svn commit: r281845 - in head: lib/libc/stdio libexec/rtld-elf sys/kern sys/sys
Author: rodrigc Date: Wed Apr 22 01:54:25 2015 New Revision: 281845 URL: https://svnweb.freebsd.org/changeset/base/281845 Log: Support file verification in MAC. * Add VCREAT flag to indicate when a new file is being created * Add VVERIFY to indicate verification is required * Both VCREAT and VVERIFY are only passed on the MAC method vnode_check_open and are removed from the accmode after * Add O_VERIFY flag to rtld open of objects * Add 'v' flag to __sflags to set O_VERIFY flag. Submitted by: Steve Kiernan Obtained from:Juniper Networks, Inc. GitHub Pull Request: https://github.com/freebsd/freebsd/pull/27 Relnotes: yes Modified: head/lib/libc/stdio/flags.c head/libexec/rtld-elf/rtld.c head/sys/kern/vfs_vnops.c head/sys/sys/fcntl.h head/sys/sys/vnode.h Modified: head/lib/libc/stdio/flags.c == --- head/lib/libc/stdio/flags.c Wed Apr 22 01:35:29 2015(r281844) +++ head/lib/libc/stdio/flags.c Wed Apr 22 01:54:25 2015(r281845) @@ -97,6 +97,10 @@ __sflags(const char *mode, int *optr) /* set close-on-exec */ o |= O_CLOEXEC; break; + case 'v': + /* verify */ + o |= O_VERIFY; + break; default: known = 0; break; Modified: head/libexec/rtld-elf/rtld.c == --- head/libexec/rtld-elf/rtld.cWed Apr 22 01:35:29 2015 (r281844) +++ head/libexec/rtld-elf/rtld.cWed Apr 22 01:54:25 2015 (r281845) @@ -2165,7 +2165,7 @@ load_object(const char *name, int fd_u, * To avoid a race, we open the file and use fstat() rather than * using stat(). */ - if ((fd = open(path, O_RDONLY | O_CLOEXEC)) == -1) { + if ((fd = open(path, O_RDONLY | O_CLOEXEC | O_VERIFY)) == -1) { _rtld_error("Cannot open \"%s\"", path); free(path); return (NULL); @@ -2855,7 +2855,7 @@ search_library_pathfds(const char *name, dirfd = parse_libdir(fdstr); if (dirfd < 0) break; - fd = __sys_openat(dirfd, name, O_RDONLY | O_CLOEXEC); + fd = __sys_openat(dirfd, name, O_RDONLY | O_CLOEXEC | O_VERIFY); if (fd >= 0) { *fdp = fd; len = strlen(fdstr) + strlen(name) + 3; Modified: head/sys/kern/vfs_vnops.c == --- head/sys/kern/vfs_vnops.c Wed Apr 22 01:35:29 2015(r281844) +++ head/sys/kern/vfs_vnops.c Wed Apr 22 01:54:25 2015(r281845) @@ -306,9 +306,15 @@ vn_open_vnode(struct vnode *vp, int fmod if ((fmode & O_APPEND) && (fmode & FWRITE)) accmode |= VAPPEND; #ifdef MAC + if (fmode & O_CREAT) + accmode |= VCREAT; + if (fmode & O_VERIFY) + accmode |= VVERIFY; error = mac_vnode_check_open(cred, vp, accmode); if (error) return (error); + + accmode &= ~(VCREAT | VVERIFY); #endif if ((fmode & O_CREAT) == 0) { if (accmode & VWRITE) { Modified: head/sys/sys/fcntl.h == --- head/sys/sys/fcntl.hWed Apr 22 01:35:29 2015(r281844) +++ head/sys/sys/fcntl.hWed Apr 22 01:54:25 2015(r281845) @@ -129,6 +129,10 @@ typedef__pid_t pid_t; #defineO_CLOEXEC 0x0010 #endif +#if __BSD_VISIBLE +#defineO_VERIFY0x0020 /* open only after verification */ +#endif + /* * XXX missing O_DSYNC, O_RSYNC. */ Modified: head/sys/sys/vnode.h == --- head/sys/sys/vnode.hWed Apr 22 01:35:29 2015(r281844) +++ head/sys/sys/vnode.hWed Apr 22 01:54:25 2015(r281845) @@ -336,6 +336,8 @@ struct vattr { #defineVWRITE_ACL 4000 /* change ACL and/or file mode */ #defineVWRITE_OWNER0001 /* change file owner */ #defineVSYNCHRONIZE0002 /* not used */ +#defineVCREAT 0004 /* creating new file */ +#defineVVERIFY 0010 /* verification required */ /* * Permissions that were traditionally granted only to the file owner. ___ 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: r281844 - head/sys/sys
Author: rodrigc Date: Wed Apr 22 01:35:29 2015 New Revision: 281844 URL: https://svnweb.freebsd.org/changeset/base/281844 Log: Quiet compiler warnings in mbuf.h * Mark unused arguments with __unused * Move inline before the return type (and use __inline to keep the file consistent in style.) Submitted by: Steve Kiernan Obtained from:Juniper Networks, Inc. Modified: head/sys/sys/mbuf.h Modified: head/sys/sys/mbuf.h == --- head/sys/sys/mbuf.h Wed Apr 22 01:08:40 2015(r281843) +++ head/sys/sys/mbuf.h Wed Apr 22 01:35:29 2015(r281844) @@ -616,8 +616,8 @@ m_getzone(int size) * should go away with constant propagation for !MGETHDR. */ static __inline int -m_init(struct mbuf *m, uma_zone_t zone, int size, int how, short type, -int flags) +m_init(struct mbuf *m, uma_zone_t zone __unused, int size __unused, int how, +short type, int flags) { int error; @@ -1122,7 +1122,7 @@ m_tag_first(struct mbuf *m) * Return the next tag in the list of tags associated with an mbuf. */ static __inline struct m_tag * -m_tag_next(struct mbuf *m, struct m_tag *t) +m_tag_next(struct mbuf *m __unused, struct m_tag *t) { return (SLIST_NEXT(t, m_tag_link)); @@ -1178,7 +1178,7 @@ m_free(struct mbuf *m) return (n); } -static int inline +static __inline int rt_m_getfib(struct mbuf *m) { KASSERT(m->m_flags & M_PKTHDR , ("Attempt to get FIB from non header mbuf.")); ___ 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: r281843 - in stable/10: sys/boot sys/boot/arm/uboot sys/boot/common sys/boot/forth sys/boot/i386/loader sys/boot/pc98/loader sys/boot/powerpc/ofw sys/boot/powerpc/ps3 sys/boot/sparc64/l...
Author: dteske Date: Wed Apr 22 01:08:40 2015 New Revision: 281843 URL: https://svnweb.freebsd.org/changeset/base/281843 Log: MFC revisions 277693,278335,280382-280385,280923-280926,280931, 280933-280939,280974-280976,281002,281009,281081,281176-281180, 281271,281275,281616 (described in-breif below): r277693: Font fix (des) r278335: Revert that r280382: Whitespace, comments, and copyright update r280383: Prevent inadvertent bootlock condition r280384: Increase max passowrd length from 16 to 255 chars r280385: Add missing variable hints to loader.conf(5) defaults r280923: Whitespace r280924: Comments r280925: Optimize bootmsg to use fg/bg/me from screen.4th r280926: Whitespace and cleanup r280931: Comments r280933: Move beastie to logo-*.4th; brands to brand-*.4th r280934: Add remainder of supported ANSI escape sequences r280935: Securely overwrite (zero) user input after password checks r280936: Use equals for ASCII double frames r280937: Solve dreaded "dictionary full" issue r280938: Add "GELI Passphrase:" prompt to boot loader r280939: Revert that (premature commit) r280974: Use fg/b/me from screen.4th instead of literals r280975: Eliminate literal escape sequences from *.4th r280976: Use ^[[m mode-ending versus ^[[37m r281002: Install newly added brand-*.4th and logo-*.4th files (jkim) r281009: Revert .PATH changes to fix mips build (jkim) r281081: Make sure forth manpages are only installed once (bapt) r281176: Back to previous mode-endings based on feedback r281177: Back to previous mode-endings based on feedback r281178: Back to previous mode-endings based on feedback r281179: Back to previous mode-endings based on feedback r281180: Eliminate literal escape sequences from *.rc r281271: Fix a bootlock condition if loader_version is set NB: Commit message of r281271 has a typo, s/_logo/_version/ r281275: Re-do proper mode-endings r281616: Add "GELI Passphrase:" prompt to boot loader Relnotes: Added "GELI Passphrase:" prompt to boot loader Added: stable/10/sys/boot/forth/Makefile - copied unchanged from r281081, head/sys/boot/forth/Makefile stable/10/sys/boot/forth/Makefile.inc - copied, changed from r281002, head/sys/boot/forth/Makefile.inc stable/10/sys/boot/forth/brand-fbsd.4th - copied, changed from r280933, head/sys/boot/forth/brand-fbsd.4th stable/10/sys/boot/forth/logo-beastie.4th - copied, changed from r280933, head/sys/boot/forth/logo-beastie.4th stable/10/sys/boot/forth/logo-beastiebw.4th - copied, changed from r280933, head/sys/boot/forth/logo-beastiebw.4th stable/10/sys/boot/forth/logo-fbsdbw.4th - copied, changed from r280933, head/sys/boot/forth/logo-fbsdbw.4th stable/10/sys/boot/forth/logo-orb.4th - copied, changed from r280933, head/sys/boot/forth/logo-orb.4th stable/10/sys/boot/forth/logo-orbbw.4th - copied, changed from r280933, head/sys/boot/forth/logo-orbbw.4th Modified: stable/10/sys/boot/Makefile stable/10/sys/boot/arm/uboot/Makefile stable/10/sys/boot/common/Makefile.inc stable/10/sys/boot/forth/beastie.4th stable/10/sys/boot/forth/brand.4th stable/10/sys/boot/forth/check-password.4th stable/10/sys/boot/forth/check-password.4th.8 stable/10/sys/boot/forth/delay.4th stable/10/sys/boot/forth/frames.4th stable/10/sys/boot/forth/loader.4th stable/10/sys/boot/forth/loader.conf stable/10/sys/boot/forth/menu-commands.4th stable/10/sys/boot/forth/menu.4th stable/10/sys/boot/forth/menu.rc stable/10/sys/boot/forth/menusets.4th stable/10/sys/boot/forth/pnp.4th stable/10/sys/boot/forth/screen.4th stable/10/sys/boot/forth/support.4th stable/10/sys/boot/forth/version.4th stable/10/sys/boot/i386/loader/Makefile stable/10/sys/boot/pc98/loader/Makefile stable/10/sys/boot/powerpc/ofw/Makefile stable/10/sys/boot/powerpc/ps3/Makefile stable/10/sys/boot/sparc64/loader/Makefile stable/10/sys/kern/init_main.c stable/10/usr.sbin/bsdinstall/scripts/zfsboot Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/boot/Makefile == --- stable/10/sys/boot/Makefile Wed Apr 22 00:40:41 2015(r281842) +++ stable/10/sys/boot/Makefile Wed Apr 22 01:08:40 2015(r281843) @@ -6,6 +6,7 @@ .if ${MK_FORTH} != "no" # Build the add-in FORTH interpreter. SUBDIR+= ficl +SUBDIR+= forth .endif # Pick the machine-dependent subdir based on the target architecture. Modified: stable/10/sys/boot/arm/uboot/Makefile == --- stable/10/sys/boot/arm/uboot/Makefile Wed Apr 22 00:40:41 2015 (r281842) +++ stable/10/sys/boot/arm/uboot/Makefile Wed Apr 22 01:08:40 2015 (r281843) @@ -137,11 +137,7 @@ ldscript.generated:: .if !defined(LOADER_ONLY) .PATH: ${.CURDIR}/../../forth -FILES+=loader.help l
svn commit: r281842 - in stable/9/sys: conf fs/ext2fs modules/ext2fs
Author: pfg Date: Wed Apr 22 00:40:41 2015 New Revision: 281842 URL: https://svnweb.freebsd.org/changeset/base/281842 Log: MFC r281670, r281703: Drop experimental ext2fs dir_index support. The htree directory index is a highly desirable feature for research purposes and was meant to improve performance in our ext2/3 driver. Unfortunately our implementation has two problems: - It never really delivered any performance improvement. - It appears to corrupt the filesystem in undetermined circumstances. Strictly speaking dir_index is not required for read/write support in ext2/3 and our limited ext4 support still works fine without it. Regain stability in the ext2 driver by removing it. We may need it back (fixed) if we want to support encrypted ext4 support but thanks to the wonders of version control we can always revert this change and bring it back. PR: 191895 PR: 198731 PR: 199309 Deleted: stable/9/sys/fs/ext2fs/ext2_hash.c stable/9/sys/fs/ext2fs/ext2_htree.c Modified: stable/9/sys/conf/files stable/9/sys/fs/ext2fs/ext2_dir.h stable/9/sys/fs/ext2fs/ext2_extern.h stable/9/sys/fs/ext2fs/ext2_lookup.c stable/9/sys/fs/ext2fs/ext2_vfsops.c stable/9/sys/fs/ext2fs/ext2fs.h stable/9/sys/modules/ext2fs/Makefile Directory Properties: stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/conf/files == --- stable/9/sys/conf/files Wed Apr 22 00:38:11 2015(r281841) +++ stable/9/sys/conf/files Wed Apr 22 00:40:41 2015(r281842) @@ -2428,8 +2428,6 @@ fs/ext2fs/ext2_bmap.c optional ext2fs fs/ext2fs/ext2_extents.c optional ext2fs fs/ext2fs/ext2_inode.c optional ext2fs fs/ext2fs/ext2_inode_cnv.c optional ext2fs -fs/ext2fs/ext2_hash.c optional ext2fs -fs/ext2fs/ext2_htree.c optional ext2fs fs/ext2fs/ext2_lookup.coptional ext2fs fs/ext2fs/ext2_subr.c optional ext2fs fs/ext2fs/ext2_vfsops.coptional ext2fs Modified: stable/9/sys/fs/ext2fs/ext2_dir.h == --- stable/9/sys/fs/ext2fs/ext2_dir.h Wed Apr 22 00:38:11 2015 (r281841) +++ stable/9/sys/fs/ext2fs/ext2_dir.h Wed Apr 22 00:40:41 2015 (r281842) @@ -40,21 +40,6 @@ struct ext2fs_direct { uint16_t e2d_namlen;/* length of string in e2d_name */ char e2d_name[EXT2FS_MAXNAMLEN];/* name with length<=EXT2FS_MAXNAMLEN */ }; - -enum slotstatus { - NONE, - COMPACT, - FOUND -}; - -struct ext2fs_searchslot { - enum slotstatus slotstatus; - doff_t slotoffset; /* offset of area with free space */ - int slotsize; /* size of area at slotoffset */ - int slotfreespace; /* amount of space free in slot */ - int slotneeded; /* sizeof the entry we are seeking */ -}; - /* * The new version of the directory entry. Since EXT2 structures are * stored in intel byte order, and the name_len field could never be Modified: stable/9/sys/fs/ext2fs/ext2_extern.h == --- stable/9/sys/fs/ext2fs/ext2_extern.hWed Apr 22 00:38:11 2015 (r281841) +++ stable/9/sys/fs/ext2fs/ext2_extern.hWed Apr 22 00:40:41 2015 (r281842) @@ -40,15 +40,12 @@ #define_FS_EXT2FS_EXT2_EXTERN_H_ struct ext2fs_dinode; -struct ext2fs_direct_2; -struct ext2fs_searchslot; struct indir; struct inode; struct mount; struct vfsconf; struct vnode; -intext2_add_entry(struct vnode *, struct ext2fs_direct_2 *); intext2_alloc(struct inode *, daddr_t, e4fs_daddr_t, int, struct ucred *, e4fs_daddr_t *); intext2_balloc(struct inode *, @@ -86,18 +83,6 @@ int ext2_dirempty(struct inode *, ino_t, intext2_checkpath(struct inode *, struct inode *, struct ucred *); intcg_has_sb(int i); intext2_inactive(struct vop_inactive_args *); -intext2_htree_add_entry(struct vnode *, struct ext2fs_direct_2 *, - struct componentname *); -intext2_htree_create_index(struct vnode *, struct componentname *, - struct ext2fs_direct_2 *); -intext2_htree_has_idx(struct inode *); -intext2_htree_hash(const char *, int, uint32_t *, int, uint32_t *, - uint32_t *); -intext2_htree_lookup(struct inode *, const char *, int, struct buf **, - int *, doff_t *, doff_t *, doff_t *, struct ext2fs_searchslot *); -intext2_search_dirblock(struct inode *, void *, int *, const char *, int, - int *, doff_t *, doff_t *, doff_t *, struct ext2fs_searchslot *); - /* Flags to low-level allocation routines. * The low 16-bits are reserved for IO_ flags from vnode.h. Modified:
svn commit: r281841 - in stable/10/sys: conf fs/ext2fs modules/ext2fs
Author: pfg Date: Wed Apr 22 00:38:11 2015 New Revision: 281841 URL: https://svnweb.freebsd.org/changeset/base/281841 Log: MFC r281670, r281703: Drop experimental ext2fs dir_index support. The htree directory index is a highly desirable feature for research purposes and was meant to improve performance in our ext2/3 driver. Unfortunately our implementation has two problems: - It never really delivered any performance improvement. - It appears to corrupt the filesystem in undetermined circumstances. Strictly speaking dir_index is not required for read/write support in ext2/3 and our limited ext4 support still works fine without it. Regain stability in the ext2 driver by removing it. We may need it back (fixed) if we want to support encrypted ext4 support but thanks to the wonders of version control we can always revert this change and bring it back. PR: 191895 PR: 198731 PR: 199309 Deleted: stable/10/sys/fs/ext2fs/ext2_hash.c stable/10/sys/fs/ext2fs/ext2_htree.c Modified: stable/10/sys/conf/files stable/10/sys/fs/ext2fs/ext2_dir.h stable/10/sys/fs/ext2fs/ext2_extern.h stable/10/sys/fs/ext2fs/ext2_lookup.c stable/10/sys/fs/ext2fs/ext2_vfsops.c stable/10/sys/fs/ext2fs/ext2fs.h stable/10/sys/modules/ext2fs/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/conf/files == --- stable/10/sys/conf/filesTue Apr 21 22:55:52 2015(r281840) +++ stable/10/sys/conf/filesWed Apr 22 00:38:11 2015(r281841) @@ -2870,8 +2870,6 @@ fs/ext2fs/ext2_bmap.c optional ext2fs fs/ext2fs/ext2_extents.c optional ext2fs fs/ext2fs/ext2_inode.c optional ext2fs fs/ext2fs/ext2_inode_cnv.c optional ext2fs -fs/ext2fs/ext2_hash.c optional ext2fs -fs/ext2fs/ext2_htree.c optional ext2fs fs/ext2fs/ext2_lookup.coptional ext2fs fs/ext2fs/ext2_subr.c optional ext2fs fs/ext2fs/ext2_vfsops.coptional ext2fs Modified: stable/10/sys/fs/ext2fs/ext2_dir.h == --- stable/10/sys/fs/ext2fs/ext2_dir.h Tue Apr 21 22:55:52 2015 (r281840) +++ stable/10/sys/fs/ext2fs/ext2_dir.h Wed Apr 22 00:38:11 2015 (r281841) @@ -40,21 +40,6 @@ struct ext2fs_direct { uint16_t e2d_namlen;/* length of string in e2d_name */ char e2d_name[EXT2FS_MAXNAMLEN];/* name with length<=EXT2FS_MAXNAMLEN */ }; - -enum slotstatus { - NONE, - COMPACT, - FOUND -}; - -struct ext2fs_searchslot { - enum slotstatus slotstatus; - doff_t slotoffset; /* offset of area with free space */ - int slotsize; /* size of area at slotoffset */ - int slotfreespace; /* amount of space free in slot */ - int slotneeded; /* sizeof the entry we are seeking */ -}; - /* * The new version of the directory entry. Since EXT2 structures are * stored in intel byte order, and the name_len field could never be Modified: stable/10/sys/fs/ext2fs/ext2_extern.h == --- stable/10/sys/fs/ext2fs/ext2_extern.h Tue Apr 21 22:55:52 2015 (r281840) +++ stable/10/sys/fs/ext2fs/ext2_extern.h Wed Apr 22 00:38:11 2015 (r281841) @@ -40,15 +40,12 @@ #define_FS_EXT2FS_EXT2_EXTERN_H_ struct ext2fs_dinode; -struct ext2fs_direct_2; -struct ext2fs_searchslot; struct indir; struct inode; struct mount; struct vfsconf; struct vnode; -intext2_add_entry(struct vnode *, struct ext2fs_direct_2 *); intext2_alloc(struct inode *, daddr_t, e4fs_daddr_t, int, struct ucred *, e4fs_daddr_t *); intext2_balloc(struct inode *, @@ -86,18 +83,6 @@ int ext2_dirempty(struct inode *, ino_t, intext2_checkpath(struct inode *, struct inode *, struct ucred *); intcg_has_sb(int i); intext2_inactive(struct vop_inactive_args *); -intext2_htree_add_entry(struct vnode *, struct ext2fs_direct_2 *, - struct componentname *); -intext2_htree_create_index(struct vnode *, struct componentname *, - struct ext2fs_direct_2 *); -intext2_htree_has_idx(struct inode *); -intext2_htree_hash(const char *, int, uint32_t *, int, uint32_t *, - uint32_t *); -intext2_htree_lookup(struct inode *, const char *, int, struct buf **, - int *, doff_t *, doff_t *, doff_t *, struct ext2fs_searchslot *); -intext2_search_dirblock(struct inode *, void *, int *, const char *, int, - int *, doff_t *, doff_t *, doff_t *, struct ext2fs_searchslot *); - /* Flags to low-level allocation routines. * The low 16-bits are reserved for IO_ flags from vnode.h. Modified: stable/10/sys/fs/ext2fs/ext2_lookup.c ===
svn commit: r281840 - head/sys/cam/scsi
Author: delphij Date: Tue Apr 21 22:55:52 2015 New Revision: 281840 URL: https://svnweb.freebsd.org/changeset/base/281840 Log: Extend DA_Q_NO_RC16 to MXUB3* devices. PR: kern/198647 MFC after:2 weeks Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c == --- head/sys/cam/scsi/scsi_da.c Tue Apr 21 20:25:12 2015(r281839) +++ head/sys/cam/scsi/scsi_da.c Tue Apr 21 22:55:52 2015(r281840) @@ -1186,7 +1186,7 @@ static struct da_quirk_entry da_quirk_ta /* * MX-ES USB Drive by Mach Xtreme */ - { T_DIRECT, SIP_MEDIA_REMOVABLE, "MX", "MXUB3SES*", "*"}, + { T_DIRECT, SIP_MEDIA_REMOVABLE, "MX", "MXUB3*", "*"}, /*quirks*/DA_Q_NO_RC16 }, }; ___ 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: r281838 - head/sys/dev/e1000
On 04/21/15 at 08:24P, Hiren Panchasara wrote: > Author: hiren > Date: Tue Apr 21 20:24:15 2015 > New Revision: 281838 > URL: https://svnweb.freebsd.org/changeset/base/281838 > > Log: > For igb(4), when we are doing multiqueue, we are all setup to have full > 32bit > RSS hash from the card. We do not need to hide that under "ifdef RSS" and > should > expose that by default so others like lagg(4) can use that and avoid > hashing the > traffic by themselves. > While here, improve comments and get rid of hidden/unimplemented RSS support > code for UDP. > > Differential Revision: https://reviews.freebsd.org/D2296 > Reviewed by:jfv, erj > Discussed with: adrian > Sponsored by: Limelight Networks > > Modified: > head/sys/dev/e1000/if_igb.c I intend to MFC this in a week or so. But for that, I'd have to first MFC a part of https://svnweb.freebsd.org/base?view=revision&revision=268028 which sets rss hash types. Cheers, Hiren pgpvFFW4C_Lvx.pgp Description: PGP signature
svn commit: r281839 - head/sys/netinet
Author: glebius Date: Tue Apr 21 20:25:12 2015 New Revision: 281839 URL: https://svnweb.freebsd.org/changeset/base/281839 Log: Improve carp(4) locking: - Use the carp_sx to serialize not only CARP ioctls, but also carp_attach() and carp_detach(). - Use cif_mtx to lock only access to those the linked list. - These locking changes allow us to do some memory allocations with M_WAITOK and also properly call callout_drain() in carp_destroy(). - In carp_attach() assert that ifaddr isn't attached. We always come here with a pristine address from in[6]_control(). Reviewed by: oleg Sponsored by: Nginx, Inc. Modified: head/sys/netinet/ip_carp.c Modified: head/sys/netinet/ip_carp.c == --- head/sys/netinet/ip_carp.c Tue Apr 21 20:24:15 2015(r281838) +++ head/sys/netinet/ip_carp.c Tue Apr 21 20:25:12 2015(r281839) @@ -256,7 +256,7 @@ SYSCTL_VNET_PCPUSTAT(_net_inet_carp, OID #defineCIF_LOCK(cif) mtx_lock(&(cif)->cif_mtx) #defineCIF_UNLOCK(cif) mtx_unlock(&(cif)->cif_mtx) #defineCIF_FREE(cif) do {\ - CIF_LOCK_ASSERT(cif); \ + CIF_LOCK(cif); \ if (TAILQ_EMPTY(&(cif)->cif_vrs)) \ carp_free_if(cif); \ else\ @@ -296,7 +296,6 @@ SYSCTL_VNET_PCPUSTAT(_net_inet_carp, OID static voidcarp_input_c(struct mbuf *, struct carp_header *, sa_family_t); static struct carp_softc *carp_alloc(struct ifnet *); -static voidcarp_detach_locked(struct ifaddr *); static voidcarp_destroy(struct carp_softc *); static struct carp_if *carp_alloc_if(struct ifnet *); @@ -1250,8 +1249,6 @@ carp_multicast_setup(struct carp_if *cif struct ifnet *ifp = cif->cif_ifp; int error = 0; - CIF_LOCK_ASSERT(cif); - switch (sa) { #ifdef INET case AF_INET: @@ -1264,9 +1261,7 @@ carp_multicast_setup(struct carp_if *cif imo->imo_membership = (struct in_multi **)malloc( (sizeof(struct in_multi *) * IP_MIN_MEMBERSHIPS), M_CARP, - M_NOWAIT); - if (imo->imo_membership == NULL) - return (ENOMEM); + M_WAITOK); imo->imo_mfilters = NULL; imo->imo_max_memberships = IP_MIN_MEMBERSHIPS; imo->imo_multicast_vif = -1; @@ -1296,9 +1291,7 @@ carp_multicast_setup(struct carp_if *cif im6o->im6o_membership = (struct in6_multi **)malloc( (sizeof(struct in6_multi *) * IPV6_MIN_MEMBERSHIPS), M_CARP, - M_ZERO | M_NOWAIT); - if (im6o->im6o_membership == NULL) - return (ENOMEM); + M_ZERO | M_WAITOK); im6o->im6o_mfilters = NULL; im6o->im6o_max_memberships = IPV6_MIN_MEMBERSHIPS; im6o->im6o_multicast_hlim = CARP_DFLTTL; @@ -1355,7 +1348,8 @@ static void carp_multicast_cleanup(struct carp_if *cif, sa_family_t sa) { - CIF_LOCK_ASSERT(cif); + sx_assert(&carp_sx, SA_XLOCKED); + switch (sa) { #ifdef INET case AF_INET: @@ -1504,22 +1498,18 @@ carp_alloc(struct ifnet *ifp) return (sc); } -static int +static void carp_grow_ifas(struct carp_softc *sc) { struct ifaddr **new; - CARP_LOCK_ASSERT(sc); - - new = malloc(sc->sc_ifasiz * 2, M_CARP, M_NOWAIT|M_ZERO); - if (new == NULL) - return (ENOMEM); + new = malloc(sc->sc_ifasiz * 2, M_CARP, M_WAITOK | M_ZERO); + CARP_LOCK(sc); bcopy(sc->sc_ifas, new, sc->sc_ifasiz); free(sc->sc_ifas, M_CARP); sc->sc_ifas = new; sc->sc_ifasiz *= 2; - - return (0); + CARP_UNLOCK(sc); } static void @@ -1528,17 +1518,20 @@ carp_destroy(struct carp_softc *sc) struct ifnet *ifp = sc->sc_carpdev; struct carp_if *cif = ifp->if_carp; - CIF_LOCK_ASSERT(cif); + sx_assert(&carp_sx, SA_XLOCKED); + + if (sc->sc_suppress) + carp_demote_adj(-V_carp_ifdown_adj, "vhid removed"); + CARP_UNLOCK(sc); + CIF_LOCK(cif); TAILQ_REMOVE(&cif->cif_vrs, sc, sc_list); + CIF_UNLOCK(cif); mtx_lock(&carp_mtx); LIST_REMOVE(sc, sc_next); mtx_unlock(&carp_mtx); - CARP_LOCK(sc); - if (sc->sc_suppress) - carp_demote_adj(-V_carp_ifdown_adj, "vhid removed"); callout_drain(&sc->sc_ad_tmo); #ifdef INET callout_drain(&sc->sc_md_tmo); @@ -1807,8 +1800,7 @@ carp_attach(struct ifaddr *ifa, int vhid struct carp_softc *sc; int index, error; - if (ifp->if_carp == NULL) - return (ENOPROTOOPT); + KASSERT(ifa->ifa_c
svn commit: r281838 - head/sys/dev/e1000
Author: hiren Date: Tue Apr 21 20:24:15 2015 New Revision: 281838 URL: https://svnweb.freebsd.org/changeset/base/281838 Log: For igb(4), when we are doing multiqueue, we are all setup to have full 32bit RSS hash from the card. We do not need to hide that under "ifdef RSS" and should expose that by default so others like lagg(4) can use that and avoid hashing the traffic by themselves. While here, improve comments and get rid of hidden/unimplemented RSS support code for UDP. Differential Revision:https://reviews.freebsd.org/D2296 Reviewed by: jfv, erj Discussed with: adrian Sponsored by: Limelight Networks Modified: head/sys/dev/e1000/if_igb.c Modified: head/sys/dev/e1000/if_igb.c == --- head/sys/dev/e1000/if_igb.c Tue Apr 21 19:33:30 2015(r281837) +++ head/sys/dev/e1000/if_igb.c Tue Apr 21 20:24:15 2015(r281838) @@ -4630,8 +4630,11 @@ igb_initialise_rss_mapping(struct adapte /* Now fill in hash table */ - /* XXX This means RSS enable + 8 queues for my igb (82580.) */ - mrqc = E1000_MRQC_ENABLE_RSS_4Q; + /* +* MRQC: Multiple Receive Queues Command +* Set queuing to RSS control, number depends on the device. +*/ + mrqc = E1000_MRQC_ENABLE_RSS_8Q; #ifdef RSS /* XXX ew typecasting */ @@ -5139,45 +5142,51 @@ igb_rxeof(struct igb_queue *que, int cou rxr->fmp->m_pkthdr.ether_vtag = vtag; rxr->fmp->m_flags |= M_VLANTAG; } -#ifdef RSS - /* XXX set flowtype once this works right */ - rxr->fmp->m_pkthdr.flowid = - le32toh(cur->wb.lower.hi_dword.rss); - switch (pkt_info & E1000_RXDADV_RSSTYPE_MASK) { - case E1000_RXDADV_RSSTYPE_IPV4_TCP: - M_HASHTYPE_SET(rxr->fmp, M_HASHTYPE_RSS_TCP_IPV4); - break; - case E1000_RXDADV_RSSTYPE_IPV4: - M_HASHTYPE_SET(rxr->fmp, M_HASHTYPE_RSS_IPV4); - break; - case E1000_RXDADV_RSSTYPE_IPV6_TCP: - M_HASHTYPE_SET(rxr->fmp, M_HASHTYPE_RSS_TCP_IPV6); - break; - case E1000_RXDADV_RSSTYPE_IPV6_EX: - M_HASHTYPE_SET(rxr->fmp, M_HASHTYPE_RSS_IPV6_EX); - break; - case E1000_RXDADV_RSSTYPE_IPV6: - M_HASHTYPE_SET(rxr->fmp, M_HASHTYPE_RSS_IPV6); - break; - case E1000_RXDADV_RSSTYPE_IPV6_TCP_EX: - M_HASHTYPE_SET(rxr->fmp, M_HASHTYPE_RSS_TCP_IPV6_EX); - break; - - /* XXX no UDP support in RSS just yet */ -#ifdef notyet - case E1000_RXDADV_RSSTYPE_IPV4_UDP: - case E1000_RXDADV_RSSTYPE_IPV6_UDP: - case E1000_RXDADV_RSSTYPE_IPV6_UDP_EX: -#endif - - default: - /* XXX fallthrough */ + + /* +* In case of multiqueue, we have RXCSUM.PCSD bit set +* and never cleared. This means we have RSS hash +* available to be used. +*/ + if (adapter->num_queues > 1) { + rxr->fmp->m_pkthdr.flowid = + le32toh(cur->wb.lower.hi_dword.rss); + switch (pkt_info & E1000_RXDADV_RSSTYPE_MASK) { + case E1000_RXDADV_RSSTYPE_IPV4_TCP: + M_HASHTYPE_SET(rxr->fmp, + M_HASHTYPE_RSS_TCP_IPV4); + break; + case E1000_RXDADV_RSSTYPE_IPV4: + M_HASHTYPE_SET(rxr->fmp, + M_HASHTYPE_RSS_IPV4); + break; + case E1000_RXDADV_RSSTYPE_IPV6_TCP: + M_HASHTYPE_SET(rxr->fmp, + M_HASHTYPE_RSS_TCP_IPV6); + break; + case E1000_RXDADV_RSSTYPE_IPV6_EX: + M_HASHTYPE_SET(rxr->fmp, + M_HASHTYPE_RSS_IPV6_EX); + break; +
svn commit: r281836 - stable/10
Author: garga (ports committer) Date: Tue Apr 21 17:02:55 2015 New Revision: 281836 URL: https://svnweb.freebsd.org/changeset/base/281836 Log: MFC r270155, r274490, r274593, r274607 Add native-xtools target to stable/10 Differential Revision:https://reviews.freebsd.org/D2044 Reviewed by: sbruno@ Approved by: sbruno@ Sponsored by: Netgate Modified: stable/10/Makefile stable/10/Makefile.inc1 Directory Properties: stable/10/ (props changed) Modified: stable/10/Makefile == --- stable/10/Makefile Tue Apr 21 16:54:21 2015(r281835) +++ stable/10/Makefile Tue Apr 21 17:02:55 2015(r281836) @@ -36,6 +36,8 @@ # specified with XDEV and XDEV_ARCH. # xdev-build - Build cross-development tools. # xdev-install- Install cross-development tools. +# native-xtools - Create host binaries that produce target objects +# for use in qemu user-mode jails. # # "quick" way to test all kernel builds: # _jflag=`sysctl -n hw.ncpu` @@ -110,6 +112,7 @@ TGTS= all all-man buildenv buildenvvars _worldtmp _legacy _bootstrap-tools _cleanobj _obj \ _build-tools _cross-tools _includes _libraries _depend \ build32 builddtb distribute32 install32 xdev xdev-build xdev-install \ + native-xtools \ TGTS+= ${SUBDIR_TARGETS} Modified: stable/10/Makefile.inc1 == --- stable/10/Makefile.inc1 Tue Apr 21 16:54:21 2015(r281835) +++ stable/10/Makefile.inc1 Tue Apr 21 17:02:55 2015(r281836) @@ -1493,6 +1493,94 @@ cross-tools: .MAKE ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install .endfor +NXBENV=MAKEOBJDIRPREFIX=${OBJTREE}/nxb \ + INSTALL="sh ${.CURDIR}/tools/install.sh" \ + VERSION="${VERSION}" +NXBMAKE= ${NXBENV} ${MAKE} \ + TBLGEN=${OBJTREE}/nxb-bin/usr/bin/tblgen \ + CLANG_TBLGEN=${OBJTREE}/nxb-bin/usr/bin/clang-tblgen \ + MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} \ + -DWITHOUT_GDB -DNO_TESTS \ + SSP_CFLAGS= \ + -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \ + -DNO_PIC -DNO_PROFILE -DNO_SHARED \ + -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF \ + -DWITHOUT_CLANG_FULL -DWITHOUT_LLDB + +native-xtools: .MAKE + mkdir -p ${OBJTREE}/nxb-bin/bin + mkdir -p ${OBJTREE}/nxb-bin/sbin + mkdir -p ${OBJTREE}/nxb-bin/usr + mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ + -p ${OBJTREE}/nxb-bin/usr >/dev/null + mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ + -p ${OBJTREE}/nxb-bin/usr/include >/dev/null +.for _tool in \ +bin/cat \ +bin/chmod \ +bin/cp \ +bin/csh \ +bin/echo \ +bin/expr \ +bin/hostname \ +bin/ln \ +bin/ls \ +bin/mkdir \ +bin/mv \ +bin/ps \ +bin/realpath \ +bin/rm \ +bin/rmdir \ +bin/sh \ +bin/sleep \ +${_clang_tblgen} \ +usr.bin/ar \ +${_binutils} \ +${_cc} \ +${_gcc_tools} \ +${_clang_libs} \ +${_clang} \ +sbin/md5 \ +sbin/sysctl \ +gnu/usr.bin/diff \ +usr.bin/awk \ +usr.bin/basename \ +usr.bin/bmake \ +usr.bin/bzip2 \ +usr.bin/cmp \ +usr.bin/dirname \ +usr.bin/env \ +usr.bin/fetch \ +usr.bin/find \ +usr.bin/grep \ +usr.bin/gzip \ +usr.bin/id \ +usr.bin/lex \ +usr.bin/lorder \ +usr.bin/mktemp \ +usr.bin/mt \ +usr.bin/patch \ +usr.bin/sed \ +usr.bin/sort \ +usr.bin/tar \ +usr.bin/touch \ +usr.bin/tr \ +usr.bin/true \ +usr.bin/uniq \ +usr.bin/unzip \ +usr.bin/xargs \ +usr.bin/xinstall \ +usr.bin/xz \ +usr.bin/yacc \ +usr.sbin/chown + ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ + cd ${.CURDIR}/${_tool} && \ + ${NXBMAKE} DIRPRFX=${_tool}/ obj && \ + ${NXBMAKE} DIRPRFX=${_tool}/ depend && \ + ${NXBMAKE} DIRPRFX=${_tool}/ all && \ + ${NXBMAKE} DIRPRFX=${_tool}/ DESTDIR=${OBJTREE}/nxb-bin install +.endfor + # # hierarchy - ensure that all the needed directories are present # ___ 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: r281835 - in stable: 10/release/doc/share/xml 8/release/doc/share/xml 9/release/doc/share/xml
Author: gjb Date: Tue Apr 21 16:54:21 2015 New Revision: 281835 URL: https://svnweb.freebsd.org/changeset/base/281835 Log: Document SA-15:07, SA-15:08, SA-15:09. Sponsored by: The FreeBSD Foundation Modified: stable/9/release/doc/share/xml/security.xml Changes in other areas also in this revision: Modified: stable/10/release/doc/share/xml/security.xml stable/8/release/doc/share/xml/security.xml Modified: stable/9/release/doc/share/xml/security.xml == --- stable/9/release/doc/share/xml/security.xml Tue Apr 21 15:47:00 2015 (r281834) +++ stable/9/release/doc/share/xml/security.xml Tue Apr 21 16:54:21 2015 (r281835) @@ -133,6 +133,21 @@ 19 March 2015 Multiple vulnerabilities + + + FreeBSD-SA-15:07.ntp + 7 April 2015 + Multiple vulnerabilities + + + + FreeBSD-SA-15:09.ipv6 + 7 April 2015 + Router advertisement Denial of + Service + ___ 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: r281835 - in stable: 10/release/doc/share/xml 8/release/doc/share/xml 9/release/doc/share/xml
Author: gjb Date: Tue Apr 21 16:54:21 2015 New Revision: 281835 URL: https://svnweb.freebsd.org/changeset/base/281835 Log: Document SA-15:07, SA-15:08, SA-15:09. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/doc/share/xml/security.xml Changes in other areas also in this revision: Modified: stable/8/release/doc/share/xml/security.xml stable/9/release/doc/share/xml/security.xml Modified: stable/10/release/doc/share/xml/security.xml == --- stable/10/release/doc/share/xml/security.xmlTue Apr 21 15:47:00 2015(r281834) +++ stable/10/release/doc/share/xml/security.xmlTue Apr 21 16:54:21 2015(r281835) @@ -86,6 +86,29 @@ 19 March 2015 Multiple vulnerabilities + + + FreeBSD-SA-15:07.ntp + 7 April 2015 + Multiple vulnerabilities + + + + FreeBSD-SA-15:08.bsdinstall + 7 April 2015 + Insecure default GELI key file + permissions + + + + FreeBSD-SA-15:09.ipv6 + 7 April 2015 + Router advertisement Denial of + Service + ___ 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: r281835 - in stable: 10/release/doc/share/xml 8/release/doc/share/xml 9/release/doc/share/xml
Author: gjb Date: Tue Apr 21 16:54:21 2015 New Revision: 281835 URL: https://svnweb.freebsd.org/changeset/base/281835 Log: Document SA-15:07, SA-15:08, SA-15:09. Sponsored by: The FreeBSD Foundation Modified: stable/8/release/doc/share/xml/security.xml Changes in other areas also in this revision: Modified: stable/10/release/doc/share/xml/security.xml stable/9/release/doc/share/xml/security.xml Modified: stable/8/release/doc/share/xml/security.xml == --- stable/8/release/doc/share/xml/security.xml Tue Apr 21 15:47:00 2015 (r281834) +++ stable/8/release/doc/share/xml/security.xml Tue Apr 21 16:54:21 2015 (r281835) @@ -238,6 +238,21 @@ 19 March 2015 Multiple vulnerabilities + + + FreeBSD-SA-15:07.ntp + 7 April 2015 + Multiple vulnerabilities + + + + FreeBSD-SA-15:09.ipv6 + 7 April 2015 + Router advertisement Denial of + Service + ___ 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: r281834 - stable/10/usr.bin/sort
Author: garga (ports committer) Date: Tue Apr 21 15:47:00 2015 New Revision: 281834 URL: https://svnweb.freebsd.org/changeset/base/281834 Log: Replace LDFLAGS by LDADD to fix sort build with -DNO_SHARED Differential Revision:https://reviews.freebsd.org/D2044 Reviewed by: sbruno@ Approved by: sbruno@ Sponsored by: Netgate Modified: stable/10/usr.bin/sort/Makefile Modified: stable/10/usr.bin/sort/Makefile == --- stable/10/usr.bin/sort/Makefile Tue Apr 21 15:00:49 2015 (r281833) +++ stable/10/usr.bin/sort/Makefile Tue Apr 21 15:47:00 2015 (r281834) @@ -13,10 +13,10 @@ CLEANFILES+= sort.1 .if defined(WITH_THREADS) CFLAGS+= -DSORT_THREADS -LDFLAGS+= -lpthread -lmd +LDADD+= -lpthread -lmd MAN_SUB+= -e 's|%%THREADS%%||g' .else -LDFLAGS+= -lmd +LDADD+= -lmd MAN_SUB+= -e 's|%%THREADS%%|\.\\"|g' .endif ___ 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: r281833 - stable/8/share/man/man3
Author: brooks Date: Tue Apr 21 15:00:49 2015 New Revision: 281833 URL: https://svnweb.freebsd.org/changeset/base/281833 Log: MFC r281605,281768: r281605: Fix a minor function definition inconsistancy. r281768: Bump doc date missed in r281605. Modified: stable/8/share/man/man3/queue.3 Directory Properties: stable/8/share/man/man3/ (props changed) Modified: stable/8/share/man/man3/queue.3 == --- stable/8/share/man/man3/queue.3 Tue Apr 21 14:48:38 2015 (r281832) +++ stable/8/share/man/man3/queue.3 Tue Apr 21 15:00:49 2015 (r281833) @@ -32,7 +32,7 @@ .\"@(#)queue.3 8.2 (Berkeley) 1/24/94 .\" $FreeBSD$ .\" -.Dd June 17, 2013 +.Dd April 16, 2015 .Dt QUEUE 3 .Os .Sh NAME @@ -150,7 +150,7 @@ lists and tail queues .Fn STAILQ_INSERT_AFTER "STAILQ_HEAD *head" "TYPE *listelm" "TYPE *elm" "STAILQ_ENTRY NAME" .Fn STAILQ_INSERT_HEAD "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME" .Fn STAILQ_INSERT_TAIL "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME" -.Fn STAILQ_LAST "STAILQ_HEAD *head" "TYPE" "STAILQ_ENTRY NAME" +.Fn STAILQ_LAST "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME" .Fn STAILQ_NEXT "TYPE *elm" "STAILQ_ENTRY NAME" .Fn STAILQ_REMOVE_AFTER "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME" .Fn STAILQ_REMOVE_HEAD "STAILQ_HEAD *head" "STAILQ_ENTRY NAME" ___ 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: r281831 - stable/9/share/man/man3
Author: brooks Date: Tue Apr 21 14:48:18 2015 New Revision: 281831 URL: https://svnweb.freebsd.org/changeset/base/281831 Log: MFC r281605,281768: r281605: Fix a minor function definition inconsistancy. r281768: Bump doc date missed in r281605. Modified: stable/9/share/man/man3/queue.3 Directory Properties: stable/9/share/man/man3/ (props changed) Modified: stable/9/share/man/man3/queue.3 == --- stable/9/share/man/man3/queue.3 Tue Apr 21 14:22:45 2015 (r281830) +++ stable/9/share/man/man3/queue.3 Tue Apr 21 14:48:18 2015 (r281831) @@ -32,7 +32,7 @@ .\"@(#)queue.3 8.2 (Berkeley) 1/24/94 .\" $FreeBSD$ .\" -.Dd June 17, 2013 +.Dd April 16, 2015 .Dt QUEUE 3 .Os .Sh NAME @@ -151,7 +151,7 @@ lists and tail queues .Fn STAILQ_INSERT_AFTER "STAILQ_HEAD *head" "TYPE *listelm" "TYPE *elm" "STAILQ_ENTRY NAME" .Fn STAILQ_INSERT_HEAD "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME" .Fn STAILQ_INSERT_TAIL "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME" -.Fn STAILQ_LAST "STAILQ_HEAD *head" "TYPE" "STAILQ_ENTRY NAME" +.Fn STAILQ_LAST "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME" .Fn STAILQ_NEXT "TYPE *elm" "STAILQ_ENTRY NAME" .Fn STAILQ_REMOVE_AFTER "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME" .Fn STAILQ_REMOVE_HEAD "STAILQ_HEAD *head" "STAILQ_ENTRY NAME" ___ 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: r281832 - head/release/tools
Author: gjb Date: Tue Apr 21 14:48:38 2015 New Revision: 281832 URL: https://svnweb.freebsd.org/changeset/base/281832 Log: Revert r281809, which did more harm than good, and apply a more proper fix when attempting to locate the /boot files. Sponsored by: The FreeBSD Foundation Modified: head/release/tools/vmimage.subr Modified: head/release/tools/vmimage.subr == --- head/release/tools/vmimage.subr Tue Apr 21 14:48:18 2015 (r281831) +++ head/release/tools/vmimage.subr Tue Apr 21 14:48:38 2015 (r281832) @@ -14,11 +14,11 @@ write_partition_layout() { SWAPOPT="-p freebsd-swap/swapfs::1G" fi - _OBJDIR="$(make -C ${WORLDDIR} -V .OBJDIR | tr -d '/usr/src')" - if [ -d "${_OBJDIR}/${TARGET}.${TARGET_ARCH}" ]; then - BOOTFILES="${_OBJDIR}/${TARGET}.${TARGET_ARCH}/usr/src/sys/boot" + _OBJDIR="$(make -C ${WORLDDIR} -V .OBJDIR)" + if [ -d "${_OBJDIR%%/usr/src}/${TARGET}.${TARGET_ARCH}" ]; then + BOOTFILES="/${_OBJDIR%%/usr/src}/${TARGET}.${TARGET_ARCH}/usr/src/sys/boot" else - BOOTFILES="${_OBJDIR}/usr/src/sys/boot" + BOOTFILES="/${_OBJDIR}/sys/boot" fi case "${TARGET}:${TARGET_ARCH}" in ___ 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: r281830 - stable/10/share/man/man3
Author: brooks Date: Tue Apr 21 14:22:45 2015 New Revision: 281830 URL: https://svnweb.freebsd.org/changeset/base/281830 Log: MFC r281605,281768: r281605: Fix a minor function definition inconsistancy. r281768: Bump doc date missed in r281605. Modified: stable/10/share/man/man3/queue.3 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man3/queue.3 == --- stable/10/share/man/man3/queue.3Tue Apr 21 13:55:24 2015 (r281829) +++ stable/10/share/man/man3/queue.3Tue Apr 21 14:22:45 2015 (r281830) @@ -32,7 +32,7 @@ .\"@(#)queue.3 8.2 (Berkeley) 1/24/94 .\" $FreeBSD$ .\" -.Dd June 17, 2013 +.Dd April 16, 2015 .Dt QUEUE 3 .Os .Sh NAME @@ -151,7 +151,7 @@ lists and tail queues .Fn STAILQ_INSERT_AFTER "STAILQ_HEAD *head" "TYPE *listelm" "TYPE *elm" "STAILQ_ENTRY NAME" .Fn STAILQ_INSERT_HEAD "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME" .Fn STAILQ_INSERT_TAIL "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME" -.Fn STAILQ_LAST "STAILQ_HEAD *head" "TYPE" "STAILQ_ENTRY NAME" +.Fn STAILQ_LAST "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME" .Fn STAILQ_NEXT "TYPE *elm" "STAILQ_ENTRY NAME" .Fn STAILQ_REMOVE_AFTER "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME" .Fn STAILQ_REMOVE_HEAD "STAILQ_HEAD *head" "STAILQ_ENTRY NAME" ___ 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: r281829 - in head/sys: compat/linux kern sys
Author: trasz Date: Tue Apr 21 13:55:24 2015 New Revision: 281829 URL: https://svnweb.freebsd.org/changeset/base/281829 Log: Modify kern___getcwd() to take max pathlen limit as an additional argument. This will be used for the Linux emulation layer - for Linux, PATH_MAX is 4096 and not 1024. Differential Revision:https://reviews.freebsd.org/D2335 Reviewed by: kib@ MFC after:1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/compat/linux/linux_getcwd.c head/sys/compat/linux/linux_misc.h head/sys/kern/vfs_cache.c head/sys/sys/syscallsubr.h Modified: head/sys/compat/linux/linux_getcwd.c == --- head/sys/compat/linux/linux_getcwd.cTue Apr 21 11:50:31 2015 (r281828) +++ head/sys/compat/linux/linux_getcwd.cTue Apr 21 13:55:24 2015 (r281829) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include #endif +#include #include #include @@ -423,14 +424,14 @@ linux_getcwd(struct thread *td, struct l len = args->bufsize; - if (len > MAXPATHLEN*4) - len = MAXPATHLEN*4; + if (len > LINUX_PATH_MAX) + len = LINUX_PATH_MAX; else if (len < 2) return ERANGE; path = malloc(len, M_TEMP, M_WAITOK); - error = kern___getcwd(td, path, UIO_SYSSPACE, len); + error = kern___getcwd(td, path, UIO_SYSSPACE, len, LINUX_PATH_MAX); if (!error) { lenused = strlen(path) + 1; if (lenused <= args->bufsize) { Modified: head/sys/compat/linux/linux_misc.h == --- head/sys/compat/linux/linux_misc.h Tue Apr 21 11:50:31 2015 (r281828) +++ head/sys/compat/linux/linux_misc.h Tue Apr 21 13:55:24 2015 (r281829) @@ -55,6 +55,8 @@ #defineLINUX_MREMAP_MAYMOVE1 #defineLINUX_MREMAP_FIXED 2 +#defineLINUX_PATH_MAX 4096 + extern const char *linux_platform; /* Modified: head/sys/kern/vfs_cache.c == --- head/sys/kern/vfs_cache.c Tue Apr 21 11:50:31 2015(r281828) +++ head/sys/kern/vfs_cache.c Tue Apr 21 13:55:24 2015(r281829) @@ -1053,11 +1053,13 @@ sys___getcwd(td, uap) struct __getcwd_args *uap; { - return (kern___getcwd(td, uap->buf, UIO_USERSPACE, uap->buflen)); + return (kern___getcwd(td, uap->buf, UIO_USERSPACE, uap->buflen, + MAXPATHLEN)); } int -kern___getcwd(struct thread *td, char *buf, enum uio_seg bufseg, u_int buflen) +kern___getcwd(struct thread *td, char *buf, enum uio_seg bufseg, u_int buflen, +u_int path_max) { char *bp, *tmpbuf; struct filedesc *fdp; @@ -1068,8 +1070,8 @@ kern___getcwd(struct thread *td, char *b return (ENODEV); if (buflen < 2) return (EINVAL); - if (buflen > MAXPATHLEN) - buflen = MAXPATHLEN; + if (buflen > path_max) + buflen = path_max; tmpbuf = malloc(buflen, M_TEMP, M_WAITOK); fdp = td->td_proc->p_fd; Modified: head/sys/sys/syscallsubr.h == --- head/sys/sys/syscallsubr.h Tue Apr 21 11:50:31 2015(r281828) +++ head/sys/sys/syscallsubr.h Tue Apr 21 13:55:24 2015(r281829) @@ -58,7 +58,7 @@ struct thr_param; struct __wrusage; intkern___getcwd(struct thread *td, char *buf, enum uio_seg bufseg, - u_int buflen); + u_int buflen, u_int path_max); intkern_accept(struct thread *td, int s, struct sockaddr **name, socklen_t *namelen, struct file **fp); intkern_accept4(struct thread *td, int s, struct sockaddr **name, ___ 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: r281721 - head/sys/sys
On Tue, 21 Apr 2015, Konstantin Belousov wrote: On Tue, Apr 21, 2015 at 07:32:30PM +1000, Bruce Evans wrote: On Tue, 21 Apr 2015, David Chisnall wrote: On 20 Apr 2015, at 17:19, Bruce Evans wrote: Enums should never be used in ABIs, since their size can be anything large enough. The rules for the size of enums also differ between C and C++, though clang (and, I think, gcc) support an attribute for specifying the enum type. They also cause namespace problems. The whole enum declaration must be exposed in any header that uses an enum type. Both C and C++ permit forward declarations of enums for use in function prototypes and so on, e.g.: enum foo; void bar(enum foo); No, they cannot do this since the size may depend on the internals of the enum: TendDRA-5.0.0: "z.c", line 1: Error: [ISO C90 6.5.2.3]: Can't declare the enumeration 'enum foo'. This is not true for C. The i386 ABI specification, from year _1997_, states that enum must be 4-bytes unsigned entity, 4-bytes aligned. See page 28 of abi386-4.pdf. That is only the i386 implementation of C. Good enough for ABI portability. Is it really so broken as to specify unsigned? enum values have type int, so unsigned cannot represent all of them. Unrepresentable enums are detected in all compilers I tested, but the error handling is broken except in gcc: clang-current: z.c:1:29: warning: overflow in enumeration value enum foo { xx = 0x7fff, yy }; ^ 1 warning generated. gcc4.2.1: z.c:1: error: overflow in enumeration values TenDRA-5.0.0: trans:/tmp/tccljzRYO/_tcc.t: internal error: constant out of range TendDRA also suffers from the C90 design error of not allowing a comma after yy. It detects this and handles it perfectly brokenly to C90 spec: "z.c", line 1: Error: [Syntax]: Extra comma at end of list. 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: r281828 - head/sys/dev/iicbus
Author: jah Date: Tue Apr 21 11:50:31 2015 New Revision: 281828 URL: https://svnweb.freebsd.org/changeset/base/281828 Log: Fix numerous issues in iic(4) and iicbus(4): --Allow multiple open iic fds by storing addressing state in cdevpriv --Fix, as much as possible, the baked-in race conditions in the iic ioctl interface by requesting bus ownership on I2CSTART, releasing it on I2CSTOP/I2CRSTCARD, and requiring bus ownership by the current cdevpriv to use the I/O ioctls --Reduce internal iic buffer size and remove 1K read/write limit by iteratively calling iicbus_read/iicbus_write --Eliminate dynamic allocation in I2CWRITE/I2CREAD --Move handling of I2CRDWR to separate function and improve error handling --Add new I2CSADDR ioctl to store address in current cdevpriv so that I2CSTART is not needed for read(2)/write(2) to work --Redesign iicbus_request_bus() and iicbus_release_bus(): --iicbus_request_bus() no longer falls through if the bus is already owned by the requesting device. Multiple threads on the same device may want exclusive access. Also, iicbus_release_bus() was never device-recursive anyway. --Previously, if IICBUS_CALLBACK failed in iicbus_release_bus(), but the following iicbus_poll() call succeeded, IICBUS_CALLBACK would not be issued again --Do not hold iicbus mtx during IICBUS_CALLBACK call. There are several drivers that may sleep in IICBUS_CALLBACK, if IIC_WAIT is passed. --Do not loop in iicbus_request_bus if IICBUS_CALLBACK returns EWOULDBLOCK; instead pass that to the caller so that it can retry if so desired. Differential Revision:https://reviews.freebsd.org/D2140 Reviewed by: imp, jhb, loos Approved by: kib (mentor) Modified: head/sys/dev/iicbus/iic.c head/sys/dev/iicbus/iic.h head/sys/dev/iicbus/iicbus_if.m head/sys/dev/iicbus/iiconf.c Modified: head/sys/dev/iicbus/iic.c == --- head/sys/dev/iicbus/iic.c Tue Apr 21 11:29:07 2015(r281827) +++ head/sys/dev/iicbus/iic.c Tue Apr 21 11:50:31 2015(r281828) @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -44,28 +45,32 @@ #include "iicbus_if.h" -#define BUFSIZE 1024 - struct iic_softc { - device_t sc_dev; - u_char sc_addr; /* 7 bit address on iicbus */ - int sc_count; /* >0 if device opened */ - - char sc_buffer[BUFSIZE];/* output buffer */ - char sc_inbuf[BUFSIZE]; /* input buffer */ - struct cdev *sc_devnode; - struct sx sc_lock; }; -#defineIIC_LOCK(sc)sx_xlock(&(sc)->sc_lock) -#defineIIC_UNLOCK(sc) sx_xunlock(&(sc)->sc_lock) +struct iic_cdevpriv { + struct sx lock; + struct iic_softc *sc; + bool started; + uint8_t addr; +}; + + +#defineIIC_LOCK(cdp) sx_xlock(&(cdp)->lock) +#defineIIC_UNLOCK(cdp) sx_xunlock(&(cdp)->lock) + +static MALLOC_DEFINE(M_IIC, "iic", "I2C device data"); static int iic_probe(device_t); static int iic_attach(device_t); static int iic_detach(device_t); static void iic_identify(driver_t *driver, device_t parent); +static void iicdtor(void *data); +static int iicuio_move(struct iic_cdevpriv *priv, struct uio *uio, int last); +static int iicuio(struct cdev *dev, struct uio *uio, int ioflag); +static int iicrdwr(struct iic_cdevpriv *priv, struct iic_rdwr_data *d, int flags); static devclass_t iic_devclass; @@ -89,18 +94,13 @@ static driver_t iic_driver = { }; static d_open_tiicopen; -static d_close_t iicclose; -static d_write_t iicwrite; -static d_read_tiicread; static d_ioctl_t iicioctl; static struct cdevsw iic_cdevsw = { .d_version =D_VERSION, - .d_flags = D_TRACKCLOSE, .d_open = iicopen, - .d_close = iicclose, - .d_read = iicread, - .d_write = iicwrite, + .d_read = iicuio, + .d_write = iicuio, .d_ioctl = iicioctl, .d_name = "iic", }; @@ -127,16 +127,15 @@ iic_probe(device_t dev) static int iic_attach(device_t dev) { - struct iic_softc *sc = (struct iic_softc *)device_get_softc(dev); + struct iic_softc *sc; + sc = device_get_softc(dev); sc->sc_dev = dev; - sx_init(&sc->sc_lock, "iic"); sc->sc_devnode = make_dev(&iic_cdevsw, device_get_unit(dev), UID_ROOT, GID_WHEEL, 0600, "iic%d", device_get_unit(dev)); if (sc->sc_devnode == NULL) { device_printf(dev, "failed to create character device\n"); - sx_destroy(&sc->sc_lock); return (ENXIO); } sc->sc_devnode->si_drv1 = sc; @@ -147,11 +146,12 @@ iic_attach(device_t dev) static int iic_d
svn commit: r281827 - in stable/9/sys/dev: aac aacraid advansys aha ahb amr buslogic bwi bwn ciss ct dpt ida if_ndis iir mlx mly trm twe
Author: mav Date: Tue Apr 21 11:29:07 2015 New Revision: 281827 URL: https://svnweb.freebsd.org/changeset/base/281827 Log: MFC r280347: Remove MAXBSIZE use from drivers where it has nothing to do. In some cases limits are just not needed, in others -- DFLTPHYS is the right constant to use instead. Modified: stable/9/sys/dev/aac/aac.c stable/9/sys/dev/aacraid/aacraid.c stable/9/sys/dev/advansys/adwcam.c stable/9/sys/dev/aha/aha.c stable/9/sys/dev/ahb/ahb.c stable/9/sys/dev/amr/amr_pci.c stable/9/sys/dev/buslogic/bt.c stable/9/sys/dev/bwi/if_bwi.c stable/9/sys/dev/bwn/if_bwn.c stable/9/sys/dev/ciss/ciss.c stable/9/sys/dev/ct/ct_isa.c stable/9/sys/dev/dpt/dpt_scsi.c stable/9/sys/dev/ida/ida.c stable/9/sys/dev/ida/ida_eisa.c stable/9/sys/dev/ida/ida_pci.c stable/9/sys/dev/if_ndis/if_ndis_pci.c stable/9/sys/dev/iir/iir.c stable/9/sys/dev/iir/iir_pci.c stable/9/sys/dev/mlx/mlx.c stable/9/sys/dev/mlx/mlx_pci.c stable/9/sys/dev/mly/mly.c stable/9/sys/dev/trm/trm.c stable/9/sys/dev/twe/twe.c stable/9/sys/dev/twe/twe_freebsd.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/aac/aac.c == --- stable/9/sys/dev/aac/aac.c Tue Apr 21 11:27:50 2015(r281826) +++ stable/9/sys/dev/aac/aac.c Tue Apr 21 11:29:07 2015(r281827) @@ -507,9 +507,9 @@ aac_alloc(struct aac_softc *sc) BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - MAXBSIZE,/* maxsize */ + sc->aac_max_sectors << 9, /* maxsize */ sc->aac_sg_tablesize,/* nsegments */ - MAXBSIZE,/* maxsegsize */ + BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ BUS_DMA_ALLOCNOW,/* flags */ busdma_lock_mutex, /* lockfunc */ &sc->aac_io_lock,/* lockfuncarg */ Modified: stable/9/sys/dev/aacraid/aacraid.c == --- stable/9/sys/dev/aacraid/aacraid.c Tue Apr 21 11:27:50 2015 (r281826) +++ stable/9/sys/dev/aacraid/aacraid.c Tue Apr 21 11:29:07 2015 (r281827) @@ -597,9 +597,9 @@ aac_alloc(struct aac_softc *sc) BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - MAXBSIZE,/* maxsize */ + sc->aac_max_sectors << 9, /* maxsize */ sc->aac_sg_tablesize,/* nsegments */ - MAXBSIZE,/* maxsegsize */ + BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ BUS_DMA_ALLOCNOW,/* flags */ busdma_lock_mutex, /* lockfunc */ &sc->aac_io_lock,/* lockfuncarg */ Modified: stable/9/sys/dev/advansys/adwcam.c == --- stable/9/sys/dev/advansys/adwcam.c Tue Apr 21 11:27:50 2015 (r281826) +++ stable/9/sys/dev/advansys/adwcam.c Tue Apr 21 11:29:07 2015 (r281827) @@ -965,7 +965,7 @@ adw_init(struct adw_softc *adw) /* highaddr */ BUS_SPACE_MAXADDR, /* filter */ NULL, /* filterarg*/ NULL, - /* maxsize */ MAXBSIZE, + /* maxsize */ DFLTPHYS, /* nsegments*/ ADW_SGSIZE, /* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT, /* flags*/ BUS_DMA_ALLOCNOW, Modified: stable/9/sys/dev/aha/aha.c == --- stable/9/sys/dev/aha/aha.c Tue Apr 21 11:27:50 2015(r281826) +++ stable/9/sys/dev/aha/aha.c Tue Apr 21 11:29:07 2015(r281827) @@ -460,7 +460,7 @@ aha_init(struct aha_softc* aha) /* highaddr */ BUS_SPACE_MAXADDR, /* filter */ NULL, /* filterarg*/ NULL, - /* maxsize */ MAXBSIZE, + /* maxsize */ DFLTPHYS, /* nsegments*/ AHA_NSEG, /* maxsegsz */ BUS_SPACE
svn commit: r281826 - in stable/10/sys/dev: aac aacraid advansys aha ahb amr buslogic bwi bwn ciss ct dpt ida if_ndis iir mlx mly trm twe
Author: mav Date: Tue Apr 21 11:27:50 2015 New Revision: 281826 URL: https://svnweb.freebsd.org/changeset/base/281826 Log: MFC r280347: Remove MAXBSIZE use from drivers where it has nothing to do. In some cases limits are just not needed, in others -- DFLTPHYS is the right constant to use instead. Modified: stable/10/sys/dev/aac/aac.c stable/10/sys/dev/aacraid/aacraid.c stable/10/sys/dev/advansys/adwcam.c stable/10/sys/dev/aha/aha.c stable/10/sys/dev/ahb/ahb.c stable/10/sys/dev/amr/amr_pci.c stable/10/sys/dev/buslogic/bt.c stable/10/sys/dev/bwi/if_bwi.c stable/10/sys/dev/bwn/if_bwn.c stable/10/sys/dev/ciss/ciss.c stable/10/sys/dev/ct/ct_isa.c stable/10/sys/dev/dpt/dpt_scsi.c stable/10/sys/dev/ida/ida.c stable/10/sys/dev/ida/ida_eisa.c stable/10/sys/dev/ida/ida_pci.c stable/10/sys/dev/if_ndis/if_ndis_pci.c stable/10/sys/dev/iir/iir.c stable/10/sys/dev/iir/iir_pci.c stable/10/sys/dev/mlx/mlx.c stable/10/sys/dev/mlx/mlx_pci.c stable/10/sys/dev/mly/mly.c stable/10/sys/dev/trm/trm.c stable/10/sys/dev/twe/twe.c stable/10/sys/dev/twe/twe_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/aac/aac.c == --- stable/10/sys/dev/aac/aac.c Tue Apr 21 10:55:53 2015(r281825) +++ stable/10/sys/dev/aac/aac.c Tue Apr 21 11:27:50 2015(r281826) @@ -507,9 +507,9 @@ aac_alloc(struct aac_softc *sc) BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - MAXBSIZE,/* maxsize */ + sc->aac_max_sectors << 9, /* maxsize */ sc->aac_sg_tablesize,/* nsegments */ - MAXBSIZE,/* maxsegsize */ + BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ BUS_DMA_ALLOCNOW,/* flags */ busdma_lock_mutex, /* lockfunc */ &sc->aac_io_lock,/* lockfuncarg */ Modified: stable/10/sys/dev/aacraid/aacraid.c == --- stable/10/sys/dev/aacraid/aacraid.c Tue Apr 21 10:55:53 2015 (r281825) +++ stable/10/sys/dev/aacraid/aacraid.c Tue Apr 21 11:27:50 2015 (r281826) @@ -597,9 +597,9 @@ aac_alloc(struct aac_softc *sc) BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - MAXBSIZE,/* maxsize */ + sc->aac_max_sectors << 9, /* maxsize */ sc->aac_sg_tablesize,/* nsegments */ - MAXBSIZE,/* maxsegsize */ + BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ BUS_DMA_ALLOCNOW,/* flags */ busdma_lock_mutex, /* lockfunc */ &sc->aac_io_lock,/* lockfuncarg */ Modified: stable/10/sys/dev/advansys/adwcam.c == --- stable/10/sys/dev/advansys/adwcam.c Tue Apr 21 10:55:53 2015 (r281825) +++ stable/10/sys/dev/advansys/adwcam.c Tue Apr 21 11:27:50 2015 (r281826) @@ -965,7 +965,7 @@ adw_init(struct adw_softc *adw) /* highaddr */ BUS_SPACE_MAXADDR, /* filter */ NULL, /* filterarg*/ NULL, - /* maxsize */ MAXBSIZE, + /* maxsize */ DFLTPHYS, /* nsegments*/ ADW_SGSIZE, /* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT, /* flags*/ BUS_DMA_ALLOCNOW, Modified: stable/10/sys/dev/aha/aha.c == --- stable/10/sys/dev/aha/aha.c Tue Apr 21 10:55:53 2015(r281825) +++ stable/10/sys/dev/aha/aha.c Tue Apr 21 11:27:50 2015(r281826) @@ -460,7 +460,7 @@ aha_init(struct aha_softc* aha) /* highaddr */ BUS_SPACE_MAXADDR, /* filter */ NULL, /* filterarg*/ NULL, - /* maxsize */ MAXBSIZE, + /* maxsize */ DFLTPHYS, /* nsegments*/ AHA_NSEG, /* maxsegsz */ BUS_SPACE_MAXSIZE_24BIT,
svn commit: r281825 - head/sys/kern
Author: mav Date: Tue Apr 21 10:55:53 2015 New Revision: 281825 URL: https://svnweb.freebsd.org/changeset/base/281825 Log: Rewrite physio() to not allocate pbufs for unmapped I/O. pbufs is a limited resource, and their allocator is not SMP-scalable. So instead of always allocating pbuf to immediately convert it to bio, allocate bio just here. If buffer needs kernel mapping, then pbuf is still allocated, but used only as a source of KVA and storage for a list of held pages. On 40-core system doing many 512-byte reads from user level to array of raw SSDs this change removes huge lock congestion inside pbuf allocator. It improves peak performance from ~300K to ~1.2M IOPS. On my previous 24-core system this problem also existed, but was less serious. Reviewed by: kib MFC after:2 weeks Modified: head/sys/kern/kern_physio.c Modified: head/sys/kern/kern_physio.c == --- head/sys/kern/kern_physio.c Tue Apr 21 10:35:23 2015(r281824) +++ head/sys/kern/kern_physio.c Tue Apr 21 10:55:53 2015(r281825) @@ -25,27 +25,26 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include +#include #include +#include int physio(struct cdev *dev, struct uio *uio, int ioflag) { - struct buf *bp; - struct cdevsw *csw; + struct buf *pbuf; + struct bio *bp; + struct vm_page **pages; caddr_t sa; - u_int iolen; - int error, i, mapped; - - /* Keep the process UPAGES from being swapped. XXX: why ? */ - PHOLD(curproc); - - bp = getpbuf(NULL); - sa = bp->b_data; - error = 0; + u_int iolen, poff; + int error, i, npages, maxpages; + vm_prot_t prot; /* XXX: sanity check */ if(dev->si_iosize_max < PAGE_SIZE) { @@ -76,95 +75,128 @@ physio(struct cdev *dev, struct uio *uio uprintf("%s: request vectors=%d > 1; " "cannot split request\n", devtoname(dev), uio->uio_iovcnt); - - error = EFBIG; - goto doerror; + return (EFBIG); } + /* +* Keep the process UPAGES from being swapped. Processes swapped +* out while holding pbufs, used by swapper, may lead to deadlock. +*/ + PHOLD(curproc); + + bp = g_alloc_bio(); + if (uio->uio_segflg != UIO_USERSPACE) { + pbuf = NULL; + pages = NULL; + } else if ((dev->si_flags & SI_UNMAPPED) && unmapped_buf_allowed) { + pbuf = NULL; + maxpages = btoc(MIN(uio->uio_resid, MAXPHYS)) + 1; + pages = malloc(sizeof(*pages) * maxpages, M_DEVBUF, M_WAITOK); + } else { + pbuf = getpbuf(NULL); + sa = pbuf->b_data; + maxpages = btoc(MAXPHYS); + pages = pbuf->b_pages; + } + prot = VM_PROT_READ; + if (uio->uio_rw == UIO_READ) + prot |= VM_PROT_WRITE; /* Less backwards than it looks */ + error = 0; for (i = 0; i < uio->uio_iovcnt; i++) { while (uio->uio_iov[i].iov_len) { - bp->b_flags = 0; + bzero(bp, sizeof(*bp)); if (uio->uio_rw == UIO_READ) { - bp->b_iocmd = BIO_READ; + bp->bio_cmd = BIO_READ; curthread->td_ru.ru_inblock++; } else { - bp->b_iocmd = BIO_WRITE; + bp->bio_cmd = BIO_WRITE; curthread->td_ru.ru_oublock++; } - bp->b_iodone = bdone; - bp->b_data = uio->uio_iov[i].iov_base; - bp->b_bcount = uio->uio_iov[i].iov_len; - bp->b_offset = uio->uio_offset; - bp->b_iooffset = uio->uio_offset; - bp->b_saveaddr = sa; - - /* Don't exceed drivers iosize limit */ - if (bp->b_bcount > dev->si_iosize_max) - bp->b_bcount = dev->si_iosize_max; - - /* -* Make sure the pbuf can map the request -* XXX: The pbuf has kvasize = MAXPHYS so a request -* XXX: larger than MAXPHYS - PAGE_SIZE must be -* XXX: page aligned or it will be fragmented. + bp->bio_offset = uio->uio_offset; + bp->bio_data = uio->uio_iov[i].iov_base; + bp->bio_length = uio->uio_iov[i].iov_len; + if (bp->bio_length > dev->si_iosize_max) + bp->bio_length = dev->si_iosi
svn commit: r281824 - in head/sys: conf net
Author: glebius Date: Tue Apr 21 10:35:23 2015 New Revision: 281824 URL: https://svnweb.freebsd.org/changeset/base/281824 Log: Make IFMEDIA_DEBUG a kernel option. Sponsored by: Nginx, Inc. Modified: head/sys/conf/NOTES head/sys/conf/options head/sys/net/if_media.c Modified: head/sys/conf/NOTES == --- head/sys/conf/NOTES Tue Apr 21 10:17:25 2015(r281823) +++ head/sys/conf/NOTES Tue Apr 21 10:35:23 2015(r281824) @@ -2836,6 +2836,7 @@ options INIT_PATH=/sbin/init:/rescue/in optionsBUS_DEBUG # enable newbus debugging optionsDEBUG_VFS_LOCKS # enable VFS lock debugging optionsSOCKBUF_DEBUG # enable sockbuf last record/mb tail checking +optionsIFMEDIA_DEBUG # enable debugging in net/if_media.c # # Verbose SYSINIT Modified: head/sys/conf/options == --- head/sys/conf/options Tue Apr 21 10:17:25 2015(r281823) +++ head/sys/conf/options Tue Apr 21 10:35:23 2015(r281824) @@ -553,6 +553,7 @@ LPT_DEBUG opt_lpt.h PLIP_DEBUG opt_plip.h LOCKF_DEBUGopt_debug_lockf.h SI_DEBUG opt_debug_si.h +IFMEDIA_DEBUG opt_ifmedia.h # Fb options FB_DEBUG opt_fb.h Modified: head/sys/net/if_media.c == --- head/sys/net/if_media.c Tue Apr 21 10:17:25 2015(r281823) +++ head/sys/net/if_media.c Tue Apr 21 10:35:23 2015(r281824) @@ -46,6 +46,8 @@ * to implement this interface. */ +#include "opt_ifmedia.h" + #include #include #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: r281823 - head
Author: ngie Date: Tue Apr 21 10:17:25 2015 New Revision: 281823 URL: https://svnweb.freebsd.org/changeset/base/281823 Log: Serialize all of _kerberos5_bootstrap_tools to avoid build failures involving make bootstrap-tools On the plus side, this also greatly reduces complexity MFC after: 1 week Pointyhat to: ngie Reported by: Willem Jan Withagen Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Tue Apr 21 09:47:27 2015(r281822) +++ head/Makefile.inc1 Tue Apr 21 10:17:25 2015(r281823) @@ -1357,13 +1357,7 @@ _kerberos5_bootstrap_tools= \ kerberos5/tools/slc \ usr.bin/compile_et -${_bt}-kerberos5/lib/libroken: ${_bt}-kerberos5/tools/make-roken -${_bt}-kerberos5/tools/asn1_compile: \ -${_bt}-kerberos5/lib/libroken ${_bt}-kerberos5/lib/libvers -${_bt}-kerberos5/tools/slc: \ -${_bt}-kerberos5/lib/libroken ${_bt}-kerberos5/lib/libvers -${_bt}-usr.bin/compile_et: \ -${_bt}-kerberos5/lib/libroken ${_bt}-kerberos5/lib/libvers +.ORDER: ${_kerberos5_bootstrap_tools:C/^/${_bt}-/g} .endif bootstrap-tools: .PHONY ___ 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: r281721 - head/sys/sys
On Tue, Apr 21, 2015 at 07:32:30PM +1000, Bruce Evans wrote: > On Tue, 21 Apr 2015, David Chisnall wrote: > > > On 20 Apr 2015, at 17:19, Bruce Evans wrote: > >> > >> Enums should never be used in ABIs, since their size can be anything > >> large enough. > > > > The rules for the size of enums also differ between C and C++, though clang > > (and, I think, gcc) support an attribute for specifying the enum type. > > > >> They also cause namespace problems. The whole enum declaration must > >> be exposed in any header that uses an enum type. > > > > Both C and C++ permit forward declarations of enums for use in function > > prototypes and so on, e.g.: > > > > enum foo; > > void > > bar(enum foo); > > No, they cannot do this since the size may depend on the internals of the > enum: > > TendDRA-5.0.0: > "z.c", line 1: Error: >[ISO C90 6.5.2.3]: Can't declare the enumeration 'enum foo'. > This is not true for C. The i386 ABI specification, from year _1997_, states that enum must be 4-bytes unsigned entity, 4-bytes aligned. See page 28 of abi386-4.pdf. ___ 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: r281821 - head/sys/dev/mii
Author: glebius Date: Tue Apr 21 09:39:48 2015 New Revision: 281821 URL: https://svnweb.freebsd.org/changeset/base/281821 Log: Instead of storing mii_media_table array index in ifm_data, determine it in mii_phy_setmedia() functionally. Sponsored by: Nginx, Inc. Modified: head/sys/dev/mii/acphy.c head/sys/dev/mii/lxtphy.c head/sys/dev/mii/mii_physubr.c head/sys/dev/mii/miivar.h Modified: head/sys/dev/mii/acphy.c == --- head/sys/dev/mii/acphy.cTue Apr 21 09:11:28 2015(r281820) +++ head/sys/dev/mii/acphy.cTue Apr 21 09:39:48 2015(r281821) @@ -139,14 +139,12 @@ acphy_attach(device_t dev) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & sc->mii_capmask; device_printf(dev, " "); -#defineADD(m, c) ifmedia_add(&sc->mii_pdata->mii_media, (m), (c), NULL) +#defineADD(m) ifmedia_add(&sc->mii_pdata->mii_media, (m), 0, NULL) if ((PHY_READ(sc, MII_ACPHY_MCTL) & AC_MCTL_FX_SEL) != 0) { sc->mii_flags |= MIIF_HAVEFIBER; - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_FX, 0, sc->mii_inst), - MII_MEDIA_100_TX); + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_FX, 0, sc->mii_inst)); printf("100baseFX, "); - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_FX, IFM_FDX, sc->mii_inst), - MII_MEDIA_100_TX_FDX); + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_FX, IFM_FDX, sc->mii_inst)); printf("100baseFX-FDX, "); } #undef ADD Modified: head/sys/dev/mii/lxtphy.c == --- head/sys/dev/mii/lxtphy.c Tue Apr 21 09:11:28 2015(r281820) +++ head/sys/dev/mii/lxtphy.c Tue Apr 21 09:39:48 2015(r281821) @@ -142,12 +142,10 @@ lxtphy_attach(device_t dev) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & sc->mii_capmask; device_printf(dev, " "); -#defineADD(m, c) ifmedia_add(&sc->mii_pdata->mii_media, (m), (c), NULL) - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_FX, 0, sc->mii_inst), - MII_MEDIA_100_TX); +#defineADD(m) ifmedia_add(&sc->mii_pdata->mii_media, (m), 0, NULL) + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_FX, 0, sc->mii_inst)); printf("100baseFX, "); - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_FX, IFM_FDX, sc->mii_inst), - MII_MEDIA_100_TX_FDX); + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_FX, IFM_FDX, sc->mii_inst)); printf("100baseFX-FDX, "); #undef ADD Modified: head/sys/dev/mii/mii_physubr.c == --- head/sys/dev/mii/mii_physubr.c Tue Apr 21 09:11:28 2015 (r281820) +++ head/sys/dev/mii/mii_physubr.c Tue Apr 21 09:39:48 2015 (r281821) @@ -54,9 +54,28 @@ __FBSDID("$FreeBSD$"); #include "miibus_if.h" /* - * Media to register setting conversion table. Order matters. + * + * An array of structures to map MII media types to BMCR/ANAR settings. */ -static const struct mii_media mii_media_table[MII_NMEDIA] = { +enum { + MII_MEDIA_NONE = 0, + MII_MEDIA_10_T, + MII_MEDIA_10_T_FDX, + MII_MEDIA_100_T4, + MII_MEDIA_100_TX, + MII_MEDIA_100_TX_FDX, + MII_MEDIA_1000_X, + MII_MEDIA_1000_X_FDX, + MII_MEDIA_1000_T, + MII_MEDIA_1000_T_FDX, + MII_NMEDIA, +}; + +static const struct mii_media { + u_int mm_bmcr;/* BMCR settings for this media */ + u_int mm_anar;/* ANAR settings for this media */ + u_int mm_gtcr;/* 100base-T2 or 1000base-T CR */ +} mii_media_table[MII_NMEDIA] = { /* None */ { BMCR_ISO, ANAR_CSMA, 0, }, @@ -104,8 +123,10 @@ mii_phy_setmedia(struct mii_softc *sc) struct mii_data *mii = sc->mii_pdata; struct ifmedia_entry *ife = mii->mii_media.ifm_cur; int bmcr, anar, gtcr; + int index = -1; - if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) { + switch (IFM_SUBTYPE(ife->ifm_media)) { + case IFM_AUTO: /* * Force renegotiation if MIIF_DOPAUSE or MIIF_FORCEANEG. * The former is necessary as we might switch from flow- @@ -115,19 +136,78 @@ mii_phy_setmedia(struct mii_softc *sc) (sc->mii_flags & (MIIF_DOPAUSE | MIIF_FORCEANEG)) != 0) (void)mii_phy_auto(sc); return; + + case IFM_NONE: + index = MII_MEDIA_NONE; + break; + + case IFM_HPNA_1: + index = MII_MEDIA_10_T; + break; + + case IFM_10_T: + switch (IFM_OPTIONS(ife->ifm_media)) { + case 0: + index = MII_MEDIA_10_T; + break; + case IFM_FDX: + case (IFM_FDX |
Re: svn commit: r281721 - head/sys/sys
On Tue, 21 Apr 2015, David Chisnall wrote: On 20 Apr 2015, at 17:19, Bruce Evans wrote: Enums should never be used in ABIs, since their size can be anything large enough. The rules for the size of enums also differ between C and C++, though clang (and, I think, gcc) support an attribute for specifying the enum type. They also cause namespace problems. The whole enum declaration must be exposed in any header that uses an enum type. Both C and C++ permit forward declarations of enums for use in function prototypes and so on, e.g.: enum foo; void bar(enum foo); No, they cannot do this since the size may depend on the internals of the enum: TendDRA-5.0.0: "z.c", line 1: Error: [ISO C90 6.5.2.3]: Can't declare the enumeration 'enum foo'. gcc-4.2.1 -std=c99 -pedantic: z.c:1: warning: ISO C forbids forward references to 'enum' types z.c:3: warning: ISO C forbids forward references to 'enum' types clang-current -std==c99 -pedantic z.c:1:6: warning: ISO C forbids forward references to 'enum' types [-Wpedantic] g++-4.2.1: z.cc:1: error: use of enum `foo' without previous declaration clang++-current: z.cc:1:6: error: ISO C++ forbids forward references to 'enum' types It takes -pedantic to turn gcc-4.2.1 and clang-current into something resembling C99 compilers, but in gcc++-4.2.1 and clang++-current nothing is required and error is actually an error. gcc and clang are still far behind TenDRA in the quality of their diagnostics. I thought that forward declarations of enums were allowed too, until recently when their brokenness turned up in kernel builds. syscallsubr.h is broken, since it uses `enum idtype' without declaring it, except bogusly as a forward declaration as above. Only kern_wait6() and kern_procctl() use this enum. (syscallsubr.h also uses the older mistake `enum uio_seg', but it has the namespace pollution of including to get this instead of being broken by this. `enum uio seg' is under __BSD_VISIBLE, but it seems to be bogus to export it to userland since it is only useful in the kernel. struct uio is kernel-only. wait6(2) has somewhat different design errors. It spells `enum idtype' as idtype_t and also uses id_t. `enum idtype' is declared with wait6() in where it is not so polluting, but still needs anti-pollution ifdefs since only idtype_t is standard.) The bug in syscallsubr.h was detected as a side effect when I enabled -pedantic to check for other errors. enums are not used much in the kernel or syscalls, and they seem to mostly have complete declarations. The pollution problem would be larger if there were more of them. POSIX has excessive typedefs, but almost no enums, at least in old versions. In a 2001 draft, it has just 4 lines out of 209786 containing `enum', and a a few more containing `enumeration type'. Its only enum types are: /* For the bsearch family: */ enum { FIND, ENTER } ACTION; enum { preorder, postorder, endorder, leaf } VISIT; /* For wait6(): */ The type idtype_t shall be defined as an enumeration type whose possible values shall include ... 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: r281820 - head/usr.sbin/ctld
Author: trasz Date: Tue Apr 21 09:11:28 2015 New Revision: 281820 URL: https://svnweb.freebsd.org/changeset/base/281820 Log: Add hint about "volmode=dev" to ctl.conf(5). Differential Revision:https://reviews.freebsd.org/D2328 Reviewed by: allanjude@, bcr@ MFC after:1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/ctld/ctl.conf.5 Modified: head/usr.sbin/ctld/ctl.conf.5 == --- head/usr.sbin/ctld/ctl.conf.5 Tue Apr 21 08:54:14 2015 (r281819) +++ head/usr.sbin/ctld/ctl.conf.5 Tue Apr 21 09:11:28 2015 (r281820) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 4, 2015 +.Dd April 19, 2015 .Dt CTL.CONF 5 .Os .Sh NAME @@ -365,7 +365,12 @@ All CTL-specific options are documented section of .Xr ctladm 8 . .It Ic path Ar path -The path to the file or device node used to back the LUN. +The path to the file, device node, or +.Xr zfs 8 +volume used to back the LUN. +For optimal performance, create the volume with the +.Qq Ar volmode=dev +property set. .It Ic serial Ar string The SCSI serial number presented to the initiator. .It Ic size Ar size @@ -435,7 +440,8 @@ target naa.50015178f369f092 { .Sh SEE ALSO .Xr ctl 4 , .Xr ctladm 8 , -.Xr ctld 8 +.Xr ctld 8 , +.Xr zfs 8 .Sh AUTHORS 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: r281819 - head/sys/dev/mii
Author: glebius Date: Tue Apr 21 08:54:14 2015 New Revision: 281819 URL: https://svnweb.freebsd.org/changeset/base/281819 Log: The comment on BMCR data in if_media entry is wrong. The ifm_data stores the index array, not a value for BMCR register. In case of IFM_10_T there could be either MII_MEDIA_10_T or MII_MEDIA_10_T_FDX, which are 1 and 2, accordingly. Neither matches a valid BMCR value. My guessing is that this write is harmless, since later mii_phy_setmedia() would write a proper value there. The code is here since the initial checkin. Note that case IFM_100_TX has the same comment, but a proper value of BMCR_ISO is written. So, collapse two cases into one, always writing there BMCR_ISO. Sponsored by: Nginx, Inc. Modified: head/sys/dev/mii/mlphy.c Modified: head/sys/dev/mii/mlphy.c == --- head/sys/dev/mii/mlphy.cTue Apr 21 08:47:27 2015(r281818) +++ head/sys/dev/mii/mlphy.cTue Apr 21 08:54:14 2015(r281819) @@ -220,29 +220,11 @@ mlphy_service(xsc, mii, cmd) msc->ml_linked = 0; return (0); case IFM_10_T: - /* -* For 10baseT modes, reset and program the -* companion PHY (of any), then program ourselves -* to match. This will put us in pass-through -* mode and let the companion PHY do all the -* work. -* -* BMCR data is stored in the ifmedia entry. -*/ - if (other != NULL) { - PHY_RESET(other); - PHY_WRITE(other, MII_BMCR, ife->ifm_data); - } - mii_phy_setmedia(sc); - msc->ml_state = 0; - break; case IFM_100_TX: /* -* For 100baseTX modes, reset and isolate the -* companion PHY (if any), then program ourselves +* For 10baseT and 100baseTX modes, reset and isolate +* the companion PHY (if any), then program ourselves * accordingly. -* -* BMCR data is stored in the ifmedia entry. */ if (other != NULL) { PHY_RESET(other); ___ 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: r281721 - head/sys/sys
On 20 Apr 2015, at 17:19, Bruce Evans wrote: > > Enums should never be used in ABIs, since their size can be anything > large enough. The rules for the size of enums also differ between C and C++, though clang (and, I think, gcc) support an attribute for specifying the enum type. > They also cause namespace problems. The whole enum declaration must > be exposed in any header that uses an enum type. Both C and C++ permit forward declarations of enums for use in function prototypes and so on, e.g.: enum foo; void bar(enum foo); 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: r281787 - head/sbin/dmesg
On Mon, 20 Apr 2015, Eric van Gyzen wrote: Log: dmesg: accommodate message buffer growth between the sysctl calls Allocate 12.5% extra space to avoid ENOMEM when the message buffer is growing steadily. This is bogus allocation. The message buffer has a small fixed size so that it fits in physical memory in the kernel, and rarely changes its size after it fills up. Userland can easily statically allocate a buffer 1000 if not 100 times as large as the full size in virtual memory. This is much easier to do than even half-baked dynamic allocation. Modified: head/sbin/dmesg/dmesg.c == --- head/sbin/dmesg/dmesg.c Mon Apr 20 20:06:25 2015(r281786) +++ head/sbin/dmesg/dmesg.c Mon Apr 20 20:07:39 2015(r281787) @@ -118,6 +118,9 @@ main(int argc, char *argv[]) */ if (sysctlbyname("kern.msgbuf", NULL, &buflen, NULL, 0) == -1) err(1, "sysctl kern.msgbuf"); + /* Allocate extra room for growth between the sysctl calls. */ + buflen += buflen/8; + /* Allocate more than sysctl sees, for room to append \n\0. */ if ((bp = malloc(buflen + 2)) == NULL) errx(1, "malloc failed"); if (sysctlbyname("kern.msgbuf", bp, &buflen, NULL, 0) == -1) This still fails if the size grows more than 12.5%. This adds some style bugs: - missing spaces around binary operator - verboseness. There is already a verbose comment about the method just above here - new verbose comments not made less verbose by not adding newline delimiters for the block (a single statement) of code that they describe, unlike some old single-line comments in the file. - (old style bug). Expansion of the verbose comment above gave a worse comment scope obfuscation. Code to adjust the buffer actually needs to be in a different block, but the comment about this code is appended to the main comment and the adjustment is not even appended. Non-half-baked dynamic initialization would check the error returned by the first sysctl, and if it is ENOMEM, then retry. This is actually simpler, since it doesn't need the second sysctl (except dynamically, and almost never then). Allocate some memory before starting the loop. This doesn't need any comments since it is obviously the only correct way to determine the amount of memory needed if the size can change. Dynamic allocation is still overkill. For the initial size, use MSG_BUFSIZE (+2) from . MSG_BUFSIZE is not quite unusable outside of the kernel. It is just a default, so cannot be used correctly outside of the kernel, but given that it exists, it is slightly better than an arbitrary value for the initial size, since that gives only 1 iteration of the loop in the usual case where dmesg was compiled with the same sources as the kernel and the user didn't change the default. Untested version: X buflen = MSGBUFSIZ / 2; X bp = NULL; X do { X buflen *= 2; X if ((bp = reallocf(bp, buflen + 2)) == NULL) X errx(1, "malloc failed"); X if (sysctlbyname("kern.msgbuf", bp, &buflen, NULL, 0) == 0) X break; X if (errno != ENOMEM) X err(1, "sysctl kern.msgbuf"); X } while (0); The error handling is still painful. malloc() failure can't happen, but I preserved the check for it. buflen *= 2 can overflow, but I omitted checking for it. This should be safe since the overflow only malloc() failures (that can't happen) have happened. phk has railed against the practice of starting with a small size and doubling it. Starting with a large size and hoping to never change it is better for bloatware. The above does the latter, except the "large" size is small. Doubling it is correct since anyone changing the default shouldn't make small adjustments. But small utilities don't need any dynamic allocation. They can allocate "large" buffers that are actually small using static allocation. Another not so good way to do the above is have a sysctl that returns the full msgbuf size. This cannot change. Then the only change needed in the original code is to change the first sysctl to determine the full size. All kernel parameters that are not constant because they may be changed by kernel options should have such a sysctl and shouldn't have any manifest constant (except as a default or minimum value, like POSIX minimum values for sysconf()). But using such a constant here just takes more code. It takes 1 sysctl() to determine the size, then a malloc(), then 1 sysctl() (but not in a loop) to use the size. Fully dynamical allocation starting with a reasonably large size usually only needs 1 malloc() and 1 sysctl(). Elsewhere, in much more important places, there is an enormous amount of sloppy code that abuses PO
svn commit: r281817 - head/sys/dev/mii
Author: glebius Date: Tue Apr 21 06:59:40 2015 New Revision: 281817 URL: https://svnweb.freebsd.org/changeset/base/281817 Log: Since xmphy doesn't call mii_phy_setmedia(), there is no reason to set ifm_data. Sponsored by: Nginx, Inc. Modified: head/sys/dev/mii/xmphy.c Modified: head/sys/dev/mii/xmphy.c == --- head/sys/dev/mii/xmphy.cTue Apr 21 06:46:11 2015(r281816) +++ head/sys/dev/mii/xmphy.cTue Apr 21 06:59:40 2015(r281817) @@ -116,16 +116,15 @@ xmphy_attach(device_t dev) PHY_RESET(sc); -#defineADD(m, c) ifmedia_add(&sc->mii_pdata->mii_media, (m), (c), NULL) +#defineADD(m) ifmedia_add(&sc->mii_pdata->mii_media, (m), 0, NULL) #define PRINT(s) printf("%s%s", sep, s); sep = ", " device_printf(dev, " "); - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, 0, sc->mii_inst), - XMPHY_BMCR_FDX); + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, 0, sc->mii_inst)); PRINT("1000baseSX"); - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, IFM_FDX, sc->mii_inst), 0); + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, IFM_FDX, sc->mii_inst)); PRINT("1000baseSX-FDX"); - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst), 0); + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst)); PRINT("auto"); printf("\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"