From brooks at FreeBSD.org Tue Sep 1 02:33:31 2009 From: brooks at FreeBSD.org (Brooks Davis) Date: Tue Sep 1 02:33:42 2009 Subject: svn commit: r196706 - head/usr.sbin/pkg_install/lib In-Reply-To: <200908311750.n7VHoXp0034601@svn.freebsd.org> References: <200908311750.n7VHoXp0034601@svn.freebsd.org> Message-ID: <20090901023240.GF65882@lor.one-eyed-alien.net> On Mon, Aug 31, 2009 at 05:50:33PM +0000, Doug Barton wrote: > Author: dougb > Date: Mon Aug 31 17:50:33 2009 > New Revision: 196706 > URL: http://svn.freebsd.org/changeset/base/196706 > > Log: > Add support for INDEX-9 [1] > > While I'm here, strip off support for FreeBSD 5.x. I'm rather baffled as to why you'd bother removing 5.x support and keep <=4.x support. It seems vanishingly unlikely we'll ever support plain INDEX files again. -- Brooks -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 187 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090901/8498a7c7/attachment.pgp From adrian at FreeBSD.org Tue Sep 1 03:44:25 2009 From: adrian at FreeBSD.org (Adrian Chadd) Date: Tue Sep 1 03:44:32 2009 Subject: svn commit: r196725 - head/sys/i386/xen Message-ID: <200909010344.n813iPcH047578@svn.freebsd.org> Author: adrian Date: Tue Sep 1 03:44:25 2009 New Revision: 196725 URL: http://svn.freebsd.org/changeset/base/196725 Log: Fix broken build. Modified: head/sys/i386/xen/pmap.c Modified: head/sys/i386/xen/pmap.c ============================================================================== --- head/sys/i386/xen/pmap.c Mon Aug 31 23:35:59 2009 (r196724) +++ head/sys/i386/xen/pmap.c Tue Sep 1 03:44:25 2009 (r196725) @@ -311,6 +311,7 @@ static vm_offset_t pmap_kmem_choose(vm_o static boolean_t pmap_is_prefaultable_locked(pmap_t pmap, vm_offset_t addr); static void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode); +static __inline void pagezero(void *page); #if defined(PAE) && !defined(XEN) static void *pmap_pdpt_allocf(uma_zone_t zone, int bytes, u_int8_t *flags, int wait); From adrian at FreeBSD.org Tue Sep 1 05:15:46 2009 From: adrian at FreeBSD.org (Adrian Chadd) Date: Tue Sep 1 05:17:22 2009 Subject: svn commit: r196726 - head/sys/i386/xen Message-ID: <200909010515.n815FjLJ049311@svn.freebsd.org> Author: adrian Date: Tue Sep 1 05:15:45 2009 New Revision: 196726 URL: http://svn.freebsd.org/changeset/base/196726 Log: Merge in the pat_works work from sys/i386/i386/pmap.c - primarily to reduce diff size. Modified: head/sys/i386/xen/pmap.c Modified: head/sys/i386/xen/pmap.c ============================================================================== --- head/sys/i386/xen/pmap.c Tue Sep 1 03:44:25 2009 (r196725) +++ head/sys/i386/xen/pmap.c Tue Sep 1 05:15:45 2009 (r196726) @@ -223,6 +223,8 @@ static uma_zone_t pdptzone; #endif #endif +static int pat_works; /* Is page attribute table sane? */ + /* * Data for the pv entry allocation mechanism */ @@ -514,33 +516,36 @@ pmap_init_pat(void) if (!(cpu_feature & CPUID_PAT)) return; -#ifdef PAT_WORKS - /* - * Leave the indices 0-3 at the default of WB, WT, UC, and UC-. - * Program 4 and 5 as WP and WC. - * Leave 6 and 7 as UC and UC-. - */ - pat_msr = rdmsr(MSR_PAT); - pat_msr &= ~(PAT_MASK(4) | PAT_MASK(5)); - pat_msr |= PAT_VALUE(4, PAT_WRITE_PROTECTED) | - PAT_VALUE(5, PAT_WRITE_COMBINING); -#else - /* - * Due to some Intel errata, we can only safely use the lower 4 - * PAT entries. Thus, just replace PAT Index 2 with WC instead - * of UC-. - * - * Intel Pentium III Processor Specification Update - * Errata E.27 (Upper Four PAT Entries Not Usable With Mode B - * or Mode C Paging) - * - * Intel Pentium IV Processor Specification Update - * Errata N46 (PAT Index MSB May Be Calculated Incorrectly) - */ - pat_msr = rdmsr(MSR_PAT); - pat_msr &= ~PAT_MASK(2); - pat_msr |= PAT_VALUE(2, PAT_WRITE_COMBINING); -#endif + if (cpu_vendor_id != CPU_VENDOR_INTEL || + (I386_CPU_FAMILY(cpu_id) == 6 && I386_CPU_MODEL(cpu_id) >= 0xe)) { + /* + * Leave the indices 0-3 at the default of WB, WT, UC, and UC-. + * Program 4 and 5 as WP and WC. + * Leave 6 and 7 as UC and UC-. + */ + pat_msr = rdmsr(MSR_PAT); + pat_msr &= ~(PAT_MASK(4) | PAT_MASK(5)); + pat_msr |= PAT_VALUE(4, PAT_WRITE_PROTECTED) | + PAT_VALUE(5, PAT_WRITE_COMBINING); + pat_works = 1; + } else { + /* + * Due to some Intel errata, we can only safely use the lower 4 + * PAT entries. Thus, just replace PAT Index 2 with WC instead + * of UC-. + * + * Intel Pentium III Processor Specification Update + * Errata E.27 (Upper Four PAT Entries Not Usable With Mode B + * or Mode C Paging) + * + * Intel Pentium IV Processor Specification Update + * Errata N46 (PAT Index MSB May Be Calculated Incorrectly) + */ + pat_msr = rdmsr(MSR_PAT); + pat_msr &= ~PAT_MASK(2); + pat_msr |= PAT_VALUE(2, PAT_WRITE_COMBINING); + pat_works = 0; + } wrmsr(MSR_PAT, pat_msr); } @@ -769,44 +774,48 @@ pmap_cache_bits(int mode, boolean_t is_p } /* Map the caching mode to a PAT index. */ - switch (mode) { -#ifdef PAT_WORKS - case PAT_UNCACHEABLE: - pat_index = 3; - break; - case PAT_WRITE_THROUGH: - pat_index = 1; - break; - case PAT_WRITE_BACK: - pat_index = 0; - break; - case PAT_UNCACHED: - pat_index = 2; - break; - case PAT_WRITE_COMBINING: - pat_index = 5; - break; - case PAT_WRITE_PROTECTED: - pat_index = 4; - break; -#else - case PAT_UNCACHED: - case PAT_UNCACHEABLE: - case PAT_WRITE_PROTECTED: - pat_index = 3; - break; - case PAT_WRITE_THROUGH: - pat_index = 1; - break; - case PAT_WRITE_BACK: - pat_index = 0; - break; - case PAT_WRITE_COMBINING: - pat_index = 2; - break; -#endif - default: - panic("Unknown caching mode %d\n", mode); + if (pat_works) { + switch (mode) { + case PAT_UNCACHEABLE: + pat_index = 3; + break; + case PAT_WRITE_THROUGH: + pat_index = 1; + break; + case PAT_WRITE_BACK: + pat_index = 0; + break; + case PAT_UNCACHED: + pat_index = 2; + break; + case PAT_WRITE_COMBINING: + pat_index = 5; + break; + case PAT_WRITE_PROTECTED: + pat_index = 4; + break; + default: + panic("Unknown caching mode %d\n", mode); + } + } else { + switch (mode) { + case PAT_UNCACHED: + case PAT_UNCACHEABLE: + case PAT_WRITE_PROTECTED: + pat_index = 3; + break; + case PAT_WRITE_THROUGH: + pat_index = 1; + break; + case PAT_WRITE_BACK: + pat_index = 0; + break; + case PAT_WRITE_COMBINING: + pat_index = 2; + break; + default: + panic("Unknown caching mode %d\n", mode); + } } /* Map the 3-bit index value into the PAT, PCD, and PWT bits. */ From maxim at FreeBSD.org Tue Sep 1 05:55:11 2009 From: maxim at FreeBSD.org (Maxim Konovalov) Date: Tue Sep 1 05:55:17 2009 Subject: svn commit: r196727 - head/share/man/man5 Message-ID: <200909010555.n815tAkx050140@svn.freebsd.org> Author: maxim Date: Tue Sep 1 05:55:10 2009 New Revision: 196727 URL: http://svn.freebsd.org/changeset/base/196727 Log: o Document MALLOC_PRODUCTION knob. PR: docs/136029 Submitted by: anonymous MFC after: 2 weeks Modified: head/share/man/man5/make.conf.5 Modified: head/share/man/man5/make.conf.5 ============================================================================== --- head/share/man/man5/make.conf.5 Tue Sep 1 05:15:45 2009 (r196726) +++ head/share/man/man5/make.conf.5 Tue Sep 1 05:55:10 2009 (r196727) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 5, 2006 +.Dd September 1, 2009 .Dt MAKE.CONF 5 .Os .Sh NAME @@ -466,6 +466,12 @@ console driver to and allow access over FireWire(IEEE1394) using .Xr dconschat 8 . Currently, only i386 and amd64 are supported. +.It Va MALLOC_PRODUCTION +.Pq Vt bool +Set this to disable assertions and statistics gathering in +.Xr malloc 3 . +It also defaults the A and J runtime options to off. +Disabled by default on -CURRENT. .It Va MODULES_WITH_WORLD .Pq Vt bool Set to build modules with the system instead of the kernel. From adrian at FreeBSD.org Tue Sep 1 06:15:52 2009 From: adrian at FreeBSD.org (Adrian Chadd) Date: Tue Sep 1 06:16:03 2009 Subject: svn commit: r196728 - head/sys/i386/xen Message-ID: <200909010615.n816Fo0Z050607@svn.freebsd.org> Author: adrian Date: Tue Sep 1 06:15:50 2009 New Revision: 196728 URL: http://svn.freebsd.org/changeset/base/196728 Log: Migrate to use cpuset_t. Modified: head/sys/i386/xen/pmap.c Modified: head/sys/i386/xen/pmap.c ============================================================================== --- head/sys/i386/xen/pmap.c Tue Sep 1 05:55:10 2009 (r196727) +++ head/sys/i386/xen/pmap.c Tue Sep 1 06:15:50 2009 (r196728) @@ -1729,7 +1729,7 @@ retry: * Deal with a SMP shootdown of other users of the pmap that we are * trying to dispose of. This can be a bit hairy. */ -static u_int *lazymask; +static cpumask_t *lazymask; static u_int lazyptd; static volatile u_int lazywait; @@ -1738,7 +1738,7 @@ void pmap_lazyfix_action(void); void pmap_lazyfix_action(void) { - u_int mymask = PCPU_GET(cpumask); + cpumask_t mymask = PCPU_GET(cpumask); #ifdef COUNT_IPIS (*ipi_lazypmap_counts[PCPU_GET(cpuid)])++; @@ -1750,7 +1750,7 @@ pmap_lazyfix_action(void) } static void -pmap_lazyfix_self(u_int mymask) +pmap_lazyfix_self(cpumask_t mymask) { if (rcr3() == lazyptd) @@ -1762,8 +1762,7 @@ pmap_lazyfix_self(u_int mymask) static void pmap_lazyfix(pmap_t pmap) { - u_int mymask; - u_int mask; + cpumask_t mymask, mask; u_int spins; while ((mask = pmap->pm_active) != 0) { From mav at FreeBSD.org Tue Sep 1 11:13:32 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Tue Sep 1 11:13:50 2009 Subject: svn commit: r196729 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/siis dev/xen/xenpci Message-ID: <200909011113.n81BDVOq058931@svn.freebsd.org> Author: mav Date: Tue Sep 1 11:13:31 2009 New Revision: 196729 URL: http://svn.freebsd.org/changeset/base/196729 Log: MFC r196655: Update siis driver: - Add SNTF support. - Do not report meaningless transport/protocol versions. Approved by: re (ATA-CAM blanket) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/siis/siis.c stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/siis/siis.c ============================================================================== --- stable/8/sys/dev/siis/siis.c Tue Sep 1 06:15:50 2009 (r196728) +++ stable/8/sys/dev/siis/siis.c Tue Sep 1 11:13:31 2009 (r196729) @@ -647,6 +647,30 @@ siis_slotsfree(device_t dev) } static void +siis_notify_events(device_t dev) +{ + struct siis_channel *ch = device_get_softc(dev); + struct cam_path *dpath; + u_int32_t status; + int i; + + status = ATA_INL(ch->r_mem, SIIS_P_SNTF); + ATA_OUTL(ch->r_mem, SIIS_P_SNTF, status); + if (bootverbose) + device_printf(dev, "SNTF 0x%04x\n", status); + for (i = 0; i < 16; i++) { + if ((status & (1 << i)) == 0) + continue; + if (xpt_create_path(&dpath, NULL, + xpt_path_path_id(ch->path), i, 0) == CAM_REQ_CMP) { + xpt_async(AC_SCSI_AEN, dpath, NULL); + xpt_free_path(dpath); + } + } + +} + +static void siis_phy_check_events(device_t dev) { struct siis_channel *ch = device_get_softc(dev); @@ -707,6 +731,9 @@ siis_ch_intr(void *data) /* Process PHY events */ if (istatus & SIIS_P_IX_PHYRDYCHG) siis_phy_check_events(dev); + /* Process NOTIFY events */ + if (istatus & SIIS_P_IX_SDBN) + siis_notify_events(dev); /* Process command errors */ if (istatus & SIIS_P_IX_COMMERR) { estatus = ATA_INL(ch->r_mem, SIIS_P_CMDERR); @@ -1267,7 +1294,6 @@ siis_reset(device_t dev) /* XXX; Commands in loading state. */ siis_end_transaction(&ch->slot[i], SIIS_ERR_INNOCENT); } - ATA_OUTL(ch->r_mem, SIIS_P_CTLCLR, SIIS_P_CTL_PME); /* Reset and reconnect PHY, */ if (!siis_sata_phy_reset(dev)) { ch->devices = 0; @@ -1461,9 +1487,9 @@ siisaction(struct cam_sim *sim, union cc uint32_t status; cts->protocol = PROTO_ATA; - cts->protocol_version = SCSI_REV_2; + cts->protocol_version = PROTO_VERSION_UNSPECIFIED; cts->transport = XPORT_SATA; - cts->transport_version = 2; + cts->transport_version = XPORT_VERSION_UNSPECIFIED; cts->proto_specific.valid = 0; cts->xport_specific.sata.valid = 0; if (cts->type == CTS_TYPE_CURRENT_SETTINGS) @@ -1548,9 +1574,9 @@ siisaction(struct cam_sim *sim, union cc strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); cpi->unit_number = cam_sim_unit(sim); cpi->transport = XPORT_SATA; - cpi->transport_version = 2; + cpi->transport_version = XPORT_VERSION_UNSPECIFIED; cpi->protocol = PROTO_ATA; - cpi->protocol_version = SCSI_REV_2; + cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->ccb_h.status = CAM_REQ_CMP; cpi->maxio = MAXPHYS; xpt_done(ccb); From kib at FreeBSD.org Tue Sep 1 11:41:51 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Tue Sep 1 11:41:59 2009 Subject: svn commit: r196730 - in head/sys: arm/arm kern sys vm Message-ID: <200909011141.n81BfpGE060068@svn.freebsd.org> Author: kib Date: Tue Sep 1 11:41:51 2009 New Revision: 196730 URL: http://svn.freebsd.org/changeset/base/196730 Log: Reintroduce the r196640, after fixing the problem with my testing. Remove the altkstacks, instead instantiate threads with kernel stack allocated with the right size from the start. For the thread that has kernel stack cached, verify that requested stack size is equial to the actual, and reallocate the stack if sizes differ [1]. This fixes the bug introduced by r173361 that was committed several days after r173004 and consisted of kthread_add(9) ignoring the non-default kernel stack size. Also, r173361 removed the caching of the kernel stacks for a non-first thread in the process. Introduce separate kernel stack cache that keeps some limited amount of preallocated kernel stacks to lower the latency of thread allocation. Add vm_lowmem handler to prune the cache on low memory condition. This way, system with reasonable amount of the threads get lower latency of thread creation, while still not exhausting significant portion of KVA for unused kstacks. Submitted by: peter [1] Discussed with: jhb, julian, peter Reviewed by: jhb Tested by: pho (and retested according to new test scenarious) MFC after: 1 week Modified: head/sys/arm/arm/vm_machdep.c head/sys/kern/kern_fork.c head/sys/kern/kern_kthread.c head/sys/kern/kern_proc.c head/sys/kern/kern_thr.c head/sys/kern/kern_thread.c head/sys/sys/proc.h head/sys/vm/vm_extern.h head/sys/vm/vm_glue.c Modified: head/sys/arm/arm/vm_machdep.c ============================================================================== --- head/sys/arm/arm/vm_machdep.c Tue Sep 1 11:13:31 2009 (r196729) +++ head/sys/arm/arm/vm_machdep.c Tue Sep 1 11:41:51 2009 (r196730) @@ -119,9 +119,6 @@ cpu_fork(register struct thread *td1, re #ifdef __XSCALE__ #ifndef CPU_XSCALE_CORE3 pmap_use_minicache(td2->td_kstack, td2->td_kstack_pages * PAGE_SIZE); - if (td2->td_altkstack) - pmap_use_minicache(td2->td_altkstack, td2->td_altkstack_pages * - PAGE_SIZE); #endif #endif td2->td_pcb = pcb2; Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Tue Sep 1 11:13:31 2009 (r196729) +++ head/sys/kern/kern_fork.c Tue Sep 1 11:41:51 2009 (r196730) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include "opt_kdtrace.h" #include "opt_ktrace.h" +#include "opt_kstack_pages.h" #include #include @@ -276,25 +277,29 @@ norfproc_fail: mem_charged = 0; vm2 = NULL; + if (pages == 0) + pages = KSTACK_PAGES; /* Allocate new proc. */ newproc = uma_zalloc(proc_zone, M_WAITOK); - if (TAILQ_EMPTY(&newproc->p_threads)) { - td2 = thread_alloc(); + td2 = FIRST_THREAD_IN_PROC(newproc); + if (td2 == NULL) { + td2 = thread_alloc(pages); if (td2 == NULL) { error = ENOMEM; goto fail1; } proc_linkup(newproc, td2); - } else - td2 = FIRST_THREAD_IN_PROC(newproc); - - /* Allocate and switch to an alternate kstack if specified. */ - if (pages != 0) { - if (!vm_thread_new_altkstack(td2, pages)) { - error = ENOMEM; - goto fail1; + } else { + if (td2->td_kstack == 0 || td2->td_kstack_pages != pages) { + if (td2->td_kstack != 0) + vm_thread_dispose(td2); + if (!thread_alloc_stack(td2, pages)) { + error = ENOMEM; + goto fail1; + } } } + if ((flags & RFMEM) == 0) { vm2 = vmspace_fork(p1->p_vmspace, &mem_charged); if (vm2 == NULL) { Modified: head/sys/kern/kern_kthread.c ============================================================================== --- head/sys/kern/kern_kthread.c Tue Sep 1 11:13:31 2009 (r196729) +++ head/sys/kern/kern_kthread.c Tue Sep 1 11:41:51 2009 (r196730) @@ -256,7 +256,7 @@ kthread_add(void (*func)(void *), void * } /* Initialize our new td */ - newtd = thread_alloc(); + newtd = thread_alloc(pages); if (newtd == NULL) return (ENOMEM); @@ -282,9 +282,6 @@ kthread_add(void (*func)(void *), void * newtd->td_pflags |= TDP_KTHREAD; newtd->td_ucred = crhold(p->p_ucred); - /* Allocate and switch to an alternate kstack if specified. */ - if (pages != 0) - vm_thread_new_altkstack(newtd, pages); /* this code almost the same as create_thread() in kern_thr.c */ PROC_LOCK(p); Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Tue Sep 1 11:13:31 2009 (r196729) +++ head/sys/kern/kern_proc.c Tue Sep 1 11:41:51 2009 (r196730) @@ -203,14 +203,6 @@ proc_dtor(void *mem, int size, void *arg #endif /* Free all OSD associated to this thread. */ osd_thread_exit(td); - - /* Dispose of an alternate kstack, if it exists. - * XXX What if there are more than one thread in the proc? - * The first thread in the proc is special and not - * freed, so you gotta do this here. - */ - if (((p->p_flag & P_KTHREAD) != 0) && (td->td_altkstack != 0)) - vm_thread_dispose_altkstack(td); } EVENTHANDLER_INVOKE(process_dtor, p); if (p->p_ksi != NULL) @@ -767,8 +759,6 @@ fill_kinfo_proc_only(struct proc *p, str FOREACH_THREAD_IN_PROC(p, td0) { if (!TD_IS_SWAPPED(td0)) kp->ki_rssize += td0->td_kstack_pages; - if (td0->td_altkstack_obj != NULL) - kp->ki_rssize += td0->td_altkstack_pages; } kp->ki_swrss = vm->vm_swrss; kp->ki_tsize = vm->vm_tsize; Modified: head/sys/kern/kern_thr.c ============================================================================== --- head/sys/kern/kern_thr.c Tue Sep 1 11:13:31 2009 (r196729) +++ head/sys/kern/kern_thr.c Tue Sep 1 11:41:51 2009 (r196730) @@ -176,7 +176,7 @@ create_thread(struct thread *td, mcontex } /* Initialize our td */ - newtd = thread_alloc(); + newtd = thread_alloc(0); if (newtd == NULL) return (ENOMEM); Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Tue Sep 1 11:13:31 2009 (r196729) +++ head/sys/kern/kern_thread.c Tue Sep 1 11:41:51 2009 (r196730) @@ -283,7 +283,7 @@ thread_reap(void) * Allocate a thread. */ struct thread * -thread_alloc(void) +thread_alloc(int pages) { struct thread *td; @@ -291,7 +291,7 @@ thread_alloc(void) td = (struct thread *)uma_zalloc(thread_zone, M_WAITOK); KASSERT(td->td_kstack == 0, ("thread_alloc got thread with kstack")); - if (!vm_thread_new(td, 0)) { + if (!vm_thread_new(td, pages)) { uma_zfree(thread_zone, td); return (NULL); } @@ -299,6 +299,17 @@ thread_alloc(void) return (td); } +int +thread_alloc_stack(struct thread *td, int pages) +{ + + KASSERT(td->td_kstack == 0, + ("thread_alloc_stack called on a thread with kstack")); + if (!vm_thread_new(td, pages)) + return (0); + cpu_thread_alloc(td); + return (1); +} /* * Deallocate a thread. @@ -312,8 +323,6 @@ thread_free(struct thread *td) cpuset_rel(td->td_cpuset); td->td_cpuset = NULL; cpu_thread_free(td); - if (td->td_altkstack != 0) - vm_thread_dispose_altkstack(td); if (td->td_kstack != 0) vm_thread_dispose(td); uma_zfree(thread_zone, td); Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Tue Sep 1 11:13:31 2009 (r196729) +++ head/sys/sys/proc.h Tue Sep 1 11:41:51 2009 (r196730) @@ -267,9 +267,6 @@ struct thread { struct vm_object *td_kstack_obj;/* (a) Kstack object. */ vm_offset_t td_kstack; /* (a) Kernel VA of kstack. */ int td_kstack_pages; /* (a) Size of the kstack. */ - struct vm_object *td_altkstack_obj;/* (a) Alternate kstack object. */ - vm_offset_t td_altkstack; /* (a) Kernel VA of alternate kstack. */ - int td_altkstack_pages; /* (a) Size of alternate kstack. */ volatile u_int td_critnest; /* (k*) Critical section nest level. */ struct mdthread td_md; /* (k) Any machine-dependent fields. */ struct td_sched *td_sched; /* (*) Scheduler-specific data. */ @@ -850,7 +847,8 @@ void cpu_thread_exit(struct thread *); void cpu_thread_free(struct thread *); void cpu_thread_swapin(struct thread *); void cpu_thread_swapout(struct thread *); -struct thread *thread_alloc(void); +struct thread *thread_alloc(int pages); +int thread_alloc_stack(struct thread *, int pages); void thread_exit(void) __dead2; void thread_free(struct thread *td); void thread_link(struct thread *td, struct proc *p); Modified: head/sys/vm/vm_extern.h ============================================================================== --- head/sys/vm/vm_extern.h Tue Sep 1 11:13:31 2009 (r196729) +++ head/sys/vm/vm_extern.h Tue Sep 1 11:41:51 2009 (r196730) @@ -80,9 +80,7 @@ int vm_fault_quick(caddr_t v, int prot); struct sf_buf *vm_imgact_map_page(vm_object_t object, vm_ooffset_t offset); void vm_imgact_unmap_page(struct sf_buf *sf); void vm_thread_dispose(struct thread *td); -void vm_thread_dispose_altkstack(struct thread *td); int vm_thread_new(struct thread *td, int pages); -int vm_thread_new_altkstack(struct thread *td, int pages); void vm_thread_swapin(struct thread *td); void vm_thread_swapout(struct thread *td); #endif /* _KERNEL */ Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Tue Sep 1 11:13:31 2009 (r196729) +++ head/sys/vm/vm_glue.c Tue Sep 1 11:41:51 2009 (r196730) @@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -308,6 +309,20 @@ vm_imgact_unmap_page(struct sf_buf *sf) vm_page_unlock_queues(); } +struct kstack_cache_entry { + vm_object_t ksobj; + struct kstack_cache_entry *next_ks_entry; +}; + +static struct kstack_cache_entry *kstack_cache; +static int kstack_cache_size = 128; +static int kstacks; +static struct mtx kstack_cache_mtx; +SYSCTL_INT(_vm, OID_AUTO, kstack_cache_size, CTLFLAG_RW, &kstack_cache_size, 0, + ""); +SYSCTL_INT(_vm, OID_AUTO, kstacks, CTLFLAG_RD, &kstacks, 0, + ""); + #ifndef KSTACK_MAX_PAGES #define KSTACK_MAX_PAGES 32 #endif @@ -323,6 +338,7 @@ vm_thread_new(struct thread *td, int pag vm_object_t ksobj; vm_offset_t ks; vm_page_t m, ma[KSTACK_MAX_PAGES]; + struct kstack_cache_entry *ks_ce; int i; /* Bounds check */ @@ -330,6 +346,22 @@ vm_thread_new(struct thread *td, int pag pages = KSTACK_PAGES; else if (pages > KSTACK_MAX_PAGES) pages = KSTACK_MAX_PAGES; + + if (pages == KSTACK_PAGES) { + mtx_lock(&kstack_cache_mtx); + if (kstack_cache != NULL) { + ks_ce = kstack_cache; + kstack_cache = ks_ce->next_ks_entry; + mtx_unlock(&kstack_cache_mtx); + + td->td_kstack_obj = ks_ce->ksobj; + td->td_kstack = (vm_offset_t)ks_ce; + td->td_kstack_pages = KSTACK_PAGES; + return (1); + } + mtx_unlock(&kstack_cache_mtx); + } + /* * Allocate an object for the kstack. */ @@ -345,7 +377,8 @@ vm_thread_new(struct thread *td, int pag vm_object_deallocate(ksobj); return (0); } - + + atomic_add_int(&kstacks, 1); if (KSTACK_GUARD_PAGES != 0) { pmap_qremove(ks, KSTACK_GUARD_PAGES); ks += KSTACK_GUARD_PAGES * PAGE_SIZE; @@ -376,20 +409,13 @@ vm_thread_new(struct thread *td, int pag return (1); } -/* - * Dispose of a thread's kernel stack. - */ -void -vm_thread_dispose(struct thread *td) +static void +vm_thread_stack_dispose(vm_object_t ksobj, vm_offset_t ks, int pages) { - vm_object_t ksobj; - vm_offset_t ks; vm_page_t m; - int i, pages; + int i; - pages = td->td_kstack_pages; - ksobj = td->td_kstack_obj; - ks = td->td_kstack; + atomic_add_int(&kstacks, -1); pmap_qremove(ks, pages); VM_OBJECT_LOCK(ksobj); for (i = 0; i < pages; i++) { @@ -405,9 +431,66 @@ vm_thread_dispose(struct thread *td) vm_object_deallocate(ksobj); kmem_free(kernel_map, ks - (KSTACK_GUARD_PAGES * PAGE_SIZE), (pages + KSTACK_GUARD_PAGES) * PAGE_SIZE); +} + +/* + * Dispose of a thread's kernel stack. + */ +void +vm_thread_dispose(struct thread *td) +{ + vm_object_t ksobj; + vm_offset_t ks; + struct kstack_cache_entry *ks_ce; + int pages; + + pages = td->td_kstack_pages; + ksobj = td->td_kstack_obj; + ks = td->td_kstack; td->td_kstack = 0; + td->td_kstack_pages = 0; + if (pages == KSTACK_PAGES && kstacks <= kstack_cache_size) { + ks_ce = (struct kstack_cache_entry *)ks; + ks_ce->ksobj = ksobj; + mtx_lock(&kstack_cache_mtx); + ks_ce->next_ks_entry = kstack_cache; + kstack_cache = ks_ce; + mtx_unlock(&kstack_cache_mtx); + return; + } + vm_thread_stack_dispose(ksobj, ks, pages); +} + +static void +vm_thread_stack_lowmem(void *nulll) +{ + struct kstack_cache_entry *ks_ce, *ks_ce1; + + mtx_lock(&kstack_cache_mtx); + ks_ce = kstack_cache; + kstack_cache = NULL; + mtx_unlock(&kstack_cache_mtx); + + while (ks_ce != NULL) { + ks_ce1 = ks_ce; + ks_ce = ks_ce->next_ks_entry; + + vm_thread_stack_dispose(ks_ce1->ksobj, (vm_offset_t)ks_ce1, + KSTACK_PAGES); + } +} + +static void +kstack_cache_init(void *nulll) +{ + + EVENTHANDLER_REGISTER(vm_lowmem, vm_thread_stack_lowmem, NULL, + EVENTHANDLER_PRI_ANY); } +MTX_SYSINIT(kstack_cache, &kstack_cache_mtx, "kstkch", MTX_DEF); +SYSINIT(vm_kstacks, SI_SUB_KTHREAD_INIT, SI_ORDER_ANY, kstack_cache_init, NULL); + /* * Allow a thread's kernel stack to be paged out. */ @@ -468,37 +551,6 @@ vm_thread_swapin(struct thread *td) } /* - * Set up a variable-sized alternate kstack. - */ -int -vm_thread_new_altkstack(struct thread *td, int pages) -{ - - td->td_altkstack = td->td_kstack; - td->td_altkstack_obj = td->td_kstack_obj; - td->td_altkstack_pages = td->td_kstack_pages; - - return (vm_thread_new(td, pages)); -} - -/* - * Restore the original kstack. - */ -void -vm_thread_dispose_altkstack(struct thread *td) -{ - - vm_thread_dispose(td); - - td->td_kstack = td->td_altkstack; - td->td_kstack_obj = td->td_altkstack_obj; - td->td_kstack_pages = td->td_altkstack_pages; - td->td_altkstack = 0; - td->td_altkstack_obj = NULL; - td->td_altkstack_pages = 0; -} - -/* * Implement fork's actions on an address space. * Here we arrange for the address space to be copied or referenced, * allocate a user struct (pcb and kernel stack), then call the From mav at FreeBSD.org Tue Sep 1 11:44:30 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Tue Sep 1 11:44:43 2009 Subject: svn commit: r196731 - in stable/8: share/man/man4 sys sys/amd64/include/xen sys/cddl/contrib/opensolaris sys/contrib/dev/acpica sys/contrib/pf sys/dev/ahci sys/dev/xen/xenpci Message-ID: <200909011144.n81BiUxH060169@svn.freebsd.org> Author: mav Date: Tue Sep 1 11:44:30 2009 New Revision: 196731 URL: http://svn.freebsd.org/changeset/base/196731 Log: MFC r196656, r196660: Update ahci driver: - Add Command Completion Coalescing support. - Add SNTF support. - Add two more power management modes (4, 5), implemented on driver level. - Fix interface mode setting. - Reduce interface reset time. - Do not report meaningless protocol/transport versions. - Report CAP2 register content. - Some performance optimizations. Approved by: re (ATA-CAM blanket) Modified: stable/8/share/man/man4/ (props changed) stable/8/share/man/man4/ahci.4 stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/ahci/ahci.c stable/8/sys/dev/ahci/ahci.h stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/share/man/man4/ahci.4 ============================================================================== --- stable/8/share/man/man4/ahci.4 Tue Sep 1 11:41:51 2009 (r196730) +++ stable/8/share/man/man4/ahci.4 Tue Sep 1 11:44:30 2009 (r196731) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 26, 2009 +.Dd August 24, 2009 .Dt AHCI 4 .Os .Sh NAME @@ -60,6 +60,13 @@ single MSI vector used, if supported (de .It 2 multiple MSI vectors used, if supported; .El +.It Va hint.ahci.X.ccc +controls Command Completion Coalescing (CCC) usage by the specified controller. +Non-zero value enables CCC and defines maximum time (in ms), request can wait +for interrupt, if there are some more requests present on controller queue. +CCC reduces number of context switches on systems with many parallel requests, +but it can decrease disk performance on some workloads due to additional +command latency. .It Va hint.ahcich.X.pm_level controls SATA interface Power Management for specified channel, allowing some power to be saved at the cost of additional command @@ -74,7 +81,15 @@ device is allowed to initiate PM state c host initiates PARTIAL PM state transition every time port becomes idle; .It 3 host initiates SLUMBER PM state transition every time port becomes idle. +.It 4 +driver initiates PARTIAL PM state transition 1ms after port becomes idle; +.It 5 +driver initiates SLUMBER PM state transition 125ms after port becomes idle. .El +Some controllers, such as ICH8, do not implement modes 2 and 3 with NCQ used. +Because of artificial entering latency, performance degradation in modes +4 and 5 is much smaller then in modes 2 and 3. +.Pp Note that interface Power Management is not compatible with device presence detection. You will have to reset bus manually on device hot-plug. Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Tue Sep 1 11:41:51 2009 (r196730) +++ stable/8/sys/dev/ahci/ahci.c Tue Sep 1 11:44:30 2009 (r196731) @@ -63,6 +63,7 @@ static int ahci_suspend(device_t dev); static int ahci_resume(device_t dev); static int ahci_ch_suspend(device_t dev); static int ahci_ch_resume(device_t dev); +static void ahci_ch_pm(void *arg); static void ahci_ch_intr_locked(void *data); static void ahci_ch_intr(void *data); static int ahci_ctlr_reset(device_t dev); @@ -121,9 +122,11 @@ ahci_attach(device_t dev) struct ahci_controller *ctlr = device_get_softc(dev); device_t child; int error, unit, speed; - u_int32_t version, caps; + u_int32_t version; ctlr->dev = dev; + resource_int_value(device_get_name(dev), + device_get_unit(dev), "ccc", &ctlr->ccc); /* if we have a memory BAR(5) we are likely on an AHCI part */ ctlr->r_rid = PCIR_BAR(5); if (!(ctlr->r_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, @@ -160,41 +163,49 @@ ahci_attach(device_t dev) } /* Announce HW capabilities. */ version = ATA_INL(ctlr->r_mem, AHCI_VS); - caps = ATA_INL(ctlr->r_mem, AHCI_CAP); - speed = (caps & AHCI_CAP_ISS) >> AHCI_CAP_ISS_SHIFT; + ctlr->caps = ATA_INL(ctlr->r_mem, AHCI_CAP); + if (version >= 0x00010020) + ctlr->caps2 = ATA_INL(ctlr->r_mem, AHCI_CAP2); + speed = (ctlr->caps & AHCI_CAP_ISS) >> AHCI_CAP_ISS_SHIFT; device_printf(dev, "AHCI v%x.%02x with %d %sGbps ports, Port Multiplier %s\n", ((version >> 20) & 0xf0) + ((version >> 16) & 0x0f), ((version >> 4) & 0xf0) + (version & 0x0f), - (caps & AHCI_CAP_NPMASK) + 1, + (ctlr->caps & AHCI_CAP_NPMASK) + 1, ((speed == 1) ? "1.5":((speed == 2) ? "3": ((speed == 3) ? "6":"?"))), - (caps & AHCI_CAP_SPM) ? + (ctlr->caps & AHCI_CAP_SPM) ? "supported" : "not supported"); if (bootverbose) { device_printf(dev, "Caps:%s%s%s%s%s%s%s%s %sGbps", - (caps & AHCI_CAP_64BIT) ? " 64bit":"", - (caps & AHCI_CAP_SNCQ) ? " NCQ":"", - (caps & AHCI_CAP_SSNTF) ? " SNTF":"", - (caps & AHCI_CAP_SMPS) ? " MPS":"", - (caps & AHCI_CAP_SSS) ? " SS":"", - (caps & AHCI_CAP_SALP) ? " ALP":"", - (caps & AHCI_CAP_SAL) ? " AL":"", - (caps & AHCI_CAP_SCLO) ? " CLO":"", + (ctlr->caps & AHCI_CAP_64BIT) ? " 64bit":"", + (ctlr->caps & AHCI_CAP_SNCQ) ? " NCQ":"", + (ctlr->caps & AHCI_CAP_SSNTF) ? " SNTF":"", + (ctlr->caps & AHCI_CAP_SMPS) ? " MPS":"", + (ctlr->caps & AHCI_CAP_SSS) ? " SS":"", + (ctlr->caps & AHCI_CAP_SALP) ? " ALP":"", + (ctlr->caps & AHCI_CAP_SAL) ? " AL":"", + (ctlr->caps & AHCI_CAP_SCLO) ? " CLO":"", ((speed == 1) ? "1.5":((speed == 2) ? "3": ((speed == 3) ? "6":"?")))); printf("%s%s%s%s%s%s %dcmd%s%s%s %dports\n", - (caps & AHCI_CAP_SAM) ? " AM":"", - (caps & AHCI_CAP_SPM) ? " PM":"", - (caps & AHCI_CAP_FBSS) ? " FBS":"", - (caps & AHCI_CAP_PMD) ? " PMD":"", - (caps & AHCI_CAP_SSC) ? " SSC":"", - (caps & AHCI_CAP_PSC) ? " PSC":"", - ((caps & AHCI_CAP_NCS) >> AHCI_CAP_NCS_SHIFT) + 1, - (caps & AHCI_CAP_CCCS) ? " CCC":"", - (caps & AHCI_CAP_EMS) ? " EM":"", - (caps & AHCI_CAP_SXS) ? " eSATA":"", - (caps & AHCI_CAP_NPMASK) + 1); + (ctlr->caps & AHCI_CAP_SAM) ? " AM":"", + (ctlr->caps & AHCI_CAP_SPM) ? " PM":"", + (ctlr->caps & AHCI_CAP_FBSS) ? " FBS":"", + (ctlr->caps & AHCI_CAP_PMD) ? " PMD":"", + (ctlr->caps & AHCI_CAP_SSC) ? " SSC":"", + (ctlr->caps & AHCI_CAP_PSC) ? " PSC":"", + ((ctlr->caps & AHCI_CAP_NCS) >> AHCI_CAP_NCS_SHIFT) + 1, + (ctlr->caps & AHCI_CAP_CCCS) ? " CCC":"", + (ctlr->caps & AHCI_CAP_EMS) ? " EM":"", + (ctlr->caps & AHCI_CAP_SXS) ? " eSATA":"", + (ctlr->caps & AHCI_CAP_NPMASK) + 1); + } + if (bootverbose && version >= 0x00010020) { + device_printf(dev, "Caps2:%s%s%s\n", + (ctlr->caps2 & AHCI_CAP2_APST) ? " APST":"", + (ctlr->caps2 & AHCI_CAP2_NVMP) ? " NVMP":"", + (ctlr->caps2 & AHCI_CAP2_BOH) ? " BOH":""); } /* Attach all channels on this controller */ for (unit = 0; unit < ctlr->channels; unit++) { @@ -266,6 +277,21 @@ ahci_ctlr_reset(device_t dev) ATA_OUTL(ctlr->r_mem, AHCI_GHC, AHCI_GHC_AE); /* Clear interrupts */ ATA_OUTL(ctlr->r_mem, AHCI_IS, ATA_INL(ctlr->r_mem, AHCI_IS)); + /* Configure CCC */ + if (ctlr->ccc) { + ATA_OUTL(ctlr->r_mem, AHCI_CCCP, ATA_INL(ctlr->r_mem, AHCI_PI)); + ATA_OUTL(ctlr->r_mem, AHCI_CCCC, + (ctlr->ccc << AHCI_CCCC_TV_SHIFT) | + (4 << AHCI_CCCC_CC_SHIFT) | + AHCI_CCCC_EN); + ctlr->cccv = (ATA_INL(ctlr->r_mem, AHCI_CCCC) & + AHCI_CCCC_INT_MASK) >> AHCI_CCCC_INT_SHIFT; + if (bootverbose) { + device_printf(dev, + "CCC with %dms/4cmd enabled on vector %d\n", + ctlr->ccc, ctlr->cccv); + } + } /* Enable AHCI interrupts */ ATA_OUTL(ctlr->r_mem, AHCI_GHC, ATA_INL(ctlr->r_mem, AHCI_GHC) | AHCI_GHC_IE); @@ -326,7 +352,8 @@ ahci_setup_interrupt(device_t dev) for (i = 0; i < ctlr->numirqs; i++) { ctlr->irqs[i].ctlr = ctlr; ctlr->irqs[i].r_irq_rid = i + (msi ? 1 : 0); - if (ctlr->numirqs == 1 || i >= ctlr->channels) + if (ctlr->numirqs == 1 || i >= ctlr->channels || + (ctlr->ccc && i == ctlr->cccv)) ctlr->irqs[i].mode = AHCI_IRQ_MODE_ALL; else if (i == ctlr->numirqs - 1) ctlr->irqs[i].mode = AHCI_IRQ_MODE_AFTER; @@ -360,11 +387,16 @@ ahci_intr(void *data) void *arg; int unit; - is = ATA_INL(ctlr->r_mem, AHCI_IS); - if (irq->mode == AHCI_IRQ_MODE_ALL) + if (irq->mode == AHCI_IRQ_MODE_ALL) { unit = 0; - else /* AHCI_IRQ_MODE_AFTER */ + if (ctlr->ccc) + is = ctlr->ichannels; + else + is = ATA_INL(ctlr->r_mem, AHCI_IS); + } else { /* AHCI_IRQ_MODE_AFTER */ unit = irq->r_irq_rid - 1; + is = ATA_INL(ctlr->r_mem, AHCI_IS); + } for (; unit < ctlr->channels; unit++) { if ((is & (1 << unit)) != 0 && (arg = ctlr->interrupt[unit].argument)) { @@ -523,10 +555,14 @@ ahci_ch_attach(device_t dev) ch->dev = dev; ch->unit = (intptr_t)device_get_ivars(dev); - ch->caps = ATA_INL(ctlr->r_mem, AHCI_CAP); + ch->caps = ctlr->caps; + ch->caps2 = ctlr->caps2; ch->numslots = ((ch->caps & AHCI_CAP_NCS) >> AHCI_CAP_NCS_SHIFT) + 1, + mtx_init(&ch->mtx, "AHCI channel lock", NULL, MTX_DEF); resource_int_value(device_get_name(dev), device_get_unit(dev), "pm_level", &ch->pm_level); + if (ch->pm_level > 3) + callout_init_mtx(&ch->pm_timer, &ch->mtx, 0); /* Limit speed for my onboard JMicron external port. * It is not eSATA really. */ if (pci_get_devid(ctlr->dev) == 0x2363197b && @@ -536,7 +572,6 @@ ahci_ch_attach(device_t dev) ch->sata_rev = 1; resource_int_value(device_get_name(dev), device_get_unit(dev), "sata_rev", &ch->sata_rev); - mtx_init(&ch->mtx, "AHCI channel lock", NULL, MTX_DEF); rid = ch->unit; if (!(ch->r_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE))) @@ -584,6 +619,11 @@ ahci_ch_attach(device_t dev) error = ENXIO; goto err3; } + if (ch->pm_level > 3) { + callout_reset(&ch->pm_timer, + (ch->pm_level == 4) ? hz / 1000 : hz / 8, + ahci_ch_pm, dev); + } mtx_unlock(&ch->mtx); return (0); @@ -610,6 +650,8 @@ ahci_ch_detach(device_t dev) cam_sim_free(ch->sim, /*free_devq*/TRUE); mtx_unlock(&ch->mtx); + if (ch->pm_level > 3) + callout_drain(&ch->pm_timer); bus_teardown_intr(dev, ch->r_irq, ch->ih); bus_release_resource(dev, SYS_RES_IRQ, ATA_IRQ_RID, ch->r_irq); @@ -661,7 +703,7 @@ ahci_ch_resume(device_t dev) /* Activate the channel and power/spin up device */ ATA_OUTL(ch->r_mem, AHCI_P_CMD, (AHCI_P_CMD_ACTIVE | AHCI_P_CMD_POD | AHCI_P_CMD_SUD | - ((ch->pm_level > 1) ? AHCI_P_CMD_ALPE : 0) | + ((ch->pm_level == 2 || ch->pm_level == 3) ? AHCI_P_CMD_ALPE : 0) | ((ch->pm_level > 2) ? AHCI_P_CMD_ASP : 0 ))); ahci_start_fr(dev); ahci_start(dev); @@ -815,6 +857,7 @@ ahci_slotsfree(device_t dev) for (i = 0; i < ch->numslots; i++) { struct ahci_slot *slot = &ch->slot[i]; + callout_drain(&slot->timeout); if (slot->dma.data_map) { bus_dmamap_destroy(ch->dma.data_tag, slot->dma.data_map); slot->dma.data_map = NULL; @@ -848,6 +891,31 @@ ahci_phy_check_events(device_t dev) } static void +ahci_notify_events(device_t dev) +{ + struct ahci_channel *ch = device_get_softc(dev); + struct cam_path *dpath; + u_int32_t status; + int i; + + status = ATA_INL(ch->r_mem, AHCI_P_SNTF); + if (status == 0) + return; + ATA_OUTL(ch->r_mem, AHCI_P_SNTF, status); + if (bootverbose) + device_printf(dev, "SNTF 0x%04x\n", status); + for (i = 0; i < 16; i++) { + if ((status & (1 << i)) == 0) + continue; + if (xpt_create_path(&dpath, NULL, + xpt_path_path_id(ch->path), i, 0) == CAM_REQ_CMP) { + xpt_async(AC_SCSI_AEN, dpath, NULL); + xpt_free_path(dpath); + } + } +} + +static void ahci_ch_intr_locked(void *data) { device_t dev = (device_t)data; @@ -859,6 +927,23 @@ ahci_ch_intr_locked(void *data) } static void +ahci_ch_pm(void *arg) +{ + device_t dev = (device_t)arg; + struct ahci_channel *ch = device_get_softc(dev); + uint32_t work; + + if (ch->numrslots != 0) + return; + work = ATA_INL(ch->r_mem, AHCI_P_CMD); + if (ch->pm_level == 4) + work |= AHCI_P_CMD_PARTIAL; + else + work |= AHCI_P_CMD_SLUMBER; + ATA_OUTL(ch->r_mem, AHCI_P_CMD, work); +} + +static void ahci_ch_intr(void *data) { device_t dev = (device_t)data; @@ -869,6 +954,8 @@ ahci_ch_intr(void *data) /* Read and clear interrupt statuses. */ istatus = ATA_INL(ch->r_mem, AHCI_P_IS); + if (istatus == 0) + return; ATA_OUTL(ch->r_mem, AHCI_P_IS, istatus); /* Read command statuses. */ cstatus = ATA_INL(ch->r_mem, AHCI_P_CI); @@ -884,17 +971,16 @@ ahci_ch_intr(void *data) // ATA_INL(ch->r_mem, AHCI_P_SERR)); ccs = (ATA_INL(ch->r_mem, AHCI_P_CMD) & AHCI_P_CMD_CCS_MASK) >> AHCI_P_CMD_CCS_SHIFT; + err = ch->rslots & (cstatus | sstatus); /* Kick controller into sane state */ ahci_stop(dev); ahci_start(dev); - ok = ch->rslots & ~(cstatus | sstatus); - err = ch->rslots & (cstatus | sstatus); } else { ccs = 0; - ok = ch->rslots & ~(cstatus | sstatus); err = 0; } /* Complete all successfull commands. */ + ok = ch->rslots & ~(cstatus | sstatus); for (i = 0; i < ch->numslots; i++) { if ((ok >> i) & 1) ahci_end_transaction(&ch->slot[i], AHCI_ERR_NONE); @@ -936,6 +1022,9 @@ ahci_ch_intr(void *data) if (ncq_err) ahci_issue_read_log(dev); } + /* Process NOTIFY events */ + if ((istatus & AHCI_P_IX_SDB) && (ch->caps & AHCI_CAP_SSNTF)) + ahci_notify_events(dev); } /* Must be called with channel locked. */ @@ -980,19 +1069,18 @@ ahci_begin_transaction(device_t dev, uni /* Choose empty slot. */ tag = ch->lastslot; - do { - tag++; - if (tag >= ch->numslots) + while (ch->slot[tag].state != AHCI_SLOT_EMPTY) { + if (++tag >= ch->numslots) tag = 0; - if (ch->slot[tag].state == AHCI_SLOT_EMPTY) - break; - } while (tag != ch->lastslot); - if (ch->slot[tag].state != AHCI_SLOT_EMPTY) - device_printf(ch->dev, "ALL SLOTS BUSY!\n"); + KASSERT(tag != ch->lastslot, ("ahci: ALL SLOTS BUSY!")); + } ch->lastslot = tag; /* Occupy chosen slot. */ slot = &ch->slot[tag]; slot->ccb = ccb; + /* Stop PM timer. */ + if (ch->numrslots == 0 && ch->pm_level > 3) + callout_stop(&ch->pm_timer); /* Update channel stats. */ ch->numrslots++; if ((ccb->ccb_h.func_code == XPT_ATA_IO) && @@ -1162,6 +1250,10 @@ ahci_timeout(struct ahci_slot *slot) struct ahci_channel *ch = device_get_softc(dev); int i; + /* Check for stale timeout. */ + if (slot->state != AHCI_SLOT_RUNNING) + return; + device_printf(dev, "Timeout on slot %d\n", slot->slot); /* Kick controller into sane state. */ ahci_stop(ch->dev); @@ -1194,8 +1286,6 @@ ahci_end_transaction(struct ahci_slot *s struct ahci_channel *ch = device_get_softc(dev); union ccb *ccb = slot->ccb; - /* Cancel command execution timeout */ - callout_stop(&slot->timeout); bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map, BUS_DMASYNC_POSTWRITE); /* Read result registers to the result struct @@ -1302,6 +1392,11 @@ ahci_end_transaction(struct ahci_slot *s ahci_begin_transaction(dev, fccb); xpt_release_simq(ch->sim, TRUE); } + /* Start PM timer. */ + if (ch->numrslots == 0 && ch->pm_level > 3) { + callout_schedule(&ch->pm_timer, + (ch->pm_level == 4) ? hz / 1000 : hz / 8); + } } static void @@ -1516,6 +1611,7 @@ static void ahci_reset(device_t dev) { struct ahci_channel *ch = device_get_softc(dev); + struct ahci_controller *ctlr = device_get_softc(device_get_parent(dev)); int i; if (bootverbose) @@ -1562,10 +1658,10 @@ ahci_reset(device_t dev) (AHCI_P_IX_CPD | AHCI_P_IX_TFE | AHCI_P_IX_HBF | AHCI_P_IX_HBD | AHCI_P_IX_IF | AHCI_P_IX_OF | ((ch->pm_level == 0) ? AHCI_P_IX_PRC | AHCI_P_IX_PC : 0) | - AHCI_P_IX_DP | AHCI_P_IX_UF | AHCI_P_IX_SDB | - AHCI_P_IX_DS | AHCI_P_IX_PS | AHCI_P_IX_DHR)); + AHCI_P_IX_DP | AHCI_P_IX_UF | (ctlr->ccc ? 0 : AHCI_P_IX_SDB) | + AHCI_P_IX_DS | AHCI_P_IX_PS | (ctlr->ccc ? 0 : AHCI_P_IX_DHR))); if (bootverbose) - device_printf(dev, "AHCI reset done: devices=%08x\n", ch->devices); + device_printf(dev, "AHCI reset done: device found\n"); /* Tell the XPT about the event */ xpt_async(AC_BUS_RESET, ch->path, NULL); } @@ -1632,6 +1728,13 @@ ahci_sata_connect(struct ahci_channel *c ((status & ATA_SS_SPD_MASK) != ATA_SS_SPD_NO_SPEED) && ((status & ATA_SS_IPM_MASK) == ATA_SS_IPM_ACTIVE)) break; + if ((status & ATA_SS_DET_MASK) == ATA_SS_DET_PHY_OFFLINE) { + if (bootverbose) { + device_printf(ch->dev, "SATA offline status=%08x\n", + status); + } + return (0); + } DELAY(1000); } if (timeout >= 100) { @@ -1664,9 +1767,6 @@ ahci_sata_phy_reset(device_t dev, int qu if (bootverbose) device_printf(dev, "hardware reset ...\n"); - ATA_OUTL(ch->r_mem, AHCI_P_SCTL, ATA_SC_IPM_DIS_PARTIAL | - ATA_SC_IPM_DIS_SLUMBER | ATA_SC_DET_RESET); - DELAY(50000); if (ch->sata_rev == 1) val = ATA_SC_SPD_SPEED_GEN1; else if (ch->sata_rev == 2) @@ -1676,9 +1776,13 @@ ahci_sata_phy_reset(device_t dev, int qu else val = 0; ATA_OUTL(ch->r_mem, AHCI_P_SCTL, + ATA_SC_DET_RESET | val | + ATA_SC_IPM_DIS_PARTIAL | ATA_SC_IPM_DIS_SLUMBER); + DELAY(5000); + ATA_OUTL(ch->r_mem, AHCI_P_SCTL, ATA_SC_DET_IDLE | val | ((ch->pm_level > 0) ? 0 : (ATA_SC_IPM_DIS_PARTIAL | ATA_SC_IPM_DIS_SLUMBER))); - DELAY(50000); + DELAY(5000); return (ahci_sata_connect(ch)); } @@ -1739,9 +1843,9 @@ ahciaction(struct cam_sim *sim, union cc uint32_t status; cts->protocol = PROTO_ATA; - cts->protocol_version = SCSI_REV_2; + cts->protocol_version = PROTO_VERSION_UNSPECIFIED; cts->transport = XPORT_SATA; - cts->transport_version = 2; + cts->transport_version = XPORT_VERSION_UNSPECIFIED; cts->proto_specific.valid = 0; cts->xport_specific.sata.valid = 0; if (cts->type == CTS_TYPE_CURRENT_SETTINGS) @@ -1834,9 +1938,9 @@ ahciaction(struct cam_sim *sim, union cc strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN); cpi->unit_number = cam_sim_unit(sim); cpi->transport = XPORT_SATA; - cpi->transport_version = 2; + cpi->transport_version = XPORT_VERSION_UNSPECIFIED; cpi->protocol = PROTO_ATA; - cpi->protocol_version = SCSI_REV_2; + cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->maxio = MAXPHYS; cpi->ccb_h.status = CAM_REQ_CMP; xpt_done(ccb); Modified: stable/8/sys/dev/ahci/ahci.h ============================================================================== --- stable/8/sys/dev/ahci/ahci.h Tue Sep 1 11:41:51 2009 (r196730) +++ stable/8/sys/dev/ahci/ahci.h Tue Sep 1 11:44:30 2009 (r196731) @@ -176,6 +176,21 @@ #define AHCI_PI 0x0c #define AHCI_VS 0x10 +#define AHCI_CCCC 0x14 +#define AHCI_CCCC_TV_MASK 0xffff0000 +#define AHCI_CCCC_TV_SHIFT 16 +#define AHCI_CCCC_CC_MASK 0x0000ff00 +#define AHCI_CCCC_CC_SHIFT 8 +#define AHCI_CCCC_INT_MASK 0x000000f8 +#define AHCI_CCCC_INT_SHIFT 3 +#define AHCI_CCCC_EN 0x00000001 +#define AHCI_CCCP 0x18 + +#define AHCI_CAP2 0x24 +#define AHCI_CAP2_BOH 0x00000001 +#define AHCI_CAP2_NVMP 0x00000002 +#define AHCI_CAP2_APST 0x00000004 + #define AHCI_OFFSET 0x100 #define AHCI_STEP 0x80 @@ -336,6 +351,7 @@ struct ahci_channel { struct cam_sim *sim; struct cam_path *path; uint32_t caps; /* Controller capabilities */ + uint32_t caps2; /* Controller capabilities */ int numslots; /* Number of present slots */ int pm_level; /* power management level */ int sata_rev; /* Maximum allowed SATA generation */ @@ -353,6 +369,7 @@ struct ahci_channel { int lastslot; /* Last used slot */ int taggedtarget; /* Last tagged target */ union ccb *frozen; /* Frozen command */ + struct callout pm_timer; /* Power management events */ }; /* structure describing a AHCI controller */ @@ -371,9 +388,13 @@ struct ahci_controller { #define AHCI_IRQ_MODE_AFTER 1 #define AHCI_IRQ_MODE_ONE 2 } irqs[16]; + uint32_t caps; /* Controller capabilities */ + uint32_t caps2; /* Controller capabilities */ int numirqs; int channels; int ichannels; + int ccc; /* CCC timeout */ + int cccv; /* CCC vector */ struct { void (*function)(void *); void *argument; From mav at FreeBSD.org Tue Sep 1 12:04:43 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Tue Sep 1 12:04:50 2009 Subject: svn commit: r196732 - in stable/8: sbin/camcontrol sys sys/amd64/include/xen sys/cam/ata sys/cddl/contrib/opensolaris sys/contrib/dev/acpica sys/contrib/pf sys/dev/xen/xenpci Message-ID: <200909011204.n81C4hL0060765@svn.freebsd.org> Author: mav Date: Tue Sep 1 12:04:43 2009 New Revision: 196732 URL: http://svn.freebsd.org/changeset/base/196732 Log: MFC r196657: ATA_FLUSHCACHE is a 28bit format command, not 48. MFC r196658: Improve camcontrol ATA support: - Tune protocol version reporting, - Add supported DMA/PIO modes reporting. - Fix IDENTIFY request for ATAPI devices. - Remove confusing "-" for NCQ status. MFC r196659: Short ATA command format has 28bit address, not 36bit. Rename ata_36bit_cmd() into ata_28bit_cmd(), while it didn't become legacy. Approved by: re (ATA-CAM blanket) Modified: stable/8/sbin/camcontrol/ (props changed) stable/8/sbin/camcontrol/camcontrol.c stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cam/ata/ata_all.c stable/8/sys/cam/ata/ata_all.h stable/8/sys/cam/ata/ata_da.c stable/8/sys/cam/ata/ata_xpt.c stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/8/sbin/camcontrol/camcontrol.c Tue Sep 1 11:44:30 2009 (r196731) +++ stable/8/sbin/camcontrol/camcontrol.c Tue Sep 1 12:04:43 2009 (r196732) @@ -206,6 +206,7 @@ static void cts_print(struct cam_device struct ccb_trans_settings *cts); static void cpi_print(struct ccb_pathinq *cpi); static int get_cpi(struct cam_device *device, struct ccb_pathinq *cpi); +static int get_cgd(struct cam_device *device, struct ccb_getdev *cgd); static int get_print_cts(struct cam_device *device, int user_settings, int quiet, struct ccb_trans_settings *cts); static int ratecontrol(struct cam_device *device, int retry_count, @@ -1015,17 +1016,18 @@ atacapprint(struct ata_params *parm) ((u_int64_t)parm->lba_size48_4 << 48); printf("\n"); - printf("Protocol "); + printf("protocol "); + printf("ATA/ATAPI-%d", ata_version(parm->version_major)); if (parm->satacapabilities && parm->satacapabilities != 0xffff) { if (parm->satacapabilities & ATA_SATA_GEN2) - printf("SATA revision 2.x\n"); + printf(" SATA 2.x\n"); else if (parm->satacapabilities & ATA_SATA_GEN1) - printf("SATA revision 1.x\n"); + printf(" SATA 1.x\n"); else - printf("Unknown SATA revision\n"); + printf(" SATA x.x\n"); } else - printf("ATA/ATAPI revision %d\n", ata_version(parm->version_major)); + printf("\n"); printf("device model %.40s\n", parm->model); printf("serial number %.20s\n", parm->serial); printf("firmware revision %.8s\n", parm->revision); @@ -1038,22 +1040,74 @@ atacapprint(struct ata_params *parm) (parm->support.command2 & ATA_SUPPORT_CFA)) printf("CFA supported\n"); - printf("lba%ssupported ", + printf("LBA%ssupported ", parm->capabilities1 & ATA_SUPPORT_LBA ? " " : " not "); if (lbasize) printf("%d sectors\n", lbasize); else printf("\n"); - printf("lba48%ssupported ", + printf("LBA48%ssupported ", parm->support.command2 & ATA_SUPPORT_ADDRESS48 ? " " : " not "); if (lbasize48) printf("%ju sectors\n", (uintmax_t)lbasize48); else printf("\n"); - printf("dma%ssupported\n", + printf("PIO supported PIO"); + if (parm->atavalid & ATA_FLAG_64_70) { + if (parm->apiomodes & 0x02) + printf("4"); + else if (parm->apiomodes & 0x01) + printf("3"); + } else if (parm->mwdmamodes & 0x04) + printf("4"); + else if (parm->mwdmamodes & 0x02) + printf("3"); + else if (parm->mwdmamodes & 0x01) + printf("2"); + else if ((parm->retired_piomode & ATA_RETIRED_PIO_MASK) == 0x200) + printf("2"); + else if ((parm->retired_piomode & ATA_RETIRED_PIO_MASK) == 0x100) + printf("1"); + else + printf("0"); + printf("\n"); + + printf("DMA%ssupported ", parm->capabilities1 & ATA_SUPPORT_DMA ? " " : " not "); + if (parm->capabilities1 & ATA_SUPPORT_DMA) { + if (parm->mwdmamodes & 0xff) { + printf("WDMA"); + if (parm->mwdmamodes & 0x04) + printf("2"); + else if (parm->mwdmamodes & 0x02) + printf("1"); + else if (parm->mwdmamodes & 0x01) + printf("0"); + printf(" "); + } + if ((parm->atavalid & ATA_FLAG_88) && + (parm->udmamodes & 0xff)) { + printf("UDMA"); + if (parm->udmamodes & 0x40) + printf("6"); + else if (parm->udmamodes & 0x20) + printf("5"); + else if (parm->udmamodes & 0x10) + printf("4"); + else if (parm->udmamodes & 0x08) + printf("3"); + else if (parm->udmamodes & 0x04) + printf("2"); + else if (parm->udmamodes & 0x02) + printf("1"); + else if (parm->udmamodes & 0x01) + printf("0"); + printf(" "); + } + } + printf("\n"); printf("overlap%ssupported\n", parm->capabilities1 & ATA_SUPPORT_OVERLAP ? " " : " not "); @@ -1070,10 +1124,10 @@ atacapprint(struct ata_params *parm) parm->enabled.command1 & ATA_SUPPORT_LOOKAHEAD ? "yes" : "no"); if (parm->satacapabilities && parm->satacapabilities != 0xffff) { - printf("Native Command Queuing (NCQ) %s %s" + printf("Native Command Queuing (NCQ) %s " " %d/0x%02X\n", parm->satacapabilities & ATA_SUPPORT_NCQ ? - "yes" : "no", " -", + "yes" : "no", (parm->satacapabilities & ATA_SUPPORT_NCQ) ? ATA_QUEUE_LEN(parm->queue) : 0, (parm->satacapabilities & ATA_SUPPORT_NCQ) ? @@ -1121,9 +1175,14 @@ ataidentify(struct cam_device *device, i { union ccb *ccb; struct ata_params *ident_buf; + struct ccb_getdev cgd; u_int i, error = 0; int16_t *ptr; - + + if (get_cgd(device, &cgd) != 0) { + warnx("couldn't get CGD"); + return(1); + } ccb = cam_getccb(device); if (ccb == NULL) { @@ -1152,10 +1211,10 @@ ataidentify(struct cam_device *device, i /*data_ptr*/(u_int8_t *)ptr, /*dxfer_len*/sizeof(struct ata_params), timeout ? timeout : 30 * 1000); -// if (periph->path->device->protocol == PROTO_ATA) - ata_36bit_cmd(&ccb->ataio, ATA_ATA_IDENTIFY, 0, 0, 0); -// else -// ata_36bit_cmd(&ccb->ataio, ATA_ATAPI_IDENTIFY, 0, 0, 0); + if (cgd.protocol == PROTO_ATA) + ata_28bit_cmd(&ccb->ataio, ATA_ATA_IDENTIFY, 0, 0, 0); + else + ata_28bit_cmd(&ccb->ataio, ATA_ATAPI_IDENTIFY, 0, 0, 0); /* Disable freezing the device queue */ ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; @@ -2588,46 +2647,71 @@ get_cpi(struct cam_device *device, struc int retval = 0; ccb = cam_getccb(device); - if (ccb == NULL) { warnx("get_cpi: couldn't allocate CCB"); return(1); } - bzero(&(&ccb->ccb_h)[1], sizeof(struct ccb_pathinq) - sizeof(struct ccb_hdr)); - ccb->ccb_h.func_code = XPT_PATH_INQ; - if (cam_send_ccb(device, ccb) < 0) { warn("get_cpi: error sending Path Inquiry CCB"); - if (arglist & CAM_ARG_VERBOSE) cam_error_print(device, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr); - retval = 1; - goto get_cpi_bailout; } - if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { - if (arglist & CAM_ARG_VERBOSE) cam_error_print(device, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr); - retval = 1; - goto get_cpi_bailout; } - bcopy(&ccb->cpi, cpi, sizeof(struct ccb_pathinq)); get_cpi_bailout: - cam_freeccb(ccb); + return(retval); +} +/* + * Get a get device CCB for the specified device. + */ +static int +get_cgd(struct cam_device *device, struct ccb_getdev *cgd) +{ + union ccb *ccb; + int retval = 0; + + ccb = cam_getccb(device); + if (ccb == NULL) { + warnx("get_cgd: couldn't allocate CCB"); + return(1); + } + bzero(&(&ccb->ccb_h)[1], + sizeof(struct ccb_pathinq) - sizeof(struct ccb_hdr)); + ccb->ccb_h.func_code = XPT_GDEV_TYPE; + if (cam_send_ccb(device, ccb) < 0) { + warn("get_cgd: error sending Path Inquiry CCB"); + if (arglist & CAM_ARG_VERBOSE) + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + retval = 1; + goto get_cgd_bailout; + } + if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + if (arglist & CAM_ARG_VERBOSE) + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + retval = 1; + goto get_cgd_bailout; + } + bcopy(&ccb->cgd, cgd, sizeof(struct ccb_getdev)); + +get_cgd_bailout: + cam_freeccb(ccb); return(retval); } @@ -2673,6 +2757,9 @@ cpi_print(struct ccb_pathinq *cpi) case PI_SOFT_RST: str = "soft reset alternative"; break; + case PI_SATAPM: + str = "SATA Port Multiplier"; + break; default: str = "unknown PI bit set"; break; @@ -2702,6 +2789,12 @@ cpi_print(struct ccb_pathinq *cpi) str = "user has disabled initial BUS RESET or" " controller is in target/mixed mode"; break; + case PIM_NO_6_BYTE: + str = "do not send 6-byte commands"; + break; + case PIM_SEQSCAN: + str = "scan bus sequentially"; + break; default: str = "unknown PIM bit set"; break; Modified: stable/8/sys/cam/ata/ata_all.c ============================================================================== --- stable/8/sys/cam/ata/ata_all.c Tue Sep 1 11:44:30 2009 (r196731) +++ stable/8/sys/cam/ata/ata_all.c Tue Sep 1 12:04:43 2009 (r196732) @@ -91,7 +91,7 @@ ata_print_ident(struct ata_params *ident } void -ata_36bit_cmd(struct ccb_ataio *ataio, uint8_t cmd, uint8_t features, +ata_28bit_cmd(struct ccb_ataio *ataio, uint8_t cmd, uint8_t features, uint32_t lba, uint8_t sector_count) { bzero(&ataio->cmd, sizeof(ataio->cmd)); Modified: stable/8/sys/cam/ata/ata_all.h ============================================================================== --- stable/8/sys/cam/ata/ata_all.h Tue Sep 1 11:44:30 2009 (r196731) +++ stable/8/sys/cam/ata/ata_all.h Tue Sep 1 12:04:43 2009 (r196732) @@ -83,7 +83,7 @@ struct ata_res { int ata_version(int ver); void ata_print_ident(struct ata_params *ident_data); -void ata_36bit_cmd(struct ccb_ataio *ataio, uint8_t cmd, uint8_t features, +void ata_28bit_cmd(struct ccb_ataio *ataio, uint8_t cmd, uint8_t features, uint32_t lba, uint8_t sector_count); void ata_48bit_cmd(struct ccb_ataio *ataio, uint8_t cmd, uint16_t features, uint64_t lba, uint16_t sector_count); Modified: stable/8/sys/cam/ata/ata_da.c ============================================================================== --- stable/8/sys/cam/ata/ata_da.c Tue Sep 1 11:44:30 2009 (r196731) +++ stable/8/sys/cam/ata/ata_da.c Tue Sep 1 12:04:43 2009 (r196732) @@ -287,7 +287,7 @@ adaclose(struct disk *dp) if (softc->flags & ADA_FLAG_CAN_48BIT) ata_48bit_cmd(&ccb->ataio, ATA_FLUSHCACHE48, 0, 0, 0); else - ata_48bit_cmd(&ccb->ataio, ATA_FLUSHCACHE, 0, 0, 0); + ata_28bit_cmd(&ccb->ataio, ATA_FLUSHCACHE, 0, 0, 0); cam_periph_runccb(ccb, /*error_routine*/NULL, /*cam_flags*/0, /*sense_flags*/SF_RETRY_UA, softc->disk->d_devstat); @@ -411,7 +411,7 @@ adadump(void *arg, void *virtual, vm_off ata_48bit_cmd(&ccb.ataio, ATA_WRITE_DMA48, 0, lba, count); } else { - ata_36bit_cmd(&ccb.ataio, ATA_WRITE_DMA, + ata_28bit_cmd(&ccb.ataio, ATA_WRITE_DMA, 0, lba, count); } xpt_polled_action(&ccb); @@ -441,7 +441,7 @@ adadump(void *arg, void *virtual, vm_off if (softc->flags & ADA_FLAG_CAN_48BIT) ata_48bit_cmd(&ccb.ataio, ATA_FLUSHCACHE48, 0, 0, 0); else - ata_48bit_cmd(&ccb.ataio, ATA_FLUSHCACHE, 0, 0, 0); + ata_28bit_cmd(&ccb.ataio, ATA_FLUSHCACHE, 0, 0, 0); xpt_polled_action(&ccb); if ((ccb.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) @@ -856,10 +856,10 @@ adastart(struct cam_periph *periph, unio } } else { if (bp->bio_cmd == BIO_READ) { - ata_36bit_cmd(ataio, ATA_READ_DMA, + ata_28bit_cmd(ataio, ATA_READ_DMA, 0, lba, count); } else { - ata_36bit_cmd(ataio, ATA_WRITE_DMA, + ata_28bit_cmd(ataio, ATA_WRITE_DMA, 0, lba, count); } } @@ -878,7 +878,7 @@ adastart(struct cam_periph *periph, unio if (softc->flags & ADA_FLAG_CAN_48BIT) ata_48bit_cmd(ataio, ATA_FLUSHCACHE48, 0, 0, 0); else - ata_48bit_cmd(ataio, ATA_FLUSHCACHE, 0, 0, 0); + ata_28bit_cmd(ataio, ATA_FLUSHCACHE, 0, 0, 0); break; } start_ccb->ccb_h.ccb_state = ADA_CCB_BUFFER_IO; @@ -1126,7 +1126,7 @@ adashutdown(void * arg, int howto) if (softc->flags & ADA_FLAG_CAN_48BIT) ata_48bit_cmd(&ccb.ataio, ATA_FLUSHCACHE48, 0, 0, 0); else - ata_48bit_cmd(&ccb.ataio, ATA_FLUSHCACHE, 0, 0, 0); + ata_28bit_cmd(&ccb.ataio, ATA_FLUSHCACHE, 0, 0, 0); xpt_polled_action(&ccb); if ((ccb.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) Modified: stable/8/sys/cam/ata/ata_xpt.c ============================================================================== --- stable/8/sys/cam/ata/ata_xpt.c Tue Sep 1 11:44:30 2009 (r196731) +++ stable/8/sys/cam/ata/ata_xpt.c Tue Sep 1 12:04:43 2009 (r196732) @@ -357,9 +357,9 @@ probestart(struct cam_periph *periph, un /*dxfer_len*/sizeof(struct ata_params), 30 * 1000); if (periph->path->device->protocol == PROTO_ATA) - ata_36bit_cmd(ataio, ATA_ATA_IDENTIFY, 0, 0, 0); + ata_28bit_cmd(ataio, ATA_ATA_IDENTIFY, 0, 0, 0); else - ata_36bit_cmd(ataio, ATA_ATAPI_IDENTIFY, 0, 0, 0); + ata_28bit_cmd(ataio, ATA_ATAPI_IDENTIFY, 0, 0, 0); break; } case PROBE_SETMODE: @@ -375,7 +375,7 @@ probestart(struct cam_periph *periph, un /*data_ptr*/NULL, /*dxfer_len*/0, 30 * 1000); - ata_36bit_cmd(ataio, ATA_SETFEATURES, ATA_SF_SETXFER, 0, + ata_28bit_cmd(ataio, ATA_SETFEATURES, ATA_SF_SETXFER, 0, ata_max_mode(ident_buf, ATA_UDMA6, ATA_UDMA6)); break; } From kib at FreeBSD.org Tue Sep 1 12:05:39 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Tue Sep 1 12:05:45 2009 Subject: svn commit: r196733 - head/sys/kern Message-ID: <200909011205.n81C5dSV060831@svn.freebsd.org> Author: kib Date: Tue Sep 1 12:05:39 2009 New Revision: 196733 URL: http://svn.freebsd.org/changeset/base/196733 Log: Fix mount reference leak when V_XSLEEP is specified to vn_start_write(). Submitted by: tegge Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Tue Sep 1 12:04:43 2009 (r196732) +++ head/sys/kern/vfs_vnops.c Tue Sep 1 12:05:39 2009 (r196733) @@ -999,7 +999,7 @@ vn_start_write(vp, mpp, flags) goto unlock; mp->mnt_writeopcount++; unlock: - if (error != 0) + if (error != 0 || (flags & V_XSLEEP) != 0) MNT_REL(mp); MNT_IUNLOCK(mp); return (error); From adrian at FreeBSD.org Tue Sep 1 12:17:48 2009 From: adrian at FreeBSD.org (Adrian Chadd) Date: Tue Sep 1 12:17:59 2009 Subject: svn commit: r196734 - head/sys/i386/xen Message-ID: <200909011217.n81CHlZR061114@svn.freebsd.org> Author: adrian Date: Tue Sep 1 12:17:47 2009 New Revision: 196734 URL: http://svn.freebsd.org/changeset/base/196734 Log: Delete whitespace not in i386/pmap.c Modified: head/sys/i386/xen/pmap.c Modified: head/sys/i386/xen/pmap.c ============================================================================== --- head/sys/i386/xen/pmap.c Tue Sep 1 12:05:39 2009 (r196733) +++ head/sys/i386/xen/pmap.c Tue Sep 1 12:17:47 2009 (r196734) @@ -4171,7 +4171,6 @@ pmap_activate(struct thread *td) td->td_pcb->pcb_cr3 = cr3; PT_UPDATES_FLUSH(); load_cr3(cr3); - PCPU_SET(curpmap, pmap); critical_exit(); } From jhb at FreeBSD.org Tue Sep 1 15:50:07 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Tue Sep 1 15:50:19 2009 Subject: svn commit: r196735 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci vm Message-ID: <200909011550.n81Fo7lp065562@svn.freebsd.org> Author: jhb Date: Tue Sep 1 15:50:07 2009 New Revision: 196735 URL: http://svn.freebsd.org/changeset/base/196735 Log: MFC 196637: Mark the fake pages constructed by the OBJT_SG pager valid. This was accidentally lost at one point during the PAT development. Without this fix vm_pager_get_pages() was zeroing each of the pages. Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/vm/sg_pager.c Modified: stable/8/sys/vm/sg_pager.c ============================================================================== --- stable/8/sys/vm/sg_pager.c Tue Sep 1 12:17:47 2009 (r196734) +++ stable/8/sys/vm/sg_pager.c Tue Sep 1 15:50:07 2009 (r196735) @@ -204,6 +204,7 @@ sg_pager_getpages(vm_object_t object, vm vm_page_unlock_queues(); vm_page_insert(page, object, offset); m[reqpage] = page; + page->valid = VM_PAGE_BITS_ALL; return (VM_PAGER_OK); } From trasz at FreeBSD.org Tue Sep 1 15:51:36 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Tue Sep 1 15:51:43 2009 Subject: svn commit: r196736 - head/tools/regression/acltools Message-ID: <200909011551.n81FpaIg065634@svn.freebsd.org> Author: trasz Date: Tue Sep 1 15:51:36 2009 New Revision: 196736 URL: http://svn.freebsd.org/changeset/base/196736 Log: Adapt to the fact that ls(1) correctly prints '+' for symlinks with ACLs now. Modified: head/tools/regression/acltools/tools-posix.test Modified: head/tools/regression/acltools/tools-posix.test ============================================================================== --- head/tools/regression/acltools/tools-posix.test Tue Sep 1 15:50:07 2009 (r196735) +++ head/tools/regression/acltools/tools-posix.test Tue Sep 1 15:51:36 2009 (r196736) @@ -77,9 +77,8 @@ $ getfacl -h lll > mask::rwx > other::r-x -# XXX: Why doesn't ls(1) print '+' for symbolic links with ACL set? $ ls -l lll | cut -d' ' -f1 -> lrwxrwxr-x +> lrwxrwxr-x+ # Check whether the original file is left untouched. $ ls -l xxx | cut -d' ' -f1 From dougb at FreeBSD.org Tue Sep 1 16:21:10 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Tue Sep 1 16:21:22 2009 Subject: svn commit: r196706 - head/usr.sbin/pkg_install/lib In-Reply-To: <20090901023240.GF65882@lor.one-eyed-alien.net> References: <200908311750.n7VHoXp0034601@svn.freebsd.org> <20090901023240.GF65882@lor.one-eyed-alien.net> Message-ID: <4A9D49EA.1070601@FreeBSD.org> Brooks Davis wrote: > On Mon, Aug 31, 2009 at 05:50:33PM +0000, Doug Barton wrote: >> Author: dougb >> Date: Mon Aug 31 17:50:33 2009 >> New Revision: 196706 >> URL: http://svn.freebsd.org/changeset/base/196706 >> >> Log: >> Add support for INDEX-9 [1] >> >> While I'm here, strip off support for FreeBSD 5.x. > > I'm rather baffled as to why you'd bother removing 5.x support and keep > <=4.x support. It seems vanishingly unlikely we'll ever support plain > INDEX files again. Feel free to remove it if you think that's the right decision. I wasn't sure, so I left it alone. Doug -- This .signature sanitized for your protection From dougb at FreeBSD.org Tue Sep 1 16:23:55 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Tue Sep 1 16:24:01 2009 Subject: svn commit: r196727 - head/share/man/man5 In-Reply-To: <200909010555.n815tAkx050140@svn.freebsd.org> References: <200909010555.n815tAkx050140@svn.freebsd.org> Message-ID: <4A9D4A90.30700@FreeBSD.org> Maxim Konovalov wrote: > Author: maxim > Date: Tue Sep 1 05:55:10 2009 > New Revision: 196727 > URL: http://svn.freebsd.org/changeset/base/196727 > > Log: > o Document MALLOC_PRODUCTION knob. > > PR: docs/136029 > Submitted by: anonymous > MFC after: 2 weeks > > Modified: > head/share/man/man5/make.conf.5 Unless I'm missing something this should be in the src.conf man page instead of make.conf. Doug -- This .signature sanitized for your protection From danfe at FreeBSD.org Tue Sep 1 16:28:56 2009 From: danfe at FreeBSD.org (Alexey Dokuchaev) Date: Tue Sep 1 16:29:07 2009 Subject: svn commit: r196727 - head/share/man/man5 In-Reply-To: <4A9D4A90.30700@FreeBSD.org> References: <200909010555.n815tAkx050140@svn.freebsd.org> <4A9D4A90.30700@FreeBSD.org> Message-ID: <20090901162856.GA54192@FreeBSD.org> On Tue, Sep 01, 2009 at 09:23:44AM -0700, Doug Barton wrote: > Maxim Konovalov wrote: > > Author: maxim > > Date: Tue Sep 1 05:55:10 2009 > > New Revision: 196727 > > URL: http://svn.freebsd.org/changeset/base/196727 > > > > Log: > > o Document MALLOC_PRODUCTION knob. > > > > PR: docs/136029 > > Submitted by: anonymous > > MFC after: 2 weeks > > > > Modified: > > head/share/man/man5/make.conf.5 > > Unless I'm missing something this should be in the src.conf man page > instead of make.conf. However, I'm used to make.conf since 4.x days, so at least cross-reference of some sort is in order (I'm not sure, there might be one already now that I write this). ./danfe From njm at njm.me.uk Tue Sep 1 16:29:41 2009 From: njm at njm.me.uk (N.J. Mann) Date: Tue Sep 1 16:29:48 2009 Subject: svn commit: r196684 - stable/7 In-Reply-To: <200908310245.n7V2jliD013837@svn.freebsd.org> References: <200908310245.n7V2jliD013837@svn.freebsd.org> Message-ID: <20090901162939.GA2371@titania.njm.me.uk> In message <200908310245.n7V2jliD013837@svn.freebsd.org>, Edwin Groothuis (edwin@FreeBSD.org) wrote: > Author: edwin > Date: Mon Aug 31 02:45:47 2009 > New Revision: 196684 > URL: http://svn.freebsd.org/changeset/base/196684 > > Log: > MFC of r192625: > > Throw alert about the newly generated format of zic(8) and the > necessarity to run tzsetup(8). > > Modified: > stable/7/UPDATING (contents, props changed) > > Modified: stable/7/UPDATING > ============================================================================== > --- stable/7/UPDATING Mon Aug 31 02:22:18 2009 (r196683) > +++ stable/7/UPDATING Mon Aug 31 02:45:47 2009 (r196684) > @@ -8,6 +8,11 @@ Items affecting the ports and packages s > /usr/ports/UPDATING. Please read that file before running > portupgrade. > > +20090831: > + The newly imported zic(8) produces a new format in the > + output. Please run tzsetup(8) to install the newly created > + data to /etc/localtime. > + > 20090731: > The ABI of various structures related to the SYSV IPC API have > been changed. Bump __FreeBSD_version to 702105. I have just updated one of my machines that runs 7-STABLE and having done so I followed the above instructions. Having read the instructions I was expecting the new version of /etc/localtime to be different from the old one. However, the new one is identical to the old one. Is this to be expected? Cheers, Nick. -- From rnoland at FreeBSD.org Tue Sep 1 16:41:29 2009 From: rnoland at FreeBSD.org (Robert Noland) Date: Tue Sep 1 16:41:40 2009 Subject: svn commit: r196737 - in stable/8/sys: . amd64/amd64 amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci i386/i386 Message-ID: <200909011641.n81GfSR5066711@svn.freebsd.org> Author: rnoland Date: Tue Sep 1 16:41:28 2009 New Revision: 196737 URL: http://svn.freebsd.org/changeset/base/196737 Log: MFC 196643 Swap the start/end virtual addresses in pmap_invalidate_cache_range(). This fixes the functionality on non SelfSnoop hardware. Found by: rnoland Submitted by: alc Reviewed by: kib Approved by: re (rwatson) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/amd64/pmap.c stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/i386/i386/pmap.c Modified: stable/8/sys/amd64/amd64/pmap.c ============================================================================== --- stable/8/sys/amd64/amd64/pmap.c Tue Sep 1 15:51:36 2009 (r196736) +++ stable/8/sys/amd64/amd64/pmap.c Tue Sep 1 16:41:28 2009 (r196737) @@ -943,8 +943,8 @@ pmap_invalidate_cache_range(vm_offset_t * coherence domain. */ mfence(); - for (; eva < sva; eva += cpu_clflush_line_size) - clflush(eva); + for (; sva < eva; sva += cpu_clflush_line_size) + clflush(sva); mfence(); } else { Modified: stable/8/sys/i386/i386/pmap.c ============================================================================== --- stable/8/sys/i386/i386/pmap.c Tue Sep 1 15:51:36 2009 (r196736) +++ stable/8/sys/i386/i386/pmap.c Tue Sep 1 16:41:28 2009 (r196737) @@ -967,8 +967,8 @@ pmap_invalidate_cache_range(vm_offset_t * coherence domain. */ mfence(); - for (; eva < sva; eva += cpu_clflush_line_size) - clflush(eva); + for (; sva < eva; sva += cpu_clflush_line_size) + clflush(sva); mfence(); } else { From dougb at FreeBSD.org Tue Sep 1 17:40:56 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Tue Sep 1 17:41:03 2009 Subject: svn commit: r196727 - head/share/man/man5 In-Reply-To: <20090901162856.GA54192@FreeBSD.org> References: <200909010555.n815tAkx050140@svn.freebsd.org> <4A9D4A90.30700@FreeBSD.org> <20090901162856.GA54192@FreeBSD.org> Message-ID: <4A9D5C9C.3060002@FreeBSD.org> Alexey Dokuchaev wrote: > However, I'm used to make.conf since 4.x days, so at least > cross-reference of some sort is in order (I'm not sure, there might be > one already now that I write this). SEE ALSO gcc(1), install(1), make(1), src.conf(5) ... :) Doug -- This .signature sanitized for your protection From bz at FreeBSD.org Tue Sep 1 17:53:02 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Tue Sep 1 17:53:14 2009 Subject: svn commit: r196738 - head/sys/netinet Message-ID: <200909011753.n81Hr1AV068295@svn.freebsd.org> Author: bz Date: Tue Sep 1 17:53:01 2009 New Revision: 196738 URL: http://svn.freebsd.org/changeset/base/196738 Log: In case an upper layer protocol tries to send a packet but the L2 code does not have the ethernet address for the destination within the broadcast domain in the table, we remember the original mbuf in `la_hold' in arpresolve() and send out a different packet with an arp request. In case there will be more upper layer packets to send we will free an earlier one held in `la_hold' and queue the new one. Once we get a packet in, with which we can perfect our arp table entry we send out the original 'on hold' packet, should there be any. Rather than continuing to process the packet that we received, we returned without freeing the packet that came in, which basically means that we leaked an mbuf for every arp request we sent. Rather than freeing the received packet and returning, continue to process the incoming arp packet as well. This should (a) improve some setups, also proxy-arp, in case it was an incoming arp request and (b) resembles the behaviour FreeBSD had from day 1, which alignes with RFC826 "Packet reception" (merge case). Rename 'm0' to 'hold' to make the code more understandable as well as diffable to earlier versions more easily. Handle the link-layer entry 'la' lock comepletely in the block where needed and release it as early as possible, rather than holding it longer, down to the end of the function. Found by: pointyhat, ns1 Bug hunting session with: erwin, simon, rwatson Tested by: simon on cluster machines Reviewed by: ratson, kmacy, julian MFC after: 3 days Modified: head/sys/netinet/if_ether.c Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Tue Sep 1 16:41:28 2009 (r196737) +++ head/sys/netinet/if_ether.c Tue Sep 1 17:53:01 2009 (r196738) @@ -462,11 +462,11 @@ in_arpinput(struct mbuf *m) struct rtentry *rt; struct ifaddr *ifa; struct in_ifaddr *ia; + struct mbuf *hold; struct sockaddr sa; struct in_addr isaddr, itaddr, myaddr; u_int8_t *enaddr = NULL; int op, flags; - struct mbuf *m0; int req_len; int bridged = 0, is_bridge = 0; #ifdef DEV_CARP @@ -631,11 +631,13 @@ match: la->lle_tbl->llt_ifp->if_xname, ifp->if_addrlen, (u_char *)ar_sha(ah), ":", ifp->if_xname); + LLE_WUNLOCK(la); goto reply; } if ((la->la_flags & LLE_VALID) && bcmp(ar_sha(ah), &la->ll_addr, ifp->if_addrlen)) { if (la->la_flags & LLE_STATIC) { + LLE_WUNLOCK(la); log(LOG_ERR, "arp: %*D attempts to modify permanent " "entry for %s on %s\n", @@ -655,6 +657,7 @@ match: } if (ifp->if_addrlen != ah->ar_hln) { + LLE_WUNLOCK(la); log(LOG_WARNING, "arp from %*D: addr len: new %d, i/f %d (ignored)", ifp->if_addrlen, (u_char *) ar_sha(ah), ":", @@ -671,15 +674,14 @@ match: } la->la_asked = 0; la->la_preempt = V_arp_maxtries; - if (la->la_hold != NULL) { - m0 = la->la_hold; - la->la_hold = 0; + hold = la->la_hold; + if (hold != NULL) { + la->la_hold = NULL; memcpy(&sa, L3_ADDR(la), sizeof(sa)); - LLE_WUNLOCK(la); - - (*ifp->if_output)(ifp, m0, &sa, NULL); - return; } + LLE_WUNLOCK(la); + if (hold != NULL) + (*ifp->if_output)(ifp, hold, &sa, NULL); } reply: if (op != ARPOP_REQUEST) @@ -750,8 +752,6 @@ reply: #endif } - if (la != NULL) - LLE_WUNLOCK(la); if (itaddr.s_addr == myaddr.s_addr && IN_LINKLOCAL(ntohl(itaddr.s_addr))) { /* RFC 3927 link-local IPv4; always reply by broadcast. */ @@ -777,8 +777,6 @@ reply: return; drop: - if (la != NULL) - LLE_WUNLOCK(la); m_freem(m); } #endif From gnn at FreeBSD.org Tue Sep 1 17:55:37 2009 From: gnn at FreeBSD.org (George V. Neville-Neil) Date: Tue Sep 1 17:55:48 2009 Subject: svn commit: r196739 - head/sys/dev/hwpmc Message-ID: <200909011755.n81HtbaJ068398@svn.freebsd.org> Author: gnn Date: Tue Sep 1 17:55:37 2009 New Revision: 196739 URL: http://svn.freebsd.org/changeset/base/196739 Log: Add counters for the i7 architecture which were accidentally left out of the original commit of i7 support. These are all the counters on pages A-32 and A-33 of the _Intel(R) 64 and IA32 Architectures Software Developer's Manual Vol 3B_, June 2009. Almost all of these counters relate to operations on the L2 cache. Reviewed by: jkoshy MFC after: 1 month Modified: head/sys/dev/hwpmc/hwpmc_core.c head/sys/dev/hwpmc/pmc_events.h Modified: head/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_core.c Tue Sep 1 17:53:01 2009 (r196738) +++ head/sys/dev/hwpmc/hwpmc_core.c Tue Sep 1 17:55:37 2009 (r196739) @@ -1182,6 +1182,29 @@ static struct iap_event_descr iap_events IAPDESCR(DBH_01H, 0xDB, 0x01, IAP_F_FM | IAP_F_I7), IAPDESCR(E4H_01H, 0xE4, 0x01, IAP_F_FM | IAP_F_I7), IAPDESCR(E5H_01H, 0xE5, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(E6H_01H, 0xE6, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(E6H_02H, 0xE6, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(E8H_01H, 0xE8, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(E8H_02H, 0xE8, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(E8H_03H, 0xE8, 0x03, IAP_F_FM | IAP_F_I7), + IAPDESCR(F0H_01H, 0xF0, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(F0H_02H, 0xF0, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(F0H_04H, 0xF0, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(F0H_08H, 0xF0, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(F0H_10H, 0xF0, 0x10, IAP_F_FM | IAP_F_I7), + IAPDESCR(F0H_20H, 0xF0, 0x20, IAP_F_FM | IAP_F_I7), + IAPDESCR(F0H_40H, 0xF0, 0x40, IAP_F_FM | IAP_F_I7), + IAPDESCR(F0H_80H, 0xF0, 0x80, IAP_F_FM | IAP_F_I7), + IAPDESCR(F1H_02H, 0xF1, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(F1H_04H, 0xF1, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(F1H_07H, 0xF1, 0x07, IAP_F_FM | IAP_F_I7), + IAPDESCR(F2H_01H, 0xF2, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(F2H_02H, 0xF2, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(F2H_04H, 0xF2, 0x04, IAP_F_FM | IAP_F_I7), + IAPDESCR(F2H_08H, 0xF2, 0x08, IAP_F_FM | IAP_F_I7), + IAPDESCR(F2H_0FH, 0xF2, 0x0F, IAP_F_FM | IAP_F_I7), + IAPDESCR(F3H_01H, 0xF3, 0x01, IAP_F_FM | IAP_F_I7), + IAPDESCR(F3H_02H, 0xF3, 0x02, IAP_F_FM | IAP_F_I7), IAPDESCR(F3H_04H, 0xF3, 0x04, IAP_F_FM | IAP_F_I7), IAPDESCR(F3H_08H, 0xF3, 0x08, IAP_F_FM | IAP_F_I7), IAPDESCR(F3H_10H, 0xF3, 0x10, IAP_F_FM | IAP_F_I7), Modified: head/sys/dev/hwpmc/pmc_events.h ============================================================================== --- head/sys/dev/hwpmc/pmc_events.h Tue Sep 1 17:53:01 2009 (r196738) +++ head/sys/dev/hwpmc/pmc_events.h Tue Sep 1 17:55:37 2009 (r196739) @@ -29,8 +29,18 @@ #ifndef _DEV_HWPMC_PMC_EVENTS_H_ #define _DEV_HWPMC_PMC_EVENTS_H_ -/* - * PMC event codes. +/* + * Note: Documentation on adding events can be found both in + * the source tree at src/share/doc/papers/hwpmc/hwpmc.ms + * as well as on-line at: + * + * http://wiki.freebsd.org/PmcTools/PmcHardwareHowTo + * + * Please refer to those resources before you attempt to modify + * this file or the hwpmc driver/subsystem. + */ + +/* * PMC event codes. * * __PMC_EV(CLASS, SYMBOLIC-NAME) * @@ -973,7 +983,30 @@ __PMC_EV(IAP, EVENT_FDH_04H) \ __PMC_EV(IAP, EVENT_FDH_08H) \ __PMC_EV(IAP, EVENT_FDH_10H) \ __PMC_EV(IAP, EVENT_FDH_20H) \ -__PMC_EV(IAP, EVENT_FDH_40H) +__PMC_EV(IAP, EVENT_FDH_40H) \ +__PMC_EV(IAP, EVENT_E6H_02H) \ +__PMC_EV(IAP, EVENT_E8H_01H) \ +__PMC_EV(IAP, EVENT_E8H_02H) \ +__PMC_EV(IAP, EVENT_E8H_03H) \ +__PMC_EV(IAP, EVENT_F0H_01H) \ +__PMC_EV(IAP, EVENT_F0H_02H) \ +__PMC_EV(IAP, EVENT_F0H_04H) \ +__PMC_EV(IAP, EVENT_F0H_08H) \ +__PMC_EV(IAP, EVENT_F0H_10H) \ +__PMC_EV(IAP, EVENT_F0H_20H) \ +__PMC_EV(IAP, EVENT_F0H_40H) \ +__PMC_EV(IAP, EVENT_F0H_80H) \ +__PMC_EV(IAP, EVENT_F1H_02H) \ +__PMC_EV(IAP, EVENT_F1H_04H) \ +__PMC_EV(IAP, EVENT_F1H_07H) \ +__PMC_EV(IAP, EVENT_F2H_01H) \ +__PMC_EV(IAP, EVENT_F2H_02H) \ +__PMC_EV(IAP, EVENT_F2H_04H) \ +__PMC_EV(IAP, EVENT_F2H_08H) \ +__PMC_EV(IAP, EVENT_F2H_0FH) \ +__PMC_EV(IAP, EVENT_F3H_01H) \ +__PMC_EV(IAP, EVENT_F3H_02H) + #define PMC_EV_IAP_FIRST PMC_EV_IAP_EVENT_02H_81H #define PMC_EV_IAP_LAST PMC_EV_IAP_EVENT_FDH_40H @@ -1894,6 +1927,29 @@ __PMC_EV_ALIAS("UOP_UNFUSION", IAP_EV __PMC_EV_ALIAS("BR_INST_DECODED", IAP_EVENT_E0H_01H) \ __PMC_EV_ALIAS("BOGUS_BR", IAP_EVENT_E4H_01H) \ __PMC_EV_ALIAS("BPU_MISSED_CALL_RET", IAP_EVENT_E5H_01H) \ +__PMC_EV_ALIAS("BACLEAR.CLEAR", IAP_EVENT_E6H_01H) \ +__PMC_EV_ALIAS("BACLEAR.BAD_TARGET", IAP_EVENT_E6H_02H) \ +__PMC_EV_ALIAS("BPU_CLEARS.EARLY", IAP_EVENT_E8H_01H) \ +__PMC_EV_ALIAS("BPU_CLEARS.LATE", IAP_EVENT_E8H_02H) \ +__PMC_EV_ALIAS("BPU_CLEARS.ANY", IAP_EVENT_E8H_03H) \ +__PMC_EV_ALIAS("L2_TRANSACTIONS.LOAD", IAP_EVENT_F0H_01H) \ +__PMC_EV_ALIAS("L2_TRANSACTIONS.RFO", IAP_EVENT_F0H_02H) \ +__PMC_EV_ALIAS("L2_TRANSACTIONS.IFETCH", IAP_EVENT_F0H_04H) \ +__PMC_EV_ALIAS("L2_TRANSACTIONS.PREFETCH", IAP_EVENT_F0H_08H) \ +__PMC_EV_ALIAS("L2_TRANSACTIONS.L1D_WB", IAP_EVENT_F0H_10H) \ +__PMC_EV_ALIAS("L2_TRANSACTIONS.FILL", IAP_EVENT_F0H_20H) \ +__PMC_EV_ALIAS("L2_TRANSACTIONS.WB", IAP_EVENT_F0H_40H) \ +__PMC_EV_ALIAS("L2_TRANSACTIONS.ANY", IAP_EVENT_F0H_80H) \ +__PMC_EV_ALIAS("L2_LINES_IN.S_STATE", IAP_EVENT_F1H_02H) \ +__PMC_EV_ALIAS("L2_LINES_IN.E_STATE", IAP_EVENT_F1H_04H) \ +__PMC_EV_ALIAS("L2_LINES_IN.ANY", IAP_EVENT_F1H_07H) \ +__PMC_EV_ALIAS("L2_LINES_OUT.DEMAND_CLEAN", IAP_EVENT_F2H_01H) \ +__PMC_EV_ALIAS("L2_LINES_OUT.DEMAND_DIRTY", IAP_EVENT_F2H_02H) \ +__PMC_EV_ALIAS("L2_LINES_OUT.PREFETCH_CLEAN", IAP_EVENT_F2H_04H) \ +__PMC_EV_ALIAS("L2_LINES_OUT.PREFETCH_DIRTY", IAP_EVENT_F2H_08H) \ +__PMC_EV_ALIAS("L2_LINES_OUT.ANY", IAP_EVENT_F2H_0FH) \ +__PMC_EV_ALIAS("L2_HW_PREFETCH.HIT", IAP_EVENT_F3H_01H) \ +__PMC_EV_ALIAS("L2_HW_PREFETCH.ALLOC", IAP_EVENT_F3H_02H) \ __PMC_EV_ALIAS("L2_HW_PREFETCH.DATA_TRIGGER", IAP_EVENT_F3H_04H) \ __PMC_EV_ALIAS("L2_HW_PREFETCH.CODE_TRIGGER", IAP_EVENT_F3H_08H) \ __PMC_EV_ALIAS("L2_HW_PREFETCH.DCA_TRIGGER", IAP_EVENT_F3H_10H) \ From trasz at FreeBSD.org Tue Sep 1 18:30:18 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Tue Sep 1 18:30:30 2009 Subject: svn commit: r196740 - head/lib/libc/posix1e Message-ID: <200909011830.n81IUHAu069085@svn.freebsd.org> Author: trasz Date: Tue Sep 1 18:30:17 2009 New Revision: 196740 URL: http://svn.freebsd.org/changeset/base/196740 Log: Fix regression introduced with NFSv4 ACL support - make acl_to_text(3) and acl_calc_mask(3) return error instead of crashing when acl passed to them is NULL. Submitted by: markus Reviewed by: rwatson MFC after: 3 days Modified: head/lib/libc/posix1e/acl_calc_mask.c head/lib/libc/posix1e/acl_to_text.c Modified: head/lib/libc/posix1e/acl_calc_mask.c ============================================================================== --- head/lib/libc/posix1e/acl_calc_mask.c Tue Sep 1 17:55:37 2009 (r196739) +++ head/lib/libc/posix1e/acl_calc_mask.c Tue Sep 1 18:30:17 2009 (r196740) @@ -50,12 +50,6 @@ acl_calc_mask(acl_t *acl_p) acl_t acl_new; int i, mask_mode, mask_num; - if (!_acl_brand_may_be(*acl_p, ACL_BRAND_POSIX)) { - errno = EINVAL; - return (-1); - } - _acl_brand_as(*acl_p, ACL_BRAND_POSIX); - /* * (23.4.2.4) requires acl_p to point to a pointer to a valid ACL. * Since one of the primary reasons to use this function would be @@ -67,6 +61,13 @@ acl_calc_mask(acl_t *acl_p) errno = EINVAL; return (-1); } + + if (!_acl_brand_may_be(*acl_p, ACL_BRAND_POSIX)) { + errno = EINVAL; + return (-1); + } + _acl_brand_as(*acl_p, ACL_BRAND_POSIX); + acl_int = &(*acl_p)->ats_acl; if ((acl_int->acl_cnt < 3) || (acl_int->acl_cnt > ACL_MAX_ENTRIES)) { errno = EINVAL; Modified: head/lib/libc/posix1e/acl_to_text.c ============================================================================== --- head/lib/libc/posix1e/acl_to_text.c Tue Sep 1 17:55:37 2009 (r196739) +++ head/lib/libc/posix1e/acl_to_text.c Tue Sep 1 18:30:17 2009 (r196740) @@ -70,11 +70,6 @@ _posix1e_acl_to_text(acl_t acl, ssize_t if (buf == NULL) return(NULL); - if (acl == NULL) { - errno = EINVAL; - return(NULL); - } - acl_int = &acl->ats_acl; mask_perm = ACL_PERM_BITS; /* effective is regular if no mask */ @@ -243,6 +238,11 @@ char * acl_to_text_np(acl_t acl, ssize_t *len_p, int flags) { + if (acl == NULL) { + errno = EINVAL; + return(NULL); + } + switch (_acl_brand(acl)) { case ACL_BRAND_POSIX: return (_posix1e_acl_to_text(acl, len_p, flags)); From simon at FreeBSD.org Tue Sep 1 20:27:02 2009 From: simon at FreeBSD.org (Simon L. Nielsen) Date: Tue Sep 1 20:27:17 2009 Subject: svn commit: r196738 - head/sys/netinet In-Reply-To: <200909011753.n81Hr1AV068295@svn.freebsd.org> References: <200909011753.n81Hr1AV068295@svn.freebsd.org> Message-ID: <20090901202659.GA1495@arthur.nitro.dk> On 2009.09.01 17:53:01 +0000, Bjoern A. Zeeb wrote: > Author: bz > Date: Tue Sep 1 17:53:01 2009 > New Revision: 196738 > URL: http://svn.freebsd.org/changeset/base/196738 > > Log: > In case an upper layer protocol tries to send a packet but the > L2 code does not have the ethernet address for the destination > within the broadcast domain in the table, we remember the > original mbuf in `la_hold' in arpresolve() and send out a > different packet with an arp request. [...] Thanks! In case anybody is interested, this was the issue which indirectly killed the FreeBSD mail system for some hours recently. It was caused by ns1.FreeBSD.org stopped responding to network traffic due to it running out of mbuf's. Feel free to guess when bz's patch was applied ;-) : http://people.freebsd.org/~simon/misc/mbuf_leak_ns1_200908.png . The final spike on the graph is me running 'arp -da' a bunch of times. -- Simon L. Nielsen From jilles at FreeBSD.org Tue Sep 1 20:58:43 2009 From: jilles at FreeBSD.org (Jilles Tjoelker) Date: Tue Sep 1 20:58:55 2009 Subject: svn commit: r196741 - in stable/8: sys sys/amd64/include/xen sys/cddl/contrib/opensolaris sys/contrib/dev/acpica sys/contrib/pf sys/dev/xen/xenpci sys/fs/fifofs sys/kern tools/regression/poll Message-ID: <200909012058.n81KwfSk072165@svn.freebsd.org> Author: jilles Date: Tue Sep 1 20:58:41 2009 New Revision: 196741 URL: http://svn.freebsd.org/changeset/base/196741 Log: MFC r196460 Fix the conformance of poll(2) for sockets after r195423 by returning POLLHUP instead of POLLIN for several cases. Now, the tools/regression/poll results for FreeBSD are closer to that of the Solaris and Linux. Also, improve the POSIX conformance by explicitely clearing POLLOUT when POLLHUP is reported in pollscan(), making the fix global. Submitted by: bde Reviewed by: rwatson MFC r196556 Fix poll() on half-closed sockets, while retaining POLLHUP for fifos. This reverts part of r196460, so that sockets only return POLLHUP if both directions are closed/error. Fifos get POLLHUP by closing the unused direction immediately after creating the sockets. The tools/regression/poll/*poll.c tests now pass except for two other things: - if POLLHUP is returned, POLLIN is always returned as well instead of only when there is data left in the buffer to be read - fifo old/new reader distinction does not work the way POSIX specs it Reviewed by: kib, bde MFC r196554 Add some tests for poll(2)/shutdown(2) interaction. Approved by: re (kensmith) Added: stable/8/tools/regression/poll/sockpoll.c - copied unchanged from r196554, head/tools/regression/poll/sockpoll.c Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/fs/fifofs/fifo_vnops.c stable/8/sys/kern/sys_generic.c stable/8/tools/regression/poll/ (props changed) stable/8/tools/regression/poll/Makefile Modified: stable/8/sys/fs/fifofs/fifo_vnops.c ============================================================================== --- stable/8/sys/fs/fifofs/fifo_vnops.c Tue Sep 1 18:30:17 2009 (r196740) +++ stable/8/sys/fs/fifofs/fifo_vnops.c Tue Sep 1 20:58:41 2009 (r196741) @@ -193,6 +193,9 @@ fifo_open(ap) goto fail2; fip->fi_writesock = wso; error = soconnect2(wso, rso); + /* Close the direction we do not use, so we can get POLLHUP. */ + if (error == 0) + error = soshutdown(rso, SHUT_WR); if (error) { (void)soclose(wso); fail2: Modified: stable/8/sys/kern/sys_generic.c ============================================================================== --- stable/8/sys/kern/sys_generic.c Tue Sep 1 18:30:17 2009 (r196740) +++ stable/8/sys/kern/sys_generic.c Tue Sep 1 20:58:41 2009 (r196741) @@ -1228,6 +1228,13 @@ pollscan(td, fds, nfd) selfdalloc(td, fds); fds->revents = fo_poll(fp, fds->events, td->td_ucred, td); + /* + * POSIX requires POLLOUT to be never + * set simultaneously with POLLHUP. + */ + if ((fds->revents & POLLHUP) != 0) + fds->revents &= ~POLLOUT; + if (fds->revents != 0) n++; } Modified: stable/8/tools/regression/poll/Makefile ============================================================================== --- stable/8/tools/regression/poll/Makefile Tue Sep 1 18:30:17 2009 (r196740) +++ stable/8/tools/regression/poll/Makefile Tue Sep 1 20:58:41 2009 (r196741) @@ -3,14 +3,15 @@ # Nothing yet works with gmake for the path to the sources. .PATH: .. -PROG= pipepoll pipeselect +PROG= pipepoll pipeselect sockpoll CFLAGS+= -Werror -Wall all: ${PROG} pipepoll: pipepoll.c pipeselect: pipeselect.c +sockpoll: sockpoll.c -pipepoll pipeselect: +pipepoll pipeselect sockpoll: ${CC} ${CFLAGS} ${LDFLAGS} -o $@ $@.c test: all Copied: stable/8/tools/regression/poll/sockpoll.c (from r196554, head/tools/regression/poll/sockpoll.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/poll/sockpoll.c Tue Sep 1 20:58:41 2009 (r196741, copy of r196554, head/tools/regression/poll/sockpoll.c) @@ -0,0 +1,202 @@ +/* $FreeBSD$ */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +static const char * +decode_events(int events) +{ + char *ncresult; + const char *result; + + switch (events) { + case POLLIN: + result = "POLLIN"; + break; + case POLLOUT: + result = "POLLOUT"; + break; + case POLLIN | POLLOUT: + result = "POLLIN | POLLOUT"; + break; + case POLLHUP: + result = "POLLHUP"; + break; + case POLLIN | POLLHUP: + result = "POLLIN | POLLHUP"; + break; + case POLLOUT | POLLHUP: + result = "POLLOUT | POLLHUP"; + break; + case POLLIN | POLLOUT | POLLHUP: + result = "POLLIN | POLLOUT | POLLHUP"; + break; + default: + asprintf(&ncresult, "%#x", events); + result = ncresult; + break; + } + return (result); +} + +static void +report(int num, const char *state, int expected, int got) +{ + if (expected == got) + printf("ok %-2d ", num); + else + printf("not ok %-2d", num); + printf(" state %s: expected %s; got %s\n", + state, decode_events(expected), decode_events(got)); + fflush(stdout); +} + +static int +set_nonblocking(int sck) +{ + int flags; + + flags = fcntl(sck, F_GETFL, 0); + flags |= O_NONBLOCK; + + if (fcntl(sck, F_SETFL, flags)) + return -1; + + return 0; +} + +static char largeblock[1048576]; /* should be more than AF_UNIX sockbuf size */ +static int fd[2]; +static struct pollfd pfd0; +static struct pollfd pfd1; + +void +setup(void) +{ + if (socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != 0) + err(1, "socketpair"); + if (set_nonblocking(fd[0]) == -1) + err(1, "fcntl"); + if (set_nonblocking(fd[1]) == -1) + err(1, "fcntl"); + pfd0.fd = fd[0]; + pfd0.events = POLLIN | POLLOUT; + pfd1.fd = fd[1]; + pfd1.events = POLLIN | POLLOUT; +} + +int +main(void) +{ + int num; + + num = 1; + printf("1..18\n"); + fflush(stdout); + + /* Large write with close */ + setup(); + if (poll(&pfd0, 1, 0) == -1) + err(1, "poll"); + report(num++, "initial 0", POLLOUT, pfd0.revents); + if (poll(&pfd1, 1, 0) == -1) + err(1, "poll"); + report(num++, "initial 1", POLLOUT, pfd1.revents); + if (write(fd[0], largeblock, sizeof(largeblock)) == -1) + err(1, "write"); + if (poll(&pfd0, 1, 0) == -1) + err(1, "poll"); + report(num++, "after large write", 0, pfd0.revents); + if (poll(&pfd1, 1, 0) == -1) + err(1, "poll"); + report(num++, "other side after large write", POLLIN | POLLOUT, pfd1.revents); + close(fd[0]); + if (poll(&pfd1, 1, 0) == -1) + err(1, "poll"); + report(num++, "other side after close", POLLIN | POLLHUP, pfd1.revents); + if (read(fd[1], largeblock, sizeof(largeblock)) == -1) + err(1, "read"); + if (poll(&pfd1, 1, 0) == -1) + err(1, "poll"); + report(num++, "other side after reading input", POLLHUP, pfd1.revents); + close(fd[1]); + + /* With shutdown(SHUT_WR) */ + setup(); + if (shutdown(fd[0], SHUT_WR) == -1) + err(1, "shutdown"); + if (poll(&pfd0, 1, 0) == -1) + err(1, "poll"); + report(num++, "after shutdown(SHUT_WR)", POLLOUT, pfd0.revents); + if (poll(&pfd1, 1, 0) == -1) + err(1, "poll"); + report(num++, "other side after shutdown(SHUT_WR)", POLLIN | POLLOUT, pfd1.revents); + switch (read(fd[1], largeblock, sizeof(largeblock))) { + case 0: + break; + case -1: + err(1, "read after other side shutdown"); + break; + default: + errx(1, "kernel made up data that was never written"); + } + if (poll(&pfd1, 1, 0) == -1) + err(1, "poll"); + report(num++, "other side after reading EOF", POLLIN | POLLOUT, pfd1.revents); + if (write(fd[1], largeblock, sizeof(largeblock)) == -1) + err(1, "write"); + if (poll(&pfd0, 1, 0) == -1) + err(1, "poll"); + report(num++, "after data from other side", POLLIN | POLLOUT, pfd0.revents); + if (poll(&pfd1, 1, 0) == -1) + err(1, "poll"); + report(num++, "after writing", POLLIN, pfd1.revents); + if (shutdown(fd[1], SHUT_WR) == -1) + err(1, "shutdown second"); + if (poll(&pfd0, 1, 0) == -1) + err(1, "poll"); + report(num++, "after second shutdown", POLLIN | POLLHUP, pfd0.revents); + if (poll(&pfd1, 1, 0) == -1) + err(1, "poll"); + report(num++, "after second shutdown", POLLHUP, pfd1.revents); + close(fd[0]); + if (poll(&pfd1, 1, 0) == -1) + err(1, "poll"); + report(num++, "after close", POLLHUP, pfd1.revents); + close(fd[1]); + + /* + * With shutdown(SHUT_RD) + * Note that shutdown(SHUT_WR) is passed to the peer, but + * shutdown(SHUT_RD) is not. + */ + setup(); + if (shutdown(fd[0], SHUT_RD) == -1) + err(1, "shutdown"); + if (poll(&pfd0, 1, 0) == -1) + err(1, "poll"); + report(num++, "after shutdown(SHUT_RD)", POLLIN | POLLOUT, pfd0.revents); + if (poll(&pfd1, 1, 0) == -1) + err(1, "poll"); + report(num++, "other side after shutdown(SHUT_RD)", POLLOUT, pfd1.revents); + if (shutdown(fd[0], SHUT_WR) == -1) + err(1, "shutdown"); + if (poll(&pfd0, 1, 0) == -1) + err(1, "poll"); + report(num++, "after shutdown(SHUT_WR)", POLLHUP, pfd0.revents); + if (poll(&pfd1, 1, 0) == -1) + err(1, "poll"); + report(num++, "other side after shutdown(SHUT_WR)", POLLIN | POLLOUT, pfd1.revents); + close(fd[0]); + close(fd[1]); + + return (0); +} From marcus at freebsd.org Tue Sep 1 21:31:14 2009 From: marcus at freebsd.org (Joe Marcus Clarke) Date: Tue Sep 1 21:31:27 2009 Subject: svn commit: r196741 - in stable/8: sys sys/amd64/include/xen sys/cddl/contrib/opensolaris sys/contrib/dev/acpica sys/contrib/pf sys/dev/xen/xenpci sys/fs/fifofs sys/kern tools/regression/poll In-Reply-To: <200909012058.n81KwfSk072165@svn.freebsd.org> References: <200909012058.n81KwfSk072165@svn.freebsd.org> Message-ID: <4A9D8D05.60206@freebsd.org> Jilles Tjoelker wrote: > Author: jilles > Date: Tue Sep 1 20:58:41 2009 > New Revision: 196741 > URL: http://svn.freebsd.org/changeset/base/196741 > > Log: > MFC r196460 > > Fix the conformance of poll(2) for sockets after r195423 by > returning POLLHUP instead of POLLIN for several cases. Now, the > tools/regression/poll results for FreeBSD are closer to that of the > Solaris and Linux. This is a huge change in terms of porting. I can't tell you how many times I've had to fix Linux (GNOME) apps to work on FreeBSD in this regard. Is this fix going to be ported to 7.X? Can we get a __FreeBSD_version bump? Joe -- Joe Marcus Clarke FreeBSD GNOME Team :: gnome@FreeBSD.org FreeNode / #freebsd-gnome http://www.FreeBSD.org/gnome From ivoras at freebsd.org Tue Sep 1 21:50:41 2009 From: ivoras at freebsd.org (Ivan Voras) Date: Tue Sep 1 21:50:47 2009 Subject: svn commit: r196738 - head/sys/netinet In-Reply-To: <20090901202659.GA1495@arthur.nitro.dk> References: <200909011753.n81Hr1AV068295@svn.freebsd.org> <20090901202659.GA1495@arthur.nitro.dk> Message-ID: <9bbcef730909011450t37582b50pecf87bb9927faf18@mail.gmail.com> 2009/9/1 Simon L. Nielsen : > On 2009.09.01 17:53:01 +0000, Bjoern A. Zeeb wrote: >> Author: bz >> Date: Tue Sep ?1 17:53:01 2009 >> New Revision: 196738 >> URL: http://svn.freebsd.org/changeset/base/196738 >> >> Log: >> ? In case an upper layer protocol tries to send a packet but the >> ? L2 code does not have the ethernet address for the destination >> ? within the broadcast domain in the table, we remember the >> ? original mbuf in `la_hold' in arpresolve() and send out a >> ? different packet with an arp request. > > [...] > > Thanks! > > In case anybody is interested, this was the issue which indirectly > killed the FreeBSD mail system for some hours recently. ?It was caused > by ns1.FreeBSD.org stopped responding to network traffic due to it > running out of mbuf's. > > Feel free to guess when bz's patch was applied ;-) : > http://people.freebsd.org/~simon/misc/mbuf_leak_ns1_200908.png . ?The > final spike on the graph is me running 'arp -da' a bunch of times. Interesting :) I assume this is 8 / HEAD -specific due to work done in ARP code? From jhb at FreeBSD.org Wed Sep 2 00:39:59 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Wed Sep 2 00:40:06 2009 Subject: svn commit: r196745 - in head/sys: amd64/amd64 i386/i386 Message-ID: <200909020039.n820dx8T076650@svn.freebsd.org> Author: jhb Date: Wed Sep 2 00:39:59 2009 New Revision: 196745 URL: http://svn.freebsd.org/changeset/base/196745 Log: Don't attempt to bind the current thread to the CPU an IRQ is bound to when removing an interrupt handler from an IRQ during shutdown. During shutdown we are already bound to CPU 0 and this was triggering a panic. MFC after: 3 days Modified: head/sys/amd64/amd64/local_apic.c head/sys/i386/i386/local_apic.c Modified: head/sys/amd64/amd64/local_apic.c ============================================================================== --- head/sys/amd64/amd64/local_apic.c Tue Sep 1 22:24:27 2009 (r196744) +++ head/sys/amd64/amd64/local_apic.c Wed Sep 2 00:39:59 2009 (r196745) @@ -990,18 +990,21 @@ apic_free_vector(u_int apic_id, u_int ve * we don't lose an interrupt delivery race. */ td = curthread; - thread_lock(td); - if (sched_is_bound(td)) - panic("apic_free_vector: Thread already bound.\n"); - sched_bind(td, apic_cpuid(apic_id)); - thread_unlock(td); + if (!rebooting) { + thread_lock(td); + if (sched_is_bound(td)) + panic("apic_free_vector: Thread already bound.\n"); + sched_bind(td, apic_cpuid(apic_id)); + thread_unlock(td); + } mtx_lock_spin(&icu_lock); lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS] = -1; mtx_unlock_spin(&icu_lock); - thread_lock(td); - sched_unbind(td); - thread_unlock(td); - + if (!rebooting) { + thread_lock(td); + sched_unbind(td); + thread_unlock(td); + } } /* Map an IDT vector (APIC) to an IRQ (interrupt source). */ Modified: head/sys/i386/i386/local_apic.c ============================================================================== --- head/sys/i386/i386/local_apic.c Tue Sep 1 22:24:27 2009 (r196744) +++ head/sys/i386/i386/local_apic.c Wed Sep 2 00:39:59 2009 (r196745) @@ -994,18 +994,21 @@ apic_free_vector(u_int apic_id, u_int ve * we don't lose an interrupt delivery race. */ td = curthread; - thread_lock(td); - if (sched_is_bound(td)) - panic("apic_free_vector: Thread already bound.\n"); - sched_bind(td, apic_cpuid(apic_id)); - thread_unlock(td); + if (!rebooting) { + thread_lock(td); + if (sched_is_bound(td)) + panic("apic_free_vector: Thread already bound.\n"); + sched_bind(td, apic_cpuid(apic_id)); + thread_unlock(td); + } mtx_lock_spin(&icu_lock); lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS] = -1; mtx_unlock_spin(&icu_lock); - thread_lock(td); - sched_unbind(td); - thread_unlock(td); - + if (!rebooting) { + thread_lock(td); + sched_unbind(td); + thread_unlock(td); + } } /* Map an IDT vector (APIC) to an IRQ (interrupt source). */ From alfred at FreeBSD.org Wed Sep 2 02:12:07 2009 From: alfred at FreeBSD.org (Alfred Perlstein) Date: Wed Sep 2 02:12:20 2009 Subject: svn commit: r196746 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/usb dev/usb/input dev/xen/xenpci Message-ID: <200909020212.n822C7Il078379@svn.freebsd.org> Author: alfred Date: Wed Sep 2 02:12:07 2009 New Revision: 196746 URL: http://svn.freebsd.org/changeset/base/196746 Log: MFC: r196489,196498 Critical USB bugfixes for 8.0 Approved by: re Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/usb/input/ukbd.c stable/8/sys/dev/usb/usb_dev.c stable/8/sys/dev/usb/usb_device.c stable/8/sys/dev/usb/usb_device.h stable/8/sys/dev/usb/usb_handle_request.c stable/8/sys/dev/usb/usb_hub.c stable/8/sys/dev/usb/usb_process.c stable/8/sys/dev/usb/usb_process.h stable/8/sys/dev/usb/usb_transfer.c stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/input/ukbd.c ============================================================================== --- stable/8/sys/dev/usb/input/ukbd.c Wed Sep 2 00:39:59 2009 (r196745) +++ stable/8/sys/dev/usb/input/ukbd.c Wed Sep 2 02:12:07 2009 (r196746) @@ -96,10 +96,14 @@ __FBSDID("$FreeBSD$"); #if USB_DEBUG static int ukbd_debug = 0; +static int ukbd_no_leds = 0; SYSCTL_NODE(_hw_usb, OID_AUTO, ukbd, CTLFLAG_RW, 0, "USB ukbd"); SYSCTL_INT(_hw_usb_ukbd, OID_AUTO, debug, CTLFLAG_RW, &ukbd_debug, 0, "Debug level"); +SYSCTL_INT(_hw_usb_ukbd, OID_AUTO, no_leds, CTLFLAG_RW, + &ukbd_no_leds, 0, "Disables setting of keyboard leds"); + #endif #define UPROTO_BOOT_KEYBOARD 1 @@ -165,6 +169,7 @@ struct ukbd_softc { #define UKBD_FLAG_APPLE_EJECT 0x0040 #define UKBD_FLAG_APPLE_FN 0x0080 #define UKBD_FLAG_APPLE_SWAP 0x0100 +#define UKBD_FLAG_TIMER_RUNNING 0x0200 int32_t sc_mode; /* input mode (K_XLATE,K_RAW,K_CODE) */ int32_t sc_state; /* shift/lock key state */ @@ -279,6 +284,25 @@ static device_attach_t ukbd_attach; static device_detach_t ukbd_detach; static device_resume_t ukbd_resume; +static uint8_t +ukbd_any_key_pressed(struct ukbd_softc *sc) +{ + uint8_t i; + uint8_t j; + + for (j = i = 0; i < UKBD_NKEYCODE; i++) + j |= sc->sc_odata.keycode[i]; + + return (j ? 1 : 0); +} + +static void +ukbd_start_timer(struct ukbd_softc *sc) +{ + sc->sc_flags |= UKBD_FLAG_TIMER_RUNNING; + usb_callout_reset(&sc->sc_callout, hz / 40, &ukbd_timeout, sc); +} + static void ukbd_put_key(struct ukbd_softc *sc, uint32_t key) { @@ -308,11 +332,15 @@ ukbd_do_poll(struct ukbd_softc *sc, uint usbd_transfer_poll(sc->sc_xfer, UKBD_N_TRANSFER); - DELAY(1000); /* delay 1 ms */ + /* Delay-optimised support for repetition of keys */ - sc->sc_time_ms++; + if (ukbd_any_key_pressed(sc)) { + /* a key is pressed - need timekeeping */ + DELAY(1000); - /* support repetition of keys: */ + /* 1 millisecond has passed */ + sc->sc_time_ms += 1; + } ukbd_interrupt(sc); @@ -470,7 +498,11 @@ ukbd_timeout(void *arg) } ukbd_interrupt(sc); - usb_callout_reset(&sc->sc_callout, hz / 40, &ukbd_timeout, sc); + if (ukbd_any_key_pressed(sc)) { + ukbd_start_timer(sc); + } else { + sc->sc_flags &= ~UKBD_FLAG_TIMER_RUNNING; + } } static uint8_t @@ -582,6 +614,12 @@ ukbd_intr_callback(struct usb_xfer *xfer } ukbd_interrupt(sc); + + if (!(sc->sc_flags & UKBD_FLAG_TIMER_RUNNING)) { + if (ukbd_any_key_pressed(sc)) { + ukbd_start_timer(sc); + } + } } case USB_ST_SETUP: tr_setup: @@ -613,6 +651,11 @@ ukbd_set_leds_callback(struct usb_xfer * uint8_t buf[2]; struct ukbd_softc *sc = usbd_xfer_softc(xfer); +#if USB_DEBUG + if (ukbd_no_leds) + return; +#endif + switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: case USB_ST_SETUP: @@ -647,11 +690,11 @@ ukbd_set_leds_callback(struct usb_xfer * usbd_xfer_set_frames(xfer, 2); usbd_transfer_submit(xfer); } - return; + break; default: /* Error */ DPRINTFN(0, "error=%s\n", usbd_errstr(error)); - return; + break; } } @@ -745,8 +788,6 @@ ukbd_attach(device_t dev) uint16_t n; uint16_t hid_len; - mtx_assert(&Giant, MA_OWNED); - kbd_init_struct(kbd, UKBD_DRIVER_NAME, KB_OTHER, unit, 0, 0, 0); kbd->kb_data = (void *)sc; @@ -831,7 +872,7 @@ ukbd_attach(device_t dev) } /* ignore if SETIDLE fails, hence it is not crucial */ - err = usbd_req_set_idle(sc->sc_udev, &Giant, sc->sc_iface_index, 0, 0); + err = usbd_req_set_idle(sc->sc_udev, NULL, sc->sc_iface_index, 0, 0); ukbd_ioctl(kbd, KDSETLED, (caddr_t)&sc->sc_state); @@ -862,9 +903,6 @@ ukbd_attach(device_t dev) usbd_transfer_start(sc->sc_xfer[UKBD_INTR_DT]); - /* start the timer */ - - ukbd_timeout(sc); mtx_unlock(&Giant); return (0); /* success */ @@ -879,8 +917,6 @@ ukbd_detach(device_t dev) struct ukbd_softc *sc = device_get_softc(dev); int error; - mtx_assert(&Giant, MA_OWNED); - DPRINTF("\n"); if (sc->sc_flags & UKBD_FLAG_POLLING) { @@ -927,8 +963,6 @@ ukbd_resume(device_t dev) { struct ukbd_softc *sc = device_get_softc(dev); - mtx_assert(&Giant, MA_OWNED); - ukbd_clear_state(&sc->sc_kbd); return (0); @@ -945,7 +979,6 @@ ukbd_configure(int flags) static int ukbd__probe(int unit, void *arg, int flags) { - mtx_assert(&Giant, MA_OWNED); return (ENXIO); } @@ -953,7 +986,6 @@ ukbd__probe(int unit, void *arg, int fla static int ukbd_init(int unit, keyboard_t **kbdp, void *arg, int flags) { - mtx_assert(&Giant, MA_OWNED); return (ENXIO); } @@ -961,7 +993,6 @@ ukbd_init(int unit, keyboard_t **kbdp, v static int ukbd_test_if(keyboard_t *kbd) { - mtx_assert(&Giant, MA_OWNED); return (0); } @@ -969,7 +1000,6 @@ ukbd_test_if(keyboard_t *kbd) static int ukbd_term(keyboard_t *kbd) { - mtx_assert(&Giant, MA_OWNED); return (ENXIO); } @@ -977,7 +1007,6 @@ ukbd_term(keyboard_t *kbd) static int ukbd_intr(keyboard_t *kbd, void *arg) { - mtx_assert(&Giant, MA_OWNED); return (0); } @@ -985,7 +1014,6 @@ ukbd_intr(keyboard_t *kbd, void *arg) static int ukbd_lock(keyboard_t *kbd, int lock) { - mtx_assert(&Giant, MA_OWNED); return (1); } @@ -1004,7 +1032,6 @@ ukbd_enable(keyboard_t *kbd) mtx_unlock(&Giant); return (retval); } - mtx_assert(&Giant, MA_OWNED); KBD_ACTIVATE(kbd); return (0); } @@ -1021,7 +1048,6 @@ ukbd_disable(keyboard_t *kbd) mtx_unlock(&Giant); return (retval); } - mtx_assert(&Giant, MA_OWNED); KBD_DEACTIVATE(kbd); return (0); } @@ -1050,7 +1076,6 @@ ukbd_check(keyboard_t *kbd) if (!mtx_owned(&Giant)) return (0); } - mtx_assert(&Giant, MA_OWNED); #ifdef UKBD_EMULATE_ATSCANCODE if (sc->sc_buffered_char[0]) { @@ -1086,7 +1111,6 @@ ukbd_check_char(keyboard_t *kbd) if (!mtx_owned(&Giant)) return (0); } - mtx_assert(&Giant, MA_OWNED); if ((sc->sc_composed_char > 0) && (!(sc->sc_flags & UKBD_FLAG_COMPOSE))) { @@ -1125,7 +1149,6 @@ ukbd_read(keyboard_t *kbd, int wait) if (!mtx_owned(&Giant)) return (-1); } - mtx_assert(&Giant, MA_OWNED); #ifdef UKBD_EMULATE_ATSCANCODE if (sc->sc_buffered_char[0]) { @@ -1190,7 +1213,6 @@ ukbd_read_char(keyboard_t *kbd, int wait if (!mtx_owned(&Giant)) return (NOKEY); } - mtx_assert(&Giant, MA_OWNED); next_code: @@ -1393,7 +1415,6 @@ ukbd_ioctl(keyboard_t *kbd, u_long cmd, */ return (EINVAL); } - mtx_assert(&Giant, MA_OWNED); switch (cmd) { case KDGKBMODE: /* get keyboard mode */ @@ -1527,7 +1548,6 @@ ukbd_clear_state(keyboard_t *kbd) if (!mtx_owned(&Giant)) { return; /* XXX */ } - mtx_assert(&Giant, MA_OWNED); sc->sc_flags &= ~(UKBD_FLAG_COMPOSE | UKBD_FLAG_POLLING); sc->sc_state &= LOCK_MASK; /* preserve locking key state */ @@ -1547,7 +1567,6 @@ ukbd_clear_state(keyboard_t *kbd) static int ukbd_get_state(keyboard_t *kbd, void *buf, size_t len) { - mtx_assert(&Giant, MA_OWNED); return (len == 0) ? 1 : -1; } @@ -1555,7 +1574,6 @@ ukbd_get_state(keyboard_t *kbd, void *bu static int ukbd_set_state(keyboard_t *kbd, void *buf, size_t len) { - mtx_assert(&Giant, MA_OWNED); return (EINVAL); } @@ -1572,7 +1590,6 @@ ukbd_poll(keyboard_t *kbd, int on) mtx_unlock(&Giant); return (retval); } - mtx_assert(&Giant, MA_OWNED); if (on) { sc->sc_flags |= UKBD_FLAG_POLLING; Modified: stable/8/sys/dev/usb/usb_dev.c ============================================================================== --- stable/8/sys/dev/usb/usb_dev.c Wed Sep 2 00:39:59 2009 (r196745) +++ stable/8/sys/dev/usb/usb_dev.c Wed Sep 2 02:12:07 2009 (r196746) @@ -217,7 +217,7 @@ usb_ref_device(struct usb_cdev_privdata * We need to grab the sx-lock before grabbing the * FIFO refs to avoid deadlock at detach! */ - sx_xlock(cpd->udev->default_sx + 1); + usbd_enum_lock(cpd->udev); mtx_lock(&usb_ref_lock); @@ -275,14 +275,12 @@ usb_ref_device(struct usb_cdev_privdata } mtx_unlock(&usb_ref_lock); - if (crd->is_uref) { - mtx_lock(&Giant); /* XXX */ - } return (0); error: if (crd->is_uref) { - sx_unlock(cpd->udev->default_sx + 1); + usbd_enum_unlock(cpd->udev); + if (--(cpd->udev->refcount) == 0) { cv_signal(cpd->udev->default_cv + 1); } @@ -334,10 +332,9 @@ usb_unref_device(struct usb_cdev_privdat DPRINTFN(2, "cpd=%p is_uref=%d\n", cpd, crd->is_uref); - if (crd->is_uref) { - mtx_unlock(&Giant); /* XXX */ - sx_unlock(cpd->udev->default_sx + 1); - } + if (crd->is_uref) + usbd_enum_unlock(cpd->udev); + mtx_lock(&usb_ref_lock); if (crd->is_read) { if (--(crd->rxfifo->refcount) == 0) { @@ -1042,9 +1039,9 @@ usb_ioctl(struct cdev *dev, u_long cmd, * reference if we need it! */ err = usb_ref_device(cpd, &refs, 0 /* no uref */ ); - if (err) { + if (err) return (ENXIO); - } + fflags = cpd->fflags; f = NULL; /* set default value */ Modified: stable/8/sys/dev/usb/usb_device.c ============================================================================== --- stable/8/sys/dev/usb/usb_device.c Wed Sep 2 00:39:59 2009 (r196745) +++ stable/8/sys/dev/usb/usb_device.c Wed Sep 2 02:12:07 2009 (r196746) @@ -402,11 +402,11 @@ usb_unconfigure(struct usb_device *udev, uint8_t do_unlock; /* automatic locking */ - if (sx_xlocked(udev->default_sx + 1)) { + if (usbd_enum_is_locked(udev)) { do_unlock = 0; } else { do_unlock = 1; - sx_xlock(udev->default_sx + 1); + usbd_enum_lock(udev); } /* detach all interface drivers */ @@ -442,9 +442,8 @@ usb_unconfigure(struct usb_device *udev, udev->curr_config_no = USB_UNCONFIG_NO; udev->curr_config_index = USB_UNCONFIG_INDEX; - if (do_unlock) { - sx_unlock(udev->default_sx + 1); - } + if (do_unlock) + usbd_enum_unlock(udev); } /*------------------------------------------------------------------------* @@ -472,11 +471,11 @@ usbd_set_config_index(struct usb_device DPRINTFN(6, "udev=%p index=%d\n", udev, index); /* automatic locking */ - if (sx_xlocked(udev->default_sx + 1)) { + if (usbd_enum_is_locked(udev)) { do_unlock = 0; } else { do_unlock = 1; - sx_xlock(udev->default_sx + 1); + usbd_enum_lock(udev); } usb_unconfigure(udev, USB_UNCFG_FLAG_FREE_SUBDEV); @@ -585,9 +584,8 @@ done: if (err) { usb_unconfigure(udev, USB_UNCFG_FLAG_FREE_SUBDEV); } - if (do_unlock) { - sx_unlock(udev->default_sx + 1); - } + if (do_unlock) + usbd_enum_unlock(udev); return (err); } @@ -823,11 +821,11 @@ usbd_set_alt_interface_index(struct usb_ uint8_t do_unlock; /* automatic locking */ - if (sx_xlocked(udev->default_sx + 1)) { + if (usbd_enum_is_locked(udev)) { do_unlock = 0; } else { do_unlock = 1; - sx_xlock(udev->default_sx + 1); + usbd_enum_lock(udev); } if (iface == NULL) { err = USB_ERR_INVAL; @@ -863,9 +861,9 @@ usbd_set_alt_interface_index(struct usb_ iface->idesc->bAlternateSetting); done: - if (do_unlock) { - sx_unlock(udev->default_sx + 1); - } + if (do_unlock) + usbd_enum_unlock(udev); + return (err); } @@ -1230,11 +1228,11 @@ usb_probe_and_attach(struct usb_device * return (USB_ERR_INVAL); } /* automatic locking */ - if (sx_xlocked(udev->default_sx + 1)) { + if (usbd_enum_is_locked(udev)) { do_unlock = 0; } else { do_unlock = 1; - sx_xlock(udev->default_sx + 1); + usbd_enum_lock(udev); } if (udev->curr_config_index == USB_UNCONFIG_INDEX) { @@ -1315,9 +1313,9 @@ usb_probe_and_attach(struct usb_device * } } done: - if (do_unlock) { - sx_unlock(udev->default_sx + 1); - } + if (do_unlock) + usbd_enum_unlock(udev); + return (0); } @@ -1779,7 +1777,8 @@ repeat_set_config: } } else if (usb_test_huawei_autoinst_p(udev, &uaa) == 0) { DPRINTFN(0, "Found Huawei auto-install disk!\n"); - err = USB_ERR_STALLED; /* fake an error */ + /* leave device unconfigured */ + usb_unconfigure(udev, USB_UNCFG_FLAG_FREE_SUBDEV); } } else { err = 0; /* set success */ @@ -1902,15 +1901,18 @@ static void usb_cdev_free(struct usb_device *udev) { struct usb_fs_privdata* pd; + struct cdev* pcdev; DPRINTFN(2, "Freeing device nodes\n"); while ((pd = LIST_FIRST(&udev->pd_list)) != NULL) { KASSERT(pd->cdev->si_drv1 == pd, ("privdata corrupt")); - destroy_dev_sched_cb(pd->cdev, usb_cdev_cleanup, pd); + pcdev = pd->cdev; pd->cdev = NULL; LIST_REMOVE(pd, pd_next); + if (pcdev != NULL) + destroy_dev_sched_cb(pcdev, usb_cdev_cleanup, pd); } } @@ -2448,3 +2450,37 @@ usbd_device_attached(struct usb_device * { return (udev->state > USB_STATE_DETACHED); } + +/* The following function locks enumerating the given USB device. */ + +void +usbd_enum_lock(struct usb_device *udev) +{ + sx_xlock(udev->default_sx + 1); + /* + * NEWBUS LOCK NOTE: We should check if any parent SX locks + * are locked before locking Giant. Else the lock can be + * locked multiple times. + */ + mtx_lock(&Giant); +} + +/* The following function unlocks enumerating the given USB device. */ + +void +usbd_enum_unlock(struct usb_device *udev) +{ + mtx_unlock(&Giant); + sx_xunlock(udev->default_sx + 1); +} + +/* + * The following function checks the enumerating lock for the given + * USB device. + */ + +uint8_t +usbd_enum_is_locked(struct usb_device *udev) +{ + return (sx_xlocked(udev->default_sx + 1)); +} Modified: stable/8/sys/dev/usb/usb_device.h ============================================================================== --- stable/8/sys/dev/usb/usb_device.h Wed Sep 2 00:39:59 2009 (r196745) +++ stable/8/sys/dev/usb/usb_device.h Wed Sep 2 02:12:07 2009 (r196746) @@ -211,5 +211,8 @@ uint8_t usb_peer_can_wakeup(struct usb_d struct usb_endpoint *usb_endpoint_foreach(struct usb_device *udev, struct usb_endpoint *ep); void usb_set_device_state(struct usb_device *udev, enum usb_dev_state state); +void usbd_enum_lock(struct usb_device *); +void usbd_enum_unlock(struct usb_device *); +uint8_t usbd_enum_is_locked(struct usb_device *); #endif /* _USB_DEVICE_H_ */ Modified: stable/8/sys/dev/usb/usb_handle_request.c ============================================================================== --- stable/8/sys/dev/usb/usb_handle_request.c Wed Sep 2 00:39:59 2009 (r196745) +++ stable/8/sys/dev/usb/usb_handle_request.c Wed Sep 2 02:12:07 2009 (r196746) @@ -152,8 +152,8 @@ usb_handle_set_config(struct usb_xfer *x * attach: */ USB_XFER_UNLOCK(xfer); - mtx_lock(&Giant); /* XXX */ - sx_xlock(udev->default_sx + 1); + + usbd_enum_lock(udev); if (conf_no == USB_UNCONFIG_NO) { conf_no = USB_UNCONFIG_INDEX; @@ -176,8 +176,7 @@ usb_handle_set_config(struct usb_xfer *x goto done; } done: - mtx_unlock(&Giant); /* XXX */ - sx_unlock(udev->default_sx + 1); + usbd_enum_unlock(udev); USB_XFER_LOCK(xfer); return (err); } @@ -190,19 +189,19 @@ usb_check_alt_setting(struct usb_device usb_error_t err = 0; /* automatic locking */ - if (sx_xlocked(udev->default_sx + 1)) { + if (usbd_enum_is_locked(udev)) { do_unlock = 0; } else { do_unlock = 1; - sx_xlock(udev->default_sx + 1); + usbd_enum_lock(udev); } if (alt_index >= usbd_get_no_alts(udev->cdesc, iface->idesc)) err = USB_ERR_INVAL; - if (do_unlock) { - sx_unlock(udev->default_sx + 1); - } + if (do_unlock) + usbd_enum_unlock(udev); + return (err); } @@ -236,8 +235,8 @@ usb_handle_iface_request(struct usb_xfer * attach: */ USB_XFER_UNLOCK(xfer); - mtx_lock(&Giant); /* XXX */ - sx_xlock(udev->default_sx + 1); + + usbd_enum_lock(udev); error = ENXIO; @@ -353,20 +352,17 @@ tr_repeat: goto tr_stalled; } tr_valid: - mtx_unlock(&Giant); - sx_unlock(udev->default_sx + 1); + usbd_enum_unlock(udev); USB_XFER_LOCK(xfer); return (0); tr_short: - mtx_unlock(&Giant); - sx_unlock(udev->default_sx + 1); + usbd_enum_unlock(udev); USB_XFER_LOCK(xfer); return (USB_ERR_SHORT_XFER); tr_stalled: - mtx_unlock(&Giant); - sx_unlock(udev->default_sx + 1); + usbd_enum_unlock(udev); USB_XFER_LOCK(xfer); return (USB_ERR_STALLED); } Modified: stable/8/sys/dev/usb/usb_hub.c ============================================================================== --- stable/8/sys/dev/usb/usb_hub.c Wed Sep 2 00:39:59 2009 (r196745) +++ stable/8/sys/dev/usb/usb_hub.c Wed Sep 2 02:12:07 2009 (r196746) @@ -96,6 +96,7 @@ struct uhub_current_state { struct uhub_softc { struct uhub_current_state sc_st;/* current state */ device_t sc_dev; /* base device */ + struct mtx sc_mtx; /* our mutex */ struct usb_device *sc_udev; /* USB device */ struct usb_xfer *sc_xfer[UHUB_N_TRANSFER]; /* interrupt xfer */ uint8_t sc_flags; @@ -428,7 +429,6 @@ repeat: mode = USB_MODE_HOST; /* need to create a new child */ - child = usb_alloc_device(sc->sc_dev, udev->bus, udev, udev->depth + 1, portno - 1, portno, speed, mode); if (child == NULL) { @@ -691,6 +691,8 @@ uhub_attach(device_t dev) sc->sc_udev = udev; sc->sc_dev = dev; + mtx_init(&sc->sc_mtx, "USB HUB mutex", NULL, MTX_DEF); + snprintf(sc->sc_name, sizeof(sc->sc_name), "%s", device_get_nameunit(dev)); @@ -774,7 +776,7 @@ uhub_attach(device_t dev) } else { /* normal HUB */ err = usbd_transfer_setup(udev, &iface_index, sc->sc_xfer, - uhub_config, UHUB_N_TRANSFER, sc, &Giant); + uhub_config, UHUB_N_TRANSFER, sc, &sc->sc_mtx); } if (err) { DPRINTFN(0, "cannot setup interrupt transfer, " @@ -850,9 +852,9 @@ uhub_attach(device_t dev) /* Start the interrupt endpoint, if any */ if (sc->sc_xfer[0] != NULL) { - USB_XFER_LOCK(sc->sc_xfer[0]); + mtx_lock(&sc->sc_mtx); usbd_transfer_start(sc->sc_xfer[0]); - USB_XFER_UNLOCK(sc->sc_xfer[0]); + mtx_unlock(&sc->sc_mtx); } /* Enable automatic power save on all USB HUBs */ @@ -868,6 +870,9 @@ error: free(udev->hub, M_USBDEV); udev->hub = NULL; } + + mtx_destroy(&sc->sc_mtx); + return (ENXIO); } @@ -908,6 +913,9 @@ uhub_detach(device_t dev) free(hub, M_USBDEV); sc->sc_udev->hub = NULL; + + mtx_destroy(&sc->sc_mtx); + return (0); } @@ -1775,10 +1783,13 @@ usb_dev_resume_peer(struct usb_device *u /* always update hardware power! */ (bus->methods->set_hw_power) (bus); } - sx_xlock(udev->default_sx + 1); + + usbd_enum_lock(udev); + /* notify all sub-devices about resume */ err = usb_suspend_resume(udev, 0); - sx_unlock(udev->default_sx + 1); + + usbd_enum_unlock(udev); /* check if peer has wakeup capability */ if (usb_peer_can_wakeup(udev)) { @@ -1844,10 +1855,12 @@ repeat: } } - sx_xlock(udev->default_sx + 1); + usbd_enum_lock(udev); + /* notify all sub-devices about suspend */ err = usb_suspend_resume(udev, 1); - sx_unlock(udev->default_sx + 1); + + usbd_enum_unlock(udev); if (usb_peer_can_wakeup(udev)) { /* allow device to do remote wakeup */ Modified: stable/8/sys/dev/usb/usb_process.c ============================================================================== --- stable/8/sys/dev/usb/usb_process.c Wed Sep 2 00:39:59 2009 (r196745) +++ stable/8/sys/dev/usb/usb_process.c Wed Sep 2 02:12:07 2009 (r196746) @@ -457,3 +457,29 @@ usb_proc_drain(struct usb_process *up) } mtx_unlock(up->up_mtx); } + +/*------------------------------------------------------------------------* + * usb_proc_rewakeup + * + * This function is called to re-wakeup the the given USB + * process. This usually happens after that the USB system has been in + * polling mode, like during a panic. This function must be called + * having "up->up_mtx" locked. + *------------------------------------------------------------------------*/ +void +usb_proc_rewakeup(struct usb_process *up) +{ + /* check if not initialised */ + if (up->up_mtx == NULL) + return; + /* check if gone */ + if (up->up_gone) + return; + + mtx_assert(up->up_mtx, MA_OWNED); + + if (up->up_msleep == 0) { + /* re-wakeup */ + cv_signal(&up->up_cv); + } +} Modified: stable/8/sys/dev/usb/usb_process.h ============================================================================== --- stable/8/sys/dev/usb/usb_process.h Wed Sep 2 00:39:59 2009 (r196745) +++ stable/8/sys/dev/usb/usb_process.h Wed Sep 2 02:12:07 2009 (r196746) @@ -75,5 +75,6 @@ void usb_proc_drain(struct usb_process * void usb_proc_mwait(struct usb_process *up, void *pm0, void *pm1); void usb_proc_free(struct usb_process *up); void *usb_proc_msignal(struct usb_process *up, void *pm0, void *pm1); +void usb_proc_rewakeup(struct usb_process *up); #endif /* _USB_PROCESS_H_ */ Modified: stable/8/sys/dev/usb/usb_transfer.c ============================================================================== --- stable/8/sys/dev/usb/usb_transfer.c Wed Sep 2 00:39:59 2009 (r196745) +++ stable/8/sys/dev/usb/usb_transfer.c Wed Sep 2 02:12:07 2009 (r196746) @@ -2907,13 +2907,9 @@ usbd_transfer_poll(struct usb_xfer **ppx } /* Make sure cv_signal() and cv_broadcast() is not called */ - udev->bus->control_xfer_proc.up_dsleep = 0; udev->bus->control_xfer_proc.up_msleep = 0; - udev->bus->explore_proc.up_dsleep = 0; udev->bus->explore_proc.up_msleep = 0; - udev->bus->giant_callback_proc.up_dsleep = 0; udev->bus->giant_callback_proc.up_msleep = 0; - udev->bus->non_giant_callback_proc.up_dsleep = 0; udev->bus->non_giant_callback_proc.up_msleep = 0; /* poll USB hardware */ From ache at FreeBSD.org Wed Sep 2 04:26:34 2009 From: ache at FreeBSD.org (Andrey A. Chernov) Date: Wed Sep 2 04:26:46 2009 Subject: svn commit: r196750 - head/contrib/ee Message-ID: <200909020426.n824QY98081387@svn.freebsd.org> Author: ache Date: Wed Sep 2 04:26:34 2009 New Revision: 196750 URL: http://svn.freebsd.org/changeset/base/196750 Log: 1) Use isprint() instead of hardcoded values to detect non-printable. 2) Use (unsigned char) cast in waddch() calls. It fix highlighting bug: sign extension of 8bit to the attributes area. 3) Use setlocale() in any case. Modified: head/contrib/ee/ee.c Modified: head/contrib/ee/ee.c ============================================================================== --- head/contrib/ee/ee.c Wed Sep 2 03:03:53 2009 (r196749) +++ head/contrib/ee/ee.c Wed Sep 2 04:26:34 2009 (r196750) @@ -726,7 +726,7 @@ int character; /* new character */ } *point = character; /* insert new character */ wclrtoeol(text_win); - if (((character >= 0) && (character < ' ')) || (character >= 127)) /* check for TAB character*/ + if (!isprint((unsigned char)character)) /* check for TAB character*/ { scr_pos = scr_horz += out_char(text_win, character, scr_horz); point++; @@ -734,7 +734,7 @@ int character; /* new character */ } else { - waddch(text_win, character); + waddch(text_win, (unsigned char)character); scr_pos = ++scr_horz; point++; position ++; @@ -969,17 +969,17 @@ int column; } else { - waddch(window, (char)character ); + waddch(window, (unsigned char)character ); return(1); } } else { - waddch(window, (char)character); + waddch(window, (unsigned char)character); return(1); } for (i2 = 0; (string[i2] != '\0') && (((column+i2+1)-horiz_offset) < last_col); i2++) - waddch(window, string[i2]); + waddch(window, (unsigned char)string[i2]); return(strlen(string)); } @@ -1044,7 +1044,7 @@ int length; /* length (in bytes) of line wclrtoeol(text_win); while ((posit < length) && (column <= last_col)) { - if ((*temp < 32) || (*temp >= 127)) + if (!isprint(*temp)) { column += len_char(*temp, abs_column); abs_column += out_char(text_win, *temp, abs_column); @@ -1923,13 +1923,13 @@ int advance; /* if true, skip leading s } *nam_str = in; g_pos++; - if (((in < ' ') || (in > 126)) && (g_horz < (last_col - 1))) + if (!isprint((unsigned char)in) && (g_horz < (last_col - 1))) g_horz += out_char(com_win, in, g_horz); else { g_horz++; if (g_horz < (last_col - 1)) - waddch(com_win, in); + waddch(com_win, (unsigned char)in); } nam_str++; } @@ -5085,8 +5085,8 @@ strings_init() { int counter; -#ifndef NO_CATGETS setlocale(LC_ALL, ""); +#ifndef NO_CATGETS catalog = catopen("ee", NL_CAT_LOCALE); #endif /* NO_CATGETS */ From ache at FreeBSD.org Wed Sep 2 04:43:47 2009 From: ache at FreeBSD.org (Andrey A. Chernov) Date: Wed Sep 2 04:43:59 2009 Subject: svn commit: r196751 - head/contrib/ee Message-ID: <200909020443.n824hl88081733@svn.freebsd.org> Author: ache Date: Wed Sep 2 04:43:46 2009 New Revision: 196751 URL: http://svn.freebsd.org/changeset/base/196751 Log: Move out of NO_CATGETS define too (as setlocale() in prev. commit) Modified: head/contrib/ee/ee.c Modified: head/contrib/ee/ee.c ============================================================================== --- head/contrib/ee/ee.c Wed Sep 2 04:26:34 2009 (r196750) +++ head/contrib/ee/ee.c Wed Sep 2 04:43:46 2009 (r196751) @@ -83,6 +83,7 @@ char *version = "@(#) ee, version " EE_ #include #include #include +#include #ifdef HAS_SYS_WAIT #include @@ -100,9 +101,7 @@ char *version = "@(#) ee, version " EE_ #include #endif - #ifndef NO_CATGETS -#include #include nl_catd catalog; From ache at FreeBSD.org Wed Sep 2 04:56:30 2009 From: ache at FreeBSD.org (Andrey A. Chernov) Date: Wed Sep 2 04:56:41 2009 Subject: svn commit: r196752 - head/lib/libc/stdtime Message-ID: <200909020456.n824uUqQ082136@svn.freebsd.org> Author: ache Date: Wed Sep 2 04:56:30 2009 New Revision: 196752 URL: http://svn.freebsd.org/changeset/base/196752 Log: Use (unsigned char) cast for ctype macro Modified: head/lib/libc/stdtime/strptime.c Modified: head/lib/libc/stdtime/strptime.c ============================================================================== --- head/lib/libc/stdtime/strptime.c Wed Sep 2 04:43:46 2009 (r196751) +++ head/lib/libc/stdtime/strptime.c Wed Sep 2 04:56:30 2009 (r196752) @@ -529,7 +529,7 @@ label: buf++; i = 0; for (len = 4; len > 0; len--) { - if (isdigit((int)*buf)) { + if (isdigit((unsigned char)*buf)) { i *= 10; i += *buf - '0'; buf++; From maxim at macomnet.ru Wed Sep 2 05:21:06 2009 From: maxim at macomnet.ru (Maxim Konovalov) Date: Wed Sep 2 05:21:18 2009 Subject: svn commit: r196727 - head/share/man/man5 In-Reply-To: <4A9D4A90.30700@FreeBSD.org> References: <200909010555.n815tAkx050140@svn.freebsd.org> <4A9D4A90.30700@FreeBSD.org> Message-ID: <20090902092054.Q27429@mp2.macomnet.net> On Tue, 1 Sep 2009, 09:23-0700, Doug Barton wrote: > Maxim Konovalov wrote: > > Author: maxim > > Date: Tue Sep 1 05:55:10 2009 > > New Revision: 196727 > > URL: http://svn.freebsd.org/changeset/base/196727 > > > > Log: > > o Document MALLOC_PRODUCTION knob. > > > > PR: docs/136029 > > Submitted by: anonymous > > MFC after: 2 weeks > > > > Modified: > > head/share/man/man5/make.conf.5 > > Unless I'm missing something this should be in the src.conf man page > instead of make.conf. > Please explain why. -- Maxim Konovalov From trasz at FreeBSD.org Wed Sep 2 05:27:00 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Wed Sep 2 05:27:06 2009 Subject: svn commit: r196753 - head/bin/chmod Message-ID: <200909020526.n825QxaP082834@svn.freebsd.org> Author: trasz Date: Wed Sep 2 05:26:59 2009 New Revision: 196753 URL: http://svn.freebsd.org/changeset/base/196753 Log: - Don't include both and - Keep variables sorted - Fix logic error with -f and -v options - don't print the usual -v output if there was an error, whether or not we were passed -f - Don't call free(3) just before exit(2) - Whitespace fixes Submitted by: bde Modified: head/bin/chmod/chmod.c Modified: head/bin/chmod/chmod.c ============================================================================== --- head/bin/chmod/chmod.c Wed Sep 2 04:56:30 2009 (r196752) +++ head/bin/chmod/chmod.c Wed Sep 2 05:26:59 2009 (r196753) @@ -41,7 +41,6 @@ static char sccsid[] = "@(#)chmod.c 8.8 #include __FBSDID("$FreeBSD$"); -#include #include #include @@ -63,7 +62,7 @@ main(int argc, char *argv[]) FTS *ftsp; FTSENT *p; mode_t *set; - int Hflag, Lflag, Rflag, ch, fflag, fts_options, hflag, rval, error; + int Hflag, Lflag, Rflag, ch, error, fflag, fts_options, hflag, rval; int vflag; char *mode; mode_t newmode; @@ -170,7 +169,6 @@ done: argv += optind; */ if (!hflag) continue; - /* else */ /* FALLTHROUGH */ default: break; @@ -188,9 +186,11 @@ done: argv += optind; error = lchmod(p->fts_accpath, newmode); else error = chmod(p->fts_accpath, newmode); - if (error && !fflag) { - warn("%s", p->fts_path); - rval = 1; + if (error) { + if (!fflag) { + warn("%s", p->fts_path); + rval = 1; + } } else { if (vflag) { (void)printf("%s", p->fts_path); @@ -201,7 +201,6 @@ done: argv += optind; strmode(p->fts_statp->st_mode, m1); strmode((p->fts_statp->st_mode & S_IFMT) | newmode, m2); - (void)printf(": 0%o [%s] -> 0%o [%s]", p->fts_statp->st_mode, m1, (p->fts_statp->st_mode & S_IFMT) | @@ -209,12 +208,10 @@ done: argv += optind; } (void)printf("\n"); } - } } if (errno) err(1, "fts_read"); - free(set); exit(rval); } From remko at elvandar.org Wed Sep 2 06:12:57 2009 From: remko at elvandar.org (Remko Lodder) Date: Wed Sep 2 06:13:09 2009 Subject: svn commit: r196746 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/usb dev/usb/input dev/xen/xenpci In-Reply-To: <200909020212.n822C7Il078379@svn.freebsd.org> References: <200909020212.n822C7Il078379@svn.freebsd.org> Message-ID: <8497dc1520e5fe6b2b3727d5fb92f358.squirrel@www.jr-hosting.nl> On Wed, September 2, 2009 4:12 am, Alfred Perlstein wrote: > Author: alfred > Date: Wed Sep 2 02:12:07 2009 > New Revision: 196746 > URL: http://svn.freebsd.org/changeset/base/196746 > > Log: > MFC: r196489,196498 > Critical USB bugfixes for 8.0 > Dear Alfred (and hps!), It would be awesome to see something more about this in the commit log. I needed to look up the specific revisions to see what changed. I always learned from Warner and people, that including the original commit message(s) saves a lot of time and makes it clear about what is being merged. Can you help and include a bit more information next time please? Thanks alot! -- /"\ Best regards, | remko@FreeBSD.org \ / Remko Lodder | remko@EFnet X http://www.evilcoder.org/ | / \ ASCII Ribbon Campaign | Against HTML Mail and News From simon at FreeBSD.org Wed Sep 2 07:08:11 2009 From: simon at FreeBSD.org (Simon L. Nielsen) Date: Wed Sep 2 07:08:17 2009 Subject: svn commit: r196752 - head/lib/libc/stdtime In-Reply-To: <200909020456.n824uUqQ082136@svn.freebsd.org> References: <200909020456.n824uUqQ082136@svn.freebsd.org> Message-ID: <20090902070808.GA1290@arthur.nitro.dk> On 2009.09.02 04:56:30 +0000, Andrey A. Chernov wrote: > Author: ache > Date: Wed Sep 2 04:56:30 2009 > New Revision: 196752 > URL: http://svn.freebsd.org/changeset/base/196752 > > Log: > Use (unsigned char) cast for ctype macro Acording to the manual page and the C standard book I have, isdigit() takes an int for an argument, so why change this? Is passing it as an int instead of char causing problems? -- Simon L. Nielsen From trasz at FreeBSD.org Wed Sep 2 08:08:57 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Wed Sep 2 08:09:09 2009 Subject: svn commit: r196754 - head/bin/cp Message-ID: <200909020808.n8288vJK086081@svn.freebsd.org> Author: trasz Date: Wed Sep 2 08:08:57 2009 New Revision: 196754 URL: http://svn.freebsd.org/changeset/base/196754 Log: Add NFSv4 ACL support to cp(1) and fix a few memory leaks. Note that this changes error reporting behaviour somewhat - before, no error was reported if ACL couldn't be copied because the target filesystem doesn't support ACLs. Now, it will be reported - of course, only if there actually is an ACL to copy. Reviewed by: rwatson Modified: head/bin/cp/utils.c Modified: head/bin/cp/utils.c ============================================================================== --- head/bin/cp/utils.c Wed Sep 2 05:26:59 2009 (r196753) +++ head/bin/cp/utils.c Wed Sep 2 08:08:57 2009 (r196754) @@ -377,24 +377,52 @@ setfile(struct stat *fs, int fd) int preserve_fd_acls(int source_fd, int dest_fd) { - struct acl *aclp; acl_t acl; + acl_type_t acl_type; + int acl_supported = 0, ret, trivial; - if (fpathconf(source_fd, _PC_ACL_EXTENDED) != 1 || - fpathconf(dest_fd, _PC_ACL_EXTENDED) != 1) + ret = fpathconf(source_fd, _PC_ACL_NFS4); + if (ret > 0 ) { + acl_supported = 1; + acl_type = ACL_TYPE_NFS4; + } else if (ret < 0 && errno != EINVAL) { + warn("fpathconf(..., _PC_ACL_NFS4) failed for %s", to.p_path); + return (1); + } + if (acl_supported == 0) { + ret = fpathconf(source_fd, _PC_ACL_EXTENDED); + if (ret > 0 ) { + acl_supported = 1; + acl_type = ACL_TYPE_ACCESS; + } else if (ret < 0 && errno != EINVAL) { + warn("fpathconf(..., _PC_ACL_EXTENDED) failed for %s", + to.p_path); + return (1); + } + } + if (acl_supported == 0) return (0); - acl = acl_get_fd(source_fd); + + acl = acl_get_fd_np(source_fd, acl_type); if (acl == NULL) { warn("failed to get acl entries while setting %s", to.p_path); return (1); } - aclp = &acl->ats_acl; - if (aclp->acl_cnt == 3) + if (acl_is_trivial_np(acl, &trivial)) { + warn("acl_is_trivial() failed for %s", to.p_path); + acl_free(acl); + return (1); + } + if (trivial) { + acl_free(acl); return (0); - if (acl_set_fd(dest_fd, acl) < 0) { + } + if (acl_set_fd_np(dest_fd, acl, acl_type) < 0) { warn("failed to set acl entries for %s", to.p_path); + acl_free(acl); return (1); } + acl_free(acl); return (0); } @@ -405,10 +433,31 @@ preserve_dir_acls(struct stat *fs, char int (*aclsetf)(const char *, acl_type_t, acl_t); struct acl *aclp; acl_t acl; + acl_type_t acl_type; + int acl_supported = 0, ret, trivial; - if (pathconf(source_dir, _PC_ACL_EXTENDED) != 1 || - pathconf(dest_dir, _PC_ACL_EXTENDED) != 1) + ret = pathconf(source_dir, _PC_ACL_NFS4); + if (ret > 0) { + acl_supported = 1; + acl_type = ACL_TYPE_NFS4; + } else if (ret < 0 && errno != EINVAL) { + warn("fpathconf(..., _PC_ACL_NFS4) failed for %s", source_dir); + return (1); + } + if (acl_supported == 0) { + ret = pathconf(source_dir, _PC_ACL_EXTENDED); + if (ret > 0) { + acl_supported = 1; + acl_type = ACL_TYPE_ACCESS; + } else if (ret < 0 && errno != EINVAL) { + warn("fpathconf(..., _PC_ACL_EXTENDED) failed for %s", + source_dir); + return (1); + } + } + if (acl_supported == 0) return (0); + /* * If the file is a link we will not follow it */ @@ -419,34 +468,48 @@ preserve_dir_acls(struct stat *fs, char aclgetf = acl_get_file; aclsetf = acl_set_file; } - /* - * Even if there is no ACL_TYPE_DEFAULT entry here, a zero - * size ACL will be returned. So it is not safe to simply - * check the pointer to see if the default ACL is present. - */ - acl = aclgetf(source_dir, ACL_TYPE_DEFAULT); + if (acl_type == ACL_TYPE_ACCESS) { + /* + * Even if there is no ACL_TYPE_DEFAULT entry here, a zero + * size ACL will be returned. So it is not safe to simply + * check the pointer to see if the default ACL is present. + */ + acl = aclgetf(source_dir, ACL_TYPE_DEFAULT); + if (acl == NULL) { + warn("failed to get default acl entries on %s", + source_dir); + return (1); + } + aclp = &acl->ats_acl; + if (aclp->acl_cnt != 0 && aclsetf(dest_dir, + ACL_TYPE_DEFAULT, acl) < 0) { + warn("failed to set default acl entries on %s", + dest_dir); + acl_free(acl); + return (1); + } + acl_free(acl); + } + acl = aclgetf(source_dir, acl_type); if (acl == NULL) { - warn("failed to get default acl entries on %s", - source_dir); + warn("failed to get acl entries on %s", source_dir); return (1); } - aclp = &acl->ats_acl; - if (aclp->acl_cnt != 0 && aclsetf(dest_dir, - ACL_TYPE_DEFAULT, acl) < 0) { - warn("failed to set default acl entries on %s", - dest_dir); + if (acl_is_trivial_np(acl, &trivial)) { + warn("acl_is_trivial() failed on %s", source_dir); + acl_free(acl); return (1); } - acl = aclgetf(source_dir, ACL_TYPE_ACCESS); - if (acl == NULL) { - warn("failed to get acl entries on %s", source_dir); - return (1); + if (trivial) { + acl_free(acl); + return (0); } - aclp = &acl->ats_acl; - if (aclsetf(dest_dir, ACL_TYPE_ACCESS, acl) < 0) { + if (aclsetf(dest_dir, acl_type, acl) < 0) { warn("failed to set acl entries on %s", dest_dir); + acl_free(acl); return (1); } + acl_free(acl); return (0); } From ache at nagual.pp.ru Wed Sep 2 08:51:09 2009 From: ache at nagual.pp.ru (Andrey Chernov) Date: Wed Sep 2 08:51:20 2009 Subject: svn commit: r196752 - head/lib/libc/stdtime In-Reply-To: <20090902070808.GA1290@arthur.nitro.dk> References: <200909020456.n824uUqQ082136@svn.freebsd.org> <20090902070808.GA1290@arthur.nitro.dk> Message-ID: <20090902084002.GA17325@nagual.pp.ru> On Wed, Sep 02, 2009 at 09:08:09AM +0200, Simon L. Nielsen wrote: > > Log: > > Use (unsigned char) cast for ctype macro > > Acording to the manual page and the C standard book I have, isdigit() > takes an int for an argument, so why change this? Not exactly that. From our manual page: "The value of the argument must be representable as an unsigned char or the value of EOF." Signed char (automatically casted to int in expression even without direct (int) cast) passed to any ctype macro potentically may cause a lot of problems, such as: incorrect char class detection or even core dump in some systems. This is due to automatic sign extension of 8bit (if present). -- http://ache.pp.ru/ From linimon at lonesome.com Wed Sep 2 10:05:10 2009 From: linimon at lonesome.com (Mark Linimon) Date: Wed Sep 2 10:05:16 2009 Subject: svn commit: r196746 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/usb dev/usb/input dev/xen/xenpci In-Reply-To: <200909020212.n822C7Il078379@svn.freebsd.org> References: <200909020212.n822C7Il078379@svn.freebsd.org> Message-ID: <20090902094508.GA1964@lonesome.com> On Wed, Sep 02, 2009 at 02:12:07AM +0000, Alfred Perlstein wrote: > MFC: r196489,196498 > Critical USB bugfixes for 8.0 Will this change anything for ports? mcl From bz at FreeBSD.org Wed Sep 2 10:39:47 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Wed Sep 2 10:40:04 2009 Subject: svn commit: r196761 - in stable/8/sys: . amd64/amd64 amd64/include/xen cddl/contrib/opensolaris compat/ia32 contrib/dev/acpica contrib/pf dev/xen/xenpci i386/i386 kern sys Message-ID: <200909021039.n82AdlPn093485@svn.freebsd.org> Author: bz Date: Wed Sep 2 10:39:46 2009 New Revision: 196761 URL: http://svn.freebsd.org/changeset/base/196761 Log: MFC r196653: Make sure FreeBSD binaries without .note.ABI-tag section work correctly and do not match a colliding Debian GNU/kFreeBSD brandinfo statements. For this mark the Debian GNU/kFreeBSD brandinfo that it must have an .note.ABI-tag section and ignore the old EI_OSABI brandinfo when comparing a possibly colliding set of options. Due to SYSINIT we add the brandinfo in a non-deterministic order, so native FreeBSD is not always first. We may want to consider to force native FreeBSD to come first as well. The only way a problem could currently be noticed is when running an i386 binary without the .note.ABI-tag on amd64 and the Debian GNU/kFreeBSD brandinfo was matched first, as the fallback to ld-elf32.so.1 does not exist in that case. Reported and tested by: ticso In collaboration with: kib MFC after: 3 days Approved by: re (rwatson) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/amd64/elf_machdep.c stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/compat/ia32/ia32_sysvec.c stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/i386/i386/elf_machdep.c stable/8/sys/kern/imgact_elf.c stable/8/sys/sys/imgact_elf.h Modified: stable/8/sys/amd64/amd64/elf_machdep.c ============================================================================== --- stable/8/sys/amd64/amd64/elf_machdep.c Wed Sep 2 10:12:13 2009 (r196760) +++ stable/8/sys/amd64/amd64/elf_machdep.c Wed Sep 2 10:39:46 2009 (r196761) @@ -118,7 +118,7 @@ static Elf64_Brandinfo kfreebsd_brand_in .sysvec = &elf64_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf64_kfreebsd_brandnote, - .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE_MANDATORY }; SYSINIT(kelf64, SI_SUB_EXEC, SI_ORDER_ANY, Modified: stable/8/sys/compat/ia32/ia32_sysvec.c ============================================================================== --- stable/8/sys/compat/ia32/ia32_sysvec.c Wed Sep 2 10:12:13 2009 (r196760) +++ stable/8/sys/compat/ia32/ia32_sysvec.c Wed Sep 2 10:39:46 2009 (r196761) @@ -180,7 +180,7 @@ static Elf32_Brandinfo kia32_brand_info .interp_path = "/lib/ld.so.1", .sysvec = &ia32_freebsd_sysvec, .brand_note = &elf32_kfreebsd_brandnote, - .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE_MANDATORY }; SYSINIT(kia32, SI_SUB_EXEC, SI_ORDER_ANY, Modified: stable/8/sys/i386/i386/elf_machdep.c ============================================================================== --- stable/8/sys/i386/i386/elf_machdep.c Wed Sep 2 10:12:13 2009 (r196760) +++ stable/8/sys/i386/i386/elf_machdep.c Wed Sep 2 10:39:46 2009 (r196761) @@ -117,7 +117,7 @@ static Elf32_Brandinfo kfreebsd_brand_in .sysvec = &elf32_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf32_kfreebsd_brandnote, - .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE_MANDATORY }; SYSINIT(kelf32, SI_SUB_EXEC, SI_ORDER_ANY, Modified: stable/8/sys/kern/imgact_elf.c ============================================================================== --- stable/8/sys/kern/imgact_elf.c Wed Sep 2 10:12:13 2009 (r196760) +++ stable/8/sys/kern/imgact_elf.c Wed Sep 2 10:39:46 2009 (r196761) @@ -238,8 +238,10 @@ __elfN(get_brandinfo)(struct image_param /* Look for an ".note.ABI-tag" ELF section */ for (i = 0; i < MAX_BRANDS; i++) { bi = elf_brand_list[i]; - if (bi != NULL && hdr->e_machine == bi->machine && - (bi->flags & BI_BRAND_NOTE) != 0) { + if (bi == NULL) + continue; + if (hdr->e_machine == bi->machine && (bi->flags & + (BI_BRAND_NOTE|BI_BRAND_NOTE_MANDATORY)) != 0) { ret = __elfN(check_note)(imgp, bi->brand_note, osrel); if (ret) return (bi); @@ -249,7 +251,9 @@ __elfN(get_brandinfo)(struct image_param /* If the executable has a brand, search for it in the brand list. */ for (i = 0; i < MAX_BRANDS; i++) { bi = elf_brand_list[i]; - if (bi != NULL && hdr->e_machine == bi->machine && + if (bi == NULL || bi->flags & BI_BRAND_NOTE_MANDATORY) + continue; + if (hdr->e_machine == bi->machine && (hdr->e_ident[EI_OSABI] == bi->brand || strncmp((const char *)&hdr->e_ident[OLD_EI_BRAND], bi->compat_3_brand, strlen(bi->compat_3_brand)) == 0)) @@ -260,7 +264,9 @@ __elfN(get_brandinfo)(struct image_param if (interp != NULL) { for (i = 0; i < MAX_BRANDS; i++) { bi = elf_brand_list[i]; - if (bi != NULL && hdr->e_machine == bi->machine && + if (bi == NULL || bi->flags & BI_BRAND_NOTE_MANDATORY) + continue; + if (hdr->e_machine == bi->machine && strcmp(interp, bi->interp_path) == 0) return (bi); } @@ -269,7 +275,9 @@ __elfN(get_brandinfo)(struct image_param /* Lacking a recognized interpreter, try the default brand */ for (i = 0; i < MAX_BRANDS; i++) { bi = elf_brand_list[i]; - if (bi != NULL && hdr->e_machine == bi->machine && + if (bi == NULL || bi->flags & BI_BRAND_NOTE_MANDATORY) + continue; + if (hdr->e_machine == bi->machine && __elfN(fallback_brand) == bi->brand) return (bi); } Modified: stable/8/sys/sys/imgact_elf.h ============================================================================== --- stable/8/sys/sys/imgact_elf.h Wed Sep 2 10:12:13 2009 (r196760) +++ stable/8/sys/sys/imgact_elf.h Wed Sep 2 10:39:46 2009 (r196761) @@ -74,8 +74,9 @@ typedef struct { const char *interp_newpath; int flags; Elf_Brandnote *brand_note; -#define BI_CAN_EXEC_DYN 0x0001 -#define BI_BRAND_NOTE 0x0002 +#define BI_CAN_EXEC_DYN 0x0001 +#define BI_BRAND_NOTE 0x0002 /* May have note.ABI-tag section. */ +#define BI_BRAND_NOTE_MANDATORY 0x0004 /* Must have note.ABI-tag section. */ } __ElfN(Brandinfo); __ElfType(Auxargs); From mav at FreeBSD.org Wed Sep 2 11:39:21 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Wed Sep 2 11:39:31 2009 Subject: svn commit: r196762 - head/sys/dev/sound/pci/hda Message-ID: <200909021139.n82BdKEX094794@svn.freebsd.org> Author: mav Date: Wed Sep 2 11:39:19 2009 New Revision: 196762 URL: http://svn.freebsd.org/changeset/base/196762 Log: Improve HDA controller capabilities logging. Modified: head/sys/dev/sound/pci/hda/hdac.c head/sys/dev/sound/pci/hda/hdac_private.h head/sys/dev/sound/pci/hda/hdac_reg.h Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Wed Sep 2 10:39:46 2009 (r196761) +++ head/sys/dev/sound/pci/hda/hdac.c Wed Sep 2 11:39:19 2009 (r196762) @@ -1520,7 +1520,7 @@ hdac_get_capabilities(struct hdac_softc sc->num_iss = HDAC_GCAP_ISS(gcap); sc->num_oss = HDAC_GCAP_OSS(gcap); sc->num_bss = HDAC_GCAP_BSS(gcap); - + sc->num_sdo = HDAC_GCAP_NSDO(gcap); sc->support_64bit = HDA_FLAG_MATCH(gcap, HDAC_GCAP_64OK); corbsize = HDAC_READ_1(&sc->mem, HDAC_CORBSIZE); @@ -1555,11 +1555,12 @@ hdac_get_capabilities(struct hdac_softc return (ENXIO); } - HDA_BOOTHVERBOSE( - device_printf(sc->dev, " CORB size: %d\n", sc->corb_size); - device_printf(sc->dev, " RIRB size: %d\n", sc->rirb_size); - device_printf(sc->dev, " Streams: ISS=%d OSS=%d BSS=%d\n", - sc->num_iss, sc->num_oss, sc->num_bss); + HDA_BOOTVERBOSE( + device_printf(sc->dev, "Caps: OSS %d, ISS %d, BSS %d, " + "NSDO %d%s, CORB %d, RIRB %d\n", + sc->num_oss, sc->num_iss, sc->num_bss, 1 << sc->num_sdo, + sc->support_64bit ? ", 64bit" : "", + sc->corb_size, sc->rirb_size); ); return (0); Modified: head/sys/dev/sound/pci/hda/hdac_private.h ============================================================================== --- head/sys/dev/sound/pci/hda/hdac_private.h Wed Sep 2 10:39:46 2009 (r196761) +++ head/sys/dev/sound/pci/hda/hdac_private.h Wed Sep 2 11:39:19 2009 (r196762) @@ -339,6 +339,7 @@ struct hdac_softc { int num_iss; int num_oss; int num_bss; + int num_sdo; int support_64bit; int streamcnt; Modified: head/sys/dev/sound/pci/hda/hdac_reg.h ============================================================================== --- head/sys/dev/sound/pci/hda/hdac_reg.h Wed Sep 2 10:39:46 2009 (r196761) +++ head/sys/dev/sound/pci/hda/hdac_reg.h Wed Sep 2 11:39:19 2009 (r196762) @@ -136,6 +136,8 @@ (((gcap) & HDAC_GCAP_ISS_MASK) >> HDAC_GCAP_ISS_SHIFT) #define HDAC_GCAP_OSS(gcap) \ (((gcap) & HDAC_GCAP_OSS_MASK) >> HDAC_GCAP_OSS_SHIFT) +#define HDAC_GCAP_NSDO(gcap) \ + (((gcap) & HDAC_GCAP_NSDO_MASK) >> HDAC_GCAP_NSDO_SHIFT) /* GCTL - Global Control */ #define HDAC_GCTL_CRST 0x00000001 From dimitry at andric.com Wed Sep 2 13:46:00 2009 From: dimitry at andric.com (Dimitry Andric) Date: Wed Sep 2 13:46:11 2009 Subject: svn commit: r196727 - head/share/man/man5 In-Reply-To: <20090902092054.Q27429@mp2.macomnet.net> References: <200909010555.n815tAkx050140@svn.freebsd.org> <4A9D4A90.30700@FreeBSD.org> <20090902092054.Q27429@mp2.macomnet.net> Message-ID: <4A9E7718.1080503@andric.com> On 2009-09-02 07:21, Maxim Konovalov wrote: >> Unless I'm missing something this should be in the src.conf man page >> instead of make.conf. > Please explain why. make.conf(5): The file make.conf contains system-wide settings that will apply to every build using make(1) and the standard sys.mk file. src.conf(5): The src.conf file contains settings that will apply to every build involving the FreeBSD source tree; see build(7). The MALLOC_PRODUCTION define is used inside the FreeBSD source tree (actually only in jemalloc, it seems). You most likely don't want it to apply 'globally', since third-party programs (e.g. ports) might give a totally different meaning to this define -- or most likely: no meaning at all. :) From flz at FreeBSD.org Wed Sep 2 13:58:16 2009 From: flz at FreeBSD.org (Florent Thoumie) Date: Wed Sep 2 13:58:22 2009 Subject: svn commit: r196766 - head/usr.sbin/pkg_install/lib Message-ID: <200909021358.n82DwF2f097781@svn.freebsd.org> Author: flz Date: Wed Sep 2 13:58:15 2009 New Revision: 196766 URL: http://svn.freebsd.org/changeset/base/196766 Log: - Bump PKG_INSTALL_VERSION to 20090902 after dougb's changes. - Change the comment to say that version must be changed when a non-cosmetic change is made. Modified: head/usr.sbin/pkg_install/lib/lib.h Modified: head/usr.sbin/pkg_install/lib/lib.h ============================================================================== --- head/usr.sbin/pkg_install/lib/lib.h Wed Sep 2 12:51:57 2009 (r196765) +++ head/usr.sbin/pkg_install/lib/lib.h Wed Sep 2 13:58:15 2009 (r196766) @@ -102,10 +102,10 @@ #define PKG_PREFIX_VNAME "PKG_PREFIX" /* - * Version of the package tools - increase only when some - * functionality used by bsd.port.mk is changed, added or removed + * Version of the package tools - increase whenever you make a change + * in the code that is not cosmetic only. */ -#define PKG_INSTALL_VERSION 20090519 +#define PKG_INSTALL_VERSION 20090902 #define PKG_WRAPCONF_FNAME "/var/db/pkg_install.conf" #define main(argc, argv) real_main(argc, argv) From flz at FreeBSD.org Wed Sep 2 14:54:47 2009 From: flz at FreeBSD.org (Florent Thoumie) Date: Wed Sep 2 14:54:58 2009 Subject: svn commit: r196767 - in head/etc: . mtree Message-ID: <200909021454.n82EslhJ099254@svn.freebsd.org> Author: flz Date: Wed Sep 2 14:54:47 2009 New Revision: 196767 URL: http://svn.freebsd.org/changeset/base/196767 Log: - Remove BSD.{x11,x11-4}.dist as we merged prefixes a while ago and those files aren't used anymore. - Remove BSD.local.dist as the file moved to ports/Templates when we merged prefixes. Deleted: head/etc/mtree/BSD.local.dist head/etc/mtree/BSD.x11-4.dist head/etc/mtree/BSD.x11.dist Modified: head/etc/Makefile Modified: head/etc/Makefile ============================================================================== --- head/etc/Makefile Wed Sep 2 13:58:15 2009 (r196766) +++ head/etc/Makefile Wed Sep 2 14:54:47 2009 (r196767) @@ -99,8 +99,7 @@ BIN1+= regdomain.xml # -rwxr-xr-x root:wheel, for the new cron root:wheel BIN2= netstart pccard_ether rc.suspend rc.resume -MTREE= BSD.include.dist BSD.local.dist BSD.root.dist BSD.usr.dist \ - BSD.var.dist BSD.x11.dist BSD.x11-4.dist +MTREE= BSD.include.dist BSD.root.dist BSD.usr.dist BSD.var.dist .if ${MK_SENDMAIL} != "no" MTREE+= BSD.sendmail.dist .endif From flz at FreeBSD.org Wed Sep 2 14:56:23 2009 From: flz at FreeBSD.org (Florent Thoumie) Date: Wed Sep 2 14:56:35 2009 Subject: svn commit: r196768 - head Message-ID: <200909021456.n82EuNcx099351@svn.freebsd.org> Author: flz Date: Wed Sep 2 14:56:23 2009 New Revision: 196768 URL: http://svn.freebsd.org/changeset/base/196768 Log: Remove BSD.{local,x11,x11-4}.dist mtree files as they're either obsolete or they've moved to ports. Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Wed Sep 2 14:54:47 2009 (r196767) +++ head/ObsoleteFiles.inc Wed Sep 2 14:56:23 2009 (r196768) @@ -14,6 +14,10 @@ # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # +# 20090902: BSD.{x11,x11-4}.dist are dead and BSD.local.dist lives in ports/ +OLD_FILES+=etc/mtree/BSD.local.dist +OLD_FILES+=etc/mtree/BSD.x11.dist +OLD_FILES+=etc/mtree/BSD.x11-4.dist # 20090801: vimage.h removed in favour of vnet.h OLD_FILES+=usr/include/sys/vimage.h # 20090719: library version bump for 8.0 From dougb at FreeBSD.org Wed Sep 2 15:06:29 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Wed Sep 2 15:06:40 2009 Subject: svn commit: r196766 - head/usr.sbin/pkg_install/lib In-Reply-To: <200909021358.n82DwF2f097781@svn.freebsd.org> References: <200909021358.n82DwF2f097781@svn.freebsd.org> Message-ID: <4A9E89E9.50300@FreeBSD.org> Florent Thoumie wrote: > Author: flz > Date: Wed Sep 2 13:58:15 2009 > New Revision: 196766 > URL: http://svn.freebsd.org/changeset/base/196766 > > Log: > - Bump PKG_INSTALL_VERSION to 20090902 after dougb's changes. > - Change the comment to say that version must be changed when a > non-cosmetic change is made. Thanks! (For the change, and for the education.) Doug -- This .signature sanitized for your protection From dougb at FreeBSD.org Wed Sep 2 15:14:18 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Wed Sep 2 15:14:30 2009 Subject: svn commit: r196746 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/usb dev/usb/input dev/xen/xenpci In-Reply-To: <8497dc1520e5fe6b2b3727d5fb92f358.squirrel@www.jr-hosting.nl> References: <200909020212.n822C7Il078379@svn.freebsd.org> <8497dc1520e5fe6b2b3727d5fb92f358.squirrel@www.jr-hosting.nl> Message-ID: <4A9E8BBE.9060000@FreeBSD.org> Remko Lodder wrote: > On Wed, September 2, 2009 4:12 am, Alfred Perlstein wrote: >> Author: alfred >> Date: Wed Sep 2 02:12:07 2009 >> New Revision: 196746 >> URL: http://svn.freebsd.org/changeset/base/196746 >> >> Log: >> MFC: r196489,196498 >> Critical USB bugfixes for 8.0 >> > > Dear Alfred (and hps!), > > It would be awesome to see something more about this in the commit log. I > needed to look up the specific revisions to see what changed. I always > learned from Warner and people, that including the original commit > message(s) saves a lot of time and makes it clear about what is being > merged. ... and I was taught that including the complete commit message is a waste of space since it already exists in HEAD, and therefore to summarize the changes briefly rather than reporting them verbatim. A philosophy with which I agree. :) There were only 2 changes merged, going back and looking at the logs for them could not have been that much of a burden. That said, for RELENG_8 commits during the freeze re@ did ask in one of their many messages about commit approvals to paste the complete commit message in the MFC. So, bad Alfred, no cookie. :) Doug -- This .signature sanitized for your protection From dougb at FreeBSD.org Wed Sep 2 15:16:42 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Wed Sep 2 15:16:48 2009 Subject: svn commit: r196727 - head/share/man/man5 In-Reply-To: <4A9E7718.1080503@andric.com> References: <200909010555.n815tAkx050140@svn.freebsd.org> <4A9D4A90.30700@FreeBSD.org> <20090902092054.Q27429@mp2.macomnet.net> <4A9E7718.1080503@andric.com> Message-ID: <4A9E8C50.5010402@FreeBSD.org> Dimitry Andric wrote: > On 2009-09-02 07:21, Maxim Konovalov wrote: >>> Unless I'm missing something this should be in the src.conf man page >>> instead of make.conf. >> Please explain why. > > make.conf(5): > The file make.conf contains system-wide settings that will apply to every > build using make(1) and the standard sys.mk file. > > src.conf(5): > The src.conf file contains settings that will apply to every build > involving the FreeBSD source tree; see build(7). > > The MALLOC_PRODUCTION define is used inside the FreeBSD source tree > (actually only in jemalloc, it seems). > > You most likely don't want it to apply 'globally', since third-party > programs (e.g. ports) might give a totally different meaning to this > define -- or most likely: no meaning at all. :) That's correct. Maxim, I forgot to include the pointer to src/tools/build/options in my previous mail, so there you go. :) Doug -- This .signature sanitized for your protection From kensmith at cse.Buffalo.EDU Wed Sep 2 15:37:07 2009 From: kensmith at cse.Buffalo.EDU (Ken Smith) Date: Wed Sep 2 15:37:14 2009 Subject: svn commit: r196746 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/usb dev/usb/input dev/xen/xenpci In-Reply-To: <4A9E8BBE.9060000@FreeBSD.org> References: <200909020212.n822C7Il078379@svn.freebsd.org> <8497dc1520e5fe6b2b3727d5fb92f358.squirrel@www.jr-hosting.nl> <4A9E8BBE.9060000@FreeBSD.org> Message-ID: <1251905775.24711.32.camel@bauer.cse.buffalo.edu> On Wed, 2009-09-02 at 08:14 -0700, Doug Barton wrote: > That said, for RELENG_8 commits during the freeze re@ did ask in one > of their many messages about commit approvals to paste the complete > commit message in the MFC. So, bad Alfred, no cookie. :) Just for clarification... We ask that you send your complete *proposed commit message* in your *approval request*. We didn't say that your commit message needs to include all of the text from the commit to head. So, bad Doug, no cookie. :-) FWIW my preference is, as usual, somewhere in between the two extremes. Duplicating a lengthy commit message in a merge is overkill but in those cases a short (one sentence max) summary of what changed being in the merge commit message is helpful. For example when looking through the commits for release notes fodder it can help. It also helps people who take the peer review of commits being done seriously to get the warm fuzzy feeling that the merge wasn't an accidental mis-merge (by seeing that the code seems to match the brief description). -- Ken Smith - From there to here, from here to | kensmith@cse.buffalo.edu there, funny things are everywhere. | - Theodore Geisel | -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: This is a digitally signed message part Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090902/7f190f9a/attachment.pgp From dougb at FreeBSD.org Wed Sep 2 15:57:45 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Wed Sep 2 15:58:02 2009 Subject: svn commit: r196746 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/usb dev/usb/input dev/xen/xenpci In-Reply-To: <1251905775.24711.32.camel@bauer.cse.buffalo.edu> References: <200909020212.n822C7Il078379@svn.freebsd.org> <8497dc1520e5fe6b2b3727d5fb92f358.squirrel@www.jr-hosting.nl> <4A9E8BBE.9060000@FreeBSD.org> <1251905775.24711.32.camel@bauer.cse.buffalo.edu> Message-ID: <4A9E95F1.9070309@FreeBSD.org> Ken Smith wrote: > On Wed, 2009-09-02 at 08:14 -0700, Doug Barton wrote: >> That said, for RELENG_8 commits during the freeze re@ did ask in one >> of their many messages about commit approvals to paste the complete >> commit message in the MFC. So, bad Alfred, no cookie. :) > > Just for clarification... We ask that you send your complete *proposed > commit message* in your *approval request*. We didn't say that your > commit message needs to include all of the text from the commit to head. > > So, bad Doug, no cookie. :-) -------- Original Message -------- Subject: Repost: approval request and merge guidelines during release cycle Date: Sun, 16 Aug 2009 10:29:58 +0100 (BST) From: Robert Watson To: developers@FreeBSD.org [...] 5. When committing the merge, include the original revision number (rXXXXXX) and a copy of the original commit message in the merge commit message. But you're the boss, so whatever you say goes. :) (I would like my cookie back though.) > FWIW my preference is, as usual, somewhere in between the two extremes. > Duplicating a lengthy commit message in a merge is overkill but in those > cases a short (one sentence max) summary of what changed being in the > merge commit message is helpful. For example when looking through the > commits for release notes fodder it can help. It also helps people who > take the peer review of commits being done seriously to get the warm > fuzzy feeling that the merge wasn't an accidental mis-merge (by seeing > that the code seems to match the brief description). Seriously though, I agree with you, and will be happy to continue complying with this policy going forward. :) Doug -- This .signature sanitized for your protection From jkim at FreeBSD.org Wed Sep 2 16:02:49 2009 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Wed Sep 2 16:03:01 2009 Subject: svn commit: r196769 - in head/sys: amd64/amd64 i386/i386 Message-ID: <200909021602.n82G2mpE000812@svn.freebsd.org> Author: jkim Date: Wed Sep 2 16:02:48 2009 New Revision: 196769 URL: http://svn.freebsd.org/changeset/base/196769 Log: - Work around ACPI mode transition problem for recent NVIDIA 9400M chipset based Intel Macs. Since r189055, these platforms started freezing when ACPI is being initialized for unknown reason. For these platforms, we just use the old PAT layout. Note this change is not enough to boot fully on these platforms because of other problems but it makes debugging possible. Note MacBook5,2 may be affected as well but it was not added here because of lack of hardware to test. - Initialize PAT MSR fully instead of reading and modifying it for safety. Reported by: rpaulo, hps, Eygene Ryabinkin (rea-fbsd at codelabs dot ru) Reviewed by: jhb Modified: head/sys/amd64/amd64/pmap.c head/sys/i386/i386/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Wed Sep 2 14:56:23 2009 (r196768) +++ head/sys/amd64/amd64/pmap.c Wed Sep 2 16:02:48 2009 (r196769) @@ -178,6 +178,8 @@ static vm_paddr_t dmaplimit; vm_offset_t kernel_vm_end = VM_MIN_KERNEL_ADDRESS; pt_entry_t pg_nx; +static int pat_works = 0; /* Is page attribute table sane? */ + SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters"); static int pg_ps_enabled = 1; @@ -590,20 +592,56 @@ void pmap_init_pat(void) { uint64_t pat_msr; + char *sysenv; + static int pat_tested = 0; /* Bail if this CPU doesn't implement PAT. */ if (!(cpu_feature & CPUID_PAT)) panic("no PAT??"); /* - * Leave the indices 0-3 at the default of WB, WT, UC, and UC-. - * Program 4 and 5 as WP and WC. - * Leave 6 and 7 as UC and UC-. - */ - pat_msr = rdmsr(MSR_PAT); - pat_msr &= ~(PAT_MASK(4) | PAT_MASK(5)); - pat_msr |= PAT_VALUE(4, PAT_WRITE_PROTECTED) | - PAT_VALUE(5, PAT_WRITE_COMBINING); + * Some Apple Macs based on nVidia chipsets cannot enter ACPI mode + * via SMI# when we use upper 4 PAT entries for unknown reason. + */ + if (!pat_tested) { + pat_works = 1; + sysenv = getenv("smbios.system.product"); + if (sysenv != NULL) { + if (strncmp(sysenv, "MacBook5,1", 10) == 0 || + strncmp(sysenv, "MacBookPro5,5", 13) == 0 || + strncmp(sysenv, "Macmini3,1", 10) == 0) + pat_works = 0; + freeenv(sysenv); + } + pat_tested = 1; + } + + /* Initialize default PAT entries. */ + pat_msr = PAT_VALUE(0, PAT_WRITE_BACK) | + PAT_VALUE(1, PAT_WRITE_THROUGH) | + PAT_VALUE(2, PAT_UNCACHED) | + PAT_VALUE(3, PAT_UNCACHEABLE) | + PAT_VALUE(4, PAT_WRITE_BACK) | + PAT_VALUE(5, PAT_WRITE_THROUGH) | + PAT_VALUE(6, PAT_UNCACHED) | + PAT_VALUE(7, PAT_UNCACHEABLE); + + if (pat_works) { + /* + * Leave the indices 0-3 at the default of WB, WT, UC, and UC-. + * Program 4 and 5 as WP and WC. + * Leave 6 and 7 as UC and UC-. + */ + pat_msr &= ~(PAT_MASK(4) | PAT_MASK(5)); + pat_msr |= PAT_VALUE(4, PAT_WRITE_PROTECTED) | + PAT_VALUE(5, PAT_WRITE_COMBINING); + } else { + /* + * Just replace PAT Index 2 with WC instead of UC-. + */ + pat_msr &= ~PAT_MASK(2); + pat_msr |= PAT_VALUE(2, PAT_WRITE_COMBINING); + } wrmsr(MSR_PAT, pat_msr); } @@ -754,27 +792,48 @@ pmap_cache_bits(int mode, boolean_t is_p pat_flag = is_pde ? PG_PDE_PAT : PG_PTE_PAT; /* Map the caching mode to a PAT index. */ - switch (mode) { - case PAT_UNCACHEABLE: - pat_index = 3; - break; - case PAT_WRITE_THROUGH: - pat_index = 1; - break; - case PAT_WRITE_BACK: - pat_index = 0; - break; - case PAT_UNCACHED: - pat_index = 2; - break; - case PAT_WRITE_COMBINING: - pat_index = 5; - break; - case PAT_WRITE_PROTECTED: - pat_index = 4; - break; - default: - panic("Unknown caching mode %d\n", mode); + if (pat_works) { + switch (mode) { + case PAT_UNCACHEABLE: + pat_index = 3; + break; + case PAT_WRITE_THROUGH: + pat_index = 1; + break; + case PAT_WRITE_BACK: + pat_index = 0; + break; + case PAT_UNCACHED: + pat_index = 2; + break; + case PAT_WRITE_COMBINING: + pat_index = 5; + break; + case PAT_WRITE_PROTECTED: + pat_index = 4; + break; + default: + panic("Unknown caching mode %d\n", mode); + } + } else { + switch (mode) { + case PAT_UNCACHED: + case PAT_UNCACHEABLE: + case PAT_WRITE_PROTECTED: + pat_index = 3; + break; + case PAT_WRITE_THROUGH: + pat_index = 1; + break; + case PAT_WRITE_BACK: + pat_index = 0; + break; + case PAT_WRITE_COMBINING: + pat_index = 2; + break; + default: + panic("Unknown caching mode %d\n", mode); + } } /* Map the 3-bit index value into the PAT, PCD, and PWT bits. */ Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Wed Sep 2 14:56:23 2009 (r196768) +++ head/sys/i386/i386/pmap.c Wed Sep 2 16:02:48 2009 (r196769) @@ -212,7 +212,7 @@ pt_entry_t pg_nx; static uma_zone_t pdptzone; #endif -static int pat_works; /* Is page attribute table sane? */ +static int pat_works = 0; /* Is page attribute table sane? */ SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters"); @@ -478,40 +478,69 @@ void pmap_init_pat(void) { uint64_t pat_msr; + char *sysenv; + static int pat_tested = 0; /* Bail if this CPU doesn't implement PAT. */ if (!(cpu_feature & CPUID_PAT)) return; - if (cpu_vendor_id != CPU_VENDOR_INTEL || - (I386_CPU_FAMILY(cpu_id) == 6 && I386_CPU_MODEL(cpu_id) >= 0xe)) { + /* + * Due to some Intel errata, we can only safely use the lower 4 + * PAT entries. + * + * Intel Pentium III Processor Specification Update + * Errata E.27 (Upper Four PAT Entries Not Usable With Mode B + * or Mode C Paging) + * + * Intel Pentium IV Processor Specification Update + * Errata N46 (PAT Index MSB May Be Calculated Incorrectly) + * + * Some Apple Macs based on nVidia chipsets cannot enter ACPI mode + * via SMI# when we use upper 4 PAT entries for unknown reason. + */ + if (!pat_tested) { + if (cpu_vendor_id != CPU_VENDOR_INTEL || + (I386_CPU_FAMILY(cpu_id) == 6 && + I386_CPU_MODEL(cpu_id) >= 0xe)) { + pat_works = 1; + sysenv = getenv("smbios.system.product"); + if (sysenv != NULL) { + if (strncmp(sysenv, "MacBook5,1", 10) == 0 || + strncmp(sysenv, "MacBookPro5,5", 13) == 0 || + strncmp(sysenv, "Macmini3,1", 10) == 0) + pat_works = 0; + freeenv(sysenv); + } + } + pat_tested = 1; + } + + /* Initialize default PAT entries. */ + pat_msr = PAT_VALUE(0, PAT_WRITE_BACK) | + PAT_VALUE(1, PAT_WRITE_THROUGH) | + PAT_VALUE(2, PAT_UNCACHED) | + PAT_VALUE(3, PAT_UNCACHEABLE) | + PAT_VALUE(4, PAT_WRITE_BACK) | + PAT_VALUE(5, PAT_WRITE_THROUGH) | + PAT_VALUE(6, PAT_UNCACHED) | + PAT_VALUE(7, PAT_UNCACHEABLE); + + if (pat_works) { /* * Leave the indices 0-3 at the default of WB, WT, UC, and UC-. * Program 4 and 5 as WP and WC. * Leave 6 and 7 as UC and UC-. */ - pat_msr = rdmsr(MSR_PAT); pat_msr &= ~(PAT_MASK(4) | PAT_MASK(5)); pat_msr |= PAT_VALUE(4, PAT_WRITE_PROTECTED) | PAT_VALUE(5, PAT_WRITE_COMBINING); - pat_works = 1; } else { /* - * Due to some Intel errata, we can only safely use the lower 4 - * PAT entries. Thus, just replace PAT Index 2 with WC instead - * of UC-. - * - * Intel Pentium III Processor Specification Update - * Errata E.27 (Upper Four PAT Entries Not Usable With Mode B - * or Mode C Paging) - * - * Intel Pentium IV Processor Specification Update - * Errata N46 (PAT Index MSB May Be Calculated Incorrectly) + * Just replace PAT Index 2 with WC instead of UC-. */ - pat_msr = rdmsr(MSR_PAT); pat_msr &= ~PAT_MASK(2); pat_msr |= PAT_VALUE(2, PAT_WRITE_COMBINING); - pat_works = 0; } wrmsr(MSR_PAT, pat_msr); } From kensmith at cse.Buffalo.EDU Wed Sep 2 16:03:30 2009 From: kensmith at cse.Buffalo.EDU (Ken Smith) Date: Wed Sep 2 16:03:42 2009 Subject: svn commit: r196746 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/usb dev/usb/input dev/xen/xenpci In-Reply-To: <4A9E95F1.9070309@FreeBSD.org> References: <200909020212.n822C7Il078379@svn.freebsd.org> <8497dc1520e5fe6b2b3727d5fb92f358.squirrel@www.jr-hosting.nl> <4A9E8BBE.9060000@FreeBSD.org> <1251905775.24711.32.camel@bauer.cse.buffalo.edu> <4A9E95F1.9070309@FreeBSD.org> Message-ID: <1251907375.24711.38.camel@bauer.cse.buffalo.edu> On Wed, 2009-09-02 at 08:57 -0700, Doug Barton wrote: > Subject: Repost: approval request and merge guidelines during release > cycle > Date: Sun, 16 Aug 2009 10:29:58 +0100 (BST) > From: Robert Watson > To: developers@FreeBSD.org > > [...] > > 5. When committing the merge, include the original revision number > (rXXXXXX) and a copy of the original commit message in the merge > commit message. > > But you're the boss, so whatever you say goes. :) (I would like my > cookie back though.) Hrm. Get it from rwatson. :-/ -- Ken Smith - From there to here, from here to | kensmith@cse.buffalo.edu there, funny things are everywhere. | - Theodore Geisel | -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: This is a digitally signed message part Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090902/bf16b48a/attachment.pgp From scf at FreeBSD.org Wed Sep 2 16:07:34 2009 From: scf at FreeBSD.org (Sean C. Farley) Date: Wed Sep 2 16:07:46 2009 Subject: svn commit: r196746 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/usb dev/usb/input dev/xen/xenpci In-Reply-To: <1251905775.24711.32.camel@bauer.cse.buffalo.edu> References: <200909020212.n822C7Il078379@svn.freebsd.org> <8497dc1520e5fe6b2b3727d5fb92f358.squirrel@www.jr-hosting.nl> <4A9E8BBE.9060000@FreeBSD.org> <1251905775.24711.32.camel@bauer.cse.buffalo.edu> Message-ID: On Wed, 2 Sep 2009, Ken Smith wrote: > On Wed, 2009-09-02 at 08:14 -0700, Doug Barton wrote: >> That said, for RELENG_8 commits during the freeze re@ did ask in one >> of their many messages about commit approvals to paste the complete >> commit message in the MFC. So, bad Alfred, no cookie. :) > > Just for clarification... We ask that you send your complete > *proposed commit message* in your *approval request*. We didn't say > that your commit message needs to include all of the text from the > commit to head. > > So, bad Doug, no cookie. :-) > > FWIW my preference is, as usual, somewhere in between the two > extremes. Duplicating a lengthy commit message in a merge is overkill > but in those cases a short (one sentence max) summary of what changed > being in the merge commit message is helpful. For example when > looking through the commits for release notes fodder it can help. It > also helps people who take the peer review of commits being done > seriously to get the warm fuzzy feeling that the merge wasn't an > accidental mis-merge (by seeing that the code seems to match the brief > description). Personally, I like to include the entire message to prevent having to scan the logs for the original commit(s), however, an alternative would be to have the MFC include a URL to the original commit. Two options would be: 1. Automatic insertion into log message with a Subversion hook which adds a URL from scanning a special code in the MFC message (MFC r12345,12346-12349). Of course, this takes more initial setup and education for committers (at least me :)) to use it correctly. 2. Committer can use a special base URL that is agreed to never change. This would make it easier to find the original log message without having to scan for it. Sean -- scf@FreeBSD.org From bz at FreeBSD.org Wed Sep 2 16:35:58 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Wed Sep 2 16:36:14 2009 Subject: svn commit: r196770 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci netinet Message-ID: <200909021635.n82GZvjh001551@svn.freebsd.org> Author: bz Date: Wed Sep 2 16:35:57 2009 New Revision: 196770 URL: http://svn.freebsd.org/changeset/base/196770 Log: MFC r196738: In case an upper layer protocol tries to send a packet but the L2 code does not have the ethernet address for the destination within the broadcast domain in the table, we remember the original mbuf in `la_hold' in arpresolve() and send out a different packet with an arp request. In case there will be more upper layer packets to send we will free an earlier one held in `la_hold' and queue the new one. Once we get a packet in, with which we can perfect our arp table entry we send out the original 'on hold' packet, should there be any. Rather than continuing to process the packet that we received, we returned without freeing the packet that came in, which basically means that we leaked an mbuf for every arp request we sent. Rather than freeing the received packet and returning, continue to process the incoming arp packet as well. This should (a) improve some setups, also proxy-arp, in case it was an incoming arp request and (b) resembles the behaviour FreeBSD had from day 1, which alignes with RFC826 "Packet reception" (merge case). Rename 'm0' to 'hold' to make the code more understandable as well as diffable to earlier versions more easily. Handle the link-layer entry 'la' lock comepletely in the block where needed and release it as early as possible, rather than holding it longer, down to the end of the function. Found by: pointyhat, ns1 Bug hunting session with: erwin, simon, rwatson Tested by: simon on cluster machines Reviewed by: ratson, kmacy, julian Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/netinet/if_ether.c Modified: stable/8/sys/netinet/if_ether.c ============================================================================== --- stable/8/sys/netinet/if_ether.c Wed Sep 2 16:02:48 2009 (r196769) +++ stable/8/sys/netinet/if_ether.c Wed Sep 2 16:35:57 2009 (r196770) @@ -462,11 +462,11 @@ in_arpinput(struct mbuf *m) struct rtentry *rt; struct ifaddr *ifa; struct in_ifaddr *ia; + struct mbuf *hold; struct sockaddr sa; struct in_addr isaddr, itaddr, myaddr; u_int8_t *enaddr = NULL; int op, flags; - struct mbuf *m0; int req_len; int bridged = 0, is_bridge = 0; #ifdef DEV_CARP @@ -631,11 +631,13 @@ match: la->lle_tbl->llt_ifp->if_xname, ifp->if_addrlen, (u_char *)ar_sha(ah), ":", ifp->if_xname); + LLE_WUNLOCK(la); goto reply; } if ((la->la_flags & LLE_VALID) && bcmp(ar_sha(ah), &la->ll_addr, ifp->if_addrlen)) { if (la->la_flags & LLE_STATIC) { + LLE_WUNLOCK(la); log(LOG_ERR, "arp: %*D attempts to modify permanent " "entry for %s on %s\n", @@ -655,6 +657,7 @@ match: } if (ifp->if_addrlen != ah->ar_hln) { + LLE_WUNLOCK(la); log(LOG_WARNING, "arp from %*D: addr len: new %d, i/f %d (ignored)", ifp->if_addrlen, (u_char *) ar_sha(ah), ":", @@ -671,15 +674,14 @@ match: } la->la_asked = 0; la->la_preempt = V_arp_maxtries; - if (la->la_hold != NULL) { - m0 = la->la_hold; - la->la_hold = 0; + hold = la->la_hold; + if (hold != NULL) { + la->la_hold = NULL; memcpy(&sa, L3_ADDR(la), sizeof(sa)); - LLE_WUNLOCK(la); - - (*ifp->if_output)(ifp, m0, &sa, NULL); - return; } + LLE_WUNLOCK(la); + if (hold != NULL) + (*ifp->if_output)(ifp, hold, &sa, NULL); } reply: if (op != ARPOP_REQUEST) @@ -750,8 +752,6 @@ reply: #endif } - if (la != NULL) - LLE_WUNLOCK(la); if (itaddr.s_addr == myaddr.s_addr && IN_LINKLOCAL(ntohl(itaddr.s_addr))) { /* RFC 3927 link-local IPv4; always reply by broadcast. */ @@ -777,8 +777,6 @@ reply: return; drop: - if (la != NULL) - LLE_WUNLOCK(la); m_freem(m); } #endif From jkim at FreeBSD.org Wed Sep 2 16:47:11 2009 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Wed Sep 2 16:47:24 2009 Subject: svn commit: r196771 - in head/sys: amd64/amd64 i386/i386 Message-ID: <200909021647.n82GlAeA001794@svn.freebsd.org> Author: jkim Date: Wed Sep 2 16:47:10 2009 New Revision: 196771 URL: http://svn.freebsd.org/changeset/base/196771 Log: Fix confusing comments about default PAT entries. Modified: head/sys/amd64/amd64/pmap.c head/sys/i386/i386/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Wed Sep 2 16:35:57 2009 (r196770) +++ head/sys/amd64/amd64/pmap.c Wed Sep 2 16:47:10 2009 (r196771) @@ -628,9 +628,9 @@ pmap_init_pat(void) if (pat_works) { /* - * Leave the indices 0-3 at the default of WB, WT, UC, and UC-. + * Leave the indices 0-3 at the default of WB, WT, UC-, and UC. * Program 4 and 5 as WP and WC. - * Leave 6 and 7 as UC and UC-. + * Leave 6 and 7 as UC- and UC. */ pat_msr &= ~(PAT_MASK(4) | PAT_MASK(5)); pat_msr |= PAT_VALUE(4, PAT_WRITE_PROTECTED) | Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Wed Sep 2 16:35:57 2009 (r196770) +++ head/sys/i386/i386/pmap.c Wed Sep 2 16:47:10 2009 (r196771) @@ -528,9 +528,9 @@ pmap_init_pat(void) if (pat_works) { /* - * Leave the indices 0-3 at the default of WB, WT, UC, and UC-. + * Leave the indices 0-3 at the default of WB, WT, UC-, and UC. * Program 4 and 5 as WP and WC. - * Leave 6 and 7 as UC and UC-. + * Leave 6 and 7 as UC- and UC. */ pat_msr &= ~(PAT_MASK(4) | PAT_MASK(5)); pat_msr |= PAT_VALUE(4, PAT_WRITE_PROTECTED) | From swell.k at gmail.com Wed Sep 2 16:57:28 2009 From: swell.k at gmail.com (Anonymous) Date: Wed Sep 2 16:57:34 2009 Subject: svn commit: r196727 - head/share/man/man5 In-Reply-To: <4A9E7718.1080503@andric.com> (Dimitry Andric's message of "Wed, 02 Sep 2009 15:46:00 +0200") References: <200909010555.n815tAkx050140@svn.freebsd.org> <4A9D4A90.30700@FreeBSD.org> <20090902092054.Q27429@mp2.macomnet.net> <4A9E7718.1080503@andric.com> Message-ID: <86hbvli9tg.fsf@gmail.com> Dimitry Andric writes: > On 2009-09-02 07:21, Maxim Konovalov wrote: >>> Unless I'm missing something this should be in the src.conf man page >>> instead of make.conf. >> Please explain why. > > make.conf(5): > The file make.conf contains system-wide settings that will apply to every > build using make(1) and the standard sys.mk file. > > src.conf(5): > The src.conf file contains settings that will apply to every build > involving the FreeBSD source tree; see build(7). > > The MALLOC_PRODUCTION define is used inside the FreeBSD source tree > (actually only in jemalloc, it seems). > > You most likely don't want it to apply 'globally', since third-party > programs (e.g. ports) might give a totally different meaning to this > define -- or most likely: no meaning at all. :) Don't you think this affects not only MALLOC_PRODUCTION but all defines under sections "BUILDING THE KERNEL" and "BUILDING THE WORLD"? For example, WITHOUT_MODULES conflicts with one in archivers/p7zip. From attilio at FreeBSD.org Wed Sep 2 17:33:52 2009 From: attilio at FreeBSD.org (Attilio Rao) Date: Wed Sep 2 17:33:58 2009 Subject: svn commit: r196772 - head/sys/kern Message-ID: <200909021733.n82HXpV6002870@svn.freebsd.org> Author: attilio Date: Wed Sep 2 17:33:51 2009 New Revision: 196772 URL: http://svn.freebsd.org/changeset/base/196772 Log: Fix some bugs related to adaptive spinning: In the lockmgr support: - GIANT_RESTORE() is just called when the sleep finishes, so the current code can ends up into a giant unlock problem. Fix it by appropriately call GIANT_RESTORE() when needed. Note that this is not exactly ideal because for any interation of the adaptive spinning we drop and restore Giant, but the overhead should be not a factor. - In the lock held in exclusive mode case, after the adaptive spinning is brought to completition, we should just retry to acquire the lock instead to fallthrough. Fix that. - Fix a style nit In the sx support: - Call GIANT_SAVE() before than looping. This saves some overhead because in the current code GIANT_SAVE() is called several times. Tested by: Giovanni Trematerra Modified: head/sys/kern/kern_lock.c head/sys/kern/kern_sx.c Modified: head/sys/kern/kern_lock.c ============================================================================== --- head/sys/kern/kern_lock.c Wed Sep 2 16:47:10 2009 (r196771) +++ head/sys/kern/kern_lock.c Wed Sep 2 17:33:51 2009 (r196772) @@ -467,7 +467,10 @@ __lockmgr_args(struct lock *lk, u_int fl /* * If the owner is running on another CPU, spin until * the owner stops running or the state of the lock - * changes. + * changes. We need a double-state handle here + * because for a failed acquisition the lock can be + * either held in exclusive mode or shared mode + * (for the writer starvation avoidance technique). */ if (LK_CAN_ADAPT(lk, flags) && (x & LK_SHARE) == 0 && LK_HOLDER(x) != LK_KERNPROC) { @@ -491,8 +494,10 @@ __lockmgr_args(struct lock *lk, u_int fl while (LK_HOLDER(lk->lk_lock) == (uintptr_t)owner && TD_IS_RUNNING(owner)) cpu_spinwait(); + GIANT_RESTORE(); + continue; } else if (LK_CAN_ADAPT(lk, flags) && - (x & LK_SHARE) !=0 && LK_SHARERS(x) && + (x & LK_SHARE) != 0 && LK_SHARERS(x) && spintries < alk_retries) { if (flags & LK_INTERLOCK) { class->lc_unlock(ilk); @@ -511,6 +516,7 @@ __lockmgr_args(struct lock *lk, u_int fl break; cpu_spinwait(); } + GIANT_RESTORE(); if (i != alk_loops) continue; } @@ -704,6 +710,8 @@ __lockmgr_args(struct lock *lk, u_int fl while (LK_HOLDER(lk->lk_lock) == (uintptr_t)owner && TD_IS_RUNNING(owner)) cpu_spinwait(); + GIANT_RESTORE(); + continue; } else if (LK_CAN_ADAPT(lk, flags) && (x & LK_SHARE) != 0 && LK_SHARERS(x) && spintries < alk_retries) { @@ -727,6 +735,7 @@ __lockmgr_args(struct lock *lk, u_int fl break; cpu_spinwait(); } + GIANT_RESTORE(); if (i != alk_loops) continue; } Modified: head/sys/kern/kern_sx.c ============================================================================== --- head/sys/kern/kern_sx.c Wed Sep 2 16:47:10 2009 (r196771) +++ head/sys/kern/kern_sx.c Wed Sep 2 17:33:51 2009 (r196772) @@ -531,13 +531,13 @@ _sx_xlock_hard(struct sx *sx, uintptr_t continue; } } else if (SX_SHARERS(x) && spintries < asx_retries) { + GIANT_SAVE(); spintries++; for (i = 0; i < asx_loops; i++) { if (LOCK_LOG_TEST(&sx->lock_object, 0)) CTR4(KTR_LOCK, "%s: shared spinning on %p with %u and %u", __func__, sx, spintries, i); - GIANT_SAVE(); x = sx->sx_lock; if ((x & SX_LOCK_SHARED) == 0 || SX_SHARERS(x) == 0) From trasz at FreeBSD.org Wed Sep 2 20:50:40 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Wed Sep 2 20:51:00 2009 Subject: svn commit: r196773 - head/bin/ls Message-ID: <200909022050.n82KodmI006768@svn.freebsd.org> Author: trasz Date: Wed Sep 2 20:50:39 2009 New Revision: 196773 URL: http://svn.freebsd.org/changeset/base/196773 Log: Fix regression introduced in r196712 - the 'name' string needs to be rewritten for each file we want to check ACL on. Without this change, ls(1) would check only the ACL on the first file to list. Modified: head/bin/ls/print.c Modified: head/bin/ls/print.c ============================================================================== --- head/bin/ls/print.c Wed Sep 2 17:33:51 2009 (r196772) +++ head/bin/ls/print.c Wed Sep 2 20:50:39 2009 (r196773) @@ -623,15 +623,19 @@ aclmode(char *buf, const FTSENT *p) S_ISWHT(p->fts_statp->st_mode)) return; + if (previous_dev == p->fts_statp->st_dev && supports_acls == 0) + return; + + if (p->fts_level == FTS_ROOTLEVEL) + snprintf(name, sizeof(name), "%s", p->fts_name); + else + snprintf(name, sizeof(name), "%s/%s", + p->fts_parent->fts_accpath, p->fts_name); + if (previous_dev != p->fts_statp->st_dev) { previous_dev = p->fts_statp->st_dev; supports_acls = 0; - if (p->fts_level == FTS_ROOTLEVEL) - snprintf(name, sizeof(name), "%s", p->fts_name); - else - snprintf(name, sizeof(name), "%s/%s", - p->fts_parent->fts_accpath, p->fts_name); ret = lpathconf(name, _PC_ACL_NFS4); if (ret > 0) { type = ACL_TYPE_NFS4; From des at des.no Thu Sep 3 07:26:04 2009 From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) Date: Thu Sep 3 07:26:16 2009 Subject: svn commit: r196752 - head/lib/libc/stdtime In-Reply-To: <20090902084002.GA17325@nagual.pp.ru> (Andrey Chernov's message of "Wed, 2 Sep 2009 12:40:03 +0400") References: <200909020456.n824uUqQ082136@svn.freebsd.org> <20090902070808.GA1290@arthur.nitro.dk> <20090902084002.GA17325@nagual.pp.ru> Message-ID: <867hwgcwvo.fsf@ds4.des.no> Andrey Chernov writes: > "Simon L. Nielsen" writes: > > Acording to the manual page and the C standard book I have, > > isdigit() takes an int for an argument, so why change this? > "The value of the argument must be representable as an unsigned char or > the value of EOF." > > Signed char (automatically casted to int in expression even without direct > (int) cast) passed to any ctype macro potentically may cause a lot of > problems, such as: incorrect char class detection or even core dump in > some systems. > > This is due to automatic sign extension of 8bit (if present). To put it more clearly: - The is*() functions expect an int for the same reason fgetc() returns one: a char alone can't represent all possible char values *plus* EOF. - In most 8-bit locales, there are valid characters outside the 0-127 range. When stored in a signed char, such characters are represented as negative values. When that signed char is promoted to a signed int, the negative values remain negative instead of being converted to the correct positive value. - This would not be a problem if C distinguished between a character (unsigned) and a "short short int" (signed). - The core dump ache refers to can occur with a na?ve implementation that uses a lookup table and checks for EOF, but not for other negative values. DES -- Dag-Erling Sm?rgrav - des@des.no From ache at nagual.pp.ru Thu Sep 3 08:43:31 2009 From: ache at nagual.pp.ru (Andrey Chernov) Date: Thu Sep 3 08:43:38 2009 Subject: svn commit: r196752 - head/lib/libc/stdtime In-Reply-To: <867hwgcwvo.fsf@ds4.des.no> References: <200909020456.n824uUqQ082136@svn.freebsd.org> <20090902070808.GA1290@arthur.nitro.dk> <20090902084002.GA17325@nagual.pp.ru> <867hwgcwvo.fsf@ds4.des.no> Message-ID: <20090903084325.GA65192@nagual.pp.ru> On Thu, Sep 03, 2009 at 09:26:03AM +0200, Dag-Erling Sm??rgrav wrote: > > - The core dump ache refers to can occur with a na??ve implementation > that uses a lookup table and checks for EOF, but not for other > negative values. Thanx for detailed explanation. Just to note: even such naive implemetations still live inside POSIX, since POSIX says that behaviour outside of "unsigned char" range + exact EOF value is undefined. -- http://ache.pp.ru/ From des at des.no Thu Sep 3 09:08:28 2009 From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) Date: Thu Sep 3 09:08:35 2009 Subject: svn commit: r196752 - head/lib/libc/stdtime In-Reply-To: <20090903084325.GA65192@nagual.pp.ru> (Andrey Chernov's message of "Thu, 3 Sep 2009 12:43:25 +0400") References: <200909020456.n824uUqQ082136@svn.freebsd.org> <20090902070808.GA1290@arthur.nitro.dk> <20090902084002.GA17325@nagual.pp.ru> <867hwgcwvo.fsf@ds4.des.no> <20090903084325.GA65192@nagual.pp.ru> Message-ID: <86zl9c9z05.fsf@ds4.des.no> Andrey Chernov writes: > Thanx for detailed explanation. np; I've made that mistake many times myself. What do you think of the attached patch? DES -- Dag-Erling Sm?rgrav - des@des.no -------------- next part -------------- A non-text attachment was scrubbed... Name: ctype-man.diff Type: text/x-patch Size: 15080 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090903/450dcd18/ctype-man.bin From ache at nagual.pp.ru Thu Sep 3 09:20:17 2009 From: ache at nagual.pp.ru (Andrey Chernov) Date: Thu Sep 3 09:20:29 2009 Subject: svn commit: r196752 - head/lib/libc/stdtime In-Reply-To: <86zl9c9z05.fsf@ds4.des.no> References: <200909020456.n824uUqQ082136@svn.freebsd.org> <20090902070808.GA1290@arthur.nitro.dk> <20090902084002.GA17325@nagual.pp.ru> <867hwgcwvo.fsf@ds4.des.no> <20090903084325.GA65192@nagual.pp.ru> <86zl9c9z05.fsf@ds4.des.no> Message-ID: <20090903092012.GA65660@nagual.pp.ru> On Thu, Sep 03, 2009 at 11:08:26AM +0200, Dag-Erling Sm??rgrav wrote: > > What do you think of the attached patch? Looks nice. -- http://ache.pp.ru/ From simon at FreeBSD.org Thu Sep 3 09:32:06 2009 From: simon at FreeBSD.org (Simon L. Nielsen) Date: Thu Sep 3 09:32:13 2009 Subject: svn commit: r196752 - head/lib/libc/stdtime In-Reply-To: <20090903084325.GA65192@nagual.pp.ru> References: <200909020456.n824uUqQ082136@svn.freebsd.org> <20090902070808.GA1290@arthur.nitro.dk> <20090902084002.GA17325@nagual.pp.ru> <867hwgcwvo.fsf@ds4.des.no> <20090903084325.GA65192@nagual.pp.ru> Message-ID: <20090903093205.GB1304@zaphod.nitro.dk> On 2009.09.03 12:43:25 +0400, Andrey Chernov wrote: > On Thu, Sep 03, 2009 at 09:26:03AM +0200, Dag-Erling Sm??rgrav wrote: > > > > - The core dump ache refers to can occur with a na??ve implementation > > that uses a lookup table and checks for EOF, but not for other > > negative values. > > Thanx for detailed explanation. Just to note: even such naive > implemetations still live inside POSIX, since POSIX says that behaviour > outside of "unsigned char" range + exact EOF value is undefined. Thanks to both of you for the detailed explanation. Always good to learn something new :-). I haven't had time to review des's patch (I can tonight if "needed"), but I certainly welcome documenting this case more clearly :-). -- Simon L. Nielsen From ed at FreeBSD.org Thu Sep 3 09:33:58 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Thu Sep 3 09:34:04 2009 Subject: svn commit: r196775 - in head/sys: conf dev/syscons dev/syscons/teken teken Message-ID: <200909030933.n839XwxV022031@svn.freebsd.org> Author: ed Date: Thu Sep 3 09:33:57 2009 New Revision: 196775 URL: http://svn.freebsd.org/changeset/base/196775 Log: Move libteken out of the syscons directory. I initially committed libteken to sys/dev/syscons/teken, but now that I'm working on a console driver myself, I noticed this was not a good decision. Move it to sys/teken to make it easier for other drivers to use a terminal emulator. Also list teken.c in sys/conf/files, instead of listing it in all the files.arch files separately. Added: head/sys/teken/ - copied from r196552, head/sys/dev/syscons/teken/ Deleted: head/sys/dev/syscons/teken/ Modified: head/sys/conf/files head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/conf/files.ia64 head/sys/conf/files.powerpc head/sys/conf/files.sparc64 head/sys/dev/syscons/scterm-teken.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Sep 2 22:12:31 2009 (r196774) +++ head/sys/conf/files Thu Sep 3 09:33:57 2009 (r196775) @@ -91,8 +91,8 @@ pccarddevs.h standard \ no-obj no-implicit-rule before-depend \ clean "pccarddevs.h" teken_state.h optional sc \ - dependency "$S/dev/syscons/teken/gensequences $S/dev/syscons/teken/sequences" \ - compile-with "${AWK} -f $S/dev/syscons/teken/gensequences $S/dev/syscons/teken/sequences > teken_state.h" \ + dependency "$S/teken/gensequences $S/teken/sequences" \ + compile-with "${AWK} -f $S/teken/gensequences $S/teken/sequences > teken_state.h" \ no-obj no-implicit-rule before-depend \ clean "teken_state.h" usbdevs.h optional usb \ @@ -2616,6 +2616,7 @@ security/mac_portacl/mac_portacl.c optio security/mac_seeotheruids/mac_seeotheruids.c optional mac_seeotheruids security/mac_stub/mac_stub.c optional mac_stub security/mac_test/mac_test.c optional mac_test +teken/teken.c optional sc ufs/ffs/ffs_alloc.c optional ffs ufs/ffs/ffs_balloc.c optional ffs ufs/ffs/ffs_inode.c optional ffs Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Wed Sep 2 22:12:31 2009 (r196774) +++ head/sys/conf/files.amd64 Thu Sep 3 09:33:57 2009 (r196775) @@ -219,7 +219,6 @@ dev/syscons/apm/apm_saver.c optional apm dev/syscons/scterm-teken.c optional sc dev/syscons/scvgarndr.c optional sc vga dev/syscons/scvtb.c optional sc -dev/syscons/teken/teken.c optional sc dev/uart/uart_cpu_amd64.c optional uart dev/wpi/if_wpi.c optional wpi isa/atrtc.c standard Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Wed Sep 2 22:12:31 2009 (r196774) +++ head/sys/conf/files.i386 Thu Sep 3 09:33:57 2009 (r196775) @@ -220,7 +220,6 @@ dev/syscons/scterm-teken.c optional sc dev/syscons/scvesactl.c optional sc vga vesa dev/syscons/scvgarndr.c optional sc vga dev/syscons/scvtb.c optional sc -dev/syscons/teken/teken.c optional sc dev/uart/uart_cpu_i386.c optional uart dev/acpica/acpi_if.m standard dev/acpi_support/acpi_wmi_if.m standard Modified: head/sys/conf/files.ia64 ============================================================================== --- head/sys/conf/files.ia64 Wed Sep 2 22:12:31 2009 (r196774) +++ head/sys/conf/files.ia64 Thu Sep 3 09:33:57 2009 (r196775) @@ -60,7 +60,6 @@ dev/kbd/kbd.c optional atkbd | sc | uk dev/syscons/scterm-teken.c optional sc dev/syscons/scvgarndr.c optional sc vga dev/syscons/scvtb.c optional sc -dev/syscons/teken/teken.c optional sc dev/uart/uart_cpu_ia64.c optional uart dev/acpica/acpi_if.m standard ia64/acpica/OsdEnvironment.c optional acpi Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Wed Sep 2 22:12:31 2009 (r196774) +++ head/sys/conf/files.powerpc Thu Sep 3 09:33:57 2009 (r196775) @@ -48,7 +48,6 @@ dev/sound/macio/tumbler.c optional snd_a dev/syscons/scgfbrndr.c optional sc dev/syscons/scterm-teken.c optional sc dev/syscons/scvtb.c optional sc -dev/syscons/teken/teken.c optional sc dev/tsec/if_tsec.c optional tsec dev/tsec/if_tsec_ocp.c optional tsec mpc85xx dev/uart/uart_bus_ocp.c optional uart mpc85xx Modified: head/sys/conf/files.sparc64 ============================================================================== --- head/sys/conf/files.sparc64 Wed Sep 2 22:12:31 2009 (r196774) +++ head/sys/conf/files.sparc64 Thu Sep 3 09:33:57 2009 (r196775) @@ -57,7 +57,6 @@ dev/sound/sbus/cs4231.c optional snd_au dev/syscons/scgfbrndr.c optional sc dev/syscons/scterm-teken.c optional sc dev/syscons/scvtb.c optional sc -dev/syscons/teken/teken.c optional sc dev/uart/uart_cpu_sparc64.c optional uart dev/uart/uart_kbd_sun.c optional uart sc kern/syscalls.c optional ktr Modified: head/sys/dev/syscons/scterm-teken.c ============================================================================== --- head/sys/dev/syscons/scterm-teken.c Wed Sep 2 22:12:31 2009 (r196774) +++ head/sys/dev/syscons/scterm-teken.c Thu Sep 3 09:33:57 2009 (r196775) @@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$"); #include -#include +#include static void scteken_revattr(unsigned char, teken_attr_t *); static unsigned int scteken_attr(const teken_attr_t *); From simon at FreeBSD.org Thu Sep 3 09:44:40 2009 From: simon at FreeBSD.org (Simon L. Nielsen) Date: Thu Sep 3 09:44:57 2009 Subject: svn commit: r196746 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/usb dev/usb/input dev/xen/xenpci In-Reply-To: <4A9E8BBE.9060000@FreeBSD.org> References: <200909020212.n822C7Il078379@svn.freebsd.org> <8497dc1520e5fe6b2b3727d5fb92f358.squirrel@www.jr-hosting.nl> <4A9E8BBE.9060000@FreeBSD.org> Message-ID: <20090903094438.GC1304@zaphod.nitro.dk> On 2009.09.02 08:14:06 -0700, Doug Barton wrote: > Remko Lodder wrote: > > On Wed, September 2, 2009 4:12 am, Alfred Perlstein wrote: > >> Author: alfred > >> Date: Wed Sep 2 02:12:07 2009 > >> New Revision: 196746 > >> URL: http://svn.freebsd.org/changeset/base/196746 > >> > >> Log: > >> MFC: r196489,196498 > >> Critical USB bugfixes for 8.0 > >> > > > > Dear Alfred (and hps!), > > > > It would be awesome to see something more about this in the commit log. I > > needed to look up the specific revisions to see what changed. I always > > learned from Warner and people, that including the original commit > > message(s) saves a lot of time and makes it clear about what is being > > merged. > > ... and I was taught that including the complete commit message is a > waste of space since it already exists in HEAD, and therefore to > summarize the changes briefly rather than reporting them verbatim. A > philosophy with which I agree. :) There were only 2 changes merged, > going back and looking at the logs for them could not have been that > much of a burden. FWIW, I like when there is a text describing the change for an MFC, because: - I don't have to go looking up more info when reading commit mails. - I don't have to go looking up more info when history X years later (this could of couse be dealt with in viewsvn if we wanted to). - If one accidently refer to the wrong revision number it is possible track down which change was MFC'ed by looking at the text. Also I don't see what space is being wasted... I agree at times it might make sense to summarize in case it's a long commit msg, but frankly I'm lazy and most of the time I just copy / paste the commit msg since it's simpler. Just my 0.01 DKK. -- Simon L. Nielsen From des at FreeBSD.org Thu Sep 3 10:06:38 2009 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Thu Sep 3 10:06:51 2009 Subject: svn commit: r196776 - head/lib/libc/locale Message-ID: <200909031006.n83A6bMZ022789@svn.freebsd.org> Author: des Date: Thu Sep 3 10:06:37 2009 New Revision: 196776 URL: http://svn.freebsd.org/changeset/base/196776 Log: Document the need for a cast when passing a char to a ctype function. MFC after: 2 weeks Modified: head/lib/libc/locale/ctype.3 head/lib/libc/locale/digittoint.3 head/lib/libc/locale/isalnum.3 head/lib/libc/locale/isalpha.3 head/lib/libc/locale/isascii.3 head/lib/libc/locale/isblank.3 head/lib/libc/locale/iscntrl.3 head/lib/libc/locale/isdigit.3 head/lib/libc/locale/isgraph.3 head/lib/libc/locale/isideogram.3 head/lib/libc/locale/islower.3 head/lib/libc/locale/isphonogram.3 head/lib/libc/locale/isprint.3 head/lib/libc/locale/ispunct.3 head/lib/libc/locale/isrune.3 head/lib/libc/locale/isspace.3 head/lib/libc/locale/isspecial.3 head/lib/libc/locale/isupper.3 head/lib/libc/locale/isxdigit.3 head/lib/libc/locale/toascii.3 head/lib/libc/locale/tolower.3 head/lib/libc/locale/toupper.3 Modified: head/lib/libc/locale/ctype.3 ============================================================================== --- head/lib/libc/locale/ctype.3 Thu Sep 3 09:33:57 2009 (r196775) +++ head/lib/libc/locale/ctype.3 Thu Sep 3 10:06:37 2009 (r196776) @@ -28,7 +28,7 @@ .\" @(#)ctype.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd March 30, 2004 +.Dd September 3, 2009 .Dt CTYPE 3 .Os .Sh NAME @@ -111,6 +111,13 @@ They are available as macros, defined in .In ctype.h , or as true functions in the C library. See the specific manual pages for more information. +.Pp +.Em NOTE : +if the value passed to one of these functions is a +.Vt signed char , +as is usually the case, it must be cast to an +.Vt unsigned char +to avoid sign-extension errors. .Sh SEE ALSO .Xr digittoint 3 , .Xr isalnum 3 , Modified: head/lib/libc/locale/digittoint.3 ============================================================================== --- head/lib/libc/locale/digittoint.3 Thu Sep 3 09:33:57 2009 (r196775) +++ head/lib/libc/locale/digittoint.3 Thu Sep 3 10:06:37 2009 (r196776) @@ -28,7 +28,7 @@ .\" @(#)digittoint.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd April 6, 2001 +.Dd September 3, 2009 .Dt DIGITTOINT 3 .Os .Sh NAME @@ -46,6 +46,15 @@ The function converts a numeric character to its corresponding integer value. The character can be any decimal digit or hexadecimal digit. With hexadecimal characters, the case of the values does not matter. +.Pp +.Em NOTE : +if the value passed to the +.Fn digittoint +function is a +.Vt signed char , +as is usually the case, it must be cast to an +.Vt unsigned char +to avoid sign-extension errors. .Sh RETURN VALUES The .Fn digittoint Modified: head/lib/libc/locale/isalnum.3 ============================================================================== --- head/lib/libc/locale/isalnum.3 Thu Sep 3 09:33:57 2009 (r196775) +++ head/lib/libc/locale/isalnum.3 Thu Sep 3 10:06:37 2009 (r196776) @@ -32,7 +32,7 @@ .\" @(#)isalnum.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd July 17, 2005 +.Dd September 3, 2009 .Dt ISALNUM 3 .Os .Sh NAME @@ -75,6 +75,15 @@ In the ASCII character set, this include .It "\&164\ ``t'' \t165\ ``u'' \t166\ ``v'' \t167\ ``w'' \t170\ ``x''" .It "\&171\ ``y'' \t172\ ``z''" .El +.Pp +.Em NOTE : +if the value passed to the +.Fn isalnum +function is a +.Vt signed char , +as is usually the case, it must be cast to an +.Vt unsigned char +to avoid sign-extension errors. .Sh RETURN VALUES The .Fn isalnum Modified: head/lib/libc/locale/isalpha.3 ============================================================================== --- head/lib/libc/locale/isalpha.3 Thu Sep 3 09:33:57 2009 (r196775) +++ head/lib/libc/locale/isalpha.3 Thu Sep 3 10:06:37 2009 (r196776) @@ -32,7 +32,7 @@ .\" @(#)isalpha.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd July 17, 2005 +.Dd September 3, 2009 .Dt ISALPHA 3 .Os .Sh NAME @@ -73,6 +73,15 @@ In the ASCII character set, this include .It "\&164\ ``t'' \t165\ ``u'' \t166\ ``v'' \t167\ ``w'' \t170\ ``x''" .It "\&171\ ``y'' \t172\ ``z''" .El +.Pp +.Em NOTE : +if the value passed to the +.Fn isalpha +function is a +.Vt signed char , +as is usually the case, it must be cast to an +.Vt unsigned char +to avoid sign-extension errors. .Sh RETURN VALUES The .Fn isalpha Modified: head/lib/libc/locale/isascii.3 ============================================================================== --- head/lib/libc/locale/isascii.3 Thu Sep 3 09:33:57 2009 (r196775) +++ head/lib/libc/locale/isascii.3 Thu Sep 3 10:06:37 2009 (r196776) @@ -28,7 +28,7 @@ .\" @(#)isascii.3 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd October 6, 2002 +.Dd September 3, 2009 .Dt ISASCII 3 .Os .Sh NAME @@ -47,6 +47,15 @@ function tests for an .Tn ASCII character, which is any character between 0 and octal 0177 inclusive. +.Pp +.Em NOTE : +if the value passed to the +.Fn isascii +function is a +.Vt signed char , +as is usually the case, it must be cast to an +.Vt unsigned char +to avoid sign-extension errors. .Sh SEE ALSO .Xr ctype 3 , .Xr iswascii 3 , Modified: head/lib/libc/locale/isblank.3 ============================================================================== --- head/lib/libc/locale/isblank.3 Thu Sep 3 09:33:57 2009 (r196775) +++ head/lib/libc/locale/isblank.3 Thu Sep 3 10:06:37 2009 (r196776) @@ -28,7 +28,7 @@ .\" @(#)isblank.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd July 17, 2005 +.Dd September 3, 2009 .Dt ISBLANK 3 .Os .Sh NAME @@ -57,6 +57,15 @@ The value of the argument must be repres .Vt "unsigned char" or the value of .Dv EOF . +.Pp +.Em NOTE : +if the value passed to the +.Fn isblank +function is a +.Vt signed char , +as is usually the case, it must be cast to an +.Vt unsigned char +to avoid sign-extension errors. .Sh RETURN VALUES The .Fn isblank Modified: head/lib/libc/locale/iscntrl.3 ============================================================================== --- head/lib/libc/locale/iscntrl.3 Thu Sep 3 09:33:57 2009 (r196775) +++ head/lib/libc/locale/iscntrl.3 Thu Sep 3 10:06:37 2009 (r196776) @@ -32,7 +32,7 @@ .\" @(#)iscntrl.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd July 17, 2005 +.Dd September 3, 2009 .Dt ISCNTRL 3 .Os .Sh NAME @@ -65,6 +65,15 @@ In the ASCII character set, this include .It "\&031\ EM \t032\ SUB \t033\ ESC \t034\ FS \t035\ GS" .It "\&036\ RS \t037\ US \t177\ DEL" .El +.Pp +.Em NOTE : +if the value passed to the +.Fn iscntrl +function is a +.Vt signed char , +as is usually the case, it must be cast to an +.Vt unsigned char +to avoid sign-extension errors. .Sh RETURN VALUES The .Fn iscntrl Modified: head/lib/libc/locale/isdigit.3 ============================================================================== --- head/lib/libc/locale/isdigit.3 Thu Sep 3 09:33:57 2009 (r196775) +++ head/lib/libc/locale/isdigit.3 Thu Sep 3 10:06:37 2009 (r196776) @@ -32,7 +32,7 @@ .\" @(#)isdigit.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd May 4, 2007 +.Dd September 3, 2009 .Dt ISDIGIT 3 .Os .Sh NAME @@ -68,6 +68,15 @@ The value of the argument must be repres .Vt "unsigned char" or the value of .Dv EOF . +.Pp +.Em NOTE : +if the value passed to the +.Fn isdigit +function is a +.Vt signed char , +as is usually the case, it must be cast to an +.Vt unsigned char +to avoid sign-extension errors. .Sh RETURN VALUES The .Fn isdigit Modified: head/lib/libc/locale/isgraph.3 ============================================================================== --- head/lib/libc/locale/isgraph.3 Thu Sep 3 09:33:57 2009 (r196775) +++ head/lib/libc/locale/isgraph.3 Thu Sep 3 10:06:37 2009 (r196776) @@ -32,7 +32,7 @@ .\" @(#)isgraph.3 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd July 17, 2005 +.Dd September 3, 2009 .Dt ISGRAPH 3 .Os .Sh NAME @@ -80,6 +80,15 @@ In the ASCII character set, this include .It "\&166\ ``v'' \t167\ ``w'' \t170\ ``x'' \t171\ ``y'' \t172\ ``z''" .It "\&173\ ``{'' \t174\ ``|'' \t175\ ``}'' \t176\ ``~''" .El +.Pp +.Em NOTE : +if the value passed to the +.Fn isgraph +function is a +.Vt signed char , +as is usually the case, it must be cast to an +.Vt unsigned char +to avoid sign-extension errors. .Sh RETURN VALUES The .Fn isgraph Modified: head/lib/libc/locale/isideogram.3 ============================================================================== --- head/lib/libc/locale/isideogram.3 Thu Sep 3 09:33:57 2009 (r196775) +++ head/lib/libc/locale/isideogram.3 Thu Sep 3 10:06:37 2009 (r196776) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 30, 2004 +.Dd September 3, 2009 .Dt ISIDEOGRAM 3 .Os .Sh NAME @@ -41,6 +41,15 @@ The .Fn isideogram function tests for an ideographic character. +.Pp +.Em NOTE : +if the value passed to the +.Fn isideogram +function is a +.Vt signed char , +as is usually the case, it must be cast to an +.Vt unsigned char +to avoid sign-extension errors. .Sh RETURN VALUES The .Fn isideogram Modified: head/lib/libc/locale/islower.3 ============================================================================== --- head/lib/libc/locale/islower.3 Thu Sep 3 09:33:57 2009 (r196775) +++ head/lib/libc/locale/islower.3 Thu Sep 3 10:06:37 2009 (r196776) @@ -32,7 +32,7 @@ .\" @(#)islower.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd July 17, 2005 +.Dd September 3, 2009 .Dt ISLOWER 3 .Os .Sh NAME @@ -64,6 +64,15 @@ In the ASCII character set, this include .It "\&165\ ``u'' \t166\ ``v'' \t167\ ``w'' \t170\ ``x'' \t171\ ``y''" .It "\&172\ ``z''" .El +.Pp +.Em NOTE : +if the value passed to the +.Fn islower +function is a +.Vt signed char , +as is usually the case, it must be cast to an +.Vt unsigned char +to avoid sign-extension errors. .Sh RETURN VALUES The .Fn islower Modified: head/lib/libc/locale/isphonogram.3 ============================================================================== --- head/lib/libc/locale/isphonogram.3 Thu Sep 3 09:33:57 2009 (r196775) +++ head/lib/libc/locale/isphonogram.3 Thu Sep 3 10:06:37 2009 (r196776) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 30, 2004 +.Dd September 3, 2009 .Dt ISPHONOGRAM 3 .Os .Sh NAME @@ -41,6 +41,15 @@ The .Fn isphonogram function tests for a phonographic character. +.Pp +.Em NOTE : +if the value passed to the +.Fn isphonogram +function is a +.Vt signed char , +as is usually the case, it must be cast to an +.Vt unsigned char +to avoid sign-extension errors. .Sh RETURN VALUES The .Fn isphonogram Modified: head/lib/libc/locale/isprint.3 ============================================================================== --- head/lib/libc/locale/isprint.3 Thu Sep 3 09:33:57 2009 (r196775) +++ head/lib/libc/locale/isprint.3 Thu Sep 3 10:06:37 2009 (r196776) @@ -32,7 +32,7 @@ .\" @(#)isprint.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd July 17, 2005 +.Dd September 3, 2009 .Dt ISPRINT 3 .Os .Sh NAME @@ -78,6 +78,15 @@ In the ASCII character set, this include .It "\&165\ ``u'' \t166\ ``v'' \t167\ ``w'' \t170\ ``x'' \t171\ ``y''" .It "\&172\ ``z'' \t173\ ``{'' \t174\ ``|'' \t175\ ``}'' \t176\ ``~''" .El +.Pp +.Em NOTE : +if the value passed to the +.Fn isprint +function is a +.Vt signed char , +as is usually the case, it must be cast to an +.Vt unsigned char +to avoid sign-extension errors. .Sh RETURN VALUES The .Fn isprint Modified: head/lib/libc/locale/ispunct.3 ============================================================================== --- head/lib/libc/locale/ispunct.3 Thu Sep 3 09:33:57 2009 (r196775) +++ head/lib/libc/locale/ispunct.3 Thu Sep 3 10:06:37 2009 (r196776) @@ -32,7 +32,7 @@ .\" @(#)ispunct.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd July 17, 2005 +.Dd September 3, 2009 .Dt ISPUNCT 3 .Os .Sh NAME @@ -70,6 +70,15 @@ In the ASCII character set, this include .It "\&136\ ``^'' \t137\ ``_'' \t140\ ```'' \t173\ ``{'' \t174\ ``|''" .It "\&175\ ``}'' \t176\ ``~''" .El +.Pp +.Em NOTE : +if the value passed to the +.Fn ispunct +function is a +.Vt signed char , +as is usually the case, it must be cast to an +.Vt unsigned char +to avoid sign-extension errors. .Sh RETURN VALUES The .Fn ispunct Modified: head/lib/libc/locale/isrune.3 ============================================================================== --- head/lib/libc/locale/isrune.3 Thu Sep 3 09:33:57 2009 (r196775) +++ head/lib/libc/locale/isrune.3 Thu Sep 3 10:06:37 2009 (r196776) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 30, 2004 +.Dd September 3, 2009 .Dt ISRUNE 3 .Os .Sh NAME @@ -46,6 +46,15 @@ In the .Tn ASCII character set, this is equivalent to .Fn isascii . +.Pp +.Em NOTE : +if the value passed to the +.Fn isrune +function is a +.Vt signed char , +as is usually the case, it must be cast to an +.Vt unsigned char +to avoid sign-extension errors. .Sh RETURN VALUES The .Fn isrune Modified: head/lib/libc/locale/isspace.3 ============================================================================== --- head/lib/libc/locale/isspace.3 Thu Sep 3 09:33:57 2009 (r196775) +++ head/lib/libc/locale/isspace.3 Thu Sep 3 10:06:37 2009 (r196776) @@ -32,7 +32,7 @@ .\" @(#)isspace.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd July 17, 2005 +.Dd September 3, 2009 .Dt ISSPACE 3 .Os .Sh NAME @@ -61,6 +61,15 @@ The value of the argument must be repres .Vt "unsigned char" or the value of .Dv EOF . +.Pp +.Em NOTE : +if the value passed to the +.Fn isspace +function is a +.Vt signed char , +as is usually the case, it must be cast to an +.Vt unsigned char +to avoid sign-extension errors. .Sh RETURN VALUES The .Fn isspace Modified: head/lib/libc/locale/isspecial.3 ============================================================================== --- head/lib/libc/locale/isspecial.3 Thu Sep 3 09:33:57 2009 (r196775) +++ head/lib/libc/locale/isspecial.3 Thu Sep 3 10:06:37 2009 (r196776) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 30, 2004 +.Dd September 3, 2009 .Dt ISSPECIAL 3 .Os .Sh NAME @@ -41,6 +41,15 @@ The .Fn isspecial function tests for a special character. +.Pp +.Em NOTE : +if the value passed to the +.Fn isspecial +function is a +.Vt signed char , +as is usually the case, it must be cast to an +.Vt unsigned char +to avoid sign-extension errors. .Sh RETURN VALUES The .Fn isspecial Modified: head/lib/libc/locale/isupper.3 ============================================================================== --- head/lib/libc/locale/isupper.3 Thu Sep 3 09:33:57 2009 (r196775) +++ head/lib/libc/locale/isupper.3 Thu Sep 3 10:06:37 2009 (r196776) @@ -32,7 +32,7 @@ .\" @(#)isupper.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd July 17, 2005 +.Dd September 3, 2009 .Dt ISUPPER 3 .Os .Sh NAME @@ -64,6 +64,15 @@ In the ASCII character set, this include .It "\&125\ ``U'' \t126\ ``V'' \t127\ ``W'' \t130\ ``X'' \t131\ ``Y''" .It "\&132\ ``Z''" .El +.Pp +.Em NOTE : +if the value passed to the +.Fn isupper +function is a +.Vt signed char , +as is usually the case, it must be cast to an +.Vt unsigned char +to avoid sign-extension errors. .Sh RETURN VALUES The .Fn isupper Modified: head/lib/libc/locale/isxdigit.3 ============================================================================== --- head/lib/libc/locale/isxdigit.3 Thu Sep 3 09:33:57 2009 (r196775) +++ head/lib/libc/locale/isxdigit.3 Thu Sep 3 10:06:37 2009 (r196776) @@ -32,7 +32,7 @@ .\" @(#)isxdigit.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd July 17, 2005 +.Dd September 3, 2009 .Dt ISXDIGIT 3 .Os .Sh NAME @@ -71,6 +71,15 @@ The value of the argument must be repres .Vt "unsigned char" or the value of .Dv EOF . +.Pp +.Em NOTE : +if the value passed to the +.Fn isxdigit +function is a +.Vt signed char , +as is usually the case, it must be cast to an +.Vt unsigned char +to avoid sign-extension errors. .Sh RETURN VALUES The .Fn isxdigit Modified: head/lib/libc/locale/toascii.3 ============================================================================== --- head/lib/libc/locale/toascii.3 Thu Sep 3 09:33:57 2009 (r196775) +++ head/lib/libc/locale/toascii.3 Thu Sep 3 10:06:37 2009 (r196776) @@ -28,7 +28,7 @@ .\" @(#)toascii.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd September 3, 2009 .Dt TOASCII 3 .Os .Sh NAME @@ -45,6 +45,15 @@ The .Fn toascii function strips all but the low 7 bits from a letter, including parity or other marker bits. +.Pp +.Em NOTE : +if the value passed to the +.Fn toascii +function is a +.Vt signed char , +as is usually the case, it must be cast to an +.Vt unsigned char +to avoid sign-extension errors. .Sh RETURN VALUES The .Fn toascii Modified: head/lib/libc/locale/tolower.3 ============================================================================== --- head/lib/libc/locale/tolower.3 Thu Sep 3 09:33:57 2009 (r196775) +++ head/lib/libc/locale/tolower.3 Thu Sep 3 10:06:37 2009 (r196776) @@ -32,7 +32,7 @@ .\" @(#)tolower.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd July 17, 2005 +.Dd September 3, 2009 .Dt TOLOWER 3 .Os .Sh NAME @@ -53,6 +53,15 @@ The argument must be representable as an .Vt "unsigned char" or the value of .Dv EOF . +.Pp +.Em NOTE : +if the value passed to the +.Fn tolower +function is a +.Vt signed char , +as is usually the case, it must be cast to an +.Vt unsigned char +to avoid sign-extension errors. .Sh RETURN VALUES If the argument is an upper-case letter, the .Fn tolower Modified: head/lib/libc/locale/toupper.3 ============================================================================== --- head/lib/libc/locale/toupper.3 Thu Sep 3 09:33:57 2009 (r196775) +++ head/lib/libc/locale/toupper.3 Thu Sep 3 10:06:37 2009 (r196776) @@ -32,7 +32,7 @@ .\" @(#)toupper.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd July 17, 2005 +.Dd September 3, 2009 .Dt TOUPPER 3 .Os .Sh NAME @@ -53,6 +53,15 @@ The argument must be representable as an .Vt "unsigned char" or the value of .Dv EOF . +.Pp +.Em NOTE : +if the value passed to the +.Fn toupper +function is a +.Vt signed char , +as is usually the case, it must be cast to an +.Vt unsigned char +to avoid sign-extension errors. .Sh RETURN VALUES If the argument is a lower-case letter, the .Fn toupper From joerg at britannica.bec.de Thu Sep 3 12:12:40 2009 From: joerg at britannica.bec.de (Joerg Sonnenberger) Date: Thu Sep 3 12:13:04 2009 Subject: svn commit: r196752 - head/lib/libc/stdtime In-Reply-To: <86zl9c9z05.fsf@ds4.des.no> References: <200909020456.n824uUqQ082136@svn.freebsd.org> <20090902070808.GA1290@arthur.nitro.dk> <20090902084002.GA17325@nagual.pp.ru> <867hwgcwvo.fsf@ds4.des.no> <20090903084325.GA65192@nagual.pp.ru> <86zl9c9z05.fsf@ds4.des.no> Message-ID: <20090903115416.GB448@britannica.bec.de> On Thu, Sep 03, 2009 at 11:08:26AM +0200, Dag-Erling Sm?rgrav wrote: > @@ -65,6 +65,15 @@ > .It "\&031\ EM \t032\ SUB \t033\ ESC \t034\ FS \t035\ GS" > .It "\&036\ RS \t037\ US \t177\ DEL" > .El > +.Pp > +.Em NOTE : > +if the value passed to the > +.Fn iscntrl > +function is a > +.Vt signed char , > +as is usually the case, it must be cast to an > +.Vt unsigned char > +to avoid sign-extension errors. > .Sh RETURN VALUES > The > .Fn iscntrl This is actually not good enough. ISO C doesn't specify whether plain char is signed or unsigned. Also, isascii is the only exception to this rule, so the change for that is wrong. Joerg From mav at FreeBSD.org Thu Sep 3 12:37:18 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Thu Sep 3 12:37:29 2009 Subject: svn commit: r196777 - head/sys/dev/ahci Message-ID: <200909031237.n83CbIgk032551@svn.freebsd.org> Author: mav Date: Thu Sep 3 12:37:17 2009 New Revision: 196777 URL: http://svn.freebsd.org/changeset/base/196777 Log: ATI SB600 can't handle 256 sectors transfers with FPDMA (NCQ). MFC after: 3 days Modified: head/sys/dev/ahci/ahci.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Thu Sep 3 10:06:37 2009 (r196776) +++ head/sys/dev/ahci/ahci.c Thu Sep 3 12:37:17 2009 (r196777) @@ -1942,6 +1942,9 @@ ahciaction(struct cam_sim *sim, union cc cpi->protocol = PROTO_ATA; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->maxio = MAXPHYS; + /* ATI SB600 can't handle 256 sectors with FPDMA (NCQ). */ + if (pci_get_devid(device_get_parent(dev)) == 0x43801002) + cpi->maxio = min(cpi->maxio, 255 * 512); cpi->ccb_h.status = CAM_REQ_CMP; xpt_done(ccb); break; From des at des.no Thu Sep 3 13:25:27 2009 From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) Date: Thu Sep 3 13:25:35 2009 Subject: svn commit: r196752 - head/lib/libc/stdtime In-Reply-To: <20090903115416.GB448@britannica.bec.de> (Joerg Sonnenberger's message of "Thu, 3 Sep 2009 13:54:16 +0200") References: <200909020456.n824uUqQ082136@svn.freebsd.org> <20090902070808.GA1290@arthur.nitro.dk> <20090902084002.GA17325@nagual.pp.ru> <867hwgcwvo.fsf@ds4.des.no> <20090903084325.GA65192@nagual.pp.ru> <86zl9c9z05.fsf@ds4.des.no> <20090903115416.GB448@britannica.bec.de> Message-ID: <86vdk0upmh.fsf@ds4.des.no> Joerg Sonnenberger writes: > Dag-Erling Sm?rgrav writes: > > @@ -65,6 +65,15 @@ > > .It "\&031\ EM \t032\ SUB \t033\ ESC \t034\ FS \t035\ GS" > > .It "\&036\ RS \t037\ US \t177\ DEL" > > .El > > +.Pp > > +.Em NOTE : > > +if the value passed to the > > +.Fn iscntrl > > +function is a > > +.Vt signed char , > > +as is usually the case, it must be cast to an > > +.Vt unsigned char > > +to avoid sign-extension errors. > > .Sh RETURN VALUES > > The > > .Fn iscntrl > This is actually not good enough. ISO C doesn't specify whether plain > char is signed or unsigned. This is FreeBSD. Our char is signed. On systems where it isn't (IRIX is the only one I know of), the cast is a no-op. > Also, isascii is the only exception to this rule, so the change for that > is wrong. No. The fact that isascii() accidentally returns the correct answer even in the absence of a cast is irrelevant. Passing a signed char to isascii() invokes undefined behavior. 7.4 Character handling 1 The header declares several functions useful for classifying and mapping characters.166) In all cases the argument is an int, the value of which shall be representable as an unsigned char or shall equal the value of the macro EOF. If the argument has any other value, the behavior is undefined. DES -- Dag-Erling Sm?rgrav - des@des.no From attilio at FreeBSD.org Thu Sep 3 13:40:41 2009 From: attilio at FreeBSD.org (Attilio Rao) Date: Thu Sep 3 13:40:53 2009 Subject: svn commit: r196779 - in head/sys: kern sys Message-ID: <200909031340.n83Defkv034013@svn.freebsd.org> Author: attilio Date: Thu Sep 3 13:40:41 2009 New Revision: 196779 URL: http://svn.freebsd.org/changeset/base/196779 Log: Add intermediate states for attaching and detaching that will be reused by the enhached newbus locking once it is checked in. This change can be easilly MFCed to STABLE_8 at the appropriate moment. Reviewed by: jhb, scottl Tested by: Giovanni Trematerra Modified: head/sys/kern/subr_bus.c head/sys/sys/bus.h Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Thu Sep 3 12:41:00 2009 (r196778) +++ head/sys/kern/subr_bus.c Thu Sep 3 13:40:41 2009 (r196779) @@ -2625,10 +2625,16 @@ device_attach(device_t dev) { int error; + if (dev->state >= DS_ATTACHING) + return (0); device_sysctl_init(dev); if (!device_is_quiet(dev)) device_print_child(dev->parent, dev); + dev->state = DS_ATTACHING; if ((error = DEVICE_ATTACH(dev)) != 0) { + KASSERT(dev->state == DS_ATTACHING, + ("%s: %p device state must not been changing", __func__, + dev)); printf("device_attach: %s%d attach returned %d\n", dev->driver->name, dev->unit, error); /* Unset the class; set in device_probe_child */ @@ -2639,6 +2645,8 @@ device_attach(device_t dev) dev->state = DS_NOTPRESENT; return (error); } + KASSERT(dev->state == DS_ATTACHING, + ("%s: %p device state must not been changing", __func__, dev)); device_sysctl_update(dev); dev->state = DS_ATTACHED; devadded(dev); @@ -2674,8 +2682,16 @@ device_detach(device_t dev) if (dev->state != DS_ATTACHED) return (0); - if ((error = DEVICE_DETACH(dev)) != 0) + dev->state = DS_DETACHING; + if ((error = DEVICE_DETACH(dev)) != 0) { + KASSERT(dev->state == DS_DETACHING, + ("%s: %p device state must not been changing", __func__, + dev)); + dev->state = DS_ATTACHED; return (error); + } + KASSERT(dev->state == DS_DETACHING, + ("%s: %p device state must not been changing", __func__, dev)); devremoved(dev); if (!device_is_quiet(dev)) device_printf(dev, "detached\n"); @@ -2730,7 +2746,7 @@ device_quiesce(device_t dev) int device_shutdown(device_t dev) { - if (dev->state < DS_ATTACHED) + if (dev->state < DS_ATTACHED || dev->state == DS_DETACHING) return (0); return (DEVICE_SHUTDOWN(dev)); } Modified: head/sys/sys/bus.h ============================================================================== --- head/sys/sys/bus.h Thu Sep 3 12:41:00 2009 (r196778) +++ head/sys/sys/bus.h Thu Sep 3 13:40:41 2009 (r196779) @@ -52,8 +52,11 @@ struct u_businfo { typedef enum device_state { DS_NOTPRESENT, /**< @brief not probed or probe failed */ DS_ALIVE, /**< @brief probe succeeded */ + DS_ATTACHING, /**< @brief attaching is in progress */ DS_ATTACHED, /**< @brief attach method called */ - DS_BUSY /**< @brief device is open */ + DS_BUSY, /**< @brief device is open */ + DS_DETACHING /**< @brief detaching is in progress */ + } device_state_t; /** From attilio at freebsd.org Thu Sep 3 13:46:43 2009 From: attilio at freebsd.org (Attilio Rao) Date: Thu Sep 3 13:46:54 2009 Subject: svn commit: r196779 - in head/sys: kern sys In-Reply-To: <200909031340.n83Defkv034013@svn.freebsd.org> References: <200909031340.n83Defkv034013@svn.freebsd.org> Message-ID: <3bbf2fe10909030646o2dc30166r303ee646572c741b@mail.gmail.com> 2009/9/3 Attilio Rao : > Author: attilio > Date: Thu Sep 3 13:40:41 2009 > New Revision: 196779 > URL: http://svn.freebsd.org/changeset/base/196779 > > Log: > Add intermediate states for attaching and detaching that will be > reused by the enhached newbus locking once it is checked in. > This change can be easilly MFCed to STABLE_8 at the appropriate moment. About this commit, there are a few of things which worths nothing: - This has been committed separately from the new-bus locking because it is planned to be MFCed before 8.0 goes out in order to offer the correct ABI compatibility for merging, while 8.1-REL, the newbus locking - Probabilly what we really wanted here is just a transitioning state instead than both DS_ATTACHING and DS_DETACHING. Some consumers would eventually understand what of the 2 is that and one of these consumers is device_is_attached(). That function is used improperly by many detach handlers in a construct like: int foo_attach(device_t dev) { ... if (error != 0) foo_detach(dev); ... } int foo_detach(device_dev) { ... if (device_is_attached(dev)) { /* do some handover */ } ... } That is an incorrect behaviour which needs to be discouraged and that will be fixed during 9.0. In the while this semantic (used by many drivers) makes the single-transition state impraticable and so we will need to stick with that device states also in 9.0. Attilio -- Peace can only be achieved by understanding - A. Einstein From jhb at FreeBSD.org Thu Sep 3 13:54:58 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Thu Sep 3 13:55:17 2009 Subject: svn commit: r196780 - in stable/8/sys: . amd64/amd64 amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci i386/i386 i386/include Message-ID: <200909031354.n83DswuL034426@svn.freebsd.org> Author: jhb Date: Thu Sep 3 13:54:58 2009 New Revision: 196780 URL: http://svn.freebsd.org/changeset/base/196780 Log: MFC 196705 and 196707: - Improve pmap_change_attr() on i386 so that it is able to demote a large (2/4MB) page into 4KB pages as needed. This should be fairly rare in practice. - Simplify pmap_change_attr() a bit: - Always calculate the cache bits instead of doing it on-demand. - Always set changed to TRUE rather than only doing it if it is false. Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/amd64/pmap.c stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/i386/i386/pmap.c stable/8/sys/i386/include/pmap.h Modified: stable/8/sys/amd64/amd64/pmap.c ============================================================================== --- stable/8/sys/amd64/amd64/pmap.c Thu Sep 3 13:40:41 2009 (r196779) +++ stable/8/sys/amd64/amd64/pmap.c Thu Sep 3 13:54:58 2009 (r196780) @@ -4476,7 +4476,8 @@ pmap_change_attr_locked(vm_offset_t va, if (base < DMAP_MIN_ADDRESS) return (EINVAL); - cache_bits_pde = cache_bits_pte = -1; + cache_bits_pde = pmap_cache_bits(mode, 1); + cache_bits_pte = pmap_cache_bits(mode, 0); changed = FALSE; /* @@ -4493,8 +4494,6 @@ pmap_change_attr_locked(vm_offset_t va, * memory type, then we need not demote this page. Just * increment tmpva to the next 1GB page frame. */ - if (cache_bits_pde < 0) - cache_bits_pde = pmap_cache_bits(mode, 1); if ((*pdpe & PG_PDE_CACHE) == cache_bits_pde) { tmpva = trunc_1gpage(tmpva) + NBPDP; continue; @@ -4522,8 +4521,6 @@ pmap_change_attr_locked(vm_offset_t va, * memory type, then we need not demote this page. Just * increment tmpva to the next 2MB page frame. */ - if (cache_bits_pde < 0) - cache_bits_pde = pmap_cache_bits(mode, 1); if ((*pde & PG_PDE_CACHE) == cache_bits_pde) { tmpva = trunc_2mpage(tmpva) + NBPDR; continue; @@ -4557,12 +4554,9 @@ pmap_change_attr_locked(vm_offset_t va, for (tmpva = base; tmpva < base + size; ) { pdpe = pmap_pdpe(kernel_pmap, tmpva); if (*pdpe & PG_PS) { - if (cache_bits_pde < 0) - cache_bits_pde = pmap_cache_bits(mode, 1); if ((*pdpe & PG_PDE_CACHE) != cache_bits_pde) { pmap_pde_attr(pdpe, cache_bits_pde); - if (!changed) - changed = TRUE; + changed = TRUE; } if (tmpva >= VM_MIN_KERNEL_ADDRESS) { if (pa_start == pa_end) { @@ -4588,12 +4582,9 @@ pmap_change_attr_locked(vm_offset_t va, } pde = pmap_pdpe_to_pde(pdpe, tmpva); if (*pde & PG_PS) { - if (cache_bits_pde < 0) - cache_bits_pde = pmap_cache_bits(mode, 1); if ((*pde & PG_PDE_CACHE) != cache_bits_pde) { pmap_pde_attr(pde, cache_bits_pde); - if (!changed) - changed = TRUE; + changed = TRUE; } if (tmpva >= VM_MIN_KERNEL_ADDRESS) { if (pa_start == pa_end) { @@ -4616,13 +4607,10 @@ pmap_change_attr_locked(vm_offset_t va, } tmpva = trunc_2mpage(tmpva) + NBPDR; } else { - if (cache_bits_pte < 0) - cache_bits_pte = pmap_cache_bits(mode, 0); pte = pmap_pde_to_pte(pde, tmpva); if ((*pte & PG_PTE_CACHE) != cache_bits_pte) { pmap_pte_attr(pte, cache_bits_pte); - if (!changed) - changed = TRUE; + changed = TRUE; } if (tmpva >= VM_MIN_KERNEL_ADDRESS) { if (pa_start == pa_end) { Modified: stable/8/sys/i386/i386/pmap.c ============================================================================== --- stable/8/sys/i386/i386/pmap.c Thu Sep 3 13:40:41 2009 (r196779) +++ stable/8/sys/i386/i386/pmap.c Thu Sep 3 13:54:58 2009 (r196780) @@ -288,12 +288,15 @@ static boolean_t pmap_enter_pde(pmap_t p static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, vm_page_t mpte); static void pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte); +static void pmap_fill_ptp(pt_entry_t *firstpte, pt_entry_t newpte); static boolean_t pmap_is_modified_pvh(struct md_page *pvh); static void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode); static vm_page_t pmap_lookup_pt_page(pmap_t pmap, vm_offset_t va); +static void pmap_pde_attr(pd_entry_t *pde, int cache_bits); static void pmap_promote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va); static boolean_t pmap_protect_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t sva, vm_prot_t prot); +static void pmap_pte_attr(pt_entry_t *pte, int cache_bits); static void pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offset_t sva, vm_page_t *free); static int pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, vm_offset_t sva, @@ -2289,32 +2292,62 @@ pmap_pv_insert_pde(pmap_t pmap, vm_offse } /* - * Tries to demote a 2- or 4MB page mapping. + * Fills a page table page with mappings to consecutive physical pages. + */ +static void +pmap_fill_ptp(pt_entry_t *firstpte, pt_entry_t newpte) +{ + pt_entry_t *pte; + + for (pte = firstpte; pte < firstpte + NPTEPG; pte++) { + *pte = newpte; + newpte += PAGE_SIZE; + } +} + +/* + * Tries to demote a 2- or 4MB page mapping. If demotion fails, the + * 2- or 4MB page mapping is invalidated. */ static boolean_t pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va) { pd_entry_t newpde, oldpde; pmap_t allpmaps_entry; - pt_entry_t *firstpte, newpte, *pte; + pt_entry_t *firstpte, newpte; vm_paddr_t mptepa; vm_page_t free, mpte; PMAP_LOCK_ASSERT(pmap, MA_OWNED); + oldpde = *pde; + KASSERT((oldpde & (PG_PS | PG_V)) == (PG_PS | PG_V), + ("pmap_demote_pde: oldpde is missing PG_PS and/or PG_V")); mpte = pmap_lookup_pt_page(pmap, va); if (mpte != NULL) pmap_remove_pt_page(pmap, mpte); else { - KASSERT((*pde & PG_W) == 0, + KASSERT((oldpde & PG_W) == 0, ("pmap_demote_pde: page table page for a wired mapping" " is missing")); - free = NULL; - pmap_remove_pde(pmap, pde, trunc_4mpage(va), &free); - pmap_invalidate_page(pmap, trunc_4mpage(va)); - pmap_free_zero_pages(free); - CTR2(KTR_PMAP, "pmap_demote_pde: failure for va %#x" - " in pmap %p", va, pmap); - return (FALSE); + + /* + * Invalidate the 2- or 4MB page mapping and return + * "failure" if the mapping was never accessed or the + * allocation of the new page table page fails. + */ + if ((oldpde & PG_A) == 0 || (mpte = vm_page_alloc(NULL, + va >> PDRSHIFT, VM_ALLOC_NOOBJ | VM_ALLOC_NORMAL | + VM_ALLOC_WIRED)) == NULL) { + free = NULL; + pmap_remove_pde(pmap, pde, trunc_4mpage(va), &free); + pmap_invalidate_page(pmap, trunc_4mpage(va)); + pmap_free_zero_pages(free); + CTR2(KTR_PMAP, "pmap_demote_pde: failure for va %#x" + " in pmap %p", va, pmap); + return (FALSE); + } + if (va < VM_MAXUSER_ADDRESS) + pmap->pm_stats.resident_count++; } mptepa = VM_PAGE_TO_PHYS(mpte); @@ -2348,30 +2381,32 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t } firstpte = PADDR2; } - oldpde = *pde; newpde = mptepa | PG_M | PG_A | (oldpde & PG_U) | PG_RW | PG_V; - KASSERT((oldpde & (PG_A | PG_V)) == (PG_A | PG_V), - ("pmap_demote_pde: oldpde is missing PG_A and/or PG_V")); + KASSERT((oldpde & PG_A) != 0, + ("pmap_demote_pde: oldpde is missing PG_A")); KASSERT((oldpde & (PG_M | PG_RW)) != PG_RW, ("pmap_demote_pde: oldpde is missing PG_M")); - KASSERT((oldpde & PG_PS) != 0, - ("pmap_demote_pde: oldpde is missing PG_PS")); newpte = oldpde & ~PG_PS; if ((newpte & PG_PDE_PAT) != 0) newpte ^= PG_PDE_PAT | PG_PTE_PAT; /* - * If the mapping has changed attributes, update the page table - * entries. - */ + * If the page table page is new, initialize it. + */ + if (mpte->wire_count == 1) { + mpte->wire_count = NPTEPG; + pmap_fill_ptp(firstpte, newpte); + } KASSERT((*firstpte & PG_FRAME) == (newpte & PG_FRAME), ("pmap_demote_pde: firstpte and newpte map different physical" " addresses")); + + /* + * If the mapping has changed attributes, update the page table + * entries. + */ if ((*firstpte & PG_PTE_PROMOTE) != (newpte & PG_PTE_PROMOTE)) - for (pte = firstpte; pte < firstpte + NPTEPG; pte++) { - *pte = newpte; - newpte += PAGE_SIZE; - } + pmap_fill_ptp(firstpte, newpte); /* * Demote the mapping. This pmap is locked. The old PDE has @@ -4426,6 +4461,40 @@ pmap_clear_reference(vm_page_t m) * Miscellaneous support routines follow */ +/* Adjust the cache mode for a 4KB page mapped via a PTE. */ +static __inline void +pmap_pte_attr(pt_entry_t *pte, int cache_bits) +{ + u_int opte, npte; + + /* + * The cache mode bits are all in the low 32-bits of the + * PTE, so we can just spin on updating the low 32-bits. + */ + do { + opte = *(u_int *)pte; + npte = opte & ~PG_PTE_CACHE; + npte |= cache_bits; + } while (npte != opte && !atomic_cmpset_int((u_int *)pte, opte, npte)); +} + +/* Adjust the cache mode for a 2/4MB page mapped via a PDE. */ +static __inline void +pmap_pde_attr(pd_entry_t *pde, int cache_bits) +{ + u_int opde, npde; + + /* + * The cache mode bits are all in the low 32-bits of the + * PDE, so we can just spin on updating the low 32-bits. + */ + do { + opde = *(u_int *)pde; + npde = opde & ~PG_PDE_CACHE; + npde |= cache_bits; + } while (npde != opde && !atomic_cmpset_int((u_int *)pde, opde, npde)); +} + /* * Map a set of physical memory pages into the kernel virtual * address space. Return a pointer to where it is mapped. This @@ -4537,13 +4606,23 @@ pmap_page_set_memattr(vm_page_t m, vm_me } } +/* + * Changes the specified virtual address range's memory type to that given by + * the parameter "mode". The specified virtual address range must be + * completely contained within either the kernel map. + * + * Returns zero if the change completed successfully, and either EINVAL or + * ENOMEM if the change failed. Specifically, EINVAL is returned if some part + * of the virtual address range was not mapped, and ENOMEM is returned if + * there was insufficient memory available to complete the change. + */ int pmap_change_attr(vm_offset_t va, vm_size_t size, int mode) { vm_offset_t base, offset, tmpva; - pt_entry_t *pte; - u_int opte, npte; pd_entry_t *pde; + pt_entry_t *pte; + int cache_bits_pte, cache_bits_pde; boolean_t changed; base = trunc_page(va); @@ -4556,47 +4635,84 @@ pmap_change_attr(vm_offset_t va, vm_size if (base < VM_MIN_KERNEL_ADDRESS) return (EINVAL); - /* 4MB pages and pages that aren't mapped aren't supported. */ - for (tmpva = base; tmpva < (base + size); tmpva += PAGE_SIZE) { + cache_bits_pde = pmap_cache_bits(mode, 1); + cache_bits_pte = pmap_cache_bits(mode, 0); + changed = FALSE; + + /* + * Pages that aren't mapped aren't supported. Also break down + * 2/4MB pages into 4KB pages if required. + */ + PMAP_LOCK(kernel_pmap); + for (tmpva = base; tmpva < base + size; ) { pde = pmap_pde(kernel_pmap, tmpva); - if (*pde & PG_PS) - return (EINVAL); - if (*pde == 0) + if (*pde == 0) { + PMAP_UNLOCK(kernel_pmap); return (EINVAL); + } + if (*pde & PG_PS) { + /* + * If the current 2/4MB page already has + * the required memory type, then we need not + * demote this page. Just increment tmpva to + * the next 2/4MB page frame. + */ + if ((*pde & PG_PDE_CACHE) == cache_bits_pde) { + tmpva = trunc_4mpage(tmpva) + NBPDR; + continue; + } + + /* + * If the current offset aligns with a 2/4MB + * page frame and there is at least 2/4MB left + * within the range, then we need not break + * down this page into 4KB pages. + */ + if ((tmpva & PDRMASK) == 0 && + tmpva + PDRMASK < base + size) { + tmpva += NBPDR; + continue; + } + if (!pmap_demote_pde(kernel_pmap, pde, tmpva)) { + PMAP_UNLOCK(kernel_pmap); + return (ENOMEM); + } + } pte = vtopte(tmpva); - if (*pte == 0) + if (*pte == 0) { + PMAP_UNLOCK(kernel_pmap); return (EINVAL); + } + tmpva += PAGE_SIZE; } - - changed = FALSE; + PMAP_UNLOCK(kernel_pmap); /* - * Ok, all the pages exist and are 4k, so run through them updating - * their cache mode. + * Ok, all the pages exist, so run through them updating their + * cache mode if required. */ - for (tmpva = base; size > 0; ) { - pte = vtopte(tmpva); - - /* - * The cache mode bits are all in the low 32-bits of the - * PTE, so we can just spin on updating the low 32-bits. - */ - do { - opte = *(u_int *)pte; - npte = opte & ~(PG_PTE_PAT | PG_NC_PCD | PG_NC_PWT); - npte |= pmap_cache_bits(mode, 0); - } while (npte != opte && - !atomic_cmpset_int((u_int *)pte, opte, npte)); - if (npte != opte) - changed = TRUE; - tmpva += PAGE_SIZE; - size -= PAGE_SIZE; + for (tmpva = base; tmpva < base + size; ) { + pde = pmap_pde(kernel_pmap, tmpva); + if (*pde & PG_PS) { + if ((*pde & PG_PDE_CACHE) != cache_bits_pde) { + pmap_pde_attr(pde, cache_bits_pde); + changed = TRUE; + } + tmpva = trunc_4mpage(tmpva) + NBPDR; + } else { + pte = vtopte(tmpva); + if ((*pte & PG_PTE_CACHE) != cache_bits_pte) { + pmap_pte_attr(pte, cache_bits_pte); + changed = TRUE; + } + tmpva += PAGE_SIZE; + } } /* - * Flush CPU caches to make sure any data isn't cached that shouldn't - * be, etc. - */ + * Flush CPU caches to make sure any data isn't cached that + * shouldn't be, etc. + */ if (changed) { pmap_invalidate_range(kernel_pmap, base, tmpva); pmap_invalidate_cache_range(base, tmpva); Modified: stable/8/sys/i386/include/pmap.h ============================================================================== --- stable/8/sys/i386/include/pmap.h Thu Sep 3 13:40:41 2009 (r196779) +++ stable/8/sys/i386/include/pmap.h Thu Sep 3 13:54:58 2009 (r196780) @@ -81,6 +81,10 @@ #define PG_PROT (PG_RW|PG_U) /* all protection bits . */ #define PG_N (PG_NC_PWT|PG_NC_PCD) /* Non-cacheable */ +/* Page level cache control fields used to determine the PAT type */ +#define PG_PDE_CACHE (PG_PDE_PAT | PG_NC_PWT | PG_NC_PCD) +#define PG_PTE_CACHE (PG_PTE_PAT | PG_NC_PWT | PG_NC_PCD) + /* * Promotion to a 2 or 4MB (PDE) page mapping requires that the corresponding * 4KB (PTE) page mappings have identical settings for the following fields: From jhb at FreeBSD.org Thu Sep 3 13:56:19 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Thu Sep 3 13:56:26 2009 Subject: svn commit: r196781 - in stable/7/sys: . amd64/amd64 amd64/include contrib/pf i386/i386 i386/include vm Message-ID: <200909031356.n83DuJ7P034506@svn.freebsd.org> Author: jhb Date: Thu Sep 3 13:56:18 2009 New Revision: 196781 URL: http://svn.freebsd.org/changeset/base/196781 Log: MFC 180430, 180483, 180485, 180601, 180845, 180871-180873, 181043, 181077, 181151, 181284, 181356, 181456, 189454, 194209, 195416, 195836, 196318, 196705, and 196707: Various fixes and enhancements to the amd64 and i386 pmaps to support PAT. - Extend pmap_demote_pde() to include the ability to instantiate a new page table page where none existed before. - Enhance pmap_change_attr() to fully support large (2/4MB) pages by breaking demoting them to 4KB page mappings when needed. - Enhance pmap_change_attr() to avoid page demotions, cache mode changes, and cache and TLB invalidation when some or all of the specified range is already mapped with the specified cache mode. - Enhance pmap_change_attr() to adjust the direct map automatically when changing the cache mode of a kernel virtual address range. - Fix pmap_object_init_pt() to not assume that the pages of a OBJT_DEVICE object are always physically contiguous. - Correct a critical accounting error in pmap_demote_pde(). Reviewed by: alc Modified: stable/7/sys/ (props changed) stable/7/sys/amd64/amd64/pmap.c stable/7/sys/amd64/include/pmap.h stable/7/sys/contrib/pf/ (props changed) stable/7/sys/i386/i386/pmap.c stable/7/sys/i386/include/pmap.h stable/7/sys/vm/vm_object.c stable/7/sys/vm/vm_object.h Modified: stable/7/sys/amd64/amd64/pmap.c ============================================================================== --- stable/7/sys/amd64/amd64/pmap.c Thu Sep 3 13:54:58 2009 (r196780) +++ stable/7/sys/amd64/amd64/pmap.c Thu Sep 3 13:56:18 2009 (r196781) @@ -220,17 +220,22 @@ static void pmap_pvh_free(struct md_page static pv_entry_t pmap_pvh_remove(struct md_page *pvh, pmap_t pmap, vm_offset_t va); +static int pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode); static boolean_t pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va); static boolean_t pmap_enter_pde(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot); static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, vm_page_t mpte); +static void pmap_fill_ptp(pt_entry_t *firstpte, pt_entry_t newpte); static void pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte); static boolean_t pmap_is_modified_pvh(struct md_page *pvh); +static void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode); static vm_page_t pmap_lookup_pt_page(pmap_t pmap, vm_offset_t va); +static void pmap_pde_attr(pd_entry_t *pde, int cache_bits); static void pmap_promote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va); static boolean_t pmap_protect_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t sva, vm_prot_t prot); +static void pmap_pte_attr(pt_entry_t *pte, int cache_bits); static int pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offset_t sva, vm_page_t *free); static int pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, @@ -461,11 +466,12 @@ create_pagetables(vm_paddr_t *firstaddr) ((pdp_entry_t *)KPDPphys)[i + KPDPI] |= PG_RW | PG_V | PG_U; } - /* Now set up the direct map space using 2MB pages */ + /* Preset PG_M and PG_A because demotion expects it */ for (i = 0; i < NPDEPG * ndmpdp; i++) { ((pd_entry_t *)DMPDphys)[i] = (vm_paddr_t)i << PDRSHIFT; - ((pd_entry_t *)DMPDphys)[i] |= PG_RW | PG_V | PG_PS | PG_G; + ((pd_entry_t *)DMPDphys)[i] |= PG_RW | PG_V | PG_PS | PG_G | + PG_M | PG_A; } /* And the direct map space's PDP */ @@ -1068,7 +1074,7 @@ pmap_kenter(vm_offset_t va, vm_paddr_t p pte_store(pte, pa | PG_RW | PG_V | PG_G); } -PMAP_INLINE void +static __inline void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode) { pt_entry_t *pte; @@ -2192,58 +2198,98 @@ pmap_pv_insert_pde(pmap_t pmap, vm_offse } /* - * Tries to demote a 2MB page mapping. + * Fills a page table page with mappings to consecutive physical pages. + */ +static void +pmap_fill_ptp(pt_entry_t *firstpte, pt_entry_t newpte) +{ + pt_entry_t *pte; + + for (pte = firstpte; pte < firstpte + NPTEPG; pte++) { + *pte = newpte; + newpte += PAGE_SIZE; + } +} + +/* + * Tries to demote a 2MB page mapping. If demotion fails, the 2MB page + * mapping is invalidated. */ static boolean_t pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va) { pd_entry_t newpde, oldpde; - pt_entry_t *firstpte, newpte, *pte; + pt_entry_t *firstpte, newpte; vm_paddr_t mptepa; vm_page_t free, mpte; PMAP_LOCK_ASSERT(pmap, MA_OWNED); + oldpde = *pde; + KASSERT((oldpde & (PG_PS | PG_V)) == (PG_PS | PG_V), + ("pmap_demote_pde: oldpde is missing PG_PS and/or PG_V")); mpte = pmap_lookup_pt_page(pmap, va); if (mpte != NULL) pmap_remove_pt_page(pmap, mpte); else { - KASSERT((*pde & PG_W) == 0, + KASSERT((oldpde & PG_W) == 0, ("pmap_demote_pde: page table page for a wired mapping" " is missing")); - free = NULL; - pmap_remove_pde(pmap, pde, trunc_2mpage(va), &free); - pmap_invalidate_page(pmap, trunc_2mpage(va)); - pmap_free_zero_pages(free); - CTR2(KTR_PMAP, "pmap_demote_pde: failure for va %#lx" - " in pmap %p", va, pmap); - return (FALSE); + + /* + * Invalidate the 2MB page mapping and return "failure" if the + * mapping was never accessed or the allocation of the new + * page table page fails. If the 2MB page mapping belongs to + * the direct map region of the kernel's address space, then + * the page allocation request specifies the highest possible + * priority (VM_ALLOC_INTERRUPT). Otherwise, the priority is + * normal. Page table pages are preallocated for every other + * part of the kernel address space, so the direct map region + * is the only part of the kernel address space that must be + * handled here. + */ + if ((oldpde & PG_A) == 0 || (mpte = vm_page_alloc(NULL, + pmap_pde_pindex(va), (va >= DMAP_MIN_ADDRESS && va < + DMAP_MAX_ADDRESS ? VM_ALLOC_INTERRUPT : VM_ALLOC_NORMAL) | + VM_ALLOC_NOOBJ | VM_ALLOC_WIRED)) == NULL) { + free = NULL; + pmap_remove_pde(pmap, pde, trunc_2mpage(va), &free); + pmap_invalidate_page(pmap, trunc_2mpage(va)); + pmap_free_zero_pages(free); + CTR2(KTR_PMAP, "pmap_demote_pde: failure for va %#lx" + " in pmap %p", va, pmap); + return (FALSE); + } + if (va < VM_MAXUSER_ADDRESS) + pmap->pm_stats.resident_count++; } mptepa = VM_PAGE_TO_PHYS(mpte); firstpte = (pt_entry_t *)PHYS_TO_DMAP(mptepa); - oldpde = *pde; newpde = mptepa | PG_M | PG_A | (oldpde & PG_U) | PG_RW | PG_V; - KASSERT((oldpde & (PG_A | PG_V)) == (PG_A | PG_V), - ("pmap_demote_pde: oldpde is missing PG_A and/or PG_V")); + KASSERT((oldpde & PG_A) != 0, + ("pmap_demote_pde: oldpde is missing PG_A")); KASSERT((oldpde & (PG_M | PG_RW)) != PG_RW, ("pmap_demote_pde: oldpde is missing PG_M")); - KASSERT((oldpde & PG_PS) != 0, - ("pmap_demote_pde: oldpde is missing PG_PS")); newpte = oldpde & ~PG_PS; if ((newpte & PG_PDE_PAT) != 0) newpte ^= PG_PDE_PAT | PG_PTE_PAT; /* - * If the mapping has changed attributes, update the page table - * entries. + * If the page table page is new, initialize it. */ + if (mpte->wire_count == 1) { + mpte->wire_count = NPTEPG; + pmap_fill_ptp(firstpte, newpte); + } KASSERT((*firstpte & PG_FRAME) == (newpte & PG_FRAME), ("pmap_demote_pde: firstpte and newpte map different physical" " addresses")); + + /* + * If the mapping has changed attributes, update the page table + * entries. + */ if ((*firstpte & PG_PTE_PROMOTE) != (newpte & PG_PTE_PROMOTE)) - for (pte = firstpte; pte < firstpte + NPTEPG; pte++) { - *pte = newpte; - newpte += PAGE_SIZE; - } + pmap_fill_ptp(firstpte, newpte); /* * Demote the mapping. This pmap is locked. The old PDE has @@ -3310,78 +3356,74 @@ void pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, vm_object_t object, vm_pindex_t pindex, vm_size_t size) { - vm_offset_t va; + pd_entry_t *pde; + vm_paddr_t pa, ptepa; vm_page_t p, pdpg; VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); KASSERT(object->type == OBJT_DEVICE, ("pmap_object_init_pt: non-device object")); - if (((addr & (NBPDR - 1)) == 0) && ((size & (NBPDR - 1)) == 0)) { - vm_page_t m[1]; - pd_entry_t ptepa, *pde; - - PMAP_LOCK(pmap); - pde = pmap_pde(pmap, addr); - if (pde != 0 && (*pde & PG_V) != 0) - goto out; - PMAP_UNLOCK(pmap); -retry: + if ((addr & (NBPDR - 1)) == 0 && (size & (NBPDR - 1)) == 0) { + if (!vm_object_populate(object, pindex, pindex + atop(size))) + return; p = vm_page_lookup(object, pindex); - if (p != NULL) { - if (vm_page_sleep_if_busy(p, FALSE, "init4p")) - goto retry; - } else { - p = vm_page_alloc(object, pindex, VM_ALLOC_NORMAL); - if (p == NULL) - return; - m[0] = p; - - if (vm_pager_get_pages(object, m, 1, 0) != VM_PAGER_OK) { - vm_page_lock_queues(); - vm_page_free(p); - vm_page_unlock_queues(); - return; - } - - p = vm_page_lookup(object, pindex); - vm_page_wakeup(p); - } + KASSERT(p->valid == VM_PAGE_BITS_ALL, + ("pmap_object_init_pt: invalid page %p", p)); + /* + * Abort the mapping if the first page is not physically + * aligned to a 2MB page boundary. + */ ptepa = VM_PAGE_TO_PHYS(p); if (ptepa & (NBPDR - 1)) return; - p->valid = VM_PAGE_BITS_ALL; + /* + * Skip the first page. Abort the mapping if the rest of + * the pages are not physically contiguous. + */ + p = TAILQ_NEXT(p, listq); + for (pa = ptepa + PAGE_SIZE; pa < ptepa + size; + pa += PAGE_SIZE) { + KASSERT(p->valid == VM_PAGE_BITS_ALL, + ("pmap_object_init_pt: invalid page %p", p)); + if (pa != VM_PAGE_TO_PHYS(p)) + return; + p = TAILQ_NEXT(p, listq); + } + /* Map using 2MB pages. */ PMAP_LOCK(pmap); - for (va = addr; va < addr + size; va += NBPDR) { - while ((pdpg = - pmap_allocpde(pmap, va, M_NOWAIT)) == NULL) { - PMAP_UNLOCK(pmap); - vm_page_busy(p); - VM_OBJECT_UNLOCK(object); - VM_WAIT; - VM_OBJECT_LOCK(object); - vm_page_wakeup(p); - PMAP_LOCK(pmap); + for (pa = ptepa; pa < ptepa + size; pa += NBPDR) { + pdpg = pmap_allocpde(pmap, addr, M_NOWAIT); + if (pdpg == NULL) { + /* + * The creation of mappings below is only an + * optimization. If a page directory page + * cannot be allocated without blocking, + * continue on to the next mapping rather than + * blocking. + */ + addr += NBPDR; + continue; } pde = (pd_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(pdpg)); - pde = &pde[pmap_pde_index(va)]; + pde = &pde[pmap_pde_index(addr)]; if ((*pde & PG_V) == 0) { - pde_store(pde, ptepa | PG_PS | PG_M | PG_A | + pde_store(pde, pa | PG_PS | PG_M | PG_A | PG_U | PG_RW | PG_V); - pmap->pm_stats.resident_count += - NBPDR / PAGE_SIZE; + pmap->pm_stats.resident_count += NBPDR / + PAGE_SIZE; + pmap_pde_mappings++; } else { + /* Continue on if the PDE is already valid. */ pdpg->wire_count--; KASSERT(pdpg->wire_count > 0, ("pmap_object_init_pt: missing reference " - "to page directory page, va: 0x%lx", va)); + "to page directory page, va: 0x%lx", addr)); } - ptepa += NBPDR; + addr += NBPDR; } - pmap_invalidate_all(pmap); -out: PMAP_UNLOCK(pmap); } } @@ -3739,7 +3781,9 @@ pmap_remove_pages(pmap_t pmap) if ((tpte & PG_PS) != 0) pte = pde; else { - pte = vtopte(pv->pv_va); + pte = (pt_entry_t *)PHYS_TO_DMAP(tpte & + PG_FRAME); + pte = &pte[pmap_pte_index(pv->pv_va)]; tpte = *pte & ~PG_PTE_PAT; } @@ -4160,41 +4204,35 @@ pmap_clear_reference(vm_page_t m) /* Adjust the cache mode for a 4KB page mapped via a PTE. */ static __inline void -pmap_pte_attr(vm_offset_t va, int mode) +pmap_pte_attr(pt_entry_t *pte, int cache_bits) { - pt_entry_t *pte; u_int opte, npte; - pte = vtopte(va); - /* * The cache mode bits are all in the low 32-bits of the * PTE, so we can just spin on updating the low 32-bits. */ do { opte = *(u_int *)pte; - npte = opte & ~(PG_PTE_PAT | PG_NC_PCD | PG_NC_PWT); - npte |= pmap_cache_bits(mode, 0); + npte = opte & ~PG_PTE_CACHE; + npte |= cache_bits; } while (npte != opte && !atomic_cmpset_int((u_int *)pte, opte, npte)); } /* Adjust the cache mode for a 2MB page mapped via a PDE. */ static __inline void -pmap_pde_attr(vm_offset_t va, int mode) +pmap_pde_attr(pd_entry_t *pde, int cache_bits) { - pd_entry_t *pde; u_int opde, npde; - pde = pmap_pde(kernel_pmap, va); - /* * The cache mode bits are all in the low 32-bits of the * PDE, so we can just spin on updating the low 32-bits. */ do { opde = *(u_int *)pde; - npde = opde & ~(PG_PDE_PAT | PG_NC_PCD | PG_NC_PWT); - npde |= pmap_cache_bits(mode, 1); + npde = opde & ~PG_PDE_CACHE; + npde |= cache_bits; } while (npde != opde && !atomic_cmpset_int((u_int *)pde, opde, npde)); } @@ -4210,11 +4248,14 @@ pmap_mapdev_attr(vm_paddr_t pa, vm_size_ vm_offset_t va, tmpva, offset; /* - * If this fits within the direct map window and use WB caching - * mode, use the direct map. + * If the specified range of physical addresses fits within the direct + * map window, use the direct map. */ - if (pa < dmaplimit && (pa + size) < dmaplimit && mode == PAT_WRITE_BACK) - return ((void *)PHYS_TO_DMAP(pa)); + if (pa < dmaplimit && pa + size < dmaplimit) { + va = PHYS_TO_DMAP(pa); + if (!pmap_change_attr(va, size, mode)) + return ((void *)va); + } offset = pa & PAGE_MASK; size = roundup(offset + size, PAGE_SIZE); va = kmem_alloc_nofault(kernel_map, size); @@ -4263,68 +4304,174 @@ pmap_unmapdev(vm_offset_t va, vm_size_t kmem_free(kernel_map, base, size); } +/* + * Changes the specified virtual address range's memory type to that given by + * the parameter "mode". The specified virtual address range must be + * completely contained within either the direct map or the kernel map. If + * the virtual address range is contained within the kernel map, then the + * memory type for each of the corresponding ranges of the direct map is also + * changed. (The corresponding ranges of the direct map are those ranges that + * map the same physical pages as the specified virtual address range.) These + * changes to the direct map are necessary because Intel describes the + * behavior of their processors as "undefined" if two or more mappings to the + * same physical page have different memory types. + * + * Returns zero if the change completed successfully, and either EINVAL or + * ENOMEM if the change failed. Specifically, EINVAL is returned if some part + * of the virtual address range was not mapped, and ENOMEM is returned if + * there was insufficient memory available to complete the change. In the + * latter case, the memory type may have been changed on some part of the + * virtual address range or the direct map. + */ int pmap_change_attr(vm_offset_t va, vm_size_t size, int mode) { + int error; + + PMAP_LOCK(kernel_pmap); + error = pmap_change_attr_locked(va, size, mode); + PMAP_UNLOCK(kernel_pmap); + return (error); +} + +static int +pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode) +{ vm_offset_t base, offset, tmpva; + vm_paddr_t pa_start, pa_end; pd_entry_t *pde; pt_entry_t *pte; + int cache_bits_pte, cache_bits_pde, error; + boolean_t changed; + PMAP_LOCK_ASSERT(kernel_pmap, MA_OWNED); base = trunc_page(va); offset = va & PAGE_MASK; size = roundup(offset + size, PAGE_SIZE); - /* Only supported on kernel virtual addresses. */ - if (base <= VM_MAXUSER_ADDRESS) + /* + * Only supported on kernel virtual addresses, including the direct + * map but excluding the recursive map. + */ + if (base < DMAP_MIN_ADDRESS) return (EINVAL); + cache_bits_pde = pmap_cache_bits(mode, 1); + cache_bits_pte = pmap_cache_bits(mode, 0); + changed = FALSE; + /* - * XXX: We have to support tearing 2MB pages down into 4k pages if - * needed here. + * Pages that aren't mapped aren't supported. Also break down 2MB pages + * into 4KB pages if required. */ - /* Pages that aren't mapped aren't supported. */ - for (tmpva = base; tmpva < (base + size); ) { + for (tmpva = base; tmpva < base + size; ) { pde = pmap_pde(kernel_pmap, tmpva); if (*pde == 0) return (EINVAL); if (*pde & PG_PS) { - /* Handle 2MB pages that are completely contained. */ - if (size >= NBPDR) { + /* + * If the current 2MB page already has the required + * memory type, then we need not demote this page. Just + * increment tmpva to the next 2MB page frame. + */ + if ((*pde & PG_PDE_CACHE) == cache_bits_pde) { + tmpva = trunc_2mpage(tmpva) + NBPDR; + continue; + } + + /* + * If the current offset aligns with a 2MB page frame + * and there is at least 2MB left within the range, then + * we need not break down this page into 4KB pages. + */ + if ((tmpva & PDRMASK) == 0 && + tmpva + PDRMASK < base + size) { tmpva += NBPDR; continue; } - return (EINVAL); + if (!pmap_demote_pde(kernel_pmap, pde, tmpva)) + return (ENOMEM); } - pte = vtopte(va); + pte = pmap_pde_to_pte(pde, tmpva); if (*pte == 0) return (EINVAL); tmpva += PAGE_SIZE; } + error = 0; /* * Ok, all the pages exist, so run through them updating their - * cache mode. + * cache mode if required. */ - for (tmpva = base; size > 0; ) { + pa_start = pa_end = 0; + for (tmpva = base; tmpva < base + size; ) { pde = pmap_pde(kernel_pmap, tmpva); if (*pde & PG_PS) { - pmap_pde_attr(tmpva, mode); - tmpva += NBPDR; - size -= NBPDR; + if ((*pde & PG_PDE_CACHE) != cache_bits_pde) { + pmap_pde_attr(pde, cache_bits_pde); + changed = TRUE; + } + if (tmpva >= VM_MIN_KERNEL_ADDRESS) { + if (pa_start == pa_end) { + /* Start physical address run. */ + pa_start = *pde & PG_PS_FRAME; + pa_end = pa_start + NBPDR; + } else if (pa_end == (*pde & PG_PS_FRAME)) + pa_end += NBPDR; + else { + /* Run ended, update direct map. */ + error = pmap_change_attr_locked( + PHYS_TO_DMAP(pa_start), + pa_end - pa_start, mode); + if (error != 0) + break; + /* Start physical address run. */ + pa_start = *pde & PG_PS_FRAME; + pa_end = pa_start + NBPDR; + } + } + tmpva = trunc_2mpage(tmpva) + NBPDR; } else { - pmap_pte_attr(tmpva, mode); + pte = pmap_pde_to_pte(pde, tmpva); + if ((*pte & PG_PTE_CACHE) != cache_bits_pte) { + pmap_pte_attr(pte, cache_bits_pte); + changed = TRUE; + } + if (tmpva >= VM_MIN_KERNEL_ADDRESS) { + if (pa_start == pa_end) { + /* Start physical address run. */ + pa_start = *pte & PG_FRAME; + pa_end = pa_start + PAGE_SIZE; + } else if (pa_end == (*pte & PG_FRAME)) + pa_end += PAGE_SIZE; + else { + /* Run ended, update direct map. */ + error = pmap_change_attr_locked( + PHYS_TO_DMAP(pa_start), + pa_end - pa_start, mode); + if (error != 0) + break; + /* Start physical address run. */ + pa_start = *pte & PG_FRAME; + pa_end = pa_start + PAGE_SIZE; + } + } tmpva += PAGE_SIZE; - size -= PAGE_SIZE; } } + if (error == 0 && pa_start != pa_end) + error = pmap_change_attr_locked(PHYS_TO_DMAP(pa_start), + pa_end - pa_start, mode); /* - * Flush CPU caches to make sure any data isn't cached that shouldn't - * be, etc. - */ - pmap_invalidate_range(kernel_pmap, base, tmpva); - pmap_invalidate_cache(); - return (0); + * Flush CPU caches if required to make sure any data isn't cached that + * shouldn't be, etc. + */ + if (changed) { + pmap_invalidate_range(kernel_pmap, base, tmpva); + pmap_invalidate_cache(); + } + return (error); } /* Modified: stable/7/sys/amd64/include/pmap.h ============================================================================== --- stable/7/sys/amd64/include/pmap.h Thu Sep 3 13:54:58 2009 (r196780) +++ stable/7/sys/amd64/include/pmap.h Thu Sep 3 13:56:18 2009 (r196781) @@ -75,6 +75,10 @@ #define PG_PROT (PG_RW|PG_U) /* all protection bits . */ #define PG_N (PG_NC_PWT|PG_NC_PCD) /* Non-cacheable */ +/* Page level cache control fields used to determine the PAT type */ +#define PG_PDE_CACHE (PG_PDE_PAT | PG_NC_PWT | PG_NC_PCD) +#define PG_PTE_CACHE (PG_PTE_PAT | PG_NC_PWT | PG_NC_PCD) + /* * Promotion to a 2MB (PDE) page mapping requires that the corresponding 4KB * (PTE) page mappings have identical settings for the following fields: @@ -308,7 +312,6 @@ void pmap_bootstrap(vm_paddr_t *); int pmap_change_attr(vm_offset_t, vm_size_t, int); void pmap_init_pat(void); void pmap_kenter(vm_offset_t va, vm_paddr_t pa); -void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode); void *pmap_kenter_temporary(vm_paddr_t pa, int i); vm_paddr_t pmap_kextract(vm_offset_t); void pmap_kremove(vm_offset_t); Modified: stable/7/sys/i386/i386/pmap.c ============================================================================== --- stable/7/sys/i386/i386/pmap.c Thu Sep 3 13:54:58 2009 (r196780) +++ stable/7/sys/i386/i386/pmap.c Thu Sep 3 13:56:18 2009 (r196781) @@ -284,11 +284,15 @@ static boolean_t pmap_enter_pde(pmap_t p static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, vm_page_t mpte); static void pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte); +static void pmap_fill_ptp(pt_entry_t *firstpte, pt_entry_t newpte); static boolean_t pmap_is_modified_pvh(struct md_page *pvh); +static void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode); static vm_page_t pmap_lookup_pt_page(pmap_t pmap, vm_offset_t va); +static void pmap_pde_attr(pd_entry_t *pde, int cache_bits); static void pmap_promote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va); static boolean_t pmap_protect_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t sva, vm_prot_t prot); +static void pmap_pte_attr(pt_entry_t *pte, int cache_bits); static void pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offset_t sva, vm_page_t *free); static int pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, vm_offset_t sva, @@ -1132,7 +1136,7 @@ pmap_kenter(vm_offset_t va, vm_paddr_t p pte_store(pte, pa | PG_RW | PG_V | pgeflag); } -PMAP_INLINE void +static __inline void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode) { pt_entry_t *pte; @@ -2245,32 +2249,62 @@ pmap_pv_insert_pde(pmap_t pmap, vm_offse } /* - * Tries to demote a 2- or 4MB page mapping. + * Fills a page table page with mappings to consecutive physical pages. + */ +static void +pmap_fill_ptp(pt_entry_t *firstpte, pt_entry_t newpte) +{ + pt_entry_t *pte; + + for (pte = firstpte; pte < firstpte + NPTEPG; pte++) { + *pte = newpte; + newpte += PAGE_SIZE; + } +} + +/* + * Tries to demote a 2- or 4MB page mapping. If demotion fails, the + * 2- or 4MB page mapping is invalidated. */ static boolean_t pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va) { pd_entry_t newpde, oldpde; pmap_t allpmaps_entry; - pt_entry_t *firstpte, newpte, *pte; + pt_entry_t *firstpte, newpte; vm_paddr_t mptepa; vm_page_t free, mpte; PMAP_LOCK_ASSERT(pmap, MA_OWNED); + oldpde = *pde; + KASSERT((oldpde & (PG_PS | PG_V)) == (PG_PS | PG_V), + ("pmap_demote_pde: oldpde is missing PG_PS and/or PG_V")); mpte = pmap_lookup_pt_page(pmap, va); if (mpte != NULL) pmap_remove_pt_page(pmap, mpte); else { - KASSERT((*pde & PG_W) == 0, + KASSERT((oldpde & PG_W) == 0, ("pmap_demote_pde: page table page for a wired mapping" " is missing")); - free = NULL; - pmap_remove_pde(pmap, pde, trunc_4mpage(va), &free); - pmap_invalidate_page(pmap, trunc_4mpage(va)); - pmap_free_zero_pages(free); - CTR2(KTR_PMAP, "pmap_demote_pde: failure for va %#x" - " in pmap %p", va, pmap); - return (FALSE); + + /* + * Invalidate the 2- or 4MB page mapping and return + * "failure" if the mapping was never accessed or the + * allocation of the new page table page fails. + */ + if ((oldpde & PG_A) == 0 || (mpte = vm_page_alloc(NULL, + va >> PDRSHIFT, VM_ALLOC_NOOBJ | VM_ALLOC_NORMAL | + VM_ALLOC_WIRED)) == NULL) { + free = NULL; + pmap_remove_pde(pmap, pde, trunc_4mpage(va), &free); + pmap_invalidate_page(pmap, trunc_4mpage(va)); + pmap_free_zero_pages(free); + CTR2(KTR_PMAP, "pmap_demote_pde: failure for va %#x" + " in pmap %p", va, pmap); + return (FALSE); + } + if (va < VM_MAXUSER_ADDRESS) + pmap->pm_stats.resident_count++; } mptepa = VM_PAGE_TO_PHYS(mpte); @@ -2304,30 +2338,32 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t } firstpte = PADDR2; } - oldpde = *pde; newpde = mptepa | PG_M | PG_A | (oldpde & PG_U) | PG_RW | PG_V; - KASSERT((oldpde & (PG_A | PG_V)) == (PG_A | PG_V), - ("pmap_demote_pde: oldpde is missing PG_A and/or PG_V")); + KASSERT((oldpde & PG_A) != 0, + ("pmap_demote_pde: oldpde is missing PG_A")); KASSERT((oldpde & (PG_M | PG_RW)) != PG_RW, ("pmap_demote_pde: oldpde is missing PG_M")); - KASSERT((oldpde & PG_PS) != 0, - ("pmap_demote_pde: oldpde is missing PG_PS")); newpte = oldpde & ~PG_PS; if ((newpte & PG_PDE_PAT) != 0) newpte ^= PG_PDE_PAT | PG_PTE_PAT; /* - * If the mapping has changed attributes, update the page table - * entries. - */ + * If the page table page is new, initialize it. + */ + if (mpte->wire_count == 1) { + mpte->wire_count = NPTEPG; + pmap_fill_ptp(firstpte, newpte); + } KASSERT((*firstpte & PG_FRAME) == (newpte & PG_FRAME), ("pmap_demote_pde: firstpte and newpte map different physical" " addresses")); + + /* + * If the mapping has changed attributes, update the page table + * entries. + */ if ((*firstpte & PG_PTE_PROMOTE) != (newpte & PG_PTE_PROMOTE)) - for (pte = firstpte; pte < firstpte + NPTEPG; pte++) { - *pte = newpte; - newpte += PAGE_SIZE; - } + pmap_fill_ptp(firstpte, newpte); /* * Demote the mapping. This pmap is locked. The old PDE has @@ -3432,62 +3468,57 @@ void pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, vm_object_t object, vm_pindex_t pindex, vm_size_t size) { + pd_entry_t *pde; + vm_paddr_t pa, ptepa; vm_page_t p; VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); KASSERT(object->type == OBJT_DEVICE, ("pmap_object_init_pt: non-device object")); if (pseflag && - ((addr & (NBPDR - 1)) == 0) && ((size & (NBPDR - 1)) == 0)) { - int i; - vm_page_t m[1]; - unsigned int ptepindex; - int npdes; - pd_entry_t ptepa; - - PMAP_LOCK(pmap); - if (pmap->pm_pdir[ptepindex = (addr >> PDRSHIFT)]) - goto out; - PMAP_UNLOCK(pmap); -retry: + (addr & (NBPDR - 1)) == 0 && (size & (NBPDR - 1)) == 0) { + if (!vm_object_populate(object, pindex, pindex + atop(size))) + return; p = vm_page_lookup(object, pindex); - if (p != NULL) { - if (vm_page_sleep_if_busy(p, FALSE, "init4p")) - goto retry; - } else { - p = vm_page_alloc(object, pindex, VM_ALLOC_NORMAL); - if (p == NULL) - return; - m[0] = p; - - if (vm_pager_get_pages(object, m, 1, 0) != VM_PAGER_OK) { - vm_page_lock_queues(); - vm_page_free(p); - vm_page_unlock_queues(); - return; - } - - p = vm_page_lookup(object, pindex); - vm_page_wakeup(p); - } + KASSERT(p->valid == VM_PAGE_BITS_ALL, + ("pmap_object_init_pt: invalid page %p", p)); + /* + * Abort the mapping if the first page is not physically + * aligned to a 2/4MB page boundary. + */ ptepa = VM_PAGE_TO_PHYS(p); if (ptepa & (NBPDR - 1)) return; - p->valid = VM_PAGE_BITS_ALL; + /* + * Skip the first page. Abort the mapping if the rest of + * the pages are not physically contiguous. + */ + p = TAILQ_NEXT(p, listq); + for (pa = ptepa + PAGE_SIZE; pa < ptepa + size; + pa += PAGE_SIZE) { + KASSERT(p->valid == VM_PAGE_BITS_ALL, + ("pmap_object_init_pt: invalid page %p", p)); + if (pa != VM_PAGE_TO_PHYS(p)) + return; + p = TAILQ_NEXT(p, listq); + } + /* Map using 2/4MB pages. */ PMAP_LOCK(pmap); - pmap->pm_stats.resident_count += size >> PAGE_SHIFT; - npdes = size >> PDRSHIFT; - for(i = 0; i < npdes; i++) { - pde_store(&pmap->pm_pdir[ptepindex], - ptepa | PG_U | PG_RW | PG_V | PG_PS); - ptepa += NBPDR; - ptepindex += 1; + for (pa = ptepa; pa < ptepa + size; pa += NBPDR) { + pde = pmap_pde(pmap, addr); + if (*pde == 0) { + pde_store(pde, pa | PG_PS | PG_M | PG_A | + PG_U | PG_RW | PG_V); + pmap->pm_stats.resident_count += NBPDR / + PAGE_SIZE; + pmap_pde_mappings++; + } + /* Else continue on if the PDE is already valid. */ + addr += NBPDR; } - pmap_invalidate_all(pmap); -out: PMAP_UNLOCK(pmap); } } @@ -4326,6 +4357,40 @@ pmap_clear_reference(vm_page_t m) * Miscellaneous support routines follow */ +/* Adjust the cache mode for a 4KB page mapped via a PTE. */ +static __inline void +pmap_pte_attr(pt_entry_t *pte, int cache_bits) +{ + u_int opte, npte; + + /* + * The cache mode bits are all in the low 32-bits of the + * PTE, so we can just spin on updating the low 32-bits. + */ + do { + opte = *(u_int *)pte; + npte = opte & ~PG_PTE_CACHE; + npte |= cache_bits; + } while (npte != opte && !atomic_cmpset_int((u_int *)pte, opte, npte)); +} + +/* Adjust the cache mode for a 2/4MB page mapped via a PDE. */ +static __inline void +pmap_pde_attr(pd_entry_t *pde, int cache_bits) +{ + u_int opde, npde; + + /* + * The cache mode bits are all in the low 32-bits of the + * PDE, so we can just spin on updating the low 32-bits. + */ + do { + opde = *(u_int *)pde; + npde = opde & ~PG_PDE_CACHE; + npde |= cache_bits; + } while (npde != opde && !atomic_cmpset_int((u_int *)pde, opde, npde)); +} + /* * Map a set of physical memory pages into the kernel virtual * address space. Return a pointer to where it is mapped. This @@ -4389,61 +4454,117 @@ pmap_unmapdev(vm_offset_t va, vm_size_t kmem_free(kernel_map, base, size); } +/* + * Changes the specified virtual address range's memory type to that given by + * the parameter "mode". The specified virtual address range must be + * completely contained within either the kernel map. + * + * Returns zero if the change completed successfully, and either EINVAL or + * ENOMEM if the change failed. Specifically, EINVAL is returned if some part + * of the virtual address range was not mapped, and ENOMEM is returned if + * there was insufficient memory available to complete the change. + */ int pmap_change_attr(vm_offset_t va, vm_size_t size, int mode) { vm_offset_t base, offset, tmpva; - pt_entry_t *pte; - u_int opte, npte; pd_entry_t *pde; + pt_entry_t *pte; + int cache_bits_pte, cache_bits_pde; + boolean_t changed; base = trunc_page(va); offset = va & PAGE_MASK; size = roundup(offset + size, PAGE_SIZE); - /* Only supported on kernel virtual addresses. */ - if (base <= VM_MAXUSER_ADDRESS) + /* + * Only supported on kernel virtual addresses above the recursive map. + */ + if (base < VM_MIN_KERNEL_ADDRESS) return (EINVAL); - /* 4MB pages and pages that aren't mapped aren't supported. */ - for (tmpva = base; tmpva < (base + size); tmpva += PAGE_SIZE) { + cache_bits_pde = pmap_cache_bits(mode, 1); + cache_bits_pte = pmap_cache_bits(mode, 0); + changed = FALSE; + + /* + * Pages that aren't mapped aren't supported. Also break down + * 2/4MB pages into 4KB pages if required. + */ + PMAP_LOCK(kernel_pmap); + for (tmpva = base; tmpva < base + size; ) { pde = pmap_pde(kernel_pmap, tmpva); - if (*pde & PG_PS) - return (EINVAL); - if (*pde == 0) + if (*pde == 0) { + PMAP_UNLOCK(kernel_pmap); return (EINVAL); - pte = vtopte(va); - if (*pte == 0) + } + if (*pde & PG_PS) { + /* + * If the current 2/4MB page already has + * the required memory type, then we need not + * demote this page. Just increment tmpva to + * the next 2/4MB page frame. + */ + if ((*pde & PG_PDE_CACHE) == cache_bits_pde) { + tmpva = trunc_4mpage(tmpva) + NBPDR; + continue; + } + + /* + * If the current offset aligns with a 2/4MB + * page frame and there is at least 2/4MB left + * within the range, then we need not break + * down this page into 4KB pages. + */ + if ((tmpva & PDRMASK) == 0 && + tmpva + PDRMASK < base + size) { + tmpva += NBPDR; + continue; + } + if (!pmap_demote_pde(kernel_pmap, pde, tmpva)) { + PMAP_UNLOCK(kernel_pmap); + return (ENOMEM); + } + } + pte = vtopte(tmpva); + if (*pte == 0) { + PMAP_UNLOCK(kernel_pmap); return (EINVAL); + } + tmpva += PAGE_SIZE; } + PMAP_UNLOCK(kernel_pmap); /* - * Ok, all the pages exist and are 4k, so run through them updating - * their cache mode. + * Ok, all the pages exist, so run through them updating their + * cache mode if required. */ - for (tmpva = base; size > 0; ) { - pte = vtopte(tmpva); - - /* - * The cache mode bits are all in the low 32-bits of the - * PTE, so we can just spin on updating the low 32-bits. - */ - do { - opte = *(u_int *)pte; - npte = opte & ~(PG_PTE_PAT | PG_NC_PCD | PG_NC_PWT); - npte |= pmap_cache_bits(mode, 0); - } while (npte != opte && - !atomic_cmpset_int((u_int *)pte, opte, npte)); - tmpva += PAGE_SIZE; - size -= PAGE_SIZE; + for (tmpva = base; tmpva < base + size; ) { + pde = pmap_pde(kernel_pmap, tmpva); + if (*pde & PG_PS) { + if ((*pde & PG_PDE_CACHE) != cache_bits_pde) { + pmap_pde_attr(pde, cache_bits_pde); + changed = TRUE; + } + tmpva = trunc_4mpage(tmpva) + NBPDR; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From joerg at britannica.bec.de Thu Sep 3 14:04:27 2009 From: joerg at britannica.bec.de (Joerg Sonnenberger) Date: Thu Sep 3 14:04:33 2009 Subject: svn commit: r196752 - head/lib/libc/stdtime In-Reply-To: <86vdk0upmh.fsf@ds4.des.no> References: <200909020456.n824uUqQ082136@svn.freebsd.org> <20090902070808.GA1290@arthur.nitro.dk> <20090902084002.GA17325@nagual.pp.ru> <867hwgcwvo.fsf@ds4.des.no> <20090903084325.GA65192@nagual.pp.ru> <86zl9c9z05.fsf@ds4.des.no> <20090903115416.GB448@britannica.bec.de> <86vdk0upmh.fsf@ds4.des.no> Message-ID: <20090903140346.GA11785@britannica.bec.de> On Thu, Sep 03, 2009 at 03:25:26PM +0200, Dag-Erling Sm?rgrav wrote: > > This is actually not good enough. ISO C doesn't specify whether plain > > char is signed or unsigned. > > This is FreeBSD. Our char is signed. On systems where it isn't (IRIX > is the only one I know of), the cast is a no-op. GCC's default for ARM is unsigned. Just to name the most popular platform. I don't know if FreeBSD has local patches, but I expect a non-trivial amount of code is ported from/to ARM systems as well. > > > Also, isascii is the only exception to this rule, so the change for that > > is wrong. > > No. The fact that isascii() accidentally returns the correct answer > even in the absence of a cast is irrelevant. Passing a signed char to > isascii() invokes undefined behavior. To quote SUS: The isascii() function shall return non-zero if c is a 7-bit US-ASCII character code between 0 and octal 0177 inclusive; otherwise, it shall return 0. Joerg From scottl at samsco.org Thu Sep 3 14:22:14 2009 From: scottl at samsco.org (Scott Long) Date: Thu Sep 3 14:22:25 2009 Subject: svn commit: r196777 - head/sys/dev/ahci In-Reply-To: <200909031237.n83CbIgk032551@svn.freebsd.org> References: <200909031237.n83CbIgk032551@svn.freebsd.org> Message-ID: <1872D962-9297-4C45-9F73-4BB823C49D74@samsco.org> In this case, set maxio to 64k, not 127.5k. You'll typically get much better i/o performance out of two 64k transfers than you will out of one 127.k transfer and one 512 bytes transfer, which is what the block layer will give you if you try to send 128k. Scott On Sep 3, 2009, at 6:37 AM, Alexander Motin wrote: > Author: mav > Date: Thu Sep 3 12:37:17 2009 > New Revision: 196777 > URL: http://svn.freebsd.org/changeset/base/196777 > > Log: > ATI SB600 can't handle 256 sectors transfers with FPDMA (NCQ). > > MFC after: 3 days > > Modified: > head/sys/dev/ahci/ahci.c > > Modified: head/sys/dev/ahci/ahci.c > = > = > = > = > = > = > = > = > ====================================================================== > --- head/sys/dev/ahci/ahci.c Thu Sep 3 10:06:37 2009 (r196776) > +++ head/sys/dev/ahci/ahci.c Thu Sep 3 12:37:17 2009 (r196777) > @@ -1942,6 +1942,9 @@ ahciaction(struct cam_sim *sim, union cc > cpi->protocol = PROTO_ATA; > cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; > cpi->maxio = MAXPHYS; > + /* ATI SB600 can't handle 256 sectors with FPDMA (NCQ). */ > + if (pci_get_devid(device_get_parent(dev)) == 0x43801002) > + cpi->maxio = min(cpi->maxio, 255 * 512); > cpi->ccb_h.status = CAM_REQ_CMP; > xpt_done(ccb); > break; From jhb at FreeBSD.org Thu Sep 3 14:23:51 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Thu Sep 3 14:24:10 2009 Subject: svn commit: r196782 - in stable/7/sys: . contrib/pf kern sys vm Message-ID: <200909031423.n83ENpUW035318@svn.freebsd.org> Author: jhb Date: Thu Sep 3 14:23:50 2009 New Revision: 196782 URL: http://svn.freebsd.org/changeset/base/196782 Log: MFC 193275 and 194989: Add an extension to the character device interface that allows character device drivers to use arbitrary VM objects to satisfy individual mmap() requests. - A new d_mmap_single(cdev, &foff, objsize, &object, prot) callback is added to cdevsw. This function is called for each mmap() request. If it returns ENODEV, then the mmap() request will fall back to using the device's device pager object and d_mmap(). Otherwise, the method can return a VM object to satisfy this entire mmap() request via *object. It can also modify the starting offset into this object via *foff. This allows device drivers to use the file offset as a cookie to identify specific VM objects. - vm_mmap_vnode() has been changed to call vm_mmap_cdev() directly when mapping V_CHR vnodes. This avoids duplicating all the cdev mmap handling code and simplifies some of vm_mmap_vnode(). - D_VERSION has been bumped to D_VERSION_02. Older device drivers using D_VERSION_01 are still supported. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/kern/kern_conf.c stable/7/sys/sys/conf.h stable/7/sys/vm/vm_mmap.c Modified: stable/7/sys/kern/kern_conf.c ============================================================================== --- stable/7/sys/kern/kern_conf.c Thu Sep 3 13:56:18 2009 (r196781) +++ stable/7/sys/kern/kern_conf.c Thu Sep 3 14:23:50 2009 (r196782) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include static MALLOC_DEFINE(M_DEVT, "cdev", "cdev storage"); @@ -276,6 +277,7 @@ dead_strategy(struct bio *bp) #define dead_dump (dumper_t *)enxio #define dead_kqfilter (d_kqfilter_t *)enxio +#define dead_mmap_single (d_mmap_single_t *)enodev static struct cdevsw dead_cdevsw = { .d_version = D_VERSION, @@ -290,7 +292,8 @@ static struct cdevsw dead_cdevsw = { .d_strategy = dead_strategy, .d_name = "dead", .d_dump = dead_dump, - .d_kqfilter = dead_kqfilter + .d_kqfilter = dead_kqfilter, + .d_mmap_single = dead_mmap_single }; /* Default methods if driver does not specify method */ @@ -302,6 +305,7 @@ static struct cdevsw dead_cdevsw = { #define no_ioctl (d_ioctl_t *)enodev #define no_mmap (d_mmap_t *)enodev #define no_kqfilter (d_kqfilter_t *)enodev +#define no_mmap_single (d_mmap_single_t *)enodev static void no_strategy(struct bio *bp) @@ -481,6 +485,23 @@ giant_mmap(struct cdev *dev, vm_offset_t return (retval); } +static int +giant_mmap_single(struct cdev *dev, vm_ooffset_t *offset, vm_size_t size, + vm_object_t *object, int nprot) +{ + struct cdevsw *dsw; + int retval; + + dsw = dev_refthread(dev); + if (dsw == NULL) + return (ENXIO); + mtx_lock(&Giant); + retval = dsw->d_gianttrick->d_mmap_single(dev, offset, size, object, + nprot); + mtx_unlock(&Giant); + dev_relthread(dev); + return (retval); +} /* * struct cdev * and u_dev_t primitives @@ -616,7 +637,8 @@ prep_cdevsw(struct cdevsw *devsw) return; } - if (devsw->d_version != D_VERSION_01) { + if (devsw->d_version != D_VERSION_01 && + devsw->d_version != D_VERSION_02) { printf( "WARNING: Device driver \"%s\" has wrong version %s\n", devsw->d_name == NULL ? "???" : devsw->d_name, @@ -632,6 +654,8 @@ prep_cdevsw(struct cdevsw *devsw) devsw->d_dump = dead_dump; devsw->d_kqfilter = dead_kqfilter; } + if (devsw->d_version == D_VERSION_01) + devsw->d_mmap_single = NULL; if (devsw->d_flags & D_TTY) { if (devsw->d_ioctl == NULL) devsw->d_ioctl = ttyioctl; @@ -668,6 +692,7 @@ prep_cdevsw(struct cdevsw *devsw) FIXUP(d_mmap, no_mmap, giant_mmap); FIXUP(d_strategy, no_strategy, giant_strategy); FIXUP(d_kqfilter, no_kqfilter, giant_kqfilter); + FIXUP(d_mmap_single, no_mmap_single, giant_mmap_single); if (devsw->d_dump == NULL) devsw->d_dump = no_dump; Modified: stable/7/sys/sys/conf.h ============================================================================== --- stable/7/sys/sys/conf.h Thu Sep 3 13:56:18 2009 (r196781) +++ stable/7/sys/sys/conf.h Thu Sep 3 14:23:50 2009 (r196782) @@ -106,6 +106,7 @@ struct thread; struct uio; struct knote; struct clonedevs; +struct vm_object; struct vnode; /* @@ -139,10 +140,10 @@ typedef int d_poll_t(struct cdev *dev, i typedef int d_kqfilter_t(struct cdev *dev, struct knote *kn); typedef int d_mmap_t(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot); +typedef int d_mmap_single_t(struct cdev *cdev, vm_ooffset_t *offset, + vm_size_t size, struct vm_object **object, int nprot); typedef void d_purge_t(struct cdev *dev); -typedef int d_spare2_t(struct cdev *dev); - typedef int dumper_t( void *priv, /* Private to the driver. */ void *virtual, /* Virtual (mapped) address. */ @@ -177,7 +178,8 @@ typedef int dumper_t( */ #define D_VERSION_00 0x20011966 #define D_VERSION_01 0x17032005 /* Add d_uid,gid,mode & kind */ -#define D_VERSION D_VERSION_01 +#define D_VERSION_02 0x28042009 /* Add d_mmap_single */ +#define D_VERSION D_VERSION_02 /* * Flags used for internal housekeeping @@ -203,7 +205,7 @@ struct cdevsw { dumper_t *d_dump; d_kqfilter_t *d_kqfilter; d_purge_t *d_purge; - d_spare2_t *d_spare2; + d_mmap_single_t *d_mmap_single; uid_t d_uid; gid_t d_gid; mode_t d_mode; Modified: stable/7/sys/vm/vm_mmap.c ============================================================================== --- stable/7/sys/vm/vm_mmap.c Thu Sep 3 13:56:18 2009 (r196781) +++ stable/7/sys/vm/vm_mmap.c Thu Sep 3 14:23:50 2009 (r196782) @@ -116,9 +116,9 @@ vmmapentry_rsrc_init(dummy) } static int vm_mmap_vnode(struct thread *, vm_size_t, vm_prot_t, vm_prot_t *, - int *, struct vnode *, vm_ooffset_t, vm_object_t *); + int *, struct vnode *, vm_ooffset_t *, vm_object_t *); static int vm_mmap_cdev(struct thread *, vm_size_t, vm_prot_t, vm_prot_t *, - int *, struct cdev *, vm_ooffset_t, vm_object_t *); + int *, struct cdev *, vm_ooffset_t *, vm_object_t *); /* * MPSAFE @@ -1132,14 +1132,13 @@ munlock(td, uap) int vm_mmap_vnode(struct thread *td, vm_size_t objsize, vm_prot_t prot, vm_prot_t *maxprotp, int *flagsp, - struct vnode *vp, vm_ooffset_t foff, vm_object_t *objp) + struct vnode *vp, vm_ooffset_t *foffp, vm_object_t *objp) { struct vattr va; - void *handle; vm_object_t obj; + vm_offset_t foff; struct mount *mp; - struct cdevsw *dsw; - int error, flags, type; + int error, flags; int vfslocked; mp = vp->v_mount; @@ -1148,6 +1147,7 @@ vm_mmap_vnode(struct thread *td, vm_size VFS_UNLOCK_GIANT(vfslocked); return (error); } + foff = *foffp; flags = *flagsp; obj = vp->v_object; if (vp->v_type == VREG) { @@ -1163,41 +1163,12 @@ vm_mmap_vnode(struct thread *td, vm_size vp = (struct vnode*)obj->handle; vget(vp, LK_EXCLUSIVE, td); } - type = OBJT_VNODE; - handle = vp; } else if (vp->v_type == VCHR) { - type = OBJT_DEVICE; - handle = vp->v_rdev; - - dsw = dev_refthread(handle); - if (dsw == NULL) { - error = ENXIO; - goto done; - } - if (dsw->d_flags & D_MMAP_ANON) { - dev_relthread(handle); - *maxprotp = VM_PROT_ALL; - *flagsp |= MAP_ANON; - error = 0; - goto done; - } - dev_relthread(handle); - /* - * cdevs does not provide private mappings of any kind. - */ - if ((*maxprotp & VM_PROT_WRITE) == 0 && - (prot & PROT_WRITE) != 0) { - error = EACCES; - goto done; - } - if (flags & (MAP_PRIVATE|MAP_COPY)) { - error = EINVAL; - goto done; - } - /* - * Force device mappings to be shared. - */ - flags |= MAP_SHARED; + error = vm_mmap_cdev(td, objsize, prot, maxprotp, flagsp, + vp->v_rdev, foffp, objp); + if (error == 0) + goto mark_atime; + goto done; } else { error = EINVAL; goto done; @@ -1224,18 +1195,18 @@ vm_mmap_vnode(struct thread *td, vm_size * we do not need to sync it. * Adjust object size to be the size of actual file. */ - if (vp->v_type == VREG) { - objsize = round_page(va.va_size); - if (va.va_nlink == 0) - flags |= MAP_NOSYNC; - } - obj = vm_pager_allocate(type, handle, objsize, prot, foff); + objsize = round_page(va.va_size); + if (va.va_nlink == 0) + flags |= MAP_NOSYNC; + obj = vm_pager_allocate(OBJT_VNODE, vp, objsize, prot, foff); if (obj == NULL) { - error = (type == OBJT_DEVICE ? EINVAL : ENOMEM); + error = ENOMEM; goto done; } *objp = obj; *flagsp = flags; + +mark_atime: vfs_mark_atime(vp, td); done: @@ -1255,11 +1226,11 @@ done: int vm_mmap_cdev(struct thread *td, vm_size_t objsize, vm_prot_t prot, vm_prot_t *maxprotp, int *flagsp, - struct cdev *cdev, vm_ooffset_t foff, vm_object_t *objp) + struct cdev *cdev, vm_ooffset_t *foff, vm_object_t *objp) { vm_object_t obj; struct cdevsw *dsw; - int flags; + int error, flags; flags = *flagsp; @@ -1272,25 +1243,43 @@ vm_mmap_cdev(struct thread *td, vm_size_ *flagsp |= MAP_ANON; return (0); } - dev_relthread(cdev); /* - * cdevs does not provide private mappings of any kind. + * cdevs do not provide private mappings of any kind. */ if ((*maxprotp & VM_PROT_WRITE) == 0 && - (prot & PROT_WRITE) != 0) + (prot & PROT_WRITE) != 0) { + dev_relthread(cdev); return (EACCES); - if (flags & (MAP_PRIVATE|MAP_COPY)) + } + if (flags & (MAP_PRIVATE|MAP_COPY)) { + dev_relthread(cdev); return (EINVAL); + } /* * Force device mappings to be shared. */ flags |= MAP_SHARED; #ifdef MAC_XXX - error = mac_check_cdev_mmap(td->td_ucred, cdev, prot); - if (error != 0) + error = mac_cdev_check_mmap(td->td_ucred, cdev, prot); + if (error != 0) { + dev_relthread(cdev); return (error); + } #endif - obj = vm_pager_allocate(OBJT_DEVICE, cdev, objsize, prot, foff); + /* + * First, try d_mmap_single(). If that is not implemented + * (returns ENODEV), fall back to using the device pager. + * Note that d_mmap_single() must return a reference to the + * object (it needs to bump the reference count of the object + * it returns somehow). + * + * XXX assumes VM_PROT_* == PROT_* + */ + error = dsw->d_mmap_single(cdev, foff, objsize, objp, (int)prot); + dev_relthread(cdev); + if (error != ENODEV) + return (error); + obj = vm_pager_allocate(OBJT_DEVICE, cdev, objsize, prot, *foff); if (obj == NULL) return (EINVAL); *objp = obj; @@ -1356,11 +1345,11 @@ vm_mmap(vm_map_t map, vm_offset_t *addr, switch (handle_type) { case OBJT_DEVICE: error = vm_mmap_cdev(td, size, prot, &maxprot, &flags, - handle, foff, &object); + handle, &foff, &object); break; case OBJT_VNODE: error = vm_mmap_vnode(td, size, prot, &maxprot, &flags, - handle, foff, &object); + handle, &foff, &object); break; case OBJT_DEFAULT: if (handle == NULL) { From mav at FreeBSD.org Thu Sep 3 14:54:56 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Thu Sep 3 14:55:02 2009 Subject: svn commit: r196777 - head/sys/dev/ahci In-Reply-To: <1872D962-9297-4C45-9F73-4BB823C49D74@samsco.org> References: <200909031237.n83CbIgk032551@svn.freebsd.org> <1872D962-9297-4C45-9F73-4BB823C49D74@samsco.org> Message-ID: <4A9FD8B4.2080605@FreeBSD.org> Scott Long wrote: > In this case, set maxio to 64k, not 127.5k. You'll typically get much > better i/o performance out of two 64k transfers > than you will out of one 127.k transfer and one 512 bytes transfer, > which is what the block layer will give you if > you try to send 128k. Couldn't it be somehow handled on that level? Limiting maxio from 127.5K to 64K is also a penalty for requests with length in that range. It would be nice if every level would do it's own job. > On Sep 3, 2009, at 6:37 AM, Alexander Motin wrote: >> Author: mav >> Date: Thu Sep 3 12:37:17 2009 >> New Revision: 196777 >> URL: http://svn.freebsd.org/changeset/base/196777 >> >> Log: >> ATI SB600 can't handle 256 sectors transfers with FPDMA (NCQ). >> >> MFC after: 3 days >> >> Modified: >> head/sys/dev/ahci/ahci.c >> >> Modified: head/sys/dev/ahci/ahci.c >> ============================================================================== >> >> --- head/sys/dev/ahci/ahci.c Thu Sep 3 10:06:37 2009 (r196776) >> +++ head/sys/dev/ahci/ahci.c Thu Sep 3 12:37:17 2009 (r196777) >> @@ -1942,6 +1942,9 @@ ahciaction(struct cam_sim *sim, union cc >> cpi->protocol = PROTO_ATA; >> cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; >> cpi->maxio = MAXPHYS; >> + /* ATI SB600 can't handle 256 sectors with FPDMA (NCQ). */ >> + if (pci_get_devid(device_get_parent(dev)) == 0x43801002) >> + cpi->maxio = min(cpi->maxio, 255 * 512); >> cpi->ccb_h.status = CAM_REQ_CMP; >> xpt_done(ccb); >> break; > -- Alexander Motin From scottl at samsco.org Thu Sep 3 15:59:46 2009 From: scottl at samsco.org (Scott Long) Date: Thu Sep 3 15:59:57 2009 Subject: svn commit: r196777 - head/sys/dev/ahci In-Reply-To: <4A9FD8B4.2080605@FreeBSD.org> References: <200909031237.n83CbIgk032551@svn.freebsd.org> <1872D962-9297-4C45-9F73-4BB823C49D74@samsco.org> <4A9FD8B4.2080605@FreeBSD.org> Message-ID: <20090903095224.N20031@pooker.samsco.org> On Thu, 3 Sep 2009, Alexander Motin wrote: > Scott Long wrote: >> In this case, set maxio to 64k, not 127.5k. You'll typically get much >> better i/o performance out of two 64k transfers >> than you will out of one 127.k transfer and one 512 bytes transfer, which >> is what the block layer will give you if >> you try to send 128k. > > Couldn't it be somehow handled on that level? It's a limitation of the paticular hardware, not the OS. Plain disks will behave like this, but RAID controllers might now. But if you want to add this feature to the upper layers, be my guest. > Limiting maxio from 127.5K to > 64K is also a penalty for requests with length in that range. Most I/O that goes to a disk comes from one of the VM pagers, and is thus page aligned and multi-of-page sized. Breaking one of these requests up into sub-page sized requests costs a whole lot more than what you are assuming. We analyzed exactly this situation a few years ago at Yahoo and came to this conclusion. > It would be > nice if every level would do it's own job. It's the job of the driver to handle the limitations of the hardware, yes. Again, if you want to experiment with pushing this functionality into GEOM, be my guest. But until then, consider following my advice. Scott > >> On Sep 3, 2009, at 6:37 AM, Alexander Motin wrote: >>> Author: mav >>> Date: Thu Sep 3 12:37:17 2009 >>> New Revision: 196777 >>> URL: http://svn.freebsd.org/changeset/base/196777 >>> >>> Log: >>> ATI SB600 can't handle 256 sectors transfers with FPDMA (NCQ). >>> >>> MFC after: 3 days >>> >>> Modified: >>> head/sys/dev/ahci/ahci.c >>> >>> Modified: head/sys/dev/ahci/ahci.c >>> ============================================================================== >>> --- head/sys/dev/ahci/ahci.c Thu Sep 3 10:06:37 2009 (r196776) >>> +++ head/sys/dev/ahci/ahci.c Thu Sep 3 12:37:17 2009 (r196777) >>> @@ -1942,6 +1942,9 @@ ahciaction(struct cam_sim *sim, union cc >>> cpi->protocol = PROTO_ATA; >>> cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; >>> cpi->maxio = MAXPHYS; >>> + /* ATI SB600 can't handle 256 sectors with FPDMA (NCQ). */ >>> + if (pci_get_devid(device_get_parent(dev)) == 0x43801002) >>> + cpi->maxio = min(cpi->maxio, 255 * 512); >>> cpi->ccb_h.status = CAM_REQ_CMP; >>> xpt_done(ccb); >>> break; >> > > > -- > Alexander Motin > From mav at FreeBSD.org Thu Sep 3 16:08:13 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Thu Sep 3 16:08:25 2009 Subject: svn commit: r196777 - head/sys/dev/ahci In-Reply-To: <20090903095224.N20031@pooker.samsco.org> References: <200909031237.n83CbIgk032551@svn.freebsd.org> <1872D962-9297-4C45-9F73-4BB823C49D74@samsco.org> <4A9FD8B4.2080605@FreeBSD.org> <20090903095224.N20031@pooker.samsco.org> Message-ID: <4A9FE9E2.1060205@FreeBSD.org> Scott Long wrote: > On Thu, 3 Sep 2009, Alexander Motin wrote: >> Scott Long wrote: >>> In this case, set maxio to 64k, not 127.5k. You'll typically get >>> much better i/o performance out of two 64k transfers >>> than you will out of one 127.k transfer and one 512 bytes transfer, >>> which is what the block layer will give you if >>> you try to send 128k. >> >> Couldn't it be somehow handled on that level? > > It's a limitation of the paticular hardware, not the OS. Plain disks > will behave like this, but RAID controllers might now. But if you want > to add this feature to the upper layers, be my guest. Huh. May be sometimes later. >> Limiting maxio from 127.5K to 64K is also a penalty for requests with >> length in that range. > > Most I/O that goes to a disk comes from one of the VM pagers, and is > thus page aligned and multi-of-page sized. Breaking one of these > requests up into sub-page sized requests costs a whole lot more than > what you are assuming. We analyzed exactly this situation a few years > ago at Yahoo and came to this conclusion. Sure, 127.5K is ugly, but what's about 96K or 112K? Is there benefits having it strictly in power of 2? -- Alexander Motin From scottl at samsco.org Thu Sep 3 16:17:53 2009 From: scottl at samsco.org (Scott Long) Date: Thu Sep 3 16:18:05 2009 Subject: svn commit: r196777 - head/sys/dev/ahci In-Reply-To: <4A9FE9E2.1060205@FreeBSD.org> References: <200909031237.n83CbIgk032551@svn.freebsd.org> <1872D962-9297-4C45-9F73-4BB823C49D74@samsco.org> <4A9FD8B4.2080605@FreeBSD.org> <20090903095224.N20031@pooker.samsco.org> <4A9FE9E2.1060205@FreeBSD.org> Message-ID: <20090903101015.P20031@pooker.samsco.org> On Thu, 3 Sep 2009, Alexander Motin wrote: > Scott Long wrote: >> On Thu, 3 Sep 2009, Alexander Motin wrote: >>> Scott Long wrote: >>>> In this case, set maxio to 64k, not 127.5k. You'll typically get much >>>> better i/o performance out of two 64k transfers >>>> than you will out of one 127.k transfer and one 512 bytes transfer, which >>>> is what the block layer will give you if >>>> you try to send 128k. >>> >>> Couldn't it be somehow handled on that level? >> >> It's a limitation of the paticular hardware, not the OS. Plain disks will >> behave like this, but RAID controllers might now. But if you want to add >> this feature to the upper layers, be my guest. > > Huh. May be sometimes later. > >>> Limiting maxio from 127.5K to 64K is also a penalty for requests with >>> length in that range. >> >> Most I/O that goes to a disk comes from one of the VM pagers, and is thus >> page aligned and multi-of-page sized. Breaking one of these requests up >> into sub-page sized requests costs a whole lot more than what you are >> assuming. We analyzed exactly this situation a few years ago at Yahoo and >> came to this conclusion. > > Sure, 127.5K is ugly, but what's about 96K or 112K? Is there benefits > it strictly in power of 2? It's convenient. We've analyzed the combinations. I'm just trying to offer some advice from experience. I'm going to drop the conversation now. Scott From sam at FreeBSD.org Thu Sep 3 16:24:21 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Thu Sep 3 16:24:31 2009 Subject: svn commit: r196783 - head/sys/net80211 Message-ID: <200909031624.n83GOLhp038059@svn.freebsd.org> Author: sam Date: Thu Sep 3 16:24:21 2009 New Revision: 196783 URL: http://svn.freebsd.org/changeset/base/196783 Log: on transition to SLEEP state mark the station in power save, not awake MFC after: 3 days Modified: head/sys/net80211/ieee80211_sta.c Modified: head/sys/net80211/ieee80211_sta.c ============================================================================== --- head/sys/net80211/ieee80211_sta.c Thu Sep 3 14:23:50 2009 (r196782) +++ head/sys/net80211/ieee80211_sta.c Thu Sep 3 16:24:21 2009 (r196783) @@ -431,7 +431,7 @@ sta_newstate(struct ieee80211vap *vap, e goto invalid; break; case IEEE80211_S_SLEEP: - ieee80211_sta_pwrsave(vap, 0); + ieee80211_sta_pwrsave(vap, 1); break; default: invalid: From ache at FreeBSD.org Thu Sep 3 16:25:25 2009 From: ache at FreeBSD.org (Andrey A. Chernov) Date: Thu Sep 3 16:25:37 2009 Subject: svn commit: r196784 - head/etc/mtree Message-ID: <200909031625.n83GPPSK038134@svn.freebsd.org> Author: ache Date: Thu Sep 3 16:25:25 2009 New Revision: 196784 URL: http://svn.freebsd.org/changeset/base/196784 Log: Add la_LN.ISO8859-13 and lv_LV Modified: head/etc/mtree/BSD.usr.dist Modified: head/etc/mtree/BSD.usr.dist ============================================================================== --- head/etc/mtree/BSD.usr.dist Thu Sep 3 16:24:21 2009 (r196783) +++ head/etc/mtree/BSD.usr.dist Thu Sep 3 16:25:25 2009 (r196784) @@ -553,6 +553,8 @@ .. la_LN.ISO8859-1 .. + la_LN.ISO8859-13 + .. la_LN.ISO8859-15 .. la_LN.ISO8859-2 @@ -567,6 +569,10 @@ .. lt_LT.UTF-8 .. + lv_LV.ISO8859-13 + .. + lv_LV.UTF-8 + .. mn_MN.UTF-8 .. nb_NO.ISO8859-1 @@ -1077,6 +1083,8 @@ .. la_LN.ISO8859-1 .. + la_LN.ISO8859-13 + .. la_LN.ISO8859-15 .. la_LN.ISO8859-2 @@ -1091,6 +1099,10 @@ .. lt_LT.UTF-8 .. + lv_LV.ISO8859-13 + .. + lv_LV.UTF-8 + .. mn_MN.UTF-8 .. nl_BE.ISO8859-1 From sam at FreeBSD.org Thu Sep 3 16:29:03 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Thu Sep 3 16:29:09 2009 Subject: svn commit: r196785 - head/sys/net80211 Message-ID: <200909031629.n83GT3Sp038234@svn.freebsd.org> Author: sam Date: Thu Sep 3 16:29:02 2009 New Revision: 196785 URL: http://svn.freebsd.org/changeset/base/196785 Log: correct timeout for doing NOL processing; need a ticks-relative value Obtained from: Marvell MFC after: 3 days Modified: head/sys/net80211/ieee80211_dfs.c Modified: head/sys/net80211/ieee80211_dfs.c ============================================================================== --- head/sys/net80211/ieee80211_dfs.c Thu Sep 3 16:25:25 2009 (r196784) +++ head/sys/net80211/ieee80211_dfs.c Thu Sep 3 16:29:02 2009 (r196785) @@ -235,7 +235,7 @@ dfs_timeout(void *arg) } if (oldest != now) { /* arrange to process next channel up for a status change */ - callout_schedule(&dfs->nol_timer, oldest + NOL_TIMEOUT); + callout_schedule(&dfs->nol_timer, oldest + NOL_TIMEOUT - now); } } From sam at errno.com Thu Sep 3 16:30:33 2009 From: sam at errno.com (Sam Leffler) Date: Thu Sep 3 16:30:39 2009 Subject: svn commit: r196785 - head/sys/net80211 In-Reply-To: <200909031629.n83GT3Sp038234@svn.freebsd.org> References: <200909031629.n83GT3Sp038234@svn.freebsd.org> Message-ID: <4A9FEF28.2070703@errno.com> Sam Leffler wrote: > Author: sam > Date: Thu Sep 3 16:29:02 2009 > New Revision: 196785 > URL: http://svn.freebsd.org/changeset/base/196785 > > Log: > correct timeout for doing NOL processing; need a ticks-relative value Reviewed by: rpaulo From ed at FreeBSD.org Thu Sep 3 16:31:12 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Thu Sep 3 16:31:19 2009 Subject: svn commit: r196786 - in head/sys: dev/syscons teken Message-ID: <200909031631.n83GVCp9038333@svn.freebsd.org> Author: ed Date: Thu Sep 3 16:31:11 2009 New Revision: 196786 URL: http://svn.freebsd.org/changeset/base/196786 Log: Expose the TF_REVERSE flag to the console driver. Right now libteken processes TF_REVERSE internally and returns the toggled colors to the console driver. This isn't entirely correct. This means that the bold flag is always processed by the foreground color, while reversing should be done after the foreground color has been set to a brighter version by the bold flag. This is no problem with the syscons driver, because with VGA it only supports 16 foreground and 8 background colors. My WIP console driver reconfigures the graphics hardware to disable the blink functionality and uses 16 foreground and 16 background colors. This means that this driver will handle the TF_REVERSE flag a little different from what syscons does right now. Modified: head/sys/dev/syscons/scterm-teken.c head/sys/teken/teken.c head/sys/teken/teken.h head/sys/teken/teken_demo.c Modified: head/sys/dev/syscons/scterm-teken.c ============================================================================== --- head/sys/dev/syscons/scterm-teken.c Thu Sep 3 16:29:02 2009 (r196785) +++ head/sys/dev/syscons/scterm-teken.c Thu Sep 3 16:31:11 2009 (r196786) @@ -300,12 +300,20 @@ static unsigned int scteken_attr(const teken_attr_t *a) { unsigned int attr = 0; + teken_color_t fg, bg; + if (a->ta_format & TF_REVERSE) { + fg = a->ta_bgcolor; + bg = a->ta_fgcolor; + } else { + fg = a->ta_fgcolor; + bg = a->ta_bgcolor; + } if (a->ta_format & TF_BOLD) - attr |= fgcolors_bold[a->ta_fgcolor]; + attr |= fgcolors_bold[fg]; else - attr |= fgcolors_normal[a->ta_fgcolor]; - attr |= bgcolors[a->ta_bgcolor]; + attr |= fgcolors_normal[fg]; + attr |= bgcolors[bg]; #ifdef FG_UNDERLINE if (a->ta_format & TF_UNDERLINE) Modified: head/sys/teken/teken.c ============================================================================== --- head/sys/teken/teken.c Thu Sep 3 16:29:02 2009 (r196785) +++ head/sys/teken/teken.c Thu Sep 3 16:31:11 2009 (r196786) @@ -70,9 +70,6 @@ static FILE *df; #define teken_scs_switch(t, g) #endif /* TEKEN_XTERM && TEKEN_UTF8 */ -/* Private flags for teken_format_t. */ -#define TF_REVERSE 0x08 - /* Private flags for t_stateflags. */ #define TS_FIRSTDIGIT 0x01 /* First numeric digit in escape sequence. */ #define TS_INSERT 0x02 /* Insert mode. */ @@ -114,19 +111,10 @@ static inline void teken_funcs_putchar(teken_t *t, const teken_pos_t *p, teken_char_t c, const teken_attr_t *a) { - teken_attr_t ta; teken_assert(p->tp_row < t->t_winsize.tp_row); teken_assert(p->tp_col < t->t_winsize.tp_col); - /* Apply inversion. */ - if (a->ta_format & TF_REVERSE) { - ta.ta_format = a->ta_format; - ta.ta_fgcolor = a->ta_bgcolor; - ta.ta_bgcolor = a->ta_fgcolor; - a = &ta; - } - t->t_funcs->tf_putchar(t->t_softc, p, c, a); } @@ -134,21 +122,12 @@ static inline void teken_funcs_fill(teken_t *t, const teken_rect_t *r, const teken_char_t c, const teken_attr_t *a) { - teken_attr_t ta; teken_assert(r->tr_end.tp_row > r->tr_begin.tp_row); teken_assert(r->tr_end.tp_row <= t->t_winsize.tp_row); teken_assert(r->tr_end.tp_col > r->tr_begin.tp_col); teken_assert(r->tr_end.tp_col <= t->t_winsize.tp_col); - /* Apply inversion. */ - if (a->ta_format & TF_REVERSE) { - ta.ta_format = a->ta_format; - ta.ta_fgcolor = a->ta_bgcolor; - ta.ta_bgcolor = a->ta_fgcolor; - a = &ta; - } - t->t_funcs->tf_fill(t->t_softc, r, c, a); } Modified: head/sys/teken/teken.h ============================================================================== --- head/sys/teken/teken.h Thu Sep 3 16:29:02 2009 (r196785) +++ head/sys/teken/teken.h Thu Sep 3 16:31:11 2009 (r196786) @@ -54,6 +54,7 @@ typedef unsigned char teken_format_t; #define TF_BOLD 0x01 #define TF_UNDERLINE 0x02 #define TF_BLINK 0x04 +#define TF_REVERSE 0x08 typedef unsigned char teken_color_t; #define TC_BLACK 0 #define TC_RED 1 Modified: head/sys/teken/teken_demo.c ============================================================================== --- head/sys/teken/teken_demo.c Thu Sep 3 16:29:02 2009 (r196785) +++ head/sys/teken/teken_demo.c Thu Sep 3 16:31:11 2009 (r196786) @@ -121,6 +121,8 @@ printchar(const teken_pos_t *p) attr |= A_UNDERLINE; if (px->a.ta_format & TF_BLINK) attr |= A_BLINK; + if (px->a.ta_format & TF_REVERSE) + attr |= A_REVERSE; bkgdset(attr | COLOR_PAIR(px->a.ta_fgcolor + 8 * px->a.ta_bgcolor)); mvaddstr(p->tp_row, p->tp_col, str); From remko at FreeBSD.org Thu Sep 3 16:34:21 2009 From: remko at FreeBSD.org (Remko Lodder) Date: Thu Sep 3 16:34:28 2009 Subject: svn commit: r196787 - in head: . etc libexec Message-ID: <200909031634.n83GYLkL038520@svn.freebsd.org> Author: remko Date: Thu Sep 3 16:34:20 2009 New Revision: 196787 URL: http://svn.freebsd.org/changeset/base/196787 Log: Do the first step in removing lukemftpd from the base system. Disconnect it from the build. If you are using the FTP daemon, please consider using the port ftp/tnftpd which is the same FTP server, but newer and might have more/better functionality. This results in us providing only one ftp daemon by default. Reviewed by: bz Approved by: imp (mentor, implicit) MFC after: 3 days Silence from: obrien Modified: head/ObsoleteFiles.inc head/etc/inetd.conf head/libexec/Makefile Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Thu Sep 3 16:31:11 2009 (r196786) +++ head/ObsoleteFiles.inc Thu Sep 3 16:34:20 2009 (r196787) @@ -14,6 +14,11 @@ # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # +# 20090904: remove lukemftpd +OLD_FILES+=usr/libexec/lukemftpd +OLD_FILES+=usr/share/man/man5/ftpd.conf.5.gz +OLD_FILES+=usr/share/man/man5/ftpusers.5.gz +OLD_FILES+=usr/share/man/man8/lukemftpd.8.gz # 20090902: BSD.{x11,x11-4}.dist are dead and BSD.local.dist lives in ports/ OLD_FILES+=etc/mtree/BSD.local.dist OLD_FILES+=etc/mtree/BSD.x11.dist Modified: head/etc/inetd.conf ============================================================================== --- head/etc/inetd.conf Thu Sep 3 16:31:11 2009 (r196786) +++ head/etc/inetd.conf Thu Sep 3 16:34:20 2009 (r196787) @@ -8,8 +8,6 @@ # #ftp stream tcp nowait root /usr/libexec/ftpd ftpd -l #ftp stream tcp6 nowait root /usr/libexec/ftpd ftpd -l -#ftp stream tcp nowait root /usr/libexec/lukemftpd ftpd -l -r -#ftp stream tcp6 nowait root /usr/libexec/lukemftpd ftpd -l -r #ssh stream tcp nowait root /usr/sbin/sshd sshd -i -4 #ssh stream tcp6 nowait root /usr/sbin/sshd sshd -i -6 #telnet stream tcp nowait root /usr/libexec/telnetd telnetd Modified: head/libexec/Makefile ============================================================================== --- head/libexec/Makefile Thu Sep 3 16:31:11 2009 (r196786) +++ head/libexec/Makefile Thu Sep 3 16:34:20 2009 (r196787) @@ -9,7 +9,6 @@ SUBDIR= ${_atrun} \ fingerd \ ftpd \ getty \ - lukemftpd \ ${_mail.local} \ ${_mknetid} \ ${_pppoed} \ From ed at 80386.nl Thu Sep 3 16:37:34 2009 From: ed at 80386.nl (Ed Schouten) Date: Thu Sep 3 16:37:46 2009 Subject: svn commit: r196787 - in head: . etc libexec In-Reply-To: <200909031634.n83GYLkL038520@svn.freebsd.org> References: <200909031634.n83GYLkL038520@svn.freebsd.org> Message-ID: <20090903163732.GQ2829@hoeg.nl> * Remko Lodder wrote: > Log: > Do the first step in removing lukemftpd from the base system. Disconnect > it from the build. > > > > MFC after: 3 days Is there a reason why we should MFC this? Wouldn't it be better to leave it in 8.0 for now? -- Ed Schouten WWW: http://80386.nl/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090903/ec6d382d/attachment.pgp From remko at elvandar.org Thu Sep 3 16:39:15 2009 From: remko at elvandar.org (Remko Lodder) Date: Thu Sep 3 16:39:21 2009 Subject: svn commit: r196787 - in head: . etc libexec In-Reply-To: <20090903163732.GQ2829@hoeg.nl> References: <200909031634.n83GYLkL038520@svn.freebsd.org> <20090903163732.GQ2829@hoeg.nl> Message-ID: On Sep 3, 2009, at 6:37 PM, Ed Schouten wrote: > * Remko Lodder wrote: >> Log: >> Do the first step in removing lukemftpd from the base system. >> Disconnect >> it from the build. >> >> >> >> MFC after: 3 days > > Is there a reason why we should MFC this? Wouldn't it be better to > leave > it in 8.0 for now? > > It will not automatically appear in 8.0. You can still build it if you connect it locally to the build again. Steps are under way to remove the rest of the code, but that might happen after 8.0 had happened. -- /"\ Best regards, | remko@FreeBSD.org \ / Remko Lodder | remko@EFnet X http://www.evilcoder.org/ | / \ ASCII Ribbon Campaign | Against HTML Mail and News From ed at 80386.nl Thu Sep 3 16:42:09 2009 From: ed at 80386.nl (Ed Schouten) Date: Thu Sep 3 16:42:23 2009 Subject: svn commit: r196787 - in head: . etc libexec In-Reply-To: References: <200909031634.n83GYLkL038520@svn.freebsd.org> <20090903163732.GQ2829@hoeg.nl> Message-ID: <20090903164208.GR2829@hoeg.nl> * Remko Lodder wrote: > It will not automatically appear in 8.0. You can still build it if > you connect it locally to the build again. > Steps are under way to remove the rest of the code, but that might > happen after 8.0 had happened. Hmhm... In my opinion it would have been better if we had a WITH_LUKEMFTPD instead of requiring users to manually rebuild it. I have to confess I don't use lukemftpd, so I'll stop complaining now. ;-) -- Ed Schouten WWW: http://80386.nl/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090903/5ed297c9/attachment.pgp From ache at FreeBSD.org Thu Sep 3 16:53:12 2009 From: ache at FreeBSD.org (Andrey A. Chernov) Date: Thu Sep 3 16:53:18 2009 Subject: svn commit: r196788 - head/share/colldef Message-ID: <200909031653.n83GrBVn038935@svn.freebsd.org> Author: ache Date: Thu Sep 3 16:53:11 2009 New Revision: 196788 URL: http://svn.freebsd.org/changeset/base/196788 Log: Add lv_LV, move lt_LT to common part Added: head/share/colldef/la_LN.ISO8859-13.src - copied, changed from r196787, head/share/colldef/lt_LT.ISO8859-13.src Deleted: head/share/colldef/lt_LT.ISO8859-13.src Modified: head/share/colldef/Makefile Modified: head/share/colldef/Makefile ============================================================================== --- head/share/colldef/Makefile Thu Sep 3 16:34:20 2009 (r196787) +++ head/share/colldef/Makefile Thu Sep 3 16:53:11 2009 (r196788) @@ -20,6 +20,7 @@ LOCALES= bg_BG.CP1251 \ is_IS.ISO8859-15 \ kk_KZ.PT154 \ la_LN.ISO8859-1 \ + la_LN.ISO8859-13 \ la_LN.ISO8859-15 \ la_LN.ISO8859-2 \ la_LN.ISO8859-4 \ @@ -27,7 +28,6 @@ LOCALES= bg_BG.CP1251 \ no_NO.ISO8859-1 \ no_NO.ISO8859-15 \ lt_LT.ISO8859-4 \ - lt_LT.ISO8859-13 \ pl_PL.ISO8859-2 \ ru_RU.CP1251 \ ru_RU.CP866 \ @@ -62,7 +62,7 @@ ${locale}.out: map.${locale:E} CLEANFILES= ${FILES} ENCODINGS= Big5 Big5HKSCS CP949 eucCN eucJP eucKR GB18030 GB2312 GBK \ - ISO8859-1 ISO8859-2 ISO8859-15 SJIS US-ASCII UTF-8 + ISO8859-1 ISO8859-2 ISO8859-13 ISO8859-15 SJIS US-ASCII UTF-8 ISO8859-1_Big5= is_IS:zh_TW ISO8859-1_ISO8859-1= ${ISO8859-15_ISO8859-15} pt_PT:pt_BR @@ -78,6 +78,9 @@ ISO8859-15_ISO8859-15= \ LATIN2LINKS= hu_HU ro_RO sr_YU ISO8859-2_ISO8859-2= ${LATIN2LINKS:C/^/la_LN:/} cs_CZ:sk_SK +LATIN13LINKS= lt_LT lv_LV +ISO8859-13_ISO8859-13= ${LATIN13LINKS:C/^/la_LN:/} + US-ASCII_Big5HKSCS= la_LN:zh_HK US-ASCII_CP949= la_LN:ko_KR US-ASCII_eucCN= la_LN:zh_CN @@ -95,7 +98,7 @@ UTF8LINKS= af_ZA am_ET be_BY bg_BG ca_AD da_DK de_AT de_CH de_DE \ el_GR en_AU en_CA en_GB en_IE en_NZ en_US es_ES et_EE eu_ES \ fi_FI fr_BE fr_CA fr_CH fr_FR he_IL hr_HR hu_HU hy_AM \ - is_IS it_CH it_IT ja_JP kk_KZ ko_KR lt_LT mn_MN \ + is_IS it_CH it_IT ja_JP kk_KZ ko_KR lt_LT lv_LV mn_MN \ nb_NO nl_BE nl_NL nn_NO no_NO pl_PL pt_BR pt_PT \ ro_RO ru_RU sk_SK sl_SI sr_YU sv_SE tr_TR uk_UA zh_CN zh_HK \ zh_TW Copied and modified: head/share/colldef/la_LN.ISO8859-13.src (from r196787, head/share/colldef/lt_LT.ISO8859-13.src) ============================================================================== --- head/share/colldef/lt_LT.ISO8859-13.src Thu Sep 3 16:34:20 2009 (r196787, copy source) +++ head/share/colldef/la_LN.ISO8859-13.src Thu Sep 3 16:53:11 2009 (r196788) @@ -1,4 +1,4 @@ -# Lithuanian (backward compatible with ASCII) +# Latin-7 / Baltic Rim (backward compatible with ASCII) # # $FreeBSD$ # From imp at FreeBSD.org Thu Sep 3 17:04:42 2009 From: imp at FreeBSD.org (Warner Losh) Date: Thu Sep 3 17:04:54 2009 Subject: svn commit: r196789 - head Message-ID: <200909031704.n83H4gCM039220@svn.freebsd.org> Author: imp Date: Thu Sep 3 17:04:42 2009 New Revision: 196789 URL: http://svn.freebsd.org/changeset/base/196789 Log: Time for house-cleaning: o remove all entries before RELENG_7 was branched, as is tradition[*]. o Update examples... nobody cares about 5.x upgrades. o minor format tweaking in a few places. o update copyright (although at best I hold an editors copyright these days). o Remove giving people permission to buy me beer. I don't do enough for this document for that anymore... Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Thu Sep 3 16:53:11 2009 (r196788) +++ head/UPDATING Thu Sep 3 17:04:42 2009 (r196789) @@ -1,51 +1,53 @@ Updating Information for FreeBSD current users -This file is maintained and copyrighted by M. Warner Losh -. See end of file for further details. For commonly -done items, please see the COMMON ITEMS: section later in the file. +This file is maintained and copyrighted by M. Warner Losh . +See end of file for further details. For commonly done items, please see the +COMMON ITEMS: section later in the file. These instructions assume that you +basically know what you are doing. If not, then please consult the FreeBSD +handbook. Items affecting the ports and packages system can be found in -/usr/ports/UPDATING. Please read that file before running -portupgrade. +/usr/ports/UPDATING. Please read that file before running portupgrade. NOTE TO PEOPLE WHO THINK THAT FreeBSD 9.x IS SLOW: - FreeBSD 9.x has many debugging features turned on, in - both the kernel and userland. These features attempt to detect - incorrect use of system primitives, and encourage loud failure - through extra sanity checking and fail stop semantics. They - also substantially impact system performance. If you want to - do performance measurement, benchmarking, and optimization, - you'll want to turn them off. This includes various WITNESS- - related kernel options, INVARIANTS, malloc debugging flags - in userland, and various verbose features in the kernel. Many - developers choose to disable these features on build machines - to maximize performance. (To disable malloc debugging, run + FreeBSD 9.x has many debugging features turned on, in both the kernel + and userland. These features attempt to detect incorrect use of + system primitives, and encourage loud failure through extra sanity + checking and fail stop semantics. They also substantially impact + system performance. If you want to do performance measurement, + benchmarking, and optimization, you'll want to turn them off. This + includes various WITNESS- related kernel options, INVARIANTS, malloc + debugging flags in userland, and various verbose features in the + kernel. Many developers choose to disable these features on build + machines to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) 20090813: - Remove the option STOP_NMI. The default action is now to use NMI - only for KDB via the newly introduced function stop_cpus_hard() - and maintain stop_cpus() to just use a normal IPI_STOP on ia32 - and amd64. + Remove the option STOP_NMI. The default action is now to use NMI only + for KDB via the newly introduced function stop_cpus_hard() and + maintain stop_cpus() to just use a normal IPI_STOP on ia32 and amd64. + +20090803: + RELENG_8 branched. 20090719: - Bump the shared library version numbers for all libraries that - do not use symbol versioning as part of the 8.0-RELEASE cycle. - Bump __FreeBSD_version to 800105. + Bump the shared library version numbers for all libraries that do not + use symbol versioning as part of the 8.0-RELEASE cycle. Bump + __FreeBSD_version to 800105. 20090714: - Due to changes in the implementation of virtual network stack - support, all network-related kernel modules must be recompiled. - As this change breaks the ABI, bump __FreeBSD_version to 800104. + Due to changes in the implementation of virtual network stack support, + all network-related kernel modules must be recompiled. As this change + breaks the ABI, bump __FreeBSD_version to 800104. 20090713: - The TOE interface to the TCP syncache has been modified to remove struct - tcpopt () from the ABI of the network stack. The - cxgb driver is the only TOE consumer affected by this change, and needs - to be recompiled along with the kernel. As this change breaks the ABI, - bump __FreeBSD_version to 800103. + The TOE interface to the TCP syncache has been modified to remove + struct tcpopt () from the ABI of the network stack. + The cxgb driver is the only TOE consumer affected by this change, and + needs to be recompiled along with the kernel. As this change breaks + the ABI, bump __FreeBSD_version to 800103. -20090712: +20090712: Padding has been added to struct tcpcb, sackhint and tcpstat in to facilitate future MFCs and bug fixes whilst maintainig the ABI. However, this change breaks the ABI, so bump @@ -53,79 +55,75 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9. any of these structs (e.g. sockstat) need to be recompiled. 20090630: - The NFS_LEGACYRPC option has been removed along with the old - kernel RPC implementation that this option selected. Kernel - configurations may need to be adjusted. + The NFS_LEGACYRPC option has been removed along with the old kernel + RPC implementation that this option selected. Kernel configurations + may need to be adjusted. 20090629: - The network interface device nodes at /dev/net/ have - been removed. All ioctl operations can be performed the normal - way using routing sockets. The kqueue functionality can - generally be replaced with routing sockets. + The network interface device nodes at /dev/net/ have been + removed. All ioctl operations can be performed the normal way using + routing sockets. The kqueue functionality can generally be replaced + with routing sockets. 20090628: - The documentation from the FreeBSD Documentation Project - (Handbook, FAQ, etc.) is now installed via packages by - sysinstall(8) and under the /usr/local/share/doc/freebsd - directory instead of /usr/share/doc. + The documentation from the FreeBSD Documentation Project (Handbook, + FAQ, etc.) is now installed via packages by sysinstall(8) and under + the /usr/local/share/doc/freebsd directory instead of /usr/share/doc. 20090624: - The ABI of various structures related to the SYSV IPC API have - been changed. As a result, the COMPAT_FREEBSD[456] and COMPAT_43 - kernel options now all require COMPAT_FREEBSD7. - Bump __FreeBSD_version to 800100. + The ABI of various structures related to the SYSV IPC API have been + changed. As a result, the COMPAT_FREEBSD[456] and COMPAT_43 kernel + options now all require COMPAT_FREEBSD7. Bump __FreeBSD_version to + 800100. 20090622: - Layout of struct vnet has changed as routing related variables - were moved to their own Vimage module. Modules need to be - recompiled. Bump __FreeBSD_version to 800099. + Layout of struct vnet has changed as routing related variables were + moved to their own Vimage module. Modules need to be recompiled. Bump + __FreeBSD_version to 800099. 20090619: - NGROUPS_MAX and NGROUPS have been increased from 16 to 1023 - and 1024 respectively. As long as no more than 16 groups per - process are used, no changes should be visible. When more - than 16 groups are used, old binaries may fail if they call - getgroups() or getgrouplist() with statically sized storage. - Recompiling will work around this, but applications should be - modified to use dynamically allocated storage for group arrays - as POSIX.1-2008 does not cap an implementation's number of - supported groups at NGROUPS_MAX+1 as previous versions did. - - NFS and portalfs mounts may also be affected as the list of - groups is truncated to 16. Users of NFS who use more than 16 - groups, should take care that negative group permissions are not - used on the exported file systems as they will not be reliable - unless a GSSAPI based authentication method is used. - -20090616: - The compiling option ADAPTIVE_LOCKMGRS has been introduced. - This option compiles in the support for adaptive spinning for lockmgrs - which want to enable it. The lockinit() function now accepts the - flag LK_ADAPTIVE in order to make the lock object subject to - adaptive spinning when both held in write and read mode. + NGROUPS_MAX and NGROUPS have been increased from 16 to 1023 and 1024 + respectively. As long as no more than 16 groups per process are used, + no changes should be visible. When more than 16 groups are used, old + binaries may fail if they call getgroups() or getgrouplist() with + statically sized storage. Recompiling will work around this, but + applications should be modified to use dynamically allocated storage + for group arrays as POSIX.1-2008 does not cap an implementation's + number of supported groups at NGROUPS_MAX+1 as previous versions did. + + NFS and portalfs mounts may also be affected as the list of groups is + truncated to 16. Users of NFS who use more than 16 groups, should + take care that negative group permissions are not used on the exported + file systems as they will not be reliable unless a GSSAPI based + authentication method is used. + +20090616: + The compiling option ADAPTIVE_LOCKMGRS has been introduced. This + option compiles in the support for adaptive spinning for lockmgrs + which want to enable it. The lockinit() function now accepts the flag + LK_ADAPTIVE in order to make the lock object subject to adaptive + spinning when both held in write and read mode. 20090613: - The layout of the structure returned by IEEE80211_IOC_STA_INFO - has changed. User applications that use this ioctl need to be - rebuilt. + The layout of the structure returned by IEEE80211_IOC_STA_INFO has + changed. User applications that use this ioctl need to be rebuilt. 20090611: - The layout of struct thread has changed. Kernel and modules - need to be rebuilt. + The layout of struct thread has changed. Kernel and modules need to + be rebuilt. 20090608: - The layout of structs ifnet, domain, protosw and vnet_net has - changed. Kernel modules need to be rebuilt. - Bump __FreeBSD_version to 800097. + The layout of structs ifnet, domain, protosw and vnet_net has changed. + Kernel modules need to be rebuilt. Bump __FreeBSD_version to 800097. 20090602: window(1) has been removed from the base system. It can now be installed from ports. The port is called misc/window. 20090601: - The way we are storing and accessing `routing table' entries - has changed. Programs reading the FIB, like netstat, need to - be re-compiled. + The way we are storing and accessing `routing table' entries has + changed. Programs reading the FIB, like netstat, need to be + re-compiled. 20090601: A new netisr implementation has been added for FreeBSD 8. Network @@ -134,24 +132,24 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9. Bump __FreeBSD_version to 800096. 20090530: - Remove the tunable/sysctl debug.mpsafevfs as its initial purpose - is no more valid. + Remove the tunable/sysctl debug.mpsafevfs as its initial purpose is no + more valid. 20090530: Add VOP_ACCESSX(9). File system modules need to be rebuilt. Bump __FreeBSD_version to 800094. 20090529: - Add mnt_xflag field to 'struct mount'. File system modules - need to be rebuilt. + Add mnt_xflag field to 'struct mount'. File system modules need to be + rebuilt. Bump __FreeBSD_version to 800093. 20090528: The compiling option ADAPTIVE_SX has been retired while it has been introduced the option NO_ADAPTIVE_SX which handles the reversed logic. The KPI for sx_init_flags() changes as accepting flags: - SX_ADAPTIVESPIN flag has been retired while the SX_NOADAPTIVE flag - has been introduced in order to handle the reversed logic. + SX_ADAPTIVESPIN flag has been retired while the SX_NOADAPTIVE flag has + been introduced in order to handle the reversed logic. Bump __FreeBSD_version to 800092. 20090527: @@ -164,20 +162,18 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9. Bump __FreeBSD_version to 800090. 20090523: - The newly imported zic(8) produces a new format in the - output. Please run tzsetup(8) to install the newly created - data to /etc/localtime. + The newly imported zic(8) produces a new format in the output. Please + run tzsetup(8) to install the newly created data to /etc/localtime. 20090520: The sysctl tree for the usb stack has renamed from hw.usb2.* to hw.usb.* and is now consistent again with previous releases. 20090520: - 802.11 monitor mode support was revised and driver api's - were changed. Drivers dependent on net80211 now support - DLT_IEEE802_11_RADIO instead of DLT_IEEE802_11. No - user-visible data structures were changed but applications - that use DLT_IEEE802_11 may require changes. + 802.11 monitor mode support was revised and driver api's were changed. + Drivers dependent on net80211 now support DLT_IEEE802_11_RADIO instead + of DLT_IEEE802_11. No user-visible data structures were changed but + applications that use DLT_IEEE802_11 may require changes. Bump __FreeBSD_version to 800088. 20090430: @@ -768,730 +764,29 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9. 20071010: RELENG_7 branched. -20071009: - Setting WITHOUT_LIBPTHREAD now means WITHOUT_LIBKSE and - WITHOUT_LIBTHR are set. - -20070930: - The PCI code has been made aware of PCI domains. This means that - the location strings as used by pciconf(8) etc are now in the - following format: pci::[:]. It - also means that consumers of potentially need to - be recompiled; this includes the hal and xorg-server ports. - -20070928: - The caching daemon (cached) was renamed to nscd. nscd.conf - configuration file should be used instead of cached.conf and - nscd_enable, nscd_pidfile and nscd_flags options should be used - instead of cached_enable, cached_pidfile and cached_flags in - rc.conf. - -20070921: - The getfacl(1) utility now prints owning user and group name - instead of owning uid and gid in the three line comment header. - This is the same behavior as getfacl(1) on Solaris and Linux. - -20070704: - The new IPsec code is now compiled in using the IPSEC option. The - IPSEC option now requires "device crypto" be defined in your kernel - configuration. The FAST_IPSEC kernel option is now deprecated. - -20070702: - The packet filter (pf) code has been updated to OpenBSD 4.1 Please - note the changed syntax - keep state is now on by default. Also - note the fact that ftp-proxy(8) has been changed from bottom up and - has been moved from libexec to usr/sbin. Changes in the ALTQ - handling also affect users of IPFW's ALTQ capabilities. - -20070701: - Remove KAME IPsec in favor of FAST_IPSEC, which is now the - only IPsec supported by FreeBSD. The new IPsec stack - supports both IPv4 and IPv6. The kernel option will change - after the code changes have settled in. For now the kernel - option IPSEC is deprecated and FAST_IPSEC is the only option, that - will change after some settling time. - -20070701: - The wicontrol(8) utility has been removed from the base system. wi(4) - cards should be configured using ifconfig(8), see the man page for more - information. - -20070612: - The i386/amd64 GENERIC kernel now defaults to the nfe(4) driver - instead of the nve(4) driver. Please update your configuration - accordingly. - -20070612: - By default, /etc/rc.d/sendmail no longer rebuilds the aliases - database if it is missing or older than the aliases file. If - desired, set the new rc.conf option sendmail_rebuild_aliases - to "YES" to restore that functionality. - -20070612: - The IPv4 multicast socket code has been considerably modified, and - moved to the file sys/netinet/in_mcast.c. Initial support for the - RFC 3678 Source-Specific Multicast Socket API has been added to - the IPv4 network stack. - - Strict multicast and broadcast reception is now the default for - UDP/IPv4 sockets; the net.inet.udp.strict_mcast_mship sysctl variable - has now been removed. - - The RFC 1724 hack for interface selection has been removed; the use - of the Linux-derived ip_mreqn structure with IP_MULTICAST_IF has - been added to replace it. Consumers such as routed will soon be - updated to reflect this. - - These changes affect users who are running routed(8) or rdisc(8) - from the FreeBSD base system on point-to-point or unnumbered - interfaces. - -20070610: - The net80211 layer has changed significantly and all wireless - drivers that depend on it need to be recompiled. Further these - changes require that any program that interacts with the wireless - support in the kernel be recompiled; this includes: ifconfig, - wpa_supplicant, hostapd, and wlanstats. Users must also, for - the moment, kldload the wlan_scan_sta and/or wlan_scan_ap modules - if they use modules for wireless support. These modules implement - scanning support for station and ap modes, respectively. Failure - to load the appropriate module before marking a wireless interface - up will result in a message to the console and the device not - operating properly. - -20070610: - The pam_nologin(8) module ceases to provide an authentication - function and starts providing an account management function. - Consequent changes to /etc/pam.d should be brought in using - mergemaster(8). Third-party files in /usr/local/etc/pam.d may - need manual editing as follows. Locate this line (or similar): - - auth required pam_nologin.so no_warn - - and change it according to this example: - - account required pam_nologin.so no_warn - - That is, the first word needs to be changed from "auth" to - "account". The new line can be moved to the account section - within the file for clarity. Not updating pam.conf(5) files - will result in nologin(5) ignored by the respective services. - -20070529: - The ether_ioctl() function has been synchronized with ioctl(2) - and ifnet.if_ioctl. Due to that, the size of one of its arguments - has changed on 64-bit architectures. All kernel modules using - ether_ioctl() need to be rebuilt on such architectures. - -20070516: - Improved INCLUDE_CONFIG_FILE support has been introduced to the - config(8) utility. In order to take advantage of this new - functionality, you are expected to recompile and install - src/usr.sbin/config. If you don't rebuild config(8), and your - kernel configuration depends on INCLUDE_CONFIG_FILE, the kernel - build will be broken because of a missing "kernconfstring" - symbol. - -20070513: - Symbol versioning is enabled by default. To disable it, use - option WITHOUT_SYMVER. It is not advisable to attempt to - disable symbol versioning once it is enabled; your installworld - will break because a symbol version-less libc will get installed - before the install tools. As a result, the old install tools, - which previously had symbol dependencies to FBSD_1.0, will fail - because the freshly installed libc will not have them. - - The default threading library (providing "libpthread") has been - changed to libthr. If you wish to have libkse as your default, - use option DEFAULT_THREAD_LIB=libkse for the buildworld. - -20070423: - The ABI breakage in sendmail(8)'s libmilter has been repaired - so it is no longer necessary to recompile mail filters (aka, - milters). If you recompiled mail filters after the 20070408 - note, it is not necessary to recompile them again. - -20070417: - The new trunk(4) driver has been renamed to lagg(4) as it better - reflects its purpose. ifconfig will need to be recompiled. - -20070408: - sendmail(8) has been updated to version 8.14.1. Mail filters - (aka, milters) compiled against the libmilter included in the - base operating system should be recompiled. - -20070302: - Firmwares for ipw(4) and iwi(4) are now included in the base tree. - In order to use them one must agree to the respective LICENSE in - share/doc/legal and define legal.intel_.license_ack=1 via - loader.conf(5) or kenv(1). Make sure to deinstall the now - deprecated modules from the respective firmware ports. - -20070228: - The name resolution/mapping functions addr2ascii(3) and ascii2addr(3) - were removed from FreeBSD's libc. These originally came from INRIA - IPv6. Nothing in FreeBSD ever used them. They may be regarded as - deprecated in previous releases. - The AF_LINK support for getnameinfo(3) was merged from NetBSD to - replace it as a more portable (and re-entrant) API. - -20070224: - To support interrupt filtering a modification to the newbus API - has occurred, ABI was broken and __FreeBSD_version was bumped - to 700031. Please make sure that your kernel and modules are in - sync. For more info: - http://docs.freebsd.org/cgi/mid.cgi?20070221233124.GA13941 - -20070224: - The IPv6 multicast forwarding code may now be loaded into GENERIC - kernels by loading the ip_mroute.ko module. This is built into the - module unless WITHOUT_INET6 or WITHOUT_INET6_SUPPORT options are - set; see src.conf(5) for more information. - -20070214: - The output of netstat -r has changed. Without -n, we now only - print a "network name" without the prefix length if the network - address and mask exactly match a Class A/B/C network, and an entry - exists in the nsswitch "networks" map. - With -n, we print the full unabbreviated CIDR network prefix in - the form "a.b.c.d/p". 0.0.0.0/0 is always printed as "default". - This change is in preparation for changes such as equal-cost - multipath, and to more generally assist operational deployment - of FreeBSD as a modern IPv4 router. - -20070210: - PIM has been turned on by default in the IPv4 multicast - routing code. The kernel option 'PIM' has now been removed. - PIM is now built by default if option 'MROUTING' is specified. - It may now be loaded into GENERIC kernels by loading the - ip_mroute.ko module. - -20070207: - Support for IPIP tunnels (VIFF_TUNNEL) in IPv4 multicast routing - has been removed. Its functionality may be achieved by explicitly - configuring gif(4) interfaces and using the 'phyint' keyword in - mrouted.conf. - XORP does not support source-routed IPv4 multicast tunnels nor the - integrated IPIP tunneling, therefore it is not affected by this - change. The __FreeBSD_version macro has been bumped to 700030. - -20061221: - Support for PCI Message Signalled Interrupts has been - re-enabled in the bge driver, only for those chips which are - believed to support it properly. If there are any problems, - MSI can be disabled completely by setting the - 'hw.pci.enable_msi' and 'hw.pci.enable_msix' tunables to 0 - in the loader. - -20061214: - Support for PCI Message Signalled Interrupts has been - disabled again in the bge driver. Many revisions of the - hardware fail to support it properly. Support can be - re-enabled by removing the #define of BGE_DISABLE_MSI in - "src/sys/dev/bge/if_bge.c". - -20061214: - Support for PCI Message Signalled Interrupts has been added - to the bge driver. If there are any problems, MSI can be - disabled completely by setting the 'hw.pci.enable_msi' and - 'hw.pci.enable_msix' tunables to 0 in the loader. - -20061205: - The removal of several facets of the experimental Threading - system from the kernel means that the proc and thread structures - have changed quite a bit. I suggest all kernel modules that might - reference these structures be recompiled.. Especially the - linux module. - -20061126: - Sound infrastructure has been updated with various fixes and - improvements. Most of the changes are pretty much transparent, - with exceptions of followings: - 1) All sound driver specific sysctls (hw.snd.pcm%d.*) have been - moved to their own dev sysctl nodes, for example: - hw.snd.pcm0.vchans -> dev.pcm.0.vchans - 2) /dev/dspr%d.%d has been deprecated. Each channel now has its - own chardev in the form of "dsp%d.%d", where - is p = playback, r = record and v = virtual, respectively. Users - are encouraged to use these devs instead of (old) "/dev/dsp%d.%d". - This does not affect those who are using "/dev/dsp". - -20061122: - geom(4)'s gmirror(8) class metadata structure has been - rev'd from v3 to v4. If you update across this point and - your metadata is converted for you, you will not be easily - able to downgrade since the /boot/kernel.old/geom_mirror.ko - kernel module will be unable to read the v4 metadata. You - can resolve this by doing from the loader(8) prompt: - - set vfs.root.mountfrom="ufs:/dev/XXX" - - where XXX is the root slice of one of the disks that composed - the mirror (i.e.: /dev/ad0s1a). You can then rebuild - the array the same way you built it originally. - -20061122: - The following binaries have been disconnected from the build: - mount_devfs, mount_ext2fs, mount_fdescfs, mount_procfs, mount_linprocfs, - and mount_std. The functionality of these programs has been - moved into the mount program. For example, to mount a devfs - filesystem, instead of using mount_devfs, use: "mount -t devfs". - This does not affect entries in /etc/fstab, since entries in - /etc/fstab are always processed with "mount -t fstype". - -20061113: - Support for PCI Message Signalled Interrupts on i386 and amd64 - has been added to the kernel and various drivers will soon be - updated to use MSI when it is available. If there are any problems, - MSI can be disabled completely by setting the 'hw.pci.enable_msi' - and 'hw.pci.enable_msix' tunables to 0 in the loader. - -20061110: - The MUTEX_PROFILING option has been renamed to LOCK_PROFILING. - The lockmgr object layout has been changed as a result of having - a lock_object embedded in it. As a consequence all file system - kernel modules must be re-compiled. The mutex profiling man page - has not yet been updated to reflect this change. - -20061026: - KSE in the kernel has now been made optional and turned on by - default. Use 'nooption KSE' in your kernel config to turn it - off. All kernel modules *must* be recompiled after this change. - There-after, modules from a KSE kernel should be compatible with - modules from a NOKSE kernel due to the temporary padding fields - added to 'struct proc'. - -20060929: - mrouted and its utilities have been removed from the base system. - -20060927: - Some ioctl(2) command codes have changed. Full backward ABI - compatibility is provided if the "options COMPAT_FREEBSD6" is - present in the kernel configuration file. Make sure to add - this option to your kernel config file, or recompile X.Org - and the rest of ports; otherwise they may refuse to work. - -20060924: - tcpslice has been removed from the base system. - -20060913: - The sizes of struct tcpcb (and struct xtcpcb) have changed due to - the rewrite of TCP syncookies. Tools like netstat, sockstat, and - systat needs to be rebuilt. - -20060903: - libpcap updated to v0.9.4 and tcpdump to v3.9.4 - -20060816: - The IPFIREWALL_FORWARD_EXTENDED option is gone and the behaviour - for IPFIREWALL_FORWARD is now as it was before when it was first - committed and for years after. The behaviour is now ON. - -20060725: - enigma(1)/crypt(1) utility has been changed on 64 bit architectures. - Now it can decrypt files created from different architectures. - Unfortunately, it is no longer able to decrypt a cipher text - generated with an older version on 64 bit architectures. - If you have such a file, you need old utility to decrypt it. - -20060709: - The interface version of the i4b kernel part has changed. So - after updating the kernel sources and compiling a new kernel, - the i4b user space tools in "/usr/src/usr.sbin/i4b" must also - be rebuilt, and vice versa. - -20060627: - The XBOX kernel now defaults to the nfe(4) driver instead of - the nve(4) driver. Please update your configuration - accordingly. - -20060514: - The i386-only lnc(4) driver for the AMD Am7900 LANCE and Am79C9xx - PCnet family of NICs has been removed. The new le(4) driver serves - as an equivalent but cross-platform replacement with the pcn(4) - driver still providing performance-optimized support for the subset - of AMD Am79C971 PCnet-FAST and greater chips as before. - -20060511: - The machdep.* sysctls and the adjkerntz utility have been - modified a bit. The new adjkerntz utility uses the new - sysctl names and sysctlbyname() calls, so it may be impossible - to run an old /sbin/adjkerntz utility in single-user mode - with a new kernel. Replace the `adjkerntz -i' step before - `make installworld' with: - - /usr/obj/usr/src/sbin/adjkerntz/adjkerntz -i - - and proceed as usual with the rest of the installworld-stage - steps. Otherwise, you risk installing binaries with their - timestamp set several hours in the future, especially if - you are running with local time set to GMT+X hours. - -20060412: - The ip6fw utility has been removed. The behavior provided by - ip6fw has been in ipfw2 for a good while and the rc.d scripts - have been updated to deal with it. There are some rules that - might not migrate cleanly. Use rc.firewall6 as a template to - rewrite rules. - -20060428: - The puc(4) driver has been overhauled. The ebus(4) and sbus(4) - attachments have been removed. Make sure to configure scc(4) - on sparc64. Note also that by default puc(4) will use uart(4) - and not sio(4) for serial ports because interrupt handling has - been optimized for multi-port serial cards and only uart(4) - implements the interface to support it. - -20060330: - The scc(4) driver replaces puc(4) for Serial Communications - Controllers (SCCs) like the Siemens SAB82532 and the Zilog - Z8530. On sparc64, it is advised to add scc(4) to the kernel - configuration to make sure that the serial ports remain - functional. - -20060317: - Most world/kernel related NO_* build options changed names. - New knobs have common prefixes WITHOUT_*/WITH_* (modelled - after FreeBSD ports) and should be set in /etc/src.conf - (the src.conf(5) manpage is provided). Full backwards - compatibility is maintained for the time being though it's - highly recommended to start moving old options out of the - system-wide /etc/make.conf file into the new /etc/src.conf - while also properly renaming them. More conversions will - likely follow. Posting to current@: - - http://lists.freebsd.org/pipermail/freebsd-current/2006-March/061725.html - -20060305: - The NETSMBCRYPTO kernel option has been retired because its - functionality is always included in NETSMB and smbfs.ko now. - -20060303: - The TDFX_LINUX kernel option was retired and replaced by the - tdfx_linux device. The latter can be loaded as the 3dfx_linux.ko - kernel module. Loading it alone should suffice to get 3dfx support - for Linux apps because it will pull in 3dfx.ko and linux.ko through - its dependencies. - -20060204: - The 'audit' group was added to support the new auditing functionality - in the base system. Be sure to follow the directions for updating, - including the requirement to run mergemaster -p. - -20060201: - The kernel ABI to file system modules was changed on i386. - Please make sure that your kernel and modules are in sync. - -20060118: - This actually occured some time ago, but installing the kernel - now also installs a bunch of symbol files for the kernel modules. - This increases the size of /boot/kernel to about 67Mbytes. You - will need twice this if you will eventually back this up to kernel.old - on your next install. - If you have a shortage of room in your root partition, you should add - -DINSTALL_NODEBUG to your make arguments or add INSTALL_NODEBUG="yes" - to your /etc/make.conf. - -20060113: - libc's malloc implementation has been replaced. This change has the - potential to uncover application bugs that previously went unnoticed. - See the malloc(3) manual page for more details. - -20060112: - The generic netgraph(4) cookie has been changed. If you upgrade - kernel passing this point, you also need to upgrade userland - and netgraph(4) utilities like ports/net/mpd or ports/net/mpd4. - -20060106: - si(4)'s device files now contain the unit number. - Uses of {cua,tty}A[0-9a-f] should be replaced by {cua,tty}A0[0-9a-f]. - -20060106: - The kernel ABI was mostly destroyed due to a change in the size - of struct lock_object which is nested in other structures such - as mutexes which are nested in all sorts of other structures. - Make sure your kernel and modules are in sync. - -20051231: - The page coloring algorithm in the VM subsystem was converted - from tuning with kernel options to autotuning. Please remove - any PQ_* option except PQ_NOOPT from your kernel config. - -20051211: - The net80211-related tools in the tools/tools/ath directory - have been moved to tools/tools/net80211 and renamed with a - "wlan" prefix. Scripts that use them should be adjusted - accordingly. - -20051202: - Scripts in the local_startup directories (as defined in - /etc/defaults/rc.conf) that have the new rc.d semantics will - now be run as part of the base system rcorder. If there are - errors or problems with one of these local scripts, it could - cause boot problems. If you encounter such problems, boot in - single user mode, remove that script from the */rc.d directory. - Please report the problem to the port's maintainer, and the - freebsd-ports@freebsd.org mailing list. - -20051129: - The nodev mount option was deprecated in RELENG_6 (where it - was a no-op), and is now unsupported. If you have nodev or dev listed - in /etc/fstab, remove it, otherwise it will result in a mount error. - -20051129: - ABI between ipfw(4) and ipfw(8) has been changed. You need - to rebuild ipfw(8) when rebuilding kernel. - -20051108: - rp(4)'s device files now contain the unit number. - Uses of {cua,tty}R[0-9a-f] should be replaced by {cua,tty}R0[0-9a-f]. - -20051029: - /etc/rc.d/ppp-user has been renamed to /etc/rc.d/ppp. - Its /etc/rc.conf.d configuration file has been `ppp' from - the beginning, and hence there is no need to touch it. - -20051014: - Now most modules get their build-time options from the kernel - configuration file. A few modules still have fixed options - due to their non-conformant implementation, but they will be - corrected eventually. You may need to review the options of - the modules in use, explicitly specify the non-default options - in the kernel configuration file, and rebuild the kernel and - modules afterwards. - -20051001: - kern.polling.enable sysctl MIB is now deprecated. Use ifconfig(8) - to turn polling(4) on your interfaces. - -20050927: - The old bridge(4) implementation was retired. The new - if_bridge(4) serves as a full functional replacement. - -20050722: - The ai_addrlen of a struct addrinfo was changed to a socklen_t - to conform to POSIX-2001. This change broke an ABI - compatibility on 64 bit architecture. You have to recompile - userland programs that use getaddrinfo(3) on 64 bit - architecture. - -20050711: - RELENG_6 branched here. - -20050629: - The pccard_ifconfig rc.conf variable has been removed and a new - variable, ifconfig_DEFAULT has been introduced. Unlike - pccard_ifconfig, ifconfig_DEFAULT applies to ALL interfaces that - do not have ifconfig_ifn entries rather than just those in - removable_interfaces. - -20050616: - Some previous versions of PAM have permitted the use of - non-absolute paths in /etc/pam.conf or /etc/pam.d/* when referring - to third party PAM modules in /usr/local/lib. A change has been - made to require the use of absolute paths in order to avoid - ambiguity and dependence on library path configuration, which may - affect existing configurations. - -20050610: - Major changes to network interface API. All drivers must be - recompiled. Drivers not in the base system will need to be - updated to the new APIs. - -20050609: - Changes were made to kinfo_proc in sys/user.h. Please recompile - userland, or commands like `fstat', `pkill', `ps', `top' and `w' - will not behave correctly. - - The API and ABI for hwpmc(4) have changed with the addition - of sampling support. Please recompile lib/libpmc(3) and - usr.sbin/{pmcstat,pmccontrol}. - -20050606: - The OpenBSD dhclient was imported in place of the ISC dhclient - and the network interface configuration scripts were updated - accordingly. If you use DHCP to configure your interfaces, you - must now run devd. Also, DNS updating was lost so you will need - to find a workaround if you use this feature. - - The '_dhcp' user was added to support the OpenBSD dhclient. Be - sure to run mergemaster -p (like you are supposed to do every time - anyway). - -20050605: - if_bridge was added to the tree. This has changed struct ifnet. - Please recompile userland and all network related modules. - -20050603: - The n_net of a struct netent was changed to an uint32_t, and - 1st argument of getnetbyaddr() was changed to an uint32_t, to - conform to POSIX-2001. These changes broke an ABI - compatibility on 64 bit architecture. With these changes, - shlib major of libpcap was bumped. You have to recompile - userland programs that use getnetbyaddr(3), getnetbyname(3), - getnetent(3) and/or libpcap on 64 bit architecture. - -20050528: - Kernel parsing of extra options on '#!' first lines of shell - scripts has changed. Lines with multiple options likely will - fail after this date. For full details, please see - http://people.freebsd.org/~gad/Updating-20050528.txt - -20050503: - The packet filter (pf) code has been updated to OpenBSD 3.7 - Please note the changed anchor syntax and the fact that - authpf(8) now needs a mounted fdescfs(5) to function. - -20050415: - The NO_MIXED_MODE kernel option has been removed from the i386 - amd64 platforms as its use has been superceded by the new local - APIC timer code. Any kernel config files containing this option - should be updated. - -20050227: - The on-disk format of LC_CTYPE files was changed to be machine - independent. Please make sure NOT to use NO_CLEAN buildworld - when crossing this point. Crossing this point also requires - recompile or reinstall of all locale depended packages. - -20050225: - The ifi_epoch member of struct if_data has been changed to - contain the uptime at which the interface was created or the - statistics zeroed rather then the wall clock time because - wallclock time may go backwards. This should have no impact - unless an snmp implementation is using this value (I know of - none at this point.) - -20050224: - The acpi_perf and acpi_throttle drivers are now part of the - acpi(4) main module. They are no longer built separately. - -20050223: - The layout of struct image_params has changed. You have to - recompile all compatibility modules (linux, svr4, etc) for use - with the new kernel. - -20050223: - The p4tcc driver has been merged into cpufreq(4). This makes - "options CPU_ENABLE_TCC" obsolete. Please load cpufreq.ko or - compile in "device cpufreq" to restore this functionality. - -20050220: - The responsibility of recomputing the file system summary of - a SoftUpdates-enabled dirty volume has been transferred to the - background fsck. A rebuild of fsck(8) utility is recommended - if you have updated the kernel. - - To get the old behavior (recompute file system summary at mount - time), you can set vfs.ffs.compute_summary_at_mount=1 before - mounting the new volume. - -20050206: - The cpufreq import is complete. As part of this, the sysctls for - acpi(4) throttling have been removed. The power_profile script - has been updated, so you can use performance/economy_cpu_freq in - rc.conf(5) to set AC on/offline cpu frequencies. - -20050206: - NG_VERSION has been increased. Recompiling kernel (or ng_socket.ko) - requires recompiling libnetgraph and userland netgraph utilities. - -20050114: - Support for abbreviated forms of a number of ipfw options is - now deprecated. Warnings are printed to stderr indicating the - correct full form when a match occurs. Some abbreviations may - be supported at a later date based on user feedback. To be - considered for support, abbreviations must be in use prior to - this commit and unlikely to be confused with current key words. - -20041221: - By a popular demand, a lot of NOFOO options were renamed - to NO_FOO (see bsd.compat.mk for a full list). The old - spellings are still supported, but will cause annoying - warnings on stderr. Make sure you upgrade properly (see - the COMMON ITEMS: section later in this file). - -20041219: - Auto-loading of ancillary wlan modules such as wlan_wep has - been temporarily disabled; you need to statically configure - the modules you need into your kernel or explicitly load them - prior to use. Specifically, if you intend to use WEP encryption - with an 802.11 device load/configure wlan_wep; if you want to - use WPA with the ath driver load/configure wlan_tkip, wlan_ccmp, - and wlan_xauth as required. - -20041213: - The behaviour of ppp(8) has changed slightly. If lqr is enabled - (``enable lqr''), older versions would revert to LCP ECHO mode on - negotiation failure. Now, ``enable echo'' is required for this - behaviour. The ppp version number has been bumped to 3.4.2 to - reflect the change. - -20041201: - The wlan support has been updated to split the crypto support - into separate modules. For static WEP you must configure the - wlan_wep module in your system or build and install the module - in place where it can be loaded (the kernel will auto-load - the module when a wep key is configured). - -20041201: - The ath driver has been updated to split the tx rate control - algorithm into a separate module. You need to include either - ath_rate_onoe or ath_rate_amrr when configuring the kernel. - -20041116: - Support for systems with an 80386 CPU has been removed. Please - use FreeBSD 5.x or earlier on systems with an 80386. - -20041110: - We have had a hack which would mount the root filesystem - R/W if the device were named 'md*'. As part of the vnode - work I'm doing I have had to remove this hack. People - building systems which use preloaded MD root filesystems - may need to insert a "/sbin/mount -u -o rw /dev/md0 /" in - their /etc/rc scripts. - -20041104: - FreeBSD 5.3 shipped here. - -20041102: - The size of struct tcpcb has changed again due to the removal - of RFC1644 T/TCP. You have to recompile userland programs that - read kmem for tcp sockets directly (netstat, sockstat, etc.) - -20041022: - The size of struct tcpcb has changed. You have to recompile - userland programs that read kmem for tcp sockets directly - (netstat, sockstat, etc.) - -20041016: - RELENG_5 branched here. For older entries, please see updating - in the RELENG_5 branch. - COMMON ITEMS: General Notes ------------- - Avoid using make -j when upgrading. From time to time in the - past there have been problems using -j with buildworld and/or - installworld. This is especially true when upgrading between - "distant" versions (eg one that cross a major release boundary - or several minor releases, or when several months have passed - on the -current branch). + Avoid using make -j when upgrading. While generally safe, there are + sometimes problems using -j to upgrade. If your upgrade fails with + -j, please try again wtihout -j. From time to time in the past there + have been problems using -j with buildworld and/or installworld. This + is especially true when upgrading between "distant" versions (eg one + that cross a major release boundary or several minor releases, or when + several months have passed on the -current branch). Sometimes, obscure build problems are the result of environment poisoning. This can happen because the make utility reads its - environment when searching for values for global variables. - To run your build attempts in an "environmental clean room", - prefix all make commands with 'env -i '. See the env(1) manual *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From dougb at FreeBSD.org Thu Sep 3 17:07:20 2009 From: dougb at FreeBSD.org (Doug Barton) Date: Thu Sep 3 17:07:30 2009 Subject: svn commit: r196727 - head/share/man/man5 In-Reply-To: <86hbvli9tg.fsf@gmail.com> References: <200909010555.n815tAkx050140@svn.freebsd.org> <4A9D4A90.30700@FreeBSD.org> <20090902092054.Q27429@mp2.macomnet.net> <4A9E7718.1080503@andric.com> <86hbvli9tg.fsf@gmail.com> Message-ID: <4A9FF7BD.30104@FreeBSD.org> Anonymous wrote: > Dimitry Andric writes: > >> On 2009-09-02 07:21, Maxim Konovalov wrote: >>>> Unless I'm missing something this should be in the src.conf man page >>>> instead of make.conf. >>> Please explain why. >> make.conf(5): >> The file make.conf contains system-wide settings that will apply to every >> build using make(1) and the standard sys.mk file. >> >> src.conf(5): >> The src.conf file contains settings that will apply to every build >> involving the FreeBSD source tree; see build(7). >> >> The MALLOC_PRODUCTION define is used inside the FreeBSD source tree >> (actually only in jemalloc, it seems). >> >> You most likely don't want it to apply 'globally', since third-party >> programs (e.g. ports) might give a totally different meaning to this >> define -- or most likely: no meaning at all. :) > > Don't you think this affects not only MALLOC_PRODUCTION but all defines > under sections "BUILDING THE KERNEL" and "BUILDING THE WORLD"? Yes, those should probably be moved as well. I've cc'ed Ruslan since he's really taken the lead on the src.conf stuff. > For example, WITHOUT_MODULES conflicts with one in archivers/p7zip. Good point. You should probably bring that to the attention of the port's maintainer. Doug -- This .signature sanitized for your protection From ache at FreeBSD.org Thu Sep 3 17:12:46 2009 From: ache at FreeBSD.org (Andrey A. Chernov) Date: Thu Sep 3 17:12:57 2009 Subject: svn commit: r196790 - head/share/mklocale Message-ID: <200909031712.n83HCkCT039422@svn.freebsd.org> Author: ache Date: Thu Sep 3 17:12:45 2009 New Revision: 196790 URL: http://svn.freebsd.org/changeset/base/196790 Log: Add lv_LV, move lt_LT to common part Added: head/share/mklocale/la_LN.ISO8859-13.src - copied unchanged from r196789, head/share/mklocale/lt_LT.ISO8859-13.src Deleted: head/share/mklocale/lt_LT.ISO8859-13.src Modified: head/share/mklocale/Makefile Modified: head/share/mklocale/Makefile ============================================================================== --- head/share/mklocale/Makefile Thu Sep 3 17:04:42 2009 (r196789) +++ head/share/mklocale/Makefile Thu Sep 3 17:12:45 2009 (r196790) @@ -13,11 +13,11 @@ LOCALES= UTF-8 \ ko_KR.CP949 \ ko_KR.eucKR \ la_LN.ISO8859-1 \ + la_LN.ISO8859-13 \ la_LN.ISO8859-15 \ la_LN.ISO8859-2 \ la_LN.ISO8859-4 \ la_LN.US-ASCII \ - lt_LT.ISO8859-13 \ ru_RU.CP866 \ ru_RU.ISO8859-5 \ ru_RU.KOI8-R \ @@ -47,7 +47,7 @@ FILESDIR_${locale}.out= ${LOCALEDIR}/${l CLEANFILES= ${FILES} ENCODINGS= CP1251 ISO8859-1 ISO8859-2 ISO8859-4 ISO8859-5 \ - ISO8859-15 US-ASCII UTF-8 + ISO8859-13 ISO8859-15 US-ASCII UTF-8 ASCIILINKS= en_AU en_CA en_GB en_NZ en_US US-ASCII_US-ASCII= ${ASCIILINKS:C/^/la_LN:/} @@ -71,6 +71,9 @@ ISO8859-4_ISO8859-4= ${LATIN4LINKS:C/^/l LATIN5LINKS= sr_YU uk_UA be_BY ISO8859-5_ISO8859-5= ${LATIN5LINKS:C/^/ru_RU:/} +LATIN13LINKS= lt_LT lv_LV +ISO8859-13_ISO8859-13= ${LATIN13LINKS:C/^/la_LN:/} + CP1251LINKS= ru_RU be_BY uk_UA CP1251_CP1251= ${CP1251LINKS:C/^/bg_BG:/} @@ -79,7 +82,7 @@ UTF8LINKS= af_ZA be_BY bg_BG ca_AD ca_ES en_AU en_CA en_GB en_IE en_NZ en_US es_ES et_EE eu_ES fi_FI \ fr_BE \ fr_CA fr_CH fr_FR he_IL hr_HR hu_HU hy_AM is_IS it_CH it_IT \ - ja_JP kk_KZ ko_KR lt_LT mn_MN \ + ja_JP kk_KZ ko_KR lt_LT lv_LV mn_MN \ nb_NO nl_BE nl_NL nn_NO no_NO pl_PL pt_BR pt_PT \ ro_RO ru_RU sk_SK sl_SI sr_YU sv_SE tr_TR uk_UA zh_CN zh_HK \ zh_TW Copied: head/share/mklocale/la_LN.ISO8859-13.src (from r196789, head/share/mklocale/lt_LT.ISO8859-13.src) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/mklocale/la_LN.ISO8859-13.src Thu Sep 3 17:12:45 2009 (r196790, copy of r196789, head/share/mklocale/lt_LT.ISO8859-13.src) @@ -0,0 +1,49 @@ +/* + * LOCALE_CTYPE for the iso_8859_13 Locale + * + * $FreeBSD$ + */ + +ENCODING "NONE" +VARIABLE ISO 8859-13 Latin-7 character set + +# +# This is a comment +# +ALPHA 'A' - 'Z' 'a' - 'z' +ALPHA 0xaa 0xba 0xc0 - 0xd6 0xd8 - 0xde 0xe0 - 0xf6 0xf8 - 0xfe +CONTROL 0x00 - 0x1f 0x7f - 0x9f +DIGIT '0' - '9' +GRAPH 0x21 - 0x7e 0xa1 - 0xff +LOWER 'a' - 'z' +LOWER 0xba 0xdf - 0xf6 0xf8 - 0xfe +PUNCT 0x21 - 0x2f 0x3a - 0x40 0x5b - 0x60 0x7b - 0x7e +PUNCT 0xa1 - 0xa9 0xab - 0xb9 0xbb -0xbf 0xd7 0xdf 0xf7 0xff +SPACE 0x09 - 0x0d 0x20 0xa0 +UPPER 'A' - 'Z' +UPPER 0xaa 0xc0 - 0xd6 0xd8 - 0xde +XDIGIT '0' - '9' 'a' - 'f' 'A' - 'F' +BLANK ' ' '\t' 0xa0 +PRINT 0x20 - 0x7e 0xa0 - 0xff + +MAPLOWER <'A' - 'Z' : 'a'> +MAPLOWER <'a' - 'z' : 'a'> +MAPLOWER <0xaa 0xba> +MAPLOWER <0xba 0xba> +MAPLOWER <0xc0 - 0xd6 : 0xe0> +MAPLOWER <0xd8 - 0xde : 0xf8> +MAPLOWER <0xe0 - 0xf6 : 0xe0> +MAPLOWER <0xf8 - 0xfe : 0xf8> + +MAPUPPER <'A' - 'Z' : 'A'> +MAPUPPER <'a' - 'z' : 'A'> +MAPUPPER <0xaa 0xaa> +MAPUPPER <0xba 0xaa> +MAPUPPER <0xc0 - 0xd6 : 0xc0> +MAPUPPER <0xd8 - 0xdf : 0xd8> +MAPUPPER <0xe0 - 0xf6 : 0xc0> +MAPUPPER <0xf8 - 0xfe : 0xd8> + +TODIGIT <'0' - '9' : 0> +TODIGIT <'A' - 'F' : 10> +TODIGIT <'a' - 'f' : 10> From imp at FreeBSD.org Thu Sep 3 17:13:54 2009 From: imp at FreeBSD.org (Warner Losh) Date: Thu Sep 3 17:14:06 2009 Subject: svn commit: r196791 - head Message-ID: <200909031713.n83HDsFc039487@svn.freebsd.org> Author: imp Date: Thu Sep 3 17:13:54 2009 New Revision: 196791 URL: http://svn.freebsd.org/changeset/base/196791 Log: Actually, stable/8 is what was created... Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Thu Sep 3 17:12:45 2009 (r196790) +++ head/UPDATING Thu Sep 3 17:13:54 2009 (r196791) @@ -28,7 +28,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9. maintain stop_cpus() to just use a normal IPI_STOP on ia32 and amd64. 20090803: - RELENG_8 branched. + stable/8 branch created in subversion. 20090719: Bump the shared library version numbers for all libraries that do not From ache at FreeBSD.org Thu Sep 3 17:37:23 2009 From: ache at FreeBSD.org (Andrey A. Chernov) Date: Thu Sep 3 17:37:35 2009 Subject: svn commit: r196792 - head/share/numericdef Message-ID: <200909031737.n83HbNYr040047@svn.freebsd.org> Author: ache Date: Thu Sep 3 17:37:23 2009 New Revision: 196792 URL: http://svn.freebsd.org/changeset/base/196792 Log: Add lv_LV Modified: head/share/numericdef/Makefile Modified: head/share/numericdef/Makefile ============================================================================== --- head/share/numericdef/Makefile Thu Sep 3 17:13:54 2009 (r196791) +++ head/share/numericdef/Makefile Thu Sep 3 17:37:23 2009 (r196792) @@ -107,7 +107,8 @@ ISO8859-5_CP1251= uk_UA ISO8859-7_UTF-8= el_GR ISO8859-9_UTF-8= tr_TR ISO8859-13_ISO8859-4= lt_LT -ISO8859-13_UTF-8= lt_LT +ISO8859-13_ISO8859-13= lt_LT:lv_LV +ISO8859-13_UTF-8= lt_LT lt_LT:lv_LV ISO8859-15_UTF-8= et_EE KOI8-R_CP1251= ru_RU KOI8-R_CP866= ru_RU From ivoras at freebsd.org Thu Sep 3 17:38:08 2009 From: ivoras at freebsd.org (Ivan Voras) Date: Thu Sep 3 17:39:50 2009 Subject: svn commit: r196777 - head/sys/dev/ahci In-Reply-To: <20090903095224.N20031@pooker.samsco.org> References: <200909031237.n83CbIgk032551@svn.freebsd.org> <1872D962-9297-4C45-9F73-4BB823C49D74@samsco.org> <4A9FD8B4.2080605@FreeBSD.org> <20090903095224.N20031@pooker.samsco.org> Message-ID: <9bbcef730909031037y4aecd692t4812718b1fd7e78e@mail.gmail.com> 2009/9/3 Scott Long : > On Thu, 3 Sep 2009, Alexander Motin wrote: >> It would be nice if every level would do it's own job. > > It's the job of the driver to handle the limitations of the hardware, yes. > Again, if you want to experiment with pushing this functionality into GEOM, > be my guest. ?But until then, consider following my advice. Speaking as an user who goes "huh, well" every time he sees a RAID card with a GB of cache talking to the OS in 64 kB chunks, eventually removing this limitation seems a Nice Thing to Have. I don't know how things look at the driver side, but GEOM by itself has no problems passing around requests of at least "long" in length. Specifically, it cares about struct bio, where bio_bcount is a "long" and bio_length and bio_completed are off_t. So, ssize_t looks ok as a high boundary. There was a time (apparently much of it was a bug in reporting and is now fixed :( ) when MAXPHYS could be manually redefined to be 256K or more and iostat would nicely state the higher value. I think the concern raised at the topic was that it doesn't play nice with bufcache, and I think the specific problem was possible out-of-memory situations. Now that kernel limits on AMD64 are much increased (to values not longer fitting in uint32_t) I wonder if the problem is so serious? I also remember BSDCan 2008: http://wiki.freebsd.org/Buf0x :) -- f+rEnSIBITAhITAhLR1nM9F4cIs5KJrhbcsVtUIt7K1MhWJy1A== From scottl at samsco.org Thu Sep 3 17:51:00 2009 From: scottl at samsco.org (Scott Long) Date: Thu Sep 3 17:51:12 2009 Subject: svn commit: r196777 - head/sys/dev/ahci In-Reply-To: <9bbcef730909031037y4aecd692t4812718b1fd7e78e@mail.gmail.com> References: <200909031237.n83CbIgk032551@svn.freebsd.org> <1872D962-9297-4C45-9F73-4BB823C49D74@samsco.org> <4A9FD8B4.2080605@FreeBSD.org> <20090903095224.N20031@pooker.samsco.org> <9bbcef730909031037y4aecd692t4812718b1fd7e78e@mail.gmail.com> Message-ID: <20090903114121.C20031@pooker.samsco.org> On Thu, 3 Sep 2009, Ivan Voras wrote: > 2009/9/3 Scott Long : >> On Thu, 3 Sep 2009, Alexander Motin wrote: > >>> It would be nice if every level would do it's own job. >> >> It's the job of the driver to handle the limitations of the hardware, yes. >> Again, if you want to experiment with pushing this functionality into GEOM, >> be my guest. ?But until then, consider following my advice. > > Speaking as an user who goes "huh, well" every time he sees a RAID > card with a GB of cache talking to the OS in 64 kB chunks, eventually > removing this limitation seems a Nice Thing to Have. > > I don't know how things look at the driver side, but GEOM by itself > has no problems passing around requests of at least "long" in length. > Specifically, it cares about struct bio, where bio_bcount is a "long" > and bio_length and bio_completed are off_t. So, ssize_t looks ok as a > high boundary. > > There was a time (apparently much of it was a bug in reporting and is > now fixed :( ) when MAXPHYS could be manually redefined to be 256K or > more and iostat would nicely state the higher value. I think the > concern raised at the topic was that it doesn't play nice with > bufcache, and I think the specific problem was possible out-of-memory > situations. Now that kernel limits on AMD64 are much increased (to > values not longer fitting in uint32_t) I wonder if the problem is so > serious? > The problem is lack of kernel address space, not lack of RAM, but that's just semantics in this discussion. I've tested with increasing MAXPHYS in increments to 1M. Performance increases logrithmically, and effectively hits a max at 512K for the variety of controllers that I tested. The gain from 64K to 128K is huge, the gain from 128K to 256K is ok, the gain from 256k to 512k is measurable but less significant, and the gain from 512k to 1m is almost not measurable. I have simple patches to increase MAXPHYS. The introduction of the the maxio paramter in the CAM SIM interface is there in preparation for this. However, a _LOT_LOT_LOT_ of drivers in the tree falsely assume that MAXPHYS and DEFLTPHYS are 128k and 64k respectively, and size their data structures accordingly. Changing these values will cause the drivers to fail in bad ways. So an audit needs to be done. Also, MAXPHYS is abused by the swapper in the struct-buf, so that needs to be reviewed as well. Even though kernel address space is less restricted on 64bit platforms, it's still not free and limitless. Large I/O's requires more work in the VM to assign address space, and in turn causes more lock contention. I haven't done any practical measurements of this on common workloads, but I can anecdotally say that I see increased lock contention from it in locking profiles. If FreeBSD wants to seriously increase MAXPHYS, this needs to be looked at and either proven to not be important, or fixed. Scott From brian at FreeBSD.org Thu Sep 3 18:16:03 2009 From: brian at FreeBSD.org (Brian Somers) Date: Thu Sep 3 18:16:15 2009 Subject: svn commit: r196793 - stable/7/usr.sbin/ppp Message-ID: <200909031816.n83IG3jB041106@svn.freebsd.org> Author: brian Date: Thu Sep 3 18:16:03 2009 New Revision: 196793 URL: http://svn.freebsd.org/changeset/base/196793 Log: MFC r196530: Document that ppp handles pipe(2) descriptors specially in -direct mode. Modified: stable/7/usr.sbin/ppp/ (props changed) stable/7/usr.sbin/ppp/ppp.8.m4 Modified: stable/7/usr.sbin/ppp/ppp.8.m4 ============================================================================== --- stable/7/usr.sbin/ppp/ppp.8.m4 Thu Sep 3 17:37:23 2009 (r196792) +++ stable/7/usr.sbin/ppp/ppp.8.m4 Thu Sep 3 18:16:03 2009 (r196793) @@ -27,7 +27,7 @@ changecom(,)dnl .\" .\" $FreeBSD$ .\" -.Dd May 24, 2007 +.Dd August 25, 2009 .Dt PPP 8 .Os .Sh NAME @@ -171,6 +171,17 @@ If callback is configured, will use the .Dq set device information when dialing back. +.Pp +When run in +.Fl direct +mode, +.Nm +will behave slightly differently if descriptor 0 was created by +.Xr pipe 2 . +As pipes are not bi-directional, ppp will redirect all writes to descriptor +1 (standard output), leaving only reads acting on descriptor 0. +No special action is taken if descriptor 0 was created by +.Xr socketpair 2 . .It Fl dedicated This option is designed for machines connected with a dedicated wire. @@ -6070,6 +6081,8 @@ This socket is used to pass links betwee .Xr tcpdump 1 , .Xr telnet 1 , .Xr kldload 2 , +.Xr pipe 2 , +.Xr socketpair 2 , ifdef({LOCALNAT},{},{.Xr libalias 3 , })dnl ifdef({LOCALRAD},{},{.Xr libradius 3 , From jhb at freebsd.org Thu Sep 3 18:38:41 2009 From: jhb at freebsd.org (John Baldwin) Date: Thu Sep 3 18:38:53 2009 Subject: svn commit: r196791 - head In-Reply-To: <200909031713.n83HDsFc039487@svn.freebsd.org> References: <200909031713.n83HDsFc039487@svn.freebsd.org> Message-ID: <200909031356.52226.jhb@freebsd.org> On Thursday 03 September 2009 1:13:54 pm Warner Losh wrote: > Author: imp > Date: Thu Sep 3 17:13:54 2009 > New Revision: 196791 > URL: http://svn.freebsd.org/changeset/base/196791 > > Log: > Actually, stable/8 is what was created... Technically both were done: RELENG_8 in CVS and stable/8 in SVN. That said, it is probably better to document SVN rather than CVS going forward. -- John Baldwin From mav at FreeBSD.org Thu Sep 3 19:02:18 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Thu Sep 3 19:02:24 2009 Subject: svn commit: r196796 - head/sys/dev/ahci Message-ID: <200909031902.n83J2HZC042128@svn.freebsd.org> Author: mav Date: Thu Sep 3 19:02:17 2009 New Revision: 196796 URL: http://svn.freebsd.org/changeset/base/196796 Log: Round maxio for ATI SB600 to 64K. Submitted by: scottl@ Modified: head/sys/dev/ahci/ahci.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Thu Sep 3 18:27:55 2009 (r196795) +++ head/sys/dev/ahci/ahci.c Thu Sep 3 19:02:17 2009 (r196796) @@ -1944,7 +1944,7 @@ ahciaction(struct cam_sim *sim, union cc cpi->maxio = MAXPHYS; /* ATI SB600 can't handle 256 sectors with FPDMA (NCQ). */ if (pci_get_devid(device_get_parent(dev)) == 0x43801002) - cpi->maxio = min(cpi->maxio, 255 * 512); + cpi->maxio = min(cpi->maxio, 128 * 512); cpi->ccb_h.status = CAM_REQ_CMP; xpt_done(ccb); break; From kostikbel at gmail.com Thu Sep 3 19:15:55 2009 From: kostikbel at gmail.com (Kostik Belousov) Date: Thu Sep 3 19:16:01 2009 Subject: svn commit: r196779 - in head/sys: kern sys In-Reply-To: <200909031340.n83Defkv034013@svn.freebsd.org> References: <200909031340.n83Defkv034013@svn.freebsd.org> Message-ID: <20090903191548.GJ1881@deviant.kiev.zoral.com.ua> On Thu, Sep 03, 2009 at 01:40:41PM +0000, Attilio Rao wrote: > Author: attilio > Date: Thu Sep 3 13:40:41 2009 > New Revision: 196779 > URL: http://svn.freebsd.org/changeset/base/196779 > > Log: > Add intermediate states for attaching and detaching that will be > reused by the enhached newbus locking once it is checked in. > This change can be easilly MFCed to STABLE_8 at the appropriate moment. > > Reviewed by: jhb, scottl > Tested by: Giovanni Trematerra > .... > Modified: head/sys/sys/bus.h > ============================================================================== > --- head/sys/sys/bus.h Thu Sep 3 12:41:00 2009 (r196778) > +++ head/sys/sys/bus.h Thu Sep 3 13:40:41 2009 (r196779) > @@ -52,8 +52,11 @@ struct u_businfo { > typedef enum device_state { > DS_NOTPRESENT, /**< @brief not probed or probe failed */ > DS_ALIVE, /**< @brief probe succeeded */ > + DS_ATTACHING, /**< @brief attaching is in progress */ > DS_ATTACHED, /**< @brief attach method called */ > - DS_BUSY /**< @brief device is open */ > + DS_BUSY, /**< @brief device is open */ > + DS_DETACHING /**< @brief detaching is in progress */ > + > } device_state_t; Since device_state_t is exposed to consumers and started to be modified, would it make sense to add explicit values for enumeration members, with enough gap in between ? It seems to give more freedom for newbus locking work with regard to backward-compatible ABI changes. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090903/edac1b1a/attachment.pgp From ivoras at freebsd.org Thu Sep 3 19:45:29 2009 From: ivoras at freebsd.org (Ivan Voras) Date: Thu Sep 3 19:45:36 2009 Subject: svn commit: r196777 - head/sys/dev/ahci In-Reply-To: <20090903114121.C20031@pooker.samsco.org> References: <200909031237.n83CbIgk032551@svn.freebsd.org> <1872D962-9297-4C45-9F73-4BB823C49D74@samsco.org> <4A9FD8B4.2080605@FreeBSD.org> <20090903095224.N20031@pooker.samsco.org> <9bbcef730909031037y4aecd692t4812718b1fd7e78e@mail.gmail.com> <20090903114121.C20031@pooker.samsco.org> Message-ID: <9bbcef730909031245o7c380925sd29b2cc976c4d7dd@mail.gmail.com> 2009/9/3 Scott Long : > The problem is lack of kernel address space, not lack of RAM, but that's Yes. > just semantics in this discussion. ?I've tested with increasing MAXPHYS in > increments to 1M. ?Performance increases logrithmically, and effectively > hits a max at 512K for the variety of controllers that I tested. ?The gain > from 64K to 128K is huge, the gain from 128K to 256K is ok, the gain from > 256k to 512k is measurable but less significant, and the gain from 512k to > 1m is almost not measurable. >From what I've seen with iostat, all machines I can currently test (SATA, various SCSI-like RAID, QLogic FC HBA), 64 k is the maximum transfer size, which I assume is DFLTPHYS. From your tests it's apparent it is suboptimal... > I have simple patches to increase MAXPHYS. ?The introduction of the the > maxio paramter in the CAM SIM interface is there in preparation for this. > However, a _LOT_LOT_LOT_ of drivers in the tree falsely assume that MAXPHYS > and DEFLTPHYS are 128k and 64k respectively, and size their data structures > accordingly. ?Changing these values will cause the drivers to fail in bad > ways. ?So an audit needs to be done. ?Also, MAXPHYS is abused by the swapper > in the struct-buf, so that needs to be reviewed as well. Since GEOM is ok with it, couldn't a migration path be to introduce a new tunable, something like LARGE_MAXPHYS (or to rename it completely to MAX_IO) or whatever and use it (after reviewing cases of abuses) in new and better maintained drivers? If the new size is larger than the old one, maybe the maximum damage would be a little bit of wasted space now and then? I can test mostly ciss and mfi. I see mfi uses it in one place that looks kind of logical: 334 /* 335 * Get information needed for sizing the contiguous memory for the 336 * frame pool. Size down the sgl parameter since we know that 337 * we will never need more than what's required for MAXPHYS. 338 * It would be nice if these constants were available at runtime 339 * instead of compile time. 340 */ 341 status = sc->mfi_read_fw_status(sc); 342 sc->mfi_max_fw_cmds = status & MFI_FWSTATE_MAXCMD_MASK; 343 max_fw_sge = (status & MFI_FWSTATE_MAXSGL_MASK) >> 16; 344 sc->mfi_max_sge = min(max_fw_sge, ((MAXPHYS / PAGE_SIZE) + 1)); But ciss doesn't reference it at all so either it deviously assumes it or is independent of it. > Even though kernel address space is less restricted on 64bit platforms, it's > still not free and limitless. ?Large I/O's requires more work in the VM to > assign address space, and in turn causes more lock contention. ?I haven't > done any practical measurements of this on common workloads, but I can > anecdotally say that I see increased lock contention from it in locking > profiles. ?If FreeBSD wants to seriously increase MAXPHYS, this needs to be > looked at and either proven to not be important, or fixed. I think the major benefits would be for the server-side crowd using RAID modes with some kind of striping. -- f+rEnSIBITAhITAhLR1nM9F4cIs5KJrhbcsVtUIt7K1MhWJy1A== From jhb at freebsd.org Thu Sep 3 20:10:01 2009 From: jhb at freebsd.org (John Baldwin) Date: Thu Sep 3 20:10:07 2009 Subject: svn commit: r196777 - head/sys/dev/ahci In-Reply-To: <9bbcef730909031245o7c380925sd29b2cc976c4d7dd@mail.gmail.com> References: <200909031237.n83CbIgk032551@svn.freebsd.org> <20090903114121.C20031@pooker.samsco.org> <9bbcef730909031245o7c380925sd29b2cc976c4d7dd@mail.gmail.com> Message-ID: <200909031602.01222.jhb@freebsd.org> On Thursday 03 September 2009 3:45:07 pm Ivan Voras wrote: > But ciss doesn't reference it at all so either it deviously assumes it > or is independent of it. Actually, it may be much worse, it may be that the author of ciss(4) new that ciss(4)'s largest supported I/O size was larger than 128k so they didn't bother handling the limit at all giving the false impression the hardware has no limit. -- John Baldwin From zec at icir.org Thu Sep 3 20:26:05 2009 From: zec at icir.org (Marko Zec) Date: Thu Sep 3 20:26:16 2009 Subject: svn commit: r196769 - in head/sys: amd64/amd64 i386/i386 In-Reply-To: <200909021602.n82G2mpE000812@svn.freebsd.org> References: <200909021602.n82G2mpE000812@svn.freebsd.org> Message-ID: <200909032225.50210.zec@icir.org> On Wednesday 02 September 2009 18:02:48 Jung-uk Kim wrote: > Author: jkim > Date: Wed Sep 2 16:02:48 2009 > New Revision: 196769 > URL: http://svn.freebsd.org/changeset/base/196769 > > Log: > - Work around ACPI mode transition problem for recent NVIDIA 9400M > chipset based Intel Macs. Since r189055, these platforms started freezing > when ACPI is being initialized for unknown reason. For these platforms, we > just use the old PAT layout. Note this change is not enough to boot fully > on these platforms because of other problems but it makes debugging > possible. Note MacBook5,2 may be affected as well but it was not added here > because of lack of hardware to test. > - Initialize PAT MSR fully instead of reading and modifying it for > safety. Perhaps I'm missing something, but I fail to understand what is the purpose / use of variable pat_tested here? Marko > Reported by: rpaulo, hps, Eygene Ryabinkin (rea-fbsd at codelabs dot ru) > Reviewed by: jhb > > Modified: > head/sys/amd64/amd64/pmap.c > head/sys/i386/i386/pmap.c > > Modified: head/sys/amd64/amd64/pmap.c > =========================================================================== >=== --- head/sys/amd64/amd64/pmap.c Wed Sep 2 14:56:23 2009 (r196768) +++ > head/sys/amd64/amd64/pmap.c Wed Sep 2 16:02:48 2009 (r196769) @@ -178,6 > +178,8 @@ static vm_paddr_t dmaplimit; > vm_offset_t kernel_vm_end = VM_MIN_KERNEL_ADDRESS; > pt_entry_t pg_nx; > > +static int pat_works = 0; /* Is page attribute table sane? */ > + > SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters"); > > static int pg_ps_enabled = 1; > @@ -590,20 +592,56 @@ void > pmap_init_pat(void) > { > uint64_t pat_msr; > + char *sysenv; > + static int pat_tested = 0; > > /* Bail if this CPU doesn't implement PAT. */ > if (!(cpu_feature & CPUID_PAT)) > panic("no PAT??"); > > /* > - * Leave the indices 0-3 at the default of WB, WT, UC, and UC-. > - * Program 4 and 5 as WP and WC. > - * Leave 6 and 7 as UC and UC-. > - */ > - pat_msr = rdmsr(MSR_PAT); > - pat_msr &= ~(PAT_MASK(4) | PAT_MASK(5)); > - pat_msr |= PAT_VALUE(4, PAT_WRITE_PROTECTED) | > - PAT_VALUE(5, PAT_WRITE_COMBINING); > + * Some Apple Macs based on nVidia chipsets cannot enter ACPI mode > + * via SMI# when we use upper 4 PAT entries for unknown reason. > + */ > + if (!pat_tested) { > + pat_works = 1; > + sysenv = getenv("smbios.system.product"); > + if (sysenv != NULL) { > + if (strncmp(sysenv, "MacBook5,1", 10) == 0 || > + strncmp(sysenv, "MacBookPro5,5", 13) == 0 || > + strncmp(sysenv, "Macmini3,1", 10) == 0) > + pat_works = 0; > + freeenv(sysenv); > + } > + pat_tested = 1; > + } > + > + /* Initialize default PAT entries. */ > + pat_msr = PAT_VALUE(0, PAT_WRITE_BACK) | > + PAT_VALUE(1, PAT_WRITE_THROUGH) | > + PAT_VALUE(2, PAT_UNCACHED) | > + PAT_VALUE(3, PAT_UNCACHEABLE) | > + PAT_VALUE(4, PAT_WRITE_BACK) | > + PAT_VALUE(5, PAT_WRITE_THROUGH) | > + PAT_VALUE(6, PAT_UNCACHED) | > + PAT_VALUE(7, PAT_UNCACHEABLE); > + > + if (pat_works) { > + /* > + * Leave the indices 0-3 at the default of WB, WT, UC, and UC-. > + * Program 4 and 5 as WP and WC. > + * Leave 6 and 7 as UC and UC-. > + */ > + pat_msr &= ~(PAT_MASK(4) | PAT_MASK(5)); > + pat_msr |= PAT_VALUE(4, PAT_WRITE_PROTECTED) | > + PAT_VALUE(5, PAT_WRITE_COMBINING); > + } else { > + /* > + * Just replace PAT Index 2 with WC instead of UC-. > + */ > + pat_msr &= ~PAT_MASK(2); > + pat_msr |= PAT_VALUE(2, PAT_WRITE_COMBINING); > + } > wrmsr(MSR_PAT, pat_msr); > } > > @@ -754,27 +792,48 @@ pmap_cache_bits(int mode, boolean_t is_p > pat_flag = is_pde ? PG_PDE_PAT : PG_PTE_PAT; > > /* Map the caching mode to a PAT index. */ > - switch (mode) { > - case PAT_UNCACHEABLE: > - pat_index = 3; > - break; > - case PAT_WRITE_THROUGH: > - pat_index = 1; > - break; > - case PAT_WRITE_BACK: > - pat_index = 0; > - break; > - case PAT_UNCACHED: > - pat_index = 2; > - break; > - case PAT_WRITE_COMBINING: > - pat_index = 5; > - break; > - case PAT_WRITE_PROTECTED: > - pat_index = 4; > - break; > - default: > - panic("Unknown caching mode %d\n", mode); > + if (pat_works) { > + switch (mode) { > + case PAT_UNCACHEABLE: > + pat_index = 3; > + break; > + case PAT_WRITE_THROUGH: > + pat_index = 1; > + break; > + case PAT_WRITE_BACK: > + pat_index = 0; > + break; > + case PAT_UNCACHED: > + pat_index = 2; > + break; > + case PAT_WRITE_COMBINING: > + pat_index = 5; > + break; > + case PAT_WRITE_PROTECTED: > + pat_index = 4; > + break; > + default: > + panic("Unknown caching mode %d\n", mode); > + } > + } else { > + switch (mode) { > + case PAT_UNCACHED: > + case PAT_UNCACHEABLE: > + case PAT_WRITE_PROTECTED: > + pat_index = 3; > + break; > + case PAT_WRITE_THROUGH: > + pat_index = 1; > + break; > + case PAT_WRITE_BACK: > + pat_index = 0; > + break; > + case PAT_WRITE_COMBINING: > + pat_index = 2; > + break; > + default: > + panic("Unknown caching mode %d\n", mode); > + } > } > > /* Map the 3-bit index value into the PAT, PCD, and PWT bits. */ > > Modified: head/sys/i386/i386/pmap.c > =========================================================================== >=== --- head/sys/i386/i386/pmap.c Wed Sep 2 14:56:23 2009 (r196768) > +++ head/sys/i386/i386/pmap.c Wed Sep 2 16:02:48 2009 (r196769) > @@ -212,7 +212,7 @@ pt_entry_t pg_nx; > static uma_zone_t pdptzone; > #endif > > -static int pat_works; /* Is page attribute table sane? */ > +static int pat_works = 0; /* Is page attribute table sane? */ > > SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters"); > > @@ -478,40 +478,69 @@ void > pmap_init_pat(void) > { > uint64_t pat_msr; > + char *sysenv; > + static int pat_tested = 0; > > /* Bail if this CPU doesn't implement PAT. */ > if (!(cpu_feature & CPUID_PAT)) > return; > > - if (cpu_vendor_id != CPU_VENDOR_INTEL || > - (I386_CPU_FAMILY(cpu_id) == 6 && I386_CPU_MODEL(cpu_id) >= 0xe)) { > + /* > + * Due to some Intel errata, we can only safely use the lower 4 > + * PAT entries. > + * > + * Intel Pentium III Processor Specification Update > + * Errata E.27 (Upper Four PAT Entries Not Usable With Mode B > + * or Mode C Paging) > + * > + * Intel Pentium IV Processor Specification Update > + * Errata N46 (PAT Index MSB May Be Calculated Incorrectly) > + * > + * Some Apple Macs based on nVidia chipsets cannot enter ACPI mode > + * via SMI# when we use upper 4 PAT entries for unknown reason. > + */ > + if (!pat_tested) { > + if (cpu_vendor_id != CPU_VENDOR_INTEL || > + (I386_CPU_FAMILY(cpu_id) == 6 && > + I386_CPU_MODEL(cpu_id) >= 0xe)) { > + pat_works = 1; > + sysenv = getenv("smbios.system.product"); > + if (sysenv != NULL) { > + if (strncmp(sysenv, "MacBook5,1", 10) == 0 || > + strncmp(sysenv, "MacBookPro5,5", 13) == 0 || > + strncmp(sysenv, "Macmini3,1", 10) == 0) > + pat_works = 0; > + freeenv(sysenv); > + } > + } > + pat_tested = 1; > + } > + > + /* Initialize default PAT entries. */ > + pat_msr = PAT_VALUE(0, PAT_WRITE_BACK) | > + PAT_VALUE(1, PAT_WRITE_THROUGH) | > + PAT_VALUE(2, PAT_UNCACHED) | > + PAT_VALUE(3, PAT_UNCACHEABLE) | > + PAT_VALUE(4, PAT_WRITE_BACK) | > + PAT_VALUE(5, PAT_WRITE_THROUGH) | > + PAT_VALUE(6, PAT_UNCACHED) | > + PAT_VALUE(7, PAT_UNCACHEABLE); > + > + if (pat_works) { > /* > * Leave the indices 0-3 at the default of WB, WT, UC, and UC-. > * Program 4 and 5 as WP and WC. > * Leave 6 and 7 as UC and UC-. > */ > - pat_msr = rdmsr(MSR_PAT); > pat_msr &= ~(PAT_MASK(4) | PAT_MASK(5)); > pat_msr |= PAT_VALUE(4, PAT_WRITE_PROTECTED) | > PAT_VALUE(5, PAT_WRITE_COMBINING); > - pat_works = 1; > } else { > /* > - * Due to some Intel errata, we can only safely use the lower 4 > - * PAT entries. Thus, just replace PAT Index 2 with WC instead > - * of UC-. > - * > - * Intel Pentium III Processor Specification Update > - * Errata E.27 (Upper Four PAT Entries Not Usable With Mode B > - * or Mode C Paging) > - * > - * Intel Pentium IV Processor Specification Update > - * Errata N46 (PAT Index MSB May Be Calculated Incorrectly) > + * Just replace PAT Index 2 with WC instead of UC-. > */ > - pat_msr = rdmsr(MSR_PAT); > pat_msr &= ~PAT_MASK(2); > pat_msr |= PAT_VALUE(2, PAT_WRITE_COMBINING); > - pat_works = 0; > } > wrmsr(MSR_PAT, pat_msr); > } From scottl at samsco.org Thu Sep 3 20:31:11 2009 From: scottl at samsco.org (Scott Long) Date: Thu Sep 3 20:31:33 2009 Subject: svn commit: r196777 - head/sys/dev/ahci In-Reply-To: <200909031602.01222.jhb@freebsd.org> References: <200909031237.n83CbIgk032551@svn.freebsd.org> <20090903114121.C20031@pooker.samsco.org> <9bbcef730909031245o7c380925sd29b2cc976c4d7dd@mail.gmail.com> <200909031602.01222.jhb@freebsd.org> Message-ID: On Sep 3, 2009, at 2:02 PM, John Baldwin wrote: > On Thursday 03 September 2009 3:45:07 pm Ivan Voras wrote: >> But ciss doesn't reference it at all so either it deviously assumes >> it >> or is independent of it. > > Actually, it may be much worse, it may be that the author of ciss(4) > new that > ciss(4)'s largest supported I/O size was larger than 128k so they > didn't > bother handling the limit at all giving the false impression the > hardware has > no limit. You're exactly right. The solution is to do a proper audit and fix the potential problems, not add yet another 1-off flag that avoids doing real work. If you want to help, keep in mind that I need help _generating_ patches, not testing them. I appreciate all of the testing goodwill out there, but analysis and fixing goodwill is needed at this phase. Scott From jkim at FreeBSD.org Thu Sep 3 20:52:01 2009 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Thu Sep 3 20:52:07 2009 Subject: svn commit: r196769 - in head/sys: amd64/amd64 i386/i386 In-Reply-To: <200909032225.50210.zec@icir.org> References: <200909021602.n82G2mpE000812@svn.freebsd.org> <200909032225.50210.zec@icir.org> Message-ID: <200909031651.49575.jkim@FreeBSD.org> On Thursday 03 September 2009 04:25 pm, Marko Zec wrote: > On Wednesday 02 September 2009 18:02:48 Jung-uk Kim wrote: > > Author: jkim > > Date: Wed Sep 2 16:02:48 2009 > > New Revision: 196769 > > URL: http://svn.freebsd.org/changeset/base/196769 > > > > Log: > > - Work around ACPI mode transition problem for recent NVIDIA > > 9400M chipset based Intel Macs. Since r189055, these platforms > > started freezing when ACPI is being initialized for unknown > > reason. For these platforms, we just use the old PAT layout. > > Note this change is not enough to boot fully on these platforms > > because of other problems but it makes debugging possible. Note > > MacBook5,2 may be affected as well but it was not added here > > because of lack of hardware to test. > > - Initialize PAT MSR fully instead of reading and modifying it > > for safety. > > Perhaps I'm missing something, but I fail to understand what is the > purpose / use of variable pat_tested here? Without it, bad things may happen while APs are being initialized in SMP case. Jung-uk Kim From gnn at FreeBSD.org Thu Sep 3 21:10:57 2009 From: gnn at FreeBSD.org (George V. Neville-Neil) Date: Thu Sep 3 21:11:04 2009 Subject: svn commit: r196797 - in head: sys/net sys/netinet usr.bin/netstat Message-ID: <200909032110.n83LAvUF044731@svn.freebsd.org> Author: gnn Date: Thu Sep 3 21:10:57 2009 New Revision: 196797 URL: http://svn.freebsd.org/changeset/base/196797 Log: Add ARP statistics to the kernel and netstat. New counters now exist for: requests sent replies sent requests received replies received packets received total packets dropped due to no ARP entry entrys timed out Duplicate IPs seen The new statistics are seen in the netstat command when it is given the -s command line switch. MFC after: 2 weeks In collaboration with: bz Modified: head/sys/net/if_arp.h head/sys/netinet/if_ether.c head/usr.bin/netstat/inet.c head/usr.bin/netstat/main.c head/usr.bin/netstat/netstat.h Modified: head/sys/net/if_arp.h ============================================================================== --- head/sys/net/if_arp.h Thu Sep 3 19:02:17 2009 (r196796) +++ head/sys/net/if_arp.h Thu Sep 3 21:10:57 2009 (r196797) @@ -108,6 +108,31 @@ struct arpcom { #define IFP2AC(ifp) ((struct arpcom *)(ifp->if_l2com)) #define AC2IFP(ac) ((ac)->ac_ifp) -#endif +#endif /* _KERNEL */ + +struct arpstat { + /* Normal things that happen: */ + u_long txrequests; /* # of ARP requests sent by this host. */ + u_long txreplies; /* # of ARP replies sent by this host. */ + u_long rxrequests; /* # of ARP requests received by this host. */ + u_long rxreplies; /* # of ARP replies received by this host. */ + u_long received; /* # of ARP packets received by this host. */ + + u_long arp_spares[4]; /* For either the upper or lower half. */ + /* Abnormal event and error counting: */ + u_long dropped; /* # of packets dropped waiting for a reply. */ + u_long timeouts; /* # of times with entries removed */ + /* due to timeout. */ + u_long dupips; /* # of duplicate IPs detected. */ +}; + +/* + * In-kernel consumers can use these accessor macros directly to update + * stats. + */ +#define ARPSTAT_ADD(name, val) V_arpstat.name += (val) +#define ARPSTAT_SUB(name, val) V_arpstat.name -= (val) +#define ARPSTAT_INC(name) ARPSTAT_ADD(name, 1) +#define ARPSTAT_DEC(name) ARPSTAT_SUB(name, 1) #endif /* !_NET_IF_ARP_H_ */ Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Thu Sep 3 19:02:17 2009 (r196796) +++ head/sys/netinet/if_ether.c Thu Sep 3 21:10:57 2009 (r196797) @@ -80,6 +80,7 @@ __FBSDID("$FreeBSD$"); SYSCTL_DECL(_net_link_ether); SYSCTL_NODE(_net_link_ether, PF_INET, inet, CTLFLAG_RW, 0, ""); +SYSCTL_NODE(_net_link_ether, PF_ARP, arp, CTLFLAG_RW, 0, ""); VNET_DEFINE(int, useloopback) = 1; /* use loopback interface for * local traffic */ @@ -89,10 +90,12 @@ static VNET_DEFINE(int, arpt_keep) = (20 * minutes */ static VNET_DEFINE(int, arp_maxtries) = 5; static VNET_DEFINE(int, arp_proxyall); +static VNET_DEFINE(struct arpstat, arpstat); /* ARP statistics, see if_arp.h */ #define V_arpt_keep VNET(arpt_keep) #define V_arp_maxtries VNET(arp_maxtries) #define V_arp_proxyall VNET(arp_proxyall) +#define V_arpstat VNET(arpstat) SYSCTL_VNET_INT(_net_link_ether_inet, OID_AUTO, max_age, CTLFLAG_RW, &VNET_NAME(arpt_keep), 0, @@ -107,6 +110,9 @@ SYSCTL_VNET_INT(_net_link_ether_inet, OI SYSCTL_VNET_INT(_net_link_ether_inet, OID_AUTO, proxyall, CTLFLAG_RW, &VNET_NAME(arp_proxyall), 0, "Enable proxy ARP for all suitable requests"); +SYSCTL_VNET_STRUCT(_net_link_ether_arp, OID_AUTO, stats, CTLFLAG_RW, + &VNET_NAME(arpstat), arpstat, + "ARP statistics (struct arpstat, net/if_arp.h)"); static void arp_init(void); void arprequest(struct ifnet *, @@ -163,20 +169,23 @@ arptimer(void *arg) return; } ifp = lle->lle_tbl->llt_ifp; + CURVNET_SET(ifp->if_vnet); IF_AFDATA_LOCK(ifp); LLE_WLOCK(lle); - if (((lle->la_flags & LLE_DELETED) - || (time_second >= lle->la_expire)) - && (!callout_pending(&lle->la_timer) && - callout_active(&lle->la_timer))) + if (((lle->la_flags & LLE_DELETED) || + (time_second >= lle->la_expire)) && + (!callout_pending(&lle->la_timer) && + callout_active(&lle->la_timer))) { (void) llentry_free(lle); - else { + ARPSTAT_INC(timeouts); + } else { /* * Still valid, just drop our reference */ LLE_FREE_LOCKED(lle); } IF_AFDATA_UNLOCK(ifp); + CURVNET_RESTORE(); } /* @@ -238,6 +247,7 @@ arprequest(struct ifnet *ifp, struct in_ sa.sa_len = 2; m->m_flags |= M_BCAST; (*ifp->if_output)(ifp, m, &sa, NULL); + ARPSTAT_INC(txrequests); } /* @@ -339,8 +349,10 @@ retry: * latest one. */ if (m != NULL) { - if (la->la_hold != NULL) + if (la->la_hold != NULL) { m_freem(la->la_hold); + ARPSTAT_INC(dropped); + } la->la_hold = m; if (renew == 0 && (flags & LLE_EXCLUSIVE)) { flags &= ~LLE_EXCLUSIVE; @@ -413,6 +425,7 @@ arpintr(struct mbuf *m) ar = mtod(m, struct arphdr *); } + ARPSTAT_INC(received); switch (ntohs(ar->ar_pro)) { #ifdef INET case ETHERTYPE_IP: @@ -493,6 +506,9 @@ in_arpinput(struct mbuf *m) (void)memcpy(&isaddr, ar_spa(ah), sizeof (isaddr)); (void)memcpy(&itaddr, ar_tpa(ah), sizeof (itaddr)); + if (op == ARPOP_REPLY) + ARPSTAT_INC(rxreplies); + /* * For a bridge, we want to check the address irrespective * of the receive interface. (This will change slightly @@ -603,6 +619,7 @@ match: ifp->if_addrlen, (u_char *)ar_sha(ah), ":", inet_ntoa(isaddr), ifp->if_xname); itaddr = myaddr; + ARPSTAT_INC(dupips); goto reply; } if (ifp->if_flags & IFF_STATICARP) @@ -686,6 +703,7 @@ match: reply: if (op != ARPOP_REQUEST) goto drop; + ARPSTAT_INC(rxrequests); if (itaddr.s_addr == myaddr.s_addr) { /* Shortcut.. the receiving interface is the target. */ @@ -774,6 +792,7 @@ reply: sa.sa_family = AF_ARP; sa.sa_len = 2; (*ifp->if_output)(ifp, m, &sa, NULL); + ARPSTAT_INC(txreplies); return; drop: Modified: head/usr.bin/netstat/inet.c ============================================================================== --- head/usr.bin/netstat/inet.c Thu Sep 3 19:02:17 2009 (r196796) +++ head/usr.bin/netstat/inet.c Thu Sep 3 21:10:57 2009 (r196797) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -871,6 +872,47 @@ ip_stats(u_long off, const char *name, i #undef p1a } +/* + * Dump ARP statistics structure. + */ +void +arp_stats(u_long off, const char *name, int af1 __unused, int proto __unused) +{ + struct arpstat arpstat, zerostat; + size_t len = sizeof(arpstat); + + if (live) { + if (zflag) + memset(&zerostat, 0, len); + if (sysctlbyname("net.link.ether.arp.stats", &arpstat, &len, + zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { + warn("sysctl: net.link.ether.arp.stats"); + return; + } + } else + kread(off, &arpstat, len); + + printf("%s:\n", name); + +#define p(f, m) if (arpstat.f || sflag <= 1) \ + printf(m, arpstat.f, plural(arpstat.f)) +#define p2(f, m) if (arpstat.f || sflag <= 1) \ + printf(m, arpstat.f, pluralies(arpstat.f)) + + p(txrequests, "\t%lu ARP request%s sent\n"); + p2(txreplies, "\t%lu ARP repl%s sent\n"); + p(rxrequests, "\t%lu ARP request%s received\n"); + p2(rxreplies, "\t%lu ARP repl%s received\n"); + p(received, "\t%lu ARP packet%s received\n"); + p(dropped, "\t%lu total packet%s dropped due to no ARP entry\n"); + p(timeouts, "\t%lu ARP entry%s timed out\n"); + p(dupips, "\t%lu Duplicate IP%s seen\n"); +#undef p +#undef p2 +} + + + static const char *icmpnames[ICMP_MAXTYPE + 1] = { "echo reply", /* RFC 792 */ "#1", Modified: head/usr.bin/netstat/main.c ============================================================================== --- head/usr.bin/netstat/main.c Thu Sep 3 19:02:17 2009 (r196796) +++ head/usr.bin/netstat/main.c Thu Sep 3 21:10:57 2009 (r196797) @@ -184,6 +184,8 @@ static struct nlist nl[] = { { .n_name = "_sctpstat" }, #define N_MFCTABLESIZE 54 { .n_name = "_mfctablesize" }, +#define N_ARPSTAT 55 + { .n_name = "_arpstat" }, { .n_name = NULL }, }; @@ -232,6 +234,8 @@ struct protox { carp_stats, NULL, "carp", 1, 0 }, { -1, N_PFSYNCSTAT, 1, NULL, pfsync_stats, NULL, "pfsync", 1, 0 }, + { -1, N_ARPSTAT, 1, NULL, + arp_stats, NULL, "arp", 1, 0 }, { -1, -1, 0, NULL, NULL, NULL, NULL, 0, 0 } }; Modified: head/usr.bin/netstat/netstat.h ============================================================================== --- head/usr.bin/netstat/netstat.h Thu Sep 3 19:02:17 2009 (r196796) +++ head/usr.bin/netstat/netstat.h Thu Sep 3 21:10:57 2009 (r196797) @@ -75,6 +75,7 @@ void udp_stats(u_long, const char *, int void sctp_protopr(u_long, const char *, int, int); void sctp_stats(u_long, const char *, int, int); #endif +void arp_stats(u_long, const char *, int, int); void ip_stats(u_long, const char *, int, int); void icmp_stats(u_long, const char *, int, int); void igmp_stats(u_long, const char *, int, int); From zec at icir.org Thu Sep 3 21:11:13 2009 From: zec at icir.org (Marko Zec) Date: Thu Sep 3 21:11:25 2009 Subject: svn commit: r196769 - in head/sys: amd64/amd64 i386/i386 In-Reply-To: <200909031651.49575.jkim@FreeBSD.org> References: <200909021602.n82G2mpE000812@svn.freebsd.org> <200909032225.50210.zec@icir.org> <200909031651.49575.jkim@FreeBSD.org> Message-ID: <200909032310.59837.zec@icir.org> On Thursday 03 September 2009 22:51:47 Jung-uk Kim wrote: > On Thursday 03 September 2009 04:25 pm, Marko Zec wrote: > > On Wednesday 02 September 2009 18:02:48 Jung-uk Kim wrote: > > > Author: jkim > > > Date: Wed Sep 2 16:02:48 2009 > > > New Revision: 196769 > > > URL: http://svn.freebsd.org/changeset/base/196769 > > > > > > Log: > > > - Work around ACPI mode transition problem for recent NVIDIA > > > 9400M chipset based Intel Macs. Since r189055, these platforms > > > started freezing when ACPI is being initialized for unknown > > > reason. For these platforms, we just use the old PAT layout. > > > Note this change is not enough to boot fully on these platforms > > > because of other problems but it makes debugging possible. Note > > > MacBook5,2 may be affected as well but it was not added here > > > because of lack of hardware to test. > > > - Initialize PAT MSR fully instead of reading and modifying it > > > for safety. > > > > Perhaps I'm missing something, but I fail to understand what is the > > purpose / use of variable pat_tested here? > > Without it, bad things may happen while APs are being initialized in > SMP case. Ouch, OK, only now I see that pat_tested is declared static - I thought it was reset to 0 at each pmap_init_pat() call... Sorry for the noise, Marko From jfv at FreeBSD.org Thu Sep 3 22:00:43 2009 From: jfv at FreeBSD.org (Jack F Vogel) Date: Thu Sep 3 22:00:54 2009 Subject: svn commit: r196798 - head/sys/dev/ixgbe Message-ID: <200909032200.n83M0gTK045771@svn.freebsd.org> Author: jfv Date: Thu Sep 3 22:00:42 2009 New Revision: 196798 URL: http://svn.freebsd.org/changeset/base/196798 Log: Stupid cut and paste error on a stats struct member, thanks to Ryan at Small Tree for finding this one. Modified: head/sys/dev/ixgbe/ixgbe.c Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Thu Sep 3 21:10:57 2009 (r196797) +++ head/sys/dev/ixgbe/ixgbe.c Thu Sep 3 22:00:42 2009 (r196798) @@ -4507,7 +4507,7 @@ ixgbe_update_stats_counters(struct adapt adapter->stats.lxoffrxc += IXGBE_READ_REG(hw, IXGBE_LXOFFRXC); /* 82598 only has a counter in the high register */ adapter->stats.gorc += IXGBE_READ_REG(hw, IXGBE_GORCH); - adapter->stats.gorc += IXGBE_READ_REG(hw, IXGBE_GOTCH); + adapter->stats.gotc += IXGBE_READ_REG(hw, IXGBE_GOTCH); adapter->stats.tor += IXGBE_READ_REG(hw, IXGBE_TORH); } From pjd at FreeBSD.org Thu Sep 3 22:19:10 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Thu Sep 3 22:19:21 2009 Subject: svn commit: r196799 - head/usr.sbin/diskinfo Message-ID: <200909032219.n83MJ9cQ046173@svn.freebsd.org> Author: pjd Date: Thu Sep 3 22:19:09 2009 New Revision: 196799 URL: http://svn.freebsd.org/changeset/base/196799 Log: Don't bother obtaining the ident if we are not going to print it. Modified: head/usr.sbin/diskinfo/diskinfo.c Modified: head/usr.sbin/diskinfo/diskinfo.c ============================================================================== --- head/usr.sbin/diskinfo/diskinfo.c Thu Sep 3 22:00:42 2009 (r196798) +++ head/usr.sbin/diskinfo/diskinfo.c Thu Sep 3 22:19:09 2009 (r196799) @@ -104,9 +104,6 @@ main(int argc, char **argv) error = ioctl(fd, DIOCGFWHEADS, &fwheads); if (error) fwheads = 0; - error = ioctl(fd, DIOCGIDENT, ident); - if (error) - ident[0] = '\0'; if (!opt_v) { printf("%s", argv[i]); printf("\t%u", sectorsize); @@ -133,7 +130,7 @@ main(int argc, char **argv) printf("\t%-12u\t# Heads according to firmware.\n", fwheads); printf("\t%-12u\t# Sectors according to firmware.\n", fwsectors); } - if (ident[0] != '\0') + if (ioctl(fd, DIOCGIDENT, ident) == 0) printf("\t%-12s\t# Disk ident.\n", ident); } printf("\n"); From alfred at freebsd.org Thu Sep 3 23:43:51 2009 From: alfred at freebsd.org (Alfred Perlstein) Date: Thu Sep 3 23:43:57 2009 Subject: svn commit: r196746 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/usb dev/usb/input dev/xen/xenpci In-Reply-To: <20090902094508.GA1964@lonesome.com> References: <200909020212.n822C7Il078379@svn.freebsd.org> <20090902094508.GA1964@lonesome.com> Message-ID: <20090903234350.GG21946@elvis.mu.org> * Mark Linimon [090902 03:05] wrote: > On Wed, Sep 02, 2009 at 02:12:07AM +0000, Alfred Perlstein wrote: > > MFC: r196489,196498 > > Critical USB bugfixes for 8.0 > > Will this change anything for ports? Don't think so, it's kernel fixes for crashdumps and memory handling. -- - Alfred Perlstein .- AMA, VMOA #5191, 03 vmax, 92 gs500, 85 ch250 .- FreeBSD committer From alfred at freebsd.org Thu Sep 3 23:47:37 2009 From: alfred at freebsd.org (Alfred Perlstein) Date: Thu Sep 3 23:47:43 2009 Subject: svn commit: r196746 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/usb dev/usb/input dev/xen/xenpci In-Reply-To: <8497dc1520e5fe6b2b3727d5fb92f358.squirrel@www.jr-hosting.nl> References: <200909020212.n822C7Il078379@svn.freebsd.org> <8497dc1520e5fe6b2b3727d5fb92f358.squirrel@www.jr-hosting.nl> Message-ID: <20090903234737.GH21946@elvis.mu.org> Since this information is available via "svn log -g" maybe we can fix the commit email script to include that infomation instead? -Alfred * Remko Lodder [090901 23:13] wrote: > On Wed, September 2, 2009 4:12 am, Alfred Perlstein wrote: > > Author: alfred > > Date: Wed Sep 2 02:12:07 2009 > > New Revision: 196746 > > URL: http://svn.freebsd.org/changeset/base/196746 > > > > Log: > > MFC: r196489,196498 > > Critical USB bugfixes for 8.0 > > > > Dear Alfred (and hps!), > > It would be awesome to see something more about this in the commit log. I > needed to look up the specific revisions to see what changed. I always > learned from Warner and people, that including the original commit > message(s) saves a lot of time and makes it clear about what is being > merged. > > Can you help and include a bit more information next time please? > > Thanks alot! > > -- > /"\ Best regards, | remko@FreeBSD.org > \ / Remko Lodder | remko@EFnet > X http://www.evilcoder.org/ | > / \ ASCII Ribbon Campaign | Against HTML Mail and News > -- - Alfred Perlstein .- AMA, VMOA #5191, 03 vmax, 92 gs500, 85 ch250 .- FreeBSD committer From jkim at FreeBSD.org Fri Sep 4 01:21:44 2009 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Fri Sep 4 01:21:51 2009 Subject: svn commit: r196804 - in vendor-sys/acpica/dist: . common compiler dispatcher executer include namespace parser tools/acpiexec utilities Message-ID: <200909040121.n841LiYe049782@svn.freebsd.org> Author: jkim Date: Fri Sep 4 01:21:44 2009 New Revision: 196804 URL: http://svn.freebsd.org/changeset/base/196804 Log: Import ACPICA 20090903 Modified: vendor-sys/acpica/dist/changes.txt vendor-sys/acpica/dist/common/dmtbdump.c vendor-sys/acpica/dist/common/dmtbinfo.c vendor-sys/acpica/dist/compiler/aslcompiler.h vendor-sys/acpica/dist/compiler/aslfiles.c vendor-sys/acpica/dist/compiler/aslglobal.h vendor-sys/acpica/dist/compiler/aslload.c vendor-sys/acpica/dist/compiler/aslmain.c vendor-sys/acpica/dist/compiler/asltypes.h vendor-sys/acpica/dist/dispatcher/dsmthdat.c vendor-sys/acpica/dist/dispatcher/dsobject.c vendor-sys/acpica/dist/executer/exstorob.c vendor-sys/acpica/dist/include/acdisasm.h vendor-sys/acpica/dist/include/aclocal.h vendor-sys/acpica/dist/include/acpixf.h vendor-sys/acpica/dist/namespace/nsinit.c vendor-sys/acpica/dist/namespace/nspredef.c vendor-sys/acpica/dist/parser/psloop.c vendor-sys/acpica/dist/tools/acpiexec/aecommon.h vendor-sys/acpica/dist/tools/acpiexec/aeexec.c vendor-sys/acpica/dist/tools/acpiexec/aehandlers.c vendor-sys/acpica/dist/tools/acpiexec/aemain.c vendor-sys/acpica/dist/tools/acpiexec/aetables.c vendor-sys/acpica/dist/utilities/uteval.c Modified: vendor-sys/acpica/dist/changes.txt ============================================================================== --- vendor-sys/acpica/dist/changes.txt Thu Sep 3 23:04:33 2009 (r196803) +++ vendor-sys/acpica/dist/changes.txt Fri Sep 4 01:21:44 2009 (r196804) @@ -1,4 +1,77 @@ ---------------------------------------- +03 September 2009. Summary of changes for version 20090903: + +This release is available at www.acpica.org/downloads + +1) ACPI CA Core Subsystem: + +For Windows Vista compatibility, added the automatic execution of an _INI +method located at the namespace root (\_INI). This method is executed at +table load time. This support is in addition to the automatic execution of +\_SB._INI. Lin Ming. + +Fixed a possible memory leak in the interpreter for AML package objects if +the package initializer list is longer than the defined size of the package. +This apparently can only happen if the BIOS changes the package size on the +fly (seen in a _PSS object), as ASL compilers do not allow this. The +interpreter will truncate the package to the defined size (and issue an error +message), but previously could leave the extra objects undeleted if they were +pre-created during the argument processing (such is the case if the package +consists of a number of sub-packages as in the _PSS.) ACPICA BZ 805. + +Fixed a problem seen when a Buffer or String is stored to itself via ASL. +This has been reported in the field. Previously, ACPICA would zero out the +buffer/string. Now, the operation is treated as a noop. Provides Windows +compatibility. ACPICA BZ 803. Lin Ming. + +Removed an extraneous error message for ASL constructs of the form +Store(LocalX,LocalX) when LocalX is uninitialized. These curious statements +are seen in many BIOSs and are once again treated as NOOPs and no error is +emitted when they are encountered. ACPICA BZ 785. + +Fixed an extraneous warning message if a _DSM reserved method returns a +Package object. _DSM can return any type of object, so validation on the +return type cannot be performed. ACPICA BZ 802. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The +debug version of the code includes the debug output trace mechanism and has a +much larger code and data size. + + Previous Release: + Non-Debug Version: 85.5K Code, 18.0K Data, 103.5K Total + Debug Version: 161.6K Code, 50.9K Data, 212.5K Total + Current Release: + Non-Debug Version: 85.6K Code, 18.0K Data, 103.6K Total + Debug Version: 161.7K Code, 50.9K Data, 212.6K Total + +2) iASL Compiler/Disassembler and Tools: + +iASL: Fixed a problem with the use of the Alias operator and Resource +Templates. The correct alias is now constructed and no error is emitted. +ACPICA BZ 738. + +iASL: Implemented the -I option to specify additional search directories for +include files. Allows multiple additional search paths for include files. +Directories are searched in the order specified on the command line (after +the local directory is searched.) ACPICA BZ 800. + +iASL: Fixed a problem where the full pathname for include files was not +emitted for warnings/errors. This caused the IDE support to not work +properly. ACPICA BZ 765. + +iASL: Implemented the -@ option to specify a Windows-style response file +containing additional command line options. ACPICA BZ 801. + +AcpiExec: Added support to load multiple AML files simultaneously (such as a +DSDT and multiple SSDTs). Also added support for wildcards within the AML +pathname. These features allow all machine tables to be easily loaded and +debugged together. ACPICA BZ 804. + +Disassembler: Added missing support for disassembly of HEST table Error Bank +subtables. + +---------------------------------------- 30 July 2009. Summary of changes for version 20090730: This release is available at www.acpica.org/downloads Modified: vendor-sys/acpica/dist/common/dmtbdump.c ============================================================================== --- vendor-sys/acpica/dist/common/dmtbdump.c Thu Sep 3 23:04:33 2009 (r196803) +++ vendor-sys/acpica/dist/common/dmtbdump.c Fri Sep 4 01:21:44 2009 (r196804) @@ -747,6 +747,8 @@ AcpiDmDumpHest ( UINT32 Offset = sizeof (ACPI_TABLE_HEST); ACPI_DMTABLE_INFO *InfoTable; UINT32 SubTableLength; + UINT32 BankCount; + ACPI_HEST_IA_ERROR_BANK *BankTable; /* Main table */ @@ -762,16 +764,21 @@ AcpiDmDumpHest ( SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset); while (Offset < Table->Length) { + BankCount = 0; switch (SubTable->Type) { case ACPI_HEST_TYPE_IA32_CHECK: InfoTable = AcpiDmTableInfoHest0; SubTableLength = sizeof (ACPI_HEST_IA_MACHINE_CHECK); + BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK, + SubTable))->NumHardwareBanks; break; case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK: InfoTable = AcpiDmTableInfoHest1; SubTableLength = sizeof (ACPI_HEST_IA_CORRECTED); + BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED, + SubTable))->NumHardwareBanks; break; case ACPI_HEST_TYPE_IA32_NMI: @@ -814,9 +821,34 @@ AcpiDmDumpHest ( return; } - /* Point to next sub-table (each subtable is of fixed length) */ + /* Point to end of current subtable (each subtable above is of fixed length) */ Offset += SubTableLength; + + /* If there are any (fixed-length) Error Banks from above, dump them now */ + + if (BankCount) + { + BankTable = ACPI_ADD_PTR (ACPI_HEST_IA_ERROR_BANK, SubTable, SubTableLength); + SubTableLength += BankCount * sizeof (ACPI_HEST_IA_ERROR_BANK); + + while (BankCount) + { + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset, BankTable, + sizeof (ACPI_HEST_IA_ERROR_BANK), AcpiDmTableInfoHestBank); + if (ACPI_FAILURE (Status)) + { + return; + } + Offset += sizeof (ACPI_HEST_IA_ERROR_BANK); + BankTable++; + BankCount--; + } + } + + /* Point to next sub-table */ + SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, SubTable, SubTableLength); } } Modified: vendor-sys/acpica/dist/common/dmtbinfo.c ============================================================================== --- vendor-sys/acpica/dist/common/dmtbinfo.c Thu Sep 3 23:04:33 2009 (r196803) +++ vendor-sys/acpica/dist/common/dmtbinfo.c Fri Sep 4 01:21:44 2009 (r196804) @@ -178,6 +178,7 @@ #define ACPI_HEST8_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_AER_BRIDGE,f) #define ACPI_HEST9_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_GENERIC,f) #define ACPI_HESTN_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_NOTIFY,f) +#define ACPI_HESTB_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_ERROR_BANK,f) #define ACPI_IVRSH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_HEADER,f) #define ACPI_IVRS0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_HARDWARE,f) #define ACPI_IVRS1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_MEMORY,f) @@ -905,6 +906,25 @@ ACPI_DMTABLE_INFO AcpiDmTableI }; +/* + * IA32 Error Bank(s) - Follows the ACPI_HEST_IA_MACHINE_CHECK and + * ACPI_HEST_IA_CORRECTED structures. + */ +ACPI_DMTABLE_INFO AcpiDmTableInfoHestBank[] = +{ + {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (BankNumber), "Bank Number"}, + {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (ClearStatusOnInit), "Clear Status On Init"}, + {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (StatusFormat), "Status Format"}, + {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (Reserved), "Reserved"}, + {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (ControlRegister), "Control Register"}, + {ACPI_DMT_UINT64, ACPI_HESTB_OFFSET (ControlData), "Control Data"}, + {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (StatusRegister), "Status Register"}, + {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (AddressRegister), "Address Register"}, + {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (MiscRegister), "Misc Register"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + + /******************************************************************************* * * HPET - High Precision Event Timer table Modified: vendor-sys/acpica/dist/compiler/aslcompiler.h ============================================================================== --- vendor-sys/acpica/dist/compiler/aslcompiler.h Thu Sep 3 23:04:33 2009 (r196803) +++ vendor-sys/acpica/dist/compiler/aslcompiler.h Fri Sep 4 01:21:44 2009 (r196804) @@ -556,6 +556,10 @@ AslAbort ( void); void +FlAddIncludeDirectory ( + char *Dir); + +void FlOpenIncludeFile ( ACPI_PARSE_OBJECT *Op); Modified: vendor-sys/acpica/dist/compiler/aslfiles.c ============================================================================== --- vendor-sys/acpica/dist/compiler/aslfiles.c Thu Sep 3 23:04:33 2009 (r196803) +++ vendor-sys/acpica/dist/compiler/aslfiles.c Fri Sep 4 01:21:44 2009 (r196804) @@ -128,10 +128,11 @@ FlOpenFile ( char *Filename, char *Mode); -static FILE * -FlOpenLocalFile ( - char *LocalName, - char *Mode); +FILE * +FlOpenIncludeWithPrefix ( + char *PrefixDir, + char *Filename); + #ifdef ACPI_OBSOLETE_FUNCTIONS ACPI_STATUS @@ -172,45 +173,6 @@ AslAbort ( /******************************************************************************* * - * FUNCTION: FlOpenLocalFile - * - * PARAMETERS: LocalName - Single filename (not a pathname) - * Mode - Open mode for fopen - * - * RETURN: File descriptor - * - * DESCRIPTION: Build a complete pathname for the input filename and open - * the file. - * - ******************************************************************************/ - -static FILE * -FlOpenLocalFile ( - char *LocalName, - char *Mode) -{ - - StringBuffer[0] = 0; - - /* Check for an absolute pathname */ - - if ((LocalName[0] != '/') && /* Forward slash */ - (LocalName[0] != '\\') && /* backslash (Win) */ - (LocalName[1] != ':')) /* Device name (Win) */ - { - /* The include file path is relative, prepend the directory path */ - - strcat (StringBuffer, Gbl_DirectoryPath); - } - strcat (StringBuffer, LocalName); - - DbgPrint (ASL_PARSE_OUTPUT, "FlOpenLocalFile: %s\n", StringBuffer); - return (fopen (StringBuffer, (const char *) Mode)); -} - - -/******************************************************************************* - * * FUNCTION: FlFileError * * PARAMETERS: FileId - Index into file info array @@ -481,6 +443,122 @@ FlSetLineNumber ( /******************************************************************************* * + * FUNCTION: FlAddIncludeDirectory + * + * PARAMETERS: Dir - Directory pathname string + * + * RETURN: None + * + * DESCRIPTION: Add a directory the list of include prefix directories. + * + ******************************************************************************/ + +void +FlAddIncludeDirectory ( + char *Dir) +{ + ASL_INCLUDE_DIR *NewDir; + ASL_INCLUDE_DIR *NextDir; + ASL_INCLUDE_DIR *PrevDir = NULL; + UINT32 NeedsSeparator = 0; + size_t DirLength; + + + DirLength = strlen (Dir); + if (!DirLength) + { + return; + } + + /* Make sure that the pathname ends with a path separator */ + + if ((Dir[DirLength-1] != '/') && + (Dir[DirLength-1] != '\\')) + { + NeedsSeparator = 1; + } + + NewDir = ACPI_ALLOCATE_ZEROED (sizeof (ASL_INCLUDE_DIR)); + NewDir->Dir = ACPI_ALLOCATE (DirLength + 1 + NeedsSeparator); + strcpy (NewDir->Dir, Dir); + if (NeedsSeparator) + { + strcat (NewDir->Dir, "/"); + } + + /* + * Preserve command line ordering of -I options by adding new elements + * at the end of the list + */ + NextDir = Gbl_IncludeDirList; + while (NextDir) + { + PrevDir = NextDir; + NextDir = NextDir->Next; + } + + if (PrevDir) + { + PrevDir->Next = NewDir; + } + else + { + Gbl_IncludeDirList = NewDir; + } +} + + +/******************************************************************************* + * + * FUNCTION: FlOpenIncludeWithPrefix + * + * PARAMETERS: PrefixDir - Prefix directory pathname. Can be a zero + * length string. + * Filename - The include filename from the source ASL. + * + * RETURN: Valid file descriptor if successful. Null otherwise. + * + * DESCRIPTION: Open an include file and push it on the input file stack. + * + ******************************************************************************/ + +FILE * +FlOpenIncludeWithPrefix ( + char *PrefixDir, + char *Filename) +{ + FILE *IncludeFile; + char *Pathname; + + + /* Build the full pathname to the file */ + + Pathname = ACPI_ALLOCATE (strlen (PrefixDir) + strlen (Filename) + 1); + + strcpy (Pathname, PrefixDir); + strcat (Pathname, Filename); + + DbgPrint (ASL_PARSE_OUTPUT, "\nAttempt to open include file: path %s\n\n", + Pathname); + + /* Attempt to open the file, push if successful */ + + IncludeFile = fopen (Pathname, "r"); + if (IncludeFile) + { + /* Push the include file on the open input file stack */ + + AslPushInputFileStack (IncludeFile, Pathname); + return (IncludeFile); + } + + ACPI_FREE (Pathname); + return (NULL); +} + + +/******************************************************************************* + * * FUNCTION: FlOpenIncludeFile * * PARAMETERS: Op - Parse node for the INCLUDE ASL statement @@ -495,7 +573,8 @@ void FlOpenIncludeFile ( ACPI_PARSE_OBJECT *Op) { - FILE *IncFile; + FILE *IncludeFile; + ASL_INCLUDE_DIR *NextDir; /* Op must be valid */ @@ -518,21 +597,58 @@ FlOpenIncludeFile ( FlPrintFile (ASL_FILE_SOURCE_OUTPUT, "\n"); Gbl_CurrentLineOffset++; - /* Prepend the directory pathname and open the include file */ - DbgPrint (ASL_PARSE_OUTPUT, "\nOpen include file: path %s\n\n", - Op->Asl.Value.String); - IncFile = FlOpenLocalFile (Op->Asl.Value.String, "r"); - if (!IncFile) + /* Attempt to open the include file */ + + /* If the file specifies an absolute path, just open it */ + + if ((Op->Asl.Value.String[0] == '/') || + (Op->Asl.Value.String[0] == '\\') || + (Op->Asl.Value.String[1] == ':')) { - sprintf (MsgBuffer, "%s (%s)", Op->Asl.Value.String, strerror (errno)); - AslError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, Op, MsgBuffer); + IncludeFile = FlOpenIncludeWithPrefix ("", Op->Asl.Value.String); + if (!IncludeFile) + { + goto ErrorExit; + } return; } - /* Push the include file on the open input file stack */ + /* + * The include filename is not an absolute path. + * + * First, search for the file within the "local" directory -- meaning + * the same directory that contains the source file. + * + * Construct the file pathname from the global directory name. + */ + IncludeFile = FlOpenIncludeWithPrefix (Gbl_DirectoryPath, Op->Asl.Value.String); + if (IncludeFile) + { + return; + } + + /* + * Second, search for the file within the (possibly multiple) directories + * specified by the -I option on the command line. + */ + NextDir = Gbl_IncludeDirList; + while (NextDir) + { + IncludeFile = FlOpenIncludeWithPrefix (NextDir->Dir, Op->Asl.Value.String); + if (IncludeFile) + { + return; + } + + NextDir = NextDir->Next; + } + + /* We could not open the include file after trying very hard */ - AslPushInputFileStack (IncFile, Op->Asl.Value.String); +ErrorExit: + sprintf (MsgBuffer, "%s, %s", Op->Asl.Value.String, strerror (errno)); + AslError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, Op, MsgBuffer); } Modified: vendor-sys/acpica/dist/compiler/aslglobal.h ============================================================================== --- vendor-sys/acpica/dist/compiler/aslglobal.h Thu Sep 3 23:04:33 2009 (r196803) +++ vendor-sys/acpica/dist/compiler/aslglobal.h Fri Sep 4 01:21:44 2009 (r196804) @@ -148,7 +148,7 @@ extern char HexL #define ASL_LINE_BUFFER_SIZE 512 #define ASL_MSG_BUFFER_SIZE 4096 #define HEX_TABLE_LINE_SIZE 8 -#define HEX_LISTING_LINE_SIZE 16 +#define HEX_LISTING_LINE_SIZE 8 /* Source code buffers and pointers for error reporting */ @@ -212,6 +212,7 @@ ASL_EXTERN char *Gbl ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_ExternalFilename, NULL); ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_IncludeFilename, NULL); ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_OutputFilenamePrefix, NULL); +ASL_EXTERN ASL_INCLUDE_DIR ASL_INIT_GLOBAL (*Gbl_IncludeDirList, NULL); ASL_EXTERN char *Gbl_CurrentInputFilename; ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HasIncludeFiles, FALSE); Modified: vendor-sys/acpica/dist/compiler/aslload.c ============================================================================== --- vendor-sys/acpica/dist/compiler/aslload.c Thu Sep 3 23:04:33 2009 (r196803) +++ vendor-sys/acpica/dist/compiler/aslload.c Fri Sep 4 01:21:44 2009 (r196804) @@ -353,6 +353,7 @@ LdLoadResourceElements ( Node->Value = (UINT32) Op->Asl.Value.Integer; Node->Op = Op; + Op->Asl.Node = Node; /* * Now enter the predefined fields, for easy lookup when referenced Modified: vendor-sys/acpica/dist/compiler/aslmain.c ============================================================================== --- vendor-sys/acpica/dist/compiler/aslmain.c Thu Sep 3 23:04:33 2009 (r196803) +++ vendor-sys/acpica/dist/compiler/aslmain.c Fri Sep 4 01:21:44 2009 (r196804) @@ -150,6 +150,28 @@ AslCommandLine ( int argc, char **argv); +static int +AslDoOptions ( + int argc, + char **argv, + BOOLEAN IsResponseFile); + +static void +AslMergeOptionTokens ( + char *InBuffer, + char *OutBuffer); + +static int +AslDoResponseFile ( + char *Filename); + +extern int AcpiGbl_Opterr; +extern int AcpiGbl_Optind; + + +#define ASL_TOKEN_SEPARATORS " \t\n" +#define ASL_SUPPORTED_OPTIONS "@:2b:cd^e:fgh^i^I:l^o:p:r:s:t:v:w:x:" + /******************************************************************************* * @@ -168,8 +190,12 @@ Options ( void) { - printf ("General Output:\n"); - printf (" -p Specify path/filename prefix for all output files\n"); + printf ("Global:\n"); + printf (" -@ Specify command file\n"); + printf (" -I Specify additional include directory\n"); + + printf ("\nGeneral Output:\n"); + printf (" -p Specify path/filename prefix for all output files\n"); printf (" -va Disable all errors and warnings (summary only)\n"); printf (" -vi Less verbose errors and warnings for use with IDEs\n"); printf (" -vo Enable optimization comments\n"); @@ -310,39 +336,149 @@ AslInitialize ( /******************************************************************************* * - * FUNCTION: AslCommandLine + * FUNCTION: AslMergeOptionTokens * - * PARAMETERS: argc/argv + * PARAMETERS: InBuffer - Input containing an option string + * OutBuffer - Merged output buffer * * RETURN: None * - * DESCRIPTION: Command line processing + * DESCRIPTION: Remove all whitespace from an option string. + * + ******************************************************************************/ + +static void +AslMergeOptionTokens ( + char *InBuffer, + char *OutBuffer) +{ + char *Token; + + + *OutBuffer = 0; + + Token = strtok (InBuffer, ASL_TOKEN_SEPARATORS); + while (Token) + { + strcat (OutBuffer, Token); + Token = strtok (NULL, ASL_TOKEN_SEPARATORS); + } +} + + +/******************************************************************************* + * + * FUNCTION: AslDoResponseFile + * + * PARAMETERS: Filename - Name of the response file + * + * RETURN: Status + * + * DESCRIPTION: Open a response file and process all options within. * ******************************************************************************/ static int -AslCommandLine ( - int argc, - char **argv) +AslDoResponseFile ( + char *Filename) { - BOOLEAN BadCommandLine = FALSE; - int j; + char *argv = StringBuffer2; + FILE *ResponseFile; + int OptStatus = 0; + int Opterr; + int Optind; - /* Minimum command line contains at least one option or an input file */ + ResponseFile = fopen (Filename, "r"); + if (!ResponseFile) + { + printf ("Could not open command file %s, %s\n", + Filename, strerror (errno)); + return -1; + } - if (argc < 2) + /* Must save the current GetOpt globals */ + + Opterr = AcpiGbl_Opterr; + Optind = AcpiGbl_Optind; + + /* + * Process all lines in the response file. There must be one complete + * option per line + */ + while (fgets (StringBuffer, ASL_MSG_BUFFER_SIZE, ResponseFile)) { - AslCompilerSignon (ASL_FILE_STDOUT); - Usage (); - exit (1); + /* Compress all tokens, allowing us to use a single argv entry */ + + AslMergeOptionTokens (StringBuffer, StringBuffer2); + + /* Process the option */ + + AcpiGbl_Opterr = 0; + AcpiGbl_Optind = 0; + + OptStatus = AslDoOptions (1, &argv, TRUE); + if (OptStatus) + { + printf ("Invalid option in command file %s: %s\n", + Filename, StringBuffer); + break; + } } + /* Restore the GetOpt globals */ + + AcpiGbl_Opterr = Opterr; + AcpiGbl_Optind = Optind; + + fclose (ResponseFile); + return (OptStatus); +} + + +/******************************************************************************* + * + * FUNCTION: AslDoOptions + * + * PARAMETERS: argc/argv - Standard argc/argv + * IsResponseFile - TRUE if executing a response file. + * + * RETURN: Status + * + * DESCRIPTION: Command line option processing + * + ******************************************************************************/ + +static int +AslDoOptions ( + int argc, + char **argv, + BOOLEAN IsResponseFile) +{ + int j; + + /* Get the command line options */ - while ((j = AcpiGetopt (argc, argv, "2b:cd^e:fgh^i^l^o:p:r:s:t:v:w:x:")) != EOF) switch (j) + while ((j = AcpiGetopt (argc, argv, ASL_SUPPORTED_OPTIONS)) != EOF) switch (j) { + case '@': /* Begin a response file */ + + if (IsResponseFile) + { + printf ("Nested command files are not supported\n"); + return -1; + } + + if (AslDoResponseFile (AcpiGbl_Optarg)) + { + return -1; + } + break; + + case '2': + Gbl_Acpi2 = TRUE; break; @@ -364,8 +500,7 @@ AslCommandLine ( default: printf ("Unknown option: -b%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } /* Produce debug output file */ @@ -394,8 +529,7 @@ AslCommandLine ( default: printf ("Unknown option: -d%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } Gbl_DisasmFlag = TRUE; @@ -444,12 +578,17 @@ AslCommandLine ( default: printf ("Unknown option: -h%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } break; + case 'I': /* Add an include file search directory */ + + FlAddIncludeDirectory (AcpiGbl_Optarg); + break; + + case 'i': switch (AcpiGbl_Optarg[0]) @@ -470,8 +609,7 @@ AslCommandLine ( default: printf ("Unknown option: -s%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } break; @@ -500,8 +638,7 @@ AslCommandLine ( default: printf ("Unknown option: -l%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } break; @@ -549,8 +686,7 @@ AslCommandLine ( default: printf ("Unknown option: -c%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } break; @@ -589,8 +725,7 @@ AslCommandLine ( default: printf ("Unknown option: -s%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } break; @@ -611,8 +746,7 @@ AslCommandLine ( default: printf ("Unknown option: -t%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } break; @@ -647,8 +781,7 @@ AslCommandLine ( default: printf ("Unknown option: -v%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } break; @@ -671,8 +804,7 @@ AslCommandLine ( default: printf ("Unknown option: -w%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } break; @@ -685,10 +817,46 @@ AslCommandLine ( default: - BadCommandLine = TRUE; - break; + return (-1); + } + + return (0); +} + + +/******************************************************************************* + * + * FUNCTION: AslCommandLine + * + * PARAMETERS: argc/argv + * + * RETURN: Last argv index + * + * DESCRIPTION: Command line processing + * + ******************************************************************************/ + +static int +AslCommandLine ( + int argc, + char **argv) +{ + int BadCommandLine = 0; + + + /* Minimum command line contains at least the command and an input file */ + + if (argc < 2) + { + AslCompilerSignon (ASL_FILE_STDOUT); + Usage (); + exit (1); } + /* Process all command line options */ + + BadCommandLine = AslDoOptions (argc, argv, FALSE); + /* Next parameter must be the input filename */ if (!argv[AcpiGbl_Optind] && Modified: vendor-sys/acpica/dist/compiler/asltypes.h ============================================================================== --- vendor-sys/acpica/dist/compiler/asltypes.h Thu Sep 3 23:04:33 2009 (r196803) +++ vendor-sys/acpica/dist/compiler/asltypes.h Fri Sep 4 01:21:44 2009 (r196804) @@ -255,6 +255,14 @@ typedef enum #define ASL_NUM_FILES (ASL_MAX_FILE_TYPE + 1) +typedef struct asl_include_dir +{ + char *Dir; + struct asl_include_dir *Next; + +} ASL_INCLUDE_DIR; + + /* An entry in the exception list, one for each error/warning */ typedef struct asl_error_msg Modified: vendor-sys/acpica/dist/dispatcher/dsmthdat.c ============================================================================== --- vendor-sys/acpica/dist/dispatcher/dsmthdat.c Thu Sep 3 23:04:33 2009 (r196803) +++ vendor-sys/acpica/dist/dispatcher/dsmthdat.c Fri Sep 4 01:21:44 2009 (r196804) @@ -548,9 +548,10 @@ AcpiDsMethodDataGetValue ( case ACPI_REFCLASS_LOCAL: - ACPI_ERROR ((AE_INFO, - "Uninitialized Local[%d] at node %p", Index, Node)); - + /* + * No error message for this case, will be trapped again later to + * detect and ignore cases of Store(LocalX,LocalX) + */ return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL); default: Modified: vendor-sys/acpica/dist/dispatcher/dsobject.c ============================================================================== --- vendor-sys/acpica/dist/dispatcher/dsobject.c Thu Sep 3 23:04:33 2009 (r196803) +++ vendor-sys/acpica/dist/dispatcher/dsobject.c Fri Sep 4 01:21:44 2009 (r196804) @@ -570,15 +570,28 @@ AcpiDsBuildInternalPackageObj ( { /* * NumElements was exhausted, but there are remaining elements in the - * PackageList. + * PackageList. Truncate the package to NumElements. * * Note: technically, this is an error, from ACPI spec: "It is an error * for NumElements to be less than the number of elements in the - * PackageList". However, for now, we just print an error message and - * no exception is returned. + * PackageList". However, we just print an error message and + * no exception is returned. This provides Windows compatibility. Some + * BIOSs will alter the NumElements on the fly, creating this type + * of ill-formed package object. */ while (Arg) { + /* + * We must delete any package elements that were created earlier + * and are not going to be used because of the package truncation. + */ + if (Arg->Common.Node) + { + AcpiUtRemoveReference ( + ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node)); + Arg->Common.Node = NULL; + } + /* Find out how many elements there really are */ i++; @@ -586,7 +599,7 @@ AcpiDsBuildInternalPackageObj ( } ACPI_ERROR ((AE_INFO, - "Package List length (%X) larger than NumElements count (%X), truncated\n", + "Package List length (0x%X) larger than NumElements count (0x%X), truncated\n", i, ElementCount)); } else if (i < ElementCount) @@ -596,7 +609,7 @@ AcpiDsBuildInternalPackageObj ( * Note: this is not an error, the package is padded out with NULLs. */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Package List length (%X) smaller than NumElements count (%X), padded with null elements\n", + "Package List length (0x%X) smaller than NumElements count (0x%X), padded with null elements\n", i, ElementCount)); } Modified: vendor-sys/acpica/dist/executer/exstorob.c ============================================================================== --- vendor-sys/acpica/dist/executer/exstorob.c Thu Sep 3 23:04:33 2009 (r196803) +++ vendor-sys/acpica/dist/executer/exstorob.c Fri Sep 4 01:21:44 2009 (r196804) @@ -150,6 +150,13 @@ AcpiExStoreBufferToBuffer ( ACPI_FUNCTION_TRACE_PTR (ExStoreBufferToBuffer, SourceDesc); + /* If Source and Target are the same, just return */ + + if (SourceDesc == TargetDesc) + { + return_ACPI_STATUS (AE_OK); + } + /* We know that SourceDesc is a buffer by now */ Buffer = ACPI_CAST_PTR (UINT8, SourceDesc->Buffer.Pointer); @@ -248,6 +255,13 @@ AcpiExStoreStringToString ( ACPI_FUNCTION_TRACE_PTR (ExStoreStringToString, SourceDesc); + /* If Source and Target are the same, just return */ + + if (SourceDesc == TargetDesc) + { + return_ACPI_STATUS (AE_OK); + } + /* We know that SourceDesc is a string by now */ Buffer = ACPI_CAST_PTR (UINT8, SourceDesc->String.Pointer); Modified: vendor-sys/acpica/dist/include/acdisasm.h ============================================================================== --- vendor-sys/acpica/dist/include/acdisasm.h Thu Sep 3 23:04:33 2009 (r196803) +++ vendor-sys/acpica/dist/include/acdisasm.h Fri Sep 4 01:21:44 2009 (r196804) @@ -273,6 +273,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTa extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest8[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest9[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHestNotify[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoHestBank[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHpet[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs0[]; Modified: vendor-sys/acpica/dist/include/aclocal.h ============================================================================== --- vendor-sys/acpica/dist/include/aclocal.h Thu Sep 3 23:04:33 2009 (r196803) +++ vendor-sys/acpica/dist/include/aclocal.h Fri Sep 4 01:21:44 2009 (r196804) @@ -1127,6 +1127,9 @@ typedef struct acpi_bit_register_info #define ACPI_OSI_WIN_XP_SP2 0x05 #define ACPI_OSI_WINSRV_2003_SP1 0x06 #define ACPI_OSI_WIN_VISTA 0x07 +#define ACPI_OSI_WINSRV_2008 0x08 +#define ACPI_OSI_WIN_VISTA_SP1 0x09 +#define ACPI_OSI_WIN_7 0x0A #define ACPI_ALWAYS_ILLEGAL 0x00 Modified: vendor-sys/acpica/dist/include/acpixf.h ============================================================================== --- vendor-sys/acpica/dist/include/acpixf.h Thu Sep 3 23:04:33 2009 (r196803) +++ vendor-sys/acpica/dist/include/acpixf.h Fri Sep 4 01:21:44 2009 (r196804) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From jkim at FreeBSD.org Fri Sep 4 01:24:28 2009 From: jkim at FreeBSD.org (Jung-uk Kim) Date: Fri Sep 4 01:24:39 2009 Subject: svn commit: r196805 - vendor-sys/acpica/20090903 Message-ID: <200909040124.n841ORTu049906@svn.freebsd.org> Author: jkim Date: Fri Sep 4 01:24:27 2009 New Revision: 196805 URL: http://svn.freebsd.org/changeset/base/196805 Log: Tag ACPICA 20090903 Added: vendor-sys/acpica/20090903/ - copied from r196804, vendor-sys/acpica/dist/ From brde at optusnet.com.au Fri Sep 4 03:42:16 2009 From: brde at optusnet.com.au (Bruce Evans) Date: Fri Sep 4 03:42:22 2009 Subject: svn commit: r196752 - head/lib/libc/stdtime In-Reply-To: <86zl9c9z05.fsf@ds4.des.no> References: <200909020456.n824uUqQ082136@svn.freebsd.org> <20090902070808.GA1290@arthur.nitro.dk> <20090902084002.GA17325@nagual.pp.ru> <867hwgcwvo.fsf@ds4.des.no> <20090903084325.GA65192@nagual.pp.ru> <86zl9c9z05.fsf@ds4.des.no> Message-ID: <20090904115255.Q48987@delplex.bde.org> On Thu, 3 Sep 2009, [utf-8] Dag-Erling Smørgrav wrote: > Andrey Chernov writes: >> Thanx for detailed explanation. > > np; I've made that mistake many times myself. Andrey doesn't make that mistake many times (at least this millenium), but fixes it a lot. > What do you think of the attached patch? Why not use the same text as POSIX? I don't like repeating this ad nauseum, but POSIX does. (In POSIX.1-2001-draft7, this repetition is responsible for 1/3 of the lines matching of "unsigned char".) C99 says this only once for ctype functions, at the beginning of the section on . The patch is missing the corresponding text for wctype functions (argmuments of type wint_t generally give undefined behaviour unless their value is representable as a wchar_t or equal to the value of WEOF). In FreeBSD, wint_t has the same type as wchar_t and that type is int, so bugs in this area are latent (unportable code might run on FreeBSD, and there might be problems with the sign bit and/or with WEOF being indistinguishable from a valid wide char encoding. gcc/config/i386 has some targets with 16-bit wide chars, and these have to be more careful about both. The non-broken ones use uint16_t for wchar_t and int for wint_t)> % Index: lib/libc/locale/iscntrl.3 % =================================================================== % --- lib/libc/locale/iscntrl.3 (revision 196695) % +++ lib/libc/locale/iscntrl.3 (working copy) % @@ -32,7 +32,7 @@ % .\" @(#)iscntrl.3 8.1 (Berkeley) 6/4/93 % .\" $FreeBSD$ % .\" % -.Dd July 17, 2005 % +.Dd September 3, 2009 % .Dt ISCNTRL 3 % .Os % .Sh NAME % @@ -65,6 +65,15 @@ % .It "\&031\ EM \t032\ SUB \t033\ ESC \t034\ FS \t035\ GS" % .It "\&036\ RS \t037\ US \t177\ DEL" % .El % +.Pp % +.Em NOTE : % +if the value passed to the % +.Fn iscntrl % +function is a % +.Vt signed char , % +as is usually the case, it must be cast to an % +.Vt unsigned char % +to avoid sign-extension errors. This wording is poor. It should be something like "if the value to be passed is represented as a signed char" ... I don't know a good easy way to fix "must be cast ... to avoid sign-extension errors". The value must be converted to one representable as an unsigned char to work, but that is not always possible, and blindly casting may give a wrong value. In most cases, it is an error to represent the value as a signed char to begin with, and better to cast a pointer from "char *" to "u_char": char *p; /* Already a bad type. */ ... isalpha(*p); /* Wrong since *p might be < 0. */ ... isalpha((u_char)*p); /* Mishandles exotic machines. */ ... isalpha(*(u_char *)p); /* Mishandles diff. exotic machines. */ "unsigned char" is spelled u_char in KNF. Here this makes the above lines barely fit in 80 columns before quoting. Exotic machines include: - simple ones complement with no trap representations, signed chars and CHAR_BIT = 8. I think '\xff' is -0. Casting this to u_char gives 0, which is probably not what is wanted, while casting the pointer to it gives 0xff (if the bits are there in the memory copy), which is probably what is wanted. - ones with chars being signed and signed chars having a larger range than unsigned ones, or with u_char of a different size than char (not sure if the latter is allowed). Then casting the pointer will give a reasonable value, though possibly not the wanted one (the difficulty is more in advancing the pointer), while blindly casting the value may corrupt many more values than -0. - ones with trap representations, instead of or in addition to the above complications. Now *p will trap on trap reps but there should be no trap reps in valid data, while casting the pointer will always give a reasonable value, possibly including trap bits. Sign extension for passing a signed char is not an error. The error is passing a negative value. Neither C99 nor POSIX gives any advice. They just say that the behaviour is undefined if the value is not representable as an unsigned char or equal to the value of EOF. % Index: lib/libc/locale/isrune.3 % =================================================================== % --- lib/libc/locale/isrune.3 (revision 196695) % +++ lib/libc/locale/isrune.3 (working copy) % @@ -25,7 +25,7 @@ % .\" % .\" $FreeBSD$ % .\" % -.Dd March 30, 2004 % +.Dd September 3, 2009 % .Dt ISRUNE 3 % .Os % .Sh NAME % @@ -46,6 +46,15 @@ % .Tn ASCII % character set, this is equivalent to % .Fn isascii . % +.Pp % +.Em NOTE : % +if the value passed to the % +.Fn isrune % +function is a % +.Vt signed char , % +as is usually the case, it must be cast to an % +.Vt unsigned char % +to avoid sign-extension errors. % .Sh RETURN VALUES % The % .Fn isrune This seems to be wrong. isascii() works on all int args, so I assume isrune() does too. isrune.3 also misdescribes its arg as "the character" -- this prejudges the arg. % Index: lib/libc/locale/digittoint.3 % =================================================================== % --- lib/libc/locale/digittoint.3 (revision 196695) % +++ lib/libc/locale/digittoint.3 (working copy) % @@ -28,7 +28,7 @@ % .\" @(#)digittoint.3 8.1 (Berkeley) 6/4/93 % .\" $FreeBSD$ % .\" % -.Dd April 6, 2001 % +.Dd September 3, 2009 % .Dt DIGITTOINT 3 % .Os % .Sh NAME % @@ -46,6 +46,15 @@ % function converts a numeric character to its corresponding integer value. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ % The character can be any decimal digit or hexadecimal digit. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ % With hexadecimal characters, the case of the values does not matter. % +.Pp % +.Em NOTE : % +if the value passed to the % +.Fn digittoint % +function is a % +.Vt signed char , % +as is usually the case, it must be cast to an % +.Vt unsigned char % +to avoid sign-extension errors. % .Sh RETURN VALUES % The % .Fn digittoint Here the behaviour already seems to be undefined unless the arg is a decimal or hex digit. Like isascii(), this function isn't in C99, so it can be more or less strict than other ctype functions. % Index: lib/libc/locale/isascii.3 % =================================================================== % --- lib/libc/locale/isascii.3 (revision 196695) % +++ lib/libc/locale/isascii.3 (working copy) % @@ -28,7 +28,7 @@ % .\" @(#)isascii.3 8.2 (Berkeley) 12/11/93 % .\" $FreeBSD$ % .\" % -.Dd October 6, 2002 % +.Dd September 3, 2009 % .Dt ISASCII 3 % .Os % .Sh NAME % @@ -47,6 +47,15 @@ % .Tn ASCII % character, which is any character % between 0 and octal 0177 inclusive. % +.Pp % +.Em NOTE : % +if the value passed to the % +.Fn isascii % +function is a % +.Vt signed char , % +as is usually the case, it must be cast to an % +.Vt unsigned char % +to avoid sign-extension errors. % .Sh SEE ALSO % .Xr ctype 3 , % .Xr iswascii 3 , This is wrong -- see above. POSIX specifically says that "The isascii() function is defined on all integer values". Please check POSIX for any other special cases -- I only remembered this one and passed most of your other changes since most of the functions are in C99. % Index: lib/libc/locale/toascii.3 % =================================================================== % --- lib/libc/locale/toascii.3 (revision 196695) % +++ lib/libc/locale/toascii.3 (working copy) % @@ -28,7 +28,7 @@ % .\" @(#)toascii.3 8.1 (Berkeley) 6/4/93 % .\" $FreeBSD$ % .\" % -.Dd June 4, 1993 % +.Dd September 3, 2009 % .Dt TOASCII 3 % .Os % .Sh NAME % @@ -45,6 +45,15 @@ % .Fn toascii % function strips all but the low 7 bits from a letter, % including parity or other marker bits. % +.Pp % +.Em NOTE : % +if the value passed to the % +.Fn toascii % +function is a % +.Vt signed char , % +as is usually the case, it must be cast to an % +.Vt unsigned char % +to avoid sign-extension errors. % .Sh RETURN VALUES % The % .Fn toascii This seems wrong too. POSIX doesn't say anything specific for it (neither the restriction nor lack of it). It just says that the result is and 0x7f where the above says "strips all but the low 7 bits from a letter". Another old bug is the above saying "letter" -- toascii() always worked on at least ASCII non-letters. % Index: lib/libc/locale/toupper.3 % =================================================================== % --- lib/libc/locale/toupper.3 (revision 196695) % +++ lib/libc/locale/toupper.3 (working copy) % @@ -32,7 +32,7 @@ % .\" @(#)toupper.3 8.1 (Berkeley) 6/4/93 % .\" $FreeBSD$ % .\" % -.Dd July 17, 2005 % +.Dd September 3, 2009 % .Dt TOUPPER 3 % .Os % .Sh NAME % @@ -53,6 +53,15 @@ % .Vt "unsigned char" % or the value of % .Dv EOF . % +.Pp % +.Em NOTE : % +if the value passed to the % +.Fn toupper % +function is a % +.Vt signed char , % +as is usually the case, it must be cast to an % +.Vt unsigned char % +to avoid sign-extension errors. % .Sh RETURN VALUES % If the argument is a lower-case letter, the % .Fn toupper toupper.2 already says that "the value of the argument is representable as an unsigned char or the value EOF" (it should say "the argument is representable as an unsigned char or equal to the value of EOF"). The new text, if any, should be mixed with this. Presumably similarly for tolower (I didn't noticed these problems earlier). Bruce From bms at incunabulum.net Fri Sep 4 04:44:56 2009 From: bms at incunabulum.net (Bruce Simpson) Date: Fri Sep 4 04:45:08 2009 Subject: svn commit: r196797 - in head: sys/net sys/netinet usr.bin/netstat In-Reply-To: <200909032110.n83LAvUF044731@svn.freebsd.org> References: <200909032110.n83LAvUF044731@svn.freebsd.org> Message-ID: <4AA09B41.3040103@incunabulum.net> George V. Neville-Neil wrote: > Author: gnn > Date: Thu Sep 3 21:10:57 2009 > New Revision: 196797 > URL: http://svn.freebsd.org/changeset/base/196797 > > Log: > Add ARP statistics to the kernel and netstat. > Thanks very much for this change. Any chance this struct can get explicitly versioned (i.e. as for struct igmpstat) as it is a new struct? cheers, BMS From alc at FreeBSD.org Fri Sep 4 04:48:12 2009 From: alc at FreeBSD.org (Alan Cox) Date: Fri Sep 4 04:48:29 2009 Subject: svn commit: r196807 - in stable/7/sys: . contrib/pf vm Message-ID: <200909040448.n844mCdq054063@svn.freebsd.org> Author: alc Date: Fri Sep 4 04:48:12 2009 New Revision: 196807 URL: http://svn.freebsd.org/changeset/base/196807 Log: MFC r190912 Previously, when vm_page_free_toq() was performed on a page belonging to a reservation, unless all of the reservation's pages were free, the reservation was moved to the head of the partially-populated reservations queue, where it would be the next reservation to be broken in case the free page queues were emptied. Now, instead, I am moving it to the tail. Very likely this reservation is in the process of being freed in its entirety, so placing it at the tail of the queue makes it more likely that the underlying physical memory will be returned to the free page queues as one contiguous chunk. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/vm/vm_reserv.c Modified: stable/7/sys/vm/vm_reserv.c ============================================================================== --- stable/7/sys/vm/vm_reserv.c Fri Sep 4 01:44:31 2009 (r196806) +++ stable/7/sys/vm/vm_reserv.c Fri Sep 4 04:48:12 2009 (r196807) @@ -138,8 +138,8 @@ static vm_reserv_t vm_reserv_array; * The partially-populated reservation queue * * This queue enables the fast recovery of an unused cached or free small page - * from a partially-populated reservation. The head of this queue is either - * the least-recently-populated or most-recently-depopulated reservation. + * from a partially-populated reservation. The reservation at the head of + * this queue is the least-recently-changed, partially-populated reservation. * * Access to this queue is synchronized by the free page queue lock. */ @@ -209,7 +209,7 @@ sysctl_vm_reserv_partpopq(SYSCTL_HANDLER /* * Reduces the given reservation's population count. If the population count * becomes zero, the reservation is destroyed. Additionally, moves the - * reservation to the head of the partially-populated reservations queue if the + * reservation to the tail of the partially-populated reservations queue if the * population count is non-zero. * * The free page queue lock must be held. @@ -235,7 +235,7 @@ vm_reserv_depopulate(vm_reserv_t rv) vm_reserv_freed++; } else { rv->inpartpopq = TRUE; - TAILQ_INSERT_HEAD(&vm_rvq_partpop, rv, partpopq); + TAILQ_INSERT_TAIL(&vm_rvq_partpop, rv, partpopq); } } From alc at FreeBSD.org Fri Sep 4 05:06:15 2009 From: alc at FreeBSD.org (Alan Cox) Date: Fri Sep 4 05:06:26 2009 Subject: svn commit: r196808 - in stable/7/sys: . amd64/include contrib/pf Message-ID: <200909040506.n8456FjI054462@svn.freebsd.org> Author: alc Date: Fri Sep 4 05:06:15 2009 New Revision: 196808 URL: http://svn.freebsd.org/changeset/base/196808 Log: MFC r193729 Now that amd64's kernel map is 512GB (r192469), there is no reason to cap its buffer map at 400MB. Modified: stable/7/sys/ (props changed) stable/7/sys/amd64/include/param.h stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/amd64/include/param.h ============================================================================== --- stable/7/sys/amd64/include/param.h Fri Sep 4 04:48:12 2009 (r196807) +++ stable/7/sys/amd64/include/param.h Fri Sep 4 05:06:15 2009 (r196808) @@ -131,15 +131,6 @@ #endif /* - * Ceiling on size of buffer cache (really only effects write queueing, - * the VM page cache is not effected), can be changed via - * the kern.maxbcache /boot/loader.conf variable. - */ -#ifndef VM_BCACHE_SIZE_MAX -#define VM_BCACHE_SIZE_MAX (400 * 1024 * 1024) -#endif - -/* * Mach derived conversion macros */ #define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK)) From ache at nagual.pp.ru Fri Sep 4 05:16:33 2009 From: ache at nagual.pp.ru (Andrey Chernov) Date: Fri Sep 4 05:16:47 2009 Subject: svn commit: r196752 - head/lib/libc/stdtime In-Reply-To: <20090904115255.Q48987@delplex.bde.org> References: <200909020456.n824uUqQ082136@svn.freebsd.org> <20090902070808.GA1290@arthur.nitro.dk> <20090902084002.GA17325@nagual.pp.ru> <867hwgcwvo.fsf@ds4.des.no> <20090903084325.GA65192@nagual.pp.ru> <86zl9c9z05.fsf@ds4.des.no> <20090904115255.Q48987@delplex.bde.org> Message-ID: <20090904051629.GA88503@nagual.pp.ru> On Fri, Sep 04, 2009 at 01:42:04PM +1000, Bruce Evans wrote: > The patch is missing the corresponding text for wctype functions > (argmuments of type wint_t generally give undefined behaviour unless > their value is representable as a wchar_t or equal to the value of > WEOF). In FreeBSD, wint_t has the same type as wchar_t and that type > is int, so bugs in this area are latent (unportable code might run > on FreeBSD, and there might be problems with the sign bit and/or with > WEOF being indistinguishable from a valid wide char encoding. Yes, having the same note for wctype family will be nice too. > It should be something like "if the value to be > passed is represented as a signed char" ... I don't know a good easy > way to fix "must be cast ... to avoid sign-extension errors". The > value must be converted to one representable as an unsigned char to > work, but that is not always possible, and blindly casting may give > a wrong value. > Exotic machines include: I think, "exotic machines" examples you mention already brokes too many other aspects regarding to char manipulating, so nobody will really make such machines with standard-compliance C compiler on them :) > Sign extension for passing a signed char is not an error. The error is > passing a negative value. Yes. Perhaps 'Never pass negative arg there, including sign-extended char' or something alike. > Neither C99 nor POSIX gives any advice. They just say that the behaviour > is undefined if the value is not representable as an unsigned char or > equal to the value of EOF. Yes, I already mention that. > % Index: lib/libc/locale/isrune.3 > % Index: lib/libc/locale/digittoint.3 > % Index: lib/libc/locale/isascii.3 > % Index: lib/libc/locale/toascii.3 Yes, those ones works with int. I don't pay attention to them in the whole patch :( About other wording nuances mentioned in your reply, I don't have an opinion, everybody knows my English is poor :) -- http://ache.pp.ru/ From brde at optusnet.com.au Fri Sep 4 05:21:21 2009 From: brde at optusnet.com.au (Bruce Evans) Date: Fri Sep 4 05:21:28 2009 Subject: svn commit: r196752 - head/lib/libc/stdtime In-Reply-To: <20090904115255.Q48987@delplex.bde.org> References: <200909020456.n824uUqQ082136@svn.freebsd.org> <20090902070808.GA1290@arthur.nitro.dk> <20090902084002.GA17325@nagual.pp.ru> <867hwgcwvo.fsf@ds4.des.no> <20090903084325.GA65192@nagual.pp.ru> <86zl9c9z05.fsf@ds4.des.no> <20090904115255.Q48987@delplex.bde.org> Message-ID: <20090904144214.O49099@delplex.bde.org> On Fri, 4 Sep 2009, Bruce Evans wrote: > On Thu, 3 Sep 2009, [utf-8] Dag-Erling Smørgrav wrote: > >> What do you think of the attached patch? Oops, it is more broken than I noticed. Almost all ctype man pages already documented the requirements in even more detail than POSIX, since Andrey fixed the missing documentation to almost catch up with C99 and POSIX in Y2K, and tjr added more details on 6 Oct 2002. E.g., in isalpha.3: % The value of the argument must be representable as an % .Vt "unsigned char" % or the value of % .Dv EOF . This is the same as in POSIX except the POSIX wording is better (e.g., the above only says implicitly that the behaviour is undefined if "must" is not satisfied). It took too many commits (revs 1.8-1.10) to get this far. % ... % .Sh COMPATIBILITY % The % .Bx 4.4 % extension of accepting arguments outside of the range of the % .Vt "unsigned char" % type in locales with large character sets is considered obsolete % and may not be supported in future releases. % The % .Fn iswalpha % function should be used instead. This was added in rev.1.16. It also has bugs from not being merged with the old documentation about this problem -- it contradicts the "must", yet still doesn't say what the behaviour is for args outside the range: - are they classified as non-alpha, or are characters with (positive) values outside the range actually possible in some locales, with these characters being classified as alpha by this function and handled correctly by all ctype functions - we now have future releases, and the above says that these releases are not permitted to support this behaviour, so why do we still have it ;-) - what happens for the corresponding problem with iswalpha -- will the FreeBSD extension of not having these problems ever be documented or not permitted or actually go away? > % Index: lib/libc/locale/iscntrl.3 > % =================================================================== > % --- lib/libc/locale/iscntrl.3 (revision 196695) > % +++ lib/libc/locale/iscntrl.3 (working copy) > % @@ -32,7 +32,7 @@ > % .\" @(#)iscntrl.3 8.1 (Berkeley) 6/4/93 > % .\" $FreeBSD$ > % .\" > % -.Dd July 17, 2005 > % +.Dd September 3, 2009 > % .Dt ISCNTRL 3 > % .Os > % .Sh NAME > % @@ -65,6 +65,15 @@ > % .It "\&031\ EM \t032\ SUB \t033\ ESC \t034\ FS \t035\ GS" > % .It "\&036\ RS \t037\ US \t177\ DEL" > % .El > % +.Pp > % +.Em NOTE : > % +if the value passed to the > % +.Fn iscntrl > % +function is a > % +.Vt signed char , > % +as is usually the case, it must be cast to an > % +.Vt unsigned char > % +to avoid sign-extension errors. > > This wording is poor. It should be something like "if the value to be > passed is represented as a signed char" ... I don't know a good easy > way to fix "must be cast ... to avoid sign-extension errors". The "value to be passed" is wrong too, since the problematic negative values must not be passed. Anyway, teaching how to apply casts to satisfy the requirements of the API should be duplicated ad nauseum in man pages even less than the requirements of the API. Bruce From weongyo at FreeBSD.org Fri Sep 4 05:28:10 2009 From: weongyo at FreeBSD.org (Weongyo Jeong) Date: Fri Sep 4 05:28:17 2009 Subject: svn commit: r196809 - head/sys/dev/usb/wlan Message-ID: <200909040528.n845SAna054988@svn.freebsd.org> Author: weongyo Date: Fri Sep 4 05:28:09 2009 New Revision: 196809 URL: http://svn.freebsd.org/changeset/base/196809 Log: fix a TX issue on big endian machines like powerpc or sparc64. Now zyd(4) should work on all architectures. Obtained from: OpenBSD Modified: head/sys/dev/usb/wlan/if_zyd.c Modified: head/sys/dev/usb/wlan/if_zyd.c ============================================================================== --- head/sys/dev/usb/wlan/if_zyd.c Fri Sep 4 05:06:15 2009 (r196808) +++ head/sys/dev/usb/wlan/if_zyd.c Fri Sep 4 05:28:09 2009 (r196809) @@ -2547,7 +2547,7 @@ zyd_tx_start(struct zyd_softc *sc, struc bits = (rate == 11) ? (totlen * 16) + 10 : ((rate == 22) ? (totlen * 8) + 10 : (totlen * 8)); - desc->plcp_length = bits / ratediv[phy]; + desc->plcp_length = htole16(bits / ratediv[phy]); desc->plcp_service = 0; if (rate == 22 && (bits % 11) > 0 && (bits % 11) <= 3) desc->plcp_service |= ZYD_PLCP_LENGEXT; From weongyo at FreeBSD.org Fri Sep 4 05:37:50 2009 From: weongyo at FreeBSD.org (Weongyo Jeong) Date: Fri Sep 4 05:37:57 2009 Subject: svn commit: r196810 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/usb/wlan dev/xen/xenpci Message-ID: <200909040537.n845boWQ055241@svn.freebsd.org> Author: weongyo Date: Fri Sep 4 05:37:49 2009 New Revision: 196810 URL: http://svn.freebsd.org/changeset/base/196810 Log: MFC r196809: fix a TX issue on big endian machines like powerpc or sparc64. Now zyd(4) should work on all architectures. Obtained from: OpenBSD Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/usb/wlan/if_zyd.c stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/wlan/if_zyd.c ============================================================================== --- stable/8/sys/dev/usb/wlan/if_zyd.c Fri Sep 4 05:28:09 2009 (r196809) +++ stable/8/sys/dev/usb/wlan/if_zyd.c Fri Sep 4 05:37:49 2009 (r196810) @@ -2547,7 +2547,7 @@ zyd_tx_start(struct zyd_softc *sc, struc bits = (rate == 11) ? (totlen * 16) + 10 : ((rate == 22) ? (totlen * 8) + 10 : (totlen * 8)); - desc->plcp_length = bits / ratediv[phy]; + desc->plcp_length = htole16(bits / ratediv[phy]); desc->plcp_service = 0; if (rate == 22 && (bits % 11) > 0 && (bits % 11) <= 3) desc->plcp_service |= ZYD_PLCP_LENGEXT; From julian at FreeBSD.org Fri Sep 4 05:40:07 2009 From: julian at FreeBSD.org (Julian Elischer) Date: Fri Sep 4 05:40:18 2009 Subject: svn commit: r196811 - head/sys/i386/include Message-ID: <200909040540.n845e6nQ055325@svn.freebsd.org> Author: julian Date: Fri Sep 4 05:40:06 2009 New Revision: 196811 URL: http://svn.freebsd.org/changeset/base/196811 Log: Bring i386 up to date with amd64 and others. The macros for PCPU can be slightly simplified, which makes the resulting tangle qa lot easier to understand when trying to read them. MFC after: 4 weeks Modified: head/sys/i386/include/pcpu.h Modified: head/sys/i386/include/pcpu.h ============================================================================== --- head/sys/i386/include/pcpu.h Fri Sep 4 05:37:49 2009 (r196810) +++ head/sys/i386/include/pcpu.h Fri Sep 4 05:40:06 2009 (r196811) @@ -152,7 +152,7 @@ extern struct pcpu *pcpup; #define __PCPU_GET(name) __extension__ ({ \ __pcpu_type(name) __res; \ struct __s { \ - u_char __b[MIN(sizeof(__pcpu_type(name)), 4)]; \ + u_char __b[MIN(sizeof(__res), 4)]; \ } __s; \ \ if (sizeof(__res) == 1 || sizeof(__res) == 2 || \ @@ -174,7 +174,7 @@ extern struct pcpu *pcpup; #define __PCPU_ADD(name, val) do { \ __pcpu_type(name) __val; \ struct __s { \ - u_char __b[MIN(sizeof(__pcpu_type(name)), 4)]; \ + u_char __b[MIN(sizeof(__val), 4)]; \ } __s; \ \ __val = (val); \ @@ -214,10 +214,10 @@ extern struct pcpu *pcpup; /* * Sets the value of the per-cpu variable name to value val. */ -#define __PCPU_SET(name, val) { \ +#define __PCPU_SET(name, val) do { \ __pcpu_type(name) __val; \ struct __s { \ - u_char __b[MIN(sizeof(__pcpu_type(name)), 4)]; \ + u_char __b[MIN(sizeof(__val), 4)]; \ } __s; \ \ __val = (val); \ @@ -230,7 +230,7 @@ extern struct pcpu *pcpup; } else { \ *__PCPU_PTR(name) = __val; \ } \ -} +} while (0) #define PCPU_GET(member) __PCPU_GET(pc_ ## member) #define PCPU_ADD(member, val) __PCPU_ADD(pc_ ## member, val) From ache at FreeBSD.org Fri Sep 4 05:54:45 2009 From: ache at FreeBSD.org (Andrey A. Chernov) Date: Fri Sep 4 05:54:57 2009 Subject: svn commit: r196812 - head/share/monetdef Message-ID: <200909040554.n845sjlO055648@svn.freebsd.org> Author: ache Date: Fri Sep 4 05:54:45 2009 New Revision: 196812 URL: http://svn.freebsd.org/changeset/base/196812 Log: Add lv_LV PR: 105100 Submitted by: Aldis Berjoza Added: head/share/monetdef/lv_LV.ISO8859-13.src (contents, props changed) Modified: head/share/monetdef/Makefile Modified: head/share/monetdef/Makefile ============================================================================== --- head/share/monetdef/Makefile Fri Sep 4 05:40:06 2009 (r196811) +++ head/share/monetdef/Makefile Fri Sep 4 05:54:45 2009 (r196812) @@ -44,6 +44,7 @@ LOCALES= af_ZA.ISO8859-1 \ ko_KR.eucKR \ ko_KR.UTF-8 \ lt_LT.ISO8859-13 \ + lv_LV.ISO8859-13 \ mn_MN.UTF-8 \ nl_BE.ISO8859-1 \ nl_NL.ISO8859-1 \ @@ -117,7 +118,7 @@ ISO8859-2_UTF-8= hr_HR hu_HU ro_RO sk_SK ISO8859-7_UTF-8= el_GR ISO8859-9_UTF-8= tr_TR ISO8859-13_ISO8859-4= lt_LT -ISO8859-13_UTF-8= lt_LT +ISO8859-13_UTF-8= lt_LT lv_LV ISO8859-15_ISO8859-15= es_ES:eu_ES ISO8859-15_UTF-8= et_EE UTF-8_Big5HKSCS= zh_HK Added: head/share/monetdef/lv_LV.ISO8859-13.src ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/monetdef/lv_LV.ISO8859-13.src Fri Sep 4 05:54:45 2009 (r196812) @@ -0,0 +1,36 @@ +# $FreeBSD$ +# +# WARNING: spaces may be essential at the end of lines +# WARNING: empty lines are essential too +# +# int_curr_symbol (last character always SPACE) +LVL +# currency_symbol +Ls +# mon_decimal_point +, +# mon_thousands_sep + +# mon_grouping, separated by ; +3;3 +# positive_sign + +# negative_sign +- +# int_frac_digits +2 +# frac_digits +2 +# p_cs_precedes +0 +# p_sep_by_space +1 +# n_cs_precedes +0 +# n_sep_by_space +1 +# p_sign_posn +1 +# n_sign_posn +1 +# EOF From ache at FreeBSD.org Fri Sep 4 06:19:38 2009 From: ache at FreeBSD.org (Andrey A. Chernov) Date: Fri Sep 4 06:19:45 2009 Subject: svn commit: r196813 - head/share/msgdef Message-ID: <200909040619.n846Jbg8056322@svn.freebsd.org> Author: ache Date: Fri Sep 4 06:19:37 2009 New Revision: 196813 URL: http://svn.freebsd.org/changeset/base/196813 Log: Add lv_LV PR: 105100 Submitted by: Aldis Berjoza Added: head/share/msgdef/lv_LV.ISO8859-13.src (contents, props changed) head/share/msgdef/lv_LV.UTF-8.src (contents, props changed) Modified: head/share/msgdef/Makefile Modified: head/share/msgdef/Makefile ============================================================================== --- head/share/msgdef/Makefile Fri Sep 4 05:54:45 2009 (r196812) +++ head/share/msgdef/Makefile Fri Sep 4 06:19:37 2009 (r196813) @@ -40,6 +40,8 @@ LOCALES= af_ZA.ISO8859-1 \ ko_KR.UTF-8 \ ko_KR.eucKR \ lt_LT.ISO8859-13 \ + lv_LV.ISO8859-13 \ + lv_LV.UTF-8 \ mn_MN.UTF-8 \ nl_NL.ISO8859-1 \ no_NO.ISO8859-1 \ Added: head/share/msgdef/lv_LV.ISO8859-13.src ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/msgdef/lv_LV.ISO8859-13.src Fri Sep 4 06:19:37 2009 (r196813) @@ -0,0 +1,14 @@ +# $FreeBSD$ +# +# WARNING: spaces may be essential at the end of lines +# WARNING: empty lines are essential too +# +# yesexpr +^[jJyY].* +# noexpr +^[nN].* +# yesstr +jâ +# nostr +nç +# EOF Added: head/share/msgdef/lv_LV.UTF-8.src ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/msgdef/lv_LV.UTF-8.src Fri Sep 4 06:19:37 2009 (r196813) @@ -0,0 +1,14 @@ +# $FreeBSD$ +# +# WARNING: spaces may be essential at the end of lines +# WARNING: empty lines are essential too +# +# yesexpr +^[jJyY].* +# noexpr +^[nN].* +# yesstr +jÄ +# nostr +nÄ“ +# EOF From ache at FreeBSD.org Fri Sep 4 06:26:42 2009 From: ache at FreeBSD.org (Andrey A. Chernov) Date: Fri Sep 4 06:26:51 2009 Subject: svn commit: r196814 - head/share/timedef Message-ID: <200909040626.n846QfIo056506@svn.freebsd.org> Author: ache Date: Fri Sep 4 06:26:40 2009 New Revision: 196814 URL: http://svn.freebsd.org/changeset/base/196814 Log: Add lv_LV PR: 105100 Submitted by: Aldis Berjoza Added: head/share/timedef/lv_LV.ISO8859-13.src (contents, props changed) head/share/timedef/lv_LV.UTF-8.src (contents, props changed) Modified: head/share/timedef/Makefile Modified: head/share/timedef/Makefile ============================================================================== --- head/share/timedef/Makefile Fri Sep 4 06:19:37 2009 (r196813) +++ head/share/timedef/Makefile Fri Sep 4 06:26:40 2009 (r196814) @@ -53,6 +53,8 @@ LOCALES= am_ET.UTF-8 \ lt_LT.ISO8859-4 \ lt_LT.ISO8859-13 \ lt_LT.UTF-8 \ + lv_LV.ISO8859-13 \ + lv_LV.UTF-8 \ mn_MN.UTF-8 \ nb_NO.ISO8859-1 \ nb_NO.UTF-8 \ Added: head/share/timedef/lv_LV.ISO8859-13.src ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/timedef/lv_LV.ISO8859-13.src Fri Sep 4 06:26:40 2009 (r196814) @@ -0,0 +1,101 @@ +# $FreeBSD$ +# WARNING: spaces may be essential at the end of lines +# WARNING: empty lines are essential too +# +# Short month names +# +Jan +Feb +Mar +Apr +Mai +Jûn +Jûl +Aug +Sep +Okt +Nov +Dec +# +# Long month names +# +janvâris +februâris +marts +aprîlis +maijs +jûnijs +jûlijs +augusts +septembris +oktobris +novembris +decembris +# +# Short weekday names +# +Sv +Pr +Ot +Tr +Ct +Pk +Ss +# +# Long weekday names +# +Svçtdiena +Pirmdiena +Otrdiena +Treðdiena +Ceturtdiena +Piektdiena +Sestdiena +# +# X_fmt +# +%H:%M:%S +# +# x_fmt +# +%d/%m/%Y +# +# c_fmt +# %A, %Y m. %B %e d. %T +%e. %b, %Y. gads %X +# +# am +# + +# +# pm +# + +# +# date_fmt +# +%A, %Y. gada %e. %B %T %Z +# +# Long month names in alternative form +# +janvâris +februâris +marts +aprîlis +maijs +jûnijs +jûlijs +augusts +septembris +oktobris +novembris +decembris +# +# md_order +# +md +# +# ampm_fmt +# + +# EOF Added: head/share/timedef/lv_LV.UTF-8.src ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/timedef/lv_LV.UTF-8.src Fri Sep 4 06:26:40 2009 (r196814) @@ -0,0 +1,101 @@ +# $FreeBSD$ +# WARNING: spaces may be essential at the end of lines +# WARNING: empty lines are essential too +# +# Short month names +# +Jan +Feb +Mar +Apr +Mai +JÅ«n +JÅ«l +Aug +Sep +Okt +Nov +Dec +# +# Long month names +# +janvÄris +februÄris +marts +aprÄ«lis +maijs +jÅ«nijs +jÅ«lijs +augusts +septembris +oktobris +novembris +decembris +# +# Short weekday names +# +Sv +Pr +Ot +Tr +Ct +Pk +Ss +# +# Long weekday names +# +SvÄ“tdiena +Pirmdiena +Otrdiena +TreÅ¡diena +Ceturtdiena +Piektdiena +Sestdiena +# +# X_fmt +# +%H:%M:%S +# +# x_fmt +# +%d/%m/%Y +# +# c_fmt +# %A, %Y m. %B %e d. %T +%e. %b, %Y. gads %X +# +# am +# + +# +# pm +# + +# +# date_fmt +# +%A, %Y. gada %e. %B %T %Z +# +# Long month names in alternative form +# +janvÄris +februÄris +marts +aprÄ«lis +maijs +jÅ«nijs +jÅ«lijs +augusts +septembris +oktobris +novembris +decembris +# +# md_order +# +md +# +# ampm_fmt +# + +# EOF From remko at elvandar.org Fri Sep 4 06:37:45 2009 From: remko at elvandar.org (Remko Lodder) Date: Fri Sep 4 06:37:52 2009 Subject: svn commit: r196746 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/usb dev/usb/input dev/xen/xenpci In-Reply-To: <20090903234737.GH21946@elvis.mu.org> References: <200909020212.n822C7Il078379@svn.freebsd.org> <8497dc1520e5fe6b2b3727d5fb92f358.squirrel@www.jr-hosting.nl> <20090903234737.GH21946@elvis.mu.org> Message-ID: <9D3CE1CC-74A7-4913-857E-7BBC7E44A379@elvandar.org> On Sep 4, 2009, at 1:47 AM, Alfred Perlstein wrote: > Since this information is available via "svn log -g" > maybe we can fix the commit email script to include that > infomation instead? > > -Alfred > > Hey Alfred, I do not mind very much how the information gets there, but I find it very comfortable if it's there (it saves me a lot of time, and I can keep up with the project like this) thanks for thinking along! -- /"\ Best regards, | remko@FreeBSD.org \ / Remko Lodder | remko@EFnet X http://www.evilcoder.org/ | / \ ASCII Ribbon Campaign | Against HTML Mail and News From julian at FreeBSD.org Fri Sep 4 07:13:08 2009 From: julian at FreeBSD.org (Julian Elischer) Date: Fri Sep 4 07:13:14 2009 Subject: svn commit: r196815 - stable/8/share/man/man9 Message-ID: <200909040713.n847D7if057561@svn.freebsd.org> Author: julian Date: Fri Sep 4 07:13:07 2009 New Revision: 196815 URL: http://svn.freebsd.org/changeset/base/196815 Log: MFC r196450 Add clarifications to the kproc and kthread manpages and link the kthread_create(9) man page to the kproc(9) page as it has migrated and people looking for it may need a hand to find its new name. Approved by: re (kib) Modified: stable/8/share/man/man9/ (props changed) stable/8/share/man/man9/Makefile stable/8/share/man/man9/kproc.9 stable/8/share/man/man9/kthread.9 Modified: stable/8/share/man/man9/Makefile ============================================================================== --- stable/8/share/man/man9/Makefile Fri Sep 4 06:26:40 2009 (r196814) +++ stable/8/share/man/man9/Makefile Fri Sep 4 07:13:07 2009 (r196815) @@ -713,6 +713,7 @@ MLINKS+=kobj.9 DEFINE_CLASS.9 \ kobj.9 kobj_delete.9 \ kobj.9 kobj_init.9 MLINKS+=kproc.9 kproc_create.9 \ + kproc.9 kthread_create.9 \ kproc.9 kproc_exit.9 \ kproc.9 kproc_resume.9 \ kproc.9 kproc_shutdown.9 \ Modified: stable/8/share/man/man9/kproc.9 ============================================================================== --- stable/8/share/man/man9/kproc.9 Fri Sep 4 06:26:40 2009 (r196814) +++ stable/8/share/man/man9/kproc.9 Fri Sep 4 07:13:07 2009 (r196815) @@ -64,6 +64,28 @@ .Fa "int flags" "int pages" "char * procname" "const char *fmt" "..." .Fc .Sh DESCRIPTION +In +.Fx 8.0 , +the +.Fn kthread* 9 +family of functions was renamed to be the +.Fn kproc* 9 +family of functions, as they were misnamed +and actually produced kernel processes. +A new family of +.Em different +.Fn kthread_* 9 +functions was added to produce +.Em real +kernel +.Em threads . +See the +.Xr kthread 9 +man page for more information on those calls. +Also note that the +.Fn kproc_kthread_add 9 +function appears in both pages as its functionality is split. +.Pp The function .Fn kproc_start is used to start Modified: stable/8/share/man/man9/kthread.9 ============================================================================== --- stable/8/share/man/man9/kthread.9 Fri Sep 4 06:26:40 2009 (r196814) +++ stable/8/share/man/man9/kthread.9 Fri Sep 4 07:13:07 2009 (r196815) @@ -65,6 +65,27 @@ .Fa "int flags" "int pages" "char * procname" "const char *fmt" "..." .Fc .Sh DESCRIPTION +In +.Fx 8.0 , +the older family of +.Fn kthread_* 9 +functions was renamed to be the +.Fn kproc_* 9 +family of functions, +as they were previously misnamed +and actually produced kernel processes. +This new family of +.Fn kthread_* 9 +functions was added to produce +.Em real +kernel threads. +See the +.Xr kproc 9 +man page for more information on the renamed calls. +Also note that the +.Fn kproc_kthread_add 9 +function appears in both pages as its functionality is split. +.Pp The function .Fn kthread_start is used to start From julian at FreeBSD.org Fri Sep 4 07:29:25 2009 From: julian at FreeBSD.org (Julian Elischer) Date: Fri Sep 4 07:29:36 2009 Subject: svn commit: r196816 - head/sys/i386/include Message-ID: <200909040729.n847TPxD057926@svn.freebsd.org> Author: julian Date: Fri Sep 4 07:29:24 2009 New Revision: 196816 URL: http://svn.freebsd.org/changeset/base/196816 Log: whitespace commit Submitted by: bde@ Modified: head/sys/i386/include/pcpu.h Modified: head/sys/i386/include/pcpu.h ============================================================================== --- head/sys/i386/include/pcpu.h Fri Sep 4 07:13:07 2009 (r196815) +++ head/sys/i386/include/pcpu.h Fri Sep 4 07:29:24 2009 (r196816) @@ -152,7 +152,7 @@ extern struct pcpu *pcpup; #define __PCPU_GET(name) __extension__ ({ \ __pcpu_type(name) __res; \ struct __s { \ - u_char __b[MIN(sizeof(__res), 4)]; \ + u_char __b[MIN(sizeof(__res), 4)]; \ } __s; \ \ if (sizeof(__res) == 1 || sizeof(__res) == 2 || \ @@ -174,7 +174,7 @@ extern struct pcpu *pcpup; #define __PCPU_ADD(name, val) do { \ __pcpu_type(name) __val; \ struct __s { \ - u_char __b[MIN(sizeof(__val), 4)]; \ + u_char __b[MIN(sizeof(__val), 4)]; \ } __s; \ \ __val = (val); \ From ache at FreeBSD.org Fri Sep 4 07:42:14 2009 From: ache at FreeBSD.org (Andrey A. Chernov) Date: Fri Sep 4 07:42:21 2009 Subject: svn commit: r196818 - head/contrib/ee Message-ID: <200909040742.n847gD62058267@svn.freebsd.org> Author: ache Date: Fri Sep 4 07:42:13 2009 New Revision: 196818 URL: http://svn.freebsd.org/changeset/base/196818 Log: 1) Remove single occurance of HAS_CTYPE ifdef, ctype functions used here for a long time and needs their header in anycase. 2) Add (unsigned char) casts to more ctype macros. 3) Simplify menu input handling using ctype instead of range unguarded hardcoded tricks. Modified: head/contrib/ee/ee.c Modified: head/contrib/ee/ee.c ============================================================================== --- head/contrib/ee/ee.c Fri Sep 4 07:33:17 2009 (r196817) +++ head/contrib/ee/ee.c Fri Sep 4 07:42:13 2009 (r196818) @@ -72,10 +72,7 @@ char *version = "@(#) ee, version " EE_ #include #endif -#ifdef HAS_CTYPE #include -#endif - #include #include #include @@ -1973,7 +1970,7 @@ int sensitive; } else { - if (toupper(*strng1) != toupper(*strng2)) + if (toupper((unsigned char)*strng1) != toupper((unsigned char)*strng2)) equal = FALSE; } strng1++; @@ -2445,7 +2442,7 @@ int noverify; if ((text_changes) && (!noverify)) { ans = get_string(changes_made_prompt, TRUE); - if (toupper(*ans) == toupper(*yes_char)) + if (toupper((unsigned char)*ans) == toupper((unsigned char)*yes_char)) text_changes = FALSE; else return(0); @@ -2522,7 +2519,7 @@ int warn_if_exists; if ((temp_fp = fopen(file_name, "r"))) { tmp_point = get_string(file_exists_prompt, TRUE); - if (toupper(*tmp_point) == toupper(*yes_char)) + if (toupper((unsigned char)*tmp_point) == toupper((unsigned char)*yes_char)) write_flag = TRUE; else write_flag = FALSE; @@ -3437,14 +3434,13 @@ struct menu_entries menu_list[]; if (input == -1) exit(0); - if (((tolower(input) >= 'a') && (tolower(input) <= 'z')) || - ((input >= '0') && (input <= '9'))) + if (isascii(input) && isalnum(input)) { - if ((tolower(input) >= 'a') && (tolower(input) <= 'z')) + if (isalpha(input)) { temp = 1 + tolower(input) - 'a'; } - else if ((input >= '0') && (input <= '9')) + else if (isdigit(input)) { temp = (2 + 'z' - 'a') + (input - '0'); } From ache at FreeBSD.org Fri Sep 4 07:44:28 2009 From: ache at FreeBSD.org (Andrey A. Chernov) Date: Fri Sep 4 07:44:34 2009 Subject: svn commit: r196819 - head/usr.bin/ee Message-ID: <200909040744.n847iSMU058380@svn.freebsd.org> Author: ache Date: Fri Sep 4 07:44:27 2009 New Revision: 196819 URL: http://svn.freebsd.org/changeset/base/196819 Log: Remove single occurance of HAS_CTYPE ifdef, ctype functions used here for a long time and needs their header in anycase. Modified: head/usr.bin/ee/Makefile Modified: head/usr.bin/ee/Makefile ============================================================================== --- head/usr.bin/ee/Makefile Fri Sep 4 07:42:13 2009 (r196818) +++ head/usr.bin/ee/Makefile Fri Sep 4 07:44:27 2009 (r196819) @@ -3,7 +3,7 @@ .PATH: ${.CURDIR}/../../contrib/ee CFLAGS+= -DHAS_NCURSES -DHAS_UNISTD -DHAS_STDARG -DHAS_STDLIB \ - -DHAS_CTYPE -DHAS_SYS_WAIT + -DHAS_SYS_WAIT PROG= ee LINKS= ${BINDIR}/ee ${BINDIR}/ree ${BINDIR}/ee ${BINDIR}/edit From des at FreeBSD.org Fri Sep 4 07:44:58 2009 From: des at FreeBSD.org (Dag-Erling Smorgrav) Date: Fri Sep 4 07:45:05 2009 Subject: svn commit: r196820 - head/lib/libc/locale Message-ID: <200909040744.n847iwFs058425@svn.freebsd.org> Author: des Date: Fri Sep 4 07:44:58 2009 New Revision: 196820 URL: http://svn.freebsd.org/changeset/base/196820 Log: Let the armchair generals handle this one. Modified: head/lib/libc/locale/ctype.3 head/lib/libc/locale/digittoint.3 head/lib/libc/locale/isalnum.3 head/lib/libc/locale/isalpha.3 head/lib/libc/locale/isascii.3 head/lib/libc/locale/isblank.3 head/lib/libc/locale/iscntrl.3 head/lib/libc/locale/isdigit.3 head/lib/libc/locale/isgraph.3 head/lib/libc/locale/isideogram.3 head/lib/libc/locale/islower.3 head/lib/libc/locale/isphonogram.3 head/lib/libc/locale/isprint.3 head/lib/libc/locale/ispunct.3 head/lib/libc/locale/isrune.3 head/lib/libc/locale/isspace.3 head/lib/libc/locale/isspecial.3 head/lib/libc/locale/isupper.3 head/lib/libc/locale/isxdigit.3 head/lib/libc/locale/toascii.3 head/lib/libc/locale/tolower.3 head/lib/libc/locale/toupper.3 Modified: head/lib/libc/locale/ctype.3 ============================================================================== --- head/lib/libc/locale/ctype.3 Fri Sep 4 07:44:27 2009 (r196819) +++ head/lib/libc/locale/ctype.3 Fri Sep 4 07:44:58 2009 (r196820) @@ -28,7 +28,7 @@ .\" @(#)ctype.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 3, 2009 +.Dd March 30, 2004 .Dt CTYPE 3 .Os .Sh NAME @@ -111,13 +111,6 @@ They are available as macros, defined in .In ctype.h , or as true functions in the C library. See the specific manual pages for more information. -.Pp -.Em NOTE : -if the value passed to one of these functions is a -.Vt signed char , -as is usually the case, it must be cast to an -.Vt unsigned char -to avoid sign-extension errors. .Sh SEE ALSO .Xr digittoint 3 , .Xr isalnum 3 , Modified: head/lib/libc/locale/digittoint.3 ============================================================================== --- head/lib/libc/locale/digittoint.3 Fri Sep 4 07:44:27 2009 (r196819) +++ head/lib/libc/locale/digittoint.3 Fri Sep 4 07:44:58 2009 (r196820) @@ -28,7 +28,7 @@ .\" @(#)digittoint.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 3, 2009 +.Dd April 6, 2001 .Dt DIGITTOINT 3 .Os .Sh NAME @@ -46,15 +46,6 @@ The function converts a numeric character to its corresponding integer value. The character can be any decimal digit or hexadecimal digit. With hexadecimal characters, the case of the values does not matter. -.Pp -.Em NOTE : -if the value passed to the -.Fn digittoint -function is a -.Vt signed char , -as is usually the case, it must be cast to an -.Vt unsigned char -to avoid sign-extension errors. .Sh RETURN VALUES The .Fn digittoint Modified: head/lib/libc/locale/isalnum.3 ============================================================================== --- head/lib/libc/locale/isalnum.3 Fri Sep 4 07:44:27 2009 (r196819) +++ head/lib/libc/locale/isalnum.3 Fri Sep 4 07:44:58 2009 (r196820) @@ -32,7 +32,7 @@ .\" @(#)isalnum.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 3, 2009 +.Dd July 17, 2005 .Dt ISALNUM 3 .Os .Sh NAME @@ -75,15 +75,6 @@ In the ASCII character set, this include .It "\&164\ ``t'' \t165\ ``u'' \t166\ ``v'' \t167\ ``w'' \t170\ ``x''" .It "\&171\ ``y'' \t172\ ``z''" .El -.Pp -.Em NOTE : -if the value passed to the -.Fn isalnum -function is a -.Vt signed char , -as is usually the case, it must be cast to an -.Vt unsigned char -to avoid sign-extension errors. .Sh RETURN VALUES The .Fn isalnum Modified: head/lib/libc/locale/isalpha.3 ============================================================================== --- head/lib/libc/locale/isalpha.3 Fri Sep 4 07:44:27 2009 (r196819) +++ head/lib/libc/locale/isalpha.3 Fri Sep 4 07:44:58 2009 (r196820) @@ -32,7 +32,7 @@ .\" @(#)isalpha.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 3, 2009 +.Dd July 17, 2005 .Dt ISALPHA 3 .Os .Sh NAME @@ -73,15 +73,6 @@ In the ASCII character set, this include .It "\&164\ ``t'' \t165\ ``u'' \t166\ ``v'' \t167\ ``w'' \t170\ ``x''" .It "\&171\ ``y'' \t172\ ``z''" .El -.Pp -.Em NOTE : -if the value passed to the -.Fn isalpha -function is a -.Vt signed char , -as is usually the case, it must be cast to an -.Vt unsigned char -to avoid sign-extension errors. .Sh RETURN VALUES The .Fn isalpha Modified: head/lib/libc/locale/isascii.3 ============================================================================== --- head/lib/libc/locale/isascii.3 Fri Sep 4 07:44:27 2009 (r196819) +++ head/lib/libc/locale/isascii.3 Fri Sep 4 07:44:58 2009 (r196820) @@ -28,7 +28,7 @@ .\" @(#)isascii.3 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd September 3, 2009 +.Dd October 6, 2002 .Dt ISASCII 3 .Os .Sh NAME @@ -47,15 +47,6 @@ function tests for an .Tn ASCII character, which is any character between 0 and octal 0177 inclusive. -.Pp -.Em NOTE : -if the value passed to the -.Fn isascii -function is a -.Vt signed char , -as is usually the case, it must be cast to an -.Vt unsigned char -to avoid sign-extension errors. .Sh SEE ALSO .Xr ctype 3 , .Xr iswascii 3 , Modified: head/lib/libc/locale/isblank.3 ============================================================================== --- head/lib/libc/locale/isblank.3 Fri Sep 4 07:44:27 2009 (r196819) +++ head/lib/libc/locale/isblank.3 Fri Sep 4 07:44:58 2009 (r196820) @@ -28,7 +28,7 @@ .\" @(#)isblank.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 3, 2009 +.Dd July 17, 2005 .Dt ISBLANK 3 .Os .Sh NAME @@ -57,15 +57,6 @@ The value of the argument must be repres .Vt "unsigned char" or the value of .Dv EOF . -.Pp -.Em NOTE : -if the value passed to the -.Fn isblank -function is a -.Vt signed char , -as is usually the case, it must be cast to an -.Vt unsigned char -to avoid sign-extension errors. .Sh RETURN VALUES The .Fn isblank Modified: head/lib/libc/locale/iscntrl.3 ============================================================================== --- head/lib/libc/locale/iscntrl.3 Fri Sep 4 07:44:27 2009 (r196819) +++ head/lib/libc/locale/iscntrl.3 Fri Sep 4 07:44:58 2009 (r196820) @@ -32,7 +32,7 @@ .\" @(#)iscntrl.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 3, 2009 +.Dd July 17, 2005 .Dt ISCNTRL 3 .Os .Sh NAME @@ -65,15 +65,6 @@ In the ASCII character set, this include .It "\&031\ EM \t032\ SUB \t033\ ESC \t034\ FS \t035\ GS" .It "\&036\ RS \t037\ US \t177\ DEL" .El -.Pp -.Em NOTE : -if the value passed to the -.Fn iscntrl -function is a -.Vt signed char , -as is usually the case, it must be cast to an -.Vt unsigned char -to avoid sign-extension errors. .Sh RETURN VALUES The .Fn iscntrl Modified: head/lib/libc/locale/isdigit.3 ============================================================================== --- head/lib/libc/locale/isdigit.3 Fri Sep 4 07:44:27 2009 (r196819) +++ head/lib/libc/locale/isdigit.3 Fri Sep 4 07:44:58 2009 (r196820) @@ -32,7 +32,7 @@ .\" @(#)isdigit.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 3, 2009 +.Dd May 4, 2007 .Dt ISDIGIT 3 .Os .Sh NAME @@ -68,15 +68,6 @@ The value of the argument must be repres .Vt "unsigned char" or the value of .Dv EOF . -.Pp -.Em NOTE : -if the value passed to the -.Fn isdigit -function is a -.Vt signed char , -as is usually the case, it must be cast to an -.Vt unsigned char -to avoid sign-extension errors. .Sh RETURN VALUES The .Fn isdigit Modified: head/lib/libc/locale/isgraph.3 ============================================================================== --- head/lib/libc/locale/isgraph.3 Fri Sep 4 07:44:27 2009 (r196819) +++ head/lib/libc/locale/isgraph.3 Fri Sep 4 07:44:58 2009 (r196820) @@ -32,7 +32,7 @@ .\" @(#)isgraph.3 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd September 3, 2009 +.Dd July 17, 2005 .Dt ISGRAPH 3 .Os .Sh NAME @@ -80,15 +80,6 @@ In the ASCII character set, this include .It "\&166\ ``v'' \t167\ ``w'' \t170\ ``x'' \t171\ ``y'' \t172\ ``z''" .It "\&173\ ``{'' \t174\ ``|'' \t175\ ``}'' \t176\ ``~''" .El -.Pp -.Em NOTE : -if the value passed to the -.Fn isgraph -function is a -.Vt signed char , -as is usually the case, it must be cast to an -.Vt unsigned char -to avoid sign-extension errors. .Sh RETURN VALUES The .Fn isgraph Modified: head/lib/libc/locale/isideogram.3 ============================================================================== --- head/lib/libc/locale/isideogram.3 Fri Sep 4 07:44:27 2009 (r196819) +++ head/lib/libc/locale/isideogram.3 Fri Sep 4 07:44:58 2009 (r196820) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 3, 2009 +.Dd March 30, 2004 .Dt ISIDEOGRAM 3 .Os .Sh NAME @@ -41,15 +41,6 @@ The .Fn isideogram function tests for an ideographic character. -.Pp -.Em NOTE : -if the value passed to the -.Fn isideogram -function is a -.Vt signed char , -as is usually the case, it must be cast to an -.Vt unsigned char -to avoid sign-extension errors. .Sh RETURN VALUES The .Fn isideogram Modified: head/lib/libc/locale/islower.3 ============================================================================== --- head/lib/libc/locale/islower.3 Fri Sep 4 07:44:27 2009 (r196819) +++ head/lib/libc/locale/islower.3 Fri Sep 4 07:44:58 2009 (r196820) @@ -32,7 +32,7 @@ .\" @(#)islower.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 3, 2009 +.Dd July 17, 2005 .Dt ISLOWER 3 .Os .Sh NAME @@ -64,15 +64,6 @@ In the ASCII character set, this include .It "\&165\ ``u'' \t166\ ``v'' \t167\ ``w'' \t170\ ``x'' \t171\ ``y''" .It "\&172\ ``z''" .El -.Pp -.Em NOTE : -if the value passed to the -.Fn islower -function is a -.Vt signed char , -as is usually the case, it must be cast to an -.Vt unsigned char -to avoid sign-extension errors. .Sh RETURN VALUES The .Fn islower Modified: head/lib/libc/locale/isphonogram.3 ============================================================================== --- head/lib/libc/locale/isphonogram.3 Fri Sep 4 07:44:27 2009 (r196819) +++ head/lib/libc/locale/isphonogram.3 Fri Sep 4 07:44:58 2009 (r196820) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 3, 2009 +.Dd March 30, 2004 .Dt ISPHONOGRAM 3 .Os .Sh NAME @@ -41,15 +41,6 @@ The .Fn isphonogram function tests for a phonographic character. -.Pp -.Em NOTE : -if the value passed to the -.Fn isphonogram -function is a -.Vt signed char , -as is usually the case, it must be cast to an -.Vt unsigned char -to avoid sign-extension errors. .Sh RETURN VALUES The .Fn isphonogram Modified: head/lib/libc/locale/isprint.3 ============================================================================== --- head/lib/libc/locale/isprint.3 Fri Sep 4 07:44:27 2009 (r196819) +++ head/lib/libc/locale/isprint.3 Fri Sep 4 07:44:58 2009 (r196820) @@ -32,7 +32,7 @@ .\" @(#)isprint.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 3, 2009 +.Dd July 17, 2005 .Dt ISPRINT 3 .Os .Sh NAME @@ -78,15 +78,6 @@ In the ASCII character set, this include .It "\&165\ ``u'' \t166\ ``v'' \t167\ ``w'' \t170\ ``x'' \t171\ ``y''" .It "\&172\ ``z'' \t173\ ``{'' \t174\ ``|'' \t175\ ``}'' \t176\ ``~''" .El -.Pp -.Em NOTE : -if the value passed to the -.Fn isprint -function is a -.Vt signed char , -as is usually the case, it must be cast to an -.Vt unsigned char -to avoid sign-extension errors. .Sh RETURN VALUES The .Fn isprint Modified: head/lib/libc/locale/ispunct.3 ============================================================================== --- head/lib/libc/locale/ispunct.3 Fri Sep 4 07:44:27 2009 (r196819) +++ head/lib/libc/locale/ispunct.3 Fri Sep 4 07:44:58 2009 (r196820) @@ -32,7 +32,7 @@ .\" @(#)ispunct.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 3, 2009 +.Dd July 17, 2005 .Dt ISPUNCT 3 .Os .Sh NAME @@ -70,15 +70,6 @@ In the ASCII character set, this include .It "\&136\ ``^'' \t137\ ``_'' \t140\ ```'' \t173\ ``{'' \t174\ ``|''" .It "\&175\ ``}'' \t176\ ``~''" .El -.Pp -.Em NOTE : -if the value passed to the -.Fn ispunct -function is a -.Vt signed char , -as is usually the case, it must be cast to an -.Vt unsigned char -to avoid sign-extension errors. .Sh RETURN VALUES The .Fn ispunct Modified: head/lib/libc/locale/isrune.3 ============================================================================== --- head/lib/libc/locale/isrune.3 Fri Sep 4 07:44:27 2009 (r196819) +++ head/lib/libc/locale/isrune.3 Fri Sep 4 07:44:58 2009 (r196820) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 3, 2009 +.Dd March 30, 2004 .Dt ISRUNE 3 .Os .Sh NAME @@ -46,15 +46,6 @@ In the .Tn ASCII character set, this is equivalent to .Fn isascii . -.Pp -.Em NOTE : -if the value passed to the -.Fn isrune -function is a -.Vt signed char , -as is usually the case, it must be cast to an -.Vt unsigned char -to avoid sign-extension errors. .Sh RETURN VALUES The .Fn isrune Modified: head/lib/libc/locale/isspace.3 ============================================================================== --- head/lib/libc/locale/isspace.3 Fri Sep 4 07:44:27 2009 (r196819) +++ head/lib/libc/locale/isspace.3 Fri Sep 4 07:44:58 2009 (r196820) @@ -32,7 +32,7 @@ .\" @(#)isspace.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 3, 2009 +.Dd July 17, 2005 .Dt ISSPACE 3 .Os .Sh NAME @@ -61,15 +61,6 @@ The value of the argument must be repres .Vt "unsigned char" or the value of .Dv EOF . -.Pp -.Em NOTE : -if the value passed to the -.Fn isspace -function is a -.Vt signed char , -as is usually the case, it must be cast to an -.Vt unsigned char -to avoid sign-extension errors. .Sh RETURN VALUES The .Fn isspace Modified: head/lib/libc/locale/isspecial.3 ============================================================================== --- head/lib/libc/locale/isspecial.3 Fri Sep 4 07:44:27 2009 (r196819) +++ head/lib/libc/locale/isspecial.3 Fri Sep 4 07:44:58 2009 (r196820) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 3, 2009 +.Dd March 30, 2004 .Dt ISSPECIAL 3 .Os .Sh NAME @@ -41,15 +41,6 @@ The .Fn isspecial function tests for a special character. -.Pp -.Em NOTE : -if the value passed to the -.Fn isspecial -function is a -.Vt signed char , -as is usually the case, it must be cast to an -.Vt unsigned char -to avoid sign-extension errors. .Sh RETURN VALUES The .Fn isspecial Modified: head/lib/libc/locale/isupper.3 ============================================================================== --- head/lib/libc/locale/isupper.3 Fri Sep 4 07:44:27 2009 (r196819) +++ head/lib/libc/locale/isupper.3 Fri Sep 4 07:44:58 2009 (r196820) @@ -32,7 +32,7 @@ .\" @(#)isupper.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 3, 2009 +.Dd July 17, 2005 .Dt ISUPPER 3 .Os .Sh NAME @@ -64,15 +64,6 @@ In the ASCII character set, this include .It "\&125\ ``U'' \t126\ ``V'' \t127\ ``W'' \t130\ ``X'' \t131\ ``Y''" .It "\&132\ ``Z''" .El -.Pp -.Em NOTE : -if the value passed to the -.Fn isupper -function is a -.Vt signed char , -as is usually the case, it must be cast to an -.Vt unsigned char -to avoid sign-extension errors. .Sh RETURN VALUES The .Fn isupper Modified: head/lib/libc/locale/isxdigit.3 ============================================================================== --- head/lib/libc/locale/isxdigit.3 Fri Sep 4 07:44:27 2009 (r196819) +++ head/lib/libc/locale/isxdigit.3 Fri Sep 4 07:44:58 2009 (r196820) @@ -32,7 +32,7 @@ .\" @(#)isxdigit.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 3, 2009 +.Dd July 17, 2005 .Dt ISXDIGIT 3 .Os .Sh NAME @@ -71,15 +71,6 @@ The value of the argument must be repres .Vt "unsigned char" or the value of .Dv EOF . -.Pp -.Em NOTE : -if the value passed to the -.Fn isxdigit -function is a -.Vt signed char , -as is usually the case, it must be cast to an -.Vt unsigned char -to avoid sign-extension errors. .Sh RETURN VALUES The .Fn isxdigit Modified: head/lib/libc/locale/toascii.3 ============================================================================== --- head/lib/libc/locale/toascii.3 Fri Sep 4 07:44:27 2009 (r196819) +++ head/lib/libc/locale/toascii.3 Fri Sep 4 07:44:58 2009 (r196820) @@ -28,7 +28,7 @@ .\" @(#)toascii.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 3, 2009 +.Dd June 4, 1993 .Dt TOASCII 3 .Os .Sh NAME @@ -45,15 +45,6 @@ The .Fn toascii function strips all but the low 7 bits from a letter, including parity or other marker bits. -.Pp -.Em NOTE : -if the value passed to the -.Fn toascii -function is a -.Vt signed char , -as is usually the case, it must be cast to an -.Vt unsigned char -to avoid sign-extension errors. .Sh RETURN VALUES The .Fn toascii Modified: head/lib/libc/locale/tolower.3 ============================================================================== --- head/lib/libc/locale/tolower.3 Fri Sep 4 07:44:27 2009 (r196819) +++ head/lib/libc/locale/tolower.3 Fri Sep 4 07:44:58 2009 (r196820) @@ -32,7 +32,7 @@ .\" @(#)tolower.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 3, 2009 +.Dd July 17, 2005 .Dt TOLOWER 3 .Os .Sh NAME @@ -53,15 +53,6 @@ The argument must be representable as an .Vt "unsigned char" or the value of .Dv EOF . -.Pp -.Em NOTE : -if the value passed to the -.Fn tolower -function is a -.Vt signed char , -as is usually the case, it must be cast to an -.Vt unsigned char -to avoid sign-extension errors. .Sh RETURN VALUES If the argument is an upper-case letter, the .Fn tolower Modified: head/lib/libc/locale/toupper.3 ============================================================================== --- head/lib/libc/locale/toupper.3 Fri Sep 4 07:44:27 2009 (r196819) +++ head/lib/libc/locale/toupper.3 Fri Sep 4 07:44:58 2009 (r196820) @@ -32,7 +32,7 @@ .\" @(#)toupper.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 3, 2009 +.Dd July 17, 2005 .Dt TOUPPER 3 .Os .Sh NAME @@ -53,15 +53,6 @@ The argument must be representable as an .Vt "unsigned char" or the value of .Dv EOF . -.Pp -.Em NOTE : -if the value passed to the -.Fn toupper -function is a -.Vt signed char , -as is usually the case, it must be cast to an -.Vt unsigned char -to avoid sign-extension errors. .Sh RETURN VALUES If the argument is a lower-case letter, the .Fn toupper From ache at nagual.pp.ru Fri Sep 4 07:53:46 2009 From: ache at nagual.pp.ru (Andrey Chernov) Date: Fri Sep 4 07:53:57 2009 Subject: svn commit: r196752 - head/lib/libc/stdtime In-Reply-To: <20090904144214.O49099@delplex.bde.org> References: <200909020456.n824uUqQ082136@svn.freebsd.org> <20090902070808.GA1290@arthur.nitro.dk> <20090902084002.GA17325@nagual.pp.ru> <867hwgcwvo.fsf@ds4.des.no> <20090903084325.GA65192@nagual.pp.ru> <86zl9c9z05.fsf@ds4.des.no> <20090904115255.Q48987@delplex.bde.org> <20090904144214.O49099@delplex.bde.org> Message-ID: <20090904075338.GA90644@nagual.pp.ru> On Fri, Sep 04, 2009 at 03:21:09PM +1000, Bruce Evans wrote: > % The value of the argument must be representable as an > % .Vt "unsigned char" > % or the value of > % .Dv EOF . > > This is the same as in POSIX except the POSIX wording is better (e.g., > the above only says implicitly that the behaviour is undefined if > "must" is not satisfied). It took too many commits (revs 1.8-1.10) to > get this far. BTW, do we have permissions for direct POSIX quotes? -- http://ache.pp.ru/ From des at des.no Fri Sep 4 07:53:50 2009 From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) Date: Fri Sep 4 07:54:08 2009 Subject: svn commit: r196746 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/usb dev/usb/input dev/xen/xenpci In-Reply-To: <20090903234737.GH21946@elvis.mu.org> (Alfred Perlstein's message of "Thu, 3 Sep 2009 16:47:37 -0700") References: <200909020212.n822C7Il078379@svn.freebsd.org> <8497dc1520e5fe6b2b3727d5fb92f358.squirrel@www.jr-hosting.nl> <20090903234737.GH21946@elvis.mu.org> Message-ID: <86d467jgc4.fsf@ds4.des.no> Alfred Perlstein writes: > Since this information is available via "svn log -g" maybe we can fix > the commit email script to include that infomation instead? Because some people like to use "svn log" from time to time. DES -- Dag-Erling Sm?rgrav - des@des.no From simon at FreeBSD.org Fri Sep 4 08:59:08 2009 From: simon at FreeBSD.org (Simon L. Nielsen) Date: Fri Sep 4 08:59:19 2009 Subject: svn commit: r196752 - head/lib/libc/stdtime In-Reply-To: <20090904075338.GA90644@nagual.pp.ru> References: <200909020456.n824uUqQ082136@svn.freebsd.org> <20090902070808.GA1290@arthur.nitro.dk> <20090902084002.GA17325@nagual.pp.ru> <867hwgcwvo.fsf@ds4.des.no> <20090903084325.GA65192@nagual.pp.ru> <86zl9c9z05.fsf@ds4.des.no> <20090904115255.Q48987@delplex.bde.org> <20090904144214.O49099@delplex.bde.org> <20090904075338.GA90644@nagual.pp.ru> Message-ID: <20090904085854.GA1311@zaphod.nitro.dk> On 2009.09.04 11:53:39 +0400, Andrey Chernov wrote: > On Fri, Sep 04, 2009 at 03:21:09PM +1000, Bruce Evans wrote: > > % The value of the argument must be representable as an > > % .Vt "unsigned char" > > % or the value of > > % .Dv EOF . > > > > This is the same as in POSIX except the POSIX wording is better (e.g., > > the above only says implicitly that the behaviour is undefined if > > "must" is not satisfied). It took too many commits (revs 1.8-1.10) to > > get this far. > > BTW, do we have permissions for direct POSIX quotes? Yes. I thought I had made a web page about it, but I can't find it now, but see this: http://lists.freebsd.org/pipermail/freebsd-doc/2005-January/006862.html We haven't used it much AFAIK, but there are a few manual pages which does make use of POSIX text. -- Simon L. Nielsen From pjd at FreeBSD.org Fri Sep 4 09:33:51 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Fri Sep 4 09:33:57 2009 Subject: svn commit: r196822 - head/sys/dev/ata Message-ID: <200909040933.n849Xoh3060664@svn.freebsd.org> Author: pjd Date: Fri Sep 4 09:33:50 2009 New Revision: 196822 URL: http://svn.freebsd.org/changeset/base/196822 Log: Remove 'ad:' prefix from disk serial number. We don't want serial number to change when we reconnect the disk in a way that it is accessible through CAM for example. Discussed with: trasz Modified: head/sys/dev/ata/ata-disk.c Modified: head/sys/dev/ata/ata-disk.c ============================================================================== --- head/sys/dev/ata/ata-disk.c Fri Sep 4 08:21:49 2009 (r196821) +++ head/sys/dev/ata/ata-disk.c Fri Sep 4 09:33:50 2009 (r196822) @@ -136,8 +136,8 @@ ad_attach(device_t dev) if ((atadev->param.support.command2 & ATA_SUPPORT_CFA) || atadev->param.config == ATA_PROTO_CFA) adp->disk->d_flags = DISKFLAG_CANDELETE; - snprintf(adp->disk->d_ident, sizeof(adp->disk->d_ident), "ad:%s", - atadev->param.serial); + strlcpy(adp->disk->d_ident, atadev->param.serial, + sizeof(adp->disk->d_ident)); disk_create(adp->disk, DISK_VERSION); device_add_child(dev, "subdisk", device_get_unit(dev)); ad_firmware_geom_adjust(dev, adp->disk); From pjd at FreeBSD.org Fri Sep 4 09:39:06 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Fri Sep 4 09:39:18 2009 Subject: svn commit: r196823 - head/sys/geom Message-ID: <200909040939.n849d63V060800@svn.freebsd.org> Author: pjd Date: Fri Sep 4 09:39:06 2009 New Revision: 196823 URL: http://svn.freebsd.org/changeset/base/196823 Log: Simplify g_disk_ident_adjust() function and allow any printable character in serial number. Discussed with: trasz Obtained from: Wheel Sp. z o.o. (http://www.wheel.pl) Modified: head/sys/geom/geom_disk.c Modified: head/sys/geom/geom_disk.c ============================================================================== --- head/sys/geom/geom_disk.c Fri Sep 4 09:33:50 2009 (r196822) +++ head/sys/geom/geom_disk.c Fri Sep 4 09:39:06 2009 (r196823) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -400,39 +401,25 @@ g_disk_destroy(void *ptr, int flag) } /* - * We only allow [a-zA-Z0-9-_@#%.:] characters, the rest is converted to 'x'. + * We only allow printable characters in disk ident, + * the rest is converted to 'x'. */ static void g_disk_ident_adjust(char *ident, size_t size) { - char newid[DISK_IDENT_SIZE], tmp[4]; - size_t len; - char *p; - - bzero(newid, sizeof(newid)); - len = 0; - for (p = ident; *p != '\0' && len < sizeof(newid) - 1; p++) { - switch (*p) { - default: - if ((*p < 'a' || *p > 'z') && - (*p < 'A' || *p > 'Z') && - (*p < '0' || *p > '9')) { - snprintf(tmp, sizeof(tmp), "x%02hhx", *p); - strlcat(newid, tmp, sizeof(newid)); - len += 3; - break; - } - /* FALLTHROUGH */ - case '-': - case '_': - case '@': - case '#': - case '%': - case '.': - case ':': - newid[len++] = *p; - break; + char *p, tmp[4], newid[DISK_IDENT_SIZE]; + + newid[0] = '\0'; + for (p = ident; *p != '\0'; p++) { + if (isprint(*p)) { + tmp[0] = *p; + tmp[1] = '\0'; + } else { + snprintf(tmp, sizeof(tmp), "x%02hhx", + *(unsigned char *)p); } + if (strlcat(newid, tmp, sizeof(newid)) >= sizeof(newid)) + break; } bzero(ident, size); strlcpy(ident, newid, size); From pjd at FreeBSD.org Fri Sep 4 09:41:00 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Fri Sep 4 09:41:06 2009 Subject: svn commit: r196824 - head/sys/cam/scsi Message-ID: <200909040940.n849exab060884@svn.freebsd.org> Author: pjd Date: Fri Sep 4 09:40:59 2009 New Revision: 196824 URL: http://svn.freebsd.org/changeset/base/196824 Log: Make serial numbers of daX disks visible by GEOM. No objections from: scottl Obtained from: Wheel Sp. z o.o. (http://www.wheel.pl) Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Fri Sep 4 09:39:06 2009 (r196823) +++ head/sys/cam/scsi/scsi_da.c Fri Sep 4 09:40:59 2009 (r196824) @@ -1266,6 +1266,8 @@ daregister(struct cam_periph *periph, vo softc->disk->d_flags = 0; if ((softc->quirks & DA_Q_NO_SYNC_CACHE) == 0) softc->disk->d_flags |= DISKFLAG_CANFLUSHCACHE; + strlcpy(softc->disk->d_ident, cgd->serial_num, + MIN(sizeof(softc->disk->d_ident), cgd->serial_num_len + 1)); disk_create(softc->disk, DISK_VERSION); mtx_lock(periph->sim->mtx); From pjd at FreeBSD.org Fri Sep 4 09:48:19 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Fri Sep 4 09:48:29 2009 Subject: svn commit: r196825 - head/sys/opencrypto Message-ID: <200909040948.n849mI3Y061075@svn.freebsd.org> Author: pjd Date: Fri Sep 4 09:48:18 2009 New Revision: 196825 URL: http://svn.freebsd.org/changeset/base/196825 Log: If crypto operation is finished with EAGAIN, don't repeat operation from the return context, but from the original context. Before repeating operation clear DONE flag and error. Reviewed by: sam Obtained from: Wheel Sp. z o.o. (http://www.wheel.pl) Modified: head/sys/opencrypto/cryptodev.c Modified: head/sys/opencrypto/cryptodev.c ============================================================================== --- head/sys/opencrypto/cryptodev.c Fri Sep 4 09:40:59 2009 (r196824) +++ head/sys/opencrypto/cryptodev.c Fri Sep 4 09:48:18 2009 (r196825) @@ -496,6 +496,7 @@ cryptodev_op( goto bail; } +again: /* * Let the dispatch run unlocked, then, interlock against the * callback before checking if the operation completed and going @@ -512,6 +513,12 @@ cryptodev_op( if (error != 0) goto bail; + if (crp->crp_etype == EAGAIN) { + crp->crp_etype = 0; + crp->crp_flags &= ~CRYPTO_F_DONE; + goto again; + } + if (crp->crp_etype != 0) { error = crp->crp_etype; goto bail; @@ -545,16 +552,10 @@ cryptodev_cb(void *op) { struct cryptop *crp = (struct cryptop *) op; struct csession *cse = (struct csession *)crp->crp_opaque; - int error; - error = crp->crp_etype; - if (error == EAGAIN) - error = crypto_dispatch(crp); mtx_lock(&cse->lock); - if (error != 0 || (crp->crp_flags & CRYPTO_F_DONE)) { - cse->error = error; - wakeup_one(crp); - } + cse->error = crp->crp_etype; + wakeup_one(crp); mtx_unlock(&cse->lock); return (0); } From trasz at FreeBSD.org Fri Sep 4 09:57:03 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Fri Sep 4 09:57:15 2009 Subject: svn commit: r196826 - head/sys/dev/usb/storage Message-ID: <200909040957.n849v3MZ061284@svn.freebsd.org> Author: trasz Date: Fri Sep 4 09:57:03 2009 New Revision: 196826 URL: http://svn.freebsd.org/changeset/base/196826 Log: Make umass(4) pass device USB serial number to CAM, making it possible to e.g. retrieve it using camcontrol(8). Reviewed by: scottl, hps (earlier version) Obtained from: Wheel Sp. z o.o. (http://www.wheel.pl) Modified: head/sys/dev/usb/storage/umass.c Modified: head/sys/dev/usb/storage/umass.c ============================================================================== --- head/sys/dev/usb/storage/umass.c Fri Sep 4 09:48:18 2009 (r196825) +++ head/sys/dev/usb/storage/umass.c Fri Sep 4 09:57:03 2009 (r196826) @@ -124,6 +124,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "usbdevs.h" #include @@ -2978,6 +2979,28 @@ umass_cam_action(struct cam_sim *sim, un if (sc->sc_transfer.cmd_data[0] == INQUIRY) { /* + * Umass devices don't generally report their serial numbers + * in the usual SCSI way. Emulate it here. + */ + if ((sc->sc_transfer.cmd_data[1] & SI_EVPD) && + sc->sc_transfer.cmd_data[2] == SVPD_UNIT_SERIAL_NUMBER && + sc->sc_udev != NULL && + sc->sc_udev->serial != NULL && + sc->sc_udev->serial[0] != '\0') { + struct scsi_vpd_unit_serial_number *vpd_serial; + + vpd_serial = (struct scsi_vpd_unit_serial_number *)ccb->csio.data_ptr; + vpd_serial->length = strlen(sc->sc_udev->serial); + if (vpd_serial->length > sizeof(vpd_serial->serial_num)) + vpd_serial->length = sizeof(vpd_serial->serial_num); + memcpy(vpd_serial->serial_num, sc->sc_udev->serial, vpd_serial->length); + ccb->csio.scsi_status = SCSI_STATUS_OK; + ccb->ccb_h.status = CAM_REQ_CMP; + xpt_done(ccb); + goto done; + } + + /* * Handle EVPD inquiry for broken devices first * NO_INQUIRY also implies NO_INQUIRY_EVPD */ @@ -3193,6 +3216,29 @@ umass_cam_cb(struct umass_softc *sc, uni maxsector = scsi_4btoul(rcap->addr) - 1; scsi_ulto4b(maxsector, rcap->addr); } + /* + * We have to add SVPD_UNIT_SERIAL_NUMBER to the list + * of pages supported by the device - otherwise, CAM + * will never ask us for the serial number if the + * device cannot handle that by itself. + */ + if (ccb->ccb_h.func_code == XPT_SCSI_IO && + sc->sc_transfer.cmd_data[0] == INQUIRY && + (sc->sc_transfer.cmd_data[1] & SI_EVPD) && + sc->sc_transfer.cmd_data[2] == SVPD_SUPPORTED_PAGE_LIST && + sc->sc_udev != NULL && + sc->sc_udev->serial != NULL && + sc->sc_udev->serial[0] != '\0') { + struct ccb_scsiio *csio; + struct scsi_vpd_supported_page_list *page_list; + + csio = &ccb->csio; + page_list = (struct scsi_vpd_supported_page_list *)csio->data_ptr; + if (page_list->length + 1 < SVPD_SUPPORTED_PAGES_SIZE) { + page_list->list[page_list->length] = SVPD_UNIT_SERIAL_NUMBER; + page_list->length++; + } + } xpt_done(ccb); break; From trasz at FreeBSD.org Fri Sep 4 10:22:29 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Fri Sep 4 10:22:40 2009 Subject: svn commit: r196827 - head/bin/getfacl Message-ID: <200909041022.n84AMTJD061884@svn.freebsd.org> Author: trasz Date: Fri Sep 4 10:22:29 2009 New Revision: 196827 URL: http://svn.freebsd.org/changeset/base/196827 Log: Add NFSv4 ACL support to getfacl(1). Reviewed by: rwatson Modified: head/bin/getfacl/getfacl.1 head/bin/getfacl/getfacl.c Modified: head/bin/getfacl/getfacl.1 ============================================================================== --- head/bin/getfacl/getfacl.1 Fri Sep 4 09:57:03 2009 (r196826) +++ head/bin/getfacl/getfacl.1 Fri Sep 4 10:22:29 2009 (r196827) @@ -30,7 +30,7 @@ .\" Developed by the TrustedBSD Project. .\" Support for POSIX.1e access control lists. .\" -.Dd March 13, 2006 +.Dd September 04, 2009 .Dt GETFACL 1 .Os .Sh NAME @@ -38,7 +38,7 @@ .Nd get ACL information .Sh SYNOPSIS .Nm -.Op Fl dhq +.Op Fl dhinqv .Op Ar .Sh DESCRIPTION The @@ -61,13 +61,25 @@ The operation applies to the default ACL access ACL. An error is generated if a default ACL cannot be associated with .Ar file . +This option is not valid for NFSv4 ACLs. .It Fl h If the target of the operation is a symbolic link, return the ACL from the symbolic link itself rather than following the link. +.It Fl i +For NFSv4 ACLs, append numerical ID at the end of each entry containing +user or group name. +Ignored for POSIX.1e ACLs. +.It Fl n +Display user and group IDs numerically rather than converting to +a user or group name. +Ignored for POSIX.1e ACLs. .It Fl q Do not write commented information about file name and ownership. This is useful when dealing with filenames with unprintable characters. +.It Fl v +For NFSv4 ACLs, display access mask and flags in a verbose form. +Ignored for POSIX.1e ACLs. .El .Pp The following operand is available: Modified: head/bin/getfacl/getfacl.c ============================================================================== --- head/bin/getfacl/getfacl.c Fri Sep 4 09:57:03 2009 (r196826) +++ head/bin/getfacl/getfacl.c Fri Sep 4 10:22:29 2009 (r196827) @@ -54,7 +54,7 @@ static void usage(void) { - fprintf(stderr, "getfacl [-dhq] [file ...]\n"); + fprintf(stderr, "getfacl [-dhnqv] [file ...]\n"); } static char * @@ -175,22 +175,39 @@ acl_from_stat(struct stat sb) } static int -print_acl(char *path, acl_type_t type, int hflag, int qflag) +print_acl(char *path, acl_type_t type, int hflag, int iflag, int nflag, + int qflag, int vflag) { struct stat sb; acl_t acl; char *acl_text; - int error; + int error, flags = 0, ret; if (hflag) error = lstat(path, &sb); else error = stat(path, &sb); if (error == -1) { - warn("%s", path); + warn("%s: stat() failed", path); return(-1); } + if (hflag) + ret = lpathconf(path, _PC_ACL_NFS4); + else + ret = pathconf(path, _PC_ACL_NFS4); + if (ret > 0) { + if (type == ACL_TYPE_DEFAULT) { + warnx("%s: there are no default entries in NFSv4 ACLs", + path); + return (-1); + } + type = ACL_TYPE_NFS4; + } else if (ret < 0 && errno != EINVAL) { + warn("%s: pathconf(..., _PC_ACL_NFS4) failed", path); + return (-1); + } + if (more_than_one) printf("\n"); else @@ -210,18 +227,27 @@ print_acl(char *path, acl_type_t type, i return(-1); } errno = 0; - if (type != ACL_TYPE_ACCESS) + if (type == ACL_TYPE_DEFAULT) return(0); acl = acl_from_stat(sb); if (!acl) { - warn("acl_from_stat()"); + warn("%s: acl_from_stat() failed", path); return(-1); } } - acl_text = acl_to_text(acl, 0); + if (iflag) + flags |= ACL_TEXT_APPEND_ID; + + if (nflag) + flags |= ACL_TEXT_NUMERIC_IDS; + + if (vflag) + flags |= ACL_TEXT_VERBOSE; + + acl_text = acl_to_text_np(acl, 0, flags); if (!acl_text) { - warn("%s", path); + warn("%s: acl_to_text_np() failed", path); return(-1); } @@ -234,7 +260,8 @@ print_acl(char *path, acl_type_t type, i } static int -print_acl_from_stdin(acl_type_t type, int hflag, int qflag) +print_acl_from_stdin(acl_type_t type, int hflag, int iflag, int nflag, + int qflag, int vflag) { char *p, pathname[PATH_MAX]; int carried_error = 0; @@ -242,7 +269,8 @@ print_acl_from_stdin(acl_type_t type, in while (fgets(pathname, (int)sizeof(pathname), stdin)) { if ((p = strchr(pathname, '\n')) != NULL) *p = '\0'; - if (print_acl(pathname, type, hflag, qflag) == -1) { + if (print_acl(pathname, type, hflag, iflag, nflag, + qflag, vflag) == -1) { carried_error = -1; } } @@ -256,11 +284,14 @@ main(int argc, char *argv[]) acl_type_t type = ACL_TYPE_ACCESS; int carried_error = 0; int ch, error, i; - int hflag, qflag; + int hflag, iflag, qflag, nflag, vflag; hflag = 0; + iflag = 0; qflag = 0; - while ((ch = getopt(argc, argv, "dhq")) != -1) + nflag = 0; + vflag = 0; + while ((ch = getopt(argc, argv, "dhinqv")) != -1) switch(ch) { case 'd': type = ACL_TYPE_DEFAULT; @@ -268,9 +299,18 @@ main(int argc, char *argv[]) case 'h': hflag = 1; break; + case 'i': + iflag = 1; + break; + case 'n': + nflag = 1; + break; case 'q': qflag = 1; break; + case 'v': + vflag = 1; + break; default: usage(); return(-1); @@ -279,17 +319,20 @@ main(int argc, char *argv[]) argv += optind; if (argc == 0) { - error = print_acl_from_stdin(type, hflag, qflag); + error = print_acl_from_stdin(type, hflag, iflag, nflag, + qflag, vflag); return(error ? 1 : 0); } for (i = 0; i < argc; i++) { if (!strcmp(argv[i], "-")) { - error = print_acl_from_stdin(type, hflag, qflag); + error = print_acl_from_stdin(type, hflag, iflag, nflag, + qflag, vflag); if (error == -1) carried_error = -1; } else { - error = print_acl(argv[i], type, hflag, qflag); + error = print_acl(argv[i], type, hflag, iflag, nflag, + qflag, vflag); if (error == -1) carried_error = -1; } From ed at 80386.nl Fri Sep 4 10:32:16 2009 From: ed at 80386.nl (Ed Schouten) Date: Fri Sep 4 10:32:22 2009 Subject: svn commit: r196818 - head/contrib/ee In-Reply-To: <200909040742.n847gD62058267@svn.freebsd.org> References: <200909040742.n847gD62058267@svn.freebsd.org> Message-ID: <20090904103214.GW2829@hoeg.nl> Hello Andrey, * Andrey A. Chernov wrote: > 1) Remove single occurance of HAS_CTYPE ifdef, ctype functions > used here for a long time and needs their header in anycase. > 2) Add (unsigned char) casts to more ctype macros. > 3) Simplify menu input handling using ctype instead of range unguarded > hardcoded tricks. Even though I really appreciate fixes/cleanups to ee(1), I think changes like these should be sent to its maintainer as well. Have you done this? -- Ed Schouten WWW: http://80386.nl/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090904/0f69f70f/attachment.pgp From stas at FreeBSD.org Fri Sep 4 11:32:06 2009 From: stas at FreeBSD.org (Stanislav Sedov) Date: Fri Sep 4 11:32:22 2009 Subject: svn commit: r196828 - in stable/8/sys: . amd64/include/xen cam/scsi cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci Message-ID: <200909041132.n84BW5H5065617@svn.freebsd.org> Author: stas Date: Fri Sep 4 11:32:05 2009 New Revision: 196828 URL: http://svn.freebsd.org/changeset/base/196828 Log: - MFC r196568: - Add quirk for Sony DSC digital cameras. This umass devices fail to attach without these quirks applied. Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cam/scsi/scsi_da.c stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_da.c Fri Sep 4 10:22:29 2009 (r196827) +++ stable/8/sys/cam/scsi/scsi_da.c Fri Sep 4 11:32:05 2009 (r196828) @@ -554,6 +554,14 @@ static struct da_quirk_entry da_quirk_ta { {T_DIRECT, SIP_MEDIA_REMOVABLE, "Netac", "OnlyDisk*", "2000"}, /*quirks*/ DA_Q_NO_SYNC_CACHE + }, + { + /* + * Sony Cyber-Shot DSC cameras + * PR: usb/137035 + */ + {T_DIRECT, SIP_MEDIA_REMOVABLE, "Sony", "Sony DSC", "*"}, + /*quirks*/ DA_Q_NO_SYNC_CACHE | DA_Q_NO_PREVENT } }; From ache at nagual.pp.ru Fri Sep 4 14:02:28 2009 From: ache at nagual.pp.ru (Andrey Chernov) Date: Fri Sep 4 14:02:35 2009 Subject: svn commit: r196818 - head/contrib/ee In-Reply-To: <20090904103214.GW2829@hoeg.nl> References: <200909040742.n847gD62058267@svn.freebsd.org> <20090904103214.GW2829@hoeg.nl> Message-ID: <20090904140219.GA3179@nagual.pp.ru> On Fri, Sep 04, 2009 at 12:32:14PM +0200, Ed Schouten wrote: > Even though I really appreciate fixes/cleanups to ee(1), I think changes > like these should be sent to its maintainer as well. Have you done this? Yes. -- http://ache.pp.ru/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090904/5bfd8111/attachment.pgp From ed at 80386.nl Fri Sep 4 14:50:07 2009 From: ed at 80386.nl (Ed Schouten) Date: Fri Sep 4 14:50:18 2009 Subject: svn commit: r196818 - head/contrib/ee In-Reply-To: <20090904140219.GA3179@nagual.pp.ru> References: <200909040742.n847gD62058267@svn.freebsd.org> <20090904103214.GW2829@hoeg.nl> <20090904140219.GA3179@nagual.pp.ru> Message-ID: <20090904145005.GX2829@hoeg.nl> * Andrey Chernov wrote: > On Fri, Sep 04, 2009 at 12:32:14PM +0200, Ed Schouten wrote: > > Even though I really appreciate fixes/cleanups to ee(1), I think changes > > like these should be sent to its maintainer as well. Have you done this? > > Yes. Great! The reason why I was being a little negative, is because I noticed the previous version of ee(1) we had, had a lot of local patches that were very hard to merge. It turned out most of the features were implemented upstream as well, albeit differently. It's nice to see someone step up to hunt down bugs in ee(1). -- Ed Schouten WWW: http://80386.nl/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090904/3abf04d8/attachment.pgp From kib at FreeBSD.org Fri Sep 4 14:53:12 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Fri Sep 4 14:53:18 2009 Subject: svn commit: r196829 - head/sys/i386/i386 Message-ID: <200909041453.n84ErCtU075966@svn.freebsd.org> Author: kib Date: Fri Sep 4 14:53:12 2009 New Revision: 196829 URL: http://svn.freebsd.org/changeset/base/196829 Log: Add missing ';'. Modified: head/sys/i386/i386/machdep.c Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Fri Sep 4 11:32:05 2009 (r196828) +++ head/sys/i386/i386/machdep.c Fri Sep 4 14:53:12 2009 (r196829) @@ -2570,7 +2570,7 @@ init386(first) default_proc_ldt.ldt_base = (caddr_t)ldt; default_proc_ldt.ldt_len = 6; _default_ldt = (int)&default_proc_ldt; - PCPU_SET(currentldt, _default_ldt) + PCPU_SET(currentldt, _default_ldt); PT_SET_MA(ldt, *vtopte((unsigned long)ldt) & ~PG_RW); xen_set_ldt((unsigned long) ldt, (sizeof ldt_segs / sizeof ldt_segs[0])); From bz at FreeBSD.org Fri Sep 4 15:00:08 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Fri Sep 4 15:00:13 2009 Subject: svn commit: r196829 - head/sys/i386/i386 In-Reply-To: <200909041453.n84ErCtU075966@svn.freebsd.org> References: <200909041453.n84ErCtU075966@svn.freebsd.org> Message-ID: <20090904145527.S68375@maildrop.int.zabbadoz.net> On Fri, 4 Sep 2009, Konstantin Belousov wrote: > Author: kib > Date: Fri Sep 4 14:53:12 2009 > New Revision: 196829 > URL: http://svn.freebsd.org/changeset/base/196829 > > Log: > Add missing ';'. This hadn't been noticed for a year as up to r196810 PCPU_SET was a { .. } block. With r196811 it was changed to do { .. } while (0) and thus the missing ';' immediately became a syntax error. > Modified: > head/sys/i386/i386/machdep.c > > Modified: head/sys/i386/i386/machdep.c > ============================================================================== > --- head/sys/i386/i386/machdep.c Fri Sep 4 11:32:05 2009 (r196828) > +++ head/sys/i386/i386/machdep.c Fri Sep 4 14:53:12 2009 (r196829) > @@ -2570,7 +2570,7 @@ init386(first) > default_proc_ldt.ldt_base = (caddr_t)ldt; > default_proc_ldt.ldt_len = 6; > _default_ldt = (int)&default_proc_ldt; > - PCPU_SET(currentldt, _default_ldt) > + PCPU_SET(currentldt, _default_ldt); > PT_SET_MA(ldt, *vtopte((unsigned long)ldt) & ~PG_RW); > xen_set_ldt((unsigned long) ldt, (sizeof ldt_segs / sizeof ldt_segs[0])); > > -- Bjoern A. Zeeb What was I talking about and who are you again? From ache at nagual.pp.ru Fri Sep 4 15:02:35 2009 From: ache at nagual.pp.ru (Andrey Chernov) Date: Fri Sep 4 15:02:46 2009 Subject: svn commit: r196818 - head/contrib/ee In-Reply-To: <20090904145005.GX2829@hoeg.nl> References: <200909040742.n847gD62058267@svn.freebsd.org> <20090904103214.GW2829@hoeg.nl> <20090904140219.GA3179@nagual.pp.ru> <20090904145005.GX2829@hoeg.nl> Message-ID: <20090904150229.GA4007@nagual.pp.ru> On Fri, Sep 04, 2009 at 04:50:05PM +0200, Ed Schouten wrote: > * Andrey Chernov wrote: > > On Fri, Sep 04, 2009 at 12:32:14PM +0200, Ed Schouten wrote: > > > Even though I really appreciate fixes/cleanups to ee(1), I think changes > > > like these should be sent to its maintainer as well. Have you done this? > > > > Yes. > > Great! The reason why I was being a little negative, is because I > noticed the previous version of ee(1) we had, had a lot of local patches > that were very hard to merge. It turned out most of the features were > implemented upstream as well, albeit differently. > > It's nice to see someone step up to hunt down bugs in ee(1). I got no reply from the author yet, lets wait. Ctype stuff there was in pre-POSIX (and even pre-BSD4.3) old times state, but luckily enough it affect only several edge cases in FreeBSD. Most unpleasant bug which was the reason I start to look there was all 8bit chars highlighting due to passing negative chars to waddch(). -- http://ache.pp.ru/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090904/9f928454/attachment.pgp From gnn at hudson-trading.com Fri Sep 4 15:18:48 2009 From: gnn at hudson-trading.com (George Neville-Neil) Date: Fri Sep 4 15:18:54 2009 Subject: svn commit: r196797 - in head: sys/net sys/netinet usr.bin/netstat In-Reply-To: <4AA09B41.3040103@incunabulum.net> References: <200909032110.n83LAvUF044731@svn.freebsd.org> <4AA09B41.3040103@incunabulum.net> Message-ID: <3C6607F2-D517-41EC-8681-33236EC6D20F@FreeBSD.org> On Sep 4, 2009, at 00:44 , Bruce Simpson wrote: > George V. Neville-Neil wrote: >> Author: gnn >> Date: Thu Sep 3 21:10:57 2009 >> New Revision: 196797 >> URL: http://svn.freebsd.org/changeset/base/196797 >> >> Log: >> Add ARP statistics to the kernel and netstat. >> > > Thanks very much for this change. > Any chance this struct can get explicitly versioned (i.e. as for > struct igmpstat) as it is a new struct? > bz@ and I will likely be tweaking this over time, so we can probably do that. Later, George From yongari at FreeBSD.org Fri Sep 4 16:41:18 2009 From: yongari at FreeBSD.org (Pyun YongHyeon) Date: Fri Sep 4 16:41:35 2009 Subject: svn commit: r196830 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/txp dev/xen/xenpci Message-ID: <200909041641.n84GfIME084442@svn.freebsd.org> Author: yongari Date: Fri Sep 4 16:41:17 2009 New Revision: 196830 URL: http://svn.freebsd.org/changeset/base/196830 Log: MFC r196721: Make sure rx descriptor ring align on 16 bytes. I guess the alignment requirement could be multiple of 4 bytes but I think using descriptor size would make intention clearer. Previously the size of rx descriptor was not power of 2 so it caused panic in bus_dmamem_alloc(9). Reported by: Jeff Blank (jb000003 <> mr-happy dot com) Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/txp/if_txp.c stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/txp/if_txp.c ============================================================================== --- stable/8/sys/dev/txp/if_txp.c Fri Sep 4 14:53:12 2009 (r196829) +++ stable/8/sys/dev/txp/if_txp.c Fri Sep 4 16:41:17 2009 (r196830) @@ -1389,7 +1389,8 @@ txp_alloc_rings(struct txp_softc *sc) /* High priority rx ring. */ error = txp_dma_alloc(sc, "hi priority rx ring", - &sc->sc_cdata.txp_rxhiring_tag, sizeof(struct txp_rx_desc), 0, + &sc->sc_cdata.txp_rxhiring_tag, + roundup(sizeof(struct txp_rx_desc), 16), 0, &sc->sc_cdata.txp_rxhiring_map, (void **)&sc->sc_ldata.txp_rxhiring, sizeof(struct txp_rx_desc) * RX_ENTRIES, &sc->sc_ldata.txp_rxhiring_paddr); @@ -1409,7 +1410,8 @@ txp_alloc_rings(struct txp_softc *sc) /* Low priority rx ring. */ error = txp_dma_alloc(sc, "low priority rx ring", - &sc->sc_cdata.txp_rxloring_tag, sizeof(struct txp_rx_desc), 0, + &sc->sc_cdata.txp_rxloring_tag, + roundup(sizeof(struct txp_rx_desc), 16), 0, &sc->sc_cdata.txp_rxloring_map, (void **)&sc->sc_ldata.txp_rxloring, sizeof(struct txp_rx_desc) * RX_ENTRIES, &sc->sc_ldata.txp_rxloring_paddr); From bz at FreeBSD.org Fri Sep 4 17:20:07 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Fri Sep 4 17:20:19 2009 Subject: svn commit: r196797 - in head: sys/net sys/netinet usr.bin/netstat In-Reply-To: <3C6607F2-D517-41EC-8681-33236EC6D20F@FreeBSD.org> References: <200909032110.n83LAvUF044731@svn.freebsd.org> <4AA09B41.3040103@incunabulum.net> <3C6607F2-D517-41EC-8681-33236EC6D20F@FreeBSD.org> Message-ID: <20090904171511.Q68375@maildrop.int.zabbadoz.net> On Fri, 4 Sep 2009, George Neville-Neil wrote: Hi, > On Sep 4, 2009, at 00:44 , Bruce Simpson wrote: > >> George V. Neville-Neil wrote: >>> Author: gnn >>> Date: Thu Sep 3 21:10:57 2009 >>> New Revision: 196797 >>> URL: http://svn.freebsd.org/changeset/base/196797 >>> >>> Log: >>> Add ARP statistics to the kernel and netstat. >>> >> >> Thanks very much for this change. >> Any chance this struct can get explicitly versioned (i.e. as for struct >> igmpstat) as it is a new struct? >> > > bz@ and I will likely be tweaking this over time, so we can probably do that. I am not entirely sure what "versioning" that struct would help? ARP is from the early 80s, we've got 8 variables and 4 spares and I cannot forsee any major rewrite of the code or the protocoll to gather a lot more stats anymore. /bz -- Bjoern A. Zeeb What was I talking about and who are you again? From imp at bsdimp.com Fri Sep 4 17:31:05 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Fri Sep 4 17:31:17 2009 Subject: svn commit: r196779 - in head/sys: kern sys In-Reply-To: <200909031340.n83Defkv034013@svn.freebsd.org> References: <200909031340.n83Defkv034013@svn.freebsd.org> Message-ID: <20090904.112919.1521002024.imp@bsdimp.com> In message: <200909031340.n83Defkv034013@svn.freebsd.org> Attilio Rao writes: : Author: attilio : Date: Thu Sep 3 13:40:41 2009 : New Revision: 196779 : URL: http://svn.freebsd.org/changeset/base/196779 : : Log: : Add intermediate states for attaching and detaching that will be : reused by the enhached newbus locking once it is checked in. : This change can be easilly MFCed to STABLE_8 at the appropriate moment. That appropriate moment better be ASAP. At least for the change I've highlighed below, since it changes the ABI. Btw, this change also breaks devinfo. : Modified: head/sys/sys/bus.h : ============================================================================== : --- head/sys/sys/bus.h Thu Sep 3 12:41:00 2009 (r196778) : +++ head/sys/sys/bus.h Thu Sep 3 13:40:41 2009 (r196779) : @@ -52,8 +52,11 @@ struct u_businfo { : typedef enum device_state { : DS_NOTPRESENT, /**< @brief not probed or probe failed */ : DS_ALIVE, /**< @brief probe succeeded */ : + DS_ATTACHING, /**< @brief attaching is in progress */ : DS_ATTACHED, /**< @brief attach method called */ : - DS_BUSY /**< @brief device is open */ : + DS_BUSY, /**< @brief device is open */ : + DS_DETACHING /**< @brief detaching is in progress */ : + : } device_state_t; device_state_t is exported to userland via devctl. Well, that's not entirely true... It isn't used EXACTLY, but there's this in devinfo.h: /* * State of the device. */ /* XXX not sure if I want a copy here, or expose sys/bus.h */ typedef enum devinfo_state { DIS_NOTPRESENT, /* not probed or probe failed */ DIS_ALIVE, /* probe succeeded */ DIS_ATTACHED, /* attach method called */ DIS_BUSY /* device is open */ } devinfo_state_t; which is why devinfo is broken. Also, DS_BUSY is used in many drivers to PREVENT detaching. So the change is bad from that point of view, since DS_DETACHING is now > DS_BUSY. There's really a partial ordering relationship now where before there was a total ordering (DS_BUSY is > DS_ATTACHED and DS_DETACHING is > DS_ATTACH, but DS_DETACHING isn't > DS_BUSY and DS_BUSY isn't > DS_DETACHING). I think that you've destroyed information here by unconditionally setting it: - if ((error = DEVICE_DETACH(dev)) != 0) + dev->state = DS_DETACHING; + if ((error = DEVICE_DETACH(dev)) != 0) { + KASSERT(dev->state == DS_DETACHING, + ("%s: %p device state must not been changing", __func__, + dev)); + dev->state = DS_ATTACHED; return (error); + } + KASSERT(dev->state == DS_DETACHING, + ("%s: %p device state must not been changing", __func__, dev)); And this looks racy between the check earlier and this setting. Properly locked, this wouldn't destroy information... At the very least cardbus/cardbus.c and pccard/pccard.c need to be looked at since they both have code that looks like: for (tmp = 0; tmp < numdevs; tmp++) { struct cardbus_devinfo *dinfo = device_get_ivars(devlist[tmp]); int status = device_get_state(devlist[tmp]); if (dinfo->pci.cfg.dev != devlist[tmp]) device_printf(cbdev, "devinfo dev mismatch\n"); if (status == DS_ATTACHED || status == DS_BUSY) device_detach(devlist[tmp]); cardbus_release_all_resources(cbdev, dinfo); cardbus_device_destroy(dinfo); device_delete_child(cbdev, devlist[tmp]); pci_freecfg((struct pci_devinfo *)dinfo); } which does ignore errors returned by device_detach for the DS_BUSY case because there's not currently a good way to tell device_detach that it *MUST* detach the device *NOW* without any possibility of veto by the driver. The above code also isn't DS_DETACHING aware, and may be wrong in the face of this new state. Of course, grepping the tree does show one or two places where DS_BUSY is used inappropriately: rp.c: static int rp_pcidetach(device_t dev) { CONTROLLER_t *ctlp; if (device_get_state(dev) == DS_BUSY) return (EBUSY); is one example. The above check should just be removed (ditto for its SHUTDOWN) routine. So I think we should fix rp.c, but we need to talk through this change a little more. I'm surprised I wasn't even pinged about it, since it hits code that I maintain and a simple grep would have found... I'm not yet asking for it to be backed out, but I don't like it on its surface and want to talk about it in more detail. Warner From rwatson at FreeBSD.org Fri Sep 4 17:33:45 2009 From: rwatson at FreeBSD.org (Robert Watson) Date: Fri Sep 4 17:33:50 2009 Subject: svn commit: r196797 - in head: sys/net sys/netinet usr.bin/netstat In-Reply-To: <4AA09B41.3040103@incunabulum.net> References: <200909032110.n83LAvUF044731@svn.freebsd.org> <4AA09B41.3040103@incunabulum.net> Message-ID: On Fri, 4 Sep 2009, Bruce Simpson wrote: > George V. Neville-Neil wrote: >> Author: gnn >> Date: Thu Sep 3 21:10:57 2009 >> New Revision: 196797 >> URL: http://svn.freebsd.org/changeset/base/196797 >> >> Log: >> Add ARP statistics to the kernel and netstat. > > Thanks very much for this change. Any chance this struct can get explicitly > versioned (i.e. as for struct igmpstat) as it is a new struct? For sysctls, explicit versioning doesn't help too much -- what I've been pondering for another structure was including spares and having a capabilities field in the structure where flags are set when fields are known by the kernel. That way userspace can tell if the kernel knows about the field it cares about and therefore whether they're worth looking at. Robert N M Watson Computer Laboratory University of Cambridge From imp at bsdimp.com Fri Sep 4 17:33:56 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Fri Sep 4 17:34:02 2009 Subject: svn commit: r196779 - in head/sys: kern sys In-Reply-To: <3bbf2fe10909030646o2dc30166r303ee646572c741b@mail.gmail.com> References: <200909031340.n83Defkv034013@svn.freebsd.org> <3bbf2fe10909030646o2dc30166r303ee646572c741b@mail.gmail.com> Message-ID: <20090904.113314.1979406201.imp@bsdimp.com> In message: <3bbf2fe10909030646o2dc30166r303ee646572c741b@mail.gmail.com> Attilio Rao writes: : 2009/9/3 Attilio Rao : : > Author: attilio : > Date: Thu Sep 3 13:40:41 2009 : > New Revision: 196779 : > URL: http://svn.freebsd.org/changeset/base/196779 : > : > Log: : > Add intermediate states for attaching and detaching that will be : > reused by the enhached newbus locking once it is checked in. : > This change can be easilly MFCed to STABLE_8 at the appropriate moment. : : About this commit, there are a few of things which worths nothing: : - This has been committed separately from the new-bus locking because : it is planned to be MFCed before 8.0 goes out in order to offer the : correct ABI compatibility for merging, while 8.1-REL, the newbus : locking I understand why the change is made here, but I don't think it is the right one. Or at least I don't think I adequately understand its motivation and need to understand that better since it doesn't make sense to me. : - Probabilly what we really wanted here is just a transitioning state : instead than both DS_ATTACHING and DS_DETACHING. Some consumers would : eventually understand what of the 2 is that and one of these consumers : is device_is_attached(). That function is used improperly by many : detach handlers in a construct like: I don't understand the point you are trying to make here... I'm not sure that piggybacking this information on the state is the right approach. : int : foo_attach(device_t dev) : { : ... : if (error != 0) : foo_detach(dev); : ... : } : : int : foo_detach(device_dev) : { : ... : if (device_is_attached(dev)) { : /* do some handover */ : } : ... : } : : That is an incorrect behaviour which needs to be discouraged and that : will be fixed during 9.0. Why is that bad? There are a lot of drivers that do that. I don't understand the point you are making here... The alternatives are likely worse. Please let me know what the plan here is. : In the while this semantic (used by many drivers) makes the : single-transition state impraticable and so we will need to stick with : that device states also in 9.0. A lot of drivers use that idiom today. Are you signing up to make sure they all work in the future? Again: I wasn't consulted on this change, don't like it, and want to talk more about it. It broke devinfo, and ignored code in cardbus and pccard that likely needs to change to cope. Warner From imp at bsdimp.com Fri Sep 4 17:41:43 2009 From: imp at bsdimp.com (M. Warner Losh) Date: Fri Sep 4 17:41:49 2009 Subject: svn commit: r196752 - head/lib/libc/stdtime In-Reply-To: <20090904075338.GA90644@nagual.pp.ru> References: <20090904115255.Q48987@delplex.bde.org> <20090904144214.O49099@delplex.bde.org> <20090904075338.GA90644@nagual.pp.ru> Message-ID: <20090904.114040.-93208535.imp@bsdimp.com> In message: <20090904075338.GA90644@nagual.pp.ru> Andrey Chernov writes: : On Fri, Sep 04, 2009 at 03:21:09PM +1000, Bruce Evans wrote: : > % The value of the argument must be representable as an : > % .Vt "unsigned char" : > % or the value of : > % .Dv EOF . : > : > This is the same as in POSIX except the POSIX wording is better (e.g., : > the above only says implicitly that the behaviour is undefined if : > "must" is not satisfied). It took too many commits (revs 1.8-1.10) to : > get this far. : : BTW, do we have permissions for direct POSIX quotes? Yes. However, if we take more than a couple of words, we need to include the POSIX copyright headers. There was email from core on this about 6 years ago, iirc. Warner From julian at elischer.org Fri Sep 4 17:46:01 2009 From: julian at elischer.org (Julian Elischer) Date: Fri Sep 4 17:46:13 2009 Subject: svn commit: r196829 - head/sys/i386/i386 In-Reply-To: <20090904145527.S68375@maildrop.int.zabbadoz.net> References: <200909041453.n84ErCtU075966@svn.freebsd.org> <20090904145527.S68375@maildrop.int.zabbadoz.net> Message-ID: <4AA15257.4050305@elischer.org> Bjoern A. Zeeb wrote: > On Fri, 4 Sep 2009, Konstantin Belousov wrote: > >> Author: kib >> Date: Fri Sep 4 14:53:12 2009 >> New Revision: 196829 >> URL: http://svn.freebsd.org/changeset/base/196829 >> >> Log: >> Add missing ';'. > > This hadn't been noticed for a year as up to r196810 PCPU_SET was a > { > .. > } > block. With r196811 it was changed to > do { > .. > } while (0) > and thus the missing ';' immediately became a syntax error. so, why does my tree compile? > > >> Modified: >> head/sys/i386/i386/machdep.c >> >> Modified: head/sys/i386/i386/machdep.c >> ============================================================================== >> >> --- head/sys/i386/i386/machdep.c Fri Sep 4 11:32:05 2009 (r196828) >> +++ head/sys/i386/i386/machdep.c Fri Sep 4 14:53:12 2009 (r196829) >> @@ -2570,7 +2570,7 @@ init386(first) >> default_proc_ldt.ldt_base = (caddr_t)ldt; >> default_proc_ldt.ldt_len = 6; >> _default_ldt = (int)&default_proc_ldt; >> - PCPU_SET(currentldt, _default_ldt) >> + PCPU_SET(currentldt, _default_ldt); >> PT_SET_MA(ldt, *vtopte((unsigned long)ldt) & ~PG_RW); >> xen_set_ldt((unsigned long) ldt, (sizeof ldt_segs / sizeof >> ldt_segs[0])); >> >> > From jhb at freebsd.org Fri Sep 4 17:51:24 2009 From: jhb at freebsd.org (John Baldwin) Date: Fri Sep 4 17:51:31 2009 Subject: svn commit: r196779 - in head/sys: kern sys In-Reply-To: <20090904.113314.1979406201.imp@bsdimp.com> References: <200909031340.n83Defkv034013@svn.freebsd.org> <3bbf2fe10909030646o2dc30166r303ee646572c741b@mail.gmail.com> <20090904.113314.1979406201.imp@bsdimp.com> Message-ID: <200909041349.53872.jhb@freebsd.org> On Friday 04 September 2009 1:33:14 pm M. Warner Losh wrote: > In message: <3bbf2fe10909030646o2dc30166r303ee646572c741b@mail.gmail.com> > Attilio Rao writes: > : 2009/9/3 Attilio Rao : > : > Author: attilio > : > Date: Thu Sep 3 13:40:41 2009 > : > New Revision: 196779 > : > URL: http://svn.freebsd.org/changeset/base/196779 > : > > : > Log: > : > Add intermediate states for attaching and detaching that will be > : > reused by the enhached newbus locking once it is checked in. > : > This change can be easilly MFCed to STABLE_8 at the appropriate moment. > : > : About this commit, there are a few of things which worths nothing: > : - This has been committed separately from the new-bus locking because > : it is planned to be MFCed before 8.0 goes out in order to offer the > : correct ABI compatibility for merging, while 8.1-REL, the newbus > : locking > > I understand why the change is made here, but I don't think it is the > right one. Or at least I don't think I adequately understand its > motivation and need to understand that better since it doesn't make > sense to me. > > : - Probabilly what we really wanted here is just a transitioning state > : instead than both DS_ATTACHING and DS_DETACHING. Some consumers would > : eventually understand what of the 2 is that and one of these consumers > : is device_is_attached(). That function is used improperly by many > : detach handlers in a construct like: > > I don't understand the point you are trying to make here... I'm not > sure that piggybacking this information on the state is the right > approach. We need a single state (though not really 2 IMO) so we can run device attach and detach routines w/o holding the new-bus lock (which it turns out we need to do as attach and detach routines can do too many things that aren't safe to do while holding the new-bus lock). > : int > : foo_attach(device_t dev) > : { > : ... > : if (error != 0) > : foo_detach(dev); > : ... > : } > : > : int > : foo_detach(device_dev) > : { > : ... > : if (device_is_attached(dev)) { > : /* do some handover */ > : } > : ... > : } > : > : That is an incorrect behaviour which needs to be discouraged and that > : will be fixed during 9.0. > > Why is that bad? There are a lot of drivers that do that. I don't > understand the point you are making here... I think it is sloppy/lazy at best. A detach routine should really only be used for detaching. > The alternatives are likely worse. Please let me know what the plan > here is. I think a very sane alternative is to split these detach routines up. All the bits that aren't conditional on 'device_is_attached()' would move into a 'foo_release_resources()' that foo_attach() calls on error. foo_detach() would then do all the work that is currently conditional on 'device_is_attached()' unconditionally and then invoke foo_release_resources(). A larger demo: int foo_attach() { sc->ifp = if_alloc(); ... ether_ifattach(sc->ifp); return (0); error: foo_detach(); } int foo_detach() { if (device_is_attached()) { ether_ifdetach(sc->ifp); } ... if_free(sc->ifp); } would now become this: int foo_attach() { sc->ifp = if_alloc(); ... ether_ifattach(sc->ifp); return (0); error: foo_release_resources(); } int foo_detach() { ether_ifdetach(sc->ifp); foo_release_resources(); } int foo_release_resources() { ... if_free(sc->ifp); } -- John Baldwin From mav at FreeBSD.org Fri Sep 4 18:21:41 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Fri Sep 4 18:21:53 2009 Subject: svn commit: r196831 - head/sbin/camcontrol Message-ID: <200909041821.n84ILfWo092251@svn.freebsd.org> Author: mav Date: Fri Sep 4 18:21:40 2009 New Revision: 196831 URL: http://svn.freebsd.org/changeset/base/196831 Log: Add to `camcontrol cmd` support for sending arbitrary ATA commands. It could be used for broad range of tasks, such as configuring drive power management modes, caching, security and any other features and tasks, not supported by existing drivers. Modified: head/sbin/camcontrol/camcontrol.8 head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.8 ============================================================================== --- head/sbin/camcontrol/camcontrol.8 Fri Sep 4 16:41:17 2009 (r196830) +++ head/sbin/camcontrol/camcontrol.8 Fri Sep 4 18:21:40 2009 (r196831) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 29, 2009 +.Dd September 4, 2009 .Dt CAMCONTROL 8 .Os .Sh NAME @@ -120,10 +120,12 @@ .Ic cmd .Op device id .Op generic args +.Aq Fl a Ar cmd Op args .Aq Fl c Ar cmd Op args .Op Fl i Ar len Ar fmt .Bk -words .Op Fl o Ar len Ar fmt Op args +.Op Fl r Ar fmt .Ek .Nm .Ic debug @@ -486,12 +488,14 @@ Saved values .El .El .It Ic cmd -Allows the user to send an arbitrary SCSI CDB to any device. +Allows the user to send an arbitrary ATA or SCSI CDB to any device. The .Ic cmd function requires the .Fl c -argument to specify the CDB. +argument to specify SCSI CDB or the +.Fl a +argument to specify ATA Command Block registers values. Other arguments are optional, depending on the command type. The command and data specification syntax is documented @@ -503,9 +507,13 @@ SCSI device in question, you MUST specif or .Fl o . .Bl -tag -width 17n +.It Fl a Ar cmd Op args +This specifies the content of 12 ATA Command Block registers (command, +features, lba_low, lba_mid, lba_high, device, lba_low_exp, lba_mid_exp. +lba_high_exp, features_exp, sector_count, sector_count_exp). .It Fl c Ar cmd Op args This specifies the SCSI CDB. -CDBs may be 6, 10, 12 or 16 bytes. +SCSI CDBs may be 6, 10, 12 or 16 bytes. .It Fl i Ar len Ar fmt This specifies the amount of data to read, and how it should be displayed. If the format is @@ -519,6 +527,13 @@ If the format is .Sq - , .Ar len bytes of data will be read from standard input and written to the device. +.It Fl r Ar fmt +This specifies that 11 result ATA Command Block registers should be displayed +(status, error, lba_low, lba_mid, lba_high, device, lba_low_exp, lba_mid_exp, +lba_high_exp, sector_count, sector_count_exp), and how. +If the format is +.Sq - , +11 result registers will be written to standard output in hex. .El .It Ic debug Turn on CAM debugging printfs in the kernel. Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Fri Sep 4 16:41:17 2009 (r196830) +++ head/sbin/camcontrol/camcontrol.c Fri Sep 4 18:21:40 2009 (r196831) @@ -120,7 +120,7 @@ struct camcontrol_opts { }; #ifndef MINIMALISTIC -static const char scsicmd_opts[] = "c:i:o:"; +static const char scsicmd_opts[] = "a:c:i:o:r"; static const char readdefect_opts[] = "f:GP"; static const char negotiate_opts[] = "acD:O:qR:T:UW:"; #endif @@ -2078,12 +2078,15 @@ scsicmd(struct cam_device *device, int a u_int32_t flags = CAM_DIR_NONE; u_int8_t *data_ptr = NULL; u_int8_t cdb[20]; + u_int8_t atacmd[12]; struct get_hook hook; int c, data_bytes = 0; int cdb_len = 0; - char *datastr = NULL, *tstr; + int atacmd_len = 0; + int need_res = 0; + char *datastr = NULL, *tstr, *resstr = NULL; int error = 0; - int fd_data = 0; + int fd_data = 0, fd_res = 0; int retval; ccb = cam_getccb(device); @@ -2094,10 +2097,32 @@ scsicmd(struct cam_device *device, int a } bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); + sizeof(union ccb) - sizeof(struct ccb_hdr)); while ((c = getopt(argc, argv, combinedopt)) != -1) { switch(c) { + case 'a': + tstr = optarg; + while (isspace(*tstr) && (*tstr != '\0')) + tstr++; + hook.argc = argc - optind; + hook.argv = argv + optind; + hook.got = 0; + atacmd_len = buff_encode_visit(atacmd, sizeof(atacmd), tstr, + iget, &hook); + /* + * Increment optind by the number of arguments the + * encoding routine processed. After each call to + * getopt(3), optind points to the argument that + * getopt should process _next_. In this case, + * that means it points to the first command string + * argument, if there is one. Once we increment + * this, it should point to either the next command + * line argument, or it should be past the end of + * the list. + */ + optind += hook.got; + break; case 'c': tstr = optarg; while (isspace(*tstr) && (*tstr != '\0')) @@ -2194,6 +2219,16 @@ scsicmd(struct cam_device *device, int a iget, &hook); optind += hook.got; break; + case 'r': + need_res = 1; + hook.argc = argc - optind; + hook.argv = argv + optind; + hook.got = 0; + resstr = cget(&hook, NULL); + if ((resstr != NULL) && (resstr[0] == '-')) + fd_res = 1; + optind += hook.got; + break; default: break; } @@ -2226,50 +2261,51 @@ scsicmd(struct cam_device *device, int a /* Disable freezing the device queue */ flags |= CAM_DEV_QFRZDIS; - /* - * This is taken from the SCSI-3 draft spec. - * (T10/1157D revision 0.3) - * The top 3 bits of an opcode are the group code. The next 5 bits - * are the command code. - * Group 0: six byte commands - * Group 1: ten byte commands - * Group 2: ten byte commands - * Group 3: reserved - * Group 4: sixteen byte commands - * Group 5: twelve byte commands - * Group 6: vendor specific - * Group 7: vendor specific - */ - switch((cdb[0] >> 5) & 0x7) { - case 0: - cdb_len = 6; - break; - case 1: - case 2: - cdb_len = 10; - break; - case 3: - case 6: - case 7: - /* computed by buff_encode_visit */ - break; - case 4: - cdb_len = 16; - break; - case 5: - cdb_len = 12; - break; - } + if (cdb_len) { + /* + * This is taken from the SCSI-3 draft spec. + * (T10/1157D revision 0.3) + * The top 3 bits of an opcode are the group code. + * The next 5 bits are the command code. + * Group 0: six byte commands + * Group 1: ten byte commands + * Group 2: ten byte commands + * Group 3: reserved + * Group 4: sixteen byte commands + * Group 5: twelve byte commands + * Group 6: vendor specific + * Group 7: vendor specific + */ + switch((cdb[0] >> 5) & 0x7) { + case 0: + cdb_len = 6; + break; + case 1: + case 2: + cdb_len = 10; + break; + case 3: + case 6: + case 7: + /* computed by buff_encode_visit */ + break; + case 4: + cdb_len = 16; + break; + case 5: + cdb_len = 12; + break; + } - /* - * We should probably use csio_build_visit or something like that - * here, but it's easier to encode arguments as you go. The - * alternative would be skipping the CDB argument and then encoding - * it here, since we've got the data buffer argument by now. - */ - bcopy(cdb, &ccb->csio.cdb_io.cdb_bytes, cdb_len); + /* + * We should probably use csio_build_visit or something like that + * here, but it's easier to encode arguments as you go. The + * alternative would be skipping the CDB argument and then encoding + * it here, since we've got the data buffer argument by now. + */ + bcopy(cdb, &ccb->csio.cdb_io.cdb_bytes, cdb_len); - cam_fill_csio(&ccb->csio, + cam_fill_csio(&ccb->csio, /*retries*/ retry_count, /*cbfcnp*/ NULL, /*flags*/ flags, @@ -2279,6 +2315,21 @@ scsicmd(struct cam_device *device, int a /*sense_len*/ SSD_FULL_SIZE, /*cdb_len*/ cdb_len, /*timeout*/ timeout ? timeout : 5000); + } else { + atacmd_len = 12; + bcopy(atacmd, &ccb->ataio.cmd.command, atacmd_len); + if (need_res) + ccb->ataio.cmd.flags |= CAM_ATAIO_NEEDRESULT; + + cam_fill_ataio(&ccb->ataio, + /*retries*/ retry_count, + /*cbfcnp*/ NULL, + /*flags*/ flags, + /*tag_action*/ 0, + /*data_ptr*/ data_ptr, + /*dxfer_len*/ data_bytes, + /*timeout*/ timeout ? timeout : 5000); + } if (((retval = cam_send_ccb(device, ccb)) < 0) || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) { @@ -2296,6 +2347,28 @@ scsicmd(struct cam_device *device, int a goto scsicmd_bailout; } + if (atacmd_len && need_res) { + if (fd_res == 0) { + buff_decode_visit(&ccb->ataio.res.status, 11, resstr, + arg_put, NULL); + fprintf(stdout, "\n"); + } else { + fprintf(stdout, + "%02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", + ccb->ataio.res.status, + ccb->ataio.res.error, + ccb->ataio.res.lba_low, + ccb->ataio.res.lba_mid, + ccb->ataio.res.lba_high, + ccb->ataio.res.device, + ccb->ataio.res.lba_low_exp, + ccb->ataio.res.lba_mid_exp, + ccb->ataio.res.lba_high_exp, + ccb->ataio.res.sector_count, + ccb->ataio.res.sector_count_exp); + fflush(stdout); + } + } if (((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) && (arglist & CAM_ARG_CMD_IN) @@ -4029,8 +4102,9 @@ usage(int verbose) " camcontrol defects [dev_id][generic args] <-f format> [-P][-G]\n" " camcontrol modepage [dev_id][generic args] <-m page | -l>\n" " [-P pagectl][-e | -b][-d]\n" -" camcontrol cmd [dev_id][generic args] <-c cmd [args]>\n" -" [-i len fmt|-o len fmt [args]]\n" +" camcontrol cmd [dev_id][generic args]\n" +" <-a cmd [args] | -c cmd [args]>\n" +" [-i len fmt|-o len fmt [args]] [-r fmt]\n" " camcontrol debug [-I][-P][-T][-S][-X][-c]\n" " \n" " camcontrol tags [dev_id][generic args] [-N tags] [-q] [-v]\n" From kmacy at FreeBSD.org Fri Sep 4 18:52:27 2009 From: kmacy at FreeBSD.org (Kip Macy) Date: Fri Sep 4 18:52:33 2009 Subject: svn commit: r196833 - head/sbin/route Message-ID: <200909041852.n84IqRtF098222@svn.freebsd.org> Author: kmacy Date: Fri Sep 4 18:52:26 2009 New Revision: 196833 URL: http://svn.freebsd.org/changeset/base/196833 Log: remove stale references to RTF_CLONING and RTF_LLINFO MFC after: 3 days Modified: head/sbin/route/route.8 Modified: head/sbin/route/route.8 ============================================================================== --- head/sbin/route/route.8 Fri Sep 4 18:40:03 2009 (r196832) +++ head/sbin/route/route.8 Fri Sep 4 18:52:26 2009 (r196833) @@ -279,7 +279,6 @@ when sending to destinations matched by These flags may be set (or sometimes cleared) by indicating the following corresponding modifiers: .Bd -literal --cloning RTF_CLONING - generates a new route on use -xresolve RTF_XRESOLVE - emit mesg on use (for external lookup) -iface ~RTF_GATEWAY - destination is directly reachable -static RTF_STATIC - manually added route @@ -288,7 +287,6 @@ by indicating the following correspondin -blackhole RTF_BLACKHOLE - silently discard pkts (during updates) -proto1 RTF_PROTO1 - set protocol specific routing flag #1 -proto2 RTF_PROTO2 - set protocol specific routing flag #2 --llinfo RTF_LLINFO - validly translates proto addr to link addr .Ed .Pp The optional modifiers @@ -326,25 +324,6 @@ or .Fl ifa modifiers may be used to determine the interface or interface address. .Pp -The optional -.Fl proxy -modifier specifies that the -.Dv RTF_LLINFO -routing table entry is the -.Dq published (proxy-only) -.Tn ARP -entry, as reported by -.Xr arp 8 . -.Pp -The optional -.Fl genmask -modifier specifies that a cloning mask is present. -This specifies the mask applied when determining if a child route -should be created. -It is only applicable to network routes with the -.Dv RTF_CLONING -flag set. -.Pp All symbolic names specified for a .Ar destination or From jamie at FreeBSD.org Fri Sep 4 19:00:49 2009 From: jamie at FreeBSD.org (Jamie Gritton) Date: Fri Sep 4 19:00:55 2009 Subject: svn commit: r196835 - head/sys/kern Message-ID: <200909041900.n84J0mx8099967@svn.freebsd.org> Author: jamie Date: Fri Sep 4 19:00:48 2009 New Revision: 196835 URL: http://svn.freebsd.org/changeset/base/196835 Log: Allow a jail's name to be the same as its jid (which is the default if no name is specified), but still disallow other numeric names. Reviewed by: zec Approved by: bz (mentor) MFC after: 3 days Modified: head/sys/kern/kern_jail.c Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Fri Sep 4 18:57:40 2009 (r196834) +++ head/sys/kern/kern_jail.c Fri Sep 4 19:00:48 2009 (r196835) @@ -478,7 +478,7 @@ kern_jail_set(struct thread *td, struct struct vfsoptlist *opts; struct prison *pr, *deadpr, *mypr, *ppr, *tpr; struct vnode *root; - char *domain, *errmsg, *host, *name, *p, *path, *uuid; + char *domain, *errmsg, *host, *name, *namelc, *p, *path, *uuid; #if defined(INET) || defined(INET6) struct prison *tppr; void *op; @@ -907,6 +907,13 @@ kern_jail_set(struct thread *td, struct goto done_unlock_list; } pr = NULL; + namelc = NULL; + if (cuflags == JAIL_CREATE && jid == 0 && name != NULL) { + namelc = strrchr(name, '.'); + jid = strtoul(namelc != NULL ? namelc + 1 : name, &p, 10); + if (*p != '\0') + jid = 0; + } if (jid != 0) { /* * See if a requested jid already exists. There is an @@ -973,17 +980,19 @@ kern_jail_set(struct thread *td, struct * because that is the jail being updated). */ if (name != NULL) { - p = strrchr(name, '.'); - if (p != NULL) { + namelc = strrchr(name, '.'); + if (namelc == NULL) + namelc = name; + else { /* * This is a hierarchical name. Split it into the * parent and child names, and make sure the parent * exists or matches an already found jail. */ - *p = '\0'; + *namelc = '\0'; if (pr != NULL) { - if (strncmp(name, ppr->pr_name, p - name) || - ppr->pr_name[p - name] != '\0') { + if (strncmp(name, ppr->pr_name, namelc - name) + || ppr->pr_name[namelc - name] != '\0') { mtx_unlock(&pr->pr_mtx); error = EINVAL; vfs_opterror(opts, @@ -1000,7 +1009,7 @@ kern_jail_set(struct thread *td, struct } mtx_unlock(&ppr->pr_mtx); } - name = p + 1; + name = ++namelc; } if (name[0] != '\0') { namelen = @@ -1412,9 +1421,11 @@ kern_jail_set(struct thread *td, struct /* Give a default name of the jid. */ if (name[0] == '\0') snprintf(name = numbuf, sizeof(numbuf), "%d", jid); - else if (strtoul(name, &p, 10) != jid && *p == '\0') { + else if (*namelc == '0' || (strtoul(namelc, &p, 10) != jid && + *p == '\0')) { error = EINVAL; - vfs_opterror(opts, "name cannot be numeric"); + vfs_opterror(opts, + "name cannot be numeric (unless it is the jid)"); goto done_deref_locked; } /* From mav at FreeBSD.org Fri Sep 4 19:20:47 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Fri Sep 4 19:20:58 2009 Subject: svn commit: r196837 - head/sys/geom/stripe Message-ID: <200909041920.n84JKlab004085@svn.freebsd.org> Author: mav Date: Fri Sep 4 19:20:46 2009 New Revision: 196837 URL: http://svn.freebsd.org/changeset/base/196837 Log: Remove artificial MAX_IO_SIZE constant, equal to DFLTPHYS * 2. Use MAXPHYS instead. It is NULL change for GENERIC kernel, but allows 'fast' mode to work on systems with increased MAXPHYS. Modified: head/sys/geom/stripe/g_stripe.c Modified: head/sys/geom/stripe/g_stripe.c ============================================================================== --- head/sys/geom/stripe/g_stripe.c Fri Sep 4 19:02:11 2009 (r196836) +++ head/sys/geom/stripe/g_stripe.c Fri Sep 4 19:20:46 2009 (r196837) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include -#define MAX_IO_SIZE (DFLTPHYS * 2) static MALLOC_DEFINE(M_STRIPE, "stripe_data", "GEOM_STRIPE Data"); static uma_zone_t g_stripe_zone; @@ -87,7 +86,7 @@ g_sysctl_stripe_fast(SYSCTL_HANDLER_ARGS } SYSCTL_PROC(_kern_geom_stripe, OID_AUTO, fast, CTLTYPE_INT | CTLFLAG_RW, NULL, 0, g_sysctl_stripe_fast, "I", "Fast, but memory-consuming, mode"); -static u_int g_stripe_maxmem = MAX_IO_SIZE * 100; +static u_int g_stripe_maxmem = MAXPHYS * 100; TUNABLE_INT("kern.geom.stripe.maxmem", &g_stripe_maxmem); SYSCTL_UINT(_kern_geom_stripe, OID_AUTO, maxmem, CTLFLAG_RD, &g_stripe_maxmem, 0, "Maximum memory that can be allocated in \"fast\" mode (in bytes)"); @@ -125,10 +124,10 @@ static void g_stripe_init(struct g_class *mp __unused) { - g_stripe_zone = uma_zcreate("g_stripe_zone", MAX_IO_SIZE, NULL, NULL, + g_stripe_zone = uma_zcreate("g_stripe_zone", MAXPHYS, NULL, NULL, NULL, NULL, 0, 0); - g_stripe_maxmem -= g_stripe_maxmem % MAX_IO_SIZE; - uma_zone_set_max(g_stripe_zone, g_stripe_maxmem / MAX_IO_SIZE); + g_stripe_maxmem -= g_stripe_maxmem % MAXPHYS; + uma_zone_set_max(g_stripe_zone, g_stripe_maxmem / MAXPHYS); } static void @@ -613,14 +612,14 @@ g_stripe_start(struct bio *bp) * Do use "fast" mode when: * 1. "Fast" mode is ON. * and - * 2. Request size is less than or equal to MAX_IO_SIZE (128kB), + * 2. Request size is less than or equal to MAXPHYS, * which should always be true. * and * 3. Request size is bigger than stripesize * ndisks. If it isn't, * there will be no need to send more than one I/O request to * a provider, so there is nothing to optmize. */ - if (g_stripe_fast && bp->bio_length <= MAX_IO_SIZE && + if (g_stripe_fast && bp->bio_length <= MAXPHYS && bp->bio_length >= stripesize * sc->sc_ndisks) { fast = 1; } From mav at FreeBSD.org Fri Sep 4 19:41:39 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Fri Sep 4 19:41:51 2009 Subject: svn commit: r196831 - head/sbin/camcontrol In-Reply-To: <86iqfytsqe.fsf@srvbsdnanssv.interne.kisoft-services.com> References: <200909041821.n84ILfWo092251@svn.freebsd.org> <86iqfytsqe.fsf@srvbsdnanssv.interne.kisoft-services.com> Message-ID: <4AA16D68.3080908@FreeBSD.org> Eric Masson wrote: > Alexander Motin writes: >> Author: mav >> Date: Fri Sep 4 18:21:40 2009 >> New Revision: 196831 >> URL: http://svn.freebsd.org/changeset/base/196831 >> >> Log: >> Add to `camcontrol cmd` support for sending arbitrary ATA commands. >> >> It could be used for broad range of tasks, such as configuring drive >> power management modes, caching, security and any other features and tasks, >> not supported by existing drivers. > > Like controlling speed of DVD drives like this linux code snippet > (speedcontrol.c) seems to be able to : > http://ubuntuforums.org/archive/index.php/t-592513.html It looks like using SCSI/ATAPI command, not an ATA. So it is supported for long time. But the idea is right, it should be possible to control it from command line. -- Alexander Motin From jhb at FreeBSD.org Fri Sep 4 19:59:33 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Fri Sep 4 19:59:53 2009 Subject: svn commit: r196838 - in stable/7/sys: . amd64/amd64 amd64/include arm/include contrib/pf dev/iir i386/i386 i386/include ia64/include kern powerpc/include sparc64/include sun4v/include sun4v/sun4v vm Message-ID: <200909041959.n84JxWGA009848@svn.freebsd.org> Author: jhb Date: Fri Sep 4 19:59:32 2009 New Revision: 196838 URL: http://svn.freebsd.org/changeset/base/196838 Log: MFC 193396, 193521, 194331, 194337, 194376, 194454, 194562, 194642, 195033, 195385, 195649, 195660, 195749, and 195774: Add support to the virtual memory system for configuring machine- dependent memory attributes: - Refactor contigmalloc() into two functions: a simple front-end that deals with the malloc tag and calls a new back-end, kmem_alloc_contig(), that allocates the pages and maps them. - Use kmem_alloc_contig() to implement the UMA back-end allocator for jumbo frame zones. - Use kmem_alloc_contig() to allocate the top-level page tables for PAE. - Introduce vm_memattr_t to as a type to hold memory attributes. - Introduce vm_object_set_memattr() for setting the default memory attributes that will be given to an object's pages. - Introduce and use pmap_page_{get,set}_memattr() for getting and setting a page's machine-dependent memory attributes. Add full support for these functions on amd64 and i386 and stubs for them on the other architectures. The function pmap_page_set_memattr() is also responsible for any other machine-dependent aspects of changing a page's memory attributes, such as flushing the cache or updating the direct map. The uses include kmem_alloc_contig(), vm_page_alloc(), and the device pager: kmem_alloc_contig() can now be used to allocate kernel memory with non-default memory attributes on amd64 and i386. vm_page_alloc() and the device pager will set the memory attributes for the real or fictitious page according to the object's default memory attributes. - Update the various pmap functions on amd64 and i386 that map pages to incorporate each page's memory attributes in the mapping. Reviewed by: alc Added: stable/7/sys/amd64/include/vm.h - copied, changed from r195033, head/sys/amd64/include/vm.h stable/7/sys/arm/include/vm.h - copied, changed from r195033, head/sys/arm/include/vm.h stable/7/sys/i386/include/vm.h - copied, changed from r195033, head/sys/i386/include/vm.h stable/7/sys/ia64/include/vm.h - copied, changed from r195033, head/sys/ia64/include/vm.h stable/7/sys/powerpc/include/vm.h - copied, changed from r195033, head/sys/powerpc/include/vm.h stable/7/sys/sparc64/include/vm.h - copied, changed from r195033, head/sys/sparc64/include/vm.h stable/7/sys/sun4v/include/vm.h - copied, changed from r195033, head/sys/sun4v/include/vm.h Modified: stable/7/sys/ (props changed) stable/7/sys/amd64/amd64/pmap.c stable/7/sys/amd64/include/pmap.h stable/7/sys/arm/include/pmap.h stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/iir/iir.c stable/7/sys/dev/iir/iir_ctrl.c stable/7/sys/i386/i386/pmap.c stable/7/sys/i386/include/pmap.h stable/7/sys/ia64/include/pmap.h stable/7/sys/kern/kern_mbuf.c stable/7/sys/powerpc/include/pmap.h stable/7/sys/sparc64/include/pmap.h stable/7/sys/sun4v/include/pmap.h stable/7/sys/sun4v/sun4v/pmap.c stable/7/sys/vm/device_pager.c stable/7/sys/vm/pmap.h stable/7/sys/vm/vm.h stable/7/sys/vm/vm_contig.c stable/7/sys/vm/vm_extern.h stable/7/sys/vm/vm_object.c stable/7/sys/vm/vm_object.h stable/7/sys/vm/vm_page.c stable/7/sys/vm/vm_phys.c Modified: stable/7/sys/amd64/amd64/pmap.c ============================================================================== --- stable/7/sys/amd64/amd64/pmap.c Fri Sep 4 19:20:46 2009 (r196837) +++ stable/7/sys/amd64/amd64/pmap.c Fri Sep 4 19:59:32 2009 (r196838) @@ -618,6 +618,7 @@ pmap_page_init(vm_page_t m) { TAILQ_INIT(&m->md.pv_list); + m->md.pat_mode = PAT_WRITE_BACK; } /* @@ -748,21 +749,6 @@ pmap_cache_bits(int mode, boolean_t is_p /* The PAT bit is different for PTE's and PDE's. */ pat_flag = is_pde ? PG_PDE_PAT : PG_PTE_PAT; - /* If we don't support PAT, map extended modes to older ones. */ - if (!(cpu_feature & CPUID_PAT)) { - switch (mode) { - case PAT_UNCACHEABLE: - case PAT_WRITE_THROUGH: - case PAT_WRITE_BACK: - break; - case PAT_UNCACHED: - case PAT_WRITE_COMBINING: - case PAT_WRITE_PROTECTED: - mode = PAT_UNCACHEABLE; - break; - } - } - /* Map the caching mode to a PAT index. */ switch (mode) { #ifdef PAT_WORKS @@ -1134,7 +1120,8 @@ pmap_qenter(vm_offset_t sva, vm_page_t * endpte = pte + count; while (pte < endpte) { oldpte |= *pte; - pte_store(pte, VM_PAGE_TO_PHYS(*ma) | PG_G | PG_RW | PG_V); + pte_store(pte, VM_PAGE_TO_PHYS(*ma) | PG_G | + pmap_cache_bits((*ma)->md.pat_mode, 0) | PG_RW | PG_V); pte++; ma++; } @@ -3046,7 +3033,7 @@ validate: /* * Now validate mapping with desired protection/wiring. */ - newpte = (pt_entry_t)(pa | PG_V); + newpte = (pt_entry_t)(pa | pmap_cache_bits(m->md.pat_mode, 0) | PG_V); if ((prot & VM_PROT_WRITE) != 0) { newpte |= PG_RW; vm_page_flag_set(m, PG_WRITEABLE); @@ -3131,7 +3118,8 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t " in pmap %p", va, pmap); return (FALSE); } - newpde = VM_PAGE_TO_PHYS(m) | PG_PS | PG_V; + newpde = VM_PAGE_TO_PHYS(m) | pmap_cache_bits(m->md.pat_mode, 1) | + PG_PS | PG_V; if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) { newpde |= PG_MANAGED; @@ -3318,7 +3306,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ */ pmap->pm_stats.resident_count++; - pa = VM_PAGE_TO_PHYS(m); + pa = VM_PAGE_TO_PHYS(m) | pmap_cache_bits(m->md.pat_mode, 0); if ((prot & VM_PROT_EXECUTE) == 0) pa |= pg_nx; @@ -3359,6 +3347,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offs pd_entry_t *pde; vm_paddr_t pa, ptepa; vm_page_t p, pdpg; + int pat_mode; VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); KASSERT(object->type == OBJT_DEVICE, @@ -3369,6 +3358,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offs p = vm_page_lookup(object, pindex); KASSERT(p->valid == VM_PAGE_BITS_ALL, ("pmap_object_init_pt: invalid page %p", p)); + pat_mode = p->md.pat_mode; /* * Abort the mapping if the first page is not physically @@ -3380,21 +3370,28 @@ pmap_object_init_pt(pmap_t pmap, vm_offs /* * Skip the first page. Abort the mapping if the rest of - * the pages are not physically contiguous. + * the pages are not physically contiguous or have differing + * memory attributes. */ p = TAILQ_NEXT(p, listq); for (pa = ptepa + PAGE_SIZE; pa < ptepa + size; pa += PAGE_SIZE) { KASSERT(p->valid == VM_PAGE_BITS_ALL, ("pmap_object_init_pt: invalid page %p", p)); - if (pa != VM_PAGE_TO_PHYS(p)) + if (pa != VM_PAGE_TO_PHYS(p) || + pat_mode != p->md.pat_mode) return; p = TAILQ_NEXT(p, listq); } - /* Map using 2MB pages. */ + /* + * Map using 2MB pages. Since "ptepa" is 2M aligned and + * "size" is a multiple of 2M, adding the PAT setting to "pa" + * will not affect the termination of this loop. + */ PMAP_LOCK(pmap); - for (pa = ptepa; pa < ptepa + size; pa += NBPDR) { + for (pa = ptepa | pmap_cache_bits(pat_mode, 1); pa < ptepa + + size; pa += NBPDR) { pdpg = pmap_allocpde(pmap, addr, M_NOWAIT); if (pdpg == NULL) { /* @@ -4305,6 +4302,26 @@ pmap_unmapdev(vm_offset_t va, vm_size_t } /* + * Sets the memory attribute for the specified page. + */ +void +pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma) +{ + + m->md.pat_mode = ma; + + /* + * If "m" is a normal page, update its direct mapping. This update + * can be relied upon to perform any cache operations that are + * required for data coherence. + */ + if ((m->flags & PG_FICTITIOUS) == 0 && + pmap_change_attr(PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)), PAGE_SIZE, + m->md.pat_mode)) + panic("memory attribute change on the direct map failed"); +} + +/* * Changes the specified virtual address range's memory type to that given by * the parameter "mode". The specified virtual address range must be * completely contained within either the direct map or the kernel map. If Modified: stable/7/sys/amd64/include/pmap.h ============================================================================== --- stable/7/sys/amd64/include/pmap.h Fri Sep 4 19:20:46 2009 (r196837) +++ stable/7/sys/amd64/include/pmap.h Fri Sep 4 19:59:32 2009 (r196838) @@ -234,7 +234,7 @@ struct pv_entry; struct pv_chunk; struct md_page { - int pv_unused; + int pat_mode; TAILQ_HEAD(,pv_entry) pv_list; }; @@ -306,6 +306,7 @@ extern vm_paddr_t dump_avail[]; extern vm_offset_t virtual_avail; extern vm_offset_t virtual_end; +#define pmap_page_get_memattr(m) ((vm_memattr_t)(m)->md.pat_mode) #define pmap_unmapbios(va, sz) pmap_unmapdev((va), (sz)) void pmap_bootstrap(vm_paddr_t *); @@ -319,6 +320,7 @@ void *pmap_mapbios(vm_paddr_t, vm_size_t void *pmap_mapdev(vm_paddr_t, vm_size_t); void *pmap_mapdev_attr(vm_paddr_t, vm_size_t, int); boolean_t pmap_page_is_mapped(vm_page_t m); +void pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma); void pmap_unmapdev(vm_offset_t, vm_size_t); void pmap_invalidate_page(pmap_t, vm_offset_t); void pmap_invalidate_range(pmap_t, vm_offset_t, vm_offset_t); Copied and modified: stable/7/sys/amd64/include/vm.h (from r195033, head/sys/amd64/include/vm.h) ============================================================================== --- head/sys/amd64/include/vm.h Fri Jun 26 04:47:43 2009 (r195033, copy source) +++ stable/7/sys/amd64/include/vm.h Fri Sep 4 19:59:32 2009 (r196838) @@ -32,14 +32,14 @@ #include -/* Cache control options. */ -#define VM_CACHE_UNCACHEABLE ((vm_cache_mode_t)PAT_UNCACHEABLE) -#define VM_CACHE_WRITE_COMBINING ((vm_cache_mode_t)PAT_WRITE_COMBINING) -#define VM_CACHE_WRITE_THROUGH ((vm_cache_mode_t)PAT_WRITE_THROUGH) -#define VM_CACHE_WRITE_PROTECTED ((vm_cache_mode_t)PAT_WRITE_PROTECTED) -#define VM_CACHE_WRITE_BACK ((vm_cache_mode_t)PAT_WRITE_BACK) -#define VM_CACHE_UNCACHED ((vm_cache_mode_t)PAT_UNCACHED) +/* Memory attributes. */ +#define VM_MEMATTR_UNCACHEABLE ((vm_memattr_t)PAT_UNCACHEABLE) +#define VM_MEMATTR_WRITE_COMBINING ((vm_memattr_t)PAT_WRITE_COMBINING) +#define VM_MEMATTR_WRITE_THROUGH ((vm_memattr_t)PAT_WRITE_THROUGH) +#define VM_MEMATTR_WRITE_PROTECTED ((vm_memattr_t)PAT_WRITE_PROTECTED) +#define VM_MEMATTR_WRITE_BACK ((vm_memattr_t)PAT_WRITE_BACK) +#define VM_MEMATTR_UNCACHED ((vm_memattr_t)PAT_UNCACHED) -#define VM_CACHE_DEFAULT VM_CACHE_WRITE_BACK +#define VM_MEMATTR_DEFAULT VM_MEMATTR_WRITE_BACK #endif /* !_MACHINE_PMAP_H_ */ Modified: stable/7/sys/arm/include/pmap.h ============================================================================== --- stable/7/sys/arm/include/pmap.h Fri Sep 4 19:20:46 2009 (r196837) +++ stable/7/sys/arm/include/pmap.h Fri Sep 4 19:59:32 2009 (r196838) @@ -75,7 +75,10 @@ #endif +#define pmap_page_get_memattr(m) VM_MEMATTR_DEFAULT #define pmap_page_is_mapped(m) (!TAILQ_EMPTY(&(m)->md.pv_list)) +#define pmap_page_set_memattr(m, ma) (void)0 + /* * Pmap stuff */ Copied and modified: stable/7/sys/arm/include/vm.h (from r195033, head/sys/arm/include/vm.h) ============================================================================== --- head/sys/arm/include/vm.h Fri Jun 26 04:47:43 2009 (r195033, copy source) +++ stable/7/sys/arm/include/vm.h Fri Sep 4 19:59:32 2009 (r196838) @@ -29,7 +29,7 @@ #ifndef _MACHINE_VM_H_ #define _MACHINE_VM_H_ -/* Cache control is not (yet) implemented. */ -#define VM_CACHE_DEFAULT 0 +/* Memory attribute configuration is not (yet) implemented. */ +#define VM_MEMATTR_DEFAULT 0 #endif /* !_MACHINE_PMAP_H_ */ Modified: stable/7/sys/dev/iir/iir.c ============================================================================== --- stable/7/sys/dev/iir/iir.c Fri Sep 4 19:20:46 2009 (r196837) +++ stable/7/sys/dev/iir/iir.c Fri Sep 4 19:59:32 2009 (r196838) @@ -67,9 +67,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include - #include MALLOC_DEFINE(M_GDTBUF, "iirbuf", "iir driver buffer"); Modified: stable/7/sys/dev/iir/iir_ctrl.c ============================================================================== --- stable/7/sys/dev/iir/iir_ctrl.c Fri Sep 4 19:20:46 2009 (r196837) +++ stable/7/sys/dev/iir/iir_ctrl.c Fri Sep 4 19:59:32 2009 (r196838) @@ -52,10 +52,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include -#include -#include #include Modified: stable/7/sys/i386/i386/pmap.c ============================================================================== --- stable/7/sys/i386/i386/pmap.c Fri Sep 4 19:20:46 2009 (r196837) +++ stable/7/sys/i386/i386/pmap.c Fri Sep 4 19:59:32 2009 (r196838) @@ -556,20 +556,18 @@ pmap_page_init(vm_page_t m) { TAILQ_INIT(&m->md.pv_list); + m->md.pat_mode = PAT_WRITE_BACK; } #ifdef PAE - -static MALLOC_DEFINE(M_PMAPPDPT, "pmap", "pmap pdpt"); - static void * pmap_pdpt_allocf(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) { /* Inform UMA that this allocator uses kernel_map/object. */ *flags = UMA_SLAB_KERNEL; - return (contigmalloc(PAGE_SIZE, M_PMAPPDPT, 0, 0x0ULL, 0xffffffffULL, - 1, 0)); + return ((void *)kmem_alloc_contig(kernel_map, bytes, wait, 0x0ULL, + 0xffffffffULL, 1, 0, VM_MEMATTR_DEFAULT)); } #endif @@ -1206,7 +1204,8 @@ pmap_qenter(vm_offset_t sva, vm_page_t * endpte = pte + count; while (pte < endpte) { oldpte |= *pte; - pte_store(pte, VM_PAGE_TO_PHYS(*ma) | pgeflag | PG_RW | PG_V); + pte_store(pte, VM_PAGE_TO_PHYS(*ma) | pgeflag | + pmap_cache_bits((*ma)->md.pat_mode, 0) | PG_RW | PG_V); pte++; ma++; } @@ -3161,7 +3160,7 @@ validate: /* * Now validate mapping with desired protection/wiring. */ - newpte = (pt_entry_t)(pa | PG_V); + newpte = (pt_entry_t)(pa | pmap_cache_bits(m->md.pat_mode, 0) | PG_V); if ((prot & VM_PROT_WRITE) != 0) { newpte |= PG_RW; vm_page_flag_set(m, PG_WRITEABLE); @@ -3243,7 +3242,8 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t " in pmap %p", va, pmap); return (FALSE); } - newpde = VM_PAGE_TO_PHYS(m) | PG_PS | PG_V; + newpde = VM_PAGE_TO_PHYS(m) | pmap_cache_bits(m->md.pat_mode, 1) | + PG_PS | PG_V; if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) { newpde |= PG_MANAGED; @@ -3428,7 +3428,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ */ pmap->pm_stats.resident_count++; - pa = VM_PAGE_TO_PHYS(m); + pa = VM_PAGE_TO_PHYS(m) | pmap_cache_bits(m->md.pat_mode, 0); #ifdef PAE if ((prot & VM_PROT_EXECUTE) == 0) pa |= pg_nx; @@ -3471,6 +3471,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offs pd_entry_t *pde; vm_paddr_t pa, ptepa; vm_page_t p; + int pat_mode; VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); KASSERT(object->type == OBJT_DEVICE, @@ -3482,6 +3483,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offs p = vm_page_lookup(object, pindex); KASSERT(p->valid == VM_PAGE_BITS_ALL, ("pmap_object_init_pt: invalid page %p", p)); + pat_mode = p->md.pat_mode; /* * Abort the mapping if the first page is not physically @@ -3493,21 +3495,28 @@ pmap_object_init_pt(pmap_t pmap, vm_offs /* * Skip the first page. Abort the mapping if the rest of - * the pages are not physically contiguous. + * the pages are not physically contiguous or have differing + * memory attributes. */ p = TAILQ_NEXT(p, listq); for (pa = ptepa + PAGE_SIZE; pa < ptepa + size; pa += PAGE_SIZE) { KASSERT(p->valid == VM_PAGE_BITS_ALL, ("pmap_object_init_pt: invalid page %p", p)); - if (pa != VM_PAGE_TO_PHYS(p)) + if (pa != VM_PAGE_TO_PHYS(p) || + pat_mode != p->md.pat_mode) return; p = TAILQ_NEXT(p, listq); } - /* Map using 2/4MB pages. */ + /* + * Map using 2/4MB pages. Since "ptepa" is 2/4M aligned and + * "size" is a multiple of 2/4M, adding the PAT setting to + * "pa" will not affect the termination of this loop. + */ PMAP_LOCK(pmap); - for (pa = ptepa; pa < ptepa + size; pa += NBPDR) { + for (pa = ptepa | pmap_cache_bits(pat_mode, 1); pa < ptepa + + size; pa += NBPDR) { pde = pmap_pde(pmap, addr); if (*pde == 0) { pde_store(pde, pa | PG_PS | PG_M | PG_A | @@ -3723,7 +3732,8 @@ pmap_zero_page(vm_page_t m) if (*sysmaps->CMAP2) panic("pmap_zero_page: CMAP2 busy"); sched_pin(); - *sysmaps->CMAP2 = PG_V | PG_RW | VM_PAGE_TO_PHYS(m) | PG_A | PG_M; + *sysmaps->CMAP2 = PG_V | PG_RW | VM_PAGE_TO_PHYS(m) | PG_A | PG_M | + pmap_cache_bits(m->md.pat_mode, 0); invlcaddr(sysmaps->CADDR2); pagezero(sysmaps->CADDR2); *sysmaps->CMAP2 = 0; @@ -3745,9 +3755,10 @@ pmap_zero_page_area(vm_page_t m, int off sysmaps = &sysmaps_pcpu[PCPU_GET(cpuid)]; mtx_lock(&sysmaps->lock); if (*sysmaps->CMAP2) - panic("pmap_zero_page: CMAP2 busy"); + panic("pmap_zero_page_area: CMAP2 busy"); sched_pin(); - *sysmaps->CMAP2 = PG_V | PG_RW | VM_PAGE_TO_PHYS(m) | PG_A | PG_M; + *sysmaps->CMAP2 = PG_V | PG_RW | VM_PAGE_TO_PHYS(m) | PG_A | PG_M | + pmap_cache_bits(m->md.pat_mode, 0); invlcaddr(sysmaps->CADDR2); if (off == 0 && size == PAGE_SIZE) pagezero(sysmaps->CADDR2); @@ -3769,9 +3780,10 @@ pmap_zero_page_idle(vm_page_t m) { if (*CMAP3) - panic("pmap_zero_page: CMAP3 busy"); + panic("pmap_zero_page_idle: CMAP3 busy"); sched_pin(); - *CMAP3 = PG_V | PG_RW | VM_PAGE_TO_PHYS(m) | PG_A | PG_M; + *CMAP3 = PG_V | PG_RW | VM_PAGE_TO_PHYS(m) | PG_A | PG_M | + pmap_cache_bits(m->md.pat_mode, 0); invlcaddr(CADDR3); pagezero(CADDR3); *CMAP3 = 0; @@ -3798,8 +3810,10 @@ pmap_copy_page(vm_page_t src, vm_page_t sched_pin(); invlpg((u_int)sysmaps->CADDR1); invlpg((u_int)sysmaps->CADDR2); - *sysmaps->CMAP1 = PG_V | VM_PAGE_TO_PHYS(src) | PG_A; - *sysmaps->CMAP2 = PG_V | PG_RW | VM_PAGE_TO_PHYS(dst) | PG_A | PG_M; + *sysmaps->CMAP1 = PG_V | VM_PAGE_TO_PHYS(src) | PG_A | + pmap_cache_bits(src->md.pat_mode, 0); + *sysmaps->CMAP2 = PG_V | PG_RW | VM_PAGE_TO_PHYS(dst) | PG_A | PG_M | + pmap_cache_bits(dst->md.pat_mode, 0); bcopy(sysmaps->CADDR1, sysmaps->CADDR2, PAGE_SIZE); *sysmaps->CMAP1 = 0; *sysmaps->CMAP2 = 0; @@ -4420,7 +4434,9 @@ pmap_mapdev_attr(vm_paddr_t pa, vm_size_ pa += PAGE_SIZE; } pmap_invalidate_range(kernel_pmap, va, tmpva); - pmap_invalidate_cache(); + /* If "Self Snoop" is supported, do nothing. */ + if (!(cpu_feature & CPUID_SS)) + pmap_invalidate_cache(); return ((void *)(va + offset)); } @@ -4455,6 +4471,25 @@ pmap_unmapdev(vm_offset_t va, vm_size_t } /* + * Sets the memory attribute for the specified page. + */ +void +pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma) +{ + + m->md.pat_mode = ma; + + /* + * If "m" is a normal page, flush it from the cache. + */ + if ((m->flags & PG_FICTITIOUS) == 0) { + /* If "Self Snoop" is supported, do nothing. */ + if (!(cpu_feature & CPUID_SS)) + pmap_invalidate_cache(); + } +} + +/* * Changes the specified virtual address range's memory type to that given by * the parameter "mode". The specified virtual address range must be * completely contained within either the kernel map. Modified: stable/7/sys/i386/include/pmap.h ============================================================================== --- stable/7/sys/i386/include/pmap.h Fri Sep 4 19:20:46 2009 (r196837) +++ stable/7/sys/i386/include/pmap.h Fri Sep 4 19:59:32 2009 (r196838) @@ -332,7 +332,7 @@ struct pv_entry; struct pv_chunk; struct md_page { - int pv_unused; + int pat_mode; TAILQ_HEAD(,pv_entry) pv_list; }; @@ -411,6 +411,7 @@ extern char *ptvmmap; /* poor name! */ extern vm_offset_t virtual_avail; extern vm_offset_t virtual_end; +#define pmap_page_get_memattr(m) ((vm_memattr_t)(m)->md.pat_mode) #define pmap_unmapbios(va, sz) pmap_unmapdev((va), (sz)) void pmap_bootstrap(vm_paddr_t); @@ -423,6 +424,7 @@ void *pmap_mapbios(vm_paddr_t, vm_size_t void *pmap_mapdev(vm_paddr_t, vm_size_t); void *pmap_mapdev_attr(vm_paddr_t, vm_size_t, int); boolean_t pmap_page_is_mapped(vm_page_t m); +void pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma); void pmap_unmapdev(vm_offset_t, vm_size_t); pt_entry_t *pmap_pte(pmap_t, vm_offset_t) __pure2; void pmap_set_pg(void); Copied and modified: stable/7/sys/i386/include/vm.h (from r195033, head/sys/i386/include/vm.h) ============================================================================== --- head/sys/i386/include/vm.h Fri Jun 26 04:47:43 2009 (r195033, copy source) +++ stable/7/sys/i386/include/vm.h Fri Sep 4 19:59:32 2009 (r196838) @@ -32,14 +32,14 @@ #include -/* Cache control options. */ -#define VM_CACHE_UNCACHEABLE ((vm_cache_mode_t)PAT_UNCACHEABLE) -#define VM_CACHE_WRITE_COMBINING ((vm_cache_mode_t)PAT_WRITE_COMBINING) -#define VM_CACHE_WRITE_THROUGH ((vm_cache_mode_t)PAT_WRITE_THROUGH) -#define VM_CACHE_WRITE_PROTECTED ((vm_cache_mode_t)PAT_WRITE_PROTECTED) -#define VM_CACHE_WRITE_BACK ((vm_cache_mode_t)PAT_WRITE_BACK) -#define VM_CACHE_UNCACHED ((vm_cache_mode_t)PAT_UNCACHED) +/* Memory attributes. */ +#define VM_MEMATTR_UNCACHEABLE ((vm_memattr_t)PAT_UNCACHEABLE) +#define VM_MEMATTR_WRITE_COMBINING ((vm_memattr_t)PAT_WRITE_COMBINING) +#define VM_MEMATTR_WRITE_THROUGH ((vm_memattr_t)PAT_WRITE_THROUGH) +#define VM_MEMATTR_WRITE_PROTECTED ((vm_memattr_t)PAT_WRITE_PROTECTED) +#define VM_MEMATTR_WRITE_BACK ((vm_memattr_t)PAT_WRITE_BACK) +#define VM_MEMATTR_UNCACHED ((vm_memattr_t)PAT_UNCACHED) -#define VM_CACHE_DEFAULT VM_CACHE_WRITE_BACK +#define VM_MEMATTR_DEFAULT VM_MEMATTR_WRITE_BACK #endif /* !_MACHINE_PMAP_H_ */ Modified: stable/7/sys/ia64/include/pmap.h ============================================================================== --- stable/7/sys/ia64/include/pmap.h Fri Sep 4 19:20:46 2009 (r196837) +++ stable/7/sys/ia64/include/pmap.h Fri Sep 4 19:59:32 2009 (r196838) @@ -118,7 +118,9 @@ extern vm_offset_t virtual_end; extern uint64_t pmap_vhpt_base[]; extern int pmap_vhpt_log2size; +#define pmap_page_get_memattr(m) VM_MEMATTR_DEFAULT #define pmap_page_is_mapped(m) (!TAILQ_EMPTY(&(m)->md.pv_list)) +#define pmap_page_set_memattr(m, ma) (void)0 #define pmap_mapbios(pa, sz) pmap_mapdev(pa, sz) #define pmap_unmapbios(va, sz) pmap_unmapdev(va, sz) Copied and modified: stable/7/sys/ia64/include/vm.h (from r195033, head/sys/ia64/include/vm.h) ============================================================================== --- head/sys/ia64/include/vm.h Fri Jun 26 04:47:43 2009 (r195033, copy source) +++ stable/7/sys/ia64/include/vm.h Fri Sep 4 19:59:32 2009 (r196838) @@ -32,13 +32,13 @@ #include #include -/* Cache control options. */ -#define VM_CACHE_WRITE_BACK ((vm_cache_mode_t)PTE_MA_WB) -#define VM_CACHE_UNCACHEABLE ((vm_cache_mode_t)PTE_MA_UC) -#define VM_CACHE_UNCACHEABLE_EXPORTED ((vm_cache_mode_t)PTE_MA_UCE) -#define VM_CACHE_WRITE_COMBINING ((vm_cache_mode_t)PTE_MA_WC) -#define VM_CACHE_NATPAGE ((vm_cache_mode_t)PTE_MA_NATPAGE) +/* Memory attributes. */ +#define VM_MEMATTR_WRITE_BACK ((vm_memattr_t)PTE_MA_WB) +#define VM_MEMATTR_UNCACHEABLE ((vm_memattr_t)PTE_MA_UC) +#define VM_MEMATTR_UNCACHEABLE_EXPORTED ((vm_memattr_t)PTE_MA_UCE) +#define VM_MEMATTR_WRITE_COMBINING ((vm_memattr_t)PTE_MA_WC) +#define VM_MEMATTR_NATPAGE ((vm_memattr_t)PTE_MA_NATPAGE) -#define VM_CACHE_DEFAULT VM_CACHE_WRITE_BACK +#define VM_MEMATTR_DEFAULT VM_MEMATTR_WRITE_BACK #endif /* !_MACHINE_PMAP_H_ */ Modified: stable/7/sys/kern/kern_mbuf.c ============================================================================== --- stable/7/sys/kern/kern_mbuf.c Fri Sep 4 19:20:46 2009 (r196837) +++ stable/7/sys/kern/kern_mbuf.c Fri Sep 4 19:59:32 2009 (r196838) @@ -45,6 +45,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include @@ -233,9 +235,6 @@ static void mb_zfini_pack(void *, int); static void mb_reclaim(void *); static void mbuf_init(void *); static void *mbuf_jumbo_alloc(uma_zone_t, int, u_int8_t *, int); -static void mbuf_jumbo_free(void *, int, u_int8_t); - -static MALLOC_DEFINE(M_JUMBOFRAME, "jumboframes", "mbuf jumbo frame buffers"); /* Ensure that MSIZE doesn't break dtom() - it must be a power of 2 */ CTASSERT((((MSIZE - 1) ^ MSIZE) + 1) >> 1 == MSIZE); @@ -297,7 +296,6 @@ mbuf_init(void *dummy) if (nmbjumbo9 > 0) uma_zone_set_max(zone_jumbo9, nmbjumbo9); uma_zone_set_allocf(zone_jumbo9, mbuf_jumbo_alloc); - uma_zone_set_freef(zone_jumbo9, mbuf_jumbo_free); zone_jumbo16 = uma_zcreate(MBUF_JUMBO16_MEM_NAME, MJUM16BYTES, mb_ctor_clust, mb_dtor_clust, @@ -310,7 +308,6 @@ mbuf_init(void *dummy) if (nmbjumbo16 > 0) uma_zone_set_max(zone_jumbo16, nmbjumbo16); uma_zone_set_allocf(zone_jumbo16, mbuf_jumbo_alloc); - uma_zone_set_freef(zone_jumbo16, mbuf_jumbo_free); zone_ext_refcnt = uma_zcreate(MBUF_EXTREFCNT_MEM_NAME, sizeof(u_int), NULL, NULL, @@ -359,18 +356,8 @@ mbuf_jumbo_alloc(uma_zone_t zone, int by /* Inform UMA that this allocator uses kernel_map/object. */ *flags = UMA_SLAB_KERNEL; - return (contigmalloc(bytes, M_JUMBOFRAME, wait, (vm_paddr_t)0, - ~(vm_paddr_t)0, 1, 0)); -} - -/* - * UMA backend page deallocator for the jumbo frame zones. - */ -static void -mbuf_jumbo_free(void *mem, int size, u_int8_t flags) -{ - - contigfree(mem, size, M_JUMBOFRAME); + return ((void *)kmem_alloc_contig(kernel_map, bytes, wait, + (vm_paddr_t)0, ~(vm_paddr_t)0, 1, 0, VM_MEMATTR_DEFAULT)); } /* Modified: stable/7/sys/powerpc/include/pmap.h ============================================================================== --- stable/7/sys/powerpc/include/pmap.h Fri Sep 4 19:20:46 2009 (r196837) +++ stable/7/sys/powerpc/include/pmap.h Fri Sep 4 19:59:32 2009 (r196838) @@ -72,7 +72,9 @@ struct md_page { extern struct pmap kernel_pmap_store; #define kernel_pmap (&kernel_pmap_store) +#define pmap_page_get_memattr(m) VM_MEMATTR_DEFAULT #define pmap_page_is_mapped(m) (!LIST_EMPTY(&(m)->md.mdpg_pvoh)) +#define pmap_page_set_memattr(m, ma) (void)0 #ifdef _KERNEL Copied and modified: stable/7/sys/powerpc/include/vm.h (from r195033, head/sys/powerpc/include/vm.h) ============================================================================== --- head/sys/powerpc/include/vm.h Fri Jun 26 04:47:43 2009 (r195033, copy source) +++ stable/7/sys/powerpc/include/vm.h Fri Sep 4 19:59:32 2009 (r196838) @@ -31,10 +31,12 @@ #include -/* Cache control options. */ -#define VM_CACHE_INHIBIT ((vm_cache_mode_t)PTE_I) -#define VM_CACHE_WRITE_THROUGH ((vm_cache_mode_t)PTE_W) +/* Memory attributes. */ +#define VM_MEMATTR_CACHING_INHIBIT ((vm_memattr_t)PTE_I) +#define VM_MEMATTR_GUARD ((vm_memattr_t)PTE_G) +#define VM_MEMATTR_MEMORY_COHERENCE ((vm_memattr_t)PTE_M) +#define VM_MEMATTR_WRITE_THROUGH ((vm_memattr_t)PTE_W) -#define VM_CACHE_DEFAULT 0 +#define VM_MEMATTR_DEFAULT 0 #endif /* !_MACHINE_PMAP_H_ */ Modified: stable/7/sys/sparc64/include/pmap.h ============================================================================== --- stable/7/sys/sparc64/include/pmap.h Fri Sep 4 19:20:46 2009 (r196837) +++ stable/7/sys/sparc64/include/pmap.h Fri Sep 4 19:59:32 2009 (r196838) @@ -77,6 +77,9 @@ struct pmap { #define PMAP_TRYLOCK(pmap) mtx_trylock(&(pmap)->pm_mtx) #define PMAP_UNLOCK(pmap) mtx_unlock(&(pmap)->pm_mtx) +#define pmap_page_get_memattr(m) VM_MEMATTR_DEFAULT +#define pmap_page_set_memattr(m, ma) (void)0 + void pmap_bootstrap(vm_offset_t ekva); vm_paddr_t pmap_kextract(vm_offset_t va); void pmap_kenter(vm_offset_t va, vm_page_t m); Copied and modified: stable/7/sys/sparc64/include/vm.h (from r195033, head/sys/sparc64/include/vm.h) ============================================================================== --- head/sys/sparc64/include/vm.h Fri Jun 26 04:47:43 2009 (r195033, copy source) +++ stable/7/sys/sparc64/include/vm.h Fri Sep 4 19:59:32 2009 (r196838) @@ -29,7 +29,7 @@ #ifndef _MACHINE_VM_H_ #define _MACHINE_VM_H_ -/* Cache control is not (yet) implemented. */ -#define VM_CACHE_DEFAULT 0 +/* Memory attribute configuration is not (yet) implemented. */ +#define VM_MEMATTR_DEFAULT 0 #endif /* !_MACHINE_PMAP_H_ */ Modified: stable/7/sys/sun4v/include/pmap.h ============================================================================== --- stable/7/sys/sun4v/include/pmap.h Fri Sep 4 19:20:46 2009 (r196837) +++ stable/7/sys/sun4v/include/pmap.h Fri Sep 4 19:59:32 2009 (r196838) @@ -106,7 +106,9 @@ typedef struct pv_entry { TAILQ_ENTRY(pv_entry) pv_plist; } *pv_entry_t; +#define pmap_page_get_memattr(m) VM_MEMATTR_DEFAULT #define pmap_page_is_mapped(m) (!TAILQ_EMPTY(&(m)->md.pv_list)) +#define pmap_page_set_memattr(m, ma) (void)0 void pmap_bootstrap(vm_offset_t ekva); vm_paddr_t pmap_kextract(vm_offset_t va); Copied and modified: stable/7/sys/sun4v/include/vm.h (from r195033, head/sys/sun4v/include/vm.h) ============================================================================== --- head/sys/sun4v/include/vm.h Fri Jun 26 04:47:43 2009 (r195033, copy source) +++ stable/7/sys/sun4v/include/vm.h Fri Sep 4 19:59:32 2009 (r196838) @@ -29,7 +29,7 @@ #ifndef _MACHINE_VM_H_ #define _MACHINE_VM_H_ -/* Cache control is not (yet) implemented. */ -#define VM_CACHE_DEFAULT 0 +/* Memory attribute configuration is not (yet) implemented. */ +#define VM_MEMATTR_DEFAULT 0 #endif /* !_MACHINE_PMAP_H_ */ Modified: stable/7/sys/sun4v/sun4v/pmap.c ============================================================================== --- stable/7/sys/sun4v/sun4v/pmap.c Fri Sep 4 19:20:46 2009 (r196837) +++ stable/7/sys/sun4v/sun4v/pmap.c Fri Sep 4 19:59:32 2009 (r196838) @@ -1298,7 +1298,7 @@ pmap_alloc_zeroed_contig_pages(int npage while (m == NULL) { for (i = 0; phys_avail[i + 1] != 0; i += 2) { m = vm_phys_alloc_contig(npages, phys_avail[i], - phys_avail[i + 1], alignment, (1UL<<34)); + phys_avail[i + 1], alignment, (1UL<<34)); if (m) goto found; } Modified: stable/7/sys/vm/device_pager.c ============================================================================== --- stable/7/sys/vm/device_pager.c Fri Sep 4 19:20:46 2009 (r196837) +++ stable/7/sys/vm/device_pager.c Fri Sep 4 19:59:32 2009 (r196838) @@ -70,9 +70,9 @@ static struct mtx dev_pager_mtx; static uma_zone_t fakepg_zone; -static vm_page_t dev_pager_getfake(vm_paddr_t); +static vm_page_t dev_pager_getfake(vm_paddr_t, vm_memattr_t); static void dev_pager_putfake(vm_page_t); -static void dev_pager_updatefake(vm_page_t, vm_paddr_t); +static void dev_pager_updatefake(vm_page_t, vm_paddr_t, vm_memattr_t); struct pagerops devicepagerops = { .pgo_init = dev_pager_init, @@ -194,7 +194,7 @@ dev_pager_dealloc(object) /* * Free up our fake pages. */ - while ((m = TAILQ_FIRST(&object->un_pager.devp.devp_pglist)) != 0) { + while ((m = TAILQ_FIRST(&object->un_pager.devp.devp_pglist)) != NULL) { TAILQ_REMOVE(&object->un_pager.devp.devp_pglist, m, pageq); dev_pager_putfake(m); } @@ -209,7 +209,8 @@ dev_pager_getpages(object, m, count, req { vm_pindex_t offset; vm_paddr_t paddr; - vm_page_t page; + vm_page_t m_paddr, page; + vm_memattr_t memattr; struct cdev *dev; int i, ret; int prot; @@ -219,7 +220,9 @@ dev_pager_getpages(object, m, count, req VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); dev = object->handle; - offset = m[reqpage]->pindex; + page = m[reqpage]; + offset = page->pindex; + memattr = object->memattr; VM_OBJECT_UNLOCK(object); csw = dev_refthread(dev); if (csw == NULL) @@ -233,14 +236,20 @@ dev_pager_getpages(object, m, count, req KASSERT(ret == 0, ("dev_pager_getpage: map function returns error")); td->td_fpop = fpop; dev_relthread(dev); - - if ((m[reqpage]->flags & PG_FICTITIOUS) != 0) { + /* If "paddr" is a real page, perform a sanity check on "memattr". */ + if ((m_paddr = vm_phys_paddr_to_vm_page(paddr)) != NULL && + pmap_page_get_memattr(m_paddr) != memattr) { + memattr = pmap_page_get_memattr(m_paddr); + printf( + "WARNING: A device driver has set \"memattr\" inconsistently.\n"); + } + if ((page->flags & PG_FICTITIOUS) != 0) { /* * If the passed in reqpage page is a fake page, update it with * the new physical address. */ VM_OBJECT_LOCK(object); - dev_pager_updatefake(m[reqpage], paddr); + dev_pager_updatefake(page, paddr, memattr); if (count > 1) { vm_page_lock_queues(); for (i = 0; i < count; i++) { @@ -254,7 +263,7 @@ dev_pager_getpages(object, m, count, req * Replace the passed in reqpage page with our own fake page and * free up the all of the original pages. */ - page = dev_pager_getfake(paddr); + page = dev_pager_getfake(paddr, memattr); VM_OBJECT_LOCK(object); TAILQ_INSERT_TAIL(&object->un_pager.devp.devp_pglist, page, pageq); vm_page_lock_queues(); @@ -264,7 +273,7 @@ dev_pager_getpages(object, m, count, req vm_page_insert(page, object, offset); m[reqpage] = page; } - + page->valid = VM_PAGE_BITS_ALL; return (VM_PAGER_OK); } @@ -294,48 +303,48 @@ dev_pager_haspage(object, pindex, before } /* - * Instantiate a fictitious page. Unlike physical memory pages, only - * the machine-independent fields must be initialized. + * Create a fictitious page with the specified physical address and memory + * attribute. The memory attribute is the only the machine-dependent aspect + * of a fictitious page that must be initialized. */ static vm_page_t -dev_pager_getfake(paddr) - vm_paddr_t paddr; +dev_pager_getfake(vm_paddr_t paddr, vm_memattr_t memattr) { vm_page_t m; - m = uma_zalloc(fakepg_zone, M_WAITOK); - + m = uma_zalloc(fakepg_zone, M_WAITOK | M_ZERO); + m->phys_addr = paddr; + /* Fictitious pages don't use "segind". */ m->flags = PG_FICTITIOUS; + /* Fictitious pages don't use "order" or "pool". */ m->oflags = VPO_BUSY; - m->valid = VM_PAGE_BITS_ALL; - m->dirty = 0; - m->busy = 0; - m->queue = PQ_NONE; - m->object = NULL; - m->wire_count = 1; - m->hold_count = 0; - m->phys_addr = paddr; - + pmap_page_set_memattr(m, memattr); return (m); } +/* + * Release a fictitious page. + */ static void -dev_pager_putfake(m) - vm_page_t m; +dev_pager_putfake(vm_page_t m) { + if (!(m->flags & PG_FICTITIOUS)) panic("dev_pager_putfake: bad page"); uma_zfree(fakepg_zone, m); } +/* + * Update the given fictitious page to the specified physical address and + * memory attribute. + */ static void -dev_pager_updatefake(m, paddr) - vm_page_t m; - vm_paddr_t paddr; +dev_pager_updatefake(vm_page_t m, vm_paddr_t paddr, vm_memattr_t memattr) { + if (!(m->flags & PG_FICTITIOUS)) panic("dev_pager_updatefake: bad page"); m->phys_addr = paddr; - m->valid = VM_PAGE_BITS_ALL; + pmap_page_set_memattr(m, memattr); } Modified: stable/7/sys/vm/pmap.h ============================================================================== --- stable/7/sys/vm/pmap.h Fri Sep 4 19:20:46 2009 (r196837) +++ stable/7/sys/vm/pmap.h Fri Sep 4 19:59:32 2009 (r196838) @@ -79,10 +79,16 @@ struct pmap_statistics { }; typedef struct pmap_statistics *pmap_statistics_t; +/* + * Each machine dependent implementation is expected to provide: + * + * vm_memattr_t pmap_page_get_memattr(vm_page_t); + * boolean_t pmap_page_is_mapped(vm_page_t); + * void pmap_page_set_memattr(vm_page_t, vm_memattr_t); + */ #include #ifdef _KERNEL -struct proc; struct thread; /* Modified: stable/7/sys/vm/vm.h ============================================================================== --- stable/7/sys/vm/vm.h Fri Sep 4 19:20:46 2009 (r196837) +++ stable/7/sys/vm/vm.h Fri Sep 4 19:59:32 2009 (r196838) @@ -61,6 +61,14 @@ #ifndef VM_H #define VM_H +#include + +/* + * The exact set of memory attributes is machine dependent. However, every + * machine is required to define VM_MEMATTR_DEFAULT. + */ +typedef char vm_memattr_t; /* memory attribute codes */ + typedef char vm_inherit_t; /* inheritance codes */ #define VM_INHERIT_SHARE ((vm_inherit_t) 0) Modified: stable/7/sys/vm/vm_contig.c ============================================================================== --- stable/7/sys/vm/vm_contig.c Fri Sep 4 19:20:46 2009 (r196837) +++ stable/7/sys/vm/vm_contig.c Fri Sep 4 19:59:32 2009 (r196838) @@ -193,37 +193,37 @@ vm_page_release_contig(vm_page_t m, vm_p * specified through the given flags, then the pages are zeroed * before they are mapped. */ -static void * -contigmapping(vm_page_t m, vm_pindex_t npages, int flags) +static vm_offset_t +contigmapping(vm_map_t map, vm_size_t size, vm_page_t m, vm_memattr_t memattr, + int flags) { vm_object_t object = kernel_object; - vm_map_t map = kernel_map; vm_offset_t addr, tmp_addr; - vm_pindex_t i; vm_map_lock(map); - if (vm_map_findspace(map, vm_map_min(map), npages << PAGE_SHIFT, &addr) - != KERN_SUCCESS) { + if (vm_map_findspace(map, vm_map_min(map), size, &addr)) { vm_map_unlock(map); - return (NULL); + return (0); } vm_object_reference(object); vm_map_insert(map, object, addr - VM_MIN_KERNEL_ADDRESS, - addr, addr + (npages << PAGE_SHIFT), VM_PROT_ALL, VM_PROT_ALL, 0); + addr, addr + size, VM_PROT_ALL, VM_PROT_ALL, 0); vm_map_unlock(map); - tmp_addr = addr; VM_OBJECT_LOCK(object); - for (i = 0; i < npages; i++) { - vm_page_insert(&m[i], object, + for (tmp_addr = addr; tmp_addr < addr + size; tmp_addr += PAGE_SIZE) { + if (memattr != VM_MEMATTR_DEFAULT) + pmap_page_set_memattr(m, memattr); + vm_page_insert(m, object, OFF_TO_IDX(tmp_addr - VM_MIN_KERNEL_ADDRESS)); - if ((flags & M_ZERO) && !(m[i].flags & PG_ZERO)) - pmap_zero_page(&m[i]); - tmp_addr += PAGE_SIZE; + if ((flags & M_ZERO) && (m->flags & PG_ZERO) == 0) + pmap_zero_page(m); + m->valid = VM_PAGE_BITS_ALL; + m++; } VM_OBJECT_UNLOCK(object); - vm_map_wire(map, addr, addr + (npages << PAGE_SHIFT), + vm_map_wire(map, addr, addr + size, VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES); - return ((void *)addr); + return (addr); } void * @@ -237,11 +237,26 @@ contigmalloc( unsigned long boundary) { void *ret; + + ret = (void *)kmem_alloc_contig(kernel_map, size, flags, low, high, + alignment, boundary, VM_MEMATTR_DEFAULT); + if (ret != NULL) + malloc_type_allocated(type, round_page(size)); + return (ret); +} + +vm_offset_t +kmem_alloc_contig(vm_map_t map, vm_size_t size, int flags, vm_paddr_t low, + vm_paddr_t high, unsigned long alignment, unsigned long boundary, + vm_memattr_t memattr) +{ + vm_offset_t ret; vm_page_t pages; unsigned long npgs; int actl, actmax, inactl, inactmax, tries; - npgs = round_page(size) >> PAGE_SHIFT; + size = round_page(size); + npgs = size >> PAGE_SHIFT; tries = 0; retry: pages = vm_phys_alloc_contig(npgs, low, high, alignment, boundary); @@ -267,13 +282,11 @@ again: tries++; goto retry; } - ret = NULL; + ret = 0; } else { - ret = contigmapping(pages, npgs, flags); - if (ret == NULL) + ret = contigmapping(map, size, pages, memattr, flags); + if (ret == 0) vm_page_release_contig(pages, npgs); - else - malloc_type_allocated(type, npgs << PAGE_SHIFT); } return (ret); } @@ -281,9 +294,7 @@ again: void contigfree(void *addr, unsigned long size, struct malloc_type *type) { - vm_pindex_t npgs; - npgs = round_page(size) >> PAGE_SHIFT; kmem_free(kernel_map, (vm_offset_t)addr, size); - malloc_type_freed(type, npgs << PAGE_SHIFT); + malloc_type_freed(type, round_page(size)); } Modified: stable/7/sys/vm/vm_extern.h ============================================================================== --- stable/7/sys/vm/vm_extern.h Fri Sep 4 19:20:46 2009 (r196837) +++ stable/7/sys/vm/vm_extern.h Fri Sep 4 19:59:32 2009 (r196838) @@ -57,6 +57,9 @@ int swapon(struct thread *, void *, int int kernacc(void *, int, int); vm_offset_t kmem_alloc(vm_map_t, vm_size_t); +vm_offset_t kmem_alloc_contig(vm_map_t map, vm_size_t size, int flags, + vm_paddr_t low, vm_paddr_t high, unsigned long alignment, + unsigned long boundary, vm_memattr_t memattr); vm_offset_t kmem_alloc_nofault(vm_map_t, vm_size_t); vm_offset_t kmem_alloc_wait(vm_map_t, vm_size_t); void kmem_free(vm_map_t, vm_offset_t, vm_size_t); Modified: stable/7/sys/vm/vm_object.c ============================================================================== --- stable/7/sys/vm/vm_object.c Fri Sep 4 19:20:46 2009 (r196837) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From trasz at FreeBSD.org Fri Sep 4 20:01:17 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Fri Sep 4 20:01:51 2009 Subject: svn commit: r196839 - head/usr.bin/find Message-ID: <200909042001.n84K1HMe010090@svn.freebsd.org> Author: trasz Date: Fri Sep 4 20:01:16 2009 New Revision: 196839 URL: http://svn.freebsd.org/changeset/base/196839 Log: Add NFSv4 ACL support to find(1). Reviewed by: rwatson Modified: head/usr.bin/find/function.c Modified: head/usr.bin/find/function.c ============================================================================== --- head/usr.bin/find/function.c Fri Sep 4 19:59:32 2009 (r196838) +++ head/usr.bin/find/function.c Fri Sep 4 20:01:16 2009 (r196839) @@ -371,38 +371,48 @@ c_mXXdepth(OPTION *option, char ***argvp int f_acl(PLAN *plan __unused, FTSENT *entry) { - int match, entries; - acl_entry_t ae; acl_t facl; + acl_type_t acl_type; + int acl_supported = 0, ret, trivial; if (S_ISLNK(entry->fts_statp->st_mode)) return 0; - if ((match = pathconf(entry->fts_accpath, _PC_ACL_EXTENDED)) <= 0) { - if (match < 0 && errno != EINVAL) - warn("%s", entry->fts_accpath); - else - return 0; + ret = pathconf(entry->fts_accpath, _PC_ACL_NFS4); + if (ret > 0) { + acl_supported = 1; + acl_type = ACL_TYPE_NFS4; + } else if (ret < 0 && errno != EINVAL) { + warn("%s", entry->fts_accpath); + return (0); } - match = 0; - if ((facl = acl_get_file(entry->fts_accpath,ACL_TYPE_ACCESS)) != NULL) { - if (acl_get_entry(facl, ACL_FIRST_ENTRY, &ae) == 1) { - /* - * POSIX.1e requires that ACLs of type ACL_TYPE_ACCESS - * must have at least three entries (owner, group, - * other). - */ - entries = 1; - while (acl_get_entry(facl, ACL_NEXT_ENTRY, &ae) == 1) { - if (++entries > 3) { - match = 1; - break; - } - } + if (acl_supported == 0) { + ret = pathconf(entry->fts_accpath, _PC_ACL_EXTENDED); + if (ret > 0) { + acl_supported = 1; + acl_type = ACL_TYPE_ACCESS; + } else if (ret < 0 && errno != EINVAL) { + warn("%s", entry->fts_accpath); + return (0); } - acl_free(facl); - } else + } + if (acl_supported == 0) + return (0); + + facl = acl_get_file(entry->fts_accpath, acl_type); + if (facl == NULL) { warn("%s", entry->fts_accpath); - return match; + return (0); + } + ret = acl_is_trivial_np(facl, &trivial); + acl_free(facl); + if (ret) { + warn("%s", entry->fts_accpath); + acl_free(facl); + return (0); + } + if (trivial) + return (0); + return (1); } PLAN * From emss at free.fr Fri Sep 4 20:26:38 2009 From: emss at free.fr (Eric Masson) Date: Fri Sep 4 20:26:49 2009 Subject: svn commit: r196831 - head/sbin/camcontrol In-Reply-To: <4AA16D68.3080908@FreeBSD.org> (Alexander Motin's message of "Fri, 04 Sep 2009 22:41:28 +0300") References: <200909041821.n84ILfWo092251@svn.freebsd.org> <86iqfytsqe.fsf@srvbsdnanssv.interne.kisoft-services.com> <4AA16D68.3080908@FreeBSD.org> Message-ID: <86eiqmtq12.fsf@srvbsdnanssv.interne.kisoft-services.com> Alexander Motin writes: > It looks like using SCSI/ATAPI command, not an ATA. So it is supported > for long time. But the idea is right, it should be possible to control > it from command line. Ok, I'll dig this. atapicam & camcontrol will be my new friends ;) I've been using FreeBSD since 3.0 with scsi storage but never really dug into cam arcanes... Thanks a lot. -- Warning: file "/home/emss/misc/fortune/En_sig.dat" unreadable Warning: file "/home/emss/misc/fortune/Fr_sig.dat" unreadable Doh, I really need to fix the auto sig feature :) From emss at free.fr Fri Sep 4 20:32:11 2009 From: emss at free.fr (Eric Masson) Date: Fri Sep 4 20:32:22 2009 Subject: svn commit: r196831 - head/sbin/camcontrol In-Reply-To: <200909041821.n84ILfWo092251@svn.freebsd.org> (Alexander Motin's message of "Fri, 4 Sep 2009 18:21:41 +0000 (UTC)") References: <200909041821.n84ILfWo092251@svn.freebsd.org> Message-ID: <86iqfytsqe.fsf@srvbsdnanssv.interne.kisoft-services.com> Alexander Motin writes: Hi Alexander, > Author: mav > Date: Fri Sep 4 18:21:40 2009 > New Revision: 196831 > URL: http://svn.freebsd.org/changeset/base/196831 > > Log: > Add to `camcontrol cmd` support for sending arbitrary ATA commands. > > It could be used for broad range of tasks, such as configuring drive > power management modes, caching, security and any other features and tasks, > not supported by existing drivers. Like controlling speed of DVD drives like this linux code snippet (speedcontrol.c) seems to be able to : http://ubuntuforums.org/archive/index.php/t-592513.html Regards -- Ca fait d?j? plusieurs semaines que j"essaie de correspondre par l" interm?diaire d"un groupe de discussion. Ca ne fait que deux jour que je suis parvenu ? exp?dier un message -+- GM in GNU : Patience et longueur de temps.. -+- From jhb at FreeBSD.org Fri Sep 4 21:00:45 2009 From: jhb at FreeBSD.org (John Baldwin) Date: Fri Sep 4 21:00:56 2009 Subject: svn commit: r196840 - head/sys/dev/cxgb Message-ID: <200909042100.n84L0j6Z014735@svn.freebsd.org> Author: jhb Date: Fri Sep 4 21:00:45 2009 New Revision: 196840 URL: http://svn.freebsd.org/changeset/base/196840 Log: Fill the reverse RSS map with 0xff's so that the subsequent loop to calculate the values will work properly. Reviewed by: np MFC after: 1 month Modified: head/sys/dev/cxgb/cxgb_main.c Modified: head/sys/dev/cxgb/cxgb_main.c ============================================================================== --- head/sys/dev/cxgb/cxgb_main.c Fri Sep 4 20:01:16 2009 (r196839) +++ head/sys/dev/cxgb/cxgb_main.c Fri Sep 4 21:00:45 2009 (r196840) @@ -1456,7 +1456,10 @@ setup_rss(adapter_t *adap) rspq_map[i] = nq[0] ? i % nq[0] : 0; rspq_map[i + RSS_TABLE_SIZE / 2] = nq[1] ? i % nq[1] + nq[0] : 0; } + /* Calculate the reverse RSS map table */ + for (i = 0; i < SGE_QSETS; ++i) + adap->rrss_map[i] = 0xff; for (i = 0; i < RSS_TABLE_SIZE; ++i) if (adap->rrss_map[rspq_map[i]] == 0xff) adap->rrss_map[rspq_map[i]] = i; From trasz at FreeBSD.org Fri Sep 4 21:49:38 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Fri Sep 4 21:49:44 2009 Subject: svn commit: r196841 - head/bin/mv Message-ID: <200909042149.n84LnbdE018523@svn.freebsd.org> Author: trasz Date: Fri Sep 4 21:49:37 2009 New Revision: 196841 URL: http://svn.freebsd.org/changeset/base/196841 Log: Add NFSv4 ACL support to mv(1). Reviewed by: rwatson Modified: head/bin/mv/mv.c Modified: head/bin/mv/mv.c ============================================================================== --- head/bin/mv/mv.c Fri Sep 4 21:00:45 2009 (r196840) +++ head/bin/mv/mv.c Fri Sep 4 21:49:37 2009 (r196841) @@ -74,6 +74,8 @@ static int copy(const char *, const char static int do_move(const char *, const char *); static int fastcopy(const char *, const char *, struct stat *); static void usage(void); +static void preserve_fd_acls(int source_fd, int dest_fd, const char *source_path, + const char *dest_path); int main(int argc, char *argv[]) @@ -260,7 +262,6 @@ fastcopy(const char *from, const char *t struct timeval tval[2]; static u_int blen; static char *bp; - acl_t acl; mode_t oldmode; int nread, from_fd, to_fd; @@ -311,23 +312,15 @@ err: if (unlink(to)) sbp->st_mode &= ~(S_ISUID | S_ISGID); } } + if (fchmod(to_fd, sbp->st_mode)) + warn("%s: set mode (was: 0%03o)", to, oldmode); /* * POSIX 1003.2c states that if _POSIX_ACL_EXTENDED is in effect * for dest_file, then its ACLs shall reflect the ACLs of the * source_file. */ - if (fpathconf(to_fd, _PC_ACL_EXTENDED) == 1 && - fpathconf(from_fd, _PC_ACL_EXTENDED) == 1) { - acl = acl_get_fd(from_fd); - if (acl == NULL) - warn("failed to get acl entries while setting %s", - from); - else if (acl_set_fd(to_fd, acl) < 0) - warn("failed to set acl entries for %s", to); - } + preserve_fd_acls(from_fd, to_fd, from, to); (void)close(from_fd); - if (fchmod(to_fd, sbp->st_mode)) - warn("%s: set mode (was: 0%03o)", to, oldmode); /* * XXX * NFS doesn't support chflags; ignore errors unless there's reason @@ -439,6 +432,59 @@ copy(const char *from, const char *to) } static void +preserve_fd_acls(int source_fd, int dest_fd, const char *source_path, + const char *dest_path) +{ + acl_t acl; + acl_type_t acl_type; + int acl_supported = 0, ret, trivial; + + ret = fpathconf(source_fd, _PC_ACL_NFS4); + if (ret > 0 ) { + acl_supported = 1; + acl_type = ACL_TYPE_NFS4; + } else if (ret < 0 && errno != EINVAL) { + warn("fpathconf(..., _PC_ACL_NFS4) failed for %s", + source_path); + return; + } + if (acl_supported == 0) { + ret = fpathconf(source_fd, _PC_ACL_EXTENDED); + if (ret > 0 ) { + acl_supported = 1; + acl_type = ACL_TYPE_ACCESS; + } else if (ret < 0 && errno != EINVAL) { + warn("fpathconf(..., _PC_ACL_EXTENDED) failed for %s", + source_path); + return; + } + } + if (acl_supported == 0) + return; + + acl = acl_get_fd_np(source_fd, acl_type); + if (acl == NULL) { + warn("failed to get acl entries for %s", source_path); + return; + } + if (acl_is_trivial_np(acl, &trivial)) { + warn("acl_is_trivial() failed for %s", source_path); + acl_free(acl); + return; + } + if (trivial) { + acl_free(acl); + return; + } + if (acl_set_fd_np(dest_fd, acl, acl_type) < 0) { + warn("failed to set acl entries for %s", dest_path); + acl_free(acl); + return; + } + acl_free(acl); +} + +static void usage(void) { From attilio at freebsd.org Fri Sep 4 21:55:54 2009 From: attilio at freebsd.org (Attilio Rao) Date: Fri Sep 4 21:56:06 2009 Subject: svn commit: r196779 - in head/sys: kern sys In-Reply-To: <20090904.112919.1521002024.imp@bsdimp.com> References: <200909031340.n83Defkv034013@svn.freebsd.org> <20090904.112919.1521002024.imp@bsdimp.com> Message-ID: <3bbf2fe10909041455u552b0dbdm1708ea0a26365149@mail.gmail.com> 2009/9/4 M. Warner Losh : > In message: <200909031340.n83Defkv034013@svn.freebsd.org> > Attilio Rao writes: > : Modified: head/sys/sys/bus.h > : ============================================================================== > : --- head/sys/sys/bus.h Thu Sep 3 12:41:00 2009 (r196778) > : +++ head/sys/sys/bus.h Thu Sep 3 13:40:41 2009 (r196779) > : @@ -52,8 +52,11 @@ struct u_businfo { > : typedef enum device_state { > : DS_NOTPRESENT, /**< @brief not probed or probe failed */ > : DS_ALIVE, /**< @brief probe succeeded */ > : + DS_ATTACHING, /**< @brief attaching is in progress */ > : DS_ATTACHED, /**< @brief attach method called */ > : - DS_BUSY /**< @brief device is open */ > : + DS_BUSY, /**< @brief device is open */ > : + DS_DETACHING /**< @brief detaching is in progress */ > : + > : } device_state_t; > > device_state_t is exported to userland via devctl. Well, that's not > entirely true... It isn't used EXACTLY, but there's this in > devinfo.h: > > /* > * State of the device. > */ > /* XXX not sure if I want a copy here, or expose sys/bus.h */ > typedef enum devinfo_state { > DIS_NOTPRESENT, /* not probed or probe failed */ > DIS_ALIVE, /* probe succeeded */ > DIS_ATTACHED, /* attach method called */ > DIS_BUSY /* device is open */ > } devinfo_state_t; > > which is why devinfo is broken. I think the right fix here is to maintain in sync devinfo.h and bus.h definition by just having one. I see that the devices states are redefined in devinfo.h in order to avoid namespace pollution and this is a good point. What I propose is to add a new header (_bus.h, to be included in both bus.h and devinfo.h) which just containst the device states. > Also, DS_BUSY is used in many drivers to PREVENT detaching. So the > change is bad from that point of view, since DS_DETACHING is now > > DS_BUSY. There's really a partial ordering relationship now where > before there was a total ordering (DS_BUSY is > DS_ATTACHED and > DS_DETACHING is > DS_ATTACH, but DS_DETACHING isn't > DS_BUSY and > DS_BUSY isn't > DS_DETACHING). I think that you've destroyed > information here by unconditionally setting it: > > - if ((error = DEVICE_DETACH(dev)) != 0) > + dev->state = DS_DETACHING; > + if ((error = DEVICE_DETACH(dev)) != 0) { > + KASSERT(dev->state == DS_DETACHING, > + ("%s: %p device state must not been changing", __func__, > + dev)); > + dev->state = DS_ATTACHED; > return (error); > + } > + KASSERT(dev->state == DS_DETACHING, > + ("%s: %p device state must not been changing", __func__, dev)); > > And this looks racy between the check earlier and this setting. > Properly locked, this wouldn't destroy information... Sorry, I really don't understand what point are you making here, and what the scaring words of "destroying", "racy", etc. means. Can you explain better that part? > At the very least cardbus/cardbus.c and pccard/pccard.c need to be > looked at since they both have code that looks like: > > for (tmp = 0; tmp < numdevs; tmp++) { > struct cardbus_devinfo *dinfo = device_get_ivars(devlist[tmp]); > int status = device_get_state(devlist[tmp]); > > if (dinfo->pci.cfg.dev != devlist[tmp]) > device_printf(cbdev, "devinfo dev mismatch\n"); > if (status == DS_ATTACHED || status == DS_BUSY) > device_detach(devlist[tmp]); > cardbus_release_all_resources(cbdev, dinfo); > cardbus_device_destroy(dinfo); > device_delete_child(cbdev, devlist[tmp]); > pci_freecfg((struct pci_devinfo *)dinfo); > } > > which does ignore errors returned by device_detach for the DS_BUSY > case because there's not currently a good way to tell device_detach > that it *MUST* detach the device *NOW* without any possibility of veto > by the driver. The above code also isn't DS_DETACHING aware, and may > be wrong in the face of this new state. How DS_DETACHING can cause problems here? device_detach() simply won't run if the state is DS_DETACHING as expected (another thread is alredy detaching and there is no need for it to detach). Also, please note that in this case, for the state == DS_BUSY he device_detach() won't do anything. You can't simply skip the return value and anything else, but the reality is still the operation won't happen. > Of course, grepping the tree does show one or two places where DS_BUSY > is used inappropriately: > > rp.c: > > static int > rp_pcidetach(device_t dev) > { > CONTROLLER_t *ctlp; > > if (device_get_state(dev) == DS_BUSY) > return (EBUSY); > > is one example. The above check should just be removed (ditto for its > SHUTDOWN) routine. > > So I think we should fix rp.c, but we need to talk through this change > a little more. I'm surprised I wasn't even pinged about it, since it > hits code that I maintain and a simple grep would have found... Still, I don't see a problem with the codes you mentioned (if not in the consumers, which were alredy "broken" before this change and which situation is not worse now), unless the devinfo breakage. Attilio -- Peace can only be achieved by understanding - A. Einstein From brooks at FreeBSD.org Fri Sep 4 22:15:26 2009 From: brooks at FreeBSD.org (Brooks Davis) Date: Fri Sep 4 22:15:38 2009 Subject: svn commit: r195843 - in head: lib/libkvm sys/kern sys/sys In-Reply-To: <20090829201228.00005860@unknown> References: <200907241503.n6OF3ATP013228@svn.freebsd.org> <20090829201228.00005860@unknown> Message-ID: <20090904221432.GC82231@lor.one-eyed-alien.net> On Sat, Aug 29, 2009 at 08:12:28PM +0100, Bruce Cran wrote: > On Fri, 24 Jul 2009 15:03:10 +0000 (UTC) > Brooks Davis wrote: > > > Author: brooks > > Date: Fri Jul 24 15:03:10 2009 > > New Revision: 195843 > > URL: http://svn.freebsd.org/changeset/base/195843 > > > > Log: > > Revert the changes to struct kinfo_proc in r194498. Instead, fill > > in up to 16 (KI_NGROUPS) values and steal a bit from ki_cr_flags > > (all bits currently unused) to indicate overflow with the new flag > > KI_CRF_GRP_OVERFLOW. > > > > This fixes procstat -s. > > > > Approved by: re (kib) > > Hi Brooks, > > This checkin appears to have broken crash dump support: the bcopy in > kvm_proc.c crashes when running "ps -ax -M /var/crash/vmcore.x > -N /boot/kernel/kernel", apparently because ucred.cr_groups isn't valid. > Does it need converted using KVM_READ first? Sorry for the delay, I believe you are correct we need to use kvm_read here instead of the bcopy. Do you still have a core handy you can test a patch against? The following should do it. -- Brooks Index: lib/libkvm/kvm_proc.c =================================================================== --- lib/libkvm/kvm_proc.c (revision 196736) +++ lib/libkvm/kvm_proc.c (working copy) @@ -151,7 +151,7 @@ kp->ki_cr_flags |= KI_CRF_GRP_OVERFLOW; } kp->ki_ngroups = ucred.cr_ngroups; - bcopy(ucred.cr_groups, kp->ki_groups, + kvm_read(kd, (u_long)ucred.cr_groups, kp->ki_groups, kp->ki_ngroups * sizeof(gid_t)); kp->ki_uid = ucred.cr_uid; if (ucred.cr_prison != NULL) { -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 187 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090904/7d4315e9/attachment.pgp From sam at FreeBSD.org Fri Sep 4 22:34:58 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Fri Sep 4 22:35:09 2009 Subject: svn commit: r196842 - head/sys/dev/mwl Message-ID: <200909042234.n84MYvcJ022111@svn.freebsd.org> Author: sam Date: Fri Sep 4 22:34:57 2009 New Revision: 196842 URL: http://svn.freebsd.org/changeset/base/196842 Log: must also plumb static wep keys to the local sta db in sta mode; not sure when this became necessary and might be caused by some missing code to do auto-configuration of DWDS usage Noticed by: Felix Feng Modified: head/sys/dev/mwl/if_mwl.c Modified: head/sys/dev/mwl/if_mwl.c ============================================================================== --- head/sys/dev/mwl/if_mwl.c Fri Sep 4 21:49:37 2009 (r196841) +++ head/sys/dev/mwl/if_mwl.c Fri Sep 4 22:34:57 2009 (r196842) @@ -1738,6 +1738,10 @@ mwl_key_set(struct ieee80211vap *vap, co * WEP keys when the sta reaches AUTH state. */ macaddr = vap->iv_bss->ni_bssid; + if ((k->wk_flags & IEEE80211_KEY_GROUP) == 0) { + /* XXX plumb to local sta db too for static key wep */ + mwl_hal_keyset(hvap, &hk, vap->iv_myaddr); + } } else if (vap->iv_opmode == IEEE80211_M_WDS && vap->iv_state != IEEE80211_S_RUN) { /* From jfv at FreeBSD.org Fri Sep 4 22:37:03 2009 From: jfv at FreeBSD.org (Jack F Vogel) Date: Fri Sep 4 22:37:09 2009 Subject: svn commit: r196843 - stable/8/sys/dev/ixgbe Message-ID: <200909042237.n84Mb3rr022309@svn.freebsd.org> Author: jfv Date: Fri Sep 4 22:37:03 2009 New Revision: 196843 URL: http://svn.freebsd.org/changeset/base/196843 Log: This patch seperates the control of header split from LRO (which it was previously dependent on), LRO gets turned off when bridging but its been found that header split is still a performance win in that case. Secondly, there was some interface specific control in stats code that has been missing, and a logic error that resulted in bogus reporting. Thanks to Manish and John of LineRateSystems for the report and help in this code. Approved by: re Modified: stable/8/sys/dev/ixgbe/ixgbe.c Modified: stable/8/sys/dev/ixgbe/ixgbe.c ============================================================================== --- stable/8/sys/dev/ixgbe/ixgbe.c Fri Sep 4 22:34:57 2009 (r196842) +++ stable/8/sys/dev/ixgbe/ixgbe.c Fri Sep 4 22:37:03 2009 (r196843) @@ -46,7 +46,7 @@ int ixgbe_display_debug_stat /********************************************************************* * Driver version *********************************************************************/ -char ixgbe_driver_version[] = "1.8.8"; +char ixgbe_driver_version[] = "1.8.9"; /********************************************************************* * PCI Device ID Table @@ -246,6 +246,15 @@ static int ixgbe_enable_msix = 1; TUNABLE_INT("hw.ixgbe.enable_msix", &ixgbe_enable_msix); /* + * Header split has seemed to be beneficial in + * all circumstances tested, so its on by default + * however this variable will allow it to be disabled + * for some debug purposes. + */ +static bool ixgbe_header_split = TRUE; +TUNABLE_INT("hw.ixgbe.hdr_split", &ixgbe_header_split); + +/* * Number of Queues, should normally * be left at 0, it then autoconfigures to * the number of cpus. Each queue is a pair @@ -454,7 +463,6 @@ ixgbe_attach(device_t dev) */ if (nmbclusters > 0 ) { int s; - /* Calculate the total RX mbuf needs */ s = (ixgbe_rxd * adapter->num_queues) * ixgbe_total_ports; if (s > nmbclusters) { device_printf(dev, "RX Descriptors exceed " @@ -1459,8 +1467,7 @@ ixgbe_msix_link(void *arg) device_printf(adapter->dev, "\nCRITICAL: ECC ERROR!! " "Please Reboot!!\n"); IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_ECC); - } - if (reg_eicr & IXGBE_EICR_GPI_SDP1) { + } else if (reg_eicr & IXGBE_EICR_GPI_SDP1) { /* Clear the interrupt */ IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP1); taskqueue_enqueue(adapter->tq, &adapter->msf_task); @@ -1883,7 +1890,11 @@ ixgbe_set_multi(struct adapter *adapter) IXGBE_WRITE_REG(&adapter->hw, IXGBE_FCTRL, fctrl); +#if __FreeBSD_version < 800000 + IF_ADDR_LOCK(ifp); +#else if_maddr_rlock(ifp); +#endif TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -1892,7 +1903,11 @@ ixgbe_set_multi(struct adapter *adapter) IXGBE_ETH_LENGTH_OF_ADDRESS); mcnt++; } +#if __FreeBSD_version < 800000 + IF_ADDR_UNLOCK(ifp); +#else if_maddr_runlock(ifp); +#endif update_ptr = mta; ixgbe_update_mc_addr_list(&adapter->hw, @@ -3534,7 +3549,10 @@ ixgbe_setup_receive_ring(struct rx_ring rxr->next_to_check = 0; rxr->last_cleaned = 0; rxr->lro_enabled = FALSE; - rxr->hdr_split = FALSE; + + /* Use header split if configured */ + if (ixgbe_header_split) + rxr->hdr_split = TRUE; bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); @@ -3553,7 +3571,6 @@ ixgbe_setup_receive_ring(struct rx_ring } INIT_DEBUGOUT("RX LRO Initialized\n"); rxr->lro_enabled = TRUE; - rxr->hdr_split = TRUE; lro->ifp = adapter->ifp; } @@ -4457,24 +4474,42 @@ ixgbe_update_stats_counters(struct adapt struct ifnet *ifp = adapter->ifp;; struct ixgbe_hw *hw = &adapter->hw; u32 missed_rx = 0, bprc, lxon, lxoff, total; + u64 total_missed_rx = 0; adapter->stats.crcerrs += IXGBE_READ_REG(hw, IXGBE_CRCERRS); for (int i = 0; i < 8; i++) { - int mp; - mp = IXGBE_READ_REG(hw, IXGBE_MPC(i)); - missed_rx += mp; - adapter->stats.mpc[i] += mp; - adapter->stats.rnbc[i] += IXGBE_READ_REG(hw, IXGBE_RNBC(i)); + /* missed_rx tallies misses for the gprc workaround */ + missed_rx += IXGBE_READ_REG(hw, IXGBE_MPC(i)); + adapter->stats.mpc[i] += missed_rx; + /* Running comprehensive total for stats display */ + total_missed_rx += adapter->stats.mpc[i]; + if (hw->mac.type == ixgbe_mac_82598EB) + adapter->stats.rnbc[i] += + IXGBE_READ_REG(hw, IXGBE_RNBC(i)); } /* Hardware workaround, gprc counts missed packets */ adapter->stats.gprc += IXGBE_READ_REG(hw, IXGBE_GPRC); adapter->stats.gprc -= missed_rx; - adapter->stats.gorc += IXGBE_READ_REG(hw, IXGBE_GORCH); - adapter->stats.gotc += IXGBE_READ_REG(hw, IXGBE_GOTCH); - adapter->stats.tor += IXGBE_READ_REG(hw, IXGBE_TORH); + if (hw->mac.type == ixgbe_mac_82599EB) { + adapter->stats.gorc += IXGBE_READ_REG(hw, IXGBE_GORCL); + IXGBE_READ_REG(hw, IXGBE_GORCH); /* clears register */ + adapter->stats.gotc += IXGBE_READ_REG(hw, IXGBE_GOTCL); + IXGBE_READ_REG(hw, IXGBE_GOTCH); /* clears register */ + adapter->stats.tor += IXGBE_READ_REG(hw, IXGBE_TORL); + IXGBE_READ_REG(hw, IXGBE_TORH); /* clears register */ + adapter->stats.lxonrxc += IXGBE_READ_REG(hw, IXGBE_LXONRXCNT); + adapter->stats.lxoffrxc += IXGBE_READ_REG(hw, IXGBE_LXOFFRXCNT); + } else { + adapter->stats.lxonrxc += IXGBE_READ_REG(hw, IXGBE_LXONRXC); + adapter->stats.lxoffrxc += IXGBE_READ_REG(hw, IXGBE_LXOFFRXC); + /* 82598 only has a counter in the high register */ + adapter->stats.gorc += IXGBE_READ_REG(hw, IXGBE_GORCH); + adapter->stats.gorc += IXGBE_READ_REG(hw, IXGBE_GOTCH); + adapter->stats.tor += IXGBE_READ_REG(hw, IXGBE_TORH); + } /* * Workaround: mprc hardware is incorrectly counting @@ -4494,9 +4529,6 @@ ixgbe_update_stats_counters(struct adapt adapter->stats.prc1522 += IXGBE_READ_REG(hw, IXGBE_PRC1522); adapter->stats.rlec += IXGBE_READ_REG(hw, IXGBE_RLEC); - adapter->stats.lxonrxc += IXGBE_READ_REG(hw, IXGBE_LXONRXCNT); - adapter->stats.lxoffrxc += IXGBE_READ_REG(hw, IXGBE_LXOFFRXCNT); - lxon = IXGBE_READ_REG(hw, IXGBE_LXONTXC); adapter->stats.lxontxc += lxon; lxoff = IXGBE_READ_REG(hw, IXGBE_LXOFFTXC); @@ -4532,7 +4564,7 @@ ixgbe_update_stats_counters(struct adapt ifp->if_collisions = 0; /* Rx Errors */ - ifp->if_ierrors = missed_rx + adapter->stats.crcerrs + + ifp->if_ierrors = total_missed_rx + adapter->stats.crcerrs + adapter->stats.rlec; } From jfv at FreeBSD.org Fri Sep 4 22:45:08 2009 From: jfv at FreeBSD.org (Jack F Vogel) Date: Fri Sep 4 22:45:14 2009 Subject: svn commit: r196844 - head/sys/dev/ixgbe Message-ID: <200909042245.n84Mj709022969@svn.freebsd.org> Author: jfv Date: Fri Sep 4 22:45:07 2009 New Revision: 196844 URL: http://svn.freebsd.org/changeset/base/196844 Log: If an interface is brought up with no cable it will experience watchdog resets, this is due to a missing check for link in the new multiqueue start code. MFC: 3 days Modified: head/sys/dev/ixgbe/ixgbe.c Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Fri Sep 4 22:37:03 2009 (r196843) +++ head/sys/dev/ixgbe/ixgbe.c Fri Sep 4 22:45:07 2009 (r196844) @@ -759,7 +759,8 @@ ixgbe_mq_start_locked(struct ifnet *ifp, struct mbuf *next; int err = 0; - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { + if (((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) || + (!adapter->link_active)) { err = drbr_enqueue(ifp, txr->br, m); return (err); } From bms at incunabulum.net Sat Sep 5 00:05:04 2009 From: bms at incunabulum.net (Bruce Simpson) Date: Sat Sep 5 00:05:16 2009 Subject: svn commit: r196797 - in head: sys/net sys/netinet usr.bin/netstat In-Reply-To: References: <200909032110.n83LAvUF044731@svn.freebsd.org> <4AA09B41.3040103@incunabulum.net> Message-ID: <4AA1AB29.9030704@incunabulum.net> Robert Watson wrote: > For sysctls, explicit versioning doesn't help too much -- what I've > been pondering for another structure was including spares and having a > capabilities field in the structure where flags are set when fields > are known by the kernel. That way userspace can tell if the kernel > knows about the field it cares about and therefore whether they're > worth looking at. One thing that Thrift did was to explicitly all number fields in their implementation of RPC. This is useful, because if anything changes over time, implementations can be updated to keep track of that. Whilst I agree that it's unlikely 'struct arpstat' would change, if it did, it would be great to have a length field, at a minimum, in front. sysctl can determine size at runtime, however, kmem interfaces cannot. That's the only real reason why I'd nudge about it. :-) For igmpstat, at least, the SSM drop adds a LOT of state to the network stack which wasn't there before, so having an explicit version field is warranted for backwards compatibility (and this is something Robert chewed me out about many months ago). Much respect, big yo'self up yo... From kensmith at FreeBSD.org Sat Sep 5 00:50:08 2009 From: kensmith at FreeBSD.org (Ken Smith) Date: Sat Sep 5 00:50:15 2009 Subject: svn commit: r196848 - stable/8/sys/conf Message-ID: <200909050050.n850o8Uf028206@svn.freebsd.org> Author: kensmith Date: Sat Sep 5 00:50:08 2009 New Revision: 196848 URL: http://svn.freebsd.org/changeset/base/196848 Log: Ready for BETA4. Approved by: re (implicit) Modified: stable/8/sys/conf/newvers.sh Modified: stable/8/sys/conf/newvers.sh ============================================================================== --- stable/8/sys/conf/newvers.sh Fri Sep 4 23:14:18 2009 (r196847) +++ stable/8/sys/conf/newvers.sh Sat Sep 5 00:50:08 2009 (r196848) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="8.0" -BRANCH="BETA3" +BRANCH="BETA4" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From alc at FreeBSD.org Sat Sep 5 05:28:07 2009 From: alc at FreeBSD.org (Alan Cox) Date: Sat Sep 5 05:28:23 2009 Subject: svn commit: r196852 - in stable/7/sys: . contrib/pf pc98/include Message-ID: <200909050528.n855S7M0038174@svn.freebsd.org> Author: alc Date: Sat Sep 5 05:28:07 2009 New Revision: 196852 URL: http://svn.freebsd.org/changeset/base/196852 Log: MFC r195089 Add stub vm.h for pc98. Added: stable/7/sys/pc98/include/vm.h - copied unchanged from r195089, head/sys/pc98/include/vm.h Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) Copied: stable/7/sys/pc98/include/vm.h (from r195089, head/sys/pc98/include/vm.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/sys/pc98/include/vm.h Sat Sep 5 05:28:07 2009 (r196852, copy of r195089, head/sys/pc98/include/vm.h) @@ -0,0 +1,6 @@ +/*- + * This file is in the public domain. + */ +/* $FreeBSD$ */ + +#include From alc at FreeBSD.org Sat Sep 5 05:57:44 2009 From: alc at FreeBSD.org (Alan Cox) Date: Sat Sep 5 05:57:56 2009 Subject: svn commit: r196853 - in stable/7/sys: . contrib/pf i386/include Message-ID: <200909050557.n855viT4038786@svn.freebsd.org> Author: alc Date: Sat Sep 5 05:57:44 2009 New Revision: 196853 URL: http://svn.freebsd.org/changeset/base/196853 Log: MFC r194295 Move (read|write)_cyrix_reg() inlines from specialreg.h to cpufunc.h. specialreg.h now consists solely of register-related macros. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/i386/include/cpufunc.h stable/7/sys/i386/include/specialreg.h Modified: stable/7/sys/i386/include/cpufunc.h ============================================================================== --- stable/7/sys/i386/include/cpufunc.h Sat Sep 5 05:28:07 2009 (r196852) +++ stable/7/sys/i386/include/cpufunc.h Sat Sep 5 05:57:44 2009 (r196853) @@ -646,6 +646,20 @@ load_dr7(u_int dr7) __asm __volatile("movl %0,%%dr7" : : "r" (dr7)); } +static __inline u_char +read_cyrix_reg(u_char reg) +{ + outb(0x22, reg); + return inb(0x23); +} + +static __inline void +write_cyrix_reg(u_char reg, u_char data) +{ + outb(0x22, reg); + outb(0x23, data); +} + static __inline register_t intr_disable(void) { @@ -720,6 +734,7 @@ u_int rdr5(void); u_int rdr6(void); u_int rdr7(void); uint64_t rdtsc(void); +u_char read_cyrix_reg(u_char reg); u_int read_eflags(void); u_int rfs(void); uint64_t rgdt(void); @@ -728,6 +743,7 @@ uint64_t ridt(void); u_short rldt(void); u_short rtr(void); void wbinvd(void); +void write_cyrix_reg(u_char reg, u_char data); void write_eflags(u_int ef); void wrmsr(u_int msr, uint64_t newval); Modified: stable/7/sys/i386/include/specialreg.h ============================================================================== --- stable/7/sys/i386/include/specialreg.h Sat Sep 5 05:28:07 2009 (r196852) +++ stable/7/sys/i386/include/specialreg.h Sat Sep 5 05:57:44 2009 (r196853) @@ -540,20 +540,4 @@ #define VIA_CRYPT_CWLO_KEY192 0x0000040c /* 192bit, 12 rds */ #define VIA_CRYPT_CWLO_KEY256 0x0000080e /* 256bit, 15 rds */ -#ifndef LOCORE -static __inline u_char -read_cyrix_reg(u_char reg) -{ - outb(0x22, reg); - return inb(0x23); -} - -static __inline void -write_cyrix_reg(u_char reg, u_char data) -{ - outb(0x22, reg); - outb(0x23, data); -} -#endif - #endif /* !_MACHINE_SPECIALREG_H_ */ From mav at FreeBSD.org Sat Sep 5 06:16:52 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Sat Sep 5 06:16:58 2009 Subject: svn commit: r196777 - head/sys/dev/ahci In-Reply-To: <200909031602.01222.jhb@freebsd.org> References: <200909031237.n83CbIgk032551@svn.freebsd.org> <20090903114121.C20031@pooker.samsco.org> <9bbcef730909031245o7c380925sd29b2cc976c4d7dd@mail.gmail.com> <200909031602.01222.jhb@freebsd.org> Message-ID: <4AA20249.9000301@FreeBSD.org> John Baldwin wrote: > On Thursday 03 September 2009 3:45:07 pm Ivan Voras wrote: >> But ciss doesn't reference it at all so either it deviously assumes it >> or is independent of it. > > Actually, it may be much worse, it may be that the author of ciss(4) new that > ciss(4)'s largest supported I/O size was larger than 128k so they didn't > bother handling the limit at all giving the false impression the hardware has > no limit. In cases of ATA and CAM infrastructures it was is so, that if driver does not sets max_iosize or maxio respectively, it uses DFLTPHYS. So problem is only about non-ATA/CAM RAIDs or cases where wrong value could be specified explicitly. ciss(4) driver was explicitly limited to 64K, until somebody could review it's capabilities. -- Alexander Motin From mav at FreeBSD.org Sat Sep 5 06:24:30 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Sat Sep 5 06:24:42 2009 Subject: svn commit: r196854 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/ahci dev/xen/xenpci Message-ID: <200909050624.n856OTob039344@svn.freebsd.org> Author: mav Date: Sat Sep 5 06:24:28 2009 New Revision: 196854 URL: http://svn.freebsd.org/changeset/base/196854 Log: MFC r196777, r196796: ATI SB600 can't handle 256 sectors transfers with FPDMA (NCQ). Approved by: re (ATA-CAM blanket) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/ahci/ahci.c stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Sat Sep 5 05:57:44 2009 (r196853) +++ stable/8/sys/dev/ahci/ahci.c Sat Sep 5 06:24:28 2009 (r196854) @@ -1942,6 +1942,9 @@ ahciaction(struct cam_sim *sim, union cc cpi->protocol = PROTO_ATA; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->maxio = MAXPHYS; + /* ATI SB600 can't handle 256 sectors with FPDMA (NCQ). */ + if (pci_get_devid(device_get_parent(dev)) == 0x43801002) + cpi->maxio = min(cpi->maxio, 128 * 512); cpi->ccb_h.status = CAM_REQ_CMP; xpt_done(ccb); break; From imp at FreeBSD.org Sat Sep 5 08:03:29 2009 From: imp at FreeBSD.org (Warner Losh) Date: Sat Sep 5 08:03:45 2009 Subject: svn commit: r196855 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci kern Message-ID: <200909050803.n8583TOM041317@svn.freebsd.org> Author: imp Date: Sat Sep 5 08:03:29 2009 New Revision: 196855 URL: http://svn.freebsd.org/changeset/base/196855 Log: MFC r196529: Rather than having enabled/disabled, implement a max queue depth. While usually not an issue, this firewalls bugs in the code that may run us out of memory. Fix a memory exhaustion in the case where devctl was disabled, but the link was bouncing. The check to queue was in the wrong place. Implement a new sysctl hw.bus.devctl_queue to control the depth. Make compatibility hacks for hw.bus.devctl_disable to ease transition. Reviewed by: emaste@ Approved by: re@ (kib) MFC after: asap Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/kern/subr_bus.c Modified: stable/8/sys/kern/subr_bus.c ============================================================================== --- stable/8/sys/kern/subr_bus.c Sat Sep 5 06:24:28 2009 (r196854) +++ stable/8/sys/kern/subr_bus.c Sat Sep 5 08:03:29 2009 (r196855) @@ -350,11 +350,18 @@ device_sysctl_fini(device_t dev) * tested since 3.4 or 2.2.8! */ +/* Deprecated way to adjust queue length */ static int sysctl_devctl_disable(SYSCTL_HANDLER_ARGS); -static int devctl_disable = 0; -TUNABLE_INT("hw.bus.devctl_disable", &devctl_disable); +/* XXX Need to support old-style tunable hw.bus.devctl_disable" */ SYSCTL_PROC(_hw_bus, OID_AUTO, devctl_disable, CTLTYPE_INT | CTLFLAG_RW, NULL, - 0, sysctl_devctl_disable, "I", "devctl disable"); + 0, sysctl_devctl_disable, "I", "devctl disable -- deprecated"); + +#define DEVCTL_DEFAULT_QUEUE_LEN 1000 +static int sysctl_devctl_queue(SYSCTL_HANDLER_ARGS); +static int devctl_queue_length = DEVCTL_DEFAULT_QUEUE_LEN; +TUNABLE_INT("hw.bus.devctl_queue", &devctl_queue_length); +SYSCTL_PROC(_hw_bus, OID_AUTO, devctl_queue, CTLTYPE_INT | CTLFLAG_RW, NULL, + 0, sysctl_devctl_queue, "I", "devctl queue length"); static d_open_t devopen; static d_close_t devclose; @@ -385,6 +392,7 @@ static struct dev_softc { int inuse; int nonblock; + int queued; struct mtx mtx; struct cv cv; struct selinfo sel; @@ -423,7 +431,7 @@ devclose(struct cdev *dev, int fflag, in mtx_lock(&devsoftc.mtx); cv_broadcast(&devsoftc.cv); mtx_unlock(&devsoftc.mtx); - + devsoftc.async_proc = NULL; return (0); } @@ -458,6 +466,7 @@ devread(struct cdev *dev, struct uio *ui } n1 = TAILQ_FIRST(&devsoftc.devq); TAILQ_REMOVE(&devsoftc.devq, n1, dei_link); + devsoftc.queued--; mtx_unlock(&devsoftc.mtx); rv = uiomove(n1->dei_data, strlen(n1->dei_data), uio); free(n1->dei_data, M_BUS); @@ -531,21 +540,33 @@ devctl_process_running(void) void devctl_queue_data(char *data) { - struct dev_event_info *n1 = NULL; + struct dev_event_info *n1 = NULL, *n2 = NULL; struct proc *p; - /* - * Do not allow empty strings to be queued, as they - * cause devd to exit prematurely. - */ if (strlen(data) == 0) return; + if (devctl_queue_length == 0) + return; n1 = malloc(sizeof(*n1), M_BUS, M_NOWAIT); if (n1 == NULL) return; n1->dei_data = data; mtx_lock(&devsoftc.mtx); + if (devctl_queue_length == 0) { + free(n1->dei_data, M_BUS); + free(n1, M_BUS); + return; + } + /* Leave at least one spot in the queue... */ + while (devsoftc.queued > devctl_queue_length - 1) { + n2 = TAILQ_FIRST(&devsoftc.devq); + TAILQ_REMOVE(&devsoftc.devq, n2, dei_link); + free(n2->dei_data, M_BUS); + free(n2, M_BUS); + devsoftc.queued--; + } TAILQ_INSERT_TAIL(&devsoftc.devq, n1, dei_link); + devsoftc.queued++; cv_broadcast(&devsoftc.cv); mtx_unlock(&devsoftc.mtx); selwakeup(&devsoftc.sel); @@ -614,7 +635,7 @@ devaddq(const char *type, const char *wh char *pnp = NULL; const char *parstr; - if (devctl_disable) + if (!devctl_queue_length)/* Rare race, but lost races safely discard */ return; data = malloc(1024, M_BUS, M_NOWAIT); if (data == NULL) @@ -731,12 +752,11 @@ sysctl_devctl_disable(SYSCTL_HANDLER_ARG struct dev_event_info *n1; int dis, error; - dis = devctl_disable; + dis = devctl_queue_length == 0; error = sysctl_handle_int(oidp, &dis, 0, req); if (error || !req->newptr) return (error); mtx_lock(&devsoftc.mtx); - devctl_disable = dis; if (dis) { while (!TAILQ_EMPTY(&devsoftc.devq)) { n1 = TAILQ_FIRST(&devsoftc.devq); @@ -744,6 +764,35 @@ sysctl_devctl_disable(SYSCTL_HANDLER_ARG free(n1->dei_data, M_BUS); free(n1, M_BUS); } + devsoftc.queued = 0; + devctl_queue_length = 0; + } else { + devctl_queue_length = DEVCTL_DEFAULT_QUEUE_LEN; + } + mtx_unlock(&devsoftc.mtx); + return (0); +} + +static int +sysctl_devctl_queue(SYSCTL_HANDLER_ARGS) +{ + struct dev_event_info *n1; + int q, error; + + q = devctl_queue_length; + error = sysctl_handle_int(oidp, &q, 0, req); + if (error || !req->newptr) + return (error); + if (q < 0) + return (EINVAL); + mtx_lock(&devsoftc.mtx); + devctl_queue_length = q; + while (devsoftc.queued > devctl_queue_length) { + n1 = TAILQ_FIRST(&devsoftc.devq); + TAILQ_REMOVE(&devsoftc.devq, n1, dei_link); + free(n1->dei_data, M_BUS); + free(n1, M_BUS); + devsoftc.queued--; } mtx_unlock(&devsoftc.mtx); return (0); @@ -886,7 +935,7 @@ devclass_find_internal(const char *class if (create && !dc) { PDEBUG(("creating %s", classname)); dc = malloc(sizeof(struct devclass) + strlen(classname) + 1, - M_BUS, M_NOWAIT|M_ZERO); + M_BUS, M_NOWAIT | M_ZERO); if (!dc) return (NULL); dc->parent = NULL; From imp at FreeBSD.org Sat Sep 5 08:08:14 2009 From: imp at FreeBSD.org (Warner Losh) Date: Sat Sep 5 08:08:20 2009 Subject: svn commit: r196856 - head Message-ID: <200909050808.n8588EEO041434@svn.freebsd.org> Author: imp Date: Sat Sep 5 08:08:14 2009 New Revision: 196856 URL: http://svn.freebsd.org/changeset/base/196856 Log: Note migration of tunable from hw.bus.devctl_disable to hw.bus.devctl_queue. The sysctl interface provides legacys upport for the latter sysctl, but the tunable support was removed. MFC after: 1 day Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Sat Sep 5 08:03:29 2009 (r196855) +++ head/UPDATING Sat Sep 5 08:08:14 2009 (r196856) @@ -22,6 +22,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9. machines to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20090825: + The old tunable hw.bus.devctl_disable has been superseded by + hw.bus.devctl_queue. hw.bus.devctl_disable=1 in loader.conf should be + replaced by hw.bus.devctl_queue=0. The default for this new tunable + is 1000. + 20090813: Remove the option STOP_NMI. The default action is now to use NMI only for KDB via the newly introduced function stop_cpus_hard() and From imp at FreeBSD.org Sat Sep 5 08:09:36 2009 From: imp at FreeBSD.org (Warner Losh) Date: Sat Sep 5 08:09:47 2009 Subject: svn commit: r196857 - head Message-ID: <200909050809.n8589a9o041494@svn.freebsd.org> Author: imp Date: Sat Sep 5 08:09:35 2009 New Revision: 196857 URL: http://svn.freebsd.org/changeset/base/196857 Log: Go ahead and mention the CVS branch name as well as the svn branch name. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Sat Sep 5 08:08:14 2009 (r196856) +++ head/UPDATING Sat Sep 5 08:09:35 2009 (r196857) @@ -34,7 +34,8 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9. maintain stop_cpus() to just use a normal IPI_STOP on ia32 and amd64. 20090803: - stable/8 branch created in subversion. + The stable/8 branch created in subversion. This corresponds to the + RELENG_8 branch in CVS. 20090719: Bump the shared library version numbers for all libraries that do not From imp at FreeBSD.org Sat Sep 5 08:38:25 2009 From: imp at FreeBSD.org (Warner Losh) Date: Sat Sep 5 08:38:31 2009 Subject: svn commit: r196858 - head/sys/dev/rp Message-ID: <200909050838.n858cP6f042100@svn.freebsd.org> Author: imp Date: Sat Sep 5 08:38:25 2009 New Revision: 196858 URL: http://svn.freebsd.org/changeset/base/196858 Log: These checks against BUSY aren't needed: the newbus layer does this already with the appropriate locks held... There's no need to do it here, so just delete the checks. Modified: head/sys/dev/rp/rp_pci.c Modified: head/sys/dev/rp/rp_pci.c ============================================================================== --- head/sys/dev/rp/rp_pci.c Sat Sep 5 08:09:35 2009 (r196857) +++ head/sys/dev/rp/rp_pci.c Sat Sep 5 08:38:25 2009 (r196858) @@ -225,11 +225,7 @@ rp_pcidetach(device_t dev) { CONTROLLER_t *ctlp; - if (device_get_state(dev) == DS_BUSY) - return (EBUSY); - ctlp = device_get_softc(dev); - rp_pcireleaseresource(ctlp); return (0); @@ -240,11 +236,7 @@ rp_pcishutdown(device_t dev) { CONTROLLER_t *ctlp; - if (device_get_state(dev) == DS_BUSY) - return (EBUSY); - ctlp = device_get_softc(dev); - rp_pcireleaseresource(ctlp); return (0); From pjd at FreeBSD.org Sat Sep 5 11:07:46 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Sat Sep 5 11:07:53 2009 Subject: svn commit: r196797 - in head: sys/net sys/netinet usr.bin/netstat In-Reply-To: <20090904171511.Q68375@maildrop.int.zabbadoz.net> References: <200909032110.n83LAvUF044731@svn.freebsd.org> <4AA09B41.3040103@incunabulum.net> <3C6607F2-D517-41EC-8681-33236EC6D20F@FreeBSD.org> <20090904171511.Q68375@maildrop.int.zabbadoz.net> Message-ID: <20090905110740.GD1665@garage.freebsd.pl> On Fri, Sep 04, 2009 at 05:19:12PM +0000, Bjoern A. Zeeb wrote: > On Fri, 4 Sep 2009, George Neville-Neil wrote: > > Hi, > > >On Sep 4, 2009, at 00:44 , Bruce Simpson wrote: > > > >>George V. Neville-Neil wrote: > >>>Author: gnn > >>>Date: Thu Sep 3 21:10:57 2009 > >>>New Revision: 196797 > >>>URL: http://svn.freebsd.org/changeset/base/196797 > >>> > >>>Log: > >>>Add ARP statistics to the kernel and netstat. > >>> > >> > >>Thanks very much for this change. > >>Any chance this struct can get explicitly versioned (i.e. as for struct > >>igmpstat) as it is a new struct? > >> > > > >bz@ and I will likely be tweaking this over time, so we can probably do > >that. > > I am not entirely sure what "versioning" that struct would help? > > ARP is from the early 80s, we've got 8 variables and 4 spares and > I cannot forsee any major rewrite of the code or the protocoll to > gather a lot more stats anymore. If there is a way to version those structures it will be good to do it even if it isn't going to change in the future. This way it can be used as an example for others to follow. -- Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 187 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090905/2831f102/attachment.pgp From kib at FreeBSD.org Sat Sep 5 13:10:55 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sat Sep 5 13:11:12 2009 Subject: svn commit: r196859 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci fs/pseudofs Message-ID: <200909051310.n85DAskt053768@svn.freebsd.org> Author: kib Date: Sat Sep 5 13:10:54 2009 New Revision: 196859 URL: http://svn.freebsd.org/changeset/base/196859 Log: MFC r196689: Remove spurious pfs_unlock(). Approved by: re (rwatson) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/fs/pseudofs/pseudofs_vnops.c Modified: stable/8/sys/fs/pseudofs/pseudofs_vnops.c ============================================================================== --- stable/8/sys/fs/pseudofs/pseudofs_vnops.c Sat Sep 5 08:38:25 2009 (r196858) +++ stable/8/sys/fs/pseudofs/pseudofs_vnops.c Sat Sep 5 13:10:54 2009 (r196859) @@ -339,7 +339,6 @@ pfs_getextattr(struct vop_getextattr_arg if (proc != NULL) PROC_UNLOCK(proc); - pfs_unlock(pn); PFS_RETURN (error); } From kib at FreeBSD.org Sat Sep 5 13:31:16 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sat Sep 5 13:31:22 2009 Subject: svn commit: r196860 - in stable/7/sys: . contrib/pf fs/pseudofs Message-ID: <200909051331.n85DVGPb054244@svn.freebsd.org> Author: kib Date: Sat Sep 5 13:31:16 2009 New Revision: 196860 URL: http://svn.freebsd.org/changeset/base/196860 Log: MFC r196689: Remove spurious pfs_unlock(). Approved by: re (rwatson) Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/fs/pseudofs/pseudofs_vnops.c Modified: stable/7/sys/fs/pseudofs/pseudofs_vnops.c ============================================================================== --- stable/7/sys/fs/pseudofs/pseudofs_vnops.c Sat Sep 5 13:10:54 2009 (r196859) +++ stable/7/sys/fs/pseudofs/pseudofs_vnops.c Sat Sep 5 13:31:16 2009 (r196860) @@ -339,7 +339,6 @@ pfs_getextattr(struct vop_getextattr_arg if (proc != NULL) PROC_UNLOCK(proc); - pfs_unlock(pn); PFS_RETURN (error); } From kib at FreeBSD.org Sat Sep 5 13:32:05 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sat Sep 5 13:32:16 2009 Subject: svn commit: r196861 - head/lib/libc/stdlib Message-ID: <200909051332.n85DW5Q1054296@svn.freebsd.org> Author: kib Date: Sat Sep 5 13:32:05 2009 New Revision: 196861 URL: http://svn.freebsd.org/changeset/base/196861 Log: Handle zero size for posix_memalign. Return NULL or unique address according to the 'V' option. PR: standards/138307 MFC after: 1 week Modified: head/lib/libc/stdlib/malloc.c Modified: head/lib/libc/stdlib/malloc.c ============================================================================== --- head/lib/libc/stdlib/malloc.c Sat Sep 5 13:31:16 2009 (r196860) +++ head/lib/libc/stdlib/malloc.c Sat Sep 5 13:32:05 2009 (r196861) @@ -5320,6 +5320,15 @@ posix_memalign(void **memptr, size_t ali goto RETURN; } + if (size == 0) { + if (opt_sysv == false) + size = 1; + else { + result = NULL; + ret = 0; + goto RETURN; + } + } result = ipalloc(alignment, size); } From trasz at FreeBSD.org Sat Sep 5 15:01:57 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Sat Sep 5 15:02:04 2009 Subject: svn commit: r196862 - in stable/8/lib/libc: . posix1e stdio stdtime string Message-ID: <200909051501.n85F1upm056564@svn.freebsd.org> Author: trasz Date: Sat Sep 5 15:01:56 2009 New Revision: 196862 URL: http://svn.freebsd.org/changeset/base/196862 Log: MFC r196740: Fix regression introduced with NFSv4 ACL support - make acl_to_text(3) and acl_calc_mask(3) return error instead of crashing when acl passed to them is NULL. Submitted by: markus Reviewed by: rwatson Approved by: re (kib) Modified: stable/8/lib/libc/ (props changed) stable/8/lib/libc/posix1e/acl_calc_mask.c stable/8/lib/libc/posix1e/acl_to_text.c stable/8/lib/libc/stdio/asprintf.c (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/lib/libc/string/ffsll.c (props changed) stable/8/lib/libc/string/flsll.c (props changed) stable/8/lib/libc/string/wcpcpy.c (props changed) stable/8/lib/libc/string/wcpncpy.c (props changed) Modified: stable/8/lib/libc/posix1e/acl_calc_mask.c ============================================================================== --- stable/8/lib/libc/posix1e/acl_calc_mask.c Sat Sep 5 13:32:05 2009 (r196861) +++ stable/8/lib/libc/posix1e/acl_calc_mask.c Sat Sep 5 15:01:56 2009 (r196862) @@ -50,12 +50,6 @@ acl_calc_mask(acl_t *acl_p) acl_t acl_new; int i, mask_mode, mask_num; - if (!_acl_brand_may_be(*acl_p, ACL_BRAND_POSIX)) { - errno = EINVAL; - return (-1); - } - _acl_brand_as(*acl_p, ACL_BRAND_POSIX); - /* * (23.4.2.4) requires acl_p to point to a pointer to a valid ACL. * Since one of the primary reasons to use this function would be @@ -67,6 +61,13 @@ acl_calc_mask(acl_t *acl_p) errno = EINVAL; return (-1); } + + if (!_acl_brand_may_be(*acl_p, ACL_BRAND_POSIX)) { + errno = EINVAL; + return (-1); + } + _acl_brand_as(*acl_p, ACL_BRAND_POSIX); + acl_int = &(*acl_p)->ats_acl; if ((acl_int->acl_cnt < 3) || (acl_int->acl_cnt > ACL_MAX_ENTRIES)) { errno = EINVAL; Modified: stable/8/lib/libc/posix1e/acl_to_text.c ============================================================================== --- stable/8/lib/libc/posix1e/acl_to_text.c Sat Sep 5 13:32:05 2009 (r196861) +++ stable/8/lib/libc/posix1e/acl_to_text.c Sat Sep 5 15:01:56 2009 (r196862) @@ -70,11 +70,6 @@ _posix1e_acl_to_text(acl_t acl, ssize_t if (buf == NULL) return(NULL); - if (acl == NULL) { - errno = EINVAL; - return(NULL); - } - acl_int = &acl->ats_acl; mask_perm = ACL_PERM_BITS; /* effective is regular if no mask */ @@ -243,6 +238,11 @@ char * acl_to_text_np(acl_t acl, ssize_t *len_p, int flags) { + if (acl == NULL) { + errno = EINVAL; + return(NULL); + } + switch (_acl_brand(acl)) { case ACL_BRAND_POSIX: return (_posix1e_acl_to_text(acl, len_p, flags)); From trasz at FreeBSD.org Sat Sep 5 15:08:59 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Sat Sep 5 15:09:10 2009 Subject: svn commit: r196863 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200909051508.n85F8xnN056719@svn.freebsd.org> Author: trasz Date: Sat Sep 5 15:08:58 2009 New Revision: 196863 URL: http://svn.freebsd.org/changeset/base/196863 Log: Improve wording. Discussed with: pjd, cperciva, rink, wkoszek and des, in order of appearance. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Sep 5 15:01:56 2009 (r196862) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Sep 5 15:08:58 2009 (r196863) @@ -3557,15 +3557,19 @@ arc_init(void) #ifdef __i386__ if (prefetch_tunable_set == 0) { - printf("ZFS NOTICE: prefetch is disabled by default on i386" - " - add enable to tunable to change.\n" ); + printf("ZFS NOTICE: Prefetch is disabled by default on i386 " + "-- to enable,\n"); + printf(" add \"vfs.zfs.prefetch_disable=0\" " + "to /boot/loader.conf.\n"); zfs_prefetch_disable=1; } #else if ((((uint64_t)physmem * PAGESIZE) < (1ULL << 32)) && prefetch_tunable_set == 0) { - printf("ZFS NOTICE: system has less than 4GB and prefetch enable is not set" - "... disabling.\n"); + printf("ZFS NOTICE: Prefetch is disabled by default if less " + "than 4 GB of RAM is present;\n" + " to enable, add \"vfs.zfs.prefetch_disable=0\" " + "to /boot/loader.conf.\n"); zfs_prefetch_disable=1; } #endif From qingli at FreeBSD.org Sat Sep 5 16:43:17 2009 From: qingli at FreeBSD.org (Qing Li) Date: Sat Sep 5 16:43:23 2009 Subject: svn commit: r196864 - in head/sys: net netinet6 Message-ID: <200909051643.n85GhHkJ058525@svn.freebsd.org> Author: qingli Date: Sat Sep 5 16:43:16 2009 New Revision: 196864 URL: http://svn.freebsd.org/changeset/base/196864 Log: This patch fixes the following issues: - Interface link-local address is not reachable within the node that owns the interface, this is due to the mismatch in address scope as the result of the installed interface address loopback route. Therefore for each interface address loopback route, the rt_gateway field (of AF_LINK type) will be used to track which interface a given address belongs to. This will aid the address source to use the proper interface for address scope/zone validation. - The loopback address is not reachable. The root cause is the same as the above. - Empty nd6 entries are created for the IPv6 loopback addresses only for validation reason. Doing so will eliminate as much of the special case (loopback addresses) handling code as possible, however, these empty nd6 entries should not be returned to the userland applications such as the "ndp" command. Since both of the above issues contain common files, these files are committed together. Reviewed by: bz MFC after: immediately Modified: head/sys/net/if_llatbl.c head/sys/netinet6/in6.c head/sys/netinet6/in6_src.c head/sys/netinet6/ip6_output.c Modified: head/sys/net/if_llatbl.c ============================================================================== --- head/sys/net/if_llatbl.c Sat Sep 5 15:08:58 2009 (r196863) +++ head/sys/net/if_llatbl.c Sat Sep 5 16:43:16 2009 (r196864) @@ -263,6 +263,15 @@ lla_rt_output(struct rt_msghdr *rtm, str __func__, dl->sdl_index); return EINVAL; } + if (ifp->if_flags & IFF_LOOPBACK) { + struct ifaddr *ia; + ia = ifa_ifwithaddr(dst); + if (ia != NULL) { + ifp = ia->ifa_ifp; + ifa_free(ia); + } else + return EINVAL; + } switch (rtm->rtm_type) { case RTM_ADD: Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Sat Sep 5 15:08:58 2009 (r196863) +++ head/sys/netinet6/in6.c Sat Sep 5 16:43:16 2009 (r196864) @@ -1201,8 +1201,8 @@ in6_purgeaddr(struct ifaddr *ifa) bzero(&null_sdl, sizeof(null_sdl)); null_sdl.sdl_len = sizeof(null_sdl); null_sdl.sdl_family = AF_LINK; - null_sdl.sdl_type = V_loif->if_type; - null_sdl.sdl_index = V_loif->if_index; + null_sdl.sdl_type = ia->ia_ifp->if_type; + null_sdl.sdl_index = ia->ia_ifp->if_index; bzero(&info, sizeof(info)); info.rti_flags = ia->ia_flags | RTF_HOST | RTF_STATIC; info.rti_info[RTAX_DST] = (struct sockaddr *)&ia->ia_addr; @@ -1782,9 +1782,9 @@ in6_ifinit(struct ifnet *ifp, struct in6 if (error == 0 && rt != NULL) { RT_LOCK(rt); ((struct sockaddr_dl *)rt->rt_gateway)->sdl_type = - rt->rt_ifp->if_type; + ifp->if_type; ((struct sockaddr_dl *)rt->rt_gateway)->sdl_index = - rt->rt_ifp->if_index; + ifp->if_index; RT_REMREF(rt); RT_UNLOCK(rt); } else if (error != 0) @@ -2495,6 +2495,9 @@ in6_lltable_dump(struct lltable *llt, st } ndpc; int i, error; + if (ifp->if_flags & IFF_LOOPBACK) + return 0; + LLTABLE_LOCK_ASSERT(); error = 0; Modified: head/sys/netinet6/in6_src.c ============================================================================== --- head/sys/netinet6/in6_src.c Sat Sep 5 15:08:58 2009 (r196863) +++ head/sys/netinet6/in6_src.c Sat Sep 5 16:43:16 2009 (r196864) @@ -85,6 +85,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #ifdef RADIX_MPATH @@ -697,8 +698,25 @@ selectroute(struct sockaddr_in6 *dstsock if (error == EHOSTUNREACH) V_ip6stat.ip6s_noroute++; - if (retifp != NULL) + if (retifp != NULL) { *retifp = ifp; + + /* + * Adjust the "outgoing" interface. If we're going to loop + * the packet back to ourselves, the ifp would be the loopback + * interface. However, we'd rather know the interface associated + * to the destination address (which should probably be one of + * our own addresses.) + */ + if (rt) { + if ((rt->rt_ifp->if_flags & IFF_LOOPBACK) && + (rt->rt_gateway->sa_family == AF_LINK)) + *retifp = + ifnet_byindex(((struct sockaddr_dl *) + rt->rt_gateway)->sdl_index); + } + } + if (retrt != NULL) *retrt = rt; /* rt may be NULL */ @@ -750,16 +768,6 @@ in6_selectif(struct sockaddr_in6 *dstsoc return (flags); } - /* - * Adjust the "outgoing" interface. If we're going to loop the packet - * back to ourselves, the ifp would be the loopback interface. - * However, we'd rather know the interface associated to the - * destination address (which should probably be one of our own - * addresses.) - */ - if (rt && rt->rt_ifa && rt->rt_ifa->ifa_ifp) - *retifp = rt->rt_ifa->ifa_ifp; - if (ro == &sro && rt && rt == sro.ro_rt) RTFREE(rt); return (0); Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Sat Sep 5 15:08:58 2009 (r196863) +++ head/sys/netinet6/ip6_output.c Sat Sep 5 16:43:16 2009 (r196864) @@ -602,15 +602,12 @@ again: rt->rt_use++; } + /* * The outgoing interface must be in the zone of source and - * destination addresses. We should use ia_ifp to support the - * case of sending packets to an address of our own. + * destination addresses. */ - if (ia != NULL && ia->ia_ifp) - origifp = ia->ia_ifp; - else - origifp = ifp; + origifp = ifp; src0 = ip6->ip6_src; if (in6_setscope(&src0, origifp, &zone)) @@ -634,6 +631,12 @@ again: goto badscope; } + /* We should use ia_ifp to support the case of + * sending packets to an address of our own. + */ + if (ia != NULL && ia->ia_ifp) + ifp = ia->ia_ifp; + /* scope check is done. */ goto routefound; From qingli at FreeBSD.org Sat Sep 5 16:50:56 2009 From: qingli at FreeBSD.org (Qing Li) Date: Sat Sep 5 16:51:07 2009 Subject: svn commit: r196865 - head/sys/netinet6 Message-ID: <200909051650.n85GotlE058713@svn.freebsd.org> Author: qingli Date: Sat Sep 5 16:50:55 2009 New Revision: 196865 URL: http://svn.freebsd.org/changeset/base/196865 Log: This patch fixes an address scope violation. Considering the scenario where an anycast address is assigned on one interface, and a global address with the same scope is assigned on another interface. In other words, the interface owns the anycast address has only the link-local address as one other address. Without this patch, "ping6" the anycast address from another station will observe the source address of the returned ICMP6 echo reply has the link-local address, not the global address that exists on the other interface in the same node. Reviewed by: bz MFC after: immediately Modified: head/sys/netinet6/icmp6.c Modified: head/sys/netinet6/icmp6.c ============================================================================== --- head/sys/netinet6/icmp6.c Sat Sep 5 16:43:16 2009 (r196864) +++ head/sys/netinet6/icmp6.c Sat Sep 5 16:50:55 2009 (r196865) @@ -2170,6 +2170,10 @@ icmp6_reflect(struct mbuf *m, size_t off } } + if ((srcp != NULL) && + (in6_addrscope(srcp) != in6_addrscope(&ip6->ip6_src))) + srcp = NULL; + if (srcp == NULL) { int e; struct sockaddr_in6 sin6; From bz at FreeBSD.org Sat Sep 5 16:51:51 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Sat Sep 5 16:51:57 2009 Subject: svn commit: r196866 - head/usr.sbin/ndp Message-ID: <200909051651.n85GppUJ058766@svn.freebsd.org> Author: bz Date: Sat Sep 5 16:51:51 2009 New Revision: 196866 URL: http://svn.freebsd.org/changeset/base/196866 Log: In the NEXTADDR macro use SA_SIZE() rather than directly using sizeof(), as introduced in r186119, for advancing the current position into the buffer. See comment in net/route.h for a description of the difference. This makes ndp -s work again. Reviewed by: qingli X-MFC after: now Modified: head/usr.sbin/ndp/ndp.c Modified: head/usr.sbin/ndp/ndp.c ============================================================================== --- head/usr.sbin/ndp/ndp.c Sat Sep 5 16:50:55 2009 (r196865) +++ head/usr.sbin/ndp/ndp.c Sat Sep 5 16:51:51 2009 (r196866) @@ -116,7 +116,7 @@ #define NEXTADDR(w, s) \ if (rtm->rtm_addrs & (w)) { \ - bcopy((char *)&s, cp, sizeof(s)); cp += sizeof(s);} + bcopy((char *)&s, cp, sizeof(s)); cp += SA_SIZE(&s);} static pid_t pid; From bz at FreeBSD.org Sat Sep 5 17:29:08 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Sat Sep 5 17:29:14 2009 Subject: svn commit: r196867 - stable/8/usr.sbin/ndp Message-ID: <200909051729.n85HT8lc059714@svn.freebsd.org> Author: bz Date: Sat Sep 5 17:29:08 2009 New Revision: 196867 URL: http://svn.freebsd.org/changeset/base/196867 Log: MFC r196866: In the NEXTADDR macro use SA_SIZE() rather than directly using sizeof(), as introduced in r186119, for advancing the current position into the buffer. See comment in net/route.h for a description of the difference. This makes ndp -s work again. Reviewed by: qingli Approved by: re (kib) Modified: stable/8/usr.sbin/ndp/ (props changed) stable/8/usr.sbin/ndp/ndp.c Modified: stable/8/usr.sbin/ndp/ndp.c ============================================================================== --- stable/8/usr.sbin/ndp/ndp.c Sat Sep 5 16:51:51 2009 (r196866) +++ stable/8/usr.sbin/ndp/ndp.c Sat Sep 5 17:29:08 2009 (r196867) @@ -116,7 +116,7 @@ #define NEXTADDR(w, s) \ if (rtm->rtm_addrs & (w)) { \ - bcopy((char *)&s, cp, sizeof(s)); cp += sizeof(s);} + bcopy((char *)&s, cp, sizeof(s)); cp += SA_SIZE(&s);} static pid_t pid; From qingli at FreeBSD.org Sat Sep 5 17:35:31 2009 From: qingli at FreeBSD.org (Qing Li) Date: Sat Sep 5 17:35:38 2009 Subject: svn commit: r196868 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci netinet6 Message-ID: <200909051735.n85HZVNd059893@svn.freebsd.org> Author: qingli Date: Sat Sep 5 17:35:31 2009 New Revision: 196868 URL: http://svn.freebsd.org/changeset/base/196868 Log: MFC r196865 This patch fixes an address scope violation. Considering the scenario where an anycast address is assigned on one interface, and a global address with the same scope is assigned on another interface. In other words, the interface owns the anycast address has only the link-local address as one other address. Without this patch, "ping6" the anycast address from another station will observe the source address of the returned ICMP6 echo reply has the link-local address, not the global address that exists on the other interface in the same node. Reviewed by: bz Approved by: re Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/netinet6/icmp6.c Modified: stable/8/sys/netinet6/icmp6.c ============================================================================== --- stable/8/sys/netinet6/icmp6.c Sat Sep 5 17:29:08 2009 (r196867) +++ stable/8/sys/netinet6/icmp6.c Sat Sep 5 17:35:31 2009 (r196868) @@ -2170,6 +2170,10 @@ icmp6_reflect(struct mbuf *m, size_t off } } + if ((srcp != NULL) && + (in6_addrscope(srcp) != in6_addrscope(&ip6->ip6_src))) + srcp = NULL; + if (srcp == NULL) { int e; struct sockaddr_in6 sin6; From qingli at FreeBSD.org Sat Sep 5 17:40:27 2009 From: qingli at FreeBSD.org (Qing Li) Date: Sat Sep 5 17:40:39 2009 Subject: svn commit: r196869 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci net netinet6 Message-ID: <200909051740.n85HeRV5060042@svn.freebsd.org> Author: qingli Date: Sat Sep 5 17:40:27 2009 New Revision: 196869 URL: http://svn.freebsd.org/changeset/base/196869 Log: MFC r196864 This patch fixes the following issues: - Interface link-local address is not reachable within the node that owns the interface, this is due to the mismatch in address scope as the result of the installed interface address loopback route. Therefore for each interface address loopback route, the rt_gateway field (of AF_LINK type) will be used to track which interface a given address belongs to. This will aid the address source to use the proper interface for address scope/zone validation. - The loopback address is not reachable. The root cause is the same as the above. - Empty nd6 entries are created for the IPv6 loopback addresses only for validation reason. Doing so will eliminate as much of the special case (loopback addresses) handling code as possible, however, these empty nd6 entries should not be returned to the userland applications such as the "ndp" command. Since both of the above issues contain common files, these files are committed together. Reviewed by: bz Approved by: re Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/net/if_llatbl.c stable/8/sys/netinet6/in6.c stable/8/sys/netinet6/in6_src.c stable/8/sys/netinet6/ip6_output.c Modified: stable/8/sys/net/if_llatbl.c ============================================================================== --- stable/8/sys/net/if_llatbl.c Sat Sep 5 17:35:31 2009 (r196868) +++ stable/8/sys/net/if_llatbl.c Sat Sep 5 17:40:27 2009 (r196869) @@ -263,6 +263,15 @@ lla_rt_output(struct rt_msghdr *rtm, str __func__, dl->sdl_index); return EINVAL; } + if (ifp->if_flags & IFF_LOOPBACK) { + struct ifaddr *ia; + ia = ifa_ifwithaddr(dst); + if (ia != NULL) { + ifp = ia->ifa_ifp; + ifa_free(ia); + } else + return EINVAL; + } switch (rtm->rtm_type) { case RTM_ADD: Modified: stable/8/sys/netinet6/in6.c ============================================================================== --- stable/8/sys/netinet6/in6.c Sat Sep 5 17:35:31 2009 (r196868) +++ stable/8/sys/netinet6/in6.c Sat Sep 5 17:40:27 2009 (r196869) @@ -1201,8 +1201,8 @@ in6_purgeaddr(struct ifaddr *ifa) bzero(&null_sdl, sizeof(null_sdl)); null_sdl.sdl_len = sizeof(null_sdl); null_sdl.sdl_family = AF_LINK; - null_sdl.sdl_type = V_loif->if_type; - null_sdl.sdl_index = V_loif->if_index; + null_sdl.sdl_type = ia->ia_ifp->if_type; + null_sdl.sdl_index = ia->ia_ifp->if_index; bzero(&info, sizeof(info)); info.rti_flags = ia->ia_flags | RTF_HOST | RTF_STATIC; info.rti_info[RTAX_DST] = (struct sockaddr *)&ia->ia_addr; @@ -1782,9 +1782,9 @@ in6_ifinit(struct ifnet *ifp, struct in6 if (error == 0 && rt != NULL) { RT_LOCK(rt); ((struct sockaddr_dl *)rt->rt_gateway)->sdl_type = - rt->rt_ifp->if_type; + ifp->if_type; ((struct sockaddr_dl *)rt->rt_gateway)->sdl_index = - rt->rt_ifp->if_index; + ifp->if_index; RT_REMREF(rt); RT_UNLOCK(rt); } else if (error != 0) @@ -2495,6 +2495,9 @@ in6_lltable_dump(struct lltable *llt, st } ndpc; int i, error; + if (ifp->if_flags & IFF_LOOPBACK) + return 0; + LLTABLE_LOCK_ASSERT(); error = 0; Modified: stable/8/sys/netinet6/in6_src.c ============================================================================== --- stable/8/sys/netinet6/in6_src.c Sat Sep 5 17:35:31 2009 (r196868) +++ stable/8/sys/netinet6/in6_src.c Sat Sep 5 17:40:27 2009 (r196869) @@ -85,6 +85,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #ifdef RADIX_MPATH @@ -697,8 +698,25 @@ selectroute(struct sockaddr_in6 *dstsock if (error == EHOSTUNREACH) V_ip6stat.ip6s_noroute++; - if (retifp != NULL) + if (retifp != NULL) { *retifp = ifp; + + /* + * Adjust the "outgoing" interface. If we're going to loop + * the packet back to ourselves, the ifp would be the loopback + * interface. However, we'd rather know the interface associated + * to the destination address (which should probably be one of + * our own addresses.) + */ + if (rt) { + if ((rt->rt_ifp->if_flags & IFF_LOOPBACK) && + (rt->rt_gateway->sa_family == AF_LINK)) + *retifp = + ifnet_byindex(((struct sockaddr_dl *) + rt->rt_gateway)->sdl_index); + } + } + if (retrt != NULL) *retrt = rt; /* rt may be NULL */ @@ -750,16 +768,6 @@ in6_selectif(struct sockaddr_in6 *dstsoc return (flags); } - /* - * Adjust the "outgoing" interface. If we're going to loop the packet - * back to ourselves, the ifp would be the loopback interface. - * However, we'd rather know the interface associated to the - * destination address (which should probably be one of our own - * addresses.) - */ - if (rt && rt->rt_ifa && rt->rt_ifa->ifa_ifp) - *retifp = rt->rt_ifa->ifa_ifp; - if (ro == &sro && rt && rt == sro.ro_rt) RTFREE(rt); return (0); Modified: stable/8/sys/netinet6/ip6_output.c ============================================================================== --- stable/8/sys/netinet6/ip6_output.c Sat Sep 5 17:35:31 2009 (r196868) +++ stable/8/sys/netinet6/ip6_output.c Sat Sep 5 17:40:27 2009 (r196869) @@ -602,15 +602,12 @@ again: rt->rt_use++; } + /* * The outgoing interface must be in the zone of source and - * destination addresses. We should use ia_ifp to support the - * case of sending packets to an address of our own. + * destination addresses. */ - if (ia != NULL && ia->ia_ifp) - origifp = ia->ia_ifp; - else - origifp = ifp; + origifp = ifp; src0 = ip6->ip6_src; if (in6_setscope(&src0, origifp, &zone)) @@ -634,6 +631,12 @@ again: goto badscope; } + /* We should use ia_ifp to support the case of + * sending packets to an address of our own. + */ + if (ia != NULL && ia->ia_ifp) + ifp = ia->ia_ifp; + /* scope check is done. */ goto routefound; From rodrigc at FreeBSD.org Sat Sep 5 18:44:36 2009 From: rodrigc at FreeBSD.org (Craig Rodrigues) Date: Sat Sep 5 18:44:47 2009 Subject: svn commit: r196870 - stable/7/etc/rc.d Message-ID: <200909051844.n85IiaNs061373@svn.freebsd.org> Author: rodrigc Date: Sat Sep 5 18:44:36 2009 New Revision: 196870 URL: http://svn.freebsd.org/changeset/base/196870 Log: This set of MFC's brings savecore closer to the trunk version. Now, crashinfo will only be run if the following conditions are true: - savecore -C determines that a crash dump exists - crashinfo_enable="YES" MFC: 182460 Add the ability to run /usr/sbin/crashinfo on a new core dump automatically during boot. MFC: 180318 Remove the $DUMPDIR variable. It's redundant and the rest of the script uses $dumpdir directly. MFC: 180317 Make checking for the availability of core dumps work in the case that $dumpdev is not set to "AUTO". Modified: stable/7/etc/rc.d/savecore Modified: stable/7/etc/rc.d/savecore ============================================================================== --- stable/7/etc/rc.d/savecore Sat Sep 5 17:40:27 2009 (r196869) +++ stable/7/etc/rc.d/savecore Sat Sep 5 18:44:36 2009 (r196870) @@ -52,10 +52,25 @@ savecore_prestart() savecore_start() { + local dev + + case "${dumpdev}" in + [Aa][Uu][Tt][Oo]) + dev= + ;; + *) + dev="${dumpdev}" + ;; + esac + echo "Checking for core dump on ${dumpdev}..." - savecore ${savecore_flags} ${dumpdir} ${dumpdev} - if checkyesno crashinfo_enable; then - ${crashinfo_program} -d ${dumpdir} + if savecore -C "${dumpdir}" "${dev}" >/dev/null; then + savecore ${savecore_flags} ${dumpdir} ${dumpdev} + if checkyesno crashinfo_enable; then + ${crashinfo_program} -d ${dumpdir} + fi + else + [ -z "${rc_quiet}" ] && echo "No core dumps found" fi } From scottl at samsco.org Sat Sep 5 19:05:18 2009 From: scottl at samsco.org (Scott Long) Date: Sat Sep 5 19:05:34 2009 Subject: svn commit: r196777 - head/sys/dev/ahci In-Reply-To: <4AA20249.9000301@FreeBSD.org> References: <200909031237.n83CbIgk032551@svn.freebsd.org> <20090903114121.C20031@pooker.samsco.org> <9bbcef730909031245o7c380925sd29b2cc976c4d7dd@mail.gmail.com> <200909031602.01222.jhb@freebsd.org> <4AA20249.9000301@FreeBSD.org> Message-ID: On Sep 5, 2009, at 12:16 AM, Alexander Motin wrote: > John Baldwin wrote: >> On Thursday 03 September 2009 3:45:07 pm Ivan Voras wrote: >>> But ciss doesn't reference it at all so either it deviously >>> assumes it >>> or is independent of it. >> >> Actually, it may be much worse, it may be that the author of ciss >> (4) new that >> ciss(4)'s largest supported I/O size was larger than 128k so they >> didn't >> bother handling the limit at all giving the false impression the >> hardware has >> no limit. > > In cases of ATA and CAM infrastructures it was is so, that if driver > does not sets max_iosize or maxio respectively, it uses DFLTPHYS. So > problem is only about non-ATA/CAM RAIDs or cases where wrong value > could > be specified explicitly. > > ciss(4) driver was explicitly limited to 64K, until somebody could > review it's capabilities. > Right, but I don't want people blindly changing this in any of the CAM drivers without understanding what is going on. Also, there are plenty of non-CAM block drivers that haven't been audited very well yet, if at all. Scott From qingli at FreeBSD.org Sat Sep 5 20:24:38 2009 From: qingli at FreeBSD.org (Qing Li) Date: Sat Sep 5 20:24:49 2009 Subject: svn commit: r196871 - in head/sys: net netinet6 Message-ID: <200909052024.n85KOcuh063182@svn.freebsd.org> Author: qingli Date: Sat Sep 5 20:24:37 2009 New Revision: 196871 URL: http://svn.freebsd.org/changeset/base/196871 Log: The addresses that are assigned to the loopback interface should be part of the kernel routing table. Reviewed by: bz MFC after: immediately Modified: head/sys/net/if_llatbl.c head/sys/netinet6/in6.c Modified: head/sys/net/if_llatbl.c ============================================================================== --- head/sys/net/if_llatbl.c Sat Sep 5 18:44:36 2009 (r196870) +++ head/sys/net/if_llatbl.c Sat Sep 5 20:24:37 2009 (r196871) @@ -263,15 +263,6 @@ lla_rt_output(struct rt_msghdr *rtm, str __func__, dl->sdl_index); return EINVAL; } - if (ifp->if_flags & IFF_LOOPBACK) { - struct ifaddr *ia; - ia = ifa_ifwithaddr(dst); - if (ia != NULL) { - ifp = ia->ifa_ifp; - ifa_free(ia); - } else - return EINVAL; - } switch (rtm->rtm_type) { case RTM_ADD: Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Sat Sep 5 18:44:36 2009 (r196870) +++ head/sys/netinet6/in6.c Sat Sep 5 20:24:37 2009 (r196871) @@ -1192,9 +1192,10 @@ in6_purgeaddr(struct ifaddr *ifa) /* * Remove the loopback route to the interface address. - * The check for the current setting of "nd6_useloopback" is not needed. + * The check for the current setting of "nd6_useloopback" + * is not needed. */ - if (!(ia->ia_ifp->if_flags & IFF_LOOPBACK)) { + { struct rt_addrinfo info; struct sockaddr_dl null_sdl; @@ -1767,7 +1768,9 @@ in6_ifinit(struct ifnet *ifp, struct in6 /* * add a loopback route to self */ - if (V_nd6_useloopback && !(ifp->if_flags & IFF_LOOPBACK)) { + if (!(ia->ia_flags & IFA_ROUTE) + && (V_nd6_useloopback + || (ifp->if_flags & IFF_LOOPBACK))) { struct rt_addrinfo info; struct rtentry *rt = NULL; static struct sockaddr_dl null_sdl = {sizeof(null_sdl), AF_LINK}; @@ -1788,7 +1791,7 @@ in6_ifinit(struct ifnet *ifp, struct in6 RT_REMREF(rt); RT_UNLOCK(rt); } else if (error != 0) - log(LOG_INFO, "in6_ifinit: insertion failed\n"); + log(LOG_INFO, "in6_ifinit: error = %d, insertion failed\n", error); } /* Add ownaddr as loopback rtentry, if necessary (ex. on p2p link). */ From qingli at FreeBSD.org Sat Sep 5 20:35:19 2009 From: qingli at FreeBSD.org (Qing Li) Date: Sat Sep 5 20:35:26 2009 Subject: svn commit: r196872 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci net netinet6 Message-ID: <200909052035.n85KZIee063436@svn.freebsd.org> Author: qingli Date: Sat Sep 5 20:35:18 2009 New Revision: 196872 URL: http://svn.freebsd.org/changeset/base/196872 Log: MFC r196871 The addresses that are assigned to the loopback interface should be part of the kernel routing table. Reviewed by: bz Approved by: re Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/net/if_llatbl.c stable/8/sys/netinet6/in6.c Modified: stable/8/sys/net/if_llatbl.c ============================================================================== --- stable/8/sys/net/if_llatbl.c Sat Sep 5 20:24:37 2009 (r196871) +++ stable/8/sys/net/if_llatbl.c Sat Sep 5 20:35:18 2009 (r196872) @@ -263,15 +263,6 @@ lla_rt_output(struct rt_msghdr *rtm, str __func__, dl->sdl_index); return EINVAL; } - if (ifp->if_flags & IFF_LOOPBACK) { - struct ifaddr *ia; - ia = ifa_ifwithaddr(dst); - if (ia != NULL) { - ifp = ia->ifa_ifp; - ifa_free(ia); - } else - return EINVAL; - } switch (rtm->rtm_type) { case RTM_ADD: Modified: stable/8/sys/netinet6/in6.c ============================================================================== --- stable/8/sys/netinet6/in6.c Sat Sep 5 20:24:37 2009 (r196871) +++ stable/8/sys/netinet6/in6.c Sat Sep 5 20:35:18 2009 (r196872) @@ -1192,9 +1192,10 @@ in6_purgeaddr(struct ifaddr *ifa) /* * Remove the loopback route to the interface address. - * The check for the current setting of "nd6_useloopback" is not needed. + * The check for the current setting of "nd6_useloopback" + * is not needed. */ - if (!(ia->ia_ifp->if_flags & IFF_LOOPBACK)) { + { struct rt_addrinfo info; struct sockaddr_dl null_sdl; @@ -1767,7 +1768,9 @@ in6_ifinit(struct ifnet *ifp, struct in6 /* * add a loopback route to self */ - if (V_nd6_useloopback && !(ifp->if_flags & IFF_LOOPBACK)) { + if (!(ia->ia_flags & IFA_ROUTE) + && (V_nd6_useloopback + || (ifp->if_flags & IFF_LOOPBACK))) { struct rt_addrinfo info; struct rtentry *rt = NULL; static struct sockaddr_dl null_sdl = {sizeof(null_sdl), AF_LINK}; @@ -1788,7 +1791,7 @@ in6_ifinit(struct ifnet *ifp, struct in6 RT_REMREF(rt); RT_UNLOCK(rt); } else if (error != 0) - log(LOG_INFO, "in6_ifinit: insertion failed\n"); + log(LOG_INFO, "in6_ifinit: error = %d, insertion failed\n", error); } /* Add ownaddr as loopback rtentry, if necessary (ex. on p2p link). */ From bruce at cran.org.uk Sun Sep 6 03:47:06 2009 From: bruce at cran.org.uk (Bruce Cran) Date: Sun Sep 6 03:47:13 2009 Subject: svn commit: r195843 - in head: lib/libkvm sys/kern sys/sys In-Reply-To: <20090904221432.GC82231@lor.one-eyed-alien.net> References: <200907241503.n6OF3ATP013228@svn.freebsd.org> <20090829201228.00005860@unknown> <20090904221432.GC82231@lor.one-eyed-alien.net> Message-ID: <20090906044700.5208ba62@gluon.draftnet> On Fri, 4 Sep 2009 17:14:32 -0500 Brooks Davis wrote: > On Sat, Aug 29, 2009 at 08:12:28PM +0100, Bruce Cran wrote: > > On Fri, 24 Jul 2009 15:03:10 +0000 (UTC) > > Brooks Davis wrote: > > > > > Author: brooks > > > Date: Fri Jul 24 15:03:10 2009 > > > New Revision: 195843 > > > URL: http://svn.freebsd.org/changeset/base/195843 > > > > > > Log: > > > Revert the changes to struct kinfo_proc in r194498. Instead, > > > fill in up to 16 (KI_NGROUPS) values and steal a bit from > > > ki_cr_flags (all bits currently unused) to indicate overflow with > > > the new flag KI_CRF_GRP_OVERFLOW. > > > > > > This fixes procstat -s. > > > > > > Approved by: re (kib) > > > > Hi Brooks, > > > > This checkin appears to have broken crash dump support: the bcopy in > > kvm_proc.c crashes when running "ps -ax -M /var/crash/vmcore.x > > -N /boot/kernel/kernel", apparently because ucred.cr_groups isn't > > valid. Does it need converted using KVM_READ first? > > Sorry for the delay, I believe you are correct we need to use kvm_read > here instead of the bcopy. Do you still have a core handy you can > test a patch against? The following should do it. The patch has fixed the crash, and data is now returned too. -- Bruce From julian at FreeBSD.org Sun Sep 6 06:05:23 2009 From: julian at FreeBSD.org (Julian Elischer) Date: Sun Sep 6 06:05:30 2009 Subject: svn commit: r196876 - stable/8 Message-ID: <200909060605.n8665Npo074679@svn.freebsd.org> Author: julian Date: Sun Sep 6 06:05:23 2009 New Revision: 196876 URL: http://svn.freebsd.org/changeset/base/196876 Log: MFC of r196477 Don't delete copies of nthread_create(9) we find inthe filesystem. we now link it to kproc_create(9), it's new name. Approved by: re (kib) Modified: stable/8/ObsoleteFiles.inc Modified: stable/8/ObsoleteFiles.inc ============================================================================== --- stable/8/ObsoleteFiles.inc Sun Sep 6 01:03:19 2009 (r196875) +++ stable/8/ObsoleteFiles.inc Sun Sep 6 06:05:23 2009 (r196876) @@ -803,8 +803,6 @@ OLD_FILES+=rescue/bsdlabel OLD_FILES+=rescue/fdisk OLD_FILES+=rescue/gpt .endif -# 20071026: kthread(9)/kproc(9) API changes -OLD_FILES+=usr/share/man/man9/kthread_create.9.gz # 20071025: rc.d/nfslocking superceeded by rc.d/lockd and rc.d/statd OLD_FILES+=etc/rc.d/nfslocking # 20070930: rename of cached to nscd From pjd at FreeBSD.org Sun Sep 6 06:48:50 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Sun Sep 6 06:48:57 2009 Subject: svn commit: r196877 - head/sbin/geom/core Message-ID: <200909060648.n866mooB075520@svn.freebsd.org> Author: pjd Date: Sun Sep 6 06:48:50 2009 New Revision: 196877 URL: http://svn.freebsd.org/changeset/base/196877 Log: For any given subcommand allow to specify multi-line usage (separated by \n). Submitted by: Mel Flynn Modified: head/sbin/geom/core/geom.c Modified: head/sbin/geom/core/geom.c ============================================================================== --- head/sbin/geom/core/geom.c Sun Sep 6 06:05:23 2009 (r196876) +++ head/sbin/geom/core/geom.c Sun Sep 6 06:48:50 2009 (r196877) @@ -98,11 +98,21 @@ usage_command(struct g_command *cmd, con struct g_option *opt; unsigned i; - fprintf(stderr, "%s %s %s", prefix, comm, cmd->gc_name); if (cmd->gc_usage != NULL) { - fprintf(stderr, " %s\n", cmd->gc_usage); + char *pos, *ptr, *sptr; + + sptr = ptr = strdup(cmd->gc_usage); + while ((pos = strsep(&ptr, "\n")) != NULL) { + if (*pos == '\0') + continue; + fprintf(stderr, "%s %s %s %s\n", prefix, comm, + cmd->gc_name, pos); + } + free(sptr); return; } + + fprintf(stderr, "%s %s %s", prefix, comm, cmd->gc_name); if ((cmd->gc_flags & G_FLAG_VERBOSE) != 0) fprintf(stderr, " [-v]"); for (i = 0; ; i++) { From pjd at FreeBSD.org Sun Sep 6 06:49:59 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Sun Sep 6 06:50:05 2009 Subject: svn commit: r196878 - head/sbin/geom/core Message-ID: <200909060649.n866nxFC075586@svn.freebsd.org> Author: pjd Date: Sun Sep 6 06:49:59 2009 New Revision: 196878 URL: http://svn.freebsd.org/changeset/base/196878 Log: Update copyright years. Modified: head/sbin/geom/core/geom.c Modified: head/sbin/geom/core/geom.c ============================================================================== --- head/sbin/geom/core/geom.c Sun Sep 6 06:48:50 2009 (r196877) +++ head/sbin/geom/core/geom.c Sun Sep 6 06:49:59 2009 (r196878) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2004-2005 Pawel Jakub Dawidek + * Copyright (c) 2004-2009 Pawel Jakub Dawidek * All rights reserved. * * Redistribution and use in source and binary forms, with or without From pjd at FreeBSD.org Sun Sep 6 06:52:07 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Sun Sep 6 06:52:14 2009 Subject: svn commit: r196879 - in head: sbin/geom/class/mirror sys/geom/mirror Message-ID: <200909060652.n866q71p075664@svn.freebsd.org> Author: pjd Date: Sun Sep 6 06:52:06 2009 New Revision: 196879 URL: http://svn.freebsd.org/changeset/base/196879 Log: Add support for changing providers priority. Submitted by: Mel Flynn Modified: head/sbin/geom/class/mirror/geom_mirror.c head/sbin/geom/class/mirror/gmirror.8 head/sys/geom/mirror/g_mirror_ctl.c Modified: head/sbin/geom/class/mirror/geom_mirror.c ============================================================================== --- head/sbin/geom/class/mirror/geom_mirror.c Sun Sep 6 06:49:59 2009 (r196878) +++ head/sbin/geom/class/mirror/geom_mirror.c Sun Sep 6 06:52:06 2009 (r196879) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2004-2005 Pawel Jakub Dawidek + * Copyright (c) 2004-2009 Pawel Jakub Dawidek * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,13 +41,12 @@ __FBSDID("$FreeBSD$"); #include #include - uint32_t lib_version = G_LIB_VERSION; uint32_t version = G_MIRROR_VERSION; static char label_balance[] = "split", configure_balance[] = "none"; static intmax_t label_slice = 4096, configure_slice = -1; -static intmax_t insert_priority = 0; +static intmax_t insert_priority = 0, configure_priority = -1; static void mirror_main(struct gctl_req *req, unsigned flags); static void mirror_activate(struct gctl_req *req); @@ -71,10 +70,12 @@ struct g_command class_commands[] = { { 'F', "nofailsync", NULL, G_TYPE_BOOL }, { 'h', "hardcode", NULL, G_TYPE_BOOL }, { 'n', "noautosync", NULL, G_TYPE_BOOL }, + { 'p', "priority", &configure_priority, G_TYPE_NUMBER }, { 's', "slice", &configure_slice, G_TYPE_NUMBER }, G_OPT_SENTINEL }, - NULL, "[-adfFhnv] [-b balance] [-s slice] name" + NULL, "[-adfFhnv] [-b balance] [-s slice] name\n" + "[-v] -p priority name prov" }, { "deactivate", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, NULL, "[-v] name prov ..." Modified: head/sbin/geom/class/mirror/gmirror.8 ============================================================================== --- head/sbin/geom/class/mirror/gmirror.8 Sun Sep 6 06:49:59 2009 (r196878) +++ head/sbin/geom/class/mirror/gmirror.8 Sun Sep 6 06:52:06 2009 (r196879) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2004-2005 Pawel Jakub Dawidek +.\" Copyright (c) 2004-2009 Pawel Jakub Dawidek .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 1, 2006 +.Dd August 1, 2009 .Dt GMIRROR 8 .Os .Sh NAME @@ -49,6 +49,12 @@ .Op Fl s Ar slice .Ar name .Nm +.Cm configure +.Op Fl v +.Fl p Ar priority +.Ar name +.Ar prov +.Nm .Cm rebuild .Op Fl v .Ar name @@ -115,8 +121,8 @@ indicates an action to be performed: .It Cm label Create a mirror. The order of components is important, because a component's priority is based on its position -(starting from 0). -The component with the biggest priority is used by the +(starting from 0 to 255). +The component with the biggest priority (the lowest number) is used by the .Cm prefer balance algorithm and is also used as a master component when resynchronization is needed, @@ -159,7 +165,7 @@ Clear metadata on the given providers. Configure the given device. .Pp Additional options include: -.Bl -tag -width ".Fl b Ar balance" +.Bl -tag -width ".Fl p Ar priority" .It Fl a Turn on autosynchronization of stale components. .It Fl b Ar balance @@ -175,6 +181,9 @@ Assumes device is in consistent state. Hardcode providers' names in metadata. .It Fl n Turn off autosynchronization of stale components. +.It Fl p Ar priority +Specifies priority for the given component +.Ar prov . .It Fl s Ar slice Specifies slice size for .Cm split Modified: head/sys/geom/mirror/g_mirror_ctl.c ============================================================================== --- head/sys/geom/mirror/g_mirror_ctl.c Sun Sep 6 06:49:59 2009 (r196878) +++ head/sys/geom/mirror/g_mirror_ctl.c Sun Sep 6 06:52:06 2009 (r196879) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2004-2006 Pawel Jakub Dawidek + * Copyright (c) 2004-2009 Pawel Jakub Dawidek * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -93,19 +93,19 @@ g_mirror_ctl_configure(struct gctl_req * { struct g_mirror_softc *sc; struct g_mirror_disk *disk; - const char *name, *balancep; - intmax_t *slicep; + const char *name, *balancep, *prov; + intmax_t *slicep, *priority; uint32_t slice; uint8_t balance; int *autosync, *noautosync, *failsync, *nofailsync, *hardcode, *dynamic; - int *nargs, do_sync = 0, dirty = 1; + int *nargs, do_sync = 0, dirty = 1, do_priority = 0; nargs = gctl_get_paraml(req, "nargs", sizeof(*nargs)); if (nargs == NULL) { gctl_error(req, "No '%s' argument.", "nargs"); return; } - if (*nargs != 1) { + if (*nargs != 1 && *nargs != 2) { gctl_error(req, "Invalid number of arguments."); return; } @@ -149,6 +149,29 @@ g_mirror_ctl_configure(struct gctl_req * gctl_error(req, "No '%s' argument.", "dynamic"); return; } + priority = gctl_get_paraml(req, "priority", sizeof(*priority)); + if (priority == NULL) { + gctl_error(req, "No '%s' argument.", "priority"); + return; + } + if (*priority < -1 || *priority > 255) { + gctl_error(req, "Priority range is 0 to 255, %jd given", + *priority); + return; + } + /* + * Since we have a priority, we also need a provider now. + * Note: be WARNS safe, by always assigning prov and only throw an + * error if *priority != -1. + */ + prov = gctl_get_asciiparam(req, "arg1"); + if (*priority > -1) { + if (prov == NULL) { + gctl_error(req, "Priority needs a disk name"); + return; + } + do_priority = 1; + } if (*autosync && *noautosync) { gctl_error(req, "'%s' and '%s' specified.", "autosync", "noautosync"); @@ -189,19 +212,32 @@ g_mirror_ctl_configure(struct gctl_req * slice = sc->sc_slice; else slice = *slicep; - if (g_mirror_ndisks(sc, -1) < sc->sc_ndisks) { + /* Enforce usage() of -p not allowing any other options. */ + if (do_priority && (*autosync || *noautosync || *failsync || + *nofailsync || *hardcode || *dynamic || *slicep != -1 || + strcmp(balancep, "none") != 0)) { sx_xunlock(&sc->sc_lock); - gctl_error(req, "Not all disks connected. Try 'forget' command " - "first."); + gctl_error(req, "only -p accepted when setting priority"); return; } if (sc->sc_balance == balance && sc->sc_slice == slice && !*autosync && !*noautosync && !*failsync && !*nofailsync && !*hardcode && - !*dynamic) { + !*dynamic && !do_priority) { sx_xunlock(&sc->sc_lock); gctl_error(req, "Nothing has changed."); return; } + if ((!do_priority && *nargs != 1) || (do_priority && *nargs != 2)) { + sx_xunlock(&sc->sc_lock); + gctl_error(req, "Invalid number of arguments."); + return; + } + if (g_mirror_ndisks(sc, -1) < sc->sc_ndisks) { + sx_xunlock(&sc->sc_lock); + gctl_error(req, "Not all disks connected. Try 'forget' command " + "first."); + return; + } sc->sc_balance = balance; sc->sc_slice = slice; if ((sc->sc_flags & G_MIRROR_DEVICE_FLAG_NOAUTOSYNC) != 0) { @@ -223,6 +259,23 @@ g_mirror_ctl_configure(struct gctl_req * } } LIST_FOREACH(disk, &sc->sc_disks, d_next) { + /* + * Handle priority first, since we only need one disk, do one + * operation on it and then we're done. No need to check other + * flags, as usage doesn't allow it. + */ + if (do_priority) { + if (strcmp(disk->d_name, prov) == 0) { + if (disk->d_priority == *priority) + gctl_error(req, "Nothing has changed."); + else { + disk->d_priority = *priority; + g_mirror_update_metadata(disk); + } + break; + } + continue; + } if (do_sync) { if (disk->d_state == G_MIRROR_DISK_STATE_SYNCHRONIZING) disk->d_flags &= ~G_MIRROR_DISK_FLAG_FORCE_SYNC; From pjd at FreeBSD.org Sun Sep 6 07:22:10 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Sun Sep 6 07:22:16 2009 Subject: svn commit: r196880 - head/lib/libc/sys Message-ID: <200909060722.n867MAWM076318@svn.freebsd.org> Author: pjd Date: Sun Sep 6 07:22:09 2009 New Revision: 196880 URL: http://svn.freebsd.org/changeset/base/196880 Log: Synchornize description in manual page with strerror() output. Modified: head/lib/libc/sys/intro.2 Modified: head/lib/libc/sys/intro.2 ============================================================================== --- head/lib/libc/sys/intro.2 Sun Sep 6 06:52:06 2009 (r196879) +++ head/lib/libc/sys/intro.2 Sun Sep 6 07:22:09 2009 (r196880) @@ -302,7 +302,7 @@ Internet protocols. .It Er 48 EADDRINUSE Em "Address already in use" . Only one usage of each address is normally permitted. .Pp -.It Er 49 EADDRNOTAVAIL Em "Cannot assign requested address" . +.It Er 49 EADDRNOTAVAIL Em "Can't assign requested address" . Normally results from an attempt to create a socket with an address not on this machine. .It Er 50 ENETDOWN Em "Network is down" . @@ -335,7 +335,7 @@ when already connected. An request to send or receive data was disallowed because the socket was not connected and (when sending on a datagram socket) no address was supplied. -.It Er 58 ESHUTDOWN Em "Cannot send after socket shutdown" . +.It Er 58 ESHUTDOWN Em "Can't send after socket shutdown" . A request to send data was disallowed because the socket had already been shut down with a previous .Xr shutdown 2 From pjd at FreeBSD.org Sun Sep 6 07:29:24 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Sun Sep 6 07:29:35 2009 Subject: svn commit: r196881 - head/sys/netinet Message-ID: <200909060729.n867TNBa076478@svn.freebsd.org> Author: pjd Date: Sun Sep 6 07:29:22 2009 New Revision: 196881 URL: http://svn.freebsd.org/changeset/base/196881 Log: Correct comment. Modified: head/sys/netinet/ip_fastfwd.c Modified: head/sys/netinet/ip_fastfwd.c ============================================================================== --- head/sys/netinet/ip_fastfwd.c Sun Sep 6 07:22:09 2009 (r196880) +++ head/sys/netinet/ip_fastfwd.c Sun Sep 6 07:29:22 2009 (r196881) @@ -151,8 +151,8 @@ ip_findroute(struct route *ro, struct in /* * Try to forward a packet based on the destination address. * This is a fast path optimized for the plain forwarding case. - * If the packet is handled (and consumed) here then we return 1; - * otherwise 0 is returned and the packet should be delivered + * If the packet is handled (and consumed) here then we return NULL; + * otherwise mbuf is returned and the packet should be delivered * to ip_input for full processing. */ struct mbuf * From pjd at FreeBSD.org Sun Sep 6 07:30:21 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Sun Sep 6 07:30:33 2009 Subject: svn commit: r196882 - head/sys/netipsec Message-ID: <200909060730.n867ULKm076539@svn.freebsd.org> Author: pjd Date: Sun Sep 6 07:30:21 2009 New Revision: 196882 URL: http://svn.freebsd.org/changeset/base/196882 Log: Correct typo in comment. Modified: head/sys/netipsec/ipsec.h Modified: head/sys/netipsec/ipsec.h ============================================================================== --- head/sys/netipsec/ipsec.h Sun Sep 6 07:29:22 2009 (r196881) +++ head/sys/netipsec/ipsec.h Sun Sep 6 07:30:21 2009 (r196882) @@ -61,7 +61,7 @@ * specifies ICMPv6 type, and the port field in "dst" specifies ICMPv6 code. */ struct secpolicyindex { - u_int8_t dir; /* direction of packet flow, see blow */ + u_int8_t dir; /* direction of packet flow, see below */ union sockaddr_union src; /* IP src address for SP */ union sockaddr_union dst; /* IP dst address for SP */ u_int8_t prefs; /* prefix length in bits for src */ From pjd at FreeBSD.org Sun Sep 6 07:32:17 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Sun Sep 6 07:32:28 2009 Subject: svn commit: r196883 - head/sys/netipsec Message-ID: <200909060732.n867WGwc076608@svn.freebsd.org> Author: pjd Date: Sun Sep 6 07:32:16 2009 New Revision: 196883 URL: http://svn.freebsd.org/changeset/base/196883 Log: Improve code a bit by eliminating goto and having one unlock per lock. Modified: head/sys/netipsec/key.c Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Sun Sep 6 07:30:21 2009 (r196882) +++ head/sys/netipsec/key.c Sun Sep 6 07:32:16 2009 (r196883) @@ -918,15 +918,14 @@ key_allocsa_policy(const struct secasind state_valid = saorder_state_valid_prefer_new; arraysize = N(saorder_state_valid_prefer_new); } - SAHTREE_UNLOCK(); - goto found; + break; } } SAHTREE_UNLOCK(); - return NULL; + if (sah == NULL) + return NULL; - found: /* search valid state */ for (stateidx = 0; stateidx < arraysize; stateidx++) { sav = key_do_allocsa_policy(sah, state_valid[stateidx]); From ed at FreeBSD.org Sun Sep 6 09:39:41 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Sun Sep 6 09:39:47 2009 Subject: svn commit: r196884 - head/sys/sys Message-ID: <200909060939.n869deVU079085@svn.freebsd.org> Author: ed Date: Sun Sep 6 09:39:40 2009 New Revision: 196884 URL: http://svn.freebsd.org/changeset/base/196884 Log: Perform cleanups to the TTY headers: - Properly sort the ioctls in ioctl_compat.h. Also perform some whitespace fixes. - Properly comment all the unused/compat ioctls in ttycom.h. Modified: head/sys/sys/ioctl_compat.h head/sys/sys/ttycom.h Modified: head/sys/sys/ioctl_compat.h ============================================================================== --- head/sys/sys/ioctl_compat.h Sun Sep 6 07:32:16 2009 (r196883) +++ head/sys/sys/ioctl_compat.h Sun Sep 6 09:39:40 2009 (r196884) @@ -73,12 +73,12 @@ struct sgttyb { #define OTIOCGETD _IOR('t', 0, int) /* get line discipline */ #define OTIOCSETD _IOW('t', 1, int) /* set line discipline */ -#define TIOCHPCL _IO('t', 2) /* hang up on last close */ -#define TIOCGETP _IOR('t', 8,struct sgttyb)/* get parameters -- gtty */ -#define TIOCSETP _IOW('t', 9,struct sgttyb)/* set parameters -- stty */ -#define TIOCSETN _IOW('t',10,struct sgttyb)/* as above, but no flushtty*/ -#define TIOCSETC _IOW('t',17,struct tchars)/* set special characters */ -#define TIOCGETC _IOR('t',18,struct tchars)/* get special characters */ +#define TIOCHPCL _IO('t', 2) /* hang up on last close */ +#define TIOCGETP _IOR('t', 8, struct sgttyb) /* get parameters */ +#define TIOCSETP _IOW('t', 9, struct sgttyb) /* set parameters */ +#define TIOCSETN _IOW('t',10, struct sgttyb) /* as above, but no flush */ +#define TIOCSETC _IOW('t',17, struct tchars) /* set special characters */ +#define TIOCGETC _IOR('t',18, struct tchars) /* get special characters */ #define TANDEM 0x00000001 /* send stopc on out q full */ #define CBREAK 0x00000002 /* half-cooked mode */ #define LCASE 0x00000004 /* simulate lower case */ @@ -126,9 +126,9 @@ struct sgttyb { #define PENDIN 0x20000000 /* tp->t_rawq needs reread */ #define DECCTQ 0x40000000 /* only ^Q starts after ^S */ #define NOFLSH 0x80000000 /* no output flush on signal */ -#define TIOCLBIS _IOW('t', 127, int) /* bis local mode bits */ -#define TIOCLBIC _IOW('t', 126, int) /* bic local mode bits */ -#define TIOCLSET _IOW('t', 125, int) /* set entire local mode word */ +#define OTIOCCONS _IO('t', 98) /* for hp300 -- sans int arg */ +#define TIOCGLTC _IOR('t', 116,struct ltchars) /* get special chars */ +#define TIOCSLTC _IOW('t', 117,struct ltchars) /* set special chars */ #define TIOCLGET _IOR('t', 124, int) /* get local modes */ #define LCRTBS (CRTBS>>16) #define LPRTERA (PRTERA>>16) @@ -145,8 +145,8 @@ struct sgttyb { #define LPENDIN (PENDIN>>16) #define LDECCTQ (DECCTQ>>16) #define LNOFLSH (NOFLSH>>16) -#define TIOCSLTC _IOW('t',117,struct ltchars)/* set local special chars*/ -#define TIOCGLTC _IOR('t',116,struct ltchars)/* get local special chars*/ -#define OTIOCCONS _IO('t', 98) /* for hp300 -- sans int arg */ +#define TIOCLSET _IOW('t', 125, int) /* set entire local mode word */ +#define TIOCLBIC _IOW('t', 126, int) /* bic local mode bits */ +#define TIOCLBIS _IOW('t', 127, int) /* bis local mode bits */ #endif /* !_SYS_IOCTL_COMPAT_H_ */ Modified: head/sys/sys/ttycom.h ============================================================================== --- head/sys/sys/ttycom.h Sun Sep 6 07:32:16 2009 (r196883) +++ head/sys/sys/ttycom.h Sun Sep 6 09:39:40 2009 (r196884) @@ -57,10 +57,9 @@ struct winsize { }; /* 0-2 compat */ - /* 3-4 obsolete */ - /* 5-7 obsolete or unused */ + /* 3-7 unused */ /* 8-10 compat */ - /* 11-12 obsolete or unused */ + /* 11-12 unused */ #define TIOCEXCL _IO('t', 13) /* set exclusive use of tty */ #define TIOCNXCL _IO('t', 14) /* reset exclusive use of tty */ #define TIOCGPTN _IOR('t', 15, int) /* Get pts number. */ @@ -70,34 +69,34 @@ struct winsize { #define TIOCSETA _IOW('t', 20, struct termios) /* set termios struct */ #define TIOCSETAW _IOW('t', 21, struct termios) /* drain output, set */ #define TIOCSETAF _IOW('t', 22, struct termios) /* drn out, fls in, set */ - /* 23-25 obsolete or unused */ + /* 23-25 unused */ #define TIOCGETD _IOR('t', 26, int) /* get line discipline */ #define TIOCSETD _IOW('t', 27, int) /* set line discipline */ #define TIOCPTMASTER _IO('t', 28) /* pts master validation */ - /* 29-69 free */ - /* 80-84 slip */ + /* 29-85 unused */ #define TIOCGDRAINWAIT _IOR('t', 86, int) /* get ttywait timeout */ #define TIOCSDRAINWAIT _IOW('t', 87, int) /* set ttywait timeout */ - /* 88 slip, ppp; conflicts */ + /* 88 unused */ + /* 89-91 conflicts: tun and tap */ #define TIOCTIMESTAMP _IOR('t', 89, struct timeval) /* enable/get timestamp * of last input event */ - /* 70-90 ppp; many conflicts */ #define TIOCMGDTRWAIT _IOR('t', 90, int) /* modem: get wait on close */ #define TIOCMSDTRWAIT _IOW('t', 91, int) /* modem: set wait on close */ - /* 90-92 tap; some conflicts */ + /* 92-93 tun and tap */ + /* 94-97 conflicts: tun and tap */ #define TIOCDRAIN _IO('t', 94) /* wait till output drained */ #define TIOCSIG _IOWINT('t', 95) /* pty: generate signal */ #define TIOCEXT _IOW('t', 96, int) /* pty: external processing */ - /* 90-97 tun; some conflicts */ #define TIOCSCTTY _IO('t', 97) /* become controlling tty */ #define TIOCCONS _IOW('t', 98, int) /* become virtual console */ #define TIOCGSID _IOR('t', 99, int) /* get session id */ - /* 100 see consio.h */ + /* 100 unused */ #define TIOCSTAT _IO('t', 101) /* simulate ^T status message */ #define TIOCUCNTL _IOW('t', 102, int) /* pty: set/clr usr cntl mode */ #define UIOCCMD(n) _IO('u', n) /* usr cntl op "n" */ #define TIOCSWINSZ _IOW('t', 103, struct winsize) /* set window size */ #define TIOCGWINSZ _IOR('t', 104, struct winsize) /* get window size */ + /* 105 unused */ #define TIOCMGET _IOR('t', 106, int) /* get all modem bits */ #define TIOCM_LE 0001 /* line enable */ #define TIOCM_DTR 0002 /* data terminal ready */ From ed at FreeBSD.org Sun Sep 6 09:59:02 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Sun Sep 6 09:59:09 2009 Subject: svn commit: r196885 - head/sys/dev/null Message-ID: <200909060959.n869x2Hu079517@svn.freebsd.org> Author: ed Date: Sun Sep 6 09:59:02 2009 New Revision: 196885 URL: http://svn.freebsd.org/changeset/base/196885 Log: Remove unneeded minor numbers from /dev/null and /dev/zero. Modified: head/sys/dev/null/null.c Modified: head/sys/dev/null/null.c ============================================================================== --- head/sys/dev/null/null.c Sun Sep 6 09:39:40 2009 (r196884) +++ head/sys/dev/null/null.c Sun Sep 6 09:59:02 2009 (r196885) @@ -49,9 +49,6 @@ static d_write_t null_write; static d_ioctl_t null_ioctl; static d_read_t zero_read; -#define NULL_MINOR 2 -#define ZERO_MINOR 12 - static struct cdevsw null_cdevsw = { .d_version = D_VERSION, .d_read = (d_read_t *)nullop, @@ -115,10 +112,10 @@ null_modevent(module_t mod __unused, int if (bootverbose) printf("null: \n"); zbuf = (void *)malloc(PAGE_SIZE, M_TEMP, M_WAITOK | M_ZERO); - null_dev = make_dev(&null_cdevsw, NULL_MINOR, UID_ROOT, - GID_WHEEL, 0666, "null"); - zero_dev = make_dev(&zero_cdevsw, ZERO_MINOR, UID_ROOT, - GID_WHEEL, 0666, "zero"); + null_dev = make_dev(&null_cdevsw, 0, UID_ROOT, GID_WHEEL, + 0666, "null"); + zero_dev = make_dev(&zero_cdevsw, 0, UID_ROOT, GID_WHEEL, + 0666, "zero"); break; case MOD_UNLOAD: From ed at FreeBSD.org Sun Sep 6 10:27:46 2009 From: ed at FreeBSD.org (Ed Schouten) Date: Sun Sep 6 10:27:52 2009 Subject: svn commit: r196886 - in head: share/man/man4 sys/dev/pty sys/kern sys/sys Message-ID: <200909061027.n86ARjvr080188@svn.freebsd.org> Author: ed Date: Sun Sep 6 10:27:45 2009 New Revision: 196886 URL: http://svn.freebsd.org/changeset/base/196886 Log: Move ptmx into pty(4). Now that pty(4) is a loadable kernel module, I'd better move /dev/ptmx in there as well. This means that pty(4) now provides almost all pseudo-terminal compatibility code. This means it's very easy to test whether applications use the proper library interfaces when allocating pseudo-terminals (namely posix_openpt and openpty). Modified: head/share/man/man4/pts.4 head/share/man/man4/pty.4 head/sys/dev/pty/pty.c head/sys/kern/tty_pts.c head/sys/sys/tty.h Modified: head/share/man/man4/pts.4 ============================================================================== --- head/share/man/man4/pts.4 Sun Sep 6 09:59:02 2009 (r196885) +++ head/share/man/man4/pts.4 Sun Sep 6 10:27:45 2009 (r196886) @@ -147,15 +147,6 @@ The files used by this pseudo-terminals implementation are: .Pp .Bl -tag -width ".Pa /dev/pts/[num]" -.It Pa /dev/ptmx -Control device, returns a file descriptor to a new master -pseudo-terminal when opened. -This device should not be opened directly. -It's only available for binary compatibility. -New devices should only be allocated with -.Xr posix_openpt 2 -and -.Xr openpty 3 . .It Pa /dev/pts/[num] Pseudo-terminal slave devices. .El Modified: head/share/man/man4/pty.4 ============================================================================== --- head/share/man/man4/pty.4 Sun Sep 6 09:59:02 2009 (r196885) +++ head/share/man/man4/pty.4 Sun Sep 6 10:27:45 2009 (r196886) @@ -32,7 +32,7 @@ .Os .Sh NAME .Nm pty -.Nd BSD-style compatibility pseudo-terminal driver +.Nd BSD-style and System V-style compatibility pseudo-terminal driver .Sh SYNOPSIS .Cd "device pty" .Sh DESCRIPTION @@ -48,6 +48,12 @@ driver. A device node for this terminal shall be created, which has the name .Pa /dev/ttyXX . .Pp +The +.Nm +driver also provides a cloning System V +.Pa /dev/ptmx +device. +.Pp New code should not try to allocate pseudo-terminals using this interface. It is only provided for compatibility with older C libraries @@ -63,6 +69,9 @@ device names: Pseudo-terminal master devices. .It Pa /dev/tty[l-sL-S][0-9a-v] Pseudo-terminal slave devices. +.It Pa /dev/ptmx +Control device, returns a file descriptor to a new master +pseudo-terminal when opened. .El .Sh DIAGNOSTICS None. @@ -75,7 +84,7 @@ A pseudo-terminal driver appeared in .Bx 4.2 . .Sh BUGS -Unlike previous implementations, the master slave device nodes are +Unlike previous implementations, the master and slave device nodes are destroyed when the PTY becomes unused. A call to .Xr stat 2 Modified: head/sys/dev/pty/pty.c ============================================================================== --- head/sys/dev/pty/pty.c Sun Sep 6 09:59:02 2009 (r196885) +++ head/sys/dev/pty/pty.c Sun Sep 6 10:27:45 2009 (r196886) @@ -47,6 +47,9 @@ __FBSDID("$FreeBSD$"); * the pts(4) driver. We just call into pts(4) to create the actual PTY. * To make sure we don't use the same PTY multiple times, we abuse * si_drv1 inside the cdev to mark whether the PTY is in use. + * + * It also implements a /dev/ptmx device node, which is useful for Linux + * binary emulation. */ static unsigned int pty_warningcnt = 1; @@ -119,12 +122,27 @@ pty_clone(void *arg, struct ucred *cr, c } static int +ptmx_fdopen(struct cdev *dev __unused, int fflags, struct thread *td, + struct file *fp) +{ + + return (pts_alloc(fflags & (FREAD|FWRITE), td, fp)); +} + +static struct cdevsw ptmx_cdevsw = { + .d_version = D_VERSION, + .d_fdopen = ptmx_fdopen, + .d_name = "ptmx", +}; + +static int pty_modevent(module_t mod, int type, void *data) { switch(type) { case MOD_LOAD: EVENTHANDLER_REGISTER(dev_clone, pty_clone, 0, 1000); + make_dev(&ptmx_cdevsw, 0, UID_ROOT, GID_WHEEL, 0666, "ptmx"); break; case MOD_SHUTDOWN: break; Modified: head/sys/kern/tty_pts.c ============================================================================== --- head/sys/kern/tty_pts.c Sun Sep 6 09:59:02 2009 (r196885) +++ head/sys/kern/tty_pts.c Sun Sep 6 10:27:45 2009 (r196886) @@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$"); /* Add compatibility bits for FreeBSD. */ #define PTS_COMPAT -/* Add /dev/ptyXX compat bits. */ +/* Add pty(4) compat bits. */ #define PTS_EXTERNAL /* Add bits to make Linux binaries work. */ #define PTS_LINUX @@ -694,7 +694,10 @@ static struct ttydevsw pts_class = { .tsw_free = ptsdrv_free, }; -static int +#ifndef PTS_EXTERNAL +static +#endif /* !PTS_EXTERNAL */ +int pts_alloc(int fflags, struct thread *td, struct file *fp) { int unit, ok; @@ -815,29 +818,11 @@ posix_openpt(struct thread *td, struct p return (0); } -#if defined(PTS_COMPAT) || defined(PTS_LINUX) -static int -ptmx_fdopen(struct cdev *dev, int fflags, struct thread *td, struct file *fp) -{ - - return (pts_alloc(fflags & (FREAD|FWRITE), td, fp)); -} - -static struct cdevsw ptmx_cdevsw = { - .d_version = D_VERSION, - .d_fdopen = ptmx_fdopen, - .d_name = "ptmx", -}; -#endif /* PTS_COMPAT || PTS_LINUX */ - static void pts_init(void *unused) { pts_pool = new_unrhdr(0, INT_MAX, NULL); -#if defined(PTS_COMPAT) || defined(PTS_LINUX) - make_dev(&ptmx_cdevsw, 0, UID_ROOT, GID_WHEEL, 0666, "ptmx"); -#endif /* PTS_COMPAT || PTS_LINUX */ } SYSINIT(pts, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, pts_init, NULL); Modified: head/sys/sys/tty.h ============================================================================== --- head/sys/sys/tty.h Sun Sep 6 09:59:02 2009 (r196885) +++ head/sys/sys/tty.h Sun Sep 6 10:27:45 2009 (r196886) @@ -202,6 +202,7 @@ void tty_info(struct tty *tp); void ttyconsdev_select(const char *name); /* Pseudo-terminal hooks. */ +int pts_alloc(int fflags, struct thread *td, struct file *fp); int pts_alloc_external(int fd, struct thread *td, struct file *fp, struct cdev *dev, const char *name); From kib at FreeBSD.org Sun Sep 6 11:44:47 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sun Sep 6 11:44:59 2009 Subject: svn commit: r196887 - head/sys/kern Message-ID: <200909061144.n86BikcZ082916@svn.freebsd.org> Author: kib Date: Sun Sep 6 11:44:46 2009 New Revision: 196887 URL: http://svn.freebsd.org/changeset/base/196887 Log: In fhopen, vfs_ref() the mount point while vnode is unlocked, to prevent vn_start_write(NULL, &mp) from operating on potentially freed or reused struct mount *. Remove unmatched vfs_rel() in cleanup. Noted and reviewed by: tegge Tested by: pho MFC after: 3 days Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Sun Sep 6 10:27:45 2009 (r196886) +++ head/sys/kern/vfs_syscalls.c Sun Sep 6 11:44:46 2009 (r196887) @@ -4439,12 +4439,15 @@ fhopen(td, uap) goto bad; } if (fmode & O_TRUNC) { + vfs_ref(mp); VOP_UNLOCK(vp, 0); /* XXX */ if ((error = vn_start_write(NULL, &mp, V_WAIT | PCATCH)) != 0) { vrele(vp); + vfs_rel(mp); goto out; } vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); /* XXX */ + vfs_rel(mp); #ifdef MAC /* * We don't yet have fp->f_cred, so use td->td_ucred, which @@ -4516,7 +4519,6 @@ fhopen(td, uap) VOP_UNLOCK(vp, 0); fdrop(fp, td); - vfs_rel(mp); VFS_UNLOCK_GIANT(vfslocked); td->td_retval[0] = indx; return (0); From kib at FreeBSD.org Sun Sep 6 11:46:52 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sun Sep 6 11:47:03 2009 Subject: svn commit: r196888 - head/sys/ufs/ffs Message-ID: <200909061146.n86BkpXK082995@svn.freebsd.org> Author: kib Date: Sun Sep 6 11:46:51 2009 New Revision: 196888 URL: http://svn.freebsd.org/changeset/base/196888 Log: The clear_remove() and clear_inodedeps() call vn_start_write(NULL, &mp, V_NOWAIT) on the non-busied mount point. Unmount might free ufs-specific mp data, causing ffs_vgetf() to access freed memory. Busy mountpoint before dropping softdep lk. Noted and reviewed by: tegge Tested by: pho MFC after: 1 week Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Sun Sep 6 11:44:46 2009 (r196887) +++ head/sys/ufs/ffs/ffs_softdep.c Sun Sep 6 11:46:51 2009 (r196888) @@ -5977,12 +5977,19 @@ clear_remove(td) if (vn_start_write(NULL, &mp, V_NOWAIT) != 0) continue; FREE_LOCK(&lk); - if ((error = ffs_vgetf(mp, ino, LK_EXCLUSIVE, &vp, - FFSV_FORCEINSMQ))) { + + /* + * Let unmount clear deps + */ + error = vfs_busy(mp, MBF_NOWAIT); + if (error != 0) + goto finish_write; + error = ffs_vgetf(mp, ino, LK_EXCLUSIVE, &vp, + FFSV_FORCEINSMQ); + vfs_unbusy(mp); + if (error != 0) { softdep_error("clear_remove: vget", error); - vn_finished_write(mp); - ACQUIRE_LOCK(&lk); - return; + goto finish_write; } if ((error = ffs_syncvnode(vp, MNT_NOWAIT))) softdep_error("clear_remove: fsync", error); @@ -5991,6 +5998,7 @@ clear_remove(td) drain_output(vp); BO_UNLOCK(bo); vput(vp); + finish_write: vn_finished_write(mp); ACQUIRE_LOCK(&lk); return; @@ -6050,13 +6058,21 @@ clear_inodedeps(td) if (vn_start_write(NULL, &mp, V_NOWAIT) != 0) continue; FREE_LOCK(&lk); + error = vfs_busy(mp, MBF_NOWAIT); /* Let unmount clear deps */ + if (error != 0) { + vn_finished_write(mp); + ACQUIRE_LOCK(&lk); + return; + } if ((error = ffs_vgetf(mp, ino, LK_EXCLUSIVE, &vp, FFSV_FORCEINSMQ)) != 0) { softdep_error("clear_inodedeps: vget", error); + vfs_unbusy(mp); vn_finished_write(mp); ACQUIRE_LOCK(&lk); return; } + vfs_unbusy(mp); if (ino == lastino) { if ((error = ffs_syncvnode(vp, MNT_WAIT))) softdep_error("clear_inodedeps: fsync1", error); From nork at FreeBSD.org Sun Sep 6 12:01:30 2009 From: nork at FreeBSD.org (Norikatsu Shigemura) Date: Sun Sep 6 12:01:37 2009 Subject: svn commit: r196889 - head/sys/dev/coretemp Message-ID: <200909061201.n86C1Tw5083308@svn.freebsd.org> Author: nork Date: Sun Sep 6 12:01:29 2009 New Revision: 196889 URL: http://svn.freebsd.org/changeset/base/196889 Log: Change 'dev.cpu.N.temperature', sysctl I (degC) to IK (Kelvin). Approved by: re (rwatson) Reviewed by: rpaulo Suggested by: ume MFC After: 3 days Modified: head/sys/dev/coretemp/coretemp.c Modified: head/sys/dev/coretemp/coretemp.c ============================================================================== --- head/sys/dev/coretemp/coretemp.c Sun Sep 6 11:46:51 2009 (r196888) +++ head/sys/dev/coretemp/coretemp.c Sun Sep 6 12:01:29 2009 (r196889) @@ -48,6 +48,8 @@ __FBSDID("$FreeBSD$"); #include #include +#define TZ_ZEROC 2732 + struct coretemp_softc { device_t sc_dev; int sc_tjmax; @@ -193,8 +195,8 @@ coretemp_attach(device_t dev) SYSCTL_CHILDREN(device_get_sysctl_tree(pdev)), OID_AUTO, "temperature", CTLTYPE_INT | CTLFLAG_RD, - dev, 0, coretemp_get_temp_sysctl, "I", - "Current temperature in degC"); + dev, 0, coretemp_get_temp_sysctl, "IK", + "Current temperature"); return (0); } @@ -283,7 +285,7 @@ coretemp_get_temp_sysctl(SYSCTL_HANDLER_ device_t dev = (device_t) arg1; int temp; - temp = coretemp_get_temp(dev); + temp = coretemp_get_temp(dev) * 10 + TZ_ZEROC; return (sysctl_handle_int(oidp, &temp, 0, req)); } From antoine at FreeBSD.org Sun Sep 6 13:26:51 2009 From: antoine at FreeBSD.org (Antoine Brodin) Date: Sun Sep 6 13:27:03 2009 Subject: svn commit: r196890 - head/etc/mtree Message-ID: <200909061326.n86DQpOt084992@svn.freebsd.org> Author: antoine Date: Sun Sep 6 13:26:51 2009 New Revision: 196890 URL: http://svn.freebsd.org/changeset/base/196890 Log: Update etc/mtree/Makefile: There is no longer BSD.{local,x11-4,x11}.dist mtree files. There is a BSD.sendmail.dist mtree file. Modified: head/etc/mtree/Makefile Modified: head/etc/mtree/Makefile ============================================================================== --- head/etc/mtree/Makefile Sun Sep 6 12:01:29 2009 (r196889) +++ head/etc/mtree/Makefile Sun Sep 6 13:26:51 2009 (r196890) @@ -5,12 +5,10 @@ FILES= ${_BIND.chroot.dist} \ ${_BIND.include.dist} \ BSD.include.dist \ - BSD.local.dist \ BSD.root.dist \ + ${_BSD.sendmail.dist} \ BSD.usr.dist \ - BSD.var.dist \ - BSD.x11-4.dist \ - BSD.x11.dist + BSD.var.dist .if ${MK_BIND} != "no" _BIND.chroot.dist= BIND.chroot.dist @@ -18,6 +16,9 @@ _BIND.chroot.dist= BIND.chroot.dist _BIND.include.dist= BIND.include.dist .endif .endif +.if ${MK_SENDMAIL} != "no" +_BSD.sendmail.dist= BSD.sendmail.dist +.endif NO_OBJ= FILESDIR= /etc/mtree From antoine at FreeBSD.org Sun Sep 6 13:31:05 2009 From: antoine at FreeBSD.org (Antoine Brodin) Date: Sun Sep 6 13:31:17 2009 Subject: svn commit: r196891 - head/sys/kern Message-ID: <200909061331.n86DV5W2085110@svn.freebsd.org> Author: antoine Date: Sun Sep 6 13:31:05 2009 New Revision: 196891 URL: http://svn.freebsd.org/changeset/base/196891 Log: Change w_notrunning and w_stillcold from pointer to array so that sizeof returns what is expected. PR: kern/138557 Discussed with: brucec@ MFC after: 1 month Modified: head/sys/kern/subr_witness.c Modified: head/sys/kern/subr_witness.c ============================================================================== --- head/sys/kern/subr_witness.c Sun Sep 6 13:26:51 2009 (r196890) +++ head/sys/kern/subr_witness.c Sun Sep 6 13:31:05 2009 (r196891) @@ -469,8 +469,8 @@ static struct witness_lock_order_data *w static struct witness_lock_order_hash w_lohash; static int w_max_used_index = 0; static unsigned int w_generation = 0; -static const char *w_notrunning = "Witness not running\n"; -static const char *w_stillcold = "Witness is still cold\n"; +static const char w_notrunning[] = "Witness not running\n"; +static const char w_stillcold[] = "Witness is still cold\n"; static struct witness_order_list_entry order_lists[] = { From mav at FreeBSD.org Sun Sep 6 14:05:01 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Sun Sep 6 14:05:08 2009 Subject: svn commit: r196892 - stable/8/sbin/camcontrol Message-ID: <200909061405.n86E51PV085825@svn.freebsd.org> Author: mav Date: Sun Sep 6 14:05:01 2009 New Revision: 196892 URL: http://svn.freebsd.org/changeset/base/196892 Log: MFC r196831: Add to `camcontrol cmd` support for sending arbitrary ATA commands. It could be used for broad range of tasks, such as configuring drive power management, caching, security and any other features and tasks, not supported by existing drivers. Approved by: re (ATA-CAM blanket) Modified: stable/8/sbin/camcontrol/ (props changed) stable/8/sbin/camcontrol/camcontrol.8 stable/8/sbin/camcontrol/camcontrol.c Modified: stable/8/sbin/camcontrol/camcontrol.8 ============================================================================== --- stable/8/sbin/camcontrol/camcontrol.8 Sun Sep 6 13:31:05 2009 (r196891) +++ stable/8/sbin/camcontrol/camcontrol.8 Sun Sep 6 14:05:01 2009 (r196892) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 29, 2009 +.Dd September 4, 2009 .Dt CAMCONTROL 8 .Os .Sh NAME @@ -120,10 +120,12 @@ .Ic cmd .Op device id .Op generic args +.Aq Fl a Ar cmd Op args .Aq Fl c Ar cmd Op args .Op Fl i Ar len Ar fmt .Bk -words .Op Fl o Ar len Ar fmt Op args +.Op Fl r Ar fmt .Ek .Nm .Ic debug @@ -486,12 +488,14 @@ Saved values .El .El .It Ic cmd -Allows the user to send an arbitrary SCSI CDB to any device. +Allows the user to send an arbitrary ATA or SCSI CDB to any device. The .Ic cmd function requires the .Fl c -argument to specify the CDB. +argument to specify SCSI CDB or the +.Fl a +argument to specify ATA Command Block registers values. Other arguments are optional, depending on the command type. The command and data specification syntax is documented @@ -503,9 +507,13 @@ SCSI device in question, you MUST specif or .Fl o . .Bl -tag -width 17n +.It Fl a Ar cmd Op args +This specifies the content of 12 ATA Command Block registers (command, +features, lba_low, lba_mid, lba_high, device, lba_low_exp, lba_mid_exp. +lba_high_exp, features_exp, sector_count, sector_count_exp). .It Fl c Ar cmd Op args This specifies the SCSI CDB. -CDBs may be 6, 10, 12 or 16 bytes. +SCSI CDBs may be 6, 10, 12 or 16 bytes. .It Fl i Ar len Ar fmt This specifies the amount of data to read, and how it should be displayed. If the format is @@ -519,6 +527,13 @@ If the format is .Sq - , .Ar len bytes of data will be read from standard input and written to the device. +.It Fl r Ar fmt +This specifies that 11 result ATA Command Block registers should be displayed +(status, error, lba_low, lba_mid, lba_high, device, lba_low_exp, lba_mid_exp, +lba_high_exp, sector_count, sector_count_exp), and how. +If the format is +.Sq - , +11 result registers will be written to standard output in hex. .El .It Ic debug Turn on CAM debugging printfs in the kernel. Modified: stable/8/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/8/sbin/camcontrol/camcontrol.c Sun Sep 6 13:31:05 2009 (r196891) +++ stable/8/sbin/camcontrol/camcontrol.c Sun Sep 6 14:05:01 2009 (r196892) @@ -120,7 +120,7 @@ struct camcontrol_opts { }; #ifndef MINIMALISTIC -static const char scsicmd_opts[] = "c:i:o:"; +static const char scsicmd_opts[] = "a:c:i:o:r"; static const char readdefect_opts[] = "f:GP"; static const char negotiate_opts[] = "acD:O:qR:T:UW:"; #endif @@ -2078,12 +2078,15 @@ scsicmd(struct cam_device *device, int a u_int32_t flags = CAM_DIR_NONE; u_int8_t *data_ptr = NULL; u_int8_t cdb[20]; + u_int8_t atacmd[12]; struct get_hook hook; int c, data_bytes = 0; int cdb_len = 0; - char *datastr = NULL, *tstr; + int atacmd_len = 0; + int need_res = 0; + char *datastr = NULL, *tstr, *resstr = NULL; int error = 0; - int fd_data = 0; + int fd_data = 0, fd_res = 0; int retval; ccb = cam_getccb(device); @@ -2094,10 +2097,32 @@ scsicmd(struct cam_device *device, int a } bzero(&(&ccb->ccb_h)[1], - sizeof(struct ccb_scsiio) - sizeof(struct ccb_hdr)); + sizeof(union ccb) - sizeof(struct ccb_hdr)); while ((c = getopt(argc, argv, combinedopt)) != -1) { switch(c) { + case 'a': + tstr = optarg; + while (isspace(*tstr) && (*tstr != '\0')) + tstr++; + hook.argc = argc - optind; + hook.argv = argv + optind; + hook.got = 0; + atacmd_len = buff_encode_visit(atacmd, sizeof(atacmd), tstr, + iget, &hook); + /* + * Increment optind by the number of arguments the + * encoding routine processed. After each call to + * getopt(3), optind points to the argument that + * getopt should process _next_. In this case, + * that means it points to the first command string + * argument, if there is one. Once we increment + * this, it should point to either the next command + * line argument, or it should be past the end of + * the list. + */ + optind += hook.got; + break; case 'c': tstr = optarg; while (isspace(*tstr) && (*tstr != '\0')) @@ -2194,6 +2219,16 @@ scsicmd(struct cam_device *device, int a iget, &hook); optind += hook.got; break; + case 'r': + need_res = 1; + hook.argc = argc - optind; + hook.argv = argv + optind; + hook.got = 0; + resstr = cget(&hook, NULL); + if ((resstr != NULL) && (resstr[0] == '-')) + fd_res = 1; + optind += hook.got; + break; default: break; } @@ -2226,50 +2261,51 @@ scsicmd(struct cam_device *device, int a /* Disable freezing the device queue */ flags |= CAM_DEV_QFRZDIS; - /* - * This is taken from the SCSI-3 draft spec. - * (T10/1157D revision 0.3) - * The top 3 bits of an opcode are the group code. The next 5 bits - * are the command code. - * Group 0: six byte commands - * Group 1: ten byte commands - * Group 2: ten byte commands - * Group 3: reserved - * Group 4: sixteen byte commands - * Group 5: twelve byte commands - * Group 6: vendor specific - * Group 7: vendor specific - */ - switch((cdb[0] >> 5) & 0x7) { - case 0: - cdb_len = 6; - break; - case 1: - case 2: - cdb_len = 10; - break; - case 3: - case 6: - case 7: - /* computed by buff_encode_visit */ - break; - case 4: - cdb_len = 16; - break; - case 5: - cdb_len = 12; - break; - } + if (cdb_len) { + /* + * This is taken from the SCSI-3 draft spec. + * (T10/1157D revision 0.3) + * The top 3 bits of an opcode are the group code. + * The next 5 bits are the command code. + * Group 0: six byte commands + * Group 1: ten byte commands + * Group 2: ten byte commands + * Group 3: reserved + * Group 4: sixteen byte commands + * Group 5: twelve byte commands + * Group 6: vendor specific + * Group 7: vendor specific + */ + switch((cdb[0] >> 5) & 0x7) { + case 0: + cdb_len = 6; + break; + case 1: + case 2: + cdb_len = 10; + break; + case 3: + case 6: + case 7: + /* computed by buff_encode_visit */ + break; + case 4: + cdb_len = 16; + break; + case 5: + cdb_len = 12; + break; + } - /* - * We should probably use csio_build_visit or something like that - * here, but it's easier to encode arguments as you go. The - * alternative would be skipping the CDB argument and then encoding - * it here, since we've got the data buffer argument by now. - */ - bcopy(cdb, &ccb->csio.cdb_io.cdb_bytes, cdb_len); + /* + * We should probably use csio_build_visit or something like that + * here, but it's easier to encode arguments as you go. The + * alternative would be skipping the CDB argument and then encoding + * it here, since we've got the data buffer argument by now. + */ + bcopy(cdb, &ccb->csio.cdb_io.cdb_bytes, cdb_len); - cam_fill_csio(&ccb->csio, + cam_fill_csio(&ccb->csio, /*retries*/ retry_count, /*cbfcnp*/ NULL, /*flags*/ flags, @@ -2279,6 +2315,21 @@ scsicmd(struct cam_device *device, int a /*sense_len*/ SSD_FULL_SIZE, /*cdb_len*/ cdb_len, /*timeout*/ timeout ? timeout : 5000); + } else { + atacmd_len = 12; + bcopy(atacmd, &ccb->ataio.cmd.command, atacmd_len); + if (need_res) + ccb->ataio.cmd.flags |= CAM_ATAIO_NEEDRESULT; + + cam_fill_ataio(&ccb->ataio, + /*retries*/ retry_count, + /*cbfcnp*/ NULL, + /*flags*/ flags, + /*tag_action*/ 0, + /*data_ptr*/ data_ptr, + /*dxfer_len*/ data_bytes, + /*timeout*/ timeout ? timeout : 5000); + } if (((retval = cam_send_ccb(device, ccb)) < 0) || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) { @@ -2296,6 +2347,28 @@ scsicmd(struct cam_device *device, int a goto scsicmd_bailout; } + if (atacmd_len && need_res) { + if (fd_res == 0) { + buff_decode_visit(&ccb->ataio.res.status, 11, resstr, + arg_put, NULL); + fprintf(stdout, "\n"); + } else { + fprintf(stdout, + "%02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", + ccb->ataio.res.status, + ccb->ataio.res.error, + ccb->ataio.res.lba_low, + ccb->ataio.res.lba_mid, + ccb->ataio.res.lba_high, + ccb->ataio.res.device, + ccb->ataio.res.lba_low_exp, + ccb->ataio.res.lba_mid_exp, + ccb->ataio.res.lba_high_exp, + ccb->ataio.res.sector_count, + ccb->ataio.res.sector_count_exp); + fflush(stdout); + } + } if (((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) && (arglist & CAM_ARG_CMD_IN) @@ -4029,8 +4102,9 @@ usage(int verbose) " camcontrol defects [dev_id][generic args] <-f format> [-P][-G]\n" " camcontrol modepage [dev_id][generic args] <-m page | -l>\n" " [-P pagectl][-e | -b][-d]\n" -" camcontrol cmd [dev_id][generic args] <-c cmd [args]>\n" -" [-i len fmt|-o len fmt [args]]\n" +" camcontrol cmd [dev_id][generic args]\n" +" <-a cmd [args] | -c cmd [args]>\n" +" [-i len fmt|-o len fmt [args]] [-r fmt]\n" " camcontrol debug [-I][-P][-T][-S][-X][-c]\n" " \n" " camcontrol tags [dev_id][generic args] [-N tags] [-q] [-v]\n" From mav at FreeBSD.org Sun Sep 6 14:23:27 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Sun Sep 6 14:23:32 2009 Subject: svn commit: r196893 - head/sys/dev/ata Message-ID: <200909061423.n86ENQ0p086193@svn.freebsd.org> Author: mav Date: Sun Sep 6 14:23:26 2009 New Revision: 196893 URL: http://svn.freebsd.org/changeset/base/196893 Log: Remove constraint, requiring request data to fulfill controller's alignment requirements. It is busdma task, to manage proper alignment by loading data to bounce buffers. PR: kern/127316 Reviewed by: current@ Tested by: Ryan Rogers Modified: head/sys/dev/ata/ata-dma.c Modified: head/sys/dev/ata/ata-dma.c ============================================================================== --- head/sys/dev/ata/ata-dma.c Sun Sep 6 14:05:01 2009 (r196892) +++ head/sys/dev/ata/ata-dma.c Sun Sep 6 14:23:26 2009 (r196893) @@ -272,10 +272,10 @@ ata_dmaload(struct ata_request *request, "FAILURE - zero length DMA transfer attempted\n"); return EIO; } - if (((uintptr_t)(request->data) & (ch->dma.alignment - 1)) || - (request->bytecount & (ch->dma.alignment - 1))) { + if (request->bytecount & (ch->dma.alignment - 1)) { device_printf(request->dev, - "FAILURE - non aligned DMA transfer attempted\n"); + "FAILURE - odd-sized DMA transfer attempt %d %% %d\n", + request->bytecount, ch->dma.alignment); return EIO; } if (request->bytecount > ch->dma.max_iosize) { From kib at FreeBSD.org Sun Sep 6 15:23:03 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Sun Sep 6 15:23:15 2009 Subject: svn commit: r196894 - stable/7/sys/vm Message-ID: <200909061523.n86FN3QP087453@svn.freebsd.org> Author: kib Date: Sun Sep 6 15:23:03 2009 New Revision: 196894 URL: http://svn.freebsd.org/changeset/base/196894 Log: Partial MFC of r194459 by thompsa, without merge recording, to allow the vm_phys_paddr_to_vm_page(9) to return NULL instead of panicking when supplied physical address does not correspond to a vm page. This is needed for device pager (and not yet merged sg pager) to skip memattr checks on specific addresses. Reported by: Thierry Herbelot Modified: stable/7/sys/vm/vm_phys.c Modified: stable/7/sys/vm/vm_phys.c ============================================================================== --- stable/7/sys/vm/vm_phys.c Sun Sep 6 14:23:26 2009 (r196893) +++ stable/7/sys/vm/vm_phys.c Sun Sep 6 15:23:03 2009 (r196894) @@ -382,8 +382,7 @@ vm_phys_paddr_to_vm_page(vm_paddr_t pa) if (pa >= seg->start && pa < seg->end) return (&seg->first_page[atop(pa - seg->start)]); } - panic("vm_phys_paddr_to_vm_page: paddr %#jx is not in any segment", - (uintmax_t)pa); + return (NULL); } /* From bz at FreeBSD.org Sun Sep 6 16:25:08 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Sun Sep 6 16:25:14 2009 Subject: svn commit: r196883 - head/sys/netipsec In-Reply-To: <200909060732.n867WGwc076608@svn.freebsd.org> References: <200909060732.n867WGwc076608@svn.freebsd.org> Message-ID: <20090906162102.Q68375@maildrop.int.zabbadoz.net> On Sun, 6 Sep 2009, Pawel Jakub Dawidek wrote: > Author: pjd > Date: Sun Sep 6 07:32:16 2009 > New Revision: 196883 > URL: http://svn.freebsd.org/changeset/base/196883 > > Log: > Improve code a bit by eliminating goto and having one unlock per lock. This does not coompile anymore: HEAD.svn/sys/netipsec/key.c: In function 'key_checkrequest': HEAD.svn/sys/netipsec/key.c: warning: 'state_valid' may be used uninitialized in this function HEAD.svn/sys/netipsec/key.c: note: 'state_valid' was declared here > Modified: > head/sys/netipsec/key.c > > Modified: head/sys/netipsec/key.c > ============================================================================== > --- head/sys/netipsec/key.c Sun Sep 6 07:30:21 2009 (r196882) > +++ head/sys/netipsec/key.c Sun Sep 6 07:32:16 2009 (r196883) > @@ -918,15 +918,14 @@ key_allocsa_policy(const struct secasind > state_valid = saorder_state_valid_prefer_new; > arraysize = N(saorder_state_valid_prefer_new); > } > - SAHTREE_UNLOCK(); > - goto found; > + break; > } > } > SAHTREE_UNLOCK(); > > - return NULL; > + if (sah == NULL) > + return NULL; > > - found: > /* search valid state */ > for (stateidx = 0; stateidx < arraysize; stateidx++) { > sav = key_do_allocsa_policy(sah, state_valid[stateidx]); > -- Bjoern A. Zeeb What was I talking about and who are you again? From pjd at FreeBSD.org Sun Sep 6 18:09:26 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Sun Sep 6 18:09:32 2009 Subject: svn commit: r196896 - head/sys/netipsec Message-ID: <200909061809.n86I9Q3m090683@svn.freebsd.org> Author: pjd Date: Sun Sep 6 18:09:25 2009 New Revision: 196896 URL: http://svn.freebsd.org/changeset/base/196896 Log: Initialize state_valid and arraysize variable so gcc won't complain. Reported by: bz Modified: head/sys/netipsec/key.c Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Sun Sep 6 17:24:15 2009 (r196895) +++ head/sys/netipsec/key.c Sun Sep 6 18:09:25 2009 (r196896) @@ -906,6 +906,9 @@ key_allocsa_policy(const struct secasind u_int stateidx, arraysize; const u_int *state_valid; + state_valid = NULL; /* silent gcc */ + arraysize = 0; /* silent gcc */ + SAHTREE_LOCK(); LIST_FOREACH(sah, &V_sahtree, chain) { if (sah->state == SADB_SASTATE_DEAD) @@ -922,7 +925,6 @@ key_allocsa_policy(const struct secasind } } SAHTREE_UNLOCK(); - if (sah == NULL) return NULL; From mav at FreeBSD.org Sun Sep 6 18:40:49 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Sun Sep 6 18:40:56 2009 Subject: svn commit: r196897 - head/sys/cam Message-ID: <200909061840.n86IemhT091296@svn.freebsd.org> Author: mav Date: Sun Sep 6 18:40:48 2009 New Revision: 196897 URL: http://svn.freebsd.org/changeset/base/196897 Log: Avoid extra swi_sched() call, if this SIM is already queued. It reduces overhead for coalesced command completions. Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Sun Sep 6 18:09:25 2009 (r196896) +++ head/sys/cam/cam_xpt.c Sun Sep 6 18:40:48 2009 (r196897) @@ -4198,12 +4198,12 @@ xpt_done(union ccb *done_ccb) mtx_lock(&cam_simq_lock); TAILQ_INSERT_TAIL(&cam_simq, sim, links); - sim->flags |= CAM_SIM_ON_DONEQ; mtx_unlock(&cam_simq_lock); + sim->flags |= CAM_SIM_ON_DONEQ; + if ((done_ccb->ccb_h.path->periph->flags & + CAM_PERIPH_POLLED) == 0) + swi_sched(cambio_ih, 0); } - if ((done_ccb->ccb_h.path->periph->flags & - CAM_PERIPH_POLLED) == 0) - swi_sched(cambio_ih, 0); break; default: panic("unknown periph type %d", @@ -4889,16 +4889,20 @@ camisr(void *dummy) mtx_lock(&cam_simq_lock); TAILQ_INIT(&queue); - TAILQ_CONCAT(&queue, &cam_simq, links); - mtx_unlock(&cam_simq_lock); - - while ((sim = TAILQ_FIRST(&queue)) != NULL) { - TAILQ_REMOVE(&queue, sim, links); - CAM_SIM_LOCK(sim); - sim->flags &= ~CAM_SIM_ON_DONEQ; - camisr_runqueue(&sim->sim_doneq); - CAM_SIM_UNLOCK(sim); + while (!TAILQ_EMPTY(&cam_simq)) { + TAILQ_CONCAT(&queue, &cam_simq, links); + mtx_unlock(&cam_simq_lock); + + while ((sim = TAILQ_FIRST(&queue)) != NULL) { + TAILQ_REMOVE(&queue, sim, links); + CAM_SIM_LOCK(sim); + sim->flags &= ~CAM_SIM_ON_DONEQ; + camisr_runqueue(&sim->sim_doneq); + CAM_SIM_UNLOCK(sim); + } + mtx_lock(&cam_simq_lock); } + mtx_unlock(&cam_simq_lock); } static void From mav at FreeBSD.org Sun Sep 6 18:48:20 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Sun Sep 6 18:48:31 2009 Subject: svn commit: r196898 - head/sys/cam Message-ID: <200909061848.n86ImI08091537@svn.freebsd.org> Author: mav Date: Sun Sep 6 18:48:18 2009 New Revision: 196898 URL: http://svn.freebsd.org/changeset/base/196898 Log: MFp4: Report scbusX in xpt_announce_periph() to less confuse users by two different bus addressing schemes. Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Sun Sep 6 18:40:48 2009 (r196897) +++ head/sys/cam/cam_xpt.c Sun Sep 6 18:48:18 2009 (r196898) @@ -1033,11 +1033,12 @@ xpt_announce_periph(struct cam_periph *p * To ensure that this is printed in one piece, * mask out CAM interrupts. */ - printf("%s%d at %s%d bus %d target %d lun %d\n", + printf("%s%d at %s%d bus %d scbus%d target %d lun %d\n", periph->periph_name, periph->unit_number, path->bus->sim->sim_name, path->bus->sim->unit_number, path->bus->sim->bus_id, + path->bus->path_id, path->target->target_id, path->device->lun_id); printf("%s%d: ", periph->periph_name, periph->unit_number); From mav at FreeBSD.org Sun Sep 6 18:56:08 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Sun Sep 6 18:56:15 2009 Subject: svn commit: r196900 - head/sys/cam Message-ID: <200909061856.n86Iu86d091765@svn.freebsd.org> Author: mav Date: Sun Sep 6 18:56:08 2009 New Revision: 196900 URL: http://svn.freebsd.org/changeset/base/196900 Log: s/bus %d/scbus%d/ in some messages to correct terminology. Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Sun Sep 6 18:49:45 2009 (r196899) +++ head/sys/cam/cam_xpt.c Sun Sep 6 18:56:08 2009 (r196900) @@ -4605,7 +4605,7 @@ xptconfigfunc(struct cam_eb *bus, void * CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD)) !=CAM_REQ_CMP){ printf("xptconfigfunc: xpt_create_path failed with " - "status %#x for bus %d\n", status, bus->path_id); + "status %#x for scbus%d\n", status, bus->path_id); printf("xptconfigfunc: halting bus configuration\n"); xpt_free_ccb(work_ccb); busses_to_config--; @@ -4616,7 +4616,7 @@ xptconfigfunc(struct cam_eb *bus, void * work_ccb->ccb_h.func_code = XPT_PATH_INQ; xpt_action(work_ccb); if (work_ccb->ccb_h.status != CAM_REQ_CMP) { - printf("xptconfigfunc: CPI failed on bus %d " + printf("xptconfigfunc: CPI failed on scbus%d " "with status %d\n", bus->path_id, work_ccb->ccb_h.status); xpt_finishconfig(xpt_periph, work_ccb); From mav at FreeBSD.org Sun Sep 6 18:59:46 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Sun Sep 6 18:59:58 2009 Subject: svn commit: r196901 - head/sys/cam Message-ID: <200909061859.n86IxkrW091861@svn.freebsd.org> Author: mav Date: Sun Sep 6 18:59:46 2009 New Revision: 196901 URL: http://svn.freebsd.org/changeset/base/196901 Log: Remove unneeded CAM_SIM_MPSAFE check. Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Sun Sep 6 18:56:08 2009 (r196900) +++ head/sys/cam/cam_xpt.c Sun Sep 6 18:59:46 2009 (r196901) @@ -4407,10 +4407,7 @@ xpt_alloc_device(struct cam_eb *bus, str device->tag_delay_count = 0; device->tag_saved_openings = 0; device->refcount = 1; - if (bus->sim->flags & CAM_SIM_MPSAFE) - callout_init_mtx(&device->callout, bus->sim->mtx, 0); - else - callout_init_mtx(&device->callout, &Giant, 0); + callout_init_mtx(&device->callout, bus->sim->mtx, 0); /* * Hold a reference to our parent target so it From pjd at FreeBSD.org Sun Sep 6 19:05:04 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Sun Sep 6 19:05:10 2009 Subject: svn commit: r196902 - head/sys/netipsec Message-ID: <200909061905.n86J53wQ092011@svn.freebsd.org> Author: pjd Date: Sun Sep 6 19:05:03 2009 New Revision: 196902 URL: http://svn.freebsd.org/changeset/base/196902 Log: Silent gcc? Yeah, you wish. What I ment was to silence gcc. Spotted by: julian Modified: head/sys/netipsec/key.c Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Sun Sep 6 18:59:46 2009 (r196901) +++ head/sys/netipsec/key.c Sun Sep 6 19:05:03 2009 (r196902) @@ -906,8 +906,8 @@ key_allocsa_policy(const struct secasind u_int stateidx, arraysize; const u_int *state_valid; - state_valid = NULL; /* silent gcc */ - arraysize = 0; /* silent gcc */ + state_valid = NULL; /* silence gcc */ + arraysize = 0; /* silence gcc */ SAHTREE_LOCK(); LIST_FOREACH(sah, &V_sahtree, chain) { From mav at FreeBSD.org Sun Sep 6 19:06:51 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Sun Sep 6 19:07:02 2009 Subject: svn commit: r196903 - head/sys/cam Message-ID: <200909061906.n86J6oKC092073@svn.freebsd.org> Author: mav Date: Sun Sep 6 19:06:50 2009 New Revision: 196903 URL: http://svn.freebsd.org/changeset/base/196903 Log: MFp4: Remove duplicate qfrozen_cnt variable from struct cam_ed. ccbq.queue.qfrozen_cnt should be used instead. Modified: head/sys/cam/cam_xpt.c head/sys/cam/cam_xpt_internal.h Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Sun Sep 6 19:05:03 2009 (r196902) +++ head/sys/cam/cam_xpt.c Sun Sep 6 19:06:50 2009 (r196903) @@ -2472,7 +2472,7 @@ xpt_action_default(union ccb *start_ccb) path = start_ccb->ccb_h.path; cam_ccbq_insert_ccb(&path->device->ccbq, start_ccb); - if (path->device->qfrozen_cnt == 0) + if (path->device->ccbq.queue.qfrozen_cnt == 0) runq = xpt_schedule_dev_sendq(path->bus, path->device); else runq = 0; @@ -2931,7 +2931,7 @@ xpt_action_default(union ccb *start_ccb) xpt_release_devq(crs->ccb_h.path, /*count*/1, /*run_queue*/TRUE); } - start_ccb->crs.qfrozen_cnt = dev->qfrozen_cnt; + start_ccb->crs.qfrozen_cnt = dev->ccbq.queue.qfrozen_cnt; start_ccb->ccb_h.status = CAM_REQ_CMP; break; } @@ -3227,7 +3227,7 @@ xpt_run_dev_sendq(struct cam_eb *bus) * If the device has been "frozen", don't attempt * to run it. */ - if (device->qfrozen_cnt > 0) { + if (device->ccbq.queue.qfrozen_cnt > 0) { continue; } @@ -3250,7 +3250,7 @@ xpt_run_dev_sendq(struct cam_eb *bus) * the device queue until we have a slot * available. */ - device->qfrozen_cnt++; + device->ccbq.queue.qfrozen_cnt++; STAILQ_INSERT_TAIL(&xsoftc.highpowerq, &work_ccb->ccb_h, xpt_links.stqe); @@ -3282,7 +3282,7 @@ xpt_run_dev_sendq(struct cam_eb *bus) * The client wants to freeze the queue * after this CCB is sent. */ - device->qfrozen_cnt++; + device->ccbq.queue.qfrozen_cnt++; } /* In Target mode, the peripheral driver knows best... */ @@ -4031,7 +4031,7 @@ xpt_freeze_devq(struct cam_path *path, u mtx_assert(path->bus->sim->mtx, MA_OWNED); - path->device->qfrozen_cnt += count; + path->device->ccbq.queue.qfrozen_cnt += count; /* * Mark the last CCB in the queue as needing @@ -4049,7 +4049,7 @@ xpt_freeze_devq(struct cam_path *path, u ccbh = TAILQ_LAST(&path->device->ccbq.active_ccbs, ccb_hdr_tailq); if (ccbh && ccbh->status == CAM_REQ_INPROG) ccbh->status = CAM_REQUEUE_REQ; - return (path->device->qfrozen_cnt); + return (path->device->ccbq.queue.qfrozen_cnt); } u_int32_t @@ -4093,11 +4093,12 @@ xpt_release_devq_device(struct cam_ed *d int rundevq; rundevq = 0; - if (dev->qfrozen_cnt > 0) { + if (dev->ccbq.queue.qfrozen_cnt > 0) { - count = (count > dev->qfrozen_cnt) ? dev->qfrozen_cnt : count; - dev->qfrozen_cnt -= count; - if (dev->qfrozen_cnt == 0) { + count = (count > dev->ccbq.queue.qfrozen_cnt) ? + dev->ccbq.queue.qfrozen_cnt : count; + dev->ccbq.queue.qfrozen_cnt -= count; + if (dev->ccbq.queue.qfrozen_cnt == 0) { /* * No longer need to wait for a successful @@ -4402,7 +4403,6 @@ xpt_alloc_device(struct cam_eb *bus, str SLIST_INIT(&device->periphs); device->generation = 0; device->owner = NULL; - device->qfrozen_cnt = 0; device->flags = CAM_DEV_UNCONFIGURED; device->tag_delay_count = 0; device->tag_saved_openings = 0; @@ -4971,7 +4971,7 @@ camisr_runqueue(void *V_queue) xpt_start_tags(ccb_h->path); if ((dev->ccbq.queue.entries > 0) - && (dev->qfrozen_cnt == 0) + && (dev->ccbq.queue.qfrozen_cnt == 0) && (device_is_send_queued(dev) == 0)) { runq = xpt_schedule_dev_sendq(ccb_h->path->bus, dev); Modified: head/sys/cam/cam_xpt_internal.h ============================================================================== --- head/sys/cam/cam_xpt_internal.h Sun Sep 6 19:05:03 2009 (r196902) +++ head/sys/cam/cam_xpt_internal.h Sun Sep 6 19:06:50 2009 (r196903) @@ -106,7 +106,6 @@ struct cam_ed { u_int8_t queue_flags; /* Queue flags from the control page */ u_int8_t serial_num_len; u_int8_t *serial_num; - u_int32_t qfrozen_cnt; u_int32_t flags; #define CAM_DEV_UNCONFIGURED 0x01 #define CAM_DEV_REL_TIMEOUT_PENDING 0x02 From mav at FreeBSD.org Sun Sep 6 19:33:13 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Sun Sep 6 19:33:25 2009 Subject: svn commit: r196904 - head/sys/geom Message-ID: <200909061933.n86JXD97092578@svn.freebsd.org> Author: mav Date: Sun Sep 6 19:33:13 2009 New Revision: 196904 URL: http://svn.freebsd.org/changeset/base/196904 Log: MFp4: Remove msleep() timeout from g_io_schedule_up/down(). It works fine without it, saving few percents of CPU on high request rates without need to rearm callout twice per request. Modified: head/sys/geom/geom_io.c Modified: head/sys/geom/geom_io.c ============================================================================== --- head/sys/geom/geom_io.c Sun Sep 6 19:06:50 2009 (r196903) +++ head/sys/geom/geom_io.c Sun Sep 6 19:33:13 2009 (r196904) @@ -567,7 +567,7 @@ g_io_schedule_down(struct thread *tp __u if (bp == NULL) { CTR0(KTR_GEOM, "g_down going to sleep"); msleep(&g_wait_down, &g_bio_run_down.bio_queue_lock, - PRIBIO | PDROP, "-", hz/10); + PRIBIO | PDROP, "-", 0); continue; } CTR0(KTR_GEOM, "g_down has work to do"); @@ -672,7 +672,7 @@ g_io_schedule_up(struct thread *tp __unu } CTR0(KTR_GEOM, "g_up going to sleep"); msleep(&g_wait_up, &g_bio_run_up.bio_queue_lock, - PRIBIO | PDROP, "-", hz/10); + PRIBIO | PDROP, "-", 0); } } From mav at FreeBSD.org Sun Sep 6 21:22:25 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Sun Sep 6 21:22:31 2009 Subject: svn commit: r196907 - head/sys/dev/ahci Message-ID: <200909062122.n86LMOvK094808@svn.freebsd.org> Author: mav Date: Sun Sep 6 21:22:24 2009 New Revision: 196907 URL: http://svn.freebsd.org/changeset/base/196907 Log: To save small bit of CPU time, hide part of SNTF register read latency behind other reads. Modified: head/sys/dev/ahci/ahci.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Sun Sep 6 20:32:16 2009 (r196906) +++ head/sys/dev/ahci/ahci.c Sun Sep 6 21:22:24 2009 (r196907) @@ -891,16 +891,12 @@ ahci_phy_check_events(device_t dev) } static void -ahci_notify_events(device_t dev) +ahci_notify_events(device_t dev, u_int32_t status) { struct ahci_channel *ch = device_get_softc(dev); struct cam_path *dpath; - u_int32_t status; int i; - status = ATA_INL(ch->r_mem, AHCI_P_SNTF); - if (status == 0) - return; ATA_OUTL(ch->r_mem, AHCI_P_SNTF, status); if (bootverbose) device_printf(dev, "SNTF 0x%04x\n", status); @@ -948,7 +944,7 @@ ahci_ch_intr(void *data) { device_t dev = (device_t)data; struct ahci_channel *ch = device_get_softc(dev); - uint32_t istatus, cstatus, sstatus, ok, err; + uint32_t istatus, sstatus, cstatus, sntf = 0, ok, err; enum ahci_err_type et; int i, ccs, ncq_err = 0; @@ -958,8 +954,10 @@ ahci_ch_intr(void *data) return; ATA_OUTL(ch->r_mem, AHCI_P_IS, istatus); /* Read command statuses. */ - cstatus = ATA_INL(ch->r_mem, AHCI_P_CI); sstatus = ATA_INL(ch->r_mem, AHCI_P_SACT); + cstatus = ATA_INL(ch->r_mem, AHCI_P_CI); + if ((istatus & AHCI_P_IX_SDB) && (ch->caps & AHCI_CAP_SSNTF)) + sntf = ATA_INL(ch->r_mem, AHCI_P_SNTF); /* Process PHY events */ if (istatus & (AHCI_P_IX_PRC | AHCI_P_IX_PC)) ahci_phy_check_events(dev); @@ -1023,8 +1021,8 @@ ahci_ch_intr(void *data) ahci_issue_read_log(dev); } /* Process NOTIFY events */ - if ((istatus & AHCI_P_IX_SDB) && (ch->caps & AHCI_CAP_SSNTF)) - ahci_notify_events(dev); + if (sntf) + ahci_notify_events(dev, sntf); } /* Must be called with channel locked. */ From pjd at FreeBSD.org Mon Sep 7 06:37:45 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Mon Sep 7 06:37:51 2009 Subject: svn commit: r196911 - head/usr.bin/tar Message-ID: <200909070637.n876bidG005754@svn.freebsd.org> Author: pjd Date: Mon Sep 7 06:37:44 2009 New Revision: 196911 URL: http://svn.freebsd.org/changeset/base/196911 Log: Make sure to use up-to-date libarchive header files from source tree when compiling tar and not the ones from /usr/include/. Reviewed by: kientzle Approved by: kientzle Modified: head/usr.bin/tar/Makefile Modified: head/usr.bin/tar/Makefile ============================================================================== --- head/usr.bin/tar/Makefile Mon Sep 7 00:49:00 2009 (r196910) +++ head/usr.bin/tar/Makefile Mon Sep 7 06:37:44 2009 (r196911) @@ -12,7 +12,7 @@ LDADD+= -lcrypto .endif CFLAGS+= -DBSDTAR_VERSION_STRING=\"${BSDTAR_VERSION_STRING}\" CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\" -CFLAGS+= -I${.CURDIR} +CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../../lib/libarchive SYMLINKS= bsdtar ${BINDIR}/tar MLINKS= bsdtar.1 tar.1 DEBUG_FLAGS=-g From attilio at FreeBSD.org Mon Sep 7 08:37:25 2009 From: attilio at FreeBSD.org (Attilio Rao) Date: Mon Sep 7 08:37:37 2009 Subject: svn commit: r196912 - in stable/7/sys: kern sys Message-ID: <200909070837.n878bP79008232@svn.freebsd.org> Author: attilio Date: Mon Sep 7 08:37:25 2009 New Revision: 196912 URL: http://svn.freebsd.org/changeset/base/196912 Log: MFC r196334: Add the macro ASSERT_ATOMIC_LOAD_PTR(), enabled through INVARIANTS, which asserts for the correct alignment of datas which need to be read atomically without locks. Use that macro in locking primitives. Modified: stable/7/sys/kern/kern_mutex.c stable/7/sys/kern/kern_rwlock.c stable/7/sys/kern/kern_sx.c stable/7/sys/sys/systm.h Modified: stable/7/sys/kern/kern_mutex.c ============================================================================== --- stable/7/sys/kern/kern_mutex.c Mon Sep 7 06:37:44 2009 (r196911) +++ stable/7/sys/kern/kern_mutex.c Mon Sep 7 08:37:25 2009 (r196912) @@ -724,6 +724,9 @@ mtx_init(struct mtx *m, const char *name MPASS((opts & ~(MTX_SPIN | MTX_QUIET | MTX_RECURSE | MTX_NOWITNESS | MTX_DUPOK | MTX_NOPROFILE)) == 0); + ASSERT_ATOMIC_LOAD_PTR(m->mtx_lock, + ("%s: mtx_lock not aligned for %s:%p", __func__, name, + &m->mtx_lock)); #ifdef MUTEX_DEBUG /* Diagnostic and error correction */ Modified: stable/7/sys/kern/kern_rwlock.c ============================================================================== --- stable/7/sys/kern/kern_rwlock.c Mon Sep 7 06:37:44 2009 (r196911) +++ stable/7/sys/kern/kern_rwlock.c Mon Sep 7 08:37:25 2009 (r196912) @@ -137,6 +137,9 @@ rw_init_flags(struct rwlock *rw, const c MPASS((opts & ~(RW_DUPOK | RW_NOPROFILE | RW_NOWITNESS | RW_QUIET | RW_RECURSE)) == 0); + ASSERT_ATOMIC_LOAD_PTR(rw->rw_lock, + ("%s: rw_lock not aligned for %s:%p", __func__, name, + &rw->rw_lock)); flags = LO_UPGRADABLE | LO_RECURSABLE; if (opts & RW_DUPOK) Modified: stable/7/sys/kern/kern_sx.c ============================================================================== --- stable/7/sys/kern/kern_sx.c Mon Sep 7 06:37:44 2009 (r196911) +++ stable/7/sys/kern/kern_sx.c Mon Sep 7 08:37:25 2009 (r196912) @@ -166,6 +166,9 @@ sx_init_flags(struct sx *sx, const char MPASS((opts & ~(SX_QUIET | SX_RECURSE | SX_NOWITNESS | SX_DUPOK | SX_NOPROFILE | SX_ADAPTIVESPIN)) == 0); + ASSERT_ATOMIC_LOAD_PTR(sx->sx_lock, + ("%s: sx_lock not aligned for %s:%p", __func__, description, + &sx->sx_lock)); flags = LO_RECURSABLE | LO_SLEEPABLE | LO_UPGRADABLE; if (opts & SX_DUPOK) Modified: stable/7/sys/sys/systm.h ============================================================================== --- stable/7/sys/sys/systm.h Mon Sep 7 06:37:44 2009 (r196911) +++ stable/7/sys/sys/systm.h Mon Sep 7 08:37:25 2009 (r196912) @@ -96,6 +96,17 @@ extern int maxusers; /* system tune hin #endif /* + * Assert that a pointer can be loaded from memory atomically. + * + * This assertion enforces stronger alignment than necessary. For example, + * on some architectures, atomicity for unaligned loads will depend on + * whether or not the load spans multiple cache lines. + */ +#define ASSERT_ATOMIC_LOAD_PTR(var, msg) \ + KASSERT(sizeof(var) == sizeof(void *) && \ + ((uintptr_t)&(var) & (sizeof(void *) - 1)) == 0, msg) + +/* * XXX the hints declarations are even more misplaced than most declarations * in this file, since they are needed in one file (per arch) and only used * in two files. From attilio at FreeBSD.org Mon Sep 7 08:41:15 2009 From: attilio at FreeBSD.org (Attilio Rao) Date: Mon Sep 7 08:41:22 2009 Subject: svn commit: r196913 - stable/7/lib/libthr/thread Message-ID: <200909070841.n878fE6M008345@svn.freebsd.org> Author: attilio Date: Mon Sep 7 08:41:14 2009 New Revision: 196913 URL: http://svn.freebsd.org/changeset/base/196913 Log: MFC r195403: Fix a bug in read lock acquisition for rwlocks by bumping rdlock_count when a successfull rwlock_rdlock_common() take place. Modified: stable/7/lib/libthr/thread/thr_rtld.c stable/7/lib/libthr/thread/thr_rwlock.c Modified: stable/7/lib/libthr/thread/thr_rtld.c ============================================================================== --- stable/7/lib/libthr/thread/thr_rtld.c Mon Sep 7 08:37:25 2009 (r196912) +++ stable/7/lib/libthr/thread/thr_rtld.c Mon Sep 7 08:41:14 2009 (r196913) @@ -116,6 +116,7 @@ _thr_rtld_rlock_acquire(void *lock) THR_CRITICAL_ENTER(curthread); while (_thr_rwlock_rdlock(&l->lock, 0, NULL) != 0) ; + curthread->rdlock_count++; RESTORE_ERRNO(); } @@ -150,6 +151,7 @@ _thr_rtld_lock_release(void *lock) state = l->lock.rw_state; if (_thr_rwlock_unlock(&l->lock) == 0) { + curthread->rdlock_count--; if ((state & URWLOCK_WRITE_OWNER) == 0) { THR_CRITICAL_LEAVE(curthread); } else { Modified: stable/7/lib/libthr/thread/thr_rwlock.c ============================================================================== --- stable/7/lib/libthr/thread/thr_rwlock.c Mon Sep 7 08:37:25 2009 (r196912) +++ stable/7/lib/libthr/thread/thr_rwlock.c Mon Sep 7 08:41:14 2009 (r196913) @@ -177,10 +177,11 @@ rwlock_rdlock_common(pthread_rwlock_t *r /* if interrupted, try to lock it in userland again. */ if (_thr_rwlock_tryrdlock(&prwlock->lock, flags) == 0) { ret = 0; - curthread->rdlock_count++; break; } } + if (ret == 0) + curthread->rdlock_count++; return (ret); } From attilio at FreeBSD.org Mon Sep 7 08:46:27 2009 From: attilio at FreeBSD.org (Attilio Rao) Date: Mon Sep 7 08:46:33 2009 Subject: svn commit: r196914 - stable/7/usr.sbin/tzsetup Message-ID: <200909070846.n878kQLe008508@svn.freebsd.org> Author: attilio Date: Mon Sep 7 08:46:26 2009 New Revision: 196914 URL: http://svn.freebsd.org/changeset/base/196914 Log: MFC r195339: Add a new option (-s) that, when specified, skips the question about adjusting the clock to UTC. Sponsored by: Sandvine Incorporated Modified: stable/7/usr.sbin/tzsetup/tzsetup.8 stable/7/usr.sbin/tzsetup/tzsetup.c Modified: stable/7/usr.sbin/tzsetup/tzsetup.8 ============================================================================== --- stable/7/usr.sbin/tzsetup/tzsetup.8 Mon Sep 7 08:41:14 2009 (r196913) +++ stable/7/usr.sbin/tzsetup/tzsetup.8 Mon Sep 7 08:46:26 2009 (r196914) @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd January 24, 1996 +.Dd September 05, 2009 .Dt TZSETUP 8 .Os .Sh NAME @@ -31,7 +31,7 @@ .Nd set local timezone .Sh SYNOPSIS .Nm -.Op Fl n +.Op Fl ns .Op Ar default .Sh DESCRIPTION The @@ -51,6 +51,9 @@ The following option is available: .Bl -tag -offset indent -width Fl .It Fl n Do not create or copy files. +.It Fl s +Skip the initial question about adjusting the clock if not set to +.Tn UTC . .El .Pp It is possible to short-circuit the menu system by specifying a Modified: stable/7/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/7/usr.sbin/tzsetup/tzsetup.c Mon Sep 7 08:41:14 2009 (r196913) +++ stable/7/usr.sbin/tzsetup/tzsetup.c Mon Sep 7 08:46:26 2009 (r196914) @@ -648,11 +648,14 @@ main(int argc, char **argv) dialog_utc = dialog_noyes; #endif - while ((c = getopt(argc, argv, "n")) != -1) { + while ((c = getopt(argc, argv, "ns")) != -1) { switch(c) { case 'n': reallydoit = 0; break; + case 's': + dialog_utc = NULL; + break; default: usage(); @@ -671,22 +674,25 @@ main(int argc, char **argv) make_menus(); init_dialog(); - if (!dialog_utc("Select local or UTC (Greenwich Mean Time) clock", - "Is this machine's CMOS clock set to UTC? If it is set to local time,\n" - "or you don't know, please choose NO here!", 7, 72)) { - if (reallydoit) - unlink(_PATH_WALL_CMOS_CLOCK); - } else { - if (reallydoit) { - fd = open(_PATH_WALL_CMOS_CLOCK, - O_WRONLY|O_CREAT|O_TRUNC, - S_IRUSR|S_IRGRP|S_IROTH); - if (fd < 0) - err(1, "create %s", _PATH_WALL_CMOS_CLOCK); - close(fd); + if (dialog_utc != NULL) { + if (!dialog_utc("Select local or UTC (Greenwich Mean Time) clock", + "Is this machine's CMOS clock set to UTC? If it is set to local time,\n" + "or you don't know, please choose NO here!", 7, 72)) { + if (reallydoit) + unlink(_PATH_WALL_CMOS_CLOCK); + } else { + if (reallydoit) { + fd = open(_PATH_WALL_CMOS_CLOCK, + O_WRONLY|O_CREAT|O_TRUNC, + S_IRUSR|S_IRGRP|S_IROTH); + if (fd < 0) + err(1, "create %s", + _PATH_WALL_CMOS_CLOCK); + close(fd); + } } + dialog_clear_norefresh(); } - dialog_clear_norefresh(); if (optind == argc - 1) { char *msg; asprintf(&msg, "\nUse the default `%s' zone?", argv[optind]); From attilio at FreeBSD.org Mon Sep 7 08:52:16 2009 From: attilio at FreeBSD.org (Attilio Rao) Date: Mon Sep 7 08:52:27 2009 Subject: svn commit: r196915 - in stable/7/sys: dev/hwpmc kern Message-ID: <200909070852.n878qFds008667@svn.freebsd.org> Author: attilio Date: Mon Sep 7 08:52:15 2009 New Revision: 196915 URL: http://svn.freebsd.org/changeset/base/196915 Log: MFC r195159 and r195005: * Don't assume a fixed number of preloaded KLDs but calculate at runtime. This avoind ending up into an endless loop. * Fix a LOR between pmc_sx and allproc/proctree locks Sponsored by: Sandvine Incorporated Modified: stable/7/sys/dev/hwpmc/hwpmc_logging.c stable/7/sys/dev/hwpmc/hwpmc_mod.c stable/7/sys/kern/kern_linker.c Modified: stable/7/sys/dev/hwpmc/hwpmc_logging.c ============================================================================== --- stable/7/sys/dev/hwpmc/hwpmc_logging.c Mon Sep 7 08:46:26 2009 (r196914) +++ stable/7/sys/dev/hwpmc/hwpmc_logging.c Mon Sep 7 08:52:15 2009 (r196915) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -552,6 +553,12 @@ pmclog_configure_log(struct pmc_mdep *md int error; struct proc *p; + /* + * As long as it is possible to get a LOR between pmc_sx lock and + * proctree/allproc sx locks used for adding a new process, assure + * the former is not held here. + */ + sx_assert(&pmc_sx, SA_UNLOCKED); PMCDBG(LOG,CFG,1, "config po=%p logfd=%d", po, logfd); p = po->po_owner; Modified: stable/7/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- stable/7/sys/dev/hwpmc/hwpmc_mod.c Mon Sep 7 08:46:26 2009 (r196914) +++ stable/7/sys/dev/hwpmc/hwpmc_mod.c Mon Sep 7 08:52:15 2009 (r196915) @@ -2666,7 +2666,7 @@ static const char *pmc_op_to_name[] = { static int pmc_syscall_handler(struct thread *td, void *syscall_args) { - int error, is_sx_downgraded, op; + int error, is_sx_downgraded, is_sx_locked, op; struct pmc_syscall_args *c; void *arg; @@ -2675,6 +2675,7 @@ pmc_syscall_handler(struct thread *td, v DROP_GIANT(); is_sx_downgraded = 0; + is_sx_locked = 1; c = (struct pmc_syscall_args *) syscall_args; @@ -2723,9 +2724,11 @@ pmc_syscall_handler(struct thread *td, v * a log file configured, flush its buffers and * de-configure it. */ - if (cl.pm_logfd >= 0) + if (cl.pm_logfd >= 0) { + sx_xunlock(&pmc_sx); + is_sx_locked = 0; error = pmclog_configure_log(md, po, cl.pm_logfd); - else if (po->po_flags & PMC_PO_OWNS_LOGFILE) { + } else if (po->po_flags & PMC_PO_OWNS_LOGFILE) { pmclog_process_closelog(po); error = pmclog_flush(po); if (error == 0) { @@ -3776,10 +3779,12 @@ pmc_syscall_handler(struct thread *td, v break; } - if (is_sx_downgraded) - sx_sunlock(&pmc_sx); - else - sx_xunlock(&pmc_sx); + if (is_sx_locked != 0) { + if (is_sx_downgraded) + sx_sunlock(&pmc_sx); + else + sx_xunlock(&pmc_sx); + } if (error) atomic_add_int(&pmc_stats.pm_syscall_errors, 1); Modified: stable/7/sys/kern/kern_linker.c ============================================================================== --- stable/7/sys/kern/kern_linker.c Mon Sep 7 08:46:26 2009 (r196914) +++ stable/7/sys/kern/kern_linker.c Mon Sep 7 08:52:15 2009 (r196915) @@ -1882,62 +1882,41 @@ linker_basename(const char *path) } #ifdef HWPMC_HOOKS - -struct hwpmc_context { - int nobjects; - int nmappings; - struct pmckern_map_in *kobase; -}; - -static int -linker_hwpmc_list_object(linker_file_t lf, void *arg) -{ - struct hwpmc_context *hc; - - hc = arg; - - /* If we run out of mappings, fail. */ - if (hc->nobjects >= hc->nmappings) - return (1); - - /* Save the info for this linker file. */ - hc->kobase[hc->nobjects].pm_file = lf->filename; - hc->kobase[hc->nobjects].pm_address = (uintptr_t)lf->address; - hc->nobjects++; - return (0); -} - /* * Inform hwpmc about the set of kernel modules currently loaded. */ void * linker_hwpmc_list_objects(void) { - struct hwpmc_context hc; + linker_file_t lf; + struct pmckern_map_in *kobase; + int i, nmappings; - hc.nmappings = 15; /* a reasonable default */ + nmappings = 0; + KLD_LOCK(); + TAILQ_FOREACH(lf, &linker_files, link) + nmappings++; - retry: - /* allocate nmappings+1 entries */ - MALLOC(hc.kobase, struct pmckern_map_in *, - (hc.nmappings + 1) * sizeof(struct pmckern_map_in), M_LINKER, - M_WAITOK | M_ZERO); - - hc.nobjects = 0; - if (linker_file_foreach(linker_hwpmc_list_object, &hc) != 0) { - hc.nmappings = hc.nobjects; - FREE(hc.kobase, M_LINKER); - goto retry; + /* Allocate nmappings + 1 entries. */ + kobase = malloc((nmappings + 1) * sizeof(struct pmckern_map_in), + M_LINKER, M_WAITOK | M_ZERO); + i = 0; + TAILQ_FOREACH(lf, &linker_files, link) { + + /* Save the info for this linker file. */ + kobase[i].pm_file = lf->filename; + kobase[i].pm_address = (uintptr_t)lf->address; + i++; } + KLD_UNLOCK(); - KASSERT(hc.nobjects > 0, ("linker_hpwmc_list_objects: no kernel " - "objects?")); + KASSERT(i > 0, ("linker_hwpmc_list_objects: no kernel objects?")); /* The last entry of the malloced area comprises of all zeros. */ - KASSERT(hc.kobase[hc.nobjects].pm_file == NULL, + KASSERT(kobase[i].pm_file == NULL, ("linker_hwpmc_list_objects: last object not NULL")); - return ((void *)hc.kobase); + return ((void *)kobase); } #endif From attilio at FreeBSD.org Mon Sep 7 09:30:38 2009 From: attilio at FreeBSD.org (Attilio Rao) Date: Mon Sep 7 09:30:51 2009 Subject: svn commit: r196916 - head/contrib/gdtoa Message-ID: <200909070930.n879UcSC009647@svn.freebsd.org> Author: attilio Date: Mon Sep 7 09:30:37 2009 New Revision: 196916 URL: http://svn.freebsd.org/changeset/base/196916 Log: Import a vendor fix for a list overrun. This has been considered as a security hole on some specialized ml, but currently the secteam@ doesn't consider that way. Reviewed by: emaste, des Sponsored by: Sandvine Incorporated MFC after: 3 days Modified: head/contrib/gdtoa/gdtoaimp.h head/contrib/gdtoa/misc.c Modified: head/contrib/gdtoa/gdtoaimp.h ============================================================================== --- head/contrib/gdtoa/gdtoaimp.h Mon Sep 7 08:52:15 2009 (r196915) +++ head/contrib/gdtoa/gdtoaimp.h Mon Sep 7 09:30:37 2009 (r196916) @@ -485,7 +485,7 @@ extern pthread_mutex_t __gdtoa_locks[2]; _pthread_mutex_unlock(&__gdtoa_locks[n]); \ } while(0) -#define Kmax 15 +#define Kmax 9 struct Bigint { Modified: head/contrib/gdtoa/misc.c ============================================================================== --- head/contrib/gdtoa/misc.c Mon Sep 7 08:52:15 2009 (r196915) +++ head/contrib/gdtoa/misc.c Mon Sep 7 09:30:37 2009 (r196916) @@ -55,7 +55,9 @@ Balloc #endif ACQUIRE_DTOA_LOCK(0); - if ( (rv = freelist[k]) !=0) { + /* The k > Kmax case does not need ACQUIRE_DTOA_LOCK(0), */ + /* but this case seems very unlikely. */ + if (k <= Kmax && (rv = freelist[k]) !=0) { freelist[k] = rv->next; } else { @@ -65,7 +67,7 @@ Balloc #else len = (sizeof(Bigint) + (x-1)*sizeof(ULong) + sizeof(double) - 1) /sizeof(double); - if (pmem_next - private_mem + len <= PRIVATE_mem) { + if (k <= Kmax && pmem_next - private_mem + len <= PRIVATE_mem) { rv = (Bigint*)pmem_next; pmem_next += len; } @@ -89,10 +91,14 @@ Bfree #endif { if (v) { - ACQUIRE_DTOA_LOCK(0); - v->next = freelist[v->k]; - freelist[v->k] = v; - FREE_DTOA_LOCK(0); + if (v->k > Kmax) + free((void*)v); + else { + ACQUIRE_DTOA_LOCK(0); + v->next = freelist[v->k]; + freelist[v->k] = v; + FREE_DTOA_LOCK(0); + } } } From attilio at FreeBSD.org Mon Sep 7 09:51:24 2009 From: attilio at FreeBSD.org (Attilio Rao) Date: Mon Sep 7 09:51:30 2009 Subject: svn commit: r196917 - in stable/7: bin/ps sys/kern Message-ID: <200909070951.n879pNst010173@svn.freebsd.org> Author: attilio Date: Mon Sep 7 09:51:23 2009 New Revision: 196917 URL: http://svn.freebsd.org/changeset/base/196917 Log: MFC r189078: * Implement ucomm with a dynamic size function in order to print out the threads name also in the case they are not the last one shown. * On AMD64 pointers don't have enough space to be printed. Fix it. * Check a return value for malloc which wasn't checked before Sponsored by: Sandvine Incorporated Modified: stable/7/bin/ps/extern.h stable/7/bin/ps/keyword.c stable/7/bin/ps/print.c stable/7/bin/ps/ps.c stable/7/sys/kern/kern_proc.c Modified: stable/7/bin/ps/extern.h ============================================================================== --- stable/7/bin/ps/extern.h Mon Sep 7 09:30:37 2009 (r196916) +++ stable/7/bin/ps/extern.h Mon Sep 7 09:51:23 2009 (r196917) @@ -39,7 +39,7 @@ extern fixpt_t ccpu; extern int cflag, eval, fscale, nlistread, rawcpu; extern unsigned long mempages; extern time_t now; -extern int sumrusage, termwidth, totwidth; +extern int showthreads, sumrusage, termwidth, totwidth; extern STAILQ_HEAD(velisthead, varent) varlist; __BEGIN_DECLS @@ -71,6 +71,7 @@ void priorityr(KINFO *, VARENT *); void rgroupname(KINFO *, VARENT *); void runame(KINFO *, VARENT *); void rvar(KINFO *, VARENT *); +int s_comm(KINFO *); int s_label(KINFO *); int s_rgroupname(KINFO *); int s_runame(KINFO *); Modified: stable/7/bin/ps/keyword.c ============================================================================== --- stable/7/bin/ps/keyword.c Mon Sep 7 09:30:37 2009 (r196916) +++ stable/7/bin/ps/keyword.c Mon Sep 7 09:51:23 2009 (r196917) @@ -79,8 +79,8 @@ static VAR var[] = { CHAR, NULL, 0}, {"blocked", "", "sigmask", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, {"caught", "", "sigcatch", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, - {"comm", "COMMAND", NULL, LJUST, ucomm, NULL, MAXCOMLEN, 0, CHAR, - NULL, 0}, + {"comm", "COMMAND", NULL, LJUST|DSIZ, ucomm, s_comm, + COMMLEN + OCOMMLEN + 1, 0, CHAR, NULL, 0}, {"command", "COMMAND", NULL, COMM|LJUST|USER, command, NULL, 16, 0, CHAR, NULL, 0}, {"cpu", "CPU", NULL, 0, kvar, NULL, 3, KOFF(ki_estcpu), UINT, "d", @@ -135,12 +135,13 @@ static VAR var[] = { LONG, "ld", 0}, {"nvcsw", "NVCSW", NULL, USER, rvar, NULL, 5, ROFF(ru_nvcsw), LONG, "ld", 0}, - {"nwchan", "NWCHAN", NULL, LJUST, nwchan, NULL, 8, 0, CHAR, NULL, 0}, + {"nwchan", "NWCHAN", NULL, LJUST, nwchan, NULL, sizeof(void *) * 2, 0, + CHAR, NULL, 0}, {"oublk", "OUBLK", NULL, USER, rvar, NULL, 4, ROFF(ru_oublock), LONG, "ld", 0}, {"oublock", "", "oublk", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, - {"paddr", "PADDR", NULL, 0, kvar, NULL, 8, KOFF(ki_paddr), KPTR, - "lx", 0}, + {"paddr", "PADDR", NULL, 0, kvar, NULL, sizeof(void *) * 2, + KOFF(ki_paddr), KPTR, "lx", 0}, {"pagein", "PAGEIN", NULL, USER, pagein, NULL, 6, 0, CHAR, NULL, 0}, {"pcpu", "", "%cpu", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, {"pending", "", "sig", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, @@ -194,13 +195,13 @@ static VAR var[] = { {"tsiz", "TSIZ", NULL, 0, kvar, NULL, 4, KOFF(ki_tsize), PGTOK, "ld", 0}, {"tt", "TT ", NULL, 0, tname, NULL, 4, 0, CHAR, NULL, 0}, {"tty", "TTY", NULL, LJUST, longtname, NULL, 8, 0, CHAR, NULL, 0}, - {"ucomm", "UCOMM", NULL, LJUST, ucomm, NULL, MAXCOMLEN, 0, CHAR, NULL, - 0}, + {"ucomm", "UCOMM", NULL, LJUST|DSIZ, ucomm, s_comm, + COMMLEN + OCOMMLEN + 1, 0, CHAR, NULL, 0}, {"uid", "UID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_uid), UINT, UIDFMT, 0}, {"upr", "UPR", NULL, 0, upr, NULL, 3, 0, CHAR, NULL, 0}, - {"uprocp", "UPROCP", NULL, 0, kvar, NULL, 8, KOFF(ki_paddr), KPTR, - "lx", 0}, + {"uprocp", "UPROCP", NULL, 0, kvar, NULL, sizeof(void *) * 2, + KOFF(ki_paddr), KPTR, "lx", 0}, {"user", "USER", NULL, LJUST|DSIZ, uname, s_uname, USERLEN, 0, CHAR, NULL, 0}, {"usrpri", "", "upr", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, @@ -324,6 +325,8 @@ findvar(char *p, int user, char **header */ rflen = strlen(v->alias) + strlen(hp) + 2; realfmt = malloc(rflen); + if (realfmt == NULL) + errx(1, "malloc failed"); snprintf(realfmt, rflen, "%s=%s", v->alias, hp); parsefmt(realfmt, user); } Modified: stable/7/bin/ps/print.c ============================================================================== --- stable/7/bin/ps/print.c Mon Sep 7 09:30:37 2009 (r196916) +++ stable/7/bin/ps/print.c Mon Sep 7 09:51:23 2009 (r196917) @@ -186,6 +186,7 @@ command(KINFO *k, VARENT *ve) void ucomm(KINFO *k, VARENT *ve) { + char tmpbuff[COMMLEN + OCOMMLEN + 2]; VAR *v; v = ve->var; @@ -193,8 +194,15 @@ ucomm(KINFO *k, VARENT *ve) if (k->ki_d.prefix) (void)printf("%s", k->ki_d.prefix); (void)printf("%s", k->ki_p->ki_comm); - } else - (void)printf("%-*s", v->width, k->ki_p->ki_comm); + } else { + bzero(tmpbuff, sizeof(tmpbuff)); + if (showthreads && k->ki_p->ki_numthreads > 1) + sprintf(tmpbuff, "%s/%s", k->ki_p->ki_comm, + k->ki_p->ki_ocomm); + else + sprintf(tmpbuff, "%s", k->ki_p->ki_comm); + (void)printf("%-*s", v->width, tmpbuff); + } } void @@ -822,6 +830,20 @@ out: } int +s_comm(KINFO *k) +{ + char tmpbuff[COMMLEN + OCOMMLEN + 2]; + + bzero(tmpbuff, sizeof(tmpbuff)); + if (showthreads && k->ki_p->ki_numthreads > 1) + sprintf(tmpbuff, "%s/%s", k->ki_p->ki_comm, + k->ki_p->ki_ocomm); + else + sprintf(tmpbuff, "%s", k->ki_p->ki_comm); + return (strlen(tmpbuff)); +} + +int s_label(KINFO *k) { char *string = NULL; Modified: stable/7/bin/ps/ps.c ============================================================================== --- stable/7/bin/ps/ps.c Mon Sep 7 09:30:37 2009 (r196916) +++ stable/7/bin/ps/ps.c Mon Sep 7 09:51:23 2009 (r196917) @@ -100,6 +100,7 @@ int rawcpu; /* -C */ int sumrusage; /* -S */ int termwidth; /* Width of the screen (0 == infinity). */ int totwidth; /* Calculated-width of requested variables. */ +int showthreads; /* will threads be shown? */ struct velisthead varlist = STAILQ_HEAD_INITIALIZER(varlist); @@ -178,7 +179,7 @@ main(int argc, char *argv[]) char *cols; int all, ch, elem, flag, _fmt, i, lineno; int descendancy, nentries, nkept, nselectors; - int prtheader, showthreads, wflag, what, xkeep, xkeep_implied; + int prtheader, wflag, what, xkeep, xkeep_implied; char errbuf[_POSIX2_LINE_MAX]; (void) setlocale(LC_ALL, ""); Modified: stable/7/sys/kern/kern_proc.c ============================================================================== --- stable/7/sys/kern/kern_proc.c Mon Sep 7 09:30:37 2009 (r196916) +++ stable/7/sys/kern/kern_proc.c Mon Sep 7 09:51:23 2009 (r196917) @@ -115,6 +115,7 @@ MALLOC_DEFINE(M_SUBPROC, "subproc", "Pro static void doenterpgrp(struct proc *, struct pgrp *); static void orphanpg(struct pgrp *pg); +static void fill_kinfo_aggregate(struct proc *p, struct kinfo_proc *kp); static void fill_kinfo_proc_only(struct proc *p, struct kinfo_proc *kp); static void fill_kinfo_thread(struct thread *td, struct kinfo_proc *kp, int preferthread); @@ -670,6 +671,30 @@ DB_SHOW_COMMAND(pgrpdump, pgrpdump) #endif /* DDB */ /* + * Rework the kinfo_proc members which need to be aggregated in the + * case of process-ware informations. + * Must be called with the target spinlock process held. + */ +static void +fill_kinfo_aggregate(struct proc *p, struct kinfo_proc *kp) +{ + struct thread *td; + + PROC_SLOCK_ASSERT(p, MA_OWNED); + + kp->ki_estcpu = 0; + kp->ki_pctcpu = 0; + kp->ki_runtime = 0; + FOREACH_THREAD_IN_PROC(p, td) { + thread_lock(td); + kp->ki_pctcpu += sched_pctcpu(td); + kp->ki_runtime += cputick2usec(td->td_runtime); + kp->ki_estcpu += td->td_estcpu; + thread_unlock(td); + } +} + +/* * Clear kinfo_proc and fill in any information that is common * to all threads in the process. * Must be called with the target process locked. @@ -868,14 +893,15 @@ fill_kinfo_thread(struct thread *td, str kp->ki_numthreads = p->p_numthreads; kp->ki_pcb = td->td_pcb; kp->ki_kstack = (void *)td->td_kstack; - kp->ki_pctcpu = sched_pctcpu(td); - kp->ki_estcpu = td->td_estcpu; kp->ki_slptime = (ticks - td->td_slptick) / hz; kp->ki_pri.pri_class = td->td_pri_class; kp->ki_pri.pri_user = td->td_user_pri; - if (preferthread) + if (preferthread) { kp->ki_runtime = cputick2usec(td->td_runtime); + kp->ki_pctcpu = sched_pctcpu(td); + kp->ki_estcpu = td->td_estcpu; + } /* We can't get this anymore but ps etc never used it anyway. */ kp->ki_rqindex = 0; @@ -895,8 +921,9 @@ fill_kinfo_proc(struct proc *p, struct k fill_kinfo_proc_only(p, kp); PROC_SLOCK(p); - if (FIRST_THREAD_IN_PROC(p) != NULL) - fill_kinfo_thread(FIRST_THREAD_IN_PROC(p), kp, 0); + MPASS (FIRST_THREAD_IN_PROC(p) != NULL); + fill_kinfo_thread(FIRST_THREAD_IN_PROC(p), kp, 0); + fill_kinfo_aggregate(p, kp); PROC_SUNLOCK(p); } @@ -962,28 +989,20 @@ sysctl_out_proc(struct proc *p, struct s PROC_LOCK_ASSERT(p, MA_OWNED); - fill_kinfo_proc_only(p, &kinfo_proc); - if (flags & KERN_PROC_NOTHREADS) { - PROC_SLOCK(p); - if (FIRST_THREAD_IN_PROC(p) != NULL) - fill_kinfo_thread(FIRST_THREAD_IN_PROC(p), - &kinfo_proc, 0); - PROC_SUNLOCK(p); + fill_kinfo_proc(p, &kinfo_proc); + if (flags & KERN_PROC_NOTHREADS) error = SYSCTL_OUT(req, (caddr_t)&kinfo_proc, - sizeof(kinfo_proc)); - } else { + sizeof(kinfo_proc)); + else { PROC_SLOCK(p); - if (FIRST_THREAD_IN_PROC(p) != NULL) - FOREACH_THREAD_IN_PROC(p, td) { - fill_kinfo_thread(td, &kinfo_proc, 1); - error = SYSCTL_OUT(req, (caddr_t)&kinfo_proc, - sizeof(kinfo_proc)); - if (error) - break; - } - else + MPASS(FIRST_THREAD_IN_PROC(p) != NULL); + FOREACH_THREAD_IN_PROC(p, td) { + fill_kinfo_thread(td, &kinfo_proc, 1); error = SYSCTL_OUT(req, (caddr_t)&kinfo_proc, - sizeof(kinfo_proc)); + sizeof(kinfo_proc)); + if (error) + break; + } PROC_SUNLOCK(p); } PROC_UNLOCK(p); From ume at FreeBSD.org Mon Sep 7 10:15:51 2009 From: ume at FreeBSD.org (Hajimu UMEMOTO) Date: Mon Sep 7 10:15:58 2009 Subject: svn commit: r196918 - in stable/7: sbin/ifconfig share/man/man4 sys/net sys/netinet sys/netinet6 sys/sys Message-ID: <200909071015.n87AFoDx011798@svn.freebsd.org> Author: ume Date: Mon Sep 7 10:15:50 2009 New Revision: 196918 URL: http://svn.freebsd.org/changeset/base/196918 Log: MFC r193664, r193796, r193815: Fix and add a workaround on an issue of EtherIP packet with reversed version field sent via gif(4)+if_bridge(4). The EtherIP implementation found on FreeBSD 6.1, 6.2, 6.3, 7.0, 7.1, and 7.2 had an interoperability issue because it sent the incorrect EtherIP packets and discarded the correct ones. Approved by: hrs Added: stable/7/sbin/ifconfig/ifgif.c - copied unchanged from r193664, head/sbin/ifconfig/ifgif.c Modified: stable/7/sbin/ifconfig/ (props changed) stable/7/sbin/ifconfig/Makefile stable/7/share/man/man4/ (props changed) stable/7/share/man/man4/gif.4 stable/7/share/man/man4/if_bridge.4 stable/7/sys/net/ (props changed) stable/7/sys/net/if_gif.c stable/7/sys/net/if_gif.h stable/7/sys/netinet/in_gif.c stable/7/sys/netinet6/in6_gif.c stable/7/sys/sys/priv.h Modified: stable/7/sbin/ifconfig/Makefile ============================================================================== --- stable/7/sbin/ifconfig/Makefile Mon Sep 7 09:51:23 2009 (r196917) +++ stable/7/sbin/ifconfig/Makefile Mon Sep 7 10:15:50 2009 (r196918) @@ -25,6 +25,7 @@ SRCS+= ifmedia.c # SIOC[GS]IFMEDIA supp SRCS+= ifvlan.c # SIOC[GS]ETVLAN support SRCS+= ifieee80211.c # SIOC[GS]IEEE80211 support SRCS+= ifgre.c # GRE keys etc +SRCS+= ifgif.c # GIF reversed header workaround SRCS+= ifcarp.c # SIOC[GS]VH support SRCS+= ifgroup.c # ... Copied: stable/7/sbin/ifconfig/ifgif.c (from r193664, head/sbin/ifconfig/ifgif.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/sbin/ifconfig/ifgif.c Mon Sep 7 10:15:50 2009 (r196918, copy of r193664, head/sbin/ifconfig/ifgif.c) @@ -0,0 +1,132 @@ +/*- + * Copyright (c) 2009 Hiroki Sato. 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 OR HIS RELATIVES 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 MIND, 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. + */ + +#ifndef lint +static const char rcsid[] = + "$FreeBSD$"; +#endif + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "ifconfig.h" + +static void gif_status(int); + +static struct { + const char *label; + u_int mask; +} gif_opts[] = { + { "ACCEPT_REV_ETHIP_VER", GIF_ACCEPT_REVETHIP }, + { "SEND_REV_ETHIP_VER", GIF_SEND_REVETHIP }, +}; + +static void +gif_status(int s) +{ + int opts; + int nopts = 0; + int i; + + ifr.ifr_data = (caddr_t)&opts; + if (ioctl(s, GIFGOPTS, &ifr) == -1) + return; + + printf("\toptions=%d<", opts); + for (i=0; i < sizeof(gif_opts)/sizeof(gif_opts[0]); i++) { + if (opts & gif_opts[i].mask) { + if (nopts++) + printf(","); + printf("%s", gif_opts[i].label); + } + } + printf(">\n"); +} + +static void +setgifopts(const char *val, + int d, int s, const struct afswtch *afp) +{ + int opts; + + ifr.ifr_data = (caddr_t)&opts; + if (ioctl(s, GIFGOPTS, &ifr) == -1) { + warn("ioctl(GIFGOPTS)"); + return; + } + + if (d < 0) + opts &= ~(-d); + else + opts |= d; + + if (ioctl(s, GIFSOPTS, &ifr) == -1) { + warn("ioctl(GIFSOPTS)"); + return; + } +} + +static struct cmd gif_cmds[] = { + DEF_CMD("accept_rev_ethip_ver", GIF_ACCEPT_REVETHIP, setgifopts), + DEF_CMD("-accept_rev_ethip_ver",-GIF_ACCEPT_REVETHIP, setgifopts), + DEF_CMD("send_rev_ethip_ver", GIF_SEND_REVETHIP, setgifopts), + DEF_CMD("-send_rev_ethip_ver", -GIF_SEND_REVETHIP, setgifopts), +}; + +static struct afswtch af_gif = { + .af_name = "af_gif", + .af_af = AF_UNSPEC, + .af_other_status = gif_status, +}; + +static __constructor void +gif_ctor(void) +{ +#define N(a) (sizeof(a) / sizeof(a[0])) + int i; + + for (i = 0; i < N(gif_cmds); i++) + cmd_register(&gif_cmds[i]); + af_register(&af_gif); +#undef N +} Modified: stable/7/share/man/man4/gif.4 ============================================================================== --- stable/7/share/man/man4/gif.4 Mon Sep 7 09:51:23 2009 (r196917) +++ stable/7/share/man/man4/gif.4 Mon Sep 7 10:15:50 2009 (r196918) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 10, 1999 +.Dd June 8, 2009 .Dt GIF 4 .Os .Sh NAME @@ -256,3 +256,32 @@ had a multi-destination behavior, config .Dv IFF_LINK0 flag. The behavior is obsolete and is no longer supported. +.Pp +On +.Fx +6.1, 6.2, 6.3, 7.0, 7.1, and 7.2 +the +.Nm +sends and receives incorrect EtherIP packets with reversed version +field when +.Xr if_bridge 4 +is used together. As a workaround on this interoperability issue, the +following two +.Xr ifconfig 8 +flags can be used: +.Bl -tag -width "accept_rev_ethip_ver" -offset indent +.It accept_rev_ethip_ver +accepts both correct EtherIP packets and ones with reversed version +field, if enabled. If disabled, the +.Nm +accepts the correct packets only. This flag is enabled by default. +.It send_rev_ethip_ver +sends EtherIP packets with reversed version field intentionally, if +enabled. If disabled, the +.Nm +sends the correct packets only. This flag is disabled by default. +.El +.Pp +If interoperability with the older +.Fx +machines is needed, both of these two flags must be enabled. Modified: stable/7/share/man/man4/if_bridge.4 ============================================================================== --- stable/7/share/man/man4/if_bridge.4 Mon Sep 7 09:51:23 2009 (r196917) +++ stable/7/share/man/man4/if_bridge.4 Mon Sep 7 10:15:50 2009 (r196918) @@ -35,7 +35,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 17, 2007 +.Dd June 8, 2009 .Dt IF_BRIDGE 4 .Os .Sh NAME @@ -389,6 +389,12 @@ ifconfig gif0 tunnel 1.2.3.4 5.6.7.8 up ifconfig bridge0 create ifconfig bridge0 addm fxp0 addm gif0 up .Ed +.Pp +Note that +.Fx +6.1, 6.2, 6.3, 7.0, 7.1, and 7.2 have a bug in the EtherIP protocol. +For more details and workaround, see +.Xr gif 4 manual page. .Sh SEE ALSO .Xr gif 4 , .Xr ipf 4 , Modified: stable/7/sys/net/if_gif.c ============================================================================== --- stable/7/sys/net/if_gif.c Mon Sep 7 09:51:23 2009 (r196917) +++ stable/7/sys/net/if_gif.c Mon Sep 7 10:15:50 2009 (r196918) @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -169,6 +170,7 @@ gif_clone_create(ifc, unit, params) if_initname(GIF2IFP(sc), ifc->ifc_name, unit); sc->encap_cookie4 = sc->encap_cookie6 = NULL; + sc->gif_options = GIF_ACCEPT_REVETHIP; GIF2IFP(sc)->if_addrlen = 0; GIF2IFP(sc)->if_mtu = GIF_MTU; @@ -479,6 +481,7 @@ gif_input(m, af, ifp) struct ifnet *ifp; { int isr, n; + struct gif_softc *sc = ifp->if_softc; struct etherip_header *eip; struct ether_header *eh; struct ifnet *oldifp; @@ -539,11 +542,25 @@ gif_input(m, af, ifp) } eip = mtod(m, struct etherip_header *); - if (eip->eip_ver != - (ETHERIP_VERSION & ETHERIP_VER_VERS_MASK)) { - /* discard unknown versions */ - m_freem(m); - return; + /* + * GIF_ACCEPT_REVETHIP (enabled by default) intentionally + * accepts an EtherIP packet with revered version field in + * the header. This is a knob for backward compatibility + * with FreeBSD 7.2R or prior. + */ + if (sc->gif_options & GIF_ACCEPT_REVETHIP) { + if (eip->eip_resvl != ETHERIP_VERSION + && eip->eip_ver != ETHERIP_VERSION) { + /* discard unknown versions */ + m_freem(m); + return; + } + } else { + if (eip->eip_ver != ETHERIP_VERSION) { + /* discard unknown versions */ + m_freem(m); + return; + } } m_adj(m, sizeof(struct etherip_header)); @@ -598,6 +615,7 @@ gif_ioctl(ifp, cmd, data) struct gif_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq*)data; int error = 0, size; + u_int options; struct sockaddr *dst, *src; #ifdef SIOCSIFMTU /* xxx */ u_long mtu; @@ -832,6 +850,24 @@ gif_ioctl(ifp, cmd, data) /* if_ioctl() takes care of it */ break; + case GIFGOPTS: + options = sc->gif_options; + error = copyout(&options, ifr->ifr_data, + sizeof(options)); + break; + + case GIFSOPTS: + if ((error = priv_check(curthread, PRIV_NET_GIF)) != 0) + break; + error = copyin(ifr->ifr_data, &options, sizeof(options)); + if (error) + break; + if (options & ~GIF_OPTMASK) + error = EINVAL; + else + sc->gif_options = options; + break; + default: error = EINVAL; break; Modified: stable/7/sys/net/if_gif.h ============================================================================== --- stable/7/sys/net/if_gif.h Mon Sep 7 09:51:23 2009 (r196917) +++ stable/7/sys/net/if_gif.h Mon Sep 7 10:15:50 2009 (r196918) @@ -71,6 +71,7 @@ struct gif_softc { const struct encaptab *encap_cookie4; const struct encaptab *encap_cookie6; void *gif_netgraph; /* ng_gif(4) netgraph node info */ + u_int gif_options; LIST_ENTRY(gif_softc) gif_list; /* all gif's are linked */ }; #define GIF2IFP(sc) ((sc)->gif_ifp) @@ -94,12 +95,18 @@ struct gif_softc { #define MTAG_GIF_CALLED 0 struct etherip_header { - u_int8_t eip_ver; /* version/reserved */ - u_int8_t eip_pad; /* required padding byte */ -}; -#define ETHERIP_VER_VERS_MASK 0x0f -#define ETHERIP_VER_RSVD_MASK 0xf0 -#define ETHERIP_VERSION 0x03 +#if BYTE_ORDER == LITTLE_ENDIAN + u_int eip_resvl:4, /* reserved */ + eip_ver:4; /* version */ +#endif +#if BYTE_ORDER == BIG_ENDIAN + u_int eip_ver:4, /* version */ + eip_resvl:4; /* reserved */ +#endif + u_int8_t eip_resvh; /* reserved */ +} __packed; + +#define ETHERIP_VERSION 0x3 /* mbuf adjust factor to force 32-bit alignment of IP header */ #define ETHERIP_ALIGN 2 @@ -114,4 +121,11 @@ int gif_encapcheck(const struct mbuf *, #endif /* _KERNEL */ +#define GIFGOPTS _IOWR('i', 150, struct ifreq) +#define GIFSOPTS _IOW('i', 151, struct ifreq) + +#define GIF_ACCEPT_REVETHIP 0x0001 +#define GIF_SEND_REVETHIP 0x0010 +#define GIF_OPTMASK (GIF_ACCEPT_REVETHIP|GIF_SEND_REVETHIP) + #endif /* _NET_IF_GIF_H_ */ Modified: stable/7/sys/netinet/in_gif.c ============================================================================== --- stable/7/sys/netinet/in_gif.c Mon Sep 7 09:51:23 2009 (r196917) +++ stable/7/sys/netinet/in_gif.c Mon Sep 7 10:15:50 2009 (r196918) @@ -144,8 +144,22 @@ in_gif_output(struct ifnet *ifp, int fam #endif /* INET6 */ case AF_LINK: proto = IPPROTO_ETHERIP; - eiphdr.eip_ver = ETHERIP_VERSION & ETHERIP_VER_VERS_MASK; - eiphdr.eip_pad = 0; + + /* + * GIF_SEND_REVETHIP (disabled by default) intentionally + * sends an EtherIP packet with revered version field in + * the header. This is a knob for backward compatibility + * with FreeBSD 7.2R or prior. + */ + if ((sc->gif_options & GIF_SEND_REVETHIP)) { + eiphdr.eip_ver = 0; + eiphdr.eip_resvl = ETHERIP_VERSION; + eiphdr.eip_resvh = 0; + } else { + eiphdr.eip_ver = ETHERIP_VERSION; + eiphdr.eip_resvl = 0; + eiphdr.eip_resvh = 0; + } /* prepend Ethernet-in-IP header */ M_PREPEND(m, sizeof(struct etherip_header), M_DONTWAIT); if (m && m->m_len < sizeof(struct etherip_header)) Modified: stable/7/sys/netinet6/in6_gif.c ============================================================================== --- stable/7/sys/netinet6/in6_gif.c Mon Sep 7 09:51:23 2009 (r196917) +++ stable/7/sys/netinet6/in6_gif.c Mon Sep 7 10:15:50 2009 (r196918) @@ -142,8 +142,22 @@ in6_gif_output(struct ifnet *ifp, #endif case AF_LINK: proto = IPPROTO_ETHERIP; - eiphdr.eip_ver = ETHERIP_VERSION & ETHERIP_VER_VERS_MASK; - eiphdr.eip_pad = 0; + + /* + * GIF_SEND_REVETHIP (disabled by default) intentionally + * sends an EtherIP packet with revered version field in + * the header. This is a knob for backward compatibility + * with FreeBSD 7.2R or prior. + */ + if ((sc->gif_options & GIF_SEND_REVETHIP)) { + eiphdr.eip_ver = 0; + eiphdr.eip_resvl = ETHERIP_VERSION; + eiphdr.eip_resvh = 0; + } else { + eiphdr.eip_ver = ETHERIP_VERSION; + eiphdr.eip_resvl = 0; + eiphdr.eip_resvh = 0; + } /* prepend Ethernet-in-IP header */ M_PREPEND(m, sizeof(struct etherip_header), M_DONTWAIT); if (m && m->m_len < sizeof(struct etherip_header)) Modified: stable/7/sys/sys/priv.h ============================================================================== --- stable/7/sys/sys/priv.h Mon Sep 7 09:51:23 2009 (r196917) +++ stable/7/sys/sys/priv.h Mon Sep 7 10:15:50 2009 (r196918) @@ -327,6 +327,7 @@ #define PRIV_NET_ADDIFADDR 413 /* Add protocol addr to interface. */ #define PRIV_NET_DELIFADDR 414 /* Delete protocol addr on interface. */ #define PRIV_NET_LAGG 415 /* Administer lagg interface. */ +#define PRIV_NET_GIF 416 /* Administer gif interface. */ /* * 802.11-related privileges. From pjd at FreeBSD.org Mon Sep 7 11:38:44 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Mon Sep 7 11:38:56 2009 Subject: svn commit: r196919 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200909071138.n87BciEc013363@svn.freebsd.org> Author: pjd Date: Mon Sep 7 11:38:43 2009 New Revision: 196919 URL: http://svn.freebsd.org/changeset/base/196919 Log: bzero() on-stack argument, so mutex_init() won't misinterpret that the lock is already initialized if we have some garbage on the stack. PR: kern/135480 Reported by: Emil Mikulic MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Mon Sep 7 10:15:50 2009 (r196918) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Mon Sep 7 11:38:43 2009 (r196919) @@ -1419,6 +1419,7 @@ dsl_dataset_drain_refs(dsl_dataset_t *ds { struct refsarg arg; + bzero(&arg, sizeof(arg)); mutex_init(&arg.lock, NULL, MUTEX_DEFAULT, NULL); cv_init(&arg.cv, NULL, CV_DEFAULT, NULL); arg.gone = FALSE; From kib at FreeBSD.org Mon Sep 7 11:55:34 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Mon Sep 7 11:55:46 2009 Subject: svn commit: r196920 - in head/sys: fs/pseudofs ufs/ffs Message-ID: <200909071155.n87BtYdV013765@svn.freebsd.org> Author: kib Date: Mon Sep 7 11:55:34 2009 New Revision: 196920 URL: http://svn.freebsd.org/changeset/base/196920 Log: insmntque_stddtr() clears vp->v_data and resets vp->v_op to dead_vnodeops before calling vgone(). Revert r189706 and corresponding part of the r186560. Noted and reviewed by: tegge Approved by: des (pseudofs part) MFC after: 3 days Modified: head/sys/fs/pseudofs/pseudofs_vncache.c head/sys/ufs/ffs/ffs_vfsops.c Modified: head/sys/fs/pseudofs/pseudofs_vncache.c ============================================================================== --- head/sys/fs/pseudofs/pseudofs_vncache.c Mon Sep 7 11:38:43 2009 (r196919) +++ head/sys/fs/pseudofs/pseudofs_vncache.c Mon Sep 7 11:55:34 2009 (r196920) @@ -193,6 +193,7 @@ retry: vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY); error = insmntque(*vpp, mp); if (error != 0) { + free(pvd, M_PFSVNCACHE); *vpp = NULLVP; return (error); } Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Mon Sep 7 11:38:43 2009 (r196919) +++ head/sys/ufs/ffs/ffs_vfsops.c Mon Sep 7 11:55:34 2009 (r196920) @@ -1467,6 +1467,7 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags vp->v_vflag |= VV_FORCEINSMQ; error = insmntque(vp, mp); if (error != 0) { + uma_zfree(uma_inode, ip); *vpp = NULL; return (error); } From kib at FreeBSD.org Mon Sep 7 12:10:41 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Mon Sep 7 12:10:47 2009 Subject: svn commit: r196921 - head/sys/fs/pseudofs Message-ID: <200909071210.n87CAflU014082@svn.freebsd.org> Author: kib Date: Mon Sep 7 12:10:41 2009 New Revision: 196921 URL: http://svn.freebsd.org/changeset/base/196921 Log: If a race is detected, pfs_vncache_alloc() may reclaim a vnode that had never been inserted into the pfs_vncache list. Since pfs_vncache_free() does not anticipate this case, it decrements pfs_vncache_entries unconditionally; if the vnode was not in the list, pfs_vncache_entries will no longer reflect the actual number of list entries. This may cause size of the cache to exceed the configured maximum. It may also trigger a panic during module unload or system shutdown. Do not decrement pfs_vncache_entries for the vnode that was not in the list. Submitted by: tegge Reviewed by: des MFC after: 1 week Modified: head/sys/fs/pseudofs/pseudofs_vncache.c Modified: head/sys/fs/pseudofs/pseudofs_vncache.c ============================================================================== --- head/sys/fs/pseudofs/pseudofs_vncache.c Mon Sep 7 11:55:34 2009 (r196920) +++ head/sys/fs/pseudofs/pseudofs_vncache.c Mon Sep 7 12:10:41 2009 (r196921) @@ -246,11 +246,13 @@ pfs_vncache_free(struct vnode *vp) KASSERT(pvd != NULL, ("pfs_vncache_free(): no vnode data\n")); if (pvd->pvd_next) pvd->pvd_next->pvd_prev = pvd->pvd_prev; - if (pvd->pvd_prev) + if (pvd->pvd_prev) { pvd->pvd_prev->pvd_next = pvd->pvd_next; - else if (pfs_vncache == pvd) + --pfs_vncache_entries; + } else if (pfs_vncache == pvd) { pfs_vncache = pvd->pvd_next; - --pfs_vncache_entries; + --pfs_vncache_entries; + } mtx_unlock(&pfs_vncache_mutex); free(pvd, M_PFSVNCACHE); From kib at FreeBSD.org Mon Sep 7 12:39:55 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Mon Sep 7 12:40:06 2009 Subject: svn commit: r196922 - in stable/7/sys: . contrib/pf net ufs/ffs Message-ID: <200909071239.n87Cds3C014740@svn.freebsd.org> Author: kib Date: Mon Sep 7 12:39:54 2009 New Revision: 196922 URL: http://svn.freebsd.org/changeset/base/196922 Log: MFC r196206. Take the number of allocated freeblks into consideration for softdep_slowdown(). Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/net/ (props changed) stable/7/sys/ufs/ffs/ffs_softdep.c Modified: stable/7/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- stable/7/sys/ufs/ffs/ffs_softdep.c Mon Sep 7 12:10:41 2009 (r196921) +++ stable/7/sys/ufs/ffs/ffs_softdep.c Mon Sep 7 12:39:54 2009 (r196922) @@ -671,6 +671,8 @@ static int req_clear_inodedeps; /* synce static int req_clear_remove; /* syncer process flush some freeblks */ #define FLUSH_REMOVE 2 #define FLUSH_REMOVE_WAIT 3 +static long num_freeblkdep; /* number of freeblks workitems allocated */ + /* * runtime statistics */ @@ -2230,6 +2232,9 @@ softdep_setup_freeblocks(ip, length, fla freeblks->fb_uid = ip->i_uid; freeblks->fb_previousinum = ip->i_number; freeblks->fb_devvp = ip->i_devvp; + ACQUIRE_LOCK(&lk); + num_freeblkdep++; + FREE_LOCK(&lk); extblocks = 0; if (fs->fs_magic == FS_UFS2_MAGIC) extblocks = btodb(fragroundup(fs, ip->i_din2->di_extsize)); @@ -2821,6 +2826,7 @@ handle_workitem_freeblocks(freeblks, fla ACQUIRE_LOCK(&lk); WORKITEM_FREE(freeblks, D_FREEBLKS); + num_freeblkdep--; FREE_LOCK(&lk); } @@ -5748,7 +5754,8 @@ softdep_slowdown(vp) max_softdeps_hard = max_softdeps * 11 / 10; if (num_dirrem < max_softdeps_hard / 2 && num_inodedep < max_softdeps_hard && - VFSTOUFS(vp->v_mount)->um_numindirdeps < maxindirdeps) { + VFSTOUFS(vp->v_mount)->um_numindirdeps < maxindirdeps && + num_freeblkdep < max_softdeps_hard) { FREE_LOCK(&lk); return (0); } From bz at FreeBSD.org Mon Sep 7 13:37:04 2009 From: bz at FreeBSD.org (Bjoern A. Zeeb) Date: Mon Sep 7 13:37:11 2009 Subject: svn commit: r196924 - in stable/7/sys: . amd64/amd64 compat/ia32 contrib/pf i386/i386 kern sys Message-ID: <200909071337.n87Db4tN016089@svn.freebsd.org> Author: bz Date: Mon Sep 7 13:37:04 2009 New Revision: 196924 URL: http://svn.freebsd.org/changeset/base/196924 Log: MFC r196653: Make sure FreeBSD binaries without .note.ABI-tag section work correctly and do not match a colliding Debian GNU/kFreeBSD brandinfo statements. For this mark the Debian GNU/kFreeBSD brandinfo that it must have an .note.ABI-tag section and ignore the old EI_OSABI brandinfo when comparing a possibly colliding set of options. Due to SYSINIT we add the brandinfo in a non-deterministic order, so native FreeBSD is not always first. We may want to consider to force native FreeBSD to come first as well. The only way a problem could currently be noticed is when running an i386 binary without the .note.ABI-tag on amd64 and the Debian GNU/kFreeBSD brandinfo was matched first, as the fallback to ld-elf32.so.1 does not exist in that case. Reported and tested by: ticso In collaboration with: kib Modified: stable/7/sys/ (props changed) stable/7/sys/amd64/amd64/elf_machdep.c stable/7/sys/compat/ia32/ia32_sysvec.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/i386/i386/elf_machdep.c stable/7/sys/kern/imgact_elf.c stable/7/sys/sys/imgact_elf.h Modified: stable/7/sys/amd64/amd64/elf_machdep.c ============================================================================== --- stable/7/sys/amd64/amd64/elf_machdep.c Mon Sep 7 12:41:19 2009 (r196923) +++ stable/7/sys/amd64/amd64/elf_machdep.c Mon Sep 7 13:37:04 2009 (r196924) @@ -117,7 +117,7 @@ static Elf64_Brandinfo kfreebsd_brand_in .sysvec = &elf64_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf64_kfreebsd_brandnote, - .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE_MANDATORY }; SYSINIT(kelf64, SI_SUB_EXEC, SI_ORDER_ANY, Modified: stable/7/sys/compat/ia32/ia32_sysvec.c ============================================================================== --- stable/7/sys/compat/ia32/ia32_sysvec.c Mon Sep 7 12:41:19 2009 (r196923) +++ stable/7/sys/compat/ia32/ia32_sysvec.c Mon Sep 7 13:37:04 2009 (r196924) @@ -179,7 +179,7 @@ static Elf32_Brandinfo kia32_brand_info .interp_path = "/lib/ld.so.1", .sysvec = &ia32_freebsd_sysvec, .brand_note = &elf32_kfreebsd_brandnote, - .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE_MANDATORY }; SYSINIT(kia32, SI_SUB_EXEC, SI_ORDER_ANY, Modified: stable/7/sys/i386/i386/elf_machdep.c ============================================================================== --- stable/7/sys/i386/i386/elf_machdep.c Mon Sep 7 12:41:19 2009 (r196923) +++ stable/7/sys/i386/i386/elf_machdep.c Mon Sep 7 13:37:04 2009 (r196924) @@ -116,7 +116,7 @@ static Elf32_Brandinfo kfreebsd_brand_in .sysvec = &elf32_freebsd_sysvec, .interp_newpath = NULL, .brand_note = &elf32_kfreebsd_brandnote, - .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE_MANDATORY }; SYSINIT(kelf32, SI_SUB_EXEC, SI_ORDER_ANY, Modified: stable/7/sys/kern/imgact_elf.c ============================================================================== --- stable/7/sys/kern/imgact_elf.c Mon Sep 7 12:41:19 2009 (r196923) +++ stable/7/sys/kern/imgact_elf.c Mon Sep 7 13:37:04 2009 (r196924) @@ -241,8 +241,10 @@ __elfN(get_brandinfo)(struct image_param /* Look for an ".note.ABI-tag" ELF section */ for (i = 0; i < MAX_BRANDS; i++) { bi = elf_brand_list[i]; - if (bi != NULL && hdr->e_machine == bi->machine && - (bi->flags & BI_BRAND_NOTE) != 0) { + if (bi == NULL) + continue; + if (hdr->e_machine == bi->machine && (bi->flags & + (BI_BRAND_NOTE|BI_BRAND_NOTE_MANDATORY)) != 0) { ret = __elfN(check_note)(imgp, bi->brand_note, osrel); if (ret) return (bi); @@ -252,7 +254,9 @@ __elfN(get_brandinfo)(struct image_param /* If the executable has a brand, search for it in the brand list. */ for (i = 0; i < MAX_BRANDS; i++) { bi = elf_brand_list[i]; - if (bi != NULL && hdr->e_machine == bi->machine && + if (bi == NULL || bi->flags & BI_BRAND_NOTE_MANDATORY) + continue; + if (hdr->e_machine == bi->machine && (hdr->e_ident[EI_OSABI] == bi->brand || strncmp((const char *)&hdr->e_ident[OLD_EI_BRAND], bi->compat_3_brand, strlen(bi->compat_3_brand)) == 0)) @@ -263,7 +267,9 @@ __elfN(get_brandinfo)(struct image_param if (interp != NULL) { for (i = 0; i < MAX_BRANDS; i++) { bi = elf_brand_list[i]; - if (bi != NULL && hdr->e_machine == bi->machine && + if (bi == NULL || bi->flags & BI_BRAND_NOTE_MANDATORY) + continue; + if (hdr->e_machine == bi->machine && strcmp(interp, bi->interp_path) == 0) return (bi); } @@ -272,7 +278,9 @@ __elfN(get_brandinfo)(struct image_param /* Lacking a recognized interpreter, try the default brand */ for (i = 0; i < MAX_BRANDS; i++) { bi = elf_brand_list[i]; - if (bi != NULL && hdr->e_machine == bi->machine && + if (bi == NULL || bi->flags & BI_BRAND_NOTE_MANDATORY) + continue; + if (hdr->e_machine == bi->machine && __elfN(fallback_brand) == bi->brand) return (bi); } Modified: stable/7/sys/sys/imgact_elf.h ============================================================================== --- stable/7/sys/sys/imgact_elf.h Mon Sep 7 12:41:19 2009 (r196923) +++ stable/7/sys/sys/imgact_elf.h Mon Sep 7 13:37:04 2009 (r196924) @@ -75,8 +75,9 @@ typedef struct { const char *interp_newpath; int flags; Elf_Brandnote *brand_note; -#define BI_CAN_EXEC_DYN 0x0001 -#define BI_BRAND_NOTE 0x0002 +#define BI_CAN_EXEC_DYN 0x0001 +#define BI_BRAND_NOTE 0x0002 /* May have note.ABI-tag section. */ +#define BI_BRAND_NOTE_MANDATORY 0x0004 /* Must have note.ABI-tag section. */ } __ElfN(Brandinfo); __ElfType(Auxargs); From kib at FreeBSD.org Mon Sep 7 13:58:27 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Mon Sep 7 13:58:34 2009 Subject: svn commit: r196925 - in stable/6/sys: . conf contrib/pf dev/cxgb ufs/ffs Message-ID: <200909071358.n87DwRYP016560@svn.freebsd.org> Author: kib Date: Mon Sep 7 13:58:26 2009 New Revision: 196925 URL: http://svn.freebsd.org/changeset/base/196925 Log: MFC r196206. Take the number of allocated freeblks into consideration for softdep_slowdown(). Tested by: pluknet gmail com Modified: stable/6/sys/ (props changed) stable/6/sys/conf/ (props changed) stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/cxgb/ (props changed) stable/6/sys/ufs/ffs/ffs_softdep.c Modified: stable/6/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- stable/6/sys/ufs/ffs/ffs_softdep.c Mon Sep 7 13:37:04 2009 (r196924) +++ stable/6/sys/ufs/ffs/ffs_softdep.c Mon Sep 7 13:58:26 2009 (r196925) @@ -668,6 +668,8 @@ static int req_clear_inodedeps; /* synce static int req_clear_remove; /* syncer process flush some freeblks */ #define FLUSH_REMOVE 2 #define FLUSH_REMOVE_WAIT 3 +static long num_freeblkdep; /* number of freeblks workitems allocated */ + /* * runtime statistics */ @@ -2195,6 +2197,9 @@ softdep_setup_freeblocks(ip, length, fla freeblks->fb_uid = ip->i_uid; freeblks->fb_previousinum = ip->i_number; freeblks->fb_devvp = ip->i_devvp; + ACQUIRE_LOCK(&lk); + num_freeblkdep++; + FREE_LOCK(&lk); extblocks = 0; if (fs->fs_magic == FS_UFS2_MAGIC) extblocks = btodb(fragroundup(fs, ip->i_din2->di_extsize)); @@ -2784,6 +2789,7 @@ handle_workitem_freeblocks(freeblks, fla ACQUIRE_LOCK(&lk); WORKITEM_FREE(freeblks, D_FREEBLKS); + num_freeblkdep--; FREE_LOCK(&lk); } @@ -5708,7 +5714,8 @@ softdep_slowdown(vp) max_softdeps_hard = max_softdeps * 11 / 10; if (num_dirrem < max_softdeps_hard / 2 && num_inodedep < max_softdeps_hard && - VFSTOUFS(vp->v_mount)->um_numindirdeps < maxindirdeps) { + VFSTOUFS(vp->v_mount)->um_numindirdeps < maxindirdeps && + num_freeblkdep < max_softdeps_hard) { FREE_LOCK(&lk); return (0); } From remko at FreeBSD.org Mon Sep 7 14:10:55 2009 From: remko at FreeBSD.org (Remko Lodder) Date: Mon Sep 7 14:11:07 2009 Subject: svn commit: r196926 - in stable/8: . etc libexec Message-ID: <200909071410.n87EAtqO016929@svn.freebsd.org> Author: remko Date: Mon Sep 7 14:10:55 2009 New Revision: 196926 URL: http://svn.freebsd.org/changeset/base/196926 Log: MFC r196787 Do the first step in removing lukemftpd from the base system. Disconnect it from the build. If you are using the FTP daemon, please consider using the port ftp/tnftpd which is the same FTP server, but newer and might have more/better functionality. This results in us providing only one ftp daemon by default. Reviewed by: bz Approved by: imp (mentor, implicit) MFC after: 3 days Silence from: obrien Approved by: re (kib), imp (mentor, implicit) Modified: stable/8/ObsoleteFiles.inc (contents, props changed) stable/8/etc/inetd.conf stable/8/libexec/Makefile Modified: stable/8/ObsoleteFiles.inc ============================================================================== --- stable/8/ObsoleteFiles.inc Mon Sep 7 13:58:26 2009 (r196925) +++ stable/8/ObsoleteFiles.inc Mon Sep 7 14:10:55 2009 (r196926) @@ -14,6 +14,11 @@ # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # +# 20090904: remove lukemftpd +OLD_FILES+=usr/libexec/lukemftpd +OLD_FILES+=usr/share/man/man5/ftpd.conf.5.gz +OLD_FILES+=usr/share/man/man5/ftpusers.5.gz +OLD_FILES+=usr/share/man/man8/lukemftpd.8.gz # 20090801: vimage.h removed in favour of vnet.h OLD_FILES+=usr/include/sys/vimage.h # 20090719: library version bump for 8.0 Modified: stable/8/etc/inetd.conf ============================================================================== --- stable/8/etc/inetd.conf Mon Sep 7 13:58:26 2009 (r196925) +++ stable/8/etc/inetd.conf Mon Sep 7 14:10:55 2009 (r196926) @@ -8,8 +8,6 @@ # #ftp stream tcp nowait root /usr/libexec/ftpd ftpd -l #ftp stream tcp6 nowait root /usr/libexec/ftpd ftpd -l -#ftp stream tcp nowait root /usr/libexec/lukemftpd ftpd -l -r -#ftp stream tcp6 nowait root /usr/libexec/lukemftpd ftpd -l -r #ssh stream tcp nowait root /usr/sbin/sshd sshd -i -4 #ssh stream tcp6 nowait root /usr/sbin/sshd sshd -i -6 #telnet stream tcp nowait root /usr/libexec/telnetd telnetd Modified: stable/8/libexec/Makefile ============================================================================== --- stable/8/libexec/Makefile Mon Sep 7 13:58:26 2009 (r196925) +++ stable/8/libexec/Makefile Mon Sep 7 14:10:55 2009 (r196926) @@ -9,7 +9,6 @@ SUBDIR= ${_atrun} \ fingerd \ ftpd \ getty \ - lukemftpd \ ${_mail.local} \ ${_mknetid} \ ${_pppoed} \ From pjd at FreeBSD.org Mon Sep 7 14:16:50 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Mon Sep 7 14:17:01 2009 Subject: svn commit: r196927 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200909071416.n87EGoiV017087@svn.freebsd.org> Author: pjd Date: Mon Sep 7 14:16:50 2009 New Revision: 196927 URL: http://svn.freebsd.org/changeset/base/196927 Log: Changing provider size is not really supported by GEOM, but doing so when provider is closed should be ok. When administrator requests to change ZVOL size do it immediately if ZVOL is closed or do it on last ZVOL close. PR: kern/136942 Requested by: Bernard Buri MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Mon Sep 7 14:10:55 2009 (r196926) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Mon Sep 7 14:16:50 2009 (r196927) @@ -153,7 +153,22 @@ static int zvol_dump_init(zvol_state_t * static void zvol_size_changed(zvol_state_t *zv, major_t maj) { + struct g_provider *pp; + + g_topology_assert(); + pp = zv->zv_provider; + if (pp == NULL) + return; + if (zv->zv_volsize == pp->mediasize) + return; + /* + * Changing provider size is not really supported by GEOM, but it + * should be safe when provider is closed. + */ + if (zv->zv_total_opens > 0) + return; + pp->mediasize = zv->zv_volsize; } int @@ -263,6 +278,7 @@ zvol_access(struct g_provider *pp, int a } zv->zv_total_opens += acr + acw + ace; + zvol_size_changed(zv, 0); mutex_exit(&zvol_state_lock); @@ -1072,11 +1088,6 @@ zvol_set_volblocksize(const char *name, if (error == ENOTSUP) error = EBUSY; dmu_tx_commit(tx); - /* XXX: Not supported. */ -#if 0 - if (error == 0) - zv->zv_provider->sectorsize = zc->zc_volblocksize; -#endif } end: mutex_exit(&zvol_state_lock); From pjd at FreeBSD.org Mon Sep 7 14:44:05 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Mon Sep 7 14:44:16 2009 Subject: svn commit: r196928 - head/cddl/contrib/opensolaris/cmd/zdb Message-ID: <200909071444.n87Ei5ND017650@svn.freebsd.org> Author: pjd Date: Mon Sep 7 14:44:04 2009 New Revision: 196928 URL: http://svn.freebsd.org/changeset/base/196928 Log: Teach zdb(8) how to obtain GEOM provider size. PR: kern/133134 Reported by: Philipp Wuensche MFC after: 3 days Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Sep 7 14:16:50 2009 (r196927) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Sep 7 14:44:04 2009 (r196928) @@ -1322,6 +1322,14 @@ dump_label(const char *dev) exit(1); } + if (S_ISCHR(statbuf.st_mode)) { + if (ioctl(fd, DIOCGMEDIASIZE, &statbuf.st_size) == -1) { + (void) printf("failed to get size of '%s': %s\n", dev, + strerror(errno)); + exit(1); + } + } + psize = statbuf.st_size; psize = P2ALIGN(psize, (uint64_t)sizeof (vdev_label_t)); From ume at FreeBSD.org Mon Sep 7 15:22:54 2009 From: ume at FreeBSD.org (Hajimu UMEMOTO) Date: Mon Sep 7 15:23:00 2009 Subject: svn commit: r196929 - head/sbin/ifconfig Message-ID: <200909071522.n87FMs68018545@svn.freebsd.org> Author: ume Date: Mon Sep 7 15:22:54 2009 New Revision: 196929 URL: http://svn.freebsd.org/changeset/base/196929 Log: Suppress an options line when no bit is on. Reviewed by: hrs MFC after: 3 days Modified: head/sbin/ifconfig/ifgif.c Modified: head/sbin/ifconfig/ifgif.c ============================================================================== --- head/sbin/ifconfig/ifgif.c Mon Sep 7 14:44:04 2009 (r196928) +++ head/sbin/ifconfig/ifgif.c Mon Sep 7 15:22:54 2009 (r196929) @@ -71,6 +71,8 @@ gif_status(int s) ifr.ifr_data = (caddr_t)&opts; if (ioctl(s, GIFGOPTS, &ifr) == -1) return; + if (opts == 0) + return; printf("\toptions=%d<", opts); for (i=0; i < sizeof(gif_opts)/sizeof(gif_opts[0]); i++) { From hrs at FreeBSD.org Mon Sep 7 15:52:15 2009 From: hrs at FreeBSD.org (Hiroki Sato) Date: Mon Sep 7 15:53:33 2009 Subject: svn commit: r196931 - head/sbin/ifconfig Message-ID: <200909071552.n87FqFwD019220@svn.freebsd.org> Author: hrs Date: Mon Sep 7 15:52:15 2009 New Revision: 196931 URL: http://svn.freebsd.org/changeset/base/196931 Log: Use printb() instead of rolling its own routine to display bits in options=<>. Pointed out by: ume MFC after: 3 days Modified: head/sbin/ifconfig/ifgif.c Modified: head/sbin/ifconfig/ifgif.c ============================================================================== --- head/sbin/ifconfig/ifgif.c Mon Sep 7 15:43:09 2009 (r196930) +++ head/sbin/ifconfig/ifgif.c Mon Sep 7 15:52:15 2009 (r196931) @@ -51,38 +51,22 @@ static const char rcsid[] = #include "ifconfig.h" -static void gif_status(int); +#define GIFBITS "\020\1ACCEPT_REV_ETHIP_VER\5SEND_REV_ETHIP_VER" -static struct { - const char *label; - u_int mask; -} gif_opts[] = { - { "ACCEPT_REV_ETHIP_VER", GIF_ACCEPT_REVETHIP }, - { "SEND_REV_ETHIP_VER", GIF_SEND_REVETHIP }, -}; +static void gif_status(int); static void gif_status(int s) { int opts; - int nopts = 0; - size_t i; ifr.ifr_data = (caddr_t)&opts; if (ioctl(s, GIFGOPTS, &ifr) == -1) return; if (opts == 0) return; - - printf("\toptions=%d<", opts); - for (i=0; i < sizeof(gif_opts)/sizeof(gif_opts[0]); i++) { - if (opts & gif_opts[i].mask) { - if (nopts++) - printf(","); - printf("%s", gif_opts[i].label); - } - } - printf(">\n"); + printb("\toptions", opts, GIFBITS); + putchar('\n'); } static void From syrinx at FreeBSD.org Mon Sep 7 16:00:33 2009 From: syrinx at FreeBSD.org (Shteryana Shopova) Date: Mon Sep 7 16:00:40 2009 Subject: svn commit: r196932 - head/sys/netinet Message-ID: <200909071600.n87G0XdT019506@svn.freebsd.org> Author: syrinx Date: Mon Sep 7 16:00:33 2009 New Revision: 196932 URL: http://svn.freebsd.org/changeset/base/196932 Log: When joining a multicast group, the inp_lookup_mcast_ifp call does a KASSERT that the group address is multicast, so the check if this is indeed true and eventually return a EINVAL if not, should be done before calling inp_lookup_mcast_ifp. This fixes a kernel crash when calling setsockopt (sock, IPPROTO_IP, IP_ADD_MEMBERSHIP,...) with invalid group address. Reviewed by: bms Approved by: bms MFC after: 3 days Modified: head/sys/netinet/in_mcast.c Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Mon Sep 7 15:52:15 2009 (r196931) +++ head/sys/netinet/in_mcast.c Mon Sep 7 16:00:33 2009 (r196932) @@ -1899,6 +1899,9 @@ inp_join_group(struct inpcb *inp, struct ssa->sin.sin_addr = mreqs.imr_sourceaddr; } + if (!IN_MULTICAST(ntohl(gsa->sin.sin_addr.s_addr))) + return (EINVAL); + ifp = inp_lookup_mcast_ifp(inp, &gsa->sin, mreqs.imr_interface); CTR3(KTR_IGMPV3, "%s: imr_interface = %s, ifp = %p", @@ -1936,6 +1939,9 @@ inp_join_group(struct inpcb *inp, struct ssa->sin.sin_port = 0; } + if (!IN_MULTICAST(ntohl(gsa->sin.sin_addr.s_addr))) + return (EINVAL); + if (gsr.gsr_interface == 0 || V_if_index < gsr.gsr_interface) return (EADDRNOTAVAIL); ifp = ifnet_byindex(gsr.gsr_interface); @@ -1948,9 +1954,6 @@ inp_join_group(struct inpcb *inp, struct break; } - if (!IN_MULTICAST(ntohl(gsa->sin.sin_addr.s_addr))) - return (EINVAL); - if (ifp == NULL || (ifp->if_flags & IFF_MULTICAST) == 0) return (EADDRNOTAVAIL); From sam at FreeBSD.org Mon Sep 7 16:08:22 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Mon Sep 7 16:08:32 2009 Subject: svn commit: r196933 - head/sys/dev/ath Message-ID: <200909071608.n87G8Lqq019727@svn.freebsd.org> Author: sam Date: Mon Sep 7 16:08:21 2009 New Revision: 196933 URL: http://svn.freebsd.org/changeset/base/196933 Log: correct typo that was a noop on 32-bit machines but a bug on 64-bit machines Submitted by: phk Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Mon Sep 7 16:00:33 2009 (r196932) +++ head/sys/dev/ath/if_ath.c Mon Sep 7 16:08:21 2009 (r196933) @@ -1452,7 +1452,7 @@ ath_hal_gethangstate(struct ath_hal *ah, uint32_t rsize; void *sp; - if (!ath_hal_getdiagstate(ah, 32, &mask, sizeof(&mask), &sp, &rsize)) + if (!ath_hal_getdiagstate(ah, 32, &mask, sizeof(mask), &sp, &rsize)) return 0; KASSERT(rsize == sizeof(uint32_t), ("resultsize %u", rsize)); *hangs = *(uint32_t *)sp; From sam at FreeBSD.org Mon Sep 7 16:12:07 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Mon Sep 7 16:12:24 2009 Subject: svn commit: r196934 - head/sys/dev/ath/ath_hal Message-ID: <200909071612.n87GC7tW019850@svn.freebsd.org> Author: sam Date: Mon Sep 7 16:12:07 2009 New Revision: 196934 URL: http://svn.freebsd.org/changeset/base/196934 Log: fix extraneous return that can cause a memory leak Submitted by: phk MFC after: 1 week Modified: head/sys/dev/ath/ath_hal/ah_eeprom_v3.c Modified: head/sys/dev/ath/ath_hal/ah_eeprom_v3.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah_eeprom_v3.c Mon Sep 7 16:08:21 2009 (r196933) +++ head/sys/dev/ath/ath_hal/ah_eeprom_v3.c Mon Sep 7 16:12:07 2009 (r196934) @@ -1759,7 +1759,7 @@ legacyEepromDetach(struct ath_hal *ah) HAL_EEPROM *ee = AH_PRIVATE(ah)->ah_eeprom; if (ee->ee_version >= AR_EEPROM_VER4_0 && ee->ee_eepMap == 1) - return freeEepromRawPowerCalInfo5112(ah, ee); + freeEepromRawPowerCalInfo5112(ah, ee); ath_hal_free(ee); AH_PRIVATE(ah)->ah_eeprom = AH_NULL; } From sam at FreeBSD.org Mon Sep 7 16:18:17 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Mon Sep 7 16:18:28 2009 Subject: svn commit: r196935 - head/sys/dev/ath Message-ID: <200909071618.n87GIGHh020046@svn.freebsd.org> Author: sam Date: Mon Sep 7 16:18:16 2009 New Revision: 196935 URL: http://svn.freebsd.org/changeset/base/196935 Log: remove extranous return Submitted by: phk MFC after: 1 week Modified: head/sys/dev/ath/ah_osdep.c Modified: head/sys/dev/ath/ah_osdep.c ============================================================================== --- head/sys/dev/ath/ah_osdep.c Mon Sep 7 16:12:07 2009 (r196934) +++ head/sys/dev/ath/ah_osdep.c Mon Sep 7 16:18:16 2009 (r196935) @@ -110,7 +110,7 @@ ath_hal_malloc(size_t size) void ath_hal_free(void* p) { - return free(p, M_ATH_HAL); + free(p, M_ATH_HAL); } void From trasz at FreeBSD.org Mon Sep 7 16:19:33 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Mon Sep 7 16:19:45 2009 Subject: svn commit: r196936 - head/bin/setfacl Message-ID: <200909071619.n87GJXwc020108@svn.freebsd.org> Author: trasz Date: Mon Sep 7 16:19:32 2009 New Revision: 196936 URL: http://svn.freebsd.org/changeset/base/196936 Log: Add NFSv4 support to setfacl(1). Reviewed by: rwatson Modified: head/bin/setfacl/mask.c head/bin/setfacl/merge.c head/bin/setfacl/remove.c head/bin/setfacl/setfacl.1 head/bin/setfacl/setfacl.c head/bin/setfacl/setfacl.h Modified: head/bin/setfacl/mask.c ============================================================================== --- head/bin/setfacl/mask.c Mon Sep 7 16:18:16 2009 (r196935) +++ head/bin/setfacl/mask.c Mon Sep 7 16:19:32 2009 (r196936) @@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$"); /* set the appropriate mask the given ACL's */ int -set_acl_mask(acl_t *prev_acl) +set_acl_mask(acl_t *prev_acl, const char *filename) { acl_entry_t entry; acl_t acl; @@ -59,7 +59,7 @@ set_acl_mask(acl_t *prev_acl) acl = acl_dup(*prev_acl); if (acl == NULL) - err(1, "acl_dup() failed"); + err(1, "%s: acl_dup() failed", filename); if (n_flag == 0) { /* @@ -70,7 +70,7 @@ set_acl_mask(acl_t *prev_acl) * class in the resulting ACL */ if (acl_calc_mask(&acl)) { - warn("acl_calc_mask() failed"); + warn("%s: acl_calc_mask() failed", filename); acl_free(acl); return (-1); } @@ -86,7 +86,8 @@ set_acl_mask(acl_t *prev_acl) while (acl_get_entry(acl, entry_id, &entry) == 1) { entry_id = ACL_NEXT_ENTRY; if (acl_get_tag_type(entry, &tag) == -1) - err(1, "acl_get_tag_type() failed"); + err(1, "%s: acl_get_tag_type() failed", + filename); if (tag == ACL_MASK) { acl_free(acl); @@ -100,7 +101,7 @@ set_acl_mask(acl_t *prev_acl) * file, then write an error message to standard error and * continue with the next file. */ - warnx("warning: no mask entry"); + warnx("%s: warning: no mask entry", filename); acl_free(acl); return (0); } Modified: head/bin/setfacl/merge.c ============================================================================== --- head/bin/setfacl/merge.c Mon Sep 7 16:18:16 2009 (r196935) +++ head/bin/setfacl/merge.c Mon Sep 7 16:19:32 2009 (r196936) @@ -36,12 +36,15 @@ __FBSDID("$FreeBSD$"); #include "setfacl.h" -static int merge_user_group(acl_entry_t *entry, acl_entry_t *entry_new); +static int merge_user_group(acl_entry_t *entry, acl_entry_t *entry_new, + int acl_brand); static int -merge_user_group(acl_entry_t *entry, acl_entry_t *entry_new) +merge_user_group(acl_entry_t *entry, acl_entry_t *entry_new, int acl_brand) { acl_permset_t permset; + acl_entry_type_t entry_type; + acl_flagset_t flagset; int have_entry; uid_t *id, *id_new; @@ -59,6 +62,18 @@ merge_user_group(acl_entry_t *entry, acl err(1, "acl_get_permset() failed"); if (acl_set_permset(*entry_new, permset) == -1) err(1, "acl_set_permset() failed"); + + if (acl_brand == ACL_BRAND_NFS4) { + if (acl_get_entry_type_np(*entry, &entry_type)) + err(1, "acl_get_entry_type_np() failed"); + if (acl_set_entry_type_np(*entry_new, entry_type)) + err(1, "acl_set_entry_type_np() failed"); + if (acl_get_flagset_np(*entry, &flagset)) + err(1, "acl_get_flagset_np() failed"); + if (acl_set_flagset_np(*entry_new, flagset)) + err(1, "acl_set_flagset_np() failed"); + } + have_entry = 1; } acl_free(id); @@ -71,20 +86,31 @@ merge_user_group(acl_entry_t *entry, acl * merge an ACL into existing file's ACL */ int -merge_acl(acl_t acl, acl_t *prev_acl) +merge_acl(acl_t acl, acl_t *prev_acl, const char *filename) { acl_entry_t entry, entry_new; acl_permset_t permset; acl_t acl_new; acl_tag_t tag, tag_new; - int entry_id, entry_id_new, have_entry; + acl_entry_type_t entry_type, entry_type_new; + acl_flagset_t flagset; + int entry_id, entry_id_new, have_entry, entry_number = 0; + int acl_brand, prev_acl_brand; + + acl_get_brand_np(acl, &acl_brand); + acl_get_brand_np(*prev_acl, &prev_acl_brand); + + if (acl_brand != prev_acl_brand) { + warnx("%s: branding mismatch; existing ACL is %s, " + "entry to be merged is %s", filename, + prev_acl_brand == ACL_BRAND_NFS4 ? "NFSv4" : "POSIX.1e", + acl_brand == ACL_BRAND_NFS4 ? "NFSv4" : "POSIX.1e"); + return (-1); + } - if (acl_type == ACL_TYPE_ACCESS) - acl_new = acl_dup(prev_acl[ACCESS_ACL]); - else - acl_new = acl_dup(prev_acl[DEFAULT_ACL]); + acl_new = acl_dup(*prev_acl); if (acl_new == NULL) - err(1, "acl_dup() failed"); + err(1, "%s: acl_dup() failed", filename); entry_id = ACL_FIRST_ENTRY; @@ -94,28 +120,45 @@ merge_acl(acl_t acl, acl_t *prev_acl) /* keep track of existing ACL_MASK entries */ if (acl_get_tag_type(entry, &tag) == -1) - err(1, "acl_get_tag_type() failed - invalid ACL entry"); + err(1, "%s: acl_get_tag_type() failed - " + "invalid ACL entry", filename); if (tag == ACL_MASK) have_mask = 1; /* check against the existing ACL entries */ entry_id_new = ACL_FIRST_ENTRY; - while (have_entry == 0 && - acl_get_entry(acl_new, entry_id_new, &entry_new) == 1) { + while (acl_get_entry(acl_new, entry_id_new, &entry_new) == 1) { entry_id_new = ACL_NEXT_ENTRY; if (acl_get_tag_type(entry, &tag) == -1) - err(1, "acl_get_tag_type() failed"); + err(1, "%s: acl_get_tag_type() failed", + filename); if (acl_get_tag_type(entry_new, &tag_new) == -1) - err(1, "acl_get_tag_type() failed"); + err(1, "%s: acl_get_tag_type() failed", + filename); if (tag != tag_new) continue; + /* + * For NFSv4, in addition to "tag" and "id" we also + * compare "entry_type". + */ + if (acl_brand == ACL_BRAND_NFS4) { + if (acl_get_entry_type_np(entry, &entry_type)) + err(1, "%s: acl_get_entry_type_np() " + "failed", filename); + if (acl_get_entry_type_np(entry_new, &entry_type_new)) + err(1, "%s: acl_get_entry_type_np() " + "failed", filename); + if (entry_type != entry_type_new) + continue; + } + switch(tag) { case ACL_USER: case ACL_GROUP: have_entry = merge_user_group(&entry, - &entry_new); + &entry_new, acl_brand); if (have_entry == 0) break; /* FALLTHROUGH */ @@ -123,37 +166,127 @@ merge_acl(acl_t acl, acl_t *prev_acl) case ACL_GROUP_OBJ: case ACL_OTHER: case ACL_MASK: + case ACL_EVERYONE: if (acl_get_permset(entry, &permset) == -1) - err(1, "acl_get_permset() failed"); + err(1, "%s: acl_get_permset() failed", + filename); if (acl_set_permset(entry_new, permset) == -1) - err(1, "acl_set_permset() failed"); + err(1, "%s: acl_set_permset() failed", + filename); + + if (acl_brand == ACL_BRAND_NFS4) { + if (acl_get_entry_type_np(entry, &entry_type)) + err(1, "%s: acl_get_entry_type_np() failed", + filename); + if (acl_set_entry_type_np(entry_new, entry_type)) + err(1, "%s: acl_set_entry_type_np() failed", + filename); + if (acl_get_flagset_np(entry, &flagset)) + err(1, "%s: acl_get_flagset_np() failed", + filename); + if (acl_set_flagset_np(entry_new, flagset)) + err(1, "%s: acl_set_flagset_np() failed", + filename); + } have_entry = 1; break; default: /* should never be here */ - errx(1, "Invalid tag type: %i", tag); + errx(1, "%s: invalid tag type: %i", filename, tag); break; } } /* if this entry has not been found, it must be new */ if (have_entry == 0) { - if (acl_create_entry(&acl_new, &entry_new) == -1) { - acl_free(acl_new); - return (-1); + + /* + * NFSv4 ACL entries must be prepended to the ACL. + * Appending them at the end makes no sense, since + * in most cases they wouldn't even get evaluated. + */ + if (acl_brand == ACL_BRAND_NFS4) { + if (acl_create_entry_np(&acl_new, &entry_new, entry_number) == -1) { + warn("%s: acl_create_entry_np() failed", filename); + acl_free(acl_new); + return (-1); + } + /* + * Without this increment, adding several + * entries at once, for example + * "setfacl -m user:1:r:allow,user:2:r:allow", + * would make them appear in reverse order. + */ + entry_number++; + } else { + if (acl_create_entry(&acl_new, &entry_new) == -1) { + warn("%s: acl_create_entry() failed", filename); + acl_free(acl_new); + return (-1); + } } if (acl_copy_entry(entry_new, entry) == -1) - err(1, "acl_copy_entry() failed"); + err(1, "%s: acl_copy_entry() failed", filename); } } - if (acl_type == ACL_TYPE_ACCESS) { - acl_free(prev_acl[ACCESS_ACL]); - prev_acl[ACCESS_ACL] = acl_new; - } else { - acl_free(prev_acl[DEFAULT_ACL]); - prev_acl[DEFAULT_ACL] = acl_new; + acl_free(*prev_acl); + *prev_acl = acl_new; + + return (0); +} + +int +add_acl(acl_t acl, uint entry_number, acl_t *prev_acl, const char *filename) +{ + acl_entry_t entry, entry_new; + acl_t acl_new; + int entry_id, acl_brand, prev_acl_brand; + + acl_get_brand_np(acl, &acl_brand); + acl_get_brand_np(*prev_acl, &prev_acl_brand); + + if (prev_acl_brand != ACL_BRAND_NFS4) { + warnx("%s: the '-a' option is only applicable to NFSv4 ACLs", + filename); + return (-1); + } + + if (acl_brand != ACL_BRAND_NFS4) { + warnx("%s: branding mismatch; existing ACL is NFSv4, " + "entry to be added is POSIX.1e", filename); + return (-1); + } + + acl_new = acl_dup(*prev_acl); + if (acl_new == NULL) + err(1, "%s: acl_dup() failed", filename); + + entry_id = ACL_FIRST_ENTRY; + + while (acl_get_entry(acl, entry_id, &entry) == 1) { + entry_id = ACL_NEXT_ENTRY; + + if (acl_create_entry_np(&acl_new, &entry_new, entry_number) == -1) { + warn("%s: acl_create_entry_np() failed", filename); + acl_free(acl_new); + return (-1); + } + + /* + * Without this increment, adding several + * entries at once, for example + * "setfacl -m user:1:r:allow,user:2:r:allow", + * would make them appear in reverse order. + */ + entry_number++; + + if (acl_copy_entry(entry_new, entry) == -1) + err(1, "%s: acl_copy_entry() failed", filename); } + acl_free(*prev_acl); + *prev_acl = acl_new; + return (0); } Modified: head/bin/setfacl/remove.c ============================================================================== --- head/bin/setfacl/remove.c Mon Sep 7 16:18:16 2009 (r196935) +++ head/bin/setfacl/remove.c Mon Sep 7 16:19:32 2009 (r196936) @@ -41,21 +41,31 @@ __FBSDID("$FreeBSD$"); * remove ACL entries from an ACL */ int -remove_acl(acl_t acl, acl_t *prev_acl) +remove_acl(acl_t acl, acl_t *prev_acl, const char *filename) { acl_entry_t entry; acl_t acl_new; acl_tag_t tag; - int carried_error, entry_id; + int carried_error, entry_id, acl_brand, prev_acl_brand; + + carried_error = 0; + + acl_get_brand_np(acl, &acl_brand); + acl_get_brand_np(*prev_acl, &prev_acl_brand); + + if (acl_brand != prev_acl_brand) { + warnx("%s: branding mismatch; existing ACL is %s, " + "entry to be removed is %s", filename, + prev_acl_brand == ACL_BRAND_NFS4 ? "NFSv4" : "POSIX.1e", + acl_brand == ACL_BRAND_NFS4 ? "NFSv4" : "POSIX.1e"); + return (-1); + } carried_error = 0; - if (acl_type == ACL_TYPE_ACCESS) - acl_new = acl_dup(prev_acl[ACCESS_ACL]); - else - acl_new = acl_dup(prev_acl[DEFAULT_ACL]); + acl_new = acl_dup(*prev_acl); if (acl_new == NULL) - err(1, "acl_dup() failed"); + err(1, "%s: acl_dup() failed", filename); tag = ACL_UNDEFINED_TAG; @@ -64,23 +74,68 @@ remove_acl(acl_t acl, acl_t *prev_acl) while (acl_get_entry(acl, entry_id, &entry) == 1) { entry_id = ACL_NEXT_ENTRY; if (acl_get_tag_type(entry, &tag) == -1) - err(1, "acl_get_tag_type() failed"); + err(1, "%s: acl_get_tag_type() failed", filename); if (tag == ACL_MASK) have_mask++; if (acl_delete_entry(acl_new, entry) == -1) { carried_error++; - warnx("cannot remove non-existent acl entry"); + warnx("%s: cannot remove non-existent ACL entry", + filename); } } - if (acl_type == ACL_TYPE_ACCESS) { - acl_free(prev_acl[ACCESS_ACL]); - prev_acl[ACCESS_ACL] = acl_new; - } else { - acl_free(prev_acl[DEFAULT_ACL]); - prev_acl[DEFAULT_ACL] = acl_new; + acl_free(*prev_acl); + *prev_acl = acl_new; + + if (carried_error) + return (-1); + + return (0); +} + +int +remove_by_number(uint entry_number, acl_t *prev_acl, const char *filename) +{ + acl_entry_t entry; + acl_t acl_new; + acl_tag_t tag; + int carried_error, entry_id; + uint i; + + carried_error = 0; + + acl_new = acl_dup(*prev_acl); + if (acl_new == NULL) + err(1, "%s: acl_dup() failed", filename); + + tag = ACL_UNDEFINED_TAG; + + /* + * Find out whether we're removing the mask entry, + * to behave the same as the routine above. + * + * XXX: Is this loop actually needed? + */ + entry_id = ACL_FIRST_ENTRY; + i = 0; + while (acl_get_entry(acl_new, entry_id, &entry) == 1) { + entry_id = ACL_NEXT_ENTRY; + if (i != entry_number) + continue; + if (acl_get_tag_type(entry, &tag) == -1) + err(1, "%s: acl_get_tag_type() failed", filename); + if (tag == ACL_MASK) + have_mask++; + } + + if (acl_delete_entry_np(acl_new, entry_number) == -1) { + carried_error++; + warn("%s: acl_delete_entry_np() failed", filename); } + acl_free(*prev_acl); + *prev_acl = acl_new; + if (carried_error) return (-1); @@ -91,18 +146,14 @@ remove_acl(acl_t acl, acl_t *prev_acl) * remove default entries */ int -remove_default(acl_t *prev_acl) +remove_default(acl_t *prev_acl, const char *filename) { - if (prev_acl[1]) { - acl_free(prev_acl[1]); - prev_acl[1] = acl_init(ACL_MAX_ENTRIES); - if (prev_acl[1] == NULL) - err(1, "acl_init() failed"); - } else { - warn("cannot remove default ACL"); - return (-1); - } + acl_free(*prev_acl); + *prev_acl = acl_init(ACL_MAX_ENTRIES); + if (*prev_acl == NULL) + err(1, "%s: acl_init() failed", filename); + return (0); } @@ -110,71 +161,14 @@ remove_default(acl_t *prev_acl) * remove extended entries */ void -remove_ext(acl_t *prev_acl) +remove_ext(acl_t *prev_acl, const char *filename) { - acl_t acl_new, acl_old; - acl_entry_t entry, entry_new; - acl_permset_t perm; - acl_tag_t tag; - int entry_id, have_mask_entry; - - if (acl_type == ACL_TYPE_ACCESS) - acl_old = acl_dup(prev_acl[ACCESS_ACL]); - else - acl_old = acl_dup(prev_acl[DEFAULT_ACL]); - if (acl_old == NULL) - err(1, "acl_dup() failed"); + acl_t acl_new; - have_mask_entry = 0; - acl_new = acl_init(ACL_MAX_ENTRIES); + acl_new = acl_strip_np(*prev_acl, !n_flag); if (acl_new == NULL) - err(1, "acl_init() failed"); - tag = ACL_UNDEFINED_TAG; - - /* only save the default user/group/other entries */ - entry_id = ACL_FIRST_ENTRY; - while (acl_get_entry(acl_old, entry_id, &entry) == 1) { - entry_id = ACL_NEXT_ENTRY; - - if (acl_get_tag_type(entry, &tag) == -1) - err(1, "acl_get_tag_type() failed"); - - switch(tag) { - case ACL_USER_OBJ: - case ACL_GROUP_OBJ: - case ACL_OTHER: - if (acl_get_tag_type(entry, &tag) == -1) - err(1, "acl_get_tag_type() failed"); - if (acl_get_permset(entry, &perm) == -1) - err(1, "acl_get_permset() failed"); - if (acl_create_entry(&acl_new, &entry_new) == -1) - err(1, "acl_create_entry() failed"); - if (acl_set_tag_type(entry_new, tag) == -1) - err(1, "acl_set_tag_type() failed"); - if (acl_set_permset(entry_new, perm) == -1) - err(1, "acl_get_permset() failed"); - if (acl_copy_entry(entry_new, entry) == -1) - err(1, "acl_copy_entry() failed"); - break; - case ACL_MASK: - have_mask_entry = 1; - break; - default: - break; - } - } - if (have_mask_entry && n_flag == 0) { - if (acl_calc_mask(&acl_new) == -1) - err(1, "acl_calc_mask() failed"); - } else { - have_mask = 1; - } + err(1, "%s: acl_strip_np() failed", filename); - if (acl_type == ACL_TYPE_ACCESS) { - acl_free(prev_acl[ACCESS_ACL]); - prev_acl[ACCESS_ACL] = acl_new; - } else { - acl_free(prev_acl[DEFAULT_ACL]); - prev_acl[DEFAULT_ACL] = acl_new; - } + acl_free(*prev_acl); + *prev_acl = acl_new; } Modified: head/bin/setfacl/setfacl.1 ============================================================================== --- head/bin/setfacl/setfacl.1 Mon Sep 7 16:18:16 2009 (r196935) +++ head/bin/setfacl/setfacl.1 Mon Sep 7 16:19:32 2009 (r196936) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 7, 2001 +.Dd September 5, 2009 .Dt SETFACL 1 .Os .Sh NAME @@ -34,9 +34,10 @@ .Sh SYNOPSIS .Nm .Op Fl bdhkn +.Op Fl a Ar position entries .Op Fl m Ar entries .Op Fl M Ar file -.Op Fl x Ar entries +.Op Fl x Ar entries | position .Op Fl X Ar file .Op Ar .Sh DESCRIPTION @@ -50,9 +51,19 @@ the file names are taken from the standa .Pp The following options are available: .Bl -tag -width indent +.It Fl a Ar position entries +Modify the ACL on the specified files by inserting new +ACL entries +specified in +.Ar entries , +starting at position +.Ar position , +counting from zero. +This option is only applicable to NFSv4 ACLs. .It Fl b -Remove all ACL entries except for the three required entries. -If the ACL contains a +Remove all ACL entries except for the three required entries +(POSIX.1e ACLs) or six "canonical" entries (NFSv4 ACLs). +If the POSIX.1e ACL contains a .Dq Li mask entry, the permissions of the .Dq Li group @@ -66,7 +77,7 @@ entries of the current ACL. The operations apply to the default ACL entries instead of access ACL entries. Currently only directories may have -default ACL's. +default ACL's. This option is not applicable to NFSv4 ACLs. .It Fl h If the target of the operation is a symbolic link, perform the operation on the symbolic link itself, rather than following the link. @@ -77,7 +88,7 @@ is not considered an error if the specif any default ACL entries. An error will be reported if any of the specified files cannot have a default entry (i.e.\& -non-directories). +non-directories). This option is not applicable to NFSv4 ACLs. .It Fl m Ar entries Modify the ACL entries on the specified files by adding new entries and modifying existing ACL entries with the ACL entries @@ -95,11 +106,15 @@ is the input is taken from stdin. .It Fl n Do not recalculate the permissions associated with the ACL -mask entry. -.It Fl x Ar entries -Remove the ACL entries specified in +mask entry. This option is not applicable to NFSv4 ACLs. +.It Fl x Ar entries | position +If .Ar entries +is specified, remove the ACL entries specified there from the access or default ACL of the specified files. +Otherwise, remove entry at index +.Ar position , +counting from zero. .It Fl X Ar file Remove the ACL entries specified in the file .Ar file @@ -108,8 +123,8 @@ from the access or default ACL of the sp .Pp The above options are evaluated in the order specified on the command-line. -.Sh ACL ENTRIES -An ACL entry contains three colon-separated fields: +.Sh POSIX.1e ACL ENTRIES +A POSIX.1E ACL entry contains three colon-separated fields: an ACL tag, an ACL qualifier, and discretionary access permissions: .Bl -tag -width indent @@ -223,7 +238,7 @@ previously specified; whitespace is igno .Ql # is ignored (comments). .Pp -When ACL entries are evaluated, the access check algorithm checks +When POSIX.1e ACL entries are evaluated, the access check algorithm checks the ACL entries in the following order: file owner, .Dq Li user ACL entries, file owning group, @@ -243,13 +258,135 @@ ACL entries for user, group, other and m For more details see the examples below. Default ACLs can be created by using .Fl d . +.Sh NFSv4 ACL ENTRIES +An NFSv4 ACL entry contains four or five colon-separated fields: an ACL tag, +an ACL qualifier (only for +.Dq Li user +and +.Dq Li group +tags), discretionary access permissions, ACL inheritance flags, and ACL type: +.Bl -tag -width indent +.It Ar "ACL tag" +The ACL tag specifies the ACL entry type and consists of +one of the following: +.Dq Li user +or +.Ql u +specifying the access +granted to the specified user; +.Dq Li group +or +.Ql g +specifying the access granted to the specified group; +.Dq Li owner@ +specifying the access granted to the owner of the file; +.Dq Li group@ +specifying the access granted to the file owning group; +.Dq Li everyone@ +specifying everyone. Note that +.Dq Li everyone@ +is not the same as traditional Unix +.Dq Li other +- it means, +literally, everyone, including file owner and owning group. +.It Ar "ACL qualifier" +The ACL qualifier field describes the user or group associated with +the ACL entry. +It may consist of one of the following: uid or +user name, or gid or group name. In entries whose tag type is +one of +.Dq Li owner@ , +.Dq Li group@ , +or +.Dq Li everyone@ , +this field is ommited altogether, including the trailing comma. +.It Ar "access permissions" +Access permissions may be specified in either short or long form. +Short and long forms may not be mixed. +Permissions in long form are separated by the +.Ql / +character; in short form, they are concatenated together. +Valid permissions are: +.Bl -tag -width ".Dv short" +.It Short +Long +.It r +read_data +.It w +write_data +.It x +execute +.It p +append_data +.It d +delete_child +.It D +delete +.It a +read_attributes +.It A +write_attributes +.It R +read_xattr +.It W +write_xattr +.It c +read_acl +.It C +write_acl +.It o +write_owner +.It S +synchronize +.El +.It Ar "ACL inheritance flags" +Inheritance flags may be specified in either short or long form. +Short and long forms may not be mixed. +Access flags in long form are separated by the +.Ql / +character; in short form, they are concatenated together. +Valid inheritance flags are: +.Bl -tag -width ".Dv short" +.It Short +Long +.It f +file_inherit +.It d +dir_inherit +.It i +inherit_only +.It n +no_propagate +.El +.Pp +Inheritance flags may be only set on directories. +.It Ar "ACL type" +The ACL type field is either +.Dq Li allow +or +.Dq Li deny . +.El +.Pp +ACL entries applied from a file using the +.Fl M +or +.Fl X +options shall be of the following form: one ACL entry per line, as +previously specified; whitespace is ignored; any text after a +.Ql # +is ignored (comments). +.Pp +NFSv4 ACL entries are evaluated in their visible order. +.Pp +Multiple ACL entries specified on the command line are +separated by commas. .Sh EXIT STATUS .Ex -std .Sh EXAMPLES .Dl setfacl -d -m u::rwx,g::rx,o::rx,mask::rwx dir .Dl setfacl -d -m g:admins:rwx dir .Pp -The first command sets the mandatory elements of the default ACL. +The first command sets the mandatory elements of the POSIX.1e default ACL. The second command specifies that users in group admins can have read, write, and execute permissions for directory named "dir". It should be noted that any files or directories created underneath "dir" will @@ -259,9 +396,13 @@ inherit these default ACLs upon creation .Pp Sets read, write, and execute permissions for the .Pa file -owner's ACL entry and read and write permissions for group mail on +owner's POSIX.1e ACL entry and read and write permissions for group mail on .Pa file . .Pp +.Dl setfacl -m owner@:rwxp::allow,g:mail:rwp::allow file +.Pp +Semantically equal to the example above, but for NFSv4 ACL. +.Pp .Dl setfacl -M file1 file2 .Pp Sets/updates the ACL entries contained in @@ -271,10 +412,15 @@ on .Pp .Dl setfacl -x g:mail:rw file .Pp -Remove the group mail ACL entry containing read/write permissions +Remove the group mail POSIX.1e ACL entry containing read/write permissions from .Pa file . .Pp +.Dl setfacl -x0 file +.Pp +Remove the first entry from the NFSv4 ACL from +.Pa file . +.Pp .Dl setfacl -bn file .Pp Remove all Modified: head/bin/setfacl/setfacl.c ============================================================================== --- head/bin/setfacl/setfacl.c Mon Sep 7 16:18:16 2009 (r196935) +++ head/bin/setfacl/setfacl.c Mon Sep 7 16:19:32 2009 (r196936) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -41,9 +42,8 @@ __FBSDID("$FreeBSD$"); #include "setfacl.h" -static void add_filename(const char *filename); -static acl_t *get_file_acls(const char *filename); -static void usage(void); +static void add_filename(const char *filename); +static void usage(void); static void add_filename(const char *filename) @@ -59,57 +59,28 @@ add_filename(const char *filename) TAILQ_INSERT_TAIL(&filelist, file, next); } -static acl_t * -get_file_acls(const char *filename) -{ - acl_t *acl; - struct stat sb; - - if (stat(filename, &sb) == -1) { - warn("stat() of %s failed", filename); - return (NULL); - } - - acl = zmalloc(sizeof(acl_t) * 2); - if (h_flag) - acl[ACCESS_ACL] = acl_get_link_np(filename, ACL_TYPE_ACCESS); - else - acl[ACCESS_ACL] = acl_get_file(filename, ACL_TYPE_ACCESS); - if (acl[ACCESS_ACL] == NULL) - err(1, "acl_get_file() failed"); - if (S_ISDIR(sb.st_mode)) { - if (h_flag) - acl[DEFAULT_ACL] = acl_get_link_np(filename, - ACL_TYPE_DEFAULT); - else - acl[DEFAULT_ACL] = acl_get_file(filename, - ACL_TYPE_DEFAULT); - if (acl[DEFAULT_ACL] == NULL) - err(1, "acl_get_file() failed"); - } else - acl[DEFAULT_ACL] = NULL; - - return (acl); -} - static void usage(void) { - fprintf(stderr, "usage: setfacl [-bdhkn] [-m entries] [-M file] " - "[-x entries] [-X file] [file ...]\n"); + fprintf(stderr, "usage: setfacl [-bdhkn] [-a position entries] " + "[-m entries] [-M file] [-x entries] [-X file] [file ...]\n"); exit(1); } int main(int argc, char *argv[]) { - acl_t *acl, final_acl; + acl_t acl; + acl_type_t acl_type; char filename[PATH_MAX]; - int local_error, carried_error, ch, i; + int local_error, carried_error, ch, i, entry_number, ret; + int h_flag; struct sf_file *file; struct sf_entry *entry; const char *fn_dup; + char *end; + struct stat sb; acl_type = ACL_TYPE_ACCESS; carried_error = local_error = 0; @@ -118,13 +89,13 @@ main(int argc, char *argv[]) TAILQ_INIT(&entrylist); TAILQ_INIT(&filelist); - while ((ch = getopt(argc, argv, "M:X:bdhkm:nx:")) != -1) + while ((ch = getopt(argc, argv, "M:X:a:bdhkm:nx:")) != -1) switch(ch) { case 'M': entry = zmalloc(sizeof(struct sf_entry)); entry->acl = get_acl_from_file(optarg); if (entry->acl == NULL) - err(1, "get_acl_from_file() failed"); + err(1, "%s: get_acl_from_file() failed", optarg); entry->op = OP_MERGE_ACL; TAILQ_INSERT_TAIL(&entrylist, entry, next); break; @@ -134,6 +105,25 @@ main(int argc, char *argv[]) entry->op = OP_REMOVE_ACL; TAILQ_INSERT_TAIL(&entrylist, entry, next); break; + case 'a': + entry = zmalloc(sizeof(struct sf_entry)); + + entry_number = strtol(optarg, &end, 10); + if (end - optarg != (int)strlen(optarg)) + errx(1, "%s: invalid entry number", optarg); + if (entry_number < 0) + errx(1, "%s: entry number cannot be less than zero", optarg); + entry->entry_number = entry_number; + + if (argv[optind] == NULL) + errx(1, "missing ACL"); + entry->acl = acl_from_text(argv[optind]); + if (entry->acl == NULL) + err(1, "%s", argv[optind]); + optind++; + entry->op = OP_ADD_ACL; + TAILQ_INSERT_TAIL(&entrylist, entry, next); + break; case 'b': entry = zmalloc(sizeof(struct sf_entry)); entry->op = OP_REMOVE_EXT; @@ -163,10 +153,18 @@ main(int argc, char *argv[]) break; case 'x': entry = zmalloc(sizeof(struct sf_entry)); - entry->acl = acl_from_text(optarg); - if (entry->acl == NULL) - err(1, "%s", optarg); - entry->op = OP_REMOVE_ACL; + entry_number = strtol(optarg, &end, 10); + if (end - optarg == (int)strlen(optarg)) { + if (entry_number < 0) + errx(1, "%s: entry number cannot be less than zero", optarg); + entry->entry_number = entry_number; + entry->op = OP_REMOVE_BY_NUMBER; + } else { + entry->acl = acl_from_text(optarg); + if (entry->acl == NULL) + err(1, "%s", optarg); + entry->op = OP_REMOVE_ACL; + } TAILQ_INSERT_TAIL(&entrylist, entry, next); break; default: @@ -199,16 +197,51 @@ main(int argc, char *argv[]) /* cycle through each file */ TAILQ_FOREACH(file, &filelist, next) { - /* get our initial access and default ACL's */ - acl = get_file_acls(file->filename); - if (acl == NULL) + local_error = 0; + + if (stat(file->filename, &sb) == -1) { + warn("%s: stat() failed", file->filename); continue; - if ((acl_type == ACL_TYPE_DEFAULT) && !acl[1]) { - warnx("Default ACL not valid for %s", file->filename); + } + + if (acl_type == ACL_TYPE_DEFAULT && S_ISDIR(sb.st_mode) == 0) { + warnx("%s: default ACL may only be set on a directory", + file->filename); continue; } - local_error = 0; + if (h_flag) + ret = lpathconf(file->filename, _PC_ACL_NFS4); + else + ret = pathconf(file->filename, _PC_ACL_NFS4); + if (ret > 0) { + if (acl_type == ACL_TYPE_DEFAULT) { + warnx("%s: there are no default entries " + "in NFSv4 ACLs", file->filename); + continue; + } + acl_type = ACL_TYPE_NFS4; + } else if (ret == 0) { + if (acl_type == ACL_TYPE_NFS4) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From pjd at FreeBSD.org Mon Sep 7 16:25:10 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Mon Sep 7 16:25:21 2009 Subject: svn commit: r196937 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci geom/multipath Message-ID: <200909071625.n87GPAxt020395@svn.freebsd.org> Author: pjd Date: Mon Sep 7 16:25:09 2009 New Revision: 196937 URL: http://svn.freebsd.org/changeset/base/196937 Log: MFC r196579: Fix an obvious topology lock leak. Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/geom/multipath/g_multipath.c Modified: stable/8/sys/geom/multipath/g_multipath.c ============================================================================== --- stable/8/sys/geom/multipath/g_multipath.c Mon Sep 7 16:19:32 2009 (r196936) +++ stable/8/sys/geom/multipath/g_multipath.c Mon Sep 7 16:25:09 2009 (r196937) @@ -198,6 +198,7 @@ g_multipath_done_error(struct bio *bp) if (sc->cp_active == NULL) { printf("GEOM_MULTIPATH: out of providers for %s\n", sc->sc_name); + g_topology_unlock(); return; } else { printf("GEOM_MULTIPATH: %s now active path in %s\n", From trasz at FreeBSD.org Mon Sep 7 16:26:04 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Mon Sep 7 16:26:12 2009 Subject: svn commit: r196938 - head/tools/regression/acltools Message-ID: <200909071626.n87GQ3al020449@svn.freebsd.org> Author: trasz Date: Mon Sep 7 16:26:03 2009 New Revision: 196938 URL: http://svn.freebsd.org/changeset/base/196938 Log: Add regression tests for NFSv4 ACLs and update POSIX.1e tests to the changed error messages. Added: head/tools/regression/acltools/01.t (contents, props changed) head/tools/regression/acltools/tools-nfs4.test (contents, props changed) Modified: head/tools/regression/acltools/00.t head/tools/regression/acltools/tools-posix.test Modified: head/tools/regression/acltools/00.t ============================================================================== --- head/tools/regression/acltools/00.t Mon Sep 7 16:25:09 2009 (r196937) +++ head/tools/regression/acltools/00.t Mon Sep 7 16:26:03 2009 (r196938) @@ -1,5 +1,32 @@ #!/bin/sh # +# Copyright (c) 2008, 2009 Edward Tomasz Napiera?a +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + # This is a wrapper script to run tools-posix.test. # # If any of the tests fails, here is how to debug it: go to @@ -9,9 +36,6 @@ # /usr/src/tools/regression/acltools/run /usr/src/tools/regression/acltools/tools-posix.test # # Output should be obvious. -# -# $FreeBSD$ -# echo "1..4" @@ -59,4 +83,3 @@ rmdir $MNT mdconfig -du $MD echo "ok 4" - Added: head/tools/regression/acltools/01.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/acltools/01.t Mon Sep 7 16:26:03 2009 (r196938) @@ -0,0 +1,86 @@ +#!/bin/sh +# +# Copyright (c) 2008, 2009 Edward Tomasz Napiera?a +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +# This is a wrapper script to run tools-nfs4.test on ZFS filesystem. +# +# WARNING: It uses hardcoded ZFS pool name "acltools" +# +# If any of the tests fails, here is how to debug it: go to +# the directory with problematic filesystem mounted on it, +# and do /path/to/test run /path/to/test tools-nfs4.test, e.g. +# +# /usr/src/tools/regression/acltools/run /usr/src/tools/regression/acltools/tools-nfs4.test +# +# Output should be obvious. + +echo "1..4" + +if [ `whoami` != "root" ]; then + echo "not ok 1 - you need to be root to run this test." + exit 1 +fi + +TESTDIR=`dirname $0` + +# Set up the test filesystem. +MD=`mdconfig -at swap -s 64m` +MNT=`mktemp -dt acltools` +zpool create -R $MNT acltools /dev/$MD +if [ $? -ne 0 ]; then + echo "not ok 1 - 'zpool create' failed." + exit 1 +fi + +echo "ok 1" + +cd $MNT + +# First, check whether we can crash the kernel by creating too many +# entries. For some reason this won't work in the test file. +touch xxx +setfacl -x5 xxx +while :; do setfacl -a0 u:42:rwx:allow xxx 2> /dev/null; if [ $? -ne 0 ]; then break; fi; done +chmod 600 xxx +rm xxx +echo "ok 2" + +perl $TESTDIR/run $TESTDIR/tools-nfs4.test > /dev/null + +if [ $? -eq 0 ]; then + echo "ok 3" +else + echo "not ok 3" +fi + +cd / +zpool destroy -f acltools +rmdir $MNT +mdconfig -du $MD + +echo "ok 4" Added: head/tools/regression/acltools/tools-nfs4.test ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/acltools/tools-nfs4.test Mon Sep 7 16:26:03 2009 (r196938) @@ -0,0 +1,829 @@ +# Copyright (c) 2008, 2009 Edward Tomasz Napiera?a +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +# This is a tools-level test for NFSv4 ACL functionality. Run it as root +# using ACL-enabled kernel: +# +# /usr/src/tools/regression/acltools/run /usr/src/tools/regression/acltools/tools-nfs4.test +# +# WARNING: Creates files in unsafe way. + +$ whoami +> root +$ umask 022 + +# Smoke test for getfacl(1). +$ touch xxx +$ getfacl xxx +> # file: xxx +> # owner: root +> # group: wheel +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> group@:-wxp----------:------:deny +> group@:r-------------:------:allow +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow + +$ getfacl -q xxx +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> group@:-wxp----------:------:deny +> group@:r-------------:------:allow +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow + +# Check verbose mode formatting. +$ getfacl -v xxx +> # file: xxx +> # owner: root +> # group: wheel +> owner@:execute::deny +> owner@:read_data/write_data/append_data/write_attributes/write_xattr/write_acl/write_owner::allow +> group@:write_data/execute/append_data::deny +> group@:read_data::allow +> everyone@:write_data/execute/append_data/write_attributes/write_xattr/write_acl/write_owner::deny +> everyone@:read_data/read_attributes/read_xattr/read_acl/synchronize::allow + +# Test setfacl -a. +$ setfacl -a2 u:0:write_acl:allow,g:1:read_acl:deny xxx +$ getfacl -n xxx +> # file: xxx +> # owner: root +> # group: wheel +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> user:0:-----------C--:------:allow +> group:1:----------c---:------:deny +> group@:-wxp----------:------:deny +> group@:r-------------:------:allow +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow + +# Test user and group name resolving. +$ rm xxx +$ touch xxx +$ setfacl -a2 u:root:write_acl:allow,g:daemon:read_acl:deny xxx +$ getfacl xxx +> # file: xxx +> # owner: root +> # group: wheel +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> user:root:-----------C--:------:allow +> group:daemon:----------c---:------:deny +> group@:-wxp----------:------:deny +> group@:r-------------:------:allow +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow + +# Check whether ls correctly marks files with "+". +$ ls -l xxx | cut -d' ' -f1 +> -rw-r--r--+ + +# Test removing entries by number. +$ setfacl -x 4 xxx +$ setfacl -x 4 xxx +$ getfacl -n xxx +> # file: xxx +> # owner: root +> # group: wheel +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> user:0:-----------C--:------:allow +> group:1:----------c---:------:deny +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow + +# Test setfacl -m. +$ setfacl -a0 everyone@:rwx:deny xxx +$ setfacl -a0 everyone@:rwx:deny xxx +$ setfacl -a0 everyone@:rwx:deny xxx +$ setfacl -m everyone@::deny xxx +$ getfacl -n xxx +> # file: xxx +> # owner: root +> # group: wheel +> everyone@:--------------:------:deny +> everyone@:--------------:------:deny +> everyone@:--------------:------:deny +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> user:0:-----------C--:------:allow +> group:1:----------c---:------:deny +> everyone@:--------------:------:deny +> everyone@:r-----a-R-c--s:------:allow + +# Test getfacl -i. +$ getfacl -i xxx +> # file: xxx +> # owner: root +> # group: wheel +> everyone@:--------------:------:deny +> everyone@:--------------:------:deny +> everyone@:--------------:------:deny +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> user:root:-----------C--:------:allow:0 +> group:daemon:----------c---:------:deny:1 +> everyone@:--------------:------:deny +> everyone@:r-----a-R-c--s:------:allow + +# Make sure cp without any flags does not copy copy the ACL. +$ cp xxx yyy +$ ls -l yyy | cut -d' ' -f1 +> -rw-r--r-- + +# Make sure it does with the "-p" flag. +$ rm yyy +$ cp -p xxx yyy +$ getfacl -n yyy +> # file: yyy +> # owner: root +> # group: wheel +> everyone@:--------------:------:deny +> everyone@:--------------:------:deny +> everyone@:--------------:------:deny +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> user:0:-----------C--:------:allow +> group:1:----------c---:------:deny +> everyone@:--------------:------:deny +> everyone@:r-----a-R-c--s:------:allow + +$ rm yyy + +# Test removing entries by... by example? +$ setfacl -x everyone@::deny xxx +$ getfacl -n xxx +> # file: xxx +> # owner: root +> # group: wheel +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> user:0:-----------C--:------:allow +> group:1:----------c---:------:deny +> everyone@:r-----a-R-c--s:------:allow + +# Test setfacl -b. +$ setfacl -b xxx +$ getfacl -n xxx +> # file: xxx +> # owner: root +> # group: wheel +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> group@:-wxp----------:------:deny +> group@:r-------------:------:allow +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow + +$ ls -l xxx | cut -d' ' -f1 +> -rw-r--r-- + +# Check setfacl(1) and getfacl(1) with multiple files. +$ touch xxx yyy zzz + +$ ls -l xxx yyy zzz | cut -d' ' -f1 +> -rw-r--r-- +> -rw-r--r-- +> -rw-r--r-- + +$ setfacl -m u:42:x:allow,g:43:w:allow nnn xxx yyy zzz +> setfacl: nnn: stat() failed: No such file or directory + +$ ls -l nnn xxx yyy zzz | cut -d' ' -f1 +> ls: nnn: No such file or directory +> -rw-r--r--+ +> -rw-r--r--+ +> -rw-r--r--+ + +$ getfacl -nq nnn xxx yyy zzz +> getfacl: nnn: stat() failed: No such file or directory +> user:42:--x-----------:------:allow +> group:43:-w------------:------:allow +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> group@:-wxp----------:------:deny +> group@:r-------------:------:allow +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow +> +> user:42:--x-----------:------:allow +> group:43:-w------------:------:allow +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> group@:-wxp----------:------:deny +> group@:r-------------:------:allow +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow +> +> user:42:--x-----------:------:allow +> group:43:-w------------:------:allow +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> group@:-wxp----------:------:deny +> group@:r-------------:------:allow +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow + +$ setfacl -b nnn xxx yyy zzz +> setfacl: nnn: stat() failed: No such file or directory + +$ ls -l nnn xxx yyy zzz | cut -d' ' -f1 +> ls: nnn: No such file or directory +> -rw-r--r-- +> -rw-r--r-- +> -rw-r--r-- + +$ rm xxx yyy zzz + +# Test applying mode to an ACL. +$ touch xxx +$ setfacl -a0 user:42:r:allow,user:43:w:deny,user:43:w:allow,user:44:x:allow -x everyone@::allow xxx +$ chmod 600 xxx +$ getfacl -n xxx +> # file: xxx +> # owner: root +> # group: wheel +> user:42:r-------------:------:deny +> user:42:r-------------:------:allow +> user:43:-w------------:------:deny +> user:43:-w------------:------:allow +> user:44:--x-----------:------:deny +> user:44:--x-----------:------:allow +> owner@:--------------:------:deny +> owner@:-------A-W-Co-:------:allow +> group@:--------------:------:deny +> group@:--------------:------:allow +> everyone@:-------A-W-Co-:------:deny +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> group@:rwxp----------:------:deny +> group@:--------------:------:allow +> everyone@:rwxp---A-W-Co-:------:deny +> everyone@:------a-R-c--s:------:allow +$ ls -l xxx | cut -d' ' -f1 +> -rw-------+ + +$ rm xxx +$ touch xxx +$ chown 42 xxx +$ setfacl -a0 user:42:r:allow,user:43:w:deny,user:43:w:allow,user:44:x:allow xxx +$ chmod 600 xxx +$ getfacl -n xxx +> # file: xxx +> # owner: 42 +> # group: wheel +> user:42:--------------:------:deny +> user:42:r-------------:------:allow +> user:43:-w------------:------:deny +> user:43:-w------------:------:allow +> user:44:--x-----------:------:deny +> user:44:--x-----------:------:allow +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> group@:rwxp----------:------:deny +> group@:--------------:------:allow +> everyone@:rwxp---A-W-Co-:------:deny +> everyone@:------a-R-c--s:------:allow +$ ls -l xxx | cut -d' ' -f1 +> -rw-------+ + +$ rm xxx +$ touch xxx +$ chown 43 xxx +$ setfacl -a0 user:42:r:allow,user:43:w:deny,user:43:w:allow,user:44:x:allow xxx +$ chmod 124 xxx +$ getfacl -n xxx +> # file: xxx +> # owner: 43 +> # group: wheel +> user:42:r-------------:------:deny +> user:42:r-------------:------:allow +> user:43:-w------------:------:deny +> user:43:-w------------:------:allow +> user:44:--x-----------:------:deny +> user:44:--x-----------:------:allow +> owner@:rw-p----------:------:deny +> owner@:--x----A-W-Co-:------:allow +> group@:r-x-----------:------:deny +> group@:-w-p----------:------:allow +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow +$ ls -l xxx | cut -d' ' -f1 +> ---x-w-r--+ + +$ rm xxx +$ touch xxx +$ chown 43 xxx +$ setfacl -a0 user:42:r:allow,user:43:w:deny,user:43:w:allow,user:44:x:allow xxx +$ chmod 412 xxx +$ getfacl -n xxx +> # file: xxx +> # owner: 43 +> # group: wheel +> user:42:r-------------:------:deny +> user:42:r-------------:------:allow +> user:43:-w------------:------:deny +> user:43:-w------------:------:allow +> user:44:--------------:------:deny +> user:44:--x-----------:------:allow +> owner@:-wxp----------:------:deny +> owner@:r------A-W-Co-:------:allow +> group@:rw-p----------:------:deny +> group@:--x-----------:------:allow +> everyone@:r-x----A-W-Co-:------:deny +> everyone@:-w-p--a-R-c--s:------:allow +$ ls -l xxx | cut -d' ' -f1 +> -r----x-w-+ + +$ mkdir ddd +$ setfacl -a0 group:44:rwapd:allow ddd +$ setfacl -a0 group:43:write_data/delete_child:d:deny,group@:ad:allow ddd +$ setfacl -a0 user:42:rx:fi:allow,group:42:write_data/delete_child:d:allow ddd +$ setfacl -m everyone@:-w-p--a-R-c--s:fi:allow ddd +$ getfacl -n ddd +> # file: ddd +> # owner: root +> # group: wheel +> user:42:r-x-----------:f-i---:allow +> group:42:-w--D---------:-d----:allow +> group:43:-w--D---------:-d----:deny +> group@:-----da-------:------:allow +> group:44:rw-p-da-------:------:allow +> owner@:--------------:------:deny +> owner@:rwxp---A-W-Co-:------:allow +> group@:-w-p----------:------:deny +> group@:r-x-----------:------:allow +> everyone@:-w-p---A-W-Co-:------:deny +> everyone@:-w-p--a-R-c--s:f-i---:allow +$ chmod 777 ddd +$ getfacl -n ddd +> # file: ddd +> # owner: root +> # group: wheel +> user:42:r-x-----------:f-i---:allow +> group:42:-w--D---------:-di---:allow +> group:42:--------------:------:deny +> group:42:-w--D---------:------:allow +> group:43:-w--D---------:-di---:deny +> group:43:-w--D---------:------:deny +> group@:-----da-------:------:allow +> group:44:--------------:------:deny +> group:44:rw-p-da-------:------:allow +> owner@:--------------:------:deny +> owner@:-------A-W-Co-:------:allow +> group@:--------------:------:deny +> group@:--------------:------:allow +> everyone@:-------A-W-Co-:------:deny +> everyone@:-w-p--a-R-c--s:f-i---:allow +> owner@:--------------:------:deny +> owner@:rwxp---A-W-Co-:------:allow +> group@:--------------:------:deny +> group@:rwxp----------:------:allow +> everyone@:-------A-W-Co-:------:deny +> everyone@:rwxp--a-R-c--s:------:allow + +$ rmdir ddd +$ mkdir ddd +$ setfacl -a0 group:44:rwapd:allow ddd +$ setfacl -a0 group:43:write_data/delete_child:d:deny,group@:ad:allow ddd +$ setfacl -a0 user:42:rx:fi:allow,group:42:write_data/delete_child:d:allow ddd +$ setfacl -m everyone@:-w-p--a-R-c--s:fi:allow ddd +$ chmod 124 ddd +$ getfacl -n ddd +> # file: ddd +> # owner: root +> # group: wheel +> user:42:r-x-----------:f-i---:allow +> group:42:-w--D---------:-di---:allow +> group:42:--------------:------:deny +> group:42:----D---------:------:allow +> group:43:-w--D---------:-di---:deny +> group:43:-w--D---------:------:deny +> group@:-----da-------:------:allow +> group:44:r-------------:------:deny +> group:44:r----da-------:------:allow +> owner@:--------------:------:deny +> owner@:-------A-W-Co-:------:allow +> group@:--------------:------:deny +> group@:--------------:------:allow +> everyone@:-------A-W-Co-:------:deny +> everyone@:-w-p--a-R-c--s:f-i---:allow +> owner@:rw-p----------:------:deny +> owner@:--x----A-W-Co-:------:allow +> group@:r-x-----------:------:deny +> group@:-w-p----------:------:allow +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow + +$ rmdir ddd +$ mkdir ddd +$ setfacl -a0 group:44:rwapd:allow ddd +$ setfacl -a0 group:43:write_data/delete_child:d:deny,group@:ad:allow ddd +$ setfacl -a0 user:42:rx:allow,user:42:rx:fi:allow,group:42:write_data/delete_child:d:allow ddd +$ setfacl -m everyone@:-w-p--a-R-c--s:fi:allow ddd +$ chmod 412 ddd +$ getfacl -n ddd +> # file: ddd +> # owner: root +> # group: wheel +> user:42:r-------------:------:deny +> user:42:r-x-----------:------:allow +> user:42:r-x-----------:f-i---:allow +> group:42:-w--D---------:-di---:allow +> group:42:-w------------:------:deny +> group:42:-w--D---------:------:allow +> group:43:-w--D---------:-di---:deny +> group:43:-w--D---------:------:deny +> group@:-----da-------:------:allow +> group:44:rw-p----------:------:deny +> group:44:rw-p-da-------:------:allow +> owner@:--------------:------:deny +> owner@:-------A-W-Co-:------:allow +> group@:--------------:------:deny +> group@:--------------:------:allow +> everyone@:-------A-W-Co-:------:deny +> everyone@:-w-p--a-R-c--s:f-i---:allow +> owner@:-wxp----------:------:deny +> owner@:r------A-W-Co-:------:allow +> group@:rw-p----------:------:deny +> group@:--x-----------:------:allow +> everyone@:r-x----A-W-Co-:------:deny +> everyone@:-w-p--a-R-c--s:------:allow + +$ rmdir ddd +$ mkdir ddd +$ setfacl -a0 group:44:rwapd:allow ddd +$ setfacl -a0 group:43:write_data/delete_child:d:deny,group@:ad:allow ddd +$ setfacl -a0 user:42:rx:allow,user:42:rx:fi:allow,group:42:write_data/delete_child:d:allow ddd +$ setfacl -m everyone@:-w-p--a-R-c--s:fi:allow ddd +$ chown 42 ddd +$ chmod 412 ddd +$ getfacl -n ddd +> # file: ddd +> # owner: 42 +> # group: wheel +> user:42:--x-----------:------:deny +> user:42:r-x-----------:------:allow +> user:42:r-x-----------:f-i---:allow +> group:42:-w--D---------:-di---:allow +> group:42:-w------------:------:deny +> group:42:-w--D---------:------:allow +> group:43:-w--D---------:-di---:deny +> group:43:-w--D---------:------:deny +> group@:-----da-------:------:allow +> group:44:rw-p----------:------:deny +> group:44:rw-p-da-------:------:allow +> owner@:--------------:------:deny +> owner@:-------A-W-Co-:------:allow +> group@:--------------:------:deny +> group@:--------------:------:allow +> everyone@:-------A-W-Co-:------:deny +> everyone@:-w-p--a-R-c--s:f-i---:allow +> owner@:-wxp----------:------:deny +> owner@:r------A-W-Co-:------:allow +> group@:rw-p----------:------:deny +> group@:--x-----------:------:allow +> everyone@:r-x----A-W-Co-:------:deny +> everyone@:-w-p--a-R-c--s:------:allow + +# Test applying ACL to mode. +$ rmdir ddd +$ mkdir ddd +$ setfacl -a0 u:42:rwx:fi:allow ddd +$ ls -ld ddd | cut -d' ' -f1 +> drwxr-xr-x+ + +$ rmdir ddd +$ mkdir ddd +$ chmod 0 ddd +$ setfacl -a0 owner@:r:allow,group@:w:deny,group@:wx:allow ddd +$ ls -ld ddd | cut -d' ' -f1 +> dr----x---+ + +# XXX: This one is fishy. Shouldn't it be "dr---wx---+"? +$ rmdir ddd +$ mkdir ddd +$ chmod 0 ddd +$ setfacl -a0 owner@:r:allow,group@:w:fi:deny,group@:wx:allow ddd +$ ls -ld ddd | cut -d' ' -f1 +> dr---wx---+ + +$ rmdir ddd +$ mkdir ddd +$ chmod 0 ddd +$ setfacl -a0 owner@:r:allow,group:43:w:deny,group:43:wx:allow ddd +$ ls -ld ddd | cut -d' ' -f1 +> dr--------+ + +$ rmdir ddd +$ mkdir ddd +$ chmod 0 ddd +$ setfacl -a0 owner@:r:allow,user:43:w:deny,user:43:wx:allow ddd +$ ls -ld ddd | cut -d' ' -f1 +> dr--------+ + +# Test inheritance. +$ rmdir ddd +$ mkdir ddd +$ setfacl -a0 group:43:write_data/write_acl:fin:deny,u:43:rwxp:allow ddd +$ setfacl -a0 user:42:rx:fi:allow,group:42:write_data/delete_child:dn:deny ddd +$ setfacl -a0 user:42:write_acl/write_owner:fi:allow ddd +$ setfacl -a0 group:41:read_data/read_attributes:dni:allow ddd +$ setfacl -a0 user:41:write_data/write_attributes:fn:allow ddd +$ getfacl -qn ddd +> user:41:-w-----A------:f--n--:allow +> group:41:r-----a-------:-din--:allow +> user:42:-----------Co-:f-i---:allow +> user:42:r-x-----------:f-i---:allow +> group:42:-w--D---------:-d-n--:deny +> group:43:-w---------C--:f-in--:deny +> user:43:rwxp----------:------:allow +> owner@:--------------:------:deny +> owner@:rwxp---A-W-Co-:------:allow +> group@:-w-p----------:------:deny +> group@:r-x-----------:------:allow +> everyone@:-w-p---A-W-Co-:------:deny +> everyone@:r-x---a-R-c--s:------:allow + +$ cd ddd +$ touch xxx +$ getfacl -qn xxx +> user:41:-w------------:------:deny +> user:41:-w-----A------:------:allow +> user:42:--------------:------:deny +> user:42:--------------:------:allow +> user:42:--x-----------:------:deny +> user:42:r-x-----------:------:allow +> group:43:-w---------C--:------:deny +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> group@:-wxp----------:------:deny +> group@:r-------------:------:allow +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow + +$ rm xxx +$ umask 077 +$ touch xxx +$ getfacl -qn xxx +> user:41:-w------------:------:deny +> user:41:-w-----A------:------:allow +> user:42:--------------:------:deny +> user:42:--------------:------:allow +> user:42:r-x-----------:------:deny +> user:42:r-x-----------:------:allow +> group:43:-w---------C--:------:deny +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> group@:rwxp----------:------:deny +> group@:--------------:------:allow +> everyone@:rwxp---A-W-Co-:------:deny +> everyone@:------a-R-c--s:------:allow + +$ rm xxx +$ umask 770 +$ touch xxx +$ getfacl -qn xxx +> user:41:-w------------:------:deny +> user:41:-w-----A------:------:allow +> user:42:--------------:------:deny +> user:42:--------------:------:allow +> user:42:r-x-----------:------:deny +> user:42:r-x-----------:------:allow +> group:43:-w---------C--:------:deny +> owner@:rwxp----------:------:deny +> owner@:-------A-W-Co-:------:allow +> group@:rwxp----------:------:deny +> group@:--------------:------:allow +> everyone@:--x----A-W-Co-:------:deny +> everyone@:rw-p--a-R-c--s:------:allow + +$ rm xxx +$ umask 707 +$ touch xxx +$ getfacl -qn xxx +> user:41:--------------:------:deny +> user:41:-w-----A------:------:allow +> user:42:--------------:------:deny +> user:42:--------------:------:allow +> user:42:--x-----------:------:deny +> user:42:r-x-----------:------:allow +> group:43:-w---------C--:------:deny +> owner@:rwxp----------:------:deny +> owner@:-------A-W-Co-:------:allow +> group@:--x-----------:------:deny +> group@:rw-p----------:------:allow +> everyone@:rwxp---A-W-Co-:------:deny +> everyone@:------a-R-c--s:------:allow + +$ umask 077 +$ mkdir yyy +$ getfacl -qn yyy +> group:41:r-------------:------:deny +> group:41:r-----a-------:------:allow +> user:42:-----------Co-:f-i---:allow +> user:42:r-x-----------:f-i---:allow +> group:42:-w--D---------:------:deny +> owner@:--------------:------:deny +> owner@:rwxp---A-W-Co-:------:allow +> group@:rwxp----------:------:deny +> group@:--------------:------:allow +> everyone@:rwxp---A-W-Co-:------:deny +> everyone@:------a-R-c--s:------:allow + +$ rmdir yyy +$ umask 770 +$ mkdir yyy +$ getfacl -qn yyy +> group:41:r-------------:------:deny +> group:41:r-----a-------:------:allow +> user:42:-----------Co-:f-i---:allow +> user:42:r-x-----------:f-i---:allow +> group:42:-w--D---------:------:deny +> owner@:rwxp----------:------:deny +> owner@:-------A-W-Co-:------:allow +> group@:rwxp----------:------:deny +> group@:--------------:------:allow +> everyone@:-------A-W-Co-:------:deny +> everyone@:rwxp--a-R-c--s:------:allow + +$ rmdir yyy +$ umask 707 +$ mkdir yyy +$ getfacl -qn yyy +> group:41:--------------:------:deny +> group:41:------a-------:------:allow +> user:42:-----------Co-:f-i---:allow +> user:42:r-x-----------:f-i---:allow +> group:42:-w--D---------:------:deny +> owner@:rwxp----------:------:deny +> owner@:-------A-W-Co-:------:allow +> group@:--------------:------:deny +> group@:rwxp----------:------:allow +> everyone@:rwxp---A-W-Co-:------:deny +> everyone@:------a-R-c--s:------:allow + +# There is some complication regarding how write_acl and write_owner flags +# get inherited. Make sure we got it right. +$ setfacl -b . +$ setfacl -a0 u:42:Co:f:allow . +$ setfacl -a0 u:43:Co:d:allow . +$ setfacl -a0 u:44:Co:fd:allow . +$ setfacl -a0 u:45:Co:fi:allow . +$ setfacl -a0 u:46:Co:di:allow . +$ setfacl -a0 u:47:Co:fdi:allow . +$ setfacl -a0 u:48:Co:fn:allow . +$ setfacl -a0 u:49:Co:dn:allow . +$ setfacl -a0 u:50:Co:fdn:allow . +$ setfacl -a0 u:51:Co:fni:allow . +$ setfacl -a0 u:52:Co:dni:allow . +$ setfacl -a0 u:53:Co:fdni:allow . +$ umask 022 +$ rm xxx +$ touch xxx +$ getfacl -nq xxx +> user:53:--------------:------:deny +> user:53:--------------:------:allow +> user:51:--------------:------:deny +> user:51:--------------:------:allow +> user:50:--------------:------:deny +> user:50:--------------:------:allow +> user:48:--------------:------:deny +> user:48:--------------:------:allow +> user:47:--------------:------:deny +> user:47:--------------:------:allow +> user:45:--------------:------:deny +> user:45:--------------:------:allow +> user:44:--------------:------:deny +> user:44:--------------:------:allow +> user:42:--------------:------:deny +> user:42:--------------:------:allow +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> group@:-wxp----------:------:deny +> group@:r-------------:------:allow +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow + +$ rmdir yyy +$ mkdir yyy +$ getfacl -nq yyy +> user:53:--------------:------:deny +> user:53:--------------:------:allow +> user:52:--------------:------:deny +> user:52:--------------:------:allow +> user:50:--------------:------:deny +> user:50:--------------:------:allow +> user:49:--------------:------:deny +> user:49:--------------:------:allow +> user:47:-----------Co-:fdi---:allow +> user:47:--------------:------:deny +> user:47:--------------:------:allow +> user:46:-----------Co-:-di---:allow +> user:46:--------------:------:deny +> user:46:--------------:------:allow +> user:45:-----------Co-:f-i---:allow +> user:44:-----------Co-:fdi---:allow +> user:44:--------------:------:deny +> user:44:--------------:------:allow +> user:43:-----------Co-:-di---:allow +> user:43:--------------:------:deny +> user:43:--------------:------:allow +> user:42:-----------Co-:f-i---:allow +> owner@:--------------:------:deny +> owner@:rwxp---A-W-Co-:------:allow +> group@:-w-p----------:------:deny +> group@:r-x-----------:------:allow +> everyone@:-w-p---A-W-Co-:------:deny +> everyone@:r-x---a-R-c--s:------:allow + +$ setfacl -b . +$ setfacl -a0 u:42:Co:f:deny . +$ setfacl -a0 u:43:Co:d:deny . +$ setfacl -a0 u:44:Co:fd:deny . +$ setfacl -a0 u:45:Co:fi:deny . +$ setfacl -a0 u:46:Co:di:deny . +$ setfacl -a0 u:47:Co:fdi:deny . +$ setfacl -a0 u:48:Co:fn:deny . +$ setfacl -a0 u:49:Co:dn:deny . +$ setfacl -a0 u:50:Co:fdn:deny . +$ setfacl -a0 u:51:Co:fni:deny . +$ setfacl -a0 u:52:Co:dni:deny . +$ setfacl -a0 u:53:Co:fdni:deny . +$ umask 022 +$ rm xxx +$ touch xxx +$ getfacl -nq xxx +> user:53:-----------Co-:------:deny +> user:51:-----------Co-:------:deny +> user:50:-----------Co-:------:deny +> user:48:-----------Co-:------:deny +> user:47:-----------Co-:------:deny +> user:45:-----------Co-:------:deny +> user:44:-----------Co-:------:deny +> user:42:-----------Co-:------:deny +> owner@:--x-----------:------:deny +> owner@:rw-p---A-W-Co-:------:allow +> group@:-wxp----------:------:deny +> group@:r-------------:------:allow +> everyone@:-wxp---A-W-Co-:------:deny +> everyone@:r-----a-R-c--s:------:allow + +$ rmdir yyy +$ mkdir yyy +$ getfacl -nq yyy +> user:53:-----------Co-:------:deny +> user:52:-----------Co-:------:deny +> user:50:-----------Co-:------:deny +> user:49:-----------Co-:------:deny +> user:47:-----------Co-:fdi---:deny +> user:47:-----------Co-:------:deny +> user:46:-----------Co-:-di---:deny +> user:46:-----------Co-:------:deny +> user:45:-----------Co-:f-i---:deny +> user:44:-----------Co-:fdi---:deny +> user:44:-----------Co-:------:deny +> user:43:-----------Co-:-di---:deny +> user:43:-----------Co-:------:deny +> user:42:-----------Co-:f-i---:deny +> owner@:--------------:------:deny +> owner@:rwxp---A-W-Co-:------:allow +> group@:-w-p----------:------:deny +> group@:r-x-----------:------:allow +> everyone@:-w-p---A-W-Co-:------:deny +> everyone@:r-x---a-R-c--s:------:allow + +$ rmdir yyy +$ rm xxx +$ cd .. +$ rmdir ddd + +$ rm xxx + Modified: head/tools/regression/acltools/tools-posix.test ============================================================================== --- head/tools/regression/acltools/tools-posix.test Mon Sep 7 16:25:09 2009 (r196937) +++ head/tools/regression/acltools/tools-posix.test Mon Sep 7 16:26:03 2009 (r196938) @@ -1,11 +1,36 @@ +# Copyright (c) 2008, 2009 Edward Tomasz Napiera?a +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From sam at FreeBSD.org Mon Sep 7 16:33:27 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Mon Sep 7 16:33:39 2009 Subject: svn commit: r196939 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci net80211 Message-ID: <200909071633.n87GXRBM020641@svn.freebsd.org> Author: sam Date: Mon Sep 7 16:33:27 2009 New Revision: 196939 URL: http://svn.freebsd.org/changeset/base/196939 Log: MFC r196785: correct timeout for doing NOL processing; need a ticks-relative value Approved by: re (kensmith) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/net80211/ieee80211_dfs.c Modified: stable/8/sys/net80211/ieee80211_dfs.c ============================================================================== --- stable/8/sys/net80211/ieee80211_dfs.c Mon Sep 7 16:26:03 2009 (r196938) +++ stable/8/sys/net80211/ieee80211_dfs.c Mon Sep 7 16:33:27 2009 (r196939) @@ -235,7 +235,7 @@ dfs_timeout(void *arg) } if (oldest != now) { /* arrange to process next channel up for a status change */ - callout_schedule(&dfs->nol_timer, oldest + NOL_TIMEOUT); + callout_schedule(&dfs->nol_timer, oldest + NOL_TIMEOUT - now); } } From sam at FreeBSD.org Mon Sep 7 16:41:19 2009 From: sam at FreeBSD.org (Sam Leffler) Date: Mon Sep 7 16:41:36 2009 Subject: svn commit: r196940 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/ath dev/xen/xenpci Message-ID: <200909071641.n87GfINm020842@svn.freebsd.org> Author: sam Date: Mon Sep 7 16:41:18 2009 New Revision: 196940 URL: http://svn.freebsd.org/changeset/base/196940 Log: MFC r196717: fix beacon timers on resume in sta mode so raoming works Approved by: re (kensmith) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/ath/if_ath.c stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/ath/if_ath.c ============================================================================== --- stable/8/sys/dev/ath/if_ath.c Mon Sep 7 16:33:27 2009 (r196939) +++ stable/8/sys/dev/ath/if_ath.c Mon Sep 7 16:41:18 2009 (r196940) @@ -1236,7 +1236,16 @@ ath_resume(struct ath_softc *sc) if (sc->sc_resume_up) { if (ic->ic_opmode == IEEE80211_M_STA) { ath_init(sc); - ieee80211_beacon_miss(ic); + /* + * Program the beacon registers using the last rx'd + * beacon frame and enable sync on the next beacon + * we see. This should handle the case where we + * wakeup and find the same AP and also the case where + * we wakeup and need to roam. For the latter we + * should get bmiss events that trigger a roam. + */ + ath_beacon_config(sc, NULL); + sc->sc_syncbeacon = 1; } else ieee80211_resume_all(ic); } From trasz at FreeBSD.org Mon Sep 7 16:56:41 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Mon Sep 7 16:56:51 2009 Subject: svn commit: r196941 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200909071656.n87GufHG021183@svn.freebsd.org> Author: trasz Date: Mon Sep 7 16:56:41 2009 New Revision: 196941 URL: http://svn.freebsd.org/changeset/base/196941 Log: Prevent the line from wrapping. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Mon Sep 7 16:41:18 2009 (r196940) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Mon Sep 7 16:56:41 2009 (r196941) @@ -3567,7 +3567,7 @@ arc_init(void) if ((((uint64_t)physmem * PAGESIZE) < (1ULL << 32)) && prefetch_tunable_set == 0) { printf("ZFS NOTICE: Prefetch is disabled by default if less " - "than 4 GB of RAM is present;\n" + "than 4GB of RAM is present;\n" " to enable, add \"vfs.zfs.prefetch_disable=0\" " "to /boot/loader.conf.\n"); zfs_prefetch_disable=1; From kensmith at FreeBSD.org Mon Sep 7 17:54:20 2009 From: kensmith at FreeBSD.org (Ken Smith) Date: Mon Sep 7 17:54:27 2009 Subject: svn commit: r196942 - head/release/scripts Message-ID: <200909071754.n87HsKIJ022310@svn.freebsd.org> Author: kensmith Date: Mon Sep 7 17:54:20 2009 New Revision: 196942 URL: http://svn.freebsd.org/changeset/base/196942 Log: Bring the layout of package-split.py more in line with where we're going with packages on the release media. It looks like we'll be putting just the doc packages on the new "memory stick" image as well as disc1. There will be no other packages on the CDROM-sized media. The DVD sized media will include the doc packages plus whatever other packages we decide to make part of the release. This commit just brings the basic structure in line with being able to do this. We still need to discuss with various people exactly which packages will be included on the DVD. If the environement variable "PKG_DVD" is set a tree suitable for the DVD media is generated. Otherwise a tree suitable for the "memory stick" and disc1 is generated. MFC after: 3 days Modified: head/release/scripts/package-split.py Modified: head/release/scripts/package-split.py ============================================================================== --- head/release/scripts/package-split.py Mon Sep 7 16:56:41 2009 (r196941) +++ head/release/scripts/package-split.py Mon Sep 7 17:54:20 2009 (r196942) @@ -23,71 +23,14 @@ if 'PKG_VERBOSE' in os.environ: else: verbose = 0 -# List of packages for disc1. This just includes packages sysinstall can -# install as a distribution -def disc1_packages(): - pkgs = ['lang/perl5.8'] - pkgs.extend(['x11/xorg', - 'devel/imake']) - if arch == 'i386': - pkgs.append('emulators/linux_base-fc4') - return pkgs - -# List of packages for disc2. This includes packages that the X desktop -# menu depends on (if it still exists) and other "nice to have" packages. -# For architectures that use a separate livefs, this is actually disc3. -def disc2_packages(): - # X Desktops - if arch == 'ia64': - pkgs = ['x11/gnome2-lite', - 'x11/kde-lite'] - else: - pkgs = ['x11/gnome2', - 'x11/kde3'] - pkgs.extend(['x11-wm/afterstep', - 'x11-wm/windowmaker', - 'x11-wm/fvwm2', - # "Nice to have" - 'archivers/unzip', - 'astro/xearth', - 'devel/gmake', - 'editors/emacs', - 'editors/vim-lite', - 'emulators/mtools', - 'graphics/png', - 'graphics/xv', - 'irc/xchat', - 'mail/exim', - 'mail/fetchmail', - 'mail/mutt', - 'mail/pine4', - 'mail/popd', - 'mail/xfmail', - 'mail/postfix', - 'net/cvsup-without-gui', - 'net/rsync', - 'net/samba3', - 'news/slrn', - 'news/tin', - 'ports-mgmt/portupgrade', - 'print/a2ps-letter', - 'print/apsfilter', - 'print/ghostscript-gnu-nox11', - 'print/gv', - 'print/psutils-letter', - 'shells/bash', - 'shells/pdksh', - 'shells/zsh', - 'security/sudo', - 'www/links', - 'www/lynx', - 'x11/rxvt', - # Formerly on disc3 - 'ports-mgmt/portaudit']) - return pkgs +if 'PKG_DVD' in os.environ: + doing_dvd = 1 +else: + doing_dvd = 0 -def docs_packages(): - pkgs = ['misc/freebsd-doc-bn', +# List of packages for disc1. +def disc1_packages(): + pkgs = ['misc/freebsd-doc-bn', 'misc/freebsd-doc-da', 'misc/freebsd-doc-de', 'misc/freebsd-doc-el', @@ -106,14 +49,58 @@ def docs_packages(): 'misc/freebsd-doc-tr', 'misc/freebsd-doc-zh_cn', 'misc/freebsd-doc-zh_tw'] + + if doing_dvd: + pkgs.extend(['lang/perl5.8', + 'x11/xorg', + 'devel/imake', + 'emulators/linux_base-fc4', + 'x11/gnome2', + 'x11/kde4', + 'x11-wm/afterstep', + 'x11-wm/windowmaker', + 'x11-wm/fvwm2', + 'archivers/unzip', + 'astro/xearth', + 'devel/gmake', + 'editors/emacs', + 'editors/vim-lite', + 'emulators/mtools', + 'graphics/png', + 'graphics/xv', + 'irc/xchat', + 'mail/exim', + 'mail/fetchmail', + 'mail/mutt', + 'mail/alpine', + 'mail/popd', + 'mail/xfmail', + 'mail/postfix', + 'net/cvsup-without-gui', + 'net/rsync', + 'net/samba3', + 'news/slrn', + 'news/tin', + 'ports-mgmt/portupgrade', + 'print/a2ps-letter', + 'print/apsfilter', + 'print/ghostscript7-nox11', + 'print/gv', + 'print/psutils-letter', + 'shells/bash', + 'shells/pdksh', + 'shells/zsh', + 'security/sudo', + 'www/links', + 'www/lynx', + 'x11/rxvt', + 'ports-mgmt/portaudit']) return pkgs # The list of desired packages def desired_packages(): disc1 = disc1_packages() - disc2 = disc2_packages() - docs = docs_packages() - return [disc1, disc2, docs] + return [disc1] # Suck the entire INDEX file into a two different dictionaries. The first # dictionary maps port names (origins) to package names. The second From pjd at FreeBSD.org Mon Sep 7 18:23:27 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Mon Sep 7 18:23:33 2009 Subject: svn commit: r196943 - head/sys/cddl/compat/opensolaris/kern Message-ID: <200909071823.n87INQpL022930@svn.freebsd.org> Author: pjd Date: Mon Sep 7 18:23:26 2009 New Revision: 196943 URL: http://svn.freebsd.org/changeset/base/196943 Log: - Avoid holding mutex around M_WAITOK allocations. - Add locking for mnt_opt field. MFC after: 1 week Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Mon Sep 7 17:54:20 2009 (r196942) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Mon Sep 7 18:23:26 2009 (r196943) @@ -45,20 +45,33 @@ vfs_setmntopt(vfs_t *vfsp, const char *n { struct vfsopt *opt; size_t namesize; + int locked; + + if (!(locked = mtx_owned(MNT_MTX(vfsp)))) + MNT_ILOCK(vfsp); if (vfsp->mnt_opt == NULL) { - vfsp->mnt_opt = malloc(sizeof(*vfsp->mnt_opt), M_MOUNT, M_WAITOK); - TAILQ_INIT(vfsp->mnt_opt); + void *opts; + + MNT_IUNLOCK(vfsp); + opts = malloc(sizeof(*vfsp->mnt_opt), M_MOUNT, M_WAITOK); + MNT_ILOCK(vfsp); + if (vfsp->mnt_opt == NULL) { + vfsp->mnt_opt = opts; + TAILQ_INIT(vfsp->mnt_opt); + } else { + free(opts, M_MOUNT); + } } - opt = malloc(sizeof(*opt), M_MOUNT, M_WAITOK); + MNT_IUNLOCK(vfsp); + opt = malloc(sizeof(*opt), M_MOUNT, M_WAITOK); namesize = strlen(name) + 1; opt->name = malloc(namesize, M_MOUNT, M_WAITOK); strlcpy(opt->name, name, namesize); opt->pos = -1; opt->seen = 1; - if (arg == NULL) { opt->value = NULL; opt->len = 0; @@ -67,16 +80,23 @@ vfs_setmntopt(vfs_t *vfsp, const char *n opt->value = malloc(opt->len, M_MOUNT, M_WAITOK); bcopy(arg, opt->value, opt->len); } - /* TODO: Locking. */ + + MNT_ILOCK(vfsp); TAILQ_INSERT_TAIL(vfsp->mnt_opt, opt, link); + if (!locked) + MNT_IUNLOCK(vfsp); } void vfs_clearmntopt(vfs_t *vfsp, const char *name) { + int locked; - /* TODO: Locking. */ + if (!(locked = mtx_owned(MNT_MTX(vfsp)))) + MNT_ILOCK(vfsp); vfs_deleteopt(vfsp->mnt_opt, name); + if (!locked) + MNT_IUNLOCK(vfsp); } int From pjd at FreeBSD.org Mon Sep 7 18:54:55 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Mon Sep 7 18:55:10 2009 Subject: svn commit: r196944 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200909071854.n87IstZ7023617@svn.freebsd.org> Author: pjd Date: Mon Sep 7 18:54:55 2009 New Revision: 196944 URL: http://svn.freebsd.org/changeset/base/196944 Log: Don't recheck ownership on update mount. This will eliminate LOR between vfs_busy() and mount mutex. We check ownership in vfs_domount() anyway. Noticed by: kib Reviewed by: kib MFC after: 1 week 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 Mon Sep 7 18:23:26 2009 (r196943) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Mon Sep 7 18:54:55 2009 (r196944) @@ -719,7 +719,10 @@ zfs_mount(vfs_t *vfsp) error = secpolicy_fs_mount(cr, mvp, vfsp); if (error) { error = dsl_deleg_access(osname, ZFS_DELEG_PERM_MOUNT, cr); - if (error == 0) { + if (error != 0) + goto out; + + if (!(vfsp->vfs_flag & MS_REMOUNT)) { vattr_t vattr; /* @@ -753,11 +756,9 @@ zfs_mount(vfs_t *vfsp) } VOP_UNLOCK(mvp, 0); #endif - - secpolicy_fs_mount_clearopts(cr, vfsp); - } else { - goto out; } + + secpolicy_fs_mount_clearopts(cr, vfsp); } /* From pjd at FreeBSD.org Mon Sep 7 19:22:45 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Mon Sep 7 19:22:51 2009 Subject: svn commit: r196947 - head/sys/cddl/compat/opensolaris/sys Message-ID: <200909071922.n87JMjYV024270@svn.freebsd.org> Author: pjd Date: Mon Sep 7 19:22:44 2009 New Revision: 196947 URL: http://svn.freebsd.org/changeset/base/196947 Log: Defer thread start until we set priority. Reviewed by: kib MFC after: 3 days Modified: head/sys/cddl/compat/opensolaris/sys/proc.h Modified: head/sys/cddl/compat/opensolaris/sys/proc.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/proc.h Mon Sep 7 19:15:07 2009 (r196946) +++ head/sys/cddl/compat/opensolaris/sys/proc.h Mon Sep 7 19:22:44 2009 (r196947) @@ -37,6 +37,7 @@ #include #include #include +#include #include #ifdef _KERNEL @@ -74,11 +75,12 @@ thread_create(caddr_t stk, size_t stksiz ASSERT(state == TS_RUN); ASSERT(pp == &p0); - error = kproc_kthread_add(proc, arg, &zfsproc, &td, 0, + error = kproc_kthread_add(proc, arg, &zfsproc, &td, RFSTOPPED, stksize / PAGE_SIZE, "zfskern", "solthread %p", proc); if (error == 0) { thread_lock(td); sched_prio(td, pri); + sched_add(td, SRQ_BORING); thread_unlock(td); } return (td); From trasz at FreeBSD.org Mon Sep 7 19:40:22 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Mon Sep 7 19:40:54 2009 Subject: svn commit: r196948 - in head/tools/regression/fstest: . tests/chmod tests/granular Message-ID: <200909071940.n87JeMXk024638@svn.freebsd.org> Author: trasz Date: Mon Sep 7 19:40:22 2009 New Revision: 196948 URL: http://svn.freebsd.org/changeset/base/196948 Log: Add regression tests for NFSv4 ACL granular permission enforcement. Added: head/tools/regression/fstest/tests/chmod/12.t (contents, props changed) head/tools/regression/fstest/tests/granular/ head/tools/regression/fstest/tests/granular/00.t (contents, props changed) head/tools/regression/fstest/tests/granular/01.t (contents, props changed) head/tools/regression/fstest/tests/granular/02.t (contents, props changed) head/tools/regression/fstest/tests/granular/03.t (contents, props changed) head/tools/regression/fstest/tests/granular/04.t (contents, props changed) head/tools/regression/fstest/tests/granular/05.t (contents, props changed) Modified: head/tools/regression/fstest/Makefile head/tools/regression/fstest/fstest.c Modified: head/tools/regression/fstest/Makefile ============================================================================== --- head/tools/regression/fstest/Makefile Mon Sep 7 19:22:44 2009 (r196947) +++ head/tools/regression/fstest/Makefile Mon Sep 7 19:40:22 2009 (r196948) @@ -4,7 +4,7 @@ OSTYPE=$(shell uname) ifeq "${OSTYPE}" "FreeBSD" CFLAGS += -D__OS_FreeBSD__ -CFLAGS += -DHAS_LCHMOD -DHAS_CHFLAGS -DHAS_LCHFLAGS +CFLAGS += -DHAS_LCHMOD -DHAS_CHFLAGS -DHAS_LCHFLAGS -DHAS_FREEBSD_ACL endif ifeq "${OSTYPE}" "SunOS" Modified: head/tools/regression/fstest/fstest.c ============================================================================== --- head/tools/regression/fstest/fstest.c Mon Sep 7 19:22:44 2009 (r196947) +++ head/tools/regression/fstest/fstest.c Mon Sep 7 19:40:22 2009 (r196948) @@ -45,6 +45,9 @@ #define stat64 stat #define lstat64 lstat #endif +#ifdef HAS_FREEBSD_ACL +#include +#endif #ifndef ALLPERMS #define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) @@ -75,7 +78,12 @@ enum action { ACTION_TRUNCATE, ACTION_STAT, ACTION_LSTAT, - ACTION_PATHCONF + ACTION_PATHCONF, +#ifdef HAS_FREEBSD_ACL + ACTION_PREPENDACL, + ACTION_READACL, +#endif + ACTION_WRITE, }; #define TYPE_NONE 0x0000 @@ -118,6 +126,11 @@ static struct syscall_desc syscalls[] = { "stat", ACTION_STAT, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, { "lstat", ACTION_LSTAT, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, { "pathconf", ACTION_PATHCONF, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, +#ifdef HAS_FREEBSD_ACL + { "prependacl", ACTION_PREPENDACL, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, + { "readacl", ACTION_READACL, { TYPE_STRING, TYPE_NONE } }, +#endif + { "write", ACTION_WRITE, { TYPE_STRING, TYPE_NONE } }, { NULL, -1, { TYPE_NONE } } }; @@ -397,6 +410,11 @@ call_syscall(struct syscall_desc *scall, char *str; long long num; } args[MAX_ARGS]; +#ifdef HAS_FREEBSD_ACL + int entry_id = ACL_FIRST_ENTRY; + acl_t acl, newacl; + acl_entry_t entry, newentry; +#endif /* * Verify correctness of the arguments. @@ -540,6 +558,48 @@ call_syscall(struct syscall_desc *scall, rval = -1; break; } +#ifdef HAS_FREEBSD_ACL + case ACTION_PREPENDACL: + rval = -1; + + acl = acl_get_file(STR(0), ACL_TYPE_NFS4); + if (acl == NULL) + break; + + newacl = acl_from_text(STR(1)); + if (acl == NULL) + break; + + while (acl_get_entry(newacl, entry_id, &newentry) == 1) { + entry_id = ACL_NEXT_ENTRY; + + if (acl_create_entry_np(&acl, &entry, 0)) + break; + + if (acl_copy_entry(entry, newentry)) + break; + } + + rval = acl_set_file(STR(0), ACL_TYPE_NFS4, acl); + break; + + case ACTION_READACL: + acl = acl_get_file(STR(0), ACL_TYPE_NFS4); + if (acl == NULL) + rval = -1; + else + rval = 0; + break; +#endif + + case ACTION_WRITE: + rval = open(STR(0), O_WRONLY); + if (rval < 0) + break; + + rval = write(rval, "x", 1); + break; + default: fprintf(stderr, "unsupported syscall\n"); exit(1); Added: head/tools/regression/fstest/tests/chmod/12.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/fstest/tests/chmod/12.t Mon Sep 7 19:40:22 2009 (r196948) @@ -0,0 +1,32 @@ +#!/bin/sh +# $FreeBSD$ + +desc="verify SUID/SGID bit behaviour" + +dir=`dirname $0` +. ${dir}/../misc.sh + +echo "1..10" + +n0=`namegen` +n1=`namegen` +n2=`namegen` + +expect 0 mkdir ${n2} 0755 +cdir=`pwd` +cd ${n2} + +# Check whether writing to the file by non-owner clears the SUID. +expect 0 create ${n0} 04777 +expect 0 -u 65534 -g 65534 write ${n0} +expect 0777 stat ${n0} mode +expect 0 unlink ${n0} + +# Check whether writing to the file by non-owner clears the SGID. +expect 0 create ${n0} 02777 +expect 0 -u 65534 -g 65534 write ${n0} +expect 0777 stat ${n0} mode +expect 0 unlink ${n0} + +cd ${cdir} +expect 0 rmdir ${n2} Added: head/tools/regression/fstest/tests/granular/00.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/fstest/tests/granular/00.t Mon Sep 7 19:40:22 2009 (r196948) @@ -0,0 +1,110 @@ +#!/bin/sh +# $FreeBSD$ + +desc="NFSv4 granular permissions checking - WRITE_DATA vs APPEND_DATA on directories" + +dir=`dirname $0` +. ${dir}/../misc.sh + +echo "1..49" + +n0=`namegen` +n1=`namegen` +n2=`namegen` +n3=`namegen` + +expect 0 mkdir ${n2} 0755 +expect 0 mkdir ${n3} 0777 +cdir=`pwd` +cd ${n2} + +# Tests 2..7 - check out whether root user can do stuff. +# Can create files? +expect 0 create ${n0} 0644 + +# Can create symlinks? +expect 0 link ${n0} ${n1} +expect 0 unlink ${n1} +expect 0 unlink ${n0} + +# Can create directories? +expect 0 mkdir ${n0} 0755 +expect 0 rmdir ${n0} + +# Check whether user 65534 is permitted to create and remove +# files, but not subdirectories. +expect 0 prependacl . user:65534:write_data::allow,user:65534:append_data::deny + +# Can create files? +expect 0 -u 65534 -g 65534 create ${n0} 0644 + +# Can create symlinks? +expect 0 -u 65534 -g 65534 link ${n0} ${n1} +expect 0 -u 65534 -g 65534 unlink ${n1} +expect 0 -u 65534 -g 65534 unlink ${n0} + +# Can create directories? +expect EACCES -u 65534 -g 65534 mkdir ${n0} 0755 +expect ENOENT -u 65534 -g 65534 rmdir ${n0} +expect 0 mkdir ${n0} 0755 +expect 0 -u 65534 -g 65534 rmdir ${n0} + +# Can move files from other directory? +expect 0 create ../${n3}/${n1} 0644 +expect 0 -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} + +# Can move files from other directory overwriting existing files? +expect 0 create ../${n3}/${n1} 0644 +expect 0 -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} + +expect 0 -u 65534 -g 65534 unlink ${n0} + +# Can move directories from other directory? +expect 0 mkdir ../${n3}/${n1} 0777 +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} + +# Can move directories from other directory overwriting existing directory? +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} +expect 0 -u 65534 -g 65534 rmdir ../${n3}/${n1} + +# Check whether user 65534 is permitted to create +# subdirectories, but not files - and to remove neither of them. +expect 0 prependacl . user:65534:write_data::deny,user:65534:append_data::allow + +# Can create files? +expect EACCES -u 65534 -g 65534 create ${n0} 0644 + +# Can create symlinks? +expect 0 create ${n0} 0644 +expect EACCES -u 65534 -g 65534 link ${n0} ${n1} +expect ENOENT -u 65534 -g 65534 unlink ${n1} +expect EACCES -u 65534 -g 65534 unlink ${n0} +expect 0 unlink ${n0} + +# Can create directories? +expect 0 -u 65534 -g 65534 mkdir ${n0} 0755 +expect EACCES -u 65534 -g 65534 rmdir ${n0} +expect 0 rmdir ${n0} + +# Can move files from other directory? +expect 0 create ../${n3}/${n1} 0644 +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} + +# Can move files from other directory overwriting existing files? +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} +expect 0 -u 65534 -g 65534 unlink ../${n3}/${n1} + +# Can move directories from other directory? +expect 0 mkdir ../${n3}/${n1} 0777 +expect 0 -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} + +# Can move directories from other directory overwriting existing directory? +expect 0 mkdir ../${n3}/${n1} 0777 +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} +expect 0 prependacl . user:65534:delete_child::allow +expect 0 -u 65534 -g 65534 rename ../${n3}/${n1} ${n0} +expect 0 -u 65534 -g 65534 rmdir ${n0} + +cd ${cdir} +expect 0 rmdir ${n2} +expect 0 rmdir ${n3} Added: head/tools/regression/fstest/tests/granular/01.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/fstest/tests/granular/01.t Mon Sep 7 19:40:22 2009 (r196948) @@ -0,0 +1,35 @@ +#!/bin/sh +# $FreeBSD$ + +desc="NFSv4 granular permissions checking - ACL_READ_ATTRIBUTES and ACL_WRITE_ATTRIBUTES" + +dir=`dirname $0` +. ${dir}/../misc.sh + +echo "1..12" + +n0=`namegen` +n1=`namegen` +n2=`namegen` + +expect 0 mkdir ${n2} 0755 +cdir=`pwd` +cd ${n2} + +# Tests 1..12 - check out whether user 65534 is permitted to read attributes. +expect 0 create ${n0} 0644 +expect 0 lstat ${n0} size +expect 0 -u 65534 -g 65534 stat ${n0} size +expect 0 prependacl ${n0} user:65534:read_attributes::deny +expect 0 lstat ${n0} size +expect EACCES -u 65534 -g 65534 stat ${n0} size +expect 0 prependacl ${n0} user:65534:read_attributes::allow +expect 0 -u 65534 -g 65534 stat ${n0} size +expect 0 lstat ${n0} size +expect 0 unlink ${n0} + +# Tests 12..12 - check out whether user 65534 is permitted to write attributes. +# XXX: Check if ACL_WRITE_ATTRIBUTES allows for modifying access times. + +cd ${cdir} +expect 0 rmdir ${n2} Added: head/tools/regression/fstest/tests/granular/02.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/fstest/tests/granular/02.t Mon Sep 7 19:40:22 2009 (r196948) @@ -0,0 +1,142 @@ +#!/bin/sh +# $FreeBSD$ + +desc="NFSv4 granular permissions checking - ACL_READ_ACL and ACL_WRITE_ACL" + +dir=`dirname $0` +. ${dir}/../misc.sh + +echo "1..83" + +n0=`namegen` +n1=`namegen` +n2=`namegen` + +expect 0 mkdir ${n2} 0755 +cdir=`pwd` +cd ${n2} + +# Check whether user 65534 is permitted to read ACL. +expect 0 create ${n0} 0644 +expect 0 readacl ${n0} +expect 0 -u 65534 -g 65534 readacl ${n0} +expect 0 prependacl ${n0} user:65534:read_acl::deny +expect 0 readacl ${n0} +expect EACCES -u 65534 -g 65534 readacl ${n0} +expect 0 prependacl ${n0} user:65534:read_acl::allow +expect 0 -u 65534 -g 65534 readacl ${n0} +expect 0 readacl ${n0} +expect 0 unlink ${n0} + +# Check whether user 65534 is permitted to write ACL. +expect 0 create ${n0} 0644 +expect EPERM -u 65534 -g 65534 prependacl ${n0} user:65534:read_data::allow +expect 0 prependacl ${n0} user:65534:write_acl::allow +expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:read_data::allow +expect 0 unlink ${n0} + +# Check whether user 65534 is permitted to write mode. +expect 0 create ${n0} 0755 +expect EPERM -u 65534 -g 65534 chmod ${n0} 0777 +expect 0 prependacl ${n0} user:65534:write_acl::allow +expect 0 -u 65534 -g 65534 chmod ${n0} 0777 +expect 0 unlink ${n0} + +# There is an interesting problem with interaction between ACL_WRITE_ACL +# and SUID/SGID bits. In case user does have ACL_WRITE_ACL, but is not +# a file owner, Solaris does the following: +# 1. Setting SUID fails with EPERM. +# 2. Setting SGID succeeds, but mode is not changed. +# 3. Modifying ACL does not clear SUID nor SGID bits. +# 4. Writing the file does clear both SUID and SGID bits. +# +# What we are doing is the following: +# 1. Setting SUID or SGID fails with EPERM. +# 2. Modifying ACL does not clear SUID nor SGID bits. +# 3. Writing the file does clear both SUID and SGID bits. +# +# Check whether user 65534 is denied to write mode with SUID bit. +expect 0 create ${n0} 0755 +expect EPERM -u 65534 -g 65534 chmod ${n0} 04777 +expect 0 prependacl ${n0} user:65534:write_acl::allow +expect EPERM -u 65534 -g 65534 chmod ${n0} 04777 +expect 0 unlink ${n0} + +# Check whether user 65534 is denied to write mode with SGID bit. +expect 0 create ${n0} 0755 +expect EPERM -u 65534 -g 65534 chmod ${n0} 02777 +expect 0 prependacl ${n0} user:65534:write_acl::allow +expect EPERM -u 65534 -g 65534 chmod ${n0} 02777 +expect 0 unlink ${n0} + +# Check whether user 65534 is allowed to write mode with sticky bit. +expect 0 mkdir ${n0} 0755 +expect EPERM -u 65534 -g 65534 chmod ${n0} 01777 +expect 0 prependacl ${n0} user:65534:write_acl::allow +expect 0 -u 65534 -g 65534 chmod ${n0} 01777 +expect 0 rmdir ${n0} + +# Check whether modifying the ACL by not-owner preserves the SUID. +expect 0 create ${n0} 04755 +expect 0 prependacl ${n0} user:65534:write_acl::allow +expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:write_data::allow +expect 04755 stat ${n0} mode +expect 0 unlink ${n0} + +# Check whether modifying the ACL by not-owner preserves the SGID. +expect 0 create ${n0} 02755 +expect 0 prependacl ${n0} user:65534:write_acl::allow +expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:write_data::allow +expect 02755 stat ${n0} mode +expect 0 unlink ${n0} + +# Check whether modifying the ACL by not-owner preserves the sticky bit. +expect 0 mkdir ${n0} 0755 +expect 0 chmod ${n0} 01755 +expect 0 prependacl ${n0} user:65534:write_acl::allow +expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:write_data::allow +expect 01755 stat ${n0} mode +expect 0 rmdir ${n0} + +# Clearing the SUID and SGID bits when being written to by non-owner +# is checked in chmod/12.t. + +# Check whether the file owner is always permitted to get and set +# ACL and file mode, even if ACL_{READ,WRITE}_ACL would deny it. +expect 0 chmod . 0777 +expect 0 -u 65534 -g 65534 create ${n0} 0600 +expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:write_acl::deny +expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:read_acl::deny +expect 0 -u 65534 -g 65534 readacl ${n0} +expect 0600 -u 65534 -g 65534 stat ${n0} mode +expect 0 -u 65534 -g 65534 chmod ${n0} 0777 +expect 0 unlink ${n0} + +expect 0 -u 65534 -g 65534 mkdir ${n0} 0600 +expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:write_acl::deny +expect 0 -u 65534 -g 65534 prependacl ${n0} user:65534:read_acl::deny +expect 0 -u 65534 -g 65534 readacl ${n0} +expect 0600 -u 65534 -g 65534 stat ${n0} mode +expect 0 -u 65534 -g 65534 chmod ${n0} 0777 +expect 0 rmdir ${n0} + +# Check whether the root is allowed for these as well. +expect 0 -u 65534 -g 65534 create ${n0} 0600 +expect 0 prependacl ${n0} everyone@:write_acl::deny +expect 0 prependacl ${n0} everyone@:read_acl::deny +expect 0 readacl ${n0} +expect 0600 stat ${n0} mode +expect 0 chmod ${n0} 0777 +expect 0 unlink ${n0} + +expect 0 -u 65534 -g 65534 mkdir ${n0} 0600 +expect 0 prependacl ${n0} everyone@:write_acl::deny +expect 0 prependacl ${n0} everyone@:read_acl::deny +expect 0600 stat ${n0} mode +expect 0 readacl ${n0} +expect 0600 stat ${n0} mode +expect 0 chmod ${n0} 0777 +expect 0 rmdir ${n0} + +cd ${cdir} +expect 0 rmdir ${n2} Added: head/tools/regression/fstest/tests/granular/03.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/fstest/tests/granular/03.t Mon Sep 7 19:40:22 2009 (r196948) @@ -0,0 +1,132 @@ +#!/bin/sh +# $FreeBSD$ + +desc="NFSv4 granular permissions checking - DELETE and DELETE_CHILD" + +dir=`dirname $0` +. ${dir}/../misc.sh + +echo "1..65" + +n0=`namegen` +n1=`namegen` +n2=`namegen` +n3=`namegen` + +expect 0 mkdir ${n2} 0755 +expect 0 mkdir ${n3} 0777 +cdir=`pwd` +cd ${n2} + +# Unlink allowed on writable directory. +expect 0 create ${n0} 0644 +expect EACCES -u 65534 -g 65534 unlink ${n0} +expect 0 prependacl . user:65534:write_data::allow +expect 0 -u 65534 -g 65534 unlink ${n0} + +# Moving file elsewhere allowed on writable directory. +expect 0 create ${n0} 0644 +expect 0 prependacl . user:65534:write_data::deny +expect EACCES -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} +expect 0 prependacl . user:65534:write_data::allow +expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} + +# Moving file from elsewhere allowed on writable directory. +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 unlink ${n0} + +# Moving file from elsewhere overwriting local file allowed +# on writable directory. +expect 0 create ${n0} 0644 +expect 0 create ../${n3}/${n0} 0644 +expect 0 prependacl . user:65534:write_data::deny +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 prependacl . user:65534:write_data::allow +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 unlink ${n0} + +# Denied DELETE changes nothing wrt removing. +expect 0 create ${n0} 0644 +expect 0 prependacl ${n0} user:65534:delete::deny +expect 0 -u 65534 -g 65534 unlink ${n0} + +# Denied DELETE changes nothing wrt moving elsewhere or from elsewhere. +expect 0 create ${n0} 0644 +expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 unlink ${n0} + +# DELETE_CHILD denies unlink on writable directory. +expect 0 create ${n0} 0644 +expect 0 prependacl . user:65534:delete_child::deny +expect EPERM -u 65534 -g 65534 unlink ${n0} +expect 0 unlink ${n0} + +# DELETE_CHILD denies moving file elsewhere. +expect 0 create ${n0} 0644 +expect EPERM -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} +expect 0 rename ${n0} ../${n3}/${n0} + +# DELETE_CHILD does not deny moving file from elsewhere +# to a writable directory. +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# DELETE_CHILD denies moving file from elsewhere +# to a writable directory overwriting local file. +expect 0 create ../${n3}/${n0} 0644 +expect EPERM -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# DELETE allowed on file allows for unlinking, no matter +# what permissions on containing directory are. +expect 0 prependacl ${n0} user:65534:delete::allow +expect 0 -u 65534 -g 65534 unlink ${n0} + +# Same for moving the file elsewhere. +expect 0 create ${n0} 0644 +expect 0 prependacl ${n0} user:65534:delete::allow +expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} + +# Same for moving the file from elsewhere into a writable +# directory with DELETE_CHILD denied. +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 unlink ${n0} + +# DELETE does not allow for overwriting a file in a unwritable +# directory with DELETE_CHILD denied. +expect 0 create ${n0} 0644 +expect 0 create ../${n3}/${n0} 0644 +expect 0 prependacl . user:65534:write_data::deny +expect 0 prependacl . user:65534:delete_child::deny +expect EPERM -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 prependacl ${n0} user:65534:delete::allow +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# But it allows for plain deletion. +expect 0 -u 65534 -g 65534 unlink ${n0} + +# DELETE_CHILD allowed on unwritable directory. +expect 0 create ${n0} 0644 +expect 0 prependacl . user:65534:delete_child::allow +expect 0 -u 65534 -g 65534 unlink ${n0} + +# Moving things elsewhere is allowed. +expect 0 create ${n0} 0644 +expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} + +# Moving things back is not. +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# Even if we're overwriting. +expect 0 create ${n0} 0644 +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# Even if we have DELETE on the existing file. +expect 0 prependacl ${n0} user:65534:delete::allow +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# Denied DELETE changes nothing wrt removing. +expect 0 prependacl ${n0} user:65534:delete::deny +expect 0 -u 65534 -g 65534 unlink ${n0} + +cd ${cdir} +expect 0 rmdir ${n2} Added: head/tools/regression/fstest/tests/granular/04.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/fstest/tests/granular/04.t Mon Sep 7 19:40:22 2009 (r196948) @@ -0,0 +1,78 @@ +#!/bin/sh +# $FreeBSD$ + +desc="NFSv4 granular permissions checking - ACL_WRITE_OWNER" + +dir=`dirname $0` +. ${dir}/../misc.sh + +echo "1..52" + +n0=`namegen` +n1=`namegen` +n2=`namegen` + +expect 0 mkdir ${n2} 0755 +cdir=`pwd` +cd ${n2} + +# ACL_WRITE_OWNER permits to set gid to our own only. +expect 0 create ${n0} 0644 +expect 0,0 lstat ${n0} uid,gid +expect EPERM -u 65534 -g 65532,65531 chown ${n0} -1 65532 +expect 0,0 lstat ${n0} uid,gid +expect 0 prependacl ${n0} user:65534:write_owner::allow +expect EPERM -u 65534 -g 65532,65531 chown ${n0} -1 65530 +expect 0,0 lstat ${n0} uid,gid +expect 0 -u 65534 -g 65532,65531 chown ${n0} -1 65532 +expect 0,65532 lstat ${n0} uid,gid +expect 0 unlink ${n0} + +# ACL_WRITE_OWNER permits to set uid to our own only. +expect 0 create ${n0} 0644 +expect 0,0 lstat ${n0} uid,gid +expect EPERM -u 65534 -g 65532,65531 chown ${n0} 65534 65531 +expect 0,0 lstat ${n0} uid,gid +expect 0 prependacl ${n0} user:65534:write_owner::allow +expect EPERM -u 65534 -g 65532,65531 chown ${n0} 65530 65531 +expect 0,0 lstat ${n0} uid,gid +expect 0 -u 65534 -g 65532,65531 chown ${n0} 65534 65531 +expect 65534,65531 lstat ${n0} uid,gid +expect 0 unlink ${n0} + +# When non-owner calls chown(2) successfully, set-uid and set-gid bits are +# removed, except when both uid and gid are equal to -1. +expect 0 create ${n0} 0644 +expect 0 prependacl ${n0} user:65534:write_owner::allow +expect 0 chmod ${n0} 06555 +expect 06555 lstat ${n0} mode +expect 0 -u 65534 -g 65533,65532 chown ${n0} 65534 65532 +expect 0555,65534,65532 lstat ${n0} mode,uid,gid +expect 0 chmod ${n0} 06555 +expect 06555 lstat ${n0} mode +expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 65533 +expect 0555,65534,65533 lstat ${n0} mode,uid,gid +expect 0 chmod ${n0} 06555 +expect 06555 lstat ${n0} mode +expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 -1 +expect 06555,65534,65533 lstat ${n0} mode,uid,gid +expect 0 unlink ${n0} + +expect 0 mkdir ${n0} 0755 +expect 0 prependacl ${n0} user:65534:write_owner::allow +expect 0 chmod ${n0} 06555 +expect 06555 lstat ${n0} mode +expect 0 -u 65534 -g 65533,65532 chown ${n0} 65534 65532 +expect 0555,65534,65532 lstat ${n0} mode,uid,gid +expect 0 chmod ${n0} 06555 +expect 06555 lstat ${n0} mode +expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 65533 +expect 0555,65534,65533 lstat ${n0} mode,uid,gid +expect 0 chmod ${n0} 06555 +expect 06555 lstat ${n0} mode +expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 -1 +expect 06555,65534,65533 lstat ${n0} mode,uid,gid +expect 0 rmdir ${n0} + +cd ${cdir} +expect 0 rmdir ${n2} Added: head/tools/regression/fstest/tests/granular/05.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/fstest/tests/granular/05.t Mon Sep 7 19:40:22 2009 (r196948) @@ -0,0 +1,147 @@ +#!/bin/sh +# $FreeBSD$ + +desc="NFSv4 granular permissions checking - DELETE and DELETE_CHILD with directories" + +dir=`dirname $0` +. ${dir}/../misc.sh + +echo "1..68" + +n0=`namegen` +n1=`namegen` +n2=`namegen` +n3=`namegen` + +expect 0 mkdir ${n2} 0755 +expect 0 mkdir ${n3} 0777 +cdir=`pwd` +cd ${n2} + +# Unlink allowed on writable directory. +expect 0 mkdir ${n0} 0755 +expect EACCES -u 65534 -g 65534 rmdir ${n0} +expect 0 prependacl . user:65534:write_data::allow +expect 0 -u 65534 -g 65534 rmdir ${n0} + +# Moving directory elsewhere allowed on writable directory. +expect 0 mkdir ${n0} 0777 +expect 0 prependacl . user:65534:write_data::deny +expect EACCES -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} +expect 0 prependacl . user:65534:write_data::allow +expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} + +# 12 +# Moving directory from elsewhere allowed on writable directory. +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 prependacl . user:65534:append_data::allow +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 rmdir ${n0} + +# Moving directory from elsewhere overwriting local directory allowed +# on writable directory. +expect 0 mkdir ${n0} 0755 +expect 0 mkdir ../${n3}/${n0} 0777 +expect 0 prependacl . user:65534:write_data::deny +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 prependacl . user:65534:write_data::allow +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 rmdir ${n0} + +# 23 +# Denied DELETE changes nothing wrt removing. +expect 0 mkdir ${n0} 0755 +expect 0 prependacl ${n0} user:65534:delete::deny +expect 0 -u 65534 -g 65534 rmdir ${n0} + +# Denied DELETE changes nothing wrt moving elsewhere or from elsewhere. +expect 0 mkdir ${n0} 0777 +expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 rmdir ${n0} + +# DELETE_CHILD denies unlink on writable directory. +expect 0 mkdir ${n0} 0755 +expect 0 prependacl . user:65534:delete_child::deny +expect EPERM -u 65534 -g 65534 rmdir ${n0} +expect 0 rmdir ${n0} + +# 35 +# DELETE_CHILD denies moving directory elsewhere. +expect 0 mkdir ${n0} 0777 +expect EPERM -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} +expect 0 rename ${n0} ../${n3}/${n0} + +# DELETE_CHILD does not deny moving directory from elsewhere +# to a writable directory. +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# DELETE_CHILD denies moving directory from elsewhere +# to a writable directory overwriting local directory. +expect 0 mkdir ../${n3}/${n0} 0755 +expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# DELETE allowed on directory allows for unlinking, no matter +# what permissions on containing directory are. +expect 0 prependacl ${n0} user:65534:delete::allow +expect 0 -u 65534 -g 65534 rmdir ${n0} + +# Same for moving the directory elsewhere. +expect 0 mkdir ${n0} 0777 +expect 0 prependacl ${n0} user:65534:delete::allow +expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} + +# 46 +# Same for moving the directory from elsewhere into a writable +# directory with DELETE_CHILD denied. +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 rmdir ${n0} + +# DELETE does not allow for overwriting a directory in a unwritable +# directory with DELETE_CHILD denied. +expect 0 mkdir ${n0} 0755 +expect 0 mkdir ../${n3}/${n0} 0777 +expect 0 prependacl . user:65534:write_data::deny +expect 0 prependacl . user:65534:delete_child::deny +expect EPERM -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 prependacl ${n0} user:65534:delete::allow +# XXX: expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# 54 +# But it allows for plain deletion. +# XXX: expect 0 -u 65534 -g 65534 rmdir ${n0} +expect 0 rmdir ${n0} + +# DELETE_CHILD allowed on unwritable directory. +expect 0 mkdir ${n0} 0755 +expect 0 prependacl . user:65534:delete_child::allow +expect 0 -u 65534 -g 65534 rmdir ${n0} + +# Moving things elsewhere is allowed. +expect 0 mkdir ${n0} 0777 +expect 0 -u 65534 -g 65534 rename ${n0} ../${n3}/${n0} + +# 60 +# Moving things back is not. +# XXX: expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# Even if we're overwriting. +# XXX: expect 0 mkdir ${n0} 0755 +expect 0 mkdir ../${n3}/${n0} 0777 +# XXX: expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 mkdir ../${n3}/${n0} 0777 + +# Even if we have DELETE on the existing directory. +expect 0 prependacl ${n0} user:65534:delete::allow +# XXX: expect EACCES -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} +expect 0 -u 65534 -g 65534 rename ../${n3}/${n0} ${n0} + +# Denied DELETE changes nothing wrt removing. +expect 0 prependacl ${n0} user:65534:delete::deny +expect 0 -u 65534 -g 65534 rmdir ${n0} + +cd ${cdir} +expect 0 rmdir ${n2} From trasz at FreeBSD.org Mon Sep 7 19:43:14 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Mon Sep 7 19:43:21 2009 Subject: svn commit: r196949 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200909071943.n87JhDYk024743@svn.freebsd.org> Author: trasz Date: Mon Sep 7 19:43:13 2009 New Revision: 196949 URL: http://svn.freebsd.org/changeset/base/196949 Log: Enable NFSv4 ACL support in ZFS. Reviewed by: pjd Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Sep 7 19:40:22 2009 (r196948) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Sep 7 19:43:13 2009 (r196949) @@ -3834,7 +3834,15 @@ zfs_pathconf(vnode_t *vp, int cmd, ulong #endif case _PC_ACL_EXTENDED: - *valp = 0; /* TODO */ + *valp = 0; + return (0); + + case _PC_ACL_NFS4: + *valp = 1; + return (0); + + case _PC_ACL_PATH_MAX: + *valp = ACL_MAX_ENTRIES; return (0); case _PC_MIN_HOLE_SIZE: @@ -4425,6 +4433,26 @@ zfs_freebsd_pathconf(ap) return (error); } +static int +zfs_freebsd_fifo_pathconf(ap) + struct vop_pathconf_args /* { + struct vnode *a_vp; + int a_name; + register_t *a_retval; + } */ *ap; +{ + + switch (ap->a_name) { + case _PC_ACL_EXTENDED: + case _PC_ACL_NFS4: + case _PC_ACL_PATH_MAX: + case _PC_MAC_PRESENT: + return (zfs_freebsd_pathconf(ap)); + default: + return (fifo_specops.vop_pathconf(ap)); + } +} + /* * FreeBSD's extended attributes namespace defines file name prefix for ZFS' * extended attribute name: @@ -4854,7 +4882,7 @@ zfs_freebsd_setacl(ap) return (EINVAL); /* - * With NFS4 ACLs, chmod(2) may need to add additional entries, + * With NFSv4 ACLs, chmod(2) may need to add additional entries, * splitting every entry into two and appending "canonical six" * entries at the end. Don't allow for setting an ACL that would * cause chmod(2) to run out of ACL entries. @@ -4928,11 +4956,9 @@ struct vop_vector zfs_vnodeops = { .vop_deleteextattr = zfs_deleteextattr, .vop_setextattr = zfs_setextattr, .vop_listextattr = zfs_listextattr, -#ifdef notyet .vop_getacl = zfs_freebsd_getacl, .vop_setacl = zfs_freebsd_setacl, .vop_aclcheck = zfs_freebsd_aclcheck, -#endif }; struct vop_vector zfs_fifoops = { @@ -4945,10 +4971,9 @@ struct vop_vector zfs_fifoops = { .vop_reclaim = zfs_freebsd_reclaim, .vop_setattr = zfs_freebsd_setattr, .vop_write = VOP_PANIC, + .vop_pathconf = zfs_freebsd_fifo_pathconf, .vop_fid = zfs_freebsd_fid, -#ifdef notyet .vop_getacl = zfs_freebsd_getacl, .vop_setacl = zfs_freebsd_setacl, .vop_aclcheck = zfs_freebsd_aclcheck, -#endif }; From pjd at FreeBSD.org Mon Sep 7 20:10:33 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Mon Sep 7 20:10:40 2009 Subject: svn commit: r196950 - head/cddl/contrib/opensolaris/lib/libzfs/common Message-ID: <200909072010.n87KAXa7025628@svn.freebsd.org> Author: pjd Date: Mon Sep 7 20:10:33 2009 New Revision: 196950 URL: http://svn.freebsd.org/changeset/base/196950 Log: Fix detection of file system being shared. After this change commands like: # zfs unshare -a # zfs destroy foo/bar # zfs rename foo/bar foo/baz should properly remove exported file systems. MFC after: 3 days Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Mon Sep 7 19:43:13 2009 (r196949) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Mon Sep 7 20:10:33 2009 (r196950) @@ -172,6 +172,7 @@ is_shared(libzfs_handle_t *hdl, const ch *tab = '\0'; if (strcmp(buf, mountpoint) == 0) { +#if defined(sun) /* * the protocol field is the third field * skip over second field @@ -194,6 +195,10 @@ is_shared(libzfs_handle_t *hdl, const ch return (0); } } +#else + if (proto == PROTO_NFS) + return (SHARED_NFS); +#endif } } From trasz at FreeBSD.org Mon Sep 7 20:57:02 2009 From: trasz at FreeBSD.org (Edward Tomasz Napierala) Date: Mon Sep 7 20:57:13 2009 Subject: svn commit: r196952 - head/share/man/man4 Message-ID: <200909072057.n87Kv1Jx026703@svn.freebsd.org> Author: trasz Date: Mon Sep 7 20:57:01 2009 New Revision: 196952 URL: http://svn.freebsd.org/changeset/base/196952 Log: Some of the controllers sold as ServeRAID (IBM ServeRAID-MR10i, in particular) are actually mfi(4) devices. Provide hints. Submitted by: Modified: head/share/man/man4/ips.4 Modified: head/share/man/man4/ips.4 ============================================================================== --- head/share/man/man4/ips.4 Mon Sep 7 20:39:04 2009 (r196951) +++ head/share/man/man4/ips.4 Mon Sep 7 20:57:01 2009 (r196952) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 4, 2006 +.Dd August 7, 2009 .Dt IPS 4 .Os .Sh NAME @@ -95,6 +95,8 @@ ServeRAID 7t/7k/7M .Pp Newer ServeRAID controllers are supported by the .Xr aac 4 +or +.Xr mfi 4 driver. .Sh DIAGNOSTICS Several error codes may be shown when the card initializes the @@ -185,6 +187,7 @@ driver does not use the subsystem. .Sh SEE ALSO .Xr aac 4 , +.Xr mfi 4 , .Xr ch 4 , .Xr da 4 , .Xr sysctl 8 From pjd at FreeBSD.org Mon Sep 7 21:46:52 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Mon Sep 7 21:46:58 2009 Subject: svn commit: r196953 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200909072146.n87Lkpw6027675@svn.freebsd.org> Author: pjd Date: Mon Sep 7 21:46:51 2009 New Revision: 196953 URL: http://svn.freebsd.org/changeset/base/196953 Log: When snapshot mount point is busy (for example we are still in it) we will fail to unmount it, but it won't be removed from the tree, so in that case there is no need to reinsert it. This fixes a panic reproducable in the following steps: # zfs create tank/foo # zfs snapshot tank/foo@snap # cd /tank/foo/.zfs/snapshot/snap # umount /tank/foo panic: avl_find() succeeded inside avl_add() Reported by: trasz MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Mon Sep 7 20:57:01 2009 (r196952) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Mon Sep 7 21:46:51 2009 (r196953) @@ -1344,7 +1344,15 @@ zfsctl_umount_snapshots(vfs_t *vfsp, int if (vn_ismntpt(sep->se_root)) { error = zfsctl_unmount_snap(sep, fflags, cr); if (error) { - avl_add(&sdp->sd_snaps, sep); + /* + * Before reinserting snapshot to the tree, + * check if it was actually removed. For example + * when snapshot mount point is busy, we will + * have an error here, but there will be no need + * to reinsert snapshot. + */ + if (avl_find(&sdp->sd_snaps, sep, NULL) == NULL) + avl_add(&sdp->sd_snaps, sep); break; } } From pjd at FreeBSD.org Mon Sep 7 21:58:55 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Mon Sep 7 21:59:06 2009 Subject: svn commit: r196954 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200909072158.n87LwsQR027945@svn.freebsd.org> Author: pjd Date: Mon Sep 7 21:58:54 2009 New Revision: 196954 URL: http://svn.freebsd.org/changeset/base/196954 Log: If we have to use avl_find(), optimize a bit and use avl_insert() instead of avl_add() (the latter is actually a wrapper around avl_find() + avl_insert()). Fix similar case in the code that is currently commented out. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Mon Sep 7 21:46:51 2009 (r196953) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Mon Sep 7 21:58:54 2009 (r196954) @@ -669,9 +669,12 @@ zfsctl_snapdir_remove(vnode_t *dvp, char if (sep) { avl_remove(&sdp->sd_snaps, sep); err = zfsctl_unmount_snap(sep, MS_FORCE, cr); - if (err) - avl_add(&sdp->sd_snaps, sep); - else + if (err) { + avl_index_t where; + + if (avl_find(&sdp->sd_snaps, sep, &where) == NULL) + avl_insert(&sdp->sd_snaps, sep, where); + } else err = dmu_objset_destroy(snapname); } else { err = ENOENT; @@ -1344,6 +1347,8 @@ zfsctl_umount_snapshots(vfs_t *vfsp, int if (vn_ismntpt(sep->se_root)) { error = zfsctl_unmount_snap(sep, fflags, cr); if (error) { + avl_index_t where; + /* * Before reinserting snapshot to the tree, * check if it was actually removed. For example @@ -1351,8 +1356,8 @@ zfsctl_umount_snapshots(vfs_t *vfsp, int * have an error here, but there will be no need * to reinsert snapshot. */ - if (avl_find(&sdp->sd_snaps, sep, NULL) == NULL) - avl_add(&sdp->sd_snaps, sep); + if (avl_find(&sdp->sd_snaps, sep, &where) == NULL) + avl_insert(&sdp->sd_snaps, sep, where); break; } } From marck at rinet.ru Mon Sep 7 22:59:18 2009 From: marck at rinet.ru (Dmitry Morozovsky) Date: Mon Sep 7 22:59:29 2009 Subject: svn commit: r196954 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs In-Reply-To: <200909072158.n87LwsQR027945@svn.freebsd.org> References: <200909072158.n87LwsQR027945@svn.freebsd.org> Message-ID: Pawel, On Mon, 7 Sep 2009, Pawel Jakub Dawidek wrote: PJD> Author: pjd PJD> Date: Mon Sep 7 21:58:54 2009 PJD> New Revision: 196954 PJD> URL: http://svn.freebsd.org/changeset/base/196954 PJD> PJD> Log: PJD> If we have to use avl_find(), optimize a bit and use avl_insert() instead of PJD> avl_add() (the latter is actually a wrapper around avl_find() + avl_insert()). PJD> PJD> Fix similar case in the code that is currently commented out. Any chance it would fix my panic reported this spring? Thanks! -- Sincerely, D.Marck [DM5020, MCK-RIPE, DM3-RIPN] [ FreeBSD committer: marck@FreeBSD.org ] ------------------------------------------------------------------------ *** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck@rinet.ru *** ------------------------------------------------------------------------ From sbruno at FreeBSD.org Mon Sep 7 23:16:28 2009 From: sbruno at FreeBSD.org (Sean Bruno) Date: Mon Sep 7 23:17:25 2009 Subject: svn commit: r196955 - head/share/examples/scsi_target Message-ID: <200909072316.n87NGRRm029450@svn.freebsd.org> Author: sbruno Date: Mon Sep 7 23:16:27 2009 New Revision: 196955 URL: http://svn.freebsd.org/changeset/base/196955 Log: A few enhancements I made while working on the Firewire target (sbp_targ). Update the error handling in a couple of cases to exit gracefully if certain mandatory conditions aren't met. Reduce the maximum number of initiators to 8 for this example code. While 1024 is more correct, this example code would act like it was stalled out even though it was merely allocating the needed structures in init_ccbs() Reviewed by: scottl@freebsd.org Modified: head/share/examples/scsi_target/scsi_target.c head/share/examples/scsi_target/scsi_target.h Modified: head/share/examples/scsi_target/scsi_target.c ============================================================================== --- head/share/examples/scsi_target/scsi_target.c Mon Sep 7 21:58:54 2009 (r196954) +++ head/share/examples/scsi_target/scsi_target.c Mon Sep 7 23:16:27 2009 (r196955) @@ -226,7 +226,7 @@ main(int argc, char *argv[]) /* Open backing store for IO */ file_fd = open(file_name, O_RDWR); if (file_fd < 0) - err(1, "open backing store file"); + errx(EX_NOINPUT, "open backing store file"); /* Check backing store size or use the size user gave us */ if (user_size == 0) { @@ -291,7 +291,9 @@ main(int argc, char *argv[]) } while (targ_fd < 0 && errno == EBUSY); if (targ_fd < 0) - err(1, "Tried to open %d devices, none available", unit); + errx(1, "Tried to open %d devices, none available", unit); + else + warnx("opened /dev/targ%d", unit); /* The first three are handled by kevent() later */ signal(SIGHUP, SIG_IGN); @@ -318,6 +320,7 @@ main(int argc, char *argv[]) /* Set up inquiry data according to what SIM supports */ if (get_sim_flags(&sim_flags) != CAM_REQ_CMP) errx(1, "get_sim_flags"); + if (tcmd_init(req_flags, sim_flags) != 0) errx(1, "Initializing tcmd subsystem failed"); @@ -327,6 +330,7 @@ main(int argc, char *argv[]) if (debug) warnx("main loop beginning"); + request_loop(); exit(0); Modified: head/share/examples/scsi_target/scsi_target.h ============================================================================== --- head/share/examples/scsi_target/scsi_target.h Mon Sep 7 21:58:54 2009 (r196954) +++ head/share/examples/scsi_target/scsi_target.h Mon Sep 7 23:16:27 2009 (r196955) @@ -35,7 +35,7 @@ * Maximum number of parallel commands to accept, * 1024 for Fibre Channel (SPI is 16). */ -#define MAX_INITIATORS 1024 +#define MAX_INITIATORS 8 #define SECTOR_SIZE 512 #define MAX_EVENTS (MAX_INITIATORS + 5) /* kqueue for AIO, signals */ From delphij at FreeBSD.org Tue Sep 8 01:11:23 2009 From: delphij at FreeBSD.org (Xin LI) Date: Tue Sep 8 01:11:35 2009 Subject: svn commit: r196956 - head/usr.bin/w Message-ID: <200909080111.n881BNxQ031626@svn.freebsd.org> Author: delphij Date: Tue Sep 8 01:11:23 2009 New Revision: 196956 URL: http://svn.freebsd.org/changeset/base/196956 Log: Constify format string pointer, otherwise this would trigger warning when higher warning level is enabled. Modified: head/usr.bin/w/pr_time.c Modified: head/usr.bin/w/pr_time.c ============================================================================== --- head/usr.bin/w/pr_time.c Mon Sep 7 23:16:27 2009 (r196955) +++ head/usr.bin/w/pr_time.c Tue Sep 8 01:11:23 2009 (r196956) @@ -58,7 +58,7 @@ pr_attime(time_t *started, time_t *now) static wchar_t buf[256]; struct tm tp, tm; time_t diff; - wchar_t *fmt; + const wchar_t *fmt; int len, width, offset = 0; tp = *localtime(started); From kientzle at FreeBSD.org Tue Sep 8 04:52:13 2009 From: kientzle at FreeBSD.org (Tim Kientzle) Date: Tue Sep 8 04:52:23 2009 Subject: svn commit: r196961 - in head/lib/libarchive: . test Message-ID: <200909080452.n884qC2n036193@svn.freebsd.org> Author: kientzle Date: Tue Sep 8 04:52:12 2009 New Revision: 196961 URL: http://svn.freebsd.org/changeset/base/196961 Log: Update tests to match r195873, which corrected how hardlinked files on iso9660 images were returned. While I'm poking around, update some comments around this area to try to clarify what's going on and what still remains to be improved. Modified: head/lib/libarchive/archive_read_support_format_iso9660.c head/lib/libarchive/test/test_read_format_isojoliet_bz2.c head/lib/libarchive/test/test_read_format_isorr_bz2.c Modified: head/lib/libarchive/archive_read_support_format_iso9660.c ============================================================================== --- head/lib/libarchive/archive_read_support_format_iso9660.c Tue Sep 8 04:08:14 2009 (r196960) +++ head/lib/libarchive/archive_read_support_format_iso9660.c Tue Sep 8 04:52:12 2009 (r196961) @@ -571,9 +571,13 @@ archive_read_format_iso9660_read_header( if (file->symlink.s != NULL) archive_entry_copy_symlink(entry, file->symlink.s); - /* If this entry points to the same data as the previous - * entry, convert this into a hardlink to that entry. - * But don't bother for zero-length files. */ + /* Note: If the input isn't seekable, we can't rewind to + * return the same body again, so if the next entry refers to + * the same data, we have to return it as a hardlink to the + * original entry. */ + /* TODO: We have enough information here to compute an + * accurate value for nlinks. We should do so and ignore + * nlinks from the RR extensions. */ if (file->offset == iso9660->previous_offset && file->size == iso9660->previous_size && file->size > 0) { @@ -586,8 +590,21 @@ archive_read_format_iso9660_read_header( return (ARCHIVE_OK); } - /* If the offset is before our current position, we can't - * seek backwards to extract it, so issue a warning. */ + /* Except for the hardlink case above, if the offset of the + * next entry is before our current position, we can't seek + * backwards to extract it, so issue a warning. Note that + * this can only happen if this entry was added to the heap + * after we passed this offset, that is, only if the directory + * mentioning this entry is later than the body of the entry. + * Such layouts are very unusual; most ISO9660 writers lay out + * and record all directory information first, then store + * all file bodies. */ + /* TODO: Someday, libarchive's I/O core will support optional + * seeking. When that day comes, this code should attempt to + * seek and only return the error if the seek fails. That + * will give us support for whacky ISO images that require + * seeking while retaining the ability to read almost all ISO + * images in a streaming fashion. */ if (file->offset < iso9660->current_position) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Ignoring out-of-order file @%x (%s) %jd < %jd", @@ -628,7 +645,7 @@ archive_read_format_iso9660_read_header( struct file_info *child; /* N.B.: these special directory identifiers - * are 8 bit "values" even on a + * are 8 bit "values" even on a * Joliet CD with UCS-2 (16bit) encoding. */ Modified: head/lib/libarchive/test/test_read_format_isojoliet_bz2.c ============================================================================== --- head/lib/libarchive/test/test_read_format_isojoliet_bz2.c Tue Sep 8 04:08:14 2009 (r196960) +++ head/lib/libarchive/test/test_read_format_isojoliet_bz2.c Tue Sep 8 04:52:12 2009 (r196961) @@ -107,14 +107,12 @@ joliettest(int withrr) assertEqualInt(2, archive_entry_gid(ae)); } - /* A hardlink to the regular file. */ + /* A regular file with two names ("hardlink" gets returned + * first, so it's not marked as a hardlink). */ assertEqualInt(0, archive_read_next_header(a, &ae)); assertEqualString("hardlink", archive_entry_pathname(ae)); assert(S_ISREG(archive_entry_stat(ae)->st_mode)); - if (withrr) { - assertEqualString("long-joliet-file-name.textfile", - archive_entry_hardlink(ae)); - } + assert(archive_entry_hardlink(ae) == NULL); assertEqualInt(6, archive_entry_size(ae)); assertEqualInt(0, archive_read_data_block(a, &p, &size, &offset)); assertEqualInt(6, (int)size); @@ -123,20 +121,27 @@ joliettest(int withrr) if (withrr) { assertEqualInt(86401, archive_entry_mtime(ae)); assertEqualInt(86401, archive_entry_atime(ae)); - assertEqualInt(2, archive_entry_stat(ae)->st_nlink); + /* TODO: Actually, libarchive should be able to + * compute nlinks correctly even without RR + * extensions. See comments in libarchive source. */ + assertEqualInt(2, archive_entry_nlink(ae)); assertEqualInt(1, archive_entry_uid(ae)); assertEqualInt(2, archive_entry_gid(ae)); } - /* A regular file. */ + /* Second name for the same regular file (this happens to be + * returned second, so does get marked as a hardlink). */ assertEqualInt(0, archive_read_next_header(a, &ae)); - assertEqualString("long-joliet-file-name.textfile", archive_entry_pathname(ae)); + assertEqualString("long-joliet-file-name.textfile", + archive_entry_pathname(ae)); assert(S_ISREG(archive_entry_stat(ae)->st_mode)); - assertEqualInt(6, archive_entry_size(ae)); + assertEqualString("hardlink", archive_entry_hardlink(ae)); + assert(!archive_entry_size_is_set(ae)); if (withrr) { assertEqualInt(86401, archive_entry_mtime(ae)); assertEqualInt(86401, archive_entry_atime(ae)); - assertEqualInt(2, archive_entry_stat(ae)->st_nlink); + /* TODO: See above. */ + assertEqualInt(2, archive_entry_nlink(ae)); assertEqualInt(1, archive_entry_uid(ae)); assertEqualInt(2, archive_entry_gid(ae)); } @@ -153,7 +158,7 @@ joliettest(int withrr) assertEqualInt(172802, archive_entry_mtime(ae)); assertEqualInt(172802, archive_entry_atime(ae)); if (withrr) { - assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_nlink(ae)); assertEqualInt(1, archive_entry_uid(ae)); assertEqualInt(2, archive_entry_gid(ae)); } Modified: head/lib/libarchive/test/test_read_format_isorr_bz2.c ============================================================================== --- head/lib/libarchive/test/test_read_format_isorr_bz2.c Tue Sep 8 04:08:14 2009 (r196960) +++ head/lib/libarchive/test/test_read_format_isorr_bz2.c Tue Sep 8 04:52:12 2009 (r196961) @@ -111,7 +111,7 @@ DEFINE_TEST(test_read_format_isorr_bz2) assertEqualString("hardlink", archive_entry_pathname(ae)); assert(S_ISREG(archive_entry_stat(ae)->st_mode)); assertEqualString("file", archive_entry_hardlink(ae)); - assertEqualInt(12345684, archive_entry_size(ae)); + assert(!archive_entry_size_is_set(ae)); assertEqualInt(86401, archive_entry_mtime(ae)); assertEqualInt(86401, archive_entry_atime(ae)); assertEqualInt(2, archive_entry_stat(ae)->st_nlink); From kientzle at FreeBSD.org Tue Sep 8 05:02:42 2009 From: kientzle at FreeBSD.org (Tim Kientzle) Date: Tue Sep 8 05:02:54 2009 Subject: svn commit: r196962 - in head/lib/libarchive: . test Message-ID: <200909080502.n8852gH4036454@svn.freebsd.org> Author: kientzle Date: Tue Sep 8 05:02:41 2009 New Revision: 196962 URL: http://svn.freebsd.org/changeset/base/196962 Log: Fiz /usr/bin/unzip: A bug deep in libarchive's read-ahead logic (incorrect handling of zero-length reads before the copy buffer is allocated) is masked by the iso9660 taster. Tar and cpio both enable that taster so were protected from the bug; unzip is susceptible. This both fixes the bug and updates the test harness to exercise this case. Submitted by: Ed Schouten diagnosed the bug and drafted a patch MFC after: 7 days Modified: head/lib/libarchive/archive_read.c head/lib/libarchive/test/test_compat_zip.c Modified: head/lib/libarchive/archive_read.c ============================================================================== --- head/lib/libarchive/archive_read.c Tue Sep 8 04:52:12 2009 (r196961) +++ head/lib/libarchive/archive_read.c Tue Sep 8 05:02:41 2009 (r196962) @@ -928,9 +928,12 @@ __archive_read_filter_ahead(struct archi for (;;) { /* - * If we can satisfy from the copy buffer, we're done. + * If we can satisfy from the copy buffer (and the + * copy buffer isn't empty), we're done. In particular, + * note that min == 0 is a perfectly well-defined + * request. */ - if (filter->avail >= min) { + if (filter->avail >= min && filter->avail > 0) { if (avail != NULL) *avail = filter->avail; return (filter->next); Modified: head/lib/libarchive/test/test_compat_zip.c ============================================================================== --- head/lib/libarchive/test/test_compat_zip.c Tue Sep 8 04:52:12 2009 (r196961) +++ head/lib/libarchive/test/test_compat_zip.c Tue Sep 8 05:02:41 2009 (r196962) @@ -36,7 +36,7 @@ test_compat_zip_1(void) assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a)); - assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a)); extract_reference_file(name); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 10240)); From pjd at FreeBSD.org Tue Sep 8 05:03:38 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Tue Sep 8 05:03:49 2009 Subject: svn commit: r196954 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs In-Reply-To: References: <200909072158.n87LwsQR027945@svn.freebsd.org> Message-ID: <20090908050330.GE1574@garage.freebsd.pl> On Tue, Sep 08, 2009 at 02:59:15AM +0400, Dmitry Morozovsky wrote: > > Pawel, > > > On Mon, 7 Sep 2009, Pawel Jakub Dawidek wrote: > > PJD> Author: pjd > PJD> Date: Mon Sep 7 21:58:54 2009 > PJD> New Revision: 196954 > PJD> URL: http://svn.freebsd.org/changeset/base/196954 > PJD> > PJD> Log: > PJD> If we have to use avl_find(), optimize a bit and use avl_insert() instead of > PJD> avl_add() (the latter is actually a wrapper around avl_find() + avl_insert()). > PJD> > PJD> Fix similar case in the code that is currently commented out. > > Any chance it would fix my panic reported this spring? I'm sorry, but no. Your panic was related to ZAP code. We can still try to debug it further if you still have this file system somewhere, but last I remember your mail server was refusing e-mails from me. If that's still the case and you read this e-mail from the mailing list could you check logs of your e-mail server and whitelist my? I have many problems because reverse DNS for my IP has *dsl* in it, which is often interpreted as dynamic IP address. -- Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 187 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20090908/817f6366/attachment.pgp From mav at FreeBSD.org Tue Sep 8 05:46:39 2009 From: mav at FreeBSD.org (Alexander Motin) Date: Tue Sep 8 05:46:53 2009 Subject: svn commit: r196964 - head/sys/geom Message-ID: <200909080546.n885kcHx037457@svn.freebsd.org> Author: mav Date: Tue Sep 8 05:46:38 2009 New Revision: 196964 URL: http://svn.freebsd.org/changeset/base/196964 Log: Do not check proper request alignment here in geom_dev in production. It will be checked any way later by g_io_check() in g_io_schedule_down(). It is only needed here to not trigger panic from additional check, when INVARIANTS enabled. So cover it with #ifdef INVARIANTS. It saves two 64bit divisions per request. Modified: head/sys/geom/geom_dev.c Modified: head/sys/geom/geom_dev.c ============================================================================== --- head/sys/geom/geom_dev.c Tue Sep 8 05:24:09 2009 (r196963) +++ head/sys/geom/geom_dev.c Tue Sep 8 05:46:38 2009 (r196964) @@ -371,14 +371,14 @@ g_dev_strategy(struct bio *bp) cp = dev->si_drv2; KASSERT(cp->acr || cp->acw, ("Consumer with zero access count in g_dev_strategy")); - +#ifdef INVARIANTS if ((bp->bio_offset % cp->provider->sectorsize) != 0 || (bp->bio_bcount % cp->provider->sectorsize) != 0) { bp->bio_resid = bp->bio_bcount; biofinish(bp, NULL, EINVAL); return; } - +#endif for (;;) { /* * XXX: This is not an ideal solution, but I belive it to From pjd at FreeBSD.org Tue Sep 8 08:54:15 2009 From: pjd at FreeBSD.org (Pawel Jakub Dawidek) Date: Tue Sep 8 08:54:27 2009 Subject: svn commit: r196965 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <200909080854.n888sFGR041201@svn.freebsd.org> Author: pjd Date: Tue Sep 8 08:54:15 2009 New Revision: 196965 URL: http://svn.freebsd.org/changeset/base/196965 Log: Fix reference count leak for a case where snapshot's mount point is updated. Such situation is not supported. This problem was triggered by something like this: # zpool create tank da0 # zfs snapshot tank@snap # cd /tank/.zfs/snapshot/snap (this will mount the snapshot) # cd # mount -u nosuid /tank/.zfs/snapshot/snap (refcount leak) # zpool export tank cannot export 'tank': pool is busy MFC after: 1 week 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 Sep 8 05:46:38 2009 (r196964) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue Sep 8 08:54:15 2009 (r196965) @@ -337,6 +337,13 @@ zfs_register_callbacks(vfs_t *vfsp) os = zfsvfs->z_os; /* + * This function can be called for a snapshot when we update snapshot's + * mount point, which isn't really supported. + */ + if (dmu_objset_is_snapshot(os)) + return (EOPNOTSUPP); + + /* * The act of registering our callbacks will destroy any mount * options we may have. In order to enable temporary overrides * of mount options, we stash away the current values and From kib at FreeBSD.org Tue Sep 8 09:17:34 2009 From: kib at FreeBSD.org (Konstantin Belousov) Date: Tue Sep 8 09:17:46 2009 Subject: svn commit: r196966 - head/sys/cddl/compat/opensolaris/kern Message-ID: <200909080917.n889HYI1041726@svn.freebsd.org> Author: kib Date: Tue Sep 8 09:17:34 2009 New Revision: 196966 URL: http://svn.freebsd.org/changeset/base/196966 Log: Lock Giant around vn_open_cred(). Remove innocent unnecessary call to NDFREE(). Reported by: marcel Reviewed and tested by: pjd MFC after: 3 days Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c Tue Sep 8 08:54:15 2009 (r196965) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c Tue Sep 8 09:17:34 2009 (r196966) @@ -69,7 +69,7 @@ kobj_open_file_vnode(const char *file) struct thread *td = curthread; struct filedesc *fd; struct nameidata nd; - int error, flags; + int error, flags, vfslocked; fd = td->td_proc->p_fd; FILEDESC_XLOCK(fd); @@ -86,11 +86,13 @@ kobj_open_file_vnode(const char *file) flags = FREAD | O_NOFOLLOW; NDINIT(&nd, LOOKUP, MPSAFE, UIO_SYSSPACE, file, td); error = vn_open_cred(&nd, &flags, 0, 0, curthread->td_ucred, NULL); - NDFREE(&nd, NDF_ONLY_PNBUF); if (error != 0) return (NULL); + vfslocked = NDHASGIANT(&nd); + NDFREE(&nd, NDF_ONLY_PNBUF); /* We just unlock so we hold a reference. */ VOP_UNLOCK(nd.ni_vp, 0); + VFS_UNLOCK_GIANT(vfslocked); return (nd.ni_vp); } From phk at FreeBSD.org Tue Sep 8 10:39:38 2009 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue Sep 8 10:39:50 2009 Subject: svn commit: r196967 - in head/sys: netinet sys Message-ID: <200909081039.n88AdcNU045214@svn.freebsd.org> Author: phk Date: Tue Sep 8 10:39:38 2009 New Revision: 196967 URL: http://svn.freebsd.org/changeset/base/196967 Log: Move the duplicate definition of struct sockaddr_storage to its own include file, and include this where the previous duplicate definitions were. Static program checkers like FlexeLint rightfully take a dim view of duplicate definitions, even if they currently are identical. Added: head/sys/sys/_sockaddr_storage.h (contents, props changed) Modified: head/sys/netinet/in.h head/sys/sys/socket.h Modified: head/sys/netinet/in.h ============================================================================== --- head/sys/netinet/in.h Tue Sep 8 09:17:34 2009 (r196966) +++ head/sys/netinet/in.h Tue Sep 8 10:39:38 2009 (r196967) @@ -89,27 +89,7 @@ typedef __socklen_t socklen_t; #define _SOCKLEN_T_DECLARED #endif -/* Avoid collision with original definition in sys/socket.h. */ -#ifndef _STRUCT_SOCKADDR_STORAGE_DECLARED -/* - * RFC 2553: protocol-independent placeholder for socket addresses - */ -#define _SS_MAXSIZE 128U -#define _SS_ALIGNSIZE (sizeof(__int64_t)) -#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(unsigned char) - \ - sizeof(sa_family_t)) -#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(unsigned char) - \ - sizeof(sa_family_t) - _SS_PAD1SIZE - _SS_ALIGNSIZE) - -struct sockaddr_storage { - unsigned char ss_len; /* address length */ - sa_family_t ss_family; /* address family */ - char __ss_pad1[_SS_PAD1SIZE]; - __int64_t __ss_align; /* force desired struct alignment */ - char __ss_pad2[_SS_PAD2SIZE]; -}; -#define _STRUCT_SOCKADDR_STORAGE_DECLARED -#endif +#include /* Socket address, internet style. */ struct sockaddr_in { Added: head/sys/sys/_sockaddr_storage.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sys/_sockaddr_storage.h Tue Sep 8 10:39:38 2009 (r196967) @@ -0,0 +1,54 @@ +/*- + * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994 + * The Regents of the University of California. 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. + * 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. + * + * @(#)socket.h 8.4 (Berkeley) 2/21/94 + * $FreeBSD$ + */ + +#ifndef _SYS__SOCKADDR_STORAGE_H_ +#define _SYS__SOCKADDR_STORAGE_H_ + +/* + * RFC 2553: protocol-independent placeholder for socket addresses + */ +#define _SS_MAXSIZE 128U +#define _SS_ALIGNSIZE (sizeof(__int64_t)) +#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(unsigned char) - \ + sizeof(sa_family_t)) +#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(unsigned char) - \ + sizeof(sa_family_t) - _SS_PAD1SIZE - _SS_ALIGNSIZE) + +struct sockaddr_storage { + unsigned char ss_len; /* address length */ + sa_family_t ss_family; /* address family */ + char __ss_pad1[_SS_PAD1SIZE]; + __int64_t __ss_align; /* force desired struct alignment */ + char __ss_pad2[_SS_PAD2SIZE]; +}; + +#endif /* !_SYS__SOCKADDR_STORAGE_H_ */ Modified: head/sys/sys/socket.h ============================================================================== --- head/sys/sys/socket.h Tue Sep 8 09:17:34 2009 (r196966) +++ head/sys/sys/socket.h Tue Sep 8 10:39:38 2009 (r196967) @@ -290,26 +290,7 @@ struct sockproto { }; #endif -#ifndef _STRUCT_SOCKADDR_STORAGE_DECLARED -/* - * RFC 2553: protocol-independent placeholder for socket addresses - */ -#define _SS_MAXSIZE 128U -#define _SS_ALIGNSIZE (sizeof(__int64_t)) -#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(unsigned char) - \ - sizeof(sa_family_t)) -#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(unsigned char) - \ - sizeof(sa_family_t) - _SS_PAD1SIZE - _SS_ALIGNSIZE) - -struct sockaddr_storage { - unsigned char ss_len; /* address length */ - sa_family_t ss_family; /* address family */ - char __ss_pad1[_SS_PAD1SIZE]; - __int64_t __ss_align; /* force desired struct alignment */ - char __ss_pad2[_SS_PAD2SIZE]; -}; -#define _STRUCT_SOCKADDR_STORAGE_DECLARED -#endif +#include #if __BSD_VISIBLE /* From phk at FreeBSD.org Tue Sep 8 12:59:57 2009 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue Sep 8 13:00:04 2009 Subject: svn commit: r196968 - head/sys/amd64/include Message-ID: <200909081259.n88Cxvan048046@svn.freebsd.org> Author: phk Date: Tue Sep 8 12:59:56 2009 New Revision: 196968 URL: http://svn.freebsd.org/changeset/base/196968 Log: Move multi-include protection back up to the top of the file and name after the physical file rather than the aliased name. Modified: head/sys/amd64/include/param.h Modified: head/sys/amd64/include/param.h ============================================================================== --- head/sys/amd64/include/param.h Tue Sep 8 10:39:38 2009 (r196967) +++ head/sys/amd64/include/param.h Tue Sep 8 12:59:56 2009 (r196968) @@ -39,6 +39,9 @@ * $FreeBSD$ */ +#ifndef _AMD64_INCLUDE_PARAM_H_ +#define _AMD64_INCLUDE_PARAM_H_ + /* * Machine dependent constants for AMD64. */ @@ -60,9 +63,6 @@ #define __HAVE_ACPI #define __PCI_REROUTE_INTERRUPT -#ifndef _MACHINE_PARAM_H_ -#define _MACHINE_PARAM_H_ - #ifndef MACHINE #define MACHINE "amd64" #endif @@ -150,5 +150,5 @@ #define pgtok(x) ((unsigned long)(x) * (PAGE_SIZE / 1024)) -#endif /* !_MACHINE_PARAM_H_ */ #endif /* !_NO_NAMESPACE_POLLUTION */ +#endif /* !_AMD64_INCLUDE_PARAM_H_ */ From phk at FreeBSD.org Tue Sep 8 13:16:56 2009 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue Sep 8 13:17:04 2009 Subject: svn commit: r196969 - in head/sys: cam/scsi contrib/dev/acpica/executer dev/aac dev/ae dev/amr dev/ata dev/ata/chipsets dev/ath dev/ath/ath_hal dev/bce dev/e1000 dev/ep dev/firewire dev/fxp dev/hpt... Message-ID: <200909081316.n88DGtVn048461@svn.freebsd.org> Author: phk Date: Tue Sep 8 13:16:55 2009 New Revision: 196969 URL: http://svn.freebsd.org/changeset/base/196969 Log: Add necessary include. Modified: head/sys/cam/scsi/scsi_cd.c head/sys/contrib/dev/acpica/executer/exfldio.c head/sys/dev/aac/aac.c head/sys/dev/ae/if_ae.c head/sys/dev/amr/amr.c head/sys/dev/ata/ata-raid.c head/sys/dev/ata/chipsets/ata-acerlabs.c head/sys/dev/ata/chipsets/ata-marvell.c head/sys/dev/ath/ah_osdep.c head/sys/dev/ath/ath_hal/ah.c head/sys/dev/ath/ath_hal/ah_eeprom_v3.c head/sys/dev/bce/if_bce.c head/sys/dev/e1000/if_em.c head/sys/dev/ep/if_ep.c head/sys/dev/ep/if_epreg.h head/sys/dev/firewire/fwcrom.c head/sys/dev/firewire/fwdev.c head/sys/dev/fxp/if_fxp.c head/sys/dev/hptiop/hptiop.c head/sys/dev/iir/iir.c head/sys/dev/mpt/mpt_raid.c head/sys/dev/msk/if_msk.c head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumreg.h head/sys/dev/usb/wlan/if_urtw.c head/sys/dev/wi/if_wi.c head/sys/fs/msdosfs/msdosfs_conv.c head/sys/kern/kern_jail.c head/sys/kern/kern_linker.c head/sys/kern/kern_lock.c head/sys/kern/kern_mutex.c head/sys/net80211/ieee80211_action.c head/sys/net80211/ieee80211_proto.h head/sys/security/audit/audit_bsm_token.c Modified: head/sys/cam/scsi/scsi_cd.c ============================================================================== --- head/sys/cam/scsi/scsi_cd.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/cam/scsi/scsi_cd.c Tue Sep 8 13:16:55 2009 (r196969) @@ -2528,7 +2528,7 @@ cdioctl(struct disk *dp, u_long cmd, voi error = cdgetmode(periph, ¶ms, AUDIO_PAGE); if (error) { - free(¶ms, M_SCSICD); + free(¶ms.mode_buf, M_SCSICD); cam_periph_unlock(periph); break; } Modified: head/sys/contrib/dev/acpica/executer/exfldio.c ============================================================================== --- head/sys/contrib/dev/acpica/executer/exfldio.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/contrib/dev/acpica/executer/exfldio.c Tue Sep 8 13:16:55 2009 (r196969) @@ -992,6 +992,7 @@ AcpiExInsertIntoField ( /* Get initial Datum from the input buffer */ + /* XXX: Flexelint sees arg 9 for bufferlen 8 */ ACPI_MEMCPY (&RawDatum, Buffer, ACPI_MIN(ObjDesc->CommonField.AccessByteWidth, BufferLength - BufferOffset)); Modified: head/sys/dev/aac/aac.c ============================================================================== --- head/sys/dev/aac/aac.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/aac/aac.c Tue Sep 8 13:16:55 2009 (r196969) @@ -3556,7 +3556,7 @@ aac_supported_features(struct aac_softc * associated with the feature in the data field or perform whatever * action needed indicates in the data field. */ - if (f.feat.fValue == 0) { + if (f.feat.fValue == 0) { f.feat.fBits.largeLBA = (sc->flags & AAC_FLAGS_LBA_64BIT) ? 1 : 0; /* TODO: In the future, add other features state here as well */ Modified: head/sys/dev/ae/if_ae.c ============================================================================== --- head/sys/dev/ae/if_ae.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/ae/if_ae.c Tue Sep 8 13:16:55 2009 (r196969) @@ -1662,6 +1662,7 @@ ae_stop_rxmac(ae_softc_t *sc) /* * Wait for IDLE state. */ + /* XXX: Flexelint "<" test with -- */ for (i = 0; i < AE_IDLE_TIMEOUT; i--) { val = AE_READ_4(sc, AE_IDLE_REG); if ((val & (AE_IDLE_RXMAC | AE_IDLE_DMAWRITE)) == 0) @@ -1698,6 +1699,7 @@ ae_stop_txmac(ae_softc_t *sc) /* * Wait for IDLE state. */ + /* XXX: Flexelint "<" test with -- */ for (i = 0; i < AE_IDLE_TIMEOUT; i--) { val = AE_READ_4(sc, AE_IDLE_REG); if ((val & (AE_IDLE_TXMAC | AE_IDLE_DMAREAD)) == 0) Modified: head/sys/dev/amr/amr.c ============================================================================== --- head/sys/dev/amr/amr.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/amr/amr.c Tue Sep 8 13:16:55 2009 (r196969) @@ -527,7 +527,7 @@ amr_rescan_drives(struct cdev *dev) sc->amr_drive[i].al_disk)) != 0) goto shutdown_out; - sc->amr_drive[i].al_disk = 0; + sc->amr_drive[i].al_disk = 0; } } Modified: head/sys/dev/ata/ata-raid.c ============================================================================== --- head/sys/dev/ata/ata-raid.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/ata/ata-raid.c Tue Sep 8 13:16:55 2009 (r196969) @@ -407,7 +407,7 @@ ata_raid_strategy(struct bio *bp) if (rdp->status & AR_S_REBUILDING) blk = ((lba / rdp->interleave) * rdp->width) * rdp->interleave + (rdp->interleave * (drv % rdp->width)) + - lba % rdp->interleave;; + lba % rdp->interleave; if (bp->bio_cmd == BIO_READ) { int src_online = @@ -1138,6 +1138,7 @@ ata_raid_create(struct ata_ioc_raid_conf rdp->type == AR_T_RAID5) { int bit = 0; + /* XXX: Flexelint not happy */ while (config->interleave >>= 1) bit++; rdp->interleave = 1 << bit; Modified: head/sys/dev/ata/chipsets/ata-acerlabs.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-acerlabs.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/ata/chipsets/ata-acerlabs.c Tue Sep 8 13:16:55 2009 (r196969) @@ -127,6 +127,7 @@ ata_ali_chipinit(device_t dev) RF_ACTIVE); if (res->bars[i] == NULL) { device_printf(dev, "Failed to allocate BAR %d\n", i); + /* XXX: Flexelint: Reuse of for loop variable 'i' at 'line 124' could cause chaos */ for (i--; i >=0; i--) bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(i), res->bars[i]); Modified: head/sys/dev/ata/chipsets/ata-marvell.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-marvell.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/ata/chipsets/ata-marvell.c Tue Sep 8 13:16:55 2009 (r196969) @@ -153,7 +153,7 @@ ata_marvell_pata_ch_attach(device_t dev) return ENXIO; /* dont use 32 bit PIO transfers */ - ch->flags |= ATA_USE_16BIT; + ch->flags |= ATA_USE_16BIT; return 0; } Modified: head/sys/dev/ath/ah_osdep.c ============================================================================== --- head/sys/dev/ath/ah_osdep.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/ath/ah_osdep.c Tue Sep 8 13:16:55 2009 (r196969) @@ -107,6 +107,7 @@ ath_hal_malloc(size_t size) return malloc(size, M_ATH_HAL, M_NOWAIT | M_ZERO); } +/* XXX: FlexeLint return in void function ? */ void ath_hal_free(void* p) { Modified: head/sys/dev/ath/ath_hal/ah.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/ath/ath_hal/ah.c Tue Sep 8 13:16:55 2009 (r196969) @@ -566,6 +566,7 @@ ath_hal_getregdump(struct ath_hal *ah, c uint32_t *dp = dstbuf; int i; + /* XXX: FlexeLint: ">" test with ++ */ for (i = 0; space >= 2*sizeof(uint32_t); i++) { u_int r = regs[i].start; u_int e = regs[i].end; Modified: head/sys/dev/ath/ath_hal/ah_eeprom_v3.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah_eeprom_v3.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/ath/ath_hal/ah_eeprom_v3.c Tue Sep 8 13:16:55 2009 (r196969) @@ -1753,6 +1753,8 @@ legacyEepromGetSpurChan(struct ath_hal * /* * Reclaim any EEPROM-related storage. */ + +/* XXX: FlexeLint: return in void function */ static void legacyEepromDetach(struct ath_hal *ah) { Modified: head/sys/dev/bce/if_bce.c ============================================================================== --- head/sys/dev/bce/if_bce.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/bce/if_bce.c Tue Sep 8 13:16:55 2009 (r196969) @@ -608,17 +608,17 @@ bce_print_adapter_info(struct bce_softc #endif if (sc->bce_flags & BCE_USING_MSI_FLAG) { if (i > 0) printf("|"); - printf("MSI"); i++; + printf("MSI"); i++; } if (sc->bce_flags & BCE_USING_MSIX_FLAG) { if (i > 0) printf("|"); - printf("MSI-X "); i++; + printf("MSI-X "); i++; } if (sc->bce_phy_flags & BCE_PHY_2_5G_CAPABLE_FLAG) { if (i > 0) printf("|"); - printf("2.5G"); i++; + printf("2.5G"); i++; } if (sc->bce_flags & BCE_MFW_ENABLE_FLAG) { @@ -628,7 +628,7 @@ bce_print_adapter_info(struct bce_softc printf(")\n"); } - DBEXIT(BCE_VERBOSE_LOAD); + DBEXIT(BCE_VERBOSE_LOAD); } Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/e1000/if_em.c Tue Sep 8 13:16:55 2009 (r196969) @@ -2826,7 +2826,7 @@ em_allocate_pci_resources(struct adapter * Setup the Legacy or MSI Interrupt handler * **********************************************************************/ -int +static int em_allocate_legacy(struct adapter *adapter) { device_t dev = adapter->dev; Modified: head/sys/dev/ep/if_ep.c ============================================================================== --- head/sys/dev/ep/if_ep.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/ep/if_ep.c Tue Sep 8 13:16:55 2009 (r196969) @@ -666,6 +666,7 @@ rescan: sc->tx_underrun++; #endif } else { + /* XXX: FlexeLint doesn't like ; */ if (status & TXS_JABBER); else ++ifp->if_collisions; Modified: head/sys/dev/ep/if_epreg.h ============================================================================== --- head/sys/dev/ep/if_epreg.h Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/ep/if_epreg.h Tue Sep 8 13:16:55 2009 (r196969) @@ -315,7 +315,11 @@ S_TX_AVAIL|S_RX_COMPLETE|S_RX_EARLY) #define S_COMMAND_IN_PROGRESS (u_short) (0x1000) -#define EP_BUSY_WAIT(sc) while (CSR_READ_2(sc, EP_STATUS) & S_COMMAND_IN_PROGRESS) +#define EP_BUSY_WAIT(sc) \ + do { \ + while (CSR_READ_2(sc, EP_STATUS) & S_COMMAND_IN_PROGRESS) \ + continue; \ + } while (0) /* Address Config. Register. * Window 0/Port 06 Modified: head/sys/dev/firewire/fwcrom.c ============================================================================== --- head/sys/dev/firewire/fwcrom.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/firewire/fwcrom.c Tue Sep 8 13:16:55 2009 (r196969) @@ -454,9 +454,9 @@ crom_add_simple_text(struct crom_src *sr len = strlen(buf); if (len > MAX_TEXT) { #if defined(__DragonFly__) || __FreeBSD_version < 500000 - printf("text(%d) trancated to %d.\n", len, MAX_TEXT); + printf("text(%d) truncated to %d.\n", len, MAX_TEXT); #else - printf("text(%d) trancated to %td.\n", len, MAX_TEXT); + printf("text(%d) truncated to %td.\n", len, MAX_TEXT); #endif len = MAX_TEXT; } Modified: head/sys/dev/firewire/fwdev.c ============================================================================== --- head/sys/dev/firewire/fwdev.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/firewire/fwdev.c Tue Sep 8 13:16:55 2009 (r196969) @@ -844,6 +844,7 @@ out: err = copyout(ptr, crom_buf->ptr, len); if (fwdev == NULL) /* myself */ + /* XXX: Flexelint no sure about modified pointer */ free(ptr, M_FW); break; default: Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/fxp/if_fxp.c Tue Sep 8 13:16:55 2009 (r196969) @@ -1597,6 +1597,7 @@ fxp_encap(struct fxp_softc *sc, struct m cbp->tbd_number = nseg; /* Configure TSO. */ if (m->m_pkthdr.csum_flags & CSUM_TSO) { + /* XXX: FlexeLint: negative subscript */ cbp->tbd[-1].tb_size = htole32(m->m_pkthdr.tso_segsz << 16); cbp->tbd[1].tb_size |= htole32(tcp_payload << 16); cbp->ipcb_ip_schedule |= FXP_IPCB_LARGESEND_ENABLE | Modified: head/sys/dev/hptiop/hptiop.c ============================================================================== --- head/sys/dev/hptiop/hptiop.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/hptiop/hptiop.c Tue Sep 8 13:16:55 2009 (r196969) @@ -432,6 +432,7 @@ srb_complete: sg_list), (u_int8_t *)&ccb->csio.sense_data, MIN(dxfer, sizeof(ccb->csio.sense_data))); } else { + /* XXX: Flexelint arg2 is 16 bytes, arg3 is 32 */ memcpy(&ccb->csio.sense_data, &req->sg_list, MIN(dxfer, sizeof(ccb->csio.sense_data))); } @@ -575,6 +576,7 @@ static void hptiop_request_callback_mv(s ccb->ccb_h.status = CAM_BUSY; break; case IOP_RESULT_CHECK_CONDITION: + /* XXX: FlexeLint: arg2=16b arg3=32 */ memcpy(&ccb->csio.sense_data, &req->sg_list, MIN(req->dataxfer_length, sizeof(ccb->csio.sense_data))); ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR; Modified: head/sys/dev/iir/iir.c ============================================================================== --- head/sys/dev/iir/iir.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/iir/iir.c Tue Sep 8 13:16:55 2009 (r196969) @@ -1203,6 +1203,7 @@ gdt_internal_cache_cmd(struct gdt_softc bzero( ccb->csio.data_ptr+copylen, ccb->csio.dxfer_len - copylen ); page=((struct scsi_mode_sense_6 *)ccb->csio.cdb_io.cdb_bytes)->page; + /* XXX: FlexeLint: why ?? */ switch (page) { default: GDT_DPRINTF(GDT_D_MISC, ("MODE_SENSE_6: page 0x%x\n", page)); Modified: head/sys/dev/mpt/mpt_raid.c ============================================================================== --- head/sys/dev/mpt/mpt_raid.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/mpt/mpt_raid.c Tue Sep 8 13:16:55 2009 (r196969) @@ -562,6 +562,7 @@ mpt_raid_reply_frame_handler(struct mpt_ break; } action_result = REQ_TO_RAID_ACTION_RESULT(req); + /* XXX: FlexeLint: ActionData is only 4 bytes */ memcpy(&action_result->action_data, &reply->ActionData, sizeof(action_result->action_data)); action_result->action_status = le16toh(reply->ActionStatus); Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/msk/if_msk.c Tue Sep 8 13:16:55 2009 (r196969) @@ -118,26 +118,21 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include #include #include -#include #include #include -#include #include #include #include #include -#include #include -#include #include #include Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/usb/wlan/if_rum.c Tue Sep 8 13:16:55 2009 (r196969) @@ -42,12 +42,9 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include #include #include -#include #include #include #include @@ -1489,7 +1486,7 @@ rum_rf_write(struct rum_softc *sc, uint8 return; } - tmp = RT2573_RF_BUSY | RT2573_RF_20BIT | (val & 0xfffff) << 2 | + tmp = RT2573_RF_BUSY | RT2573_RF_20BIT | ((val & 0xfffff) << 2) | (reg & 3); rum_write(sc, RT2573_PHY_CSR4, tmp); Modified: head/sys/dev/usb/wlan/if_rumreg.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumreg.h Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/usb/wlan/if_rumreg.h Tue Sep 8 13:16:55 2009 (r196969) @@ -139,7 +139,7 @@ #define RT2573_BBP_BUSY (1 << 16) /* possible flags for register PHY_CSR4 */ #define RT2573_RF_20BIT (20 << 24) -#define RT2573_RF_BUSY (1 << 31) +#define RT2573_RF_BUSY (1U << 31) /* LED values */ #define RT2573_LED_RADIO (1 << 8) Modified: head/sys/dev/usb/wlan/if_urtw.c ============================================================================== --- head/sys/dev/usb/wlan/if_urtw.c Tue Sep 8 12:59:56 2009 (r196968) +++ head/sys/dev/usb/wlan/if_urtw.c Tue Sep 8 13:16:55 2009 (r196969) @@ -61,6 +61,8 @@ __FBSDID("$FreeBSD$"); #include #include +#define nitems(a) (sizeof(a) / sizeof((a)[0])) + SYSCTL_NODE(_hw_usb, OID_AUTO, urtw, CTLFLAG_RW, 0, "USB Realtek 8187L"); #ifdef URTW_DEBUG int urtw_debug = 0; @@ -175,6 +177,46 @@ struct urtw_pair { uint32_t val; }; +static const uint8_t urtw_8187b_reg_table[][3] = { + { 0xf0, 0x32, 0 }, { 0xf1, 0x32, 0 }, { 0xf2, 0x00, 0 }, + { 0xf3, 0x00, 0 }, { 0xf4, 0x32, 0 }, { 0xf5, 0x43, 0 }, + { 0xf6, 0x00, 0 }, { 0xf7, 0x00, 0 }, { 0xf8, 0x46, 0 }, + { 0xf9, 0xa4, 0 }, { 0xfa, 0x00, 0 }, { 0xfb, 0x00, 0 }, + { 0xfc, 0x96, 0 }, { 0xfd, 0xa4, 0 }, { 0xfe, 0x00, 0 }, + { 0xff, 0x00, 0 }, + + { 0x58, 0x4b, 1 }, { 0x59, 0x00, 1 }, { 0x5a, 0x4b, 1 }, + { 0x5b, 0x00, 1 }, { 0x60, 0x4b, 1 }, { 0x61, 0x09, 1 }, + { 0x62, 0x4b, 1 }, { 0x63, 0x09, 1 }, { 0xce, 0x0f, 1 }, + { 0xcf, 0x00, 1 }, { 0xe0, 0xff, 1 }, { 0xe1, 0x0f, 1 }, + { 0xe2, 0x00, 1 }, { 0xf0, 0x4e, 1 }, { 0xf1, 0x01, 1 }, + { 0xf2, 0x02, 1 }, { 0xf3, 0x03, 1 }, { 0xf4, 0x04, 1 }, + { 0xf5, 0x05, 1 }, { 0xf6, 0x06, 1 }, { 0xf7, 0x07, 1 }, + { 0xf8, 0x08, 1 }, + + { 0x4e, 0x00, 2 }, { 0x0c, 0x04, 2 }, { 0x21, 0x61, 2 }, + { 0x22, 0x68, 2 }, { 0x23, 0x6f, 2 }, { 0x24, 0x76, 2 }, + { 0x25, 0x7d, 2 }, { 0x26, 0x84, 2 }, { 0x27, 0x8d, 2 }, + { 0x4d, 0x08, 2 }, { 0x50, 0x05, 2 }, { 0x51, 0xf5, 2 }, + { 0x52, 0x04, 2 }, { 0x53, 0xa0, 2 }, { 0x54, 0x1f, 2 }, + { 0x55, 0x23, 2 }, { 0x56, 0x45, 2 }, { 0x57, 0x67, 2 }, + { 0x58, 0x08, 2 }, { 0x59, 0x08, 2 }, { 0x5a, 0x08, 2 }, + { 0x5b, 0x08, 2 }, { 0x60, 0x08, 2 }, { 0x61, 0x08, 2 }, + { 0x62, 0x08, 2 }, { 0x63, 0x08, 2 }, { 0x64, 0xcf, 2 }, + { 0x72, 0x56, 2 }, { 0x73, 0x9a, 2 }, + + { 0x34, 0xf0, 0 }, { 0x35, 0x0f, 0 }, { 0x5b, 0x40, 0 }, + { 0x84, 0x88, 0 }, { 0x85, 0x24, 0 }, { 0x88, 0x54, 0 }, + { 0x8b, 0xb8, 0 }, { 0x8c, 0x07, 0 }, { 0x8d, 0x00, 0 }, + { 0x94, 0x1b, 0 }, { 0x95, 0x12, 0 }, { 0x96, 0x00, 0 }, + { 0x97, 0x06, 0 }, { 0x9d, 0x1a, 0 }, { 0x9f, 0x10, 0 }, + { 0xb4, 0x22, 0 }, { 0xbe, 0x80, 0 }, { 0xdb, 0x00, 0 }, + { 0xee, 0x00, 0 }, { 0x91, 0x03, 0 }, + + { 0x4c, 0x00, 2 }, { 0x9f, 0x00, 3 }, { 0x8c, 0x01, 0 }, + { 0x8d, 0x10, 0 }, { 0x8e, 0x08, 0 }, { 0x8f, 0x00, 0 } +}; + static uint8_t urtw_8225_agc[] = { 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9d, 0x9c, 0x9b, 0x9a, 0x99, 0x98, 0x97, 0x96, 0x95, 0x94, 0x93, 0x92, 0x91, 0x90, @@ -190,21 +232,6 @@ static uint8_t urtw_8225_agc[] = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }; -static uint8_t urtw_8225z2_agc[] = { - 0x5e, 0x5e, 0x5e, 0x5e, 0x5d, 0x5b, 0x59, 0x57, 0x55, 0x53, 0x51, - 0x4f, 0x4d, 0x4b, 0x49, 0x47, 0x45, 0x43, 0x41, 0x3f, 0x3d, 0x3b, - 0x39, 0x37, 0x35, 0x33, 0x31, 0x2f, 0x2d, 0x2b, 0x29, 0x27, 0x25, - 0x23, 0x21, 0x1f, 0x1d, 0x1b, 0x19, 0x17, 0x15, 0x13, 0x11, 0x0f, - 0x0d, 0x0b, 0x09, 0x07, 0x05, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x19, 0x19, - 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x20, 0x21, 0x22, 0x23, - 0x24, 0x25, 0x26, 0x26, 0x27, 0x27, 0x28, 0x28, 0x29, 0x2a, 0x2a, - 0x2a, 0x2b, 0x2b, 0x2b, 0x2c, 0x2c, 0x2c, 0x2d, 0x2d, 0x2d, 0x2d, - 0x2e, 0x2e, 0x2e, 0x2e, 0x2f, 0x2f, 0x2f, 0x30, 0x30, 0x31, 0x31, - 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, - 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31 -}; - static uint32_t urtw_8225_channel[] = { 0x0000, /* dummy channel 0 */ 0x085c, /* 1 */ @@ -237,7 +264,7 @@ static struct urtw_pair urtw_8225_rf_par { 0x00, 0x0067 }, { 0x01, 0x0fe0 }, { 0x02, 0x044d }, { 0x03, 0x0441 }, { 0x04, 0x0486 }, { 0x05, 0x0bc0 }, { 0x06, 0x0ae6 }, { 0x07, 0x082a }, { 0x08, 0x001f }, { 0x09, 0x0334 }, { 0x0a, 0x0fd4 }, { 0x0b, 0x0391 }, - { 0x0c, 0x0050 }, { 0x0d, 0x06db }, { 0x0e, 0x0029 }, { 0x0f, 0x0914 }, + { 0x0c, 0x0050 }, { 0x0d, 0x06db }, { 0x0e, 0x0029 }, { 0x0f, 0x0914 } }; static struct urtw_pair urtw_8225_rf_part2[] = { @@ -279,7 +306,7 @@ static uint16_t urtw_8225_rxgain[] = { }; static uint8_t urtw_8225_threshold[] = { - 0x8d, 0x8d, 0x8d, 0x8d, 0x9d, 0xad, 0xbd, + 0x8d, 0x8d, 0x8d, 0x8d, 0x9d, 0xad, 0xbd }; static uint8_t urtw_8225_tx_gain_cck_ofdm[] = { @@ -304,10 +331,29 @@ static uint8_t urtw_8225_txpwr_cck_ch14[ 0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00 }; -static uint8_t urtw_8225_txpwr_ofdm[]={ +static uint8_t urtw_8225_txpwr_ofdm[] = { 0x80, 0x90, 0xa2, 0xb5, 0xcb, 0xe4 }; +static uint8_t urtw_8225z2_agc[] = { + 0x5e, 0x5e, 0x5e, 0x5e, 0x5d, 0x5b, 0x59, 0x57, + 0x55, 0x53, 0x51, 0x4f, 0x4d, 0x4b, 0x49, 0x47, + 0x45, 0x43, 0x41, 0x3f, 0x3d, 0x3b, 0x39, 0x37, + 0x35, 0x33, 0x31, 0x2f, 0x2d, 0x2b, 0x29, 0x27, + 0x25, 0x23, 0x21, 0x1f, 0x1d, 0x1b, 0x19, 0x17, + 0x15, 0x13, 0x11, 0x0f, 0x0d, 0x0b, 0x09, 0x07, + 0x05, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, + 0x19, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, + 0x26, 0x27, 0x27, 0x28, 0x28, 0x29, 0x2a, 0x2a, + 0x2a, 0x2b, 0x2b, 0x2b, 0x2c, 0x2c, 0x2c, 0x2d, + 0x2d, 0x2d, 0x2d, 0x2e, 0x2e, 0x2e, 0x2e, 0x2f, + 0x2f, 0x2f, 0x30, 0x30, 0x31, 0x31, 0x31, 0x31, + 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, + 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31 +}; + static uint8_t urtw_8225v2_gain_bg[]={ 0x23, 0x15, 0xa5, /* -82-1dbm */ 0x23, 0x15, 0xb5, /* -82-2dbm */ @@ -410,11 +456,7 @@ static uint8_t urtw_8225v2_tx_gain_cck_o 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, - 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, -}; - -static uint8_t urtw_8225v2_txpwr_cck[] = { - 0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04 + 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23 }; static uint8_t urtw_8225v2_txpwr_cck_ch14[] = { @@ -428,6 +470,10 @@ static uint8_t urtw_8225v2b_txpwr_cck[] 0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03 }; +static uint8_t urtw_8225v2_txpwr_cck[] = { + 0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04 +}; + static uint8_t urtw_8225v2b_txpwr_cck_ch14[] = { 0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x30, 0x2f, 0x29, 0x15, 0x00, 0x00, 0x00, 0x00, @@ -441,40 +487,6 @@ static struct urtw_pair urtw_ratetable[] { 96, 10 }, { 108, 11 } }; -static const uint8_t urtw_8187b_reg_table[][3] = { - { 0xf0, 0x32, 0 }, { 0xf1, 0x32, 0 }, { 0xf2, 0x00, 0 }, - { 0xf3, 0x00, 0 }, { 0xf4, 0x32, 0 }, { 0xf5, 0x43, 0 }, - { 0xf6, 0x00, 0 }, { 0xf7, 0x00, 0 }, { 0xf8, 0x46, 0 }, - { 0xf9, 0xa4, 0 }, { 0xfa, 0x00, 0 }, { 0xfb, 0x00, 0 }, - { 0xfc, 0x96, 0 }, { 0xfd, 0xa4, 0 }, { 0xfe, 0x00, 0 }, - { 0xff, 0x00, 0 }, { 0x58, 0x4b, 1 }, { 0x59, 0x00, 1 }, - { 0x5a, 0x4b, 1 }, { 0x5b, 0x00, 1 }, { 0x60, 0x4b, 1 }, - { 0x61, 0x09, 1 }, { 0x62, 0x4b, 1 }, { 0x63, 0x09, 1 }, - { 0xce, 0x0f, 1 }, { 0xcf, 0x00, 1 }, { 0xe0, 0xff, 1 }, - { 0xe1, 0x0f, 1 }, { 0xe2, 0x00, 1 }, { 0xf0, 0x4e, 1 }, - { 0xf1, 0x01, 1 }, { 0xf2, 0x02, 1 }, { 0xf3, 0x03, 1 }, - { 0xf4, 0x04, 1 }, { 0xf5, 0x05, 1 }, { 0xf6, 0x06, 1 }, - { 0xf7, 0x07, 1 }, { 0xf8, 0x08, 1 }, { 0x4e, 0x00, 2 }, - { 0x0c, 0x04, 2 }, { 0x21, 0x61, 2 }, { 0x22, 0x68, 2 }, - { 0x23, 0x6f, 2 }, { 0x24, 0x76, 2 }, { 0x25, 0x7d, 2 }, - { 0x26, 0x84, 2 }, { 0x27, 0x8d, 2 }, { 0x4d, 0x08, 2 }, - { 0x50, 0x05, 2 }, { 0x51, 0xf5, 2 }, { 0x52, 0x04, 2 }, - { 0x53, 0xa0, 2 }, { 0x54, 0x1f, 2 }, { 0x55, 0x23, 2 }, - { 0x56, 0x45, 2 }, { 0x57, 0x67, 2 }, { 0x58, 0x08, 2 }, - { 0x59, 0x08, 2 }, { 0x5a, 0x08, 2 }, { 0x5b, 0x08, 2 }, - { 0x60, 0x08, 2 }, { 0x61, 0x08, 2 }, { 0x62, 0x08, 2 }, - { 0x63, 0x08, 2 }, { 0x64, 0xcf, 2 }, { 0x72, 0x56, 2 }, - { 0x73, 0x9a, 2 }, { 0x34, 0xf0, 0 }, { 0x35, 0x0f, 0 }, - { 0x5b, 0x40, 0 }, { 0x84, 0x88, 0 }, { 0x85, 0x24, 0 }, - { 0x88, 0x54, 0 }, { 0x8b, 0xb8, 0 }, { 0x8c, 0x07, 0 }, - { 0x8d, 0x00, 0 }, { 0x94, 0x1b, 0 }, { 0x95, 0x12, 0 }, - { 0x96, 0x00, 0 }, { 0x97, 0x06, 0 }, { 0x9d, 0x1a, 0 }, - { 0x9f, 0x10, 0 }, { 0xb4, 0x22, 0 }, { 0xbe, 0x80, 0 }, - { 0xdb, 0x00, 0 }, { 0xee, 0x00, 0 }, { 0x91, 0x03, 0 }, - { 0x4c, 0x00, 2 }, { 0x9f, 0x00, 3 }, { 0x8c, 0x01, 0 }, - { 0x8d, 0x10, 0 }, { 0x8e, 0x08, 0 }, { 0x8f, 0x00, 0 } -}; - static usb_callback_t urtw_bulk_rx_callback; static usb_callback_t urtw_bulk_tx_callback; @@ -1034,7 +1046,6 @@ urtw_init(void *arg) static usb_error_t urtw_adapter_start_b(struct urtw_softc *sc) { -#define N(a) (sizeof(a) / sizeof((a)[0])) int i; uint8_t data8; usb_error_t error; @@ -1098,7 +1109,7 @@ urtw_adapter_start_b(struct urtw_softc * goto fail; urtw_write8_m(sc, URTW_WPA_CONFIG, 0); - for (i = 0; i < N(urtw_8187b_reg_table); i++) { + for (i = 0; i < nitems(urtw_8187b_reg_table); i++) { error = urtw_write8_i(sc, urtw_8187b_reg_table[i][0], urtw_8187b_reg_table[i][1], urtw_8187b_reg_table[i][2]); if (error) @@ -1208,7 +1219,6 @@ urtw_adapter_start_b(struct urtw_softc * fail: return (error); -#undef N } static usb_error_t @@ -1273,19 +1283,6 @@ fail: return (error); } -static usb_error_t -urtw_set_mode(struct urtw_softc *sc, uint32_t mode) -{ - uint8_t data; - usb_error_t error; - - urtw_read8_m(sc, URTW_EPROM_CMD, &data); - data = (data & ~URTW_EPROM_CMD_MASK) | (mode << URTW_EPROM_CMD_SHIFT); - data = data & ~(URTW_EPROM_CS | URTW_EPROM_CK); - urtw_write8_m(sc, URTW_EPROM_CMD, data); -fail: - return (error); -} static usb_error_t urtw_8187b_cmd_reset(struct urtw_softc *sc) @@ -1395,56 +1392,6 @@ urtw_write32_i(struct urtw_softc *sc, in } static void -urtw_stop_locked(struct ifnet *ifp, int disable) -{ - struct urtw_softc *sc = ifp->if_softc; - uint8_t data8; - usb_error_t error; - - (void)disable; - ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); - - error = urtw_intr_disable(sc); - if (error) - goto fail; - urtw_read8_m(sc, URTW_CMD, &data8); - data8 &= ~(URTW_CMD_RX_ENABLE | URTW_CMD_TX_ENABLE); - urtw_write8_m(sc, URTW_CMD, data8); - - error = sc->sc_rf_stop(sc); - if (error != 0) - goto fail; - - error = urtw_set_mode(sc, URTW_EPROM_CMD_CONFIG); - if (error) - goto fail; - urtw_read8_m(sc, URTW_CONFIG4, &data8); - urtw_write8_m(sc, URTW_CONFIG4, data8 | URTW_CONFIG4_VCOOFF); - error = urtw_set_mode(sc, URTW_EPROM_CMD_NORMAL); - if (error) - goto fail; -fail: - if (error) - device_printf(sc->sc_dev, "failed to stop (%s)\n", - usbd_errstr(error)); - - usb_callout_stop(&sc->sc_led_ch); - callout_stop(&sc->sc_watchdog_ch); - - urtw_abort_xfers(sc); -} - -static void -urtw_stop(struct ifnet *ifp, int disable) -{ - struct urtw_softc *sc = ifp->if_softc; - - URTW_LOCK(sc); - urtw_stop_locked(ifp, disable); - URTW_UNLOCK(sc); -} - -static void urtw_abort_xfers(struct urtw_softc *sc) { int i, max; @@ -1949,105 +1896,198 @@ urtw_set_multi(void *arg) ifp->if_flags |= IFF_ALLMULTI; } + static usb_error_t -urtw_set_rate(struct urtw_softc *sc) +urtw_get_macaddr(struct urtw_softc *sc) { - int i, basic_rate, min_rr_rate, max_rr_rate; - uint16_t data; + uint32_t data; usb_error_t error; - basic_rate = urtw_rate2rtl(48); - min_rr_rate = urtw_rate2rtl(12); - max_rr_rate = urtw_rate2rtl(48); - - urtw_write8_m(sc, URTW_RESP_RATE, - max_rr_rate << URTW_RESP_MAX_RATE_SHIFT | - min_rr_rate << URTW_RESP_MIN_RATE_SHIFT); - - urtw_read16_m(sc, URTW_BRSR, &data); - data &= ~URTW_BRSR_MBR_8185; - - for (i = 0; i <= basic_rate; i++) - data |= (1 << i); - - urtw_write16_m(sc, URTW_BRSR, data); + error = urtw_eprom_read32(sc, URTW_EPROM_MACADDR, &data); + if (error != 0) + goto fail; + sc->sc_bssid[0] = data & 0xff; + sc->sc_bssid[1] = (data & 0xff00) >> 8; + error = urtw_eprom_read32(sc, URTW_EPROM_MACADDR + 1, &data); + if (error != 0) + goto fail; + sc->sc_bssid[2] = data & 0xff; + sc->sc_bssid[3] = (data & 0xff00) >> 8; + error = urtw_eprom_read32(sc, URTW_EPROM_MACADDR + 2, &data); + if (error != 0) + goto fail; + sc->sc_bssid[4] = data & 0xff; + sc->sc_bssid[5] = (data & 0xff00) >> 8; fail: return (error); } -static uint16_t -urtw_rate2rtl(int rate) +static usb_error_t +urtw_eprom_read32(struct urtw_softc *sc, uint32_t addr, uint32_t *data) { -#define N(a) (sizeof(a) / sizeof((a)[0])) - int i; +#define URTW_READCMD_LEN 3 + int addrlen, i; + int16_t addrstr[8], data16, readcmd[] = { 1, 1, 0 }; + usb_error_t error; - for (i = 0; i < N(urtw_ratetable); i++) { - if (rate == urtw_ratetable[i].reg) - return urtw_ratetable[i].val; + /* NB: make sure the buffer is initialized */ + *data = 0; + + /* enable EPROM programming */ + urtw_write8_m(sc, URTW_EPROM_CMD, URTW_EPROM_CMD_PROGRAM_MODE); + DELAY(URTW_EPROM_DELAY); + + error = urtw_eprom_cs(sc, URTW_EPROM_ENABLE); + if (error != 0) + goto fail; + error = urtw_eprom_ck(sc); + if (error != 0) + goto fail; + error = urtw_eprom_sendbits(sc, readcmd, URTW_READCMD_LEN); + if (error != 0) + goto fail; + if (sc->sc_epromtype == URTW_EEPROM_93C56) { + addrlen = 8; + addrstr[0] = addr & (1 << 7); + addrstr[1] = addr & (1 << 6); + addrstr[2] = addr & (1 << 5); + addrstr[3] = addr & (1 << 4); + addrstr[4] = addr & (1 << 3); + addrstr[5] = addr & (1 << 2); + addrstr[6] = addr & (1 << 1); + addrstr[7] = addr & (1 << 0); + } else { + addrlen=6; + addrstr[0] = addr & (1 << 5); + addrstr[1] = addr & (1 << 4); + addrstr[2] = addr & (1 << 3); + addrstr[3] = addr & (1 << 2); + addrstr[4] = addr & (1 << 1); + addrstr[5] = addr & (1 << 0); } + error = urtw_eprom_sendbits(sc, addrstr, addrlen); + if (error != 0) + goto fail; - return (3); -#undef N -} + error = urtw_eprom_writebit(sc, 0); + if (error != 0) + goto fail; -static uint16_t -urtw_rtl2rate(int rate) -{ -#define N(a) (sizeof(a) / sizeof((a)[0])) - int i; + for (i = 0; i < 16; i++) { + error = urtw_eprom_ck(sc); + if (error != 0) + goto fail; + error = urtw_eprom_readbit(sc, &data16); + if (error != 0) + goto fail; - for (i = 0; i < N(urtw_ratetable); i++) { - if (rate == urtw_ratetable[i].val) - return urtw_ratetable[i].reg; + (*data) |= (data16 << (15 - i)); } - return (0); -#undef N + error = urtw_eprom_cs(sc, URTW_EPROM_DISABLE); + if (error != 0) + goto fail; + error = urtw_eprom_ck(sc); + if (error != 0) + goto fail; + + /* now disable EPROM programming */ + urtw_write8_m(sc, URTW_EPROM_CMD, URTW_EPROM_CMD_NORMAL_MODE); +fail: + return (error); +#undef URTW_READCMD_LEN } static usb_error_t -urtw_update_msr(struct urtw_softc *sc) +urtw_eprom_readbit(struct urtw_softc *sc, int16_t *data) { - struct ifnet *ifp = sc->sc_ifp; - struct ieee80211com *ic = ifp->if_l2com; - uint8_t data; + uint8_t data8; usb_error_t error; - urtw_read8_m(sc, URTW_MSR, &data); - data &= ~URTW_MSR_LINK_MASK; - - if (sc->sc_state == IEEE80211_S_RUN) { - switch (ic->ic_opmode) { - case IEEE80211_M_STA: - case IEEE80211_M_MONITOR: - data |= URTW_MSR_LINK_STA; - if (sc->sc_flags & URTW_RTL8187B) - data |= URTW_MSR_LINK_ENEDCA; - break; - case IEEE80211_M_IBSS: - data |= URTW_MSR_LINK_ADHOC; - break; - case IEEE80211_M_HOSTAP: - data |= URTW_MSR_LINK_HOSTAP; - break; - default: - panic("unsupported operation mode 0x%x\n", - ic->ic_opmode); - /* never reach */ - } - } else - data |= URTW_MSR_LINK_NONE; + urtw_read8_m(sc, URTW_EPROM_CMD, &data8); + *data = (data8 & URTW_EPROM_READBIT) ? 1 : 0; + DELAY(URTW_EPROM_DELAY); - urtw_write8_m(sc, URTW_MSR, data); fail: return (error); } static usb_error_t -urtw_read8_c(struct urtw_softc *sc, int val, uint8_t *data) +urtw_eprom_sendbits(struct urtw_softc *sc, int16_t *buf, int buflen) { - struct usb_device_request req; - usb_error_t error; + int i = 0; + usb_error_t error = 0; + + for (i = 0; i < buflen; i++) { + error = urtw_eprom_writebit(sc, buf[i]); + if (error != 0) + goto fail; + error = urtw_eprom_ck(sc); + if (error != 0) + goto fail; + } +fail: + return (error); +} + +static usb_error_t +urtw_eprom_writebit(struct urtw_softc *sc, int16_t bit) +{ + uint8_t data; + usb_error_t error; + + urtw_read8_m(sc, URTW_EPROM_CMD, &data); + if (bit != 0) + urtw_write8_m(sc, URTW_EPROM_CMD, data | URTW_EPROM_WRITEBIT); + else + urtw_write8_m(sc, URTW_EPROM_CMD, data & ~URTW_EPROM_WRITEBIT); + DELAY(URTW_EPROM_DELAY); +fail: + return (error); +} + +static usb_error_t +urtw_eprom_ck(struct urtw_softc *sc) +{ + uint8_t data; + usb_error_t error; + + /* masking */ + urtw_read8_m(sc, URTW_EPROM_CMD, &data); + urtw_write8_m(sc, URTW_EPROM_CMD, data | URTW_EPROM_CK); + DELAY(URTW_EPROM_DELAY); + /* unmasking */ + urtw_read8_m(sc, URTW_EPROM_CMD, &data); + urtw_write8_m(sc, URTW_EPROM_CMD, data & ~URTW_EPROM_CK); + DELAY(URTW_EPROM_DELAY); +fail: + return (error); +} + + +static usb_error_t +urtw_eprom_cs(struct urtw_softc *sc, int able) +{ + uint8_t data; + usb_error_t error; + + urtw_read8_m(sc, URTW_EPROM_CMD, &data); + if (able == URTW_EPROM_ENABLE) + urtw_write8_m(sc, URTW_EPROM_CMD, data | URTW_EPROM_CS); + else + urtw_write8_m(sc, URTW_EPROM_CMD, data & ~URTW_EPROM_CS); + DELAY(URTW_EPROM_DELAY); +fail: + return (error); +} + + + +static usb_error_t +urtw_read8_c(struct urtw_softc *sc, int val, uint8_t *data) +{ + struct usb_device_request req; + usb_error_t error; URTW_ASSERT_LOCKED(sc); @@ -2062,6 +2102,22 @@ urtw_read8_c(struct urtw_softc *sc, int } static usb_error_t +urtw_read8e(struct urtw_softc *sc, int val, uint8_t *data) +{ + struct usb_device_request req; + usb_error_t error; + + req.bmRequestType = UT_READ_VENDOR_DEVICE; + req.bRequest = URTW_8187_GETREGS_REQ; + USETW(req.wValue, val | 0xfe00); + USETW(req.wIndex, 0); + USETW(req.wLength, sizeof(uint8_t)); + + error = urtw_do_request(sc, &req, data); + return (error); +} + +static usb_error_t urtw_read16_c(struct urtw_softc *sc, int val, uint16_t *data) { struct usb_device_request req; @@ -2114,6 +2170,20 @@ urtw_write8_c(struct urtw_softc *sc, int } static usb_error_t +urtw_write8e(struct urtw_softc *sc, int val, uint8_t data) +{ + struct usb_device_request req; + + req.bmRequestType = UT_WRITE_VENDOR_DEVICE; + req.bRequest = URTW_8187_SETREGS_REQ; + USETW(req.wValue, val | 0xfe00); + USETW(req.wIndex, 0); + USETW(req.wLength, sizeof(uint8_t)); + + return (urtw_do_request(sc, &req, &data)); +} + +static usb_error_t urtw_write16_c(struct urtw_softc *sc, int val, uint16_t data) { struct usb_device_request req; @@ -2146,308 +2216,180 @@ urtw_write32_c(struct urtw_softc *sc, in } static usb_error_t -urtw_get_macaddr(struct urtw_softc *sc) +urtw_set_mode(struct urtw_softc *sc, uint32_t mode) { - uint32_t data; + uint8_t data; usb_error_t error; - error = urtw_eprom_read32(sc, URTW_EPROM_MACADDR, &data); - if (error != 0) - goto fail; - sc->sc_bssid[0] = data & 0xff; - sc->sc_bssid[1] = (data & 0xff00) >> 8; - error = urtw_eprom_read32(sc, URTW_EPROM_MACADDR + 1, &data); - if (error != 0) - goto fail; - sc->sc_bssid[2] = data & 0xff; - sc->sc_bssid[3] = (data & 0xff00) >> 8; - error = urtw_eprom_read32(sc, URTW_EPROM_MACADDR + 2, &data); - if (error != 0) - goto fail; - sc->sc_bssid[4] = data & 0xff; - sc->sc_bssid[5] = (data & 0xff00) >> 8; + urtw_read8_m(sc, URTW_EPROM_CMD, &data); + data = (data & ~URTW_EPROM_CMD_MASK) | (mode << URTW_EPROM_CMD_SHIFT); + data = data & ~(URTW_EPROM_CS | URTW_EPROM_CK); + urtw_write8_m(sc, URTW_EPROM_CMD, data); fail: return (error); } static usb_error_t -urtw_eprom_read32(struct urtw_softc *sc, uint32_t addr, uint32_t *data) +urtw_8180_set_anaparam(struct urtw_softc *sc, uint32_t val) { -#define URTW_READCMD_LEN 3 - int addrlen, i; - int16_t addrstr[8], data16, readcmd[] = { 1, 1, 0 }; + uint8_t data; usb_error_t error; - /* NB: make sure the buffer is initialized */ - *data = 0; - - /* enable EPROM programming */ - urtw_write8_m(sc, URTW_EPROM_CMD, URTW_EPROM_CMD_PROGRAM_MODE); - DELAY(URTW_EPROM_DELAY); - - error = urtw_eprom_cs(sc, URTW_EPROM_ENABLE); - if (error != 0) - goto fail; - error = urtw_eprom_ck(sc); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From phk at FreeBSD.org Tue Sep 8 13:19:05 2009 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue Sep 8 13:19:13 2009 Subject: svn commit: r196970 - in head/sys: cam/scsi contrib/dev/acpica/executer dev/aac dev/ae dev/amr dev/ata dev/ata/chipsets dev/ath dev/ath/ath_hal dev/bce dev/e1000 dev/ep dev/firewire dev/fxp dev/hpt... Message-ID: <200909081319.n88DJ5ne048573@svn.freebsd.org> Author: phk Date: Tue Sep 8 13:19:05 2009 New Revision: 196970 URL: http://svn.freebsd.org/changeset/base/196970 Log: Revert previous commit and add myself to the list of people who should know better than to commit with a cat in the area. Modified: head/sys/cam/scsi/scsi_cd.c head/sys/contrib/dev/acpica/executer/exfldio.c head/sys/dev/aac/aac.c head/sys/dev/ae/if_ae.c head/sys/dev/amr/amr.c head/sys/dev/ata/ata-raid.c head/sys/dev/ata/chipsets/ata-acerlabs.c head/sys/dev/ata/chipsets/ata-marvell.c head/sys/dev/ath/ah_osdep.c head/sys/dev/ath/ath_hal/ah.c head/sys/dev/ath/ath_hal/ah_eeprom_v3.c head/sys/dev/bce/if_bce.c head/sys/dev/e1000/if_em.c head/sys/dev/ep/if_ep.c head/sys/dev/ep/if_epreg.h head/sys/dev/firewire/fwcrom.c head/sys/dev/firewire/fwdev.c head/sys/dev/fxp/if_fxp.c head/sys/dev/hptiop/hptiop.c head/sys/dev/iir/iir.c head/sys/dev/mpt/mpt_raid.c head/sys/dev/msk/if_msk.c head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumreg.h head/sys/dev/usb/wlan/if_urtw.c head/sys/dev/wi/if_wi.c head/sys/fs/msdosfs/msdosfs_conv.c head/sys/kern/kern_jail.c head/sys/kern/kern_linker.c head/sys/kern/kern_lock.c head/sys/kern/kern_mutex.c head/sys/net80211/ieee80211_action.c head/sys/net80211/ieee80211_proto.h head/sys/security/audit/audit_bsm_token.c Modified: head/sys/cam/scsi/scsi_cd.c ============================================================================== --- head/sys/cam/scsi/scsi_cd.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/cam/scsi/scsi_cd.c Tue Sep 8 13:19:05 2009 (r196970) @@ -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(¶ms, M_SCSICD); cam_periph_unlock(periph); break; } Modified: head/sys/contrib/dev/acpica/executer/exfldio.c ============================================================================== --- head/sys/contrib/dev/acpica/executer/exfldio.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/contrib/dev/acpica/executer/exfldio.c Tue Sep 8 13:19:05 2009 (r196970) @@ -992,7 +992,6 @@ AcpiExInsertIntoField ( /* Get initial Datum from the input buffer */ - /* XXX: Flexelint sees arg 9 for bufferlen 8 */ ACPI_MEMCPY (&RawDatum, Buffer, ACPI_MIN(ObjDesc->CommonField.AccessByteWidth, BufferLength - BufferOffset)); Modified: head/sys/dev/aac/aac.c ============================================================================== --- head/sys/dev/aac/aac.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/aac/aac.c Tue Sep 8 13:19:05 2009 (r196970) @@ -3556,7 +3556,7 @@ aac_supported_features(struct aac_softc * associated with the feature in the data field or perform whatever * action needed indicates in the data field. */ - if (f.feat.fValue == 0) { + if (f.feat.fValue == 0) { f.feat.fBits.largeLBA = (sc->flags & AAC_FLAGS_LBA_64BIT) ? 1 : 0; /* TODO: In the future, add other features state here as well */ Modified: head/sys/dev/ae/if_ae.c ============================================================================== --- head/sys/dev/ae/if_ae.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/ae/if_ae.c Tue Sep 8 13:19:05 2009 (r196970) @@ -1662,7 +1662,6 @@ ae_stop_rxmac(ae_softc_t *sc) /* * Wait for IDLE state. */ - /* XXX: Flexelint "<" test with -- */ for (i = 0; i < AE_IDLE_TIMEOUT; i--) { val = AE_READ_4(sc, AE_IDLE_REG); if ((val & (AE_IDLE_RXMAC | AE_IDLE_DMAWRITE)) == 0) @@ -1699,7 +1698,6 @@ ae_stop_txmac(ae_softc_t *sc) /* * Wait for IDLE state. */ - /* XXX: Flexelint "<" test with -- */ for (i = 0; i < AE_IDLE_TIMEOUT; i--) { val = AE_READ_4(sc, AE_IDLE_REG); if ((val & (AE_IDLE_TXMAC | AE_IDLE_DMAREAD)) == 0) Modified: head/sys/dev/amr/amr.c ============================================================================== --- head/sys/dev/amr/amr.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/amr/amr.c Tue Sep 8 13:19:05 2009 (r196970) @@ -527,7 +527,7 @@ amr_rescan_drives(struct cdev *dev) sc->amr_drive[i].al_disk)) != 0) goto shutdown_out; - sc->amr_drive[i].al_disk = 0; + sc->amr_drive[i].al_disk = 0; } } Modified: head/sys/dev/ata/ata-raid.c ============================================================================== --- head/sys/dev/ata/ata-raid.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/ata/ata-raid.c Tue Sep 8 13:19:05 2009 (r196970) @@ -407,7 +407,7 @@ ata_raid_strategy(struct bio *bp) if (rdp->status & AR_S_REBUILDING) blk = ((lba / rdp->interleave) * rdp->width) * rdp->interleave + (rdp->interleave * (drv % rdp->width)) + - lba % rdp->interleave; + lba % rdp->interleave;; if (bp->bio_cmd == BIO_READ) { int src_online = @@ -1138,7 +1138,6 @@ ata_raid_create(struct ata_ioc_raid_conf rdp->type == AR_T_RAID5) { int bit = 0; - /* XXX: Flexelint not happy */ while (config->interleave >>= 1) bit++; rdp->interleave = 1 << bit; Modified: head/sys/dev/ata/chipsets/ata-acerlabs.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-acerlabs.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/ata/chipsets/ata-acerlabs.c Tue Sep 8 13:19:05 2009 (r196970) @@ -127,7 +127,6 @@ ata_ali_chipinit(device_t dev) RF_ACTIVE); if (res->bars[i] == NULL) { device_printf(dev, "Failed to allocate BAR %d\n", i); - /* XXX: Flexelint: Reuse of for loop variable 'i' at 'line 124' could cause chaos */ for (i--; i >=0; i--) bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(i), res->bars[i]); Modified: head/sys/dev/ata/chipsets/ata-marvell.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-marvell.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/ata/chipsets/ata-marvell.c Tue Sep 8 13:19:05 2009 (r196970) @@ -153,7 +153,7 @@ ata_marvell_pata_ch_attach(device_t dev) return ENXIO; /* dont use 32 bit PIO transfers */ - ch->flags |= ATA_USE_16BIT; + ch->flags |= ATA_USE_16BIT; return 0; } Modified: head/sys/dev/ath/ah_osdep.c ============================================================================== --- head/sys/dev/ath/ah_osdep.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/ath/ah_osdep.c Tue Sep 8 13:19:05 2009 (r196970) @@ -107,7 +107,6 @@ ath_hal_malloc(size_t size) return malloc(size, M_ATH_HAL, M_NOWAIT | M_ZERO); } -/* XXX: FlexeLint return in void function ? */ void ath_hal_free(void* p) { Modified: head/sys/dev/ath/ath_hal/ah.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/ath/ath_hal/ah.c Tue Sep 8 13:19:05 2009 (r196970) @@ -566,7 +566,6 @@ ath_hal_getregdump(struct ath_hal *ah, c uint32_t *dp = dstbuf; int i; - /* XXX: FlexeLint: ">" test with ++ */ for (i = 0; space >= 2*sizeof(uint32_t); i++) { u_int r = regs[i].start; u_int e = regs[i].end; Modified: head/sys/dev/ath/ath_hal/ah_eeprom_v3.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah_eeprom_v3.c Tue Sep 8 13:16:55 2009 (r196969) +++ head/sys/dev/ath/ath_hal/ah_eeprom_v3.c Tue Sep 8 13:19:05 2009 (r196970) @@ -1753