From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 00:03:33 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 43B32A4; Sun, 5 Oct 2014 00:03:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3C22A2EE; Sat, 4 Oct 2014 23:56:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s94NuQgP006724; Sat, 4 Oct 2014 23:56:26 GMT (envelope-from gavin@FreeBSD.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s94NuPHN006723; Sat, 4 Oct 2014 23:56:25 GMT (envelope-from gavin@FreeBSD.org) Message-Id: <201410042356.s94NuPHN006723@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gavin set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson Date: Sat, 4 Oct 2014 23:56:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272544 - head/release/doc/en_US.ISO8859-1/hardware X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 00:03:33 -0000 Author: gavin Date: Sat Oct 4 23:56:25 2014 New Revision: 272544 URL: https://svnweb.freebsd.org/changeset/base/272544 Log: Include urndis(4) in list of devices for which we generate hardware notes. MFC after: 3 days Modified: head/release/doc/en_US.ISO8859-1/hardware/article.xml Modified: head/release/doc/en_US.ISO8859-1/hardware/article.xml ============================================================================== --- head/release/doc/en_US.ISO8859-1/hardware/article.xml Sat Oct 4 22:52:21 2014 (r272543) +++ head/release/doc/en_US.ISO8859-1/hardware/article.xml Sat Oct 4 23:56:25 2014 (r272544) @@ -908,6 +908,8 @@ &hwlist.udav; + &hwlist.urndis; + &hwlist.vge; &hwlist.vr; From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 01:52:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D38FCB81; Sun, 5 Oct 2014 01:52:17 +0000 (UTC) Received: from mail108.syd.optusnet.com.au (mail108.syd.optusnet.com.au [211.29.132.59]) by mx1.freebsd.org (Postfix) with ESMTP id 952B7E3C; Sun, 5 Oct 2014 01:52:17 +0000 (UTC) Received: from c122-106-147-133.carlnfd1.nsw.optusnet.com.au (c122-106-147-133.carlnfd1.nsw.optusnet.com.au [122.106.147.133]) by mail108.syd.optusnet.com.au (Postfix) with ESMTPS id AF07F1A69C5; Sun, 5 Oct 2014 12:52:06 +1100 (EST) Date: Sun, 5 Oct 2014 12:51:56 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: "Bjoern A. Zeeb" Subject: Re: svn commit: r272505 - in head/sys: kern sys In-Reply-To: <42180557-0119-4597-9492-662E1671A840@FreeBSD.org> Message-ID: <20141005123549.A1162@besplex.bde.org> References: <201410040808.s9488uAI099166@svn.freebsd.org> <42180557-0119-4597-9492-662E1671A840@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=BdjhjNd2 c=1 sm=1 tr=0 a=7NqvjVvQucbO2RlWB8PEog==:117 a=PO7r1zJSAAAA:8 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=6I5d2MoRAAAA:8 a=vBSQY5nq6lOT3kLbb88A:9 a=CjuIK1q_8ugA:10 a=SV7veod9ZcQA:10 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Konstantin Belousov , Mateusz Guzik X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 01:52:18 -0000 On Sat, 4 Oct 2014, Bjoern A. Zeeb wrote: > On 04 Oct 2014, at 08:08 , Mateusz Guzik wrote: >> ... >> Log: >> Plug capability races. > ... > > This file is included from user space. There is no opt_capsicum.h there. > Including an opt_* in the header file seems wrong in a lot of ways usually. > > I tried to add a bandaid for the moment with r272523 which (to be honest) makes it worse. > > This needs a better fix. > > I also wonder why the (conditional) fde_seq ended up at the beginning of the structure rather than the end? It adds to the already-massive namespace pollution in other ways. >> Modified: head/sys/sys/filedesc.h >> ============================================================================== >> --- head/sys/sys/filedesc.h Sat Oct 4 08:05:39 2014 (r272504) >> +++ head/sys/sys/filedesc.h Sat Oct 4 08:08:56 2014 (r272505) >> @@ -33,11 +33,14 @@ >> #ifndef _SYS_FILEDESC_H_ >> #define _SYS_FILEDESC_H_ >> >> +#include "opt_capsicum.h" >> + Fatal namspace pollution. >> #include >> #include >> #include >> #include >> #include Old massive namespace pollution. >> +#include New namespace pollution. >> #include >> >> #include Old massive namespace pollution, continued. The pollution is nested. at least has a _KERNEL ifdef around most of its pollution. >> @@ -50,6 +53,9 @@ struct filecaps { >> }; >> >> struct filedescent { >> +#ifdef CAPABILITIES >> + seq_t fde_seq; /* if you need fde_file and fde_caps in sync */ >> +#endif This ifdef makes the struct not really a struct. The layout depends on visible options, and the visible options may depend on pollution. The worst sort of pollution bug would occur if something else has a similar ifdef but doesn't include the options header. Then when different pollution there results in including this header, the include of the options header here gives different visible options and thus a different struct layout there. >> struct file *fde_file; /* file structure for open file */ >> struct filecaps fde_caps; /* per-descriptor rights */ >> uint8_t fde_flags; /* per-process open file flags */ >> @@ -58,6 +64,13 @@ struct filedescent { >> #define fde_fcntls fde_caps.fc_fcntls >> #define fde_ioctls fde_caps.fc_ioctls >> #define fde_nioctls fde_caps.fc_nioctls >> +#ifdef CAPABILITIES >> +#define fde_change(fde) ((char *)(fde) + sizeof(seq_t)) >> +#define fde_change_size (sizeof(struct filedescent) - sizeof(seq_t)) >> +#else >> +#define fde_change(fde) ((fde)) >> +#define fde_change_size (sizeof(struct filedescent)) >> +#endif >> >> /* >> * This structure is used for the management of descriptors. It may be >> @@ -82,6 +95,9 @@ struct filedesc { >> int fd_holdleaderscount; /* block fdfree() for shared close() */ >> int fd_holdleaderswakeup; /* fdfree() needs wakeup */ >> }; >> +#ifdef CAPABILITIES >> +#define fd_seq(fdp, fd) (&(fdp)->fd_ofiles[(fd)].fde_seq) >> +#endif The Ifdefs of the macros are not even wrong. Macros are not as polluting as inline functions, so always defining them doen't cause many problems. They just give relatively minor namespace pollution and are unusable if the headers needed to use them are not included. The patch has some style bugs, e.g., long lines. Bruce From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 02:16:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4C452E35; Sun, 5 Oct 2014 02:16:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A14AFC8; Sun, 5 Oct 2014 02:16:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s952GsBb072185; Sun, 5 Oct 2014 02:16:54 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s952Gr8R072183; Sun, 5 Oct 2014 02:16:53 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410050216.s952Gr8R072183@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 5 Oct 2014 02:16:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272546 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 02:16:54 -0000 Author: mjg Date: Sun Oct 5 02:16:53 2014 New Revision: 272546 URL: https://svnweb.freebsd.org/changeset/base/272546 Log: Get rid of crshared. Modified: head/sys/kern/kern_prot.c head/sys/sys/ucred.h Modified: head/sys/kern/kern_prot.c ============================================================================== --- head/sys/kern/kern_prot.c Sun Oct 5 01:28:21 2014 (r272545) +++ head/sys/kern/kern_prot.c Sun Oct 5 02:16:53 2014 (r272546) @@ -1884,23 +1884,13 @@ crfree(struct ucred *cr) } /* - * Check to see if this ucred is shared. - */ -int -crshared(struct ucred *cr) -{ - - return (cr->cr_ref > 1); -} - -/* * Copy a ucred's contents from a template. Does not block. */ void crcopy(struct ucred *dest, struct ucred *src) { - KASSERT(crshared(dest) == 0, ("crcopy of shared ucred")); + KASSERT(dest->cr_ref == 1, ("crcopy of shared ucred")); bcopy(&src->cr_startcopy, &dest->cr_startcopy, (unsigned)((caddr_t)&src->cr_endcopy - (caddr_t)&src->cr_startcopy)); Modified: head/sys/sys/ucred.h ============================================================================== --- head/sys/sys/ucred.h Sun Oct 5 01:28:21 2014 (r272545) +++ head/sys/sys/ucred.h Sun Oct 5 02:16:53 2014 (r272546) @@ -108,7 +108,6 @@ void cred_update_thread(struct thread *t void crfree(struct ucred *cr); struct ucred *crget(void); struct ucred *crhold(struct ucred *cr); -int crshared(struct ucred *cr); void cru2x(struct ucred *cr, struct xucred *xcr); void crsetgroups(struct ucred *cr, int n, gid_t *groups); int groupmember(gid_t gid, struct ucred *cred); From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 02:34:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 29E0011D; Sun, 5 Oct 2014 02:34:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0CF531BB; Sun, 5 Oct 2014 02:34:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s952YMdW081370; Sun, 5 Oct 2014 02:34:22 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s952YMaX081367; Sun, 5 Oct 2014 02:34:22 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201410050234.s952YMaX081367@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sun, 5 Oct 2014 02:34:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272547 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 02:34:23 -0000 Author: hrs Date: Sun Oct 5 02:34:21 2014 New Revision: 272547 URL: https://svnweb.freebsd.org/changeset/base/272547 Log: - Move L2 addr configuration for the primary port to a taskqueue. This fixes LOR of softc rmlock in iflladdr_event handlers. - Call if_delmulti_ifma() after LACP_UNLOCK(). This fixes another LOR. - Fix a panic in lacp_transit_expire(). - Fix a panic in lagg_input() upon shutting down a port. Modified: head/sys/net/ieee8023ad_lacp.c head/sys/net/if_lagg.c head/sys/net/if_lagg.h Modified: head/sys/net/ieee8023ad_lacp.c ============================================================================== --- head/sys/net/ieee8023ad_lacp.c Sun Oct 5 02:16:53 2014 (r272546) +++ head/sys/net/ieee8023ad_lacp.c Sun Oct 5 02:34:21 2014 (r272547) @@ -579,12 +579,13 @@ lacp_port_destroy(struct lagg_port *lgp) lacp_disable_distributing(lp); lacp_unselect(lp); + LIST_REMOVE(lp, lp_next); + LACP_UNLOCK(lsc); + /* The address may have already been removed by if_purgemaddrs() */ if (!lgp->lp_detaching) if_delmulti_ifma(lp->lp_ifma); - LIST_REMOVE(lp, lp_next); - LACP_UNLOCK(lsc); free(lp, M_DEVBUF); } @@ -745,7 +746,9 @@ lacp_transit_expire(void *vp) LACP_LOCK_ASSERT(lsc); + CURVNET_SET(lsc->lsc_softc->sc_ifp->if_vnet); LACP_TRACE(NULL); + CURVNET_RESTORE(); lsc->lsc_suppress_distributing = FALSE; } Modified: head/sys/net/if_lagg.c ============================================================================== --- head/sys/net/if_lagg.c Sun Oct 5 02:16:53 2014 (r272546) +++ head/sys/net/if_lagg.c Sun Oct 5 02:34:21 2014 (r272547) @@ -569,15 +569,15 @@ lagg_clone_destroy(struct ifnet *ifp) static void lagg_lladdr(struct lagg_softc *sc, uint8_t *lladdr) { - struct ifnet *ifp = sc->sc_ifp; + struct lagg_port lp; - if (memcmp(lladdr, IF_LLADDR(ifp), ETHER_ADDR_LEN) == 0) - return; + LAGG_WLOCK_ASSERT(sc); + + bzero(&lp, sizeof(lp)); + lp.lp_ifp = sc->sc_ifp; + lp.lp_softc = sc; - bcopy(lladdr, IF_LLADDR(ifp), ETHER_ADDR_LEN); - /* Let the protocol know the MAC has changed */ - lagg_proto_lladdr(sc); - EVENTHANDLER_INVOKE(iflladdr_event, ifp); + lagg_port_lladdr(&lp, lladdr); } static void @@ -648,6 +648,7 @@ lagg_port_lladdr(struct lagg_port *lp, u /* Update the lladdr even if pending, it may have changed */ llq->llq_ifp = ifp; + llq->llq_primary = (sc->sc_primary->lp_ifp == ifp) ? 1 : 0; bcopy(lladdr, llq->llq_lladdr, ETHER_ADDR_LEN); if (!pending) @@ -680,14 +681,35 @@ lagg_port_setlladdr(void *arg, int pendi for (llq = head; llq != NULL; llq = head) { ifp = llq->llq_ifp; - /* Set the link layer address */ CURVNET_SET(ifp->if_vnet); - error = if_setlladdr(ifp, llq->llq_lladdr, ETHER_ADDR_LEN); + if (llq->llq_primary == 0) { + /* + * Set the link layer address on the laggport interface. + * if_setlladdr() triggers gratuitous ARPs for INET. + */ + error = if_setlladdr(ifp, llq->llq_lladdr, + ETHER_ADDR_LEN); + if (error) + printf("%s: setlladdr failed on %s\n", __func__, + ifp->if_xname); + } else { + /* + * Set the link layer address on the lagg interface. + * lagg_proto_lladdr() notifies the MAC change to + * the aggregation protocol. iflladdr_event handler + * may trigger gratuitous ARPs for INET. + */ + if (memcmp(llq->llq_lladdr, IF_LLADDR(ifp), + ETHER_ADDR_LEN) != 0) { + bcopy(llq->llq_lladdr, IF_LLADDR(ifp), + ETHER_ADDR_LEN); + LAGG_WLOCK(sc); + lagg_proto_lladdr(sc); + LAGG_WUNLOCK(sc); + EVENTHANDLER_INVOKE(iflladdr_event, ifp); + } + } CURVNET_RESTORE(); - if (error) - printf("%s: setlladdr failed on %s\n", __func__, - ifp->if_xname); - head = SLIST_NEXT(llq, llq_entries); free(llq, M_DEVBUF); } @@ -1639,7 +1661,7 @@ lagg_input(struct ifnet *ifp, struct mbu ETHER_BPF_MTAP(scifp, m); - m = lagg_proto_input(sc, lp, m); + m = (lp->lp_detaching == 0) ? lagg_proto_input(sc, lp, m) : NULL; if (m != NULL) { if (scifp->if_flags & IFF_MONITOR) { Modified: head/sys/net/if_lagg.h ============================================================================== --- head/sys/net/if_lagg.h Sun Oct 5 02:16:53 2014 (r272546) +++ head/sys/net/if_lagg.h Sun Oct 5 02:34:21 2014 (r272547) @@ -159,6 +159,9 @@ struct lagg_reqopts { #define SIOCGLAGGOPTS _IOWR('i', 152, struct lagg_reqopts) #define SIOCSLAGGOPTS _IOW('i', 153, struct lagg_reqopts) +#define LAGG_OPT_BITS "\020\001USE_FLOWID\005LACP_STRICT" \ + "\006LACP_TXTEST\007LACP_RXTEST" + #ifdef _KERNEL /* @@ -203,6 +206,7 @@ struct lagg_mc { struct lagg_llq { struct ifnet *llq_ifp; uint8_t llq_lladdr[ETHER_ADDR_LEN]; + uint8_t llq_primary; SLIST_ENTRY(lagg_llq) llq_entries; }; From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 02:37:02 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DE261286; Sun, 5 Oct 2014 02:37:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B19BE1D0; Sun, 5 Oct 2014 02:37:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s952b2Wr081854; Sun, 5 Oct 2014 02:37:02 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s952b2ab081851; Sun, 5 Oct 2014 02:37:02 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201410050237.s952b2ab081851@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sun, 5 Oct 2014 02:37:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272548 - in head: sbin/ifconfig sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 02:37:03 -0000 Author: hrs Date: Sun Oct 5 02:37:01 2014 New Revision: 272548 URL: https://svnweb.freebsd.org/changeset/base/272548 Log: Use printb() for boolean flags in ro_opts and actor_state for LACP. Modified: head/sbin/ifconfig/iflagg.c head/sys/net/ieee8023ad_lacp.h Modified: head/sbin/ifconfig/iflagg.c ============================================================================== --- head/sbin/ifconfig/iflagg.c Sun Oct 5 02:34:21 2014 (r272547) +++ head/sbin/ifconfig/iflagg.c Sun Oct 5 02:37:01 2014 (r272548) @@ -17,6 +17,7 @@ static const char rcsid[] = #include #include #include +#include #include #include @@ -246,18 +247,9 @@ lagg_status(int s) putchar('\n'); if (verbose) { printf("\tlagg options:\n"); - printf("\t\tuse_flowid: %d\n", - (ro.ro_opts & LAGG_OPT_USE_FLOWID) ? 1 : 0); + printb("\t\tflags", ro.ro_opts, LAGG_OPT_BITS); + putchar('\n'); printf("\t\tflowid_shift: %d\n", ro.ro_flowid_shift); - switch (ra.ra_proto) { - case LAGG_PROTO_LACP: - printf("\t\tlacp_strict: %d\n", - (ro.ro_opts & LAGG_OPT_LACP_STRICT) ? 1 : 0); - printf("\t\tlacp_rxtest: %d\n", - (ro.ro_opts & LAGG_OPT_LACP_RXTEST) ? 1 : 0); - printf("\t\tlacp_txtest: %d\n", - (ro.ro_opts & LAGG_OPT_LACP_TXTEST) ? 1 : 0); - } printf("\tlagg statistics:\n"); printf("\t\tactive ports: %d\n", ro.ro_active); printf("\t\tflapping: %u\n", ro.ro_flapping); @@ -272,7 +264,8 @@ lagg_status(int s) printf("\tlaggport: %s ", rpbuf[i].rp_portname); printb("flags", rpbuf[i].rp_flags, LAGG_PORT_BITS); if (verbose && ra.ra_proto == LAGG_PROTO_LACP) - printf(" state=%X", lp->actor_state); + printb(" state", lp->actor_state, + LACP_STATE_BITS); putchar('\n'); if (verbose && ra.ra_proto == LAGG_PROTO_LACP) printf("\t\t%s\n", Modified: head/sys/net/ieee8023ad_lacp.h ============================================================================== --- head/sys/net/ieee8023ad_lacp.h Sun Oct 5 02:34:21 2014 (r272547) +++ head/sys/net/ieee8023ad_lacp.h Sun Oct 5 02:37:01 2014 (r272548) @@ -75,6 +75,7 @@ "\007DEFAULTED" \ "\010EXPIRED" +#ifdef _KERNEL /* * IEEE802.3 slow protocols * @@ -336,3 +337,4 @@ lacp_isdistributing(struct lagg_port *lg #define LACP_LAGIDSTR_MAX \ (1 + LACP_PARTNERSTR_MAX + 1 + LACP_PARTNERSTR_MAX + 1) #define LACP_STATESTR_MAX (255) /* XXX */ +#endif /* _KERNEL */ From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 03:18:31 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 46CD5CA3; Sun, 5 Oct 2014 03:18:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 346D782A; Sun, 5 Oct 2014 03:18:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s953IVow002184; Sun, 5 Oct 2014 03:18:31 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s953IVbq002183; Sun, 5 Oct 2014 03:18:31 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201410050318.s953IVbq002183@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Sun, 5 Oct 2014 03:18:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272550 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 03:18:31 -0000 Author: bryanv Date: Sun Oct 5 03:18:30 2014 New Revision: 272550 URL: https://svnweb.freebsd.org/changeset/base/272550 Log: Remove stray uma_mtx lock/unlock in zone_drain_wait() Callers of zone_drain_wait(M_WAITOK) do not need to hold (and were not) the uma_mtx, but we would attempt to unlock and relock the mutex if we had to sleep because the zone was already draining. The M_NOWAIT callers may hold the uma_mtx, but we do not sleep in that case. Reviewed by: jhb MFC after: 3 days Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Sun Oct 5 02:52:54 2014 (r272549) +++ head/sys/vm/uma_core.c Sun Oct 5 03:18:30 2014 (r272550) @@ -897,9 +897,7 @@ zone_drain_wait(uma_zone_t zone, int wai while (zone->uz_flags & UMA_ZFLAG_DRAINING) { if (waitok == M_NOWAIT) goto out; - mtx_unlock(&uma_mtx); msleep(zone, zone->uz_lockptr, PVM, "zonedrain", 1); - mtx_lock(&uma_mtx); } zone->uz_flags |= UMA_ZFLAG_DRAINING; bucket_cache_drain(zone); From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 03:41:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ECA43EF2; Sun, 5 Oct 2014 03:41:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D9878A4C; Sun, 5 Oct 2014 03:41:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s953fl0c015181; Sun, 5 Oct 2014 03:41:47 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s953flKW015144; Sun, 5 Oct 2014 03:41:47 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201410050341.s953flKW015144@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 5 Oct 2014 03:41:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272551 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 03:41:48 -0000 Author: cy Date: Sun Oct 5 03:41:47 2014 New Revision: 272551 URL: https://svnweb.freebsd.org/changeset/base/272551 Log: ipfiler bug #550 filter rule list corrupted with inserted rules Obtained from: ipfilter CVS repo (r1.128); NetBSD CVS repo (r1.15) Modified: head/sys/contrib/ipfilter/netinet/fil.c Modified: head/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/fil.c Sun Oct 5 03:18:30 2014 (r272550) +++ head/sys/contrib/ipfilter/netinet/fil.c Sun Oct 5 03:41:47 2014 (r272551) @@ -4496,7 +4496,15 @@ frrequest(softc, unit, req, data, set, m fp = f; f = NULL; + fp->fr_next = NULL; fp->fr_dnext = NULL; + fp->fr_pnext = NULL; + fp->fr_pdnext = NULL; + fp->fr_grp = NULL; + fp->fr_grphead = NULL; + fp->fr_icmpgrp = NULL; + fp->fr_isc = (void *)-1; + fp->fr_ptr = NULL; fp->fr_ref = 0; fp->fr_flags |= FR_COPIED; } else { @@ -5000,7 +5008,9 @@ frrequest(softc, unit, req, data, set, m if (f->fr_collect > fp->fr_collect) break; ftail = &f->fr_next; + fprev = ftail; } + ftail = fprev; f = NULL; ptr = NULL; } else if (req == (ioctlcmd_t)SIOCINAFR || @@ -5091,6 +5101,8 @@ frrequest(softc, unit, req, data, set, m fp->fr_ref = 1; fp->fr_pnext = ftail; fp->fr_next = *ftail; + if (fp->fr_next != NULL) + fp->fr_next->fr_pnext = &fp->fr_next; *ftail = fp; if (addrem == 0) ipf_fixskip(ftail, fp, 1); From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 03:45:20 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C8B60CE; Sun, 5 Oct 2014 03:45:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AAABBA5A; Sun, 5 Oct 2014 03:45:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s953jKTN015695; Sun, 5 Oct 2014 03:45:20 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s953jKTo015694; Sun, 5 Oct 2014 03:45:20 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201410050345.s953jKTo015694@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 5 Oct 2014 03:45:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272552 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 03:45:21 -0000 Author: cy Date: Sun Oct 5 03:45:19 2014 New Revision: 272552 URL: https://svnweb.freebsd.org/changeset/base/272552 Log: ipfilter bug #554 Determining why a ipf rule matches is hard -- replace ipfilter rule compare with new ipf_rule_compare() function. Obtained from: ipfilter CVS rep (r1.129) Modified: head/sys/contrib/ipfilter/netinet/fil.c Modified: head/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/fil.c Sun Oct 5 03:41:47 2014 (r272551) +++ head/sys/contrib/ipfilter/netinet/fil.c Sun Oct 5 03:45:19 2014 (r272552) @@ -4436,6 +4436,39 @@ ipf_matchicmpqueryreply(v, ic, icmp, rev /* ------------------------------------------------------------------------ */ +/* Function: ipf_rule_compare */ +/* Parameters: fr1(I) - first rule structure to compare */ +/* fr2(I) - second rule structure to compare */ +/* Returns: int - 0 == rules are the same, else mismatch */ +/* */ +/* Compare two rules and return 0 if they match or a number indicating */ +/* which of the individual checks failed. */ +/* ------------------------------------------------------------------------ */ +static int +ipf_rule_compare(frentry_t *fr1, frentry_t *fr2) +{ + if (fr1->fr_cksum != fr2->fr_cksum) + return 1; + if (fr1->fr_size != fr2->fr_size) + return 2; + if (fr1->fr_dsize != fr2->fr_dsize) + return 3; + if (bcmp((char *)&fr1->fr_func, (char *)&fr2->fr_func, + fr1->fr_size - offsetof(struct frentry, fr_func)) != 0) + return 4; + if (fr1->fr_data && !fr2->fr_data) + return 5; + if (!fr1->fr_data && fr2->fr_data) + return 6; + if (fr1->fr_data) { + if (bcmp(fr1->fr_caddr, fr2->fr_caddr, fr1->fr_dsize)) + return 7; + } + return 0; +} + + +/* ------------------------------------------------------------------------ */ /* Function: frrequest */ /* Returns: int - 0 == success, > 0 == errno value */ /* Parameters: unit(I) - device for which this is for */ @@ -4928,17 +4961,7 @@ frrequest(softc, unit, req, data, set, m } for (; (f = *ftail) != NULL; ftail = &f->fr_next) { - DT2(rule_cmp, frentry_t *, fp, frentry_t *, f); - if ((fp->fr_cksum != f->fr_cksum) || - (fp->fr_size != f->fr_size) || - (f->fr_dsize != fp->fr_dsize)) - continue; - if (bcmp((char *)&f->fr_func, (char *)&fp->fr_func, - fp->fr_size - offsetof(struct frentry, fr_func)) != 0) - continue; - if ((!ptr && !f->fr_data) || - (ptr && f->fr_data && - !bcmp((char *)ptr, (char *)f->fr_data, f->fr_dsize))) + if (ipf_rule_compare(fp, f) == 0) break; } From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 03:48:09 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D163F323; Sun, 5 Oct 2014 03:48:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BE5EAA79; Sun, 5 Oct 2014 03:48:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s953m9Qp016073; Sun, 5 Oct 2014 03:48:09 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s953m9aJ016072; Sun, 5 Oct 2014 03:48:09 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201410050348.s953m9aJ016072@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 5 Oct 2014 03:48:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272553 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 03:48:09 -0000 Author: cy Date: Sun Oct 5 03:48:09 2014 New Revision: 272553 URL: https://svnweb.freebsd.org/changeset/base/272553 Log: ipfilter bug #538 ipf_p_dns_del should return void Obtained from: ipfilter cvs repo (r1.8) Modified: head/sys/contrib/ipfilter/netinet/ip_dns_pxy.c Modified: head/sys/contrib/ipfilter/netinet/ip_dns_pxy.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_dns_pxy.c Sun Oct 5 03:45:19 2014 (r272552) +++ head/sys/contrib/ipfilter/netinet/ip_dns_pxy.c Sun Oct 5 03:48:09 2014 (r272553) @@ -29,7 +29,7 @@ typedef struct ipf_dns_softc_s { int ipf_p_dns_allow_query __P((ipf_dns_softc_t *, dnsinfo_t *)); int ipf_p_dns_ctl __P((ipf_main_softc_t *, void *, ap_ctl_t *)); -int ipf_p_dns_del __P((ipf_main_softc_t *, ap_session_t *)); +void ipf_p_dns_del __P((ipf_main_softc_t *, ap_session_t *)); int ipf_p_dns_get_name __P((ipf_dns_softc_t *, char *, int, char *, int)); int ipf_p_dns_inout __P((void *, fr_info_t *, ap_session_t *, nat_t *)); int ipf_p_dns_match __P((fr_info_t *, ap_session_t *, nat_t *)); @@ -214,7 +214,7 @@ ipf_p_dns_new(arg, fin, aps, nat) /* ARGSUSED */ -int +void ipf_p_dns_del(softc, aps) ipf_main_softc_t *softc; ap_session_t *aps; @@ -227,7 +227,6 @@ ipf_p_dns_del(softc, aps) KFREES(aps->aps_data, aps->aps_psiz); aps->aps_data = NULL; aps->aps_psiz = 0; - return 0; } From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 03:52:10 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8844C612; Sun, 5 Oct 2014 03:52:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 743F5B17; Sun, 5 Oct 2014 03:52:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s953qAKA019975; Sun, 5 Oct 2014 03:52:10 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s953qAsV019974; Sun, 5 Oct 2014 03:52:10 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201410050352.s953qAsV019974@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 5 Oct 2014 03:52:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272554 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 03:52:10 -0000 Author: cy Date: Sun Oct 5 03:52:09 2014 New Revision: 272554 URL: https://svnweb.freebsd.org/changeset/base/272554 Log: ipfilter bug #534 destination list hashing not endian neutral Obtained from: ipfilter CVS repo (r1.26), NetBSD CVS repo (r1.8) Modified: head/sys/contrib/ipfilter/netinet/ip_dstlist.c Modified: head/sys/contrib/ipfilter/netinet/ip_dstlist.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_dstlist.c Sun Oct 5 03:48:09 2014 (r272553) +++ head/sys/contrib/ipfilter/netinet/ip_dstlist.c Sun Oct 5 03:52:09 2014 (r272554) @@ -1193,7 +1193,7 @@ ipf_dstlist_select(fin, d) MD5Update(&ctx, (u_char *)&fin->fin_dst6, sizeof(fin->fin_dst6)); MD5Final((u_char *)hash, &ctx); - x = hash[0] % d->ipld_nodes; + x = ntohl(hash[0]) % d->ipld_nodes; sel = d->ipld_dests[x]; break; @@ -1203,7 +1203,7 @@ ipf_dstlist_select(fin, d) MD5Update(&ctx, (u_char *)&fin->fin_src6, sizeof(fin->fin_src6)); MD5Final((u_char *)hash, &ctx); - x = hash[0] % d->ipld_nodes; + x = ntohl(hash[0]) % d->ipld_nodes; sel = d->ipld_dests[x]; break; @@ -1213,7 +1213,7 @@ ipf_dstlist_select(fin, d) MD5Update(&ctx, (u_char *)&fin->fin_dst6, sizeof(fin->fin_dst6)); MD5Final((u_char *)hash, &ctx); - x = hash[0] % d->ipld_nodes; + x = ntohl(hash[0]) % d->ipld_nodes; sel = d->ipld_dests[x]; break; From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 03:58:31 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C9EA7776; Sun, 5 Oct 2014 03:58:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B5369B2A; Sun, 5 Oct 2014 03:58:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s953wV8X020748; Sun, 5 Oct 2014 03:58:31 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s953wVRv020747; Sun, 5 Oct 2014 03:58:31 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201410050358.s953wVRv020747@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 5 Oct 2014 03:58:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272555 - head/sys/contrib/ipfilter/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 03:58:31 -0000 Author: cy Date: Sun Oct 5 03:58:30 2014 New Revision: 272555 URL: https://svnweb.freebsd.org/changeset/base/272555 Log: ipfilter bug #537 NAT rules with sticky have incorrect hostmap IP address. This fixes when an IP address mapping is put in the hostmap table for sticky NAT rules, it ends up having the wrong byte order. Obtained from: ipfilter CVS repo (r1.102), NetBSD CVS repo (r1.12) Modified: head/sys/contrib/ipfilter/netinet/ip_nat.c Modified: head/sys/contrib/ipfilter/netinet/ip_nat.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_nat.c Sun Oct 5 03:52:09 2014 (r272554) +++ head/sys/contrib/ipfilter/netinet/ip_nat.c Sun Oct 5 03:58:30 2014 (r272555) @@ -2946,10 +2946,11 @@ ipf_nat_newrdr(fin, nat, ni) */ if (np->in_flags & IPN_SPLIT) { in.s_addr = np->in_dnip; + inb.s_addr = htonl(in.s_addr); if ((np->in_flags & (IPN_ROUNDR|IPN_STICKY)) == IPN_STICKY) { hm = ipf_nat_hostmap(softn, NULL, fin->fin_src, - fin->fin_dst, in, (u_32_t)dport); + fin->fin_dst, inb, (u_32_t)dport); if (hm != NULL) { in.s_addr = hm->hm_ndstip.s_addr; move = 0; @@ -3050,13 +3051,14 @@ ipf_nat_newrdr(fin, nat, ni) return -1; } + inb.s_addr = htonl(in.s_addr); nat->nat_ndstaddr = htonl(in.s_addr); nat->nat_odstip = fin->fin_dst; nat->nat_nsrcip = fin->fin_src; nat->nat_osrcip = fin->fin_src; if ((nat->nat_hm == NULL) && ((np->in_flags & IPN_STICKY) != 0)) nat->nat_hm = ipf_nat_hostmap(softn, np, fin->fin_src, - fin->fin_dst, in, (u_32_t)dport); + fin->fin_dst, inb, (u_32_t)dport); if (flags & IPN_TCPUDP) { nat->nat_odport = dport; From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 06:00:22 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C625323C; Sun, 5 Oct 2014 06:00:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B367D75C; Sun, 5 Oct 2014 06:00:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9560MeU078057; Sun, 5 Oct 2014 06:00:22 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9560MXC078056; Sun, 5 Oct 2014 06:00:22 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201410050600.s9560MXC078056@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sun, 5 Oct 2014 06:00:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272556 - head/sys/boot/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 06:00:22 -0000 Author: ae Date: Sun Oct 5 06:00:22 2014 New Revision: 272556 URL: https://svnweb.freebsd.org/changeset/base/272556 Log: Add a bit more debug messages. Modified: head/sys/boot/common/part.c Modified: head/sys/boot/common/part.c ============================================================================== --- head/sys/boot/common/part.c Sun Oct 5 03:58:30 2014 (r272555) +++ head/sys/boot/common/part.c Sun Oct 5 06:00:22 2014 (r272556) @@ -301,6 +301,7 @@ ptable_gptread(struct ptable *table, voi } } } + DEBUG("GPT detected"); if (pri == 0 && sec == 0) { /* Both primary and backup tables are invalid. */ table->type = PTABLE_NONE; @@ -378,6 +379,7 @@ ptable_ebrread(struct ptable *table, voi buf = malloc(table->sectorsize); if (buf == NULL) return (table); + DEBUG("EBR detected"); for (i = 0; i < MAXEBRENTRIES; i++) { #if 0 /* Some BIOSes return an incorrect number of sectors */ if (offset >= table->sectors) @@ -470,6 +472,7 @@ ptable_bsdread(struct ptable *table, voi DEBUG("invalid number of partitions"); goto out; } + DEBUG("BSD detected"); part = &dl->d_partitions[0]; raw_offset = le32toh(part[RAW_PART].p_offset); for (i = 0; i < dl->d_npartitions; i++, part++) { @@ -553,6 +556,7 @@ ptable_vtoc8read(struct ptable *table, v DEBUG("invalid geometry"); goto out; } + DEBUG("VTOC8 detected"); for (i = 0; i < VTOC8_NPARTS; i++) { dl->part[i].tag = be16toh(dl->part[i].tag); if (i == VTOC_RAW_PART || @@ -665,6 +669,7 @@ ptable_open(void *dev, off_t sectors, ui #endif #ifdef LOADER_MBR_SUPPORT /* Read MBR. */ + DEBUG("MBR detected"); table->type = PTABLE_MBR; for (i = has_ext = 0; i < NDOSPART; i++) { if (dp[i].dp_typ == 0) From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 06:04:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F202C3A8; Sun, 5 Oct 2014 06:04:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D2C417F5; Sun, 5 Oct 2014 06:04:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9564mhW080894; Sun, 5 Oct 2014 06:04:48 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9564ljm080884; Sun, 5 Oct 2014 06:04:47 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201410050604.s9564ljm080884@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sun, 5 Oct 2014 06:04:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272557 - in head: sys/boot/common tools/tools/bootparttest X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 06:04:49 -0000 Author: ae Date: Sun Oct 5 06:04:47 2014 New Revision: 272557 URL: https://svnweb.freebsd.org/changeset/base/272557 Log: Rework bootparttest to use more code from sys/boot. Use disk_open() call to emulate loader behavior. Added: head/tools/tools/bootparttest/stub.c - copied, changed from r272555, head/tools/tools/bootparttest/malloc.c Deleted: head/tools/tools/bootparttest/malloc.c Modified: head/sys/boot/common/disk.c head/tools/tools/bootparttest/Makefile head/tools/tools/bootparttest/bootparttest.c Modified: head/sys/boot/common/disk.c ============================================================================== --- head/sys/boot/common/disk.c Sun Oct 5 06:00:22 2014 (r272556) +++ head/sys/boot/common/disk.c Sun Oct 5 06:04:47 2014 (r272557) @@ -90,7 +90,7 @@ disk_lookup(struct disk_devdesc *dev) entry->d_partition == dev->d_partition) { dev->d_offset = entry->d_offset; DEBUG("%s offset %lld", disk_fmtdev(dev), - dev->d_offset); + (long long)dev->d_offset); #ifdef DISK_DEBUG entry->count++; #endif @@ -367,7 +367,7 @@ out: dev->d_slice = slice; dev->d_partition = partition; DEBUG("%s offset %lld => %p", disk_fmtdev(dev), - dev->d_offset, od); + (long long)dev->d_offset, od); } return (rc); } Modified: head/tools/tools/bootparttest/Makefile ============================================================================== --- head/tools/tools/bootparttest/Makefile Sun Oct 5 06:00:22 2014 (r272556) +++ head/tools/tools/bootparttest/Makefile Sun Oct 5 06:04:47 2014 (r272557) @@ -7,13 +7,14 @@ BINDIR?= /usr/bin PROG= bootparttest MAN= -SRCS= bootparttest.c crc32.c malloc.c part.c +SRCS= bootparttest.c crc32.c stub.c part.c disk.c -CFLAGS= -I${.CURDIR}/../../../sys/boot/common -I. \ - -DLOADER_GPT_SUPPORT -DLOADER_MBR_SUPPORT -DPART_DEBUG +CFLAGS= -I${.CURDIR}/../../../sys/boot/common \ + -DLOADER_GPT_SUPPORT -DLOADER_MBR_SUPPORT -DPART_DEBUG \ + -DDISK_DEBUG -DPADD+= ${LIBGEOM} ${LIBUTIL} -LDADD+= ${LIBGEOM} ${LIBUTIL} -LDFLAGS+= -lgeom -lutil +DPADD+= ${LIBGEOM} +LDADD+= ${LIBGEOM} +LDFLAGS+= -lgeom .include Modified: head/tools/tools/bootparttest/bootparttest.c ============================================================================== --- head/tools/tools/bootparttest/bootparttest.c Sun Oct 5 06:00:22 2014 (r272556) +++ head/tools/tools/bootparttest/bootparttest.c Sun Oct 5 06:04:47 2014 (r272557) @@ -33,140 +33,106 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include +#include #include +static int disk_strategy(void *devdata, int rw, daddr_t blk, + size_t size, char *buf, size_t *rsize); + +/* stub struct devsw */ +struct devsw { + const char dv_name[8]; + int dv_type; + void *dv_init; + int (*dv_strategy)(void *devdata, int rw, daddr_t blk, + size_t size, char *buf, size_t *rsize); + void *dv_open; + void *dv_close; + void *dv_ioctl; + void *dv_print; + void *dv_cleanupa; +} udisk = { + .dv_name = "disk", + .dv_strategy = disk_strategy +}; + struct disk { - const char *name; uint64_t mediasize; uint16_t sectorsize; int fd; int file; - off_t offset; -}; +} disk; static int -diskread(void *arg, void *buf, size_t blocks, off_t offset) +disk_strategy(void *devdata, int rw, daddr_t blk, size_t size, char *buf, + size_t *rsize) { - struct disk *dp; + struct disk_devdesc *dev = devdata; + int ret; - dp = (struct disk *)arg; - printf("%s: read %lu blocks from the offset %jd [+%jd]\n", dp->name, - blocks, offset, dp->offset); - if (offset >= dp->mediasize / dp->sectorsize) + if (rw != 1 /* F_READ */) return (-1); - - return (pread(dp->fd, buf, blocks * dp->sectorsize, - (offset + dp->offset) * dp->sectorsize) != blocks * dp->sectorsize); -} - -static const char* -ptable_type2str(const struct ptable *table) -{ - - switch (ptable_gettype(table)) { - case PTABLE_NONE: - return ("None"); - case PTABLE_BSD: - return ("BSD"); - case PTABLE_MBR: - return ("MBR"); - case PTABLE_GPT: - return ("GPT"); - case PTABLE_VTOC8: - return ("VTOC8"); - }; - return ("Unknown"); -} - -#define PWIDTH 35 -static void -ptable_print(void *arg, const char *pname, const struct ptable_entry *part) -{ - struct ptable *table; - struct disk *dp, bsd; - char line[80], size[6]; - - dp = (struct disk *)arg; - sprintf(line, " %s%s: %s", dp->file ? "disk0": dp->name, pname, - parttype2str(part->type)); - humanize_number(size, sizeof(size), - (part->end - part->start + 1) * dp->sectorsize, "", - HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL); - printf("%-*s%s\n", PWIDTH, line, size); - if (part->type == PART_FREEBSD) { - sprintf(line, "%s%s", dp->file ? "disk0": dp->name, pname); - bsd.name = line; - bsd.fd = dp->fd; - bsd.file = 0; /* to use dp->name in the next sprintf */ - bsd.offset = dp->offset + part->start; - bsd.sectorsize = dp->sectorsize; - bsd.mediasize = (part->end - part->start + 1) * dp->sectorsize; - table = ptable_open(&bsd, bsd.mediasize / bsd.sectorsize, - bsd.sectorsize, diskread); - if (table == NULL) - return; - ptable_iterate(table, &bsd, ptable_print); - ptable_close(table); - } -} -#undef PWIDTH - -static void -inspect_disk(struct disk *dp) -{ - struct ptable *table; - - table = ptable_open(dp, dp->mediasize / dp->sectorsize, - dp->sectorsize, diskread); - if (table == NULL) { - printf("ptable_open failed\n"); - return; - } - printf("Partition table detected: %s\n", ptable_type2str(table)); - ptable_iterate(table, dp, ptable_print); - ptable_close(table); + if (rsize) + *rsize = 0; + printf("read %lu bytes from the block %ld [+%ld]\n", size, + blk, dev->d_offset); + ret = pread(disk.fd, buf, size, + (blk + dev->d_offset) * disk.sectorsize); + if (ret != size) + return (-1); + return (0); } int main(int argc, char **argv) { + struct disk_devdesc dev; struct stat sb; - struct disk d; + const char *p; if (argc < 2) errx(1, "Usage: %s | " "", argv[0]); - d.name = argv[1]; - if (stat(d.name, &sb) == 0 && S_ISREG(sb.st_mode)) { - d.fd = open(d.name, O_RDONLY); - if (d.fd < 0) - err(1, "open %s", d.name); - d.mediasize = sb.st_size; - d.sectorsize = 512; - d.file = 1; + memset(&disk, 0, sizeof(disk)); + memset(&dev, 0, sizeof(dev)); + dev.d_dev = &udisk; + dev.d_slice = -1; + dev.d_partition = -1; + if (stat(argv[1], &sb) == 0 && S_ISREG(sb.st_mode)) { + disk.fd = open(argv[1], O_RDONLY); + if (disk.fd < 0) + err(1, "open %s", argv[1]); + disk.mediasize = sb.st_size; + disk.sectorsize = 512; + disk.file = 1; } else { - d.fd = g_open(d.name, 0); - if (d.fd < 0) - err(1, "g_open %s", d.name); - d.mediasize = g_mediasize(d.fd); - d.sectorsize = g_sectorsize(d.fd); - d.file = 0; + disk.fd = g_open(argv[1], 0); + if (disk.fd < 0) + err(1, "g_open %s", argv[1]); + disk.mediasize = g_mediasize(disk.fd); + disk.sectorsize = g_sectorsize(disk.fd); + p = strpbrk(argv[1], "0123456789"); + if (p != NULL) + disk_parsedev(&dev, p, NULL); } - d.offset = 0; - printf("%s \"%s\" opened\n", d.file ? "Disk image": "GEOM provider", - d.name); + printf("%s \"%s\" opened\n", disk.file ? "Disk image": "GEOM provider", + argv[1]); printf("Mediasize: %ju Bytes (%ju sectors)\nSectorsize: %u Bytes\n", - d.mediasize, d.mediasize / d.sectorsize, d.sectorsize); + disk.mediasize, disk.mediasize / disk.sectorsize, disk.sectorsize); - inspect_disk(&d); + if (disk_open(&dev, disk.mediasize, disk.sectorsize, 0) != 0) + errx(1, "disk_open failed"); + printf("\tdisk0:\n"); + disk_print(&dev, "\tdisk0", 1); + disk_close(&dev); - if (d.file) - close(d.fd); + if (disk.file) + close(disk.fd); else - g_close(d.fd); + g_close(disk.fd); return (0); } Copied and modified: head/tools/tools/bootparttest/stub.c (from r272555, head/tools/tools/bootparttest/malloc.c) ============================================================================== --- head/tools/tools/bootparttest/malloc.c Sun Oct 5 03:58:30 2014 (r272555, copy source) +++ head/tools/tools/bootparttest/stub.c Sun Oct 5 06:04:47 2014 (r272557) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include +#include void* Malloc(size_t size, const char *file, int line) @@ -42,3 +43,10 @@ Free(void *ptr, const char *file, int li return (free(ptr)); } + +void +pager_output(const char *s) +{ + + printf("%s", s); +} From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 06:06:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C5B8C58F; Sun, 5 Oct 2014 06:06:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B2B0780F; Sun, 5 Oct 2014 06:06:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9566ncK081200; Sun, 5 Oct 2014 06:06:49 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9566nNb081199; Sun, 5 Oct 2014 06:06:49 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201410050606.s9566nNb081199@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sun, 5 Oct 2014 06:06:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272558 - head/tools/tools/bootparttest X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 06:06:49 -0000 Author: ae Date: Sun Oct 5 06:06:48 2014 New Revision: 272558 URL: https://svnweb.freebsd.org/changeset/base/272558 Log: Fix typo. Modified: head/tools/tools/bootparttest/bootparttest.c Modified: head/tools/tools/bootparttest/bootparttest.c ============================================================================== --- head/tools/tools/bootparttest/bootparttest.c Sun Oct 5 06:04:47 2014 (r272557) +++ head/tools/tools/bootparttest/bootparttest.c Sun Oct 5 06:06:48 2014 (r272558) @@ -53,7 +53,7 @@ struct devsw { void *dv_close; void *dv_ioctl; void *dv_print; - void *dv_cleanupa; + void *dv_cleanup; } udisk = { .dv_name = "disk", .dv_strategy = disk_strategy From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 06:28:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 92C0E79E; Sun, 5 Oct 2014 06:28:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F587986; Sun, 5 Oct 2014 06:28:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s956SsMt090809; Sun, 5 Oct 2014 06:28:54 GMT (envelope-from rwatson@FreeBSD.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s956SsFU090808; Sun, 5 Oct 2014 06:28:54 GMT (envelope-from rwatson@FreeBSD.org) Message-Id: <201410050628.s956SsFU090808@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rwatson set sender to rwatson@FreeBSD.org using -f From: Robert Watson Date: Sun, 5 Oct 2014 06:28:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272559 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 06:28:54 -0000 Author: rwatson Date: Sun Oct 5 06:28:53 2014 New Revision: 272559 URL: https://svnweb.freebsd.org/changeset/base/272559 Log: Eliminate use of M_EXT in IP6_EXTHDR_CHECK() by trimming a redundant 'if'/'else' case: it matches the simple 'else' case that follows. This reduces awareness of external-storage mechanics outside of the mbuf allocator. Reviewed by: bz MFC after: 3 days Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D900 Modified: head/sys/netinet/ip6.h Modified: head/sys/netinet/ip6.h ============================================================================== --- head/sys/netinet/ip6.h Sun Oct 5 06:06:48 2014 (r272558) +++ head/sys/netinet/ip6.h Sun Oct 5 06:28:53 2014 (r272559) @@ -277,12 +277,6 @@ do { \ (((m) = m_pullup((m), (off) + (hlen))) == NULL)) { \ IP6STAT_INC(ip6s_exthdrtoolong); \ return ret; \ - } else if ((m)->m_flags & M_EXT) { \ - if ((m)->m_len < (off) + (hlen)) { \ - IP6STAT_INC(ip6s_exthdrtoolong); \ - m_freem(m); \ - return ret; \ - } \ } else { \ if ((m)->m_len < (off) + (hlen)) { \ IP6STAT_INC(ip6s_exthdrtoolong); \ From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 07:21:42 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 396EF229; Sun, 5 Oct 2014 07:21:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2684EE34; Sun, 5 Oct 2014 07:21:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s957Lg2P018836; Sun, 5 Oct 2014 07:21:42 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s957Lgeg018835; Sun, 5 Oct 2014 07:21:42 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410050721.s957Lgeg018835@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 5 Oct 2014 07:21:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272560 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 07:21:42 -0000 Author: mjg Date: Sun Oct 5 07:21:41 2014 New Revision: 272560 URL: https://svnweb.freebsd.org/changeset/base/272560 Log: Avoid unnecessary ppeers_lock acquisition in exit1. MFC after: 1 week Modified: head/sys/kern/kern_exit.c Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Sun Oct 5 06:28:53 2014 (r272559) +++ head/sys/kern/kern_exit.c Sun Oct 5 07:21:41 2014 (r272560) @@ -265,8 +265,8 @@ exit1(struct thread *td, int rv) AUDIT_SYSCALL_EXIT(0, td); #endif - /* Are we a task leader? */ - if (p == p->p_leader) { + /* Are we a task leader with peers? */ + if (p->p_peers != NULL && p == p->p_leader) { mtx_lock(&ppeers_lock); q = p->p_peers; while (q != NULL) { @@ -337,15 +337,17 @@ exit1(struct thread *td, int rv) /* * Remove ourself from our leader's peer list and wake our leader. */ - mtx_lock(&ppeers_lock); - if (p->p_leader->p_peers) { - q = p->p_leader; - while (q->p_peers != p) - q = q->p_peers; - q->p_peers = p->p_peers; - wakeup(p->p_leader); + if (p->p_leader->p_peers != NULL) { + mtx_lock(&ppeers_lock); + if (p->p_leader->p_peers != NULL) { + q = p->p_leader; + while (q->p_peers != p) + q = q->p_peers; + q->p_peers = p->p_peers; + wakeup(p->p_leader); + } + mtx_unlock(&ppeers_lock); } - mtx_unlock(&ppeers_lock); vmspace_exit(td); From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 07:27:06 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4503A3A4; Sun, 5 Oct 2014 07:27:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3120EE55; Sun, 5 Oct 2014 07:27:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s957R61Z019691; Sun, 5 Oct 2014 07:27:06 GMT (envelope-from nyan@FreeBSD.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s957R6N4019690; Sun, 5 Oct 2014 07:27:06 GMT (envelope-from nyan@FreeBSD.org) Message-Id: <201410050727.s957R6N4019690@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: nyan set sender to nyan@FreeBSD.org using -f From: Takahashi Yoshihiro Date: Sun, 5 Oct 2014 07:27:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272561 - head/sys/modules X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 07:27:06 -0000 Author: nyan Date: Sun Oct 5 07:27:05 2014 New Revision: 272561 URL: https://svnweb.freebsd.org/changeset/base/272561 Log: - Refactor defining variables. - Merge common modules both i386 and amd64 into one if-endif. - Sort. - There are no functional changes. Modified: head/sys/modules/Makefile Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Sun Oct 5 07:21:41 2014 (r272560) +++ head/sys/modules/Makefile Sun Oct 5 07:27:05 2014 (r272561) @@ -384,32 +384,7 @@ SUBDIR= \ ${_xe} \ xl \ ${_zfs} \ - zlib \ - -.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" -_filemon= filemon -_vmware= vmware -.endif - -.if ${MACHINE_CPUARCH} != "powerpc" && ${MACHINE_CPUARCH} != "arm" && \ - ${MACHINE_CPUARCH} != "mips" -_syscons= syscons -_vpo= vpo -.endif - -.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" -# no BUS_SPACE_UNSPECIFIED -# No barrier instruction support (specific to this driver) -_sym= sym -# intr_disable() is a macro, causes problems -.if ${MK_SOURCELESS_UCODE} != "no" -_cxgb= cxgb -.endif -.endif - -.if ${MK_SOURCELESS_UCODE} != "no" -_cxgbe= cxgbe -.endif + zlib .if ${MK_CRYPT} != "no" || defined(ALL_MODULES) .if exists(${.CURDIR}/../opencrypto) @@ -423,23 +398,20 @@ _random= random .if (${MK_INET_SUPPORT} != "no" || ${MK_INET6_SUPPORT} != "no") || \ defined(ALL_MODULES) -_carp= carp +_carp= carp _toecore= toecore .endif .if ${MK_INET_SUPPORT} != "no" || defined(ALL_MODULES) _if_gre= if_gre +_ipdivert= ipdivert +_ipfw= ipfw .endif .if ${MK_IPFILTER} != "no" || defined(ALL_MODULES) _ipfilter= ipfilter .endif -.if ${MK_INET_SUPPORT} != "no" || defined(ALL_MODULES) -_ipdivert= ipdivert -_ipfw= ipfw -.endif - .if ${MK_NAND} != "no" || defined(ALL_MODULES) _nandfs= nandfs _nandsim= nandsim @@ -460,6 +432,7 @@ _pfsync= pfsync .if ${MK_SOURCELESS_UCODE} != "no" _bce= bce +_cxgbe= cxgbe _fatm= fatm _fxp= fxp _ispfw= ispfw @@ -471,31 +444,33 @@ _ti= ti _txp= txp .endif -.if ${MACHINE_CPUARCH} == "i386" -# XXX some of these can move to the general case when de-i386'ed -# XXX some of these can move now, but are untested on other architectures. -_3dfx= 3dfx -_3dfx_linux= 3dfx_linux + +.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" && \ + ${MACHINE_CPUARCH} != "powerpc" +_syscons= syscons +_vpo= vpo +.endif + +.if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" +# no BUS_SPACE_UNSPECIFIED +# No barrier instruction support (specific to this driver) +_sym= sym +# intr_disable() is a macro, causes problems +.if ${MK_SOURCELESS_UCODE} != "no" +_cxgb= cxgb +.endif +.endif + +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" _agp= agp -_aic= aic _an= an _aout= aout -_apm= apm -_arcnet= arcnet _bktr= bktr _bxe= bxe _cardbus= cardbus _cbb= cbb -.if ${MK_SOURCELESS_UCODE} != "no" -_ce= ce -.endif -_coff= coff -.if ${MK_SOURCELESS_UCODE} != "no" -_cp= cp -.endif _cpuctl= cpuctl _cpufreq= cpufreq -_cs= cs .if ${MK_CDDL} != "no" || defined(ALL_MODULES) _cyclic= cyclic .endif @@ -506,21 +481,15 @@ _drm2= drm2 _dtrace= dtrace .endif _ed= ed -_elink= elink _em= em -_ep= ep _et= et _exca= exca _ext2fs= ext2fs -_fe= fe -_glxiic= glxiic -_glxsb= glxsb +_filemon= filemon _i2c= i2c .if ${MK_OFED} != "no" || defined(ALL_MODULES) _ibcore= ibcore .endif -_ibcs2= ibcs2 -_ie= ie _if_ndis= if_ndis _igb= igb _io= io @@ -530,28 +499,15 @@ _ipoib= ipoib _linprocfs= linprocfs _linsysfs= linsysfs _linux= linux -_mse= mse -.if ${MK_OFED} != "no" || defined(ALL_MODULES) -_mlx4= mlx4 -_mlx4ib= mlx4ib -_mlxen= mlxen -_mthca= mthca -.endif -_ncr= ncr -_ncv= ncv _ndis= ndis -_nsp= nsp .if ${MK_CDDL} != "no" || defined(ALL_MODULES) _opensolaris= opensolaris .endif _pccard= pccard -_pcfclock= pcfclock -_pst= pst .if ${MK_OFED} != "no" || defined(ALL_MODULES) _rdma= rdma .endif _safe= safe -_sbni= sbni _scsi_low= scsi_low _si= si _smbfs= smbfs @@ -559,42 +515,27 @@ _sound= sound _speaker= speaker _splash= splash _sppp= sppp -_stg= stg -_streams= streams -_svr4= svr4 +_vmware= vmware _vxge= vxge _wbwd= wbwd -_wds= wds _wi= wi -_xe= xe .if ${MK_ZFS} != "no" || defined(ALL_MODULES) _zfs= zfs .endif -.if ${MACHINE} == "i386" +.if ${MACHINE} != "pc98" _aac= aac _aacraid= aacraid _acpi= acpi .if ${MK_CRYPT} != "no" || defined(ALL_MODULES) _aesni= aesni .endif -.if ${MK_EISA} != "no" -_ahb= ahb -.endif _amdsbwd= amdsbwd _amdtemp= amdtemp _arcmsr= arcmsr _asmc= asmc -_asr= asr -_bios= bios _ciss= ciss -_cm= cm _cmx= cmx _coretemp= coretemp -.if ${MK_SOURCELESS_UCODE} != "no" -_ctau= ctau -.endif -_dpt= dpt -_ex= ex .if ${MK_SOURCELESS_HOST} != "no" _hpt27xx= hpt27xx .endif @@ -625,171 +566,102 @@ _iwnfw= iwnfw .endif _ixgb= ixgb _ixgbe= ixgbe +.if ${MK_OFED} != "no" || defined(ALL_MODULES) +_mlx4= mlx4 +_mlx4ib= mlx4ib +_mlxen= mlxen +.endif _mly= mly +.if ${MK_OFED} != "no" || defined(ALL_MODULES) +_mthca= mthca +.endif _nfe= nfe _nvd= nvd _nvme= nvme _nvram= nvram _nxge= nxge -_tpm= tpm -_viawd= viawd -_wl= wl -_wpi= wpi -.if ${MK_SOURCELESS_UCODE} != "no" -_wpifw= wpifw -.endif .if ${MK_CRYPT} != "no" || defined(ALL_MODULES) _padlock= padlock .endif _s3= s3 +_tpm= tpm _twa= twa _vesa= vesa +_viawd= viawd _virtio= virtio +_wpi= wpi +.if ${MK_SOURCELESS_UCODE} != "no" +_wpifw= wpifw +.endif _x86bios= x86bios -.elif ${MACHINE} == "pc98" -_canbepm= canbepm -_canbus= canbus -_ct= ct -_pmc= pmc -_snc= snc .endif .endif .if ${MACHINE_CPUARCH} == "amd64" -_aac= aac -_aacraid= aacraid -_aout= aout -_acpi= acpi -.if ${MK_CRYPT} != "no" || defined(ALL_MODULES) -_aesni= aesni -.endif -_agp= agp -_an= an -_amdsbwd= amdsbwd -_amdtemp= amdtemp -_arcmsr= arcmsr -_asmc= asmc -_bktr= bktr -_bxe= bxe -_cardbus= cardbus -_cbb= cbb -_cmx= cmx -_ciss= ciss -_coretemp= coretemp -_cpuctl= cpuctl -_cpufreq= cpufreq -.if ${MK_CDDL} != "no" || defined(ALL_MODULES) -_cyclic= cyclic -.endif -_dpms= dpms -_drm= drm -_drm2= drm2 -.if ${MK_CDDL} != "no" || defined(ALL_MODULES) -_dtrace= dtrace -.endif -_ed= ed -_et= et -_em= em -_exca= exca -_ext2fs= ext2fs -.if ${MK_SOURCELESS_HOST} != "no" -_hpt27xx= hpt27xx -.endif -_hptiop= hptiop -.if ${MK_SOURCELESS_HOST} != "no" -_hptmv= hptmv -_hptnr= hptnr -_hptrr= hptrr -.endif -_hyperv= hyperv -_i2c= i2c -.if ${MK_OFED} != "no" || defined(ALL_MODULES) -_ibcore= ibcore -.endif -_ichwd= ichwd -_ida= ida -_if_ndis= if_ndis -_igb= igb -_iir= iir -_io= io -_ipmi= ipmi -.if ${MK_OFED} != "no" || defined(ALL_MODULES) -_ipoib= ipoib -.endif -_ips= ips -_ipw= ipw -.if ${MK_SOURCELESS_UCODE} != "no" -_ipwfw= ipwfw -.endif -_isci= isci -_iwi= iwi -.if ${MK_SOURCELESS_UCODE} != "no" -_iwifw= iwifw -.endif -_iwn= iwn -.if ${MK_SOURCELESS_UCODE} != "no" -_iwnfw= iwnfw -.endif -_ixgb= ixgb -_ixgbe= ixgbe _ixl= ixl _ixlv= ixlv -_linprocfs= linprocfs -_linsysfs= linsysfs -_linux= linux -_mly= mly -.if ${MK_OFED} != "no" || defined(ALL_MODULES) -_mlx4= mlx4 -_mlx4ib= mlx4ib -_mlxen= mlxen -_mthca= mthca -.endif -_ndis= ndis -_nfe= nfe _ntb= ntb -_nvd= nvd -_nvme= nvme -_nvram= nvram -_nxge= nxge -.if ${MK_CDDL} != "no" || defined(ALL_MODULES) -_opensolaris= opensolaris -.endif -.if ${MK_CRYPT} != "no" || defined(ALL_MODULES) -_padlock= padlock -.endif -_pccard= pccard _qlxge= qlxge _qlxgb= qlxgb _qlxgbe= qlxgbe -.if ${MK_OFED} != "no" || defined(ALL_MODULES) -_rdma= rdma -.endif -_s3= s3 -_safe= safe -_scsi_low= scsi_low _sfxge= sfxge -_si= si -_smbfs= smbfs -_sound= sound -_speaker= speaker -_splash= splash -_sppp= sppp -_tpm= tpm -_twa= twa -_vesa= vesa -_viawd= viawd -_virtio= virtio _vmm= vmm -_vxge= vxge -_x86bios= x86bios -_wbwd= wbwd -_wi= wi -_wpi= wpi +.endif + +.if ${MACHINE_CPUARCH} == "i386" +# XXX some of these can move to the general case when de-i386'ed +# XXX some of these can move now, but are untested on other architectures. +_3dfx= 3dfx +_3dfx_linux= 3dfx_linux +_aic= aic +_apm= apm +_arcnet= arcnet .if ${MK_SOURCELESS_UCODE} != "no" -_wpifw= wpifw +_ce= ce .endif -.if ${MK_ZFS} != "no" || defined(ALL_MODULES) -_zfs= zfs +_coff= coff +.if ${MK_SOURCELESS_UCODE} != "no" +_cp= cp +.endif +_cs= cs +_elink= elink +_ep= ep +_fe= fe +_glxiic= glxiic +_glxsb= glxsb +_ibcs2= ibcs2 +_ie= ie +_mse= mse +_ncr= ncr +_ncv= ncv +_nsp= nsp +_pcfclock= pcfclock +_pst= pst +_sbni= sbni +_streams= streams +_stg= stg +_svr4= svr4 +_wds= wds +_xe= xe +.if ${MACHINE} == "i386" +.if ${MK_EISA} != "no" +_ahb= ahb +.endif +_asr= asr +_bios= bios +_cm= cm +.if ${MK_SOURCELESS_UCODE} != "no" +_ctau= ctau +.endif +_dpt= dpt +_ex= ex +_wl= wl +.elif ${MACHINE} == "pc98" +_canbepm= canbepm +_canbus= canbus +_ct= ct +_pmc= pmc +_snc= snc .endif .endif @@ -816,12 +688,12 @@ _dtrace= dtrace .endif _exca= exca _nvram= powermac_nvram -_pccard= pccard -_smbfs= smbfs -_sound= sound .if ${MK_CDDL} != "no" || defined(ALL_MODULES) _opensolaris= opensolaris .endif +_pccard= pccard +_smbfs= smbfs +_sound= sound _wi= wi .endif @@ -846,6 +718,7 @@ _sound= sound _zfs= zfs .endif .endif + .endif .for reject in ${WITHOUT_MODULES} From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 07:29:51 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A5DE450F; Sun, 5 Oct 2014 07:29:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9247CE6B; Sun, 5 Oct 2014 07:29:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s957Tpe6020061; Sun, 5 Oct 2014 07:29:51 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s957TpY9020060; Sun, 5 Oct 2014 07:29:51 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201410050729.s957TpY9020060@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Sun, 5 Oct 2014 07:29:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272562 - head/lib/libc/stdtime X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 07:29:51 -0000 Author: ache Date: Sun Oct 5 07:29:50 2014 New Revision: 272562 URL: https://svnweb.freebsd.org/changeset/base/272562 Log: 1) For %Z format, understand "UTC" name too. 2) Return NULL if timegm() fails, because it means we can convert what we have in GMT to local time needed. Modified: head/lib/libc/stdtime/strptime.c Modified: head/lib/libc/stdtime/strptime.c ============================================================================== --- head/lib/libc/stdtime/strptime.c Sun Oct 5 07:27:05 2014 (r272561) +++ head/lib/libc/stdtime/strptime.c Sun Oct 5 07:29:50 2014 (r272562) @@ -552,7 +552,8 @@ label: strncpy(zonestr, buf, cp - buf); zonestr[cp - buf] = '\0'; tzset(); - if (0 == strcmp(zonestr, "GMT")) { + if (0 == strcmp(zonestr, "GMT") || + 0 == strcmp(zonestr, "UTC")) { *GMTp = 1; } else if (0 == strcmp(zonestr, tzname[0])) { tm->tm_isdst = 0; @@ -674,6 +675,9 @@ strptime_l(const char * __restrict buf, ret = _strptime(buf, fmt, tm, &gmt, loc); if (ret && gmt) { time_t t = timegm(tm); + + if (t == -1) + return (NULL); localtime_r(&t, tm); } From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 11:06:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 123F178A; Sun, 5 Oct 2014 11:06:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F22398E9; Sun, 5 Oct 2014 11:06:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s95B6MZ4024111; Sun, 5 Oct 2014 11:06:22 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s95B6M4g024110; Sun, 5 Oct 2014 11:06:22 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201410051106.s95B6M4g024110@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 5 Oct 2014 11:06:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272564 - head/contrib/binutils/bfd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 11:06:23 -0000 Author: andrew Date: Sun Oct 5 11:06:22 2014 New Revision: 272564 URL: https://svnweb.freebsd.org/changeset/base/272564 Log: Merge the big-endian ARM targets together, and the little-endian ARM targets. With this we assume any ARM target containing eb is big-endian, otherwise it is little-endian. Modified: head/contrib/binutils/bfd/config.bfd Modified: head/contrib/binutils/bfd/config.bfd ============================================================================== --- head/contrib/binutils/bfd/config.bfd Sun Oct 5 10:20:47 2014 (r272563) +++ head/contrib/binutils/bfd/config.bfd Sun Oct 5 11:06:22 2014 (r272564) @@ -273,19 +273,11 @@ case "${targ}" in targ_defvec=bfd_elf32_littlearm_vec targ_selvecs=bfd_elf32_bigarm_vec ;; - armeb-*-freebsd*) + arm*eb*-*-freebsd*) targ_defvec=bfd_elf32_bigarm_vec targ_selvecs=bfd_elf32_littlearm_vec ;; - armv6eb-*-freebsd*) - targ_defvec=bfd_elf32_bigarm_vec - targ_selvecs=bfd_elf32_littlearm_vec - ;; - armv6-*-freebsd* | armv6hf-*-freebsd*) - targ_defvec=bfd_elf32_littlearm_vec - targ_selvecs=bfd_elf32_bigarm_vec - ;; - arm-*-elf | arm-*-freebsd* | arm*-*-linux-* | arm*-*-conix* | \ + arm-*-elf | arm*-*-freebsd* | arm*-*-linux-* | arm*-*-conix* | \ arm*-*-uclinux* | arm-*-kfreebsd*-gnu | \ arm*-*-eabi* ) targ_defvec=bfd_elf32_littlearm_vec From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 11:16:17 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3823AB24; Sun, 5 Oct 2014 11:16:17 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2444A9C6; Sun, 5 Oct 2014 11:16:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s95BGH8t029238; Sun, 5 Oct 2014 11:16:17 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s95BGHlY029237; Sun, 5 Oct 2014 11:16:17 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201410051116.s95BGHlY029237@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sun, 5 Oct 2014 11:16:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272565 - head/tools/tools/bootparttest X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 11:16:17 -0000 Author: ae Date: Sun Oct 5 11:16:16 2014 New Revision: 272565 URL: https://svnweb.freebsd.org/changeset/base/272565 Log: Fix format string warnings. Modified: head/tools/tools/bootparttest/bootparttest.c Modified: head/tools/tools/bootparttest/bootparttest.c ============================================================================== --- head/tools/tools/bootparttest/bootparttest.c Sun Oct 5 11:06:22 2014 (r272564) +++ head/tools/tools/bootparttest/bootparttest.c Sun Oct 5 11:16:16 2014 (r272565) @@ -78,8 +78,8 @@ disk_strategy(void *devdata, int rw, dad return (-1); if (rsize) *rsize = 0; - printf("read %lu bytes from the block %ld [+%ld]\n", size, - blk, dev->d_offset); + printf("read %zu bytes from the block %lld [+%lld]\n", size, + (long long)blk, (long long)dev->d_offset); ret = pread(disk.fd, buf, size, (blk + dev->d_offset) * disk.sectorsize); if (ret != size) From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 16:40:05 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6250FCAB; Sun, 5 Oct 2014 16:40:05 +0000 (UTC) Received: from fep19.mx.upcmail.net (fep19.mx.upcmail.net [62.179.121.39]) by mx1.freebsd.org (Postfix) with ESMTP id BD86CC0F; Sun, 5 Oct 2014 16:40:02 +0000 (UTC) Received: from edge04.upcmail.net ([192.168.13.239]) by viefep19-int.chello.at (InterMail vM.8.01.05.05 201-2260-151-110-20120111) with ESMTP id <20141005163954.UMLU22985.viefep19-int.chello.at@edge04.upcmail.net>; Sun, 5 Oct 2014 18:39:54 +0200 Received: from mole.fafoe.narf.at ([80.109.238.242]) by edge04.upcmail.net with edge id zUft1o00F5EV2AQ01UftYh; Sun, 05 Oct 2014 18:39:53 +0200 X-SourceIP: 80.109.238.242 Received: by mole.fafoe.narf.at (Postfix, from userid 1001) id 513106D47C; Sun, 5 Oct 2014 18:39:54 +0200 (CEST) Date: Sun, 5 Oct 2014 18:39:54 +0200 From: Stefan Farfeleder To: "Bjoern A. Zeeb" Subject: Re: svn commit: r272505 - in head/sys: kern sys Message-ID: <20141005163953.GA1890@mole.fafoe.narf.at> References: <201410040808.s9488uAI099166@svn.freebsd.org> <42180557-0119-4597-9492-662E1671A840@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <42180557-0119-4597-9492-662E1671A840@FreeBSD.org> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Konstantin Belousov , Mateusz Guzik X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 16:40:05 -0000 On Sat, Oct 04, 2014 at 02:21:54PM +0000, Bjoern A. Zeeb wrote: > > On 04 Oct 2014, at 08:08 , Mateusz Guzik wrote: > > > Author: mjg > > Date: Sat Oct 4 08:08:56 2014 > > New Revision: 272505 > > URL: https://svnweb.freebsd.org/changeset/base/272505 > > > > Log: > > Plug capability races. > > > > fp and appropriate capability lookups were not atomic, which could result in > > improper capabilities being checked. > > > > This could result either in protection bypass or in a spurious ENOTCAPABLE. > > > > Make fp + capability check atomic with the help of sequence counters. > > > > Reviewed by: kib > > MFC after: 3 weeks > > > > Modified: > > head/sys/kern/kern_descrip.c > > head/sys/sys/filedesc.h > > … > > > This file is included from user space. There is no opt_capsicum.h there. > Including an opt_* in the header file seems wrong in a lot of ways usually. > > I tried to add a bandaid for the moment with r272523 which (to be honest) makes it worse. > > This needs a better fix. Hi, this also breaks the nvidia-driver port (also with your fix). BR, Stefan From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 17:16:22 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C6F88593; Sun, 5 Oct 2014 17:16:22 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3713CFB0; Sun, 5 Oct 2014 17:16:22 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id s95HGHiA086725 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 5 Oct 2014 20:16:17 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua s95HGHiA086725 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id s95HGHuX086724; Sun, 5 Oct 2014 20:16:17 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 5 Oct 2014 20:16:17 +0300 From: Konstantin Belousov To: Stefan Farfeleder Subject: Re: svn commit: r272505 - in head/sys: kern sys Message-ID: <20141005171617.GB26076@kib.kiev.ua> References: <201410040808.s9488uAI099166@svn.freebsd.org> <42180557-0119-4597-9492-662E1671A840@FreeBSD.org> <20141005163953.GA1890@mole.fafoe.narf.at> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20141005163953.GA1890@mole.fafoe.narf.at> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: src-committers@freebsd.org, Mateusz Guzik , svn-src-all@freebsd.org, "Bjoern A. Zeeb" , Konstantin Belousov , svn-src-head@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 17:16:22 -0000 On Sun, Oct 05, 2014 at 06:39:54PM +0200, Stefan Farfeleder wrote: > On Sat, Oct 04, 2014 at 02:21:54PM +0000, Bjoern A. Zeeb wrote: > > > > On 04 Oct 2014, at 08:08 , Mateusz Guzik wrote: > > > > > Author: mjg > > > Date: Sat Oct 4 08:08:56 2014 > > > New Revision: 272505 > > > URL: https://svnweb.freebsd.org/changeset/base/272505 > > > > > > Log: > > > Plug capability races. > > > > > > fp and appropriate capability lookups were not atomic, which could result in > > > improper capabilities being checked. > > > > > > This could result either in protection bypass or in a spurious ENOTCAPABLE. > > > > > > Make fp + capability check atomic with the help of sequence counters. > > > > > > Reviewed by: kib > > > MFC after: 3 weeks > > > > > > Modified: > > > head/sys/kern/kern_descrip.c > > > head/sys/sys/filedesc.h > > > ??? > > > > > > This file is included from user space. There is no opt_capsicum.h there. > > Including an opt_* in the header file seems wrong in a lot of ways usually. > > > > I tried to add a bandaid for the moment with r272523 which (to be honest) makes it worse. > > > > This needs a better fix. > > Hi, > > this also breaks the nvidia-driver port (also with your fix). Is the breakage due to missing opt_capsicum.h file ? If yes, what I proposed, i.e. making the new member unconditional, should fix it without changes to the module build system. From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 17:36:01 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 21F65A3C; Sun, 5 Oct 2014 17:36:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 022F6235; Sun, 5 Oct 2014 17:36:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s95Ha09o010638; Sun, 5 Oct 2014 17:36:00 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s95Ha0U7010634; Sun, 5 Oct 2014 17:36:00 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201410051736.s95Ha0U7010634@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 5 Oct 2014 17:36:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272566 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 17:36:01 -0000 Author: kib Date: Sun Oct 5 17:35:59 2014 New Revision: 272566 URL: https://svnweb.freebsd.org/changeset/base/272566 Log: On error, sbuf_bcat() returns -1. Some callers returned this -1 to the upper layers, which interpret it as errno value, which happens to be ERESTART. The result was spurious restarts of the sysctls in loop, e.g. kern.proc.proc, instead of returning ENOMEM to caller. Convert -1 from sbuf_bcat() to ENOMEM, when returning to the callers expecting errno. In collaboration with: pho Sponsored by: The FreeBSD Foundation (kib) MFC after: 1 week Modified: head/sys/kern/kern_descrip.c head/sys/kern/kern_proc.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Sun Oct 5 11:16:16 2014 (r272565) +++ head/sys/kern/kern_descrip.c Sun Oct 5 17:35:59 2014 (r272566) @@ -3097,7 +3097,7 @@ export_kinfo_to_sb(struct export_fd_buf } efbuf->remainder -= kif->kf_structsize; } - return (sbuf_bcat(efbuf->sb, kif, kif->kf_structsize)); + return (sbuf_bcat(efbuf->sb, kif, kif->kf_structsize) == 0 ? 0 : ENOMEM); } static int Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Sun Oct 5 11:16:16 2014 (r272565) +++ head/sys/kern/kern_proc.c Sun Oct 5 17:35:59 2014 (r272566) @@ -1208,21 +1208,25 @@ kern_proc_out(struct proc *p, struct sbu #ifdef COMPAT_FREEBSD32 if ((flags & KERN_PROC_MASK32) != 0) { freebsd32_kinfo_proc_out(&ki, &ki32); - error = sbuf_bcat(sb, &ki32, sizeof(ki32)); + if (sbuf_bcat(sb, &ki32, sizeof(ki32)) != 0) + error = ENOMEM; } else #endif - error = sbuf_bcat(sb, &ki, sizeof(ki)); + if (sbuf_bcat(sb, &ki, sizeof(ki)) != 0) + error = ENOMEM; } else { FOREACH_THREAD_IN_PROC(p, td) { fill_kinfo_thread(td, &ki, 1); #ifdef COMPAT_FREEBSD32 if ((flags & KERN_PROC_MASK32) != 0) { freebsd32_kinfo_proc_out(&ki, &ki32); - error = sbuf_bcat(sb, &ki32, sizeof(ki32)); + if (sbuf_bcat(sb, &ki32, sizeof(ki32)) != 0) + error = ENOMEM; } else #endif - error = sbuf_bcat(sb, &ki, sizeof(ki)); - if (error) + if (sbuf_bcat(sb, &ki, sizeof(ki)) != 0) + error = ENOMEM; + if (error != 0) break; } } @@ -1777,7 +1781,8 @@ proc_getauxv(struct thread *td, struct p else #endif size = vsize * sizeof(Elf_Auxinfo); - error = sbuf_bcat(sb, auxv, size); + if (sbuf_bcat(sb, auxv, size) != 0) + error = ENOMEM; free(auxv, M_TEMP); } return (error); @@ -2363,9 +2368,10 @@ kern_proc_vmmap_out(struct proc *p, stru strlen(kve->kve_path) + 1; kve->kve_structsize = roundup(kve->kve_structsize, sizeof(uint64_t)); - error = sbuf_bcat(sb, kve, kve->kve_structsize); + if (sbuf_bcat(sb, kve, kve->kve_structsize) != 0) + error = ENOMEM; vm_map_lock_read(map); - if (error) + if (error != 0) break; if (last_timestamp != map->timestamp) { vm_map_lookup_entry(map, addr - 1, &tmp_entry); From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 18:21:15 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7FDFA46D; Sun, 5 Oct 2014 18:21:15 +0000 (UTC) Received: from fep26.mx.upcmail.net (fep26.mx.upcmail.net [62.179.121.46]) by mx1.freebsd.org (Postfix) with ESMTP id F34F8909; Sun, 5 Oct 2014 18:21:13 +0000 (UTC) Received: from edge04.upcmail.net ([192.168.13.239]) by viefep20-int.chello.at (InterMail vM.8.01.05.13 201-2260-151-135-20130320) with ESMTP id <20141005181907.NMJK24820.viefep20-int.chello.at@edge04.upcmail.net>; Sun, 5 Oct 2014 20:19:07 +0200 Received: from mole.fafoe.narf.at ([80.109.238.242]) by edge04.upcmail.net with edge id zWK51o01W5EV2AQ01WK5l9; Sun, 05 Oct 2014 20:19:06 +0200 X-SourceIP: 80.109.238.242 Received: by mole.fafoe.narf.at (Postfix, from userid 1001) id E65436D47C; Sun, 5 Oct 2014 20:19:06 +0200 (CEST) Date: Sun, 5 Oct 2014 20:19:06 +0200 From: Stefan Farfeleder To: Konstantin Belousov Subject: Re: svn commit: r272505 - in head/sys: kern sys Message-ID: <20141005181906.GB1890@mole.fafoe.narf.at> References: <201410040808.s9488uAI099166@svn.freebsd.org> <42180557-0119-4597-9492-662E1671A840@FreeBSD.org> <20141005163953.GA1890@mole.fafoe.narf.at> <20141005171617.GB26076@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20141005171617.GB26076@kib.kiev.ua> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: src-committers@freebsd.org, Mateusz Guzik , svn-src-all@freebsd.org, "Bjoern A. Zeeb" , Konstantin Belousov , svn-src-head@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 18:21:15 -0000 On Sun, Oct 05, 2014 at 08:16:17PM +0300, Konstantin Belousov wrote: > On Sun, Oct 05, 2014 at 06:39:54PM +0200, Stefan Farfeleder wrote: > > On Sat, Oct 04, 2014 at 02:21:54PM +0000, Bjoern A. Zeeb wrote: > > > > > > On 04 Oct 2014, at 08:08 , Mateusz Guzik wrote: > > > > > > > Author: mjg > > > > Date: Sat Oct 4 08:08:56 2014 > > > > New Revision: 272505 > > > > URL: https://svnweb.freebsd.org/changeset/base/272505 > > > > > > > > Log: > > > > Plug capability races. > > > > > > > > fp and appropriate capability lookups were not atomic, which could result in > > > > improper capabilities being checked. > > > > > > > > This could result either in protection bypass or in a spurious ENOTCAPABLE. > > > > > > > > Make fp + capability check atomic with the help of sequence counters. > > > > > > > > Reviewed by: kib > > > > MFC after: 3 weeks > > > > > > > > Modified: > > > > head/sys/kern/kern_descrip.c > > > > head/sys/sys/filedesc.h > > > > ??? > > > > > > > > > This file is included from user space. There is no opt_capsicum.h there. > > > Including an opt_* in the header file seems wrong in a lot of ways usually. > > > > > > I tried to add a bandaid for the moment with r272523 which (to be honest) makes it worse. > > > > > > This needs a better fix. > > > > Hi, > > > > this also breaks the nvidia-driver port (also with your fix). > > Is the breakage due to missing opt_capsicum.h file ? > If yes, what I proposed, i.e. making the new member unconditional, > should fix it without changes to the module build system. Yes, it breaks due to the missing file. Stefan From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 19:40:30 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CA6F3D21; Sun, 5 Oct 2014 19:40:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B4E5FF86; Sun, 5 Oct 2014 19:40:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s95JeUmh069800; Sun, 5 Oct 2014 19:40:30 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s95JeUg7069798; Sun, 5 Oct 2014 19:40:30 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410051940.s95JeUg7069798@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 5 Oct 2014 19:40:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272567 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 19:40:31 -0000 Author: mjg Date: Sun Oct 5 19:40:29 2014 New Revision: 272567 URL: https://svnweb.freebsd.org/changeset/base/272567 Log: filedesc: fix up breakage introduced in 272505 Include sequence counter supports incoditionally [1]. This fixes reprted build problems with e.g. nvidia driver due to missing opt_capsicum.h. Replace fishy looking sizeof with offsetof. Make fde_seq the last member in order to simplify calculations. Suggested by: kib [1] X-MFC: with 272505 Modified: head/sys/kern/kern_descrip.c head/sys/sys/filedesc.h Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Sun Oct 5 17:35:59 2014 (r272566) +++ head/sys/kern/kern_descrip.c Sun Oct 5 19:40:29 2014 (r272567) @@ -295,7 +295,7 @@ _fdfree(struct filedesc *fdp, int fd, in filecaps_free(&fde->fde_caps); if (last) return; - bzero(fde_change(fde), fde_change_size); + bzero(fde, fde_change_size); fdunused(fdp, fd); #ifdef CAPABILITIES seq_write_end(&fde->fde_seq); @@ -894,7 +894,7 @@ do_dup(struct thread *td, int flags, int seq_write_begin(&newfde->fde_seq); #endif filecaps_free(&newfde->fde_caps); - memcpy(fde_change(newfde), fde_change(oldfde), fde_change_size); + memcpy(newfde, oldfde, fde_change_size); filecaps_copy(&oldfde->fde_caps, &newfde->fde_caps); if ((flags & DUP_CLOEXEC) != 0) newfde->fde_flags = oldfde->fde_flags | UF_EXCLOSE; @@ -2778,7 +2778,7 @@ dupfdopen(struct thread *td, struct file #ifdef CAPABILITIES seq_write_begin(&newfde->fde_seq); #endif - memcpy(fde_change(newfde), fde_change(oldfde), fde_change_size); + memcpy(newfde, oldfde, fde_change_size); filecaps_copy(&oldfde->fde_caps, &newfde->fde_caps); #ifdef CAPABILITIES seq_write_end(&newfde->fde_seq); @@ -2793,8 +2793,8 @@ dupfdopen(struct thread *td, struct file #ifdef CAPABILITIES seq_write_begin(&newfde->fde_seq); #endif - memcpy(fde_change(newfde), fde_change(oldfde), fde_change_size); - bzero(fde_change(oldfde), fde_change_size); + memcpy(newfde, oldfde, fde_change_size); + bzero(oldfde, fde_change_size); fdunused(fdp, dfd); #ifdef CAPABILITIES seq_write_end(&newfde->fde_seq); Modified: head/sys/sys/filedesc.h ============================================================================== --- head/sys/sys/filedesc.h Sun Oct 5 17:35:59 2014 (r272566) +++ head/sys/sys/filedesc.h Sun Oct 5 19:40:29 2014 (r272567) @@ -33,10 +33,6 @@ #ifndef _SYS_FILEDESC_H_ #define _SYS_FILEDESC_H_ -#ifdef _KERNEL -#include "opt_capsicum.h" -#endif - #include #include #include @@ -55,24 +51,16 @@ struct filecaps { }; struct filedescent { -#ifdef CAPABILITIES - seq_t fde_seq; /* if you need fde_file and fde_caps in sync */ -#endif struct file *fde_file; /* file structure for open file */ struct filecaps fde_caps; /* per-descriptor rights */ uint8_t fde_flags; /* per-process open file flags */ + seq_t fde_seq; /* if you need fde_file and fde_caps in sync */ }; #define fde_rights fde_caps.fc_rights #define fde_fcntls fde_caps.fc_fcntls #define fde_ioctls fde_caps.fc_ioctls #define fde_nioctls fde_caps.fc_nioctls -#ifdef CAPABILITIES -#define fde_change(fde) ((char *)(fde) + sizeof(seq_t)) -#define fde_change_size (sizeof(struct filedescent) - sizeof(seq_t)) -#else -#define fde_change(fde) ((fde)) -#define fde_change_size (sizeof(struct filedescent)) -#endif +#define fde_change_size (offsetof(struct filedescent, fde_seq)) /* * This structure is used for the management of descriptors. It may be @@ -97,9 +85,7 @@ struct filedesc { int fd_holdleaderscount; /* block fdfree() for shared close() */ int fd_holdleaderswakeup; /* fdfree() needs wakeup */ }; -#ifdef CAPABILITIES #define fd_seq(fdp, fd) (&(fdp)->fd_ofiles[(fd)].fde_seq) -#endif /* * Structure to keep track of (process leader, struct fildedesc) tuples. From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 19:43:38 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 04058E7D; Sun, 5 Oct 2014 19:43:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E2B7C81; Sun, 5 Oct 2014 19:43:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s95JhbQb073536; Sun, 5 Oct 2014 19:43:37 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s95JhbCp073535; Sun, 5 Oct 2014 19:43:37 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201410051943.s95JhbCp073535@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sun, 5 Oct 2014 19:43:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272568 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 19:43:38 -0000 Author: hrs Date: Sun Oct 5 19:43:37 2014 New Revision: 272568 URL: https://svnweb.freebsd.org/changeset/base/272568 Log: Virtualize if_bridge(4) cloner. Modified: head/sys/net/if_bridge.c Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Sun Oct 5 19:40:29 2014 (r272567) +++ head/sys/net/if_bridge.c Sun Oct 5 19:43:37 2014 (r272568) @@ -226,7 +226,8 @@ struct bridge_softc { u_char sc_defaddr[6]; /* Default MAC address */ }; -static struct mtx bridge_list_mtx; +static VNET_DEFINE(struct mtx, bridge_list_mtx); +#define V_bridge_list_mtx VNET(bridge_list_mtx) eventhandler_tag bridge_detach_cookie = NULL; int bridge_rtable_prune_period = BRIDGE_RTABLE_PRUNE_PERIOD; @@ -350,36 +351,64 @@ static struct bstp_cb_ops bridge_ops = { SYSCTL_DECL(_net_link); static SYSCTL_NODE(_net_link, IFT_BRIDGE, bridge, CTLFLAG_RW, 0, "Bridge"); -static int pfil_onlyip = 1; /* only pass IP[46] packets when pfil is enabled */ -static int pfil_bridge = 1; /* run pfil hooks on the bridge interface */ -static int pfil_member = 1; /* run pfil hooks on the member interface */ -static int pfil_ipfw = 0; /* layer2 filter with ipfw */ -static int pfil_ipfw_arp = 0; /* layer2 filter with ipfw */ -static int pfil_local_phys = 0; /* run pfil hooks on the physical interface for - locally destined packets */ -static int log_stp = 0; /* log STP state changes */ -static int bridge_inherit_mac = 0; /* share MAC with first bridge member */ -SYSCTL_INT(_net_link_bridge, OID_AUTO, pfil_onlyip, CTLFLAG_RWTUN, - &pfil_onlyip, 0, "Only pass IP packets when pfil is enabled"); -SYSCTL_INT(_net_link_bridge, OID_AUTO, ipfw_arp, CTLFLAG_RWTUN, - &pfil_ipfw_arp, 0, "Filter ARP packets through IPFW layer2"); -SYSCTL_INT(_net_link_bridge, OID_AUTO, pfil_bridge, CTLFLAG_RWTUN, - &pfil_bridge, 0, "Packet filter on the bridge interface"); -SYSCTL_INT(_net_link_bridge, OID_AUTO, pfil_member, CTLFLAG_RWTUN, - &pfil_member, 0, "Packet filter on the member interface"); -SYSCTL_INT(_net_link_bridge, OID_AUTO, pfil_local_phys, CTLFLAG_RWTUN, - &pfil_local_phys, 0, +/* only pass IP[46] packets when pfil is enabled */ +static VNET_DEFINE(int, pfil_onlyip) = 1; +#define V_pfil_onlyip VNET(pfil_onlyip) +SYSCTL_INT(_net_link_bridge, OID_AUTO, pfil_onlyip, + CTLFLAG_RWTUN | CTLFLAG_VNET, &VNET_NAME(pfil_onlyip), 0, + "Only pass IP packets when pfil is enabled"); + +/* run pfil hooks on the bridge interface */ +static VNET_DEFINE(int, pfil_bridge) = 1; +#define V_pfil_bridge VNET(pfil_bridge) +SYSCTL_INT(_net_link_bridge, OID_AUTO, pfil_bridge, + CTLFLAG_RWTUN | CTLFLAG_VNET, &VNET_NAME(pfil_bridge), 0, + "Packet filter on the bridge interface"); + +/* layer2 filter with ipfw */ +static VNET_DEFINE(int, pfil_ipfw); +#define V_pfil_ipfw VNET(pfil_ipfw) + +/* layer2 ARP filter with ipfw */ +static VNET_DEFINE(int, pfil_ipfw_arp); +#define V_pfil_ipfw_arp VNET(pfil_ipfw_arp) +SYSCTL_INT(_net_link_bridge, OID_AUTO, ipfw_arp, + CTLFLAG_RWTUN | CTLFLAG_VNET, &VNET_NAME(pfil_ipfw_arp), 0, + "Filter ARP packets through IPFW layer2"); + +/* run pfil hooks on the member interface */ +static VNET_DEFINE(int, pfil_member) = 1; +#define V_pfil_member VNET(pfil_member) +SYSCTL_INT(_net_link_bridge, OID_AUTO, pfil_member, + CTLFLAG_RWTUN | CTLFLAG_VNET, &VNET_NAME(pfil_member), 0, + "Packet filter on the member interface"); + +/* run pfil hooks on the physical interface for locally destined packets */ +static VNET_DEFINE(int, pfil_local_phys); +#define V_pfil_local_phys VNET(pfil_local_phys) +SYSCTL_INT(_net_link_bridge, OID_AUTO, pfil_local_phys, + CTLFLAG_RWTUN | CTLFLAG_VNET, &VNET_NAME(pfil_local_phys), 0, "Packet filter on the physical interface for locally destined packets"); -SYSCTL_INT(_net_link_bridge, OID_AUTO, log_stp, CTLFLAG_RWTUN, - &log_stp, 0, "Log STP state changes"); -SYSCTL_INT(_net_link_bridge, OID_AUTO, inherit_mac, CTLFLAG_RWTUN, - &bridge_inherit_mac, 0, + +/* log STP state changes */ +static VNET_DEFINE(int, log_stp); +#define V_log_stp VNET(log_stp) +SYSCTL_INT(_net_link_bridge, OID_AUTO, log_stp, + CTLFLAG_RWTUN | CTLFLAG_VNET, &VNET_NAME(log_stp), 0, + "Log STP state changes"); + +/* share MAC with first bridge member */ +static VNET_DEFINE(int, bridge_inherit_mac); +#define V_bridge_inherit_mac VNET(bridge_inherit_mac) +SYSCTL_INT(_net_link_bridge, OID_AUTO, inherit_mac, + CTLFLAG_RWTUN | CTLFLAG_VNET, &VNET_NAME(bridge_inherit_mac), 0, "Inherit MAC address from the first bridge member"); static VNET_DEFINE(int, allow_llz_overlap) = 0; #define V_allow_llz_overlap VNET(allow_llz_overlap) -SYSCTL_VNET_INT(_net_link_bridge, OID_AUTO, allow_llz_overlap, CTLFLAG_RW, - &VNET_NAME(allow_llz_overlap), 0, "Allow overlap of link-local scope " +SYSCTL_VNET_INT(_net_link_bridge, OID_AUTO, allow_llz_overlap, + CTLFLAG_RW | CTLFLAG_VNET, &VNET_NAME(allow_llz_overlap), 0, + "Allow overlap of link-local scope " "zones of a bridge interface and the member interfaces"); struct bridge_control { @@ -477,27 +506,52 @@ const struct bridge_control bridge_contr BC_F_COPYIN|BC_F_SUSER }, }; -const int bridge_control_table_size = - sizeof(bridge_control_table) / sizeof(bridge_control_table[0]); +const int bridge_control_table_size = nitems(bridge_control_table); + +static VNET_DEFINE(LIST_HEAD(, bridge_softc), bridge_list); +#define V_bridge_list VNET(bridge_list) +#define BRIDGE_LIST_LOCK_INIT(x) mtx_init(&V_bridge_list_mtx, \ + "if_bridge list", NULL, MTX_DEF) +#define BRIDGE_LIST_LOCK_DESTROY(x) mtx_destroy(&V_bridge_list_mtx) +#define BRIDGE_LIST_LOCK(x) mtx_lock(&V_bridge_list_mtx) +#define BRIDGE_LIST_UNLOCK(x) mtx_unlock(&V_bridge_list_mtx) -LIST_HEAD(, bridge_softc) bridge_list; +static VNET_DEFINE(struct if_clone *, bridge_cloner); +#define V_bridge_cloner VNET(bridge_cloner) -static struct if_clone *bridge_cloner; static const char bridge_name[] = "bridge"; +static void +vnet_bridge_init(const void *unused __unused) +{ + + BRIDGE_LIST_LOCK_INIT(); + LIST_INIT(&V_bridge_list); + V_bridge_cloner = if_clone_simple(bridge_name, + bridge_clone_create, bridge_clone_destroy, 0); +} +VNET_SYSINIT(vnet_bridge_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, + vnet_bridge_init, NULL); + +static void +vnet_bridge_uninit(const void *unused __unused) +{ + + if_clone_detach(V_bridge_cloner); + BRIDGE_LIST_LOCK_DESTROY(); +} +VNET_SYSUNINIT(vnet_bridge_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, + vnet_bridge_uninit, NULL); + static int bridge_modevent(module_t mod, int type, void *data) { switch (type) { case MOD_LOAD: - mtx_init(&bridge_list_mtx, "if_bridge list", NULL, MTX_DEF); - bridge_cloner = if_clone_simple(bridge_name, - bridge_clone_create, bridge_clone_destroy, 0); bridge_rtnode_zone = uma_zcreate("bridge_rtnode", sizeof(struct bridge_rtnode), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); - LIST_INIT(&bridge_list); bridge_input_p = bridge_input; bridge_output_p = bridge_output; bridge_dn_p = bridge_dummynet; @@ -509,13 +563,11 @@ bridge_modevent(module_t mod, int type, case MOD_UNLOAD: EVENTHANDLER_DEREGISTER(ifnet_departure_event, bridge_detach_cookie); - if_clone_detach(bridge_cloner); uma_zdestroy(bridge_rtnode_zone); bridge_input_p = NULL; bridge_output_p = NULL; bridge_dn_p = NULL; bridge_linkstate_p = NULL; - mtx_destroy(&bridge_list_mtx); break; default: return (EOPNOTSUPP); @@ -538,14 +590,14 @@ MODULE_DEPEND(if_bridge, bridgestp, 1, 1 static int sysctl_pfil_ipfw(SYSCTL_HANDLER_ARGS) { - int enable = pfil_ipfw; + int enable = V_pfil_ipfw; int error; error = sysctl_handle_int(oidp, &enable, 0, req); - enable = (enable) ? 1 : 0; + enable &= 1; - if (enable != pfil_ipfw) { - pfil_ipfw = enable; + if (enable != V_pfil_ipfw) { + V_pfil_ipfw = enable; /* * Disable pfil so that ipfw doesnt run twice, if the user @@ -553,17 +605,19 @@ sysctl_pfil_ipfw(SYSCTL_HANDLER_ARGS) * pfil_member. Also allow non-ip packets as ipfw can filter by * layer2 type. */ - if (pfil_ipfw) { - pfil_onlyip = 0; - pfil_bridge = 0; - pfil_member = 0; + if (V_pfil_ipfw) { + V_pfil_onlyip = 0; + V_pfil_bridge = 0; + V_pfil_member = 0; } } return (error); } -SYSCTL_PROC(_net_link_bridge, OID_AUTO, ipfw, CTLTYPE_INT|CTLFLAG_RW, - &pfil_ipfw, 0, &sysctl_pfil_ipfw, "I", "Layer2 filter with IPFW"); +SYSCTL_PROC(_net_link_bridge, OID_AUTO, ipfw, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_VNET, + &VNET_NAME(pfil_ipfw), 0, &sysctl_pfil_ipfw, "I", + "Layer2 filter with IPFW"); /* * bridge_clone_create: @@ -632,8 +686,8 @@ bridge_clone_create(struct if_clone *ifc fb = 1; retry = 0; - mtx_lock(&bridge_list_mtx); - LIST_FOREACH(sc2, &bridge_list, sc_list) { + BRIDGE_LIST_LOCK(); + LIST_FOREACH(sc2, &V_bridge_list, sc_list) { bifp = sc2->sc_ifp; if (memcmp(sc->sc_defaddr, IF_LLADDR(bifp), ETHER_ADDR_LEN) == 0) { @@ -641,7 +695,7 @@ bridge_clone_create(struct if_clone *ifc break; } } - mtx_unlock(&bridge_list_mtx); + BRIDGE_LIST_UNLOCK(); } while (retry == 1); bstp_attach(&sc->sc_stp, &bridge_ops); @@ -650,9 +704,9 @@ bridge_clone_create(struct if_clone *ifc ifp->if_baudrate = 0; ifp->if_type = IFT_BRIDGE; - mtx_lock(&bridge_list_mtx); - LIST_INSERT_HEAD(&bridge_list, sc, sc_list); - mtx_unlock(&bridge_list_mtx); + BRIDGE_LIST_LOCK(); + LIST_INSERT_HEAD(&V_bridge_list, sc, sc_list); + BRIDGE_LIST_UNLOCK(); return (0); } @@ -684,9 +738,9 @@ bridge_clone_destroy(struct ifnet *ifp) callout_drain(&sc->sc_brcallout); - mtx_lock(&bridge_list_mtx); + BRIDGE_LIST_LOCK(); LIST_REMOVE(sc, sc_list); - mtx_unlock(&bridge_list_mtx); + BRIDGE_LIST_UNLOCK(); bstp_detach(&sc->sc_stp); ether_ifdetach(ifp); @@ -952,7 +1006,7 @@ bridge_delete_member(struct bridge_softc * the mac address of the bridge to the address of the next member, or * to its default address if no members are left. */ - if (bridge_inherit_mac && sc->sc_ifaddr == ifs) { + if (V_bridge_inherit_mac && sc->sc_ifaddr == ifs) { if (LIST_EMPTY(&sc->sc_iflist)) { bcopy(sc->sc_defaddr, IF_LLADDR(sc->sc_ifp), ETHER_ADDR_LEN); @@ -1118,7 +1172,7 @@ bridge_ioctl_add(struct bridge_softc *sc * member and the MAC address of the bridge has not been changed from * the default randomly generated one. */ - if (bridge_inherit_mac && LIST_EMPTY(&sc->sc_iflist) && + if (V_bridge_inherit_mac && LIST_EMPTY(&sc->sc_iflist) && !memcmp(IF_LLADDR(sc->sc_ifp), sc->sc_defaddr, ETHER_ADDR_LEN)) { bcopy(IF_LLADDR(ifs), IF_LLADDR(sc->sc_ifp), ETHER_ADDR_LEN); sc->sc_ifaddr = ifs; @@ -1757,8 +1811,8 @@ bridge_ifdetach(void *arg __unused, stru } /* Check if the interface is a span port */ - mtx_lock(&bridge_list_mtx); - LIST_FOREACH(sc, &bridge_list, sc_list) { + BRIDGE_LIST_LOCK(); + LIST_FOREACH(sc, &V_bridge_list, sc_list) { BRIDGE_LOCK(sc); LIST_FOREACH(bif, &sc->sc_spanlist, bif_next) if (ifp == bif->bif_ifp) { @@ -1768,7 +1822,7 @@ bridge_ifdetach(void *arg __unused, stru BRIDGE_UNLOCK(sc); } - mtx_unlock(&bridge_list_mtx); + BRIDGE_LIST_UNLOCK(); } /* @@ -2350,7 +2404,7 @@ bridge_input(struct ifnet *ifp, struct m if_inc_counter(iface, IFCOUNTER_IPACKETS, 1); \ if_inc_counter(iface, IFCOUNTER_IBYTES, m->m_pkthdr.len); \ /* Filter on the physical interface. */ \ - if (pfil_local_phys && \ + if (V_pfil_local_phys && \ (PFIL_HOOKED(&V_inet_pfil_hook) \ OR_PFIL_HOOKED_INET6)) { \ if (bridge_pfil(&m, NULL, ifp, \ @@ -3004,7 +3058,7 @@ bridge_state_change(struct ifnet *ifp, i "discarding" }; - if (log_stp) + if (V_log_stp) log(LOG_NOTICE, "%s: state changed to %s on %s\n", sc->sc_ifp->if_xname, stpstates[state], ifp->if_xname); } @@ -3032,7 +3086,7 @@ bridge_pfil(struct mbuf **mp, struct ifn KASSERT(M_WRITABLE(*mp), ("%s: modifying a shared mbuf", __func__)); #endif - if (pfil_bridge == 0 && pfil_member == 0 && pfil_ipfw == 0) + if (V_pfil_bridge == 0 && V_pfil_member == 0 && V_pfil_ipfw == 0) return (0); /* filtering is disabled */ i = min((*mp)->m_pkthdr.len, max_protohdr); @@ -3074,7 +3128,7 @@ bridge_pfil(struct mbuf **mp, struct ifn switch (ether_type) { case ETHERTYPE_ARP: case ETHERTYPE_REVARP: - if (pfil_ipfw_arp == 0) + if (V_pfil_ipfw_arp == 0) return (0); /* Automatically pass */ break; @@ -3089,12 +3143,12 @@ bridge_pfil(struct mbuf **mp, struct ifn * packets, these will not be checked by pfil(9) and * passed unconditionally so the default is to drop. */ - if (pfil_onlyip) + if (V_pfil_onlyip) goto bad; } /* Run the packet through pfil before stripping link headers */ - if (PFIL_HOOKED(&V_link_pfil_hook) && pfil_ipfw != 0 && + if (PFIL_HOOKED(&V_link_pfil_hook) && V_pfil_ipfw != 0 && dir == PFIL_OUT && ifp != NULL) { error = pfil_run_hooks(&V_link_pfil_hook, mp, ifp, dir, NULL); @@ -3147,21 +3201,21 @@ bridge_pfil(struct mbuf **mp, struct ifn * Keep the order: * in_if -> bridge_if -> out_if */ - if (pfil_bridge && dir == PFIL_OUT && bifp != NULL) + if (V_pfil_bridge && dir == PFIL_OUT && bifp != NULL) error = pfil_run_hooks(&V_inet_pfil_hook, mp, bifp, dir, NULL); if (*mp == NULL || error != 0) /* filter may consume */ break; - if (pfil_member && ifp != NULL) + if (V_pfil_member && ifp != NULL) error = pfil_run_hooks(&V_inet_pfil_hook, mp, ifp, dir, NULL); if (*mp == NULL || error != 0) /* filter may consume */ break; - if (pfil_bridge && dir == PFIL_IN && bifp != NULL) + if (V_pfil_bridge && dir == PFIL_IN && bifp != NULL) error = pfil_run_hooks(&V_inet_pfil_hook, mp, bifp, dir, NULL); @@ -3169,7 +3223,7 @@ bridge_pfil(struct mbuf **mp, struct ifn break; /* check if we need to fragment the packet */ - if (pfil_member && ifp != NULL && dir == PFIL_OUT) { + if (V_pfil_member && ifp != NULL && dir == PFIL_OUT) { i = (*mp)->m_pkthdr.len; if (i > ifp->if_mtu) { error = bridge_fragment(ifp, *mp, &eh2, snap, @@ -3199,21 +3253,21 @@ bridge_pfil(struct mbuf **mp, struct ifn break; #ifdef INET6 case ETHERTYPE_IPV6: - if (pfil_bridge && dir == PFIL_OUT && bifp != NULL) + if (V_pfil_bridge && dir == PFIL_OUT && bifp != NULL) error = pfil_run_hooks(&V_inet6_pfil_hook, mp, bifp, dir, NULL); if (*mp == NULL || error != 0) /* filter may consume */ break; - if (pfil_member && ifp != NULL) + if (V_pfil_member && ifp != NULL) error = pfil_run_hooks(&V_inet6_pfil_hook, mp, ifp, dir, NULL); if (*mp == NULL || error != 0) /* filter may consume */ break; - if (pfil_bridge && dir == PFIL_IN && bifp != NULL) + if (V_pfil_bridge && dir == PFIL_IN && bifp != NULL) error = pfil_run_hooks(&V_inet6_pfil_hook, mp, bifp, dir, NULL); break; From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 19:44:41 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AD88DFC1; Sun, 5 Oct 2014 19:44:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9866A95; Sun, 5 Oct 2014 19:44:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s95JifoI073736; Sun, 5 Oct 2014 19:44:41 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s95JifGD073735; Sun, 5 Oct 2014 19:44:41 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410051944.s95JifGD073735@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 5 Oct 2014 19:44:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272569 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 19:44:41 -0000 Author: mjg Date: Sun Oct 5 19:44:40 2014 New Revision: 272569 URL: https://svnweb.freebsd.org/changeset/base/272569 Log: Keep struct filedescent comments within 80-char limit. Modified: head/sys/sys/filedesc.h Modified: head/sys/sys/filedesc.h ============================================================================== --- head/sys/sys/filedesc.h Sun Oct 5 19:43:37 2014 (r272568) +++ head/sys/sys/filedesc.h Sun Oct 5 19:44:40 2014 (r272569) @@ -51,10 +51,10 @@ struct filecaps { }; struct filedescent { - struct file *fde_file; /* file structure for open file */ - struct filecaps fde_caps; /* per-descriptor rights */ - uint8_t fde_flags; /* per-process open file flags */ - seq_t fde_seq; /* if you need fde_file and fde_caps in sync */ + struct file *fde_file; /* file structure for open file */ + struct filecaps fde_caps; /* per-descriptor rights */ + uint8_t fde_flags; /* per-process open file flags */ + seq_t fde_seq; /* keep file and caps in sync */ }; #define fde_rights fde_caps.fc_rights #define fde_fcntls fde_caps.fc_fcntls From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 19:45:39 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B4B0419A; Sun, 5 Oct 2014 19:45:39 +0000 (UTC) Received: from mail-wi0-x236.google.com (mail-wi0-x236.google.com [IPv6:2a00:1450:400c:c05::236]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5D769BA; Sun, 5 Oct 2014 19:45:38 +0000 (UTC) Received: by mail-wi0-f182.google.com with SMTP id n3so2803163wiv.15 for ; Sun, 05 Oct 2014 12:45:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=CF31lD6XwTglbgyVbm2sAEgeI3fZB31r0F5dpWB6fL0=; b=HOOFdWUIy16vxYYcvcf8IkLpCIhHyBhZScRicsAeHAPEw165Vr7133CDntBreUk7sr kcDlfubbg8P8LfBXq3EHXF+RrBAUBYi61/BGtEYSByLD9IMYDH3vP5HJZeF/RkTdViCa W7pjCgHG9oEXTMfSQzeDb365wLG3jhWk7KsLI4sLgCKaF2JZYyefCDDPxsqrNEE18uz6 06cAq7Igcc2Ex7DlK+KhGTQEkicGbuGKv2xUnKXRQgwdME95p2WErhUu9NhaPPwjxzb3 fYl293A808QVbMfWYbZovyQqpkmhLNMYh5XxkSl4CuRZe+TvYJW8UQc1hiz5KK8p/jIF lULA== X-Received: by 10.180.184.225 with SMTP id ex1mr3464776wic.22.1412538336583; Sun, 05 Oct 2014 12:45:36 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id ce1sm14919614wjc.2.2014.10.05.12.45.35 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 05 Oct 2014 12:45:35 -0700 (PDT) Date: Sun, 5 Oct 2014 21:45:33 +0200 From: Mateusz Guzik To: Stefan Farfeleder Subject: Re: svn commit: r272505 - in head/sys: kern sys Message-ID: <20141005194533.GD9262@dft-labs.eu> References: <201410040808.s9488uAI099166@svn.freebsd.org> <42180557-0119-4597-9492-662E1671A840@FreeBSD.org> <20141005163953.GA1890@mole.fafoe.narf.at> <20141005171617.GB26076@kib.kiev.ua> <20141005181906.GB1890@mole.fafoe.narf.at> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20141005181906.GB1890@mole.fafoe.narf.at> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: src-committers@freebsd.org, Mateusz Guzik , svn-src-all@freebsd.org, svn-src-head@freebsd.org, "Bjoern A. Zeeb" , Konstantin Belousov , Konstantin Belousov X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 19:45:39 -0000 On Sun, Oct 05, 2014 at 08:19:06PM +0200, Stefan Farfeleder wrote: > On Sun, Oct 05, 2014 at 08:16:17PM +0300, Konstantin Belousov wrote: > > On Sun, Oct 05, 2014 at 06:39:54PM +0200, Stefan Farfeleder wrote: > > > On Sat, Oct 04, 2014 at 02:21:54PM +0000, Bjoern A. Zeeb wrote: > > > > > > > > On 04 Oct 2014, at 08:08 , Mateusz Guzik wrote: > > > > > > > > > Author: mjg > > > > > Date: Sat Oct 4 08:08:56 2014 > > > > > New Revision: 272505 > > > > > URL: https://svnweb.freebsd.org/changeset/base/272505 > > > > > > > > > > Log: > > > > > Plug capability races. > > > > > > > > > > fp and appropriate capability lookups were not atomic, which could result in > > > > > improper capabilities being checked. > > > > > > > > > > This could result either in protection bypass or in a spurious ENOTCAPABLE. > > > > > > > > > > Make fp + capability check atomic with the help of sequence counters. > > > > > > > > > > Reviewed by: kib > > > > > MFC after: 3 weeks > > > > > > > > > > Modified: > > > > > head/sys/kern/kern_descrip.c > > > > > head/sys/sys/filedesc.h > > > > > ??? > > > > > > > > > > > > This file is included from user space. There is no opt_capsicum.h there. > > > > Including an opt_* in the header file seems wrong in a lot of ways usually. > > > > > > > > I tried to add a bandaid for the moment with r272523 which (to be honest) makes it worse. > > > > > > > > This needs a better fix. > > > > > > Hi, > > > > > > this also breaks the nvidia-driver port (also with your fix). > > > > Is the breakage due to missing opt_capsicum.h file ? > > If yes, what I proposed, i.e. making the new member unconditional, > > should fix it without changes to the module build system. > > Yes, it breaks due to the missing file. > Can you update the kernel to at least r272569 and test again? Make sure you are running the new kernel before testing the driver. -- Mateusz Guzik From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 19:46:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 85CEC2ED; Sun, 5 Oct 2014 19:46:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 57A3BCB; Sun, 5 Oct 2014 19:46:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s95Jkr4n074098; Sun, 5 Oct 2014 19:46:53 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s95JkrUh074097; Sun, 5 Oct 2014 19:46:53 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201410051946.s95JkrUh074097@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sun, 5 Oct 2014 19:46:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272570 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 19:46:53 -0000 Author: hrs Date: Sun Oct 5 19:46:52 2014 New Revision: 272570 URL: https://svnweb.freebsd.org/changeset/base/272570 Log: Virtualize if_disc(4) cloner. Modified: head/sys/net/if_disc.c Modified: head/sys/net/if_disc.c ============================================================================== --- head/sys/net/if_disc.c Sun Oct 5 19:44:40 2014 (r272569) +++ head/sys/net/if_disc.c Sun Oct 5 19:46:52 2014 (r272570) @@ -50,6 +50,7 @@ #include #include #include +#include #include "opt_inet.h" #include "opt_inet6.h" @@ -74,7 +75,8 @@ static void disc_clone_destroy(struct if static const char discname[] = "disc"; static MALLOC_DEFINE(M_DISC, discname, "Discard interface"); -static struct if_clone *disc_cloner; +static VNET_DEFINE(struct if_clone *, disc_cloner); +#define V_disc_cloner VNET(disc_cloner) static int disc_clone_create(struct if_clone *ifc, int unit, caddr_t params) @@ -129,17 +131,32 @@ disc_clone_destroy(struct ifnet *ifp) free(sc, M_DISC); } +static void +vnet_disc_init(const void *unused __unused) +{ + + V_disc_cloner = if_clone_simple(discname, disc_clone_create, + disc_clone_destroy, 0); +} +VNET_SYSINIT(vnet_disc_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, + vnet_disc_init, NULL); + +static void +vnet_disc_uninit(const void *unused __unused) +{ + + if_clone_detach(V_disc_cloner); +} +VNET_SYSUNINIT(vnet_disc_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, + vnet_disc_uninit, NULL); + static int disc_modevent(module_t mod, int type, void *data) { switch (type) { case MOD_LOAD: - disc_cloner = if_clone_simple(discname, disc_clone_create, - disc_clone_destroy, 0); - break; case MOD_UNLOAD: - if_clone_detach(disc_cloner); break; default: return (EOPNOTSUPP); @@ -185,6 +202,7 @@ discoutput(struct ifnet *ifp, struct mbu static void discrtrequest(int cmd, struct rtentry *rt, struct rt_addrinfo *info) { + RT_LOCK_ASSERT(rt); rt->rt_mtu = DSMTU; } @@ -200,7 +218,6 @@ discioctl(struct ifnet *ifp, u_long cmd, int error = 0; switch (cmd) { - case SIOCSIFADDR: ifp->if_flags |= IFF_UP; ifa = (struct ifaddr *)data; @@ -210,7 +227,6 @@ discioctl(struct ifnet *ifp, u_long cmd, * Everything else is done at a higher level. */ break; - case SIOCADDMULTI: case SIOCDELMULTI: if (ifr == 0) { @@ -218,7 +234,6 @@ discioctl(struct ifnet *ifp, u_long cmd, break; } switch (ifr->ifr_addr.sa_family) { - #ifdef INET case AF_INET: break; @@ -227,17 +242,14 @@ discioctl(struct ifnet *ifp, u_long cmd, case AF_INET6: break; #endif - default: error = EAFNOSUPPORT; break; } break; - case SIOCSIFMTU: ifp->if_mtu = ifr->ifr_mtu; break; - default: error = EINVAL; } From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 20:27:32 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F2D5DE58; Sun, 5 Oct 2014 20:27:31 +0000 (UTC) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 7E4E96A4; Sun, 5 Oct 2014 20:27:31 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 7C88425D3AA4; Sun, 5 Oct 2014 20:27:28 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 97BFDC76FDB; Sun, 5 Oct 2014 20:27:27 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id jQekbnfYpB9h; Sun, 5 Oct 2014 20:27:25 +0000 (UTC) Received: from [IPv6:fde9:577b:c1a9:4410:90f6:2af7:ba50:d9b9] (unknown [IPv6:fde9:577b:c1a9:4410:90f6:2af7:ba50:d9b9]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 8AB89C76FD7; Sun, 5 Oct 2014 20:27:23 +0000 (UTC) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r272567 - in head/sys: kern sys From: "Bjoern A. Zeeb" In-Reply-To: <201410051940.s95JeUg7069798@svn.freebsd.org> Date: Sun, 5 Oct 2014 20:26:59 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <2438AED3-AC72-4099-ACD6-E2642B4A866D@FreeBSD.org> References: <201410051940.s95JeUg7069798@svn.freebsd.org> To: Mateusz Guzik , Konstantin Belousov X-Mailer: Apple Mail (2.1878.6) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 20:27:32 -0000 On 05 Oct 2014, at 19:40 , Mateusz Guzik wrote: > Author: mjg > Date: Sun Oct 5 19:40:29 2014 > New Revision: 272567 > URL: https://svnweb.freebsd.org/changeset/base/272567 >=20 > Log: > filedesc: fix up breakage introduced in 272505 >=20 > Include sequence counter supports incoditionally [1]. This fixes = reprted build > problems with e.g. nvidia driver due to missing opt_capsicum.h. >=20 > Replace fishy looking sizeof with offsetof. Make fde_seq the last = member in > order to simplify calculations. Seing this on an incremental build now for bmake: stopped in /scratch/tmp/bz/head.svn/lib/libkvm = /storage/head/obj//mips.mipsel/scratch/tmp/bz/head.svn/tmp/usr/include/sys= /filedesc.h:57: error: expected specifier-qualifier-list before 'seq_t' I=92ll see if this persists with a full build but I assume it will. >=20 > Suggested by: kib [1] > X-MFC: with 272505 >=20 > Modified: > head/sys/kern/kern_descrip.c > head/sys/sys/filedesc.h >=20 > Modified: head/sys/kern/kern_descrip.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/kern/kern_descrip.c Sun Oct 5 17:35:59 2014 = (r272566) > +++ head/sys/kern/kern_descrip.c Sun Oct 5 19:40:29 2014 = (r272567) > @@ -295,7 +295,7 @@ _fdfree(struct filedesc *fdp, int fd, in > filecaps_free(&fde->fde_caps); > if (last) > return; > - bzero(fde_change(fde), fde_change_size); > + bzero(fde, fde_change_size); > fdunused(fdp, fd); > #ifdef CAPABILITIES > seq_write_end(&fde->fde_seq); > @@ -894,7 +894,7 @@ do_dup(struct thread *td, int flags, int > seq_write_begin(&newfde->fde_seq); > #endif > filecaps_free(&newfde->fde_caps); > - memcpy(fde_change(newfde), fde_change(oldfde), fde_change_size); > + memcpy(newfde, oldfde, fde_change_size); > filecaps_copy(&oldfde->fde_caps, &newfde->fde_caps); > if ((flags & DUP_CLOEXEC) !=3D 0) > newfde->fde_flags =3D oldfde->fde_flags | UF_EXCLOSE; > @@ -2778,7 +2778,7 @@ dupfdopen(struct thread *td, struct file > #ifdef CAPABILITIES > seq_write_begin(&newfde->fde_seq); > #endif > - memcpy(fde_change(newfde), fde_change(oldfde), = fde_change_size); > + memcpy(newfde, oldfde, fde_change_size); > filecaps_copy(&oldfde->fde_caps, &newfde->fde_caps); > #ifdef CAPABILITIES > seq_write_end(&newfde->fde_seq); > @@ -2793,8 +2793,8 @@ dupfdopen(struct thread *td, struct file > #ifdef CAPABILITIES > seq_write_begin(&newfde->fde_seq); > #endif > - memcpy(fde_change(newfde), fde_change(oldfde), = fde_change_size); > - bzero(fde_change(oldfde), fde_change_size); > + memcpy(newfde, oldfde, fde_change_size); > + bzero(oldfde, fde_change_size); > fdunused(fdp, dfd); > #ifdef CAPABILITIES > seq_write_end(&newfde->fde_seq); >=20 > Modified: head/sys/sys/filedesc.h > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/sys/filedesc.h Sun Oct 5 17:35:59 2014 = (r272566) > +++ head/sys/sys/filedesc.h Sun Oct 5 19:40:29 2014 = (r272567) > @@ -33,10 +33,6 @@ > #ifndef _SYS_FILEDESC_H_ > #define _SYS_FILEDESC_H_ >=20 > -#ifdef _KERNEL > -#include "opt_capsicum.h" > -#endif > - > #include > #include > #include > @@ -55,24 +51,16 @@ struct filecaps { > }; >=20 > struct filedescent { > -#ifdef CAPABILITIES > - seq_t fde_seq; /* if you need fde_file = and fde_caps in sync */ > -#endif > struct file *fde_file; /* file structure for = open file */ > struct filecaps fde_caps; /* per-descriptor rights = */ > uint8_t fde_flags; /* per-process open file = flags */ > + seq_t fde_seq; /* if you need fde_file = and fde_caps in sync */ > }; > #define fde_rights fde_caps.fc_rights > #define fde_fcntls fde_caps.fc_fcntls > #define fde_ioctls fde_caps.fc_ioctls > #define fde_nioctls fde_caps.fc_nioctls > -#ifdef CAPABILITIES > -#define fde_change(fde) ((char *)(fde) + sizeof(seq_t)) > -#define fde_change_size (sizeof(struct filedescent) - = sizeof(seq_t)) > -#else > -#define fde_change(fde) ((fde)) > -#define fde_change_size (sizeof(struct filedescent)) > -#endif > +#define fde_change_size (offsetof(struct filedescent, fde_seq)) >=20 > /* > * This structure is used for the management of descriptors. It may = be > @@ -97,9 +85,7 @@ struct filedesc { > int fd_holdleaderscount; /* block fdfree() for shared = close() */ > int fd_holdleaderswakeup; /* fdfree() needs wakeup */ > }; > -#ifdef CAPABILITIES > #define fd_seq(fdp, fd) (&(fdp)->fd_ofiles[(fd)].fde_seq) > -#endif >=20 > /* > * Structure to keep track of (process leader, struct fildedesc) = tuples. >=20 =97=20 Bjoern A. Zeeb "Come on. Learn, goddamn it.", WarGames, 1983 From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 20:30:50 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CF64F19C; Sun, 5 Oct 2014 20:30:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BAE4B6C6; Sun, 5 Oct 2014 20:30:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s95KUokl094368; Sun, 5 Oct 2014 20:30:50 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s95KUowt094367; Sun, 5 Oct 2014 20:30:50 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201410052030.s95KUowt094367@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 5 Oct 2014 20:30:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272571 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 20:30:50 -0000 Author: tuexen Date: Sun Oct 5 20:30:49 2014 New Revision: 272571 URL: https://svnweb.freebsd.org/changeset/base/272571 Log: Remove unused MC_ALIGN macro as suggested by Robert. MFC after: 1 week Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sun Oct 5 19:46:52 2014 (r272570) +++ head/sys/netinet/sctp_output.c Sun Oct 5 20:30:49 2014 (r272571) @@ -6784,13 +6784,6 @@ sctp_sendall_completes(void *ptr, uint32 SCTP_FREE(ca, SCTP_M_COPYAL); } - -#define MC_ALIGN(m, len) do { \ - SCTP_BUF_RESV_UF(m, ((MCLBYTES - (len)) & ~(sizeof(long) - 1)); \ -} while (0) - - - static struct mbuf * sctp_copy_out_all(struct uio *uio, int len) { From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 20:47:24 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1955D77D; Sun, 5 Oct 2014 20:47:24 +0000 (UTC) Received: from mail-wg0-x229.google.com (mail-wg0-x229.google.com [IPv6:2a00:1450:400c:c00::229]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E2122905; Sun, 5 Oct 2014 20:47:22 +0000 (UTC) Received: by mail-wg0-f41.google.com with SMTP id b13so5092407wgh.12 for ; Sun, 05 Oct 2014 13:47:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=k/4iCVu3UQPEoe3axZZqv4ioBm4JVJjbMjWMoIqwdaE=; b=MGaApKGrqqYnapMYTxlcKkvSh6tg7b6ZWz7GgLHMkQ0cgTrKipqOekcopD/L5zq0Lh 2af6Q6YPa76oy8TLxcLHg0puEUE7tv29OMiAe2WXtGCqpN/WWH7dVjZctH7CKfmkfrQC VYZTqM2blbh90UoxqMovAazKHtt0SPPlWFURrGj86ENNfM1pmInfBWzSf6G1b4HFlGXv +E37lojEPJdDZW0cNnN3x132DESMvUWc5uCcQPiw7XLFLbSM+IDix9uERQ9o6m57VKqn tkdgHyzrm3w8r3TUR5VAHjVem6RPzYvmkVU2wcK6PPO+KKOSO6SNRthlMkqh2Z+mDrNI 5ifQ== X-Received: by 10.194.184.166 with SMTP id ev6mr23947709wjc.61.1412542040646; Sun, 05 Oct 2014 13:47:20 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id mb20sm9092887wic.9.2014.10.05.13.47.18 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 05 Oct 2014 13:47:19 -0700 (PDT) Date: Sun, 5 Oct 2014 22:47:16 +0200 From: Mateusz Guzik To: "Bjoern A. Zeeb" Subject: Re: svn commit: r272567 - in head/sys: kern sys Message-ID: <20141005204716.GE9262@dft-labs.eu> References: <201410051940.s95JeUg7069798@svn.freebsd.org> <2438AED3-AC72-4099-ACD6-E2642B4A866D@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2438AED3-AC72-4099-ACD6-E2642B4A866D@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Konstantin Belousov , Mateusz Guzik X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 20:47:24 -0000 On Sun, Oct 05, 2014 at 08:26:59PM +0000, Bjoern A. Zeeb wrote: > > On 05 Oct 2014, at 19:40 , Mateusz Guzik wrote: > > > Author: mjg > > Date: Sun Oct 5 19:40:29 2014 > > New Revision: 272567 > > URL: https://svnweb.freebsd.org/changeset/base/272567 > > > > Log: > > filedesc: fix up breakage introduced in 272505 > > > > Include sequence counter supports incoditionally [1]. This fixes reprted build > > problems with e.g. nvidia driver due to missing opt_capsicum.h. > > > > Replace fishy looking sizeof with offsetof. Make fde_seq the last member in > > order to simplify calculations. > > Seing this on an incremental build now for > > bmake: stopped in /scratch/tmp/bz/head.svn/lib/libkvm > > /storage/head/obj//mips.mipsel/scratch/tmp/bz/head.svn/tmp/usr/include/sys/filedesc.h:57: error: expected specifier-qualifier-list before 'seq_t' > > I’ll see if this persists with a full build but I assume it will. > I cannot reproduce it, tried with mips + QEMU config. One crap thing is that typedef uint32_t seq_t is placed before includes. Does it help if you move it after systm.h? Was the failure present prior to this patch? -- Mateusz Guzik From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 21:27:27 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3BB1ED0F; Sun, 5 Oct 2014 21:27:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0DF34D52; Sun, 5 Oct 2014 21:27:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s95LRQb5024236; Sun, 5 Oct 2014 21:27:26 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s95LRQlY024235; Sun, 5 Oct 2014 21:27:26 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201410052127.s95LRQlY024235@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sun, 5 Oct 2014 21:27:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272572 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 21:27:27 -0000 Author: hrs Date: Sun Oct 5 21:27:26 2014 New Revision: 272572 URL: https://svnweb.freebsd.org/changeset/base/272572 Log: Virtualize if_edsc(4). Modified: head/sys/net/if_edsc.c Modified: head/sys/net/if_edsc.c ============================================================================== --- head/sys/net/if_edsc.c Sun Oct 5 20:30:49 2014 (r272571) +++ head/sys/net/if_edsc.c Sun Oct 5 21:27:26 2014 (r272572) @@ -51,6 +51,7 @@ #include /* network interface cloning */ #include /* IFT_ETHER and friends */ #include /* kernel-only part of ifnet(9) */ +#include static const char edscname[] = "edsc"; @@ -69,7 +70,8 @@ struct edsc_softc { /* * Attach to the interface cloning framework. */ -static struct if_clone *edsc_cloner; +static VNET_DEFINE(struct if_clone *, edsc_cloner); +#define V_edsc_cloner VNET(edsc_cloner) static int edsc_clone_create(struct if_clone *, int, caddr_t); static void edsc_clone_destroy(struct ifnet *); @@ -307,6 +309,36 @@ edsc_start(struct ifnet *ifp) */ } +static void +vnet_edsc_init(const void *unused __unused) +{ + + /* + * Connect to the network interface cloning framework. + * The last argument is the number of units to be created + * from the outset. It's also the minimum number of units + * allowed. We don't want any units created as soon as the + * driver is loaded. + */ + V_edsc_cloner = if_clone_simple(edscname, edsc_clone_create, + edsc_clone_destroy, 0); +} +VNET_SYSINIT(vnet_edsc_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, + vnet_edsc_init, NULL); + +static void +vnet_edsc_uninit(const void *unused __unused) +{ + + /* + * Disconnect from the cloning framework. + * Existing interfaces will be disposed of properly. + */ + if_clone_detach(V_edsc_cloner); +} +VNET_SYSUNINIT(vnet_edsc_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, + vnet_edsc_uninit, NULL); + /* * This function provides handlers for module events, namely load and unload. */ @@ -316,25 +348,8 @@ edsc_modevent(module_t mod, int type, vo switch (type) { case MOD_LOAD: - /* - * Connect to the network interface cloning framework. - * The last argument is the number of units to be created - * from the outset. It's also the minimum number of units - * allowed. We don't want any units created as soon as the - * driver is loaded. - */ - edsc_cloner = if_clone_simple(edscname, edsc_clone_create, - edsc_clone_destroy, 0); - break; - case MOD_UNLOAD: - /* - * Disconnect from the cloning framework. - * Existing interfaces will be disposed of properly. - */ - if_clone_detach(edsc_cloner); break; - default: /* * There are other event types, but we don't handle them. From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 21:34:56 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CDA3BFAC; Sun, 5 Oct 2014 21:34:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE75EE14; Sun, 5 Oct 2014 21:34:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s95LYunF029023; Sun, 5 Oct 2014 21:34:56 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s95LYu0d029022; Sun, 5 Oct 2014 21:34:56 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201410052134.s95LYu0d029022@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Sun, 5 Oct 2014 21:34:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272573 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 21:34:56 -0000 Author: bryanv Date: Sun Oct 5 21:34:56 2014 New Revision: 272573 URL: https://svnweb.freebsd.org/changeset/base/272573 Log: Change the UMA mutex into a rwlock Acquire the lock in read mode when just needed to ensure the stability of the keg list. The UMA lock may be held for a long time (relatively speaking) in uma_reclaim() on machines with lots of zones/kegs. If the uma_timeout() would fire during that period, subsequent callouts on that CPU may be significantly delayed. Reviewed by: jhb Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Sun Oct 5 21:27:26 2014 (r272572) +++ head/sys/vm/uma_core.c Sun Oct 5 21:34:56 2014 (r272573) @@ -135,8 +135,8 @@ static LIST_HEAD(,uma_keg) uma_kegs = LI static LIST_HEAD(,uma_zone) uma_cachezones = LIST_HEAD_INITIALIZER(uma_cachezones); -/* This mutex protects the keg list */ -static struct mtx_padalign uma_mtx; +/* This RW lock protects the keg list */ +static struct rwlock_padalign uma_rwlock; /* Linked list of boot time pages */ static LIST_HEAD(,uma_slab) uma_boot_pages = @@ -904,7 +904,7 @@ zone_drain_wait(uma_zone_t zone, int wai ZONE_UNLOCK(zone); /* * The DRAINING flag protects us from being freed while - * we're running. Normally the uma_mtx would protect us but we + * we're running. Normally the uma_rwlock would protect us but we * must be able to release and acquire the right lock for each keg. */ zone_foreach_keg(zone, &keg_drain); @@ -1540,9 +1540,9 @@ keg_ctor(void *mem, int size, void *udat LIST_INSERT_HEAD(&keg->uk_zones, zone, uz_link); - mtx_lock(&uma_mtx); + rw_wlock(&uma_rwlock); LIST_INSERT_HEAD(&uma_kegs, keg, uk_link); - mtx_unlock(&uma_mtx); + rw_wunlock(&uma_rwlock); return (0); } @@ -1592,9 +1592,9 @@ zone_ctor(void *mem, int size, void *uda zone->uz_release = arg->release; zone->uz_arg = arg->arg; zone->uz_lockptr = &zone->uz_lock; - mtx_lock(&uma_mtx); + rw_wlock(&uma_rwlock); LIST_INSERT_HEAD(&uma_cachezones, zone, uz_link); - mtx_unlock(&uma_mtx); + rw_wunlock(&uma_rwlock); goto out; } @@ -1611,7 +1611,7 @@ zone_ctor(void *mem, int size, void *uda zone->uz_fini = arg->fini; zone->uz_lockptr = &keg->uk_lock; zone->uz_flags |= UMA_ZONE_SECONDARY; - mtx_lock(&uma_mtx); + rw_wlock(&uma_rwlock); ZONE_LOCK(zone); LIST_FOREACH(z, &keg->uk_zones, uz_link) { if (LIST_NEXT(z, uz_link) == NULL) { @@ -1620,7 +1620,7 @@ zone_ctor(void *mem, int size, void *uda } } ZONE_UNLOCK(zone); - mtx_unlock(&uma_mtx); + rw_wunlock(&uma_rwlock); } else if (keg == NULL) { if ((keg = uma_kcreate(zone, arg->size, arg->uminit, arg->fini, arg->align, arg->flags)) == NULL) @@ -1718,9 +1718,9 @@ zone_dtor(void *arg, int size, void *uda if (!(zone->uz_flags & UMA_ZFLAG_INTERNAL)) cache_drain(zone); - mtx_lock(&uma_mtx); + rw_wlock(&uma_rwlock); LIST_REMOVE(zone, uz_link); - mtx_unlock(&uma_mtx); + rw_wunlock(&uma_rwlock); /* * XXX there are some races here where * the zone can be drained but zone lock @@ -1742,9 +1742,9 @@ zone_dtor(void *arg, int size, void *uda * We only destroy kegs from non secondary zones. */ if (keg != NULL && (zone->uz_flags & UMA_ZONE_SECONDARY) == 0) { - mtx_lock(&uma_mtx); + rw_wlock(&uma_rwlock); LIST_REMOVE(keg, uk_link); - mtx_unlock(&uma_mtx); + rw_wunlock(&uma_rwlock); zone_free_item(kegs, keg, NULL, SKIP_NONE); } ZONE_LOCK_FINI(zone); @@ -1766,12 +1766,12 @@ zone_foreach(void (*zfunc)(uma_zone_t)) uma_keg_t keg; uma_zone_t zone; - mtx_lock(&uma_mtx); + rw_rlock(&uma_rwlock); LIST_FOREACH(keg, &uma_kegs, uk_link) { LIST_FOREACH(zone, &keg->uk_zones, uz_link) zfunc(zone); } - mtx_unlock(&uma_mtx); + rw_runlock(&uma_rwlock); } /* Public functions */ @@ -1787,7 +1787,7 @@ uma_startup(void *bootmem, int boot_page #ifdef UMA_DEBUG printf("Creating uma keg headers zone and keg.\n"); #endif - mtx_init(&uma_mtx, "UMA lock", NULL, MTX_DEF); + rw_init(&uma_rwlock, "UMA lock"); /* "manually" create the initial zone */ memset(&args, 0, sizeof(args)); @@ -3362,12 +3362,12 @@ sysctl_vm_zone_count(SYSCTL_HANDLER_ARGS int count; count = 0; - mtx_lock(&uma_mtx); + rw_rlock(&uma_rwlock); LIST_FOREACH(kz, &uma_kegs, uk_link) { LIST_FOREACH(z, &kz->uk_zones, uz_link) count++; } - mtx_unlock(&uma_mtx); + rw_runlock(&uma_rwlock); return (sysctl_handle_int(oidp, &count, 0, req)); } @@ -3392,7 +3392,7 @@ sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS sbuf_new_for_sysctl(&sbuf, NULL, 128, req); count = 0; - mtx_lock(&uma_mtx); + rw_rlock(&uma_rwlock); LIST_FOREACH(kz, &uma_kegs, uk_link) { LIST_FOREACH(z, &kz->uk_zones, uz_link) count++; @@ -3468,7 +3468,7 @@ skip: ZONE_UNLOCK(z); } } - mtx_unlock(&uma_mtx); + rw_runlock(&uma_rwlock); error = sbuf_finish(&sbuf); sbuf_delete(&sbuf); return (error); From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 21:39:51 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 04F2B308; Sun, 5 Oct 2014 21:39:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E6267E56; Sun, 5 Oct 2014 21:39:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s95LdotJ029808; Sun, 5 Oct 2014 21:39:50 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s95LdoJw029807; Sun, 5 Oct 2014 21:39:50 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410052139.s95LdoJw029807@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 5 Oct 2014 21:39:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272574 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 21:39:51 -0000 Author: mjg Date: Sun Oct 5 21:39:50 2014 New Revision: 272574 URL: https://svnweb.freebsd.org/changeset/base/272574 Log: seq_t needs to be visible to userspace Pointy hat to: mjg Reported by: bz X-MFC: with r272567 Modified: head/sys/sys/seq.h Modified: head/sys/sys/seq.h ============================================================================== --- head/sys/sys/seq.h Sun Oct 5 21:34:56 2014 (r272573) +++ head/sys/sys/seq.h Sun Oct 5 21:39:50 2014 (r272574) @@ -29,6 +29,16 @@ #define _SYS_SEQ_H_ #ifdef _KERNEL +#include +#endif +#include + +/* + * seq_t may be included in structs visible to userspace + */ +typedef uint32_t seq_t; + +#ifdef _KERNEL /* * Typical usage: @@ -54,10 +64,7 @@ * foo(lobj); */ -typedef uint32_t seq_t; - /* A hack to get MPASS macro */ -#include #include #include From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 21:40:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C5D574E2; Sun, 5 Oct 2014 21:40:13 +0000 (UTC) Received: from mail-wi0-x229.google.com (mail-wi0-x229.google.com [IPv6:2a00:1450:400c:c05::229]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 91DE2E63; Sun, 5 Oct 2014 21:40:12 +0000 (UTC) Received: by mail-wi0-f169.google.com with SMTP id cc10so5269501wib.0 for ; Sun, 05 Oct 2014 14:40:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=rYPbgL9D4gKtSEDcWyRRHnlpanHW+LfVwNqYqBcS2k4=; b=Hvi2oDXxyKQZG7+a0J8lPXnbvErCdqIKnREuR52dqXjhjymA17qeNxV3r/g/SSnPo3 aKgjqd6bKX0fYTBpOYckz40SANgNriVGPWpFmcS3oC12WK36ovJTNguTB3zZTslxmpbo 93IJvWTbYMLdnygKgMcTFL08t4BtEcOIp5cITN2Pi9rxm4h/9R8+pYMz876mk9TkQDHB ghH8GvW7UWMwxmKny2ECc3OfPQYmKgYpPoHzERU596Nqa9AwkQ4+beWv/QxyFrdsKc4G oMlMp3kS22axfDKKIeEiA8B7yN/qyaxEYY0eP7apVH73J5gY+CWmL3SlIARgJUQGXh/l gRFA== X-Received: by 10.195.12.46 with SMTP id en14mr18810576wjd.95.1412545210921; Sun, 05 Oct 2014 14:40:10 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id ma8sm15145855wjb.46.2014.10.05.14.40.09 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 05 Oct 2014 14:40:10 -0700 (PDT) Date: Sun, 5 Oct 2014 23:40:07 +0200 From: Mateusz Guzik To: "Bjoern A. Zeeb" Subject: Re: svn commit: r272567 - in head/sys: kern sys Message-ID: <20141005214006.GF9262@dft-labs.eu> References: <201410051940.s95JeUg7069798@svn.freebsd.org> <2438AED3-AC72-4099-ACD6-E2642B4A866D@FreeBSD.org> <20141005204716.GE9262@dft-labs.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20141005204716.GE9262@dft-labs.eu> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Konstantin Belousov , Mateusz Guzik X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 21:40:13 -0000 On Sun, Oct 05, 2014 at 10:47:16PM +0200, Mateusz Guzik wrote: > On Sun, Oct 05, 2014 at 08:26:59PM +0000, Bjoern A. Zeeb wrote: > > > > On 05 Oct 2014, at 19:40 , Mateusz Guzik wrote: > > > > > Author: mjg > > > Date: Sun Oct 5 19:40:29 2014 > > > New Revision: 272567 > > > URL: https://svnweb.freebsd.org/changeset/base/272567 > > > > > > Log: > > > filedesc: fix up breakage introduced in 272505 > > > > > > Include sequence counter supports incoditionally [1]. This fixes reprted build > > > problems with e.g. nvidia driver due to missing opt_capsicum.h. > > > > > > Replace fishy looking sizeof with offsetof. Make fde_seq the last member in > > > order to simplify calculations. > > > > Seing this on an incremental build now for > > > > bmake: stopped in /scratch/tmp/bz/head.svn/lib/libkvm > > > > /storage/head/obj//mips.mipsel/scratch/tmp/bz/head.svn/tmp/usr/include/sys/filedesc.h:57: error: expected specifier-qualifier-list before 'seq_t' > > > > I’ll see if this persists with a full build but I assume it will. > > > > I cannot reproduce it, tried with mips + QEMU config. > > One crap thing is that typedef uint32_t seq_t is placed before includes. > > Does it help if you move it after systm.h? > > Was the failure present prior to this patch? > Sigh, sorry, totally misread what you wrote. Fixed in r272574. -- Mateusz Guzik From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 21:51:38 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5E8D286C; Sun, 5 Oct 2014 21:51:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4A79CF96; Sun, 5 Oct 2014 21:51:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s95LpcLj035050; Sun, 5 Oct 2014 21:51:38 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s95Lpbvx035042; Sun, 5 Oct 2014 21:51:37 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201410052151.s95Lpbvx035042@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 5 Oct 2014 21:51:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272575 - head/bin/sh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 21:51:38 -0000 Author: jilles Date: Sun Oct 5 21:51:36 2014 New Revision: 272575 URL: https://svnweb.freebsd.org/changeset/base/272575 Log: sh: Eliminate some gotos. Modified: head/bin/sh/eval.c head/bin/sh/expand.c head/bin/sh/jobs.c head/bin/sh/redir.c head/bin/sh/trap.c Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Sun Oct 5 21:39:50 2014 (r272574) +++ head/bin/sh/eval.c Sun Oct 5 21:51:36 2014 (r272575) @@ -316,9 +316,10 @@ evalloop(union node *n, int flags) loopnest++; status = 0; for (;;) { - evaltree(n->nbinary.ch1, EV_TESTED); + if (!evalskip) + evaltree(n->nbinary.ch1, EV_TESTED); if (evalskip) { -skipping: if (evalskip == SKIPCONT && --skipcount <= 0) { + if (evalskip == SKIPCONT && --skipcount <= 0) { evalskip = 0; continue; } @@ -337,8 +338,6 @@ skipping: if (evalskip == SKIPCONT && } evaltree(n->nbinary.ch2, flags); status = exitstatus; - if (evalskip) - goto skipping; } loopnest--; exitstatus = status; @@ -648,15 +647,15 @@ evalbackcmd(union node *n, struct backcm struct jmploc *savehandler; struct localvar *savelocalvars; - setstackmark(&smark); result->fd = -1; result->buf = NULL; result->nleft = 0; result->jp = NULL; if (n == NULL) { exitstatus = 0; - goto out; + return; } + setstackmark(&smark); exitstatus = oexitstatus; if (is_valid_fast_cmdsubst(n)) { savelocalvars = localvars; @@ -698,7 +697,6 @@ evalbackcmd(union node *n, struct backcm result->fd = pip[0]; result->jp = jp; } -out: popstackmark(&smark); TRACE(("evalbackcmd done: fd=%d buf=%p nleft=%d jp=%p\n", result->fd, result->buf, result->nleft, result->jp)); Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Sun Oct 5 21:39:50 2014 (r272574) +++ head/bin/sh/expand.c Sun Oct 5 21:51:36 2014 (r272575) @@ -328,24 +328,19 @@ exptilde(char *p, int flag) done: *p = '\0'; if (*(startp+1) == '\0') { - if ((home = lookupvar("HOME")) == NULL) - goto lose; + home = lookupvar("HOME"); } else { - if ((pw = getpwnam(startp+1)) == NULL) - goto lose; - home = pw->pw_dir; + pw = getpwnam(startp+1); + home = pw != NULL ? pw->pw_dir : NULL; } - if (*home == '\0') - goto lose; *p = c; + if (home == NULL || *home == '\0') + return (startp); if (quotes) STPUTS_QUOTES(home, SQSYNTAX, expdest); else STPUTS(home, expdest); return (p); -lose: - *p = c; - return (startp); } Modified: head/bin/sh/jobs.c ============================================================================== --- head/bin/sh/jobs.c Sun Oct 5 21:39:50 2014 (r272574) +++ head/bin/sh/jobs.c Sun Oct 5 21:51:36 2014 (r272575) @@ -373,13 +373,13 @@ showjob(struct job *jp, int mode) strcat(statestr, " (core dumped)"); } - for (ps = jp->ps ; ; ps++) { /* for each process */ + for (ps = jp->ps ; procno > 0 ; ps++, procno--) { /* for each process */ if (mode == SHOWJOBS_PIDS || mode == SHOWJOBS_PGIDS) { out1fmt("%d\n", (int)ps->pid); - goto skip; + continue; } if (mode != SHOWJOBS_VERBOSE && ps != jp->ps) - goto skip; + continue; if (jobno == curr && ps == jp->ps) c = '+'; else if (jobno == prev && ps == jp->ps) @@ -410,8 +410,6 @@ showjob(struct job *jp, int mode) out1c('\n'); } else printjobcmd(jp); -skip: if (--procno <= 0) - break; } } Modified: head/bin/sh/redir.c ============================================================================== --- head/bin/sh/redir.c Sun Oct 5 21:39:50 2014 (r272574) +++ head/bin/sh/redir.c Sun Oct 5 21:51:36 2014 (r272575) @@ -173,21 +173,12 @@ openredirect(union node *redir, char mem fname = redir->nfile.expfname; if ((f = open(fname, O_RDONLY)) < 0) error("cannot open %s: %s", fname, strerror(errno)); -movefd: - if (f != fd) { - if (dup2(f, fd) == -1) { - e = errno; - close(f); - error("%d: %s", fd, strerror(e)); - } - close(f); - } break; case NFROMTO: fname = redir->nfile.expfname; if ((f = open(fname, O_RDWR|O_CREAT, 0666)) < 0) error("cannot create %s: %s", fname, strerror(errno)); - goto movefd; + break; case NTO: if (Cflag) { fname = redir->nfile.expfname; @@ -205,19 +196,19 @@ movefd: } else error("cannot create %s: %s", fname, strerror(EEXIST)); - goto movefd; + break; } /* FALLTHROUGH */ case NCLOBBER: fname = redir->nfile.expfname; if ((f = open(fname, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) error("cannot create %s: %s", fname, strerror(errno)); - goto movefd; + break; case NAPPEND: fname = redir->nfile.expfname; if ((f = open(fname, O_WRONLY|O_CREAT|O_APPEND, 0666)) < 0) error("cannot create %s: %s", fname, strerror(errno)); - goto movefd; + break; case NTOFD: case NFROMFD: if (redir->ndup.dupfd >= 0) { /* if not ">&-" */ @@ -231,14 +222,22 @@ movefd: } else { close(fd); } - break; + return; case NHERE: case NXHERE: f = openhere(redir); - goto movefd; + break; default: abort(); } + if (f != fd) { + if (dup2(f, fd) == -1) { + e = errno; + close(f); + error("%d: %s", fd, strerror(e)); + } + close(f); + } } Modified: head/bin/sh/trap.c ============================================================================== --- head/bin/sh/trap.c Sun Oct 5 21:39:50 2014 (r272574) +++ head/bin/sh/trap.c Sun Oct 5 21:51:36 2014 (r272575) @@ -510,28 +510,25 @@ exitshell_savedstatus(void) exiting_exitstatus = oexitstatus; } exitstatus = oexitstatus = exiting_exitstatus; - if (setjmp(loc1.loc)) { - goto l1; + if (!setjmp(loc1.loc)) { + handler = &loc1; + if ((p = trap[0]) != NULL && *p != '\0') { + /* + * Reset evalskip, or the trap on EXIT could be + * interrupted if the last command was a "return". + */ + evalskip = 0; + trap[0] = NULL; + evalstring(p, 0); + } } - if (setjmp(loc2.loc)) { - goto l2; - } - handler = &loc1; - if ((p = trap[0]) != NULL && *p != '\0') { - /* - * Reset evalskip, or the trap on EXIT could be - * interrupted if the last command was a "return". - */ - evalskip = 0; - trap[0] = NULL; - evalstring(p, 0); - } -l1: handler = &loc2; /* probably unnecessary */ - flushall(); + if (!setjmp(loc2.loc)) { + handler = &loc2; /* probably unnecessary */ + flushall(); #if JOBS - setjobctl(0); + setjobctl(0); #endif -l2: + } if (sig != 0 && sig != SIGSTOP && sig != SIGTSTP && sig != SIGTTIN && sig != SIGTTOU) { signal(sig, SIG_DFL); From owner-svn-src-head@FreeBSD.ORG Sun Oct 5 22:13:14 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A70ECE47; Sun, 5 Oct 2014 22:13:14 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9432F254; Sun, 5 Oct 2014 22:13:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s95MDEs1046960; Sun, 5 Oct 2014 22:13:14 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s95MDExh046959; Sun, 5 Oct 2014 22:13:14 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201410052213.s95MDExh046959@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 5 Oct 2014 22:13:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272576 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2014 22:13:14 -0000 Author: markj Date: Sun Oct 5 22:13:13 2014 New Revision: 272576 URL: https://svnweb.freebsd.org/changeset/base/272576 Log: Fix dependency errors when linking libproc. Reported by: Oliver Hartmann X-MFC-With: r272488 Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Sun Oct 5 21:51:36 2014 (r272575) +++ head/Makefile.inc1 Sun Oct 5 22:13:13 2014 (r272576) @@ -1536,6 +1536,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1 ${_cddl_lib_libuutil} \ ${_cddl_lib_libavl} \ ${_cddl_lib_libzfs_core} \ + ${_cddl_lib_libctf} \ lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \ ${_secure_lib_libcrypto} ${_lib_libldns} \ ${_secure_lib_libssh} ${_secure_lib_libssl} @@ -1586,9 +1587,11 @@ _cddl_lib_libnvpair= cddl/lib/libnvpair _cddl_lib_libavl= cddl/lib/libavl _cddl_lib_libuutil= cddl/lib/libuutil _cddl_lib_libzfs_core= cddl/lib/libzfs_core +_cddl_lib_libctf= cddl/lib/libctf _cddl_lib= cddl/lib cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L cddl/lib/libzfs__L: lib/libgeom__L +cddl/lib/libctf__L: lib/libz__L .endif .if ${MK_CRYPT} != "no" From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 00:16:25 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0B6CF1A0; Mon, 6 Oct 2014 00:16:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D31E7F31; Mon, 6 Oct 2014 00:16:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s960GO4X005242; Mon, 6 Oct 2014 00:16:24 GMT (envelope-from brd@FreeBSD.org) Received: (from brd@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s960GOWO005239; Mon, 6 Oct 2014 00:16:24 GMT (envelope-from brd@FreeBSD.org) Message-Id: <201410060016.s960GOWO005239@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: brd set sender to brd@FreeBSD.org using -f From: Brad Davis Date: Mon, 6 Oct 2014 00:16:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272578 - head/usr.sbin/pw/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 00:16:25 -0000 Author: brd (doc committer) Date: Mon Oct 6 00:16:23 2014 New Revision: 272578 URL: https://svnweb.freebsd.org/changeset/base/272578 Log: - Add some tests for modifying groups Reviewed by: will Added: head/usr.sbin/pw/tests/pw_modify.sh (contents, props changed) Modified: head/usr.sbin/pw/tests/Makefile Modified: head/usr.sbin/pw/tests/Makefile ============================================================================== --- head/usr.sbin/pw/tests/Makefile Sun Oct 5 23:32:58 2014 (r272577) +++ head/usr.sbin/pw/tests/Makefile Mon Oct 6 00:16:23 2014 (r272578) @@ -2,7 +2,7 @@ TESTSDIR= ${TESTSBASE}/usr.sbin/pw -ATF_TESTS_SH= pw_delete +ATF_TESTS_SH= pw_delete pw_modify FILES= group helper_functions.shin master.passwd FILESDIR= ${TESTSDIR} Added: head/usr.sbin/pw/tests/pw_modify.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/pw/tests/pw_modify.sh Mon Oct 6 00:16:23 2014 (r272578) @@ -0,0 +1,34 @@ +# $FreeBSD$ + +# Import helper functions +. $(atf_get_srcdir)/helper_functions.shin + + +# Test adding & removing a user from a group +atf_test_case groupmod_user +groupmod_user_body() { + populate_etc_skel + atf_check -s exit:0 pw -V ${HOME} addgroup test + atf_check -s exit:0 pw -V ${HOME} groupmod test -m root + atf_check -s exit:0 -o match:"^test:\*:1001:root$" \ + grep "^test:\*:.*:root$" $HOME/group + atf_check -s exit:0 pw -V ${HOME} groupmod test -d root + atf_check -s exit:0 -o match:"^test:\*:1001:$" \ + grep "^test:\*:.*:$" $HOME/group +} + + +# Test adding and removing a user that does not exist +atf_test_case groupmod_invalid_user +groupmod_invalid_user_body() { + populate_etc_skel + atf_check -s exit:0 pw -V ${HOME} addgroup test + atf_check -s exit:67 -e match:"does not exist" pw -V ${HOME} groupmod test -m foo + atf_check -s exit:0 pw -V ${HOME} groupmod test -d foo +} + + +atf_init_test_cases() { + atf_add_test_case groupmod_user + atf_add_test_case groupmod_invalid_user +} From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 00:25:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1C8B6359; Mon, 6 Oct 2014 00:25:11 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 09F9AFE5; Mon, 6 Oct 2014 00:25:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s960PAlc009765; Mon, 6 Oct 2014 00:25:10 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s960PALS009764; Mon, 6 Oct 2014 00:25:10 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201410060025.s960PALS009764@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Mon, 6 Oct 2014 00:25:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272579 - head/share/man/man5 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 00:25:11 -0000 Author: bdrewery Date: Mon Oct 6 00:25:10 2014 New Revision: 272579 URL: https://svnweb.freebsd.org/changeset/base/272579 Log: Bump .Dd missed in r271424 Modified: head/share/man/man5/rc.conf.5 Modified: head/share/man/man5/rc.conf.5 ============================================================================== --- head/share/man/man5/rc.conf.5 Mon Oct 6 00:16:23 2014 (r272578) +++ head/share/man/man5/rc.conf.5 Mon Oct 6 00:25:10 2014 (r272579) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 27, 2014 +.Dd September 11, 2014 .Dt RC.CONF 5 .Os .Sh NAME From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 02:31:35 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DADC421A; Mon, 6 Oct 2014 02:31:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C60DEC40; Mon, 6 Oct 2014 02:31:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s962VYm7068369; Mon, 6 Oct 2014 02:31:34 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s962VYB5068366; Mon, 6 Oct 2014 02:31:34 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410060231.s962VYB5068366@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 6 Oct 2014 02:31:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272582 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 02:31:35 -0000 Author: mjg Date: Mon Oct 6 02:31:33 2014 New Revision: 272582 URL: https://svnweb.freebsd.org/changeset/base/272582 Log: Convert racct stubs to inline functions. This saves some symbols and function calls for kernel without RACCT. MFC after: 1 week Modified: head/sys/kern/kern_racct.c head/sys/sys/racct.h Modified: head/sys/kern/kern_racct.c ============================================================================== --- head/sys/kern/kern_racct.c Mon Oct 6 00:31:31 2014 (r272581) +++ head/sys/kern/kern_racct.c Mon Oct 6 02:31:33 2014 (r272582) @@ -1203,88 +1203,4 @@ racct_init(void) } SYSINIT(racct, SI_SUB_RACCT, SI_ORDER_FIRST, racct_init, NULL); -#else /* !RACCT */ - -int -racct_add(struct proc *p, int resource, uint64_t amount) -{ - - return (0); -} - -void -racct_add_cred(struct ucred *cred, int resource, uint64_t amount) -{ -} - -void -racct_add_force(struct proc *p, int resource, uint64_t amount) -{ - - return; -} - -int -racct_set(struct proc *p, int resource, uint64_t amount) -{ - - return (0); -} - -void -racct_set_force(struct proc *p, int resource, uint64_t amount) -{ -} - -void -racct_sub(struct proc *p, int resource, uint64_t amount) -{ -} - -void -racct_sub_cred(struct ucred *cred, int resource, uint64_t amount) -{ -} - -uint64_t -racct_get_limit(struct proc *p, int resource) -{ - - return (UINT64_MAX); -} - -uint64_t -racct_get_available(struct proc *p, int resource) -{ - - return (UINT64_MAX); -} - -void -racct_create(struct racct **racctp) -{ -} - -void -racct_destroy(struct racct **racctp) -{ -} - -int -racct_proc_fork(struct proc *parent, struct proc *child) -{ - - return (0); -} - -void -racct_proc_fork_done(struct proc *child) -{ -} - -void -racct_proc_exit(struct proc *p) -{ -} - #endif /* !RACCT */ Modified: head/sys/sys/racct.h ============================================================================== --- head/sys/sys/racct.h Mon Oct 6 00:31:31 2014 (r272581) +++ head/sys/sys/racct.h Mon Oct 6 02:31:33 2014 (r272582) @@ -37,6 +37,7 @@ #define _RACCT_H_ #include +#include #include #include @@ -141,6 +142,8 @@ struct racct { LIST_HEAD(, rctl_rule_link) r_rule_links; }; +#ifdef RACCT + int racct_add(struct proc *p, int resource, uint64_t amount); void racct_add_cred(struct ucred *cred, int resource, uint64_t amount); void racct_add_force(struct proc *p, int resource, uint64_t amount); @@ -162,4 +165,88 @@ void racct_proc_ucred_changed(struct pro struct ucred *newcred); void racct_move(struct racct *dest, struct racct *src); +#else + +static inline int +racct_add(struct proc *p, int resource, uint64_t amount) +{ + + return (0); +} + +static inline void +racct_add_cred(struct ucred *cred, int resource, uint64_t amount) +{ +} + +static inline void +racct_add_force(struct proc *p, int resource, uint64_t amount) +{ +} + +static inline int +racct_set(struct proc *p, int resource, uint64_t amount) +{ + + return (0); +} + +static inline void +racct_set_force(struct proc *p, int resource, uint64_t amount) +{ +} + +static inline void +racct_sub(struct proc *p, int resource, uint64_t amount) +{ +} + +static inline void +racct_sub_cred(struct ucred *cred, int resource, uint64_t amount) +{ +} + +static inline uint64_t +racct_get_limit(struct proc *p, int resource) +{ + + return (UINT64_MAX); +} + +static inline uint64_t +racct_get_available(struct proc *p, int resource) +{ + + return (UINT64_MAX); +} + +static inline void +racct_create(struct racct **racctp) +{ +} + +static inline void +racct_destroy(struct racct **racctp) +{ +} + +static inline int +racct_proc_fork(struct proc *parent, struct proc *child) +{ + + return (0); +} + +static inline void +racct_proc_fork_done(struct proc *child) +{ +} + +static inline void +racct_proc_exit(struct proc *p) +{ +} + +#endif + #endif /* !_RACCT_H_ */ From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 04:25:55 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 912383B4; Mon, 6 Oct 2014 04:25:55 +0000 (UTC) Received: from mail108.syd.optusnet.com.au (mail108.syd.optusnet.com.au [211.29.132.59]) by mx1.freebsd.org (Postfix) with ESMTP id 4CFF6935; Mon, 6 Oct 2014 04:25:54 +0000 (UTC) Received: from c122-106-147-133.carlnfd1.nsw.optusnet.com.au (c122-106-147-133.carlnfd1.nsw.optusnet.com.au [122.106.147.133]) by mail108.syd.optusnet.com.au (Postfix) with ESMTPS id 4A9421A3A6B; Mon, 6 Oct 2014 15:25:45 +1100 (EST) Date: Mon, 6 Oct 2014 15:25:44 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Mateusz Guzik Subject: Re: svn commit: r272574 - head/sys/sys In-Reply-To: <201410052139.s95LdoJw029807@svn.freebsd.org> Message-ID: <20141006145350.S1175@besplex.bde.org> References: <201410052139.s95LdoJw029807@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=dMCfxopb c=1 sm=1 tr=0 a=7NqvjVvQucbO2RlWB8PEog==:117 a=PO7r1zJSAAAA:8 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=wSEkhf3f56hUFKgGh-kA:9 a=CjuIK1q_8ugA:10 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 04:25:55 -0000 On Sun, 5 Oct 2014, Mateusz Guzik wrote: > Log: > seq_t needs to be visible to userspace > > Pointy hat to: mjg > Reported by: bz > X-MFC: with r272567 The namespace pollution is more disgusting than before. > Modified: head/sys/sys/seq.h > ============================================================================== > --- head/sys/sys/seq.h Sun Oct 5 21:34:56 2014 (r272573) > +++ head/sys/sys/seq.h Sun Oct 5 21:39:50 2014 (r272574) > @@ -29,6 +29,16 @@ > #define _SYS_SEQ_H_ > > #ifdef _KERNEL > +#include > +#endif Namespace pollution. In the kernel, it is the responsibility of .c files to include before any other header except , in case bad headers like this one use inline functions with KASSERT() either now or later. > +#include Namespace pollution. In the kernel, it is the responsibility of .c files to include before any other header, since it has standard namspace pollution that other headers may depend on now or later. This pollution includes , even outside the kernel. It is a documented style bug to include both and . It is a bug to include and not in the kernel, except in very special cases where only headers with a stable API are included after it (otherwise, the others might grow a need for or . Outside of the kernel, the necessary types and no others should be declared in headers. > +/* > + * seq_t may be included in structs visible to userspace > + */ > +typedef uint32_t seq_t; > + > +#ifdef _KERNEL > > /* > * Typical usage: > @@ -54,10 +64,7 @@ > * foo(lobj); > */ > > -typedef uint32_t seq_t; > - > /* A hack to get MPASS macro */ > -#include > #include Now the comment doesn't match the code. The hack is to include both and . MPASS is defined in . has minimal pollution. In particular, it doesn't include . It uses MPASS() with a KASSERT(), but this is in a macro so files that actually use the macro need to include . 's includers are now such files, but polluted instead. This commit moves half of the hack earlier than needed and far from the comment that documents it. > > #include If you remove the part of the hack, some .c files might break. This is a feature. It detects 2 bugs: - nested pollution. IIRC, is now polluted with an include of , so not only files that include are effected - the brokenness of the files that break. is included much more, and any .c file that is missing the include of , or includes it miss-sorted in alphabetical or totally disordered after . Part of the feature is that you get to fix all such broken .c files, or better implement new headers without namespace pollution. The only easy way to avoid pollution from KASSERT() in headers is to only use it in other macros. Some inline functions are so small that this is clean enough. But ones that use KASSERT() are not so small. Just using it makes them too large to inline (when it is enabled). Bruce From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 05:42:21 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F10EB216; Mon, 6 Oct 2014 05:42:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C2732FA9; Mon, 6 Oct 2014 05:42:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s965gKO5060214; Mon, 6 Oct 2014 05:42:20 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s965gKSn060213; Mon, 6 Oct 2014 05:42:20 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410060542.s965gKSn060213@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 6 Oct 2014 05:42:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272583 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 05:42:21 -0000 Author: delphij Date: Mon Oct 6 05:42:20 2014 New Revision: 272583 URL: https://svnweb.freebsd.org/changeset/base/272583 Log: MFV r272500: Don't inherit flags other than DS_FLAG_CI_DATASET and DS_FLAG_INCONSISTENT when cloning. This prevents DS_FLAG_DEFER_DESTROY being inherited from a clone that is marked for deferred destroy, which causes snapshots of the clone being destroyed when getting a hold or clone. Illumos issue: 5150 zfs clone of a defer_destroy snapshot causes strangeness MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Mon Oct 6 02:31:33 2014 (r272582) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Mon Oct 6 05:42:20 2014 (r272583) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Portions Copyright (c) 2011 Martin Matuska - * Copyright (c) 2013, 2014 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright (c) 2014, Joyent, Inc. All rights reserved. * Copyright (c) 2014 RackTop Systems. */ @@ -699,7 +699,13 @@ dsl_dataset_create_sync_dd(dsl_dir_t *dd dsphys->ds_uncompressed_bytes = origin->ds_phys->ds_uncompressed_bytes; dsphys->ds_bp = origin->ds_phys->ds_bp; - dsphys->ds_flags |= origin->ds_phys->ds_flags; + + /* + * Inherit flags that describe the dataset's contents + * (INCONSISTENT) or properties (Case Insensitive). + */ + dsphys->ds_flags |= origin->ds_phys->ds_flags & + (DS_FLAG_INCONSISTENT | DS_FLAG_CI_DATASET); dmu_buf_will_dirty(origin->ds_dbuf, tx); origin->ds_phys->ds_num_children++; From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 05:46:52 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8A5E93AA; Mon, 6 Oct 2014 05:46:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6B857FC9; Mon, 6 Oct 2014 05:46:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s965kqTe060824; Mon, 6 Oct 2014 05:46:52 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s965kqDQ060823; Mon, 6 Oct 2014 05:46:52 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410060546.s965kqDQ060823@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 6 Oct 2014 05:46:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272584 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 05:46:52 -0000 Author: delphij Date: Mon Oct 6 05:46:51 2014 New Revision: 272584 URL: https://svnweb.freebsd.org/changeset/base/272584 Log: MFV r272501: Illumos issue: 5177 remove dead code from dsl_scan.c MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Mon Oct 6 05:42:20 2014 (r272583) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Mon Oct 6 05:46:51 2014 (r272584) @@ -375,13 +375,12 @@ dsl_scan_cancel(dsl_pool_t *dp) dsl_scan_cancel_sync, NULL, 3, ZFS_SPACE_CHECK_RESERVED)); } -static void dsl_scan_visitbp(blkptr_t *bp, - const zbookmark_phys_t *zb, dnode_phys_t *dnp, arc_buf_t *pbuf, - dsl_dataset_t *ds, dsl_scan_t *scn, dmu_objset_type_t ostype, - dmu_tx_t *tx); +static void dsl_scan_visitbp(blkptr_t *bp, const zbookmark_phys_t *zb, + dnode_phys_t *dnp, dsl_dataset_t *ds, dsl_scan_t *scn, + dmu_objset_type_t ostype, dmu_tx_t *tx); static void dsl_scan_visitdnode(dsl_scan_t *, dsl_dataset_t *ds, dmu_objset_type_t ostype, - dnode_phys_t *dnp, arc_buf_t *buf, uint64_t object, dmu_tx_t *tx); + dnode_phys_t *dnp, uint64_t object, dmu_tx_t *tx); void dsl_free(dsl_pool_t *dp, uint64_t txg, const blkptr_t *bp) @@ -615,7 +614,7 @@ dsl_scan_check_resume(dsl_scan_t *scn, c static int dsl_scan_recurse(dsl_scan_t *scn, dsl_dataset_t *ds, dmu_objset_type_t ostype, dnode_phys_t *dnp, const blkptr_t *bp, - const zbookmark_phys_t *zb, dmu_tx_t *tx, arc_buf_t **bufp) + const zbookmark_phys_t *zb, dmu_tx_t *tx) { dsl_pool_t *dp = scn->scn_dp; int zio_flags = ZIO_FLAG_CANFAIL | ZIO_FLAG_SCAN_THREAD; @@ -626,76 +625,72 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_da int i; blkptr_t *cbp; int epb = BP_GET_LSIZE(bp) >> SPA_BLKPTRSHIFT; + arc_buf_t *buf; - err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, bufp, + err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, &buf, ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb); if (err) { scn->scn_phys.scn_errors++; return (err); } - for (i = 0, cbp = (*bufp)->b_data; i < epb; i++, cbp++) { - dsl_scan_prefetch(scn, *bufp, cbp, zb->zb_objset, + for (i = 0, cbp = buf->b_data; i < epb; i++, cbp++) { + dsl_scan_prefetch(scn, buf, cbp, zb->zb_objset, zb->zb_object, zb->zb_blkid * epb + i); } - for (i = 0, cbp = (*bufp)->b_data; i < epb; i++, cbp++) { + for (i = 0, cbp = buf->b_data; i < epb; i++, cbp++) { zbookmark_phys_t czb; SET_BOOKMARK(&czb, zb->zb_objset, zb->zb_object, zb->zb_level - 1, zb->zb_blkid * epb + i); dsl_scan_visitbp(cbp, &czb, dnp, - *bufp, ds, scn, ostype, tx); - } - } else if (BP_GET_TYPE(bp) == DMU_OT_USERGROUP_USED) { - uint32_t flags = ARC_WAIT; - - err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, bufp, - ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb); - if (err) { - scn->scn_phys.scn_errors++; - return (err); + ds, scn, ostype, tx); } + (void) arc_buf_remove_ref(buf, &buf); } else if (BP_GET_TYPE(bp) == DMU_OT_DNODE) { uint32_t flags = ARC_WAIT; dnode_phys_t *cdnp; int i, j; int epb = BP_GET_LSIZE(bp) >> DNODE_SHIFT; + arc_buf_t *buf; - err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, bufp, + err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, &buf, ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb); if (err) { scn->scn_phys.scn_errors++; return (err); } - for (i = 0, cdnp = (*bufp)->b_data; i < epb; i++, cdnp++) { + for (i = 0, cdnp = buf->b_data; i < epb; i++, cdnp++) { for (j = 0; j < cdnp->dn_nblkptr; j++) { blkptr_t *cbp = &cdnp->dn_blkptr[j]; - dsl_scan_prefetch(scn, *bufp, cbp, + dsl_scan_prefetch(scn, buf, cbp, zb->zb_objset, zb->zb_blkid * epb + i, j); } } - for (i = 0, cdnp = (*bufp)->b_data; i < epb; i++, cdnp++) { + for (i = 0, cdnp = buf->b_data; i < epb; i++, cdnp++) { dsl_scan_visitdnode(scn, ds, ostype, - cdnp, *bufp, zb->zb_blkid * epb + i, tx); + cdnp, zb->zb_blkid * epb + i, tx); } + (void) arc_buf_remove_ref(buf, &buf); } else if (BP_GET_TYPE(bp) == DMU_OT_OBJSET) { uint32_t flags = ARC_WAIT; objset_phys_t *osp; + arc_buf_t *buf; - err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, bufp, + err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, &buf, ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb); if (err) { scn->scn_phys.scn_errors++; return (err); } - osp = (*bufp)->b_data; + osp = buf->b_data; dsl_scan_visitdnode(scn, ds, osp->os_type, - &osp->os_meta_dnode, *bufp, DMU_META_DNODE_OBJECT, tx); + &osp->os_meta_dnode, DMU_META_DNODE_OBJECT, tx); - if (OBJSET_BUF_HAS_USERUSED(*bufp)) { + if (OBJSET_BUF_HAS_USERUSED(buf)) { /* * We also always visit user/group accounting * objects, and never skip them, even if we are @@ -703,12 +698,13 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_da * deltas from this txg get integrated. */ dsl_scan_visitdnode(scn, ds, osp->os_type, - &osp->os_groupused_dnode, *bufp, + &osp->os_groupused_dnode, DMU_GROUPUSED_OBJECT, tx); dsl_scan_visitdnode(scn, ds, osp->os_type, - &osp->os_userused_dnode, *bufp, + &osp->os_userused_dnode, DMU_USERUSED_OBJECT, tx); } + (void) arc_buf_remove_ref(buf, &buf); } return (0); @@ -716,7 +712,7 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_da static void dsl_scan_visitdnode(dsl_scan_t *scn, dsl_dataset_t *ds, - dmu_objset_type_t ostype, dnode_phys_t *dnp, arc_buf_t *buf, + dmu_objset_type_t ostype, dnode_phys_t *dnp, uint64_t object, dmu_tx_t *tx) { int j; @@ -727,7 +723,7 @@ dsl_scan_visitdnode(dsl_scan_t *scn, dsl SET_BOOKMARK(&czb, ds ? ds->ds_object : 0, object, dnp->dn_nlevels - 1, j); dsl_scan_visitbp(&dnp->dn_blkptr[j], - &czb, dnp, buf, ds, scn, ostype, tx); + &czb, dnp, ds, scn, ostype, tx); } if (dnp->dn_flags & DNODE_FLAG_SPILL_BLKPTR) { @@ -735,7 +731,7 @@ dsl_scan_visitdnode(dsl_scan_t *scn, dsl SET_BOOKMARK(&czb, ds ? ds->ds_object : 0, object, 0, DMU_SPILL_BLKID); dsl_scan_visitbp(&dnp->dn_spill, - &czb, dnp, buf, ds, scn, ostype, tx); + &czb, dnp, ds, scn, ostype, tx); } } @@ -745,9 +741,8 @@ dsl_scan_visitdnode(dsl_scan_t *scn, dsl */ static void dsl_scan_visitbp(blkptr_t *bp, const zbookmark_phys_t *zb, - dnode_phys_t *dnp, arc_buf_t *pbuf, - dsl_dataset_t *ds, dsl_scan_t *scn, dmu_objset_type_t ostype, - dmu_tx_t *tx) + dnode_phys_t *dnp, dsl_dataset_t *ds, dsl_scan_t *scn, + dmu_objset_type_t ostype, dmu_tx_t *tx) { dsl_pool_t *dp = scn->scn_dp; arc_buf_t *buf = NULL; @@ -767,16 +762,15 @@ dsl_scan_visitbp(blkptr_t *bp, const zbo scn->scn_visited_this_txg++; dprintf_bp(bp, - "visiting ds=%p/%llu zb=%llx/%llx/%llx/%llx buf=%p bp=%p", + "visiting ds=%p/%llu zb=%llx/%llx/%llx/%llx bp=%p", ds, ds ? ds->ds_object : 0, zb->zb_objset, zb->zb_object, zb->zb_level, zb->zb_blkid, - pbuf, bp); + bp); if (bp->blk_birth <= scn->scn_phys.scn_cur_min_txg) return; - if (dsl_scan_recurse(scn, ds, ostype, dnp, &bp_toread, zb, tx, - &buf) != 0) + if (dsl_scan_recurse(scn, ds, ostype, dnp, &bp_toread, zb, tx) != 0) return; /* @@ -800,8 +794,6 @@ dsl_scan_visitbp(blkptr_t *bp, const zbo if (BP_PHYSICAL_BIRTH(bp) <= scn->scn_phys.scn_cur_max_txg) { scan_funcs[scn->scn_phys.scn_func](dp, bp, zb); } - if (buf) - (void) arc_buf_remove_ref(buf, &buf); } static void @@ -812,7 +804,7 @@ dsl_scan_visit_rootbp(dsl_scan_t *scn, d SET_BOOKMARK(&zb, ds ? ds->ds_object : DMU_META_OBJSET, ZB_ROOT_OBJECT, ZB_ROOT_LEVEL, ZB_ROOT_BLKID); - dsl_scan_visitbp(bp, &zb, NULL, NULL, + dsl_scan_visitbp(bp, &zb, NULL, ds, scn, DMU_OST_NONE, tx); dprintf_ds(ds, "finished scan%s", ""); From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 06:19:55 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4B68C80F; Mon, 6 Oct 2014 06:19:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1D400366; Mon, 6 Oct 2014 06:19:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s966Js5i076067; Mon, 6 Oct 2014 06:19:54 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s966Js9M076066; Mon, 6 Oct 2014 06:19:54 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201410060619.s966Js9M076066@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 6 Oct 2014 06:19:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272595 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 06:19:55 -0000 Author: hselasky Date: Mon Oct 6 06:19:54 2014 New Revision: 272595 URL: https://svnweb.freebsd.org/changeset/base/272595 Log: Minor code styling. Suggested by: glebius @ Modified: head/sys/netinet/tcp_output.c Modified: head/sys/netinet/tcp_output.c ============================================================================== --- head/sys/netinet/tcp_output.c Mon Oct 6 06:08:29 2014 (r272594) +++ head/sys/netinet/tcp_output.c Mon Oct 6 06:19:54 2014 (r272595) @@ -806,41 +806,40 @@ send: * Check if we should limit by maximum segment * size and count: */ - if (if_hw_tsomaxsegcount != 0 && if_hw_tsomaxsegsize != 0) { + if (if_hw_tsomaxsegcount != 0 && + if_hw_tsomaxsegsize != 0) { max_len = 0; mb = sbsndmbuf(&so->so_snd, off, &moff); while (mb != NULL && (u_int)max_len < len) { - u_int cur_length; - u_int cur_frags; + u_int mlen; + u_int frags; /* * Get length of mbuf fragment - * and how many hardware - * frags, rounded up, it would - * use: + * and how many hardware frags, + * rounded up, it would use: */ - cur_length = (mb->m_len - moff); - cur_frags = (cur_length + if_hw_tsomaxsegsize - - 1) / if_hw_tsomaxsegsize; + mlen = (mb->m_len - moff); + frags = howmany(mlen, + if_hw_tsomaxsegsize); /* Handle special case: Zero Length Mbuf */ - if (cur_frags == 0) - cur_frags = 1; + if (frags == 0) + frags = 1; /* * Check if the fragment limit - * will be reached or - * exceeded: + * will be reached or exceeded: */ - if (cur_frags >= if_hw_tsomaxsegcount) { - max_len += min(cur_length, + if (frags >= if_hw_tsomaxsegcount) { + max_len += min(mlen, if_hw_tsomaxsegcount * if_hw_tsomaxsegsize); break; } - max_len += cur_length; - if_hw_tsomaxsegcount -= cur_frags; + max_len += mlen; + if_hw_tsomaxsegcount -= frags; moff = 0; mb = mb->m_next; } From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 06:20:36 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4B35A953; Mon, 6 Oct 2014 06:20:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 37BAF370; Mon, 6 Oct 2014 06:20:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s966Kas9078737; Mon, 6 Oct 2014 06:20:36 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s966Kaqt078736; Mon, 6 Oct 2014 06:20:36 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410060620.s966Kaqt078736@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 6 Oct 2014 06:20:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272596 - head/sys/fs/devfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 06:20:36 -0000 Author: mjg Date: Mon Oct 6 06:20:35 2014 New Revision: 272596 URL: https://svnweb.freebsd.org/changeset/base/272596 Log: devfs: don't take proctree_lock unconditionally in devfs_close MFC after: 1 week Modified: head/sys/fs/devfs/devfs_vnops.c Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Mon Oct 6 06:19:54 2014 (r272595) +++ head/sys/fs/devfs/devfs_vnops.c Mon Oct 6 06:20:35 2014 (r272596) @@ -546,19 +546,22 @@ devfs_close(struct vop_close_args *ap) * plus the session), release the reference from the session. */ oldvp = NULL; - sx_xlock(&proctree_lock); if (td && vp == td->td_proc->p_session->s_ttyvp) { - SESS_LOCK(td->td_proc->p_session); - VI_LOCK(vp); - if (count_dev(dev) == 2 && (vp->v_iflag & VI_DOOMED) == 0) { - td->td_proc->p_session->s_ttyvp = NULL; - td->td_proc->p_session->s_ttydp = NULL; - oldvp = vp; + sx_xlock(&proctree_lock); + if (vp == td->td_proc->p_session->s_ttyvp) { + SESS_LOCK(td->td_proc->p_session); + VI_LOCK(vp); + if (count_dev(dev) == 2 && + (vp->v_iflag & VI_DOOMED) == 0) { + td->td_proc->p_session->s_ttyvp = NULL; + td->td_proc->p_session->s_ttydp = NULL; + oldvp = vp; + } + VI_UNLOCK(vp); + SESS_UNLOCK(td->td_proc->p_session); } - VI_UNLOCK(vp); - SESS_UNLOCK(td->td_proc->p_session); + sx_xunlock(&proctree_lock); } - sx_xunlock(&proctree_lock); if (oldvp != NULL) vrele(oldvp); /* From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 07:01:32 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E2E2C479; Mon, 6 Oct 2014 07:01:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D0052966; Mon, 6 Oct 2014 07:01:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9671WEC098037; Mon, 6 Oct 2014 07:01:32 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9671WNZ098036; Mon, 6 Oct 2014 07:01:32 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410060701.s9671WNZ098036@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 6 Oct 2014 07:01:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272597 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 07:01:33 -0000 Author: mav Date: Mon Oct 6 07:01:32 2014 New Revision: 272597 URL: https://svnweb.freebsd.org/changeset/base/272597 Log: Fix length of Extended INQUIRY Data VPD page. MFC after: 3 days Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Mon Oct 6 06:20:35 2014 (r272596) +++ head/sys/cam/ctl/ctl.c Mon Oct 6 07:01:32 2014 (r272597) @@ -9912,9 +9912,7 @@ ctl_inquiry_evpd_eid(struct ctl_scsiio * lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - data_len = sizeof(struct scsi_vpd_mode_page_policy) + - sizeof(struct scsi_vpd_mode_page_policy_descr); - + data_len = sizeof(struct scsi_vpd_extended_inquiry_data); ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); eid_ptr = (struct scsi_vpd_extended_inquiry_data *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 07:03:19 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7FE105E4; Mon, 6 Oct 2014 07:03:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 61CA69FA; Mon, 6 Oct 2014 07:03:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9673JVX098740; Mon, 6 Oct 2014 07:03:19 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9673IDA098734; Mon, 6 Oct 2014 07:03:18 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410060703.s9673IDA098734@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 6 Oct 2014 07:03:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272598 - in head: cddl/contrib/opensolaris/cmd/zdb sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 07:03:19 -0000 Author: delphij Date: Mon Oct 6 07:03:17 2014 New Revision: 272598 URL: https://svnweb.freebsd.org/changeset/base/272598 Log: MFV r272585: Split the godfather zio into CPU number's to reduce lock contention. Illumos issue: 5176 lock contention on godfather zio MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Oct 6 07:01:32 2014 (r272597) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Oct 6 07:03:17 2014 (r272598) @@ -2594,10 +2594,12 @@ dump_block_stats(spa_t *spa) * all async I/Os to complete. */ if (dump_opt['c']) { - (void) zio_wait(spa->spa_async_zio_root); - spa->spa_async_zio_root = zio_root(spa, NULL, NULL, - ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | - ZIO_FLAG_GODFATHER); + for (int i = 0; i < max_ncpus; i++) { + (void) zio_wait(spa->spa_async_zio_root[i]); + spa->spa_async_zio_root[i] = zio_root(spa, NULL, NULL, + ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | + ZIO_FLAG_GODFATHER); + } } if (zcb.zcb_haderrors) { Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon Oct 6 07:01:32 2014 (r272597) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon Oct 6 07:03:17 2014 (r272598) @@ -1277,7 +1277,9 @@ spa_unload(spa_t *spa) * Wait for any outstanding async I/O to complete. */ if (spa->spa_async_zio_root != NULL) { - (void) zio_wait(spa->spa_async_zio_root); + for (int i = 0; i < max_ncpus; i++) + (void) zio_wait(spa->spa_async_zio_root[i]); + kmem_free(spa->spa_async_zio_root, max_ncpus * sizeof (void *)); spa->spa_async_zio_root = NULL; } @@ -2213,8 +2215,13 @@ spa_load_impl(spa_t *spa, uint64_t pool_ /* * Create "The Godfather" zio to hold all async IOs */ - spa->spa_async_zio_root = zio_root(spa, NULL, NULL, - ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | ZIO_FLAG_GODFATHER); + spa->spa_async_zio_root = kmem_alloc(max_ncpus * sizeof (void *), + KM_SLEEP); + for (int i = 0; i < max_ncpus; i++) { + spa->spa_async_zio_root[i] = zio_root(spa, NULL, NULL, + ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | + ZIO_FLAG_GODFATHER); + } /* * Parse the configuration into a vdev tree. We explicitly set the @@ -3567,8 +3574,13 @@ spa_create(const char *pool, nvlist_t *n /* * Create "The Godfather" zio to hold all async IOs */ - spa->spa_async_zio_root = zio_root(spa, NULL, NULL, - ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | ZIO_FLAG_GODFATHER); + spa->spa_async_zio_root = kmem_alloc(max_ncpus * sizeof (void *), + KM_SLEEP); + for (int i = 0; i < max_ncpus; i++) { + spa->spa_async_zio_root[i] = zio_root(spa, NULL, NULL, + ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | + ZIO_FLAG_GODFATHER); + } /* * Create the root vdev. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Mon Oct 6 07:01:32 2014 (r272597) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Mon Oct 6 07:03:17 2014 (r272598) @@ -206,7 +206,8 @@ struct spa { uint64_t spa_failmode; /* failure mode for the pool */ uint64_t spa_delegation; /* delegation on/off */ list_t spa_config_list; /* previous cache file(s) */ - zio_t *spa_async_zio_root; /* root of all async I/O */ + /* per-CPU array of root of async I/O: */ + zio_t **spa_async_zio_root; zio_t *spa_suspend_zio_root; /* root of all suspended I/O */ kmutex_t spa_suspend_lock; /* protects suspend_zio_root */ kcondvar_t spa_suspend_cv; /* notification of resume */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Mon Oct 6 07:01:32 2014 (r272597) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Mon Oct 6 07:03:17 2014 (r272598) @@ -1457,7 +1457,7 @@ zio_nowait(zio_t *zio) */ spa_t *spa = zio->io_spa; - zio_add_child(spa->spa_async_zio_root, zio); + zio_add_child(spa->spa_async_zio_root[CPU_SEQID], zio); } zio_execute(zio); From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 07:09:48 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2FD43795; Mon, 6 Oct 2014 07:09:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1C6A6A3C; Mon, 6 Oct 2014 07:09:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9679lGI099667; Mon, 6 Oct 2014 07:09:47 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9679lC5099666; Mon, 6 Oct 2014 07:09:47 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410060709.s9679lC5099666@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 6 Oct 2014 07:09:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272599 - head/cddl/contrib/opensolaris/cmd/zdb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 07:09:48 -0000 Author: delphij Date: Mon Oct 6 07:09:47 2014 New Revision: 272599 URL: https://svnweb.freebsd.org/changeset/base/272599 Log: MFV r272588: Handle old format deadlist. Illumos issue: 5178 zdb -vvvvv on old-format pool fails in dump_deadlist() MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Oct 6 07:03:17 2014 (r272598) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Oct 6 07:09:47 2014 (r272599) @@ -1461,6 +1461,11 @@ dump_deadlist(dsl_deadlist_t *dl) if (dump_opt['d'] < 3) return; + if (dl->dl_oldfmt) { + dump_bpobj(&dl->dl_bpobj, "old-format deadlist", 0); + return; + } + zdb_nicenum(dl->dl_phys->dl_used, bytes); zdb_nicenum(dl->dl_phys->dl_comp, comp); zdb_nicenum(dl->dl_phys->dl_uncomp, uncomp); From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 07:22:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4CD74AEF; Mon, 6 Oct 2014 07:22:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 39FFCBD0; Mon, 6 Oct 2014 07:22:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s967MnmB008311; Mon, 6 Oct 2014 07:22:49 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s967Mnjv008310; Mon, 6 Oct 2014 07:22:49 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410060722.s967Mnjv008310@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 6 Oct 2014 07:22:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272600 - head/sys/fs/devfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 07:22:49 -0000 Author: mjg Date: Mon Oct 6 07:22:48 2014 New Revision: 272600 URL: https://svnweb.freebsd.org/changeset/base/272600 Log: devfs: tidy up after 272596 This moves a var to an if statement, no functional changes. MFC after: 1 week Modified: head/sys/fs/devfs/devfs_vnops.c Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Mon Oct 6 07:09:47 2014 (r272599) +++ head/sys/fs/devfs/devfs_vnops.c Mon Oct 6 07:22:48 2014 (r272600) @@ -545,8 +545,8 @@ devfs_close(struct vop_close_args *ap) * if the reference count is 2 (this last descriptor * plus the session), release the reference from the session. */ - oldvp = NULL; if (td && vp == td->td_proc->p_session->s_ttyvp) { + oldvp = NULL; sx_xlock(&proctree_lock); if (vp == td->td_proc->p_session->s_ttyvp) { SESS_LOCK(td->td_proc->p_session); @@ -561,9 +561,9 @@ devfs_close(struct vop_close_args *ap) SESS_UNLOCK(td->td_proc->p_session); } sx_xunlock(&proctree_lock); + if (oldvp != NULL) + vrele(oldvp); } - if (oldvp != NULL) - vrele(oldvp); /* * We do not want to really close the device if it * is still in use unless we are trying to close it From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 07:29:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BF7E1C87; Mon, 6 Oct 2014 07:29:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A0EBCC06; Mon, 6 Oct 2014 07:29:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s967TIu7009122; Mon, 6 Oct 2014 07:29:18 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s967TIav009120; Mon, 6 Oct 2014 07:29:18 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410060729.s967TIav009120@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 6 Oct 2014 07:29:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272601 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 07:29:18 -0000 Author: delphij Date: Mon Oct 6 07:29:17 2014 New Revision: 272601 URL: https://svnweb.freebsd.org/changeset/base/272601 Log: MFV r272591: Use loaned ARC buffer for zfs receive to avoid copy. Illumos issue: 5162 zfs recv should use loaned arc buffer to avoid copy MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Mon Oct 6 07:22:48 2014 (r272600) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Mon Oct 6 07:29:17 2014 (r272601) @@ -1332,7 +1332,14 @@ dmu_assign_arcbuf(dmu_buf_t *handle, uin rw_exit(&dn->dn_struct_rwlock); DB_DNODE_EXIT(dbuf); - if (offset == db->db.db_offset && blksz == db->db.db_size) { + /* + * We can only assign if the offset is aligned, the arc buf is the + * same size as the dbuf, and the dbuf is not metadata. It + * can't be metadata because the loaned arc buf comes from the + * user-data kmem arena. + */ + if (offset == db->db.db_offset && blksz == db->db.db_size && + DBUF_GET_BUFC_TYPE(db) == ARC_BUFC_DATA) { dbuf_assign_arcbuf(db, buf, tx); dbuf_rele(db, FTAG); } else { Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Mon Oct 6 07:22:48 2014 (r272600) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Mon Oct 6 07:29:17 2014 (r272601) @@ -1273,18 +1273,20 @@ restore_bytes(struct restorearg *ra, voi } static void * -restore_read(struct restorearg *ra, int len) +restore_read(struct restorearg *ra, int len, char *buf) { - void *rv; int done = 0; + if (buf == NULL) + buf = ra->buf; + /* some things will require 8-byte alignment, so everything must */ ASSERT0(len % 8); while (done < len) { ssize_t resid; - ra->err = restore_bytes(ra, (caddr_t)ra->buf + done, + ra->err = restore_bytes(ra, buf + done, len - done, ra->voff, &resid); if (resid == len - done) @@ -1296,12 +1298,11 @@ restore_read(struct restorearg *ra, int } ASSERT3U(done, ==, len); - rv = ra->buf; if (ra->byteswap) - fletcher_4_incremental_byteswap(rv, len, &ra->cksum); + fletcher_4_incremental_byteswap(buf, len, &ra->cksum); else - fletcher_4_incremental_native(rv, len, &ra->cksum); - return (rv); + fletcher_4_incremental_native(buf, len, &ra->cksum); + return (buf); } static void @@ -1416,7 +1417,7 @@ restore_object(struct restorearg *ra, ob return (SET_ERROR(EINVAL)); if (drro->drr_bonuslen) { - data = restore_read(ra, P2ROUNDUP(drro->drr_bonuslen, 8)); + data = restore_read(ra, P2ROUNDUP(drro->drr_bonuslen, 8), NULL); if (ra->err != 0) return (ra->err); } @@ -1513,19 +1514,30 @@ restore_write(struct restorearg *ra, obj !DMU_OT_IS_VALID(drrw->drr_type)) return (SET_ERROR(EINVAL)); - data = restore_read(ra, drrw->drr_length); - if (data == NULL) - return (ra->err); - if (dmu_object_info(os, drrw->drr_object, NULL) != 0) return (SET_ERROR(EINVAL)); + dmu_buf_t *bonus; + if (dmu_bonus_hold(os, drrw->drr_object, FTAG, &bonus) != 0) + return (SET_ERROR(EINVAL)); + + arc_buf_t *abuf = dmu_request_arcbuf(bonus, drrw->drr_length); + + data = restore_read(ra, drrw->drr_length, abuf->b_data); + if (data == NULL) { + dmu_return_arcbuf(abuf); + dmu_buf_rele(bonus, FTAG); + return (ra->err); + } + tx = dmu_tx_create(os); dmu_tx_hold_write(tx, drrw->drr_object, drrw->drr_offset, drrw->drr_length); err = dmu_tx_assign(tx, TXG_WAIT); if (err != 0) { + dmu_return_arcbuf(abuf); + dmu_buf_rele(bonus, FTAG); dmu_tx_abort(tx); return (err); } @@ -1534,9 +1546,9 @@ restore_write(struct restorearg *ra, obj DMU_OT_BYTESWAP(drrw->drr_type); dmu_ot_byteswap[byteswap].ob_func(data, drrw->drr_length); } - dmu_write(os, drrw->drr_object, - drrw->drr_offset, drrw->drr_length, data, tx); + dmu_assign_arcbuf(bonus, drrw->drr_offset, abuf, tx); dmu_tx_commit(tx); + dmu_buf_rele(bonus, FTAG); return (0); } @@ -1618,7 +1630,7 @@ restore_write_embedded(struct restorearg if (drrwnp->drr_compression >= ZIO_COMPRESS_FUNCTIONS) return (EINVAL); - data = restore_read(ra, P2ROUNDUP(drrwnp->drr_psize, 8)); + data = restore_read(ra, P2ROUNDUP(drrwnp->drr_psize, 8), NULL); if (data == NULL) return (ra->err); @@ -1653,7 +1665,7 @@ restore_spill(struct restorearg *ra, obj drrs->drr_length > SPA_MAXBLOCKSIZE) return (SET_ERROR(EINVAL)); - data = restore_read(ra, drrs->drr_length); + data = restore_read(ra, drrs->drr_length, NULL); if (data == NULL) return (ra->err); @@ -1795,7 +1807,7 @@ dmu_recv_stream(dmu_recv_cookie_t *drc, */ pcksum = ra.cksum; while (ra.err == 0 && - NULL != (drr = restore_read(&ra, sizeof (*drr)))) { + NULL != (drr = restore_read(&ra, sizeof (*drr), NULL))) { if (issig(JUSTLOOKING) && issig(FORREAL)) { ra.err = SET_ERROR(EINTR); goto out; From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 09:00:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1F378E76; Mon, 6 Oct 2014 09:00:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0C0898EF; Mon, 6 Oct 2014 09:00:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9690rdv052206; Mon, 6 Oct 2014 09:00:53 GMT (envelope-from ganbold@FreeBSD.org) Received: (from ganbold@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9690rYt052205; Mon, 6 Oct 2014 09:00:53 GMT (envelope-from ganbold@FreeBSD.org) Message-Id: <201410060900.s9690rYt052205@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ganbold set sender to ganbold@FreeBSD.org using -f From: Ganbold Tsagaankhuu Date: Mon, 6 Oct 2014 09:00:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272602 - head/sys/dev/uart X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 09:00:54 -0000 Author: ganbold Date: Mon Oct 6 09:00:53 2014 New Revision: 272602 URL: https://svnweb.freebsd.org/changeset/base/272602 Log: Use documented compat string for msm uart. Whilst here use tab instead of spaces. Approved by: stas (mentor) Modified: head/sys/dev/uart/uart_bus_fdt.c Modified: head/sys/dev/uart/uart_bus_fdt.c ============================================================================== --- head/sys/dev/uart/uart_bus_fdt.c Mon Oct 6 07:29:17 2014 (r272601) +++ head/sys/dev/uart/uart_bus_fdt.c Mon Oct 6 09:00:53 2014 (r272602) @@ -84,7 +84,7 @@ static struct ofw_compat_data compat_dat {"fsl,imx21-uart", (uintptr_t)&uart_imx_class}, {"fsl,mvf600-uart", (uintptr_t)&uart_vybrid_class}, {"lpc,uart", (uintptr_t)&uart_lpc_class}, - {"qcom,uart-dm", (uintptr_t)&uart_msm_class}, + {"qcom,msm-uartdm", (uintptr_t)&uart_msm_class}, {"ti,ns16550", (uintptr_t)&uart_ti8250_class}, {"ns16550", (uintptr_t)&uart_ns8250_class}, {NULL, (uintptr_t)NULL}, From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 09:52:29 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CBF72E4B; Mon, 6 Oct 2014 09:52:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B9A5BEAC; Mon, 6 Oct 2014 09:52:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s969qTV1078732; Mon, 6 Oct 2014 09:52:29 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s969qThS078731; Mon, 6 Oct 2014 09:52:29 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201410060952.s969qThS078731@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 6 Oct 2014 09:52:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272605 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 09:52:29 -0000 Author: andrew Date: Mon Oct 6 09:52:28 2014 New Revision: 272605 URL: https://svnweb.freebsd.org/changeset/base/272605 Log: Disable generating vfp and NEON instructions in the arm kernel. Modified: head/sys/conf/Makefile.arm Modified: head/sys/conf/Makefile.arm ============================================================================== --- head/sys/conf/Makefile.arm Mon Oct 6 09:46:21 2014 (r272604) +++ head/sys/conf/Makefile.arm Mon Oct 6 09:52:28 2014 (r272605) @@ -42,6 +42,9 @@ STRIP_FLAGS = -S # We don't support gcc's thump interwork stuff, so disable it CFLAGS.gcc += -mno-thumb-interwork +# We generally don't want fpu instructions in the kernel. +CFLAGS.clang += -mfpu=none + .if !empty(DDB_ENABLED) CFLAGS += -funwind-tables # clang requires us to tell it to emit assembly with unwind information From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 10:58:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DB703D91; Mon, 6 Oct 2014 10:58:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C874484C; Mon, 6 Oct 2014 10:58:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s96Awsut007883; Mon, 6 Oct 2014 10:58:54 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s96Awstt007882; Mon, 6 Oct 2014 10:58:54 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410061058.s96Awstt007882@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 6 Oct 2014 10:58:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272606 - head/sys/dev/ahci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 10:58:55 -0000 Author: mav Date: Mon Oct 6 10:58:54 2014 New Revision: 272606 URL: https://svnweb.freebsd.org/changeset/base/272606 Log: Use r271207 optimization only for MSI-enabled HBAs. It was found that VirtualBox' AHCI does not allow nterrupt to be cleared before the interrupt status register is read, causing interrupt storm. AHCI specification allows to skip this register use when multi-vector MSI is enabled and so interrupting port is known. For single-vector MSI that is not stated explicitly, but if the port is only one, it is obviously known too. Modified: head/sys/dev/ahci/ahci.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Mon Oct 6 09:52:28 2014 (r272605) +++ head/sys/dev/ahci/ahci.c Mon Oct 6 10:58:54 2014 (r272606) @@ -360,7 +360,7 @@ ahci_setup_interrupt(device_t dev) for (i = 0; i < ctlr->numirqs; i++) { ctlr->irqs[i].ctlr = ctlr; ctlr->irqs[i].r_irq_rid = i + (ctlr->msi ? 1 : 0); - if (ctlr->channels == 1 && !ctlr->ccc) + if (ctlr->channels == 1 && !ctlr->ccc && ctlr->msi) ctlr->irqs[i].mode = AHCI_IRQ_MODE_ONE; else if (ctlr->numirqs == 1 || i >= ctlr->channels || (ctlr->ccc && i == ctlr->cccv)) From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 11:00:48 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3AD98EF0; Mon, 6 Oct 2014 11:00:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2253D8E9; Mon, 6 Oct 2014 11:00:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s96B0lYW010925; Mon, 6 Oct 2014 11:00:47 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s96B0lat010924; Mon, 6 Oct 2014 11:00:47 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201410061100.s96B0lat010924@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Mon, 6 Oct 2014 11:00:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272607 - head/sbin/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 11:00:48 -0000 Author: melifaro Date: Mon Oct 6 11:00:47 2014 New Revision: 272607 URL: https://svnweb.freebsd.org/changeset/base/272607 Log: Improve "reserved keywords" hack: we can't easily predict (in current parsing model) if the keyword is ipfw(8) reserved keyword or port name. Checking proto database via getprotobyname() consumes a lot of CPU and leads to tens of seconds for parsing large ruleset. Use list of reserved keywords and check them as pre-requisite before doing getprotobyname(). Obtained from: Yandex LLC Modified: head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Mon Oct 6 10:58:54 2014 (r272606) +++ head/sbin/ipfw/ipfw2.c Mon Oct 6 11:00:47 2014 (r272607) @@ -2904,13 +2904,34 @@ add_dstip(ipfw_insn *cmd, char *av, int return cmd; } +static struct _s_x f_reserved_keywords[] = { + { "altq", TOK_OR }, + { "//", TOK_OR }, + { "diverted", TOK_OR }, + { "dst-port", TOK_OR }, + { "src-port", TOK_OR }, + { "established", TOK_OR }, + { "keep-state", TOK_OR }, + { "frag", TOK_OR }, + { "icmptypes", TOK_OR }, + { "in", TOK_OR }, + { "out", TOK_OR }, + { "ip6", TOK_OR }, + { "any", TOK_OR }, + { "to", TOK_OR }, + { "via", TOK_OR }, + { "{", TOK_OR }, + { NULL, 0 } /* terminator */ +}; + static ipfw_insn * add_ports(ipfw_insn *cmd, char *av, u_char proto, int opcode, int cblen) { - /* XXX "any" is trapped before. Perhaps "to" */ - if (_substrcmp(av, "any") == 0) { - return NULL; - } else if (fill_newports((ipfw_insn_u16 *)cmd, av, proto, cblen)) { + + if (match_token(f_reserved_keywords, av) != -1) + return (NULL); + + if (fill_newports((ipfw_insn_u16 *)cmd, av, proto, cblen)) { /* XXX todo: check that we have a protocol with ports */ cmd->opcode = opcode; return cmd; From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 11:15:12 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AF0D2704; Mon, 6 Oct 2014 11:15:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9BBF8A21; Mon, 6 Oct 2014 11:15:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s96BFC9f017309; Mon, 6 Oct 2014 11:15:12 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s96BFCmj017308; Mon, 6 Oct 2014 11:15:12 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201410061115.s96BFCmj017308@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Mon, 6 Oct 2014 11:15:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272609 - head/sys/netpfil/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 11:15:12 -0000 Author: melifaro Date: Mon Oct 6 11:15:11 2014 New Revision: 272609 URL: https://svnweb.freebsd.org/changeset/base/272609 Log: Fix O_TCPOPTS processing. Obtained from: luigi Modified: head/sys/netpfil/ipfw/ip_fw2.c Modified: head/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw2.c Mon Oct 6 11:05:56 2014 (r272608) +++ head/sys/netpfil/ipfw/ip_fw2.c Mon Oct 6 11:15:11 2014 (r272609) @@ -1722,9 +1722,13 @@ do { \ break; case O_TCPOPTS: - PULLUP_LEN(hlen, ulp, (TCP(ulp)->th_off << 2)); - match = (proto == IPPROTO_TCP && offset == 0 && - tcpopts_match(TCP(ulp), cmd)); + if (proto == IPPROTO_TCP && ulp != NULL) { + PULLUP_LEN(hlen, ulp, + (TCP(ulp)->th_off << 2)); + match = (proto == IPPROTO_TCP && + offset == 0 && + tcpopts_match(TCP(ulp), cmd)); + } break; case O_TCPSEQ: From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 12:20:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4F8AC709; Mon, 6 Oct 2014 12:20:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2FECD1B8; Mon, 6 Oct 2014 12:20:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s96CKlFZ046837; Mon, 6 Oct 2014 12:20:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s96CKkqn046835; Mon, 6 Oct 2014 12:20:46 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410061220.s96CKkqn046835@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 6 Oct 2014 12:20:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272613 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 12:20:47 -0000 Author: mav Date: Mon Oct 6 12:20:46 2014 New Revision: 272613 URL: https://svnweb.freebsd.org/changeset/base/272613 Log: Add support for MaxBurstLength and Expected Data transfer Length parameters. Before this change target could send R2T request for write transfer of any size, that could violate iSCSI RFC, which allows initiator to limit maximum R2T size by negotiating MaxBurstLength connection parameter. Also report an error in case of write underflow, when initiator provides less data than initiator expects. Previously in such case our target sent R2T request for non-existing data, violating the RFC, and confusing some initiators. SCSI specs don't explicitly define how write underflows should be handled and there are different oppinions, but reporting error is hopefully better then violating iSCSI RFC with unpredictable results. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c head/sys/cam/ctl/ctl_frontend_iscsi.h Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- head/sys/cam/ctl/ctl_frontend_iscsi.c Mon Oct 6 12:08:47 2014 (r272612) +++ head/sys/cam/ctl/ctl_frontend_iscsi.c Mon Oct 6 12:20:46 2014 (r272613) @@ -154,6 +154,8 @@ static uint32_t cfiscsi_lun_map(void *ar static int cfiscsi_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td); static void cfiscsi_datamove(union ctl_io *io); +static void cfiscsi_datamove_in(union ctl_io *io); +static void cfiscsi_datamove_out(union ctl_io *io); static void cfiscsi_done(union ctl_io *io); static bool cfiscsi_pdu_update_cmdsn(const struct icl_pdu *request); static void cfiscsi_pdu_handle_nop_out(struct icl_pdu *request); @@ -824,7 +826,7 @@ cfiscsi_handle_data_segment(struct icl_p return (true); } - if (io->scsiio.ext_data_filled == io->scsiio.kern_data_len && + if (io->scsiio.ext_data_filled == cdw->cdw_r2t_end && (bhsdo->bhsdo_flags & BHSDO_FLAGS_F) == 0) { CFISCSI_SESSION_WARN(cs, "got the final packet without " "the F flag; flags = 0x%x; dropping connection", @@ -834,7 +836,7 @@ cfiscsi_handle_data_segment(struct icl_p return (true); } - if (io->scsiio.ext_data_filled != io->scsiio.kern_data_len && + if (io->scsiio.ext_data_filled != cdw->cdw_r2t_end && (bhsdo->bhsdo_flags & BHSDO_FLAGS_F) != 0) { if ((request->ip_bhs->bhs_opcode & ~ISCSI_BHS_OPCODE_IMMEDIATE) == ISCSI_BHS_OPCODE_SCSI_DATA_OUT) { @@ -842,7 +844,7 @@ cfiscsi_handle_data_segment(struct icl_p "transmitted size was %zd bytes instead of %d; " "dropping connection", (size_t)io->scsiio.ext_data_filled, - io->scsiio.kern_data_len); + cdw->cdw_r2t_end); ctl_set_data_phase_error(&io->scsiio); cfiscsi_session_terminate(cs); return (true); @@ -855,7 +857,7 @@ cfiscsi_handle_data_segment(struct icl_p } } - if (io->scsiio.ext_data_filled == io->scsiio.kern_data_len) { + if (io->scsiio.ext_data_filled == cdw->cdw_r2t_end) { #if 0 CFISCSI_SESSION_DEBUG(cs, "no longer expecting Data-Out with target " "transfer tag 0x%x", cdw->cdw_target_transfer_tag); @@ -911,8 +913,13 @@ cfiscsi_pdu_handle_data_out(struct icl_p CFISCSI_SESSION_LOCK(cs); TAILQ_REMOVE(&cs->cs_waiting_for_data_out, cdw, cdw_next); CFISCSI_SESSION_UNLOCK(cs); + done = (io->scsiio.ext_data_filled != cdw->cdw_r2t_end || + io->scsiio.ext_data_filled == io->scsiio.kern_data_len); uma_zfree(cfiscsi_data_wait_zone, cdw); - io->scsiio.be_move_done(io); + if (done) + io->scsiio.be_move_done(io); + else + cfiscsi_datamove_out(io); } icl_pdu_free(request); @@ -2567,6 +2574,8 @@ cfiscsi_datamove_out(union ctl_io *io) const struct iscsi_bhs_scsi_command *bhssc; struct iscsi_bhs_r2t *bhsr2t; struct cfiscsi_data_wait *cdw; + struct ctl_sg_entry ctl_sg_entry, *ctl_sglist; + uint32_t expected_len, r2t_off, r2t_len; uint32_t target_transfer_tag; bool done; @@ -2585,9 +2594,16 @@ cfiscsi_datamove_out(union ctl_io *io) PDU_TOTAL_TRANSFER_LEN(request) = io->scsiio.kern_total_len; /* - * We hadn't received anything during this datamove yet. + * Report write underflow as error since CTL and backends don't + * really support it, and SCSI does not tell how to do it right. */ - io->scsiio.ext_data_filled = 0; + expected_len = ntohl(bhssc->bhssc_expected_data_transfer_length); + if (io->scsiio.kern_rel_offset + io->scsiio.kern_data_len > + expected_len) { + io->scsiio.io_hdr.port_status = 43; + io->scsiio.be_move_done(io); + return; + } target_transfer_tag = atomic_fetchadd_32(&cs->cs_target_transfer_tag, 1); @@ -2609,8 +2625,35 @@ cfiscsi_datamove_out(union ctl_io *io) cdw->cdw_ctl_io = io; cdw->cdw_target_transfer_tag = target_transfer_tag; cdw->cdw_initiator_task_tag = bhssc->bhssc_initiator_task_tag; + cdw->cdw_r2t_end = io->scsiio.kern_data_len; + + /* Set initial data pointer for the CDW respecting ext_data_filled. */ + if (io->scsiio.kern_sg_entries > 0) { + ctl_sglist = (struct ctl_sg_entry *)io->scsiio.kern_data_ptr; + } else { + ctl_sglist = &ctl_sg_entry; + ctl_sglist->addr = io->scsiio.kern_data_ptr; + ctl_sglist->len = io->scsiio.kern_data_len; + } + cdw->cdw_sg_index = 0; + cdw->cdw_sg_addr = ctl_sglist[cdw->cdw_sg_index].addr; + cdw->cdw_sg_len = ctl_sglist[cdw->cdw_sg_index].len; + r2t_off = io->scsiio.ext_data_filled; + while (r2t_off > 0) { + if (r2t_off >= cdw->cdw_sg_len) { + r2t_off -= cdw->cdw_sg_len; + cdw->cdw_sg_index++; + cdw->cdw_sg_addr = ctl_sglist[cdw->cdw_sg_index].addr; + cdw->cdw_sg_len = ctl_sglist[cdw->cdw_sg_index].len; + continue; + } + cdw->cdw_sg_addr += r2t_off; + cdw->cdw_sg_len -= r2t_off; + r2t_off = 0; + } - if (cs->cs_immediate_data && io->scsiio.kern_rel_offset < + if (cs->cs_immediate_data && + io->scsiio.kern_rel_offset + io->scsiio.ext_data_filled < icl_pdu_data_segment_length(request)) { done = cfiscsi_handle_data_segment(request, cdw); if (done) { @@ -2620,6 +2663,11 @@ cfiscsi_datamove_out(union ctl_io *io) } } + r2t_off = io->scsiio.kern_rel_offset + io->scsiio.ext_data_filled; + r2t_len = MIN(io->scsiio.kern_data_len - io->scsiio.ext_data_filled, + cs->cs_max_burst_length); + cdw->cdw_r2t_end = io->scsiio.ext_data_filled + r2t_len; + CFISCSI_SESSION_LOCK(cs); TAILQ_INSERT_TAIL(&cs->cs_waiting_for_data_out, cdw, cdw_next); CFISCSI_SESSION_UNLOCK(cs); @@ -2659,16 +2707,13 @@ cfiscsi_datamove_out(union ctl_io *io) * The ext_data_filled is to account for unsolicited * (immediate) data that might have already arrived. */ - bhsr2t->bhsr2t_buffer_offset = - htonl(io->scsiio.kern_rel_offset + io->scsiio.ext_data_filled); + bhsr2t->bhsr2t_buffer_offset = htonl(r2t_off); /* * This is the total length (sum of S/G lengths) this call - * to cfiscsi_datamove() is supposed to handle. - * - * XXX: Limit it to MaxBurstLength. + * to cfiscsi_datamove() is supposed to handle, limited by + * MaxBurstLength. */ - bhsr2t->bhsr2t_desired_data_transfer_length = - htonl(io->scsiio.kern_data_len - io->scsiio.ext_data_filled); + bhsr2t->bhsr2t_desired_data_transfer_length = htonl(r2t_len); cfiscsi_pdu_queue(response); } @@ -2678,8 +2723,11 @@ cfiscsi_datamove(union ctl_io *io) if ((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_IN) cfiscsi_datamove_in(io); - else + else { + /* We hadn't received anything during this datamove yet. */ + io->scsiio.ext_data_filled = 0; cfiscsi_datamove_out(io); + } } static void Modified: head/sys/cam/ctl/ctl_frontend_iscsi.h ============================================================================== --- head/sys/cam/ctl/ctl_frontend_iscsi.h Mon Oct 6 12:08:47 2014 (r272612) +++ head/sys/cam/ctl/ctl_frontend_iscsi.h Mon Oct 6 12:20:46 2014 (r272613) @@ -56,6 +56,7 @@ struct cfiscsi_data_wait { int cdw_sg_index; char *cdw_sg_addr; size_t cdw_sg_len; + uint32_t cdw_r2t_end; }; #define CFISCSI_SESSION_STATE_INVALID 0 From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 12:29:07 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C8C848C8; Mon, 6 Oct 2014 12:29:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B480C200; Mon, 6 Oct 2014 12:29:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s96CT7Iv050761; Mon, 6 Oct 2014 12:29:07 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s96CT7gZ050760; Mon, 6 Oct 2014 12:29:07 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201410061229.s96CT7gZ050760@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Mon, 6 Oct 2014 12:29:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272614 - head/sys/netpfil/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 12:29:07 -0000 Author: melifaro Date: Mon Oct 6 12:29:06 2014 New Revision: 272614 URL: https://svnweb.freebsd.org/changeset/base/272614 Log: Improve r272609 (O_TCPOPTS). MFC after: 3 dayes Modified: head/sys/netpfil/ipfw/ip_fw2.c Modified: head/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw2.c Mon Oct 6 12:20:46 2014 (r272613) +++ head/sys/netpfil/ipfw/ip_fw2.c Mon Oct 6 12:29:06 2014 (r272614) @@ -1722,12 +1722,10 @@ do { \ break; case O_TCPOPTS: - if (proto == IPPROTO_TCP && ulp != NULL) { + if (proto == IPPROTO_TCP && offset == 0 && ulp){ PULLUP_LEN(hlen, ulp, (TCP(ulp)->th_off << 2)); - match = (proto == IPPROTO_TCP && - offset == 0 && - tcpopts_match(TCP(ulp), cmd)); + match = tcpopts_match(TCP(ulp), cmd); } break; From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 14:43:03 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CBC2E5D6; Mon, 6 Oct 2014 14:43:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D46C641; Mon, 6 Oct 2014 14:43:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s96Eh3UY022722; Mon, 6 Oct 2014 14:43:03 GMT (envelope-from rodrigc@FreeBSD.org) Received: (from rodrigc@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s96Eh2Jn022718; Mon, 6 Oct 2014 14:43:02 GMT (envelope-from rodrigc@FreeBSD.org) Message-Id: <201410061443.s96Eh2Jn022718@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rodrigc set sender to rodrigc@FreeBSD.org using -f From: Craig Rodrigues Date: Mon, 6 Oct 2014 14:43:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272649 - head/contrib/byacc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 14:43:03 -0000 Author: rodrigc Date: Mon Oct 6 14:43:02 2014 New Revision: 272649 URL: https://svnweb.freebsd.org/changeset/base/272649 Log: MFV: use calloc in get_line() when allocating line to ensure it is fully initialized, fixes a later uninitialized value in copy_param() (FreeBSD #193499). PR: 193499 Submitted by: Thomas E. Dickey Modified: head/contrib/byacc/CHANGES head/contrib/byacc/defs.h head/contrib/byacc/reader.c Modified: head/contrib/byacc/CHANGES ============================================================================== --- head/contrib/byacc/CHANGES Mon Oct 6 14:39:45 2014 (r272648) +++ head/contrib/byacc/CHANGES Mon Oct 6 14:43:02 2014 (r272649) @@ -1,3 +1,9 @@ +2014-10-02 Thomas E. Dickey + + * reader.c, defs.h: + use calloc in get_line() when allocating line to ensure it is fully initialized, + fixes a later uninitialized value in copy_param() (FreeBSD #193499). + 2014-07-15 Thomas E. Dickey * aclocal.m4: resync with my-autoconf (no change to configure script) Modified: head/contrib/byacc/defs.h ============================================================================== --- head/contrib/byacc/defs.h Mon Oct 6 14:39:45 2014 (r272648) +++ head/contrib/byacc/defs.h Mon Oct 6 14:43:02 2014 (r272649) @@ -157,6 +157,7 @@ #define CALLOC(k,n) (calloc((size_t)(k),(size_t)(n))) #define FREE(x) (free((char*)(x))) #define MALLOC(n) (malloc((size_t)(n))) +#define TCMALLOC(t,n) ((t*) calloc((size_t)(n), sizeof(t))) #define TMALLOC(t,n) ((t*) malloc((size_t)(n) * sizeof(t))) #define NEW(t) ((t*)allocate(sizeof(t))) #define NEW2(n,t) ((t*)allocate(((size_t)(n)*sizeof(t)))) Modified: head/contrib/byacc/reader.c ============================================================================== --- head/contrib/byacc/reader.c Mon Oct 6 14:39:45 2014 (r272648) +++ head/contrib/byacc/reader.c Mon Oct 6 14:43:02 2014 (r272649) @@ -125,7 +125,7 @@ get_line(void) if (line) FREE(line); linesize = LINESIZE + 1; - line = TMALLOC(char, linesize); + line = TCMALLOC(char, linesize); NO_SPACE(line); } From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 14:49:30 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B0647A62; Mon, 6 Oct 2014 14:49:30 +0000 (UTC) Received: from mail-wg0-x234.google.com (mail-wg0-x234.google.com [IPv6:2a00:1450:400c:c00::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C556B6D9; Mon, 6 Oct 2014 14:49:29 +0000 (UTC) Received: by mail-wg0-f52.google.com with SMTP id a1so6732843wgh.35 for ; Mon, 06 Oct 2014 07:49:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=YXSZsdWYDnZtf2OpePdjtQKLQRvhKSw7ZUL63pYU/fs=; b=itV8OoxIekPN/rpo/iS7+8stWiga3z2n2RM62FSDPCg9l/0jB2L6qG65GdhF98GVzP usbscI7uc8rA5ieWGRMJTlZhM/urHe5xeWjJkgv76Es8iG5WNLCKpPQExZ+a+zOJBloe nM3OqcSQJ4w0zh1iHkpZ8oBc7hT7N3xiTY/rSRoGE0/Q0ctBDQEi+Gyv6H24KkSRw3my xqxMg8q3jT1s6AjOhQ4vh/t5jROKcwaYxo2JiDUzWrOgTFubx3NRChQnVDEcT3zUA9m+ pFO8x2BWtnQkGfeLlEXFCRihHXxMmL+NYlSnme9QuO0c65jNhT3urerju6lc7QCSEBuy qHww== X-Received: by 10.194.60.51 with SMTP id e19mr31008546wjr.65.1412606968089; Mon, 06 Oct 2014 07:49:28 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by mx.google.com with ESMTPSA id ma8sm17507557wjb.46.2014.10.06.07.49.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Oct 2014 07:49:27 -0700 (PDT) Sender: Baptiste Daroussin Date: Mon, 6 Oct 2014 16:49:24 +0200 From: Baptiste Daroussin To: Craig Rodrigues Subject: Re: svn commit: r272649 - head/contrib/byacc Message-ID: <20141006144924.GB37670@ivaldir.etoilebsd.net> References: <201410061443.s96Eh2Jn022718@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Izn7cH1Com+I3R9J" Content-Disposition: inline In-Reply-To: <201410061443.s96Eh2Jn022718@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 14:49:30 -0000 --Izn7cH1Com+I3R9J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 06, 2014 at 02:43:02PM +0000, Craig Rodrigues wrote: > Author: rodrigc > Date: Mon Oct 6 14:43:02 2014 > New Revision: 272649 > URL: https://svnweb.freebsd.org/changeset/base/272649 >=20 > Log: > MFV: > use calloc in get_line() when allocating line to ensure it is fully in= itialized, > fixes a later uninitialized value in copy_param() (FreeBSD #193499). > =20 > PR: 193499 > Submitted by: Thomas E. Dickey >=20 Why a direct commit instead of a proper import of 20141005 version? it would have imho been better, simpler and easier to maintain. regards, Bapt --Izn7cH1Com+I3R9J Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlQyq/QACgkQ8kTtMUmk6EzYcwCfQpwUkP9F/lRoDWbnMcm7ClqM aDIAn0wPe78Uk5S81SBzPprKmJ8ezvYe =8MYB -----END PGP SIGNATURE----- --Izn7cH1Com+I3R9J-- From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 14:52:05 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C26B9CA9; Mon, 6 Oct 2014 14:52:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ADFBC808; Mon, 6 Oct 2014 14:52:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s96Eq5w8027479; Mon, 6 Oct 2014 14:52:05 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s96Eq5oH027478; Mon, 6 Oct 2014 14:52:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410061452.s96Eq5oH027478@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 6 Oct 2014 14:52:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272650 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 14:52:05 -0000 Author: mav Date: Mon Oct 6 14:52:04 2014 New Revision: 272650 URL: https://svnweb.freebsd.org/changeset/base/272650 Log: Set CAM_SIM_QUEUED flag before calling ctl_queue() to avoid race. PR: 194128 Submitted by: Scott M. Ferris MFC after: 3 days Sponsored by: EMC/Isilon Storage Division Modified: head/sys/cam/ctl/ctl_frontend_cam_sim.c Modified: head/sys/cam/ctl/ctl_frontend_cam_sim.c ============================================================================== --- head/sys/cam/ctl/ctl_frontend_cam_sim.c Mon Oct 6 14:43:02 2014 (r272649) +++ head/sys/cam/ctl/ctl_frontend_cam_sim.c Mon Oct 6 14:52:04 2014 (r272650) @@ -609,14 +609,16 @@ cfcs_action(struct cam_sim *sim, union c bcopy(csio->cdb_io.cdb_bytes, io->scsiio.cdb, io->scsiio.cdb_len); + ccb->ccb_h.status |= CAM_SIM_QUEUED; err = ctl_queue(io); if (err != CTL_RETVAL_COMPLETE) { printf("%s: func %d: error %d returned by " "ctl_queue()!\n", __func__, ccb->ccb_h.func_code, err); ctl_free_io(io); - } else { - ccb->ccb_h.status |= CAM_SIM_QUEUED; + ccb->ccb_h.status = CAM_REQ_INVALID; + xpt_done(ccb); + return; } break; } From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 15:03:09 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ACEFF552; Mon, 6 Oct 2014 15:03:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 98E2A969; Mon, 6 Oct 2014 15:03:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s96F39dC032798; Mon, 6 Oct 2014 15:03:09 GMT (envelope-from luigi@FreeBSD.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s96F39cm032797; Mon, 6 Oct 2014 15:03:09 GMT (envelope-from luigi@FreeBSD.org) Message-Id: <201410061503.s96F39cm032797@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: luigi set sender to luigi@FreeBSD.org using -f From: Luigi Rizzo Date: Mon, 6 Oct 2014 15:03:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272653 - head/contrib/tcpdump X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 15:03:09 -0000 Author: luigi Date: Mon Oct 6 15:03:08 2014 New Revision: 272653 URL: https://svnweb.freebsd.org/changeset/base/272653 Log: Fix comment and sort rights by name MFC after: 3 days Modified: head/contrib/tcpdump/tcpdump.c Modified: head/contrib/tcpdump/tcpdump.c ============================================================================== --- head/contrib/tcpdump/tcpdump.c Mon Oct 6 14:57:26 2014 (r272652) +++ head/contrib/tcpdump/tcpdump.c Mon Oct 6 15:03:08 2014 (r272653) @@ -1534,11 +1534,11 @@ main(int argc, char **argv) static const unsigned long cmds[] = { BIOCGSTATS }; /* - * the various libpcap devices use a combination of - * read (bpf), ioctl (bpf, netmap), poll (netmap) - * so we add the relevant access rights. + * The various libpcap devices use a combination of + * read (bpf), ioctl (bpf, netmap), poll (netmap). + * Grant the relevant access rights, sorted by name. */ - cap_rights_init(&rights, CAP_IOCTL, CAP_READ, CAP_EVENT); + cap_rights_init(&rights, CAP_EVENT, CAP_IOCTL, CAP_READ); if (cap_rights_limit(pcap_fileno(pd), &rights) < 0 && errno != ENOSYS) { error("unable to limit pcap descriptor"); From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 15:13:02 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7E4C393F; Mon, 6 Oct 2014 15:13:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 666C7A94; Mon, 6 Oct 2014 15:13:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s96FD2xp037977; Mon, 6 Oct 2014 15:13:02 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s96FD0pu037956; Mon, 6 Oct 2014 15:13:00 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410061513.s96FD0pu037956@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Mon, 6 Oct 2014 15:13:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272655 - in head/contrib/byacc: . package package/debian package/pkgsrc test test/btyacc test/yacc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 15:13:02 -0000 Author: bapt Date: Mon Oct 6 15:12:59 2014 New Revision: 272655 URL: https://svnweb.freebsd.org/changeset/base/272655 Log: Import byacc 20141005 from vendor Added: head/contrib/byacc/test/btyacc/btyacc_demo2.error - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_demo2.error head/contrib/byacc/test/btyacc/btyacc_demo2.output - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_demo2.output head/contrib/byacc/test/btyacc/btyacc_demo2.tab.c - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_demo2.tab.c head/contrib/byacc/test/btyacc/btyacc_demo2.tab.h - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_demo2.tab.h head/contrib/byacc/test/btyacc/btyacc_destroy1.error - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_destroy1.error head/contrib/byacc/test/btyacc/btyacc_destroy1.output - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_destroy1.output head/contrib/byacc/test/btyacc/btyacc_destroy1.tab.c - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_destroy1.tab.c head/contrib/byacc/test/btyacc/btyacc_destroy1.tab.h - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_destroy1.tab.h head/contrib/byacc/test/btyacc/btyacc_destroy2.error - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_destroy2.error head/contrib/byacc/test/btyacc/btyacc_destroy2.output - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_destroy2.output head/contrib/byacc/test/btyacc/btyacc_destroy2.tab.c - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_destroy2.tab.c head/contrib/byacc/test/btyacc/btyacc_destroy2.tab.h - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_destroy2.tab.h head/contrib/byacc/test/btyacc/btyacc_destroy3.error - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_destroy3.error head/contrib/byacc/test/btyacc/btyacc_destroy3.output - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_destroy3.output head/contrib/byacc/test/btyacc/btyacc_destroy3.tab.c - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_destroy3.tab.c head/contrib/byacc/test/btyacc/btyacc_destroy3.tab.h - copied unchanged from r272652, vendor/byacc/dist/test/btyacc/btyacc_destroy3.tab.h head/contrib/byacc/test/btyacc_destroy1.y - copied unchanged from r272652, vendor/byacc/dist/test/btyacc_destroy1.y head/contrib/byacc/test/btyacc_destroy2.y - copied unchanged from r272652, vendor/byacc/dist/test/btyacc_destroy2.y head/contrib/byacc/test/btyacc_destroy3.y - copied unchanged from r272652, vendor/byacc/dist/test/btyacc_destroy3.y Modified: head/contrib/byacc/CHANGES head/contrib/byacc/MANIFEST head/contrib/byacc/VERSION head/contrib/byacc/aclocal.m4 head/contrib/byacc/btyaccpar.c head/contrib/byacc/closure.c head/contrib/byacc/config.sub head/contrib/byacc/configure head/contrib/byacc/defs.h head/contrib/byacc/lalr.c head/contrib/byacc/main.c head/contrib/byacc/output.c head/contrib/byacc/package/byacc.spec head/contrib/byacc/package/debian/changelog head/contrib/byacc/package/mingw-byacc.spec head/contrib/byacc/package/pkgsrc/Makefile head/contrib/byacc/reader.c head/contrib/byacc/test/btyacc/btyacc_calc1.tab.c head/contrib/byacc/test/btyacc/btyacc_demo.tab.c head/contrib/byacc/test/btyacc/calc.tab.c head/contrib/byacc/test/btyacc/calc1.tab.c head/contrib/byacc/test/btyacc/calc2.tab.c head/contrib/byacc/test/btyacc/calc3.tab.c head/contrib/byacc/test/btyacc/code_calc.code.c head/contrib/byacc/test/btyacc/code_calc.tab.c head/contrib/byacc/test/btyacc/code_error.code.c head/contrib/byacc/test/btyacc/code_error.tab.c head/contrib/byacc/test/btyacc/empty.tab.c head/contrib/byacc/test/btyacc/err_inherit1.tab.c head/contrib/byacc/test/btyacc/err_inherit2.tab.c head/contrib/byacc/test/btyacc/err_inherit3.tab.c head/contrib/byacc/test/btyacc/err_inherit4.tab.c head/contrib/byacc/test/btyacc/err_inherit5.tab.c head/contrib/byacc/test/btyacc/err_syntax1.tab.c head/contrib/byacc/test/btyacc/err_syntax10.tab.c head/contrib/byacc/test/btyacc/err_syntax11.tab.c head/contrib/byacc/test/btyacc/err_syntax12.tab.c head/contrib/byacc/test/btyacc/err_syntax13.tab.c head/contrib/byacc/test/btyacc/err_syntax14.tab.c head/contrib/byacc/test/btyacc/err_syntax15.tab.c head/contrib/byacc/test/btyacc/err_syntax16.tab.c head/contrib/byacc/test/btyacc/err_syntax17.tab.c head/contrib/byacc/test/btyacc/err_syntax18.tab.c head/contrib/byacc/test/btyacc/err_syntax19.tab.c head/contrib/byacc/test/btyacc/err_syntax2.tab.c head/contrib/byacc/test/btyacc/err_syntax20.tab.c head/contrib/byacc/test/btyacc/err_syntax21.tab.c head/contrib/byacc/test/btyacc/err_syntax22.tab.c head/contrib/byacc/test/btyacc/err_syntax23.tab.c head/contrib/byacc/test/btyacc/err_syntax24.tab.c head/contrib/byacc/test/btyacc/err_syntax25.tab.c head/contrib/byacc/test/btyacc/err_syntax26.tab.c head/contrib/byacc/test/btyacc/err_syntax27.tab.c head/contrib/byacc/test/btyacc/err_syntax3.tab.c head/contrib/byacc/test/btyacc/err_syntax4.tab.c head/contrib/byacc/test/btyacc/err_syntax5.tab.c head/contrib/byacc/test/btyacc/err_syntax6.tab.c head/contrib/byacc/test/btyacc/err_syntax7.tab.c head/contrib/byacc/test/btyacc/err_syntax7a.tab.c head/contrib/byacc/test/btyacc/err_syntax7b.tab.c head/contrib/byacc/test/btyacc/err_syntax8.tab.c head/contrib/byacc/test/btyacc/err_syntax8a.tab.c head/contrib/byacc/test/btyacc/err_syntax9.tab.c head/contrib/byacc/test/btyacc/error.tab.c head/contrib/byacc/test/btyacc/grammar.tab.c head/contrib/byacc/test/btyacc/inherit0.tab.c head/contrib/byacc/test/btyacc/inherit1.tab.c head/contrib/byacc/test/btyacc/inherit2.tab.c head/contrib/byacc/test/btyacc/ok_syntax1.tab.c head/contrib/byacc/test/btyacc/pure_calc.tab.c head/contrib/byacc/test/btyacc/pure_error.tab.c head/contrib/byacc/test/btyacc/quote_calc-s.tab.c head/contrib/byacc/test/btyacc/quote_calc.tab.c head/contrib/byacc/test/btyacc/quote_calc2-s.tab.c head/contrib/byacc/test/btyacc/quote_calc2.tab.c head/contrib/byacc/test/btyacc/quote_calc3-s.tab.c head/contrib/byacc/test/btyacc/quote_calc3.tab.c head/contrib/byacc/test/btyacc/quote_calc4-s.tab.c head/contrib/byacc/test/btyacc/quote_calc4.tab.c head/contrib/byacc/test/btyacc/rename_debug.c head/contrib/byacc/test/btyacc/varsyntax_calc1.tab.c head/contrib/byacc/test/yacc/calc2.tab.c head/contrib/byacc/test/yacc/calc3.tab.c head/contrib/byacc/test/yacc/ok_syntax1.tab.c head/contrib/byacc/yacc.1 Directory Properties: head/contrib/byacc/ (props changed) Modified: head/contrib/byacc/CHANGES ============================================================================== --- head/contrib/byacc/CHANGES Mon Oct 6 15:11:08 2014 (r272654) +++ head/contrib/byacc/CHANGES Mon Oct 6 15:12:59 2014 (r272655) @@ -1,9 +1,125 @@ +2014-10-05 Thomas E. Dickey + + * main.c: + make change to umask before calling mkstemp, as suggested in Coverity #56902 + + * reader.c: + adjust logic in copy_action to avoid potential null-pointer dereference + (Coverity #56901) + + * reader.c: + adjust logic to avoid potential null-pointer dereference in compile_args + (Coverity #63407) + + * reader.c: eliminate strcpy into fixed-size buffer (Coverity #63408) + + * yacc.1: document changes made with respect to %parse-param + + * output.c: + add parameters from %parse-param to destructor. The order of the parameters + is intentionally inconsistent with yyparse/yyerror, for "compatibility" with + bison. + + * test/btyacc/btyacc_destroy1.tab.c, test/btyacc/btyacc_destroy2.tab.c, test/btyacc/btyacc_destroy3.tab.c: + regen + + * output.c: + use puts_param_types/puts_param_names to output lex_param data. + + * test/btyacc/ok_syntax1.tab.c, test/btyacc/calc2.tab.c, test/btyacc/calc3.tab.c, test/yacc/ok_syntax1.tab.c, test/yacc/calc2.tab.c, test/yacc/calc3.tab.c, test/btyacc/error.tab.c, test/btyacc/grammar.tab.c, test/btyacc/inherit0.tab.c, test/btyacc/inherit1.tab.c, test/btyacc/inherit2.tab.c, test/btyacc/pure_calc.tab.c, test/btyacc/pure_error.tab.c, test/btyacc/quote_calc-s.tab.c, test/btyacc/quote_calc.tab.c, test/btyacc/quote_calc2-s.tab.c, test/btyacc/quote_calc2.tab.c, test/btyacc/quote_calc3-s.tab.c, test/btyacc/quote_calc3.tab.c, test/btyacc/quote_calc4-s.tab.c, test/btyacc/quote_calc4.tab.c, test/btyacc/varsyntax_calc1.tab.c, test/btyacc/btyacc_calc1.tab.c, test/btyacc/btyacc_demo.tab.c, test/btyacc/calc.tab.c, test/btyacc/calc1.tab.c, test/btyacc/code_calc.code.c, test/btyacc/code_error.code.c, test/btyacc/empty.tab.c, test/btyacc/err_inherit3.tab.c, test/btyacc/err_inherit4.tab.c, test/btyacc/err_syntax10.tab.c, test/btyacc/err_syntax11.tab.c, test/btyacc/err_syntax12.tab.c , test/btyacc/err_syntax18.tab.c, test/btyacc/err_syntax20.tab.c, test/btyacc/rename_debug.c: + regen + + * btyaccpar.c: add casts, change types to fix strict compiler warnings + + * test/btyacc/err_syntax17.tab.c, test/btyacc/err_syntax19.tab.c, test/btyacc/err_syntax2.tab.c, test/btyacc/err_syntax21.tab.c, test/btyacc/err_syntax22.tab.c, test/btyacc/err_syntax23.tab.c, test/btyacc/err_syntax24.tab.c, test/btyacc/err_syntax25.tab.c, test/btyacc/err_syntax26.tab.c, test/btyacc/err_syntax27.tab.c, test/btyacc/err_syntax3.tab.c, test/btyacc/err_syntax4.tab.c, test/btyacc/err_syntax5.tab.c, test/btyacc/err_syntax6.tab.c, test/btyacc/err_syntax7.tab.c, test/btyacc/err_syntax7a.tab.c, test/btyacc/err_syntax7b.tab.c, test/btyacc/err_syntax8.tab.c, test/btyacc/err_syntax8a.tab.c, test/btyacc/err_syntax9.tab.c, test/btyacc/err_inherit1.tab.c, test/btyacc/err_inherit2.tab.c, test/btyacc/err_inherit5.tab.c, test/btyacc/err_syntax1.tab.c, test/btyacc/err_syntax13.tab.c, test/btyacc/err_syntax14.tab.c, test/btyacc/err_syntax15.tab.c, test/btyacc/err_syntax16.tab.c: + regen + + * output.c: gcc-warning + + * test/btyacc/code_calc.tab.c, test/btyacc/code_error.tab.c: regen + + * output.c: fix limit when merging real/workaround tables + + * output.c: + for btyacc, it is possible to have no conflicts - but in that case, the + "ctable" was not generated at all, while the skeleton uses the table. + The most straightforward (workaround) is generating a dummy table which + rejects any state. + + * test/btyacc_destroy3.y, test/btyacc_destroy2.y, test/btyacc_destroy1.y: + fix "make check_make" + + * test/yacc/calc3.tab.c, test/yacc/ok_syntax1.tab.c, test/yacc/calc2.tab.c, test/btyacc/btyacc_destroy1.tab.c, test/btyacc/btyacc_destroy2.tab.c: + regen + + * reader.c: + trim blanks from interim value in copy_param() to handle special case when + a space precedes a comma. + + * output.c: + use two new functions, puts_param_types and puts_param_names, to improve + format of the parse_param list (by trimming space after "*") as well as + correcting the output of the comma-separated names (only the last name + was output). + + * test/btyacc/ok_syntax1.tab.c, test/btyacc/btyacc_destroy3.tab.c, test/btyacc/calc2.tab.c, test/btyacc/calc3.tab.c: + regen + + * reader.c: + modify copy_param() to handle resulting comma-separated list. Before, it + only expected a single parameter. + +2014-10-04 Thomas E. Dickey + + * reader.c: split-out save_param() from copy_param() + + * reader.c: trim_blanks() did not always convert spaces - fix. + + * reader.c: fix some minor regressions with error-reporting + + * aclocal.m4: update CF_XOPEN_SOURCE for Unixware change from lynx + + * VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec, package/pkgsrc/Makefile: + bump + + * reader.c: + modify copy_param() to accept multiple parameters, each in curly braces like + recent bison, as well as honoring bison's undocumented feature to accept the + parameters as a comma-separated list. + + * test/btyacc/btyacc_destroy3.tab.c, test/btyacc/btyacc_destroy1.tab.c, test/btyacc/btyacc_destroy2.tab.c, test/btyacc/btyacc_destroy3.error, test/btyacc/btyacc_destroy3.output, test/btyacc/btyacc_destroy3.tab.h, test/btyacc/btyacc_destroy2.error, test/btyacc/btyacc_destroy2.output, test/btyacc/btyacc_destroy2.tab.h: + RCS_BASE + +2014-10-03 Thomas E. Dickey + + * test/btyacc/btyacc_demo2.error, test/btyacc/btyacc_demo2.output, test/btyacc/btyacc_demo2.tab.c, test/btyacc/btyacc_demo2.tab.h, test/btyacc/btyacc_destroy1.error, test/btyacc/btyacc_destroy1.output, test/btyacc/btyacc_destroy1.tab.h, test/btyacc_destroy3.y, test/btyacc_destroy1.y, test/btyacc_destroy2.y: + RCS_BASE + 2014-10-02 Thomas E. Dickey - * reader.c, defs.h: + * main.c, reader.c, defs.h: use calloc in get_line() when allocating line to ensure it is fully initialized, fixes a later uninitialized value in copy_param() (FreeBSD #193499). +2014-09-17 Thomas E. Dickey + + * closure.c, lalr.c, output.c, defs.h: + rephrase odd addressing to fix Coverity #48848, #38950, #38860, not actually + a bug. + +2014-09-01 Thomas E. Dickey + + * config.sub: update to 2014-07-28 + +2014-07-27 Thomas E. Dickey + + * configure: regen + + * aclocal.m4: modified to support port to Minix3.2 + + * package/pkgsrc/Makefile, VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec: + bump + 2014-07-15 Thomas E. Dickey * aclocal.m4: resync with my-autoconf (no change to configure script) Modified: head/contrib/byacc/MANIFEST ============================================================================== --- head/contrib/byacc/MANIFEST Mon Oct 6 15:11:08 2014 (r272654) +++ head/contrib/byacc/MANIFEST Mon Oct 6 15:12:59 2014 (r272655) @@ -1,4 +1,4 @@ -MANIFEST for byacc-20140715, version t20140715 +MANIFEST for byacc-20141005, version t20141005 -------------------------------------------------------------------------------- MANIFEST this file ACKNOWLEDGEMENTS original version of byacc - 1993 Modified: head/contrib/byacc/VERSION ============================================================================== --- head/contrib/byacc/VERSION Mon Oct 6 15:11:08 2014 (r272654) +++ head/contrib/byacc/VERSION Mon Oct 6 15:12:59 2014 (r272655) @@ -1 +1 @@ -20140715 +20141005 Modified: head/contrib/byacc/aclocal.m4 ============================================================================== --- head/contrib/byacc/aclocal.m4 Mon Oct 6 15:11:08 2014 (r272654) +++ head/contrib/byacc/aclocal.m4 Mon Oct 6 15:12:59 2014 (r272655) @@ -1,4 +1,4 @@ -dnl $Id: aclocal.m4,v 1.35 2014/07/15 19:38:05 tom Exp $ +dnl $Id: aclocal.m4,v 1.37 2014/10/04 16:40:06 tom Exp $ dnl Macros for byacc configure script (Thomas E. Dickey) dnl --------------------------------------------------------------------------- dnl Copyright 2004-2013,2014 Thomas E. Dickey @@ -54,7 +54,7 @@ define([CF_ACVERSION_COMPARE], [ifelse([$8], , ,[$8])], [ifelse([$9], , ,[$9])])])dnl dnl --------------------------------------------------------------------------- -dnl CF_ADD_CFLAGS version: 10 updated: 2010/05/26 05:38:42 +dnl CF_ADD_CFLAGS version: 11 updated: 2014/07/22 05:32:57 dnl ------------- dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS dnl The second parameter if given makes this macro verbose. @@ -79,7 +79,7 @@ no) -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes @@ -116,7 +116,7 @@ yes) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -1085,7 +1085,7 @@ fi fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_XOPEN_SOURCE version: 46 updated: 2014/02/09 19:30:15 +dnl CF_XOPEN_SOURCE version: 48 updated: 2014/09/01 12:29:14 dnl --------------- dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, dnl or adapt to the vendor's definitions to get equivalent functionality, @@ -1136,6 +1136,9 @@ irix[[56]].*) #(vi linux*|gnu*|mint*|k*bsd*-gnu) #(vi CF_GNU_SOURCE ;; +minix*) #(vi + cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this... + ;; mirbsd*) #(vi # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks and other headers which use u_int / u_short types cf_XOPEN_SOURCE= @@ -1165,6 +1168,10 @@ solaris2.*) #(vi cf_xopen_source="-D__EXTENSIONS__" cf_cv_xopen_source=broken ;; +sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2) + cf_XOPEN_SOURCE= + cf_POSIX_C_SOURCE= + ;; *) CF_TRY_XOPEN_SOURCE CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) @@ -1172,7 +1179,7 @@ solaris2.*) #(vi esac if test -n "$cf_xopen_source" ; then - CF_ADD_CFLAGS($cf_xopen_source) + CF_ADD_CFLAGS($cf_xopen_source,true) fi dnl In anything but the default case, we may have system-specific setting Modified: head/contrib/byacc/btyaccpar.c ============================================================================== --- head/contrib/byacc/btyaccpar.c Mon Oct 6 15:11:08 2014 (r272654) +++ head/contrib/byacc/btyaccpar.c Mon Oct 6 15:12:59 2014 (r272655) @@ -18,7 +18,7 @@ const char *const banner[] = { "/* original parser id follows */", "/* yysccsid[] = \"@(#)yaccpar 1.9 (Berkeley) 02/21/93\" */", - "/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */", + "/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */", "", "#define YYBYACC 1", CONCAT1("#define YYMAJOR ", YYMAJOR), @@ -56,7 +56,7 @@ const char *const tables[] = "#if YYBTYACC", "extern const YYINT yycindex[];", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ "extern const YYINT yygindex[];", "extern const YYINT yytable[];", "extern const YYINT yycheck[];", @@ -64,7 +64,7 @@ const char *const tables[] = "#if YYBTYACC", "extern const YYINT yyctable[];", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ "", "#if YYDEBUG", "extern const char *const yyname[];", @@ -127,7 +127,7 @@ const char *const hdr_defs[] = "#define YYLVQUEUEGROWTH 32", "#endif", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ "", "/* define the initial stack-sizes */", "#ifdef YYSTACKSIZE", @@ -172,7 +172,7 @@ const char *const hdr_defs[] = "};", "typedef struct YYParseState_s YYParseState;", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ 0 }; @@ -220,7 +220,7 @@ const char *const hdr_vars[] = "", "static short *yylexemes = 0;", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ 0 }; @@ -277,7 +277,7 @@ const char *const body_vars[] = "", " static short *yylexemes = 0;", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ 0 }; @@ -290,14 +290,14 @@ const char *const body_1[] = "#if YYBTYACC", "#define yytrial (yyps->save)", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ "", "#if YYDEBUG", - "#include /* needed for printf */", + "#include /* needed for printf */", "#endif", "", - "#include /* needed for malloc, etc */", - "#include /* needed for memset */", + "#include /* needed for malloc, etc */", + "#include /* needed for memset */", "", "/* allocate initial stack or double stack size, up to YYMAXDEPTH */", "static int yygrowstack(YYSTACKDATA *data)", @@ -404,7 +404,7 @@ const char *const body_1[] = " free(p);", "}", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ "", "#define YYABORT goto yyabort", "#define YYREJECT goto yyabort", @@ -416,7 +416,7 @@ const char *const body_1[] = "#define YYVALID_NESTED do { if (yyps->save && \\", " yyps->save->save == 0) goto yyvalid; } while(0)", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ "", "int", "YYPARSE_DECL()", @@ -432,7 +432,7 @@ const char *const body_2[] = " int yynewerrflag;", " YYParseState *yyerrctx = NULL;", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", " YYLTYPE yyerror_loc_range[2]; /* position of error start & end */", "#endif", @@ -454,7 +454,7 @@ const char *const body_2[] = " yyps = yyNewState(0); if (yyps == 0) goto yyenomem;", " yyps->save = 0;", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " yynerrs = 0;", " yyerrflag = 0;", " yychar = YYEMPTY;", @@ -495,8 +495,8 @@ const char *const body_2[] = " /* in trial mode; save scanner results for future parse attempts */", " if (yylvp == yylvlim)", " { /* Enlarge lexical value queue */", - " int p = yylvp - yylvals;", - " int s = yylvlim - yylvals;", + " size_t p = (size_t) (yylvp - yylvals);", + " size_t s = (size_t) (yylvlim - yylvals);", "", " s += YYLVQUEUEGROWTH;", " if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;", @@ -524,13 +524,13 @@ const char *const body_2[] = " }", " /* normal operation, no conflict encountered */", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " yychar = YYLEX;", #if defined(YYBTYACC) "#if YYBTYACC", " } while (0);", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " if (yychar < 0) yychar = YYEOF;", " /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */", "#if YYDEBUG", @@ -544,7 +544,7 @@ const char *const body_2[] = "#if YYBTYACC", " if (!yytrial)", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " fprintf(stderr, \" <%s>\", YYSTYPE_TOSTRING(yychar, yylval));", "#endif", " fputc('\\n', stderr);", @@ -598,12 +598,12 @@ const char *const body_2[] = " save->state = yystate;", " save->errflag = yyerrflag;", " save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);", - " memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));", + " memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));", " save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);", - " memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));", + " memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));", "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", " save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);", - " memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));", + " memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));", "#endif", " ctry = yytable[yyn];", " if (yyctable[ctry] == -1)", @@ -658,7 +658,7 @@ const char *const body_2[] = " yylexp--;", " yychar = YYEMPTY;", " }", - " save->lexeme = yylvp - yylvals;", + " save->lexeme = (int) (yylvp - yylvals);", " yyps->save = save;", " }", " if (yytable[yyn] == ctry)", @@ -695,7 +695,7 @@ const char *const body_2[] = " }", " } /* End of code dealing with conflicts */", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&", " yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)", " {", @@ -754,14 +754,14 @@ const char *const body_2[] = " yyerrctx->state = yystate;", " yyerrctx->errflag = yyerrflag;", " yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);", - " memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));", + " memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));", " yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);", - " memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));", + " memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));", "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", " yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);", - " memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));", + " memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));", "#endif", - " yyerrctx->lexeme = yylvp - yylvals;", + " yyerrctx->lexeme = (int) (yylvp - yylvals);", " }", " yylvp = yylvals + save->lexeme;", "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", @@ -770,12 +770,12 @@ const char *const body_2[] = " yylexp = yylexemes + save->lexeme;", " yychar = YYEMPTY;", " yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);", - " memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));", + " memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));", " yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);", - " memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));", + " memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));", "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", " yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);", - " memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));", + " memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));", "#endif", " ctry = ++save->ctry;", " yystate = save->state;", @@ -805,12 +805,12 @@ const char *const body_2[] = " yylloc = yylpp[-1];", "#endif", " yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);", - " memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));", + " memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));", " yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);", - " memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));", + " memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));", "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", " yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);", - " memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));", + " memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));", "#endif", " yystate = yyerrctx->state;", " yyFreeState(yyerrctx);", @@ -820,7 +820,7 @@ const char *const body_2[] = " }", " if (yynewerrflag == 0) goto yyinrecovery;", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ "", " YYERROR_CALL(\"syntax error\");", "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", @@ -876,7 +876,7 @@ const char *const body_2[] = "#if YYBTYACC", " if (!yytrial)", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", " YYDESTRUCT_CALL(\"error: discarding state\",", " yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);", @@ -909,7 +909,7 @@ const char *const body_2[] = "#if YYBTYACC", " if (!yytrial)", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", " YYDESTRUCT_CALL(\"error: discarding token\", yychar, &yylval, &yylloc);", "#else", @@ -932,7 +932,7 @@ const char *const body_2[] = "#if YYBTYACC", " if (!yytrial)", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " if (yym > 0)", " {", " int i;", @@ -961,7 +961,7 @@ const char *const body_2[] = "#if YYBTYACC", " if (!yytrial)", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " {", " YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);", " /* just in case YYERROR is invoked within the action, save", @@ -998,7 +998,7 @@ const char *const trailer[] = "#if YYBTYACC", " if (!yytrial)", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " fprintf(stderr, \"result is <%s>, \", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));", "#endif", " fprintf(stderr, \"shifting from state 0 to final state %d\\n\", YYFINAL);", @@ -1030,8 +1030,8 @@ const char *const trailer[] = " /* in trial mode; save scanner results for future parse attempts */", " if (yylvp == yylvlim)", " { /* Enlarge lexical value queue */", - " int p = yylvp - yylvals;", - " int s = yylvlim - yylvals;", + " size_t p = (size_t) (yylvp - yylvals);", + " size_t s = (size_t) (yylvlim - yylvals);", "", " s += YYLVQUEUEGROWTH;", " if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)", @@ -1062,13 +1062,13 @@ const char *const trailer[] = " }", " /* normal operation, no conflict encountered */", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " yychar = YYLEX;", #if defined(YYBTYACC) "#if YYBTYACC", " } while (0);", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " if (yychar < 0) yychar = YYEOF;", " /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */", "#if YYDEBUG", @@ -1097,7 +1097,7 @@ const char *const trailer[] = "#if YYBTYACC", " if (!yytrial)", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " fprintf(stderr, \"result is <%s>, \", YYSTYPE_TOSTRING(yystos[yystate], yyval));", "#endif", " fprintf(stderr, \"shifting from state %d to state %d\\n\", *yystack.s_mark, yystate);", @@ -1140,17 +1140,17 @@ const char *const trailer[] = " yylexp = yylexemes + yypath->lexeme;", " yychar = YYEMPTY;", " yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);", - " memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));", + " memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));", " yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);", - " memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));", + " memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));", "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)", " yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);", - " memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));", + " memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));", "#endif", " yystate = yypath->state;", " goto yyloop;", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ "", "yyoverflow:", " YYERROR_CALL(\"yacc stack overflow\");", @@ -1161,7 +1161,7 @@ const char *const trailer[] = " YYERROR_CALL(\"memory exhausted\");", "yyabort_nomem:", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " yyresult = 2;", " goto yyreturn;", "", @@ -1174,7 +1174,7 @@ const char *const trailer[] = "#if YYBTYACC", " if (yyps->save) goto yyvalid;", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " yyresult = 0;", "", "yyreturn:", @@ -1224,7 +1224,7 @@ const char *const trailer[] = " yyFreeState(save);", " }", "#endif /* YYBTYACC */", -#endif /* defined(YYBTYACC) */ +#endif /* defined(YYBTYACC) */ " yyfreestack(&yystack);", " return (yyresult);", "}", Modified: head/contrib/byacc/closure.c ============================================================================== --- head/contrib/byacc/closure.c Mon Oct 6 15:11:08 2014 (r272654) +++ head/contrib/byacc/closure.c Mon Oct 6 15:12:59 2014 (r272655) @@ -1,4 +1,4 @@ -/* $Id: closure.c,v 1.10 2014/02/19 00:45:42 Tom.Shields Exp $ */ +/* $Id: closure.c,v 1.11 2014/09/18 00:40:07 tom Exp $ */ #include "defs.h" @@ -6,6 +6,7 @@ Value_t *itemset; Value_t *itemsetend; unsigned *ruleset; +static unsigned *first_base; static unsigned *first_derives; static unsigned *EFF; @@ -68,7 +69,8 @@ set_first_derives(void) rulesetsize = WORDSIZE(nrules); varsetsize = WORDSIZE(nvars); - first_derives = NEW2(nvars * rulesetsize, unsigned) - ntokens * rulesetsize; + first_base = NEW2(nvars * rulesetsize, unsigned); + first_derives = first_base - ntokens * rulesetsize; set_EFF(); @@ -176,7 +178,7 @@ finalize_closure(void) { FREE(itemset); FREE(ruleset); - FREE(first_derives + ntokens * WORDSIZE(nrules)); + FREE(first_base); } #ifdef DEBUG Modified: head/contrib/byacc/config.sub ============================================================================== --- head/contrib/byacc/config.sub Mon Oct 6 15:11:08 2014 (r272654) +++ head/contrib/byacc/config.sub Mon Oct 6 15:12:59 2014 (r272655) @@ -2,7 +2,7 @@ # Configuration validation subroutine script. # Copyright 1992-2014 Free Software Foundation, Inc. -timestamp='2014-04-03' +timestamp='2014-07-28' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -283,8 +283,10 @@ case $basic_machine in | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ @@ -401,8 +403,10 @@ case $basic_machine in | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ @@ -824,6 +828,10 @@ case $basic_machine in basic_machine=powerpc-unknown os=-morphos ;; + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox + ;; msdos) basic_machine=i386-pc os=-msdos @@ -1369,7 +1377,7 @@ case $os in | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ Modified: head/contrib/byacc/configure ============================================================================== --- head/contrib/byacc/configure Mon Oct 6 15:11:08 2014 (r272654) +++ head/contrib/byacc/configure Mon Oct 6 15:12:59 2014 (r272655) @@ -1936,7 +1936,7 @@ no) -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes @@ -1977,7 +1977,7 @@ yes) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -2498,6 +2498,9 @@ echo "${ECHO_T}$cf_cv_gnu_source" >&6 test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" ;; +minix*) #(vi + cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this... + ;; mirbsd*) #(vi # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks and other headers which use u_int / u_short types cf_XOPEN_SOURCE= @@ -2515,16 +2518,16 @@ cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAG sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` -echo "$as_me:2518: checking if we should define _POSIX_C_SOURCE" >&5 +echo "$as_me:2521: checking if we should define _POSIX_C_SOURCE" >&5 echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 if test "${cf_cv_posix_c_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else -echo "${as_me:-configure}:2524: testing if the symbol is already defined go no further ..." 1>&5 +echo "${as_me:-configure}:2527: testing if the symbol is already defined go no further ..." 1>&5 cat >conftest.$ac_ext <<_ACEOF -#line 2527 "configure" +#line 2530 "configure" #include "confdefs.h" #include int @@ -2539,16 +2542,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2542: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2545: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2545: \$? = $ac_status" >&5 + echo "$as_me:2548: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2548: \"$ac_try\"") >&5 + { (eval echo "$as_me:2551: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2551: \$? = $ac_status" >&5 + echo "$as_me:2554: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_posix_c_source=no else @@ -2569,7 +2572,7 @@ cf_want_posix_source=no esac if test "$cf_want_posix_source" = yes ; then cat >conftest.$ac_ext <<_ACEOF -#line 2572 "configure" +#line 2575 "configure" #include "confdefs.h" #include int @@ -2584,16 +2587,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2587: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2590: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2590: \$? = $ac_status" >&5 + echo "$as_me:2593: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2593: \"$ac_try\"") >&5 + { (eval echo "$as_me:2596: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2596: \$? = $ac_status" >&5 + echo "$as_me:2599: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -2604,15 +2607,15 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "${as_me:-configure}:2607: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 +echo "${as_me:-configure}:2610: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 CFLAGS="$cf_trim_CFLAGS" CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" -echo "${as_me:-configure}:2612: testing if the second compile does not leave our definition intact error ..." 1>&5 +echo "${as_me:-configure}:2615: testing if the second compile does not leave our definition intact error ..." 1>&5 cat >conftest.$ac_ext <<_ACEOF -#line 2615 "configure" +#line 2618 "configure" #include "confdefs.h" #include int @@ -2627,16 +2630,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2630: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2633: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2633: \$? = $ac_status" >&5 + echo "$as_me:2636: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2636: \"$ac_try\"") >&5 + { (eval echo "$as_me:2639: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2639: \$? = $ac_status" >&5 + echo "$as_me:2642: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -2652,7 +2655,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:2655: result: $cf_cv_posix_c_source" >&5 +echo "$as_me:2658: result: $cf_cv_posix_c_source" >&5 echo "${ECHO_T}$cf_cv_posix_c_source" >&6 if test "$cf_cv_posix_c_source" != no ; then @@ -2674,7 +2677,7 @@ no) -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes @@ -2715,7 +2718,7 @@ yes) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -2766,14 +2769,14 @@ solaris2.*) #(vi ;; *) -echo "$as_me:2769: checking if we should define _XOPEN_SOURCE" >&5 +echo "$as_me:2772: checking if we should define _XOPEN_SOURCE" >&5 echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 if test "${cf_cv_xopen_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 2776 "configure" +#line 2779 "configure" #include "confdefs.h" #include @@ -2792,16 +2795,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2795: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2798: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2798: \$? = $ac_status" >&5 + echo "$as_me:2801: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2801: \"$ac_try\"") >&5 + { (eval echo "$as_me:2804: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2804: \$? = $ac_status" >&5 + echo "$as_me:2807: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_xopen_source=no else @@ -2810,7 +2813,7 @@ cat conftest.$ac_ext >&5 cf_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" cat >conftest.$ac_ext <<_ACEOF -#line 2813 "configure" +#line 2816 "configure" #include "confdefs.h" #include @@ -2829,16 +2832,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2832: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2835: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2835: \$? = $ac_status" >&5 + echo "$as_me:2838: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2838: \"$ac_try\"") >&5 + { (eval echo "$as_me:2841: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2841: \$? = $ac_status" >&5 + echo "$as_me:2844: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_xopen_source=no else @@ -2853,7 +2856,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:2856: result: $cf_cv_xopen_source" >&5 +echo "$as_me:2859: result: $cf_cv_xopen_source" >&5 echo "${ECHO_T}$cf_cv_xopen_source" >&6 if test "$cf_cv_xopen_source" != no ; then @@ -2883,7 +2886,7 @@ no) -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes @@ -2924,7 +2927,7 @@ yes) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` - test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; @@ -2961,16 +2964,16 @@ cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAG sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` -echo "$as_me:2964: checking if we should define _POSIX_C_SOURCE" >&5 +echo "$as_me:2967: checking if we should define _POSIX_C_SOURCE" >&5 echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 if test "${cf_cv_posix_c_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else -echo "${as_me:-configure}:2970: testing if the symbol is already defined go no further ..." 1>&5 +echo "${as_me:-configure}:2973: testing if the symbol is already defined go no further ..." 1>&5 cat >conftest.$ac_ext <<_ACEOF -#line 2973 "configure" +#line 2976 "configure" #include "confdefs.h" #include int @@ -2985,16 +2988,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2988: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2991: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2991: \$? = $ac_status" >&5 + echo "$as_me:2994: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2994: \"$ac_try\"") >&5 + { (eval echo "$as_me:2997: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2997: \$? = $ac_status" >&5 + echo "$as_me:3000: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_posix_c_source=no else @@ -3015,7 +3018,7 @@ cf_want_posix_source=no esac if test "$cf_want_posix_source" = yes ; then cat >conftest.$ac_ext <<_ACEOF -#line 3018 "configure" +#line 3021 "configure" #include "confdefs.h" #include int @@ -3030,16 +3033,16 @@ make an error } _ACEOF *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 15:43:58 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2ADC348E; Mon, 6 Oct 2014 15:43:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 17219DE5; Mon, 6 Oct 2014 15:43:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s96FhvuH052752; Mon, 6 Oct 2014 15:43:57 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s96FhvUJ052751; Mon, 6 Oct 2014 15:43:57 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201410061543.s96FhvUJ052751@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 6 Oct 2014 15:43:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272658 - head/sys/i386/i386 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 15:43:58 -0000 Author: jhb Date: Mon Oct 6 15:43:57 2014 New Revision: 272658 URL: https://svnweb.freebsd.org/changeset/base/272658 Log: Call initializecpucache() on the BSP for i386 in the !XEN case. This was my bug in r271409 that I noticed while reviewing r272492. Modified: head/sys/i386/i386/machdep.c Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Mon Oct 6 15:24:04 2014 (r272657) +++ head/sys/i386/i386/machdep.c Mon Oct 6 15:43:57 2014 (r272658) @@ -3326,9 +3326,7 @@ init386(first) setidt(IDT_GP, &IDTVEC(prot), SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); initializecpu(); /* Initialize CPU registers */ -#ifdef PC98 initializecpucache(); -#endif /* make an initial tss so cpu can get interrupt stack on syscall! */ /* Note: -16 is so we can grow the trapframe if we came from vm86 */ From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 15:48:30 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 952EF73A; Mon, 6 Oct 2014 15:48:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 76102E37; Mon, 6 Oct 2014 15:48:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s96FmUmD053523; Mon, 6 Oct 2014 15:48:30 GMT (envelope-from luigi@FreeBSD.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s96FmTNZ053516; Mon, 6 Oct 2014 15:48:29 GMT (envelope-from luigi@FreeBSD.org) Message-Id: <201410061548.s96FmTNZ053516@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: luigi set sender to luigi@FreeBSD.org using -f From: Luigi Rizzo Date: Mon, 6 Oct 2014 15:48:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272659 - in head: contrib/libpcap lib/libpcap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 15:48:30 -0000 Author: luigi Date: Mon Oct 6 15:48:28 2014 New Revision: 272659 URL: https://svnweb.freebsd.org/changeset/base/272659 Log: Add netmap support to libpcap. Tcpdump and other native pcap application can now run directly on netmap ports using netmap:foo or valeXX:YY device names. Modifications to existing code are small and trivial, the netmap-specific code is all in a new file. Please be aware that in netmap mode the physical interface is disconnected from the host stack, so libpcap will steal the traffic not just make a copy. For the full version of the code (including linux and autotools support) see https://code.google.com/p/netmap-libpcap/ MFC after: 3 days Added: head/lib/libpcap/pcap-netmap.c (contents, props changed) Modified: head/contrib/libpcap/inet.c head/contrib/libpcap/pcap.c head/lib/libpcap/Makefile head/lib/libpcap/config.h Modified: head/contrib/libpcap/inet.c ============================================================================== --- head/contrib/libpcap/inet.c Mon Oct 6 15:43:57 2014 (r272658) +++ head/contrib/libpcap/inet.c Mon Oct 6 15:48:28 2014 (r272659) @@ -737,6 +737,10 @@ pcap_lookupnet(device, netp, maskp, errb #ifdef PCAP_SUPPORT_USB || strstr(device, "usbmon") != NULL #endif +#ifdef PCAP_SUPPORT_NETMAP + || !strncmp(device, "netmap:", 7) + || !strncmp(device, "vale", 4) +#endif #ifdef HAVE_SNF_API || strstr(device, "snf") != NULL #endif Modified: head/contrib/libpcap/pcap.c ============================================================================== --- head/contrib/libpcap/pcap.c Mon Oct 6 15:43:57 2014 (r272658) +++ head/contrib/libpcap/pcap.c Mon Oct 6 15:48:28 2014 (r272659) @@ -106,6 +106,10 @@ static const char rcsid[] _U_ = #include "pcap-netfilter-linux.h" #endif +#ifdef PCAP_SUPPORT_NETMAP +pcap_t* pcap_netmap_create(const char *device, char *ebuf, int *is_ours); +#endif + int pcap_not_initialized(pcap_t *pcap) { @@ -301,6 +305,9 @@ struct capture_source_type { int (*findalldevs_op)(pcap_if_t **, char *); pcap_t *(*create_op)(const char *, char *, int *); } capture_source_types[] = { +#ifdef PCAP_SUPPORT_NETMAP + { NULL, pcap_netmap_create }, +#endif #ifdef HAVE_DAG_API { dag_findalldevs, dag_create }, #endif Modified: head/lib/libpcap/Makefile ============================================================================== --- head/lib/libpcap/Makefile Mon Oct 6 15:43:57 2014 (r272658) +++ head/lib/libpcap/Makefile Mon Oct 6 15:48:28 2014 (r272659) @@ -7,6 +7,7 @@ SHLIBDIR?= /lib LIB= pcap SRCS= grammar.y tokdefs.h version.h pcap-bpf.c \ + pcap-netmap.c \ pcap.c pcap-common.c inet.c fad-getad.c gencode.c optimize.c nametoaddr.c \ etherent.c savefile.c bpf_filter.c bpf_image.c bpf_dump.c \ scanner.l sf-pcap.c sf-pcap-ng.c version.c Modified: head/lib/libpcap/config.h ============================================================================== --- head/lib/libpcap/config.h Mon Oct 6 15:43:57 2014 (r272658) +++ head/lib/libpcap/config.h Mon Oct 6 15:48:28 2014 (r272659) @@ -271,6 +271,9 @@ /* target host supports USB sniffing */ /* #undef PCAP_SUPPORT_USB */ +/* target host supports netmap */ +#define PCAP_SUPPORT_NETMAP 1 + /* include ACN support */ /* #undef SITA */ Added: head/lib/libpcap/pcap-netmap.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libpcap/pcap-netmap.c Mon Oct 6 15:48:28 2014 (r272659) @@ -0,0 +1,283 @@ +/* + * Copyright (C) 2014 Luigi Rizzo. 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, 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#define NETMAP_WITH_LIBS +#include + +#include "pcap-int.h" + +/* + * $FreeBSD$ + * + * This code is meant to build also on other versions of libpcap. + * + * older libpcap miss p->priv, use p->md.device instead (and allocate). + * Also opt.timeout was in md.timeout before. + * Use #define PCAP_IF_UP to discriminate + */ +#ifdef PCAP_IF_UP +#define NM_PRIV(p) ((struct pcap_netmap *)(p->priv)) +#define the_timeout opt.timeout +#else +#define HAVE_NO_PRIV +#define NM_PRIV(p) ((struct pcap_netmap *)(p->md.device)) +#define SET_PRIV(p, x) p->md.device = (void *)x +#define the_timeout md.timeout +#endif + +#if defined (linux) +/* On FreeBSD we use IFF_PPROMISC which is in ifr_flagshigh. + * remap to IFF_PROMISC on linux + */ +#define IFF_PPROMISC IFF_PROMISC +#endif /* linux */ + +struct pcap_netmap { + struct nm_desc *d; /* pointer returned by nm_open() */ + pcap_handler cb; /* callback and argument */ + u_char *cb_arg; + int must_clear_promisc; /* flag */ + uint64_t rx_pkts; /* # of pkts received before the filter */ +}; + + +static int +pcap_netmap_stats(pcap_t *p, struct pcap_stat *ps) +{ + struct pcap_netmap *pn = NM_PRIV(p); + + ps->ps_recv = pn->rx_pkts; + ps->ps_drop = 0; + ps->ps_ifdrop = 0; + return 0; +} + + +static void +pcap_netmap_filter(u_char *arg, struct pcap_pkthdr *h, const u_char *buf) +{ + pcap_t *p = (pcap_t *)arg; + struct pcap_netmap *pn = NM_PRIV(p); + const struct bpf_insn *pc = p->fcode.bf_insns; + + ++pn->rx_pkts; + if (pc == NULL || bpf_filter(pc, buf, h->len, h->caplen)) + pn->cb(pn->cb_arg, h, buf); +} + + +static int +pcap_netmap_dispatch(pcap_t *p, int cnt, pcap_handler cb, u_char *user) +{ + int ret; + struct pcap_netmap *pn = NM_PRIV(p); + struct nm_desc *d = pn->d; + struct pollfd pfd = { .fd = p->fd, .events = POLLIN, .revents = 0 }; + + pn->cb = cb; + pn->cb_arg = user; + + for (;;) { + if (p->break_loop) { + p->break_loop = 0; + return PCAP_ERROR_BREAK; + } + /* nm_dispatch won't run forever */ + + ret = nm_dispatch((void *)d, cnt, (void *)pcap_netmap_filter, (void *)p); + if (ret != 0) + break; + errno = 0; + ret = poll(&pfd, 1, p->the_timeout); + } + return ret; +} + + +/* XXX need to check the NIOCTXSYNC/poll */ +static int +pcap_netmap_inject(pcap_t *p, const void *buf, size_t size) +{ + struct nm_desc *d = NM_PRIV(p)->d; + + return nm_inject(d, buf, size); +} + + +static int +pcap_netmap_ioctl(pcap_t *p, u_long what, uint32_t *if_flags) +{ + struct pcap_netmap *pn = NM_PRIV(p); + struct nm_desc *d = pn->d; + struct ifreq ifr; + int error, fd = d->fd; + +#ifdef linux + fd = socket(AF_INET, SOCK_DGRAM, 0); + if (fd < 0) { + fprintf(stderr, "Error: cannot get device control socket.\n"); + return -1; + } +#endif /* linux */ + bzero(&ifr, sizeof(ifr)); + strncpy(ifr.ifr_name, d->req.nr_name, sizeof(ifr.ifr_name)); + switch (what) { + case SIOCSIFFLAGS: + ifr.ifr_flags = *if_flags; +#ifdef __FreeBSD__ + ifr.ifr_flagshigh = *if_flags >> 16; +#endif /* __FreeBSD__ */ + break; + } + error = ioctl(fd, what, &ifr); + if (!error) { + switch (what) { + case SIOCGIFFLAGS: + *if_flags = ifr.ifr_flags; +#ifdef __FreeBSD__ + *if_flags |= (ifr.ifr_flagshigh << 16); +#endif /* __FreeBSD__ */ + } + } +#ifdef linux + close(fd); +#endif /* linux */ + return error ? -1 : 0; +} + + +static void +pcap_netmap_close(pcap_t *p) +{ + struct pcap_netmap *pn = NM_PRIV(p); + struct nm_desc *d = pn->d; + uint32_t if_flags = 0; + + if (pn->must_clear_promisc) { + pcap_netmap_ioctl(p, SIOCGIFFLAGS, &if_flags); /* fetch flags */ + if (if_flags & IFF_PPROMISC) { + if_flags &= ~IFF_PPROMISC; + pcap_netmap_ioctl(p, SIOCSIFFLAGS, &if_flags); + } + } + nm_close(d); +#ifdef HAVE_NO_PRIV + free(pn); + SET_PRIV(p, NULL); // unnecessary +#endif + pcap_cleanup_live_common(p); +} + + +static int +pcap_netmap_activate(pcap_t *p) +{ + struct pcap_netmap *pn = NM_PRIV(p); + struct nm_desc *d = nm_open(p->opt.source, NULL, 0, NULL); + uint32_t if_flags = 0; + + if (d == NULL) { + snprintf(p->errbuf, PCAP_ERRBUF_SIZE, + "netmap open: cannot access %s: %s\n", + p->opt.source, pcap_strerror(errno)); +#ifdef HAVE_NO_PRIV + free(pn); + SET_PRIV(p, NULL); // unnecessary +#endif + pcap_cleanup_live_common(p); + return (PCAP_ERROR); + } + if (0) + fprintf(stderr, "%s device %s priv %p fd %d ports %d..%d\n", + __FUNCTION__, p->opt.source, d, d->fd, + d->first_rx_ring, d->last_rx_ring); + pn->d = d; + p->fd = d->fd; + if (p->opt.promisc && !(d->req.nr_ringid & NETMAP_SW_RING)) { + pcap_netmap_ioctl(p, SIOCGIFFLAGS, &if_flags); /* fetch flags */ + if (!(if_flags & IFF_PPROMISC)) { + pn->must_clear_promisc = 1; + if_flags |= IFF_PPROMISC; + pcap_netmap_ioctl(p, SIOCSIFFLAGS, &if_flags); + } + } + p->linktype = DLT_EN10MB; + p->selectable_fd = p->fd; + p->read_op = pcap_netmap_dispatch; + p->inject_op = pcap_netmap_inject, + p->setfilter_op = install_bpf_program; + p->setdirection_op = NULL; + p->set_datalink_op = NULL; + p->getnonblock_op = pcap_getnonblock_fd; + p->setnonblock_op = pcap_setnonblock_fd; + p->stats_op = pcap_netmap_stats; + p->cleanup_op = pcap_netmap_close; + + return (0); +} + + +pcap_t * +pcap_netmap_create(const char *device, char *ebuf, int *is_ours) +{ + pcap_t *p; + + *is_ours = (!strncmp(device, "netmap:", 7) || !strncmp(device, "vale", 4)); + if (! *is_ours) + return NULL; +#ifdef HAVE_NO_PRIV + { + void *pn = calloc(1, sizeof(struct pcap_netmap)); + if (pn == NULL) + return NULL; + p = pcap_create_common(device, ebuf); + if (p == NULL) { + free(pn); + return NULL; + } + SET_PRIV(p, pn); + } +#else + p = pcap_create_common(device, ebuf, sizeof (struct pcap_netmap)); + if (p == NULL) + return (NULL); +#endif + p->activate_op = pcap_netmap_activate; + return (p); +} From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 16:38:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3A9EC5AD; Mon, 6 Oct 2014 16:38:11 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 137596D0; Mon, 6 Oct 2014 16:38:11 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-70-85-31.nwrknj.fios.verizon.net [173.70.85.31]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 05C1AB97B; Mon, 6 Oct 2014 12:38:10 -0400 (EDT) From: John Baldwin To: Mateusz Guzik Subject: Re: svn commit: r272596 - head/sys/fs/devfs Date: Mon, 06 Oct 2014 11:37:32 -0400 Message-ID: <13670379.opPJl0kA6Z@ralph.baldwin.cx> User-Agent: KMail/4.12.5 (FreeBSD/10.1-BETA2; KDE/4.12.5; amd64; ; ) In-Reply-To: <201410060620.s966Kaqt078736@svn.freebsd.org> References: <201410060620.s966Kaqt078736@svn.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 06 Oct 2014 12:38:10 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 16:38:11 -0000 On Monday, October 06, 2014 06:20:36 AM Mateusz Guzik wrote: > Author: mjg > Date: Mon Oct 6 06:20:35 2014 > New Revision: 272596 > URL: https://svnweb.freebsd.org/changeset/base/272596 > > Log: > devfs: don't take proctree_lock unconditionally in devfs_close > > MFC after: 1 week Just for my sanity: What keeps td->td_proc->p_session static in this case so that it is safe to dereference it? Specifically, if you are preempted after reading p_session but before you then read s_ttyvp, what prevents a race with another thread changing the session of td->td_proc? -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 18:11:06 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 22E1A6CD; Mon, 6 Oct 2014 18:11:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F3151A1; Mon, 6 Oct 2014 18:11:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s96IB5Jh022178; Mon, 6 Oct 2014 18:11:05 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s96IB5rL022177; Mon, 6 Oct 2014 18:11:05 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201410061811.s96IB5rL022177@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 6 Oct 2014 18:11:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272666 - head/sys/x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 18:11:06 -0000 Author: jhb Date: Mon Oct 6 18:11:05 2014 New Revision: 272666 URL: https://svnweb.freebsd.org/changeset/base/272666 Log: Fix build for i386 kernels with out 'I686_CPU'. PR: 193660 Submitted by: holger@freyther.de Modified: head/sys/x86/x86/local_apic.c Modified: head/sys/x86/x86/local_apic.c ============================================================================== --- head/sys/x86/x86/local_apic.c Mon Oct 6 17:27:49 2014 (r272665) +++ head/sys/x86/x86/local_apic.c Mon Oct 6 18:11:05 2014 (r272666) @@ -1366,7 +1366,7 @@ apic_init(void *dummy __unused) printf("APIC: Using the %s enumerator.\n", best_enum->apic_name); -#ifndef __amd64__ +#ifdef I686_CPU /* * To work around an errata, we disable the local APIC on some * CPUs during early startup. We need to turn the local APIC back From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 18:16:46 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9C390BF6; Mon, 6 Oct 2014 18:16:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8892229B; Mon, 6 Oct 2014 18:16:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s96IGkAB025780; Mon, 6 Oct 2014 18:16:46 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s96IGkNp025779; Mon, 6 Oct 2014 18:16:46 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201410061816.s96IGkNp025779@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 6 Oct 2014 18:16:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272668 - head/usr.sbin/nscd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 18:16:46 -0000 Author: jhb Date: Mon Oct 6 18:16:45 2014 New Revision: 272668 URL: https://svnweb.freebsd.org/changeset/base/272668 Log: Properly set the timeout in a query_state. The global query_timeout configuration value is an integer count of seconds, it is not a timeval. Using memcpy() to copy a timeval from it put garbage into the tv_usec field. PR: 194025 Submitted by: David Shane Holden MFC after: 1 week Modified: head/usr.sbin/nscd/query.c Modified: head/usr.sbin/nscd/query.c ============================================================================== --- head/usr.sbin/nscd/query.c Mon Oct 6 18:15:13 2014 (r272667) +++ head/usr.sbin/nscd/query.c Mon Oct 6 18:16:45 2014 (r272668) @@ -1253,8 +1253,8 @@ init_query_state(int sockfd, size_t keve retval->read_func = query_socket_read; get_time_func(&retval->creation_time); - memcpy(&retval->timeout, &s_configuration->query_timeout, - sizeof(struct timeval)); + retval->timeout.tv_sec = s_configuration->query_timeout; + retval->timeout.tv_usec = 0; TRACE_OUT(init_query_state); return (retval); From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 20:48:03 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 31C794F7; Mon, 6 Oct 2014 20:48:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 03BC081B; Mon, 6 Oct 2014 20:48:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s96Km22P099711; Mon, 6 Oct 2014 20:48:02 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s96Km2GQ099708; Mon, 6 Oct 2014 20:48:02 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201410062048.s96Km2GQ099708@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Mon, 6 Oct 2014 20:48:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272670 - in head/sys/amd64: include vmm vmm/intel X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 20:48:03 -0000 Author: neel Date: Mon Oct 6 20:48:01 2014 New Revision: 272670 URL: https://svnweb.freebsd.org/changeset/base/272670 Log: Inject #UD into the guest when it executes either 'MONITOR' or 'MWAIT'. The hypervisor hides the MONITOR/MWAIT capability by unconditionally setting CPUID.01H:ECX[3] to 0 so the guest should not expect these instructions to be present anyways. Discussed with: grehan Modified: head/sys/amd64/include/vmm.h head/sys/amd64/vmm/intel/vmx.c head/sys/amd64/vmm/vmm.c Modified: head/sys/amd64/include/vmm.h ============================================================================== --- head/sys/amd64/include/vmm.h Mon Oct 6 20:38:55 2014 (r272669) +++ head/sys/amd64/include/vmm.h Mon Oct 6 20:48:01 2014 (r272670) @@ -485,6 +485,8 @@ enum vm_exitcode { VM_EXITCODE_SUSPENDED, VM_EXITCODE_INOUT_STR, VM_EXITCODE_TASK_SWITCH, + VM_EXITCODE_MONITOR, + VM_EXITCODE_MWAIT, VM_EXITCODE_MAX }; Modified: head/sys/amd64/vmm/intel/vmx.c ============================================================================== --- head/sys/amd64/vmm/intel/vmx.c Mon Oct 6 20:38:55 2014 (r272669) +++ head/sys/amd64/vmm/intel/vmx.c Mon Oct 6 20:48:01 2014 (r272670) @@ -81,6 +81,8 @@ __FBSDID("$FreeBSD$"); #define PROCBASED_CTLS_ONE_SETTING \ (PROCBASED_SECONDARY_CONTROLS | \ + PROCBASED_MWAIT_EXITING | \ + PROCBASED_MONITOR_EXITING | \ PROCBASED_IO_EXITING | \ PROCBASED_MSR_BITMAPS | \ PROCBASED_CTLS_WINDOW_SETTING | \ @@ -2373,6 +2375,12 @@ vmx_exit_process(struct vmx *vmx, int vc case EXIT_REASON_XSETBV: handled = vmx_emulate_xsetbv(vmx, vcpu, vmexit); break; + case EXIT_REASON_MONITOR: + vmexit->exitcode = VM_EXITCODE_MONITOR; + break; + case EXIT_REASON_MWAIT: + vmexit->exitcode = VM_EXITCODE_MWAIT; + break; default: vmm_stat_incr(vmx->vm, vcpu, VMEXIT_UNKNOWN, 1); break; Modified: head/sys/amd64/vmm/vmm.c ============================================================================== --- head/sys/amd64/vmm/vmm.c Mon Oct 6 20:38:55 2014 (r272669) +++ head/sys/amd64/vmm/vmm.c Mon Oct 6 20:48:01 2014 (r272670) @@ -1481,6 +1481,10 @@ restart: case VM_EXITCODE_INOUT_STR: error = vm_handle_inout(vm, vcpuid, vme, &retu); break; + case VM_EXITCODE_MONITOR: + case VM_EXITCODE_MWAIT: + vm_inject_ud(vm, vcpuid); + break; default: retu = true; /* handled in userland */ break; From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 21:52:41 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BC7B9CBE; Mon, 6 Oct 2014 21:52:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8EA21F20; Mon, 6 Oct 2014 21:52:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s96LqfhH033440; Mon, 6 Oct 2014 21:52:41 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s96LqfYP033439; Mon, 6 Oct 2014 21:52:41 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201410062152.s96LqfYP033439@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 6 Oct 2014 21:52:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272671 - head/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 21:52:41 -0000 Author: markj Date: Mon Oct 6 21:52:40 2014 New Revision: 272671 URL: https://svnweb.freebsd.org/changeset/base/272671 Log: Treat D keywords as identifiers in certain postfix expressions. This allows one to, for example, access the "provider" field of a struct g_consumer, even though "provider" is a D keyword. PR: 169657 MFC after: 2 months Discussed with: Bryan Cantrill Sponsored by: EMC / Isilon Storage Division Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_grammar.y Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_grammar.y ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_grammar.y Mon Oct 6 20:48:01 2014 (r272670) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_grammar.y Mon Oct 6 21:52:40 2014 (r272671) @@ -207,6 +207,8 @@ %type unary_operator %type struct_or_union +%type dtrace_keyword_ident + %% dtrace_program: d_expression DT_TOK_EOF { return (dt_node_root($1)); } @@ -391,12 +393,18 @@ postfix_expression: | postfix_expression DT_TOK_DOT DT_TOK_TNAME { $$ = OP2(DT_TOK_DOT, $1, dt_node_ident($3)); } + | postfix_expression DT_TOK_DOT dtrace_keyword_ident { + $$ = OP2(DT_TOK_DOT, $1, dt_node_ident($3)); + } | postfix_expression DT_TOK_PTR DT_TOK_IDENT { $$ = OP2(DT_TOK_PTR, $1, dt_node_ident($3)); } | postfix_expression DT_TOK_PTR DT_TOK_TNAME { $$ = OP2(DT_TOK_PTR, $1, dt_node_ident($3)); } + | postfix_expression DT_TOK_PTR dtrace_keyword_ident { + $$ = OP2(DT_TOK_PTR, $1, dt_node_ident($3)); + } | postfix_expression DT_TOK_ADDADD { $$ = OP1(DT_TOK_POSTINC, $1); } @@ -411,6 +419,10 @@ postfix_expression: DT_TOK_TNAME DT_TOK_RPAR { $$ = dt_node_offsetof($3, $5); } + | DT_TOK_OFFSETOF DT_TOK_LPAR type_name DT_TOK_COMMA + dtrace_keyword_ident DT_TOK_RPAR { + $$ = dt_node_offsetof($3, $5); + } | DT_TOK_XLATE DT_TOK_LT type_name DT_TOK_GT DT_TOK_LPAR expression DT_TOK_RPAR { $$ = OP2(DT_TOK_XLATE, dt_node_type($3), $6); @@ -835,4 +847,15 @@ function_parameters: | parameter_type_list { $$ = $1; } ; +dtrace_keyword_ident: + DT_KEY_PROBE { $$ = DUP("probe"); } + | DT_KEY_PROVIDER { $$ = DUP("provider"); } + | DT_KEY_SELF { $$ = DUP("self"); } + | DT_KEY_STRING { $$ = DUP("string"); } + | DT_TOK_STRINGOF { $$ = DUP("stringof"); } + | DT_KEY_USERLAND { $$ = DUP("userland"); } + | DT_TOK_XLATE { $$ = DUP("xlate"); } + | DT_KEY_XLATOR { $$ = DUP("translator"); } + ; + %% From owner-svn-src-head@FreeBSD.ORG Mon Oct 6 22:45:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 838B5A42; Mon, 6 Oct 2014 22:45:28 +0000 (UTC) Received: from mho-01-ewr.mailhop.org (mho-03-ewr.mailhop.org [204.13.248.66]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 581B8760; Mon, 6 Oct 2014 22:45:27 +0000 (UTC) Received: from [73.34.117.227] (helo=ilsoft.org) by mho-01-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1XbH1y-000FiX-4D; Mon, 06 Oct 2014 22:45:26 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id s96MjPUY029064; Mon, 6 Oct 2014 16:45:25 -0600 (MDT) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 73.34.117.227 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1/2JcPcuP2S7XaUtUy40pBW X-Authentication-Warning: paranoia.hippie.lan: Host revolution.hippie.lan [172.22.42.240] claimed to be [172.22.42.240] Subject: Re: svn commit: r272562 - head/lib/libc/stdtime From: Ian Lepore To: "Andrey A. Chernov" In-Reply-To: <201410050729.s957TpY9020060@svn.freebsd.org> References: <201410050729.s957TpY9020060@svn.freebsd.org> Content-Type: text/plain; charset="us-ascii" Date: Mon, 06 Oct 2014 16:45:24 -0600 Message-ID: <1412635524.12052.188.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 22:45:28 -0000 On Sun, 2014-10-05 at 07:29 +0000, Andrey A. Chernov wrote: > Author: ache > Date: Sun Oct 5 07:29:50 2014 > New Revision: 272562 > URL: https://svnweb.freebsd.org/changeset/base/272562 > > Log: > 1) For %Z format, understand "UTC" name too. > 2) Return NULL if timegm() fails, because it means we can convert > what we have in GMT to local time needed. > > Modified: > head/lib/libc/stdtime/strptime.c > > Modified: head/lib/libc/stdtime/strptime.c > ============================================================================== > --- head/lib/libc/stdtime/strptime.c Sun Oct 5 07:27:05 2014 (r272561) > +++ head/lib/libc/stdtime/strptime.c Sun Oct 5 07:29:50 2014 (r272562) > @@ -552,7 +552,8 @@ label: > strncpy(zonestr, buf, cp - buf); > zonestr[cp - buf] = '\0'; > tzset(); > - if (0 == strcmp(zonestr, "GMT")) { > + if (0 == strcmp(zonestr, "GMT") || > + 0 == strcmp(zonestr, "UTC")) { > *GMTp = 1; > } else if (0 == strcmp(zonestr, tzname[0])) { > tm->tm_isdst = 0; > @@ -674,6 +675,9 @@ strptime_l(const char * __restrict buf, > ret = _strptime(buf, fmt, tm, &gmt, loc); > if (ret && gmt) { > time_t t = timegm(tm); > + > + if (t == -1) > + return (NULL); > localtime_r(&t, tm); > } > > Using -1 as an error indicator in time conversions has drawbacks (your change doesn't make it any better or worse, I'm just whining in general)... revolution > date -ujf "%Y-%m-%dT%H:%M:%S" +%s 1970-01-01T0:0:0 0 revolution > date -ujf "%Y-%m-%dT%H:%M:%S" +%s 1969-12-31T23:59:58 -2 revolution > date -ujf "%Y-%m-%dT%H:%M:%S" +%s 1969-12-31T23:59:59 date: nonexistent time If timegm() and mktime() were to set errno in addition to returning -1, strptime() (and others) could use that to see the difference between errors and the second immediately before the epoch. I'm not sure of the standards-related implications of those routines setting errno though. -- Ian From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 00:52:43 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 951BE4E7; Tue, 7 Oct 2014 00:52:43 +0000 (UTC) Received: from mail-wg0-x22a.google.com (mail-wg0-x22a.google.com [IPv6:2a00:1450:400c:c00::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8E23F612; Tue, 7 Oct 2014 00:52:42 +0000 (UTC) Received: by mail-wg0-f42.google.com with SMTP id z12so7904239wgg.1 for ; Mon, 06 Oct 2014 17:52:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=XV940Ik7J3WJdItDomZRn3vq2OSJj1pYDjueTfbRCvk=; b=EUkO1bOXI1rXRog2DRit2zPi7F+YT+Y3oWwgNmte96/gry2C1HVvdhiGFl/hN9dtPz JSUUcGrwNpFr/K+IEl+ANM3+J7V/FHGXtGGyVOoLk1RuZy/63IhBAAkxmYJmWZsrVtQc UTRehzIhsQwaeGWOm//E/uJA68fE2vtbARGDrdxSU174kavHXS91UAOL5WzT1jkolXdD 2x5OLOKckH8Ivve/h9sHjB0lRw3Lmc1HRaEKEpOzCNXpqLupnuDLs42S7jxxWPMusVSf sAa5MJJKbANyC+W0i+9f2YQLpot4MYROA81Y7amlTJYq6AyK0iT9lRTv9Y5umsCA+iGO Dswg== X-Received: by 10.180.182.166 with SMTP id ef6mr7024702wic.10.1412643160838; Mon, 06 Oct 2014 17:52:40 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id o1sm18861574wja.25.2014.10.06.17.52.39 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 06 Oct 2014 17:52:40 -0700 (PDT) Date: Tue, 7 Oct 2014 02:52:37 +0200 From: Mateusz Guzik To: John Baldwin Subject: Re: svn commit: r272596 - head/sys/fs/devfs Message-ID: <20141007005237.GA32651@dft-labs.eu> References: <201410060620.s966Kaqt078736@svn.freebsd.org> <13670379.opPJl0kA6Z@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <13670379.opPJl0kA6Z@ralph.baldwin.cx> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Mateusz Guzik X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 00:52:43 -0000 On Mon, Oct 06, 2014 at 11:37:32AM -0400, John Baldwin wrote: > On Monday, October 06, 2014 06:20:36 AM Mateusz Guzik wrote: > > Author: mjg > > Date: Mon Oct 6 06:20:35 2014 > > New Revision: 272596 > > URL: https://svnweb.freebsd.org/changeset/base/272596 > > > > Log: > > devfs: don't take proctree_lock unconditionally in devfs_close > > > > MFC after: 1 week > > Just for my sanity: > > What keeps td->td_proc->p_session static in this case so that it is safe to > dereference it? Specifically, if you are preempted after reading p_session > but before you then read s_ttyvp, what prevents a race with another thread > changing the session of td->td_proc? > Right, it's buggy. Turns out devfs was quite liberal in relation to that even prior to my change. How about: diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index d7009a4..a480e4f 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -499,6 +499,7 @@ devfs_access(struct vop_access_args *ap) { struct vnode *vp = ap->a_vp; struct devfs_dirent *de; + struct proc *p; int error; de = vp->v_data; @@ -511,11 +512,14 @@ devfs_access(struct vop_access_args *ap) return (0); if (error != EACCES) return (error); + p = ap->a_td->td_proc; /* We do, however, allow access to the controlling terminal */ - if (!(ap->a_td->td_proc->p_flag & P_CONTROLT)) + if (!(p->p_flag & P_CONTROLT)) return (error); - if (ap->a_td->td_proc->p_session->s_ttydp == de->de_cdp) - return (0); + PROC_LOCK(p); + if (p->p_session->s_ttydp == de->de_cdp) + error = 0; + PROC_UNLOCK(p); return (error); } @@ -525,6 +529,7 @@ devfs_close(struct vop_close_args *ap) { struct vnode *vp = ap->a_vp, *oldvp; struct thread *td = ap->a_td; + struct proc *p; struct cdev *dev = vp->v_rdev; struct cdevsw *dsw; int vp_locked, error, ref; @@ -545,24 +550,30 @@ devfs_close(struct vop_close_args *ap) * if the reference count is 2 (this last descriptor * plus the session), release the reference from the session. */ - if (td && vp == td->td_proc->p_session->s_ttyvp) { - oldvp = NULL; - sx_xlock(&proctree_lock); - if (vp == td->td_proc->p_session->s_ttyvp) { - SESS_LOCK(td->td_proc->p_session); - VI_LOCK(vp); - if (count_dev(dev) == 2 && - (vp->v_iflag & VI_DOOMED) == 0) { - td->td_proc->p_session->s_ttyvp = NULL; - td->td_proc->p_session->s_ttydp = NULL; - oldvp = vp; + if (td != NULL) { + p = td->td_proc; + PROC_LOCK(p); + if (vp == p->p_session->s_ttyvp) { + PROC_UNLOCK(p); + oldvp = NULL; + sx_xlock(&proctree_lock); + if (vp == p->p_session->s_ttyvp) { + SESS_LOCK(p->p_session); + VI_LOCK(vp); + if (count_dev(dev) == 2 && + (vp->v_iflag & VI_DOOMED) == 0) { + p->p_session->s_ttyvp = NULL; + p->p_session->s_ttydp = NULL; + oldvp = vp; + } + VI_UNLOCK(vp); + SESS_UNLOCK(p->p_session); } - VI_UNLOCK(vp); - SESS_UNLOCK(td->td_proc->p_session); - } - sx_xunlock(&proctree_lock); - if (oldvp != NULL) - vrele(oldvp); + sx_xunlock(&proctree_lock); + if (oldvp != NULL) + vrele(oldvp); + } else + PROC_UNLOCK(p); } /* * We do not want to really close the device if it @@ -814,6 +825,7 @@ devfs_prison_check(struct devfs_dirent *de, struct thread *td) { struct cdev_priv *cdp; struct ucred *dcr; + struct proc *p; int error; cdp = de->de_cdp; @@ -827,10 +839,13 @@ devfs_prison_check(struct devfs_dirent *de, struct thread *td) if (error == 0) return (0); /* We do, however, allow access to the controlling terminal */ - if (!(td->td_proc->p_flag & P_CONTROLT)) + p = td->td_proc; + if (!(p->p_flag & P_CONTROLT)) return (error); - if (td->td_proc->p_session->s_ttydp == cdp) - return (0); + PROC_LOCK(p); + if (p->p_session->s_ttydp == cdp) + error = 0; + PROC_UNLOCK(p); return (error); } From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 03:12:09 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 26528363; Tue, 7 Oct 2014 03:12:09 +0000 (UTC) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "funkthat.com", Issuer "funkthat.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id F2880371; Tue, 7 Oct 2014 03:12:08 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id s973C6I2016643 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 6 Oct 2014 20:12:06 -0700 (PDT) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id s973C6tS016642; Mon, 6 Oct 2014 20:12:06 -0700 (PDT) (envelope-from jmg) Date: Mon, 6 Oct 2014 20:12:06 -0700 From: John-Mark Gurney To: Luigi Rizzo Subject: Re: svn commit: r272659 - in head: contrib/libpcap lib/libpcap Message-ID: <20141007031205.GF1852@funkthat.com> References: <201410061548.s96FmTNZ053516@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201410061548.s96FmTNZ053516@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Mon, 06 Oct 2014 20:12:06 -0700 (PDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 03:12:09 -0000 Luigi Rizzo wrote this message on Mon, Oct 06, 2014 at 15:48 +0000: > Author: luigi > Date: Mon Oct 6 15:48:28 2014 > New Revision: 272659 > URL: https://svnweb.freebsd.org/changeset/base/272659 > > Log: > Add netmap support to libpcap. Tcpdump and other native pcap application can now > run directly on netmap ports using netmap:foo or valeXX:YY device names. > Modifications to existing code are small and trivial, the netmap-specific > code is all in a new file. > > Please be aware that in netmap mode the physical interface is disconnected from > the host stack, so libpcap will steal the traffic not just make a copy. > > For the full version of the code (including linux and autotools support) see > https://code.google.com/p/netmap-libpcap/ > > MFC after: 3 days Please update man page before merging... Specificly w/ the warning about stealing the traffic, but also include general use too... Thanks. -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 04:54:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CC3B479D; Tue, 7 Oct 2014 04:54:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ACEE4FFE; Tue, 7 Oct 2014 04:54:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s974sDTN036618; Tue, 7 Oct 2014 04:54:13 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s974sB9a036605; Tue, 7 Oct 2014 04:54:11 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410070454.s974sB9a036605@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 7 Oct 2014 04:54:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272673 - in head: include lib/libc/string sys/conf sys/libkern sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 04:54:13 -0000 Author: delphij Date: Tue Oct 7 04:54:11 2014 New Revision: 272673 URL: https://svnweb.freebsd.org/changeset/base/272673 Log: Add explicit_bzero(3) and its kernel counterpart. Obtained from: OpenBSD MFC after: 2 weeks Added: head/lib/libc/string/explicit_bzero.c (contents, props changed) head/sys/libkern/explicit_bzero.c (contents, props changed) Modified: head/include/strings.h head/lib/libc/string/Makefile.inc head/lib/libc/string/Symbol.map head/lib/libc/string/bzero.3 head/sys/conf/files head/sys/sys/systm.h Modified: head/include/strings.h ============================================================================== --- head/include/strings.h Mon Oct 6 23:17:01 2014 (r272672) +++ head/include/strings.h Tue Oct 7 04:54:11 2014 (r272673) @@ -43,6 +43,9 @@ int bcmp(const void *, const void *, si void bcopy(const void *, void *, size_t); /* LEGACY */ void bzero(void *, size_t); /* LEGACY */ #endif +#if __BSD_VISIBLE +void explicit_bzero(void *, size_t); +#endif #if __XSI_VISIBLE int ffs(int) __pure2; #endif Modified: head/lib/libc/string/Makefile.inc ============================================================================== --- head/lib/libc/string/Makefile.inc Mon Oct 6 23:17:01 2014 (r272672) +++ head/lib/libc/string/Makefile.inc Tue Oct 7 04:54:11 2014 (r272673) @@ -6,7 +6,8 @@ CFLAGS+= -I${LIBC_SRCTOP}/locale # machine-independent string sources -MISRCS+=bcmp.c bcopy.c bzero.c ffs.c ffsl.c ffsll.c fls.c flsl.c flsll.c \ +MISRCS+=bcmp.c bcopy.c bzero.c explicit_bzero.c \ + ffs.c ffsl.c ffsll.c fls.c flsl.c flsll.c \ memccpy.c memchr.c memrchr.c memcmp.c \ memcpy.c memmem.c memmove.c memset.c \ stpcpy.c stpncpy.c strcasecmp.c \ Modified: head/lib/libc/string/Symbol.map ============================================================================== --- head/lib/libc/string/Symbol.map Mon Oct 6 23:17:01 2014 (r272672) +++ head/lib/libc/string/Symbol.map Tue Oct 7 04:54:11 2014 (r272673) @@ -100,6 +100,10 @@ FBSD_1.3 { wcwidth_l; }; +FBSD_1.4 { + explicit_bzero; +}; + FBSDprivate_1.0 { __strtok_r; }; Modified: head/lib/libc/string/bzero.3 ============================================================================== --- head/lib/libc/string/bzero.3 Mon Oct 6 23:17:01 2014 (r272672) +++ head/lib/libc/string/bzero.3 Tue Oct 7 04:54:11 2014 (r272673) @@ -35,7 +35,8 @@ .Dt BZERO 3 .Os .Sh NAME -.Nm bzero +.Nm bzero , +.Nm explicit_bzero .Nd write zeroes to a byte string .Sh LIBRARY .Lb libc @@ -43,6 +44,8 @@ .In strings.h .Ft void .Fn bzero "void *b" "size_t len" +.Ft void +.Fn explicit_bzero "void *b" "size_t len" .Sh DESCRIPTION The .Fn bzero @@ -56,6 +59,12 @@ If is zero, .Fn bzero does nothing. +.Pp +The +.Fn explicit_bzero +variant behaves the same, but will not be removed by a compiler's dead store +optimization pass, making it useful for clearing sensitive memory such as a +password. .Sh SEE ALSO .Xr memset 3 , .Xr swab 3 @@ -72,3 +81,10 @@ before it was moved to for .St -p1003.1-2001 compliance. +.Pp +The +.Fn explicit_bzero +function first appeared in +.Ox 5.5 +and +.Fx 11.0 . Added: head/lib/libc/string/explicit_bzero.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/string/explicit_bzero.c Tue Oct 7 04:54:11 2014 (r272673) @@ -0,0 +1,22 @@ +/* $OpenBSD: explicit_bzero.c,v 1.3 2014/06/21 02:34:26 matthew Exp $ */ +/* + * Public domain. + * Written by Matthew Dempsky. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +__attribute__((weak)) void +__explicit_bzero_hook(void *buf, size_t len) +{ +} + +void +explicit_bzero(void *buf, size_t len) +{ + memset(buf, 0, len); + __explicit_bzero_hook(buf, len); +} Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Oct 6 23:17:01 2014 (r272672) +++ head/sys/conf/files Tue Oct 7 04:54:11 2014 (r272673) @@ -3163,6 +3163,7 @@ libkern/arc4random.c standard libkern/bcd.c standard libkern/bsearch.c standard libkern/crc32.c standard +libkern/explicit_bzero.c standard libkern/fnmatch.c standard libkern/iconv.c optional libiconv libkern/iconv_converter_if.m optional libiconv Added: head/sys/libkern/explicit_bzero.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/libkern/explicit_bzero.c Tue Oct 7 04:54:11 2014 (r272673) @@ -0,0 +1,24 @@ +/* $OpenBSD: explicit_bzero.c,v 1.3 2014/06/21 02:34:26 matthew Exp $ */ +/* + * Public domain. + * Written by Matthew Dempsky. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +__attribute__((weak)) void __explicit_bzero_hook(void *, size_t); + +__attribute__((weak)) void +__explicit_bzero_hook(void *buf, size_t len) +{ +} + +void +explicit_bzero(void *buf, size_t len) +{ + memset(buf, 0, len); + __explicit_bzero_hook(buf, len); +} Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Mon Oct 6 23:17:01 2014 (r272672) +++ head/sys/sys/systm.h Tue Oct 7 04:54:11 2014 (r272673) @@ -232,6 +232,7 @@ void hexdump(const void *ptr, int length #define ovbcopy(f, t, l) bcopy((f), (t), (l)) void bcopy(const void *from, void *to, size_t len) __nonnull(1) __nonnull(2); void bzero(void *buf, size_t len) __nonnull(1); +void explicit_bzero(void *, size_t) __nonnull(1);; void *memcpy(void *to, const void *from, size_t len) __nonnull(1) __nonnull(2); void *memmove(void *dest, const void *src, size_t n) __nonnull(1) __nonnull(2); From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 04:54:48 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0CBD38DC; Tue, 7 Oct 2014 04:54:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED615E; Tue, 7 Oct 2014 04:54:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s974sl0T036720; Tue, 7 Oct 2014 04:54:47 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s974slin036719; Tue, 7 Oct 2014 04:54:47 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410070454.s974slin036719@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 7 Oct 2014 04:54:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272674 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 04:54:48 -0000 Author: delphij Date: Tue Oct 7 04:54:47 2014 New Revision: 272674 URL: https://svnweb.freebsd.org/changeset/base/272674 Log: Bump __FreeBSD_version for the addition of explicit_bzero(3). Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Tue Oct 7 04:54:11 2014 (r272673) +++ head/sys/sys/param.h Tue Oct 7 04:54:47 2014 (r272674) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100036 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100037 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 04:59:12 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8DCCAAE5; Tue, 7 Oct 2014 04:59:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 79BCFCD; Tue, 7 Oct 2014 04:59:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s974xCSQ037355; Tue, 7 Oct 2014 04:59:12 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s974xCKK037353; Tue, 7 Oct 2014 04:59:12 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410070459.s974xCKK037353@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 7 Oct 2014 04:59:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272675 - head/lib/libc/string X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 04:59:12 -0000 Author: delphij Date: Tue Oct 7 04:59:11 2014 New Revision: 272675 URL: https://svnweb.freebsd.org/changeset/base/272675 Log: Add MLINK for explicit_bzero(3) and bump .Dd date. MFC after: 2 weeks Modified: head/lib/libc/string/Makefile.inc head/lib/libc/string/bzero.3 Modified: head/lib/libc/string/Makefile.inc ============================================================================== --- head/lib/libc/string/Makefile.inc Tue Oct 7 04:54:47 2014 (r272674) +++ head/lib/libc/string/Makefile.inc Tue Oct 7 04:59:11 2014 (r272675) @@ -36,6 +36,7 @@ MAN+= bcmp.3 bcopy.3 bstring.3 bzero.3 f strspn.3 strstr.3 strtok.3 strxfrm.3 swab.3 wcscoll.3 wcstok.3 \ wcswidth.3 wcsxfrm.3 wmemchr.3 +MLINKS+=bzero.3 explicit_bzero.3 MLINKS+=ffs.3 ffsl.3 \ ffs.3 ffsll.3 \ ffs.3 fls.3 \ Modified: head/lib/libc/string/bzero.3 ============================================================================== --- head/lib/libc/string/bzero.3 Tue Oct 7 04:54:47 2014 (r272674) +++ head/lib/libc/string/bzero.3 Tue Oct 7 04:59:11 2014 (r272675) @@ -31,7 +31,7 @@ .\" @(#)bzero.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd October 6, 2014 .Dt BZERO 3 .Os .Sh NAME From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 05:16:07 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A90E6F1 for ; Tue, 7 Oct 2014 05:16:07 +0000 (UTC) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com [209.85.215.53]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2D48C2AA for ; Tue, 7 Oct 2014 05:16:06 +0000 (UTC) Received: by mail-la0-f53.google.com with SMTP id gq15so5561907lab.40 for ; Mon, 06 Oct 2014 22:16:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=5rsGmcl4SWZSnYTB963tSohjPmuqx+aGP93L9rWjIDg=; b=gpFAitccV6uzAdUGTIV/TTkxQ19QM8K9f8jqfD28kkzFFiD0GOI2R9xGrJfOSXFVbs /GM6oK25kRXmz1wO9z22UuPQfDrC0MBoBnmM/AofMIz8uCnYYV+Oq6wxRsNRrXqNurA9 yUCUX8l3D7c8f/lwUyb/CoIcTLZ0ZYazmzSvNxMgAmoPlGMVgKsjSFFxwXCGKsd2oEWW AuuPIt8Uh6Go08UJzF0e1CMnHppV5bGCCyrz72DiTch3pCpGw8a2x7RJ2farxKBH9VuZ axQl+47k7DKVSxoPpqV8zke7nhJYwIrq7qwEy6dc7p+yg+MRLjcZgQASU9eCJHjMoO2v rQPQ== X-Gm-Message-State: ALoCoQmwwIHhklA3sybAZVt9onmGjRjac73I9MtaNt+8D0F0PuDRwxriTyqyVQ7uL228F0GQ0738 X-Received: by 10.112.209.2 with SMTP id mi2mr1252235lbc.51.1412658963983; Mon, 06 Oct 2014 22:16:03 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by mx.google.com with ESMTPSA id n4sm6358796lah.2.2014.10.06.22.16.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Oct 2014 22:16:03 -0700 (PDT) Message-ID: <54337712.4090202@freebsd.org> Date: Tue, 07 Oct 2014 09:16:02 +0400 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: Ian Lepore Subject: Re: svn commit: r272562 - head/lib/libc/stdtime References: <201410050729.s957TpY9020060@svn.freebsd.org> <1412635524.12052.188.camel@revolution.hippie.lan> In-Reply-To: <1412635524.12052.188.camel@revolution.hippie.lan> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 05:16:07 -0000 On 07.10.2014 2:45, Ian Lepore wrote: > Using -1 as an error indicator in time conversions has drawbacks (your > change doesn't make it any better or worse, I'm just whining in > general)... > > revolution > date -ujf "%Y-%m-%dT%H:%M:%S" +%s 1970-01-01T0:0:0 > 0 > revolution > date -ujf "%Y-%m-%dT%H:%M:%S" +%s 1969-12-31T23:59:58 > -2 > revolution > date -ujf "%Y-%m-%dT%H:%M:%S" +%s 1969-12-31T23:59:59 > date: nonexistent time > > If timegm() and mktime() were to set errno in addition to returning -1, > strptime() (and others) could use that to see the difference between > errors and the second immediately before the epoch. I'm not sure of the > standards-related implications of those routines setting errno though. POSIX, Base Specs, Issue 7, mktime says: "If the time since the Epoch cannot be represented, the function shall return the value (time_t)−1 and set errno to indicate the error. ... [EOVERFLOW] The result cannot be represented." But we don't set EOVERFLOW inside timegm or mktime... About negative time_t values, POSIX, Seconds Since the Epoch, says: "...is related to a time represented as seconds since the Epoch... If the year is <1970 or the value is negative, the relationship is undefined." So, we are free to either treat all negative values as errors or set EOVERFLOW in our time functions and add a check to every lib & program since nobody checks it. I'll think about this place more.. -- http://ache.vniz.net/ From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 06:02:09 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9E1E48CA; Tue, 7 Oct 2014 06:02:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A44A971; Tue, 7 Oct 2014 06:02:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s97629WJ069973; Tue, 7 Oct 2014 06:02:09 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s97629cO069972; Tue, 7 Oct 2014 06:02:09 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201410070602.s97629cO069972@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Tue, 7 Oct 2014 06:02:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272678 - head/lib/libc/stdtime X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 06:02:09 -0000 Author: ache Date: Tue Oct 7 06:02:08 2014 New Revision: 272678 URL: https://svnweb.freebsd.org/changeset/base/272678 Log: Back out timegm error check from r272562. POSIX treats negative time_t as undefined (i.e. may be valid too, depends on system's policy we don't have) and we don't set EOVERFLOW in mktime/timegm as POSIX requires to surely distinguish -1 return as valid negative time from -1 as error return. Modified: head/lib/libc/stdtime/strptime.c Modified: head/lib/libc/stdtime/strptime.c ============================================================================== --- head/lib/libc/stdtime/strptime.c Tue Oct 7 06:00:32 2014 (r272677) +++ head/lib/libc/stdtime/strptime.c Tue Oct 7 06:02:08 2014 (r272678) @@ -676,8 +676,6 @@ strptime_l(const char * __restrict buf, if (ret && gmt) { time_t t = timegm(tm); - if (t == -1) - return (NULL); localtime_r(&t, tm); } From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 06:34:06 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0FADBE40; Tue, 7 Oct 2014 06:34:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EFD35C3F; Tue, 7 Oct 2014 06:34:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s976Y5cc084777; Tue, 7 Oct 2014 06:34:05 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s976Y5CS084776; Tue, 7 Oct 2014 06:34:05 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201410070634.s976Y5CS084776@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Tue, 7 Oct 2014 06:34:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272679 - head/lib/libc/stdtime X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 06:34:06 -0000 Author: ache Date: Tue Oct 7 06:34:05 2014 New Revision: 272679 URL: https://svnweb.freebsd.org/changeset/base/272679 Log: 1) Fix the case we have less arguments for format string than we expected. 2) Return error on unsupported format specs. (both according to POSIX) PR: 93197 Modified: head/lib/libc/stdtime/strptime.c Modified: head/lib/libc/stdtime/strptime.c ============================================================================== --- head/lib/libc/stdtime/strptime.c Tue Oct 7 06:02:08 2014 (r272678) +++ head/lib/libc/stdtime/strptime.c Tue Oct 7 06:34:05 2014 (r272679) @@ -103,9 +103,6 @@ _strptime(const char *buf, const char *f ptr = fmt; while (*ptr != 0) { - if (*buf == 0) - break; - c = *ptr++; if (c != '%') { @@ -123,7 +120,6 @@ _strptime(const char *buf, const char *f label: c = *ptr++; switch (c) { - case 0: case '%': if (*buf++ != '%') return (NULL); @@ -600,6 +596,9 @@ label: while (isspace_l((unsigned char)*buf, locale)) buf++; break; + + default: + return (NULL); } } From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 07:33:44 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8C100C0D; Tue, 7 Oct 2014 07:33:44 +0000 (UTC) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 4E84436B; Tue, 7 Oct 2014 07:33:43 +0000 (UTC) Received: from nine.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id 876D96D65; Tue, 7 Oct 2014 07:33:42 +0000 (UTC) Received: by nine.des.no (Postfix, from userid 1001) id 8D0E8452F; Tue, 7 Oct 2014 09:33:46 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Xin LI Subject: Re: svn commit: r272673 - in head: include lib/libc/string sys/conf sys/libkern sys/sys References: <201410070454.s974sB9a036605@svn.freebsd.org> Date: Tue, 07 Oct 2014 09:33:46 +0200 In-Reply-To: <201410070454.s974sB9a036605@svn.freebsd.org> (Xin LI's message of "Tue, 7 Oct 2014 04:54:11 +0000 (UTC)") Message-ID: <86lhos72qt.fsf@nine.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 07:33:44 -0000 Xin LI writes: > Log: > Add explicit_bzero(3) and its kernel counterpart. I would much prefer that we add memset_s(3) from C11, which predates explicit_bzero(3) by either three or five years (depending on whether you count from the publication date or the proposal date). In the longer term, we should also consider adding the rest of annex K. Here's a patch for NetBSD (which was never accepted): https://mail-index.netbsd.org/tech-userlevel/2012/02/24/msg006125.html I realize that these extensions are controversial, but I still believe that having them is better than not having them. As the WG points out, the intention with gets_s(3) and scanf_s(3) is not to encourage the use of those interfaces, but to make it easier to retrofit code that uses gets(3) and scanf(3). DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 10:04:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 877D239F; Tue, 7 Oct 2014 10:04:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 730CF763; Tue, 7 Oct 2014 10:04:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s97A4Q3N086056; Tue, 7 Oct 2014 10:04:26 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s97A4Qo1086054; Tue, 7 Oct 2014 10:04:26 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201410071004.s97A4Qo1086054@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 7 Oct 2014 10:04:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272683 - in head/sys/ofed: drivers/net/mlx4 include/linux/mlx4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 10:04:26 -0000 Author: hselasky Date: Tue Oct 7 10:04:25 2014 New Revision: 272683 URL: https://svnweb.freebsd.org/changeset/base/272683 Log: Fix compile warning when compiling with GCC. MFC after: 3 days Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/net/mlx4/mlx4.h head/sys/ofed/include/linux/mlx4/device.h Modified: head/sys/ofed/drivers/net/mlx4/mlx4.h ============================================================================== --- head/sys/ofed/drivers/net/mlx4/mlx4.h Tue Oct 7 08:23:37 2014 (r272682) +++ head/sys/ofed/drivers/net/mlx4/mlx4.h Tue Oct 7 10:04:25 2014 (r272683) @@ -1234,6 +1234,7 @@ int mlx4_trans_to_dmfs_attach(struct mlx u8 gid[16], u8 port, int block_mcast_loopback, enum mlx4_protocol prot, u64 *reg_id); +int mlx4_SET_MCAST_FLTR(struct mlx4_dev *dev, u8 port, u64 mac, u64 clear, u8 mode); int mlx4_SET_MCAST_FLTR_wrapper(struct mlx4_dev *dev, int slave, struct mlx4_vhcr *vhcr, struct mlx4_cmd_mailbox *inbox, Modified: head/sys/ofed/include/linux/mlx4/device.h ============================================================================== --- head/sys/ofed/include/linux/mlx4/device.h Tue Oct 7 08:23:37 2014 (r272682) +++ head/sys/ofed/include/linux/mlx4/device.h Tue Oct 7 10:04:25 2014 (r272683) @@ -1208,7 +1208,6 @@ int mlx4_multicast_promisc_add(struct ml int mlx4_multicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port); int mlx4_unicast_promisc_add(struct mlx4_dev *dev, u32 qpn, u8 port); int mlx4_unicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port); -int mlx4_SET_MCAST_FLTR(struct mlx4_dev *dev, u8 port, u64 mac, u64 clear, u8 mode); int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac); void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac); From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 13:31:05 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 38C07B9B; Tue, 7 Oct 2014 13:31:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 255E6EE7; Tue, 7 Oct 2014 13:31:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s97DV57Z088378; Tue, 7 Oct 2014 13:31:05 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s97DV5hB088377; Tue, 7 Oct 2014 13:31:05 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201410071331.s97DV5hB088377@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 7 Oct 2014 13:31:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272695 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 13:31:05 -0000 Author: ae Date: Tue Oct 7 13:31:04 2014 New Revision: 272695 URL: https://svnweb.freebsd.org/changeset/base/272695 Log: Our packet filters use mbuf's rcvif pointer to determine incoming interface. Change mbuf's rcvif to enc0 and restore it after pfil processing. PR: 110959 Sponsored by: Yandex LLC Modified: head/sys/net/if_enc.c Modified: head/sys/net/if_enc.c ============================================================================== --- head/sys/net/if_enc.c Tue Oct 7 13:30:42 2014 (r272694) +++ head/sys/net/if_enc.c Tue Oct 7 13:31:04 2014 (r272695) @@ -230,6 +230,7 @@ ipsec_filter(struct mbuf **mp, int dir, { int error, i; struct ip *ip; + struct ifnet *rcvif; KASSERT(encif != NULL, ("%s: encif is null", __func__)); KASSERT(flags & (ENC_IN|ENC_OUT), @@ -268,6 +269,8 @@ ipsec_filter(struct mbuf **mp, int dir, } error = 0; + rcvif = (*mp)->m_pkthdr.rcvif; + (*mp)->m_pkthdr.rcvif = encif; ip = mtod(*mp, struct ip *); switch (ip->ip_v) { #ifdef INET @@ -298,6 +301,7 @@ ipsec_filter(struct mbuf **mp, int dir, if (error != 0) goto bad; + (*mp)->m_pkthdr.rcvif = rcvif; return (error); bad: From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 14:05:04 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E9751DA2; Tue, 7 Oct 2014 14:05:04 +0000 (UTC) Received: from mail.fer.hr (mail.fer.hr [161.53.72.233]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client CN "mail.fer.hr", Issuer "TERENA SSL CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7DA9238F; Tue, 7 Oct 2014 14:05:04 +0000 (UTC) Received: from x23 (31.147.124.153) by MAIL.fer.hr (161.53.72.233) with Microsoft SMTP Server (TLS) id 14.2.342.3; Tue, 7 Oct 2014 16:03:51 +0200 Date: Tue, 7 Oct 2014 16:04:05 +0200 From: Marko Zec To: "Andrey V. Elsukov" Subject: Re: svn commit: r272695 - head/sys/net Message-ID: <20141007160405.35f52792@x23> In-Reply-To: <201410071331.s97DV5hB088377@svn.freebsd.org> References: <201410071331.s97DV5hB088377@svn.freebsd.org> X-Mailer: Claws Mail 3.9.2 (GTK+ 2.24.19; amd64-portbld-freebsd9.1) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [31.147.124.153] Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 14:05:05 -0000 On Tue, 7 Oct 2014 13:31:05 +0000 "Andrey V. Elsukov" wrote: > Author: ae > Date: Tue Oct 7 13:31:04 2014 > New Revision: 272695 > URL: https://svnweb.freebsd.org/changeset/base/272695 > > Log: > Our packet filters use mbuf's rcvif pointer to determine incoming > interface. Change mbuf's rcvif to enc0 and restore it after pfil > processing. Will this work / was this tested with options VIMAGE, where m_pkthdr.rcvif->if_vnet will no longer match curvnet, except in vnet0? Marko > PR: 110959 > Sponsored by: Yandex LLC > > Modified: > head/sys/net/if_enc.c > > Modified: head/sys/net/if_enc.c > ============================================================================== > --- head/sys/net/if_enc.c Tue Oct 7 13:30:42 2014 > (r272694) +++ head/sys/net/if_enc.c Tue Oct 7 13:31:04 > 2014 (r272695) @@ -230,6 +230,7 @@ ipsec_filter(struct mbuf > **mp, int dir, { > int error, i; > struct ip *ip; > + struct ifnet *rcvif; > > KASSERT(encif != NULL, ("%s: encif is null", __func__)); > KASSERT(flags & (ENC_IN|ENC_OUT), > @@ -268,6 +269,8 @@ ipsec_filter(struct mbuf **mp, int dir, > } > > error = 0; > + rcvif = (*mp)->m_pkthdr.rcvif; > + (*mp)->m_pkthdr.rcvif = encif; > ip = mtod(*mp, struct ip *); > switch (ip->ip_v) { > #ifdef INET > @@ -298,6 +301,7 @@ ipsec_filter(struct mbuf **mp, int dir, > if (error != 0) > goto bad; > > + (*mp)->m_pkthdr.rcvif = rcvif; > return (error); > > bad: > From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 14:15:51 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 21D127A8; Tue, 7 Oct 2014 14:15:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0E0DA783; Tue, 7 Oct 2014 14:15:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s97EFoUf012417; Tue, 7 Oct 2014 14:15:50 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s97EFoTC012416; Tue, 7 Oct 2014 14:15:50 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201410071415.s97EFoTC012416@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 7 Oct 2014 14:15:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272701 - head/sys/cddl/compat/opensolaris/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 14:15:51 -0000 Author: avg Date: Tue Oct 7 14:15:50 2014 New Revision: 272701 URL: https://svnweb.freebsd.org/changeset/base/272701 Log: make userland __assfail from opensolaris compat honor 'aok' variable This should allow zdb -A option to actually make difference. MFC after: 2 weeks Modified: head/sys/cddl/compat/opensolaris/sys/assfail.h Modified: head/sys/cddl/compat/opensolaris/sys/assfail.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/assfail.h Tue Oct 7 14:09:05 2014 (r272700) +++ head/sys/cddl/compat/opensolaris/sys/assfail.h Tue Oct 7 14:15:50 2014 (r272701) @@ -46,20 +46,24 @@ void assfail3(const char *, uintmax_t, c #else /* !defined(_KERNEL) */ #ifndef HAVE_ASSFAIL +extern int aok; + static __inline int __assfail(const char *expr, const char *file, int line) { (void)fprintf(stderr, "Assertion failed: (%s), file %s, line %d.\n", expr, file, line); - abort(); - /* NOTREACHED */ + if (!aok) + abort(); return (0); } #define assfail __assfail #endif #ifndef HAVE_ASSFAIL3 +extern int aok; + static __inline void __assfail3(const char *expr, uintmax_t lv, const char *op, uintmax_t rv, const char *file, int line) { @@ -67,8 +71,8 @@ __assfail3(const char *expr, uintmax_t l (void)fprintf(stderr, "Assertion failed: %s (0x%jx %s 0x%jx), file %s, line %d.\n", expr, lv, op, rv, file, line); - abort(); - /* NOTREACHED */ + if (!aok) + abort(); } #define assfail3 __assfail3 #endif From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 14:18:46 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:1900:2254:206a::19:2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 43F06D0C; Tue, 7 Oct 2014 14:18:46 +0000 (UTC) Received: from butcher-nb.yandex.net (hub.freebsd.org [IPv6:2001:1900:2254:206c::16:88]) by mx2.freebsd.org (Postfix) with ESMTP id 1AA74254D; Tue, 7 Oct 2014 14:18:44 +0000 (UTC) Message-ID: <5433F5EE.3010006@FreeBSD.org> Date: Tue, 07 Oct 2014 18:17:18 +0400 From: "Andrey V. Elsukov" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: Marko Zec Subject: Re: svn commit: r272695 - head/sys/net References: <201410071331.s97DV5hB088377@svn.freebsd.org> <20141007160405.35f52792@x23> In-Reply-To: <20141007160405.35f52792@x23> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 14:18:46 -0000 On 07.10.2014 18:04, Marko Zec wrote: > On Tue, 7 Oct 2014 13:31:05 +0000 > "Andrey V. Elsukov" wrote: > >> Author: ae >> Date: Tue Oct 7 13:31:04 2014 >> New Revision: 272695 >> URL: https://svnweb.freebsd.org/changeset/base/272695 >> >> Log: >> Our packet filters use mbuf's rcvif pointer to determine incoming >> interface. Change mbuf's rcvif to enc0 and restore it after pfil >> processing. > > Will this work / was this tested with options VIMAGE, where > m_pkthdr.rcvif->if_vnet will no longer match curvnet, except in vnet0? I tested only without VIMAGE. ipfw and pf use if_xname field to compare interfaces. So will this work? -- WBR, Andrey V. Elsukov From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 14:30:25 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A7FF318C; Tue, 7 Oct 2014 14:30:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 935618E3; Tue, 7 Oct 2014 14:30:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s97EUP6A019296; Tue, 7 Oct 2014 14:30:25 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s97EUPIq019272; Tue, 7 Oct 2014 14:30:25 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201410071430.s97EUPIq019272@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 7 Oct 2014 14:30:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272702 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 14:30:25 -0000 Author: avg Date: Tue Oct 7 14:30:24 2014 New Revision: 272702 URL: https://svnweb.freebsd.org/changeset/base/272702 Log: reduce L2ARC_WRITE_SIZE on FreeBSD FreeBSD has ARC_BUFC_NUMMETADATALISTS metadata lists and ARC_BUFC_NUMDATALISTS data lists (currently both are 16) while illumos has just a single list of each kind. L2ARC_WRITE_SIZE determines the default value of l2arc_write_max which defines limits on how much data is scanned and written to a cache device during each run of the l2arc feed thread. The limits are applied on the per buffer list basis. Because FreeBSD has more lists we proportionally reduce the limits. Reviewed by: Brendan Gregg (earlier version) MFC after: 2 weeks Sponsored by: HybridCluster Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Oct 7 14:15:50 2014 (r272701) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Oct 7 14:30:24 2014 (r272702) @@ -711,7 +711,9 @@ uint64_t zfs_crc64_table[256]; * Level 2 ARC */ -#define L2ARC_WRITE_SIZE (8 * 1024 * 1024) /* initial write max */ +/* initial write max */ +#define L2ARC_WRITE_SIZE \ + (8 * 1024 * 1024 * 2 / (ARC_BUFC_NUMMETADATALISTS + ARC_BUFC_NUMDATALISTS)) #define L2ARC_HEADROOM 2 /* num of writes */ /* * If we discover during ARC scan any buffers to be compressed, we boost From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 15:13:44 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 467E751A; Tue, 7 Oct 2014 15:13:44 +0000 (UTC) Received: from mail.fer.hr (mail.fer.hr [161.53.72.233]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client CN "mail.fer.hr", Issuer "TERENA SSL CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CE3D9DFD; Tue, 7 Oct 2014 15:13:43 +0000 (UTC) Received: from x23 (31.147.124.153) by MAIL.fer.hr (161.53.72.233) with Microsoft SMTP Server (TLS) id 14.2.342.3; Tue, 7 Oct 2014 17:13:40 +0200 Date: Tue, 7 Oct 2014 17:13:55 +0200 From: Marko Zec To: "Andrey V. Elsukov" Subject: Re: svn commit: r272695 - head/sys/net Message-ID: <20141007171355.6e4da644@x23> In-Reply-To: <5433F5EE.3010006@FreeBSD.org> References: <201410071331.s97DV5hB088377@svn.freebsd.org> <20141007160405.35f52792@x23> <5433F5EE.3010006@FreeBSD.org> X-Mailer: Claws Mail 3.9.2 (GTK+ 2.24.19; amd64-portbld-freebsd9.1) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [31.147.124.153] Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 15:13:44 -0000 On Tue, 7 Oct 2014 18:17:18 +0400 "Andrey V. Elsukov" wrote: > On 07.10.2014 18:04, Marko Zec wrote: > > On Tue, 7 Oct 2014 13:31:05 +0000 > > "Andrey V. Elsukov" wrote: > > > >> Author: ae > >> Date: Tue Oct 7 13:31:04 2014 > >> New Revision: 272695 > >> URL: https://svnweb.freebsd.org/changeset/base/272695 > >> > >> Log: > >> Our packet filters use mbuf's rcvif pointer to determine incoming > >> interface. Change mbuf's rcvif to enc0 and restore it after pfil > >> processing. > > > > Will this work / was this tested with options VIMAGE, where > > m_pkthdr.rcvif->if_vnet will no longer match curvnet, except in > > vnet0? > > I tested only without VIMAGE. ipfw and pf use if_xname field to > compare interfaces. So will this work? I have no idea whether this would work now, but this change implies that no pfil consumer should reference m_pkthdr.rcvif->if_vnet from now on, ever. Which doesn't seem right to me. If changing m_pkthdr.rcvif to enc0 in ipsec_filter() is really unavoidable, perhaps we could introduce enc0 for each vnet, maybe in a similar manner how hrs@ virtualized gif (271917) and gre (271918) cloners, which (gif) apparently seem to be at the root of the PR 110959 referenced here. Marko From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 16:01:17 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EF2B19C8; Tue, 7 Oct 2014 16:01:17 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB2E064C; Tue, 7 Oct 2014 16:01:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s97G1H81065973; Tue, 7 Oct 2014 16:01:17 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s97G1H0f065972; Tue, 7 Oct 2014 16:01:17 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201410071601.s97G1H0f065972@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 7 Oct 2014 16:01:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272706 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 16:01:18 -0000 Author: tuexen Date: Tue Oct 7 16:01:17 2014 New Revision: 272706 URL: https://svnweb.freebsd.org/changeset/base/272706 Log: Fix a bug introduced in https://svnweb.freebsd.org/base?view=revision&revision=272347 MFC after: 3 days Modified: head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Tue Oct 7 15:21:20 2014 (r272705) +++ head/sys/netinet6/udp6_usrreq.c Tue Oct 7 16:01:17 2014 (r272706) @@ -265,7 +265,7 @@ udp6_input(struct mbuf **mp, int *offp, if (uh_sum != 0) { UDPSTAT_INC(udps_badsum); - /*goto badunlocked;*/ + goto badunlocked; } /* From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 16:06:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 84FE1EEF; Tue, 7 Oct 2014 16:06:11 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 70D8A785; Tue, 7 Oct 2014 16:06:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s97G6BA2067006; Tue, 7 Oct 2014 16:06:11 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s97G6Bej067004; Tue, 7 Oct 2014 16:06:11 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201410071606.s97G6Bej067004@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 7 Oct 2014 16:06:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272707 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 16:06:11 -0000 Author: avg Date: Tue Oct 7 16:06:10 2014 New Revision: 272707 URL: https://svnweb.freebsd.org/changeset/base/272707 Log: revert r272702: wrong (earlier) change was committed Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Oct 7 16:01:17 2014 (r272706) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Oct 7 16:06:10 2014 (r272707) @@ -711,9 +711,7 @@ uint64_t zfs_crc64_table[256]; * Level 2 ARC */ -/* initial write max */ -#define L2ARC_WRITE_SIZE \ - (8 * 1024 * 1024 * 2 / (ARC_BUFC_NUMMETADATALISTS + ARC_BUFC_NUMDATALISTS)) +#define L2ARC_WRITE_SIZE (8 * 1024 * 1024) /* initial write max */ #define L2ARC_HEADROOM 2 /* num of writes */ /* * If we discover during ARC scan any buffers to be compressed, we boost From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 16:08:22 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4CB88120; Tue, 7 Oct 2014 16:08:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 38A767B5; Tue, 7 Oct 2014 16:08:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s97G8MOx067344; Tue, 7 Oct 2014 16:08:22 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s97G8MVc067343; Tue, 7 Oct 2014 16:08:22 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201410071608.s97G8MVc067343@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 7 Oct 2014 16:08:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272708 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 16:08:22 -0000 Author: avg Date: Tue Oct 7 16:08:21 2014 New Revision: 272708 URL: https://svnweb.freebsd.org/changeset/base/272708 Log: l2arc_write_buffers: reduce headroom value FreeBSD has ARC_BUFC_NUMMETADATALISTS metadata lists and ARC_BUFC_NUMDATALISTS data lists (currently both are 16) while illumos has just a single list of each kind. headroom determines how much data is scanned on a single list during each run of the l2arc feed thread. Because FreeBSD has more lists we proportionally decrease the limit. Reviewed by: Brendan Gregg (earlier version) MFC after: 2 weeks Sponsored by: HybridCluster Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Oct 7 16:06:10 2014 (r272707) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Oct 7 16:08:21 2014 (r272708) @@ -5047,7 +5047,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_de if (ab == NULL) ARCSTAT_BUMP(arcstat_l2_write_buffer_list_null_iter); - headroom = target_sz * l2arc_headroom; + headroom = target_sz * l2arc_headroom * 2 / ARC_BUFC_NUMLISTS; if (do_headroom_boost) headroom = (headroom * l2arc_headroom_boost) / 100; From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 16:22:24 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B74075F1; Tue, 7 Oct 2014 16:22:24 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 750D5981; Tue, 7 Oct 2014 16:22:24 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 6CCA4B976; Tue, 7 Oct 2014 12:22:23 -0400 (EDT) From: John Baldwin To: Mateusz Guzik Subject: Re: svn commit: r272596 - head/sys/fs/devfs Date: Tue, 7 Oct 2014 11:00:38 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20140415; KDE/4.5.5; amd64; ; ) References: <201410060620.s966Kaqt078736@svn.freebsd.org> <13670379.opPJl0kA6Z@ralph.baldwin.cx> <20141007005237.GA32651@dft-labs.eu> In-Reply-To: <20141007005237.GA32651@dft-labs.eu> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201410071100.38827.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 07 Oct 2014 12:22:23 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Mateusz Guzik X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 16:22:24 -0000 On Monday, October 06, 2014 8:52:37 pm Mateusz Guzik wrote: > On Mon, Oct 06, 2014 at 11:37:32AM -0400, John Baldwin wrote: > > On Monday, October 06, 2014 06:20:36 AM Mateusz Guzik wrote: > > > Author: mjg > > > Date: Mon Oct 6 06:20:35 2014 > > > New Revision: 272596 > > > URL: https://svnweb.freebsd.org/changeset/base/272596 > > > > > > Log: > > > devfs: don't take proctree_lock unconditionally in devfs_close > > > > > > MFC after: 1 week > > > > Just for my sanity: > > > > What keeps td->td_proc->p_session static in this case so that it is safe to > > dereference it? Specifically, if you are preempted after reading p_session > > but before you then read s_ttyvp, what prevents a race with another thread > > changing the session of td->td_proc? > > > > Right, it's buggy. > > Turns out devfs was quite liberal in relation to that even prior to my > change. > > How about: > > diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c > index d7009a4..a480e4f 100644 > --- a/sys/fs/devfs/devfs_vnops.c > +++ b/sys/fs/devfs/devfs_vnops.c > @@ -499,6 +499,7 @@ devfs_access(struct vop_access_args *ap) > { > struct vnode *vp = ap->a_vp; > struct devfs_dirent *de; > + struct proc *p; > int error; > > de = vp->v_data; > @@ -511,11 +512,14 @@ devfs_access(struct vop_access_args *ap) > return (0); > if (error != EACCES) > return (error); > + p = ap->a_td->td_proc; > /* We do, however, allow access to the controlling terminal */ > - if (!(ap->a_td->td_proc->p_flag & P_CONTROLT)) > + if (!(p->p_flag & P_CONTROLT)) > return (error); > - if (ap->a_td->td_proc->p_session->s_ttydp == de->de_cdp) > - return (0); > + PROC_LOCK(p); > + if (p->p_session->s_ttydp == de->de_cdp) > + error = 0; > + PROC_UNLOCK(p); > return (error); > } > > @@ -525,6 +529,7 @@ devfs_close(struct vop_close_args *ap) > { > struct vnode *vp = ap->a_vp, *oldvp; > struct thread *td = ap->a_td; > + struct proc *p; > struct cdev *dev = vp->v_rdev; > struct cdevsw *dsw; > int vp_locked, error, ref; > @@ -545,24 +550,30 @@ devfs_close(struct vop_close_args *ap) > * if the reference count is 2 (this last descriptor > * plus the session), release the reference from the session. > */ > - if (td && vp == td->td_proc->p_session->s_ttyvp) { > - oldvp = NULL; > - sx_xlock(&proctree_lock); > - if (vp == td->td_proc->p_session->s_ttyvp) { > - SESS_LOCK(td->td_proc->p_session); > - VI_LOCK(vp); > - if (count_dev(dev) == 2 && > - (vp->v_iflag & VI_DOOMED) == 0) { > - td->td_proc->p_session->s_ttyvp = NULL; > - td->td_proc->p_session->s_ttydp = NULL; > - oldvp = vp; > + if (td != NULL) { > + p = td->td_proc; > + PROC_LOCK(p); > + if (vp == p->p_session->s_ttyvp) { > + PROC_UNLOCK(p); > + oldvp = NULL; > + sx_xlock(&proctree_lock); > + if (vp == p->p_session->s_ttyvp) { > + SESS_LOCK(p->p_session); > + VI_LOCK(vp); > + if (count_dev(dev) == 2 && > + (vp->v_iflag & VI_DOOMED) == 0) { > + p->p_session->s_ttyvp = NULL; > + p->p_session->s_ttydp = NULL; > + oldvp = vp; > + } > + VI_UNLOCK(vp); > + SESS_UNLOCK(p->p_session); > } > - VI_UNLOCK(vp); > - SESS_UNLOCK(td->td_proc->p_session); > - } > - sx_xunlock(&proctree_lock); > - if (oldvp != NULL) > - vrele(oldvp); > + sx_xunlock(&proctree_lock); > + if (oldvp != NULL) > + vrele(oldvp); > + } else > + PROC_UNLOCK(p); > } > /* > * We do not want to really close the device if it > @@ -814,6 +825,7 @@ devfs_prison_check(struct devfs_dirent *de, struct thread *td) > { > struct cdev_priv *cdp; > struct ucred *dcr; > + struct proc *p; > int error; > > cdp = de->de_cdp; > @@ -827,10 +839,13 @@ devfs_prison_check(struct devfs_dirent *de, struct thread *td) > if (error == 0) > return (0); > /* We do, however, allow access to the controlling terminal */ > - if (!(td->td_proc->p_flag & P_CONTROLT)) > + p = td->td_proc; > + if (!(p->p_flag & P_CONTROLT)) > return (error); > - if (td->td_proc->p_session->s_ttydp == cdp) > - return (0); > + PROC_LOCK(p); > + if (p->p_session->s_ttydp == cdp) > + error = 0; > + PROC_UNLOCK(p); > return (error); > } I think this is fine (and I've had one of these fixes in a side branch forever myself). In my version I held PROC_LOCK while checking P_CONTROLT. I think you might need that in case another thread in the same process is invoking TIOCSCTTY. (I am assuming that the thread variables in devfs_access() and devfs_prison_check() are in fact curthread. If they weren't, I think you'd definitely need the lock. Since TIOCSCTTY acts on curthread, you could get by without the lock for reading the flag for curproc for a single-threaded process, but not for a multi-threaded one.) -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 16:28:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EF01EABA; Tue, 7 Oct 2014 16:28:17 +0000 (UTC) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id AFE56A46; Tue, 7 Oct 2014 16:28:17 +0000 (UTC) Received: from nine.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id E553DAFEC; Tue, 7 Oct 2014 16:28:09 +0000 (UTC) Received: by nine.des.no (Postfix, from userid 1001) id 2218845EF; Tue, 7 Oct 2014 18:28:14 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Dimitry Andric Subject: Re: svn commit: r272281 - head/lib/libpam/modules/pam_login_access References: <201409291036.s8TAaFUs040310@svn.freebsd.org> Date: Tue, 07 Oct 2014 18:28:13 +0200 In-Reply-To: (Dimitry Andric's message of "Mon, 29 Sep 2014 13:10:03 +0200") Message-ID: <86h9zfondu.fsf@nine.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, "Bjoern A. Zeeb" , src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 16:28:18 -0000 Dimitry Andric writes: > And why is 'user' not a char * to begin with? :) man 3 pam_get_item + C rules about casting pointers. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 16:40:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3D564F71; Tue, 7 Oct 2014 16:40:54 +0000 (UTC) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id F0D31BA2; Tue, 7 Oct 2014 16:40:53 +0000 (UTC) Received: from nine.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id 38F3BC02C; Tue, 7 Oct 2014 16:40:53 +0000 (UTC) Received: by nine.des.no (Postfix, from userid 1001) id 6C51545F3; Tue, 7 Oct 2014 18:40:57 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Bruce Evans Subject: Re: svn commit: r272281 - head/lib/libpam/modules/pam_login_access References: <201409291036.s8TAaFUs040310@svn.freebsd.org> <4929EC39-0862-4547-B044-44C396529F74@FreeBSD.org> <20140929233019.C2907@besplex.bde.org> Date: Tue, 07 Oct 2014 18:40:57 +0200 In-Reply-To: <20140929233019.C2907@besplex.bde.org> (Bruce Evans's message of "Mon, 29 Sep 2014 23:56:59 +1000 (EST)") Message-ID: <86d2a3omsm.fsf@nine.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, "Bjoern A. Zeeb" , Dimitry Andric , src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 16:40:54 -0000 Bruce Evans writes: > Other bugs in PAM_VERBOSE_ERROR()'s function [...] PAM_VERBOSE_ERROR should die. The only reason I didn't kill it way back when was to avoid extensive modifications to existing modules. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 17:08:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9ACA7EAD; Tue, 7 Oct 2014 17:08:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 85E9BF32; Tue, 7 Oct 2014 17:08:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s97H8smh097320; Tue, 7 Oct 2014 17:08:54 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s97H8sfT097319; Tue, 7 Oct 2014 17:08:54 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201410071708.s97H8sfT097319@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Tue, 7 Oct 2014 17:08:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272710 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 17:08:54 -0000 Author: neel Date: Tue Oct 7 17:08:53 2014 New Revision: 272710 URL: https://svnweb.freebsd.org/changeset/base/272710 Log: Implement the FLUSH operation in the virtio-block emulation. This gets rid of the following error message during FreeBSD guest bootup: "vtbd0: hard error cmd=flush fsbn 0" Reported by: rodrigc Reviewed by: grehan Modified: head/usr.sbin/bhyve/pci_virtio_block.c Modified: head/usr.sbin/bhyve/pci_virtio_block.c ============================================================================== --- head/usr.sbin/bhyve/pci_virtio_block.c Tue Oct 7 16:46:11 2014 (r272709) +++ head/usr.sbin/bhyve/pci_virtio_block.c Tue Oct 7 17:08:53 2014 (r272710) @@ -94,6 +94,8 @@ struct vtblk_config { struct virtio_blk_hdr { #define VBH_OP_READ 0 #define VBH_OP_WRITE 1 +#define VBH_OP_FLUSH 4 +#define VBH_OP_FLUSH_OUT 5 #define VBH_OP_IDENT 8 #define VBH_FLAG_BARRIER 0x80000000 /* OR'ed into vbh_type */ uint32_t vbh_type; @@ -217,6 +219,10 @@ pci_vtblk_proc(struct pci_vtblk_softc *s MIN(iov[1].iov_len, sizeof(sc->vbsc_ident))); err = 0; break; + case VBH_OP_FLUSH: + case VBH_OP_FLUSH_OUT: + err = fsync(sc->vbsc_fd); + break; default: err = -ENOSYS; break; From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 17:39:33 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BC30EE11; Tue, 7 Oct 2014 17:39:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A5408347; Tue, 7 Oct 2014 17:39:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s97HdXAF012333; Tue, 7 Oct 2014 17:39:33 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s97HdUGO012318; Tue, 7 Oct 2014 17:39:30 GMT (envelope-from br@FreeBSD.org) Message-Id: <201410071739.s97HdUGO012318@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Tue, 7 Oct 2014 17:39:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272712 - in head/sys: arm/altera/socfpga arm/conf arm/samsung/exynos boot/fdt/dts/arm dev/mmc dev/mmc/host X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 17:39:33 -0000 Author: br Date: Tue Oct 7 17:39:30 2014 New Revision: 272712 URL: https://svnweb.freebsd.org/changeset/base/272712 Log: Add driver for Synopsys DesignWare Mobile Storage Host Controller. Sponsored by: DARPA, AFRL Added: head/sys/dev/mmc/host/ head/sys/dev/mmc/host/dwmmc.c (contents, props changed) head/sys/dev/mmc/host/dwmmc.h (contents, props changed) Modified: head/sys/arm/altera/socfpga/files.socfpga head/sys/arm/altera/socfpga/socfpga_machdep.c head/sys/arm/conf/EXYNOS5.common head/sys/arm/conf/SOCKIT head/sys/arm/samsung/exynos/exynos5_machdep.c head/sys/arm/samsung/exynos/files.exynos5 head/sys/boot/fdt/dts/arm/exynos5420-arndale-octa.dts head/sys/boot/fdt/dts/arm/exynos5420-peach-pit.dts head/sys/boot/fdt/dts/arm/exynos5420.dtsi head/sys/boot/fdt/dts/arm/socfpga-sockit.dts head/sys/boot/fdt/dts/arm/socfpga.dtsi head/sys/dev/mmc/mmc.c Modified: head/sys/arm/altera/socfpga/files.socfpga ============================================================================== --- head/sys/arm/altera/socfpga/files.socfpga Tue Oct 7 17:23:11 2014 (r272711) +++ head/sys/arm/altera/socfpga/files.socfpga Tue Oct 7 17:39:30 2014 (r272712) @@ -19,3 +19,4 @@ arm/altera/socfpga/socfpga_manager.c st arm/altera/socfpga/socfpga_rstmgr.c standard dev/dwc/if_dwc.c optional dwc +dev/mmc/host/dwmmc.c optional dwmmc Modified: head/sys/arm/altera/socfpga/socfpga_machdep.c ============================================================================== --- head/sys/arm/altera/socfpga/socfpga_machdep.c Tue Oct 7 17:23:11 2014 (r272711) +++ head/sys/arm/altera/socfpga/socfpga_machdep.c Tue Oct 7 17:39:30 2014 (r272712) @@ -89,6 +89,9 @@ platform_devmap_init(void) */ arm_devmap_add_entry(0xffb00000, 0x100000); + /* dwmmc */ + arm_devmap_add_entry(0xff700000, 0x100000); + return (0); } Modified: head/sys/arm/conf/EXYNOS5.common ============================================================================== --- head/sys/arm/conf/EXYNOS5.common Tue Oct 7 17:23:11 2014 (r272711) +++ head/sys/arm/conf/EXYNOS5.common Tue Oct 7 17:39:30 2014 (r272712) @@ -80,7 +80,7 @@ options NFS_ROOT # NFS usable as /, re device mmc # mmc/sd bus device mmcsd # mmc/sd flash cards -device sdhci # generic sdhci +device dwmmc options ROOTDEVNAME=\"ufs:/dev/da0\" Modified: head/sys/arm/conf/SOCKIT ============================================================================== --- head/sys/arm/conf/SOCKIT Tue Oct 7 17:23:11 2014 (r272711) +++ head/sys/arm/conf/SOCKIT Tue Oct 7 17:39:30 2014 (r272712) @@ -82,7 +82,7 @@ options NFS_ROOT # NFS usable as /, re device mmc # mmc/sd bus device mmcsd # mmc/sd flash cards -device sdhci # generic sdhci +device dwmmc options ROOTDEVNAME=\"ufs:/dev/da0\" Modified: head/sys/arm/samsung/exynos/exynos5_machdep.c ============================================================================== --- head/sys/arm/samsung/exynos/exynos5_machdep.c Tue Oct 7 17:23:11 2014 (r272711) +++ head/sys/arm/samsung/exynos/exynos5_machdep.c Tue Oct 7 17:39:30 2014 (r272712) @@ -78,6 +78,9 @@ platform_devmap_init(void) /* UART */ arm_devmap_add_entry(0x12C00000, 0x100000); + /* DWMMC */ + arm_devmap_add_entry(0x12200000, 0x100000); + return (0); } Modified: head/sys/arm/samsung/exynos/files.exynos5 ============================================================================== --- head/sys/arm/samsung/exynos/files.exynos5 Tue Oct 7 17:23:11 2014 (r272711) +++ head/sys/arm/samsung/exynos/files.exynos5 Tue Oct 7 17:39:30 2014 (r272712) @@ -33,4 +33,4 @@ arm/samsung/exynos/chrome_ec.c optiona arm/samsung/exynos/chrome_ec_spi.c optional chrome_ec_spi arm/samsung/exynos/chrome_kb.c optional chrome_kb -#dev/sdhci/sdhci_fdt.c optional sdhci +dev/mmc/host/dwmmc.c optional dwmmc Modified: head/sys/boot/fdt/dts/arm/exynos5420-arndale-octa.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/exynos5420-arndale-octa.dts Tue Oct 7 17:23:11 2014 (r272711) +++ head/sys/boot/fdt/dts/arm/exynos5420-arndale-octa.dts Tue Oct 7 17:39:30 2014 (r272712) @@ -47,8 +47,19 @@ status = "okay"; }; - sdhci@12220000 { - status = "disabled"; + mmc2: dwmmc@12220000 { + status = "okay"; + num-slots = <1>; + supports-highspeed; + samsung,dw-mshc-ciu-div = <3>; + samsung,dw-mshc-sdr-timing = <2 3>; + samsung,dw-mshc-ddr-timing = <1 2>; + bus-frequency = <50000000>; + + slot@0 { + reg = <0>; + bus-width = <4>; + }; }; }; Modified: head/sys/boot/fdt/dts/arm/exynos5420-peach-pit.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/exynos5420-peach-pit.dts Tue Oct 7 17:23:11 2014 (r272711) +++ head/sys/boot/fdt/dts/arm/exynos5420-peach-pit.dts Tue Oct 7 17:39:30 2014 (r272712) @@ -68,5 +68,20 @@ usbdrd_phy1: phy@12500000 { vbus-supply = < 218 >; }; + + mmc2: dwmmc@12220000 { + status = "okay"; + num-slots = <1>; + supports-highspeed; + samsung,dw-mshc-ciu-div = <3>; + samsung,dw-mshc-sdr-timing = <2 3>; + samsung,dw-mshc-ddr-timing = <1 2>; + bus-frequency = <50000000>; + + slot@0 { + reg = <0>; + bus-width = <4>; + }; + }; }; }; Modified: head/sys/boot/fdt/dts/arm/exynos5420.dtsi ============================================================================== --- head/sys/boot/fdt/dts/arm/exynos5420.dtsi Tue Oct 7 17:23:11 2014 (r272711) +++ head/sys/boot/fdt/dts/arm/exynos5420.dtsi Tue Oct 7 17:39:30 2014 (r272712) @@ -81,5 +81,32 @@ xhci@12400000 { status = "okay"; }; + + mmc0: dwmmc@12200000 { + compatible = "samsung,exynos5420-dw-mshc-smu"; + reg = <0x12200000 0x10000>; + interrupts = <107>; + interrupt-parent = <&GIC>; + fifo-depth = <0x40>; + status = "disabled"; + }; + + mmc1: dwmmc@12210000 { + compatible = "samsung,exynos5420-dw-mshc-smu"; + reg = <0x12210000 0x10000>; + interrupts = <108>; + interrupt-parent = <&GIC>; + fifo-depth = <0x40>; + status = "disabled"; + }; + + mmc2: dwmmc@12220000 { + compatible = "samsung,exynos5420-dw-mshc"; + reg = <0x12220000 0x10000>; + interrupts = <109>; + interrupt-parent = <&GIC>; + fifo-depth = <0x40>; + status = "disabled"; + }; }; }; Modified: head/sys/boot/fdt/dts/arm/socfpga-sockit.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/socfpga-sockit.dts Tue Oct 7 17:23:11 2014 (r272711) +++ head/sys/boot/fdt/dts/arm/socfpga-sockit.dts Tue Oct 7 17:39:30 2014 (r272712) @@ -55,6 +55,19 @@ gmac1: ethernet@ff702000 { status = "okay"; }; + + mmc: dwmmc@ff704000 { + status = "okay"; + num-slots = <1>; + supports-highspeed; + broken-cd; + bus-frequency = <25000000>; + + slot@0 { + reg = <0>; + bus-width = <4>; + }; + }; }; chosen { Modified: head/sys/boot/fdt/dts/arm/socfpga.dtsi ============================================================================== --- head/sys/boot/fdt/dts/arm/socfpga.dtsi Tue Oct 7 17:23:11 2014 (r272711) +++ head/sys/boot/fdt/dts/arm/socfpga.dtsi Tue Oct 7 17:39:30 2014 (r272712) @@ -152,5 +152,14 @@ phy-mode = "rgmii"; status = "disabled"; }; + + mmc: dwmmc@ff704000 { + compatible = "altr,socfpga-dw-mshc"; + reg = <0xff704000 0x1000>; + interrupts = <171>; + interrupt-parent = <&GIC>; + fifo-depth = <0x400>; + status = "disabled"; + }; }; }; Added: head/sys/dev/mmc/host/dwmmc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mmc/host/dwmmc.c Tue Oct 7 17:39:30 2014 (r272712) @@ -0,0 +1,1103 @@ +/*- + * Copyright (c) 2014 Ruslan Bukin + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * 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. + */ + +/* + * Synopsys DesignWare Mobile Storage Host Controller + * Chapter 14, Altera Cyclone V Device Handbook (CV-5V2 2014.07.22) + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include "mmcbr_if.h" + +#define dprintf(x, arg...) + +#define READ4(_sc, _reg) \ + bus_read_4((_sc)->res[0], _reg) +#define WRITE4(_sc, _reg, _val) \ + bus_write_4((_sc)->res[0], _reg, _val) + +#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) + +#define DWMMC_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) +#define DWMMC_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) +#define DWMMC_LOCK_INIT(_sc) \ + mtx_init(&_sc->sc_mtx, device_get_nameunit(_sc->dev), \ + "dwmmc", MTX_DEF) +#define DWMMC_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx); +#define DWMMC_ASSERT_LOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED); +#define DWMMC_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED); + +#define PENDING_CMD 0x01 +#define PENDING_STOP 0x02 +#define CARD_INIT_DONE 0x04 + +#define DWMMC_DATA_ERR_FLAGS (SDMMC_INTMASK_DRT | SDMMC_INTMASK_DCRC \ + |SDMMC_INTMASK_HTO | SDMMC_INTMASK_SBE \ + |SDMMC_INTMASK_EBE) +#define DWMMC_CMD_ERR_FLAGS (SDMMC_INTMASK_RTO | SDMMC_INTMASK_RCRC \ + |SDMMC_INTMASK_RE) +#define DWMMC_ERR_FLAGS (DWMMC_DATA_ERR_FLAGS | DWMMC_CMD_ERR_FLAGS \ + |SDMMC_INTMASK_HLE) + +#define DES0_DIC (1 << 1) +#define DES0_LD (1 << 2) +#define DES0_FS (1 << 3) +#define DES0_CH (1 << 4) +#define DES0_ER (1 << 5) +#define DES0_CES (1 << 30) +#define DES0_OWN (1 << 31) + +#define DES1_BS1_MASK 0xfff +#define DES1_BS1_SHIFT 0 + +struct idmac_desc { + uint32_t des0; /* control */ + uint32_t des1; /* bufsize */ + uint32_t des2; /* buf1 phys addr */ + uint32_t des3; /* buf2 phys addr or next descr */ +}; + +#define DESC_COUNT 256 +#define DESC_SIZE (sizeof(struct idmac_desc) * DESC_COUNT) +#define DEF_MSIZE 0x2 /* Burst size of multiple transaction */ + +struct dwmmc_softc { + struct resource *res[2]; + bus_space_tag_t bst; + bus_space_handle_t bsh; + device_t dev; + void *intr_cookie; + struct mmc_host host; + struct mtx sc_mtx; + struct mmc_request *req; + struct mmc_command *curcmd; + uint32_t flags; + uint32_t hwtype; + uint32_t use_auto_stop; + + bus_dma_tag_t desc_tag; + bus_dmamap_t desc_map; + struct idmac_desc *desc_ring; + bus_addr_t desc_ring_paddr; + bus_dma_tag_t buf_tag; + bus_dmamap_t buf_map; + + uint32_t bus_busy; + uint32_t dto_rcvd; + uint32_t acd_rcvd; + uint32_t cmd_done; + uint32_t bus_hz; + uint32_t fifo_depth; + uint32_t num_slots; + uint32_t sdr_timing; + uint32_t ddr_timing; +}; + +static void dwmmc_next_operation(struct dwmmc_softc *); +static int dwmmc_setup_bus(struct dwmmc_softc *, int); +static int dma_done(struct dwmmc_softc *, struct mmc_command *); +static int dma_stop(struct dwmmc_softc *); + +static struct resource_spec dwmmc_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { SYS_RES_IRQ, 0, RF_ACTIVE }, + { -1, 0 } +}; + +enum { + HWTYPE_NONE, + HWTYPE_ALTERA, + HWTYPE_EXYNOS, +}; + +#define HWTYPE_MASK (0x0000ffff) +#define HWFLAG_MASK (0xffff << 16) + +static struct ofw_compat_data compat_data[] = { + {"altr,socfpga-dw-mshc", HWTYPE_ALTERA}, + {"samsung,exynos5420-dw-mshc", HWTYPE_EXYNOS}, + {NULL, HWTYPE_NONE}, +}; + +static void +dwmmc_get1paddr(void *arg, bus_dma_segment_t *segs, int nsegs, int error) +{ + + if (error != 0) + return; + *(bus_addr_t *)arg = segs[0].ds_addr; +} + +static void +dwmmc_ring_setup(void *arg, bus_dma_segment_t *segs, int nsegs, int error) +{ + struct dwmmc_softc *sc; + int idx; + + if (error != 0) + return; + + sc = arg; + + dprintf("nsegs %d seg0len %lu\n", nsegs, segs[0].ds_len); + + for (idx = 0; idx < nsegs; idx++) { + sc->desc_ring[idx].des0 = (DES0_OWN | DES0_DIC | DES0_CH); + sc->desc_ring[idx].des1 = segs[idx].ds_len; + sc->desc_ring[idx].des2 = segs[idx].ds_addr; + + if (idx == 0) + sc->desc_ring[idx].des0 |= DES0_FS; + + if (idx == (nsegs - 1)) { + sc->desc_ring[idx].des0 &= ~(DES0_DIC | DES0_CH); + sc->desc_ring[idx].des0 |= DES0_LD; + } + } +} + +static int +dwmmc_ctrl_reset(struct dwmmc_softc *sc, int reset_bits) +{ + int reg; + int i; + + reg = READ4(sc, SDMMC_CTRL); + reg |= (reset_bits); + WRITE4(sc, SDMMC_CTRL, reg); + + /* Wait reset done */ + for (i = 0; i < 100; i++) { + if (!(READ4(sc, SDMMC_CTRL) & reset_bits)) + return (0); + DELAY(10); + }; + + device_printf(sc->dev, "Reset failed\n"); + + return (1); +} + +static int +dma_setup(struct dwmmc_softc *sc) +{ + int error; + int nidx; + int idx; + + /* + * Set up TX descriptor ring, descriptors, and dma maps. + */ + error = bus_dma_tag_create( + bus_get_dma_tag(sc->dev), /* Parent tag. */ + 4096, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + DESC_SIZE, 1, /* maxsize, nsegments */ + DESC_SIZE, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->desc_tag); + if (error != 0) { + device_printf(sc->dev, + "could not create ring DMA tag.\n"); + return (1); + } + + error = bus_dmamem_alloc(sc->desc_tag, (void**)&sc->desc_ring, + BUS_DMA_COHERENT | BUS_DMA_WAITOK | BUS_DMA_ZERO, + &sc->desc_map); + if (error != 0) { + device_printf(sc->dev, + "could not allocate descriptor ring.\n"); + return (1); + } + + error = bus_dmamap_load(sc->desc_tag, sc->desc_map, + sc->desc_ring, DESC_SIZE, dwmmc_get1paddr, + &sc->desc_ring_paddr, 0); + if (error != 0) { + device_printf(sc->dev, + "could not load descriptor ring map.\n"); + return (1); + } + + for (idx = 0; idx < DESC_COUNT; idx++) { + sc->desc_ring[idx].des0 = DES0_CH; + sc->desc_ring[idx].des1 = 0; + nidx = (idx + 1) % DESC_COUNT; + sc->desc_ring[idx].des3 = sc->desc_ring_paddr + \ + (nidx * sizeof(struct idmac_desc)); + } + + error = bus_dma_tag_create( + bus_get_dma_tag(sc->dev), /* Parent tag. */ + 4096, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + DESC_COUNT*MMC_SECTOR_SIZE, /* maxsize */ + DESC_COUNT, /* nsegments */ + MMC_SECTOR_SIZE, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->buf_tag); + if (error != 0) { + device_printf(sc->dev, + "could not create ring DMA tag.\n"); + return (1); + } + + error = bus_dmamap_create(sc->buf_tag, 0, + &sc->buf_map); + if (error != 0) { + device_printf(sc->dev, + "could not create TX buffer DMA map.\n"); + return (1); + } + + return (0); +} + +static void +dwmmc_cmd_done(struct dwmmc_softc *sc) +{ + struct mmc_command *cmd; + + cmd = sc->curcmd; + if (cmd == NULL) + return; + + if (cmd->flags & MMC_RSP_PRESENT) { + if (cmd->flags & MMC_RSP_136) { + cmd->resp[3] = READ4(sc, SDMMC_RESP0); + cmd->resp[2] = READ4(sc, SDMMC_RESP1); + cmd->resp[1] = READ4(sc, SDMMC_RESP2); + cmd->resp[0] = READ4(sc, SDMMC_RESP3); + } else { + cmd->resp[3] = 0; + cmd->resp[2] = 0; + cmd->resp[1] = 0; + cmd->resp[0] = READ4(sc, SDMMC_RESP0); + } + } +} + +static void +dwmmc_tasklet(struct dwmmc_softc *sc) +{ + struct mmc_command *cmd; + + cmd = sc->curcmd; + if (cmd == NULL) + return; + + if (cmd->error != MMC_ERR_NONE) { + dwmmc_next_operation(sc); + } else if (!cmd->data && sc->cmd_done) { + dwmmc_next_operation(sc); + } else if (cmd->data && sc->dto_rcvd) { + if ((cmd->opcode == MMC_WRITE_MULTIPLE_BLOCK || + cmd->opcode == MMC_READ_MULTIPLE_BLOCK) && + sc->use_auto_stop) { + if (sc->acd_rcvd) + dwmmc_next_operation(sc); + } else { + dwmmc_next_operation(sc); + } + } +} + +static void +dwmmc_intr(void *arg) +{ + struct mmc_command *cmd; + struct dwmmc_softc *sc; + uint32_t reg; + + sc = arg; + + DWMMC_LOCK(sc); + + cmd = sc->curcmd; + + /* First handle SDMMC controller interrupts */ + reg = READ4(sc, SDMMC_MINTSTS); + if (reg) { + dprintf("%s 0x%08x\n", __func__, reg); + + if (reg & DWMMC_CMD_ERR_FLAGS) { + WRITE4(sc, SDMMC_RINTSTS, DWMMC_CMD_ERR_FLAGS); + dprintf("cmd err 0x%08x cmd 0x%08x\n", + reg, cmd->opcode); + cmd->error = MMC_ERR_TIMEOUT; + } + + if (reg & DWMMC_DATA_ERR_FLAGS) { + WRITE4(sc, SDMMC_RINTSTS, DWMMC_DATA_ERR_FLAGS); + dprintf("data err 0x%08x cmd 0x%08x\n", + reg, cmd->opcode); + cmd->error = MMC_ERR_FAILED; + + dma_done(sc, cmd); + dma_stop(sc); + DWMMC_UNLOCK(sc); + return; + } + + if (reg & SDMMC_INTMASK_CMD_DONE) { + dwmmc_cmd_done(sc); + sc->cmd_done = 1; + WRITE4(sc, SDMMC_RINTSTS, SDMMC_INTMASK_CMD_DONE); + } + + if (reg & SDMMC_INTMASK_ACD) { + sc->acd_rcvd = 1; + WRITE4(sc, SDMMC_RINTSTS, SDMMC_INTMASK_ACD); + } + + if (reg & SDMMC_INTMASK_DTO) { + sc->dto_rcvd = 1; + WRITE4(sc, SDMMC_RINTSTS, SDMMC_INTMASK_DTO); + } + + if (reg & SDMMC_INTMASK_CD) { + /* XXX: Handle card detect */ + WRITE4(sc, SDMMC_RINTSTS, SDMMC_INTMASK_CD); + } + } + + /* Now handle DMA interrupts */ + reg = READ4(sc, SDMMC_IDSTS); + if (reg) { + dprintf("dma intr 0x%08x\n", reg); + if (reg & (SDMMC_IDINTEN_TI | SDMMC_IDINTEN_RI)) { + WRITE4(sc, SDMMC_IDSTS, (SDMMC_IDINTEN_TI | + SDMMC_IDINTEN_RI)); + WRITE4(sc, SDMMC_IDSTS, SDMMC_IDINTEN_NI); + dma_done(sc, cmd); + } + } + + dwmmc_tasklet(sc); + + DWMMC_UNLOCK(sc); +} + +static int +parse_fdt(struct dwmmc_softc *sc) +{ + pcell_t dts_value[3]; + phandle_t node; + int len; + + if ((node = ofw_bus_get_node(sc->dev)) == -1) + return (ENXIO); + + /* fifo-depth */ + if ((len = OF_getproplen(node, "fifo-depth")) <= 0) + return (ENXIO); + OF_getencprop(node, "fifo-depth", dts_value, len); + sc->fifo_depth = dts_value[0]; + + /* num-slots */ + if ((len = OF_getproplen(node, "num-slots")) <= 0) + return (ENXIO); + OF_getencprop(node, "num-slots", dts_value, len); + sc->num_slots = dts_value[0]; + + /* + * We need some platform-specific code to know + * what the clock is supplied for our device. + * For now rely on the value specified in FDT. + */ + if ((len = OF_getproplen(node, "bus-frequency")) <= 0) + return (ENXIO); + OF_getencprop(node, "bus-frequency", dts_value, len); + sc->bus_hz = dts_value[0]; + + /* + * Platform-specific stuff + * XXX: Move to separate file + */ + + if ((sc->hwtype & HWTYPE_MASK) != HWTYPE_EXYNOS) + return (0); + + if ((len = OF_getproplen(node, "samsung,dw-mshc-ciu-div")) <= 0) + return (ENXIO); + OF_getencprop(node, "samsung,dw-mshc-ciu-div", dts_value, len); + sc->sdr_timing = (dts_value[0] << SDMMC_CLKSEL_DIVIDER_SHIFT); + sc->ddr_timing = (dts_value[0] << SDMMC_CLKSEL_DIVIDER_SHIFT); + + if ((len = OF_getproplen(node, "samsung,dw-mshc-sdr-timing")) <= 0) + return (ENXIO); + OF_getencprop(node, "samsung,dw-mshc-sdr-timing", dts_value, len); + sc->sdr_timing |= ((dts_value[0] << SDMMC_CLKSEL_SAMPLE_SHIFT) | + (dts_value[1] << SDMMC_CLKSEL_DRIVE_SHIFT)); + + if ((len = OF_getproplen(node, "samsung,dw-mshc-ddr-timing")) <= 0) + return (ENXIO); + OF_getencprop(node, "samsung,dw-mshc-ddr-timing", dts_value, len); + sc->ddr_timing |= ((dts_value[0] << SDMMC_CLKSEL_SAMPLE_SHIFT) | + (dts_value[1] << SDMMC_CLKSEL_DRIVE_SHIFT)); + + return (0); +} + +static int +dwmmc_probe(device_t dev) +{ + uintptr_t hwtype; + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + hwtype = ofw_bus_search_compatible(dev, compat_data)->ocd_data; + if (hwtype == HWTYPE_NONE) + return (ENXIO); + + device_set_desc(dev, "Synopsys DesignWare Mobile " + "Storage Host Controller"); + return (BUS_PROBE_DEFAULT); +} + +static int +dwmmc_attach(device_t dev) +{ + struct dwmmc_softc *sc; + device_t child; + int error; + int slot; + + sc = device_get_softc(dev); + + sc->dev = dev; + sc->hwtype = ofw_bus_search_compatible(dev, compat_data)->ocd_data; + + /* Why not to use Auto Stop? It save a hundred of irq per second */ + sc->use_auto_stop = 1; + + error = parse_fdt(sc); + if (error != 0) { + device_printf(dev, "Can't get FDT property.\n"); + return (ENXIO); + } + + DWMMC_LOCK_INIT(sc); + + if (bus_alloc_resources(dev, dwmmc_spec, sc->res)) { + device_printf(dev, "could not allocate resources\n"); + return (ENXIO); + } + + /* Memory interface */ + sc->bst = rman_get_bustag(sc->res[0]); + sc->bsh = rman_get_bushandle(sc->res[0]); + + /* Setup interrupt handler. */ + error = bus_setup_intr(dev, sc->res[1], INTR_TYPE_NET | INTR_MPSAFE, + NULL, dwmmc_intr, sc, &sc->intr_cookie); + if (error != 0) { + device_printf(dev, "could not setup interrupt handler.\n"); + return (ENXIO); + } + + device_printf(dev, "Hardware version ID is %04x\n", + READ4(sc, SDMMC_VERID) & 0xffff); + + WRITE4(sc, EMMCP_MPSBEGIN0, 0); + WRITE4(sc, EMMCP_SEND0, 0); + WRITE4(sc, EMMCP_CTRL0, (MPSCTRL_SECURE_READ_BIT | + MPSCTRL_SECURE_WRITE_BIT | + MPSCTRL_NON_SECURE_READ_BIT | + MPSCTRL_NON_SECURE_WRITE_BIT | + MPSCTRL_VALID)); + + /* XXX: we support operation for slot index 0 only */ + slot = 0; + WRITE4(sc, SDMMC_PWREN, (1 << slot)); + + /* Reset all */ + if (dwmmc_ctrl_reset(sc, (SDMMC_CTRL_RESET | + SDMMC_CTRL_FIFO_RESET | + SDMMC_CTRL_DMA_RESET))) + return (ENXIO); + + dwmmc_setup_bus(sc, sc->host.f_min); + + if (dma_setup(sc)) + return (ENXIO); + + /* Install desc base */ + WRITE4(sc, SDMMC_DBADDR, sc->desc_ring_paddr); + + /* Enable DMA interrupts */ + WRITE4(sc, SDMMC_IDSTS, SDMMC_IDINTEN_MASK); + WRITE4(sc, SDMMC_IDINTEN, (SDMMC_IDINTEN_NI | + SDMMC_IDINTEN_RI | + SDMMC_IDINTEN_TI)); + + /* Clear and disable interrups for a while */ + WRITE4(sc, SDMMC_RINTSTS, 0xffffffff); + WRITE4(sc, SDMMC_INTMASK, 0); + + /* Maximum timeout */ + WRITE4(sc, SDMMC_TMOUT, 0xffffffff); + + /* Enable interrupts */ + WRITE4(sc, SDMMC_RINTSTS, 0xffffffff); + WRITE4(sc, SDMMC_INTMASK, (SDMMC_INTMASK_CMD_DONE | + SDMMC_INTMASK_DTO | + SDMMC_INTMASK_ACD | + SDMMC_INTMASK_TXDR | + SDMMC_INTMASK_RXDR | + DWMMC_ERR_FLAGS | + SDMMC_INTMASK_CD)); + WRITE4(sc, SDMMC_CTRL, SDMMC_CTRL_INT_ENABLE); + + sc->host.f_min = 400000; + sc->host.f_max = 200000000; + sc->host.host_ocr = MMC_OCR_320_330 | MMC_OCR_330_340; + sc->host.caps = MMC_CAP_4_BIT_DATA; + + child = device_add_child(dev, "mmc", 0); + return (bus_generic_attach(dev)); +} + +static int +dwmmc_setup_bus(struct dwmmc_softc *sc, int freq) +{ + int tout; + int div; + + if (freq == 0) { + WRITE4(sc, SDMMC_CLKENA, 0); + WRITE4(sc, SDMMC_CMD, (SDMMC_CMD_WAIT_PRVDATA | + SDMMC_CMD_UPD_CLK_ONLY | SDMMC_CMD_START)); + + tout = 1000; + do { + if (tout-- < 0) { + device_printf(sc->dev, "Failed update clk\n"); + return (1); + } + } while (READ4(sc, SDMMC_CMD) & SDMMC_CMD_START); + + return (0); + } + + WRITE4(sc, SDMMC_CLKENA, 0); + WRITE4(sc, SDMMC_CLKSRC, 0); + + div = (sc->bus_hz != freq) ? DIV_ROUND_UP(sc->bus_hz, 2 * freq) : 0; + + WRITE4(sc, SDMMC_CLKDIV, div); + WRITE4(sc, SDMMC_CMD, (SDMMC_CMD_WAIT_PRVDATA | + SDMMC_CMD_UPD_CLK_ONLY | SDMMC_CMD_START)); + + tout = 1000; + do { + if (tout-- < 0) { + device_printf(sc->dev, "Failed to update clk"); + return (1); + } + } while (READ4(sc, SDMMC_CMD) & SDMMC_CMD_START); + + WRITE4(sc, SDMMC_CLKENA, (SDMMC_CLKENA_CCLK_EN | SDMMC_CLKENA_LP)); + WRITE4(sc, SDMMC_CMD, SDMMC_CMD_WAIT_PRVDATA | + SDMMC_CMD_UPD_CLK_ONLY | SDMMC_CMD_START); + + tout = 1000; + do { + if (tout-- < 0) { + device_printf(sc->dev, "Failed to enable clk\n"); + return (1); + } + } while (READ4(sc, SDMMC_CMD) & SDMMC_CMD_START); + + return (0); +} + +static int +dwmmc_update_ios(device_t brdev, device_t reqdev) +{ + struct dwmmc_softc *sc; + struct mmc_ios *ios; + + sc = device_get_softc(brdev); + ios = &sc->host.ios; + + dprintf("Setting up clk %u bus_width %d\n", + ios->clock, ios->bus_width); + + dwmmc_setup_bus(sc, ios->clock); + + if (ios->bus_width == bus_width_8) + WRITE4(sc, SDMMC_CTYPE, SDMMC_CTYPE_8BIT); + else if (ios->bus_width == bus_width_4) + WRITE4(sc, SDMMC_CTYPE, SDMMC_CTYPE_4BIT); + else + WRITE4(sc, SDMMC_CTYPE, 0); + + if ((sc->hwtype & HWTYPE_MASK) == HWTYPE_EXYNOS) { + /* XXX: take care about DDR or SDR use here */ + WRITE4(sc, SDMMC_CLKSEL, sc->sdr_timing); + } + + /* + * XXX: take care about DDR bit + * + * reg = READ4(sc, SDMMC_UHS_REG); + * reg |= (SDMMC_UHS_REG_DDR); + * WRITE4(sc, SDMMC_UHS_REG, reg); + */ + + return (0); +} + +static int +dma_done(struct dwmmc_softc *sc, struct mmc_command *cmd) +{ + struct mmc_data *data; + + data = cmd->data; + + if (data->flags & MMC_DATA_WRITE) + bus_dmamap_sync(sc->buf_tag, sc->buf_map, + BUS_DMASYNC_POSTWRITE); + else + bus_dmamap_sync(sc->buf_tag, sc->buf_map, + BUS_DMASYNC_POSTREAD); + + bus_dmamap_unload(sc->buf_tag, sc->buf_map); + + return (0); +} + +static int +dma_stop(struct dwmmc_softc *sc) +{ + int reg; + + reg = READ4(sc, SDMMC_CTRL); + reg &= ~(SDMMC_CTRL_USE_IDMAC); + reg |= (SDMMC_CTRL_DMA_RESET); + WRITE4(sc, SDMMC_CTRL, reg); + + reg = READ4(sc, SDMMC_BMOD); + reg &= ~(SDMMC_BMOD_DE | SDMMC_BMOD_FB); + reg |= (SDMMC_BMOD_SWR); + WRITE4(sc, SDMMC_BMOD, reg); + + return (0); +} + +static int +dma_prepare(struct dwmmc_softc *sc, struct mmc_command *cmd) +{ + struct mmc_data *data; + int len; + int err; + int reg; + + data = cmd->data; + len = data->len; + + reg = READ4(sc, SDMMC_INTMASK); + reg &= ~(SDMMC_INTMASK_TXDR | SDMMC_INTMASK_RXDR); + WRITE4(sc, SDMMC_INTMASK, reg); + + err = bus_dmamap_load(sc->buf_tag, sc->buf_map, + data->data, data->len, dwmmc_ring_setup, + sc, BUS_DMA_NOWAIT); + if (err != 0) + panic("dmamap_load failed\n"); + + if (data->flags & MMC_DATA_WRITE) + bus_dmamap_sync(sc->buf_tag, sc->buf_map, + BUS_DMASYNC_PREWRITE); + else + bus_dmamap_sync(sc->buf_tag, sc->buf_map, + BUS_DMASYNC_PREREAD); + + reg = (DEF_MSIZE << SDMMC_FIFOTH_MSIZE_S); + reg |= ((sc->fifo_depth / 2) - 1) << SDMMC_FIFOTH_RXWMARK_S; + reg |= (sc->fifo_depth / 2) << SDMMC_FIFOTH_TXWMARK_S; + + WRITE4(sc, SDMMC_FIFOTH, reg); + wmb(); + + reg = READ4(sc, SDMMC_CTRL); + reg |= (SDMMC_CTRL_USE_IDMAC | SDMMC_CTRL_DMA_ENABLE); + WRITE4(sc, SDMMC_CTRL, reg); + wmb(); + + reg = READ4(sc, SDMMC_BMOD); + reg |= (SDMMC_BMOD_DE | SDMMC_BMOD_FB); + WRITE4(sc, SDMMC_BMOD, reg); + + /* Start */ + WRITE4(sc, SDMMC_PLDMND, 1); + + return (0); +} + +static void +dwmmc_start_cmd(struct dwmmc_softc *sc, struct mmc_command *cmd) +{ + struct mmc_data *data; + uint32_t blksz; + uint32_t cmdr; + + sc->curcmd = cmd; + data = cmd->data; + + /* XXX Upper layers don't always set this */ + cmd->mrq = sc->req; + + /* Begin setting up command register. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 18:00:35 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9B42599A; Tue, 7 Oct 2014 18:00:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8672588C; Tue, 7 Oct 2014 18:00:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s97I0ZIr023910; Tue, 7 Oct 2014 18:00:35 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s97I0ZV7023909; Tue, 7 Oct 2014 18:00:35 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201410071800.s97I0ZV7023909@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Tue, 7 Oct 2014 18:00:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272713 - head/sys/dev/hwpmc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 18:00:35 -0000 Author: bz Date: Tue Oct 7 18:00:34 2014 New Revision: 272713 URL: https://svnweb.freebsd.org/changeset/base/272713 Log: Since introducing the extra mapping in r250103 for architectural performance events we have actually counted 'Branch Instruction Retired' when people asked for 'Unhalted core cycles' using the 'unhalted-core-cycles' event mask mnemonic. Reviewed by: jimharris Discussed with: gnn, rwatson MFC after: 3 days Sponsored by: DARPA/AFRL Modified: head/sys/dev/hwpmc/hwpmc_core.c Modified: head/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_core.c Tue Oct 7 17:39:30 2014 (r272712) +++ head/sys/dev/hwpmc/hwpmc_core.c Tue Oct 7 18:00:34 2014 (r272713) @@ -1796,7 +1796,7 @@ iap_is_event_architectural(enum pmc_even switch (pe) { case PMC_EV_IAP_ARCH_UNH_COR_CYC: ae = CORE_AE_UNHALTED_CORE_CYCLES; - *map = PMC_EV_IAP_EVENT_C4H_00H; + *map = PMC_EV_IAP_EVENT_3CH_00H; break; case PMC_EV_IAP_ARCH_INS_RET: ae = CORE_AE_INSTRUCTION_RETIRED; From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 18:47:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9066DBED; Tue, 7 Oct 2014 18:47:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7BB3BD5E; Tue, 7 Oct 2014 18:47:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s97Ils5W046676; Tue, 7 Oct 2014 18:47:54 GMT (envelope-from ray@FreeBSD.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s97Ilsbj046675; Tue, 7 Oct 2014 18:47:54 GMT (envelope-from ray@FreeBSD.org) Message-Id: <201410071847.s97Ilsbj046675@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ray set sender to ray@FreeBSD.org using -f From: Aleksandr Rybalko Date: Tue, 7 Oct 2014 18:47:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272715 - head/sys/dev/vt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 18:47:54 -0000 Author: ray Date: Tue Oct 7 18:47:53 2014 New Revision: 272715 URL: https://svnweb.freebsd.org/changeset/base/272715 Log: Allow vt(4) to disable terminal bell with `sysctl kern.vt.bell_enable=0`, similar as syscons(4) do. Submitted by: Tiwei Bie MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/vt/vt_core.c Modified: head/sys/dev/vt/vt_core.c ============================================================================== --- head/sys/dev/vt/vt_core.c Tue Oct 7 18:22:05 2014 (r272714) +++ head/sys/dev/vt/vt_core.c Tue Oct 7 18:47:53 2014 (r272715) @@ -120,6 +120,7 @@ const struct terminal_class vt_termclass static SYSCTL_NODE(_kern, OID_AUTO, vt, CTLFLAG_RD, 0, "vt(9) parameters"); VT_SYSCTL_INT(enable_altgr, 1, "Enable AltGr key (Do not assume R.Alt as Alt)"); +VT_SYSCTL_INT(enable_bell, 1, "Enable bell"); VT_SYSCTL_INT(debug, 0, "vt(9) debug level"); VT_SYSCTL_INT(deadtimer, 15, "Time to wait busy process in VT_PROCESS mode"); VT_SYSCTL_INT(suspendswitch, 1, "Switch to VT0 before suspend"); @@ -904,6 +905,9 @@ vtterm_bell(struct terminal *tm) struct vt_window *vw = tm->tm_softc; struct vt_device *vd = vw->vw_device; + if (!vt_enable_bell) + return; + if (vd->vd_flags & VDF_QUIET_BELL) return; @@ -915,6 +919,9 @@ vtterm_beep(struct terminal *tm, u_int p { u_int freq, period; + if (!vt_enable_bell) + return; + if ((param == 0) || ((param & 0xffff) == 0)) { vtterm_bell(tm); return; From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 19:07:51 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2DAD9492; Tue, 7 Oct 2014 19:07:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 19235FA6; Tue, 7 Oct 2014 19:07:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s97J7oZp056115; Tue, 7 Oct 2014 19:07:50 GMT (envelope-from gavin@FreeBSD.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s97J7oS1056113; Tue, 7 Oct 2014 19:07:50 GMT (envelope-from gavin@FreeBSD.org) Message-Id: <201410071907.s97J7oS1056113@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gavin set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson Date: Tue, 7 Oct 2014 19:07:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272716 - in head/sys/dev/usb: . net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 19:07:51 -0000 Author: gavin Date: Tue Oct 7 19:07:50 2014 New Revision: 272716 URL: https://svnweb.freebsd.org/changeset/base/272716 Log: Support the Vodafone R215 LET USB dongle, which is apparently a rebadged E5372 with different product IDs. Interestingly, the standard E5372 IDs (12d1:1506) are currently listed in u3g.c and are the same as the E3131. However, the R215/E5372 is an NCM device and works well with cdce(4) whereas the E3131 isn't. More work may be needed to better identify the other device IDs. MFC after: 1 week Modified: head/sys/dev/usb/net/if_cdce.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/net/if_cdce.c ============================================================================== --- head/sys/dev/usb/net/if_cdce.c Tue Oct 7 18:47:53 2014 (r272715) +++ head/sys/dev/usb/net/if_cdce.c Tue Oct 7 19:07:50 2014 (r272716) @@ -273,6 +273,7 @@ static const struct usb_ether_methods cd static const STRUCT_USB_HOST_ID cdce_switch_devs[] = { {USB_VPI(USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E3272_INIT, MSC_EJECT_HUAWEI2)}, + {USB_VPI(USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_R215_INIT, MSC_EJECT_HUAWEI2)}, }; static const STRUCT_USB_HOST_ID cdce_host_devs[] = { Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Tue Oct 7 18:47:53 2014 (r272715) +++ head/sys/dev/usb/usbdevs Tue Oct 7 19:07:50 2014 (r272716) @@ -2353,6 +2353,8 @@ product HUAWEI E3131 0x1506 3G modem product HUAWEI K3765_INIT 0x1520 K3765 Initial product HUAWEI K4505_INIT 0x1521 K4505 Initial product HUAWEI E3272_INIT 0x155b LTE modem initial +product HUAWEI R215_INIT 0x1582 LTE modem initial +product HUAWEI R215 0x1588 LTE modem product HUAWEI ETS2055 0x1803 CDMA modem product HUAWEI E173 0x1c05 3G modem product HUAWEI E173_INIT 0x1c0b 3G modem initial From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 19:08:03 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B730B5D1; Tue, 7 Oct 2014 19:08:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A2B3EFAD; Tue, 7 Oct 2014 19:08:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s97J83mC056200; Tue, 7 Oct 2014 19:08:03 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s97J8328056199; Tue, 7 Oct 2014 19:08:03 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410071908.s97J8328056199@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 7 Oct 2014 19:08:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272717 - head/usr.sbin/autofs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 19:08:03 -0000 Author: trasz Date: Tue Oct 7 19:08:02 2014 New Revision: 272717 URL: https://svnweb.freebsd.org/changeset/base/272717 Log: Remove call to access(2) which didn't serve any purpose, and make it more tolerant to errors. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/autofs/common.c Modified: head/usr.sbin/autofs/common.c ============================================================================== --- head/usr.sbin/autofs/common.c Tue Oct 7 19:07:50 2014 (r272716) +++ head/usr.sbin/autofs/common.c Tue Oct 7 19:08:02 2014 (r272717) @@ -169,17 +169,12 @@ create_directory(const char *path) if (component == NULL) break; concat(&partial, &component); - //log_debugx("checking \"%s\" for existence", partial); - error = access(partial, F_OK); - if (error == 0) - continue; - if (errno != ENOENT) - log_err(1, "cannot access %s", partial); - log_debugx("directory %s does not exist, creating", - partial); + //log_debugx("creating \"%s\"", partial); error = mkdir(partial, 0755); - if (error != 0) - log_err(1, "cannot create %s", partial); + if (error != 0 && errno != EEXIST) { + log_warn("cannot create %s", partial); + return; + } } free(tofree); From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 20:13:48 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 276E7392; Tue, 7 Oct 2014 20:13:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 13B6D9C1; Tue, 7 Oct 2014 20:13:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s97KDlVw091062; Tue, 7 Oct 2014 20:13:47 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s97KDltI091061; Tue, 7 Oct 2014 20:13:47 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201410072013.s97KDltI091061@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Tue, 7 Oct 2014 20:13:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272718 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 20:13:48 -0000 Author: jkim Date: Tue Oct 7 20:13:47 2014 New Revision: 272718 URL: https://svnweb.freebsd.org/changeset/base/272718 Log: Make kern.nswbuf tunable from loader. MFC after: 1 week Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Tue Oct 7 19:08:02 2014 (r272717) +++ head/sys/kern/vfs_bio.c Tue Oct 7 20:13:47 2014 (r272718) @@ -667,6 +667,10 @@ bd_speedup(void) mtx_unlock(&bdlock); } +#ifndef NSWBUF_MIN +#define NSWBUF_MIN 16 +#endif + #ifdef __i386__ #define TRANSIENT_DENOM 5 #else @@ -778,11 +782,10 @@ kern_vfs_bio_buffer_alloc(caddr_t v, lon * swbufs are used as temporary holders for I/O, such as paging I/O. * We have no less then 16 and no more then 256. */ - nswbuf = max(min(nbuf/4, 256), 16); -#ifdef NSWBUF_MIN + nswbuf = min(nbuf / 4, 256); + TUNABLE_INT_FETCH("kern.nswbuf", &nswbuf); if (nswbuf < NSWBUF_MIN) nswbuf = NSWBUF_MIN; -#endif /* * Reserve space for the buffer cache buffers From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 21:02:37 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3D061F9D; Tue, 7 Oct 2014 21:02:37 +0000 (UTC) Received: from mail-la0-x22a.google.com (mail-la0-x22a.google.com [IPv6:2a00:1450:4010:c03::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 35A45ECF; Tue, 7 Oct 2014 21:02:36 +0000 (UTC) Received: by mail-la0-f42.google.com with SMTP id mk6so7284930lab.29 for ; Tue, 07 Oct 2014 14:02:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=QLKlNZ/y4jD/i7WQ3aCzx2C5d8l43BiLs60e+97IQkk=; b=yuTXAc1GsKW63LBlLnzbkRvfUE77g8DNNBhP4y9SjbWafKJn2xx/0Kf1araMZsRjKt 6VEF6HTLfQiIsQEle+SmvOTITAiKyjCkaIP+k+au0p4DmBr4NtCeofCGbxAyN/9p8ZfD aLpDu9Hp6fOUJ7XFIqZBssFTNV/5/JhZvu9CoZ8io7EjifTIVIbfSV/kTbJG3a3PLFEA mFNC0GVqk5YEuEuxkAsox8+6UPx6IJucnVdHaRkliaoeHHcPtnysdBjLmGw3mLa06KhL 3/5Y6gR4KROsg/d0SZUTsn9CLFxtVEjdUtEHwvo0i4w6OlujrwVxeZveeDygiBIPC34U 3VGQ== MIME-Version: 1.0 X-Received: by 10.112.54.130 with SMTP id j2mr6390296lbp.41.1412715754221; Tue, 07 Oct 2014 14:02:34 -0700 (PDT) Sender: crodr001@gmail.com Received: by 10.112.131.66 with HTTP; Tue, 7 Oct 2014 14:02:34 -0700 (PDT) In-Reply-To: <20141006144924.GB37670@ivaldir.etoilebsd.net> References: <201410061443.s96Eh2Jn022718@svn.freebsd.org> <20141006144924.GB37670@ivaldir.etoilebsd.net> Date: Tue, 7 Oct 2014 14:02:34 -0700 X-Google-Sender-Auth: 0LWcdi-B4R7r-zlmDCCTRk5o79s Message-ID: Subject: Re: svn commit: r272649 - head/contrib/byacc From: Craig Rodrigues To: Baptiste Daroussin Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 21:02:37 -0000 On Mon, Oct 6, 2014 at 7:49 AM, Baptiste Daroussin wrote: > > Why a direct commit instead of a proper import of 20141005 version? it > would > have imho been better, simpler and easier to maintain. > Because according to Thomas Dickey, he did not fix all the memory related problems in snapshot 20141005. Specifically there are still some issues not fixed when realloc() is called. I was going to wait for the next snapshot. However, I wanted to get that one fix into FreeBSD to fix the kyua tests, which have been failing under Jenkins. See: https://jenkins.freebsd.org/jenkins/job/FreeBSD_HEAD-tests2/ (see runs #10 and #11). -- Craig From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 21:26:24 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AA8C78A7; Tue, 7 Oct 2014 21:26:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9671B17D; Tue, 7 Oct 2014 21:26:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s97LQOEs025769; Tue, 7 Oct 2014 21:26:24 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s97LQNrX025760; Tue, 7 Oct 2014 21:26:23 GMT (envelope-from np@FreeBSD.org) Message-Id: <201410072126.s97LQNrX025760@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 7 Oct 2014 21:26:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272719 - in head/sys/dev/cxgbe: common tom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 21:26:24 -0000 Author: np Date: Tue Oct 7 21:26:22 2014 New Revision: 272719 URL: https://svnweb.freebsd.org/changeset/base/272719 Log: cxgbe/tom: don't leak resources tied to an active open request that cannot be sent to the chip because a prerequisite L2 resolution failed. Submitted by: Hariprasad at chelsio dot com (original version) MFC after: 2 weeks. Modified: head/sys/dev/cxgbe/common/t4_msg.h head/sys/dev/cxgbe/tom/t4_connect.c head/sys/dev/cxgbe/tom/t4_tom.c head/sys/dev/cxgbe/tom/t4_tom.h head/sys/dev/cxgbe/tom/t4_tom_l2t.c Modified: head/sys/dev/cxgbe/common/t4_msg.h ============================================================================== --- head/sys/dev/cxgbe/common/t4_msg.h Tue Oct 7 20:13:47 2014 (r272718) +++ head/sys/dev/cxgbe/common/t4_msg.h Tue Oct 7 21:26:22 2014 (r272719) @@ -273,6 +273,7 @@ union opcode_tid { /* extract the TID from a CPL command */ #define GET_TID(cmd) (G_TID(ntohl(OPCODE_TID(cmd)))) +#define GET_OPCODE(cmd) ((cmd)->ot.opcode) /* partitioning of TID fields that also carry a queue id */ #define S_TID_TID 0 Modified: head/sys/dev/cxgbe/tom/t4_connect.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_connect.c Tue Oct 7 20:13:47 2014 (r272718) +++ head/sys/dev/cxgbe/tom/t4_connect.c Tue Oct 7 21:26:22 2014 (r272719) @@ -115,8 +115,8 @@ do_act_establish(struct sge_iq *iq, cons { struct adapter *sc = iq->adapter; const struct cpl_act_establish *cpl = (const void *)(rss + 1); - unsigned int tid = GET_TID(cpl); - unsigned int atid = G_TID_TID(ntohl(cpl->tos_atid)); + u_int tid = GET_TID(cpl); + u_int atid = G_TID_TID(ntohl(cpl->tos_atid)); struct toepcb *toep = lookup_atid(sc, atid); struct inpcb *inp = toep->inp; @@ -178,17 +178,34 @@ act_open_rpl_status_to_errno(int status) } } +void +act_open_failure_cleanup(struct adapter *sc, u_int atid, u_int status) +{ + struct toepcb *toep = lookup_atid(sc, atid); + struct inpcb *inp = toep->inp; + struct toedev *tod = &toep->td->tod; + + free_atid(sc, atid); + toep->tid = -1; + + if (status != EAGAIN) + INP_INFO_WLOCK(&V_tcbinfo); + INP_WLOCK(inp); + toe_connect_failed(tod, inp, status); + final_cpl_received(toep); /* unlocks inp */ + if (status != EAGAIN) + INP_INFO_WUNLOCK(&V_tcbinfo); +} + static int do_act_open_rpl(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) { struct adapter *sc = iq->adapter; const struct cpl_act_open_rpl *cpl = (const void *)(rss + 1); - unsigned int atid = G_TID_TID(G_AOPEN_ATID(be32toh(cpl->atid_status))); - unsigned int status = G_AOPEN_STATUS(be32toh(cpl->atid_status)); + u_int atid = G_TID_TID(G_AOPEN_ATID(be32toh(cpl->atid_status))); + u_int status = G_AOPEN_STATUS(be32toh(cpl->atid_status)); struct toepcb *toep = lookup_atid(sc, atid); - struct inpcb *inp = toep->inp; - struct toedev *tod = &toep->td->tod; int rc; KASSERT(m == NULL, ("%s: wasn't expecting payload", __func__)); @@ -200,20 +217,11 @@ do_act_open_rpl(struct sge_iq *iq, const if (negative_advice(status)) return (0); - free_atid(sc, atid); - toep->tid = -1; - if (status && act_open_has_tid(status)) release_tid(sc, GET_TID(cpl), toep->ctrlq); rc = act_open_rpl_status_to_errno(status); - if (rc != EAGAIN) - INP_INFO_WLOCK(&V_tcbinfo); - INP_WLOCK(inp); - toe_connect_failed(tod, inp, rc); - final_cpl_received(toep); /* unlocks inp */ - if (rc != EAGAIN) - INP_INFO_WUNLOCK(&V_tcbinfo); + act_open_failure_cleanup(sc, atid, rc); return (0); } Modified: head/sys/dev/cxgbe/tom/t4_tom.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.c Tue Oct 7 20:13:47 2014 (r272718) +++ head/sys/dev/cxgbe/tom/t4_tom.c Tue Oct 7 21:26:22 2014 (r272719) @@ -98,6 +98,7 @@ static void t4_clip_task(void *, int); static void update_clip_table(struct adapter *, struct tom_data *); static void destroy_clip_table(struct adapter *, struct tom_data *); static void free_tom_data(struct adapter *, struct tom_data *); +static void reclaim_wr_resources(void *, int); static int in6_ifaddr_gen; static eventhandler_tag ifaddr_evhandler; @@ -903,6 +904,8 @@ free_tom_data(struct adapter *sc, struct if (td->listen_mask != 0) hashdestroy(td->listen_hash, M_CXGBE, td->listen_mask); + if (mtx_initialized(&td->unsent_wr_lock)) + mtx_destroy(&td->unsent_wr_lock); if (mtx_initialized(&td->lctx_hash_lock)) mtx_destroy(&td->lctx_hash_lock); if (mtx_initialized(&td->toep_list_lock)) @@ -912,6 +915,44 @@ free_tom_data(struct adapter *sc, struct free(td, M_CXGBE); } +static void +reclaim_wr_resources(void *arg, int count) +{ + struct tom_data *td = arg; + STAILQ_HEAD(, wrqe) twr_list = STAILQ_HEAD_INITIALIZER(twr_list); + struct cpl_act_open_req *cpl; + u_int opcode, atid; + struct wrqe *wr; + struct adapter *sc; + + mtx_lock(&td->unsent_wr_lock); + STAILQ_SWAP(&td->unsent_wr_list, &twr_list, wrqe); + mtx_unlock(&td->unsent_wr_lock); + + while ((wr = STAILQ_FIRST(&twr_list)) != NULL) { + STAILQ_REMOVE_HEAD(&twr_list, link); + + cpl = wrtod(wr); + opcode = GET_OPCODE(cpl); + + switch (opcode) { + case CPL_ACT_OPEN_REQ: + case CPL_ACT_OPEN_REQ6: + atid = G_TID_TID(be32toh(OPCODE_TID(cpl))); + sc = td_adapter(td); + + CTR2(KTR_CXGBE, "%s: atid %u ", __func__, atid); + act_open_failure_cleanup(sc, atid, EHOSTUNREACH); + free(wr, M_CXGBE); + break; + default: + log(LOG_ERR, "%s: leaked work request %p, wr_len %d, " + "opcode %x\n", __func__, wr, wr->wr_len, opcode); + /* WR not freed here; go look at it with a debugger. */ + } + } +} + /* * Ground control to Major TOM * Commencing countdown, engines on @@ -939,6 +980,11 @@ t4_tom_activate(struct adapter *sc) td->listen_hash = hashinit_flags(LISTEN_HASH_SIZE, M_CXGBE, &td->listen_mask, HASH_NOWAIT); + /* List of WRs for which L2 resolution failed */ + mtx_init(&td->unsent_wr_lock, "Unsent WR list lock", NULL, MTX_DEF); + STAILQ_INIT(&td->unsent_wr_list); + TASK_INIT(&td->reclaim_wr_resources, 0, reclaim_wr_resources, td); + /* TID tables */ rc = alloc_tid_tabs(&sc->tids); if (rc != 0) @@ -1012,6 +1058,12 @@ t4_tom_deactivate(struct adapter *sc) rc = EBUSY; mtx_unlock(&td->lctx_hash_lock); + taskqueue_drain(taskqueue_thread, &td->reclaim_wr_resources); + mtx_lock(&td->unsent_wr_lock); + if (!STAILQ_EMPTY(&td->unsent_wr_list)) + rc = EBUSY; + mtx_unlock(&td->unsent_wr_lock); + if (rc == 0) { unregister_toedev(sc->tom_softc); free_tom_data(sc, td); Modified: head/sys/dev/cxgbe/tom/t4_tom.h ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.h Tue Oct 7 20:13:47 2014 (r272718) +++ head/sys/dev/cxgbe/tom/t4_tom.h Tue Oct 7 21:26:22 2014 (r272719) @@ -210,6 +210,11 @@ struct tom_data { struct mtx clip_table_lock; struct clip_head clip_table; int clip_gen; + + /* WRs that will not be sent to the chip because L2 resolution failed */ + struct mtx unsent_wr_lock; + STAILQ_HEAD(, wrqe) unsent_wr_list; + struct task reclaim_wr_resources; }; static inline struct tom_data * @@ -252,6 +257,7 @@ void release_lip(struct tom_data *, stru void t4_init_connect_cpl_handlers(struct adapter *); int t4_connect(struct toedev *, struct socket *, struct rtentry *, struct sockaddr *); +void act_open_failure_cleanup(struct adapter *, u_int, u_int); /* t4_listen.c */ void t4_init_listen_cpl_handlers(struct adapter *); Modified: head/sys/dev/cxgbe/tom/t4_tom_l2t.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom_l2t.c Tue Oct 7 20:13:47 2014 (r272718) +++ head/sys/dev/cxgbe/tom/t4_tom_l2t.c Tue Oct 7 21:26:22 2014 (r272719) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -161,25 +162,17 @@ send_pending(struct adapter *sc, struct } static void -resolution_failed_for_wr(struct wrqe *wr) +resolution_failed(struct adapter *sc, struct l2t_entry *e) { - log(LOG_ERR, "%s: leaked work request %p, wr_len %d\n", __func__, wr, - wr->wr_len); - - /* free(wr, M_CXGBE); */ -} - -static void -resolution_failed(struct l2t_entry *e) -{ - struct wrqe *wr; + struct tom_data *td = sc->tom_softc; mtx_assert(&e->lock, MA_OWNED); - while ((wr = STAILQ_FIRST(&e->wr_list)) != NULL) { - STAILQ_REMOVE_HEAD(&e->wr_list, link); - resolution_failed_for_wr(wr); - } + mtx_lock(&td->unsent_wr_lock); + STAILQ_CONCAT(&td->unsent_wr_list, &e->wr_list); + mtx_unlock(&td->unsent_wr_lock); + + taskqueue_enqueue(taskqueue_thread, &td->reclaim_wr_resources); } static void @@ -203,7 +196,7 @@ update_entry(struct adapter *sc, struct * need to wlock the table). */ e->state = L2T_STATE_FAILED; - resolution_failed(e); + resolution_failed(sc, e); return; } else if (lladdr == NULL) { @@ -305,12 +298,11 @@ again: if (e->state == L2T_STATE_VALID && !STAILQ_EMPTY(&e->wr_list)) send_pending(sc, e); if (e->state == L2T_STATE_FAILED) - resolution_failed(e); + resolution_failed(sc, e); mtx_unlock(&e->lock); break; case L2T_STATE_FAILED: - resolution_failed_for_wr(wr); return (EHOSTUNREACH); } From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 21:50:29 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9F6C9E61; Tue, 7 Oct 2014 21:50:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7EFDE3F0; Tue, 7 Oct 2014 21:50:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s97LoTwg036306; Tue, 7 Oct 2014 21:50:29 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s97LoSiq036303; Tue, 7 Oct 2014 21:50:28 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201410072150.s97LoSiq036303@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Tue, 7 Oct 2014 21:50:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272720 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 21:50:29 -0000 Author: sbruno Date: Tue Oct 7 21:50:28 2014 New Revision: 272720 URL: https://svnweb.freebsd.org/changeset/base/272720 Log: Implement PLPMTUD blackhole detection (RFC 4821), inspired by code from xnu sources. If we encounter a network where ICMP is blocked the Needs Frag indicator may not propagate back to us. Attempt to downshift the mss once to a preconfigured value. Default this feature to off for now while we do not have a full PLPMTUD implementation in our stack. Adds the following new sysctl's for control: net.inet.tcp.pmtud_blackhole_detection -- turns on/off this feature net.inet.tcp.pmtud_blackhole_mss -- mss to try for ipv4 net.inet.tcp.v6pmtud_blackhole_mss -- mss to try for ipv6 Adds the following new sysctl's for monitoring: -- Number of times the code was activated to attempt a mss downshift net.inet.tcp.pmtud_blackhole_activated -- Number of times the blackhole mss was used in an attempt to downshift net.inet.tcp.pmtud_blackhole_min_activated -- Number of times that we failed to connect after we downshifted the mss net.inet.tcp.pmtud_blackhole_failed Phabricator: https://reviews.freebsd.org/D506 Reviewed by: rpaulo bz MFC after: 2 weeks Relnotes: yes Sponsored by: Limelight Networks Modified: head/sys/netinet/tcp_output.c head/sys/netinet/tcp_timer.c head/sys/netinet/tcp_var.h Modified: head/sys/netinet/tcp_output.c ============================================================================== --- head/sys/netinet/tcp_output.c Tue Oct 7 21:26:22 2014 (r272719) +++ head/sys/netinet/tcp_output.c Tue Oct 7 21:50:28 2014 (r272720) @@ -675,6 +675,12 @@ just_return: send: SOCKBUF_LOCK_ASSERT(&so->so_snd); + if (len > 0) { + if (len >= tp->t_maxseg) + tp->t_flags2 |= TF2_PLPMTU_MAXSEGSNT; + else + tp->t_flags2 &= ~TF2_PLPMTU_MAXSEGSNT; + } /* * Before ESTABLISHED, force sending of initial options * unless TCP set not to do any options. @@ -1303,8 +1309,12 @@ send: * * NB: Don't set DF on small MTU/MSS to have a safe fallback. */ - if (V_path_mtu_discovery && tp->t_maxopd > V_tcp_minmss) + if (V_path_mtu_discovery && tp->t_maxopd > V_tcp_minmss) { ip->ip_off |= htons(IP_DF); + tp->t_flags2 |= TF2_PLPMTU_PMTUD; + } else { + tp->t_flags2 &= ~TF2_PLPMTU_PMTUD; + } if (tp->t_state == TCPS_SYN_SENT) TCP_PROBE5(connect__request, NULL, tp, ip, tp, th); Modified: head/sys/netinet/tcp_timer.c ============================================================================== --- head/sys/netinet/tcp_timer.c Tue Oct 7 21:26:22 2014 (r272719) +++ head/sys/netinet/tcp_timer.c Tue Oct 7 21:50:28 2014 (r272720) @@ -66,6 +66,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef INET6 +#include +#endif #include #ifdef TCPDEBUG #include @@ -127,6 +130,54 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, rexm &tcp_rexmit_drop_options, 0, "Drop TCP options from 3rd and later retransmitted SYN"); +static VNET_DEFINE(int, tcp_pmtud_blackhole_detect); +#define V_tcp_pmtud_blackhole_detect VNET(tcp_pmtud_blackhole_detect) +SYSCTL_INT(_net_inet_tcp, OID_AUTO, pmtud_blackhole_detection, + CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_VNET, + &VNET_NAME(tcp_pmtud_blackhole_detect), 0, + "Path MTU Discovery Black Hole Detection Enabled"); + +static VNET_DEFINE(int, tcp_pmtud_blackhole_activated); +#define V_tcp_pmtud_blackhole_activated \ + VNET(tcp_pmtud_blackhole_activated) +SYSCTL_INT(_net_inet_tcp, OID_AUTO, pmtud_blackhole_activated, + CTLTYPE_INT|CTLFLAG_RD|CTLFLAG_VNET, + &VNET_NAME(tcp_pmtud_blackhole_activated), 0, + "Path MTU Discovery Black Hole Detection, Activation Count"); + +static VNET_DEFINE(int, tcp_pmtud_blackhole_activated_min_mss); +#define V_tcp_pmtud_blackhole_activated_min_mss \ + VNET(tcp_pmtud_blackhole_activated_min_mss) +SYSCTL_INT(_net_inet_tcp, OID_AUTO, pmtud_blackhole_activated_min_mss, + CTLTYPE_INT|CTLFLAG_RD|CTLFLAG_VNET, + &VNET_NAME(tcp_pmtud_blackhole_activated_min_mss), 0, + "Path MTU Discovery Black Hole Detection, Activation Count at min MSS"); + +static VNET_DEFINE(int, tcp_pmtud_blackhole_failed); +#define V_tcp_pmtud_blackhole_failed VNET(tcp_pmtud_blackhole_failed) +SYSCTL_INT(_net_inet_tcp, OID_AUTO, pmtud_blackhole_failed, + CTLTYPE_INT|CTLFLAG_RD|CTLFLAG_VNET, + &VNET_NAME(tcp_pmtud_blackhole_failed), 0, + "Path MTU Discovery Black Hole Detection, Failure Count"); + +#ifdef INET +static VNET_DEFINE(int, tcp_pmtud_blackhole_mss) = 1200; +#define V_tcp_pmtud_blackhole_mss VNET(tcp_pmtud_blackhole_mss) +SYSCTL_INT(_net_inet_tcp, OID_AUTO, pmtud_blackhole_mss, + CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_VNET, + &VNET_NAME(tcp_pmtud_blackhole_mss), 0, + "Path MTU Discovery Black Hole Detection lowered MSS"); +#endif + +#ifdef INET6 +static VNET_DEFINE(int, tcp_v6pmtud_blackhole_mss) = 1220; +#define V_tcp_v6pmtud_blackhole_mss VNET(tcp_v6pmtud_blackhole_mss) +SYSCTL_INT(_net_inet_tcp, OID_AUTO, v6pmtud_blackhole_mss, + CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_VNET, + &VNET_NAME(tcp_v6pmtud_blackhole_mss), 0, + "Path MTU Discovery IPv6 Black Hole Detection lowered MSS"); +#endif + #ifdef RSS static int per_cpu_timers = 1; #else @@ -539,6 +590,7 @@ tcp_timer_rexmt(void * xtp) ostate = tp->t_state; #endif + INP_INFO_RLOCK(&V_tcbinfo); inp = tp->t_inpcb; /* @@ -640,6 +692,102 @@ tcp_timer_rexmt(void * xtp) rexmt = TCP_REXMTVAL(tp) * tcp_backoff[tp->t_rxtshift]; TCPT_RANGESET(tp->t_rxtcur, rexmt, tp->t_rttmin, TCPTV_REXMTMAX); + + if (V_tcp_pmtud_blackhole_detect && (tp->t_state == TCPS_ESTABLISHED)) { + int optlen; +#ifdef INET6 + int isipv6; +#endif + + if (((tp->t_flags2 & (TF2_PLPMTU_PMTUD|TF2_PLPMTU_MAXSEGSNT)) == + (TF2_PLPMTU_PMTUD|TF2_PLPMTU_MAXSEGSNT)) && + (tp->t_rxtshift <= 2)) { + /* + * Enter Path MTU Black-hole Detection mechanism: + * - Disable Path MTU Discovery (IP "DF" bit). + * - Reduce MTU to lower value than what we + * negotiated with peer. + */ + /* Record that we may have found a black hole. */ + tp->t_flags2 |= TF2_PLPMTU_BLACKHOLE; + + /* Keep track of previous MSS. */ + optlen = tp->t_maxopd - tp->t_maxseg; + tp->t_pmtud_saved_maxopd = tp->t_maxopd; + + /* + * Reduce the MSS to blackhole value or to the default + * in an attempt to retransmit. + */ +#ifdef INET6 + isipv6 = (tp->t_inpcb->inp_vflag & INP_IPV6) ? 1 : 0; + if (isipv6 && + tp->t_maxopd > V_tcp_v6pmtud_blackhole_mss) { + /* Use the sysctl tuneable blackhole MSS. */ + tp->t_maxopd = V_tcp_v6pmtud_blackhole_mss; + V_tcp_pmtud_blackhole_activated++; + } else if (isipv6) { + /* Use the default MSS. */ + tp->t_maxopd = V_tcp_v6mssdflt; + /* + * Disable Path MTU Discovery when we switch to + * minmss. + */ + tp->t_flags2 &= ~TF2_PLPMTU_PMTUD; + V_tcp_pmtud_blackhole_activated_min_mss++; + } +#endif +#if defined(INET6) && defined(INET) + else +#endif +#ifdef INET + if (tp->t_maxopd > V_tcp_pmtud_blackhole_mss) { + /* Use the sysctl tuneable blackhole MSS. */ + tp->t_maxopd = V_tcp_pmtud_blackhole_mss; + V_tcp_pmtud_blackhole_activated++; + } else { + /* Use the default MSS. */ + tp->t_maxopd = V_tcp_mssdflt; + /* + * Disable Path MTU Discovery when we switch to + * minmss. + */ + tp->t_flags2 &= ~TF2_PLPMTU_PMTUD; + V_tcp_pmtud_blackhole_activated_min_mss++; + } +#endif + tp->t_maxseg = tp->t_maxopd - optlen; + /* + * Reset the slow-start flight size + * as it may depend on the new MSS. + */ + if (CC_ALGO(tp)->conn_init != NULL) + CC_ALGO(tp)->conn_init(tp->ccv); + } else { + /* + * If further retransmissions are still unsuccessful + * with a lowered MTU, maybe this isn't a blackhole and + * we restore the previous MSS and blackhole detection + * flags. + */ + if ((tp->t_flags2 & TF2_PLPMTU_BLACKHOLE) && + (tp->t_rxtshift > 4)) { + tp->t_flags2 |= TF2_PLPMTU_PMTUD; + tp->t_flags2 &= ~TF2_PLPMTU_BLACKHOLE; + optlen = tp->t_maxopd - tp->t_maxseg; + tp->t_maxopd = tp->t_pmtud_saved_maxopd; + tp->t_maxseg = tp->t_maxopd - optlen; + V_tcp_pmtud_blackhole_failed++; + /* + * Reset the slow-start flight size as it + * may depend on the new MSS. + */ + if (CC_ALGO(tp)->conn_init != NULL) + CC_ALGO(tp)->conn_init(tp->ccv); + } + } + } + /* * Disable RFC1323 and SACK if we haven't got any response to * our third SYN to work-around some broken terminal servers Modified: head/sys/netinet/tcp_var.h ============================================================================== --- head/sys/netinet/tcp_var.h Tue Oct 7 21:26:22 2014 (r272719) +++ head/sys/netinet/tcp_var.h Tue Oct 7 21:50:28 2014 (r272720) @@ -200,6 +200,8 @@ struct tcpcb { u_int t_keepcnt; /* number of keepalives before close */ u_int t_tsomax; /* TSO total burst length limit in bytes */ + u_int t_pmtud_saved_maxopd; /* pre-blackhole MSS */ + u_int t_flags2; /* More tcpcb flags storage */ uint32_t t_ispare[6]; /* 5 UTO, 1 TBD */ uint32_t t_tsomaxsegcount; /* TSO maximum segment count */ @@ -278,6 +280,13 @@ struct tcpcb { #endif /* TCP_SIGNATURE */ /* + * Flags for PLPMTU handling, t_flags2 + */ +#define TF2_PLPMTU_BLACKHOLE 0x00000001 /* Possible PLPMTUD Black Hole. */ +#define TF2_PLPMTU_PMTUD 0x00000002 /* Allowed to attempt PLPMTUD. */ +#define TF2_PLPMTU_MAXSEGSNT 0x00000004 /* Last seg sent was full seg. */ + +/* * Structure to hold TCP options that are only used during segment * processing (in tcp_input), but not held in the tcpcb. * It's basically used to reduce the number of parameters From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 22:39:48 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2753014E; Tue, 7 Oct 2014 22:39:48 +0000 (UTC) Received: from mail-wg0-x22a.google.com (mail-wg0-x22a.google.com [IPv6:2a00:1450:400c:c00::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3A641B1F; Tue, 7 Oct 2014 22:39:47 +0000 (UTC) Received: by mail-wg0-f42.google.com with SMTP id z12so10349909wgg.13 for ; Tue, 07 Oct 2014 15:39:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=Anvucj+QE3CVEdbIHlvIM2zbqcYY1nVif8bPSWfOp4Y=; b=vyz5NHOpHP1otfckYuxzMSgruZMuTN/AMUSRtpIJYi4aPxGJDNCtUHsMmigs5WTmQn tnaM/7XlJFakKWWQON26b8viXK+YZPOlWn4fmE38bSEiRhEarHAXdP+YTbavbUpCtafA mnoUedGz3Ep+WmBPCxUwrIOJFoymV3kH5yUCLg89C+JkqaKEoa7pge+hSF6Qe3L339FF eBup9Pgn3fwP6bsM5JwCMpcRII53DJZQW1JDs/ozEXAVdRBTIuTLfqejQeOFOQ9g+F8Y E7hKkCRuLLOttPgfpo3lA8j5ZXS23wA9uW0UPdcpCUBiyQKvCkUmfCoZBOIB+vIXNiCF kL+A== X-Received: by 10.194.171.37 with SMTP id ar5mr7878885wjc.69.1412721585558; Tue, 07 Oct 2014 15:39:45 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by mx.google.com with ESMTPSA id eg8sm16347242wib.15.2014.10.07.15.39.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Oct 2014 15:39:44 -0700 (PDT) Sender: Baptiste Daroussin Date: Wed, 8 Oct 2014 00:39:42 +0200 From: Baptiste Daroussin To: Craig Rodrigues Subject: Re: svn commit: r272649 - head/contrib/byacc Message-ID: <20141007223941.GT37670@ivaldir.etoilebsd.net> References: <201410061443.s96Eh2Jn022718@svn.freebsd.org> <20141006144924.GB37670@ivaldir.etoilebsd.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ULJ2Z7kCM1hyNsWd" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 22:39:48 -0000 --ULJ2Z7kCM1hyNsWd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 07, 2014 at 02:02:34PM -0700, Craig Rodrigues wrote: > On Mon, Oct 6, 2014 at 7:49 AM, Baptiste Daroussin wro= te: >=20 > > > > Why a direct commit instead of a proper import of 20141005 version? it > > would > > have imho been better, simpler and easier to maintain. > > >=20 > Because according to Thomas Dickey, he did not fix all > the memory related problems in snapshot 20141005. Specifically there are > still > some issues not fixed when realloc() is called. > I was going to wait for the next snapshot. > However, I wanted to get that one fix into FreeBSD to fix the kyua tests, > which have been failing under Jenkins. See: > https://jenkins.freebsd.org/jenkins/job/FreeBSD_HEAD-tests2/ > (see runs #10 and #11). In that case I will import the new one which has the fix (do you confirm?) Best regards, Bapt --ULJ2Z7kCM1hyNsWd Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlQ0a60ACgkQ8kTtMUmk6EzoHQCfZR3GElARQNXmB9sKWmCRAxCh 1wEAoJ6Rr0tCDMtWUcaDEioIp8d+WkDR =arik -----END PGP SIGNATURE----- --ULJ2Z7kCM1hyNsWd-- From owner-svn-src-head@FreeBSD.ORG Tue Oct 7 23:58:32 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C1194A17; Tue, 7 Oct 2014 23:58:32 +0000 (UTC) Received: from woozle.rinet.ru (woozle.rinet.ru [195.54.192.68]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3E2173CE; Tue, 7 Oct 2014 23:58:31 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by woozle.rinet.ru (8.14.5/8.14.5) with ESMTP id s97Nw14m025800; Wed, 8 Oct 2014 03:58:01 +0400 (MSK) (envelope-from marck@rinet.ru) Date: Wed, 8 Oct 2014 03:58:01 +0400 (MSK) From: Dmitry Morozovsky To: Ed Maste Subject: Re: svn commit: r272384 - head/usr.bin/mkimg In-Reply-To: Message-ID: References: <201410012103.s91L3HR0010906@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) X-NCC-RegID: ru.rinet X-OpenPGP-Key-ID: 6B691B03 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (woozle.rinet.ru [0.0.0.0]); Wed, 08 Oct 2014 03:58:02 +0400 (MSK) Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2014 23:58:32 -0000 On Fri, 3 Oct 2014, Ed Maste wrote: > On 2 October 2014 10:43, Ed Maste wrote: > > > > I've been using brooks' NO_ROOT support along with makefs / mkimg to > > build and test changes by creating an image to boot in QEMU. This > > change provides a noticeable improvement in the cycle time. > > I've had a couple of inquiries about the workflow I've been using, so > I've added a brief set of steps to my Wiki page at > https://wiki.freebsd.org/EdMaste/BuildVM . > > With -DNO_ROOT for the install targets an mtree file named METALOG > file is created at the top of DESTDIR. Files are installed owned by > the user, without special flags. Makefs reads the METALOG file and > applies the desired ownership, permissions and flags in the generated > file system. > > Then mkimg creates an image with a GPT partition table, the UFS > filesystem created by makefs, and the various boot loader bits for > legacy and UEFI boot. Wouldn't it be useful for automating backing up config directories? I'd think about copying, say, /etc and /usr/local/etc to sometemporary place, changing owner to non-privileged user, and then commit changes (removals should be treated specially, of course) to some kind of SCM? Or, does such project exist already? I failed to find it, but maybe my goole-fu is lacking necessary components ;) -- Sincerely, D.Marck [DM5020, MCK-RIPE, DM3-RIPN] [ FreeBSD committer: marck@FreeBSD.org ] ------------------------------------------------------------------------ *** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck@rinet.ru *** ------------------------------------------------------------------------ From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 01:03:33 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B015F5C0; Wed, 8 Oct 2014 01:03:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9221DC12; Wed, 8 Oct 2014 01:03:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9813Xur031893; Wed, 8 Oct 2014 01:03:33 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9813W7h031886; Wed, 8 Oct 2014 01:03:32 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201410080103.s9813W7h031886@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Wed, 8 Oct 2014 01:03:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272721 - in head/sys/dev: alc ale X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 01:03:33 -0000 Author: yongari Date: Wed Oct 8 01:03:32 2014 New Revision: 272721 URL: https://svnweb.freebsd.org/changeset/base/272721 Log: Fix a long standing bug in MAC statistics register access. One additional register was erroneously added in the MAC register set such that 7 TX statistics counters were wrong. Modified: head/sys/dev/alc/if_alc.c head/sys/dev/alc/if_alcreg.h head/sys/dev/ale/if_ale.c head/sys/dev/ale/if_alereg.h Modified: head/sys/dev/alc/if_alc.c ============================================================================== --- head/sys/dev/alc/if_alc.c Tue Oct 7 21:50:28 2014 (r272720) +++ head/sys/dev/alc/if_alc.c Wed Oct 8 01:03:32 2014 (r272721) @@ -1287,8 +1287,6 @@ alc_sysctl_node(struct alc_softc *sc) &stats->tx_late_colls, "Late collisions"); ALC_SYSCTL_STAT_ADD32(ctx, child, "excess_colls", &stats->tx_excess_colls, "Excessive collisions"); - ALC_SYSCTL_STAT_ADD32(ctx, child, "abort", - &stats->tx_abort, "Aborted frames due to Excessive collisions"); ALC_SYSCTL_STAT_ADD32(ctx, child, "underruns", &stats->tx_underrun, "FIFO underruns"); ALC_SYSCTL_STAT_ADD32(ctx, child, "desc_underruns", @@ -2599,7 +2597,6 @@ alc_stats_update(struct alc_softc *sc) stat->tx_multi_colls += smb->tx_multi_colls; stat->tx_late_colls += smb->tx_late_colls; stat->tx_excess_colls += smb->tx_excess_colls; - stat->tx_abort += smb->tx_abort; stat->tx_underrun += smb->tx_underrun; stat->tx_desc_underrun += smb->tx_desc_underrun; stat->tx_lenerrs += smb->tx_lenerrs; @@ -2612,17 +2609,10 @@ alc_stats_update(struct alc_softc *sc) if_inc_counter(ifp, IFCOUNTER_COLLISIONS, smb->tx_single_colls + smb->tx_multi_colls * 2 + smb->tx_late_colls + - smb->tx_abort * HDPX_CFG_RETRY_DEFAULT); + smb->tx_excess_colls * HDPX_CFG_RETRY_DEFAULT); - /* - * XXX - * tx_pkts_truncated counter looks suspicious. It constantly - * increments with no sign of Tx errors. This may indicate - * the counter name is not correct one so I've removed the - * counter in output errors. - */ - if_inc_counter(ifp, IFCOUNTER_OERRORS, - smb->tx_abort + smb->tx_late_colls + smb->tx_underrun); + if_inc_counter(ifp, IFCOUNTER_OERRORS, smb->tx_late_colls + + smb->tx_excess_colls + smb->tx_underrun + smb->tx_pkts_truncated); if_inc_counter(ifp, IFCOUNTER_IPACKETS, smb->rx_frames); Modified: head/sys/dev/alc/if_alcreg.h ============================================================================== --- head/sys/dev/alc/if_alcreg.h Tue Oct 7 21:50:28 2014 (r272720) +++ head/sys/dev/alc/if_alcreg.h Wed Oct 8 01:03:32 2014 (r272721) @@ -860,7 +860,6 @@ struct smb { uint32_t tx_multi_colls; uint32_t tx_late_colls; uint32_t tx_excess_colls; - uint32_t tx_abort; uint32_t tx_underrun; uint32_t tx_desc_underrun; uint32_t tx_lenerrs; Modified: head/sys/dev/ale/if_ale.c ============================================================================== --- head/sys/dev/ale/if_ale.c Tue Oct 7 21:50:28 2014 (r272720) +++ head/sys/dev/ale/if_ale.c Wed Oct 8 01:03:32 2014 (r272721) @@ -946,8 +946,6 @@ ale_sysctl_node(struct ale_softc *sc) &stats->tx_late_colls, "Late collisions"); ALE_SYSCTL_STAT_ADD32(ctx, child, "excess_colls", &stats->tx_excess_colls, "Excessive collisions"); - ALE_SYSCTL_STAT_ADD32(ctx, child, "abort", - &stats->tx_abort, "Aborted frames due to Excessive collisions"); ALE_SYSCTL_STAT_ADD32(ctx, child, "underruns", &stats->tx_underrun, "FIFO underruns"); ALE_SYSCTL_STAT_ADD32(ctx, child, "desc_underruns", @@ -2197,7 +2195,6 @@ ale_stats_update(struct ale_softc *sc) stat->tx_multi_colls += smb->tx_multi_colls; stat->tx_late_colls += smb->tx_late_colls; stat->tx_excess_colls += smb->tx_excess_colls; - stat->tx_abort += smb->tx_abort; stat->tx_underrun += smb->tx_underrun; stat->tx_desc_underrun += smb->tx_desc_underrun; stat->tx_lenerrs += smb->tx_lenerrs; @@ -2210,17 +2207,10 @@ ale_stats_update(struct ale_softc *sc) if_inc_counter(ifp, IFCOUNTER_COLLISIONS, smb->tx_single_colls + smb->tx_multi_colls * 2 + smb->tx_late_colls + - smb->tx_abort * HDPX_CFG_RETRY_DEFAULT); + smb->tx_excess_colls * HDPX_CFG_RETRY_DEFAULT); - /* - * XXX - * tx_pkts_truncated counter looks suspicious. It constantly - * increments with no sign of Tx errors. This may indicate - * the counter name is not correct one so I've removed the - * counter in output errors. - */ - if_inc_counter(ifp, IFCOUNTER_OERRORS, - smb->tx_abort + smb->tx_late_colls + smb->tx_underrun); + if_inc_counter(ifp, IFCOUNTER_OERRORS, smb->tx_late_colls + + smb->tx_excess_colls + smb->tx_underrun + smb->tx_pkts_truncated); if_inc_counter(ifp, IFCOUNTER_IPACKETS, smb->rx_frames); Modified: head/sys/dev/ale/if_alereg.h ============================================================================== --- head/sys/dev/ale/if_alereg.h Tue Oct 7 21:50:28 2014 (r272720) +++ head/sys/dev/ale/if_alereg.h Wed Oct 8 01:03:32 2014 (r272721) @@ -605,7 +605,6 @@ struct smb { uint32_t tx_multi_colls; uint32_t tx_late_colls; uint32_t tx_excess_colls; - uint32_t tx_abort; uint32_t tx_underrun; uint32_t tx_desc_underrun; uint32_t tx_lenerrs; From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 05:04:31 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D9DB9B50; Wed, 8 Oct 2014 05:04:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C624460F; Wed, 8 Oct 2014 05:04:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9854VRC044603; Wed, 8 Oct 2014 05:04:31 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9854Vbd044602; Wed, 8 Oct 2014 05:04:31 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201410080504.s9854Vbd044602@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Wed, 8 Oct 2014 05:04:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272728 - head/usr.bin/w X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 05:04:32 -0000 Author: eadler Date: Wed Oct 8 05:04:31 2014 New Revision: 272728 URL: https://svnweb.freebsd.org/changeset/base/272728 Log: don't reinvent the wheel: rely on basename(3) Reviewed by: nwhitehorn Modified: head/usr.bin/w/w.c Modified: head/usr.bin/w/w.c ============================================================================== --- head/usr.bin/w/w.c Wed Oct 8 04:42:56 2014 (r272727) +++ head/usr.bin/w/w.c Wed Oct 8 05:04:31 2014 (r272728) @@ -68,6 +68,7 @@ static const char sccsid[] = "@(#)w.c 8. #include #include #include +#include #include #include #include @@ -121,7 +122,6 @@ static struct entry { static void pr_header(time_t *, int); static struct stat *ttystat(char *); static void usage(int); -static int this_is_uptime(const char *s); char *fmt_argv(char **, char *, char *, size_t); /* ../../bin/ps/fmt.c */ @@ -144,7 +144,7 @@ main(int argc, char *argv[]) use_comma = (*nl_langinfo(RADIXCHAR) != ','); /* Are we w(1) or uptime(1)? */ - if (this_is_uptime(argv[0]) == 0) { + if (strcmp(basename(argv[0]), "uptime") == 0) { wcmd = 0; p = ""; } else { @@ -512,17 +512,3 @@ usage(int wcmd) (void)fprintf(stderr, "usage: uptime\n"); exit(1); } - -static int -this_is_uptime(const char *s) -{ - const char *u; - - if ((u = strrchr(s, '/')) != NULL) - ++u; - else - u = s; - if (strcmp(u, "uptime") == 0) - return (0); - return (-1); -} From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 05:34:40 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A0A53DC; Wed, 8 Oct 2014 05:34:40 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8CDE18D7; Wed, 8 Oct 2014 05:34:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s985Yec6058500; Wed, 8 Oct 2014 05:34:40 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s985YeH8058499; Wed, 8 Oct 2014 05:34:40 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201410080534.s985YeH8058499@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Wed, 8 Oct 2014 05:34:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272729 - head/sys/dev/pci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 05:34:40 -0000 Author: yongari Date: Wed Oct 8 05:34:39 2014 New Revision: 272729 URL: https://svnweb.freebsd.org/changeset/base/272729 Log: Add new quirk PCI_QUIRK_MSI_INTX_BUG to pci(4). QAC AR816x/E2200 controller has a silicon bug that MSI interrupt does not assert if PCIM_CMD_INTxDIS bit of command register is set. Reviewed by: jhb Modified: head/sys/dev/pci/pci.c Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Wed Oct 8 05:04:31 2014 (r272728) +++ head/sys/dev/pci/pci.c Wed Oct 8 05:34:39 2014 (r272729) @@ -207,6 +207,7 @@ struct pci_quirk { #define PCI_QUIRK_ENABLE_MSI_VM 3 /* Older chipset in VM where MSI works */ #define PCI_QUIRK_UNMAP_REG 4 /* Ignore PCI map register */ #define PCI_QUIRK_DISABLE_MSIX 5 /* MSI-X doesn't work */ +#define PCI_QUIRK_MSI_INTX_BUG 5 /* PCIM_CMD_INTxDIS disables MSI */ int arg1; int arg2; }; @@ -266,6 +267,15 @@ static const struct pci_quirk pci_quirks */ { 0x43851002, PCI_QUIRK_UNMAP_REG, 0x14, 0 }, + /* + * Atheros AR8161/AR8162/E2200 ethernet controller has a bug that + * MSI interrupt does not assert if PCIM_CMD_INTxDIS bit of the + * command register is set. + */ + { 0x10911969, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, + { 0xE0911969, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, + { 0x10901969, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, + { 0 } }; @@ -3856,8 +3866,14 @@ pci_setup_intr(device_t dev, device_t ch mte->mte_handlers++; } - /* Make sure that INTx is disabled if we are using MSI/MSIX */ - pci_set_command_bit(dev, child, PCIM_CMD_INTxDIS); + if (!pci_has_quirk(pci_get_devid(dev), + PCI_QUIRK_MSI_INTX_BUG)) { + /* + * Make sure that INTx is disabled if we are + * using MSI/MSIX + */ + pci_set_command_bit(dev, child, PCIM_CMD_INTxDIS); + } bad: if (error) { (void)bus_generic_teardown_intr(dev, child, irq, From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 05:47:01 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EA71C2EC; Wed, 8 Oct 2014 05:47:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D571C9BA; Wed, 8 Oct 2014 05:47:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s985l1Q0063366; Wed, 8 Oct 2014 05:47:01 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s985l1Tu063364; Wed, 8 Oct 2014 05:47:01 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201410080547.s985l1Tu063364@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Wed, 8 Oct 2014 05:47:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272730 - head/sys/dev/alc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 05:47:02 -0000 Author: yongari Date: Wed Oct 8 05:47:01 2014 New Revision: 272730 URL: https://svnweb.freebsd.org/changeset/base/272730 Log: Add support for QAC AR816x/AR817x Gigabit/Fast Ethernet controllers. These controllers seem to have the same feature of AR813x/AR815x and improved RSS support(4 TX queues and 8 RX queues). alc(4) supports all hardware features except RSS. I didn't implement RX checksum offloading for AR816x/AR817x just because I couldn't get confirmation from the Vendor whether AR816x/AR817x corrected its predecessor's RX checksum offloading bug on fragmented packets. This change adds supports for the following controllers. o AR8161 PCIe Gigabit Ethernet controller o AR8162 PCIe Fast Ethernet controller o AR8171 PCIe Gigabit Ethernet controller o AR8172 PCIe Fast Ethernet controller o Killer E2200 Gigabit Ethernet controller Tested by: Many Relnotes: yes MFC after: 2 weeks HW donated by: Qualcomm Atheros Communications, Inc. Modified: head/sys/dev/alc/if_alc.c head/sys/dev/alc/if_alcreg.h head/sys/dev/alc/if_alcvar.h Modified: head/sys/dev/alc/if_alc.c ============================================================================== --- head/sys/dev/alc/if_alc.c Wed Oct 8 05:34:39 2014 (r272729) +++ head/sys/dev/alc/if_alc.c Wed Oct 8 05:47:01 2014 (r272730) @@ -111,17 +111,31 @@ static struct alc_ident alc_ident_table[ "Atheros AR8152 v1.1 PCIe Fast Ethernet" }, { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8152_B2, 6 * 1024, "Atheros AR8152 v2.0 PCIe Fast Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8161, 9 * 1024, + "Atheros AR8161 PCIe Gigabit Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8162, 9 * 1024, + "Atheros AR8161 PCIe Fast Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8171, 9 * 1024, + "Atheros AR8161 PCIe Gigabit Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8172, 9 * 1024, + "Atheros AR8161 PCIe Fast Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_E2200, 9 * 1024, + "Killer E2200 Gigabit Ethernet" }, { 0, 0, 0, NULL} }; -static void alc_aspm(struct alc_softc *, int); +static void alc_aspm(struct alc_softc *, int, int); +static void alc_aspm_813x(struct alc_softc *, int); +static void alc_aspm_816x(struct alc_softc *, int); static int alc_attach(device_t); static int alc_check_boundary(struct alc_softc *); +static void alc_config_msi(struct alc_softc *); static int alc_detach(device_t); static void alc_disable_l0s_l1(struct alc_softc *); static int alc_dma_alloc(struct alc_softc *); static void alc_dma_free(struct alc_softc *); static void alc_dmamap_cb(void *, bus_dma_segment_t *, int, int); +static void alc_dsp_fixup(struct alc_softc *, int); static int alc_encap(struct alc_softc *, struct mbuf **); static struct alc_ident * alc_find_ident(device_t); @@ -130,6 +144,9 @@ static struct mbuf * alc_fixup_rx(struct ifnet *, struct mbuf *); #endif static void alc_get_macaddr(struct alc_softc *); +static void alc_get_macaddr_813x(struct alc_softc *); +static void alc_get_macaddr_816x(struct alc_softc *); +static void alc_get_macaddr_par(struct alc_softc *); static void alc_init(void *); static void alc_init_cmb(struct alc_softc *); static void alc_init_locked(struct alc_softc *); @@ -141,14 +158,26 @@ static void alc_int_task(void *, int); static int alc_intr(void *); static int alc_ioctl(struct ifnet *, u_long, caddr_t); static void alc_mac_config(struct alc_softc *); +static uint32_t alc_mii_readreg_813x(struct alc_softc *, int, int); +static uint32_t alc_mii_readreg_816x(struct alc_softc *, int, int); +static uint32_t alc_mii_writereg_813x(struct alc_softc *, int, int, int); +static uint32_t alc_mii_writereg_816x(struct alc_softc *, int, int, int); static int alc_miibus_readreg(device_t, int, int); static void alc_miibus_statchg(device_t); static int alc_miibus_writereg(device_t, int, int, int); +static uint32_t alc_miidbg_readreg(struct alc_softc *, int); +static uint32_t alc_miidbg_writereg(struct alc_softc *, int, int); +static uint32_t alc_miiext_readreg(struct alc_softc *, int, int); +static uint32_t alc_miiext_writereg(struct alc_softc *, int, int, int); static int alc_mediachange(struct ifnet *); +static int alc_mediachange_locked(struct alc_softc *); static void alc_mediastatus(struct ifnet *, struct ifmediareq *); static int alc_newbuf(struct alc_softc *, struct alc_rxdesc *); +static void alc_osc_reset(struct alc_softc *); static void alc_phy_down(struct alc_softc *); static void alc_phy_reset(struct alc_softc *); +static void alc_phy_reset_813x(struct alc_softc *); +static void alc_phy_reset_816x(struct alc_softc *); static int alc_probe(device_t); static void alc_reset(struct alc_softc *); static int alc_resume(device_t); @@ -158,6 +187,8 @@ static void alc_rxfilter(struct alc_soft static void alc_rxvlan(struct alc_softc *); static void alc_setlinkspeed(struct alc_softc *); static void alc_setwol(struct alc_softc *); +static void alc_setwol_813x(struct alc_softc *); +static void alc_setwol_816x(struct alc_softc *); static int alc_shutdown(device_t); static void alc_start(struct ifnet *); static void alc_start_locked(struct ifnet *); @@ -230,10 +261,21 @@ static int alc_miibus_readreg(device_t dev, int phy, int reg) { struct alc_softc *sc; - uint32_t v; - int i; + int v; sc = device_get_softc(dev); + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + v = alc_mii_readreg_816x(sc, phy, reg); + else + v = alc_mii_readreg_813x(sc, phy, reg); + return (v); +} + +static uint32_t +alc_mii_readreg_813x(struct alc_softc *sc, int phy, int reg) +{ + uint32_t v; + int i; /* * For AR8132 fast ethernet controller, do not report 1000baseT @@ -262,14 +304,52 @@ alc_miibus_readreg(device_t dev, int phy return ((v & MDIO_DATA_MASK) >> MDIO_DATA_SHIFT); } +static uint32_t +alc_mii_readreg_816x(struct alc_softc *sc, int phy, int reg) +{ + uint32_t clk, v; + int i; + + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) + clk = MDIO_CLK_25_128; + else + clk = MDIO_CLK_25_4; + CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_READ | + MDIO_SUP_PREAMBLE | clk | MDIO_REG_ADDR(reg)); + for (i = ALC_PHY_TIMEOUT; i > 0; i--) { + DELAY(5); + v = CSR_READ_4(sc, ALC_MDIO); + if ((v & MDIO_OP_BUSY) == 0) + break; + } + + if (i == 0) { + device_printf(sc->alc_dev, "phy read timeout : %d\n", reg); + return (0); + } + + return ((v & MDIO_DATA_MASK) >> MDIO_DATA_SHIFT); +} + static int alc_miibus_writereg(device_t dev, int phy, int reg, int val) { struct alc_softc *sc; - uint32_t v; - int i; + int v; sc = device_get_softc(dev); + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + v = alc_mii_writereg_816x(sc, phy, reg, val); + else + v = alc_mii_writereg_813x(sc, phy, reg, val); + return (v); +} + +static uint32_t +alc_mii_writereg_813x(struct alc_softc *sc, int phy, int reg, int val) +{ + uint32_t v; + int i; CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_WRITE | (val & MDIO_DATA_MASK) << MDIO_DATA_SHIFT | @@ -287,6 +367,32 @@ alc_miibus_writereg(device_t dev, int ph return (0); } +static uint32_t +alc_mii_writereg_816x(struct alc_softc *sc, int phy, int reg, int val) +{ + uint32_t clk, v; + int i; + + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) + clk = MDIO_CLK_25_128; + else + clk = MDIO_CLK_25_4; + CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_WRITE | + ((val & MDIO_DATA_MASK) << MDIO_DATA_SHIFT) | MDIO_REG_ADDR(reg) | + MDIO_SUP_PREAMBLE | clk); + for (i = ALC_PHY_TIMEOUT; i > 0; i--) { + DELAY(5); + v = CSR_READ_4(sc, ALC_MDIO); + if ((v & MDIO_OP_BUSY) == 0) + break; + } + + if (i == 0) + device_printf(sc->alc_dev, "phy write timeout : %d\n", reg); + + return (0); +} + static void alc_miibus_statchg(device_t dev) { @@ -319,7 +425,6 @@ alc_miibus_statchg(device_t dev) break; } } - alc_stop_queue(sc); /* Stop Rx/Tx MACs. */ alc_stop_mac(sc); @@ -331,7 +436,159 @@ alc_miibus_statchg(device_t dev) reg = CSR_READ_4(sc, ALC_MAC_CFG); reg |= MAC_CFG_TX_ENB | MAC_CFG_RX_ENB; CSR_WRITE_4(sc, ALC_MAC_CFG, reg); - alc_aspm(sc, IFM_SUBTYPE(mii->mii_media_active)); + } + alc_aspm(sc, 0, IFM_SUBTYPE(mii->mii_media_active)); + alc_dsp_fixup(sc, IFM_SUBTYPE(mii->mii_media_active)); +} + +static uint32_t +alc_miidbg_readreg(struct alc_softc *sc, int reg) +{ + + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, ALC_MII_DBG_ADDR, + reg); + return (alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA)); +} + +static uint32_t +alc_miidbg_writereg(struct alc_softc *sc, int reg, int val) +{ + + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, ALC_MII_DBG_ADDR, + reg); + return (alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, val)); +} + +static uint32_t +alc_miiext_readreg(struct alc_softc *sc, int devaddr, int reg) +{ + uint32_t clk, v; + int i; + + CSR_WRITE_4(sc, ALC_EXT_MDIO, EXT_MDIO_REG(reg) | + EXT_MDIO_DEVADDR(devaddr)); + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) + clk = MDIO_CLK_25_128; + else + clk = MDIO_CLK_25_4; + CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_READ | + MDIO_SUP_PREAMBLE | clk | MDIO_MODE_EXT); + for (i = ALC_PHY_TIMEOUT; i > 0; i--) { + DELAY(5); + v = CSR_READ_4(sc, ALC_MDIO); + if ((v & MDIO_OP_BUSY) == 0) + break; + } + + if (i == 0) { + device_printf(sc->alc_dev, "phy ext read timeout : %d, %d\n", + devaddr, reg); + return (0); + } + + return ((v & MDIO_DATA_MASK) >> MDIO_DATA_SHIFT); +} + +static uint32_t +alc_miiext_writereg(struct alc_softc *sc, int devaddr, int reg, int val) +{ + uint32_t clk, v; + int i; + + CSR_WRITE_4(sc, ALC_EXT_MDIO, EXT_MDIO_REG(reg) | + EXT_MDIO_DEVADDR(devaddr)); + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) + clk = MDIO_CLK_25_128; + else + clk = MDIO_CLK_25_4; + CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_WRITE | + ((val & MDIO_DATA_MASK) << MDIO_DATA_SHIFT) | + MDIO_SUP_PREAMBLE | clk | MDIO_MODE_EXT); + for (i = ALC_PHY_TIMEOUT; i > 0; i--) { + DELAY(5); + v = CSR_READ_4(sc, ALC_MDIO); + if ((v & MDIO_OP_BUSY) == 0) + break; + } + + if (i == 0) + device_printf(sc->alc_dev, "phy ext write timeout : %d, %d\n", + devaddr, reg); + + return (0); +} + +static void +alc_dsp_fixup(struct alc_softc *sc, int media) +{ + uint16_t agc, len, val; + + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + return; + if (AR816X_REV(sc->alc_rev) >= AR816X_REV_C0) + return; + + /* + * Vendor PHY magic. + * 1000BT/AZ, wrong cable length + */ + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) { + len = alc_miiext_readreg(sc, MII_EXT_PCS, MII_EXT_CLDCTL6); + len = (len >> EXT_CLDCTL6_CAB_LEN_SHIFT) & + EXT_CLDCTL6_CAB_LEN_MASK; + agc = alc_miidbg_readreg(sc, MII_DBG_AGC); + agc = (agc >> DBG_AGC_2_VGA_SHIFT) & DBG_AGC_2_VGA_MASK; + if ((media == IFM_1000_T && len > EXT_CLDCTL6_CAB_LEN_SHORT1G && + agc > DBG_AGC_LONG1G_LIMT) || + (media == IFM_100_TX && len > DBG_AGC_LONG100M_LIMT && + agc > DBG_AGC_LONG1G_LIMT)) { + alc_miidbg_writereg(sc, MII_DBG_AZ_ANADECT, + DBG_AZ_ANADECT_LONG); + val = alc_miiext_readreg(sc, MII_EXT_ANEG, + MII_EXT_ANEG_AFE); + val |= ANEG_AFEE_10BT_100M_TH; + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_AFE, + val); + } else { + alc_miidbg_writereg(sc, MII_DBG_AZ_ANADECT, + DBG_AZ_ANADECT_DEFAULT); + val = alc_miiext_readreg(sc, MII_EXT_ANEG, + MII_EXT_ANEG_AFE); + val &= ~ANEG_AFEE_10BT_100M_TH; + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_AFE, + val); + } + if ((sc->alc_flags & ALC_FLAG_LINK_WAR) != 0 && + AR816X_REV(sc->alc_rev) == AR816X_REV_B0) { + if (media == IFM_1000_T) { + /* + * Giga link threshold, raise the tolerance of + * noise 50%. + */ + val = alc_miidbg_readreg(sc, MII_DBG_MSE20DB); + val &= ~DBG_MSE20DB_TH_MASK; + val |= (DBG_MSE20DB_TH_HI << + DBG_MSE20DB_TH_SHIFT); + alc_miidbg_writereg(sc, MII_DBG_MSE20DB, val); + } else if (media == IFM_100_TX) + alc_miidbg_writereg(sc, MII_DBG_MSE16DB, + DBG_MSE16DB_UP); + } + } else { + val = alc_miiext_readreg(sc, MII_EXT_ANEG, MII_EXT_ANEG_AFE); + val &= ~ANEG_AFEE_10BT_100M_TH; + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_AFE, val); + if ((sc->alc_flags & ALC_FLAG_LINK_WAR) != 0 && + AR816X_REV(sc->alc_rev) == AR816X_REV_B0) { + alc_miidbg_writereg(sc, MII_DBG_MSE16DB, + DBG_MSE16DB_DOWN); + val = alc_miidbg_readreg(sc, MII_DBG_MSE20DB); + val &= ~DBG_MSE20DB_TH_MASK; + val |= (DBG_MSE20DB_TH_DEFAULT << DBG_MSE20DB_TH_SHIFT); + alc_miidbg_writereg(sc, MII_DBG_MSE20DB, val); + } } } @@ -359,17 +616,29 @@ static int alc_mediachange(struct ifnet *ifp) { struct alc_softc *sc; - struct mii_data *mii; - struct mii_softc *miisc; int error; sc = ifp->if_softc; ALC_LOCK(sc); + error = alc_mediachange_locked(sc); + ALC_UNLOCK(sc); + + return (error); +} + +static int +alc_mediachange_locked(struct alc_softc *sc) +{ + struct mii_data *mii; + struct mii_softc *miisc; + int error; + + ALC_LOCK_ASSERT(sc); + mii = device_get_softc(sc->alc_miibus); LIST_FOREACH(miisc, &mii->mii_phys, mii_list) PHY_RESET(miisc); error = mii_mediachg(mii); - ALC_UNLOCK(sc); return (error); } @@ -407,7 +676,17 @@ alc_probe(device_t dev) static void alc_get_macaddr(struct alc_softc *sc) { - uint32_t ea[2], opt; + + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + alc_get_macaddr_816x(sc); + else + alc_get_macaddr_813x(sc); +} + +static void +alc_get_macaddr_813x(struct alc_softc *sc) +{ + uint32_t opt; uint16_t val; int eeprom, i; @@ -502,6 +781,73 @@ alc_get_macaddr(struct alc_softc *sc) } } + alc_get_macaddr_par(sc); +} + +static void +alc_get_macaddr_816x(struct alc_softc *sc) +{ + uint32_t reg; + int i, reloaded; + + reloaded = 0; + /* Try to reload station address via TWSI. */ + for (i = 100; i > 0; i--) { + reg = CSR_READ_4(sc, ALC_SLD); + if ((reg & (SLD_PROGRESS | SLD_START)) == 0) + break; + DELAY(1000); + } + if (i != 0) { + CSR_WRITE_4(sc, ALC_SLD, reg | SLD_START); + for (i = 100; i > 0; i--) { + DELAY(1000); + reg = CSR_READ_4(sc, ALC_SLD); + if ((reg & SLD_START) == 0) + break; + } + if (i != 0) + reloaded++; + else if (bootverbose) + device_printf(sc->alc_dev, + "reloading station address via TWSI timed out!\n"); + } + + /* Try to reload station address from EEPROM or FLASH. */ + if (reloaded == 0) { + reg = CSR_READ_4(sc, ALC_EEPROM_LD); + if ((reg & (EEPROM_LD_EEPROM_EXIST | + EEPROM_LD_FLASH_EXIST)) != 0) { + for (i = 100; i > 0; i--) { + reg = CSR_READ_4(sc, ALC_EEPROM_LD); + if ((reg & (EEPROM_LD_PROGRESS | + EEPROM_LD_START)) == 0) + break; + DELAY(1000); + } + if (i != 0) { + CSR_WRITE_4(sc, ALC_EEPROM_LD, reg | + EEPROM_LD_START); + for (i = 100; i > 0; i--) { + DELAY(1000); + reg = CSR_READ_4(sc, ALC_EEPROM_LD); + if ((reg & EEPROM_LD_START) == 0) + break; + } + } else if (bootverbose) + device_printf(sc->alc_dev, + "reloading EEPROM/FLASH timed out!\n"); + } + } + + alc_get_macaddr_par(sc); +} + +static void +alc_get_macaddr_par(struct alc_softc *sc) +{ + uint32_t ea[2]; + ea[0] = CSR_READ_4(sc, ALC_PAR0); ea[1] = CSR_READ_4(sc, ALC_PAR1); sc->alc_eaddr[0] = (ea[1] >> 8) & 0xFF; @@ -517,19 +863,31 @@ alc_disable_l0s_l1(struct alc_softc *sc) { uint32_t pmcfg; - /* Another magic from vendor. */ - pmcfg = CSR_READ_4(sc, ALC_PM_CFG); - pmcfg &= ~(PM_CFG_L1_ENTRY_TIMER_MASK | PM_CFG_CLK_SWH_L1 | - PM_CFG_ASPM_L0S_ENB | PM_CFG_ASPM_L1_ENB | PM_CFG_MAC_ASPM_CHK | - PM_CFG_SERDES_PD_EX_L1); - pmcfg |= PM_CFG_SERDES_BUDS_RX_L1_ENB | PM_CFG_SERDES_PLL_L1_ENB | - PM_CFG_SERDES_L1_ENB; - CSR_WRITE_4(sc, ALC_PM_CFG, pmcfg); + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) == 0) { + /* Another magic from vendor. */ + pmcfg = CSR_READ_4(sc, ALC_PM_CFG); + pmcfg &= ~(PM_CFG_L1_ENTRY_TIMER_MASK | PM_CFG_CLK_SWH_L1 | + PM_CFG_ASPM_L0S_ENB | PM_CFG_ASPM_L1_ENB | + PM_CFG_MAC_ASPM_CHK | PM_CFG_SERDES_PD_EX_L1); + pmcfg |= PM_CFG_SERDES_BUDS_RX_L1_ENB | + PM_CFG_SERDES_PLL_L1_ENB | PM_CFG_SERDES_L1_ENB; + CSR_WRITE_4(sc, ALC_PM_CFG, pmcfg); + } } static void alc_phy_reset(struct alc_softc *sc) { + + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + alc_phy_reset_816x(sc); + else + alc_phy_reset_813x(sc); +} + +static void +alc_phy_reset_813x(struct alc_softc *sc) +{ uint16_t data; /* Reset magic from Linux. */ @@ -642,12 +1000,101 @@ alc_phy_reset(struct alc_softc *sc) } static void +alc_phy_reset_816x(struct alc_softc *sc) +{ + uint32_t val; + + val = CSR_READ_4(sc, ALC_GPHY_CFG); + val &= ~(GPHY_CFG_EXT_RESET | GPHY_CFG_LED_MODE | + GPHY_CFG_GATE_25M_ENB | GPHY_CFG_PHY_IDDQ | GPHY_CFG_PHY_PLL_ON | + GPHY_CFG_PWDOWN_HW | GPHY_CFG_100AB_ENB); + val |= GPHY_CFG_SEL_ANA_RESET; +#ifdef notyet + val |= GPHY_CFG_HIB_PULSE | GPHY_CFG_HIB_EN | GPHY_CFG_SEL_ANA_RESET; +#else + /* Disable PHY hibernation. */ + val &= ~(GPHY_CFG_HIB_PULSE | GPHY_CFG_HIB_EN); +#endif + CSR_WRITE_4(sc, ALC_GPHY_CFG, val); + DELAY(10); + CSR_WRITE_4(sc, ALC_GPHY_CFG, val | GPHY_CFG_EXT_RESET); + DELAY(800); + + /* Vendor PHY magic. */ +#ifdef notyet + alc_miidbg_writereg(sc, MII_DBG_LEGCYPS, DBG_LEGCYPS_DEFAULT); + alc_miidbg_writereg(sc, MII_DBG_SYSMODCTL, DBG_SYSMODCTL_DEFAULT); + alc_miiext_writereg(sc, MII_EXT_PCS, MII_EXT_VDRVBIAS, + EXT_VDRVBIAS_DEFAULT); +#else + /* Disable PHY hibernation. */ + alc_miidbg_writereg(sc, MII_DBG_LEGCYPS, + DBG_LEGCYPS_DEFAULT & ~DBG_LEGCYPS_ENB); + alc_miidbg_writereg(sc, MII_DBG_HIBNEG, + DBG_HIBNEG_DEFAULT & ~(DBG_HIBNEG_PSHIB_EN | DBG_HIBNEG_HIB_PULSE)); + alc_miidbg_writereg(sc, MII_DBG_GREENCFG, DBG_GREENCFG_DEFAULT); +#endif + + /* XXX Disable EEE. */ + val = CSR_READ_4(sc, ALC_LPI_CTL); + val &= ~LPI_CTL_ENB; + CSR_WRITE_4(sc, ALC_LPI_CTL, val); + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_LOCAL_EEEADV, 0); + + /* PHY power saving. */ + alc_miidbg_writereg(sc, MII_DBG_TST10BTCFG, DBG_TST10BTCFG_DEFAULT); + alc_miidbg_writereg(sc, MII_DBG_SRDSYSMOD, DBG_SRDSYSMOD_DEFAULT); + alc_miidbg_writereg(sc, MII_DBG_TST100BTCFG, DBG_TST100BTCFG_DEFAULT); + alc_miidbg_writereg(sc, MII_DBG_ANACTL, DBG_ANACTL_DEFAULT); + val = alc_miidbg_readreg(sc, MII_DBG_GREENCFG2); + val &= ~DBG_GREENCFG2_GATE_DFSE_EN; + alc_miidbg_writereg(sc, MII_DBG_GREENCFG2, val); + + /* RTL8139C, 120m issue. */ + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_NLP78, + ANEG_NLP78_120M_DEFAULT); + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_S3DIG10, + ANEG_S3DIG10_DEFAULT); + + if ((sc->alc_flags & ALC_FLAG_LINK_WAR) != 0) { + /* Turn off half amplitude. */ + val = alc_miiext_readreg(sc, MII_EXT_PCS, MII_EXT_CLDCTL3); + val |= EXT_CLDCTL3_BP_CABLE1TH_DET_GT; + alc_miiext_writereg(sc, MII_EXT_PCS, MII_EXT_CLDCTL3, val); + /* Turn off Green feature. */ + val = alc_miidbg_readreg(sc, MII_DBG_GREENCFG2); + val |= DBG_GREENCFG2_BP_GREEN; + alc_miidbg_writereg(sc, MII_DBG_GREENCFG2, val); + /* Turn off half bias. */ + val = alc_miiext_readreg(sc, MII_EXT_PCS, MII_EXT_CLDCTL5); + val |= EXT_CLDCTL5_BP_VD_HLFBIAS; + alc_miiext_writereg(sc, MII_EXT_PCS, MII_EXT_CLDCTL5, val); + } +} + +static void alc_phy_down(struct alc_softc *sc) { + uint32_t gphy; switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8161: + case DEVICEID_ATHEROS_E2200: + case DEVICEID_ATHEROS_AR8162: + case DEVICEID_ATHEROS_AR8171: + case DEVICEID_ATHEROS_AR8172: + gphy = CSR_READ_4(sc, ALC_GPHY_CFG); + gphy &= ~(GPHY_CFG_EXT_RESET | GPHY_CFG_LED_MODE | + GPHY_CFG_100AB_ENB | GPHY_CFG_PHY_PLL_ON); + gphy |= GPHY_CFG_HIB_EN | GPHY_CFG_HIB_PULSE | + GPHY_CFG_SEL_ANA_RESET; + gphy |= GPHY_CFG_PHY_IDDQ | GPHY_CFG_PWDOWN_HW; + CSR_WRITE_4(sc, ALC_GPHY_CFG, gphy); + break; case DEVICEID_ATHEROS_AR8151: case DEVICEID_ATHEROS_AR8151_V2: + case DEVICEID_ATHEROS_AR8152_B: + case DEVICEID_ATHEROS_AR8152_B2: /* * GPHY power down caused more problems on AR8151 v2.0. * When driver is reloaded after GPHY power down, @@ -673,12 +1120,23 @@ alc_phy_down(struct alc_softc *sc) } static void -alc_aspm(struct alc_softc *sc, int media) +alc_aspm(struct alc_softc *sc, int init, int media) +{ + + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + alc_aspm_816x(sc, init); + else + alc_aspm_813x(sc, media); +} + +static void +alc_aspm_813x(struct alc_softc *sc, int media) { uint32_t pmcfg; uint16_t linkcfg; - ALC_LOCK_ASSERT(sc); + if ((sc->alc_flags & ALC_FLAG_LINK) == 0) + return; pmcfg = CSR_READ_4(sc, ALC_PM_CFG); if ((sc->alc_flags & (ALC_FLAG_APS | ALC_FLAG_PCIE)) == @@ -759,71 +1217,61 @@ alc_aspm(struct alc_softc *sc, int media CSR_WRITE_4(sc, ALC_PM_CFG, pmcfg); } -static int -alc_attach(device_t dev) +static void +alc_aspm_816x(struct alc_softc *sc, int init) { - struct alc_softc *sc; - struct ifnet *ifp; - char *aspm_state[] = { "L0s/L1", "L0s", "L1", "L0s/L1" }; - uint16_t burst; - int base, error, i, msic, msixc, state; - uint32_t cap, ctl, val; - - error = 0; - sc = device_get_softc(dev); - sc->alc_dev = dev; - - mtx_init(&sc->alc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, - MTX_DEF); - callout_init_mtx(&sc->alc_tick_ch, &sc->alc_mtx, 0); - TASK_INIT(&sc->alc_int_task, 0, alc_int_task, sc); - sc->alc_ident = alc_find_ident(dev); + uint32_t pmcfg; - /* Map the device. */ - pci_enable_busmaster(dev); - sc->alc_res_spec = alc_res_spec_mem; - sc->alc_irq_spec = alc_irq_spec_legacy; - error = bus_alloc_resources(dev, sc->alc_res_spec, sc->alc_res); - if (error != 0) { - device_printf(dev, "cannot allocate memory resources.\n"); - goto fail; + pmcfg = CSR_READ_4(sc, ALC_PM_CFG); + pmcfg &= ~PM_CFG_L1_ENTRY_TIMER_816X_MASK; + pmcfg |= PM_CFG_L1_ENTRY_TIMER_816X_DEFAULT; + pmcfg &= ~PM_CFG_PM_REQ_TIMER_MASK; + pmcfg |= PM_CFG_PM_REQ_TIMER_816X_DEFAULT; + pmcfg &= ~PM_CFG_LCKDET_TIMER_MASK; + pmcfg |= PM_CFG_LCKDET_TIMER_DEFAULT; + pmcfg |= PM_CFG_SERDES_PD_EX_L1 | PM_CFG_CLK_SWH_L1 | PM_CFG_PCIE_RECV; + pmcfg &= ~(PM_CFG_RX_L1_AFTER_L0S | PM_CFG_TX_L1_AFTER_L0S | + PM_CFG_ASPM_L1_ENB | PM_CFG_ASPM_L0S_ENB | + PM_CFG_SERDES_L1_ENB | PM_CFG_SERDES_PLL_L1_ENB | + PM_CFG_SERDES_BUDS_RX_L1_ENB | PM_CFG_SA_DLY_ENB | + PM_CFG_MAC_ASPM_CHK | PM_CFG_HOTRST); + if (AR816X_REV(sc->alc_rev) <= AR816X_REV_A1 && + (sc->alc_rev & 0x01) != 0) + pmcfg |= PM_CFG_SERDES_L1_ENB | PM_CFG_SERDES_PLL_L1_ENB; + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) { + /* Link up, enable both L0s, L1s. */ + pmcfg |= PM_CFG_ASPM_L0S_ENB | PM_CFG_ASPM_L1_ENB | + PM_CFG_MAC_ASPM_CHK; + } else { + if (init != 0) + pmcfg |= PM_CFG_ASPM_L0S_ENB | PM_CFG_ASPM_L1_ENB | + PM_CFG_MAC_ASPM_CHK; + else if ((sc->alc_ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + pmcfg |= PM_CFG_ASPM_L1_ENB | PM_CFG_MAC_ASPM_CHK; } + CSR_WRITE_4(sc, ALC_PM_CFG, pmcfg); +} - /* Set PHY address. */ - sc->alc_phyaddr = ALC_PHY_ADDR; +static void +alc_init_pcie(struct alc_softc *sc) +{ + const char *aspm_state[] = { "L0s/L1", "L0s", "L1", "L0s/L1" }; + uint32_t cap, ctl, val; + int state; - /* Initialize DMA parameters. */ - sc->alc_dma_rd_burst = 0; - sc->alc_dma_wr_burst = 0; - sc->alc_rcb = DMA_CFG_RCB_64; - if (pci_find_cap(dev, PCIY_EXPRESS, &base) == 0) { - sc->alc_flags |= ALC_FLAG_PCIE; - sc->alc_expcap = base; - burst = CSR_READ_2(sc, base + PCIER_DEVICE_CTL); - sc->alc_dma_rd_burst = - (burst & PCIEM_CTL_MAX_READ_REQUEST) >> 12; - sc->alc_dma_wr_burst = (burst & PCIEM_CTL_MAX_PAYLOAD) >> 5; - if (bootverbose) { - device_printf(dev, "Read request size : %u bytes.\n", - alc_dma_burst[sc->alc_dma_rd_burst]); - device_printf(dev, "TLP payload size : %u bytes.\n", - alc_dma_burst[sc->alc_dma_wr_burst]); - } - if (alc_dma_burst[sc->alc_dma_rd_burst] > 1024) - sc->alc_dma_rd_burst = 3; - if (alc_dma_burst[sc->alc_dma_wr_burst] > 1024) - sc->alc_dma_wr_burst = 3; - /* Clear data link and flow-control protocol error. */ - val = CSR_READ_4(sc, ALC_PEX_UNC_ERR_SEV); - val &= ~(PEX_UNC_ERR_SEV_DLP | PEX_UNC_ERR_SEV_FCP); - CSR_WRITE_4(sc, ALC_PEX_UNC_ERR_SEV, val); + /* Clear data link and flow-control protocol error. */ + val = CSR_READ_4(sc, ALC_PEX_UNC_ERR_SEV); + val &= ~(PEX_UNC_ERR_SEV_DLP | PEX_UNC_ERR_SEV_FCP); + CSR_WRITE_4(sc, ALC_PEX_UNC_ERR_SEV, val); + + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) == 0) { CSR_WRITE_4(sc, ALC_LTSSM_ID_CFG, CSR_READ_4(sc, ALC_LTSSM_ID_CFG) & ~LTSSM_ID_WRO_ENB); CSR_WRITE_4(sc, ALC_PCIE_PHYMISC, CSR_READ_4(sc, ALC_PCIE_PHYMISC) | PCIE_PHYMISC_FORCE_RCV_DET); if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B && - pci_get_revid(dev) == ATHEROS_AR8152_B_V10) { + sc->alc_rev == ATHEROS_AR8152_B_V10) { val = CSR_READ_4(sc, ALC_PCIE_PHYMISC2); val &= ~(PCIE_PHYMISC2_SERDES_CDR_MASK | PCIE_PHYMISC2_SERDES_TH_MASK); @@ -832,13 +1280,13 @@ alc_attach(device_t dev) CSR_WRITE_4(sc, ALC_PCIE_PHYMISC2, val); } /* Disable ASPM L0S and L1. */ - cap = CSR_READ_2(sc, base + PCIER_LINK_CAP); + cap = CSR_READ_2(sc, sc->alc_expcap + PCIER_LINK_CAP); if ((cap & PCIEM_LINK_CAP_ASPM) != 0) { - ctl = CSR_READ_2(sc, base + PCIER_LINK_CTL); + ctl = CSR_READ_2(sc, sc->alc_expcap + PCIER_LINK_CTL); if ((ctl & PCIEM_LINK_CTL_RCB) != 0) sc->alc_rcb = DMA_CFG_RCB_128; if (bootverbose) - device_printf(dev, "RCB %u bytes\n", + device_printf(sc->alc_dev, "RCB %u bytes\n", sc->alc_rcb == DMA_CFG_RCB_64 ? 64 : 128); state = ctl & PCIEM_LINK_CTL_ASPMC; if (state & PCIEM_LINK_CTL_ASPMC_L0S) @@ -855,13 +1303,91 @@ alc_attach(device_t dev) device_printf(sc->alc_dev, "no ASPM support\n"); } + } else { + val = CSR_READ_4(sc, ALC_PDLL_TRNS1); + val &= ~PDLL_TRNS1_D3PLLOFF_ENB; + CSR_WRITE_4(sc, ALC_PDLL_TRNS1, val); + val = CSR_READ_4(sc, ALC_MASTER_CFG); + if (AR816X_REV(sc->alc_rev) <= AR816X_REV_A1 && + (sc->alc_rev & 0x01) != 0) { + if ((val & MASTER_WAKEN_25M) == 0 || + (val & MASTER_CLK_SEL_DIS) == 0) { + val |= MASTER_WAKEN_25M | MASTER_CLK_SEL_DIS; + CSR_WRITE_4(sc, ALC_MASTER_CFG, val); + } + } else { + if ((val & MASTER_WAKEN_25M) == 0 || + (val & MASTER_CLK_SEL_DIS) != 0) { + val |= MASTER_WAKEN_25M; + val &= ~MASTER_CLK_SEL_DIS; + CSR_WRITE_4(sc, ALC_MASTER_CFG, val); + } + } } + alc_aspm(sc, 1, IFM_UNKNOWN); +} - /* Reset PHY. */ - alc_phy_reset(sc); +static void +alc_config_msi(struct alc_softc *sc) +{ + uint32_t ctl, mod; - /* Reset the ethernet controller. */ - alc_reset(sc); + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) { + /* + * It seems interrupt moderation is controlled by + * ALC_MSI_RETRANS_TIMER register if MSI/MSIX is active. + * Driver uses RX interrupt moderation parameter to + * program ALC_MSI_RETRANS_TIMER register. + */ + ctl = CSR_READ_4(sc, ALC_MSI_RETRANS_TIMER); + ctl &= ~MSI_RETRANS_TIMER_MASK; + ctl &= ~MSI_RETRANS_MASK_SEL_LINE; + mod = ALC_USECS(sc->alc_int_rx_mod); + if (mod == 0) + mod = 1; + ctl |= mod; + if ((sc->alc_flags & ALC_FLAG_MSIX) != 0) + CSR_WRITE_4(sc, ALC_MSI_RETRANS_TIMER, ctl | + MSI_RETRANS_MASK_SEL_STD); + else if ((sc->alc_flags & ALC_FLAG_MSI) != 0) + CSR_WRITE_4(sc, ALC_MSI_RETRANS_TIMER, ctl | + MSI_RETRANS_MASK_SEL_LINE); + else + CSR_WRITE_4(sc, ALC_MSI_RETRANS_TIMER, 0); + } +} + +static int +alc_attach(device_t dev) +{ + struct alc_softc *sc; + struct ifnet *ifp; + int base, error, i, msic, msixc; + uint16_t burst; + + error = 0; + sc = device_get_softc(dev); + sc->alc_dev = dev; + sc->alc_rev = pci_get_revid(dev); + + mtx_init(&sc->alc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, + MTX_DEF); + callout_init_mtx(&sc->alc_tick_ch, &sc->alc_mtx, 0); + TASK_INIT(&sc->alc_int_task, 0, alc_int_task, sc); + sc->alc_ident = alc_find_ident(dev); + + /* Map the device. */ + pci_enable_busmaster(dev); + sc->alc_res_spec = alc_res_spec_mem; + sc->alc_irq_spec = alc_irq_spec_legacy; + error = bus_alloc_resources(dev, sc->alc_res_spec, sc->alc_res); + if (error != 0) { + device_printf(dev, "cannot allocate memory resources.\n"); + goto fail; + } + + /* Set PHY address. */ + sc->alc_phyaddr = ALC_PHY_ADDR; /* * One odd thing is AR8132 uses the same PHY hardware(F1 @@ -871,6 +1397,19 @@ alc_attach(device_t dev) * shows the same PHY model/revision number of AR8131. */ switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8161: + if (pci_get_subvendor(dev) == VENDORID_ATHEROS && + pci_get_subdevice(dev) == 0x0091 && sc->alc_rev == 0) + sc->alc_flags |= ALC_FLAG_LINK_WAR; + /* FALLTHROUGH */ + case DEVICEID_ATHEROS_E2200: + case DEVICEID_ATHEROS_AR8171: + sc->alc_flags |= ALC_FLAG_AR816X_FAMILY; + break; + case DEVICEID_ATHEROS_AR8162: + case DEVICEID_ATHEROS_AR8172: + sc->alc_flags |= ALC_FLAG_FASTETHER | ALC_FLAG_AR816X_FAMILY; + break; case DEVICEID_ATHEROS_AR8152_B: case DEVICEID_ATHEROS_AR8152_B2: sc->alc_flags |= ALC_FLAG_APS; @@ -885,7 +1424,7 @@ alc_attach(device_t dev) default: break; } - sc->alc_flags |= ALC_FLAG_ASPM_MON | ALC_FLAG_JUMBO; + sc->alc_flags |= ALC_FLAG_JUMBO; /* * It seems that AR813x/AR815x has silicon bug for SMB. In @@ -898,7 +1437,6 @@ alc_attach(device_t dev) * Don't use Tx CMB. It is known to have silicon bug. */ sc->alc_flags |= ALC_FLAG_CMB_BUG; - sc->alc_rev = pci_get_revid(dev); sc->alc_chip_rev = CSR_READ_4(sc, ALC_MASTER_CFG) >> MASTER_CHIP_REV_SHIFT; if (bootverbose) { @@ -906,11 +1444,45 @@ alc_attach(device_t dev) sc->alc_rev); device_printf(dev, "Chip id/revision : 0x%04x\n", sc->alc_chip_rev); + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + device_printf(dev, "AR816x revision : 0x%x\n", + AR816X_REV(sc->alc_rev)); } device_printf(dev, "%u Tx FIFO, %u Rx FIFO\n", CSR_READ_4(sc, ALC_SRAM_TX_FIFO_LEN) * 8, CSR_READ_4(sc, ALC_SRAM_RX_FIFO_LEN) * 8); + /* Initialize DMA parameters. */ + sc->alc_dma_rd_burst = 0; + sc->alc_dma_wr_burst = 0; + sc->alc_rcb = DMA_CFG_RCB_64; + if (pci_find_cap(dev, PCIY_EXPRESS, &base) == 0) { + sc->alc_flags |= ALC_FLAG_PCIE; + sc->alc_expcap = base; + burst = CSR_READ_2(sc, base + PCIER_DEVICE_CTL); + sc->alc_dma_rd_burst = + (burst & PCIEM_CTL_MAX_READ_REQUEST) >> 12; + sc->alc_dma_wr_burst = (burst & PCIEM_CTL_MAX_PAYLOAD) >> 5; + if (bootverbose) { + device_printf(dev, "Read request size : %u bytes.\n", + alc_dma_burst[sc->alc_dma_rd_burst]); + device_printf(dev, "TLP payload size : %u bytes.\n", + alc_dma_burst[sc->alc_dma_wr_burst]); + } + if (alc_dma_burst[sc->alc_dma_rd_burst] > 1024) + sc->alc_dma_rd_burst = 3; + if (alc_dma_burst[sc->alc_dma_wr_burst] > 1024) + sc->alc_dma_wr_burst = 3; + alc_init_pcie(sc); + } + + /* Reset PHY. */ + alc_phy_reset(sc); + + /* Reset the ethernet controller. */ + alc_stop_mac(sc); + alc_reset(sc); + /* Allocate IRQ resources. */ msixc = pci_msix_count(dev); msic = pci_msi_count(dev); @@ -918,11 +1490,20 @@ alc_attach(device_t dev) device_printf(dev, "MSIX count : %d\n", msixc); device_printf(dev, "MSI count : %d\n", msic); } - /* Prefer MSIX over MSI. */ + if (msixc > 1) + msixc = 1; + if (msic > 1) + msic = 1; + /* + * Prefer MSIX over MSI. + * AR816x controller has a silicon bug that MSI interrupt + * does not assert if PCIM_CMD_INTxDIS bit of command + * register is set. pci(4) was taught to handle that case. + */ if (msix_disable == 0 || msi_disable == 0) { - if (msix_disable == 0 && msixc == ALC_MSIX_MESSAGES && + if (msix_disable == 0 && msixc > 0 && pci_alloc_msix(dev, &msixc) == 0) { - if (msic == ALC_MSIX_MESSAGES) { + if (msic == 1) { device_printf(dev, "Using %d MSIX message(s).\n", msixc); sc->alc_flags |= ALC_FLAG_MSIX; @@ -931,9 +1512,8 @@ alc_attach(device_t dev) pci_release_msi(dev); } if (msi_disable == 0 && (sc->alc_flags & ALC_FLAG_MSIX) == 0 && - msic == ALC_MSI_MESSAGES && - pci_alloc_msi(dev, &msic) == 0) { - if (msic == ALC_MSI_MESSAGES) { + msic > 0 && pci_alloc_msi(dev, &msic) == 0) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 05:49:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3BCBF442; Wed, 8 Oct 2014 05:49:11 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0DE919C3; Wed, 8 Oct 2014 05:49:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s985nAYA063659; Wed, 8 Oct 2014 05:49:10 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s985nArh063658; Wed, 8 Oct 2014 05:49:10 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201410080549.s985nArh063658@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Wed, 8 Oct 2014 05:49:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272731 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 05:49:11 -0000 Author: yongari Date: Wed Oct 8 05:49:10 2014 New Revision: 272731 URL: https://svnweb.freebsd.org/changeset/base/272731 Log: Document newly added controller AR816x/AR817x. Modified: head/share/man/man4/alc.4 Modified: head/share/man/man4/alc.4 ============================================================================== --- head/share/man/man4/alc.4 Wed Oct 8 05:47:01 2014 (r272730) +++ head/share/man/man4/alc.4 Wed Oct 8 05:49:10 2014 (r272731) @@ -24,12 +24,12 @@ .\" .\" $FreeBSD$ .\" -.Dd August 9, 2010 +.Dd October 8, 2014 .Dt ALC 4 .Os .Sh NAME .Nm alc -.Nd Atheros AR813x/AR815x Gigabit/Fast Ethernet driver +.Nd Atheros AR813x/AR815x/AR816x/AR817x Gigabit/Fast Ethernet driver .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -48,8 +48,8 @@ if_alc_load="YES" .Sh DESCRIPTION The .Nm -device driver provides support for Atheros AR813x and AR815x PCI -Express Gigabit/Fast Ethernet controllers. +device driver provides support for Atheros AR813x, AR815x, AR816x +and AR817x PCI Express Gigabit/Fast Ethernet controllers. .Pp All LOMs supported by the .Nm @@ -58,9 +58,9 @@ segmentation offload (TSO), hardware VLA features, Wake On Lan (WOL) and an interrupt moderation mechanism as well as a 64-bit multicast hash filter. .Pp -The AR813x and AR815x supports Jumbo Frames (up to 9216 and 6144 -bytes, respectively), which can be configured via the interface -MTU setting. +The AR813x, AR815x, AR816x and AR817x supports Jumbo Frames (up to +9216, 6144, 9216 and 9216 bytes, respectively), which can be +configured via the interface MTU setting. Selecting an MTU larger than 1500 bytes with the .Xr ifconfig 8 utility configures the adapter to receive and transmit Jumbo Frames. @@ -112,6 +112,16 @@ Atheros AR8151 v2.0 PCI Express Gigabit Atheros AR8152 v1.1 PCI Express Fast Ethernet controller .It Atheros AR8152 v2.0 PCI Express Fast Ethernet controller +.It +Atheros AR8161 PCI Express Gigabit Ethernet controller +.It +Atheros AR8162 PCI Express Fast Ethernet controller +.It +Atheros AR8171 PCI Express Gigabit Ethernet controller +.It +Atheros AR8172 PCI Express Fast Ethernet controller +.It +Killer E2200 Gigabit Ethernet controller .El .Sh LOADER TUNABLES Tunables can be set at the From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 05:53:04 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DE2AF69D; Wed, 8 Oct 2014 05:53:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA3BEA75; Wed, 8 Oct 2014 05:53:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s985r40v067654; Wed, 8 Oct 2014 05:53:04 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s985r4Il067653; Wed, 8 Oct 2014 05:53:04 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201410080553.s985r4Il067653@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Wed, 8 Oct 2014 05:53:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272732 - head/sys/dev/pci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 05:53:05 -0000 Author: yongari Date: Wed Oct 8 05:53:04 2014 New Revision: 272732 URL: https://svnweb.freebsd.org/changeset/base/272732 Log: Oops, fix typo made in r272729. Modified: head/sys/dev/pci/pci.c Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Wed Oct 8 05:49:10 2014 (r272731) +++ head/sys/dev/pci/pci.c Wed Oct 8 05:53:04 2014 (r272732) @@ -207,7 +207,7 @@ struct pci_quirk { #define PCI_QUIRK_ENABLE_MSI_VM 3 /* Older chipset in VM where MSI works */ #define PCI_QUIRK_UNMAP_REG 4 /* Ignore PCI map register */ #define PCI_QUIRK_DISABLE_MSIX 5 /* MSI-X doesn't work */ -#define PCI_QUIRK_MSI_INTX_BUG 5 /* PCIM_CMD_INTxDIS disables MSI */ +#define PCI_QUIRK_MSI_INTX_BUG 6 /* PCIM_CMD_INTxDIS disables MSI */ int arg1; int arg2; }; From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 07:00:52 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 305B0A3F; Wed, 8 Oct 2014 07:00:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1BA6310F; Wed, 8 Oct 2014 07:00:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9870p2C000889; Wed, 8 Oct 2014 07:00:51 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9870pah000885; Wed, 8 Oct 2014 07:00:51 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201410080700.s9870pah000885@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 8 Oct 2014 07:00:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272733 - in head/sys/dev/usb: . controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 07:00:52 -0000 Author: hselasky Date: Wed Oct 8 07:00:50 2014 New Revision: 272733 URL: https://svnweb.freebsd.org/changeset/base/272733 Log: Add support for disabling USB enumeration in general or on selected USB HUBs. MFC after: 2 weeks Modified: head/sys/dev/usb/controller/usb_controller.c head/sys/dev/usb/usb_freebsd.h head/sys/dev/usb/usb_freebsd_loader.h head/sys/dev/usb/usb_hub.c Modified: head/sys/dev/usb/controller/usb_controller.c ============================================================================== --- head/sys/dev/usb/controller/usb_controller.c Wed Oct 8 05:53:04 2014 (r272732) +++ head/sys/dev/usb/controller/usb_controller.c Wed Oct 8 07:00:50 2014 (r272733) @@ -102,6 +102,14 @@ static int usb_no_shutdown_wait = 0; SYSCTL_INT(_hw_usb, OID_AUTO, no_shutdown_wait, CTLFLAG_RWTUN, &usb_no_shutdown_wait, 0, "No USB device waiting at system shutdown."); +#if USB_HAVE_DISABLE_ENUM +static int usb_disable_enumeration = 0; +SYSCTL_INT(_hw_usb, OID_AUTO, disable_enumeration, CTLFLAG_RWTUN, + &usb_disable_enumeration, 0, "Set to disable all USB device enumeration."); +#else +#define usb_disable_enumeration 0 +#endif + static devclass_t usb_devclass; static device_method_t usb_methods[] = { @@ -371,7 +379,8 @@ usb_bus_explore(struct usb_proc_msg *pm) USB_BUS_LOCK(bus); } - if (udev != NULL && udev->hub != NULL) { + if (usb_disable_enumeration == 0 && + udev != NULL && udev->hub != NULL) { if (bus->do_probe) { bus->do_probe = 0; Modified: head/sys/dev/usb/usb_freebsd.h ============================================================================== --- head/sys/dev/usb/usb_freebsd.h Wed Oct 8 05:53:04 2014 (r272732) +++ head/sys/dev/usb/usb_freebsd.h Wed Oct 8 07:00:50 2014 (r272733) @@ -50,6 +50,7 @@ #define USB_HAVE_FIXED_IFACE 0 #define USB_HAVE_FIXED_CONFIG 0 #define USB_HAVE_FIXED_PORT 0 +#define USB_HAVE_DISABLE_ENUM 1 /* define zero ticks callout value */ #define USB_CALLOUT_ZERO_TICKS 1 Modified: head/sys/dev/usb/usb_freebsd_loader.h ============================================================================== --- head/sys/dev/usb/usb_freebsd_loader.h Wed Oct 8 05:53:04 2014 (r272732) +++ head/sys/dev/usb/usb_freebsd_loader.h Wed Oct 8 07:00:50 2014 (r272733) @@ -50,6 +50,7 @@ #define USB_HAVE_FIXED_IFACE 0 #define USB_HAVE_FIXED_CONFIG 0 #define USB_HAVE_FIXED_PORT 0 +#define USB_HAVE_DISABLE_ENUM 0 #define USB_CALLOUT_ZERO_TICKS 1 Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Wed Oct 8 05:53:04 2014 (r272732) +++ head/sys/dev/usb/usb_hub.c Wed Oct 8 07:00:50 2014 (r272733) @@ -111,6 +111,9 @@ struct uhub_softc { struct mtx sc_mtx; /* our mutex */ struct usb_device *sc_udev; /* USB device */ struct usb_xfer *sc_xfer[UHUB_N_TRANSFER]; /* interrupt xfer */ +#if USB_HAVE_DISABLE_ENUM + int sc_disable_enumeration; +#endif uint8_t sc_flags; #define UHUB_FLAG_DID_EXPLORE 0x01 }; @@ -993,6 +996,13 @@ uhub_explore(struct usb_device *udev) DPRINTFN(11, "udev=%p addr=%d\n", udev, udev->address); +#if USB_HAVE_DISABLE_ENUM + /* check if we should skip enumeration from this USB HUB */ + if (sc->sc_disable_enumeration != 0) { + DPRINTF("Enumeration is disabled!\n"); + return (0); + } +#endif /* ignore devices that are too deep */ if (uhub_is_too_deep(udev)) return (USB_ERR_TOO_DEEP); @@ -1188,6 +1198,10 @@ uhub_attach(device_t dev) struct usb_hub *hub; struct usb_hub_descriptor hubdesc20; struct usb_hub_ss_descriptor hubdesc30; +#if USB_HAVE_DISABLE_ENUM + struct sysctl_ctx_list *sysctl_ctx; + struct sysctl_oid *sysctl_tree; +#endif uint16_t pwrdly; uint16_t nports; uint8_t x; @@ -1469,6 +1483,19 @@ uhub_attach(device_t dev) usbd_set_power_mode(udev, USB_POWER_MODE_SAVE); +#if USB_HAVE_DISABLE_ENUM + /* Add device sysctls */ + + sysctl_ctx = device_get_sysctl_ctx(dev); + sysctl_tree = device_get_sysctl_tree(dev); + + if (sysctl_ctx != NULL && sysctl_tree != NULL) { + (void) SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "disable_enumeration", CTLFLAG_RWTUN, + &sc->sc_disable_enumeration, 0, + "Set to disable enumeration on this USB HUB."); + } +#endif return (0); error: From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 07:48:39 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1D17935A; Wed, 8 Oct 2014 07:48:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F1ECB76A; Wed, 8 Oct 2014 07:48:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s987mcDK021885; Wed, 8 Oct 2014 07:48:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s987mbmc021877; Wed, 8 Oct 2014 07:48:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410080748.s987mbmc021877@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 8 Oct 2014 07:48:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272734 - in head/sys/cam: ctl scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 07:48:39 -0000 Author: mav Date: Wed Oct 8 07:48:36 2014 New Revision: 272734 URL: https://svnweb.freebsd.org/changeset/base/272734 Log: Add support for WRITE ATOMIC (16) command and report SBC-4 compliance. Atomic writes are only supported for ZVOLs in "dev" mode. In other cases atomicity can not be guarantied and so the command is blocked. Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_backend.h head/sys/cam/ctl/ctl_backend_block.c head/sys/cam/ctl/ctl_backend_ramdisk.c head/sys/cam/ctl/ctl_cmd_table.c head/sys/cam/ctl/scsi_ctl.c head/sys/cam/scsi/scsi_all.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Wed Oct 8 07:00:50 2014 (r272733) +++ head/sys/cam/ctl/ctl.c Wed Oct 8 07:48:36 2014 (r272734) @@ -9126,6 +9126,31 @@ ctl_read_write(struct ctl_scsiio *ctsio) num_blocks = scsi_4btoul(cdb->length); break; } + case WRITE_ATOMIC_16: { + struct scsi_rw_16 *cdb; + + if (lun->be_lun->atomicblock == 0) { + ctl_set_invalid_opcode(ctsio); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + + cdb = (struct scsi_rw_16 *)ctsio->cdb; + if (cdb->byte2 & SRW12_FUA) + flags |= CTL_LLF_FUA; + if (cdb->byte2 & SRW12_DPO) + flags |= CTL_LLF_DPO; + lba = scsi_8btou64(cdb->addr); + num_blocks = scsi_4btoul(cdb->length); + if (num_blocks > lun->be_lun->atomicblock) { + ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, + /*command*/ 1, /*field*/ 12, /*bit_valid*/ 0, + /*bit*/ 0); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + break; + } case WRITE_VERIFY_16: { struct scsi_write_verify_16 *cdb; @@ -10299,6 +10324,10 @@ ctl_inquiry_evpd_block_limits(struct ctl bl_ptr->unmap_grain_align); } } + scsi_ulto4b(lun->be_lun->atomicblock, + bl_ptr->max_atomic_transfer_length); + scsi_ulto4b(0, bl_ptr->atomic_alignment); + scsi_ulto4b(0, bl_ptr->atomic_transfer_length_granularity); } scsi_u64to8b(UINT64_MAX, bl_ptr->max_write_same_length); @@ -10694,13 +10723,13 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio } if (lun == NULL) { - /* SBC-3 (no version claimed) */ - scsi_ulto2b(0x04C0, inq_ptr->version4); + /* SBC-4 (no version claimed) */ + scsi_ulto2b(0x0600, inq_ptr->version4); } else { switch (lun->be_lun->lun_type) { case T_DIRECT: - /* SBC-3 (no version claimed) */ - scsi_ulto2b(0x04C0, inq_ptr->version4); + /* SBC-4 (no version claimed) */ + scsi_ulto2b(0x0600, inq_ptr->version4); break; case T_PROCESSOR: default: @@ -10818,7 +10847,8 @@ ctl_get_lba_len(union ctl_io *io, uint64 break; } case READ_16: - case WRITE_16: { + case WRITE_16: + case WRITE_ATOMIC_16: { struct scsi_rw_16 *cdb; cdb = (struct scsi_rw_16 *)io->scsiio.cdb; @@ -10832,7 +10862,6 @@ ctl_get_lba_len(union ctl_io *io, uint64 cdb = (struct scsi_write_verify_16 *)io->scsiio.cdb; - *lba = scsi_8btou64(cdb->addr); *len = scsi_4btoul(cdb->length); break; Modified: head/sys/cam/ctl/ctl_backend.h ============================================================================== --- head/sys/cam/ctl/ctl_backend.h Wed Oct 8 07:00:50 2014 (r272733) +++ head/sys/cam/ctl/ctl_backend.h Wed Oct 8 07:48:36 2014 (r272734) @@ -144,6 +144,8 @@ typedef void (*be_lun_config_t)(void *be * * pblockoff is the lowest LBA on the LUN aligned ot physical sector. * + * atomicblock is the number of blocks that can be written atomically. + * * req_lun_id is the requested LUN ID. CTL only pays attention to this * field if the CTL_LUN_FLAG_ID_REQ flag is set. If the requested LUN ID is * not available, the LUN addition will fail. If a particular LUN ID isn't @@ -188,6 +190,7 @@ struct ctl_be_lun { uint32_t blocksize; /* passed to CTL */ uint16_t pblockexp; /* passed to CTL */ uint16_t pblockoff; /* passed to CTL */ + uint32_t atomicblock; /* passed to CTL */ uint32_t req_lun_id; /* passed to CTL */ uint32_t lun_id; /* returned from CTL */ uint8_t serial_num[CTL_SN_LEN]; /* passed to CTL */ Modified: head/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_block.c Wed Oct 8 07:00:50 2014 (r272733) +++ head/sys/cam/ctl/ctl_backend_block.c Wed Oct 8 07:48:36 2014 (r272734) @@ -2003,6 +2003,9 @@ ctl_be_block_create(struct ctl_be_block_ be_lun->ctl_be_lun.flags = CTL_LUN_FLAG_PRIMARY; if (unmap) be_lun->ctl_be_lun.flags |= CTL_LUN_FLAG_UNMAP; + if (be_lun->dispatch == ctl_be_block_dispatch_zvol) + be_lun->ctl_be_lun.atomicblock = CTLBLK_MAX_IO_SIZE / + be_lun->blocksize; be_lun->ctl_be_lun.be_lun = be_lun; be_lun->ctl_be_lun.blocksize = be_lun->blocksize; be_lun->ctl_be_lun.pblockexp = be_lun->pblockexp; Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_ramdisk.c Wed Oct 8 07:00:50 2014 (r272733) +++ head/sys/cam/ctl/ctl_backend_ramdisk.c Wed Oct 8 07:48:36 2014 (r272734) @@ -595,6 +595,7 @@ ctl_backend_ramdisk_create(struct ctl_be be_lun->ctl_be_lun.flags = CTL_LUN_FLAG_PRIMARY; if (unmap) be_lun->ctl_be_lun.flags |= CTL_LUN_FLAG_UNMAP; + be_lun->ctl_be_lun.atomicblock = UINT32_MAX; be_lun->ctl_be_lun.be_lun = be_lun; if (params->flags & CTL_LUN_FLAG_ID_REQ) { Modified: head/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- head/sys/cam/ctl/ctl_cmd_table.c Wed Oct 8 07:00:50 2014 (r272733) +++ head/sys/cam/ctl/ctl_cmd_table.c Wed Oct 8 07:48:36 2014 (r272734) @@ -1117,8 +1117,11 @@ const struct ctl_cmd_entry ctl_cmd_table /* 9B */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, -/* 9C */ -{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, +/* 9C WRITE ATOMIC (16) */ +{ctl_read_write, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_SLUN| CTL_FLAG_DATA_OUT, + CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE, + 16, {0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0, 0, 0xff, 0xff, 0, 0x07}}, /* 9D */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, Modified: head/sys/cam/ctl/scsi_ctl.c ============================================================================== --- head/sys/cam/ctl/scsi_ctl.c Wed Oct 8 07:00:50 2014 (r272733) +++ head/sys/cam/ctl/scsi_ctl.c Wed Oct 8 07:48:36 2014 (r272734) @@ -1115,6 +1115,7 @@ ctlfe_adjust_cdb(struct ccb_accept_tio * } case READ_16: case WRITE_16: + case WRITE_ATOMIC_16: { struct scsi_rw_16 *cdb = (struct scsi_rw_16 *)cmdbyt; lba = scsi_8btou64(cdb->addr); Modified: head/sys/cam/scsi/scsi_all.h ============================================================================== --- head/sys/cam/scsi/scsi_all.h Wed Oct 8 07:00:50 2014 (r272733) +++ head/sys/cam/scsi/scsi_all.h Wed Oct 8 07:48:36 2014 (r272734) @@ -1720,6 +1720,7 @@ struct ata_pass_16 { #define VERIFY_16 0x8F #define SYNCHRONIZE_CACHE_16 0x91 #define WRITE_SAME_16 0x93 +#define WRITE_ATOMIC_16 0x9C #define SERVICE_ACTION_IN 0x9E #define REPORT_LUNS 0xA0 #define ATA_PASS_12 0xA1 @@ -2437,8 +2438,7 @@ struct scsi_vpd_logical_block_prov }; /* - * Block Limits VDP Page based on - * T10/1799-D Revision 31 + * Block Limits VDP Page based on SBC-4 Revision 2 */ struct scsi_vpd_block_limits { @@ -2459,7 +2459,10 @@ struct scsi_vpd_block_limits u_int8_t opt_unmap_grain[4]; u_int8_t unmap_grain_align[4]; u_int8_t max_write_same_length[8]; - u_int8_t reserved2[20]; + u_int8_t max_atomic_transfer_length[4]; + u_int8_t atomic_alignment[4]; + u_int8_t atomic_transfer_length_granularity[4]; + u_int8_t reserved2[8]; }; struct scsi_read_capacity From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 08:48:20 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E5CB03E5; Wed, 8 Oct 2014 08:48:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D0CFED1E; Wed, 8 Oct 2014 08:48:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s988mJMJ053622; Wed, 8 Oct 2014 08:48:19 GMT (envelope-from kadesai@FreeBSD.org) Received: (from kadesai@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s988mIsQ053610; Wed, 8 Oct 2014 08:48:18 GMT (envelope-from kadesai@FreeBSD.org) Message-Id: <201410080848.s988mIsQ053610@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kadesai set sender to kadesai@FreeBSD.org using -f From: Kashyap D Desai Date: Wed, 8 Oct 2014 08:48:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272735 - head/sys/dev/mrsas X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 08:48:20 -0000 Author: kadesai Date: Wed Oct 8 08:48:18 2014 New Revision: 272735 URL: https://svnweb.freebsd.org/changeset/base/272735 Log: Current MegaRAID firmware and hence the driver only supported 64VDs. E.g: If the user wants to create more than 64VD on a controller, it is not possible on current firmware/driver. New feature and requirement to support upto 256VD, firmware/driver/apps need changes. In addition to that, there must be a backward compatibility of the new driver with the older firmware and vice versa. RAID map is the interface between Driver and FW to fetch all required fields(attributes) for each Virtual Drives. In the earlier design driver was using the FW copy of RAID map where as in the new design the Driver will keep the RAID map copy of its own; on which it will operate for any raid map access in fast path. Local driver raid map copy will provide ease of access through out the code and provide generic interface for future FW raid map changes. For the backward compatibility driver will notify FW that it supports 256VD to the FW in driver capability field. Based on the controller properly returned by the FW, the Driver will know whether it supports 256VD or not and will copy the RAID map accordingly. At any given time, driver will always have old or new Raid map. Reviewed by : ambrisko MFC after : 2 weeks Sponsored by: AVAGO Technologies Modified: head/sys/dev/mrsas/mrsas.c head/sys/dev/mrsas/mrsas.h head/sys/dev/mrsas/mrsas_cam.c head/sys/dev/mrsas/mrsas_fp.c Modified: head/sys/dev/mrsas/mrsas.c ============================================================================== --- head/sys/dev/mrsas/mrsas.c Wed Oct 8 07:48:36 2014 (r272734) +++ head/sys/dev/mrsas/mrsas.c Wed Oct 8 08:48:18 2014 (r272735) @@ -139,8 +139,8 @@ extern void mrsas_release_mpt_cmd(struct extern struct mrsas_mpt_cmd *mrsas_get_mpt_cmd(struct mrsas_softc *sc); extern int mrsas_passthru(struct mrsas_softc *sc, void *arg); extern uint8_t MR_ValidateMapInfo(struct mrsas_softc *sc); -extern u_int16_t MR_GetLDTgtId(u_int32_t ld, MR_FW_RAID_MAP_ALL *map); -extern MR_LD_RAID *MR_LdRaidGet(u_int32_t ld, MR_FW_RAID_MAP_ALL *map); +extern u_int16_t MR_GetLDTgtId(u_int32_t ld, MR_DRV_RAID_MAP_ALL *map); +extern MR_LD_RAID *MR_LdRaidGet(u_int32_t ld, MR_DRV_RAID_MAP_ALL *map); extern void mrsas_xpt_freeze(struct mrsas_softc *sc); extern void mrsas_xpt_release(struct mrsas_softc *sc); extern MRSAS_REQUEST_DESCRIPTOR_UNION *mrsas_get_request_desc(struct mrsas_softc *sc, @@ -928,6 +928,9 @@ void mrsas_free_mem(struct mrsas_softc * bus_dmamem_free(sc->raidmap_tag[i], sc->raidmap_mem[i], sc->raidmap_dmamap[i]); if (sc->raidmap_tag[i] != NULL) bus_dma_tag_destroy(sc->raidmap_tag[i]); + + if (sc->ld_drv_map[i] != NULL) + free(sc->ld_drv_map[i], M_MRSAS); } /* @@ -1634,9 +1637,58 @@ mrsas_addr_cb(void *arg, bus_dma_segment * Allocate DMA memory for the RAID maps and perform setup. */ static int mrsas_setup_raidmap(struct mrsas_softc *sc) -{ - sc->map_sz = sizeof(MR_FW_RAID_MAP) + - (sizeof(MR_LD_SPAN_MAP) * (MAX_LOGICAL_DRIVES - 1)); +{ + int i; + + sc->drv_supported_vd_count = + MRSAS_MAX_LD_CHANNELS * MRSAS_MAX_DEV_PER_CHANNEL; + sc->drv_supported_pd_count = + MRSAS_MAX_PD_CHANNELS * MRSAS_MAX_DEV_PER_CHANNEL; + + if(sc->max256vdSupport) { + sc->fw_supported_vd_count = MAX_LOGICAL_DRIVES_EXT; + sc->fw_supported_pd_count = MAX_PHYSICAL_DEVICES; + } else { + sc->fw_supported_vd_count = MAX_LOGICAL_DRIVES; + sc->fw_supported_pd_count = MAX_PHYSICAL_DEVICES; + } + +#if VD_EXT_DEBUG + device_printf(sc->mrsas_dev, "FW supports: max256vdSupport = %s\n", + sc->max256vdSupport ? "YES":"NO"); + device_printf(sc->mrsas_dev, "FW supports %dVDs %dPDs\n" + "DRIVER supports %dVDs %dPDs \n", + sc->fw_supported_vd_count, sc->fw_supported_pd_count, + sc->drv_supported_vd_count, sc->drv_supported_pd_count); +#endif + + sc->old_map_sz = sizeof(MR_FW_RAID_MAP) + + (sizeof(MR_LD_SPAN_MAP) * (sc->fw_supported_vd_count - 1)); + sc->new_map_sz = sizeof(MR_FW_RAID_MAP_EXT); + sc->drv_map_sz = sizeof(MR_DRV_RAID_MAP) + + (sizeof(MR_LD_SPAN_MAP) * (sc->drv_supported_vd_count-1)); + + for (i = 0; i < 2; i++) { + sc->ld_drv_map[i] = + (void*) malloc(sc->drv_map_sz, M_MRSAS, M_NOWAIT); + /* Do Error handling */ + if (!sc->ld_drv_map[i]) { + device_printf(sc->mrsas_dev, "Could not allocate memory for local map"); + + if (i == 1) + free (sc->ld_drv_map[0], M_MRSAS); + //ABORT driver initialization + goto ABORT; + } + } + + sc->max_map_sz = max(sc->old_map_sz, sc->new_map_sz); + + if(sc->max256vdSupport) + sc->current_map_sz = sc->new_map_sz; + else + sc->current_map_sz = sc->old_map_sz; + for (int i=0; i < 2; i++) { @@ -1645,28 +1697,36 @@ static int mrsas_setup_raidmap(struct mr BUS_SPACE_MAXADDR_32BIT,// lowaddr BUS_SPACE_MAXADDR, // highaddr NULL, NULL, // filter, filterarg - sc->map_sz, // maxsize + sc->max_map_sz, // maxsize 1, // nsegments - sc->map_sz, // maxsegsize + sc->max_map_sz, // maxsegsize BUS_DMA_ALLOCNOW, // flags NULL, NULL, // lockfunc, lockarg &sc->raidmap_tag[i])) { - device_printf(sc->mrsas_dev, "Cannot allocate raid map tag.\n"); - return (ENOMEM); - } - if (bus_dmamem_alloc(sc->raidmap_tag[i], (void **)&sc->raidmap_mem[i], - BUS_DMA_NOWAIT, &sc->raidmap_dmamap[i])) { - device_printf(sc->mrsas_dev, "Cannot allocate raidmap memory.\n"); - return (ENOMEM); + device_printf(sc->mrsas_dev, + "Cannot allocate raid map tag.\n"); + return (ENOMEM); + } + if (bus_dmamem_alloc(sc->raidmap_tag[i], + (void **)&sc->raidmap_mem[i], + BUS_DMA_NOWAIT, &sc->raidmap_dmamap[i])) { + device_printf(sc->mrsas_dev, + "Cannot allocate raidmap memory.\n"); + return (ENOMEM); } + + bzero (sc->raidmap_mem[i], sc->max_map_sz); + if (bus_dmamap_load(sc->raidmap_tag[i], sc->raidmap_dmamap[i], - sc->raidmap_mem[i], sc->map_sz, mrsas_addr_cb, &sc->raidmap_phys_addr[i], - BUS_DMA_NOWAIT)){ + sc->raidmap_mem[i], sc->max_map_sz, + mrsas_addr_cb, &sc->raidmap_phys_addr[i], + BUS_DMA_NOWAIT)){ device_printf(sc->mrsas_dev, "Cannot load raidmap memory.\n"); return (ENOMEM); } if (!sc->raidmap_mem[i]) { - device_printf(sc->mrsas_dev, "Cannot allocate memory for raid map.\n"); + device_printf(sc->mrsas_dev, + "Cannot allocate memory for raid map.\n"); return (ENOMEM); } } @@ -1675,6 +1735,9 @@ static int mrsas_setup_raidmap(struct mr mrsas_sync_map_info(sc); return (0); + +ABORT: + return (1); } /** @@ -1708,13 +1771,32 @@ static int mrsas_init_fw(struct mrsas_so if (mrsas_init_adapter(sc) != SUCCESS){ device_printf(sc->mrsas_dev, "Adapter initialize Fail.\n"); return(1); - } + } /* Allocate internal commands for pass-thru */ if (mrsas_alloc_mfi_cmds(sc) != SUCCESS){ device_printf(sc->mrsas_dev, "Allocate MFI cmd failed.\n"); return(1); - } + } + + /* + * Get the controller info from FW, so that + * the MAX VD support availability can be decided. + */ + ctrl_info = malloc(sizeof(struct mrsas_ctrl_info), M_MRSAS, M_NOWAIT); + if (!ctrl_info) + device_printf(sc->mrsas_dev, "Malloc for ctrl_info failed.\n"); + + if (mrsas_get_ctrl_info(sc, ctrl_info)) { + device_printf(sc->mrsas_dev, "Unable to get FW ctrl_info.\n"); + } + + sc->max256vdSupport = + (u_int8_t) ctrl_info->adapterOperations3.supportMaxExtLDs; + + if (ctrl_info->max_lds > 64){ + sc->max256vdSupport = 1; + } if (mrsas_setup_raidmap(sc) != SUCCESS) { device_printf(sc->mrsas_dev, "Set up RAID map failed.\n"); @@ -1722,16 +1804,13 @@ static int mrsas_init_fw(struct mrsas_so } /* For pass-thru, get PD/LD list and controller info */ - memset(sc->pd_list, 0, MRSAS_MAX_PD * sizeof(struct mrsas_pd_list)); + memset(sc->pd_list, 0, + MRSAS_MAX_PD * sizeof(struct mrsas_pd_list)); mrsas_get_pd_list(sc); - memset(sc->ld_ids, 0xff, MRSAS_MAX_LD); + memset(sc->ld_ids, 0xff, MRSAS_MAX_LD_IDS); mrsas_get_ld_list(sc); - //memset(sc->log_to_span, 0, MRSAS_MAX_LD * sizeof(LD_SPAN_INFO)); - - ctrl_info = malloc(sizeof(struct mrsas_ctrl_info), M_MRSAS, M_NOWAIT); - /* * Compute the max allowed sectors per IO: The controller info has two * limits on max sectors. Driver should use the minimum of these two. @@ -1742,33 +1821,32 @@ static int mrsas_init_fw(struct mrsas_so * to calculate max_sectors_1. So the number ended up as zero always. */ tmp_sectors = 0; - if (ctrl_info && !mrsas_get_ctrl_info(sc, ctrl_info)) { - max_sectors_1 = (1 << ctrl_info->stripe_sz_ops.min) * - ctrl_info->max_strips_per_io; - max_sectors_2 = ctrl_info->max_request_size; - tmp_sectors = min(max_sectors_1 , max_sectors_2); - sc->disableOnlineCtrlReset = - ctrl_info->properties.OnOffProperties.disableOnlineCtrlReset; - sc->UnevenSpanSupport = - ctrl_info->adapterOperations2.supportUnevenSpans; - if(sc->UnevenSpanSupport) { - device_printf(sc->mrsas_dev, "FW supports: UnevenSpanSupport=%x\n", - sc->UnevenSpanSupport); - if (MR_ValidateMapInfo(sc)) - sc->fast_path_io = 1; - else - sc->fast_path_io = 0; - - } - } + max_sectors_1 = (1 << ctrl_info->stripe_sz_ops.min) * + ctrl_info->max_strips_per_io; + max_sectors_2 = ctrl_info->max_request_size; + tmp_sectors = min(max_sectors_1 , max_sectors_2); sc->max_sectors_per_req = sc->max_num_sge * MRSAS_PAGE_SIZE / 512; if (tmp_sectors && (sc->max_sectors_per_req > tmp_sectors)) sc->max_sectors_per_req = tmp_sectors; + sc->disableOnlineCtrlReset = + ctrl_info->properties.OnOffProperties.disableOnlineCtrlReset; + sc->UnevenSpanSupport = + ctrl_info->adapterOperations2.supportUnevenSpans; + if(sc->UnevenSpanSupport) { + printf("FW supports: UnevenSpanSupport=%x\n\n", + sc->UnevenSpanSupport); + + if (MR_ValidateMapInfo(sc)) + sc->fast_path_io = 1; + else + sc->fast_path_io = 0; + } + if (ctrl_info) free(ctrl_info, M_MRSAS); - + return(0); } @@ -1934,6 +2012,7 @@ int mrsas_ioc_init(struct mrsas_softc *s init_frame->driver_ver_hi = 0; } + init_frame->driver_operations.mfi_capabilities.support_max_255lds = 1; phys_addr = (bus_addr_t)sc->ioc_init_phys_mem + 1024; init_frame->queue_info_new_phys_addr_lo = phys_addr; init_frame->data_xfer_len = sizeof(Mpi2IOCInitRequest_t); @@ -2468,7 +2547,7 @@ int mrsas_reset_ctrl(struct mrsas_softc /* Reset load balance info */ memset(sc->load_balance_info, 0, - sizeof(LD_LOAD_BALANCE_INFO) * MAX_LOGICAL_DRIVES); + sizeof(LD_LOAD_BALANCE_INFO) * MAX_LOGICAL_DRIVES_EXT); if (!mrsas_get_map_info(sc)) mrsas_sync_map_info(sc); @@ -3135,25 +3214,27 @@ static int mrsas_get_ld_map_info(struct int retcode = 0; struct mrsas_mfi_cmd *cmd; struct mrsas_dcmd_frame *dcmd; - MR_FW_RAID_MAP_ALL *map; + void *map; bus_addr_t map_phys_addr = 0; cmd = mrsas_get_mfi_cmd(sc); if (!cmd) { - device_printf(sc->mrsas_dev, "Cannot alloc for ld map info cmd.\n"); + device_printf(sc->mrsas_dev, + "Cannot alloc for ld map info cmd.\n"); return 1; } dcmd = &cmd->frame->dcmd; - map = sc->raidmap_mem[(sc->map_id & 1)]; + map = (void *)sc->raidmap_mem[(sc->map_id & 1)]; map_phys_addr = sc->raidmap_phys_addr[(sc->map_id & 1)]; if (!map) { - device_printf(sc->mrsas_dev, "Failed to alloc mem for ld map info.\n"); + device_printf(sc->mrsas_dev, + "Failed to alloc mem for ld map info.\n"); mrsas_release_mfi_cmd(cmd); return (ENOMEM); } - memset(map, 0, sizeof(*map)); + memset(map, 0, sizeof(sc->max_map_sz)); memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE); dcmd->cmd = MFI_CMD_DCMD; @@ -3162,18 +3243,21 @@ static int mrsas_get_ld_map_info(struct dcmd->flags = MFI_FRAME_DIR_READ; dcmd->timeout = 0; dcmd->pad_0 = 0; - dcmd->data_xfer_len = sc->map_sz; + dcmd->data_xfer_len = sc->current_map_sz; dcmd->opcode = MR_DCMD_LD_MAP_GET_INFO; dcmd->sgl.sge32[0].phys_addr = map_phys_addr; - dcmd->sgl.sge32[0].length = sc->map_sz; + dcmd->sgl.sge32[0].length = sc->current_map_sz; + if (!mrsas_issue_polled(sc, cmd)) retcode = 0; - else + else { - device_printf(sc->mrsas_dev, "Fail to send get LD map info cmd.\n"); + device_printf(sc->mrsas_dev, + "Fail to send get LD map info cmd.\n"); retcode = 1; } mrsas_release_mfi_cmd(cmd); + return(retcode); } @@ -3191,26 +3275,28 @@ static int mrsas_sync_map_info(struct mr struct mrsas_dcmd_frame *dcmd; uint32_t size_sync_info, num_lds; MR_LD_TARGET_SYNC *target_map = NULL; - MR_FW_RAID_MAP_ALL *map; + MR_DRV_RAID_MAP_ALL *map; MR_LD_RAID *raid; MR_LD_TARGET_SYNC *ld_sync; bus_addr_t map_phys_addr = 0; cmd = mrsas_get_mfi_cmd(sc); if (!cmd) { - device_printf(sc->mrsas_dev, "Cannot alloc for sync map info cmd\n"); + device_printf(sc->mrsas_dev, + "Cannot alloc for sync map info cmd\n"); return 1; } - map = sc->raidmap_mem[sc->map_id & 1]; + map = sc->ld_drv_map[sc->map_id & 1]; num_lds = map->raidMap.ldCount; - + dcmd = &cmd->frame->dcmd; size_sync_info = sizeof(MR_LD_TARGET_SYNC) * num_lds; memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE); - target_map = (MR_LD_TARGET_SYNC *)sc->raidmap_mem[(sc->map_id - 1) & 1]; - memset(target_map, 0, sizeof(MR_FW_RAID_MAP_ALL)); + target_map = + (MR_LD_TARGET_SYNC *)sc->raidmap_mem[(sc->map_id - 1) & 1]; + memset(target_map, 0, sc->max_map_sz); map_phys_addr = sc->raidmap_phys_addr[(sc->map_id - 1) & 1]; @@ -3228,16 +3314,17 @@ static int mrsas_sync_map_info(struct mr dcmd->flags = MFI_FRAME_DIR_WRITE; dcmd->timeout = 0; dcmd->pad_0 = 0; - dcmd->data_xfer_len = sc->map_sz; + dcmd->data_xfer_len = sc->current_map_sz; dcmd->mbox.b[0] = num_lds; dcmd->mbox.b[1] = MRSAS_DCMD_MBOX_PEND_FLAG; dcmd->opcode = MR_DCMD_LD_MAP_GET_INFO; dcmd->sgl.sge32[0].phys_addr = map_phys_addr; - dcmd->sgl.sge32[0].length = sc->map_sz; + dcmd->sgl.sge32[0].length = sc->current_map_sz; sc->map_update_cmd = cmd; if (mrsas_issue_dcmd(sc, cmd)) { - device_printf(sc->mrsas_dev, "Fail to send sync map info command.\n"); + device_printf(sc->mrsas_dev, + "Fail to send sync map info command.\n"); return(1); } return(retcode); @@ -3263,7 +3350,8 @@ static int mrsas_get_pd_list(struct mrsa cmd = mrsas_get_mfi_cmd(sc); if (!cmd) { - device_printf(sc->mrsas_dev, "Cannot alloc for get PD list cmd\n"); + device_printf(sc->mrsas_dev, + "Cannot alloc for get PD list cmd\n"); return 1; } @@ -3272,7 +3360,8 @@ static int mrsas_get_pd_list(struct mrsa tcmd = malloc(sizeof(struct mrsas_tmp_dcmd), M_MRSAS, M_NOWAIT); pd_list_size = MRSAS_MAX_PD * sizeof(struct MR_PD_LIST); if (mrsas_alloc_tmp_dcmd(sc, tcmd, pd_list_size) != SUCCESS) { - device_printf(sc->mrsas_dev, "Cannot alloc dmamap for get PD list cmd\n"); + device_printf(sc->mrsas_dev, + "Cannot alloc dmamap for get PD list cmd\n"); mrsas_release_mfi_cmd(cmd); return(ENOMEM); } @@ -3304,11 +3393,14 @@ static int mrsas_get_pd_list(struct mrsa pd_count = MRSAS_MAX_PD; pd_addr = pd_list_mem->addr; if (retcode == 0 && pd_list_mem->count < pd_count) { - memset(sc->local_pd_list, 0, MRSAS_MAX_PD * sizeof(struct mrsas_pd_list)); + memset(sc->local_pd_list, 0, + MRSAS_MAX_PD * sizeof(struct mrsas_pd_list)); for (pd_index = 0; pd_index < pd_list_mem->count; pd_index++) { sc->local_pd_list[pd_addr->deviceId].tid = pd_addr->deviceId; - sc->local_pd_list[pd_addr->deviceId].driveType = pd_addr->scsiDevType; - sc->local_pd_list[pd_addr->deviceId].driveState = MR_PD_STATE_SYSTEM; + sc->local_pd_list[pd_addr->deviceId].driveType = + pd_addr->scsiDevType; + sc->local_pd_list[pd_addr->deviceId].driveState = + MR_PD_STATE_SYSTEM; pd_addr++; } } @@ -3340,7 +3432,8 @@ static int mrsas_get_ld_list(struct mrsa cmd = mrsas_get_mfi_cmd(sc); if (!cmd) { - device_printf(sc->mrsas_dev, "Cannot alloc for get LD list cmd\n"); + device_printf(sc->mrsas_dev, + "Cannot alloc for get LD list cmd\n"); return 1; } @@ -3349,7 +3442,8 @@ static int mrsas_get_ld_list(struct mrsa tcmd = malloc(sizeof(struct mrsas_tmp_dcmd), M_MRSAS, M_NOWAIT); ld_list_size = sizeof(struct MR_LD_LIST); if (mrsas_alloc_tmp_dcmd(sc, tcmd, ld_list_size) != SUCCESS) { - device_printf(sc->mrsas_dev, "Cannot alloc dmamap for get LD list cmd\n"); + device_printf(sc->mrsas_dev, + "Cannot alloc dmamap for get LD list cmd\n"); mrsas_release_mfi_cmd(cmd); return(ENOMEM); } @@ -3359,6 +3453,9 @@ static int mrsas_get_ld_list(struct mrsa } memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE); + if (sc->max256vdSupport) + dcmd->mbox.b[0]=1; + dcmd->cmd = MFI_CMD_DCMD; dcmd->cmd_status = 0xFF; dcmd->sge_count = 1; @@ -3375,10 +3472,15 @@ static int mrsas_get_ld_list(struct mrsa else retcode = 1; +#if VD_EXT_DEBUG + printf ("Number of LDs %d\n", ld_list_mem->ldCount); +#endif + /* Get the instance LD list */ - if ((retcode == 0) && (ld_list_mem->ldCount <= (MAX_LOGICAL_DRIVES))){ + if ((retcode == 0) && + (ld_list_mem->ldCount <= sc->fw_supported_vd_count)){ sc->CurLdCount = ld_list_mem->ldCount; - memset(sc->ld_ids, 0xff, MRSAS_MAX_LD); + memset(sc->ld_ids, 0xff, MAX_LOGICAL_DRIVES_EXT); for (ld_index = 0; ld_index < ld_list_mem->ldCount; ld_index++) { if (ld_list_mem->ldList[ld_index].state != 0) { ids = ld_list_mem->ldList[ld_index].ref.ld_context.targetId; Modified: head/sys/dev/mrsas/mrsas.h ============================================================================== --- head/sys/dev/mrsas/mrsas.h Wed Oct 8 07:48:36 2014 (r272734) +++ head/sys/dev/mrsas/mrsas.h Wed Oct 8 08:48:18 2014 (r272735) @@ -573,32 +573,55 @@ typedef struct _MPI2_IOC_INIT_REQUEST /* * MR private defines */ -#define MR_PD_INVALID 0xFFFF -#define MAX_SPAN_DEPTH 8 -#define MAX_QUAD_DEPTH MAX_SPAN_DEPTH +#define MR_PD_INVALID 0xFFFF +#define MAX_SPAN_DEPTH 8 +#define MAX_QUAD_DEPTH MAX_SPAN_DEPTH #define MAX_RAIDMAP_SPAN_DEPTH (MAX_SPAN_DEPTH) -#define MAX_ROW_SIZE 32 -#define MAX_RAIDMAP_ROW_SIZE (MAX_ROW_SIZE) -#define MAX_LOGICAL_DRIVES 64 -#define MAX_RAIDMAP_LOGICAL_DRIVES (MAX_LOGICAL_DRIVES) -#define MAX_RAIDMAP_VIEWS (MAX_LOGICAL_DRIVES) -#define MAX_ARRAYS 128 -#define MAX_RAIDMAP_ARRAYS (MAX_ARRAYS) -#define MAX_PHYSICAL_DEVICES 256 -#define MAX_RAIDMAP_PHYSICAL_DEVICES (MAX_PHYSICAL_DEVICES) -#define MR_DCMD_LD_MAP_GET_INFO 0x0300e101 // get the mapping information of this LD +#define MAX_ROW_SIZE 32 +#define MAX_RAIDMAP_ROW_SIZE (MAX_ROW_SIZE) +#define MAX_LOGICAL_DRIVES 64 +#define MAX_LOGICAL_DRIVES_EXT 256 + +#define MAX_RAIDMAP_LOGICAL_DRIVES (MAX_LOGICAL_DRIVES) +#define MAX_RAIDMAP_VIEWS (MAX_LOGICAL_DRIVES) + +#define MAX_ARRAYS 128 +#define MAX_RAIDMAP_ARRAYS (MAX_ARRAYS) + +#define MAX_ARRAYS_EXT 256 +#define MAX_API_ARRAYS_EXT MAX_ARRAYS_EXT + +#define MAX_PHYSICAL_DEVICES 256 +#define MAX_RAIDMAP_PHYSICAL_DEVICES (MAX_PHYSICAL_DEVICES) +#define MR_DCMD_LD_MAP_GET_INFO 0x0300e101 // get the mapping information of this LD + + +#define MRSAS_MAX_PD_CHANNELS 1 +#define MRSAS_MAX_LD_CHANNELS 1 +#define MRSAS_MAX_DEV_PER_CHANNEL 256 +#define MRSAS_DEFAULT_INIT_ID -1 +#define MRSAS_MAX_LUN 8 +#define MRSAS_DEFAULT_CMD_PER_LUN 256 +#define MRSAS_MAX_PD (MRSAS_MAX_PD_CHANNELS * \ + MRSAS_MAX_DEV_PER_CHANNEL) +#define MRSAS_MAX_LD_IDS (MRSAS_MAX_LD_CHANNELS * \ + MRSAS_MAX_DEV_PER_CHANNEL) + + +#define VD_EXT_DEBUG 0 /******************************************************************* * RAID map related structures ********************************************************************/ - +#pragma pack(1) typedef struct _MR_DEV_HANDLE_INFO { - u_int16_t curDevHdl; // the device handle currently used by fw to issue the command. + u_int16_t curDevHdl; // the device handle currently used by fw to issue the command. u_int8_t validHandles; // bitmap of valid device handles. u_int8_t reserved; u_int16_t devHandle[2]; // 0x04 dev handles for all the paths. } MR_DEV_HANDLE_INFO; +#pragma pack() typedef struct _MR_ARRAY_INFO { u_int16_t pd[MAX_RAIDMAP_ROW_SIZE]; @@ -720,6 +743,86 @@ typedef struct _MR_FW_RAID_MAP { MR_LD_SPAN_MAP ldSpanMap[1]; // 0x28a8-[0-MAX_RAIDMAP_LOGICAL_DRIVES+MAX_RAIDMAP_VIEWS+1]; } MR_FW_RAID_MAP; // 0x3288, Total Size + +typedef struct _MR_FW_RAID_MAP_EXT { + /* Not used in new map */ + u_int32_t reserved; + + union { + struct { + u_int32_t maxLd; + u_int32_t maxSpanDepth; + u_int32_t maxRowSize; + u_int32_t maxPdCount; + u_int32_t maxArrays; + } validationInfo; + u_int32_t version[5]; + u_int32_t reserved1[5]; + }fw_raid_desc; + + u_int8_t fpPdIoTimeoutSec; + u_int8_t reserved2[7]; + + u_int16_t ldCount; + u_int16_t arCount; + u_int16_t spanCount; + u_int16_t reserve3; + + MR_DEV_HANDLE_INFO devHndlInfo[MAX_RAIDMAP_PHYSICAL_DEVICES]; + u_int8_t ldTgtIdToLd[MAX_LOGICAL_DRIVES_EXT]; + MR_ARRAY_INFO arMapInfo[MAX_API_ARRAYS_EXT]; + MR_LD_SPAN_MAP ldSpanMap[MAX_LOGICAL_DRIVES_EXT]; +} MR_FW_RAID_MAP_EXT; + + +typedef struct _MR_DRV_RAID_MAP { + /* total size of this structure, including this field. + * This feild will be manupulated by driver for ext raid map, + * else pick the value from firmware raid map. + */ + u_int32_t totalSize; + + union { + struct { + u_int32_t maxLd; + u_int32_t maxSpanDepth; + u_int32_t maxRowSize; + u_int32_t maxPdCount; + u_int32_t maxArrays; + } validationInfo; + u_int32_t version[5]; + u_int32_t reserved1[5]; + }drv_raid_desc; + + /* timeout value used by driver in FP IOs*/ + u_int8_t fpPdIoTimeoutSec; + u_int8_t reserved2[7]; + + u_int16_t ldCount; + u_int16_t arCount; + u_int16_t spanCount; + u_int16_t reserve3; + + MR_DEV_HANDLE_INFO devHndlInfo[MAX_RAIDMAP_PHYSICAL_DEVICES]; + u_int8_t ldTgtIdToLd[MAX_LOGICAL_DRIVES_EXT]; + MR_ARRAY_INFO arMapInfo[MAX_API_ARRAYS_EXT]; + MR_LD_SPAN_MAP ldSpanMap[1]; + +}MR_DRV_RAID_MAP; + +/* Driver raid map size is same as raid map ext + * MR_DRV_RAID_MAP_ALL is created to sync with old raid. + * And it is mainly for code re-use purpose. + */ + +#pragma pack(1) +typedef struct _MR_DRV_RAID_MAP_ALL { + + MR_DRV_RAID_MAP raidMap; + MR_LD_SPAN_MAP ldSpanMap[MAX_LOGICAL_DRIVES_EXT - 1]; +}MR_DRV_RAID_MAP_ALL; +#pragma pack() + typedef struct _LD_LOAD_BALANCE_INFO { u_int8_t loadBalanceFlag; @@ -1200,22 +1303,6 @@ typedef enum _REGION_TYPE { REGION_TYPE_EXCLUSIVE = 3, // exclusive lock (for writes) } REGION_TYPE; -/* - * MR private defines - */ -#define MR_PD_INVALID 0xFFFF -#define MAX_SPAN_DEPTH 8 -#define MAX_RAIDMAP_SPAN_DEPTH (MAX_SPAN_DEPTH) -#define MAX_ROW_SIZE 32 -#define MAX_RAIDMAP_ROW_SIZE (MAX_ROW_SIZE) -#define MAX_LOGICAL_DRIVES 64 -#define MAX_RAIDMAP_LOGICAL_DRIVES (MAX_LOGICAL_DRIVES) -#define MAX_RAIDMAP_VIEWS (MAX_LOGICAL_DRIVES) -#define MAX_ARRAYS 128 -#define MAX_RAIDMAP_ARRAYS (MAX_ARRAYS) -#define MAX_PHYSICAL_DEVICES 256 -#define MAX_RAIDMAP_PHYSICAL_DEVICES (MAX_PHYSICAL_DEVICES) -#define MR_DCMD_LD_MAP_GET_INFO 0x0300e101 /* * SCSI-CAM Related Defines @@ -1423,7 +1510,7 @@ struct MR_LD_LIST { u_int8_t state; // current LD state (MR_LD_STATE) u_int8_t reserved[3]; // pad to 8-byte boundary u_int64_t size; // LD size - } ldList[MAX_LOGICAL_DRIVES]; + } ldList[MAX_LOGICAL_DRIVES_EXT]; }; #pragma pack() @@ -1485,7 +1572,23 @@ struct mrsas_ctrl_prop { u_int32_t allowBootWithPinnedCache : 1; u_int32_t disableSpinDownHS : 1; u_int32_t enableJBOD : 1; - u_int32_t reserved :18; + u_int32_t disableCacheBypass : 1; // 1 = disable cache-bypass-performance-improvement feature + u_int32_t useDiskActivityForLocate : 1; // 1 = drive activity LED is toggled for LOCATE + u_int32_t enablePI : 1; // 0 = Disable SCSI PI for controller. Remove any active protection information + u_int32_t preventPIImport : 1; // 1 = Prevent import of SCSI DIF protected logical disks + u_int32_t useGlobalSparesForEmergency : 1; // 1 = Use global spares for Emergency (if spare is incompatible without Emergency) + u_int32_t useUnconfGoodForEmergency : 1; // 1 = Use uncofgured good drives for Emergency + u_int32_t useEmergencySparesforSMARTer: 1; // 1 = Use Emergency spares for SMARTer + u_int32_t forceSGPIOForQuadOnly : 1; // 1 = Force SGPIO status per port only for four drives, affects HPC controllers + u_int32_t enableConfigAutoBalance : 1; // 0 = Configuration auto balance disabled, 1 = Configuration auto balance enabled + u_int32_t enableVirtualCache : 1; // 1 = Virtual caching is enabled on DFF and SFM. + u_int32_t enableAutoLockRecovery : 1; // 1 = Auto Lock Recovery on DFF and SFM + u_int32_t disableImmediateIO : 1; // 1 = Disable Legacy Immediate IO, 0 = Enable + u_int32_t disableT10RebuildAssist : 1; // 1 = Disable T10 Rebuild Assist, use legacy rebuild method + u_int32_t ignore64ldRestriction : 1; // 0 - limit LD to 64 even if more LD support exists, 1 - support more than 64 ld with new DDF format + u_int32_t enableSwZone : 1; // 1 = enable Software Zone + u_int32_t limitMaxRateSATA3G : 1; // 1 = negotiated link rates to direct attached SATA devices shall be limited to 3Gbps + u_int32_t reserved :2; } OnOffProperties; u_int8_t autoSnapVDSpace; // % of source LD to be reserved for auto // snapshot in snapshot repository, for @@ -1828,16 +1931,18 @@ struct mrsas_ctrl_info { u_int32_t reserved :26; } cluster; - char clusterId[16]; //0x7D4 + char clusterId[16]; //0x7D4 - u_int8_t pad[0x800-0x7E4]; //0x7E4 -} __packed; + char reserved6[4]; //0x7E4 RESERVED FOR IOV -/* - * Ld and PD Max Support Defines - */ -#define MRSAS_MAX_PD 256 -#define MRSAS_MAX_LD 64 + struct{ //0x7E8 + u_int32_t resrved :5; + u_int32_t supportMaxExtLDs :1; + u_int32_t reserved1 :26; + }adapterOperations3; + + u_int8_t pad[0x800-0x7EC]; //0x7EC +} __packed; /* * When SCSI mid-layer calls driver's reset routine, driver waits for @@ -1930,6 +2035,18 @@ struct mrsas_header { }; #pragma pack() + +typedef union _MFI_CAPABILITIES { + struct { + u_int32_t support_fp_remote_lun:1; + u_int32_t support_additional_msix:1; + u_int32_t support_fastpath_wb:1; + u_int32_t support_max_255lds:1; + u_int32_t reserved:28; + } mfi_capabilities; + u_int32_t reg; +} MFI_CAPABILITIES; + #pragma pack(1) struct mrsas_init_frame { u_int8_t cmd; /*00h */ @@ -1937,8 +2054,7 @@ struct mrsas_init_frame { u_int8_t cmd_status; /*02h */ u_int8_t reserved_1; /*03h */ - u_int32_t reserved_2; /*04h */ - + MFI_CAPABILITIES driver_operations; /*04h*/ u_int32_t context; /*08h */ u_int32_t pad_0; /*0Ch */ @@ -2423,13 +2539,29 @@ struct mrsas_softc { bus_addr_t el_info_phys_addr; //get event log info cmd physical addr struct mrsas_pd_list pd_list[MRSAS_MAX_PD]; struct mrsas_pd_list local_pd_list[MRSAS_MAX_PD]; - u_int8_t ld_ids[MRSAS_MAX_LD]; + u_int8_t ld_ids[MRSAS_MAX_LD_IDS]; struct taskqueue *ev_tq; //taskqueue for events struct task ev_task; u_int32_t CurLdCount; u_int64_t reset_flags; - LD_LOAD_BALANCE_INFO load_balance_info[MAX_LOGICAL_DRIVES]; - LD_SPAN_INFO log_to_span[MAX_LOGICAL_DRIVES]; + LD_LOAD_BALANCE_INFO load_balance_info[MAX_LOGICAL_DRIVES_EXT]; + LD_SPAN_INFO log_to_span[MAX_LOGICAL_DRIVES_EXT]; + + u_int8_t max256vdSupport; + u_int16_t fw_supported_vd_count; + u_int16_t fw_supported_pd_count; + + u_int16_t drv_supported_vd_count; + u_int16_t drv_supported_pd_count; + + u_int32_t max_map_sz; + u_int32_t current_map_sz; + u_int32_t old_map_sz; + u_int32_t new_map_sz; + u_int32_t drv_map_sz; + + /*Non dma-able memory. Driver local copy.*/ + MR_DRV_RAID_MAP_ALL *ld_drv_map[2]; }; /* Compatibility shims for different OS versions */ Modified: head/sys/dev/mrsas/mrsas_cam.c ============================================================================== --- head/sys/dev/mrsas/mrsas_cam.c Wed Oct 8 07:48:36 2014 (r272734) +++ head/sys/dev/mrsas/mrsas_cam.c Wed Oct 8 08:48:18 2014 (r272735) @@ -77,7 +77,7 @@ void mrsas_fire_cmd(struct mrsas_softc * u_int32_t req_desc_hi); void mrsas_set_pd_lba(MRSAS_RAID_SCSI_IO_REQUEST *io_request, u_int8_t cdb_len, struct IO_REQUEST_INFO *io_info, union ccb *ccb, - MR_FW_RAID_MAP_ALL *local_map_ptr, u_int32_t ref_tag, + MR_DRV_RAID_MAP_ALL *local_map_ptr, u_int32_t ref_tag, u_int32_t ld_block_size); static void mrsas_freeze_simq(struct mrsas_mpt_cmd *cmd, struct cam_sim *sim); static void mrsas_poll(struct cam_sim *sim); @@ -91,16 +91,16 @@ struct mrsas_mpt_cmd * mrsas_get_mpt_cmd MRSAS_REQUEST_DESCRIPTOR_UNION *mrsas_get_request_desc(struct mrsas_softc *sc, u_int16_t index); -extern u_int16_t MR_TargetIdToLdGet(u_int32_t ldTgtId, MR_FW_RAID_MAP_ALL *map); -extern u_int32_t MR_LdBlockSizeGet(u_int32_t ldTgtId, MR_FW_RAID_MAP_ALL *map, +extern u_int16_t MR_TargetIdToLdGet(u_int32_t ldTgtId, MR_DRV_RAID_MAP_ALL *map); +extern u_int32_t MR_LdBlockSizeGet(u_int32_t ldTgtId, MR_DRV_RAID_MAP_ALL *map, struct mrsas_softc *sc); extern void mrsas_isr(void *arg); extern void mrsas_aen_handler(struct mrsas_softc *sc); extern u_int8_t MR_BuildRaidContext(struct mrsas_softc *sc, struct IO_REQUEST_INFO *io_info,RAID_CONTEXT *pRAID_Context, - MR_FW_RAID_MAP_ALL *map); + MR_DRV_RAID_MAP_ALL *map); extern u_int16_t MR_LdSpanArrayGet(u_int32_t ld, u_int32_t span, - MR_FW_RAID_MAP_ALL *map); + MR_DRV_RAID_MAP_ALL *map); extern u_int16_t mrsas_get_updated_dev_handle(PLD_LOAD_BALANCE_INFO lbInfo, struct IO_REQUEST_INFO *io_info); extern u_int8_t megasas_get_best_arm(PLD_LOAD_BALANCE_INFO lbInfo, u_int8_t arm, @@ -321,9 +321,9 @@ static void mrsas_action(struct cam_sim ccb->cpi.protocol = PROTO_SCSI; ccb->cpi.protocol_version = SCSI_REV_2; if (ccb->cpi.bus_id == 0) - ccb->cpi.max_target = MRSAS_MAX_LD-1; - else ccb->cpi.max_target = MRSAS_MAX_PD-1; + else + ccb->cpi.max_target = MRSAS_MAX_LD_IDS-1; #if (__FreeBSD_version > 704000) ccb->cpi.maxio = MRSAS_MAX_IO_SIZE; #endif @@ -701,7 +701,7 @@ int mrsas_setup_io(struct mrsas_softc *s struct ccb_hdr *ccb_h = &(ccb->ccb_h); struct ccb_scsiio *csio = &(ccb->csio); struct IO_REQUEST_INFO io_info; - MR_FW_RAID_MAP_ALL *map_ptr; + MR_DRV_RAID_MAP_ALL *map_ptr; u_int8_t fp_possible; u_int32_t start_lba_hi, start_lba_lo, ld_block_size; u_int32_t datalength = 0; @@ -780,10 +780,10 @@ int mrsas_setup_io(struct mrsas_softc *s break; } - map_ptr = sc->raidmap_mem[(sc->map_id & 1)]; + map_ptr = sc->ld_drv_map[(sc->map_id & 1)]; ld_block_size = MR_LdBlockSizeGet(device_id, map_ptr, sc); - if ((MR_TargetIdToLdGet(device_id, map_ptr) >= MAX_LOGICAL_DRIVES) || + if ((MR_TargetIdToLdGet(device_id, map_ptr) >= MAX_LOGICAL_DRIVES_EXT) || (!sc->fast_path_io)) { io_request->RaidContext.regLockFlags = 0; fp_possible = 0; @@ -851,12 +851,12 @@ int mrsas_build_dcdb(struct mrsas_softc { struct ccb_hdr *ccb_h = &(ccb->ccb_h); u_int32_t device_id; - MR_FW_RAID_MAP_ALL *map_ptr; + MR_DRV_RAID_MAP_ALL *map_ptr; MRSAS_RAID_SCSI_IO_REQUEST *io_request; io_request = cmd->io_request; device_id = ccb_h->target_id; - map_ptr = sc->raidmap_mem[(sc->map_id & 1)]; + map_ptr = sc->ld_drv_map[(sc->map_id & 1)]; /* Check if this is for system PD */ if (cam_sim_bus(sim) == 1 && @@ -867,7 +867,12 @@ int mrsas_build_dcdb(struct mrsas_softc io_request->RaidContext.regLockFlags = 0; io_request->RaidContext.regLockRowLBA = 0; io_request->RaidContext.regLockLength = 0; - io_request->RaidContext.RAIDFlags = MR_RAID_FLAGS_IO_SUB_TYPE_SYSTEM_PD << + + // LSI TEST + //printf("LSI Debug bus %d device_id %d map_ptr->raidMap.devHndlInfo[device_id].curDevHdl %d \n", + // cam_sim_bus(sim), device_id, map_ptr->raidMap.devHndlInfo[device_id].curDevHdl); + + io_request->RaidContext.RAIDFlags = MR_RAID_FLAGS_IO_SUB_TYPE_SYSTEM_PD << MR_RAID_CTX_RAID_FLAGS_IO_SUB_TYPE_SHIFT; if ((sc->device_id == MRSAS_INVADER) || (sc->device_id == MRSAS_FURY)) io_request->IoFlags |= MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH; Modified: head/sys/dev/mrsas/mrsas_fp.c ============================================================================== --- head/sys/dev/mrsas/mrsas_fp.c Wed Oct 8 07:48:36 2014 (r272734) +++ head/sys/dev/mrsas/mrsas_fp.c Wed Oct 8 08:48:18 2014 (r272735) @@ -63,54 +63,56 @@ u_int8_t mrsas_get_best_arm(PLD_LOAD_BAL u_int64_t block, u_int32_t count); u_int8_t MR_BuildRaidContext(struct mrsas_softc *sc, struct IO_REQUEST_INFO *io_info, - RAID_CONTEXT *pRAID_Context, MR_FW_RAID_MAP_ALL *map); + RAID_CONTEXT *pRAID_Context, MR_DRV_RAID_MAP_ALL *map); u_int8_t MR_GetPhyParams(struct mrsas_softc *sc, u_int32_t ld, u_int64_t stripRow, u_int16_t stripRef, struct IO_REQUEST_INFO *io_info, RAID_CONTEXT *pRAID_Context, - MR_FW_RAID_MAP_ALL *map); -u_int16_t MR_TargetIdToLdGet(u_int32_t ldTgtId, MR_FW_RAID_MAP_ALL *map); -u_int32_t MR_LdBlockSizeGet(u_int32_t ldTgtId, MR_FW_RAID_MAP_ALL *map); -u_int16_t MR_GetLDTgtId(u_int32_t ld, MR_FW_RAID_MAP_ALL *map); + MR_DRV_RAID_MAP_ALL *map); +u_int16_t MR_TargetIdToLdGet(u_int32_t ldTgtId, MR_DRV_RAID_MAP_ALL *map); +u_int32_t MR_LdBlockSizeGet(u_int32_t ldTgtId, MR_DRV_RAID_MAP_ALL *map); +u_int16_t MR_GetLDTgtId(u_int32_t ld, MR_DRV_RAID_MAP_ALL *map); u_int16_t mrsas_get_updated_dev_handle(PLD_LOAD_BALANCE_INFO lbInfo, struct IO_REQUEST_INFO *io_info); u_int32_t mega_mod64(u_int64_t dividend, u_int32_t divisor); u_int32_t MR_GetSpanBlock(u_int32_t ld, u_int64_t row, u_int64_t *span_blk, - MR_FW_RAID_MAP_ALL *map, int *div_error); + MR_DRV_RAID_MAP_ALL *map, int *div_error); u_int64_t mega_div64_32(u_int64_t dividend, u_int32_t divisor); -void mrsas_update_load_balance_params(MR_FW_RAID_MAP_ALL *map, +void mrsas_update_load_balance_params(MR_DRV_RAID_MAP_ALL *map, PLD_LOAD_BALANCE_INFO lbInfo); void mrsas_set_pd_lba(MRSAS_RAID_SCSI_IO_REQUEST *io_request, u_int8_t cdb_len, struct IO_REQUEST_INFO *io_info, union ccb *ccb, - MR_FW_RAID_MAP_ALL *local_map_ptr, u_int32_t ref_tag, + MR_DRV_RAID_MAP_ALL *local_map_ptr, u_int32_t ref_tag, u_int32_t ld_block_size); static u_int16_t MR_LdSpanArrayGet(u_int32_t ld, u_int32_t span, - MR_FW_RAID_MAP_ALL *map); -static u_int16_t MR_PdDevHandleGet(u_int32_t pd, MR_FW_RAID_MAP_ALL *map); + MR_DRV_RAID_MAP_ALL *map); +static u_int16_t MR_PdDevHandleGet(u_int32_t pd, MR_DRV_RAID_MAP_ALL *map); static u_int16_t MR_ArPdGet(u_int32_t ar, u_int32_t arm, - MR_FW_RAID_MAP_ALL *map); + MR_DRV_RAID_MAP_ALL *map); static MR_LD_SPAN *MR_LdSpanPtrGet(u_int32_t ld, u_int32_t span, - MR_FW_RAID_MAP_ALL *map); + MR_DRV_RAID_MAP_ALL *map); static u_int8_t MR_LdDataArmGet(u_int32_t ld, u_int32_t armIdx, - MR_FW_RAID_MAP_ALL *map); + MR_DRV_RAID_MAP_ALL *map); static MR_SPAN_BLOCK_INFO *MR_LdSpanInfoGet(u_int32_t ld, - MR_FW_RAID_MAP_ALL *map); -MR_LD_RAID *MR_LdRaidGet(u_int32_t ld, MR_FW_RAID_MAP_ALL *map); + MR_DRV_RAID_MAP_ALL *map); +MR_LD_RAID *MR_LdRaidGet(u_int32_t ld, MR_DRV_RAID_MAP_ALL *map); +void MR_PopulateDrvRaidMap (struct mrsas_softc *sc); + /* * Spanset related function prototypes * Added for PRL11 configuration (Uneven span support) */ -void mr_update_span_set(MR_FW_RAID_MAP_ALL *map, PLD_SPAN_INFO ldSpanInfo); +void mr_update_span_set(MR_DRV_RAID_MAP_ALL *map, PLD_SPAN_INFO ldSpanInfo); static u_int8_t mr_spanset_get_phy_params(struct mrsas_softc *sc, u_int32_t ld, u_int64_t stripRow, u_int16_t stripRef, struct IO_REQUEST_INFO *io_info, - RAID_CONTEXT *pRAID_Context, MR_FW_RAID_MAP_ALL *map); + RAID_CONTEXT *pRAID_Context, MR_DRV_RAID_MAP_ALL *map); static u_int64_t get_row_from_strip(struct mrsas_softc *sc, u_int32_t ld, - u_int64_t strip, MR_FW_RAID_MAP_ALL *map); + u_int64_t strip, MR_DRV_RAID_MAP_ALL *map); static u_int32_t mr_spanset_get_span_block(struct mrsas_softc *sc, u_int32_t ld, u_int64_t row, u_int64_t *span_blk, - MR_FW_RAID_MAP_ALL *map, int *div_error); + MR_DRV_RAID_MAP_ALL *map, int *div_error); static u_int8_t get_arm(struct mrsas_softc *sc, u_int32_t ld, u_int8_t span, - u_int64_t stripe, MR_FW_RAID_MAP_ALL *map); + u_int64_t stripe, MR_DRV_RAID_MAP_ALL *map); /* @@ -173,52 +175,52 @@ quotient;}) * parts of the RAID map and returns the appropriate parameters. */ -MR_LD_RAID *MR_LdRaidGet(u_int32_t ld, MR_FW_RAID_MAP_ALL *map) +MR_LD_RAID *MR_LdRaidGet(u_int32_t ld, MR_DRV_RAID_MAP_ALL *map) { return (&map->raidMap.ldSpanMap[ld].ldRaid); } -u_int16_t MR_GetLDTgtId(u_int32_t ld, MR_FW_RAID_MAP_ALL *map) +u_int16_t MR_GetLDTgtId(u_int32_t ld, MR_DRV_RAID_MAP_ALL *map) { return (map->raidMap.ldSpanMap[ld].ldRaid.targetId); } -static u_int16_t MR_LdSpanArrayGet(u_int32_t ld, u_int32_t span, MR_FW_RAID_MAP_ALL *map) +static u_int16_t MR_LdSpanArrayGet(u_int32_t ld, u_int32_t span, MR_DRV_RAID_MAP_ALL *map) { return map->raidMap.ldSpanMap[ld].spanBlock[span].span.arrayRef; } -static u_int8_t MR_LdDataArmGet(u_int32_t ld, u_int32_t armIdx, MR_FW_RAID_MAP_ALL *map) +static u_int8_t MR_LdDataArmGet(u_int32_t ld, u_int32_t armIdx, MR_DRV_RAID_MAP_ALL *map) { return map->raidMap.ldSpanMap[ld].dataArmMap[armIdx]; } -static u_int16_t MR_PdDevHandleGet(u_int32_t pd, MR_FW_RAID_MAP_ALL *map) +static u_int16_t MR_PdDevHandleGet(u_int32_t pd, MR_DRV_RAID_MAP_ALL *map) { return map->raidMap.devHndlInfo[pd].curDevHdl; } -static u_int16_t MR_ArPdGet(u_int32_t ar, u_int32_t arm, MR_FW_RAID_MAP_ALL *map) +static u_int16_t MR_ArPdGet(u_int32_t ar, u_int32_t arm, MR_DRV_RAID_MAP_ALL *map) { return map->raidMap.arMapInfo[ar].pd[arm]; } -static MR_LD_SPAN *MR_LdSpanPtrGet(u_int32_t ld, u_int32_t span, MR_FW_RAID_MAP_ALL *map) +static MR_LD_SPAN *MR_LdSpanPtrGet(u_int32_t ld, u_int32_t span, MR_DRV_RAID_MAP_ALL *map) { return &map->raidMap.ldSpanMap[ld].spanBlock[span].span; } -static MR_SPAN_BLOCK_INFO *MR_LdSpanInfoGet(u_int32_t ld, MR_FW_RAID_MAP_ALL *map) +static MR_SPAN_BLOCK_INFO *MR_LdSpanInfoGet(u_int32_t ld, MR_DRV_RAID_MAP_ALL *map) { return &map->raidMap.ldSpanMap[ld].spanBlock[0]; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 08:51:06 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BB99C560; Wed, 8 Oct 2014 08:51:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A81B2DC6; Wed, 8 Oct 2014 08:51:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s988p6Ar054155; Wed, 8 Oct 2014 08:51:06 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s988p6w5054154; Wed, 8 Oct 2014 08:51:06 GMT (envelope-from br@FreeBSD.org) Message-Id: <201410080851.s988p6w5054154@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Wed, 8 Oct 2014 08:51:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272736 - head/sys/dev/mmc/host X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 08:51:06 -0000 Author: br Date: Wed Oct 8 08:51:05 2014 New Revision: 272736 URL: https://svnweb.freebsd.org/changeset/base/272736 Log: Always wait 'command done' interrupt status bit before proceeding next command. Sponsored by: DARPA, AFRL Modified: head/sys/dev/mmc/host/dwmmc.c Modified: head/sys/dev/mmc/host/dwmmc.c ============================================================================== --- head/sys/dev/mmc/host/dwmmc.c Wed Oct 8 08:48:18 2014 (r272735) +++ head/sys/dev/mmc/host/dwmmc.c Wed Oct 8 08:51:05 2014 (r272736) @@ -348,9 +348,10 @@ dwmmc_tasklet(struct dwmmc_softc *sc) if (cmd == NULL) return; - if (cmd->error != MMC_ERR_NONE) { - dwmmc_next_operation(sc); - } else if (!cmd->data && sc->cmd_done) { + if (!sc->cmd_done) + return; + + if (cmd->error != MMC_ERR_NONE || !cmd->data) { dwmmc_next_operation(sc); } else if (cmd->data && sc->dto_rcvd) { if ((cmd->opcode == MMC_WRITE_MULTIPLE_BLOCK || @@ -394,11 +395,8 @@ dwmmc_intr(void *arg) dprintf("data err 0x%08x cmd 0x%08x\n", reg, cmd->opcode); cmd->error = MMC_ERR_FAILED; - dma_done(sc, cmd); dma_stop(sc); - DWMMC_UNLOCK(sc); - return; } if (reg & SDMMC_INTMASK_CMD_DONE) { From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 09:19:38 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 126CCB76; Wed, 8 Oct 2014 09:19:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F0F7DD8; Wed, 8 Oct 2014 09:19:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s989Jb8t068188; Wed, 8 Oct 2014 09:19:37 GMT (envelope-from kadesai@FreeBSD.org) Received: (from kadesai@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s989JaR3068176; Wed, 8 Oct 2014 09:19:36 GMT (envelope-from kadesai@FreeBSD.org) Message-Id: <201410080919.s989JaR3068176@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kadesai set sender to kadesai@FreeBSD.org using -f From: Kashyap D Desai Date: Wed, 8 Oct 2014 09:19:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272737 - in head/sys: dev/mrsas modules/mrsas modules/mrsas/mrsas_linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 09:19:38 -0000 Author: kadesai Date: Wed Oct 8 09:19:35 2014 New Revision: 272737 URL: https://svnweb.freebsd.org/changeset/base/272737 Log: This is a feature provided to run 32-bit linux binaries on FreeBSD 64bit machine, for which 32bit compatibilty code has been added. As in linux there is only one device entry that is used to fire IOCTL commands, a new device entry megaraid_sas_ioctl_node is added for solely this purpose. From one dev node i.e mrgaraid_sa_ioctl_node we have to find out the controller instance in case of multicontroller, for which one management info structure has been added. Reviewed by: ambrisko MFC after: 2 weeks Sponsored by: AVAGO Technologies Added: head/sys/dev/mrsas/mrsas_linux.c (contents, props changed) head/sys/modules/mrsas/mrsas_linux/ head/sys/modules/mrsas/mrsas_linux/Makefile (contents, props changed) Modified: head/sys/dev/mrsas/mrsas.c head/sys/dev/mrsas/mrsas.h head/sys/dev/mrsas/mrsas_ioctl.c head/sys/dev/mrsas/mrsas_ioctl.h head/sys/modules/mrsas/Makefile Modified: head/sys/dev/mrsas/mrsas.c ============================================================================== --- head/sys/dev/mrsas/mrsas.c Wed Oct 8 08:51:05 2014 (r272736) +++ head/sys/dev/mrsas/mrsas.c Wed Oct 8 09:19:35 2014 (r272737) @@ -65,6 +65,7 @@ static d_read_t mrsas_read; static d_write_t mrsas_write; static d_ioctl_t mrsas_ioctl; +static struct mrsas_mgmt_info mrsas_mgmt_info; static struct mrsas_ident *mrsas_find_ident(device_t); static void mrsas_shutdown_ctlr(struct mrsas_softc *sc, u_int32_t opcode); static void mrsas_flush_cache(struct mrsas_softc *sc); @@ -137,7 +138,7 @@ extern void mrsas_free_frame(struct mrsa extern int mrsas_alloc_mfi_cmds(struct mrsas_softc *sc); extern void mrsas_release_mpt_cmd(struct mrsas_mpt_cmd *cmd); extern struct mrsas_mpt_cmd *mrsas_get_mpt_cmd(struct mrsas_softc *sc); -extern int mrsas_passthru(struct mrsas_softc *sc, void *arg); +extern int mrsas_passthru(struct mrsas_softc *sc, void *arg, u_long ioctlCmd); extern uint8_t MR_ValidateMapInfo(struct mrsas_softc *sc); extern u_int16_t MR_GetLDTgtId(u_int32_t ld, MR_DRV_RAID_MAP_ALL *map); extern MR_LD_RAID *MR_LdRaidGet(u_int32_t ld, MR_DRV_RAID_MAP_ALL *map); @@ -657,7 +658,7 @@ mrsas_register_aen(struct mrsas_softc *s dcmd->data_xfer_len = sizeof(struct mrsas_evt_detail); dcmd->opcode = MR_DCMD_CTRL_EVENT_WAIT; dcmd->mbox.w[0] = seq_num; - sc->last_seq_num = seq_num; + sc->last_seq_num = seq_num; dcmd->mbox.w[1] = curr_aen.word; dcmd->sgl.sge32[0].phys_addr = (u_int32_t) sc->evt_detail_phys_addr; dcmd->sgl.sge32[0].length = sizeof(struct mrsas_evt_detail); @@ -775,6 +776,8 @@ static int mrsas_attach(device_t dev) sc->mrsas_cdev = make_dev(&mrsas_cdevsw, device_get_unit(dev), UID_ROOT, GID_OPERATOR, (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP), "mrsas%u", device_get_unit(dev)); + if (device_get_unit(dev) == 0) + make_dev_alias(sc->mrsas_cdev, "megaraid_sas_ioctl_node"); if (sc->mrsas_cdev) sc->mrsas_cdev->si_drv1 = sc; @@ -816,6 +819,17 @@ static int mrsas_attach(device_t dev) goto fail_start_aen; } + /* + * Add this controller to mrsas_mgmt_info structure so that it + * can be exported to management applications + */ + if (device_get_unit(dev) == 0) + memset(&mrsas_mgmt_info, 0, sizeof(mrsas_mgmt_info)); + + mrsas_mgmt_info.count++; + mrsas_mgmt_info.sc_ptr[mrsas_mgmt_info.max_index] = sc; + mrsas_mgmt_info.max_index++; + return (0); fail_start_aen: @@ -858,6 +872,19 @@ static int mrsas_detach(device_t dev) sc = device_get_softc(dev); sc->remove_in_progress = 1; + + /* + * Take the instance off the instance array. Note that we will not + * decrement the max_index. We let this array be sparse array + */ + for (i = 0; i < mrsas_mgmt_info.max_index; i++) { + if (mrsas_mgmt_info.sc_ptr[i] == sc) { + mrsas_mgmt_info.count--; + mrsas_mgmt_info.sc_ptr[i] = NULL; + break; + } + } + if(sc->ocr_thread_active) wakeup(&sc->ocr_chan); while(sc->reset_in_progress){ @@ -1101,8 +1128,19 @@ mrsas_ioctl(struct cdev *dev, u_long cmd struct mrsas_softc *sc; int ret = 0, i = 0; - sc = (struct mrsas_softc *)(dev->si_drv1); - + struct mrsas_iocpacket *user_ioc = (struct mrsas_iocpacket *)arg; + + /* get the Host number & the softc from data sent by the Application */ + sc = mrsas_mgmt_info.sc_ptr[user_ioc->host_no]; + + if ((mrsas_mgmt_info.max_index == user_ioc->host_no) || (sc == NULL)) { + printf ("Please check the controller number\n"); + if (sc == NULL) + printf ("There is NO such Host no. %d\n", user_ioc->host_no); + + return ENOENT; + } + if (sc->remove_in_progress) { mrsas_dprint(sc, MRSAS_INFO, "Driver remove or shutdown called.\n"); @@ -1131,12 +1169,17 @@ mrsas_ioctl(struct cdev *dev, u_long cmd do_ioctl: switch (cmd) { - case MRSAS_IOC_FIRMWARE_PASS_THROUGH: - ret = mrsas_passthru(sc, (void *)arg); + case MRSAS_IOC_FIRMWARE_PASS_THROUGH64: +#ifdef COMPAT_FREEBSD32 + case MRSAS_IOC_FIRMWARE_PASS_THROUGH32: +#endif + ret = mrsas_passthru(sc, (void *)arg, cmd); break; case MRSAS_IOC_SCAN_BUS: ret = mrsas_bus_scan(sc); break; + default: + mrsas_dprint(sc, MRSAS_TRACE, "IOCTL command 0x%lx is not handled\n", cmd); } return (ret); Modified: head/sys/dev/mrsas/mrsas.h ============================================================================== --- head/sys/dev/mrsas/mrsas.h Wed Oct 8 08:51:05 2014 (r272736) +++ head/sys/dev/mrsas/mrsas.h Wed Oct 8 09:19:35 2014 (r272737) @@ -2419,6 +2419,14 @@ struct mrsas_evt_detail { } __packed; +/* Controller management info added to support Linux Emulator */ +#define MAX_MGMT_ADAPTERS 1024 + +struct mrsas_mgmt_info { + u_int16_t count; + struct mrsas_softc *sc_ptr[MAX_MGMT_ADAPTERS]; + int max_index; +}; /******************************************************************* * per-instance data Modified: head/sys/dev/mrsas/mrsas_ioctl.c ============================================================================== --- head/sys/dev/mrsas/mrsas_ioctl.c Wed Oct 8 08:51:05 2014 (r272736) +++ head/sys/dev/mrsas/mrsas_ioctl.c Wed Oct 8 09:19:35 2014 (r272737) @@ -51,11 +51,9 @@ __FBSDID("$FreeBSD$"); * Function prototypes */ int mrsas_alloc_mfi_cmds(struct mrsas_softc *sc); -int mrsas_passthru(struct mrsas_softc *sc, void *arg); +int mrsas_passthru(struct mrsas_softc *sc, void *arg, u_long ioctlCmd); void mrsas_free_ioc_cmd(struct mrsas_softc *sc); void mrsas_free_frame(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd); -void mrsas_dump_dcmd(struct mrsas_softc *sc, struct mrsas_dcmd_frame* dcmd); -void mrsas_dump_ioctl(struct mrsas_softc *sc, struct mrsas_iocpacket *user_ioc); void * mrsas_alloc_frame(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd); static int mrsas_create_frame_pool(struct mrsas_softc *sc); static void mrsas_alloc_cb(void *arg, bus_dma_segment_t *segs, @@ -66,79 +64,6 @@ extern void mrsas_release_mfi_cmd(struct extern int mrsas_issue_blocked_cmd(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd); - -/** - * mrsas_dump_ioctl: Print debug output for DCMDs - * input: Adapter instance soft state - * DCMD frame structure - * - * This function is called from mrsas_passthru() to print out debug information - * in the handling and routing of DCMD commands. - */ -void mrsas_dump_dcmd( struct mrsas_softc *sc, struct mrsas_dcmd_frame* dcmd ) -{ - int i; - - device_printf(sc->mrsas_dev, "dcmd->cmd: 0x%02hhx\n", dcmd->cmd); - device_printf(sc->mrsas_dev, "dcmd->cmd_status: 0x%02hhx\n", dcmd->cmd_status); - device_printf(sc->mrsas_dev, "dcmd->sge_count: 0x%02hhx\n", dcmd->sge_count); - device_printf(sc->mrsas_dev, "dcmd->context: 0x%08x\n", dcmd->context); - device_printf(sc->mrsas_dev, "dcmd->flags: 0x%04hx\n", dcmd->flags); - device_printf(sc->mrsas_dev, "dcmd->timeout: 0x%04hx\n", dcmd->timeout); - device_printf(sc->mrsas_dev, "dcmd->data_xfer_len: 0x%08x\n", dcmd->data_xfer_len); - device_printf(sc->mrsas_dev, "dcmd->opcode: 0x%08x\n", dcmd->opcode); - device_printf(sc->mrsas_dev, "dcmd->mbox.w[0]: 0x%08x\n", dcmd->mbox.w[0]); - device_printf(sc->mrsas_dev, "dcmd->mbox.w[1]: 0x%08x\n", dcmd->mbox.w[1]); - device_printf(sc->mrsas_dev, "dcmd->mbox.w[2]: 0x%08x\n", dcmd->mbox.w[2]); - for (i=0; i< MIN(MAX_IOCTL_SGE, dcmd->sge_count); i++) { - device_printf(sc->mrsas_dev, "sgl[%02d]\n", i); - device_printf(sc->mrsas_dev, " sge32[%02d].phys_addr: 0x%08x\n", - i, dcmd->sgl.sge32[i].phys_addr); - device_printf(sc->mrsas_dev, " sge32[%02d].length: 0x%08x\n", - i, dcmd->sgl.sge32[i].length); - device_printf(sc->mrsas_dev, " sge64[%02d].phys_addr: 0x%08llx\n", - i, (long long unsigned int) dcmd->sgl.sge64[i].phys_addr); - device_printf(sc->mrsas_dev, " sge64[%02d].length: 0x%08x\n", - i, dcmd->sgl.sge64[i].length); - } -} - -/** - * mrsas_dump_ioctl: Print debug output for ioctl - * input: Adapter instance soft state - * iocpacket structure - * - * This function is called from mrsas_passthru() to print out debug information - * in the handling and routing of ioctl commands. - */ -void mrsas_dump_ioctl(struct mrsas_softc *sc, struct mrsas_iocpacket *user_ioc) -{ - union mrsas_frame *in_cmd = (union mrsas_frame *) &(user_ioc->frame.raw); - struct mrsas_dcmd_frame* dcmd = (struct mrsas_dcmd_frame *) &(in_cmd->dcmd); - int i; - - device_printf(sc->mrsas_dev, - "====== In %s() ======================================\n", __func__); - device_printf(sc->mrsas_dev, "host_no: 0x%04hx\n", user_ioc->host_no); - device_printf(sc->mrsas_dev, " __pad1: 0x%04hx\n", user_ioc->__pad1); - device_printf(sc->mrsas_dev, "sgl_off: 0x%08x\n", user_ioc->sgl_off); - device_printf(sc->mrsas_dev, "sge_count: 0x%08x\n", user_ioc->sge_count); - device_printf(sc->mrsas_dev, "sense_off: 0x%08x\n", user_ioc->sense_off); - device_printf(sc->mrsas_dev, "sense_len: 0x%08x\n", user_ioc->sense_len); - - mrsas_dump_dcmd(sc, dcmd); - - for (i=0; i< MIN(MAX_IOCTL_SGE, user_ioc->sge_count); i++) { - device_printf(sc->mrsas_dev, "sge[%02d]\n", i); - device_printf(sc->mrsas_dev, - " iov_base: %p\n", user_ioc->sgl[i].iov_base); - device_printf(sc->mrsas_dev, " iov_len: %p\n", - (void*)user_ioc->sgl[i].iov_len); - } - device_printf(sc->mrsas_dev, - "==================================================================\n"); -} - /** * mrsas_passthru: Handle pass-through commands * input: Adapter instance soft state @@ -147,9 +72,12 @@ void mrsas_dump_ioctl(struct mrsas_softc * This function is called from mrsas_ioctl() to handle pass-through and * ioctl commands to Firmware. */ -int mrsas_passthru( struct mrsas_softc *sc, void *arg ) +int mrsas_passthru( struct mrsas_softc *sc, void *arg, u_long ioctlCmd ) { struct mrsas_iocpacket *user_ioc = (struct mrsas_iocpacket *)arg; +#ifdef COMPAT_FREEBSD32 + struct mrsas_iocpacket32 *user_ioc32 = (struct mrsas_iocpacket32 *)arg; +#endif union mrsas_frame *in_cmd = (union mrsas_frame *) &(user_ioc->frame.raw); struct mrsas_mfi_cmd *cmd = NULL; bus_dma_tag_t ioctl_data_tag[MAX_IOCTL_SGE]; @@ -160,12 +88,11 @@ int mrsas_passthru( struct mrsas_softc * bus_dmamap_t ioctl_sense_dmamap = 0; void *ioctl_sense_mem = 0; bus_addr_t ioctl_sense_phys_addr = 0; - int i, adapter, ioctl_data_size, ioctl_sense_size, ret=0; + int i, ioctl_data_size=0, ioctl_sense_size, ret=0; struct mrsas_sge32 *kern_sge32; unsigned long *sense_ptr; - - /* For debug - uncomment the following line for debug output */ - //mrsas_dump_ioctl(sc, user_ioc); + uint8_t *iov_base_ptrin=NULL; + size_t iov_len=0; /* * Check for NOP from MegaCli... MegaCli can issue a DCMD of 0. In this @@ -177,13 +104,6 @@ int mrsas_passthru( struct mrsas_softc * return (0); } - /* Validate host_no */ - adapter = user_ioc->host_no; - if (adapter != device_get_unit(sc->mrsas_dev)) { - device_printf(sc->mrsas_dev, "In %s() IOCTL not for me!\n", __func__); - return(ENOENT); - } - /* Validate SGL length */ if (user_ioc->sge_count > MAX_IOCTL_SGE) { device_printf(sc->mrsas_dev, "In %s() SGL is too long (%d > 8).\n", @@ -225,9 +145,17 @@ int mrsas_passthru( struct mrsas_softc * * For each user buffer, create a mirror buffer and copy in */ for (i=0; i < user_ioc->sge_count; i++) { - if (!user_ioc->sgl[i].iov_len) - continue; - ioctl_data_size = user_ioc->sgl[i].iov_len; + if (ioctlCmd == MRSAS_IOC_FIRMWARE_PASS_THROUGH64) { + if (!user_ioc->sgl[i].iov_len) + continue; + ioctl_data_size = user_ioc->sgl[i].iov_len; +#ifdef COMPAT_FREEBSD32 + } else { + if (!user_ioc32->sgl[i].iov_len) + continue; + ioctl_data_size = user_ioc32->sgl[i].iov_len; +#endif + } if (bus_dma_tag_create( sc->mrsas_parent_tag, // parent 1, 0, // algnmnt, boundary BUS_SPACE_MAXADDR_32BIT,// lowaddr @@ -239,8 +167,8 @@ int mrsas_passthru( struct mrsas_softc * BUS_DMA_ALLOCNOW, // flags NULL, NULL, // lockfunc, lockarg &ioctl_data_tag[i])) { - device_printf(sc->mrsas_dev, "Cannot allocate ioctl data tag\n"); - return (ENOMEM); + device_printf(sc->mrsas_dev, "Cannot allocate ioctl data tag\n"); + return (ENOMEM); } if (bus_dmamem_alloc(ioctl_data_tag[i], (void **)&ioctl_data_mem[i], (BUS_DMA_NOWAIT | BUS_DMA_ZERO), &ioctl_data_dmamap[i])) { @@ -256,18 +184,31 @@ int mrsas_passthru( struct mrsas_softc * /* Save the physical address and length */ kern_sge32[i].phys_addr = (u_int32_t)ioctl_data_phys_addr[i]; - kern_sge32[i].length = user_ioc->sgl[i].iov_len; + + if (ioctlCmd == MRSAS_IOC_FIRMWARE_PASS_THROUGH64) { + kern_sge32[i].length = user_ioc->sgl[i].iov_len; + + iov_base_ptrin = user_ioc->sgl[i].iov_base; + iov_len = user_ioc->sgl[i].iov_len; +#ifdef COMPAT_FREEBSD32 + } else { + kern_sge32[i].length = user_ioc32->sgl[i].iov_len; + + iov_base_ptrin = PTRIN(user_ioc32->sgl[i].iov_base); + iov_len = user_ioc32->sgl[i].iov_len; +#endif + } /* Copy in data from user space */ - ret = copyin(user_ioc->sgl[i].iov_base, ioctl_data_mem[i], - user_ioc->sgl[i].iov_len); + ret = copyin(iov_base_ptrin, ioctl_data_mem[i], iov_len); if (ret) { - device_printf(sc->mrsas_dev, "IOCTL copyin failed!\n"); - goto out; + device_printf(sc->mrsas_dev, "IOCTL copyin failed!\n"); + goto out; } } ioctl_sense_size = user_ioc->sense_len; + if (user_ioc->sense_len) { if (bus_dma_tag_create( sc->mrsas_parent_tag, // parent 1, 0, // algnmnt, boundary @@ -311,8 +252,17 @@ int mrsas_passthru( struct mrsas_softc * * copy out the kernel buffers to user buffers */ for (i = 0; i < user_ioc->sge_count; i++) { - ret = copyout(ioctl_data_mem[i], user_ioc->sgl[i].iov_base, - user_ioc->sgl[i].iov_len); + if (ioctlCmd == MRSAS_IOC_FIRMWARE_PASS_THROUGH64) { + iov_base_ptrin = user_ioc->sgl[i].iov_base; + iov_len = user_ioc->sgl[i].iov_len; +#ifdef COMPAT_FREEBSD32 + } else { + iov_base_ptrin = PTRIN(user_ioc32->sgl[i].iov_base); + iov_len = user_ioc32->sgl[i].iov_len; +#endif + } + + ret = copyout(ioctl_data_mem[i], iov_base_ptrin, iov_len); if (ret) { device_printf(sc->mrsas_dev, "IOCTL copyout failed!\n"); goto out; @@ -368,7 +318,6 @@ out: if (ioctl_data_tag[i] != NULL) bus_dma_tag_destroy(ioctl_data_tag[i]); } - /* Free command */ mrsas_release_mfi_cmd(cmd); Modified: head/sys/dev/mrsas/mrsas_ioctl.h ============================================================================== --- head/sys/dev/mrsas/mrsas_ioctl.h Wed Oct 8 08:51:05 2014 (r272736) +++ head/sys/dev/mrsas/mrsas_ioctl.h Wed Oct 8 09:19:35 2014 (r272737) @@ -51,6 +51,15 @@ __FBSDID("$FreeBSD$"); #include #endif /* !_IOWR */ +#ifdef COMPAT_FREEBSD32 +/* Compilation error FIX */ +#if (__FreeBSD_version <= 900000) +#include +#endif +#include +#include +#endif + /* * We need to use the same values as the mfi driver until MegaCli adds * support for this (mrsas) driver: @@ -61,10 +70,15 @@ __FBSDID("$FreeBSD$"); * These three values are encoded into a somewhat unique, 32-bit value. */ -#define MRSAS_IOC_FIRMWARE_PASS_THROUGH _IOWR('M', 1, struct mrsas_iocpacket) +#define MRSAS_IOC_FIRMWARE_PASS_THROUGH64 _IOWR('M', 1, struct mrsas_iocpacket) +#ifdef COMPAT_FREEBSD32 +#define MRSAS_IOC_FIRMWARE_PASS_THROUGH32 _IOWR('M', 1, struct mrsas_iocpacket32) +#endif #define MRSAS_IOC_SCAN_BUS _IO('M', 10) +#define MRSAS_LINUX_CMD32 0xc1144d01 + #define MAX_IOCTL_SGE 16 #define MFI_FRAME_DIR_READ 0x0010 #define MFI_CMD_LD_SCSI_IO 0x03 @@ -94,4 +108,22 @@ struct mrsas_iocpacket { }; #pragma pack() +#ifdef COMPAT_FREEBSD32 +#pragma pack(1) +struct mrsas_iocpacket32 { + u_int16_t host_no; + u_int16_t __pad1; + u_int32_t sgl_off; + u_int32_t sge_count; + u_int32_t sense_off; + u_int32_t sense_len; + union { + u_int8_t raw[MEGAMFI_RAW_FRAME_SIZE]; + struct mrsas_header hdr; + } frame; + struct iovec32 sgl[MAX_IOCTL_SGE]; +}; +#pragma pack() +#endif /* COMPAT_FREEBSD32 */ + #endif /* MRSAS_IOCTL_H */ Added: head/sys/dev/mrsas/mrsas_linux.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mrsas/mrsas_linux.c Wed Oct 8 09:19:35 2014 (r272737) @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2014, LSI Corp. + * All rights reserved. + * Author: Kashyap Desai, Sibananda Sahu + * Support: freebsdraid@lsi.com + * + * 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. + * 3. Neither the name of the nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDER 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. + * + * The views and conclusions contained in the software and documentation + * are those of the authors and should not be interpreted as representing + * official policies,either expressed or implied, of the FreeBSD Project. + * + * Send feedback to: + * Mail to: LSI Corporation, 1621 Barber Lane, Milpitas, CA 95035 + * ATTN: MegaRaid FreeBSD + * + */ + +#include + + +#include +#include + +#if (__FreeBSD_version > 900000) +#include +#endif + +#include +#include +#include +#include +#include +#include + +#if defined(__amd64__) /* Assume amd64 wants 32 bit Linux */ +#include +#include +#else +#include +#include +#endif +#include +#include + +#include +#include + +/* There are multiple ioctl number ranges that need to be handled */ +#define MRSAS_LINUX_IOCTL_MIN 0x4d00 +#define MRSAS_LINUX_IOCTL_MAX 0x4d01 + +static linux_ioctl_function_t mrsas_linux_ioctl; +static struct linux_ioctl_handler mrsas_linux_handler = {mrsas_linux_ioctl, + MRSAS_LINUX_IOCTL_MIN, + MRSAS_LINUX_IOCTL_MAX}; + +SYSINIT (mrsas_register, SI_SUB_KLD, SI_ORDER_MIDDLE, + linux_ioctl_register_handler, &mrsas_linux_handler); +SYSUNINIT(mrsas_unregister, SI_SUB_KLD, SI_ORDER_MIDDLE, + linux_ioctl_unregister_handler, &mrsas_linux_handler); + +static struct linux_device_handler mrsas_device_handler = + { "mrsas", "megaraid_sas", "mrsas0", "megaraid_sas_ioctl_node", -1, 0, 1}; + +SYSINIT (mrsas_register2, SI_SUB_KLD, SI_ORDER_MIDDLE, + linux_device_register_handler, &mrsas_device_handler); +SYSUNINIT(mrsas_unregister2, SI_SUB_KLD, SI_ORDER_MIDDLE, + linux_device_unregister_handler, &mrsas_device_handler); + +static int +mrsas_linux_modevent(module_t mod __unused, int cmd __unused, void *data __unused) +{ + return (0); +} + +static int +mrsas_linux_ioctl(struct thread *p, struct linux_ioctl_args *args) +{ + #if (__FreeBSD_version >= 1000000) + cap_rights_t rights; + #endif + struct file *fp; + int error; + u_long cmd = args->cmd; + + if (cmd != MRSAS_LINUX_CMD32){ + error = ENOTSUP; + goto END; + } + + #if (__FreeBSD_version >= 1000000) + error = fget(p, args->fd, cap_rights_init(&rights, CAP_IOCTL), &fp); + #elif (__FreeBSD_version <= 900000) + error = fget(p, args->fd, &fp); + #else /* For FreeBSD version greater than 9.0.0 but less than 10.0.0 */ + error = fget(p, args->fd, CAP_IOCTL, &fp); + #endif + if (error != 0) + goto END; + + error = fo_ioctl(fp, cmd, (caddr_t)args->arg, p->td_ucred, p); + fdrop(fp, p); +END: + return (error); +} + +DEV_MODULE(mrsas_linux, mrsas_linux_modevent, NULL); +MODULE_DEPEND(mrsas, linux, 1, 1, 1); Modified: head/sys/modules/mrsas/Makefile ============================================================================== --- head/sys/modules/mrsas/Makefile Wed Oct 8 08:51:05 2014 (r272736) +++ head/sys/modules/mrsas/Makefile Wed Oct 8 09:19:35 2014 (r272737) @@ -1,14 +1,24 @@ -# $FreeBSD$ +# Makefile for mrsas driver + -.PATH: ${.CURDIR}/../../dev/mrsas +KMOD=mrsas +.PATH: ${.CURDIR}/../../dev/${KMOD} -KMOD= mrsas -SRCS= mrsas.c mrsas_cam.c mrsas_ioctl.c mrsas_fp.c -SRCS+= device_if.h bus_if.h pci_if.h opt_cam.h opt_scsi.h +.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" +SUBDIR+= mrsas_linux +.endif + +SRCS=mrsas.c mrsas_cam.c mrsas_ioctl.c mrsas_fp.c +SRCS+= device_if.h bus_if.h pci_if.h opt_cam.h opt_scsi.h #CFLAGS+= -MRSAS_DEBUG .include -#CFLAGS+= -fgnu89-inline +CFLAGS+= -fgnu89-inline + +TARGET_ARCH = ${MACHINE_ARCH} +.if ${TARGET_ARCH} == "amd64" +CFLAGS+= -DCOMPAT_FREEBSD32 -D_STANDALONE +.endif clean_cscope: rm -f cscope* Added: head/sys/modules/mrsas/mrsas_linux/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/mrsas/mrsas_linux/Makefile Wed Oct 8 09:19:35 2014 (r272737) @@ -0,0 +1,10 @@ +# Makefile for mrsas driver + + +.PATH: ${.CURDIR}/../../../dev/mrsas + +KMOD= mrsas_linux +SRCS= mrsas_linux.c +SRCS+= device_if.h bus_if.h pci_if.h + +.include From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 09:30:37 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 284421C0; Wed, 8 Oct 2014 09:30:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 140DB1FD; Wed, 8 Oct 2014 09:30:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s989Uaee073964; Wed, 8 Oct 2014 09:30:36 GMT (envelope-from kadesai@FreeBSD.org) Received: (from kadesai@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s989Uat9073960; Wed, 8 Oct 2014 09:30:36 GMT (envelope-from kadesai@FreeBSD.org) Message-Id: <201410080930.s989Uat9073960@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kadesai set sender to kadesai@FreeBSD.org using -f From: Kashyap D Desai Date: Wed, 8 Oct 2014 09:30:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272738 - in head/sys: dev/mrsas modules/mrsas modules/mrsas/mrsas_linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 09:30:37 -0000 Author: kadesai Date: Wed Oct 8 09:30:35 2014 New Revision: 272738 URL: https://svnweb.freebsd.org/changeset/base/272738 Log: Fix the minor svn add issue. $FreeBSD$ expands at the time of snv add, so I have added $FreeBSD$ as comment. This commit is contininous of last mrsas commit, so that compilation does not break. Obtained from: AVAGO Technologies MFC after: 2 weeks Modified: head/sys/dev/mrsas/mrsas_linux.c head/sys/modules/mrsas/Makefile head/sys/modules/mrsas/mrsas_linux/Makefile Modified: head/sys/dev/mrsas/mrsas_linux.c ============================================================================== --- head/sys/dev/mrsas/mrsas_linux.c Wed Oct 8 09:19:35 2014 (r272737) +++ head/sys/dev/mrsas/mrsas_linux.c Wed Oct 8 09:30:35 2014 (r272738) @@ -39,10 +39,10 @@ * Mail to: LSI Corporation, 1621 Barber Lane, Milpitas, CA 95035 * ATTN: MegaRaid FreeBSD * + * $FreeBSD$ */ #include - #include #include Modified: head/sys/modules/mrsas/Makefile ============================================================================== --- head/sys/modules/mrsas/Makefile Wed Oct 8 09:19:35 2014 (r272737) +++ head/sys/modules/mrsas/Makefile Wed Oct 8 09:30:35 2014 (r272738) @@ -1,5 +1,5 @@ # Makefile for mrsas driver - +# $FreeBSD$ KMOD=mrsas .PATH: ${.CURDIR}/../../dev/${KMOD} Modified: head/sys/modules/mrsas/mrsas_linux/Makefile ============================================================================== --- head/sys/modules/mrsas/mrsas_linux/Makefile Wed Oct 8 09:19:35 2014 (r272737) +++ head/sys/modules/mrsas/mrsas_linux/Makefile Wed Oct 8 09:30:35 2014 (r272738) @@ -1,5 +1,5 @@ # Makefile for mrsas driver - +# $FreeBSD$ .PATH: ${.CURDIR}/../../../dev/mrsas From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 09:34:27 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 428C9382; Wed, 8 Oct 2014 09:34:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2E3A82DF; Wed, 8 Oct 2014 09:34:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s989YRaO077231; Wed, 8 Oct 2014 09:34:27 GMT (envelope-from kadesai@FreeBSD.org) Received: (from kadesai@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s989YQqV077228; Wed, 8 Oct 2014 09:34:26 GMT (envelope-from kadesai@FreeBSD.org) Message-Id: <201410080934.s989YQqV077228@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kadesai set sender to kadesai@FreeBSD.org using -f From: Kashyap D Desai Date: Wed, 8 Oct 2014 09:34:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272739 - head/sys/dev/mrsas X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 09:34:27 -0000 Author: kadesai Date: Wed Oct 8 09:34:25 2014 New Revision: 272739 URL: https://svnweb.freebsd.org/changeset/base/272739 Log: Extended MSI-x vectors support for Invader and Fury(12Gb/s HBA). This Driver will create multiple MSI-x vector depending upon what FW expose. As of now 12 Gbp/s MR controller (Invader and Fury) expose 96 msix vector. As of now 6 Gbp/s MR controller (Thunderbolt) expose 16 msix vector. Reviewed by: ambrisko MFC after: 2 weeks Sponsored by: AVAGO Technologies Modified: head/sys/dev/mrsas/mrsas.c head/sys/dev/mrsas/mrsas.h head/sys/dev/mrsas/mrsas_cam.c Modified: head/sys/dev/mrsas/mrsas.c ============================================================================== --- head/sys/dev/mrsas/mrsas.c Wed Oct 8 09:30:35 2014 (r272738) +++ head/sys/dev/mrsas/mrsas.c Wed Oct 8 09:34:25 2014 (r272739) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include /* @@ -67,6 +68,8 @@ static d_ioctl_t mrsas_ioctl; static struct mrsas_mgmt_info mrsas_mgmt_info; static struct mrsas_ident *mrsas_find_ident(device_t); +static int mrsas_setup_msix(struct mrsas_softc *sc); +static int mrsas_allocate_msix(struct mrsas_softc *sc); static void mrsas_shutdown_ctlr(struct mrsas_softc *sc, u_int32_t opcode); static void mrsas_flush_cache(struct mrsas_softc *sc); static void mrsas_reset_reply_desc(struct mrsas_softc *sc); @@ -80,7 +83,7 @@ static int mrsas_setup_irq(struct mrsas_ static int mrsas_alloc_mem(struct mrsas_softc *sc); static int mrsas_init_fw(struct mrsas_softc *sc); static int mrsas_setup_raidmap(struct mrsas_softc *sc); -static int mrsas_complete_cmd(struct mrsas_softc *sc); +static int mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex); static int mrsas_clear_intr(struct mrsas_softc *sc); static int mrsas_get_ctrl_info(struct mrsas_softc *sc, struct mrsas_ctrl_info *ctrl_info); @@ -151,7 +154,6 @@ static int mrsas_alloc_evt_log_info_cmd( static void mrsas_free_evt_log_info_cmd(struct mrsas_softc *sc); SYSCTL_NODE(_hw, OID_AUTO, mrsas, CTLFLAG_RD, 0, "MRSAS Driver Parameters"); - /** * PCI device struct and table * @@ -709,9 +711,64 @@ static int mrsas_start_aen(struct mrsas_ return mrsas_register_aen(sc, eli.newest_seq_num + 1, class_locale.word); + } /** + * mrsas_setup_msix: Allocate MSI-x vectors + * @sc: Adapter soft state + */ +static int mrsas_setup_msix(struct mrsas_softc *sc) +{ + int i; + for (i = 0; i < sc->msix_vectors; i++) { + sc->irq_context[i].sc = sc; + sc->irq_context[i].MSIxIndex = i; + sc->irq_id[i] = i + 1; + sc->mrsas_irq[i] = bus_alloc_resource_any + (sc->mrsas_dev, SYS_RES_IRQ, &sc->irq_id[i] + , RF_ACTIVE); + if (sc->mrsas_irq[i] == NULL) { + device_printf(sc->mrsas_dev, "Can't allocate MSI-x\n"); + goto irq_alloc_failed; + } + if (bus_setup_intr(sc->mrsas_dev, + sc->mrsas_irq[i], + INTR_MPSAFE|INTR_TYPE_CAM, + NULL, mrsas_isr, &sc->irq_context[i], + &sc->intr_handle[i])) { + device_printf(sc->mrsas_dev, + "Cannot set up MSI-x interrupt handler\n"); + goto irq_alloc_failed; + } + } + return SUCCESS; + +irq_alloc_failed: + mrsas_teardown_intr(sc); + return (FAIL); +} + +/** + * mrsas_allocate_msix: Setup MSI-x vectors + * @sc: Adapter soft state + */ +static int mrsas_allocate_msix(struct mrsas_softc *sc) +{ + if (pci_alloc_msix(sc->mrsas_dev, &sc->msix_vectors) == 0) { + device_printf(sc->mrsas_dev, "Using MSI-X with %d number" + " of vectors\n", sc->msix_vectors); + } else { + device_printf(sc->mrsas_dev, "MSI-x setup failed\n"); + goto irq_alloc_failed; + } + return SUCCESS; + +irq_alloc_failed: + mrsas_teardown_intr(sc); + return (FAIL); +} +/** * mrsas_attach: PCI entry point * input: device struct pointer * @@ -784,6 +841,8 @@ static int mrsas_attach(device_t dev) sc->adprecovery = MRSAS_HBA_OPERATIONAL; sc->UnevenSpanSupport = 0; + sc->msix_enable = 0; + /* Initialize Firmware */ if (mrsas_init_fw(sc) != SUCCESS) { goto attach_fail_fw; @@ -794,6 +853,7 @@ static int mrsas_attach(device_t dev) goto attach_fail_cam; } + /* Register IRQs */ if (mrsas_setup_irq(sc) != SUCCESS) { goto attach_fail_irq; @@ -838,7 +898,9 @@ attach_fail_irq: attach_fail_cam: mrsas_cam_detach(sc); attach_fail_fw: -//attach_fail_raidmap: + /* if MSIX vector is allocated and FW Init FAILED then release MSIX */ + if (sc->msix_enable == 1) + pci_release_msi(sc->mrsas_dev); mrsas_free_mem(sc); mtx_destroy(&sc->sim_lock); mtx_destroy(&sc->aen_lock); @@ -1081,11 +1143,28 @@ void mrsas_free_mem(struct mrsas_softc * */ void mrsas_teardown_intr(struct mrsas_softc *sc) { - if (sc->intr_handle) - bus_teardown_intr(sc->mrsas_dev, sc->mrsas_irq, sc->intr_handle); - if (sc->mrsas_irq != NULL) - bus_release_resource(sc->mrsas_dev, SYS_RES_IRQ, sc->irq_id, sc->mrsas_irq); - sc->intr_handle = NULL; + int i; + if (!sc->msix_enable) { + if (sc->intr_handle[0]) + bus_teardown_intr(sc->mrsas_dev, sc->mrsas_irq[0], sc->intr_handle[0]); + if (sc->mrsas_irq[0] != NULL) + bus_release_resource(sc->mrsas_dev, SYS_RES_IRQ, sc->irq_id[0], sc->mrsas_irq[0]); + sc->intr_handle[0] = NULL; + } else { + for (i = 0; i < sc->msix_vectors; i++) { + if (sc->intr_handle[i]) + bus_teardown_intr(sc->mrsas_dev, sc->mrsas_irq[i], + sc->intr_handle[i]); + + if (sc->mrsas_irq[i] != NULL) + bus_release_resource(sc->mrsas_dev, SYS_RES_IRQ, + sc->irq_id[i], sc->mrsas_irq[i]); + + sc->intr_handle[i] = NULL; + } + pci_release_msi(sc->mrsas_dev); + } + } /** @@ -1195,19 +1274,29 @@ do_ioctl: */ static int mrsas_setup_irq(struct mrsas_softc *sc) { - sc->irq_id = 0; - sc->mrsas_irq = bus_alloc_resource_any(sc->mrsas_dev, SYS_RES_IRQ, - &sc->irq_id, RF_SHAREABLE | RF_ACTIVE); - if (sc->mrsas_irq == NULL){ - device_printf(sc->mrsas_dev, "Cannot allocate interrupt\n"); - return (FAIL); - } - if (bus_setup_intr(sc->mrsas_dev, sc->mrsas_irq, INTR_MPSAFE|INTR_TYPE_CAM, - NULL, mrsas_isr, sc, &sc->intr_handle)) { - device_printf(sc->mrsas_dev, "Cannot set up interrupt\n"); - return (FAIL); - } + if (sc->msix_enable && (mrsas_setup_msix(sc) == SUCCESS)) + device_printf(sc->mrsas_dev, "MSI-x interrupts setup success\n"); + else { + device_printf(sc->mrsas_dev, "Fall back to legacy interrupt\n"); + sc->irq_context[0].sc = sc; + sc->irq_context[0].MSIxIndex = 0; + sc->irq_id[0] = 0; + sc->mrsas_irq[0] = bus_alloc_resource_any(sc->mrsas_dev, + SYS_RES_IRQ, &sc->irq_id[0], RF_SHAREABLE | RF_ACTIVE); + if (sc->mrsas_irq[0] == NULL){ + device_printf(sc->mrsas_dev, "Cannot allocate legcay" + "interrupt\n"); + return (FAIL); + } + if (bus_setup_intr(sc->mrsas_dev, sc->mrsas_irq[0], + INTR_MPSAFE|INTR_TYPE_CAM, NULL, mrsas_isr, + &sc->irq_context[0], &sc->intr_handle[0])) { + device_printf(sc->mrsas_dev, "Cannot set up legacy" + "interrupt\n"); + return (FAIL); + } + } return (0); } @@ -1221,16 +1310,16 @@ static int mrsas_setup_irq(struct mrsas_ */ void mrsas_isr(void *arg) { - struct mrsas_softc *sc = (struct mrsas_softc *)arg; - int status; - - /* Clear FW state change interrupt */ - status = mrsas_clear_intr(sc); + struct mrsas_irq_context *irq_context = (struct mrsas_irq_context *)arg; + struct mrsas_softc *sc = irq_context->sc; + int status = 0; + + if (!sc->msix_vectors) { + status = mrsas_clear_intr(sc); + if (!status) + return; + } - /* Not our interrupt */ - if (!status) - return; - /* If we are resetting, bail */ if (test_bit(MRSAS_FUSION_IN_RESET, &sc->reset_flags)) { printf(" Entered into ISR when OCR is going active. \n"); @@ -1238,7 +1327,7 @@ void mrsas_isr(void *arg) return; } /* Process for reply request and clear response interrupt */ - if (mrsas_complete_cmd(sc) != SUCCESS) + if (mrsas_complete_cmd(sc, irq_context->MSIxIndex) != SUCCESS) mrsas_clear_intr(sc); return; @@ -1255,7 +1344,7 @@ void mrsas_isr(void *arg) * the command type and perform the appropriate action. Before we * return, we clear the response interrupt. */ -static int mrsas_complete_cmd(struct mrsas_softc *sc) +static int mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex) { Mpi2ReplyDescriptorsUnion_t *desc; MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR *reply_desc; @@ -1276,7 +1365,9 @@ static int mrsas_complete_cmd(struct mrs return (DONE); desc = sc->reply_desc_mem; - desc += sc->last_reply_idx; + //desc += sc->last_reply_idx[0]; + desc += ((MSIxIndex * sc->reply_alloc_sz)/sizeof(MPI2_REPLY_DESCRIPTORS_UNION)) + + sc->last_reply_idx[MSIxIndex]; reply_desc = (MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR *)desc; @@ -1321,18 +1412,19 @@ static int mrsas_complete_cmd(struct mrs break; } - sc->last_reply_idx++; - if (sc->last_reply_idx >= sc->reply_q_depth) - sc->last_reply_idx = 0; + sc->last_reply_idx[MSIxIndex]++; + if (sc->last_reply_idx[MSIxIndex] >= sc->reply_q_depth) + sc->last_reply_idx[MSIxIndex] = 0; desc->Words = ~((uint64_t)0x00); /* set it back to all 0xFFFFFFFFs */ num_completed++; threshold_reply_count++; /* Get the next reply descriptor */ - if (!sc->last_reply_idx) + if (!sc->last_reply_idx[MSIxIndex]){ desc = sc->reply_desc_mem; - else + desc += ((MSIxIndex * sc->reply_alloc_sz)/sizeof(MPI2_REPLY_DESCRIPTORS_UNION)); + } else desc++; reply_desc = (MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR *)desc; @@ -1349,18 +1441,40 @@ static int mrsas_complete_cmd(struct mrs * completed. */ if (threshold_reply_count >= THRESHOLD_REPLY_COUNT) { - mrsas_write_reg(sc, offsetof(mrsas_reg_set, reply_post_host_index), - sc->last_reply_idx); - threshold_reply_count = 0; + if (sc->msix_enable) { + if ((sc->device_id == MRSAS_INVADER) || + (sc->device_id == MRSAS_FURY)) + mrsas_write_reg(sc, sc->msix_reg_offset[MSIxIndex/8], + ((MSIxIndex & 0x7) << 24) | + sc->last_reply_idx[MSIxIndex]); + else + mrsas_write_reg(sc, sc->msix_reg_offset[0], (MSIxIndex << 24) | + sc->last_reply_idx[MSIxIndex]); + } else + mrsas_write_reg(sc, offsetof(mrsas_reg_set, + reply_post_host_index),sc->last_reply_idx[0]); + + threshold_reply_count = 0; + } } - } /* No match, just return */ if (num_completed == 0) return (DONE); /* Clear response interrupt */ - mrsas_write_reg(sc, offsetof(mrsas_reg_set, reply_post_host_index),sc->last_reply_idx); + if (sc->msix_enable) { + if ((sc->device_id == MRSAS_INVADER) || + (sc->device_id == MRSAS_FURY)){ + mrsas_write_reg(sc, sc->msix_reg_offset[MSIxIndex/8], + ((MSIxIndex & 0x7) << 24) | + sc->last_reply_idx[MSIxIndex]); + } else + mrsas_write_reg(sc, sc->msix_reg_offset[0], (MSIxIndex << 24) | + sc->last_reply_idx[MSIxIndex]); + } else + mrsas_write_reg(sc, offsetof(mrsas_reg_set, + reply_post_host_index),sc->last_reply_idx[0]); return(0); } @@ -1423,7 +1537,7 @@ void mrsas_map_mpt_cmd_status(struct mrs static int mrsas_alloc_mem(struct mrsas_softc *sc) { u_int32_t verbuf_size, io_req_size, reply_desc_size, sense_size, - chain_frame_size, evt_detail_size; + chain_frame_size, evt_detail_size, count; /* * Allocate parent DMA tag @@ -1537,10 +1651,11 @@ static int mrsas_alloc_mem(struct mrsas_ return (ENOMEM); } + count = sc->msix_vectors > 0 ? sc->msix_vectors : 1; /* * Allocate Reply Descriptor Array */ - reply_desc_size = sc->reply_alloc_sz; + reply_desc_size = sc->reply_alloc_sz * count; if (bus_dma_tag_create( sc->mrsas_parent_tag, // parent 16, 0, // algnmnt, boundary BUS_SPACE_MAXADDR_32BIT,// lowaddr @@ -1796,13 +1911,15 @@ ABORT: */ static int mrsas_init_fw(struct mrsas_softc *sc) { + + int ret, loop, ocr = 0; u_int32_t max_sectors_1; u_int32_t max_sectors_2; u_int32_t tmp_sectors; struct mrsas_ctrl_info *ctrl_info; - - int ret, ocr = 0; - + u_int32_t scratch_pad_2; + int msix_enable = 0; + int fw_msix_count = 0; /* Make sure Firmware is ready */ ret = mrsas_transition_to_ready(sc, ocr); @@ -1810,7 +1927,57 @@ static int mrsas_init_fw(struct mrsas_so return(ret); } - /* Get operational params, sge flags, send init cmd to ctlr */ + + /* MSI-x index 0- reply post host index register */ + sc->msix_reg_offset[0] = MPI2_REPLY_POST_HOST_INDEX_OFFSET; + /* Check if MSI-X is supported while in ready state */ + msix_enable = (mrsas_read_reg(sc, offsetof(mrsas_reg_set, outbound_scratch_pad)) & 0x4000000) >> 0x1a; + + if (msix_enable) { + scratch_pad_2 = mrsas_read_reg(sc, offsetof(mrsas_reg_set, + outbound_scratch_pad_2)); + + /* Check max MSI-X vectors */ + if (sc->device_id == MRSAS_TBOLT) { + sc->msix_vectors = (scratch_pad_2 + & MR_MAX_REPLY_QUEUES_OFFSET) + 1; + fw_msix_count = sc->msix_vectors; + } else { + /* Invader/Fury supports 96 MSI-X vectors */ + sc->msix_vectors = ((scratch_pad_2 + & MR_MAX_REPLY_QUEUES_EXT_OFFSET) + >> MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT) + 1; + fw_msix_count = sc->msix_vectors; + + /* Save 1-15 reply post index address to local + * memory + * Index 0 is already saved from reg offset + * MPI2_REPLY_POST_HOST_INDEX_OFFSET + */ + for (loop = 1; loop < MR_MAX_MSIX_REG_ARRAY; + loop++) { + sc->msix_reg_offset[loop] = + MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET + + (loop * 0x10); + } + } + + /* Don't bother allocating more MSI-X vectors than cpus */ + sc->msix_vectors = min(sc->msix_vectors, + mp_ncpus); + + /* Allocate MSI-x vectors */ + if (mrsas_allocate_msix(sc) == SUCCESS) + sc->msix_enable = 1; + else + sc->msix_enable = 0; + + device_printf(sc->mrsas_dev, "FW supports <%d> MSIX vector," + "Online CPU %d Current MSIX <%d>\n", + fw_msix_count, mp_ncpus, sc->msix_vectors); + } + + /* Get operational params, sge flags, send init cmd to ctlr */ if (mrsas_init_adapter(sc) != SUCCESS){ device_printf(sc->mrsas_dev, "Adapter initialize Fail.\n"); return(1); @@ -1907,6 +2074,7 @@ int mrsas_init_adapter(struct mrsas_soft uint32_t status; u_int32_t max_cmd; int ret; + int i = 0; /* Read FW status register */ status = mrsas_read_reg(sc, offsetof(mrsas_reg_set, outbound_scratch_pad)); @@ -1919,7 +2087,7 @@ int mrsas_init_adapter(struct mrsas_soft max_cmd = sc->max_fw_cmds; /* Determine allocation size of command frames */ - sc->reply_q_depth = ((max_cmd *2 +1 +15)/16*16); + sc->reply_q_depth = ((max_cmd +1 +15)/16*16); sc->request_alloc_sz = sizeof(MRSAS_REQUEST_DESCRIPTOR_UNION) * max_cmd; sc->reply_alloc_sz = sizeof(MPI2_REPLY_DESCRIPTORS_UNION) * (sc->reply_q_depth); sc->io_frames_alloc_sz = MRSAS_MPI2_RAID_DEFAULT_IO_FRAME_SIZE + (MRSAS_MPI2_RAID_DEFAULT_IO_FRAME_SIZE * (max_cmd + 1)); @@ -1936,7 +2104,9 @@ int mrsas_init_adapter(struct mrsas_soft sc->chain_offset_io_request = (MRSAS_MPI2_RAID_DEFAULT_IO_FRAME_SIZE - sizeof(MPI2_SGE_IO_UNION))/16; - sc->last_reply_idx = 0; + int count = sc->msix_vectors > 0 ? sc->msix_vectors : 1; + for (i = 0 ; i < count; i++) + sc->last_reply_idx[i] = 0; ret = mrsas_alloc_mem(sc); if (ret != SUCCESS) @@ -1949,6 +2119,7 @@ int mrsas_init_adapter(struct mrsas_soft ret = mrsas_ioc_init(sc); if (ret != SUCCESS) return(ret); + return(0); @@ -2042,12 +2213,21 @@ int mrsas_ioc_init(struct mrsas_softc *s IOCInitMsg->ReplyDescriptorPostQueueDepth = sc->reply_q_depth; IOCInitMsg->ReplyDescriptorPostQueueAddress = sc->reply_desc_phys_addr; IOCInitMsg->SystemRequestFrameBaseAddress = sc->io_request_phys_addr; + IOCInitMsg->HostMSIxVectors = (sc->msix_vectors > 0 ? sc->msix_vectors : 0); init_frame = (struct mrsas_init_frame *)sc->ioc_init_mem; init_frame->cmd = MFI_CMD_INIT; init_frame->cmd_status = 0xFF; init_frame->flags |= MFI_FRAME_DONT_POST_IN_REPLY_QUEUE; + /* driver support Extended MSIX */ + if ((sc->device_id == MRSAS_INVADER) || + (sc->device_id == MRSAS_FURY)) { + init_frame->driver_operations. + mfi_capabilities.support_additional_msix = 1; + } + + if (sc->verbuf_mem) { snprintf((char *)sc->verbuf_mem, strlen(MRSAS_VERSION)+2,"%s\n", MRSAS_VERSION); @@ -2113,7 +2293,7 @@ int mrsas_ioc_init(struct mrsas_softc *s int mrsas_alloc_mpt_cmds(struct mrsas_softc *sc) { int i, j; - u_int32_t max_cmd; + u_int32_t max_cmd, count; struct mrsas_mpt_cmd *cmd; pMpi2ReplyDescriptorsUnion_t reply_desc; u_int32_t offset, chain_offset, sense_offset; @@ -2183,7 +2363,8 @@ int mrsas_alloc_mpt_cmds(struct mrsas_so /* Initialize reply descriptor array to 0xFFFFFFFF */ reply_desc = sc->reply_desc_mem; - for (i = 0; i < sc->reply_q_depth; i++, reply_desc++) { + count = sc->msix_vectors > 0 ? sc->msix_vectors : 1; + for (i = 0; i < sc->reply_q_depth * count ; i++, reply_desc++) { reply_desc->Words = MRSAS_ULONG_MAX; } return(0); @@ -2400,11 +2581,14 @@ mrsas_ocr_thread(void *arg) */ void mrsas_reset_reply_desc(struct mrsas_softc *sc) { - int i; + int i, count; pMpi2ReplyDescriptorsUnion_t reply_desc; - sc->last_reply_idx = 0; - reply_desc = sc->reply_desc_mem; + count = sc->msix_vectors > 0 ? sc->msix_vectors : 1; + for (i = 0 ; i < count ; i++) + sc->last_reply_idx[i] = 0; + + reply_desc = sc->reply_desc_mem; for (i = 0; i < sc->reply_q_depth; i++, reply_desc++) { reply_desc->Words = MRSAS_ULONG_MAX; } @@ -2641,7 +2825,8 @@ void mrsas_kill_hba (struct mrsas_softc int mrsas_wait_for_outstanding(struct mrsas_softc *sc) { int i, outstanding, retval = 0; - u_int32_t fw_state; + u_int32_t fw_state, count, MSIxIndex; + for (i = 0; i < MRSAS_RESET_WAIT_TIME; i++) { if (sc->remove_in_progress) { @@ -2666,7 +2851,9 @@ int mrsas_wait_for_outstanding(struct mr if (!(i % MRSAS_RESET_NOTICE_INTERVAL)) { mrsas_dprint(sc, MRSAS_OCR, "[%2d]waiting for %d " "commands to complete\n",i,outstanding); - mrsas_complete_cmd(sc); + count = sc->msix_vectors > 0 ? sc->msix_vectors : 1; + for (MSIxIndex = 0 ; MSIxIndex < count; MSIxIndex++) + mrsas_complete_cmd(sc, MSIxIndex); } DELAY(1000 * 1000); } Modified: head/sys/dev/mrsas/mrsas.h ============================================================================== --- head/sys/dev/mrsas/mrsas.h Wed Oct 8 09:30:35 2014 (r272738) +++ head/sys/dev/mrsas/mrsas.h Wed Oct 8 09:34:25 2014 (r272739) @@ -110,6 +110,7 @@ __FBSDID("$FreeBSD$"); #define MRSAS_IO_TIMEOUT 180000 /* 180 second timeout */ #define MRSAS_LDIO_QUEUE_DEPTH 70 /* 70 percent as default */ #define THRESHOLD_REPLY_COUNT 50 +#define MAX_MSIX_COUNT 128 /* Boolean types @@ -1959,6 +1960,16 @@ struct mrsas_ctrl_info { #define MRSAS_DEFAULT_CMD_TIMEOUT 90 #define MRSAS_THROTTLE_QUEUE_DEPTH 16 +/* + * MSI-x regsiters offset defines + */ +#define MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x0000030C) +#define MPI2_REPLY_POST_HOST_INDEX_OFFSET (0x0000006C) +#define MR_MAX_REPLY_QUEUES_OFFSET (0x0000001F) +#define MR_MAX_REPLY_QUEUES_EXT_OFFSET (0x003FC000) +#define MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT 14 +#define MR_MAX_MSIX_REG_ARRAY 16 + /* * FW reports the maximum of number of commands that it can accept (maximum * commands that can be outstanding) at any time. The driver must report a @@ -1968,7 +1979,7 @@ struct mrsas_ctrl_info { */ #define MRSAS_INT_CMDS 32 #define MRSAS_SKINNY_INT_CMDS 5 -#define MRSAS_MAX_MSIX_QUEUES 16 +#define MRSAS_MAX_MSIX_QUEUES 128 /* * FW can accept both 32 and 64 bit SGLs. We want to allocate 32/64 bit @@ -1993,6 +2004,17 @@ struct mrsas_ctrl_info { #define MFI_1068_FW_HANDSHAKE_OFFSET 0x64 #define MFI_1068_FW_READY 0xDDDD0000 +typedef union _MFI_CAPABILITIES { + struct { + u_int32_t support_fp_remote_lun:1; + u_int32_t support_additional_msix:1; + u_int32_t support_fastpath_wb:1; + u_int32_t support_max_255lds:1; + u_int32_t reserved:28; + } mfi_capabilities; + u_int32_t reg; +} MFI_CAPABILITIES; + #pragma pack(1) struct mrsas_sge32 { u_int32_t phys_addr; @@ -2035,18 +2057,6 @@ struct mrsas_header { }; #pragma pack() - -typedef union _MFI_CAPABILITIES { - struct { - u_int32_t support_fp_remote_lun:1; - u_int32_t support_additional_msix:1; - u_int32_t support_fastpath_wb:1; - u_int32_t support_max_255lds:1; - u_int32_t reserved:28; - } mfi_capabilities; - u_int32_t reg; -} MFI_CAPABILITIES; - #pragma pack(1) struct mrsas_init_frame { u_int8_t cmd; /*00h */ @@ -2162,8 +2172,7 @@ struct mrsas_abort_frame { u_int8_t cmd_status; /*02h */ u_int8_t reserved_1; /*03h */ - u_int32_t reserved_2; /*04h */ - + MFI_CAPABILITIES driver_operations; /*04h */ u_int32_t context; /*08h */ u_int32_t pad_0; /*0Ch */ @@ -2419,6 +2428,11 @@ struct mrsas_evt_detail { } __packed; +struct mrsas_irq_context { + struct mrsas_softc *sc; + uint32_t MSIxIndex; +}; + /* Controller management info added to support Linux Emulator */ #define MAX_MGMT_ADAPTERS 1024 @@ -2479,9 +2493,13 @@ struct mrsas_softc { struct mtx aen_lock; // aen lock uint32_t max_fw_cmds; // Max commands from FW uint32_t max_num_sge; // Max number of SGEs - struct resource *mrsas_irq; // interrupt interface window - void *intr_handle; // handle - int irq_id; // intr resource id + struct resource *mrsas_irq[MAX_MSIX_COUNT]; // interrupt interface window + void *intr_handle[MAX_MSIX_COUNT]; // handle + int irq_id[MAX_MSIX_COUNT]; // intr resource id + struct mrsas_irq_context irq_context[MAX_MSIX_COUNT]; + int msix_vectors; // Max msix vectors + int msix_enable; // MSI-x support + uint32_t msix_reg_offset[16]; struct mrsas_mpt_cmd **mpt_cmd_list; struct mrsas_mfi_cmd **mfi_cmd_list; TAILQ_HEAD(, mrsas_mpt_cmd) mrsas_mpt_cmd_list_head; @@ -2492,7 +2510,7 @@ struct mrsas_softc { bus_addr_t io_request_frames_phys; u_int8_t *io_request_frames; bus_addr_t reply_frames_desc_phys; - u_int16_t last_reply_idx; + u_int16_t last_reply_idx[MAX_MSIX_COUNT]; u_int32_t reply_q_depth; u_int32_t request_alloc_sz; u_int32_t reply_alloc_sz; Modified: head/sys/dev/mrsas/mrsas_cam.c ============================================================================== --- head/sys/dev/mrsas/mrsas_cam.c Wed Oct 8 09:30:35 2014 (r272738) +++ head/sys/dev/mrsas/mrsas_cam.c Wed Oct 8 09:34:25 2014 (r272739) @@ -49,8 +49,14 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include /* XXX for pcpu.h */ +#include /* XXX for PCPU_GET */ + +#define smp_processor_id() PCPU_GET(cpuid) + /* * Function prototypes */ @@ -794,7 +800,11 @@ int mrsas_setup_io(struct mrsas_softc *s fp_possible = io_info.fpOkForIo; } - if (fp_possible) { + cmd->request_desc->SCSIIO.MSIxIndex = + sc->msix_vectors ? smp_processor_id() % sc->msix_vectors : 0; + + + if (fp_possible) { mrsas_set_pd_lba(io_request, csio->cdb_len, &io_info, ccb, map_ptr, start_lba_lo, ld_block_size); io_request->Function = MPI2_FUNCTION_SCSI_IO_REQUEST; @@ -881,6 +891,9 @@ int mrsas_build_dcdb(struct mrsas_softc MRSAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); cmd->request_desc->SCSIIO.DevHandle = map_ptr->raidMap.devHndlInfo[device_id].curDevHdl; + cmd->request_desc->SCSIIO.MSIxIndex = + sc->msix_vectors ? smp_processor_id() % sc->msix_vectors : 0; + } else { io_request->Function = MRSAS_MPI2_FUNCTION_LD_IO_REQUEST; From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 09:35:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7B6554D5; Wed, 8 Oct 2014 09:35:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 67F1C2F1; Wed, 8 Oct 2014 09:35:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s989ZrNV077475; Wed, 8 Oct 2014 09:35:53 GMT (envelope-from kadesai@FreeBSD.org) Received: (from kadesai@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s989Zrf1077472; Wed, 8 Oct 2014 09:35:53 GMT (envelope-from kadesai@FreeBSD.org) Message-Id: <201410080935.s989Zrf1077472@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kadesai set sender to kadesai@FreeBSD.org using -f From: Kashyap D Desai Date: Wed, 8 Oct 2014 09:35:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272740 - head/sys/dev/mrsas X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 09:35:53 -0000 Author: kadesai Date: Wed Oct 8 09:35:52 2014 New Revision: 272740 URL: https://svnweb.freebsd.org/changeset/base/272740 Log: d_poll() callback function is the entry point for poll system call for the application. It is meant to notify the applications which will be waiting for some controller events to be occured. Reviewed by: ambrisko MFC after: 2 weeks Sponsored by: AVAGO Technologies Modified: head/sys/dev/mrsas/mrsas.c head/sys/dev/mrsas/mrsas.h Modified: head/sys/dev/mrsas/mrsas.c ============================================================================== --- head/sys/dev/mrsas/mrsas.c Wed Oct 8 09:34:25 2014 (r272739) +++ head/sys/dev/mrsas/mrsas.c Wed Oct 8 09:35:52 2014 (r272740) @@ -65,6 +65,7 @@ static d_close_t mrsas_close; static d_read_t mrsas_read; static d_write_t mrsas_write; static d_ioctl_t mrsas_ioctl; +static d_poll_t mrsas_poll; static struct mrsas_mgmt_info mrsas_mgmt_info; static struct mrsas_ident *mrsas_find_ident(device_t); @@ -184,6 +185,7 @@ static struct cdevsw mrsas_cdevsw = { .d_read = mrsas_read, .d_write = mrsas_write, .d_ioctl = mrsas_ioctl, + .d_poll = mrsas_poll, .d_name = "mrsas", }; @@ -1265,6 +1267,36 @@ do_ioctl: } /** + * mrsas_poll: poll entry point for mrsas driver fd + * + * This function is the entry point for poll from the OS. It waits for + * some AEN events to be triggered from the controller and notifies back. + */ +static int +mrsas_poll(struct cdev *dev, int poll_events, struct thread *td) +{ + struct mrsas_softc *sc; + int revents = 0; + + sc = dev->si_drv1; + + if (poll_events & (POLLIN | POLLRDNORM)) { + if (sc->mrsas_aen_triggered) { + revents |= poll_events & (POLLIN | POLLRDNORM); + } + } + + if (revents == 0) { + if (poll_events & (POLLIN | POLLRDNORM)) { + sc->mrsas_poll_waiting = 1; + selrecord(td, &sc->mrsas_select); + } + } + + return revents; +} + +/** * mrsas_setup_irq: Set up interrupt. * input: Adapter instance soft state * @@ -3274,13 +3306,12 @@ mrsas_complete_mptmfi_passthru(struct mr mtx_unlock(&sc->raidmap_lock); break; } -#if 0 //currently not supporting event handling, so commenting out if (cmd->frame->dcmd.opcode == MR_DCMD_CTRL_EVENT_GET_INFO || cmd->frame->dcmd.opcode == MR_DCMD_CTRL_EVENT_GET) { - mrsas_poll_wait_aen = 0; + sc->mrsas_aen_triggered = 0; } -#endif - /* See if got an event notification */ + + /* See if got an event notification */ if (cmd->frame->dcmd.opcode == MR_DCMD_CTRL_EVENT_WAIT) mrsas_complete_aen(sc, cmd); else @@ -3967,7 +3998,11 @@ void mrsas_complete_aen(struct mrsas_sof * Don't signal app if it is just an aborted previously registered aen */ if ((!cmd->abort_aen) && (sc->remove_in_progress == 0)) { - /* TO DO (?) */ + sc->mrsas_aen_triggered = 1; + if (sc->mrsas_poll_waiting) { + sc->mrsas_poll_waiting = 0; + selwakeup(&sc->mrsas_select); + } } else cmd->abort_aen = 0; Modified: head/sys/dev/mrsas/mrsas.h ============================================================================== --- head/sys/dev/mrsas/mrsas.h Wed Oct 8 09:34:25 2014 (r272739) +++ head/sys/dev/mrsas/mrsas.h Wed Oct 8 09:35:52 2014 (r272740) @@ -2491,6 +2491,9 @@ struct mrsas_softc { struct mtx mfi_cmd_pool_lock; // lock for cmd pool linked list struct mtx raidmap_lock; // lock for raid map access/update struct mtx aen_lock; // aen lock + struct selinfo mrsas_select; // poll select interface for application + uint32_t mrsas_aen_triggered; + uint32_t mrsas_poll_waiting; uint32_t max_fw_cmds; // Max commands from FW uint32_t max_num_sge; // Max number of SGEs struct resource *mrsas_irq[MAX_MSIX_COUNT]; // interrupt interface window From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 09:37:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9FB1D62F; Wed, 8 Oct 2014 09:37:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8215C30A; Wed, 8 Oct 2014 09:37:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s989bn4c077747; Wed, 8 Oct 2014 09:37:49 GMT (envelope-from kadesai@FreeBSD.org) Received: (from kadesai@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s989bmiR077743; Wed, 8 Oct 2014 09:37:48 GMT (envelope-from kadesai@FreeBSD.org) Message-Id: <201410080937.s989bmiR077743@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kadesai set sender to kadesai@FreeBSD.org using -f From: Kashyap D Desai Date: Wed, 8 Oct 2014 09:37:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272741 - head/sys/dev/mrsas X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 09:37:49 -0000 Author: kadesai Date: Wed Oct 8 09:37:47 2014 New Revision: 272741 URL: https://svnweb.freebsd.org/changeset/base/272741 Log: In the passthru IOCTL path, the mfi command pool was freely accessible N times where as there are limited number(32) of mfi commands in the pool. The mfi command pool is now restricted to 27 simultaneous accesses by using a counting semaphore while calling the passthru function. In the mrsas_cam.c source file there was a same function name mrsas_poll(), which was same as the mrsas_poll() implemented in the mrsas.c file for the polling interface. To clearly distinguish the functionality by usage we have renamed the former as mrsas_cam_poll(). In the passthru function let's say it has got an mfi command from the pool but it has failed in one of the DMA function call which will lead to leak an mfi command because in the ERROR case it directly returns and not freeing up the occupied mfi command. Reviewed by: ambrisko MFC after: 2 weeks Sponsored by: AVAGO Technologies Modified: head/sys/dev/mrsas/mrsas.c head/sys/dev/mrsas/mrsas.h head/sys/dev/mrsas/mrsas_cam.c head/sys/dev/mrsas/mrsas_ioctl.c Modified: head/sys/dev/mrsas/mrsas.c ============================================================================== --- head/sys/dev/mrsas/mrsas.c Wed Oct 8 09:35:52 2014 (r272740) +++ head/sys/dev/mrsas/mrsas.c Wed Oct 8 09:37:47 2014 (r272741) @@ -823,6 +823,9 @@ static int mrsas_attach(device_t dev) mtx_init(&sc->mfi_cmd_pool_lock, "mrsas_mfi_cmd_pool_lock", NULL, MTX_DEF); mtx_init(&sc->raidmap_lock, "mrsas_raidmap_lock", NULL, MTX_DEF); + /* Intialize a counting Semaphore to take care no. of concurrent IOCTLs */ + sema_init(&sc->ioctl_count_sema, MRSAS_MAX_MFI_CMDS-5, IOCTL_SEMA_DESCRIPTION); + /* Intialize linked list */ TAILQ_INIT(&sc->mrsas_mpt_cmd_list_head); TAILQ_INIT(&sc->mrsas_mfi_cmd_list_head); @@ -912,6 +915,8 @@ attach_fail_fw: mtx_destroy(&sc->mpt_cmd_pool_lock); mtx_destroy(&sc->mfi_cmd_pool_lock); mtx_destroy(&sc->raidmap_lock); + /* Destroy the counting semaphore created for Ioctl */ + sema_destroy(&sc->ioctl_count_sema); attach_fail: destroy_dev(sc->mrsas_cdev); if (sc->reg_res){ @@ -937,10 +942,13 @@ static int mrsas_detach(device_t dev) sc = device_get_softc(dev); sc->remove_in_progress = 1; + /* Destroy the character device so no other IOCTL will be handled */ + destroy_dev(sc->mrsas_cdev); + /* * Take the instance off the instance array. Note that we will not * decrement the max_index. We let this array be sparse array - */ + */ for (i = 0; i < mrsas_mgmt_info.max_index; i++) { if (mrsas_mgmt_info.sc_ptr[i] == sc) { mrsas_mgmt_info.count--; @@ -984,13 +992,22 @@ static int mrsas_detach(device_t dev) mtx_destroy(&sc->mpt_cmd_pool_lock); mtx_destroy(&sc->mfi_cmd_pool_lock); mtx_destroy(&sc->raidmap_lock); + + /* Wait for all the semaphores to be released */ + while (sema_value(&sc->ioctl_count_sema) != (MRSAS_MAX_MFI_CMDS-5)) + pause("mr_shutdown", hz); + + /* Destroy the counting semaphore created for Ioctl */ + sema_destroy(&sc->ioctl_count_sema); + if (sc->reg_res){ bus_release_resource(sc->mrsas_dev, SYS_RES_MEMORY, sc->reg_res_id, sc->reg_res); } - destroy_dev(sc->mrsas_cdev); + if (sc->sysctl_tree != NULL) sysctl_ctx_free(&sc->sysctl_ctx); + return (0); } @@ -1254,13 +1271,21 @@ do_ioctl: #ifdef COMPAT_FREEBSD32 case MRSAS_IOC_FIRMWARE_PASS_THROUGH32: #endif + /* Decrement the Ioctl counting Semaphore before getting an mfi command */ + sema_wait(&sc->ioctl_count_sema); + ret = mrsas_passthru(sc, (void *)arg, cmd); + + /* Increment the Ioctl counting semaphore value */ + sema_post(&sc->ioctl_count_sema); + break; case MRSAS_IOC_SCAN_BUS: ret = mrsas_bus_scan(sc); break; default: mrsas_dprint(sc, MRSAS_TRACE, "IOCTL command 0x%lx is not handled\n", cmd); + ret = ENOENT; } return (ret); Modified: head/sys/dev/mrsas/mrsas.h ============================================================================== --- head/sys/dev/mrsas/mrsas.h Wed Oct 8 09:35:52 2014 (r272740) +++ head/sys/dev/mrsas/mrsas.h Wed Oct 8 09:37:47 2014 (r272741) @@ -67,12 +67,16 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include #include #include +#define IOCTL_SEMA_DESCRIPTION "mrsas semaphore for MFI pool" + /* * Device IDs and PCI */ @@ -2494,6 +2498,8 @@ struct mrsas_softc { struct selinfo mrsas_select; // poll select interface for application uint32_t mrsas_aen_triggered; uint32_t mrsas_poll_waiting; + + struct sema ioctl_count_sema; // counting semaphore for ioctl uint32_t max_fw_cmds; // Max commands from FW uint32_t max_num_sge; // Max number of SGEs struct resource *mrsas_irq[MAX_MSIX_COUNT]; // interrupt interface window Modified: head/sys/dev/mrsas/mrsas_cam.c ============================================================================== --- head/sys/dev/mrsas/mrsas_cam.c Wed Oct 8 09:35:52 2014 (r272740) +++ head/sys/dev/mrsas/mrsas_cam.c Wed Oct 8 09:37:47 2014 (r272741) @@ -86,7 +86,7 @@ void mrsas_set_pd_lba(MRSAS_RAID_SCSI_IO MR_DRV_RAID_MAP_ALL *local_map_ptr, u_int32_t ref_tag, u_int32_t ld_block_size); static void mrsas_freeze_simq(struct mrsas_mpt_cmd *cmd, struct cam_sim *sim); -static void mrsas_poll(struct cam_sim *sim); +static void mrsas_cam_poll(struct cam_sim *sim); static void mrsas_action(struct cam_sim *sim, union ccb *ccb); static void mrsas_scsiio_timeout(void *data); static void mrsas_data_load_cb(void *arg, bus_dma_segment_t *segs, @@ -137,7 +137,7 @@ int mrsas_cam_attach(struct mrsas_softc /* * Create SIM for bus 0 and register, also create path */ - sc->sim_0 = cam_sim_alloc(mrsas_action, mrsas_poll, "mrsas", sc, + sc->sim_0 = cam_sim_alloc(mrsas_action, mrsas_cam_poll, "mrsas", sc, device_get_unit(sc->mrsas_dev), &sc->sim_lock, mrsas_cam_depth, mrsas_cam_depth, devq); if (sc->sim_0 == NULL){ @@ -173,7 +173,7 @@ int mrsas_cam_attach(struct mrsas_softc /* * Create SIM for bus 1 and register, also create path */ - sc->sim_1 = cam_sim_alloc(mrsas_action, mrsas_poll, "mrsas", sc, + sc->sim_1 = cam_sim_alloc(mrsas_action, mrsas_cam_poll, "mrsas", sc, device_get_unit(sc->mrsas_dev), &sc->sim_lock, mrsas_cam_depth, mrsas_cam_depth, devq); if (sc->sim_1 == NULL){ @@ -1110,12 +1110,12 @@ void mrsas_cmd_done(struct mrsas_softc * } /** - * mrsas_poll: Polling entry point + * mrsas_cam_poll: Polling entry point * input: Pointer to SIM * * This is currently a stub function. */ -static void mrsas_poll(struct cam_sim *sim) +static void mrsas_cam_poll(struct cam_sim *sim) { struct mrsas_softc *sc = (struct mrsas_softc *)cam_sim_softc(sim); mrsas_isr((void *) sc); Modified: head/sys/dev/mrsas/mrsas_ioctl.c ============================================================================== --- head/sys/dev/mrsas/mrsas_ioctl.c Wed Oct 8 09:35:52 2014 (r272740) +++ head/sys/dev/mrsas/mrsas_ioctl.c Wed Oct 8 09:37:47 2014 (r272741) @@ -168,18 +168,21 @@ int mrsas_passthru( struct mrsas_softc * NULL, NULL, // lockfunc, lockarg &ioctl_data_tag[i])) { device_printf(sc->mrsas_dev, "Cannot allocate ioctl data tag\n"); - return (ENOMEM); + ret = ENOMEM; + goto out; } if (bus_dmamem_alloc(ioctl_data_tag[i], (void **)&ioctl_data_mem[i], (BUS_DMA_NOWAIT | BUS_DMA_ZERO), &ioctl_data_dmamap[i])) { device_printf(sc->mrsas_dev, "Cannot allocate ioctl data mem\n"); - return (ENOMEM); + ret = ENOMEM; + goto out; } if (bus_dmamap_load(ioctl_data_tag[i], ioctl_data_dmamap[i], ioctl_data_mem[i], ioctl_data_size, mrsas_alloc_cb, &ioctl_data_phys_addr[i], BUS_DMA_NOWAIT)) { device_printf(sc->mrsas_dev, "Cannot load ioctl data mem\n"); - return (ENOMEM); + ret = ENOMEM; + goto out; } /* Save the physical address and length */ @@ -222,18 +225,21 @@ int mrsas_passthru( struct mrsas_softc * NULL, NULL, // lockfunc, lockarg &ioctl_sense_tag)) { device_printf(sc->mrsas_dev, "Cannot allocate ioctl sense tag\n"); - return (ENOMEM); + ret = ENOMEM; + goto out; } if (bus_dmamem_alloc(ioctl_sense_tag, (void **)&ioctl_sense_mem, (BUS_DMA_NOWAIT | BUS_DMA_ZERO), &ioctl_sense_dmamap)) { - device_printf(sc->mrsas_dev, "Cannot allocate ioctl data mem\n"); - return (ENOMEM); + device_printf(sc->mrsas_dev, "Cannot allocate ioctl sense mem\n"); + ret = ENOMEM; + goto out; } if (bus_dmamap_load(ioctl_sense_tag, ioctl_sense_dmamap, ioctl_sense_mem, ioctl_sense_size, mrsas_alloc_cb, &ioctl_sense_phys_addr, BUS_DMA_NOWAIT)) { device_printf(sc->mrsas_dev, "Cannot load ioctl sense mem\n"); - return (ENOMEM); + ret = ENOMEM; + goto out; } sense_ptr = (unsigned long *)((unsigned long)cmd->frame + user_ioc->sense_off); @@ -299,17 +305,24 @@ out: */ if (ioctl_sense_phys_addr) bus_dmamap_unload(ioctl_sense_tag, ioctl_sense_dmamap); - if (ioctl_sense_mem) + if (ioctl_sense_mem != NULL) bus_dmamem_free(ioctl_sense_tag, ioctl_sense_mem, ioctl_sense_dmamap); - if (ioctl_sense_tag) + if (ioctl_sense_tag != NULL) bus_dma_tag_destroy(ioctl_sense_tag); /* * Release data buffers */ for (i = 0; i < user_ioc->sge_count; i++) { - if (!user_ioc->sgl[i].iov_len) - continue; + if (ioctlCmd == MRSAS_IOC_FIRMWARE_PASS_THROUGH64) { + if (!user_ioc->sgl[i].iov_len) + continue; +#ifdef COMPAT_FREEBSD32 + } else { + if (!user_ioc32->sgl[i].iov_len) + continue; +#endif + } if (ioctl_data_phys_addr[i]) bus_dmamap_unload(ioctl_data_tag[i], ioctl_data_dmamap[i]); if (ioctl_data_mem[i] != NULL) From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 09:39:19 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B54C6796; Wed, 8 Oct 2014 09:39:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A1B6A323; Wed, 8 Oct 2014 09:39:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s989dJmG077983; Wed, 8 Oct 2014 09:39:19 GMT (envelope-from kadesai@FreeBSD.org) Received: (from kadesai@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s989dJNt077982; Wed, 8 Oct 2014 09:39:19 GMT (envelope-from kadesai@FreeBSD.org) Message-Id: <201410080939.s989dJNt077982@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kadesai set sender to kadesai@FreeBSD.org using -f From: Kashyap D Desai Date: Wed, 8 Oct 2014 09:39:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272742 - head/sys/dev/mrsas X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 09:39:19 -0000 Author: kadesai Date: Wed Oct 8 09:39:18 2014 New Revision: 272742 URL: https://svnweb.freebsd.org/changeset/base/272742 Log: Driver version upgrade. Bring head mrsas same as internal Phase 6.5. Reviewed by: ambrisko MFC after: 2 weeks Sponsored by: AVAGO Technologies Modified: head/sys/dev/mrsas/mrsas.h Modified: head/sys/dev/mrsas/mrsas.h ============================================================================== --- head/sys/dev/mrsas/mrsas.h Wed Oct 8 09:37:47 2014 (r272741) +++ head/sys/dev/mrsas/mrsas.h Wed Oct 8 09:39:18 2014 (r272742) @@ -105,7 +105,7 @@ __FBSDID("$FreeBSD$"); */ #define BYTE_ALIGNMENT 1 #define MRSAS_MAX_NAME_LENGTH 32 -#define MRSAS_VERSION "06.704.01.01-fbsd" +#define MRSAS_VERSION "06.705.10.00-fbsd" #define MRSAS_ULONG_MAX 0xFFFFFFFFFFFFFFFF #define MRSAS_DEFAULT_TIMEOUT 0x14 //temp #define DONE 0 From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 09:44:02 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DCF6093B; Wed, 8 Oct 2014 09:44:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C93D63FA; Wed, 8 Oct 2014 09:44:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s989i2vf082003; Wed, 8 Oct 2014 09:44:02 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s989i2S6082002; Wed, 8 Oct 2014 09:44:02 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410080944.s989i2S6082002@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 8 Oct 2014 09:44:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272743 - head/sys/fs/autofs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 09:44:03 -0000 Author: trasz Date: Wed Oct 8 09:44:02 2014 New Revision: 272743 URL: https://svnweb.freebsd.org/changeset/base/272743 Log: Simplify; no functional changes. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/fs/autofs/autofs.c Modified: head/sys/fs/autofs/autofs.c ============================================================================== --- head/sys/fs/autofs/autofs.c Wed Oct 8 09:39:18 2014 (r272742) +++ head/sys/fs/autofs/autofs.c Wed Oct 8 09:44:02 2014 (r272743) @@ -367,7 +367,7 @@ autofs_trigger_one(struct autofs_node *a char *key, *path; int error = 0, request_error, last; - amp = VFSTOAUTOFS(anp->an_vnode->v_mount); + amp = anp->an_mount; sx_assert(&autofs_softc->sc_lock, SA_XLOCKED); From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 09:50:59 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7545AC99; Wed, 8 Oct 2014 09:50:59 +0000 (UTC) Received: from smtp1.multiplay.co.uk (smtp1.multiplay.co.uk [85.236.96.35]) by mx1.freebsd.org (Postfix) with ESMTP id 394916B9; Wed, 8 Oct 2014 09:50:58 +0000 (UTC) Received: by smtp1.multiplay.co.uk (Postfix, from userid 65534) id 6449420E70953; Wed, 8 Oct 2014 09:50:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.multiplay.co.uk X-Spam-Level: * X-Spam-Status: No, score=1.6 required=8.0 tests=AWL,BAYES_00,DOS_OE_TO_MX, FSL_HELO_NON_FQDN_1,RDNS_DYNAMIC,STOX_REPLY_TYPE autolearn=no version=3.3.1 Received: from r2d2 (82-69-141-170.dsl.in-addr.zen.co.uk [82.69.141.170]) by smtp1.multiplay.co.uk (Postfix) with ESMTP id BEBDA20E70951; Wed, 8 Oct 2014 09:50:49 +0000 (UTC) Message-ID: <81F46B899A5843B7B0D07649108D5A97@multiplay.co.uk> From: "Steven Hartland" To: "Kashyap D Desai" , , , References: <201410080930.s989Uat9073960@svn.freebsd.org> Subject: Re: svn commit: r272738 - in head/sys: dev/mrsas modules/mrsas modules/mrsas/mrsas_linux Date: Wed, 8 Oct 2014 10:50:47 +0100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="UTF-8"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 09:50:59 -0000 I thought it was convension to avoid using $FreeBSD$ in code comments instead use the __FBSDID e.g. #include __FBSDID("$FreeBSD$"); #include Could anyone confirm? Regards Steve ----- Original Message ----- From: "Kashyap D Desai" To: ; ; Sent: Wednesday, October 08, 2014 10:30 AM Subject: svn commit: r272738 - in head/sys: dev/mrsas modules/mrsas modules/mrsas/mrsas_linux > Author: kadesai > Date: Wed Oct 8 09:30:35 2014 > New Revision: 272738 > URL: https://svnweb.freebsd.org/changeset/base/272738 > > Log: > Fix the minor svn add issue. $FreeBSD$ expands at the time of > snv add, so I have added $FreeBSD$ as comment. > > This commit is contininous of last mrsas commit, so that compilation > does not break. > > Obtained from: AVAGO Technologies > MFC after: 2 weeks > > Modified: > head/sys/dev/mrsas/mrsas_linux.c > head/sys/modules/mrsas/Makefile > head/sys/modules/mrsas/mrsas_linux/Makefile > > Modified: head/sys/dev/mrsas/mrsas_linux.c > ============================================================================== > --- head/sys/dev/mrsas/mrsas_linux.c Wed Oct 8 09:19:35 2014 (r272737) > +++ head/sys/dev/mrsas/mrsas_linux.c Wed Oct 8 09:30:35 2014 (r272738) > @@ -39,10 +39,10 @@ > * Mail to: LSI Corporation, 1621 Barber Lane, Milpitas, CA 95035 > * ATTN: MegaRaid FreeBSD > * > + * $FreeBSD$ > */ > > #include > - > > #include > #include > > Modified: head/sys/modules/mrsas/Makefile > ============================================================================== > --- head/sys/modules/mrsas/Makefile Wed Oct 8 09:19:35 2014 (r272737) > +++ head/sys/modules/mrsas/Makefile Wed Oct 8 09:30:35 2014 (r272738) > @@ -1,5 +1,5 @@ > # Makefile for mrsas driver > - > +# $FreeBSD$ > > KMOD=mrsas > .PATH: ${.CURDIR}/../../dev/${KMOD} > > Modified: head/sys/modules/mrsas/mrsas_linux/Makefile > ============================================================================== > --- head/sys/modules/mrsas/mrsas_linux/Makefile Wed Oct 8 09:19:35 2014 (r272737) > +++ head/sys/modules/mrsas/mrsas_linux/Makefile Wed Oct 8 09:30:35 2014 (r272738) > @@ -1,5 +1,5 @@ > # Makefile for mrsas driver > - > +# $FreeBSD$ > > .PATH: ${.CURDIR}/../../../dev/mrsas > > > From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 10:14:38 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3795D594; Wed, 8 Oct 2014 10:14:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 22E5A940; Wed, 8 Oct 2014 10:14:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s98AEctu096648; Wed, 8 Oct 2014 10:14:38 GMT (envelope-from kadesai@FreeBSD.org) Received: (from kadesai@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s98AEcL1096646; Wed, 8 Oct 2014 10:14:38 GMT (envelope-from kadesai@FreeBSD.org) Message-Id: <201410081014.s98AEcL1096646@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kadesai set sender to kadesai@FreeBSD.org using -f From: Kashyap D Desai Date: Wed, 8 Oct 2014 10:14:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272744 - head/sys/dev/mrsas X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 10:14:38 -0000 Author: kadesai Date: Wed Oct 8 10:14:37 2014 New Revision: 272744 URL: https://svnweb.freebsd.org/changeset/base/272744 Log: No logical code change in this pathc. Only Style 9 changes for mrsas driver. Reviewed by: ambrisko MFC after: 2 weeks Sponsored by: AVAGO Technologies Modified: head/sys/dev/mrsas/mrsas.c head/sys/dev/mrsas/mrsas.h head/sys/dev/mrsas/mrsas_cam.c head/sys/dev/mrsas/mrsas_fp.c head/sys/dev/mrsas/mrsas_ioctl.c head/sys/dev/mrsas/mrsas_ioctl.h head/sys/dev/mrsas/mrsas_linux.c Modified: head/sys/dev/mrsas/mrsas.c ============================================================================== --- head/sys/dev/mrsas/mrsas.c Wed Oct 8 09:44:02 2014 (r272743) +++ head/sys/dev/mrsas/mrsas.c Wed Oct 8 10:14:37 2014 (r272744) @@ -1,43 +1,38 @@ /* - * Copyright (c) 2014, LSI Corp. - * All rights reserved. - * Author: Marian Choy + * Copyright (c) 2014, LSI Corp. All rights reserved. Author: Marian Choy * Support: freebsdraid@lsi.com * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: + * 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. - * 3. Neither the name of the nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 - * COPYRIGHT HOLDER 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 + * 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. 3. Neither the name of the + * nor the names of its contributors may be used to endorse or + * promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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. * - * The views and conclusions contained in the software and documentation - * are those of the authors and should not be interpreted as representing + * The views and conclusions contained in the software and documentation are + * those of the authors and should not be interpreted as representing * official policies,either expressed or implied, of the FreeBSD Project. * - * Send feedback to: - * Mail to: LSI Corporation, 1621 Barber Lane, Milpitas, CA 95035 - * ATTN: MegaRaid FreeBSD + * Send feedback to: Mail to: LSI Corporation, 1621 + * Barber Lane, Milpitas, CA 95035 ATTN: MegaRaid FreeBSD * */ @@ -57,15 +52,15 @@ __FBSDID("$FreeBSD$"); #include -/* - * Function prototypes +/* + * Function prototypes */ -static d_open_t mrsas_open; -static d_close_t mrsas_close; -static d_read_t mrsas_read; -static d_write_t mrsas_write; -static d_ioctl_t mrsas_ioctl; -static d_poll_t mrsas_poll; +static d_open_t mrsas_open; +static d_close_t mrsas_close; +static d_read_t mrsas_read; +static d_write_t mrsas_write; +static d_ioctl_t mrsas_ioctl; +static d_poll_t mrsas_poll; static struct mrsas_mgmt_info mrsas_mgmt_info; static struct mrsas_ident *mrsas_find_ident(device_t); @@ -86,454 +81,474 @@ static int mrsas_init_fw(struct mrsas_so static int mrsas_setup_raidmap(struct mrsas_softc *sc); static int mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex); static int mrsas_clear_intr(struct mrsas_softc *sc); -static int mrsas_get_ctrl_info(struct mrsas_softc *sc, - struct mrsas_ctrl_info *ctrl_info); -static int mrsas_issue_blocked_abort_cmd(struct mrsas_softc *sc, - struct mrsas_mfi_cmd *cmd_to_abort); +static int +mrsas_get_ctrl_info(struct mrsas_softc *sc, + struct mrsas_ctrl_info *ctrl_info); +static int +mrsas_issue_blocked_abort_cmd(struct mrsas_softc *sc, + struct mrsas_mfi_cmd *cmd_to_abort); u_int32_t mrsas_read_reg(struct mrsas_softc *sc, int offset); -u_int8_t mrsas_build_mptmfi_passthru(struct mrsas_softc *sc, - struct mrsas_mfi_cmd *mfi_cmd); -int mrsas_transition_to_ready(struct mrsas_softc *sc, int ocr); -int mrsas_init_adapter(struct mrsas_softc *sc); -int mrsas_alloc_mpt_cmds(struct mrsas_softc *sc); -int mrsas_alloc_ioc_cmd(struct mrsas_softc *sc); -int mrsas_alloc_ctlr_info_cmd(struct mrsas_softc *sc); -int mrsas_ioc_init(struct mrsas_softc *sc); -int mrsas_bus_scan(struct mrsas_softc *sc); -int mrsas_issue_dcmd(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd); -int mrsas_issue_polled(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd); -int mrsas_reset_ctrl(struct mrsas_softc *sc); -int mrsas_wait_for_outstanding(struct mrsas_softc *sc); -int mrsas_issue_blocked_cmd(struct mrsas_softc *sc, - struct mrsas_mfi_cmd *cmd); -int mrsas_alloc_tmp_dcmd(struct mrsas_softc *sc, struct mrsas_tmp_dcmd *tcmd, - int size); -void mrsas_release_mfi_cmd(struct mrsas_mfi_cmd *cmd); -void mrsas_wakeup(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd); -void mrsas_complete_aen(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd); -void mrsas_complete_abort(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd); -void mrsas_disable_intr(struct mrsas_softc *sc); -void mrsas_enable_intr(struct mrsas_softc *sc); -void mrsas_free_ioc_cmd(struct mrsas_softc *sc); -void mrsas_free_mem(struct mrsas_softc *sc); -void mrsas_free_tmp_dcmd(struct mrsas_tmp_dcmd *tmp); -void mrsas_isr(void *arg); -void mrsas_teardown_intr(struct mrsas_softc *sc); -void mrsas_addr_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error); -void mrsas_kill_hba (struct mrsas_softc *sc); -void mrsas_aen_handler(struct mrsas_softc *sc); -void mrsas_write_reg(struct mrsas_softc *sc, int offset, - u_int32_t value); -void mrsas_fire_cmd(struct mrsas_softc *sc, u_int32_t req_desc_lo, - u_int32_t req_desc_hi); -void mrsas_free_ctlr_info_cmd(struct mrsas_softc *sc); -void mrsas_complete_mptmfi_passthru(struct mrsas_softc *sc, - struct mrsas_mfi_cmd *cmd, u_int8_t status); -void mrsas_map_mpt_cmd_status(struct mrsas_mpt_cmd *cmd, u_int8_t status, - u_int8_t extStatus); -struct mrsas_mfi_cmd* mrsas_get_mfi_cmd(struct mrsas_softc *sc); -MRSAS_REQUEST_DESCRIPTOR_UNION * mrsas_build_mpt_cmd(struct mrsas_softc *sc, - struct mrsas_mfi_cmd *cmd); +u_int8_t +mrsas_build_mptmfi_passthru(struct mrsas_softc *sc, + struct mrsas_mfi_cmd *mfi_cmd); +int mrsas_transition_to_ready(struct mrsas_softc *sc, int ocr); +int mrsas_init_adapter(struct mrsas_softc *sc); +int mrsas_alloc_mpt_cmds(struct mrsas_softc *sc); +int mrsas_alloc_ioc_cmd(struct mrsas_softc *sc); +int mrsas_alloc_ctlr_info_cmd(struct mrsas_softc *sc); +int mrsas_ioc_init(struct mrsas_softc *sc); +int mrsas_bus_scan(struct mrsas_softc *sc); +int mrsas_issue_dcmd(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd); +int mrsas_issue_polled(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd); +int mrsas_reset_ctrl(struct mrsas_softc *sc); +int mrsas_wait_for_outstanding(struct mrsas_softc *sc); +int +mrsas_issue_blocked_cmd(struct mrsas_softc *sc, + struct mrsas_mfi_cmd *cmd); +int +mrsas_alloc_tmp_dcmd(struct mrsas_softc *sc, struct mrsas_tmp_dcmd *tcmd, + int size); +void mrsas_release_mfi_cmd(struct mrsas_mfi_cmd *cmd); +void mrsas_wakeup(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd); +void mrsas_complete_aen(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd); +void mrsas_complete_abort(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd); +void mrsas_disable_intr(struct mrsas_softc *sc); +void mrsas_enable_intr(struct mrsas_softc *sc); +void mrsas_free_ioc_cmd(struct mrsas_softc *sc); +void mrsas_free_mem(struct mrsas_softc *sc); +void mrsas_free_tmp_dcmd(struct mrsas_tmp_dcmd *tmp); +void mrsas_isr(void *arg); +void mrsas_teardown_intr(struct mrsas_softc *sc); +void mrsas_addr_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error); +void mrsas_kill_hba(struct mrsas_softc *sc); +void mrsas_aen_handler(struct mrsas_softc *sc); +void +mrsas_write_reg(struct mrsas_softc *sc, int offset, + u_int32_t value); +void +mrsas_fire_cmd(struct mrsas_softc *sc, u_int32_t req_desc_lo, + u_int32_t req_desc_hi); +void mrsas_free_ctlr_info_cmd(struct mrsas_softc *sc); +void +mrsas_complete_mptmfi_passthru(struct mrsas_softc *sc, + struct mrsas_mfi_cmd *cmd, u_int8_t status); +void +mrsas_map_mpt_cmd_status(struct mrsas_mpt_cmd *cmd, u_int8_t status, + u_int8_t extStatus); +struct mrsas_mfi_cmd *mrsas_get_mfi_cmd(struct mrsas_softc *sc); + +MRSAS_REQUEST_DESCRIPTOR_UNION *mrsas_build_mpt_cmd + (struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd); extern int mrsas_cam_attach(struct mrsas_softc *sc); extern void mrsas_cam_detach(struct mrsas_softc *sc); extern void mrsas_cmd_done(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd); extern void mrsas_free_frame(struct mrsas_softc *sc, struct mrsas_mfi_cmd *cmd); extern int mrsas_alloc_mfi_cmds(struct mrsas_softc *sc); -extern void mrsas_release_mpt_cmd(struct mrsas_mpt_cmd *cmd); +extern void mrsas_release_mpt_cmd(struct mrsas_mpt_cmd *cmd); extern struct mrsas_mpt_cmd *mrsas_get_mpt_cmd(struct mrsas_softc *sc); extern int mrsas_passthru(struct mrsas_softc *sc, void *arg, u_long ioctlCmd); extern uint8_t MR_ValidateMapInfo(struct mrsas_softc *sc); -extern u_int16_t MR_GetLDTgtId(u_int32_t ld, MR_DRV_RAID_MAP_ALL *map); -extern MR_LD_RAID *MR_LdRaidGet(u_int32_t ld, MR_DRV_RAID_MAP_ALL *map); +extern u_int16_t MR_GetLDTgtId(u_int32_t ld, MR_DRV_RAID_MAP_ALL * map); +extern MR_LD_RAID *MR_LdRaidGet(u_int32_t ld, MR_DRV_RAID_MAP_ALL * map); extern void mrsas_xpt_freeze(struct mrsas_softc *sc); extern void mrsas_xpt_release(struct mrsas_softc *sc); -extern MRSAS_REQUEST_DESCRIPTOR_UNION *mrsas_get_request_desc(struct mrsas_softc *sc, - u_int16_t index); +extern MRSAS_REQUEST_DESCRIPTOR_UNION * +mrsas_get_request_desc(struct mrsas_softc *sc, + u_int16_t index); extern int mrsas_bus_scan_sim(struct mrsas_softc *sc, struct cam_sim *sim); static int mrsas_alloc_evt_log_info_cmd(struct mrsas_softc *sc); static void mrsas_free_evt_log_info_cmd(struct mrsas_softc *sc); + SYSCTL_NODE(_hw, OID_AUTO, mrsas, CTLFLAG_RD, 0, "MRSAS Driver Parameters"); -/** +/* * PCI device struct and table * */ typedef struct mrsas_ident { - uint16_t vendor; - uint16_t device; - uint16_t subvendor; - uint16_t subdevice; - const char *desc; -} MRSAS_CTLR_ID; + uint16_t vendor; + uint16_t device; + uint16_t subvendor; + uint16_t subdevice; + const char *desc; +} MRSAS_CTLR_ID; MRSAS_CTLR_ID device_table[] = { - {0x1000, MRSAS_TBOLT, 0xffff, 0xffff, "LSI Thunderbolt SAS Controller"}, - {0x1000, MRSAS_INVADER, 0xffff, 0xffff, "LSI Invader SAS Controller"}, - {0x1000, MRSAS_FURY, 0xffff, 0xffff, "LSI Fury SAS Controller"}, - {0, 0, 0, 0, NULL} + {0x1000, MRSAS_TBOLT, 0xffff, 0xffff, "LSI Thunderbolt SAS Controller"}, + {0x1000, MRSAS_INVADER, 0xffff, 0xffff, "LSI Invader SAS Controller"}, + {0x1000, MRSAS_FURY, 0xffff, 0xffff, "LSI Fury SAS Controller"}, + {0, 0, 0, 0, NULL} }; -/** - * Character device entry points +/* + * Character device entry points * */ static struct cdevsw mrsas_cdevsw = { - .d_version = D_VERSION, - .d_open = mrsas_open, - .d_close = mrsas_close, - .d_read = mrsas_read, - .d_write = mrsas_write, - .d_ioctl = mrsas_ioctl, - .d_poll = mrsas_poll, - .d_name = "mrsas", + .d_version = D_VERSION, + .d_open = mrsas_open, + .d_close = mrsas_close, + .d_read = mrsas_read, + .d_write = mrsas_write, + .d_ioctl = mrsas_ioctl, + .d_poll = mrsas_poll, + .d_name = "mrsas", }; MALLOC_DEFINE(M_MRSAS, "mrsasbuf", "Buffers for the MRSAS driver"); -/** - * In the cdevsw routines, we find our softc by using the si_drv1 member - * of struct cdev. We set this variable to point to our softc in our - * attach routine when we create the /dev entry. +/* + * In the cdevsw routines, we find our softc by using the si_drv1 member of + * struct cdev. We set this variable to point to our softc in our attach + * routine when we create the /dev entry. */ int mrsas_open(struct cdev *dev, int oflags, int devtype, d_thread_t *td) { - struct mrsas_softc *sc; + struct mrsas_softc *sc; - sc = dev->si_drv1; - return (0); + sc = dev->si_drv1; + return (0); } int mrsas_close(struct cdev *dev, int fflag, int devtype, d_thread_t *td) { - struct mrsas_softc *sc; + struct mrsas_softc *sc; - sc = dev->si_drv1; - return (0); + sc = dev->si_drv1; + return (0); } int mrsas_read(struct cdev *dev, struct uio *uio, int ioflag) { - struct mrsas_softc *sc; + struct mrsas_softc *sc; - sc = dev->si_drv1; - return (0); + sc = dev->si_drv1; + return (0); } int mrsas_write(struct cdev *dev, struct uio *uio, int ioflag) { - struct mrsas_softc *sc; + struct mrsas_softc *sc; - sc = dev->si_drv1; - return (0); + sc = dev->si_drv1; + return (0); } -/** - * Register Read/Write Functions +/* + * Register Read/Write Functions * */ void mrsas_write_reg(struct mrsas_softc *sc, int offset, - u_int32_t value) + u_int32_t value) { - bus_space_tag_t bus_tag = sc->bus_tag; - bus_space_handle_t bus_handle = sc->bus_handle; + bus_space_tag_t bus_tag = sc->bus_tag; + bus_space_handle_t bus_handle = sc->bus_handle; - bus_space_write_4(bus_tag, bus_handle, offset, value); + bus_space_write_4(bus_tag, bus_handle, offset, value); } u_int32_t mrsas_read_reg(struct mrsas_softc *sc, int offset) { - bus_space_tag_t bus_tag = sc->bus_tag; - bus_space_handle_t bus_handle = sc->bus_handle; + bus_space_tag_t bus_tag = sc->bus_tag; + bus_space_handle_t bus_handle = sc->bus_handle; - return((u_int32_t)bus_space_read_4(bus_tag, bus_handle, offset)); + return ((u_int32_t)bus_space_read_4(bus_tag, bus_handle, offset)); } -/** - * Interrupt Disable/Enable/Clear Functions +/* + * Interrupt Disable/Enable/Clear Functions * */ -void mrsas_disable_intr(struct mrsas_softc *sc) +void +mrsas_disable_intr(struct mrsas_softc *sc) { - u_int32_t mask = 0xFFFFFFFF; - u_int32_t status; + u_int32_t mask = 0xFFFFFFFF; + u_int32_t status; - mrsas_write_reg(sc, offsetof(mrsas_reg_set, outbound_intr_mask), mask); - /* Dummy read to force pci flush */ - status = mrsas_read_reg(sc, offsetof(mrsas_reg_set, outbound_intr_mask)); + mrsas_write_reg(sc, offsetof(mrsas_reg_set, outbound_intr_mask), mask); + /* Dummy read to force pci flush */ + status = mrsas_read_reg(sc, offsetof(mrsas_reg_set, outbound_intr_mask)); } -void mrsas_enable_intr(struct mrsas_softc *sc) +void +mrsas_enable_intr(struct mrsas_softc *sc) { - u_int32_t mask = MFI_FUSION_ENABLE_INTERRUPT_MASK; - u_int32_t status; + u_int32_t mask = MFI_FUSION_ENABLE_INTERRUPT_MASK; + u_int32_t status; - mrsas_write_reg(sc, offsetof(mrsas_reg_set, outbound_intr_status), ~0); - status = mrsas_read_reg(sc, offsetof(mrsas_reg_set, outbound_intr_status)); + mrsas_write_reg(sc, offsetof(mrsas_reg_set, outbound_intr_status), ~0); + status = mrsas_read_reg(sc, offsetof(mrsas_reg_set, outbound_intr_status)); - mrsas_write_reg(sc, offsetof(mrsas_reg_set, outbound_intr_mask), ~mask); - status = mrsas_read_reg(sc, offsetof(mrsas_reg_set, outbound_intr_mask)); + mrsas_write_reg(sc, offsetof(mrsas_reg_set, outbound_intr_mask), ~mask); + status = mrsas_read_reg(sc, offsetof(mrsas_reg_set, outbound_intr_mask)); } -static int mrsas_clear_intr(struct mrsas_softc *sc) +static int +mrsas_clear_intr(struct mrsas_softc *sc) { - u_int32_t status, fw_status, fw_state; + u_int32_t status, fw_status, fw_state; - /* Read received interrupt */ - status = mrsas_read_reg(sc, offsetof(mrsas_reg_set, outbound_intr_status)); + /* Read received interrupt */ + status = mrsas_read_reg(sc, offsetof(mrsas_reg_set, outbound_intr_status)); - /* If FW state change interrupt is received, write to it again to clear */ - if (status & MRSAS_FW_STATE_CHNG_INTERRUPT) { - fw_status = mrsas_read_reg(sc, offsetof(mrsas_reg_set, - outbound_scratch_pad)); - fw_state = fw_status & MFI_STATE_MASK; - if (fw_state == MFI_STATE_FAULT) { - device_printf(sc->mrsas_dev, "FW is in FAULT state!\n"); - if(sc->ocr_thread_active) - wakeup(&sc->ocr_chan); - } - mrsas_write_reg(sc, offsetof(mrsas_reg_set, outbound_intr_status), status); - mrsas_read_reg(sc, offsetof(mrsas_reg_set, outbound_intr_status)); - return(1); - } - - /* Not our interrupt, so just return */ - if (!(status & MFI_FUSION_ENABLE_INTERRUPT_MASK)) - return(0); + /* + * If FW state change interrupt is received, write to it again to + * clear + */ + if (status & MRSAS_FW_STATE_CHNG_INTERRUPT) { + fw_status = mrsas_read_reg(sc, offsetof(mrsas_reg_set, + outbound_scratch_pad)); + fw_state = fw_status & MFI_STATE_MASK; + if (fw_state == MFI_STATE_FAULT) { + device_printf(sc->mrsas_dev, "FW is in FAULT state!\n"); + if (sc->ocr_thread_active) + wakeup(&sc->ocr_chan); + } + mrsas_write_reg(sc, offsetof(mrsas_reg_set, outbound_intr_status), status); + mrsas_read_reg(sc, offsetof(mrsas_reg_set, outbound_intr_status)); + return (1); + } + /* Not our interrupt, so just return */ + if (!(status & MFI_FUSION_ENABLE_INTERRUPT_MASK)) + return (0); - /* We got a reply interrupt */ - return(1); + /* We got a reply interrupt */ + return (1); } -/** - * PCI Support Functions +/* + * PCI Support Functions * */ -static struct mrsas_ident * mrsas_find_ident(device_t dev) +static struct mrsas_ident * +mrsas_find_ident(device_t dev) { - struct mrsas_ident *pci_device; + struct mrsas_ident *pci_device; - for (pci_device=device_table; pci_device->vendor != 0; pci_device++) - { - if ((pci_device->vendor == pci_get_vendor(dev)) && - (pci_device->device == pci_get_device(dev)) && - ((pci_device->subvendor == pci_get_subvendor(dev)) || - (pci_device->subvendor == 0xffff)) && - ((pci_device->subdevice == pci_get_subdevice(dev)) || - (pci_device->subdevice == 0xffff))) - return (pci_device); - } - return (NULL); + for (pci_device = device_table; pci_device->vendor != 0; pci_device++) { + if ((pci_device->vendor == pci_get_vendor(dev)) && + (pci_device->device == pci_get_device(dev)) && + ((pci_device->subvendor == pci_get_subvendor(dev)) || + (pci_device->subvendor == 0xffff)) && + ((pci_device->subdevice == pci_get_subdevice(dev)) || + (pci_device->subdevice == 0xffff))) + return (pci_device); + } + return (NULL); } -static int mrsas_probe(device_t dev) +static int +mrsas_probe(device_t dev) { - static u_int8_t first_ctrl = 1; - struct mrsas_ident *id; + static u_int8_t first_ctrl = 1; + struct mrsas_ident *id; - if ((id = mrsas_find_ident(dev)) != NULL) { - if (first_ctrl) { - printf("LSI MegaRAID SAS FreeBSD mrsas driver version: %s\n", MRSAS_VERSION); - first_ctrl = 0; - } - device_set_desc(dev, id->desc); - /* between BUS_PROBE_DEFAULT and BUS_PROBE_LOW_PRIORITY */ - return (-30); - } - return (ENXIO); + if ((id = mrsas_find_ident(dev)) != NULL) { + if (first_ctrl) { + printf("LSI MegaRAID SAS FreeBSD mrsas driver version: %s\n", + MRSAS_VERSION); + first_ctrl = 0; + } + device_set_desc(dev, id->desc); + /* between BUS_PROBE_DEFAULT and BUS_PROBE_LOW_PRIORITY */ + return (-30); + } + return (ENXIO); } -/** - * mrsas_setup_sysctl: setup sysctl values for mrsas - * input: Adapter instance soft state +/* + * mrsas_setup_sysctl: setup sysctl values for mrsas + * input: Adapter instance soft state * * Setup sysctl entries for mrsas driver. */ static void mrsas_setup_sysctl(struct mrsas_softc *sc) { - struct sysctl_ctx_list *sysctl_ctx = NULL; - struct sysctl_oid *sysctl_tree = NULL; - char tmpstr[80], tmpstr2[80]; - - /* - * Setup the sysctl variable so the user can change the debug level - * on the fly. - */ - snprintf(tmpstr, sizeof(tmpstr), "MRSAS controller %d", - device_get_unit(sc->mrsas_dev)); - snprintf(tmpstr2, sizeof(tmpstr2), "%d", device_get_unit(sc->mrsas_dev)); - - sysctl_ctx = device_get_sysctl_ctx(sc->mrsas_dev); - if (sysctl_ctx != NULL) - sysctl_tree = device_get_sysctl_tree(sc->mrsas_dev); - - if (sysctl_tree == NULL) { - sysctl_ctx_init(&sc->sysctl_ctx); - sc->sysctl_tree = SYSCTL_ADD_NODE(&sc->sysctl_ctx, - SYSCTL_STATIC_CHILDREN(_hw_mrsas), OID_AUTO, tmpstr2, - CTLFLAG_RD, 0, tmpstr); - if (sc->sysctl_tree == NULL) - return; - sysctl_ctx = &sc->sysctl_ctx; - sysctl_tree = sc->sysctl_tree; - } - SYSCTL_ADD_UINT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), - OID_AUTO, "disable_ocr", CTLFLAG_RW, &sc->disableOnlineCtrlReset, 0, - "Disable the use of OCR"); - - SYSCTL_ADD_STRING(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), - OID_AUTO, "driver_version", CTLFLAG_RD, MRSAS_VERSION, - strlen(MRSAS_VERSION), "driver version"); - - SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), - OID_AUTO, "reset_count", CTLFLAG_RD, - &sc->reset_count, 0, "number of ocr from start of the day"); - - SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), - OID_AUTO, "fw_outstanding", CTLFLAG_RD, - &sc->fw_outstanding, 0, "FW outstanding commands"); + struct sysctl_ctx_list *sysctl_ctx = NULL; + struct sysctl_oid *sysctl_tree = NULL; + char tmpstr[80], tmpstr2[80]; + + /* + * Setup the sysctl variable so the user can change the debug level + * on the fly. + */ + snprintf(tmpstr, sizeof(tmpstr), "MRSAS controller %d", + device_get_unit(sc->mrsas_dev)); + snprintf(tmpstr2, sizeof(tmpstr2), "%d", device_get_unit(sc->mrsas_dev)); + + sysctl_ctx = device_get_sysctl_ctx(sc->mrsas_dev); + if (sysctl_ctx != NULL) + sysctl_tree = device_get_sysctl_tree(sc->mrsas_dev); + + if (sysctl_tree == NULL) { + sysctl_ctx_init(&sc->sysctl_ctx); + sc->sysctl_tree = SYSCTL_ADD_NODE(&sc->sysctl_ctx, + SYSCTL_STATIC_CHILDREN(_hw_mrsas), OID_AUTO, tmpstr2, + CTLFLAG_RD, 0, tmpstr); + if (sc->sysctl_tree == NULL) + return; + sysctl_ctx = &sc->sysctl_ctx; + sysctl_tree = sc->sysctl_tree; + } + SYSCTL_ADD_UINT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "disable_ocr", CTLFLAG_RW, &sc->disableOnlineCtrlReset, 0, + "Disable the use of OCR"); + + SYSCTL_ADD_STRING(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "driver_version", CTLFLAG_RD, MRSAS_VERSION, + strlen(MRSAS_VERSION), "driver version"); SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), - OID_AUTO, "io_cmds_highwater", CTLFLAG_RD, - &sc->io_cmds_highwater, 0, "Max FW outstanding commands"); + OID_AUTO, "reset_count", CTLFLAG_RD, + &sc->reset_count, 0, "number of ocr from start of the day"); - SYSCTL_ADD_UINT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), - OID_AUTO, "mrsas_debug", CTLFLAG_RW, &sc->mrsas_debug, 0, - "Driver debug level"); + SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "fw_outstanding", CTLFLAG_RD, + &sc->fw_outstanding, 0, "FW outstanding commands"); - SYSCTL_ADD_UINT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), - OID_AUTO, "mrsas_io_timeout", CTLFLAG_RW, &sc->mrsas_io_timeout, - 0, "Driver IO timeout value in mili-second."); + SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "io_cmds_highwater", CTLFLAG_RD, + &sc->io_cmds_highwater, 0, "Max FW outstanding commands"); - SYSCTL_ADD_UINT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), - OID_AUTO, "mrsas_fw_fault_check_delay", CTLFLAG_RW, - &sc->mrsas_fw_fault_check_delay, - 0, "FW fault check thread delay in seconds. "); + SYSCTL_ADD_UINT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "mrsas_debug", CTLFLAG_RW, &sc->mrsas_debug, 0, + "Driver debug level"); + + SYSCTL_ADD_UINT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "mrsas_io_timeout", CTLFLAG_RW, &sc->mrsas_io_timeout, + 0, "Driver IO timeout value in mili-second."); + + SYSCTL_ADD_UINT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "mrsas_fw_fault_check_delay", CTLFLAG_RW, + &sc->mrsas_fw_fault_check_delay, + 0, "FW fault check thread delay in seconds. "); - SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), - OID_AUTO, "reset_in_progress", CTLFLAG_RD, - &sc->reset_in_progress, 0, "ocr in progress status"); + SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "reset_in_progress", CTLFLAG_RD, + &sc->reset_in_progress, 0, "ocr in progress status"); } -/** - * mrsas_get_tunables: get tunable parameters. - * input: Adapter instance soft state +/* + * mrsas_get_tunables: get tunable parameters. + * input: Adapter instance soft state * * Get tunable parameters. This will help to debug driver at boot time. */ static void mrsas_get_tunables(struct mrsas_softc *sc) { - char tmpstr[80]; + char tmpstr[80]; + + /* XXX default to some debugging for now */ + sc->mrsas_debug = MRSAS_FAULT; + sc->mrsas_io_timeout = MRSAS_IO_TIMEOUT; + sc->mrsas_fw_fault_check_delay = 1; + sc->reset_count = 0; + sc->reset_in_progress = 0; + + /* + * Grab the global variables. + */ + TUNABLE_INT_FETCH("hw.mrsas.debug_level", &sc->mrsas_debug); + + /* Grab the unit-instance variables */ + snprintf(tmpstr, sizeof(tmpstr), "dev.mrsas.%d.debug_level", + device_get_unit(sc->mrsas_dev)); + TUNABLE_INT_FETCH(tmpstr, &sc->mrsas_debug); +} - /* XXX default to some debugging for now */ - sc->mrsas_debug = MRSAS_FAULT; - sc->mrsas_io_timeout = MRSAS_IO_TIMEOUT; - sc->mrsas_fw_fault_check_delay = 1; - sc->reset_count = 0; - sc->reset_in_progress = 0; - - /* - * Grab the global variables. - */ - TUNABLE_INT_FETCH("hw.mrsas.debug_level", &sc->mrsas_debug); - - /* Grab the unit-instance variables */ - snprintf(tmpstr, sizeof(tmpstr), "dev.mrsas.%d.debug_level", - device_get_unit(sc->mrsas_dev)); - TUNABLE_INT_FETCH(tmpstr, &sc->mrsas_debug); -} - -/** - * mrsas_alloc_evt_log_info cmd: Allocates memory to get event log information. - * Used to get sequence number at driver load time. - * input: Adapter soft state +/* + * mrsas_alloc_evt_log_info cmd: Allocates memory to get event log information. + * Used to get sequence number at driver load time. + * input: Adapter soft state * * Allocates DMAable memory for the event log info internal command. */ -int mrsas_alloc_evt_log_info_cmd(struct mrsas_softc *sc) +int +mrsas_alloc_evt_log_info_cmd(struct mrsas_softc *sc) { - int el_info_size; + int el_info_size; + + /* Allocate get event log info command */ + el_info_size = sizeof(struct mrsas_evt_log_info); + if (bus_dma_tag_create(sc->mrsas_parent_tag, + 1, 0, + BUS_SPACE_MAXADDR_32BIT, + BUS_SPACE_MAXADDR, + NULL, NULL, + el_info_size, + 1, + el_info_size, + BUS_DMA_ALLOCNOW, + NULL, NULL, + &sc->el_info_tag)) { + device_printf(sc->mrsas_dev, "Cannot allocate event log info tag\n"); + return (ENOMEM); + } + if (bus_dmamem_alloc(sc->el_info_tag, (void **)&sc->el_info_mem, + BUS_DMA_NOWAIT, &sc->el_info_dmamap)) { + device_printf(sc->mrsas_dev, "Cannot allocate event log info cmd mem\n"); + return (ENOMEM); + } + if (bus_dmamap_load(sc->el_info_tag, sc->el_info_dmamap, + sc->el_info_mem, el_info_size, mrsas_addr_cb, + &sc->el_info_phys_addr, BUS_DMA_NOWAIT)) { + device_printf(sc->mrsas_dev, "Cannot load event log info cmd mem\n"); + return (ENOMEM); + } + memset(sc->el_info_mem, 0, el_info_size); + return (0); +} - /* Allocate get event log info command */ - el_info_size = sizeof(struct mrsas_evt_log_info); - if (bus_dma_tag_create( sc->mrsas_parent_tag, // parent - 1, 0, // algnmnt, boundary - BUS_SPACE_MAXADDR_32BIT,// lowaddr - BUS_SPACE_MAXADDR, // highaddr - NULL, NULL, // filter, filterarg - el_info_size, // maxsize - 1, // msegments - el_info_size, // maxsegsize - BUS_DMA_ALLOCNOW, // flags - NULL, NULL, // lockfunc, lockarg - &sc->el_info_tag)) { - device_printf(sc->mrsas_dev, "Cannot allocate event log info tag\n"); - return (ENOMEM); - } - if (bus_dmamem_alloc(sc->el_info_tag, (void **)&sc->el_info_mem, - BUS_DMA_NOWAIT, &sc->el_info_dmamap)) { - device_printf(sc->mrsas_dev, "Cannot allocate event log info cmd mem\n"); - return (ENOMEM); - } - if (bus_dmamap_load(sc->el_info_tag, sc->el_info_dmamap, - sc->el_info_mem, el_info_size, mrsas_addr_cb, - &sc->el_info_phys_addr, BUS_DMA_NOWAIT)) { - device_printf(sc->mrsas_dev, "Cannot load event log info cmd mem\n"); - return (ENOMEM); - } - - memset(sc->el_info_mem, 0, el_info_size); - return (0); -} - -/** - * mrsas_free_evt_info_cmd: Free memory for Event log info command - * input: Adapter soft state +/* + * mrsas_free_evt_info_cmd: Free memory for Event log info command + * input: Adapter soft state * * Deallocates memory for the event log info internal command. */ -void mrsas_free_evt_log_info_cmd(struct mrsas_softc *sc) +void +mrsas_free_evt_log_info_cmd(struct mrsas_softc *sc) { - if (sc->el_info_phys_addr) - bus_dmamap_unload(sc->el_info_tag, sc->el_info_dmamap); - if (sc->el_info_mem != NULL) - bus_dmamem_free(sc->el_info_tag, sc->el_info_mem, sc->el_info_dmamap); - if (sc->el_info_tag != NULL) - bus_dma_tag_destroy(sc->el_info_tag); + if (sc->el_info_phys_addr) + bus_dmamap_unload(sc->el_info_tag, sc->el_info_dmamap); + if (sc->el_info_mem != NULL) + bus_dmamem_free(sc->el_info_tag, sc->el_info_mem, sc->el_info_dmamap); + if (sc->el_info_tag != NULL) + bus_dma_tag_destroy(sc->el_info_tag); } -/** +/* * mrsas_get_seq_num: Get latest event sequence number * @sc: Adapter soft state * @eli: Firmware event log sequence number information. - * Firmware maintains a log of all events in a non-volatile area. - * Driver get the sequence number using DCMD - * "MR_DCMD_CTRL_EVENT_GET_INFO" at driver load time. + * + * Firmware maintains a log of all events in a non-volatile area. + * Driver get the sequence number using DCMD + * "MR_DCMD_CTRL_EVENT_GET_INFO" at driver load time. */ static int mrsas_get_seq_num(struct mrsas_softc *sc, - struct mrsas_evt_log_info *eli) + struct mrsas_evt_log_info *eli) { struct mrsas_mfi_cmd *cmd; struct mrsas_dcmd_frame *dcmd; - cmd = mrsas_get_mfi_cmd(sc); + cmd = mrsas_get_mfi_cmd(sc); if (!cmd) { device_printf(sc->mrsas_dev, "Failed to get a free cmd\n"); return -ENOMEM; } - dcmd = &cmd->frame->dcmd; if (mrsas_alloc_evt_log_info_cmd(sc) != SUCCESS) { @@ -541,7 +556,6 @@ mrsas_get_seq_num(struct mrsas_softc *sc mrsas_release_mfi_cmd(cmd); return -ENOMEM; } - memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE); dcmd->cmd = MFI_CMD_DCMD; @@ -558,8 +572,8 @@ mrsas_get_seq_num(struct mrsas_softc *sc mrsas_issue_blocked_cmd(sc, cmd); /* - * Copy the data back into callers buffer - */ + * Copy the data back into callers buffer + */ memcpy(eli, sc->el_info_mem, sizeof(struct mrsas_evt_log_info)); mrsas_free_evt_log_info_cmd(sc); mrsas_release_mfi_cmd(cmd); @@ -568,18 +582,19 @@ mrsas_get_seq_num(struct mrsas_softc *sc } -/** +/* * mrsas_register_aen: Register for asynchronous event notification - * @sc: Adapter soft state - * @seq_num: Starting sequence number - * @class_locale: Class of the event - * This function subscribes for events beyond the @seq_num - * and type @class_locale. - * - * */ + * @sc: Adapter soft state + * @seq_num: Starting sequence number + * @class_locale: Class of the event + * + * This function subscribes for events beyond the @seq_num + * and type @class_locale. + * + */ static int mrsas_register_aen(struct mrsas_softc *sc, u_int32_t seq_num, - u_int32_t class_locale_word) + u_int32_t class_locale_word) { int ret_val; struct mrsas_mfi_cmd *cmd; @@ -587,17 +602,16 @@ mrsas_register_aen(struct mrsas_softc *s union mrsas_evt_class_locale curr_aen; union mrsas_evt_class_locale prev_aen; -/* - * If there an AEN pending already (aen_cmd), check if the - * class_locale of that pending AEN is inclusive of the new - * AEN request we currently have. If it is, then we don't have - * to do anything. In other words, whichever events the current - * AEN request is subscribing to, have already been subscribed - * to. - * If the old_cmd is _not_ inclusive, then we have to abort - * that command, form a class_locale that is superset of both - * old and current and re-issue to the FW - * */ + /* + * If there an AEN pending already (aen_cmd), check if the + * class_locale of that pending AEN is inclusive of the new AEN + * request we currently have. If it is, then we don't have to do + * anything. In other words, whichever events the current AEN request + * is subscribing to, have already been subscribed to. If the old_cmd + * is _not_ inclusive, then we have to abort that command, form a + * class_locale that is superset of both old and current and re-issue + * to the FW + */ curr_aen.word = class_locale_word; @@ -605,21 +619,21 @@ mrsas_register_aen(struct mrsas_softc *s prev_aen.word = sc->aen_cmd->frame->dcmd.mbox.w[1]; -/* - * A class whose enum value is smaller is inclusive of all - * higher values. If a PROGRESS (= -1) was previously - * registered, then a new registration requests for higher - * classes need not be sent to FW. They are automatically - * included. - * Locale numbers don't have such hierarchy. They are bitmap values - */ + /* + * A class whose enum value is smaller is inclusive of all + * higher values. If a PROGRESS (= -1) was previously + * registered, then a new registration requests for higher + * classes need not be sent to FW. They are automatically + * included. Locale numbers don't have such hierarchy. They + * are bitmap values + */ if ((prev_aen.members.class <= curr_aen.members.class) && - !((prev_aen.members.locale & curr_aen.members.locale) ^ - curr_aen.members.locale)) { + !((prev_aen.members.locale & curr_aen.members.locale) ^ + curr_aen.members.locale)) { /* - * Previously issued event registration includes - * current request. Nothing to do. - */ + * Previously issued event registration includes + * current request. Nothing to do. + */ return 0; } else { curr_aen.members.locale |= prev_aen.members.locale; @@ -629,17 +643,16 @@ mrsas_register_aen(struct mrsas_softc *s sc->aen_cmd->abort_aen = 1; ret_val = mrsas_issue_blocked_abort_cmd(sc, - sc->aen_cmd); + sc->aen_cmd); if (ret_val) { printf("mrsas: Failed to abort " - "previous AEN command\n"); + "previous AEN command\n"); return ret_val; } } } - - cmd = mrsas_get_mfi_cmd(sc); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 12:18:17 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 25941217; Wed, 8 Oct 2014 12:18:17 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1220A7D7; Wed, 8 Oct 2014 12:18:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s98CIGPU056632; Wed, 8 Oct 2014 12:18:16 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s98CIGPk056631; Wed, 8 Oct 2014 12:18:16 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201410081218.s98CIGPk056631@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 8 Oct 2014 12:18:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272746 - head/sys/geom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 12:18:17 -0000 Author: ae Date: Wed Oct 8 12:18:16 2014 New Revision: 272746 URL: https://svnweb.freebsd.org/changeset/base/272746 Log: Add an ability to set dumpdev via loader(8) tunable. MFC after: 3 weeks Modified: head/sys/geom/geom_dev.c Modified: head/sys/geom/geom_dev.c ============================================================================== --- head/sys/geom/geom_dev.c Wed Oct 8 11:12:14 2014 (r272745) +++ head/sys/geom/geom_dev.c Wed Oct 8 12:18:16 2014 (r272746) @@ -82,6 +82,8 @@ static struct cdevsw g_dev_cdevsw = { .d_flags = D_DISK | D_TRACKCLOSE, }; +static g_init_t g_dev_init; +static g_fini_t g_dev_fini; static g_taste_t g_dev_taste; static g_orphan_t g_dev_orphan; static g_attrchanged_t g_dev_attrchanged; @@ -89,6 +91,8 @@ static g_attrchanged_t g_dev_attrchanged static struct g_class g_dev_class = { .name = "DEV", .version = G_VERSION, + .init = g_dev_init, + .fini = g_dev_fini, .taste = g_dev_taste, .orphan = g_dev_orphan, .attrchanged = g_dev_attrchanged @@ -107,6 +111,58 @@ SYSCTL_QUAD(_kern_geom_dev, OID_AUTO, de "delete request sent to the provider. Larger requests are chunked " "so they can be interrupted. (0 = disable chunking)"); +static char *dumpdev = NULL; +static void +g_dev_init(struct g_class *mp) +{ + + dumpdev = getenv("dumpdev"); +} + +static void +g_dev_fini(struct g_class *mp) +{ + + freeenv(dumpdev); +} + +static int +g_dev_setdumpdev(struct cdev *dev) +{ + struct g_kerneldump kd; + struct g_consumer *cp; + int error, len; + + if (dev == NULL) + return (set_dumper(NULL, NULL)); + + cp = dev->si_drv2; + len = sizeof(kd); + kd.offset = 0; + kd.length = OFF_MAX; + error = g_io_getattr("GEOM::kerneldump", cp, &len, &kd); + if (error == 0) { + error = set_dumper(&kd.di, devtoname(dev)); + if (error == 0) + dev->si_flags |= SI_DUMPDEV; + } + return (error); +} + +static void +init_dumpdev(struct cdev *dev) +{ + + if (dumpdev == NULL) + return; + if (strcmp(devtoname(dev), dumpdev) != 0) + return; + if (g_dev_setdumpdev(dev) == 0) { + freeenv(dumpdev); + dumpdev = NULL; + } +} + static void g_dev_destroy(void *arg, int flags __unused) { @@ -261,10 +317,12 @@ g_dev_taste(struct g_class *mp, struct g dev->si_iosize_max = MAXPHYS; dev->si_drv2 = cp; + init_dumpdev(dev); if (adev != NULL) { adev->si_iosize_max = MAXPHYS; adev->si_drv2 = cp; adev->si_flags |= SI_UNMAPPED; + init_dumpdev(adev); } g_dev_attrchanged(cp, "GEOM::physpath"); @@ -358,7 +416,6 @@ g_dev_ioctl(struct cdev *dev, u_long cmd { struct g_consumer *cp; struct g_provider *pp; - struct g_kerneldump kd; off_t offset, length, chunk; int i, error; @@ -395,19 +452,10 @@ g_dev_ioctl(struct cdev *dev, u_long cmd error = g_io_getattr("GEOM::frontstuff", cp, &i, data); break; case DIOCSKERNELDUMP: - if (*(u_int *)data == 0) { - error = set_dumper(NULL, NULL); - break; - } - kd.offset = 0; - kd.length = OFF_MAX; - i = sizeof kd; - error = g_io_getattr("GEOM::kerneldump", cp, &i, &kd); - if (error == 0) { - error = set_dumper(&kd.di, devtoname(dev)); - if (error == 0) - dev->si_flags |= SI_DUMPDEV; - } + if (*(u_int *)data == 0) + error = g_dev_setdumpdev(NULL); + else + error = g_dev_setdumpdev(dev); break; case DIOCGFLUSH: error = g_io_flush(cp); From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 12:19:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 883D6373; Wed, 8 Oct 2014 12:19:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 737447E7; Wed, 8 Oct 2014 12:19:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s98CJnE9056853; Wed, 8 Oct 2014 12:19:49 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s98CJntC056851; Wed, 8 Oct 2014 12:19:49 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201410081219.s98CJntC056851@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 8 Oct 2014 12:19:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272747 - head/sbin/dumpon X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 12:19:49 -0000 Author: ae Date: Wed Oct 8 12:19:48 2014 New Revision: 272747 URL: https://svnweb.freebsd.org/changeset/base/272747 Log: Revert r156046. We support setting dumpdev via loader tunable again. Also change default disk name to ada. MFC after: 3 weeks Modified: head/sbin/dumpon/dumpon.8 Modified: head/sbin/dumpon/dumpon.8 ============================================================================== --- head/sbin/dumpon/dumpon.8 Wed Oct 8 12:18:16 2014 (r272746) +++ head/sbin/dumpon/dumpon.8 Wed Oct 8 12:19:48 2014 (r272747) @@ -28,7 +28,7 @@ .\" From: @(#)swapon.8 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd April 29, 2013 +.Dd October 8, 2014 .Dt DUMPON 8 .Os .Sh NAME @@ -124,9 +124,18 @@ performs a on .Pa /dev/null and thus instructs the kernel not to save crash dumps. +.Pp +Since +.Nm +cannot be used during kernel initialization, the +.Va dumpdev +variable of +.Xr loader 8 +must be used to enable dumps for system panics which occur +during kernel initialization. .Sh FILES -.Bl -tag -width "/dev/{ad,da}?s?b" -compact -.It Pa /dev/{ad,da}?s?b +.Bl -tag -width "/dev/{ada,da}?s?b" -compact +.It Pa /dev/{ada,da}?s?b standard swap areas .It Pa /etc/rc.conf boot-time system configuration @@ -136,6 +145,7 @@ boot-time system configuration .Xr rc.conf 5 , .Xr config 8 , .Xr init 8 , +.Xr loader 8 , .Xr rc 8 , .Xr savecore 8 , .Xr swapon 8 , From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 12:24:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5F1A1510; Wed, 8 Oct 2014 12:24:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 407BF8A8; Wed, 8 Oct 2014 12:24:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s98COQiW060900; Wed, 8 Oct 2014 12:24:26 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s98COPZ2060897; Wed, 8 Oct 2014 12:24:25 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410081224.s98COPZ2060897@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 8 Oct 2014 12:24:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272748 - in head: sys/cam/ctl usr.sbin/ctladm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 12:24:26 -0000 Author: mav Date: Wed Oct 8 12:24:24 2014 New Revision: 272748 URL: https://svnweb.freebsd.org/changeset/base/272748 Log: Implement software (mode page) and hardware (config) write protection. Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_private.h head/usr.sbin/ctladm/ctladm.8 Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Wed Oct 8 12:19:48 2014 (r272747) +++ head/sys/cam/ctl/ctl.c Wed Oct 8 12:24:24 2014 (r272748) @@ -293,7 +293,7 @@ static struct scsi_control_page control_ /*page_length*/sizeof(struct scsi_control_page) - 2, /*rlec*/SCP_DSENSE, /*queue_flags*/SCP_QUEUE_ALG_MASK, - /*eca_and_aen*/0, + /*eca_and_aen*/SCP_SWP, /*flags4*/0, /*aen_holdoff_period*/{0, 0}, /*busy_timeout_period*/{0, 0}, @@ -4447,7 +4447,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft struct ctl_port *port; struct scsi_vpd_id_descriptor *desc; struct scsi_vpd_id_t10 *t10id; - const char *eui, *naa, *scsiname, *vendor; + const char *eui, *naa, *scsiname, *vendor, *value; int lun_number, i, lun_malloced; int devidlen, idlen1, idlen2 = 0, len; @@ -4609,6 +4609,10 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft if (be_lun->flags & CTL_LUN_FLAG_PRIMARY) lun->flags |= CTL_LUN_PRIMARY_SC; + value = ctl_get_opt(&be_lun->options, "readonly"); + if (value != NULL && strcmp(value, "on") == 0) + lun->flags |= CTL_LUN_READONLY; + lun->ctl_softc = ctl_softc; TAILQ_INIT(&lun->ooa_queue); TAILQ_INIT(&lun->blocked_queue); @@ -6219,6 +6223,14 @@ ctl_control_page_handler(struct ctl_scsi saved_cp->queue_flags |= user_cp->queue_flags & SCP_QUEUE_ALG_MASK; set_ua = 1; } + if ((current_cp->eca_and_aen & SCP_SWP) != + (user_cp->eca_and_aen & SCP_SWP)) { + current_cp->eca_and_aen &= ~SCP_SWP; + current_cp->eca_and_aen |= user_cp->eca_and_aen & SCP_SWP; + saved_cp->eca_and_aen &= ~SCP_SWP; + saved_cp->eca_and_aen |= user_cp->eca_and_aen & SCP_SWP; + set_ua = 1; + } if (set_ua != 0) { int i; /* @@ -7045,8 +7057,13 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) header = (struct scsi_mode_hdr_6 *)ctsio->kern_data_ptr; header->datalen = ctl_min(total_len - 1, 254); - if (control_dev == 0) + if (control_dev == 0) { header->dev_specific = 0x10; /* DPOFUA */ + if ((lun->flags & CTL_LUN_READONLY) || + (lun->mode_pages.control_page[CTL_PAGE_CURRENT] + .eca_and_aen & SCP_SWP) != 0) + header->dev_specific |= 0x80; /* WP */ + } if (dbd) header->block_descr_len = 0; else @@ -7063,8 +7080,13 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) datalen = ctl_min(total_len - 2, 65533); scsi_ulto2b(datalen, header->datalen); - if (control_dev == 0) + if (control_dev == 0) { header->dev_specific = 0x10; /* DPOFUA */ + if ((lun->flags & CTL_LUN_READONLY) || + (lun->mode_pages.control_page[CTL_PAGE_CURRENT] + .eca_and_aen & SCP_SWP) != 0) + header->dev_specific |= 0x80; /* WP */ + } if (dbd) scsi_ulto2b(0, header->block_descr_len); else @@ -11313,6 +11335,24 @@ ctl_scsiio_lun_check(struct ctl_softc *c } #endif + if (entry->pattern & CTL_LUN_PAT_WRITE) { + if (lun->flags & CTL_LUN_READONLY) { + ctl_set_sense(ctsio, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_DATA_PROTECT, + /*asc*/ 0x27, /*ascq*/ 0x01, SSD_ELEM_NONE); + retval = 1; + goto bailout; + } + if ((lun->mode_pages.control_page[CTL_PAGE_CURRENT] + .eca_and_aen & SCP_SWP) != 0) { + ctl_set_sense(ctsio, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_DATA_PROTECT, + /*asc*/ 0x27, /*ascq*/ 0x02, SSD_ELEM_NONE); + retval = 1; + goto bailout; + } + } + /* * Check for a reservation conflict. If this command isn't allowed * even on reserved LUNs, and if this initiator isn't the one who Modified: head/sys/cam/ctl/ctl_private.h ============================================================================== --- head/sys/cam/ctl/ctl_private.h Wed Oct 8 12:19:48 2014 (r272747) +++ head/sys/cam/ctl/ctl_private.h Wed Oct 8 12:24:24 2014 (r272748) @@ -198,7 +198,8 @@ typedef enum { CTL_LUN_OFFLINE = 0x080, CTL_LUN_PR_RESERVED = 0x100, CTL_LUN_PRIMARY_SC = 0x200, - CTL_LUN_SENSE_DESC = 0x400 + CTL_LUN_SENSE_DESC = 0x400, + CTL_LUN_READONLY = 0x800 } ctl_lun_flags; typedef enum { Modified: head/usr.sbin/ctladm/ctladm.8 ============================================================================== --- head/usr.sbin/ctladm/ctladm.8 Wed Oct 8 12:19:48 2014 (r272747) +++ head/usr.sbin/ctladm/ctladm.8 Wed Oct 8 12:24:24 2014 (r272748) @@ -34,7 +34,7 @@ .\" $Id: //depot/users/kenm/FreeBSD-test2/usr.sbin/ctladm/ctladm.8#3 $ .\" $FreeBSD$ .\" -.Dd September 13, 2014 +.Dd October 8, 2014 .Dt CTLADM 8 .Os .Sh NAME @@ -961,6 +961,9 @@ This allows to offload copying between d on the same host in trusted environments. .It Va readcache Set to "off", disables read caching for the LUN, if supported by the backend. +.It Va readonly +Set to "on", blocks all media write operations to the LUN, reporting it +as write protected. .It Va reordering Set to "unrestricted", allows target to process commands with SIMPLE task attribute in arbitrary order. Any data integrity exposures related to From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 12:33:32 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3BDE07E9; Wed, 8 Oct 2014 12:33:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 28A0699E; Wed, 8 Oct 2014 12:33:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s98CXW37065563; Wed, 8 Oct 2014 12:33:32 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s98CXWpD065562; Wed, 8 Oct 2014 12:33:32 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201410081233.s98CXWpD065562@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 8 Oct 2014 12:33:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272749 - head/sys/boot/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 12:33:32 -0000 Author: ae Date: Wed Oct 8 12:33:31 2014 New Revision: 272749 URL: https://svnweb.freebsd.org/changeset/base/272749 Log: Fix comment. MFC after: 1 week Modified: head/sys/boot/common/disk.h Modified: head/sys/boot/common/disk.h ============================================================================== --- head/sys/boot/common/disk.h Wed Oct 8 12:24:24 2014 (r272748) +++ head/sys/boot/common/disk.h Wed Oct 8 12:33:31 2014 (r272749) @@ -43,12 +43,12 @@ * BSD disklabel partition within an MBR slice: * * d_slice = MBR slice number (typically 1..4) - * d_partition = disklabel partition (typically 0..7) + * d_partition = disklabel partition (typically 0..19) * * BSD disklabel partition on the true dedicated disk: * * d_slice = -1 - * d_partition = disklabel partition (typically 0..7) + * d_partition = disklabel partition (typically 0..19) * * GPT partition: * @@ -71,7 +71,7 @@ * if there are multiple slices/partitions of a given type, the first one * is chosen. * - * The low-level disk device will typically call slice_open() from its open + * The low-level disk device will typically call disk_open() from its open * method to interpret the disk partition tables according to the rules above. * This will initialize d_offset to the block offset of the start of the * selected partition - this offset should be added to the offset passed to From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 12:48:50 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2C926B10; Wed, 8 Oct 2014 12:48:50 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0497EAB6; Wed, 8 Oct 2014 12:48:50 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-70-85-31.nwrknj.fios.verizon.net [173.70.85.31]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id CB0D2B93B; Wed, 8 Oct 2014 08:48:47 -0400 (EDT) From: John Baldwin To: Steven Hartland Subject: Re: svn commit: r272738 - in head/sys: dev/mrsas modules/mrsas modules/mrsas/mrsas_linux Date: Wed, 08 Oct 2014 08:48:37 -0400 Message-ID: <1896519.jz39uM6CZQ@ralph.baldwin.cx> User-Agent: KMail/4.12.5 (FreeBSD/10.1-BETA2; KDE/4.12.5; amd64; ; ) In-Reply-To: <81F46B899A5843B7B0D07649108D5A97@multiplay.co.uk> References: <201410080930.s989Uat9073960@svn.freebsd.org> <81F46B899A5843B7B0D07649108D5A97@multiplay.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 08 Oct 2014 08:48:47 -0400 (EDT) Cc: Kashyap D Desai , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 12:48:50 -0000 On Wednesday, October 08, 2014 10:50:47 AM Steven Hartland wrote: > I thought it was convension to avoid using $FreeBSD$ in code comments > instead use the __FBSDID e.g. > > #include > __FBSDID("$FreeBSD$"); > #include > > Could anyone confirm? > > Regards > Steve Yes, C files use __FBSDID(). I believe headers use a bare $FreeBSD$ comment after the license block. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 15:29:50 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4C1778BB; Wed, 8 Oct 2014 15:29:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3817EEAD; Wed, 8 Oct 2014 15:29:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s98FTomZ047955; Wed, 8 Oct 2014 15:29:50 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s98FToxK047954; Wed, 8 Oct 2014 15:29:50 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201410081529.s98FToxK047954@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 8 Oct 2014 15:29:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272750 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 15:29:50 -0000 Author: tuexen Date: Wed Oct 8 15:29:49 2014 New Revision: 272750 URL: https://svnweb.freebsd.org/changeset/base/272750 Log: Ensure that the number of stream reported in srs_number_streams is consistent with the amount of data provided in the SCTP_RESET_STREAMS socket option. Thanks to Peter Bostroem from Google for drawing my attention to this part of the code. Modified: head/sys/netinet/sctp_usrreq.c Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Wed Oct 8 12:33:31 2014 (r272749) +++ head/sys/netinet/sctp_usrreq.c Wed Oct 8 15:29:49 2014 (r272750) @@ -4431,6 +4431,12 @@ sctp_setopt(struct socket *so, int optna SCTP_TCB_UNLOCK(stcb); break; } + if (sizeof(struct sctp_reset_streams) + + strrst->srs_number_streams * sizeof(uint16_t) > optsize) { + error = EINVAL; + SCTP_TCB_UNLOCK(stcb); + break; + } if (stcb->asoc.stream_reset_outstanding) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EALREADY); error = EALREADY; From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 15:31:00 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8B863A12; Wed, 8 Oct 2014 15:31:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5EE57F40; Wed, 8 Oct 2014 15:31:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s98FV06D048865; Wed, 8 Oct 2014 15:31:00 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s98FUx7m048861; Wed, 8 Oct 2014 15:30:59 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201410081530.s98FUx7m048861@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 8 Oct 2014 15:30:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272751 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 15:31:00 -0000 Author: tuexen Date: Wed Oct 8 15:30:59 2014 New Revision: 272751 URL: https://svnweb.freebsd.org/changeset/base/272751 Log: Ensure that the list of streams sent in a stream reset parameter fits in an mbuf-cluster. Thanks to Peter Bostroem for drawing my attention to this part of the code. Modified: head/sys/netinet/sctp_output.c head/sys/netinet/sctp_output.h Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Wed Oct 8 15:29:49 2014 (r272750) +++ head/sys/netinet/sctp_output.c Wed Oct 8 15:30:59 2014 (r272751) @@ -11846,7 +11846,7 @@ sctp_add_an_in_stream(struct sctp_tmit_c int sctp_send_str_reset_req(struct sctp_tcb *stcb, - int number_entries, uint16_t * list, + uint16_t number_entries, uint16_t * list, uint8_t send_out_req, uint8_t send_in_req, uint8_t send_tsn_req, @@ -11879,6 +11879,14 @@ sctp_send_str_reset_req(struct sctp_tcb SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, EINVAL); return (EINVAL); } + if (number_entries > (MCLBYTES - + SCTP_MIN_OVERHEAD - + sizeof(struct sctp_chunkhdr) - + sizeof(struct sctp_stream_reset_out_request)) / + sizeof(uint16_t)) { + SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM); + return (ENOMEM); + } sctp_alloc_a_chunk(stcb, chk); if (chk == NULL) { SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM); Modified: head/sys/netinet/sctp_output.h ============================================================================== --- head/sys/netinet/sctp_output.h Wed Oct 8 15:29:49 2014 (r272750) +++ head/sys/netinet/sctp_output.h Wed Oct 8 15:30:59 2014 (r272751) @@ -181,8 +181,8 @@ sctp_add_stream_reset_result_tsn(struct uint32_t, uint32_t, uint32_t, uint32_t); int -sctp_send_str_reset_req(struct sctp_tcb *, int, uint16_t *, uint8_t, uint8_t, - uint8_t, uint8_t, uint16_t, uint16_t, uint8_t); +sctp_send_str_reset_req(struct sctp_tcb *, uint16_t, uint16_t *, uint8_t, + uint8_t, uint8_t, uint8_t, uint16_t, uint16_t, uint8_t); void sctp_send_abort(struct mbuf *, int, struct sockaddr *, struct sockaddr *, From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 15:57:36 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3AA468B5; Wed, 8 Oct 2014 15:57:36 +0000 (UTC) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id BB52A286; Wed, 8 Oct 2014 15:57:35 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 9E1AE25D388C; Wed, 8 Oct 2014 15:57:31 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id B9F56C7700E; Wed, 8 Oct 2014 15:57:30 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id BdPkt32o8XSW; Wed, 8 Oct 2014 15:57:27 +0000 (UTC) Received: from [IPv6:fde9:577b:c1a9:4420:cabc:c8ff:fe8b:4fe6] (orange-tun0-ula.sbone.de [IPv6:fde9:577b:c1a9:4420:cabc:c8ff:fe8b:4fe6]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id B5C34C76FD3; Wed, 8 Oct 2014 15:57:26 +0000 (UTC) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r272738 - in head/sys: dev/mrsas modules/mrsas modules/mrsas/mrsas_linux From: "Bjoern A. Zeeb" In-Reply-To: <201410080930.s989Uat9073960@svn.freebsd.org> Date: Wed, 8 Oct 2014 15:57:25 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <3F8BC7C7-412E-47E8-8837-CB95738C3512@lists.zabbadoz.net> References: <201410080930.s989Uat9073960@svn.freebsd.org> To: Kashyap D Desai X-Mailer: Apple Mail (2.1878.6) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 15:57:36 -0000 On 08 Oct 2014, at 09:30 , Kashyap D Desai wrote: > Author: kadesai > Date: Wed Oct 8 09:30:35 2014 > New Revision: 272738 > URL: https://svnweb.freebsd.org/changeset/base/272738 >=20 > Log: > Fix the minor svn add issue. $FreeBSD$ expands at the time of > snv add, so I have added $FreeBSD$ as comment. >=20 > This commit is contininous of last mrsas commit, so that compilation > does not break. >=20 So i386.XEN seems broken when I do a universe currently; could you = check? In file included from = /scratch/tmp/bz/head.svn/sys/modules/mrsas/mrsas_linux/../../../dev/mrsas/= mrsas_linux.c:66: @/dev/mrsas/mrsas.h:516:3: error: typedef redefinition with different = types ('struct atomic_t' vs 'struct atomic_t') } atomic_t; ^ ./machine/xen/xen-os.h:157:42: note: previous definition is here typedef struct { volatile int counter; } atomic_t; ^ In file included from = /scratch/tmp/bz/head.svn/sys/modules/mrsas/mrsas_linux/../../../dev/mrsas/= mrsas_linux.c:66: @/dev/mrsas/mrsas.h:2580:1: error: redefinition of 'clear_bit' clear_bit(int b, volatile void *p) ^ ./machine/xen/xen-os.h:258:24: note: previous definition is here static __inline__ void clear_bit(int nr, volatile void * addr) ^ In file included from = /scratch/tmp/bz/head.svn/sys/modules/mrsas/mrsas_linux/../../../dev/mrsas/= mrsas_linux.c:66: @/dev/mrsas/mrsas.h:2586:1: error: redefinition of 'set_bit' set_bit(int b, volatile void *p) ^ ./machine/xen/xen-os.h:240:24: note: previous definition is here static __inline__ void set_bit(int nr, volatile void * addr) ^ In file included from = /scratch/tmp/bz/head.svn/sys/modules/mrsas/mrsas_linux/../../../dev/mrsas/= mrsas_linux.c:66: @/dev/mrsas/mrsas.h:2592:1: error: expected ')' test_bit(int b, volatile void *p) ^ ./machine/xen/xen-os.h:225:27: note: expanded from macro 'test_bit' (__builtin_constant_p(nr) ? \ ^ @/dev/mrsas/mrsas.h:2592:1: note: to match this '(' ./machine/xen/xen-os.h:224:27: note: expanded from macro 'test_bit' #define test_bit(nr,addr) \ ^ In file included from = /scratch/tmp/bz/head.svn/sys/modules/mrsas/mrsas_linux/../../../dev/mrsas/= mrsas_linux.c:66: @/dev/mrsas/mrsas.h:2592:1: error: static declaration of = '__builtin_constant_p' follows non-static declaration test_bit(int b, volatile void *p) ^ ./machine/xen/xen-os.h:225:2: note: expanded from macro 'test_bit' (__builtin_constant_p(nr) ? \ ^ ./x86/endian.h:122:10: note: previous implicit declaration is here return (__bswap64_gen(_x)); ^ ./x86/endian.h:70:16: note: expanded from macro '__bswap64_gen' (((__uint64_t)__bswap32((x) & 0xffffffff) << 32) | __bswap32((x) = >> 32)) ^ ./x86/endian.h:77:3: note: expanded from macro '__bswap32' (__builtin_constant_p(x) ? \ ^ In file included from = /scratch/tmp/bz/head.svn/sys/modules/mrsas/mrsas_linux/../../../dev/mrsas/= mrsas_linux.c:66: @/dev/mrsas/mrsas.h:2592:1: error: definition of builtin function = '__builtin_constant_p' test_bit(int b, volatile void *p) ^ ./machine/xen/xen-os.h:225:2: note: expanded from macro 'test_bit' (__builtin_constant_p(nr) ? \ ^ In file included from = /scratch/tmp/bz/head.svn/sys/modules/mrsas/mrsas_linux/../../../dev/mrsas/= mrsas_linux.c:66: @/dev/mrsas/mrsas.h:2594:26: error: use of undeclared identifier 'p' return ((volatile int *)p)[b >> 5] & (1 << (b & 0x1f)); ^ 7 errors generated. --- mrsas_linux.o --- *** [mrsas_linux.o] Error code 1 > Obtained from: AVAGO Technologies > MFC after: 2 weeks >=20 > Modified: > head/sys/dev/mrsas/mrsas_linux.c > head/sys/modules/mrsas/Makefile > head/sys/modules/mrsas/mrsas_linux/Makefile >=20 > Modified: head/sys/dev/mrsas/mrsas_linux.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/mrsas/mrsas_linux.c Wed Oct 8 09:19:35 2014 = (r272737) > +++ head/sys/dev/mrsas/mrsas_linux.c Wed Oct 8 09:30:35 2014 = (r272738) > @@ -39,10 +39,10 @@ > * Mail to: LSI Corporation, 1621 Barber Lane, Milpitas, CA 95035 > * ATTN: MegaRaid FreeBSD > * > + * $FreeBSD$ > */ >=20 > #include > - >=20 > #include > #include >=20 > Modified: head/sys/modules/mrsas/Makefile > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/modules/mrsas/Makefile Wed Oct 8 09:19:35 2014 = (r272737) > +++ head/sys/modules/mrsas/Makefile Wed Oct 8 09:30:35 2014 = (r272738) > @@ -1,5 +1,5 @@ > # Makefile for mrsas driver > - > +# $FreeBSD$ >=20 > KMOD=3Dmrsas > .PATH: ${.CURDIR}/../../dev/${KMOD} >=20 > Modified: head/sys/modules/mrsas/mrsas_linux/Makefile > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/modules/mrsas/mrsas_linux/Makefile Wed Oct 8 = 09:19:35 2014 (r272737) > +++ head/sys/modules/mrsas/mrsas_linux/Makefile Wed Oct 8 = 09:30:35 2014 (r272738) > @@ -1,5 +1,5 @@ > # Makefile for mrsas driver > - > +# $FreeBSD$ >=20 > .PATH: ${.CURDIR}/../../../dev/mrsas >=20 >=20 =97=20 Bjoern A. Zeeb "Come on. Learn, goddamn it.", WarGames, 1983 From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 16:22:27 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2425622E; Wed, 8 Oct 2014 16:22:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1050B7D5; Wed, 8 Oct 2014 16:22:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s98GMQow076262; Wed, 8 Oct 2014 16:22:26 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s98GMQxu076260; Wed, 8 Oct 2014 16:22:26 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410081622.s98GMQxu076260@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 8 Oct 2014 16:22:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272756 - head/sys/dev/mpr X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 16:22:27 -0000 Author: mav Date: Wed Oct 8 16:22:26 2014 New Revision: 272756 URL: https://svnweb.freebsd.org/changeset/base/272756 Log: Properly report 12Gbps connection rate. Reviewed by: kadesai, slm MFC after: 1 week Modified: head/sys/dev/mpr/mpr_sas.c head/sys/dev/mpr/mpr_table.c Modified: head/sys/dev/mpr/mpr_sas.c ============================================================================== --- head/sys/dev/mpr/mpr_sas.c Wed Oct 8 15:58:28 2014 (r272755) +++ head/sys/dev/mpr/mpr_sas.c Wed Oct 8 16:22:26 2014 (r272756) @@ -1043,6 +1043,9 @@ mprsas_action(struct cam_sim *sim, union case 0x0a: sas->bitrate = 600000; break; + case 0x0b: + sas->bitrate = 1200000; + break; default: sas->valid = 0; } Modified: head/sys/dev/mpr/mpr_table.c ============================================================================== --- head/sys/dev/mpr/mpr_table.c Wed Oct 8 15:58:28 2014 (r272755) +++ head/sys/dev/mpr/mpr_table.c Wed Oct 8 16:22:26 2014 (r272756) @@ -118,6 +118,7 @@ struct mpr_table_lookup mpr_linkrate_nam {"1.5Gbps", 0x08}, {"3.0Gbps", 0x09}, {"6.0Gbps", 0x0a}, + {"12.0Gbps", 0x0b}, {NULL, 0}, {"LinkRate Unknown", 0x00} }; From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 16:23:00 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 480D336D; Wed, 8 Oct 2014 16:23:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 33C507DC; Wed, 8 Oct 2014 16:23:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s98GN0un076375; Wed, 8 Oct 2014 16:23:00 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s98GMxdO076371; Wed, 8 Oct 2014 16:22:59 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201410081622.s98GMxdO076371@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 8 Oct 2014 16:22:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272757 - in head: sys/kern tools/sched X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 16:23:00 -0000 Author: jhb Date: Wed Oct 8 16:22:59 2014 New Revision: 272757 URL: https://svnweb.freebsd.org/changeset/base/272757 Log: Add schedgraph traces for callout handlers. Specifically, a callwheel logs a running event each time it executes a callout function. The event includes the function pointer, argument, and whether or not it was run from hardware interrupt context. The callwheel is marked idle when each handler completes. This effectively logs the duration of each callout routine in the graph. Modified: head/sys/kern/kern_timeout.c head/tools/sched/schedgraph.py Modified: head/sys/kern/kern_timeout.c ============================================================================== --- head/sys/kern/kern_timeout.c Wed Oct 8 16:22:26 2014 (r272756) +++ head/sys/kern/kern_timeout.c Wed Oct 8 16:22:59 2014 (r272757) @@ -163,6 +163,7 @@ struct callout_cpu { sbintime_t cc_lastscan; void *cc_cookie; u_int cc_bucket; + char cc_ktr_event_name[20]; }; #define cc_exec_curr cc_exec_entity[0].cc_curr @@ -201,7 +202,7 @@ struct callout_cpu cc_cpu; static int timeout_cpu; -static void callout_cpu_init(struct callout_cpu *cc); +static void callout_cpu_init(struct callout_cpu *cc, int cpu); static void softclock_call_cc(struct callout *c, struct callout_cpu *cc, #ifdef CALLOUT_PROFILING int *mpcalls, int *lockcalls, int *gcalls, @@ -302,7 +303,7 @@ callout_callwheel_init(void *dummy) cc = CC_CPU(timeout_cpu); cc->cc_callout = malloc(ncallout * sizeof(struct callout), M_CALLOUT, M_WAITOK); - callout_cpu_init(cc); + callout_cpu_init(cc, timeout_cpu); } SYSINIT(callwheel_init, SI_SUB_CPU, SI_ORDER_ANY, callout_callwheel_init, NULL); @@ -310,7 +311,7 @@ SYSINIT(callwheel_init, SI_SUB_CPU, SI_O * Initialize the per-cpu callout structures. */ static void -callout_cpu_init(struct callout_cpu *cc) +callout_cpu_init(struct callout_cpu *cc, int cpu) { struct callout *c; int i; @@ -325,6 +326,8 @@ callout_cpu_init(struct callout_cpu *cc) cc->cc_firstevent = SBT_MAX; for (i = 0; i < 2; i++) cc_cce_cleanup(cc, i); + snprintf(cc->cc_ktr_event_name, sizeof(cc->cc_ktr_event_name), + "callwheel cpu %d", cpu); if (cc->cc_callout == NULL) /* Only cpu0 handles timeout(9) */ return; for (i = 0; i < ncallout; i++) { @@ -396,7 +399,7 @@ start_softclock(void *dummy) continue; cc = CC_CPU(cpu); cc->cc_callout = NULL; /* Only cpu0 handles timeout(9). */ - callout_cpu_init(cc); + callout_cpu_init(cc, cpu); snprintf(name, sizeof(name), "clock (%d)", cpu); ie = NULL; if (swi_add(&ie, name, softclock, cc, SWI_CLOCK, @@ -711,6 +714,8 @@ softclock_call_cc(struct callout *c, str CTR3(KTR_CALLOUT, "callout %p func %p arg %p", c, c_func, c_arg); } + KTR_STATE3(KTR_SCHED, "callout", cc->cc_ktr_event_name, "running", + "func:%p", c_func, "arg:%p", c_arg, "direct:%d", direct); #if defined(DIAGNOSTIC) || defined(CALLOUT_PROFILING) sbt1 = sbinuptime(); #endif @@ -733,6 +738,7 @@ softclock_call_cc(struct callout *c, str lastfunc = c_func; } #endif + KTR_STATE0(KTR_SCHED, "callout", cc->cc_ktr_event_name, "idle"); CTR1(KTR_CALLOUT, "callout %p finished", c); if ((c_flags & CALLOUT_RETURNUNLOCKED) == 0) class->lc_unlock(c_lock); Modified: head/tools/sched/schedgraph.py ============================================================================== --- head/tools/sched/schedgraph.py Wed Oct 8 16:22:26 2014 (r272756) +++ head/tools/sched/schedgraph.py Wed Oct 8 16:22:59 2014 (r272757) @@ -80,8 +80,6 @@ eventcolors = [ ("runq rem", "yellow"), ("thread exit", "grey"), ("proc exit", "grey"), - ("callwheel idle", "grey"), - ("callout running", "green"), ("lock acquire", "blue"), ("lock contest", "purple"), ("failed lock try", "red"), @@ -903,7 +901,6 @@ class KTRFile: self.timestamp_f = None self.timestamp_l = None self.locks = {} - self.callwheels = {} self.ticks = {} self.load = {} self.crit = {} From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 16:48:06 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2B6B44E6; Wed, 8 Oct 2014 16:48:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0C4A0A37; Wed, 8 Oct 2014 16:48:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s98Gm5Yl087396; Wed, 8 Oct 2014 16:48:05 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s98Gm4mn087390; Wed, 8 Oct 2014 16:48:04 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201410081648.s98Gm4mn087390@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 8 Oct 2014 16:48:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272761 - in head/sys: amd64/amd64 amd64/include dev/drm2/i915 i386/i386 i386/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 16:48:06 -0000 Author: kib Date: Wed Oct 8 16:48:03 2014 New Revision: 272761 URL: https://svnweb.freebsd.org/changeset/base/272761 Log: Add an argument to the x86 pmap_invalidate_cache_range() to request forced invalidation of the cache range regardless of the presence of self-snoop feature. Some recent Intel GPUs in some modes are not coherent, and dirty lines in CPU cache must be flushed before the pages are transferred to GPU domain. Reviewed by: alc (previous version) Tested by: pho (amd64) Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/amd64/amd64/pmap.c head/sys/amd64/include/pmap.h head/sys/dev/drm2/i915/intel_ringbuffer.c head/sys/i386/i386/pmap.c head/sys/i386/i386/vm_machdep.c head/sys/i386/include/pmap.h Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Wed Oct 8 16:35:57 2014 (r272760) +++ head/sys/amd64/amd64/pmap.c Wed Oct 8 16:48:03 2014 (r272761) @@ -1710,16 +1710,20 @@ pmap_update_pde(pmap_t pmap, vm_offset_t #define PMAP_CLFLUSH_THRESHOLD (2 * 1024 * 1024) void -pmap_invalidate_cache_range(vm_offset_t sva, vm_offset_t eva) +pmap_invalidate_cache_range(vm_offset_t sva, vm_offset_t eva, boolean_t force) { - KASSERT((sva & PAGE_MASK) == 0, - ("pmap_invalidate_cache_range: sva not page-aligned")); - KASSERT((eva & PAGE_MASK) == 0, - ("pmap_invalidate_cache_range: eva not page-aligned")); + if (force) { + sva &= ~(vm_offset_t)cpu_clflush_line_size; + } else { + KASSERT((sva & PAGE_MASK) == 0, + ("pmap_invalidate_cache_range: sva not page-aligned")); + KASSERT((eva & PAGE_MASK) == 0, + ("pmap_invalidate_cache_range: eva not page-aligned")); + } - if (cpu_feature & CPUID_SS) - ; /* If "Self Snoop" is supported, do nothing. */ + if ((cpu_feature & CPUID_SS) != 0 && !force) + ; /* If "Self Snoop" is supported and allowed, do nothing. */ else if ((cpu_feature & CPUID_CLFSH) != 0 && eva - sva < PMAP_CLFLUSH_THRESHOLD) { @@ -6222,7 +6226,7 @@ pmap_mapdev_attr(vm_paddr_t pa, vm_size_ for (tmpsize = 0; tmpsize < size; tmpsize += PAGE_SIZE) pmap_kenter_attr(va + tmpsize, pa + tmpsize, mode); pmap_invalidate_range(kernel_pmap, va, va + tmpsize); - pmap_invalidate_cache_range(va, va + tmpsize); + pmap_invalidate_cache_range(va, va + tmpsize, FALSE); return ((void *)(va + offset)); } @@ -6558,7 +6562,7 @@ pmap_change_attr_locked(vm_offset_t va, */ if (changed) { pmap_invalidate_range(kernel_pmap, base, tmpva); - pmap_invalidate_cache_range(base, tmpva); + pmap_invalidate_cache_range(base, tmpva, FALSE); } return (error); } Modified: head/sys/amd64/include/pmap.h ============================================================================== --- head/sys/amd64/include/pmap.h Wed Oct 8 16:35:57 2014 (r272760) +++ head/sys/amd64/include/pmap.h Wed Oct 8 16:48:03 2014 (r272761) @@ -394,7 +394,8 @@ void pmap_invalidate_range(pmap_t, vm_of void pmap_invalidate_all(pmap_t); void pmap_invalidate_cache(void); void pmap_invalidate_cache_pages(vm_page_t *pages, int count); -void pmap_invalidate_cache_range(vm_offset_t sva, vm_offset_t eva); +void pmap_invalidate_cache_range(vm_offset_t sva, vm_offset_t eva, + boolean_t force); void pmap_get_mapping(pmap_t pmap, vm_offset_t va, uint64_t *ptr, int *num); #endif /* _KERNEL */ Modified: head/sys/dev/drm2/i915/intel_ringbuffer.c ============================================================================== --- head/sys/dev/drm2/i915/intel_ringbuffer.c Wed Oct 8 16:35:57 2014 (r272760) +++ head/sys/dev/drm2/i915/intel_ringbuffer.c Wed Oct 8 16:48:03 2014 (r272761) @@ -366,7 +366,7 @@ init_pipe_control(struct intel_ring_buff goto err_unpin; pmap_qenter((uintptr_t)pc->cpu_page, &obj->pages[0], 1); pmap_invalidate_cache_range((vm_offset_t)pc->cpu_page, - (vm_offset_t)pc->cpu_page + PAGE_SIZE); + (vm_offset_t)pc->cpu_page + PAGE_SIZE, FALSE); pc->obj = obj; ring->private = pc; @@ -1014,7 +1014,7 @@ static int init_status_page(struct intel pmap_qenter((vm_offset_t)ring->status_page.page_addr, &obj->pages[0], 1); pmap_invalidate_cache_range((vm_offset_t)ring->status_page.page_addr, - (vm_offset_t)ring->status_page.page_addr + PAGE_SIZE); + (vm_offset_t)ring->status_page.page_addr + PAGE_SIZE, FALSE); ring->status_page.obj = obj; memset(ring->status_page.page_addr, 0, PAGE_SIZE); Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Wed Oct 8 16:35:57 2014 (r272760) +++ head/sys/i386/i386/pmap.c Wed Oct 8 16:48:03 2014 (r272761) @@ -1172,16 +1172,20 @@ pmap_update_pde(pmap_t pmap, vm_offset_t #define PMAP_CLFLUSH_THRESHOLD (2 * 1024 * 1024) void -pmap_invalidate_cache_range(vm_offset_t sva, vm_offset_t eva) +pmap_invalidate_cache_range(vm_offset_t sva, vm_offset_t eva, boolean_t force) { - KASSERT((sva & PAGE_MASK) == 0, - ("pmap_invalidate_cache_range: sva not page-aligned")); - KASSERT((eva & PAGE_MASK) == 0, - ("pmap_invalidate_cache_range: eva not page-aligned")); + if (force) { + sva &= ~(vm_offset_t)cpu_clflush_line_size; + } else { + KASSERT((sva & PAGE_MASK) == 0, + ("pmap_invalidate_cache_range: sva not page-aligned")); + KASSERT((eva & PAGE_MASK) == 0, + ("pmap_invalidate_cache_range: eva not page-aligned")); + } - if (cpu_feature & CPUID_SS) - ; /* If "Self Snoop" is supported, do nothing. */ + if ((cpu_feature & CPUID_SS) != 0 && !force) + ; /* If "Self Snoop" is supported and allowed, do nothing. */ else if ((cpu_feature & CPUID_CLFSH) != 0 && eva - sva < PMAP_CLFLUSH_THRESHOLD) { @@ -5164,7 +5168,7 @@ pmap_mapdev_attr(vm_paddr_t pa, vm_size_ for (tmpsize = 0; tmpsize < size; tmpsize += PAGE_SIZE) pmap_kenter_attr(va + tmpsize, pa + tmpsize, mode); pmap_invalidate_range(kernel_pmap, va, va + tmpsize); - pmap_invalidate_cache_range(va, va + size); + pmap_invalidate_cache_range(va, va + size, FALSE); return ((void *)(va + offset)); } @@ -5370,7 +5374,7 @@ pmap_change_attr(vm_offset_t va, vm_size */ if (changed) { pmap_invalidate_range(kernel_pmap, base, tmpva); - pmap_invalidate_cache_range(base, tmpva); + pmap_invalidate_cache_range(base, tmpva, FALSE); } return (0); } Modified: head/sys/i386/i386/vm_machdep.c ============================================================================== --- head/sys/i386/i386/vm_machdep.c Wed Oct 8 16:35:57 2014 (r272760) +++ head/sys/i386/i386/vm_machdep.c Wed Oct 8 16:48:03 2014 (r272761) @@ -813,7 +813,7 @@ sf_buf_invalidate(struct sf_buf *sf) * settings are recalculated. */ pmap_qenter(sf->kva, &m, 1); - pmap_invalidate_cache_range(sf->kva, sf->kva + PAGE_SIZE); + pmap_invalidate_cache_range(sf->kva, sf->kva + PAGE_SIZE, FALSE); } /* Modified: head/sys/i386/include/pmap.h ============================================================================== --- head/sys/i386/include/pmap.h Wed Oct 8 16:35:57 2014 (r272760) +++ head/sys/i386/include/pmap.h Wed Oct 8 16:48:03 2014 (r272761) @@ -458,7 +458,8 @@ void pmap_invalidate_range(pmap_t, vm_of void pmap_invalidate_all(pmap_t); void pmap_invalidate_cache(void); void pmap_invalidate_cache_pages(vm_page_t *pages, int count); -void pmap_invalidate_cache_range(vm_offset_t sva, vm_offset_t eva); +void pmap_invalidate_cache_range(vm_offset_t sva, vm_offset_t eva, + boolean_t force); #endif /* _KERNEL */ From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 17:40:59 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 72EFEE76; Wed, 8 Oct 2014 17:40:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5E6EAFEC; Wed, 8 Oct 2014 17:40:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s98HexIr015982; Wed, 8 Oct 2014 17:40:59 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s98Hex9U015981; Wed, 8 Oct 2014 17:40:59 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201410081740.s98Hex9U015981@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 8 Oct 2014 17:40:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272762 - head/usr.bin/find X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 17:40:59 -0000 Author: emaste Date: Wed Oct 8 17:40:58 2014 New Revision: 272762 URL: https://svnweb.freebsd.org/changeset/base/272762 Log: Correct scale factor for T terabyte suffix PR: 194250 MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/usr.bin/find/function.c Modified: head/usr.bin/find/function.c ============================================================================== --- head/usr.bin/find/function.c Wed Oct 8 16:48:03 2014 (r272761) +++ head/usr.bin/find/function.c Wed Oct 8 17:40:58 2014 (r272762) @@ -1506,7 +1506,7 @@ c_size(OPTION *option, char ***argvp) scale = 0x40000000LL; break; case 'T': /* terabytes 1<<40 */ - scale = 0x1000000000LL; + scale = 0x10000000000LL; break; case 'P': /* petabytes 1<<50 */ scale = 0x4000000000000LL; From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 17:44:31 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3AD3730A; Wed, 8 Oct 2014 17:44:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 23B23152; Wed, 8 Oct 2014 17:44:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s98HiV33017419; Wed, 8 Oct 2014 17:44:31 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s98HiV4U017418; Wed, 8 Oct 2014 17:44:31 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201410081744.s98HiV4U017418@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 8 Oct 2014 17:44:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272763 - head/usr.sbin/newsyslog X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 17:44:31 -0000 Author: markj Date: Wed Oct 8 17:44:30 2014 New Revision: 272763 URL: https://svnweb.freebsd.org/changeset/base/272763 Log: If we fail to send a signal after rotation, print the pidfile from which the corresponding PID was obtained. PR: 194143 Submitted by: Lyndon Nerenberg MFC after: 1 week Modified: head/usr.sbin/newsyslog/newsyslog.c Modified: head/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- head/usr.sbin/newsyslog/newsyslog.c Wed Oct 8 17:40:58 2014 (r272762) +++ head/usr.sbin/newsyslog/newsyslog.c Wed Oct 8 17:44:30 2014 (r272763) @@ -1968,8 +1968,8 @@ do_sigwork(struct sigwork_entry *swork) */ if (errno != ESRCH) swork->sw_pidok = 0; - warn("can't notify %s, pid %d", swork->sw_pidtype, - (int)swork->sw_pid); + warn("can't notify %s, pid %d = %s", swork->sw_pidtype, + (int)swork->sw_pid, swork->sw_fname); } else { if (verbose) printf("Notified %s pid %d = %s\n", swork->sw_pidtype, From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 19:49:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 89D2C8AA; Wed, 8 Oct 2014 19:49:11 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 764D4264; Wed, 8 Oct 2014 19:49:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s98JnBoY074244; Wed, 8 Oct 2014 19:49:11 GMT (envelope-from gavin@FreeBSD.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s98JnBwp074243; Wed, 8 Oct 2014 19:49:11 GMT (envelope-from gavin@FreeBSD.org) Message-Id: <201410081949.s98JnBwp074243@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gavin set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson Date: Wed, 8 Oct 2014 19:49:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272764 - head/sys/dev/usb/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 19:49:11 -0000 Author: gavin Date: Wed Oct 8 19:49:10 2014 New Revision: 272764 URL: https://svnweb.freebsd.org/changeset/base/272764 Log: It looks like an entry for the R215 is not required in cdce(4) after all. Modified: head/sys/dev/usb/net/if_cdce.c Modified: head/sys/dev/usb/net/if_cdce.c ============================================================================== --- head/sys/dev/usb/net/if_cdce.c Wed Oct 8 17:44:30 2014 (r272763) +++ head/sys/dev/usb/net/if_cdce.c Wed Oct 8 19:49:10 2014 (r272764) @@ -273,7 +273,6 @@ static const struct usb_ether_methods cd static const STRUCT_USB_HOST_ID cdce_switch_devs[] = { {USB_VPI(USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E3272_INIT, MSC_EJECT_HUAWEI2)}, - {USB_VPI(USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_R215_INIT, MSC_EJECT_HUAWEI2)}, }; static const STRUCT_USB_HOST_ID cdce_host_devs[] = { From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 19:54:42 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E1442B83; Wed, 8 Oct 2014 19:54:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CE5D135D; Wed, 8 Oct 2014 19:54:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s98Jsgb5078451; Wed, 8 Oct 2014 19:54:42 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s98Jsg3l078450; Wed, 8 Oct 2014 19:54:42 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410081954.s98Jsg3l078450@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 8 Oct 2014 19:54:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272765 - head/sys/dev/iscsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 19:54:43 -0000 Author: mav Date: Wed Oct 8 19:54:42 2014 New Revision: 272765 URL: https://svnweb.freebsd.org/changeset/base/272765 Log: Remove one second wait for threads exit from icl_conn_close(). Switch it from polling with pause() to using cv_wait()/cv_signal(). Modified: head/sys/dev/iscsi/icl.c Modified: head/sys/dev/iscsi/icl.c ============================================================================== --- head/sys/dev/iscsi/icl.c Wed Oct 8 19:49:10 2014 (r272764) +++ head/sys/dev/iscsi/icl.c Wed Oct 8 19:54:42 2014 (r272765) @@ -771,6 +771,7 @@ icl_receive_thread(void *arg) ICL_CONN_LOCK(ic); ic->ic_receive_running = false; + cv_signal(&ic->ic_send_cv); ICL_CONN_UNLOCK(ic); kthread_exit(); } @@ -1023,6 +1024,7 @@ icl_send_thread(void *arg) STAILQ_CONCAT(&ic->ic_to_send, &queue); ic->ic_send_running = false; + cv_signal(&ic->ic_send_cv); ICL_CONN_UNLOCK(ic); kthread_exit(); } @@ -1342,15 +1344,11 @@ icl_conn_close(struct icl_conn *ic) /* * Wake up the threads, so they can properly terminate. */ - cv_signal(&ic->ic_receive_cv); - cv_signal(&ic->ic_send_cv); while (ic->ic_receive_running || ic->ic_send_running) { //ICL_DEBUG("waiting for send/receive threads to terminate"); - ICL_CONN_UNLOCK(ic); cv_signal(&ic->ic_receive_cv); cv_signal(&ic->ic_send_cv); - pause("icl_close", 1 * hz); - ICL_CONN_LOCK(ic); + cv_wait(&ic->ic_send_cv, ic->ic_lock); } //ICL_DEBUG("send/receive threads terminated"); From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 20:10:22 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B11D9F97; Wed, 8 Oct 2014 20:10:22 +0000 (UTC) Received: from mail-la0-x232.google.com (mail-la0-x232.google.com [IPv6:2a00:1450:4010:c03::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A72617B1; Wed, 8 Oct 2014 20:10:21 +0000 (UTC) Received: by mail-la0-f50.google.com with SMTP id s18so9170274lam.23 for ; Wed, 08 Oct 2014 13:10:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=wjvJHltr3mx6cWmzaspEEztRPg6NmedA0yccs0Bcd4s=; b=z36283Ea7Tc+VxoOTMNBR/BbKGs4rIPbh4dY7ekqG2ygExnSfn6jcSCHDXvx2sbFGH +HoLRFxfu47nYzVyF4GzDOs4LddlMYWc8LSS3jvW9xYgInAoSnmVCB9aSswx0ueqSWAK 8nv/6dgfitlfD/Ioqx8W1pUgyioU2WO7M+LKZUjdiUSN5Aq9jjVcFg7s+AhOajj/zbJP HuEqSVScmKEBecuWFPkP5vR8l0mPhMsGncYe7KpfdYrQD7WgLNhrlOOxmSbuhS1TK/1n D8D8r2wYb0E9QSI3NB7EOSq/XN6LtSatzSdr3Ryk8EGgCekz7rLgtyvyduYtT0sFDItA QgAA== MIME-Version: 1.0 X-Received: by 10.112.205.39 with SMTP id ld7mr13079771lbc.40.1412799019434; Wed, 08 Oct 2014 13:10:19 -0700 (PDT) Sender: crodr001@gmail.com Received: by 10.112.131.66 with HTTP; Wed, 8 Oct 2014 13:10:19 -0700 (PDT) In-Reply-To: <20141007223941.GT37670@ivaldir.etoilebsd.net> References: <201410061443.s96Eh2Jn022718@svn.freebsd.org> <20141006144924.GB37670@ivaldir.etoilebsd.net> <20141007223941.GT37670@ivaldir.etoilebsd.net> Date: Wed, 8 Oct 2014 13:10:19 -0700 X-Google-Sender-Auth: mIgrZNbkAlroSRA_bPTT3Z3ygGs Message-ID: Subject: Re: svn commit: r272649 - head/contrib/byacc From: Craig Rodrigues To: Baptiste Daroussin Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 20:10:22 -0000 On Tue, Oct 7, 2014 at 3:39 PM, Baptiste Daroussin wrote: > On Tue, Oct 07, 2014 at 02:02:34PM -0700, Craig Rodrigues wrote: > > On Mon, Oct 6, 2014 at 7:49 AM, Baptiste Daroussin > wrote: > > > > > > > > Why a direct commit instead of a proper import of 20141005 version? it > > > would > > > have imho been better, simpler and easier to maintain. > > > > > > > Because according to Thomas Dickey, he did not fix all > > the memory related problems in snapshot 20141005. Specifically there are > > still > > some issues not fixed when realloc() is called. > > I was going to wait for the next snapshot. > > However, I wanted to get that one fix into FreeBSD to fix the kyua tests, > > which have been failing under Jenkins. See: > > https://jenkins.freebsd.org/jenkins/job/FreeBSD_HEAD-tests2/ > > (see runs #10 and #11). > > In that case I will import the new one which has the fix (do you confirm?) > According to http://invisible-island.net/byacc/CHANGES.html , the 2014-10-06 has a fix to address my concerns. However, this fix involves a lot of changes to the code, and I don't have time right now to audit everything. There have been a lot of changes to the byacc code in the past few days. The changes are good bugfixes, but I would recommend auditing everything beore importing the snapshot into FreeBSD. -- Craig From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 20:25:25 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E98A3284; Wed, 8 Oct 2014 20:25:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CAB2A8DA; Wed, 8 Oct 2014 20:25:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s98KPOTt092742; Wed, 8 Oct 2014 20:25:24 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s98KPLHK092724; Wed, 8 Oct 2014 20:25:21 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201410082025.s98KPLHK092724@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 8 Oct 2014 20:25:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272766 - in head/sys: amd64/amd64 amd64/include arm/arm arm/include i386/i386 i386/include mips/include mips/mips x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 20:25:25 -0000 Author: markj Date: Wed Oct 8 20:25:21 2014 New Revision: 272766 URL: https://svnweb.freebsd.org/changeset/base/272766 Log: Pass up the error status of minidumpsys() to its callers. PR: 193761 Submitted by: Conrad Meyer Sponsored by: EMC / Isilon Storage Division Modified: head/sys/amd64/amd64/minidump_machdep.c head/sys/amd64/include/md_var.h head/sys/arm/arm/dump_machdep.c head/sys/arm/arm/minidump_machdep.c head/sys/arm/include/md_var.h head/sys/i386/i386/minidump_machdep.c head/sys/i386/include/md_var.h head/sys/mips/include/md_var.h head/sys/mips/mips/dump_machdep.c head/sys/mips/mips/minidump_machdep.c head/sys/x86/x86/dump_machdep.c Modified: head/sys/amd64/amd64/minidump_machdep.c ============================================================================== --- head/sys/amd64/amd64/minidump_machdep.c Wed Oct 8 19:54:42 2014 (r272765) +++ head/sys/amd64/amd64/minidump_machdep.c Wed Oct 8 20:25:21 2014 (r272766) @@ -215,7 +215,7 @@ blk_write(struct dumperinfo *di, char *p /* A fake page table page, to avoid having to handle both 4K and 2M pages */ static pd_entry_t fakepd[NPDEPG]; -void +int minidumpsys(struct dumperinfo *di) { uint32_t pmapsize; @@ -441,7 +441,7 @@ minidumpsys(struct dumperinfo *di) /* Signal completion, signoff and exit stage left. */ dump_write(di, NULL, 0, 0, 0); printf("\nDump complete\n"); - return; + return (0); fail: if (error < 0) @@ -462,6 +462,7 @@ minidumpsys(struct dumperinfo *di) printf("Dump failed. Partition too small.\n"); else printf("** DUMP FAILED (ERROR %d) **\n", error); + return (error); } void Modified: head/sys/amd64/include/md_var.h ============================================================================== --- head/sys/amd64/include/md_var.h Wed Oct 8 19:54:42 2014 (r272765) +++ head/sys/amd64/include/md_var.h Wed Oct 8 20:25:21 2014 (r272766) @@ -118,7 +118,7 @@ void pagezero(void *addr); void printcpuinfo(void); void setidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int ist); int user_dbreg_trap(void); -void minidumpsys(struct dumperinfo *); +int minidumpsys(struct dumperinfo *); struct savefpu *get_pcb_user_save_td(struct thread *td); struct savefpu *get_pcb_user_save_pcb(struct pcb *pcb); struct pcb *get_pcb_td(struct thread *td); Modified: head/sys/arm/arm/dump_machdep.c ============================================================================== --- head/sys/arm/arm/dump_machdep.c Wed Oct 8 19:54:42 2014 (r272765) +++ head/sys/arm/arm/dump_machdep.c Wed Oct 8 20:25:21 2014 (r272766) @@ -280,10 +280,8 @@ dumpsys(struct dumperinfo *di) size_t hdrsz; int error; - if (do_minidump) { - minidumpsys(di); - return (0); - } + if (do_minidump) + return (minidumpsys(di)); bzero(&ehdr, sizeof(ehdr)); ehdr.e_ident[EI_MAG0] = ELFMAG0; Modified: head/sys/arm/arm/minidump_machdep.c ============================================================================== --- head/sys/arm/arm/minidump_machdep.c Wed Oct 8 19:54:42 2014 (r272765) +++ head/sys/arm/arm/minidump_machdep.c Wed Oct 8 20:25:21 2014 (r272766) @@ -196,7 +196,7 @@ blk_write_cont(struct dumperinfo *di, vm /* A fake page table page, to avoid having to handle both 4K and 2M pages */ static pt_entry_t fakept[NPTEPG]; -void +int minidumpsys(struct dumperinfo *di) { struct minidumphdr mdhdr; @@ -460,7 +460,7 @@ minidumpsys(struct dumperinfo *di) /* Signal completion, signoff and exit stage left. */ dump_write(di, NULL, 0, 0, 0); printf("\nDump complete\n"); - return; + return (0); fail: if (error < 0) @@ -472,6 +472,7 @@ fail: printf("\nDump failed. Partition too small.\n"); else printf("\n** DUMP FAILED (ERROR %d) **\n", error); + return (error); } void Modified: head/sys/arm/include/md_var.h ============================================================================== --- head/sys/arm/include/md_var.h Wed Oct 8 19:54:42 2014 (r272765) +++ head/sys/arm/include/md_var.h Wed Oct 8 20:25:21 2014 (r272766) @@ -68,6 +68,6 @@ extern int busdma_swi_pending; void busdma_swi(void); void dump_add_page(vm_paddr_t); void dump_drop_page(vm_paddr_t); -void minidumpsys(struct dumperinfo *); +int minidumpsys(struct dumperinfo *); #endif /* !_MACHINE_MD_VAR_H_ */ Modified: head/sys/i386/i386/minidump_machdep.c ============================================================================== --- head/sys/i386/i386/minidump_machdep.c Wed Oct 8 19:54:42 2014 (r272765) +++ head/sys/i386/i386/minidump_machdep.c Wed Oct 8 20:25:21 2014 (r272766) @@ -178,7 +178,7 @@ blk_write(struct dumperinfo *di, char *p /* A fake page table page, to avoid having to handle both 4K and 2M pages */ static pt_entry_t fakept[NPTEPG]; -void +int minidumpsys(struct dumperinfo *di) { uint64_t dumpsize; @@ -377,7 +377,7 @@ minidumpsys(struct dumperinfo *di) /* Signal completion, signoff and exit stage left. */ dump_write(di, NULL, 0, 0, 0); printf("\nDump complete\n"); - return; + return (0); fail: if (error < 0) @@ -389,6 +389,7 @@ minidumpsys(struct dumperinfo *di) printf("\nDump failed. Partition too small.\n"); else printf("\n** DUMP FAILED (ERROR %d) **\n", error); + return (error); } void Modified: head/sys/i386/include/md_var.h ============================================================================== --- head/sys/i386/include/md_var.h Wed Oct 8 19:54:42 2014 (r272765) +++ head/sys/i386/include/md_var.h Wed Oct 8 20:25:21 2014 (r272766) @@ -113,6 +113,6 @@ void ppro_reenable_apic(void); void printcpuinfo(void); void setidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int selec); int user_dbreg_trap(void); -void minidumpsys(struct dumperinfo *); +int minidumpsys(struct dumperinfo *); #endif /* !_MACHINE_MD_VAR_H_ */ Modified: head/sys/mips/include/md_var.h ============================================================================== --- head/sys/mips/include/md_var.h Wed Oct 8 19:54:42 2014 (r272765) +++ head/sys/mips/include/md_var.h Wed Oct 8 20:25:21 2014 (r272766) @@ -79,5 +79,5 @@ void busdma_swi(void); struct dumperinfo; void dump_add_page(vm_paddr_t); void dump_drop_page(vm_paddr_t); -void minidumpsys(struct dumperinfo *); +int minidumpsys(struct dumperinfo *); #endif /* !_MACHINE_MD_VAR_H_ */ Modified: head/sys/mips/mips/dump_machdep.c ============================================================================== --- head/sys/mips/mips/dump_machdep.c Wed Oct 8 19:54:42 2014 (r272765) +++ head/sys/mips/mips/dump_machdep.c Wed Oct 8 20:25:21 2014 (r272766) @@ -266,10 +266,8 @@ dumpsys(struct dumperinfo *di) size_t hdrsz; int error; - if (do_minidump) { - minidumpsys(di); - return (0); - } + if (do_minidump) + return (minidumpsys(di)); bzero(&ehdr, sizeof(ehdr)); ehdr.e_ident[EI_MAG0] = ELFMAG0; Modified: head/sys/mips/mips/minidump_machdep.c ============================================================================== --- head/sys/mips/mips/minidump_machdep.c Wed Oct 8 19:54:42 2014 (r272765) +++ head/sys/mips/mips/minidump_machdep.c Wed Oct 8 20:25:21 2014 (r272766) @@ -153,7 +153,7 @@ write_buffer(struct dumperinfo *di, char return (0); } -void +int minidumpsys(struct dumperinfo *di) { struct minidumphdr mdhdr; @@ -325,7 +325,7 @@ minidumpsys(struct dumperinfo *di) /* Signal completion, signoff and exit stage left. */ dump_write(di, NULL, 0, 0, 0); printf("\nDump complete\n"); - return; + return (0); fail: if (error < 0) @@ -337,4 +337,5 @@ fail: printf("\nDump failed. Partition too small.\n"); else printf("\n** DUMP FAILED (ERROR %d) **\n", error); + return (error); } Modified: head/sys/x86/x86/dump_machdep.c ============================================================================== --- head/sys/x86/x86/dump_machdep.c Wed Oct 8 19:54:42 2014 (r272765) +++ head/sys/x86/x86/dump_machdep.c Wed Oct 8 20:25:21 2014 (r272766) @@ -275,10 +275,9 @@ dumpsys(struct dumperinfo *di) size_t hdrsz; int error; - if (do_minidump) { - minidumpsys(di); - return (0); - } + if (do_minidump) + return (minidumpsys(di)); + bzero(&ehdr, sizeof(ehdr)); ehdr.e_ident[EI_MAG0] = ELFMAG0; ehdr.e_ident[EI_MAG1] = ELFMAG1; From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 20:39:34 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CE38D5E4; Wed, 8 Oct 2014 20:39:34 +0000 (UTC) Received: from mail-wi0-x232.google.com (mail-wi0-x232.google.com [IPv6:2a00:1450:400c:c05::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E95319F0; Wed, 8 Oct 2014 20:39:33 +0000 (UTC) Received: by mail-wi0-f178.google.com with SMTP id cc10so122224wib.17 for ; Wed, 08 Oct 2014 13:39:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=A/cmEIIN9uSSAbZoahZZJ54c30lq1TZqJ314iTFoeuA=; b=XYESd6ZspHlC0IlQEXSibxq4Aii7PBoW0sGOAEljhCfJhh+UqXAiUb51CO9NC6XB5E UUaPsoH2Rt3bIcffa8zIMCSnnJfPqCTwp6B5iCyX7rxEwtWp6d9VfONxnzWP5aQa+w2+ N+0/zXkVa504NS7h6RJ63D/4P6IxXsMjVt0i5wHa86QTokPPI63Cqgh3uKIYA+S5d7zo 8Otoy4OTjqzlQhcQkgvFR2tuB64d3EqPjmdI9GPJlZxj05fOWIPIpL1Pohe73y10ar8R Jdib6iPeMAWOidBctDY6vg0TraZM9emXlteFsw/d1zPbnJX8aMdHfgbyvKeHteqmumOx G3rg== X-Received: by 10.180.87.161 with SMTP id az1mr36297863wib.13.1412800772033; Wed, 08 Oct 2014 13:39:32 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by mx.google.com with ESMTPSA id bv17sm1801670wib.13.2014.10.08.13.39.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Oct 2014 13:39:31 -0700 (PDT) Sender: Baptiste Daroussin Date: Wed, 8 Oct 2014 22:39:29 +0200 From: Baptiste Daroussin To: Craig Rodrigues Subject: Re: svn commit: r272649 - head/contrib/byacc Message-ID: <20141008203928.GA2675@ivaldir.etoilebsd.net> References: <201410061443.s96Eh2Jn022718@svn.freebsd.org> <20141006144924.GB37670@ivaldir.etoilebsd.net> <20141007223941.GT37670@ivaldir.etoilebsd.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7AUc2qLy4jB3hD7Z" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 20:39:35 -0000 --7AUc2qLy4jB3hD7Z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Oct 08, 2014 at 01:10:19PM -0700, Craig Rodrigues wrote: > On Tue, Oct 7, 2014 at 3:39 PM, Baptiste Daroussin wro= te: >=20 > > On Tue, Oct 07, 2014 at 02:02:34PM -0700, Craig Rodrigues wrote: > > > On Mon, Oct 6, 2014 at 7:49 AM, Baptiste Daroussin > > wrote: > > > > > > > > > > > Why a direct commit instead of a proper import of 20141005 version?= it > > > > would > > > > have imho been better, simpler and easier to maintain. > > > > > > > > > > Because according to Thomas Dickey, he did not fix all > > > the memory related problems in snapshot 20141005. Specifically there= are > > > still > > > some issues not fixed when realloc() is called. > > > I was going to wait for the next snapshot. > > > However, I wanted to get that one fix into FreeBSD to fix the kyua te= sts, > > > which have been failing under Jenkins. See: > > > https://jenkins.freebsd.org/jenkins/job/FreeBSD_HEAD-tests2/ > > > (see runs #10 and #11). > > > > In that case I will import the new one which has the fix (do you confir= m?) > > >=20 > According to http://invisible-island.net/byacc/CHANGES.html , the > 2014-10-06 has a fix > to address my concerns. However, this fix involves a lot of changes to t= he > code, > and I don't have time right now to audit everything. >=20 > There have been a lot of changes to the byacc code in the past few days. > The changes > are good bugfixes, but I would recommend auditing everything beore > importing the snapshot into FreeBSD. It has already been imported the only difference between the version in base since 2 days ago and the version upstream now is your change. regards, Bapt --7AUc2qLy4jB3hD7Z Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlQ1oQAACgkQ8kTtMUmk6EwlMgCfT7LDln4+rPctQbGewkV2eHLU qXoAoKLb8JXa6qOQ7QAikrnWbd6fzTkM =LImK -----END PGP SIGNATURE----- --7AUc2qLy4jB3hD7Z-- From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 20:46:40 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8D58EAD8; Wed, 8 Oct 2014 20:46:40 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F2AEAE2; Wed, 8 Oct 2014 20:46:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s98Kke5Z002659; Wed, 8 Oct 2014 20:46:40 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s98Kkdt7002654; Wed, 8 Oct 2014 20:46:39 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410082046.s98Kkdt7002654@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Wed, 8 Oct 2014 20:46:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272769 - in head/contrib/byacc: . package package/debian package/debian/source package/pkgsrc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 20:46:40 -0000 Author: bapt Date: Wed Oct 8 20:46:38 2014 New Revision: 272769 URL: https://svnweb.freebsd.org/changeset/base/272769 Log: Import byacc 20141006 Modified: head/contrib/byacc/CHANGES head/contrib/byacc/MANIFEST head/contrib/byacc/VERSION head/contrib/byacc/configure head/contrib/byacc/configure.in head/contrib/byacc/main.c head/contrib/byacc/package/byacc.spec head/contrib/byacc/package/debian/changelog head/contrib/byacc/package/debian/source/format head/contrib/byacc/package/mingw-byacc.spec head/contrib/byacc/package/pkgsrc/Makefile head/contrib/byacc/reader.c Directory Properties: head/contrib/byacc/ (props changed) Modified: head/contrib/byacc/CHANGES ============================================================================== --- head/contrib/byacc/CHANGES Wed Oct 8 20:44:05 2014 (r272768) +++ head/contrib/byacc/CHANGES Wed Oct 8 20:46:38 2014 (r272769) @@ -1,3 +1,23 @@ +2014-10-06 Thomas E. Dickey + + * package/debian/source/format: + change to native format to work around regression in Debian packaging. + + * VERSION, package/byacc.spec, package/debian/changelog, package/mingw-byacc.spec, package/pkgsrc/Makefile: + bump + + * configure: regen + + * main.c: + correct parameter for umask - for very old mkstemp's - and use type mode_t + to quiet compiler warning + + * configure.in: add configure check for mode_t + + * reader.c: + better fix for get_line, by ensuring there is enough space to null-terminate + its result (prompted by discussion with Craig Rodrigues). + 2014-10-05 Thomas E. Dickey * main.c: Modified: head/contrib/byacc/MANIFEST ============================================================================== --- head/contrib/byacc/MANIFEST Wed Oct 8 20:44:05 2014 (r272768) +++ head/contrib/byacc/MANIFEST Wed Oct 8 20:46:38 2014 (r272769) @@ -1,4 +1,4 @@ -MANIFEST for byacc-20141005, version t20141005 +MANIFEST for byacc-20141006, version t20141006 -------------------------------------------------------------------------------- MANIFEST this file ACKNOWLEDGEMENTS original version of byacc - 1993 Modified: head/contrib/byacc/VERSION ============================================================================== --- head/contrib/byacc/VERSION Wed Oct 8 20:44:05 2014 (r272768) +++ head/contrib/byacc/VERSION Wed Oct 8 20:46:38 2014 (r272769) @@ -1 +1 @@ -20141005 +20141006 Modified: head/contrib/byacc/configure ============================================================================== --- head/contrib/byacc/configure Wed Oct 8 20:44:05 2014 (r272768) +++ head/contrib/byacc/configure Wed Oct 8 20:46:38 2014 (r272769) @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 1.19 . +# From configure.in Revision: 1.20 . # Guess values for system-dependent variables and create Makefiles. # Generated by Autoconf 2.52.20121002. # @@ -106,6 +106,42 @@ SHELL=${CONFIG_SHELL-/bin/sh} : ${ac_max_here_lines=38} ac_unique_file="main.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" # Initialize some variables set by options. ac_init_help= @@ -854,7 +890,7 @@ if test -z "$CONFIG_SITE"; then fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then - { echo "$as_me:857: loading site script $ac_site_file" >&5 + { echo "$as_me:893: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} cat "$ac_site_file" >&5 . "$ac_site_file" @@ -865,7 +901,7 @@ if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then - { echo "$as_me:868: loading cache $cache_file" >&5 + { echo "$as_me:904: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; @@ -873,7 +909,7 @@ echo "$as_me: loading cache $cache_file" esac fi else - { echo "$as_me:876: creating cache $cache_file" >&5 + { echo "$as_me:912: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi @@ -889,21 +925,21 @@ for ac_var in `(set) 2>&1 | eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) - { echo "$as_me:892: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 + { echo "$as_me:928: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) - { echo "$as_me:896: error: \`$ac_var' was not set in the previous run" >&5 + { echo "$as_me:932: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:902: error: \`$ac_var' has changed since the previous run:" >&5 + { echo "$as_me:938: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:904: former value: $ac_old_val" >&5 + { echo "$as_me:940: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:906: current value: $ac_new_val" >&5 + { echo "$as_me:942: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; @@ -922,9 +958,9 @@ echo "$as_me: current value: $ac_new_v fi done if $ac_cache_corrupted; then - { echo "$as_me:925: error: changes in the environment can compromise the build" >&5 + { echo "$as_me:961: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:927: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 + { { echo "$as_me:963: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi @@ -945,10 +981,10 @@ esac echo "#! $SHELL" >conftest.sh echo "exit 0" >>conftest.sh chmod +x conftest.sh -if { (echo "$as_me:948: PATH=\".;.\"; conftest.sh") >&5 +if { (echo "$as_me:984: PATH=\".;.\"; conftest.sh") >&5 (PATH=".;."; conftest.sh) 2>&5 ac_status=$? - echo "$as_me:951: \$? = $ac_status" >&5 + echo "$as_me:987: \$? = $ac_status" >&5 (exit $ac_status); }; then ac_path_separator=';' else @@ -976,7 +1012,7 @@ for ac_dir in $srcdir $srcdir/.. $srcdir fi done if test -z "$ac_aux_dir"; then - { { echo "$as_me:979: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 + { { echo "$as_me:1015: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi @@ -986,11 +1022,11 @@ ac_configure="$SHELL $ac_aux_dir/configu # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || - { { echo "$as_me:989: error: cannot run $ac_config_sub" >&5 + { { echo "$as_me:1025: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } -echo "$as_me:993: checking build system type" >&5 +echo "$as_me:1029: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -999,23 +1035,23 @@ else test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && - { { echo "$as_me:1002: error: cannot guess build type; you must specify one" >&5 + { { echo "$as_me:1038: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || - { { echo "$as_me:1006: error: $ac_config_sub $ac_cv_build_alias failed." >&5 + { { echo "$as_me:1042: error: $ac_config_sub $ac_cv_build_alias failed." >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed." >&2;} { (exit 1); exit 1; }; } fi -echo "$as_me:1011: result: $ac_cv_build" >&5 +echo "$as_me:1047: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$as_me:1018: checking host system type" >&5 +echo "$as_me:1054: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1024,12 +1060,12 @@ else test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || - { { echo "$as_me:1027: error: $ac_config_sub $ac_cv_host_alias failed" >&5 + { { echo "$as_me:1063: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi -echo "$as_me:1032: result: $ac_cv_host" >&5 +echo "$as_me:1068: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` @@ -1037,7 +1073,7 @@ host_vendor=`echo $ac_cv_host | sed 's/^ host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then - echo "$as_me:1040: checking target system type" >&5 + echo "$as_me:1076: checking target system type" >&5 echo $ECHO_N "checking target system type... $ECHO_C" >&6 if test "${ac_cv_target+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1046,12 +1082,12 @@ else test "x$ac_cv_target_alias" = "x" && ac_cv_target_alias=$ac_cv_host_alias ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || - { { echo "$as_me:1049: error: $ac_config_sub $ac_cv_target_alias failed" >&5 + { { echo "$as_me:1085: error: $ac_config_sub $ac_cv_target_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} { (exit 1); exit 1; }; } fi -echo "$as_me:1054: result: $ac_cv_target" >&5 +echo "$as_me:1090: result: $ac_cv_target" >&5 echo "${ECHO_T}$ac_cv_target" >&6 target=$ac_cv_target target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` @@ -1083,13 +1119,13 @@ else fi test -z "$system_name" && system_name="$cf_cv_system_name" -test -n "$cf_cv_system_name" && echo "$as_me:1086: result: Configuring for $cf_cv_system_name" >&5 +test -n "$cf_cv_system_name" && echo "$as_me:1122: result: Configuring for $cf_cv_system_name" >&5 echo "${ECHO_T}Configuring for $cf_cv_system_name" >&6 if test ".$system_name" != ".$cf_cv_system_name" ; then - echo "$as_me:1090: result: Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&5 + echo "$as_me:1126: result: Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&5 echo "${ECHO_T}Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&6 - { { echo "$as_me:1092: error: \"Please remove config.cache and try again.\"" >&5 + { { echo "$as_me:1128: error: \"Please remove config.cache and try again.\"" >&5 echo "$as_me: error: \"Please remove config.cache and try again.\"" >&2;} { (exit 1); exit 1; }; } fi @@ -1116,7 +1152,7 @@ ac_main_return=return if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -echo "$as_me:1119: checking for $ac_word" >&5 +echo "$as_me:1155: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1131,7 +1167,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="${ac_tool_prefix}gcc" -echo "$as_me:1134: found $ac_dir/$ac_word" >&5 +echo "$as_me:1170: found $ac_dir/$ac_word" >&5 break done @@ -1139,10 +1175,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:1142: result: $CC" >&5 + echo "$as_me:1178: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else - echo "$as_me:1145: result: no" >&5 + echo "$as_me:1181: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1151,7 +1187,7 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -echo "$as_me:1154: checking for $ac_word" >&5 +echo "$as_me:1190: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1166,7 +1202,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="gcc" -echo "$as_me:1169: found $ac_dir/$ac_word" >&5 +echo "$as_me:1205: found $ac_dir/$ac_word" >&5 break done @@ -1174,10 +1210,10 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:1177: result: $ac_ct_CC" >&5 + echo "$as_me:1213: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else - echo "$as_me:1180: result: no" >&5 + echo "$as_me:1216: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1190,7 +1226,7 @@ if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -echo "$as_me:1193: checking for $ac_word" >&5 +echo "$as_me:1229: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1205,7 +1241,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="${ac_tool_prefix}cc" -echo "$as_me:1208: found $ac_dir/$ac_word" >&5 +echo "$as_me:1244: found $ac_dir/$ac_word" >&5 break done @@ -1213,10 +1249,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:1216: result: $CC" >&5 + echo "$as_me:1252: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else - echo "$as_me:1219: result: no" >&5 + echo "$as_me:1255: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1225,7 +1261,7 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -echo "$as_me:1228: checking for $ac_word" >&5 +echo "$as_me:1264: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1240,7 +1276,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="cc" -echo "$as_me:1243: found $ac_dir/$ac_word" >&5 +echo "$as_me:1279: found $ac_dir/$ac_word" >&5 break done @@ -1248,10 +1284,10 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:1251: result: $ac_ct_CC" >&5 + echo "$as_me:1287: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else - echo "$as_me:1254: result: no" >&5 + echo "$as_me:1290: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1264,7 +1300,7 @@ fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -echo "$as_me:1267: checking for $ac_word" >&5 +echo "$as_me:1303: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1284,7 +1320,7 @@ if test "$ac_dir/$ac_word" = "/usr/ucb/c continue fi ac_cv_prog_CC="cc" -echo "$as_me:1287: found $ac_dir/$ac_word" >&5 +echo "$as_me:1323: found $ac_dir/$ac_word" >&5 break done @@ -1306,10 +1342,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:1309: result: $CC" >&5 + echo "$as_me:1345: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else - echo "$as_me:1312: result: no" >&5 + echo "$as_me:1348: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1320,7 +1356,7 @@ if test -z "$CC"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:1323: checking for $ac_word" >&5 +echo "$as_me:1359: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1335,7 +1371,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="$ac_tool_prefix$ac_prog" -echo "$as_me:1338: found $ac_dir/$ac_word" >&5 +echo "$as_me:1374: found $ac_dir/$ac_word" >&5 break done @@ -1343,10 +1379,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:1346: result: $CC" >&5 + echo "$as_me:1382: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else - echo "$as_me:1349: result: no" >&5 + echo "$as_me:1385: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1359,7 +1395,7 @@ if test -z "$CC"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:1362: checking for $ac_word" >&5 +echo "$as_me:1398: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1374,7 +1410,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="$ac_prog" -echo "$as_me:1377: found $ac_dir/$ac_word" >&5 +echo "$as_me:1413: found $ac_dir/$ac_word" >&5 break done @@ -1382,10 +1418,10 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:1385: result: $ac_ct_CC" >&5 + echo "$as_me:1421: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else - echo "$as_me:1388: result: no" >&5 + echo "$as_me:1424: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1397,32 +1433,32 @@ fi fi -test -z "$CC" && { { echo "$as_me:1400: error: no acceptable cc found in \$PATH" >&5 +test -z "$CC" && { { echo "$as_me:1436: error: no acceptable cc found in \$PATH" >&5 echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. -echo "$as_me:1405:" \ +echo "$as_me:1441:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:1408: \"$ac_compiler --version &5\"") >&5 +{ (eval echo "$as_me:1444: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? - echo "$as_me:1411: \$? = $ac_status" >&5 + echo "$as_me:1447: \$? = $ac_status" >&5 (exit $ac_status); } -{ (eval echo "$as_me:1413: \"$ac_compiler -v &5\"") >&5 +{ (eval echo "$as_me:1449: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? - echo "$as_me:1416: \$? = $ac_status" >&5 + echo "$as_me:1452: \$? = $ac_status" >&5 (exit $ac_status); } -{ (eval echo "$as_me:1418: \"$ac_compiler -V &5\"") >&5 +{ (eval echo "$as_me:1454: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? - echo "$as_me:1421: \$? = $ac_status" >&5 + echo "$as_me:1457: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF -#line 1425 "configure" +#line 1461 "configure" #include "confdefs.h" int @@ -1438,13 +1474,13 @@ ac_clean_files="$ac_clean_files a.out a. # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -echo "$as_me:1441: checking for C compiler default output" >&5 +echo "$as_me:1477: checking for C compiler default output" >&5 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -if { (eval echo "$as_me:1444: \"$ac_link_default\"") >&5 +if { (eval echo "$as_me:1480: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? - echo "$as_me:1447: \$? = $ac_status" >&5 + echo "$as_me:1483: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last @@ -1467,34 +1503,34 @@ done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -{ { echo "$as_me:1470: error: C compiler cannot create executables" >&5 +{ { echo "$as_me:1506: error: C compiler cannot create executables" >&5 echo "$as_me: error: C compiler cannot create executables" >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext -echo "$as_me:1476: result: $ac_file" >&5 +echo "$as_me:1512: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -echo "$as_me:1481: checking whether the C compiler works" >&5 +echo "$as_me:1517: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' - { (eval echo "$as_me:1487: \"$ac_try\"") >&5 + { (eval echo "$as_me:1523: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1490: \$? = $ac_status" >&5 + echo "$as_me:1526: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { echo "$as_me:1497: error: cannot run C compiled programs. + { { echo "$as_me:1533: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&2;} @@ -1502,24 +1538,24 @@ If you meant to cross compile, use \`--h fi fi fi -echo "$as_me:1505: result: yes" >&5 +echo "$as_me:1541: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -echo "$as_me:1512: checking whether we are cross compiling" >&5 +echo "$as_me:1548: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:1514: result: $cross_compiling" >&5 +echo "$as_me:1550: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 -echo "$as_me:1517: checking for executable suffix" >&5 +echo "$as_me:1553: checking for executable suffix" >&5 echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 -if { (eval echo "$as_me:1519: \"$ac_link\"") >&5 +if { (eval echo "$as_me:1555: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:1522: \$? = $ac_status" >&5 + echo "$as_me:1558: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will @@ -1535,25 +1571,25 @@ for ac_file in `(ls conftest.exe; ls con esac done else - { { echo "$as_me:1538: error: cannot compute EXEEXT: cannot compile and link" >&5 + { { echo "$as_me:1574: error: cannot compute EXEEXT: cannot compile and link" >&5 echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext -echo "$as_me:1544: result: $ac_cv_exeext" >&5 +echo "$as_me:1580: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT -echo "$as_me:1550: checking for object suffix" >&5 +echo "$as_me:1586: checking for object suffix" >&5 echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 1556 "configure" +#line 1592 "configure" #include "confdefs.h" int @@ -1565,10 +1601,10 @@ main () } _ACEOF rm -f conftest.o conftest.obj -if { (eval echo "$as_me:1568: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1604: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1571: \$? = $ac_status" >&5 + echo "$as_me:1607: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in @@ -1580,24 +1616,24 @@ done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -{ { echo "$as_me:1583: error: cannot compute OBJEXT: cannot compile" >&5 +{ { echo "$as_me:1619: error: cannot compute OBJEXT: cannot compile" >&5 echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -echo "$as_me:1590: result: $ac_cv_objext" >&5 +echo "$as_me:1626: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -echo "$as_me:1594: checking whether we are using the GNU C compiler" >&5 +echo "$as_me:1630: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 1600 "configure" +#line 1636 "configure" #include "confdefs.h" int @@ -1612,16 +1648,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:1615: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1651: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1618: \$? = $ac_status" >&5 + echo "$as_me:1654: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1621: \"$ac_try\"") >&5 + { (eval echo "$as_me:1657: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1624: \$? = $ac_status" >&5 + echo "$as_me:1660: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else @@ -1633,19 +1669,19 @@ rm -f conftest.$ac_objext conftest.$ac_e ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -echo "$as_me:1636: result: $ac_cv_c_compiler_gnu" >&5 +echo "$as_me:1672: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" -echo "$as_me:1642: checking whether $CC accepts -g" >&5 +echo "$as_me:1678: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 1648 "configure" +#line 1684 "configure" #include "confdefs.h" int @@ -1657,16 +1693,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:1660: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1696: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1663: \$? = $ac_status" >&5 + echo "$as_me:1699: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1666: \"$ac_try\"") >&5 + { (eval echo "$as_me:1702: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1669: \$? = $ac_status" >&5 + echo "$as_me:1705: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else @@ -1676,7 +1712,7 @@ ac_cv_prog_cc_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:1679: result: $ac_cv_prog_cc_g" >&5 +echo "$as_me:1715: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS @@ -1703,16 +1739,16 @@ cat >conftest.$ac_ext <<_ACEOF #endif _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:1706: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1742: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1709: \$? = $ac_status" >&5 + echo "$as_me:1745: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1712: \"$ac_try\"") >&5 + { (eval echo "$as_me:1748: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1715: \$? = $ac_status" >&5 + echo "$as_me:1751: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ ''\ @@ -1724,7 +1760,7 @@ if { (eval echo "$as_me:1706: \"$ac_comp 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF -#line 1727 "configure" +#line 1763 "configure" #include "confdefs.h" #include $ac_declaration @@ -1737,16 +1773,16 @@ exit (42); } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:1740: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1776: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1743: \$? = $ac_status" >&5 + echo "$as_me:1779: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1746: \"$ac_try\"") >&5 + { (eval echo "$as_me:1782: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1749: \$? = $ac_status" >&5 + echo "$as_me:1785: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -1756,7 +1792,7 @@ continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line 1759 "configure" +#line 1795 "configure" #include "confdefs.h" $ac_declaration int @@ -1768,16 +1804,16 @@ exit (42); } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:1771: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1807: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1774: \$? = $ac_status" >&5 + echo "$as_me:1810: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1777: \"$ac_try\"") >&5 + { (eval echo "$as_me:1813: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1780: \$? = $ac_status" >&5 + echo "$as_me:1816: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else @@ -1807,15 +1843,15 @@ ac_main_return=return GCC_VERSION=none if test "$GCC" = yes ; then - echo "$as_me:1810: checking version of $CC" >&5 + echo "$as_me:1846: checking version of $CC" >&5 echo $ECHO_N "checking version of $CC... $ECHO_C" >&6 GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[^)]*) //' -e 's/^.*(Debian[^)]*) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`" test -z "$GCC_VERSION" && GCC_VERSION=unknown - echo "$as_me:1814: result: $GCC_VERSION" >&5 + echo "$as_me:1850: result: $GCC_VERSION" >&5 echo "${ECHO_T}$GCC_VERSION" >&6 fi -echo "$as_me:1818: checking for $CC option to accept ANSI C" >&5 +echo "$as_me:1854: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1823,7 +1859,7 @@ else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF -#line 1826 "configure" +#line 1862 "configure" #include "confdefs.h" #include #include @@ -1872,16 +1908,16 @@ for ac_arg in "" -qlanglvl=ansi -std1 -A do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext -if { (eval echo "$as_me:1875: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1911: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1878: \$? = $ac_status" >&5 + echo "$as_me:1914: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1881: \"$ac_try\"") >&5 + { (eval echo "$as_me:1917: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1884: \$? = $ac_status" >&5 + echo "$as_me:1920: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break @@ -1898,10 +1934,10 @@ fi case "x$ac_cv_prog_cc_stdc" in x|xno) - echo "$as_me:1901: result: none needed" >&5 + echo "$as_me:1937: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) - echo "$as_me:1904: result: $ac_cv_prog_cc_stdc" >&5 + echo "$as_me:1940: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac @@ -1909,13 +1945,13 @@ esac # This should have been defined by AC_PROG_CC : ${CC:=cc} -echo "$as_me:1912: checking \$CC variable" >&5 +echo "$as_me:1948: checking \$CC variable" >&5 echo $ECHO_N "checking \$CC variable... $ECHO_C" >&6 case "$CC" in #(vi *[\ \ ]-[IUD]*) - echo "$as_me:1916: result: broken" >&5 + echo "$as_me:1952: result: broken" >&5 echo "${ECHO_T}broken" >&6 - { echo "$as_me:1918: WARNING: your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options" >&5 + { echo "$as_me:1954: WARNING: your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options" >&5 echo "$as_me: WARNING: your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options" >&2;} # humor him... cf_flags=`echo "$CC" | sed -e 's/^[^ ]*[ ]//'` @@ -2001,12 +2037,12 @@ fi ;; *) - echo "$as_me:2004: result: ok" >&5 + echo "$as_me:2040: result: ok" >&5 echo "${ECHO_T}ok" >&6 ;; esac -echo "$as_me:2009: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "$as_me:2045: checking whether ${MAKE-make} sets \${MAKE}" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then @@ -2026,11 +2062,11 @@ fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$as_me:2029: result: yes" >&5 + echo "$as_me:2065: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else - echo "$as_me:2033: result: no" >&5 + echo "$as_me:2069: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi @@ -2047,7 +2083,7 @@ fi # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. -echo "$as_me:2050: checking for a BSD compatible install" >&5 +echo "$as_me:2086: checking for a BSD compatible install" >&5 echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then @@ -2096,7 +2132,7 @@ fi INSTALL=$ac_install_sh fi fi -echo "$as_me:2099: result: $INSTALL" >&5 +echo "$as_me:2135: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. @@ -2107,7 +2143,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCR test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -echo "$as_me:2110: checking if filesystem supports mixed-case filenames" >&5 +echo "$as_me:2146: checking if filesystem supports mixed-case filenames" >&5 echo $ECHO_N "checking if filesystem supports mixed-case filenames... $ECHO_C" >&6 if test "${cf_cv_mixedcase+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2134,7 +2170,7 @@ else fi fi -echo "$as_me:2137: result: $cf_cv_mixedcase" >&5 +echo "$as_me:2173: result: $cf_cv_mixedcase" >&5 echo "${ECHO_T}$cf_cv_mixedcase" >&6 test "$cf_cv_mixedcase" = yes && cat >>confdefs.h <<\EOF @@ -2145,7 +2181,7 @@ for ac_prog in exctags ctags do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 21:23:35 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7D21888A; Wed, 8 Oct 2014 21:23:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A419EB1; Wed, 8 Oct 2014 21:23:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s98LNZTk021940; Wed, 8 Oct 2014 21:23:35 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s98LNZng021938; Wed, 8 Oct 2014 21:23:35 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201410082123.s98LNZng021938@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 8 Oct 2014 21:23:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272770 - in head/sys: net netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 21:23:35 -0000 Author: ae Date: Wed Oct 8 21:23:34 2014 New Revision: 272770 URL: https://svnweb.freebsd.org/changeset/base/272770 Log: When tunneling interface is going to insert mbuf into netisr queue after stripping outer header, consider it as new packet and clear the protocols flags. This fixes problems when IPSEC traffic goes through various tunnels and router doesn't send ICMP/ICMPv6 errors. PR: 174602 Obtained from: Yandex LLC MFC after: 2 weeks Sponsored by: Yandex LLC Modified: head/sys/net/if_gif.c head/sys/netinet/ip_gre.c Modified: head/sys/net/if_gif.c ============================================================================== --- head/sys/net/if_gif.c Wed Oct 8 20:46:38 2014 (r272769) +++ head/sys/net/if_gif.c Wed Oct 8 21:23:34 2014 (r272770) @@ -547,6 +547,7 @@ gif_input(struct mbuf *m, int af, struct } sc = ifp->if_softc; m->m_pkthdr.rcvif = ifp; + m_clrprotoflags(m); #ifdef MAC mac_ifnet_create_mbuf(ifp, m); Modified: head/sys/netinet/ip_gre.c ============================================================================== --- head/sys/netinet/ip_gre.c Wed Oct 8 20:46:38 2014 (r272769) +++ head/sys/netinet/ip_gre.c Wed Oct 8 21:23:34 2014 (r272770) @@ -205,7 +205,7 @@ gre_input2(struct mbuf *m ,int hlen, u_c } m->m_pkthdr.rcvif = GRE2IFP(sc); - + m_clrprotoflags(m); netisr_queue(isr, m); /* Packet is done, no further processing needed. */ From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 21:53:25 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F03CFE7; Wed, 8 Oct 2014 21:53:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB4BC298; Wed, 8 Oct 2014 21:53:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s98LrOaX036151; Wed, 8 Oct 2014 21:53:24 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s98LrOAp036150; Wed, 8 Oct 2014 21:53:24 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201410082153.s98LrOAp036150@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 8 Oct 2014 21:53:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272771 - head/share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 21:53:25 -0000 Author: jhb Date: Wed Oct 8 21:53:24 2014 New Revision: 272771 URL: https://svnweb.freebsd.org/changeset/base/272771 Log: Rewrite timeout(9) to be callout(9)-centric instead. Move the description of timeout(9) to the end and mark it prominently as deprecated. Document somewhat how times are specified for the 'sbt' variants. Better explain how using callout_init_*() to associate a lock with a callout resolves common races. Differential Revision: https://reviews.freebsd.org/D847 Reviewed by: wblock, bjk MFC after: 1 week Modified: head/share/man/man9/timeout.9 Modified: head/share/man/man9/timeout.9 ============================================================================== --- head/share/man/man9/timeout.9 Wed Oct 8 21:23:34 2014 (r272770) +++ head/share/man/man9/timeout.9 Wed Oct 8 21:53:24 2014 (r272771) @@ -33,27 +33,27 @@ .Dt TIMEOUT 9 .Os .Sh NAME -.Nm timeout , -.Nm untimeout , +.Nm callout_active , +.Nm callout_deactivate , +.Nm callout_drain , .Nm callout_handle_init , .Nm callout_init , .Nm callout_init_mtx , .Nm callout_init_rm , .Nm callout_init_rw , -.Nm callout_stop , -.Nm callout_drain , +.Nm callout_pending , .Nm callout_reset , -.Nm callout_reset_on , .Nm callout_reset_curcpu , +.Nm callout_reset_on , .Nm callout_reset_sbt , -.Nm callout_reset_sbt_on , .Nm callout_reset_sbt_curcpu , +.Nm callout_reset_sbt_on , .Nm callout_schedule , -.Nm callout_schedule_on , .Nm callout_schedule_curcpu , -.Nm callout_pending , -.Nm callout_active , -.Nm callout_deactivate +.Nm callout_schedule_on , +.Nm callout_stop , +.Nm timeout , +.Nm untimeout .Nd execute a function after a specified length of time .Sh SYNOPSIS .In sys/types.h @@ -61,16 +61,18 @@ .Bd -literal typedef void timeout_t (void *); .Ed -.Ft struct callout_handle -.Fn timeout "timeout_t *func" "void *arg" "int ticks" +.Ft int +.Fn callout_active "struct callout *c" +.Ft void +.Fn callout_deactivate "struct callout *c" +.Ft int +.Fn callout_drain "struct callout *c" .Ft void .Fn callout_handle_init "struct callout_handle *handle" .Bd -literal struct callout_handle handle = CALLOUT_HANDLE_INITIALIZER(&handle); .Ed .Ft void -.Fn untimeout "timeout_t *func" "void *arg" "struct callout_handle handle" -.Ft void .Fn callout_init "struct callout *c" "int mpsafe" .Ft void .Fn callout_init_mtx "struct callout *c" "struct mtx *mtx" "int flags" @@ -79,314 +81,337 @@ struct callout_handle handle = CALLOUT_H .Ft void .Fn callout_init_rw "struct callout *c" "struct rwlock *rw" "int flags" .Ft int -.Fn callout_stop "struct callout *c" -.Ft int -.Fn callout_drain "struct callout *c" +.Fn callout_pending "struct callout *c" .Ft int .Fn callout_reset "struct callout *c" "int ticks" "timeout_t *func" "void *arg" .Ft int +.Fn callout_reset_curcpu "struct callout *c" "int ticks" "timeout_t *func" \ +"void *arg" +.Ft int .Fn callout_reset_on "struct callout *c" "int ticks" "timeout_t *func" \ "void *arg" "int cpu" .Ft int +.Fn callout_reset_sbt "struct callout *c" "sbintime_t sbt" \ +"sbintime_t pr" "timeout_t *func" "void *arg" "int flags" +.Ft int +.Fn callout_reset_sbt_curcpu "struct callout *c" "sbintime_t sbt" \ +"sbintime_t pr" "timeout_t *func" "void *arg" "int flags" +.Ft int .Fn callout_reset_sbt_on "struct callout *c" "sbintime_t sbt" \ "sbintime_t pr" "timeout_t *func" "void *arg" "int cpu" "int flags" .Ft int -.Fn callout_reset_curcpu "struct callout *c" "int ticks" "timeout_t *func" \ -"void *arg" -.Ft int .Fn callout_schedule "struct callout *c" "int ticks" .Ft int -.Fn callout_schedule_on "struct callout *c" "int ticks" "int cpu" -.Ft int .Fn callout_schedule_curcpu "struct callout *c" "int ticks" .Ft int -.Fn callout_pending "struct callout *c" +.Fn callout_schedule_on "struct callout *c" "int ticks" "int cpu" .Ft int -.Fn callout_active "struct callout *c" +.Fn callout_stop "struct callout *c" +.Ft struct callout_handle +.Fn timeout "timeout_t *func" "void *arg" "int ticks" .Ft void -.Fn callout_deactivate "struct callout *c" +.Fn untimeout "timeout_t *func" "void *arg" "struct callout_handle handle" .Sh DESCRIPTION -The function -.Fn timeout -schedules a call to the function given by the argument -.Fa func -to take place after -.Fa ticks Ns No /hz -seconds. -Non-positive values of -.Fa ticks -are silently converted to the value -.Sq 1 . -.Fa func -should be a pointer to a function that takes a -.Fa void * -argument. -Upon invocation, -.Fa func -will receive -.Fa arg -as its only argument. -The return value from -.Fn timeout -is a -.Ft struct callout_handle -which can be used in conjunction with the -.Fn untimeout -function to request that a scheduled timeout be canceled. -The -.Fn timeout -call is the old style and new code should use the -.Fn callout_* -functions. -.Pp -The function -.Fn callout_handle_init -can be used to initialize a handle to a state which will cause -any calls to -.Fn untimeout -with that handle to return with no side -effects. -.Pp -Assigning a callout handle the value of -.Fn CALLOUT_HANDLE_INITIALIZER -performs the same function as -.Fn callout_handle_init -and is provided for use on statically declared or global callout handles. -.Pp -The function -.Fn untimeout -cancels the timeout associated with -.Fa handle -using the -.Fa func -and -.Fa arg -arguments to validate the handle. -If the handle does not correspond to a timeout with -the function -.Fa func -taking the argument -.Fa arg -no action is taken. -.Fa handle -must be initialized by a previous call to -.Fn timeout , -.Fn callout_handle_init , -or assigned the value of -.Fn CALLOUT_HANDLE_INITIALIZER "&handle" -before being passed to -.Fn untimeout . -The behavior of calling -.Fn untimeout -with an uninitialized handle -is undefined. The -.Fn untimeout -call is the old style and new code should use the -.Fn callout_* -functions. +.Nm callout +API is used to schedule a call to an arbitrary function at a specific +time in the future. +Consumers of this API are required to allocate a callout structure +.Pq struct callout +for each pending function invocation. +This structure stores state about the pending function invocation including +the function to be called and the time at which the function should be invoked. +Pending function calls can be cancelled or rescheduled to a different time. +In addition, +a callout structure may be reused to schedule a new function call after a +scheduled call is completed. +.Pp +Callouts only provide a single-shot mode. +If a consumer requires a periodic timer, +it must explicitly reschedule each function call. +This is normally done by rescheduling the subsequent call within the called +function. +.Pp +Callout functions must not sleep. +They may not acquire sleepable locks, +wait on condition variables, +perform blocking allocation requests, +or invoke any other action that might sleep. .Pp -As handles are recycled by the system, it is possible (although unlikely) -that a handle from one invocation of -.Fn timeout -may match the handle of another invocation of -.Fn timeout -if both calls used the same function pointer and argument, and the first -timeout is expired or canceled before the second call. -The timeout facility offers O(1) running time for -.Fn timeout -and -.Fn untimeout . -Timeouts are executed from -.Fn softclock -with the -.Va Giant -lock held. -Thus they are protected from re-entrancy. -.Pp -The functions +Each callout structure must be initialized by .Fn callout_init , .Fn callout_init_mtx , .Fn callout_init_rm , -.Fn callout_init_rw , -.Fn callout_stop , -.Fn callout_drain , -.Fn callout_reset -and -.Fn callout_schedule -are low-level routines for clients who wish to allocate their own -callout structures. -.Pp -The function -.Fn callout_init -initializes a callout so it can be passed to -.Fn callout_stop , -.Fn callout_drain , -.Fn callout_reset or -.Fn callout_schedule -without any side effects. +.Fn callout_init_rw +before it is passed to any of the other callout functions. +The +.Fn callout_init +function initializes a callout structure in +.Fa c +that is not associated with a specific lock. If the .Fa mpsafe argument is zero, the callout structure is not considered to be .Dq multi-processor safe ; -that is, -the Giant lock will be acquired before calling the callout function, +and the Giant lock will be acquired before calling the callout function and released when the callout function returns. .Pp The -.Fn callout_init_mtx -function may be used as an alternative to -.Fn callout_init . -The parameter -.Fa mtx -specifies a mutex that is to be acquired by the callout subsystem -before calling the callout function, and released when the callout -function returns. -The following -.Fa flags -may be specified: -.Bl -tag -width ".Dv CALLOUT_RETURNUNLOCKED" -.It Dv CALLOUT_RETURNUNLOCKED -The callout function will release -.Fa mtx -itself, so the callout subsystem should not attempt to unlock it -after the callout function returns. -.El -.Pp -The +.Fn callout_init_mtx , +.Fn callout_init_rm , +and .Fn callout_init_rw -and the -.Fn callout_init_rm -fuctions serve the need of using rwlocks and rmlocks in conjunction -with callouts. -The functions do the same as -.Fn callout_init -with the possibility of specifying an extra -.Fa rw +functions initialize a callout structure in +.Fa c +that is associated with a specific lock. +The lock is specified by the +.Fa mtx , +.Fa rm , or -.Fa rm -argument. -If an -.Fa rm -argument is specified, the lock should be created without passing the +.Fa rw +parameter. +The associated lock must be held while stopping or rescheduling the +callout. +The callout subsystem acquires the associated lock before calling the +callout function and releases it after the function returns. +If the callout was cancelled while the callout subsystem waited for the +associated lock, +the callout function is not called, +and the associated lock is released. +This ensures that stopping or rescheduling the callout will abort any +previously scheduled invocation. +.Pp +Only regular mutexes may be used with +.Fn callout_init_mtx ; +spin mutexes are not supported. +A sleepable read-mostly lock +.Po +one initialized with the .Dv RM_SLEEPABLE -flag. -The usable lock classes are currently limited to mutexes, rwlocks and -non-sleepable rmlocks, because callout handlers run in softclock swi, -so they cannot sleep nor acquire sleepable locks like sx or lockmgr. -The following +flag +.Pc +may not be used with +.Fn callout_init_rm . +Similarly, other sleepable lock types such as +.Xr sx 9 +and +.Xr lockmgr 9 +cannot be used with callouts because sleeping is not permitted in +the callout subsystem. +.Pp +These .Fa flags -may be specified: -.Bl -tag -width ".Dv CALLOUT_SHAREDLOCK" +may be specified for +.Fn callout_init_mtx , +.Fn callout_init_rm , +or +.Fn callout_init_rw : +.Bl -tag -width ".Dv CALLOUT_RETURNUNLOCKED" +.It Dv CALLOUT_RETURNUNLOCKED +The callout function will release the associated lock itself, +so the callout subsystem should not attempt to unlock it +after the callout function returns. .It Dv CALLOUT_SHAREDLOCK The lock is only acquired in read mode when running the callout handler. -It has no effects when used in conjunction with -.Fa mtx . +This flag is ignored by +.Fn callout_init_mtx . .El .Pp The function .Fn callout_stop -cancels a callout if it is currently pending. +cancels a callout +.Fa c +if it is currently pending. If the callout is pending, then .Fn callout_stop -will return a non-zero value. -If the callout is not set, has already been serviced or is currently -being serviced, then zero will be returned. -If the callout has an associated mutex, then that mutex must be -held when this function is called. +returns a non-zero value. +If the callout is not set, +has already been serviced, +or is currently being serviced, +then zero will be returned. +If the callout has an associated lock, +then that lock must be held when this function is called. .Pp The function .Fn callout_drain is identical to .Fn callout_stop -except that it will wait for the callout to be completed if it is -already in progress. +except that it will wait for the callout +.Fa c +to complete if it is already in progress. This function MUST NOT be called while holding any locks on which the callout might block, or deadlock will result. Note that if the callout subsystem has already begun processing this -callout, then the callout function may be invoked during the execution of -.Fn callout_drain . +callout, then the callout function may be invoked before +.Fn callout_drain +returns. However, the callout subsystem does guarantee that the callout will be fully stopped before .Fn callout_drain returns. .Pp -The function -.Fn callout_reset -first performs the equivalent of -.Fn callout_stop -to disestablish the callout, and then establishes a new callout in the -same manner as -.Fn timeout . -If there was already a pending callout and it was rescheduled, then -.Fn callout_reset -will return a non-zero value. -If the callout has an associated mutex, then that mutex must be -held when this function is called. -The function -.Fn callout_schedule -(re)schedules an existing callout for a new period of time; -it is equivalent to calling -.Fn callout_reset -with the -.Fa func -and -.Fa arg -parameters extracted from the callout structure (though possibly with -lower overhead). -.Pp -The functions -.Fn callout_reset_on -and -.Fn callout_schedule_on -are equivalent to +The .Fn callout_reset and .Fn callout_schedule -but take an extra parameter specifying the target CPU for the callout. +function families schedule a future function invocation for callout +.Fa c . +If +.Fa c +already has a pending callout, +it is cancelled before the new invocation is scheduled. +These functions return a non-zero value if a pending callout was cancelled +and zero if there was no pending callout. +If the callout has an associated lock, +then that lock must be held when any of these functions are called. .Pp -The function -.Fn callout_reset_sbt_on -allows to get higher time resolution, taking relative or absolute time -and precision instead of relative ticks count. -If specified time is in past, it will be silently converted to present -to run handler as soon as possible. +The time at which the callout function will be invoked is determined by +either the +.Fa ticks +argument or the +.Fa sbt , +.Fa pr , +and +.Fa flags +arguments. +When +.Fa ticks +is used, +the callout is scheduled to execute after +.Fa ticks Ns No /hz +seconds. +Non-positive values of +.Fa ticks +are silently converted to the value +.Sq 1 . .Pp -The following +The +.Fa sbt , +.Fa pr , +and +.Fa flags +arguments provide more control over the scheduled time including +support for higher resolution times, +specifying the precision of the scheduled time, +and setting an absolute deadline instead of a relative timeout. +The callout is scheduled to execute in a time window which begins at +the time specified in +.Fa sbt +and extends for the amount of time specified in +.Fa pr . +If +.Fa sbt +specifies a time in the past, +the window is adjusted to start at the current time. +A non-zero value for +.Fa pr +allows the callout subsystem to coalesce callouts scheduled close to each +other into fewer timer interrupts, +reducing processing overhead and power consumption. +These .Fa flags -may be specified: +may be specified to adjust the interpretation of +.Fa sbt +and +.Fa pr : .Bl -tag -width ".Dv C_DIRECT_EXEC" .It Dv C_ABSOLUTE Handle the .Fa sbt -argument as absolute time of the event since boot, or relative time otherwise. +argument as an absolute time since boot. +By default, +.Fa sbt +is treated as a relative amount of time, +similar to +.Fa ticks . .It Dv C_DIRECT_EXEC -Run handler directly from hardware interrupt context instead of softclock swi. -It is faster, but puts more constraints on handlers. -Handlers may use only spin mutexes for locking, and they must be fast because -they run with absolute priority. +Run the handler directly from hardware interrupt context instead of from the +softclock thread. +This reduces latency and overhead, but puts more constraints on the callout +function. +Callout functions run in this context may use only spin mutexes for locking +and should be as small as possible because they run with absolute priority. .It Fn C_PREL Specifies relative event time precision as binary logarithm of time interval divided by acceptable time deviation: 1 -- 1/2, 2 -- 1/4, etc. -Smaller value allows to aggregate more events in one timer interrupt to -reduce processing overhead and power consumption. +Note that the larger of +.Fa pr +or this value is used as the length of the time window. +Smaller values +.Pq which result in larger time intervals +allow the callout subsystem to aggregate more events in one timer interrupt. .It Dv C_HARDCLOCK -Align the timeouts, if possible, to -.Fn hardclock -calls. +Align the timeouts to +.Fn hardclock +calls if possible. .El .Pp -The functions -.Fn callout_reset_curcpu +The +.Fn callout_reset +functions accept a +.Fa func +argument which identifies the function to be called when the time expires. +It must be a pointer to a function that takes a single +.Fa void * +argument. +Upon invocation, +.Fa func +will receive +.Fa arg +as its only argument. +The +.Fn callout_schedule +functions reuse the +.Fa func and -.Fn callout_schedule_curcpu -are wrappers for -.Fn callout_reset_on +.Fa arg +arguments from the previous callout. +Note that one of the +.Fn callout_reset +functions must always be called to initialize +.Fa func +and +.Fa arg +before one of the +.Fn callout_schedule +functions can be used. +.Pp +The callout subsystem provides a softclock thread for each CPU in the system. +Callouts are assigned to a single CPU and are executed by the softclock thread +for that CPU. +Initially, +callouts are assigned to CPU 0. +The +.Fn callout_reset_on , +.Fn callout_reset_sbt_on , and .Fn callout_schedule_on -using the current CPU as the target CPU. +functions assign the callout to CPU +.Fa cpu . +The +.Fn callout_reset_curcpu , +.Fn callout_reset_sbt_curpu , +and +.Fn callout_schedule_curcpu +functions assign the callout to the current CPU. +The +.Fn callout_reset , +.Fn callout_reset_sbt , +and +.Fn callout_schedule +functions schedule the callout to execute in the softclock thread of the CPU +to which it is currently assigned. +.Pp +Softclock threads are not pinned to their respective CPUs by default. +The softclock thread for CPU 0 can be pinned to CPU 0 by setting the +.Va kern.pin_default_swi +loader tunable to a non-zero value. +Softclock threads for CPUs other than zero can be pinned to their +respective CPUs by setting the +.Va kern.pin_pcpu_swi +loader tunable to a non-zero value. .Pp The macros .Fn callout_pending , @@ -394,10 +419,6 @@ The macros and .Fn callout_deactivate provide access to the current state of the callout. -Careful use of these macros can avoid many of the race conditions -that are inherent in asynchronous timer facilities; see -.Sx "Avoiding Race Conditions" -below for further details. The .Fn callout_pending macro checks whether a callout is @@ -410,7 +431,8 @@ starts to process this callout, .Fn callout_pending will return .Dv FALSE -even though the callout function may not have finished (or even begun) +even though the callout function may not have finished +.Pq or even begun executing. The .Fn callout_active @@ -434,45 +456,64 @@ but it clear it when a callout expires normally via the execution of the callout function. .Ss "Avoiding Race Conditions" -The callout subsystem invokes callout functions from its own timer +The callout subsystem invokes callout functions from its own thread context. -Without some kind of synchronization it is possible that a callout +Without some kind of synchronization, +it is possible that a callout function will be invoked concurrently with an attempt to stop or reset the callout by another thread. -In particular, since callout functions typically acquire a mutex as +In particular, since callout functions typically acquire a lock as their first action, the callout function may have already been invoked, -but be blocked waiting for that mutex at the time that another thread +but is blocked waiting for that lock at the time that another thread tries to reset or stop the callout. .Pp -The callout subsystem provides a number of mechanisms to address these -synchronization concerns: +There are three main techniques for addressing these +synchronization concerns. +The first approach is preferred as it is the simplest: .Bl -enum -offset indent .It -If the callout has an associated mutex that was specified using the -.Fn callout_init_mtx -function (or implicitly specified as the -.Va Giant -mutex using +Callouts can be associated with a specific lock when they are initialized +by +.Fn callout_init_mtx , +.Fn callout_init_rm , +or +.Fn callout_init_rw . +When a callout is associated with a lock, +the callout subsystem acquires the lock before the callout function is +invoked. +This allows the callout subsystem to transparently handle races between +callout cancellation, +scheduling, +and execution. +Note that the associated lock must be acquired before calling +.Fn callout_stop +or one of the +.Fn callout_reset +or +.Fn callout_schedule +functions to provide this safety. +.Pp +A callout initialized via .Fn callout_init with .Fa mpsafe -set to -.Dv FALSE ) , -then this mutex is used to avoid the race conditions. -The associated mutex must be acquired by the caller before calling -.Fn callout_stop -or -.Fn callout_reset -and it is guaranteed that the callout will be correctly stopped -or reset as expected. -Note that it is still necessary to use -.Fn callout_drain -before destroying the callout or its associated mutex. +set to zero is implicitly associated with the +.Va Giant +mutex. +If +.Va Giant +is held when cancelling or rescheduling the callout, +then its use will prevent races with the callout function. .It The return value from .Fn callout_stop -and +.Po +or the .Fn callout_reset +and +.Fn callout_schedule +function families +.Pc indicates whether or not the callout was removed. If it is known that the callout was set and the callout function has not yet executed, then a return value of @@ -607,19 +648,134 @@ data objects that have already been dest To ensure that the callout is completely finished, a call to .Fn callout_drain should be used. -.Sh RETURN VALUES -The +In particular, +a callout should always be drained prior to destroying its associated lock +or releasing the storage for the callout structure. +.Sh LEGACY API +.Bf Sy +The functions below are a legacy API that will be removed in a future release. +New code should not use these routines. +.Ef +.Pp +The function .Fn timeout -function returns a +schedules a call to the function given by the argument +.Fa func +to take place after +.Fa ticks Ns No /hz +seconds. +Non-positive values of +.Fa ticks +are silently converted to the value +.Sq 1 . +.Fa func +should be a pointer to a function that takes a +.Fa void * +argument. +Upon invocation, +.Fa func +will receive +.Fa arg +as its only argument. +The return value from +.Fn timeout +is a .Ft struct callout_handle -that can be passed to +which can be used in conjunction with the +.Fn untimeout +function to request that a scheduled timeout be canceled. +.Pp +The function +.Fn callout_handle_init +can be used to initialize a handle to a state which will cause +any calls to +.Fn untimeout +with that handle to return with no side +effects. +.Pp +Assigning a callout handle the value of +.Fn CALLOUT_HANDLE_INITIALIZER +performs the same function as +.Fn callout_handle_init +and is provided for use on statically declared or global callout handles. +.Pp +The function +.Fn untimeout +cancels the timeout associated with +.Fa handle +using the +.Fa func +and +.Fa arg +arguments to validate the handle. +If the handle does not correspond to a timeout with +the function +.Fa func +taking the argument +.Fa arg +no action is taken. +.Fa handle +must be initialized by a previous call to +.Fn timeout , +.Fn callout_handle_init , +or assigned the value of +.Fn CALLOUT_HANDLE_INITIALIZER "&handle" +before being passed to .Fn untimeout . +The behavior of calling +.Fn untimeout +with an uninitialized handle +is undefined. +.Pp +As handles are recycled by the system, it is possible (although unlikely) +that a handle from one invocation of +.Fn timeout +may match the handle of another invocation of +.Fn timeout +if both calls used the same function pointer and argument, and the first +timeout is expired or canceled before the second call. +The timeout facility offers O(1) running time for +.Fn timeout +and +.Fn untimeout . +Timeouts are executed from +.Fn softclock +with the +.Va Giant +lock held. +Thus they are protected from re-entrancy. +.Sh RETURN VALUES +The +.Fn callout_active +macro returns the state of a callout's +.Em active +flag. +.Pp +The +.Fn callout_pending +macro returns the state of a callout's +.Em pending +flag. +.Pp +The +.Fn callout_reset +and +.Fn callout_schedule +function families return non-zero if the callout was pending before the new +function invocation was scheduled. +.Pp The .Fn callout_stop and .Fn callout_drain functions return non-zero if the callout was still pending when it was called or zero otherwise. +The +.Fn timeout +function returns a +.Ft struct callout_handle +that can be passed to +.Fn untimeout . .Sh HISTORY The current timeout and untimeout routines are based on the work of .An Adam M. Costello From owner-svn-src-head@FreeBSD.ORG Wed Oct 8 21:56:00 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DB86025A; Wed, 8 Oct 2014 21:56:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C89382D1; Wed, 8 Oct 2014 21:56:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s98Lu0M4036552; Wed, 8 Oct 2014 21:56:00 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s98Lu0W8036550; Wed, 8 Oct 2014 21:56:00 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201410082156.s98Lu0W8036550@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 8 Oct 2014 21:56:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272772 - head/share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2014 21:56:01 -0000 Author: jhb Date: Wed Oct 8 21:56:00 2014 New Revision: 272772 URL: https://svnweb.freebsd.org/changeset/base/272772 Log: Forgot to bump Dd. Pointy hat to: jhb Modified: head/share/man/man9/timeout.9 Modified: head/share/man/man9/timeout.9 ============================================================================== --- head/share/man/man9/timeout.9 Wed Oct 8 21:53:24 2014 (r272771) +++ head/share/man/man9/timeout.9 Wed Oct 8 21:56:00 2014 (r272772) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 21, 2014 +.Dd October 8, 2014 .Dt TIMEOUT 9 .Os .Sh NAME From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 00:32:35 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ADA76480; Thu, 9 Oct 2014 00:32:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7FB3D69B; Thu, 9 Oct 2014 00:32:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s990WZIJ013144; Thu, 9 Oct 2014 00:32:35 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s990WYBS013139; Thu, 9 Oct 2014 00:32:34 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410090032.s990WYBS013139@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 9 Oct 2014 00:32:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272777 - in head: etc/mtree usr.sbin/nmtree usr.sbin/nmtree/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 00:32:35 -0000 Author: ngie Date: Thu Oct 9 00:32:33 2014 New Revision: 272777 URL: https://svnweb.freebsd.org/changeset/base/272777 Log: Integrate usr.sbin/nmtree/tests from NetBSD into atf/kyua In collaboration with: pho Sponsored by: EMC / Isilon Storage Division Added: head/usr.sbin/nmtree/tests/ head/usr.sbin/nmtree/tests/Makefile (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/usr.sbin/nmtree/Makefile Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Wed Oct 8 22:13:18 2014 (r272776) +++ head/etc/mtree/BSD.tests.dist Thu Oct 9 00:32:33 2014 (r272777) @@ -287,6 +287,8 @@ .. newsyslog .. + nmtree + .. pw .. sa Modified: head/usr.sbin/nmtree/Makefile ============================================================================== --- head/usr.sbin/nmtree/Makefile Wed Oct 8 22:13:18 2014 (r272776) +++ head/usr.sbin/nmtree/Makefile Thu Oct 9 00:32:33 2014 (r272777) @@ -1,6 +1,6 @@ # $FreeBSD$ -.include +.include .PATH: ${.CURDIR}/../../contrib/mtree @@ -24,4 +24,8 @@ LDADD+= ${LIBNETBSD} LINKS= ${BINDIR}/mtree ${BINDIR}/nmtree MLINKS= mtree.8 nmtree.8 +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + .include Added: head/usr.sbin/nmtree/tests/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/nmtree/tests/Makefile Thu Oct 9 00:32:33 2014 (r272777) @@ -0,0 +1,32 @@ +# $FreeBSD$ + +TESTSRC= ${.CURDIR}/../../../contrib/netbsd-tests/usr.sbin/mtree +.PATH: ${TESTSRC} + +TESTSDIR= ${TESTSBASE}/usr.sbin/nmtree + +ATF_TESTS_SH= nmtree_test +ATF_TESTS_SH_SRC_nmtree_test= t_mtree.sh + +FILESDIR= ${TESTSDIR} + +# NOTE: the output from FreeBSD's nmtree displays sha256digest instead of +# sha256; we need to mangle the specfiles to reflect this. +.for f in mtree_d_create.out netbsd6_d_create.out +CLEANFILES+= $f $f.tmp +FILES+= $f +$f: ${TESTSRC}/$f + sed -e 's/sha256/sha256digest/g' < ${.ALLSRC} > ${.TARGET}.tmp + mv ${.TARGET}.tmp ${.TARGET} +.endfor + +FILES+= d_convert.in +FILES+= d_convert_C.out +FILES+= d_convert_C_S.out +FILES+= d_convert_D.out +FILES+= d_convert_D_S.out +FILES+= d_merge.in +FILES+= d_merge_C_M.out +FILES+= d_merge_C_M_S.out + +.include From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 00:37:58 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B5A90607; Thu, 9 Oct 2014 00:37:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A24EF6CA; Thu, 9 Oct 2014 00:37:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s990bwx4013880; Thu, 9 Oct 2014 00:37:58 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s990bwxB013879; Thu, 9 Oct 2014 00:37:58 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410090037.s990bwxB013879@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 9 Oct 2014 00:37:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272778 - head/etc/mtree X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 00:37:58 -0000 Author: ngie Date: Thu Oct 9 00:37:58 2014 New Revision: 272778 URL: https://svnweb.freebsd.org/changeset/base/272778 Log: Set the autoindent to 4 spaces with vim in BSD.tests.dist This will prevent vim users from accidentally checking in buggy mtree files (mixed tabs/spaces). MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division Modified: head/etc/mtree/BSD.tests.dist Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Thu Oct 9 00:32:33 2014 (r272777) +++ head/etc/mtree/BSD.tests.dist Thu Oct 9 00:37:58 2014 (r272778) @@ -296,3 +296,5 @@ .. .. .. + +# vim: set expandtab ts=4 sw=4: From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 00:41:44 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5471C764; Thu, 9 Oct 2014 00:41:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 264476DD; Thu, 9 Oct 2014 00:41:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s990fiOW017781; Thu, 9 Oct 2014 00:41:44 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s990fhon017578; Thu, 9 Oct 2014 00:41:43 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410090041.s990fhon017578@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 9 Oct 2014 00:41:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272779 - in head: etc/mtree usr.bin/basename usr.bin/basename/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 00:41:44 -0000 Author: ngie Date: Thu Oct 9 00:41:42 2014 New Revision: 272779 URL: https://svnweb.freebsd.org/changeset/base/272779 Log: Integrate usr.sbin/basename/tests from NetBSD into atf/kyua In collaboration with: pho Sponsored by: EMC / Isilon Storage Division Added: head/usr.bin/basename/tests/ head/usr.bin/basename/tests/Makefile (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/usr.bin/basename/Makefile Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Thu Oct 9 00:37:58 2014 (r272778) +++ head/etc/mtree/BSD.tests.dist Thu Oct 9 00:41:42 2014 (r272779) @@ -143,6 +143,8 @@ usr.bin apply .. + basename + .. bmake archives fmt_44bsd Modified: head/usr.bin/basename/Makefile ============================================================================== --- head/usr.bin/basename/Makefile Thu Oct 9 00:37:58 2014 (r272778) +++ head/usr.bin/basename/Makefile Thu Oct 9 00:41:42 2014 (r272779) @@ -1,7 +1,13 @@ # From: @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ +.include + PROG= basename MLINKS= basename.1 dirname.1 +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + .include Added: head/usr.bin/basename/tests/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/basename/tests/Makefile Thu Oct 9 00:41:42 2014 (r272779) @@ -0,0 +1,12 @@ +# $FreeBSD$ + +TESTSRC= ${.CURDIR}/../../../contrib/netbsd-tests/usr.bin/basename +.PATH: ${TESTSRC} + +.include + +TESTSDIR= ${TESTSBASE}/usr.bin/basename +ATF_TESTS_SH= basename_test +ATF_TESTS_SH_SRC_basename_test= t_basename.sh + +.include From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 00:50:34 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EAA8BA56; Thu, 9 Oct 2014 00:50:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D6806816; Thu, 9 Oct 2014 00:50:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s990oYYP021332; Thu, 9 Oct 2014 00:50:34 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s990oYFL021328; Thu, 9 Oct 2014 00:50:34 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410090050.s990oYFL021328@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 9 Oct 2014 00:50:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272780 - in head: etc/mtree usr.bin/cmp usr.bin/cmp/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 00:50:35 -0000 Author: ngie Date: Thu Oct 9 00:50:33 2014 New Revision: 272780 URL: https://svnweb.freebsd.org/changeset/base/272780 Log: Integrate usr.bin/cmp/tests from NetBSD into atf/kyua In collaboration with: sjg Sponsored by: EMC / Isilon Storage Division Added: head/usr.bin/cmp/tests/ head/usr.bin/cmp/tests/Makefile (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/usr.bin/cmp/Makefile Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Thu Oct 9 00:41:42 2014 (r272779) +++ head/etc/mtree/BSD.tests.dist Thu Oct 9 00:50:33 2014 (r272780) @@ -245,6 +245,8 @@ .. calendar .. + cmp + .. comm .. file2c Modified: head/usr.bin/cmp/Makefile ============================================================================== --- head/usr.bin/cmp/Makefile Thu Oct 9 00:41:42 2014 (r272779) +++ head/usr.bin/cmp/Makefile Thu Oct 9 00:50:33 2014 (r272780) @@ -1,7 +1,13 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ +.include + PROG= cmp SRCS= cmp.c link.c misc.c regular.c special.c +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + .include Added: head/usr.bin/cmp/tests/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/cmp/tests/Makefile Thu Oct 9 00:50:33 2014 (r272780) @@ -0,0 +1,12 @@ +# $FreeBSD$ + +TESTSRC= ${.CURDIR}/../../../contrib/netbsd-tests/usr.bin/cmp +.PATH: ${TESTSRC} + +.include + +TESTSDIR= ${TESTSBASE}/usr.bin/cmp +ATF_TESTS_SH= cmp_test +ATF_TESTS_SH_SRC_cmp_test= t_cmp.sh + +.include From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 00:55:06 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4D69ABCF; Thu, 9 Oct 2014 00:55:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 397298C4; Thu, 9 Oct 2014 00:55:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s990t64d023003; Thu, 9 Oct 2014 00:55:06 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s990t5eG023000; Thu, 9 Oct 2014 00:55:05 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410090055.s990t5eG023000@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 9 Oct 2014 00:55:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272781 - in head: etc/mtree usr.bin/dirname usr.bin/dirname/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 00:55:06 -0000 Author: ngie Date: Thu Oct 9 00:55:04 2014 New Revision: 272781 URL: https://svnweb.freebsd.org/changeset/base/272781 Log: Integrate usr.bin/dirname/tests from NetBSD into atf/kyua In collaboration with: pho, sjg Sponsored by: EMC / Isilon Storage Division Added: head/usr.bin/dirname/tests/ head/usr.bin/dirname/tests/Makefile (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/usr.bin/dirname/Makefile Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Thu Oct 9 00:50:33 2014 (r272780) +++ head/etc/mtree/BSD.tests.dist Thu Oct 9 00:55:04 2014 (r272781) @@ -249,6 +249,8 @@ .. comm .. + dirname + .. file2c .. join Modified: head/usr.bin/dirname/Makefile ============================================================================== --- head/usr.bin/dirname/Makefile Thu Oct 9 00:50:33 2014 (r272780) +++ head/usr.bin/dirname/Makefile Thu Oct 9 00:55:04 2014 (r272781) @@ -1,7 +1,13 @@ # From: @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ +.include + PROG= dirname MAN= +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + .include Added: head/usr.bin/dirname/tests/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/dirname/tests/Makefile Thu Oct 9 00:55:04 2014 (r272781) @@ -0,0 +1,12 @@ +# $FreeBSD$ + +TESTSRC= ${.CURDIR}/../../../contrib/netbsd-tests/usr.bin/dirname +.PATH: ${TESTSRC} + +.include + +TESTSDIR= ${TESTSBASE}/usr.bin/dirname +ATF_TESTS_SH= dirname_test +ATF_TESTS_SH_SRC_dirname_test= t_dirname.sh + +.include From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 01:39:08 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E6A6C3AE; Thu, 9 Oct 2014 01:39:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D28ACC21; Thu, 9 Oct 2014 01:39:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s991d8Dn042430; Thu, 9 Oct 2014 01:39:08 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s991d8K5042426; Thu, 9 Oct 2014 01:39:08 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410090139.s991d8K5042426@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 9 Oct 2014 01:39:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272782 - in head: bin/sleep bin/sleep/tests etc/mtree X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 01:39:09 -0000 Author: ngie Date: Thu Oct 9 01:39:07 2014 New Revision: 272782 URL: https://svnweb.freebsd.org/changeset/base/272782 Log: Integrate bin/sleep/tests from NetBSD into atf/kyua Sponsored by: EMC / Isilon Storage Division Added: head/bin/sleep/tests/ head/bin/sleep/tests/Makefile (contents, props changed) Modified: head/bin/sleep/Makefile head/etc/mtree/BSD.tests.dist Modified: head/bin/sleep/Makefile ============================================================================== --- head/bin/sleep/Makefile Thu Oct 9 00:55:04 2014 (r272781) +++ head/bin/sleep/Makefile Thu Oct 9 01:39:07 2014 (r272782) @@ -1,6 +1,12 @@ # @(#)Makefile 8.1 (Berkeley) 5/31/93 # $FreeBSD$ +.include + PROG= sleep +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + .include Added: head/bin/sleep/tests/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sleep/tests/Makefile Thu Oct 9 01:39:07 2014 (r272782) @@ -0,0 +1,12 @@ +# $FreeBSD$ + +TESTSRC= ${.CURDIR}/../../../contrib/netbsd-tests/bin/sleep +.PATH: ${TESTSRC} + +.include + +TESTSDIR= ${TESTSBASE}/bin/sleep +ATF_TESTS_SH= sleep_test +ATF_TESTS_SH_SRC_sleep_test= t_sleep.sh + +.include Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Thu Oct 9 00:55:04 2014 (r272781) +++ head/etc/mtree/BSD.tests.dist Thu Oct 9 01:39:07 2014 (r272782) @@ -47,6 +47,8 @@ set-e .. .. + sleep + .. test .. .. From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 01:46:32 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 816455E6; Thu, 9 Oct 2014 01:46:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5304DCDC; Thu, 9 Oct 2014 01:46:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s991kWSZ046861; Thu, 9 Oct 2014 01:46:32 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s991kV32046857; Thu, 9 Oct 2014 01:46:31 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410090146.s991kV32046857@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 9 Oct 2014 01:46:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272783 - in head: etc/mtree usr.bin/cut usr.bin/cut/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 01:46:32 -0000 Author: ngie Date: Thu Oct 9 01:46:31 2014 New Revision: 272783 URL: https://svnweb.freebsd.org/changeset/base/272783 Log: Integrate usr.bin/cut/tests from NetBSD into atf/kyua Sponsored by: EMC / Isilon Storage Division Added: head/usr.bin/cut/tests/ head/usr.bin/cut/tests/Makefile (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/usr.bin/cut/Makefile Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Thu Oct 9 01:39:07 2014 (r272782) +++ head/etc/mtree/BSD.tests.dist Thu Oct 9 01:46:31 2014 (r272783) @@ -251,6 +251,8 @@ .. comm .. + cut + .. dirname .. file2c Modified: head/usr.bin/cut/Makefile ============================================================================== --- head/usr.bin/cut/Makefile Thu Oct 9 01:39:07 2014 (r272782) +++ head/usr.bin/cut/Makefile Thu Oct 9 01:46:31 2014 (r272783) @@ -1,6 +1,12 @@ # From: @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ +.include + PROG= cut +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + .include Added: head/usr.bin/cut/tests/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/cut/tests/Makefile Thu Oct 9 01:46:31 2014 (r272783) @@ -0,0 +1,21 @@ +# $FreeBSD$ + +TESTSRC= ${.CURDIR}/../../../contrib/netbsd-tests/usr.bin/cut +.PATH: ${TESTSRC} + +.include + +TESTSDIR= ${TESTSBASE}/usr.bin/cut +ATF_TESTS_SH= cut_test +ATF_TESTS_SH_SRC_cut_test= t_cut.sh + +FILESDIR= ${TESTSDIR} +FILES= d_basic.out +FILES+= d_cut.in +FILES+= d_dflag.out +FILES+= d_dsflag.out +FILES+= d_latin1.in +FILES+= d_sflag.out +FILES+= d_utf8.in + +.include From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 01:53:24 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 891AE894; Thu, 9 Oct 2014 01:53:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5AC24D9E; Thu, 9 Oct 2014 01:53:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s991rOwL051253; Thu, 9 Oct 2014 01:53:24 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s991rN51051250; Thu, 9 Oct 2014 01:53:23 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410090153.s991rN51051250@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 9 Oct 2014 01:53:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272784 - in head: etc/mtree usr.bin/grep usr.bin/grep/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 01:53:24 -0000 Author: ngie Date: Thu Oct 9 01:53:23 2014 New Revision: 272784 URL: https://svnweb.freebsd.org/changeset/base/272784 Log: Integrate usr.bin/grep/tests from NetBSD into atf/kyua Sponsored by: EMC / Isilon Storage Division Added: head/usr.bin/grep/tests/ head/usr.bin/grep/tests/Makefile (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/usr.bin/grep/Makefile Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Thu Oct 9 01:46:31 2014 (r272783) +++ head/etc/mtree/BSD.tests.dist Thu Oct 9 01:53:23 2014 (r272784) @@ -257,6 +257,8 @@ .. file2c .. + grep + .. join .. jot Modified: head/usr.bin/grep/Makefile ============================================================================== --- head/usr.bin/grep/Makefile Thu Oct 9 01:46:31 2014 (r272783) +++ head/usr.bin/grep/Makefile Thu Oct 9 01:53:23 2014 (r272784) @@ -85,4 +85,8 @@ DPADD+= ${LIBGNUREGEX} CFLAGS+= -DWITHOUT_NLS .endif +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + .include Added: head/usr.bin/grep/tests/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/grep/tests/Makefile Thu Oct 9 01:53:23 2014 (r272784) @@ -0,0 +1,41 @@ +# $FreeBSD$ + +TESTSRC= ${.CURDIR}/../../../contrib/netbsd-tests/usr.bin/grep +.PATH: ${TESTSRC} + +.include + +TESTSDIR= ${TESTSBASE}/usr.bin/grep + +ATF_TESTS_SH= grep_test +ATF_TESTS_SH_SRC_grep_test= t_grep.sh + +FILESDIR= ${TESTSDIR} +FILES= d_basic.out +FILES+= d_begin_end_a.out +FILES+= d_begin_end_b.out +FILES+= d_binary.out +FILES+= d_context2_a.out +FILES+= d_context2_b.out +FILES+= d_context2_c.out +FILES+= d_context_a.in +FILES+= d_context_a.out +FILES+= d_context_b.in +FILES+= d_context_b.out +FILES+= d_context_c.out +FILES+= d_context_d.out +FILES+= d_egrep.out +FILES+= d_file_exp.in +FILES+= d_file_exp.out +FILES+= d_ignore_case.out +FILES+= d_input +FILES+= d_invert.in +FILES+= d_invert.out +FILES+= d_recurse.out +FILES+= d_recurse_symlink.err +FILES+= d_recurse_symlink.out +FILES+= d_whole_line.out +FILES+= d_word_regexps.out +FILES+= d_zgrep.out + +.include From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 01:54:33 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 720A59D4; Thu, 9 Oct 2014 01:54:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5E3BFDA4; Thu, 9 Oct 2014 01:54:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s991sX9D051446; Thu, 9 Oct 2014 01:54:33 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s991sXmN051445; Thu, 9 Oct 2014 01:54:33 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201410090154.s991sXmN051445@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Thu, 9 Oct 2014 01:54:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272785 - head/sys/boot/i386/gptboot X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 01:54:33 -0000 Author: marcel Date: Thu Oct 9 01:54:32 2014 New Revision: 272785 URL: https://svnweb.freebsd.org/changeset/base/272785 Log: Properly NUL-terminate the on-stack buffer for reading /boot.config or /boot/config. In qemu, on a warm boot, the stack is not all zeroes and we parse beyond the file's contents. Obtained from: Juniper Networks, Inc. Modified: head/sys/boot/i386/gptboot/gptboot.c Modified: head/sys/boot/i386/gptboot/gptboot.c ============================================================================== --- head/sys/boot/i386/gptboot/gptboot.c Thu Oct 9 01:53:23 2014 (r272784) +++ head/sys/boot/i386/gptboot/gptboot.c Thu Oct 9 01:54:32 2014 (r272785) @@ -136,6 +136,7 @@ int main(void) { char cmd[512], cmdtmp[512]; + ssize_t sz; int autoboot, dskupdated; ufs_ino_t ino; @@ -164,9 +165,10 @@ main(void) for (;;) { *kname = '\0'; if ((ino = lookup(PATH_CONFIG)) || - (ino = lookup(PATH_DOTCONFIG))) - fsread(ino, cmd, sizeof(cmd)); - + (ino = lookup(PATH_DOTCONFIG))) { + sz = fsread(ino, cmd, sizeof(cmd) - 1); + cmd[(sz < 0) ? 0 : sz] = '\0'; + } if (*cmd != '\0') { memcpy(cmdtmp, cmd, sizeof(cmdtmp)); if (parse(cmdtmp, &dskupdated)) From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 01:59:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 440B7B62; Thu, 9 Oct 2014 01:59:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 30423DC8; Thu, 9 Oct 2014 01:59:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s991xQXB052124; Thu, 9 Oct 2014 01:59:26 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s991xQr8052123; Thu, 9 Oct 2014 01:59:26 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201410090159.s991xQr8052123@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Thu, 9 Oct 2014 01:59:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272786 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 01:59:26 -0000 Author: marcel Date: Thu Oct 9 01:59:25 2014 New Revision: 272786 URL: https://svnweb.freebsd.org/changeset/base/272786 Log: Apply r269126 to tty_timedwait(): Don't return ERESTART when the device is gone. Modified: head/sys/kern/tty.c Modified: head/sys/kern/tty.c ============================================================================== --- head/sys/kern/tty.c Thu Oct 9 01:54:32 2014 (r272785) +++ head/sys/kern/tty.c Thu Oct 9 01:59:25 2014 (r272786) @@ -1392,14 +1392,14 @@ tty_timedwait(struct tty *tp, struct cv error = cv_timedwait_sig(cv, tp->t_mtx, hz); - /* Restart the system call when we may have been revoked. */ - if (tp->t_revokecnt != revokecnt) - return (ERESTART); - /* Bail out when the device slipped away. */ if (tty_gone(tp)) return (ENXIO); + /* Restart the system call when we may have been revoked. */ + if (tp->t_revokecnt != revokecnt) + return (ERESTART); + return (error); } From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 02:07:35 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E16C6DCA; Thu, 9 Oct 2014 02:07:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B34A5EA6; Thu, 9 Oct 2014 02:07:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9927Zbm056726; Thu, 9 Oct 2014 02:07:35 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9927ZcF056723; Thu, 9 Oct 2014 02:07:35 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410090207.s9927ZcF056723@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 9 Oct 2014 02:07:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272787 - in head: etc/mtree gnu/usr.bin/diff gnu/usr.bin/diff/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 02:07:36 -0000 Author: ngie Date: Thu Oct 9 02:07:34 2014 New Revision: 272787 URL: https://svnweb.freebsd.org/changeset/base/272787 Log: Integrate usr.bin/diff/tests from NetBSD into atf/kyua at gnu/usr.bin/diff/tests Sponsored by: EMC / Isilon Storage Division Added: head/gnu/usr.bin/diff/tests/ head/gnu/usr.bin/diff/tests/Makefile (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/gnu/usr.bin/diff/Makefile Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Thu Oct 9 01:59:25 2014 (r272786) +++ head/etc/mtree/BSD.tests.dist Thu Oct 9 02:07:34 2014 (r272787) @@ -70,6 +70,8 @@ lib .. usr.bin + diff + .. .. .. lib Modified: head/gnu/usr.bin/diff/Makefile ============================================================================== --- head/gnu/usr.bin/diff/Makefile Thu Oct 9 01:59:25 2014 (r272786) +++ head/gnu/usr.bin/diff/Makefile Thu Oct 9 02:07:34 2014 (r272787) @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + DIFFSRC=${.CURDIR}/../../../contrib/diff/src .PATH: ${DIFFSRC} \ ${.CURDIR}/../../../contrib/diff/lib \ @@ -27,4 +29,8 @@ SUBDIR+=doc DPADD= ${LIBGNUREGEX} LDADD= -lgnuregex +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + .include Added: head/gnu/usr.bin/diff/tests/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/gnu/usr.bin/diff/tests/Makefile Thu Oct 9 02:07:34 2014 (r272787) @@ -0,0 +1,17 @@ +# $FreeBSD$ + +TESTSRC= ${.CURDIR}/../../../../contrib/netbsd-tests/usr.bin/diff +.PATH: ${TESTSRC} + +.include + +TESTSDIR= ${TESTSBASE}/gnu/usr.bin/diff +ATF_TESTS_SH= diff_test +ATF_TESTS_SH_SED_diff_test= -e 's/t_diff/`basename $$0`/g' +ATF_TESTS_SH_SRC_diff_test= t_diff.sh + +FILESDIR= ${TESTSDIR} +FILES+= d_mallocv1.in +FILES+= d_mallocv2.in + +.include From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 02:24:35 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8CF449F; Thu, 9 Oct 2014 02:24:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 78B0FB9; Thu, 9 Oct 2014 02:24:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s992OZjk065867; Thu, 9 Oct 2014 02:24:35 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s992OYhr065864; Thu, 9 Oct 2014 02:24:34 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410090224.s992OYhr065864@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 9 Oct 2014 02:24:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272788 - in head: etc/mtree usr.bin/gzip usr.bin/gzip/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 02:24:35 -0000 Author: ngie Date: Thu Oct 9 02:24:34 2014 New Revision: 272788 URL: https://svnweb.freebsd.org/changeset/base/272788 Log: Integrate usr.bin/gzip/tests from NetBSD into atf/kyua Sponsored by: EMC / Isilon Storage Division Added: head/usr.bin/gzip/tests/ head/usr.bin/gzip/tests/Makefile (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/usr.bin/gzip/Makefile Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Thu Oct 9 02:07:34 2014 (r272787) +++ head/etc/mtree/BSD.tests.dist Thu Oct 9 02:24:34 2014 (r272788) @@ -261,6 +261,8 @@ .. grep .. + gzip + .. join .. jot Modified: head/usr.bin/gzip/Makefile ============================================================================== --- head/usr.bin/gzip/Makefile Thu Oct 9 02:07:34 2014 (r272787) +++ head/usr.bin/gzip/Makefile Thu Oct 9 02:24:34 2014 (r272788) @@ -28,4 +28,8 @@ LINKS+= ${BINDIR}/gzip ${BINDIR}/gunzip ${BINDIR}/gzip ${BINDIR}/zcat \ ${BINDIR}/zdiff ${BINDIR}/zcmp +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + .include Added: head/usr.bin/gzip/tests/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/gzip/tests/Makefile Thu Oct 9 02:24:34 2014 (r272788) @@ -0,0 +1,12 @@ +# $FreeBSD$ + +TESTSRC= ${.CURDIR}/../../../contrib/netbsd-tests/usr.bin/gzip +.PATH: ${TESTSRC} + +.include + +TESTSDIR= ${TESTSBASE}/usr.bin/gzip +ATF_TESTS_SH= gzip_test +ATF_TESTS_SH_SRC_gzip_test= t_gzip.sh + +.include From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 02:30:39 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A446D20D; Thu, 9 Oct 2014 02:30:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 85286164; Thu, 9 Oct 2014 02:30:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s992UdtG066761; Thu, 9 Oct 2014 02:30:39 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s992UdpV066760; Thu, 9 Oct 2014 02:30:39 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201410090230.s992UdpV066760@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Thu, 9 Oct 2014 02:30:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272789 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 02:30:39 -0000 Author: marcel Date: Thu Oct 9 02:30:38 2014 New Revision: 272789 URL: https://svnweb.freebsd.org/changeset/base/272789 Log: Fix draining in ttydev_leave(): 1. ERESTART is not only returned when the revoke count changed. It is also returned when a signal is received. While a change in the revoke count should be ignored, a signal should not. 2. Waiting until the output queue is entirely drained can cause a hang when the underlying device is stuck or broken. Have tty_drain() take care of this by telling it when we're leaving. When leaving, tty_drain() will use a timed wait to address point 2 above and it will check the revoke count to handle point 1 above. The timeout is set to 1 second, which is arbitrary and long enough to expect a change in the output queue. Discussed with: jilles@ Reported by: Yamagi Burmeister Modified: head/sys/kern/tty.c Modified: head/sys/kern/tty.c ============================================================================== --- head/sys/kern/tty.c Thu Oct 9 02:24:34 2014 (r272788) +++ head/sys/kern/tty.c Thu Oct 9 02:30:38 2014 (r272789) @@ -123,9 +123,10 @@ tty_watermarks(struct tty *tp) } static int -tty_drain(struct tty *tp) +tty_drain(struct tty *tp, int leaving) { - int error; + size_t bytesused; + int error, revokecnt; if (ttyhook_hashook(tp, getc_inject)) /* buffer is inaccessible */ @@ -134,11 +135,27 @@ tty_drain(struct tty *tp) while (ttyoutq_bytesused(&tp->t_outq) > 0) { ttydevsw_outwakeup(tp); /* Could be handled synchronously. */ - if (ttyoutq_bytesused(&tp->t_outq) == 0) + bytesused = ttyoutq_bytesused(&tp->t_outq); + if (bytesused == 0) return (0); /* Wait for data to be drained. */ - error = tty_wait(tp, &tp->t_outwait); + if (leaving) { + revokecnt = tp->t_revokecnt; + error = tty_timedwait(tp, &tp->t_outwait, hz); + switch (error) { + case ERESTART: + if (revokecnt != tp->t_revokecnt) + error = 0; + break; + case EWOULDBLOCK: + if (ttyoutq_bytesused(&tp->t_outq) < bytesused) + error = 0; + break; + } + } else + error = tty_wait(tp, &tp->t_outwait); + if (error) return (error); } @@ -191,10 +208,8 @@ ttydev_leave(struct tty *tp) /* Drain any output. */ MPASS((tp->t_flags & TF_STOPPED) == 0); - if (!tty_gone(tp)) { - while (tty_drain(tp) == ERESTART) - ; - } + if (!tty_gone(tp)) + tty_drain(tp, 1); ttydisc_close(tp); @@ -1528,7 +1543,7 @@ tty_generic_ioctl(struct tty *tp, u_long /* Set terminal flags through tcsetattr(). */ if (cmd == TIOCSETAW || cmd == TIOCSETAF) { - error = tty_drain(tp); + error = tty_drain(tp, 0); if (error) return (error); if (cmd == TIOCSETAF) @@ -1707,7 +1722,7 @@ tty_generic_ioctl(struct tty *tp, u_long } case TIOCDRAIN: /* Drain TTY output. */ - return tty_drain(tp); + return tty_drain(tp, 0); case TIOCCONS: /* Set terminal as console TTY. */ if (*(int *)data) { From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 04:40:20 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9DE84D6A; Thu, 9 Oct 2014 04:40:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89DEDF15; Thu, 9 Oct 2014 04:40:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s994eKW5030662; Thu, 9 Oct 2014 04:40:20 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s994eKZp030661; Thu, 9 Oct 2014 04:40:20 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201410090440.s994eKZp030661@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Thu, 9 Oct 2014 04:40:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272796 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 04:40:20 -0000 Author: bryanv Date: Thu Oct 9 04:40:19 2014 New Revision: 272796 URL: https://svnweb.freebsd.org/changeset/base/272796 Log: Add M_FLOWID to M_COPYFLAGS The M_FLOWID flag should be propagated to the new mbuf pkthdr in m_move_pkthdr() and m_dup_pkthdr(). The new mbuf already got the existing flowid value, but would be ignored since the flag was not set. Phabricator: https://reviews.freebsd.org/D914 Reviewed by: adrian Obtained from: NetApp MFC after: 1 week Modified: head/sys/sys/mbuf.h Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Thu Oct 9 04:10:58 2014 (r272795) +++ head/sys/sys/mbuf.h Thu Oct 9 04:40:19 2014 (r272796) @@ -248,7 +248,7 @@ struct mbuf { * Flags preserved when copying m_pkthdr. */ #define M_COPYFLAGS \ - (M_PKTHDR|M_EOR|M_RDONLY|M_BCAST|M_MCAST|M_VLANTAG|M_PROMISC| \ + (M_PKTHDR|M_EOR|M_RDONLY|M_BCAST|M_MCAST|M_PROMISC|M_VLANTAG|M_FLOWID| \ M_PROTOFLAGS) /* From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 05:17:48 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7E06E2FB; Thu, 9 Oct 2014 05:17:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A13B2DB; Thu, 9 Oct 2014 05:17:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s995HmY0048114; Thu, 9 Oct 2014 05:17:48 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s995HmSx048113; Thu, 9 Oct 2014 05:17:48 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201410090517.s995HmSx048113@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Thu, 9 Oct 2014 05:17:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272797 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 05:17:48 -0000 Author: bryanv Date: Thu Oct 9 05:17:47 2014 New Revision: 272797 URL: https://svnweb.freebsd.org/changeset/base/272797 Log: Check for mbuf copy failure when there are multiple multicast sockets This partitular case is the only path where the mbuf could be NULL. udp_append() checked for a NULL mbuf only after invoking the tunneling callback. Our only in tree tunneling callback - SCTP - assumed a non NULL mbuf, and it is a bit odd to make the callbacks responsible for checking this condition. This also reduces the differences between the IPv4 and IPv6 code. MFC after: 1 month Modified: head/sys/netinet/udp_usrreq.c Modified: head/sys/netinet/udp_usrreq.c ============================================================================== --- head/sys/netinet/udp_usrreq.c Thu Oct 9 04:40:19 2014 (r272796) +++ head/sys/netinet/udp_usrreq.c Thu Oct 9 05:17:47 2014 (r272797) @@ -316,9 +316,6 @@ udp_append(struct inpcb *inp, struct ip return; } - if (n == NULL) - return; - off += sizeof(struct udphdr); #ifdef IPSEC @@ -578,8 +575,10 @@ udp_input(struct mbuf **mp, int *offp, i if (last != NULL) { struct mbuf *n; - n = m_copy(m, 0, M_COPYALL); - udp_append(last, ip, n, iphlen, &udp_in); + if ((n = m_copy(m, 0, M_COPYALL)) != NULL) { + udp_append(last, ip, n, iphlen, + &udp_in); + } INP_RUNLOCK(last); } last = inp; From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 05:33:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 11A50791; Thu, 9 Oct 2014 05:33:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E6A0E67A; Thu, 9 Oct 2014 05:33:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s995XRM9057146; Thu, 9 Oct 2014 05:33:27 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s995XQDf057138; Thu, 9 Oct 2014 05:33:26 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201410090533.s995XQDf057138@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 9 Oct 2014 05:33:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272799 - in head/sys: dev/acpica dev/pci kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 05:33:28 -0000 Author: adrian Date: Thu Oct 9 05:33:25 2014 New Revision: 272799 URL: https://svnweb.freebsd.org/changeset/base/272799 Log: Add a bus method to fetch the VM domain for the given device/bus. * Add a bus_if.m method - get_domain() - returning the VM domain or ENOENT if the device isn't in a VM domain; * Add bus methods to print out the domain of the device if appropriate; * Add code in srat.c to save the PXM -> VM domain mapping that's done and expose a function to translate VM domain -> PXM; * Add ACPI and ACPI PCI methods to check if the bus has a _PXM attribute and if so map it to the VM domain; * (.. yes, this works recursively.) * Have the pci bus glue print out the device VM domain if present. Note: this is just the plumbing to start enumerating information - it doesn't at all modify behaviour. Differential Revision: D906 Reviewed by: jhb Sponsored by: Norse Corp Modified: head/sys/dev/acpica/acpi.c head/sys/dev/acpica/acpi_pci.c head/sys/dev/acpica/acpivar.h head/sys/dev/pci/pci.c head/sys/kern/bus_if.m head/sys/kern/subr_bus.c head/sys/sys/bus.h Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Thu Oct 9 05:28:11 2014 (r272798) +++ head/sys/dev/acpica/acpi.c Thu Oct 9 05:33:25 2014 (r272799) @@ -208,6 +208,7 @@ static device_method_t acpi_methods[] = DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), DEVMETHOD(bus_hint_device_unit, acpi_hint_device_unit), + DEVMETHOD(bus_get_domain, acpi_get_domain), /* ACPI bus */ DEVMETHOD(acpi_id_probe, acpi_device_id_probe), @@ -794,6 +795,7 @@ acpi_print_child(device_t bus, device_t retval += resource_list_print_type(rl, "drq", SYS_RES_DRQ, "%ld"); if (device_get_flags(child)) retval += printf(" flags %#x", device_get_flags(child)); + retval += bus_print_child_domain(bus, child); retval += bus_print_child_footer(bus, child); return (retval); @@ -1067,6 +1069,35 @@ acpi_hint_device_unit(device_t acdev, de } /* + * Fech the NUMA domain for the given device. + * + * If a device has a _PXM method, map that to a NUMA domain. + * + * If none is found, then it'll call the parent method. + * If there's no domain, return ENOENT. + */ +int +acpi_get_domain(device_t dev, device_t child, int *domain) +{ +#if MAXMEMDOM > 1 + ACPI_HANDLE h; + int d, pxm; + + h = acpi_get_handle(child); + if ((h != NULL) && + ACPI_SUCCESS(acpi_GetInteger(h, "_PXM", &pxm))) { + d = acpi_map_pxm_to_vm_domainid(pxm); + if (d < 0) + return (ENOENT); + *domain = d; + return (0); + } +#endif + /* No _PXM node; go up a level */ + return (bus_generic_get_domain(dev, child, domain)); +} + +/* * Pre-allocate/manage all memory and IO resources. Since rman can't handle * duplicates, we merge any in the sysresource attach routine. */ Modified: head/sys/dev/acpica/acpi_pci.c ============================================================================== --- head/sys/dev/acpica/acpi_pci.c Thu Oct 9 05:28:11 2014 (r272798) +++ head/sys/dev/acpica/acpi_pci.c Thu Oct 9 05:33:25 2014 (r272799) @@ -94,6 +94,7 @@ static device_method_t acpi_pci_methods[ DEVMETHOD(bus_write_ivar, acpi_pci_write_ivar), DEVMETHOD(bus_child_location_str, acpi_pci_child_location_str_method), DEVMETHOD(bus_get_dma_tag, acpi_pci_get_dma_tag), + DEVMETHOD(bus_get_domain, acpi_get_domain), /* PCI interface */ DEVMETHOD(pci_set_powerstate, acpi_pci_set_powerstate_method), Modified: head/sys/dev/acpica/acpivar.h ============================================================================== --- head/sys/dev/acpica/acpivar.h Thu Oct 9 05:28:11 2014 (r272798) +++ head/sys/dev/acpica/acpivar.h Thu Oct 9 05:33:25 2014 (r272799) @@ -489,5 +489,16 @@ ACPI_HANDLE acpi_GetReference(ACPI_HANDL SYSCTL_DECL(_debug_acpi); +/* + * Map a PXM to a VM domain. + * + * Returns the VM domain ID if found, or -1 if not found / invalid. + */ +#if MAXMEMDOM > 1 +extern int acpi_map_pxm_to_vm_domainid(int pxm); +#endif + +extern int acpi_get_domain(device_t dev, device_t child, int *domain); + #endif /* _KERNEL */ #endif /* !_ACPIVAR_H_ */ Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Thu Oct 9 05:28:11 2014 (r272798) +++ head/sys/dev/pci/pci.c Thu Oct 9 05:33:25 2014 (r272799) @@ -3965,6 +3965,7 @@ pci_print_child(device_t dev, device_t c retval += printf(" at device %d.%d", pci_get_slot(child), pci_get_function(child)); + retval += bus_print_child_domain(dev, child); retval += bus_print_child_footer(dev, child); return (retval); Modified: head/sys/kern/bus_if.m ============================================================================== --- head/sys/kern/bus_if.m Thu Oct 9 05:28:11 2014 (r272798) +++ head/sys/kern/bus_if.m Thu Oct 9 05:33:25 2014 (r272799) @@ -692,3 +692,16 @@ METHOD int resume_child { device_t _dev; device_t _child; } DEFAULT bus_generic_resume_child; + +/** + * @brief Get the VM domain handle for the given bus and child. + * + * @param _dev the bus device + * @param _child the child device + * @param _domain a pointer to the bus's domain handle identifier + */ +METHOD int get_domain { + device_t _dev; + device_t _child; + int *_domain; +} DEFAULT bus_generic_get_domain; Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Thu Oct 9 05:28:11 2014 (r272798) +++ head/sys/kern/subr_bus.c Thu Oct 9 05:33:25 2014 (r272799) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -3754,6 +3755,25 @@ bus_print_child_footer(device_t dev, dev /** * @brief Helper function for implementing BUS_PRINT_CHILD(). * + * This function prints out the VM domain for the given device. + * + * @returns the number of characters printed + */ +int +bus_print_child_domain(device_t dev, device_t child) +{ + int domain; + + /* No domain? Don't print anything */ + if (BUS_GET_DOMAIN(dev, child, &domain) != 0) + return (0); + + return (printf(" numa-domain %d", domain)); +} + +/** + * @brief Helper function for implementing BUS_PRINT_CHILD(). + * * This function simply calls bus_print_child_header() followed by * bus_print_child_footer(). * @@ -3765,6 +3785,7 @@ bus_generic_print_child(device_t dev, de int retval = 0; retval += bus_print_child_header(dev, child); + retval += bus_print_child_domain(dev, child); retval += bus_print_child_footer(dev, child); return (retval); @@ -4179,6 +4200,16 @@ bus_generic_child_present(device_t dev, return (BUS_CHILD_PRESENT(device_get_parent(dev), dev)); } +int +bus_generic_get_domain(device_t dev, device_t child, int *domain) +{ + + if (dev->parent) + return (BUS_GET_DOMAIN(dev->parent, dev, domain)); + + return (ENOENT); +} + /* * Some convenience functions to make it easier for drivers to use the * resource-management functions. All these really do is hide the Modified: head/sys/sys/bus.h ============================================================================== --- head/sys/sys/bus.h Thu Oct 9 05:28:11 2014 (r272798) +++ head/sys/sys/bus.h Thu Oct 9 05:33:25 2014 (r272799) @@ -331,6 +331,7 @@ struct resource_list * bus_generic_get_resource_list (device_t, device_t); void bus_generic_new_pass(device_t dev); int bus_print_child_header(device_t dev, device_t child); +int bus_print_child_domain(device_t dev, device_t child); int bus_print_child_footer(device_t dev, device_t child); int bus_generic_print_child(device_t dev, device_t child); int bus_generic_probe(device_t dev); @@ -364,6 +365,8 @@ int bus_generic_teardown_intr(device_t d int bus_generic_write_ivar(device_t dev, device_t child, int which, uintptr_t value); +int bus_generic_get_domain(device_t dev, device_t child, int *domain); + /* * Wrapper functions for the BUS_*_RESOURCE methods to make client code * a little simpler. From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 05:34:29 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 67E188DF; Thu, 9 Oct 2014 05:34:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A533683; Thu, 9 Oct 2014 05:34:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s995YTPE057315; Thu, 9 Oct 2014 05:34:29 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s995YTUx057314; Thu, 9 Oct 2014 05:34:29 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201410090534.s995YTUx057314@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 9 Oct 2014 05:34:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272800 - head/sys/x86/acpica X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 05:34:29 -0000 Author: adrian Date: Thu Oct 9 05:34:28 2014 New Revision: 272800 URL: https://svnweb.freebsd.org/changeset/base/272800 Log: Missing from previous commit - keep the VM domain -> PXM mapping array and use it to map PXM -> VM domain when needed. Differential Revision: D906 Reviewed by: jhb Modified: head/sys/x86/acpica/srat.c Modified: head/sys/x86/acpica/srat.c ============================================================================== --- head/sys/x86/acpica/srat.c Thu Oct 9 05:33:25 2014 (r272799) +++ head/sys/x86/acpica/srat.c Thu Oct 9 05:34:28 2014 (r272800) @@ -62,6 +62,8 @@ int num_mem; static ACPI_TABLE_SRAT *srat; static vm_paddr_t srat_physaddr; +static int vm_domains[VM_PHYSSEG_MAX]; + static void srat_walk_table(acpi_subtable_handler *handler, void *arg); /* @@ -247,7 +249,6 @@ check_phys_avail(void) static int renumber_domains(void) { - int domains[VM_PHYSSEG_MAX]; int i, j, slot; /* Enumerate all the domains. */ @@ -255,17 +256,17 @@ renumber_domains(void) for (i = 0; i < num_mem; i++) { /* See if this domain is already known. */ for (j = 0; j < vm_ndomains; j++) { - if (domains[j] >= mem_info[i].domain) + if (vm_domains[j] >= mem_info[i].domain) break; } - if (j < vm_ndomains && domains[j] == mem_info[i].domain) + if (j < vm_ndomains && vm_domains[j] == mem_info[i].domain) continue; /* Insert the new domain at slot 'j'. */ slot = j; for (j = vm_ndomains; j > slot; j--) - domains[j] = domains[j - 1]; - domains[slot] = mem_info[i].domain; + vm_domains[j] = vm_domains[j - 1]; + vm_domains[slot] = mem_info[i].domain; vm_ndomains++; if (vm_ndomains > MAXMEMDOM) { vm_ndomains = 1; @@ -280,15 +281,15 @@ renumber_domains(void) * If the domain is already the right value, no need * to renumber. */ - if (domains[i] == i) + if (vm_domains[i] == i) continue; /* Walk the cpu[] and mem_info[] arrays to renumber. */ for (j = 0; j < num_mem; j++) - if (mem_info[j].domain == domains[i]) + if (mem_info[j].domain == vm_domains[i]) mem_info[j].domain = i; for (j = 0; j <= MAX_APIC_ID; j++) - if (cpus[j].enabled && cpus[j].domain == domains[i]) + if (cpus[j].enabled && cpus[j].domain == vm_domains[i]) cpus[j].domain = i; } KASSERT(vm_ndomains > 0, @@ -368,4 +369,23 @@ srat_set_cpus(void *dummy) } } SYSINIT(srat_set_cpus, SI_SUB_CPU, SI_ORDER_ANY, srat_set_cpus, NULL); + +/* + * Map a _PXM value to a VM domain ID. + * + * Returns the domain ID, or -1 if no domain ID was found. + */ +int +acpi_map_pxm_to_vm_domainid(int pxm) +{ + int i; + + for (i = 0; i < vm_ndomains; i++) { + if (vm_domains[i] == pxm) + return (i); + } + + return (-1); +} + #endif /* MAXMEMDOM > 1 */ From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 05:42:08 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 291B9A9F; Thu, 9 Oct 2014 05:42:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EFB4A7A8; Thu, 9 Oct 2014 05:42:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s995g73k061633; Thu, 9 Oct 2014 05:42:07 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s995g7Tu061632; Thu, 9 Oct 2014 05:42:07 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201410090542.s995g7Tu061632@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Thu, 9 Oct 2014 05:42:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272801 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 05:42:08 -0000 Author: bryanv Date: Thu Oct 9 05:42:07 2014 New Revision: 272801 URL: https://svnweb.freebsd.org/changeset/base/272801 Log: Move the calls to u_tun_func() into udp6_append() A similar cleanup for UDPv4 was performed in r220620. Phabricator: https://reviews.freebsd.org/D383 Reviewed by: gnn MFC after: 1 month Modified: head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Thu Oct 9 05:34:28 2014 (r272800) +++ head/sys/netinet6/udp6_usrreq.c Thu Oct 9 05:42:07 2014 (r272801) @@ -141,9 +141,18 @@ udp6_append(struct inpcb *inp, struct mb { struct socket *so; struct mbuf *opts; + struct udpcb *up; INP_LOCK_ASSERT(inp); + /* + * Engage the tunneling protocol. + */ + up = intoudpcb(inp); + if (up->u_tun_func != NULL) { + (*up->u_tun_func)(n, off, inp); + return; + } #ifdef IPSEC /* Check AH/ESP integrity. */ if (ipsec6_in_reject(n, inp)) { @@ -361,20 +370,7 @@ udp6_input(struct mbuf **mp, int *offp, if ((n = m_copy(m, 0, M_COPYALL)) != NULL) { INP_RLOCK(last); - up = intoudpcb(last); - if (up->u_tun_func == NULL) { - udp6_append(last, n, off, &fromsa); - } else { - /* - * Engage the tunneling - * protocol we will have to - * leave the info_lock up, - * since we are hunting - * through multiple UDP's. - * - */ - (*up->u_tun_func)(n, off, last); - } + udp6_append(last, n, off, &fromsa); INP_RUNLOCK(last); } } @@ -404,16 +400,8 @@ udp6_input(struct mbuf **mp, int *offp, } INP_RLOCK(last); INP_INFO_RUNLOCK(pcbinfo); - up = intoudpcb(last); UDP_PROBE(receive, NULL, last, ip6, last, uh); - if (up->u_tun_func == NULL) { - udp6_append(last, m, off, &fromsa); - } else { - /* - * Engage the tunneling protocol. - */ - (*up->u_tun_func)(m, off, last); - } + udp6_append(last, m, off, &fromsa); INP_RUNLOCK(last); return (IPPROTO_DONE); } @@ -492,15 +480,7 @@ udp6_input(struct mbuf **mp, int *offp, } } UDP_PROBE(receive, NULL, inp, ip6, inp, uh); - if (up->u_tun_func == NULL) { - udp6_append(inp, m, off, &fromsa); - } else { - /* - * Engage the tunneling protocol. - */ - - (*up->u_tun_func)(m, off, inp); - } + udp6_append(inp, m, off, &fromsa); INP_RUNLOCK(inp); return (IPPROTO_DONE); From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 05:53:59 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5483328C; Thu, 9 Oct 2014 05:53:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 412E388B; Thu, 9 Oct 2014 05:53:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s995rxc3066789; Thu, 9 Oct 2014 05:53:59 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s995rxHK066788; Thu, 9 Oct 2014 05:53:59 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410090553.s995rxHK066788@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 9 Oct 2014 05:53:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272805 - head/sys/cam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 05:53:59 -0000 Author: mav Date: Thu Oct 9 05:53:58 2014 New Revision: 272805 URL: https://svnweb.freebsd.org/changeset/base/272805 Log: Use proper variable when looping through periphs with CAM_PERIPH_FREE. PR: 194256 Submitted by: Scott M. Ferris MFC after: 3 days Sponsored by: EMC/Isilon Storage Division Modified: head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Thu Oct 9 05:53:04 2014 (r272804) +++ head/sys/cam/cam_xpt.c Thu Oct 9 05:53:58 2014 (r272805) @@ -2195,7 +2195,7 @@ xptperiphtraverse(struct cam_ed *device, next_periph = SLIST_NEXT(periph, periph_links); while (next_periph != NULL && (next_periph->flags & CAM_PERIPH_FREE) != 0) - next_periph = SLIST_NEXT(periph, periph_links); + next_periph = SLIST_NEXT(next_periph, periph_links); if (next_periph) next_periph->refcount++; mtx_unlock(&bus->eb_mtx); @@ -2269,7 +2269,7 @@ xptpdperiphtraverse(struct periph_driver next_periph = TAILQ_NEXT(periph, unit_links); while (next_periph != NULL && (next_periph->flags & CAM_PERIPH_FREE) != 0) - next_periph = TAILQ_NEXT(periph, unit_links); + next_periph = TAILQ_NEXT(next_periph, unit_links); if (next_periph) next_periph->refcount++; xpt_unlock_buses(); From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 06:02:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6FD70626; Thu, 9 Oct 2014 06:02:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5B98097A; Thu, 9 Oct 2014 06:02:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9962s1h071638; Thu, 9 Oct 2014 06:02:54 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9962sA0071637; Thu, 9 Oct 2014 06:02:54 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410090602.s9962sA0071637@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 9 Oct 2014 06:02:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272806 - head/cddl/contrib/opensolaris/cmd/zdb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 06:02:54 -0000 Author: delphij Date: Thu Oct 9 06:02:53 2014 New Revision: 272806 URL: https://svnweb.freebsd.org/changeset/base/272806 Log: MFV r272802: - Limit ARC for zdb at 256MB. zdb do not typically revisit data in the ARC. - Increase default max_inflight from 200 to 1000 (can be overriden by -I) so we can queue more I/Os when doing scrubbing. - Print status while loading meataslabs for leak detection. Illumos issues: 5169 zdb should limit its ARC size 5170 zdb -c should create more scrub i/os by default 5171 zdb should print status while loading metaslabs for leak detection MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Oct 9 05:53:58 2014 (r272805) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Oct 9 06:02:53 2014 (r272806) @@ -76,8 +76,10 @@ #ifndef lint extern boolean_t zfs_recover; +extern uint64_t zfs_arc_max, zfs_arc_meta_limit; #else boolean_t zfs_recover; +uint64_t zfs_arc_max, zfs_arc_meta_limit; #endif const char cmdname[] = "zdb"; @@ -89,7 +91,7 @@ extern void dump_intent_log(zilog_t *); uint64_t *zopt_object = NULL; int zopt_objects = 0; libzfs_handle_t *g_zfs; -uint64_t max_inflight = 200; +uint64_t max_inflight = 1000; /* * These libumem hooks provide a reasonable set of defaults for the allocator's @@ -2382,7 +2384,7 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog zcb->zcb_readfails = 0; - if (dump_opt['b'] < 5 && isatty(STDERR_FILENO) && + if (dump_opt['b'] < 5 && gethrtime() > zcb->zcb_lastprint + NANOSEC) { uint64_t now = gethrtime(); char buf[10]; @@ -2467,9 +2469,9 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb) if (!dump_opt['L']) { vdev_t *rvd = spa->spa_root_vdev; - for (int c = 0; c < rvd->vdev_children; c++) { + for (uint64_t c = 0; c < rvd->vdev_children; c++) { vdev_t *vd = rvd->vdev_child[c]; - for (int m = 0; m < vd->vdev_ms_count; m++) { + for (uint64_t m = 0; m < vd->vdev_ms_count; m++) { metaslab_t *msp = vd->vdev_ms[m]; mutex_enter(&msp->ms_lock); metaslab_unload(msp); @@ -2482,6 +2484,15 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb) * interfaces. */ if (msp->ms_sm != NULL) { + (void) fprintf(stderr, + "\rloading space map for " + "vdev %llu of %llu, " + "metaslab %llu of %llu ...", + (longlong_t)c, + (longlong_t)rvd->vdev_children, + (longlong_t)m, + (longlong_t)vd->vdev_ms_count); + msp->ms_ops = &zdb_metaslab_ops; VERIFY0(space_map_load(msp->ms_sm, msp->ms_tree, SM_ALLOC)); @@ -2490,6 +2501,7 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb) mutex_exit(&msp->ms_lock); } } + (void) fprintf(stderr, "\n"); } spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER); @@ -3490,6 +3502,12 @@ main(int argc, char **argv) usage(); } + /* + * ZDB does not typically re-read blocks; therefore limit the ARC + * to 256 MB, which can be used entirely for metadata. + */ + zfs_arc_max = zfs_arc_meta_limit = 256 * 1024 * 1024; + kernel_init(FREAD); g_zfs = libzfs_init(); ASSERT(g_zfs != NULL); From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 06:04:07 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9867078B; Thu, 9 Oct 2014 06:04:07 +0000 (UTC) Received: from mail-ig0-x235.google.com (mail-ig0-x235.google.com [IPv6:2607:f8b0:4001:c05::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47C9C98D; Thu, 9 Oct 2014 06:04:07 +0000 (UTC) Received: by mail-ig0-f181.google.com with SMTP id r10so2244434igi.14 for ; Wed, 08 Oct 2014 23:04:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:mime-version:in-reply-to:content-type :content-transfer-encoding:message-id:cc:from:subject:date:to; bh=3kPeD1T/neyqSVTv+nMAjvlKno+Ahl55vLU9IeOMHPs=; b=BX6/d6RI3I81w0QqP6OljjhKD1Qh5EEF6Qpf4g/iTFM2iaB4We0LZ4Ei66xArT4YF+ R81Rc0becloTAwwTzU4qgrRIQKDKGFQ/eBlSSCCW8JanCOhwd923Lv2PdpWyRDY3NYMe GTrQW4Eo2VwwLjiM1lDi3yh8UWJm2TvP5RpEOLAjLIEAomMNLOtfkYIGwTesA0xV62rx cOi2MRQvmgNP+KkTKIv9EHffnc+rAPUtErhBmFZ+ovdPXtYW/4NOYxXTbpk3ZsNs5OSz 3OA81ygjHVbUvly6oxBza0RYqNMeBWe06jDGExpqK76SI8kaSlIXwBfGh48ESnP3P+5V yxag== X-Received: by 10.43.108.212 with SMTP id ed20mr4441596icc.12.1412834646648; Wed, 08 Oct 2014 23:04:06 -0700 (PDT) Received: from [10.76.23.9] (mobile-166-137-212-186.mycingular.net. [166.137.212.186]) by mx.google.com with ESMTPSA id f19sm5368567igo.10.2014.10.08.23.04.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Oct 2014 23:04:06 -0700 (PDT) References: <201410090553.s995rxHK066788@svn.freebsd.org> Mime-Version: 1.0 (1.0) In-Reply-To: <201410090553.s995rxHK066788@svn.freebsd.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: <3EB30773-FEC7-4DF9-95A1-E5963FB22112@gmail.com> X-Mailer: iPhone Mail (11D257) From: Garrett Cooper Subject: Re: svn commit: r272805 - head/sys/cam Date: Wed, 8 Oct 2014 23:04:03 -0700 To: Alexander Motin Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 06:04:07 -0000 Also... > On Oct 8, 2014, at 22:53, Alexander Motin wrote: >=20 > Author: mav > Date: Thu Oct 9 05:53:58 2014 > New Revision: 272805 > URL: https://svnweb.freebsd.org/changeset/base/272805 >=20 > Log: > Use proper variable when looping through periphs with CAM_PERIPH_FREE. >=20 > PR: 194256 > Submitted by: Scott M. Ferris > MFC after: 3 days > Sponsored by: EMC/Isilon Storage Division >=20 Reported by: Anton Rang > Modified: > head/sys/cam/cam_xpt.c >=20 > Modified: head/sys/cam/cam_xpt.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D > --- head/sys/cam/cam_xpt.c Thu Oct 9 05:53:04 2014 (r272804) > +++ head/sys/cam/cam_xpt.c Thu Oct 9 05:53:58 2014 (r272805) > @@ -2195,7 +2195,7 @@ xptperiphtraverse(struct cam_ed *device, > next_periph =3D SLIST_NEXT(periph, periph_links); > while (next_periph !=3D NULL && > (next_periph->flags & CAM_PERIPH_FREE) !=3D 0) > - next_periph =3D SLIST_NEXT(periph, periph_links); > + next_periph =3D SLIST_NEXT(next_periph, periph_links); > if (next_periph) > next_periph->refcount++; > mtx_unlock(&bus->eb_mtx); > @@ -2269,7 +2269,7 @@ xptpdperiphtraverse(struct periph_driver > next_periph =3D TAILQ_NEXT(periph, unit_links); > while (next_periph !=3D NULL && > (next_periph->flags & CAM_PERIPH_FREE) !=3D 0) > - next_periph =3D TAILQ_NEXT(periph, unit_links); > + next_periph =3D TAILQ_NEXT(next_periph, unit_links); > if (next_periph) > next_periph->refcount++; > xpt_unlock_buses(); >=20 From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 06:24:07 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A5E59D46; Thu, 9 Oct 2014 06:24:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 91A2BB40; Thu, 9 Oct 2014 06:24:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s996O7PA081473; Thu, 9 Oct 2014 06:24:07 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s996O78a081471; Thu, 9 Oct 2014 06:24:07 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201410090624.s996O78a081471@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 9 Oct 2014 06:24:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272807 - in head/sys/dev/usb: . controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 06:24:07 -0000 Author: hselasky Date: Thu Oct 9 06:24:06 2014 New Revision: 272807 URL: https://svnweb.freebsd.org/changeset/base/272807 Log: Refine support for disabling USB enumeration to allow device detach and suspend and resume of existing devices. MFC after: 2 weeks Modified: head/sys/dev/usb/controller/usb_controller.c head/sys/dev/usb/usb_hub.c Modified: head/sys/dev/usb/controller/usb_controller.c ============================================================================== --- head/sys/dev/usb/controller/usb_controller.c Thu Oct 9 06:02:53 2014 (r272806) +++ head/sys/dev/usb/controller/usb_controller.c Thu Oct 9 06:24:06 2014 (r272807) @@ -102,14 +102,6 @@ static int usb_no_shutdown_wait = 0; SYSCTL_INT(_hw_usb, OID_AUTO, no_shutdown_wait, CTLFLAG_RWTUN, &usb_no_shutdown_wait, 0, "No USB device waiting at system shutdown."); -#if USB_HAVE_DISABLE_ENUM -static int usb_disable_enumeration = 0; -SYSCTL_INT(_hw_usb, OID_AUTO, disable_enumeration, CTLFLAG_RWTUN, - &usb_disable_enumeration, 0, "Set to disable all USB device enumeration."); -#else -#define usb_disable_enumeration 0 -#endif - static devclass_t usb_devclass; static device_method_t usb_methods[] = { @@ -379,8 +371,7 @@ usb_bus_explore(struct usb_proc_msg *pm) USB_BUS_LOCK(bus); } - if (usb_disable_enumeration == 0 && - udev != NULL && udev->hub != NULL) { + if (udev != NULL && udev->hub != NULL) { if (bus->do_probe) { bus->do_probe = 0; Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Thu Oct 9 06:02:53 2014 (r272806) +++ head/sys/dev/usb/usb_hub.c Thu Oct 9 06:24:06 2014 (r272807) @@ -97,6 +97,12 @@ SYSCTL_INT(_hw_usb, OID_AUTO, power_time &usb_power_timeout, 0, "USB power timeout"); #endif +#if USB_HAVE_DISABLE_ENUM +static int usb_disable_enumeration = 0; +SYSCTL_INT(_hw_usb, OID_AUTO, disable_enumeration, CTLFLAG_RWTUN, + &usb_disable_enumeration, 0, "Set to disable all USB device enumeration."); +#endif + struct uhub_current_state { uint16_t port_change; uint16_t port_status; @@ -621,9 +627,9 @@ repeat: err = usbd_req_clear_port_feature(udev, NULL, portno, UHF_C_PORT_CONNECTION); - if (err) { + if (err) goto error; - } + /* check if there is a child */ if (child != NULL) { @@ -636,14 +642,22 @@ repeat: /* get fresh status */ err = uhub_read_port_status(sc, portno); - if (err) { + if (err) + goto error; + +#if USB_HAVE_DISABLE_ENUM + /* check if we should skip enumeration from this USB HUB */ + if (usb_disable_enumeration != 0 || + sc->sc_disable_enumeration != 0) { + DPRINTF("Enumeration is disabled!\n"); goto error; } +#endif /* check if nothing is connected to the port */ - if (!(sc->sc_st.port_status & UPS_CURRENT_CONNECT_STATUS)) { + if (!(sc->sc_st.port_status & UPS_CURRENT_CONNECT_STATUS)) goto error; - } + /* check if there is no power on the port and print a warning */ switch (udev->speed) { @@ -996,13 +1010,6 @@ uhub_explore(struct usb_device *udev) DPRINTFN(11, "udev=%p addr=%d\n", udev, udev->address); -#if USB_HAVE_DISABLE_ENUM - /* check if we should skip enumeration from this USB HUB */ - if (sc->sc_disable_enumeration != 0) { - DPRINTF("Enumeration is disabled!\n"); - return (0); - } -#endif /* ignore devices that are too deep */ if (uhub_is_too_deep(udev)) return (USB_ERR_TOO_DEEP); From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 06:58:34 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 706FF4D7; Thu, 9 Oct 2014 06:58:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5C9CCDFF; Thu, 9 Oct 2014 06:58:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s996wYvR096352; Thu, 9 Oct 2014 06:58:34 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s996wYOr096351; Thu, 9 Oct 2014 06:58:34 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410090658.s996wYOr096351@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Thu, 9 Oct 2014 06:58:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272808 - head/include/rpcsvc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 06:58:34 -0000 Author: bapt Date: Thu Oct 9 06:58:33 2014 New Revision: 272808 URL: https://svnweb.freebsd.org/changeset/base/272808 Log: Fix build with rpcgen using a recent (tested with gcc 4.9.1) GNU cpp Modified: head/include/rpcsvc/nis.x Modified: head/include/rpcsvc/nis.x ============================================================================== --- head/include/rpcsvc/nis.x Thu Oct 9 06:24:06 2014 (r272807) +++ head/include/rpcsvc/nis.x Thu Oct 9 06:58:33 2014 (r272808) @@ -400,10 +400,7 @@ program NIS_PROG { %#define OARIGHTS(d, n) (((d)->do_armask.do_armask_val+n)->oa_rights) %#define WORLD_DEFAULT (NIS_READ_ACC) %#define GROUP_DEFAULT (NIS_READ_ACC << 8) -%#define OWNER_DEFAULT ((NIS_READ_ACC +\ - NIS_MODIFY_ACC +\ - NIS_CREATE_ACC +\ - NIS_DESTROY_ACC) << 16) +%#define OWNER_DEFAULT ((NIS_READ_ACC + NIS_MODIFY_ACC + NIS_CREATE_ACC + NIS_DESTROY_ACC) << 16) %#define DEFAULT_RIGHTS (WORLD_DEFAULT | GROUP_DEFAULT | OWNER_DEFAULT) % %/* Result manipulation defines ... */ @@ -432,10 +429,8 @@ program NIS_PROG { % * these definitions they take an nis_object *, and an int and return % * a u_char * for Value, and an int for length. % */ -%#define ENTRY_VAL(obj, col) \ - (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val -%#define ENTRY_LEN(obj, col) \ - (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len +%#define ENTRY_VAL(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val +%#define ENTRY_LEN(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len % %#ifdef __cplusplus %} From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 07:18:42 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3B46C915; Thu, 9 Oct 2014 07:18:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2623DFBB; Thu, 9 Oct 2014 07:18:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s997IgQU006081; Thu, 9 Oct 2014 07:18:42 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s997IfTt006077; Thu, 9 Oct 2014 07:18:41 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410090718.s997IfTt006077@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 9 Oct 2014 07:18:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272809 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 07:18:42 -0000 Author: delphij Date: Thu Oct 9 07:18:40 2014 New Revision: 272809 URL: https://svnweb.freebsd.org/changeset/base/272809 Log: MFV r272803: Illumos issue: 5175 implement dmu_read_uio_dbuf() to improve cached read performance MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Oct 9 06:58:33 2014 (r272808) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Oct 9 07:18:40 2014 (r272809) @@ -1021,8 +1021,8 @@ xuio_stat_wbuf_nocopy() } #ifdef _KERNEL -int -dmu_read_uio(objset_t *os, uint64_t object, uio_t *uio, uint64_t size) +static int +dmu_read_uio_dnode(dnode_t *dn, uio_t *uio, uint64_t size) { dmu_buf_t **dbp; int numbufs, i, err; @@ -1032,8 +1032,8 @@ dmu_read_uio(objset_t *os, uint64_t obje * NB: we could do this block-at-a-time, but it's nice * to be reading in parallel. */ - err = dmu_buf_hold_array(os, object, uio->uio_loffset, size, TRUE, FTAG, - &numbufs, &dbp); + err = dmu_buf_hold_array_by_dnode(dn, uio->uio_loffset, size, + TRUE, FTAG, &numbufs, &dbp, 0); if (err) return (err); @@ -1080,6 +1080,58 @@ dmu_read_uio(objset_t *os, uint64_t obje return (err); } +/* + * Read 'size' bytes into the uio buffer. + * From object zdb->db_object. + * Starting at offset uio->uio_loffset. + * + * If the caller already has a dbuf in the target object + * (e.g. its bonus buffer), this routine is faster than dmu_read_uio(), + * because we don't have to find the dnode_t for the object. + */ +int +dmu_read_uio_dbuf(dmu_buf_t *zdb, uio_t *uio, uint64_t size) +{ + dmu_buf_impl_t *db = (dmu_buf_impl_t *)zdb; + dnode_t *dn; + int err; + + if (size == 0) + return (0); + + DB_DNODE_ENTER(db); + dn = DB_DNODE(db); + err = dmu_read_uio_dnode(dn, uio, size); + DB_DNODE_EXIT(db); + + return (err); +} + +/* + * Read 'size' bytes into the uio buffer. + * From the specified object + * Starting at offset uio->uio_loffset. + */ +int +dmu_read_uio(objset_t *os, uint64_t object, uio_t *uio, uint64_t size) +{ + dnode_t *dn; + int err; + + if (size == 0) + return (0); + + err = dnode_hold(os, object, FTAG, &dn); + if (err) + return (err); + + err = dmu_read_uio_dnode(dn, uio, size); + + dnode_rele(dn, FTAG); + + return (err); +} + static int dmu_write_uio_dnode(dnode_t *dn, uio_t *uio, uint64_t size, dmu_tx_t *tx) { @@ -1132,6 +1184,15 @@ dmu_write_uio_dnode(dnode_t *dn, uio_t * return (err); } +/* + * Write 'size' bytes from the uio buffer. + * To object zdb->db_object. + * Starting at offset uio->uio_loffset. + * + * If the caller already has a dbuf in the target object + * (e.g. its bonus buffer), this routine is faster than dmu_write_uio(), + * because we don't have to find the dnode_t for the object. + */ int dmu_write_uio_dbuf(dmu_buf_t *zdb, uio_t *uio, uint64_t size, dmu_tx_t *tx) @@ -1151,6 +1212,11 @@ dmu_write_uio_dbuf(dmu_buf_t *zdb, uio_t return (err); } +/* + * Write 'size' bytes from the uio buffer. + * To the specified object. + * Starting at offset uio->uio_loffset. + */ int dmu_write_uio(objset_t *os, uint64_t object, uio_t *uio, uint64_t size, dmu_tx_t *tx) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Thu Oct 9 06:58:33 2014 (r272808) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Thu Oct 9 07:18:40 2014 (r272809) @@ -616,6 +616,7 @@ void dmu_write(objset_t *os, uint64_t ob void dmu_prealloc(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, dmu_tx_t *tx); int dmu_read_uio(objset_t *os, uint64_t object, struct uio *uio, uint64_t size); +int dmu_read_uio_dbuf(dmu_buf_t *zdb, struct uio *uio, uint64_t size); int dmu_write_uio(objset_t *os, uint64_t object, struct uio *uio, uint64_t size, dmu_tx_t *tx); int dmu_write_uio_dbuf(dmu_buf_t *zdb, struct uio *uio, uint64_t size, Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Oct 9 06:58:33 2014 (r272808) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Oct 9 07:18:40 2014 (r272809) @@ -582,7 +582,6 @@ static int mappedread(vnode_t *vp, int nbytes, uio_t *uio) { znode_t *zp = VTOZ(vp); - objset_t *os = zp->z_zfsvfs->z_os; vm_object_t obj; int64_t start; caddr_t va; @@ -613,7 +612,8 @@ mappedread(vnode_t *vp, int nbytes, uio_ page_unhold(pp); } else { zfs_vmobject_wunlock(obj); - error = dmu_read_uio(os, zp->z_id, uio, bytes); + error = dmu_read_uio_dbuf(sa_get_db(zp->z_sa_hdl), + uio, bytes); zfs_vmobject_wlock(obj); } len -= bytes; @@ -650,7 +650,6 @@ zfs_read(vnode_t *vp, uio_t *uio, int io { znode_t *zp = VTOZ(vp); zfsvfs_t *zfsvfs = zp->z_zfsvfs; - objset_t *os; ssize_t n, nbytes; int error = 0; rl_t *rl; @@ -658,7 +657,6 @@ zfs_read(vnode_t *vp, uio_t *uio, int io ZFS_ENTER(zfsvfs); ZFS_VERIFY_ZP(zp); - os = zfsvfs->z_os; if (zp->z_pflags & ZFS_AV_QUARANTINED) { ZFS_EXIT(zfsvfs); @@ -756,10 +754,12 @@ zfs_read(vnode_t *vp, uio_t *uio, int io error = mappedread_sf(vp, nbytes, uio); else #endif /* __FreeBSD__ */ - if (vn_has_cached_data(vp)) + if (vn_has_cached_data(vp)) { error = mappedread(vp, nbytes, uio); - else - error = dmu_read_uio(os, zp->z_id, uio, nbytes); + } else { + error = dmu_read_uio_dbuf(sa_get_db(zp->z_sa_hdl), + uio, nbytes); + } if (error) { /* convert checksum errors into IO errors */ if (error == ECKSUM) From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 07:52:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4A935E86; Thu, 9 Oct 2014 07:52:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 353275E5; Thu, 9 Oct 2014 07:52:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s997qrHj023780; Thu, 9 Oct 2014 07:52:53 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s997qqY2023773; Thu, 9 Oct 2014 07:52:52 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410090752.s997qqY2023773@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 9 Oct 2014 07:52:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272810 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 07:52:53 -0000 Author: delphij Date: Thu Oct 9 07:52:51 2014 New Revision: 272810 URL: https://svnweb.freebsd.org/changeset/base/272810 Log: MFV r272804: Refactor the code and stop restore_object from creating two transactions. Illumos issue: 3693 restore_object uses at least two transactions to restore an object MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Oct 9 07:18:40 2014 (r272809) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Oct 9 07:52:51 2014 (r272810) @@ -1918,6 +1918,7 @@ dmu_object_info_from_dnode(dnode_t *dn, doi->doi_indirection = dn->dn_nlevels; doi->doi_checksum = dn->dn_checksum; doi->doi_compress = dn->dn_compress; + doi->doi_nblkptr = dn->dn_nblkptr; doi->doi_physical_blocks_512 = (DN_USED_BYTES(dnp) + 256) >> 9; doi->doi_max_offset = (dn->dn_maxblkid + 1) * dn->dn_datablksz; doi->doi_fill_count = 0; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c Thu Oct 9 07:18:40 2014 (r272809) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c Thu Oct 9 07:52:51 2014 (r272810) @@ -20,7 +20,8 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013, 2014 by Delphix. All rights reserved. + * Copyright 2014 HybridCluster. All rights reserved. */ #include @@ -107,11 +108,9 @@ dmu_object_claim(objset_t *os, uint64_t int dmu_object_reclaim(objset_t *os, uint64_t object, dmu_object_type_t ot, - int blocksize, dmu_object_type_t bonustype, int bonuslen) + int blocksize, dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx) { dnode_t *dn; - dmu_tx_t *tx; - int nblkptr; int err; if (object == DMU_META_DNODE_OBJECT) @@ -122,44 +121,9 @@ dmu_object_reclaim(objset_t *os, uint64_ if (err) return (err); - if (dn->dn_type == ot && dn->dn_datablksz == blocksize && - dn->dn_bonustype == bonustype && dn->dn_bonuslen == bonuslen) { - /* nothing is changing, this is a noop */ - dnode_rele(dn, FTAG); - return (0); - } - - if (bonustype == DMU_OT_SA) { - nblkptr = 1; - } else { - nblkptr = 1 + ((DN_MAX_BONUSLEN - bonuslen) >> SPA_BLKPTRSHIFT); - } - - /* - * If we are losing blkptrs or changing the block size this must - * be a new file instance. We must clear out the previous file - * contents before we can change this type of metadata in the dnode. - */ - if (dn->dn_nblkptr > nblkptr || dn->dn_datablksz != blocksize) { - err = dmu_free_long_range(os, object, 0, DMU_OBJECT_END); - if (err) - goto out; - } - - tx = dmu_tx_create(os); - dmu_tx_hold_bonus(tx, object); - err = dmu_tx_assign(tx, TXG_WAIT); - if (err) { - dmu_tx_abort(tx); - goto out; - } - dnode_reallocate(dn, ot, blocksize, bonustype, bonuslen, tx); - dmu_tx_commit(tx); -out: dnode_rele(dn, FTAG); - return (err); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Thu Oct 9 07:18:40 2014 (r272809) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Thu Oct 9 07:52:51 2014 (r272810) @@ -24,6 +24,7 @@ * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright (c) 2014, Joyent, Inc. All rights reserved. * Copyright (c) 2012, Martin Matuska . All rights reserved. + * Copyright 2014 HybridCluster. All rights reserved. */ #include @@ -1392,12 +1393,25 @@ backup_byteswap(dmu_replay_record_t *drr #undef DO32 } +static inline uint8_t +deduce_nblkptr(dmu_object_type_t bonus_type, uint64_t bonus_size) +{ + if (bonus_type == DMU_OT_SA) { + return (1); + } else { + return (1 + + ((DN_MAX_BONUSLEN - bonus_size) >> SPA_BLKPTRSHIFT)); + } +} + static int restore_object(struct restorearg *ra, objset_t *os, struct drr_object *drro) { - int err; + dmu_object_info_t doi; dmu_tx_t *tx; void *data = NULL; + uint64_t object; + int err; if (drro->drr_type == DMU_OT_NONE || !DMU_OT_IS_VALID(drro->drr_type) || @@ -1411,10 +1425,11 @@ restore_object(struct restorearg *ra, ob return (SET_ERROR(EINVAL)); } - err = dmu_object_info(os, drro->drr_object, NULL); + err = dmu_object_info(os, drro->drr_object, &doi); if (err != 0 && err != ENOENT) return (SET_ERROR(EINVAL)); + object = err == 0 ? drro->drr_object : DMU_NEW_OBJECT; if (drro->drr_bonuslen) { data = restore_read(ra, P2ROUNDUP(drro->drr_bonuslen, 8), NULL); @@ -1422,37 +1437,53 @@ restore_object(struct restorearg *ra, ob return (ra->err); } - if (err == ENOENT) { - /* currently free, want to be allocated */ - tx = dmu_tx_create(os); - dmu_tx_hold_bonus(tx, DMU_NEW_OBJECT); - err = dmu_tx_assign(tx, TXG_WAIT); - if (err != 0) { - dmu_tx_abort(tx); - return (err); + /* + * If we are losing blkptrs or changing the block size this must + * be a new file instance. We must clear out the previous file + * contents before we can change this type of metadata in the dnode. + */ + if (err == 0) { + int nblkptr; + + nblkptr = deduce_nblkptr(drro->drr_bonustype, + drro->drr_bonuslen); + + if (drro->drr_blksz != doi.doi_data_block_size || + nblkptr < doi.doi_nblkptr) { + err = dmu_free_long_range(os, drro->drr_object, + 0, DMU_OBJECT_END); + if (err != 0) + return (SET_ERROR(EINVAL)); } + } + + tx = dmu_tx_create(os); + dmu_tx_hold_bonus(tx, object); + err = dmu_tx_assign(tx, TXG_WAIT); + if (err != 0) { + dmu_tx_abort(tx); + return (err); + } + + if (object == DMU_NEW_OBJECT) { + /* currently free, want to be allocated */ err = dmu_object_claim(os, drro->drr_object, drro->drr_type, drro->drr_blksz, drro->drr_bonustype, drro->drr_bonuslen, tx); - dmu_tx_commit(tx); - } else { - /* currently allocated, want to be allocated */ + } else if (drro->drr_type != doi.doi_type || + drro->drr_blksz != doi.doi_data_block_size || + drro->drr_bonustype != doi.doi_bonus_type || + drro->drr_bonuslen != doi.doi_bonus_size) { + /* currently allocated, but with different properties */ err = dmu_object_reclaim(os, drro->drr_object, drro->drr_type, drro->drr_blksz, - drro->drr_bonustype, drro->drr_bonuslen); + drro->drr_bonustype, drro->drr_bonuslen, tx); } if (err != 0) { + dmu_tx_commit(tx); return (SET_ERROR(EINVAL)); } - tx = dmu_tx_create(os); - dmu_tx_hold_bonus(tx, drro->drr_object); - err = dmu_tx_assign(tx, TXG_WAIT); - if (err != 0) { - dmu_tx_abort(tx); - return (err); - } - dmu_object_set_checksum(os, drro->drr_object, drro->drr_checksumtype, tx); dmu_object_set_compress(os, drro->drr_object, drro->drr_compress, tx); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Thu Oct 9 07:18:40 2014 (r272809) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Thu Oct 9 07:52:51 2014 (r272810) @@ -25,6 +25,7 @@ * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright 2013 DEY Storage Systems, Inc. + * Copyright 2014 HybridCluster. All rights reserved. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -341,7 +342,7 @@ uint64_t dmu_object_alloc(objset_t *os, int dmu_object_claim(objset_t *os, uint64_t object, dmu_object_type_t ot, int blocksize, dmu_object_type_t bonus_type, int bonus_len, dmu_tx_t *tx); int dmu_object_reclaim(objset_t *os, uint64_t object, dmu_object_type_t ot, - int blocksize, dmu_object_type_t bonustype, int bonuslen); + int blocksize, dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *txp); /* * Free an object from this objset. @@ -662,7 +663,8 @@ typedef struct dmu_object_info { uint8_t doi_indirection; /* 2 = dnode->indirect->data */ uint8_t doi_checksum; uint8_t doi_compress; - uint8_t doi_pad[5]; + uint8_t doi_nblkptr; + uint8_t doi_pad[4]; uint64_t doi_physical_blocks_512; /* data + metadata, 512b blks */ uint64_t doi_max_offset; uint64_t doi_fill_count; /* number of non-empty blocks */ From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 09:04:02 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2EFA7BA5; Thu, 9 Oct 2014 09:04:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B5DBCB3; Thu, 9 Oct 2014 09:04:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99941kS058335; Thu, 9 Oct 2014 09:04:01 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99941FS058334; Thu, 9 Oct 2014 09:04:01 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410090904.s99941FS058334@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Thu, 9 Oct 2014 09:04:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272811 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 09:04:02 -0000 Author: bapt Date: Thu Oct 9 09:04:01 2014 New Revision: 272811 URL: https://svnweb.freebsd.org/changeset/base/272811 Log: Add CROSS_TOOLCHAIN macro select pre seeded external toolchain configuration files The goal is to provide pre seeded toolchain configurations withing the ports tree to allow the use of an external toolchain in a simple way: make CROSS_TOOLCHAIN=powerpc64-gcc TARGET=powerpc TARGET_ARCH=powerpc64 buildworld This will look for the external toolchain definition in /usr/local/share/mk/powerpc64-gcc.mk While here add the notion of X_COMPILER_TYPE to the external toolchain framework to allow to deal with differences between gcc and clang in regards of cross building Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Thu Oct 9 07:52:51 2014 (r272810) +++ head/Makefile.inc1 Thu Oct 9 09:04:01 2014 (r272811) @@ -299,6 +299,10 @@ HMAKE+= PATH=${TMPPATH} METALOG=${METAL WMAKEENV+= MK_CTF=no .endif +.if defined(CROSS_TOOLCHAIN) +LOCALBASE?= /usr/local +.include "${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk" +.endif .if defined(CROSS_TOOLCHAIN_PREFIX) CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} @@ -343,10 +347,14 @@ TARGET_ABI= gnueabihf TARGET_ABI= gnueabi .endif .endif +.if ${X_COMPILER_TYPE} == gcc +XFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib +.else TARGET_ABI?= unknown TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0 XFLAGS+= -target ${TARGET_TRIPLE} .endif +.endif WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP} From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 09:12:10 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 74FD2D99; Thu, 9 Oct 2014 09:12:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 60DFBD91; Thu, 9 Oct 2014 09:12:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s999CA7L062921; Thu, 9 Oct 2014 09:12:10 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s999C9rb062915; Thu, 9 Oct 2014 09:12:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410090912.s999C9rb062915@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 9 Oct 2014 09:12:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272812 - in head/sys: cam/ctl dev/iscsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 09:12:10 -0000 Author: mav Date: Thu Oct 9 09:12:08 2014 New Revision: 272812 URL: https://svnweb.freebsd.org/changeset/base/272812 Log: Make iSCSI connection close somewhat less aggressive. It allows to push out some final data from the send queue to the socket before its close. In particular, it increases chances for logout response to be delivered to the initiator. Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c head/sys/dev/iscsi/icl.c head/sys/dev/iscsi/icl.h head/sys/dev/iscsi/iscsi.c Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- head/sys/cam/ctl/ctl_frontend_iscsi.c Thu Oct 9 09:04:01 2014 (r272811) +++ head/sys/cam/ctl/ctl_frontend_iscsi.c Thu Oct 9 09:12:08 2014 (r272812) @@ -1135,7 +1135,6 @@ cfiscsi_maintenance_thread(void *arg) * that anymore. We might need to revisit that. */ callout_drain(&cs->cs_callout); - icl_conn_shutdown(cs->cs_conn); icl_conn_close(cs->cs_conn); /* Modified: head/sys/dev/iscsi/icl.c ============================================================================== --- head/sys/dev/iscsi/icl.c Thu Oct 9 09:04:01 2014 (r272811) +++ head/sys/dev/iscsi/icl.c Thu Oct 9 09:12:08 2014 (r272812) @@ -873,8 +873,6 @@ icl_conn_send_pdus(struct icl_conn *ic, SOCKBUF_UNLOCK(&so->so_snd); while (!STAILQ_EMPTY(queue)) { - if (ic->ic_disconnecting) - return; request = STAILQ_FIRST(queue); size = icl_pdu_size(request); if (available < size) { @@ -971,11 +969,6 @@ icl_send_thread(void *arg) ic->ic_send_running = true; for (;;) { - if (ic->ic_disconnecting) { - //ICL_DEBUG("terminating"); - break; - } - for (;;) { /* * If the local queue is empty, populate it from @@ -1014,6 +1007,11 @@ icl_send_thread(void *arg) break; } + if (ic->ic_disconnecting) { + //ICL_DEBUG("terminating"); + break; + } + cv_wait(&ic->ic_send_cv, ic->ic_lock); } @@ -1298,21 +1296,6 @@ icl_conn_handoff(struct icl_conn *ic, in } void -icl_conn_shutdown(struct icl_conn *ic) -{ - ICL_CONN_LOCK_ASSERT_NOT(ic); - - ICL_CONN_LOCK(ic); - if (ic->ic_socket == NULL) { - ICL_CONN_UNLOCK(ic); - return; - } - ICL_CONN_UNLOCK(ic); - - soshutdown(ic->ic_socket, SHUT_RDWR); -} - -void icl_conn_close(struct icl_conn *ic) { struct icl_pdu *pdu; Modified: head/sys/dev/iscsi/icl.h ============================================================================== --- head/sys/dev/iscsi/icl.h Thu Oct 9 09:04:01 2014 (r272811) +++ head/sys/dev/iscsi/icl.h Thu Oct 9 09:12:08 2014 (r272812) @@ -107,7 +107,6 @@ struct icl_conn { struct icl_conn *icl_conn_new(const char *name, struct mtx *lock); void icl_conn_free(struct icl_conn *ic); int icl_conn_handoff(struct icl_conn *ic, int fd); -void icl_conn_shutdown(struct icl_conn *ic); void icl_conn_close(struct icl_conn *ic); bool icl_conn_connected(struct icl_conn *ic); Modified: head/sys/dev/iscsi/iscsi.c ============================================================================== --- head/sys/dev/iscsi/iscsi.c Thu Oct 9 09:04:01 2014 (r272811) +++ head/sys/dev/iscsi/iscsi.c Thu Oct 9 09:12:08 2014 (r272812) @@ -367,7 +367,6 @@ static void iscsi_maintenance_thread_reconnect(struct iscsi_session *is) { - icl_conn_shutdown(is->is_conn); icl_conn_close(is->is_conn); ISCSI_SESSION_LOCK(is); From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 09:46:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 892488A3; Thu, 9 Oct 2014 09:46:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7576616B; Thu, 9 Oct 2014 09:46:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s999kjrZ077989; Thu, 9 Oct 2014 09:46:45 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s999kjmO077988; Thu, 9 Oct 2014 09:46:45 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410090946.s999kjmO077988@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Thu, 9 Oct 2014 09:46:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272813 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 09:46:45 -0000 Author: bapt Date: Thu Oct 9 09:46:44 2014 New Revision: 272813 URL: https://svnweb.freebsd.org/changeset/base/272813 Log: Fix build when XCC is defined and X_COMPILER_TYPE is not Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Thu Oct 9 09:12:08 2014 (r272812) +++ head/Makefile.inc1 Thu Oct 9 09:46:44 2014 (r272813) @@ -347,7 +347,7 @@ TARGET_ABI= gnueabihf TARGET_ABI= gnueabi .endif .endif -.if ${X_COMPILER_TYPE} == gcc +.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc XFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib .else TARGET_ABI?= unknown From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 10:47:14 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D7D31781; Thu, 9 Oct 2014 10:47:14 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C4438A07; Thu, 9 Oct 2014 10:47:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99AlEw9006557; Thu, 9 Oct 2014 10:47:14 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99AlE7G006556; Thu, 9 Oct 2014 10:47:14 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410091047.s99AlE7G006556@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Thu, 9 Oct 2014 10:47:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272814 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 10:47:15 -0000 Author: bapt Date: Thu Oct 9 10:47:14 2014 New Revision: 272814 URL: https://svnweb.freebsd.org/changeset/base/272814 Log: Add OBJCOPY to the list of external tools Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Thu Oct 9 09:46:44 2014 (r272813) +++ head/Makefile.inc1 Thu Oct 9 10:47:14 2014 (r272814) @@ -315,7 +315,7 @@ X${COMPILER}?= ${CROSS_COMPILER_PREFIX}$ X${COMPILER}?= ${${COMPILER}} .endif .endfor -XBINUTILS= AS AR LD NM OBJDUMP RANLIB STRINGS +XBINUTILS= AS AR LD NM OBJCOPY OBJDUMP RANLIB STRINGS .for BINUTIL in ${XBINUTILS} .if defined(CROSS_BINUTILS_PREFIX) X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}} @@ -326,7 +326,8 @@ X${BINUTIL}?= ${${BINUTIL}} WMAKEENV+= CC="${XCC} ${XFLAGS}" CXX="${XCXX} ${XFLAGS}" \ CPP="${XCPP} ${XFLAGS}" \ AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \ - OBJDUMP=${XOBJDUMP} RANLIB=${XRANLIB} STRINGS=${XSTRINGS} + OBJDUMP=${XOBJDUMP} OBJCOPY="${OBJCOPY}" \ + RANLIB=${XRANLIB} STRINGS=${XSTRINGS} .if ${XCC:M/*} XFLAGS= --sysroot=${WORLDTMP} From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 12:20:01 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 66892A24; Thu, 9 Oct 2014 12:20:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 52F6637F; Thu, 9 Oct 2014 12:20:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99CK117049399; Thu, 9 Oct 2014 12:20:01 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99CK1Cl049398; Thu, 9 Oct 2014 12:20:01 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410091220.s99CK1Cl049398@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Thu, 9 Oct 2014 12:20:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272815 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 12:20:01 -0000 Author: bapt Date: Thu Oct 9 12:20:00 2014 New Revision: 272815 URL: https://svnweb.freebsd.org/changeset/base/272815 Log: Fix typo Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Thu Oct 9 10:47:14 2014 (r272814) +++ head/Makefile.inc1 Thu Oct 9 12:20:00 2014 (r272815) @@ -326,7 +326,7 @@ X${BINUTIL}?= ${${BINUTIL}} WMAKEENV+= CC="${XCC} ${XFLAGS}" CXX="${XCXX} ${XFLAGS}" \ CPP="${XCPP} ${XFLAGS}" \ AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \ - OBJDUMP=${XOBJDUMP} OBJCOPY="${OBJCOPY}" \ + OBJDUMP=${XOBJDUMP} OBJCOPY="${XOBJCOPY}" \ RANLIB=${XRANLIB} STRINGS=${XSTRINGS} .if ${XCC:M/*} From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 12:35:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8CA2ED18; Thu, 9 Oct 2014 12:35:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 790C2794; Thu, 9 Oct 2014 12:35:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99CZIph058067; Thu, 9 Oct 2014 12:35:18 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99CZIAQ058066; Thu, 9 Oct 2014 12:35:18 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410091235.s99CZIAQ058066@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Thu, 9 Oct 2014 12:35:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272816 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 12:35:18 -0000 Author: bapt Date: Thu Oct 9 12:35:17 2014 New Revision: 272816 URL: https://svnweb.freebsd.org/changeset/base/272816 Log: Only catch the line from the compiler output where 'version' is a word This allows to build the kernel with gcc 4.9.1 from ports Modified: head/sys/conf/newvers.sh Modified: head/sys/conf/newvers.sh ============================================================================== --- head/sys/conf/newvers.sh Thu Oct 9 12:20:00 2014 (r272815) +++ head/sys/conf/newvers.sh Thu Oct 9 12:35:17 2014 (r272816) @@ -89,7 +89,7 @@ fi touch version v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date` i=`${MAKE:-make} -V KERN_IDENT` -compiler_v=$($(${MAKE:-make} -V CC) -v 2>&1 | grep 'version') +compiler_v=$($(${MAKE:-make} -V CC) -v 2>&1 | grep -w 'version') for dir in /usr/bin /usr/local/bin; do if [ ! -z "${svnversion}" ] ; then From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 13:58:20 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BE97D95E; Thu, 9 Oct 2014 13:58:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AAA401000; Thu, 9 Oct 2014 13:58:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99DwKpG097242; Thu, 9 Oct 2014 13:58:20 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99DwKA2097240; Thu, 9 Oct 2014 13:58:20 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201410091358.s99DwKA2097240@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 9 Oct 2014 13:58:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272820 - head/etc/devd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 13:58:20 -0000 Author: hselasky Date: Thu Oct 9 13:58:19 2014 New Revision: 272820 URL: https://svnweb.freebsd.org/changeset/base/272820 Log: Add example devd configuration file for USB printers. Added: head/etc/devd/ulpt.conf (contents, props changed) Modified: head/etc/devd/Makefile Modified: head/etc/devd/Makefile ============================================================================== --- head/etc/devd/Makefile Thu Oct 9 13:36:37 2014 (r272819) +++ head/etc/devd/Makefile Thu Oct 9 13:58:19 2014 (r272820) @@ -11,7 +11,7 @@ FILES+= asus.conf .endif .if ${MK_USB} != "no" -FILES+= uath.conf usb.conf +FILES+= uath.conf ulpt.conf usb.conf .endif .if ${MK_ZFS} != "no" Added: head/etc/devd/ulpt.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/etc/devd/ulpt.conf Thu Oct 9 13:58:19 2014 (r272820) @@ -0,0 +1,18 @@ +# +# $FreeBSD$ +# + +# +# Example devd configuration file for USB printers. +# Uncomment the notify rule below to enable. +# +# Generic USB printer devices +#notify 100 { +# match "system" "USB"; +# match "subsystem" "INTERFACE"; +# match "type" "ATTACH"; +# match "intclass" "0x07"; +# match "intsubclass" "0x01"; +# match "intprotocol" "(0x01|0x02|0x03)"; +# action "chown root:wheel /dev/$cdev"; +#}; From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 14:43:44 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A28CCF16; Thu, 9 Oct 2014 14:43:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8E379841; Thu, 9 Oct 2014 14:43:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99Ehi48021596; Thu, 9 Oct 2014 14:43:44 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99EhiJ4021595; Thu, 9 Oct 2014 14:43:44 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201410091443.s99EhiJ4021595@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 9 Oct 2014 14:43:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272822 - head/sys/dev/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 14:43:44 -0000 Author: hselasky Date: Thu Oct 9 14:43:43 2014 New Revision: 272822 URL: https://svnweb.freebsd.org/changeset/base/272822 Log: Add sysctl knob to disable port power on a specific USB HUB. You need to reset the USB HUB using "usbconfig -d X.Y reset" or boot having the setting in /boot/loader.conf before it activates. Modified: head/sys/dev/usb/usb_hub.c Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Thu Oct 9 14:33:20 2014 (r272821) +++ head/sys/dev/usb/usb_hub.c Thu Oct 9 14:43:43 2014 (r272822) @@ -101,6 +101,10 @@ SYSCTL_INT(_hw_usb, OID_AUTO, power_time static int usb_disable_enumeration = 0; SYSCTL_INT(_hw_usb, OID_AUTO, disable_enumeration, CTLFLAG_RWTUN, &usb_disable_enumeration, 0, "Set to disable all USB device enumeration."); + +static int usb_disable_port_power = 0; +SYSCTL_INT(_hw_usb, OID_AUTO, disable_port_power, CTLFLAG_RWTUN, + &usb_disable_port_power, 0, "Set to disable all USB port power."); #endif struct uhub_current_state { @@ -119,6 +123,7 @@ struct uhub_softc { struct usb_xfer *sc_xfer[UHUB_N_TRANSFER]; /* interrupt xfer */ #if USB_HAVE_DISABLE_ENUM int sc_disable_enumeration; + int sc_disable_port_power; #endif uint8_t sc_flags; #define UHUB_FLAG_DID_EXPLORE 0x01 @@ -1406,6 +1411,24 @@ uhub_attach(device_t dev) /* wait with power off for a while */ usb_pause_mtx(NULL, USB_MS_TO_TICKS(USB_POWER_DOWN_TIME)); +#if USB_HAVE_DISABLE_ENUM + /* Add device sysctls */ + + sysctl_ctx = device_get_sysctl_ctx(dev); + sysctl_tree = device_get_sysctl_tree(dev); + + if (sysctl_ctx != NULL && sysctl_tree != NULL) { + (void) SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "disable_enumeration", CTLFLAG_RWTUN, + &sc->sc_disable_enumeration, 0, + "Set to disable enumeration on this USB HUB."); + + (void) SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "disable_port_power", CTLFLAG_RWTUN, + &sc->sc_disable_port_power, 0, + "Set to disable USB port power on this USB HUB."); + } +#endif /* * To have the best chance of success we do things in the exact same * order as Windoze98. This should not be necessary, but some @@ -1460,13 +1483,27 @@ uhub_attach(device_t dev) removable++; break; } - if (!err) { - /* turn the power on */ - err = usbd_req_set_port_feature(udev, NULL, - portno, UHF_PORT_POWER); + if (err == 0) { +#if USB_HAVE_DISABLE_ENUM + /* check if we should disable USB port power or not */ + if (usb_disable_port_power != 0 || + sc->sc_disable_port_power != 0) { + /* turn the power off */ + DPRINTFN(0, "Turning port %d power off\n", portno); + err = usbd_req_clear_port_feature(udev, NULL, + portno, UHF_PORT_POWER); + } else { +#endif + /* turn the power on */ + DPRINTFN(0, "Turning port %d power on\n", portno); + err = usbd_req_set_port_feature(udev, NULL, + portno, UHF_PORT_POWER); +#if USB_HAVE_DISABLE_ENUM + } +#endif } - if (err) { - DPRINTFN(0, "port %d power on failed, %s\n", + if (err != 0) { + DPRINTFN(0, "port %d power on or off failed, %s\n", portno, usbd_errstr(err)); } DPRINTF("turn on port %d power\n", @@ -1490,19 +1527,6 @@ uhub_attach(device_t dev) usbd_set_power_mode(udev, USB_POWER_MODE_SAVE); -#if USB_HAVE_DISABLE_ENUM - /* Add device sysctls */ - - sysctl_ctx = device_get_sysctl_ctx(dev); - sysctl_tree = device_get_sysctl_tree(dev); - - if (sysctl_ctx != NULL && sysctl_tree != NULL) { - (void) SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), - OID_AUTO, "disable_enumeration", CTLFLAG_RWTUN, - &sc->sc_disable_enumeration, 0, - "Set to disable enumeration on this USB HUB."); - } -#endif return (0); error: From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 15:01:58 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 207833E4; Thu, 9 Oct 2014 15:01:58 +0000 (UTC) Received: from mail-qc0-x237.google.com (mail-qc0-x237.google.com [IPv6:2607:f8b0:400d:c01::237]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A1279A7A; Thu, 9 Oct 2014 15:01:57 +0000 (UTC) Received: by mail-qc0-f183.google.com with SMTP id r5so107415qcx.0 for ; Thu, 09 Oct 2014 08:01:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:message-id:in-reply-to:references:subject :mime-version:content-type; bh=2XJ2sFDe0ExwgJS0ET79+1vkNlQUC8mPekYWV5woqWA=; b=iOyrJ3YZGLlmZGhxu/fKgnYpjMsXMXEpTULIDZF/DAik62P0f9nvfErl6ENIlZfYH2 sDhQYOXogJZGWARqdHEqvbOMl31N4kp/YR8ApR/NuL2ZRtOUiC2FVR2f29ZaYRq56ClP kwy/97DPW6bFRg+3EjdyUvqiq1v4f6U8rOab2l9PqjIDESzG/aOb/2RCO3Jw34jzOY38 OGYdHzTxIdFcxGgg+h6fJlKdm5a0vL8vQaFKxLnVWpi/tPSoElcbHZhytFWF0JMxSt3F AgenW9IZdSX6qQJ1jrbgP8LIWQaB6Rdx0Dt/pUI7md7WOL2+vifJ2ylqBne7UPLwpRY1 UV1w== X-Received: by 10.182.81.169 with SMTP id b9mr118883oby.8.1412866916746; Thu, 09 Oct 2014 08:01:56 -0700 (PDT) X-Google-Doc-Id: d1ec095ca66d579e X-Google-Web-Client: true Date: Thu, 9 Oct 2014 08:01:55 -0700 (PDT) From: roseknr1 To: bsdmailinglist@googlegroups.com Message-Id: <56602668-32d8-422a-85d2-9b2b1fdfdf11@googlegroups.com> In-Reply-To: <201410091443.s99EhiJ4021595@svn.freebsd.org> References: <201410091443.s99EhiJ4021595@svn.freebsd.org> Subject: Re: svn commit: r272822 - head/sys/dev/usb MIME-Version: 1.0 X-Google-IP: 117.221.202.78 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, hselasky@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 15:01:58 -0000 *join free social network clickcare * On Thursday, October 9, 2014 8:13:51 PM UTC+5:30, Hans Petter Selasky wrote: > > Author: hselasky > Date: Thu Oct 9 14:43:43 2014 > New Revision: 272822 > URL: https://svnweb.freebsd.org/changeset/base/272822 > > Log: > Add sysctl knob to disable port power on a specific USB HUB. You need > to reset the USB HUB using "usbconfig -d X.Y reset" or boot having the > setting in /boot/loader.conf before it activates. > > Modified: > head/sys/dev/usb/usb_hub.c > > Modified: head/sys/dev/usb/usb_hub.c > ============================================================================== > > --- head/sys/dev/usb/usb_hub.c Thu Oct 9 14:33:20 > 2014 (r272821) > +++ head/sys/dev/usb/usb_hub.c Thu Oct 9 14:43:43 > 2014 (r272822) > @@ -101,6 +101,10 @@ SYSCTL_INT(_hw_usb, OID_AUTO, power_time > static int usb_disable_enumeration = 0; > SYSCTL_INT(_hw_usb, OID_AUTO, disable_enumeration, CTLFLAG_RWTUN, > &usb_disable_enumeration, 0, "Set to disable all USB device > enumeration."); > + > +static int usb_disable_port_power = 0; > +SYSCTL_INT(_hw_usb, OID_AUTO, disable_port_power, CTLFLAG_RWTUN, > + &usb_disable_port_power, 0, "Set to disable all USB port power."); > #endif > > struct uhub_current_state { > @@ -119,6 +123,7 @@ struct uhub_softc { > struct usb_xfer *sc_xfer[UHUB_N_TRANSFER]; /* interrupt > xfer */ > #if USB_HAVE_DISABLE_ENUM > int sc_disable_enumeration; > + int sc_disable_port_power; > #endif > uint8_t sc_flags; > #define UHUB_FLAG_DID_EXPLORE 0x01 > @@ -1406,6 +1411,24 @@ uhub_attach(device_t dev) > /* wait with power off for a while */ > usb_pause_mtx(NULL, USB_MS_TO_TICKS(USB_POWER_DOWN_TIME)); > > +#if USB_HAVE_DISABLE_ENUM > + /* Add device sysctls */ > + > + sysctl_ctx = device_get_sysctl_ctx(dev); > + sysctl_tree = device_get_sysctl_tree(dev); > + > + if (sysctl_ctx != NULL && sysctl_tree != NULL) { > + (void) SYSCTL_ADD_INT(sysctl_ctx, > SYSCTL_CHILDREN(sysctl_tree), > + OID_AUTO, "disable_enumeration", CTLFLAG_RWTUN, > + &sc->sc_disable_enumeration, 0, > + "Set to disable enumeration on this USB HUB."); > + > + (void) SYSCTL_ADD_INT(sysctl_ctx, > SYSCTL_CHILDREN(sysctl_tree), > + OID_AUTO, "disable_port_power", CTLFLAG_RWTUN, > + &sc->sc_disable_port_power, 0, > + "Set to disable USB port power on this USB HUB."); > + } > +#endif > /* > * To have the best chance of success we do things in the exact > same > * order as Windoze98. This should not be necessary, but some > @@ -1460,13 +1483,27 @@ uhub_attach(device_t dev) > removable++; > break; > } > - if (!err) { > - /* turn the power on */ > - err = usbd_req_set_port_feature(udev, NULL, > - portno, UHF_PORT_POWER); > + if (err == 0) { > +#if USB_HAVE_DISABLE_ENUM > + /* check if we should disable USB port power or > not */ > + if (usb_disable_port_power != 0 || > + sc->sc_disable_port_power != 0) { > + /* turn the power off */ > + DPRINTFN(0, "Turning port %d power > off\n", portno); > + err = usbd_req_clear_port_feature(udev, > NULL, > + portno, UHF_PORT_POWER); > + } else { > +#endif > + /* turn the power on */ > + DPRINTFN(0, "Turning port %d power on\n", > portno); > + err = usbd_req_set_port_feature(udev, > NULL, > + portno, UHF_PORT_POWER); > +#if USB_HAVE_DISABLE_ENUM > + } > +#endif > } > - if (err) { > - DPRINTFN(0, "port %d power on failed, %s\n", > + if (err != 0) { > + DPRINTFN(0, "port %d power on or off failed, > %s\n", > portno, usbd_errstr(err)); > } > DPRINTF("turn on port %d power\n", > @@ -1490,19 +1527,6 @@ uhub_attach(device_t dev) > > usbd_set_power_mode(udev, USB_POWER_MODE_SAVE); > > -#if USB_HAVE_DISABLE_ENUM > - /* Add device sysctls */ > - > - sysctl_ctx = device_get_sysctl_ctx(dev); > - sysctl_tree = device_get_sysctl_tree(dev); > - > - if (sysctl_ctx != NULL && sysctl_tree != NULL) { > - (void) SYSCTL_ADD_INT(sysctl_ctx, > SYSCTL_CHILDREN(sysctl_tree), > - OID_AUTO, "disable_enumeration", CTLFLAG_RWTUN, > - &sc->sc_disable_enumeration, 0, > - "Set to disable enumeration on this USB HUB."); > - } > -#endif > return (0); > > error: > _______________________________________________ > svn-s...@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all...@freebsd.org " > > From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 15:16:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6BA1CAF3; Thu, 9 Oct 2014 15:16:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 55FD3C85; Thu, 9 Oct 2014 15:16:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99FGsob036373; Thu, 9 Oct 2014 15:16:54 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99FGrrW036363; Thu, 9 Oct 2014 15:16:53 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201410091516.s99FGrrW036363@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Thu, 9 Oct 2014 15:16:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272823 - in head/sys: compat/freebsd32 conf kern netinet sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 15:16:54 -0000 Author: marcel Date: Thu Oct 9 15:16:52 2014 New Revision: 272823 URL: https://svnweb.freebsd.org/changeset/base/272823 Log: Move the SCTP syscalls to netinet with the rest of the SCTP code. The syscalls themselves are tightly coupled with the network stack and therefore should not be in the generic socket code. The following four syscalls have been marked as NOSTD so they can be dynamically registered in sctp_syscalls_init() function: sys_sctp_peeloff sys_sctp_generic_sendmsg sys_sctp_generic_sendmsg_iov sys_sctp_generic_recvmsg The syscalls are also set up to be dynamically registered when COMPAT32 option is configured. As a side effect of moving the SCTP syscalls, getsock_cap needs to be made available outside of the uipc_syscalls.c source file. A proper prototype has been added to the sys/socketvar.h header file. API tests from the SCTP reference implementation have been run to ensure compatibility. (http://code.google.com/p/sctp-refimpl/source/checkout) Submitted by: Steve Kiernan Reviewed by: tuexen, rrs Obtained from: Juniper Networks, Inc. Added: head/sys/netinet/sctp_syscalls.c - copied, changed from r272821, head/sys/kern/uipc_syscalls.c Modified: head/sys/compat/freebsd32/syscalls.master head/sys/conf/files head/sys/kern/syscalls.master head/sys/kern/uipc_syscalls.c head/sys/sys/socketvar.h Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Thu Oct 9 14:43:43 2014 (r272822) +++ head/sys/compat/freebsd32/syscalls.master Thu Oct 9 15:16:52 2014 (r272823) @@ -845,14 +845,14 @@ 468 AUE_NULL UNIMPL nosys 469 AUE_NULL UNIMPL __getpath_fromfd 470 AUE_NULL UNIMPL __getpath_fromaddr -471 AUE_NULL NOPROTO { int sctp_peeloff(int sd, uint32_t name); } -472 AUE_NULL NOPROTO { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, \ +471 AUE_NULL NOPROTO|NOSTD { int sctp_peeloff(int sd, uint32_t name); } +472 AUE_NULL NOPROTO|NOSTD { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, \ caddr_t to, __socklen_t tolen, \ struct sctp_sndrcvinfo *sinfo, int flags); } -473 AUE_NULL NOPROTO { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, \ +473 AUE_NULL NOPROTO|NOSTD { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, \ caddr_t to, __socklen_t tolen, \ struct sctp_sndrcvinfo *sinfo, int flags); } -474 AUE_NULL NOPROTO { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, \ +474 AUE_NULL NOPROTO|NOSTD { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, \ struct sockaddr * from, __socklen_t *fromlenaddr, \ struct sctp_sndrcvinfo *sinfo, int *msg_flags); } #ifdef PAD64_REQUIRED Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Oct 9 14:43:43 2014 (r272822) +++ head/sys/conf/files Thu Oct 9 15:16:52 2014 (r272823) @@ -3429,6 +3429,7 @@ netinet/sctp_output.c optional inet sct netinet/sctp_pcb.c optional inet sctp | inet6 sctp netinet/sctp_peeloff.c optional inet sctp | inet6 sctp netinet/sctp_ss_functions.c optional inet sctp | inet6 sctp +netinet/sctp_syscalls.c optional inet sctp | inet6 sctp netinet/sctp_sysctl.c optional inet sctp | inet6 sctp netinet/sctp_timer.c optional inet sctp | inet6 sctp netinet/sctp_usrreq.c optional inet sctp | inet6 sctp Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Thu Oct 9 14:43:43 2014 (r272822) +++ head/sys/kern/syscalls.master Thu Oct 9 15:16:52 2014 (r272823) @@ -837,14 +837,14 @@ 468 AUE_NULL UNIMPL nosys 469 AUE_NULL UNIMPL __getpath_fromfd 470 AUE_NULL UNIMPL __getpath_fromaddr -471 AUE_NULL STD { int sctp_peeloff(int sd, uint32_t name); } -472 AUE_NULL STD { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, \ +471 AUE_NULL NOSTD { int sctp_peeloff(int sd, uint32_t name); } +472 AUE_NULL NOSTD { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, \ caddr_t to, __socklen_t tolen, \ struct sctp_sndrcvinfo *sinfo, int flags); } -473 AUE_NULL STD { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, \ +473 AUE_NULL NOSTD { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, \ caddr_t to, __socklen_t tolen, \ struct sctp_sndrcvinfo *sinfo, int flags); } -474 AUE_NULL STD { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, \ +474 AUE_NULL NOSTD { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, \ struct sockaddr * from, __socklen_t *fromlenaddr, \ struct sctp_sndrcvinfo *sinfo, int *msg_flags); } 475 AUE_PREAD STD { ssize_t pread(int fd, void *buf, \ Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Thu Oct 9 14:43:43 2014 (r272822) +++ head/sys/kern/uipc_syscalls.c Thu Oct 9 15:16:52 2014 (r272823) @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include "opt_capsicum.h" #include "opt_inet.h" #include "opt_inet6.h" -#include "opt_sctp.h" #include "opt_compat.h" #include "opt_ktrace.h" @@ -95,13 +94,6 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(INET) || defined(INET6) -#ifdef SCTP -#include -#include -#endif /* SCTP */ -#endif /* INET || INET6 */ - /* * Flags for accept1() and kern_accept4(), in addition to SOCK_CLOEXEC * and SOCK_NONBLOCK. @@ -198,7 +190,7 @@ SYSCTL_PROC(_kern_ipc, OID_AUTO, sfstat, * capability rights are present. * A reference on the file entry is held upon returning. */ -static int +int getsock_cap(struct filedesc *fdp, int fd, cap_rights_t *rightsp, struct file **fpp, u_int *fflagp) { @@ -3206,484 +3198,3 @@ out: return (error); } - -/* - * SCTP syscalls. - * Functionality only compiled in if SCTP is defined in the kernel Makefile, - * otherwise all return EOPNOTSUPP. - * XXX: We should make this loadable one day. - */ -int -sys_sctp_peeloff(td, uap) - struct thread *td; - struct sctp_peeloff_args /* { - int sd; - caddr_t name; - } */ *uap; -{ -#if (defined(INET) || defined(INET6)) && defined(SCTP) - struct file *nfp = NULL; - struct socket *head, *so; - cap_rights_t rights; - u_int fflag; - int error, fd; - - AUDIT_ARG_FD(uap->sd); - error = fgetsock(td, uap->sd, cap_rights_init(&rights, CAP_PEELOFF), - &head, &fflag); - if (error != 0) - goto done2; - if (head->so_proto->pr_protocol != IPPROTO_SCTP) { - error = EOPNOTSUPP; - goto done; - } - error = sctp_can_peel_off(head, (sctp_assoc_t)uap->name); - if (error != 0) - goto done; - /* - * At this point we know we do have a assoc to pull - * we proceed to get the fd setup. This may block - * but that is ok. - */ - - error = falloc(td, &nfp, &fd, 0); - if (error != 0) - goto done; - td->td_retval[0] = fd; - - CURVNET_SET(head->so_vnet); - so = sonewconn(head, SS_ISCONNECTED); - if (so == NULL) { - error = ENOMEM; - goto noconnection; - } - /* - * Before changing the flags on the socket, we have to bump the - * reference count. Otherwise, if the protocol calls sofree(), - * the socket will be released due to a zero refcount. - */ - SOCK_LOCK(so); - soref(so); /* file descriptor reference */ - SOCK_UNLOCK(so); - - ACCEPT_LOCK(); - - TAILQ_REMOVE(&head->so_comp, so, so_list); - head->so_qlen--; - so->so_state |= (head->so_state & SS_NBIO); - so->so_state &= ~SS_NOFDREF; - so->so_qstate &= ~SQ_COMP; - so->so_head = NULL; - ACCEPT_UNLOCK(); - finit(nfp, fflag, DTYPE_SOCKET, so, &socketops); - error = sctp_do_peeloff(head, so, (sctp_assoc_t)uap->name); - if (error != 0) - goto noconnection; - if (head->so_sigio != NULL) - fsetown(fgetown(&head->so_sigio), &so->so_sigio); - -noconnection: - /* - * close the new descriptor, assuming someone hasn't ripped it - * out from under us. - */ - if (error != 0) - fdclose(td->td_proc->p_fd, nfp, fd, td); - - /* - * Release explicitly held references before returning. - */ - CURVNET_RESTORE(); -done: - if (nfp != NULL) - fdrop(nfp, td); - fputsock(head); -done2: - return (error); -#else /* SCTP */ - return (EOPNOTSUPP); -#endif /* SCTP */ -} - -int -sys_sctp_generic_sendmsg (td, uap) - struct thread *td; - struct sctp_generic_sendmsg_args /* { - int sd, - caddr_t msg, - int mlen, - caddr_t to, - __socklen_t tolen, - struct sctp_sndrcvinfo *sinfo, - int flags - } */ *uap; -{ -#if (defined(INET) || defined(INET6)) && defined(SCTP) - struct sctp_sndrcvinfo sinfo, *u_sinfo = NULL; - struct socket *so; - struct file *fp = NULL; - struct sockaddr *to = NULL; -#ifdef KTRACE - struct uio *ktruio = NULL; -#endif - struct uio auio; - struct iovec iov[1]; - cap_rights_t rights; - int error = 0, len; - - if (uap->sinfo != NULL) { - error = copyin(uap->sinfo, &sinfo, sizeof (sinfo)); - if (error != 0) - return (error); - u_sinfo = &sinfo; - } - - cap_rights_init(&rights, CAP_SEND); - if (uap->tolen != 0) { - error = getsockaddr(&to, uap->to, uap->tolen); - if (error != 0) { - to = NULL; - goto sctp_bad2; - } - cap_rights_set(&rights, CAP_CONNECT); - } - - AUDIT_ARG_FD(uap->sd); - error = getsock_cap(td->td_proc->p_fd, uap->sd, &rights, &fp, NULL); - if (error != 0) - goto sctp_bad; -#ifdef KTRACE - if (to && (KTRPOINT(td, KTR_STRUCT))) - ktrsockaddr(to); -#endif - - iov[0].iov_base = uap->msg; - iov[0].iov_len = uap->mlen; - - so = (struct socket *)fp->f_data; - if (so->so_proto->pr_protocol != IPPROTO_SCTP) { - error = EOPNOTSUPP; - goto sctp_bad; - } -#ifdef MAC - error = mac_socket_check_send(td->td_ucred, so); - if (error != 0) - goto sctp_bad; -#endif /* MAC */ - - auio.uio_iov = iov; - auio.uio_iovcnt = 1; - auio.uio_segflg = UIO_USERSPACE; - auio.uio_rw = UIO_WRITE; - auio.uio_td = td; - auio.uio_offset = 0; /* XXX */ - auio.uio_resid = 0; - len = auio.uio_resid = uap->mlen; - CURVNET_SET(so->so_vnet); - error = sctp_lower_sosend(so, to, &auio, (struct mbuf *)NULL, - (struct mbuf *)NULL, uap->flags, u_sinfo, td); - CURVNET_RESTORE(); - if (error != 0) { - if (auio.uio_resid != len && (error == ERESTART || - error == EINTR || error == EWOULDBLOCK)) - error = 0; - /* Generation of SIGPIPE can be controlled per socket. */ - if (error == EPIPE && !(so->so_options & SO_NOSIGPIPE) && - !(uap->flags & MSG_NOSIGNAL)) { - PROC_LOCK(td->td_proc); - tdsignal(td, SIGPIPE); - PROC_UNLOCK(td->td_proc); - } - } - if (error == 0) - td->td_retval[0] = len - auio.uio_resid; -#ifdef KTRACE - if (ktruio != NULL) { - ktruio->uio_resid = td->td_retval[0]; - ktrgenio(uap->sd, UIO_WRITE, ktruio, error); - } -#endif /* KTRACE */ -sctp_bad: - if (fp != NULL) - fdrop(fp, td); -sctp_bad2: - free(to, M_SONAME); - return (error); -#else /* SCTP */ - return (EOPNOTSUPP); -#endif /* SCTP */ -} - -int -sys_sctp_generic_sendmsg_iov(td, uap) - struct thread *td; - struct sctp_generic_sendmsg_iov_args /* { - int sd, - struct iovec *iov, - int iovlen, - caddr_t to, - __socklen_t tolen, - struct sctp_sndrcvinfo *sinfo, - int flags - } */ *uap; -{ -#if (defined(INET) || defined(INET6)) && defined(SCTP) - struct sctp_sndrcvinfo sinfo, *u_sinfo = NULL; - struct socket *so; - struct file *fp = NULL; - struct sockaddr *to = NULL; -#ifdef KTRACE - struct uio *ktruio = NULL; -#endif - struct uio auio; - struct iovec *iov, *tiov; - cap_rights_t rights; - ssize_t len; - int error, i; - - if (uap->sinfo != NULL) { - error = copyin(uap->sinfo, &sinfo, sizeof (sinfo)); - if (error != 0) - return (error); - u_sinfo = &sinfo; - } - cap_rights_init(&rights, CAP_SEND); - if (uap->tolen != 0) { - error = getsockaddr(&to, uap->to, uap->tolen); - if (error != 0) { - to = NULL; - goto sctp_bad2; - } - cap_rights_set(&rights, CAP_CONNECT); - } - - AUDIT_ARG_FD(uap->sd); - error = getsock_cap(td->td_proc->p_fd, uap->sd, &rights, &fp, NULL); - if (error != 0) - goto sctp_bad1; - -#ifdef COMPAT_FREEBSD32 - if (SV_CURPROC_FLAG(SV_ILP32)) - error = freebsd32_copyiniov((struct iovec32 *)uap->iov, - uap->iovlen, &iov, EMSGSIZE); - else -#endif - error = copyiniov(uap->iov, uap->iovlen, &iov, EMSGSIZE); - if (error != 0) - goto sctp_bad1; -#ifdef KTRACE - if (to && (KTRPOINT(td, KTR_STRUCT))) - ktrsockaddr(to); -#endif - - so = (struct socket *)fp->f_data; - if (so->so_proto->pr_protocol != IPPROTO_SCTP) { - error = EOPNOTSUPP; - goto sctp_bad; - } -#ifdef MAC - error = mac_socket_check_send(td->td_ucred, so); - if (error != 0) - goto sctp_bad; -#endif /* MAC */ - - auio.uio_iov = iov; - auio.uio_iovcnt = uap->iovlen; - auio.uio_segflg = UIO_USERSPACE; - auio.uio_rw = UIO_WRITE; - auio.uio_td = td; - auio.uio_offset = 0; /* XXX */ - auio.uio_resid = 0; - tiov = iov; - for (i = 0; i iovlen; i++, tiov++) { - if ((auio.uio_resid += tiov->iov_len) < 0) { - error = EINVAL; - goto sctp_bad; - } - } - len = auio.uio_resid; - CURVNET_SET(so->so_vnet); - error = sctp_lower_sosend(so, to, &auio, - (struct mbuf *)NULL, (struct mbuf *)NULL, - uap->flags, u_sinfo, td); - CURVNET_RESTORE(); - if (error != 0) { - if (auio.uio_resid != len && (error == ERESTART || - error == EINTR || error == EWOULDBLOCK)) - error = 0; - /* Generation of SIGPIPE can be controlled per socket */ - if (error == EPIPE && !(so->so_options & SO_NOSIGPIPE) && - !(uap->flags & MSG_NOSIGNAL)) { - PROC_LOCK(td->td_proc); - tdsignal(td, SIGPIPE); - PROC_UNLOCK(td->td_proc); - } - } - if (error == 0) - td->td_retval[0] = len - auio.uio_resid; -#ifdef KTRACE - if (ktruio != NULL) { - ktruio->uio_resid = td->td_retval[0]; - ktrgenio(uap->sd, UIO_WRITE, ktruio, error); - } -#endif /* KTRACE */ -sctp_bad: - free(iov, M_IOV); -sctp_bad1: - if (fp != NULL) - fdrop(fp, td); -sctp_bad2: - free(to, M_SONAME); - return (error); -#else /* SCTP */ - return (EOPNOTSUPP); -#endif /* SCTP */ -} - -int -sys_sctp_generic_recvmsg(td, uap) - struct thread *td; - struct sctp_generic_recvmsg_args /* { - int sd, - struct iovec *iov, - int iovlen, - struct sockaddr *from, - __socklen_t *fromlenaddr, - struct sctp_sndrcvinfo *sinfo, - int *msg_flags - } */ *uap; -{ -#if (defined(INET) || defined(INET6)) && defined(SCTP) - uint8_t sockbufstore[256]; - struct uio auio; - struct iovec *iov, *tiov; - struct sctp_sndrcvinfo sinfo; - struct socket *so; - struct file *fp = NULL; - struct sockaddr *fromsa; - cap_rights_t rights; -#ifdef KTRACE - struct uio *ktruio = NULL; -#endif - ssize_t len; - int error, fromlen, i, msg_flags; - - AUDIT_ARG_FD(uap->sd); - error = getsock_cap(td->td_proc->p_fd, uap->sd, - cap_rights_init(&rights, CAP_RECV), &fp, NULL); - if (error != 0) - return (error); -#ifdef COMPAT_FREEBSD32 - if (SV_CURPROC_FLAG(SV_ILP32)) - error = freebsd32_copyiniov((struct iovec32 *)uap->iov, - uap->iovlen, &iov, EMSGSIZE); - else -#endif - error = copyiniov(uap->iov, uap->iovlen, &iov, EMSGSIZE); - if (error != 0) - goto out1; - - so = fp->f_data; - if (so->so_proto->pr_protocol != IPPROTO_SCTP) { - error = EOPNOTSUPP; - goto out; - } -#ifdef MAC - error = mac_socket_check_receive(td->td_ucred, so); - if (error != 0) - goto out; -#endif /* MAC */ - - if (uap->fromlenaddr != NULL) { - error = copyin(uap->fromlenaddr, &fromlen, sizeof (fromlen)); - if (error != 0) - goto out; - } else { - fromlen = 0; - } - if (uap->msg_flags) { - error = copyin(uap->msg_flags, &msg_flags, sizeof (int)); - if (error != 0) - goto out; - } else { - msg_flags = 0; - } - auio.uio_iov = iov; - auio.uio_iovcnt = uap->iovlen; - auio.uio_segflg = UIO_USERSPACE; - auio.uio_rw = UIO_READ; - auio.uio_td = td; - auio.uio_offset = 0; /* XXX */ - auio.uio_resid = 0; - tiov = iov; - for (i = 0; i iovlen; i++, tiov++) { - if ((auio.uio_resid += tiov->iov_len) < 0) { - error = EINVAL; - goto out; - } - } - len = auio.uio_resid; - fromsa = (struct sockaddr *)sockbufstore; - -#ifdef KTRACE - if (KTRPOINT(td, KTR_GENIO)) - ktruio = cloneuio(&auio); -#endif /* KTRACE */ - memset(&sinfo, 0, sizeof(struct sctp_sndrcvinfo)); - CURVNET_SET(so->so_vnet); - error = sctp_sorecvmsg(so, &auio, (struct mbuf **)NULL, - fromsa, fromlen, &msg_flags, - (struct sctp_sndrcvinfo *)&sinfo, 1); - CURVNET_RESTORE(); - if (error != 0) { - if (auio.uio_resid != len && (error == ERESTART || - error == EINTR || error == EWOULDBLOCK)) - error = 0; - } else { - if (uap->sinfo) - error = copyout(&sinfo, uap->sinfo, sizeof (sinfo)); - } -#ifdef KTRACE - if (ktruio != NULL) { - ktruio->uio_resid = len - auio.uio_resid; - ktrgenio(uap->sd, UIO_READ, ktruio, error); - } -#endif /* KTRACE */ - if (error != 0) - goto out; - td->td_retval[0] = len - auio.uio_resid; - - if (fromlen && uap->from) { - len = fromlen; - if (len <= 0 || fromsa == 0) - len = 0; - else { - len = MIN(len, fromsa->sa_len); - error = copyout(fromsa, uap->from, (size_t)len); - if (error != 0) - goto out; - } - error = copyout(&len, uap->fromlenaddr, sizeof (socklen_t)); - if (error != 0) - goto out; - } -#ifdef KTRACE - if (KTRPOINT(td, KTR_STRUCT)) - ktrsockaddr(fromsa); -#endif - if (uap->msg_flags) { - error = copyout(&msg_flags, uap->msg_flags, sizeof (int)); - if (error != 0) - goto out; - } -out: - free(iov, M_IOV); -out1: - if (fp != NULL) - fdrop(fp, td); - - return (error); -#else /* SCTP */ - return (EOPNOTSUPP); -#endif /* SCTP */ -} Copied and modified: head/sys/netinet/sctp_syscalls.c (from r272821, head/sys/kern/uipc_syscalls.c) ============================================================================== --- head/sys/kern/uipc_syscalls.c Thu Oct 9 14:33:20 2014 (r272821, copy source) +++ head/sys/netinet/sctp_syscalls.c Thu Oct 9 15:16:52 2014 (r272823) @@ -2,9 +2,6 @@ * Copyright (c) 1982, 1986, 1989, 1990, 1993 * The Regents of the University of California. All rights reserved. * - * sendfile(2) and related extensions: - * Copyright (c) 1998, David Greenman. All rights reserved. - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -29,7 +26,6 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)uipc_syscalls.c 8.4 (Berkeley) 2/21/94 */ #include @@ -45,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -58,18 +53,15 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include -#include #include -#include -#include #include #include #include #include +#include #include #include #include @@ -86,3126 +78,33 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(INET) || defined(INET6) -#ifdef SCTP #include #include -#endif /* SCTP */ -#endif /* INET || INET6 */ - -/* - * Flags for accept1() and kern_accept4(), in addition to SOCK_CLOEXEC - * and SOCK_NONBLOCK. - */ -#define ACCEPT4_INHERIT 0x1 -#define ACCEPT4_COMPAT 0x2 - -static int sendit(struct thread *td, int s, struct msghdr *mp, int flags); -static int recvit(struct thread *td, int s, struct msghdr *mp, void *namelenp); - -static int accept1(struct thread *td, int s, struct sockaddr *uname, - socklen_t *anamelen, int flags); -static int do_sendfile(struct thread *td, struct sendfile_args *uap, - int compat); -static int getsockname1(struct thread *td, struct getsockname_args *uap, - int compat); -static int getpeername1(struct thread *td, struct getpeername_args *uap, - int compat); - -counter_u64_t sfstat[sizeof(struct sfstat) / sizeof(uint64_t)]; - -static int filt_sfsync_attach(struct knote *kn); -static void filt_sfsync_detach(struct knote *kn); -static int filt_sfsync(struct knote *kn, long hint); -/* - * sendfile(2)-related variables and associated sysctls - */ -static SYSCTL_NODE(_kern_ipc, OID_AUTO, sendfile, CTLFLAG_RW, 0, - "sendfile(2) tunables"); -static int sfreadahead = 1; -SYSCTL_INT(_kern_ipc_sendfile, OID_AUTO, readahead, CTLFLAG_RW, - &sfreadahead, 0, "Number of sendfile(2) read-ahead MAXBSIZE blocks"); - -#ifdef SFSYNC_DEBUG -static int sf_sync_debug = 0; -SYSCTL_INT(_debug, OID_AUTO, sf_sync_debug, CTLFLAG_RW, - &sf_sync_debug, 0, "Output debugging during sf_sync lifecycle"); -#define SFSYNC_DPRINTF(s, ...) \ - do { \ - if (sf_sync_debug) \ - printf((s), ##__VA_ARGS__); \ - } while (0) -#else -#define SFSYNC_DPRINTF(c, ...) -#endif - -static uma_zone_t zone_sfsync; - -static struct filterops sendfile_filtops = { - .f_isfd = 0, - .f_attach = filt_sfsync_attach, - .f_detach = filt_sfsync_detach, - .f_event = filt_sfsync, +static struct syscall_helper_data sctp_syscalls[] = { + SYSCALL_INIT_HELPER(sctp_peeloff), + SYSCALL_INIT_HELPER(sctp_generic_sendmsg), + SYSCALL_INIT_HELPER(sctp_generic_sendmsg_iov), + SYSCALL_INIT_HELPER(sctp_generic_recvmsg), + SYSCALL_INIT_LAST }; static void -sfstat_init(const void *unused) -{ - - COUNTER_ARRAY_ALLOC(sfstat, sizeof(struct sfstat) / sizeof(uint64_t), - M_WAITOK); -} -SYSINIT(sfstat, SI_SUB_MBUF, SI_ORDER_FIRST, sfstat_init, NULL); - -static void -sf_sync_init(const void *unused) -{ - - zone_sfsync = uma_zcreate("sendfile_sync", sizeof(struct sendfile_sync), - NULL, NULL, - NULL, NULL, - UMA_ALIGN_CACHE, - 0); - kqueue_add_filteropts(EVFILT_SENDFILE, &sendfile_filtops); -} -SYSINIT(sf_sync, SI_SUB_MBUF, SI_ORDER_FIRST, sf_sync_init, NULL); - -static int -sfstat_sysctl(SYSCTL_HANDLER_ARGS) -{ - struct sfstat s; - - COUNTER_ARRAY_COPY(sfstat, &s, sizeof(s) / sizeof(uint64_t)); - if (req->newptr) - COUNTER_ARRAY_ZERO(sfstat, sizeof(s) / sizeof(uint64_t)); - return (SYSCTL_OUT(req, &s, sizeof(s))); -} -SYSCTL_PROC(_kern_ipc, OID_AUTO, sfstat, CTLTYPE_OPAQUE | CTLFLAG_RW, - NULL, 0, sfstat_sysctl, "I", "sendfile statistics"); - -/* - * Convert a user file descriptor to a kernel file entry and check if required - * capability rights are present. - * A reference on the file entry is held upon returning. - */ -static int -getsock_cap(struct filedesc *fdp, int fd, cap_rights_t *rightsp, - struct file **fpp, u_int *fflagp) -{ - struct file *fp; - int error; - - error = fget_unlocked(fdp, fd, rightsp, 0, &fp, NULL); - if (error != 0) - return (error); - if (fp->f_type != DTYPE_SOCKET) { - fdrop(fp, curthread); - return (ENOTSOCK); - } - if (fflagp != NULL) - *fflagp = fp->f_flag; - *fpp = fp; - return (0); -} - -/* - * System call interface to the socket abstraction. - */ -#if defined(COMPAT_43) -#define COMPAT_OLDSOCK -#endif - -int -sys_socket(td, uap) - struct thread *td; - struct socket_args /* { - int domain; - int type; - int protocol; - } */ *uap; -{ - struct socket *so; - struct file *fp; - int fd, error, type, oflag, fflag; - - AUDIT_ARG_SOCKET(uap->domain, uap->type, uap->protocol); - - type = uap->type; - oflag = 0; - fflag = 0; - if ((type & SOCK_CLOEXEC) != 0) { - type &= ~SOCK_CLOEXEC; - oflag |= O_CLOEXEC; - } - if ((type & SOCK_NONBLOCK) != 0) { - type &= ~SOCK_NONBLOCK; - fflag |= FNONBLOCK; - } - -#ifdef MAC - error = mac_socket_check_create(td->td_ucred, uap->domain, type, - uap->protocol); - if (error != 0) - return (error); -#endif - error = falloc(td, &fp, &fd, oflag); - if (error != 0) - return (error); - /* An extra reference on `fp' has been held for us by falloc(). */ - error = socreate(uap->domain, &so, type, uap->protocol, - td->td_ucred, td); - if (error != 0) { - fdclose(td->td_proc->p_fd, fp, fd, td); - } else { - finit(fp, FREAD | FWRITE | fflag, DTYPE_SOCKET, so, &socketops); - if ((fflag & FNONBLOCK) != 0) - (void) fo_ioctl(fp, FIONBIO, &fflag, td->td_ucred, td); - td->td_retval[0] = fd; - } - fdrop(fp, td); - return (error); -} - -/* ARGSUSED */ -int -sys_bind(td, uap) - struct thread *td; - struct bind_args /* { - int s; - caddr_t name; - int namelen; - } */ *uap; -{ - struct sockaddr *sa; - int error; - - error = getsockaddr(&sa, uap->name, uap->namelen); - if (error == 0) { - error = kern_bind(td, uap->s, sa); - free(sa, M_SONAME); - } - return (error); -} - -static int -kern_bindat(struct thread *td, int dirfd, int fd, struct sockaddr *sa) -{ - struct socket *so; - struct file *fp; - cap_rights_t rights; - int error; - - AUDIT_ARG_FD(fd); - AUDIT_ARG_SOCKADDR(td, dirfd, sa); - error = getsock_cap(td->td_proc->p_fd, fd, - cap_rights_init(&rights, CAP_BIND), &fp, NULL); - if (error != 0) - return (error); - so = fp->f_data; -#ifdef KTRACE - if (KTRPOINT(td, KTR_STRUCT)) - ktrsockaddr(sa); -#endif -#ifdef MAC - error = mac_socket_check_bind(td->td_ucred, so, sa); - if (error == 0) { -#endif - if (dirfd == AT_FDCWD) - error = sobind(so, sa, td); - else - error = sobindat(dirfd, so, sa, td); -#ifdef MAC - } -#endif - fdrop(fp, td); - return (error); -} - -int -kern_bind(struct thread *td, int fd, struct sockaddr *sa) -{ - - return (kern_bindat(td, AT_FDCWD, fd, sa)); -} - -/* ARGSUSED */ -int -sys_bindat(td, uap) - struct thread *td; - struct bindat_args /* { - int fd; - int s; - caddr_t name; - int namelen; - } */ *uap; -{ - struct sockaddr *sa; - int error; - - error = getsockaddr(&sa, uap->name, uap->namelen); - if (error == 0) { - error = kern_bindat(td, uap->fd, uap->s, sa); - free(sa, M_SONAME); - } - return (error); -} - -/* ARGSUSED */ -int -sys_listen(td, uap) - struct thread *td; - struct listen_args /* { - int s; - int backlog; - } */ *uap; -{ - struct socket *so; - struct file *fp; - cap_rights_t rights; - int error; - - AUDIT_ARG_FD(uap->s); - error = getsock_cap(td->td_proc->p_fd, uap->s, - cap_rights_init(&rights, CAP_LISTEN), &fp, NULL); - if (error == 0) { - so = fp->f_data; -#ifdef MAC - error = mac_socket_check_listen(td->td_ucred, so); - if (error == 0) -#endif - error = solisten(so, uap->backlog, td); - fdrop(fp, td); - } - return(error); -} - -/* - * accept1() - */ -static int -accept1(td, s, uname, anamelen, flags) - struct thread *td; - int s; - struct sockaddr *uname; - socklen_t *anamelen; - int flags; -{ - struct sockaddr *name; - socklen_t namelen; - struct file *fp; - int error; - - if (uname == NULL) - return (kern_accept4(td, s, NULL, NULL, flags, NULL)); - - error = copyin(anamelen, &namelen, sizeof (namelen)); - if (error != 0) - return (error); - - error = kern_accept4(td, s, &name, &namelen, flags, &fp); - - if (error != 0) - return (error); - - if (error == 0 && uname != NULL) { -#ifdef COMPAT_OLDSOCK - if (flags & ACCEPT4_COMPAT) - ((struct osockaddr *)name)->sa_family = - name->sa_family; -#endif - error = copyout(name, uname, namelen); - } - if (error == 0) - error = copyout(&namelen, anamelen, - sizeof(namelen)); - if (error != 0) - fdclose(td->td_proc->p_fd, fp, td->td_retval[0], td); - fdrop(fp, td); - free(name, M_SONAME); - return (error); -} - -int -kern_accept(struct thread *td, int s, struct sockaddr **name, - socklen_t *namelen, struct file **fp) -{ - return (kern_accept4(td, s, name, namelen, ACCEPT4_INHERIT, fp)); -} - -int -kern_accept4(struct thread *td, int s, struct sockaddr **name, - socklen_t *namelen, int flags, struct file **fp) -{ - struct filedesc *fdp; - struct file *headfp, *nfp = NULL; - struct sockaddr *sa = NULL; - struct socket *head, *so; - cap_rights_t rights; - u_int fflag; - pid_t pgid; - int error, fd, tmp; - - if (name != NULL) - *name = NULL; - *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 15:19:38 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4ABB1D7F; Thu, 9 Oct 2014 15:19:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 355D1CB5; Thu, 9 Oct 2014 15:19:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99FJc6s036768; Thu, 9 Oct 2014 15:19:38 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99FJZvR036758; Thu, 9 Oct 2014 15:19:35 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201410091519.s99FJZvR036758@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Thu, 9 Oct 2014 15:19:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272824 - in head/sys: compat/freebsd32 kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 15:19:38 -0000 Author: marcel Date: Thu Oct 9 15:19:35 2014 New Revision: 272824 URL: https://svnweb.freebsd.org/changeset/base/272824 Log: Regenerate after r272823: Move the SCTP syscalls to netinet with the rest of the SCTP code. Submitted by: Steve Kiernan Reviewed by: tuexen, rrs Obtained from: Juniper Networks, Inc. Modified: head/sys/compat/freebsd32/freebsd32_proto.h head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/kern/init_sysent.c head/sys/kern/syscalls.c head/sys/sys/syscall.h head/sys/sys/syscall.mk head/sys/sys/sysproto.h Modified: head/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_proto.h Thu Oct 9 15:16:52 2014 (r272823) +++ head/sys/compat/freebsd32/freebsd32_proto.h Thu Oct 9 15:19:35 2014 (r272824) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 270691 2014-08-27 01:02:02Z kib + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 272823 2014-10-09 15:16:52Z marcel */ #ifndef _FREEBSD32_SYSPROTO_H_ Modified: head/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscall.h Thu Oct 9 15:16:52 2014 (r272823) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Thu Oct 9 15:19:35 2014 (r272824) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 270691 2014-08-27 01:02:02Z kib + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 272823 2014-10-09 15:16:52Z marcel */ #define FREEBSD32_SYS_syscall 0 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscalls.c Thu Oct 9 15:16:52 2014 (r272823) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Thu Oct 9 15:19:35 2014 (r272824) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 270691 2014-08-27 01:02:02Z kib + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 272823 2014-10-09 15:16:52Z marcel */ const char *freebsd32_syscallnames[] = { Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Thu Oct 9 15:16:52 2014 (r272823) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Thu Oct 9 15:19:35 2014 (r272824) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 270691 2014-08-27 01:02:02Z kib + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 272823 2014-10-09 15:16:52Z marcel */ #include "opt_compat.h" @@ -518,10 +518,10 @@ struct sysent freebsd32_sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 468 = nosys */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 469 = __getpath_fromfd */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 470 = __getpath_fromaddr */ - { AS(sctp_peeloff_args), (sy_call_t *)sys_sctp_peeloff, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 471 = sctp_peeloff */ - { AS(sctp_generic_sendmsg_args), (sy_call_t *)sys_sctp_generic_sendmsg, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 472 = sctp_generic_sendmsg */ - { AS(sctp_generic_sendmsg_iov_args), (sy_call_t *)sys_sctp_generic_sendmsg_iov, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 473 = sctp_generic_sendmsg_iov */ - { AS(sctp_generic_recvmsg_args), (sy_call_t *)sys_sctp_generic_recvmsg, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 474 = sctp_generic_recvmsg */ + { AS(sctp_peeloff_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 471 = sctp_peeloff */ + { AS(sctp_generic_sendmsg_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 472 = sctp_generic_sendmsg */ + { AS(sctp_generic_sendmsg_iov_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 473 = sctp_generic_sendmsg_iov */ + { AS(sctp_generic_recvmsg_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 474 = sctp_generic_recvmsg */ #ifdef PAD64_REQUIRED { AS(freebsd32_pread_args), (sy_call_t *)freebsd32_pread, AUE_PREAD, NULL, 0, 0, 0, SY_THR_STATIC }, /* 475 = freebsd32_pread */ { AS(freebsd32_pwrite_args), (sy_call_t *)freebsd32_pwrite, AUE_PWRITE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 476 = freebsd32_pwrite */ Modified: head/sys/kern/init_sysent.c ============================================================================== --- head/sys/kern/init_sysent.c Thu Oct 9 15:16:52 2014 (r272823) +++ head/sys/kern/init_sysent.c Thu Oct 9 15:19:35 2014 (r272824) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 263318 2014-03-18 21:32:03Z attilio + * created from FreeBSD: head/sys/kern/syscalls.master 272823 2014-10-09 15:16:52Z marcel */ #include "opt_compat.h" @@ -505,10 +505,10 @@ struct sysent sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 468 = nosys */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 469 = __getpath_fromfd */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 470 = __getpath_fromaddr */ - { AS(sctp_peeloff_args), (sy_call_t *)sys_sctp_peeloff, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 471 = sctp_peeloff */ - { AS(sctp_generic_sendmsg_args), (sy_call_t *)sys_sctp_generic_sendmsg, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 472 = sctp_generic_sendmsg */ - { AS(sctp_generic_sendmsg_iov_args), (sy_call_t *)sys_sctp_generic_sendmsg_iov, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 473 = sctp_generic_sendmsg_iov */ - { AS(sctp_generic_recvmsg_args), (sy_call_t *)sys_sctp_generic_recvmsg, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 474 = sctp_generic_recvmsg */ + { AS(sctp_peeloff_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_ABSENT }, /* 471 = sctp_peeloff */ + { AS(sctp_generic_sendmsg_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_ABSENT }, /* 472 = sctp_generic_sendmsg */ + { AS(sctp_generic_sendmsg_iov_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_ABSENT }, /* 473 = sctp_generic_sendmsg_iov */ + { AS(sctp_generic_recvmsg_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_ABSENT }, /* 474 = sctp_generic_recvmsg */ { AS(pread_args), (sy_call_t *)sys_pread, AUE_PREAD, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 475 = pread */ { AS(pwrite_args), (sy_call_t *)sys_pwrite, AUE_PWRITE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 476 = pwrite */ { AS(mmap_args), (sy_call_t *)sys_mmap, AUE_MMAP, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 477 = mmap */ Modified: head/sys/kern/syscalls.c ============================================================================== --- head/sys/kern/syscalls.c Thu Oct 9 15:16:52 2014 (r272823) +++ head/sys/kern/syscalls.c Thu Oct 9 15:19:35 2014 (r272824) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 263318 2014-03-18 21:32:03Z attilio + * created from FreeBSD: head/sys/kern/syscalls.master 272823 2014-10-09 15:16:52Z marcel */ const char *syscallnames[] = { Modified: head/sys/sys/syscall.h ============================================================================== --- head/sys/sys/syscall.h Thu Oct 9 15:16:52 2014 (r272823) +++ head/sys/sys/syscall.h Thu Oct 9 15:19:35 2014 (r272824) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 263318 2014-03-18 21:32:03Z attilio + * created from FreeBSD: head/sys/kern/syscalls.master 272823 2014-10-09 15:16:52Z marcel */ #define SYS_syscall 0 Modified: head/sys/sys/syscall.mk ============================================================================== --- head/sys/sys/syscall.mk Thu Oct 9 15:16:52 2014 (r272823) +++ head/sys/sys/syscall.mk Thu Oct 9 15:19:35 2014 (r272824) @@ -1,7 +1,7 @@ # FreeBSD system call names. # DO NOT EDIT-- this file is automatically generated. # $FreeBSD$ -# created from FreeBSD: head/sys/kern/syscalls.master 263318 2014-03-18 21:32:03Z attilio +# created from FreeBSD: head/sys/kern/syscalls.master 272823 2014-10-09 15:16:52Z marcel MIASM = \ syscall.o \ exit.o \ Modified: head/sys/sys/sysproto.h ============================================================================== --- head/sys/sys/sysproto.h Thu Oct 9 15:16:52 2014 (r272823) +++ head/sys/sys/sysproto.h Thu Oct 9 15:19:35 2014 (r272824) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 263318 2014-03-18 21:32:03Z attilio + * created from FreeBSD: head/sys/kern/syscalls.master 272823 2014-10-09 15:16:52Z marcel */ #ifndef _SYS_SYSPROTO_H_ From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 15:26:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 907FBBE4; Thu, 9 Oct 2014 15:26:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D30BE13; Thu, 9 Oct 2014 15:26:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99FQNeC042832; Thu, 9 Oct 2014 15:26:23 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99FQNDm042831; Thu, 9 Oct 2014 15:26:23 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410091526.s99FQNDm042831@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Thu, 9 Oct 2014 15:26:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272825 - head/sys/ufs/ufs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 15:26:23 -0000 Author: bapt Date: Thu Oct 9 15:26:22 2014 New Revision: 272825 URL: https://svnweb.freebsd.org/changeset/base/272825 Log: Use offsetof() from sys/types.h instead of a custom one This fixes build with recent gcc versions Modified: head/sys/ufs/ufs/dir.h Modified: head/sys/ufs/ufs/dir.h ============================================================================== --- head/sys/ufs/ufs/dir.h Thu Oct 9 15:19:35 2014 (r272824) +++ head/sys/ufs/ufs/dir.h Thu Oct 9 15:26:22 2014 (r272825) @@ -110,7 +110,7 @@ struct direct { * */ #define DIRECTSIZ(namlen) \ - (((uintptr_t)&((struct direct *)0)->d_name + \ + ((offsetof(struct direct, d_name) + \ ((namlen)+1)*sizeof(((struct direct *)0)->d_name[0]) + 3) & ~3) #if (BYTE_ORDER == LITTLE_ENDIAN) #define DIRSIZ(oldfmt, dp) \ From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 15:30:51 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DF4E9D93; Thu, 9 Oct 2014 15:30:51 +0000 (UTC) Received: from mail-wg0-x22e.google.com (mail-wg0-x22e.google.com [IPv6:2a00:1450:400c:c00::22e]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2AAD3EDB; Thu, 9 Oct 2014 15:30:51 +0000 (UTC) Received: by mail-wg0-f46.google.com with SMTP id l18so1614496wgh.29 for ; Thu, 09 Oct 2014 08:30:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=0p9D1n9cLJog7y0X2X/AfzG0spxSK+scejx1M7LFDuc=; b=Zsxzhqu/zzW3O4vuYkwkBbN56H5ADA607MspAqGimEvKEt9WadLr+YRywRNLk6PJIs WkCnlwrRHBGJPJRce1TDNpuuvesQoH0hp5VIjt3PCpCNwEZTj6b+pFDdKtGGHsBBWs5t 2Ui+exRO5e3gvFtTxkKCOctoJtjz7e9aeHaco9QNNLNambqVhzDTuPiHkifsunk4+Lrs FWLuKthxkUirIDqM7VJZXs/+DsMlC730pqoRJX6HrYfCmd2jaIoAIYFEJFI3vXRLoRRp pi0/EW5M+3qLZtHeCfKOPu9S50UKigvt19230gEnNDaA7R1zFFVayZp8wlpItrQiCsU0 mzSg== X-Received: by 10.194.216.39 with SMTP id on7mr19670515wjc.56.1412868649321; Thu, 09 Oct 2014 08:30:49 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by mx.google.com with ESMTPSA id bv17sm4403807wib.13.2014.10.09.08.30.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Oct 2014 08:30:48 -0700 (PDT) Sender: Baptiste Daroussin Date: Thu, 9 Oct 2014 17:30:44 +0200 From: Baptiste Daroussin To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r272825 - head/sys/ufs/ufs Message-ID: <20141009153043.GB19486@ivaldir.etoilebsd.net> References: <201410091526.s99FQNDm042831@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="mojUlQ0s9EVzWg2t" Content-Disposition: inline In-Reply-To: <201410091526.s99FQNDm042831@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 15:30:52 -0000 --mojUlQ0s9EVzWg2t Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Oct 09, 2014 at 03:26:23PM +0000, Baptiste Daroussin wrote: > Author: bapt > Date: Thu Oct 9 15:26:22 2014 > New Revision: 272825 > URL: https://svnweb.freebsd.org/changeset/base/272825 >=20 > Log: > Use offsetof() from sys/types.h instead of a custom one > This fixes build with recent gcc versions >=20 I forgot: Reviewed by: kan, imp Differential revision: https://reviews.freebsd.org/D925 regards, Bapt --mojUlQ0s9EVzWg2t Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlQ2qiMACgkQ8kTtMUmk6EznjACgo6jUrmps/1/1rieMIjf/szhf TPsAnRCnvO2TFI+fkf2tdgc/UkrVJ8RP =mFNG -----END PGP SIGNATURE----- --mojUlQ0s9EVzWg2t-- From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 15:52:02 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 129644B2; Thu, 9 Oct 2014 15:52:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F3CB9180; Thu, 9 Oct 2014 15:52:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99Fq1UR059330; Thu, 9 Oct 2014 15:52:01 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99Fq1jI059329; Thu, 9 Oct 2014 15:52:01 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410091552.s99Fq1jI059329@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Thu, 9 Oct 2014 15:52:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272827 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 15:52:02 -0000 Author: bapt Date: Thu Oct 9 15:52:01 2014 New Revision: 272827 URL: https://svnweb.freebsd.org/changeset/base/272827 Log: Add size(1) to the cross build toolchain Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Thu Oct 9 15:35:28 2014 (r272826) +++ head/Makefile.inc1 Thu Oct 9 15:52:01 2014 (r272827) @@ -315,7 +315,7 @@ X${COMPILER}?= ${CROSS_COMPILER_PREFIX}$ X${COMPILER}?= ${${COMPILER}} .endif .endfor -XBINUTILS= AS AR LD NM OBJCOPY OBJDUMP RANLIB STRINGS +XBINUTILS= AS AR LD NM OBJCOPY OBJDUMP RANLIB SIZE STRINGS .for BINUTIL in ${XBINUTILS} .if defined(CROSS_BINUTILS_PREFIX) X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}} @@ -327,7 +327,8 @@ WMAKEENV+= CC="${XCC} ${XFLAGS}" CXX="${ CPP="${XCPP} ${XFLAGS}" \ AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \ OBJDUMP=${XOBJDUMP} OBJCOPY="${XOBJCOPY}" \ - RANLIB=${XRANLIB} STRINGS=${XSTRINGS} + RANLIB=${XRANLIB} STRINGS=${XSTRINGS} \ + SIZE="${XSIZE}" .if ${XCC:M/*} XFLAGS= --sysroot=${WORLDTMP} From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 16:39:10 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EB7EE74D; Thu, 9 Oct 2014 16:39:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D825B951; Thu, 9 Oct 2014 16:39:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99GdAuq080707; Thu, 9 Oct 2014 16:39:10 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99GdA0N080706; Thu, 9 Oct 2014 16:39:10 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201410091639.s99GdA0N080706@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 9 Oct 2014 16:39:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272829 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 16:39:11 -0000 Author: imp Date: Thu Oct 9 16:39:10 2014 New Revision: 272829 URL: https://svnweb.freebsd.org/changeset/base/272829 Log: When building with a newer GCC, suppress some warnings for the moment. The kernel isn't ready for them without a lot of work. Modified: head/sys/conf/kern.mk Modified: head/sys/conf/kern.mk ============================================================================== --- head/sys/conf/kern.mk Thu Oct 9 16:12:01 2014 (r272828) +++ head/sys/conf/kern.mk Thu Oct 9 16:39:10 2014 (r272829) @@ -33,7 +33,13 @@ CWARNEXTRA?= -Wno-error-tautological-com .endif .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40300 -CWARNEXTRA?= -Wno-inline +# Catch-all for all the things that are in our tree, but for which we're +# not yet ready for this compiler. Note: we likely only really "support" +# building with gcc 4.8 and newer. Nothing older has been tested. +CWARNEXTRA?= -Wno-error=inline -Wno-error=enum-compare -Wno-error=unused-but-set-variable \ + -Wno-error=aggressive-loop-optimizations -Wno-error=maybe-uninitialized \ + -Wno-error=unused-local-typedefs -Wno-error=array-bounds -Wno-error=address \ + -Wno-error=cast-qual -Wno-error=sequence-point -Wno-error=attributes .endif # External compilers may not support our format extensions. Allow them From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 16:45:12 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 679BCA0F; Thu, 9 Oct 2014 16:45:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A8F8A09; Thu, 9 Oct 2014 16:45:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99GjC0f085036; Thu, 9 Oct 2014 16:45:12 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99GjCaR085035; Thu, 9 Oct 2014 16:45:12 GMT (envelope-from des@FreeBSD.org) Message-Id: <201410091645.s99GjCaR085035@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: des set sender to des@FreeBSD.org using -f From: Dag-Erling Smørgrav Date: Thu, 9 Oct 2014 16:45:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272830 - head/lib/libcrypt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 16:45:12 -0000 Author: des Date: Thu Oct 9 16:45:11 2014 New Revision: 272830 URL: https://svnweb.freebsd.org/changeset/base/272830 Log: Change the hardcoded default back from SHA512 to DES. PR: 192277 MFC after: 3 days Modified: head/lib/libcrypt/crypt.c Modified: head/lib/libcrypt/crypt.c ============================================================================== --- head/lib/libcrypt/crypt.c Thu Oct 9 16:39:10 2014 (r272829) +++ head/lib/libcrypt/crypt.c Thu Oct 9 16:45:11 2014 (r272830) @@ -37,24 +37,26 @@ __FBSDID("$FreeBSD$"); #include "crypt.h" /* - * List of supported crypt(3) formats. The first element in the list will - * be the default. + * List of supported crypt(3) formats. + * + * The default algorithm is the last entry in the list (second-to-last + * array element since the last is a sentinel). The reason for placing + * the default last rather than first is that DES needs to be at the + * bottom for the algorithm guessing logic in crypt(3) to work correctly, + * and it needs to be the default for backward compatibility. */ static const struct crypt_format { const char *const name; char *(*const func)(const char *, const char *); const char *const magic; } crypt_formats[] = { - /* default format */ - { "sha512", crypt_sha512, "$6$" }, - - /* other supported formats */ { "md5", crypt_md5, "$1$" }, #ifdef HAS_BLOWFISH { "blf", crypt_blowfish, "$2" }, #endif { "nth", crypt_nthash, "$3$" }, { "sha256", crypt_sha256, "$5$" }, + { "sha512", crypt_sha512, "$6$" }, #ifdef HAS_DES { "des", crypt_des, "_" }, #endif @@ -63,7 +65,8 @@ static const struct crypt_format { { NULL, NULL, NULL } }; -static const struct crypt_format *crypt_format = &crypt_formats[0]; +static const struct crypt_format *crypt_format = + &crypt_formats[(sizeof crypt_formats / sizeof *crypt_formats) - 2]; #define DES_SALT_ALPHABET \ "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 16:48:43 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1F25AC63; Thu, 9 Oct 2014 16:48:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0BC1FA2F; Thu, 9 Oct 2014 16:48:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99GmgD6085609; Thu, 9 Oct 2014 16:48:42 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99GmgMx085608; Thu, 9 Oct 2014 16:48:42 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201410091648.s99GmgMx085608@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 9 Oct 2014 16:48:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272831 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 16:48:43 -0000 Author: adrian Date: Thu Oct 9 16:48:42 2014 New Revision: 272831 URL: https://svnweb.freebsd.org/changeset/base/272831 Log: Shuffle things. Suggested by: jhb Differential Revision: D906 Sponsored by: Norse Corp Modified: head/sys/sys/bus.h Modified: head/sys/sys/bus.h ============================================================================== --- head/sys/sys/bus.h Thu Oct 9 16:45:11 2014 (r272830) +++ head/sys/sys/bus.h Thu Oct 9 16:48:42 2014 (r272831) @@ -327,6 +327,7 @@ int bus_generic_detach(device_t dev); void bus_generic_driver_added(device_t dev, driver_t *driver); bus_dma_tag_t bus_generic_get_dma_tag(device_t dev, device_t child); +int bus_generic_get_domain(device_t dev, device_t child, int *domain); struct resource_list * bus_generic_get_resource_list (device_t, device_t); void bus_generic_new_pass(device_t dev); @@ -365,8 +366,6 @@ int bus_generic_teardown_intr(device_t d int bus_generic_write_ivar(device_t dev, device_t child, int which, uintptr_t value); -int bus_generic_get_domain(device_t dev, device_t child, int *domain); - /* * Wrapper functions for the BUS_*_RESOURCE methods to make client code * a little simpler. From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 17:26:30 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C240443E; Thu, 9 Oct 2014 17:26:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AEF59E6C; Thu, 9 Oct 2014 17:26:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99HQUnl004195; Thu, 9 Oct 2014 17:26:30 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99HQU54004194; Thu, 9 Oct 2014 17:26:30 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410091726.s99HQU54004194@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Thu, 9 Oct 2014 17:26:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272832 - head/sys/ufs/ufs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 17:26:30 -0000 Author: bapt Date: Thu Oct 9 17:26:29 2014 New Revision: 272832 URL: https://svnweb.freebsd.org/changeset/base/272832 Log: Backout r272825 every useland usage of ufs/ufs/dir.h are now broken with that change Modified: head/sys/ufs/ufs/dir.h Modified: head/sys/ufs/ufs/dir.h ============================================================================== --- head/sys/ufs/ufs/dir.h Thu Oct 9 16:48:42 2014 (r272831) +++ head/sys/ufs/ufs/dir.h Thu Oct 9 17:26:29 2014 (r272832) @@ -110,7 +110,7 @@ struct direct { * */ #define DIRECTSIZ(namlen) \ - ((offsetof(struct direct, d_name) + \ + (((uintptr_t)&((struct direct *)0)->d_name + \ ((namlen)+1)*sizeof(((struct direct *)0)->d_name[0]) + 3) & ~3) #if (BYTE_ORDER == LITTLE_ENDIAN) #define DIRSIZ(oldfmt, dp) \ From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 17:39:12 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 151E4862; Thu, 9 Oct 2014 17:39:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 025A7FF5; Thu, 9 Oct 2014 17:39:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99HdBXN009192; Thu, 9 Oct 2014 17:39:11 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99HdBjb009191; Thu, 9 Oct 2014 17:39:11 GMT (envelope-from des@FreeBSD.org) Message-Id: <201410091739.s99HdBjb009191@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: des set sender to des@FreeBSD.org using -f From: Dag-Erling Smørgrav Date: Thu, 9 Oct 2014 17:39:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272833 - head/usr.sbin/pw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 17:39:12 -0000 Author: des Date: Thu Oct 9 17:39:11 2014 New Revision: 272833 URL: https://svnweb.freebsd.org/changeset/base/272833 Log: Two more places where login_setcryptfmt() defaults to MD5 were missed in r252688. MFC after: 3 days Modified: head/usr.sbin/pw/pw_user.c Modified: head/usr.sbin/pw/pw_user.c ============================================================================== --- head/usr.sbin/pw/pw_user.c Thu Oct 9 17:26:29 2014 (r272832) +++ head/usr.sbin/pw/pw_user.c Thu Oct 9 17:39:11 2014 (r272833) @@ -615,7 +615,7 @@ pw_user(struct userconf * cnf, int mode, pwd->pw_dir = pw_homepolicy(cnf, args, pwd->pw_name); pwd->pw_shell = pw_shellpolicy(cnf, args, NULL); lc = login_getpwclass(pwd); - if (lc == NULL || login_setcryptfmt(lc, "md5", NULL) == NULL) + if (lc == NULL || login_setcryptfmt(lc, "sha512", NULL) == NULL) warn("setting crypt(3) format"); login_close(lc); pwd->pw_passwd = pw_password(cnf, args, pwd->pw_name); @@ -690,7 +690,7 @@ pw_user(struct userconf * cnf, int mode, } else { lc = login_getpwclass(pwd); if (lc == NULL || - login_setcryptfmt(lc, "md5", NULL) == NULL) + login_setcryptfmt(lc, "sha512", NULL) == NULL) warn("setting crypt(3) format"); login_close(lc); pwd->pw_passwd = pw_pwcrypt(line); From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 17:45:59 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9DDD1A39; Thu, 9 Oct 2014 17:45:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A1ED142; Thu, 9 Oct 2014 17:45:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99HjxHF013497; Thu, 9 Oct 2014 17:45:59 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99HjxFU013496; Thu, 9 Oct 2014 17:45:59 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201410091745.s99HjxFU013496@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 9 Oct 2014 17:45:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272834 - head/cddl/contrib/opensolaris/cmd/lockstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 17:45:59 -0000 Author: markj Date: Thu Oct 9 17:45:58 2014 New Revision: 272834 URL: https://svnweb.freebsd.org/changeset/base/272834 Log: Document the CPU+Pri_Class column rather than CPU+PRI, as the latter isn't used or implemented on FreeBSD. Reported by: kmacy Reviewed by: kmacy, rpaulo MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Modified: head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.1 Modified: head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.1 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.1 Thu Oct 9 17:39:11 2014 (r272833) +++ head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.1 Thu Oct 9 17:45:58 2014 (r272834) @@ -21,7 +21,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 24, 2013 +.Dd October 8, 2014 .Dt LOCKSTAT 1 .Os .Sh NAME @@ -238,10 +238,11 @@ Average duration of the events in nanose For the profiling event, duration means interrupt latency. .It Lock Address of the lock; displayed symbolically if possible. -.It CPU+PIL -CPU plus processor interrupt level (PIL). -For example, if CPU 4 is interrupted while at PIL 6, this will be reported as -cpu[4]+6. +.It CPU+Pri_Class +CPU plus the priority class of the interrupted thread. +For example, if CPU 4 is interrupted while running a timeshare thread, this +will be reported as +.Ql cpu[4]+TShar . .It Caller Address of the caller; displayed symbolically if possible. .El From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 18:23:17 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 71EFF226; Thu, 9 Oct 2014 18:23:17 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EFC06790; Thu, 9 Oct 2014 18:23:16 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id s99INA1R019051 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 9 Oct 2014 21:23:10 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua s99INA1R019051 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id s99INAdr019050; Thu, 9 Oct 2014 21:23:10 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 9 Oct 2014 21:23:10 +0300 From: Konstantin Belousov To: Adrian Chadd Subject: Re: svn commit: r272800 - head/sys/x86/acpica Message-ID: <20141009182310.GL2153@kib.kiev.ua> References: <201410090534.s995YTUx057314@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201410090534.s995YTUx057314@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 18:23:17 -0000 On Thu, Oct 09, 2014 at 05:34:29AM +0000, Adrian Chadd wrote: > Author: adrian > Date: Thu Oct 9 05:34:28 2014 > New Revision: 272800 > URL: https://svnweb.freebsd.org/changeset/base/272800 > > Log: > Missing from previous commit - keep the VM domain -> PXM mapping > array and use it to map PXM -> VM domain when needed. > > Differential Revision: D906 > Reviewed by: jhb > > Modified: > head/sys/x86/acpica/srat.c > > Modified: head/sys/x86/acpica/srat.c > ============================================================================== > --- head/sys/x86/acpica/srat.c Thu Oct 9 05:33:25 2014 (r272799) > +++ head/sys/x86/acpica/srat.c Thu Oct 9 05:34:28 2014 (r272800) > @@ -62,6 +62,8 @@ int num_mem; > static ACPI_TABLE_SRAT *srat; > static vm_paddr_t srat_physaddr; > > +static int vm_domains[VM_PHYSSEG_MAX]; > + > static void srat_walk_table(acpi_subtable_handler *handler, void *arg); > > /* > @@ -247,7 +249,6 @@ check_phys_avail(void) > static int > renumber_domains(void) > { > - int domains[VM_PHYSSEG_MAX]; > int i, j, slot; > > /* Enumerate all the domains. */ > @@ -255,17 +256,17 @@ renumber_domains(void) > for (i = 0; i < num_mem; i++) { > /* See if this domain is already known. */ > for (j = 0; j < vm_ndomains; j++) { > - if (domains[j] >= mem_info[i].domain) > + if (vm_domains[j] >= mem_info[i].domain) > break; > } > - if (j < vm_ndomains && domains[j] == mem_info[i].domain) > + if (j < vm_ndomains && vm_domains[j] == mem_info[i].domain) > continue; > > /* Insert the new domain at slot 'j'. */ > slot = j; > for (j = vm_ndomains; j > slot; j--) > - domains[j] = domains[j - 1]; > - domains[slot] = mem_info[i].domain; > + vm_domains[j] = vm_domains[j - 1]; > + vm_domains[slot] = mem_info[i].domain; > vm_ndomains++; > if (vm_ndomains > MAXMEMDOM) { > vm_ndomains = 1; > @@ -280,15 +281,15 @@ renumber_domains(void) > * If the domain is already the right value, no need > * to renumber. > */ > - if (domains[i] == i) > + if (vm_domains[i] == i) > continue; > > /* Walk the cpu[] and mem_info[] arrays to renumber. */ > for (j = 0; j < num_mem; j++) > - if (mem_info[j].domain == domains[i]) > + if (mem_info[j].domain == vm_domains[i]) > mem_info[j].domain = i; > for (j = 0; j <= MAX_APIC_ID; j++) > - if (cpus[j].enabled && cpus[j].domain == domains[i]) > + if (cpus[j].enabled && cpus[j].domain == vm_domains[i]) > cpus[j].domain = i; > } > KASSERT(vm_ndomains > 0, > @@ -368,4 +369,23 @@ srat_set_cpus(void *dummy) > } > } > SYSINIT(srat_set_cpus, SI_SUB_CPU, SI_ORDER_ANY, srat_set_cpus, NULL); > + > +/* > + * Map a _PXM value to a VM domain ID. > + * > + * Returns the domain ID, or -1 if no domain ID was found. > + */ > +int > +acpi_map_pxm_to_vm_domainid(int pxm) > +{ > + int i; > + > + for (i = 0; i < vm_ndomains; i++) { > + if (vm_domains[i] == pxm) > + return (i); > + } > + > + return (-1); > +} > + > #endif /* MAXMEMDOM > 1 */ I do not like it. Sorry for not looking at the web thing, I have very little time. It never was an intention that one proximity domain reported by ACPI was mapped to single VM domain. VM could split domains (in terms of vm_domains) further for other reasons. Main motivation is that there is 1:1 relations between domain/page queues/page queues locks/pagedaemons. I have patches in WIP stage which split firmware proximity domains further, to decrease congestion on the page queue locks. I wrote about this in the pgsql performance report. The short version is that there is/will be N:1 relation between VM domains and proximity domains (which is reported by ACPI for devices). From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 18:49:59 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6593A87F; Thu, 9 Oct 2014 18:49:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 518C5A00; Thu, 9 Oct 2014 18:49:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99InxSw042543; Thu, 9 Oct 2014 18:49:59 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99Inxf8042542; Thu, 9 Oct 2014 18:49:59 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410091849.s99Inxf8042542@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 9 Oct 2014 18:49:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272836 - head/sys/fs/autofs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 18:49:59 -0000 Author: trasz Date: Thu Oct 9 18:49:58 2014 New Revision: 272836 URL: https://svnweb.freebsd.org/changeset/base/272836 Log: Remove remnants of some cleanup; no functional changes. Sponsored by: The FreeBSD Foundation Modified: head/sys/fs/autofs/autofs_vnops.c Modified: head/sys/fs/autofs/autofs_vnops.c ============================================================================== --- head/sys/fs/autofs/autofs_vnops.c Thu Oct 9 18:03:12 2014 (r272835) +++ head/sys/fs/autofs/autofs_vnops.c Thu Oct 9 18:49:58 2014 (r272836) @@ -459,8 +459,8 @@ autofs_readdir(struct vop_readdir_args * static int autofs_reclaim(struct vop_reclaim_args *ap) { - struct vnode *vp = ap->a_vp; - struct autofs_node *anp = vp->v_data; + struct vnode *vp; + struct autofs_node *anp; vp = ap->a_vp; anp = vp->v_data; From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 19:02:33 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 187C3D67; Thu, 9 Oct 2014 19:02:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 05579BAE; Thu, 9 Oct 2014 19:02:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99J2WwI051220; Thu, 9 Oct 2014 19:02:32 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99J2WuC051219; Thu, 9 Oct 2014 19:02:32 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201410091902.s99J2WuC051219@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Thu, 9 Oct 2014 19:02:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272838 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 19:02:33 -0000 Author: neel Date: Thu Oct 9 19:02:32 2014 New Revision: 272838 URL: https://svnweb.freebsd.org/changeset/base/272838 Log: iasl(8) expects integer fields in data tables to be specified as hexadecimal values. Therefore the bit width of the "PM Timer Block" was actually being interpreted as 50-bits instead of the expected 32-bit. This eliminates an error message emitted by a Linux 3.17 guest during boot: "Invalid length for FADT/PmTimerBlock: 50, using default 32" Reviewed by: grehan MFC after: 1 week Modified: head/usr.sbin/bhyve/acpi.c Modified: head/usr.sbin/bhyve/acpi.c ============================================================================== --- head/usr.sbin/bhyve/acpi.c Thu Oct 9 18:50:37 2014 (r272837) +++ head/usr.sbin/bhyve/acpi.c Thu Oct 9 19:02:32 2014 (r272838) @@ -492,7 +492,7 @@ basl_fwrite_fadt(FILE *fp) EFPRINTF(fp, "[0012]\t\tPM Timer Block : [Generic Address Structure]\n"); EFPRINTF(fp, "[0001]\t\tSpace ID : 01 [SystemIO]\n"); - EFPRINTF(fp, "[0001]\t\tBit Width : 32\n"); + EFPRINTF(fp, "[0001]\t\tBit Width : 20\n"); EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n"); EFPRINTF(fp, "[0001]\t\tEncoded Access Width : 03 [DWord Access:32]\n"); @@ -502,7 +502,7 @@ basl_fwrite_fadt(FILE *fp) EFPRINTF(fp, "[0012]\t\tGPE0 Block : [Generic Address Structure]\n"); EFPRINTF(fp, "[0001]\t\tSpace ID : 01 [SystemIO]\n"); - EFPRINTF(fp, "[0001]\t\tBit Width : 80\n"); + EFPRINTF(fp, "[0001]\t\tBit Width : 00\n"); EFPRINTF(fp, "[0001]\t\tBit Offset : 00\n"); EFPRINTF(fp, "[0001]\t\tEncoded Access Width : 01 [Byte Access:8]\n"); EFPRINTF(fp, "[0008]\t\tAddress : 0000000000000000\n"); From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 19:13:35 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EEFC9FBB; Thu, 9 Oct 2014 19:13:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D0909CB1; Thu, 9 Oct 2014 19:13:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99JDYjf056184; Thu, 9 Oct 2014 19:13:34 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99JDYS1056181; Thu, 9 Oct 2014 19:13:34 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201410091913.s99JDYS1056181@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Thu, 9 Oct 2014 19:13:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272839 - in head: sys/amd64/vmm/intel sys/x86/include usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 19:13:35 -0000 Author: neel Date: Thu Oct 9 19:13:33 2014 New Revision: 272839 URL: https://svnweb.freebsd.org/changeset/base/272839 Log: Support Intel-specific MSRs that are accessed when booting up a linux in bhyve: - MSR_PLATFORM_INFO - MSR_TURBO_RATIO_LIMITx - MSR_RAPL_POWER_UNIT Reviewed by: grehan MFC after: 1 week Modified: head/sys/amd64/vmm/intel/vmx_msr.c head/sys/x86/include/specialreg.h head/usr.sbin/bhyve/xmsr.c Modified: head/sys/amd64/vmm/intel/vmx_msr.c ============================================================================== --- head/sys/amd64/vmm/intel/vmx_msr.c Thu Oct 9 19:02:32 2014 (r272838) +++ head/sys/amd64/vmm/intel/vmx_msr.c Thu Oct 9 19:13:33 2014 (r272839) @@ -33,7 +33,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include +#include #include #include @@ -176,11 +178,64 @@ msr_bitmap_change_access(char *bitmap, u } static uint64_t misc_enable; +static uint64_t platform_info; +static uint64_t turbo_ratio_limit; static uint64_t host_msrs[GUEST_MSR_NUM]; +static bool +nehalem_cpu(void) +{ + u_int family, model; + + /* + * The family:model numbers belonging to the Nehalem microarchitecture + * are documented in Section 35.5, Intel SDM dated Feb 2014. + */ + family = CPUID_TO_FAMILY(cpu_id); + model = CPUID_TO_MODEL(cpu_id); + if (family == 0x6) { + switch (model) { + case 0x1A: + case 0x1E: + case 0x1F: + case 0x2E: + return (true); + default: + break; + } + } + return (false); +} + +static bool +westmere_cpu(void) +{ + u_int family, model; + + /* + * The family:model numbers belonging to the Westmere microarchitecture + * are documented in Section 35.6, Intel SDM dated Feb 2014. + */ + family = CPUID_TO_FAMILY(cpu_id); + model = CPUID_TO_MODEL(cpu_id); + if (family == 0x6) { + switch (model) { + case 0x25: + case 0x2C: + return (true); + default: + break; + } + } + return (false); +} + void vmx_msr_init(void) { + uint64_t bus_freq, ratio; + int i; + /* * It is safe to cache the values of the following MSRs because * they don't change based on curcpu, curproc or curthread. @@ -204,6 +259,44 @@ vmx_msr_init(void) */ misc_enable |= (1 << 12) | (1 << 11); misc_enable &= ~((1 << 18) | (1 << 16)); + + if (nehalem_cpu() || westmere_cpu()) + bus_freq = 133330000; /* 133Mhz */ + else + bus_freq = 100000000; /* 100Mhz */ + + /* + * XXXtime + * The ratio should really be based on the virtual TSC frequency as + * opposed to the host TSC. + */ + ratio = (tsc_freq / bus_freq) & 0xff; + + /* + * The register definition is based on the micro-architecture + * but the following bits are always the same: + * [15:8] Maximum Non-Turbo Ratio + * [28] Programmable Ratio Limit for Turbo Mode + * [29] Programmable TDC-TDP Limit for Turbo Mode + * [47:40] Maximum Efficiency Ratio + * + * The other bits can be safely set to 0 on all + * micro-architectures up to Haswell. + */ + platform_info = (ratio << 8) | (ratio << 40); + + /* + * The number of valid bits in the MSR_TURBO_RATIO_LIMITx register is + * dependent on the maximum cores per package supported by the micro- + * architecture. For e.g., Westmere supports 6 cores per package and + * uses the low 48 bits. Sandybridge support 8 cores per package and + * uses up all 64 bits. + * + * However, the unused bits are reserved so we pretend that all bits + * in this MSR are valid. + */ + for (i = 0; i < 8; i++) + turbo_ratio_limit = (turbo_ratio_limit << 8) | ratio; } void @@ -266,6 +359,13 @@ vmx_rdmsr(struct vmx *vmx, int vcpuid, u case MSR_IA32_MISC_ENABLE: *val = misc_enable; break; + case MSR_PLATFORM_INFO: + *val = platform_info; + break; + case MSR_TURBO_RATIO_LIMIT: + case MSR_TURBO_RATIO_LIMIT1: + *val = turbo_ratio_limit; + break; default: error = EINVAL; break; Modified: head/sys/x86/include/specialreg.h ============================================================================== --- head/sys/x86/include/specialreg.h Thu Oct 9 19:02:32 2014 (r272838) +++ head/sys/x86/include/specialreg.h Thu Oct 9 19:13:33 2014 (r272839) @@ -381,6 +381,7 @@ #define MSR_BIOS_SIGN 0x08b #define MSR_PERFCTR0 0x0c1 #define MSR_PERFCTR1 0x0c2 +#define MSR_PLATFORM_INFO 0x0ce #define MSR_MPERF 0x0e7 #define MSR_APERF 0x0e8 #define MSR_IA32_EXT_CONFIG 0x0ee /* Undocumented. Core Solo/Duo only */ @@ -404,6 +405,8 @@ #define MSR_THERM_STATUS 0x19c #define MSR_IA32_MISC_ENABLE 0x1a0 #define MSR_IA32_TEMPERATURE_TARGET 0x1a2 +#define MSR_TURBO_RATIO_LIMIT 0x1ad +#define MSR_TURBO_RATIO_LIMIT1 0x1ae #define MSR_DEBUGCTLMSR 0x1d9 #define MSR_LASTBRANCHFROMIP 0x1db #define MSR_LASTBRANCHTOIP 0x1dc @@ -437,6 +440,7 @@ #define MSR_MC4_STATUS 0x411 #define MSR_MC4_ADDR 0x412 #define MSR_MC4_MISC 0x413 +#define MSR_RAPL_POWER_UNIT 0x606 #define MSR_PKG_ENERGY_STATUS 0x611 #define MSR_DRAM_ENERGY_STATUS 0x619 #define MSR_PP0_ENERGY_STATUS 0x639 Modified: head/usr.sbin/bhyve/xmsr.c ============================================================================== --- head/usr.sbin/bhyve/xmsr.c Thu Oct 9 19:02:32 2014 (r272838) +++ head/usr.sbin/bhyve/xmsr.c Thu Oct 9 19:13:33 2014 (r272839) @@ -80,6 +80,13 @@ emulate_rdmsr(struct vmctx *ctx, int vcp case MSR_DRAM_ENERGY_STATUS: *val = 0; break; + case MSR_RAPL_POWER_UNIT: + /* + * Use the default value documented in section + * "RAPL Interfaces" in Intel SDM vol3. + */ + *val = 0x000a1003; + break; default: error = -1; break; From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 19:32:36 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B3DC250A; Thu, 9 Oct 2014 19:32:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D3C5EB6; Thu, 9 Oct 2014 19:32:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99JWaVX065628; Thu, 9 Oct 2014 19:32:36 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99JWaSc065624; Thu, 9 Oct 2014 19:32:36 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201410091932.s99JWaSc065624@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Thu, 9 Oct 2014 19:32:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272840 - in head: sbin/ipfw sys/conf sys/modules/ipfw sys/netgraph sys/netinet sys/netpfil/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 19:32:36 -0000 Author: melifaro Date: Thu Oct 9 19:32:35 2014 New Revision: 272840 URL: https://svnweb.freebsd.org/changeset/base/272840 Log: Merge projects/ipfw to HEAD. Main user-visible changes are related to tables: * Tables are now identified by names, not numbers. There can be up to 65k tables with up to 63-byte long names. * Tables are now set-aware (default off), so you can switch/move them atomically with rules. * More functionality is supported (swap, lock, limits, user-level lookup, batched add/del) by generic table code. * New table types are added (flow) so you can match multiple packet fields at once. * Ability to add different type of lookup algorithms for particular table type has been added. * New table algorithms are added (cidr:hash, iface:array, number:array and flow:hash) to make certain types of lookup more effective. * Table value are now capable of holding multiple data fields for different tablearg users Performance changes: * Main ipfw lock was converted to rmlock * Rule counters were separated from rule itself and made per-cpu. * Radix table entries fits into 128 bytes * struct ip_fw is now more compact so more rules will fit into 64 bytes * interface tables uses array of existing ifindexes for faster match ABI changes: All functionality supported by old ipfw(8) remains functional. Old & new binaries can work together with the following restrictions: * Tables named other than ^\d+$ are shown as table(65535) in ruleset in old binaries Internal changes:. Changing table ids to numbers resulted in format modification for most sockopt codes. Old sopt format was compact, but very hard to extend (no versioning, inability to add more opcodes), so * All relevant opcodes were converted to TLV-based versioned IP_FW3-based codes. * The remaining opcodes were also converted to be able to eliminate all older opcodes at once * All IP_FW3 handlers uses special API instead of calling sooptcopy* directly to ease adding another communication methods * struct ip_fw is now different for kernel and userland * tablearg value has been changed to 0 to ease future extensions * table "values" are now indexes in special value array which holds extended data for given index * Batched add/delete has been added to tables code * Most changes has been done to permit batched rule addition. * interface tracking API has been added (started on demand) to permit effective interface tables operations * O(1) skipto cache, currently turned off by default at compile-time (eats 512K). * Several steps has been made towards making libipfw: * most of new functions were separated into "parse/prepare/show and actuall-do-stuff" pieces (already merged). * there are separate functions for parsing text string into "struct ip_fw" and printing "struct ip_fw" to supplied buffer (already merged). * Probably some more less significant/forgotten features MFC after: 1 month Sponsored by: Yandex LLC Added: head/sbin/ipfw/tables.c - copied unchanged from r272837, projects/ipfw/sbin/ipfw/tables.c head/sys/netpfil/ipfw/ip_fw_iface.c - copied unchanged from r272837, projects/ipfw/sys/netpfil/ipfw/ip_fw_iface.c head/sys/netpfil/ipfw/ip_fw_table.h (contents, props changed) - copied, changed from r272837, projects/ipfw/sys/netpfil/ipfw/ip_fw_table.h head/sys/netpfil/ipfw/ip_fw_table_algo.c (contents, props changed) - copied, changed from r272837, projects/ipfw/sys/netpfil/ipfw/ip_fw_table_algo.c head/sys/netpfil/ipfw/ip_fw_table_value.c - copied unchanged from r272837, projects/ipfw/sys/netpfil/ipfw/ip_fw_table_value.c Modified: head/sbin/ipfw/Makefile head/sbin/ipfw/ipfw.8 head/sbin/ipfw/ipfw2.c head/sbin/ipfw/ipfw2.h head/sbin/ipfw/main.c head/sbin/ipfw/nat.c head/sys/conf/files head/sys/modules/ipfw/Makefile head/sys/netgraph/ng_ipfw.c head/sys/netinet/ip_fw.h head/sys/netpfil/ipfw/ip_dummynet.c head/sys/netpfil/ipfw/ip_fw2.c head/sys/netpfil/ipfw/ip_fw_dynamic.c head/sys/netpfil/ipfw/ip_fw_log.c head/sys/netpfil/ipfw/ip_fw_nat.c head/sys/netpfil/ipfw/ip_fw_private.h head/sys/netpfil/ipfw/ip_fw_sockopt.c head/sys/netpfil/ipfw/ip_fw_table.c Directory Properties: head/ (props changed) head/sbin/ (props changed) head/sbin/ipfw/ (props changed) head/sys/ (props changed) head/sys/conf/ (props changed) Modified: head/sbin/ipfw/Makefile ============================================================================== --- head/sbin/ipfw/Makefile Thu Oct 9 19:13:33 2014 (r272839) +++ head/sbin/ipfw/Makefile Thu Oct 9 19:32:35 2014 (r272840) @@ -3,7 +3,7 @@ .include PROG= ipfw -SRCS= ipfw2.c dummynet.c ipv6.c main.c nat.c +SRCS= ipfw2.c dummynet.c ipv6.c main.c nat.c tables.c WARNS?= 2 .if ${MK_PF} != "no" Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Thu Oct 9 19:13:33 2014 (r272839) +++ head/sbin/ipfw/ipfw.8 Thu Oct 9 19:32:35 2014 (r272840) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 31, 2014 +.Dd Aug 13, 2014 .Dt IPFW 8 .Os .Sh NAME @@ -48,17 +48,43 @@ in-kernel NAT. .Brq Cm firewall | altq | one_pass | debug | verbose | dyn_keepalive .Ss LOOKUP TABLES .Nm -.Cm table Ar number Cm add Ar addr Ns Oo / Ns Ar masklen Oc Op Ar value +.Oo Cm set Ar N Oc Cm table Ar name Cm create Ar create-options .Nm -.Cm table Ar number Cm delete Ar addr Ns Op / Ns Ar masklen +.Oo Cm set Ar N Oc Cm table Ar name Cm destroy .Nm -.Cm table -.Brq Ar number | all -.Cm flush +.Oo Cm set Ar N Oc Cm table Ar name Cm modify Ar modify-options +.Nm +.Oo Cm set Ar N Oc Cm table Ar name Cm swap Ar name +.Nm +.Oo Cm set Ar N Oc Cm table Ar name Cm add Ar table-key Op Ar value +.Nm +.Oo Cm set Ar N Oc Cm table Ar name Cm add Op Ar table-key Ar value ... +.Nm +.Oo Cm set Ar N Oc Cm table Ar name Cm atomic add Op Ar table-key Ar value ... +.Nm +.Oo Cm set Ar N Oc Cm table Ar name Cm delete Op Ar table-key ... .Nm -.Cm table -.Brq Ar number | all +.Oo Cm set Ar N Oc Cm table Ar name Cm lookup Ar addr +.Nm +.Oo Cm set Ar N Oc Cm table Ar name Cm lock +.Nm +.Oo Cm set Ar N Oc Cm table Ar name Cm unlock +.Nm +.Oo Cm set Ar N Oc Cm table +.Brq Ar name | all .Cm list +.Nm +.Oo Cm set Ar N Oc Cm table +.Brq Ar name | all +.Cm info +.Nm +.Oo Cm set Ar N Oc Cm table +.Brq Ar name | all +.Cm detail +.Nm +.Oo Cm set Ar N Oc Cm table +.Brq Ar name | all +.Cm flush .Ss DUMMYNET CONFIGURATION (TRAFFIC SHAPER AND PACKET SCHEDULER) .Nm .Brq Cm pipe | queue | sched @@ -87,6 +113,13 @@ in-kernel NAT. .Oc .Oc .Ar pathname +.Ss INTERNAL DIAGNOSTICS +.Nm +.Cm internal iflist +.Nm +.Cm internal talist +.Nm +.Cm internal vlist .Sh DESCRIPTION The .Nm @@ -822,10 +855,11 @@ It is possible to use the .Cm tablearg keyword with a skipto for a .Em computed -skipto, but care should be used, as no destination caching -is possible in this case so the rules are always walked to find it, -starting from the -.Cm skipto . +skipto. Skipto may work either in O(log(N)) or in O(1) depending +on amount of memory and/or sysctl variables. +See the +.Sx SYSCTL VARIABLES +section for more details. .It Cm call Ar number | tablearg The current rule number is saved in the internal stack and ruleset processing continues with the first rule numbered @@ -1152,7 +1186,7 @@ with multiple addresses) is provided for its use is discouraged. .It Ar addr : Oo Cm not Oc Bro .Cm any | me | me6 | -.Cm table Ns Pq Ar number Ns Op , Ns Ar value +.Cm table Ns Pq Ar name Ns Op , Ns Ar value .Ar | addr-list | addr-set .Brc .Bl -tag -width indent @@ -1164,8 +1198,8 @@ matches any IP address configured on an matches any IPv6 address configured on an interface in the system. The address list is evaluated at the time the packet is analysed. -.It Cm table Ns Pq Ar number Ns Op , Ns Ar value -Matches any IPv4 address for which an entry exists in the lookup table +.It Cm table Ns Pq Ar name Ns Op , Ns Ar value +Matches any IPv4 or IPv6 address for which an entry exists in the lookup table .Ar number . If an optional 32-bit unsigned .Ar value @@ -1359,6 +1393,19 @@ and IPsec encapsulated security payload .It Cm fib Ar fibnum Matches a packet that has been tagged to use the given FIB (routing table) number. +.It Cm flow Ar table Ns Pq Ar name Ns Op , Ns Ar value +Search for the flow entry in lookup table +.Ar name . +If not found, the match fails. +Otherwise, the match succeeds and +.Cm tablearg +is set to the value extracted from the table. +.Pp +This option can be useful to quickly dispatch traffic based on +certain packet fields. +See the +.Sx LOOKUP TABLES +section below for more information on lookup tables. .It Cm flow-id Ar labels Matches IPv6 packets containing any of the flow labels given in .Ar labels . @@ -1550,9 +1597,9 @@ of source and destination addresses and specified. Currently, only IPv4 flows are supported. -.It Cm lookup Bro Cm dst-ip | dst-port | src-ip | src-port | uid | jail Brc Ar N +.It Cm lookup Bro Cm dst-ip | dst-port | src-ip | src-port | uid | jail Brc Ar name Search an entry in lookup table -.Ar N +.Ar name that matches the field specified as argument. If not found, the match fails. Otherwise, the match succeeds and @@ -1616,13 +1663,19 @@ and they are always printed as hexadecim option is used, in which case symbolic resolution will be attempted). .It Cm proto Ar protocol Matches packets with the corresponding IP protocol. -.It Cm recv | xmit | via Brq Ar ifX | Ar if Ns Cm * | Ar table Ns Pq Ar number Ns Op , Ns Ar value | Ar ipno | Ar any +.It Cm recv | xmit | via Brq Ar ifX | Ar if Ns Cm * | Ar table Ns Po Ar name Ns Oo , Ns Ar value Oc Pc | Ar ipno | Ar any Matches packets received, transmitted or going through, respectively, the interface specified by exact name .Po Ar ifX Pc , by device name .Po Ar if* Pc , by IP address, or through some interface. +Table +.Ar name +may be used to match interface by its kernel ifindex. +See the +.Sx LOOKUP TABLES +section below for more information on lookup tables. .Pp The .Cm via @@ -1817,15 +1870,35 @@ connected networks instead of all source .Sh LOOKUP TABLES Lookup tables are useful to handle large sparse sets of addresses or other search keys (e.g., ports, jail IDs, interface names). -In the rest of this section we will use the term ``address''. -There may be up to 65535 different lookup tables, numbered 0 to 65534. +In the rest of this section we will use the term ``key''. +Table name needs to match the following spec: +.Ar table-name . +Tables with the same name can be created in different +.Ar sets . +However, rule links to the tables in +.Ar set 0 +by default. +This behavior can be controlled by +.Va net.inet.ip.fw.tables_sets +variable. +See the +.Sx SETS OF RULES +section for more information. +There may be up to 65535 different lookup tables. .Pp +The following table types are supported: +.Bl -tag -width indent +.It Ar table-type : Ar addr | iface | number | flow +.It Ar table-key : Ar addr Ns Oo / Ns Ar masklen Oc | iface-name | number | flow-spec +.It Ar flow-spec : Ar flow-field Ns Op , Ns Ar flow-spec +.It Ar flow-field : src-ip | proto | src-port | dst-ip | dst-port +.It Cm addr +matches IPv4 or IPv6 address. Each entry is represented by an .Ar addr Ns Op / Ns Ar masklen and will match all addresses with base .Ar addr -(specified as an IPv4/IPv6 address, a hostname or an unsigned integer) -and mask width of +(specified as an IPv4/IPv6 address, or a hostname) and mask width of .Ar masklen bits. If @@ -1833,29 +1906,140 @@ If is not specified, it defaults to 32 for IPv4 and 128 for IPv6. When looking up an IP address in a table, the most specific entry will match. -Associated with each entry is a 32-bit unsigned -.Ar value , -which can optionally be checked by a rule matching code. -When adding an entry, if -.Ar value -is not specified, it defaults to 0. +.It Cm iface +matches interface names. +Each entry is represented by string treated as interface name. +Wildcards are not supported. +.It Cm number +maches protocol ports, uids/gids or jail IDs. +Each entry is represented by 32-bit unsigned integer. +Ranges are not supported. +.It Cm flow +Matches packet fields specified by +.Ar flow +type suboptions with table entries. +.El +.Pp +Tables require explicit creation via +.Cm create +before use. .Pp -An entry can be added to a table -.Pq Cm add , -or removed from a table -.Pq Cm delete . -A table can be examined -.Pq Cm list -or flushed -.Pq Cm flush . +The following creation options are supported: +.Bl -tag -width indent +.It Ar create-options : Ar create-option | create-options +.It Ar create-option : Cm type Ar table-type | Cm valtype Ar value-mask | Cm algo Ar algo-desc | +.Cm limit Ar number | Cm locked +.It Cm type +Table key type. +.It Cm valtype +Table value mask. +.It Cm algo +Table algorithm to use (see below). +.It Cm limit +Maximum number of items that may be inserted into table. +.It Cm locked +Restrict any table modifications. +.El .Pp -Internally, each table is stored in a Radix tree, the same way as -the routing table (see -.Xr route 4 ) . +Some of these options may be modified later via +.Cm modify +keyword. +The following options can be changed: +.Bl -tag -width indent +.It Ar modify-options : Ar modify-option | modify-options +.It Ar modify-option : Cm limit Ar number +.It Cm limit +Alter maximum number of items that may be inserted into table. +.El .Pp -Lookup tables currently support only ports, jail IDs, IPv4/IPv6 addresses -and interface names. -Wildcards is not supported for interface names. +Additionally, table can be locked or unlocked using +.Cm lock +or +.Cm unlock +commands. +.Pp +Tables of the same +.Ar type +can be swapped with each other using +.Cm swap Ar name +command. +Swap may fail if tables limits are set and data exchange +would result in limits hit. +Operation is performed atomically. +.Pp +One or more entries can be added to a table at once using +.Cm add +command. +Addition of all items are performed atomically. +By default, error in addition of one entry does not influence +addition of other entries. However, non-zero error code is returned +in that case. +Special +.Cm atomic +keyword may be specified before +.Cm add +to indicate all-or-none add request. +.Pp +One or more entries can be removed from a table at once using +.Cm delete +command. +By default, error in removal of one entry does not influence +removing of other entries. However, non-zero error code is returned +in that case. +.Pp +It may be possible to check what entry will be found on particular +.Ar table-key +using +.Cm lookup +.Ae table-key +command. +This functionality is optional and may be unsupported in some algorithms. +.Pp +The following operations can be performed on +.Ar one +or +.Cm all +tables: +.Bl -tag -width indent +.It Cm list +List all entries. +.It Cm flush +Removes all entries. +.It Cm info +Shows generic table information. +.It Cm detail +Shows generic table information and algo-specific data. +.El +.Pp +The following lookup algorithms are supported: +.Bl -tag -width indent +.It Ar algo-desc : algo-name | "algo-name algo-data" +.It Ar algo-name: Ar addr:radix | addr:hash | iface:arrray | number:array | flow:hash +.It Cm addr:radix +Separate Radix trees for IPv4 and IPv6, the same way as the routing table (see +.Xr route 4 ) . +Default choice for +.Ar addr +type. +.It Cm addr:hash +Separate auto-growing hashes for IPv4 and IPv6. +Accepts entries with the same mask length specified initially via +.Cm "addr:hash masks=/v4,/v6" +algorithm creation options. +Assume /32 and /128 masks by default. +Search removes host bits (according to mask) from supplied address and checks +resulting key in appropriate hash. +Mostly optimized for /64 and byte-ranged IPv6 masks. +.It Cm iface:arrray +Array storing sorted indexes for entries which are presented in the system. +Optimized for very fast lookup. +.It Cm number:array +Array storing sorted u32 numbers. +.It Cm flow:hash +Auto-growing hash storing flow entries. +Search calculates hash on required packet fields and searches for matching +entries in selected bucket. +.El .Pp The .Cm tablearg @@ -1864,6 +2048,39 @@ the argument for a rule action, action p This can significantly reduce number of rules in some configurations. If two tables are used in a rule, the result of the second (destination) is used. +.Pp +Each record may hold one or more values according to +.Ar value-mask . +This mask is set on table creation via +.Cm valtype +option. +The following value types are supported: +.Bl -tag -width indent +.It Ar value-mask : Ar value-type Ns Op , Ns Ar value-mask +.It Ar value-type : Ar skipto | pipe | fib | nat | dscp | tag | divert | +.Ar netgraph | limit | ipv4 +.It Cm skipto +rule number to jump to. +.It Cm pipe +Pipe number to use. +.It Cm fib +fib number to match/set. +.It Cm nat +nat number to jump to. +.It Cm dscp +dscp value to match/set. +.It Cm tag +tag number to match/set. +.It Cm divert +port number to divert traffic to. +.It Cm netgraph +hook number to move packet to. +.It Cm limit +maximum number of connections. +.It Cm ipv4 +IPv4 nexthop to fwd packets to. +.El +.Pp The .Cm tablearg argument can be used with the following actions: @@ -1873,32 +2090,34 @@ action parameters: rule options: .Cm limit, tagged. .Pp -When used with -.Cm fwd -it is possible to supply table entries with values -that are in the form of IP addresses or hostnames. -See the -.Sx EXAMPLES -Section for example usage of tables and the tablearg keyword. -.Pp When used with the .Cm skipto action, the user should be aware that the code will walk the ruleset -up to a rule equal to, or past, the given number, -and should therefore try keep the -ruleset compact between the skipto and the target rules. +up to a rule equal to, or past, the given number. +.Pp +See the +.Sx EXAMPLES +Section for example usage of tables and the tablearg keyword. .Sh SETS OF RULES -Each rule belongs to one of 32 different +Each rule or table belongs to one of 32 different .Em sets , numbered 0 to 31. Set 31 is reserved for the default rule. .Pp -By default, rules are put in set 0, unless you use the +By default, rules or tables are put in set 0, unless you use the .Cm set N -attribute when entering a new rule. +attribute when adding a new rule or table. Sets can be individually and atomically enabled or disabled, so this mechanism permits an easy way to store multiple configurations of the firewall and quickly (and atomically) switch between them. +.Pp +By default, tables from set 0 are referenced when adding rule with +table opcodes regardless of rule set. +This behavior can be changed by setting +.Va net.inet.ip.fw.tables_set +variable to 1. +Rule's set will then be used for table references. +.Pp The command to enable/disable sets is .Bd -ragged -offset indent .Nm @@ -2968,6 +3187,22 @@ Controls whether bridged packets are pas .Nm . Default is no. .El +.Sh INTERNAL DIAGNOSTICS +There are some commands that may be useful to understand current state +of certain subsystems inside kernel module. +These commands provide debugging output which may change without notice. +.Pp +Currently the following commands are available as +.Cm internal +sub-options: +.Bl -tag -width indent +.It Cm iflist +Lists all interface which are currently tracked by +.Nm +with their in-kernel status. +.It Cm talist +List all table lookup algorithms currently available. +.El .Sh EXAMPLES There are far too many possible uses of .Nm @@ -3220,30 +3455,43 @@ Then we classify traffic using a single .Dl "ipfw pipe 1 config bw 1000Kbyte/s" .Dl "ipfw pipe 4 config bw 4000Kbyte/s" .Dl "..." -.Dl "ipfw table 1 add 192.168.2.0/24 1" -.Dl "ipfw table 1 add 192.168.0.0/27 4" -.Dl "ipfw table 1 add 192.168.0.2 1" +.Dl "ipfw table T1 create type addr" +.Dl "ipfw table T1 add 192.168.2.0/24 1" +.Dl "ipfw table T1 add 192.168.0.0/27 4" +.Dl "ipfw table T1 add 192.168.0.2 1" .Dl "..." -.Dl "ipfw add pipe tablearg ip from table(1) to any" +.Dl "ipfw add pipe tablearg ip from 'table(T1)' to any" .Pp Using the .Cm fwd action, the table entries may include hostnames and IP addresses. .Pp -.Dl "ipfw table 1 add 192.168.2.0/24 10.23.2.1" -.Dl "ipfw table 1 add 192.168.0.0/27 router1.dmz" +.Dl "ipfw table T2 create type addr ftype ip" +.Dl "ipfw table T2 add 192.168.2.0/24 10.23.2.1" +.Dl "ipfw table T21 add 192.168.0.0/27 router1.dmz" .Dl "..." .Dl "ipfw add 100 fwd tablearg ip from any to table(1)" .Pp In the following example per-interface firewall is created: .Pp -.Dl "ipfw table 10 add vlan20 12000" -.Dl "ipfw table 10 add vlan30 13000" -.Dl "ipfw table 20 add vlan20 22000" -.Dl "ipfw table 20 add vlan30 23000" +.Dl "ipfw table IN create type iface valtype skipto,fib" +.Dl "ipfw table IN add vlan20 12000,12" +.Dl "ipfw table IN add vlan30 13000,13" +.Dl "ipfw table OUT create type iface valtype skipto" +.Dl "ipfw table OUT add vlan20 22000" +.Dl "ipfw table OUT add vlan30 23000" +.Dl ".." +.Dl "ipfw add 100 ipfw setfib tablearg ip from any to any recv 'table(IN)' in" +.Dl "ipfw add 200 ipfw skipto tablearg ip from any to any recv 'table(IN)' in" +.Dl "ipfw add 300 ipfw skipto tablearg ip from any to any xmit 'table(OUT)' out" +.Pp +The following example illustrate usage of flow tables: +.Pp +.Dl "ipfw table fl create type flow:flow:src-ip,proto,dst-ip,dst-port" +.Dl "ipfw table fl add 2a02:6b8:77::88,tcp,2a02:6b8:77::99,80 11" +.Dl "ipfw table fl add 10.0.0.1,udp,10.0.0.2,53 12" .Dl ".." -.Dl "ipfw add 100 ipfw skipto tablearg ip from any to any recv 'table(10)' in" -.Dl "ipfw add 200 ipfw skipto tablearg ip from any to any xmit 'table(10)' out" +.Dl "ipfw add 100 allow ip from any to any flow 'table(fl,11)' recv ix0" .Ss SETS OF RULES To add a set of rules atomically, e.g.\& set 18: .Pp Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Thu Oct 9 19:13:33 2014 (r272839) +++ head/sbin/ipfw/ipfw2.c Thu Oct 9 19:32:35 2014 (r272840) @@ -66,22 +66,13 @@ struct format_opts { uint32_t first; /* first rule to request */ uint32_t last; /* last rule to request */ uint32_t dcnt; /* number of dynamic states */ + ipfw_obj_ctlv *tstate; /* table state data */ }; -#define IP_FW_TARG IP_FW_TABLEARG -#define ip_fw_bcounter ip_fw -#define ip_fw_rule ip_fw -struct tidx; int resvd_set_number = RESVD_SET; int ipfw_socket = -1; -uint32_t ipfw_tables_max = 0; /* Number of tables supported by kernel */ - -#ifndef s6_addr32 -#define s6_addr32 __u6_addr.__u6_addr32 -#endif - #define CHECK_LENGTH(v, len) do { \ if ((v) < (len)) \ errx(EX_DATAERR, "Rule too long"); \ @@ -362,6 +353,7 @@ static struct _s_x rule_options[] = { { "src-ipv6", TOK_SRCIP6}, { "src-ip6", TOK_SRCIP6}, { "lookup", TOK_LOOKUP}, + { "flow", TOK_FLOW}, { "//", TOK_COMMENT }, { "not", TOK_NOT }, /* pseudo option */ @@ -376,6 +368,11 @@ static struct _s_x rule_options[] = { }; void bprint_uint_arg(struct buf_pr *bp, const char *str, uint32_t arg); +static int ipfw_get_config(struct cmdline_opts *co, struct format_opts *fo, + ipfw_cfg_lheader **pcfg, size_t *psize); +static int ipfw_show_config(struct cmdline_opts *co, struct format_opts *fo, + ipfw_cfg_lheader *cfg, size_t sz, int ac, char **av); +static void ipfw_list_tifaces(void); /* * Simple string buffer API. @@ -514,6 +511,26 @@ safe_realloc(void *ptr, size_t size) } /* + * Compare things like interface or table names. + */ +int +stringnum_cmp(const char *a, const char *b) +{ + int la, lb; + + la = strlen(a); + lb = strlen(b); + + if (la > lb) + return (1); + else if (la < lb) + return (-01); + + return (strcmp(a, b)); +} + + +/* * conditionally runs the command. * Selected options or negative -> getsockopt */ @@ -546,20 +563,18 @@ do_cmd(int optname, void *optval, uintpt } /* - * do_setcmd3 - pass ipfw control cmd to kernel + * do_set3 - pass ipfw control cmd to kernel * @optname: option name * @optval: pointer to option data * @optlen: option length * - * Function encapsulates option value in IP_FW3 socket option - * and calls setsockopt(). - * Function returns 0 on success or -1 otherwise. + * Assumes op3 header is already embedded. + * Calls setsockopt() with IP_FW3 as kernel-visible opcode. + * Returns 0 on success or errno otherwise. */ -static int -do_setcmd3(int optname, void *optval, socklen_t optlen) +int +do_set3(int optname, ip_fw3_opheader *op3, uintptr_t optlen) { - socklen_t len; - ip_fw3_opheader *op3; if (co.test_only) return (0); @@ -569,14 +584,40 @@ do_setcmd3(int optname, void *optval, so if (ipfw_socket < 0) err(EX_UNAVAILABLE, "socket"); - len = sizeof(ip_fw3_opheader) + optlen; - op3 = alloca(len); - /* Zero reserved fields */ - memset(op3, 0, sizeof(ip_fw3_opheader)); - memcpy(op3 + 1, optval, optlen); op3->opcode = optname; - return setsockopt(ipfw_socket, IPPROTO_IP, IP_FW3, op3, len); + return (setsockopt(ipfw_socket, IPPROTO_IP, IP_FW3, op3, optlen)); +} + +/* + * do_get3 - pass ipfw control cmd to kernel + * @optname: option name + * @optval: pointer to option data + * @optlen: pointer to option length + * + * Assumes op3 header is already embedded. + * Calls getsockopt() with IP_FW3 as kernel-visible opcode. + * Returns 0 on success or errno otherwise. + */ +int +do_get3(int optname, ip_fw3_opheader *op3, size_t *optlen) +{ + int error; + + if (co.test_only) + return (0); + + if (ipfw_socket == -1) + ipfw_socket = socket(AF_INET, SOCK_RAW, IPPROTO_RAW); + if (ipfw_socket < 0) + err(EX_UNAVAILABLE, "socket"); + + op3->opcode = optname; + + error = getsockopt(ipfw_socket, IPPROTO_IP, IP_FW3, op3, + (socklen_t *)optlen); + + return (error); } /** @@ -596,6 +637,37 @@ match_token(struct _s_x *table, char *st } /** + * match_token takes a table and a string, returns the value associated + * with the string for the best match. + * + * Returns: + * value from @table for matched records + * -1 for non-matched records + * -2 if more than one records match @string. + */ +int +match_token_relaxed(struct _s_x *table, char *string) +{ + struct _s_x *pt, *m; + int i, c; + + i = strlen(string); + c = 0; + + for (pt = table ; i != 0 && pt->s != NULL ; pt++) { + if (strncmp(pt->s, string, i) != 0) + continue; + m = pt; + c++; + } + + if (c == 1) + return (m->x); + + return (c > 0 ? -2: -1); +} + +/** * match_value takes a table and a value, returns the string associated * with the value (NULL in case of failure). */ @@ -608,16 +680,36 @@ match_value(struct _s_x *p, int value) return NULL; } +size_t +concat_tokens(char *buf, size_t bufsize, struct _s_x *table, char *delimiter) +{ + struct _s_x *pt; + int l; + size_t sz; + + for (sz = 0, pt = table ; pt->s != NULL; pt++) { + l = snprintf(buf + sz, bufsize - sz, "%s%s", + (sz == 0) ? "" : delimiter, pt->s); + sz += l; + bufsize += l; + if (sz > bufsize) + return (bufsize); + } + + return (sz); +} + /* * helper function to process a set of flags and set bits in the * appropriate masks. */ -void -fill_flags(struct _s_x *flags, char *p, uint8_t *set, uint8_t *clear) +int +fill_flags(struct _s_x *flags, char *p, char **e, uint32_t *set, + uint32_t *clear) { char *q; /* points to the separator */ int val; - uint8_t *which; /* mask we are working on */ + uint32_t *which; /* mask we are working on */ while (p && *p) { if (*p == '!') { @@ -629,11 +721,35 @@ fill_flags(struct _s_x *flags, char *p, if (q) *q++ = '\0'; val = match_token(flags, p); - if (val <= 0) - errx(EX_DATAERR, "invalid flag %s", p); - *which |= (uint8_t)val; + if (val <= 0) { + if (e != NULL) + *e = p; + return (-1); + } + *which |= (uint32_t)val; p = q; } + return (0); +} + +void +print_flags_buffer(char *buf, size_t sz, struct _s_x *list, uint32_t set) +{ + char const *comma = ""; + int i, l; + + for (i = 0; list[i].x != 0; i++) { + if ((set & list[i].x) == 0) + continue; + + set &= ~list[i].x; + l = snprintf(buf, sz, "%s%s", comma, list[i].s); + if (l >= sz) + return; + comma = ","; + buf += l; + sz -=l; + } } /* @@ -1018,6 +1134,7 @@ print_flags(struct buf_pr *bp, char cons } } + /* * Print the ip address contained in a command. */ @@ -1029,6 +1146,7 @@ print_ip(struct buf_pr *bp, struct forma struct in_addr *ia; uint32_t len = F_LEN((ipfw_insn *)cmd); uint32_t *a = ((ipfw_insn_u32 *)cmd)->d; + char *t; if (cmd->o.opcode == O_IP_DST_LOOKUP && len > F_INSN_SIZE(ipfw_insn_u32)) { uint32_t d = a[1]; @@ -1036,8 +1154,9 @@ print_ip(struct buf_pr *bp, struct forma if (d < sizeof(lookup_key)/sizeof(lookup_key[0])) arg = match_value(rule_options, lookup_key[d]); - bprintf(bp, "%s lookup %s %d", cmd->o.len & F_NOT ? " not": "", - arg, cmd->o.arg1); + t = table_search_ctlv(fo->tstate, ((ipfw_insn *)cmd)->arg1); + bprintf(bp, "%s lookup %s %s", cmd->o.len & F_NOT ? " not": "", + arg, t); return; } bprintf(bp, "%s%s ", cmd->o.len & F_NOT ? " not": "", s); @@ -1048,7 +1167,8 @@ print_ip(struct buf_pr *bp, struct forma } if (cmd->o.opcode == O_IP_SRC_LOOKUP || cmd->o.opcode == O_IP_DST_LOOKUP) { - bprintf(bp, "table(%u", ((ipfw_insn *)cmd)->arg1); + t = table_search_ctlv(fo->tstate, ((ipfw_insn *)cmd)->arg1); + bprintf(bp, "table(%s", t); if (len == F_INSN_SIZE(ipfw_insn_u32)) bprintf(bp, ",%u", *a); bprintf(bp, ")"); @@ -1262,12 +1382,9 @@ show_static_rule(struct cmdline_opts *co ipfw_insn_log *logptr = NULL; /* set if we find an O_LOG */ ipfw_insn_altq *altqptr = NULL; /* set if we find an O_ALTQ */ int or_block = 0; /* we are in an or block */ - uint32_t set_disable; uint32_t uval; - bcopy(&rule->next_rule, &set_disable, sizeof(set_disable)); - - if (set_disable & (1 << rule->set)) { + if ((fo->set_mask & (1 << rule->set)) == 0) { /* disabled mask */ if (!co->show_sets) return; @@ -1504,7 +1621,7 @@ show_static_rule(struct cmdline_opts *co break; } } - if (rule->_pad & 1) { /* empty rules before options */ + if (rule->flags & IPFW_RULE_NOOPT) { /* empty rules before options */ if (!co->do_compact) { show_prerequisites(bp, &flags, HAVE_PROTO, 0); bprintf(bp, " from any to any"); @@ -1707,7 +1824,7 @@ show_static_rule(struct cmdline_opts *co case O_RECV: case O_VIA: { - char const *s; + char const *s, *t; ipfw_insn_if *cmdif = (ipfw_insn_if *)cmd; if (cmd->opcode == O_XMIT) @@ -1719,10 +1836,26 @@ show_static_rule(struct cmdline_opts *co if (cmdif->name[0] == '\0') bprintf(bp, " %s %s", s, inet_ntoa(cmdif->p.ip)); - else if (cmdif->name[0] == '\1') /* interface table */ - bprintf(bp, " %s table(%d)", s, cmdif->p.glob); - else + else if (cmdif->name[0] == '\1') { + /* interface table */ + t = table_search_ctlv(fo->tstate, + cmdif->p.kidx); + bprintf(bp, " %s table(%s)", s, t); + } else bprintf(bp, " %s %s", s, cmdif->name); + + break; + } + case O_IP_FLOW_LOOKUP: + { + char *t; + + t = table_search_ctlv(fo->tstate, cmd->arg1); + bprintf(bp, " flow table(%s", t); + if (F_LEN(cmd) == F_INSN_SIZE(ipfw_insn_u32)) + bprintf(bp, ",%u", + ((ipfw_insn_u32 *)cmd)->d[0]); + bprintf(bp, ")"); break; } case O_IPID: @@ -1974,6 +2107,19 @@ show_dyn_state(struct cmdline_opts *co, bprintf(bp, " UNKNOWN <-> UNKNOWN\n"); } +static int +do_range_cmd(int cmd, ipfw_range_tlv *rt) +{ + ipfw_range_header rh; + + memset(&rh, 0, sizeof(rh)); + memcpy(&rh.range, rt, sizeof(*rt)); + rh.range.head.length = sizeof(*rt); + rh.range.head.type = IPFW_TLV_RANGE; + + return (do_set3(cmd, &rh.opheader, sizeof(rh))); +} + /* * This one handles all set-related commands * ipfw set { show | enable | disable } @@ -1984,77 +2130,75 @@ show_dyn_state(struct cmdline_opts *co, void ipfw_sets_handler(char *av[]) { - uint32_t set_disable, masks[2]; - int i, nbytes; - uint16_t rulenum; - uint8_t cmd, new_set; + uint32_t masks[2]; + int i; + uint8_t cmd, new_set, rulenum; + ipfw_range_tlv rt; + char *msg; + size_t size; av++; + memset(&rt, 0, sizeof(rt)); if (av[0] == NULL) errx(EX_USAGE, "set needs command"); if (_substrcmp(*av, "show") == 0) { - void *data = NULL; - char const *msg; - int nalloc; - - nalloc = nbytes = sizeof(struct ip_fw); - while (nbytes >= nalloc) { - if (data) - free(data); - nalloc = nalloc * 2 + 200; - nbytes = nalloc; - data = safe_calloc(1, nbytes); - if (do_cmd(IP_FW_GET, data, (uintptr_t)&nbytes) < 0) - err(EX_OSERR, "getsockopt(IP_FW_GET)"); - } + struct format_opts fo; + ipfw_cfg_lheader *cfg; - bcopy(&((struct ip_fw *)data)->next_rule, - &set_disable, sizeof(set_disable)); + memset(&fo, 0, sizeof(fo)); + if (ipfw_get_config(&co, &fo, &cfg, &size) != 0) + err(EX_OSERR, "requesting config failed"); - for (i = 0, msg = "disable" ; i < RESVD_SET; i++) - if ((set_disable & (1<set_mask & (1<set_mask != (uint32_t)-1) ? " enable" : "enable"; for (i = 0; i < RESVD_SET; i++) - if (!(set_disable & (1<set_mask & (1< RESVD_SET) + rt.set = atoi(av[0]); + rt.new_set = atoi(av[1]); + if (!isdigit(*(av[0])) || rt.set > RESVD_SET) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 19:40:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 81C9B908; Thu, 9 Oct 2014 19:40:18 +0000 (UTC) Received: from mail-wi0-x236.google.com (mail-wi0-x236.google.com [IPv6:2a00:1450:400c:c05::236]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A5E85F26; Thu, 9 Oct 2014 19:40:17 +0000 (UTC) Received: by mail-wi0-f182.google.com with SMTP id n3so2865243wiv.15 for ; Thu, 09 Oct 2014 12:40:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=gqWzbpLv0ZAOXcUMKb8ISb+4xTYcvvw8HHucxv8VGUE=; b=iZ2ENz9O7ewXBvxMOfgrfSwpr8T6tThitvNpRAbzuhBmE2Doq+Wfr2g/2qzxUJt06Q uFRMy1q6iInlh2rQ/KYYEfAxKpsywSLUX0FTAwFOdaZdSdcguR7XZgksSPHR8eo4v7a+ m8PaRTA7y++vle5/gPPaSVQigDh/+LbS9xIgSSpapR3boIxD0VUczcjk/zJKS9fHFSSP Sggf9igZ1mOPnIVncMVTW7EVMAxPigqyKrZ6pAQ3x7I7+quZ5Dzz67u/gil+hHARlhR9 BjZa3Vrb53sx1nFGQUP37WjOc35Vcwh0FGbbyBVP1WTJJjHwT1OsbMzz8GOF5FVii1xd yv/w== MIME-Version: 1.0 X-Received: by 10.180.9.73 with SMTP id x9mr287751wia.20.1412883615902; Thu, 09 Oct 2014 12:40:15 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.216.106.136 with HTTP; Thu, 9 Oct 2014 12:40:15 -0700 (PDT) In-Reply-To: <20141009182310.GL2153@kib.kiev.ua> References: <201410090534.s995YTUx057314@svn.freebsd.org> <20141009182310.GL2153@kib.kiev.ua> Date: Thu, 9 Oct 2014 12:40:15 -0700 X-Google-Sender-Auth: hHZWZT4NoYgjIa_nON-KqsITkgg Message-ID: Subject: Re: svn commit: r272800 - head/sys/x86/acpica From: Adrian Chadd To: Konstantin Belousov , "freebsd-arch@freebsd.org" Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 19:40:18 -0000 On 9 October 2014 11:23, Konstantin Belousov wrote: > I do not like it. Sorry for not looking at the web thing, I have very > little time. > > It never was an intention that one proximity domain reported by ACPI > was mapped to single VM domain. VM could split domains (in terms of > vm_domains) further for other reasons. Main motivation is that there > is 1:1 relations between domain/page queues/page queues locks/pagedaemons. > > I have patches in WIP stage which split firmware proximity domains > further, to decrease congestion on the page queue locks. I wrote about > this in the pgsql performance report. > > The short version is that there is/will be N:1 relation between VM domains > and proximity domains (which is reported by ACPI for devices). Hi, Well, we'll have to come up with an alternate design for all of this then. If we're going to actively define VM domains to be more than 1:1 VM domain to proximity domain then we're going to have to introduce proximity domains as a separate construct to the VM/NUMA system. (This is all fallout from this stuff not really being well defined and multiple people having differing ideas of what things may mean.) So let's flesh out what that's going to look like so we can mutate this interface and the general NUMA side of things into something that's useful. It may be enough to store the PXM map (renumbered to origin from 0 and be non-sparse) and then have a different mapping from PXM to VM domain. -a From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 19:43:30 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8AEE8B35; Thu, 9 Oct 2014 19:43:30 +0000 (UTC) Received: from mail-pa0-x22d.google.com (mail-pa0-x22d.google.com [IPv6:2607:f8b0:400e:c03::22d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4E542FD6; Thu, 9 Oct 2014 19:43:30 +0000 (UTC) Received: by mail-pa0-f45.google.com with SMTP id rd3so323555pab.4 for ; Thu, 09 Oct 2014 12:43:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:mime-version:in-reply-to:content-type :content-transfer-encoding:message-id:cc:from:subject:date:to; bh=iQp1oyFcG0x7LWndRfKAYKRyf9mqzPzZfpwjwfzwmfg=; b=yxclcm97BY/n9229htQKywUAkWZDrapmiVb08Cn+S4cB54CcgZNKmvXYNLd5je7T/w JejWoplY5EkvVggG+2ptVZjnXomFt6x0E+Xbvv85KcuqZYxUnAYqYPxzVoyzBLekh+nQ t8R662/2uNnOALguEU7RF1vD667l4wcz9m93RVyGsPGj0GJ6+acLv5wIq/I0iKMwPSTa jTgEyZbcCa+5dG+kSL7XUoQdx1nSG/g4nZdGITWHVEQHyjQIYnRuK6ie7t7FYCjm/HIr LUM6DU62t6LsbAsI3uVQRVDs+/UTzenNZhzftPNVngVa8GG6htwkoHDhBpVTKqWJbS6F pJFA== X-Received: by 10.68.129.138 with SMTP id nw10mr98556pbb.143.1412883809877; Thu, 09 Oct 2014 12:43:29 -0700 (PDT) Received: from [10.61.9.12] (mobile-166-137-212-101.mycingular.net. [166.137.212.101]) by mx.google.com with ESMTPSA id uc7sm1338362pbc.10.2014.10.09.12.43.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 09 Oct 2014 12:43:28 -0700 (PDT) References: <201410091932.s99JWaSc065624@svn.freebsd.org> Mime-Version: 1.0 (1.0) In-Reply-To: <201410091932.s99JWaSc065624@svn.freebsd.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: <9BFD4761-FD58-4933-A1A1-31E77E440835@gmail.com> X-Mailer: iPhone Mail (11D257) From: Garrett Cooper Subject: Re: svn commit: r272840 - in head: sbin/ipfw sys/conf sys/modules/ipfw sys/netgraph sys/netinet sys/netpfil/ipfw Date: Thu, 9 Oct 2014 12:43:24 -0700 To: "Alexander V. Chernikov" Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 19:43:30 -0000 > On Oct 9, 2014, at 12:32, "Alexander V. Chernikov" w= rote: >=20 > Author: melifaro > Date: Thu Oct 9 19:32:35 2014 > New Revision: 272840 > URL: https://svnweb.freebsd.org/changeset/base/272840 ... > MFC after: 1 month Should this be MFCed? Does it break existing usability? > Sponsored by: Yandex LLC Relnotes: YES= From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 20:08:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 738EEEB3; Thu, 9 Oct 2014 20:08:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 54F02256; Thu, 9 Oct 2014 20:08:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99K8Duu080513; Thu, 9 Oct 2014 20:08:13 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99K8CMv080510; Thu, 9 Oct 2014 20:08:12 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201410092008.s99K8CMv080510@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 9 Oct 2014 20:08:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272841 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 20:08:13 -0000 Author: tuexen Date: Thu Oct 9 20:08:12 2014 New Revision: 272841 URL: https://svnweb.freebsd.org/changeset/base/272841 Log: Ensure that the flags field of sctp_tmit_chunks is initialized. Thanks to Peter Bostroem from Google for reporting the issue. MFC after: 3 days Modified: head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Thu Oct 9 19:32:35 2014 (r272840) +++ head/sys/netinet/sctp_input.c Thu Oct 9 20:08:12 2014 (r272841) @@ -4069,8 +4069,10 @@ __attribute__((noinline)) if (chk == NULL) { return (ret_code); } + chk->copy_by_ref = 0; chk->rec.chunk_id.id = SCTP_STREAM_RESET; chk->rec.chunk_id.can_take_data = 0; + chk->flags = 0; chk->asoc = &stcb->asoc; chk->no_fr_allowed = 0; chk->book_size = chk->send_size = sizeof(struct sctp_chunkhdr); Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Thu Oct 9 19:32:35 2014 (r272840) +++ head/sys/netinet/sctp_output.c Thu Oct 9 20:08:12 2014 (r272841) @@ -8925,16 +8925,11 @@ sctp_queue_op_err(struct sctp_tcb *stcb, return; } chk->send_size = 0; - mat = op_err; - while (mat != NULL) { + for (mat = op_err; mat != NULL; mat = SCTP_BUF_NEXT(mat)) { chk->send_size += SCTP_BUF_LEN(mat); - mat = SCTP_BUF_NEXT(mat); } - chk->rec.chunk_id.id = SCTP_OPERATION_ERROR; - chk->rec.chunk_id.can_take_data = 1; chk->sent = SCTP_DATAGRAM_UNSENT; chk->snd_count = 0; - chk->flags = 0; chk->asoc = &stcb->asoc; chk->data = op_err; chk->whoTo = NULL; @@ -9022,12 +9017,12 @@ sctp_send_cookie_echo(struct mbuf *m, return (-5); } chk->copy_by_ref = 0; - chk->send_size = plen; chk->rec.chunk_id.id = SCTP_COOKIE_ECHO; chk->rec.chunk_id.can_take_data = 0; + chk->flags = CHUNK_FLAGS_FRAGMENT_OK; + chk->send_size = plen; chk->sent = SCTP_DATAGRAM_UNSENT; chk->snd_count = 0; - chk->flags = CHUNK_FLAGS_FRAGMENT_OK; chk->asoc = &stcb->asoc; chk->data = cookie; chk->whoTo = net; @@ -9090,12 +9085,12 @@ sctp_send_heartbeat_ack(struct sctp_tcb return; } chk->copy_by_ref = 0; - chk->send_size = chk_length; chk->rec.chunk_id.id = SCTP_HEARTBEAT_ACK; chk->rec.chunk_id.can_take_data = 1; + chk->flags = 0; + chk->send_size = chk_length; chk->sent = SCTP_DATAGRAM_UNSENT; chk->snd_count = 0; - chk->flags = 0; chk->asoc = &stcb->asoc; chk->data = outchain; chk->whoTo = net; @@ -9127,12 +9122,12 @@ sctp_send_cookie_ack(struct sctp_tcb *st return; } chk->copy_by_ref = 0; - chk->send_size = sizeof(struct sctp_chunkhdr); chk->rec.chunk_id.id = SCTP_COOKIE_ACK; chk->rec.chunk_id.can_take_data = 1; + chk->flags = 0; + chk->send_size = sizeof(struct sctp_chunkhdr); chk->sent = SCTP_DATAGRAM_UNSENT; chk->snd_count = 0; - chk->flags = 0; chk->asoc = &stcb->asoc; chk->data = cookie_ack; if (chk->asoc->last_control_chunk_from != NULL) { @@ -9173,9 +9168,10 @@ sctp_send_shutdown_ack(struct sctp_tcb * return; } chk->copy_by_ref = 0; - chk->send_size = sizeof(struct sctp_chunkhdr); chk->rec.chunk_id.id = SCTP_SHUTDOWN_ACK; chk->rec.chunk_id.can_take_data = 1; + chk->flags = 0; + chk->send_size = sizeof(struct sctp_chunkhdr); chk->sent = SCTP_DATAGRAM_UNSENT; chk->snd_count = 0; chk->flags = 0; @@ -9216,9 +9212,10 @@ sctp_send_shutdown(struct sctp_tcb *stcb return; } chk->copy_by_ref = 0; - chk->send_size = sizeof(struct sctp_shutdown_chunk); chk->rec.chunk_id.id = SCTP_SHUTDOWN; chk->rec.chunk_id.can_take_data = 1; + chk->flags = 0; + chk->send_size = sizeof(struct sctp_shutdown_chunk); chk->sent = SCTP_DATAGRAM_UNSENT; chk->snd_count = 0; chk->flags = 0; @@ -9269,13 +9266,13 @@ sctp_send_asconf(struct sctp_tcb *stcb, return; } chk->copy_by_ref = 0; - chk->data = m_asconf; - chk->send_size = len; chk->rec.chunk_id.id = SCTP_ASCONF; chk->rec.chunk_id.can_take_data = 0; + chk->flags = CHUNK_FLAGS_FRAGMENT_OK; + chk->data = m_asconf; + chk->send_size = len; chk->sent = SCTP_DATAGRAM_UNSENT; chk->snd_count = 0; - chk->flags = CHUNK_FLAGS_FRAGMENT_OK; chk->asoc = &stcb->asoc; chk->whoTo = net; if (chk->whoTo) { @@ -9364,7 +9361,9 @@ sctp_send_asconf_ack(struct sctp_tcb *st return; } chk->copy_by_ref = 0; - + chk->rec.chunk_id.id = SCTP_ASCONF_ACK; + chk->rec.chunk_id.can_take_data = 1; + chk->flags = CHUNK_FLAGS_FRAGMENT_OK; chk->whoTo = net; if (chk->whoTo) { atomic_add_int(&chk->whoTo->ref_count, 1); @@ -9373,11 +9372,8 @@ sctp_send_asconf_ack(struct sctp_tcb *st chk->send_size = 0; /* Get size */ chk->send_size = ack->len; - chk->rec.chunk_id.id = SCTP_ASCONF_ACK; - chk->rec.chunk_id.can_take_data = 1; chk->sent = SCTP_DATAGRAM_UNSENT; chk->snd_count = 0; - chk->flags |= CHUNK_FLAGS_FRAGMENT_OK; /* XXX */ chk->asoc = &stcb->asoc; TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next); @@ -10257,6 +10253,7 @@ send_forward_tsn(struct sctp_tcb *stcb, chk->copy_by_ref = 0; chk->rec.chunk_id.id = SCTP_FORWARD_CUM_TSN; chk->rec.chunk_id.can_take_data = 0; + chk->flags = 0; chk->asoc = asoc; chk->whoTo = NULL; chk->data = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_NOWAIT, 1, MT_DATA); @@ -10490,6 +10487,7 @@ sctp_send_sack(struct sctp_tcb *stcb, in /* Clear our pkt counts */ asoc->data_pkts_seen = 0; + a_chk->flags = 0; a_chk->asoc = asoc; a_chk->snd_count = 0; a_chk->send_size = 0; /* fill in later */ @@ -11267,6 +11265,7 @@ sctp_send_hb(struct sctp_tcb *stcb, stru chk->copy_by_ref = 0; chk->rec.chunk_id.id = SCTP_HEARTBEAT_REQUEST; chk->rec.chunk_id.can_take_data = 1; + chk->flags = 0; chk->asoc = &stcb->asoc; chk->send_size = sizeof(struct sctp_heartbeat_chunk); @@ -11368,10 +11367,11 @@ sctp_send_ecn_echo(struct sctp_tcb *stcb if (chk == NULL) { return; } - chk->copy_by_ref = 0; SCTP_STAT_INCR(sctps_queue_upd_ecne); + chk->copy_by_ref = 0; chk->rec.chunk_id.id = SCTP_ECN_ECHO; chk->rec.chunk_id.can_take_data = 0; + chk->flags = 0; chk->asoc = &stcb->asoc; chk->send_size = sizeof(struct sctp_ecne_chunk); chk->data = sctp_get_mbuf_for_msg(chk->send_size, 0, M_NOWAIT, 1, MT_HEADER); @@ -11431,6 +11431,9 @@ sctp_send_packet_dropped(struct sctp_tcb return; } chk->copy_by_ref = 0; + chk->rec.chunk_id.id = SCTP_PACKET_DROPPED; + chk->rec.chunk_id.can_take_data = 1; + chk->flags = 0; len -= iphlen; chk->send_size = len; /* Validate that we do not have an ABORT in here. */ @@ -11517,8 +11520,6 @@ jump_out: } else { chk->whoTo = NULL; } - chk->rec.chunk_id.id = SCTP_PACKET_DROPPED; - chk->rec.chunk_id.can_take_data = 1; drp->ch.chunk_type = SCTP_PACKET_DROPPED; drp->ch.chunk_length = htons(chk->send_size); spc = SCTP_SB_LIMIT_RCV(stcb->sctp_socket); @@ -11584,6 +11585,7 @@ sctp_send_cwr(struct sctp_tcb *stcb, str chk->copy_by_ref = 0; chk->rec.chunk_id.id = SCTP_ECN_CWR; chk->rec.chunk_id.can_take_data = 1; + chk->flags = 0; chk->asoc = &stcb->asoc; chk->send_size = sizeof(struct sctp_cwr_chunk); chk->data = sctp_get_mbuf_for_msg(chk->send_size, 0, M_NOWAIT, 1, MT_HEADER); @@ -11895,6 +11897,7 @@ sctp_send_str_reset_req(struct sctp_tcb chk->copy_by_ref = 0; chk->rec.chunk_id.id = SCTP_STREAM_RESET; chk->rec.chunk_id.can_take_data = 0; + chk->flags = 0; chk->asoc = &stcb->asoc; chk->book_size = sizeof(struct sctp_chunkhdr); chk->send_size = SCTP_SIZE32(chk->book_size); From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 20:39:19 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 77B445DE; Thu, 9 Oct 2014 20:39:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 640D67E7; Thu, 9 Oct 2014 20:39:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99KdJYa094739; Thu, 9 Oct 2014 20:39:19 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99KdJDD094738; Thu, 9 Oct 2014 20:39:19 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201410092039.s99KdJDD094738@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 9 Oct 2014 20:39:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272842 - head/libexec/rtld-elf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 20:39:19 -0000 Author: emaste Date: Thu Oct 9 20:39:18 2014 New Revision: 272842 URL: https://svnweb.freebsd.org/changeset/base/272842 Log: Always return pathname in dl_iterate_phdr's dlpi_name, as Linux does Linux LD_ITERATE_PHDR(3): The dlpi_name field is a null-terminated string giving the pathname from which the shared object was loaded. That functionality is much more useful than returning just the short name. Approved by: kan Sponsored by: The FreeBSD Foundation Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Thu Oct 9 20:08:12 2014 (r272841) +++ head/libexec/rtld-elf/rtld.c Thu Oct 9 20:39:18 2014 (r272842) @@ -3377,8 +3377,7 @@ rtld_fill_dl_phdr_info(const Obj_Entry * { phdr_info->dlpi_addr = (Elf_Addr)obj->relocbase; - phdr_info->dlpi_name = STAILQ_FIRST(&obj->names) ? - STAILQ_FIRST(&obj->names)->name : obj->path; + phdr_info->dlpi_name = obj->path; phdr_info->dlpi_phdr = obj->phdr; phdr_info->dlpi_phnum = obj->phsize / sizeof(obj->phdr[0]); phdr_info->dlpi_tls_modid = obj->tlsindex; From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 20:53:38 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AAC999E0; Thu, 9 Oct 2014 20:53:38 +0000 (UTC) Received: from mail.ipfw.ru (mail.ipfw.ru [IPv6:2a01:4f8:120:6141::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6AEC2990; Thu, 9 Oct 2014 20:53:38 +0000 (UTC) Received: from secured.by.ipfw.ru ([95.143.220.47] helo=[10.0.0.120]) by mail.ipfw.ru with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.82 (FreeBSD)) (envelope-from ) id 1XcGip-0002wU-2h; Thu, 09 Oct 2014 20:37:47 +0400 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r272840 - in head: sbin/ipfw sys/conf sys/modules/ipfw sys/netgraph sys/netinet sys/netpfil/ipfw From: "Alexander V. Chernikov" In-Reply-To: <9BFD4761-FD58-4933-A1A1-31E77E440835@gmail.com> Date: Fri, 10 Oct 2014 00:53:31 +0400 Content-Transfer-Encoding: quoted-printable Message-Id: <308FA9E9-0BC6-42CB-A85E-BD770EBD46DA@ipfw.ru> References: <201410091932.s99JWaSc065624@svn.freebsd.org> <9BFD4761-FD58-4933-A1A1-31E77E440835@gmail.com> To: Garrett Cooper X-Mailer: Apple Mail (2.1878.6) Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , "Alexander V. Chernikov" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 20:53:38 -0000 On 09 Oct 2014, at 23:43, Garrett Cooper wrote: >=20 >> On Oct 9, 2014, at 12:32, "Alexander V. Chernikov" = wrote: >>=20 >> Author: melifaro >> Date: Thu Oct 9 19:32:35 2014 >> New Revision: 272840 >> URL: https://svnweb.freebsd.org/changeset/base/272840 >=20 > ... >=20 >> MFC after: 1 month >=20 > Should this be MFCed? Does it break existing usability? Old ABI is kept, so old binaries can work as-is. There are _some_ output changes in new ipfw(8) binary, but this can/will = be altered for MFC. >=20 >> Sponsored by: Yandex LLC >=20 > Relnotes: YES From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 20:55:07 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 83C45B30; Thu, 9 Oct 2014 20:55:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 613E299E; Thu, 9 Oct 2014 20:55:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99Kt7kx003942; Thu, 9 Oct 2014 20:55:07 GMT (envelope-from pjd@FreeBSD.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99Kt6aH003930; Thu, 9 Oct 2014 20:55:06 GMT (envelope-from pjd@FreeBSD.org) Message-Id: <201410092055.s99Kt6aH003930@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pjd set sender to pjd@FreeBSD.org using -f From: Pawel Jakub Dawidek Date: Thu, 9 Oct 2014 20:55:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272843 - head/lib/libnv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 20:55:07 -0000 Author: pjd Date: Thu Oct 9 20:55:05 2014 New Revision: 272843 URL: https://svnweb.freebsd.org/changeset/base/272843 Log: Fix problem on big endian systems introduced in r271579 - when we were returning from handling a nested nvlist we were resetting big-endian flag. Reported by: Kuleshov Aleksey @ yandex.ru Tested by: Kuleshov Aleksey @ yandex.ru Modified: head/lib/libnv/nvlist.c head/lib/libnv/nvlist_impl.h head/lib/libnv/nvpair.c head/lib/libnv/nvpair_impl.h Modified: head/lib/libnv/nvlist.c ============================================================================== --- head/lib/libnv/nvlist.c Thu Oct 9 20:39:18 2014 (r272842) +++ head/lib/libnv/nvlist.c Thu Oct 9 20:55:05 2014 (r272843) @@ -698,7 +698,7 @@ nvlist_check_header(struct nvlist_header const unsigned char * nvlist_unpack_header(nvlist_t *nvl, const unsigned char *ptr, size_t nfds, - int *flagsp, size_t *leftp) + bool *isbep, size_t *leftp) { struct nvlist_header nvlhdr; @@ -725,7 +725,8 @@ nvlist_unpack_header(nvlist_t *nvl, cons nvl->nvl_flags = (nvlhdr.nvlh_flags & NV_FLAG_PUBLIC_MASK); ptr += sizeof(nvlhdr); - *flagsp = (int)nvlhdr.nvlh_flags; + if (isbep != NULL) + *isbep = (((int)nvlhdr.nvlh_flags & NV_FLAG_BIG_ENDIAN) != 0); *leftp -= sizeof(nvlhdr); return (ptr); @@ -741,7 +742,7 @@ nvlist_xunpack(const void *buf, size_t s nvlist_t *nvl, *retnvl, *tmpnvl; nvpair_t *nvp; size_t left; - int flags; + bool isbe; left = size; ptr = buf; @@ -751,44 +752,43 @@ nvlist_xunpack(const void *buf, size_t s if (nvl == NULL) goto failed; - ptr = nvlist_unpack_header(nvl, ptr, nfds, &flags, &left); + ptr = nvlist_unpack_header(nvl, ptr, nfds, &isbe, &left); if (ptr == NULL) goto failed; while (left > 0) { - ptr = nvpair_unpack(flags, ptr, &left, &nvp); + ptr = nvpair_unpack(isbe, ptr, &left, &nvp); if (ptr == NULL) goto failed; switch (nvpair_type(nvp)) { case NV_TYPE_NULL: - ptr = nvpair_unpack_null(flags, nvp, ptr, &left); + ptr = nvpair_unpack_null(isbe, nvp, ptr, &left); break; case NV_TYPE_BOOL: - ptr = nvpair_unpack_bool(flags, nvp, ptr, &left); + ptr = nvpair_unpack_bool(isbe, nvp, ptr, &left); break; case NV_TYPE_NUMBER: - ptr = nvpair_unpack_number(flags, nvp, ptr, &left); + ptr = nvpair_unpack_number(isbe, nvp, ptr, &left); break; case NV_TYPE_STRING: - ptr = nvpair_unpack_string(flags, nvp, ptr, &left); + ptr = nvpair_unpack_string(isbe, nvp, ptr, &left); break; case NV_TYPE_NVLIST: - ptr = nvpair_unpack_nvlist(&flags, nvp, ptr, &left, - nfds, &tmpnvl); + ptr = nvpair_unpack_nvlist(isbe, nvp, ptr, &left, nfds, + &tmpnvl); nvlist_set_parent(tmpnvl, nvp); break; case NV_TYPE_DESCRIPTOR: - ptr = nvpair_unpack_descriptor(flags, nvp, ptr, &left, + ptr = nvpair_unpack_descriptor(isbe, nvp, ptr, &left, fds, nfds); break; case NV_TYPE_BINARY: - ptr = nvpair_unpack_binary(flags, nvp, ptr, &left); + ptr = nvpair_unpack_binary(isbe, nvp, ptr, &left); break; case NV_TYPE_NVLIST_UP: if (nvl->nvl_parent == NULL) goto failed; nvl = nvpair_nvlist(nvl->nvl_parent); - flags = nvl->nvl_flags; continue; default: PJDLOG_ABORT("Invalid type (%d).", nvpair_type(nvp)); Modified: head/lib/libnv/nvlist_impl.h ============================================================================== --- head/lib/libnv/nvlist_impl.h Thu Oct 9 20:39:18 2014 (r272842) +++ head/lib/libnv/nvlist_impl.h Thu Oct 9 20:55:05 2014 (r272843) @@ -42,6 +42,6 @@ nvlist_t *nvlist_xunpack(const void *buf nvpair_t *nvlist_get_nvpair_parent(const nvlist_t *nvl); const unsigned char *nvlist_unpack_header(nvlist_t *nvl, - const unsigned char *ptr, size_t nfds, int *flagsp, size_t *leftp); + const unsigned char *ptr, size_t nfds, bool *isbep, size_t *leftp); #endif /* !_NVLIST_IMPL_H_ */ Modified: head/lib/libnv/nvpair.c ============================================================================== --- head/lib/libnv/nvpair.c Thu Oct 9 20:39:18 2014 (r272842) +++ head/lib/libnv/nvpair.c Thu Oct 9 20:55:05 2014 (r272843) @@ -389,7 +389,7 @@ nvpair_init_datasize(nvpair_t *nvp) } const unsigned char * -nvpair_unpack_header(int flags, nvpair_t *nvp, const unsigned char *ptr, +nvpair_unpack_header(bool isbe, nvpair_t *nvp, const unsigned char *ptr, size_t *leftp) { struct nvpair_header nvphdr; @@ -411,12 +411,12 @@ nvpair_unpack_header(int flags, nvpair_t } #if BYTE_ORDER == BIG_ENDIAN - if ((flags & NV_FLAG_BIG_ENDIAN) == 0) { + if (!isbe) { nvphdr.nvph_namesize = le16toh(nvphdr.nvph_namesize); nvphdr.nvph_datasize = le64toh(nvphdr.nvph_datasize); } #else - if ((flags & NV_FLAG_BIG_ENDIAN) != 0) { + if (isbe) { nvphdr.nvph_namesize = be16toh(nvphdr.nvph_namesize); nvphdr.nvph_datasize = be64toh(nvphdr.nvph_datasize); } @@ -451,7 +451,7 @@ failed: } const unsigned char * -nvpair_unpack_null(int flags __unused, nvpair_t *nvp, const unsigned char *ptr, +nvpair_unpack_null(bool isbe __unused, nvpair_t *nvp, const unsigned char *ptr, size_t *leftp __unused) { @@ -466,7 +466,7 @@ nvpair_unpack_null(int flags __unused, n } const unsigned char * -nvpair_unpack_bool(int flags __unused, nvpair_t *nvp, const unsigned char *ptr, +nvpair_unpack_bool(bool isbe __unused, nvpair_t *nvp, const unsigned char *ptr, size_t *leftp) { uint8_t value; @@ -497,7 +497,7 @@ nvpair_unpack_bool(int flags __unused, n } const unsigned char * -nvpair_unpack_number(int flags, nvpair_t *nvp, const unsigned char *ptr, +nvpair_unpack_number(bool isbe, nvpair_t *nvp, const unsigned char *ptr, size_t *leftp) { @@ -512,7 +512,7 @@ nvpair_unpack_number(int flags, nvpair_t return (NULL); } - if ((flags & NV_FLAG_BIG_ENDIAN) != 0) + if (isbe) nvp->nvp_data = be64dec(ptr); else nvp->nvp_data = le64dec(ptr); @@ -523,7 +523,7 @@ nvpair_unpack_number(int flags, nvpair_t } const unsigned char * -nvpair_unpack_string(int flags __unused, nvpair_t *nvp, +nvpair_unpack_string(bool isbe __unused, nvpair_t *nvp, const unsigned char *ptr, size_t *leftp) { @@ -551,8 +551,8 @@ nvpair_unpack_string(int flags __unused, } const unsigned char * -nvpair_unpack_nvlist(int *flagsp, nvpair_t *nvp, const unsigned char *ptr, - size_t *leftp, size_t nfds, nvlist_t **child) +nvpair_unpack_nvlist(bool isbe __unused, nvpair_t *nvp, + const unsigned char *ptr, size_t *leftp, size_t nfds, nvlist_t **child) { nvlist_t *value; @@ -567,7 +567,7 @@ nvpair_unpack_nvlist(int *flagsp, nvpair if (value == NULL) return (NULL); - ptr = nvlist_unpack_header(value, ptr, nfds, flagsp, leftp); + ptr = nvlist_unpack_header(value, ptr, nfds, NULL, leftp); if (ptr == NULL) return (NULL); @@ -578,7 +578,7 @@ nvpair_unpack_nvlist(int *flagsp, nvpair } const unsigned char * -nvpair_unpack_descriptor(int flags, nvpair_t *nvp, const unsigned char *ptr, +nvpair_unpack_descriptor(bool isbe, nvpair_t *nvp, const unsigned char *ptr, size_t *leftp, const int *fds, size_t nfds) { int64_t idx; @@ -594,7 +594,7 @@ nvpair_unpack_descriptor(int flags, nvpa return (NULL); } - if ((flags & NV_FLAG_BIG_ENDIAN) != 0) + if (isbe) idx = be64dec(ptr); else idx = le64dec(ptr); @@ -618,7 +618,7 @@ nvpair_unpack_descriptor(int flags, nvpa } const unsigned char * -nvpair_unpack_binary(int flags __unused, nvpair_t *nvp, +nvpair_unpack_binary(bool isbe __unused, nvpair_t *nvp, const unsigned char *ptr, size_t *leftp) { void *value; @@ -644,7 +644,7 @@ nvpair_unpack_binary(int flags __unused, } const unsigned char * -nvpair_unpack(int flags, const unsigned char *ptr, size_t *leftp, +nvpair_unpack(bool isbe, const unsigned char *ptr, size_t *leftp, nvpair_t **nvpp) { nvpair_t *nvp, *tmp; @@ -654,7 +654,7 @@ nvpair_unpack(int flags, const unsigned return (NULL); nvp->nvp_name = (char *)(nvp + 1); - ptr = nvpair_unpack_header(flags, nvp, ptr, leftp); + ptr = nvpair_unpack_header(isbe, nvp, ptr, leftp); if (ptr == NULL) goto failed; tmp = realloc(nvp, sizeof(*nvp) + strlen(nvp->nvp_name) + 1); Modified: head/lib/libnv/nvpair_impl.h ============================================================================== --- head/lib/libnv/nvpair_impl.h Thu Oct 9 20:39:18 2014 (r272842) +++ head/lib/libnv/nvpair_impl.h Thu Oct 9 20:55:05 2014 (r272843) @@ -48,7 +48,7 @@ void nvpair_insert(struct nvl_head *head void nvpair_remove(struct nvl_head *head, nvpair_t *nvp, const nvlist_t *nvl); size_t nvpair_header_size(void); size_t nvpair_size(const nvpair_t *nvp); -const unsigned char *nvpair_unpack(int flags, const unsigned char *ptr, +const unsigned char *nvpair_unpack(bool isbe, const unsigned char *ptr, size_t *leftp, nvpair_t **nvpp); void nvpair_free_structure(nvpair_t *nvp); void nvpair_init_datasize(nvpair_t *nvp); @@ -72,21 +72,21 @@ unsigned char *nvpair_pack_binary(const unsigned char *nvpair_pack_nvlist_up(unsigned char *ptr, size_t *leftp); /* Unpack data functions. */ -const unsigned char *nvpair_unpack_header(int flags, nvpair_t *nvp, +const unsigned char *nvpair_unpack_header(bool isbe, nvpair_t *nvp, const unsigned char *ptr, size_t *leftp); -const unsigned char *nvpair_unpack_null(int flags, nvpair_t *nvp, +const unsigned char *nvpair_unpack_null(bool isbe, nvpair_t *nvp, const unsigned char *ptr, size_t *leftp); -const unsigned char *nvpair_unpack_bool(int flags, nvpair_t *nvp, +const unsigned char *nvpair_unpack_bool(bool isbe, nvpair_t *nvp, const unsigned char *ptr, size_t *leftp); -const unsigned char *nvpair_unpack_number(int flags, nvpair_t *nvp, +const unsigned char *nvpair_unpack_number(bool isbe, nvpair_t *nvp, const unsigned char *ptr, size_t *leftp); -const unsigned char *nvpair_unpack_string(int flags, nvpair_t *nvp, +const unsigned char *nvpair_unpack_string(bool isbe, nvpair_t *nvp, const unsigned char *ptr, size_t *leftp); -const unsigned char *nvpair_unpack_nvlist(int *flagsp, nvpair_t *nvp, +const unsigned char *nvpair_unpack_nvlist(bool isbe, nvpair_t *nvp, const unsigned char *ptr, size_t *leftp, size_t nvlist, nvlist_t **child); -const unsigned char *nvpair_unpack_descriptor(int flags, nvpair_t *nvp, +const unsigned char *nvpair_unpack_descriptor(bool isbe, nvpair_t *nvp, const unsigned char *ptr, size_t *leftp, const int *fds, size_t nfds); -const unsigned char *nvpair_unpack_binary(int flags, nvpair_t *nvp, +const unsigned char *nvpair_unpack_binary(bool isbe, nvpair_t *nvp, const unsigned char *ptr, size_t *leftp); #endif /* !_NVPAIR_IMPL_H_ */ From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 21:21:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D780C6A0; Thu, 9 Oct 2014 21:21:23 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 962A9D1A; Thu, 9 Oct 2014 21:21:23 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id A7BA2B94C; Thu, 9 Oct 2014 17:21:22 -0400 (EDT) From: John Baldwin To: Konstantin Belousov Subject: Re: svn commit: r272800 - head/sys/x86/acpica Date: Thu, 9 Oct 2014 17:17:38 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20140415; KDE/4.5.5; amd64; ; ) References: <201410090534.s995YTUx057314@svn.freebsd.org> <20141009182310.GL2153@kib.kiev.ua> In-Reply-To: <20141009182310.GL2153@kib.kiev.ua> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201410091717.38641.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 09 Oct 2014 17:21:22 -0400 (EDT) Cc: svn-src-head@freebsd.org, Adrian Chadd , src-committers@freebsd.org, svn-src-all@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 21:21:24 -0000 On Thursday, October 09, 2014 2:23:10 pm Konstantin Belousov wrote: > On Thu, Oct 09, 2014 at 05:34:29AM +0000, Adrian Chadd wrote: > > Author: adrian > > Date: Thu Oct 9 05:34:28 2014 > > New Revision: 272800 > > URL: https://svnweb.freebsd.org/changeset/base/272800 > > > > Log: > > Missing from previous commit - keep the VM domain -> PXM mapping > > array and use it to map PXM -> VM domain when needed. > > > > Differential Revision: D906 > > Reviewed by: jhb > > > > Modified: > > head/sys/x86/acpica/srat.c > > > > Modified: head/sys/x86/acpica/srat.c > > ============================================================================== > > --- head/sys/x86/acpica/srat.c Thu Oct 9 05:33:25 2014 (r272799) > > +++ head/sys/x86/acpica/srat.c Thu Oct 9 05:34:28 2014 (r272800) > > @@ -62,6 +62,8 @@ int num_mem; > > static ACPI_TABLE_SRAT *srat; > > static vm_paddr_t srat_physaddr; > > > > +static int vm_domains[VM_PHYSSEG_MAX]; > > + > > static void srat_walk_table(acpi_subtable_handler *handler, void *arg); > > > > /* > > @@ -247,7 +249,6 @@ check_phys_avail(void) > > static int > > renumber_domains(void) > > { > > - int domains[VM_PHYSSEG_MAX]; > > int i, j, slot; > > > > /* Enumerate all the domains. */ > > @@ -255,17 +256,17 @@ renumber_domains(void) > > for (i = 0; i < num_mem; i++) { > > /* See if this domain is already known. */ > > for (j = 0; j < vm_ndomains; j++) { > > - if (domains[j] >= mem_info[i].domain) > > + if (vm_domains[j] >= mem_info[i].domain) > > break; > > } > > - if (j < vm_ndomains && domains[j] == mem_info[i].domain) > > + if (j < vm_ndomains && vm_domains[j] == mem_info[i].domain) > > continue; > > > > /* Insert the new domain at slot 'j'. */ > > slot = j; > > for (j = vm_ndomains; j > slot; j--) > > - domains[j] = domains[j - 1]; > > - domains[slot] = mem_info[i].domain; > > + vm_domains[j] = vm_domains[j - 1]; > > + vm_domains[slot] = mem_info[i].domain; > > vm_ndomains++; > > if (vm_ndomains > MAXMEMDOM) { > > vm_ndomains = 1; > > @@ -280,15 +281,15 @@ renumber_domains(void) > > * If the domain is already the right value, no need > > * to renumber. > > */ > > - if (domains[i] == i) > > + if (vm_domains[i] == i) > > continue; > > > > /* Walk the cpu[] and mem_info[] arrays to renumber. */ > > for (j = 0; j < num_mem; j++) > > - if (mem_info[j].domain == domains[i]) > > + if (mem_info[j].domain == vm_domains[i]) > > mem_info[j].domain = i; > > for (j = 0; j <= MAX_APIC_ID; j++) > > - if (cpus[j].enabled && cpus[j].domain == domains[i]) > > + if (cpus[j].enabled && cpus[j].domain == vm_domains[i]) > > cpus[j].domain = i; > > } > > KASSERT(vm_ndomains > 0, > > @@ -368,4 +369,23 @@ srat_set_cpus(void *dummy) > > } > > } > > SYSINIT(srat_set_cpus, SI_SUB_CPU, SI_ORDER_ANY, srat_set_cpus, NULL); > > + > > +/* > > + * Map a _PXM value to a VM domain ID. > > + * > > + * Returns the domain ID, or -1 if no domain ID was found. > > + */ > > +int > > +acpi_map_pxm_to_vm_domainid(int pxm) > > +{ > > + int i; > > + > > + for (i = 0; i < vm_ndomains; i++) { > > + if (vm_domains[i] == pxm) > > + return (i); > > + } > > + > > + return (-1); > > +} > > + > > #endif /* MAXMEMDOM > 1 */ > > I do not like it. Sorry for not looking at the web thing, I have very > little time. > > It never was an intention that one proximity domain reported by ACPI > was mapped to single VM domain. VM could split domains (in terms of > vm_domains) further for other reasons. Main motivation is that there > is 1:1 relations between domain/page queues/page queues locks/pagedaemons. > > I have patches in WIP stage which split firmware proximity domains > further, to decrease congestion on the page queue locks. I wrote about > this in the pgsql performance report. > > The short version is that there is/will be N:1 relation between VM domains > and proximity domains (which is reported by ACPI for devices). _PXM is also defined to be what SRAT reports for memory, and is what will be used to do NUMA-aware memory allocations. While the VM system may decide to split a given NUMA domain into multiple some-other-things, those some-other- things won't be a NUMA domain anymore. At that point, you will need to divorce them from 'domain' and use another term as the domain index into mem_info[] will still be needed so that NUMA allocations do the correct thing. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 22:36:22 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4E22578C; Thu, 9 Oct 2014 22:36:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 39D95795; Thu, 9 Oct 2014 22:36:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99MaMUb050943; Thu, 9 Oct 2014 22:36:22 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99MaLGI050939; Thu, 9 Oct 2014 22:36:21 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201410092236.s99MaLGI050939@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Thu, 9 Oct 2014 22:36:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272844 - in head/sys: netinet netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 22:36:22 -0000 Author: bryanv Date: Thu Oct 9 22:36:21 2014 New Revision: 272844 URL: https://svnweb.freebsd.org/changeset/base/272844 Log: Add missing UDP multicast receive dtrace probes Phabricator: https://reviews.freebsd.org/D924 Reviewed by: rpaulo markj MFC after: 1 month Modified: head/sys/netinet/udp_usrreq.c head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet/udp_usrreq.c ============================================================================== --- head/sys/netinet/udp_usrreq.c Thu Oct 9 20:55:05 2014 (r272843) +++ head/sys/netinet/udp_usrreq.c Thu Oct 9 22:36:21 2014 (r272844) @@ -576,6 +576,8 @@ udp_input(struct mbuf **mp, int *offp, i struct mbuf *n; if ((n = m_copy(m, 0, M_COPYALL)) != NULL) { + UDP_PROBE(receive, NULL, last, ip, + last, uh); udp_append(last, ip, n, iphlen, &udp_in); } @@ -607,6 +609,7 @@ udp_input(struct mbuf **mp, int *offp, i INP_INFO_RUNLOCK(pcbinfo); goto badunlocked; } + UDP_PROBE(receive, NULL, last, ip, last, uh); udp_append(last, ip, m, iphlen, &udp_in); INP_RUNLOCK(last); INP_INFO_RUNLOCK(pcbinfo); Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Thu Oct 9 20:55:05 2014 (r272843) +++ head/sys/netinet6/udp6_usrreq.c Thu Oct 9 22:36:21 2014 (r272844) @@ -370,6 +370,8 @@ udp6_input(struct mbuf **mp, int *offp, if ((n = m_copy(m, 0, M_COPYALL)) != NULL) { INP_RLOCK(last); + UDP_PROBE(receive, NULL, last, ip6, + last, uh); udp6_append(last, n, off, &fromsa); INP_RUNLOCK(last); } From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 22:39:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 77A1E964; Thu, 9 Oct 2014 22:39:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 623EE7B9; Thu, 9 Oct 2014 22:39:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99MdsR5051448; Thu, 9 Oct 2014 22:39:54 GMT (envelope-from kargl@FreeBSD.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99MdrxP051443; Thu, 9 Oct 2014 22:39:53 GMT (envelope-from kargl@FreeBSD.org) Message-Id: <201410092239.s99MdrxP051443@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kargl set sender to kargl@FreeBSD.org using -f From: Steve Kargl Date: Thu, 9 Oct 2014 22:39:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272845 - in head/lib/msun: ld128 ld80 src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 22:39:54 -0000 Author: kargl Date: Thu Oct 9 22:39:52 2014 New Revision: 272845 URL: https://svnweb.freebsd.org/changeset/base/272845 Log: The value small=2**-(p+3), where p is the precision, can be determine from lgamma(x) = -log(x) - log(1+x) + x*(1-g) + x**2*P(x) with g = 0.57... being the Euler constant and P(x) a polynomial. Substitution of small into the RHS shows that the last 3 terms are negligible in comparison to the leading term. The choice of 3 may be conservative. The value large=2**(p+3) is detemined from Stirling's approximation lgamma(x) = x*(log(x)-1) - log(x)/2 + log(2*pi)/2 + P(1/x)/x Again, substitution of large into the RHS reveals the last 3 terms are negligible in comparison to the leading term. Move the x=+-0 special case into the |x|>15)<<1; - return (1-i)+one/x; /* erfl(+-inf)=+-1 */ - } + EXTRACT_LDBL128_WORDS(hx,lx,llx,x); - /* purge off +-inf, NaN, +-0, tiny and negative arguments */ + /* purge +-Inf and NaNs */ *signgamp = 1; - if((hx & 0x7fff) == 0x7fff) /* x is +-Inf or NaN */ - return x*x; - if((hx==0||hx==0x8000)&&lx==0) { - if (hx&0x8000) - *signgamp = -1; - return one/vzero; - } + ix = hx&0x7fff; + if(ix==0x7fff) return x*x; - /* purge off tiny and negative arguments */ - if(fabsl(x)<0x1p-119L) { - if(hx&0x8000) { - *signgamp = -1; - return -logl(-x); - } else return -logl(x); + /* purge +-0 and tiny arguments */ + *signgamp = 1-2*(hx>>15); + if(ix<0x3fff-116) { /* |x|<2**-(p+3), return -log(|x|) */ + if((ix|lx|llx)==0) + return one/vzero; + return -logl(fabsl(x)); } + + /* purge negative integers and start evaluation for other x < 0 */ if(hx&0x8000) { - if(fabsl(x)>=0x1p112) + *signgamp = 1; + if(ix>=0x3fff+112) /* |x|>=2**(p-1), must be -integer */ return one/vzero; t = sin_pil(x); if(t==zero) return one/vzero; @@ -264,17 +256,19 @@ lgammal_r(long double x, int *signgamp) x = -x; } - if(x == 1 || x ==2) r = 0; - else if(x<2) { - if(x<=0.8999996185302734) { + /* purge 1 and 2 */ + if((ix==0x3fff || ix==0x4000) && (lx|llx)==0) r = 0; + /* for x < 2.0 */ + else if(ix<0x4000) { + if(x<=8.9999961853027344e-01) { r = -logl(x); - if(x>=0.7315998077392578) {y = 1-x; i= 0;} - else if(x>=0.2316399812698364) {y= x-(tc-1); i=1;} + if(x>=7.3159980773925781e-01) {y = 1-x; i= 0;} + else if(x>=2.3163998126983643e-01) {y= x-(tc-1); i=1;} else {y = x; i=2;} } else { - r = 0; - if(x>=1.7316312789916992) {y=2-x;i=0;} - else if(x>=1.2316322326660156) {y=x-tc;i=1;} + r = 0; + if(x>=1.7316312789916992e+00) {y=2-x;i=0;} + else if(x>=1.2316322326660156e+00) {y=x-tc;i=1;} else {y=x-1;i=2;} } switch(i) { @@ -285,23 +279,24 @@ lgammal_r(long double x, int *signgamp) p2 = z*(a1+z*(a3+z*(a5+z*(a7+z*(a9+z*(a11+z*(a13+z*(a15+ z*(a17+z*(a19+z*(a21+z*a23))))))))))); p = y*p1+p2; - r += (p-y/2); break; + r += p-y/2; break; case 1: p = t0+y*t1+tt+y*y*(t2+y*(t3+y*(t4+y*(t5+y*(t6+y*(t7+y*(t8+ y*(t9+y*(t10+y*(t11+y*(t12+y*(t13+y*(t14+y*(t15+y*(t16+ y*(t17+y*(t18+y*(t19+y*(t20+y*(t21+y*(t22+y*(t23+ y*(t24+y*(t25+y*(t26+y*(t27+y*(t28+y*(t29+y*(t30+ y*(t31+y*t32)))))))))))))))))))))))))))))); - r += (tf + p); break; + r += tf + p; break; case 2: p1 = y*(u0+y*(u1+y*(u2+y*(u3+y*(u4+y*(u5+y*(u6+y*(u7+ y*(u8+y*(u9+y*u10)))))))))); p2 = one+y*(v1+y*(v2+y*(v3+y*(v4+y*(v5+y*(v6+y*(v7+ y*(v8+y*(v9+y*(v10+y*v11)))))))))); - r += (-y/2 + p1/p2); + r += p1/p2-y/2; } } - else if(x<8) { + /* x < 8.0 */ + else if(ix<0x4002) { i = x; y = x-i; p = y*(s0+y*(s1+y*(s2+y*(s3+y*(s4+y*(s5+y*(s6+y*(s7+y*(s8+ @@ -318,7 +313,8 @@ lgammal_r(long double x, int *signgamp) case 3: z *= (y+2); /* FALLTHRU */ r += logl(z); break; } - } else if (x < 0x1p119L) { + /* 8.0 <= x < 2**(p+3) */ + } else if (ix<0x3fff+116) { t = logl(x); z = one/x; y = z*z; @@ -326,6 +322,7 @@ lgammal_r(long double x, int *signgamp) y*(w9+y*(w10+y*(w11+y*(w12+y*(w13+y*(w14+y*(w15+y*(w16+ y*(w17+y*w18))))))))))))))))); r = (x-half)*(t-one)+w; + /* 2**(p+3) <= x <= inf */ } else r = x*(logl(x)-1); if(hx&0x8000) r = nadj - r; Modified: head/lib/msun/ld80/e_lgammal_r.c ============================================================================== --- head/lib/msun/ld80/e_lgammal_r.c Thu Oct 9 22:36:21 2014 (r272844) +++ head/lib/msun/ld80/e_lgammal_r.c Thu Oct 9 22:39:52 2014 (r272845) @@ -14,12 +14,11 @@ __FBSDID("$FreeBSD$"); /* - * See s_lgamma_r.c for complete comments. + * See e_lgamma_r.c for complete comments. * * Converted to long double by Steven G. Kargl. */ -#include #ifdef __i386__ #include #endif @@ -219,8 +218,8 @@ sin_pil(long double x) y = -x; - vz = y+0x1p63L; - z = vz-0x1p63L; + vz = y+0x1p63; + z = vz-0x1p63; if (z == y) return zero; @@ -243,7 +242,7 @@ sin_pil(long double x) case 5: case 6: y = -__kernel_cosl(pi*(y-1.5),zero); break; default: y = __kernel_sinl(pi*(y-2.0),zero,0); break; - } + } return -y; } @@ -253,31 +252,29 @@ lgammal_r(long double x, int *signgamp) long double nadj,p,p1,p2,p3,q,r,t,w,y,z; uint64_t lx; int i; - uint16_t hx; + uint16_t hx,ix; EXTRACT_LDBL80_WORDS(hx,lx,x); - /* purge off +-inf, NaN, +-0 */ + /* purge +-Inf and NaNs */ *signgamp = 1; - if((hx & 0x7fff) == 0x7fff) /* x is +-Inf or NaN */ - return x*x; - if((hx==0||hx==0x8000)&&lx==0) { - if (hx&0x8000) - *signgamp = -1; - return one/vzero; - } + ix = hx&0x7fff; + if(ix==0x7fff) return x*x; ENTERI(); - /* purge off tiny and negative arguments */ - if(fabsl(x)<0x1p-70L) { /* |x|<2**-70, return -log(|x|) */ - if(hx&0x8000) { - *signgamp = -1; - RETURNI(-logl(-x)); - } else RETURNI(-logl(x)); + /* purge +-0 and tiny arguments */ + *signgamp = 1-2*(hx>>15); + if(ix<0x3fff-67) { /* |x|<2**-(p+3), return -log(|x|) */ + if((ix|lx)==0) + RETURNI(one/vzero); + RETURNI(-logl(fabsl(x))); } + + /* purge negative integers and start evaluation for other x < 0 */ if(hx&0x8000) { - if(fabsl(x)>=0x1p63) /* |x|>=2**(p-1), must be -integer */ + *signgamp = 1; + if(ix>=0x3fff+63) /* |x|>=2**(p-1), must be -integer */ RETURNI(one/vzero); t = sin_pil(x); if(t==zero) RETURNI(one/vzero); /* -integer */ @@ -286,19 +283,30 @@ lgammal_r(long double x, int *signgamp) x = -x; } - /* purge off 1 and 2 */ - if(x == 1 || x == 2) r = 0; + /* purge 1 and 2 */ + if((ix==0x3fff || ix==0x4000) && lx==0x8000000000000000ULL) r = 0; /* for x < 2.0 */ - else if(x<2) { - if(x<=0.8999996185302734) { /* lgamma(x) = lgamma(x+1)-log(x) */ - r = - logl(x); - if(x>=0.7315998077392578) {y = 1-x; i= 0;} - else if(x>=0.2316399812698364) {y= x-(tc-1); i=1;} - else {y = x; i=2;} + else if(ix<0x4000) { + /* + * XXX Supposedly, one can use the following information to replace the + * XXX FP rational expressions. A similar approach is appropriate + * XXX for ld128, but one (may need?) needs to consider llx, too. + * + * 8.9999961853027344e-01 3ffe e666600000000000 + * 7.3159980773925781e-01 3ffe bb4a200000000000 + * 2.3163998126983643e-01 3ffc ed33080000000000 + * 1.7316312789916992e+00 3fff dda6180000000000 + * 1.2316322326660156e+00 3fff 9da6200000000000 + */ + if(x<8.9999961853027344e-01) { + r = -logl(x); + if(x>=7.3159980773925781e-01) {y = 1-x; i= 0;} + else if(x>=2.3163998126983643e-01) {y= x-(tc-1); i=1;} + else {y = x; i=2;} } else { r = 0; - if(x>=1.7316312789916992) {y=2-x;i=0;} - else if(x>=1.2316322326660156) {y=x-tc;i=1;} + if(x>=1.7316312789916992e+00) {y=2-x;i=0;} + else if(x>=1.2316322326660156e+00) {y=x-tc;i=1;} else {y=x-1;i=2;} } switch(i) { @@ -307,19 +315,20 @@ lgammal_r(long double x, int *signgamp) p1 = a0+z*(a2+z*(a4+z*(a6+z*(a8+z*(a10+z*a12))))); p2 = z*(a1+z*(a3+z*(a5+z*(a7+z*(a9+z*(a11+z*a13)))))); p = y*p1+p2; - r += (p-y/2); break; + r += p-y/2; break; case 1: p = t0+y*t1+tt+y*y*(t2+y*(t3+y*(t4+y*(t5+y*(t6+y*(t7+y*(t8+ y*(t9+y*(t10+y*(t11+y*(t12+y*(t13+y*(t14+y*(t15+y*(t16+ y*(t17+y*t18)))))))))))))))); - r += (tf + p); break; + r += tf + p; break; case 2: p1 = y*(u0+y*(u1+y*(u2+y*(u3+y*(u4+y*(u5+y*u6)))))); p2 = 1+y*(v1+y*(v2+y*(v3+y*(v4+y*(v5+y*v6))))); - r += (-y/2 + p1/p2); + r += p1/p2-y/2; } } - else if(x<8) { + /* x < 8.0 */ + else if(ix<0x4002) { i = x; y = x-i; p = y*(s0+y*(s1+y*(s2+y*(s3+y*(s4+y*(s5+y*s6)))))); @@ -334,15 +343,15 @@ lgammal_r(long double x, int *signgamp) case 3: z *= (y+2); /* FALLTHRU */ r += logl(z); break; } - /* 8.0 <= x < 2**70 */ - } else if (x < 0x1p70L) { + /* 8.0 <= x < 2**(p+3) */ + } else if (ix<0x3fff+67) { t = logl(x); z = one/x; y = z*z; w = w0+z*(w1+y*(w2+y*(w3+y*(w4+y*(w5+y*(w6+y*(w7+y*w8))))))); r = (x-half)*(t-one)+w; + /* 2**(p+3) <= x <= inf */ } else - /* 2**70 <= x <= inf */ r = x*(logl(x)-1); if(hx&0x8000) r = nadj - r; RETURNI(r); Modified: head/lib/msun/src/e_lgamma_r.c ============================================================================== --- head/lib/msun/src/e_lgamma_r.c Thu Oct 9 22:36:21 2014 (r272844) +++ head/lib/msun/src/e_lgamma_r.c Thu Oct 9 22:39:52 2014 (r272845) @@ -201,28 +201,28 @@ sin_pi(double x) double __ieee754_lgamma_r(double x, int *signgamp) { - double t,y,z,nadj,p,p1,p2,p3,q,r,w; + double nadj,p,p1,p2,p3,q,r,t,w,y,z; int32_t hx; int i,ix,lx; EXTRACT_WORDS(hx,lx,x); - /* purge off +-inf, NaN, +-0, tiny and negative arguments */ + /* purge +-Inf and NaNs */ *signgamp = 1; ix = hx&0x7fffffff; if(ix>=0x7ff00000) return x*x; - if((ix|lx)==0) { - if(hx<0) - *signgamp = -1; - return one/vzero; - } - if(ix<0x3b900000) { /* |x|<2**-70, return -log(|x|) */ - if(hx<0) { - *signgamp = -1; - return -__ieee754_log(-x); - } else return -__ieee754_log(x); + + /* purge +-0 and tiny arguments */ + *signgamp = 1-2*((uint32_t)hx>>31); + if(ix<0x3c700000) { /* |x|<2**-56, return -log(|x|) */ + if((ix|lx)==0) + return one/vzero; + return -__ieee754_log(fabs(x)); } + + /* purge negative integers and start evaluation for other x < 0 */ if(hx<0) { + *signgamp = 1; if(ix>=0x43300000) /* |x|>=2**52, must be -integer */ return one/vzero; t = sin_pi(x); @@ -232,7 +232,7 @@ __ieee754_lgamma_r(double x, int *signga x = -x; } - /* purge off 1 and 2 */ + /* purge 1 and 2 */ if((((ix-0x3ff00000)|lx)==0)||(((ix-0x40000000)|lx)==0)) r = 0; /* for x < 2.0 */ else if(ix<0x40000000) { @@ -253,7 +253,7 @@ __ieee754_lgamma_r(double x, int *signga p1 = a0+z*(a2+z*(a4+z*(a6+z*(a8+z*a10)))); p2 = z*(a1+z*(a3+z*(a5+z*(a7+z*(a9+z*a11))))); p = y*p1+p2; - r += (p-y/2); break; + r += p-y/2; break; case 1: z = y*y; w = z*y; @@ -261,19 +261,20 @@ __ieee754_lgamma_r(double x, int *signga p2 = t1+w*(t4+w*(t7+w*(t10+w*t13))); p3 = t2+w*(t5+w*(t8+w*(t11+w*t14))); p = z*p1-(tt-w*(p2+y*p3)); - r += (tf + p); break; + r += tf + p; break; case 2: p1 = y*(u0+y*(u1+y*(u2+y*(u3+y*(u4+y*u5))))); p2 = one+y*(v1+y*(v2+y*(v3+y*(v4+y*v5)))); - r += (-0.5*y + p1/p2); + r += p1/p2-y/2; } } - else if(ix<0x40200000) { /* x < 8.0 */ - i = (int)x; - y = x-(double)i; + /* x < 8.0 */ + else if(ix<0x40200000) { + i = x; + y = x-i; p = y*(s0+y*(s1+y*(s2+y*(s3+y*(s4+y*(s5+y*s6)))))); q = one+y*(r1+y*(r2+y*(r3+y*(r4+y*(r5+y*r6))))); - r = half*y+p/q; + r = y/2+p/q; z = one; /* lgamma(1+s) = log(s) + lgamma(s) */ switch(i) { case 7: z *= (y+6); /* FALLTHRU */ @@ -283,15 +284,15 @@ __ieee754_lgamma_r(double x, int *signga case 3: z *= (y+2); /* FALLTHRU */ r += __ieee754_log(z); break; } - /* 8.0 <= x < 2**58 */ - } else if (ix < 0x43900000) { + /* 8.0 <= x < 2**56 */ + } else if (ix < 0x43700000) { t = __ieee754_log(x); z = one/x; y = z*z; w = w0+z*(w1+y*(w2+y*(w3+y*(w4+y*(w5+y*w6))))); r = (x-half)*(t-one)+w; } else - /* 2**58 <= x <= inf */ + /* 2**56 <= x <= inf */ r = x*(__ieee754_log(x)-one); if(hx<0) r = nadj - r; return r; Modified: head/lib/msun/src/e_lgammaf_r.c ============================================================================== --- head/lib/msun/src/e_lgammaf_r.c Thu Oct 9 22:36:21 2014 (r272844) +++ head/lib/msun/src/e_lgammaf_r.c Thu Oct 9 22:39:52 2014 (r272845) @@ -122,29 +122,29 @@ sin_pif(float x) float __ieee754_lgammaf_r(float x, int *signgamp) { - float t,y,z,nadj,p,p1,p2,p3,q,r,w; + float nadj,p,p1,p2,p3,q,r,t,w,y,z; int32_t hx; int i,ix; GET_FLOAT_WORD(hx,x); - /* purge off +-inf, NaN, +-0, tiny and negative arguments */ + /* purge +-Inf and NaNs */ *signgamp = 1; ix = hx&0x7fffffff; if(ix>=0x7f800000) return x*x; - if(ix==0) { - if(hx<0) - *signgamp = -1; - return one/vzero; - } - if(ix<0x35000000) { /* |x|<2**-21, return -log(|x|) */ - if(hx<0) { - *signgamp = -1; - return -__ieee754_logf(-x); - } else return -__ieee754_logf(x); + + /* purge +-0 and tiny arguments */ + *signgamp = 1-2*((uint32_t)hx>>31); + if(ix<0x32000000) { /* |x|<2**-27, return -log(|x|) */ + if(ix==0) + return one/vzero; + return -__ieee754_logf(fabsf(x)); } + + /* purge negative integers and start evaluation for other x < 0 */ if(hx<0) { - if(ix>=0x4b000000) /* |x|>=2**23, must be -integer */ + *signgamp = 1; + if(ix>=0x4b000000) /* |x|>=2**23, must be -integer */ return one/vzero; t = sin_pif(x); if(t==zero) return one/vzero; /* -integer */ @@ -153,7 +153,7 @@ __ieee754_lgammaf_r(float x, int *signga x = -x; } - /* purge off 1 and 2 */ + /* purge 1 and 2 */ if (ix==0x3f800000||ix==0x40000000) r = 0; /* for x < 2.0 */ else if(ix<0x40000000) { @@ -174,17 +174,18 @@ __ieee754_lgammaf_r(float x, int *signga p1 = a0+z*(a2+z*a4); p2 = z*(a1+z*(a3+z*a5)); p = y*p1+p2; - r += (p-y/2); break; + r += p-y/2; break; case 1: p = t0+y*t1+y*y*(t2+y*(t3+y*(t4+y*(t5+y*(t6+y*t7))))); - r += (tf + p); break; + r += tf + p; break; case 2: p1 = y*(u0+y*(u1+y*u2)); p2 = one+y*(v1+y*(v2+y*v3)); - r += (p1/p2-y/2); + r += p1/p2-y/2; } } - else if(ix<0x41000000) { /* x < 8.0 */ + /* x < 8.0 */ + else if(ix<0x41000000) { i = x; y = x-i; p = y*(s0+y*(s1+y*(s2+y*s3))); @@ -199,15 +200,15 @@ __ieee754_lgammaf_r(float x, int *signga case 3: z *= (y+2); /* FALLTHRU */ r += __ieee754_logf(z); break; } - /* 8.0 <= x < 2**24 */ - } else if (ix < 0x4b800000) { + /* 8.0 <= x < 2**27 */ + } else if (ix < 0x4d000000) { t = __ieee754_logf(x); z = one/x; y = z*z; w = w0+z*(w1+y*w2); r = (x-half)*(t-one)+w; } else - /* 2**24 <= x <= inf */ + /* 2**27 <= x <= inf */ r = x*(__ieee754_logf(x)-one); if(hx<0) r = nadj - r; return r; From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 22:58:34 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B385295; Thu, 9 Oct 2014 22:58:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9FD2B9AE; Thu, 9 Oct 2014 22:58:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99MwY4p060947; Thu, 9 Oct 2014 22:58:34 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99MwY2U060946; Thu, 9 Oct 2014 22:58:34 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201410092258.s99MwY2U060946@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 9 Oct 2014 22:58:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272848 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 22:58:34 -0000 Author: emaste Date: Thu Oct 9 22:58:33 2014 New Revision: 272848 URL: https://svnweb.freebsd.org/changeset/base/272848 Log: Update dl_iterate_phdr(3) to follow r272842 Relnotes: yes Sponsored by: The FreeBSD Foundation Modified: head/lib/libc/gen/dl_iterate_phdr.3 Modified: head/lib/libc/gen/dl_iterate_phdr.3 ============================================================================== --- head/lib/libc/gen/dl_iterate_phdr.3 Thu Oct 9 22:56:38 2014 (r272847) +++ head/lib/libc/gen/dl_iterate_phdr.3 Thu Oct 9 22:58:33 2014 (r272848) @@ -15,7 +15,7 @@ .\" .\" $OpenBSD: dl_iterate_phdr.3,v 1.3 2007/05/31 19:19:48 jmc Exp $ .\" $FreeBSD$ -.Dd February 15, 2012 +.Dd October 9, 2014 .Dt DL_ITERATE_PHDR 3 .Os .Sh NAME @@ -68,7 +68,7 @@ have the following meaning: The base address at which the object is mapped into the address space of the calling process. .It Fa dlpi_name -The name of the ELF object. +The pathname of the ELF object. .It Fa dlpi_phdr A pointer to the object's program headers. .It Fa dlpi_phnum From owner-svn-src-head@FreeBSD.ORG Thu Oct 9 23:05:32 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9CD68250; Thu, 9 Oct 2014 23:05:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F4B0A6E; Thu, 9 Oct 2014 23:05:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s99N5WVa065406; Thu, 9 Oct 2014 23:05:32 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s99N5Vmd065383; Thu, 9 Oct 2014 23:05:31 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201410092305.s99N5Vmd065383@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 9 Oct 2014 23:05:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272849 - in head: . gnu/usr.bin tools/build/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 23:05:32 -0000 Author: emaste Date: Thu Oct 9 23:05:31 2014 New Revision: 272849 URL: https://svnweb.freebsd.org/changeset/base/272849 Log: Build gperf only if we're using g++ (not clang++) gperf is used as a build tool for g++ and is not needed for Clang architectures. Ports and third-party software that need it can use the up-to-date devel/gperf port. PR: 194103 (exp-run) Reviewed by: bapt Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D886 Modified: head/UPDATING head/gnu/usr.bin/Makefile head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/UPDATING ============================================================================== --- head/UPDATING Thu Oct 9 22:58:33 2014 (r272848) +++ head/UPDATING Thu Oct 9 23:05:31 2014 (r272849) @@ -31,6 +31,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20141009: + gperf has been removed from the base system for architectures + that use clang. Ports that require gperf will obtain it from the + devel/gperf port. + 20140923: pjdfstest has been moved from tools/regression/pjdfstest to contrib/pjdfstest . Modified: head/gnu/usr.bin/Makefile ============================================================================== --- head/gnu/usr.bin/Makefile Thu Oct 9 22:58:33 2014 (r272848) +++ head/gnu/usr.bin/Makefile Thu Oct 9 23:05:31 2014 (r272849) @@ -18,7 +18,9 @@ SUBDIR= ${_binutils} \ ${_texinfo} .if ${MK_CXX} != "no" +.if ${MK_GCC} != "no" _gperf= gperf +.endif .if ${MK_GROFF} != "no" _groff= groff .endif Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Thu Oct 9 22:58:33 2014 (r272848) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Thu Oct 9 23:05:31 2014 (r272849) @@ -591,13 +591,18 @@ OLD_FILES+=usr/share/man/man1/ctm_smail. OLD_FILES+=usr/share/man/man5/ctm.5.gz .endif -# devd(8) and gperf(1) not listed here on purpose +# devd(8) not listed here on purpose .if ${MK_CXX} == no OLD_FILES+=usr/bin/CC OLD_FILES+=usr/bin/c++ OLD_FILES+=usr/bin/c++filt OLD_FILES+=usr/bin/g++ OLD_FILES+=usr/libexec/cc1plus +.if ${MK_GCC} == no +OLD_FILES+=usr/bin/gperf +OLD_FILES+=usr/share/info/gperf.info.gz +OLD_FILES+=usr/share/man/man1/gperf.1.gz +.endif .endif .if ${MK_FMTREE} == no From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 00:26:29 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3C5E528A; Fri, 10 Oct 2014 00:26:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F3B824F; Fri, 10 Oct 2014 00:26:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9A0QS3Y006259; Fri, 10 Oct 2014 00:26:28 GMT (envelope-from syrinx@FreeBSD.org) Received: (from syrinx@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9A0QSFU006258; Fri, 10 Oct 2014 00:26:28 GMT (envelope-from syrinx@FreeBSD.org) Message-Id: <201410100026.s9A0QSFU006258@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: syrinx set sender to syrinx@FreeBSD.org using -f From: Shteryana Shopova Date: Fri, 10 Oct 2014 00:26:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272878 - head/contrib/bsnmp/snmp_target X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 00:26:29 -0000 Author: syrinx Date: Fri Oct 10 00:26:28 2014 New Revision: 272878 URL: https://svnweb.freebsd.org/changeset/base/272878 Log: Fix a bug in decoding string indexes in snmp_target(3), thus causing bsnmpd(1) to not send v3 notifications properly; while here add two missing return statements which could lead to abort() in case of a rollback Modified: head/contrib/bsnmp/snmp_target/target_snmp.c Modified: head/contrib/bsnmp/snmp_target/target_snmp.c ============================================================================== --- head/contrib/bsnmp/snmp_target/target_snmp.c Fri Oct 10 00:26:00 2014 (r272877) +++ head/contrib/bsnmp/snmp_target/target_snmp.c Fri Oct 10 00:26:28 2014 (r272878) @@ -301,6 +301,7 @@ op_snmp_target_addrs(struct snmp_context default: break; } + return (SNMP_ERR_NOERROR); default: abort(); @@ -625,6 +626,7 @@ op_snmp_notify(struct snmp_context *ctx default: break; } + return (SNMP_ERR_NOERROR); default: abort(); @@ -663,13 +665,14 @@ target_append_index(struct asn_oid *oid, static int target_decode_index(const struct asn_oid *oid, uint sub, char *name) { - uint32_t i, len; + uint32_t i; - if ((len = oid->len - sub) >= SNMP_ADM_STR32_SIZ) + if (oid->len - sub != oid->subs[sub] + 1 || oid->subs[sub] >= + SNMP_ADM_STR32_SIZ) return (-1); - for (i = 0; i < len; i++) - name[i] = oid->subs[sub + i]; + for (i = 0; i < oid->subs[sub]; i++) + name[i] = oid->subs[sub + i + 1]; name[i] = '\0'; return (0); From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 00:35:09 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 711D06E3; Fri, 10 Oct 2014 00:35:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5D530359; Fri, 10 Oct 2014 00:35:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9A0Z9ig011067; Fri, 10 Oct 2014 00:35:09 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9A0Z9dw011066; Fri, 10 Oct 2014 00:35:09 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201410100035.s9A0Z9dw011066@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 10 Oct 2014 00:35:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272880 - head/sys/ufs/ufs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 00:35:09 -0000 Author: imp Date: Fri Oct 10 00:35:08 2014 New Revision: 272880 URL: https://svnweb.freebsd.org/changeset/base/272880 Log: Restore the backed-out change, using __offsetof instead. Modified: head/sys/ufs/ufs/dir.h Modified: head/sys/ufs/ufs/dir.h ============================================================================== --- head/sys/ufs/ufs/dir.h Fri Oct 10 00:28:19 2014 (r272879) +++ head/sys/ufs/ufs/dir.h Fri Oct 10 00:35:08 2014 (r272880) @@ -110,7 +110,7 @@ struct direct { * */ #define DIRECTSIZ(namlen) \ - (((uintptr_t)&((struct direct *)0)->d_name + \ + ((__offsetof(struct direct, d_name) + \ ((namlen)+1)*sizeof(((struct direct *)0)->d_name[0]) + 3) & ~3) #if (BYTE_ORDER == LITTLE_ENDIAN) #define DIRSIZ(oldfmt, dp) \ From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 00:35:14 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CD24E822; Fri, 10 Oct 2014 00:35:14 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B90A335A; Fri, 10 Oct 2014 00:35:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9A0ZEsQ011137; Fri, 10 Oct 2014 00:35:14 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9A0ZE5n011135; Fri, 10 Oct 2014 00:35:14 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201410100035.s9A0ZE5n011135@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 10 Oct 2014 00:35:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272881 - in head/sys: conf sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 00:35:14 -0000 Author: imp Date: Fri Oct 10 00:35:13 2014 New Revision: 272881 URL: https://svnweb.freebsd.org/changeset/base/272881 Log: For gcc 4.6 and newer, _Static_assert is a keyword, so don't try to redefine it. It does what we want, and is always available unlike other alternatives. Modified: head/sys/conf/kern.mk head/sys/sys/cdefs.h Modified: head/sys/conf/kern.mk ============================================================================== --- head/sys/conf/kern.mk Fri Oct 10 00:35:08 2014 (r272880) +++ head/sys/conf/kern.mk Fri Oct 10 00:35:13 2014 (r272881) @@ -38,7 +38,7 @@ CWARNEXTRA?= -Wno-error-tautological-com # building with gcc 4.8 and newer. Nothing older has been tested. CWARNEXTRA?= -Wno-error=inline -Wno-error=enum-compare -Wno-error=unused-but-set-variable \ -Wno-error=aggressive-loop-optimizations -Wno-error=maybe-uninitialized \ - -Wno-error=unused-local-typedefs -Wno-error=array-bounds -Wno-error=address \ + -Wno-error=array-bounds -Wno-error=address \ -Wno-error=cast-qual -Wno-error=sequence-point -Wno-error=attributes .endif Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Fri Oct 10 00:35:08 2014 (r272880) +++ head/sys/sys/cdefs.h Fri Oct 10 00:35:13 2014 (r272881) @@ -288,6 +288,8 @@ #if (defined(__cplusplus) && __cplusplus >= 201103L) || \ __has_extension(cxx_static_assert) #define _Static_assert(x, y) static_assert(x, y) +#elif __GNUC_PREREQ__(4,6) +/* Nothing, gcc 4.6 and higher has _Static_assert built-in */ #elif defined(__COUNTER__) #define _Static_assert(x, y) __Static_assert(x, __COUNTER__) #define __Static_assert(x, y) ___Static_assert(x, y) From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 03:05:56 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 88E4F110; Fri, 10 Oct 2014 03:05:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 726D93E7; Fri, 10 Oct 2014 03:05:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9A35utF082206; Fri, 10 Oct 2014 03:05:56 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9A35uAZ082205; Fri, 10 Oct 2014 03:05:56 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410100305.s9A35uAZ082205@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Fri, 10 Oct 2014 03:05:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272884 - head/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 03:05:56 -0000 Author: delphij Date: Fri Oct 10 03:05:55 2014 New Revision: 272884 URL: https://svnweb.freebsd.org/changeset/base/272884 Log: accept(2) may and can return EAGAIN, document it. MFC after: 1 week Modified: head/lib/libc/sys/accept.2 Modified: head/lib/libc/sys/accept.2 ============================================================================== --- head/lib/libc/sys/accept.2 Fri Oct 10 01:01:04 2014 (r272883) +++ head/lib/libc/sys/accept.2 Fri Oct 10 03:05:55 2014 (r272884) @@ -28,7 +28,7 @@ .\" @(#)accept.2 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd October 1, 2013 +.Dd October 9, 2014 .Dt ACCEPT 2 .Os .Sh NAME @@ -201,7 +201,7 @@ The .Fa addr argument is not in a writable part of the user address space. -.It Bq Er EWOULDBLOCK +.It Bo Er EWOULDBLOCK Bc or Bq Er EAGAIN The socket is marked non-blocking and no connections are present to be accepted. .It Bq Er ECONNABORTED From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 03:20:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7D748335; Fri, 10 Oct 2014 03:20:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6AC2A6CD; Fri, 10 Oct 2014 03:20:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9A3KDqk088066; Fri, 10 Oct 2014 03:20:13 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9A3KDKB088065; Fri, 10 Oct 2014 03:20:13 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201410100320.s9A3KDKB088065@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Fri, 10 Oct 2014 03:20:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272885 - head/sbin/swapon X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 03:20:13 -0000 Author: hrs Date: Fri Oct 10 03:20:12 2014 New Revision: 272885 URL: https://svnweb.freebsd.org/changeset/base/272885 Log: Do not add late flag when file= is specified because it has a bad side-effect. The specified file should exist before the fstab line. Reported by: wblock (long time ago) MFC after: 1 day Modified: head/sbin/swapon/swapon.c Modified: head/sbin/swapon/swapon.c ============================================================================== --- head/sbin/swapon/swapon.c Fri Oct 10 03:05:55 2014 (r272884) +++ head/sbin/swapon/swapon.c Fri Oct 10 03:20:12 2014 (r272885) @@ -172,15 +172,8 @@ main(int argc, char **argv) continue; if (strstr(fsp->fs_mntops, "noauto") != NULL) continue; - /* - * Forcibly enable "late" option when file= is - * specified. This is because mounting file - * systems with rw option is typically - * required to make the backing store ready. - */ if (which_prog != SWAPOFF && - (strstr(fsp->fs_mntops, "late") != NULL || - strstr(fsp->fs_mntops, "file=") != NULL) && + strstr(fsp->fs_mntops, "late") && late == 0) continue; swfile = swap_on_off(fsp->fs_spec, 1, From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 04:52:00 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DC1F0D90; Fri, 10 Oct 2014 04:51:59 +0000 (UTC) Received: from smtp2.wemm.org (smtp2.wemm.org [192.203.228.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp2.wemm.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 700E3F10; Fri, 10 Oct 2014 04:51:59 +0000 (UTC) Received: from overcee.wemm.org (canning.wemm.org [192.203.228.65]) by smtp2.wemm.org (Postfix) with ESMTP id C078833E; Thu, 9 Oct 2014 21:51:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=m20140428; t=1412916718; bh=l+GUc5F4cZ2gcqpH040lnaX9JPPsAaBlq7k2Y0aSHzM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=fle2KBrN4k6J/i4LkG6xz5sTsj8aSwuSAOkeFkLcrWVciWDRE5w9B5rX1VsgAr7hp raBaNQE6NJyOQ4i1P5UXrgOIska+yhO3EJTY6eW0sYzhUxToyFOrzQFfcbc94eQ1b5 A5jUz7PLvtW5DspO5MsHyU9pr9fx9WMpthiG0CqA= From: Peter Wemm To: Baptiste Daroussin Subject: Re: svn commit: r272827 - head Date: Thu, 09 Oct 2014 21:51:54 -0700 Message-ID: <1467763.xYzL2ym5JW@overcee.wemm.org> User-Agent: KMail/4.12.5 (FreeBSD/11.0-CURRENT; KDE/4.12.5; amd64; ; ) In-Reply-To: <201410091552.s99Fq1jI059329@svn.freebsd.org> References: <201410091552.s99Fq1jI059329@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart8713087.o5KmKOXE4z"; micalg="pgp-sha1"; protocol="application/pgp-signature" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 04:52:00 -0000 --nextPart8713087.o5KmKOXE4z Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" On Thursday, October 09, 2014 03:52:01 PM Baptiste Daroussin wrote: > Author: bapt > Date: Thu Oct 9 15:52:01 2014 > New Revision: 272827 > URL: https://svnweb.freebsd.org/changeset/base/272827 >=20 > Log: > Add size(1) to the cross build toolchain >=20 > Modified: > head/Makefile.inc1 >=20 > Modified: head/Makefile.inc1 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > =3D=3D --- head/Makefile.inc1=09Thu Oct 9 15:35:28 2014=09(r272826) > +++ head/Makefile.inc1=09Thu Oct 9 15:52:01 2014=09(r272827) > @@ -315,7 +315,7 @@ X${COMPILER}?=3D=09${CROSS_COMPILER_PREFIX}$ > X${COMPILER}?=3D=09${${COMPILER}} > .endif > .endfor > -XBINUTILS=3D=09AS AR LD NM OBJCOPY OBJDUMP RANLIB STRINGS > +XBINUTILS=3D=09AS AR LD NM OBJCOPY OBJDUMP RANLIB SIZE STRINGS > .for BINUTIL in ${XBINUTILS} > .if defined(CROSS_BINUTILS_PREFIX) > X${BINUTIL}?=3D=09${CROSS_BINUTILS_PREFIX}${${BINUTIL}} > @@ -327,7 +327,8 @@ WMAKEENV+=3D=09CC=3D"${XCC} ${XFLAGS}" CXX=3D"${ > =09=09CPP=3D"${XCPP} ${XFLAGS}" \ > =09=09AS=3D"${XAS}" AR=3D"${XAR}" LD=3D"${XLD}" NM=3D${XNM} \ > =09=09OBJDUMP=3D${XOBJDUMP} OBJCOPY=3D"${XOBJCOPY}" \ > -=09=09RANLIB=3D${XRANLIB} STRINGS=3D${XSTRINGS} > +=09=09RANLIB=3D${XRANLIB} STRINGS=3D${XSTRINGS} \ > +=09=09SIZE=3D"${XSIZE}" >=20 > .if ${XCC:M/*} > XFLAGS=3D=09=09--sysroot=3D${WORLDTMP} This broke 'make buildkernel'. kern.pre.mk: SIZE?=3D size kern.post.mk: SYSTEM_LD_TAIL=3D @${OBJCOPY} --strip-symbol gcc2_compiled. ${.TARGET} = ; \ ${SIZE} ${.TARGET} ; chmod 755 ${.TARGET} This is getting executed as: objcopy --strip-symbol gcc2_compiled. .kernel ; kernel ; chmod 755 kern= el ie: "kernel" instead of "size kernel". XSIZE isn't set for the non-cro= ss=20 case. =2D-=20 Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI= 6FJV UTF-8: for when a ' or ... just won\342\200\231t do\342\200\246 --nextPart8713087.o5KmKOXE4z Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABAgAGBQJUN2XuAAoJEDXWlwnsgJ4EX40H/0ctx2Usk7lmFHsXce4VrTr1 M8MeUimo+CRYsLJcOU9h7B6nVLMTOEREHMBTDx66SbAP/x9RoROLLkAk5dSqLu+E qfjAcYH8bW0dQX6msHJ8x6hStMHVeC4zuvB8z4/yEWk/C7sgMb+Qg/Tc7ydr+qbe Eig8bSbgWqJBuU76v6iKvQNKJ6EmKXU32Rl/cI5B1OSmH1QYphxaOOscdXBZR+sr pAjmOHOiqa38XG5XB+hYqE8Gaqtw9paBp7zhlBvqkgcetRQGHz5RSWRSH1Zc0RHK sZcJr5zktuaRZnQw1d+hHoxObSZST6woT9JiG4XJkgC4jOqqojJhp4YQtHfIgiA= =CK84 -----END PGP SIGNATURE----- --nextPart8713087.o5KmKOXE4z-- From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 06:09:01 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4101148C; Fri, 10 Oct 2014 06:09:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2CB68810; Fri, 10 Oct 2014 06:09:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9A6917Q067755; Fri, 10 Oct 2014 06:09:01 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9A690NU067686; Fri, 10 Oct 2014 06:09:00 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201410100609.s9A690NU067686@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Fri, 10 Oct 2014 06:09:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272886 - in head/sys: netinet netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 06:09:01 -0000 Author: bryanv Date: Fri Oct 10 06:08:59 2014 New Revision: 272886 URL: https://svnweb.freebsd.org/changeset/base/272886 Log: Add context pointer and source address to the UDP tunnel callback These are needed for the forthcoming vxlan implementation. The context pointer means we do not have to use a spare pointer field in the inpcb, and the source address is required to populate vxlan's forwarding table. While I highly doubt there is an out of tree consumer of the UDP tunneling callback, this change may be a difficult to eventually MFC. Phabricator: https://reviews.freebsd.org/D383 Reviewed by: gnn Modified: head/sys/netinet/sctputil.c head/sys/netinet/udp_usrreq.c head/sys/netinet/udp_var.h head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Fri Oct 10 03:20:12 2014 (r272885) +++ head/sys/netinet/sctputil.c Fri Oct 10 06:08:59 2014 (r272886) @@ -6832,7 +6832,8 @@ sctp_log_trace(uint32_t subsys, const ch #endif static void -sctp_recv_udp_tunneled_packet(struct mbuf *m, int off, struct inpcb *ignored) +sctp_recv_udp_tunneled_packet(struct mbuf *m, int off, struct inpcb *ignored, + const struct sockaddr *sa SCTP_UNUSED, void *ctx SCTP_UNUSED) { struct ip *iph; @@ -6968,7 +6969,7 @@ sctp_over_udp_start(void) } /* Call the special UDP hook. */ if ((ret = udp_set_kernel_tunneling(SCTP_BASE_INFO(udp4_tun_socket), - sctp_recv_udp_tunneled_packet))) { + sctp_recv_udp_tunneled_packet, NULL))) { sctp_over_udp_stop(); return (ret); } @@ -6992,7 +6993,7 @@ sctp_over_udp_start(void) } /* Call the special UDP hook. */ if ((ret = udp_set_kernel_tunneling(SCTP_BASE_INFO(udp6_tun_socket), - sctp_recv_udp_tunneled_packet))) { + sctp_recv_udp_tunneled_packet, NULL))) { sctp_over_udp_stop(); return (ret); } Modified: head/sys/netinet/udp_usrreq.c ============================================================================== --- head/sys/netinet/udp_usrreq.c Fri Oct 10 03:20:12 2014 (r272885) +++ head/sys/netinet/udp_usrreq.c Fri Oct 10 06:08:59 2014 (r272886) @@ -312,7 +312,8 @@ udp_append(struct inpcb *inp, struct ip */ up = intoudpcb(inp); if (up->u_tun_func != NULL) { - (*up->u_tun_func)(n, off, inp); + (*up->u_tun_func)(n, off, inp, (struct sockaddr *)udp_in, + up->u_tun_ctx); return; } @@ -1717,7 +1718,7 @@ udp_attach(struct socket *so, int proto, #endif /* INET */ int -udp_set_kernel_tunneling(struct socket *so, udp_tun_func_t f) +udp_set_kernel_tunneling(struct socket *so, udp_tun_func_t f, void *ctx) { struct inpcb *inp; struct udpcb *up; @@ -1733,6 +1734,7 @@ udp_set_kernel_tunneling(struct socket * return (EBUSY); } up->u_tun_func = f; + up->u_tun_ctx = ctx; INP_WUNLOCK(inp); return (0); } Modified: head/sys/netinet/udp_var.h ============================================================================== --- head/sys/netinet/udp_var.h Fri Oct 10 03:20:12 2014 (r272885) +++ head/sys/netinet/udp_var.h Fri Oct 10 06:08:59 2014 (r272886) @@ -55,7 +55,8 @@ struct udpiphdr { struct inpcb; struct mbuf; -typedef void(*udp_tun_func_t)(struct mbuf *, int off, struct inpcb *); +typedef void(*udp_tun_func_t)(struct mbuf *, int off, struct inpcb *, + const struct sockaddr *, void *); /* * UDP control block; one per udp. @@ -65,6 +66,7 @@ struct udpcb { u_int u_flags; /* Generic UDP flags. */ uint16_t u_rxcslen; /* Coverage for incoming datagrams. */ uint16_t u_txcslen; /* Coverage for outgoing datagrams. */ + void *u_tun_ctx; /* Tunneling callback context. */ }; #define intoudpcb(ip) ((struct udpcb *)(ip)->inp_ppcb) @@ -176,7 +178,8 @@ void udplite_input(struct mbuf *, int); struct inpcb *udp_notify(struct inpcb *inp, int errno); int udp_shutdown(struct socket *so); -int udp_set_kernel_tunneling(struct socket *so, udp_tun_func_t f); +int udp_set_kernel_tunneling(struct socket *so, udp_tun_func_t f, + void *ctx); #endif /* _KERNEL */ Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Fri Oct 10 03:20:12 2014 (r272885) +++ head/sys/netinet6/udp6_usrreq.c Fri Oct 10 06:08:59 2014 (r272886) @@ -150,7 +150,8 @@ udp6_append(struct inpcb *inp, struct mb */ up = intoudpcb(inp); if (up->u_tun_func != NULL) { - (*up->u_tun_func)(n, off, inp); + (*up->u_tun_func)(n, off, inp, (struct sockaddr *)fromsa, + up->u_tun_ctx); return; } #ifdef IPSEC From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 06:09:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E21615DB; Fri, 10 Oct 2014 06:09:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CE99D81A; Fri, 10 Oct 2014 06:09:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9A69lDW067885; Fri, 10 Oct 2014 06:09:47 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9A69lZ6067884; Fri, 10 Oct 2014 06:09:47 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410100609.s9A69lZ6067884@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 10 Oct 2014 06:09:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272887 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 06:09:48 -0000 Author: bapt Date: Fri Oct 10 06:09:47 2014 New Revision: 272887 URL: https://svnweb.freebsd.org/changeset/base/272887 Log: Make sure SIZE is defined early Modified: head/share/mk/sys.mk Modified: head/share/mk/sys.mk ============================================================================== --- head/share/mk/sys.mk Fri Oct 10 06:08:59 2014 (r272886) +++ head/share/mk/sys.mk Fri Oct 10 06:09:47 2014 (r272887) @@ -146,6 +146,10 @@ RFLAGS ?= SHELL ?= sh +.if !defined(%POSIX) +SIZE ?= size +.endif + YACC ?= yacc .if defined(%POSIX) YFLAGS ?= From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 06:24:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 23245982; Fri, 10 Oct 2014 06:24:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D0B69AF; Fri, 10 Oct 2014 06:24:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9A6OCjL076550; Fri, 10 Oct 2014 06:24:12 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9A6OAVo076537; Fri, 10 Oct 2014 06:24:10 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410100624.s9A6OAVo076537@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 10 Oct 2014 06:24:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272888 - in head: contrib/binutils/bfd contrib/binutils/gas/config contrib/binutils/ld/emulparams sys/boot/powerpc/ofw sys/boot/powerpc/ps3 sys/boot/powerpc/uboot sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 06:24:13 -0000 Author: bapt Date: Fri Oct 10 06:24:09 2014 New Revision: 272888 URL: https://svnweb.freebsd.org/changeset/base/272888 Log: Rename elf*-powerpc into elf*-powerpc-freebsd in binutils The powerpc support was the only supported architecture not prepending the elf format name with "-freebsd" in base this change makes it consistent with other architectures. On newer version of binutils the powerpc format is also prepended with "-freebsd". Also modify the kernel ldscripts in that regards. As a result it is now possible cross build the kernel on powerpc using newer binutils Differential Revision: https://reviews.freebsd.org/D926 Differential Revision: https://reviews.freebsd.org/D928 Modified: head/contrib/binutils/bfd/elf32-ppc.c head/contrib/binutils/bfd/elf64-ppc.c head/contrib/binutils/gas/config/tc-ppc.c head/contrib/binutils/ld/emulparams/elf32ppc_fbsd.sh head/contrib/binutils/ld/emulparams/elf64ppc_fbsd.sh head/sys/boot/powerpc/ofw/ldscript.powerpc head/sys/boot/powerpc/ps3/ldscript.powerpc head/sys/boot/powerpc/uboot/ldscript.powerpc head/sys/conf/ldscript.powerpc head/sys/conf/ldscript.powerpc64 Modified: head/contrib/binutils/bfd/elf32-ppc.c ============================================================================== --- head/contrib/binutils/bfd/elf32-ppc.c Fri Oct 10 06:09:47 2014 (r272887) +++ head/contrib/binutils/bfd/elf32-ppc.c Fri Oct 10 06:24:09 2014 (r272888) @@ -7572,7 +7572,7 @@ ppc_elf_finish_dynamic_sections (bfd *ou #define TARGET_LITTLE_SYM bfd_elf32_powerpcle_vec #define TARGET_LITTLE_NAME "elf32-powerpcle" #define TARGET_BIG_SYM bfd_elf32_powerpc_vec -#define TARGET_BIG_NAME "elf32-powerpc" +#define TARGET_BIG_NAME "elf32-powerpc-freebsd" #define ELF_ARCH bfd_arch_powerpc #define ELF_MACHINE_CODE EM_PPC #ifdef __QNXTARGET__ Modified: head/contrib/binutils/bfd/elf64-ppc.c ============================================================================== --- head/contrib/binutils/bfd/elf64-ppc.c Fri Oct 10 06:09:47 2014 (r272887) +++ head/contrib/binutils/bfd/elf64-ppc.c Fri Oct 10 06:24:09 2014 (r272888) @@ -58,7 +58,7 @@ static bfd_vma opd_entry_value #define TARGET_LITTLE_SYM bfd_elf64_powerpcle_vec #define TARGET_LITTLE_NAME "elf64-powerpcle" #define TARGET_BIG_SYM bfd_elf64_powerpc_vec -#define TARGET_BIG_NAME "elf64-powerpc" +#define TARGET_BIG_NAME "elf64-powerpc-freebsd" #define ELF_ARCH bfd_arch_powerpc #define ELF_MACHINE_CODE EM_PPC64 #define ELF_MAXPAGESIZE 0x10000 Modified: head/contrib/binutils/gas/config/tc-ppc.c ============================================================================== --- head/contrib/binutils/gas/config/tc-ppc.c Fri Oct 10 06:09:47 2014 (r272887) +++ head/contrib/binutils/gas/config/tc-ppc.c Fri Oct 10 06:24:09 2014 (r272888) @@ -1210,7 +1210,7 @@ ppc_target_format (void) return "elf32-powerpc-vxworks"; # else return (target_big_endian - ? (ppc_obj64 ? "elf64-powerpc" : "elf32-powerpc") + ? (ppc_obj64 ? "elf64-powerpc-freebsd" : "elf32-powerpc-freebsd") : (ppc_obj64 ? "elf64-powerpcle" : "elf32-powerpcle")); # endif #endif Modified: head/contrib/binutils/ld/emulparams/elf32ppc_fbsd.sh ============================================================================== --- head/contrib/binutils/ld/emulparams/elf32ppc_fbsd.sh Fri Oct 10 06:09:47 2014 (r272887) +++ head/contrib/binutils/ld/emulparams/elf32ppc_fbsd.sh Fri Oct 10 06:24:09 2014 (r272888) @@ -1,2 +1,4 @@ . ${srcdir}/emulparams/elf32ppc.sh . ${srcdir}/emulparams/elf_fbsd.sh + +OUTPUT_FORMAT="elf32-powerpc-freebsd" Modified: head/contrib/binutils/ld/emulparams/elf64ppc_fbsd.sh ============================================================================== --- head/contrib/binutils/ld/emulparams/elf64ppc_fbsd.sh Fri Oct 10 06:09:47 2014 (r272887) +++ head/contrib/binutils/ld/emulparams/elf64ppc_fbsd.sh Fri Oct 10 06:24:09 2014 (r272888) @@ -1,3 +1,4 @@ . ${srcdir}/emulparams/elf64ppc.sh . ${srcdir}/emulparams/elf_fbsd.sh +OUTPUT_FORMAT="elf64-powerpc-freebsd" Modified: head/sys/boot/powerpc/ofw/ldscript.powerpc ============================================================================== --- head/sys/boot/powerpc/ofw/ldscript.powerpc Fri Oct 10 06:09:47 2014 (r272887) +++ head/sys/boot/powerpc/ofw/ldscript.powerpc Fri Oct 10 06:24:09 2014 (r272888) @@ -1,6 +1,7 @@ /* $FreeBSD$ */ -OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") +OUTPUT_FORMAT("elf32-powerpc-freebsd", "elf32-powerpc-freebsd", + "elf32-powerpc-freebsd") OUTPUT_ARCH(powerpc:common) ENTRY(_start) SEARCH_DIR(/usr/lib); Modified: head/sys/boot/powerpc/ps3/ldscript.powerpc ============================================================================== --- head/sys/boot/powerpc/ps3/ldscript.powerpc Fri Oct 10 06:09:47 2014 (r272887) +++ head/sys/boot/powerpc/ps3/ldscript.powerpc Fri Oct 10 06:24:09 2014 (r272888) @@ -1,6 +1,7 @@ /* $FreeBSD$ */ -OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") +OUTPUT_FORMAT("elf32-powerpc-freebsd", "elf32-powerpc-freebsd", + "elf32-powerpc-freebsd") OUTPUT_ARCH(powerpc:common) ENTRY(_start) SEARCH_DIR(/usr/lib); Modified: head/sys/boot/powerpc/uboot/ldscript.powerpc ============================================================================== --- head/sys/boot/powerpc/uboot/ldscript.powerpc Fri Oct 10 06:09:47 2014 (r272887) +++ head/sys/boot/powerpc/uboot/ldscript.powerpc Fri Oct 10 06:24:09 2014 (r272888) @@ -1,6 +1,7 @@ /* $FreeBSD$ */ -OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") +OUTPUT_FORMAT("elf32-powerpc-freebsd", "elf32-powerpc-freebsd", + "elf32-powerpc-freebsd") OUTPUT_ARCH(powerpc:common) ENTRY(_start) SEARCH_DIR(/usr/lib); Modified: head/sys/conf/ldscript.powerpc ============================================================================== --- head/sys/conf/ldscript.powerpc Fri Oct 10 06:09:47 2014 (r272887) +++ head/sys/conf/ldscript.powerpc Fri Oct 10 06:24:09 2014 (r272888) @@ -1,6 +1,7 @@ /* $FreeBSD$ */ -OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") +OUTPUT_FORMAT("elf32-powerpc-freebsd", "elf32-powerpc-freebsd", + "elf32-powerpc-freebsd") OUTPUT_ARCH(powerpc) ENTRY(__start) SEARCH_DIR(/usr/lib); Modified: head/sys/conf/ldscript.powerpc64 ============================================================================== --- head/sys/conf/ldscript.powerpc64 Fri Oct 10 06:09:47 2014 (r272887) +++ head/sys/conf/ldscript.powerpc64 Fri Oct 10 06:24:09 2014 (r272888) @@ -1,6 +1,7 @@ /* $FreeBSD$ */ -OUTPUT_FORMAT("elf64-powerpc", "elf64-powerpc", "elf64-powerpc") +OUTPUT_FORMAT("elf64-powerpc-freebsd", "elf64-powerpc-freebsd", + "elf64-powerpc-freebsd") OUTPUT_ARCH(powerpc:common64) ENTRY(__start) SEARCH_DIR(/usr/lib); From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 06:45:14 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6B694E22; Fri, 10 Oct 2014 06:45:14 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CE13B71; Fri, 10 Oct 2014 06:45:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9A6jEgY085866; Fri, 10 Oct 2014 06:45:14 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9A6jEXH085865; Fri, 10 Oct 2014 06:45:14 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201410100645.s9A6jEXH085865@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Fri, 10 Oct 2014 06:45:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272889 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 06:45:14 -0000 Author: hrs Date: Fri Oct 10 06:45:13 2014 New Revision: 272889 URL: https://svnweb.freebsd.org/changeset/base/272889 Log: Virtualize if_epair(4). An if_xname check for both "a" and "b" interfaces is added to return EEXIST when only "b" interface exists---this can happen when epairb is moved to a vnet jail and then "ifconfig epair create" is invoked there. Modified: head/sys/net/if_epair.c Modified: head/sys/net/if_epair.c ============================================================================== --- head/sys/net/if_epair.c Fri Oct 10 06:24:09 2014 (r272888) +++ head/sys/net/if_epair.c Fri Oct 10 06:45:13 2014 (r272889) @@ -101,7 +101,7 @@ static int epair_clone_destroy(struct if static const char epairname[] = "epair"; -/* Netisr realted definitions and sysctl. */ +/* Netisr related definitions and sysctl. */ static struct netisr_handler epair_nh = { .nh_name = epairname, .nh_proto = NETISR_EPAIR, @@ -172,7 +172,8 @@ STAILQ_HEAD(eid_list, epair_ifp_drain); static MALLOC_DEFINE(M_EPAIR, epairname, "Pair of virtual cross-over connected Ethernet-like interfaces"); -static struct if_clone *epair_cloner; +static VNET_DEFINE(struct if_clone *, epair_cloner); +#define V_epair_cloner VNET(epair_cloner) /* * DPCPU area and functions. @@ -760,10 +761,17 @@ epair_clone_create(struct if_clone *ifc, ifc_free_unit(ifc, unit); return (ENOSPC); } - *dp = 'a'; + *dp = 'b'; /* Must not change dp so we can replace 'a' by 'b' later. */ *(dp+1) = '\0'; + /* Check if 'a' and 'b' interfaces already exist. */ + if (ifunit(name) != NULL) + return (EEXIST); + *dp = 'a'; + if (ifunit(name) != NULL) + return (EEXIST); + /* Allocate memory for both [ab] interfaces */ sca = malloc(sizeof(struct epair_softc), M_EPAIR, M_WAITOK | M_ZERO); EPAIR_REFCOUNT_INIT(&sca->refcount, 1); @@ -944,6 +952,25 @@ epair_clone_destroy(struct if_clone *ifc return (0); } +static void +vnet_epair_init(const void *unused __unused) +{ + + V_epair_cloner = if_clone_advanced(epairname, 0, + epair_clone_match, epair_clone_create, epair_clone_destroy); +} +VNET_SYSINIT(vnet_epair_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, + vnet_epair_init, NULL); + +static void +vnet_epair_uninit(const void *unused __unused) +{ + + if_clone_detach(V_epair_cloner); +} +VNET_SYSUNINIT(vnet_epair_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, + vnet_epair_uninit, NULL); + static int epair_modevent(module_t mod, int type, void *data) { @@ -957,13 +984,10 @@ epair_modevent(module_t mod, int type, v if (TUNABLE_INT_FETCH("net.link.epair.netisr_maxqlen", &qlimit)) epair_nh.nh_qlimit = qlimit; netisr_register(&epair_nh); - epair_cloner = if_clone_advanced(epairname, 0, - epair_clone_match, epair_clone_create, epair_clone_destroy); if (bootverbose) printf("%s initialized.\n", epairname); break; case MOD_UNLOAD: - if_clone_detach(epair_cloner); netisr_unregister(&epair_nh); epair_dpcpu_detach(); if (bootverbose) From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 08:35:17 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 80902F83; Fri, 10 Oct 2014 08:35:17 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6CED486B; Fri, 10 Oct 2014 08:35:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9A8ZHvZ037501; Fri, 10 Oct 2014 08:35:17 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9A8ZH0u037500; Fri, 10 Oct 2014 08:35:17 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410100835.s9A8ZH0u037500@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 10 Oct 2014 08:35:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272890 - head/contrib/netbsd-tests/lib/libc/stdlib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 08:35:17 -0000 Author: ngie Date: Fri Oct 10 08:35:16 2014 New Revision: 272890 URL: https://svnweb.freebsd.org/changeset/base/272890 Log: Only build/run hsearch_basic and hsearch_r_basic on NetBSD hdestroy1 is not present on FreeBSD Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/stdlib/t_hsearch.c Modified: head/contrib/netbsd-tests/lib/libc/stdlib/t_hsearch.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/stdlib/t_hsearch.c Fri Oct 10 06:45:13 2014 (r272889) +++ head/contrib/netbsd-tests/lib/libc/stdlib/t_hsearch.c Fri Oct 10 08:35:16 2014 (r272890) @@ -75,6 +75,7 @@ __RCSID("$NetBSD: t_hsearch.c,v 1.4 2014 #define REQUIRE_ERRNO(x) ATF_REQUIRE_MSG(x, "%s", strerror(errno)) +#if defined(__NetBSD__) ATF_TC(hsearch_basic); ATF_TC_HEAD(hsearch_basic, tc) { @@ -123,6 +124,7 @@ ATF_TC_BODY(hsearch_basic, tc) hdestroy1(free, NULL); } +#endif ATF_TC(hsearch_duplicate); ATF_TC_HEAD(hsearch_duplicate, tc) @@ -229,6 +231,7 @@ ATF_TC_BODY(hsearch_two, tc) hdestroy(); } +#if defined(__NetBSD__) ATF_TC(hsearch_r_basic); ATF_TC_HEAD(hsearch_r_basic, tc) { @@ -276,6 +279,7 @@ ATF_TC_BODY(hsearch_r_basic, tc) hdestroy1_r(&t, free, NULL); } +#endif ATF_TC(hsearch_r_duplicate); ATF_TC_HEAD(hsearch_r_duplicate, tc) @@ -385,12 +389,16 @@ ATF_TC_BODY(hsearch_r_two, tc) ATF_TP_ADD_TCS(tp) { +#if defined(__NetBSD__) ATF_TP_ADD_TC(tp, hsearch_basic); +#endif ATF_TP_ADD_TC(tp, hsearch_duplicate); ATF_TP_ADD_TC(tp, hsearch_nonexistent); ATF_TP_ADD_TC(tp, hsearch_two); +#if defined(__NetBSD__) ATF_TP_ADD_TC(tp, hsearch_r_basic); +#endif ATF_TP_ADD_TC(tp, hsearch_r_duplicate); ATF_TP_ADD_TC(tp, hsearch_r_nonexistent); ATF_TP_ADD_TC(tp, hsearch_r_two); From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 08:57:56 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3019D3B9; Fri, 10 Oct 2014 08:57:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1CC2BA45; Fri, 10 Oct 2014 08:57:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9A8vtIN047277; Fri, 10 Oct 2014 08:57:55 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9A8vtvh047276; Fri, 10 Oct 2014 08:57:55 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410100857.s9A8vtvh047276@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 10 Oct 2014 08:57:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272891 - head/contrib/netbsd-tests/lib/libc/stdlib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 08:57:56 -0000 Author: ngie Date: Fri Oct 10 08:57:55 2014 New Revision: 272891 URL: https://svnweb.freebsd.org/changeset/base/272891 Log: Expect SIGSEGV in lib/libc/stdlib/t_getenv:setenv_basic See bin/189805 for more details In collaboration with: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/stdlib/t_getenv.c Modified: head/contrib/netbsd-tests/lib/libc/stdlib/t_getenv.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/stdlib/t_getenv.c Fri Oct 10 08:35:16 2014 (r272890) +++ head/contrib/netbsd-tests/lib/libc/stdlib/t_getenv.c Fri Oct 10 08:57:55 2014 (r272891) @@ -40,6 +40,9 @@ __RCSID("$NetBSD: t_getenv.c,v 1.2 2011/ #include #include #include +#if defined(__FreeBSD__) +#include +#endif extern char **environ; @@ -152,6 +155,15 @@ ATF_TC_BODY(setenv_basic, tc) ATF_CHECK_ERRNO(EINVAL, setenv(NULL, "val", 1) == -1); ATF_CHECK_ERRNO(EINVAL, setenv("", "val", 1) == -1); ATF_CHECK_ERRNO(EINVAL, setenv("v=r", "val", 1) == -1); +#if defined(__FreeBSD__) + /* + Both FreeBSD and OS/X does not validate the second + argument to setenv(3) + */ + atf_tc_expect_signal(SIGSEGV, "FreeBSD does not validate the second " + "argument to setenv(3); see bin/189805"); +#endif + ATF_CHECK_ERRNO(EINVAL, setenv("var", NULL, 1) == -1); ATF_CHECK(setenv("var", "=val", 1) == 0); From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 12:38:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 20BD069C; Fri, 10 Oct 2014 12:38:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0C6AA28D; Fri, 10 Oct 2014 12:38:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9ACcsYQ050397; Fri, 10 Oct 2014 12:38:54 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9ACcrxo050395; Fri, 10 Oct 2014 12:38:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410101238.s9ACcrxo050395@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 10 Oct 2014 12:38:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272893 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 12:38:54 -0000 Author: mav Date: Fri Oct 10 12:38:53 2014 New Revision: 272893 URL: https://svnweb.freebsd.org/changeset/base/272893 Log: Store persistent reservation keys as uint64_t instead of uint8_t[8]. This allows to simplify the code and save 512KB of RAM per LUN (8%) by removing no longer needed "registered" keys flags. Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_private.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Fri Oct 10 12:02:34 2014 (r272892) +++ head/sys/cam/ctl/ctl.c Fri Oct 10 12:38:53 2014 (r272893) @@ -2990,12 +2990,11 @@ ctl_ioctl(struct cdev *dev, u_long cmd, for (j = 0; j < (CTL_MAX_PORTS * 2); j++) { for (k = 0; k < CTL_MAX_INIT_PER_PORT; k++){ idx = j * CTL_MAX_INIT_PER_PORT + k; - if (lun->per_res[idx].registered == 0) + if (lun->pr_keys[idx] == 0) continue; printf(" LUN %d port %d iid %d key " "%#jx\n", i, j, k, - (uintmax_t)scsi_8btou64( - lun->per_res[idx].res_key.key)); + (uintmax_t)lun->pr_keys[idx]); } } } @@ -5536,7 +5535,7 @@ ctl_start_stop(struct ctl_scsiio *ctsio) uint32_t residx; residx = ctl_get_resindex(&ctsio->io_hdr.nexus); - if (!lun->per_res[residx].registered + if (lun->pr_keys[residx] == 0 || (lun->pr_res_idx!=residx && lun->res_type < 4)) { ctl_set_reservation_conflict(ctsio); @@ -5827,7 +5826,7 @@ ctl_read_buffer(struct ctl_scsiio *ctsio && residx != lun->pr_res_idx) || ((lun->res_type == SPR_TYPE_EX_AC_RO || lun->res_type == SPR_TYPE_EX_AC_AR) - && !lun->per_res[residx].registered)) { + && lun->pr_keys[residx] == 0)) { ctl_set_reservation_conflict(ctsio); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); @@ -6882,7 +6881,7 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) && residx != lun->pr_res_idx) || ((lun->res_type == SPR_TYPE_EX_AC_RO || lun->res_type == SPR_TYPE_EX_AC_AR) - && !lun->per_res[residx].registered)) { + && lun->pr_keys[residx] == 0)) { ctl_set_reservation_conflict(ctsio); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); @@ -7825,7 +7824,7 @@ retry: lun->pr_key_count, res_keys->header.length); for (i = 0, key_count = 0; i < 2*CTL_MAX_INITIATORS; i++) { - if (!lun->per_res[i].registered) + if (lun->pr_keys[i] == 0) continue; /* @@ -7851,10 +7850,8 @@ retry: key_count++; continue; } - memcpy(res_keys->keys[key_count].key, - lun->per_res[i].res_key.key, - ctl_min(sizeof(res_keys->keys[key_count].key), - sizeof(lun->per_res[i].res_key))); + scsi_u64to8b(lun->pr_keys[i], + res_keys->keys[key_count].key); key_count++; } break; @@ -7905,9 +7902,8 @@ retry: * is 0, since it doesn't really matter. */ if (lun->pr_res_idx != CTL_PR_ALL_REGISTRANTS) { - memcpy(res->data.reservation, - &lun->per_res[lun->pr_res_idx].res_key, - sizeof(struct scsi_per_res_key)); + scsi_u64to8b(lun->pr_keys[lun->pr_res_idx], + res->data.reservation); } res->data.scopetype = lun->res_type; break; @@ -7958,11 +7954,10 @@ retry: res_desc = &res_status->desc[0]; for (i = 0; i < 2*CTL_MAX_INITIATORS; i++) { - if (!lun->per_res[i].registered) + if (lun->pr_keys[i] == 0) continue; - memcpy(&res_desc->res_key, &lun->per_res[i].res_key.key, - sizeof(res_desc->res_key)); + scsi_u64to8b(lun->pr_keys[i], res_desc->res_key.key); if ((lun->flags & CTL_LUN_PR_RESERVED) && (lun->pr_res_idx == i || lun->pr_res_idx == CTL_PR_ALL_REGISTRANTS)) { @@ -8055,15 +8050,12 @@ ctl_pro_preempt(struct ctl_softc *softc, return (1); } - /* temporarily unregister this nexus */ - lun->per_res[residx].registered = 0; - /* * Unregister everybody else and build UA for * them */ for(i=0; i < 2*CTL_MAX_INITIATORS; i++) { - if (lun->per_res[i].registered == 0) + if (i == residx || lun->pr_keys[i] == 0) continue; if (!persis_offset @@ -8074,11 +8066,8 @@ ctl_pro_preempt(struct ctl_softc *softc, && i >= persis_offset) lun->pending_ua[i-persis_offset] |= CTL_UA_REG_PREEMPT; - lun->per_res[i].registered = 0; - memset(&lun->per_res[i].res_key, 0, - sizeof(struct scsi_per_res_key)); + lun->pr_keys[i] = 0; } - lun->per_res[residx].registered = 1; lun->pr_key_count = 1; lun->res_type = type; if (lun->res_type != SPR_TYPE_WR_EX_AR @@ -8142,16 +8131,11 @@ ctl_pro_preempt(struct ctl_softc *softc, } for (i=0; i < 2*CTL_MAX_INITIATORS; i++) { - if (lun->per_res[i].registered - && memcmp(param->serv_act_res_key, - lun->per_res[i].res_key.key, - sizeof(struct scsi_per_res_key)) != 0) + if (lun->pr_keys[i] != sa_res_key) continue; found = 1; - lun->per_res[i].registered = 0; - memset(&lun->per_res[i].res_key, 0, - sizeof(struct scsi_per_res_key)); + lun->pr_keys[i] = 0; lun->pr_key_count--; if (!persis_offset && i < CTL_MAX_INITIATORS) @@ -8185,9 +8169,7 @@ ctl_pro_preempt(struct ctl_softc *softc, } else { /* Reserved but not all registrants */ /* sa_res_key is res holder */ - if (memcmp(param->serv_act_res_key, - lun->per_res[lun->pr_res_idx].res_key.key, - sizeof(struct scsi_per_res_key)) == 0) { + if (sa_res_key == lun->pr_keys[lun->pr_res_idx]) { /* validate scope and type */ if ((cdb->scope_type & SPR_SCOPE_MASK) != SPR_LU_SCOPE) { @@ -8228,22 +8210,12 @@ ctl_pro_preempt(struct ctl_softc *softc, * except don't unregister the res holder. */ - /* - * Temporarily unregister so it won't get - * removed or UA generated - */ - lun->per_res[residx].registered = 0; for(i=0; i < 2*CTL_MAX_INITIATORS; i++) { - if (lun->per_res[i].registered == 0) + if (i == residx || lun->pr_keys[i] == 0) continue; - if (memcmp(param->serv_act_res_key, - lun->per_res[i].res_key.key, - sizeof(struct scsi_per_res_key)) == 0) { - lun->per_res[i].registered = 0; - memset(&lun->per_res[i].res_key, - 0, - sizeof(struct scsi_per_res_key)); + if (sa_res_key == lun->pr_keys[i]) { + lun->pr_keys[i] = 0; lun->pr_key_count--; if (!persis_offset @@ -8268,7 +8240,6 @@ ctl_pro_preempt(struct ctl_softc *softc, CTL_UA_RES_RELEASE; } } - lun->per_res[residx].registered = 1; lun->res_type = type; if (lun->res_type != SPR_TYPE_WR_EX_AR && lun->res_type != SPR_TYPE_EX_AC_AR) @@ -8299,15 +8270,11 @@ ctl_pro_preempt(struct ctl_softc *softc, int found=0; for (i=0; i < 2*CTL_MAX_INITIATORS; i++) { - if (memcmp(param->serv_act_res_key, - lun->per_res[i].res_key.key, - sizeof(struct scsi_per_res_key)) != 0) + if (sa_res_key != lun->pr_keys[i]) continue; found = 1; - lun->per_res[i].registered = 0; - memset(&lun->per_res[i].res_key, 0, - sizeof(struct scsi_per_res_key)); + lun->pr_keys[i] = 0; lun->pr_key_count--; if (!persis_offset @@ -8354,26 +8321,22 @@ ctl_pro_preempt(struct ctl_softc *softc, static void ctl_pro_preempt_other(struct ctl_lun *lun, union ctl_ha_msg *msg) { + uint64_t sa_res_key; int i; + sa_res_key = scsi_8btou64(msg->pr.pr_info.sa_res_key); + if (lun->pr_res_idx == CTL_PR_ALL_REGISTRANTS || lun->pr_res_idx == CTL_PR_NO_RESERVATION - || memcmp(&lun->per_res[lun->pr_res_idx].res_key, - msg->pr.pr_info.sa_res_key, - sizeof(struct scsi_per_res_key)) != 0) { - uint64_t sa_res_key; - sa_res_key = scsi_8btou64(msg->pr.pr_info.sa_res_key); - + || sa_res_key != lun->pr_keys[lun->pr_res_idx]) { if (sa_res_key == 0) { - /* temporarily unregister this nexus */ - lun->per_res[msg->pr.pr_info.residx].registered = 0; - /* * Unregister everybody else and build UA for * them */ for(i=0; i < 2*CTL_MAX_INITIATORS; i++) { - if (lun->per_res[i].registered == 0) + if (i == msg->pr.pr_info.residx || + lun->pr_keys[i] == 0) continue; if (!persis_offset @@ -8383,12 +8346,9 @@ ctl_pro_preempt_other(struct ctl_lun *lu else if (persis_offset && i >= persis_offset) lun->pending_ua[i - persis_offset] |= CTL_UA_REG_PREEMPT; - lun->per_res[i].registered = 0; - memset(&lun->per_res[i].res_key, 0, - sizeof(struct scsi_per_res_key)); + lun->pr_keys[i] = 0; } - lun->per_res[msg->pr.pr_info.residx].registered = 1; lun->pr_key_count = 1; lun->res_type = msg->pr.pr_info.res_type; if (lun->res_type != SPR_TYPE_WR_EX_AR @@ -8396,14 +8356,10 @@ ctl_pro_preempt_other(struct ctl_lun *lu lun->pr_res_idx = msg->pr.pr_info.residx; } else { for (i=0; i < 2*CTL_MAX_INITIATORS; i++) { - if (memcmp(msg->pr.pr_info.sa_res_key, - lun->per_res[i].res_key.key, - sizeof(struct scsi_per_res_key)) != 0) + if (sa_res_key == lun->pr_keys[i]) continue; - lun->per_res[i].registered = 0; - memset(&lun->per_res[i].res_key, 0, - sizeof(struct scsi_per_res_key)); + lun->pr_keys[i] = 0; lun->pr_key_count--; if (!persis_offset @@ -8417,21 +8373,13 @@ ctl_pro_preempt_other(struct ctl_lun *lu } } } else { - /* - * Temporarily unregister so it won't get removed - * or UA generated - */ - lun->per_res[msg->pr.pr_info.residx].registered = 0; for (i=0; i < 2*CTL_MAX_INITIATORS; i++) { - if (lun->per_res[i].registered == 0) + if (i == msg->pr.pr_info.residx || + lun->pr_keys[i] == 0) continue; - if (memcmp(msg->pr.pr_info.sa_res_key, - lun->per_res[i].res_key.key, - sizeof(struct scsi_per_res_key)) == 0) { - lun->per_res[i].registered = 0; - memset(&lun->per_res[i].res_key, 0, - sizeof(struct scsi_per_res_key)); + if (sa_res_key == lun->pr_keys[i]) { + lun->pr_keys[i] = 0; lun->pr_key_count--; if (!persis_offset && i < CTL_MAX_INITIATORS) @@ -8454,7 +8402,6 @@ ctl_pro_preempt_other(struct ctl_lun *lu CTL_UA_RES_RELEASE; } } - lun->per_res[msg->pr.pr_info.residx].registered = 1; lun->res_type = msg->pr.pr_info.res_type; if (lun->res_type != SPR_TYPE_WR_EX_AR && lun->res_type != SPR_TYPE_EX_AC_AR) @@ -8552,11 +8499,8 @@ ctl_persistent_reserve_out(struct ctl_sc */ if ((cdb->action & SPRO_ACTION_MASK) != SPRO_REG_IGNO) { mtx_lock(&lun->lun_lock); - if (lun->per_res[residx].registered) { - if (memcmp(param->res_key.key, - lun->per_res[residx].res_key.key, - ctl_min(sizeof(param->res_key), - sizeof(lun->per_res[residx].res_key))) != 0) { + if (lun->pr_keys[residx] != 0) { + if (res_key != lun->pr_keys[residx]) { /* * The current key passed in doesn't match * the one the initiator previously @@ -8637,14 +8581,12 @@ ctl_persistent_reserve_out(struct ctl_sc if ((res_key == 0 && (cdb->action & SPRO_ACTION_MASK) == SPRO_REGISTER) || ((cdb->action & SPRO_ACTION_MASK) == SPRO_REG_IGNO - && !lun->per_res[residx].registered)) { + && lun->pr_keys[residx] == 0)) { mtx_unlock(&lun->lun_lock); goto done; } - lun->per_res[residx].registered = 0; - memset(&lun->per_res[residx].res_key, - 0, sizeof(lun->per_res[residx].res_key)); + lun->pr_keys[residx] = 0; lun->pr_key_count--; if (residx == lun->pr_res_idx) { @@ -8663,9 +8605,8 @@ ctl_persistent_reserve_out(struct ctl_sc */ for (i = 0; i < CTL_MAX_INITIATORS;i++){ - if (lun->per_res[ - i+persis_offset].registered - == 0) + if (lun->pr_keys[ + i + persis_offset] == 0) continue; lun->pending_ua[i] |= CTL_UA_RES_RELEASE; @@ -8695,15 +8636,9 @@ ctl_persistent_reserve_out(struct ctl_sc * If we aren't registered currently then increment * the key count and set the registered flag. */ - if (!lun->per_res[residx].registered) { + if (lun->pr_keys[residx] == 0) lun->pr_key_count++; - lun->per_res[residx].registered = 1; - } - - memcpy(&lun->per_res[residx].res_key, - param->serv_act_res_key, - ctl_min(sizeof(param->serv_act_res_key), - sizeof(lun->per_res[residx].res_key))); + lun->pr_keys[residx] = sa_res_key; persis_io.hdr.nexus = ctsio->io_hdr.nexus; persis_io.hdr.msg_type = CTL_MSG_PERS_ACTION; @@ -8816,20 +8751,12 @@ ctl_persistent_reserve_out(struct ctl_sc */ if (type != SPR_TYPE_EX_AC && type != SPR_TYPE_WR_EX) { - /* - * temporarily unregister so we don't generate UA - */ - lun->per_res[residx].registered = 0; - for (i = 0; i < CTL_MAX_INITIATORS; i++) { - if (lun->per_res[i+persis_offset].registered - == 0) + if (i == residx || + lun->pr_keys[i + persis_offset] == 0) continue; - lun->pending_ua[i] |= - CTL_UA_RES_RELEASE; + lun->pending_ua[i] |= CTL_UA_RES_RELEASE; } - - lun->per_res[residx].registered = 1; } mtx_unlock(&lun->lun_lock); /* Send msg to other side */ @@ -8852,13 +8779,10 @@ ctl_persistent_reserve_out(struct ctl_sc lun->pr_key_count = 0; lun->pr_res_idx = CTL_PR_NO_RESERVATION; - - memset(&lun->per_res[residx].res_key, - 0, sizeof(lun->per_res[residx].res_key)); - lun->per_res[residx].registered = 0; + lun->pr_keys[residx] = 0; for (i=0; i < 2*CTL_MAX_INITIATORS; i++) - if (lun->per_res[i].registered) { + if (lun->pr_keys[i] != 0) { if (!persis_offset && i < CTL_MAX_INITIATORS) lun->pending_ua[i] |= CTL_UA_RES_PREEMPT; @@ -8866,9 +8790,7 @@ ctl_persistent_reserve_out(struct ctl_sc lun->pending_ua[i-persis_offset] |= CTL_UA_RES_PREEMPT; - memset(&lun->per_res[i].res_key, - 0, sizeof(struct scsi_per_res_key)); - lun->per_res[i].registered = 0; + lun->pr_keys[i] = 0; } lun->PRGeneration++; mtx_unlock(&lun->lun_lock); @@ -8924,20 +8846,15 @@ ctl_hndl_per_res_out_on_other_sc(union c mtx_lock(&lun->lun_lock); switch(msg->pr.pr_info.action) { case CTL_PR_REG_KEY: - if (!lun->per_res[msg->pr.pr_info.residx].registered) { - lun->per_res[msg->pr.pr_info.residx].registered = 1; + if (lun->pr_keys[msg->pr.pr_info.residx] == 0) lun->pr_key_count++; - } + lun->pr_keys[msg->pr.pr_info.residx] = + scsi_8btou64(msg->pr.pr_info.sa_res_key); lun->PRGeneration++; - memcpy(&lun->per_res[msg->pr.pr_info.residx].res_key, - msg->pr.pr_info.sa_res_key, - sizeof(struct scsi_per_res_key)); break; case CTL_PR_UNREG_KEY: - lun->per_res[msg->pr.pr_info.residx].registered = 0; - memset(&lun->per_res[msg->pr.pr_info.residx].res_key, - 0, sizeof(struct scsi_per_res_key)); + lun->pr_keys[msg->pr.pr_info.residx] = 0; lun->pr_key_count--; /* XXX Need to see if the reservation has been released */ @@ -8958,8 +8875,8 @@ ctl_hndl_per_res_out_on_other_sc(union c */ for (i = 0; i < CTL_MAX_INITIATORS; i++) { - if (lun->per_res[i+ - persis_offset].registered == 0) + if (lun->pr_keys[i+ + persis_offset] == 0) continue; lun->pending_ua[i] |= @@ -8992,7 +8909,7 @@ ctl_hndl_per_res_out_on_other_sc(union c if (lun->res_type != SPR_TYPE_EX_AC && lun->res_type != SPR_TYPE_WR_EX) { for (i = 0; i < CTL_MAX_INITIATORS; i++) - if (lun->per_res[i+persis_offset].registered) + if (lun->pr_keys[i+persis_offset] != 0) lun->pending_ua[i] |= CTL_UA_RES_RELEASE; } @@ -9012,7 +8929,7 @@ ctl_hndl_per_res_out_on_other_sc(union c lun->pr_res_idx = CTL_PR_NO_RESERVATION; for (i=0; i < 2*CTL_MAX_INITIATORS; i++) { - if (lun->per_res[i].registered == 0) + if (lun->pr_keys[i] == 0) continue; if (!persis_offset && i < CTL_MAX_INITIATORS) @@ -9021,9 +8938,7 @@ ctl_hndl_per_res_out_on_other_sc(union c && i >= persis_offset) lun->pending_ua[i-persis_offset] |= CTL_UA_RES_PREEMPT; - memset(&lun->per_res[i].res_key, 0, - sizeof(struct scsi_per_res_key)); - lun->per_res[i].registered = 0; + lun->pr_keys[i] = 0; } lun->PRGeneration++; break; @@ -9062,7 +8977,7 @@ ctl_read_write(struct ctl_scsiio *ctsio) && residx != lun->pr_res_idx) || ((lun->res_type == SPR_TYPE_EX_AC_RO || lun->res_type == SPR_TYPE_EX_AC_AR) - && !lun->per_res[residx].registered)) { + && lun->pr_keys[residx] == 0)) { ctl_set_reservation_conflict(ctsio); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); @@ -11379,7 +11294,7 @@ ctl_scsiio_lun_check(struct ctl_softc *c * type reservations are checked in the particular command * for a conflict. Read and SSU are the only ones. */ - if (!lun->per_res[residx].registered + if (lun->pr_keys[residx] == 0 || (residx != lun->pr_res_idx && lun->res_type < 4)) { ctsio->scsi_status = SCSI_STATUS_RESERV_CONFLICT; ctsio->io_hdr.status = CTL_SCSI_ERROR; Modified: head/sys/cam/ctl/ctl_private.h ============================================================================== --- head/sys/cam/ctl/ctl_private.h Fri Oct 10 12:02:34 2014 (r272892) +++ head/sys/cam/ctl/ctl_private.h Fri Oct 10 12:38:53 2014 (r272893) @@ -353,11 +353,6 @@ typedef enum { CTL_PR_FLAG_ACTIVE_RES = 0x02 } ctl_per_res_flags; -struct ctl_per_res_info { - struct scsi_per_res_key res_key; - uint8_t registered; -}; - #define CTL_PR_ALL_REGISTRANTS 0xFFFFFFFF #define CTL_PR_NO_RESERVATION 0xFFFFFFF0 @@ -398,8 +393,8 @@ struct ctl_lun { struct ctl_mode_pages mode_pages; struct ctl_lun_io_stats stats; uint32_t res_idx; - struct ctl_per_res_info per_res[2*CTL_MAX_INITIATORS]; unsigned int PRGeneration; + uint64_t pr_keys[2*CTL_MAX_INITIATORS]; int pr_key_count; uint32_t pr_res_idx; uint8_t res_type; From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 14:03:40 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7AE23ECB; Fri, 10 Oct 2014 14:03:40 +0000 (UTC) Received: from mho-01-ewr.mailhop.org (mho-03-ewr.mailhop.org [204.13.248.66]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DB9CD9E; Fri, 10 Oct 2014 14:03:39 +0000 (UTC) Received: from [73.34.117.227] (helo=ilsoft.org) by mho-01-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1Xcan6-000H4K-JJ; Fri, 10 Oct 2014 14:03:32 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id s9AE3VoX037578; Fri, 10 Oct 2014 08:03:31 -0600 (MDT) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 73.34.117.227 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX18CHjGNQuq2WzP0G8cA7V4q X-Authentication-Warning: paranoia.hippie.lan: Host revolution.hippie.lan [172.22.42.240] claimed to be [172.22.42.240] Subject: Re: svn commit: r272808 - head/include/rpcsvc From: Ian Lepore To: Baptiste Daroussin In-Reply-To: <201410090658.s996wYOr096351@svn.freebsd.org> References: <201410090658.s996wYOr096351@svn.freebsd.org> Content-Type: text/plain; charset="us-ascii" Date: Fri, 10 Oct 2014 08:03:31 -0600 Message-ID: <1412949811.12052.270.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 14:03:40 -0000 On Thu, 2014-10-09 at 06:58 +0000, Baptiste Daroussin wrote: > Author: bapt > Date: Thu Oct 9 06:58:33 2014 > New Revision: 272808 > URL: https://svnweb.freebsd.org/changeset/base/272808 > > Log: > Fix build with rpcgen using a recent (tested with gcc 4.9.1) GNU cpp > > Modified: > head/include/rpcsvc/nis.x > > Modified: head/include/rpcsvc/nis.x > ============================================================================== > --- head/include/rpcsvc/nis.x Thu Oct 9 06:24:06 2014 (r272807) > +++ head/include/rpcsvc/nis.x Thu Oct 9 06:58:33 2014 (r272808) > @@ -400,10 +400,7 @@ program NIS_PROG { > %#define OARIGHTS(d, n) (((d)->do_armask.do_armask_val+n)->oa_rights) > %#define WORLD_DEFAULT (NIS_READ_ACC) > %#define GROUP_DEFAULT (NIS_READ_ACC << 8) > -%#define OWNER_DEFAULT ((NIS_READ_ACC +\ > - NIS_MODIFY_ACC +\ > - NIS_CREATE_ACC +\ > - NIS_DESTROY_ACC) << 16) > +%#define OWNER_DEFAULT ((NIS_READ_ACC + NIS_MODIFY_ACC + NIS_CREATE_ACC + NIS_DESTROY_ACC) << 16) > %#define DEFAULT_RIGHTS (WORLD_DEFAULT | GROUP_DEFAULT | OWNER_DEFAULT) > % > %/* Result manipulation defines ... */ > @@ -432,10 +429,8 @@ program NIS_PROG { > % * these definitions they take an nis_object *, and an int and return > % * a u_char * for Value, and an int for length. > % */ > -%#define ENTRY_VAL(obj, col) \ > - (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val > -%#define ENTRY_LEN(obj, col) \ > - (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len > +%#define ENTRY_VAL(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val > +%#define ENTRY_LEN(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len > % > %#ifdef __cplusplus > %} > How does unwrapping these lines so that they're longer than the style(9) limits fix the build? (I'm not a fan of 80-column limits, it's a rule that needs to die die die. I'm just curious what the actual fix is here.) -- Ian From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 14:17:43 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A3882418; Fri, 10 Oct 2014 14:17:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F67BEF7; Fri, 10 Oct 2014 14:17:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9AEHhTO099721; Fri, 10 Oct 2014 14:17:43 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9AEHhKL099720; Fri, 10 Oct 2014 14:17:43 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410101417.s9AEHhKL099720@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 10 Oct 2014 14:17:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272894 - head/sys/dev/mc146818 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 14:17:43 -0000 Author: bapt Date: Fri Oct 10 14:17:42 2014 New Revision: 272894 URL: https://svnweb.freebsd.org/changeset/base/272894 Log: Use FreeBSD-bit-checking-style This appease gcc 4.9 issuing warnings about parentheses Differential Revision: https://reviews.freebsd.org/D933 Reviewed by: marius Modified: head/sys/dev/mc146818/mc146818.c Modified: head/sys/dev/mc146818/mc146818.c ============================================================================== --- head/sys/dev/mc146818/mc146818.c Fri Oct 10 12:38:53 2014 (r272893) +++ head/sys/dev/mc146818/mc146818.c Fri Oct 10 14:17:42 2014 (r272894) @@ -77,7 +77,7 @@ mc146818_attach(device_t dev) } mtx_lock_spin(&sc->sc_mtx); - if (!(*sc->sc_mcread)(dev, MC_REGD) & MC_REGD_VRT) { + if (((*sc->sc_mcread)(dev, MC_REGD) & MC_REGD_VRT) == 0) { mtx_unlock_spin(&sc->sc_mtx); device_printf(dev, "%s: battery low\n", __func__); return (ENXIO); @@ -118,7 +118,7 @@ mc146818_gettime(device_t dev, struct ti */ for (;;) { mtx_lock_spin(&sc->sc_mtx); - if (!((*sc->sc_mcread)(dev, MC_REGA) & MC_REGA_UIP)) + if (((*sc->sc_mcread)(dev, MC_REGA) & MC_REGA_UIP) == 0) break; mtx_unlock_spin(&sc->sc_mtx); if (--timeout < 0) { @@ -164,7 +164,7 @@ mc146818_getsecs(device_t dev, int *secp for (;;) { mtx_lock_spin(&sc->sc_mtx); - if (!((*sc->sc_mcread)(dev, MC_REGA) & MC_REGA_UIP)) { + if (((*sc->sc_mcread)(dev, MC_REGA) & MC_REGA_UIP) == 0) { sec = FROMREG((*sc->sc_mcread)(dev, MC_SEC)); mtx_unlock_spin(&sc->sc_mtx); break; From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 14:18:33 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E3250565; Fri, 10 Oct 2014 14:18:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CF2E0F03; Fri, 10 Oct 2014 14:18:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9AEIXxQ099884; Fri, 10 Oct 2014 14:18:33 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9AEIXkM099883; Fri, 10 Oct 2014 14:18:33 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410101418.s9AEIXkM099883@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 10 Oct 2014 14:18:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272895 - head/sys/sparc64/sparc64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 14:18:34 -0000 Author: bapt Date: Fri Oct 10 14:18:33 2014 New Revision: 272895 URL: https://svnweb.freebsd.org/changeset/base/272895 Log: Fix typo revealed by using newer binutils Differential Revision: https://reviews.freebsd.org/D933 Reviewed by: marius Modified: head/sys/sparc64/sparc64/support.S Modified: head/sys/sparc64/sparc64/support.S ============================================================================== --- head/sys/sparc64/sparc64/support.S Fri Oct 10 14:17:42 2014 (r272894) +++ head/sys/sparc64/sparc64/support.S Fri Oct 10 14:18:33 2014 (r272895) @@ -517,7 +517,7 @@ fs_nofault_end: ENTRY(fs_fault) retl mov -1, %o0 -END(fsfault) +END(fs_fault) .globl fas_nofault_begin fas_nofault_begin: From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 14:35:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BD1DB8E5; Fri, 10 Oct 2014 14:35:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D8E615F; Fri, 10 Oct 2014 14:35:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9AEZrrS009148; Fri, 10 Oct 2014 14:35:53 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9AEZqSf009142; Fri, 10 Oct 2014 14:35:52 GMT (envelope-from br@FreeBSD.org) Message-Id: <201410101435.s9AEZqSf009142@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Fri, 10 Oct 2014 14:35:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272896 - in head/sys: arm/altera/socfpga arm/conf boot/fdt/dts/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 14:35:53 -0000 Author: br Date: Fri Oct 10 14:35:51 2014 New Revision: 272896 URL: https://svnweb.freebsd.org/changeset/base/272896 Log: o Add machine-dependent SMP part o Enable SMP Sponsored by: DARPA, AFRL Added: head/sys/arm/altera/socfpga/socfpga_mp.c (contents, props changed) Modified: head/sys/arm/altera/socfpga/files.socfpga head/sys/arm/altera/socfpga/socfpga_machdep.c head/sys/arm/conf/SOCKIT head/sys/boot/fdt/dts/arm/socfpga-sockit.dts Modified: head/sys/arm/altera/socfpga/files.socfpga ============================================================================== --- head/sys/arm/altera/socfpga/files.socfpga Fri Oct 10 14:18:33 2014 (r272895) +++ head/sys/arm/altera/socfpga/files.socfpga Fri Oct 10 14:35:51 2014 (r272896) @@ -17,6 +17,7 @@ arm/altera/socfpga/socfpga_common.c sta arm/altera/socfpga/socfpga_machdep.c standard arm/altera/socfpga/socfpga_manager.c standard arm/altera/socfpga/socfpga_rstmgr.c standard +arm/altera/socfpga/socfpga_mp.c optional smp dev/dwc/if_dwc.c optional dwc dev/mmc/host/dwmmc.c optional dwmmc Modified: head/sys/arm/altera/socfpga/socfpga_machdep.c ============================================================================== --- head/sys/arm/altera/socfpga/socfpga_machdep.c Fri Oct 10 14:18:33 2014 (r272895) +++ head/sys/arm/altera/socfpga/socfpga_machdep.c Fri Oct 10 14:35:51 2014 (r272896) @@ -92,6 +92,9 @@ platform_devmap_init(void) /* dwmmc */ arm_devmap_add_entry(0xff700000, 0x100000); + /* scu */ + arm_devmap_add_entry(0xfff00000, 0x100000); + return (0); } Added: head/sys/arm/altera/socfpga/socfpga_mp.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/altera/socfpga/socfpga_mp.c Fri Oct 10 14:35:51 2014 (r272896) @@ -0,0 +1,180 @@ +/*- + * Copyright (c) 2014 Ruslan Bukin + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#define SCU_PHYSBASE 0xFFFEC000 +#define SCU_SIZE 0x100 + +#define SCU_CONTROL_REG 0x00 +#define SCU_CONTROL_ENABLE (1 << 0) +#define SCU_CONFIG_REG 0x04 +#define SCU_CONFIG_REG_NCPU_MASK 0x03 +#define SCU_CPUPOWER_REG 0x08 +#define SCU_INV_TAGS_REG 0x0c +#define SCU_DIAG_CONTROL 0x30 +#define SCU_DIAG_DISABLE_MIGBIT (1 << 0) +#define SCU_FILTER_START_REG 0x40 +#define SCU_FILTER_END_REG 0x44 +#define SCU_SECURE_ACCESS_REG 0x50 +#define SCU_NONSECURE_ACCESS_REG 0x54 + +#define RSTMGR_PHYSBASE 0xFFD05000 +#define RSTMGR_SIZE 0x100 +#define MPUMODRST 0x10 +#define MPUMODRST_CPU1 (1 << 1) + +#define RAM_PHYSBASE 0x0 +#define RAM_SIZE 0x1000 + +extern char *mpentry_addr; +static void socfpga_trampoline(void); + +static void +socfpga_trampoline(void) +{ + + __asm __volatile( + "ldr pc, 1f\n" + ".globl mpentry_addr\n" + "mpentry_addr:\n" + "1: .space 4\n"); +} + +void +platform_mp_init_secondary(void) +{ + + gic_init_secondary(); +} + +void +platform_mp_setmaxid(void) +{ + int hwcpu, ncpu; + + /* If we've already set this don't bother to do it again. */ + if (mp_ncpus != 0) + return; + + hwcpu = 2; + + ncpu = hwcpu; + TUNABLE_INT_FETCH("hw.ncpu", &ncpu); + if (ncpu < 1 || ncpu > hwcpu) + ncpu = hwcpu; + + mp_ncpus = ncpu; + mp_maxid = ncpu - 1; +} + +int +platform_mp_probe(void) +{ + + if (mp_ncpus == 0) + platform_mp_setmaxid(); + + return (mp_ncpus > 1); +} + +void +platform_mp_start_ap(void) +{ + bus_space_handle_t scu, rst, ram; + int reg; + + if (bus_space_map(fdtbus_bs_tag, SCU_PHYSBASE, + SCU_SIZE, 0, &scu) != 0) + panic("Couldn't map the SCU\n"); + if (bus_space_map(fdtbus_bs_tag, RSTMGR_PHYSBASE, + RSTMGR_SIZE, 0, &rst) != 0) + panic("Couldn't map the reset manager (RSTMGR)\n"); + if (bus_space_map(fdtbus_bs_tag, RAM_PHYSBASE, + RAM_SIZE, 0, &ram) != 0) + panic("Couldn't map the first physram page\n"); + + /* Invalidate SCU cache tags */ + bus_space_write_4(fdtbus_bs_tag, scu, + SCU_INV_TAGS_REG, 0x0000ffff); + + /* + * Erratum ARM/MP: 764369 (problems with cache maintenance). + * Setting the "disable-migratory bit" in the undocumented SCU + * Diagnostic Control Register helps work around the problem. + */ + reg = bus_space_read_4(fdtbus_bs_tag, scu, SCU_DIAG_CONTROL); + reg |= (SCU_DIAG_DISABLE_MIGBIT); + bus_space_write_4(fdtbus_bs_tag, scu, SCU_DIAG_CONTROL, reg); + + /* Put CPU1 to reset state */ + bus_space_write_4(fdtbus_bs_tag, rst, MPUMODRST, MPUMODRST_CPU1); + + /* Enable the SCU, then clean the cache on this core */ + reg = bus_space_read_4(fdtbus_bs_tag, scu, SCU_CONTROL_REG); + reg |= (SCU_CONTROL_ENABLE); + bus_space_write_4(fdtbus_bs_tag, scu, SCU_CONTROL_REG, reg); + + /* Set up trampoline code */ + mpentry_addr = (char *)pmap_kextract((vm_offset_t)mpentry); + bus_space_write_region_4(fdtbus_bs_tag, ram, 0, + (uint32_t *)&socfpga_trampoline, 8); + + cpu_idcache_wbinv_all(); + cpu_l2cache_wbinv_all(); + + /* Put CPU1 out from reset */ + bus_space_write_4(fdtbus_bs_tag, rst, MPUMODRST, 0); + + armv7_sev(); + + bus_space_unmap(fdtbus_bs_tag, scu, SCU_SIZE); + bus_space_unmap(fdtbus_bs_tag, rst, RSTMGR_SIZE); + bus_space_unmap(fdtbus_bs_tag, ram, RAM_SIZE); +} + +void +platform_ipi_send(cpuset_t cpus, u_int ipi) +{ + + pic_ipi_send(cpus, ipi); +} Modified: head/sys/arm/conf/SOCKIT ============================================================================== --- head/sys/arm/conf/SOCKIT Fri Oct 10 14:18:33 2014 (r272895) +++ head/sys/arm/conf/SOCKIT Fri Oct 10 14:35:51 2014 (r272896) @@ -53,7 +53,7 @@ options PREEMPTION options FREEBSD_BOOT_LOADER options VFP # vfp/neon -#options SMP +options SMP # Debugging makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols Modified: head/sys/boot/fdt/dts/arm/socfpga-sockit.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/socfpga-sockit.dts Fri Oct 10 14:18:33 2014 (r272895) +++ head/sys/boot/fdt/dts/arm/socfpga-sockit.dts Fri Oct 10 14:35:51 2014 (r272896) @@ -38,6 +38,9 @@ model = "Terasic SoCKit"; compatible = "altr,socfpga-cyclone5", "altr,socfpga"; + /* Reserve first page for secondary CPU trampoline code */ + memreserve = < 0x00000000 0x1000 >; + memory { device_type = "memory"; reg = < 0x00000000 0x40000000 >; /* 1G RAM */ From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 14:50:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0DB90C8; Fri, 10 Oct 2014 14:50:49 +0000 (UTC) Received: from mail-wg0-x22f.google.com (mail-wg0-x22f.google.com [IPv6:2a00:1450:400c:c00::22f]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 12C142D2; Fri, 10 Oct 2014 14:50:47 +0000 (UTC) Received: by mail-wg0-f47.google.com with SMTP id x13so4077069wgg.6 for ; Fri, 10 Oct 2014 07:50:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=V+FaLF7GPQzi9VTkVhD1XPsOIz/PkCxSCuhxFM1aYpI=; b=LYyeQuIZ+Eo13xVmCmSFBuTBj2PtVFdhhP8Qw8z2ZjekhZYJsq4SIUVVa3C3P/816M Ul6LzYg9xAtqw3AJJtjwL0s6NbWrfxABNkcPTkjYPjxMufVz4wLvulWUviJFLjRxi6uO LRbMBnlGp4bwpw3zMqLBmFewRYvlp3Wn0hq0cnxZEN6fVotVEnC5RhP3DJDAoBuJAPMr fZZZ0+ARLTYSMdNY3Uld/zSSbbQV8xPRyLipX+jXeu2YWAv9/RaHEoANT5Ys9DuJpuR8 urIoE4PJZ2VdVmdvAnf/QHD7Ui/LhKtjGSvasQUj7WbqzdIeySXJBwPqAI69TJYOf9vc mKWg== X-Received: by 10.180.104.199 with SMTP id gg7mr5275500wib.46.1412952646237; Fri, 10 Oct 2014 07:50:46 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by mx.google.com with ESMTPSA id bv17sm2874841wib.13.2014.10.10.07.50.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Oct 2014 07:50:45 -0700 (PDT) Sender: Baptiste Daroussin Date: Fri, 10 Oct 2014 16:50:43 +0200 From: Baptiste Daroussin To: Ian Lepore Subject: Re: svn commit: r272808 - head/include/rpcsvc Message-ID: <20141010145043.GI19486@ivaldir.etoilebsd.net> References: <201410090658.s996wYOr096351@svn.freebsd.org> <1412949811.12052.270.camel@revolution.hippie.lan> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="dMdWWqg3F2Dv/qfw" Content-Disposition: inline In-Reply-To: <1412949811.12052.270.camel@revolution.hippie.lan> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 14:50:49 -0000 --dMdWWqg3F2Dv/qfw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 10, 2014 at 08:03:31AM -0600, Ian Lepore wrote: > On Thu, 2014-10-09 at 06:58 +0000, Baptiste Daroussin wrote: > > Author: bapt > > Date: Thu Oct 9 06:58:33 2014 > > New Revision: 272808 > > URL: https://svnweb.freebsd.org/changeset/base/272808 > >=20 > > Log: > > Fix build with rpcgen using a recent (tested with gcc 4.9.1) GNU cpp > >=20 > > Modified: > > head/include/rpcsvc/nis.x > >=20 > > Modified: head/include/rpcsvc/nis.x > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/include/rpcsvc/nis.x Thu Oct 9 06:24:06 2014 (r272807) > > +++ head/include/rpcsvc/nis.x Thu Oct 9 06:58:33 2014 (r272808) > > @@ -400,10 +400,7 @@ program NIS_PROG { > > %#define OARIGHTS(d, n) (((d)->do_armask.do_armask_val+n)->oa_rights) > > %#define WORLD_DEFAULT (NIS_READ_ACC) > > %#define GROUP_DEFAULT (NIS_READ_ACC << 8) > > -%#define OWNER_DEFAULT ((NIS_READ_ACC +\ > > - NIS_MODIFY_ACC +\ > > - NIS_CREATE_ACC +\ > > - NIS_DESTROY_ACC) << 16) > > +%#define OWNER_DEFAULT ((NIS_READ_ACC + NIS_MODIFY_ACC + NIS_CREATE_AC= C + NIS_DESTROY_ACC) << 16) > > %#define DEFAULT_RIGHTS (WORLD_DEFAULT | GROUP_DEFAULT | OWNER_DEFAULT) > > % > > %/* Result manipulation defines ... */ > > @@ -432,10 +429,8 @@ program NIS_PROG { > > % * these definitions they take an nis_object *, and an int and return > > % * a u_char * for Value, and an int for length. > > % */ > > -%#define ENTRY_VAL(obj, col) \ > > - (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val > > -%#define ENTRY_LEN(obj, col) \ > > - (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len > > +%#define ENTRY_VAL(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].e= c_value.ec_value_val > > +%#define ENTRY_LEN(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].e= c_value.ec_value_len > > % > > %#ifdef __cplusplus > > %} > >=20 >=20 > How does unwrapping these lines so that they're longer than the style(9) > limits fix the build? >=20 > (I'm not a fan of 80-column limits, it's a rule that needs to die die > die. I'm just curious what the actual fix is here.) >=20 to be honnest here I don't know how rpcgen passes lines to cpp but recent G= NU cpp are failing because of that, looking at dragonfly I have seen they fixed the same way. regards, Bapt --dMdWWqg3F2Dv/qfw Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlQ38kMACgkQ8kTtMUmk6ExXEACgkKzLE/G3quUVncTDKezXdbO+ nI4An1mh7DC8AsNMNHCh6wo10VyNdfk8 =LMei -----END PGP SIGNATURE----- --dMdWWqg3F2Dv/qfw-- From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 15:06:05 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2FCA775A; Fri, 10 Oct 2014 15:06:05 +0000 (UTC) Received: from mail-pa0-x22a.google.com (mail-pa0-x22a.google.com [IPv6:2607:f8b0:400e:c03::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E384F6AF; Fri, 10 Oct 2014 15:06:04 +0000 (UTC) Received: by mail-pa0-f42.google.com with SMTP id bj1so1910882pad.15 for ; Fri, 10 Oct 2014 08:06:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=j2txKVvHw1SoTs4koBIv30dpQ80B9cNpxi5grKLcjhY=; b=mhGfey88lLwsCv8ACPux6xIUdviJ/k8JGcaHTyLlu3KkVZMl3YErU8ubUlDbkiwuAQ gyjiErBNFhpIaJZIdGBQw7zjg+Nf9R6c6oNnYpIN0ua8ljMfP/KW2737504DMSrL55UA 3IyfkttDW2Q77foawtDkKu0ANaXL/YoIzhlzA+rfnV3Duk3V3IolmYYQwb9DiLWgIa9+ 8OGhTF2cLAQkrXQO+LY6m/ZLZ4ZzXRfs6tII11OCIbk1G1QcjevNM+Vb07ycidmtMiAk s7Q4yCg9VLt7o4KZDFUiG0Ydk3UBLlzSXsGuP0GtfXboZEmbDj1IEm64i47e5hn9dPCT 05uA== MIME-Version: 1.0 X-Received: by 10.70.140.199 with SMTP id ri7mr5743303pdb.47.1412953564277; Fri, 10 Oct 2014 08:06:04 -0700 (PDT) Received: by 10.70.9.132 with HTTP; Fri, 10 Oct 2014 08:06:04 -0700 (PDT) In-Reply-To: <20141010145043.GI19486@ivaldir.etoilebsd.net> References: <201410090658.s996wYOr096351@svn.freebsd.org> <1412949811.12052.270.camel@revolution.hippie.lan> <20141010145043.GI19486@ivaldir.etoilebsd.net> Date: Fri, 10 Oct 2014 11:06:04 -0400 Message-ID: Subject: Re: svn commit: r272808 - head/include/rpcsvc From: Benjamin Kaduk To: Baptiste Daroussin Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Ian Lepore X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 15:06:05 -0000 On Fri, Oct 10, 2014 at 10:50 AM, Baptiste Daroussin wrote: > On Fri, Oct 10, 2014 at 08:03:31AM -0600, Ian Lepore wrote: > > On Thu, 2014-10-09 at 06:58 +0000, Baptiste Daroussin wrote: > > > Author: bapt > > > Date: Thu Oct 9 06:58:33 2014 > > > New Revision: 272808 > > > URL: https://svnweb.freebsd.org/changeset/base/272808 > > > > > > -%#define ENTRY_VAL(obj, col) \ > > > - (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val > > > -%#define ENTRY_LEN(obj, col) \ > > > - (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len > > > +%#define ENTRY_VAL(obj, col) > (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val > > > +%#define ENTRY_LEN(obj, col) > (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len > > > % > > > %#ifdef __cplusplus > > > %} > > > > > > > How does unwrapping these lines so that they're longer than the style(9) > > limits fix the build? > > > > (I'm not a fan of 80-column limits, it's a rule that needs to die die > > die. I'm just curious what the actual fix is here.) > > > > to be honnest here I don't know how rpcgen passes lines to cpp but recent > GNU cpp > are failing because of that, looking at dragonfly I have seen they fixed > the > same way. > rpcgen accpets cpp syntax for including other snippets as rpcgen input, but also needs to keep the ability to output cpp directives in the generated code. The '%' prefix is a sigil that the directive is to be skipped by rpcgen and instead emitted to the generated code. I assume that there was a bug in the handling of continuation lines in this context which causes things to be confused, but don't know the details of that, just what's "supposed to be" going on. -Ben From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 16:06:25 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0ECBFBE4; Fri, 10 Oct 2014 16:06:25 +0000 (UTC) Received: from fep19.mx.upcmail.net (fep19.mx.upcmail.net [62.179.121.39]) by mx1.freebsd.org (Postfix) with ESMTP id B27F8D5F; Fri, 10 Oct 2014 16:06:22 +0000 (UTC) Received: from edge04.upcmail.net ([192.168.13.239]) by viefep15-int.chello.at (InterMail vM.8.01.05.05 201-2260-151-110-20120111) with ESMTP id <20141010160537.YJUT19410.viefep15-int.chello.at@edge04.upcmail.net>; Fri, 10 Oct 2014 18:05:37 +0200 Received: from mole.fafoe.narf.at ([80.109.238.242]) by edge04.upcmail.net with edge id 1U5d1p00Z5EV2AQ01U5dfW; Fri, 10 Oct 2014 18:05:37 +0200 X-SourceIP: 80.109.238.242 Received: by mole.fafoe.narf.at (Postfix, from userid 1001) id 2D40E6D413; Fri, 10 Oct 2014 18:05:37 +0200 (CEST) Date: Fri, 10 Oct 2014 18:05:37 +0200 From: Stefan Farfeleder To: Baptiste Daroussin Subject: Re: svn commit: r272894 - head/sys/dev/mc146818 Message-ID: <20141010160536.GC1262@mole.fafoe.narf.at> References: <201410101417.s9AEHhKL099720@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201410101417.s9AEHhKL099720@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, marius@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 16:06:25 -0000 On Fri, Oct 10, 2014 at 02:17:43PM +0000, Baptiste Daroussin wrote: > Author: bapt > Date: Fri Oct 10 14:17:42 2014 > New Revision: 272894 > URL: https://svnweb.freebsd.org/changeset/base/272894 > > Log: > Use FreeBSD-bit-checking-style > This appease gcc 4.9 issuing warnings about parentheses > > Differential Revision: https://reviews.freebsd.org/D933 > Reviewed by: marius > > Modified: > head/sys/dev/mc146818/mc146818.c > > Modified: head/sys/dev/mc146818/mc146818.c > ============================================================================== > --- head/sys/dev/mc146818/mc146818.c Fri Oct 10 12:38:53 2014 (r272893) > +++ head/sys/dev/mc146818/mc146818.c Fri Oct 10 14:17:42 2014 (r272894) > @@ -77,7 +77,7 @@ mc146818_attach(device_t dev) > } > > mtx_lock_spin(&sc->sc_mtx); > - if (!(*sc->sc_mcread)(dev, MC_REGD) & MC_REGD_VRT) { > + if (((*sc->sc_mcread)(dev, MC_REGD) & MC_REGD_VRT) == 0) { > mtx_unlock_spin(&sc->sc_mtx); > device_printf(dev, "%s: battery low\n", __func__); > return (ENXIO); This changes the meaning. The old code was parsed as '(!...) & MC_REGD_VRT' which evaluates to constant 0. Probably this was wrong, but your comment doesn't seem to indicate that. The other two changes are fine. Stefan From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 16:36:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B53E8695; Fri, 10 Oct 2014 16:36:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 95B17167; Fri, 10 Oct 2014 16:36:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9AGaQob066898; Fri, 10 Oct 2014 16:36:26 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9AGaQ43066897; Fri, 10 Oct 2014 16:36:26 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201410101636.s9AGaQ43066897@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 10 Oct 2014 16:36:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272897 - head/sys/dev/e1000 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 16:36:26 -0000 Author: jhb Date: Fri Oct 10 16:36:25 2014 New Revision: 272897 URL: https://svnweb.freebsd.org/changeset/base/272897 Log: Various fixes to stats: - Read the counts of received, dropped, and transmitted management packets and add sysctl nodes for them. - Fix the total octets received/transmitted to read all 64 bits of the counters. - Add missing sysctl nodes for rlec, tncrs, fcruc, tor, and tot. - Remove spurious spaces. Reviewed by: Eric Joyner @ Intel MFC after: 1 week Modified: head/sys/dev/e1000/if_igb.c Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Fri Oct 10 14:35:51 2014 (r272896) +++ head/sys/dev/e1000/if_igb.c Fri Oct 10 16:36:25 2014 (r272897) @@ -5649,8 +5649,14 @@ igb_update_stats_counters(struct adapter stats->roc += E1000_READ_REG(hw, E1000_ROC); stats->rjc += E1000_READ_REG(hw, E1000_RJC); - stats->tor += E1000_READ_REG(hw, E1000_TORH); - stats->tot += E1000_READ_REG(hw, E1000_TOTH); + stats->mgprc += E1000_READ_REG(hw, E1000_MGTPRC); + stats->mgpdc += E1000_READ_REG(hw, E1000_MGTPDC); + stats->mgptc += E1000_READ_REG(hw, E1000_MGTPTC); + + stats->tor += E1000_READ_REG(hw, E1000_TORL) + + ((u64)E1000_READ_REG(hw, E1000_TORH) << 32); + stats->tot += E1000_READ_REG(hw, E1000_TOTL) + + ((u64)E1000_READ_REG(hw, E1000_TOTH) << 32); stats->tpr += E1000_READ_REG(hw, E1000_TPR); stats->tpt += E1000_READ_REG(hw, E1000_TPT); @@ -5965,6 +5971,9 @@ igb_add_hw_stats(struct adapter *adapter SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "missed_packets", CTLFLAG_RD, &stats->mpc, "Missed Packets"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_length_errors", + CTLFLAG_RD, &stats->rlec, + "Receive Length Errors"); SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_no_buff", CTLFLAG_RD, &stats->rnbc, "Receive No Buffers"); @@ -5973,7 +5982,7 @@ igb_add_hw_stats(struct adapter *adapter "Receive Undersize"); SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_fragmented", CTLFLAG_RD, &stats->rfc, - "Fragmented Packets Received "); + "Fragmented Packets Received"); SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_oversize", CTLFLAG_RD, &stats->roc, "Oversized Packets Received"); @@ -5989,6 +5998,9 @@ igb_add_hw_stats(struct adapter *adapter SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "alignment_errs", CTLFLAG_RD, &stats->algnerrc, "Alignment Errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_no_crs", + CTLFLAG_RD, &stats->tncrs, + "Transmit with No CRS"); /* On 82575 these are collision counts */ SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "coll_ext_errs", CTLFLAG_RD, &stats->cexterr, @@ -6005,10 +6017,22 @@ igb_add_hw_stats(struct adapter *adapter SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "xoff_txd", CTLFLAG_RD, &stats->xofftxc, "XOFF Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "unsupported_fc_recvd", + CTLFLAG_RD, &stats->fcruc, + "Unsupported Flow Control Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "mgmt_pkts_recvd", + CTLFLAG_RD, &stats->mgprc, + "Management Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "mgmt_pkts_drop", + CTLFLAG_RD, &stats->mgpdc, + "Management Packets Dropped"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "mgmt_pkts_txd", + CTLFLAG_RD, &stats->mgptc, + "Management Packets Transmitted"); /* Packet Reception Stats */ SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "total_pkts_recvd", CTLFLAG_RD, &stats->tpr, - "Total Packets Received "); + "Total Packets Received"); SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_pkts_recvd", CTLFLAG_RD, &stats->gprc, "Good Packets Received"); @@ -6020,7 +6044,7 @@ igb_add_hw_stats(struct adapter *adapter "Multicast Packets Received"); SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_64", CTLFLAG_RD, &stats->prc64, - "64 byte frames received "); + "64 byte frames received"); SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_65_127", CTLFLAG_RD, &stats->prc127, "65-127 byte frames received"); @@ -6038,12 +6062,18 @@ igb_add_hw_stats(struct adapter *adapter "1023-1522 byte frames received"); SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_octets_recvd", CTLFLAG_RD, &stats->gorc, - "Good Octets Received"); + "Good Octets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "total_octets_recvd", + CTLFLAG_RD, &stats->tor, + "Total Octets Received"); /* Packet Transmission Stats */ SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_octets_txd", CTLFLAG_RD, &stats->gotc, "Good Octets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "total_octets_txd", + CTLFLAG_RD, &stats->tot, + "Total Octets Transmitted"); SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "total_pkts_txd", CTLFLAG_RD, &stats->tpt, "Total Packets Transmitted"); @@ -6058,7 +6088,7 @@ igb_add_hw_stats(struct adapter *adapter "Multicast Packets Transmitted"); SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_64", CTLFLAG_RD, &stats->ptc64, - "64 byte frames transmitted "); + "64 byte frames transmitted"); SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_65_127", CTLFLAG_RD, &stats->ptc127, "65-127 byte frames transmitted"); From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 17:24:58 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E9C2A24E; Fri, 10 Oct 2014 17:24:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D3FDD8AA; Fri, 10 Oct 2014 17:24:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9AHOv7i090935; Fri, 10 Oct 2014 17:24:57 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9AHOvtv090930; Fri, 10 Oct 2014 17:24:57 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201410101724.s9AHOvtv090930@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Fri, 10 Oct 2014 17:24:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272898 - in head: sbin/ipfw sys/netpfil/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 17:24:58 -0000 Author: melifaro Date: Fri Oct 10 17:24:56 2014 New Revision: 272898 URL: https://svnweb.freebsd.org/changeset/base/272898 Log: Partially fix build on !amd64 Pointed by: bz Modified: head/sbin/ipfw/ipfw2.c head/sbin/ipfw/tables.c (contents, props changed) head/sys/netpfil/ipfw/ip_fw_table_algo.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Fri Oct 10 16:36:25 2014 (r272897) +++ head/sbin/ipfw/ipfw2.c Fri Oct 10 17:24:56 2014 (r272898) @@ -2580,7 +2580,7 @@ ipfw_show_config(struct cmdline_opts *co list_static_range(co, fo, &bp, rbase, rcnt); if (co->do_dynamic && dynsz > 0) { - printf("## Dynamic rules (%d %lu):\n", fo->dcnt, dynsz); + printf("## Dynamic rules (%d %zu):\n", fo->dcnt, dynsz); list_dyn_range(co, fo, &bp, dynbase, dynsz); } Modified: head/sbin/ipfw/tables.c ============================================================================== --- head/sbin/ipfw/tables.c Fri Oct 10 16:36:25 2014 (r272897) +++ head/sbin/ipfw/tables.c Fri Oct 10 17:24:56 2014 (r272898) @@ -13,7 +13,7 @@ * * in-kernel ipfw tables support. * - * $FreeBSD: projects/ipfw/sbin/ipfw/ipfw2.c 267467 2014-06-14 10:58:39Z melifaro $ + * $FreeBSD$ */ @@ -1908,7 +1908,7 @@ ipfw_list_values(int ac, char *av[]) for (i = 0; i < olh->count; i++) { table_show_value(buf, sizeof(buf), (ipfw_table_value *)v, vmask, 0); - printf("[%u] refs=%lu %s\n", v->spare1, v->refcnt, buf); + printf("[%u] refs=%ju %s\n", v->spare1, v->refcnt, buf); v = (struct _table_value *)((caddr_t)v + olh->objsize); } Modified: head/sys/netpfil/ipfw/ip_fw_table_algo.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_table_algo.c Fri Oct 10 16:36:25 2014 (r272897) +++ head/sys/netpfil/ipfw/ip_fw_table_algo.c Fri Oct 10 17:24:56 2014 (r272898) @@ -366,6 +366,36 @@ struct ta_buf_radix } addr; }; +static int ta_lookup_radix(struct table_info *ti, void *key, uint32_t keylen, + uint32_t *val); +static int ta_init_radix(struct ip_fw_chain *ch, void **ta_state, + struct table_info *ti, char *data, uint8_t tflags); +static int flush_radix_entry(struct radix_node *rn, void *arg); +static void ta_destroy_radix(void *ta_state, struct table_info *ti); +static void ta_dump_radix_tinfo(void *ta_state, struct table_info *ti, + ipfw_ta_tinfo *tinfo); +static int ta_dump_radix_tentry(void *ta_state, struct table_info *ti, + void *e, ipfw_obj_tentry *tent); +static int ta_find_radix_tentry(void *ta_state, struct table_info *ti, + ipfw_obj_tentry *tent); +static void ta_foreach_radix(void *ta_state, struct table_info *ti, + ta_foreach_f *f, void *arg); +static inline void ipv6_writemask(struct in6_addr *addr6, uint8_t mask); +static void tei_to_sockaddr_ent(struct tentry_info *tei, struct sockaddr *sa, + struct sockaddr *ma, int *set_mask); +static int ta_prepare_add_radix(struct ip_fw_chain *ch, struct tentry_info *tei, + void *ta_buf); +static int ta_add_radix(void *ta_state, struct table_info *ti, + struct tentry_info *tei, void *ta_buf, uint32_t *pnum); +static int ta_prepare_del_radix(struct ip_fw_chain *ch, struct tentry_info *tei, + void *ta_buf); +static int ta_del_radix(void *ta_state, struct table_info *ti, + struct tentry_info *tei, void *ta_buf, uint32_t *pnum); +static void ta_flush_radix_entry(struct ip_fw_chain *ch, struct tentry_info *tei, + void *ta_buf); +static int ta_need_modify_radix(void *ta_state, struct table_info *ti, + uint32_t count, uint64_t *pflags); + static int ta_lookup_radix(struct table_info *ti, void *key, uint32_t keylen, uint32_t *val) @@ -479,7 +509,9 @@ ta_dump_radix_tentry(void *ta_state, str ipfw_obj_tentry *tent) { struct radix_addr_entry *n; +#ifdef INET6 struct radix_addr_xentry *xn; +#endif n = (struct radix_addr_entry *)e; @@ -563,8 +595,12 @@ tei_to_sockaddr_ent(struct tentry_info * struct sockaddr *ma, int *set_mask) { int mlen; +#ifdef INET struct sockaddr_in *addr, *mask; +#endif +#ifdef INET6 struct sa_in6 *addr6, *mask6; +#endif in_addr_t a4; mlen = tei->masklen; @@ -895,6 +931,56 @@ struct ta_buf_chash struct chashentry ent; }; +static __inline uint32_t hash_ip(uint32_t addr, int hsize); +static __inline uint32_t hash_ip6(struct in6_addr *addr6, int hsize); +static __inline uint16_t hash_ip64(struct in6_addr *addr6, int hsize); +static __inline uint32_t hash_ip6_slow(struct in6_addr *addr6, void *key, + int mask, int hsize); +static __inline uint32_t hash_ip6_al(struct in6_addr *addr6, void *key, int mask, + int hsize); +static int ta_lookup_chash_slow(struct table_info *ti, void *key, uint32_t keylen, + uint32_t *val); +static int ta_lookup_chash_aligned(struct table_info *ti, void *key, + uint32_t keylen, uint32_t *val); +static int ta_lookup_chash_64(struct table_info *ti, void *key, uint32_t keylen, + uint32_t *val); +static int chash_parse_opts(struct chash_cfg *cfg, char *data); +static void ta_print_chash_config(void *ta_state, struct table_info *ti, + char *buf, size_t bufsize); +static int log2(uint32_t v); +static int ta_init_chash(struct ip_fw_chain *ch, void **ta_state, + struct table_info *ti, char *data, uint8_t tflags); +static void ta_destroy_chash(void *ta_state, struct table_info *ti); +static void ta_dump_chash_tinfo(void *ta_state, struct table_info *ti, + ipfw_ta_tinfo *tinfo); +static int ta_dump_chash_tentry(void *ta_state, struct table_info *ti, + void *e, ipfw_obj_tentry *tent); +static uint32_t hash_ent(struct chashentry *ent, int af, int mlen, + uint32_t size); +static int tei_to_chash_ent(struct tentry_info *tei, struct chashentry *ent); +static int ta_find_chash_tentry(void *ta_state, struct table_info *ti, + ipfw_obj_tentry *tent); +static void ta_foreach_chash(void *ta_state, struct table_info *ti, + ta_foreach_f *f, void *arg); +static int ta_prepare_add_chash(struct ip_fw_chain *ch, struct tentry_info *tei, + void *ta_buf); +static int ta_add_chash(void *ta_state, struct table_info *ti, + struct tentry_info *tei, void *ta_buf, uint32_t *pnum); +static int ta_prepare_del_chash(struct ip_fw_chain *ch, struct tentry_info *tei, + void *ta_buf); +static int ta_del_chash(void *ta_state, struct table_info *ti, + struct tentry_info *tei, void *ta_buf, uint32_t *pnum); +static void ta_flush_chash_entry(struct ip_fw_chain *ch, struct tentry_info *tei, + void *ta_buf); +static int ta_need_modify_chash(void *ta_state, struct table_info *ti, + uint32_t count, uint64_t *pflags); +static int ta_prepare_mod_chash(void *ta_buf, uint64_t *pflags); +static int ta_fill_mod_chash(void *ta_state, struct table_info *ti, void *ta_buf, + uint64_t *pflags); +static void ta_modify_chash(void *ta_state, struct table_info *ti, void *ta_buf, + uint64_t pflags); +static void ta_flush_mod_chash(void *ta_buf); + static __inline uint32_t hash_ip(uint32_t addr, int hsize) @@ -1816,6 +1902,44 @@ struct ta_buf_ifidx int compare_ifidx(const void *k, const void *v); static void if_notifier(struct ip_fw_chain *ch, void *cbdata, uint16_t ifindex); +static struct ifidx * ifidx_find(struct table_info *ti, void *key); +static int ta_lookup_ifidx(struct table_info *ti, void *key, uint32_t keylen, + uint32_t *val); +static int ta_init_ifidx(struct ip_fw_chain *ch, void **ta_state, + struct table_info *ti, char *data, uint8_t tflags); +static void ta_change_ti_ifidx(void *ta_state, struct table_info *ti); +static void destroy_ifidx_locked(struct namedobj_instance *ii, + struct named_object *no, void *arg); +static void ta_destroy_ifidx(void *ta_state, struct table_info *ti); +static void ta_dump_ifidx_tinfo(void *ta_state, struct table_info *ti, + ipfw_ta_tinfo *tinfo); +static int ta_prepare_add_ifidx(struct ip_fw_chain *ch, struct tentry_info *tei, + void *ta_buf); +static int ta_add_ifidx(void *ta_state, struct table_info *ti, + struct tentry_info *tei, void *ta_buf, uint32_t *pnum); +static int ta_prepare_del_ifidx(struct ip_fw_chain *ch, struct tentry_info *tei, + void *ta_buf); +static int ta_del_ifidx(void *ta_state, struct table_info *ti, + struct tentry_info *tei, void *ta_buf, uint32_t *pnum); +static void ta_flush_ifidx_entry(struct ip_fw_chain *ch, + struct tentry_info *tei, void *ta_buf); +static void if_notifier(struct ip_fw_chain *ch, void *cbdata, uint16_t ifindex); +static int ta_need_modify_ifidx(void *ta_state, struct table_info *ti, + uint32_t count, uint64_t *pflags); +static int ta_prepare_mod_ifidx(void *ta_buf, uint64_t *pflags); +static int ta_fill_mod_ifidx(void *ta_state, struct table_info *ti, + void *ta_buf, uint64_t *pflags); +static void ta_modify_ifidx(void *ta_state, struct table_info *ti, void *ta_buf, + uint64_t pflags); +static void ta_flush_mod_ifidx(void *ta_buf); +static int ta_dump_ifidx_tentry(void *ta_state, struct table_info *ti, void *e, + ipfw_obj_tentry *tent); +static int ta_find_ifidx_tentry(void *ta_state, struct table_info *ti, + ipfw_obj_tentry *tent); +static void foreach_ifidx(struct namedobj_instance *ii, struct named_object *no, + void *arg); +static void ta_foreach_ifidx(void *ta_state, struct table_info *ti, + ta_foreach_f *f, void *arg); int compare_ifidx(const void *k, const void *v) @@ -2483,6 +2607,36 @@ struct ta_buf_numarray }; int compare_numarray(const void *k, const void *v); +static struct numarray *numarray_find(struct table_info *ti, void *key); +static int ta_lookup_numarray(struct table_info *ti, void *key, + uint32_t keylen, uint32_t *val); +static int ta_init_numarray(struct ip_fw_chain *ch, void **ta_state, + struct table_info *ti, char *data, uint8_t tflags); +static void ta_destroy_numarray(void *ta_state, struct table_info *ti); +static void ta_dump_numarray_tinfo(void *ta_state, struct table_info *ti, + ipfw_ta_tinfo *tinfo); +static int ta_prepare_add_numarray(struct ip_fw_chain *ch, + struct tentry_info *tei, void *ta_buf); +static int ta_add_numarray(void *ta_state, struct table_info *ti, + struct tentry_info *tei, void *ta_buf, uint32_t *pnum); +static int ta_del_numarray(void *ta_state, struct table_info *ti, + struct tentry_info *tei, void *ta_buf, uint32_t *pnum); +static void ta_flush_numarray_entry(struct ip_fw_chain *ch, + struct tentry_info *tei, void *ta_buf); +static int ta_need_modify_numarray(void *ta_state, struct table_info *ti, + uint32_t count, uint64_t *pflags); +static int ta_prepare_mod_numarray(void *ta_buf, uint64_t *pflags); +static int ta_fill_mod_numarray(void *ta_state, struct table_info *ti, + void *ta_buf, uint64_t *pflags); +static void ta_modify_numarray(void *ta_state, struct table_info *ti, + void *ta_buf, uint64_t pflags); +static void ta_flush_mod_numarray(void *ta_buf); +static int ta_dump_numarray_tentry(void *ta_state, struct table_info *ti, + void *e, ipfw_obj_tentry *tent); +static int ta_find_numarray_tentry(void *ta_state, struct table_info *ti, + ipfw_obj_tentry *tent); +static void ta_foreach_numarray(void *ta_state, struct table_info *ti, + ta_foreach_f *f, void *arg); int compare_numarray(const void *k, const void *v) @@ -2915,6 +3069,44 @@ struct ta_buf_fhash { struct fhashentry6 fe6; }; +static __inline int cmp_flow_ent(struct fhashentry *a, + struct fhashentry *b, size_t sz); +static __inline uint32_t hash_flow4(struct fhashentry4 *f, int hsize); +static __inline uint32_t hash_flow6(struct fhashentry6 *f, int hsize); +static uint32_t hash_flow_ent(struct fhashentry *ent, uint32_t size); +static int ta_lookup_fhash(struct table_info *ti, void *key, uint32_t keylen, + uint32_t *val); +static int ta_init_fhash(struct ip_fw_chain *ch, void **ta_state, +struct table_info *ti, char *data, uint8_t tflags); +static void ta_destroy_fhash(void *ta_state, struct table_info *ti); +static void ta_dump_fhash_tinfo(void *ta_state, struct table_info *ti, + ipfw_ta_tinfo *tinfo); +static int ta_dump_fhash_tentry(void *ta_state, struct table_info *ti, + void *e, ipfw_obj_tentry *tent); +static int tei_to_fhash_ent(struct tentry_info *tei, struct fhashentry *ent); +static int ta_find_fhash_tentry(void *ta_state, struct table_info *ti, + ipfw_obj_tentry *tent); +static void ta_foreach_fhash(void *ta_state, struct table_info *ti, + ta_foreach_f *f, void *arg); +static int ta_prepare_add_fhash(struct ip_fw_chain *ch, + struct tentry_info *tei, void *ta_buf); +static int ta_add_fhash(void *ta_state, struct table_info *ti, + struct tentry_info *tei, void *ta_buf, uint32_t *pnum); +static int ta_prepare_del_fhash(struct ip_fw_chain *ch, struct tentry_info *tei, + void *ta_buf); +static int ta_del_fhash(void *ta_state, struct table_info *ti, + struct tentry_info *tei, void *ta_buf, uint32_t *pnum); +static void ta_flush_fhash_entry(struct ip_fw_chain *ch, struct tentry_info *tei, + void *ta_buf); +static int ta_need_modify_fhash(void *ta_state, struct table_info *ti, + uint32_t count, uint64_t *pflags); +static int ta_prepare_mod_fhash(void *ta_buf, uint64_t *pflags); +static int ta_fill_mod_fhash(void *ta_state, struct table_info *ti, + void *ta_buf, uint64_t *pflags); +static void ta_modify_fhash(void *ta_state, struct table_info *ti, void *ta_buf, + uint64_t pflags); +static void ta_flush_mod_fhash(void *ta_buf); + static __inline int cmp_flow_ent(struct fhashentry *a, struct fhashentry *b, size_t sz) { @@ -3129,7 +3321,9 @@ ta_dump_fhash_tentry(void *ta_state, str struct fhash_cfg *cfg; struct fhashentry *ent; struct fhashentry4 *fe4; +#ifdef INET6 struct fhashentry6 *fe6; +#endif struct tflow_entry *tfe; cfg = (struct fhash_cfg *)ta_state; @@ -3549,6 +3743,25 @@ struct table_algo flow_hash = { * */ +static struct rtentry *lookup_kfib(void *key, int keylen, int fib); +static int ta_lookup_kfib(struct table_info *ti, void *key, uint32_t keylen, + uint32_t *val); +static int kfib_parse_opts(int *pfib, char *data); +static void ta_print_kfib_config(void *ta_state, struct table_info *ti, + char *buf, size_t bufsize); +static int ta_init_kfib(struct ip_fw_chain *ch, void **ta_state, + struct table_info *ti, char *data, uint8_t tflags); +static void ta_destroy_kfib(void *ta_state, struct table_info *ti); +static void ta_dump_kfib_tinfo(void *ta_state, struct table_info *ti, + ipfw_ta_tinfo *tinfo); +static int contigmask(uint8_t *p, int len); +static int ta_dump_kfib_tentry(void *ta_state, struct table_info *ti, void *e, + ipfw_obj_tentry *tent); +static int ta_find_kfib_tentry(void *ta_state, struct table_info *ti, + ipfw_obj_tentry *tent); +static void ta_foreach_kfib(void *ta_state, struct table_info *ti, + ta_foreach_f *f, void *arg); + static struct rtentry * lookup_kfib(void *key, int keylen, int fib) { From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 18:31:36 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 06971499; Fri, 10 Oct 2014 18:31:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E6622FB8; Fri, 10 Oct 2014 18:31:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9AIVZnK025079; Fri, 10 Oct 2014 18:31:35 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9AIVZtP025078; Fri, 10 Oct 2014 18:31:35 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201410101831.s9AIVZtP025078@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Fri, 10 Oct 2014 18:31:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272899 - head/sys/netpfil/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 18:31:36 -0000 Author: melifaro Date: Fri Oct 10 18:31:35 2014 New Revision: 272899 URL: https://svnweb.freebsd.org/changeset/base/272899 Log: Fix NOINET6 build for ipfw. Modified: head/sys/netpfil/ipfw/ip_fw_table_algo.c Modified: head/sys/netpfil/ipfw/ip_fw_table_algo.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_table_algo.c Fri Oct 10 17:24:56 2014 (r272898) +++ head/sys/netpfil/ipfw/ip_fw_table_algo.c Fri Oct 10 18:31:35 2014 (r272899) @@ -380,7 +380,6 @@ static int ta_find_radix_tentry(void *ta ipfw_obj_tentry *tent); static void ta_foreach_radix(void *ta_state, struct table_info *ti, ta_foreach_f *f, void *arg); -static inline void ipv6_writemask(struct in6_addr *addr6, uint8_t mask); static void tei_to_sockaddr_ent(struct tentry_info *tei, struct sockaddr *sa, struct sockaddr *ma, int *set_mask); static int ta_prepare_add_radix(struct ip_fw_chain *ch, struct tentry_info *tei, @@ -579,6 +578,8 @@ ta_foreach_radix(void *ta_state, struct #ifdef INET6 +static inline void ipv6_writemask(struct in6_addr *addr6, uint8_t mask); + static inline void ipv6_writemask(struct in6_addr *addr6, uint8_t mask) { @@ -638,8 +639,8 @@ tei_to_sockaddr_ent(struct tentry_info * *set_mask = 1; else *set_mask = 0; - } #endif + } } static int @@ -648,7 +649,9 @@ ta_prepare_add_radix(struct ip_fw_chain { struct ta_buf_radix *tb; struct radix_addr_entry *ent; +#ifdef INET6 struct radix_addr_xentry *xent; +#endif struct sockaddr *addr, *mask; int mlen, set_mask; @@ -931,13 +934,17 @@ struct ta_buf_chash struct chashentry ent; }; +#ifdef INET static __inline uint32_t hash_ip(uint32_t addr, int hsize); +#endif +#ifdef INET6 static __inline uint32_t hash_ip6(struct in6_addr *addr6, int hsize); static __inline uint16_t hash_ip64(struct in6_addr *addr6, int hsize); static __inline uint32_t hash_ip6_slow(struct in6_addr *addr6, void *key, int mask, int hsize); static __inline uint32_t hash_ip6_al(struct in6_addr *addr6, void *key, int mask, int hsize); +#endif static int ta_lookup_chash_slow(struct table_info *ti, void *key, uint32_t keylen, uint32_t *val); static int ta_lookup_chash_aligned(struct table_info *ti, void *key, @@ -982,13 +989,16 @@ static void ta_modify_chash(void *ta_sta static void ta_flush_mod_chash(void *ta_buf); +#ifdef INET static __inline uint32_t hash_ip(uint32_t addr, int hsize) { return (addr % (hsize - 1)); } +#endif +#ifdef INET6 static __inline uint32_t hash_ip6(struct in6_addr *addr6, int hsize) { @@ -1034,6 +1044,7 @@ hash_ip6_al(struct in6_addr *addr6, void memcpy(addr6, key, mask); return (hash_ip6(addr6, hsize)); } +#endif static int ta_lookup_chash_slow(struct table_info *ti, void *key, uint32_t keylen, @@ -1045,6 +1056,7 @@ ta_lookup_chash_slow(struct table_info * uint8_t imask; if (keylen == sizeof(in_addr_t)) { +#ifdef INET head = (struct chashbhead *)ti->state; imask = ti->data >> 24; hsize = 1 << ((ti->data & 0xFFFF) >> 8); @@ -1058,7 +1070,9 @@ ta_lookup_chash_slow(struct table_info * return (1); } } +#endif } else { +#ifdef INET6 /* IPv6: worst scenario: non-round mask */ struct in6_addr addr6; head = (struct chashbhead *)ti->xstate; @@ -1071,6 +1085,7 @@ ta_lookup_chash_slow(struct table_info * return (1); } } +#endif } return (0); @@ -1086,6 +1101,7 @@ ta_lookup_chash_aligned(struct table_inf uint8_t imask; if (keylen == sizeof(in_addr_t)) { +#ifdef INET head = (struct chashbhead *)ti->state; imask = ti->data >> 24; hsize = 1 << ((ti->data & 0xFFFF) >> 8); @@ -1099,7 +1115,9 @@ ta_lookup_chash_aligned(struct table_inf return (1); } } +#endif } else { +#ifdef INET6 /* IPv6: aligned to 8bit mask */ struct in6_addr addr6; uint64_t *paddr, *ptmp; @@ -1116,6 +1134,7 @@ ta_lookup_chash_aligned(struct table_inf return (1); } } +#endif } return (0); @@ -1131,6 +1150,7 @@ ta_lookup_chash_64(struct table_info *ti uint8_t imask; if (keylen == sizeof(in_addr_t)) { +#ifdef INET head = (struct chashbhead *)ti->state; imask = ti->data >> 24; hsize = 1 << ((ti->data & 0xFFFF) >> 8); @@ -1144,7 +1164,9 @@ ta_lookup_chash_64(struct table_info *ti return (1); } } +#endif } else { +#ifdef INET6 /* IPv6: /64 */ uint64_t a6, *paddr; head = (struct chashbhead *)ti->xstate; @@ -1159,6 +1181,7 @@ ta_lookup_chash_64(struct table_info *ti return (1); } } +#endif } return (0); @@ -1369,13 +1392,19 @@ hash_ent(struct chashentry *ent, int af, { uint32_t hash; + hash = 0; + if (af == AF_INET) { +#ifdef INET hash = hash_ip(ent->a.a4, size); +#endif } else { +#ifdef INET6 if (mlen == 64) hash = hash_ip64(&ent->a.a6, size); else hash = hash_ip6(&ent->a.a6, size); +#endif } return (hash); @@ -1384,8 +1413,10 @@ hash_ent(struct chashentry *ent, int af, static int tei_to_chash_ent(struct tentry_info *tei, struct chashentry *ent) { - struct in6_addr mask6; int mlen; +#ifdef INET6 + struct in6_addr mask6; +#endif mlen = tei->masklen; @@ -3357,8 +3388,12 @@ ta_dump_fhash_tentry(void *ta_state, str static int tei_to_fhash_ent(struct tentry_info *tei, struct fhashentry *ent) { +#ifdef INET struct fhashentry4 *fe4; +#endif +#ifdef INET6 struct fhashentry6 *fe6; +#endif struct tflow_entry *tfe; tfe = (struct tflow_entry *)tei->paddr; @@ -3905,8 +3940,12 @@ ta_dump_kfib_tentry(void *ta_state, stru ipfw_obj_tentry *tent) { struct rtentry *rte; +#ifdef INET struct sockaddr_in *addr, *mask; +#endif +#ifdef INET6 struct sockaddr_in6 *addr6, *mask6; +#endif int len; rte = (struct rtentry *)e; @@ -3915,6 +3954,7 @@ ta_dump_kfib_tentry(void *ta_state, stru len = 0; /* Guess IPv4/IPv6 radix by sockaddr family */ +#ifdef INET if (addr->sin_family == AF_INET) { tent->k.addr.s_addr = addr->sin_addr.s_addr; len = 32; @@ -3925,8 +3965,10 @@ ta_dump_kfib_tentry(void *ta_state, stru tent->masklen = len; tent->subtype = AF_INET; tent->v.kidx = 0; /* Do we need to put GW here? */ + } +#endif #ifdef INET6 - } else if (addr->sin_family == AF_INET6) { + if (addr->sin_family == AF_INET6) { addr6 = (struct sockaddr_in6 *)addr; mask6 = (struct sockaddr_in6 *)mask; memcpy(&tent->k, &addr6->sin6_addr, sizeof(struct in6_addr)); @@ -3938,8 +3980,8 @@ ta_dump_kfib_tentry(void *ta_state, stru tent->masklen = len; tent->subtype = AF_INET6; tent->v.kidx = 0; -#endif } +#endif return (0); } From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 18:57:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 75CC8BC2; Fri, 10 Oct 2014 18:57:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 62478286; Fri, 10 Oct 2014 18:57:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9AIvDlH035162; Fri, 10 Oct 2014 18:57:13 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9AIvD5L035161; Fri, 10 Oct 2014 18:57:13 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201410101857.s9AIvD5L035161@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Fri, 10 Oct 2014 18:57:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272900 - head/sys/netpfil/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 18:57:13 -0000 Author: melifaro Date: Fri Oct 10 18:57:12 2014 New Revision: 272900 URL: https://svnweb.freebsd.org/changeset/base/272900 Log: Fix KASSERT argument type. Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_sockopt.c Fri Oct 10 18:31:35 2014 (r272899) +++ head/sys/netpfil/ipfw/ip_fw_sockopt.c Fri Oct 10 18:57:12 2014 (r272900) @@ -3185,7 +3185,7 @@ ipfw_objhash_bitmap_alloc(uint32_t items u_long *idx_mask; KASSERT((items % BLOCK_ITEMS) == 0, - ("bitmask size needs to power of 2 and greater or equal to %lu", + ("bitmask size needs to power of 2 and greater or equal to %zu", BLOCK_ITEMS)); max_blocks = items / BLOCK_ITEMS; From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 18:57:40 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8C6F9D0B; Fri, 10 Oct 2014 18:57:40 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 78D7929B; Fri, 10 Oct 2014 18:57:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9AIvepL035258; Fri, 10 Oct 2014 18:57:40 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9AIve3K035257; Fri, 10 Oct 2014 18:57:40 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410101857.s9AIve3K035257@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 10 Oct 2014 18:57:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272901 - head/contrib/netbsd-tests/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 18:57:40 -0000 Author: ngie Date: Fri Oct 10 18:57:39 2014 New Revision: 272901 URL: https://svnweb.freebsd.org/changeset/base/272901 Log: Disable tests that don't pass on FreeBSD due to missing support in humanize_number(3). Bringing in additional revisions from NetBSD's humanize_number(3) will fix the tests Account for the fact that util.h on NetBSD is libutil.h on FreeBSD Submitted by: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c Modified: head/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c Fri Oct 10 18:57:12 2014 (r272900) +++ head/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c Fri Oct 10 18:57:39 2014 (r272901) @@ -34,7 +34,11 @@ #include #include #include +#if defined(__FreeBSD__) +#include +#else #include +#endif const struct hnopts { size_t ho_len; @@ -78,6 +82,7 @@ const struct hnopts { /* * Truncated output. Rev. 1.7 produces "1.0 K". */ +#if !defined(__FreeBSD__) { 6, 1000, "A", HN_AUTOSCALE, HN_DECIMAL, -1, "" }, /* @@ -90,6 +95,7 @@ const struct hnopts { /* Similar case it prints 1000 where it shouldn't */ { 5, 1023488, "", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL, 4, "1.0M" }, +#endif { 5, 1023999, "", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL, 4, "1.0M" }, }; From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 18:59:19 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A8852E67; Fri, 10 Oct 2014 18:59:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 94F5E2B6; Fri, 10 Oct 2014 18:59:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9AIxJIi035514; Fri, 10 Oct 2014 18:59:19 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9AIxJHW035513; Fri, 10 Oct 2014 18:59:19 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410101859.s9AIxJHW035513@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 10 Oct 2014 18:59:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272902 - head/contrib/netbsd-tests/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 18:59:19 -0000 Author: ngie Date: Fri Oct 10 18:59:18 2014 New Revision: 272902 URL: https://svnweb.freebsd.org/changeset/base/272902 Log: Add missing #include for gettimeofday Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/gen/t_time.c Modified: head/contrib/netbsd-tests/lib/libc/gen/t_time.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/gen/t_time.c Fri Oct 10 18:57:39 2014 (r272901) +++ head/contrib/netbsd-tests/lib/libc/gen/t_time.c Fri Oct 10 18:59:18 2014 (r272902) @@ -31,6 +31,9 @@ #include __RCSID("$NetBSD: t_time.c,v 1.2 2011/11/11 05:03:38 jruoho Exp $"); +#if defined(__FreeBSD__) +#include +#endif #include #include #include From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 19:02:03 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3B608FDC; Fri, 10 Oct 2014 19:02:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 27AAC36D; Fri, 10 Oct 2014 19:02:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9AJ23WZ039394; Fri, 10 Oct 2014 19:02:03 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9AJ23Fc039393; Fri, 10 Oct 2014 19:02:03 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410101902.s9AJ23Fc039393@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 10 Oct 2014 19:02:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272903 - head/contrib/netbsd-tests/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 19:02:03 -0000 Author: ngie Date: Fri Oct 10 19:02:02 2014 New Revision: 272903 URL: https://svnweb.freebsd.org/changeset/base/272903 Log: FreeBSD returns ENOTTY instead of EBADF in ttyname_r; mark it as an expected failure PR: 191936 In collaboration with: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c Modified: head/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c Fri Oct 10 18:59:18 2014 (r272902) +++ head/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c Fri Oct 10 19:02:02 2014 (r272903) @@ -107,6 +107,9 @@ ATF_TC_BODY(ttyname_r_err, tc) ATF_REQUIRE(rv == ERANGE); } +#if defined(__FreeBSD__) + atf_tc_expect_fail("FreeBSD returns ENOTTY instead of EBADF; see bin/191936"); +#endif rv = ttyname_r(-1, buf, ttymax); ATF_REQUIRE(rv == EBADF); From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 19:12:06 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 664DC307; Fri, 10 Oct 2014 19:12:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 38E0166A; Fri, 10 Oct 2014 19:12:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9AJC6CC044202; Fri, 10 Oct 2014 19:12:06 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9AJC5uw044199; Fri, 10 Oct 2014 19:12:05 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201410101912.s9AJC5uw044199@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 10 Oct 2014 19:12:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272904 - in head/sys/dev: ctau cx digi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 19:12:06 -0000 Author: jhb Date: Fri Oct 10 19:12:04 2014 New Revision: 272904 URL: https://svnweb.freebsd.org/changeset/base/272904 Log: Don't pass RF_ALLOCATED to bus_alloc_resource(). Modified: head/sys/dev/ctau/if_ct.c head/sys/dev/cx/if_cx.c head/sys/dev/digi/digi_isa.c Modified: head/sys/dev/ctau/if_ct.c ============================================================================== --- head/sys/dev/ctau/if_ct.c Fri Oct 10 19:02:02 2014 (r272903) +++ head/sys/dev/ctau/if_ct.c Fri Oct 10 19:12:04 2014 (r272904) @@ -323,8 +323,7 @@ static int ct_is_free_res (device_t dev, { struct resource *res; - if (!(res = bus_alloc_resource (dev, type, &rid, start, end, count, - RF_ALLOCATED))) + if (!(res = bus_alloc_resource (dev, type, &rid, start, end, count, 0))) return 0; bus_release_resource (dev, type, rid, res); Modified: head/sys/dev/cx/if_cx.c ============================================================================== --- head/sys/dev/cx/if_cx.c Fri Oct 10 19:02:02 2014 (r272903) +++ head/sys/dev/cx/if_cx.c Fri Oct 10 19:12:04 2014 (r272904) @@ -410,8 +410,7 @@ static int cx_is_free_res (device_t dev, { struct resource *res; - if (!(res = bus_alloc_resource (dev, type, &rid, start, end, count, - RF_ALLOCATED))) + if (!(res = bus_alloc_resource (dev, type, &rid, start, end, count, 0))) return 0; bus_release_resource (dev, type, rid, res); Modified: head/sys/dev/digi/digi_isa.c ============================================================================== --- head/sys/dev/digi/digi_isa.c Fri Oct 10 19:02:02 2014 (r272903) +++ head/sys/dev/digi/digi_isa.c Fri Oct 10 19:12:04 2014 (r272904) @@ -292,7 +292,7 @@ digi_isa_probe(device_t dev) /* Temporarily map our memory */ sc->res.mrid = 0; sc->res.mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->res.mrid, - 0ul, ~0ul, sc->win_size, RF_ALLOCATED); + 0ul, ~0ul, sc->win_size, 0); if (sc->res.mem == NULL) { device_printf(dev, "0x%lx: Memory range is in use\n", sc->pmem); bus_release_resource(dev, SYS_RES_IOPORT, sc->res.iorid, From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 19:18:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D63E052D; Fri, 10 Oct 2014 19:18:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B77BF6A8; Fri, 10 Oct 2014 19:18:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9AJIrtl045156; Fri, 10 Oct 2014 19:18:53 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9AJIrLW045154; Fri, 10 Oct 2014 19:18:53 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410101918.s9AJIrLW045154@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 10 Oct 2014 19:18:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272905 - head/contrib/netbsd-tests/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 19:18:54 -0000 Author: ngie Date: Fri Oct 10 19:18:52 2014 New Revision: 272905 URL: https://svnweb.freebsd.org/changeset/base/272905 Log: FreeBSD doesn't support strings greater than MAXHOSTNAMELEN-1 in {get,set}{domain,host}name. Adjust the tests to not exceed that value when testing out the code Add a positive and negative test for MAXHOSTNAMELEN-1 and MAXHOSTNAMELEN, respectively PR: 181127 In collaboration with: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c head/contrib/netbsd-tests/lib/libc/gen/t_sethostname.c Modified: head/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c Fri Oct 10 19:12:04 2014 (r272904) +++ head/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c Fri Oct 10 19:18:52 2014 (r272905) @@ -63,8 +63,20 @@ ATF_TC_BODY(setdomainname_basic, tc) (void)memset(name, 0, sizeof(name)); +#if defined(__FreeBSD__) + /* + * Sanity checks to ensure that the wrong invariant isn't being + * tested for per PR # 181127 + */ + ATF_REQUIRE_EQ(sizeof(domains[i]), MAXHOSTNAMELEN); + ATF_REQUIRE_EQ(sizeof(name), MAXHOSTNAMELEN); + + ATF_REQUIRE(setdomainname(domains[i],sizeof(domains[i]) - 1) == 0); + ATF_REQUIRE(getdomainname(name, sizeof(name) - 1) == 0); +#else ATF_REQUIRE(setdomainname(domains[i],sizeof(domains[i])) == 0); ATF_REQUIRE(getdomainname(name, sizeof(name)) == 0); +#endif ATF_REQUIRE(strcmp(domains[i], name) == 0); } @@ -89,6 +101,10 @@ ATF_TC_BODY(setdomainname_limit, tc) (void)memset(name, 0, sizeof(name)); +#if defined(__FreeBSD__) + ATF_REQUIRE(setdomainname(name, MAXHOSTNAMELEN - 1 ) == 0); + ATF_REQUIRE(setdomainname(name, MAXHOSTNAMELEN) == -1); +#endif ATF_REQUIRE(setdomainname(name, sizeof(name)) == -1); } Modified: head/contrib/netbsd-tests/lib/libc/gen/t_sethostname.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/gen/t_sethostname.c Fri Oct 10 19:12:04 2014 (r272904) +++ head/contrib/netbsd-tests/lib/libc/gen/t_sethostname.c Fri Oct 10 19:18:52 2014 (r272905) @@ -63,8 +63,20 @@ ATF_TC_BODY(sethostname_basic, tc) (void)memset(name, 0, sizeof(name)); +#if defined(__FreeBSD__) + /* + * Sanity checks to ensure that the wrong invariant isn't being + * tested for per PR # 181127 + */ + ATF_REQUIRE_EQ(sizeof(hosts[i]), MAXHOSTNAMELEN); + ATF_REQUIRE_EQ(sizeof(name), MAXHOSTNAMELEN); + + ATF_REQUIRE(sethostname(hosts[i], sizeof(hosts[i]) - 1) == 0); + ATF_REQUIRE(gethostname(name, sizeof(name) - 1) == 0); +#else ATF_REQUIRE(sethostname(hosts[i], sizeof(hosts[i])) == 0); ATF_REQUIRE(gethostname(name, sizeof(name)) == 0); +#endif ATF_REQUIRE(strcmp(hosts[i], name) == 0); } @@ -94,6 +106,10 @@ ATF_TC_BODY(sethostname_limit, tc) ATF_TC_CLEANUP(sethostname_limit, tc) { +#if defined(__FreeBSD__) + ATF_REQUIRE(sethostname(host, MAXHOSTNAMELEN - 1 ) == 0); + ATF_REQUIRE(sethostname(host, MAXHOSTNAMELEN) == -1); +#endif (void)sethostname(host, sizeof(host)); } From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 19:26:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 64E2A7E5; Fri, 10 Oct 2014 19:26:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 460FE7EC; Fri, 10 Oct 2014 19:26:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9AJQSAn049606; Fri, 10 Oct 2014 19:26:28 GMT (envelope-from gnn@FreeBSD.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9AJQRY1049602; Fri, 10 Oct 2014 19:26:27 GMT (envelope-from gnn@FreeBSD.org) Message-Id: <201410101926.s9AJQRY1049602@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gnn set sender to gnn@FreeBSD.org using -f From: "George V. Neville-Neil" Date: Fri, 10 Oct 2014 19:26:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272906 - in head/sys: conf libkern netpfil/pf sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 19:26:28 -0000 Author: gnn Date: Fri Oct 10 19:26:26 2014 New Revision: 272906 URL: https://svnweb.freebsd.org/changeset/base/272906 Log: Change the PF hash from Jenkins to Murmur3. In forwarding tests this showed a conservative 3% incrase in PPS. Differential Revision: https://reviews.freebsd.org/D461 Submitted by: des Reviewed by: emaste MFC after: 1 month Added: head/sys/libkern/murmur3_32.c (contents, props changed) Modified: head/sys/conf/files head/sys/netpfil/pf/pf.c head/sys/sys/hash.h Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Oct 10 19:18:52 2014 (r272905) +++ head/sys/conf/files Fri Oct 10 19:26:26 2014 (r272906) @@ -3175,6 +3175,7 @@ libkern/inet_ntoa.c standard libkern/inet_ntop.c standard libkern/inet_pton.c standard libkern/jenkins_hash.c standard +libkern/murmur3_32.c standard libkern/mcount.c optional profiling-routine libkern/memcchr.c standard libkern/memchr.c optional fdt | gdb Added: head/sys/libkern/murmur3_32.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/libkern/murmur3_32.c Fri Oct 10 19:26:26 2014 (r272906) @@ -0,0 +1,74 @@ +/*- + * Copyright (c) 2014 Dag-Erling Smørgrav + * 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, 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. + */ + +#include +#include +#include +#include + +#define rol32(i32, n) ((i32) << (n) | (i32) >> (32 - (n))) + +/* + * $FreeBSD$ + * Simple implementation of the Murmur3-32 hash function optimized for + * aligned sequences of 32-bit words. If len is not a multiple of 4, it + * will be rounded down, droping trailer bytes. + */ +uint32_t +murmur3_aligned_32(const void *data, size_t len, uint32_t seed) +{ + const uint32_t *data32; + uint32_t hash, k; + size_t res; + + /* initialize */ + len -= len % sizeof(*data32); + res = len; + data32 = data; + hash = seed; + + /* iterate */ + for (res = 0; res < len; res += sizeof(*data32), data32++) { + k = le32toh(*data32); + k *= 0xcc9e2d51; + k = rol32(k, 15); + k *= 0x1b873593; + hash ^= k; + hash = rol32(hash, 13); + hash *= 5; + hash += 0xe6546b64; + } + + /* finalize */ + hash ^= (uint32_t)len; + hash ^= hash >> 16; + hash *= 0x85ebca6b; + hash ^= hash >> 13; + hash *= 0xc2b2ae35; + hash ^= hash >> 16; + return (hash); +} + Modified: head/sys/netpfil/pf/pf.c ============================================================================== --- head/sys/netpfil/pf/pf.c Fri Oct 10 19:18:52 2014 (r272905) +++ head/sys/netpfil/pf/pf.c Fri Oct 10 19:26:26 2014 (r272906) @@ -374,9 +374,9 @@ pf_hashkey(struct pf_state_key *sk) { uint32_t h; - h = jenkins_hash32((uint32_t *)sk, - sizeof(struct pf_state_key_cmp)/sizeof(uint32_t), - V_pf_hashseed); + h = murmur3_aligned_32((uint32_t *)sk, + sizeof(struct pf_state_key_cmp), + V_pf_hashseed); return (h & pf_hashmask); } @@ -388,12 +388,12 @@ pf_hashsrc(struct pf_addr *addr, sa_fami switch (af) { case AF_INET: - h = jenkins_hash32((uint32_t *)&addr->v4, - sizeof(addr->v4)/sizeof(uint32_t), V_pf_hashseed); + h = murmur3_aligned_32((uint32_t *)&addr->v4, + sizeof(addr->v4), V_pf_hashseed); break; case AF_INET6: - h = jenkins_hash32((uint32_t *)&addr->v6, - sizeof(addr->v6)/sizeof(uint32_t), V_pf_hashseed); + h = murmur3_aligned_32((uint32_t *)&addr->v6, + sizeof(addr->v6), V_pf_hashseed); break; default: panic("%s: unknown address family %u", __func__, af); Modified: head/sys/sys/hash.h ============================================================================== --- head/sys/sys/hash.h Fri Oct 10 19:18:52 2014 (r272905) +++ head/sys/sys/hash.h Fri Oct 10 19:26:26 2014 (r272906) @@ -125,6 +125,9 @@ hash32_strne(const void *buf, size_t len */ uint32_t jenkins_hash(const void *, size_t, uint32_t); uint32_t jenkins_hash32(const uint32_t *, size_t, uint32_t); + +uint32_t murmur3_aligned_32(const void *data, size_t len, uint32_t seed); + #endif /* _KERNEL */ #endif /* !_SYS_HASH_H_ */ From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 19:27:37 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 126E2B0D; Fri, 10 Oct 2014 19:27:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E898F7FE; Fri, 10 Oct 2014 19:27:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9AJRa4s049811; Fri, 10 Oct 2014 19:27:36 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9AJRaaN049810; Fri, 10 Oct 2014 19:27:36 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201410101927.s9AJRaaN049810@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 10 Oct 2014 19:27:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272907 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 19:27:37 -0000 Author: kib Date: Fri Oct 10 19:27:36 2014 New Revision: 272907 URL: https://svnweb.freebsd.org/changeset/base/272907 Log: Make MAP_NOSYNC handling in the vm_fault() read-locked object path compatible with write-locked path. Test for MAP_ENTRY_NOSYNC and set VPO_NOSYNC for pages with dirty mask zero (this does not exclude a possibility that the page is dirty, e.g. due to read fault on writeable mapping and consequent write; the same issue exists in the slow path). Use helper vm_fault_dirty() to unify fast and slow path handling of VPO_NOSYNC and setting the dirty mask. Reviewed by: alc Sponsored by: The FreeBSD Foundation Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Fri Oct 10 19:26:26 2014 (r272906) +++ head/sys/vm/vm_fault.c Fri Oct 10 19:27:36 2014 (r272907) @@ -174,6 +174,70 @@ unlock_and_deallocate(struct faultstate } } +static void +vm_fault_dirty(vm_map_entry_t entry, vm_page_t m, vm_prot_t prot, + vm_prot_t fault_type, int fault_flags, boolean_t set_wd) +{ + boolean_t need_dirty; + + if (((prot & VM_PROT_WRITE) == 0 && + (fault_flags & VM_FAULT_DIRTY) == 0) || + (m->oflags & VPO_UNMANAGED) != 0) + return; + + VM_OBJECT_ASSERT_LOCKED(m->object); + + need_dirty = ((fault_type & VM_PROT_WRITE) != 0 && + (fault_flags & VM_FAULT_CHANGE_WIRING) == 0) || + (fault_flags & VM_FAULT_DIRTY) != 0; + + if (set_wd) + vm_object_set_writeable_dirty(m->object); + else + /* + * If two callers of vm_fault_dirty() with set_wd == + * FALSE, one for the map entry with MAP_ENTRY_NOSYNC + * flag set, other with flag clear, race, it is + * possible for the no-NOSYNC thread to see m->dirty + * != 0 and not clear VPO_NOSYNC. Take vm_page lock + * around manipulation of VPO_NOSYNC and + * vm_page_dirty() call, to avoid the race and keep + * m->oflags consistent. + */ + vm_page_lock(m); + + /* + * If this is a NOSYNC mmap we do not want to set VPO_NOSYNC + * if the page is already dirty to prevent data written with + * the expectation of being synced from not being synced. + * Likewise if this entry does not request NOSYNC then make + * sure the page isn't marked NOSYNC. Applications sharing + * data should use the same flags to avoid ping ponging. + */ + if ((entry->eflags & MAP_ENTRY_NOSYNC) != 0) { + if (m->dirty == 0) { + m->oflags |= VPO_NOSYNC; + } + } else { + m->oflags &= ~VPO_NOSYNC; + } + + /* + * If the fault is a write, we know that this page is being + * written NOW so dirty it explicitly to save on + * pmap_is_modified() calls later. + * + * Also tell the backing pager, if any, that it should remove + * any swap backing since the page is now dirty. + */ + if (need_dirty) + vm_page_dirty(m); + if (!set_wd) + vm_page_unlock(m); + if (need_dirty) + vm_pager_page_unswapped(m); +} + /* * TRYPAGER - used by vm_fault to calculate whether the pager for the * current object *might* contain the page. @@ -321,11 +385,8 @@ RetryFault:; vm_page_hold(m); vm_page_unlock(m); } - if ((fault_type & VM_PROT_WRITE) != 0 && - (m->oflags & VPO_UNMANAGED) == 0) { - vm_page_dirty(m); - vm_pager_page_unswapped(m); - } + vm_fault_dirty(fs.entry, m, prot, fault_type, fault_flags, + FALSE); VM_OBJECT_RUNLOCK(fs.first_object); if (!wired) vm_fault_prefault(&fs, vaddr, 0, 0); @@ -898,42 +959,7 @@ vnode_locked: if (hardfault) fs.entry->next_read = fs.pindex + faultcount - reqpage; - if (((prot & VM_PROT_WRITE) != 0 || - (fault_flags & VM_FAULT_DIRTY) != 0) && - (fs.m->oflags & VPO_UNMANAGED) == 0) { - vm_object_set_writeable_dirty(fs.object); - - /* - * If this is a NOSYNC mmap we do not want to set VPO_NOSYNC - * if the page is already dirty to prevent data written with - * the expectation of being synced from not being synced. - * Likewise if this entry does not request NOSYNC then make - * sure the page isn't marked NOSYNC. Applications sharing - * data should use the same flags to avoid ping ponging. - */ - if (fs.entry->eflags & MAP_ENTRY_NOSYNC) { - if (fs.m->dirty == 0) - fs.m->oflags |= VPO_NOSYNC; - } else { - fs.m->oflags &= ~VPO_NOSYNC; - } - - /* - * If the fault is a write, we know that this page is being - * written NOW so dirty it explicitly to save on - * pmap_is_modified() calls later. - * - * Also tell the backing pager, if any, that it should remove - * any swap backing since the page is now dirty. - */ - if (((fault_type & VM_PROT_WRITE) != 0 && - (fault_flags & VM_FAULT_CHANGE_WIRING) == 0) || - (fault_flags & VM_FAULT_DIRTY) != 0) { - vm_page_dirty(fs.m); - vm_pager_page_unswapped(fs.m); - } - } - + vm_fault_dirty(fs.entry, fs.m, prot, fault_type, fault_flags, TRUE); vm_page_assert_xbusied(fs.m); /* From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 19:28:58 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 25EE1C9B; Fri, 10 Oct 2014 19:28:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1254582D; Fri, 10 Oct 2014 19:28:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9AJSvOV050034; Fri, 10 Oct 2014 19:28:57 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9AJSvN3050033; Fri, 10 Oct 2014 19:28:57 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410101928.s9AJSvN3050033@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 10 Oct 2014 19:28:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272908 - head/contrib/netbsd-tests/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 19:28:58 -0000 Author: ngie Date: Fri Oct 10 19:28:57 2014 New Revision: 272908 URL: https://svnweb.freebsd.org/changeset/base/272908 Log: Disable the invalid pointer test on FreeBSD FreeBSD segfaults on invalid pointers passed to getcwd because it throbs the address passed in in libc, whereas NetBSD just passes the information off to the syscall, which allows the kernel to return EFAULT on bad pointers. In collaboration with: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/gen/t_getcwd.c Modified: head/contrib/netbsd-tests/lib/libc/gen/t_getcwd.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/gen/t_getcwd.c Fri Oct 10 19:27:36 2014 (r272907) +++ head/contrib/netbsd-tests/lib/libc/gen/t_getcwd.c Fri Oct 10 19:28:57 2014 (r272908) @@ -56,10 +56,12 @@ ATF_TC_BODY(getcwd_err, tc) ATF_REQUIRE(getcwd(buf, 0) == NULL); ATF_REQUIRE(errno == EINVAL); +#if defined(__NetBSD__) errno = 0; ATF_REQUIRE(getcwd((void *)-1, sizeof(buf)) == NULL); ATF_REQUIRE(errno == EFAULT); +#endif } ATF_TC(getcwd_fts); From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 19:32:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 845DC1DD; Fri, 10 Oct 2014 19:32:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 581DA8EC; Fri, 10 Oct 2014 19:32:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9AJWsh3054057; Fri, 10 Oct 2014 19:32:54 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9AJWsHq054056; Fri, 10 Oct 2014 19:32:54 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410101932.s9AJWsHq054056@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 10 Oct 2014 19:32:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272909 - head/contrib/netbsd-tests/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 19:32:54 -0000 Author: ngie Date: Fri Oct 10 19:32:53 2014 New Revision: 272909 URL: https://svnweb.freebsd.org/changeset/base/272909 Log: Handle getting/setting niceness/priority correctly on FreeBSD vs NetBSD This might be fallout from PR: 189821 Submitted by: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/gen/t_nice.c Modified: head/contrib/netbsd-tests/lib/libc/gen/t_nice.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/gen/t_nice.c Fri Oct 10 19:28:57 2014 (r272908) +++ head/contrib/netbsd-tests/lib/libc/gen/t_nice.c Fri Oct 10 19:32:53 2014 (r272909) @@ -93,7 +93,11 @@ ATF_TC_HEAD(nice_priority, tc) ATF_TC_BODY(nice_priority, tc) { +#if defined(__FreeBSD__) + int i, pri, pri2, nic; +#else int i, pri, nic; +#endif pid_t pid; int sta; @@ -106,8 +110,10 @@ ATF_TC_BODY(nice_priority, tc) pri = getpriority(PRIO_PROCESS, 0); ATF_REQUIRE(errno == 0); +#if defined(__NetBSD__) if (nic != pri) atf_tc_fail("nice(3) and getpriority(2) conflict"); +#endif /* * Also verify that the nice(3) values @@ -119,10 +125,18 @@ ATF_TC_BODY(nice_priority, tc) if (pid == 0) { errno = 0; +#if defined(__FreeBSD__) pri = getpriority(PRIO_PROCESS, 0); +#else + pri2 = getpriority(PRIO_PROCESS, 0); +#endif ATF_REQUIRE(errno == 0); +#if defined(__FreeBSD__) + if (pri != pri2) +#else if (nic != pri) +#endif _exit(EXIT_FAILURE); _exit(EXIT_SUCCESS); @@ -161,7 +175,11 @@ ATF_TC_HEAD(nice_thread, tc) ATF_TC_BODY(nice_thread, tc) { pthread_t tid[5]; +#if defined(__FreeBSD__) + int pri, rv, val; +#else int rv, val; +#endif size_t i; /* @@ -173,7 +191,12 @@ ATF_TC_BODY(nice_thread, tc) val = nice(i); ATF_REQUIRE(val != -1); +#if defined(__FreeBSD__) + pri = getpriority(PRIO_PROCESS, 0); + rv = pthread_create(&tid[i], NULL, threadfunc, &pri); +#else rv = pthread_create(&tid[i], NULL, threadfunc, &val); +#endif ATF_REQUIRE(rv == 0); rv = pthread_join(tid[i], NULL); From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 19:34:20 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 912E335F; Fri, 10 Oct 2014 19:34:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D7EB90E; Fri, 10 Oct 2014 19:34:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9AJYK3k054337; Fri, 10 Oct 2014 19:34:20 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9AJYKZS054336; Fri, 10 Oct 2014 19:34:20 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410101934.s9AJYKZS054336@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 10 Oct 2014 19:34:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272910 - head/contrib/netbsd-tests/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 19:34:20 -0000 Author: ngie Date: Fri Oct 10 19:34:19 2014 New Revision: 272910 URL: https://svnweb.freebsd.org/changeset/base/272910 Log: SIGPWR does not exist on FreeBSD Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/gen/t_raise.c Modified: head/contrib/netbsd-tests/lib/libc/gen/t_raise.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/gen/t_raise.c Fri Oct 10 19:32:53 2014 (r272909) +++ head/contrib/netbsd-tests/lib/libc/gen/t_raise.c Fri Oct 10 19:34:19 2014 (r272910) @@ -43,7 +43,11 @@ static int count; static void handler_err(int); static void handler_ret(int); static void handler_stress(int); +#if defined(__FreeBSD__) +static int sig[] = { SIGALRM, SIGIO, SIGUSR1, SIGUSR2 }; +#else static int sig[] = { SIGALRM, SIGIO, SIGUSR1, SIGUSR2, SIGPWR }; +#endif static void handler_stress(int signo) From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 19:41:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E791068D; Fri, 10 Oct 2014 19:41:11 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D2CEE954; Fri, 10 Oct 2014 19:41:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9AJfBYM056478; Fri, 10 Oct 2014 19:41:11 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9AJfA6P056471; Fri, 10 Oct 2014 19:41:10 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410101941.s9AJfA6P056471@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 10 Oct 2014 19:41:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272911 - in head: sys/cam/ctl usr.sbin/ctladm usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 19:41:12 -0000 Author: mav Date: Fri Oct 10 19:41:09 2014 New Revision: 272911 URL: https://svnweb.freebsd.org/changeset/base/272911 Log: Make ctld start even if some LUNs are unable to open backing storage. Such LUNs will be visible to initiators, but return "not ready" status on media access commands. If backing storage become available later, `ctladm modify ...` or `service ctld reload` can trigger its reopen. Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_backend.h head/sys/cam/ctl/ctl_backend_block.c head/sys/cam/ctl/ctl_cmd_table.c head/sys/cam/ctl/ctl_ioctl.h head/usr.sbin/ctladm/ctladm.c head/usr.sbin/ctld/kernel.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Fri Oct 10 19:34:19 2014 (r272910) +++ head/sys/cam/ctl/ctl.c Fri Oct 10 19:41:09 2014 (r272911) @@ -4599,6 +4599,9 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft be_lun->ctl_lun = lun; be_lun->lun_id = lun_number; atomic_add_int(&be_lun->be->num_luns, 1); + if (be_lun->flags & CTL_LUN_FLAG_OFFLINE) + lun->flags |= CTL_LUN_OFFLINE; + if (be_lun->flags & CTL_LUN_FLAG_POWERED_OFF) lun->flags |= CTL_LUN_STOPPED; Modified: head/sys/cam/ctl/ctl_backend.h ============================================================================== --- head/sys/cam/ctl/ctl_backend.h Fri Oct 10 19:34:19 2014 (r272910) +++ head/sys/cam/ctl/ctl_backend.h Fri Oct 10 19:41:09 2014 (r272911) @@ -73,6 +73,8 @@ * The DEV_TYPE flag tells us that the device_type field is filled in. * * The UNMAP flag tells us that this LUN supports UNMAP. + * + * The OFFLINE flag tells us that this LUN can not access backing store. */ typedef enum { CTL_LUN_FLAG_ID_REQ = 0x01, @@ -82,7 +84,8 @@ typedef enum { CTL_LUN_FLAG_SERIAL_NUM = 0x10, CTL_LUN_FLAG_DEVID = 0x20, CTL_LUN_FLAG_DEV_TYPE = 0x40, - CTL_LUN_FLAG_UNMAP = 0x80 + CTL_LUN_FLAG_UNMAP = 0x80, + CTL_LUN_FLAG_OFFLINE = 0x100 } ctl_backend_lun_flags; #ifdef _KERNEL Modified: head/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_block.c Fri Oct 10 19:34:19 2014 (r272910) +++ head/sys/cam/ctl/ctl_backend_block.c Fri Oct 10 19:41:09 2014 (r272911) @@ -151,6 +151,7 @@ typedef void (*cbb_dispatch_t)(struct ct * and a backend block LUN, and between a backend block LUN and a CTL LUN. */ struct ctl_be_block_lun { + struct ctl_lun_create_params params; struct ctl_block_disk *disk; char lunname[32]; char *dev_path; @@ -1521,7 +1522,7 @@ ctl_be_block_ioctl(struct cdev *dev, u_l default: lun_req->status = CTL_LUN_ERROR; snprintf(lun_req->error_str, sizeof(lun_req->error_str), - "%s: invalid LUN request type %d", __func__, + "invalid LUN request type %d", lun_req->reqtype); break; } @@ -1545,7 +1546,7 @@ ctl_be_block_open_file(struct ctl_be_blo error = 0; file_data = &be_lun->backend.file; - params = &req->reqdata.create; + params = &be_lun->params; be_lun->dev_type = CTL_BE_BLOCK_FILE; be_lun->dispatch = ctl_be_block_dispatch_file; @@ -1628,7 +1629,7 @@ ctl_be_block_open_dev(struct ctl_be_bloc int error; off_t ps, pss, po, pos; - params = &req->reqdata.create; + params = &be_lun->params; be_lun->dev_type = CTL_BE_BLOCK_DEV; be_lun->backend.dev.cdev = be_lun->vn->v_rdev; @@ -1646,8 +1647,8 @@ ctl_be_block_open_dev(struct ctl_be_bloc error = VOP_GETATTR(be_lun->vn, &vattr, NOCRED); if (error) { snprintf(req->error_str, sizeof(req->error_str), - "%s: error getting vnode attributes for device %s", - __func__, be_lun->dev_path); + "error getting vnode attributes for device %s", + be_lun->dev_path); return (error); } @@ -1655,7 +1656,7 @@ ctl_be_block_open_dev(struct ctl_be_bloc devsw = dev->si_devsw; if (!devsw->d_ioctl) { snprintf(req->error_str, sizeof(req->error_str), - "%s: no d_ioctl for device %s!", __func__, + "no d_ioctl for device %s!", be_lun->dev_path); return (ENODEV); } @@ -1665,8 +1666,8 @@ ctl_be_block_open_dev(struct ctl_be_bloc curthread); if (error) { snprintf(req->error_str, sizeof(req->error_str), - "%s: error %d returned for DIOCGSECTORSIZE ioctl " - "on %s!", __func__, error, be_lun->dev_path); + "error %d returned for DIOCGSECTORSIZE ioctl " + "on %s!", error, be_lun->dev_path); return (error); } @@ -1688,9 +1689,9 @@ ctl_be_block_open_dev(struct ctl_be_bloc be_lun->blocksize = params->blocksize_bytes; } else { snprintf(req->error_str, sizeof(req->error_str), - "%s: requested blocksize %u is not an even " + "requested blocksize %u is not an even " "multiple of backing device blocksize %u", - __func__, params->blocksize_bytes, + params->blocksize_bytes, be_lun->blocksize); return (EINVAL); @@ -1698,8 +1699,8 @@ ctl_be_block_open_dev(struct ctl_be_bloc } else if ((params->blocksize_bytes != 0) && (params->blocksize_bytes != be_lun->blocksize)) { snprintf(req->error_str, sizeof(req->error_str), - "%s: requested blocksize %u < backing device " - "blocksize %u", __func__, params->blocksize_bytes, + "requested blocksize %u < backing device " + "blocksize %u", params->blocksize_bytes, be_lun->blocksize); return (EINVAL); } @@ -1709,8 +1710,8 @@ ctl_be_block_open_dev(struct ctl_be_bloc curthread); if (error) { snprintf(req->error_str, sizeof(req->error_str), - "%s: error %d returned for DIOCGMEDIASIZE " - " ioctl on %s!", __func__, error, + "error %d returned for DIOCGMEDIASIZE " + " ioctl on %s!", error, be_lun->dev_path); return (error); } @@ -1718,8 +1719,8 @@ ctl_be_block_open_dev(struct ctl_be_bloc if (params->lun_size_bytes != 0) { if (params->lun_size_bytes > be_lun->size_bytes) { snprintf(req->error_str, sizeof(req->error_str), - "%s: requested LUN size %ju > backing device " - "size %ju", __func__, + "requested LUN size %ju > backing device " + "size %ju", (uintmax_t)params->lun_size_bytes, (uintmax_t)be_lun->size_bytes); return (EINVAL); @@ -1792,6 +1793,7 @@ ctl_be_block_close(struct ctl_be_block_l panic("Unexpected backend type."); break; } + be_lun->dev_type = CTL_BE_BLOCK_NONE; } PICKUP_GIANT(); @@ -1814,7 +1816,7 @@ ctl_be_block_open(struct ctl_be_block_so if (rootvnode == NULL) { snprintf(req->error_str, sizeof(req->error_str), - "%s: Root filesystem is not mounted", __func__); + "Root filesystem is not mounted"); return (1); } @@ -1858,7 +1860,7 @@ ctl_be_block_open(struct ctl_be_block_so } } snprintf(req->error_str, sizeof(req->error_str), - "%s: error opening %s", __func__, be_lun->dev_path); + "error opening %s: %d", be_lun->dev_path, error); return (error); } @@ -1902,11 +1904,13 @@ ctl_be_block_create(struct ctl_be_block_ params = &req->reqdata.create; retval = 0; + req->status = CTL_LUN_OK; num_threads = cbb_num_threads; be_lun = malloc(sizeof(*be_lun), M_CTLBLK, M_ZERO | M_WAITOK); + be_lun->params = req->reqdata.create; be_lun->softc = softc; STAILQ_INIT(&be_lun->input_queue); STAILQ_INIT(&be_lun->config_write_queue); @@ -1922,7 +1926,7 @@ ctl_be_block_create(struct ctl_be_block_ if (be_lun->lun_zone == NULL) { snprintf(req->error_str, sizeof(req->error_str), - "%s: error allocating UMA zone", __func__); + "error allocating UMA zone"); goto bailout_error; } @@ -1935,26 +1939,18 @@ ctl_be_block_create(struct ctl_be_block_ value = ctl_get_opt(&be_lun->ctl_be_lun.options, "file"); if (value == NULL) { snprintf(req->error_str, sizeof(req->error_str), - "%s: no file argument specified", __func__); + "no file argument specified"); goto bailout_error; } be_lun->dev_path = strdup(value, M_CTLBLK); + be_lun->blocksize = 512; + be_lun->blocksize_shift = fls(be_lun->blocksize) - 1; retval = ctl_be_block_open(softc, be_lun, req); if (retval != 0) { retval = 0; - goto bailout_error; + req->status = CTL_LUN_WARNING; } - - /* - * Tell the user the size of the file/device. - */ - params->lun_size_bytes = be_lun->size_bytes; - - /* - * The maximum LBA is the size - 1. - */ - be_lun->ctl_be_lun.maxlba = be_lun->size_blocks - 1; } else { /* * For processor devices, we don't have any size. @@ -1965,7 +1961,6 @@ ctl_be_block_create(struct ctl_be_block_ be_lun->size_blocks = 0; be_lun->size_bytes = 0; be_lun->ctl_be_lun.maxlba = 0; - params->lun_size_bytes = 0; /* * Default to just 1 thread for processor devices. @@ -1988,8 +1983,8 @@ ctl_be_block_create(struct ctl_be_block_ */ if (tmp_num_threads < 1) { snprintf(req->error_str, sizeof(req->error_str), - "%s: invalid number of threads %s", - __func__, num_thread_str); + "invalid number of threads %s", + num_thread_str); goto bailout_error; } num_threads = tmp_num_threads; @@ -2001,16 +1996,22 @@ ctl_be_block_create(struct ctl_be_block_ be_lun->flags = CTL_BE_BLOCK_LUN_UNCONFIGURED; be_lun->ctl_be_lun.flags = CTL_LUN_FLAG_PRIMARY; + if (be_lun->vn == NULL) + be_lun->ctl_be_lun.flags |= CTL_LUN_FLAG_OFFLINE; if (unmap) be_lun->ctl_be_lun.flags |= CTL_LUN_FLAG_UNMAP; - if (be_lun->dispatch == ctl_be_block_dispatch_zvol) - be_lun->ctl_be_lun.atomicblock = CTLBLK_MAX_IO_SIZE / - be_lun->blocksize; be_lun->ctl_be_lun.be_lun = be_lun; + be_lun->ctl_be_lun.maxlba = (be_lun->size_blocks == 0) ? + 0 : (be_lun->size_blocks - 1); be_lun->ctl_be_lun.blocksize = be_lun->blocksize; be_lun->ctl_be_lun.pblockexp = be_lun->pblockexp; be_lun->ctl_be_lun.pblockoff = be_lun->pblockoff; + if (be_lun->dispatch == ctl_be_block_dispatch_zvol && + be_lun->blocksize != 0) + be_lun->ctl_be_lun.atomicblock = CTLBLK_MAX_IO_SIZE / + be_lun->blocksize; /* Tell the user the blocksize we ended up using */ + params->lun_size_bytes = be_lun->size_bytes; params->blocksize_bytes = be_lun->blocksize; if (params->flags & CTL_LUN_FLAG_ID_REQ) { be_lun->ctl_be_lun.req_lun_id = params->req_lun_id; @@ -2062,7 +2063,7 @@ ctl_be_block_create(struct ctl_be_block_ if (be_lun->io_taskqueue == NULL) { snprintf(req->error_str, sizeof(req->error_str), - "%s: Unable to create taskqueue", __func__); + "unable to create taskqueue"); goto bailout_error; } @@ -2105,8 +2106,8 @@ ctl_be_block_create(struct ctl_be_block_ softc->num_luns--; mtx_unlock(&softc->lock); snprintf(req->error_str, sizeof(req->error_str), - "%s: ctl_add_lun() returned error %d, see dmesg for " - "details", __func__, retval); + "ctl_add_lun() returned error %d, see dmesg for " + "details", retval); retval = 0; goto bailout_error; } @@ -2128,8 +2129,7 @@ ctl_be_block_create(struct ctl_be_block_ if (be_lun->flags & CTL_BE_BLOCK_LUN_CONFIG_ERR) { snprintf(req->error_str, sizeof(req->error_str), - "%s: LUN configuration error, see dmesg for details", - __func__); + "LUN configuration error, see dmesg for details"); STAILQ_REMOVE(&softc->lun_list, be_lun, ctl_be_block_lun, links); softc->num_luns--; @@ -2148,9 +2148,6 @@ ctl_be_block_create(struct ctl_be_block_ | DEVSTAT_TYPE_IF_OTHER, DEVSTAT_PRIORITY_OTHER); - - req->status = CTL_LUN_OK; - return (retval); bailout_error: @@ -2192,8 +2189,8 @@ ctl_be_block_rm(struct ctl_be_block_soft if (be_lun == NULL) { snprintf(req->error_str, sizeof(req->error_str), - "%s: LUN %u is not managed by the block backend", - __func__, params->lun_id); + "LUN %u is not managed by the block backend", + params->lun_id); goto bailout_error; } @@ -2201,8 +2198,8 @@ ctl_be_block_rm(struct ctl_be_block_soft if (retval != 0) { snprintf(req->error_str, sizeof(req->error_str), - "%s: error %d returned from ctl_disable_lun() for " - "LUN %d", __func__, retval, params->lun_id); + "error %d returned from ctl_disable_lun() for " + "LUN %d", retval, params->lun_id); goto bailout_error; } @@ -2210,8 +2207,8 @@ ctl_be_block_rm(struct ctl_be_block_soft retval = ctl_invalidate_lun(&be_lun->ctl_be_lun); if (retval != 0) { snprintf(req->error_str, sizeof(req->error_str), - "%s: error %d returned from ctl_invalidate_lun() for " - "LUN %d", __func__, retval, params->lun_id); + "error %d returned from ctl_invalidate_lun() for " + "LUN %d", retval, params->lun_id); goto bailout_error; } @@ -2229,8 +2226,7 @@ ctl_be_block_rm(struct ctl_be_block_soft if ((be_lun->flags & CTL_BE_BLOCK_LUN_UNCONFIGURED) == 0) { snprintf(req->error_str, sizeof(req->error_str), - "%s: interrupted waiting for LUN to be freed", - __func__); + "interrupted waiting for LUN to be freed"); mtx_unlock(&softc->lock); goto bailout_error; } @@ -2274,9 +2270,7 @@ ctl_be_block_modify_file(struct ctl_be_b { struct vattr vattr; int error; - struct ctl_lun_modify_params *params; - - params = &req->reqdata.modify; + struct ctl_lun_create_params *params = &be_lun->params; if (params->lun_size_bytes != 0) { be_lun->size_bytes = params->lun_size_bytes; @@ -2303,16 +2297,13 @@ ctl_be_block_modify_dev(struct ctl_be_bl { struct ctl_be_block_devdata *dev_data; int error; - struct ctl_lun_modify_params *params; + struct ctl_lun_create_params *params = &be_lun->params; uint64_t size_bytes; - params = &req->reqdata.modify; - dev_data = &be_lun->backend.dev; if (!dev_data->csw->d_ioctl) { snprintf(req->error_str, sizeof(req->error_str), - "%s: no d_ioctl for device %s!", __func__, - be_lun->dev_path); + "no d_ioctl for device %s!", be_lun->dev_path); return (ENODEV); } @@ -2321,16 +2312,16 @@ ctl_be_block_modify_dev(struct ctl_be_bl curthread); if (error) { snprintf(req->error_str, sizeof(req->error_str), - "%s: error %d returned for DIOCGMEDIASIZE ioctl " - "on %s!", __func__, error, be_lun->dev_path); + "error %d returned for DIOCGMEDIASIZE ioctl " + "on %s!", error, be_lun->dev_path); return (error); } if (params->lun_size_bytes != 0) { if (params->lun_size_bytes > size_bytes) { snprintf(req->error_str, sizeof(req->error_str), - "%s: requested LUN size %ju > backing device " - "size %ju", __func__, + "requested LUN size %ju > backing device " + "size %ju", (uintmax_t)params->lun_size_bytes, (uintmax_t)size_bytes); return (EINVAL); @@ -2355,9 +2346,7 @@ ctl_be_block_modify(struct ctl_be_block_ params = &req->reqdata.modify; mtx_lock(&softc->lock); - be_lun = NULL; - STAILQ_FOREACH(be_lun, &softc->lun_list, links) { if (be_lun->ctl_be_lun.lun_id == params->lun_id) break; @@ -2366,29 +2355,22 @@ ctl_be_block_modify(struct ctl_be_block_ if (be_lun == NULL) { snprintf(req->error_str, sizeof(req->error_str), - "%s: LUN %u is not managed by the block backend", - __func__, params->lun_id); + "LUN %u is not managed by the block backend", + params->lun_id); goto bailout_error; } - if (params->lun_size_bytes != 0) { - if (params->lun_size_bytes < be_lun->blocksize) { - snprintf(req->error_str, sizeof(req->error_str), - "%s: LUN size %ju < blocksize %u", __func__, - params->lun_size_bytes, be_lun->blocksize); - goto bailout_error; - } - } + be_lun->params.lun_size_bytes = params->lun_size_bytes; - oldsize = be_lun->size_bytes; - if (be_lun->vn->v_type == VREG) + oldsize = be_lun->size_blocks; + if (be_lun->vn == NULL) + error = ctl_be_block_open(softc, be_lun, req); + else if (be_lun->vn->v_type == VREG) error = ctl_be_block_modify_file(be_lun, req); else error = ctl_be_block_modify_dev(be_lun, req); - if (error != 0) - goto bailout_error; - if (be_lun->size_bytes != oldsize) { + if (error == 0 && be_lun->size_blocks != oldsize) { be_lun->size_blocks = be_lun->size_bytes >> be_lun->blocksize_shift; @@ -2398,14 +2380,24 @@ ctl_be_block_modify(struct ctl_be_block_ * XXX: Note that this field is being updated without locking, * which might cause problems on 32-bit architectures. */ - be_lun->ctl_be_lun.maxlba = be_lun->size_blocks - 1; + be_lun->ctl_be_lun.maxlba = (be_lun->size_blocks == 0) ? + 0 : (be_lun->size_blocks - 1); + be_lun->ctl_be_lun.blocksize = be_lun->blocksize; + be_lun->ctl_be_lun.pblockexp = be_lun->pblockexp; + be_lun->ctl_be_lun.pblockoff = be_lun->pblockoff; + if (be_lun->dispatch == ctl_be_block_dispatch_zvol && + be_lun->blocksize != 0) + be_lun->ctl_be_lun.atomicblock = CTLBLK_MAX_IO_SIZE / + be_lun->blocksize; ctl_lun_capacity_changed(&be_lun->ctl_be_lun); + if (oldsize == 0 && be_lun->size_blocks != 0) + ctl_lun_online(&be_lun->ctl_be_lun); } /* Tell the user the exact size we ended up using */ params->lun_size_bytes = be_lun->size_bytes; - req->status = CTL_LUN_OK; + req->status = error ? CTL_LUN_WARNING : CTL_LUN_OK; return (0); Modified: head/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- head/sys/cam/ctl/ctl_cmd_table.c Fri Oct 10 19:34:19 2014 (r272910) +++ head/sys/cam/ctl/ctl_cmd_table.c Fri Oct 10 19:41:09 2014 (r272911) @@ -70,6 +70,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -81,6 +82,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -92,6 +94,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -103,6 +106,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -120,6 +124,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -131,6 +136,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -142,6 +148,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -153,6 +160,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -164,6 +172,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -178,6 +187,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -460,6 +470,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_report_tagret_port_groups, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN, CTL_LUN_PAT_NONE, @@ -472,6 +483,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_report_supported_opcodes, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -482,6 +494,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_report_supported_tmf, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -495,6 +508,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_report_timestamp, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN, CTL_LUN_PAT_NONE, @@ -601,6 +615,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_mode_select, CTL_SERIDX_MD_SEL, CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_NONE, 6, {0x11, 0, 0, 0xff, 0x07}}, @@ -610,6 +625,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_NONE, 6, {0, 0, 0, 0, 0x07}}, @@ -619,6 +635,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_NONE, CTL_LUN_PAT_NONE, 6, {0, 0, 0, 0, 0x07}}, @@ -633,6 +650,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_mode_sense, CTL_SERIDX_MD_SNS, CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -855,6 +873,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_mode_select, CTL_SERIDX_MD_SEL, CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_NONE, 10, {0x11, 0, 0, 0, 0, 0, 0xff, 0xff, 0x07} }, @@ -864,6 +883,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_NONE, 10, {0x02, 0, 0xff, 0, 0, 0, 0xff, 0xff, 0x07} }, @@ -873,6 +893,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_NONE, 10, {0x02, 0, 0xff, 0, 0, 0, 0xff, 0xff, 0x07} }, @@ -887,6 +908,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_mode_sense, CTL_SERIDX_MD_SNS, CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, Modified: head/sys/cam/ctl/ctl_ioctl.h ============================================================================== --- head/sys/cam/ctl/ctl_ioctl.h Fri Oct 10 19:34:19 2014 (r272910) +++ head/sys/cam/ctl/ctl_ioctl.h Fri Oct 10 19:41:09 2014 (r272911) @@ -363,7 +363,8 @@ struct ctl_port_list { typedef enum { CTL_LUN_NOSTATUS, CTL_LUN_OK, - CTL_LUN_ERROR + CTL_LUN_ERROR, + CTL_LUN_WARNING } ctl_lun_status; #define CTL_ERROR_STR_LEN 160 Modified: head/usr.sbin/ctladm/ctladm.c ============================================================================== --- head/usr.sbin/ctladm/ctladm.c Fri Oct 10 19:34:19 2014 (r272910) +++ head/usr.sbin/ctladm/ctladm.c Fri Oct 10 19:41:09 2014 (r272911) @@ -3174,14 +3174,18 @@ cctl_create_lun(int fd, int argc, char * goto bailout; } - if (req.status == CTL_LUN_ERROR) { - warnx("%s: error returned from LUN creation request:\n%s", - __func__, req.error_str); + switch (req.status) { + case CTL_LUN_ERROR: + warnx("LUN creation error: %s", req.error_str); retval = 1; goto bailout; - } else if (req.status != CTL_LUN_OK) { - warnx("%s: unknown LUN creation request status %d", - __func__, req.status); + case CTL_LUN_WARNING: + warnx("LUN creation warning: %s", req.error_str); + break; + case CTL_LUN_OK: + break; + default: + warnx("unknown LUN creation status: %d", req.status); retval = 1; goto bailout; } @@ -3320,19 +3324,23 @@ cctl_rm_lun(int fd, int argc, char **arg goto bailout; } - if (req.status == CTL_LUN_ERROR) { - warnx("%s: error returned from LUN removal request:\n%s", - __func__, req.error_str); + switch (req.status) { + case CTL_LUN_ERROR: + warnx("LUN removal error: %s", req.error_str); retval = 1; goto bailout; - } else if (req.status != CTL_LUN_OK) { - warnx("%s: unknown LUN removal request status %d", - __func__, req.status); + case CTL_LUN_WARNING: + warnx("LUN removal warning: %s", req.error_str); + break; + case CTL_LUN_OK: + break; + default: + warnx("unknown LUN removal status: %d", req.status); retval = 1; goto bailout; } - printf("LUN %d deleted successfully\n", lun_id); + printf("LUN %d removed successfully\n", lun_id); bailout: return (retval); @@ -3397,14 +3405,18 @@ cctl_modify_lun(int fd, int argc, char * goto bailout; } - if (req.status == CTL_LUN_ERROR) { - warnx("%s: error returned from LUN modification request:\n%s", - __func__, req.error_str); + switch (req.status) { + case CTL_LUN_ERROR: + warnx("LUN modification error: %s", req.error_str); retval = 1; goto bailout; - } else if (req.status != CTL_LUN_OK) { - warnx("%s: unknown LUN modification request status %d", - __func__, req.status); + case CTL_LUN_WARNING: + warnx("LUN modification warning: %s", req.error_str); + break; + case CTL_LUN_OK: + break; + default: + warnx("unknown LUN modification status: %d", req.status); retval = 1; goto bailout; } Modified: head/usr.sbin/ctld/kernel.c ============================================================================== --- head/usr.sbin/ctld/kernel.c Fri Oct 10 19:34:19 2014 (r272910) +++ head/usr.sbin/ctld/kernel.c Fri Oct 10 19:41:09 2014 (r272911) @@ -700,20 +700,22 @@ kernel_lun_add(struct lun *lun) return (1); } - if (req.status == CTL_LUN_ERROR) { - log_warnx("error returned from LUN creation request: %s", - req.error_str); - return (1); - } - - if (req.status != CTL_LUN_OK) { - log_warnx("unknown LUN creation request status %d", + switch (req.status) { + case CTL_LUN_ERROR: + log_warnx("LUN creation error: %s", req.error_str); + return (1); + case CTL_LUN_WARNING: + log_warnx("LUN creation warning: %s", req.error_str); + break; + case CTL_LUN_OK: + break; + default: + log_warnx("unknown LUN creation status: %d", req.status); return (1); } lun_set_ctl_lun(lun, req.reqdata.create.req_lun_id); - return (0); } @@ -735,14 +737,17 @@ kernel_lun_resize(struct lun *lun) return (1); } - if (req.status == CTL_LUN_ERROR) { - log_warnx("error returned from LUN modification request: %s", - req.error_str); - return (1); - } - - if (req.status != CTL_LUN_OK) { - log_warnx("unknown LUN modification request status %d", + switch (req.status) { + case CTL_LUN_ERROR: + log_warnx("LUN modification error: %s", req.error_str); + return (1); + case CTL_LUN_WARNING: + log_warnx("LUN modification warning: %s", req.error_str); + break; + case CTL_LUN_OK: + break; + default: + log_warnx("unknown LUN modification status: %d", req.status); return (1); } @@ -767,14 +772,17 @@ kernel_lun_remove(struct lun *lun) return (1); } - if (req.status == CTL_LUN_ERROR) { - log_warnx("error returned from LUN removal request: %s", - req.error_str); - return (1); - } - - if (req.status != CTL_LUN_OK) { - log_warnx("unknown LUN removal request status %d", req.status); + switch (req.status) { + case CTL_LUN_ERROR: + log_warnx("LUN removal error: %s", req.error_str); + return (1); + case CTL_LUN_WARNING: + log_warnx("LUN removal warning: %s", req.error_str); + break; + case CTL_LUN_OK: + break; + default: + log_warnx("unknown LUN removal status: %d", req.status); return (1); } From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 20:37:07 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2085E79E; Fri, 10 Oct 2014 20:37:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0BA10EE2; Fri, 10 Oct 2014 20:37:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9AKb60n085032; Fri, 10 Oct 2014 20:37:06 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9AKb6LS085031; Fri, 10 Oct 2014 20:37:06 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201410102037.s9AKb6LS085031@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Fri, 10 Oct 2014 20:37:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272912 - head/sys/netpfil/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 20:37:07 -0000 Author: melifaro Date: Fri Oct 10 20:37:06 2014 New Revision: 272912 URL: https://svnweb.freebsd.org/changeset/base/272912 Log: Remove redundant if_notifier declaration. Modified: head/sys/netpfil/ipfw/ip_fw_table_algo.c Modified: head/sys/netpfil/ipfw/ip_fw_table_algo.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_table_algo.c Fri Oct 10 19:41:09 2014 (r272911) +++ head/sys/netpfil/ipfw/ip_fw_table_algo.c Fri Oct 10 20:37:06 2014 (r272912) @@ -1932,7 +1932,6 @@ struct ta_buf_ifidx }; int compare_ifidx(const void *k, const void *v); -static void if_notifier(struct ip_fw_chain *ch, void *cbdata, uint16_t ifindex); static struct ifidx * ifidx_find(struct table_info *ti, void *key); static int ta_lookup_ifidx(struct table_info *ti, void *key, uint32_t keylen, uint32_t *val); From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 20:40:08 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 788FFA0E; Fri, 10 Oct 2014 20:40:08 +0000 (UTC) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebius.int.ru", Issuer "cell.glebius.int.ru" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id E8036F18; Fri, 10 Oct 2014 20:40:07 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.9/8.14.9) with ESMTP id s9AKdwvE047591 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 11 Oct 2014 00:39:58 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.9/8.14.9/Submit) id s9AKdwdU047590; Sat, 11 Oct 2014 00:39:58 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Sat, 11 Oct 2014 00:39:58 +0400 From: Gleb Smirnoff To: John Baldwin , Eric Joyner Subject: Re: svn commit: r272897 - head/sys/dev/e1000 Message-ID: <20141010203957.GD73266@glebius.int.ru> References: <201410101636.s9AGaQ43066897@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201410101636.s9AGaQ43066897@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 20:40:08 -0000 On Fri, Oct 10, 2014 at 04:36:26PM +0000, John Baldwin wrote: J> Author: jhb J> Date: Fri Oct 10 16:36:25 2014 J> New Revision: 272897 J> URL: https://svnweb.freebsd.org/changeset/base/272897 J> J> Log: J> Various fixes to stats: J> - Read the counts of received, dropped, and transmitted management J> packets and add sysctl nodes for them. J> - Fix the total octets received/transmitted to read all 64 bits of J> the counters. J> - Add missing sysctl nodes for rlec, tncrs, fcruc, tor, and tot. J> - Remove spurious spaces. J> J> Reviewed by: Eric Joyner @ Intel J> MFC after: 1 week JFYI With the new API (userland part to be done) one wouldn't need a bunch of sysctls hanging off every NIC. Look at ift_counter enum in if_var.h. It is int type, so we can cut it into large blocks for vendor specific counters. The top part, up to the IFCOUNTERS member would remain standard and copied to if_data when imported to userland. Above IFCOUNTERS we can give us much number space to vendors as needed. Like this: + IFCOUNTER_INTEL_RLEC = 1000, + IFCOUNTER_INTEL_TNCRS, + IFCOUNTER_INTEL_FCRUC, ... etc After that the driver can return them via igb_get_counter(). As said, the userland API not written yet. The plan is that it will be not as bulky as NET_RT_IFLIST sysctl, that returns all counters for all NICs. It will allow to request certain counters for certain NICs. -- Totus tuus, Glebius. From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 21:19:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 20D71719; Fri, 10 Oct 2014 21:19:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D1C6370; Fri, 10 Oct 2014 21:19:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9ALJHTb004846; Fri, 10 Oct 2014 21:19:17 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9ALJHmG004845; Fri, 10 Oct 2014 21:19:17 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410102119.s9ALJHmG004845@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 10 Oct 2014 21:19:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272914 - head/contrib/netbsd-tests/lib/libc/gen/posix_spawn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 21:19:18 -0000 Author: ngie Date: Fri Oct 10 21:19:17 2014 New Revision: 272914 URL: https://svnweb.freebsd.org/changeset/base/272914 Log: Skip over t_spawn_open_nonexistent_diag because it requires NetBSD specific additions to posix_spawn Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c Modified: head/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c Fri Oct 10 20:47:23 2014 (r272913) +++ head/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c Fri Oct 10 21:19:17 2014 (r272914) @@ -31,6 +31,9 @@ */ +#if defined(__FreeBSD__) +#include +#endif #include #include #include @@ -248,6 +251,7 @@ ATF_TC_BODY(t_spawn_open_nonexistent, tc posix_spawn_file_actions_destroy(&fa); } +#if defined(__NetBSD__) ATF_TC(t_spawn_open_nonexistent_diag); ATF_TC_HEAD(t_spawn_open_nonexistent_diag, tc) @@ -283,6 +287,7 @@ ATF_TC_BODY(t_spawn_open_nonexistent_dia posix_spawn_file_actions_destroy(&fa); posix_spawnattr_destroy(&attr); } +#endif ATF_TC(t_spawn_fileactions); @@ -376,7 +381,9 @@ ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, t_spawn_fileactions); ATF_TP_ADD_TC(tp, t_spawn_open_nonexistent); +#if defined(__NetBSD__) ATF_TP_ADD_TC(tp, t_spawn_open_nonexistent_diag); +#endif ATF_TP_ADD_TC(tp, t_spawn_reopen); ATF_TP_ADD_TC(tp, t_spawn_openmode); ATF_TP_ADD_TC(tp, t_spawn_empty_fileactions); From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 21:22:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7AAE89A0; Fri, 10 Oct 2014 21:22:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4D77D616; Fri, 10 Oct 2014 21:22:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9ALMQ4X008830; Fri, 10 Oct 2014 21:22:26 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9ALMQQn008829; Fri, 10 Oct 2014 21:22:26 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410102122.s9ALMQQn008829@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 10 Oct 2014 21:22:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272915 - head/contrib/netbsd-tests/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 21:22:26 -0000 Author: ngie Date: Fri Oct 10 21:22:25 2014 New Revision: 272915 URL: https://svnweb.freebsd.org/changeset/base/272915 Log: Port the testcase to FreeBSD - Make #include path to h_macros.h a non-relative path - __gl_stat_t is synonymous with struct stat on FreeBSD - FreeBSD doesn't have _DIRENT_RECLEN - Skip over glob_star on FreeBSD (testcase doesn't pass) In collaboration with: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/gen/t_glob.c Modified: head/contrib/netbsd-tests/lib/libc/gen/t_glob.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/gen/t_glob.c Fri Oct 10 21:19:17 2014 (r272914) +++ head/contrib/netbsd-tests/lib/libc/gen/t_glob.c Fri Oct 10 21:22:25 2014 (r272915) @@ -46,7 +46,13 @@ __RCSID("$NetBSD: t_glob.c,v 1.3 2013/01 #include #include +#if defined(__FreeBSD__) +#include "h_macros.h" +#define __gl_stat_t struct stat +#define _S_IFDIR S_IFDIR +#else #include "../../../h_macros.h" +#endif #ifdef DEBUG @@ -132,7 +138,11 @@ gl_readdir(void *v) dir.d_ino = dd->pos; dir.d_type = f->dir ? DT_DIR : DT_REG; DPRINTF(("readdir %s %d\n", dir.d_name, dir.d_type)); +#if defined(__FreeBSD__) + dir.d_reclen = -1; /* Does not have _DIRENT_RECLEN */ +#else dir.d_reclen = _DIRENT_RECLEN(&dir, dir.d_namlen); +#endif return &dir; } return NULL; @@ -213,6 +223,7 @@ run(const char *p, int flags, const char } +#if !defined(__FreeBSD__) ATF_TC(glob_star); ATF_TC_HEAD(glob_star, tc) { @@ -224,6 +235,7 @@ ATF_TC_BODY(glob_star, tc) { run("a/**", GLOB_STAR, glob_star, __arraycount(glob_star)); } +#endif ATF_TC(glob_star_not); ATF_TC_HEAD(glob_star_not, tc) @@ -260,7 +272,9 @@ ATF_TC_BODY(glob_nocheck, tc) ATF_TP_ADD_TCS(tp) { +#if !defined(__FreeBSD__) ATF_TP_ADD_TC(tp, glob_star); +#endif ATF_TP_ADD_TC(tp, glob_star_not); /* * Remove this test for now - the GLOB_NOCHECK return value has been From owner-svn-src-head@FreeBSD.ORG Fri Oct 10 22:18:10 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4CF07B45; Fri, 10 Oct 2014 22:18:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 39637B40; Fri, 10 Oct 2014 22:18:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9AMIA18034260; Fri, 10 Oct 2014 22:18:10 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9AMIAjN034259; Fri, 10 Oct 2014 22:18:10 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410102218.s9AMIAjN034259@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 10 Oct 2014 22:18:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272917 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Oct 2014 22:18:10 -0000 Author: ngie Date: Fri Oct 10 22:18:09 2014 New Revision: 272917 URL: https://svnweb.freebsd.org/changeset/base/272917 Log: Add LDFLAGS to PROG_VARS so it can be overridden on a per-PROG basis MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Modified: head/share/mk/bsd.progs.mk Modified: head/share/mk/bsd.progs.mk ============================================================================== --- head/share/mk/bsd.progs.mk Fri Oct 10 21:48:59 2014 (r272916) +++ head/share/mk/bsd.progs.mk Fri Oct 10 22:18:09 2014 (r272917) @@ -43,7 +43,7 @@ PROG ?= $t .if defined(PROG) # just one of many PROG_OVERRIDE_VARS += BINDIR MAN SRCS -PROG_VARS += CFLAGS CPPFLAGS CXXFLAGS DPADD DPLIBS LDADD ${PROG_OVERRIDE_VARS} +PROG_VARS += CFLAGS CPPFLAGS CXXFLAGS DPADD DPLIBS LDADD LDFLAGS ${PROG_OVERRIDE_VARS} .for v in ${PROG_VARS:O:u} .if empty(${PROG_OVERRIDE_VARS:M$v}) .if defined(${v}.${PROG}) From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 02:02:59 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 80097600; Sat, 11 Oct 2014 02:02:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 61B721A7; Sat, 11 Oct 2014 02:02:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9B22xgI045881; Sat, 11 Oct 2014 02:02:59 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9B22xO8045880; Sat, 11 Oct 2014 02:02:59 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201410110202.s9B22xO8045880@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Sat, 11 Oct 2014 02:02:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272925 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 02:02:59 -0000 Author: marcel Date: Sat Oct 11 02:02:58 2014 New Revision: 272925 URL: https://svnweb.freebsd.org/changeset/base/272925 Log: Turn WITNESS_COUNT into a tunable and sysctl. This allows adjusting the value without recompiling the kernel. This is useful when recompiling is not possible as an immediate solution. When we run out of witness objects, witness is completely disabled. Not having an immediate solution can therefore be problematic. Submitted by: Sreekanth Rupavatharam Obtained from: Juniper Networks, Inc. Modified: head/sys/kern/subr_witness.c Modified: head/sys/kern/subr_witness.c ============================================================================== --- head/sys/kern/subr_witness.c Sat Oct 11 01:01:18 2014 (r272924) +++ head/sys/kern/subr_witness.c Sat Oct 11 02:02:58 2014 (r272925) @@ -135,7 +135,6 @@ __FBSDID("$FreeBSD$"); #ifndef WITNESS_COUNT #define WITNESS_COUNT 1536 #endif -#define WITNESS_CHILDCOUNT (WITNESS_COUNT * 4) #define WITNESS_HASH_SIZE 251 /* Prime, gives load factor < 2 */ #define WITNESS_PENDLIST (1024 + MAXCPU) @@ -155,7 +154,6 @@ __FBSDID("$FreeBSD$"); #define MAX_W_NAME 64 -#define BADSTACK_SBUF_SIZE (256 * WITNESS_COUNT) #define FULLGRAPH_SBUF_SIZE 512 /* @@ -184,7 +182,7 @@ __FBSDID("$FreeBSD$"); #define WITNESS_ATOD(x) (((x) & WITNESS_RELATED_MASK) << 2) #define WITNESS_INDEX_ASSERT(i) \ - MPASS((i) > 0 && (i) <= w_max_used_index && (i) < WITNESS_COUNT) + MPASS((i) > 0 && (i) <= w_max_used_index && (i) < witness_count) static MALLOC_DEFINE(M_WITNESS, "Witness", "Witness"); @@ -416,6 +414,13 @@ int witness_skipspin = 0; #endif SYSCTL_INT(_debug_witness, OID_AUTO, skipspin, CTLFLAG_RDTUN, &witness_skipspin, 0, ""); +/* tunable for Witness count */ +int witness_count = WITNESS_COUNT; +int badstack_sbuf_size = WITNESS_COUNT * 256; + +SYSCTL_INT(_debug_witness, OID_AUTO, witness_count, CTLFLAG_RDTUN, + &witness_count, 0, ""); + /* * Call this to print out the relations between locks. */ @@ -450,7 +455,7 @@ SYSCTL_INT(_debug_witness, OID_AUTO, sle ""); static struct witness *w_data; -static uint8_t w_rmatrix[WITNESS_COUNT+1][WITNESS_COUNT+1]; +static uint8_t **w_rmatrix; static struct lock_list_entry w_locklistdata[LOCK_CHILDCOUNT]; static struct witness_hash w_hash; /* The witness hash table. */ @@ -726,9 +731,18 @@ witness_initialize(void *dummy __unused) struct witness *w, *w1; int i; - w_data = malloc(sizeof (struct witness) * WITNESS_COUNT, M_WITNESS, + w_data = malloc(sizeof (struct witness) * witness_count, M_WITNESS, M_NOWAIT | M_ZERO); + w_rmatrix = malloc(sizeof(uint8_t *) * (witness_count+1), + M_WITNESS, M_NOWAIT | M_ZERO); + + for(i = 0; i < witness_count+1; i++) { + w_rmatrix[i] = malloc(sizeof(uint8_t) * (witness_count + 1), + M_WITNESS, M_NOWAIT | M_ZERO); + } + badstack_sbuf_size = witness_count * 256; + /* * We have to release Giant before initializing its witness * structure so that WITNESS doesn't get confused. @@ -739,7 +753,7 @@ witness_initialize(void *dummy __unused) CTR1(KTR_WITNESS, "%s: initializing witness", __func__); mtx_init(&w_mtx, "witness lock", NULL, MTX_SPIN | MTX_QUIET | MTX_NOWITNESS | MTX_NOPROFILE); - for (i = WITNESS_COUNT - 1; i >= 0; i--) { + for (i = witness_count - 1; i >= 0; i--) { w = &w_data[i]; memset(w, 0, sizeof(*w)); w_data[i].w_index = i; /* Witness index never changes. */ @@ -752,8 +766,10 @@ witness_initialize(void *dummy __unused) STAILQ_REMOVE_HEAD(&w_free, w_list); w_free_cnt--; - memset(w_rmatrix, 0, - (sizeof(**w_rmatrix) * (WITNESS_COUNT+1) * (WITNESS_COUNT+1))); + for(i = 0; i < witness_count; i++) { + memset(w_rmatrix[i], 0, sizeof(uint8_t) * + (witness_count + 1)); + } for (i = 0; i < LOCK_CHILDCOUNT; i++) witness_lock_list_free(&w_locklistdata[i]); @@ -1196,7 +1212,7 @@ witness_checkorder(struct lock_object *l for (j = 0, lle = lock_list; lle != NULL; lle = lle->ll_next) { for (i = lle->ll_count - 1; i >= 0; i--, j++) { - MPASS(j < WITNESS_COUNT); + MPASS(j < witness_count); lock1 = &lle->ll_children[i]; /* @@ -2057,7 +2073,7 @@ witness_get(void) w_free_cnt--; index = w->w_index; MPASS(index > 0 && index == w_max_used_index+1 && - index < WITNESS_COUNT); + index < witness_count); bzero(w, sizeof(*w)); w->w_index = index; if (index > w_max_used_index) @@ -2482,7 +2498,7 @@ sysctl_debug_witness_badstacks(SYSCTL_HA return (error); } error = 0; - sb = sbuf_new(NULL, NULL, BADSTACK_SBUF_SIZE, SBUF_AUTOEXTEND); + sb = sbuf_new(NULL, NULL, badstack_sbuf_size, SBUF_AUTOEXTEND); if (sb == NULL) return (ENOMEM); From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 05:11:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E63DBDC7; Sat, 11 Oct 2014 05:11:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D2CB7696; Sat, 11 Oct 2014 05:11:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9B5BNZT035584; Sat, 11 Oct 2014 05:11:23 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9B5BNON035583; Sat, 11 Oct 2014 05:11:23 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410110511.s9B5BNON035583@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 11 Oct 2014 05:11:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272931 - head/sys/fs/autofs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 05:11:24 -0000 Author: trasz Date: Sat Oct 11 05:11:23 2014 New Revision: 272931 URL: https://svnweb.freebsd.org/changeset/base/272931 Log: Add assertion to catch duplicated notes. Sponsored by: The FreeBSD Foundation Modified: head/sys/fs/autofs/autofs_vnops.c Modified: head/sys/fs/autofs/autofs_vnops.c ============================================================================== --- head/sys/fs/autofs/autofs_vnops.c Sat Oct 11 04:57:17 2014 (r272930) +++ head/sys/fs/autofs/autofs_vnops.c Sat Oct 11 05:11:23 2014 (r272931) @@ -504,9 +504,13 @@ autofs_node_new(struct autofs_node *pare { struct autofs_node *anp; - if (parent != NULL) + if (parent != NULL) { AUTOFS_ASSERT_XLOCKED(parent->an_mount); + KASSERT(autofs_node_find(parent, name, namelen, NULL) == ENOENT, + ("node \"%s\" already exists", name)); + } + anp = uma_zalloc(autofs_node_zone, M_WAITOK | M_ZERO); if (namelen >= 0) anp->an_name = strndup(name, namelen, M_AUTOFS); From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 05:18:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D982DB3; Sat, 11 Oct 2014 05:18:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AC8486C6; Sat, 11 Oct 2014 05:18:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9B5INCQ037074; Sat, 11 Oct 2014 05:18:23 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9B5ININ037072; Sat, 11 Oct 2014 05:18:23 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410110518.s9B5ININ037072@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 11 Oct 2014 05:18:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272932 - in head: sbin/iscontrol share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 05:18:24 -0000 Author: trasz Date: Sat Oct 11 05:18:22 2014 New Revision: 272932 URL: https://svnweb.freebsd.org/changeset/base/272932 Log: Mark iscontrol(8) and iscsi_initiator(4) obsolete. Differential Revision: https://reviews.freebsd.org/D931 Reviewed by: wblock@ MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/sbin/iscontrol/iscontrol.8 head/share/man/man4/iscsi_initiator.4 Modified: head/sbin/iscontrol/iscontrol.8 ============================================================================== --- head/sbin/iscontrol/iscontrol.8 Sat Oct 11 05:11:23 2014 (r272931) +++ head/sbin/iscontrol/iscontrol.8 Sat Oct 11 05:18:22 2014 (r272932) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 9, 2010 +.Dd October 9, 2014 .Dt ISCONTROL 8 .Os .Sh NAME @@ -41,6 +41,15 @@ .Op Fl t Ar target .Op Ar variable Ns = Ns Ar value .Sh DESCRIPTION +.Bf -symbolic +This command, along with its kernel counterpart +.Xr iscsi_initiator 4 , +is obsolete. +Users are advised to use +.Xr iscsictl 8 +instead. +.Ef +.Pp Internet SCSI (iSCSI) is a network protocol standard, that allows the use of the SCSI protocol over TCP/IP networks, the Modified: head/share/man/man4/iscsi_initiator.4 ============================================================================== --- head/share/man/man4/iscsi_initiator.4 Sat Oct 11 05:11:23 2014 (r272931) +++ head/share/man/man4/iscsi_initiator.4 Sat Oct 11 05:18:22 2014 (r272932) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 3, 2010 +.Dd October 9, 2014 .Dt ISCSI_INITIATOR 4 .Os .Sh NAME @@ -45,6 +45,16 @@ module at boot time, place the following iscsi_initiator_load="YES" .Ed .Sh DESCRIPTION +.Bf -symbolic +This driver, along with its userspace counterpart +.Xr iscontrol 8 , +is obsolete. +Users are advised to use +.Xr iscsi 4 +instead. +.Ef +.Pp + The .Nm implements the kernel side of the Internet SCSI (iSCSI) network From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 07:21:01 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8A3B6FD; Sat, 11 Oct 2014 07:21:01 +0000 (UTC) Received: from mail1.yamagi.org (yugo.yamagi.org [212.48.122.103]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4D124F4; Sat, 11 Oct 2014 07:21:00 +0000 (UTC) Received: from pd9520155.dip0.t-ipconnect.de ([217.82.1.85] helo=maka.home.yamagi.org) by mail1.yamagi.org with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.82_1-5b7a7c0-XX (FreeBSD)) (envelope-from ) id 1Xcqyp-0001Oy-RC; Sat, 11 Oct 2014 09:20:52 +0200 Date: Sat, 11 Oct 2014 09:20:36 +0200 From: Yamagi Burmeister To: marcel@FreeBSD.org Subject: Re: svn commit: r272789 - head/sys/kern Message-Id: <20141011092036.b8d1a6f70b2284b257948ea3@yamagi.org> In-Reply-To: <201410090230.s992UdpV066760@svn.freebsd.org> References: <201410090230.s992UdpV066760@svn.freebsd.org> X-Mailer: Sylpheed 3.4.2 (GTK+ 2.24.22; amd64-portbld-freebsd9.3) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 07:21:01 -0000 Thank you :) I suspect that's too late to get this into FreeBSD 10.1? On Thu, 9 Oct 2014 02:30:39 +0000 (UTC) Marcel Moolenaar wrote: > Author: marcel > Date: Thu Oct 9 02:30:38 2014 > New Revision: 272789 > URL: https://svnweb.freebsd.org/changeset/base/272789 > > Log: > Fix draining in ttydev_leave(): > 1. ERESTART is not only returned when the revoke count changed. It > is also returned when a signal is received. While a change in > the revoke count should be ignored, a signal should not. > 2. Waiting until the output queue is entirely drained can cause a > hang when the underlying device is stuck or broken. > > Have tty_drain() take care of this by telling it when we're leaving. > When leaving, tty_drain() will use a timed wait to address point 2 > above and it will check the revoke count to handle point 1 above. > The timeout is set to 1 second, which is arbitrary and long enough > to expect a change in the output queue. > > Discussed with: jilles@ > Reported by: Yamagi Burmeister > > Modified: > head/sys/kern/tty.c > > Modified: head/sys/kern/tty.c > ============================================================================== > --- head/sys/kern/tty.c Thu Oct 9 02:24:34 2014 (r272788) > +++ head/sys/kern/tty.c Thu Oct 9 02:30:38 2014 (r272789) > @@ -123,9 +123,10 @@ tty_watermarks(struct tty *tp) > } > > static int > -tty_drain(struct tty *tp) > +tty_drain(struct tty *tp, int leaving) > { > - int error; > + size_t bytesused; > + int error, revokecnt; > > if (ttyhook_hashook(tp, getc_inject)) > /* buffer is inaccessible */ > @@ -134,11 +135,27 @@ tty_drain(struct tty *tp) > while (ttyoutq_bytesused(&tp->t_outq) > 0) { > ttydevsw_outwakeup(tp); > /* Could be handled synchronously. */ > - if (ttyoutq_bytesused(&tp->t_outq) == 0) > + bytesused = ttyoutq_bytesused(&tp->t_outq); > + if (bytesused == 0) > return (0); > > /* Wait for data to be drained. */ > - error = tty_wait(tp, &tp->t_outwait); > + if (leaving) { > + revokecnt = tp->t_revokecnt; > + error = tty_timedwait(tp, &tp->t_outwait, hz); > + switch (error) { > + case ERESTART: > + if (revokecnt != tp->t_revokecnt) > + error = 0; > + break; > + case EWOULDBLOCK: > + if (ttyoutq_bytesused(&tp->t_outq) < bytesused) > + error = 0; > + break; > + } > + } else > + error = tty_wait(tp, &tp->t_outwait); > + > if (error) > return (error); > } > @@ -191,10 +208,8 @@ ttydev_leave(struct tty *tp) > > /* Drain any output. */ > MPASS((tp->t_flags & TF_STOPPED) == 0); > - if (!tty_gone(tp)) { > - while (tty_drain(tp) == ERESTART) > - ; > - } > + if (!tty_gone(tp)) > + tty_drain(tp, 1); > > ttydisc_close(tp); > > @@ -1528,7 +1543,7 @@ tty_generic_ioctl(struct tty *tp, u_long > > /* Set terminal flags through tcsetattr(). */ > if (cmd == TIOCSETAW || cmd == TIOCSETAF) { > - error = tty_drain(tp); > + error = tty_drain(tp, 0); > if (error) > return (error); > if (cmd == TIOCSETAF) > @@ -1707,7 +1722,7 @@ tty_generic_ioctl(struct tty *tp, u_long > } > case TIOCDRAIN: > /* Drain TTY output. */ > - return tty_drain(tp); > + return tty_drain(tp, 0); > case TIOCCONS: > /* Set terminal as console TTY. */ > if (*(int *)data) { > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" -- Homepage: www.yamagi.org XMPP: yamagi@yamagi.org GnuPG/GPG: 0xEFBCCBCB From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 07:49:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 30EF68B6; Sat, 11 Oct 2014 07:49:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1DEAA388; Sat, 11 Oct 2014 07:49:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9B7nRns007846; Sat, 11 Oct 2014 07:49:27 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9B7nREb007845; Sat, 11 Oct 2014 07:49:27 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410110749.s9B7nREb007845@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 11 Oct 2014 07:49:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272935 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 07:49:28 -0000 Author: mav Date: Sat Oct 11 07:49:27 2014 New Revision: 272935 URL: https://svnweb.freebsd.org/changeset/base/272935 Log: Mark CTL frontend's CAM driver as CAM_PERIPH_DRV_EARLY. Target mode operation does not depend on the initiator mode scan process. This change allows the target driver to attach earlier and receive some async events (like AC_CONTRACT) that could be lost otherwise. MFC after: 1 week Modified: head/sys/cam/ctl/scsi_ctl.c Modified: head/sys/cam/ctl/scsi_ctl.c ============================================================================== --- head/sys/cam/ctl/scsi_ctl.c Sat Oct 11 06:22:57 2014 (r272934) +++ head/sys/cam/ctl/scsi_ctl.c Sat Oct 11 07:49:27 2014 (r272935) @@ -224,7 +224,8 @@ static void ctlfe_dump(void); static struct periph_driver ctlfe_driver = { ctlfeperiphinit, "ctl", - TAILQ_HEAD_INITIALIZER(ctlfe_driver.units), /*generation*/ 0 + TAILQ_HEAD_INITIALIZER(ctlfe_driver.units), /*generation*/ 0, + CAM_PERIPH_DRV_EARLY }; static struct ctl_frontend ctlfe_frontend = From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 07:59:16 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 53A70A9E; Sat, 11 Oct 2014 07:59:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 40BEF637; Sat, 11 Oct 2014 07:59:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9B7xGxP013010; Sat, 11 Oct 2014 07:59:16 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9B7xGqB013008; Sat, 11 Oct 2014 07:59:16 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410110759.s9B7xGqB013008@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 11 Oct 2014 07:59:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272936 - head/sys/dev/isp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 07:59:16 -0000 Author: mav Date: Sat Oct 11 07:59:15 2014 New Revision: 272936 URL: https://svnweb.freebsd.org/changeset/base/272936 Log: Update isp_tgt_map and send new arrival notification if target that departed earlier has returned. Previously that code worked only once, confusing CTL. MFC after: 1 month Modified: head/sys/dev/isp/isp_library.c Modified: head/sys/dev/isp/isp_library.c ============================================================================== --- head/sys/dev/isp/isp_library.c Sat Oct 11 07:49:27 2014 (r272935) +++ head/sys/dev/isp/isp_library.c Sat Oct 11 07:59:15 2014 (r272936) @@ -2540,6 +2540,10 @@ isp_add_wwn_entry(ispsoftc_t *isp, int c isp_prt(isp, ISP_LOGWARN, "Chan %d IID 0x%016llx N-Port Handle 0x%04x Port ID 0x%06x reentered", chan, (unsigned long long) lp->port_wwn, lp->handle, lp->portid); } + if (fcp->isp_tgt_map[nphdl] == 0) { + fcp->isp_tgt_map[nphdl] = i + 1; + goto notify; + } return; } @@ -2573,6 +2577,7 @@ isp_add_wwn_entry(ispsoftc_t *isp, int c isp_prt(isp, ISP_LOGTINFO, "Chan %d IID 0x%016llx N-Port Handle 0x%04x Port ID 0x%06x vtgt %d %s added", chan, (unsigned long long) ini, nphdl, s_id, fcp->isp_tgt_map[nphdl] - 1, buf); +notify: ISP_MEMZERO(&nt, sizeof (nt)); nt.nt_hba = isp; nt.nt_wwn = ini; From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 08:50:20 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3E07D24A; Sat, 11 Oct 2014 08:50:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2ACD2A7D; Sat, 11 Oct 2014 08:50:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9B8oK06036549; Sat, 11 Oct 2014 08:50:20 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9B8oK9Z036548; Sat, 11 Oct 2014 08:50:20 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410110850.s9B8oK9Z036548@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 11 Oct 2014 08:50:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272937 - head/sys/dev/isp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 08:50:20 -0000 Author: mav Date: Sat Oct 11 08:50:19 2014 New Revision: 272937 URL: https://svnweb.freebsd.org/changeset/base/272937 Log: Fix r272936 build with old GCC. MFC after: 1 week Modified: head/sys/dev/isp/isp_library.c Modified: head/sys/dev/isp/isp_library.c ============================================================================== --- head/sys/dev/isp/isp_library.c Sat Oct 11 07:59:15 2014 (r272936) +++ head/sys/dev/isp/isp_library.c Sat Oct 11 08:50:19 2014 (r272937) @@ -2472,7 +2472,8 @@ isp_add_wwn_entry(ispsoftc_t *isp, int c lp = NULL; if (fcp->isp_tgt_map[nphdl]) { - lp = &fcp->portdb[fcp->isp_tgt_map[nphdl] - 1]; + i = fcp->isp_tgt_map[nphdl] - 1; + lp = &fcp->portdb[i]; } else { /* * Make sure the addition of a new target mode entry doesn't duplicate entries From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 09:29:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CE5D7804; Sat, 11 Oct 2014 09:29:23 +0000 (UTC) Received: from mx0.gentlemail.de (mx0.gentlemail.de [IPv6:2a00:e10:2800::a130]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5B4A6D8E; Sat, 11 Oct 2014 09:29:23 +0000 (UTC) Received: from mh0.gentlemail.de (ezra.dcm1.omnilan.net [78.138.80.135]) by mx0.gentlemail.de (8.14.5/8.14.5) with ESMTP id s9B9TKu8017041; Sat, 11 Oct 2014 11:29:20 +0200 (CEST) (envelope-from h.schmalzbauer@omnilan.de) Received: from titan.inop.mo1.omnilan.net (titan.inop.mo1.omnilan.net [IPv6:2001:a60:f0bb:1::3:1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mh0.gentlemail.de (Postfix) with ESMTPSA id C25853BB8; Sat, 11 Oct 2014 11:29:19 +0200 (CEST) Message-ID: <5438F86A.5070204@omnilan.de> Date: Sat, 11 Oct 2014 11:29:14 +0200 From: Harald Schmalzbauer Organization: OmniLAN User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; de-DE; rv:1.9.2.8) Gecko/20100906 Lightning/1.0b2 Thunderbird/3.1.2 MIME-Version: 1.0 To: Xin LI Subject: Re: svn commit: r272324 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs References: <201409301850.s8UIokXo051151@svn.freebsd.org> In-Reply-To: <201409301850.s8UIokXo051151@svn.freebsd.org> X-Enigmail-Version: 1.1.2 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigBCE2BF8E913EA3BB22397AD5" X-Greylist: ACL 119 matched, not delayed by milter-greylist-4.2.7 (mx0.gentlemail.de [78.138.80.130]); Sat, 11 Oct 2014 11:29:20 +0200 (CEST) X-Milter: Spamilter (Reciever: mx0.gentlemail.de; Sender-ip: 78.138.80.135; Sender-helo: mh0.gentlemail.de; ) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 09:29:23 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigBCE2BF8E913EA3BB22397AD5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Bez=FCglich Xin LI's Nachricht vom 30.09.2014 20:50 (localtime): > Author: delphij > Date: Tue Sep 30 18:50:45 2014 > New Revision: 272324 > URL: http://svnweb.freebsd.org/changeset/base/272324 > > Log: > Fix a mismerge in r260183 which prevents snapshot zvol devices being > removed and re-instate the fix in r242862. > =20 > Reported by: Leon Dang , smh > MFC after: 3 days Ist this a candidate for 10.1? Although I guess MFC hasn't happened yet - couldn't find it in stable/10? Thanks, -Harry --------------enigBCE2BF8E913EA3BB22397AD5 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAlQ4+G8ACgkQLDqVQ9VXb8h/kgCfTtOj+s/gD97ZFLnwa34yHsSz WhEAn2iPLjt2mAnzYr0aBnHsZ0C8FZWP =eXaJ -----END PGP SIGNATURE----- --------------enigBCE2BF8E913EA3BB22397AD5-- From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 10:19:38 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B3C0123B; Sat, 11 Oct 2014 10:19:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9FBAF2E4; Sat, 11 Oct 2014 10:19:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9BAJcvW079065; Sat, 11 Oct 2014 10:19:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9BAJcRw079064; Sat, 11 Oct 2014 10:19:38 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410111019.s9BAJcRw079064@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 11 Oct 2014 10:19:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272938 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 10:19:38 -0000 Author: mav Date: Sat Oct 11 10:19:37 2014 New Revision: 272938 URL: https://svnweb.freebsd.org/changeset/base/272938 Log: Filter out duplicate AC_PATH_REGISTERED async events. Queued async events handling in CAM opened race, that may lead to duplicate AC_PATH_REGISTERED events delivery during boot. That was not happening before r272935 because the driver was initialized later. After that change it started create duplicate ports in CTL. Modified: head/sys/cam/ctl/scsi_ctl.c Modified: head/sys/cam/ctl/scsi_ctl.c ============================================================================== --- head/sys/cam/ctl/scsi_ctl.c Sat Oct 11 08:50:19 2014 (r272937) +++ head/sys/cam/ctl/scsi_ctl.c Sat Oct 11 10:19:37 2014 (r272938) @@ -271,11 +271,19 @@ ctlfeperiphinit(void) static void ctlfeasync(void *callback_arg, uint32_t code, struct cam_path *path, void *arg) { + struct ctlfe_softc *softc; #ifdef CTLFEDEBUG printf("%s: entered\n", __func__); #endif + mtx_lock(&ctlfe_list_mtx); + STAILQ_FOREACH(softc, &ctlfe_softc_list, links) { + if (softc->path_id == xpt_path_path_id(path)) + break; + } + mtx_unlock(&ctlfe_list_mtx); + /* * When a new path gets registered, and it is capable of target * mode, go ahead and attach. Later on, we may need to be more @@ -284,7 +292,6 @@ ctlfeasync(void *callback_arg, uint32_t switch (code) { case AC_PATH_REGISTERED: { struct ctl_port *port; - struct ctlfe_softc *bus_softc; struct ccb_pathinq *cpi; int retval; @@ -299,6 +306,14 @@ ctlfeasync(void *callback_arg, uint32_t break; } + if (softc != NULL) { +#ifdef CTLFEDEBUG + printf("%s: CTL port for CAM path %u already exists\n", + __func__, xpt_path_path_id(path)); +#endif + break; + } + #ifdef CTLFE_INIT_ENABLE if (ctlfe_num_targets >= ctlfe_max_targets) { union ccb *ccb; @@ -347,25 +362,23 @@ ctlfeasync(void *callback_arg, uint32_t * use M_NOWAIT. Of course this means trouble if we * can't allocate memory. */ - bus_softc = malloc(sizeof(*bus_softc), M_CTLFE, - M_NOWAIT | M_ZERO); - if (bus_softc == NULL) { + softc = malloc(sizeof(*softc), M_CTLFE, M_NOWAIT | M_ZERO); + if (softc == NULL) { printf("%s: unable to malloc %zd bytes for softc\n", - __func__, sizeof(*bus_softc)); + __func__, sizeof(*softc)); return; } - bus_softc->path_id = cpi->ccb_h.path_id; - bus_softc->sim = xpt_path_sim(path); + softc->path_id = cpi->ccb_h.path_id; + softc->sim = xpt_path_sim(path); if (cpi->maxio != 0) - bus_softc->maxio = cpi->maxio; + softc->maxio = cpi->maxio; else - bus_softc->maxio = DFLTPHYS; - mtx_init(&bus_softc->lun_softc_mtx, "LUN softc mtx", NULL, - MTX_DEF); - STAILQ_INIT(&bus_softc->lun_softc_list); + softc->maxio = DFLTPHYS; + mtx_init(&softc->lun_softc_mtx, "LUN softc mtx", NULL, MTX_DEF); + STAILQ_INIT(&softc->lun_softc_list); - port = &bus_softc->port; + port = &softc->port; port->frontend = &ctlfe_frontend; /* @@ -380,21 +393,21 @@ ctlfeasync(void *callback_arg, uint32_t /* XXX KDM what should the real number be here? */ port->num_requested_ctl_io = 4096; - snprintf(bus_softc->port_name, sizeof(bus_softc->port_name), + snprintf(softc->port_name, sizeof(softc->port_name), "%s%d", cpi->dev_name, cpi->unit_number); /* * XXX KDM it would be nice to allocate storage in the * frontend structure itself. */ - port->port_name = bus_softc->port_name; + port->port_name = softc->port_name; port->physical_port = cpi->unit_number; port->virtual_port = cpi->bus_id; port->port_online = ctlfe_online; port->port_offline = ctlfe_offline; - port->onoff_arg = bus_softc; + port->onoff_arg = softc; port->lun_enable = ctlfe_lun_enable; port->lun_disable = ctlfe_lun_disable; - port->targ_lun_arg = bus_softc; + port->targ_lun_arg = softc; port->fe_datamove = ctlfe_datamove_done; port->fe_done = ctlfe_datamove_done; /* @@ -416,35 +429,28 @@ ctlfeasync(void *callback_arg, uint32_t if (retval != 0) { printf("%s: ctl_port_register() failed with " "error %d!\n", __func__, retval); - mtx_destroy(&bus_softc->lun_softc_mtx); - free(bus_softc, M_CTLFE); + mtx_destroy(&softc->lun_softc_mtx); + free(softc, M_CTLFE); break; } else { mtx_lock(&ctlfe_list_mtx); - STAILQ_INSERT_TAIL(&ctlfe_softc_list, bus_softc, links); + STAILQ_INSERT_TAIL(&ctlfe_softc_list, softc, links); mtx_unlock(&ctlfe_list_mtx); } break; } case AC_PATH_DEREGISTERED: { - struct ctlfe_softc *softc = NULL; - - mtx_lock(&ctlfe_list_mtx); - STAILQ_FOREACH(softc, &ctlfe_softc_list, links) { - if (softc->path_id == xpt_path_path_id(path)) { - STAILQ_REMOVE(&ctlfe_softc_list, softc, - ctlfe_softc, links); - break; - } - } - mtx_unlock(&ctlfe_list_mtx); if (softc != NULL) { /* * XXX KDM are we certain at this point that there * are no outstanding commands for this frontend? */ + mtx_lock(&ctlfe_list_mtx); + STAILQ_REMOVE(&ctlfe_softc_list, softc, ctlfe_softc, + links); + mtx_unlock(&ctlfe_list_mtx); ctl_port_deregister(&softc->port); mtx_destroy(&softc->lun_softc_mtx); free(softc, M_CTLFE); @@ -459,8 +465,7 @@ ctlfeasync(void *callback_arg, uint32_t switch (ac->contract_number) { case AC_CONTRACT_DEV_CHG: { struct ac_device_changed *dev_chg; - struct ctlfe_softc *softc; - int retval, found; + int retval; dev_chg = (struct ac_device_changed *)ac->contract_data; @@ -469,18 +474,7 @@ ctlfeasync(void *callback_arg, uint32_t xpt_path_path_id(path), dev_chg->target, (dev_chg->arrived == 0) ? "left" : "arrived"); - found = 0; - - mtx_lock(&ctlfe_list_mtx); - STAILQ_FOREACH(softc, &ctlfe_softc_list, links) { - if (softc->path_id == xpt_path_path_id(path)) { - found = 1; - break; - } - } - mtx_unlock(&ctlfe_list_mtx); - - if (found == 0) { + if (softc == NULL) { printf("%s: CTL port for CAM path %u not " "found!\n", __func__, xpt_path_path_id(path)); From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 11:44:50 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0B304C11; Sat, 11 Oct 2014 11:44:50 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D5512C0D; Sat, 11 Oct 2014 11:44:49 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-70-85-31.nwrknj.fios.verizon.net [173.70.85.31]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id E5635B9A1; Sat, 11 Oct 2014 07:44:48 -0400 (EDT) From: John Baldwin To: Marcel Moolenaar Subject: Re: svn commit: r272925 - head/sys/kern Date: Sat, 11 Oct 2014 07:42:09 -0400 Message-ID: <5628877.fmhc88cXyY@ralph.baldwin.cx> User-Agent: KMail/4.12.5 (FreeBSD/10.1-BETA2; KDE/4.12.5; amd64; ; ) In-Reply-To: <201410110202.s9B22xO8045880@svn.freebsd.org> References: <201410110202.s9B22xO8045880@svn.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Sat, 11 Oct 2014 07:44:49 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 11:44:50 -0000 On Saturday, October 11, 2014 02:02:59 AM Marcel Moolenaar wrote: > Author: marcel > Date: Sat Oct 11 02:02:58 2014 > New Revision: 272925 > URL: https://svnweb.freebsd.org/changeset/base/272925 > > Log: > Turn WITNESS_COUNT into a tunable and sysctl. This allows adjusting > the value without recompiling the kernel. This is useful when > recompiling is not possible as an immediate solution. When we run out > of witness objects, witness is completely disabled. Not having an > immediate solution can therefore be problematic. > > Submitted by: Sreekanth Rupavatharam > Obtained from: Juniper Networks, Inc. A few nits: > Modified: > head/sys/kern/subr_witness.c > > @@ -416,6 +414,13 @@ int witness_skipspin = 0; > #endif > SYSCTL_INT(_debug_witness, OID_AUTO, skipspin, CTLFLAG_RDTUN, > &witness_skipspin, 0, ""); > > +/* tunable for Witness count */ > +int witness_count = WITNESS_COUNT; > +int badstack_sbuf_size = WITNESS_COUNT * 256; This assignment isn't needed (it always gets overwritten). Also, style-wise, FreeBSD code tends to group a SYSCTL with its variable. The comment also just duplicates the code. > + > +SYSCTL_INT(_debug_witness, OID_AUTO, witness_count, CTLFLAG_RDTUN, > + &witness_count, 0, ""); > + > /* > * Call this to print out the relations between locks. > */ > @@ -450,7 +455,7 @@ SYSCTL_INT(_debug_witness, OID_AUTO, sle > ""); > > static struct witness *w_data; > -static uint8_t w_rmatrix[WITNESS_COUNT+1][WITNESS_COUNT+1]; > +static uint8_t **w_rmatrix; > static struct lock_list_entry w_locklistdata[LOCK_CHILDCOUNT]; > static struct witness_hash w_hash; /* The witness hash table. */ > > @@ -726,9 +731,18 @@ witness_initialize(void *dummy __unused) > struct witness *w, *w1; > int i; > > - w_data = malloc(sizeof (struct witness) * WITNESS_COUNT, M_WITNESS, > + w_data = malloc(sizeof (struct witness) * witness_count, M_WITNESS, > M_NOWAIT | M_ZERO); > > + w_rmatrix = malloc(sizeof(uint8_t *) * (witness_count+1), > + M_WITNESS, M_NOWAIT | M_ZERO); > + > + for(i = 0; i < witness_count+1; i++) { Please use a space after 'for' and around '+' in 'witness_count + 1' (you do Below). > + w_rmatrix[i] = malloc(sizeof(uint8_t) * (witness_count + 1), > + M_WITNESS, M_NOWAIT | M_ZERO); The malloc of w_rmatrix() used M_NOWAIT, but you didn't check its return Value, so this will fault. Either check the return value or use M_WAITOK. > + } > + badstack_sbuf_size = witness_count * 256; > + > /* > * We have to release Giant before initializing its witness > * structure so that WITNESS doesn't get confused. > @@ -739,7 +753,7 @@ witness_initialize(void *dummy __unused) > CTR1(KTR_WITNESS, "%s: initializing witness", __func__); > mtx_init(&w_mtx, "witness lock", NULL, MTX_SPIN | MTX_QUIET | > MTX_NOWITNESS | MTX_NOPROFILE); > - for (i = WITNESS_COUNT - 1; i >= 0; i--) { > + for (i = witness_count - 1; i >= 0; i--) { > w = &w_data[i]; > memset(w, 0, sizeof(*w)); > w_data[i].w_index = i; /* Witness index never changes. */ > @@ -752,8 +766,10 @@ witness_initialize(void *dummy __unused) > STAILQ_REMOVE_HEAD(&w_free, w_list); > w_free_cnt--; > > - memset(w_rmatrix, 0, > - (sizeof(**w_rmatrix) * (WITNESS_COUNT+1) * (WITNESS_COUNT+1))); > + for(i = 0; i < witness_count; i++) { > + memset(w_rmatrix[i], 0, sizeof(uint8_t) * > + (witness_count + 1)); > + } More 'space after for'. Also, 'sizeof(*w_rmatrix[i])' would more closely match the old code. Using 'sizeof(uint8_t)' means you still have to fix this if you change the base matrix type later. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 11:44:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3507BC0D; Sat, 11 Oct 2014 11:44:49 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0A18FC0B; Sat, 11 Oct 2014 11:44:49 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-70-85-31.nwrknj.fios.verizon.net [173.70.85.31]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 8FE3CB939; Sat, 11 Oct 2014 07:44:47 -0400 (EDT) From: John Baldwin To: Marcel Moolenaar Subject: Re: svn commit: r272925 - head/sys/kern Date: Sat, 11 Oct 2014 07:44:44 -0400 Message-ID: <4751050.jVrWRduCzy@ralph.baldwin.cx> User-Agent: KMail/4.12.5 (FreeBSD/10.1-BETA2; KDE/4.12.5; amd64; ; ) In-Reply-To: <201410110202.s9B22xO8045880@svn.freebsd.org> References: <201410110202.s9B22xO8045880@svn.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Sat, 11 Oct 2014 07:44:47 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 11:44:49 -0000 On Saturday, October 11, 2014 02:02:59 AM Marcel Moolenaar wrote: > Author: marcel > Date: Sat Oct 11 02:02:58 2014 > New Revision: 272925 > URL: https://svnweb.freebsd.org/changeset/base/272925 > > Log: > Turn WITNESS_COUNT into a tunable and sysctl. This allows adjusting > the value without recompiling the kernel. This is useful when > recompiling is not possible as an immediate solution. When we run out > of witness objects, witness is completely disabled. Not having an > immediate solution can therefore be problematic. > > Submitted by: Sreekanth Rupavatharam > Obtained from: Juniper Networks, Inc. Thanks, just a few nits: > Modified: > head/sys/kern/subr_witness.c > > @@ -416,6 +414,13 @@ int witness_skipspin = 0; > #endif > SYSCTL_INT(_debug_witness, OID_AUTO, skipspin, CTLFLAG_RDTUN, > &witness_skipspin, 0, ""); > > +/* tunable for Witness count */ > +int witness_count = WITNESS_COUNT; > +int badstack_sbuf_size = WITNESS_COUNT * 256; This assignment isn't needed (it always gets overwritten). Also, style-wise, FreeBSD code tends to group a SYSCTL with its variable. The comment also just duplicates the code. > + > +SYSCTL_INT(_debug_witness, OID_AUTO, witness_count, CTLFLAG_RDTUN, > + &witness_count, 0, ""); > + > /* > * Call this to print out the relations between locks. > */ > @@ -450,7 +455,7 @@ SYSCTL_INT(_debug_witness, OID_AUTO, sle > ""); > > static struct witness *w_data; > -static uint8_t w_rmatrix[WITNESS_COUNT+1][WITNESS_COUNT+1]; > +static uint8_t **w_rmatrix; > static struct lock_list_entry w_locklistdata[LOCK_CHILDCOUNT]; > static struct witness_hash w_hash; /* The witness hash table. */ > > @@ -726,9 +731,18 @@ witness_initialize(void *dummy __unused) > struct witness *w, *w1; > int i; > > - w_data = malloc(sizeof (struct witness) * WITNESS_COUNT, M_WITNESS, > + w_data = malloc(sizeof (struct witness) * witness_count, M_WITNESS, > M_NOWAIT | M_ZERO); > > + w_rmatrix = malloc(sizeof(uint8_t *) * (witness_count+1), > + M_WITNESS, M_NOWAIT | M_ZERO); > + > + for(i = 0; i < witness_count+1; i++) { Please use a space after 'for' and around '+' in 'witness_count + 1' (you do Below). > + w_rmatrix[i] = malloc(sizeof(uint8_t) * (witness_count + 1), > + M_WITNESS, M_NOWAIT | M_ZERO); The malloc of w_rmatrix() used M_NOWAIT, but you didn't check its return Value, so this will fault. Either check the return value or use M_WAITOK. > + } > + badstack_sbuf_size = witness_count * 256; > + > /* > * We have to release Giant before initializing its witness > * structure so that WITNESS doesn't get confused. > @@ -739,7 +753,7 @@ witness_initialize(void *dummy __unused) > CTR1(KTR_WITNESS, "%s: initializing witness", __func__); > mtx_init(&w_mtx, "witness lock", NULL, MTX_SPIN | MTX_QUIET | > MTX_NOWITNESS | MTX_NOPROFILE); > - for (i = WITNESS_COUNT - 1; i >= 0; i--) { > + for (i = witness_count - 1; i >= 0; i--) { > w = &w_data[i]; > memset(w, 0, sizeof(*w)); > w_data[i].w_index = i; /* Witness index never changes. */ > @@ -752,8 +766,10 @@ witness_initialize(void *dummy __unused) > STAILQ_REMOVE_HEAD(&w_free, w_list); > w_free_cnt--; > > - memset(w_rmatrix, 0, > - (sizeof(**w_rmatrix) * (WITNESS_COUNT+1) * (WITNESS_COUNT+1))); > + for(i = 0; i < witness_count; i++) { > + memset(w_rmatrix[i], 0, sizeof(uint8_t) * > + (witness_count + 1)); > + } More 'space after for'. Also, 'sizeof(*w_rmatrix[i])' would more closely match the old code. Using 'sizeof(uint8_t)' means you still have to fix this if you change the base matrix type later. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 11:44:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6F5B4C0F; Sat, 11 Oct 2014 11:44:49 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46C42C0C; Sat, 11 Oct 2014 11:44:49 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-70-85-31.nwrknj.fios.verizon.net [173.70.85.31]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 2B578B968; Sat, 11 Oct 2014 07:44:48 -0400 (EDT) From: John Baldwin To: Gleb Smirnoff Subject: Re: svn commit: r272897 - head/sys/dev/e1000 Date: Sat, 11 Oct 2014 07:44:03 -0400 Message-ID: <30805588.2zv3sCXaFo@ralph.baldwin.cx> User-Agent: KMail/4.12.5 (FreeBSD/10.1-BETA2; KDE/4.12.5; amd64; ; ) In-Reply-To: <20141010203957.GD73266@glebius.int.ru> References: <201410101636.s9AGaQ43066897@svn.freebsd.org> <20141010203957.GD73266@glebius.int.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Sat, 11 Oct 2014 07:44:48 -0400 (EDT) Cc: svn-src-head@freebsd.org, Eric Joyner , src-committers@freebsd.org, svn-src-all@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 11:44:49 -0000 On Saturday, October 11, 2014 12:39:58 AM Gleb Smirnoff wrote: > On Fri, Oct 10, 2014 at 04:36:26PM +0000, John Baldwin wrote: > J> Author: jhb > J> Date: Fri Oct 10 16:36:25 2014 > J> New Revision: 272897 > J> URL: https://svnweb.freebsd.org/changeset/base/272897 > J> > J> Log: > J> Various fixes to stats: > J> - Read the counts of received, dropped, and transmitted management > J> packets and add sysctl nodes for them. > J> - Fix the total octets received/transmitted to read all 64 bits of > J> the counters. > J> - Add missing sysctl nodes for rlec, tncrs, fcruc, tor, and tot. > J> - Remove spurious spaces. > J> > J> Reviewed by: Eric Joyner @ Intel > J> MFC after: 1 week > > JFYI > > With the new API (userland part to be done) one wouldn't need a bunch > of sysctls hanging off every NIC. > > Look at ift_counter enum in if_var.h. It is int type, so we can cut it > into large blocks for vendor specific counters. The top part, up to the > IFCOUNTERS member would remain standard and copied to if_data when > imported to userland. Above IFCOUNTERS we can give us much number > space to vendors as needed. Like this: > > + IFCOUNTER_INTEL_RLEC = 1000, > + IFCOUNTER_INTEL_TNCRS, > + IFCOUNTER_INTEL_FCRUC, > ... etc > > After that the driver can return them via igb_get_counter(). > > As said, the userland API not written yet. The plan is that it will > be not as bulky as NET_RT_IFLIST sysctl, that returns all counters > for all NICs. It will allow to request certain counters for certain > NICs. This sounds good to me. cxgb/cxgbe also have a bunch of useful stat counters as well. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 11:49:52 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EF2B7BE; Sat, 11 Oct 2014 11:49:52 +0000 (UTC) Received: from mx0.gentlemail.de (mx0.gentlemail.de [IPv6:2a00:e10:2800::a130]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5EA4FC4D; Sat, 11 Oct 2014 11:49:52 +0000 (UTC) Received: from mh0.gentlemail.de (ezra.dcm1.omnilan.net [IPv6:2a00:e10:2800::a135]) by mx0.gentlemail.de (8.14.5/8.14.5) with ESMTP id s9BBnnX2017927; Sat, 11 Oct 2014 13:49:49 +0200 (CEST) (envelope-from h.schmalzbauer@omnilan.de) Received: from titan.inop.mo1.omnilan.net (titan.inop.mo1.omnilan.net [IPv6:2001:a60:f0bb:1::3:1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mh0.gentlemail.de (Postfix) with ESMTPSA id 1BE023BFA; Sat, 11 Oct 2014 13:49:49 +0200 (CEST) Message-ID: <5439195C.6030805@omnilan.de> Date: Sat, 11 Oct 2014 13:49:48 +0200 From: Harald Schmalzbauer Organization: OmniLAN User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; de-DE; rv:1.9.2.8) Gecko/20100906 Lightning/1.0b2 Thunderbird/3.1.2 MIME-Version: 1.0 To: Xin LI Subject: Re: svn commit: r272324 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs References: <201409301850.s8UIokXo051151@svn.freebsd.org> <5438F86A.5070204@omnilan.de> In-Reply-To: <5438F86A.5070204@omnilan.de> X-Enigmail-Version: 1.1.2 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigD6E3A6F37EEA63793B4DB743" X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (mx0.gentlemail.de [IPv6:2a00:e10:2800::a130]); Sat, 11 Oct 2014 13:49:49 +0200 (CEST) X-Milter: Spamilter (Reciever: mx0.gentlemail.de; Sender-ip: ; Sender-helo: mh0.gentlemail.de; ) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 11:49:53 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigD6E3A6F37EEA63793B4DB743 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Bez=FCglich Harald Schmalzbauer's Nachricht vom 11.10.2014 11:29 (localtime): > Bez=FCglich Xin LI's Nachricht vom 30.09.2014 20:50 (localtime): >> Author: delphij >> Date: Tue Sep 30 18:50:45 2014 >> New Revision: 272324 >> URL: http://svnweb.freebsd.org/changeset/base/272324 >> >> Log: >> Fix a mismerge in r260183 which prevents snapshot zvol devices being= >> removed and re-instate the fix in r242862. >> =20 >> Reported by: Leon Dang , smh >> MFC after: 3 days > Ist this a candidate for 10.1? Although I guess MFC hasn't happened yet= > - couldn't find it in stable/10? Ah, found it in r272883 (stable/10). So I guess it won't make it into 10.= 1? Thanks, -Harry --------------enigD6E3A6F37EEA63793B4DB743 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAlQ5GVwACgkQLDqVQ9VXb8h6UQCfQUMHBuNNCgWNMQvIVfnYi0Js YlYAniOhQELBhEhRutgr5O66pw1wj+Wf =U4Ny -----END PGP SIGNATURE----- --------------enigD6E3A6F37EEA63793B4DB743-- From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 12:56:50 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1F0359C7; Sat, 11 Oct 2014 12:56:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0B1D221A; Sat, 11 Oct 2014 12:56:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9BCunei053808; Sat, 11 Oct 2014 12:56:49 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9BCunVp053807; Sat, 11 Oct 2014 12:56:49 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410111256.s9BCunVp053807@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 11 Oct 2014 12:56:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272939 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 12:56:50 -0000 Author: mav Date: Sat Oct 11 12:56:49 2014 New Revision: 272939 URL: https://svnweb.freebsd.org/changeset/base/272939 Log: Shorten frontend name. Modified: head/sys/cam/ctl/scsi_ctl.c Modified: head/sys/cam/ctl/scsi_ctl.c ============================================================================== --- head/sys/cam/ctl/scsi_ctl.c Sat Oct 11 10:19:37 2014 (r272938) +++ head/sys/cam/ctl/scsi_ctl.c Sat Oct 11 12:56:49 2014 (r272939) @@ -230,7 +230,7 @@ static struct periph_driver ctlfe_driver static struct ctl_frontend ctlfe_frontend = { - .name = "camtarget", + .name = "camtgt", .init = ctlfeinitialize, .fe_dump = ctlfe_dump, .shutdown = ctlfeshutdown, From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 15:04:51 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1499977C; Sat, 11 Oct 2014 15:04:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 001DD164; Sat, 11 Oct 2014 15:04:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9BF4oqO015608; Sat, 11 Oct 2014 15:04:50 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9BF4oOH015607; Sat, 11 Oct 2014 15:04:50 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201410111504.s9BF4oOH015607@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sat, 11 Oct 2014 15:04:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272940 - head/sys/netpfil/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 15:04:51 -0000 Author: melifaro Date: Sat Oct 11 15:04:50 2014 New Revision: 272940 URL: https://svnweb.freebsd.org/changeset/base/272940 Log: Fix KASSERT typo. Modified: head/sys/netpfil/ipfw/ip_fw_table_value.c (contents, props changed) Modified: head/sys/netpfil/ipfw/ip_fw_table_value.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_table_value.c Sat Oct 11 12:56:49 2014 (r272939) +++ head/sys/netpfil/ipfw/ip_fw_table_value.c Sat Oct 11 15:04:50 2014 (r272940) @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: projects/ipfw/sys/netpfil/ipfw/ip_fw_table.c 270407 2014-08-23 12:41:39Z melifaro $"); +__FBSDID("$FreeBSD$"); /* * Multi-field value support for ipfw tables. @@ -557,7 +557,7 @@ ipfw_link_table_values(struct ip_fw_chai return (0); } - KASSERT(pval == ch->tablestate, ("resize_storage() notify failure")); + KASSERT(pval == ch->valuestate, ("resize_storage() notify failure")); /* Let's try to link values */ for (i = 0; i < count; i++) { From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 16:08:55 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 637DD847; Sat, 11 Oct 2014 16:08:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 501BF912; Sat, 11 Oct 2014 16:08:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9BG8tNE044138; Sat, 11 Oct 2014 16:08:55 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9BG8tZu044137; Sat, 11 Oct 2014 16:08:55 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201410111608.s9BG8tZu044137@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 11 Oct 2014 16:08:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272941 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 16:08:55 -0000 Author: jhb Date: Sat Oct 11 16:08:54 2014 New Revision: 272941 URL: https://svnweb.freebsd.org/changeset/base/272941 Log: Update ip_divert.ko to depend on version 3 of ipfw. Modified: head/sys/netinet/ip_divert.c Modified: head/sys/netinet/ip_divert.c ============================================================================== --- head/sys/netinet/ip_divert.c Sat Oct 11 15:04:50 2014 (r272940) +++ head/sys/netinet/ip_divert.c Sat Oct 11 16:08:54 2014 (r272941) @@ -836,5 +836,5 @@ static moduledata_t ipdivertmod = { }; DECLARE_MODULE(ipdivert, ipdivertmod, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY); -MODULE_DEPEND(ipdivert, ipfw, 2, 2, 2); +MODULE_DEPEND(ipdivert, ipfw, 3, 3, 3); MODULE_VERSION(ipdivert, 1); From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 16:17:50 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5A240C02; Sat, 11 Oct 2014 16:17:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2CE359E2; Sat, 11 Oct 2014 16:17:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9BGHoxw049068; Sat, 11 Oct 2014 16:17:50 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9BGHoGn049067; Sat, 11 Oct 2014 16:17:50 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201410111617.s9BGHoGn049067@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 11 Oct 2014 16:17:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272943 - head/sys/i386/xen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 16:17:50 -0000 Author: kib Date: Sat Oct 11 16:17:49 2014 New Revision: 272943 URL: https://svnweb.freebsd.org/changeset/base/272943 Log: MFi386 r272761. Noted by: Holger Hans Peter Freyther Sponsored by: The FreeBSD Foundation MFC after: 10 days Modified: head/sys/i386/xen/pmap.c Modified: head/sys/i386/xen/pmap.c ============================================================================== --- head/sys/i386/xen/pmap.c Sat Oct 11 16:16:05 2014 (r272942) +++ head/sys/i386/xen/pmap.c Sat Oct 11 16:17:49 2014 (r272943) @@ -888,15 +888,19 @@ pmap_invalidate_cache(void) #define PMAP_CLFLUSH_THRESHOLD (2 * 1024 * 1024) void -pmap_invalidate_cache_range(vm_offset_t sva, vm_offset_t eva) +pmap_invalidate_cache_range(vm_offset_t sva, vm_offset_t eva, boolean_t force) { - KASSERT((sva & PAGE_MASK) == 0, - ("pmap_invalidate_cache_range: sva not page-aligned")); - KASSERT((eva & PAGE_MASK) == 0, - ("pmap_invalidate_cache_range: eva not page-aligned")); + if (force) { + sva &= ~(vm_offset_t)cpu_clflush_line_size; + } else { + KASSERT((sva & PAGE_MASK) == 0, + ("pmap_invalidate_cache_range: sva not page-aligned")); + KASSERT((eva & PAGE_MASK) == 0, + ("pmap_invalidate_cache_range: eva not page-aligned")); + } - if (cpu_feature & CPUID_SS) + if ((cpu_feature & CPUID_SS) != 0 && !force) ; /* If "Self Snoop" is supported, do nothing. */ else if ((cpu_feature & CPUID_CLFSH) != 0 && eva - sva < PMAP_CLFLUSH_THRESHOLD) { @@ -4073,7 +4077,7 @@ pmap_mapdev_attr(vm_paddr_t pa, vm_size_ for (tmpsize = 0; tmpsize < size; tmpsize += PAGE_SIZE) pmap_kenter_attr(va + tmpsize, pa + tmpsize, mode); pmap_invalidate_range(kernel_pmap, va, va + tmpsize); - pmap_invalidate_cache_range(va, va + size); + pmap_invalidate_cache_range(va, va + size, FALSE); return ((void *)(va + offset)); } @@ -4241,7 +4245,7 @@ pmap_change_attr(vm_offset_t va, vm_size */ if (changed) { pmap_invalidate_range(kernel_pmap, base, tmpva); - pmap_invalidate_cache_range(base, tmpva); + pmap_invalidate_cache_range(base, tmpva, FALSE); } return (0); } From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 16:34:02 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A5476E2; Sat, 11 Oct 2014 16:34:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 77E5FB7D; Sat, 11 Oct 2014 16:34:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9BGY29t057946; Sat, 11 Oct 2014 16:34:02 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9BGY2jN057945; Sat, 11 Oct 2014 16:34:02 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201410111634.s9BGY2jN057945@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Sat, 11 Oct 2014 16:34:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272944 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 16:34:02 -0000 Author: marcel Date: Sat Oct 11 16:34:01 2014 New Revision: 272944 URL: https://svnweb.freebsd.org/changeset/base/272944 Log: Fix nits in previous commit: 1. Remove initializer for badstack_sbuf_size; it gets set unconditionally. 2. Remove meaningless comment. 3. Group witness_count and its sysctl together. 4. Fix spacing in for statements (space after for and within condition). 5. Change *all* M_NOWAIT usages in witness_initialize() to M_WAITOK; not just those that were newly introduced -- the allocation is assumed to succeed for all allocations. 6. Avoid using uint8_t as the base type in sizeof() expressions; Use the variable name (w_rmatrix) as much as possible. Pointed out by: jhb@ (thanks!) Modified: head/sys/kern/subr_witness.c Modified: head/sys/kern/subr_witness.c ============================================================================== --- head/sys/kern/subr_witness.c Sat Oct 11 16:17:49 2014 (r272943) +++ head/sys/kern/subr_witness.c Sat Oct 11 16:34:01 2014 (r272944) @@ -414,10 +414,9 @@ int witness_skipspin = 0; #endif SYSCTL_INT(_debug_witness, OID_AUTO, skipspin, CTLFLAG_RDTUN, &witness_skipspin, 0, ""); -/* tunable for Witness count */ -int witness_count = WITNESS_COUNT; -int badstack_sbuf_size = WITNESS_COUNT * 256; +int badstack_sbuf_size; +int witness_count = WITNESS_COUNT; SYSCTL_INT(_debug_witness, OID_AUTO, witness_count, CTLFLAG_RDTUN, &witness_count, 0, ""); @@ -732,17 +731,17 @@ witness_initialize(void *dummy __unused) int i; w_data = malloc(sizeof (struct witness) * witness_count, M_WITNESS, - M_NOWAIT | M_ZERO); + M_WAITOK | M_ZERO); - w_rmatrix = malloc(sizeof(uint8_t *) * (witness_count+1), - M_WITNESS, M_NOWAIT | M_ZERO); + w_rmatrix = malloc(sizeof(*w_rmatrix) * (witness_count + 1), + M_WITNESS, M_WAITOK | M_ZERO); - for(i = 0; i < witness_count+1; i++) { - w_rmatrix[i] = malloc(sizeof(uint8_t) * (witness_count + 1), - M_WITNESS, M_NOWAIT | M_ZERO); + for (i = 0; i < witness_count + 1; i++) { + w_rmatrix[i] = malloc(sizeof(*w_rmatrix[i]) * + (witness_count + 1), M_WITNESS, M_WAITOK | M_ZERO); } badstack_sbuf_size = witness_count * 256; - + /* * We have to release Giant before initializing its witness * structure so that WITNESS doesn't get confused. @@ -766,8 +765,8 @@ witness_initialize(void *dummy __unused) STAILQ_REMOVE_HEAD(&w_free, w_list); w_free_cnt--; - for(i = 0; i < witness_count; i++) { - memset(w_rmatrix[i], 0, sizeof(uint8_t) * + for (i = 0; i < witness_count; i++) { + memset(w_rmatrix[i], 0, sizeof(*w_rmatrix[i]) * (witness_count + 1)); } From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 17:52:55 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 81CED393; Sat, 11 Oct 2014 17:52:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 637FB308; Sat, 11 Oct 2014 17:52:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9BHqtVR095732; Sat, 11 Oct 2014 17:52:55 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9BHqsxD095729; Sat, 11 Oct 2014 17:52:54 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410111752.s9BHqsxD095729@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 11 Oct 2014 17:52:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272947 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 17:52:55 -0000 Author: mav Date: Sat Oct 11 17:52:54 2014 New Revision: 272947 URL: https://svnweb.freebsd.org/changeset/base/272947 Log: Give physical and virtual ports numbers some more meaning. Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c head/sys/cam/ctl/ctl_frontend_iscsi.h head/sys/cam/ctl/scsi_ctl.c Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- head/sys/cam/ctl/ctl_frontend_iscsi.c Sat Oct 11 17:49:51 2014 (r272946) +++ head/sys/cam/ctl/ctl_frontend_iscsi.c Sat Oct 11 17:52:54 2014 (r272947) @@ -1996,7 +1996,8 @@ cfiscsi_ioctl_port_create(struct ctl_req /* XXX KDM what should the real number be here? */ port->num_requested_ctl_io = 4096; port->port_name = "iscsi"; - port->virtual_port = strtoul(tag, NULL, 0); + port->physical_port = strtoul(tag, NULL, 0); + port->virtual_port = ct->ct_target_id; port->port_online = cfiscsi_online; port->port_offline = cfiscsi_offline; port->port_info = cfiscsi_info; @@ -2029,7 +2030,7 @@ cfiscsi_ioctl_port_create(struct ctl_req SVPD_ID_TYPE_SCSI_NAME; desc->length = idlen; snprintf(desc->identifier, idlen, "%s,t,0x%4.4x", - target, port->virtual_port); + target, port->physical_port); /* Generate Target ID. */ idlen = strlen(target) + 1; @@ -2257,6 +2258,9 @@ cfiscsi_target_find_or_create(struct cfi strlcpy(newct->ct_alias, alias, sizeof(newct->ct_alias)); refcount_init(&newct->ct_refcount, 1); newct->ct_softc = softc; + if (TAILQ_EMPTY(&softc->targets)) + softc->last_target_id = 0; + newct->ct_target_id = ++softc->last_target_id; TAILQ_INSERT_TAIL(&softc->targets, newct, ct_next); mtx_unlock(&softc->lock); Modified: head/sys/cam/ctl/ctl_frontend_iscsi.h ============================================================================== --- head/sys/cam/ctl/ctl_frontend_iscsi.h Sat Oct 11 17:49:51 2014 (r272946) +++ head/sys/cam/ctl/ctl_frontend_iscsi.h Sat Oct 11 17:52:54 2014 (r272947) @@ -45,6 +45,7 @@ struct cfiscsi_target { char ct_alias[CTL_ISCSI_ALIAS_LEN]; int ct_state; int ct_online; + int ct_target_id; struct ctl_port ct_port; }; @@ -110,6 +111,7 @@ struct cfiscsi_softc { struct mtx lock; char port_name[32]; int online; + int last_target_id; unsigned int last_session_id; TAILQ_HEAD(, cfiscsi_target) targets; TAILQ_HEAD(, cfiscsi_session) sessions; Modified: head/sys/cam/ctl/scsi_ctl.c ============================================================================== --- head/sys/cam/ctl/scsi_ctl.c Sat Oct 11 17:49:51 2014 (r272946) +++ head/sys/cam/ctl/scsi_ctl.c Sat Oct 11 17:52:54 2014 (r272947) @@ -400,8 +400,8 @@ ctlfeasync(void *callback_arg, uint32_t * frontend structure itself. */ port->port_name = softc->port_name; - port->physical_port = cpi->unit_number; - port->virtual_port = cpi->bus_id; + port->physical_port = cpi->bus_id; + port->virtual_port = 0; port->port_online = ctlfe_online; port->port_offline = ctlfe_offline; port->onoff_arg = softc; From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 18:34:12 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EB4622D6; Sat, 11 Oct 2014 18:34:11 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D79AF903; Sat, 11 Oct 2014 18:34:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9BIYBQn015404; Sat, 11 Oct 2014 18:34:11 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9BIYADE015400; Sat, 11 Oct 2014 18:34:10 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201410111834.s9BIYADE015400@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 11 Oct 2014 18:34:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272949 - head/contrib/tcp_wrappers X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 18:34:12 -0000 Author: pfg Date: Sat Oct 11 18:34:10 2014 New Revision: 272949 URL: https://svnweb.freebsd.org/changeset/base/272949 Log: tcpd: complete function prototypes. This clears up at least a build issues on mysql-server ports. While here also replace some spaces with tabs in our headers. PR: 42336 MFC after: 2 weeks Modified: head/contrib/tcp_wrappers/inetcf.h head/contrib/tcp_wrappers/mystdarg.h head/contrib/tcp_wrappers/tcpd.h head/contrib/tcp_wrappers/tli-sequent.h Modified: head/contrib/tcp_wrappers/inetcf.h ============================================================================== --- head/contrib/tcp_wrappers/inetcf.h Sat Oct 11 18:01:09 2014 (r272948) +++ head/contrib/tcp_wrappers/inetcf.h Sat Oct 11 18:34:10 2014 (r272949) @@ -8,7 +8,7 @@ extern char *inet_cfg(); /* read inetd. extern void inet_set(); /* remember internet service */ extern int inet_get(); /* look up internet service */ -#define WR_UNKNOWN (-1) /* service unknown */ -#define WR_NOT 1 /* may not be wrapped */ -#define WR_MAYBE 2 /* may be wrapped */ +#define WR_UNKNOWN (-1) /* service unknown */ +#define WR_NOT 1 /* may not be wrapped */ +#define WR_MAYBE 2 /* may be wrapped */ #define WR_YES 3 /* service is wrapped */ Modified: head/contrib/tcp_wrappers/mystdarg.h ============================================================================== --- head/contrib/tcp_wrappers/mystdarg.h Sat Oct 11 18:01:09 2014 (r272948) +++ head/contrib/tcp_wrappers/mystdarg.h Sat Oct 11 18:34:10 2014 (r272949) @@ -6,14 +6,14 @@ #ifdef __STDC__ #include -#define VARARGS(func,type,arg) func(type arg, ...) -#define VASTART(ap,type,name) va_start(ap,name) -#define VAEND(ap) va_end(ap) +#define VARARGS(func,type,arg) func(type arg, ...) +#define VASTART(ap,type,name) va_start(ap,name) +#define VAEND(ap) va_end(ap) #else #include -#define VARARGS(func,type,arg) func(va_alist) va_dcl -#define VASTART(ap,type,name) {type name; va_start(ap); name = va_arg(ap, type) -#define VAEND(ap) va_end(ap);} +#define VARARGS(func,type,arg) func(va_alist) va_dcl +#define VASTART(ap,type,name) {type name; va_start(ap); name = va_arg(ap, type) +#define VAEND(ap) va_end(ap);} #endif extern char *percent_m(); Modified: head/contrib/tcp_wrappers/tcpd.h ============================================================================== --- head/contrib/tcp_wrappers/tcpd.h Sat Oct 11 18:01:09 2014 (r272948) +++ head/contrib/tcp_wrappers/tcpd.h Sat Oct 11 18:34:10 2014 (r272949) @@ -8,7 +8,7 @@ /* Structure to describe one communications endpoint. */ -#define STRING_LENGTH 128 /* hosts, users, processes */ +#define STRING_LENGTH 128 /* hosts, users, processes */ struct host_info { char name[STRING_LENGTH]; /* access via eval_hostname(host) */ @@ -31,21 +31,21 @@ struct request_info { char pid[10]; /* access via eval_pid(request) */ struct host_info client[1]; /* client endpoint info */ struct host_info server[1]; /* server endpoint info */ - void (*sink) (); /* datagram sink function or 0 */ - void (*hostname) (); /* address to printable hostname */ - void (*hostaddr) (); /* address to printable address */ - void (*cleanup) (); /* cleanup function or 0 */ + void (*sink) (int); /* datagram sink function or 0 */ + void (*hostname) (struct host_info *); /* address to printable hostname */ + void (*hostaddr) (struct host_info *); /* address to printable address */ + void (*cleanup) (struct request_info *); /* cleanup function or 0 */ struct netconfig *config; /* netdir handle */ }; /* Common string operations. Less clutter should be more readable. */ -#define STRN_CPY(d,s,l) { strncpy((d),(s),(l)); (d)[(l)-1] = 0; } +#define STRN_CPY(d,s,l) { strncpy((d),(s),(l)); (d)[(l)-1] = 0; } -#define STRN_EQ(x,y,l) (strncasecmp((x),(y),(l)) == 0) -#define STRN_NE(x,y,l) (strncasecmp((x),(y),(l)) != 0) -#define STR_EQ(x,y) (strcasecmp((x),(y)) == 0) -#define STR_NE(x,y) (strcasecmp((x),(y)) != 0) +#define STRN_EQ(x,y,l) (strncasecmp((x),(y),(l)) == 0) +#define STRN_NE(x,y,l) (strncasecmp((x),(y),(l)) != 0) +#define STR_EQ(x,y) (strcasecmp((x),(y)) == 0) +#define STR_NE(x,y) (strcasecmp((x),(y)) != 0) /* * Initially, all above strings have the empty value. Information that @@ -54,22 +54,22 @@ struct request_info { * that we do not believe in is set to "paranoid". */ -#define STRING_UNKNOWN "unknown" /* lookup failed */ -#define STRING_PARANOID "paranoid" /* hostname conflict */ +#define STRING_UNKNOWN "unknown" /* lookup failed */ +#define STRING_PARANOID "paranoid" /* hostname conflict */ extern char unknown[]; extern char paranoid[]; -#define HOSTNAME_KNOWN(s) (STR_NE((s),unknown) && STR_NE((s),paranoid)) +#define HOSTNAME_KNOWN(s) (STR_NE((s),unknown) && STR_NE((s),paranoid)) -#define NOT_INADDR(s) (s[strspn(s,"01234567890./")] != 0) +#define NOT_INADDR(s) (s[strspn(s,"01234567890./")] != 0) /* Global functions. */ #if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT) extern void fromhost(); /* get/validate client host info */ #else -#define fromhost sock_host /* no TLI support needed */ +#define fromhost sock_host /* no TLI support needed */ #endif extern int hosts_access(); /* access control */ @@ -105,15 +105,15 @@ extern struct request_info *request_init extern struct request_info *request_set(); /* update request structure */ #endif -#define RQ_FILE 1 /* file descriptor */ -#define RQ_DAEMON 2 /* server process (argv[0]) */ -#define RQ_USER 3 /* client user name */ -#define RQ_CLIENT_NAME 4 /* client host name */ -#define RQ_CLIENT_ADDR 5 /* client host address */ -#define RQ_CLIENT_SIN 6 /* client endpoint (internal) */ -#define RQ_SERVER_NAME 7 /* server host name */ -#define RQ_SERVER_ADDR 8 /* server host address */ -#define RQ_SERVER_SIN 9 /* server endpoint (internal) */ +#define RQ_FILE 1 /* file descriptor */ +#define RQ_DAEMON 2 /* server process (argv[0]) */ +#define RQ_USER 3 /* client user name */ +#define RQ_CLIENT_NAME 4 /* client host name */ +#define RQ_CLIENT_ADDR 5 /* client host address */ +#define RQ_CLIENT_SIN 6 /* client endpoint (internal) */ +#define RQ_SERVER_NAME 7 /* server host name */ +#define RQ_SERVER_ADDR 8 /* server host address */ +#define RQ_SERVER_SIN 9 /* server endpoint (internal) */ /* * Routines for delayed evaluation of request attributes. Each attribute @@ -129,15 +129,15 @@ extern char *eval_hostaddr(); /* printa extern char *eval_hostinfo(); /* host name or address */ extern char *eval_client(); /* whatever is available */ extern char *eval_server(); /* whatever is available */ -#define eval_daemon(r) ((r)->daemon) /* daemon process name */ -#define eval_pid(r) ((r)->pid) /* process id */ +#define eval_daemon(r) ((r)->daemon) /* daemon process name */ +#define eval_pid(r) ((r)->pid) /* process id */ /* Socket-specific methods, including DNS hostname lookups. */ extern void sock_host(); /* look up endpoint addresses */ extern void sock_hostname(); /* translate address to hostname */ extern void sock_hostaddr(); /* address to printable address */ -#define sock_methods(r) \ +#define sock_methods(r) \ { (r)->hostname = sock_hostname; (r)->hostaddr = sock_hostaddr; } /* The System V Transport-Level Interface (TLI) interface. */ @@ -173,9 +173,9 @@ extern struct tcpd_context tcpd_context; * (-1) returns are here because zero is already taken by longjmp(). */ -#define AC_PERMIT 1 /* permit access */ -#define AC_DENY (-1) /* deny_access */ -#define AC_ERROR AC_DENY /* XXX */ +#define AC_PERMIT 1 /* permit access */ +#define AC_DENY (-1) /* deny_access */ +#define AC_ERROR AC_DENY /* XXX */ /* * In verification mode an option function should just say what it would do, @@ -190,36 +190,36 @@ extern int dry_run; /* verification fl /* Bug workarounds. */ #ifdef INET_ADDR_BUG /* inet_addr() returns struct */ -#define inet_addr fix_inet_addr +#define inet_addr fix_inet_addr extern long fix_inet_addr(); #endif #ifdef BROKEN_FGETS /* partial reads from sockets */ -#define fgets fix_fgets +#define fgets fix_fgets extern char *fix_fgets(); #endif #ifdef RECVFROM_BUG /* no address family info */ -#define recvfrom fix_recvfrom +#define recvfrom fix_recvfrom extern int fix_recvfrom(); #endif #ifdef GETPEERNAME_BUG /* claims success with UDP */ -#define getpeername fix_getpeername +#define getpeername fix_getpeername extern int fix_getpeername(); #endif #ifdef SOLARIS_24_GETHOSTBYNAME_BUG /* lists addresses as aliases */ -#define gethostbyname fix_gethostbyname +#define gethostbyname fix_gethostbyname extern struct hostent *fix_gethostbyname(); #endif #ifdef USE_STRSEP /* libc calls strtok() */ -#define strtok fix_strtok +#define strtok fix_strtok extern char *fix_strtok(); #endif #ifdef LIBC_CALLS_STRTOK /* libc calls strtok() */ -#define strtok my_strtok +#define strtok my_strtok extern char *my_strtok(); #endif Modified: head/contrib/tcp_wrappers/tli-sequent.h ============================================================================== --- head/contrib/tcp_wrappers/tli-sequent.h Sat Oct 11 18:01:09 2014 (r272948) +++ head/contrib/tcp_wrappers/tli-sequent.h Sat Oct 11 18:34:10 2014 (r272949) @@ -1,7 +1,7 @@ #ifdef __STDC__ -#define __P(X) X +#define __P(X) X #else -#define __P(X) () +#define __P(X) () #endif extern int t_sync __P((int)); From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 18:54:38 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0B270D58; Sat, 11 Oct 2014 18:54:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EBEAFACA; Sat, 11 Oct 2014 18:54:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9BIsbrs025093; Sat, 11 Oct 2014 18:54:37 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9BIsbhE025092; Sat, 11 Oct 2014 18:54:37 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201410111854.s9BIsbhE025092@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 11 Oct 2014 18:54:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272950 - head/contrib/tcp_wrappers X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 18:54:38 -0000 Author: pfg Date: Sat Oct 11 18:54:37 2014 New Revision: 272950 URL: https://svnweb.freebsd.org/changeset/base/272950 Log: tcpd.h: add prototype for hosts_ctl According the hosts_access(3) man page the hosts_ctl() prototype should be in tcpd.h. For now, follow other declarations and don't add the arguments in the prototype. Reference: https://www.illumos.org/issues/4385 PR: 32808 MFC after: 2 weeks Modified: head/contrib/tcp_wrappers/tcpd.h Modified: head/contrib/tcp_wrappers/tcpd.h ============================================================================== --- head/contrib/tcp_wrappers/tcpd.h Sat Oct 11 18:34:10 2014 (r272949) +++ head/contrib/tcp_wrappers/tcpd.h Sat Oct 11 18:54:37 2014 (r272950) @@ -73,6 +73,7 @@ extern void fromhost(); /* get/validat #endif extern int hosts_access(); /* access control */ +extern int hosts_ctl(); /* wrapper around request_init() */ extern void shell_cmd(); /* execute shell command */ extern char *percent_x(); /* do % expansion */ extern void rfc931(); /* client name from RFC 931 daemon */ From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 18:58:58 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CB84B163; Sat, 11 Oct 2014 18:58:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B85F9B03; Sat, 11 Oct 2014 18:58:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9BIwwAA025705; Sat, 11 Oct 2014 18:58:58 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9BIwwWW025704; Sat, 11 Oct 2014 18:58:58 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201410111858.s9BIwwWW025704@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 11 Oct 2014 18:58:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272951 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 18:58:58 -0000 Author: pfg Date: Sat Oct 11 18:58:58 2014 New Revision: 272951 URL: https://svnweb.freebsd.org/changeset/base/272951 Log: Bump FreeBSD_version due to cleanup of tcp wrapper header. Due to revisions r272949 and r272950 which should affect positively some ports. Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Sat Oct 11 18:54:37 2014 (r272950) +++ head/sys/sys/param.h Sat Oct 11 18:58:58 2014 (r272951) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100037 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100038 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 19:09:57 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 82A89638; Sat, 11 Oct 2014 19:09:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 560F7C01; Sat, 11 Oct 2014 19:09:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9BJ9v2Z031011; Sat, 11 Oct 2014 19:09:57 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9BJ9ueU031008; Sat, 11 Oct 2014 19:09:56 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201410111909.s9BJ9ueU031008@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 11 Oct 2014 19:09:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272952 - in head/sys: fs/ext2fs fs/msdosfs ufs/ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 19:09:57 -0000 Author: kib Date: Sat Oct 11 19:09:56 2014 New Revision: 272952 URL: https://svnweb.freebsd.org/changeset/base/272952 Log: Do not set IN_ACCESS flag for read-only mounts. The IN_ACCESS survives remount in rw, also it is set for vnodes on rootfs before noatime can be set or clock is adjusted. All conditions result in wrong atime for accessed vnodes. Submitted by: bde MFC after: 1 week Modified: head/sys/fs/ext2fs/ext2_vnops.c head/sys/fs/msdosfs/msdosfs_vnops.c head/sys/ufs/ffs/ffs_vnops.c Modified: head/sys/fs/ext2fs/ext2_vnops.c ============================================================================== --- head/sys/fs/ext2fs/ext2_vnops.c Sat Oct 11 18:58:58 2014 (r272951) +++ head/sys/fs/ext2fs/ext2_vnops.c Sat Oct 11 19:09:56 2014 (r272952) @@ -1762,7 +1762,7 @@ ext2_ind_read(struct vop_read_args *ap) } if ((error == 0 || uio->uio_resid != orig_resid) && - (vp->v_mount->mnt_flag & MNT_NOATIME) == 0) + (vp->v_mount->mnt_flag & (MNT_NOATIME | MNT_RDONLY)) == 0) ip->i_flag |= IN_ACCESS; return (error); } Modified: head/sys/fs/msdosfs/msdosfs_vnops.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_vnops.c Sat Oct 11 18:58:58 2014 (r272951) +++ head/sys/fs/msdosfs/msdosfs_vnops.c Sat Oct 11 19:09:56 2014 (r272952) @@ -642,7 +642,7 @@ msdosfs_read(ap) brelse(bp); } while (error == 0 && uio->uio_resid > 0 && n != 0); if (!isadir && (error == 0 || uio->uio_resid != orig_resid) && - (vp->v_mount->mnt_flag & MNT_NOATIME) == 0) + (vp->v_mount->mnt_flag & (MNT_NOATIME | MNT_RDONLY)) == 0) dep->de_flag |= DE_ACCESS; return (error); } Modified: head/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vnops.c Sat Oct 11 18:58:58 2014 (r272951) +++ head/sys/ufs/ffs/ffs_vnops.c Sat Oct 11 19:09:56 2014 (r272952) @@ -627,7 +627,7 @@ ffs_read(ap) } if ((error == 0 || uio->uio_resid != orig_resid) && - (vp->v_mount->mnt_flag & MNT_NOATIME) == 0 && + (vp->v_mount->mnt_flag & (MNT_NOATIME | MNT_RDONLY)) == 0 && (ip->i_flag & IN_ACCESS) == 0) { VI_LOCK(vp); ip->i_flag |= IN_ACCESS; From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 19:37:01 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3929FECB; Sat, 11 Oct 2014 19:37:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 237A3E97; Sat, 11 Oct 2014 19:37:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9BJb1N9045256; Sat, 11 Oct 2014 19:37:01 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9BJb0VC045249; Sat, 11 Oct 2014 19:37:00 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201410111937.s9BJb0VC045249@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 11 Oct 2014 19:37:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272956 - head/sys/dev/mse X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 19:37:01 -0000 Author: jhb Date: Sat Oct 11 19:36:59 2014 New Revision: 272956 URL: https://svnweb.freebsd.org/changeset/base/272956 Log: Add locking and mark MPSAFE. - Add a mutex to protect the softc. - Use callout(9) instead of timeout(9). - Consolidate duplicated detach routines into a bus-independent detach routine. - Add an extra sleep lock flag (MSESC_READING) to prevent other readers from reading while the first reader is copying data out of sc_bytes[] via uiomove(). - Use bus_*() instead of bus_space_*(). Tested by: nyan Modified: head/sys/dev/mse/mse.c head/sys/dev/mse/mse_cbus.c head/sys/dev/mse/mse_isa.c head/sys/dev/mse/msevar.h Modified: head/sys/dev/mse/mse.c ============================================================================== --- head/sys/dev/mse/mse.c Sat Oct 11 19:34:41 2014 (r272955) +++ head/sys/dev/mse/mse.c Sat Oct 11 19:36:59 2014 (r272956) @@ -99,7 +99,6 @@ static d_poll_t msepoll; static struct cdevsw mse_cdevsw = { .d_version = D_VERSION, - .d_flags = D_NEEDGIANT, .d_open = mseopen, .d_close = mseclose, .d_read = mseread, @@ -109,9 +108,10 @@ static struct cdevsw mse_cdevsw = { }; static void mseintr(void *); -static timeout_t msetimeout; +static void mseintr_locked(mse_softc_t *sc); +static void msetimeout(void *); -#define MSE_NBLOCKIO(dev) dev2unit(dev) +#define MSE_NBLOCKIO(dev) (dev2unit(dev) != 0) #define MSEPRI (PZERO + 3) @@ -123,32 +123,68 @@ mse_common_attach(device_t dev) sc = device_get_softc(dev); unit = device_get_unit(dev); + mtx_init(&sc->sc_lock, "mse", NULL, MTX_DEF); + callout_init_mtx(&sc->sc_callout, &sc->sc_lock, 0); rid = 0; sc->sc_intr = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE); if (sc->sc_intr == NULL) { bus_release_resource(dev, SYS_RES_IOPORT, rid, sc->sc_port); + mtx_destroy(&sc->sc_lock); return ENXIO; } - if (bus_setup_intr(dev, sc->sc_intr, - INTR_TYPE_TTY, NULL, mseintr, sc, &sc->sc_ih)) { + if (bus_setup_intr(dev, sc->sc_intr, INTR_TYPE_TTY | INTR_MPSAFE, + NULL, mseintr, sc, &sc->sc_ih)) { bus_release_resource(dev, SYS_RES_IOPORT, rid, sc->sc_port); bus_release_resource(dev, SYS_RES_IRQ, rid, sc->sc_intr); + mtx_destroy(&sc->sc_lock); return ENXIO; } flags = device_get_flags(dev); sc->mode.accelfactor = (flags & MSE_CONFIG_ACCEL) >> 4; - callout_handle_init(&sc->sc_callout); - sc->sc_dev = make_dev(&mse_cdevsw, 0, 0, 0, 0600, "mse%d", unit); + sc->sc_dev = make_dev(&mse_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, + "mse%d", unit); sc->sc_dev->si_drv1 = sc; - sc->sc_ndev = make_dev(&mse_cdevsw, 1, 0, 0, 0600, "nmse%d", unit); + sc->sc_ndev = make_dev(&mse_cdevsw, 1, UID_ROOT, GID_WHEEL, 0600, + "nmse%d", unit); sc->sc_ndev->si_drv1 = sc; return 0; } +int +mse_detach(device_t dev) +{ + mse_softc_t *sc; + int rid; + + sc = device_get_softc(dev); + MSE_LOCK(sc); + if (sc->sc_flags & MSESC_OPEN) { + MSE_UNLOCK(sc); + return EBUSY; + } + + /* Sabotage subsequent opens. */ + sc->sc_mousetype = MSE_NONE; + MSE_UNLOCK(sc); + + destroy_dev(sc->sc_dev); + destroy_dev(sc->sc_ndev); + + rid = 0; + bus_teardown_intr(dev, sc->sc_intr, sc->sc_ih); + bus_release_resource(dev, SYS_RES_IRQ, rid, sc->sc_intr); + bus_release_resource(dev, SYS_RES_IOPORT, rid, sc->sc_port); + + callout_drain(&sc->sc_callout); + mtx_destroy(&sc->sc_lock); + + return 0; +} + /* * Exclusive open the mouse, initialize it and enable interrupts. */ @@ -156,18 +192,22 @@ static int mseopen(struct cdev *dev, int flags, int fmt, struct thread *td) { mse_softc_t *sc = dev->si_drv1; - int s; - if (sc->sc_mousetype == MSE_NONE) + MSE_LOCK(sc); + if (sc->sc_mousetype == MSE_NONE) { + MSE_UNLOCK(sc); return (ENXIO); - if (sc->sc_flags & MSESC_OPEN) + } + if (sc->sc_flags & MSESC_OPEN) { + MSE_UNLOCK(sc); return (EBUSY); + } sc->sc_flags |= MSESC_OPEN; sc->sc_obuttons = sc->sc_buttons = MOUSE_MSC_BUTTONS; sc->sc_deltax = sc->sc_deltay = 0; sc->sc_bytesread = sc->mode.packetsize = MOUSE_MSC_PACKETSIZE; sc->sc_watchdog = FALSE; - sc->sc_callout = timeout(msetimeout, dev, hz*2); + callout_reset(&sc->sc_callout, hz * 2, msetimeout, dev); sc->mode.level = 0; sc->status.flags = 0; sc->status.button = sc->status.obutton = 0; @@ -176,9 +216,8 @@ mseopen(struct cdev *dev, int flags, int /* * Initialize mouse interface and enable interrupts. */ - s = spltty(); - (*sc->sc_enablemouse)(sc->sc_iot, sc->sc_ioh); - splx(s); + (*sc->sc_enablemouse)(sc->sc_port); + MSE_UNLOCK(sc); return (0); } @@ -189,14 +228,12 @@ static int mseclose(struct cdev *dev, int flags, int fmt, struct thread *td) { mse_softc_t *sc = dev->si_drv1; - int s; - untimeout(msetimeout, dev, sc->sc_callout); - callout_handle_init(&sc->sc_callout); - s = spltty(); - (*sc->sc_disablemouse)(sc->sc_iot, sc->sc_ioh); + MSE_LOCK(sc); + callout_stop(&sc->sc_callout); + (*sc->sc_disablemouse)(sc->sc_port); sc->sc_flags &= ~MSESC_OPEN; - splx(s); + MSE_UNLOCK(sc); return(0); } @@ -209,27 +246,38 @@ static int mseread(struct cdev *dev, struct uio *uio, int ioflag) { mse_softc_t *sc = dev->si_drv1; - int xfer, s, error; + int xfer, error; /* * If there are no protocol bytes to be read, set up a new protocol * packet. */ - s = spltty(); /* XXX Should be its own spl, but where is imlXX() */ + MSE_LOCK(sc); + while (sc->sc_flags & MSESC_READING) { + if (MSE_NBLOCKIO(dev)) { + MSE_UNLOCK(sc); + return (0); + } + sc->sc_flags |= MSESC_WANT; + error = mtx_sleep(sc, &sc->sc_lock, MSEPRI | PCATCH, "mseread", + 0); + if (error) { + MSE_UNLOCK(sc); + return (error); + } + } + sc->sc_flags |= MSESC_READING; + xfer = 0; if (sc->sc_bytesread >= sc->mode.packetsize) { while (sc->sc_deltax == 0 && sc->sc_deltay == 0 && (sc->sc_obuttons ^ sc->sc_buttons) == 0) { - if (MSE_NBLOCKIO(dev)) { - splx(s); - return (0); - } + if (MSE_NBLOCKIO(dev)) + goto out; sc->sc_flags |= MSESC_WANT; - error = tsleep(sc, MSEPRI | PCATCH, + error = mtx_sleep(sc, &sc->sc_lock, MSEPRI | PCATCH, "mseread", 0); - if (error) { - splx(s); - return (error); - } + if (error) + goto out; } /* @@ -257,13 +305,21 @@ mseread(struct cdev *dev, struct uio *ui sc->sc_deltax = sc->sc_deltay = 0; sc->sc_bytesread = 0; } - splx(s); xfer = min(uio->uio_resid, sc->mode.packetsize - sc->sc_bytesread); + MSE_UNLOCK(sc); error = uiomove(&sc->sc_bytes[sc->sc_bytesread], xfer, uio); - if (error) - return (error); - sc->sc_bytesread += xfer; - return(0); + MSE_LOCK(sc); +out: + sc->sc_flags &= ~MSESC_READING; + if (error == 0) + sc->sc_bytesread += xfer; + if (sc->sc_flags & MSESC_WANT) { + sc->sc_flags &= ~MSESC_WANT; + MSE_UNLOCK(sc); + wakeup(sc); + } else + MSE_UNLOCK(sc); + return (error); } /* @@ -275,20 +331,19 @@ mseioctl(struct cdev *dev, u_long cmd, c mse_softc_t *sc = dev->si_drv1; mousestatus_t status; int err = 0; - int s; switch (cmd) { case MOUSE_GETHWINFO: - s = spltty(); + MSE_LOCK(sc); *(mousehw_t *)addr = sc->hw; if (sc->mode.level == 0) ((mousehw_t *)addr)->model = MOUSE_MODEL_GENERIC; - splx(s); + MSE_UNLOCK(sc); break; case MOUSE_GETMODE: - s = spltty(); + MSE_LOCK(sc); *(mousemode_t *)addr = sc->mode; switch (sc->mode.level) { case 0: @@ -299,7 +354,7 @@ mseioctl(struct cdev *dev, u_long cmd, c ((mousemode_t *)addr)->syncmask[1] = MOUSE_SYS_SYNC; break; } - splx(s); + MSE_UNLOCK(sc); break; case MOUSE_SETMODE: @@ -310,9 +365,11 @@ mseioctl(struct cdev *dev, u_long cmd, c default: return (EINVAL); } - if (((mousemode_t *)addr)->accelfactor < -1) + MSE_LOCK(sc); + if (((mousemode_t *)addr)->accelfactor < -1) { + MSE_UNLOCK(sc); return (EINVAL); - else if (((mousemode_t *)addr)->accelfactor >= 0) + } else if (((mousemode_t *)addr)->accelfactor >= 0) sc->mode.accelfactor = ((mousemode_t *)addr)->accelfactor; sc->mode.level = ((mousemode_t *)addr)->level; @@ -326,23 +383,30 @@ mseioctl(struct cdev *dev, u_long cmd, c = MOUSE_SYS_PACKETSIZE; break; } + MSE_UNLOCK(sc); break; case MOUSE_GETLEVEL: + MSE_LOCK(sc); *(int *)addr = sc->mode.level; + MSE_UNLOCK(sc); break; case MOUSE_SETLEVEL: switch (*(int *)addr) { case 0: + MSE_LOCK(sc); sc->mode.level = *(int *)addr; sc->sc_bytesread = sc->mode.packetsize = MOUSE_MSC_PACKETSIZE; + MSE_UNLOCK(sc); break; case 1: + MSE_LOCK(sc); sc->mode.level = *(int *)addr; sc->sc_bytesread = sc->mode.packetsize = MOUSE_SYS_PACKETSIZE; + MSE_UNLOCK(sc); break; default: return (EINVAL); @@ -350,7 +414,7 @@ mseioctl(struct cdev *dev, u_long cmd, c break; case MOUSE_GETSTATUS: - s = spltty(); + MSE_LOCK(sc); status = sc->status; sc->status.flags = 0; sc->status.obutton = sc->status.button; @@ -358,7 +422,7 @@ mseioctl(struct cdev *dev, u_long cmd, c sc->status.dx = 0; sc->status.dy = 0; sc->status.dz = 0; - splx(s); + MSE_UNLOCK(sc); *(mousestatus_t *)addr = status; break; @@ -385,24 +449,18 @@ static int msepoll(struct cdev *dev, int events, struct thread *td) { mse_softc_t *sc = dev->si_drv1; - int s; int revents = 0; - s = spltty(); + MSE_LOCK(sc); if (events & (POLLIN | POLLRDNORM)) { if (sc->sc_bytesread != sc->mode.packetsize || sc->sc_deltax != 0 || sc->sc_deltay != 0 || (sc->sc_obuttons ^ sc->sc_buttons) != 0) revents |= events & (POLLIN | POLLRDNORM); - else { - /* - * Since this is an exclusive open device, any previous - * proc pointer is trash now, so we can just assign it. - */ + else selrecord(td, &sc->sc_selp); - } } - splx(s); + MSE_UNLOCK(sc); return (revents); } @@ -417,13 +475,14 @@ msetimeout(void *arg) dev = (struct cdev *)arg; sc = dev->si_drv1; + MSE_ASSERT_LOCKED(sc); if (sc->sc_watchdog) { if (bootverbose) printf("%s: lost interrupt?\n", devtoname(dev)); - mseintr(sc); + mseintr_locked(sc); } sc->sc_watchdog = TRUE; - sc->sc_callout = timeout(msetimeout, dev, hz); + callout_schedule(&sc->sc_callout, hz); } /* @@ -432,6 +491,16 @@ msetimeout(void *arg) static void mseintr(void *arg) { + mse_softc_t *sc = arg; + + MSE_LOCK(sc); + mseintr_locked(sc); + MSE_UNLOCK(sc); +} + +static void +mseintr_locked(mse_softc_t *sc) +{ /* * the table to turn MouseSystem button bits (MOUSE_MSC_BUTTON?UP) * into `mousestatus' button bits (MOUSE_BUTTON?DOWN). @@ -446,7 +515,6 @@ mseintr(void *arg) MOUSE_BUTTON1DOWN | MOUSE_BUTTON2DOWN, MOUSE_BUTTON1DOWN | MOUSE_BUTTON2DOWN | MOUSE_BUTTON3DOWN }; - mse_softc_t *sc = arg; int dx, dy, but; int sign; @@ -458,7 +526,7 @@ mseintr(void *arg) if ((sc->sc_flags & MSESC_OPEN) == 0) return; - (*sc->sc_getmouse)(sc->sc_iot, sc->sc_ioh, &dx, &dy, &but); + (*sc->sc_getmouse)(sc->sc_port, &dx, &dy, &but); if (sc->mode.accelfactor > 0) { sign = (dx < 0); dx = dx * dx / sc->mode.accelfactor; Modified: head/sys/dev/mse/mse_cbus.c ============================================================================== --- head/sys/dev/mse/mse_cbus.c Sat Oct 11 19:34:41 2014 (r272955) +++ head/sys/dev/mse/mse_cbus.c Sat Oct 11 19:36:59 2014 (r272956) @@ -91,12 +91,11 @@ static int mse_cbus_probe(device_t dev); static int mse_cbus_attach(device_t dev); -static int mse_cbus_detach(device_t dev); static device_method_t mse_methods[] = { DEVMETHOD(device_probe, mse_cbus_probe), DEVMETHOD(device_attach, mse_cbus_attach), - DEVMETHOD(device_detach, mse_cbus_detach), + DEVMETHOD(device_detach, mse_detach), { 0, 0 } }; @@ -136,10 +135,10 @@ static struct isa_pnp_id mse_ids[] = { static bus_addr_t mse_port[] = {0, 2, 4, 6}; static int mse_probe98m(device_t dev, mse_softc_t *sc); -static void mse_disable98m(bus_space_tag_t t, bus_space_handle_t h); -static void mse_get98m(bus_space_tag_t t, bus_space_handle_t h, +static void mse_disable98m(struct resource *port); +static void mse_get98m(struct resource *port, int *dx, int *dy, int *but); -static void mse_enable98m(bus_space_tag_t t, bus_space_handle_t h); +static void mse_enable98m(struct resource *port); static struct mse_types mse_types[] = { { MSE_98BUSMOUSE, @@ -173,8 +172,6 @@ mse_cbus_probe(device_t dev) bus_release_resource(dev, SYS_RES_IOPORT, rid, sc->sc_port); return ENXIO; } - sc->sc_iot = rman_get_bustag(sc->sc_port); - sc->sc_ioh = rman_get_bushandle(sc->sc_port); /* * Check for each mouse type in the table. @@ -216,33 +213,10 @@ mse_cbus_attach(device_t dev) bus_release_resource(dev, SYS_RES_IOPORT, rid, sc->sc_port); return ENXIO; } - sc->sc_iot = rman_get_bustag(sc->sc_port); - sc->sc_ioh = rman_get_bushandle(sc->sc_port); return (mse_common_attach(dev)); } -static int -mse_cbus_detach(device_t dev) -{ - mse_softc_t *sc; - int rid; - - sc = device_get_softc(dev); - if (sc->sc_flags & MSESC_OPEN) - return EBUSY; - - rid = 0; - BUS_TEARDOWN_INTR(device_get_parent(dev), dev, sc->sc_intr, sc->sc_ih); - bus_release_resource(dev, SYS_RES_IRQ, rid, sc->sc_intr); - bus_release_resource(dev, SYS_RES_IOPORT, rid, sc->sc_port); - - destroy_dev(sc->sc_dev); - destroy_dev(sc->sc_ndev); - - return 0; -} - /* * Routines for the PC98 bus mouse. */ @@ -255,15 +229,15 @@ static int mse_probe98m(device_t dev, mse_softc_t *sc) { /* mode set */ - bus_space_write_1(sc->sc_iot, sc->sc_ioh, MODE, 0x93); + bus_write_1(sc->sc_port, MODE, 0x93); /* initialize */ /* INT disable */ - bus_space_write_1(sc->sc_iot, sc->sc_ioh, INT, INT_DISABLE); + bus_write_1(sc->sc_port, INT, INT_DISABLE); /* HC = 0 */ - bus_space_write_1(sc->sc_iot, sc->sc_ioh, HC, HC_NO_CLEAR); + bus_write_1(sc->sc_port, HC, HC_NO_CLEAR); /* HC = 1 */ - bus_space_write_1(sc->sc_iot, sc->sc_ioh, HC, HC_CLEAR); + bus_write_1(sc->sc_port, HC, HC_CLEAR); return (1); } @@ -272,57 +246,56 @@ mse_probe98m(device_t dev, mse_softc_t * * Initialize PC98 bus mouse and enable interrupts. */ static void -mse_enable98m(bus_space_tag_t tag, bus_space_handle_t handle) +mse_enable98m(struct resource *port) { - bus_space_write_1(tag, handle, INT, INT_ENABLE); /* INT enable */ - bus_space_write_1(tag, handle, HC, HC_NO_CLEAR); /* HC = 0 */ - bus_space_write_1(tag, handle, HC, HC_CLEAR); /* HC = 1 */ + bus_write_1(port, INT, INT_ENABLE); /* INT enable */ + bus_write_1(port, HC, HC_NO_CLEAR); /* HC = 0 */ + bus_write_1(port, HC, HC_CLEAR); /* HC = 1 */ } /* * Disable interrupts for PC98 Bus mouse. */ static void -mse_disable98m(bus_space_tag_t tag, bus_space_handle_t handle) +mse_disable98m(struct resource *port) { - bus_space_write_1(tag, handle, INT, INT_DISABLE); /* INT disable */ - bus_space_write_1(tag, handle, HC, HC_NO_CLEAR); /* HC = 0 */ - bus_space_write_1(tag, handle, HC, HC_CLEAR); /* HC = 1 */ + bus_write_1(port, INT, INT_DISABLE); /* INT disable */ + bus_write_1(port, HC, HC_NO_CLEAR); /* HC = 0 */ + bus_write_1(port, HC, HC_CLEAR); /* HC = 1 */ } /* * Get current dx, dy and up/down button state. */ static void -mse_get98m(bus_space_tag_t tag, bus_space_handle_t handle, int *dx, int *dy, - int *but) +mse_get98m(struct resource *port, int *dx, int *dy, int *but) { register char x, y; - bus_space_write_1(tag, handle, INT, INT_DISABLE); /* INT disable */ + bus_write_1(port, INT, INT_DISABLE); /* INT disable */ - bus_space_write_1(tag, handle, HC, HC_CLEAR); /* HC = 1 */ + bus_write_1(port, HC, HC_CLEAR); /* HC = 1 */ /* X low */ - bus_space_write_1(tag, handle, MSE_PORTC, 0x90 | XL); - x = bus_space_read_1(tag, handle, MSE_PORTA) & 0x0f; + bus_write_1(port, MSE_PORTC, 0x90 | XL); + x = bus_read_1(port, MSE_PORTA) & 0x0f; /* X high */ - bus_space_write_1(tag, handle, MSE_PORTC, 0x90 | XH); - x |= ((bus_space_read_1(tag, handle, MSE_PORTA) & 0x0f) << 4); + bus_write_1(port, MSE_PORTC, 0x90 | XH); + x |= ((bus_read_1(port, MSE_PORTA) & 0x0f) << 4); /* Y low */ - bus_space_write_1(tag, handle, MSE_PORTC, 0x90 | YL); - y = (bus_space_read_1(tag, handle, MSE_PORTA) & 0x0f); + bus_write_1(port, MSE_PORTC, 0x90 | YL); + y = (bus_read_1(port, MSE_PORTA) & 0x0f); /* Y high */ - bus_space_write_1(tag, handle, MSE_PORTC, 0x90 | YH); - y |= ((bus_space_read_1(tag, handle, MSE_PORTA) & 0x0f) << 4); + bus_write_1(port, MSE_PORTC, 0x90 | YH); + y |= ((bus_read_1(port, MSE_PORTA) & 0x0f) << 4); - *but = (bus_space_read_1(tag, handle, MSE_PORTA) >> 5) & 7; + *but = (bus_read_1(port, MSE_PORTA) >> 5) & 7; *dx = x; *dy = y; - bus_space_write_1(tag, handle, HC, HC_NO_CLEAR); /* HC = 0 */ + bus_write_1(port, HC, HC_NO_CLEAR); /* HC = 0 */ - bus_space_write_1(tag, handle, INT, INT_ENABLE); /* INT enable */ + bus_write_1(port, INT, INT_ENABLE); /* INT enable */ } Modified: head/sys/dev/mse/mse_isa.c ============================================================================== --- head/sys/dev/mse/mse_isa.c Sat Oct 11 19:34:41 2014 (r272955) +++ head/sys/dev/mse/mse_isa.c Sat Oct 11 19:36:59 2014 (r272956) @@ -91,12 +91,11 @@ static int mse_isa_probe(device_t dev); static int mse_isa_attach(device_t dev); -static int mse_isa_detach(device_t dev); static device_method_t mse_methods[] = { DEVMETHOD(device_probe, mse_isa_probe), DEVMETHOD(device_attach, mse_isa_attach), - DEVMETHOD(device_detach, mse_isa_detach), + DEVMETHOD(device_detach, mse_detach), { 0, 0 } }; @@ -156,12 +155,10 @@ static struct isa_pnp_id mse_ids[] = { #define MSE_INTREN 0x00 static int mse_probelogi(device_t dev, mse_softc_t *sc); -static void mse_disablelogi(bus_space_tag_t t, - bus_space_handle_t h); -static void mse_getlogi(bus_space_tag_t t, bus_space_handle_t h, - int *dx, int *dy, int *but); -static void mse_enablelogi(bus_space_tag_t t, - bus_space_handle_t h); +static void mse_disablelogi(struct resource *port); +static void mse_getlogi(struct resource *port, int *dx, int *dy, + int *but); +static void mse_enablelogi(struct resource *port); /* * ATI Inport mouse definitions @@ -175,10 +172,10 @@ static void mse_enablelogi(bus_space_ta #define MSE_INPORT_INTREN 0x09 static int mse_probeati(device_t dev, mse_softc_t *sc); -static void mse_enableati(bus_space_tag_t t, bus_space_handle_t h); -static void mse_disableati(bus_space_tag_t t, bus_space_handle_t h); -static void mse_getati(bus_space_tag_t t, bus_space_handle_t h, - int *dx, int *dy, int *but); +static void mse_enableati(struct resource *port); +static void mse_disableati(struct resource *port); +static void mse_getati(struct resource *port, int *dx, int *dy, + int *but); static struct mse_types mse_types[] = { { MSE_ATIINPORT, @@ -213,8 +210,6 @@ mse_isa_probe(device_t dev) MSE_IOSIZE, RF_ACTIVE); if (sc->sc_port == NULL) return ENXIO; - sc->sc_iot = rman_get_bustag(sc->sc_port); - sc->sc_ioh = rman_get_bushandle(sc->sc_port); /* * Check for each mouse type in the table. @@ -252,33 +247,10 @@ mse_isa_attach(device_t dev) MSE_IOSIZE, RF_ACTIVE); if (sc->sc_port == NULL) return ENXIO; - sc->sc_iot = rman_get_bustag(sc->sc_port); - sc->sc_ioh = rman_get_bushandle(sc->sc_port); return (mse_common_attach(dev)); } -static int -mse_isa_detach(device_t dev) -{ - mse_softc_t *sc; - int rid; - - sc = device_get_softc(dev); - if (sc->sc_flags & MSESC_OPEN) - return EBUSY; - - rid = 0; - BUS_TEARDOWN_INTR(device_get_parent(dev), dev, sc->sc_intr, sc->sc_ih); - bus_release_resource(dev, SYS_RES_IRQ, rid, sc->sc_intr); - bus_release_resource(dev, SYS_RES_IOPORT, rid, sc->sc_port); - - destroy_dev(sc->sc_dev); - destroy_dev(sc->sc_ndev); - - return 0; -} - /* * Routines for the Logitech mouse. */ @@ -293,15 +265,14 @@ mse_probelogi(device_t dev, mse_softc_t int sig; - bus_space_write_1(sc->sc_iot, sc->sc_ioh, MSE_PORTD, MSE_SETUP); + bus_write_1(sc->sc_port, MSE_PORTD, MSE_SETUP); /* set the signature port */ - bus_space_write_1(sc->sc_iot, sc->sc_ioh, MSE_PORTB, MSE_LOGI_SIG); + bus_write_1(sc->sc_port, MSE_PORTB, MSE_LOGI_SIG); DELAY(30000); /* 30 ms delay */ - sig = bus_space_read_1(sc->sc_iot, sc->sc_ioh, MSE_PORTB) & 0xFF; + sig = bus_read_1(sc->sc_port, MSE_PORTB) & 0xFF; if (sig == MSE_LOGI_SIG) { - bus_space_write_1(sc->sc_iot, sc->sc_ioh, MSE_PORTC, - MSE_DISINTR); + bus_write_1(sc->sc_port, MSE_PORTC, MSE_DISINTR); return(1); } else { if (bootverbose) @@ -314,46 +285,45 @@ mse_probelogi(device_t dev, mse_softc_t * Initialize Logitech mouse and enable interrupts. */ static void -mse_enablelogi(bus_space_tag_t tag, bus_space_handle_t handle) +mse_enablelogi(struct resource *port) { int dx, dy, but; - bus_space_write_1(tag, handle, MSE_PORTD, MSE_SETUP); - mse_getlogi(tag, handle, &dx, &dy, &but); + bus_write_1(port, MSE_PORTD, MSE_SETUP); + mse_getlogi(port, &dx, &dy, &but); } /* * Disable interrupts for Logitech mouse. */ static void -mse_disablelogi(bus_space_tag_t tag, bus_space_handle_t handle) +mse_disablelogi(struct resource *port) { - bus_space_write_1(tag, handle, MSE_PORTC, MSE_DISINTR); + bus_write_1(port, MSE_PORTC, MSE_DISINTR); } /* * Get the current dx, dy and button up/down state. */ static void -mse_getlogi(bus_space_tag_t tag, bus_space_handle_t handle, int *dx, int *dy, - int *but) +mse_getlogi(struct resource *port, int *dx, int *dy, int *but) { register char x, y; - bus_space_write_1(tag, handle, MSE_PORTC, MSE_HOLD | MSE_RXLOW); - x = bus_space_read_1(tag, handle, MSE_PORTA); + bus_write_1(port, MSE_PORTC, MSE_HOLD | MSE_RXLOW); + x = bus_read_1(port, MSE_PORTA); *but = (x >> 5) & MOUSE_MSC_BUTTONS; x &= 0xf; - bus_space_write_1(tag, handle, MSE_PORTC, MSE_HOLD | MSE_RXHIGH); - x |= (bus_space_read_1(tag, handle, MSE_PORTA) << 4); - bus_space_write_1(tag, handle, MSE_PORTC, MSE_HOLD | MSE_RYLOW); - y = (bus_space_read_1(tag, handle, MSE_PORTA) & 0xf); - bus_space_write_1(tag, handle, MSE_PORTC, MSE_HOLD | MSE_RYHIGH); - y |= (bus_space_read_1(tag, handle, MSE_PORTA) << 4); + bus_write_1(port, MSE_PORTC, MSE_HOLD | MSE_RXHIGH); + x |= (bus_read_1(port, MSE_PORTA) << 4); + bus_write_1(port, MSE_PORTC, MSE_HOLD | MSE_RYLOW); + y = (bus_read_1(port, MSE_PORTA) & 0xf); + bus_write_1(port, MSE_PORTC, MSE_HOLD | MSE_RYHIGH); + y |= (bus_read_1(port, MSE_PORTA) << 4); *dx = x; *dy = y; - bus_space_write_1(tag, handle, MSE_PORTC, MSE_INTREN); + bus_write_1(port, MSE_PORTC, MSE_INTREN); } /* @@ -369,7 +339,7 @@ mse_probeati(device_t dev, mse_softc_t * int i; for (i = 0; i < 2; i++) - if (bus_space_read_1(sc->sc_iot, sc->sc_ioh, MSE_PORTC) == 0xde) + if (bus_read_1(sc->sc_port, MSE_PORTC) == 0xde) return (1); return (0); } @@ -378,44 +348,43 @@ mse_probeati(device_t dev, mse_softc_t * * Initialize ATI Inport mouse and enable interrupts. */ static void -mse_enableati(bus_space_tag_t tag, bus_space_handle_t handle) +mse_enableati(struct resource *port) { - bus_space_write_1(tag, handle, MSE_PORTA, MSE_INPORT_RESET); - bus_space_write_1(tag, handle, MSE_PORTA, MSE_INPORT_MODE); - bus_space_write_1(tag, handle, MSE_PORTB, MSE_INPORT_INTREN); + bus_write_1(port, MSE_PORTA, MSE_INPORT_RESET); + bus_write_1(port, MSE_PORTA, MSE_INPORT_MODE); + bus_write_1(port, MSE_PORTB, MSE_INPORT_INTREN); } /* * Disable interrupts for ATI Inport mouse. */ static void -mse_disableati(bus_space_tag_t tag, bus_space_handle_t handle) +mse_disableati(struct resource *port) { - bus_space_write_1(tag, handle, MSE_PORTA, MSE_INPORT_MODE); - bus_space_write_1(tag, handle, MSE_PORTB, 0); + bus_write_1(port, MSE_PORTA, MSE_INPORT_MODE); + bus_write_1(port, MSE_PORTB, 0); } /* * Get current dx, dy and up/down button state. */ static void -mse_getati(bus_space_tag_t tag, bus_space_handle_t handle, int *dx, int *dy, - int *but) +mse_getati(struct resource *port, int *dx, int *dy, int *but) { char byte; - bus_space_write_1(tag, handle, MSE_PORTA, MSE_INPORT_MODE); - bus_space_write_1(tag, handle, MSE_PORTB, MSE_INPORT_HOLD); - bus_space_write_1(tag, handle, MSE_PORTA, MSE_INPORT_STATUS); - *but = ~bus_space_read_1(tag, handle, MSE_PORTB) & MOUSE_MSC_BUTTONS; - bus_space_write_1(tag, handle, MSE_PORTA, MSE_INPORT_DX); - byte = bus_space_read_1(tag, handle, MSE_PORTB); + bus_write_1(port, MSE_PORTA, MSE_INPORT_MODE); + bus_write_1(port, MSE_PORTB, MSE_INPORT_HOLD); + bus_write_1(port, MSE_PORTA, MSE_INPORT_STATUS); + *but = ~bus_read_1(port, MSE_PORTB) & MOUSE_MSC_BUTTONS; + bus_write_1(port, MSE_PORTA, MSE_INPORT_DX); + byte = bus_read_1(port, MSE_PORTB); *dx = byte; - bus_space_write_1(tag, handle, MSE_PORTA, MSE_INPORT_DY); - byte = bus_space_read_1(tag, handle, MSE_PORTB); + bus_write_1(port, MSE_PORTA, MSE_INPORT_DY); + byte = bus_read_1(port, MSE_PORTB); *dy = byte; - bus_space_write_1(tag, handle, MSE_PORTA, MSE_INPORT_MODE); - bus_space_write_1(tag, handle, MSE_PORTB, MSE_INPORT_INTREN); + bus_write_1(port, MSE_PORTA, MSE_INPORT_MODE); + bus_write_1(port, MSE_PORTB, MSE_INPORT_INTREN); } Modified: head/sys/dev/mse/msevar.h ============================================================================== --- head/sys/dev/mse/msevar.h Sat Oct 11 19:34:41 2014 (r272955) +++ head/sys/dev/mse/msevar.h Sat Oct 11 19:36:59 2014 (r272956) @@ -46,7 +46,7 @@ /* * Software control structure for mouse. The sc_enablemouse(), - * sc_disablemouse() and sc_getmouse() routines must be called spl'd(). + * sc_disablemouse() and sc_getmouse() routines must be called locked. */ typedef struct mse_softc { int sc_flags; @@ -54,22 +54,19 @@ typedef struct mse_softc { struct selinfo sc_selp; struct resource *sc_port; struct resource *sc_intr; - bus_space_tag_t sc_iot; - bus_space_handle_t sc_ioh; void *sc_ih; - void (*sc_enablemouse)(bus_space_tag_t t, - bus_space_handle_t h); - void (*sc_disablemouse)(bus_space_tag_t t, - bus_space_handle_t h); - void (*sc_getmouse)(bus_space_tag_t t, bus_space_handle_t h, - int *dx, int *dy, int *but); + void (*sc_enablemouse)(struct resource *port); + void (*sc_disablemouse)(struct resource *port); + void (*sc_getmouse)(struct resource *port, int *dx, int *dy, + int *but); int sc_deltax; int sc_deltay; int sc_obuttons; int sc_buttons; int sc_bytesread; u_char sc_bytes[MOUSE_SYS_PACKETSIZE]; - struct callout_handle sc_callout; + struct callout sc_callout; + struct mtx sc_lock; int sc_watchdog; struct cdev *sc_dev; struct cdev *sc_ndev; @@ -78,9 +75,14 @@ typedef struct mse_softc { mousestatus_t status; } mse_softc_t; +#define MSE_LOCK(sc) mtx_lock(&(sc)->sc_lock) +#define MSE_UNLOCK(sc) mtx_unlock(&(sc)->sc_lock) +#define MSE_ASSERT_LOCKED(sc) mtx_assert(&(sc)->sc_lock, MA_OWNED) + /* Flags */ #define MSESC_OPEN 0x1 #define MSESC_WANT 0x2 +#define MSESC_READING 0x4 /* and Mouse Types */ #define MSE_NONE 0 /* don't move this! */ @@ -110,12 +112,11 @@ struct mse_types { int m_type; /* Type of bus mouse */ int (*m_probe)(device_t dev, mse_softc_t *sc); /* Probe routine to test for it */ - void (*m_enable)(bus_space_tag_t t, bus_space_handle_t h); + void (*m_enable)(struct resource *port); /* Start routine */ - void (*m_disable)(bus_space_tag_t t, bus_space_handle_t h); + void (*m_disable)(struct resource *port); /* Disable interrupts routine */ - void (*m_get)(bus_space_tag_t t, bus_space_handle_t h, int *dx, - int *dy, int *but); + void (*m_get)(struct resource *port, int *dx, int *dy, int *but); /* and get mouse status */ mousehw_t m_hw; /* buttons iftype type model hwid */ mousemode_t m_mode; /* proto rate res accel level size mask */ @@ -123,3 +124,4 @@ struct mse_types { extern devclass_t mse_devclass; int mse_common_attach(device_t); +int mse_detach(device_t); From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 19:37:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 74CE29D; Sat, 11 Oct 2014 19:37:18 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CD00EA1; Sat, 11 Oct 2014 19:37:18 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-70-85-31.nwrknj.fios.verizon.net [173.70.85.31]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 537C1B985; Sat, 11 Oct 2014 15:37:17 -0400 (EDT) From: John Baldwin To: "Alexander V. Chernikov" Subject: Re: svn commit: r272840 - in head: sbin/ipfw sys/conf sys/modules/ipfw sys/netgraph sys/netinet sys/netpfil/ipfw Date: Sat, 11 Oct 2014 12:13:19 -0400 Message-ID: <6784482.tcpsbB2Pkh@ralph.baldwin.cx> User-Agent: KMail/4.12.5 (FreeBSD/10.1-BETA2; KDE/4.12.5; amd64; ; ) In-Reply-To: <201410091932.s99JWaSc065624@svn.freebsd.org> References: <201410091932.s99JWaSc065624@svn.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Sat, 11 Oct 2014 15:37:17 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 19:37:18 -0000 On Thursday, October 09, 2014 07:32:36 PM Alexander V. Chernikov wrote: > Author: melifaro > Date: Thu Oct 9 19:32:35 2014 > New Revision: 272840 > URL: https://svnweb.freebsd.org/changeset/base/272840 > > Log: > Merge projects/ipfw to HEAD. Should it now say 'ipfw3' in dmesg instead of ipfw2? Also, should the associated filenames (ipfw2.* and ip_fw2.*) be renamed? (Perhaps back to just ipfw.* and ip_fw.* to avoid more rototill in the future?) -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 20:14:56 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 20FB5E8E; Sat, 11 Oct 2014 20:14:56 +0000 (UTC) Received: from mail.ipfw.ru (mail.ipfw.ru [IPv6:2a01:4f8:120:6141::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D5B9127E; Sat, 11 Oct 2014 20:14:55 +0000 (UTC) Received: from secured.by.ipfw.ru ([95.143.220.47] helo=[10.0.0.120]) by mail.ipfw.ru with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.82 (FreeBSD)) (envelope-from ) id 1Xcz4P-000CUF-Jf; Sat, 11 Oct 2014 19:59:01 +0400 Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r272840 - in head: sbin/ipfw sys/conf sys/modules/ipfw sys/netgraph sys/netinet sys/netpfil/ipfw From: "Alexander V. Chernikov" In-Reply-To: <6784482.tcpsbB2Pkh@ralph.baldwin.cx> Date: Sun, 12 Oct 2014 00:14:51 +0400 Content-Transfer-Encoding: quoted-printable Message-Id: <5A09F093-EC19-4E02-8930-224D8CC08D31@ipfw.ru> References: <201410091932.s99JWaSc065624@svn.freebsd.org> <6784482.tcpsbB2Pkh@ralph.baldwin.cx> To: John Baldwin X-Mailer: Apple Mail (2.1878.6) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, "Alexander V. Chernikov" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 20:14:56 -0000 On 11 Oct 2014, at 20:13, John Baldwin wrote: > On Thursday, October 09, 2014 07:32:36 PM Alexander V. Chernikov = wrote: >> Author: melifaro >> Date: Thu Oct 9 19:32:35 2014 >> New Revision: 272840 >> URL: https://svnweb.freebsd.org/changeset/base/272840 >>=20 >> Log: >> Merge projects/ipfw to HEAD. >=20 > Should it now say 'ipfw3' in dmesg instead of ipfw2? Also, should the=20= I=92m not sure all these changes are worth renaming ipfw2 to ipfw3 :) > associated filenames (ipfw2.* and ip_fw2.*) be renamed? (Perhaps back > to just ipfw.* and ip_fw.* to avoid more rototill in the future?) >=20 > --=20 > John Baldwin >=20 From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 20:25:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6FF56265; Sat, 11 Oct 2014 20:25:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5C4E937B; Sat, 11 Oct 2014 20:25:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9BKPNDw069291; Sat, 11 Oct 2014 20:25:23 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9BKPKHn069277; Sat, 11 Oct 2014 20:25:20 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201410112025.s9BKPKHn069277@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 11 Oct 2014 20:25:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272958 - head/sys/ddb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 20:25:23 -0000 Author: pfg Date: Sat Oct 11 20:25:19 2014 New Revision: 272958 URL: https://svnweb.freebsd.org/changeset/base/272958 Log: ddb: space/tab fixes. No functional change. MFC after: 3 days Modified: head/sys/ddb/db_break.c head/sys/ddb/db_command.c head/sys/ddb/db_output.h head/sys/ddb/db_print.c head/sys/ddb/db_ps.c head/sys/ddb/db_run.c head/sys/ddb/db_sym.h head/sys/ddb/db_textdump.c head/sys/ddb/db_variables.h head/sys/ddb/db_watch.c head/sys/ddb/db_watch.h Modified: head/sys/ddb/db_break.c ============================================================================== --- head/sys/ddb/db_break.c Sat Oct 11 19:38:29 2014 (r272957) +++ head/sys/ddb/db_break.c Sat Oct 11 20:25:19 2014 (r272958) @@ -161,13 +161,13 @@ db_breakpoint_t db_find_breakpoint_here(addr) db_addr_t addr; { - return db_find_breakpoint(db_map_addr(addr), addr); + return db_find_breakpoint(db_map_addr(addr), addr); } static boolean_t db_breakpoints_inserted = TRUE; #ifndef BKPT_WRITE -#define BKPT_WRITE(addr, storage) \ +#define BKPT_WRITE(addr, storage) \ do { \ *storage = db_get_value(addr, BKPT_SIZE, FALSE); \ db_put_value(addr, BKPT_SIZE, BKPT_SET(*storage)); \ @@ -175,7 +175,7 @@ do { \ #endif #ifndef BKPT_CLEAR -#define BKPT_CLEAR(addr, storage) \ +#define BKPT_CLEAR(addr, storage) \ db_put_value(addr, BKPT_SIZE, *storage) #endif Modified: head/sys/ddb/db_command.c ============================================================================== --- head/sys/ddb/db_command.c Sat Oct 11 19:38:29 2014 (r272957) +++ head/sys/ddb/db_command.c Sat Oct 11 20:25:19 2014 (r272958) @@ -648,7 +648,7 @@ db_kill(dummy1, dummy2, dummy3, dummy4) db_expr_t old_radix, pid, sig; struct proc *p; -#define DB_ERROR(f) do { db_printf f; db_flush_lex(); goto out; } while (0) +#define DB_ERROR(f) do { db_printf f; db_flush_lex(); goto out; } while (0) /* * PIDs and signal numbers are typically represented in base Modified: head/sys/ddb/db_output.h ============================================================================== --- head/sys/ddb/db_output.h Sat Oct 11 19:38:29 2014 (r272957) +++ head/sys/ddb/db_output.h Sat Oct 11 20:25:19 2014 (r272958) @@ -30,7 +30,7 @@ #define _DDB_DB_OUTPUT_H_ /* - * Author: David B. Golub, Carnegie Mellon University + * Author: David B. Golub, Carnegie Mellon University * Date: 8/90 */ Modified: head/sys/ddb/db_print.c ============================================================================== --- head/sys/ddb/db_print.c Sat Oct 11 19:38:29 2014 (r272957) +++ head/sys/ddb/db_print.c Sat Oct 11 20:25:19 2014 (r272958) @@ -25,7 +25,7 @@ * */ /* - * Author: David B. Golub, Carnegie Mellon University + * Author: David B. Golub, Carnegie Mellon University * Date: 7/90 */ Modified: head/sys/ddb/db_ps.c ============================================================================== --- head/sys/ddb/db_ps.c Sat Oct 11 19:38:29 2014 (r272957) +++ head/sys/ddb/db_ps.c Sat Oct 11 20:25:19 2014 (r272958) @@ -155,7 +155,7 @@ db_ps(db_expr_t addr, boolean_t hasaddr, else if (wflag) state[0] = 'W'; else - state[0] = '?'; + state[0] = '?'; } break; case PRS_NEW: @@ -211,7 +211,7 @@ db_ps(db_expr_t addr, boolean_t hasaddr, p = LIST_NEXT(p, p_list); if (p == NULL && np > 0) p = LIST_FIRST(&zombproc); - } + } } static void Modified: head/sys/ddb/db_run.c ============================================================================== --- head/sys/ddb/db_run.c Sat Oct 11 19:38:29 2014 (r272957) +++ head/sys/ddb/db_run.c Sat Oct 11 20:25:19 2014 (r272958) @@ -54,7 +54,7 @@ static int db_run_mode; #define STEP_RETURN 2 #define STEP_CALLT 3 #define STEP_CONTINUE 4 -#define STEP_INVISIBLE 5 +#define STEP_INVISIBLE 5 #define STEP_COUNT 6 static boolean_t db_sstep_print; Modified: head/sys/ddb/db_sym.h ============================================================================== --- head/sys/ddb/db_sym.h Sat Oct 11 19:38:29 2014 (r272957) +++ head/sys/ddb/db_sym.h Sat Oct 11 20:25:19 2014 (r272958) @@ -30,7 +30,7 @@ #define _DDB_DB_SYM_H_ /* - * Author: Alessandro Forin, Carnegie Mellon University + * Author: Alessandro Forin, Carnegie Mellon University * Date: 8/90 */ Modified: head/sys/ddb/db_textdump.c ============================================================================== --- head/sys/ddb/db_textdump.c Sat Oct 11 19:38:29 2014 (r272957) +++ head/sys/ddb/db_textdump.c Sat Oct 11 20:25:19 2014 (r272958) @@ -348,8 +348,8 @@ textdump_dump_msgbuf(struct dumperinfo * */ total_len = 0; offset = 0; - msgbuf_peekbytes(msgbufp, NULL, 0, &seq); - while ((len = msgbuf_peekbytes(msgbufp, buf, sizeof(buf), &seq)) > 0) { + msgbuf_peekbytes(msgbufp, NULL, 0, &seq); + while ((len = msgbuf_peekbytes(msgbufp, buf, sizeof(buf), &seq)) > 0) { for (i = 0; i < len; i++) { if (buf[i] == '\0') continue; @@ -362,7 +362,7 @@ textdump_dump_msgbuf(struct dumperinfo * total_len += offset; offset = 0; } - } + } total_len += offset; /* Without the zero-padding. */ if (offset != 0) { bzero(textdump_block_buffer + offset, Modified: head/sys/ddb/db_variables.h ============================================================================== --- head/sys/ddb/db_variables.h Sat Oct 11 19:38:29 2014 (r272957) +++ head/sys/ddb/db_variables.h Sat Oct 11 20:25:19 2014 (r272958) @@ -27,7 +27,7 @@ */ /* - * Author: David B. Golub, Carnegie Mellon University + * Author: David B. Golub, Carnegie Mellon University * Date: 7/90 */ Modified: head/sys/ddb/db_watch.c ============================================================================== --- head/sys/ddb/db_watch.c Sat Oct 11 19:38:29 2014 (r272957) +++ head/sys/ddb/db_watch.c Sat Oct 11 20:25:19 2014 (r272958) @@ -303,8 +303,8 @@ db_deletehwatch_cmd(addr, have_addr, cou { int rc; - if (count < 0) - count = 4; + if (count < 0) + count = 4; rc = db_md_clr_watchpoint(addr, count); if (rc < 0) @@ -322,8 +322,8 @@ db_hwatchpoint_cmd(addr, have_addr, coun { int rc; - if (count < 0) - count = 4; + if (count < 0) + count = 4; rc = db_md_set_watchpoint(addr, count); if (rc < 0) Modified: head/sys/ddb/db_watch.h ============================================================================== --- head/sys/ddb/db_watch.h Sat Oct 11 19:38:29 2014 (r272957) +++ head/sys/ddb/db_watch.h Sat Oct 11 20:25:19 2014 (r272958) @@ -27,7 +27,7 @@ */ /* - * Author: David B. Golub, Carnegie Mellon University + * Author: David B. Golub, Carnegie Mellon University * Date: 10/90 */ From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 20:28:05 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CF6983C4; Sat, 11 Oct 2014 20:28:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B11B0388; Sat, 11 Oct 2014 20:28:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9BKS54A069651; Sat, 11 Oct 2014 20:28:05 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9BKS5E7069649; Sat, 11 Oct 2014 20:28:05 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201410112028.s9BKS5E7069649@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 11 Oct 2014 20:28:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272959 - in head/etc: defaults rc.d X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 20:28:06 -0000 Author: hrs Date: Sat Oct 11 20:28:04 2014 New Revision: 272959 URL: https://svnweb.freebsd.org/changeset/base/272959 Log: Rename s/network/netif/ and set netif_enable for namespace consistency. Modified: head/etc/defaults/rc.conf head/etc/rc.d/netif Modified: head/etc/defaults/rc.conf ============================================================================== --- head/etc/defaults/rc.conf Sat Oct 11 20:25:19 2014 (r272958) +++ head/etc/defaults/rc.conf Sat Oct 11 20:28:04 2014 (r272959) @@ -110,6 +110,7 @@ synchronous_dhclient="NO" # Start dhclie # interfaces during startup. defaultroute_delay="30" # Time to wait for a default route on a DHCP interface. defaultroute_carrier_delay="5" # Time to wait for carrier while waiting for a default route. +netif_enable="YES" # Set to YES to initialize network interfaces netif_ipexpand_max="2048" # Maximum number of IP addrs in a range spec. wpa_supplicant_program="/usr/sbin/wpa_supplicant" wpa_supplicant_flags="-s" # Extra flags to pass to wpa_supplicant Modified: head/etc/rc.d/netif ============================================================================== --- head/etc/rc.d/netif Sat Oct 11 20:25:19 2014 (r272958) +++ head/etc/rc.d/netif Sat Oct 11 20:28:04 2014 (r272959) @@ -33,9 +33,10 @@ . /etc/rc.subr . /etc/network.subr -name="network" -start_cmd="network_start" -stop_cmd="network_stop" +name="netif" +rcvar="${name}_enable" +start_cmd="netif_start" +stop_cmd="netif_stop" cloneup_cmd="clone_up" clonedown_cmd="clone_down" clear_cmd="doclear" @@ -47,7 +48,7 @@ cmdifn= set_rcvar_obsolete ipv6_enable ipv6_activate_all_interfaces set_rcvar_obsolete ipv6_prefer -network_start() +netif_start() { local _if @@ -71,7 +72,7 @@ network_start() ifnet_rename $cmdifn # Configure the interface(s). - network_common ifn_start $cmdifn + netif_common ifn_start $cmdifn if [ -f /etc/rc.d/ipfilter ] ; then # Resync ipfilter @@ -87,19 +88,19 @@ network_start() fi } -network_stop() +netif_stop() { _clone_down=1 - network_stop0 $* + netif_stop0 $* } doclear() { _clone_down= - network_stop0 $* + netif_stop0 $* } -network_stop0() +netif_stop0() { local _if @@ -108,7 +109,7 @@ network_stop0() cmdifn=$* # Deconfigure the interface(s) - network_common ifn_stop $cmdifn + netif_common ifn_stop $cmdifn # Destroy cloned interfaces if [ -n "$_clone_down" ]; then @@ -126,28 +127,28 @@ vnet_up() { cmdifn=$* - network_common ifn_vnetup $cmdifn + netif_common ifn_vnetup $cmdifn } vnet_down() { cmdifn=$* - network_common ifn_vnetdown $cmdifn + netif_common ifn_vnetdown $cmdifn } -# network_common routine +# netif_common routine # Common configuration subroutine for network interfaces. This # routine takes all the preparatory steps needed for configuriing # an interface and then calls $routine. -network_common() +netif_common() { local _cooked_list _tmp_list _fail _func _ok _str _cmdifn _func= if [ -z "$1" ]; then - err 1 "network_common(): No function name specified." + err 1 "netif_common(): No function name specified." else _func="$1" shift From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 20:46:07 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 91D89805; Sat, 11 Oct 2014 20:46:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F15075F; Sat, 11 Oct 2014 20:46:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9BKk72X078820; Sat, 11 Oct 2014 20:46:07 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9BKk7Hq078819; Sat, 11 Oct 2014 20:46:07 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201410112046.s9BKk7Hq078819@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 11 Oct 2014 20:46:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272961 - head/usr.sbin/rtsold X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 20:46:07 -0000 Author: hrs Date: Sat Oct 11 20:46:06 2014 New Revision: 272961 URL: https://svnweb.freebsd.org/changeset/base/272961 Log: Fix buffer overrun. MFC after: 1 day Modified: head/usr.sbin/rtsold/rtsol.c Modified: head/usr.sbin/rtsold/rtsol.c ============================================================================== --- head/usr.sbin/rtsold/rtsol.c Sat Oct 11 20:35:36 2014 (r272960) +++ head/usr.sbin/rtsold/rtsol.c Sat Oct 11 20:46:06 2014 (r272961) @@ -933,7 +933,8 @@ dname_labeldec(char *dst, size_t dlen, c dst_origin = dst; memset(dst, '\0', dlen); while (src && (len = (uint8_t)(*src++) & 0x3f) && - (src + len) <= src_last) { + (src + len) <= src_last && + (dst - dst_origin < (ssize_t)dlen)) { if (dst != dst_origin) *dst++ = '.'; warnmsg(LOG_DEBUG, __func__, "labellen = %zd", len); From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 21:43:06 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F36F819E; Sat, 11 Oct 2014 21:43:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DFABDC0B; Sat, 11 Oct 2014 21:43:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9BLh5BJ006726; Sat, 11 Oct 2014 21:43:05 GMT (envelope-from gnn@FreeBSD.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9BLh5uT006725; Sat, 11 Oct 2014 21:43:05 GMT (envelope-from gnn@FreeBSD.org) Message-Id: <201410112143.s9BLh5uT006725@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gnn set sender to gnn@FreeBSD.org using -f From: "George V. Neville-Neil" Date: Sat, 11 Oct 2014 21:43:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272962 - head/tools/tools/netmap X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 21:43:06 -0000 Author: gnn Date: Sat Oct 11 21:43:05 2014 New Revision: 272962 URL: https://svnweb.freebsd.org/changeset/base/272962 Log: Add a new option, -P, to pkt-gen which reads a single packet from a stored pcap file and transmits it instead of the default UDP packet. Reviewed by: luigi MFC after: 2 weeks Modified: head/tools/tools/netmap/pkt-gen.c Modified: head/tools/tools/netmap/pkt-gen.c ============================================================================== --- head/tools/tools/netmap/pkt-gen.c Sat Oct 11 20:46:06 2014 (r272961) +++ head/tools/tools/netmap/pkt-gen.c Sat Oct 11 21:43:05 2014 (r272962) @@ -202,6 +202,7 @@ struct glob_arg { int dummy_send; int virt_header; /* send also the virt_header */ int extra_bufs; /* goes in nr_arg3 */ + char *packet_file; /* -P option */ }; enum dev_type { DEV_NONE, DEV_NETMAP, DEV_PCAP, DEV_TAP }; @@ -224,6 +225,7 @@ struct targ { int affinity; struct pkt pkt; + void *frame; }; @@ -613,6 +615,28 @@ initialize_packet(struct targ *targ) indirect_payload : default_payload; int i, l0 = strlen(payload); + char errbuf[PCAP_ERRBUF_SIZE]; + pcap_t *file; + struct pcap_pkthdr *header; + const unsigned char *packet; + + /* Read a packet from a PCAP file if asked. */ + if (targ->g->packet_file != NULL) { + if ((file = pcap_open_offline(targ->g->packet_file, + errbuf)) == NULL) + D("failed to open pcap file %s", + targ->g->packet_file); + if (pcap_next_ex(file, &header, &packet) < 0) + D("failed to read packet from %s", + targ->g->packet_file); + if ((targ->frame = malloc(header->caplen)) == NULL) + D("out of memory"); + bcopy(packet, (unsigned char *)targ->frame, header->caplen); + targ->g->pkt_size = header->caplen; + pcap_close(file); + return; + } + /* create a nice NUL-terminated string */ for (i = 0; i < paylen; i += l0) { if (l0 > paylen - i) @@ -783,7 +807,6 @@ pinger_body(void *data) frame += sizeof(targ->pkt.vh) - targ->g->virt_header; size = targ->g->pkt_size + targ->g->virt_header; - if (targ->g->nthreads > 1) { D("can only ping with 1 thread"); return NULL; @@ -1038,10 +1061,15 @@ sender_body(void *data) void *frame; int size; - frame = pkt; - frame += sizeof(pkt->vh) - targ->g->virt_header; - size = targ->g->pkt_size + targ->g->virt_header; - + if (targ->frame == NULL) { + frame = pkt; + frame += sizeof(pkt->vh) - targ->g->virt_header; + size = targ->g->pkt_size + targ->g->virt_header; + } else { + frame = targ->frame; + size = targ->g->pkt_size; + } + D("start, fd %d main_fd %d", targ->fd, targ->g->main_fd); if (setaffinity(targ->thread, targ->affinity)) goto quit; @@ -1366,6 +1394,7 @@ usage(void) "\t-R rate in packets per second\n" "\t-X dump payload\n" "\t-H len add empty virtio-net-header with size 'len'\n" + "\t-P file load packet from pcap file" "", cmd); @@ -1638,7 +1667,7 @@ main(int arc, char **argv) g.virt_header = 0; while ( (ch = getopt(arc, argv, - "a:f:F:n:i:Il:d:s:D:S:b:c:o:p:T:w:WvR:XC:H:e:m:")) != -1) { + "a:f:F:n:i:Il:d:s:D:S:b:c:o:p:T:w:WvR:XC:H:e:m:P:")) != -1) { struct sf *fn; switch(ch) { @@ -1781,7 +1810,11 @@ main(int arc, char **argv) D("unrecognized monitor mode %s", optarg); } break; + case 'P': + g.packet_file = strdup(optarg); + break; } + } if (g.ifname == NULL) { From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 21:53:07 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2129A3E9; Sat, 11 Oct 2014 21:53:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D612CCF; Sat, 11 Oct 2014 21:53:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9BLr6bp011419; Sat, 11 Oct 2014 21:53:06 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9BLr6gp011418; Sat, 11 Oct 2014 21:53:06 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201410112153.s9BLr6gp011418@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sat, 11 Oct 2014 21:53:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272963 - head/usr.sbin/pstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 21:53:07 -0000 Author: jilles Date: Sat Oct 11 21:53:06 2014 New Revision: 272963 URL: https://svnweb.freebsd.org/changeset/base/272963 Log: pstat(8): Correct description of the SESS column in pstat -t. MFC after: 1 week Modified: head/usr.sbin/pstat/pstat.8 Modified: head/usr.sbin/pstat/pstat.8 ============================================================================== --- head/usr.sbin/pstat/pstat.8 Sat Oct 11 21:43:05 2014 (r272962) +++ head/usr.sbin/pstat/pstat.8 Sat Oct 11 21:53:06 2014 (r272963) @@ -35,7 +35,7 @@ .\" @(#)pstat.8 8.5 (Berkeley) 5/13/94 .\" $FreeBSD$ .\" -.Dd August 20, 2008 +.Dd October 11, 2014 .Dt PSTAT 8 .Os .Sh NAME @@ -170,7 +170,7 @@ Low water mark for output. .It COL Calculated column position of terminal. .It SESS -Kernel address of the session structure. +Process ID of the session leader. .It PGID Process group for which this is the controlling terminal. .It STATE From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 23:08:01 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ADE5CB8A; Sat, 11 Oct 2014 23:08:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9A748363; Sat, 11 Oct 2014 23:08:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9BN811i046123; Sat, 11 Oct 2014 23:08:01 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9BN81W5046122; Sat, 11 Oct 2014 23:08:01 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201410112308.s9BN81W5046122@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 11 Oct 2014 23:08:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272971 - head/usr.sbin/rtadvd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 23:08:01 -0000 Author: hrs Date: Sat Oct 11 23:08:00 2014 New Revision: 272971 URL: https://svnweb.freebsd.org/changeset/base/272971 Log: Fix off-by-one. MFC after: 1 day Modified: head/usr.sbin/rtadvd/advcap.c Modified: head/usr.sbin/rtadvd/advcap.c ============================================================================== --- head/usr.sbin/rtadvd/advcap.c Sat Oct 11 23:02:03 2014 (r272970) +++ head/usr.sbin/rtadvd/advcap.c Sat Oct 11 23:08:00 2014 (r272971) @@ -149,9 +149,9 @@ getent(char *bp, char *name, const char } break; } - if (cp >= bp + BUFSIZ) { + if (cp >= bp + BUFSIZ - 1) { write(STDERR_FILENO, "Remcap entry too long\n", - 23); + 22); break; } else *cp++ = c; From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 23:24:10 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B2964E56; Sat, 11 Oct 2014 23:24:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 851316D8; Sat, 11 Oct 2014 23:24:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9BNOAxA055043; Sat, 11 Oct 2014 23:24:10 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9BNOAPQ055042; Sat, 11 Oct 2014 23:24:10 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201410112324.s9BNOAPQ055042@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 11 Oct 2014 23:24:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272972 - head/usr.sbin/rtadvd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 23:24:10 -0000 Author: hrs Date: Sat Oct 11 23:24:09 2014 New Revision: 272972 URL: https://svnweb.freebsd.org/changeset/base/272972 Log: Check buffer length more strictly. MFC after: 1 day Modified: head/usr.sbin/rtadvd/config.c Modified: head/usr.sbin/rtadvd/config.c ============================================================================== --- head/usr.sbin/rtadvd/config.c Sat Oct 11 23:08:00 2014 (r272971) +++ head/usr.sbin/rtadvd/config.c Sat Oct 11 23:24:09 2014 (r272972) @@ -77,10 +77,10 @@ static time_t prefix_timo = (60 * 120); static struct rtadvd_timer *prefix_timeout(void *); static void makeentry(char *, size_t, int, const char *); -static size_t dname_labelenc(char *, const char *); +static ssize_t dname_labelenc(char *, const char *); /* Encode domain name label encoding in RFC 1035 Section 3.1 */ -static size_t +static ssize_t dname_labelenc(char *dst, const char *src) { char *dst_origin; @@ -90,6 +90,8 @@ dname_labelenc(char *dst, const char *sr dst_origin = dst; len = strlen(src); + if (len + len / 64 + 1 + 1 > DNAME_LABELENC_MAXLEN) + return (-1); /* Length fields per 63 octets + '\0' (<= DNAME_LABELENC_MAXLEN) */ memset(dst, 0, len + len / 64 + 1 + 1); @@ -98,9 +100,13 @@ dname_labelenc(char *dst, const char *sr /* Put a length field with 63 octet limitation first. */ p = strchr(src, '.'); if (p == NULL) - *dst++ = len = MIN(63, len); + *dst = len = MIN(63, len); + else + *dst = len = MIN(63, p - src); + if (dst + 1 + len < dst_origin + DNAME_LABELENC_MAXLEN) + dst++; else - *dst++ = len = MIN(63, p - src); + return (-1); /* Copy 63 octets at most. */ memcpy(dst, src, len); dst += len; @@ -866,6 +872,11 @@ getconfig_free_rdn: abuf[c] = '\0'; ELM_MALLOC(dnsa, goto getconfig_free_dns); dnsa->da_len = dname_labelenc(dnsa->da_dom, abuf); + if (dnsa->da_len < 0) { + syslog(LOG_ERR, "Invalid dnssl entry: %s", + abuf); + goto getconfig_free_dns; + } syslog(LOG_DEBUG, "<%s>: dnsa->da_len = %d", __func__, dnsa->da_len); TAILQ_INSERT_TAIL(&dns->dn_list, dnsa, da_next); From owner-svn-src-head@FreeBSD.ORG Sat Oct 11 23:49:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A71CC336; Sat, 11 Oct 2014 23:49:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 933B28F7; Sat, 11 Oct 2014 23:49:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9BNnSSM065111; Sat, 11 Oct 2014 23:49:28 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9BNnSXc065105; Sat, 11 Oct 2014 23:49:28 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201410112349.s9BNnSXc065105@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 11 Oct 2014 23:49:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272974 - in head: etc share/man/man8 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2014 23:49:28 -0000 Author: hrs Date: Sat Oct 11 23:49:27 2014 New Revision: 272974 URL: https://svnweb.freebsd.org/changeset/base/272974 Log: Add ${name}_env and ${name}_prepend. ${name}_env is an argument list which will be passed to env(1). ${name}_prepend is simply prepended to the command line for $command. Modified: head/etc/rc.subr head/share/man/man8/rc.subr.8 Modified: head/etc/rc.subr ============================================================================== --- head/etc/rc.subr Sat Oct 11 23:31:44 2014 (r272973) +++ head/etc/rc.subr Sat Oct 11 23:49:27 2014 (r272974) @@ -749,6 +749,8 @@ check_startmsgs() # NOTE: $flags from the parent environment # can be used to override this. # +# ${name}_env n Environment variables to run ${command} with. +# # ${name}_fib n Routing table number to run ${command} with. # # ${name}_nice n Nice level to run ${command} at. @@ -764,6 +766,8 @@ check_startmsgs() # to run the chrooted ${command} with. # Requires /usr to be mounted. # +# ${name}_prepend n Command added before ${command}. +# # ${rc_arg}_cmd n If set, use this as the method when invoked; # Otherwise, use default command (see below) # @@ -937,7 +941,8 @@ run_rc_command() eval _chdir=\$${name}_chdir _chroot=\$${name}_chroot \ _nice=\$${name}_nice _user=\$${name}_user \ _group=\$${name}_group _groups=\$${name}_groups \ - _fib=\$${name}_fib + _fib=\$${name}_fib _env=\$${name}_env \ + _prepend=\$${name}_prepend if [ -n "$_user" ]; then # unset $_user if running as that user if [ "$_user" = "$(eval $IDCMD)" ]; then @@ -1022,12 +1027,14 @@ run_rc_command() _doit="\ ${_nice:+nice -n $_nice }\ ${_fib:+setfib -F $_fib }\ +${_env:+env $_env }\ chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\ $_chroot $command $rc_flags $command_args" else _doit="\ ${_chdir:+cd $_chdir && }\ ${_fib:+setfib -F $_fib }\ +${_env:+env $_env }\ $command $rc_flags $command_args" if [ -n "$_user" ]; then _doit="su -m $_user -c 'sh -c \"$_doit\"'" @@ -1038,6 +1045,9 @@ $command $rc_flags $command_args" fi _doit="nice -n $_nice $_doit" fi + if [ -n "$_prepend" ]; then + _doit="$_prepend $_doit" + fi fi # run the full command Modified: head/share/man/man8/rc.subr.8 ============================================================================== --- head/share/man/man8/rc.subr.8 Sat Oct 11 23:31:44 2014 (r272973) +++ head/share/man/man8/rc.subr.8 Sat Oct 11 23:49:27 2014 (r272974) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 23, 2012 +.Dd October 12, 2014 .Dt RC.SUBR 8 .Os .Sh NAME @@ -568,6 +568,22 @@ to before running Only supported after .Pa /usr is mounted. +.It Va ${name}_env +A list of environment variables to run +.Va command +with. +This will be passed as arguments to +.Xr env 1 +utility. +.It Va ${name}_fib +FIB +.Pa Routing Table +number to run +.Va command +with. +See +.Xr setfib 1 +for more details. .It Va ${name}_flags Arguments to call .Va command @@ -622,6 +638,14 @@ as. Comma separated list of supplementary groups to run the chrooted .Va command with. +.It Va ${name}_prepend +Commands to be prepended to +.Va command . +This is a generic version of +.Va ${name}_env , +.Va ${name}_fib , +or +.Va ${name}_nice . .It Ar argument Ns Va _cmd Shell commands which override the default method for .Ar argument .