Re: svn commit: r230628 - head/sys/sparc64/include
On Sat, Jan 28, 2012 at 10:37:40PM -0800, Doug Barton wrote: On 01/28/2012 18:39, Julian Elischer wrote: Bruce these comments are valid. please make use of your commit bit and make the appropriate changes! Completely aside from the pedantic value of having the person who broke it be the one to fix it; this line of reasoning is only going DIScourage people from pointing out problems. Are you sure that's what you want? I believe we all want all the bright points of BdeBSD to be merged into our tree, no? At some point I was collecting Bruce's insights for future analysis and hope to work out patches, but quickly realized I do not have required technical background to be qualified for this work. Which brings me to the same conclusion as Julian: people should make you of their commit bits and make appropriate changes themslves! :-) ./danfe ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r230768 - head/sys/dev/sound/pci/hda
Author: mav Date: Mon Jan 30 09:59:33 2012 New Revision: 230768 URL: http://svn.freebsd.org/changeset/base/230768 Log: Fix typo in comments. Modified: head/sys/dev/sound/pci/hda/hdac.h Modified: head/sys/dev/sound/pci/hda/hdac.h == --- head/sys/dev/sound/pci/hda/hdac.h Mon Jan 30 07:56:00 2012 (r230767) +++ head/sys/dev/sound/pci/hda/hdac.h Mon Jan 30 09:59:33 2012 (r230768) @@ -320,7 +320,7 @@ #define HDA_CODEC_ALC899 HDA_CODEC_CONSTRUCT(REALTEK, 0x0899) #define HDA_CODEC_ALC HDA_CODEC_CONSTRUCT(REALTEK, 0x) -/* Motorolla */ +/* Motorola */ #define MOTO_VENDORID 0x1057 #define HDA_CODEC_MOTO HDA_CODEC_CONSTRUCT(MOTO, 0x) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r230230 - head/sys/dev/random
Andrey Chernov writes: On Thu, Jan 26, 2012 at 10:13:41PM +0400, Andrey Chernov wrote: On Thu, Jan 26, 2012 at 12:52:43PM -0500, David Schultz wrote: Why complicate things with atomics at all? A race might result in arc4random(9) being seeded multiple times, but that's harmless. Multiply seeding in line is harmless, just waste of time and resources. Other case is one missing seeding when variable is set concurrently with its read. I see no complication using atomic. Latest version is even shorter than previous ones. Well, I almost forget about my special case: I have personal prohibition from @secteam (5 years old already) to commit anything to all RNG areas. So, the question is: could anyone of you commit some version from this thread, please? Sure; I'll do it. Please give me your test code/cases. I don't insist of atomics in this sutuation, so you can peek any version you like. I'll need to clearly see what works. M -- Mark R V Murray Cert APS(Open) Dip Phys(Open) BSc Open(Open) BSc(Hons)(Open) Pi: 132511160 ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r230230 - head/sys/dev/random
On Mon, Jan 30, 2012 at 11:30:15AM +, Mark Murray wrote: Well, I almost forget about my special case: I have personal prohibition from @secteam (5 years old already) to commit anything to all RNG areas. So, the question is: could anyone of you commit some version from this thread, please? Sure; I'll do it. Please give me your test code/cases. I don't insist of atomics in this sutuation, so you can peek any version you like. I'll need to clearly see what works. Both works:) Version with atomic cmpsets works 100% correct, but it seems people dislike it just for using atomics. Version without atomics works slightly incorrectly in edge cases, but no harm happens. Worst possible scenario for version without atomics: 1) Several arc4random() fired at once (i.e. concurrently) exact in the moment when random_yarrow_unblock() modifies this variable. 2) Such of them who catch the variable after modification and see that reseed is needed simultaneously put themselves into reseeding chain, because arc4_randomstir() is protected with mutex. There is no harm can be done to this PRNG by reseeding it many times sequentially, just waste of CPU time. 3) Such of them who miss the modification skips this step, and PRNG will be reseded when any other arc4random() call happens afterwards. The rest of arc4rand() function code is protected by mutex too, so it will stay sequentially-aligned in any case. -- http://ache.vniz.net/ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r230774 - head/sys/dev/pci
Author: jhb Date: Mon Jan 30 15:09:03 2012 New Revision: 230774 URL: http://svn.freebsd.org/changeset/base/230774 Log: Add a constant for the PCI-e surprise link down uncorrectable error. Modified: head/sys/dev/pci/pcireg.h Modified: head/sys/dev/pci/pcireg.h == --- head/sys/dev/pci/pcireg.h Mon Jan 30 12:32:22 2012(r230773) +++ head/sys/dev/pci/pcireg.h Mon Jan 30 15:09:03 2012(r230774) @@ -697,6 +697,7 @@ #definePCIR_AER_UC_STATUS 0x04 #definePCIM_AER_UC_TRAINING_ERROR 0x0001 #definePCIM_AER_UC_DL_PROTOCOL_ERROR 0x0010 +#definePCIM_AER_UC_SUPRISE_LINK_DOWN 0x0020 #definePCIM_AER_UC_POISONED_TLP0x1000 #definePCIM_AER_UC_FC_PROTOCOL_ERROR 0x2000 #definePCIM_AER_UC_COMPLETION_TIMEOUT 0x4000 ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r230775 - in head/sys: conf dev/ixgbe modules/ixgbe
Author: jfv Date: Mon Jan 30 16:42:02 2012 New Revision: 230775 URL: http://svn.freebsd.org/changeset/base/230775 Log: New hardware support: Intel X540 adapter support added. Some shared code reorganization along with the new adapter. Sync changes to OACTIVE in igb into this driver. Misc small fixes. Added: head/sys/dev/ixgbe/ixgbe_82598.h (contents, props changed) head/sys/dev/ixgbe/ixgbe_82599.h (contents, props changed) head/sys/dev/ixgbe/ixgbe_x540.c (contents, props changed) head/sys/dev/ixgbe/ixgbe_x540.h (contents, props changed) Modified: head/sys/conf/files head/sys/dev/ixgbe/ixgbe.c head/sys/dev/ixgbe/ixgbe.h head/sys/dev/ixgbe/ixgbe_82598.c head/sys/dev/ixgbe/ixgbe_82599.c head/sys/dev/ixgbe/ixgbe_api.c head/sys/dev/ixgbe/ixgbe_api.h head/sys/dev/ixgbe/ixgbe_common.c head/sys/dev/ixgbe/ixgbe_common.h head/sys/dev/ixgbe/ixgbe_mbx.c head/sys/dev/ixgbe/ixgbe_mbx.h head/sys/dev/ixgbe/ixgbe_osdep.h head/sys/dev/ixgbe/ixgbe_phy.c head/sys/dev/ixgbe/ixgbe_phy.h head/sys/dev/ixgbe/ixgbe_type.h head/sys/dev/ixgbe/ixgbe_vf.c head/sys/dev/ixgbe/ixgbe_vf.h head/sys/dev/ixgbe/ixv.c head/sys/dev/ixgbe/ixv.h head/sys/modules/ixgbe/Makefile Modified: head/sys/conf/files == --- head/sys/conf/files Mon Jan 30 15:09:03 2012(r230774) +++ head/sys/conf/files Mon Jan 30 16:42:02 2012(r230775) @@ -1395,6 +1395,8 @@ dev/ixgbe/ixgbe_82598.c optional ixgbe compile-with ${NORMAL_C} -I$S/dev/ixgbe dev/ixgbe/ixgbe_82599.coptional ixgbe inet \ compile-with ${NORMAL_C} -I$S/dev/ixgbe +dev/ixgbe/ixgbe_x540.c optional ixgbe inet \ + compile-with ${NORMAL_C} -I$S/dev/ixgbe dev/jme/if_jme.c optional jme pci dev/joy/joy.c optional joy dev/joy/joy_isa.c optional joy isa Modified: head/sys/dev/ixgbe/ixgbe.c == --- head/sys/dev/ixgbe/ixgbe.c Mon Jan 30 15:09:03 2012(r230774) +++ head/sys/dev/ixgbe/ixgbe.c Mon Jan 30 16:42:02 2012(r230775) @@ -1,6 +1,6 @@ /** - Copyright (c) 2001-2011, Intel Corporation + Copyright (c) 2001-2012, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -47,7 +47,7 @@ int ixgbe_display_debug_stat /* * Driver version */ -char ixgbe_driver_version[] = 2.3.11; +char ixgbe_driver_version[] = 2.4.5; /* * PCI Device ID Table @@ -81,6 +81,8 @@ static ixgbe_vendor_info_t ixgbe_vendor_ {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_COMBO_BACKPLANE, 0, 0, 0}, {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_BACKPLANE_FCOE, 0, 0, 0}, {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP_FCOE, 0, 0, 0}, + {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599EN_SFP, 0, 0, 0}, + {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_X540T, 0, 0, 0}, /* required last entry */ {0, 0, 0, 0, 0} }; @@ -153,6 +155,7 @@ static void ixgbe_refresh_mbufs(struct r static int ixgbe_xmit(struct tx_ring *, struct mbuf **); static int ixgbe_set_flowcntl(SYSCTL_HANDLER_ARGS); static int ixgbe_set_advertise(SYSCTL_HANDLER_ARGS); +static int ixgbe_set_thermal_test(SYSCTL_HANDLER_ARGS); static int ixgbe_dma_malloc(struct adapter *, bus_size_t, struct ixgbe_dma_alloc *, int); static void ixgbe_dma_free(struct adapter *, struct ixgbe_dma_alloc *); @@ -415,19 +418,29 @@ ixgbe_attach(device_t dev) SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, flow_control, CTLTYPE_INT | CTLFLAG_RW, + OID_AUTO, fc, CTLTYPE_INT | CTLFLAG_RW, adapter, 0, ixgbe_set_flowcntl, I, Flow Control); - SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, advertise_gig, CTLTYPE_INT | CTLFLAG_RW, - adapter, 0, ixgbe_set_advertise, I, 1G Link); - SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, enable_aim, CTLTYPE_INT|CTLFLAG_RW, ixgbe_enable_aim, 1, Interrupt Moderation); + /* + ** Allow a kind of speed control by forcing the autoneg + ** advertised speed list to only a certain value, this + ** supports 1G on 82599 devices, and 100Mb on x540. + */ +
svn commit: r230777 - head/sys/amd64/acpica
Author: jkim Date: Mon Jan 30 18:28:56 2012 New Revision: 230777 URL: http://svn.freebsd.org/changeset/base/230777 Log: Naturally align a newly added wakeup_fpusave. Modified: head/sys/amd64/acpica/acpi_wakecode.S Modified: head/sys/amd64/acpica/acpi_wakecode.S == --- head/sys/amd64/acpica/acpi_wakecode.S Mon Jan 30 17:17:31 2012 (r230776) +++ head/sys/amd64/acpica/acpi_wakecode.S Mon Jan 30 18:28:56 2012 (r230777) @@ -267,11 +267,11 @@ wakeup_ctx: .quad 0 wakeup_pcb: .quad 0 +wakeup_fpusave: + .quad 0 wakeup_gdt: .word 0 .quad 0 -wakeup_fpusave: - .quad 0 ALIGN_DATA wakeup_efer: ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r193833 - in head: share/man/man9 sys/kern sys/sys
On Sunday, January 29, 2012 10:41:24 am Marius Strobl wrote: On Tue, Jun 09, 2009 at 02:26:23PM +, John Baldwin wrote: Author: jhb Date: Tue Jun 9 14:26:23 2009 New Revision: 193833 URL: http://svn.freebsd.org/changeset/base/193833 Log: Add support for multiple passes of the device tree during the boot-time probe. The current device order is unchanged. This commit just adds the infrastructure and ABI changes so that it is easier to merge later changes into 8.x. - Driver attachments now have an associated pass level. Attachments are not allowed to probe or attach to drivers until the system-wide pass level is = the attachment's pass level. By default driver attachments use the last pass level (BUS_PASS_DEFAULT). Driver's that wish to probe during an earlier pass use EARLY_DRIVER_MODULE() instead of DRIVER_MODULE() which accepts the pass level as an additional parameter. - A new method BUS_NEW_PASS has been added to the bus interface. This method is invoked when the system-wide pass level is changed to kick off a rescan of the device tree so that drivers that have just been made eligible can probe and attach. - The bus_generic_new_pass() function provides a default implementation of BUS_NEW_PASS(). It first allows drivers that were just made eligible for this pass to identify new child devices. Then it propogates the rescan to child devices that already have an attached driver by invoking their BUS_NEW_PASS() method. It also reprobes devices without a driver. - BUS_PROBE_NOMATCH() is only invoked for devices that do not have an attached driver after being scanned during the final pass. - The bus_set_pass() function is used during boot to raise the pass level. Currently it is only called once during root_bus_configure() to raise the pass level to BUS_PASS_DEFAULT. This has the effect of probing all devices in a single pass identical to previous behavior. Reviewed by: imp Approved by: re (kib) What would be necessary to finally enable support for multi-pass probing apart from the drivers also needing to set BUS_PASS_n if they want to take part earlier than BUS_PASS_DEFAULT)? My understanding is that this is should be as simple as changing root_bus_configure() to return BUS_PASS_ROOT instead of BUS_PASS_DEFAULT but the comment above that line actually talks about splitting the return value (?) up somehow ... It will already work now without needing any changes. I have some older patches to make x86 probe ACPI and PCI busses and bridges early and they required no changes to the root bus. The reason for the comment is that I eventually imagine the multiple passes being split up so that we can do other actions after various passes are complete. For example, we might rewrite root_bus_configure() so that it looks something like: void root_bus_configure(void) { /* Enumerate the device tree and reserve static resources. */ bus_set_pass(BUS_PASS_RESOURCE); /* * Now scan devices to allocate dynamic resources, possibly * rewriting BARs, etc. */ /* some code that doesn't exist yet */ /* Now probe interrupt controllers. */ bus_set_pass(BUS_PASS_INTERRUPT); /* Now kick off interrupt routing via some new bus method. */ /* not written yet */ /* Finish probing everything else. */ bus_set_pass(BUS_PASS_DEFAULT); } This works because bus_set_pass() will do multiple scans of the tree, one per configured pass level, to raise the system's pass level up to the requested level. -- John Baldwin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r227753 - in head: contrib/gdtoa include lib/libc/gdtoa lib/libc/gen lib/libc/locale lib/libc/regex lib/libc/stdio lib/libc/stdlib lib/libc/stdtime lib/libc/string
On 18 Jan 2012, at 19:07, David Schultz wrote: This patch appears to cause a large performance regression. For example, I measured a 78% slowdown for strtol(42, ...). That's definitely worth taking a closer look at. I think we can cache some things in TLS and avoid some pthread_getspecific calls. The current code is the 'make it work' version. The 'make it fast' version is planned... Furthermore, the resulting static binary for a trivial program goes from 7k to 303k, due to pulling in malloc, stdio, and all the pthread stubs. That's not ideal, but I'm not sure if it's avoidable. Is statically linking libc something people regularly do? Presumably the capabilities of the non-xlocale entry points aren't appreciably changed, Well... actually they are. All of them now use the per-thread locale if one is set, and only fall back to the global one if it isn't. The behaviour is only unchanged if nothing in the program calls uselocale(). so there ought to be a way to avoid the overhead for them. Do you have any thoughts on this? Yup. A quick-and-dirty hack would be to add a flag that was set on the first call to uselocale() and to always use the global locale if this is not set. That should remove a lot of the overhead in cases where no one uses the per-thread locales. We can also probably store the locale in TLS, which (on platforms with fast TLS) should speed up the lookup a bit. Some more minor issues... It's also customary to document public APIs so that, for instance, `man printf_l' pulls up a page with the prototype, required #includes, and behavior. Aliasing manpages with MLINKS as appropriate is fine; for instance, Darwin's manpages on these functions look like a good example to follow. Yup, all of the foo_l manpages are missing. They're on my TODO, unless any docs people want to get there first... Finally, I'm not usually one to be picky about style, but could you make a pass to clean things up a little bit to match the surrounding code, wrap multiline comments to 80 columns, etc? You've also added new copyright notices for one-line changes (e.g., stdio/vdprintf.c, gdtoa/machdep_ldis?.c) and multiple copyright notices in the same file (locale/collate.c), which could be cleaned up concurrently. I'll take a look. David___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r230583 - head/sys/kern
On Mon, Jan 30, 2012, Kostik Belousov wrote: On Sun, Jan 29, 2012 at 05:39:04PM -0500, David Schultz wrote: On Sun, Jan 29, 2012, Kostik Belousov wrote: On Sat, Jan 28, 2012 at 07:12:25PM -0500, David Schultz wrote: On Sat, Jan 28, 2012, Kostik Belousov wrote: On Fri, Jan 27, 2012 at 02:42:21PM -0500, David Schultz wrote: The correct limit on the maximum size of a single read/write is SSIZE_MAX, but FreeBSD uses INT_MAX. It's not safe to raise the limit yet, though, because of bugs in several filesystems. For example, FFS copies uio_resid into a local variable of type int. I have some old patches that fix some of these issues for FFS and cd9660, but surely there are more places I didn't notice. Absolutely agree. http://people.freebsd.org/~kib/misc/uio_resid.5.patch Nice. You found a lot more than I've got in my tree, and you even fixed the return values. There are at least a few more places to fix. For instance, cd9660 and the NFS client pass uio_resid or iov_len to min(), which operates on ints. (Incidentally, C11 generics ought to make it possible to write type-generic min() and max() functions.) Thank you, http://people.freebsd.org/~kib/misc/uio_resid.6.patch changed them to MIN(). This looks good to me. I tried to think of other places that you might have missed, and the only one that occurred to me is the Might ? I think this is a blatant understate. pipe code. sys_pipe.c has an `int orig_resid' and lots of bogus casts of iov_len and uio_resid to type u_int. Some look harmless, although it appears that writing a multiple of 2^32 bytes might result in pipe_build_write_buffer() allocating a 0-length buffer. My only reservation is that raising the limit could unmask a kernel buffer overflow if we missed something, but I guess we have to cross that bridge some day anyway. Yes, and it is an obvious reason why I am chicken to commit this for so long time. One more place, if this is reasonable to count as 'one' place, are the cdevsw methods. devfs passes uio down to the drivers. That's why I'm glad I'm not committing it. :) A more conservative change (also known as kicking the can down the road) would be to add a VFS flag, e.g., VFCF_LONGIO, and only set it on file systems that have been thoroughly reviewed. The VFS layer could cap the size at INT_MAX for file systems without the flag. diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 9edcb74..332ec37 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c [...] @@ -757,14 +757,14 @@ pipe_build_write_buffer(wpipe, uio) struct pipe *wpipe; struct uio *uio; { - u_int size; + size_t size; int i; PIPE_LOCK_ASSERT(wpipe, MA_NOTOWNED); KASSERT(wpipe-pipe_state PIPE_DIRECTW, (Clone attempt on non-direct write pipe!)); - size = (u_int) uio-uio_iov-iov_len; + size = uio-uio_iov-iov_len; if (size wpipe-pipe_buffer.size) size = wpipe-pipe_buffer.size; The transfer can't be bigger than the max pipe buffer size (64k), so `size = (int)MIN(uio-uio_iov-iov_len, wpipe-pipe_buffer.size)' should suffice. The same comment applies elsewhere in the file. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r230778 - head/sys/kern
Author: ambrisko Date: Mon Jan 30 19:19:22 2012 New Revision: 230778 URL: http://svn.freebsd.org/changeset/base/230778 Log: When detaching an AIO or LIO requests grab the lock and tell knlist_remove that we have the lock now. This cleans up a locking panic ASSERT when knlist_empty is called without a lock when INVARIANTS etc. are turned. Reviewed by: kib jhb MFC after:1 week Modified: head/sys/kern/vfs_aio.c Modified: head/sys/kern/vfs_aio.c == --- head/sys/kern/vfs_aio.c Mon Jan 30 18:28:56 2012(r230777) +++ head/sys/kern/vfs_aio.c Mon Jan 30 19:19:22 2012(r230778) @@ -2535,10 +2535,13 @@ filt_aioattach(struct knote *kn) static void filt_aiodetach(struct knote *kn) { - struct aiocblist *aiocbe = kn-kn_ptr.p_aio; + struct knlist *knl; - if (!knlist_empty(aiocbe-klist)) - knlist_remove(aiocbe-klist, kn, 0); + knl = kn-kn_ptr.p_aio-klist; + knl-kl_lock(knl-kl_lockarg); + if (!knlist_empty(knl)) + knlist_remove(knl, kn, 1); + knl-kl_unlock(knl-kl_lockarg); } /* kqueue filter function */ @@ -2580,10 +2583,13 @@ filt_lioattach(struct knote *kn) static void filt_liodetach(struct knote *kn) { - struct aioliojob * lj = kn-kn_ptr.p_lio; + struct knlist *knl; - if (!knlist_empty(lj-klist)) - knlist_remove(lj-klist, kn, 0); + knl = kn-kn_ptr.p_lio-klist; + knl-kl_lock(knl-kl_lockarg); + if (!knlist_empty(knl)) + knlist_remove(knl, kn, 1); + knl-kl_unlock(knl-kl_lockarg); } /* kqueue filter function */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r230779 - head/sys/powerpc/aim
Author: kib Date: Mon Jan 30 19:31:17 2012 New Revision: 230779 URL: http://svn.freebsd.org/changeset/base/230779 Log: Fix build for the case of powerpc64 kernel without COMPAT_FREEBSD32. MFC after:2 months Modified: head/sys/powerpc/aim/mmu_oea64.c Modified: head/sys/powerpc/aim/mmu_oea64.c == --- head/sys/powerpc/aim/mmu_oea64.cMon Jan 30 19:19:22 2012 (r230778) +++ head/sys/powerpc/aim/mmu_oea64.cMon Jan 30 19:31:17 2012 (r230779) @@ -114,6 +114,7 @@ __FBSDID($FreeBSD$); * correct. */ +#include opt_compat.h #include opt_kstack_pages.h #include sys/param.h @@ -1466,7 +1467,9 @@ moea64_init(mmu_t mmu) uma_zone_set_allocf(moea64_mpvo_zone,moea64_uma_page_alloc); } +#ifdef COMPAT_FREEBSD32 elf32_nxstack = 1; +#endif moea64_initialized = TRUE; } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r230782 - head/sys/kern
Author: jhb Date: Mon Jan 30 19:35:15 2012 New Revision: 230782 URL: http://svn.freebsd.org/changeset/base/230782 Log: Refine the implementation of POSIX_FADV_NOREUSE for the read(2) case such that instead of using direct I/O it allows read-ahead similar to POSIX_FADV_NORMAL, but invokes VOP_ADVISE(POSIX_FADV_DONTNEED) after the read(2) has completed to purge just-read data. The write(2) path continues to use direct I/O for POSIX_FADV_NOREUSE for now. Note that NOREUSE works optimally if an application reads and writes full fs blocks. Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c == --- head/sys/kern/vfs_vnops.c Mon Jan 30 19:34:41 2012(r230781) +++ head/sys/kern/vfs_vnops.c Mon Jan 30 19:35:15 2012(r230782) @@ -519,6 +519,7 @@ vn_read(fp, uio, active_cred, flags, td) int error, ioflag; struct mtx *mtxp; int advice, vfslocked; + off_t offset; KASSERT(uio-uio_td == td, (uio_td %p is not td %p, uio-uio_td, td)); @@ -558,19 +559,14 @@ vn_read(fp, uio, active_cred, flags, td) switch (advice) { case POSIX_FADV_NORMAL: case POSIX_FADV_SEQUENTIAL: + case POSIX_FADV_NOREUSE: ioflag |= sequential_heuristic(uio, fp); break; case POSIX_FADV_RANDOM: /* Disable read-ahead for random I/O. */ break; - case POSIX_FADV_NOREUSE: - /* -* Request the underlying FS to discard the buffers -* and pages after the I/O is complete. -*/ - ioflag |= IO_DIRECT; - break; } + offset = uio-uio_offset; #ifdef MAC error = mac_vnode_check_read(active_cred, fp-f_cred, vp); @@ -587,6 +583,10 @@ vn_read(fp, uio, active_cred, flags, td) } fp-f_nextoff = uio-uio_offset; VOP_UNLOCK(vp, 0); + if (error == 0 advice == POSIX_FADV_NOREUSE + offset != uio-uio_offset) + error = VOP_ADVISE(vp, offset, uio-uio_offset - 1, + POSIX_FADV_DONTNEED); VFS_UNLOCK_GIANT(vfslocked); return (error); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r230622 - head
On 2012-01-27, at 19:29, Dimitry Andric wrote: Author: dim Date: Fri Jan 27 18:29:03 2012 New Revision: 230622 URL: http://svn.freebsd.org/changeset/base/230622 Log: When the buildkernel stage 2.3 (build tools) runs, the PATH is still set to the default from the top-level Makefile. Therefore, invocations of lex and yacc (used during building of aicasm) will use the executables in /usr/bin, not those optionally built during the previous buildworld or kernel-toolchain. This makes kernel builds from older FreeBSD releases more difficult than necessary. Fix this by setting PATH to ${BPATH}:${PATH} in stage 2.3, so the bootstrap tools directories are searched before the regular ones. Is this supposed to work for cross building as well? I'm still encountering problems on a 7.3 host build: 1. Cross world builds fine make -j 8 buildworld TARGET_ARCH=arm 2. Kernel fails w/ the aicasm make buildkernel TARGET_ARCH=arm KERNCONF=SHEEVAPLUG [...] cc -O2 -pipe -nostdinc -I/usr/include -I. -I/home/raj/work/svn/base/head/sys/dev/aic7xxx/aicasm -std=gnu99 -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wno-pointer-sign -c aicasm_scan.c cc1: warnings being treated as errors /home/raj/work/svn/base/head/sys/dev/aic7xxx/aicasm/aicasm_scan.l:837: warning: function declaration isn't a prototype *** Error code 1 Stop in /home/raj/work/obj/arm.arm/home/raj/work/svn/base/head/sys/SHEEVAPLUG. *** Error code 1 Stop in /home/raj/work/svn/base/head. *** Error code 1 Stop in /home/raj/work/svn/base/head. Do you know any workarounds to this? Rafal ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r230783 - head/sys/sys
Author: kib Date: Mon Jan 30 19:50:13 2012 New Revision: 230783 URL: http://svn.freebsd.org/changeset/base/230783 Log: Add definition for PT_GNU_RELRO. MFC after:3 days Modified: head/sys/sys/elf_common.h Modified: head/sys/sys/elf_common.h == --- head/sys/sys/elf_common.h Mon Jan 30 19:35:15 2012(r230782) +++ head/sys/sys/elf_common.h Mon Jan 30 19:50:13 2012(r230783) @@ -328,6 +328,7 @@ typedef struct { #definePT_SUNW_UNWIND 0x6464e550 /* amd64 UNWIND program header */ #definePT_GNU_EH_FRAME 0x6474e550 #definePT_GNU_STACK0x6474e551 +#definePT_GNU_RELRO0x6474e552 #definePT_LOSUNW 0x6ffa #definePT_SUNWBSS 0x6ffa /* Sun Specific segment */ #definePT_SUNWSTACK0x6ffb /* describes the stack segment */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r230784 - head/libexec/rtld-elf
Author: kib Date: Mon Jan 30 19:52:17 2012 New Revision: 230784 URL: http://svn.freebsd.org/changeset/base/230784 Log: Add support for GNU RELRO. Submitted by: John Marino draco marino st MFC after:2 weeks Modified: head/libexec/rtld-elf/map_object.c head/libexec/rtld-elf/rtld.c head/libexec/rtld-elf/rtld.h Modified: head/libexec/rtld-elf/map_object.c == --- head/libexec/rtld-elf/map_object.c Mon Jan 30 19:50:13 2012 (r230783) +++ head/libexec/rtld-elf/map_object.c Mon Jan 30 19:52:17 2012 (r230784) @@ -84,6 +84,8 @@ map_object(int fd, const char *path, con Elf_Addr bss_vlimit; caddr_t bss_addr; Elf_Word stack_flags; +Elf_Addr relro_page; +size_t relro_size; hdr = get_elf_header(fd, path); if (hdr == NULL) @@ -100,6 +102,8 @@ map_object(int fd, const char *path, con nsegs = -1; phdyn = phinterp = phtls = NULL; phdr_vaddr = 0; +relro_page = 0; +relro_size = 0; segs = alloca(sizeof(segs[0]) * hdr-e_phnum); stack_flags = RTLD_DEFAULT_STACK_PF_EXEC | PF_R | PF_W; while (phdr phlimit) { @@ -134,6 +138,11 @@ map_object(int fd, const char *path, con case PT_GNU_STACK: stack_flags = phdr-p_flags; break; + + case PT_GNU_RELRO: + relro_page = phdr-p_vaddr; + relro_size = phdr-p_memsz; + break; } ++phdr; @@ -269,6 +278,9 @@ map_object(int fd, const char *path, con obj-tlsinit = mapbase + phtls-p_vaddr; } obj-stack_flags = stack_flags; +obj-relro_page = obj-relocbase + trunc_page(relro_page); +obj-relro_size = round_page(relro_size); + return obj; } Modified: head/libexec/rtld-elf/rtld.c == --- head/libexec/rtld-elf/rtld.cMon Jan 30 19:50:13 2012 (r230783) +++ head/libexec/rtld-elf/rtld.cMon Jan 30 19:52:17 2012 (r230784) @@ -1114,6 +1114,11 @@ digest_phdr(const Elf_Phdr *phdr, int ph case PT_GNU_STACK: obj-stack_flags = ph-p_flags; break; + + case PT_GNU_RELRO: + obj-relro_page = obj-relocbase + trunc_page(ph-p_vaddr); + obj-relro_size = round_page(ph-p_memsz); + break; } } if (nsegs 1) { @@ -2007,6 +2012,14 @@ relocate_objects(Obj_Entry *first, bool if (reloc_jmpslots(obj, lockstate) == -1) return -1; + if (obj-relro_size 0) { + if (mprotect(obj-relro_page, obj-relro_size, PROT_READ) == -1) { + _rtld_error(%s: Cannot enforce relro protection: %s, + obj-path, strerror(errno)); + return -1; + } + } + /* * Set up the magic number and version in the Obj_Entry. These * were checked in the crt1.o from the original ElfKit, so we Modified: head/libexec/rtld-elf/rtld.h == --- head/libexec/rtld-elf/rtld.hMon Jan 30 19:50:13 2012 (r230783) +++ head/libexec/rtld-elf/rtld.hMon Jan 30 19:52:17 2012 (r230784) @@ -168,6 +168,9 @@ typedef struct Struct_Obj_Entry { size_t tlsoffset; /* Offset of static TLS block for this module */ size_t tlsalign; /* Alignment of static TLS block */ +caddr_t relro_page; +size_t relro_size; + /* Items from the dynamic section. */ Elf_Addr *pltgot; /* PLT or GOT, depending on architecture */ const Elf_Rel *rel;/* Relocation entries */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r230785 - head/sys/kern
Author: kib Date: Mon Jan 30 20:00:29 2012 New Revision: 230785 URL: http://svn.freebsd.org/changeset/base/230785 Log: A debugger which requested PT_FOLLOW_FORK should get the notification about new child not only when doing PT_TO_SCX, but also for PT_CONTINUE. If TDB_FORK flag is set, always issue a stop, the same as is done for TDB_EXEC. Reported by: Dmitry Mikulin dmitrym juniper net MFC after:1 week Modified: head/sys/kern/subr_syscall.c Modified: head/sys/kern/subr_syscall.c == --- head/sys/kern/subr_syscall.cMon Jan 30 19:52:17 2012 (r230784) +++ head/sys/kern/subr_syscall.cMon Jan 30 20:00:29 2012 (r230785) @@ -212,7 +212,8 @@ syscallret(struct thread *td, int error, * executes. If debugger requested tracing of syscall * returns, do it now too. */ - if (traced ((td-td_dbgflags TDB_EXEC) != 0 || + if (traced + ((td-td_dbgflags (TDB_FORK | TDB_EXEC)) != 0 || (p-p_stops S_PT_SCX) != 0)) ptracestop(td, SIGTRAP); td-td_dbgflags = ~(TDB_SCX | TDB_EXEC | TDB_FORK); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r230622 - head
On 2012-01-30 20:27, Rafal Jaworowski wrote: ... Fix this by setting PATH to ${BPATH}:${PATH} in stage 2.3, so the bootstrap tools directories are searched before the regular ones. Is this supposed to work for cross building as well? I'm still encountering problems on a 7.3 host build: 1. Cross world builds fine make -j 8 buildworld TARGET_ARCH=arm 2. Kernel fails w/ the aicasm make buildkernel TARGET_ARCH=arm KERNCONF=SHEEVAPLUG [...] cc -O2 -pipe -nostdinc -I/usr/include -I. -I/home/raj/work/svn/base/head/sys/dev/aic7xxx/aicasm -std=gnu99 -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wno-pointer-sign -c aicasm_scan.c cc1: warnings being treated as errors /home/raj/work/svn/base/head/sys/dev/aic7xxx/aicasm/aicasm_scan.l:837: warning: function declaration isn't a prototype Can you please try doing make buildenv TARGET_ARCH=arm, then run which lex and which yacc? ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r230782 - head/sys/kern
On Monday, January 30, 2012 2:35:16 pm John Baldwin wrote: Author: jhb Date: Mon Jan 30 19:35:15 2012 New Revision: 230782 URL: http://svn.freebsd.org/changeset/base/230782 Log: Refine the implementation of POSIX_FADV_NOREUSE for the read(2) case such that instead of using direct I/O it allows read-ahead similar to POSIX_FADV_NORMAL, but invokes VOP_ADVISE(POSIX_FADV_DONTNEED) after the read(2) has completed to purge just-read data. The write(2) path continues to use direct I/O for POSIX_FADV_NOREUSE for now. Note that NOREUSE works optimally if an application reads and writes full fs blocks. Oops, forgot: Tested by: jilles The NOREUSE bits may still need further refinement. For example, if we allow something along the lines of 'POSIX_FADV_NOREUSE | POSIX_FADV_SEQUENTIAL', then we could change the VOP_ADVISE() here to use 0 as the starting offset which should do a better job of not leaving data in RAM due to reading partial blocks. Also, sequentially reading a file on unaligned block offsets with NOREUSE can result in extraneous reads currently, and we could possibly alleviate those by changing DONTNEED to only flush wholly contained-blocks rather than wholly-contained pages from the backing VM object. However, without the previous change I suggested that will exacerbate the problem of NOREUSE not actually purging any data from RAM. The problem with the | approach though is that it is not portable, so it is not likely that portable programs like vlc will use it. HP/UX had an extended variant of fadvise() that allowed multiple policies to be set on a range, apparently to handle exactly this case (sequential and noreuse). The problem seems to be that noreuse is really orthogonal to the other access-pattern hints (normal vs random vs sequential). Finally, I've wondered if POSIX_FADV_SEQUENTIAL shouldn't just mandate the maximum read-ahead and write-clustering rather than using the heuristics. It's not completely clear if we did that what the right thing to do if an application does posix_fadvise(POSIX_FADV_SEQUENTIAL) followed by fcntl(F_READAHEAD) with a different size, esp. given that posix_fadvise() can theoretically only apply to a range of the file descriptor whereas F_READAHEAD applies globally to the file descriptor. -- John Baldwin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r230622 - head
On 2012-01-30, at 21:08, Dimitry Andric wrote: On 2012-01-30 20:27, Rafal Jaworowski wrote: ... Fix this by setting PATH to ${BPATH}:${PATH} in stage 2.3, so the bootstrap tools directories are searched before the regular ones. Is this supposed to work for cross building as well? I'm still encountering problems on a 7.3 host build: 1. Cross world builds fine make -j 8 buildworld TARGET_ARCH=arm 2. Kernel fails w/ the aicasm make buildkernel TARGET_ARCH=arm KERNCONF=SHEEVAPLUG [...] cc -O2 -pipe -nostdinc -I/usr/include -I. -I/home/raj/work/svn/base/head/sys/dev/aic7xxx/aicasm -std=gnu99 -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wno-pointer-sign -c aicasm_scan.c cc1: warnings being treated as errors /home/raj/work/svn/base/head/sys/dev/aic7xxx/aicasm/aicasm_scan.l:837: warning: function declaration isn't a prototype Can you please try doing make buildenv TARGET_ARCH=arm, then run which lex and which yacc? make buildenv TARGET_ARCH=arm Entering world for arm:arm $ which lex /home/raj/work/obj//arm.arm/home/raj/work/svn/base/head/tmp/legacy/usr/bin/lex $ which yacc /home/raj/work/obj//arm.arm/home/raj/work/svn/base/head/tmp/legacy/usr/bin/yacc $ They seem freshly built (from the earlier buildworld run). Rafal ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r230786 - head
Author: imp Date: Mon Jan 30 20:19:28 2012 New Revision: 230786 URL: http://svn.freebsd.org/changeset/base/230786 Log: Allow specification of build shell for the buildenv target. Submitted by: ian lepore Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Mon Jan 30 20:00:29 2012(r230785) +++ head/Makefile.inc1 Mon Jan 30 20:19:28 2012(r230786) @@ -19,6 +19,7 @@ # list # TARGET=machine to crossbuild world for a different machine type # TARGET_ARCH= may be required when a TARGET supports multiple endians +# BUILDENV_SHELL= shell to launch for the buildenv target (def:/bin/sh) # # The intended user-driven targets are: @@ -108,6 +109,8 @@ CLEANDIR= cleandir LOCAL_TOOL_DIRS?= +BUILDENV_SHELL?=/bin/sh + CVS?= cvs CVSFLAGS?= -A -P -d -I! SVN?= svn @@ -558,7 +561,7 @@ buildenvvars: buildenv: @echo Entering world for ${TARGET_ARCH}:${TARGET} - @cd ${.CURDIR} env ${WMAKEENV} sh || true + @cd ${.CURDIR} env ${WMAKEENV} ${BUILDENV_SHELL} || true TOOLCHAIN_TGTS=${WMAKE_TGTS:N_depend:Neverything:Nbuild32} toolchain: ${TOOLCHAIN_TGTS} ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r230622 - head
On Mon, 2012-01-30 at 21:08 +0100, Dimitry Andric wrote: On 2012-01-30 20:27, Rafal Jaworowski wrote: ... Fix this by setting PATH to ${BPATH}:${PATH} in stage 2.3, so the bootstrap tools directories are searched before the regular ones. Is this supposed to work for cross building as well? I'm still encountering problems on a 7.3 host build: 1. Cross world builds fine make -j 8 buildworld TARGET_ARCH=arm 2. Kernel fails w/ the aicasm make buildkernel TARGET_ARCH=arm KERNCONF=SHEEVAPLUG [...] cc -O2 -pipe -nostdinc -I/usr/include -I. -I/home/raj/work/svn/base/head/sys/dev/aic7xxx/aicasm -std=gnu99 -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wno-pointer-sign -c aicasm_scan.c cc1: warnings being treated as errors /home/raj/work/svn/base/head/sys/dev/aic7xxx/aicasm/aicasm_scan.l:837: warning: function declaration isn't a prototype Can you please try doing make buildenv TARGET_ARCH=arm, then run which lex and which yacc? Shouldn't lex and yacc be listed in the Makefile.inc1 bootstrap-tools target for this to be fully effective? It looks like neither is in RELENG_7 and lex is only conditionally listed in RELENG_8. -- Ian ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r230787 - head/share/man/man9
Author: brueffer Date: Mon Jan 30 21:02:25 2012 New Revision: 230787 URL: http://svn.freebsd.org/changeset/base/230787 Log: Manpages for the buf_ring and drbr interfaces. Submitted by: kmacy (aeons ago) MFC after:1 week Added: head/share/man/man9/buf_ring.9 (contents, props changed) head/share/man/man9/drbr.9 (contents, props changed) Modified: head/share/man/man9/Makefile Modified: head/share/man/man9/Makefile == --- head/share/man/man9/MakefileMon Jan 30 20:19:28 2012 (r230786) +++ head/share/man/man9/MakefileMon Jan 30 21:02:25 2012 (r230787) @@ -12,6 +12,7 @@ MAN= accept_filter.9 \ boot.9 \ bpf.9 \ buf.9 \ + buf_ring.9 \ BUF_ISLOCKED.9 \ BUF_LOCK.9 \ BUF_LOCKFREE.9 \ @@ -99,6 +100,7 @@ MAN= accept_filter.9 \ devtoname.9 \ disk.9 \ domain.9 \ + drbr.9 \ driver.9 \ DRIVER_MODULE.9 \ EVENTHANDLER.9 \ @@ -410,6 +412,16 @@ MLINKS+=bpf.9 bpfattach.9 \ bpf.9 bpf_tap.9 \ bpf.9 bpf_validate.9 MLINKS+=buf.9 bp.9 +MLINKS+=buf_ring.9 buf_ring_alloc.9 \ + buf_ring.9 buf_ring_free.9 \ + buf_ring.9 buf_ring_enqueue.9 \ + buf_ring.9 buf_ring_enqueue_bytes.9 \ + buf_ring.9 buf_ring_dequeue_mc.9 \ + buf_ring.9 buf_ring_dequeue_sc.9 \ + buf_ring.9 buf_ring_count.9 \ + buf_ring.9 buf_ring_empty.9 \ + buf_ring.9 buf_ring_full.9 \ + buf_ring.9 buf_ring_peek.9 MLINKS+=bus_activate_resource.9 bus_deactivate_resource.9 MLINKS+=bus_alloc_resource.9 bus_alloc_resource_any.9 MLINKS+=BUS_BIND_INTR.9 bus_bind_intr.9 @@ -608,6 +620,14 @@ MLINKS+=domain.9 DOMAIN_SET.9 \ domain.9 pfctlinput2.9 \ domain.9 pffindproto.9 \ domain.9 pffindtype.9 +MLINKS+=drbr.9 drbr_free.9 \ + drbr.9 drbr_enqueue.9 \ + drbr.9 drbr_dequeue.9 \ + drbr.9 drbr_dequeue_cond.9 \ + drbr.9 drbr_flush.9 \ + drbr.9 drbr_empty.9 \ + drbr.9 drbr_inuse.9 \ + drbr.9 drbr_stats_update.9 MLINKS+=EVENTHANDLER.9 EVENTHANDLER_DECLARE.9 \ EVENTHANDLER.9 EVENTHANDLER_DEREGISTER.9 \ EVENTHANDLER.9 eventhandler_deregister.9 \ Added: head/share/man/man9/buf_ring.9 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man9/buf_ring.9 Mon Jan 30 21:02:25 2012 (r230787) @@ -0,0 +1,144 @@ +.\ Copyright (c) 2009 Bitgravity Inc +.\ Written by: Kip Macy km...@freebsd.org +.\ 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$ +.\ +.Dd January 30, 2012 +.Dt BUF_RING 9 +.Os +.Sh NAME +.Nm buf_ring , +.Nm buf_ring_alloc , +.Nm buf_ring_free , +.Nm buf_ring_enqueue , +.Nm buf_ring_enqueue_bytes , +.Nm buf_ring_dequeue_mc , +.Nm buf_ring_dequeue_sc , +.Nm buf_ring_count , +.Nm buf_ring_empty , +.Nm buf_ring_full , +.Nm buf_ring_peek , +.Nd multi-producer, {single, multi}-consumer lock-less ring buffer +.Sh SYNOPSIS +.In sys/param.h +.In sys/buf_ring.h +.Ft struct buf_ring * +.Fn buf_ring_alloc int count struct malloc_type *type int flags struct mtx *sc_lock +.Ft void +.Fn buf_ring_free struct buf_ring *br struct malloc_type *type +.Ft int +.Fn buf_ring_enqueue struct buf_ring *br void *buf +.Ft int +.Fn buf_ring_enqueue_bytes struct buf_ring *br void *buf int bytes +.Ft void * +.Fn buf_ring_dequeue_mc struct buf_ring *br +.Ft void * +.Fn buf_ring_dequeue_sc struct buf_ring *br +.Ft int +.Fn buf_ring_count struct buf_ring *br +.Ft int +.Fn buf_ring_empty struct buf_ring *br +.Ft int +.Fn buf_ring_full
Re: svn commit: r227753 - in head: contrib/gdtoa include lib/libc/gdtoa lib/libc/gen lib/libc/locale lib/libc/regex lib/libc/stdio lib/libc/stdlib lib/libc/stdtime lib/libc/string
On Mon, Jan 30, 2012, David Chisnall wrote: On 18 Jan 2012, at 19:07, David Schultz wrote: This patch appears to cause a large performance regression. For example, I measured a 78% slowdown for strtol(42, ...). That's definitely worth taking a closer look at. I think we can cache some things in TLS and avoid some pthread_getspecific calls. The current code is the 'make it work' version. The 'make it fast' version is planned... Sounds good; I look forward to it. Furthermore, the resulting static binary for a trivial program goes from 7k to 303k, due to pulling in malloc, stdio, and all the pthread stubs. That's not ideal, but I'm not sure if it's avoidable. Is statically linking libc something people regularly do? Aside from bde, probably not many. This is definitely a second-order concern. FreeBSD has a set of statically linked binaries in /rescue for situations where /lib gets screwed up. Space is an issue there because the root partition is historically sized quite small. Embedded folks might also care, but I'll let them speak for themselves. I did get a request several years ago from an embedded developer to unbreak the NO_FLOATING_POINT option in libc, and you could imagine perhaps a NO_LOCALE option as well. Yup. A quick-and-dirty hack would be to add a flag that was set on the first call to uselocale() and to always use the global locale if this is not set. That should remove a lot of the overhead in cases where no one uses the per-thread locales. We can also probably store the locale in TLS, which (on platforms with fast TLS) should speed up the lookup a bit. I thought that's what thread_(get|set)_locale already did. Actually, it's counterintuitive that it would be significantly slower to access per-thread state than global state. Any idea why? Maybe it says something about our pthread_getspecific() implementation. I will run the code through a profiler some day, but I don't have the cycles right now. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r227753 - in head: contrib/gdtoa include lib/libc/gdtoa lib/libc/gen lib/libc/locale lib/libc/regex lib/libc/stdio lib/libc/stdlib lib/libc/stdtime lib/libc/string
On Mon, 2012-01-30 at 16:26 -0500, David Schultz wrote: On Mon, Jan 30, 2012, David Chisnall wrote: On 18 Jan 2012, at 19:07, David Schultz wrote: This patch appears to cause a large performance regression. For example, I measured a 78% slowdown for strtol(42, ...). That's definitely worth taking a closer look at. I think we can cache some things in TLS and avoid some pthread_getspecific calls. The current code is the 'make it work' version. The 'make it fast' version is planned... Sounds good; I look forward to it. Furthermore, the resulting static binary for a trivial program goes from 7k to 303k, due to pulling in malloc, stdio, and all the pthread stubs. That's not ideal, but I'm not sure if it's avoidable. Is statically linking libc something people regularly do? Aside from bde, probably not many. This is definitely a second-order concern. FreeBSD has a set of statically linked binaries in /rescue for situations where /lib gets screwed up. Space is an issue there because the root partition is historically sized quite small. Embedded folks might also care, but I'll let them speak for themselves. I did get a request several years ago from an embedded developer to unbreak the NO_FLOATING_POINT option in libc, and you could imagine perhaps a NO_LOCALE option as well. If locale support starts adding a lot of cycles or memory, then we embedded folks might like a NO_LOCALE option. 100k here, 200k there, and before you know it you're cursing some hardware designer who was sure that you'd never use all of the 64MB of ram he generously gave you. -- Ian ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r230622 - head
On 2012-01-30 21:48, Ian Lepore wrote: On Mon, 2012-01-30 at 21:08 +0100, Dimitry Andric wrote: On 2012-01-30 20:27, Rafal Jaworowski wrote: ... Fix this by setting PATH to ${BPATH}:${PATH} in stage 2.3, so the bootstrap tools directories are searched before the regular ones. Is this supposed to work for cross building as well? I'm still encountering problems on a 7.3 host build: 1. Cross world builds fine make -j 8 buildworld TARGET_ARCH=arm 2. Kernel fails w/ the aicasm make buildkernel TARGET_ARCH=arm KERNCONF=SHEEVAPLUG [...] cc -O2 -pipe -nostdinc -I/usr/include -I. -I/home/raj/work/svn/base/head/sys/dev/aic7xxx/aicasm -std=gnu99 -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wno-pointer-sign -c aicasm_scan.c cc1: warnings being treated as errors /home/raj/work/svn/base/head/sys/dev/aic7xxx/aicasm/aicasm_scan.l:837: warning: function declaration isn't a prototype Can you please try doing make buildenv TARGET_ARCH=arm, then run which lex and which yacc? Shouldn't lex and yacc be listed in the Makefile.inc1 bootstrap-tools target for this to be fully effective? It looks like neither is in RELENG_7 and lex is only conditionally listed in RELENG_8. It is, for head at least (but I think I will MFC this change, if it turns out to work correctly). Look in Makefile.inc1, around line 1030: .if ${BOOTSTRAPPING} 96 _lex= usr.bin/lex _yacc= usr.bin/yacc .endif I have assumed Rafal is building a head checkout on 7.3 release. Since BOOTSTRAPPING will most likely be 703000, the lex and yacc targets are built during the bootstrap-tools stage. That said, I still don't understand why the generated aicasm_scan.c file is still defining the input() function. Rafal, just to be sure, can you please paste the file that was generated during your buildkernel? ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r227753 - in head: contrib/gdtoa include lib/libc/gdtoa lib/libc/gen lib/libc/locale lib/libc/regex lib/libc/stdio lib/libc/stdlib lib/libc/stdtime lib/libc/string
On Mon, Jan 30, 2012 at 04:26:31PM -0500, David Schultz wrote: FreeBSD has a set of statically linked binaries in /rescue for situations where /lib gets screwed up. Space is an issue there because the root partition is historically sized quite small. /rescue is a single binary created with crunchgen and 137 hard links. There's also one 9K script. BTW, I known of someone besides bde who creates statically linked binaries; particularly when he's debugging and profiling the his code. :-) -- Steve ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r230789 - head/sys/dev/fe
Author: imp Date: Mon Jan 30 22:47:02 2012 New Revision: 230789 URL: http://svn.freebsd.org/changeset/base/230789 Log: Improve media status reporting, when the driver knows... Modified: head/sys/dev/fe/if_fe.c Modified: head/sys/dev/fe/if_fe.c == --- head/sys/dev/fe/if_fe.c Mon Jan 30 22:32:54 2012(r230788) +++ head/sys/dev/fe/if_fe.c Mon Jan 30 22:47:02 2012(r230789) @@ -2255,6 +2255,7 @@ fe_medchange (struct ifnet *ifp) static void fe_medstat (struct ifnet *ifp, struct ifmediareq *ifmr) { - (void)ifp; - (void)ifmr; + struct fe_softc *sc = ifp-if_softc; + + ifmr-ifm_active = sc-media.ifm_media; } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r230790 - head/sys/dev/ixgbe
Author: jfv Date: Mon Jan 30 23:03:21 2012 New Revision: 230790 URL: http://svn.freebsd.org/changeset/base/230790 Log: Wrap the bool typedef Modified: head/sys/dev/ixgbe/ixgbe_osdep.h Modified: head/sys/dev/ixgbe/ixgbe_osdep.h == --- head/sys/dev/ixgbe/ixgbe_osdep.hMon Jan 30 22:47:02 2012 (r230789) +++ head/sys/dev/ixgbe/ixgbe_osdep.hMon Jan 30 23:03:21 2012 (r230790) @@ -106,7 +106,9 @@ typedef uint16_tu16; typedef uint32_t u32; typedef int32_ts32; typedef uint64_t u64; +#ifndef __bool_true_false_are_defined typedef boolean_t bool; +#endif #define le16_to_cpu ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r230791 - in head/sys/dev/ath/ath_hal: ar5210 ar5211 ar5212
Author: adrian Date: Mon Jan 30 23:07:27 2012 New Revision: 230791 URL: http://svn.freebsd.org/changeset/base/230791 Log: Radar API related fixes. * For legacy NICs, the combined RSSI should be used. For earlier AR5416 NICs, use control chain 0 RSSI rather than combined RSSI. For AR5416 version 2.1, use the combined RSSI again. * Add in a missing AR5212 HAL method (get11nextbusy) which may be called by radar code. This serves no functional change for what's currently in FreeBSD. Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c head/sys/dev/ath/ath_hal/ar5212/ar5212.h head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c == --- head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c Mon Jan 30 23:03:21 2012(r230790) +++ head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c Mon Jan 30 23:07:27 2012(r230791) @@ -359,6 +359,12 @@ ar5210FillCapabilityInfo(struct ath_hal pCap-halChanHalfRate = AH_FALSE; pCap-halChanQuarterRate = AH_FALSE; + /* +* RSSI uses the combined field; some 11n NICs may use +* the control chain RSSI. +*/ + pCap-halUseCombinedRadarRssi = AH_TRUE; + if (ath_hal_eepromGetFlag(ah, AR_EEP_RFKILL)) { /* * Setup initial rfsilent settings based on the EEPROM Modified: head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c == --- head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c Mon Jan 30 23:03:21 2012(r230790) +++ head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c Mon Jan 30 23:07:27 2012(r230791) @@ -494,6 +494,12 @@ ar5211FillCapabilityInfo(struct ath_hal pCap-halChanHalfRate = AH_FALSE; pCap-halChanQuarterRate = AH_FALSE; + /* +* RSSI uses the combined field; some 11n NICs may use +* the control chain RSSI. +*/ + pCap-halUseCombinedRadarRssi = AH_TRUE; + if (ath_hal_eepromGetFlag(ah, AR_EEP_RFKILL) ath_hal_eepromGet(ah, AR_EEP_RFSILENT, ahpriv-ah_rfsilent) == HAL_OK) { /* NB: enabled by default */ Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212.h == --- head/sys/dev/ath/ath_hal/ar5212/ar5212.hMon Jan 30 23:03:21 2012 (r230790) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212.hMon Jan 30 23:07:27 2012 (r230791) @@ -628,5 +628,6 @@ extern HAL_BOOL ar5212ProcessRadarEvent( struct ath_rx_status *rxs, uint64_t fulltsf, const char *buf, HAL_DFS_EVENT *event); extern HAL_BOOL ar5212IsFastClockEnabled(struct ath_hal *ah); +extern uint32_t ar5212Get11nExtBusy(struct ath_hal *ah); #endif /* _ATH_AR5212_H_ */ Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c == --- head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c Mon Jan 30 23:03:21 2012(r230790) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c Mon Jan 30 23:07:27 2012(r230791) @@ -134,6 +134,7 @@ static const struct ath_hal_private ar52 .ah_getDfsThresh= ar5212GetDfsThresh, .ah_procRadarEvent = ar5212ProcessRadarEvent, .ah_isFastClockEnabled = ar5212IsFastClockEnabled, + .ah_get11nExtBusy = ar5212Get11nExtBusy, /* Key Cache Functions */ .ah_getKeyCacheSize = ar5212GetKeyCacheSize, @@ -839,6 +840,12 @@ ar5212FillCapabilityInfo(struct ath_hal pCap-halChanHalfRate = AH_TRUE; pCap-halChanQuarterRate = AH_TRUE; + /* +* RSSI uses the combined field; some 11n NICs may use +* the control chain RSSI. +*/ + pCap-halUseCombinedRadarRssi = AH_TRUE; + if (ath_hal_eepromGetFlag(ah, AR_EEP_RFKILL) ath_hal_eepromGet(ah, AR_EEP_RFSILENT, ahpriv-ah_rfsilent) == HAL_OK) { /* NB: enabled by default */ Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c == --- head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Mon Jan 30 23:03:21 2012(r230790) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Mon Jan 30 23:07:27 2012(r230791) @@ -1233,3 +1233,13 @@ ar5212IsFastClockEnabled(struct ath_hal { return AH_FALSE; } + +/* + * Return what percentage of the extension channel is busy. + * This is always disabled for AR5212 series NICs. + */ +uint32_t +ar5212Get11nExtBusy(struct ath_hal *ah) +{ + return 0; +} ___
svn commit: r230793 - in head/sys: conf net80211
Author: adrian Date: Tue Jan 31 00:03:49 2012 New Revision: 230793 URL: http://svn.freebsd.org/changeset/base/230793 Log: Add a DFS debugging mode which is useful when doing automated DFS compliance testing. In order to allow for radar pattern matching to occur, the DFS CAC/NOL handling needs to be made configurable. This commit introduces a new sysctl, net.wlan.dfs_debug, which controls which DFS debug mode net80211 is in. * 0 = default, CSA/NOL handling as per normal. * 1 = announce a CSA, but don't add the channel to the non-occupy list (NOL.) * 2 = disable both CSA and NOL - only print that a radar event occured. This code is not compiled/enabled by default as it breaks regulatory handling. A user must enable IEEE80211_DFS_DEBUG in their kernel configuration file for this option to become available. Obtained from:Atheros Modified: head/sys/conf/options head/sys/net80211/ieee80211_dfs.c head/sys/net80211/ieee80211_dfs.h Modified: head/sys/conf/options == --- head/sys/conf/options Mon Jan 30 23:37:17 2012(r230792) +++ head/sys/conf/options Tue Jan 31 00:03:49 2012(r230793) @@ -845,6 +845,7 @@ IEEE80211_SUPPORT_MESH opt_wlan.h IEEE80211_SUPPORT_SUPERG opt_wlan.h IEEE80211_SUPPORT_TDMA opt_wlan.h IEEE80211_ALQ opt_wlan.h +IEEE80211_DFS_DEBUGopt_wlan.h # 802.11 TDMA support TDMA_SLOTLEN_DEFAULT opt_tdma.h Modified: head/sys/net80211/ieee80211_dfs.c == --- head/sys/net80211/ieee80211_dfs.c Mon Jan 30 23:37:17 2012 (r230792) +++ head/sys/net80211/ieee80211_dfs.c Tue Jan 31 00:03:49 2012 (r230793) @@ -64,6 +64,28 @@ SYSCTL_INT(_net_wlan, OID_AUTO, cac_time ieee80211_cac_timeout, 0, CAC timeout (secs)); #defineCAC_TIMEOUT msecs_to_ticks(ieee80211_cac_timeout*1000) +/* + DFS* In order to facilitate debugging, a couple of operating + * modes aside from the default are needed. + * + * 0 - default CAC/NOL behaviour - ie, start CAC, place + * channel on NOL list. + * 1 - send CAC, but don't change channel or add the channel + * to the NOL list. + * 2 - just match on radar, don't send CAC or place channel in + * the NOL list. + */ +static int ieee80211_dfs_debug = DFS_DBG_NONE; + +/* + * This option must not be included in the default kernel + * as it allows users to plainly disable CAC/NOL handling. + */ +#ifdef IEEE80211_DFS_DEBUG +SYSCTL_INT(_net_wlan, OID_AUTO, dfs_debug, CTLFLAG_RW, + ieee80211_dfs_debug, 0, DFS debug behaviour); +#endif + static int null_set_quiet(struct ieee80211_node *ni, u_int8_t *quiet_elm) { @@ -278,24 +300,44 @@ ieee80211_dfs_notify_radar(struct ieee80 IEEE80211_LOCK_ASSERT(ic); /* -* Mark all entries with this frequency. Notify user -* space and arrange for notification when the radar -* indication is cleared. Then kick the NOL processing -* thread if not already running. +* If doing DFS debugging (mode 2), don't bother +* running the rest of this function. +* +* Simply announce the presence of the radar and continue +* along merrily. */ - now = ticks; - for (i = 0; i ic-ic_nchans; i++) { - struct ieee80211_channel *c = ic-ic_channels[i]; - if (c-ic_freq == chan-ic_freq) { - c-ic_state = ~IEEE80211_CHANSTATE_CACDONE; - c-ic_state |= IEEE80211_CHANSTATE_RADAR; - dfs-nol_event[i] = now; + if (ieee80211_dfs_debug == DFS_DBG_NOCSANOL) { + announce_radar(ic-ic_ifp, chan, chan); + ieee80211_notify_radar(ic, chan); + return; + } + + /* +* Don't mark the channel and don't put it into NOL +* if we're doing DFS debugging. +*/ + if (ieee80211_dfs_debug == DFS_DBG_NONE) { + /* +* Mark all entries with this frequency. Notify user +* space and arrange for notification when the radar +* indication is cleared. Then kick the NOL processing +* thread if not already running. +*/ + now = ticks; + for (i = 0; i ic-ic_nchans; i++) { + struct ieee80211_channel *c = ic-ic_channels[i]; + if (c-ic_freq == chan-ic_freq) { + c-ic_state = ~IEEE80211_CHANSTATE_CACDONE; + c-ic_state |= IEEE80211_CHANSTATE_RADAR; + dfs-nol_event[i] = now; + } } + ieee80211_notify_radar(ic, chan); + chan-ic_state |= IEEE80211_CHANSTATE_NORADAR; + if
svn commit: r230795 - in head/usr.sbin/makefs: . cd9660
Author: jkim Date: Tue Jan 31 00:32:37 2012 New Revision: 230795 URL: http://svn.freebsd.org/changeset/base/230795 Log: Allow contents of multiple directories to be merged to the current image. Note this patch was submitted to NetBSD and they already adopted it. http://mail-index.netbsd.org/source-changes/2012/01/28/msg031078.html MFC after:1 week Modified: head/usr.sbin/makefs/cd9660.c head/usr.sbin/makefs/cd9660.h head/usr.sbin/makefs/cd9660/cd9660_write.c head/usr.sbin/makefs/ffs.c head/usr.sbin/makefs/makefs.8 head/usr.sbin/makefs/makefs.c head/usr.sbin/makefs/makefs.h head/usr.sbin/makefs/walk.c Modified: head/usr.sbin/makefs/cd9660.c == --- head/usr.sbin/makefs/cd9660.c Tue Jan 31 00:12:51 2012 (r230794) +++ head/usr.sbin/makefs/cd9660.c Tue Jan 31 00:32:37 2012 (r230795) @@ -472,8 +472,6 @@ cd9660_makefs(const char *image, const c return; } - diskStructure.rootFilesystemPath = dir; - if (diskStructure.verbose_level 0) printf(cd9660_makefs: image %s directory %s root %p\n, image, dir, root); @@ -1568,24 +1566,15 @@ cd9660_generate_path_table(void) } void -cd9660_compute_full_filename(cd9660node *node, char *buf, int level) +cd9660_compute_full_filename(cd9660node *node, char *buf) { - cd9660node *parent; - - parent = (node-rr_real_parent == NULL ? - node-parent : node-rr_real_parent); - if (parent != NULL) { - cd9660_compute_full_filename(parent, buf, level + 1); - strcat(buf, node-node-name); - } else { - /* We are at the root */ - strcat(buf, diskStructure.rootFilesystemPath); - if (buf[strlen(buf) - 1] == '/') - buf[strlen(buf) - 1] = '\0'; - } + int len; - if (level != 0) - strcat(buf, /); + len = CD9660MAXPATH + 1; + len = snprintf(buf, len, %s/%s/%s, node-node-root, + node-node-path, node-node-name); + if (len CD9660MAXPATH) + errx(1, Pathname too long.); } /* NEW filename conversion method */ Modified: head/usr.sbin/makefs/cd9660.h == --- head/usr.sbin/makefs/cd9660.h Tue Jan 31 00:12:51 2012 (r230794) +++ head/usr.sbin/makefs/cd9660.h Tue Jan 31 00:32:37 2012 (r230795) @@ -244,8 +244,6 @@ typedef struct _iso9660_disk { cd9660node *rootNode; - const char *rootFilesystemPath; - /* Important sector numbers here */ /* primaryDescriptor.type_l_path_table*/ int64_t primaryBigEndianTableSector; @@ -345,7 +343,7 @@ int cd9660_setup_boot_volume_descriptor( intcd9660_write_image(const char *image); intcd9660_copy_file(FILE *, off_t, const char *); -void cd9660_compute_full_filename(cd9660node *, char *, int); +void cd9660_compute_full_filename(cd9660node *, char *); intcd9660_compute_record_size(cd9660node *); /* Debugging functions */ Modified: head/usr.sbin/makefs/cd9660/cd9660_write.c == --- head/usr.sbin/makefs/cd9660/cd9660_write.c Tue Jan 31 00:12:51 2012 (r230794) +++ head/usr.sbin/makefs/cd9660/cd9660_write.c Tue Jan 31 00:32:37 2012 (r230795) @@ -296,7 +296,7 @@ cd9660_write_file(FILE *fd, cd9660node * inode-flags |= FI_WRITTEN; if (writenode-node-contents == NULL) cd9660_compute_full_filename(writenode, - temp_file_name, 0); + temp_file_name); ret = cd9660_copy_file(fd, writenode-fileDataSector, (writenode-node-contents != NULL) ? writenode-node-contents : temp_file_name); Modified: head/usr.sbin/makefs/ffs.c == --- head/usr.sbin/makefs/ffs.c Tue Jan 31 00:12:51 2012(r230794) +++ head/usr.sbin/makefs/ffs.c Tue Jan 31 00:32:37 2012(r230795) @@ -780,8 +780,8 @@ ffs_populate_dir(const char *dir, fsnode cur-inode-flags |= FI_WRITTEN; if (cur-contents == NULL) { - if (snprintf(path, sizeof(path), %s/%s, dir, - cur-name) = sizeof(path)) + if (snprintf(path, sizeof(path), %s/%s/%s, cur-root, + cur-path, cur-name) = (int)sizeof(path)) errx(1, Pathname too long.); } Modified: head/usr.sbin/makefs/makefs.8 == --- head/usr.sbin/makefs/makefs.8
svn commit: r230801 - head/sys/nlm
Author: rmacklem Date: Tue Jan 31 02:11:05 2012 New Revision: 230801 URL: http://svn.freebsd.org/changeset/base/230801 Log: jwd@ reported a problem via email to freebsd-fs@ on Aug 25, 2011 under the subject F_RDLCK lock to FreeBSD NFS fails to R/O target file. This occurred because the server side NLM always checked for VWRITE access, irrespective of the type of lock request. This patch replaces VOP_ACCESS(..VWRITE..) with one appropriate to the lock operation. It allows unlock and lock cancellation to be done without a check of VOP_ACCESS(), so that files can't be left locked indefinitely after the file permissions have been changed. Discussed with: zack Submitted by: jwd (earlier version) Reviewed by: dfr MFC after:2 weeks Modified: head/sys/nlm/nlm_prot_impl.c Modified: head/sys/nlm/nlm_prot_impl.c == --- head/sys/nlm/nlm_prot_impl.cTue Jan 31 01:51:30 2012 (r230800) +++ head/sys/nlm/nlm_prot_impl.cTue Jan 31 02:11:05 2012 (r230801) @@ -1775,10 +1775,10 @@ struct vfs_state { static int nlm_get_vfs_state(struct nlm_host *host, struct svc_req *rqstp, -fhandle_t *fhp, struct vfs_state *vs) +fhandle_t *fhp, struct vfs_state *vs, accmode_t accmode) { int error, exflags; - struct ucred *cred = NULL, *credanon; + struct ucred *cred = NULL, *credanon = NULL; memset(vs, 0, sizeof(*vs)); @@ -1788,14 +1788,19 @@ nlm_get_vfs_state(struct nlm_host *host, } vs-vs_vfslocked = VFS_LOCK_GIANT(vs-vs_mp); - error = VFS_CHECKEXP(vs-vs_mp, (struct sockaddr *)host-nh_addr, - exflags, credanon, NULL, NULL); - if (error) - goto out; + /* accmode == 0 means don't check, since it is an unlock. */ + if (accmode != 0) { + error = VFS_CHECKEXP(vs-vs_mp, + (struct sockaddr *)host-nh_addr, exflags, credanon, + NULL, NULL); + if (error) + goto out; - if (exflags MNT_EXRDONLY || (vs-vs_mp-mnt_flag MNT_RDONLY)) { - error = EROFS; - goto out; + if (exflags MNT_EXRDONLY || + (vs-vs_mp-mnt_flag MNT_RDONLY)) { + error = EROFS; + goto out; + } } error = VFS_FHTOVP(vs-vs_mp, fhp-fh_fid, LK_EXCLUSIVE, vs-vs_vp); @@ -1803,22 +1808,31 @@ nlm_get_vfs_state(struct nlm_host *host, goto out; vs-vs_vnlocked = TRUE; - if (!svc_getcred(rqstp, cred, NULL)) { - error = EINVAL; - goto out; - } - if (cred-cr_uid == 0 || (exflags MNT_EXPORTANON)) { - crfree(cred); - cred = credanon; - credanon = NULL; - } + if (accmode != 0) { + if (!svc_getcred(rqstp, cred, NULL)) { + error = EINVAL; + goto out; + } + if (cred-cr_uid == 0 || (exflags MNT_EXPORTANON)) { + crfree(cred); + cred = credanon; + credanon = NULL; + } - /* -* Check cred. -*/ - error = VOP_ACCESS(vs-vs_vp, VWRITE, cred, curthread); - if (error) - goto out; + /* +* Check cred. +*/ + error = VOP_ACCESS(vs-vs_vp, accmode, cred, curthread); + /* +* If this failed and accmode != VWRITE, try again with +* VWRITE to maintain backwards compatibility with the +* old code that always used VWRITE. +*/ + if (error != 0 accmode != VWRITE) + error = VOP_ACCESS(vs-vs_vp, VWRITE, cred, curthread); + if (error) + goto out; + } #if __FreeBSD_version 800011 VOP_UNLOCK(vs-vs_vp, 0, curthread); @@ -1872,6 +1886,7 @@ nlm_do_test(nlm4_testargs *argp, nlm4_te struct nlm_host *host, *bhost; int error, sysid; struct flock fl; + accmode_t accmode; memset(result, 0, sizeof(*result)); memset(vs, 0, sizeof(vs)); @@ -1897,7 +1912,8 @@ nlm_do_test(nlm4_testargs *argp, nlm4_te goto out; } - error = nlm_get_vfs_state(host, rqstp, fh, vs); + accmode = argp-exclusive ? VWRITE : VREAD; + error = nlm_get_vfs_state(host, rqstp, fh, vs, accmode); if (error) { result-stat.stat = nlm_convert_error(error); goto out; @@ -1968,6 +1984,7 @@ nlm_do_lock(nlm4_lockargs *argp, nlm4_re struct nlm_host *host; int error, sysid; struct flock fl; + accmode_t accmode; memset(result, 0, sizeof(*result));
svn commit: r230803 - in head/sys: fs/nfsclient nfsclient
Author: rmacklem Date: Tue Jan 31 03:58:26 2012 New Revision: 230803 URL: http://svn.freebsd.org/changeset/base/230803 Log: When a mount -u switches an NFS mount point from TCP to UDP, any thread doing an I/O RPC with a transfer size greater than NFS_UDPMAXDATA will be hung indefinitely, retrying the RPC. After a discussion on freebsd-fs@, I decided to add a warning message for this case, as suggested by Jeremy Chadwick. Suggested by: freebsd at jdc.parodius.com (Jeremy Chadwick) MFC after:2 weeks Modified: head/sys/fs/nfsclient/nfs_clvfsops.c head/sys/nfsclient/nfs_vfsops.c Modified: head/sys/fs/nfsclient/nfs_clvfsops.c == --- head/sys/fs/nfsclient/nfs_clvfsops.cTue Jan 31 02:30:47 2012 (r230802) +++ head/sys/fs/nfsclient/nfs_clvfsops.cTue Jan 31 03:58:26 2012 (r230803) @@ -999,6 +999,19 @@ nfs_mount(struct mount *mp) error = EIO; goto out; } + + /* +* If a change from TCP-UDP is done and there are thread(s) +* that have I/O RPC(s) in progress with a tranfer size +* greater than NFS_MAXDGRAMDATA, those thread(s) will be +* hung, retrying the RPC(s) forever. Usually these threads +* will be seen doing an uninterruptible sleep on wait channel +* newnfsreq (truncated to newnfsre by procstat). +*/ + if (args.sotype == SOCK_DGRAM nmp-nm_sotype == SOCK_STREAM) + tprintf(td-td_proc, LOG_WARNING, + Warning: mount -u that changes TCP-UDP can result in hung threads\n); + /* * When doing an update, we can't change version, * security, switch lockd strategies or change cookie Modified: head/sys/nfsclient/nfs_vfsops.c == --- head/sys/nfsclient/nfs_vfsops.c Tue Jan 31 02:30:47 2012 (r230802) +++ head/sys/nfsclient/nfs_vfsops.c Tue Jan 31 03:58:26 2012 (r230803) @@ -56,6 +56,7 @@ __FBSDID($FreeBSD$); #include sys/socketvar.h #include sys/sockio.h #include sys/sysctl.h +#include sys/syslog.h #include sys/vnode.h #include sys/signalvar.h @@ -1116,6 +1117,19 @@ nfs_mount(struct mount *mp) error = EIO; goto out; } + + /* +* If a change from TCP-UDP is done and there are thread(s) +* that have I/O RPC(s) in progress with a tranfer size +* greater than NFS_MAXDGRAMDATA, those thread(s) will be +* hung, retrying the RPC(s) forever. Usually these threads +* will be seen doing an uninterruptible sleep on wait channel +* newnfsreq (truncated to newnfsre by procstat). +*/ + if (args.sotype == SOCK_DGRAM nmp-nm_sotype == SOCK_STREAM) + tprintf(curthread-td_proc, LOG_WARNING, + Warning: mount -u that changes TCP-UDP can result in hung threads\n); + /* * When doing an update, we can't change from or to * v3, switch lockd strategies or change cookie translation ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r230804 - head/usr.sbin/bsdinstall/scripts
Author: kevlo Date: Tue Jan 31 05:49:49 2012 New Revision: 230804 URL: http://svn.freebsd.org/changeset/base/230804 Log: Fix a whitespace nit Reviewed by: bz Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 == --- head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Tue Jan 31 03:58:26 2012(r230803) +++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Tue Jan 31 05:49:49 2012(r230804) @@ -73,7 +73,7 @@ exec 3- echo $INTERFACE $IF_CONFIG | awk -v prefix=$IFCONFIG_PREFIX '{ - printf(ifconfig_%s=\%s inet %s netmask %s\\n, $1, prefix, $2, $3); + printf(ifconfig_%s=\%s\inet %s netmask %s\\n, $1, prefix, $2, $3); printf(defaultrouter=\%s\\n, $4); }' $BSDINSTALL_TMPETC/._rc.conf.net ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org