svn commit: r274744 - head/sys/contrib/ipfilter/netinet
Author: rodrigc Date: Thu Nov 20 08:11:54 2014 New Revision: 274744 URL: https://svnweb.freebsd.org/changeset/base/274744 Log: Set the current vnet inside the ioctl handler for ipfilter. Without this fix, the vnet was NULL and would crash. This fix is similar to what was done inside the ioctl handler for PF. Tested by: (1) Boot a kernel with "options VIMAGE" enabled (2) Type: echo "map lo0 from 10.0.0.0/24 to ! 10.0.0.0/24 -> 127.0.0.1/32" > /etc/ipnat.rules ; service ipnat onerestart PR: 176992 Differential Revision: https://reviews.freebsd.org/D1191 Reviewed by: cy Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c == --- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Nov 20 06:32:47 2014(r274743) +++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Nov 20 08:11:54 2014(r274744) @@ -33,6 +33,9 @@ static const char rcsid[] = "@(#)$Id$"; #include #include # include +#if defined(__FreeBSD_version) && (__FreeBSD_version >= 80) +#include +#endif # include # include #if !defined(__hpux) @@ -52,6 +55,12 @@ static const char rcsid[] = "@(#)$Id$"; #include #include #include +#if defined(__FreeBSD_version) && (__FreeBSD_version >= 80) +#include +#else +#define CURVNET_SET(arg) +#define CURVNET_RESTORE() +#endif #if defined(__osf__) # include #endif @@ -323,7 +332,9 @@ ipfioctl(dev, cmd, data, mode SPL_NET(s); + CURVNET_SET(TD_TO_VNET(p)); error = ipf_ioctlswitch(&ipfmain, unit, data, cmd, mode, p->p_uid, p); + CURVNET_RESTORE(); if (error != -1) { SPL_X(s); return error; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r274745 - head/share/man/man9
Author: rodrigc Date: Thu Nov 20 09:56:34 2014 New Revision: 274745 URL: https://svnweb.freebsd.org/changeset/base/274745 Log: MFp4: @179066 Add page which describes VNET network stack virtualization infrastructure. Submitted by: bz Sponsored by: The FreeBSD Foundation Sponsored by: CK Software GmbH Added: head/share/man/man9/vnet.9 (contents, props changed) Modified: head/share/man/man9/Makefile Modified: head/share/man/man9/Makefile == --- head/share/man/man9/MakefileThu Nov 20 08:11:54 2014 (r274744) +++ head/share/man/man9/MakefileThu Nov 20 09:56:34 2014 (r274745) @@ -345,6 +345,7 @@ MAN=accept_filter.9 \ vmem.9 \ vn_fullpath.9 \ vn_isdisk.9 \ + vnet.9 \ vnode.9 \ VOP_ACCESS.9 \ VOP_ACLCHECK.9 \ Added: head/share/man/man9/vnet.9 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man9/vnet.9 Thu Nov 20 09:56:34 2014(r274745) @@ -0,0 +1,502 @@ +.\"- +.\" Copyright (c) 2010 The FreeBSD Foundation +.\" All rights reserved. +.\" +.\" This documentation was written by CK Software GmbH 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$ +.\" +.Dd November 20, 2014 +.Dt VNET 9 +.Os +.Sh NAME +.Nm VNET +.Nd "network subsystem virtualization infrastructure" +.Sh SYNOPSIS +.Cd "options VIMAGE" +.Cd "options VNET_DEBUG" +.Pp +.In sys/vnet.h +.Pp +.\" +.Ss "Constants and Global Variables" +.\" +.Dv VNET_SETNAME +.\""set_vnet" +.Dv VNET_SYMPREFIX +.\""vnet_entry_" +.Vt extern struct vnet *vnet0; +.\" +.Ss "Variable Declaration" +.Fo VNET +.Fa "name" +.Fc +.\" +.Fo VNET_NAME +.Fa "name" +.Fc +.\" +.Fo VNET_DECLARE +.Fa "type" "name" +.Fc +.\" +.Fo VNET_DEFINE +.Fa "type" "name" +.Fc +.\" +.Bd -literal +#defineV_name VNET(name) +.Ed +.\" +.Ss "Virtual Instance Selection" +.\" +.Fo CRED_TO_VNET +.Fa "struct ucred *" +.Fc +.\" +.Fo TD_TO_VNET +.Fa "struct thread *" +.Fc +.\" +.Fo P_TO_VNET +.Fa "struct proc *" +.Fc +.\" +.Fo IS_DEFAULT_VNET +.Fa "struct vnet *" +.Fc +.\" +.Fo VNET_ASSERT +.Fa exp msg +.Fc +.\" +.Fo CURVNET_SET +.Fa "struct vnet *" +.Fc +.\" +.Fo CURVNET_SET_QUIET +.Fa "struct vnet *" +.Fc +.\" +.Fo CURVNET_RESTORE +.Fc +.\" +.Fo VNET_ITERATOR_DECL +.Fa "struct vnet *" +.Fc +.\" +.Fo VNET_FOREACH +.Fa "struct vnet *" +.Fc +.\" +.Ss "Locking" +.\" +.Fo VNET_LIST_RLOCK +.Fc +.Fo VNET_LIST_RUNLOCK +.Fc +.Fo VNET_LIST_RLOCK_NOSLEEP +.Fc +.Fo VNET_LIST_RUNLOCK_NOSLEEP +.Fc +.\" +.Ss "Startup and Teardown Functions" +.\" +.Ft "struct vnet *" +.Fo vnet_alloc +.Fa void +.Fc +.\" +.Ft void +.Fo vnet_destroy +.Fa "struct vnet *" +.Fc +.\" +.Fo VNET_SYSINIT +.Fa ident +.Fa "enum sysinit_sub_id subsystem" +.Fa "enum sysinit_elem_order order" +.Fa "sysinit_cfunc_t func" +.Fa "const void *arg" +.Fc +.\" +.Fo VNET_SYSUNINIT +.Fa ident +.Fa "enum sysinit_sub_id subsystem" +.Fa "enum sysinit_elem_order order" +.Fa "sysinit_cfunc_t func" +.Fa "const void *arg" +.Fc +.\" +.Ss "Eventhandlers" +.\" +.Fo VNET_GLOBAL_EVENTHANDLER_REGISTER +.Fa "const char *name" +.Fa "void *func" +.Fa "void *arg" +.Fa "int priority
Re: svn commit: r274721 - head/sys/geom/part
On 20.11.2014 07:38, Bruce Evans wrote: > On Wed, 19 Nov 2014, Warner Losh wrote: > >> Log: >> The number of BSD partitions is variable. Return the proper number >> (which is in basetable->gpt_entries). >> >> Submitted by: ae@ >> >> Modified: >> head/sys/geom/part/g_part_bsd.c >> >> Modified: head/sys/geom/part/g_part_bsd.c >> == >> >> --- head/sys/geom/part/g_part_bsd.cWed Nov 19 18:19:21 2014 >> (r274720) >> +++ head/sys/geom/part/g_part_bsd.cWed Nov 19 18:55:27 2014 >> (r274721) >> @@ -521,7 +521,7 @@ g_part_bsd_ioctl(struct g_part_table *ba >> >> table = (struct g_part_bsd_table *)basetable; >> p = table->bbarea + pp->sectorsize; >> -return (bsd_disklabel_le_dec(p, data, MAXPARTITIONS)); >> +return (bsd_disklabel_le_dec(p, data, basetable->gpt_entries)); >> } >> default: >> return (ENOIOCTL); > > How can this work? I think you are implementing DIOCGDINFO. This returns > a struct disklabel, which is limited by binary compatibility to the > historical number of partitions (8). So this ioctl just cannot support > more than 8 partitions. The best that could happen is for > bsd_disklabel_le_dec() to return an error in this case. But it actually > does essentially the reverse -- you pass it the maximum supported by the > ioctl, and it returns an error if the actual number is larger. So > MAXPARTITIONS was correct if this is to implement DIOCGDINFO. Yes, you are right. The size is hardcoded in the DIOCGDINFO and this can lead to out of the bound access in the application that uses it. Sorry for wrong suggestion. -- WBR, Andrey V. Elsukov ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r274749 - head/share/man/man4
Author: emaste Date: Thu Nov 20 14:18:07 2014 New Revision: 274749 URL: https://svnweb.freebsd.org/changeset/base/274749 Log: Spell out "Windows" - no need to censor it in a man page Modified: head/share/man/man4/splash.4 Modified: head/share/man/man4/splash.4 == --- head/share/man/man4/splash.4Thu Nov 20 11:33:38 2014 (r274748) +++ head/share/man/man4/splash.4Thu Nov 20 14:18:07 2014 (r274749) @@ -66,7 +66,7 @@ Currently the following decoder modules .Pp .Bl -tag -width splash_decoder -compact .It Pa splash_bmp.ko -W*ndows BMP file decoder. +Windows BMP file decoder. While the BMP file format allows images of various color depths, this decoder currently only handles 256 color bitmaps. Bitmaps of other color depths will not be displayed. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r274661 - in head/sys: conf geom/part modules/geom/geom_part/geom_part_bsd
On 19.11.2014 21:49, Warner Losh wrote: > > On Nov 19, 2014, at 11:00 AM, Andrey V. Elsukov wrote: > >> On 19.11.2014 19:20, Warner Losh wrote: Probably you need to use basetable->gpt_entries here instead of MAXPARTITIONS. >>> >>> I’m having trouble connecting the dots between GPT and BSDlabels. Why >>> would this field be relevant? Is it just poorly named? MAXPARTITIONS >> >> gpt_entries isn't related to GPT, it is `geom partition table's` number >> of partitions entries. Each instance of partition table (i.e. geom) can >> have own number of partitions. MBR always has 4, but GPT or BSD can have >> different numbers. > > Ah, OK. Thanks for the explanation. I understand. I’ll work up a patch. Hi, Warner since there are some reports about strange behavior of old utilities after this commit, maybe we won't repair them by this way? What you think about this path? -- WBR, Andrey V. Elsukov Index: head/sbin/fsck/fsck.c === --- head/sbin/fsck/fsck.c (revision 274736) +++ head/sbin/fsck/fsck.c (working copy) @@ -41,8 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define FSTYPENAMES -#include +#include #include #include @@ -85,6 +84,17 @@ static const char *getfslab(const char *); static void usage(void) __dead2; static int isok(struct fstab *); +static struct { + const char *ptype; + const char *name; +} ptype_map[] = { + { "ufs", "ffs" }, + { "ffs", "ffs" }, + { "fat", "msdosfs" }, + { "efi", "msdosfs" }, + { NULL, NULL }, +}; + int main(int argc, char *argv[]) { @@ -535,41 +545,27 @@ mangle(char *opts, int *argcp, const char ** volat *maxargcp = maxargc; } - static const char * getfslab(const char *str) { - struct disklabel dl; - int fd; - char p; - const char *vfstype; - u_char t; + struct diocgattr_arg attr; + int fd, i; - /* deduce the file system type from the disk label */ if ((fd = open(str, O_RDONLY)) == -1) err(1, "cannot open `%s'", str); - if (ioctl(fd, DIOCGDINFO, &dl) == -1) { + strncpy(attr.name, "PART::type", sizeof(attr.name)); + memset(&attr.value, 0, sizeof(attr.value)); + attr.len = sizeof(attr.value); + if (ioctl(fd, DIOCGATTR, &attr) == -1) { (void) close(fd); return(NULL); } - (void) close(fd); - - p = str[strlen(str) - 1]; - - if ((p - 'a') >= dl.d_npartitions) - errx(1, "partition `%s' is not defined on disk", str); - - if ((t = dl.d_partitions[p - 'a'].p_fstype) >= FSMAXTYPES) - errx(1, "partition `%s' is not of a legal vfstype", - str); - - if ((vfstype = fstypenames[t]) == NULL) - errx(1, "vfstype `%s' on partition `%s' is not supported", - fstypenames[t], str); - - return vfstype; + for (i = 0; ptype_map[i].ptype != NULL; i++) + if (strstr(attr.value.str, ptype_map[i].ptype) != NULL) + return (ptype_map[i].name); + return (NULL); } signature.asc Description: OpenPGP digital signature
svn commit: r274750 - head/sbin/fsck
Author: ae Date: Thu Nov 20 16:31:31 2014 New Revision: 274750 URL: https://svnweb.freebsd.org/changeset/base/274750 Log: Use geom attribute "PART::type" to determine partition type and choose relevant fsck_xxx utility. MFC after:1 week Modified: head/sbin/fsck/fsck.c Modified: head/sbin/fsck/fsck.c == --- head/sbin/fsck/fsck.c Thu Nov 20 14:18:07 2014(r274749) +++ head/sbin/fsck/fsck.c Thu Nov 20 16:31:31 2014(r274750) @@ -41,8 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define FSTYPENAMES -#include +#include #include #include @@ -81,10 +80,21 @@ static void addentry(struct fstypelist * static void maketypelist(char *); static void catopt(char **, const char *); static void mangle(char *, int *, const char ** volatile *, int *); -static const char *getfslab(const char *); +static const char *getfstype(const char *); static void usage(void) __dead2; static int isok(struct fstab *); +static struct { + const char *ptype; + const char *name; +} ptype_map[] = { + { "ufs","ffs" }, + { "ffs","ffs" }, + { "fat","msdosfs" }, + { "efi","msdosfs" }, + { NULL, NULL }, +}; + int main(int argc, char *argv[]) { @@ -203,7 +213,7 @@ main(int argc, char *argv[]) if ((fs = getfsfile(spec)) == NULL && (fs = getfsspec(spec)) == NULL) { if (vfstype == NULL) - vfstype = getfslab(spec); + vfstype = getfstype(spec); if (vfstype == NULL) errx(1, "Could not determine filesystem type"); type = vfstype; @@ -535,41 +545,27 @@ mangle(char *opts, int *argcp, const cha *maxargcp = maxargc; } - static const char * -getfslab(const char *str) +getfstype(const char *str) { - struct disklabel dl; - int fd; - char p; - const char *vfstype; - u_char t; + struct diocgattr_arg attr; + int fd, i; - /* deduce the file system type from the disk label */ if ((fd = open(str, O_RDONLY)) == -1) err(1, "cannot open `%s'", str); - if (ioctl(fd, DIOCGDINFO, &dl) == -1) { + strncpy(attr.name, "PART::type", sizeof(attr.name)); + memset(&attr.value, 0, sizeof(attr.value)); + attr.len = sizeof(attr.value); + if (ioctl(fd, DIOCGATTR, &attr) == -1) { (void) close(fd); return(NULL); } - (void) close(fd); - - p = str[strlen(str) - 1]; - - if ((p - 'a') >= dl.d_npartitions) - errx(1, "partition `%s' is not defined on disk", str); - - if ((t = dl.d_partitions[p - 'a'].p_fstype) >= FSMAXTYPES) - errx(1, "partition `%s' is not of a legal vfstype", - str); - - if ((vfstype = fstypenames[t]) == NULL) - errx(1, "vfstype `%s' on partition `%s' is not supported", - fstypenames[t], str); - - return vfstype; + for (i = 0; ptype_map[i].ptype != NULL; i++) + if (strstr(attr.value.str, ptype_map[i].ptype) != NULL) + return (ptype_map[i].name); + return (NULL); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r274751 - head/sys/dev/fdt
Author: andrew Date: Thu Nov 20 17:03:40 2014 New Revision: 274751 URL: https://svnweb.freebsd.org/changeset/base/274751 Log: The ranges parent bus address may just be a tag to the entry in the parent node. Take this in to account by searching until we find the range for the root node. Differential Revision:https://reviews.freebsd.org/D1160 Reviewed by: ian Obtained from:ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/fdt/fdt_common.c Modified: head/sys/dev/fdt/fdt_common.c == --- head/sys/dev/fdt/fdt_common.c Thu Nov 20 16:31:31 2014 (r274750) +++ head/sys/dev/fdt/fdt_common.c Thu Nov 20 17:03:40 2014 (r274751) @@ -1,7 +1,9 @@ /*- - * Copyright (c) 2009-2010 The FreeBSD Foundation + * Copyright (c) 2009-2014 The FreeBSD Foundation * All rights reserved. * + * This software was developed by Andrew Turner under sponsorship from + * the FreeBSD Foundation. * This software was developed by Semihalf under sponsorship from * the FreeBSD Foundation. * @@ -64,12 +66,84 @@ vm_offset_t fdt_immr_size; struct fdt_ic_list fdt_ic_list_head = SLIST_HEAD_INITIALIZER(fdt_ic_list_head); +static int +fdt_get_range_by_busaddr(phandle_t node, u_long addr, u_long *base, +u_long *size) +{ + pcell_t ranges[32], *rangesptr; + pcell_t addr_cells, size_cells, par_addr_cells; + u_long bus_addr, par_bus_addr, pbase, psize; + int err, i, len, tuple_size, tuples; + + if ((fdt_addrsize_cells(node, &addr_cells, &size_cells)) != 0) + return (ENXIO); + /* +* Process 'ranges' property. +*/ + par_addr_cells = fdt_parent_addr_cells(node); + if (par_addr_cells > 2) { + return (ERANGE); + } + + len = OF_getproplen(node, "ranges"); + if (len < 0) + return (-1); + if (len > sizeof(ranges)) + return (ENOMEM); + if (len == 0) { + *base = 0; + *size = ULONG_MAX; + return (0); + } + + if (OF_getprop(node, "ranges", ranges, sizeof(ranges)) <= 0) + return (EINVAL); + + tuple_size = addr_cells + par_addr_cells + size_cells; + tuples = len / (tuple_size * sizeof(cell_t)); + + if (fdt_ranges_verify(ranges, tuples, par_addr_cells, + addr_cells, size_cells)) { + return (ERANGE); + } + *base = 0; + *size = 0; + + for (i = 0; i < tuples; i++) { + rangesptr = &ranges[i * tuple_size]; + + bus_addr = fdt_data_get((void *)rangesptr, addr_cells); + if (bus_addr != addr) + continue; + rangesptr += addr_cells; + + par_bus_addr = fdt_data_get((void *)rangesptr, par_addr_cells); + rangesptr += par_addr_cells; + + err = fdt_get_range_by_busaddr(OF_parent(node), par_bus_addr, + &pbase, &psize); + if (err > 0) + return (err); + if (err == 0) + *base = pbase; + else + *base = par_bus_addr; + + *size = fdt_data_get((void *)rangesptr, size_cells); + + return (0); + } + + return (EINVAL); +} + int fdt_get_range(phandle_t node, int range_id, u_long *base, u_long *size) { pcell_t ranges[6], *rangesptr; pcell_t addr_cells, size_cells, par_addr_cells; - int len, tuple_size, tuples; + u_long par_bus_addr, pbase, psize; + int err, len, tuple_size, tuples; if ((fdt_addrsize_cells(node, &addr_cells, &size_cells)) != 0) return (ENXIO); @@ -109,8 +183,17 @@ fdt_get_range(phandle_t node, int range_ *base = fdt_data_get((void *)rangesptr, addr_cells); rangesptr += addr_cells; - *base += fdt_data_get((void *)rangesptr, par_addr_cells); + + par_bus_addr = fdt_data_get((void *)rangesptr, par_addr_cells); rangesptr += par_addr_cells; + + err = fdt_get_range_by_busaddr(OF_parent(node), par_bus_addr, + &pbase, &psize); + if (err == 0) + *base += pbase; + else + *base += par_bus_addr; + *size = fdt_data_get((void *)rangesptr, size_cells); return (0); } @@ -292,7 +375,7 @@ fdt_parent_addr_cells(phandle_t node) /* Find out #address-cells of the superior bus. */ if (OF_searchprop(OF_parent(node), "#address-cells", &addr_cells, sizeof(addr_cells)) <= 0) - addr_cells = 2; + return (2); return ((int)fdt32_to_cpu(addr_cells)); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsub
svn commit: r274752 - in head/sys/mips: include mips
Author: br Date: Thu Nov 20 17:06:41 2014 New Revision: 274752 URL: https://svnweb.freebsd.org/changeset/base/274752 Log: Add L2-cache writeback/flush operations. Supported 32,128-byte line-size, else ignored. Cavium Networks also ignored as it has non-standard config registers. Obtained from:NetBSD Sponsored by: DARPA, AFRL Modified: head/sys/mips/include/cache_mipsNN.h head/sys/mips/include/cpuinfo.h head/sys/mips/include/cpuregs.h head/sys/mips/mips/cache.c head/sys/mips/mips/cache_mipsNN.c head/sys/mips/mips/cpu.c Modified: head/sys/mips/include/cache_mipsNN.h == --- head/sys/mips/include/cache_mipsNN.hThu Nov 20 17:03:40 2014 (r274751) +++ head/sys/mips/include/cache_mipsNN.hThu Nov 20 17:06:41 2014 (r274752) @@ -67,5 +67,15 @@ void mipsNN_pdcache_wbinv_range_index_12 void mipsNN_pdcache_inv_range_128(vm_offset_t, vm_size_t); void mipsNN_pdcache_wb_range_128(vm_offset_t, vm_size_t); #endif +void mipsNN_sdcache_wbinv_all_32(void); +void mipsNN_sdcache_wbinv_range_32(vm_paddr_t, vm_size_t); +void mipsNN_sdcache_wbinv_range_index_32(vm_paddr_t, vm_size_t); +void mipsNN_sdcache_inv_range_32(vm_paddr_t, vm_size_t); +void mipsNN_sdcache_wb_range_32(vm_paddr_t, vm_size_t); +void mipsNN_sdcache_wbinv_all_128(void); +void mipsNN_sdcache_wbinv_range_128(vm_paddr_t, vm_size_t); +void mipsNN_sdcache_wbinv_range_index_128(vm_paddr_t, vm_size_t); +void mipsNN_sdcache_inv_range_128(vm_paddr_t, vm_size_t); +void mipsNN_sdcache_wb_range_128(vm_paddr_t, vm_size_t); #endif /* _MACHINE_CACHE_MIPSNN_H_ */ Modified: head/sys/mips/include/cpuinfo.h == --- head/sys/mips/include/cpuinfo.h Thu Nov 20 17:03:40 2014 (r274751) +++ head/sys/mips/include/cpuinfo.h Thu Nov 20 17:06:41 2014 (r274752) @@ -67,6 +67,12 @@ struct mips_cpuinfo { u_int8_tdc_nways; u_int16_t dc_nsets; } l1; + struct { + u_int32_t dc_size; + u_int8_tdc_linesize; + u_int8_tdc_nways; + u_int16_t dc_nsets; + } l2; }; extern struct mips_cpuinfo cpuinfo; Modified: head/sys/mips/include/cpuregs.h == --- head/sys/mips/include/cpuregs.h Thu Nov 20 17:03:40 2014 (r274751) +++ head/sys/mips/include/cpuregs.h Thu Nov 20 17:06:41 2014 (r274752) @@ -550,6 +550,13 @@ #define MIPS_CONFIG1_EP0x0002 /* EJTAG implemented */ #define MIPS_CONFIG1_FP0x0001 /* FPU implemented */ +#define MIPS_CONFIG2_SA_SHIFT 0 /* Secondary cache associativity */ +#define MIPS_CONFIG2_SA_MASK 0xf +#define MIPS_CONFIG2_SL_SHIFT 4 /* Secondary cache line size */ +#define MIPS_CONFIG2_SL_MASK 0xf +#define MIPS_CONFIG2_SS_SHIFT 8 /* Secondary cache sets per way */ +#define MIPS_CONFIG2_SS_MASK 0xf + #define MIPS_CONFIG4_MMUSIZEEXT0x00FF /* bits 7.. 0 MMU Size Extension */ #define MIPS_CONFIG4_MMUEXTDEF 0xC000 /* bits 15.14 MMU Extension Definition */ #define MIPS_CONFIG4_MMUEXTDEF_MMUSIZEEXT 0x4000 /* This values denotes CONFIG4 bits */ Modified: head/sys/mips/mips/cache.c == --- head/sys/mips/mips/cache.c Thu Nov 20 17:03:40 2014(r274751) +++ head/sys/mips/mips/cache.c Thu Nov 20 17:06:41 2014(r274752) @@ -260,19 +260,42 @@ mips_config_cache(struct mips_cpuinfo * panic("no pdcache_wb_range"); } - /* XXXMIPS: No secondary cache handlers yet */ -#ifdef notyet - if (mips_sdcache_size) { - if (!mips_cache_ops.mco_sdcache_wbinv_all) - panic("no sdcache_wbinv_all"); - if (!mips_cache_ops.mco_sdcache_wbinv_range) - panic("no sdcache_wbinv_range"); - if (!mips_cache_ops.mco_sdcache_wbinv_range_index) - panic("no sdcache_wbinv_range_index"); - if (!mips_cache_ops.mco_sdcache_inv_range) - panic("no sdcache_inv_range"); - if (!mips_cache_ops.mco_sdcache_wb_range) - panic("no sdcache_wb_range"); + /* L2 data cache */ + if (!cpuinfo->l2.dc_size) { + /* No L2 found, ignore */ + return; } + + switch (cpuinfo->l2.dc_linesize) { + case 32: + mips_cache_ops.mco_sdcache_wbinv_all = + mipsNN_sdcache_wbinv_all_32; + mips_cache_ops.mco_sdcache_wbinv_
Re: svn commit: r274752 - in head/sys/mips: include mips
W! -adrian On 20 November 2014 09:06, Ruslan Bukin wrote: > Author: br > Date: Thu Nov 20 17:06:41 2014 > New Revision: 274752 > URL: https://svnweb.freebsd.org/changeset/base/274752 > > Log: > Add L2-cache writeback/flush operations. Supported 32,128-byte line-size, > else ignored. Cavium Networks also ignored as it has non-standard config > registers. > > Obtained from:NetBSD > Sponsored by: DARPA, AFRL > > Modified: > head/sys/mips/include/cache_mipsNN.h > head/sys/mips/include/cpuinfo.h > head/sys/mips/include/cpuregs.h > head/sys/mips/mips/cache.c > head/sys/mips/mips/cache_mipsNN.c > head/sys/mips/mips/cpu.c > > Modified: head/sys/mips/include/cache_mipsNN.h > == > --- head/sys/mips/include/cache_mipsNN.hThu Nov 20 17:03:40 2014 > (r274751) > +++ head/sys/mips/include/cache_mipsNN.hThu Nov 20 17:06:41 2014 > (r274752) > @@ -67,5 +67,15 @@ void mipsNN_pdcache_wbinv_range_index_12 > void mipsNN_pdcache_inv_range_128(vm_offset_t, vm_size_t); > void mipsNN_pdcache_wb_range_128(vm_offset_t, vm_size_t); > #endif > +void mipsNN_sdcache_wbinv_all_32(void); > +void mipsNN_sdcache_wbinv_range_32(vm_paddr_t, vm_size_t); > +void mipsNN_sdcache_wbinv_range_index_32(vm_paddr_t, vm_size_t); > +void mipsNN_sdcache_inv_range_32(vm_paddr_t, vm_size_t); > +void mipsNN_sdcache_wb_range_32(vm_paddr_t, vm_size_t); > +void mipsNN_sdcache_wbinv_all_128(void); > +void mipsNN_sdcache_wbinv_range_128(vm_paddr_t, vm_size_t); > +void mipsNN_sdcache_wbinv_range_index_128(vm_paddr_t, vm_size_t); > +void mipsNN_sdcache_inv_range_128(vm_paddr_t, vm_size_t); > +void mipsNN_sdcache_wb_range_128(vm_paddr_t, vm_size_t); > > #endif /* _MACHINE_CACHE_MIPSNN_H_ */ > > Modified: head/sys/mips/include/cpuinfo.h > == > --- head/sys/mips/include/cpuinfo.h Thu Nov 20 17:03:40 2014 > (r274751) > +++ head/sys/mips/include/cpuinfo.h Thu Nov 20 17:06:41 2014 > (r274752) > @@ -67,6 +67,12 @@ struct mips_cpuinfo { > u_int8_tdc_nways; > u_int16_t dc_nsets; > } l1; > + struct { > + u_int32_t dc_size; > + u_int8_tdc_linesize; > + u_int8_tdc_nways; > + u_int16_t dc_nsets; > + } l2; > }; > > extern struct mips_cpuinfo cpuinfo; > > Modified: head/sys/mips/include/cpuregs.h > == > --- head/sys/mips/include/cpuregs.h Thu Nov 20 17:03:40 2014 > (r274751) > +++ head/sys/mips/include/cpuregs.h Thu Nov 20 17:06:41 2014 > (r274752) > @@ -550,6 +550,13 @@ > #define MIPS_CONFIG1_EP0x0002 /* EJTAG > implemented */ > #define MIPS_CONFIG1_FP0x0001 /* FPU > implemented */ > > +#define MIPS_CONFIG2_SA_SHIFT 0 /* Secondary cache > associativity */ > +#define MIPS_CONFIG2_SA_MASK 0xf > +#define MIPS_CONFIG2_SL_SHIFT 4 /* Secondary cache > line size */ > +#define MIPS_CONFIG2_SL_MASK 0xf > +#define MIPS_CONFIG2_SS_SHIFT 8 /* Secondary cache > sets per way */ > +#define MIPS_CONFIG2_SS_MASK 0xf > + > #define MIPS_CONFIG4_MMUSIZEEXT0x00FF /* bits 7.. 0 > MMU Size Extension */ > #define MIPS_CONFIG4_MMUEXTDEF 0xC000 /* bits 15.14 MMU > Extension Definition */ > #define MIPS_CONFIG4_MMUEXTDEF_MMUSIZEEXT 0x4000 /* This values > denotes CONFIG4 bits */ > > Modified: head/sys/mips/mips/cache.c > == > --- head/sys/mips/mips/cache.c Thu Nov 20 17:03:40 2014(r274751) > +++ head/sys/mips/mips/cache.c Thu Nov 20 17:06:41 2014(r274752) > @@ -260,19 +260,42 @@ mips_config_cache(struct mips_cpuinfo * > panic("no pdcache_wb_range"); > } > > - /* XXXMIPS: No secondary cache handlers yet */ > -#ifdef notyet > - if (mips_sdcache_size) { > - if (!mips_cache_ops.mco_sdcache_wbinv_all) > - panic("no sdcache_wbinv_all"); > - if (!mips_cache_ops.mco_sdcache_wbinv_range) > - panic("no sdcache_wbinv_range"); > - if (!mips_cache_ops.mco_sdcache_wbinv_range_index) > - panic("no sdcache_wbinv_range_index"); > - if (!mips_cache_ops.mco_sdcache_inv_range) > - panic("no sdcache_inv_range"); > - if (!mips_cache_ops.mco_sdcache_wb_range) > - panic("no sdcache_wb_range"); > + /* L2 data cache */ > + if (!cpuinfo->l2.dc_size) { > +
Re: svn commit: r274661 - in head/sys: conf geom/part modules/geom/geom_part/geom_part_bsd
On Nov 20, 2014, at 8:28 AM, Andrey V. Elsukov wrote: > On 19.11.2014 21:49, Warner Losh wrote: >> >> On Nov 19, 2014, at 11:00 AM, Andrey V. Elsukov wrote: >> >>> On 19.11.2014 19:20, Warner Losh wrote: > Probably you need to use basetable->gpt_entries here instead of > MAXPARTITIONS. I’m having trouble connecting the dots between GPT and BSDlabels. Why would this field be relevant? Is it just poorly named? MAXPARTITIONS >>> >>> gpt_entries isn't related to GPT, it is `geom partition table's` number >>> of partitions entries. Each instance of partition table (i.e. geom) can >>> have own number of partitions. MBR always has 4, but GPT or BSD can have >>> different numbers. >> >> Ah, OK. Thanks for the explanation. I understand. I’ll work up a patch. > > Hi, Warner > > since there are some reports about strange behavior of old utilities > after this commit, maybe we won't repair them by this way? > What you think about this path? It doesn’t thrill me. What’s it trying to do? And localizing it to fsck is useless. And where are these reports? Warner signature.asc Description: Message signed with OpenPGP using GPGMail
svn commit: r274753 - head/sys/geom/part
Author: imp Date: Thu Nov 20 17:31:25 2014 New Revision: 274753 URL: https://svnweb.freebsd.org/changeset/base/274753 Log: Actually, that was a bad idea. Go back to MAXPARTITIONS. Submitted by: bruce Modified: head/sys/geom/part/g_part_bsd.c Modified: head/sys/geom/part/g_part_bsd.c == --- head/sys/geom/part/g_part_bsd.c Thu Nov 20 17:06:41 2014 (r274752) +++ head/sys/geom/part/g_part_bsd.c Thu Nov 20 17:31:25 2014 (r274753) @@ -521,7 +521,7 @@ g_part_bsd_ioctl(struct g_part_table *ba table = (struct g_part_bsd_table *)basetable; p = table->bbarea + pp->sectorsize; - return (bsd_disklabel_le_dec(p, data, basetable->gpt_entries)); + return (bsd_disklabel_le_dec(p, data, MAXPARTITIONS)); } default: return (ENOIOCTL); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r274661 - in head/sys: conf geom/part modules/geom/geom_part/geom_part_bsd
On 20.11.2014 20:23, Warner Losh wrote: >> since there are some reports about strange behavior of old utilities >> after this commit, maybe we won't repair them by this way? >> What you think about this path? > > It doesn’t thrill me. What’s it trying to do? And localizing it to fsck is > useless. And where > are these reports? I already committed it in r274750. GEOM_PART class can return partition type via "PART::type" attribute. Now fsck uses it and runs fsck_ffs or fsck_msdosfs depending from the partition type. -- WBR, Andrey V. Elsukov ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r274756 - head/sys/cam/scsi
Author: mav Date: Thu Nov 20 19:28:42 2014 New Revision: 274756 URL: https://svnweb.freebsd.org/changeset/base/274756 Log: Remove residual xpt_release_device() call left after r272406 cleanup. Excessive release here could trigger use-after-free condition and kernel panic on LUN 0 disconnect. MFC after:1 week Modified: head/sys/cam/scsi/scsi_xpt.c Modified: head/sys/cam/scsi/scsi_xpt.c == --- head/sys/cam/scsi/scsi_xpt.cThu Nov 20 18:49:11 2014 (r274755) +++ head/sys/cam/scsi/scsi_xpt.cThu Nov 20 19:28:42 2014 (r274756) @@ -2032,23 +2032,7 @@ scsi_scan_bus(struct cam_periph *periph, scan_info->lunindex[target_id]++; } else { mtx_unlock(&target->luns_mtx); - /* -* We're done with scanning all luns. -* -* Nuke the bogus device for lun 0 if lun 0 -* wasn't on the list. -*/ - if (first != 0) { - TAILQ_FOREACH(device, - &target->ed_entries, links) { - if (device->lun_id == 0) { - break; - } - } - if (device) { - xpt_release_device(device); - } - } + /* We're done with scanning all luns. */ } } else { mtx_unlock(&target->luns_mtx); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r274758 - head/sys/dev/wl
Author: jhb Date: Thu Nov 20 20:09:18 2014 New Revision: 274758 URL: https://svnweb.freebsd.org/changeset/base/274758 Log: Various fixes for wl(4): - Don't recurse driver mutex. - Don't hold driver mutex across fubyte/subyte. - Replace fubyte/subyte loops with copyin/copyout calls. - Use relatively sane locking in wl_ioctl(). - Use bus space accessors instead of in*()/out*(). - Use callout(9) instead of timeout(9). - Stop watchdog timer in detach and don't hold mutex across bus_teardown_intr(). - Use device_printf() and if_printf(). - De-spl(). Tested by:no one Modified: head/sys/dev/wl/if_wl.c head/sys/dev/wl/if_wl.h Modified: head/sys/dev/wl/if_wl.c == --- head/sys/dev/wl/if_wl.c Thu Nov 20 19:35:29 2014(r274757) +++ head/sys/dev/wl/if_wl.c Thu Nov 20 20:09:18 2014(r274758) @@ -232,12 +232,11 @@ __FBSDID("$FreeBSD$"); static chart_packet[ETHERMTU + sizeof(struct ether_header) + sizeof(long)]; -struct wl_softc{ +struct wl_softc { +device_t dev; struct ifnet *ifp; u_char psa[0x40]; u_char nwid[2];/* current radio modem nwid */ -short base; -short unit; intflags; inttbusy; /* flag to determine if xmit is busy */ u_shortbegin_fd; @@ -252,10 +251,8 @@ struct wl_softc{ struct resource*res_ioport; struct resource*res_irq; void *intr_cookie; -bus_space_tag_tbt; -bus_space_handle_t bh; struct mtx wl_mtx; -struct callout_handle watchdog_ch; +struct callout watchdog_timer; #ifdef WLCACHE intw_sigitems; /* number of cached entries */ /* array of cache entries */ @@ -328,9 +325,11 @@ SYSCTL_INT(_machdep, OID_AUTO, wl_gather static int wl_allocate_resources(device_t device); static int wl_deallocate_resources(device_t device); static voidwlstart(struct ifnet *ifp); +static voidwlstart_locked(struct ifnet *ifp); static voidwlinit(void *xsc); +static voidwlinit_locked(struct wl_softc *sc); static int wlioctl(struct ifnet *ifp, u_long cmd, caddr_t data); -static timeout_t wlwatchdog; +static voidwlwatchdog(void *arg); static voidwlintr(void *arg); static voidwlxmt(struct wl_softc *sc, struct mbuf *m); static int wldiag(struct wl_softc *sc); @@ -338,7 +337,7 @@ static int wlconfig(struct wl_softc *sc) static int wlcmd(struct wl_softc *sc, char *str); static voidwlmmcstat(struct wl_softc *sc); static u_short wlbldru(struct wl_softc *sc); -static u_short wlmmcread(u_int base, u_short reg); +static u_short wlmmcread(struct wl_softc *sc, u_short reg); static voidwlinitmmc(struct wl_softc *sc); static int wlhwrst(struct wl_softc *sc); static voidwlrustrt(struct wl_softc *sc); @@ -353,12 +352,12 @@ static void wlhdwsleaze(u_short *countp, #ifdef WLDEBUG static voidwltbd(struct wl_softc *sc); #endif -static voidwlgetpsa(int base, u_char *buf); +static voidwlgetpsa(struct wl_softc *sc, u_char *buf); static voidwlsetpsa(struct wl_softc *sc); static u_short wlpsacrc(u_char *buf); static voidwldump(struct wl_softc *sc); #ifdef WLCACHE -static voidwl_cache_store(struct wl_softc *, int, struct ether_header *, struct mbuf *); +static voidwl_cache_store(struct wl_softc *, struct ether_header *, struct mbuf *); static void wl_cache_zero(struct wl_softc *sc); #endif @@ -387,10 +386,9 @@ static int wlprobe(device_t device) { struct wl_softc*sc; -short base; char *str = "wl%d: board out of range [0..%d]\n"; u_char inbuf[100]; -unsigned long junk, oldpri, sirq; +unsigned long junk, sirq; interror, irq; error = ISA_PNP_PROBE(device_get_parent(device), device, wl_ids); @@ -402,28 +400,24 @@ wlprobe(device_t device) if (error) goto errexit; -base = rman_get_start(sc->res_ioport); - /* TBD. not true. * regular CMD() will not work, since no softc yet */ -#define PCMD(base, hacr) outw((base), (hacr)) +#define PCMD(sc, hacr) WL_WRITE_2((sc), HACR, (hacr)) -oldpri = splimp(); -PCMD(base, HACR_RESET);/* reset the board */ +PCMD(sc, HACR_RESET); /* reset the board */ DELAY(DELAYCONST); /* >> 4 clocks at 6MHz */ -PCMD(base, HACR_RESET);/* reset the board */ +PCMD(sc, HACR_RESET); /* reset the board */ DELAY(DELAYCONST); /* >> 4 clocks at 6MHz */ -splx(oldpri); /* clear reset command and set PIO#1 in autoincrement mode */ -PCMD(base, HACR_DEFAULT); -PCMD(base, HACR_DEFAULT); -outw(PIOR1(base), 0); /* go
svn commit: r274759 - head/sys/i386/isa
Author: jhb Date: Thu Nov 20 20:24:30 2014 New Revision: 274759 URL: https://svnweb.freebsd.org/changeset/base/274759 Log: Lock spic(4) and mark it MPSAFE: - Add a per-softc mutex as a driver lock. - Use callout(9) instead of timeout(9). - Set softc pointer in si_drv1 of cdev instead of looking softc up via devclass in cdev methods. Tested by:no one Modified: head/sys/i386/isa/spic.c Modified: head/sys/i386/isa/spic.c == --- head/sys/i386/isa/spic.cThu Nov 20 20:09:18 2014(r274758) +++ head/sys/i386/isa/spic.cThu Nov 20 20:24:30 2014(r274759) @@ -87,7 +87,6 @@ static d_poll_t spicpoll; static struct cdevsw spic_cdevsw = { .d_version =D_VERSION, - .d_flags = D_NEEDGIANT, .d_open = spicopen, .d_close = spicclose, .d_read = spicread, @@ -106,8 +105,10 @@ struct spic_softc { int sc_opened; int sc_sleeping; int sc_buttonlast; - struct callout_handle sc_timeout_ch; + struct callout sc_timeout; + struct mtx sc_lock; device_t sc_dev; + struct cdev *sc_cdev; struct selinfo sc_rsel; u_char sc_buf[SCBUFLEN]; int sc_count; @@ -337,6 +338,8 @@ spic_attach(device_t dev) sc = device_get_softc(dev); sc->sc_dev = dev; + mtx_init(&sc->sc_lock, "spic", NULL, MTX_DEF); + callout_init_mtx(&sc->sc_timeout, &sc->sc_lock, 0); spic_pollrate = (hz/50); /* Every 50th of a second */ @@ -345,7 +348,8 @@ spic_attach(device_t dev) spic_call1(sc, 0x92); /* There can be only one */ - make_dev(&spic_cdevsw, 0, 0, 0, 0600, "jogdial"); + sc->sc_cdev = make_dev(&spic_cdevsw, 0, 0, 0, 0600, "jogdial"); + sc->sc_cdev->si_drv1 = sc; return 0; } @@ -357,6 +361,7 @@ spictimeout(void *arg) u_char b, event, param; int j; + mtx_assert(&sc->sc_lock, MA_OWNED); if (!sc->sc_opened) { device_printf(sc->sc_dev, "timeout called while closed!\n"); return; @@ -426,7 +431,7 @@ spictimeout(void *arg) } else { /* No event. Wait some more */ - sc->sc_timeout_ch = timeout(spictimeout, sc, spic_pollrate); + callout_reset(&sc->sc_timeout, spic_pollrate, spictimeout, sc); return; } @@ -439,7 +444,7 @@ spictimeout(void *arg) } spic_call2(sc, 0x81, 0xff); /* Clear event */ - sc->sc_timeout_ch = timeout(spictimeout, sc, spic_pollrate); + callout_reset(&sc->sc_timeout, spic_pollrate, spictimeout, sc); } static int @@ -447,17 +452,21 @@ spicopen(struct cdev *dev, int flag, int { struct spic_softc *sc; - sc = devclass_get_softc(spic_devclass, 0); + sc = dev->si_drv1; - if (sc->sc_opened) - return EBUSY; + mtx_lock(&sc->sc_lock); + if (sc->sc_opened) { + mtx_unlock(&sc->sc_lock); + return (EBUSY); + } sc->sc_opened++; sc->sc_count=0; /* Start the polling */ - timeout(spictimeout, sc, spic_pollrate); - return 0; + callout_reset(&sc->sc_timeout, spic_pollrate, spictimeout, sc); + mtx_unlock(&sc->sc_lock); + return (0); } static int @@ -465,11 +474,13 @@ spicclose(struct cdev *dev, int flag, in { struct spic_softc *sc; - sc = devclass_get_softc(spic_devclass, 0); + sc = dev->si_drv1; + mtx_lock(&sc->sc_lock); /* Stop polling */ - untimeout(spictimeout, sc, sc->sc_timeout_ch); + callout_stop(&sc->sc_timeout); sc->sc_opened = 0; + mtx_unlock(&sc->sc_lock); return 0; } @@ -477,34 +488,31 @@ static int spicread(struct cdev *dev, struct uio *uio, int flag) { struct spic_softc *sc; - int l, s, error; + int l, error; u_char buf[SCBUFLEN]; - sc = devclass_get_softc(spic_devclass, 0); + sc = dev->si_drv1; if (uio->uio_resid <= 0) /* What kind of a read is this?! */ - return 0; + return (0); - s = spltty(); + mtx_lock(&sc->sc_lock); while (!(sc->sc_count)) { sc->sc_sleeping=1; - error = tsleep( sc, PZERO | PCATCH, "jogrea", 0); + error = mtx_sleep(sc, &sc->sc_lock, PZERO | PCATCH, "jogrea", 0); sc->sc_sleeping=0; if (error) { - splx(s); - return error; + mtx_unlock(&sc->sc_lock); + return (error); } } - splx(s); - s = spltty(); l = min(uio->uio_resid, sc->sc_count); bcopy(sc->sc_buf, buf, l); sc->sc_count -= l; bcopy(sc->sc_buf + l, sc->sc_buf, l); - splx(s);
svn commit: r274760 - in head/sys: cam/scsi dev/ct dev/ncv dev/nsp dev/stg
Author: jhb Date: Thu Nov 20 20:50:05 2014 New Revision: 274760 URL: https://svnweb.freebsd.org/changeset/base/274760 Log: Lock the scsi_low code and the drivers which use it along with other related cleanups: - Require each driver to initalize a mutex in the scsi_low_softc that is shared with the scsi_low code. This mutex is used for CAM SIMs, timers, and interrupt handlers. - Replace the osdep function switch with direct calls to the relevant CAM functions and direct manipulation of timers via callout(9). - Collapse the CAM-specific scsi_low_osdep_interface substructure directly into scsi_low_softc. - Use bus_*() instead of bus_space_*(). - Return BUS_PROBE_DEFAULT from probe routines instead of 0. - No need to zero softcs. - Pass 0ul and ~0ul instead of 0 and ~0 to bus_alloc_resource(). - Spell "dettach" as "detach". - Remove unused 'dvname' variables. - De-spl(). Tested by:no one Modified: head/sys/cam/scsi/scsi_low.c head/sys/cam/scsi/scsi_low.h head/sys/dev/ct/bshw_machdep.c head/sys/dev/ct/ct.c head/sys/dev/ct/ct_isa.c head/sys/dev/ct/ct_machdep.h head/sys/dev/ct/ctvar.h head/sys/dev/ncv/ncr53c500.c head/sys/dev/ncv/ncr53c500_pccard.c head/sys/dev/ncv/ncr53c500var.h head/sys/dev/nsp/nsp.c head/sys/dev/nsp/nsp_pccard.c head/sys/dev/nsp/nspvar.h head/sys/dev/stg/tmc18c30.c head/sys/dev/stg/tmc18c30_isa.c head/sys/dev/stg/tmc18c30_pccard.c head/sys/dev/stg/tmc18c30_pci.c head/sys/dev/stg/tmc18c30_subr.c head/sys/dev/stg/tmc18c30var.h Modified: head/sys/cam/scsi/scsi_low.c == --- head/sys/cam/scsi/scsi_low.cThu Nov 20 20:24:30 2014 (r274759) +++ head/sys/cam/scsi/scsi_low.cThu Nov 20 20:50:05 2014 (r274760) @@ -150,6 +150,8 @@ int scsi_low_version_major = 2; int scsi_low_version_minor = 17; static struct scsi_low_softc_tab sl_tab = LIST_HEAD_INITIALIZER(sl_tab); +static struct mtx sl_tab_lock; +MTX_SYSINIT(sl_tab_lock, &sl_tab_lock, "scsi low table", MTX_DEF); /** * Debug, Run test and Statics @@ -365,21 +367,10 @@ static void scsi_low_poll_cam(struct cam void scsi_low_scsi_action_cam(struct cam_sim *, union ccb *); static int scsi_low_attach_cam(struct scsi_low_softc *); -static int scsi_low_world_start_cam(struct scsi_low_softc *); -static int scsi_low_dettach_cam(struct scsi_low_softc *); +static int scsi_low_detach_cam(struct scsi_low_softc *); static int scsi_low_ccb_setup_cam(struct scsi_low_softc *, struct slccb *); static int scsi_low_done_cam(struct scsi_low_softc *, struct slccb *); -static void scsi_low_timeout_cam(struct scsi_low_softc *, int, int); -struct scsi_low_osdep_funcs scsi_low_osdep_funcs_cam = { - scsi_low_attach_cam, - scsi_low_world_start_cam, - scsi_low_dettach_cam, - scsi_low_ccb_setup_cam, - scsi_low_done_cam, - scsi_low_timeout_cam -}; - struct scsi_low_error_code scsi_low_error_code_cam[] = { {0, CAM_REQ_CMP}, {SENSEIO, CAM_AUTOSNS_VALID | CAM_REQ_CMP_ERR}, @@ -409,12 +400,13 @@ scsi_low_poll_cam(sim) { struct scsi_low_softc *slp = SIM2SLP(sim); + SCSI_LOW_ASSERT_LOCKED(slp); (*slp->sl_funcs->scsi_low_poll) (slp); - if (slp->sl_si.si_poll_count ++ >= + if (slp->sl_poll_count ++ >= SCSI_LOW_CAM_POLL_HZ / SCSI_LOW_TIMEOUT_HZ) { - slp->sl_si.si_poll_count = 0; + slp->sl_poll_count = 0; scsi_low_timeout_check(slp); } } @@ -429,8 +421,9 @@ scsi_low_scsi_action_cam(sim, ccb) struct lun_info *li; struct slccb *cb; u_int lun, flags, msg, target; - int s, rv; + int rv; + SCSI_LOW_ASSERT_LOCKED(slp); target = (u_int) (ccb->ccb_h.target_id); lun = (u_int) ccb->ccb_h.target_lun; @@ -469,7 +462,6 @@ scsi_low_scsi_action_cam(sim, ccb) else flags = CCB_SCSIIO; - s = splcam(); li = scsi_low_alloc_li(ti, lun, 1); if (ti->ti_setup_msg != 0) @@ -485,7 +477,6 @@ scsi_low_scsi_action_cam(sim, ccb) scsi_low_test_abort(slp, ti, li); } #endif /* SCSI_LOW_DEBUG */ - splx(s); break; case XPT_EN_LUN:/* Enable LUN as a target */ @@ -508,10 +499,8 @@ scsi_low_scsi_action_cam(sim, ccb) } #endif /* SCSI_LOW_DIAGNOSTIC */ - s = splcam(); cb = scsi_low_find_ccb(slp, target, lun, ccb->cab.abort_ccb); rv = scsi_low_abort_ccb(slp, cb); - splx(s); if (rv == 0) ccb->ccb_h.status = CAM_REQ_CMP; @@ -540,7 +529,6 @@ scsi_low_scsi_action_cam(sim, ccb) if (lun ==
Re: svn commit: r274672 - in head/contrib/libxo: . libxo xolint
On Wed, Nov 19, 2014 at 8:07 AM, Marcel Moolenaar wrote: > > Patches for netstat can be found here: > https://github.com/Juniper/libxo/blob/master/patches/netstat.patch > > Let me know if it contains the answer to your question. > > I should be able to commit netstat shortly. > Will you be committing the patches for vmstat at about the same time? Last year at BayLisa, Alfred gave a presentation ( https://www.youtube.com/watch?v=xBuyvEddI7U ) mentioning work he did to modify certain utilities in FreeBSD so that they could output information in a format that could be parsed by higher level tools ( https://github.com/splbio/eagleeye ). Converting these (and other) utilities to use libxo will make it a lot easier to write analysis tools like eagleeye. -- Craig ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r274661 - in head/sys: conf geom/part modules/geom/geom_part/geom_part_bsd
On Nov 20, 2014, at 10:43 AM, Andrey V. Elsukov wrote: > On 20.11.2014 20:23, Warner Losh wrote: >>> since there are some reports about strange behavior of old utilities >>> after this commit, maybe we won't repair them by this way? >>> What you think about this path? >> >> It doesn’t thrill me. What’s it trying to do? And localizing it to fsck is >> useless. And where >> are these reports? > > I already committed it in r274750. > GEOM_PART class can return partition type via "PART::type" attribute. > Now fsck uses it and runs fsck_ffs or fsck_msdosfs depending from the > partition type. Why did you even ask me and then commit? Grump. Warner signature.asc Description: Message signed with OpenPGP using GPGMail
Re: svn commit: r274661 - in head/sys: conf geom/part modules/geom/geom_part/geom_part_bsd
On Nov 20, 2014, at 2:14 PM, Warner Losh wrote: > > On Nov 20, 2014, at 10:43 AM, Andrey V. Elsukov wrote: > >> On 20.11.2014 20:23, Warner Losh wrote: since there are some reports about strange behavior of old utilities after this commit, maybe we won't repair them by this way? What you think about this path? >>> >>> It doesn’t thrill me. What’s it trying to do? And localizing it to fsck is >>> useless. And where >>> are these reports? >> >> I already committed it in r274750. >> GEOM_PART class can return partition type via "PART::type" attribute. >> Now fsck uses it and runs fsck_ffs or fsck_msdosfs depending from the >> partition type. > > Why did you even ask me and then commit? > > > > Grump. And seeing that it was verbatim, I am likely going to back it. Why did you jump into fix a problem I was fixing in such a bogus way. Warner signature.asc Description: Message signed with OpenPGP using GPGMail
svn commit: r274761 - head/sbin/fsck
Author: imp Date: Thu Nov 20 21:18:19 2014 New Revision: 274761 URL: https://svnweb.freebsd.org/changeset/base/274761 Log: Back our r274750 until discussions on proper fix are over. Modified: head/sbin/fsck/fsck.c Modified: head/sbin/fsck/fsck.c == --- head/sbin/fsck/fsck.c Thu Nov 20 20:50:05 2014(r274760) +++ head/sbin/fsck/fsck.c Thu Nov 20 21:18:19 2014(r274761) @@ -41,7 +41,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#define FSTYPENAMES +#include #include #include @@ -80,21 +81,10 @@ static void addentry(struct fstypelist * static void maketypelist(char *); static void catopt(char **, const char *); static void mangle(char *, int *, const char ** volatile *, int *); -static const char *getfstype(const char *); +static const char *getfslab(const char *); static void usage(void) __dead2; static int isok(struct fstab *); -static struct { - const char *ptype; - const char *name; -} ptype_map[] = { - { "ufs","ffs" }, - { "ffs","ffs" }, - { "fat","msdosfs" }, - { "efi","msdosfs" }, - { NULL, NULL }, -}; - int main(int argc, char *argv[]) { @@ -213,7 +203,7 @@ main(int argc, char *argv[]) if ((fs = getfsfile(spec)) == NULL && (fs = getfsspec(spec)) == NULL) { if (vfstype == NULL) - vfstype = getfstype(spec); + vfstype = getfslab(spec); if (vfstype == NULL) errx(1, "Could not determine filesystem type"); type = vfstype; @@ -545,27 +535,41 @@ mangle(char *opts, int *argcp, const cha *maxargcp = maxargc; } + static const char * -getfstype(const char *str) +getfslab(const char *str) { - struct diocgattr_arg attr; - int fd, i; + struct disklabel dl; + int fd; + char p; + const char *vfstype; + u_char t; + /* deduce the file system type from the disk label */ if ((fd = open(str, O_RDONLY)) == -1) err(1, "cannot open `%s'", str); - strncpy(attr.name, "PART::type", sizeof(attr.name)); - memset(&attr.value, 0, sizeof(attr.value)); - attr.len = sizeof(attr.value); - if (ioctl(fd, DIOCGATTR, &attr) == -1) { + if (ioctl(fd, DIOCGDINFO, &dl) == -1) { (void) close(fd); return(NULL); } + (void) close(fd); - for (i = 0; ptype_map[i].ptype != NULL; i++) - if (strstr(attr.value.str, ptype_map[i].ptype) != NULL) - return (ptype_map[i].name); - return (NULL); + + p = str[strlen(str) - 1]; + + if ((p - 'a') >= dl.d_npartitions) + errx(1, "partition `%s' is not defined on disk", str); + + if ((t = dl.d_partitions[p - 'a'].p_fstype) >= FSMAXTYPES) + errx(1, "partition `%s' is not of a legal vfstype", + str); + + if ((vfstype = fstypenames[t]) == NULL) + errx(1, "vfstype `%s' on partition `%s' is not supported", + fstypenames[t], str); + + return vfstype; } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r274672 - in head/contrib/libxo: . libxo xolint
> On Nov 20, 2014, at 1:10 PM, Craig Rodrigues wrote: > > > > On Wed, Nov 19, 2014 at 8:07 AM, Marcel Moolenaar wrote: > > Patches for netstat can be found here: > https://github.com/Juniper/libxo/blob/master/patches/netstat.patch > > Let me know if it contains the answer to your question. > > I should be able to commit netstat shortly. > > Will you be committing the patches for vmstat at about the same time? I'll work on vmstat as well, yes. Feel free to help out if you want it done ASAP. -- Marcel Moolenaar mar...@xcllnt.net ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r274661 - in head/sys: conf geom/part modules/geom/geom_part/geom_part_bsd
On 21.11.2014 00:16, Warner Losh wrote: >>> I already committed it in r274750. GEOM_PART class can return >>> partition type via "PART::type" attribute. Now fsck uses it and >>> runs fsck_ffs or fsck_msdosfs depending from the partition type. >> >> Why did you even ask me and then commit? >> >> > it> I did the tests and it works for ufs and msdosfs. > And seeing that it was verbatim, I am likely going to back it. Why > did you jump into fix a problem I was fixing in such a bogus way. Your fix isn't complete. It works only for bsdlabels with 8 partitions. -- WBR, Andrey V. Elsukov signature.asc Description: OpenPGP digital signature
Re: svn commit: r274745 - head/share/man/man9
On Thu, Nov 20, 2014 at 09:56:34AM +, Craig Rodrigues wrote: C> Author: rodrigc C> Date: Thu Nov 20 09:56:34 2014 C> New Revision: 274745 C> URL: https://svnweb.freebsd.org/changeset/base/274745 C> C> Log: C> MFp4: @179066 C> C> Add page which describes VNET network stack virtualization infrastructure. C> C> Submitted by: bz C> Sponsored by: The FreeBSD Foundation C> Sponsored by: CK Software GmbH C> C> Added: C> head/share/man/man9/vnet.9 (contents, props changed) C> Modified: C> head/share/man/man9/Makefile Thanks a lot for that, Craig and Bjoern! May be it is worth adding MILNKS for vimage.9, what do you think? -- Totus tuus, Glebius. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r274766 - head/sys/dev/hwpmc
Author: emaste Date: Thu Nov 20 23:16:19 2014 New Revision: 274766 URL: https://svnweb.freebsd.org/changeset/base/274766 Log: Clamp too-large hwpmc callchaindepth to the maximum If the depth requested by the user is too large, it's better to provide the maximum than the smaller default. Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/hwpmc/hwpmc_mod.c Modified: head/sys/dev/hwpmc/hwpmc_mod.c == --- head/sys/dev/hwpmc/hwpmc_mod.c Thu Nov 20 23:00:17 2014 (r274765) +++ head/sys/dev/hwpmc/hwpmc_mod.c Thu Nov 20 23:16:19 2014 (r274766) @@ -4749,8 +4749,9 @@ pmc_initialize(void) if (pmc_callchaindepth <= 0 || pmc_callchaindepth > PMC_CALLCHAIN_DEPTH_MAX) { (void) printf("hwpmc: tunable \"callchaindepth\"=%d out of " - "range.\n", pmc_callchaindepth); - pmc_callchaindepth = PMC_CALLCHAIN_DEPTH; + "range - using %d.\n", pmc_callchaindepth, + PMC_CALLCHAIN_DEPTH_MAX); + pmc_callchaindepth = PMC_CALLCHAIN_DEPTH_MAX; } md = pmc_md_initialize(); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r274770 - head/sbin/fsck
Author: imp Date: Fri Nov 21 01:43:55 2014 New Revision: 274770 URL: https://svnweb.freebsd.org/changeset/base/274770 Log: Recommit r274750. Modified: head/sbin/fsck/fsck.c Modified: head/sbin/fsck/fsck.c == --- head/sbin/fsck/fsck.c Fri Nov 21 01:27:27 2014(r274769) +++ head/sbin/fsck/fsck.c Fri Nov 21 01:43:55 2014(r274770) @@ -41,8 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define FSTYPENAMES -#include +#include #include #include @@ -81,10 +80,21 @@ static void addentry(struct fstypelist * static void maketypelist(char *); static void catopt(char **, const char *); static void mangle(char *, int *, const char ** volatile *, int *); -static const char *getfslab(const char *); +static const char *getfstype(const char *); static void usage(void) __dead2; static int isok(struct fstab *); +static struct { + const char *ptype; + const char *name; +} ptype_map[] = { + { "ufs","ffs" }, + { "ffs","ffs" }, + { "fat","msdosfs" }, + { "efi","msdosfs" }, + { NULL, NULL }, +}; + int main(int argc, char *argv[]) { @@ -203,7 +213,7 @@ main(int argc, char *argv[]) if ((fs = getfsfile(spec)) == NULL && (fs = getfsspec(spec)) == NULL) { if (vfstype == NULL) - vfstype = getfslab(spec); + vfstype = getfstype(spec); if (vfstype == NULL) errx(1, "Could not determine filesystem type"); type = vfstype; @@ -535,41 +545,27 @@ mangle(char *opts, int *argcp, const cha *maxargcp = maxargc; } - static const char * -getfslab(const char *str) +getfstype(const char *str) { - struct disklabel dl; - int fd; - char p; - const char *vfstype; - u_char t; + struct diocgattr_arg attr; + int fd, i; - /* deduce the file system type from the disk label */ if ((fd = open(str, O_RDONLY)) == -1) err(1, "cannot open `%s'", str); - if (ioctl(fd, DIOCGDINFO, &dl) == -1) { + strncpy(attr.name, "PART::type", sizeof(attr.name)); + memset(&attr.value, 0, sizeof(attr.value)); + attr.len = sizeof(attr.value); + if (ioctl(fd, DIOCGATTR, &attr) == -1) { (void) close(fd); return(NULL); } - (void) close(fd); - - p = str[strlen(str) - 1]; - - if ((p - 'a') >= dl.d_npartitions) - errx(1, "partition `%s' is not defined on disk", str); - - if ((t = dl.d_partitions[p - 'a'].p_fstype) >= FSMAXTYPES) - errx(1, "partition `%s' is not of a legal vfstype", - str); - - if ((vfstype = fstypenames[t]) == NULL) - errx(1, "vfstype `%s' on partition `%s' is not supported", - fstypenames[t], str); - - return vfstype; + for (i = 0; ptype_map[i].ptype != NULL; i++) + if (strstr(attr.value.str, ptype_map[i].ptype) != NULL) + return (ptype_map[i].name); + return (NULL); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r274772 - in head: lib/libc/gen lib/libc/include lib/libc/sys lib/libkiconv lib/libmd lib/libthr/thread lib/msun/src libexec/rtld-elf sys/amd64/include sys/arm/include sys/i386/include ...
Author: emaste Date: Fri Nov 21 02:05:48 2014 New Revision: 274772 URL: https://svnweb.freebsd.org/changeset/base/274772 Log: Use canonical __PIC__ flag It is automatically set when -fPIC is passed to the compiler. Reviewed by: dim, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D1179 Modified: head/lib/libc/gen/errlst.c head/lib/libc/gen/isnan.c head/lib/libc/gen/tls.c head/lib/libc/include/errlst.h head/lib/libc/sys/stack_protector.c head/lib/libc/sys/stack_protector_compat.c head/lib/libkiconv/quirks.c head/lib/libkiconv/xlat16_iconv.c head/lib/libkiconv/xlat16_sysctl.c head/lib/libmd/rmd160c.c head/lib/libmd/sha1c.c head/lib/libthr/thread/thr_exit.c head/lib/libthr/thread/thr_private.h head/lib/msun/src/s_isnan.c head/libexec/rtld-elf/rtld.c head/sys/amd64/include/asm.h head/sys/arm/include/asm.h head/sys/i386/include/asm.h head/sys/powerpc/include/asm.h head/sys/powerpc/include/profile.h head/sys/sparc64/include/asm.h Modified: head/lib/libc/gen/errlst.c == --- head/lib/libc/gen/errlst.c Fri Nov 21 01:53:40 2014(r274771) +++ head/lib/libc/gen/errlst.c Fri Nov 21 02:05:48 2014(r274772) @@ -158,7 +158,7 @@ const char *const sys_errlist[] = { }; const int sys_nerr = sizeof(sys_errlist) / sizeof(sys_errlist[0]); -#ifdef PIC +#ifdef __PIC__ __strong_reference(sys_errlist, __hidden_sys_errlist); __strong_reference(sys_nerr, __hidden_sys_nerr); #endif Modified: head/lib/libc/gen/isnan.c == --- head/lib/libc/gen/isnan.c Fri Nov 21 01:53:40 2014(r274771) +++ head/lib/libc/gen/isnan.c Fri Nov 21 02:05:48 2014(r274772) @@ -40,7 +40,7 @@ * time, when calling both functions. */ -#ifdef PIC +#ifdef __PIC__ __weak_reference(__isnan, isnan); __weak_reference(__isnanf, isnanf); @@ -61,4 +61,4 @@ __isnanf(float f) u.f = f; return (u.bits.exp == 255 && u.bits.man != 0); } -#endif /* PIC */ +#endif /* __PIC__ */ Modified: head/lib/libc/gen/tls.c == --- head/lib/libc/gen/tls.c Fri Nov 21 01:53:40 2014(r274771) +++ head/lib/libc/gen/tls.c Fri Nov 21 02:05:48 2014(r274772) @@ -78,7 +78,7 @@ void __libc_free_tls(void *tls, size_t t #define TLS_VARIANT_II #endif -#ifndef PIC +#ifndef __PIC__ #define round(size, align) \ (((size) + (align) - 1) & ~((align) - 1)) @@ -107,7 +107,7 @@ __libc_tls_get_addr(void *ti __unused) return (0); } -#ifndef PIC +#ifndef __PIC__ #ifdef TLS_VARIANT_I @@ -264,14 +264,14 @@ __libc_free_tls(void *tcb __unused, size { } -#endif /* PIC */ +#endif /* __PIC__ */ extern char **environ; void _init_tls() { -#ifndef PIC +#ifndef __PIC__ Elf_Addr *sp; Elf_Auxinfo *aux, *auxp; Elf_Phdr *phdr; Modified: head/lib/libc/include/errlst.h == --- head/lib/libc/include/errlst.h Fri Nov 21 01:53:40 2014 (r274771) +++ head/lib/libc/include/errlst.h Fri Nov 21 02:05:48 2014 (r274772) @@ -31,7 +31,7 @@ #include -#ifdef PIC +#ifdef __PIC__ /* If the main executable imports these, do not use its copy from libc.so. */ extern const char *const __hidden_sys_errlist[] __hidden; extern const int __hidden_sys_nerr __hidden; Modified: head/lib/libc/sys/stack_protector.c == --- head/lib/libc/sys/stack_protector.c Fri Nov 21 01:53:40 2014 (r274771) +++ head/lib/libc/sys/stack_protector.c Fri Nov 21 02:05:48 2014 (r274772) @@ -115,6 +115,6 @@ __chk_fail(void) __fail("buffer overflow detected; terminated"); } -#ifndef PIC +#ifndef __PIC__ __weak_reference(__stack_chk_fail, __stack_chk_fail_local); #endif Modified: head/lib/libc/sys/stack_protector_compat.c == --- head/lib/libc/sys/stack_protector_compat.c Fri Nov 21 01:53:40 2014 (r274771) +++ head/lib/libc/sys/stack_protector_compat.c Fri Nov 21 02:05:48 2014 (r274772) @@ -8,7 +8,7 @@ __FBSDID("$FreeBSD$"); void __stack_chk_fail(void); -#ifdef PIC +#ifdef __PIC__ void __stack_chk_fail_local_hidden(void) { Modified: head/lib/libkiconv/quirks.c == --- head/lib/libkiconv/quirks.c Fri Nov 21 01:53:40 2014(r274771) +++ head/lib/libkiconv/quirks.c Fri Nov 21 02:05:48 2014(r274772) @@ -31,7 +31,7 @@ * when statically linked. */ -#ifdef PIC +#ifdef __PIC__ /* * Why do we need quirks? @@ -193,4 +193,4 @@ kiconv_quirkcs(const char* base __unused return (base); } -#endif /
svn commit: r274776 - head/sys/powerpc/powerpc
Author: jhibbits Date: Fri Nov 21 02:45:39 2014 New Revision: 274776 URL: https://svnweb.freebsd.org/changeset/base/274776 Log: Fix the powerpc64 build. Pointy-hat to:me X-MFC-with: r274735 Modified: head/sys/powerpc/powerpc/db_trace.c Modified: head/sys/powerpc/powerpc/db_trace.c == --- head/sys/powerpc/powerpc/db_trace.c Fri Nov 21 02:30:37 2014 (r274775) +++ head/sys/powerpc/powerpc/db_trace.c Fri Nov 21 02:45:39 2014 (r274776) @@ -263,7 +263,7 @@ db_backtrace(struct thread *td, db_addr_ print_trap: lr = (db_addr_t) tf->srr0; db_printsym(lr, DB_STGY_ANY); - db_printf(": srr1=%#x\n", tf->srr1); + db_printf(": srr1=%#zx\n", tf->srr1); db_printf("%-10s r1=%#zx cr=%#x xer=%#x ctr=%#zx", "", tf->fixreg[1], (uint32_t)tf->cr, (uint32_t)tf->xer, tf->ctr); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r274167 - in head/sys: kern sys
On Nov 6, 2014, at 00:12, Mateusz Guzik wrote: > > Author: mjg > Date: Thu Nov 6 08:12:34 2014 > New Revision: 274167 > URL: https://svnweb.freebsd.org/changeset/base/274167 > > Log: > Add sysctl kern.proc.cwd > > It returns only current working directory of given process which saves a lot > of > overhead over kern.proc.filedesc if given proc has a lot of open fds. > > Submitted by:Tiwei Bie (slightly modified) > X-Additional:JuniorJobs project > > Modified: > head/sys/kern/kern_descrip.c > head/sys/sys/sysctl.h > head/sys/sys/user.h > > Modified: head/sys/kern/kern_descrip.c > == > --- head/sys/kern/kern_descrip.c Thu Nov 6 07:44:10 2014 > (r274166) > +++ head/sys/kern/kern_descrip.c Thu Nov 6 08:12:34 2014 > (r274167) > @@ -3406,6 +3406,73 @@ static SYSCTL_NODE(_kern_proc, KERN_PROC > CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc_filedesc, > "Process filedesc entries"); > > +/* > + * Store a process current working directory information to sbuf. > + * > + * Takes a locked proc as argument, and returns with the proc unlocked. I never really liked this approach because it makes it harder to see the locking pattern. Why not call fdhold(p) in the sysctl handler, unlock the process, call kern_proc_cwd_out() with an additional fdp argument, and then call fddrop()? -- Rui Paulo ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r274167 - in head/sys: kern sys
On Thu, Nov 20, 2014 at 09:24:37PM -0800, Rui Paulo wrote: > On Nov 6, 2014, at 00:12, Mateusz Guzik wrote: > > > > Author: mjg > > Date: Thu Nov 6 08:12:34 2014 > > New Revision: 274167 > > URL: https://svnweb.freebsd.org/changeset/base/274167 > > > > Log: > > Add sysctl kern.proc.cwd > > > > It returns only current working directory of given process which saves a > > lot of > > overhead over kern.proc.filedesc if given proc has a lot of open fds. > > > > Submitted by: Tiwei Bie (slightly modified) > > X-Additional: JuniorJobs project > > > > Modified: > > head/sys/kern/kern_descrip.c > > head/sys/sys/sysctl.h > > head/sys/sys/user.h > > > > Modified: head/sys/kern/kern_descrip.c > > == > > --- head/sys/kern/kern_descrip.cThu Nov 6 07:44:10 2014 > > (r274166) > > +++ head/sys/kern/kern_descrip.cThu Nov 6 08:12:34 2014 > > (r274167) > > @@ -3406,6 +3406,73 @@ static SYSCTL_NODE(_kern_proc, KERN_PROC > > CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc_filedesc, > > "Process filedesc entries"); > > > > +/* > > + * Store a process current working directory information to sbuf. > > + * > > + * Takes a locked proc as argument, and returns with the proc unlocked. > > I never really liked this approach because it makes it harder to see the > locking pattern. > > Why not call fdhold(p) in the sysctl handler, unlock the process, call > kern_proc_cwd_out() with an additional fdp argument, and then call fddrop()? > This code just mimics what was done with kern_proc_filedesc_out, which happens to have semi-valid usecase when fdhold returns NULL. In general I agree and this scheme is going away. I have a patch in my backlog which "pins" the process (i.e. prevents exec and exit) for the duration of kern_proc_filedesc_out/whatever, so it will effectively mean such functions will no longer play with fdhold/fddrop. Interestingly enough this requires some changes in devfs and I didn't have the time to ensure they work properly. -- Mateusz Guzik ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r274784 - head/sys/fs/smbfs
Author: trasz Date: Fri Nov 21 06:21:39 2014 New Revision: 274784 URL: https://svnweb.freebsd.org/changeset/base/274784 Log: Fix smbfs to not zero out statfs f_flags field. Previously, this made getmntinfo() return empty flags for smbfs filesystems when called with MNT_WAIT. It's not visible with mount(8), since it uses MNT_NOWAIT, but broke autounmount(8) operation. PR: 195161 Differential Revision:https://reviews.freebsd.org/D1194 Reviewed by: kib@ MFC after:1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/fs/smbfs/smbfs_vfsops.c Modified: head/sys/fs/smbfs/smbfs_vfsops.c == --- head/sys/fs/smbfs/smbfs_vfsops.cFri Nov 21 03:22:22 2014 (r274783) +++ head/sys/fs/smbfs/smbfs_vfsops.cFri Nov 21 06:21:39 2014 (r274784) @@ -401,8 +401,6 @@ smbfs_statfs(struct mount *mp, struct st scred = smbfs_malloc_scred(); smb_makescred(scred, td, td->td_ucred); error = smbfs_smb_statfs(ssp, sbp, scred); - if (error == 0) - sbp->f_flags = 0; /* copy of mount exported flags */ smbfs_free_scred(scred); return (error); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r274785 - head/sys/cam/ctl
Author: mav Date: Fri Nov 21 06:27:37 2014 New Revision: 274785 URL: https://svnweb.freebsd.org/changeset/base/274785 Log: Partially reconstruct Active/Standby clusting. In this mode one head is in Active state, supporting all commands, while another is in Standby state, supporting only minimal LUN discovery subset. It is still incomplete since Standby state requires reservation support, which is impossible to do right without having interlink between heads. But it allows to run some basic experiments. Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_cmd_table.c head/sys/cam/ctl/ctl_frontend.c head/sys/cam/ctl/ctl_frontend.h head/sys/cam/ctl/ctl_frontend_cam_sim.c head/sys/cam/ctl/ctl_frontend_internal.c head/sys/cam/ctl/ctl_frontend_iscsi.c head/sys/cam/ctl/ctl_ha.h head/sys/cam/ctl/ctl_private.h head/sys/cam/ctl/ctl_tpc_local.c head/sys/cam/ctl/scsi_ctl.c Modified: head/sys/cam/ctl/ctl.c == --- head/sys/cam/ctl/ctl.c Fri Nov 21 06:21:39 2014(r274784) +++ head/sys/cam/ctl/ctl.c Fri Nov 21 06:27:37 2014(r274785) @@ -357,7 +357,6 @@ static struct ctl_logical_block_provisio static int rcv_sync_msg; static int persis_offset; static uint8_t ctl_pause_rtr; -static int ctl_is_single = 1; SYSCTL_NODE(_kern_cam, OID_AUTO, ctl, CTLFLAG_RD, 0, "CAM Target Layer"); static int worker_threads = -1; @@ -970,12 +969,42 @@ ctl_copy_sense_data(union ctl_ha_msg *sr } static int +ctl_ha_state_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct ctl_softc *softc = (struct ctl_softc *)arg1; + struct ctl_lun *lun; + int error, value, i; + + if (softc->flags & CTL_FLAG_ACTIVE_SHELF) + value = 0; + else + value = 1; + + error = sysctl_handle_int(oidp, &value, 0, req); + if ((error != 0) || (req->newptr == NULL)) + return (error); + + mtx_lock(&softc->ctl_lock); + if (value == 0) + softc->flags |= CTL_FLAG_ACTIVE_SHELF; + else + softc->flags &= ~CTL_FLAG_ACTIVE_SHELF; + STAILQ_FOREACH(lun, &softc->lun_list, links) { + mtx_lock(&lun->lun_lock); + for (i = 0; i < CTL_MAX_INITIATORS; i++) + lun->pending_ua[i] |= CTL_UA_ASYM_ACC_CHANGE; + mtx_unlock(&lun->lun_lock); + } + mtx_unlock(&softc->ctl_lock); + return (0); +} + +static int ctl_init(void) { struct ctl_softc *softc; struct ctl_io_pool *internal_pool, *emergency_pool, *other_pool; struct ctl_port *port; -uint8_t sc_id =0; int i, error, retval; //int isc_retval; @@ -1033,16 +1062,17 @@ ctl_init(void) * In Copan's HA scheme, the "master" and "slave" roles are * figured out through the slot the controller is in. Although it * is an active/active system, someone has to be in charge. -*/ -#ifdef NEEDTOPORT -scmicro_rw(SCMICRO_GET_SHELF_ID, &sc_id); -#endif - -if (sc_id == 0) { - softc->flags |= CTL_FLAG_MASTER_SHELF; - persis_offset = 0; +*/ + SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "ha_id", CTLFLAG_RDTUN, &softc->ha_id, 0, + "HA head ID (0 - no HA)"); + if (softc->ha_id == 0) { + softc->flags |= CTL_FLAG_ACTIVE_SHELF; + softc->is_single = 1; + softc->port_offset = 0; } else - persis_offset = CTL_MAX_INITIATORS; + softc->port_offset = (softc->ha_id - 1) * CTL_MAX_PORTS; + persis_offset = softc->port_offset * CTL_MAX_INIT_PER_PORT; /* * XXX KDM need to figure out where we want to get our target ID @@ -1155,12 +1185,15 @@ ctl_init(void) port->max_targets = 15; port->max_target_id = 15; - if (ctl_port_register(&softc->ioctl_info.port, - (softc->flags & CTL_FLAG_MASTER_SHELF)) != 0) { + if (ctl_port_register(&softc->ioctl_info.port) != 0) { printf("ctl: ioctl front end registration failed, will " "continue anyway\n"); } + SYSCTL_ADD_PROC(&softc->sysctl_ctx,SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "ha_state", CTLTYPE_INT | CTLFLAG_RWTUN, + softc, 0, ctl_ha_state_sysctl, "I", "HA state for this head"); + #ifdef CTL_IO_DELAY if (sizeof(struct callout) > CTL_TIMER_BYTES) { printf("sizeof(struct callout) %zd > CTL_TIMER_BYTES %zd\n", @@ -1262,10 +1295,10 @@ ctl_close(struct cdev *dev, int flags, i int ctl_port_enable(ctl_port_type port_type) { - struct ctl_softc *softc; + struct ctl_softc *softc = control_softc; struct ctl_port *port; - if (ctl_is_single == 0) { + if (softc->is_single == 0) { union ctl_ha_
Re: svn commit: r274489 - in head/sys/amd64: amd64 include
On Nov 13, 2014, at 14:11, Scott Long wrote: > > Author: scottl > Date: Thu Nov 13 22:11:44 2014 > New Revision: 274489 > URL: https://svnweb.freebsd.org/changeset/base/274489 > > Log: > Extend earlier addition of stack frames to most of support.S. This makes > stack traces in KDB, HWPMC, and DTrace much more reliable and useful. No performance differences? The kernel enables/disables the compiler option to omit the frame pointer based on the kernel config file. If DDB, DTrace, or HWPMC is enabled, the frame pointer is always saved in C functions. Some of these functions are in the hot path, so if you didn't see any performance problem, I wonder if we should disable -fomit-frame-pointer always. -- Rui Paulo ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"