Re: svn commit: r253636 - head/sys/vm
On Thu, 25 Jul 2013, Tim Kientzle wrote: Log: Clear entire map structure including locks so that the locks don't accidentally appear to have been already initialized. In particular, this fixes a consistent kernel crash on armv6 with: panic: lock "vm map (user)" 0xc09cc050 already initialized that appeared with r251709. PR: arm/180820 Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c == --- head/sys/vm/vm_map.cThu Jul 25 03:44:12 2013(r253635) +++ head/sys/vm/vm_map.cThu Jul 25 03:48:37 2013(r253636) @@ -239,8 +239,7 @@ vm_map_zinit(void *mem, int size, int fl vm_map_t map; map = (vm_map_t)mem; - map->nentries = 0; - map->size = 0; + memset(map, 0, sizeof(*map)); mtx_init(&map->system_mtx, "vm map (system)", NULL, MTX_DEF | MTX_DUPOK); sx_init(&map->lock, "vm map (user)"); return (0); memset() to value 0 is spelled bzero() in the kernel. Before this commit, vm used normal style in 21 of 28 instances. The style regression is even smaller in kern -- 18 of 169 instances (3 in comments, and 1 of these in a loop doing a memset to a nonzero value, which was required before about FreeBSD-4 since memset() didn't exist in the kernel. memset() is still a slightly pessimized wrapper round bzero() when the value is nonzero, and a more pessimized loop otherwise). In FreeBSD-4, this style bug was not present in vm (0 of 16 instances) and was smaller in kern (6 of 121 instances (3 in comments, and 1 to #define a buggy memset() in terms of bzero() for the other 2)). Bruce ___ 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: r253346 - in head/sys: kern net netgraph netgraph/bluetooth/socket
On Mon, Jul 15, 2013 at 01:32:55AM +, Craig Rodrigues wrote: > Author: rodrigc > Date: Mon Jul 15 01:32:55 2013 > New Revision: 253346 > URL: http://svnweb.freebsd.org/changeset/base/253346 > > Log: > PR: 168520 170096 > Submitted by: adrian, zec > > Fix multiple kernel panics when VIMAGE is enabled in the kernel. > These fixes are based on patches submitted by Adrian Chadd and Marko Zec. > > (1) Set curthread->td_vnet to vnet0 in device_probe_and_attach() just > before calling >device_attach(). This fixes multiple VIMAGE related kernel panics >when trying to attach Bluetooth or USB Ethernet devices because >curthread->td_vnet is NULL. > > (2) Set curthread->td_vnet in if_detach(). This fixes kernel panics when > detaching networking >interfaces, especially USB Ethernet devices. > > (3) Use VNET_DOMAIN_SET() in ng_btsocket.c > > (4) In ng_unref_node() set curthread->td_vnet. This fixes kernel panics >when detaching Netgraph nodes. > > Modified: > head/sys/kern/subr_bus.c > head/sys/net/if.c > head/sys/netgraph/bluetooth/socket/ng_btsocket.c > head/sys/netgraph/ng_base.c > > Modified: head/sys/kern/subr_bus.c > == > --- head/sys/kern/subr_bus.c Mon Jul 15 00:49:10 2013(r253345) > +++ head/sys/kern/subr_bus.c Mon Jul 15 01:32:55 2013(r253346) > @@ -53,6 +53,8 @@ __FBSDID("$FreeBSD$"); > #include > #include > > +#include > + > #include > > #include > @@ -2735,7 +2737,11 @@ device_probe_and_attach(device_t dev) > return (0); > else if (error != 0) > return (error); > - return (device_attach(dev)); > + > + CURVNET_SET_QUIET(vnet0); > + error = device_attach(dev); > + CURVNET_RESTORE(); > + return error; > } Uhm - do we really need to have that layering violation in subr_bus.c? Wouldn't it be sufficient to set curthread->td_vnet to vnet0 in if_alloc(9) or if_attach(9) at least instead? Marius ___ 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: r253636 - head/sys/vm
On 07/25/13 09:26, Bruce Evans wrote: On Thu, 25 Jul 2013, Tim Kientzle wrote: Log: Clear entire map structure including locks so that the locks don't accidentally appear to have been already initialized. In particular, this fixes a consistent kernel crash on armv6 with: panic: lock "vm map (user)" 0xc09cc050 already initialized that appeared with r251709. PR: arm/180820 Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c == --- head/sys/vm/vm_map.cThu Jul 25 03:44:12 2013(r253635) +++ head/sys/vm/vm_map.cThu Jul 25 03:48:37 2013(r253636) @@ -239,8 +239,7 @@ vm_map_zinit(void *mem, int size, int fl vm_map_t map; map = (vm_map_t)mem; -map->nentries = 0; -map->size = 0; +memset(map, 0, sizeof(*map)); mtx_init(&map->system_mtx, "vm map (system)", NULL, MTX_DEF | MTX_DUPOK); sx_init(&map->lock, "vm map (user)"); return (0); memset() to value 0 is spelled bzero() in the kernel. Hi, Is this the "memset vs bzero" or "batman vs superman" discussion again ;-) The structure looks like some size, so bzero() might run faster than memset() depending on the compiler settings. Should be profiled before changed! --HPS ___ 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: r253643 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys
Author: mav Date: Thu Jul 25 08:41:22 2013 New Revision: 253643 URL: http://svnweb.freebsd.org/changeset/base/253643 Log: Following r222950, revert unintentional change cls -> class in argument name in r245264. Aside from non-uniformity, that again confused C++ compilers. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/ddt.h Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/ddt.h == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/ddt.h Thu Jul 25 08:05:25 2013(r253642) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/ddt.h Thu Jul 25 08:41:22 2013(r253643) @@ -172,7 +172,7 @@ extern void ddt_object_name(ddt_t *ddt, extern int ddt_object_walk(ddt_t *ddt, enum ddt_type type, enum ddt_class cls, uint64_t *walk, ddt_entry_t *dde); extern int ddt_object_count(ddt_t *ddt, enum ddt_type type, -enum ddt_class class, uint64_t *count); +enum ddt_class cls, uint64_t *count); extern int ddt_object_info(ddt_t *ddt, enum ddt_type type, enum ddt_class cls, dmu_object_info_t *); extern boolean_t ddt_object_exists(ddt_t *ddt, enum ddt_type type, ___ 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: r253346 - in head/sys: kern net netgraph netgraph/bluetooth/socket
On Thursday 25 July 2013 10:07:58 Marius Strobl wrote: > On Mon, Jul 15, 2013 at 01:32:55AM +, Craig Rodrigues wrote: > > Author: rodrigc > > Date: Mon Jul 15 01:32:55 2013 > > New Revision: 253346 > > URL: http://svnweb.freebsd.org/changeset/base/253346 > > > > Log: > > PR: 168520 170096 > > Submitted by: adrian, zec > > > > Fix multiple kernel panics when VIMAGE is enabled in the kernel. > > These fixes are based on patches submitted by Adrian Chadd and Marko > > Zec. > > > > (1) Set curthread->td_vnet to vnet0 in device_probe_and_attach() > > just before calling device_attach(). This fixes multiple VIMAGE > > related kernel panics when trying to attach Bluetooth or USB Ethernet > > devices because curthread->td_vnet is NULL. > > > > (2) Set curthread->td_vnet in if_detach(). This fixes kernel panics > > when detaching networking interfaces, especially USB Ethernet devices. > > > > (3) Use VNET_DOMAIN_SET() in ng_btsocket.c > > > > (4) In ng_unref_node() set curthread->td_vnet. This fixes kernel > > panics when detaching Netgraph nodes. > > > > Modified: > > head/sys/kern/subr_bus.c > > head/sys/net/if.c > > head/sys/netgraph/bluetooth/socket/ng_btsocket.c > > head/sys/netgraph/ng_base.c > > > > Modified: head/sys/kern/subr_bus.c > > === > >=== --- head/sys/kern/subr_bus.c Mon Jul 15 00:49:10 2013 > >(r253345) > > +++ head/sys/kern/subr_bus.cMon Jul 15 01:32:55 2013 > > (r253346) @@ > > -53,6 +53,8 @@ __FBSDID("$FreeBSD$"); > > #include > > #include > > > > +#include > > + > > #include > > > > #include > > @@ -2735,7 +2737,11 @@ device_probe_and_attach(device_t dev) > > return (0); > > else if (error != 0) > > return (error); > > - return (device_attach(dev)); > > + > > + CURVNET_SET_QUIET(vnet0); > > + error = device_attach(dev); > > + CURVNET_RESTORE(); > > + return error; > > } > > Uhm - do we really need to have that layering violation in subr_bus.c? > Wouldn't it be sufficient to set curthread->td_vnet to vnet0 in > if_alloc(9) or if_attach(9) at least instead? That wouldn't solve the issues with attaching netgraph node(s) to the arriving device, nor potentially other issues unrelated to if_alloc or if_attach. Marko ___ 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: r253644 - head/sys/dev/ata/chipsets
Author: mav Date: Thu Jul 25 09:12:46 2013 New Revision: 253644 URL: http://svnweb.freebsd.org/changeset/base/253644 Log: Add missing NULL check after malloc(M_NOWAIT). Submitted by: Dmitry Luhtionov Modified: head/sys/dev/ata/chipsets/ata-promise.c Modified: head/sys/dev/ata/chipsets/ata-promise.c == --- head/sys/dev/ata/chipsets/ata-promise.c Thu Jul 25 08:41:22 2013 (r253643) +++ head/sys/dev/ata/chipsets/ata-promise.c Thu Jul 25 09:12:46 2013 (r253644) @@ -287,6 +287,10 @@ ata_promise_chipinit(device_t dev) /* setup host packet controls */ hpkt = malloc(sizeof(struct ata_promise_sx4), M_ATAPCI, M_NOWAIT | M_ZERO); + if (hpkt == NULL) { + device_printf(dev, "Cannot allocate HPKT\n"); + goto failnfree; + } mtx_init(&hpkt->mtx, "ATA promise HPKT lock", NULL, MTX_DEF); TAILQ_INIT(&hpkt->queue); hpkt->busy = 0; ___ 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: r253645 - head/sys/dev/sound/pci
Author: uqs Date: Thu Jul 25 09:29:48 2013 New Revision: 253645 URL: http://svnweb.freebsd.org/changeset/base/253645 Log: snd_ds1(4): Fix order of arguments for stereo/16bit mode This function is called 4 times in this file, with swapped parameter ordering. Fix the function definition instead of all the call sites. 16bit/stereo or 8bit/mono playback is unaffected and was probably working fine before, this should fix 16bit/mono and 8bit/stereo playback. Found by: Coverity Scan, CID 1006688 Modified: head/sys/dev/sound/pci/ds1.c Modified: head/sys/dev/sound/pci/ds1.c == --- head/sys/dev/sound/pci/ds1.cThu Jul 25 09:12:46 2013 (r253644) +++ head/sys/dev/sound/pci/ds1.cThu Jul 25 09:29:48 2013 (r253645) @@ -365,7 +365,7 @@ ds_allocpslot(struct sc_info *sc) } static int -ds_initpbank(volatile struct pbank *pb, int ch, int b16, int stereo, u_int32_t rate, bus_addr_t base, u_int32_t len) +ds_initpbank(volatile struct pbank *pb, int ch, int stereo, int b16, u_int32_t rate, bus_addr_t base, u_int32_t len) { u_int32_t lv[] = {1, 1, 0, 0, 0}; u_int32_t rv[] = {1, 0, 1, 0, 0}; ___ 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: r253646 - head/sys/dev/aic7xxx
Author: uqs Date: Thu Jul 25 09:30:00 2013 New Revision: 253646 URL: http://svnweb.freebsd.org/changeset/base/253646 Log: Match function definition to declaration and call-site. SVN r95378 refactored ahc_9005_subdevinfo_valid out into a separate function but swapped the vendor/subvendor and device/subdevice pairs of the parameters. Found by: Coverity Prevent, CID 744931 Reviewed by: gibbs Modified: head/sys/dev/aic7xxx/aic7xxx_pci.c Modified: head/sys/dev/aic7xxx/aic7xxx_pci.c == --- head/sys/dev/aic7xxx/aic7xxx_pci.c Thu Jul 25 09:29:48 2013 (r253645) +++ head/sys/dev/aic7xxx/aic7xxx_pci.c Thu Jul 25 09:30:00 2013 (r253646) @@ -673,8 +673,8 @@ const u_int ahc_num_pci_devs = NUM_ELEME #define STA0x08 #define DPR0x01 -static int ahc_9005_subdevinfo_valid(uint16_t vendor, uint16_t device, -uint16_t subvendor, uint16_t subdevice); +static int ahc_9005_subdevinfo_valid(uint16_t device, uint16_t vendor, +uint16_t subdevice, uint16_t subvendor); static int ahc_ext_scbram_present(struct ahc_softc *ahc); static void ahc_scbram_config(struct ahc_softc *ahc, int enable, int pcheck, int fast, int large); @@ -766,7 +766,7 @@ ahc_find_pci_device(aic_dev_softc_t pci) * ID as valid. */ if (aic_get_pci_function(pci) > 0 -&& ahc_9005_subdevinfo_valid(vendor, device, subvendor, subdevice) +&& ahc_9005_subdevinfo_valid(device, vendor, subdevice, subvendor) && SUBID_9005_MFUNCENB(subdevice) == 0) return (NULL); ___ 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: r253346 - in head/sys: kern net netgraph netgraph/bluetooth/socket
On Thu, Jul 25, 2013 at 1:07 AM, Marius Strobl wrote: > > Uhm - do we really need to have that layering violation in subr_bus.c? > Wouldn't it be sufficient to set curthread->td_vnet to vnet0 in if_alloc(9) > or if_attach(9) at least instead? > There was some discussion about this involving Marko Zec, Adrian Chadd, and myself starting in this thread: http://lists.freebsd.org/pipermail/svn-src-all/2013-July/071798.html Adrian and Marko converged on similar patches: http://lists.freebsd.org/pipermail/freebsd-hackers/2012-November/041120.html http://people.freebsd.org/~adrian/ath/20130712-vimage-default-attach-detach.diff As Marko mentioned in another e-mail on this thread, the patch as it is necessary in order to fix VIMAGE related kernel panics in many different scenarios, including ones involving Netgraph nodes. -- Craig ___ 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: r253346 - in head/sys: kern net netgraph netgraph/bluetooth/socket
On Thursday 25 July 2013 11:36:46 Craig Rodrigues wrote: > On Thu, Jul 25, 2013 at 1:07 AM, Marius Strobl wrote: > > Uhm - do we really need to have that layering violation in subr_bus.c? > > Wouldn't it be sufficient to set curthread->td_vnet to vnet0 in > > if_alloc(9) or if_attach(9) at least instead? > > There was some discussion about this involving Marko Zec, Adrian Chadd, > and myself > starting in this thread: > > http://lists.freebsd.org/pipermail/svn-src-all/2013-July/071798.html > > Adrian and Marko converged on similar patches: > > http://lists.freebsd.org/pipermail/freebsd-hackers/2012-November/041120.h >tml > http://people.freebsd.org/~adrian/ath/20130712-vimage-default-attach-deta >ch.diff > > > As Marko mentioned in another e-mail on this thread, the patch as it is > necessary in > order to fix VIMAGE related kernel panics in many different scenarios, > including > ones involving Netgraph nodes. Moreover, unconditionally setting curvnet to vnet0 in if_alloc(), if_attach() or similar places as suggested my Marius simply couldn't work, because that would break creation of pseudo-interfaces inside non-vnet0 contexts (such as vlan, ng_ether, ng_eiface etc.). Marko ___ 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: r253614 - head/usr.bin/patch
On Wed, Jul 24, 2013 at 01:14:25PM -0500, Pedro Giffuni wrote: > El 24/07/2013 11:52 a. m., Alexey Dokuchaev escribiцЁ: > >On Wed, Jul 24, 2013 at 03:46:50PM +, Pedro F. Giffuni wrote: > >>New Revision: 253614 > >>URL: http://svnweb.freebsd.org/changeset/base/253614 > >> > >>Log: > >> patch: style fix > > > >It's still broken: bad use of capital letters (lack thereof), missing full > >stop (terminating dot). > > > > All the comments in that file have that same problem. At least now > we are consistently inconsistent. ;-) > >> Submitted by:gogolok > > > >$ finger gogo...@freebsd.org > >[...] > >finger: gogolok: no such user > > > >?? > > > @google ... > > I actually don't have more information about the submitter: My point was that "short" should only be used for our fellow committers. ./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: r253647 - head/sys/dev/ahci
Author: mav Date: Thu Jul 25 10:29:40 2013 New Revision: 253647 URL: http://svnweb.freebsd.org/changeset/base/253647 Log: Decode some bits defined in AHCI 1.3.1 Device Sleep Technical Proposal. For now this is only conmetics to report HBA capabilities (Haswell?). Submitted by: Dmitry Luhtionov Modified: head/sys/dev/ahci/ahci.c head/sys/dev/ahci/ahci.h Modified: head/sys/dev/ahci/ahci.c == --- head/sys/dev/ahci/ahci.cThu Jul 25 09:30:00 2013(r253646) +++ head/sys/dev/ahci/ahci.cThu Jul 25 10:29:40 2013(r253647) @@ -538,7 +538,10 @@ ahci_attach(device_t dev) (ctlr->caps & AHCI_CAP_NPMASK) + 1); } if (bootverbose && version >= 0x00010200) { - device_printf(dev, "Caps2:%s%s%s\n", + device_printf(dev, "Caps2:%s%s%s%s%s%s\n", + (ctlr->caps2 & AHCI_CAP2_DESO) ? " DESO":"", + (ctlr->caps2 & AHCI_CAP2_SADM) ? " SADM":"", + (ctlr->caps2 & AHCI_CAP2_SDS) ? " SDS":"", (ctlr->caps2 & AHCI_CAP2_APST) ? " APST":"", (ctlr->caps2 & AHCI_CAP2_NVMP) ? " NVMP":"", (ctlr->caps2 & AHCI_CAP2_BOH) ? " BOH":""); Modified: head/sys/dev/ahci/ahci.h == --- head/sys/dev/ahci/ahci.hThu Jul 25 09:30:00 2013(r253646) +++ head/sys/dev/ahci/ahci.hThu Jul 25 10:29:40 2013(r253647) @@ -100,6 +100,7 @@ #define ATA_SS_IPM_ACTIVE 0x0100 #define ATA_SS_IPM_PARTIAL 0x0200 #define ATA_SS_IPM_SLUMBER 0x0600 +#define ATA_SS_IPM_DEVSLEEP 0x0800 #define ATA_SERROR 14 #define ATA_SE_DATA_CORRECTED 0x0001 @@ -205,6 +206,9 @@ #defineAHCI_CAP2_BOH 0x0001 #defineAHCI_CAP2_NVMP 0x0002 #defineAHCI_CAP2_APST 0x0004 +#defineAHCI_CAP2_SDS 0x0008 +#defineAHCI_CAP2_SADM 0x0010 +#defineAHCI_CAP2_DESO 0x0020 #define AHCI_OFFSET 0x100 #define AHCI_STEP 0x80 @@ -262,6 +266,7 @@ #define AHCI_P_CMD_ACTIVE 0x1000 #define AHCI_P_CMD_PARTIAL 0x2000 #define AHCI_P_CMD_SLUMBER 0x6000 +#define AHCI_P_CMD_DEVSLEEP 0x8000 #define AHCI_P_TFD 0x20 #define AHCI_P_SIG 0x24 ___ 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: r253636 - head/sys/vm
On 25 Jul 2013, at 09:11, Hans Petter Selasky wrote: > The structure looks like some size, so bzero() might run faster than memset() > depending on the compiler settings. Should be profiled before changed! They will generate identical code for small structures with known sizes. Both clang and gcc have a simplify libcalls pass that recognises both functions and will elide the call in preference to a small set of inline stores. However(), memset is to be preferred in this idiom because the compiler provides better diagnostics in the case of error: bzero.c:9:22: warning: 'memset' call operates on objects of type 'struct foo' while the size is based on a different type 'struct foo *' [-Wsizeof-pointer-memaccess] memset(f, 0, sizeof(f)); ~^ bzero.c:9:22: note: did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)? memset(f, 0, sizeof(f)); ^ The same line with bzero(f, sizeof(f)) generates no error. David signature.asc Description: Message signed with OpenPGP using GPGMail
svn commit: r253649 - head/bin/sh
Author: jilles Date: Thu Jul 25 13:09:17 2013 New Revision: 253649 URL: http://svnweb.freebsd.org/changeset/base/253649 Log: sh: Remove output.c's reset() handler. These cleanup operations are not needed because they are already performed after an optimized command substitution (whether there was an error or not). Modified: head/bin/sh/output.c Modified: head/bin/sh/output.c == --- head/bin/sh/output.cThu Jul 25 12:43:22 2013(r253648) +++ head/bin/sh/output.cThu Jul 25 13:09:17 2013(r253649) @@ -75,25 +75,6 @@ struct output memout = {NULL, 0, NULL, 0 struct output *out1 = &output; struct output *out2 = &errout; - - -#ifdef mkinit - -INCLUDE "output.h" -INCLUDE "memalloc.h" - -RESET { - out1 = &output; - out2 = &errout; - if (memout.buf != NULL) { - ckfree(memout.buf); - memout.buf = NULL; - } -} - -#endif - - void outcslow(int c, struct output *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"
Re: svn commit: r253346 - in head/sys: kern net netgraph netgraph/bluetooth/socket
On Thu, Jul 25, 2013 at 12:24:53PM +0200, Marko Zec wrote: > On Thursday 25 July 2013 11:36:46 Craig Rodrigues wrote: > > On Thu, Jul 25, 2013 at 1:07 AM, Marius Strobl > wrote: > > > Uhm - do we really need to have that layering violation in subr_bus.c? > > > Wouldn't it be sufficient to set curthread->td_vnet to vnet0 in > > > if_alloc(9) or if_attach(9) at least instead? > > > > There was some discussion about this involving Marko Zec, Adrian Chadd, > > and myself > > starting in this thread: > > > > http://lists.freebsd.org/pipermail/svn-src-all/2013-July/071798.html > > > > Adrian and Marko converged on similar patches: > > > > http://lists.freebsd.org/pipermail/freebsd-hackers/2012-November/041120.h > >tml > > http://people.freebsd.org/~adrian/ath/20130712-vimage-default-attach-deta > >ch.diff > > > > > > As Marko mentioned in another e-mail on this thread, the patch as it is > > necessary in > > order to fix VIMAGE related kernel panics in many different scenarios, > > including > > ones involving Netgraph nodes. > > Moreover, unconditionally setting curvnet to vnet0 in if_alloc(), > if_attach() or similar places as suggested my Marius simply couldn't work, > because that would break creation of pseudo-interfaces inside non-vnet0 > contexts (such as vlan, ng_ether, ng_eiface etc.). > Well, I didn't say that it shall be unconditional; in a previous version of the patch Adrian also set it conditionally only in case vnet isn't vnet0 in device_probe_and_attach() so it seems viable to check whether that's needed in a particular context. As for Netgraph nodes I don't know how these are attached to devices but a quick look at the code suggests that f. e. ng_make_node_common() would be a good candidate for setting vnet to vnet0 if necessary. Moving this network specific stuff out of the generic device layer would also make things consistent and symmetric given that r253346 added setting vnet to if_detach(), if_free() and ng_unref_node(). Marius ___ 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: r253650 - head/bin/sh
Author: jilles Date: Thu Jul 25 15:08:41 2013 New Revision: 253650 URL: http://svnweb.freebsd.org/changeset/base/253650 Log: sh: Remove mkinit. Replace the RESET blocks with regular functions and a reset() function that calls them all. This code generation tool is unusual and does not appear to provide much benefit. I do not think isolating the knowledge about which modules need to be reset is worth an almost 500-line build tool and wider scope for variables used by the reset functions. Also, relying on reset functions is often wrong: the cleanup should be done in exception handlers so that no stale state remains after 'command eval' and the like. Deleted: head/bin/sh/init.h head/bin/sh/mkinit.c Modified: head/bin/sh/Makefile head/bin/sh/TOUR head/bin/sh/eval.c head/bin/sh/eval.h head/bin/sh/exec.c head/bin/sh/input.c head/bin/sh/input.h head/bin/sh/main.c head/bin/sh/parser.c head/bin/sh/parser.h head/bin/sh/redir.c head/bin/sh/redir.h Modified: head/bin/sh/Makefile == --- head/bin/sh/MakefileThu Jul 25 13:09:17 2013(r253649) +++ head/bin/sh/MakefileThu Jul 25 15:08:41 2013(r253650) @@ -8,7 +8,7 @@ SHSRCS= alias.c arith_yacc.c arith_yylex histedit.c input.c jobs.c kill.c mail.c main.c memalloc.c miscbltin.c \ mystring.c options.c output.c parser.c printf.c redir.c show.c \ test.c trap.c var.c -GENSRCS= builtins.c init.c nodes.c syntax.c +GENSRCS= builtins.c nodes.c syntax.c GENHDRS= builtins.h nodes.h syntax.h token.h SRCS= ${SHSRCS} ${GENSRCS} ${GENHDRS} @@ -30,26 +30,21 @@ WFORMAT=0 ${.CURDIR}/../test \ ${.CURDIR}/../../usr.bin/printf -CLEANFILES+= mkinit mkinit.o mknodes mknodes.o \ +CLEANFILES+= mknodes mknodes.o \ mksyntax mksyntax.o CLEANFILES+= ${GENSRCS} ${GENHDRS} -build-tools: mkinit mknodes mksyntax +build-tools: mknodes mksyntax .ORDER: builtins.c builtins.h builtins.c builtins.h: mkbuiltins builtins.def sh ${.CURDIR}/mkbuiltins ${.CURDIR} -init.c: mkinit alias.c eval.c exec.c input.c jobs.c options.c parser.c \ - redir.c trap.c var.c - ./mkinit ${.ALLSRC:S/^mkinit$//} - # XXX this is just to stop the default .c rule being used, so that the # intermediate object has a fixed name. # XXX we have a default .c rule, but no default .o rule. .o: ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} -mkinit: mkinit.o mknodes: mknodes.o mksyntax: mksyntax.o Modified: head/bin/sh/TOUR == --- head/bin/sh/TOURThu Jul 25 13:09:17 2013(r253649) +++ head/bin/sh/TOURThu Jul 25 15:08:41 2013(r253650) @@ -25,38 +25,11 @@ programs is: program input files generates --- --- - mkbuiltins builtinsbuiltins.h builtins.c -mkinit *.c init.c mknodes nodetypes nodes.h nodes.c mksyntax- syntax.h syntax.c mktokens- token.h -There are undoubtedly too many of these. Mkinit searches all the -C source files for entries looking like: - -RESET { - x = 2;/* executed when the shell does a longjmp - back to the main command loop */ -} - -It pulls this code out into routines which are when particular -events occur. The intent is to improve modularity by isolating -the information about which modules need to be explicitly -initialized/reset within the modules themselves. - -Mkinit recognizes several constructs for placing declarations in -the init.c file. -INCLUDE "file.h" -includes a file. The storage class MKINIT makes a declaration -available in the init.c file, for example: -MKINIT int funcnest;/* depth of function calls */ -MKINIT alone on a line introduces a structure or union declara- -tion: -MKINIT -struct redirtab { - short renamed[10]; -}; -Preprocessor #define statements are copied to init.c without any -special action to request this. +There are undoubtedly too many of these. EXCEPTIONS: Code for dealing with exceptions appears in exceptions.c. The C language doesn't include exception handling, Modified: head/bin/sh/eval.c == --- head/bin/sh/eval.c Thu Jul 25 13:09:17 2013(r253649) +++ head/bin/sh/eval.c Thu Jul 25 15:08:41 2013(r253650) @@ -104,16 +104,13 @@ static void prehash(union node *); * Called to reset things after an exception. */ -#ifdef mkinit -INCLUDE "eval.h" - -RESET { +void +reseteval(void) +{ evalskip = 0; loopnest = 0; funcnest = 0; } -#endif - /* Modified: he
Re: svn commit: r253636 - head/sys/vm
On Thu, Jul 25, 2013 at 4:43 AM, David Chisnall wrote: > However(), memset is to be preferred in this idiom because the compiler > provides better diagnostics in the case of error: > > bzero.c:9:22: warning: 'memset' call operates on objects of type 'struct > foo' > while the size is based on a different type 'struct foo *' > [-Wsizeof-pointer-memaccess] > memset(f, 0, sizeof(f)); >~^ > bzero.c:9:22: note: did you mean to dereference the argument to 'sizeof' > (and > multiply it by the number of elements)? > memset(f, 0, sizeof(f)); > ^ > > The same line with bzero(f, sizeof(f)) generates no error. > Isn't that a compiler bug? memset(p, 0, n) is the same as bzero(p, n). Why would the compiler warn on one and not the other? Does clang have a similar bias for memcpy versus bcopy? Thanks, matthew ___ 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: r253614 - head/usr.bin/patch
On 25.07.2013 05:27, Alexey Dokuchaev wrote: All the comments in that file have that same problem. At least now we are consistently inconsistent. ;-) Yes, I defininitely missed a wink there :). This is not a change I feel I should spend more time on though. Submitted by:gogolok $ finger gogo...@freebsd.org [...] finger: gogolok: no such user ?? @google ... I actually don't have more information about the submitter: My point was that "short" should only be used for our fellow committers. Ugh ... point taken. The problem with unwritten rules is that someone can always abuse them in the name of lazyness. I will be more careful next time. Pedro. ___ 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: r253651 - head/sys/fs/ext2fs
Author: pfg Date: Thu Jul 25 15:34:20 2013 New Revision: 253651 URL: http://svnweb.freebsd.org/changeset/base/253651 Log: ext2fs: Don't assume that on-disk format of a directory is the same as in ext2_readdir() has always been very fs specific and different with respect to its ufs_ counterpart. Recent changes from UFS have made it possible to share more closely the implementation. MFUFS r252438: Always start parsing at DIRBLKSIZ aligned offset, skip first entries if uio_offset is not DIRBLKSIZ aligned. Return EINVAL if buffer is too small for single entry. Preallocate buffer for cookies. Skip entries with zero inode number. Reviewed by: gleb, Zheng Liu MFC after:1 month Modified: head/sys/fs/ext2fs/ext2_lookup.c Modified: head/sys/fs/ext2fs/ext2_lookup.c == --- head/sys/fs/ext2fs/ext2_lookup.cThu Jul 25 15:08:41 2013 (r253650) +++ head/sys/fs/ext2fs/ext2_lookup.cThu Jul 25 15:34:20 2013 (r253651) @@ -128,33 +128,40 @@ ext2_is_dot_entry(struct componentname * /* * Vnode op for reading directories. - * - * This function has to convert directory entries from the on-disk - * format to the format defined by . Unfortunately, the - * conversion will blow up some entries by four bytes, so it can't be - * done in place. Instead, the conversion is done entry by entry and - * the converted entry is sent via uiomove. - * - * XXX allocate a buffer, convert as many entries as possible, then send - * the whole buffer to uiomove */ int ext2_readdir(struct vop_readdir_args *ap) { + struct vnode *vp = ap->a_vp; struct uio *uio = ap->a_uio; - int count, error; - - struct ext2fs_direct_2 *edp, *dp; - int ncookies; + struct buf *bp; + struct inode *ip; + struct ext2fs_direct_2 *dp, *edp; + u_long *cookies; struct dirent dstdp; - struct uio auio; - struct iovec aiov; - caddr_t dirbuf; + off_t offset, startoffset; + size_t readcnt, skipcnt; + ssize_t startresid; + int ncookies; int DIRBLKSIZ = VTOI(ap->a_vp)->i_e2fs->e2fs_bsize; - int readcnt; - off_t startoffset = uio->uio_offset; + int error; - count = uio->uio_resid; + ip = VTOI(vp); + if (ap->a_ncookies != NULL) { + ncookies = uio->uio_resid; + if (uio->uio_offset >= ip->i_size) + ncookies = 0; + else if (ip->i_size - uio->uio_offset < ncookies) + ncookies = ip->i_size - uio->uio_offset; + ncookies = ncookies / (offsetof(struct ext2fs_direct_2, + e2d_namlen) + 4) + 1; + cookies = malloc(ncookies * sizeof(*cookies), M_TEMP, M_WAITOK); + *ap->a_ncookies = ncookies; + *ap->a_cookies = cookies; + } else { + ncookies = 0; + cookies = NULL; + } /* * Avoid complications for partial directory entries by adjusting * the i/o to end at a block boundary. Don't give up (like ufs @@ -163,25 +170,33 @@ ext2_readdir(struct vop_readdir_args *ap * size is a little larger than DIRBLKSIZ to allow for expansion * of directory entries, but some callers just use 512. */ - count -= (uio->uio_offset + count) & (DIRBLKSIZ -1); - if (count <= 0) - count += DIRBLKSIZ; - auio = *uio; - auio.uio_iov = &aiov; - auio.uio_iovcnt = 1; - auio.uio_resid = count; - auio.uio_segflg = UIO_SYSSPACE; - aiov.iov_len = count; - dirbuf = malloc(count, M_TEMP, M_WAITOK); - aiov.iov_base = dirbuf; - error = VOP_READ(ap->a_vp, &auio, 0, ap->a_cred); - if (error == 0) { - readcnt = count - auio.uio_resid; - edp = (struct ext2fs_direct_2 *)&dirbuf[readcnt]; - ncookies = 0; - bzero(&dstdp, offsetof(struct dirent, d_name)); - for (dp = (struct ext2fs_direct_2 *)dirbuf; - !error && uio->uio_resid > 0 && dp < edp; ) { + if (uio->uio_offset < 0) + offset = startoffset = uio->uio_offset + DIRBLKSIZ; + else + offset = startoffset = uio->uio_offset; + startresid = uio->uio_resid; + error = 0; + while (error == 0 && uio->uio_resid > 0 && + uio->uio_offset < ip->i_size) { + error = ext2_blkatoff(vp, uio->uio_offset, NULL, &bp); + if (error) + break; + if (bp->b_offset + bp->b_bcount > ip->i_size) + readcnt = ip->i_size - bp->b_offset; + else + readcnt = bp->b_bcount; + skipcnt = (size_t)(uio->uio_offset - bp->b_offset) & + ~(size_t)(DIRBLKSIZ - 1); + offset = bp->b_offset
Re: svn commit: r253346 - in head/sys: kern net netgraph netgraph/bluetooth/socket
On Thu, 25 Jul 2013, Marko Zec wrote: On Thursday 25 July 2013 10:07:58 Marius Strobl wrote: On Mon, Jul 15, 2013 at 01:32:55AM +, Craig Rodrigues wrote: Author: rodrigc Date: Mon Jul 15 01:32:55 2013 New Revision: 253346 URL: http://svnweb.freebsd.org/changeset/base/253346 Log: PR: 168520 170096 Submitted by: adrian, zec Fix multiple kernel panics when VIMAGE is enabled in the kernel. These fixes are based on patches submitted by Adrian Chadd and Marko Zec. (1) Set curthread->td_vnet to vnet0 in device_probe_and_attach() just before calling device_attach(). This fixes multiple VIMAGE related kernel panics when trying to attach Bluetooth or USB Ethernet devices because curthread->td_vnet is NULL. (2) Set curthread->td_vnet in if_detach(). This fixes kernel panics when detaching networking interfaces, especially USB Ethernet devices. (3) Use VNET_DOMAIN_SET() in ng_btsocket.c (4) In ng_unref_node() set curthread->td_vnet. This fixes kernel panics when detaching Netgraph nodes. Modified: head/sys/kern/subr_bus.c head/sys/net/if.c head/sys/netgraph/bluetooth/socket/ng_btsocket.c head/sys/netgraph/ng_base.c Modified: head/sys/kern/subr_bus.c === === --- head/sys/kern/subr_bus.cMon Jul 15 00:49:10 2013 (r253345) +++ head/sys/kern/subr_bus.cMon Jul 15 01:32:55 2013(r253346) @@ -53,6 +53,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include @@ -2735,7 +2737,11 @@ device_probe_and_attach(device_t dev) return (0); else if (error != 0) return (error); - return (device_attach(dev)); + + CURVNET_SET_QUIET(vnet0); + error = device_attach(dev); + CURVNET_RESTORE(); + return error; } Uhm - do we really need to have that layering violation in subr_bus.c? Wouldn't it be sufficient to set curthread->td_vnet to vnet0 in if_alloc(9) or if_attach(9) at least instead? That wouldn't solve the issues with attaching netgraph node(s) to the arriving device, nor potentially other issues unrelated to if_alloc or if_attach. This patch also has some style bugs (change from silly parentheses around the return value to none. 2 returns in unchanged code visible in the patch still use normal style). Bruce ___ 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: r253346 - in head/sys: kern net netgraph netgraph/bluetooth/socket
There's already a layering violation. It's called "giving a default vnet context during initial system bring up rather than properly figuring out where to sneak it in." That's the root cause that hid all of this crap. -adrian ___ 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: r253618 - head/sys/dev/usb/gadget
On Wednesday, July 24, 2013 2:32:15 pm David E. O'Brien wrote: > Author: obrien > Date: Wed Jul 24 18:32:15 2013 > New Revision: 253618 > URL: http://svnweb.freebsd.org/changeset/base/253618 > > Log: > per style(9): > Kernel include files (i.e. sys/*.h) come first; normally, include > OR , but not both. includes > , and it is okay to depend on that. This is not fully correct. The consistent style throughout the tree when using _FBSDID() is: #include __FBSDID() #include ... Please fix these to match that. It might not be a bad idea to document the __FBSDID() practice in style.9 while you are at it. -- 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"
svn commit: r253652 - head/sys/fs/ext2fs
Author: pfg Date: Thu Jul 25 16:04:55 2013 New Revision: 253652 URL: http://svnweb.freebsd.org/changeset/base/253652 Log: ext2fs: Drop a check that wan't supposed to be in r253651. MFC after:1 month Modified: head/sys/fs/ext2fs/ext2_lookup.c Modified: head/sys/fs/ext2fs/ext2_lookup.c == --- head/sys/fs/ext2fs/ext2_lookup.cThu Jul 25 15:34:20 2013 (r253651) +++ head/sys/fs/ext2fs/ext2_lookup.cThu Jul 25 16:04:55 2013 (r253652) @@ -170,10 +170,7 @@ ext2_readdir(struct vop_readdir_args *ap * size is a little larger than DIRBLKSIZ to allow for expansion * of directory entries, but some callers just use 512. */ - if (uio->uio_offset < 0) - offset = startoffset = uio->uio_offset + DIRBLKSIZ; - else - offset = startoffset = uio->uio_offset; + offset = startoffset = uio->uio_offset; startresid = uio->uio_resid; error = 0; while (error == 0 && uio->uio_resid > 0 && ___ 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: r253653 - head/sys/ofed/drivers/net/mlx4
Author: jhb Date: Thu Jul 25 16:34:34 2013 New Revision: 253653 URL: http://svnweb.freebsd.org/changeset/base/253653 Log: Avoid trashing IP fragments: - Only enable UDP/TCP hardware checksums if CSUM_UDP or CSUM_TCP is set. - Only enable IP hardware checksums if CSUM_IP is set. PR: kern/180430 Submitted by: Meny Yossefi MFC after:1 week Modified: head/sys/ofed/drivers/net/mlx4/en_tx.c Modified: head/sys/ofed/drivers/net/mlx4/en_tx.c == --- head/sys/ofed/drivers/net/mlx4/en_tx.c Thu Jul 25 16:04:55 2013 (r253652) +++ head/sys/ofed/drivers/net/mlx4/en_tx.c Thu Jul 25 16:34:34 2013 (r253653) @@ -780,8 +780,12 @@ retry: tx_desc->ctrl.srcrb_flags = cpu_to_be32(MLX4_WQE_CTRL_CQ_UPDATE | MLX4_WQE_CTRL_SOLICITED); if (mb->m_pkthdr.csum_flags & (CSUM_IP|CSUM_TCP|CSUM_UDP)) { - tx_desc->ctrl.srcrb_flags |= cpu_to_be32(MLX4_WQE_CTRL_IP_CSUM | - MLX4_WQE_CTRL_TCP_UDP_CSUM); + if (mb->m_pkthdr.csum_flags & CSUM_IP) + tx_desc->ctrl.srcrb_flags |= + cpu_to_be32(MLX4_WQE_CTRL_IP_CSUM); + if (mb->m_pkthdr.csum_flags & (CSUM_TCP|CSUM_UDP)) + tx_desc->ctrl.srcrb_flags |= + cpu_to_be32(MLX4_WQE_CTRL_TCP_UDP_CSUM); priv->port_stats.tx_chksum_offload++; } ___ 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: r253644 - head/sys/dev/ata/chipsets
On Thursday, July 25, 2013 5:12:46 am Alexander Motin wrote: > Author: mav > Date: Thu Jul 25 09:12:46 2013 > New Revision: 253644 > URL: http://svnweb.freebsd.org/changeset/base/253644 > > Log: > Add missing NULL check after malloc(M_NOWAIT). > > Submitted by: Dmitry Luhtionov > > Modified: > head/sys/dev/ata/chipsets/ata-promise.c > > Modified: head/sys/dev/ata/chipsets/ata-promise.c > == > --- head/sys/dev/ata/chipsets/ata-promise.c Thu Jul 25 08:41:22 2013 > (r253643) > +++ head/sys/dev/ata/chipsets/ata-promise.c Thu Jul 25 09:12:46 2013 > (r253644) > @@ -287,6 +287,10 @@ ata_promise_chipinit(device_t dev) > /* setup host packet controls */ > hpkt = malloc(sizeof(struct ata_promise_sx4), > M_ATAPCI, M_NOWAIT | M_ZERO); > + if (hpkt == NULL) { > + device_printf(dev, "Cannot allocate HPKT\n"); > + goto failnfree; > + } > mtx_init(&hpkt->mtx, "ATA promise HPKT lock", NULL, MTX_DEF); > TAILQ_INIT(&hpkt->queue); > hpkt->busy = 0; Why not use M_WAITOK here? -- 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: r253636 - head/sys/vm
On Thu, 25 Jul 2013, David Chisnall wrote: On 25 Jul 2013, at 09:11, Hans Petter Selasky wrote: The structure looks like some size, so bzero() might run faster than memset() depending on the compiler settings. Should be profiled before changed! They will generate identical code for small structures with known sizes. Both clang and gcc have a simplify libcalls pass that recognises both functions and will elide the call in preference to a small set of inline stores. In the kernel, compilers are prevented from inlining memset() and many other things by -ffreestanding in CFLAGS. This rarely matters, and no one except me cares. In my version, memset() doesn't exist, but bzero() has the micro-optimization of turning itself into __builtin_memset() if the size is small (<= 32). My memcpy() has the micro-optimization of turning itself into __builtin_memcpy() unconditionally. __builtin_memcpy() then turns itself back into extern memcpy() according to the inverse of a similar size check. I think extern memcmp() still doesn't exist in the FreeBSD kernel, so simply using __builtin_memset() would give linkage errors when __builtin_memcmp() turns itself back into memcmp(). Determining whether the size is "small" is difficult. It is very CPU-dependent, and also depends on how efficient the extern function is. Compilers once used a very large limits for inlining, but changed to fairly small limits when they realized that they didn't understand memory. Extern functions are hard to optimize, since the correct optimization depends on the CPU including its cache organization. FreeBSD's x86 bcopy() and bzero() are still optimized for generic CPUs. Generic means approximately the original i386, but since these are important operations, all CPUs run the old i386 code for them not to badly (perhaps only twice as slow as possible), with newer Intel systems doing it better than most. Use of memcpy() in the kernel is the result of previous micro-optimizations. It was supposed to be used only for small fixed-size copies. This could have been done better by making bcopy() inline and calling __builtin_memcpy() in this case. The extern memcpy() should never have been used, but was needed for cases where __builtin_memcpy() turns itself into memcpy(), which happened mainly when compiling with -O0. Other uses of memcpy() were style bugs. No one cared when this optimization was turned into a style bug in all cases by -ffreestanding. However(), memset is to be preferred in this idiom because the compiler provides better diagnostics in the case of error: bzero.c:9:22: warning: 'memset' call operates on objects of type 'struct foo' while the size is based on a different type 'struct foo *' [-Wsizeof-pointer-memaccess] memset(f, 0, sizeof(f)); ~^ bzero.c:9:22: note: did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)? memset(f, 0, sizeof(f)); ^ The same line with bzero(f, sizeof(f)) generates no error. This is compiler bug with -ffreestanding. Then memset() is not special. clang allows me to declare my own memset but still prints this warning if the API is not too different: no warning for "void memset(int *, int)", but warning for "int memset(int *, int, int)". The warning seems to be based on the function name, since it is not claimed that the function is standard (even without -ffreestanding). While testing this, I mistyped an &f as &foo, where &foo is a function name. clang doesn't warn about this. clang warned when memset was my home made "int memset(int *, int, int)", because the function pointer isn't compatible with int *. But it also isn't compatible with void *. I think casting NULL to a function pointer must work even if NULL is spelled with a void *, but that is the only case where a void * object pointer can safely be converted to a function pointer. Bruce ___ 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: r253346 - in head/sys: kern net netgraph netgraph/bluetooth/socket
On Thursday 25 July 2013 16:27:43 Marius Strobl wrote: > On Thu, Jul 25, 2013 at 12:24:53PM +0200, Marko Zec wrote: > > On Thursday 25 July 2013 11:36:46 Craig Rodrigues wrote: > > > On Thu, Jul 25, 2013 at 1:07 AM, Marius Strobl > > > > wrote: > > > > Uhm - do we really need to have that layering violation in > > > > subr_bus.c? Wouldn't it be sufficient to set curthread->td_vnet to > > > > vnet0 in if_alloc(9) or if_attach(9) at least instead? > > > > > > There was some discussion about this involving Marko Zec, Adrian > > > Chadd, and myself > > > starting in this thread: > > > > > > http://lists.freebsd.org/pipermail/svn-src-all/2013-July/071798.html > > > > > > Adrian and Marko converged on similar patches: > > > > > > http://lists.freebsd.org/pipermail/freebsd-hackers/2012-November/0411 > > >20.h tml > > > http://people.freebsd.org/~adrian/ath/20130712-vimage-default-attach- > > >deta ch.diff > > > > > > > > > As Marko mentioned in another e-mail on this thread, the patch as it > > > is necessary in > > > order to fix VIMAGE related kernel panics in many different > > > scenarios, including > > > ones involving Netgraph nodes. > > > > Moreover, unconditionally setting curvnet to vnet0 in if_alloc(), > > if_attach() or similar places as suggested my Marius simply couldn't > > work, because that would break creation of pseudo-interfaces inside > > non-vnet0 contexts (such as vlan, ng_ether, ng_eiface etc.). > > Well, I didn't say that it shall be unconditional; in a previous > version of the patch Adrian also set it conditionally only in case > vnet isn't vnet0 in device_probe_and_attach() so it seems viable to > check whether that's needed in a particular context. When a function which is expected to be called with curvnet properly set is called with curvnet being NULL, it should panic (or crash), not guess which vnet the caller should have set, but failed to do. Otherwise, we would have tons of subtle inter-vnet leaks (towards vnet0) which could be very difficult to track and nail down. Hell, why not set curvnet to vnet0 at boot time and NEVER revert it back to NULL, while only occasionally switching to non-default vnets - how would we swim in that kind of mud? > As for Netgraph nodes I don't know how these are attached to devices > but a quick look at the code suggests that f. e. ng_make_node_common() > would be a good candidate for setting vnet to vnet0 if necessary. > Moving this network specific stuff out of the generic device layer > would also make things consistent and symmetric given that r253346 > added setting vnet to if_detach(), if_free() and ng_unref_node(). In all the functions you're refering to here, vnet context is unambiguously defined by the object passed as function's argument, so it is perfectly safe to do CURVNET_SET(ifp->if_vnet) or CURVNET_SET(ng_node->nd_vnet), which is very different from the proposal for pure guessing in if_attach() etc. which I am strongly opposed to. Marko ___ 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: r253654 - head/sys/dev/uart
Author: marcel Date: Thu Jul 25 16:57:27 2013 New Revision: 253654 URL: http://svnweb.freebsd.org/changeset/base/253654 Log: Set the device description after we call uart_probe(). In uart_probe() we call device-specific probe functions, which can (and typically will) set the device description based on low-level device probe information. In the end we never actually used the device description that we so carefully maintained in the PCI match table. By setting the device description after we call uart_probe(), we'll print the more user- friendly description by default. Modified: head/sys/dev/uart/uart_bus_pci.c Modified: head/sys/dev/uart/uart_bus_pci.c == --- head/sys/dev/uart/uart_bus_pci.cThu Jul 25 16:34:34 2013 (r253653) +++ head/sys/dev/uart/uart_bus_pci.cThu Jul 25 16:57:27 2013 (r253654) @@ -162,6 +162,7 @@ uart_pci_probe(device_t dev) { struct uart_softc *sc; const struct pci_id *id; + int result; sc = device_get_softc(dev); @@ -174,9 +175,14 @@ uart_pci_probe(device_t dev) return (ENXIO); match: + result = uart_bus_probe(dev, 0, id->rclk, id->rid, 0); + /* Bail out on error. */ + if (result > 0) + return (result); + /* Set/override the device description. */ if (id->desc) device_set_desc(dev, id->desc); - return (uart_bus_probe(dev, 0, id->rclk, id->rid, 0)); + return (result); } DRIVER_MODULE(uart, pci, uart_pci_driver, uart_devclass, NULL, NULL); ___ 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: r253618 - head/sys/dev/usb/gadget
On Wed, 24 Jul 2013, John Baldwin wrote: On Wednesday, July 24, 2013 2:32:15 pm David E. O'Brien wrote: Author: obrien Date: Wed Jul 24 18:32:15 2013 New Revision: 253618 URL: http://svnweb.freebsd.org/changeset/base/253618 Log: per style(9): Kernel include files (i.e. sys/*.h) come first; normally, include OR , but not both. includes , and it is okay to depend on that. This is not fully correct. The consistent style throughout the tree when using _FBSDID() is: #include __FBSDID() #include ... Please fix these to match that. It might not be a bad idea to document the __FBSDID() practice in style.9 while you are at it. This ugliness (sys/cdefs.h before __FBSDID()) is to avoid changing all the includes of sys/param.h and sys/types.h or even anyother.h that followed the old style rule. As is common, style(9) documents the rule for sys/cdefs.h before __FBSDID() only by example. Its main text wasn't changed and still emphasizes depending on getting sys/cdefs.h from sys/param.h or sys/types.h and not from anywhere else. But almost everywhere else now includes it too, and with it included before __FBSDID(), almost all direct includes of it not before __FBSDID() are style bugs. Bruce ___ 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: r253644 - head/sys/dev/ata/chipsets
On 25.07.2013 19:14, John Baldwin wrote: On Thursday, July 25, 2013 5:12:46 am Alexander Motin wrote: Author: mav Date: Thu Jul 25 09:12:46 2013 New Revision: 253644 URL: http://svnweb.freebsd.org/changeset/base/253644 Log: Add missing NULL check after malloc(M_NOWAIT). Submitted by:Dmitry Luhtionov Modified: head/sys/dev/ata/chipsets/ata-promise.c Modified: head/sys/dev/ata/chipsets/ata-promise.c == --- head/sys/dev/ata/chipsets/ata-promise.c Thu Jul 25 08:41:22 2013 (r253643) +++ head/sys/dev/ata/chipsets/ata-promise.c Thu Jul 25 09:12:46 2013 (r253644) @@ -287,6 +287,10 @@ ata_promise_chipinit(device_t dev) /* setup host packet controls */ hpkt = malloc(sizeof(struct ata_promise_sx4), M_ATAPCI, M_NOWAIT | M_ZERO); + if (hpkt == NULL) { + device_printf(dev, "Cannot allocate HPKT\n"); + goto failnfree; + } mtx_init(&hpkt->mtx, "ATA promise HPKT lock", NULL, MTX_DEF); TAILQ_INIT(&hpkt->queue); hpkt->busy = 0; Why not use M_WAITOK here? I have no strong opinion. I was going to do it first because only Giant is held at that point. But looking on different device_XXX() internals and other code I've found that they prefer to use M_NOWAIT in alike places. While Giant allows sleeping, it is dropped during sleep, that I guess is not really safe. -- Alexander Motin ___ 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: r253563 - head/contrib/libstdc++/include/c_std
On Tue, 23 Jul 2013 10:23:43 + (UTC) David Chisnall wrote: > Author: theraven > Date: Tue Jul 23 10:23:43 2013 > New Revision: 253563 > URL: http://svnweb.freebsd.org/changeset/base/253563 > > Log: > Add isnan() and isinf() to the global namespace in libstdc++'s . > > The standard (n3242, section 17.6.1.1, paragraph 4) says that, because > these are > declared as macros in the C specification (even though they are > implemented as functions in the C++ library) they should be in the global > namespace. > > A surprising number of configure checks rely on this. It was broken by > recent > cleanups to math.h. > > Modified: > head/contrib/libstdc++/include/c_std/std_cmath.h > > Modified: head/contrib/libstdc++/include/c_std/std_cmath.h > == > --- head/contrib/libstdc++/include/c_std/std_cmath.h Tue Jul 23 05:11:22 > 2013(r253562) > +++ head/contrib/libstdc++/include/c_std/std_cmath.h Tue Jul 23 10:23:43 > 2013(r253563) > @@ -589,6 +589,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) > { return ::__gnu_cxx::__capture_isunordered(__f1, __f2); } > > _GLIBCXX_END_NAMESPACE > +using std::isnan; > +using std::isinf; > > #endif /* _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC */ > #endif Doesn't this violate C++98/C++03? The quote above is for C++11. I think the real issue here is that isnan/isinf functions were completely removed from math.h instead of just hidden for C++11 (with some #if). This also broke compilation of C code with -D_XOPEN_SOURCE=500. signature.asc Description: PGP signature
svn commit: r253655 - head/sys/net
Author: adrian Date: Thu Jul 25 19:10:23 2013 New Revision: 253655 URL: http://svnweb.freebsd.org/changeset/base/253655 Log: Fix typo. Sponsored by: Netflix Modified: head/sys/net/ieee8023ad_lacp.c Modified: head/sys/net/ieee8023ad_lacp.c == --- head/sys/net/ieee8023ad_lacp.c Thu Jul 25 16:57:27 2013 (r253654) +++ head/sys/net/ieee8023ad_lacp.c Thu Jul 25 19:10:23 2013 (r253655) @@ -1343,7 +1343,7 @@ re_eval: case LACP_MUX_DISTRIBUTING: if (selected != LACP_SELECTED || !p_sync || !p_collecting) { new_state = LACP_MUX_COLLECTING; - lacp_dprintf(lp, "Interface stopped DISTRIBUTING, possible flaping\n"); + lacp_dprintf(lp, "Interface stopped DISTRIBUTING, possible flapping\n"); sc->sc_flapping++; } break; ___ 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: r253656 - head/lib/libc/sys
Author: jhb Date: Thu Jul 25 19:34:24 2013 New Revision: 253656 URL: http://svnweb.freebsd.org/changeset/base/253656 Log: Enhance the description of NOTE_TRACK: - NOTE_TRACK has never triggered a NOTE_TRACK event from the parent pid. If NOTE_FORK is set, the listener will get a NOTE_FORK event from the parent pid, but not a separate NOTE_TRACK event. - Explicitly note that the event added to monitor the child process preserves the fflags from the original event. - Move the description of NOTE_TRACKERR under NOTE_TRACK as it is not a bit for the user to set (which is what this list pupports to be). Also, explicitly note that if an error occurs, the NOTE_CHILD event will not be generated. MFC after:1 week Modified: head/lib/libc/sys/kqueue.2 Modified: head/lib/libc/sys/kqueue.2 == --- head/lib/libc/sys/kqueue.2 Thu Jul 25 19:10:23 2013(r253655) +++ head/lib/libc/sys/kqueue.2 Thu Jul 25 19:34:24 2013(r253656) @@ -388,20 +388,25 @@ The process has called .It NOTE_EXEC The process has executed a new process via .Xr execve 2 -or similar call. +or a similar call. .It NOTE_TRACK Follow a process across .Fn fork calls. -The parent process will return with NOTE_TRACK set in the +The parent process registers a new kevent to monitor the child process +using the same .Va fflags -field, while the child process will return with NOTE_CHILD set in +as the original event. +The child process will signal an event with NOTE_CHILD set in .Va fflags and the parent PID in .Va data . -.It NOTE_TRACKERR -This flag is returned if the system was unable to attach an event to -the child process, usually due to resource limitations. +.Pp +If the parent process fails to register a new kevent +.Pq usually due to resource limitations , +it will signal an event with NOTE_TRACKERR set in +.Va fflags , +and the child process will not signal a NOTE_CHILD event. .El .Pp On return, ___ 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: r253657 - head/sys/fs/ext2fs
Author: pfg Date: Thu Jul 25 19:37:49 2013 New Revision: 253657 URL: http://svnweb.freebsd.org/changeset/base/253657 Log: ext2fs: Return EINVAL for negative uio_offset as in UFS. While here drop old comment that doesn't really apply. MFC after:1 month Discussed with: gleb Modified: head/sys/fs/ext2fs/ext2_lookup.c Modified: head/sys/fs/ext2fs/ext2_lookup.c == --- head/sys/fs/ext2fs/ext2_lookup.cThu Jul 25 19:34:24 2013 (r253656) +++ head/sys/fs/ext2fs/ext2_lookup.cThu Jul 25 19:37:49 2013 (r253657) @@ -146,6 +146,8 @@ ext2_readdir(struct vop_readdir_args *ap int DIRBLKSIZ = VTOI(ap->a_vp)->i_e2fs->e2fs_bsize; int error; + if (uio->uio_offset < 0) + return (EINVAL); ip = VTOI(vp); if (ap->a_ncookies != NULL) { ncookies = uio->uio_resid; @@ -162,14 +164,6 @@ ext2_readdir(struct vop_readdir_args *ap ncookies = 0; cookies = NULL; } - /* -* Avoid complications for partial directory entries by adjusting -* the i/o to end at a block boundary. Don't give up (like ufs -* does) if the initial adjustment gives a negative count, since -* many callers don't supply a large enough buffer. The correct -* size is a little larger than DIRBLKSIZ to allow for expansion -* of directory entries, but some callers just use 512. -*/ offset = startoffset = uio->uio_offset; startresid = uio->uio_resid; error = 0; ___ 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: r253658 - head/bin/sh
Author: jilles Date: Thu Jul 25 19:48:15 2013 New Revision: 253658 URL: http://svnweb.freebsd.org/changeset/base/253658 Log: sh: Remove #define MKINIT. MKINIT only served for the removed mkinit. Many variables can be static now. Modified: head/bin/sh/eval.c head/bin/sh/input.c head/bin/sh/jobs.c head/bin/sh/parser.c head/bin/sh/redir.c head/bin/sh/shell.h head/bin/sh/trap.c Modified: head/bin/sh/eval.c == --- head/bin/sh/eval.c Thu Jul 25 19:37:49 2013(r253657) +++ head/bin/sh/eval.c Thu Jul 25 19:48:15 2013(r253658) @@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$"); int evalskip; /* set if we are skipping commands */ int skipcount; /* number of levels to skip */ -MKINIT int loopnest; /* current loop nesting level */ +static int loopnest; /* current loop nesting level */ int funcnest; /* depth of function calls */ static int builtin_flags; /* evalcommand flags for builtins */ Modified: head/bin/sh/input.c == --- head/bin/sh/input.c Thu Jul 25 19:37:49 2013(r253657) +++ head/bin/sh/input.c Thu Jul 25 19:48:15 2013(r253658) @@ -92,7 +92,7 @@ struct parsefile { int plinno = 1;/* input line number */ int parsenleft;/* copy of parsefile->nleft */ -MKINIT int parselleft; /* copy of parsefile->lleft */ +static int parselleft; /* copy of parsefile->lleft */ const char *parsenextc;/* copy of parsefile->nextc */ static char basebuf[BUFSIZ + 1];/* buffer for top level input file */ static struct parsefile basepf = { /* top level input file */ Modified: head/bin/sh/jobs.c == --- head/bin/sh/jobs.c Thu Jul 25 19:37:49 2013(r253657) +++ head/bin/sh/jobs.c Thu Jul 25 19:48:15 2013(r253658) @@ -77,8 +77,8 @@ __FBSDID("$FreeBSD$"); static struct job *jobtab; /* array of jobs */ static int njobs; /* size of array */ -MKINIT pid_t backgndpid = -1; /* pid of last background process */ -MKINIT struct job *bgjob = NULL; /* last background process */ +static pid_t backgndpid = -1; /* pid of last background process */ +static struct job *bgjob = NULL; /* last background process */ #if JOBS static struct job *jobmru; /* most recently used job list */ static pid_t initialpgrp; /* pgrp of shell on invocation */ @@ -116,7 +116,7 @@ static void showjob(struct job *, int); * Turn job control on and off. */ -MKINIT int jobctl; +static int jobctl; #if JOBS void Modified: head/bin/sh/parser.c == --- head/bin/sh/parser.cThu Jul 25 19:37:49 2013(r253657) +++ head/bin/sh/parser.cThu Jul 25 19:48:15 2013(r253658) @@ -96,9 +96,9 @@ static struct heredoc *heredoclist; /* l static int doprompt; /* if set, prompt the user */ static int needprompt; /* true if interactive and at start of line */ static int lasttoken; /* last token read */ -MKINIT int tokpushback;/* last token pushed back */ +int tokpushback; /* last token pushed back */ static char *wordtext; /* text of last word returned by readtoken */ -MKINIT int checkkwd;/* 1 == check for kwds, 2 == also eat newlines */ +static int checkkwd;/* 1 == check for kwds, 2 == also eat newlines */ static struct nodelist *backquotelist; static union node *redirnode; static struct heredoc *heredoc; Modified: head/bin/sh/redir.c == --- head/bin/sh/redir.c Thu Jul 25 19:37:49 2013(r253657) +++ head/bin/sh/redir.c Thu Jul 25 19:48:15 2013(r253658) @@ -66,14 +66,13 @@ __FBSDID("$FreeBSD$"); #define CLOSED -1 /* fd was not open before redir */ -MKINIT struct redirtab { struct redirtab *next; int renamed[10]; }; -MKINIT struct redirtab *redirlist; +static struct redirtab *redirlist; /* * We keep track of whether or not fd0 has been redirected. This is for Modified: head/bin/sh/shell.h == --- head/bin/sh/shell.h Thu Jul 25 19:37:49 2013(r253657) +++ head/bin/sh/shell.h Thu Jul 25 19:48:15 2013(r253658) @@ -63,7 +63,6 @@ typedef intmax_t arith_t; #defineARITH_MAX INTMAX_MAX typedef void *pointer; -#define MKINIT /* empty */ #include Modified: head/bin/sh/trap.c == --- head/bin/sh/trap.c Thu Jul 25 19:37:49 2013(r253657) +++ head/bin/sh/trap.c Thu Jul 25 19:48:15 2013
svn commit: r253659 - head/bin/sh
Author: jilles Date: Thu Jul 25 20:50:35 2013 New Revision: 253659 URL: http://svnweb.freebsd.org/changeset/base/253659 Log: sh: Remove an incorrect comment. Modified: head/bin/sh/parser.c Modified: head/bin/sh/parser.c == --- head/bin/sh/parser.cThu Jul 25 19:48:15 2013(r253658) +++ head/bin/sh/parser.cThu Jul 25 20:50:35 2013(r253659) @@ -98,7 +98,7 @@ static int needprompt;/* true if inter static int lasttoken; /* last token read */ int tokpushback; /* last token pushed back */ static char *wordtext; /* text of last word returned by readtoken */ -static int checkkwd;/* 1 == check for kwds, 2 == also eat newlines */ +static int checkkwd; static struct nodelist *backquotelist; static union node *redirnode; static struct heredoc *heredoc; ___ 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: r253660 - head/share/man/man9
Author: brooks Date: Thu Jul 25 20:53:15 2013 New Revision: 253660 URL: http://svnweb.freebsd.org/changeset/base/253660 Log: Document the sbinuptime() and getsbinuptime() functions introduced in r247452. Sponsored by: DARPA, AFRL Modified: head/share/man/man9/Makefile head/share/man/man9/microuptime.9 Modified: head/share/man/man9/Makefile == --- head/share/man/man9/MakefileThu Jul 25 20:50:35 2013 (r253659) +++ head/share/man/man9/MakefileThu Jul 25 20:53:15 2013 (r253660) @@ -954,7 +954,9 @@ MLINKS+=microuptime.9 binuptime.9 \ microuptime.9 getbinuptime.9 \ microuptime.9 getmicrouptime.9 \ microuptime.9 getnanouptime.9 \ - microuptime.9 nanouptime.9 + microuptime.9 getsbinuptime.9 \ + microuptime.9 nanouptime.9 \ + microuptime.9 sbinuptime.9 MLINKS+=mi_switch.9 cpu_switch.9 \ mi_switch.9 cpu_throw.9 MLINKS+=mtx_pool.9 mtx_pool_alloc.9 \ Modified: head/share/man/man9/microuptime.9 == --- head/share/man/man9/microuptime.9 Thu Jul 25 20:50:35 2013 (r253659) +++ head/share/man/man9/microuptime.9 Thu Jul 25 20:53:15 2013 (r253660) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 16, 2004 +.Dd July 25, 2013 .Dt MICROUPTIME 9 .Os .Sh NAME @@ -33,7 +33,9 @@ .Nm microuptime , .Nm getmicrouptime , .Nm nanouptime , -.Nm getnanouptime +.Nm getnanouptime , +.Nm sbinuptime , +.Nm getsbinuptime .Nd get the time elapsed since boot .Sh SYNOPSIS .In sys/time.h @@ -49,6 +51,10 @@ .Fn nanouptime "struct timespec *ts" .Ft void .Fn getnanouptime "struct timespec *tsp" +.Ft sbintime_t +.Fn sbinuptime "void" +.Ft sbintime_t +.Fn getsbinuptime "void" .Sh DESCRIPTION The .Fn binuptime @@ -71,28 +77,37 @@ and .Fn getnanouptime functions store the elapsed time as a .Vt "struct timespec" . +The +.Fn sbinuptime +and +.Fn getsbinuptime +functions return the time elapsed since boot as a +.Vt "sbintime_t" . .Pp The .Fn binuptime , .Fn microuptime , +.Fn nanouptime , and -.Fn nanouptime +.Fn sbinuptime functions always query the timecounter to return the current time as precisely as possible. Whereas .Fn getbinuptime , .Fn getmicrouptime , +.Fn getnanouptime , and -.Fn getnanouptime +.Fn getsbinuptime functions are abstractions which return a less precise, but faster to obtain, time. .Pp The intent of the .Fn getbinuptime , .Fn getmicrouptime , +.Fn getnanouptime , and -.Fn getnanouptime +.Fn getsbinuptime functions is to enforce the user's preference for timer accuracy versus execution time. .Sh SEE ALSO ___ 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: r253587 - head/sys/vm
On 7/23/13 6:25 PM, Jeff Roberson wrote: > Author: jeff > Date: Wed Jul 24 01:25:56 2013 > New Revision: 253587 > URL: http://svnweb.freebsd.org/changeset/base/253587 > > Log: >- Remove the long obsolete 'vm_pageout_algorithm' experiment. > There is more of it. diff --git a/lib/libc/gen/sysctl.3 b/lib/libc/gen/sysctl.3 index d689b7c..7d7b90a 100644 --- a/lib/libc/gen/sysctl.3 +++ b/lib/libc/gen/sysctl.3 @@ -735,7 +735,6 @@ privilege may change the value. .It Sy "Second level name TypeChangeable" .It "VM_LOADAVGstruct loadavg no" .It "VM_TOTAL struct vmtotal no" -.It "VM_PAGEOUT_ALGORITHM integer yes" .It "VM_SWAPPING_ENABLED integer maybe" .It "VM_V_CACHE_MAXinteger yes" .It "VM_V_CACHE_MINinteger yes" @@ -754,9 +753,6 @@ The returned data consists of a Return the system wide virtual memory statistics. The returned data consists of a .Va struct vmtotal . -.It Li VM_PAGEOUT_ALGORITHM -0 if the statistics-based page management algorithm is in use -or 1 if the near-LRU algorithm is in use. .It Li VM_SWAPPING_ENABLED 1 if process swapping is enabled or 0 if disabled. This variable is diff --git a/sys/vm/vm_param.h b/sys/vm/vm_param.h index c404989..44306be 100644 --- a/sys/vm/vm_param.h +++ b/sys/vm/vm_param.h @@ -82,9 +82,8 @@ #defineVM_V_CACHE_MIN 7 /* cnt.v_cache_min */ #defineVM_V_CACHE_MAX 8 /* cnt.v_cache_max */ #define VM_V_PAGEOUT_FREE_MIN 9 /* cnt.v_pageout_free_min */ -#defineVM_PAGEOUT_ALGORITHM10 /* pageout algorithm */ -#define VM_SWAPPING_ENABLED11 /* swapping enabled */ -#defineVM_MAXID12 /* number of valid vm ids */ +#define VM_SWAPPING_ENABLED10 /* swapping enabled */ +#defineVM_MAXID11 /* number of valid vm ids */ #define CTL_VM_NAMES { \ { 0, 0 }, \ @@ -97,7 +96,6 @@ { "v_cache_min", CTLTYPE_UINT }, \ { "v_cache_max", CTLTYPE_UINT }, \ { "v_pageout_free_min", CTLTYPE_UINT}, \ - { "pageout_algorithm", CTLTYPE_INT}, \ { "swap_enabled", CTLTYPE_INT},\ } diff --git a/tools/tools/sysdoc/tunables.mdoc b/tools/tools/sysdoc/tunables.mdoc index 35ef9c0..8b426e6 100644 --- a/tools/tools/sysdoc/tunables.mdoc +++ b/tools/tools/sysdoc/tunables.mdoc @@ -2259,9 +2259,6 @@ Displays the number of swap devices available to the system. This is a read-only variable. --- -vm.pageout_algorithm - vm.pageout_full_stats_interval --- -- Andrey Zonov signature.asc Description: OpenPGP digital signature
Re: svn commit: r253587 - head/sys/vm
On Jul 25, 2013, at 3:40 PM, Andrey Zonov wrote: > On 7/23/13 6:25 PM, Jeff Roberson wrote: >> Author: jeff >> Date: Wed Jul 24 01:25:56 2013 >> New Revision: 253587 >> URL: http://svnweb.freebsd.org/changeset/base/253587 >> >> Log: >> - Remove the long obsolete 'vm_pageout_algorithm' experiment. >> > > There is more of it. > Thank you. Please commit this. Alan > diff --git a/lib/libc/gen/sysctl.3 b/lib/libc/gen/sysctl.3 > index d689b7c..7d7b90a 100644 > --- a/lib/libc/gen/sysctl.3 > +++ b/lib/libc/gen/sysctl.3 > @@ -735,7 +735,6 @@ privilege may change the value. > .It Sy "Second level name TypeChangeable" > .It "VM_LOADAVGstruct loadavg no" > .It "VM_TOTAL struct vmtotal no" > -.It "VM_PAGEOUT_ALGORITHM integer yes" > .It "VM_SWAPPING_ENABLED integer maybe" > .It "VM_V_CACHE_MAXinteger yes" > .It "VM_V_CACHE_MINinteger yes" > @@ -754,9 +753,6 @@ The returned data consists of a > Return the system wide virtual memory statistics. > The returned data consists of a > .Va struct vmtotal . > -.It Li VM_PAGEOUT_ALGORITHM > -0 if the statistics-based page management algorithm is in use > -or 1 if the near-LRU algorithm is in use. > .It Li VM_SWAPPING_ENABLED > 1 if process swapping is enabled or 0 if disabled. > This variable is > diff --git a/sys/vm/vm_param.h b/sys/vm/vm_param.h > index c404989..44306be 100644 > --- a/sys/vm/vm_param.h > +++ b/sys/vm/vm_param.h > @@ -82,9 +82,8 @@ > #defineVM_V_CACHE_MIN 7 /* cnt.v_cache_min */ > #defineVM_V_CACHE_MAX 8 /* cnt.v_cache_max */ > #define VM_V_PAGEOUT_FREE_MIN 9 /* cnt.v_pageout_free_min */ > -#defineVM_PAGEOUT_ALGORITHM10 /* pageout algorithm */ > -#define VM_SWAPPING_ENABLED11 /* swapping enabled */ > -#defineVM_MAXID12 /* number of valid vm ids */ > +#define VM_SWAPPING_ENABLED10 /* swapping enabled */ > +#defineVM_MAXID11 /* number of valid vm ids */ > > #define CTL_VM_NAMES { \ >{ 0, 0 }, \ > @@ -97,7 +96,6 @@ >{ "v_cache_min", CTLTYPE_UINT }, \ >{ "v_cache_max", CTLTYPE_UINT }, \ >{ "v_pageout_free_min", CTLTYPE_UINT}, \ > - { "pageout_algorithm", CTLTYPE_INT}, \ >{ "swap_enabled", CTLTYPE_INT},\ > } > > diff --git a/tools/tools/sysdoc/tunables.mdoc > b/tools/tools/sysdoc/tunables.mdoc > index 35ef9c0..8b426e6 100644 > --- a/tools/tools/sysdoc/tunables.mdoc > +++ b/tools/tools/sysdoc/tunables.mdoc > @@ -2259,9 +2259,6 @@ Displays the number of swap devices available > to the system. This is a read-only variable. > > --- > -vm.pageout_algorithm > - > > vm.pageout_full_stats_interval > > --- > > > -- > Andrey Zonov > ___ 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: r253661 - head/cddl/contrib/opensolaris/tools/ctf/cvt
Author: pfg Date: Fri Jul 26 00:28:19 2013 New Revision: 253661 URL: http://svnweb.freebsd.org/changeset/base/253661 Log: Fix a segfault in ctfmerge due to a bug in gcc. GCC can generate bogus dwarf attributes with DW_AT_byte_size set to 0x. The issue was originaly detected in NetBSD but it has been adapted for portability and to avoid compiler warnings. Reference: https://www.illumos.org/issues/3776 Obtained from:NetBSD MFC after:1 month Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c head/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h head/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c head/cddl/contrib/opensolaris/tools/ctf/cvt/st_parse.c Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c == --- head/cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c Thu Jul 25 20:53:15 2013(r253660) +++ head/cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c Fri Jul 26 00:28:19 2013(r253661) @@ -52,6 +52,8 @@ static char *curfile; #defineCTF_BUF_CHUNK_SIZE (64 * 1024) #defineRES_BUF_CHUNK_SIZE (64 * 1024) +static int ntypes=0; /* The number of types. */ + struct ctf_buf { strtab_t ctb_strtab;/* string table */ caddr_t ctb_base; /* pointer to base of buffer */ @@ -1143,6 +1145,10 @@ resurrect_types(ctf_header_t *h, tdata_t (*mpp)->ml_type = tdarr[ctm->ctm_type]; (*mpp)->ml_offset = ctm->ctm_offset; (*mpp)->ml_size = 0; + if (ctm->ctm_type > ntypes) { + parseterminate("Invalid member type ctm_type=%d", + ctm->ctm_type); + } } } else { for (i = 0, mpp = &tdp->t_members; i < vlen; @@ -1159,6 +1165,10 @@ resurrect_types(ctf_header_t *h, tdata_t (*mpp)->ml_offset = (int)CTF_LMEM_OFFSET(ctlm); (*mpp)->ml_size = 0; + if (ctlm->ctlm_type > ntypes) { + parseterminate("Invalid lmember type ctlm_type=%d", + ctlm->ctlm_type); + } } } @@ -1272,9 +1282,10 @@ ctf_parse(ctf_header_t *h, caddr_t buf, { tdata_t *td = tdata_new(); tdesc_t **tdarr; - int ntypes = count_types(h, buf); int idx, i; + ntypes = count_types(h, buf); + /* shudder */ tdarr = xcalloc(sizeof (tdesc_t *) * (ntypes + 1)); tdarr[0] = NULL; Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h == --- head/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h Thu Jul 25 20:53:15 2013(r253660) +++ head/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h Fri Jul 26 00:28:19 2013(r253661) @@ -159,7 +159,7 @@ typedef struct ardef { /* Auxiliary structure for structure/union tdesc_t */ typedef struct mlist { int ml_offset; /* Offset from start of structure (in bits) */ - int ml_size;/* Member size (in bits) */ + uint_t ml_size;/* Member size (in bits) */ char*ml_name; /* Member name */ struct tdesc *ml_type; /* Member type */ struct mlist *ml_next; /* Next member */ Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c == --- head/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c Thu Jul 25 20:53:15 2013(r253660) +++ head/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c Fri Jul 26 00:28:19 2013(r253661) @@ -674,6 +674,13 @@ die_array_create(dwarf_t *dw, Dwarf_Die tdesc_t *dimtdp; int flags; + /* Check for bogus gcc DW_AT_byte_size attribute */ + if (uval == (unsigned)-1) { + printf("dwarf.c:%s() working around bogus -1 DW_AT_byte_size\n", + __func__); + uval = 0; + } + tdp->t_size = uval; /* @@ -760,6 +767,12 @@ die_enum_create(dwarf_t *dw, Dwarf_Die d tdp->t_type = ENUM; (void) die_unsigned(dw, die, DW_AT_byte_size, &uval, DW_ATTR_REQ); + /* Check for bogus gcc DW_AT_byte_size attribute */ + if (uval == (unsigned)-1) { + printf("dwar
svn commit: r253662 - in head: lib/libc/gen sys/vm tools/tools/sysdoc
Author: zont Date: Fri Jul 26 02:00:06 2013 New Revision: 253662 URL: http://svnweb.freebsd.org/changeset/base/253662 Log: Remove define and documentation for vm_pageout_algorithm missed in r253587 Modified: head/lib/libc/gen/sysctl.3 head/sys/vm/vm_param.h head/tools/tools/sysdoc/tunables.mdoc Modified: head/lib/libc/gen/sysctl.3 == --- head/lib/libc/gen/sysctl.3 Fri Jul 26 00:28:19 2013(r253661) +++ head/lib/libc/gen/sysctl.3 Fri Jul 26 02:00:06 2013(r253662) @@ -735,7 +735,6 @@ privilege may change the value. .It Sy "Second level name TypeChangeable" .It "VM_LOADAVGstruct loadavg no" .It "VM_TOTAL struct vmtotal no" -.It "VM_PAGEOUT_ALGORITHM integer yes" .It "VM_SWAPPING_ENABLED integer maybe" .It "VM_V_CACHE_MAXinteger yes" .It "VM_V_CACHE_MINinteger yes" @@ -754,9 +753,6 @@ The returned data consists of a Return the system wide virtual memory statistics. The returned data consists of a .Va struct vmtotal . -.It Li VM_PAGEOUT_ALGORITHM -0 if the statistics-based page management algorithm is in use -or 1 if the near-LRU algorithm is in use. .It Li VM_SWAPPING_ENABLED 1 if process swapping is enabled or 0 if disabled. This variable is Modified: head/sys/vm/vm_param.h == --- head/sys/vm/vm_param.h Fri Jul 26 00:28:19 2013(r253661) +++ head/sys/vm/vm_param.h Fri Jul 26 02:00:06 2013(r253662) @@ -82,9 +82,8 @@ #defineVM_V_CACHE_MIN 7 /* cnt.v_cache_min */ #defineVM_V_CACHE_MAX 8 /* cnt.v_cache_max */ #define VM_V_PAGEOUT_FREE_MIN 9 /* cnt.v_pageout_free_min */ -#defineVM_PAGEOUT_ALGORITHM10 /* pageout algorithm */ -#define VM_SWAPPING_ENABLED11 /* swapping enabled */ -#defineVM_MAXID12 /* number of valid vm ids */ +#define VM_SWAPPING_ENABLED10 /* swapping enabled */ +#defineVM_MAXID11 /* number of valid vm ids */ #define CTL_VM_NAMES { \ { 0, 0 }, \ @@ -97,7 +96,6 @@ { "v_cache_min", CTLTYPE_UINT }, \ { "v_cache_max", CTLTYPE_UINT }, \ { "v_pageout_free_min", CTLTYPE_UINT}, \ - { "pageout_algorithm", CTLTYPE_INT}, \ { "swap_enabled", CTLTYPE_INT},\ } Modified: head/tools/tools/sysdoc/tunables.mdoc == --- head/tools/tools/sysdoc/tunables.mdoc Fri Jul 26 00:28:19 2013 (r253661) +++ head/tools/tools/sysdoc/tunables.mdoc Fri Jul 26 02:00:06 2013 (r253662) @@ -2259,9 +2259,6 @@ Displays the number of swap devices avai to the system. This is a read-only variable. --- -vm.pageout_algorithm - vm.pageout_full_stats_interval --- ___ 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"