svn commit: r273633 - head/tools/regression/zfs/zpool/create
Author: ngie Date: Sat Oct 25 07:20:46 2014 New Revision: 273633 URL: https://svnweb.freebsd.org/changeset/base/273633 Log: Bail out of the script on FreeBSD due to deterministic panic issue PR: 194589 Sponsored by: EMC / Isilon Storage Division Modified: head/tools/regression/zfs/zpool/create/files.t Modified: head/tools/regression/zfs/zpool/create/files.t == --- head/tools/regression/zfs/zpool/create/files.t Sat Oct 25 06:33:00 2014(r273632) +++ head/tools/regression/zfs/zpool/create/files.t Sat Oct 25 07:20:46 2014(r273633) @@ -4,6 +4,8 @@ dir=`dirname $0` . ${dir}/../../misc.sh +[ "${os}" = "FreeBSD" ] && die "panics FreeBSD; see bug # 194589" + echo "1..59" files_create 5 ___ 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: r273598 - in head: include sys/dev/acpica
On Fri, Oct 24, 2014 at 10:45:46PM +0300, Konstantin Belousov wrote: > On Fri, Oct 24, 2014 at 07:33:07PM +, Rui Paulo wrote: > > On Oct 24, 2014, at 12:20 PM, Konstantin Belousov > > wrote: > > > > > +static int > > > +hpet_mmap(struct cdev *cdev, vm_ooffset_t offset, vm_paddr_t *paddr, > > > + int nprot, vm_memattr_t *memattr) > > > +{ > > > + struct hpet_softc *sc; > > > + > > > + sc = cdev->si_drv1; > > > + if (offset > rman_get_size(sc->mem_res)) > > > + return (EINVAL); > > > + if (!sc->mmap_allow_write && (nprot & PROT_WRITE)) > > > + return (EPERM); > > > + *paddr = rman_get_start(sc->mem_res) + offset; > > What is the memattr for the backing page ? Is it set to non-cached > > mode somehow ? I was not able to find place where would this happen. > > > > I expect it to be set to non-cached since it's a device anyway, but I don't > > know where it is. During my testing, I did not see any problems with > > cached values, though. > > > I am not claiming that it is wrong, only that I do not see an easy reason > why it is right. Just printing the *memattr would provide the confidence. > Ok, I did looked at the pte of the HPET page. I get the value 0x8000fed00025 which coincides with the resource address 0xfed0 reported by devinfo -vr for hpet (to double-check my findings). The low bits indicate that PAT0 pat entry is used for the page caching mode. Corresponding PAT MSR 0x277 has the following value: sandy% sudo cpucontrol -m 0x277 /dev/cpuctl0 MSR 0x277: 0x00010506 0x00070406 i.e. memory type is 6, which is write-back, according to SDM. This is wrong, as I feared. The patch below fixes the issue. The pte for HPET page is equal to 0x8000fed0003d after the patch is applied, PAT3 is used, and its value is 0 == UNCACHEABLE, as it must be. Do you agree with the patch ? diff --git a/sys/dev/acpica/acpi_hpet.c b/sys/dev/acpica/acpi_hpet.c index 6b35f5c..0da8bae 100644 --- a/sys/dev/acpica/acpi_hpet.c +++ b/sys/dev/acpica/acpi_hpet.c @@ -356,6 +356,7 @@ hpet_mmap(struct cdev *cdev, vm_ooffset_t offset, vm_paddr_t *paddr, if (!sc->mmap_allow_write && (nprot & PROT_WRITE)) return (EPERM); *paddr = rman_get_start(sc->mem_res) + offset; + *memattr = VM_MEMATTR_UNCACHEABLE; return (0); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r273634 - head/sys/netinet
Author: tuexen Date: Sat Oct 25 09:25:29 2014 New Revision: 273634 URL: https://svnweb.freebsd.org/changeset/base/273634 Log: Fix a use of an uninitialized variable by makeing sure that sctp_med_chunk_output() always initialized the reason_code instead of relying on the caller. The variable is only used for debugging purpose. This issue was reported by Peter Bostroem from Google. MFC after: 3 days Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Sat Oct 25 07:20:46 2014 (r273633) +++ head/sys/netinet/sctp_output.c Sat Oct 25 09:25:29 2014 (r273634) @@ -6748,7 +6748,7 @@ sctp_sendall_iterator(struct sctp_inpcb if (do_chunk_output) sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_USR_SEND, SCTP_SO_NOT_LOCKED); else if (added_control) { - int num_out = 0, reason = 0, now_filled = 0; + int num_out, reason, now_filled = 0; struct timeval now; int frag_point; @@ -7814,6 +7814,7 @@ sctp_med_chunk_output(struct sctp_inpcb int quit_now = 0; *num_out = 0; + *reason_code = 0; auth_keyid = stcb->asoc.authinfo.active_keyid; if ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) || (asoc->state & SCTP_STATE_SHUTDOWN_RECEIVED) || @@ -9945,7 +9946,7 @@ sctp_chunk_output(struct sctp_inpcb *inp */ struct sctp_association *asoc; struct sctp_nets *net; - int error = 0, num_out = 0, tot_out = 0, ret = 0, reason_code = 0; + int error = 0, num_out, tot_out = 0, ret = 0, reason_code; unsigned int burst_cnt = 0; struct timeval now; int now_filled = 0; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r273635 - head/usr.sbin/ctld
Author: mav Date: Sat Oct 25 12:50:26 2014 New Revision: 273635 URL: https://svnweb.freebsd.org/changeset/base/273635 Log: Add basic iSNS client to the iSCSI target. This makes ctld(8) register its iSCSI targets and portals on configured iSNS servers to allow initiators find them without active discovery. Fetching of allowed initiators from iSNS is not implemented now, so target ACLs still should be configured manually. Reviewed by: trasz@ MFC after:1 month Sponsored by: iXsystems, Inc. Added: head/usr.sbin/ctld/isns.c (contents, props changed) head/usr.sbin/ctld/isns.h (contents, props changed) Modified: head/usr.sbin/ctld/Makefile head/usr.sbin/ctld/ctl.conf.5 head/usr.sbin/ctld/ctld.c head/usr.sbin/ctld/ctld.h head/usr.sbin/ctld/parse.y head/usr.sbin/ctld/token.l Modified: head/usr.sbin/ctld/Makefile == --- head/usr.sbin/ctld/Makefile Sat Oct 25 09:25:29 2014(r273634) +++ head/usr.sbin/ctld/Makefile Sat Oct 25 12:50:26 2014(r273635) @@ -1,7 +1,8 @@ # $FreeBSD$ PROG= ctld -SRCS= chap.c ctld.c discovery.c kernel.c keys.c log.c login.c parse.y pdu.c token.l y.tab.h +SRCS= chap.c ctld.c discovery.c isns.c kernel.c keys.c log.c +SRCS+= login.c parse.y pdu.c token.l y.tab.h CFLAGS+= -I${.CURDIR} CFLAGS+= -I${.CURDIR}/../../sys CFLAGS+= -I${.CURDIR}/../../sys/cam/ctl Modified: head/usr.sbin/ctld/ctl.conf.5 == --- head/usr.sbin/ctld/ctl.conf.5 Sat Oct 25 09:25:29 2014 (r273634) +++ head/usr.sbin/ctld/ctl.conf.5 Sat Oct 25 12:50:26 2014 (r273635) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 22, 2014 +.Dd October 23, 2014 .Dt CTL.CONF 5 .Os .Sh NAME @@ -106,6 +106,13 @@ The timeout for login sessions, after wh will be forcibly terminated. The default is 60. A setting of 0 disables the timeout. +.It Ic isns-server Ar address +An IPv4 or IPv6 address and optionally port of iSNS server to register on. +.It Ic isns-period Ar seconds +iSNS registration period. +Registered Network Entity not updated during this period will be unregistered. +.It Ic isns-timeout Ar seconds +Timeout for iSNS requests. .El .Ss auth-group Context .Bl -tag -width indent Modified: head/usr.sbin/ctld/ctld.c == --- head/usr.sbin/ctld/ctld.c Sat Oct 25 09:25:29 2014(r273634) +++ head/usr.sbin/ctld/ctld.c Sat Oct 25 12:50:26 2014(r273635) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include "ctld.h" +#include "isns.h" bool proxy_mode = false; @@ -89,7 +90,10 @@ conf_new(void) TAILQ_INIT(&conf->conf_targets); TAILQ_INIT(&conf->conf_auth_groups); TAILQ_INIT(&conf->conf_portal_groups); + TAILQ_INIT(&conf->conf_isns); + conf->conf_isns_period = 900; + conf->conf_isns_timeout = 5; conf->conf_debug = 0; conf->conf_timeout = 60; conf->conf_maxproc = 30; @@ -103,6 +107,7 @@ conf_delete(struct conf *conf) struct target *targ, *tmp; struct auth_group *ag, *cagtmp; struct portal_group *pg, *cpgtmp; + struct isns *is, *istmp; assert(conf->conf_pidfh == NULL); @@ -112,6 +117,8 @@ conf_delete(struct conf *conf) auth_group_delete(ag); TAILQ_FOREACH_SAFE(pg, &conf->conf_portal_groups, pg_next, cpgtmp) portal_group_delete(pg); + TAILQ_FOREACH_SAFE(is, &conf->conf_isns, i_next, istmp) + isns_delete(is); free(conf->conf_pidfile_path); free(conf); } @@ -644,47 +651,28 @@ portal_group_find(const struct conf *con return (NULL); } -int -portal_group_add_listen(struct portal_group *pg, const char *value, bool iser) +static int +parse_addr_port(char *arg, const char *def_port, struct addrinfo **ai) { struct addrinfo hints; - struct portal *portal; - char *addr, *ch, *arg; + char *addr, *ch; const char *port; int error, colons = 0; - portal = portal_new(pg); - portal->p_listen = checked_strdup(value); - portal->p_iser = iser; - - arg = portal->p_listen; - if (arg[0] == '\0') { - log_warnx("empty listen address"); - portal_delete(portal); - return (1); - } if (arg[0] == '[') { /* * IPv6 address in square brackets, perhaps with port. */ arg++; addr = strsep(&arg, "]"); - if (arg == NULL) { - log_warnx("invalid listen address %s", - portal->p_listen); - portal_delete(portal); + if (arg == NULL) return (1); -
svn commit: r273638 - in head/sys: geom kern
Author: mav Date: Sat Oct 25 15:16:19 2014 New Revision: 273638 URL: https://svnweb.freebsd.org/changeset/base/273638 Log: Revert somewhat hackish geom_disk optimization, committed as part of r256880, and the following r273143 commit, supposed to workaround introduced issue by quite innocent-looking change. While there is no clear understanding why, but r273143 is accused in data corruption in some environments with high I/O load. I personally don't see any problem in that commit, and possibly it is just a trigger to some other bug somewhere, but better safe then sorry for now. Requested by: scottl@ MFC after:3 days Modified: head/sys/geom/geom_disk.c head/sys/kern/vfs_bio.c Modified: head/sys/geom/geom_disk.c == --- head/sys/geom/geom_disk.c Sat Oct 25 15:14:19 2014(r273637) +++ head/sys/geom/geom_disk.c Sat Oct 25 15:16:19 2014(r273638) @@ -235,25 +235,6 @@ g_disk_done(struct bio *bp) g_destroy_bio(bp); } -static void -g_disk_done_single(struct bio *bp) -{ - struct bintime now; - struct g_disk_softc *sc; - - bp->bio_completed = bp->bio_length - bp->bio_resid; - bp->bio_done = (void *)bp->bio_to; - bp->bio_to = LIST_FIRST(&bp->bio_disk->d_geom->provider); - if ((bp->bio_cmd & (BIO_READ|BIO_WRITE|BIO_DELETE|BIO_FLUSH)) != 0) { - binuptime(&now); - sc = bp->bio_to->private; - mtx_lock(&sc->done_mtx); - devstat_end_transaction_bio_bt(sc->dp->d_devstat, bp, &now); - mtx_unlock(&sc->done_mtx); - } - g_io_deliver(bp, bp->bio_error); -} - static int g_disk_ioctl(struct g_provider *pp, u_long cmd, void * data, int fflag, struct thread *td) { @@ -277,7 +258,7 @@ g_disk_start(struct bio *bp) struct disk *dp; struct g_disk_softc *sc; int error; - off_t d_maxsize, off; + off_t off; sc = bp->bio_to->private; if (sc == NULL || (dp = sc->dp) == NULL || dp->d_destroyed) { @@ -294,20 +275,6 @@ g_disk_start(struct bio *bp) /* fall-through */ case BIO_READ: case BIO_WRITE: - d_maxsize = (bp->bio_cmd == BIO_DELETE) ? - dp->d_delmaxsize : dp->d_maxsize; - if (bp->bio_length <= d_maxsize) { - bp->bio_disk = dp; - bp->bio_to = (void *)bp->bio_done; - bp->bio_done = g_disk_done_single; - bp->bio_pblkno = bp->bio_offset / dp->d_sectorsize; - bp->bio_bcount = bp->bio_length; - mtx_lock(&sc->start_mtx); - devstat_start_transaction_bio(dp->d_devstat, bp); - mtx_unlock(&sc->start_mtx); - dp->d_strategy(bp); - break; - } off = 0; bp3 = NULL; bp2 = g_clone_bio(bp); @@ -316,6 +283,10 @@ g_disk_start(struct bio *bp) break; } do { + off_t d_maxsize; + + d_maxsize = (bp->bio_cmd == BIO_DELETE) ? + dp->d_delmaxsize : dp->d_maxsize; bp2->bio_offset += off; bp2->bio_length -= off; if ((bp->bio_flags & BIO_UNMAPPED) == 0) { @@ -415,13 +386,17 @@ g_disk_start(struct bio *bp) error = EOPNOTSUPP; break; } - bp->bio_disk = dp; - bp->bio_to = (void *)bp->bio_done; - bp->bio_done = g_disk_done_single; - mtx_lock(&sc->start_mtx); - devstat_start_transaction_bio(dp->d_devstat, bp); - mtx_unlock(&sc->start_mtx); - dp->d_strategy(bp); + bp2 = g_clone_bio(bp); + if (bp2 == NULL) { + g_io_deliver(bp, ENOMEM); + return; + } + bp2->bio_done = g_disk_done; + bp2->bio_disk = dp; + mtx_lock(&sc->start_mtx); + devstat_start_transaction_bio(dp->d_devstat, bp2); + mtx_unlock(&sc->start_mtx); + dp->d_strategy(bp2); break; default: error = EOPNOTSUPP; Modified: head/sys/kern/vfs_bio.c == --- head/sys/kern/vfs_bio.c Sat Oct 25 15:14:19 2014(r273637) +++ head/sys/kern/vfs_bio.c Sat Oct 25 15:16:19 2014(r273638) @@ -3618,8 +3618,10 @@ biodone(struct bio *bp) bp->bio_flags |= BIO_DONE; wakeup(bp); mtx_unlock(mtxp); - } else + } else { + bp->bio_flags |= BIO_DONE;
Re: svn commit: r273598 - in head: include sys/dev/acpica
On Oct 25, 2014, at 02:00, Konstantin Belousov wrote: > > Ok, I did looked at the pte of the HPET page. I get the value > 0x8000fed00025 > which coincides with the resource address 0xfed0 reported > by devinfo -vr for hpet (to double-check my findings). The low > bits indicate that PAT0 pat entry is used for the page caching > mode. Corresponding PAT MSR 0x277 has the following value: > sandy% sudo cpucontrol -m 0x277 /dev/cpuctl0 > MSR 0x277: 0x00010506 0x00070406 > i.e. memory type is 6, which is write-back, according to SDM. > This is wrong, as I feared. > > The patch below fixes the issue. The pte for HPET page is equal to > 0x8000fed0003d > after the patch is applied, PAT3 is used, and its value is 0 == > UNCACHEABLE, as it must be. > > Do you agree with the patch ? Yes, thanks for working on this! -- 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"
svn commit: r273640 - head/sys/cam/ctl
Author: mav Date: Sat Oct 25 17:07:35 2014 New Revision: 273640 URL: https://svnweb.freebsd.org/changeset/base/273640 Log: Add support for 12/16-byte EUI and 16-byte NAA IDs. MFC after:1 week Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c == --- head/sys/cam/ctl/ctl.c Sat Oct 25 15:32:56 2014(r273639) +++ head/sys/cam/ctl/ctl.c Sat Oct 25 17:07:35 2014(r273640) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -4349,6 +4350,36 @@ ctl_init_log_page_index(struct ctl_lun * return (CTL_RETVAL_COMPLETE); } +static int +hex2bin(const char *str, uint8_t *buf, int buf_size) +{ + int i; + u_char c; + + memset(buf, 0, buf_size); + while (isspace(str[0])) + str++; + if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X')) + str += 2; + buf_size *= 2; + for (i = 0; str[i] != 0 && i < buf_size; i++) { + c = str[i]; + if (isdigit(c)) + c -= '0'; + else if (isalpha(c)) + c -= isupper(c) ? 'A' - 10 : 'a' - 10; + else + break; + if (c >= 16) + break; + if ((i & 1) == 0) + buf[i / 2] |= (c << 4); + else + buf[i / 2] |= c; + } + return ((i + 1) / 2); +} + /* * LUN allocation. * @@ -4414,15 +4445,14 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft } eui = ctl_get_opt(&be_lun->options, "eui"); if (eui != NULL) { - len += sizeof(struct scsi_vpd_id_descriptor) + 8; + len += sizeof(struct scsi_vpd_id_descriptor) + 16; } naa = ctl_get_opt(&be_lun->options, "naa"); if (naa != NULL) { - len += sizeof(struct scsi_vpd_id_descriptor) + 8; + len += sizeof(struct scsi_vpd_id_descriptor) + 16; } lun->lun_devid = malloc(sizeof(struct ctl_devid) + len, M_CTL, M_WAITOK | M_ZERO); - lun->lun_devid->len = len; desc = (struct scsi_vpd_id_descriptor *)lun->lun_devid->data; desc->proto_codeset = SVPD_ID_CODESET_ASCII; desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_LUN | SVPD_ID_TYPE_T10; @@ -4452,8 +4482,10 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft desc->proto_codeset = SVPD_ID_CODESET_BINARY; desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_LUN | SVPD_ID_TYPE_EUI64; - desc->length = 8; - scsi_u64to8b(strtouq(eui, NULL, 0), desc->identifier); + desc->length = hex2bin(eui, desc->identifier, 16); + desc->length = desc->length > 12 ? 16 : + (desc->length > 8 ? 12 : 8); + len -= 16 - desc->length; } if (naa != NULL) { desc = (struct scsi_vpd_id_descriptor *)(&desc->identifier[0] + @@ -4461,9 +4493,11 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft desc->proto_codeset = SVPD_ID_CODESET_BINARY; desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_LUN | SVPD_ID_TYPE_NAA; - desc->length = 8; - scsi_u64to8b(strtouq(naa, NULL, 0), desc->identifier); + desc->length = hex2bin(naa, desc->identifier, 16); + desc->length = desc->length > 8 ? 16 : 8; + len -= 16 - desc->length; } + lun->lun_devid->len = len; mtx_lock(&ctl_softc->ctl_lock); /* ___ 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: r273641 - in head/sys/cddl: compat/opensolaris/kern contrib/opensolaris/uts/common/fs contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/sys
Author: jpaetzel Date: Sat Oct 25 17:42:44 2014 New Revision: 273641 URL: https://svnweb.freebsd.org/changeset/base/273641 Log: This change addresses 4 bugs in ZFS exposed by Richard Kojedzinszky's crash.sh script attached to FreeNAS bug 4109: https://bugs.freenas.org/issues/4109 Three are in the snapshot layer: a) AVG explains in his notes: https://wiki.freebsd.org/AvgVfsSolarisVsFreeBSD "VOP_INACTIVE must not do any destructive actions to a vnode and its filesystem node, nor invalidate them in any way." gfs_vop_inactive and zfsctl_snapshot_inactive did just that. In OpenSolaris VOP_INACTIVE is much closer to FreeBSD's VOP_RECLAIM. Rename & move them to gfs_vop_reclaim and zfsctl_snapshot_reclaim and merge in the requisite vnode_destroy from zfsctl_common_reclaim. b) gfs_lookup_dot and various zfsctl functions do not honor the FreeBSD VFS convention of only locking from the root downward. When looking up ".." the convention is to drop the current leaf vnode lock before acquiring the directory vnode and then subsequently re-acquiring the lock on the leaf vnode. This fixes that in all the places that our exercised by crash.sh. c) The snapshot may already be unmounted when the directory vnode is reclaimed. Check for this case and return. One in the common layer: d) Callers of traverse expect the reference to the vnode passed in to be maintained. Don't release it. This last one may be an unclear contract. There may in fact be some callers that do expect the reference to be dropped on success in addition to callers that expect it to be released. In this case a further audit of the callers is needed and a consensus on the correct behavior. PR: 184677 Submitted by: kmacy Reviewed by: delphij, will, avg MFC after:2 weeks Sponsored by: iXsystems Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c head/sys/cddl/contrib/opensolaris/uts/common/sys/gfs.h Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c == --- head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c Sat Oct 25 17:07:35 2014(r273640) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c Sat Oct 25 17:42:44 2014(r273641) @@ -91,11 +91,11 @@ traverse(vnode_t **cvpp, int lktype) error = vfs_busy(vfsp, 0); /* * tvp is NULL for *cvpp vnode, which we can't unlock. +* At least some callers expect the reference to be +* maintained to the original *cvpp */ if (tvp != NULL) vput(cvp); - else - vrele(cvp); if (error) return (error); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c Sat Oct 25 17:07:35 2014(r273640) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c Sat Oct 25 17:42:44 2014(r273641) @@ -90,7 +90,7 @@ * gfs_dir_lookup() * gfs_dir_readdir() * - * gfs_vop_inactive() + * gfs_vop_reclaim() * gfs_vop_lookup() * gfs_vop_readdir() * gfs_vop_map() @@ -435,6 +435,8 @@ gfs_readdir_fini(gfs_readdir_state_t *st int gfs_lookup_dot(vnode_t **vpp, vnode_t *dvp, vnode_t *pvp, const char *nm) { + int ltype; + if (*nm == '\0' || strcmp(nm, ".") == 0) { VN_HOLD(dvp); *vpp = dvp; @@ -444,11 +446,15 @@ gfs_lookup_dot(vnode_t **vpp, vnode_t *d ASSERT(dvp->v_flag & VROOT); VN_HOLD(dvp); *vpp = dvp; + ASSERT_VOP_ELOCKED(dvp, "gfs_lookup_dot: non-locked dvp"); } else { + ltype = VOP_ISLOCKED(dvp); + VOP_UNLOCK(dvp, 0); VN_HOLD(pvp); *vpp = pvp; + vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(dvp, ltype | LK_RETRY); } - vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY); return (0); } @@ -618,7 +624,7 @@ gfs_root_create_file(size_t size, vfs_t /* * gfs_file_inactive() * - * Called from the VOP_INACTIVE() routine. If necessary, this routine will + * Called from the VOP_RECLAIM() routine. If necessary, this routine will * remove the given vnode from the parent directory and clean up any references * in the VFS layer. * @@ -1215,15 +1221,15 @@ gfs_vop_map(vnode_t *vp, offset_t off, s #endif /* sun */ /* - * gfs_vop_inactive: VO
svn commit: r273644 - head/share/man/man3
Author: jhb Date: Sat Oct 25 19:31:34 2014 New Revision: 273644 URL: https://svnweb.freebsd.org/changeset/base/273644 Log: Clarify that pthread_cleanup_push()/pop() are implemented as macros that create a new code block and thus must be balanced at the same lexical scope. (This is also a requirement in POSIX.) PR: 194280 Submitted by: dr2867.busin...@pacbell.net MFC after:1 week Modified: head/share/man/man3/pthread_cleanup_pop.3 head/share/man/man3/pthread_cleanup_push.3 Modified: head/share/man/man3/pthread_cleanup_pop.3 == --- head/share/man/man3/pthread_cleanup_pop.3 Sat Oct 25 19:01:02 2014 (r273643) +++ head/share/man/man3/pthread_cleanup_pop.3 Sat Oct 25 19:31:34 2014 (r273644) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 30, 1998 +.Dd October 25, 2014 .Dt PTHREAD_CLEANUP_POP 3 .Os .Sh NAME @@ -50,6 +50,14 @@ If there is no cleanup routine then .Fn pthread_cleanup_pop does nothing. +.Pp +The +.Fn pthread_cleanup_push +function is implemented as a macro that closes a block. +Invocations of this function must appear as standalone statements that are +paired with an earlier call of +.Xr pthread_cleanup_push 3 +in the same lexical scope. .Sh RETURN VALUES The .Fn pthread_cleanup_pop Modified: head/share/man/man3/pthread_cleanup_push.3 == --- head/share/man/man3/pthread_cleanup_push.3 Sat Oct 25 19:01:02 2014 (r273643) +++ head/share/man/man3/pthread_cleanup_push.3 Sat Oct 25 19:31:34 2014 (r273644) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 30, 1998 +.Dd October 25, 2014 .Dt PTHREAD_CLEANUP_PUSH 3 .Os .Sh NAME @@ -52,6 +52,14 @@ When is called, it is passed .Fa arg as its only argument. +.Pp +The +.Fn pthread_cleanup_push +function is implemented as a macro that opens a new block. +Invocations of this function must appear as standalone statements that are +paired with a later call of +.Xr pthread_cleanup_pop 3 +in the same lexical scope. .Sh RETURN VALUES The .Fn pthread_cleanup_push ___ 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: r273616 - head/sys/kern
On Saturday, October 25, 2014 12:16:36 AM Xin LI wrote: > Author: delphij > Date: Sat Oct 25 00:16:36 2014 > New Revision: 273616 > URL: https://svnweb.freebsd.org/changeset/base/273616 > > Log: > Fix build. Thanks, I had this fixed in the tree I used for testing but it didn't get committed into my test branch. :( -- John Baldwin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r273601 - head/lib/libc/gen
On Saturday, October 25, 2014 07:42:44 AM Andrey Chernov wrote: > On 25.10.2014 6:21, Andrey Chernov wrote: > > On 24.10.2014 23:55, John Baldwin wrote: > >> Author: jhb > >> Date: Fri Oct 24 19:55:49 2014 > >> New Revision: 273601 > >> URL: https://svnweb.freebsd.org/changeset/base/273601 > >> > >> Log: > >> Don't reference sem(4) from the POSIX semaphore pages. POSIX > >> semaphores > >> were reimplemented using umtx in FreeBSD 9 and no longer use sem(4). > > > > sem kernel module referenced in sem(4) uses the same uipc_sem.c file as > > kernel's P1003_1B_SEMAPHORES option, so they both use the same code and > > better be cross-linked since sem(4) explains how to turn it on. > > From the first glance I can't determine, is libc implementation better > than kernel one or not. BTW, firefox port still recommends sem_load="YES" The sem_init/open/unlike/destroy/post/*wait() API used to use sem(4) (which is sem.ko and the kernel option) from FreeBSD 5 up through FreeBSD 8. These functions have used umtx_op() instead of sem(4) since FreeBSD 9.0. Note that libc/gen/sem_new.c does not call ksem_*. -- John Baldwin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r273644 - head/share/man/man3
On Sat, 2014-10-25 at 19:31 +, John Baldwin wrote: > Author: jhb > Date: Sat Oct 25 19:31:34 2014 > New Revision: 273644 > URL: https://svnweb.freebsd.org/changeset/base/273644 > > Log: > Clarify that pthread_cleanup_push()/pop() are implemented as macros that > create a new code block and thus must be balanced at the same lexical > scope. (This is also a requirement in POSIX.) > > PR: 194280 > Submitted by: dr2867.busin...@pacbell.net > MFC after: 1 week > > Modified: > head/share/man/man3/pthread_cleanup_pop.3 > head/share/man/man3/pthread_cleanup_push.3 > > Modified: head/share/man/man3/pthread_cleanup_pop.3 > == > --- head/share/man/man3/pthread_cleanup_pop.3 Sat Oct 25 19:01:02 2014 > (r273643) > +++ head/share/man/man3/pthread_cleanup_pop.3 Sat Oct 25 19:31:34 2014 > (r273644) > @@ -27,7 +27,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 30, 1998 > +.Dd October 25, 2014 > .Dt PTHREAD_CLEANUP_POP 3 > .Os > .Sh NAME > @@ -50,6 +50,14 @@ If there is no cleanup routine > then > .Fn pthread_cleanup_pop > does nothing. > +.Pp > +The > +.Fn pthread_cleanup_push Should be pop? -- Ian > +function is implemented as a macro that closes a block. > +Invocations of this function must appear as standalone statements that are > +paired with an earlier call of > +.Xr pthread_cleanup_push 3 > +in the same lexical scope. > .Sh RETURN VALUES > The > .Fn pthread_cleanup_pop > > Modified: head/share/man/man3/pthread_cleanup_push.3 > == > --- head/share/man/man3/pthread_cleanup_push.3Sat Oct 25 19:01:02 > 2014(r273643) > +++ head/share/man/man3/pthread_cleanup_push.3Sat Oct 25 19:31:34 > 2014(r273644) > @@ -27,7 +27,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 30, 1998 > +.Dd October 25, 2014 > .Dt PTHREAD_CLEANUP_PUSH 3 > .Os > .Sh NAME > @@ -52,6 +52,14 @@ When > is called, it is passed > .Fa arg > as its only argument. > +.Pp > +The > +.Fn pthread_cleanup_push > +function is implemented as a macro that opens a new block. > +Invocations of this function must appear as standalone statements that are > +paired with a later call of > +.Xr pthread_cleanup_pop 3 > +in the same lexical scope. > .Sh RETURN VALUES > The > .Fn pthread_cleanup_push > ___ 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: r273646 - head/sys/kern
Author: jhb Date: Sat Oct 25 20:42:47 2014 New Revision: 273646 URL: https://svnweb.freebsd.org/changeset/base/273646 Log: Use correct type in __DEVOLATILE(). Modified: head/sys/kern/kern_umtx.c Modified: head/sys/kern/kern_umtx.c == --- head/sys/kern/kern_umtx.c Sat Oct 25 20:34:10 2014(r273645) +++ head/sys/kern/kern_umtx.c Sat Oct 25 20:42:47 2014(r273646) @@ -2895,7 +2895,8 @@ do_sem2_wake(struct thread *td, struct _ */ if (cnt == 1) { umtxq_unlock(&key); - count = fuword32(__DEVOLATILE(void *, &sem->_count)); + count = fuword32(__DEVOLATILE(uint32_t *, + &sem->_count)); while (count != -1 && count & USEM_HAS_WAITERS) count = casuword32(&sem->_count, count, count & ~USEM_HAS_WAITERS); ___ 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: r273647 - head/sys/dev/acpica
Author: kib Date: Sat Oct 25 21:01:50 2014 New Revision: 273647 URL: https://svnweb.freebsd.org/changeset/base/273647 Log: Set the caching mode for the usermode mapping of the HPET registers page to uncached. Reviewed by: rpaulo Sponsored by: The FreeBSD Foundation MFC after:1 week Modified: head/sys/dev/acpica/acpi_hpet.c Modified: head/sys/dev/acpica/acpi_hpet.c == --- head/sys/dev/acpica/acpi_hpet.c Sat Oct 25 20:42:47 2014 (r273646) +++ head/sys/dev/acpica/acpi_hpet.c Sat Oct 25 21:01:50 2014 (r273647) @@ -356,6 +356,7 @@ hpet_mmap(struct cdev *cdev, vm_ooffset_ if (!sc->mmap_allow_write && (nprot & PROT_WRITE)) return (EPERM); *paddr = rman_get_start(sc->mem_res) + offset; + *memattr = VM_MEMATTR_UNCACHEABLE; return (0); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r273601 - head/lib/libc/gen
On Sat, Oct 25, 2014 at 07:42:44AM +0400, Andrey Chernov wrote: > On 25.10.2014 6:21, Andrey Chernov wrote: > > On 24.10.2014 23:55, John Baldwin wrote: > >> Author: jhb > >> Date: Fri Oct 24 19:55:49 2014 > >> New Revision: 273601 > >> URL: https://svnweb.freebsd.org/changeset/base/273601 > >> > >> Log: > >> Don't reference sem(4) from the POSIX semaphore pages. POSIX semaphores > >> were reimplemented using umtx in FreeBSD 9 and no longer use sem(4). > > > > sem kernel module referenced in sem(4) uses the same uipc_sem.c file as > > kernel's P1003_1B_SEMAPHORES option, so they both use the same code and > > better be cross-linked since sem(4) explains how to turn it on. > > > > From the first glance I can't determine, is libc implementation better > than kernel one or not. BTW, firefox port still recommends sem_load="YES" > Firefox still recommands sem_load because we still support FreeBSD 8. regards, Bapt pgpGFSTg4jCF9.pgp Description: PGP signature
svn commit: r273653 - head/release
Author: gjb Date: Sun Oct 26 01:41:54 2014 New Revision: 273653 URL: https://svnweb.freebsd.org/changeset/base/273653 Log: Fix a few issues with creating VOLUME_LABEL for the installation ISOs: - TYPE, BRANCH, and REVISION are only defined if OSRELEASE is not defined, so in situations where one might set OSRELEASE for an in-house ISO build, VOLUME_LABEL would be empty. - makefs(8) limits the volume label to 32 characters, which for the powerpc64 case, OSRELEASE expands to FreeBSD-11.0-CURRENT-powerpc-powerpc64. Even with removing the prefixing 'FreeBSD-', the string is 30 characters long, leaving zero room for suffixing the type of ISO media (BO for bootonly, CD for cdrom, and DVD for dvdrom). Resolve these by defining VOLUME_LABEL when defining OSRELEASE if unset. If OSRELEASE is defined by the builder, use the OSRELEASE from that definition as the VOLUME_LABEL. In addition, for cases where both TARGET and TARGET_ARCH are used for the VOLUME_LABEL, use TARGET_ARCH if it differs from TARGET. There are probably a few sharp edges here yet, but these problems are going to affect the powerpc/powerpc64 builds for 10.1-RELEASE, so the immediate concern is fixing the underlying problem at hand quickly, and less so about the elegance of the fix. MFC after:3 days X-MFC-10.1: yes, asap Sponsored by: The FreeBSD Foundation Modified: head/release/Makefile Modified: head/release/Makefile == --- head/release/Makefile Sun Oct 26 01:30:46 2014(r273652) +++ head/release/Makefile Sun Oct 26 01:41:54 2014(r273653) @@ -56,13 +56,17 @@ ${_V}!= eval $$(awk '/^${_V}=/{print}' $ .for _V in ${TARGET_ARCH} .if !empty(TARGET:M${_V}) OSRELEASE= ${TYPE}-${REVISION}-${BRANCH}-${TARGET} +VOLUME_LABEL= ${REVISION:C/\./_/g:}_${BRANCH}_${TARGET} .else OSRELEASE= ${TYPE}-${REVISION}-${BRANCH}-${TARGET}-${TARGET_ARCH} +VOLUME_LABEL= ${REVISION:C/\./_/g:}_${BRANCH}_${TARGET_ARCH} .endif .endfor .endif -VOLUME_LABEL= ${OSRELEASE:C/[-\.]/_/g:S/^$${TYPE}_//} +.if !defined(VOLUME_LABEL) || empty(VOLUME_LABEL) +VOLUME_LABEL= FreeBSD_Install +.endif .if !exists(${DOCDIR}) NODOC= true ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r273654 - head/sys/kern
Author: mjg Date: Sun Oct 26 01:47:55 2014 New Revision: 273654 URL: https://svnweb.freebsd.org/changeset/base/273654 Log: Now that sysctl_root is only called with sysctl lock in shared mode, update its assertion to require that. Update comment missed in r273400: sysctl_xlock/unlock -> sysctl_xlock/xunlock Noted by: jhb Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c == --- head/sys/kern/kern_sysctl.c Sun Oct 26 01:41:54 2014(r273653) +++ head/sys/kern/kern_sysctl.c Sun Oct 26 01:47:55 2014(r273654) @@ -77,7 +77,7 @@ static MALLOC_DEFINE(M_SYSCTLTMP, "sysct * The sysctllock protects the MIB tree. It also protects sysctl * contexts used with dynamic sysctls. The sysctl_register_oid() and * sysctl_unregister_oid() routines require the sysctllock to already - * be held, so the sysctl_lock() and sysctl_unlock() routines are + * be held, so the sysctl_xlock() and sysctl_xunlock() routines are * provided for the few places in the kernel which need to use that * API rather than using the dynamic API. Use of the dynamic API is * strongly encouraged for most code. @@ -96,6 +96,7 @@ static struct sx sysctlmemlock; #defineSYSCTL_XLOCKED()sx_xlocked(&sysctllock) #defineSYSCTL_ASSERT_LOCKED() sx_assert(&sysctllock, SA_LOCKED) #defineSYSCTL_ASSERT_XLOCKED() sx_assert(&sysctllock, SA_XLOCKED) +#defineSYSCTL_ASSERT_SLOCKED() sx_assert(&sysctllock, SA_SLOCKED) #defineSYSCTL_INIT() sx_init(&sysctllock, "sysctl lock") #defineSYSCTL_SLEEP(ch, wmesg, timo) \ sx_sleep(ch, &sysctllock, 0, wmesg, timo) @@ -1572,7 +1573,7 @@ sysctl_root(SYSCTL_HANDLER_ARGS) struct sysctl_oid *oid; int error, indx, lvl; - SYSCTL_ASSERT_LOCKED(); + SYSCTL_ASSERT_SLOCKED(); error = sysctl_find_oid(arg1, arg2, &oid, &indx, req); if (error) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r273401 - head/sys/kern
On Thu, Oct 23, 2014 at 12:14:03PM -0400, John Baldwin wrote: > On Tuesday, October 21, 2014 3:05:45 pm Mateusz Guzik wrote: > > Author: mjg > > Date: Tue Oct 21 19:05:44 2014 > > New Revision: 273401 > > URL: https://svnweb.freebsd.org/changeset/base/273401 > > > > Log: > > Implement shared locking for sysctl. > > A bit more detail in this message was warranted. We had some shared locking > in the past (r192125) but it was subsequently reverted (r216060). > > In particular, explaining how you fixed the part of 216060 that caused the > shared locking to be reverted would have answered Bjoern's earlier question > as > well. It's important that log messages not only explain what they are doing, > but why they are doing so. (For exmaple, it would have been nice if 216060 > had explained why it was reverting the shared locking in its log message, but > it didn't. :( ) > > I think that you fixed the issues by a combination of using > sysctl_lock/unlock > to handle shared vs exclusive locking for the caller and you used atomic ops > on the running count (previously the xlock allowed use of non-atomic ops on > the running count). > I agree that commit message is quite lacking in detail, in retrospect I should have written a thing or two. So yes, in short mutual exclusion between threads disabling sysctls and ones going through them is retained. And accuracy of the counter is ensured with the use of atomic ops. > sysctl_root() is now only called with a shared lock held, so you should > change > its assertion accordingly. sysctl_register_oid() is still called with the > xlock held, so you can't remove the sysctl_lock() stuff from > sysctl_root_handler_locked() entirely. OTOH, there is a stale comment in > kern_sysctl.c about having a public sysctl_lock/unlock API that you can just > remove. Also, given that sysctl_lock/unlock are only used in > sysctl_root_handler_locked(), I would probably remove them and just inline > them in the one place they are needed. I addressed stuff in https://svnweb.freebsd.org/changeset/base/273654 , although the comment needed altering and not removing. I specifically added sysctl_lock/unlock so that next folk with similar usecse will not have to. So I'm not going to remove it, but if you really don't like it feel free to do it. > > Finally, getting pre-commit review is fairly easy these days with phabricator > and would allow you to have had all these things noted and addressed before > it > went into the tree. > yeah, I actually do ask for review more often than not. :) -- 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: r273666 - head/sys/amd64/vmm
Author: neel Date: Sun Oct 26 03:03:41 2014 New Revision: 273666 URL: https://svnweb.freebsd.org/changeset/base/273666 Log: Don't pass the 'error' return from an I/O port handler directly to vm_run(). Most I/O port handlers return -1 to signal an error. If this value is returned without modification to vm_run() then it leads to incorrect behavior because '-1' is interpreted as ERESTART at the system call level. Fix this by always returning EIO to signal an error from an I/O port handler. MFC after:1 week Modified: head/sys/amd64/vmm/vmm_ioport.c Modified: head/sys/amd64/vmm/vmm_ioport.c == --- head/sys/amd64/vmm/vmm_ioport.c Sun Oct 26 02:53:23 2014 (r273665) +++ head/sys/amd64/vmm/vmm_ioport.c Sun Oct 26 03:03:41 2014 (r273666) @@ -106,15 +106,14 @@ emulate_inout_port(struct vm *vm, int vc uint32_t mask, val; int error; - error = 0; - *retu = true; - - if (vmexit->u.inout.port >= MAX_IOPORTS) - goto done; - - handler = ioport_handler[vmexit->u.inout.port]; - if (handler == NULL) - goto done; + /* +* If there is no handler for the I/O port then punt to userspace. +*/ + if (vmexit->u.inout.port >= MAX_IOPORTS || + (handler = ioport_handler[vmexit->u.inout.port]) == NULL) { + *retu = true; + return (0); + } mask = vie_size2mask(vmexit->u.inout.bytes); @@ -124,20 +123,27 @@ emulate_inout_port(struct vm *vm, int vc error = (*handler)(vm, vcpuid, vmexit->u.inout.in, vmexit->u.inout.port, vmexit->u.inout.bytes, &val); + if (error) { + /* +* The value returned by this function is also the return value +* of vm_run(). This needs to be a positive number otherwise it +* can be interpreted as a "pseudo-error" like ERESTART. +* +* Enforce this by mapping all errors to EIO. +*/ + return (EIO); + } - if (!error) { - *retu = false; - if (vmexit->u.inout.in) { - vmexit->u.inout.eax &= ~mask; - vmexit->u.inout.eax |= val & mask; - error = vm_set_register(vm, vcpuid, - VM_REG_GUEST_RAX, vmexit->u.inout.eax); - KASSERT(error == 0, ("emulate_ioport: error %d " - "setting guest rax register", error)); - } + if (vmexit->u.inout.in) { + vmexit->u.inout.eax &= ~mask; + vmexit->u.inout.eax |= val & mask; + error = vm_set_register(vm, vcpuid, VM_REG_GUEST_RAX, + vmexit->u.inout.eax); + KASSERT(error == 0, ("emulate_ioport: error %d setting guest " + "rax register", error)); } -done: - return (error); + *retu = false; + return (0); } static int ___ 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: r273630 - head/tools/regression/zfs/zpool/add
Its not clear from this why you elected to disable the test and hide the issue instead of fixing the panic cause, could you clarify please? On 25/10/2014 07:10, Garrett Cooper wrote: Author: ngie Date: Sat Oct 25 06:10:01 2014 New Revision: 273630 URL: https://svnweb.freebsd.org/changeset/base/273630 Log: Bail out of the script on FreeBSD due to deterministic panic issue PR: 191573 Sponsored by: EMC / Isilon Storage Division Modified: head/tools/regression/zfs/zpool/add/files.t Modified: head/tools/regression/zfs/zpool/add/files.t == --- head/tools/regression/zfs/zpool/add/files.t Sat Oct 25 05:56:21 2014 (r273629) +++ head/tools/regression/zfs/zpool/add/files.t Sat Oct 25 06:10:01 2014 (r273630) @@ -4,6 +4,8 @@ dir=`dirname $0` . ${dir}/../../misc.sh +[ "${os}" = "FreeBSD" ] && die "panics FreeBSD; see bug # 191573" + echo "1..54" files_create 8 ___ 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: r273683 - in head: sys/amd64/include sys/amd64/vmm sys/amd64/vmm/io sys/modules/vmm usr.sbin/bhyve
Author: neel Date: Sun Oct 26 04:44:28 2014 New Revision: 273683 URL: https://svnweb.freebsd.org/changeset/base/273683 Log: Move the ACPI PM timer emulation into vmm.ko. This reduces variability during timer calibration by keeping the emulation "close" to the guest. Additionally having all timer emulations in the kernel will ease the transition to a per-VM clock source (as opposed to using the host's uptime keep track of time). Discussed with: grehan Added: head/sys/amd64/vmm/io/vpmtmr.c (contents, props changed) head/sys/amd64/vmm/io/vpmtmr.h (contents, props changed) Deleted: head/usr.sbin/bhyve/pmtmr.c Modified: head/sys/amd64/include/vmm.h head/sys/amd64/vmm/vmm.c head/sys/amd64/vmm/vmm_ioport.c head/sys/modules/vmm/Makefile head/usr.sbin/bhyve/Makefile Modified: head/sys/amd64/include/vmm.h == --- head/sys/amd64/include/vmm.hSun Oct 26 04:17:20 2014 (r273682) +++ head/sys/amd64/include/vmm.hSun Oct 26 04:44:28 2014 (r273683) @@ -285,6 +285,7 @@ int vm_assign_pptdev(struct vm *vm, int int vm_unassign_pptdev(struct vm *vm, int bus, int slot, int func); struct vatpic *vm_atpic(struct vm *vm); struct vatpit *vm_atpit(struct vm *vm); +struct vpmtmr *vm_pmtmr(struct vm *vm); /* * Inject exception 'vme' into the guest vcpu. This function returns 0 on Added: head/sys/amd64/vmm/io/vpmtmr.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/amd64/vmm/io/vpmtmr.c Sun Oct 26 04:44:28 2014 (r273683) @@ -0,0 +1,104 @@ +/*- + * Copyright (c) 2014, Neel Natu (n...@freebsd.org) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice unmodified, 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 ``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 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include + +#include "vpmtmr.h" + +/* + * The ACPI Power Management timer is a free-running 24- or 32-bit + * timer with a frequency of 3.579545MHz + * + * This implementation will be 32-bits + */ + +#define PMTMR_FREQ 3579545 /* 3.579545MHz */ + +struct vpmtmr { + sbintime_t freq_sbt; + sbintime_t baseuptime; + uint32_tbaseval; +}; + +static MALLOC_DEFINE(M_VPMTMR, "vpmtmr", "bhyve virtual acpi timer"); + +struct vpmtmr * +vpmtmr_init(struct vm *vm) +{ + struct vpmtmr *vpmtmr; + struct bintime bt; + + vpmtmr = malloc(sizeof(struct vpmtmr), M_VPMTMR, M_WAITOK | M_ZERO); + vpmtmr->baseuptime = sbinuptime(); + vpmtmr->baseval = 0; + + FREQ2BT(PMTMR_FREQ, &bt); + vpmtmr->freq_sbt = bttosbt(bt); + + return (vpmtmr); +} + +void +vpmtmr_cleanup(struct vpmtmr *vpmtmr) +{ + + free(vpmtmr, M_VPMTMR); +} + +int +vpmtmr_handler(void *vm, int vcpuid, bool in, int port, int bytes, +uint32_t *val) +{ + struct vpmtmr *vpmtmr; + sbintime_t now, delta; + + if (!in || bytes != 4) + return (-1); + + vpmtmr = vm_pmtmr(vm); + + /* +* No locking needed because 'baseuptime' and 'baseval' are +* written only during initialization. +*/ + now = sbinuptime(); + delta = now - vpmtmr->baseuptime; + KASSERT(delta >= 0, ("vpmtmr_handler: uptime went backwards: " + "%#lx to %#lx", vpmtmr->baseuptime, now)); + *val = vpmtmr->baseval + delta / vpmtmr->freq_sbt; + + return (0); +} Added: head/sys/amd64/vmm/io/vpmtmr.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/amd64/vmm/io/vpm
svn commit: r273684 - head/sys/kern
Author: mjg Date: Sun Oct 26 05:39:42 2014 New Revision: 273684 URL: https://svnweb.freebsd.org/changeset/base/273684 Log: Use a temporary buffer in sys_setgroups for requests with <= XU_NGROUPS groups. Submitted by: Tiwei Bie X-Additional: JuniorJobs project MFC after:2 weeks Modified: head/sys/kern/kern_prot.c Modified: head/sys/kern/kern_prot.c == --- head/sys/kern/kern_prot.c Sun Oct 26 04:44:28 2014(r273683) +++ head/sys/kern/kern_prot.c Sun Oct 26 05:39:42 2014(r273684) @@ -806,17 +806,24 @@ int sys_setgroups(struct thread *td, struct setgroups_args *uap) { gid_t *groups = NULL; + gid_t smallgroups[XU_NGROUPS]; + u_int gidsetsize; int error; - if (uap->gidsetsize > ngroups_max + 1) + gidsetsize = uap->gidsetsize; + if (gidsetsize > ngroups_max + 1) return (EINVAL); - groups = malloc(uap->gidsetsize * sizeof(gid_t), M_TEMP, M_WAITOK); - error = copyin(uap->gidset, groups, uap->gidsetsize * sizeof(gid_t)); + if (gidsetsize > XU_NGROUPS) + groups = malloc(gidsetsize * sizeof(gid_t), M_TEMP, M_WAITOK); + else + groups = smallgroups; + error = copyin(uap->gidset, groups, gidsetsize * sizeof(gid_t)); if (error) goto out; - error = kern_setgroups(td, uap->gidsetsize, groups); + error = kern_setgroups(td, gidsetsize, groups); out: - free(groups, M_TEMP); + if (gidsetsize > XU_NGROUPS) + free(groups, M_TEMP); return (error); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r273630 - head/tools/regression/zfs/zpool/add
On Sat, Oct 25, 2014 at 9:22 PM, Steven Hartland wrote: > Its not clear from this why you elected to disable the test and hide the > issue instead of fixing the panic cause, could you clarify please? See: https://lists.freebsd.org/pipermail/freebsd-testing/2014-October/000584.html https://lists.freebsd.org/pipermail/freebsd-testing/2014-October/000585.html -- 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"
svn commit: r273685 - head/sys/kern
Author: mjg Date: Sun Oct 26 06:04:09 2014 New Revision: 273685 URL: https://svnweb.freebsd.org/changeset/base/273685 Log: Tidy up sys_setgroups and kern_setgroups. - 'groups' initialization to NULL is always ovewrwriten before use, so plug it - get rid of 'goto out' - kern_setgroups's callers already validate ngrp, so only assert the condition - ngrp is an u_int, so 'ngrp < 1' is more readable as 'ngrp == 0' No functional changes. Modified: head/sys/kern/kern_prot.c Modified: head/sys/kern/kern_prot.c == --- head/sys/kern/kern_prot.c Sun Oct 26 05:39:42 2014(r273684) +++ head/sys/kern/kern_prot.c Sun Oct 26 06:04:09 2014(r273685) @@ -805,23 +805,24 @@ struct setgroups_args { int sys_setgroups(struct thread *td, struct setgroups_args *uap) { - gid_t *groups = NULL; gid_t smallgroups[XU_NGROUPS]; + gid_t *groups; u_int gidsetsize; int error; gidsetsize = uap->gidsetsize; if (gidsetsize > ngroups_max + 1) return (EINVAL); + if (gidsetsize > XU_NGROUPS) groups = malloc(gidsetsize * sizeof(gid_t), M_TEMP, M_WAITOK); else groups = smallgroups; + error = copyin(uap->gidset, groups, gidsetsize * sizeof(gid_t)); - if (error) - goto out; - error = kern_setgroups(td, gidsetsize, groups); -out: + if (error == 0) + error = kern_setgroups(td, gidsetsize, groups); + if (gidsetsize > XU_NGROUPS) free(groups, M_TEMP); return (error); @@ -834,8 +835,7 @@ kern_setgroups(struct thread *td, u_int struct ucred *newcred, *oldcred; int error; - if (ngrp > ngroups_max + 1) - return (EINVAL); + MPASS(ngrp <= ngroups_max); AUDIT_ARG_GROUPSET(groups, ngrp); newcred = crget(); crextend(newcred, ngrp); @@ -852,7 +852,7 @@ kern_setgroups(struct thread *td, u_int if (error) goto fail; - if (ngrp < 1) { + if (ngrp == 0) { /* * setgroups(0, NULL) is a legitimate way of clearing the * groups vector on non-BSD systems (which generally do not ___ 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"