svn commit: r265425 - in stable/10: share/man/man4 sys/dev/cxgbe sys/dev/cxgbe/common
Author: np Date: Tue May 6 06:49:39 2014 New Revision: 265425 URL: http://svnweb.freebsd.org/changeset/base/265425 Log: MFC r263317, r263412, and r263451. r263317: cxgbe(4): significant rx rework. - More flexible cluster size selection, including the ability to fall back to a safe cluster size (PAGE_SIZE from zone_jumbop by default) in case an allocation of a larger size fails. - A single get_fl_payload() function that assembles the payload into an mbuf chain for any kind of freelist. This replaces two variants: one for freelists with buffer packing enabled and another for those without. - Buffer packing with any sized cluster. It was limited to 4K clusters only before this change. - Enable buffer packing for TOE rx queues as well. - Statistics and tunables to go with all these changes. The driver's man page will be updated separately. r263412: cxgbe(4): if_iqdrops statistic should include tunnel congestion drops. r263451: cxgbe(4): man page updates. Modified: stable/10/share/man/man4/cxgbe.4 stable/10/sys/dev/cxgbe/adapter.h stable/10/sys/dev/cxgbe/common/t4_hw.h stable/10/sys/dev/cxgbe/t4_main.c stable/10/sys/dev/cxgbe/t4_sge.c Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/cxgbe.4 == --- stable/10/share/man/man4/cxgbe.4Tue May 6 06:18:43 2014 (r265424) +++ stable/10/share/man/man4/cxgbe.4Tue May 6 06:49:39 2014 (r265425) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2011-2013, Chelsio Inc +.\" Copyright (c) 2011-2014, Chelsio Inc .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 18, 2013 +.Dd March 20, 2014 .Dt CXGBE 4 .Os .Sh NAME @@ -141,11 +141,11 @@ prompt before booting the kernel or stor .Xr loader.conf 5 . .Bl -tag -width indent .It Va hw.cxgbe.ntxq10g -The number of tx queues to use for a 10Gb port. +The number of tx queues to use for a 10Gb or 40Gb port. The default is 16 or the number of CPU cores in the system, whichever is less. .It Va hw.cxgbe.nrxq10g -The number of rx queues to use for a 10Gb port. +The number of rx queues to use for a 10Gb or 40Gb port. The default is 8 or the number of CPU cores in the system, whichever is less. .It Va hw.cxgbe.ntxq1g @@ -157,11 +157,11 @@ The number of rx queues to use for a 1Gb The default is 2 or the number of CPU cores in the system, whichever is less. .It Va hw.cxgbe.nofldtxq10g -The number of TOE tx queues to use for a 10Gb port. +The number of TOE tx queues to use for a 10Gb or 40Gb port. The default is 8 or the number of CPU cores in the system, whichever is less. .It Va hw.cxgbe.nofldrxq10g -The number of TOE rx queues to use for a 10Gb port. +The number of TOE rx queues to use for a 10Gb or 40Gb port. The default is 2 or the number of CPU cores in the system, whichever is less. .It Va hw.cxgbe.nofldtxq1g @@ -177,8 +177,7 @@ The timer index value to use to delay in The holdoff timer list has the values 1, 5, 10, 50, 100, and 200 by default (all values are in microseconds) and the index selects a value from this list. -The default value is 1 for both 10Gb and 1Gb ports, which means the -timer value is 5us. +The default value is 1 which means the timer value is 5us. Different interfaces can be assigned different values at any time via the dev.cxgbe.X.holdoff_tmr_idx or dev.cxl.X.holdoff_tmr_idx sysctl. .It Va hw.cxgbe.holdoff_pktc_idx_10G @@ -186,9 +185,8 @@ dev.cxgbe.X.holdoff_tmr_idx or dev.cxl.X The packet-count index value to use to delay interrupts. The packet-count list has the values 1, 8, 16, and 32 by default and the index selects a value from this list. -The default value is -1 for both 10Gb and 1Gb ports, which means packet -counting is disabled and interrupts are generated based solely on the -holdoff timer value. +The default value is -1 which means packet counting is disabled and interrupts +are generated based solely on the holdoff timer value. Different interfaces can be assigned different values via the dev.cxgbe.X.holdoff_pktc_idx or dev.cxl.X.holdoff_pktc_idx sysctl. This sysctl works only when the interface has never been marked up (as done by @@ -228,6 +226,43 @@ already on the card. long as it is compatible with the driver and is a different version than the one already on the card. The default is 1. +.It Va hw.cxgbe.fl_pktshift +The number of bytes of padding inserted before the begining of an Ethernet +frame in the receive buffer. +The default value of 2 ensures that the Ethernet payload (usually the IP header) +is at a 4 byte aligned address. +0-7 are all valid values. +.It Va hw.cxgbe.fl_pad +A non-zero value ensures that writes from the hardware to a receive buffer are +padded up to the specified boundary. +The default is -1 which lets the driver pick a pad boundary. +0 d
svn commit: r265424 - head/sys/dev/mpr
Author: ken Date: Tue May 6 06:18:43 2014 New Revision: 265424 URL: http://svnweb.freebsd.org/changeset/base/265424 Log: Fix a problem with async notifications in the mpr(4) driver. This problem only occurs on versions of FreeBSD prior to the recent CAM locking changes. (i.e. stable/9 and older versions of stable/10) This change should be a no-op for head and stable/10. If a path isn't specified, xpt_register_async() will create a fully wildcarded path and acquire a lock (the XPT lock in older versions, and via xpt_path_lock() in newer versions) to call xpt_action() for the XPT_SASYNC_CB CCB. It will then drop the lock and if the requested event includes AC_FOUND_DEVICE or AC_PATH_REGISTERED, it will get the caller up to date with any device arrivals or path registrations. The issue is that before the locking changes, each SIM lock would get acquired in turn during the EDT tree traversal process. If a path is specified for xpt_register_async(), it won't acquire and drop its own lock, but instead expects the caller to hold its own SIM lock. That works for the first part of xpt_register_async(), but causes a recursive lock acquisition once the EDT traversal happens and it comes to the SIM in question. And it isn't possible to call xpt_action() without holding a SIM lock. The locking changes fix this by using the XPT topology lock for EDT traversal, so it is no longer an issue to hold the SIM lock while calling xpt_register_async(). The solution for FreeBSD versions before the locking changes is to request notification of all device arrivals (so we pass a NULL path into xpt_register_async()) and then filter out the arrivals that are not ours. MFC After:3 days Sponsored by: Spectra Logic Corporation Modified: head/sys/dev/mpr/mpr_sas.c Modified: head/sys/dev/mpr/mpr_sas.c == --- head/sys/dev/mpr/mpr_sas.c Tue May 6 04:22:37 2014(r265423) +++ head/sys/dev/mpr/mpr_sas.c Tue May 6 06:18:43 2014(r265424) @@ -813,8 +813,49 @@ mpr_attach_sas(struct mpr_softc *sc) #else event = AC_FOUND_DEVICE; #endif + + /* +* Prior to the CAM locking improvements, we can't call +* xpt_register_async() with a particular path specified. +* +* If a path isn't specified, xpt_register_async() will +* generate a wildcard path and acquire the XPT lock while +* it calls xpt_action() to execute the XPT_SASYNC_CB CCB. +* It will then drop the XPT lock once that is done. +* +* If a path is specified for xpt_register_async(), it will +* not acquire and drop the XPT lock around the call to +* xpt_action(). xpt_action() asserts that the caller +* holds the SIM lock, so the SIM lock has to be held when +* calling xpt_register_async() when the path is specified. +* +* But xpt_register_async calls xpt_for_all_devices(), +* which calls xptbustraverse(), which will acquire each +* SIM lock. When it traverses our particular bus, it will +* necessarily acquire the SIM lock, which will lead to a +* recursive lock acquisition. +* +* The CAM locking changes fix this problem by acquiring +* the XPT topology lock around bus traversal in +* xptbustraverse(), so the caller can hold the SIM lock +* and it does not cause a recursive lock acquisition. +* +* These __FreeBSD_version values are approximate, especially +* for stable/10, which is two months later than the actual +* change. +*/ + +#if (__FreeBSD_version < 1000703) || \ +((__FreeBSD_version >= 110) && (__FreeBSD_version < 112)) + mpr_unlock(sc); + status = xpt_register_async(event, mprsas_async, sc, + NULL); + mpr_lock(sc); +#else status = xpt_register_async(event, mprsas_async, sc, sassc->path); +#endif + if (status != CAM_REQ_CMP) { mpr_dprint(sc, MPR_ERROR, "Error %#x registering async handler for " @@ -2988,6 +3029,18 @@ mprsas_async(void *callback_arg, uint32_ break; /* +* See the comment in mpr_attach_sas() for a detailed +* explanation. In these versions of FreeBSD we register +* for all events and filter out the events that don't +* apply to us. +*/ +#if (__FreeBSD_version < 1000703)
Re: svn commit: r265367 - head/lib/libc/regex
On Tue, 6 May 2014, Andrey Chernov wrote: On 06.05.2014 2:12, David Chisnall wrote: On 5 May 2014, at 22:51, Andrey Chernov wrote: For standard malloc/realloc interface it is up to the caller to check n*size not overflows. You must trust caller already does such check. Do a search of the CVE database sometime to see how well placed that trust generally is. Or even look at the code in question, where none of the realloc() or malloc() calls does overflow checking. I know current situation and disagree with OpenBSD way to fix it. Public interface assumes that caller should be trusted. Period. How well it is really trusted is up to the caller and should be fixed in it clearly, allowing human to trace the logic. Using calloc() to enforce it instead of caller is semantically wrong, Relying on a standard function to behave according to the standard is semantically wrong? The standard behaviour is undefined. It cannot be relied on. From C99 (n869.txt): %7.20.3.1 The calloc function % %Synopsis % %[#1] % %#include %void *calloc(size_t nmemb, size_t size); % %Description % %[#2] The calloc function allocates space for an array of %nmemb objects, each of whose size is size. The space is %initialized to all bits zero.238) Oops, there is no object to begin with, so perhaps the behaviour is defined after all. This is unclear. It is also unclear if objects can have size too large to represent as a size_t. C99 says that sizeof(object) is the size in bytes of an object, but it also says that the value of sizeof() is implementation-defined. If the multiplication overflows, then it can be argued that the behaviour is undefined (because the object cannot exist since sizeof() is required to actually return the size), and it can be argued that the behaviour is defined in some cases even when the multiplication overflows (because sizeof() is only required to return an implementation-defined value like the actual size modulo SIZE_MAX; then the object might exist). calloc() may have been actually useful orginally to handle the weird second case. In K&R1, size_t didn't exist and whether sizeof() worked was even less clear than now. The type of sizeof() was "an integer". malloc() took an int arg IIRC. malloc() is not even in the index in K&R1. But objects of size larger than INT_MAX were useful, and it would be reasonable to ask for calloc() to allocate one. K&R1 has calloc() in the index and documents it as calloc(n, sizeof(object)), where n and sizeof() are apparently implicit-int. So calloc(16368, 2) should give an object of size 32768 if possible. sizeof(this) is then unrepresentable as a 16-bit int. I used arrays larger than 32768 quite often on 16-bit systems, but only with 16-bit unsigned size_t. Yes. Generally it is using a function outside of its purpose. I.e. you can use calloc() just to check n*size and nothing else (free() result immediately afterwards) instead of writing just single check by yourself. It will be legal usage but semantically wrong and misleading. and especially strange when the caller is standard C library under your control. I don't follow this. If libc can't rely on standards conformance from itself then other code stands no chance. calloc() in FreeBSD is controlled too, but in 4.4BSD it just did the multiplication blindly. This was fixed (if it is a bug) in FreeBSD in 2002 (by tjr). The errno was the nondescript ENOMEM. Now, calloc() is sophisticated but the errno still seems to be ENOMEM. I think calloc() should check for overflow but callers shouldn't depend on this. In practice, the multiplication is less likely to overflow than malloc() is to fail, which "can't happen". You could limit the number of elements to something reasonable like 2**28 to ensure that the multiplication can't overflow with an element size of 8. The rare program that needs to support allocating more than 2**28 elements on 32-bit systems according to user input can be more careful. On 64-bit systems, you can use a less modest limit. Bruce ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265422 - head
Author: imp Date: Tue May 6 04:22:29 2014 New Revision: 265422 URL: http://svnweb.freebsd.org/changeset/base/265422 Log: Document src.opts.mk changes and the decoupling of /etc/src.conf from anything but the source tree. Modified: head/Makefile.inc1 head/UPDATING Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Tue May 6 04:22:06 2014(r265421) +++ head/Makefile.inc1 Tue May 6 04:22:29 2014(r265422) @@ -45,7 +45,7 @@ .error "Both TARGET and TARGET_ARCH must be defined." .endif -.include +.include "share/mk/src.opts.mk" .include .include Modified: head/UPDATING == --- head/UPDATING Tue May 6 04:22:06 2014(r265421) +++ head/UPDATING Tue May 6 04:22:29 2014(r265422) @@ -12,9 +12,9 @@ Items affecting the ports and packages s /usr/ports/UPDATING. Please read that file before running portupgrade. NOTE: FreeBSD has switched from gcc to clang. If you have trouble bootstrapping -from older versions of FreeBSD, try WITHOUT_CLANG to bootstrap to the tip of -head, and then rebuild without this option. The bootstrap process from -older version of current is a bit fragile. +from older versions of FreeBSD, try WITHOUT_CLANG and WITH_GCC to bootstrap to +the tip of head, and then rebuild without this option. The bootstrap process from +older version of current accorss the gcc/clang cutover is a bit fragile. NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW: FreeBSD 11.x has many debugging features turned on, in both the kernel @@ -31,6 +31,17 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20140505: + /etc/src.conf now affects only builds of the FreeBSD src tree. In the + past, it affected all builds that used the bsd.*.mk files. The old + behavior was a bug, but people may have relied upon it. To get this + behavior back, you can .include /etc/src.conf from /etc/make.conf + (which is still global and isn't changed). This also changes the + behavior of incremental builds inside the tree of individual + directories. Set MAKESYSPATH to ".../share/mk" to do that. + Although this has survived make universe and some upgrade scenarios, + other upgrade scenarios may have broken. + 20140430: The lindev device has been removed since /dev/full has been made a standard device. __FreeBSD_version has been bumped. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265420 - in head: . bin bin/csh bin/date bin/ed bin/ls bin/mv bin/pax bin/pkill bin/sh bin/test cddl cddl/lib cddl/sbin cddl/usr.bin cddl/usr.sbin etc etc/mtree etc/periodic/daily etc/...
Author: imp Date: Tue May 6 04:22:01 2014 New Revision: 265420 URL: http://svnweb.freebsd.org/changeset/base/265420 Log: Use src.opts.mk in preference to bsd.own.mk except where we need stuff from the latter. Modified: head/Makefile.inc1 head/bin/Makefile head/bin/Makefile.inc head/bin/csh/Makefile head/bin/date/Makefile head/bin/ed/Makefile head/bin/ls/Makefile head/bin/mv/Makefile head/bin/pax/Makefile head/bin/pkill/Makefile head/bin/sh/Makefile head/bin/test/Makefile head/cddl/Makefile head/cddl/lib/Makefile head/cddl/sbin/Makefile head/cddl/usr.bin/Makefile head/cddl/usr.sbin/Makefile head/etc/Makefile head/etc/mtree/Makefile head/etc/periodic/daily/Makefile head/etc/periodic/monthly/Makefile head/etc/periodic/security/Makefile head/etc/periodic/weekly/Makefile head/etc/rc.d/Makefile head/games/Makefile head/games/factor/Makefile head/gnu/Makefile head/gnu/lib/Makefile head/gnu/lib/csu/Makefile head/gnu/lib/libgcc/Makefile head/gnu/lib/libgcov/Makefile head/gnu/lib/libstdc++/Makefile head/gnu/lib/libsupc++/Makefile head/gnu/usr.bin/Makefile head/gnu/usr.bin/binutils/as/Makefile head/gnu/usr.bin/binutils/ld/Makefile head/gnu/usr.bin/cc/Makefile head/gnu/usr.bin/cc/Makefile.inc head/gnu/usr.bin/cc/c++/Makefile head/gnu/usr.bin/cc/cc/Makefile head/gnu/usr.bin/cc/cc1/Makefile head/gnu/usr.bin/cc/cc1plus/Makefile head/gnu/usr.bin/cc/cc_tools/Makefile head/gnu/usr.bin/cc/cpp/Makefile head/gnu/usr.bin/dialog/Makefile head/gnu/usr.bin/grep/Makefile head/include/Makefile head/include/arpa/Makefile head/kerberos5/Makefile.inc head/lib/Makefile head/lib/atf/Makefile head/lib/atf/libatf-c++/Makefile head/lib/atf/libatf-c/Makefile head/lib/clang/Makefile head/lib/clang/clang.build.mk head/lib/clang/libllvmanalysis/Makefile head/lib/clang/libllvmipa/Makefile head/lib/clang/libllvmipo/Makefile head/lib/clang/libllvmmc/Makefile head/lib/clang/libllvmscalaropts/Makefile head/lib/clang/libllvmsupport/Makefile head/lib/clang/libllvmtransformutils/Makefile head/lib/clang/libllvmx86disassembler/Makefile head/lib/libarchive/Makefile head/lib/libbsnmp/libbsnmp/Makefile head/lib/libc/Makefile head/lib/libc_nonshared/Makefile head/lib/libcompiler_rt/Makefile head/lib/libcrypt/Makefile head/lib/libfetch/Makefile head/lib/libipsec/Makefile head/lib/libkiconv/Makefile head/lib/libmilter/Makefile head/lib/libpam/modules/modules.inc head/lib/libpam/modules/pam_unix/Makefile head/lib/libpcap/Makefile head/lib/libproc/Makefile head/lib/libprocstat/Makefile head/lib/libradius/Makefile head/lib/librpcsvc/Makefile head/lib/libsm/Makefile head/lib/libsmb/Makefile head/lib/libstand/Makefile head/lib/libtelnet/Makefile head/lib/libthr/Makefile head/lib/libulog/Makefile head/lib/libutil/Makefile head/lib/libwrap/Makefile head/lib/ncurses/Makefile head/lib/ncurses/ncurses/Makefile head/libexec/Makefile head/libexec/atf/atf-check/Makefile head/libexec/ftpd/Makefile head/libexec/rlogind/Makefile head/libexec/rtld-elf/Makefile head/libexec/tcpd/Makefile head/libexec/telnetd/Makefile head/release/picobsd/tinyware/login/Makefile head/rescue/librescue/Makefile head/rescue/rescue/Makefile head/sbin/Makefile head/sbin/Makefile.inc head/sbin/atm/atmconfig/Makefile head/sbin/dhclient/Makefile head/sbin/geom/class/Makefile head/sbin/ggate/Makefile head/sbin/growfs/Makefile head/sbin/hastctl/Makefile head/sbin/hastd/Makefile head/sbin/ifconfig/Makefile head/sbin/ipfw/Makefile head/sbin/mdconfig/Makefile head/sbin/pfctl/Makefile head/sbin/ping/Makefile head/sbin/route/Makefile head/sbin/setkey/Makefile head/secure/Makefile head/secure/Makefile.inc head/secure/lib/Makefile head/secure/lib/libssh/Makefile head/secure/libexec/Makefile head/secure/libexec/sftp-server/Makefile head/secure/libexec/ssh-keysign/Makefile head/secure/libexec/ssh-pkcs11-helper/Makefile head/secure/usr.bin/Makefile head/secure/usr.bin/scp/Makefile head/secure/usr.bin/sftp/Makefile head/secure/usr.bin/ssh-add/Makefile head/secure/usr.bin/ssh-agent/Makefile head/secure/usr.bin/ssh-keygen/Makefile head/secure/usr.bin/ssh-keyscan/Makefile head/secure/usr.bin/ssh/Makefile head/secure/usr.sbin/Makefile head/secure/usr.sbin/sshd/Makefile head/share/Makefile head/share/doc/Makefile head/share/doc/smm/Makefile head/share/dtrace/Makefile head/share/examples/Makefile head/share/man/Makefile head/share/man/man1/Makefile head/share/man/man3/Makefile head/share/man/man4/Makefile head/share/man/man5/Makefile head/share/mk/Makefile head/share/mk/bsd.opts.mk head/share/mk/bsd.own.mk head/share/mk/src.opts.mk head/sys/Makefile head/sys/boot/Makefile head/sys/boot/amd64/efi/Makefile head/sys/boot/arm/at91/bootspi/Makefile head/sys/boot/arm/at91/libat91/Makefile head/sys/boot/arm/ixp425/boot2
svn commit: r265423 - in head: . share/mk usr.bin usr.bin/bmake usr.bin/make
Author: imp Date: Tue May 6 04:22:37 2014 New Revision: 265423 URL: http://svnweb.freebsd.org/changeset/base/265423 Log: Remove support for WITHOUT_BMAKE. bmake is now the only make that can build world, so it is the only make we build or install. fmake is still in the tree, but disconnected, and upgrades from older systems that still have bmake has not been removed, but its state has not been tested (it should work given how minimal the work to upgrade to bmake is). Modified: head/Makefile head/share/mk/src.opts.mk head/usr.bin/Makefile head/usr.bin/bmake/Makefile.inc head/usr.bin/make/Makefile Modified: head/Makefile == --- head/Makefile Tue May 6 04:22:29 2014(r265422) +++ head/Makefile Tue May 6 04:22:37 2014(r265423) @@ -139,11 +139,7 @@ _MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH # Choices add to complexity though. # We cannot blindly use a make which may not be the one we want # so be exlicit - until all choice is removed. -.if !defined(WITHOUT_BMAKE) WANT_MAKE= bmake -.else -WANT_MAKE= fmake -.endif MYMAKE= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}/${WANT_MAKE} .if defined(.PARSEDIR) HAVE_MAKE= bmake @@ -152,7 +148,7 @@ HAVE_MAKE= fmake .endif .if exists(${MYMAKE}) SUB_MAKE:= ${MYMAKE} -m ${.CURDIR}/share/mk -.elif ${WANT_MAKE} != ${HAVE_MAKE} || ${WANT_MAKE} != "bmake" +.elif ${WANT_MAKE} != ${HAVE_MAKE} # It may not exist yet but we may cause it to. # In the case of fmake, upgrade_checks may cause a newer version to be built. SUB_MAKE= `test -x ${MYMAKE} && echo ${MYMAKE} || echo ${MAKE}` \ Modified: head/share/mk/src.opts.mk == --- head/share/mk/src.opts.mk Tue May 6 04:22:29 2014(r265422) +++ head/share/mk/src.opts.mk Tue May 6 04:22:37 2014(r265423) @@ -65,7 +65,6 @@ __DEFAULT_YES_OPTIONS = \ BINUTILS \ BINUTILS_BOOTSTRAP \ BLUETOOTH \ -BMAKE \ BOOT \ BSD_CPIO \ BSNMP \ Modified: head/usr.bin/Makefile == --- head/usr.bin/Makefile Tue May 6 04:22:29 2014(r265422) +++ head/usr.bin/Makefile Tue May 6 04:22:37 2014(r265423) @@ -279,11 +279,7 @@ SUBDIR+= msgs .endif .if ${MK_MAKE} != "no" -.if ${MK_BMAKE} != "no" SUBDIR+= bmake -.else -SUBDIR+= make -.endif .endif .if ${MK_MAN_UTILS} != "no" Modified: head/usr.bin/bmake/Makefile.inc == --- head/usr.bin/bmake/Makefile.inc Tue May 6 04:22:29 2014 (r265422) +++ head/usr.bin/bmake/Makefile.inc Tue May 6 04:22:37 2014 (r265423) @@ -7,15 +7,7 @@ .export SRCTOP .endif -# Sadly, we cannot assume src.opts.mk did its job, -# nor can we safely include the one we want -.if !defined(WITHOUT_BMAKE) -MK_BMAKE= yes -.endif - -.if defined(MK_BMAKE) && ${MK_BMAKE} != "no" PROG= make -.endif .if !defined(MK_SHARED_TOOLCHAIN) || ${MK_SHARED_TOOLCHAIN} == "no" NO_SHARED?= YES Modified: head/usr.bin/make/Makefile == --- head/usr.bin/make/Makefile Tue May 6 04:22:29 2014(r265422) +++ head/usr.bin/make/Makefile Tue May 6 04:22:37 2014(r265423) @@ -111,12 +111,10 @@ CFLAGS+= -DDEFSHELLNAME=\"${MAKE_SHELL}\ .error "MAKE_SHELL must be set to one of \"csh\", \"sh\" or \"ksh\"." .endif -.if defined(MK_BMAKE) && ${MK_BMAKE} != "no" # if we are here we don't want this called 'make' PROG= fmake fmake.1: make.1 cp ${.ALLSRC} ${.TARGET} -.endif .if ${MK_TESTS} != "no" SUBDIR+= tests ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265421 - stable/10/sys/dev/cxgbe
Author: np Date: Tue May 6 04:22:06 2014 New Revision: 265421 URL: http://svnweb.freebsd.org/changeset/base/265421 Log: MFC r260210 (by adrian@): Add an option to enable or disable the small RX packet copying that is done to improve performance of small frames. When doing RX packing, the RX copying isn't necessarily required. Modified: stable/10/sys/dev/cxgbe/adapter.h stable/10/sys/dev/cxgbe/t4_main.c stable/10/sys/dev/cxgbe/t4_sge.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cxgbe/adapter.h == --- stable/10/sys/dev/cxgbe/adapter.h Tue May 6 04:22:01 2014 (r265420) +++ stable/10/sys/dev/cxgbe/adapter.h Tue May 6 04:22:06 2014 (r265421) @@ -643,6 +643,8 @@ struct adapter { const char *last_op; const void *last_op_thr; #endif + + int sc_do_rxcopy; }; #define ADAPTER_LOCK(sc) mtx_lock(&(sc)->sc_lock) Modified: stable/10/sys/dev/cxgbe/t4_main.c == --- stable/10/sys/dev/cxgbe/t4_main.c Tue May 6 04:22:01 2014 (r265420) +++ stable/10/sys/dev/cxgbe/t4_main.c Tue May 6 04:22:06 2014 (r265421) @@ -4207,6 +4207,10 @@ t4_sysctls(struct adapter *sc) oid = device_get_sysctl_tree(sc->dev); c0 = children = SYSCTL_CHILDREN(oid); + sc->sc_do_rxcopy = 1; + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "do_rx_copy", CTLFLAG_RW, + &sc->sc_do_rxcopy, 1, "Do RX copy of small frames"); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "nports", CTLFLAG_RD, NULL, sc->params.nports, "# of ports"); Modified: stable/10/sys/dev/cxgbe/t4_sge.c == --- stable/10/sys/dev/cxgbe/t4_sge.cTue May 6 04:22:01 2014 (r265420) +++ stable/10/sys/dev/cxgbe/t4_sge.cTue May 6 04:22:06 2014 (r265421) @@ -1450,7 +1450,7 @@ get_fl_payload1(struct adapter *sc, stru bus_dmamap_sync(fl->tag[sd->tag_idx], sd->map, BUS_DMASYNC_POSTREAD); - if (len < RX_COPY_THRESHOLD) { + if (sc->sc_do_rxcopy && (len < RX_COPY_THRESHOLD)) { #ifdef T4_PKT_TIMESTAMP /* Leave room for a timestamp */ m0->m_data += 8; @@ -1601,7 +1601,7 @@ get_fl_payload2(struct adapter *sc, stru bus_dmamap_sync(fl->tag[sd->tag_idx], sd->map, BUS_DMASYNC_POSTREAD); - if (len < RX_COPY_THRESHOLD) { + if (sc->sc_do_rxcopy && (len < RX_COPY_THRESHOLD)) { #ifdef T4_PKT_TIMESTAMP /* Leave room for a timestamp */ m0->m_data += 8; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265419 - head/share/mk
Author: imp Date: Tue May 6 04:21:48 2014 New Revision: 265419 URL: http://svnweb.freebsd.org/changeset/base/265419 Log: Move the /usr/src specific options to src.opts.mk. Move inclusion of /etc/src.conf to this file as well. Now, it will only affect builds of /usr/src and not others that use the bsd.*.mk files. Specifically don't install src.opts.mk so we can catch when it 'leaks' into bsd.*.mk again and have there be errors when this happens. Future commits will move to including src.opts.mk instead of bsd.own.mk when all that's needed is one of the MK_FOO options from src.opts.mk. Future options should be placed here, unless they directly affect a bsd.*.mk file, in which case they should be placed in bsd.opts.mk. Added: head/share/mk/src.opts.mk - copied, changed from r265418, head/share/mk/bsd.own.mk Modified: head/share/mk/Makefile head/share/mk/bsd.opts.mk Modified: head/share/mk/Makefile == --- head/share/mk/Makefile Tue May 6 03:42:04 2014(r265418) +++ head/share/mk/Makefile Tue May 6 04:21:48 2014(r265419) @@ -42,6 +42,9 @@ FILES=\ sys.mk \ version_gen.awk +# Installed for the moment, but not may not be in the future. +FILES+=src.opts.mk + NO_OBJ= FILESDIR= ${BINDIR}/mk Modified: head/share/mk/bsd.opts.mk == --- head/share/mk/bsd.opts.mk Tue May 6 03:42:04 2014(r265418) +++ head/share/mk/bsd.opts.mk Tue May 6 04:21:48 2014(r265419) @@ -31,11 +31,6 @@ : .if !defined(_WITHOUT_SRCCONF) -SRCCONF?= /etc/src.conf -.if exists(${SRCCONF}) || ${SRCCONF} != "/etc/src.conf" -.include "${SRCCONF}" -.endif - # # Define MK_* variables (which are either "yes" or "no") for users # to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the @@ -66,354 +61,12 @@ __DEFAULT_YES_OPTIONS = \ __DEFAULT_NO_OPTIONS = \ CTF \ DEBUG_FILES \ -INSTALL_AS_USER \ - -.include - -# Note: __DEFAULT_{YES,NO}_OPTIONS unset by bsd.mkopt.mk - -# These options are used by src the builds - -__DEFAULT_YES_OPTIONS = \ -ACCT \ -ACPI \ -AMD \ -APM \ -ARM_EABI \ -AT \ -ATM \ -AUDIT \ -AUTHPF \ -BINUTILS \ -BINUTILS_BOOTSTRAP \ -BLUETOOTH \ -BMAKE \ -BOOT \ -BSD_CPIO \ -BSNMP \ -BZIP2 \ -CALENDAR \ -CAPSICUM \ -CASPER \ -CDDL \ -CPP \ -CROSS_COMPILER \ -CRYPT \ -CTM \ -CXX \ -DICT \ -DMAGENT \ -DYNAMICROOT \ -ED_CRYPTO \ -EXAMPLES \ -FDT \ -FLOPPY \ -FMTREE \ -FORMAT_EXTENSIONS \ -FORTH \ -FP_LIBC \ -FREEBSD_UPDATE \ -GAMES \ -GCOV \ -GDB \ -GNU \ -GNU_GREP_COMPAT \ -GPIB \ -GPIO \ -GPL_DTC \ -GROFF \ -HTML \ -ICONV \ -INET \ -INET6 \ -IPFILTER \ -IPFW \ -JAIL \ -KDUMP \ -KERNEL_SYMBOLS \ -KVM \ -LDNS \ -LDNS_UTILS \ -LEGACY_CONSOLE \ -LIB32 \ -LIBPTHREAD \ -LIBTHR \ -LOCALES \ -LOCATE \ -LPR \ -LS_COLORS \ -LZMA_SUPPORT \ -MAIL \ -MAILWRAPPER \ -MAKE \ -NCURSESW \ -NDIS \ -NETCAT \ -NETGRAPH \ -NLS_CATALOGS \ -NS_CACHING \ -NTP \ -OPENSSL \ -PAM \ -PC_SYSINSTALL \ -PF \ -PKGBOOTSTRAP \ -PMC \ -PORTSNAP \ -PPP \ -QUOTAS \ -RCMDS \ -RCS \ -RESCUE \ -ROUTED \ -SENDMAIL \ -SETUID_LOGIN \ -SHAREDOCS \ -SOURCELESS \ -SOURCELESS_HOST \ -SOURCELESS_UCODE \ -SVNLITE \ -SYSCALL_COMPAT \ -SYSCONS \ -SYSINSTALL \ -TCSH \ -TELNET \ -TEXTPROC \ -UNBOUND \ -USB \ -UTMPX \ -VI \ -WIRELESS \ -WPA_SUPPLICANT_EAPOL \ -ZFS \ -ZONEINFO - -__DEFAULT_NO_OPTIONS = \ -BSD_GREP \ -CLANG_EXTRAS \ -EISA \ -HESIOD \ -LLDB \ -NAND \ -OFED \ -OPENLDAP \ -OPENSSH_NONE_CIPHER \ -SHARED_TOOLCHAIN \ -SORT_THREADS \ -SVN \ -TESTS \ -USB_GADGET_EXAMPLES - -# -# Default behaviour of some options depends on the architecture. Unfortunately -# this means that we have to test TARGET_ARCH (the buildworld case) as well -# as MACHINE_ARCH (the non-buildworld case). Normally TARGET_ARCH is not -# used at all in bsd.*.mk, but we have to make an exception here if we want -# to allow defaults for some things like clang to vary by target architecture. -# Additional, per-target behavior should be rarely added only after much -# gnashing of teeth and grinding of gears. -# -.if defined(TARGET_ARCH) -__T=${TARGET_ARCH} -.else -__T=${MACHINE_ARCH} -.endif -.if defined(TARGET) -__TT=${TARGET} -.else -__TT=${MACHINE} -.endif -# Clang is only for x86, powerpc and little-endian arm right now, by default. -.if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*} -__DEFAULT_YES_OPTIONS+=CLA
Re: svn commit: r265364 - head/sys/amd64/vmm
On 5/6/14, 12:19 AM, Neel Natu wrote: Author: neel Date: Mon May 5 16:19:24 2014 New Revision: 265364 URL: http://svnweb.freebsd.org/changeset/base/265364 Log: Virtual machine halt detection is turned on by default. Allow it to be disabled via the tunable 'hw.vmm.halt_detection'. So this can only be changed at boot time for the host? not even as a sysctl? Why is that? Why can this not be done from the App? Modified: head/sys/amd64/vmm/vmm.c Modified: head/sys/amd64/vmm/vmm.c == --- head/sys/amd64/vmm/vmm.cMon May 5 15:59:31 2014(r265363) +++ head/sys/amd64/vmm/vmm.cMon May 5 16:19:24 2014(r265364) @@ -189,6 +189,16 @@ static VMM_STAT(VCPU_TOTAL_RUNTIME, "vcp SYSCTL_NODE(_hw, OID_AUTO, vmm, CTLFLAG_RW, NULL, NULL); +/* + * Halt the guest if all vcpus are executing a HLT instruction with + * interrupts disabled. + */ +static int halt_detection_enabled = 1; +TUNABLE_INT("hw.vmm.halt_detection", &halt_detection_enabled); +SYSCTL_INT(_hw_vmm, OID_AUTO, halt_detection, CTLFLAG_RDTUN, +&halt_detection_enabled, 0, +"Halt VM if all vcpus execute HLT with interrupts disabled"); + static int vmm_ipinum; SYSCTL_INT(_hw_vmm, OID_AUTO, ipinum, CTLFLAG_RD, &vmm_ipinum, 0, "IPI vector used for vcpu notifications"); @@ -1047,7 +1057,7 @@ vm_handle_hlt(struct vm *vm, int vcpuid, if (intr_disabled) { wmesg = "vmhalt"; VCPU_CTR0(vm, vcpuid, "Halted"); - if (!vcpu_halted) { + if (!vcpu_halted && halt_detection_enabled) { vcpu_halted = 1; CPU_SET_ATOMIC(vcpuid, &vm->halted_cpus); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r265367 - head/lib/libc/regex
On Tue, 6 May 2014, Andrey Chernov wrote: On 05.05.2014 22:28, David Chisnall wrote: On 5 May 2014, at 18:42, Andrey Chernov wrote: Please don't commit OpenBSD errors. Now you mix calloc() with the realloc() for the same variable later which makes calloc() zeroing pointless and waste of CPU. The existence of calloc() is a bug. OpenBSD might be using it to zero memory, but this zeroing should be explicit. I didn't really notice before that the implicit zeroing doesn't even give much shorter code, since you still need explicit zeroing after realloc() if you have a policy of zeroing everything. The purpose of calloc() here is not (primarily) to get the zero'd size, it's to get the overflow-checking behaviour for calloc. It didn't help get the line-length overflow checking in mail. It is better to avoid using undocumented intrinsic knowledge of standard function particular implementation, this is unportable at least and hard to understand too. It is unportable. The behaviour on overflow is undefined. See another reply. The overflow checking is painful, but doing it in calloc() is only a minor simplification. In ps, I needed the following. It is complicated enough even for system input ({ARG_MAX}) that can be trusted to some extent. % if (buf == NULL) { % if ((arg_max = sysconf(_SC_ARG_MAX)) == -1) % errx(1, "sysconf _SC_ARG_MAX failed"); % if (arg_max >= LONG_MAX / 4 || arg_max >= (long)(SIZE_MAX / 4)) % errx(1, "sysconf _SC_ARG_MAX preposterously large"); % buf_size = 4 * arg_max + 1; % if ((buf = malloc(buf_size)) == NULL) % errx(1, "malloc failed"); % } Here we can't simply use calloc(4, sysconf(...)) (or is it calloc(sysconf(...), 4)?) because: - sysconf() has type long, which differs from size_t, so we can't even pass sysconf() to calloc() in general - sysconf() has an out of band error value - we don't quite have an array, and want to add 1. Adding 1 might overflow. The above is long partly because it has excessive error handling. This much error handling is probably justified for user input but not for sysconf(). Now I don't even like checking if malloc() failed. malloc() never fails, and if it does then there is nothing much you can do. A core dump is quite good error handling for it. But error handling like this allows giving specific error messages. If you use calloc() and the multiplication overflows, then the behaviour can be anything. If the behaviour is to return 0 and set errno to indicate the error, then the best that you can do is hope than errno is set to the undocumented value EINVAL or EOVERFLOW and then possibly check the multiplication yourself so as to determine if that was the error, and then print a specific error message. Bruce ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265418 - head/sys/vm
Author: alc Date: Tue May 6 03:42:04 2014 New Revision: 265418 URL: http://svnweb.freebsd.org/changeset/base/265418 Log: Prior to r254304, a separate function, vm_pageout_page_stats(), was used to periodically update the reference status of the active pages. This function was called, instead of vm_pageout_scan(), when memory was not scarce. The objective was to provide up to date reference status for active pages in case memory did become scarce and active pages needed to be deactivated. The active page queue scan performed by vm_pageout_page_stats() was virtually identical to that performed by vm_pageout_scan(), and so r254304 eliminated vm_pageout_page_stats(). Instead, vm_pageout_scan() is called with the parameter "pass" set to zero. The intention was that when pass is zero, vm_pageout_scan() would only scan the active queue. However, the variable page_shortage can still be greater than zero when memory is not scarce and vm_pageout_scan() is called with pass equal to zero. Consequently, the inactive queue may be scanned and dirty pages laundered even though that was not intended by r254304. This revision fixes that. Reported by: avg MFC after:1 week Sponsored by: EMC / Isilon Storage Division Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c == --- head/sys/vm/vm_pageout.cTue May 6 03:38:04 2014(r265417) +++ head/sys/vm/vm_pageout.cTue May 6 03:42:04 2014(r265418) @@ -942,13 +942,15 @@ vm_pageout_scan(struct vm_domain *vmd, i */ addl_page_shortage = 0; - deficit = atomic_readandclear_int(&vm_pageout_deficit); - /* * Calculate the number of pages we want to either free or move * to the cache. */ - page_shortage = vm_paging_target() + deficit; + if (pass > 0) { + deficit = atomic_readandclear_int(&vm_pageout_deficit); + page_shortage = vm_paging_target() + deficit; + } else + page_shortage = deficit = 0; /* * maxlaunder limits the number of dirty pages we flush per scan. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265417 - stable/10/share/man/man4
Author: bryanv Date: Tue May 6 03:38:04 2014 New Revision: 265417 URL: http://svnweb.freebsd.org/changeset/base/265417 Log: MFC r265287: Fix SYNOPSIS ("device if_vtnet" -> "device vtnet"). Modified: stable/10/share/man/man4/vtnet.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/vtnet.4 == --- stable/10/share/man/man4/vtnet.4Tue May 6 03:05:14 2014 (r265416) +++ stable/10/share/man/man4/vtnet.4Tue May 6 03:38:04 2014 (r265417) @@ -35,7 +35,7 @@ To compile this driver into the kernel, place the following lines in your kernel configuration file: .Bd -ragged -offset indent -.Cd "device if_vtnet" +.Cd "device vtnet" .Ed .Pp Alternatively, to load the driver as a ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265416 - stable/10/sys/sys
Author: np Date: Tue May 6 03:05:14 2014 New Revision: 265416 URL: http://svnweb.freebsd.org/changeset/base/265416 Log: MFC r261804: Provide additional information in some panic strings. Modified: stable/10/sys/sys/mbuf.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/sys/mbuf.h == --- stable/10/sys/sys/mbuf.hTue May 6 03:02:02 2014(r265415) +++ stable/10/sys/sys/mbuf.hTue May 6 03:05:14 2014(r265416) @@ -539,7 +539,7 @@ m_gettype(int size) type = EXT_JUMBO16; break; default: - panic("%s: invalid cluster size", __func__); + panic("%s: invalid cluster size %d", __func__, size); } return (type); @@ -588,7 +588,7 @@ m_getzone(int size) zone = zone_jumbo16; break; default: - panic("%s: invalid cluster size", __func__); + panic("%s: invalid cluster size %d", __func__, size); } return (zone); @@ -733,7 +733,7 @@ m_cljset(struct mbuf *m, void *cl, int t zone = zone_jumbo16; break; default: - panic("%s: unknown cluster type", __func__); + panic("%s: unknown cluster type %d", __func__, type); break; } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265415 - stable/10/tools/tools/cxgbetool
Author: np Date: Tue May 6 03:02:02 2014 New Revision: 265415 URL: http://svnweb.freebsd.org/changeset/base/265415 Log: MFC r261534: cxgbetool: Display the congestion channel map in hex. Modified: stable/10/tools/tools/cxgbetool/cxgbetool.c Directory Properties: stable/10/ (props changed) Modified: stable/10/tools/tools/cxgbetool/cxgbetool.c == --- stable/10/tools/tools/cxgbetool/cxgbetool.c Tue May 6 02:54:59 2014 (r265414) +++ stable/10/tools/tools/cxgbetool/cxgbetool.c Tue May 6 03:02:02 2014 (r265415) @@ -1368,7 +1368,7 @@ show_sge_context(const struct t4_sge_con FIELD1("CngDBPHdr:", 6), FIELD1("CngDBPData:", 5), FIELD1("CngIMSG:", 4), - FIELD("CngChMap:", 0, 3), + { "CngChMap:", 0, 3, 0, 1, 0}, { NULL } }; static struct field_desc t5_conm[] = { @@ -1377,7 +1377,7 @@ show_sge_context(const struct t4_sge_con FIELD1("CngDBPHdr:", 18), FIELD1("CngDBPData:", 17), FIELD1("CngIMSG:", 16), - FIELD("CngChMap:", 0, 15), + { "CngChMap:", 0, 15, 0, 1, 0}, { NULL } }; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265414 - stable/10/sys/net
Author: rmacklem Date: Tue May 6 02:54:59 2014 New Revision: 265414 URL: http://svnweb.freebsd.org/changeset/base/265414 Log: MFC: r264630 For NFS mounts using rsize,wsize=65536 over TSO enabled network interfaces limited to 32 transmit segments, there are two known issues. The more serious one is that for an I/O of slightly less than 64K, the net device driver prepends an ethernet header, resulting in a TSO segment slightly larger than 64K. Since m_defrag() copies this into 33 mbuf clusters, the transmit fails with EFBIG. A tester indicated observing a similar failure using iSCSI. The second less critical problem is that the network device driver must copy the mbuf chain via m_defrag() (m_collapse() is not sufficient), resulting in measurable overhead. This patch reduces the default size of if_hw_tsomax slightly, so that the first issue is avoided. Fixing the second issue will require a way for the network device driver to inform tcp_output() that it is limited to 32 transmit segments. Modified: stable/10/sys/net/if.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net/if.c == --- stable/10/sys/net/if.c Tue May 6 02:49:31 2014(r265413) +++ stable/10/sys/net/if.c Tue May 6 02:54:59 2014(r265414) @@ -74,6 +74,7 @@ #include #if defined(INET) || defined(INET6) +#include #include #include #include @@ -658,7 +659,8 @@ if_attach_internal(struct ifnet *ifp, in #if defined(INET) || defined(INET6) /* Initialize to max value. */ if (ifp->if_hw_tsomax == 0) - ifp->if_hw_tsomax = IP_MAXPACKET; + ifp->if_hw_tsomax = min(IP_MAXPACKET, 32 * MCLBYTES - + (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN)); KASSERT(ifp->if_hw_tsomax <= IP_MAXPACKET && ifp->if_hw_tsomax >= IP_MAXPACKET / 8, ("%s: tsomax outside of range", __func__)); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265413 - stable/10/sys/net
Author: rmacklem Date: Tue May 6 02:49:31 2014 New Revision: 265413 URL: http://svnweb.freebsd.org/changeset/base/265413 Log: MFC: r264517 Vlan did not set the value of if_hw_tsomax, so when vlan was stacked on top of a network interface that set if_hw_tsomax, tcp_output() would see the default value instead of the value set by the network interface. This patch modifies vlan so that it sets if_hw_tsomax to the value of the parent interface. Modified: stable/10/sys/net/if_vlan.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net/if_vlan.c == --- stable/10/sys/net/if_vlan.c Tue May 6 02:44:01 2014(r265412) +++ stable/10/sys/net/if_vlan.c Tue May 6 02:49:31 2014(r265413) @@ -1509,6 +1509,8 @@ vlan_capabilities(struct ifvlan *ifv) * propagate the hardware-assisted flag. TSO on VLANs * does not necessarily require hardware VLAN tagging. */ + if (p->if_hw_tsomax > 0) + ifp->if_hw_tsomax = p->if_hw_tsomax; if (p->if_capabilities & IFCAP_VLAN_HWTSO) ifp->if_capabilities |= p->if_capabilities & IFCAP_TSO; if (p->if_capenable & IFCAP_VLAN_HWTSO) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265412 - stable/10/sys/net
Author: rmacklem Date: Tue May 6 02:44:01 2014 New Revision: 265412 URL: http://svnweb.freebsd.org/changeset/base/265412 Log: MFC: r264469, r264498 Lagg did not set the value of if_hw_tsomax, so when lagg was stacked on top of network interfaces that set if_hw_tsomax, tcp_output() would see the default value instead of the value set by the network interface(s). This patch modifies lagg so that it sets if_hw_tsomax to the minimum of the value(s) for the underlying network interfaces. Modified: stable/10/sys/net/if_lagg.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net/if_lagg.c == --- stable/10/sys/net/if_lagg.c Tue May 6 02:32:27 2014(r265411) +++ stable/10/sys/net/if_lagg.c Tue May 6 02:44:01 2014(r265412) @@ -54,11 +54,11 @@ __FBSDID("$FreeBSD$"); #if defined(INET) || defined(INET6) #include +#include #endif #ifdef INET #include #include -#include #endif #ifdef INET6 @@ -448,6 +448,11 @@ lagg_capabilities(struct lagg_softc *sc) struct lagg_port *lp; int cap = ~0, ena = ~0; u_long hwa = ~0UL; +#if defined(INET) || defined(INET6) + u_int hw_tsomax = IP_MAXPACKET; /* Initialize to the maximum value. */ +#else + u_int hw_tsomax = ~0; /* if_hw_tsomax is only for INET/INET6, but.. */ +#endif LAGG_WLOCK_ASSERT(sc); @@ -456,6 +461,10 @@ lagg_capabilities(struct lagg_softc *sc) cap &= lp->lp_ifp->if_capabilities; ena &= lp->lp_ifp->if_capenable; hwa &= lp->lp_ifp->if_hwassist; + /* Set to the minimum value of the lagg ports. */ + if (lp->lp_ifp->if_hw_tsomax < hw_tsomax && + lp->lp_ifp->if_hw_tsomax > 0) + hw_tsomax = lp->lp_ifp->if_hw_tsomax; } cap = (cap == ~0 ? 0 : cap); ena = (ena == ~0 ? 0 : ena); @@ -463,10 +472,12 @@ lagg_capabilities(struct lagg_softc *sc) if (sc->sc_ifp->if_capabilities != cap || sc->sc_ifp->if_capenable != ena || - sc->sc_ifp->if_hwassist != hwa) { + sc->sc_ifp->if_hwassist != hwa || + sc->sc_ifp->if_hw_tsomax != hw_tsomax) { sc->sc_ifp->if_capabilities = cap; sc->sc_ifp->if_capenable = ena; sc->sc_ifp->if_hwassist = hwa; + sc->sc_ifp->if_hw_tsomax = hw_tsomax; getmicrotime(&sc->sc_ifp->if_lastchange); if (sc->sc_ifflags & IFF_DEBUG) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265411 - in head/sys: dev/bxe modules/bxe
Author: davidcs Date: Tue May 6 02:32:27 2014 New Revision: 265411 URL: http://svnweb.freebsd.org/changeset/base/265411 Log: Modify Copyright information to reflect Qlogic Corporation's purchase of Broadcom's NetXtreme business Submitted by:David C Somayajulu (davi...@freebsd.org) QLogic Corporation MFC after:5 days Modified: head/sys/dev/bxe/57710_init_values.c head/sys/dev/bxe/57710_int_offsets.h head/sys/dev/bxe/57711_init_values.c head/sys/dev/bxe/57711_int_offsets.h head/sys/dev/bxe/57712_init_values.c head/sys/dev/bxe/57712_int_offsets.h head/sys/dev/bxe/bxe.c head/sys/dev/bxe/bxe.h head/sys/dev/bxe/bxe_dcb.h head/sys/dev/bxe/bxe_debug.c head/sys/dev/bxe/bxe_elink.c head/sys/dev/bxe/bxe_elink.h head/sys/dev/bxe/bxe_stats.c head/sys/dev/bxe/bxe_stats.h head/sys/dev/bxe/ecore_fw_defs.h head/sys/dev/bxe/ecore_hsi.h head/sys/dev/bxe/ecore_init.h head/sys/dev/bxe/ecore_init_ops.h head/sys/dev/bxe/ecore_mfw_req.h head/sys/dev/bxe/ecore_reg.h head/sys/dev/bxe/ecore_sp.c head/sys/dev/bxe/ecore_sp.h head/sys/modules/bxe/Makefile Modified: head/sys/dev/bxe/57710_init_values.c == --- head/sys/dev/bxe/57710_init_values.cTue May 6 02:22:52 2014 (r265410) +++ head/sys/dev/bxe/57710_init_values.cTue May 6 02:32:27 2014 (r265411) @@ -1,9 +1,5 @@ /*- - * Copyright (c) 2007-2013 Broadcom Corporation. All rights reserved. - * - * Eric Davis - * David Christensen - * Gary Zambrano + * Copyright (c) 2007-2014 QLogic Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -14,9 +10,6 @@ * 2. Redistributions in binary form must reproduce the above copyright *notice, this list of conditions and the following disclaimer in the *documentation and/or other materials provided with the distribution. - * 3. Neither the name of Broadcom Corporation nor the name of its contributors - *may be used to endorse or promote products derived from this software - *without specific prior written consent. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE Modified: head/sys/dev/bxe/57710_int_offsets.h == --- head/sys/dev/bxe/57710_int_offsets.hTue May 6 02:22:52 2014 (r265410) +++ head/sys/dev/bxe/57710_int_offsets.hTue May 6 02:32:27 2014 (r265411) @@ -1,9 +1,5 @@ /*- - * Copyright (c) 2007-2013 Broadcom Corporation. All rights reserved. - * - * Eric Davis - * David Christensen - * Gary Zambrano + * Copyright (c) 2007-2014 QLogic Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -14,9 +10,6 @@ * 2. Redistributions in binary form must reproduce the above copyright *notice, this list of conditions and the following disclaimer in the *documentation and/or other materials provided with the distribution. - * 3. Neither the name of Broadcom Corporation nor the name of its contributors - *may be used to endorse or promote products derived from this software - *without specific prior written consent. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE Modified: head/sys/dev/bxe/57711_init_values.c == --- head/sys/dev/bxe/57711_init_values.cTue May 6 02:22:52 2014 (r265410) +++ head/sys/dev/bxe/57711_init_values.cTue May 6 02:32:27 2014 (r265411) @@ -1,9 +1,5 @@ /*- - * Copyright (c) 2007-2013 Broadcom Corporation. All rights reserved. - * - * Eric Davis - * David Christensen - * Gary Zambrano + * Copyright (c) 2007-2014 QLogic Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -14,9 +10,6 @@ * 2. Redistributions in binary form must reproduce the above copyright *notice, this list of conditions and the following disclaimer in the *documentation and/or other materials provided with the distribution. - * 3. Neither the name of Broadcom Corporation nor the name of its contributors - *may be used to endorse or promote products derived from this software - *without specific prior written consent. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE Mo
svn commit: r265410 - in stable/10/sys/dev/cxgbe: . common
Author: np Date: Tue May 6 02:22:52 2014 New Revision: 265410 URL: http://svnweb.freebsd.org/changeset/base/265410 Log: MFC r261533, r261536, r261537, and r263457. r261533: cxgbe(4): Use the port's tx channel to identify it to t4_clr_port_stats. r261536: cxgbe(4): The T5 allows for a different freelist starvation threshold for queues with buffer packing. Use the correct value to calculate a freelist's low water mark. r261537: cxgbe(4): Use the rx channel map (instead of the tx channel map) as the congestion channel map. r263457: cxgbe(4): Recognize the "spider" configuration where a T5 card's 40G QSFP port is presented as 4 distinct 10G SFP+ ports to the driver. Modified: stable/10/sys/dev/cxgbe/adapter.h stable/10/sys/dev/cxgbe/common/t4_hw.c stable/10/sys/dev/cxgbe/t4_main.c stable/10/sys/dev/cxgbe/t4_sge.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cxgbe/adapter.h == --- stable/10/sys/dev/cxgbe/adapter.h Tue May 6 01:15:42 2014 (r265409) +++ stable/10/sys/dev/cxgbe/adapter.h Tue May 6 02:22:52 2014 (r265410) @@ -204,6 +204,7 @@ struct port_info { uint8_t mod_type; uint8_t port_id; uint8_t tx_chan; + uint8_t rx_chan_map; /* rx MPS channel bitmap */ /* These need to be int as they are used in sysctl */ int ntxq; /* # of tx queues */ @@ -512,6 +513,7 @@ struct sge { int timer_val[SGE_NTIMERS]; int counter_val[SGE_NCOUNTERS]; int fl_starve_threshold; + int fl_starve_threshold2; int eq_s_qpp; int iq_s_qpp; Modified: stable/10/sys/dev/cxgbe/common/t4_hw.c == --- stable/10/sys/dev/cxgbe/common/t4_hw.c Tue May 6 01:15:42 2014 (r265409) +++ stable/10/sys/dev/cxgbe/common/t4_hw.c Tue May 6 02:22:52 2014 (r265410) @@ -5647,6 +5647,7 @@ int __devinit t4_port_init(struct port_i p->viid = ret; p->tx_chan = j; + p->rx_chan_map = get_mps_bg_map(adap, j); p->lport = j; p->rss_size = rss_size; t4_os_set_hw_addr(adap, p->port_id, addr); Modified: stable/10/sys/dev/cxgbe/t4_main.c == --- stable/10/sys/dev/cxgbe/t4_main.c Tue May 6 01:15:42 2014 (r265409) +++ stable/10/sys/dev/cxgbe/t4_main.c Tue May 6 02:22:52 2014 (r265410) @@ -2622,6 +2622,7 @@ build_medialist(struct port_info *pi) ifmedia_set(media, m | IFM_10G_CX4); break; + case FW_PORT_TYPE_QSFP_10G: case FW_PORT_TYPE_SFP: case FW_PORT_TYPE_FIBER_XFI: case FW_PORT_TYPE_FIBER_XAUI: @@ -7754,11 +7755,11 @@ t4_ioctl(struct cdev *dev, unsigned long if (port_id >= sc->params.nports) return (EINVAL); + pi = sc->port[port_id]; /* MAC stats */ - t4_clr_port_stats(sc, port_id); + t4_clr_port_stats(sc, pi->tx_chan); - pi = sc->port[port_id]; if (pi->flags & PORT_INIT_DONE) { struct sge_rxq *rxq; struct sge_txq *txq; Modified: stable/10/sys/dev/cxgbe/t4_sge.c == --- stable/10/sys/dev/cxgbe/t4_sge.cTue May 6 01:15:42 2014 (r265409) +++ stable/10/sys/dev/cxgbe/t4_sge.cTue May 6 02:22:52 2014 (r265410) @@ -568,6 +568,10 @@ t4_read_chip_settings(struct adapter *sc r = t4_read_reg(sc, A_SGE_CONM_CTRL); s->fl_starve_threshold = G_EGRTHRESHOLD(r) * 2 + 1; + if (is_t4(sc)) + s->fl_starve_threshold2 = s->fl_starve_threshold; + else + s->fl_starve_threshold2 = G_EGRTHRESHOLDPACKING(r) * 2 + 1; /* egress queues: log2 of # of doorbells per BAR2 page */ r = t4_read_reg(sc, A_SGE_EGRESS_QUEUES_PER_PAGE_PF); @@ -2232,7 +2236,9 @@ alloc_iq_fl(struct port_info *pi, struct return (rc); } fl->needed = fl->cap; - fl->lowat = roundup2(sc->sge.fl_starve_threshold, 8); + fl->lowat = fl->flags & FL_BUF_PACKING ? + roundup2(sc->sge.fl_starve_threshold2, 8) : + roundup2(sc->sge.fl_starve_threshold, 8); c.iqns_to_fl0congen |= htobe32(V_FW_IQ_CMD_FL0HOSTFCMODE(X_HOSTFCMODE_NONE) | @@ -2467,7 +2473,7 @@ tnl_cong(struct port_info *pi) else if (cong_drop == 1) return (0); else - return (1 << pi->tx_chan); + return (pi->rx_chan_map); } static int @@ -2574,7 +2580,7 @@ alloc_ofld_rxq(struct port_info *pi, str char name[16];
svn commit: r265409 - head/sys/dev/ath
Author: adrian Date: Tue May 6 01:15:42 2014 New Revision: 265409 URL: http://svnweb.freebsd.org/changeset/base/265409 Log: Modify the RX path to keep the previous RX descriptor around once it's used. It turns out that the RX DMA engine does the same last-descriptor-link- pointer-re-reading trick that the TX DMA engine. That is, the hardware re-reads the link pointer before it moves onto the next descriptor. Thus we can't free a descriptor before we move on; it's possible the hardware will need to re-read the link pointer before we overwrite it with a new one. Tested: * AR5416, STA mode TODO: * more thorough AP and STA mode testing! * test on other pre-AR9380 NICs, just to be sure. * Break out the RX descriptor grabbing bits from the RX completion bits, like what is done in the RX EDMA code, so .. * .. the RX lock can be held during ath_rx_proc(), but not across packet input. Modified: head/sys/dev/ath/if_ath_rx.c head/sys/dev/ath/if_ath_sysctl.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_ath_rx.c == --- head/sys/dev/ath/if_ath_rx.cTue May 6 00:00:07 2014 (r265408) +++ head/sys/dev/ath/if_ath_rx.cTue May 6 01:15:42 2014 (r265409) @@ -245,6 +245,8 @@ ath_legacy_rxbuf_init(struct ath_softc * struct mbuf *m; struct ath_desc *ds; + /* XXX TODO: ATH_RX_LOCK_ASSERT(sc); */ + m = bf->bf_m; if (m == NULL) { /* @@ -974,6 +976,14 @@ rx_next: #defineATH_RX_MAX 128 +/* + * XXX TODO: break out the "get buffers" from "call ath_rx_pkt()" like + * the EDMA code does. + * + * XXX TODO: then, do all of the RX list management stuff inside + * ATH_RX_LOCK() so we don't end up potentially racing. The EDMA + * code is doing it right. + */ static void ath_rx_proc(struct ath_softc *sc, int resched) { @@ -995,6 +1005,7 @@ ath_rx_proc(struct ath_softc *sc, int re u_int64_t tsf; int npkts = 0; int kickpcu = 0; + int ret; /* XXX we must not hold the ATH_LOCK here */ ATH_UNLOCK_ASSERT(sc); @@ -1094,8 +1105,26 @@ ath_rx_proc(struct ath_softc *sc, int re if (ath_rx_pkt(sc, rs, status, tsf, nf, HAL_RX_QUEUE_HP, bf, m)) ngood++; rx_proc_next: - TAILQ_INSERT_TAIL(&sc->sc_rxbuf, bf, bf_list); - } while (ath_rxbuf_init(sc, bf) == 0); + /* +* If there's a holding buffer, insert that onto +* the RX list; the hardware is now definitely not pointing +* to it now. +*/ + ret = 0; + if (sc->sc_rxedma[HAL_RX_QUEUE_HP].m_holdbf != NULL) { + TAILQ_INSERT_TAIL(&sc->sc_rxbuf, + sc->sc_rxedma[HAL_RX_QUEUE_HP].m_holdbf, + bf_list); + ret = ath_rxbuf_init(sc, + sc->sc_rxedma[HAL_RX_QUEUE_HP].m_holdbf); + } + /* +* Next, throw our buffer into the holding entry. The hardware +* may use the descriptor to read the link pointer before +* DMAing the next descriptor in to write out a packet. +*/ + sc->sc_rxedma[HAL_RX_QUEUE_HP].m_holdbf = bf; + } while (ret == 0); /* rx signal state monitoring */ ath_hal_rxmonitor(ah, &sc->sc_halstats, sc->sc_curchan); @@ -1127,6 +1156,13 @@ rx_proc_next: * constantly write over the same frame, leading * the RX driver code here to get heavily confused. */ + /* +* XXX Has RX DMA stopped enough here to just call +* ath_startrecv()? +* XXX Do we need to use the holding buffer to restart +* RX DMA by appending entries to the final +* descriptor? Quite likely. +*/ #if 1 ath_startrecv(sc); #else @@ -1217,6 +1253,58 @@ ath_legacy_flushrecv(struct ath_softc *s ath_rx_proc(sc, 0); } +static void +ath_legacy_flush_rxpending(struct ath_softc *sc) +{ + + /* XXX ATH_RX_LOCK_ASSERT(sc); */ + + if (sc->sc_rxedma[HAL_RX_QUEUE_LP].m_rxpending != NULL) { + m_freem(sc->sc_rxedma[HAL_RX_QUEUE_LP].m_rxpending); + sc->sc_rxedma[HAL_RX_QUEUE_LP].m_rxpending = NULL; + } + if (sc->sc_rxedma[HAL_RX_QUEUE_HP].m_rxpending != NULL) { + m_freem(sc->sc_rxedma[HAL_RX_QUEUE_HP].m_rxpending); + sc->sc_rxedma[HAL_RX_QUEUE_HP].m_rxpending = NULL; + } +} + +static int +ath_legacy_flush_rxholdbf(struct ath_softc *sc) +{ + struct ath_buf *bf; + + /* XXX ATH_RX_LOCK_ASSERT(sc); */ + /* +* If there are RX holding buffers, free them
Re: svn commit: r265391 - head/sys/dev/vt
On Mon, May 05, 2014 at 09:29:57PM +, Aleksandr Rybalko wrote: > Author: ray > Date: Mon May 5 21:29:56 2014 > New Revision: 265391 > URL: http://svnweb.freebsd.org/changeset/base/265391 > > Log: > Define a new method for probing vt(4) driver before attach it at early > stage. > Can you please commit a vt.4 manual page or stop referring to vt(4) in your commit messages? -- Steve ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265408 - in head: sys/netinet usr.bin/netstat
Author: glebius Date: Tue May 6 00:00:07 2014 New Revision: 265408 URL: http://svnweb.freebsd.org/changeset/base/265408 Log: - Remove net.inet.tcp.reass.overflows sysctl. It counts exactly same events that tcpstat's tcps_rcvmemdrop counter counts. - Rename tcps_rcvmemdrop to tcps_rcvreassfull and improve its description in netstat(1) output. Sponsored by: Netflix Sponsored by: Nginx, Inc. Modified: head/sys/netinet/tcp_reass.c head/sys/netinet/tcp_var.h head/usr.bin/netstat/inet.c Modified: head/sys/netinet/tcp_reass.c == --- head/sys/netinet/tcp_reass.cMon May 5 23:54:13 2014 (r265407) +++ head/sys/netinet/tcp_reass.cTue May 6 00:00:07 2014 (r265408) @@ -72,16 +72,6 @@ __FBSDID("$FreeBSD$"); #include #include -static SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0, -"TCP Segment Reassembly Queue"); - -static VNET_DEFINE(int, tcp_reass_overflows) = 0; -#defineV_tcp_reass_overflows VNET(tcp_reass_overflows) -SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, overflows, -CTLTYPE_INT | CTLFLAG_RD, -&VNET_NAME(tcp_reass_overflows), 0, -"Global number of TCP Segment Reassembly Queue Overflows"); - void tcp_reass_flush(struct tcpcb *tp) { @@ -142,8 +132,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd tp->t_segqlen + m->m_pkthdr.len >= sbspace(&so->so_rcv)) { char *s; - V_tcp_reass_overflows++; - TCPSTAT_INC(tcps_rcvmemdrop); + TCPSTAT_INC(tcps_rcvreassfull); *tlenp = 0; if ((s = tcp_log_addrs(&tp->t_inpcb->inp_inc, th, NULL, NULL))) { Modified: head/sys/netinet/tcp_var.h == --- head/sys/netinet/tcp_var.h Mon May 5 23:54:13 2014(r265407) +++ head/sys/netinet/tcp_var.h Tue May 6 00:00:07 2014(r265408) @@ -426,7 +426,7 @@ struct tcpstat { uint64_t tcps_rcvbyte; /* bytes received in sequence */ uint64_t tcps_rcvbadsum;/* packets received with ccksum errs */ uint64_t tcps_rcvbadoff;/* packets received with bad offset */ - uint64_t tcps_rcvmemdrop; /* packets dropped for lack of memory */ + uint64_t tcps_rcvreassfull; /* packets dropped for no reass space */ uint64_t tcps_rcvshort; /* packets received too short */ uint64_t tcps_rcvduppack; /* duplicate-only packets received */ uint64_t tcps_rcvdupbyte; /* duplicate-only bytes received */ Modified: head/usr.bin/netstat/inet.c == --- head/usr.bin/netstat/inet.c Mon May 5 23:54:13 2014(r265407) +++ head/usr.bin/netstat/inet.c Tue May 6 00:00:07 2014(r265408) @@ -660,7 +660,8 @@ tcp_stats(u_long off, const char *name, p(tcps_rcvbadsum, "\t\t%ju discarded for bad checksum%s\n"); p(tcps_rcvbadoff, "\t\t%ju discarded for bad header offset field%s\n"); p1a(tcps_rcvshort, "\t\t%ju discarded because packet too short\n"); - p1a(tcps_rcvmemdrop, "\t\t%ju discarded due to memory problems\n"); + p1a(tcps_rcvreassfull, + "\t\t%ju discarded due to no space in reassembly queue\n"); p(tcps_connattempt, "\t%ju connection request%s\n"); p(tcps_accepts, "\t%ju connection accept%s\n"); p(tcps_badsyn, "\t%ju bad connection attempt%s\n"); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265407 - head/usr.sbin/bhyve
Author: neel Date: Mon May 5 23:54:13 2014 New Revision: 265407 URL: http://svnweb.freebsd.org/changeset/base/265407 Log: Disable the 'uart_drain()' callback when the emulated receive FIFO is full. Failing to do this will cause the kevent(2) notification to trigger continuously and the bhyve(8) mevent thread will hog the cpu until the characters on the backend tty device are drained. Also, make the uart backend file descriptor non-blocking to avoid a select(2) before every byte read from that backend. Reviewed by: grehan Modified: head/usr.sbin/bhyve/uart_emul.c Modified: head/usr.sbin/bhyve/uart_emul.c == --- head/usr.sbin/bhyve/uart_emul.c Mon May 5 23:36:46 2014 (r265406) +++ head/usr.sbin/bhyve/uart_emul.c Mon May 5 23:54:13 2014 (r265407) @@ -110,6 +110,7 @@ struct uart_softc { uint8_t dlh;/* Baudrate divisor latch MSB */ struct fifo rxfifo; + struct mevent *mev; struct ttyfd tty; boolthre_int_pending; /* THRE interrupt pending */ @@ -145,34 +146,15 @@ ttyopen(struct ttyfd *tf) } } -static bool -tty_char_available(struct ttyfd *tf) -{ - fd_set rfds; - struct timeval tv; - - FD_ZERO(&rfds); - FD_SET(tf->fd, &rfds); - tv.tv_sec = 0; - tv.tv_usec = 0; - if (select(tf->fd + 1, &rfds, NULL, NULL, &tv) > 0 ) { - return (true); - } else { - return (false); - } -} - static int ttyread(struct ttyfd *tf) { - char rb; + unsigned char rb; - if (tty_char_available(tf)) { - read(tf->fd, &rb, 1); - return (rb & 0xff); - } else { + if (read(tf->fd, &rb, 1) == 1) + return (rb); + else return (-1); - } } static void @@ -183,62 +165,111 @@ ttywrite(struct ttyfd *tf, unsigned char } static void -fifo_reset(struct fifo *fifo, int size) +rxfifo_reset(struct uart_softc *sc, int size) { + char flushbuf[32]; + struct fifo *fifo; + ssize_t nread; + int error; + fifo = &sc->rxfifo; bzero(fifo, sizeof(struct fifo)); fifo->size = size; + + if (sc->tty.opened) { + /* +* Flush any unread input from the tty buffer. +*/ + while (1) { + nread = read(sc->tty.fd, flushbuf, sizeof(flushbuf)); + if (nread != sizeof(flushbuf)) + break; + } + + /* +* Enable mevent to trigger when new characters are available +* on the tty fd. +*/ + error = mevent_enable(sc->mev); + assert(error == 0); + } +} + +static int +rxfifo_available(struct uart_softc *sc) +{ + struct fifo *fifo; + + fifo = &sc->rxfifo; + return (fifo->num < fifo->size); } static int -fifo_putchar(struct fifo *fifo, uint8_t ch) +rxfifo_putchar(struct uart_softc *sc, uint8_t ch) { + struct fifo *fifo; + int error; + + fifo = &sc->rxfifo; if (fifo->num < fifo->size) { fifo->buf[fifo->windex] = ch; fifo->windex = (fifo->windex + 1) % fifo->size; fifo->num++; + if (!rxfifo_available(sc)) { + if (sc->tty.opened) { + /* +* Disable mevent callback if the FIFO is full. +*/ + error = mevent_disable(sc->mev); + assert(error == 0); + } + } return (0); } else return (-1); } static int -fifo_getchar(struct fifo *fifo) +rxfifo_getchar(struct uart_softc *sc) { - int c; + struct fifo *fifo; + int c, error, wasfull; + wasfull = 0; + fifo = &sc->rxfifo; if (fifo->num > 0) { + if (!rxfifo_available(sc)) + wasfull = 1; c = fifo->buf[fifo->rindex]; fifo->rindex = (fifo->rindex + 1) % fifo->size; fifo->num--; + if (wasfull) { + if (sc->tty.opened) { + error = mevent_enable(sc->mev); + assert(error == 0); + } + } return (c); } else return (-1); } static int -fifo_numchars(struct fifo *fifo) +rxfifo_numchars(struct uart_softc *sc) { + struct fifo *fifo = &sc->rxfifo; return (fifo->num); } -static int -fifo_available(struct fifo *fifo) -{ - - return (fifo->num < fifo->size); -} - static void uart_opentty(struct uart_softc *sc) { -
svn commit: r265406 - head/release/scripts
Author: gjb Date: Mon May 5 23:36:46 2014 New Revision: 265406 URL: http://svnweb.freebsd.org/changeset/base/265406 Log: Use 'return' instead of 'exit' in main(), since the script exits with the last returned exit code. Sponsored by: The FreeBSD Foundation Modified: head/release/scripts/relnotes-search.sh Modified: head/release/scripts/relnotes-search.sh == --- head/release/scripts/relnotes-search.sh Mon May 5 23:01:01 2014 (r265405) +++ head/release/scripts/relnotes-search.sh Mon May 5 23:36:46 2014 (r265406) @@ -56,7 +56,7 @@ main() { if [ -e "${where}" ]; then echo "Log file already exists:" echo " (${where})" - exit 2 + return 2 fi ;; r) @@ -64,7 +64,7 @@ main() { c=$(echo -n ${rev} | tr -d '0-9' | wc -c) if [ ${c} -ne 0 ]; then echo "Revision number must be numeric." - exit 2 + return 2 fi # Since the last specified revision is # specified, mangle the variable to @@ -101,25 +101,25 @@ main() { # Did we find svn? if [ -z "${svn}" ]; then echo "svn(1) binary not found." - exit 2 + return 2 fi # Is more than one path specified? (This should never # be triggered, because the argument count is checked # above, but better safe than sorry.) if [ $# -gt 1 ]; then echo "Cannot specify more than one working path." - exit 2 + return 2 fi # Does the directory exist? if [ ! -d "${1}" ]; then echo "Specified path (${1}) is not a directory." - exit 2 + return 2 fi # Is it a subversion repository checkout? ${svn} info ${1} >/dev/null 2>&1 if [ "$?" -ne 0 ]; then echo "Cannot determine svn repository information for ${1}" - exit 2 + return 2 fi # All tests passed. Let's see what can possibly go wrong ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r265367 - head/lib/libc/regex
On 06.05.2014 2:59, Warner Losh wrote: > Stupid is as stupid does. malloc and realloc both have this same issue. While > an interesting theoretical attack, the size doesn’t necessarily come from > multiplication. Careful coding is still required, not matter what spin you > put on this. reallocf() solves the memory leak issue, but not the problem > with overflow (which the realloc() interface has too). The caller can check > to make sure they aren’t requesting too much memory and overflowing. The > interface isn’t designed to solve the problem you are complaining about. > > There’s only so much you can do to prevent programming errors. calloc() isn’t > going to solve the world’s problems for you, and introduces a non-trivial > amount of overhead for the trivial amount of overhead that is “saved” by > moving the overflow check from the caller to the callee... I agree completely. -- http://ache.vniz.net/ signature.asc Description: OpenPGP digital signature
Re: svn commit: r265367 - head/lib/libc/regex
On 06.05.2014 2:52, Andrey Chernov wrote: > As I mention initially, literal enough checks is what we need to make > logic clear. In the case we discuss realloc() can be changed by > reallocf() which does n*size and NULL checks and literal "if" should be > added before malloc() to check overflow. Sorry crumpled phrase. Literal "if" for overflow checking should be added before both malloc() and reallocf(). Other ways will make the code obscure for human and hard to support. -- http://ache.vniz.net/ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265405 - head/release/scripts
Author: gjb Date: Mon May 5 23:01:01 2014 New Revision: 265405 URL: http://svnweb.freebsd.org/changeset/base/265405 Log: Add a helper script for parsing 'svn log' for the 'Relnotes:' tag in case 'yes' is not explicitly the first string value following the tab. As it turns out, a number of commits have bypassed my filters (both email and 'svn log --search'), and this script returns the results I want when doing these searches. Sponsored by: The FreeBSD Foundation Added: head/release/scripts/relnotes-search.sh (contents, props changed) Added: head/release/scripts/relnotes-search.sh == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/release/scripts/relnotes-search.sh Mon May 5 23:01:01 2014 (r265405) @@ -0,0 +1,133 @@ +#!/bin/sh +#- +# Copyright (c) 2014 The FreeBSD Foundation +# All rights reserved. +# +# This software were developed by Glen Barber +# under sponsorship from the FreeBSD Foundation. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +#notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +#notice, this list of conditions and the following disclaimer in the +#documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +set -C + +PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin" +export PATH + +usage() { + echo "Usage:" + echo -n "$(basename ${0}) [-rNN]" + echo " [-l /path/for/output] /path/to/branch" + echo " -r: The oldest commit to include in the search" + echo "" + exit 1 +} + +main() { + while getopts "l:r:" arg ; do + case ${arg} in + l) + # Disallow '-rNN' argument for oldest + # revision # from becoming the log file + # accidentally. + where="${OPTARG##-r*}" + [ -z "${where}" ] && usage + if [ -e "${where}" ]; then + echo "Log file already exists:" + echo " (${where})" + exit 2 + fi + ;; + r) + rev="${OPTARG##-r}" + c=$(echo -n ${rev} | tr -d '0-9' | wc -c) + if [ ${c} -ne 0 ]; then + echo "Revision number must be numeric." + exit 2 + fi + # Since the last specified revision is + # specified, mangle the variable to + # make svn syntax happy. + rev="-r${rev}:rHEAD" + ;; + *) + usage + ;; + esac + done + shift $(( ${OPTIND} - 1 )) + + # This assumes a local working copy, which svn search + # allows exactly one repository path (although the root + # can still be the path). + [ "$#" -ne 1 ] && usage + + # If no log file, write to stdout. + [ -z "${where}" ] && where=/dev/stdout + + svn= + # Where is svn? + for s in /usr/bin /usr/local/bin; do + if [ -x ${s}/svn ]; then + svn=${s}/svn + break + fi + if [ -x ${s}/svnlite ]; then + svn=${s}/svnlite + break + fi + done + # Did we find svn? + if [ -z "${svn}" ]; then + echo "svn(1) binary not found." + exit 2 +
Re: svn commit: r265367 - head/lib/libc/regex
On May 5, 2014, at 3:43 PM, David Chisnall wrote: > On 5 May 2014, at 22:33, Warner Losh wrote: > >> reallocf(): >>The reallocf() function is identical to the realloc() function, except >>that it will free the passed pointer when the requested memory cannot be >>allocated. This is a FreeBSD specific API designed to ease the problems >>with traditional coding styles for realloc() causing memory leaks in >>libraries. >> ... >>The reallocf() function first appeared in FreeBSD 3.0. > > While reallocf() is nice, it doesn't address the problem of overflow. It > takes a single size, forcing the caller to do the number-of-elements * > element-size multiplication, which is the problematic one. If an attacker > can control the number of elements, then it's possible to make the > multiplication overflow so reallocf() will return a valid pointer to an area > of memory that is much smaller than the caller was expecting. Stupid is as stupid does. malloc and realloc both have this same issue. While an interesting theoretical attack, the size doesn’t necessarily come from multiplication. Careful coding is still required, not matter what spin you put on this. reallocf() solves the memory leak issue, but not the problem with overflow (which the realloc() interface has too). The caller can check to make sure they aren’t requesting too much memory and overflowing. The interface isn’t designed to solve the problem you are complaining about. There’s only so much you can do to prevent programming errors. calloc() isn’t going to solve the world’s problems for you, and introduces a non-trivial amount of overhead for the trivial amount of overhead that is “saved” by moving the overflow check from the caller to the callee... Warner signature.asc Description: Message signed with OpenPGP using GPGMail
Re: svn commit: r265367 - head/lib/libc/regex
On 06.05.2014 2:12, David Chisnall wrote: > On 5 May 2014, at 22:51, Andrey Chernov wrote: > >> For standard malloc/realloc interface it is up to the caller to check >> n*size not overflows. You must trust caller already does such check. > > Do a search of the CVE database sometime to see how well placed that trust > generally is. Or even look at the code in question, where none of the > realloc() or malloc() calls does overflow checking. I know current situation and disagree with OpenBSD way to fix it. Public interface assumes that caller should be trusted. Period. How well it is really trusted is up to the caller and should be fixed in it clearly, allowing human to trace the logic. >> Using calloc() to enforce it instead of caller is semantically wrong, > > Relying on a standard function to behave according to the standard is > semantically wrong? Yes. Generally it is using a function outside of its purpose. I.e. you can use calloc() just to check n*size and nothing else (free() result immediately afterwards) instead of writing just single check by yourself. It will be legal usage but semantically wrong and misleading. >> and especially strange when the caller is standard C library under your >> control. > > I don't follow this. If libc can't rely on standards conformance from itself > then other code stands no chance. Libc here is the caller which is well under control because of the same codebase. It means that n*size check can be easily added before malloc call instead of using side effects with hidden logic. As I mention initially, literal enough checks is what we need to make logic clear. In the case we discuss realloc() can be changed by reallocf() which does n*size and NULL checks and literal "if" should be added before malloc() to check overflow. -- http://ache.vniz.net/ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r265367 - head/lib/libc/regex
On May 5, 2014, at 4:10 PM, Pedro Giffuni wrote: > El 5/5/2014 4:21 PM, David Chisnall escribió: >> On 5 May 2014, at 20:49, Pedro Giffuni wrote: >> >>> Yes, but I reverted it because there are other ways to check for overflows >>> without the performance hit. >> > > FWIW, in this particular case I think the overflow simply doesn't happen: > apparently it is easier to be hit by a DoS first. > > >> Do we have a good reusable routine for doing this somewhere? Clang and gcc >> both have some idiom recognisers that try to spot when people are attempting >> to do this. Clang also has a builtin, which would be good to use when >> available. Overflow checking is very cheap on modern CPUs (add, branch on >> carry), so it would be nice if we could start looking for this malloc() and >> realloc() pattern and replacing the multiply with something that checks for >> the error. >> > > We don't. OpenBSD introduced an extension: reallocarray(). We do. reallocf(), which first appeared in FreeBSD 3.0. Warner ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r265367 - head/lib/libc/regex
El 5/5/2014 4:21 PM, David Chisnall escribió: On 5 May 2014, at 20:49, Pedro Giffuni wrote: Yes, but I reverted it because there are other ways to check for overflows without the performance hit. FWIW, in this particular case I think the overflow simply doesn't happen: apparently it is easier to be hit by a DoS first. Do we have a good reusable routine for doing this somewhere? Clang and gcc both have some idiom recognisers that try to spot when people are attempting to do this. Clang also has a builtin, which would be good to use when available. Overflow checking is very cheap on modern CPUs (add, branch on carry), so it would be nice if we could start looking for this malloc() and realloc() pattern and replacing the multiply with something that checks for the error. We don't. OpenBSD introduced an extension: reallocarray(). Pedro. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265403 - head/sys/dev/vt/hw/vga
Author: ray Date: Mon May 5 22:12:46 2014 New Revision: 265403 URL: http://svnweb.freebsd.org/changeset/base/265403 Log: Switch vga drivers to use names and new vt(4) driver probe method. Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/vt/hw/vga/vga.c Modified: head/sys/dev/vt/hw/vga/vga.c == --- head/sys/dev/vt/hw/vga/vga.cMon May 5 22:10:31 2014 (r265402) +++ head/sys/dev/vt/hw/vga/vga.cMon May 5 22:12:46 2014 (r265403) @@ -71,6 +71,7 @@ struct vga_softc { #defineVT_VGA_HEIGHT 480 #defineVT_VGA_MEMSIZE (VT_VGA_WIDTH * VT_VGA_HEIGHT / 8) +static vd_probe_t vga_probe; static vd_init_t vga_init; static vd_blank_t vga_blank; static vd_bitbltchr_t vga_bitbltchr; @@ -81,6 +82,8 @@ static vd_putchar_t vga_putchar; static vd_postswitch_t vga_postswitch; static const struct vt_driver vt_vga_driver = { + .vd_name= "vga", + .vd_probe = vga_probe, .vd_init= vga_init, .vd_blank = vga_blank, .vd_bitbltchr = vga_bitbltchr, @@ -97,8 +100,7 @@ static const struct vt_driver vt_vga_dri * buffer is always big enough to support both. */ static struct vga_softc vga_conssoftc; -VT_CONSDEV_DECLARE(vt_vga_driver, MAX(80, PIXEL_WIDTH(VT_VGA_WIDTH)), -MAX(25, PIXEL_HEIGHT(VT_VGA_HEIGHT)), &vga_conssoftc); +VT_DRIVER_DECLARE(vt_vga, vt_vga_driver); static inline void vga_setcolor(struct vt_device *vd, term_color_t color) @@ -631,10 +633,22 @@ vga_initialize(struct vt_device *vd, int } static int +vga_probe(struct vt_device *vd) +{ + + return (CN_INTERNAL); +} + +static int vga_init(struct vt_device *vd) { - struct vga_softc *sc = vd->vd_softc; - int textmode = 0; + struct vga_softc *sc; + int textmode; + + if (vd->vd_softc == NULL) + vd->vd_softc = (void *)&vga_conssoftc; + sc = vd->vd_softc; + textmode = 0; #if defined(__amd64__) || defined(__i386__) sc->vga_fb_tag = X86_BUS_SPACE_MEM; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r265367 - head/lib/libc/regex
On 5 May 2014, at 22:51, Andrey Chernov wrote: > For standard malloc/realloc interface it is up to the caller to check > n*size not overflows. You must trust caller already does such check. Do a search of the CVE database sometime to see how well placed that trust generally is. Or even look at the code in question, where none of the realloc() or malloc() calls does overflow checking. > Using calloc() to enforce it instead of caller is semantically wrong, Relying on a standard function to behave according to the standard is semantically wrong? > and especially strange when the caller is standard C library under your > control. I don't follow this. If libc can't rely on standards conformance from itself then other code stands no chance. > It was unclear what type of ckecking you mean initially You mean when I said 'the overflow-checking behaviour of calloc'? I'm sorry, but I'm not sure how I could have made that clearer. > and confirm my > statement that such code is hard to understand. I disagree. Favouring calloc() over malloc() unless profiling indicates that calloc() is a bottleneck has been recommended practice for a *very* long time and I'm honestly surprised to encounter C programmers who have not come across the advice. > Even if it is for > arithmetic overflow, it is still semantically incorrect, see my other > answer. Your other answer did not say *why* you think it's 'semantically incorrect'. The standard requires calloc() to do overflow checking and that is the reason for its use in the overwhelming number of cases. > Main purpose of calloc is to zero memory, not to check its > argument, so its argument checking is side effect. It should be > implemented by the caller (as I already answer) and not by the price of > zeroing. It is unfortunate that the zeroing and the overflow checking were conflated in the standard, but that certainly doesn't mean that it is the only purpose of calloc. If you want to argue that the price of zeroing is too high, then I would like to see some profiling data to back it up. Between the cost of performing an allocation and the cost of doing a regex search, I'd be surprised if the cost of a bzero() were not in the noise. To offset this, you'd be increasing i-cache usage at every malloc() call site by wrapping it in an overflow check (if you want the code to be *correct* as well as fast), which is likely to be a bigger hit. The reason that calloc() does zeroing in the first place rather than just having malloc() followed by memset() / bzero() is that the memory that malloc() gets from the kernel is already zero'd, and so the 'price' for the zeroing is often nothing. David P.S. A quick look at Coverity shows 4 other bugs in this file, one of which looks like it might actually be serious. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265402 - head/sys/dev/vt/hw/vga
Author: ray Date: Mon May 5 22:10:31 2014 New Revision: 265402 URL: http://svnweb.freebsd.org/changeset/base/265402 Log: Revert r264997 and r265026. It is not required anymore. Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/vt/hw/vga/vga.c Modified: head/sys/dev/vt/hw/vga/vga.c == --- head/sys/dev/vt/hw/vga/vga.cMon May 5 22:03:08 2014 (r265401) +++ head/sys/dev/vt/hw/vga/vga.cMon May 5 22:10:31 2014 (r265402) @@ -45,10 +45,8 @@ __FBSDID("$FreeBSD$"); #if defined(__amd64__) || defined(__i386__) #include #include -#include #include #include -#include #endif /* __amd64__ || __i386__ */ struct vga_softc { @@ -638,19 +636,6 @@ vga_init(struct vt_device *vd) struct vga_softc *sc = vd->vd_softc; int textmode = 0; -#if defined(__amd64__) - /* Disable if EFI framebuffer present. Should be handled by priority -* logic in vt(9), but this will do for now. XXX */ - - caddr_t kmdp, efifb; - kmdp = preload_search_by_type("elf kernel"); - if (kmdp == NULL) - kmdp = preload_search_by_type("elf64 kernel"); - efifb = preload_search_info(kmdp, MODINFO_METADATA | MODINFOMD_EFI_FB); - if (efifb != NULL) - return (CN_DEAD); -#endif - #if defined(__amd64__) || defined(__i386__) sc->vga_fb_tag = X86_BUS_SPACE_MEM; sc->vga_fb_handle = KERNBASE + VGA_MEM_BASE; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265400 - in head: share/mk sys/boot/i386/boot2
Author: imp Date: Mon May 5 22:03:01 2014 New Revision: 265400 URL: http://svnweb.freebsd.org/changeset/base/265400 Log: Introduce CWARNFLAGS.${COMPILER_TYPE} and use that to simplify the thicket of .if ${COMPILER_TYPE} == "clang" that controls warnings. Also, use CFLAGS.clang in a couple places in preference to having a similar construct that's related to the CWARNFLAGS changes. Modified: head/share/mk/bsd.sys.mk head/sys/boot/i386/boot2/Makefile Modified: head/share/mk/bsd.sys.mk == --- head/share/mk/bsd.sys.mkMon May 5 22:02:48 2014(r265399) +++ head/share/mk/bsd.sys.mkMon May 5 22:03:01 2014(r265400) @@ -52,9 +52,8 @@ CWARNFLAGS+= -Wcast-align .if ${WARNS} >= 6 CWARNFLAGS+= -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls\ -Wold-style-definition -.if ${COMPILER_TYPE} == "clang" && !defined(EARLY_BUILD) && \ -!defined(NO_WMISSING_VARIABLE_DECLARATIONS) -CWARNFLAGS+= -Wmissing-variable-declarations +.if !defined(EARLY_BUILD) && !defined(NO_WMISSING_VARIABLE_DECLARATIONS) +CWARNFLAGS.clang+= -Wmissing-variable-declarations .endif .endif # WARNS >= 6 .if ${WARNS} >= 2 && ${WARNS} <= 4 @@ -65,24 +64,24 @@ CWARNFLAGS+=-Wno-uninitialized CWARNFLAGS+= -Wno-pointer-sign # Clang has more warnings enabled by default, and when using -Wall, so if WARNS # is set to low values, these have to be disabled explicitly. -.if ${COMPILER_TYPE} == "clang" && !defined(EARLY_BUILD) +.if !defined(EARLY_BUILD) .if ${WARNS} <= 6 -CWARNFLAGS+= -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable +CWARNFLAGS.clang+= -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable .endif # WARNS <= 6 .if ${WARNS} <= 3 -CWARNFLAGS+= -Wno-tautological-compare -Wno-unused-value\ +CWARNFLAGS.clang+= -Wno-tautological-compare -Wno-unused-value\ -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion .endif # WARNS <= 3 .if ${WARNS} <= 2 -CWARNFLAGS+= -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter +CWARNFLAGS.clang+= -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter .endif # WARNS <= 2 .if ${WARNS} <= 1 -CWARNFLAGS+= -Wno-parentheses +CWARNFLAGS.clang+= -Wno-parentheses .endif # WARNS <= 1 .if defined(NO_WARRAY_BOUNDS) -CWARNFLAGS+= -Wno-array-bounds +CWARNFLAGS.clang+= -Wno-array-bounds .endif # NO_WARRAY_BOUNDS -.endif # CLANG +.endif # !EARLY_BUILD .endif # WARNS .if defined(FORMAT_AUDIT) @@ -92,11 +91,11 @@ WFORMAT=1 .if ${WFORMAT} > 0 #CWARNFLAGS+= -Wformat-nonliteral -Wformat-security -Wno-format-extra-args CWARNFLAGS+= -Wformat=2 -Wno-format-extra-args -.if ${COMPILER_TYPE} == "clang" && !defined(EARLY_BUILD) +.if !defined(EARLY_BUILD) .if ${WARNS} <= 3 -CWARNFLAGS+= -Wno-format-nonliteral +CWARNFLAGS.clang+= -Wno-format-nonliteral .endif # WARNS <= 3 -.endif # CLANG +.endif # !EARLY_BUILD .if !defined(NO_WERROR) && !defined(NO_WERROR.${COMPILER_TYPE}) CWARNFLAGS+= -Werror .endif # !NO_WERROR && !NO_WERROR.${COMPILER_TYPE} @@ -111,23 +110,25 @@ CWARNFLAGS+= -Wno-format CWARNFLAGS+= -Wno-unknown-pragmas .endif # IGNORE_PRAGMA -.if !defined(EARLY_BUILD) .if ${COMPILER_TYPE} == "clang" +# Would love to do this unconditionally, but can't due to its use in +# kernel build coupled with CFLAGS.${TARGET} feature CLANG_NO_IAS= -no-integrated-as +.endif CLANG_OPT_SMALL= -mstack-alignment=8 -mllvm -inline-threshold=3\ -mllvm -enable-load-pre=false -mllvm -simplifycfg-dup-ret -CFLAGS+=-Qunused-arguments +.if !defined(EARLY_BUILD) +CFLAGS.clang+= -Qunused-arguments .if ${MACHINE_CPUARCH} == "sparc64" # Don't emit .cfi directives, since we must use GNU as on sparc64, for now. -CFLAGS+=-fno-dwarf2-cfi-asm +CFLAGS.clang+= -fno-dwarf2-cfi-asm .endif # SPARC64 # The libc++ headers use c++11 extensions. These are normally silenced because # they are treated as system headers, but we explicitly disable that warning # suppression when building the base system to catch bugs in our headers. # Eventually we'll want to start building the base system C++ code as C++11, # but not yet. -CXXFLAGS+= -Wno-c++11-extensions -.endif # CLANG +CXXFLAGS.clang+=-Wno-c++11-extensions CFLAGS+=${CFLAGS.${COMPILER_TYPE}} CXXFLAGS+= ${CXXFLAGS.${COMPILER_TYPE}} .endif # !EARLY_BUILD @@ -140,8 +141,7 @@ CFLAGS+=${SSP_CFLAGS} .endif # SSP && !IA64 && !ARM && !MIPS # Allow user-specified additional warning flags -CFLAGS+= ${CWARNFLAGS} - +CFLAGS+= ${CWARNFLAGS} ${CWARNFLAGS.${COMPILER_TYPE}} # Tell bmake not to mistake standard targets for things to be searched for # or expect to ever be up-to-date. Modified: head/sys/boot/i386/boot2/Makefile == --- head/sys/boot/i386/boot2/Makefile Mon May
svn commit: r265401 - head/share/mk
Author: imp Date: Mon May 5 22:03:08 2014 New Revision: 265401 URL: http://svnweb.freebsd.org/changeset/base/265401 Log: Simplify use of the semi-bogus EARLY_BUILD variable. Also, simplify use of semi-bogus NO_WARNS variable. Both of these, in this case, should collapse to WITHOUT_WARNS in a future commit. Modified: head/share/mk/bsd.sys.mk Modified: head/share/mk/bsd.sys.mk == --- head/share/mk/bsd.sys.mkMon May 5 22:03:01 2014(r265400) +++ head/share/mk/bsd.sys.mkMon May 5 22:03:08 2014(r265401) @@ -24,7 +24,6 @@ CFLAGS+= -std=iso9899:1999 .else # CSTD CFLAGS+= -std=${CSTD} .endif # CSTD -.if !defined(NO_WARNS) # -pedantic is problematic because it also imposes namespace restrictions #CFLAGS+= -pedantic .if defined(WARNS) @@ -52,7 +51,7 @@ CWARNFLAGS+= -Wcast-align .if ${WARNS} >= 6 CWARNFLAGS+= -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls\ -Wold-style-definition -.if !defined(EARLY_BUILD) && !defined(NO_WMISSING_VARIABLE_DECLARATIONS) +.if !defined(NO_WMISSING_VARIABLE_DECLARATIONS) CWARNFLAGS.clang+= -Wmissing-variable-declarations .endif .endif # WARNS >= 6 @@ -64,7 +63,6 @@ CWARNFLAGS+= -Wno-uninitialized CWARNFLAGS+= -Wno-pointer-sign # Clang has more warnings enabled by default, and when using -Wall, so if WARNS # is set to low values, these have to be disabled explicitly. -.if !defined(EARLY_BUILD) .if ${WARNS} <= 6 CWARNFLAGS.clang+= -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable .endif # WARNS <= 6 @@ -81,7 +79,6 @@ CWARNFLAGS.clang+=-Wno-parentheses .if defined(NO_WARRAY_BOUNDS) CWARNFLAGS.clang+= -Wno-array-bounds .endif # NO_WARRAY_BOUNDS -.endif # !EARLY_BUILD .endif # WARNS .if defined(FORMAT_AUDIT) @@ -91,11 +88,9 @@ WFORMAT= 1 .if ${WFORMAT} > 0 #CWARNFLAGS+= -Wformat-nonliteral -Wformat-security -Wno-format-extra-args CWARNFLAGS+= -Wformat=2 -Wno-format-extra-args -.if !defined(EARLY_BUILD) .if ${WARNS} <= 3 CWARNFLAGS.clang+= -Wno-format-nonliteral .endif # WARNS <= 3 -.endif # !EARLY_BUILD .if !defined(NO_WERROR) && !defined(NO_WERROR.${COMPILER_TYPE}) CWARNFLAGS+= -Werror .endif # !NO_WERROR && !NO_WERROR.${COMPILER_TYPE} @@ -104,7 +99,6 @@ CWARNFLAGS+= -Werror .if defined(NO_WFORMAT) || defined(NO_WFORMAT.${COMPILER_TYPE}) CWARNFLAGS+= -Wno-format .endif # NO_WFORMAT || NO_WFORMAT.${COMPILER_TYPE} -.endif # !NO_WARNS .if defined(IGNORE_PRAGMA) CWARNFLAGS+= -Wno-unknown-pragmas @@ -117,7 +111,6 @@ CLANG_NO_IAS=-no-integrated-as .endif CLANG_OPT_SMALL= -mstack-alignment=8 -mllvm -inline-threshold=3\ -mllvm -enable-load-pre=false -mllvm -simplifycfg-dup-ret -.if !defined(EARLY_BUILD) CFLAGS.clang+= -Qunused-arguments .if ${MACHINE_CPUARCH} == "sparc64" # Don't emit .cfi directives, since we must use GNU as on sparc64, for now. @@ -129,9 +122,6 @@ CFLAGS.clang+= -fno-dwarf2-cfi-asm # Eventually we'll want to start building the base system C++ code as C++11, # but not yet. CXXFLAGS.clang+=-Wno-c++11-extensions -CFLAGS+=${CFLAGS.${COMPILER_TYPE}} -CXXFLAGS+= ${CXXFLAGS.${COMPILER_TYPE}} -.endif # !EARLY_BUILD .if ${MK_SSP} != "no" && ${MACHINE_CPUARCH} != "ia64" && \ ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" @@ -140,8 +130,19 @@ SSP_CFLAGS?= -fstack-protector CFLAGS+= ${SSP_CFLAGS} .endif # SSP && !IA64 && !ARM && !MIPS -# Allow user-specified additional warning flags +# Allow user-specified additional warning flags, plus compiler specific flag overrides. +# Unless we're early in the build, in which case don't (which is lame, this should +# be handled by NO_WARNS which needs to migrate to something else. +.if !defined(NO_WARNS) && !defined(EARLY_BUILD) CFLAGS+= ${CWARNFLAGS} ${CWARNFLAGS.${COMPILER_TYPE}} +.endif + +# Not sure this is 100% kosher, but I think that EARLY_BUILD must be only +# defined when we're not building programs that use the CFLAGS.foo feature. +.if !defined(EARLY_BUILD) +CFLAGS+=${CFLAGS.${COMPILER_TYPE}} +CXXFLAGS+= ${CXXFLAGS.${COMPILER_TYPE}} +.endif # Tell bmake not to mistake standard targets for things to be searched for # or expect to ever be up-to-date. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265399 - head/share/mk
Author: imp Date: Mon May 5 22:02:48 2014 New Revision: 265399 URL: http://svnweb.freebsd.org/changeset/base/265399 Log: [1] Make WITHOUT_FOO alway trump WITH_FOO, regardless of the system default. This restores more of the historical expectations that were broken when we started disallowing both WITH_FOO and WITHOUT_FOO to be defined. [2] Document this new behavior, and improve the documentation in general here. Submitted by: sjg@ [1]. Modified: head/share/mk/bsd.mkopt.mk Modified: head/share/mk/bsd.mkopt.mk == --- head/share/mk/bsd.mkopt.mk Mon May 5 21:49:31 2014(r265398) +++ head/share/mk/bsd.mkopt.mk Mon May 5 22:02:48 2014(r265399) @@ -1,22 +1,34 @@ # # $FreeBSD$ # -# Generic mechanism to deal with WITH and WITHOUT options and turn them into MK_ options. +# Generic mechanism to deal with WITH and WITHOUT options and turn +# them into MK_ options. # +# For each option FOO in __DEFUALT_YES_OPTIONS, MK_FOO is set to +# "yes", unless WITHOUT_FOO is defined, in which case it is set to +# "no". +# +# For each option FOO in __DEFUALT_NO_OPTIONS, MK_FOO is set to "no", +# unless WITH_FOO is defined, in which case it is set to "yes". +# +# If both WITH_FOO and WITHOUT_FOO are defined, WITHOUT_FOO wins and +# MK_FOO is set to "no" regardless of which list it was in. +# +# Both __DEFAULT_YES_OPTIONS and __DEFAULT_NO_OPTIONS are undef'd +# after all this processing, allowing this file to be included +# multiple times with different lists. +# +# Users should generally define WITH_FOO or WITHOUT_FOO, but the build +# system should use MK_FOO={yes,no} when it needs to override the +# user's desires or default behavior. # -# For each option FOO that defaults to YES, MK_FOO is set to yes, unless WITHOUT_FOO -# is defined, in which case it is set to no. If both WITH_FOO and WITHOUT_FOO are -# defined, WITHOUT_FOO wins. The list of default yes options is contained in the -# __DEFAULT_YES_OPTIONS variable, which is undefined after expansion. -# -# For each option FOO that defaults to NO, MK_FOO is set to no, unless WITH_FOO -# is defined, in which case it is set to yes. If both WITH_FOO and WITHOUT_FOO are -# defined, WITH_FOO wins. The list of default no options is contained in the -# __DEFAULT_NO_OPTIONS variable, which is undefined after expansion. + +# +# MK_* options which default to "yes". # .for var in ${__DEFAULT_YES_OPTIONS} .if !defined(MK_${var}) -.if defined(WITHOUT_${var})# IF both WITH and WITHOUT defined, WITHOUT wins. +.if defined(WITHOUT_${var})# WITHOUT always wins MK_${var}:=no .else MK_${var}:=yes @@ -30,7 +42,7 @@ MK_${var}:= yes # .for var in ${__DEFAULT_NO_OPTIONS} .if !defined(MK_${var}) -.if defined(WITH_${var}) # If both WITH and WITHOUT defined, WITH wins +.if definfed(WITH_${var} && !defined(WITHOUT_${var}) # WITHOUT aways wins MK_${var}:=yes .else MK_${var}:=no ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r265367 - head/lib/libc/regex
On 06.05.2014 1:52, David Chisnall wrote: > This is not relying on undocumented intrinsic knowledge, this is relying on > the standard library doing what is required of it. There is a reason why > secure coding standards have, for over a decade, said to prefer calloc() over > malloc() unless profiling shows that calloc() is a bottleneck: it means that > only one person needs to get the overflow checking right in one place, rather > than everyone getting it right everywhere. It was unclear what type of ckecking you mean initially and confirm my statement that such code is hard to understand. Even if it is for arithmetic overflow, it is still semantically incorrect, see my other answer. Main purpose of calloc is to zero memory, not to check its argument, so its argument checking is side effect. It should be implemented by the caller (as I already answer) and not by the price of zeroing. -- http://ache.vniz.net/ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r265367 - head/lib/libc/regex
On 5 May 2014, at 22:40, Andrey Chernov wrote: > On 05.05.2014 22:28, David Chisnall wrote: >> On 5 May 2014, at 18:42, Andrey Chernov wrote: >> >>> Please don't commit OpenBSD errors. Now you mix calloc() with the >>> realloc() for the same variable later which makes calloc() zeroing >>> pointless and waste of CPU. >> >> The purpose of calloc() here is not (primarily) to get the zero'd size, it's >> to get the overflow-checking behaviour for calloc. > > It is better to avoid using undocumented intrinsic knowledge of standard > function particular implementation, this is unportable at least and hard > to understand too. calloc() is required to return either NULL or a valid pointer to the requested amount of memory. An implementation that does not correctly check for overflow is buggy and will be regarded as a security hole (see: http://cert.uni-stuttgart.de/ticker/advisories/calloc.html), but fortunately these were all fixed by around 2004. This is not relying on undocumented intrinsic knowledge, this is relying on the standard library doing what is required of it. There is a reason why secure coding standards have, for over a decade, said to prefer calloc() over malloc() unless profiling shows that calloc() is a bottleneck: it means that only one person needs to get the overflow checking right in one place, rather than everyone getting it right everywhere. David ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r265367 - head/lib/libc/regex
On 06.05.2014 1:43, David Chisnall wrote: > While reallocf() is nice, it doesn't address the problem of overflow. It > takes a single size, forcing the caller to do the number-of-elements * > element-size multiplication, which is the problematic one. If an attacker > can control the number of elements, then it's possible to make the > multiplication overflow so reallocf() will return a valid pointer to an area > of memory that is much smaller than the caller was expecting. For standard malloc/realloc interface it is up to the caller to check n*size not overflows. You must trust caller already does such check. Using calloc() to enforce it instead of caller is semantically wrong, and especially strange when the caller is standard C library under your control. -- http://ache.vniz.net/ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265398 - head/sys/dev/vt/hw/ofwfb
Author: ray Date: Mon May 5 21:49:31 2014 New Revision: 265398 URL: http://svnweb.freebsd.org/changeset/base/265398 Log: Add vt(4) driver name for ofwfb driver. Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/vt/hw/ofwfb/ofwfb.c Modified: head/sys/dev/vt/hw/ofwfb/ofwfb.c == --- head/sys/dev/vt/hw/ofwfb/ofwfb.cMon May 5 21:48:19 2014 (r265397) +++ head/sys/dev/vt/hw/ofwfb/ofwfb.cMon May 5 21:49:31 2014 (r265398) @@ -63,6 +63,7 @@ static vd_blank_t ofwfb_blank; static vd_bitbltchr_t ofwfb_bitbltchr; static const struct vt_driver vt_ofwfb_driver = { + .vd_name= "ofwfb", .vd_init= ofwfb_init, .vd_blank = ofwfb_blank, .vd_bitbltchr = ofwfb_bitbltchr, ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265397 - in head/sys/dev/vt/hw: efifb fb
Author: ray Date: Mon May 5 21:48:19 2014 New Revision: 265397 URL: http://svnweb.freebsd.org/changeset/base/265397 Log: Switch fb and efifb drivers to use names and new vt(4) driver probe method. Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/vt/hw/efifb/efifb.c head/sys/dev/vt/hw/fb/vt_early_fb.c head/sys/dev/vt/hw/fb/vt_fb.c head/sys/dev/vt/hw/fb/vt_fb.h Modified: head/sys/dev/vt/hw/efifb/efifb.c == --- head/sys/dev/vt/hw/efifb/efifb.cMon May 5 21:46:10 2014 (r265396) +++ head/sys/dev/vt/hw/efifb/efifb.cMon May 5 21:48:19 2014 (r265397) @@ -51,36 +51,58 @@ __FBSDID("$FreeBSD$"); #include #include -static vd_init_t vt_efb_init; +static vd_init_t vt_efifb_init; +static vd_probe_t vt_efifb_probe; -static struct vt_driver vt_efb_driver = { - .vd_init = vt_efb_init, +static struct vt_driver vt_efifb_driver = { + .vd_name = "efifb", + .vd_probe = vt_efifb_probe, + .vd_init = vt_efifb_init, .vd_blank = vt_fb_blank, .vd_bitbltchr = vt_fb_bitbltchr, + .vd_maskbitbltchr = vt_fb_maskbitbltchr, /* Better than VGA, but still generic driver. */ .vd_priority = VD_PRIORITY_GENERIC + 1, }; -static struct fb_info info; -VT_CONSDEV_DECLARE(vt_efb_driver, -MAX(80, PIXEL_WIDTH(VT_FB_DEFAULT_WIDTH)), -MAX(25, PIXEL_HEIGHT(VT_FB_DEFAULT_HEIGHT)), &info); +static struct fb_info local_info; +VT_DRIVER_DECLARE(vt_efifb, vt_efifb_driver); static int -vt_efb_init(struct vt_device *vd) +vt_efifb_probe(struct vt_device *vd) { - int depth, d, disable, i, len; - struct fb_info *info; + int disabled; struct efi_fb *efifb; caddr_t kmdp; - info = vd->vd_softc; + disabled = 0; + TUNABLE_INT_FETCH("hw.syscons.disable", &disabled); + if (disabled != 0) + return (CN_DEAD); - disable = 0; - TUNABLE_INT_FETCH("hw.syscons.disable", &disable); - if (disable != 0) + kmdp = preload_search_by_type("elf kernel"); + if (kmdp == NULL) + kmdp = preload_search_by_type("elf64 kernel"); + efifb = (struct efi_fb *)preload_search_info(kmdp, + MODINFO_METADATA | MODINFOMD_EFI_FB); + if (efifb == NULL) return (CN_DEAD); + return (CN_INTERNAL); +} + +static int +vt_efifb_init(struct vt_device *vd) +{ + int depth, d, i, len; + struct fb_info *info; + struct efi_fb *efifb; + caddr_t kmdp; + + info = vd->vd_softc; + if (info == NULL) + info = vd->vd_softc = (void *)&local_info; + kmdp = preload_search_by_type("elf kernel"); if (kmdp == NULL) kmdp = preload_search_by_type("elf64 kernel"); @@ -136,7 +158,8 @@ vt_efb_init(struct vt_device *vd) fb_probe(info); vt_fb_init(vd); + /* Clear the screen. */ + vt_fb_blank(vd, TC_BLACK); return (CN_INTERNAL); } - Modified: head/sys/dev/vt/hw/fb/vt_early_fb.c == --- head/sys/dev/vt/hw/fb/vt_early_fb.c Mon May 5 21:46:10 2014 (r265396) +++ head/sys/dev/vt/hw/fb/vt_early_fb.c Mon May 5 21:48:19 2014 (r265397) @@ -52,18 +52,19 @@ __FBSDID("$FreeBSD$"); #include static vd_init_t vt_efb_init; +static vd_probe_t vt_efb_probe; static struct vt_driver vt_fb_early_driver = { + .vd_name = "efb", + .vd_probe = vt_efb_probe, .vd_init = vt_efb_init, .vd_blank = vt_fb_blank, .vd_bitbltchr = vt_fb_bitbltchr, .vd_priority = VD_PRIORITY_GENERIC, }; -static struct fb_info info; -VT_CONSDEV_DECLARE(vt_fb_early_driver, -MAX(80, PIXEL_WIDTH(VT_FB_DEFAULT_WIDTH)), -MAX(25, PIXEL_HEIGHT(VT_FB_DEFAULT_HEIGHT)), &info); +static struct fb_info local_info; +VT_DRIVER_DECLARE(vt_efb, vt_fb_early_driver); static void #ifdef FDT @@ -126,30 +127,62 @@ vt_efb_initialize(struct fb_info *info) } } -static int -vt_efb_init(struct vt_device *vd) +static phandle_t +vt_efb_get_fbnode() { - struct ofw_pci_register pciaddrs[8]; - struct fb_info *info; - int i, len, n_pciaddrs; phandle_t chosen, node; ihandle_t stdout; char type[64]; - info = vd->vd_softc; - chosen = OF_finddevice("/chosen"); OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)); node = OF_instance_to_package(stdout); - if (node == -1) { - /* -* The "/chosen/stdout" does not exist try -* using "screen" directly. -*/ - node = OF_finddevice("screen"); + if (node != -1) { + /* The "/chosen/stdout" present. */ + OF_getprop(node, "device_type", type, sizeof(type)); + /* Check i
svn commit: r265396 - head/sys/sys
Author: rwatson Date: Mon May 5 21:46:10 2014 New Revision: 265396 URL: http://svnweb.freebsd.org/changeset/base/265396 Log: Garbage collect two more unused sysinit subsystems: SI_SUB_KVM_RSRC and SI_SUB_CLISTS. MFC after:3 days Modified: head/sys/sys/kernel.h Modified: head/sys/sys/kernel.h == --- head/sys/sys/kernel.h Mon May 5 21:44:53 2014(r265395) +++ head/sys/sys/kernel.h Mon May 5 21:46:10 2014(r265396) @@ -94,7 +94,6 @@ enum sysinit_sub_id { SI_SUB_MTX_POOL_STATIC = 0x090,/* static mutex pool */ SI_SUB_VM = 0x100,/* virtual memory system init*/ SI_SUB_KMEM = 0x180,/* kernel memory*/ - SI_SUB_KVM_RSRC = 0x1A0,/* kvm operational limits*/ SI_SUB_HYPERVISOR = 0x1A4,/* * Hypervisor detection and * virtualization support @@ -138,7 +137,6 @@ enum sysinit_sub_id { SI_SUB_CONFIGURE= 0x380,/* Configure devices */ SI_SUB_VFS = 0x400,/* virtual filesystem*/ SI_SUB_CLOCKS = 0x480,/* real time and stat clocks*/ - SI_SUB_CLIST= 0x580,/* clists*/ SI_SUB_SYSV_SHM = 0x640,/* System V shared memory*/ SI_SUB_SYSV_SEM = 0x680,/* System V semaphores*/ SI_SUB_SYSV_MSG = 0x6C0,/* System V message queues*/ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265395 - head/sys/dev/vt
Author: ray Date: Mon May 5 21:44:53 2014 New Revision: 265395 URL: http://svnweb.freebsd.org/changeset/base/265395 Log: Set of updates to vt(4) core part. o Declare vt(4) drivers dataset. o Create single static structures for all early drivers. o Add vt(4) to be by default in the kernel consoles list. o Create one more sysinit point, to be able to initialize memory and lock requirement of early drivers. o Implement early drivers select. (Only best available will be selected). o Fix one missed "return (0)" for VTYLOCK. o Improve locking for cases when one driver replace another. o Make driver replacement notification less debug-look-like. Minor spell fixes. Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/vt/vt_core.c Modified: head/sys/dev/vt/vt_core.c == --- head/sys/dev/vt/vt_core.c Mon May 5 21:34:10 2014(r265394) +++ head/sys/dev/vt/vt_core.c Mon May 5 21:44:53 2014(r265395) @@ -144,6 +144,83 @@ static int vt_window_switch(struct vt_wi static int vt_late_window_switch(struct vt_window *); static int vt_proc_alive(struct vt_window *); static void vt_resize(struct vt_device *); +static void vt_update_static(void *); + +SET_DECLARE(vt_drv_set, struct vt_driver); + +#define _VTDEFH MAX(100, PIXEL_HEIGHT(VT_FB_DEFAULT_HEIGHT)) +#define _VTDEFW MAX(200, PIXEL_WIDTH(VT_FB_DEFAULT_WIDTH)) + +static struct terminal vt_consterm; +static struct vt_windowvt_conswindow; +static struct vt_devicevt_consdev = { + .vd_driver = NULL, + .vd_softc = NULL, + .vd_flags = VDF_INVALID, + .vd_windows = { [VT_CONSWINDOW] = &vt_conswindow, }, + .vd_curwindow = &vt_conswindow, + .vd_markedwin = NULL, + .vd_kbstate = 0, +}; +static term_char_t vt_constextbuf[(_VTDEFW) * (VBF_DEFAULT_HISTORY_SIZE)]; +static term_char_t *vt_constextbufrows[VBF_DEFAULT_HISTORY_SIZE]; +static struct vt_windowvt_conswindow = { + .vw_number = VT_CONSWINDOW, + .vw_flags = VWF_CONSOLE, + .vw_buf = { + .vb_buffer = vt_constextbuf, + .vb_rows = vt_constextbufrows, + .vb_history_size = VBF_DEFAULT_HISTORY_SIZE, + .vb_curroffset = 0, + .vb_roffset = 0, + .vb_flags = VBF_STATIC, + .vb_mark_start = {.tp_row = 0, .tp_col = 0,}, + .vb_mark_end = {.tp_row = 0, .tp_col = 0,}, + .vb_scr_size = { + .tp_row = _VTDEFH, + .tp_col = _VTDEFW, + }, + }, + .vw_device = &vt_consdev, + .vw_terminal = &vt_consterm, + .vw_kbdmode = K_XLATE, +}; +static struct terminal vt_consterm = { + .tm_class = &vt_termclass, + .tm_softc = &vt_conswindow, + .tm_flags = TF_CONS, +}; +static struct consdev vt_consterm_consdev = { + .cn_ops = &termcn_cnops, + .cn_arg = &vt_consterm, + .cn_name = "ttyv0", +}; + +/* Add to set of consoles. */ +DATA_SET(cons_set, vt_consterm_consdev); + +/* + * Right after kmem is done to allow early drivers to use locking and allocate + * memory. + */ +SYSINIT(vt_update_static, SI_SUB_KMEM, SI_ORDER_ANY, vt_update_static, +&vt_consdev); +/* Delay until all devices attached, to not waste time. */ +SYSINIT(vt_early_cons, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_ANY, vt_upgrade, +&vt_consdev); + +/* Initialize locks/mem depended members. */ +static void +vt_update_static(void *dummy) +{ + + if (main_vd != NULL) { + printf("VT: running with driver \"%s\".\n", + main_vd->vd_driver->vd_name); + mtx_init(&main_vd->vd_lock, "vtdev", NULL, MTX_DEF); + cv_init(&main_vd->vd_winswitch, "vtwswt"); + } +} static void vt_switch_timer(void *arg) @@ -775,7 +852,7 @@ vt_flush(struct vt_device *vd) if ((vd->vd_flags & (VDF_MOUSECURSOR|VDF_TEXTMODE)) == VDF_MOUSECURSOR) { m = &vt_default_mouse_pointer; - bpl = (m->w + 7) >> 3; /* Bytes per sorce line. */ + bpl = (m->w + 7) >> 3; /* Bytes per source line. */ w = m->w; h = m->h; @@ -851,9 +928,11 @@ vtterm_splash(struct vt_device *vd) } #endif + static void vtterm_cnprobe(struct terminal *tm, struct consdev *cp) { + struct vt_driver *vtd, **vtdlist, *vtdbest = NULL; struct vt_window *vw = tm->tm_softc; struct vt_device *vd = vw->vw_device; struct winsize wsz; @@ -862,6 +941,24 @@ vtterm_cnprobe(struct terminal *tm, stru /* Initialization already done. */ return; + SET_FOREACH(vtdlist, vt_drv_set) { + vtd = *vtdlist; + if (vtd->vd_probe == NULL) + continue; + if (vtd->vd_probe(vd) == CN_DEAD) + continue; + if ((vtdb
Re: svn commit: r265367 - head/lib/libc/regex
On 5 May 2014, at 22:33, Warner Losh wrote: > reallocf(): > The reallocf() function is identical to the realloc() function, except > that it will free the passed pointer when the requested memory cannot be > allocated. This is a FreeBSD specific API designed to ease the problems > with traditional coding styles for realloc() causing memory leaks in > libraries. > ... > The reallocf() function first appeared in FreeBSD 3.0. While reallocf() is nice, it doesn't address the problem of overflow. It takes a single size, forcing the caller to do the number-of-elements * element-size multiplication, which is the problematic one. If an attacker can control the number of elements, then it's possible to make the multiplication overflow so reallocf() will return a valid pointer to an area of memory that is much smaller than the caller was expecting. David ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r265367 - head/lib/libc/regex
On 05.05.2014 22:28, David Chisnall wrote: > On 5 May 2014, at 18:42, Andrey Chernov wrote: > >> Please don't commit OpenBSD errors. Now you mix calloc() with the >> realloc() for the same variable later which makes calloc() zeroing >> pointless and waste of CPU. > > The purpose of calloc() here is not (primarily) to get the zero'd size, it's > to get the overflow-checking behaviour for calloc. It is better to avoid using undocumented intrinsic knowledge of standard function particular implementation, this is unportable at least and hard to understand too. Moreover, choosing some standard function just due to its arcane side effect is semantically incorrect. If you need bounds checking, you can either making it transparent from the library code point of view (preferred) or use literal visible methods (pragma, online function, etc). > The uses of realloc() later do still potentially overflow, as they follow the > realloc(pointer, size * sizeof(type)) antipattern. The code can become completely mess if not follows simple strategies above. -- http://ache.vniz.net/ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265393 - head/sys/netinet
Author: glebius Date: Mon May 5 21:33:20 2014 New Revision: 265393 URL: http://svnweb.freebsd.org/changeset/base/265393 Log: The tcp_log_addrs() uses th pointer, which points into the mbuf, thus we can not free the mbuf before tcp_log_addrs(). Sponsored by: Nginx, Inc. Sponsored by: Netflix Modified: head/sys/netinet/tcp_reass.c Modified: head/sys/netinet/tcp_reass.c == --- head/sys/netinet/tcp_reass.cMon May 5 21:31:00 2014 (r265392) +++ head/sys/netinet/tcp_reass.cMon May 5 21:33:20 2014 (r265393) @@ -144,7 +144,6 @@ tcp_reass(struct tcpcb *tp, struct tcphd V_tcp_reass_overflows++; TCPSTAT_INC(tcps_rcvmemdrop); - m_freem(m); *tlenp = 0; if ((s = tcp_log_addrs(&tp->t_inpcb->inp_inc, th, NULL, NULL))) { @@ -152,6 +151,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd "segment dropped\n", s, __func__); free(s, M_TCPLOG); } + m_freem(m); return (0); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265394 - stable/10/release/doc/en_US.ISO8859-1/hardware
Author: brueffer Date: Mon May 5 21:34:10 2014 New Revision: 265394 URL: http://svnweb.freebsd.org/changeset/base/265394 Log: MFC: r265242 Generate hardware notes for mpr(4) and bump copyright for 2014. Modified: stable/10/release/doc/en_US.ISO8859-1/hardware/article.xml Directory Properties: stable/10/ (props changed) Modified: stable/10/release/doc/en_US.ISO8859-1/hardware/article.xml == --- stable/10/release/doc/en_US.ISO8859-1/hardware/article.xml Mon May 5 21:33:20 2014(r265393) +++ stable/10/release/doc/en_US.ISO8859-1/hardware/article.xml Mon May 5 21:34:10 2014(r265394) @@ -29,6 +29,7 @@ 2011 2012 2013 + 2014 mailto:d...@freebsd.org";>The &os; Documentation Project @@ -732,6 +733,8 @@ &hwlist.mly; + &hwlist.mpr; + &hwlist.mps; &hwlist.mpt; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r265367 - head/lib/libc/regex
On May 5, 2014, at 3:21 PM, David Chisnall wrote: > On 5 May 2014, at 20:49, Pedro Giffuni wrote: > >> Yes, but I reverted it because there are other ways to check for overflows >> without the performance hit. > > Do we have a good reusable routine for doing this somewhere? Clang and gcc > both have some idiom recognisers that try to spot when people are attempting > to do this. Clang also has a builtin, which would be good to use when > available. Overflow checking is very cheap on modern CPUs (add, branch on > carry), so it would be nice if we could start looking for this malloc() and > realloc() pattern and replacing the multiply with something that checks for > the error. reallocf(): The reallocf() function is identical to the realloc() function, except that it will free the passed pointer when the requested memory cannot be allocated. This is a FreeBSD specific API designed to ease the problems with traditional coding styles for realloc() causing memory leaks in libraries. ... The reallocf() function first appeared in FreeBSD 3.0. Warner ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265392 - head/sys/dev/vt
Author: ray Date: Mon May 5 21:31:00 2014 New Revision: 265392 URL: http://svnweb.freebsd.org/changeset/base/265392 Log: Create dataset for vt(4) drivers. Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/vt/vt.h Modified: head/sys/dev/vt/vt.h == --- head/sys/dev/vt/vt.hMon May 5 21:29:56 2014(r265391) +++ head/sys/dev/vt/vt.hMon May 5 21:31:00 2014(r265392) @@ -394,6 +394,9 @@ TERMINAL_DECLARE_EARLY(driver ## _conste SYSINIT(vt_early_cons, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_ANY, \ vt_upgrade, &driver ## _consdev) +/* name argument is not used yet. */ +#define VT_DRIVER_DECLARE(name, drv) DATA_SET(vt_drv_set, drv) + /* * Fonts. * ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265391 - head/sys/dev/vt
Author: ray Date: Mon May 5 21:29:56 2014 New Revision: 265391 URL: http://svnweb.freebsd.org/changeset/base/265391 Log: Define a new method for probing vt(4) driver before attach it at early stage. Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/vt/vt.h Modified: head/sys/dev/vt/vt.h == --- head/sys/dev/vt/vt.hMon May 5 20:55:37 2014(r265390) +++ head/sys/dev/vt/vt.hMon May 5 21:29:56 2014(r265391) @@ -277,6 +277,7 @@ struct vt_window { */ typedef int vd_init_t(struct vt_device *vd); +typedef int vd_probe_t(struct vt_device *vd); typedef void vd_postswitch_t(struct vt_device *vd); typedef void vd_blank_t(struct vt_device *vd, term_color_t color); typedef void vd_bitbltchr_t(struct vt_device *vd, const uint8_t *src, @@ -295,7 +296,9 @@ typedef void vd_drawrect_t(struct vt_dev typedef void vd_setpixel_t(struct vt_device *, int, int, term_color_t); struct vt_driver { + char vd_name[16]; /* Console attachment. */ + vd_probe_t *vd_probe; vd_init_t *vd_init; /* Drawing. */ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r265367 - head/lib/libc/regex
On 5 May 2014, at 20:49, Pedro Giffuni wrote: > Yes, but I reverted it because there are other ways to check for overflows > without the performance hit. Do we have a good reusable routine for doing this somewhere? Clang and gcc both have some idiom recognisers that try to spot when people are attempting to do this. Clang also has a builtin, which would be good to use when available. Overflow checking is very cheap on modern CPUs (add, branch on carry), so it would be nice if we could start looking for this malloc() and realloc() pattern and replacing the multiply with something that checks for the error. David ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265390 - stable/9/sys/fs/nfsclient
Author: rmacklem Date: Mon May 5 20:55:37 2014 New Revision: 265390 URL: http://svnweb.freebsd.org/changeset/base/265390 Log: MFC: r264738 For an NFSv4 mount with the "nocto" option, don't get the up to date file attributes upon close. This reduces the Getattr RPC count by about 65% for software builds. Modified: stable/9/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clvnops.c == --- stable/9/sys/fs/nfsclient/nfs_clvnops.c Mon May 5 20:48:36 2014 (r265389) +++ stable/9/sys/fs/nfsclient/nfs_clvnops.c Mon May 5 20:55:37 2014 (r265390) @@ -762,7 +762,9 @@ nfs_close(struct vop_close_args *ap) /* * Get attributes so "change" is up to date. */ - if (error == 0 && nfscl_mustflush(vp) != 0) { + if (error == 0 && nfscl_mustflush(vp) != 0 && + vp->v_type == VREG && + (VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_NOCTO) == 0) { ret = nfsrpc_getattr(vp, cred, ap->a_td, &nfsva, NULL); if (!ret) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265389 - stable/9/sys/fs/nfsclient
Author: rmacklem Date: Mon May 5 20:48:36 2014 New Revision: 265389 URL: http://svnweb.freebsd.org/changeset/base/265389 Log: MFC: r264705, r264749 Modify the NFSv4 client create/mkdir RPC so that it acquires post-create/mkdir directory attributes. This allows the RPC to name cache the newly created directory and reduces the lookup RPC count for applications creating a lot of directories. Modified: stable/9/sys/fs/nfsclient/nfs_clcomsubs.c stable/9/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clcomsubs.c == --- stable/9/sys/fs/nfsclient/nfs_clcomsubs.c Mon May 5 20:35:35 2014 (r265388) +++ stable/9/sys/fs/nfsclient/nfs_clcomsubs.c Mon May 5 20:48:36 2014 (r265389) @@ -66,7 +66,7 @@ static struct { { NFSV4OP_READ, 1, "Read", 4, }, { NFSV4OP_WRITE, 2, "Write", 5, }, { NFSV4OP_OPEN, 5, "Open", 4, }, - { NFSV4OP_CREATE, 3, "Create", 6, }, + { NFSV4OP_CREATE, 5, "Create", 6, }, { NFSV4OP_CREATE, 1, "Create", 6, }, { NFSV4OP_CREATE, 3, "Create", 6, }, { NFSV4OP_REMOVE, 1, "Remove", 6, }, Modified: stable/9/sys/fs/nfsclient/nfs_clrpcops.c == --- stable/9/sys/fs/nfsclient/nfs_clrpcops.cMon May 5 20:35:35 2014 (r265388) +++ stable/9/sys/fs/nfsclient/nfs_clrpcops.cMon May 5 20:48:36 2014 (r265389) @@ -2409,10 +2409,12 @@ nfsrpc_mkdir(vnode_t dvp, char *name, in struct nfsrv_descript nfsd, *nd = &nfsd; nfsattrbit_t attrbits; int error = 0; + struct nfsfh *fhp; *nfhpp = NULL; *attrflagp = 0; *dattrflagp = 0; + fhp = VTONFS(dvp)->n_fhp; if (namelen > NFS_MAXNAMLEN) return (ENAMETOOLONG); NFSCL_REQSTART(nd, NFSPROC_MKDIR, dvp); @@ -2428,6 +2430,12 @@ nfsrpc_mkdir(vnode_t dvp, char *name, in *tl++ = txdr_unsigned(NFSV4OP_GETFH); *tl = txdr_unsigned(NFSV4OP_GETATTR); (void) nfsrv_putattrbit(nd, &attrbits); + NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(NFSV4OP_PUTFH); + (void) nfsm_fhtom(nd, fhp->nfh_fh, fhp->nfh_len, 0); + NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(NFSV4OP_GETATTR); + (void) nfsrv_putattrbit(nd, &attrbits); } error = nfscl_request(nd, dvp, p, cred, dstuff); if (error) @@ -2441,6 +2449,14 @@ nfsrpc_mkdir(vnode_t dvp, char *name, in } if (!error) error = nfscl_mtofh(nd, nfhpp, nnap, attrflagp); + if (error == 0 && (nd->nd_flag & ND_NFSV4) != 0) { + /* Get rid of the PutFH and Getattr status values. */ + NFSM_DISSECT(tl, u_int32_t *, 4 * NFSX_UNSIGNED); + /* Load the directory attributes. */ + error = nfsm_loadattr(nd, dnap); + if (error == 0) + *dattrflagp = 1; + } } if ((nd->nd_flag & ND_NFSV3) && !error) error = nfscl_wcc_data(nd, dvp, dnap, dattrflagp, NULL, dstuff); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r265359 - head/sys/modules/sound/sound
On May 5, 2014, at 8:31 AM, Hans Petter Selasky wrote: > Author: hselasky > Date: Mon May 5 14:31:34 2014 > New Revision: 265359 > URL: http://svnweb.freebsd.org/changeset/base/265359 > > Log: > Build the kernel sound module without ISA DMA support for ARM and MIPS > platforms, because these platforms do not implement the ISA DMA > API. Else the sound modules cannot be loaded when running these > platforms. > > MFC after: 2 weeks > > Modified: > head/sys/modules/sound/sound/Makefile > > Modified: head/sys/modules/sound/sound/Makefile > == > --- head/sys/modules/sound/sound/Makefile Mon May 5 11:50:52 2014 > (r265358) > +++ head/sys/modules/sound/sound/Makefile Mon May 5 14:31:34 2014 > (r265359) > @@ -44,7 +44,8 @@ CLEANFILES+=feeder_eq_gen.h feeder_rate > > EXPORT_SYMS= YES # XXX evaluate > > -.if ${MACHINE_CPUARCH} == "sparc64" || ${MACHINE_CPUARCH} == "powerpc" > +.if ${MACHINE_CPUARCH} == "sparc64" || ${MACHINE_CPUARCH} == "powerpc" || \ > +${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "mips" > # Create an empty opt_isa.h in order to keep kmod.mk from linking in an > # existing one from KERNBUILDDIR which possibly has DEV_ISA defined so > # sound.ko is always built without isadma support. Rather than an opt-in approach here, why not lust list the three that have it since they are the only ones that will ever have it… Warner ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265388 - in stable/10: share/man/man4 sys/amd64/conf sys/conf sys/dev/mpr sys/i386/conf sys/ia64/conf sys/mips/conf sys/modules sys/modules/mpr sys/sparc64/conf
Author: ken Date: Mon May 5 20:35:35 2014 New Revision: 265388 URL: http://svnweb.freebsd.org/changeset/base/265388 Log: MFC the mpr(4) driver for LSI's 12Gb SAS cards. This includes r265236, r265237, r265241 and r265261: r265236 | ken | 2014-05-02 14:25:09 -0600 (Fri, 02 May 2014) | 51 lines Bring in the mpr(4) driver for LSI's MPT3 12Gb SAS controllers. This is derived from the mps(4) driver, but it supports only the 12Gb IT and IR hardware including the SAS 3004, SAS 3008 and SAS 3108. Some notes about this driver: o The 12Gb hardware can do "FastPath" I/O, and that capability is included in this driver. o WarpDrive functionality has been removed, since it isn't supported in the 12Gb driver interface. o The Scatter/Gather list handling code is significantly different between the 6Gb and 12Gb hardware. The 12Gb boards support IEEE Scatter/Gather lists. Thanks to LSI for developing and testing this driver for FreeBSD. share/man/man4/mpr.4: mpr(4) man page. sys/dev/mpr/*: mpr(4) driver files. sys/modules/Makefile, sys/modules/mpr/Makefile: Add a module Makefile for the mpr(4) driver. sys/conf/files: Add the mpr(4) driver. sys/amd64/conf/GENERIC, sys/i386/conf/GENERIC, sys/mips/conf/OCTEON1, sys/sparc64/conf/GENERIC: Add the mpr(4) driver to all config files that currently have the mps(4) driver. sys/ia64/conf/GENERIC: Add the mps(4) and mpr(4) drivers to the ia64 GENERIC config file. sys/i386/conf/XEN: Exclude the mpr module from building here. Submitted by: Steve McConnell Tested by: Chris Reeves Sponsored by: LSI, Spectra Logic Relnotes: LSI 12Gb SAS driver mpr(4) added r265237 | ken | 2014-05-02 14:36:20 -0600 (Fri, 02 May 2014) | 8 lines Add the mpr(4) man page to the man4 Makefile. This should have been included in r265236. Submitted by: Steve McConnell MFC after: 3 days Sponsored by: LSI, Spectra Logic r265241 | brueffer | 2014-05-02 15:14:28 -0600 (Fri, 02 May 2014) | 2 lines Use our standard SYNOPSIS wording; perform some cleanup while here. r265261 | brueffer | 2014-05-03 05:15:28 -0600 (Sat, 03 May 2014) | 2 lines Add a missing colon. Submitted by: Steve McConnell Tested by:Chris Reeves Sponsored by: LSI, Spectra Logic Relnotes: LSI 12Gb SAS driver mpr(4) added Added: stable/10/share/man/man4/mpr.4 - copied, changed from r265236, head/share/man/man4/mpr.4 stable/10/sys/dev/mpr/ - copied from r265236, head/sys/dev/mpr/ stable/10/sys/modules/mpr/ - copied from r265236, head/sys/modules/mpr/ Modified: stable/10/share/man/man4/Makefile stable/10/sys/amd64/conf/GENERIC stable/10/sys/conf/files stable/10/sys/i386/conf/GENERIC stable/10/sys/i386/conf/XEN stable/10/sys/ia64/conf/GENERIC stable/10/sys/mips/conf/OCTEON1 stable/10/sys/modules/Makefile stable/10/sys/sparc64/conf/GENERIC Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/Makefile == --- stable/10/share/man/man4/Makefile Mon May 5 20:13:25 2014 (r265387) +++ stable/10/share/man/man4/Makefile Mon May 5 20:35:35 2014 (r265388) @@ -259,6 +259,7 @@ MAN=aac.4 \ mod_cc.4 \ mos.4 \ mouse.4 \ + mpr.4 \ mps.4 \ mpt.4 \ msk.4 \ Copied and modified: stable/10/share/man/man4/mpr.4 (from r265236, head/share/man/man4/mpr.4) == --- head/share/man/man4/mpr.4 Fri May 2 20:25:09 2014(r265236, copy source) +++ stable/10/share/man/man4/mpr.4 Mon May 5 20:35:35 2014 (r265388) @@ -36,7 +36,7 @@ .\" $Id$ .\" $FreeBSD$ .\" -.Dd Apr 28, 2014 +.Dd May 2, 2014 .Dt MPR 4 .Os .Sh NAME @@ -51,7 +51,8 @@ kernel configuration file: .Cd "device mpr" .Ed .Pp -Or, to load the driver as a module at boot, place the following line in +Alternatively, to load the driver as a +module at boot time, place the following line in .Xr loader.conf 5 : .Bd -literal -offset i
Re: svn commit: r265367 - head/lib/libc/regex
El 5/5/2014 1:28 PM, David Chisnall escribió: On 5 May 2014, at 18:42, Andrey Chernov wrote: Please don't commit OpenBSD errors. Now you mix calloc() with the realloc() for the same variable later which makes calloc() zeroing pointless and waste of CPU. The purpose of calloc() here is not (primarily) to get the zero'd size, it's to get the overflow-checking behaviour for calloc. Yes, but I reverted it because there are other ways to check for overflows without the performance hit. The uses of realloc() later do still potentially overflow, as they follow the realloc(pointer, size * sizeof(type)) antipattern. FWIW, I actually got to this by checking kern/169302: unfortunately it is unclear if the NetBSD patch there (with or without the OpenBSD change) helps with the test case. Pedro. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265386 - head/sys/dev/mpr
Author: ken Date: Mon May 5 19:53:03 2014 New Revision: 265386 URL: http://svnweb.freebsd.org/changeset/base/265386 Log: Adjust #if statements inside mprsas_send_smpcmd() to more accurately reflect when unmapped I/O support was added. For FreeBSD 10, it arrived just prior to __FreeBSD_version 128. For FreeBSD 9, it arrived just prior to __FreeBSD_version 902001. Also, fix compiler warnings in mprsas_send_smpcmd() that happen in the i386 PAE build for non-unmapped I/O builds. These were fixed in mps(4) in revision 241145, but didn't make it into the mpr(4) driver. This change should only affect FreeBSD versions outside the above revisions, and thus doesn't affect head. MFC after:3 days Sponsored by: Spectra Logic Corporation Modified: head/sys/dev/mpr/mpr_sas.c Modified: head/sys/dev/mpr/mpr_sas.c == --- head/sys/dev/mpr/mpr_sas.c Mon May 5 19:38:29 2014(r265385) +++ head/sys/dev/mpr/mpr_sas.c Mon May 5 19:53:03 2014(r265386) @@ -2501,7 +2501,8 @@ mprsas_send_smpcmd(struct mprsas_softc * sg = NULL; error = 0; -#if __FreeBSD_version >= 129 +#if (__FreeBSD_version >= 128) || \ +((__FreeBSD_version >= 902001) && (__FreeBSD_version < 100)) switch (ccb->ccb_h.flags & CAM_DATA_MASK) { case CAM_DATA_PADDR: case CAM_DATA_SG_PADDR: @@ -2561,7 +2562,7 @@ mprsas_send_smpcmd(struct mprsas_softc * xpt_done(ccb); return; } -#else //__FreeBSD_version < 129 +#else /* __FreeBSD_version < 128 */ /* * XXX We don't yet support physical addresses here. */ @@ -2604,7 +2605,7 @@ mprsas_send_smpcmd(struct mprsas_softc * bus_dma_segment_t *req_sg; req_sg = (bus_dma_segment_t *)ccb->smpio.smp_request; - request = (uint8_t *)req_sg[0].ds_addr; + request = (uint8_t *)(uintptr_t)req_sg[0].ds_addr; } else request = ccb->smpio.smp_request; @@ -2612,14 +2613,14 @@ mprsas_send_smpcmd(struct mprsas_softc * bus_dma_segment_t *rsp_sg; rsp_sg = (bus_dma_segment_t *)ccb->smpio.smp_response; - response = (uint8_t *)rsp_sg[0].ds_addr; + response = (uint8_t *)(uintptr_t)rsp_sg[0].ds_addr; } else response = ccb->smpio.smp_response; } else { request = ccb->smpio.smp_request; response = ccb->smpio.smp_response; } -#endif //__FreeBSD_version >= 129 +#endif /* __FreeBSD_version < 128 */ cm = mpr_alloc_command(sc); if (cm == NULL) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265385 - in head: . etc/mtree sbin/ifconfig sbin/ifconfig/tests
Author: asomers Date: Mon May 5 19:38:29 2014 New Revision: 265385 URL: http://svnweb.freebsd.org/changeset/base/265385 Log: Remove the ifconfig test added in rev 263445. After discussion with melifaro, we agreed that ifconfig's behavior was not a bug. The main motivation for bin/187551 was to partially resolve kern/187549, but we resolved kern/187549 in a different way instead. ObsoleteFiles.inc etc/mtree/BSD.tests.dist sbin/ifconfig/tests/fibs_test.sh sbin/ifconfig/tests/Makefile sbin/ifconfig/Makefile Remove /usr/tests/sbin/ifconfig PR: bin/187551 MFC after:3 days Sponsored by: Spectra Logic Deleted: head/sbin/ifconfig/tests/Makefile head/sbin/ifconfig/tests/fibs_test.sh Modified: head/ObsoleteFiles.inc head/etc/mtree/BSD.tests.dist head/sbin/ifconfig/Makefile Modified: head/ObsoleteFiles.inc == --- head/ObsoleteFiles.inc Mon May 5 19:35:32 2014(r265384) +++ head/ObsoleteFiles.inc Mon May 5 19:38:29 2014(r265385) @@ -38,6 +38,10 @@ # xargs -n1 | sort | uniq -d; # done +# 20140505: Reject PR kern/187551 +OLD_DIRS+=usr/tests/sbin/ifconfig +OLD_FILES+=usr/tests/sbin/ifconfig/Kyuafile +OLD_FILES+=usr/tests/sbin/ifconfig/fibs_test # 20140502: Removal of lindev(4) OLD_FILES+=usr/share/man/man4/lindev.4.gz # 20140314: AppleTalk Modified: head/etc/mtree/BSD.tests.dist == --- head/etc/mtree/BSD.tests.dist Mon May 5 19:35:32 2014 (r265384) +++ head/etc/mtree/BSD.tests.dist Mon May 5 19:38:29 2014 (r265385) @@ -97,8 +97,6 @@ .. growfs .. -ifconfig -.. mdconfig .. .. Modified: head/sbin/ifconfig/Makefile == --- head/sbin/ifconfig/Makefile Mon May 5 19:35:32 2014(r265384) +++ head/sbin/ifconfig/Makefile Mon May 5 19:38:29 2014(r265385) @@ -63,8 +63,4 @@ MAN= ifconfig.8 CFLAGS+= -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wnested-externs WARNS?=2 -.if ${MK_TESTS} != "no" -SUBDIR+=tests -.endif - .include ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265383 - stable/9/usr.sbin/mergemaster
Author: peter Date: Mon May 5 19:35:02 2014 New Revision: 265383 URL: http://svnweb.freebsd.org/changeset/base/265383 Log: MFC r250916: coexist with /etc/localtime being a symlink Modified: stable/9/usr.sbin/mergemaster/mergemaster.sh Modified: stable/9/usr.sbin/mergemaster/mergemaster.sh == --- stable/9/usr.sbin/mergemaster/mergemaster.shMon May 5 18:32:24 2014(r265382) +++ stable/9/usr.sbin/mergemaster/mergemaster.shMon May 5 19:35:02 2014(r265383) @@ -1327,7 +1327,7 @@ case "${NEED_PWD_MKDB}" in ;; esac -if [ -e "${DESTDIR}/etc/localtime" -a -z "${PRE_WORLD}" ]; then# Ignore if TZ == UTC +if [ -e "${DESTDIR}/etc/localtime" -a ! -L "${DESTDIR}/etc/localtime" -a -z "${PRE_WORLD}" ]; then # Ignore if TZ == UTC echo '' [ -n "${DESTDIR}" ] && tzs_args="-C ${DESTDIR}" if [ -f "${DESTDIR}/var/db/zoneinfo" ]; then ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r265367 - head/lib/libc/regex
On 5 May 2014, at 18:42, Andrey Chernov wrote: > Please don't commit OpenBSD errors. Now you mix calloc() with the > realloc() for the same variable later which makes calloc() zeroing > pointless and waste of CPU. The purpose of calloc() here is not (primarily) to get the zero'd size, it's to get the overflow-checking behaviour for calloc. The uses of realloc() later do still potentially overflow, as they follow the realloc(pointer, size * sizeof(type)) antipattern. David ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265376 - head/usr.sbin/bhyve
Author: neel Date: Mon May 5 18:06:35 2014 New Revision: 265376 URL: http://svnweb.freebsd.org/changeset/base/265376 Log: Modify the "-p" option to be more flexible when associating a 'vcpu' with a 'hostcpu'. The new format of the argument string is "vcpu:hostcpu". This allows pinning a subset of the vcpus if desired. It also allows pinning a vcpu to more than a single 'hostcpu'. Submitted by: novel (initial version) Modified: head/usr.sbin/bhyve/bhyve.8 head/usr.sbin/bhyve/bhyverun.c Modified: head/usr.sbin/bhyve/bhyve.8 == --- head/usr.sbin/bhyve/bhyve.8 Mon May 5 18:04:57 2014(r265375) +++ head/usr.sbin/bhyve/bhyve.8 Mon May 5 18:06:35 2014(r265376) @@ -35,7 +35,7 @@ .Op Fl aehwxAHPW .Op Fl c Ar numcpus .Op Fl g Ar gdbport -.Op Fl p Ar pinnedcpu +.Op Fl p Ar vcpu:hostcpu .Op Fl s Ar slot,emulation Ns Op , Ns Ar conf .Op Fl l Ar lpcdev Ns Op , Ns Ar conf .Ar vmname @@ -80,12 +80,11 @@ For allow a remote kernel kgdb to be relayed to the guest kernel gdb stub via a local IPv4 address and this port. This option will be deprecated in a future version. -.It Fl p Ar pinnedcpu -Force guest virtual CPUs to be pinned to host CPUs. -Virtual CPU -.Em n -is pinned to host CPU -.Em pinnedcpu+n . +.It Fl p Ar vcpu:hostcpu +Pin guest's virtual CPU +.Em vcpu +to +.Em hostcpu . .It Fl P Force the guest virtual CPU to exit when a PAUSE instruction is detected. .It Fl W Modified: head/usr.sbin/bhyve/bhyverun.c == --- head/usr.sbin/bhyve/bhyverun.c Mon May 5 18:04:57 2014 (r265375) +++ head/usr.sbin/bhyve/bhyverun.c Mon May 5 18:06:35 2014 (r265376) @@ -85,7 +85,6 @@ char *vmname; int guest_ncpus; char *guest_uuid_str; -static int pincpu = -1; static int guest_vmexit_on_hlt, guest_vmexit_on_pause; static int virtio_msix = 1; static int x2apic_mode = 0;/* default is xAPIC */ @@ -123,18 +122,20 @@ struct mt_vmm_info { int mt_vcpu; } mt_vmm_info[VM_MAXCPU]; +static cpuset_t *vcpumap[VM_MAXCPU] = { NULL }; + static void usage(int code) { fprintf(stderr, -"Usage: %s [-aehwAHIPW] [-g ] [-s ]\n" - " %*s [-c vcpus] [-p pincpu] [-m mem] [-l ] \n" +"Usage: %s [-aehwAHIPW] [-g ] [-s ] [-c vcpus]\n" + " %*s [-p vcpu:hostcpu] [-m mem] [-l ] \n" " -a: local apic is in xAPIC mode (deprecated)\n" " -A: create an ACPI table\n" " -g: gdb port\n" " -c: # cpus (default 1)\n" - " -p: pin vcpu 'n' to host cpu 'pincpu + n'\n" + " -p: pin 'vcpu' to 'hostcpu'\n" " -H: vmexit from the guest on hlt\n" " -P: vmexit from the guest on pause\n" " -W: force virtio to use single-vector MSI\n" @@ -152,6 +153,39 @@ usage(int code) exit(code); } +static int +pincpu_parse(const char *opt) +{ + int vcpu, pcpu; + + if (sscanf(opt, "%d:%d", &vcpu, &pcpu) != 2) { + fprintf(stderr, "invalid format: %s\n", opt); + return (-1); + } + + if (vcpu < 0 || vcpu >= VM_MAXCPU) { + fprintf(stderr, "vcpu '%d' outside valid range from 0 to %d\n", + vcpu, VM_MAXCPU - 1); + return (-1); + } + + if (pcpu < 0 || pcpu >= CPU_SETSIZE) { + fprintf(stderr, "hostcpu '%d' outside valid range from " + "0 to %d\n", pcpu, CPU_SETSIZE - 1); + return (-1); + } + + if (vcpumap[vcpu] == NULL) { + if ((vcpumap[vcpu] = malloc(sizeof(cpuset_t))) == NULL) { + perror("malloc"); + return (-1); + } + CPU_ZERO(vcpumap[vcpu]); + } + CPU_SET(pcpu, vcpumap[vcpu]); + return (0); +} + void * paddr_guest2host(struct vmctx *ctx, uintptr_t gaddr, size_t len) { @@ -498,16 +532,13 @@ static vmexit_handler_t handler[VM_EXITC static void vm_loop(struct vmctx *ctx, int vcpu, uint64_t rip) { - cpuset_t mask; int error, rc, prevcpu; enum vm_exitcode exitcode; enum vm_suspend_how how; - if (pincpu >= 0) { - CPU_ZERO(&mask); - CPU_SET(pincpu + vcpu, &mask); + if (vcpumap[vcpu] != NULL) { error = pthread_setaffinity_np(pthread_self(), - sizeof(mask), &mask); + sizeof(cpuset_t), vcpumap[vcpu]); assert(error == 0); } @@ -640,7 +671,10 @@ main(int argc, char *argv[]) bvmcons = 1; break; case 'p': - pincpu = atoi(optarg); +
svn commit: r265375 - head/lib/libc/regex
Author: pfg Date: Mon May 5 18:04:57 2014 New Revision: 265375 URL: http://svnweb.freebsd.org/changeset/base/265375 Log: Revert r265367: Use of calloc instead of malloc in regex (from OpenBSD). In this case the change makes no sense since we are using realloc() later. Reported by: ache Modified: head/lib/libc/regex/regcomp.c Modified: head/lib/libc/regex/regcomp.c == --- head/lib/libc/regex/regcomp.c Mon May 5 17:58:00 2014 (r265374) +++ head/lib/libc/regex/regcomp.c Mon May 5 18:04:57 2014 (r265375) @@ -214,7 +214,7 @@ regcomp(regex_t * __restrict preg, if (g == NULL) return(REG_ESPACE); p->ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */ - p->strip = (sop *)calloc(p->ssize, sizeof(sop)); + p->strip = (sop *)malloc(p->ssize * sizeof(sop)); p->slen = 0; if (p->strip == NULL) { free((char *)g); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r265367 - head/lib/libc/regex
On 05.05.2014 20:41, Pedro F. Giffuni wrote: > Log: > regex: Use calloc instead of malloc. > > Mostly to reduce differences with OpenBSD. Please don't commit OpenBSD errors. Now you mix calloc() with the realloc() for the same variable later which makes calloc() zeroing pointless and waste of CPU. -- http://ache.vniz.net/ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265371 - head/sys/dev/usb/net
Author: tuexen Date: Mon May 5 17:30:05 2014 New Revision: 265371 URL: http://svnweb.freebsd.org/changeset/base/265371 Log: Fill in csum_data only for UDP or TCP packets. This fixes a bug where SCTP were reported to have always a correct checksum if they don't contain any ethernet padding. MFC after: 3 days Modified: head/sys/dev/usb/net/if_smsc.c Modified: head/sys/dev/usb/net/if_smsc.c == --- head/sys/dev/usb/net/if_smsc.c Mon May 5 17:06:40 2014 (r265370) +++ head/sys/dev/usb/net/if_smsc.c Mon May 5 17:30:05 2014 (r265371) @@ -86,6 +86,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #include "opt_platform.h" #ifdef FDT @@ -1025,25 +1028,32 @@ smsc_bulk_read_callback(struct usb_xfer * * Ignore H/W csum for non-IPv4 packets. */ - if (be16toh(eh->ether_type) == ETHERTYPE_IP && pktlen > ETHER_MIN_LEN) { - - /* Indicate the UDP/TCP csum has been calculated */ - m->m_pkthdr.csum_flags |= CSUM_DATA_VALID; - - /* Copy the TCP/UDP checksum from the last 2 bytes -* of the transfer and put in the csum_data field. -*/ - usbd_copy_out(pc, (off + pktlen), - &m->m_pkthdr.csum_data, 2); - - /* The data is copied in network order, but the -* csum algorithm in the kernel expects it to be -* in host network order. -*/ - m->m_pkthdr.csum_data = ntohs(m->m_pkthdr.csum_data); - - smsc_dbg_printf(sc, "RX checksum offloaded (0x%04x)\n", - m->m_pkthdr.csum_data); + if ((be16toh(eh->ether_type) == ETHERTYPE_IP) && + (pktlen > ETHER_MIN_LEN)) { + struct ip *ip; + + ip = (struct ip *)(eh + 1); + if ((ip->ip_v == IPVERSION) && + ((ip->ip_p == IPPROTO_TCP) || +(ip->ip_p == IPPROTO_UDP))) { + /* Indicate the UDP/TCP csum has been calculated */ + m->m_pkthdr.csum_flags |= CSUM_DATA_VALID; + + /* Copy the TCP/UDP checksum from the last 2 bytes +* of the transfer and put in the csum_data field. +*/ + usbd_copy_out(pc, (off + pktlen), + &m->m_pkthdr.csum_data, 2); + + /* The data is copied in network order, but the +* csum algorithm in the kernel expects it to be +* in host network order. +*/ + m->m_pkthdr.csum_data = ntohs(m->m_pkthdr.csum_data); + + smsc_dbg_printf(sc, "RX checksum offloaded (0x%04x)\n", + m->m_pkthdr.csum_data); + } } /* Need to adjust the offset as well or we'll be off ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265370 - head/sys/dev/ath
Author: adrian Date: Mon May 5 17:06:40 2014 New Revision: 265370 URL: http://svnweb.freebsd.org/changeset/base/265370 Log: Wake up the hardware before calling ath_mode_init() in the ioctl() path. Tested: * AR5416, STA + powersave Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c == --- head/sys/dev/ath/if_ath.c Mon May 5 17:00:17 2014(r265369) +++ head/sys/dev/ath/if_ath.c Mon May 5 17:06:40 2014(r265370) @@ -6504,7 +6504,9 @@ ath_ioctl(struct ifnet *ifp, u_long cmd, * only reflect promisc mode settings. */ ATH_LOCK(sc); + ath_power_set_power_state(sc, HAL_PM_AWAKE); ath_mode_init(sc); + ath_power_restore_power_state(sc); ATH_UNLOCK(sc); } else if (ifp->if_flags & IFF_UP) { /* ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265368 - stable/10/libexec/atrun
Author: ghelmer Date: Mon May 5 16:52:38 2014 New Revision: 265368 URL: http://svnweb.freebsd.org/changeset/base/265368 Log: MFC r264617: Fix releasing the lock in the parent atrun process after the queue directory has been processed. Otherwise, a long-running child process caused other atrun invocations to stall unnecessarily. Submitted by: J.R. Oldroyd jr at opal.com Modified: stable/10/libexec/atrun/atrun.c Directory Properties: stable/10/ (props changed) Modified: stable/10/libexec/atrun/atrun.c == --- stable/10/libexec/atrun/atrun.c Mon May 5 16:41:15 2014 (r265367) +++ stable/10/libexec/atrun/atrun.c Mon May 5 16:52:38 2014 (r265368) @@ -567,6 +567,12 @@ main(int argc, char *argv[]) if (run_batch && (gloadavg() < load_avg)) run_file(batch_name, batch_uid, batch_gid); +if (flock(dirfd(spool), LOCK_UN) == -1) + perr("cannot unlock %s", ATJOB_DIR); + +if (closedir(spool) == -1) + perr("cannot closedir %s", ATJOB_DIR); + closelog(); exit(EXIT_SUCCESS); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265367 - head/lib/libc/regex
Author: pfg Date: Mon May 5 16:41:15 2014 New Revision: 265367 URL: http://svnweb.freebsd.org/changeset/base/265367 Log: regex: Use calloc instead of malloc. Mostly to reduce differences with OpenBSD. Obtained from:OpenBSD (CVS rev. 1.17) MFC after:3 days Modified: head/lib/libc/regex/regcomp.c Modified: head/lib/libc/regex/regcomp.c == --- head/lib/libc/regex/regcomp.c Mon May 5 16:35:37 2014 (r265366) +++ head/lib/libc/regex/regcomp.c Mon May 5 16:41:15 2014 (r265367) @@ -214,7 +214,7 @@ regcomp(regex_t * __restrict preg, if (g == NULL) return(REG_ESPACE); p->ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */ - p->strip = (sop *)malloc(p->ssize * sizeof(sop)); + p->strip = (sop *)calloc(p->ssize, sizeof(sop)); p->slen = 0; if (p->strip == NULL) { free((char *)g); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265366 - head/usr.sbin/bhyve
Author: neel Date: Mon May 5 16:35:37 2014 New Revision: 265366 URL: http://svnweb.freebsd.org/changeset/base/265366 Log: Remove misleading "addcpu" in an error message emitted by fbsdrun_deletecpu(). Pointed out by: novel Modified: head/usr.sbin/bhyve/bhyverun.c Modified: head/usr.sbin/bhyve/bhyverun.c == --- head/usr.sbin/bhyve/bhyverun.c Mon May 5 16:30:03 2014 (r265365) +++ head/usr.sbin/bhyve/bhyverun.c Mon May 5 16:35:37 2014 (r265366) @@ -229,8 +229,7 @@ fbsdrun_deletecpu(struct vmctx *ctx, int { if (!CPU_ISSET(vcpu, &cpumask)) { - fprintf(stderr, "addcpu: attempting to delete unknown cpu %d\n", - vcpu); + fprintf(stderr, "Attempting to delete unknown cpu %d\n", vcpu); exit(1); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265365 - head/usr.sbin/bhyve
Author: neel Date: Mon May 5 16:30:03 2014 New Revision: 265365 URL: http://svnweb.freebsd.org/changeset/base/265365 Log: Re-adding an event to a kqueue modifies the parameters of the original event. However, if the original knote had been disabled then it is not automatically re-enabled. Fix this by using EV_ADD to create an mevent and EV_ENABLE to enable it. Adding a kevent for the first time implicitly enables it so existing callers of mevent_add() don't need to change. Reviewed by: grehan Modified: head/usr.sbin/bhyve/mevent.c Modified: head/usr.sbin/bhyve/mevent.c == --- head/usr.sbin/bhyve/mevent.cMon May 5 16:19:24 2014 (r265364) +++ head/usr.sbin/bhyve/mevent.cMon May 5 16:30:03 2014 (r265365) @@ -52,9 +52,10 @@ __FBSDID("$FreeBSD$"); #defineMEVENT_MAX 64 -#define MEV_ENABLE 1 -#define MEV_DISABLE2 -#define MEV_DEL_PENDING3 +#defineMEV_ADD 1 +#defineMEV_ENABLE 2 +#defineMEV_DISABLE 3 +#defineMEV_DEL_PENDING 4 extern char *vmname; @@ -147,10 +148,11 @@ mevent_kq_flags(struct mevent *mevp) int ret; switch (mevp->me_state) { + case MEV_ADD: + ret = EV_ADD; /* implicitly enabled */ + break; case MEV_ENABLE: - ret = EV_ADD; - if (mevp->me_type == EVF_TIMER) - ret |= EV_ENABLE; + ret = EV_ENABLE; break; case MEV_DISABLE: ret = EV_DISABLE; @@ -158,6 +160,9 @@ mevent_kq_flags(struct mevent *mevp) case MEV_DEL_PENDING: ret = EV_DELETE; break; + default: + assert(0); + break; } return (ret); @@ -284,7 +289,7 @@ mevent_add(int tfd, enum ev_type type, LIST_INSERT_HEAD(&change_head, mevp, me_list); mevp->me_cq = 1; - mevp->me_state = MEV_ENABLE; + mevp->me_state = MEV_ADD; mevent_notify(); exit: ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r265363 - head/sys/kern
On Monday, May 05, 2014 11:59:31 am Don Lewis wrote: > Author: truckman > Date: Mon May 5 15:59:31 2014 > New Revision: 265363 > URL: http://svnweb.freebsd.org/changeset/base/265363 > > Log: > Avoid unsigned integer overflow which can cause > rman_reserve_resource_bound() to return incorrect results. > > Continue the initial search until the first viable region is found. > > Add a comment to explain the search termination test. > > PR: kern/188534 > Reviewed by:jhb (previous version) > MFC after: 1 week > > Modified: > head/sys/kern/subr_rman.c Thanks for tracking this down! -- John Baldwin ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265364 - head/sys/amd64/vmm
Author: neel Date: Mon May 5 16:19:24 2014 New Revision: 265364 URL: http://svnweb.freebsd.org/changeset/base/265364 Log: Virtual machine halt detection is turned on by default. Allow it to be disabled via the tunable 'hw.vmm.halt_detection'. Modified: head/sys/amd64/vmm/vmm.c Modified: head/sys/amd64/vmm/vmm.c == --- head/sys/amd64/vmm/vmm.cMon May 5 15:59:31 2014(r265363) +++ head/sys/amd64/vmm/vmm.cMon May 5 16:19:24 2014(r265364) @@ -189,6 +189,16 @@ static VMM_STAT(VCPU_TOTAL_RUNTIME, "vcp SYSCTL_NODE(_hw, OID_AUTO, vmm, CTLFLAG_RW, NULL, NULL); +/* + * Halt the guest if all vcpus are executing a HLT instruction with + * interrupts disabled. + */ +static int halt_detection_enabled = 1; +TUNABLE_INT("hw.vmm.halt_detection", &halt_detection_enabled); +SYSCTL_INT(_hw_vmm, OID_AUTO, halt_detection, CTLFLAG_RDTUN, +&halt_detection_enabled, 0, +"Halt VM if all vcpus execute HLT with interrupts disabled"); + static int vmm_ipinum; SYSCTL_INT(_hw_vmm, OID_AUTO, ipinum, CTLFLAG_RD, &vmm_ipinum, 0, "IPI vector used for vcpu notifications"); @@ -1047,7 +1057,7 @@ vm_handle_hlt(struct vm *vm, int vcpuid, if (intr_disabled) { wmesg = "vmhalt"; VCPU_CTR0(vm, vcpuid, "Halted"); - if (!vcpu_halted) { + if (!vcpu_halted && halt_detection_enabled) { vcpu_halted = 1; CPU_SET_ATOMIC(vcpuid, &vm->halted_cpus); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265363 - head/sys/kern
Author: truckman Date: Mon May 5 15:59:31 2014 New Revision: 265363 URL: http://svnweb.freebsd.org/changeset/base/265363 Log: Avoid unsigned integer overflow which can cause rman_reserve_resource_bound() to return incorrect results. Continue the initial search until the first viable region is found. Add a comment to explain the search termination test. PR: kern/188534 Reviewed by: jhb (previous version) MFC after:1 week Modified: head/sys/kern/subr_rman.c Modified: head/sys/kern/subr_rman.c == --- head/sys/kern/subr_rman.c Mon May 5 14:57:38 2014(r265362) +++ head/sys/kern/subr_rman.c Mon May 5 15:59:31 2014(r265363) @@ -456,7 +456,7 @@ rman_reserve_resource_bound(struct rman mtx_lock(rm->rm_mtx); for (r = TAILQ_FIRST(&rm->rm_list); -r && r->r_end < start; +r && r->r_end < start + count - 1; r = TAILQ_NEXT(r, r_link)) ; @@ -466,6 +466,11 @@ rman_reserve_resource_bound(struct rman } amask = (1ul << RF_ALIGNMENT(flags)) - 1; + if (start + amask < start) { + DPRINTF(("start+amask wrapped around\n")); + goto out; + } + /* If bound is 0, bmask will also be 0 */ bmask = ~(bound - 1); /* @@ -473,11 +478,20 @@ rman_reserve_resource_bound(struct rman */ for (s = r; s; s = TAILQ_NEXT(s, r_link)) { DPRINTF(("considering [%#lx, %#lx]\n", s->r_start, s->r_end)); - if (s->r_start + count - 1 > end) { + /* +* The resource list is sorted, so there is no point in +* searching further once r_start is too large. +*/ + if (s->r_start > end - (count - 1)) { DPRINTF(("s->r_start (%#lx) + count - 1> end (%#lx)\n", s->r_start, end)); break; } + if (s->r_start + amask < s->r_start) { + DPRINTF(("s->r_start (%#lx) + amask (%#lx) wrapped\n", + s->r_start, amask)); + break; + } if (s->r_flags & RF_ALLOCATED) { DPRINTF(("region is allocated\n")); continue; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265362 - head/release/doc/en_US.ISO8859-1/hardware
Author: brueffer Date: Mon May 5 14:57:38 2014 New Revision: 265362 URL: http://svnweb.freebsd.org/changeset/base/265362 Log: Mention the axge(4) driver in the hardware notes. MFC after:1 week Modified: head/release/doc/en_US.ISO8859-1/hardware/article.xml Modified: head/release/doc/en_US.ISO8859-1/hardware/article.xml == --- head/release/doc/en_US.ISO8859-1/hardware/article.xml Mon May 5 14:50:53 2014(r265361) +++ head/release/doc/en_US.ISO8859-1/hardware/article.xml Mon May 5 14:57:38 2014(r265362) @@ -821,6 +821,9 @@ &hwlist.axe; + ASIX Electronics AX88178A/AX88179 USB Gigabit Ethernet + adapters (&man.axge.4; driver) + &hwlist.bce; [&arch.amd64;, &arch.i386;] Broadcom BCM4401 based Fast ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265361 - stable/10/lib/libc/locale
Author: pfg Date: Mon May 5 14:50:53 2014 New Revision: 265361 URL: http://svnweb.freebsd.org/changeset/base/265361 Log: MFC r265095, r265167; citrus: Avoid invalid code points. The UTF-8 decoder should not accept byte sequences which decode to unicode code positions U+D800 to U+DFFF (UTF-16 surrogates).[1] Contrary to the original OpenBSD patch, we do pass U+FFFE and U+, both values are valid "non-characters" [2] and must be mapped through UTFs. [1] http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 [2] http://www.unicode.org/faq/private_use.html Reported by: Stefan Sperling [1] Thanks to:jilles [2] Obtained from:OpenBSD Modified: stable/10/lib/libc/locale/utf8.c Modified: stable/10/lib/libc/locale/utf8.c == --- stable/10/lib/libc/locale/utf8.cMon May 5 14:50:44 2014 (r265360) +++ stable/10/lib/libc/locale/utf8.cMon May 5 14:50:53 2014 (r265361) @@ -203,6 +203,13 @@ _UTF8_mbrtowc(wchar_t * __restrict pwc, errno = EILSEQ; return ((size_t)-1); } + if (wch >= 0xd800 && wch <= 0xdfff) { + /* +* Malformed input; invalid code points. +*/ + errno = EILSEQ; + return ((size_t)-1); + } if (pwc != NULL) *pwc = wch; us->want = 0; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265360 - head/share/man/man4
Author: brueffer Date: Mon May 5 14:50:44 2014 New Revision: 265360 URL: http://svnweb.freebsd.org/changeset/base/265360 Log: Remove stray comma. MFC after:3 days Modified: head/share/man/man4/tnt4882.4 Modified: head/share/man/man4/tnt4882.4 == --- head/share/man/man4/tnt4882.4 Mon May 5 14:31:34 2014 (r265359) +++ head/share/man/man4/tnt4882.4 Mon May 5 14:50:44 2014 (r265360) @@ -44,7 +44,7 @@ This chip emulates a NEC \(mcPD7210 cont interface between the host computer and the instrument bus. .Sh SEE ALSO .Xr gpib 3 , -.Xr gpib 4 , +.Xr gpib 4 .Sh HISTORY The .Nm ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265359 - head/sys/modules/sound/sound
Author: hselasky Date: Mon May 5 14:31:34 2014 New Revision: 265359 URL: http://svnweb.freebsd.org/changeset/base/265359 Log: Build the kernel sound module without ISA DMA support for ARM and MIPS platforms, because these platforms do not implement the ISA DMA API. Else the sound modules cannot be loaded when running these platforms. MFC after:2 weeks Modified: head/sys/modules/sound/sound/Makefile Modified: head/sys/modules/sound/sound/Makefile == --- head/sys/modules/sound/sound/Makefile Mon May 5 11:50:52 2014 (r265358) +++ head/sys/modules/sound/sound/Makefile Mon May 5 14:31:34 2014 (r265359) @@ -44,7 +44,8 @@ CLEANFILES+= feeder_eq_gen.h feeder_rate EXPORT_SYMS= YES # XXX evaluate -.if ${MACHINE_CPUARCH} == "sparc64" || ${MACHINE_CPUARCH} == "powerpc" +.if ${MACHINE_CPUARCH} == "sparc64" || ${MACHINE_CPUARCH} == "powerpc" || \ +${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "mips" # Create an empty opt_isa.h in order to keep kmod.mk from linking in an # existing one from KERNBUILDDIR which possibly has DEV_ISA defined so # sound.ko is always built without isadma support. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265358 - head/sys/dev/usb/controller
Author: hselasky Date: Mon May 5 11:50:52 2014 New Revision: 265358 URL: http://svnweb.freebsd.org/changeset/base/265358 Log: Improve DWC OTG USB host side support for isochronous FULL and HIGH speed data traffic going directly to a USB device or through a so-called USB transaction translator. Add checks that we are not overusing the TX FIFO. MFC after:2 weeks Modified: head/sys/dev/usb/controller/dwc_otg.c head/sys/dev/usb/controller/dwc_otg.h head/sys/dev/usb/controller/dwc_otgreg.h Modified: head/sys/dev/usb/controller/dwc_otg.c == --- head/sys/dev/usb/controller/dwc_otg.c Mon May 5 11:30:45 2014 (r265357) +++ head/sys/dev/usb/controller/dwc_otg.c Mon May 5 11:50:52 2014 (r265358) @@ -207,6 +207,12 @@ dwc_otg_init_fifo(struct dwc_otg_softc * /* reset active endpoints */ sc->sc_active_rx_ep = 0; + /* reset TX size */ + sc->sc_tx_cur_size = 0; + + /* reset TT info */ + memset(sc->sc_tt_info, 0, sizeof(sc->sc_tt_info)); + fifo_size /= 2; DWC_OTG_WRITE_4(sc, DOTG_GNPTXFSIZ, @@ -215,19 +221,17 @@ dwc_otg_init_fifo(struct dwc_otg_softc * tx_start += fifo_size; + for (x = 0; x != sc->sc_host_ch_max; x++) { + /* enable all needed interrupts */ + DWC_OTG_WRITE_4(sc, DOTG_HCINTMSK(x), HCINT_DEFAULT_MASK); + } + DWC_OTG_WRITE_4(sc, DOTG_HPTXFSIZ, ((fifo_size / 4) << 16) | (tx_start / 4)); - for (x = 0; x != sc->sc_host_ch_max; x++) { - /* enable interrupts */ - DWC_OTG_WRITE_4(sc, DOTG_HCINTMSK(x), - HCINT_STALL | HCINT_BBLERR | - HCINT_XACTERR | - HCINT_NAK | HCINT_ACK | HCINT_NYET | - HCINT_CHHLTD | HCINT_FRMOVRUN | - HCINT_DATATGLERR); - } + /* store maximum TX FIFO size */ + sc->sc_tx_max_size = fifo_size; /* enable host channel interrupts */ DWC_OTG_WRITE_4(sc, DOTG_HAINTMSK, @@ -309,6 +313,12 @@ dwc_otg_init_fifo(struct dwc_otg_softc * } else { /* reset active endpoints */ sc->sc_active_rx_ep = 0; + + /* reset TX size */ + sc->sc_tx_cur_size = 0; + + /* reset TT info */ + memset(sc->sc_tt_info, 0, sizeof(sc->sc_tt_info)); } return (0); } @@ -376,9 +386,9 @@ dwc_otg_pull_down(struct dwc_otg_softc * static void dwc_otg_enable_sof_irq(struct dwc_otg_softc *sc) { - if (sc->sc_irq_mask & GINTSTS_SOF) + if (sc->sc_irq_mask & GINTMSK_SOFMSK) return; - sc->sc_irq_mask |= GINTSTS_SOF; + sc->sc_irq_mask |= GINTMSK_SOFMSK; DWC_OTG_WRITE_4(sc, DOTG_GINTMSK, sc->sc_irq_mask); } @@ -506,6 +516,7 @@ dwc_otg_clear_hcint(struct dwc_otg_softc { uint32_t hcint; + /* clear all pending interrupts */ hcint = DWC_OTG_READ_4(sc, DOTG_HCINT(x)); DWC_OTG_WRITE_4(sc, DOTG_HCINT(x), hcint); @@ -513,6 +524,10 @@ dwc_otg_clear_hcint(struct dwc_otg_softc sc->sc_chan_state[x].hcint = 0; } +/* + * This function waits until a DWC OTG host channel is ready to be + * used again: + */ static uint8_t dwc_otg_host_channel_wait(struct dwc_otg_td *td) { @@ -545,6 +560,9 @@ dwc_otg_host_channel_wait(struct dwc_otg sc->sc_chan_state[td->channel].allocated = 0; sc->sc_chan_state[x].allocated = 1; + sc->sc_chan_state[x].tx_size = + sc->sc_chan_state[td->channel].tx_size; + if (sc->sc_chan_state[td->channel].suspended) { sc->sc_chan_state[td->channel].suspended = 0; sc->sc_chan_state[x].suspended = 1; @@ -579,6 +597,7 @@ static uint8_t dwc_otg_host_channel_alloc(struct dwc_otg_td *td) { struct dwc_otg_softc *sc; + uint32_t tx_size; uint8_t x; uint8_t max_channel; @@ -591,9 +610,25 @@ dwc_otg_host_channel_alloc(struct dwc_ot if ((td->hcchar & HCCHAR_EPNUM_MASK) == 0) { max_channel = 1; x = 0; + tx_size = td->max_packet_size; + if ((sc->sc_tx_cur_size + tx_size) > sc->sc_tx_max_size) { + DPRINTF("Too little FIFO space\n"); + return (1); /* too little FIFO */ + } } else { max_channel = sc->sc_host_ch_max; x = 1; + if ((td->hcchar & HCCHAR_EPDIR) == HCCHAR_EPDIR_OUT) { + tx_size = td->max_packet_size; +
svn commit: r265357 - stable/9/sys/netinet
Author: rmacklem Date: Mon May 5 11:30:45 2014 New Revision: 265357 URL: http://svnweb.freebsd.org/changeset/base/265357 Log: MFC: r264739 Add {} braces so that the code conforms to the indentation. Fortunately, I don't think doing the assignment of cap->tsomax unconditionally causes any problem. Modified: stable/9/sys/netinet/tcp_subr.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/tcp_subr.c == --- stable/9/sys/netinet/tcp_subr.c Mon May 5 10:54:36 2014 (r265356) +++ stable/9/sys/netinet/tcp_subr.c Mon May 5 11:30:45 2014 (r265357) @@ -1741,9 +1741,10 @@ tcp_maxmtu(struct in_conninfo *inc, stru /* Report additional interface capabilities. */ if (cap != NULL) { if (ifp->if_capenable & IFCAP_TSO4 && - ifp->if_hwassist & CSUM_TSO) + ifp->if_hwassist & CSUM_TSO) { cap->ifcap |= CSUM_TSO; cap->tsomax = ifp->if_hw_tsomax; + } } RTFREE(sro.ro_rt); } @@ -1779,9 +1780,10 @@ tcp_maxmtu6(struct in_conninfo *inc, str /* Report additional interface capabilities. */ if (cap != NULL) { if (ifp->if_capenable & IFCAP_TSO6 && - ifp->if_hwassist & CSUM_TSO) + ifp->if_hwassist & CSUM_TSO) { cap->ifcap |= CSUM_TSO; cap->tsomax = ifp->if_hw_tsomax; + } } RTFREE(sro6.ro_rt); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265351 - head/sys/geom/label
Author: trasz Date: Mon May 5 09:20:30 2014 New Revision: 265351 URL: http://svnweb.freebsd.org/changeset/base/265351 Log: Make r242379 - the fix for UFS labels disappearing after resizing the provider - also apply to UFS1 filesystems. This should help with resizing filesystems created by makefs(8), which still uses UFS1. Tested by:jmg@ Sponsored by: The FreeBSD Foundation Modified: head/sys/geom/label/g_label_ufs.c Modified: head/sys/geom/label/g_label_ufs.c == --- head/sys/geom/label/g_label_ufs.c Mon May 5 08:12:21 2014 (r265350) +++ head/sys/geom/label/g_label_ufs.c Mon May 5 09:20:30 2014 (r265351) @@ -81,13 +81,15 @@ g_label_ufs_taste_common(struct g_consum fs = (struct fs *)g_read_data(cp, superblock, SBLOCKSIZE, NULL); if (fs == NULL) continue; - /* Check for magic. We also need to check if file system size is equal + /* +* Check for magic. We also need to check if file system size is equal * to providers size, because sysinstall(8) used to bogusly put first * partition at offset 0 instead of 16, and glabel/ufs would find file * system on slice instead of partition. */ if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_fsize > 0 && - pp->mediasize / fs->fs_fsize == fs->fs_old_size) { + ((pp->mediasize / fs->fs_fsize == fs->fs_old_size) || + (pp->mediasize / fs->fs_fsize == fs->fs_providersize))) { /* Valid UFS1. */ } else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0 && ((pp->mediasize / fs->fs_fsize == fs->fs_size) || ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265350 - head/sys/dev/ath
Author: adrian Date: Mon May 5 08:12:21 2014 New Revision: 265350 URL: http://svnweb.freebsd.org/changeset/base/265350 Log: Break out the multicast programming into its own hardware specific call, which assumes the hardware is awake. Turn ath_update_mcast() into a routine that's only called from the net80211 layer - and it forces the hardware awake first. This fixes a LOR from the EDMA RX path which calls ath_mode_init() with the RX lock held - the driver lock can't also be grabbed. This path assumes that the ath_mode_init() callers all wake up the NIC first. Tested: * AR9485, STA mode, powersave Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c == --- head/sys/dev/ath/if_ath.c Mon May 5 08:00:50 2014(r265349) +++ head/sys/dev/ath/if_ath.c Mon May 5 08:12:21 2014(r265350) @@ -165,6 +165,7 @@ static void ath_bmiss_vap(struct ieee802 static voidath_bmiss_proc(void *, int); static voidath_key_update_begin(struct ieee80211vap *); static voidath_key_update_end(struct ieee80211vap *); +static voidath_update_mcast_hw(struct ath_softc *); static voidath_update_mcast(struct ifnet *); static voidath_update_promisc(struct ifnet *); static voidath_updateslot(struct ifnet *); @@ -3379,10 +3380,15 @@ ath_update_promisc(struct ifnet *ifp) DPRINTF(sc, ATH_DEBUG_MODE, "%s: RX filter 0x%x\n", __func__, rfilt); } +/* + * Driver-internal mcast update call. + * + * Assumes the hardware is already awake. + */ static void -ath_update_mcast(struct ifnet *ifp) +ath_update_mcast_hw(struct ath_softc *sc) { - struct ath_softc *sc = ifp->if_softc; + struct ifnet *ifp = sc->sc_ifp; u_int32_t mfilt[2]; /* calculate and install multicast filter */ @@ -3410,13 +3416,31 @@ ath_update_mcast(struct ifnet *ifp) if_maddr_runlock(ifp); } else mfilt[0] = mfilt[1] = ~0; + + ath_hal_setmcastfilter(sc->sc_ah, mfilt[0], mfilt[1]); + + DPRINTF(sc, ATH_DEBUG_MODE, "%s: MC filter %08x:%08x\n", + __func__, mfilt[0], mfilt[1]); +} + +/* + * Called from the net80211 layer - force the hardware + * awake before operating. + */ +static void +ath_update_mcast(struct ifnet *ifp) +{ + struct ath_softc *sc = ifp->if_softc; + ATH_LOCK(sc); ath_power_set_power_state(sc, HAL_PM_AWAKE); - ath_hal_setmcastfilter(sc->sc_ah, mfilt[0], mfilt[1]); + ATH_UNLOCK(sc); + + ath_update_mcast_hw(sc); + + ATH_LOCK(sc); ath_power_restore_power_state(sc); ATH_UNLOCK(sc); - DPRINTF(sc, ATH_DEBUG_MODE, "%s: MC filter %08x:%08x\n", - __func__, mfilt[0], mfilt[1]); } void @@ -3444,7 +3468,7 @@ ath_mode_init(struct ath_softc *sc) ath_hal_setmac(ah, IF_LLADDR(ifp)); /* calculate and install multicast filter */ - ath_update_mcast(ifp); + ath_update_mcast_hw(sc); } /* ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265349 - head/sys/dev/ath
Author: adrian Date: Mon May 5 08:00:50 2014 New Revision: 265349 URL: http://svnweb.freebsd.org/changeset/base/265349 Log: Quieten the RX/TX descriptor and FIFO setup debugging. Tested: * AR9485, STA mode Modified: head/sys/dev/ath/if_ath_rx_edma.c head/sys/dev/ath/if_ath_tx_edma.c Modified: head/sys/dev/ath/if_ath_rx_edma.c == --- head/sys/dev/ath/if_ath_rx_edma.c Mon May 5 07:58:05 2014 (r265348) +++ head/sys/dev/ath/if_ath_rx_edma.c Mon May 5 08:00:50 2014 (r265349) @@ -888,10 +888,13 @@ ath_edma_setup_rxfifo(struct ath_softc * qtype); return (-EINVAL); } - device_printf(sc->sc_dev, "%s: type=%d, FIFO depth = %d entries\n", - __func__, - qtype, - re->m_fifolen); + + if (bootverbose) + device_printf(sc->sc_dev, + "%s: type=%d, FIFO depth = %d entries\n", + __func__, + qtype, + re->m_fifolen); /* Allocate ath_buf FIFO array, pre-zero'ed */ re->m_fifo = malloc(sizeof(struct ath_buf *) * re->m_fifolen, @@ -982,10 +985,12 @@ ath_recv_setup_edma(struct ath_softc *sc (void) ath_hal_setrxbufsize(sc->sc_ah, sc->sc_edma_bufsize - sc->sc_rx_statuslen); - device_printf(sc->sc_dev, "RX status length: %d\n", - sc->sc_rx_statuslen); - device_printf(sc->sc_dev, "RX buffer size: %d\n", - sc->sc_edma_bufsize); + if (bootverbose) { + device_printf(sc->sc_dev, "RX status length: %d\n", + sc->sc_rx_statuslen); + device_printf(sc->sc_dev, "RX buffer size: %d\n", + sc->sc_edma_bufsize); + } sc->sc_rx.recv_stop = ath_edma_stoprecv; sc->sc_rx.recv_start = ath_edma_startrecv; Modified: head/sys/dev/ath/if_ath_tx_edma.c == --- head/sys/dev/ath/if_ath_tx_edma.c Mon May 5 07:58:05 2014 (r265348) +++ head/sys/dev/ath/if_ath_tx_edma.c Mon May 5 08:00:50 2014 (r265349) @@ -866,12 +866,14 @@ ath_xmit_setup_edma(struct ath_softc *sc (void) ath_hal_gettxstatuslen(sc->sc_ah, &sc->sc_tx_statuslen); (void) ath_hal_getntxmaps(sc->sc_ah, &sc->sc_tx_nmaps); - device_printf(sc->sc_dev, "TX descriptor length: %d\n", - sc->sc_tx_desclen); - device_printf(sc->sc_dev, "TX status length: %d\n", - sc->sc_tx_statuslen); - device_printf(sc->sc_dev, "TX buffers per descriptor: %d\n", - sc->sc_tx_nmaps); + if (bootverbose) { + device_printf(sc->sc_dev, "TX descriptor length: %d\n", + sc->sc_tx_desclen); + device_printf(sc->sc_dev, "TX status length: %d\n", + sc->sc_tx_statuslen); + device_printf(sc->sc_dev, "TX buffers per descriptor: %d\n", + sc->sc_tx_nmaps); + } sc->sc_tx.xmit_setup = ath_edma_dma_txsetup; sc->sc_tx.xmit_teardown = ath_edma_dma_txteardown; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r265348 - in head/sys: contrib/dev/ath/ath_hal/ar9300 dev/ath/ath_hal
Author: adrian Date: Mon May 5 07:58:05 2014 New Revision: 265348 URL: http://svnweb.freebsd.org/changeset/base/265348 Log: Add Atheros AR support to the HAL. This seems to probe/attach as an AR9485 and thus nothing else besides adding the device id seems to be required. ath0: mem 0xf480-0xf487 irq 19 at device 0.0 on pci5 ath0: [HT] enabling HT modes ath0: [HT] enabling short-GI in 20MHz mode ath0: [HT] 1 stream STBC receive enabled ath0: [HT] 1 RX streams; 1 TX streams ath0: AR9485 mac 576.1 RF5110 phy 1926.8 ath0: 2GHz radio: 0x; 5GHz radio: 0x The NIC I have here is a 1 antenna, 2GHz only device. Thankyou to Jim Thompson for the AR NIC. Tested: * AR (pretending not to be an AR9485, but failing miserably); STA mode with powersave. Relnotes: yes Sponsored by: Netgate Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_attach.c head/sys/dev/ath/ath_hal/ah_devid.h Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_attach.c == --- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_attach.c Mon May 5 07:40:55 2014(r265347) +++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_attach.c Mon May 5 07:58:05 2014(r265348) @@ -4113,6 +4113,8 @@ ar9300_probe(uint16_t vendorid, uint16_t return "Qualcomm Atheros QCA955x"; case AR9300_DEVID_QCA9565: /* Aphrodite */ return "Qualcomm Atheros AR9565"; +case AR9300_DEVID_AR_PCIE: + return "Atheros AR"; default: return AH_NULL; } Modified: head/sys/dev/ath/ath_hal/ah_devid.h == --- head/sys/dev/ath/ath_hal/ah_devid.h Mon May 5 07:40:55 2014 (r265347) +++ head/sys/dev/ath/ath_hal/ah_devid.h Mon May 5 07:58:05 2014 (r265348) @@ -92,6 +92,7 @@ #defineAR9300_DEVID_AR946X_PCIE0x0034 #defineAR9300_DEVID_AR9330 0x0035 #defineAR9300_DEVID_QCA95650x0036 +#defineAR9300_DEVID_AR_PCIE0x0037 #defineAR9300_DEVID_QCA955X0x0039 #defineAR_SUBVENDOR_ID_NOG 0x0e11 /* No 11G subvendor ID */ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"