From owner-svn-src-head@FreeBSD.ORG Sun Jul 29 00:44:41 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BC551106566C; Sun, 29 Jul 2012 00:44:41 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A7F488FC0A; Sun, 29 Jul 2012 00:44:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6T0if5c089313; Sun, 29 Jul 2012 00:44:41 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6T0iflC089310; Sun, 29 Jul 2012 00:44:41 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201207290044.q6T0iflC089310@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 29 Jul 2012 00:44:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238877 - head/sys/netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 29 Jul 2012 00:44:41 -0000 Author: bz Date: Sun Jul 29 00:44:41 2012 New Revision: 238877 URL: http://svn.freebsd.org/changeset/base/238877 Log: Fix a comment that we do not have an SA yet but need to acquire one. MFC after: 3 days Modified: head/sys/netinet6/ip6_ipsec.c Modified: head/sys/netinet6/ip6_ipsec.c ============================================================================== --- head/sys/netinet6/ip6_ipsec.c Sat Jul 28 23:11:09 2012 (r238876) +++ head/sys/netinet6/ip6_ipsec.c Sun Jul 29 00:44:41 2012 (r238877) @@ -263,7 +263,7 @@ ip6_ipsec_output(struct mbuf **m, struct mtag->m_tag_id != PACKET_TAG_IPSEC_OUT_CRYPTO_NEEDED) continue; /* - * Check if policy has an SA associated with it. + * Check if policy has no SA associated with it. * This can happen when an SP has yet to acquire * an SA; e.g. on first reference. If it occurs, * then we let ipsec4_process_packet do its thing. From owner-svn-src-head@FreeBSD.ORG Sun Jul 29 00:45:25 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 510D1106566C; Sun, 29 Jul 2012 00:45:25 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3C78C8FC08; Sun, 29 Jul 2012 00:45:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6T0jPBj089399; Sun, 29 Jul 2012 00:45:25 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6T0jPsq089397; Sun, 29 Jul 2012 00:45:25 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201207290045.q6T0jPsq089397@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 29 Jul 2012 00:45:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238878 - head/sys/netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 29 Jul 2012 00:45:25 -0000 Author: bz Date: Sun Jul 29 00:45:24 2012 New Revision: 238878 URL: http://svn.freebsd.org/changeset/base/238878 Log: For consistency put the IPsec comment iside the #fidef section. MFC after: 3 days Modified: head/sys/netinet6/ip6_output.c Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Sun Jul 29 00:44:41 2012 (r238877) +++ head/sys/netinet6/ip6_output.c Sun Jul 29 00:45:24 2012 (r238878) @@ -294,11 +294,11 @@ ip6_output(struct mbuf *m0, struct ip6_p MAKE_EXTHDR(opt->ip6po_dest2, &exthdrs.ip6e_dest2); } +#ifdef IPSEC /* * IPSec checking which handles several cases. * FAST IPSEC: We re-injected the packet. */ -#ifdef IPSEC switch(ip6_ipsec_output(&m, inp, &flags, &error, &ifp, &sp)) { case 1: /* Bad packet */ From owner-svn-src-head@FreeBSD.ORG Sun Jul 29 01:01:37 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 395B1106564A; Sun, 29 Jul 2012 01:01:37 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 24DD48FC08; Sun, 29 Jul 2012 01:01:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6T11bqH090660; Sun, 29 Jul 2012 01:01:37 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6T11ZYR090658; Sun, 29 Jul 2012 01:01:35 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201207290101.q6T11ZYR090658@svn.freebsd.org> From: Doug Barton Date: Sun, 29 Jul 2012 01:01:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238879 - head/games/fortune/datfiles X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 29 Jul 2012 01:01:37 -0000 Author: dougb Date: Sun Jul 29 01:01:35 2012 New Revision: 238879 URL: http://svn.freebsd.org/changeset/base/238879 Log: Add a couple of nice quotes from Edward Everett Hale Modified: head/games/fortune/datfiles/fortunes Modified: head/games/fortune/datfiles/fortunes ============================================================================== --- head/games/fortune/datfiles/fortunes Sun Jul 29 00:45:24 2012 (r238878) +++ head/games/fortune/datfiles/fortunes Sun Jul 29 01:01:35 2012 (r238879) @@ -22100,6 +22100,11 @@ planet. Tuna, chicken, sparrow-brains, e world that they like, but catnip is crack from home. -- Bill Cole % +I am only one, but I am one. I cannot do everything, but I can do +something. And I will not let what I cannot do interfere with what +I can do. + -- Edward Everett Hale, (1822 - 1909) +% I am professionally trained in computer science, which is to say (in all seriousness) that I am extremely poorly educated. -- Joseph Weizenbaum, "Computer Power and Human Reason" @@ -31413,6 +31418,10 @@ Look ere ye leap. % Look out! Behind you! % +Look up and not down, look forward and not back, look out and not in, +and lend a hand. + -- Edward Everett Hale, "Lowell Institute Lectures" (1869) +% Look, we play the Star Spangled Banner before every game. You want us to pay income taxes, too? -- Bill Veeck, Chicago White Sox From owner-svn-src-head@FreeBSD.ORG Sun Jul 29 02:11:25 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98D66106564A; Sun, 29 Jul 2012 02:11:25 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 58AE18FC12; Sun, 29 Jul 2012 02:11:25 +0000 (UTC) Received: by pbbro2 with SMTP id ro2so7947116pbb.13 for ; Sat, 28 Jul 2012 19:11:25 -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 :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=9XtxftE5fEH45fwvBVdYhWUTJdNT/7S3hzzFq/ME35Y=; b=I26SK1XS4/Ia4vUj7nSL/8QNTDpukuiNCTr/dYc4K/od6iKlJtW5Ce6pJGdSyZUDm/ upCLPZMgzLd/yXi+MFzKzGnEbApDJIiz6rOLl1Mf8iXjxaJ0LtGbouOEP7nvMokgrSDE rjrZv4qKZccDF4Bl+S+MRauf5fHlTmdD629nbnRsKz/2h+8vQZl+M4iDOFZrYNqlTeMV qxpgRQtPX/5ZnCWKwPh3tbk77vWBBfViHxhWETJZ2+rzq8PzIPSWbxWM9Mbbtna5Bjt3 3LKzWqGbdgOcWVqPA+NXpqeTtBLz0OVd4QtZynd4rwAPlnpB3zk+ZfzReIvqy4MfsNz1 WObg== MIME-Version: 1.0 Received: by 10.68.223.164 with SMTP id qv4mr24972775pbc.20.1343527884911; Sat, 28 Jul 2012 19:11:24 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.68.66.136 with HTTP; Sat, 28 Jul 2012 19:11:24 -0700 (PDT) In-Reply-To: <201207270548.q6R5mgiS070136@svn.freebsd.org> References: <201207270548.q6R5mgiS070136@svn.freebsd.org> Date: Sat, 28 Jul 2012 19:11:24 -0700 X-Google-Sender-Auth: RPiMqVoi9jWsPqj5aifDPYCf5kA Message-ID: From: Adrian Chadd To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-wireless@freebsd.org Subject: Re: svn commit: r238824 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 29 Jul 2012 02:11:25 -0000 Hi, This broke -HEAD. Let me go and figure out what I need to do to fix the descriptor offset math. It only showed up under heavy iperf testing. Ping wasn't enough to trigger the crash. :( Adrian On 26 July 2012 22:48, Adrian Chadd wrote: > Author: adrian > Date: Fri Jul 27 05:48:42 2012 > New Revision: 238824 > URL: http://svn.freebsd.org/changeset/base/238824 > > Log: > Migrate the descriptor allocation function to not care about the number > of buffers, only the number of descriptors. > > This involves: > > * Change the allocation function to not use nbuf at all; > * When calling it, pass in "nbuf * ndesc" to correctly update how many > descriptors are being allocated. > > Whilst here, fix the descriptor allocation code to correctly allocate > a larger buffer size if the Merlin 4KB WAR is required. It overallocates > descriptors when allocating a block that doesn't ever have a 4KB boundary > being crossed, but that can be fixed at a later stage. > > Modified: > head/sys/dev/ath/if_ath.c > head/sys/dev/ath/if_ath_misc.h > > Modified: head/sys/dev/ath/if_ath.c > ============================================================================== > --- head/sys/dev/ath/if_ath.c Fri Jul 27 05:37:01 2012 (r238823) > +++ head/sys/dev/ath/if_ath.c Fri Jul 27 05:48:42 2012 (r238824) > @@ -2773,7 +2773,7 @@ ath_load_cb(void *arg, bus_dma_segment_t > int > ath_descdma_alloc_desc(struct ath_softc *sc, > struct ath_descdma *dd, ath_bufhead *head, > - const char *name, int ds_size, int nbuf, int ndesc) > + const char *name, int ds_size, int ndesc) > { > #define DS2PHYS(_dd, _ds) \ > ((_dd)->dd_desc_paddr + ((caddr_t)(_ds) - (caddr_t)(_dd)->dd_desc)) > @@ -2785,11 +2785,11 @@ ath_descdma_alloc_desc(struct ath_softc > dd->dd_descsize = ds_size; > > DPRINTF(sc, ATH_DEBUG_RESET, > - "%s: %s DMA: %u buffers %u desc/buf, %d bytes per descriptor\n", > - __func__, name, nbuf, ndesc, dd->dd_descsize); > + "%s: %s DMA: %u desc, %d bytes per descriptor\n", > + __func__, name, ndesc, dd->dd_descsize); > > dd->dd_name = name; > - dd->dd_desc_len = dd->dd_descsize * nbuf * ndesc; > + dd->dd_desc_len = dd->dd_descsize * ndesc; > > /* > * Merlin work-around: > @@ -2797,8 +2797,8 @@ ath_descdma_alloc_desc(struct ath_softc > * Assume one skipped descriptor per 4KB page. > */ > if (! ath_hal_split4ktrans(sc->sc_ah)) { > - int numdescpage = 4096 / (dd->dd_descsize * ndesc); > - dd->dd_desc_len = (nbuf / numdescpage + 1) * 4096; > + int numpages = dd->dd_desc_len / 4096; > + dd->dd_desc_len += ds_size * numpages; > } > > /* > @@ -2834,7 +2834,7 @@ ath_descdma_alloc_desc(struct ath_softc > &dd->dd_dmamap); > if (error != 0) { > if_printf(ifp, "unable to alloc memory for %u %s descriptors, " > - "error %u\n", nbuf * ndesc, dd->dd_name, error); > + "error %u\n", ndesc, dd->dd_name, error); > goto fail1; > } > > @@ -2883,7 +2883,7 @@ ath_descdma_setup(struct ath_softc *sc, > > /* Allocate descriptors */ > error = ath_descdma_alloc_desc(sc, dd, head, name, ds_size, > - nbuf, ndesc); > + nbuf * ndesc); > > /* Assume any errors during allocation were dealt with */ > if (error != 0) { > > Modified: head/sys/dev/ath/if_ath_misc.h > ============================================================================== > --- head/sys/dev/ath/if_ath_misc.h Fri Jul 27 05:37:01 2012 (r238823) > +++ head/sys/dev/ath/if_ath_misc.h Fri Jul 27 05:48:42 2012 (r238824) > @@ -86,7 +86,7 @@ extern void ath_setslottime(struct ath_s > > extern int ath_descdma_alloc_desc(struct ath_softc *sc, > struct ath_descdma *dd, ath_bufhead *head, const char *name, > - int ds_size, int nbuf, int ndesc); > + int ds_size, int ndesc); > extern int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd, > ath_bufhead *head, const char *name, int ds_size, int nbuf, > int ndesc); From owner-svn-src-head@FreeBSD.ORG Sun Jul 29 04:26:25 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFB07106566B; Sun, 29 Jul 2012 04:26:25 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AAD918FC14; Sun, 29 Jul 2012 04:26:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6T4QPK0006890; Sun, 29 Jul 2012 04:26:25 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6T4QPDf006888; Sun, 29 Jul 2012 04:26:25 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201207290426.q6T4QPDf006888@svn.freebsd.org> From: Warner Losh Date: Sun, 29 Jul 2012 04:26:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238880 - head/sys/arm/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 29 Jul 2012 04:26:25 -0000 Author: imp Date: Sun Jul 29 04:26:24 2012 New Revision: 238880 URL: http://svn.freebsd.org/changeset/base/238880 Log: Add usb_template for the gadget support. Even though this isn't a bootable kernel, its config will likely be copied to places that are. Submitted by: Hans Petter Selasky Modified: head/sys/arm/conf/ATMEL Modified: head/sys/arm/conf/ATMEL ============================================================================== --- head/sys/arm/conf/ATMEL Sun Jul 29 01:01:35 2012 (r238879) +++ head/sys/arm/conf/ATMEL Sun Jul 29 04:26:24 2012 (r238880) @@ -165,6 +165,7 @@ device umass # Disks/Mass storage - Re device at91_dci # Atmel's usb device device usfs # emulate a flash device cdce # emulate an ethernet +device usb_template # Control of the gadget # watchdog device at91_wdt # Atmel AT91 Watchdog Timer From owner-svn-src-head@FreeBSD.ORG Sun Jul 29 04:28:29 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D8C83106566C; Sun, 29 Jul 2012 04:28:29 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C470B8FC08; Sun, 29 Jul 2012 04:28:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6T4STw1007078; Sun, 29 Jul 2012 04:28:29 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6T4STUY007076; Sun, 29 Jul 2012 04:28:29 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201207290428.q6T4STUY007076@svn.freebsd.org> From: Warner Losh Date: Sun, 29 Jul 2012 04:28:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238881 - head/sys/arm/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 29 Jul 2012 04:28:30 -0000 Author: imp Date: Sun Jul 29 04:28:29 2012 New Revision: 238881 URL: http://svn.freebsd.org/changeset/base/238881 Log: Commit the dci (gadget) support to the one ATMEL kernel config where it might actually work. Modified: head/sys/arm/conf/KB920X Modified: head/sys/arm/conf/KB920X ============================================================================== --- head/sys/arm/conf/KB920X Sun Jul 29 04:26:24 2012 (r238880) +++ head/sys/arm/conf/KB920X Sun Jul 29 04:28:29 2012 (r238881) @@ -138,6 +138,12 @@ device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support device wlan_amrr # AMRR transmit rate control algorithm +# USB device (gadget) support +device at91_dci # Atmel's usb device +device usfs # emulate a flash +device cdce # emulate an ethernet +device usb_template # Control of the gadget + options IEEE80211_SUPPORT_MESH options AH_SUPPORT_AR5416 From owner-svn-src-head@FreeBSD.ORG Sun Jul 29 06:33:28 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A45D6106566B; Sun, 29 Jul 2012 06:33:28 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 901B28FC16; Sun, 29 Jul 2012 06:33:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6T6XSdc017048; Sun, 29 Jul 2012 06:33:28 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6T6XSn8017046; Sun, 29 Jul 2012 06:33:28 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207290633.q6T6XSn8017046@svn.freebsd.org> From: Martin Matuska Date: Sun, 29 Jul 2012 06:33:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238882 - head/contrib/libarchive/libarchive X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 29 Jul 2012 06:33:28 -0000 Author: mm Date: Sun Jul 29 06:33:27 2012 New Revision: 238882 URL: http://svn.freebsd.org/changeset/base/238882 Log: Fix endless loop if reading unsupported ACL type. Apply fix from vendor's master branch. References: https://github.com/libarchive/libarchive/commit/d8b9dbd Reported on: freebsd-current@ Obtained from: libarchive Modified: head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Modified: head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Sun Jul 29 04:28:29 2012 (r238881) +++ head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Sun Jul 29 06:33:27 2012 (r238882) @@ -485,6 +485,7 @@ setup_acl_posix1e(struct archive_read_di ae_tag = ARCHIVE_ENTRY_ACL_OTHER; } else { /* Skip types that libarchive can't support. */ + s = acl_get_entry(acl, ACL_NEXT_ENTRY, &acl_entry); continue; } From owner-svn-src-head@FreeBSD.ORG Sun Jul 29 06:34:45 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCA11106564A; Sun, 29 Jul 2012 06:34:45 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C88D98FC12; Sun, 29 Jul 2012 06:34:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6T6YjUC017193; Sun, 29 Jul 2012 06:34:45 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6T6YjAn017191; Sun, 29 Jul 2012 06:34:45 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207290634.q6T6YjAn017191@svn.freebsd.org> From: Martin Matuska Date: Sun, 29 Jul 2012 06:34:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238883 - head/lib/libarchive X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 29 Jul 2012 06:34:46 -0000 Author: mm Date: Sun Jul 29 06:34:45 2012 New Revision: 238883 URL: http://svn.freebsd.org/changeset/base/238883 Log: Catch up config_freebsd.h with libarchive 3.0.4 Modified: head/lib/libarchive/config_freebsd.h Modified: head/lib/libarchive/config_freebsd.h ============================================================================== --- head/lib/libarchive/config_freebsd.h Sun Jul 29 06:33:27 2012 (r238882) +++ head/lib/libarchive/config_freebsd.h Sun Jul 29 06:34:45 2012 (r238883) @@ -129,7 +129,6 @@ #define HAVE_LSTAT 1 #define HAVE_LUTIMES 1 #define HAVE_MBRTOWC 1 -#define HAVE_MBSNRTOWCS 1 #define HAVE_MEMMOVE 1 #define HAVE_MEMORY_H 1 #define HAVE_MEMSET 1 @@ -206,7 +205,6 @@ #define HAVE_WCSCMP 1 #define HAVE_WCSCPY 1 #define HAVE_WCSLEN 1 -#define HAVE_WCSNRTOMBS 1 #define HAVE_WCTOMB 1 #define HAVE_WCTYPE_H 1 #define HAVE_WMEMCMP 1 From owner-svn-src-head@FreeBSD.ORG Sun Jul 29 08:52:33 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54384106564A; Sun, 29 Jul 2012 08:52:33 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3F3068FC12; Sun, 29 Jul 2012 08:52:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6T8qX0s028833; Sun, 29 Jul 2012 08:52:33 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6T8qXNq028831; Sun, 29 Jul 2012 08:52:33 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207290852.q6T8qXNq028831@svn.freebsd.org> From: Adrian Chadd Date: Sun, 29 Jul 2012 08:52:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238884 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 29 Jul 2012 08:52:33 -0000 Author: adrian Date: Sun Jul 29 08:52:32 2012 New Revision: 238884 URL: http://svn.freebsd.org/changeset/base/238884 Log: Fix breakage introduced in r238824 - correctly calculate the descriptor wrapping. The previous code was only wrapping descriptor "block" boundaries rather than individual descriptors. It sounds equivalent but it isn't. r238824 changed the descriptor allocation to enforce that an individual descriptor doesn't wrap a 4KiB boundary rather than the whole block of descriptors. Eg, for TX descriptors, they're allocated in blocks of 10 descriptors for each ath_buf (for scatter/gather DMA.) Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Sun Jul 29 06:34:45 2012 (r238883) +++ head/sys/dev/ath/if_ath.c Sun Jul 29 08:52:32 2012 (r238884) @@ -2914,7 +2914,7 @@ ath_descdma_setup(struct ath_softc *sc, * in the descriptor. */ if (ATH_DESC_4KB_BOUND_CHECK(bf->bf_daddr, - dd->dd_descsize * ndesc)) { + dd->dd_descsize)) { /* Start at the next page */ ds += 0x1000 - (bf->bf_daddr & 0xFFF); bf->bf_desc = (struct ath_desc *) ds; @@ -2932,6 +2932,12 @@ ath_descdma_setup(struct ath_softc *sc, bf->bf_lastds = bf->bf_desc; /* Just an initial value */ TAILQ_INSERT_TAIL(head, bf, bf_list); } + + /* + * XXX TODO: ensure that ds doesn't overflow the descriptor + * allocation otherwise weird stuff will occur and crash your + * machine. + */ return 0; /* XXX this should likely just call ath_descdma_cleanup() */ fail3: From owner-svn-src-head@FreeBSD.ORG Sun Jul 29 09:23:33 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0EDDC106566B; Sun, 29 Jul 2012 09:23:33 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D431F8FC0A; Sun, 29 Jul 2012 09:23:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6T9NWhT031335; Sun, 29 Jul 2012 09:23:32 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6T9NWew031333; Sun, 29 Jul 2012 09:23:32 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207290923.q6T9NWew031333@svn.freebsd.org> From: Adrian Chadd Date: Sun, 29 Jul 2012 09:23:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238885 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 29 Jul 2012 09:23:33 -0000 Author: adrian Date: Sun Jul 29 09:23:32 2012 New Revision: 238885 URL: http://svn.freebsd.org/changeset/base/238885 Log: Shuffle the rate control call to be consistent with non-aggregate TX. The correct ordering for non-aggregate TX is: * call ath_hal_setuptxdesc() to setup the first TX descriptor complete with the first TX rate/try count; * call ath_hal_setupxtxdesc() to setup the multi-rate retry; * .. or for 802.11n NICs, call ath_hal_set11nratescenario() for MRR and 802.11n flags; * then call ath_hal_filltxdesc() to setup intermediary descriptors in a multi-descriptor single frame. The call to ath_hal_filltxdesc() routines seem to correctly (consistently?) handle the intermediary descriptor flags, including copying the rate control information to the final descriptor in the frame. That's used by the rate control module rather than the hardware. Tested: * Only on AR9280 STA mode, however it should work on other chips in both STA and AP mode. Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Sun Jul 29 08:52:32 2012 (r238884) +++ head/sys/dev/ath/if_ath_tx.c Sun Jul 29 09:23:32 2012 (r238885) @@ -3895,9 +3895,9 @@ ath_tx_tid_hw_queue_aggr(struct ath_soft ath_tx_set_rtscts(sc, bf); ath_tx_rate_fill_rcflags(sc, bf); ath_tx_setds(sc, bf); + ath_tx_set_ratectrl(sc, ni, bf); ath_tx_chaindesclist(sc, bf); ath_hal_clr11n_aggr(sc->sc_ah, bf->bf_desc); - ath_tx_set_ratectrl(sc, ni, bf); sc->sc_aggr_stats.aggr_nonbaw_pkt++; @@ -3955,9 +3955,9 @@ ath_tx_tid_hw_queue_aggr(struct ath_soft "%s: single-frame aggregate\n", __func__); bf->bf_state.bfs_aggr = 0; ath_tx_setds(sc, bf); + ath_tx_set_ratectrl(sc, ni, bf); ath_tx_chaindesclist(sc, bf); ath_hal_clr11n_aggr(sc->sc_ah, bf->bf_desc); - ath_tx_set_ratectrl(sc, ni, bf); if (status == ATH_AGGR_BAW_CLOSED) sc->sc_aggr_stats.aggr_baw_closed_single_pkt++; else @@ -4084,8 +4084,8 @@ ath_tx_tid_hw_queue_norm(struct ath_soft ath_tx_set_rtscts(sc, bf); ath_tx_rate_fill_rcflags(sc, bf); ath_tx_setds(sc, bf); - ath_tx_chaindesclist(sc, bf); ath_tx_set_ratectrl(sc, ni, bf); + ath_tx_chaindesclist(sc, bf); /* Track outstanding buffer count to hardware */ /* aggregates are "one" buffer */ From owner-svn-src-head@FreeBSD.ORG Sun Jul 29 11:51:49 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AEA26106566B; Sun, 29 Jul 2012 11:51:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9784F8FC08; Sun, 29 Jul 2012 11:51:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6TBpng6049280; Sun, 29 Jul 2012 11:51:49 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6TBpnOu049262; Sun, 29 Jul 2012 11:51:49 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201207291151.q6TBpnOu049262@svn.freebsd.org> From: Alexander Motin Date: Sun, 29 Jul 2012 11:51:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238886 - in head/sys: cam cam/ata cam/scsi geom geom/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 29 Jul 2012 11:51:49 -0000 Author: mav Date: Sun Jul 29 11:51:48 2012 New Revision: 238886 URL: http://svn.freebsd.org/changeset/base/238886 Log: Implement media change notification for DA and CD removable media devices. It includes three parts: 1) Modifications to CAM to detect media media changes and report them to disk(9) layer. For modern SATA (and potentially UAS) devices it utilizes Asynchronous Notification mechanism to receive events from hardware. Active polling with TEST UNIT READY commands with 3 seconds period is used for incapable hardware. After that both CD and DA drivers work the same way, detecting two conditions: "NOT READY: Medium not present" after medium was detected previously, and "UNIT ATTENTION: Not ready to ready change, medium may have changed". First one reported to disk(9) as media removal, second as media insert/change. To reliably receive second event new AC_UNIT_ATTENTION async added to make UAs broadcasted to all periphs by generic error handling code in cam_periph_error(). 2) Modifications to GEOM core to handle media remove and change events. Media removal handled by spoiling all consumers attached to the provider. Media change event also schedules provider retaste after spoiling to probe new media. New flag G_CF_ORPHAN was added to consumers to reflect that consumer is in process of destruction. It allows retaste to create new geom instance of the same class, while previous one is still dying. 3) Modifications to some GEOM classes: DEV -- to report media change events to devd; VFS -- to handle spoiling same as orphan to prevent accessing replaced media. PART class already handles spoiling alike to orphan. Reviewed by: silence on geom@ and scsi@ Tested by: avg Sponsored by: iXsystems, Inc. / PC-BSD MFC after: 2 months Modified: head/sys/cam/ata/ata_all.h head/sys/cam/ata/ata_xpt.c head/sys/cam/cam_ccb.h head/sys/cam/cam_periph.c head/sys/cam/cam_xpt.c head/sys/cam/scsi/scsi_cd.c head/sys/cam/scsi/scsi_da.c head/sys/geom/geom.h head/sys/geom/geom_dev.c head/sys/geom/geom_disk.c head/sys/geom/geom_disk.h head/sys/geom/geom_event.c head/sys/geom/geom_io.c head/sys/geom/geom_slice.c head/sys/geom/geom_subr.c head/sys/geom/geom_vfs.c head/sys/geom/part/g_part.c Modified: head/sys/cam/ata/ata_all.h ============================================================================== --- head/sys/cam/ata/ata_all.h Sun Jul 29 09:23:32 2012 (r238885) +++ head/sys/cam/ata/ata_all.h Sun Jul 29 11:51:48 2012 (r238886) @@ -35,6 +35,7 @@ struct ccb_ataio; struct cam_periph; union ccb; +#define SID_AEN 0x04 /* Abuse inq_flags bit to track enabled AEN. */ #define SID_DMA 0x10 /* Abuse inq_flags bit to track enabled DMA. */ struct ata_cmd { Modified: head/sys/cam/ata/ata_xpt.c ============================================================================== --- head/sys/cam/ata/ata_xpt.c Sun Jul 29 09:23:32 2012 (r238885) +++ head/sys/cam/ata/ata_xpt.c Sun Jul 29 11:51:48 2012 (r238886) @@ -468,6 +468,12 @@ negotiate: 0, 0x02); break; case PROBE_SETAN: + /* Remember what transport thinks about AEN. */ + if (softc->caps & CTS_SATA_CAPS_H_AN) + path->device->inq_flags |= SID_AEN; + else + path->device->inq_flags &= ~SID_AEN; + xpt_async(AC_GETDEV_CHANGED, path, NULL); cam_fill_ataio(ataio, 1, probedone, @@ -1154,6 +1160,12 @@ notsata: cts.xport_specific.sata.valid = CTS_SATA_VALID_CAPS; xpt_action((union ccb *)&cts); softc->caps = caps; + /* Remember what transport thinks about AEN. */ + if (softc->caps & CTS_SATA_CAPS_H_AN) + path->device->inq_flags |= SID_AEN; + else + path->device->inq_flags &= ~SID_AEN; + xpt_async(AC_GETDEV_CHANGED, path, NULL); if (periph->path->device->flags & CAM_DEV_UNCONFIGURED) { path->device->flags &= ~CAM_DEV_UNCONFIGURED; xpt_acquire_device(path->device); Modified: head/sys/cam/cam_ccb.h ============================================================================== --- head/sys/cam/cam_ccb.h Sun Jul 29 09:23:32 2012 (r238885) +++ head/sys/cam/cam_ccb.h Sun Jul 29 11:51:48 2012 (r238886) @@ -755,6 +755,7 @@ struct ccb_relsim { * Definitions for the asynchronous callback CCB fields. */ typedef enum { + AC_UNIT_ATTENTION = 0x4000,/* Device reported UNIT ATTENTION */ AC_ADVINFO_CHANGED = 0x2000,/* Advance info might have changes */ AC_CONTRACT = 0x1000,/* A contractual callback */ AC_GETDEV_CHANGED = 0x800,/* Getdev info might have changed */ Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Sun Jul 29 09:23:32 2012 (r238885) +++ head/sys/cam/cam_periph.c Sun Jul 29 11:51:48 2012 (r238886) @@ -1593,6 +1593,7 @@ cam_periph_error(union ccb *ccb, cam_fla const char *action_string; cam_status status; int frozen, error, openings, print, lost_device; + int error_code, sense_key, asc, ascq; u_int32_t relsim_flags, timeout; print = 1; @@ -1759,6 +1760,12 @@ cam_periph_error(union ccb *ccb, cam_fla xpt_async(AC_LOST_DEVICE, newpath, NULL); xpt_free_path(newpath); } + + /* Broadcast UNIT ATTENTIONs to all periphs. */ + } else if (scsi_extract_sense_ccb(ccb, + &error_code, &sense_key, &asc, &ascq) && + sense_key == SSD_KEY_UNIT_ATTENTION) { + xpt_async(AC_UNIT_ATTENTION, orig_ccb->ccb_h.path, orig_ccb); } /* Attempt a retry */ Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Sun Jul 29 09:23:32 2012 (r238885) +++ head/sys/cam/cam_xpt.c Sun Jul 29 11:51:48 2012 (r238886) @@ -4055,6 +4055,7 @@ xpt_async_string(u_int32_t async_code) case AC_GETDEV_CHANGED: return ("AC_GETDEV_CHANGED"); case AC_CONTRACT: return ("AC_CONTRACT"); case AC_ADVINFO_CHANGED: return ("AC_ADVINFO_CHANGED"); + case AC_UNIT_ATTENTION: return ("AC_UNIT_ATTENTION"); } return ("AC_UNKNOWN"); } Modified: head/sys/cam/scsi/scsi_cd.c ============================================================================== --- head/sys/cam/scsi/scsi_cd.c Sun Jul 29 09:23:32 2012 (r238885) +++ head/sys/cam/scsi/scsi_cd.c Sun Jul 29 11:51:48 2012 (r238886) @@ -97,6 +97,7 @@ typedef enum { CD_FLAG_NEW_DISC = 0x0002, CD_FLAG_DISC_LOCKED = 0x0004, CD_FLAG_DISC_REMOVABLE = 0x0008, + CD_FLAG_SAW_MEDIA = 0x0010, CD_FLAG_CHANGER = 0x0040, CD_FLAG_ACTIVE = 0x0080, CD_FLAG_SCHED_ON_COMP = 0x0100, @@ -110,6 +111,7 @@ typedef enum { CD_CCB_PROBE = 0x01, CD_CCB_BUFFER_IO = 0x02, CD_CCB_WAITING = 0x03, + CD_CCB_TUR = 0x04, CD_CCB_TYPE_MASK = 0x0F, CD_CCB_RETRY_UA = 0x10 } cd_ccb_state; @@ -154,12 +156,14 @@ struct cd_softc { struct cam_periph *periph; int minimum_command_size; int outstanding_cmds; + int tur; struct task sysctl_task; struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; STAILQ_HEAD(, cd_mode_params) mode_queue; struct cd_tocdata toc; struct disk *disk; + struct callout mediapoll_c; }; struct cd_page_sizes { @@ -281,6 +285,7 @@ static int cdsendkey(struct cam_periph struct dvd_authinfo *authinfo); static int cdreaddvdstructure(struct cam_periph *periph, struct dvd_struct *dvdstruct); +static timeout_t cdmediapoll; static struct periph_driver cddriver = { @@ -290,6 +295,9 @@ static struct periph_driver cddriver = PERIPHDRIVER_DECLARE(cd, cddriver); +#ifndef CD_DEFAULT_POLL_PERIOD +#define CD_DEFAULT_POLL_PERIOD 3 +#endif #ifndef CD_DEFAULT_RETRY #define CD_DEFAULT_RETRY 4 #endif @@ -303,6 +311,7 @@ PERIPHDRIVER_DECLARE(cd, cddriver); #define CHANGER_MAX_BUSY_SECONDS 15 #endif +static int cd_poll_period = CD_DEFAULT_POLL_PERIOD; static int cd_retry_count = CD_DEFAULT_RETRY; static int cd_timeout = CD_DEFAULT_TIMEOUT; static int changer_min_busy_seconds = CHANGER_MIN_BUSY_SECONDS; @@ -311,6 +320,9 @@ static int changer_max_busy_seconds = CH static SYSCTL_NODE(_kern_cam, OID_AUTO, cd, CTLFLAG_RD, 0, "CAM CDROM driver"); static SYSCTL_NODE(_kern_cam_cd, OID_AUTO, changer, CTLFLAG_RD, 0, "CD Changer"); +SYSCTL_INT(_kern_cam_cd, OID_AUTO, poll_period, CTLFLAG_RW, + &cd_poll_period, 0, "Media polling period in seconds"); +TUNABLE_INT("kern.cam.cd.poll_period", &cd_poll_period); SYSCTL_INT(_kern_cam_cd, OID_AUTO, retry_count, CTLFLAG_RW, &cd_retry_count, 0, "Normal I/O retry count"); TUNABLE_INT("kern.cam.cd.retry_count", &cd_retry_count); @@ -494,6 +506,7 @@ cdcleanup(struct cam_periph *periph) xpt_print(periph->path, "can't remove sysctl context\n"); } + callout_drain(&softc->mediapoll_c); disk_destroy(softc->disk); free(softc, M_DEVBUF); cam_periph_lock(periph); @@ -504,6 +517,7 @@ cdasync(void *callback_arg, u_int32_t co struct cam_path *path, void *arg) { struct cam_periph *periph; + struct cd_softc *softc; periph = (struct cam_periph *)callback_arg; switch (code) { @@ -541,10 +555,39 @@ cdasync(void *callback_arg, u_int32_t co break; } + case AC_UNIT_ATTENTION: + { + union ccb *ccb; + int error_code, sense_key, asc, ascq; + + softc = (struct cd_softc *)periph->softc; + ccb = (union ccb *)arg; + + /* + * Handle all media change UNIT ATTENTIONs except + * our own, as they will be handled by cderror(). + */ + if (xpt_path_periph(ccb->ccb_h.path) != periph && + scsi_extract_sense_ccb(ccb, + &error_code, &sense_key, &asc, &ascq)) { + if (asc == 0x28 && ascq == 0x00) + disk_media_changed(softc->disk, M_NOWAIT); + } + cam_periph_async(periph, code, path, arg); + break; + } + case AC_SCSI_AEN: + softc = (struct cd_softc *)periph->softc; + if (softc->state == CD_STATE_NORMAL && !softc->tur) { + if (cam_periph_acquire(periph) == CAM_REQ_CMP) { + softc->tur = 1; + xpt_schedule(periph, CAM_PRIORITY_DEV); + } + } + /* FALLTHROUGH */ case AC_SENT_BDR: case AC_BUS_RESET: { - struct cd_softc *softc; struct ccb_hdr *ccbh; softc = (struct cd_softc *)periph->softc; @@ -788,8 +831,8 @@ cdregister(struct cam_periph *periph, vo * Add an async callback so that we get * notified if this device goes away. */ - xpt_register_async(AC_SENT_BDR | AC_BUS_RESET | AC_LOST_DEVICE, - cdasync, periph, periph->path); + xpt_register_async(AC_SENT_BDR | AC_BUS_RESET | AC_LOST_DEVICE | + AC_SCSI_AEN | AC_UNIT_ATTENTION, cdasync, periph, periph->path); /* * If the target lun is greater than 0, we most likely have a CD @@ -1005,6 +1048,17 @@ cdregister(struct cam_periph *periph, vo } } + /* + * Schedule a periodic media polling events. + */ + callout_init_mtx(&softc->mediapoll_c, periph->sim->mtx, 0); + if ((softc->flags & CD_FLAG_DISC_REMOVABLE) && + (softc->flags & CD_FLAG_CHANGER) == 0 && + (cgd->inq_flags & SID_AEN) == 0 && + cd_poll_period != 0) + callout_reset(&softc->mediapoll_c, cd_poll_period * hz, + cdmediapoll, periph); + cdregisterexit: if ((softc->flags & CD_FLAG_CHANGER) == 0) @@ -1500,8 +1554,25 @@ cdstart(struct cam_periph *periph, union periph->immediate_priority = CAM_PRIORITY_NONE; wakeup(&periph->ccb_list); } else if (bp == NULL) { - xpt_release_ccb(start_ccb); + if (softc->tur) { + softc->tur = 0; + csio = &start_ccb->csio; + scsi_test_unit_ready(csio, + /*retries*/ cd_retry_count, + cddone, + MSG_SIMPLE_Q_TAG, + SSD_FULL_SIZE, + cd_timeout); + start_ccb->ccb_h.ccb_bp = NULL; + start_ccb->ccb_h.ccb_state = CD_CCB_TUR; + xpt_action(start_ccb); + } else + xpt_release_ccb(start_ccb); } else { + if (softc->tur) { + softc->tur = 0; + cam_periph_release_locked(periph); + } bioq_remove(&softc->bio_queue, bp); scsi_read_write(&start_ccb->csio, @@ -1545,7 +1616,7 @@ cdstart(struct cam_periph *periph, union xpt_action(start_ccb); } - if (bp != NULL) { + if (bp != NULL || softc->tur) { /* Have more work to do, so ensure we stay scheduled */ xpt_schedule(periph, CAM_PRIORITY_NORMAL); } @@ -1840,6 +1911,25 @@ cddone(struct cam_periph *periph, union wakeup(&done_ccb->ccb_h.cbfcnp); return; } + case CD_CCB_TUR: + { + if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + + if (cderror(done_ccb, CAM_RETRY_SELTO, + SF_RETRY_UA | SF_NO_RECOVERY | SF_NO_PRINT) == + ERESTART) + return; + if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) + cam_release_devq(done_ccb->ccb_h.path, + /*relsim_flags*/0, + /*reduction*/0, + /*timeout*/0, + /*getcount_only*/0); + } + xpt_release_ccb(done_ccb); + cam_periph_release_locked(periph); + return; + } default: break; } @@ -2830,7 +2920,7 @@ cdcheckmedia(struct cam_periph *periph) cdprevent(periph, PR_ALLOW); return (error); } else { - softc->flags |= CD_FLAG_VALID_MEDIA; + softc->flags |= CD_FLAG_SAW_MEDIA | CD_FLAG_VALID_MEDIA; softc->disk->d_sectorsize = softc->params.blksize; softc->disk->d_mediasize = (off_t)softc->params.blksize * softc->params.disksize; @@ -3175,6 +3265,14 @@ cderror(union ccb *ccb, u_int32_t cam_fl &error_code, &sense_key, &asc, &ascq)) { if (sense_key == SSD_KEY_ILLEGAL_REQUEST) error = cd6byteworkaround(ccb); + else if (sense_key == SSD_KEY_UNIT_ATTENTION && + asc == 0x28 && ascq == 0x00) + disk_media_changed(softc->disk, M_NOWAIT); + else if (sense_key == SSD_KEY_NOT_READY && + asc == 0x3a && (softc->flags & CD_FLAG_SAW_MEDIA)) { + softc->flags &= ~CD_FLAG_SAW_MEDIA; + disk_media_gone(softc->disk, M_NOWAIT); + } } if (error == ERESTART) @@ -3190,6 +3288,26 @@ cderror(union ccb *ccb, u_int32_t cam_fl &softc->saved_ccb)); } +static void +cdmediapoll(void *arg) +{ + struct cam_periph *periph = arg; + struct cd_softc *softc = periph->softc; + + if (softc->flags & CD_FLAG_CHANGER) + return; + + if (softc->state == CD_STATE_NORMAL && !softc->tur) { + if (cam_periph_acquire(periph) == CAM_REQ_CMP) { + softc->tur = 1; + xpt_schedule(periph, CAM_PRIORITY_DEV); + } + } + /* Queue us up again */ + if (cd_poll_period != 0) + callout_schedule(&softc->mediapoll_c, cd_poll_period * hz); +} + /* * Read table of contents */ Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Sun Jul 29 09:23:32 2012 (r238885) +++ head/sys/cam/scsi/scsi_da.c Sun Jul 29 11:51:48 2012 (r238886) @@ -77,6 +77,7 @@ typedef enum { DA_FLAG_NEW_PACK = 0x002, DA_FLAG_PACK_LOCKED = 0x004, DA_FLAG_PACK_REMOVABLE = 0x008, + DA_FLAG_SAW_MEDIA = 0x010, DA_FLAG_NEED_OTAG = 0x020, DA_FLAG_WENT_IDLE = 0x040, DA_FLAG_RETRY_UA = 0x080, @@ -101,6 +102,7 @@ typedef enum { DA_CCB_WAITING = 0x04, DA_CCB_DUMP = 0x05, DA_CCB_DELETE = 0x06, + DA_CCB_TUR = 0x07, DA_CCB_TYPE_MASK = 0x0F, DA_CCB_RETRY_UA = 0x10 } da_ccb_state; @@ -150,6 +152,7 @@ struct da_softc { int unmap_max_ranges; int unmap_max_lba; int delete_running; + int tur; da_delete_methods delete_method; struct disk_params params; struct disk *disk; @@ -161,6 +164,7 @@ struct da_softc { uint64_t wwpn; uint8_t unmap_buf[UNMAP_MAX_RANGES * 16 + 8]; struct scsi_read_capacity_data_long rcaplong; + struct callout mediapoll_c; }; struct da_quirk_entry { @@ -857,6 +861,11 @@ static void dasetgeom(struct cam_periph size_t rcap_size); static timeout_t dasendorderedtag; static void dashutdown(void *arg, int howto); +static timeout_t damediapoll; + +#ifndef DA_DEFAULT_POLL_PERIOD +#define DA_DEFAULT_POLL_PERIOD 3 +#endif #ifndef DA_DEFAULT_TIMEOUT #define DA_DEFAULT_TIMEOUT 60 /* Timeout in seconds */ @@ -871,12 +880,16 @@ static void dashutdown(void *arg, int h #endif +static int da_poll_period = DA_DEFAULT_POLL_PERIOD; static int da_retry_count = DA_DEFAULT_RETRY; static int da_default_timeout = DA_DEFAULT_TIMEOUT; static int da_send_ordered = DA_DEFAULT_SEND_ORDERED; static SYSCTL_NODE(_kern_cam, OID_AUTO, da, CTLFLAG_RD, 0, "CAM Direct Access Disk driver"); +SYSCTL_INT(_kern_cam_da, OID_AUTO, poll_period, CTLFLAG_RW, + &da_poll_period, 0, "Media polling period in seconds"); +TUNABLE_INT("kern.cam.da.poll_period", &da_poll_period); SYSCTL_INT(_kern_cam_da, OID_AUTO, retry_count, CTLFLAG_RW, &da_retry_count, 0, "Normal I/O retry count"); TUNABLE_INT("kern.cam.da.retry_count", &da_retry_count); @@ -966,6 +979,9 @@ daopen(struct disk *dp) (softc->quirks & DA_Q_NO_PREVENT) == 0) daprevent(periph, PR_PREVENT); + if (error == 0) + softc->flags |= DA_FLAG_SAW_MEDIA; + cam_periph_unhold(periph); cam_periph_unlock(periph); @@ -1050,7 +1066,8 @@ daschedule(struct cam_periph *periph) /* Check if we have more work to do. */ if (bioq_first(&softc->bio_queue) || - (!softc->delete_running && bioq_first(&softc->delete_queue))) { + (!softc->delete_running && bioq_first(&softc->delete_queue)) || + softc->tur) { prio = CAM_PRIORITY_NORMAL; } @@ -1297,6 +1314,7 @@ dacleanup(struct cam_periph *periph) xpt_print(periph->path, "can't remove sysctl context\n"); } + callout_drain(&softc->mediapoll_c); disk_destroy(softc->disk); callout_drain(&softc->sendordered_c); free(softc, M_DEVBUF); @@ -1308,6 +1326,7 @@ daasync(void *callback_arg, u_int32_t co struct cam_path *path, void *arg) { struct cam_periph *periph; + struct da_softc *softc; periph = (struct cam_periph *)callback_arg; switch (code) { @@ -1359,10 +1378,43 @@ daasync(void *callback_arg, u_int32_t co } break; } + case AC_UNIT_ATTENTION: + { + union ccb *ccb; + int error_code, sense_key, asc, ascq; + + softc = (struct da_softc *)periph->softc; + ccb = (union ccb *)arg; + + /* + * Handle all UNIT ATTENTIONs except our own, + * as they will be handled by daerror(). + */ + if (xpt_path_periph(ccb->ccb_h.path) != periph && + scsi_extract_sense_ccb(ccb, + &error_code, &sense_key, &asc, &ascq)) { + if (asc == 0x2A && ascq == 0x09) { + xpt_print(ccb->ccb_h.path, + "capacity data has changed\n"); + dareprobe(periph); + } else if (asc == 0x28 && ascq == 0x00) + disk_media_changed(softc->disk, M_NOWAIT); + } + cam_periph_async(periph, code, path, arg); + break; + } + case AC_SCSI_AEN: + softc = (struct da_softc *)periph->softc; + if (softc->state == DA_STATE_NORMAL && !softc->tur) { + if (cam_periph_acquire(periph) == CAM_REQ_CMP) { + softc->tur = 1; + xpt_schedule(periph, CAM_PRIORITY_DEV); + } + } + /* FALLTHROUGH */ case AC_SENT_BDR: case AC_BUS_RESET: { - struct da_softc *softc; struct ccb_hdr *ccbh; softc = (struct da_softc *)periph->softc; @@ -1698,9 +1750,9 @@ daregister(struct cam_periph *periph, vo * fine without them and the only alternative * would be to not attach the device on failure. */ - xpt_register_async(AC_SENT_BDR | AC_BUS_RESET - | AC_LOST_DEVICE | AC_ADVINFO_CHANGED, - daasync, periph, periph->path); + xpt_register_async(AC_SENT_BDR | AC_BUS_RESET | AC_LOST_DEVICE | + AC_ADVINFO_CHANGED | AC_SCSI_AEN | AC_UNIT_ATTENTION, + daasync, periph, periph->path); /* * Emit an attribute changed notification just in case @@ -1710,6 +1762,16 @@ daregister(struct cam_periph *periph, vo */ disk_attr_changed(softc->disk, "GEOM::physpath", M_NOWAIT); + /* + * Schedule a periodic media polling events. + */ + callout_init_mtx(&softc->mediapoll_c, periph->sim->mtx, 0); + if ((softc->flags & DA_FLAG_PACK_REMOVABLE) && + (cgd->inq_flags & SID_AEN) == 0 && + da_poll_period != 0) + callout_reset(&softc->mediapoll_c, da_poll_period * hz, + damediapoll, periph); + xpt_schedule(periph, CAM_PRIORITY_DEV); return(CAM_REQ_CMP); @@ -1847,9 +1909,25 @@ dastart(struct cam_periph *periph, union /* Run regular command. */ bp = bioq_takefirst(&softc->bio_queue); if (bp == NULL) { - xpt_release_ccb(start_ccb); + if (softc->tur) { + softc->tur = 0; + scsi_test_unit_ready(&start_ccb->csio, + /*retries*/ da_retry_count, + dadone, + MSG_SIMPLE_Q_TAG, + SSD_FULL_SIZE, + da_default_timeout * 1000); + start_ccb->ccb_h.ccb_bp = NULL; + start_ccb->ccb_h.ccb_state = DA_CCB_TUR; + xpt_action(start_ccb); + } else + xpt_release_ccb(start_ccb); break; } + if (softc->tur) { + softc->tur = 0; + cam_periph_release_locked(periph); + } if ((bp->bio_flags & BIO_ORDERED) != 0 || (softc->flags & DA_FLAG_NEED_OTAG) != 0) { @@ -2417,6 +2495,25 @@ dadone(struct cam_periph *periph, union case DA_CCB_DUMP: /* No-op. We're polling */ return; + case DA_CCB_TUR: + { + if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + + if (daerror(done_ccb, CAM_RETRY_SELTO, + SF_RETRY_UA | SF_NO_RECOVERY | SF_NO_PRINT) == + ERESTART) + return; + if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) + cam_release_devq(done_ccb->ccb_h.path, + /*relsim_flags*/0, + /*reduction*/0, + /*timeout*/0, + /*getcount_only*/0); + } + xpt_release_ccb(done_ccb); + cam_periph_release_locked(periph); + return; + } default: break; } @@ -2477,6 +2574,13 @@ daerror(union ccb *ccb, u_int32_t cam_fl xpt_print(periph->path, "capacity data has changed\n"); dareprobe(periph); sense_flags |= SF_NO_PRINT; + } else if (sense_key == SSD_KEY_UNIT_ATTENTION && + asc == 0x28 && ascq == 0x00) + disk_media_changed(softc->disk, M_NOWAIT); + else if (sense_key == SSD_KEY_NOT_READY && + asc == 0x3a && (softc->flags & DA_FLAG_SAW_MEDIA)) { + softc->flags &= ~DA_FLAG_SAW_MEDIA; + disk_media_gone(softc->disk, M_NOWAIT); } } if (error == ERESTART) @@ -2493,6 +2597,23 @@ daerror(union ccb *ccb, u_int32_t cam_fl } static void +damediapoll(void *arg) +{ + struct cam_periph *periph = arg; + struct da_softc *softc = periph->softc; + + if (softc->state == DA_STATE_NORMAL && !softc->tur) { + if (cam_periph_acquire(periph) == CAM_REQ_CMP) { + softc->tur = 1; + daschedule(periph); + } + } + /* Queue us up again */ + if (da_poll_period != 0) + callout_schedule(&softc->mediapoll_c, da_poll_period * hz); +} + +static void daprevent(struct cam_periph *periph, int action) { struct da_softc *softc; Modified: head/sys/geom/geom.h ============================================================================== --- head/sys/geom/geom.h Sun Jul 29 09:23:32 2012 (r238885) +++ head/sys/geom/geom.h Sun Jul 29 11:51:48 2012 (r238886) @@ -174,7 +174,9 @@ struct g_consumer { struct g_provider *provider; LIST_ENTRY(g_consumer) consumers; /* XXX: better name */ int acr, acw, ace; - int spoiled; + int flags; +#define G_CF_SPOILED 0x1 +#define G_CF_ORPHAN 0x4 struct devstat *stat; u_int nstart, nend; @@ -247,6 +249,8 @@ int g_post_event(g_event_t *func, void * int g_waitfor_event(g_event_t *func, void *arg, int flag, ...); void g_cancel_event(void *ref); int g_attr_changed(struct g_provider *pp, const char *attr, int flag); +int g_media_changed(struct g_provider *pp, int flag); +int g_media_gone(struct g_provider *pp, int flag); void g_orphan_provider(struct g_provider *pp, int error); void g_waitidlelock(void); Modified: head/sys/geom/geom_dev.c ============================================================================== --- head/sys/geom/geom_dev.c Sun Jul 29 09:23:32 2012 (r238885) +++ head/sys/geom/geom_dev.c Sun Jul 29 11:51:48 2012 (r238886) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -105,6 +106,21 @@ g_dev_print(void) static void g_dev_attrchanged(struct g_consumer *cp, const char *attr) { + struct cdev *dev; + char buf[SPECNAMELEN + 6]; + + if (strcmp(attr, "GEOM::media") == 0) { + dev = cp->geom->softc; + snprintf(buf, sizeof(buf), "cdev=%s", dev->si_name); + devctl_notify_f("DEVFS", "CDEV", "MEDIACHANGE", buf, M_WAITOK); + dev = cp->cp_alias_dev; + if (dev != NULL) { + snprintf(buf, sizeof(buf), "cdev=%s", dev->si_name); + devctl_notify_f("DEVFS", "CDEV", "MEDIACHANGE", buf, + M_WAITOK); + } + return; + } if (strcmp(attr, "GEOM::physpath") != 0) return; @@ -119,7 +135,6 @@ g_dev_attrchanged(struct g_consumer *cp, g_io_getattr("GEOM::physpath", cp, &physpath_len, physpath); g_access(cp, -1, 0, 0); if (error == 0 && strlen(physpath) != 0) { - struct cdev *dev; struct cdev *old_alias_dev; struct cdev **alias_devp; @@ -161,9 +176,6 @@ g_dev_taste(struct g_class *mp, struct g g_trace(G_T_TOPOLOGY, "dev_taste(%s,%s)", mp->name, pp->name); g_topology_assert(); - LIST_FOREACH(cp, &pp->consumers, consumers) - if (cp->geom->class == mp) - return (NULL); gp = g_new_geomf(mp, pp->name); cp = g_new_consumer(gp); error = g_attach(cp, pp); Modified: head/sys/geom/geom_disk.c ============================================================================== --- head/sys/geom/geom_disk.c Sun Jul 29 09:23:32 2012 (r238885) +++ head/sys/geom/geom_disk.c Sun Jul 29 11:51:48 2012 (r238886) @@ -660,6 +660,32 @@ disk_attr_changed(struct disk *dp, const } void +disk_media_changed(struct disk *dp, int flag) +{ + struct g_geom *gp; + struct g_provider *pp; + + gp = dp->d_geom; + if (gp != NULL) { + LIST_FOREACH(pp, &gp->provider, provider) + g_media_changed(pp, flag); + } +} + +void +disk_media_gone(struct disk *dp, int flag) +{ + struct g_geom *gp; + struct g_provider *pp; + + gp = dp->d_geom; + if (gp != NULL) { + LIST_FOREACH(pp, &gp->provider, provider) + g_media_gone(pp, flag); + } +} + +void disk_resize(struct disk *dp) { struct g_geom *gp; Modified: head/sys/geom/geom_disk.h ============================================================================== --- head/sys/geom/geom_disk.h Sun Jul 29 09:23:32 2012 (r238885) +++ head/sys/geom/geom_disk.h Sun Jul 29 11:51:48 2012 (r238886) @@ -109,6 +109,8 @@ void disk_create(struct disk *disk, int void disk_destroy(struct disk *disk); void disk_gone(struct disk *disk); void disk_attr_changed(struct disk *dp, const char *attr, int flag); +void disk_media_changed(struct disk *dp, int flag); +void disk_media_gone(struct disk *dp, int flag); void disk_resize(struct disk *dp); #define DISK_VERSION_00 0x58561059 Modified: head/sys/geom/geom_event.c ============================================================================== --- head/sys/geom/geom_event.c Sun Jul 29 09:23:32 2012 (r238885) +++ head/sys/geom/geom_event.c Sun Jul 29 11:51:48 2012 (r238886) @@ -202,14 +202,12 @@ g_orphan_register(struct g_provider *pp) * Tell all consumers the bad news. * Don't be surprised if they self-destruct. */ - cp = LIST_FIRST(&pp->consumers); - while (cp != NULL) { - cp2 = LIST_NEXT(cp, consumers); + LIST_FOREACH_SAFE(cp, &pp->consumers, consumers, cp2) { KASSERT(cp->geom->orphan != NULL, ("geom %s has no orphan, class %s", cp->geom->name, cp->geom->class->name)); + cp->flags |= G_CF_ORPHAN; cp->geom->orphan(cp); - cp = cp2; } if (LIST_EMPTY(&pp->consumers) && wf) g_destroy_provider(pp); Modified: head/sys/geom/geom_io.c ============================================================================== --- head/sys/geom/geom_io.c Sun Jul 29 09:23:32 2012 (r238885) +++ head/sys/geom/geom_io.c Sun Jul 29 11:51:48 2012 (r238886) @@ -305,6 +305,8 @@ g_io_check(struct bio *bp) /* if provider is marked for error, don't disturb. */ if (pp->error) return (pp->error); + if (cp->flags & G_CF_ORPHAN) + return (ENXIO); switch(bp->bio_cmd) { case BIO_READ: Modified: head/sys/geom/geom_slice.c ============================================================================== --- head/sys/geom/geom_slice.c Sun Jul 29 09:23:32 2012 (r238885) +++ head/sys/geom/geom_slice.c Sun Jul 29 11:51:48 2012 (r238886) @@ -465,6 +465,7 @@ g_slice_spoiled(struct g_consumer *cp) g_topology_assert(); gp = cp->geom; g_trace(G_T_TOPOLOGY, "g_slice_spoiled(%p/%s)", cp, gp->name); + cp->flags |= G_CF_ORPHAN; gsp = gp->softc; gp->softc = NULL; g_slice_free(gsp); Modified: head/sys/geom/geom_subr.c ============================================================================== --- head/sys/geom/geom_subr.c Sun Jul 29 09:23:32 2012 (r238885) +++ head/sys/geom/geom_subr.c Sun Jul 29 11:51:48 2012 (r238886) @@ -262,10 +262,11 @@ g_modevent(module_t mod, int type, void static void g_retaste_event(void *arg, int flag) { - struct g_class *cp, *mp; - struct g_geom *gp, *gp2; + struct g_class *mp, *mp2; + struct g_geom *gp; struct g_hh00 *hh; struct g_provider *pp; + struct g_consumer *cp; g_topology_assert(); if (flag == EV_CANCEL) /* XXX: can't happen ? */ @@ -282,17 +283,20 @@ g_retaste_event(void *arg, int flag) } g_trace(G_T_TOPOLOGY, "g_retaste(%s)", mp->name); - LIST_FOREACH(cp, &g_classes, class) { - LIST_FOREACH(gp, &cp->geom, geom) { + LIST_FOREACH(mp2, &g_classes, class) { + LIST_FOREACH(gp, &mp2->geom, geom) { LIST_FOREACH(pp, &gp->provider, provider) { if (pp->acr || pp->acw || pp->ace) continue; - LIST_FOREACH(gp2, &mp->geom, geom) { - if (!strcmp(pp->name, gp2->name)) + LIST_FOREACH(cp, &pp->consumers, consumers) { + if (cp->geom->class == mp && + (cp->flags & G_CF_ORPHAN) == 0) break; } - if (gp2 != NULL) - g_wither_geom(gp2, ENXIO); + if (cp != NULL) { + cp->flags |= G_CF_ORPHAN; + g_wither_geom(cp->geom, ENXIO); + } mp->taste(mp, pp, 0); g_topology_assert(); } @@ -534,7 +538,7 @@ g_new_provider_event(void *arg, int flag { struct g_class *mp; struct g_provider *pp; - struct g_consumer *cp; + struct g_consumer *cp, *next_cp; g_topology_assert(); if (flag == EV_CANCEL) @@ -545,11 +549,17 @@ g_new_provider_event(void *arg, int flag G_VALID_PROVIDER(pp); KASSERT(!(pp->flags & G_PF_WITHER), ("g_new_provider_event but withered")); + LIST_FOREACH_SAFE(cp, &pp->consumers, consumers, next_cp) { + if ((cp->flags & G_CF_ORPHAN) == 0 && + cp->geom->attrchanged != NULL) + cp->geom->attrchanged(cp, "GEOM::media"); + } LIST_FOREACH(mp, &g_classes, class) { if (mp->taste == NULL) continue; LIST_FOREACH(cp, &pp->consumers, consumers) - if (cp->geom->class == mp) + if (cp->geom->class == mp && + (cp->flags & G_CF_ORPHAN) == 0) break; if (cp != NULL) continue; @@ -628,8 +638,10 @@ g_resize_provider_event(void *arg, int f LIST_FOREACH_SAFE(cp, &pp->consumers, consumers, cp2) { gp = cp->geom; - if (gp->resize == NULL && size < pp->mediasize) + if (gp->resize == NULL && size < pp->mediasize) { + cp->flags |= G_CF_ORPHAN; cp->geom->orphan(cp); + } } pp->mediasize = size; @@ -648,7 +660,8 @@ g_resize_provider_event(void *arg, int f if (mp->taste == NULL) continue; LIST_FOREACH(cp, &pp->consumers, consumers) - if (cp->geom->class == mp) + if (cp->geom->class == mp && + (cp->flags & G_CF_ORPHAN) == 0) break; if (cp != NULL) continue; @@ -867,7 +880,7 @@ g_access(struct g_consumer *cp, int dcr, * are probably just ahead of the event telling us that. Fail * now rather than having to unravel this later. */ - if (cp->geom->spoiled != NULL && cp->spoiled && + if (cp->geom->spoiled != NULL && (cp->flags & G_CF_SPOILED) && (dcr > 0 || dcw > 0 || dce > 0)) return (ENXIO); @@ -1017,6 +1030,7 @@ g_std_spoiled(struct g_consumer *cp) g_topology_assert(); G_VALID_CONSUMER(cp); g_trace(G_T_TOPOLOGY, "g_std_spoiled(%p)", cp); + cp->flags |= G_CF_ORPHAN; g_detach(cp); gp = cp->geom; LIST_FOREACH(pp, &gp->provider, provider) @@ -1052,9 +1066,9 @@ g_spoil_event(void *arg, int flag) G_VALID_PROVIDER(pp); for (cp = LIST_FIRST(&pp->consumers); cp != NULL; cp = cp2) { cp2 = LIST_NEXT(cp, consumers); - if (!cp->spoiled) + if ((cp->flags & G_CF_SPOILED) == 0) continue; - cp->spoiled = 0; + cp->flags &= ~G_CF_SPOILED; if (cp->geom->spoiled == NULL) continue; cp->geom->spoiled(cp); @@ -1079,11 +1093,54 @@ g_spoil(struct g_provider *pp, struct g_ KASSERT(cp2->acw == 0, ("spoiling cp->acw = %d", cp2->acw)); */ KASSERT(cp2->ace == 0, ("spoiling cp->ace = %d", cp2->ace)); - cp2->spoiled++; + cp2->flags |= G_CF_SPOILED; } g_post_event(g_spoil_event, pp, M_WAITOK, pp, NULL); } +static void +g_media_changed_event(void *arg, int flag) +{ + struct g_provider *pp; + int retaste; + + g_topology_assert(); + if (flag == EV_CANCEL) + return; + pp = arg; + G_VALID_PROVIDER(pp); + + /* + * If provider was not open for writing, queue retaste after spoiling. + * If it was, retaste will happen automatically on close. + */ + retaste = (pp->acw == 0 && pp->error == 0 && + !(pp->geom->flags & G_GEOM_WITHER)); + g_spoil_event(arg, flag); + if (retaste) + g_post_event(g_new_provider_event, pp, M_WAITOK, pp, NULL); +} + +int +g_media_changed(struct g_provider *pp, int flag) +{ + struct g_consumer *cp; + + LIST_FOREACH(cp, &pp->consumers, consumers) + cp->flags |= G_CF_SPOILED; + return (g_post_event(g_media_changed_event, pp, flag, pp, NULL)); +} + +int +g_media_gone(struct g_provider *pp, int flag) +{ + struct g_consumer *cp; + + LIST_FOREACH(cp, &pp->consumers, consumers) + cp->flags |= G_CF_SPOILED; + return (g_post_event(g_spoil_event, pp, flag, pp, NULL)); +} + int g_getattr__(const char *attr, struct g_consumer *cp, void *var, int len) { @@ -1239,15 +1296,15 @@ db_show_geom_consumer(int indent, struct cp->provider); } gprintln(" access: r%dw%de%d", cp->acr, cp->acw, cp->ace); - gprintln(" spoiled: %d", cp->spoiled); + gprintln(" flags: 0x%04x", cp->flags); gprintln(" nstart: %u", cp->nstart); gprintln(" nend: %u", cp->nend); } else { gprintf("consumer: %p (%s), access=r%dw%de%d", cp, cp->provider != NULL ? cp->provider->name : "none", cp->acr, cp->acw, cp->ace); - if (cp->spoiled) - db_printf(", spoiled=%d", cp->spoiled); + if (cp->flags) + db_printf(", flags=0x%04x", cp->flags); db_printf("\n"); } } Modified: head/sys/geom/geom_vfs.c ============================================================================== --- head/sys/geom/geom_vfs.c Sun Jul 29 09:23:32 2012 (r238885) +++ head/sys/geom/geom_vfs.c Sun Jul 29 11:51:48 2012 (r238886) @@ -65,11 +65,13 @@ static struct buf_ops __g_vfs_bufops = { struct buf_ops *g_vfs_bufops = &__g_vfs_bufops; static g_orphan_t g_vfs_orphan; +static g_spoiled_t g_vfs_spoiled; static struct g_class g_vfs_class = { .name = "VFS", .version = G_VERSION, .orphan = g_vfs_orphan, + .spoiled = g_vfs_spoiled, }; DECLARE_GEOM_CLASS(g_vfs_class, g_vfs); @@ -215,8 +217,35 @@ g_vfs_orphan(struct g_consumer *cp) if (sc == NULL) return; mtx_lock(&sc->sc_mtx); + destroy = (sc->sc_active == 0 && sc->sc_orphaned == 0); + sc->sc_orphaned = 1; + mtx_unlock(&sc->sc_mtx); + if (destroy) + g_vfs_destroy(cp, 0); + + /* + * Do not destroy the geom. Filesystem will do that during unmount. + */ +} + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sun Jul 29 14:21:42 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE5191065670; Sun, 29 Jul 2012 14:21:42 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 990F78FC08; Sun, 29 Jul 2012 14:21:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6TELgdh061265; Sun, 29 Jul 2012 14:21:42 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6TELgjB061263; Sun, 29 Jul 2012 14:21:42 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201207291421.q6TELgjB061263@svn.freebsd.org> From: Matt Jacob Date: Sun, 29 Jul 2012 14:21:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238887 - head/sys/dev/isp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 29 Jul 2012 14:21:42 -0000 Author: mjacob Date: Sun Jul 29 14:21:42 2012 New Revision: 238887 URL: http://svn.freebsd.org/changeset/base/238887 Log: Grr.!$()!$$ I missed checking this in even though I *did* run a tinderbox myself and caught the error. Change to isp_send_cmd needs a final ecmd argument. Sponsored by: Spectralogic MFC after: 1 month X-MFC: 238869 Modified: head/sys/dev/isp/isp_sbus.c Modified: head/sys/dev/isp/isp_sbus.c ============================================================================== --- head/sys/dev/isp/isp_sbus.c Sun Jul 29 11:51:48 2012 (r238886) +++ head/sys/dev/isp/isp_sbus.c Sun Jul 29 14:21:42 2012 (r238887) @@ -600,7 +600,7 @@ dma2(void *arg, bus_dma_segment_t *dm_se ddir = ISP_NOXFR; } - if (isp_send_cmd(isp, rq, dm_segs, nseg, XS_XFRLEN(csio), ddir) != CMD_QUEUED) { + if (isp_send_cmd(isp, rq, dm_segs, nseg, XS_XFRLEN(csio), ddir, NULL) != CMD_QUEUED) { mp->error = MUSHERR_NOQENTRIES; } } From owner-svn-src-head@FreeBSD.ORG Sun Jul 29 18:04:39 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41165106566C; Sun, 29 Jul 2012 18:04:39 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2B7B38FC21; Sun, 29 Jul 2012 18:04:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6TI4ddw080442; Sun, 29 Jul 2012 18:04:39 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6TI4cix080438; Sun, 29 Jul 2012 18:04:38 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201207291804.q6TI4cix080438@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 29 Jul 2012 18:04:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238888 - head/bin/sh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 29 Jul 2012 18:04:39 -0000 Author: jilles Date: Sun Jul 29 18:04:38 2012 New Revision: 238888 URL: http://svn.freebsd.org/changeset/base/238888 Log: sh: Fix EINTR race condition in "wait" and "set -T" using sigsuspend(). When waiting for child processes using "wait" or if "set -T" is in effect, a signal interrupts the wait. Make sure there is no window where the signal handler may be invoked (setting a flag) just before going to sleep. There is a similar race condition in the shell language, but scripts can avoid it by exiting from the trap handler or enforcing synchronization using a fifo. If SIGCHLD is not trapped, a signal handler must be installed for it. Only install this handler for the duration of the wait to avoid triggering unexpected [EINTR] errors elsewhere. Note that for some reason only SIGINT and SIGQUIT interrupt a "wait" command. This remains the case. Modified: head/bin/sh/jobs.c head/bin/sh/trap.c head/bin/sh/trap.h Modified: head/bin/sh/jobs.c ============================================================================== --- head/bin/sh/jobs.c Sun Jul 29 14:21:42 2012 (r238887) +++ head/bin/sh/jobs.c Sun Jul 29 18:04:38 2012 (r238888) @@ -87,6 +87,10 @@ int in_waitcmd = 0; /* are we in waitcm volatile sig_atomic_t breakwaitcmd = 0; /* should wait be terminated? */ static int ttyfd = -1; +/* mode flags for dowait */ +#define DOWAIT_BLOCK 0x1 /* wait until a child exits */ +#define DOWAIT_SIG 0x2 /* if DOWAIT_BLOCK, abort on signals */ + #if JOBS static void restartjob(struct job *); #endif @@ -518,7 +522,7 @@ waitcmd(int argc, char **argv) break; } } - } while (dowait(1, (struct job *)NULL) != -1); + } while (dowait(DOWAIT_BLOCK | DOWAIT_SIG, (struct job *)NULL) != -1); in_waitcmd--; return 0; @@ -965,7 +969,7 @@ waitforjob(struct job *jp, int *origstat INTOFF; TRACE(("waitforjob(%%%td) called\n", jp - jobtab + 1)); while (jp->state == 0) - if (dowait(1, jp) == -1) + if (dowait(DOWAIT_BLOCK | (Tflag ? DOWAIT_SIG : 0), jp) == -1) dotrap(); #if JOBS if (jp->jobctl) { @@ -1003,14 +1007,20 @@ waitforjob(struct job *jp, int *origstat } +static void +dummy_handler(int sig) +{ +} /* * Wait for a process to terminate. */ static pid_t -dowait(int block, struct job *job) +dowait(int mode, struct job *job) { + struct sigaction sa, osa; + sigset_t mask, omask; pid_t pid; int status; struct procstat *sp; @@ -1021,8 +1031,22 @@ dowait(int block, struct job *job) int sig; int coredump; int wflags; + int restore_sigchld; TRACE(("dowait(%d) called\n", block)); + restore_sigchld = 0; + if ((mode & DOWAIT_SIG) != 0) { + sigfillset(&mask); + sigprocmask(SIG_BLOCK, &mask, &omask); + INTOFF; + if (!issigchldtrapped()) { + restore_sigchld = 1; + sa.sa_handler = dummy_handler; + sa.sa_flags = 0; + sigemptyset(&sa.sa_mask); + sigaction(SIGCHLD, &sa, &osa); + } + } do { #if JOBS if (iflag) @@ -1030,13 +1054,25 @@ dowait(int block, struct job *job) else #endif wflags = 0; - if (block == 0) + if ((mode & (DOWAIT_BLOCK | DOWAIT_SIG)) != DOWAIT_BLOCK) wflags |= WNOHANG; pid = wait3(&status, wflags, (struct rusage *)NULL); TRACE(("wait returns %d, status=%d\n", (int)pid, status)); + if (pid == 0 && (mode & DOWAIT_SIG) != 0) { + sigsuspend(&omask); + pid = -1; + if (int_pending()) + break; + } } while (pid == -1 && errno == EINTR && breakwaitcmd == 0); if (pid == -1 && errno == ECHILD && job != NULL) job->state = JOBDONE; + if ((mode & DOWAIT_SIG) != 0) { + if (restore_sigchld) + sigaction(SIGCHLD, &osa, NULL); + sigprocmask(SIG_SETMASK, &omask, NULL); + INTON; + } if (breakwaitcmd != 0) { breakwaitcmd = 0; if (pid <= 0) Modified: head/bin/sh/trap.c ============================================================================== --- head/bin/sh/trap.c Sun Jul 29 14:21:42 2012 (r238887) +++ head/bin/sh/trap.c Sun Jul 29 18:04:38 2012 (r238888) @@ -368,6 +368,14 @@ ignoresig(int signo) } +int +issigchldtrapped(void) +{ + + return (trap[SIGCHLD] != NULL && *trap[SIGCHLD] != '\0'); +} + + /* * Signal handler. */ Modified: head/bin/sh/trap.h ============================================================================== --- head/bin/sh/trap.h Sun Jul 29 14:21:42 2012 (r238887) +++ head/bin/sh/trap.h Sun Jul 29 18:04:38 2012 (r238888) @@ -41,6 +41,7 @@ void clear_traps(void); int have_traps(void); void setsignal(int); void ignoresig(int); +int issigchldtrapped(void); void onsig(int); void dotrap(void); void setinteractive(int); From owner-svn-src-head@FreeBSD.ORG Sun Jul 29 18:20:50 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8DDAB106566B; Sun, 29 Jul 2012 18:20:50 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 793658FC0A; Sun, 29 Jul 2012 18:20:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6TIKo3M082495; Sun, 29 Jul 2012 18:20:50 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6TIKoig082493; Sun, 29 Jul 2012 18:20:50 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201207291820.q6TIKoig082493@svn.freebsd.org> From: Alan Cox Date: Sun, 29 Jul 2012 18:20:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238889 - head/sys/amd64/amd64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 29 Jul 2012 18:20:50 -0000 Author: alc Date: Sun Jul 29 18:20:49 2012 New Revision: 238889 URL: http://svn.freebsd.org/changeset/base/238889 Log: Shave off a few more cycles from pmap_enter()'s critical section. In particular, do a little less work with the PV list lock held. Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sun Jul 29 18:04:38 2012 (r238888) +++ head/sys/amd64/amd64/pmap.c Sun Jul 29 18:20:49 2012 (r238889) @@ -3446,6 +3446,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, KASSERT(va < UPT_MIN_ADDRESS || va >= UPT_MAX_ADDRESS, ("pmap_enter: invalid to pmap_enter page table pages (va: 0x%lx)", va)); + KASSERT((prot & access) == access, ("pmap_enter: access not in prot")); KASSERT((m->oflags & VPO_UNMANAGED) != 0 || va < kmi.clean_sva || va >= kmi.clean_eva, ("pmap_enter: managed mapping within the clean submap")); @@ -3453,7 +3454,9 @@ pmap_enter(pmap_t pmap, vm_offset_t va, VM_OBJECT_LOCKED(m->object), ("pmap_enter: page %p is not busy", m)); pa = VM_PAGE_TO_PHYS(m); - newpte = (pt_entry_t)(pa | pmap_cache_bits(m->md.pat_mode, 0) | PG_V); + newpte = (pt_entry_t)(pa | PG_A | PG_V); + if ((access & VM_PROT_WRITE) != 0) + newpte |= PG_M; if ((prot & VM_PROT_WRITE) != 0) newpte |= PG_RW; if ((prot & VM_PROT_EXECUTE) == 0) @@ -3464,6 +3467,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, newpte |= PG_U; if (pmap == kernel_pmap) newpte |= PG_G; + newpte |= pmap_cache_bits(m->md.pat_mode, 0); mpte = om = NULL; @@ -3495,7 +3499,6 @@ retry: panic("pmap_enter: invalid page directory va=%#lx", va); origpte = *pte; - opa = origpte & PG_FRAME; /* * Is the specified virtual address already mapped? @@ -3507,9 +3510,9 @@ retry: * are valid mappings in them. Hence, if a user page is wired, * the PT page will be also. */ - if (wired && (origpte & PG_W) == 0) + if ((newpte & PG_W) != 0 && (origpte & PG_W) == 0) pmap->pm_stats.wired_count++; - else if (!wired && (origpte & PG_W)) + else if ((newpte & PG_W) == 0 && (origpte & PG_W) != 0) pmap->pm_stats.wired_count--; /* @@ -3523,17 +3526,20 @@ retry: } /* - * Has the mapping changed? + * Has the physical page changed? */ + opa = origpte & PG_FRAME; if (opa == pa) { /* * No, might be a protection or wiring change. */ if ((origpte & PG_MANAGED) != 0) { newpte |= PG_MANAGED; + if ((newpte & PG_RW) != 0) + vm_page_aflag_set(m, PGA_WRITEABLE); om = m; } - if ((origpte & ~(PG_M | PG_A)) == newpte) + if (((origpte ^ newpte) & ~(PG_M | PG_A)) == 0) goto unchanged; goto validate; } else { @@ -3547,7 +3553,7 @@ retry: /* * Increment the counters. */ - if (wired) + if ((newpte & PG_W) != 0) pmap->pm_stats.wired_count++; pmap_resident_count_inc(pmap, 1); } @@ -3561,21 +3567,18 @@ retry: pv->pv_va = va; CHANGE_PV_LIST_LOCK_TO_PHYS(&lock, pa); TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); + if ((newpte & PG_RW) != 0) + vm_page_aflag_set(m, PGA_WRITEABLE); } -validate: - /* * Update the PTE. */ - newpte |= PG_A; - if ((access & VM_PROT_WRITE) != 0) - newpte |= PG_M; - if ((newpte & (PG_MANAGED | PG_RW)) == (PG_MANAGED | PG_RW)) - vm_page_aflag_set(m, PGA_WRITEABLE); if ((origpte & PG_V) != 0) { +validate: invlva = FALSE; origpte = pte_load_store(pte, newpte); + opa = origpte & PG_FRAME; if ((origpte & PG_A) != 0 && (opa != pa || ((origpte & PG_NX) == 0 && (newpte & PG_NX) != 0))) invlva = TRUE; From owner-svn-src-head@FreeBSD.ORG Sun Jul 29 20:04:10 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2B334106566C; Sun, 29 Jul 2012 20:04:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 167B28FC1A; Sun, 29 Jul 2012 20:04:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6TK49iF095467; Sun, 29 Jul 2012 20:04:09 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6TK496t095465; Sun, 29 Jul 2012 20:04:09 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201207292004.q6TK496t095465@svn.freebsd.org> From: Alexander Motin Date: Sun, 29 Jul 2012 20:04:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238892 - head/sys/geom X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 29 Jul 2012 20:04:10 -0000 Author: mav Date: Sun Jul 29 20:04:09 2012 New Revision: 238892 URL: http://svn.freebsd.org/changeset/base/238892 Log: Partially revert r238886 in part of GEOM_VFS spoiling. This change triggered interesting foot shooting condition in GEOM when RW access to root partition by fsck spoils VFS geom there, which has it opened RO at the same time. Seems spoiling concept needs some rework. Modified: head/sys/geom/geom_vfs.c Modified: head/sys/geom/geom_vfs.c ============================================================================== --- head/sys/geom/geom_vfs.c Sun Jul 29 18:52:18 2012 (r238891) +++ head/sys/geom/geom_vfs.c Sun Jul 29 20:04:09 2012 (r238892) @@ -65,13 +65,11 @@ static struct buf_ops __g_vfs_bufops = { struct buf_ops *g_vfs_bufops = &__g_vfs_bufops; static g_orphan_t g_vfs_orphan; -static g_spoiled_t g_vfs_spoiled; static struct g_class g_vfs_class = { .name = "VFS", .version = G_VERSION, .orphan = g_vfs_orphan, - .spoiled = g_vfs_spoiled, }; DECLARE_GEOM_CLASS(g_vfs_class, g_vfs); @@ -217,35 +215,8 @@ g_vfs_orphan(struct g_consumer *cp) if (sc == NULL) return; mtx_lock(&sc->sc_mtx); - destroy = (sc->sc_active == 0 && sc->sc_orphaned == 0); - sc->sc_orphaned = 1; - mtx_unlock(&sc->sc_mtx); - if (destroy) - g_vfs_destroy(cp, 0); - - /* - * Do not destroy the geom. Filesystem will do that during unmount. - */ -} - -static void -g_vfs_spoiled(struct g_consumer *cp) -{ - struct g_geom *gp; - struct g_vfs_softc *sc; - int destroy; - - g_topology_assert(); - - gp = cp->geom; - g_trace(G_T_TOPOLOGY, "g_vfs_spoiled(%p(%s))", cp, gp->name); - cp->flags |= G_CF_ORPHAN; - sc = gp->softc; - if (sc == NULL) - return; - mtx_lock(&sc->sc_mtx); - destroy = (sc->sc_active == 0 && sc->sc_orphaned == 0); sc->sc_orphaned = 1; + destroy = (sc->sc_active == 0); mtx_unlock(&sc->sc_mtx); if (destroy) g_vfs_destroy(cp, 0); From owner-svn-src-head@FreeBSD.ORG Sun Jul 29 20:36:25 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 95E381065672; Sun, 29 Jul 2012 20:36:25 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) by mx1.freebsd.org (Postfix) with ESMTP id 4C62E8FC15; Sun, 29 Jul 2012 20:36:25 +0000 (UTC) Received: from slw by zxy.spb.ru with local (Exim 4.69 (FreeBSD)) (envelope-from ) id 1SvaGG-000Hr1-M6; Mon, 30 Jul 2012 00:38:48 +0400 Date: Mon, 30 Jul 2012 00:38:48 +0400 From: Slawa Olhovchenkov To: Bernhard Schmidt Message-ID: <20120729203848.GA88729@zxy.spb.ru> References: <201204261735.q3QHZCH4060106@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201204261735.q3QHZCH4060106@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r234711 - in head/usr.sbin/wpa: . hostapd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 29 Jul 2012 20:36:25 -0000 On Thu, Apr 26, 2012 at 05:35:12PM +0000, Bernhard Schmidt wrote: > Author: bschmidt > Date: Thu Apr 26 17:35:11 2012 > New Revision: 234711 > URL: http://svn.freebsd.org/changeset/base/234711 > > Log: > fix EAP server support after the 0.7.3 import: > - eap_xxx.c files have been renamed to eap_server_xxx.c > - additional crypto files are required for some options > - EAP_MD5 and EAP_GTC is now enabled by default to match vendor config > - move each file on its own line to hopefully make further diffs easier > to read > > EAP_SERVER is now enabled by default. Fiddling with HOSTAPD_CFLAGS in > src.conf is no longer required to get a basic WPA-EAP/radius setup > running. No support for EAP_SERVER_PSK? Not enabled EAP_SERVER_PSK or EAP_SERVER_GPSK? From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 01:42:22 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C5C451065675; Mon, 30 Jul 2012 01:42:22 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A660B8FC0C; Mon, 30 Jul 2012 01:42:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6U1gMXV033757; Mon, 30 Jul 2012 01:42:22 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6U1gMgY033755; Mon, 30 Jul 2012 01:42:22 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207300142.q6U1gMgY033755@svn.freebsd.org> From: Adrian Chadd Date: Mon, 30 Jul 2012 01:42:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238893 - head/tools/tools/ath/athratestats X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 01:42:22 -0000 Author: adrian Date: Mon Jul 30 01:42:22 2012 New Revision: 238893 URL: http://svn.freebsd.org/changeset/base/238893 Log: Break out the parsing code from main() and modularise things a little. The eventual aim will be to support listing "one" and "all" stations for the given ath device. Modified: head/tools/tools/ath/athratestats/main.c Modified: head/tools/tools/ath/athratestats/main.c ============================================================================== --- head/tools/tools/ath/athratestats/main.c Sun Jul 29 20:04:09 2012 (r238892) +++ head/tools/tools/ath/athratestats/main.c Mon Jul 30 01:42:22 2012 (r238893) @@ -170,18 +170,69 @@ ath_rate_ioctl(struct ath_ratestats *r) err(1, "ioctl"); } -int -main(int argc, char *argv[]) +static int +rate_node_stats(struct ath_ratestats *r, struct ether_addr *e) { - struct ath_ratestats r; - struct ether_addr *e; - uint8_t *buf; struct ath_rateioctl_tlv *av; struct sample_node *sn = NULL; struct ath_rateioctl_rt *rt = NULL; + int error = 0; + uint8_t *buf = r->re.buf; + + /* + * For now, hard-code the TLV order and contents. Ew! + */ + av = (struct ath_rateioctl_tlv *) buf; + if (av->tlv_id != ATH_RATE_TLV_RATETABLE) { + fprintf(stderr, "unexpected rate control TLV (got 0x%x, " + "expected 0x%x\n", + av->tlv_id, + ATH_RATE_TLV_RATETABLE); + exit(127); + } + if (av->tlv_len != sizeof(struct ath_rateioctl_rt)) { + fprintf(stderr, "unexpected TLV len (got %d bytes, " + "expected %d bytes\n", + av->tlv_len, + sizeof(struct ath_rateioctl_rt)); + exit(127); + } + rt = (void *) (buf + sizeof(struct ath_rateioctl_tlv)); + + /* Next */ + av = (void *) (buf + sizeof(struct ath_rateioctl_tlv) + + sizeof(struct ath_rateioctl_rt)); + if (av->tlv_id != ATH_RATE_TLV_SAMPLENODE) { + fprintf(stderr, "unexpected rate control TLV (got 0x%x, " + "expected 0x%x\n", + av->tlv_id, + ATH_RATE_TLV_SAMPLENODE); + exit(127); + } + if (av->tlv_len != sizeof(struct sample_node)) { + fprintf(stderr, "unexpected TLV len (got %d bytes, " + "expected %d bytes\n", + av->tlv_len, + sizeof(struct sample_node)); + exit(127); + } + sn = (void *) (buf + sizeof(struct ath_rateioctl_tlv) + + sizeof(struct ath_rateioctl_rt) + + sizeof(struct ath_rateioctl_tlv)); + + ath_sample_stats(r, rt, sn); +} + + +int +main(int argc, char *argv[]) +{ char const *ifname = NULL, *macaddr = NULL; int c; int do_all = 0; + struct ether_addr *e; + struct ath_ratestats r; + uint8_t *buf; ifname = getenv("ATH"); if (ifname == NULL) @@ -207,18 +258,6 @@ main(int argc, char *argv[]) } } - buf = calloc(1, STATS_BUF_SIZE); - if (buf == NULL) - err(1, "calloc"); - - bzero(&r, sizeof(r)); - r.s = socket(AF_INET, SOCK_DGRAM, 0); - if (r.s < 0) { - err(1, "socket"); - } - /* XXX error check */ - ath_setifname(&r, ifname); - if (macaddr == NULL) { errx(1, "%s: macaddress wasn't supplied and no -a given\n", argv[0]); @@ -228,53 +267,40 @@ main(int argc, char *argv[]) if (e == NULL) err(1, "ether_aton"); + bzero(&r, sizeof(r)); + + /* + * Persistent buffer for each lookup + */ + buf = malloc(STATS_BUF_SIZE); + if (buf == NULL) + err(1, "calloc"); + r.re.buf = buf; r.re.len = STATS_BUF_SIZE; - ath_setsta(&r, e->octet); - ath_rate_ioctl(&r); + r.s = socket(AF_INET, SOCK_DGRAM, 0); + if (r.s < 0) { + err(1, "socket"); + } + /* XXX error check */ + ath_setifname(&r, ifname); + + /* Zero the buffer before it's passed in */ + memset(buf, '\0', STATS_BUF_SIZE); /* - * For now, hard-code the TLV order and contents. Ew! + * Set the station address for this lookup. */ - av = (struct ath_rateioctl_tlv *) buf; - if (av->tlv_id != ATH_RATE_TLV_RATETABLE) { - fprintf(stderr, "unexpected rate control TLV (got 0x%x, " - "expected 0x%x\n", - av->tlv_id, - ATH_RATE_TLV_RATETABLE); - exit(127); - } - if (av->tlv_len != sizeof(struct ath_rateioctl_rt)) { - fprintf(stderr, "unexpected TLV len (got %d bytes, " - "expected %d bytes\n", - av->tlv_len, - sizeof(struct ath_rateioctl_rt)); - exit(127); - } - rt = (void *) (buf + sizeof(struct ath_rateioctl_tlv)); + ath_setsta(&r, e->octet); - /* Next */ - av = (void *) (buf + sizeof(struct ath_rateioctl_tlv) + - sizeof(struct ath_rateioctl_rt)); - if (av->tlv_id != ATH_RATE_TLV_SAMPLENODE) { - fprintf(stderr, "unexpected rate control TLV (got 0x%x, " - "expected 0x%x\n", - av->tlv_id, - ATH_RATE_TLV_SAMPLENODE); - exit(127); - } - if (av->tlv_len != sizeof(struct sample_node)) { - fprintf(stderr, "unexpected TLV len (got %d bytes, " - "expected %d bytes\n", - av->tlv_len, - sizeof(struct sample_node)); - exit(127); - } - sn = (void *) (buf + sizeof(struct ath_rateioctl_tlv) + - sizeof(struct ath_rateioctl_rt) + - sizeof(struct ath_rateioctl_tlv)); + /* + * Fetch the data from the driver. + */ + ath_rate_ioctl(&r); - ath_sample_stats(&r, rt, sn); + /* + * Decode and parse statistics. + */ + rate_node_stats(&r, e); } - From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 03:00:59 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26504106566C; Mon, 30 Jul 2012 03:00:59 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB3AA8FC17; Mon, 30 Jul 2012 03:00:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6U30wfh039908; Mon, 30 Jul 2012 03:00:58 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6U30w2x039903; Mon, 30 Jul 2012 03:00:58 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201207300300.q6U30w2x039903@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 30 Jul 2012 03:00:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238894 - in head/sys: cam/scsi modules/cam X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 03:00:59 -0000 Author: bz Date: Mon Jul 30 03:00:58 2012 New Revision: 238894 URL: http://svn.freebsd.org/changeset/base/238894 Log: Remove opt_enc.h from files committed with r235911. enc(4) is the 'encapsulating interface' used with IPsec and has nothing to do with storage 'enclosure' services. MFC after: 3 days Noticed while: debugging why enc(4) is no longer automatically created Modified: head/sys/cam/scsi/scsi_enc.c head/sys/cam/scsi/scsi_enc_safte.c head/sys/cam/scsi/scsi_enc_ses.c head/sys/modules/cam/Makefile Modified: head/sys/cam/scsi/scsi_enc.c ============================================================================== --- head/sys/cam/scsi/scsi_enc.c Mon Jul 30 01:42:22 2012 (r238893) +++ head/sys/cam/scsi/scsi_enc.c Mon Jul 30 03:00:58 2012 (r238894) @@ -56,8 +56,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - MALLOC_DEFINE(M_SCSIENC, "SCSI ENC", "SCSI ENC buffers"); /* Enclosure type independent driver */ Modified: head/sys/cam/scsi/scsi_enc_safte.c ============================================================================== --- head/sys/cam/scsi/scsi_enc_safte.c Mon Jul 30 01:42:22 2012 (r238893) +++ head/sys/cam/scsi/scsi_enc_safte.c Mon Jul 30 03:00:58 2012 (r238894) @@ -48,8 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - /* * SAF-TE Type Device Emulation */ Modified: head/sys/cam/scsi/scsi_enc_ses.c ============================================================================== --- head/sys/cam/scsi/scsi_enc_ses.c Mon Jul 30 01:42:22 2012 (r238893) +++ head/sys/cam/scsi/scsi_enc_ses.c Mon Jul 30 03:00:58 2012 (r238894) @@ -56,8 +56,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - /* SES Native Type Device Support */ /* SES Diagnostic Page Codes */ Modified: head/sys/modules/cam/Makefile ============================================================================== --- head/sys/modules/cam/Makefile Mon Jul 30 01:42:22 2012 (r238893) +++ head/sys/modules/cam/Makefile Mon Jul 30 03:00:58 2012 (r238894) @@ -14,7 +14,6 @@ SRCS+= opt_scsi.h SRCS+= opt_cd.h SRCS+= opt_pt.h SRCS+= opt_sa.h -SRCS+= opt_enc.h SRCS+= device_if.h bus_if.h vnode_if.h SRCS+= cam.c .if exists($S/${MACHINE}/${MACHINE}/cam_machdep.c) From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 06:00:32 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 408641065672; Mon, 30 Jul 2012 06:00:32 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 121DD8FC17; Mon, 30 Jul 2012 06:00:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6U60VHI054682; Mon, 30 Jul 2012 06:00:31 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6U60VDE054680; Mon, 30 Jul 2012 06:00:31 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201207300600.q6U60VDE054680@svn.freebsd.org> From: Warner Losh Date: Mon, 30 Jul 2012 06:00:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238895 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 06:00:32 -0000 Author: imp Date: Mon Jul 30 06:00:31 2012 New Revision: 238895 URL: http://svn.freebsd.org/changeset/base/238895 Log: Fix a couple of comments about the rm9200, and fix a couple of indentation issues. Add note that we need to implement at91sam9260 erratum workaround. Modified: head/sys/arm/at91/if_ate.c Modified: head/sys/arm/at91/if_ate.c ============================================================================== --- head/sys/arm/at91/if_ate.c Mon Jul 30 03:00:58 2012 (r238894) +++ head/sys/arm/at91/if_ate.c Mon Jul 30 06:00:31 2012 (r238895) @@ -569,8 +569,6 @@ ate_activate(device_t dev) /* * DMA tag and map for the TX descriptors. - * XXX Old EMAC (not EMACB) doesn't really need DMA'able - * memory. We could just malloc it. gja XXX */ if (bus_dma_tag_create(bus_get_dma_tag(dev), sizeof(eth_tx_desc_t), 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, @@ -606,11 +604,10 @@ ate_activate(device_t dev) if (sc->is_emacb) { /* Write the descriptor queue address. */ WR4(sc, ETHB_TBQP, sc->tx_desc_phys); - } - /* EMACB: Enable transceiver input clock */ - if (sc->is_emacb) + /* EMACB: Enable transceiver input clock */ WR4(sc, ETHB_UIO, RD4(sc, ETHB_UIO) | ETHB_UIO_CLKE); + } return (0); @@ -676,7 +673,7 @@ ate_deactivate(struct ate_softc *sc) } if (sc->is_emacb) - WR4(sc, ETHB_UIO, RD4(sc, ETHB_UIO) & ~ETHB_UIO_CLKE); + WR4(sc, ETHB_UIO, RD4(sc, ETHB_UIO) & ~ETHB_UIO_CLKE); } /* @@ -849,12 +846,11 @@ ate_intr(void *xsc) return; if (status & ETH_ISR_RCOM) { - - bus_dmamap_sync(sc->rx_desc_tag, sc->rx_desc_map, + bus_dmamap_sync(sc->rx_desc_tag, sc->rx_desc_map, BUS_DMASYNC_POSTREAD); - rxdhead = &sc->rx_descs[sc->rxhead]; - while (rxdhead->addr & ETH_CPU_OWNER) { + rxdhead = &sc->rx_descs[sc->rxhead]; + while (rxdhead->addr & ETH_CPU_OWNER) { if (!sc->is_emacb) { /* * Simulate SAM9 FIRST/LAST bits for RM9200. @@ -933,7 +929,8 @@ ate_intr(void *xsc) /* XXX Performance robbing copy. Could * recieve directly to mbufs if not an - * RM9200. XXX */ + * RM9200. And even then we could likely + * copy just the protocol headers. XXX */ m_append(mb, count, sc->rx_buf[sc->rxhead]); remain -= count; } @@ -1014,6 +1011,9 @@ ate_intr(void *xsc) BARRIER(sc, ETH_CTL, 4, BUS_SPACE_BARRIER_WRITE); WR4(sc, ETH_CTL, reg | ETH_CTL_RE); } + + /* XXX need to work around SAM9260 errata 43.2.4.1: + * disable the mac, reset tx buffer, enable mac on TUND */ } /* @@ -1269,7 +1269,7 @@ atestop(struct ate_softc *sc) /* Turn off transeiver input clock */ if (sc->is_emacb) - WR4(sc, ETHB_UIO, RD4(sc, ETHB_UIO) & ~ETHB_UIO_CLKE); + WR4(sc, ETHB_UIO, RD4(sc, ETHB_UIO) & ~ETHB_UIO_CLKE); /* * XXX we should power down the EMAC if it isn't in use, after From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 07:13:07 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 328841065672; Mon, 30 Jul 2012 07:13:07 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C4468FC1B; Mon, 30 Jul 2012 07:13:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6U7D6a4060640; Mon, 30 Jul 2012 07:13:06 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6U7D6U8060637; Mon, 30 Jul 2012 07:13:06 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <201207300713.q6U7D6U8060637@svn.freebsd.org> From: Brian Somers Date: Mon, 30 Jul 2012 07:13:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238896 - head/usr.bin/script X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 07:13:07 -0000 Author: brian Date: Mon Jul 30 07:13:06 2012 New Revision: 238896 URL: http://svn.freebsd.org/changeset/base/238896 Log: Add d, p and r switches for recording script sessions with timing data and playing sessions back with or without time delays. PR: 114465 Submitted by: ighighi at gmail dot com MFC after: 3 weeks Modified: head/usr.bin/script/script.1 head/usr.bin/script/script.c Modified: head/usr.bin/script/script.1 ============================================================================== --- head/usr.bin/script/script.1 Mon Jul 30 06:00:31 2012 (r238895) +++ head/usr.bin/script/script.1 Mon Jul 30 07:13:06 2012 (r238896) @@ -36,7 +36,7 @@ .Nd make typescript of terminal session .Sh SYNOPSIS .Nm -.Op Fl akq +.Op Fl adkpqr .Op Fl t Ar time .Op Ar file Op Ar command ... .Sh DESCRIPTION @@ -72,10 +72,20 @@ Append the output to or .Pa typescript , retaining the prior contents. +.It Fl d +When playing back a session with the +.Fl p +flag, don't sleep between records when playing back a timestamped session. .It Fl k Log keys sent to the program as well as output. +.It Fl p +Play back a session recorded with the +.Fl r +flag in real time. .It Fl q -Run in quiet mode, omit the start and stop status messages. +Run in quiet mode, omit the start, stop and command status messages. +.It Fl r +Record a session with input, output, and timestamping. .It Fl t Ar time Specify the interval at which the script output file will be flushed to disk, in seconds. @@ -151,6 +161,14 @@ The .Nm command appeared in .Bx 3.0 . +.Pp +The +.Fl d , +.Fl p +and +.Fl r +options first appeared in +.Nx 2.0 . .Sh BUGS The .Nm Modified: head/usr.bin/script/script.c ============================================================================== --- head/usr.bin/script/script.c Mon Jul 30 06:00:31 2012 (r238895) +++ head/usr.bin/script/script.c Mon Jul 30 07:13:06 2012 (r238896) @@ -46,6 +46,9 @@ static const char sccsid[] = "@(#)script #include #include #include +#include +#include +#include #include #include @@ -59,11 +62,21 @@ static const char sccsid[] = "@(#)script #include #include +#define DEF_BUF 65536 + +struct stamp { + uint64_t scr_len; /* amount of data */ + uint64_t scr_sec; /* time it arrived in seconds... */ + uint32_t scr_usec; /* ...and microseconds */ + uint32_t scr_direction; /* 'i', 'o', etc (also indicates endianness) */ +}; + static FILE *fscript; static int master, slave; static int child; static const char *fname; static int qflg, ttyflg; +static int usesleep, rawout; static struct termios tt; @@ -71,6 +84,9 @@ static void done(int) __dead2; static void doshell(char **); static void fail(void); static void finish(void); +static void record(FILE *, char *, size_t, int); +static void consume(FILE *, off_t, char *, int); +static void playback(FILE *) __dead2; static void usage(void); int @@ -79,7 +95,7 @@ main(int argc, char *argv[]) int cc; struct termios rtt, stt; struct winsize win; - int aflg, kflg, ch, n; + int aflg, kflg, pflg, ch, n; struct timeval tv, *tvp; time_t tvec, start; char obuf[BUFSIZ]; @@ -87,19 +103,32 @@ main(int argc, char *argv[]) fd_set rfd; int flushtime = 30; int readstdin; + int k; + + aflg = kflg = pflg = 0; + usesleep = 1; + rawout = 0; - aflg = kflg = 0; - while ((ch = getopt(argc, argv, "aqkt:")) != -1) + while ((ch = getopt(argc, argv, "adkpqrt:")) != -1) switch(ch) { case 'a': aflg = 1; break; - case 'q': - qflg = 1; + case 'd': + usesleep = 0; break; case 'k': kflg = 1; break; + case 'p': + pflg = 1; + break; + case 'q': + qflg = 1; + break; + case 'r': + rawout = 1; + break; case 't': flushtime = atoi(optarg); if (flushtime < 0) @@ -119,9 +148,12 @@ main(int argc, char *argv[]) } else fname = "typescript"; - if ((fscript = fopen(fname, aflg ? "a" : "w")) == NULL) + if ((fscript = fopen(fname, pflg ? "r" : aflg ? "a" : "w")) == NULL) err(1, "%s", fname); + if (pflg) + playback(fscript); + if ((ttyflg = isatty(STDIN_FILENO)) != 0) { if (tcgetattr(STDIN_FILENO, &tt) == -1) err(1, "tcgetattr"); @@ -134,10 +166,23 @@ main(int argc, char *argv[]) err(1, "openpty"); } + if (rawout) + record(fscript, NULL, 0, 's'); + if (!qflg) { tvec = time(NULL); (void)printf("Script started, output file is %s\n", fname); - (void)fprintf(fscript, "Script started on %s", ctime(&tvec)); + if (!rawout) { + (void)fprintf(fscript, "Script started on %s", + ctime(&tvec)); + if (argv[0]) { + fprintf(fscript, "command: "); + for (k = 0 ; argv[k] ; ++k) + fprintf(fscript, "%s%s", k ? " " : "", + argv[k]); + fprintf(fscript, "\n"); + } + } fflush(fscript); } if (ttyflg) { @@ -163,15 +208,12 @@ main(int argc, char *argv[]) FD_SET(master, &rfd); if (readstdin) FD_SET(STDIN_FILENO, &rfd); - if (!readstdin && ttyflg) { - tv.tv_sec = 1; + if ((!readstdin && ttyflg) || flushtime > 0) { + tv.tv_sec = !readstdin && ttyflg ? 1 : + flushtime - (tvec - start); tv.tv_usec = 0; tvp = &tv; readstdin = 1; - } else if (flushtime > 0) { - tv.tv_sec = flushtime - (tvec - start); - tv.tv_usec = 0; - tvp = &tv; } else { tvp = NULL; } @@ -190,6 +232,8 @@ main(int argc, char *argv[]) readstdin = 0; } if (cc > 0) { + if (rawout) + record(fscript, ibuf, cc, 'i'); (void)write(master, ibuf, cc); if (kflg && tcgetattr(master, &stt) >= 0 && ((stt.c_lflag & ECHO) == 0)) { @@ -202,7 +246,10 @@ main(int argc, char *argv[]) if (cc <= 0) break; (void)write(STDOUT_FILENO, obuf, cc); - (void)fwrite(obuf, 1, cc, fscript); + if (rawout) + record(fscript, obuf, cc, 'o'); + else + (void)fwrite(obuf, 1, cc, fscript); } tvec = time(0); if (tvec - start >= flushtime) { @@ -218,7 +265,7 @@ static void usage(void) { (void)fprintf(stderr, - "usage: script [-akq] [-t time] [file [command ...]]\n"); + "usage: script [-adkpqr] [-t time] [file [command ...]]\n"); exit(1); } @@ -242,17 +289,11 @@ static void doshell(char **av) { const char *shell; - int k; shell = getenv("SHELL"); if (shell == NULL) shell = _PATH_BSHELL; - if (av[0]) - for (k = 0 ; av[k] ; ++k) - fprintf(fscript, "%s%s", k ? " " : "", av[k]); - fprintf(fscript, "\r\n"); - (void)close(master); (void)fclose(fscript); login_tty(slave); @@ -282,11 +323,144 @@ done(int eno) if (ttyflg) (void)tcsetattr(STDIN_FILENO, TCSAFLUSH, &tt); tvec = time(NULL); + if (rawout) + record(fscript, NULL, 0, 'e'); if (!qflg) { - (void)fprintf(fscript,"\nScript done on %s", ctime(&tvec)); + if (!rawout) + (void)fprintf(fscript,"\nScript done on %s", + ctime(&tvec)); (void)printf("\nScript done, output file is %s\n", fname); } (void)fclose(fscript); (void)close(master); exit(eno); } + +static void +record(FILE *fp, char *buf, size_t cc, int direction) +{ + struct iovec iov[2]; + struct stamp stamp; + struct timeval tv; + + (void)gettimeofday(&tv, NULL); + stamp.scr_len = cc; + stamp.scr_sec = tv.tv_sec; + stamp.scr_usec = tv.tv_usec; + stamp.scr_direction = direction; + iov[0].iov_len = sizeof(stamp); + iov[0].iov_base = &stamp; + iov[1].iov_len = cc; + iov[1].iov_base = buf; + if (writev(fileno(fp), &iov[0], 2) == -1) + err(1, "writev"); +} + +static void +consume(FILE *fp, off_t len, char *buf, int reg) +{ + size_t l; + + if (reg) { + if (fseeko(fp, len, SEEK_CUR) == -1) + err(1, NULL); + } + else { + while (len > 0) { + l = MIN(DEF_BUF, len); + if (fread(buf, sizeof(char), l, fp) != l) + err(1, "cannot read buffer"); + len -= l; + } + } +} + +#define swapstamp(stamp) do { \ + if (stamp.scr_direction > 0xff) { \ + stamp.scr_len = bswap64(stamp.scr_len); \ + stamp.scr_sec = bswap64(stamp.scr_sec); \ + stamp.scr_usec = bswap32(stamp.scr_usec); \ + stamp.scr_direction = bswap32(stamp.scr_direction); \ + } \ +} while (0/*CONSTCOND*/) + +static void +playback(FILE *fp) +{ + struct timespec tsi, tso; + struct stamp stamp; + struct stat pst; + char buf[DEF_BUF]; + off_t nread, save_len; + size_t l; + time_t tclock; + int reg; + + if (fstat(fileno(fp), &pst) == -1) + err(1, "fstat failed"); + + reg = S_ISREG(pst.st_mode); + + for (nread = 0; !reg || nread < pst.st_size; nread += save_len) { + if (fread(&stamp, sizeof(stamp), 1, fp) != 1) { + if (reg) + err(1, "reading playback header"); + else + break; + } + swapstamp(stamp); + save_len = sizeof(stamp); + + if (reg && stamp.scr_len > + (uint64_t)(pst.st_size - save_len) - nread) + errx(1, "invalid stamp"); + + save_len += stamp.scr_len; + tclock = stamp.scr_sec; + tso.tv_sec = stamp.scr_sec; + tso.tv_nsec = stamp.scr_usec * 1000; + + switch (stamp.scr_direction) { + case 's': + if (!qflg) + (void)printf("Script started on %s", + ctime(&tclock)); + tsi = tso; + (void)consume(fp, stamp.scr_len, buf, reg); + break; + case 'e': + if (!qflg) + (void)printf("\nScript done on %s", + ctime(&tclock)); + (void)consume(fp, stamp.scr_len, buf, reg); + break; + case 'i': + /* throw input away */ + (void)consume(fp, stamp.scr_len, buf, reg); + break; + case 'o': + tsi.tv_sec = tso.tv_sec - tsi.tv_sec; + tsi.tv_nsec = tso.tv_nsec - tsi.tv_nsec; + if (tsi.tv_nsec < 0) { + tsi.tv_sec -= 1; + tsi.tv_nsec += 1000000000; + } + if (usesleep) + (void)nanosleep(&tsi, NULL); + tsi = tso; + while (stamp.scr_len > 0) { + l = MIN(DEF_BUF, stamp.scr_len); + if (fread(buf, sizeof(char), l, fp) != l) + err(1, "cannot read buffer"); + + (void)write(STDOUT_FILENO, buf, l); + stamp.scr_len -= l; + } + break; + default: + errx(1, "invalid direction"); + } + } + (void)fclose(fp); + exit(0); +} From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 08:06:01 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9816B1065672; Mon, 30 Jul 2012 08:06:01 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 83AB58FC15; Mon, 30 Jul 2012 08:06:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6U861Ae065075; Mon, 30 Jul 2012 08:06:01 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6U861cD065073; Mon, 30 Jul 2012 08:06:01 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <201207300806.q6U861cD065073@svn.freebsd.org> From: Brian Somers Date: Mon, 30 Jul 2012 08:06:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238897 - head/usr.bin/script X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 08:06:01 -0000 Author: brian Date: Mon Jul 30 08:06:00 2012 New Revision: 238897 URL: http://svn.freebsd.org/changeset/base/238897 Log: Mention when -d, -p and -r first hit FreeBSD. Bump the document date to when the change was made (rather than when the PR was submitted). Suggested by: pluknet Modified: head/usr.bin/script/script.1 Modified: head/usr.bin/script/script.1 ============================================================================== --- head/usr.bin/script/script.1 Mon Jul 30 07:13:06 2012 (r238896) +++ head/usr.bin/script/script.1 Mon Jul 30 08:06:00 2012 (r238897) @@ -28,7 +28,7 @@ .\" @(#)script.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd September 28, 2011 +.Dd July 30, 2012 .Dt SCRIPT 1 .Os .Sh NAME @@ -168,7 +168,9 @@ The and .Fl r options first appeared in -.Nx 2.0 . +.Nx 2.0 +and were ported to +.Fx 10 . .Sh BUGS The .Nm From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 08:56:57 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 466BC106564A; Mon, 30 Jul 2012 08:56:57 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 310E28FC1A; Mon, 30 Jul 2012 08:56:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6U8uv1h069328; Mon, 30 Jul 2012 08:56:57 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6U8uupw069324; Mon, 30 Jul 2012 08:56:56 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201207300856.q6U8uupw069324@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 30 Jul 2012 08:56:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238898 - head/sys/dev/sdhci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 08:56:57 -0000 Author: glebius Date: Mon Jul 30 08:56:56 2012 New Revision: 238898 URL: http://svn.freebsd.org/changeset/base/238898 Log: Return back double spacing. Modified: head/sys/dev/sdhci/sdhci.c Modified: head/sys/dev/sdhci/sdhci.c ============================================================================== --- head/sys/dev/sdhci/sdhci.c Mon Jul 30 08:06:00 2012 (r238897) +++ head/sys/dev/sdhci/sdhci.c Mon Jul 30 08:56:56 2012 (r238898) @@ -364,7 +364,7 @@ sdhci_lower_frequency(device_t dev) /* * Some SD/MMC cards don't work with the default base - * clock frequency of 200MHz. Lower it to 50MHz. + * clock frequency of 200MHz. Lower it to 50MHz. */ pci_write_config(dev, SDHC_PCI_BASE_FREQ_KEY, 0x01, 1); pci_write_config(dev, SDHC_PCI_BASE_FREQ, 50, 1); From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 10:14:38 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1274C106566B; Mon, 30 Jul 2012 10:14:38 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CCDBA8FC1C; Mon, 30 Jul 2012 10:14:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6UAEb7x075570; Mon, 30 Jul 2012 10:14:37 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6UAEbof075568; Mon, 30 Jul 2012 10:14:37 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201207301014.q6UAEbof075568@svn.freebsd.org> From: Joel Dahl Date: Mon, 30 Jul 2012 10:14:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238899 - head/sbin/geom/class/sched X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 10:14:38 -0000 Author: joel (doc committer) Date: Mon Jul 30 10:14:37 2012 New Revision: 238899 URL: http://svn.freebsd.org/changeset/base/238899 Log: Remove trailing whitespace. Modified: head/sbin/geom/class/sched/gsched.8 Modified: head/sbin/geom/class/sched/gsched.8 ============================================================================== --- head/sbin/geom/class/sched/gsched.8 Mon Jul 30 08:56:56 2012 (r238898) +++ head/sbin/geom/class/sched/gsched.8 Mon Jul 30 10:14:37 2012 (r238899) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 26, 2012 +.Dd July 26, 2012 .Dt GSCHED 8 .Os .Sh NAME From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 10:55:24 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9AD3D106566B; Mon, 30 Jul 2012 10:55:24 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7BA398FC0A; Mon, 30 Jul 2012 10:55:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6UAtO2B078866; Mon, 30 Jul 2012 10:55:24 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6UAtOda078862; Mon, 30 Jul 2012 10:55:24 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201207301055.q6UAtOda078862@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 30 Jul 2012 10:55:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238900 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 10:55:24 -0000 Author: luigi Date: Mon Jul 30 10:55:23 2012 New Revision: 238900 URL: http://svn.freebsd.org/changeset/base/238900 Log: Fix some compile errors at high WARNS, including one for an uninitialized variable. unused parameters and variables are annotated with (void)foo; /* UNUSED */ instead of __unused, because this code needs to build also on linux and windows. Modified: head/sbin/ipfw/dummynet.c head/sbin/ipfw/ipfw2.c head/sbin/ipfw/nat.c Modified: head/sbin/ipfw/dummynet.c ============================================================================== --- head/sbin/ipfw/dummynet.c Mon Jul 30 10:14:37 2012 (r238899) +++ head/sbin/ipfw/dummynet.c Mon Jul 30 10:55:23 2012 (r238900) @@ -759,7 +759,8 @@ load_extra_delays(const char *filename, void ipfw_config_pipe(int ac, char **av) { - int i, j; + int i; + u_int j; char *end; struct dn_id *buf, *base; struct dn_sch *sch = NULL; @@ -1282,8 +1283,8 @@ parse_range(int ac, char *av[], uint32_t av--; } if (v[1] < v[0] || - v[1] < 0 || v[1] >= DN_MAX_ID-1 || - v[0] < 0 || v[1] >= DN_MAX_ID-1) { + v[1] >= DN_MAX_ID-1 || + v[1] >= DN_MAX_ID-1) { continue; /* invalid entry */ } n++; @@ -1310,11 +1311,12 @@ void dummynet_list(int ac, char *av[], int show_counters) { struct dn_id *oid, *x = NULL; - int ret, i, l; + int ret, i; int n; /* # of ranges */ - int buflen; - int max_size; /* largest obj passed up */ + u_int buflen, l; + u_int max_size; /* largest obj passed up */ + (void)show_counters; // XXX unused, but we should use it. ac--; av++; /* skip 'list' | 'show' word */ Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Mon Jul 30 10:14:37 2012 (r238899) +++ head/sbin/ipfw/ipfw2.c Mon Jul 30 10:55:23 2012 (r238900) @@ -412,7 +412,7 @@ do_cmd(int optname, void *optval, uintpt * and calls setsockopt(). * Function returns 0 on success or -1 otherwise. */ -int +static int do_setcmd3(int optname, void *optval, socklen_t optlen) { socklen_t len; @@ -3930,6 +3930,7 @@ ipfw_table_handler(int ac, char *av[]) uint32_t a, type, mask, addrlen; uint32_t tables_max; + mask = 0; // XXX uninitialized ? len = sizeof(tables_max); if (sysctlbyname("net.inet.ip.fw.tables_max", &tables_max, &len, NULL, 0) == -1) @@ -4135,7 +4136,7 @@ table_list(uint16_t num, int need_header if (sz < xent->len) break; sz -= xent->len; - xent = (void *)xent + xent->len; + xent = (ipfw_table_xentry *)((char *)xent + xent->len); } free(tbl); Modified: head/sbin/ipfw/nat.c ============================================================================== --- head/sbin/ipfw/nat.c Mon Jul 30 10:14:37 2012 (r238899) +++ head/sbin/ipfw/nat.c Mon Jul 30 10:55:23 2012 (r238900) @@ -318,6 +318,7 @@ estimate_redir_addr(int *ac, char ***av) char *sep = **av; u_int c = 0; + (void)ac; /* UNUSED */ while ((sep = strchr(sep, ',')) != NULL) { c++; sep++; @@ -379,6 +380,7 @@ estimate_redir_port(int *ac, char ***av) char *sep = **av; u_int c = 0; + (void)ac; /* UNUSED */ while ((sep = strchr(sep, ',')) != NULL) { c++; sep++; From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 11:02:22 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E95EB106566B; Mon, 30 Jul 2012 11:02:22 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D3DD58FC18; Mon, 30 Jul 2012 11:02:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6UB2Mt0085537; Mon, 30 Jul 2012 11:02:22 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6UB2MLf085535; Mon, 30 Jul 2012 11:02:22 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201207301102.q6UB2MLf085535@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 30 Jul 2012 11:02:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238903 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 11:02:23 -0000 Author: luigi Date: Mon Jul 30 11:02:22 2012 New Revision: 238903 URL: http://svn.freebsd.org/changeset/base/238903 Log: remove the last __unused instance in sbin/ipfw. This particular function (show_prerequisites() ) we should actually remove the argument from the callers as well, but i'll do it at a later time. Modified: head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Mon Jul 30 11:00:55 2012 (r238902) +++ head/sbin/ipfw/ipfw2.c Mon Jul 30 11:02:22 2012 (r238903) @@ -976,8 +976,9 @@ print_icmptypes(ipfw_insn_u32 *cmd) #define HAVE_OPTIONS 0x8000 static void -show_prerequisites(int *flags, int want, int cmd __unused) +show_prerequisites(int *flags, int want, int cmd) { + (void)cmd; /* UNUSED */ if (co.comment_only) return; if ( (*flags & HAVE_IP) == HAVE_IP) From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 14:47:36 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA007106564A; Mon, 30 Jul 2012 14:47:36 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 56E3B8FC0A; Mon, 30 Jul 2012 14:47:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6UElaX5003712; Mon, 30 Jul 2012 14:47:36 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6UEla03003705; Mon, 30 Jul 2012 14:47:36 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207301447.q6UEla03003705@svn.freebsd.org> From: Martin Matuska Date: Mon, 30 Jul 2012 14:47:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238909 - in head: contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/tar/test lib/libarchive lib/libarchive/test X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 14:47:36 -0000 Author: mm Date: Mon Jul 30 14:47:35 2012 New Revision: 238909 URL: http://svn.freebsd.org/changeset/base/238909 Log: Backport NFSv4 ACL fix from libarchive master branch. Source: https://github.com/libarchive/libarchive/commit/f67370d5 Obtained from: libarchive (master branch) Added: head/contrib/libarchive/libarchive/archive_write_disk_acl.c head/contrib/libarchive/libarchive/test/test_acl_freebsd_nfs4.c head/contrib/libarchive/libarchive/test/test_acl_freebsd_posix1e.c Modified: head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c head/contrib/libarchive/libarchive/archive_write_disk_posix.c head/contrib/libarchive/libarchive/archive_write_disk_private.h head/contrib/libarchive/tar/test/test_basic.c head/lib/libarchive/Makefile head/lib/libarchive/config_freebsd.h head/lib/libarchive/test/Makefile Modified: head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Mon Jul 30 14:34:30 2012 (r238908) +++ head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Mon Jul 30 14:47:35 2012 (r238909) @@ -114,7 +114,7 @@ __FBSDID("$FreeBSD$"); #define ACL_GET_PERM acl_get_perm_np #endif -static int setup_acls_posix1e(struct archive_read_disk *, +static int setup_acls(struct archive_read_disk *, struct archive_entry *, int *fd); static int setup_mac_metadata(struct archive_read_disk *, struct archive_entry *, int *fd); @@ -168,15 +168,16 @@ archive_read_disk_entry_from_file(struct st = &s; } archive_entry_copy_stat(entry, st); - /* Lookup uname/gname */ - name = archive_read_disk_uname(_a, archive_entry_uid(entry)); - if (name != NULL) - archive_entry_copy_uname(entry, name); - name = archive_read_disk_gname(_a, archive_entry_gid(entry)); - if (name != NULL) - archive_entry_copy_gname(entry, name); } + /* Lookup uname/gname */ + name = archive_read_disk_uname(_a, archive_entry_uid(entry)); + if (name != NULL) + archive_entry_copy_uname(entry, name); + name = archive_read_disk_gname(_a, archive_entry_gid(entry)); + if (name != NULL) + archive_entry_copy_gname(entry, name); + #ifdef HAVE_STRUCT_STAT_ST_FLAGS /* On FreeBSD, we get flags for free with the stat. */ /* TODO: Does this belong in copy_stat()? */ @@ -244,7 +245,7 @@ archive_read_disk_entry_from_file(struct } #endif /* HAVE_READLINK || HAVE_READLINKAT */ - r = setup_acls_posix1e(a, entry, &fd); + r = setup_acls(a, entry, &fd); r1 = setup_xattrs(a, entry, &fd); if (r1 < r) r = r1; @@ -388,15 +389,16 @@ setup_mac_metadata(struct archive_read_d #ifdef HAVE_POSIX_ACL -static void setup_acl_posix1e(struct archive_read_disk *a, +static int translate_acl(struct archive_read_disk *a, struct archive_entry *entry, acl_t acl, int archive_entry_acl_type); static int -setup_acls_posix1e(struct archive_read_disk *a, +setup_acls(struct archive_read_disk *a, struct archive_entry *entry, int *fd) { const char *accpath; acl_t acl; + int r; accpath = archive_entry_sourcepath(entry); if (accpath == NULL) @@ -404,15 +406,33 @@ setup_acls_posix1e(struct archive_read_d archive_entry_acl_clear(entry); - if (*fd < 0 && a->tree != NULL && - (a->follow_symlinks || archive_entry_filetype(entry) != AE_IFLNK)){ - *fd = a->open_on_current_dir(a->tree, accpath, - O_RDONLY | O_NONBLOCK); - if (*fd < 0) { - archive_set_error(&a->archive, errno, - "Couldn't access %s", accpath); - return (ARCHIVE_FAILED); - } + /* Try NFS4 ACL first. */ + if (*fd >= 0) + acl = acl_get_fd(*fd); +#if HAVE_ACL_GET_LINK_NP + else if (!a->follow_symlinks) + acl = acl_get_link_np(accpath, ACL_TYPE_NFS4); +#else + else if ((!a->follow_symlinks) + && (archive_entry_filetype(entry) == AE_IFLNK)) + /* We can't get the ACL of a symlink, so we assume it can't + have one. */ + acl = NULL; +#endif + else + acl = acl_get_file(accpath, ACL_TYPE_NFS4); +#if HAVE_ACL_IS_TRIVIAL_NP + /* Ignore "trivial" ACLs that just mirror the file mode. */ + acl_is_trivial_np(acl, &r); + if (r) { + acl_free(acl); + acl = NULL; + } +#endif + if (acl != NULL) { + translate_acl(a, entry, acl, ARCHIVE_ENTRY_ACL_TYPE_NFS4); + acl_free(acl); + return (ARCHIVE_OK); } /* Retrieve access ACL from file. */ @@ -431,7 +451,7 @@ setup_acls_posix1e(struct archive_read_d else acl = acl_get_file(accpath, ACL_TYPE_ACCESS); if (acl != NULL) { - setup_acl_posix1e(a, entry, acl, + translate_acl(a, entry, acl, ARCHIVE_ENTRY_ACL_TYPE_ACCESS); acl_free(acl); } @@ -440,7 +460,7 @@ setup_acls_posix1e(struct archive_read_d if (S_ISDIR(archive_entry_mode(entry))) { acl = acl_get_file(accpath, ACL_TYPE_DEFAULT); if (acl != NULL) { - setup_acl_posix1e(a, entry, acl, + translate_acl(a, entry, acl, ARCHIVE_ENTRY_ACL_TYPE_DEFAULT); acl_free(acl); } @@ -449,70 +469,182 @@ setup_acls_posix1e(struct archive_read_d } /* - * Translate POSIX.1e ACL into libarchive internal structure. + * Translate system ACL into libarchive internal structure. */ -static void -setup_acl_posix1e(struct archive_read_disk *a, - struct archive_entry *entry, acl_t acl, int archive_entry_acl_type) + +static struct { + int archive_perm; + int platform_perm; +} acl_perm_map[] = { + {ARCHIVE_ENTRY_ACL_EXECUTE, ACL_EXECUTE}, + {ARCHIVE_ENTRY_ACL_WRITE, ACL_WRITE}, + {ARCHIVE_ENTRY_ACL_READ, ACL_READ}, + {ARCHIVE_ENTRY_ACL_READ_DATA, ACL_READ_DATA}, + {ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, ACL_LIST_DIRECTORY}, + {ARCHIVE_ENTRY_ACL_WRITE_DATA, ACL_WRITE_DATA}, + {ARCHIVE_ENTRY_ACL_ADD_FILE, ACL_ADD_FILE}, + {ARCHIVE_ENTRY_ACL_APPEND_DATA, ACL_APPEND_DATA}, + {ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY, ACL_ADD_SUBDIRECTORY}, + {ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS, ACL_READ_NAMED_ATTRS}, + {ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS, ACL_WRITE_NAMED_ATTRS}, + {ARCHIVE_ENTRY_ACL_DELETE_CHILD, ACL_DELETE_CHILD}, + {ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES, ACL_READ_ATTRIBUTES}, + {ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES, ACL_WRITE_ATTRIBUTES}, + {ARCHIVE_ENTRY_ACL_DELETE, ACL_DELETE}, + {ARCHIVE_ENTRY_ACL_READ_ACL, ACL_READ_ACL}, + {ARCHIVE_ENTRY_ACL_WRITE_ACL, ACL_WRITE_ACL}, + {ARCHIVE_ENTRY_ACL_WRITE_OWNER, ACL_WRITE_OWNER}, + {ARCHIVE_ENTRY_ACL_SYNCHRONIZE, ACL_SYNCHRONIZE} +}; + +static struct { + int archive_inherit; + int platform_inherit; +} acl_inherit_map[] = { + {ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, ACL_ENTRY_FILE_INHERIT}, + {ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT, ACL_ENTRY_DIRECTORY_INHERIT}, + {ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, ACL_ENTRY_NO_PROPAGATE_INHERIT}, + {ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, ACL_ENTRY_INHERIT_ONLY} +}; + +static int +translate_acl(struct archive_read_disk *a, + struct archive_entry *entry, acl_t acl, int default_entry_acl_type) { acl_tag_t acl_tag; + acl_entry_type_t acl_type; + acl_flagset_t acl_flagset; acl_entry_t acl_entry; acl_permset_t acl_permset; + int brand, i, r, entry_acl_type; int s, ae_id, ae_tag, ae_perm; const char *ae_name; + + // FreeBSD "brands" ACLs as POSIX.1e or NFSv4 + // Make sure the "brand" on this ACL is consistent + // with the default_entry_acl_type bits provided. + acl_get_brand_np(acl, &brand); + switch (brand) { + case ACL_BRAND_POSIX: + switch (default_entry_acl_type) { + case ARCHIVE_ENTRY_ACL_TYPE_ACCESS: + case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT: + entry_acl_type = default_entry_acl_type; + break; + default: + // XXX set warning message? + return ARCHIVE_FAILED; + } + break; + case ACL_BRAND_NFS4: + if (default_entry_acl_type & ~ARCHIVE_ENTRY_ACL_TYPE_NFS4) { + // XXX set warning message? + return ARCHIVE_FAILED; + } + break; + default: + // XXX set warning message? + return ARCHIVE_FAILED; + break; + } + + s = acl_get_entry(acl, ACL_FIRST_ENTRY, &acl_entry); while (s == 1) { ae_id = -1; ae_name = NULL; + ae_perm = 0; acl_get_tag_type(acl_entry, &acl_tag); - if (acl_tag == ACL_USER) { + switch (acl_tag) { + case ACL_USER: ae_id = (int)*(uid_t *)acl_get_qualifier(acl_entry); ae_name = archive_read_disk_uname(&a->archive, ae_id); ae_tag = ARCHIVE_ENTRY_ACL_USER; - } else if (acl_tag == ACL_GROUP) { + break; + case ACL_GROUP: ae_id = (int)*(gid_t *)acl_get_qualifier(acl_entry); ae_name = archive_read_disk_gname(&a->archive, ae_id); ae_tag = ARCHIVE_ENTRY_ACL_GROUP; - } else if (acl_tag == ACL_MASK) { + break; + case ACL_MASK: ae_tag = ARCHIVE_ENTRY_ACL_MASK; - } else if (acl_tag == ACL_USER_OBJ) { + break; + case ACL_USER_OBJ: ae_tag = ARCHIVE_ENTRY_ACL_USER_OBJ; - } else if (acl_tag == ACL_GROUP_OBJ) { + break; + case ACL_GROUP_OBJ: ae_tag = ARCHIVE_ENTRY_ACL_GROUP_OBJ; - } else if (acl_tag == ACL_OTHER) { + break; + case ACL_OTHER: ae_tag = ARCHIVE_ENTRY_ACL_OTHER; - } else { + break; + case ACL_EVERYONE: + ae_tag = ARCHIVE_ENTRY_ACL_EVERYONE; + break; + default: /* Skip types that libarchive can't support. */ s = acl_get_entry(acl, ACL_NEXT_ENTRY, &acl_entry); continue; } - acl_get_permset(acl_entry, &acl_permset); - ae_perm = 0; + // XXX acl type maps to allow/deny/audit/YYYY bits + // XXX acl_get_entry_type_np on FreeBSD returns EINVAL for + // non-NFSv4 ACLs + entry_acl_type = default_entry_acl_type; + r = acl_get_entry_type_np(acl_entry, &acl_type); + if (r == 0) { + switch (acl_type) { + case ACL_ENTRY_TYPE_ALLOW: + entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_ALLOW; + break; + case ACL_ENTRY_TYPE_DENY: + entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_DENY; + break; + case ACL_ENTRY_TYPE_AUDIT: + entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_AUDIT; + break; + case ACL_ENTRY_TYPE_ALARM: + entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_ALARM; + break; + } + } + /* - * acl_get_perm() is spelled differently on different - * platforms; see above. + * Libarchive stores "flag" (NFSv4 inheritance bits) + * in the ae_perm bitmap. */ - if (ACL_GET_PERM(acl_permset, ACL_EXECUTE)) - ae_perm |= ARCHIVE_ENTRY_ACL_EXECUTE; - if (ACL_GET_PERM(acl_permset, ACL_READ)) - ae_perm |= ARCHIVE_ENTRY_ACL_READ; - if (ACL_GET_PERM(acl_permset, ACL_WRITE)) - ae_perm |= ARCHIVE_ENTRY_ACL_WRITE; - - archive_entry_acl_add_entry(entry, - archive_entry_acl_type, ae_perm, ae_tag, - ae_id, ae_name); + acl_get_flagset_np(acl_entry, &acl_flagset); + for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) { + if (acl_get_flag_np(acl_flagset, + acl_inherit_map[i].platform_inherit)) + ae_perm |= acl_inherit_map[i].archive_inherit; + + } + + acl_get_permset(acl_entry, &acl_permset); + for (i = 0; i < (int)(sizeof(acl_perm_map) / sizeof(acl_perm_map[0])); ++i) { + /* + * acl_get_perm() is spelled differently on different + * platforms; see above. + */ + if (ACL_GET_PERM(acl_permset, acl_perm_map[i].platform_perm)) + ae_perm |= acl_perm_map[i].archive_perm; + } + + archive_entry_acl_add_entry(entry, entry_acl_type, + ae_perm, ae_tag, + ae_id, ae_name); s = acl_get_entry(acl, ACL_NEXT_ENTRY, &acl_entry); } + return (ARCHIVE_OK); } #else static int -setup_acls_posix1e(struct archive_read_disk *a, - struct archive_entry *entry, int *fd) +setup_acls(struct archive_read_disk *a, + struct archive_entry *entry, int fd) { (void)a; /* UNUSED */ (void)entry; /* UNUSED */ Added: head/contrib/libarchive/libarchive/archive_write_disk_acl.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libarchive/libarchive/archive_write_disk_acl.c Mon Jul 30 14:47:35 2012 (r238909) @@ -0,0 +1,249 @@ +/*- + * Copyright (c) 2003-2010 Tim Kientzle + * 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 + * in this position and unchanged. + * 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(S) ``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(S) 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 "archive_platform.h" +__FBSDID("$FreeBSD: head/lib/libarchive/archive_write_disk.c 201159 2009-12-29 05:35:40Z kientzle $"); + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_ACL_H +#define _ACL_PRIVATE /* For debugging */ +#include +#endif +#ifdef HAVE_ERRNO_H +#include +#endif + +#include "archive.h" +#include "archive_entry.h" +#include "archive_acl_private.h" +#include "archive_write_disk_private.h" + +#ifndef HAVE_POSIX_ACL +/* Default empty function body to satisfy mainline code. */ +int +archive_write_disk_set_acls(struct archive *a, int fd, const char *name, + struct archive_acl *abstract_acl) +{ + (void)a; /* UNUSED */ + (void)fd; /* UNUSED */ + (void)name; /* UNUSED */ + (void)abstract_acl; /* UNUSED */ + return (ARCHIVE_OK); +} + +#else + +static int set_acl(struct archive *, int fd, const char *, + struct archive_acl *, + acl_type_t, int archive_entry_acl_type, const char *tn); + +/* + * XXX TODO: What about ACL types other than ACCESS and DEFAULT? + */ +int +archive_write_disk_set_acls(struct archive *a, int fd, const char *name, + struct archive_acl *abstract_acl) +{ + int ret; + + if (archive_acl_count(abstract_acl, ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) > 0) { + ret = set_acl(a, fd, name, abstract_acl, ACL_TYPE_ACCESS, + ARCHIVE_ENTRY_ACL_TYPE_ACCESS, "access"); + if (ret != ARCHIVE_OK) + return (ret); + ret = set_acl(a, fd, name, abstract_acl, ACL_TYPE_DEFAULT, + ARCHIVE_ENTRY_ACL_TYPE_DEFAULT, "default"); + return (ret); + } else if (archive_acl_count(abstract_acl, ARCHIVE_ENTRY_ACL_TYPE_NFS4) > 0) { + ret = set_acl(a, fd, name, abstract_acl, ACL_TYPE_NFS4, + ARCHIVE_ENTRY_ACL_TYPE_NFS4, "nfs4"); + return (ret); + } else + return ARCHIVE_OK; +} + +static struct { + int archive_perm; + int platform_perm; +} acl_perm_map[] = { + {ARCHIVE_ENTRY_ACL_EXECUTE, ACL_EXECUTE}, + {ARCHIVE_ENTRY_ACL_WRITE, ACL_WRITE}, + {ARCHIVE_ENTRY_ACL_READ, ACL_READ}, + {ARCHIVE_ENTRY_ACL_READ_DATA, ACL_READ_DATA}, + {ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, ACL_LIST_DIRECTORY}, + {ARCHIVE_ENTRY_ACL_WRITE_DATA, ACL_WRITE_DATA}, + {ARCHIVE_ENTRY_ACL_ADD_FILE, ACL_ADD_FILE}, + {ARCHIVE_ENTRY_ACL_APPEND_DATA, ACL_APPEND_DATA}, + {ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY, ACL_ADD_SUBDIRECTORY}, + {ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS, ACL_READ_NAMED_ATTRS}, + {ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS, ACL_WRITE_NAMED_ATTRS}, + {ARCHIVE_ENTRY_ACL_DELETE_CHILD, ACL_DELETE_CHILD}, + {ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES, ACL_READ_ATTRIBUTES}, + {ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES, ACL_WRITE_ATTRIBUTES}, + {ARCHIVE_ENTRY_ACL_DELETE, ACL_DELETE}, + {ARCHIVE_ENTRY_ACL_READ_ACL, ACL_READ_ACL}, + {ARCHIVE_ENTRY_ACL_WRITE_ACL, ACL_WRITE_ACL}, + {ARCHIVE_ENTRY_ACL_WRITE_OWNER, ACL_WRITE_OWNER}, + {ARCHIVE_ENTRY_ACL_SYNCHRONIZE, ACL_SYNCHRONIZE} +}; + +static struct { + int archive_inherit; + int platform_inherit; +} acl_inherit_map[] = { + {ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, ACL_ENTRY_FILE_INHERIT}, + {ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT, ACL_ENTRY_DIRECTORY_INHERIT}, + {ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, ACL_ENTRY_NO_PROPAGATE_INHERIT}, + {ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, ACL_ENTRY_INHERIT_ONLY} +}; + +static int +set_acl(struct archive *a, int fd, const char *name, + struct archive_acl *abstract_acl, + acl_type_t acl_type, int ae_requested_type, const char *tname) +{ + acl_t acl; + acl_entry_t acl_entry; + acl_permset_t acl_permset; + acl_flagset_t acl_flagset; + int ret; + int ae_type, ae_permset, ae_tag, ae_id; + uid_t ae_uid; + gid_t ae_gid; + const char *ae_name; + int entries; + int i; + + ret = ARCHIVE_OK; + entries = archive_acl_reset(abstract_acl, ae_requested_type); + if (entries == 0) + return (ARCHIVE_OK); + acl = acl_init(entries); + while (archive_acl_next(a, abstract_acl, ae_requested_type, &ae_type, + &ae_permset, &ae_tag, &ae_id, &ae_name) == ARCHIVE_OK) { + acl_create_entry(&acl, &acl_entry); + + switch (ae_tag) { + case ARCHIVE_ENTRY_ACL_USER: + acl_set_tag_type(acl_entry, ACL_USER); + ae_uid = archive_write_disk_uid(a, ae_name, ae_id); + acl_set_qualifier(acl_entry, &ae_uid); + break; + case ARCHIVE_ENTRY_ACL_GROUP: + acl_set_tag_type(acl_entry, ACL_GROUP); + ae_gid = archive_write_disk_gid(a, ae_name, ae_id); + acl_set_qualifier(acl_entry, &ae_gid); + break; + case ARCHIVE_ENTRY_ACL_USER_OBJ: + acl_set_tag_type(acl_entry, ACL_USER_OBJ); + break; + case ARCHIVE_ENTRY_ACL_GROUP_OBJ: + acl_set_tag_type(acl_entry, ACL_GROUP_OBJ); + break; + case ARCHIVE_ENTRY_ACL_MASK: + acl_set_tag_type(acl_entry, ACL_MASK); + break; + case ARCHIVE_ENTRY_ACL_OTHER: + acl_set_tag_type(acl_entry, ACL_OTHER); + break; + case ARCHIVE_ENTRY_ACL_EVERYONE: + acl_set_tag_type(acl_entry, ACL_EVERYONE); + break; + default: + /* XXX */ + break; + } + + switch (ae_type) { + case ARCHIVE_ENTRY_ACL_TYPE_ALLOW: + acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_ALLOW); + break; + case ARCHIVE_ENTRY_ACL_TYPE_DENY: + acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_DENY); + break; + case ARCHIVE_ENTRY_ACL_TYPE_AUDIT: + acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_AUDIT); + break; + case ARCHIVE_ENTRY_ACL_TYPE_ALARM: + acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_ALARM); + break; + case ARCHIVE_ENTRY_ACL_TYPE_ACCESS: + case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT: + // These don't translate directly into the system ACL. + break; + default: + // XXX error handling here. + break; + } + + acl_get_permset(acl_entry, &acl_permset); + acl_clear_perms(acl_permset); + + for (i = 0; i < (int)(sizeof(acl_perm_map) / sizeof(acl_perm_map[0])); ++i) { + if (ae_permset & acl_perm_map[i].archive_perm) + acl_add_perm(acl_permset, + acl_perm_map[i].platform_perm); + } + + acl_get_flagset_np(acl_entry, &acl_flagset); + acl_clear_flags_np(acl_flagset); + for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) { + if (ae_permset & acl_inherit_map[i].archive_inherit) + acl_add_flag_np(acl_flagset, + acl_inherit_map[i].platform_inherit); + } + } + + /* Try restoring the ACL through 'fd' if we can. */ +#if HAVE_ACL_SET_FD + if (fd >= 0 && acl_type == ACL_TYPE_ACCESS && acl_set_fd(fd, acl) == 0) + ret = ARCHIVE_OK; + else +#else +#if HAVE_ACL_SET_FD_NP + if (fd >= 0 && acl_set_fd_np(fd, acl, acl_type) == 0) + ret = ARCHIVE_OK; + else +#endif +#endif +#if HAVE_ACL_SET_LINK_NP + if (acl_set_link_np(name, acl_type, acl) != 0) { + archive_set_error(a, errno, "Failed to set %s acl", tname); + ret = ARCHIVE_WARN; + } +#else + /* TODO: Skip this if 'name' is a symlink. */ + if (acl_set_file(name, acl_type, acl) != 0) { + archive_set_error(a, errno, "Failed to set %s acl", tname); + ret = ARCHIVE_WARN; + } +#endif + acl_free(acl); + return (ret); +} +#endif Modified: head/contrib/libarchive/libarchive/archive_write_disk_posix.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_disk_posix.c Mon Jul 30 14:34:30 2012 (r238908) +++ head/contrib/libarchive/libarchive/archive_write_disk_posix.c Mon Jul 30 14:47:35 2012 (r238909) @@ -32,9 +32,6 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_TYPES_H #include #endif -#ifdef HAVE_SYS_ACL_H -#include -#endif #ifdef HAVE_SYS_EXTATTR_H #include #endif @@ -129,6 +126,7 @@ __FBSDID("$FreeBSD$"); #include "archive_string.h" #include "archive_entry.h" #include "archive_private.h" +#include "archive_write_disk_private.h" #ifndef O_BINARY #define O_BINARY 0 @@ -267,11 +265,6 @@ static int create_dir(struct archive_wri static int create_parent_dir(struct archive_write_disk *, char *); static int older(struct stat *, struct archive_entry *); static int restore_entry(struct archive_write_disk *); -#ifdef HAVE_POSIX_ACL -static int set_acl(struct archive_write_disk *, int fd, const char *, struct archive_acl *, - acl_type_t, int archive_entry_acl_type, const char *tn); -#endif -static int set_acls(struct archive_write_disk *, int fd, const char *, struct archive_acl *); static int set_mac_metadata(struct archive_write_disk *, const char *, const void *, size_t); static int set_xattrs(struct archive_write_disk *); @@ -570,6 +563,7 @@ _archive_write_disk_header(struct archiv if (a->deferred & TODO_ACLS) { fe = current_fixup(a, archive_entry_pathname(entry)); + fe->fixup |= TODO_ACLS; archive_acl_copy(&fe->acl, archive_entry_acl(entry)); } @@ -878,7 +872,7 @@ _archive_write_disk_finish_entry(struct * ACLs that prevent attribute changes (including time). */ if (a->todo & TODO_ACLS) { - int r2 = set_acls(a, a->fd, + int r2 = archive_write_disk_set_acls(&a->archive, a->fd, archive_entry_pathname(a->entry), archive_entry_acl(a->entry)); if (r2 < ret) ret = r2; @@ -950,12 +944,12 @@ archive_write_disk_gid(struct archive *_ int64_t archive_write_disk_uid(struct archive *_a, const char *name, int64_t id) { - struct archive_write_disk *a = (struct archive_write_disk *)_a; - archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, - ARCHIVE_STATE_ANY, "archive_write_disk_uid"); - if (a->lookup_uid) - return (a->lookup_uid)(a->lookup_uid_data, name, id); - return (id); + struct archive_write_disk *a = (struct archive_write_disk *)_a; + archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, + ARCHIVE_STATE_ANY, "archive_write_disk_uid"); + if (a->lookup_uid) + return (a->lookup_uid)(a->lookup_uid_data, name, id); + return (id); } /* @@ -1381,7 +1375,8 @@ _archive_write_disk_close(struct archive if (p->fixup & TODO_MODE_BASE) chmod(p->name, p->mode); if (p->fixup & TODO_ACLS) - set_acls(a, -1, p->name, &p->acl); + archive_write_disk_set_acls(&a->archive, + -1, p->name, &p->acl); if (p->fixup & TODO_FFLAGS) set_fflags_platform(a, -1, p->name, p->mode, p->fflags_set, 0); @@ -2543,131 +2538,6 @@ set_mac_metadata(struct archive_write_di } #endif -#ifndef HAVE_POSIX_ACL -/* Default empty function body to satisfy mainline code. */ -static int -set_acls(struct archive_write_disk *a, int fd, const char *name, - struct archive_acl *aacl) -{ - (void)a; /* UNUSED */ - (void)fd; /* UNUSED */ - (void)name; /* UNUSED */ - (void)aacl; /* UNUSED */ - return (ARCHIVE_OK); -} - -#else - -/* - * XXX TODO: What about ACL types other than ACCESS and DEFAULT? - */ -static int -set_acls(struct archive_write_disk *a, int fd, const char *name, - struct archive_acl *abstract_acl) -{ - int ret; - - ret = set_acl(a, fd, name, abstract_acl, ACL_TYPE_ACCESS, - ARCHIVE_ENTRY_ACL_TYPE_ACCESS, "access"); - if (ret != ARCHIVE_OK) - return (ret); - ret = set_acl(a, fd, name, abstract_acl, ACL_TYPE_DEFAULT, - ARCHIVE_ENTRY_ACL_TYPE_DEFAULT, "default"); - return (ret); -} - - -static int -set_acl(struct archive_write_disk *a, int fd, const char *name, - struct archive_acl *abstract_acl, - acl_type_t acl_type, int ae_requested_type, const char *tname) -{ - acl_t acl; - acl_entry_t acl_entry; - acl_permset_t acl_permset; - int ret, r; - int ae_type, ae_permset, ae_tag, ae_id; - uid_t ae_uid; - gid_t ae_gid; - const char *ae_name; - int entries; - - ret = ARCHIVE_OK; - entries = archive_acl_reset(abstract_acl, ae_requested_type); - if (entries == 0) - return (ARCHIVE_OK); - acl = acl_init(entries); - while ((r = archive_acl_next(&a->archive, abstract_acl, - ae_requested_type, &ae_type, &ae_permset, &ae_tag, &ae_id, - &ae_name)) == ARCHIVE_OK) { - acl_create_entry(&acl, &acl_entry); - - switch (ae_tag) { - case ARCHIVE_ENTRY_ACL_USER: - acl_set_tag_type(acl_entry, ACL_USER); - ae_uid = archive_write_disk_uid(&a->archive, - ae_name, ae_id); - acl_set_qualifier(acl_entry, &ae_uid); - break; - case ARCHIVE_ENTRY_ACL_GROUP: - acl_set_tag_type(acl_entry, ACL_GROUP); - ae_gid = archive_write_disk_gid(&a->archive, - ae_name, ae_id); - acl_set_qualifier(acl_entry, &ae_gid); - break; - case ARCHIVE_ENTRY_ACL_USER_OBJ: - acl_set_tag_type(acl_entry, ACL_USER_OBJ); - break; - case ARCHIVE_ENTRY_ACL_GROUP_OBJ: - acl_set_tag_type(acl_entry, ACL_GROUP_OBJ); - break; - case ARCHIVE_ENTRY_ACL_MASK: - acl_set_tag_type(acl_entry, ACL_MASK); - break; - case ARCHIVE_ENTRY_ACL_OTHER: - acl_set_tag_type(acl_entry, ACL_OTHER); - break; - default: - /* XXX */ - break; - } - - acl_get_permset(acl_entry, &acl_permset); - acl_clear_perms(acl_permset); - if (ae_permset & ARCHIVE_ENTRY_ACL_EXECUTE) - acl_add_perm(acl_permset, ACL_EXECUTE); - if (ae_permset & ARCHIVE_ENTRY_ACL_WRITE) - acl_add_perm(acl_permset, ACL_WRITE); - if (ae_permset & ARCHIVE_ENTRY_ACL_READ) - acl_add_perm(acl_permset, ACL_READ); - } - if (r == ARCHIVE_FATAL) { - acl_free(acl); - archive_set_error(&a->archive, errno, - "Failed to archive_acl_next"); - return (r); - } - - /* Try restoring the ACL through 'fd' if we can. */ -#if HAVE_ACL_SET_FD - if (fd >= 0 && acl_type == ACL_TYPE_ACCESS && acl_set_fd(fd, acl) == 0) - ret = ARCHIVE_OK; - else -#else -#if HAVE_ACL_SET_FD_NP - if (fd >= 0 && acl_set_fd_np(fd, acl, acl_type) == 0) - ret = ARCHIVE_OK; - else -#endif -#endif - if (acl_set_file(name, acl_type, acl) != 0) { - archive_set_error(&a->archive, errno, "Failed to set %s acl", tname); - ret = ARCHIVE_WARN; - } - acl_free(acl); - return (ret); -} -#endif #if HAVE_LSETXATTR || HAVE_LSETEA /* Modified: head/contrib/libarchive/libarchive/archive_write_disk_private.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_disk_private.h Mon Jul 30 14:34:30 2012 (r238908) +++ head/contrib/libarchive/libarchive/archive_write_disk_private.h Mon Jul 30 14:47:35 2012 (r238909) @@ -33,6 +33,11 @@ #ifndef ARCHIVE_WRITE_DISK_PRIVATE_H_INCLUDED #define ARCHIVE_WRITE_DISK_PRIVATE_H_INCLUDED +#include "archive_acl_private.h" + struct archive_write_disk; +int +archive_write_disk_set_acls(struct archive *, int /* fd */, const char * /* pathname */, struct archive_acl *); + #endif Added: head/contrib/libarchive/libarchive/test/test_acl_freebsd_nfs4.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libarchive/libarchive/test/test_acl_freebsd_nfs4.c Mon Jul 30 14:47:35 2012 (r238909) @@ -0,0 +1,1094 @@ +/*- + * Copyright (c) 2003-2010 Tim Kientzle + * 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(S) ``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(S) 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 "test.h" +__FBSDID("$FreeBSD$"); + +#if defined(__FreeBSD__) && __FreeBSD__ >= 8 +#define _ACL_PRIVATE +#include + +struct myacl_t { + int type; + int permset; + int tag; + int qual; /* GID or UID of user/group, depending on tag. */ + const char *name; /* Name of user/group, depending on tag. */ +}; + +static struct myacl_t acls_reg[] = { + /* For this test, we need the file owner to be able to read and write the ACL. */ + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, + ARCHIVE_ENTRY_ACL_READ_DATA | ARCHIVE_ENTRY_ACL_READ_ACL | ARCHIVE_ENTRY_ACL_WRITE_ACL | ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS | ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES, + ARCHIVE_ENTRY_ACL_USER_OBJ, -1, ""}, + + /* An entry for each type. */ + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_EXECUTE, + ARCHIVE_ENTRY_ACL_USER, 108, "user108" }, + { ARCHIVE_ENTRY_ACL_TYPE_DENY, ARCHIVE_ENTRY_ACL_EXECUTE, + ARCHIVE_ENTRY_ACL_USER, 109, "user109" }, + + /* An entry for each permission. */ + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_EXECUTE, + ARCHIVE_ENTRY_ACL_USER, 112, "user112" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_READ_DATA, + ARCHIVE_ENTRY_ACL_USER, 113, "user113" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_WRITE_DATA, + ARCHIVE_ENTRY_ACL_USER, 115, "user115" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_APPEND_DATA, + ARCHIVE_ENTRY_ACL_USER, 117, "user117" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS, + ARCHIVE_ENTRY_ACL_USER, 119, "user119" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS, + ARCHIVE_ENTRY_ACL_USER, 120, "user120" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES, + ARCHIVE_ENTRY_ACL_USER, 122, "user122" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES, + ARCHIVE_ENTRY_ACL_USER, 123, "user123" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_DELETE, + ARCHIVE_ENTRY_ACL_USER, 124, "user124" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_READ_ACL, + ARCHIVE_ENTRY_ACL_USER, 125, "user125" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_WRITE_ACL, + ARCHIVE_ENTRY_ACL_USER, 126, "user126" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_WRITE_OWNER, + ARCHIVE_ENTRY_ACL_USER, 127, "user127" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_SYNCHRONIZE, + ARCHIVE_ENTRY_ACL_USER, 128, "user128" }, + + /* One entry for each qualifier. */ + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_EXECUTE, + ARCHIVE_ENTRY_ACL_USER, 135, "user135" }, +// { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_EXECUTE, +// ARCHIVE_ENTRY_ACL_USER_OBJ, -1, "" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_EXECUTE, + ARCHIVE_ENTRY_ACL_GROUP, 136, "group136" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_EXECUTE, + ARCHIVE_ENTRY_ACL_GROUP_OBJ, -1, "" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_EXECUTE, + ARCHIVE_ENTRY_ACL_EVERYONE, -1, "" } +}; + + +static struct myacl_t acls_dir[] = { + /* For this test, we need to be able to read and write the ACL. */ + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_READ_ACL, + ARCHIVE_ENTRY_ACL_USER_OBJ, -1, ""}, + + /* An entry for each type. */ + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, + ARCHIVE_ENTRY_ACL_USER, 101, "user101" }, + { ARCHIVE_ENTRY_ACL_TYPE_DENY, ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, + ARCHIVE_ENTRY_ACL_USER, 102, "user102" }, + + /* An entry for each permission. */ + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, + ARCHIVE_ENTRY_ACL_USER, 201, "user201" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_ADD_FILE, + ARCHIVE_ENTRY_ACL_USER, 202, "user202" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY, + ARCHIVE_ENTRY_ACL_USER, 203, "user203" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS, + ARCHIVE_ENTRY_ACL_USER, 204, "user204" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS, + ARCHIVE_ENTRY_ACL_USER, 205, "user205" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_DELETE_CHILD, + ARCHIVE_ENTRY_ACL_USER, 206, "user206" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES, + ARCHIVE_ENTRY_ACL_USER, 207, "user207" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES, + ARCHIVE_ENTRY_ACL_USER, 208, "user208" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_DELETE, + ARCHIVE_ENTRY_ACL_USER, 209, "user209" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_READ_ACL, + ARCHIVE_ENTRY_ACL_USER, 210, "user210" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_WRITE_ACL, + ARCHIVE_ENTRY_ACL_USER, 211, "user211" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_WRITE_OWNER, + ARCHIVE_ENTRY_ACL_USER, 212, "user212" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_SYNCHRONIZE, + ARCHIVE_ENTRY_ACL_USER, 213, "user213" }, + + /* One entry with each inheritance value. */ + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, + ARCHIVE_ENTRY_ACL_READ_DATA | ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, + ARCHIVE_ENTRY_ACL_USER, 301, "user301" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, + ARCHIVE_ENTRY_ACL_READ_DATA | ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT, + ARCHIVE_ENTRY_ACL_USER, 302, "user302" }, +#if 0 + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, + ARCHIVE_ENTRY_ACL_READ_DATA | ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, + ARCHIVE_ENTRY_ACL_USER, 303, "user303" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, + ARCHIVE_ENTRY_ACL_READ_DATA | ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, + ARCHIVE_ENTRY_ACL_USER, 304, "user304" }, +#endif + +#if 0 + /* FreeBSD does not support audit entries. */ + { ARCHIVE_ENTRY_ACL_TYPE_AUDIT, + ARCHIVE_ENTRY_ACL_READ_DATA | ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS, + ARCHIVE_ENTRY_ACL_USER, 401, "user401" }, + { ARCHIVE_ENTRY_ACL_TYPE_AUDIT, + ARCHIVE_ENTRY_ACL_READ_DATA | ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS, + ARCHIVE_ENTRY_ACL_USER, 402, "user402" }, +#endif + + /* One entry for each qualifier. */ + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, + ARCHIVE_ENTRY_ACL_USER, 501, "user501" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, + ARCHIVE_ENTRY_ACL_GROUP, 502, "group502" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, + ARCHIVE_ENTRY_ACL_GROUP_OBJ, -1, "" }, + { ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, + ARCHIVE_ENTRY_ACL_EVERYONE, -1, "" } +}; + +static void +set_acls(struct archive_entry *ae, struct myacl_t *acls, int start, int end) +{ + int i; + + archive_entry_acl_clear(ae); + if (start > 0) { + assertEqualInt(ARCHIVE_OK, + archive_entry_acl_add_entry(ae, + acls[0].type, acls[0].permset, acls[0].tag, + acls[0].qual, acls[0].name)); + } + for (i = start; i < end; i++) { + assertEqualInt(ARCHIVE_OK, + archive_entry_acl_add_entry(ae, + acls[i].type, acls[i].permset, acls[i].tag, + acls[i].qual, acls[i].name)); + } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 18:04:38 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 527FD106564A; Mon, 30 Jul 2012 18:04:38 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 279248FC12; Mon, 30 Jul 2012 18:04:38 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 825DCB984; Mon, 30 Jul 2012 14:04:37 -0400 (EDT) From: John Baldwin To: Konstantin Belousov Date: Mon, 30 Jul 2012 09:58:40 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p17; KDE/4.5.5; amd64; ; ) References: <201207181536.q6IFa45h084774@svn.freebsd.org> In-Reply-To: <201207181536.q6IFa45h084774@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201207300958.40082.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 30 Jul 2012 14:04:37 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r238597 - head/sys/amd64/amd64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 18:04:38 -0000 On Wednesday, July 18, 2012 11:36:04 am Konstantin Belousov wrote: > Author: kib > Date: Wed Jul 18 15:36:03 2012 > New Revision: 238597 > URL: http://svn.freebsd.org/changeset/base/238597 > > Log: > Add stmxcsr. > > Submitted by: Ed Alley > PR: amd64/169927 > MFC after: 3 weeks > > Modified: > head/sys/amd64/amd64/fpu.c > > Modified: head/sys/amd64/amd64/fpu.c > ============================================================================== > --- head/sys/amd64/amd64/fpu.c Wed Jul 18 12:41:09 2012 (r238596) > +++ head/sys/amd64/amd64/fpu.c Wed Jul 18 15:36:03 2012 (r238597) > @@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$"); > #define fxrstor(addr) __asm __volatile("fxrstor %0" : : "m" (*(addr))) > #define fxsave(addr) __asm __volatile("fxsave %0" : "=m" (*(addr))) > #define ldmxcsr(csr) __asm __volatile("ldmxcsr %0" : : "m" (csr)) > +#define stmxcsr(addr) __asm __volatile("stmxcsr %0" : : "m" (*(addr))) > > static __inline void > xrstor(char *addr, uint64_t mask) > @@ -105,6 +106,7 @@ void fnstsw(caddr_t addr); > void fxsave(caddr_t addr); > void fxrstor(caddr_t addr); > void ldmxcsr(u_int csr); > +void stmxcsr(u_int csr); > void xrstor(char *addr, uint64_t mask); > void xsave(char *addr, uint64_t mask); I think this should use 'u_int *addr' rather than 'u_int csr'. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 18:04:39 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB51A106566B; Mon, 30 Jul 2012 18:04:39 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 7F7858FC0A; Mon, 30 Jul 2012 18:04:39 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id C5CC2B98C; Mon, 30 Jul 2012 14:04:38 -0400 (EDT) From: John Baldwin To: "David E. O'Brien" Date: Mon, 30 Jul 2012 11:19:48 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p17; KDE/4.5.5; amd64; ; ) References: <201207180557.q6I5vheM034018@svn.freebsd.org> In-Reply-To: <201207180557.q6I5vheM034018@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201207301119.49002.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 30 Jul 2012 14:04:38 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r238563 - head/gnu/usr.bin/groff/tmac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 18:04:39 -0000 On Wednesday, July 18, 2012 1:57:43 am David E. O'Brien wrote: > Author: obrien > Date: Wed Jul 18 05:57:42 2012 > New Revision: 238563 > URL: http://svn.freebsd.org/changeset/base/238563 > > Log: > a ";" tells make we want the shell to be used > > Submitted by: Simon Gerraty > > Modified: > head/gnu/usr.bin/groff/tmac/Makefile > > Modified: head/gnu/usr.bin/groff/tmac/Makefile > ============================================================================== > --- head/gnu/usr.bin/groff/tmac/Makefile Wed Jul 18 05:50:40 2012 (r238562) > +++ head/gnu/usr.bin/groff/tmac/Makefile Wed Jul 18 05:57:42 2012 (r238563) > @@ -68,7 +68,7 @@ beforeinstall: > cd ${.CURDIR}; \ > ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \ > koi8-r.tmac hyphen.ru ${DESTDIR}${TMACDIR} > - cd ${.OBJDIR} > + cd ${.OBJDIR}; Isn't this a nop now? That is, it changes the working directory in a temporary shell that immediately exits? -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 18:21:49 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 88F6B1065686; Mon, 30 Jul 2012 18:21:49 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 742778FC0C; Mon, 30 Jul 2012 18:21:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6UILneP022244; Mon, 30 Jul 2012 18:21:49 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6UILnA8022241; Mon, 30 Jul 2012 18:21:49 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201207301821.q6UILnA8022241@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 30 Jul 2012 18:21:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238912 - head/sys/dev/netmap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 18:21:49 -0000 Author: luigi Date: Mon Jul 30 18:21:48 2012 New Revision: 238912 URL: http://svn.freebsd.org/changeset/base/238912 Log: - move the inclusion of netmap headers to the common part of the code; - more portable annotations for unused arguments; Modified: head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_mem2.c Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Mon Jul 30 15:37:47 2012 (r238911) +++ head/sys/dev/netmap/netmap.c Mon Jul 30 18:21:48 2012 (r238912) @@ -90,13 +90,14 @@ __FBSDID("$FreeBSD$"); #include #include /* BIOCIMMEDIATE */ #include -#include -#include #include /* bus_dmamap_* */ MALLOC_DEFINE(M_NETMAP, "netmap", "Network memory map"); #endif /* __FreeBSD__ */ +#include +#include + /* * lock and unlock for the netmap memory allocator */ @@ -764,8 +765,8 @@ netmap_set_ringid(struct netmap_priv_d * * Return 0 on success, errno otherwise. */ static int -netmap_ioctl(__unused struct cdev *dev, u_long cmd, caddr_t data, - __unused int fflag, struct thread *td) +netmap_ioctl(struct cdev *dev, u_long cmd, caddr_t data, + int fflag, struct thread *td) { struct netmap_priv_d *priv = NULL; struct ifnet *ifp; @@ -775,6 +776,8 @@ netmap_ioctl(__unused struct cdev *dev, u_int i, lim; struct netmap_if *nifp; + (void)dev; /* UNUSED */ + (void)fflag; /* UNUSED */ #ifdef linux #define devfs_get_cdevpriv(pp) \ ({ *(struct netmap_priv_d **)pp = ((struct file *)td)->private_data; \ @@ -1551,7 +1554,7 @@ linux_netmap_poll(struct file * file, st } static int -netmap_mmap(__unused struct file *f, struct vm_area_struct *vma) +netmap_mmap(struct file *f, struct vm_area_struct *vma) { int lut_skip, i, j; int user_skip = 0; @@ -1565,6 +1568,7 @@ netmap_mmap(__unused struct file *f, str * vma->vm_end: end of the mapping user address space */ + (void)f; /* UNUSED */ // XXX security checks for (i = 0; i < 3; i++) { /* loop through obj_pools */ @@ -1599,7 +1603,7 @@ netmap_start_linux(struct sk_buff *skb, } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37) // XXX was 38 #define LIN_IOCTL_NAME .ioctl int linux_netmap_ioctl(struct inode *inode, struct file *file, u_int cmd, u_long data /* arg */) @@ -1623,8 +1627,9 @@ linux_netmap_ioctl(struct file *file, u_ static int -netmap_release(__unused struct inode *inode, struct file *file) +netmap_release(struct inode *inode, struct file *file) { + (void)inode; /* UNUSED */ if (file->private_data) netmap_dtor(file->private_data); return (0); Modified: head/sys/dev/netmap/netmap_mem2.c ============================================================================== --- head/sys/dev/netmap/netmap_mem2.c Mon Jul 30 15:37:47 2012 (r238911) +++ head/sys/dev/netmap/netmap_mem2.c Mon Jul 30 18:21:48 2012 (r238912) @@ -25,7 +25,7 @@ /* * $FreeBSD$ - * $Id: netmap_mem2.c 10830 2012-03-22 18:06:01Z luigi $ + * $Id: netmap_mem2.c 11445 2012-07-30 10:49:07Z luigi $ * * New memory allocator for netmap */ @@ -300,12 +300,13 @@ netmap_obj_free_va(struct netmap_obj_poo static void -netmap_new_bufs(struct netmap_if *nifp __unused, +netmap_new_bufs(struct netmap_if *nifp, struct netmap_slot *slot, u_int n) { struct netmap_obj_pool *p = nm_mem->nm_buf_pool; uint32_t i = 0; /* slot counter */ + (void)nifp; /* UNUSED */ for (i = 0; i < n; i++) { void *vaddr = netmap_buf_malloc(); if (vaddr == NULL) { From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 19:26:02 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8EB9106566B; Mon, 30 Jul 2012 19:26:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B32178FC12; Mon, 30 Jul 2012 19:26:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6UJQ2W2030225; Mon, 30 Jul 2012 19:26:02 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6UJQ2Aj030222; Mon, 30 Jul 2012 19:26:02 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201207301926.q6UJQ2Aj030222@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 30 Jul 2012 19:26:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238914 - in head/sys: amd64/amd64 i386/isa X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 19:26:02 -0000 Author: kib Date: Mon Jul 30 19:26:02 2012 New Revision: 238914 URL: http://svn.freebsd.org/changeset/base/238914 Log: Change (unused) prototype for stmxcsr() to match reality. Noted by: jhb MFC after: 1 week Modified: head/sys/amd64/amd64/fpu.c head/sys/i386/isa/npx.c Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Mon Jul 30 19:05:41 2012 (r238913) +++ head/sys/amd64/amd64/fpu.c Mon Jul 30 19:26:02 2012 (r238914) @@ -106,7 +106,7 @@ void fnstsw(caddr_t addr); void fxsave(caddr_t addr); void fxrstor(caddr_t addr); void ldmxcsr(u_int csr); -void stmxcsr(u_int csr); +void stmxcsr(u_int *csr); void xrstor(char *addr, uint64_t mask); void xsave(char *addr, uint64_t mask); Modified: head/sys/i386/isa/npx.c ============================================================================== --- head/sys/i386/isa/npx.c Mon Jul 30 19:05:41 2012 (r238913) +++ head/sys/i386/isa/npx.c Mon Jul 30 19:26:02 2012 (r238914) @@ -114,7 +114,7 @@ void frstor(caddr_t addr); #ifdef CPU_ENABLE_SSE void fxsave(caddr_t addr); void fxrstor(caddr_t addr); -void stmxcsr(u_int csr); +void stmxcsr(u_int *csr); #endif #endif /* __GNUCLIKE_ASM && !lint */ From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 20:08:10 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D65CF106564A; Mon, 30 Jul 2012 20:08:10 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id AC5838FC08; Mon, 30 Jul 2012 20:08:10 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 19133B97A; Mon, 30 Jul 2012 16:08:10 -0400 (EDT) From: John Baldwin To: Luigi Rizzo Date: Mon, 30 Jul 2012 14:45:45 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p17; KDE/4.5.5; amd64; ; ) References: <201207251128.q6PBSFlt052575@svn.freebsd.org> In-Reply-To: <201207251128.q6PBSFlt052575@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201207301445.45210.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 30 Jul 2012 16:08:10 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r238765 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 20:08:10 -0000 On Wednesday, July 25, 2012 7:28:15 am Luigi Rizzo wrote: > Author: luigi > Date: Wed Jul 25 11:28:15 2012 > New Revision: 238765 > URL: http://svn.freebsd.org/changeset/base/238765 > > Log: > Use legacy interrupts as a default. This gives up to 10% speedup > when used in qemu (and this driver is for non-PCIe cards, > so probably its largest use is in virtualized environments). > > Approved by: Jack Vogel > MFC after: 3 days Why not make this a tunable or some such? You could even have it only use the legacy handler under qemu easily enough. There's no reason this has to be a compile-time option. This is almost certainly slower on real hardware where this is important to work around dubious Intel Host-PCI bridges that result in aliased USB interrupts for every em(4) interrupt. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 20:38:38 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D69D106564A; Mon, 30 Jul 2012 20:38:38 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 695468FC17; Mon, 30 Jul 2012 20:38:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6UKcckd040490; Mon, 30 Jul 2012 20:38:38 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6UKcc8c040488; Mon, 30 Jul 2012 20:38:38 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201207302038.q6UKcc8c040488@svn.freebsd.org> From: Alan Cox Date: Mon, 30 Jul 2012 20:38:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238915 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 20:38:38 -0000 Author: alc Date: Mon Jul 30 20:38:37 2012 New Revision: 238915 URL: http://svn.freebsd.org/changeset/base/238915 Log: Eliminate an unneeded declaration. (I should have removed this as part of r227568.) Modified: head/sys/vm/vm_page.h Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Mon Jul 30 19:26:02 2012 (r238914) +++ head/sys/vm/vm_page.h Mon Jul 30 20:38:37 2012 (r238915) @@ -310,7 +310,6 @@ extern struct vpglocks pa_lock[]; * */ -struct vnode; extern int vm_page_zero_count; extern vm_page_t vm_page_array; /* First resident page in table */ From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 20:44:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C150106566C; Mon, 30 Jul 2012 20:44:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 370E68FC14; Mon, 30 Jul 2012 20:44:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6UKikJk041188; Mon, 30 Jul 2012 20:44:46 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6UKikjV041186; Mon, 30 Jul 2012 20:44:46 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201207302044.q6UKikjV041186@svn.freebsd.org> From: John Baldwin Date: Mon, 30 Jul 2012 20:44:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238917 - head/sys/i386/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 20:44:46 -0000 Author: jhb Date: Mon Jul 30 20:44:45 2012 New Revision: 238917 URL: http://svn.freebsd.org/changeset/base/238917 Log: The linux_lstat() system call accepts a pointer to a 'struct l_stat', not a 'struct ostat'. Modified: head/sys/i386/linux/syscalls.master Modified: head/sys/i386/linux/syscalls.master ============================================================================== --- head/sys/i386/linux/syscalls.master Mon Jul 30 20:40:14 2012 (r238916) +++ head/sys/i386/linux/syscalls.master Mon Jul 30 20:44:45 2012 (r238917) @@ -158,7 +158,7 @@ struct l_old_select_argv *ptr); } 83 AUE_SYMLINK STD { int linux_symlink(char *path, char *to); } ; 84: oldlstat -84 AUE_LSTAT STD { int linux_lstat(char *path, struct ostat *up); } +84 AUE_LSTAT STD { int linux_lstat(char *path, struct l_stat *up); } 85 AUE_READLINK STD { int linux_readlink(char *name, char *buf, \ l_int count); } 86 AUE_USELIB STD { int linux_uselib(char *library); } From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 20:45:18 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E79010656D6; Mon, 30 Jul 2012 20:45:18 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A13F8FC17; Mon, 30 Jul 2012 20:45:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6UKjINF041276; Mon, 30 Jul 2012 20:45:18 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6UKjI1Y041270; Mon, 30 Jul 2012 20:45:18 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201207302045.q6UKjI1Y041270@svn.freebsd.org> From: John Baldwin Date: Mon, 30 Jul 2012 20:45:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238918 - head/sys/i386/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 20:45:18 -0000 Author: jhb Date: Mon Jul 30 20:45:17 2012 New Revision: 238918 URL: http://svn.freebsd.org/changeset/base/238918 Log: Regen. Modified: head/sys/i386/linux/linux_proto.h head/sys/i386/linux/linux_syscall.h head/sys/i386/linux/linux_syscalls.c head/sys/i386/linux/linux_sysent.c head/sys/i386/linux/linux_systrace_args.c Modified: head/sys/i386/linux/linux_proto.h ============================================================================== --- head/sys/i386/linux/linux_proto.h Mon Jul 30 20:44:45 2012 (r238917) +++ head/sys/i386/linux/linux_proto.h Mon Jul 30 20:45:17 2012 (r238918) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 234359 2012-04-16 23:16:18Z jkim + * created from FreeBSD: head/sys/i386/linux/syscalls.master 238917 2012-07-30 20:44:45Z jhb */ #ifndef _LINUX_SYSPROTO_H_ @@ -261,7 +261,7 @@ struct linux_symlink_args { }; struct linux_lstat_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; - char up_l_[PADL_(struct ostat *)]; struct ostat * up; char up_r_[PADR_(struct ostat *)]; + char up_l_[PADL_(struct l_stat *)]; struct l_stat * up; char up_r_[PADR_(struct l_stat *)]; }; struct linux_readlink_args { char name_l_[PADL_(char *)]; char * name; char name_r_[PADR_(char *)]; Modified: head/sys/i386/linux/linux_syscall.h ============================================================================== --- head/sys/i386/linux/linux_syscall.h Mon Jul 30 20:44:45 2012 (r238917) +++ head/sys/i386/linux/linux_syscall.h Mon Jul 30 20:45:17 2012 (r238918) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 234359 2012-04-16 23:16:18Z jkim + * created from FreeBSD: head/sys/i386/linux/syscalls.master 238917 2012-07-30 20:44:45Z jhb */ #define LINUX_SYS_exit 1 Modified: head/sys/i386/linux/linux_syscalls.c ============================================================================== --- head/sys/i386/linux/linux_syscalls.c Mon Jul 30 20:44:45 2012 (r238917) +++ head/sys/i386/linux/linux_syscalls.c Mon Jul 30 20:45:17 2012 (r238918) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 234359 2012-04-16 23:16:18Z jkim + * created from FreeBSD: head/sys/i386/linux/syscalls.master 238917 2012-07-30 20:44:45Z jhb */ const char *linux_syscallnames[] = { Modified: head/sys/i386/linux/linux_sysent.c ============================================================================== --- head/sys/i386/linux/linux_sysent.c Mon Jul 30 20:44:45 2012 (r238917) +++ head/sys/i386/linux/linux_sysent.c Mon Jul 30 20:45:17 2012 (r238918) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 234359 2012-04-16 23:16:18Z jkim + * created from FreeBSD: head/sys/i386/linux/syscalls.master 238917 2012-07-30 20:44:45Z jhb */ #include Modified: head/sys/i386/linux/linux_systrace_args.c ============================================================================== --- head/sys/i386/linux/linux_systrace_args.c Mon Jul 30 20:44:45 2012 (r238917) +++ head/sys/i386/linux/linux_systrace_args.c Mon Jul 30 20:45:17 2012 (r238918) @@ -570,7 +570,7 @@ systrace_args(int sysnum, void *params, case 84: { struct linux_lstat_args *p = params; uarg[0] = (intptr_t) p->path; /* char * */ - uarg[1] = (intptr_t) p->up; /* struct ostat * */ + uarg[1] = (intptr_t) p->up; /* struct l_stat * */ *n_args = 2; break; } @@ -3192,7 +3192,7 @@ systrace_entry_setargdesc(int sysnum, in p = "char *"; break; case 1: - p = "struct ostat *"; + p = "struct l_stat *"; break; default: break; From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 20:56:20 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 06356106566B; Mon, 30 Jul 2012 20:56:20 +0000 (UTC) (envelope-from issyl0@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E38AB8FC16; Mon, 30 Jul 2012 20:56:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6UKuJIx042627; Mon, 30 Jul 2012 20:56:19 GMT (envelope-from issyl0@svn.freebsd.org) Received: (from issyl0@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6UKuJ8Z042620; Mon, 30 Jul 2012 20:56:19 GMT (envelope-from issyl0@svn.freebsd.org) Message-Id: <201207302056.q6UKuJ8Z042620@svn.freebsd.org> From: Isabell Long Date: Mon, 30 Jul 2012 20:56:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238919 - head/lib/libc/locale X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 20:56:20 -0000 Author: issyl0 (doc committer) Date: Mon Jul 30 20:56:19 2012 New Revision: 238919 URL: http://svn.freebsd.org/changeset/base/238919 Log: Add more locale-specific functions to the relevant man pages and Makefile: - lib/libc/locale/islower.3 - lib/libc/locale/ispunct.3 - lib/libc/locale/nl_langinfo.3 - lib/libc/locale/isgraph.3 - lib/libc/locale/isspace.3 Reviewed by: bz Approved by: theraven MFC after: 5 days Modified: head/lib/libc/locale/Makefile.inc head/lib/libc/locale/isgraph.3 head/lib/libc/locale/islower.3 head/lib/libc/locale/ispunct.3 head/lib/libc/locale/isspace.3 head/lib/libc/locale/nl_langinfo.3 Modified: head/lib/libc/locale/Makefile.inc ============================================================================== --- head/lib/libc/locale/Makefile.inc Mon Jul 30 20:45:17 2012 (r238918) +++ head/lib/libc/locale/Makefile.inc Mon Jul 30 20:56:19 2012 (r238919) @@ -47,6 +47,11 @@ MAN+= big5.5 euc.5 gb18030.5 gb2312.5 gb MLINKS+=btowc.3 wctob.3 MLINKS+=isdigit.3 isnumber.3 +MLINKS+=isgraph.3 isgraph_l.3 +MLINKS+=islower.3 islower_l.3 +MLINKS+=ispunct.3 ispunct_l.3 +MLINKS+=isspace.3 isspace_l.3 +MLINKS+=nl_langinfo.3 nl_langinfo_l.3 MLINKS+=iswalnum.3 iswalpha.3 iswalnum.3 iswascii.3 iswalnum.3 iswblank.3 \ iswalnum.3 iswcntrl.3 iswalnum.3 iswdigit.3 iswalnum.3 iswgraph.3 \ iswalnum.3 iswhexnumber.3 \ Modified: head/lib/libc/locale/isgraph.3 ============================================================================== --- head/lib/libc/locale/isgraph.3 Mon Jul 30 20:45:17 2012 (r238918) +++ head/lib/libc/locale/isgraph.3 Mon Jul 30 20:56:19 2012 (r238919) @@ -32,7 +32,7 @@ .\" @(#)isgraph.3 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd July 17, 2005 +.Dd July 30, 2012 .Dt ISGRAPH 3 .Os .Sh NAME @@ -44,6 +44,8 @@ .In ctype.h .Ft int .Fn isgraph "int c" +.Ft int +.Fn isgraph_l "int c" "locale_t loc" .Sh DESCRIPTION The .Fn isgraph @@ -79,11 +81,19 @@ In the ASCII character set, this include .It "\&166\ ``v''" Ta "167\ ``w''" Ta "170\ ``x''" Ta "171\ ``y''" Ta "172\ ``z''" .It "\&173\ ``{''" Ta "174\ ``|''" Ta "175\ ``}''" Ta "176\ ``~''" Ta \& .El +.Pp +The +.Fn isgraph_l +function takes an explicit locale argument, whereas the +.Fn isgraph +function uses the current global or per-thread locale. .Sh RETURN VALUES The .Fn isgraph -function returns zero if the character tests false and -returns non-zero if the character tests true. +and +.Fn isgraph_l +functions return zero if the character tests false and +return non-zero if the character tests true. .Sh COMPATIBILITY The .Bx 4.4 @@ -103,3 +113,7 @@ The .Fn isgraph function conforms to .St -isoC . +The +.Fn isgraph_l +function conforms to +.St -p1003.1-2008 . Modified: head/lib/libc/locale/islower.3 ============================================================================== --- head/lib/libc/locale/islower.3 Mon Jul 30 20:45:17 2012 (r238918) +++ head/lib/libc/locale/islower.3 Mon Jul 30 20:56:19 2012 (r238919) @@ -32,7 +32,7 @@ .\" @(#)islower.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd July 17, 2005 +.Dd July 30, 2012 .Dt ISLOWER 3 .Os .Sh NAME @@ -44,6 +44,8 @@ .In ctype.h .Ft int .Fn islower "int c" +.Ft int +.Fn islower_l "int c" "locale_t loc" .Sh DESCRIPTION The .Fn islower @@ -63,11 +65,18 @@ In the ASCII character set, this include .It "\&165\ ``u''" Ta "166\ ``v''" Ta "167\ ``w''" Ta "170\ ``x''" Ta "171\ ``y''" .It "\&172\ ``z''" Ta \& Ta \& Ta \& Ta \& .El +The +.Fn islower_l +function takes an explicit locale argument, whereas the +.Fn islower +function uses the current global or per-thread locale. .Sh RETURN VALUES The .Fn islower -function returns zero if the character tests false and -returns non-zero if the character tests true. +and +.Fn islower_l +functions return zero if the character tests false and +return non-zero if the character tests true. .Sh COMPATIBILITY The .Bx 4.4 @@ -88,3 +97,7 @@ The .Fn islower function conforms to .St -isoC . +The +.Fn islower_l +function conforms to +.St -p1003.1-2008 . Modified: head/lib/libc/locale/ispunct.3 ============================================================================== --- head/lib/libc/locale/ispunct.3 Mon Jul 30 20:45:17 2012 (r238918) +++ head/lib/libc/locale/ispunct.3 Mon Jul 30 20:56:19 2012 (r238919) @@ -32,7 +32,7 @@ .\" @(#)ispunct.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd July 17, 2005 +.Dd July 30, 2012 .Dt ISPUNCT 3 .Os .Sh NAME @@ -44,6 +44,8 @@ .In ctype.h .Ft int .Fn ispunct "int c" +.Ft int +.Fn ispunct_l "int c" "locale_t loc" .Sh DESCRIPTION The .Fn ispunct @@ -69,11 +71,19 @@ In the ASCII character set, this include .It "\&136\ ``^''" Ta "137\ ``_''" Ta "140\ ```''" Ta "173\ ``{''" Ta "174\ ``|''" .It "\&175\ ``}''" Ta "176\ ``~''" Ta \& Ta \& Ta \& .El +.Pp +The +.Fn ispunct_l +function takes an explicit locale argument, whereas the +.Fn ispunct +function uses the current global or per-thread locale. .Sh RETURN VALUES The .Fn ispunct -function returns zero if the character tests false and -returns non-zero if the character tests true. +and +.Fn ispunct_l +functions return zero if the character tests false and +return non-zero if the character tests true. .Sh COMPATIBILITY The .Bx 4.4 @@ -93,3 +103,7 @@ The .Fn ispunct function conforms to .St -isoC . +The +.Fn ispunct_l +function conforms to +.St -p1003.1-2008 . Modified: head/lib/libc/locale/isspace.3 ============================================================================== --- head/lib/libc/locale/isspace.3 Mon Jul 30 20:45:17 2012 (r238918) +++ head/lib/libc/locale/isspace.3 Mon Jul 30 20:56:19 2012 (r238919) @@ -32,7 +32,7 @@ .\" @(#)isspace.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd July 17, 2005 +.Dd July 30, 2012 .Dt ISSPACE 3 .Os .Sh NAME @@ -44,6 +44,8 @@ .In ctype.h .Ft int .Fn isspace "int c" +.Ft int +.Fn isspace_l "int c" "locale_t loc" .Sh DESCRIPTION The .Fn isspace @@ -60,11 +62,19 @@ The value of the argument must be repres .Vt "unsigned char" or the value of .Dv EOF . +.Pp +The +.Fn isspace_l +function takes an explicit locale argument, whereas the +.Fn isspace +function uses the current global or per-thread locale. .Sh RETURN VALUES The .Fn isspace -function returns zero if the character tests false and -returns non-zero if the character tests true. +and +.Fn isspace_l +functions return zero if the character tests false and +return non-zero if the character tests true. .Sh COMPATIBILITY The .Bx 4.4 @@ -85,3 +95,7 @@ The .Fn isspace function conforms to .St -isoC . +The +.Fn isspace_l +function conforms to +.St -p1003.1-2008 . Modified: head/lib/libc/locale/nl_langinfo.3 ============================================================================== --- head/lib/libc/locale/nl_langinfo.3 Mon Jul 30 20:45:17 2012 (r238918) +++ head/lib/libc/locale/nl_langinfo.3 Mon Jul 30 20:56:19 2012 (r238919) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 3, 2001 +.Dd July 30, 2012 .Dt NL_LANGINFO 3 .Os .Sh NAME @@ -36,11 +36,16 @@ .In langinfo.h .Ft char * .Fn nl_langinfo "nl_item item" +.Ft char * +.Fn nl_langinfo_l "nl_item item" "locale_t loc" .Sh DESCRIPTION The .Fn nl_langinfo function returns a pointer to a string containing information relevant to -the particular language or cultural area defined in the program's locale. +the particular language or cultural area defined in the program or thread's +locale, or in the case of +.Fn nl_langinfo_l , +the locale passed as the second argument. The manifest constant names and values of .Fa item are defined in @@ -60,6 +65,9 @@ In a locale where langinfo data is not d returns a pointer to the corresponding string in the .Tn POSIX locale. +.Fn nl_langinfo_l +returns the same values as +.Fn nl_langinfo . In all locales, .Fn nl_langinfo returns a pointer to an empty string if @@ -83,6 +91,10 @@ The .Fn nl_langinfo function conforms to .St -susv2 . +The +.Fn nl_langinfo_l +function conforms to +.St -p1003.1-2008 . .Sh HISTORY The .Fn nl_langinfo From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 21:02:45 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 032B9106564A; Mon, 30 Jul 2012 21:02:45 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E19438FC08; Mon, 30 Jul 2012 21:02:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6UL2iQm043312; Mon, 30 Jul 2012 21:02:44 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6UL2iFK043309; Mon, 30 Jul 2012 21:02:44 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201207302102.q6UL2iFK043309@svn.freebsd.org> From: Joel Dahl Date: Mon, 30 Jul 2012 21:02:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238920 - head/lib/libc/locale X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 21:02:45 -0000 Author: joel (doc committer) Date: Mon Jul 30 21:02:44 2012 New Revision: 238920 URL: http://svn.freebsd.org/changeset/base/238920 Log: Remove trailing whitespace. Modified: head/lib/libc/locale/islower.3 Modified: head/lib/libc/locale/islower.3 ============================================================================== --- head/lib/libc/locale/islower.3 Mon Jul 30 20:56:19 2012 (r238919) +++ head/lib/libc/locale/islower.3 Mon Jul 30 21:02:44 2012 (r238920) @@ -69,7 +69,7 @@ The .Fn islower_l function takes an explicit locale argument, whereas the .Fn islower -function uses the current global or per-thread locale. +function uses the current global or per-thread locale. .Sh RETURN VALUES The .Fn islower From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 21:19:19 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB6F4106564A; Mon, 30 Jul 2012 21:19:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A63208FC0A; Mon, 30 Jul 2012 21:19:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6ULJJjP044908; Mon, 30 Jul 2012 21:19:19 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6ULJJ6M044906; Mon, 30 Jul 2012 21:19:19 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201207302119.q6ULJJ6M044906@svn.freebsd.org> From: Warner Losh Date: Mon, 30 Jul 2012 21:19:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238921 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 21:19:19 -0000 Author: imp Date: Mon Jul 30 21:19:19 2012 New Revision: 238921 URL: http://svn.freebsd.org/changeset/base/238921 Log: List the members of the AT91SAM9G45 family. Modified: head/sys/arm/at91/std.at91sam9g45 Modified: head/sys/arm/at91/std.at91sam9g45 ============================================================================== --- head/sys/arm/at91/std.at91sam9g45 Mon Jul 30 21:02:44 2012 (r238920) +++ head/sys/arm/at91/std.at91sam9g45 Mon Jul 30 21:19:19 2012 (r238921) @@ -1,6 +1,9 @@ # $FreeBSD$ # -# PHYSADDR is different on at91sam9g45 than the other at91sam SoCs +# Unlike other Atmel SoCs, which have their SDRAM at CS1, the +# at91sam9g45 family has it on CS6, so PHYSADDR must be adjusted +# accordingly. The at91sam9g45, at91sam9g46, at91sam9m10 and at91sam9m11 +# SoCs are members of this family. files "../at91/files.at91" cpu CPU_ARM9 From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 21:30:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 816291065670; Mon, 30 Jul 2012 21:30:44 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6BF198FC12; Mon, 30 Jul 2012 21:30:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6ULUi6R045857; Mon, 30 Jul 2012 21:30:44 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6ULUi9M045851; Mon, 30 Jul 2012 21:30:44 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201207302130.q6ULUi9M045851@svn.freebsd.org> From: Warner Losh Date: Mon, 30 Jul 2012 21:30:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238922 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 21:30:44 -0000 Author: imp Date: Mon Jul 30 21:30:43 2012 New Revision: 238922 URL: http://svn.freebsd.org/changeset/base/238922 Log: These files will support the whole at91sam9x5 family when done, so rename them now before they get copied further afield... Added: head/sys/arm/at91/at91sam9x5.c - copied, changed from r238879, head/sys/arm/at91/at91sam9x25.c head/sys/arm/at91/at91sam9x5reg.h - copied, changed from r238879, head/sys/arm/at91/at91sam9x25reg.h Deleted: head/sys/arm/at91/at91sam9x25.c head/sys/arm/at91/at91sam9x25reg.h Modified: head/sys/arm/at91/files.at91 head/sys/arm/at91/std.atmel head/sys/arm/at91/std.sam9x25ek Copied and modified: head/sys/arm/at91/at91sam9x5.c (from r238879, head/sys/arm/at91/at91sam9x25.c) ============================================================================== --- head/sys/arm/at91/at91sam9x25.c Sun Jul 29 01:01:35 2012 (r238879, copy source) +++ head/sys/arm/at91/at91sam9x5.c Mon Jul 30 21:30:43 2012 (r238922) @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include Copied and modified: head/sys/arm/at91/at91sam9x5reg.h (from r238879, head/sys/arm/at91/at91sam9x25reg.h) ============================================================================== --- head/sys/arm/at91/at91sam9x25reg.h Sun Jul 29 01:01:35 2012 (r238879, copy source) +++ head/sys/arm/at91/at91sam9x5reg.h Mon Jul 30 21:30:43 2012 (r238922) @@ -27,8 +27,8 @@ /* $FreeBSD$ */ -#ifndef AT91SAM9X25REG_H_ -#define AT91SAM9X25REG_H_ +#ifndef AT91SAM9X5REG_H_ +#define AT91SAM9X5REG_H_ #ifndef AT91SAM9X25_MASTER_CLOCK #define AT91SAM9X25_MASTER_CLOCK ((18432000 * 43)/6) @@ -312,5 +312,4 @@ #define AT91SAM9X25_SDRAMC_ISR 0x20 #define AT91SAM9X25_SDRAMC_MDR 0x24 -#endif /* AT91SAM9X25REG_H_*/ - +#endif /* AT91SAM9X5REG_H_*/ Modified: head/sys/arm/at91/files.at91 ============================================================================== --- head/sys/arm/at91/files.at91 Mon Jul 30 21:19:19 2012 (r238921) +++ head/sys/arm/at91/files.at91 Mon Jul 30 21:30:43 2012 (r238922) @@ -33,7 +33,7 @@ arm/at91/at91rm9200_devices.c optional a arm/at91/at91sam9260.c optional at91sam9260 arm/at91/at91sam9g20.c optional at91sam9g20 arm/at91/at91sam9g45.c optional at91sam9g45 -arm/at91/at91sam9x25.c optional at91sam9x25 +arm/at91/at91sam9x5.c optional at91sam9x5 # # All the boards we support # Modified: head/sys/arm/at91/std.atmel ============================================================================== --- head/sys/arm/at91/std.atmel Mon Jul 30 21:19:19 2012 (r238921) +++ head/sys/arm/at91/std.atmel Mon Jul 30 21:30:43 2012 (r238922) @@ -10,7 +10,7 @@ device at91rm9200 device at91sam9260 device at91sam9g20 device at91sam9g45 -device at91sam9x25 +device at91sam9x5 # bring in the sam specific timers and such device at91sam9 Modified: head/sys/arm/at91/std.sam9x25ek ============================================================================== --- head/sys/arm/at91/std.sam9x25ek Mon Jul 30 21:19:19 2012 (r238921) +++ head/sys/arm/at91/std.sam9x25ek Mon Jul 30 21:30:43 2012 (r238922) @@ -8,4 +8,4 @@ options KERNPHYSADDR=0x20000000 options KERNVIRTADDR=0xc0000000 device at91_board_sam9x25ek -device at91sam9x25 +device at91sam9x5 From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 21:55:50 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8ACA0106564A; Mon, 30 Jul 2012 21:55:50 +0000 (UTC) (envelope-from kargl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 75E138FC0C; Mon, 30 Jul 2012 21:55:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6ULtoNK048382; Mon, 30 Jul 2012 21:55:50 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6ULtoaN048378; Mon, 30 Jul 2012 21:55:50 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201207302155.q6ULtoaN048378@svn.freebsd.org> From: Steve Kargl Date: Mon, 30 Jul 2012 21:55:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238923 - in head/lib/msun: ld128 ld80 src X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 21:55:50 -0000 Author: kargl Date: Mon Jul 30 21:55:49 2012 New Revision: 238923 URL: http://svn.freebsd.org/changeset/base/238923 Log: Whitespace. Submitted by: bde Approved by: das (pre-approved) Modified: head/lib/msun/ld128/s_expl.c head/lib/msun/ld80/s_expl.c head/lib/msun/src/s_cbrtl.c Modified: head/lib/msun/ld128/s_expl.c ============================================================================== --- head/lib/msun/ld128/s_expl.c Mon Jul 30 21:30:43 2012 (r238922) +++ head/lib/msun/ld128/s_expl.c Mon Jul 30 21:55:49 2012 (r238923) @@ -58,7 +58,7 @@ P9 = 2.755731922401038678178761995444688 P10 = 2.75573236172670046201884000197885520e-7L, P11 = 2.50517544183909126492878226167697856e-8L; -#define INTERVALS 128 +#define INTERVALS 128 static const struct { long double hi; @@ -205,7 +205,7 @@ expl(long double x) /* Filter out exceptional cases. */ u.e = x; hx = u.xbits.expsign; - ix = hx & 0x7fff; + ix = hx & 0x7fff; if (ix >= BIAS + 13) { /* |x| >= 8192 or x is NaN */ if (ix == BIAS + LDBL_MAX_EXP) { if (u.xbits.manh != 0 Modified: head/lib/msun/ld80/s_expl.c ============================================================================== --- head/lib/msun/ld80/s_expl.c Mon Jul 30 21:30:43 2012 (r238922) +++ head/lib/msun/ld80/s_expl.c Mon Jul 30 21:55:49 2012 (r238923) @@ -88,7 +88,7 @@ P6 = 1.3888891738560272e-3; /* 0x16c1 * the first 47 (?!) bits of the significand is stored in hi and the next 53 * bits are in lo. */ -#define INTERVALS 128 +#define INTERVALS 128 static const struct { double hi; Modified: head/lib/msun/src/s_cbrtl.c ============================================================================== --- head/lib/msun/src/s_cbrtl.c Mon Jul 30 21:30:43 2012 (r238922) +++ head/lib/msun/src/s_cbrtl.c Mon Jul 30 21:55:49 2012 (r238923) @@ -52,7 +52,6 @@ cbrtl(long double x) return (x + x); ENTERI(); - if (k == 0) { /* If x = +-0, then cbrt(x) = +-0. */ if ((u.bits.manh | u.bits.manl) == 0) From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 21:58:28 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C3C651065670; Mon, 30 Jul 2012 21:58:28 +0000 (UTC) (envelope-from kargl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AF76C8FC15; Mon, 30 Jul 2012 21:58:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6ULwSSD048680; Mon, 30 Jul 2012 21:58:28 GMT (envelope-from kargl@svn.freebsd.org) Received: (from kargl@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6ULwSS7048678; Mon, 30 Jul 2012 21:58:28 GMT (envelope-from kargl@svn.freebsd.org) Message-Id: <201207302158.q6ULwSS7048678@svn.freebsd.org> From: Steve Kargl Date: Mon, 30 Jul 2012 21:58:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238924 - head/lib/msun/src X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 21:58:28 -0000 Author: kargl Date: Mon Jul 30 21:58:28 2012 New Revision: 238924 URL: http://svn.freebsd.org/changeset/base/238924 Log: ieeefp.h is only needed on i386 class hardware. Submitted by: bde Approved by: das (pre-approved) Modified: head/lib/msun/src/s_cbrtl.c Modified: head/lib/msun/src/s_cbrtl.c ============================================================================== --- head/lib/msun/src/s_cbrtl.c Mon Jul 30 21:55:49 2012 (r238923) +++ head/lib/msun/src/s_cbrtl.c Mon Jul 30 21:58:28 2012 (r238924) @@ -18,7 +18,9 @@ __FBSDID("$FreeBSD$"); #include +#ifdef __i386__ #include +#endif #include "fpmath.h" #include "math.h" From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 22:28:15 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 931331065672; Mon, 30 Jul 2012 22:28:15 +0000 (UTC) (envelope-from Daan@vitsch.nl) Received: from VM01.VEHosting.nl (VM016.VEHosting.nl [IPv6:2001:1af8:2100:b020::140]) by mx1.freebsd.org (Postfix) with ESMTP id 2B9418FC1F; Mon, 30 Jul 2012 22:28:14 +0000 (UTC) Received: from [2001:470:d233:2:224:8cff:fe82:66cd] ([IPv6:2001:470:d233:2:224:8cff:fe82:66cd]) (authenticated bits=0) by VM01.VEHosting.nl (8.14.3/8.13.8) with ESMTP id q6UMSHTO044809; Tue, 31 Jul 2012 00:28:17 +0200 (CEST) (envelope-from Daan@vitsch.nl) From: Daan Vreeken Organization: Vitsch Electronics To: svn-src-all@freebsd.org Date: Tue, 31 Jul 2012 00:28:12 +0200 User-Agent: KMail/1.9.10 References: <201206290418.q5T4IqpX018099@svn.freebsd.org> In-Reply-To: <201206290418.q5T4IqpX018099@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201207310028.12533.Daan@vitsch.nl> x-ve-auth-version: mi-1.1.5 2011-02-07 - Copyright (c) 2008, 2011 - Daan Vreeken - VEHosting x-ve-auth: authenticated as 'pa4dan' on VM01.VEHosting.nl Cc: svn-src-head@freebsd.org, src-committers@freebsd.org, Warner Losh Subject: Re: svn commit: r237742 - in head/sys/arm: at91 conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 22:28:15 -0000 Hi Warner, On Friday 29 June 2012 06:18:52 Warner Losh wrote: > Author: imp > Date: Fri Jun 29 04:18:52 2012 > New Revision: 237742 > URL: http://svn.freebsd.org/changeset/base/237742 > > Log: > Initital support for AT91SAM9X25 SoC and the SAM9X25-EK evaluation > board. Much work remains. ... > Added: head/sys/arm/at91/at91sam9x25.c > =========================================================================== >=== --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/arm/at91/at91sam9x25.c Fri Jun 29 04:18:52 2012 (r237742) > @@ -0,0 +1,343 @@ ... > +static uint32_t > +at91_pll_outa(int freq) > +{ > + > + switch (freq / 10000000) { You seem to be dividing freq into multiples of 10MHz instead of 1MHz here. I think dividing by 1e6 was the intention. > + case 747 ... 801: return ((1 << 29) | (0 << 14)); > + case 697 ... 746: return ((1 << 29) | (1 << 14)); > + case 647 ... 696: return ((1 << 29) | (2 << 14)); > + case 597 ... 646: return ((1 << 29) | (3 << 14)); > + case 547 ... 596: return ((1 << 29) | (1 << 14)); > + case 497 ... 546: return ((1 << 29) | (2 << 14)); > + case 447 ... 496: return ((1 << 29) | (3 << 14)); > + case 397 ... 446: return ((1 << 29) | (4 << 14)); The (4 << 14) looks a bit strange here, as OUTA only occupies bit 14 and 15 of CKGR_PLLAR. (See Atmel doc11054, page 201 and 1103.) Maybe this entire routine could be written as something like: uint8_t outa; freq /= 1000000; // optional: //freq += 3; // see doc11054, page 1103 outa = 3 - ((freq / 50) & 3); return ((1 << 29) | (outa << 14)); Just glancing at the code, setting ICPLLA in PMC_PLLICPR for frequencies <= 600MHz seems to be missing at this moment (or I'm just not seeing it). (see page 212 and 1103) Regards, -- Daan Vreeken Vitsch Electronics http://Vitsch.nl/ http://VitschVPN.nl/ tel: +31-(0)40-7113051 KvK nr: 17174380 From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 22:46:43 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B5A6106566C; Mon, 30 Jul 2012 22:46:43 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F0B1C8FC0A; Mon, 30 Jul 2012 22:46:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6UMkgqU053642; Mon, 30 Jul 2012 22:46:42 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6UMkgcA053639; Mon, 30 Jul 2012 22:46:42 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201207302246.q6UMkgcA053639@svn.freebsd.org> From: Davide Italiano Date: Mon, 30 Jul 2012 22:46:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238925 - in head/sys: conf kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 22:46:43 -0000 Author: davide Date: Mon Jul 30 22:46:42 2012 New Revision: 238925 URL: http://svn.freebsd.org/changeset/base/238925 Log: Until now KTR_ENTRIES, which defines the size of circular buffer used in ktr(4), was constrained to be a power of two. Remove this constraint and update sys/conf/NOTES accordingly. Reviewed by: jhb Approved by: gnn (mentor) Sponsored by: Google Summer of Code 2012 Modified: head/sys/conf/NOTES head/sys/kern/kern_ktr.c Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Mon Jul 30 21:58:28 2012 (r238924) +++ head/sys/conf/NOTES Mon Jul 30 22:46:42 2012 (r238925) @@ -435,7 +435,7 @@ options KTRACE_REQUEST_POOL=101 # # KTR is a kernel tracing facility imported from BSD/OS. It is # enabled with the KTR option. KTR_ENTRIES defines the number of -# entries in the circular trace buffer; it must be a power of two. +# entries in the circular trace buffer; it may be an arbitrary number. # KTR_COMPILE defines the mask of events to compile into the kernel as # defined by the KTR_* constants in . KTR_MASK defines the # initial value of the ktr_mask variable which determines at runtime Modified: head/sys/kern/kern_ktr.c ============================================================================== --- head/sys/kern/kern_ktr.c Mon Jul 30 21:58:28 2012 (r238924) +++ head/sys/kern/kern_ktr.c Mon Jul 30 22:46:42 2012 (r238925) @@ -283,7 +283,7 @@ ktr_tracepoint(u_int mask, const char *f { do { saveindex = ktr_idx; - newindex = (saveindex + 1) & (KTR_ENTRIES - 1); + newindex = (saveindex + 1) % KTR_ENTRIES; } while (atomic_cmpset_rel_int(&ktr_idx, saveindex, newindex) == 0); entry = &ktr_buf[saveindex]; } @@ -338,7 +338,7 @@ static int db_mach_vtrace(void); DB_SHOW_COMMAND(ktr, db_ktr_all) { - tstate.cur = (ktr_idx - 1) & (KTR_ENTRIES - 1); + tstate.cur = (ktr_idx - 1) % KTR_ENTRIES; tstate.first = -1; db_ktr_verbose = 0; db_ktr_verbose |= (strchr(modif, 'v') != NULL) ? 2 : 0; From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 22:48:36 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F11131065670; Mon, 30 Jul 2012 22:48:35 +0000 (UTC) (envelope-from davide.italiano@gmail.com) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 7ABAB8FC12; Mon, 30 Jul 2012 22:48:35 +0000 (UTC) Received: by vbmv11 with SMTP id v11so6300227vbm.13 for ; Mon, 30 Jul 2012 15:48: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 :x-google-sender-auth:message-id:subject:from:to:content-type; bh=M36M6m73AM/v+BUrisplv/aYE9WjQizm4AUYl1WcGsI=; b=HowAR4a67sECK5HGn975HJiFpyfcNh2Q9To7/UVdQg7q4ZaEpZ1h4KEAljkYMkkqp7 K9kJS25Ipn4+RoNS36Kj0L+Pa3ueOWFhKUdlpkb/PvhjhxQzNH62DLEvW0l2uiUGwOAN DH4pE+urw7SZ29u8u3HRttQYoLSxdqLNinoVQyzGjkKqQ/OAEgzTM/MC+7r4ryUCQJYf DdphOoA79QOTW5n93yw3aXIr+Vgp05r/3hbN1DnuMfOAseap0irrSx8pLVL6NVfIySI7 75U289f7sOCIE0aTupY3UloSO8MUFO2BW6FeukmffAnqYKfio8sKsOgDNtvtcwulydcz gXNg== MIME-Version: 1.0 Received: by 10.52.71.79 with SMTP id s15mr11049523vdu.86.1343688514800; Mon, 30 Jul 2012 15:48:34 -0700 (PDT) Sender: davide.italiano@gmail.com Received: by 10.58.196.170 with HTTP; Mon, 30 Jul 2012 15:48:34 -0700 (PDT) In-Reply-To: <201207302246.q6UMkgcA053639@svn.freebsd.org> References: <201207302246.q6UMkgcA053639@svn.freebsd.org> Date: Tue, 31 Jul 2012 00:48:34 +0200 X-Google-Sender-Auth: B4Ow7mcCRKQK2sE5XYltxqpiItM Message-ID: From: Davide Italiano To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Cc: Subject: Re: svn commit: r238925 - in head/sys: conf kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 22:48:36 -0000 On Tue, Jul 31, 2012 at 12:46 AM, Davide Italiano wrote: > Author: davide > Date: Mon Jul 30 22:46:42 2012 > New Revision: 238925 > URL: http://svn.freebsd.org/changeset/base/238925 > > Log: > Until now KTR_ENTRIES, which defines the size of circular buffer used in > ktr(4), was constrained to be a power of two. Remove this constraint and > update sys/conf/NOTES accordingly. > > Reviewed by: jhb > Approved by: gnn (mentor) > Sponsored by: Google Summer of Code 2012 > > Modified: > head/sys/conf/NOTES > head/sys/kern/kern_ktr.c > > Modified: head/sys/conf/NOTES > ============================================================================== > --- head/sys/conf/NOTES Mon Jul 30 21:58:28 2012 (r238924) > +++ head/sys/conf/NOTES Mon Jul 30 22:46:42 2012 (r238925) > @@ -435,7 +435,7 @@ options KTRACE_REQUEST_POOL=101 > # > # KTR is a kernel tracing facility imported from BSD/OS. It is > # enabled with the KTR option. KTR_ENTRIES defines the number of > -# entries in the circular trace buffer; it must be a power of two. > +# entries in the circular trace buffer; it may be an arbitrary number. > # KTR_COMPILE defines the mask of events to compile into the kernel as > # defined by the KTR_* constants in . KTR_MASK defines the > # initial value of the ktr_mask variable which determines at runtime > > Modified: head/sys/kern/kern_ktr.c > ============================================================================== > --- head/sys/kern/kern_ktr.c Mon Jul 30 21:58:28 2012 (r238924) > +++ head/sys/kern/kern_ktr.c Mon Jul 30 22:46:42 2012 (r238925) > @@ -283,7 +283,7 @@ ktr_tracepoint(u_int mask, const char *f > { > do { > saveindex = ktr_idx; > - newindex = (saveindex + 1) & (KTR_ENTRIES - 1); > + newindex = (saveindex + 1) % KTR_ENTRIES; > } while (atomic_cmpset_rel_int(&ktr_idx, saveindex, newindex) == 0); > entry = &ktr_buf[saveindex]; > } > @@ -338,7 +338,7 @@ static int db_mach_vtrace(void); > DB_SHOW_COMMAND(ktr, db_ktr_all) > { > > - tstate.cur = (ktr_idx - 1) & (KTR_ENTRIES - 1); > + tstate.cur = (ktr_idx - 1) % KTR_ENTRIES; > tstate.first = -1; > db_ktr_verbose = 0; > db_ktr_verbose |= (strchr(modif, 'v') != NULL) ? 2 : 0; I forget this: MFC after: 3 days. From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 23:00:11 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 602291065673; Mon, 30 Jul 2012 23:00:09 +0000 (UTC) (envelope-from jfvogel@gmail.com) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 8CAB78FC08; Mon, 30 Jul 2012 23:00:08 +0000 (UTC) Received: by vbmv11 with SMTP id v11so6309275vbm.13 for ; Mon, 30 Jul 2012 16:00:08 -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=B81uIMuv6V/+ZPnBx00craoUzWstqjtvtkDtpkv4wg8=; b=A0EqT9DcEI5mE9xJENATwEnnvubPAm+K4x9fEAlONSPURPF0sYQDH+xD7Fip66Rkqc d3KbQR6198LZ++mx8nyoO1uf+1qQ85feqLNaTBLQquhLT6hgb4q/5ukNYWVlsT1DC1ef VtfPPtliJ/sS1dpmeu2AjG9ErhOtDKSnZ5FX/5PkKnDXX/jWztH+MGCyfFsEhEQ2N738 UsRH4l5CPm18aTcb8u+2JSm3Wn3v4NI/eyznTB6H5in2n9WyQYmwuRp+uYsDVJx8TpgC xEUJkB4YtY1BxHBhRlDs0RVaPYcu6N4t2AyHw0gzwsV41nBjKMN//2x9hPGRx6lGkUzT d16A== MIME-Version: 1.0 Received: by 10.58.189.69 with SMTP id gg5mr750943vec.6.1343689207777; Mon, 30 Jul 2012 16:00:07 -0700 (PDT) Received: by 10.58.187.225 with HTTP; Mon, 30 Jul 2012 16:00:07 -0700 (PDT) In-Reply-To: <201207301445.45210.jhb@freebsd.org> References: <201207251128.q6PBSFlt052575@svn.freebsd.org> <201207301445.45210.jhb@freebsd.org> Date: Mon, 30 Jul 2012 16:00:07 -0700 Message-ID: From: Jack Vogel To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: svn-src-head@freebsd.org, Luigi Rizzo , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r238765 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 23:00:11 -0000 I have some changes that are needed anyway, I will change this to a tuneable. Jack On Mon, Jul 30, 2012 at 11:45 AM, John Baldwin wrote: > On Wednesday, July 25, 2012 7:28:15 am Luigi Rizzo wrote: > > Author: luigi > > Date: Wed Jul 25 11:28:15 2012 > > New Revision: 238765 > > URL: http://svn.freebsd.org/changeset/base/238765 > > > > Log: > > Use legacy interrupts as a default. This gives up to 10% speedup > > when used in qemu (and this driver is for non-PCIe cards, > > so probably its largest use is in virtualized environments). > > > > Approved by: Jack Vogel > > MFC after: 3 days > > Why not make this a tunable or some such? You could even have it only use > the > legacy handler under qemu easily enough. There's no reason this has to be > a > compile-time option. This is almost certainly slower on real hardware > where > this is important to work around dubious Intel Host-PCI bridges that > result in > aliased USB interrupts for every em(4) interrupt. > > -- > John Baldwin > From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 23:11:11 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D7F7E1065673 for ; Mon, 30 Jul 2012 23:11:10 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 6F52E8FC19 for ; Mon, 30 Jul 2012 23:11:10 +0000 (UTC) Received: by obbun3 with SMTP id un3so12430487obb.13 for ; Mon, 30 Jul 2012 16:11:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer :x-gm-message-state; bh=KVuOmfwQil9w0BUKuecYf1Bm6KR/6TA+ZqegEMnreWg=; b=LMitdH3LFUt9c6pf5MC1/pthPUFJ3RmVMf4zUQ9jrzMt+tLi5LDqXZwHDU4rVkWI/O zNZVl19ITEYB+XVIQc0zGO+imht1Goune/wB1pD7s7EYbyzUGZSKPwDaQPvzep/D/heP gaCb+Yws3U95+2dNaBTuNPNNitIOHMpELRxzcED9b3wkALbMkHs4NHzV0PBNGBtmanT2 vu+bxWXSsKVOy9F7gsIRsy09iLQYMX303fqh8yD6e5Ia44LjLZEDim/l4GeH8STgT7pr TVBoQDwyEfu6LYt5o3Hl706lycw+wmUS0duLTIx2F3NkcIMQnV4FzwyQaJ8NYQavAPtk 1JyQ== Received: by 10.182.0.13 with SMTP id 13mr6913286oba.55.1343689870078; Mon, 30 Jul 2012 16:11:10 -0700 (PDT) Received: from [10.30.101.53] ([209.117.142.2]) by mx.google.com with ESMTPS id bp7sm10224911obc.12.2012.07.30.16.11.08 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 30 Jul 2012 16:11:09 -0700 (PDT) Sender: Warner Losh Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: <201207310028.12533.Daan@vitsch.nl> Date: Mon, 30 Jul 2012 17:11:07 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <1E3463C8-3D39-4FC6-9163-A0298502A3E0@bsdimp.com> References: <201206290418.q5T4IqpX018099@svn.freebsd.org> <201207310028.12533.Daan@vitsch.nl> To: Daan Vreeken X-Mailer: Apple Mail (2.1084) X-Gm-Message-State: ALoCoQkzUkKQkvHcGmPw5tZIWsvlD22b3PfyaxoFHtQ3PCK72A/x/S/WkLDEEiDrf9uwP5rWnSpA Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Warner Losh Subject: Re: svn commit: r237742 - in head/sys/arm: at91 conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 23:11:11 -0000 Thanks for the review. I'm pretty sure that code is wrong. I'll go = over your comments with a printed datasheet. They are likely correct. = This code suffers a bitt too much from being cut and pasted too many = times. Warner On Jul 30, 2012, at 4:28 PM, Daan Vreeken wrote: > Hi Warner, >=20 >=20 > On Friday 29 June 2012 06:18:52 Warner Losh wrote: >> Author: imp >> Date: Fri Jun 29 04:18:52 2012 >> New Revision: 237742 >> URL: http://svn.freebsd.org/changeset/base/237742 >>=20 >> Log: >> Initital support for AT91SAM9X25 SoC and the SAM9X25-EK evaluation >> board. Much work remains. > ... >> Added: head/sys/arm/at91/at91sam9x25.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 --- /dev/null 00:00:00 1970 (empty, because file is = newly added) >> +++ head/sys/arm/at91/at91sam9x25.c Fri Jun 29 04:18:52 2012 = (r237742) >> @@ -0,0 +1,343 @@ > ... >> +static uint32_t >> +at91_pll_outa(int freq) >> +{ >> + >> + switch (freq / 10000000) { >=20 > You seem to be dividing freq into multiples of 10MHz instead of 1MHz = here. I=20 > think dividing by 1e6 was the intention. >=20 >> + case 747 ... 801: return ((1 << 29) | (0 << 14)); >> + case 697 ... 746: return ((1 << 29) | (1 << 14)); >> + case 647 ... 696: return ((1 << 29) | (2 << 14)); >> + case 597 ... 646: return ((1 << 29) | (3 << 14)); >> + case 547 ... 596: return ((1 << 29) | (1 << 14)); >> + case 497 ... 546: return ((1 << 29) | (2 << 14)); >> + case 447 ... 496: return ((1 << 29) | (3 << 14)); >=20 >> + case 397 ... 446: return ((1 << 29) | (4 << 14)); >=20 > The (4 << 14) looks a bit strange here, as OUTA only occupies bit 14 = and 15 of=20 > CKGR_PLLAR. (See Atmel doc11054, page 201 and 1103.) >=20 > Maybe this entire routine could be written as something like: > uint8_t outa; >=20 > freq /=3D 1000000; > // optional: > //freq +=3D 3; > // see doc11054, page 1103 > outa =3D 3 - ((freq / 50) & 3); >=20 > return ((1 << 29) | (outa << 14)); >=20 > Just glancing at the code, setting ICPLLA in PMC_PLLICPR for = frequencies <=3D=20 > 600MHz seems to be missing at this moment (or I'm just not seeing it). > (see page 212 and 1103) >=20 >=20 > Regards, > --=20 > Daan Vreeken > Vitsch Electronics > http://Vitsch.nl/ > http://VitschVPN.nl/ > tel: +31-(0)40-7113051 > KvK nr: 17174380 From owner-svn-src-head@FreeBSD.ORG Mon Jul 30 23:14:25 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 66AA7106564A; Mon, 30 Jul 2012 23:14:25 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4DD238FC18; Mon, 30 Jul 2012 23:14:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6UNEPYl056872; Mon, 30 Jul 2012 23:14:25 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6UNEPG3056860; Mon, 30 Jul 2012 23:14:25 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207302314.q6UNEPG3056860@svn.freebsd.org> From: Martin Matuska Date: Mon, 30 Jul 2012 23:14:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238926 - in head: . cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common cddl/lib/libzfs rescue/rescue sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 30 Jul 2012 23:14:25 -0000 Author: mm Date: Mon Jul 30 23:14:24 2012 New Revision: 238926 URL: http://svn.freebsd.org/changeset/base/238926 Log: Partial MFV (illumos-gate 13753:2aba784c276b) 2762 zpool command should have better support for feature flags References: https://www.illumos.org/issues/2762 MFC after: 2 weeks Modified: head/Makefile.inc1 head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c head/cddl/lib/libzfs/Makefile head/rescue/rescue/Makefile head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfeature.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Mon Jul 30 22:46:42 2012 (r238925) +++ head/Makefile.inc1 Mon Jul 30 23:14:24 2012 (r238926) @@ -1260,7 +1260,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1 lib/ncurses/ncurses lib/ncurses/ncursesw \ lib/libopie lib/libpam ${_lib_libthr} \ lib/libradius lib/libsbuf lib/libtacplus \ - ${_cddl_lib_libumem} \ + ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \ lib/libutil ${_lib_libypclnt} lib/libz lib/msun \ ${_secure_lib_libcrypto} ${_secure_lib_libssh} \ ${_secure_lib_libssl} @@ -1284,6 +1284,7 @@ lib/libopie__L lib/libtacplus__L: lib/li .if ${MK_CDDL} != "no" _cddl_lib_libumem= cddl/lib/libumem +_cddl_lib_libnvpair= cddl/lib/libnvpair _cddl_lib= cddl/lib .endif Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Mon Jul 30 22:46:42 2012 (r238925) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Mon Jul 30 23:14:24 2012 (r238926) @@ -1636,21 +1636,22 @@ for unixtime .Op Fl v .Xc .Pp -Displays all pools formatted using a different +Displays pools which do not have all supported features enabled and pools +formatted using a legacy .Tn ZFS -pool on-disk version. Older versions can continue to be used, but some -features may not be available. These pools can be upgraded using -.Qq Nm Cm upgrade Fl a . -Pools that are formatted with a more recent version are also displayed, -although these pools will be inaccessible on the system. +version number. +These pools can continue to be used, but some features may not be available. +Use +.Nm Cm upgrade Fl a +to enable all features on all pools. .Bl -tag -width indent .It Fl v -Displays +Displays legacy .Tn ZFS -pool versions supported by the current software. The current -.Tn ZFS -pool version and all previous supported versions are displayed, along -with an explanation of the features provided with each version. +versions supported by the current software. +See +.Xr zpool-features.5 +for a description of feature flags features supported by the current software. .El .It Xo .Nm @@ -1659,18 +1660,22 @@ with an explanation of the features prov .Fl a | Ar pool ... .Xc .Pp -Upgrades the given pool to the latest on-disk pool version. Once this is done, -the pool will no longer be accessible on systems running older versions of the -software. +Enables all supported features on the given pool. +Once this is done, the pool will no longer be accessible on systems that do +not support feature flags. +See +.Xr zpool-features.5 +for details on compatability with system sthat support feature flags, but do +not support all features enabled on the pool. .Bl -tag -width indent .It Fl a -Upgrades all pools. +Enables all supported features on all pools. .It Fl V Ar version -Upgrade to the specified version. If the +Upgrade to the specified legacy version. If the .Fl V -flag is not specified, the pool is upgraded to the most recent version. This -option can only be used to increase the version number, and only up to the most -recent version supported by this software. +flag is specified, no features will be enabled on the pool. +This option can only be used to increase version number up to the last +supported legacy version number. .El .El .Sh EXAMPLES Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Mon Jul 30 22:46:42 2012 (r238925) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Mon Jul 30 23:14:24 2012 (r238926) @@ -389,6 +389,18 @@ print_vdev_tree(zpool_handle_t *zhp, con } } +static boolean_t +prop_list_contains_feature(nvlist_t *proplist) +{ + nvpair_t *nvp; + for (nvp = nvlist_next_nvpair(proplist, NULL); NULL != nvp; + nvp = nvlist_next_nvpair(proplist, nvp)) { + if (zpool_prop_feature(nvpair_name(nvp))) + return (B_TRUE); + } + return (B_FALSE); +} + /* * Add a property pair (name, string-value) into a property nvlist. */ @@ -412,12 +424,30 @@ add_prop_list(const char *propname, char proplist = *props; if (poolprop) { + const char *vname = zpool_prop_to_name(ZPOOL_PROP_VERSION); + if ((prop = zpool_name_to_prop(propname)) == ZPROP_INVAL && !zpool_prop_feature(propname)) { (void) fprintf(stderr, gettext("property '%s' is " "not a valid pool property\n"), propname); return (2); } + + /* + * feature@ properties and version should not be specified + * at the same time. + */ + if ((prop == ZPROP_INVAL && zpool_prop_feature(propname) && + nvlist_exists(proplist, vname)) || + (prop == ZPOOL_PROP_VERSION && + prop_list_contains_feature(proplist))) { + (void) fprintf(stderr, gettext("'feature@' and " + "'version' properties cannot be specified " + "together\n")); + return (2); + } + + if (zpool_prop_feature(propname)) normnm = propname; else @@ -1583,8 +1613,8 @@ show_import(nvlist_t *config) break; case ZPOOL_STATUS_VERSION_OLDER: - (void) printf(gettext(" status: The pool is formatted using an " - "older on-disk version.\n")); + (void) printf(gettext(" status: The pool is formatted using a " + "legacy on-disk version.\n")); break; case ZPOOL_STATUS_VERSION_NEWER: @@ -1592,6 +1622,11 @@ show_import(nvlist_t *config) "incompatible version.\n")); break; + case ZPOOL_STATUS_FEAT_DISABLED: + (void) printf(gettext(" status: Some supported features are " + "not enabled on the pool.\n")); + break; + case ZPOOL_STATUS_UNSUP_FEAT_READ: (void) printf(gettext("status: The pool uses the following " "feature(s) not supported on this sytem:\n")); @@ -1638,19 +1673,21 @@ show_import(nvlist_t *config) * Print out an action according to the overall state of the pool. */ if (vs->vs_state == VDEV_STATE_HEALTHY) { - if (reason == ZPOOL_STATUS_VERSION_OLDER) + if (reason == ZPOOL_STATUS_VERSION_OLDER || + reason == ZPOOL_STATUS_FEAT_DISABLED) { (void) printf(gettext(" action: The pool can be " "imported using its name or numeric identifier, " "though\n\tsome features will not be available " "without an explicit 'zpool upgrade'.\n")); - else if (reason == ZPOOL_STATUS_HOSTID_MISMATCH) + } else if (reason == ZPOOL_STATUS_HOSTID_MISMATCH) { (void) printf(gettext(" action: The pool can be " "imported using its name or numeric " "identifier and\n\tthe '-f' flag.\n")); - else + } else { (void) printf(gettext(" action: The pool can be " "imported using its name or numeric " "identifier.\n")); + } } else if (vs->vs_state == VDEV_STATE_DEGRADED) { (void) printf(gettext(" action: The pool can be imported " "despite missing or damaged devices. The\n\tfault " @@ -4108,12 +4145,13 @@ status_callback(zpool_handle_t *zhp, voi break; case ZPOOL_STATUS_VERSION_OLDER: - (void) printf(gettext("status: The pool is formatted using an " - "older on-disk format. The pool can\n\tstill be used, but " - "some features are unavailable.\n")); + (void) printf(gettext("status: The pool is formatted using a " + "legacy on-disk format. The pool can\n\tstill be used, " + "but some features are unavailable.\n")); (void) printf(gettext("action: Upgrade the pool using 'zpool " "upgrade'. Once this is done, the\n\tpool will no longer " - "be accessible on older software versions.\n")); + "be accessible on software that does not support feature\n" + "\tflags.\n")); break; case ZPOOL_STATUS_VERSION_NEWER: @@ -4125,6 +4163,16 @@ status_callback(zpool_handle_t *zhp, voi "backup.\n")); break; + case ZPOOL_STATUS_FEAT_DISABLED: + (void) printf(gettext("status: Some supported features are not " + "enabled on the pool. The pool can\n\tstill be used, but " + "some features are unavailable.\n")); + (void) printf(gettext("action: Enable all features using " + "'zpool upgrade'. Once this is done,\n\tthe pool may no " + "longer be accessible by software that does not support\n\t" + "the features. See zpool-features(5) for details.\n")); + break; + case ZPOOL_STATUS_UNSUP_FEAT_READ: (void) printf(gettext("status: The pool cannot be accessed on " "this system because it uses the\n\tfollowing feature(s) " @@ -4354,9 +4402,7 @@ zpool_do_status(int argc, char **argv) } typedef struct upgrade_cbdata { - int cb_all; int cb_first; - int cb_newer; char cb_poolname[ZPOOL_MAXNAMELEN]; int cb_argc; uint64_t cb_version; @@ -4389,55 +4435,156 @@ is_root_pool(zpool_handle_t *zhp) } static int +upgrade_version(zpool_handle_t *zhp, uint64_t version) +{ + int ret; + nvlist_t *config; + uint64_t oldversion; + + config = zpool_get_config(zhp, NULL); + verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION, + &oldversion) == 0); + + assert(SPA_VERSION_IS_SUPPORTED(oldversion)); + assert(oldversion < version); + + ret = zpool_upgrade(zhp, version); + if (ret != 0) + return (ret); + + if (version >= SPA_VERSION_FEATURES) { + (void) printf(gettext("Successfully upgraded " + "'%s' from version %llu to feature flags.\n"), + zpool_get_name(zhp), oldversion); + } else { + (void) printf(gettext("Successfully upgraded " + "'%s' from version %llu to version %llu.\n"), + zpool_get_name(zhp), oldversion, version); + } + + return (0); +} + +static int +upgrade_enable_all(zpool_handle_t *zhp, int *countp) +{ + int i, ret, count; + boolean_t firstff = B_TRUE; + nvlist_t *enabled = zpool_get_features(zhp); + + count = 0; + for (i = 0; i < SPA_FEATURES; i++) { + const char *fname = spa_feature_table[i].fi_uname; + const char *fguid = spa_feature_table[i].fi_guid; + if (!nvlist_exists(enabled, fguid)) { + char *propname; + verify(-1 != asprintf(&propname, "feature@%s", fname)); + ret = zpool_set_prop(zhp, propname, + ZFS_FEATURE_ENABLED); + if (ret != 0) { + free(propname); + return (ret); + } + count++; + + if (firstff) { + (void) printf(gettext("Enabled the " + "following features on '%s':\n"), + zpool_get_name(zhp)); + firstff = B_FALSE; + } + (void) printf(gettext(" %s\n"), fname); + free(propname); + } + } + + if (countp != NULL) + *countp = count; + return (0); +} + +static int upgrade_cb(zpool_handle_t *zhp, void *arg) { upgrade_cbdata_t *cbp = arg; nvlist_t *config; uint64_t version; - int ret = 0; + boolean_t printnl = B_FALSE; + int ret; config = zpool_get_config(zhp, NULL); verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION, &version) == 0); - if (!cbp->cb_newer && SPA_VERSION_IS_SUPPORTED(version) && - version != SPA_VERSION) { - if (!cbp->cb_all) { - if (cbp->cb_first) { - (void) printf(gettext("The following pools are " - "out of date, and can be upgraded. After " - "being\nupgraded, these pools will no " - "longer be accessible by older software " - "versions.\n\n")); - (void) printf(gettext("VER POOL\n")); - (void) printf(gettext("--- ------------\n")); - cbp->cb_first = B_FALSE; - } + assert(SPA_VERSION_IS_SUPPORTED(version)); - (void) printf("%2llu %s\n", (u_longlong_t)version, - zpool_get_name(zhp)); - } else { + if (version < cbp->cb_version) { + cbp->cb_first = B_FALSE; + ret = upgrade_version(zhp, cbp->cb_version); + if (ret != 0) + return (ret); +#ifdef __FreeBSD__ + if (cbp->cb_poolname[0] == '\0' && + is_root_pool(zhp)) { + (void) strlcpy(cbp->cb_poolname, + zpool_get_name(zhp), + sizeof(cbp->cb_poolname)); + } +#endif /* ___FreeBSD__ */ + printnl = B_TRUE; + +#ifdef illumos + /* + * If they did "zpool upgrade -a", then we could + * be doing ioctls to different pools. We need + * to log this history once to each pool, and bypass + * the normal history logging that happens in main(). + */ + (void) zpool_log_history(g_zfs, history_str); + log_history = B_FALSE; +#endif + } + + if (cbp->cb_version >= SPA_VERSION_FEATURES) { + int count; + ret = upgrade_enable_all(zhp, &count); + if (ret != 0) + return (ret); + + if (count > 0) { cbp->cb_first = B_FALSE; - ret = zpool_upgrade(zhp, cbp->cb_version); - if (!ret) { - (void) printf(gettext("Successfully upgraded " - "'%s'\n\n"), zpool_get_name(zhp)); - if (cbp->cb_poolname[0] == '\0' && - is_root_pool(zhp)) { - (void) strlcpy(cbp->cb_poolname, - zpool_get_name(zhp), - sizeof(cbp->cb_poolname)); - } - } + printnl = B_TRUE; } - } else if (cbp->cb_newer && !SPA_VERSION_IS_SUPPORTED(version)) { - assert(!cbp->cb_all); + } + + if (printnl) { + (void) printf(gettext("\n")); + } + + return (0); +} +static int +upgrade_list_older_cb(zpool_handle_t *zhp, void *arg) +{ + upgrade_cbdata_t *cbp = arg; + nvlist_t *config; + uint64_t version; + + config = zpool_get_config(zhp, NULL); + verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION, + &version) == 0); + + assert(SPA_VERSION_IS_SUPPORTED(version)); + + if (version < SPA_VERSION_FEATURES) { if (cbp->cb_first) { (void) printf(gettext("The following pools are " - "formatted using an unsupported software version " - "and\ncannot be accessed on the current " - "system.\n\n")); + "formatted with legacy version numbers and can\n" + "be upgraded to use feature flags. After " + "being upgraded, these pools\nwill no " + "longer be accessible by software that does not " + "support feature\nflags.\n\n")); (void) printf(gettext("VER POOL\n")); (void) printf(gettext("--- ------------\n")); cbp->cb_first = B_FALSE; @@ -4447,14 +4594,65 @@ upgrade_cb(zpool_handle_t *zhp, void *ar zpool_get_name(zhp)); } - zpool_close(zhp); - return (ret); + return (0); +} + +static int +upgrade_list_disabled_cb(zpool_handle_t *zhp, void *arg) +{ + upgrade_cbdata_t *cbp = arg; + nvlist_t *config; + uint64_t version; + + config = zpool_get_config(zhp, NULL); + verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION, + &version) == 0); + + if (version >= SPA_VERSION_FEATURES) { + int i; + boolean_t poolfirst = B_TRUE; + nvlist_t *enabled = zpool_get_features(zhp); + + for (i = 0; i < SPA_FEATURES; i++) { + const char *fguid = spa_feature_table[i].fi_guid; + const char *fname = spa_feature_table[i].fi_uname; + if (!nvlist_exists(enabled, fguid)) { + if (cbp->cb_first) { + (void) printf(gettext("\nSome " + "supported features are not " + "enabled on the following pools. " + "Once a\nfeature is enabled the " + "pool may become incompatible with " + "software\nthat does not support " + "the feature. See " + "zpool-features(5) for " + "details.\n\n")); + (void) printf(gettext("POOL " + "FEATURE\n")); + (void) printf(gettext("------" + "---------\n")); + cbp->cb_first = B_FALSE; + } + + if (poolfirst) { + (void) printf(gettext("%s\n"), + zpool_get_name(zhp)); + poolfirst = B_FALSE; + } + + (void) printf(gettext(" %s\n"), fname); + } + } + } + + return (0); } /* ARGSUSED */ static int upgrade_one(zpool_handle_t *zhp, void *data) { + boolean_t printnl = B_FALSE; upgrade_cbdata_t *cbp = data; uint64_t cur_version; int ret; @@ -4469,30 +4667,58 @@ upgrade_one(zpool_handle_t *zhp, void *d cur_version = zpool_get_prop_int(zhp, ZPOOL_PROP_VERSION, NULL); if (cur_version > cbp->cb_version) { (void) printf(gettext("Pool '%s' is already formatted " - "using more current version '%llu'.\n"), + "using more current version '%llu'.\n\n"), zpool_get_name(zhp), cur_version); return (0); } - if (cur_version == cbp->cb_version) { + + if (cbp->cb_version != SPA_VERSION && cur_version == cbp->cb_version) { (void) printf(gettext("Pool '%s' is already formatted " - "using the current version.\n"), zpool_get_name(zhp)); + "using version %llu.\n\n"), zpool_get_name(zhp), + cbp->cb_version); return (0); } - ret = zpool_upgrade(zhp, cbp->cb_version); + if (cur_version != cbp->cb_version) { + printnl = B_TRUE; + ret = upgrade_version(zhp, cbp->cb_version); + if (ret != 0) { +#ifdef __FreeBSD__ + if (cbp->cb_poolname[0] == '\0' && + is_root_pool(zhp)) { + (void) strlcpy(cbp->cb_poolname, + zpool_get_name(zhp), + sizeof(cbp->cb_poolname)); + } +#endif /* ___FreeBSD__ */ + return (ret); + } + } + + if (cbp->cb_version >= SPA_VERSION_FEATURES) { + int count = 0; + ret = upgrade_enable_all(zhp, &count); + if (ret != 0) + return (ret); - if (!ret) { - (void) printf(gettext("Successfully upgraded '%s' " - "from version %llu to version %llu\n\n"), - zpool_get_name(zhp), (u_longlong_t)cur_version, - (u_longlong_t)cbp->cb_version); + if (count != 0) { + printnl = B_TRUE; + } else if (cur_version == SPA_VERSION) { + (void) printf(gettext("Pool '%s' already has all " + "supported features enabled.\n"), + zpool_get_name(zhp)); + } if (cbp->cb_poolname[0] == '\0' && is_root_pool(zhp)) { (void) strlcpy(cbp->cb_poolname, zpool_get_name(zhp), sizeof(cbp->cb_poolname)); } } - return (ret != 0); + if (printnl) { + (void) printf(gettext("\n")); + } + + return (0); } /* @@ -4511,6 +4737,7 @@ zpool_do_upgrade(int argc, char **argv) upgrade_cbdata_t cb = { 0 }; int ret = 0; boolean_t showversions = B_FALSE; + boolean_t upgradeall = B_FALSE; char *end; @@ -4518,7 +4745,7 @@ zpool_do_upgrade(int argc, char **argv) while ((c = getopt(argc, argv, ":avV:")) != -1) { switch (c) { case 'a': - cb.cb_all = B_TRUE; + upgradeall = B_TRUE; break; case 'v': showversions = B_TRUE; @@ -4551,19 +4778,19 @@ zpool_do_upgrade(int argc, char **argv) if (cb.cb_version == 0) { cb.cb_version = SPA_VERSION; - } else if (!cb.cb_all && argc == 0) { + } else if (!upgradeall && argc == 0) { (void) fprintf(stderr, gettext("-V option is " "incompatible with other arguments\n")); usage(B_FALSE); } if (showversions) { - if (cb.cb_all || argc != 0) { + if (upgradeall || argc != 0) { (void) fprintf(stderr, gettext("-v option is " "incompatible with other arguments\n")); usage(B_FALSE); } - } else if (cb.cb_all) { + } else if (upgradeall) { if (argc != 0) { (void) fprintf(stderr, gettext("-a option should not " "be used along with a pool name\n")); @@ -4573,9 +4800,25 @@ zpool_do_upgrade(int argc, char **argv) (void) printf(gettext("This system supports ZFS pool feature " "flags.\n\n")); - cb.cb_first = B_TRUE; if (showversions) { - (void) printf(gettext("The following versions are " + int i; + + (void) printf(gettext("The following features are " + "supported:\n\n")); + (void) printf(gettext("FEAT DESCRIPTION\n")); + (void) printf("----------------------------------------------" + "---------------\n"); + for (i = 0; i < SPA_FEATURES; i++) { + zfeature_info_t *fi = &spa_feature_table[i]; + const char *ro = fi->fi_can_readonly ? + " (read-only compatible)" : ""; + + (void) printf("%-37s%s\n", fi->fi_uname, ro); + (void) printf(" %s\n", fi->fi_desc); + } + (void) printf("\n"); + + (void) printf(gettext("The following legacy versions are also " "supported:\n\n")); (void) printf(gettext("VER DESCRIPTION\n")); (void) printf("--- -----------------------------------------" @@ -4618,32 +4861,44 @@ zpool_do_upgrade(int argc, char **argv) (void) printf(gettext("\nFor more information on a particular " "version, including supported releases,\n")); (void) printf(gettext("see the ZFS Administration Guide.\n\n")); - } else if (argc == 0) { - int notfound; - + } else if (argc == 0 && upgradeall) { + cb.cb_first = B_TRUE; ret = zpool_iter(g_zfs, upgrade_cb, &cb); - notfound = cb.cb_first; - - if (!cb.cb_all && ret == 0) { - if (!cb.cb_first) - (void) printf("\n"); - cb.cb_first = B_TRUE; - cb.cb_newer = B_TRUE; - ret = zpool_iter(g_zfs, upgrade_cb, &cb); - if (!cb.cb_first) { - notfound = B_FALSE; - (void) printf("\n"); + if (ret == 0 && cb.cb_first) { + if (cb.cb_version == SPA_VERSION) { + (void) printf(gettext("All pools are already " + "formatted using feature flags.\n\n")); + (void) printf(gettext("Every feature flags " + "pool already has all supported features " + "enabled.\n")); + } else { + (void) printf(gettext("All pools are already " + "formatted with version %llu or higher.\n"), + cb.cb_version); } } + } else if (argc == 0) { + cb.cb_first = B_TRUE; + ret = zpool_iter(g_zfs, upgrade_list_older_cb, &cb); + assert(ret == 0); + + if (cb.cb_first) { + (void) printf(gettext("All pools are formatted " + "using feature flags.\n\n")); + } else { + (void) printf(gettext("\nUse 'zpool upgrade -v' " + "for a list of available legacy versions.\n")); + } - if (ret == 0) { - if (notfound) - (void) printf(gettext("All pools are formatted " - "using this version.\n")); - else if (!cb.cb_all) - (void) printf(gettext("Use 'zpool upgrade -v' " - "for a list of available versions and " - "their associated\nfeatures.\n")); + cb.cb_first = B_TRUE; + ret = zpool_iter(g_zfs, upgrade_list_disabled_cb, &cb); + assert(ret == 0); + + if (cb.cb_first) { + (void) printf(gettext("Every feature flags pool has " + "all supported features enabled.\n")); + } else { + (void) printf(gettext("\n")); } } else { ret = for_each_pool(argc, argv, B_FALSE, NULL, Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Mon Jul 30 22:46:42 2012 (r238925) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Mon Jul 30 23:14:24 2012 (r238926) @@ -316,7 +316,8 @@ typedef enum { * requiring administrative attention. There is no corresponding * message ID. */ - ZPOOL_STATUS_VERSION_OLDER, /* older on-disk version */ + ZPOOL_STATUS_VERSION_OLDER, /* older legacy on-disk version */ + ZPOOL_STATUS_FEAT_DISABLED, /* supported features are disabled */ ZPOOL_STATUS_RESILVERING, /* device being resilvered */ ZPOOL_STATUS_OFFLINE_DEV, /* device online */ ZPOOL_STATUS_REMOVED_DEV, /* removed device */ Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c Mon Jul 30 22:46:42 2012 (r238925) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c Mon Jul 30 23:14:24 2012 (r238926) @@ -44,6 +44,7 @@ #include #include #include "libzfs_impl.h" +#include "zfeature_common.h" /* * Message ID table. This must be kept in sync with the ZPOOL_STATUS_* defines @@ -319,6 +320,30 @@ check_status(nvlist_t *config, boolean_t if (SPA_VERSION_IS_SUPPORTED(version) && version != SPA_VERSION) return (ZPOOL_STATUS_VERSION_OLDER); + /* + * Usable pool with disabled features + */ + if (version >= SPA_VERSION_FEATURES) { + int i; + nvlist_t *feat; + + if (isimport) { + feat = fnvlist_lookup_nvlist(config, + ZPOOL_CONFIG_LOAD_INFO); + feat = fnvlist_lookup_nvlist(feat, + ZPOOL_CONFIG_ENABLED_FEAT); + } else { + feat = fnvlist_lookup_nvlist(config, + ZPOOL_CONFIG_FEATURE_STATS); + } + + for (i = 0; i < SPA_FEATURES; i++) { + zfeature_info_t *fi = &spa_feature_table[i]; + if (!nvlist_exists(feat, fi->fi_guid)) + return (ZPOOL_STATUS_FEAT_DISABLED); + } + } + return (ZPOOL_STATUS_OK); } Modified: head/cddl/lib/libzfs/Makefile ============================================================================== --- head/cddl/lib/libzfs/Makefile Mon Jul 30 22:46:42 2012 (r238925) +++ head/cddl/lib/libzfs/Makefile Mon Jul 30 23:14:24 2012 (r238926) @@ -6,8 +6,8 @@ .PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libzfs/common LIB= zfs -DPADD= ${LIBMD} ${LIBPTHREAD} ${LIBUMEM} ${LIBUTIL} ${LIBM} -LDADD= -lmd -lpthread -lumem -lutil -lm +DPADD= ${LIBMD} ${LIBPTHREAD} ${LIBUMEM} ${LIBUTIL} ${LIBM} ${LIBNVPAIR} +LDADD= -lmd -lpthread -lumem -lutil -lm -lnvpair SRCS= deviceid.c \ fsshare.c \ Modified: head/rescue/rescue/Makefile ============================================================================== --- head/rescue/rescue/Makefile Mon Jul 30 22:46:42 2012 (r238925) +++ head/rescue/rescue/Makefile Mon Jul 30 23:14:24 2012 (r238926) @@ -123,7 +123,7 @@ CRUNCH_LIBS+= -lalias -lcam -lcurses -ld CRUNCH_LIBS+= -lipx .endif .if ${MK_ZFS} != "no" -CRUNCH_LIBS+= -lavl -lnvpair -lzfs -lpthread -luutil -lumem +CRUNCH_LIBS+= -lavl -lzfs -lnvpair -lpthread -luutil -lumem .endif CRUNCH_LIBS+= -lgeom -lbsdxml -lkiconv -lmd -lsbuf -lufs -lz Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon Jul 30 22:46:42 2012 (r238925) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon Jul 30 23:14:24 2012 (r238926) @@ -2172,7 +2172,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_ if (spa_version(spa) >= SPA_VERSION_FEATURES) { boolean_t missing_feat_read = B_FALSE; - nvlist_t *unsup_feat; + nvlist_t *unsup_feat, *enabled_feat; if (spa_dir_prop(spa, DMU_POOL_FEATURES_FOR_READ, &spa->spa_feat_for_read_obj) != 0) { @@ -2189,27 +2189,32 @@ spa_load_impl(spa_t *spa, uint64_t pool_ return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); } - VERIFY(nvlist_alloc(&unsup_feat, NV_UNIQUE_NAME, KM_SLEEP) == - 0); + enabled_feat = fnvlist_alloc(); + unsup_feat = fnvlist_alloc(); if (!feature_is_supported(spa->spa_meta_objset, spa->spa_feat_for_read_obj, spa->spa_feat_desc_obj, - unsup_feat)) + unsup_feat, enabled_feat)) missing_feat_read = B_TRUE; if (spa_writeable(spa) || state == SPA_LOAD_TRYIMPORT) { if (!feature_is_supported(spa->spa_meta_objset, spa->spa_feat_for_write_obj, spa->spa_feat_desc_obj, - unsup_feat)) + unsup_feat, enabled_feat)) { missing_feat_write = B_TRUE; + } } + fnvlist_add_nvlist(spa->spa_load_info, + ZPOOL_CONFIG_ENABLED_FEAT, enabled_feat); + if (!nvlist_empty(unsup_feat)) { - VERIFY(nvlist_add_nvlist(spa->spa_load_info, - ZPOOL_CONFIG_UNSUP_FEAT, unsup_feat) == 0); + fnvlist_add_nvlist(spa->spa_load_info, + ZPOOL_CONFIG_UNSUP_FEAT, unsup_feat); } - nvlist_free(unsup_feat); + fnvlist_free(enabled_feat); + fnvlist_free(unsup_feat); if (!missing_feat_read) { fnvlist_add_boolean(spa->spa_load_info, Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfeature.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfeature.h Mon Jul 30 22:46:42 2012 (r238925) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfeature.h Mon Jul 30 23:14:24 2012 (r238926) @@ -35,7 +35,7 @@ extern "C" { #endif extern boolean_t feature_is_supported(objset_t *os, uint64_t obj, - uint64_t desc_obj, nvlist_t *unsup_feat); + uint64_t desc_obj, nvlist_t *unsup_feat, nvlist_t *enabled_feat); struct spa; extern void spa_feature_create_zap_objects(struct spa *, dmu_tx_t *); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c Mon Jul 30 22:46:42 2012 (r238925) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c Mon Jul 30 23:14:24 2012 (r238926) @@ -173,7 +173,7 @@ typedef enum { */ boolean_t feature_is_supported(objset_t *os, uint64_t obj, uint64_t desc_obj, - nvlist_t *unsup_feat) + nvlist_t *unsup_feat, nvlist_t *enabled_feat) { boolean_t supported; zap_cursor_t zc; @@ -186,11 +186,16 @@ feature_is_supported(objset_t *os, uint6 ASSERT(za.za_integer_length == sizeof (uint64_t) && za.za_num_integers == 1); + if (NULL != enabled_feat) { + fnvlist_add_uint64(enabled_feat, za.za_name, + za.za_first_integer); + } + if (za.za_first_integer != 0 && !zfeature_is_supported(za.za_name)) { supported = B_FALSE; - if (unsup_feat != NULL) { + if (NULL != unsup_feat) { char *desc = ""; char buf[MAXPATHLEN]; Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Mon Jul 30 22:46:42 2012 (r238925) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Mon Jul 30 23:14:24 2012 (r238926) @@ -520,6 +520,7 @@ typedef struct zpool_rewind_policy { #define ZPOOL_CONFIG_LOAD_INFO "load_info" /* not stored on disk */ #define ZPOOL_CONFIG_REWIND_INFO "rewind_info" /* not stored on disk */ #define ZPOOL_CONFIG_UNSUP_FEAT "unsup_feat" /* not stored on disk */ +#define ZPOOL_CONFIG_ENABLED_FEAT "enabled_feat" /* not stored on disk */ #define ZPOOL_CONFIG_CAN_RDONLY "can_rdonly" /* not stored on disk */ #define ZPOOL_CONFIG_FEATURES_FOR_READ "features_for_read" #define ZPOOL_CONFIG_FEATURE_STATS "feature_stats" /* not stored on disk */ From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 02:00:38 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07EF2106564A; Tue, 31 Jul 2012 02:00:38 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E65B08FC08; Tue, 31 Jul 2012 02:00:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6V20bpt073158; Tue, 31 Jul 2012 02:00:37 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6V20bJR073154; Tue, 31 Jul 2012 02:00:37 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201207310200.q6V20bJR073154@svn.freebsd.org> From: David Xu Date: Tue, 31 Jul 2012 02:00:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238928 - in head/sys: fs/fifofs kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 02:00:38 -0000 Author: davidxu Date: Tue Jul 31 02:00:37 2012 New Revision: 238928 URL: http://svn.freebsd.org/changeset/base/238928 Log: When a thread is blocked in direct write state, it only sets PIPE_DIRECTW flag but not PIPE_WANTW, but FIFO pipe code does not understand this internal state, when a FIFO peer reader closes the pipe, it wants to notify the writer, it checks PIPE_WANTW, if not set, it skips calling wakeup(), so blocked writer never noticed the case, but in general, the writer should return from the syscall with EPIPE error code and may get SIGPIPE signal. Setting the PIPE_WANTW fixed problem, or you can turn off direct write, it should fix the problem too. This bug is found by PR/170203. Another bug in FIFO pipe code is when peer closes the pipe, another end which is being blocked in select() or poll() is not notified, it missed to call pipeselwakeup(). Third problem is found in poll regression test, the existing code can not pass 6b,6c,6d tests, but FreeBSD-4 works. This commit does not fix the problem, I still need to study more to find the cause. PR: 170203 Tested by: Garrett Copper < yanegomi at gmail dot com > Modified: head/sys/fs/fifofs/fifo_vnops.c head/sys/kern/sys_pipe.c head/sys/sys/pipe.h Modified: head/sys/fs/fifofs/fifo_vnops.c ============================================================================== --- head/sys/fs/fifofs/fifo_vnops.c Tue Jul 31 00:46:19 2012 (r238927) +++ head/sys/fs/fifofs/fifo_vnops.c Tue Jul 31 02:00:37 2012 (r238928) @@ -283,8 +283,11 @@ fifo_close(ap) if (fip->fi_readers == 0) { PIPE_LOCK(cpipe); cpipe->pipe_state |= PIPE_EOF; - if (cpipe->pipe_state & PIPE_WANTW) + if ((cpipe->pipe_state & PIPE_WANTW)) { + cpipe->pipe_state &= ~PIPE_WANTW; wakeup(cpipe); + } + pipeselwakeup(cpipe); PIPE_UNLOCK(cpipe); } } @@ -293,10 +296,13 @@ fifo_close(ap) if (fip->fi_writers == 0) { PIPE_LOCK(cpipe); cpipe->pipe_state |= PIPE_EOF; - if (cpipe->pipe_state & PIPE_WANTR) + if ((cpipe->pipe_state & PIPE_WANTR)) { + cpipe->pipe_state &= ~PIPE_WANTR; wakeup(cpipe); + } fip->fi_wgen++; FIFO_UPDWGEN(fip, cpipe); + pipeselwakeup(cpipe); PIPE_UNLOCK(cpipe); } } Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Tue Jul 31 00:46:19 2012 (r238927) +++ head/sys/kern/sys_pipe.c Tue Jul 31 02:00:37 2012 (r238928) @@ -227,7 +227,6 @@ static int pipe_create(struct pipe *pipe static int pipe_paircreate(struct thread *td, struct pipepair **p_pp); static __inline int pipelock(struct pipe *cpipe, int catch); static __inline void pipeunlock(struct pipe *cpipe); -static __inline void pipeselwakeup(struct pipe *cpipe); #ifndef PIPE_NODIRECT static int pipe_build_write_buffer(struct pipe *wpipe, struct uio *uio); static void pipe_destroy_write_buffer(struct pipe *wpipe); @@ -607,7 +606,7 @@ pipeunlock(cpipe) } } -static __inline void +void pipeselwakeup(cpipe) struct pipe *cpipe; { @@ -738,7 +737,7 @@ pipe_read(fp, uio, active_cred, flags, t rpipe->pipe_map.pos += size; rpipe->pipe_map.cnt -= size; if (rpipe->pipe_map.cnt == 0) { - rpipe->pipe_state &= ~PIPE_DIRECTW; + rpipe->pipe_state &= ~(PIPE_DIRECTW|PIPE_WANTW); wakeup(rpipe); } #endif @@ -1001,6 +1000,7 @@ retry: wakeup(wpipe); } pipeselwakeup(wpipe); + wpipe->pipe_state |= PIPE_WANTW; pipeunlock(wpipe); error = msleep(wpipe, PIPE_MTX(wpipe), PRIBIO | PCATCH, "pipdwt", 0); Modified: head/sys/sys/pipe.h ============================================================================== --- head/sys/sys/pipe.h Tue Jul 31 00:46:19 2012 (r238927) +++ head/sys/sys/pipe.h Tue Jul 31 02:00:37 2012 (r238928) @@ -143,5 +143,5 @@ struct pipepair { void pipe_dtor(struct pipe *dpipe); int pipe_named_ctor(struct pipe **ppipe, struct thread *td); - +void pipeselwakeup(struct pipe *cpipe); #endif /* !_SYS_PIPE_H_ */ From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 02:18:11 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6A6B4106566B; Tue, 31 Jul 2012 02:18:11 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 54F948FC0A; Tue, 31 Jul 2012 02:18:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6V2IBcN074591; Tue, 31 Jul 2012 02:18:11 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6V2IBl6074589; Tue, 31 Jul 2012 02:18:11 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207310218.q6V2IBl6074589@svn.freebsd.org> From: Adrian Chadd Date: Tue, 31 Jul 2012 02:18:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238929 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 02:18:11 -0000 Author: adrian Date: Tue Jul 31 02:18:10 2012 New Revision: 238929 URL: http://svn.freebsd.org/changeset/base/238929 Log: Placeholder ioctl for an upcoming rate control statistics API change. Modified: head/sys/dev/ath/if_athioctl.h Modified: head/sys/dev/ath/if_athioctl.h ============================================================================== --- head/sys/dev/ath/if_athioctl.h Tue Jul 31 02:00:37 2012 (r238928) +++ head/sys/dev/ath/if_athioctl.h Tue Jul 31 02:18:10 2012 (r238929) @@ -231,6 +231,7 @@ struct ath_rateioctl { caddr_t buf; }; #define SIOCGATHNODERATESTATS _IOWR('i', 149, struct ath_rateioctl) +#define SIOCGATHRATESTATS _IOWR('i', 150, struct ath_rateioctl) /* * Radio capture format. From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 02:28:32 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B21CD1065670; Tue, 31 Jul 2012 02:28:32 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 91B198FC17; Tue, 31 Jul 2012 02:28:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6V2SWtn075474; Tue, 31 Jul 2012 02:28:32 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6V2SWhl075470; Tue, 31 Jul 2012 02:28:32 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207310228.q6V2SWhl075470@svn.freebsd.org> From: Adrian Chadd Date: Tue, 31 Jul 2012 02:28:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238930 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 02:28:32 -0000 Author: adrian Date: Tue Jul 31 02:28:32 2012 New Revision: 238930 URL: http://svn.freebsd.org/changeset/base/238930 Log: Break out the hardware handoff and TX DMA restart code into methods. These (and a few others) will differ based on the underlying DMA implementation. For the EDMA NICs, simply stub them out in a fashion which will let me focus on implementing the necessary descriptor API changes. Modified: head/sys/dev/ath/if_ath_tx.c head/sys/dev/ath/if_ath_tx.h head/sys/dev/ath/if_ath_tx_edma.c Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Tue Jul 31 02:18:10 2012 (r238929) +++ head/sys/dev/ath/if_ath_tx.c Tue Jul 31 02:28:32 2012 (r238930) @@ -639,8 +639,8 @@ ath_tx_handoff_hw(struct ath_softc *sc, * * This must be called whether the queue is empty or not. */ -void -ath_txq_restart_dma(struct ath_softc *sc, struct ath_txq *txq) +static void +ath_legacy_tx_dma_restart(struct ath_softc *sc, struct ath_txq *txq) { struct ath_hal *ah = sc->sc_ah; struct ath_buf *bf, *bf_last; @@ -668,7 +668,8 @@ ath_txq_restart_dma(struct ath_softc *sc * The relevant hardware txq should be locked. */ static void -ath_tx_handoff(struct ath_softc *sc, struct ath_txq *txq, struct ath_buf *bf) +ath_legacy_xmit_handoff(struct ath_softc *sc, struct ath_txq *txq, + struct ath_buf *bf) { ATH_TXQ_LOCK_ASSERT(txq); @@ -4493,4 +4494,7 @@ ath_xmit_setup_legacy(struct ath_softc * sc->sc_tx.xmit_setup = ath_legacy_dma_txsetup; sc->sc_tx.xmit_teardown = ath_legacy_dma_txteardown; + + sc->sc_tx.xmit_dma_restart = ath_legacy_tx_dma_restart; + sc->sc_tx.xmit_handoff = ath_legacy_xmit_handoff; } Modified: head/sys/dev/ath/if_ath_tx.h ============================================================================== --- head/sys/dev/ath/if_ath_tx.h Tue Jul 31 02:18:10 2012 (r238929) +++ head/sys/dev/ath/if_ath_tx.h Tue Jul 31 02:28:32 2012 (r238930) @@ -79,7 +79,6 @@ #define BAW_WITHIN(_start, _bawsz, _seqno) \ ((((_seqno) - (_start)) & 4095) < (_bawsz)) -extern void ath_txq_restart_dma(struct ath_softc *sc, struct ath_txq *txq); extern void ath_freetx(struct mbuf *m); extern void ath_tx_node_flush(struct ath_softc *sc, struct ath_node *an); extern void ath_tx_txq_drain(struct ath_softc *sc, struct ath_txq *txq); @@ -131,6 +130,10 @@ extern void ath_addba_response_timeout(s (_sc)->sc_tx.xmit_setup(_sc) #define ath_txdma_teardown(_sc) \ (_sc)->sc_tx.xmit_teardown(_sc) +#define ath_txq_restart_dma(_sc, _txq) \ + (_sc)->sc_tx.xmit_dma_restart((_sc), (_txq)) +#define ath_tx_handoff(_sc, _txq, _bf) \ + (_sc)->sc_tx.xmit_handoff((_sc), (_txq), (_bf)) extern void ath_xmit_setup_legacy(struct ath_softc *sc); #endif Modified: head/sys/dev/ath/if_ath_tx_edma.c ============================================================================== --- head/sys/dev/ath/if_ath_tx_edma.c Tue Jul 31 02:18:10 2012 (r238929) +++ head/sys/dev/ath/if_ath_tx_edma.c Tue Jul 31 02:28:32 2012 (r238930) @@ -130,6 +130,62 @@ __FBSDID("$FreeBSD$"); MALLOC_DECLARE(M_ATHDEV); +/* + * Re-initialise the DMA FIFO with the current contents of + * said FIFO. + * + * This should only be called as part of the chip reset path, as it + * assumes the FIFO is currently empty. + * + * TODO: verify that a cold/warm reset does clear the TX FIFO, so + * writing in a partially-filled FIFO will not cause double-entries + * to appear. + */ +static void +ath_edma_dma_restart(struct ath_softc *sc, struct ath_txq *txq) +{ + + device_printf(sc->sc_dev, "%s: called: txq=%p, qnum=%d\n", + __func__, + txq, + txq->axq_qnum); +} + +/* + * Handoff this frame to the hardware. + * + * For the multicast queue, this will treat it as a software queue + * and append it to the list, after updating the MORE_DATA flag + * in the previous frame. The cabq processing code will ensure + * that the queue contents gets transferred over. + * + * For the hardware queues, this will queue a frame to the queue + * like before, then populate the FIFO from that. Since the + * EDMA hardware has 8 FIFO slots per TXQ, this ensures that + * frames such as management frames don't get prematurely dropped. + * + * This does imply that a similar flush-hwq-to-fifoq method will + * need to be called from the processq function, before the + * per-node software scheduler is called. + */ +static void +ath_edma_xmit_handoff(struct ath_softc *sc, struct ath_txq *txq, + struct ath_buf *bf) +{ + + device_printf(sc->sc_dev, "%s: called; bf=%p, txq=%p, qnum=%d\n", + __func__, + bf, + txq, + txq->axq_qnum); + + /* + * XXX For now this is a placeholder; free the buffer + * and inform the stack that the TX failed. + */ + ath_tx_default_comp(sc, bf, 1); +} + static int ath_edma_setup_txfifo(struct ath_softc *sc, int qnum) { @@ -217,4 +273,7 @@ ath_xmit_setup_edma(struct ath_softc *sc sc->sc_tx.xmit_setup = ath_edma_dma_txsetup; sc->sc_tx.xmit_teardown = ath_edma_dma_txteardown; + + sc->sc_tx.xmit_dma_restart = ath_edma_dma_restart; + sc->sc_tx.xmit_handoff = ath_edma_xmit_handoff; } From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 03:09:50 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1339B106564A; Tue, 31 Jul 2012 03:09:50 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F09118FC0A; Tue, 31 Jul 2012 03:09:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6V39nZl078835; Tue, 31 Jul 2012 03:09:49 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6V39ngx078828; Tue, 31 Jul 2012 03:09:49 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207310309.q6V39ngx078828@svn.freebsd.org> From: Adrian Chadd Date: Tue, 31 Jul 2012 03:09:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238931 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 03:09:50 -0000 Author: adrian Date: Tue Jul 31 03:09:48 2012 New Revision: 238931 URL: http://svn.freebsd.org/changeset/base/238931 Log: Migrate some more TX side setup routines to be methods. Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_ath_misc.h head/sys/dev/ath/if_ath_tx.c head/sys/dev/ath/if_ath_tx.h head/sys/dev/ath/if_ath_tx_edma.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Tue Jul 31 02:28:32 2012 (r238930) +++ head/sys/dev/ath/if_ath.c Tue Jul 31 03:09:48 2012 (r238931) @@ -254,6 +254,28 @@ SYSCTL_INT(_hw_ath, OID_AUTO, bstuck, CT MALLOC_DEFINE(M_ATHDEV, "athdev", "ath driver dma buffers"); +void +ath_legacy_attach_comp_func(struct ath_softc *sc) +{ + + /* + * Special case certain configurations. Note the + * CAB queue is handled by these specially so don't + * include them when checking the txq setup mask. + */ + switch (sc->sc_txqsetup &~ (1<sc_cabq->axq_qnum)) { + case 0x01: + TASK_INIT(&sc->sc_txtask, 0, ath_tx_proc_q0, sc); + break; + case 0x0f: + TASK_INIT(&sc->sc_txtask, 0, ath_tx_proc_q0123, sc); + break; + default: + TASK_INIT(&sc->sc_txtask, 0, ath_tx_proc, sc); + break; + } +} + #define HAL_MODE_HT20 (HAL_MODE_11NG_HT20 | HAL_MODE_11NA_HT20) #define HAL_MODE_HT40 \ (HAL_MODE_11NG_HT40PLUS | HAL_MODE_11NG_HT40MINUS | \ @@ -460,21 +482,12 @@ ath_attach(u_int16_t devid, struct ath_s } /* - * Special case certain configurations. Note the - * CAB queue is handled by these specially so don't - * include them when checking the txq setup mask. + * Attach the TX completion function. + * + * The non-EDMA chips may have some special case optimisations; + * this method gives everyone a chance to attach cleanly. */ - switch (sc->sc_txqsetup &~ (1<sc_cabq->axq_qnum)) { - case 0x01: - TASK_INIT(&sc->sc_txtask, 0, ath_tx_proc_q0, sc); - break; - case 0x0f: - TASK_INIT(&sc->sc_txtask, 0, ath_tx_proc_q0123, sc); - break; - default: - TASK_INIT(&sc->sc_txtask, 0, ath_tx_proc, sc); - break; - } + sc->sc_tx.xmit_attach_comp_func(sc); /* * Setup rate control. Some rate control modules @@ -3563,8 +3576,8 @@ ath_tx_update_busy(struct ath_softc *sc) * Kick the packet scheduler if needed. This can occur from this * particular task. */ -static int -ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq, int dosched) +int +ath_legacy_tx_processq(struct ath_softc *sc, struct ath_txq *txq, int dosched) { struct ath_hal *ah = sc->sc_ah; struct ath_buf *bf; @@ -3964,7 +3977,7 @@ ath_tx_freebuf(struct ath_softc *sc, str } void -ath_tx_draintxq(struct ath_softc *sc, struct ath_txq *txq) +ath_legacy_tx_draintxq(struct ath_softc *sc, struct ath_txq *txq) { #ifdef ATH_DEBUG struct ath_hal *ah = sc->sc_ah; Modified: head/sys/dev/ath/if_ath_misc.h ============================================================================== --- head/sys/dev/ath/if_ath_misc.h Tue Jul 31 02:28:32 2012 (r238930) +++ head/sys/dev/ath/if_ath_misc.h Tue Jul 31 03:09:48 2012 (r238931) @@ -66,7 +66,6 @@ extern void ath_returnbuf_head(struct at extern void ath_returnbuf_tail(struct ath_softc *sc, struct ath_buf *bf); extern int ath_reset(struct ifnet *, ATH_RESET_TYPE); -extern void ath_tx_draintxq(struct ath_softc *sc, struct ath_txq *txq); extern void ath_tx_default_comp(struct ath_softc *sc, struct ath_buf *bf, int fail); extern void ath_tx_update_ratectrl(struct ath_softc *sc, @@ -96,6 +95,11 @@ extern int ath_descdma_setup_rx_edma(str extern void ath_descdma_cleanup(struct ath_softc *sc, struct ath_descdma *dd, ath_bufhead *head); +extern void ath_legacy_attach_comp_func(struct ath_softc *sc); +extern void ath_legacy_tx_draintxq(struct ath_softc *sc, struct ath_txq *txq); +extern int ath_legacy_tx_processq(struct ath_softc *sc, struct ath_txq *txq, + int dosched); + /* * This is only here so that the RX proc function can call it. * It's very likely that the "start TX after RX" call should be Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Tue Jul 31 02:28:32 2012 (r238930) +++ head/sys/dev/ath/if_ath_tx.c Tue Jul 31 03:09:48 2012 (r238931) @@ -4494,7 +4494,10 @@ ath_xmit_setup_legacy(struct ath_softc * sc->sc_tx.xmit_setup = ath_legacy_dma_txsetup; sc->sc_tx.xmit_teardown = ath_legacy_dma_txteardown; + sc->sc_tx.xmit_attach_comp_func = ath_legacy_attach_comp_func; sc->sc_tx.xmit_dma_restart = ath_legacy_tx_dma_restart; sc->sc_tx.xmit_handoff = ath_legacy_xmit_handoff; + sc->sc_tx.xmit_processq = ath_legacy_tx_processq; + sc->sc_tx.xmit_drainq = ath_legacy_tx_draintxq; } Modified: head/sys/dev/ath/if_ath_tx.h ============================================================================== --- head/sys/dev/ath/if_ath_tx.h Tue Jul 31 02:28:32 2012 (r238930) +++ head/sys/dev/ath/if_ath_tx.h Tue Jul 31 03:09:48 2012 (r238931) @@ -134,6 +134,11 @@ extern void ath_addba_response_timeout(s (_sc)->sc_tx.xmit_dma_restart((_sc), (_txq)) #define ath_tx_handoff(_sc, _txq, _bf) \ (_sc)->sc_tx.xmit_handoff((_sc), (_txq), (_bf)) +#define ath_tx_draintxq(_sc, _txq) \ + (_sc)->sc_tx.xmit_drainq((_sc), (_txq)) +#define ath_tx_processq(_sc, _txq, _dosched) \ + (_sc)->sc_tx.xmit_processq((_sc), (_txq), (_dosched)) + extern void ath_xmit_setup_legacy(struct ath_softc *sc); #endif Modified: head/sys/dev/ath/if_ath_tx_edma.c ============================================================================== --- head/sys/dev/ath/if_ath_tx_edma.c Tue Jul 31 02:28:32 2012 (r238930) +++ head/sys/dev/ath/if_ath_tx_edma.c Tue Jul 31 03:09:48 2012 (r238931) @@ -255,6 +255,35 @@ ath_edma_dma_txteardown(struct ath_softc return (0); } +static int +ath_edma_tx_processq(struct ath_softc *sc, struct ath_txq *txq, int dosched) +{ + + return (0); +} + +static void +ath_edma_tx_draintxq(struct ath_softc *sc, struct ath_txq *txq) +{ + +} + +static void +ath_edma_tx_proc(void *arg, int npending) +{ + struct ath_softc *sc = (struct ath_softc *) arg; + + device_printf(sc->sc_dev, "%s: called, npending=%d\n", + __func__, npending); +} + +static void +ath_edma_attach_comp_func(struct ath_softc *sc) +{ + + TASK_INIT(&sc->sc_txtask, 0, ath_edma_tx_proc, sc); +} + void ath_xmit_setup_edma(struct ath_softc *sc) { @@ -273,7 +302,10 @@ ath_xmit_setup_edma(struct ath_softc *sc sc->sc_tx.xmit_setup = ath_edma_dma_txsetup; sc->sc_tx.xmit_teardown = ath_edma_dma_txteardown; + sc->sc_tx.xmit_attach_comp_func = ath_edma_attach_comp_func; sc->sc_tx.xmit_dma_restart = ath_edma_dma_restart; sc->sc_tx.xmit_handoff = ath_edma_xmit_handoff; + sc->sc_tx.xmit_processq = ath_edma_tx_processq; + sc->sc_tx.xmit_drainq = ath_edma_tx_draintxq; } Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Tue Jul 31 02:28:32 2012 (r238930) +++ head/sys/dev/ath/if_athvar.h Tue Jul 31 03:09:48 2012 (r238931) @@ -408,6 +408,17 @@ struct ath_tx_edma_fifo { struct ath_tx_methods { int (*xmit_setup)(struct ath_softc *sc); int (*xmit_teardown)(struct ath_softc *sc); + void (*xmit_attach_comp_func)(struct ath_softc *sc); + + void (*xmit_dma_restart)(struct ath_softc *sc, + struct ath_txq *txq); + void (*xmit_handoff)(struct ath_softc *sc, + struct ath_txq *txq, struct ath_buf *bf); + + void (*xmit_drainq)(struct ath_softc *sc, + struct ath_txq *txq); + int (*xmit_processq)(struct ath_softc *sc, + struct ath_txq *txq, int dosched); }; struct ath_softc { From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 03:47:27 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [69.147.83.53]) by hub.freebsd.org (Postfix) with ESMTP id 39A61106564A; Tue, 31 Jul 2012 03:47:27 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from opti.dougb.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 7C0F214DE36; Tue, 31 Jul 2012 03:47:26 +0000 (UTC) Message-ID: <5017554E.2020806@FreeBSD.org> Date: Mon, 30 Jul 2012 20:47:26 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:14.0) Gecko/20120728 Thunderbird/14.0 MIME-Version: 1.0 To: Luigi Rizzo References: <201207301821.q6UILnA8022241@svn.freebsd.org> In-Reply-To: <201207301821.q6UILnA8022241@svn.freebsd.org> X-Enigmail-Version: 1.4.2 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r238912 - head/sys/dev/netmap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 03:47:27 -0000 It seems this broke the build? On 07/30/2012 11:21, Luigi Rizzo wrote: > Author: luigi > Date: Mon Jul 30 18:21:48 2012 > New Revision: 238912 > URL: http://svn.freebsd.org/changeset/base/238912 > > Log: > - move the inclusion of netmap headers to the common part of the code; > - more portable annotations for unused arguments; > > Modified: > head/sys/dev/netmap/netmap.c > head/sys/dev/netmap/netmap_mem2.c > > Modified: head/sys/dev/netmap/netmap.c > ============================================================================== > --- head/sys/dev/netmap/netmap.c Mon Jul 30 15:37:47 2012 (r238911) > +++ head/sys/dev/netmap/netmap.c Mon Jul 30 18:21:48 2012 (r238912) > @@ -90,13 +90,14 @@ __FBSDID("$FreeBSD$"); > #include > #include /* BIOCIMMEDIATE */ > #include > -#include > -#include > #include /* bus_dmamap_* */ > > MALLOC_DEFINE(M_NETMAP, "netmap", "Network memory map"); > #endif /* __FreeBSD__ */ > > +#include > +#include > + > /* > * lock and unlock for the netmap memory allocator > */ > @@ -764,8 +765,8 @@ netmap_set_ringid(struct netmap_priv_d * > * Return 0 on success, errno otherwise. > */ > static int > -netmap_ioctl(__unused struct cdev *dev, u_long cmd, caddr_t data, > - __unused int fflag, struct thread *td) > +netmap_ioctl(struct cdev *dev, u_long cmd, caddr_t data, > + int fflag, struct thread *td) > { > struct netmap_priv_d *priv = NULL; > struct ifnet *ifp; > @@ -775,6 +776,8 @@ netmap_ioctl(__unused struct cdev *dev, > u_int i, lim; > struct netmap_if *nifp; > > + (void)dev; /* UNUSED */ > + (void)fflag; /* UNUSED */ > #ifdef linux > #define devfs_get_cdevpriv(pp) \ > ({ *(struct netmap_priv_d **)pp = ((struct file *)td)->private_data; \ > @@ -1551,7 +1554,7 @@ linux_netmap_poll(struct file * file, st > } > > static int > -netmap_mmap(__unused struct file *f, struct vm_area_struct *vma) > +netmap_mmap(struct file *f, struct vm_area_struct *vma) > { > int lut_skip, i, j; > int user_skip = 0; > @@ -1565,6 +1568,7 @@ netmap_mmap(__unused struct file *f, str > * vma->vm_end: end of the mapping user address space > */ > > + (void)f; /* UNUSED */ > // XXX security checks > > for (i = 0; i < 3; i++) { /* loop through obj_pools */ > @@ -1599,7 +1603,7 @@ netmap_start_linux(struct sk_buff *skb, > } > > > -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38) > +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37) // XXX was 38 > #define LIN_IOCTL_NAME .ioctl > int > linux_netmap_ioctl(struct inode *inode, struct file *file, u_int cmd, u_long data /* arg */) > @@ -1623,8 +1627,9 @@ linux_netmap_ioctl(struct file *file, u_ > > > static int > -netmap_release(__unused struct inode *inode, struct file *file) > +netmap_release(struct inode *inode, struct file *file) > { > + (void)inode; /* UNUSED */ > if (file->private_data) > netmap_dtor(file->private_data); > return (0); > > Modified: head/sys/dev/netmap/netmap_mem2.c > ============================================================================== > --- head/sys/dev/netmap/netmap_mem2.c Mon Jul 30 15:37:47 2012 (r238911) > +++ head/sys/dev/netmap/netmap_mem2.c Mon Jul 30 18:21:48 2012 (r238912) > @@ -25,7 +25,7 @@ > > /* > * $FreeBSD$ > - * $Id: netmap_mem2.c 10830 2012-03-22 18:06:01Z luigi $ > + * $Id: netmap_mem2.c 11445 2012-07-30 10:49:07Z luigi $ > * > * New memory allocator for netmap > */ > @@ -300,12 +300,13 @@ netmap_obj_free_va(struct netmap_obj_poo > > > static void > -netmap_new_bufs(struct netmap_if *nifp __unused, > +netmap_new_bufs(struct netmap_if *nifp, > struct netmap_slot *slot, u_int n) > { > struct netmap_obj_pool *p = nm_mem->nm_buf_pool; > uint32_t i = 0; /* slot counter */ > > + (void)nifp; /* UNUSED */ > for (i = 0; i < n; i++) { > void *vaddr = netmap_buf_malloc(); > if (vaddr == NULL) { > -- I am only one, but I am one. I cannot do everything, but I can do something. And I will not let what I cannot do interfere with what I can do. -- Edward Everett Hale, (1822 - 1909) From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 03:53:31 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 111B8106568C; Tue, 31 Jul 2012 03:53:31 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 93B4B8FC1A; Tue, 31 Jul 2012 03:53:30 +0000 (UTC) Received: by obbun3 with SMTP id un3so12820370obb.13 for ; Mon, 30 Jul 2012 20:53:30 -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=ELKuE3+kbTQXT9t9BS3HwhCssiTtdhrSlSNGqU9enGk=; b=EIlGSahJBAp1Zk744Lo6NoXrqVXvGdInGgMwuAeAuDrSfHyDqeAt8JWTQKSVDM1J93 4hFE4L4OXk+ZDYK/omOXBKQQLa3h4wzEO9VkiRit3BsGxn257vK6B5w7b+3vnWmf/puq +WT/djrzqvwTC94WtJvzypJXJNUoHw8s1MHTnPFx4Es7igVkAUgJStIgXl6BoF4K/Gwj 7Bnh27QCxDN/oVMGagI9RTHQFy0vGDvkIoV14Nhh6WBxcx6aGswwE4EvHMuzjo2cENRb 3x7o/DXSHMVi+w45WJf5m2U7xNwQVRcp5EzEKRb8F8MyXyBrC+hmFzcAqLrETa41R3YP 7zqQ== MIME-Version: 1.0 Received: by 10.60.19.232 with SMTP id i8mr20756237oee.35.1343706810016; Mon, 30 Jul 2012 20:53:30 -0700 (PDT) Received: by 10.76.84.7 with HTTP; Mon, 30 Jul 2012 20:53:29 -0700 (PDT) In-Reply-To: <5017554E.2020806@FreeBSD.org> References: <201207301821.q6UILnA8022241@svn.freebsd.org> <5017554E.2020806@FreeBSD.org> Date: Mon, 30 Jul 2012 20:53:29 -0700 Message-ID: From: Garrett Cooper To: Doug Barton Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, Luigi Rizzo , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r238912 - head/sys/dev/netmap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 03:53:31 -0000 On Mon, Jul 30, 2012 at 8:47 PM, Doug Barton wrote: > It seems this broke the build? > > > On 07/30/2012 11:21, Luigi Rizzo wrote: >> Author: luigi >> Date: Mon Jul 30 18:21:48 2012 >> New Revision: 238912 >> URL: http://svn.freebsd.org/changeset/base/238912 >> >> Log: >> - move the inclusion of netmap headers to the common part of the code; This part did in particular. I CCed Luigi about the issue this morning. Thanks! -Garrett From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 03:56:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4F1231065675; Tue, 31 Jul 2012 03:56:46 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 08E4A8FC18; Tue, 31 Jul 2012 03:56:46 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id B55E67300A; Tue, 31 Jul 2012 06:16:44 +0200 (CEST) Date: Tue, 31 Jul 2012 06:16:44 +0200 From: Luigi Rizzo To: Garrett Cooper Message-ID: <20120731041644.GA7559@onelab2.iet.unipi.it> References: <201207301821.q6UILnA8022241@svn.freebsd.org> <5017554E.2020806@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, Luigi Rizzo , Doug Barton , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r238912 - head/sys/dev/netmap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 03:56:46 -0000 On Mon, Jul 30, 2012 at 08:53:29PM -0700, Garrett Cooper wrote: > On Mon, Jul 30, 2012 at 8:47 PM, Doug Barton wrote: > > It seems this broke the build? > > > > > > On 07/30/2012 11:21, Luigi Rizzo wrote: > >> Author: luigi > >> Date: Mon Jul 30 18:21:48 2012 > >> New Revision: 238912 > >> URL: http://svn.freebsd.org/changeset/base/238912 > >> > >> Log: > >> - move the inclusion of netmap headers to the common part of the code; > > This part did in particular. I CCed Luigi about the issue this morning. yes, thanks, i am working on this. i think a quick fix is to move the MALLOC_DECLARE after the netmap_kern.h header inclusion. I am working on a fix. (6am here, give me a couple of hours to wake up :) cheers luigi From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 04:09:28 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63685106564A; Tue, 31 Jul 2012 04:09:28 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E42C8FC12; Tue, 31 Jul 2012 04:09:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6V49SrT083637; Tue, 31 Jul 2012 04:09:28 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6V49S4a083635; Tue, 31 Jul 2012 04:09:28 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201207310409.q6V49S4a083635@svn.freebsd.org> From: Warner Losh Date: Tue, 31 Jul 2012 04:09:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238932 - head/sys/arm/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 04:09:28 -0000 Author: imp Date: Tue Jul 31 04:09:27 2012 New Revision: 238932 URL: http://svn.freebsd.org/changeset/base/238932 Log: macb doesn't work, switch to ate. Modified: head/sys/arm/conf/SAM9X25EK Modified: head/sys/arm/conf/SAM9X25EK ============================================================================== --- head/sys/arm/conf/SAM9X25EK Tue Jul 31 03:09:48 2012 (r238931) +++ head/sys/arm/conf/SAM9X25EK Tue Jul 31 04:09:27 2012 (r238932) @@ -86,8 +86,7 @@ device md device uart # Serial Ports # Ethernet -#device ate # Ethernet Driver -device macb # Alternate Ethernet driver +device ate # Ethernet Driver device mii option AT91_ATE_USE_RMII From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 05:23:24 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5EB13106564A; Tue, 31 Jul 2012 05:23:24 +0000 (UTC) (envelope-from fjoe@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3047F8FC12; Tue, 31 Jul 2012 05:23:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6V5NOx2089533; Tue, 31 Jul 2012 05:23:24 GMT (envelope-from fjoe@svn.freebsd.org) Received: (from fjoe@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6V5NN0j089530; Tue, 31 Jul 2012 05:23:23 GMT (envelope-from fjoe@svn.freebsd.org) Message-Id: <201207310523.q6V5NN0j089530@svn.freebsd.org> From: Max Khon Date: Tue, 31 Jul 2012 05:23:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238933 - head/sys/dev/puc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 05:23:24 -0000 Author: fjoe Date: Tue Jul 31 05:23:23 2012 New Revision: 238933 URL: http://svn.freebsd.org/changeset/base/238933 Log: - Change back "d_ofs" to int8_t to not pessimize padding and size of "struct puc_cfg". - Use "puc_config_moxa" for Moxa boards that need d_ofs greater than 0x7f Prodded by: marcel@, gavin@ MFC after: 3 days Modified: head/sys/dev/puc/puc_cfg.h head/sys/dev/puc/pucdata.c Modified: head/sys/dev/puc/puc_cfg.h ============================================================================== --- head/sys/dev/puc/puc_cfg.h Tue Jul 31 04:09:27 2012 (r238932) +++ head/sys/dev/puc/puc_cfg.h Tue Jul 31 05:23:23 2012 (r238933) @@ -79,7 +79,7 @@ struct puc_cfg { int8_t ports; int8_t rid; /* Rid of first port */ int8_t d_rid; /* Delta rid of next ports */ - int16_t d_ofs; /* Delta offset of next ports */ + int8_t d_ofs; /* Delta offset of next ports */ puc_config_f *config_function; }; Modified: head/sys/dev/puc/pucdata.c ============================================================================== --- head/sys/dev/puc/pucdata.c Tue Jul 31 04:09:27 2012 (r238932) +++ head/sys/dev/puc/pucdata.c Tue Jul 31 05:23:23 2012 (r238933) @@ -510,13 +510,15 @@ const struct puc_cfg puc_pci_devices[] = { 0x1393, 0x1024, 0xffff, 0, "Moxa Technologies, Smartio CP-102E/PCIe", DEFAULT_RCLK * 8, - PUC_PORT_2S, 0x14, 0, 0x200 + PUC_PORT_2S, 0x14, 0, -1, + .config_function = puc_config_moxa }, { 0x1393, 0x1025, 0xffff, 0, "Moxa Technologies, Smartio CP-102EL/PCIe", DEFAULT_RCLK * 8, - PUC_PORT_2S, 0x14, 0, 0x200, + PUC_PORT_2S, 0x14, 0, -1, + .config_function = puc_config_moxa }, { 0x1393, 0x1040, 0xffff, 0, @@ -572,7 +574,8 @@ const struct puc_cfg puc_pci_devices[] = { 0x1393, 0x1182, 0xffff, 0, "Moxa Technologies, Smartio CP-118EL-A/PCIe", DEFAULT_RCLK * 8, - PUC_PORT_8S, 0x14, 0, 0x200, + PUC_PORT_8S, 0x14, 0, -1, + .config_function = puc_config_moxa }, { 0x1393, 0x1680, 0xffff, 0, @@ -596,7 +599,8 @@ const struct puc_cfg puc_pci_devices[] = { 0x1393, 0x1683, 0xffff, 0, "Moxa Technologies, Smartio CP-168EL-A/PCIe", DEFAULT_RCLK * 8, - PUC_PORT_8S, 0x14, 0, 0x200, + PUC_PORT_8S, 0x14, 0, -1, + .config_function = puc_config_moxa }, { 0x13a8, 0x0152, 0xffff, 0, @@ -1159,7 +1163,12 @@ puc_config_moxa(struct puc_softc *sc, en intptr_t *res) { if (cmd == PUC_CFG_GET_OFS) { - *res = ((port == 3) ? 7 : port) * 0x200; + const struct puc_cfg *cfg = sc->sc_cfg; + + if (port == 3 && (cfg->device == 0x1045 || cfg->device == 0x1144)) + port = 7; + *res = port * 0x200; + return 0; } return (ENXIO); From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 05:34:54 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E1E3A106566B; Tue, 31 Jul 2012 05:34:54 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CCA9A8FC12; Tue, 31 Jul 2012 05:34:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6V5YspR090457; Tue, 31 Jul 2012 05:34:54 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6V5YsZ5090455; Tue, 31 Jul 2012 05:34:54 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201207310534.q6V5YsZ5090455@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 31 Jul 2012 05:34:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238934 - head/sys/netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 05:34:55 -0000 Author: bz Date: Tue Jul 31 05:34:54 2012 New Revision: 238934 URL: http://svn.freebsd.org/changeset/base/238934 Log: Improve the should-never-hit printf to ease debugging in case we'd ever hit it again when doing the delayed IPv6 checksum calculations. MFC after: 3 days Modified: head/sys/netinet6/ip6_output.c Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Tue Jul 31 05:23:23 2012 (r238933) +++ head/sys/netinet6/ip6_output.c Tue Jul 31 05:34:54 2012 (r238934) @@ -195,8 +195,9 @@ in6_delayed_cksum(struct mbuf *m, uint32 offset += m->m_pkthdr.csum_data; /* checksum offset */ if (offset + sizeof(u_short) > m->m_len) { - printf("%s: delayed m_pullup, m->len: %d off: %d\n", - __func__, m->m_len, offset); + printf("%s: delayed m_pullup, m->len: %d plen %u off %u " + "csum_flags=0x%04x\n", __func__, m->m_len, plen, offset, + m->m_pkthdr.csum_flags); /* * XXX this should not happen, but if it does, the correct * behavior may be to insert the checksum in the appropriate From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 05:44:03 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DCAFD1065686; Tue, 31 Jul 2012 05:44:03 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C8A6D8FC19; Tue, 31 Jul 2012 05:44:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6V5i3Qu091246; Tue, 31 Jul 2012 05:44:03 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6V5i3wL091244; Tue, 31 Jul 2012 05:44:03 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201207310544.q6V5i3wL091244@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 31 Jul 2012 05:44:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238935 - head/sys/netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 05:44:04 -0000 Author: bz Date: Tue Jul 31 05:44:03 2012 New Revision: 238935 URL: http://svn.freebsd.org/changeset/base/238935 Log: Properly apply #ifdef INET and leave a comment that we are (will) apply delayed IPv6 checksum processing in ip6_output.c when doing IPsec. PR: kern/170116 MFC after: 3 days Modified: head/sys/netinet6/ip6_ipsec.c Modified: head/sys/netinet6/ip6_ipsec.c ============================================================================== --- head/sys/netinet6/ip6_ipsec.c Tue Jul 31 05:34:54 2012 (r238934) +++ head/sys/netinet6/ip6_ipsec.c Tue Jul 31 05:44:03 2012 (r238935) @@ -291,16 +291,16 @@ ip6_ipsec_output(struct mbuf **m, struct /* * Do delayed checksums now because we send before * this is done in the normal processing path. - * XXX-BZ CSUM_DELAY_DATA_IPV6? + * For IPv6 we do delayed checksums in ip6_output.c. */ +#ifdef INET if ((*m)->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { ipseclog((LOG_DEBUG, "%s: we do not support IPv4 over IPv6", __func__)); -#ifdef INET in_delayed_cksum(*m); -#endif (*m)->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } +#endif /* * Preserve KAME behaviour: ENOENT can be returned From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 05:48:36 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53E3B1065670; Tue, 31 Jul 2012 05:48:36 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 34C4D8FC0A; Tue, 31 Jul 2012 05:48:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6V5masR091628; Tue, 31 Jul 2012 05:48:36 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6V5mZHf091624; Tue, 31 Jul 2012 05:48:35 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201207310548.q6V5mZHf091624@svn.freebsd.org> From: David Xu Date: Tue, 31 Jul 2012 05:48:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238936 - in head/sys: fs/fifofs kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 05:48:36 -0000 Author: davidxu Date: Tue Jul 31 05:48:35 2012 New Revision: 238936 URL: http://svn.freebsd.org/changeset/base/238936 Log: I am comparing current pipe code with the one in 8.3-STABLE r236165, I found 8.3 is a history BSD version using socket to implement FIFO pipe, it uses per-file seqcount to compare with writer generation stored in per-pipe object. The concept is after all writers are gone, the pipe enters next generation, all old readers have not closed the pipe should get the indication that the pipe is disconnected, result is they should get EPIPE, SIGPIPE or get POLLHUP in poll(). But newcomer should not know that previous writters were gone, it should treat it as a fresh session. I am trying to bring back FIFO pipe to history behavior. It is still unclear that if single EOF flag can represent SBS_CANTSENDMORE and SBS_CANTRCVMORE which socket-based version is using, but I have run the poll regression test in tool directory, output is same as the one on 8.3-STABLE now. I think the output "not ok 18 FIFO state 6b: poll result 0 expected 1. expected POLLHUP; got 0" might be bogus, because newcomer should not know that old writers were gone. I got the same behavior on Linux. Our implementation always return POLLIN for disconnected pipe even it should return POLLHUP, but I think it is not wise to remove POLLIN for compatible reason, this is our history behavior. Regression test: /usr/src/tools/regression/poll Modified: head/sys/fs/fifofs/fifo_vnops.c head/sys/kern/sys_pipe.c head/sys/sys/pipe.h Modified: head/sys/fs/fifofs/fifo_vnops.c ============================================================================== --- head/sys/fs/fifofs/fifo_vnops.c Tue Jul 31 05:44:03 2012 (r238935) +++ head/sys/fs/fifofs/fifo_vnops.c Tue Jul 31 05:48:35 2012 (r238936) @@ -59,23 +59,13 @@ * Notes about locking: * - fi_pipe is invariant since init time. * - fi_readers and fi_writers are protected by the vnode lock. - * - fi_wgen and fi_seqcount are protected by the pipe mutex. */ struct fifoinfo { struct pipe *fi_pipe; long fi_readers; long fi_writers; - int fi_wgen; - int fi_seqcount; }; -#define FIFO_UPDWGEN(fip, pip) do { \ - if ((fip)->fi_wgen == (fip)->fi_seqcount) \ - (pip)->pipe_state |= PIPE_SAMEWGEN; \ - else \ - (pip)->pipe_state &= ~PIPE_SAMEWGEN; \ -} while (0) - static vop_print_t fifo_print; static vop_open_t fifo_open; static vop_close_t fifo_close; @@ -161,7 +151,7 @@ fifo_open(ap) return (error); fip = malloc(sizeof(*fip), M_VNODE, M_WAITOK); fip->fi_pipe = fpipe; - fip->fi_wgen = fip->fi_readers = fip->fi_writers = 0; + fpipe->pipe_wgen = fip->fi_readers = fip->fi_writers = 0; KASSERT(vp->v_fifoinfo == NULL, ("fifo_open: v_fifoinfo race")); vp->v_fifoinfo = fip; } @@ -181,8 +171,7 @@ fifo_open(ap) if (fip->fi_writers > 0) wakeup(&fip->fi_writers); } - fip->fi_seqcount = fip->fi_wgen - fip->fi_writers; - FIFO_UPDWGEN(fip, fpipe); + fp->f_seqcount = fpipe->pipe_wgen - fip->fi_writers; } if (ap->a_mode & FWRITE) { if ((ap->a_mode & O_NONBLOCK) && fip->fi_readers == 0) { @@ -235,8 +224,7 @@ fifo_open(ap) fpipe->pipe_state |= PIPE_EOF; if (fpipe->pipe_state & PIPE_WANTR) wakeup(fpipe); - fip->fi_wgen++; - FIFO_UPDWGEN(fip, fpipe); + fpipe->pipe_wgen++; PIPE_UNLOCK(fpipe); fifo_cleanup(vp); } @@ -300,8 +288,7 @@ fifo_close(ap) cpipe->pipe_state &= ~PIPE_WANTR; wakeup(cpipe); } - fip->fi_wgen++; - FIFO_UPDWGEN(fip, cpipe); + cpipe->pipe_wgen++; pipeselwakeup(cpipe); PIPE_UNLOCK(cpipe); } Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Tue Jul 31 05:44:03 2012 (r238935) +++ head/sys/kern/sys_pipe.c Tue Jul 31 05:48:35 2012 (r238936) @@ -1442,7 +1442,7 @@ pipe_poll(fp, events, active_cred, td) levents = events & (POLLIN | POLLINIGNEOF | POLLPRI | POLLRDNORM | POLLRDBAND); if (rpipe->pipe_state & PIPE_NAMED && fp->f_flag & FREAD && levents && - rpipe->pipe_state & PIPE_SAMEWGEN) + fp->f_seqcount == rpipe->pipe_wgen) events |= POLLINIGNEOF; if ((events & POLLINIGNEOF) == 0) { Modified: head/sys/sys/pipe.h ============================================================================== --- head/sys/sys/pipe.h Tue Jul 31 05:44:03 2012 (r238935) +++ head/sys/sys/pipe.h Tue Jul 31 05:48:35 2012 (r238936) @@ -96,7 +96,6 @@ struct pipemapping { #define PIPE_DIRECTW 0x400 /* Pipe direct write active. */ #define PIPE_DIRECTOK 0x800 /* Direct mode ok. */ #define PIPE_NAMED 0x1000 /* Is a named pipe. */ -#define PIPE_SAMEWGEN 0x2000 /* same write generation for named pipes. */ /* * Per-pipe data structure. @@ -115,6 +114,7 @@ struct pipe { u_int pipe_state; /* pipe status info */ int pipe_busy; /* busy flag, mostly to handle rundown sanely */ int pipe_present; /* still present? */ + int pipe_wgen; /* writer generation for named pipe */ ino_t pipe_ino; /* fake inode for stat(2) */ }; From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 05:51:48 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE07F106564A; Tue, 31 Jul 2012 05:51:48 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A9E148FC17; Tue, 31 Jul 2012 05:51:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6V5pmBD091910; Tue, 31 Jul 2012 05:51:48 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6V5pmeO091908; Tue, 31 Jul 2012 05:51:48 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201207310551.q6V5pmeO091908@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 31 Jul 2012 05:51:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238937 - head/sys/dev/netmap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 05:51:48 -0000 Author: luigi Date: Tue Jul 31 05:51:48 2012 New Revision: 238937 URL: http://svn.freebsd.org/changeset/base/238937 Log: remove a redundant MALLOC_DECLARE Modified: head/sys/dev/netmap/netmap_kern.h Modified: head/sys/dev/netmap/netmap_kern.h ============================================================================== --- head/sys/dev/netmap/netmap_kern.h Tue Jul 31 05:48:35 2012 (r238936) +++ head/sys/dev/netmap/netmap_kern.h Tue Jul 31 05:51:48 2012 (r238937) @@ -80,10 +80,6 @@ #error unsupported platform #endif -#ifdef MALLOC_DECLARE -MALLOC_DECLARE(M_NETMAP); -#endif - #define ND(format, ...) #define D(format, ...) \ do { \ From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 07:22:26 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A4D5C1065670; Tue, 31 Jul 2012 07:22:26 +0000 (UTC) (envelope-from giovanni.trematerra@gmail.com) Received: from mail-qa0-f47.google.com (mail-qa0-f47.google.com [209.85.216.47]) by mx1.freebsd.org (Postfix) with ESMTP id F29728FC0A; Tue, 31 Jul 2012 07:22:25 +0000 (UTC) Received: by qabg1 with SMTP id g1so1619943qab.13 for ; Tue, 31 Jul 2012 00:22:25 -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 :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=xfSLwXuWwB/wmUO8l4eap/Er3UvpIfXjLgvRlw+rtHQ=; b=Hh7VhvwysxMaqW1Ww+j7UMXhQIkVk0XUGecquqybugRNbFiSeyWqz63E4n6UwjLnEL WKIOVgg6HNKLydldLFPwZcbIrlc1Jjc60jXVRz/2eWU/TNMBaHN0nNjLX28WvLf/PzyU i+Wlp5jzDjdesXnkQWXm0BEeZyuQ0k7aZW55O3plV/3/ms2ZF+3gAySPwyTyMhvVEgM2 R1jAExqwpMMS2sBmlNSkxqNFQ7RWfTozb37+WjoE7rBRpgo4mBGgJkFy66L1H/PTkr2s AxI2xM/0Y1qSJXBUud2R8iadNn3ixoW6zU4f0Fddm6GDpd65EeW08DGABuoKT9aww1Zk T1Hg== MIME-Version: 1.0 Received: by 10.224.59.199 with SMTP id m7mr10765382qah.13.1343719345263; Tue, 31 Jul 2012 00:22:25 -0700 (PDT) Sender: giovanni.trematerra@gmail.com Received: by 10.229.59.169 with HTTP; Tue, 31 Jul 2012 00:22:25 -0700 (PDT) In-Reply-To: <201207310548.q6V5mZHf091624@svn.freebsd.org> References: <201207310548.q6V5mZHf091624@svn.freebsd.org> Date: Tue, 31 Jul 2012 09:22:25 +0200 X-Google-Sender-Auth: zgPcggJt6w-UNVm59UL4w7vWixo Message-ID: From: Giovanni Trematerra To: David Xu Content-Type: text/plain; charset=UTF-8 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Konstantin Belousov , bde@freebsd.org Subject: Re: svn commit: r238936 - in head/sys: fs/fifofs kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 07:22:26 -0000 On Tue, Jul 31, 2012 at 7:48 AM, David Xu wrote: > Author: davidxu > Date: Tue Jul 31 05:48:35 2012 > New Revision: 238936 > URL: http://svn.freebsd.org/changeset/base/238936 > > Log: > I am comparing current pipe code with the one in 8.3-STABLE r236165, > I found 8.3 is a history BSD version using socket to implement FIFO > pipe, it uses per-file seqcount to compare with writer generation > stored in per-pipe object. The concept is after all writers are gone, > the pipe enters next generation, all old readers have not closed the > pipe should get the indication that the pipe is disconnected, result > is they should get EPIPE, SIGPIPE or get POLLHUP in poll(). > But newcomer should not know that previous writters were gone, it > should treat it as a fresh session. > I am trying to bring back FIFO pipe to history behavior. It is still > unclear that if single EOF flag can represent SBS_CANTSENDMORE and > SBS_CANTRCVMORE which socket-based version is using, but I have run > the poll regression test in tool directory, output is same as the one > on 8.3-STABLE now. > I think the output "not ok 18 FIFO state 6b: poll result 0 expected 1. > expected POLLHUP; got 0" might be bogus, because newcomer should not > know that old writers were gone. I got the same behavior on Linux. > Our implementation always return POLLIN for disconnected pipe even it > should return POLLHUP, but I think it is not wise to remove POLLIN for > compatible reason, this is our history behavior. > I'm sorry but I'm failing to understand the reason for this change. Can you point me out a test that confirm that the change is needed. The only thing I see is an increase in the memory footprint for the pipes. There was a lot of discussions on this topic on -arch mailing list http://lists.freebsd.org/pipermail/freebsd-arch/2012-January/012131.html http://lists.freebsd.org/pipermail/freebsd-arch/2012-February/012314.html Thank you -- Gianni From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 07:22:51 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 74B8310657CC; Tue, 31 Jul 2012 07:22:51 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F8E88FC0A; Tue, 31 Jul 2012 07:22:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6V7MpfO099709; Tue, 31 Jul 2012 07:22:51 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6V7Mp43099707; Tue, 31 Jul 2012 07:22:51 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201207310722.q6V7Mp43099707@svn.freebsd.org> From: Monthadar Al Jaberi Date: Tue, 31 Jul 2012 07:22:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238938 - head/sys/dev/wtap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 07:22:51 -0000 Author: monthadar Date: Tue Jul 31 07:22:50 2012 New Revision: 238938 URL: http://svn.freebsd.org/changeset/base/238938 Log: Fix wtap to not panic in wtap_beacon_intrp. * Changed KASSERT to be debug printf (DWTAP_PRINTF). If state is not IEEE80211_S_RUN we return without scheduling a new callout; * When net80211 stack changes state to IEEE802_11_INIT we stop the beacon callout task; Modified: head/sys/dev/wtap/if_wtap.c Modified: head/sys/dev/wtap/if_wtap.c ============================================================================== --- head/sys/dev/wtap/if_wtap.c Tue Jul 31 05:51:48 2012 (r238937) +++ head/sys/dev/wtap/if_wtap.c Tue Jul 31 07:22:50 2012 (r238938) @@ -230,8 +230,10 @@ wtap_beacon_intrp(void *arg) struct ieee80211vap *vap = arg; struct mbuf *m; - KASSERT(vap->iv_state >= IEEE80211_S_RUN, - ("not running, state %d", vap->iv_state)); + if (vap->iv_state < IEEE80211_S_RUN) { + DWTAP_PRINTF("Skip beacon, not running, state %d", vap->iv_state); + return ; + } DWTAP_PRINTF("[%d] beacon intrp\n", avp->id); //burst mode /* * Update dynamic beacon contents. If this returns @@ -289,6 +291,8 @@ wtap_newstate(struct ieee80211vap *vap, default: goto bad; } + } else if (nstate == IEEE80211_S_INIT) { + callout_stop(&avp->av_swba); } return 0; bad: From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 07:31:48 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7817106564A; Tue, 31 Jul 2012 07:31:48 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 78F138FC12; Tue, 31 Jul 2012 07:31:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6V7VmXn000533; Tue, 31 Jul 2012 07:31:48 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6V7VmnE000531; Tue, 31 Jul 2012 07:31:48 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201207310731.q6V7VmnE000531@svn.freebsd.org> From: Monthadar Al Jaberi Date: Tue, 31 Jul 2012 07:31:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238939 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 07:31:48 -0000 Author: monthadar Date: Tue Jul 31 07:31:47 2012 New Revision: 238939 URL: http://svn.freebsd.org/changeset/base/238939 Log: Fix bugs in net80211s found with wtap simulator. For description of the test scripts refer to projects/net80211_testsuite/wtap. * Test 007 showed a bug in intermediate PREP for a proxy entry. Resolved; * Test 002 showed a bug in the Addressing Mode flag for a PREQ. Resolved; Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c ============================================================================== --- head/sys/net80211/ieee80211_hwmp.c Tue Jul 31 07:22:50 2012 (r238938) +++ head/sys/net80211/ieee80211_hwmp.c Tue Jul 31 07:31:47 2012 (r238939) @@ -840,7 +840,7 @@ hwmp_rootmode_cb(void *arg) IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, vap->iv_bss, "%s", "send broadcast PREQ"); - preq.preq_flags = IEEE80211_MESHPREQ_FLAGS_AM; + preq.preq_flags = 0; if (ms->ms_flags & IEEE80211_MESHFLAGS_GATE) preq.preq_flags |= IEEE80211_MESHPREQ_FLAGS_GATE; if (hs->hs_rootmode == IEEE80211_HWMP_ROOTMODE_PROACTIVE) @@ -951,7 +951,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, hrtarg = IEEE80211_MESH_ROUTE_PRIV(rttarg, struct ieee80211_hwmp_route); /* Address mode: ucast */ - if((preq->preq_flags & IEEE80211_MESHPREQ_FLAGS_AM) == 0 && + if(preq->preq_flags & IEEE80211_MESHPREQ_FLAGS_AM && rttarg == NULL && !IEEE80211_ADDR_EQ(vap->iv_myaddr, PREQ_TADDR(0))) { IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_HWMP, @@ -1029,6 +1029,8 @@ hwmp_recv_preq(struct ieee80211vap *vap, hs->hs_seq = HWMP_SEQ_MAX(hs->hs_seq, PREQ_TSEQ(0)) + 1; prep.prep_flags = 0; + prep.prep_hopcount = 0; + IEEE80211_ADDR_COPY(prep.prep_targetaddr, vap->iv_myaddr); if (rttarg != NULL && /* if NULL it means we are the target */ rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY) { IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, @@ -1038,13 +1040,13 @@ hwmp_recv_preq(struct ieee80211vap *vap, rttarg->rt_dest); /* update proxy seqno to HWMP seqno */ rttarg->rt_ext_seq = hs->hs_seq; + prep.prep_hopcount = rttarg->rt_nhops; + IEEE80211_ADDR_COPY(prep.prep_targetaddr, rttarg->rt_mesh_gate); } /* * Build and send a PREP frame. */ - prep.prep_hopcount = 0; prep.prep_ttl = ms->ms_ttl; - IEEE80211_ADDR_COPY(prep.prep_targetaddr, vap->iv_myaddr); prep.prep_targetseq = hs->hs_seq; prep.prep_lifetime = preq->preq_lifetime; prep.prep_metric = IEEE80211_MESHLMETRIC_INITIALVAL; From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 07:36:28 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 09501106564A; Tue, 31 Jul 2012 07:36:28 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E88008FC08; Tue, 31 Jul 2012 07:36:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6V7aRPw000940; Tue, 31 Jul 2012 07:36:27 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6V7aRVU000938; Tue, 31 Jul 2012 07:36:27 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201207310736.q6V7aRVU000938@svn.freebsd.org> From: Monthadar Al Jaberi Date: Tue, 31 Jul 2012 07:36:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238940 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 07:36:28 -0000 Author: monthadar Date: Tue Jul 31 07:36:27 2012 New Revision: 238940 URL: http://svn.freebsd.org/changeset/base/238940 Log: Fix a PREQ comparison error in 11s HWMP. * Earlier we compared two not equal metrics, one was what we recevied in the 'new PREQ' while the other was what we already have saved which was 'old PREQ' + link metric for the last hop; * Fixed by adding 'new PREQ' + link metric for the last hop in a temporary variable; Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c ============================================================================== --- head/sys/net80211/ieee80211_hwmp.c Tue Jul 31 07:31:47 2012 (r238939) +++ head/sys/net80211/ieee80211_hwmp.c Tue Jul 31 07:36:27 2012 (r238940) @@ -912,6 +912,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, struct ieee80211_hwmp_state *hs = vap->iv_hwmp; struct ieee80211_meshprep_ie prep; ieee80211_hwmp_seq preqid; /* last seen preqid for orig */ + uint32_t metric = 0; if (ni == vap->iv_bss || ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED) @@ -985,13 +986,13 @@ hwmp_recv_preq(struct ieee80211vap *vap, /* Data creation and update of forwarding information * according to Table 11C-8 for originator mesh STA. */ + metric = preq->preq_metric + ms->ms_pmetric->mpm_metric(ni); if (HWMP_SEQ_GT(preq->preq_origseq, hrorig->hr_seq) || (HWMP_SEQ_EQ(preq->preq_origseq, hrorig->hr_seq) && - preq->preq_metric < rtorig->rt_metric)) { + metric < rtorig->rt_metric)) { hrorig->hr_seq = preq->preq_origseq; IEEE80211_ADDR_COPY(rtorig->rt_nexthop, wh->i_addr2); - rtorig->rt_metric = preq->preq_metric + - ms->ms_pmetric->mpm_metric(ni); + rtorig->rt_metric = metric; rtorig->rt_nhops = preq->preq_hopcount + 1; ieee80211_mesh_rt_update(rtorig, preq->preq_lifetime); /* path to orig is valid now */ From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 08:04:49 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B026D106564A; Tue, 31 Jul 2012 08:04:49 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B38B8FC14; Tue, 31 Jul 2012 08:04:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6V84nV5003604; Tue, 31 Jul 2012 08:04:49 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6V84nxJ003602; Tue, 31 Jul 2012 08:04:49 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201207310804.q6V84nxJ003602@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 31 Jul 2012 08:04:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238941 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 08:04:49 -0000 Author: luigi Date: Tue Jul 31 08:04:49 2012 New Revision: 238941 URL: http://svn.freebsd.org/changeset/base/238941 Log: nobody uses this file except the userspace ipfw code, but the cast of a pointer to an integer needs a cast to prevent a warning for size mismatch. MFC after: 1 week Modified: head/sys/netinet/in_cksum.c Modified: head/sys/netinet/in_cksum.c ============================================================================== --- head/sys/netinet/in_cksum.c Tue Jul 31 07:36:27 2012 (r238940) +++ head/sys/netinet/in_cksum.c Tue Jul 31 08:04:49 2012 (r238941) @@ -88,7 +88,7 @@ in_cksum(struct mbuf *m, int len) /* * Force to even boundary. */ - if ((1 & (int) w) && (mlen > 0)) { + if ((1 & (uintptr_t) w) && (mlen > 0)) { REDUCE; sum <<= 8; s_util.c[0] = *(u_char *)w; From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 08:05:41 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66F3E1065675; Tue, 31 Jul 2012 08:05:41 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 298048FC19; Tue, 31 Jul 2012 08:05:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6V85fib003699; Tue, 31 Jul 2012 08:05:41 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6V85eaD003697; Tue, 31 Jul 2012 08:05:40 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201207310805.q6V85eaD003697@svn.freebsd.org> From: Monthadar Al Jaberi Date: Tue, 31 Jul 2012 08:05:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238942 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 08:05:41 -0000 Author: monthadar Date: Tue Jul 31 08:05:40 2012 New Revision: 238942 URL: http://svn.freebsd.org/changeset/base/238942 Log: Fixed some debug output in hwmp_recv_prep. Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c ============================================================================== --- head/sys/net80211/ieee80211_hwmp.c Tue Jul 31 08:04:49 2012 (r238941) +++ head/sys/net80211/ieee80211_hwmp.c Tue Jul 31 08:05:40 2012 (r238942) @@ -1289,7 +1289,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, "discard PREP from %6D, new metric %u > %u", prep->prep_targetaddr, ":", - prep->prep_metric, rt->rt_metric); + metric, rt->rt_metric); return; } } @@ -1299,7 +1299,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID ? "prefer" : "update", prep->prep_targetaddr, ":", - rt->rt_nhops, prep->prep_hopcount, + rt->rt_nhops, prep->prep_hopcount + 1, rt->rt_metric, metric); hr->hr_seq = prep->prep_targetseq; @@ -1371,7 +1371,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, rtext->rt_flags & IEEE80211_MESHRT_FLAGS_VALID ? "prefer" : "update", prep->prep_target_ext_addr, ":", - rtext->rt_nhops, prep->prep_hopcount, + rtext->rt_nhops, prep->prep_hopcount + 1, rtext->rt_metric, metric); rtext->rt_flags = IEEE80211_MESHRT_FLAGS_PROXY | From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 08:19:52 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 814EF106566B; Tue, 31 Jul 2012 08:19:52 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-gh0-f182.google.com (mail-gh0-f182.google.com [209.85.160.182]) by mx1.freebsd.org (Postfix) with ESMTP id F1ECA8FC0C; Tue, 31 Jul 2012 08:19:51 +0000 (UTC) Received: by ghbz22 with SMTP id z22so6673498ghb.13 for ; Tue, 31 Jul 2012 01:19:51 -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 :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=rUjrUYxB7Z5DpozmIrf2pc+DYf5VUxzliEiThkoN6N8=; b=eDDq/xOl7L5EWZr/ziQdhDvgdcqBaNkz91yLGbGLtvGme4xhgGlKiLmqmtvc3K2jFu 9e4RTVrkI/Ypi4PHBY2RU7IkasSPnjU7UOtkA22PfTiW6PXXiOPgaiZQ3aNHM3pLLq1+ XFvYgqvrymB34BmukAJeyBuAsW09X7WFP/Oobsk1mU5SmNiBjcuh1Z7a53f22rHya3yi BM9TGKyayjM/x+aCXgah61s6vVNysP4ik3eADPkQ+/kXoxI2JC/XTeDzZaM/z5RuWeHC lrVYU9QkHQhBNqyR80rTZt+BvLMiw+1yTkhrPSj8/PTpku6gzfeOvZzxKPQAwZVG+/+C Co3w== MIME-Version: 1.0 Received: by 10.66.88.39 with SMTP id bd7mr30535769pab.50.1343722790841; Tue, 31 Jul 2012 01:19:50 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.68.66.136 with HTTP; Tue, 31 Jul 2012 01:19:50 -0700 (PDT) In-Reply-To: <201207310805.q6V85eaD003697@svn.freebsd.org> References: <201207310805.q6V85eaD003697@svn.freebsd.org> Date: Tue, 31 Jul 2012 01:19:50 -0700 X-Google-Sender-Auth: ySLeOZ_zGcn82W2zhuKgMge4wyE Message-ID: From: Adrian Chadd To: Monthadar Al Jaberi Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r238942 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 08:19:52 -0000 .. these are all approved-by: me. :-) Adrian On 31 July 2012 01:05, Monthadar Al Jaberi wrote: > Author: monthadar > Date: Tue Jul 31 08:05:40 2012 > New Revision: 238942 > URL: http://svn.freebsd.org/changeset/base/238942 > > Log: > Fixed some debug output in hwmp_recv_prep. > > Modified: > head/sys/net80211/ieee80211_hwmp.c > > Modified: head/sys/net80211/ieee80211_hwmp.c > ============================================================================== > --- head/sys/net80211/ieee80211_hwmp.c Tue Jul 31 08:04:49 2012 (r238941) > +++ head/sys/net80211/ieee80211_hwmp.c Tue Jul 31 08:05:40 2012 (r238942) > @@ -1289,7 +1289,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, > IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, > "discard PREP from %6D, new metric %u > %u", > prep->prep_targetaddr, ":", > - prep->prep_metric, rt->rt_metric); > + metric, rt->rt_metric); > return; > } > } > @@ -1299,7 +1299,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, > rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID ? > "prefer" : "update", > prep->prep_targetaddr, ":", > - rt->rt_nhops, prep->prep_hopcount, > + rt->rt_nhops, prep->prep_hopcount + 1, > rt->rt_metric, metric); > > hr->hr_seq = prep->prep_targetseq; > @@ -1371,7 +1371,7 @@ hwmp_recv_prep(struct ieee80211vap *vap, > rtext->rt_flags & IEEE80211_MESHRT_FLAGS_VALID ? > "prefer" : "update", > prep->prep_target_ext_addr, ":", > - rtext->rt_nhops, prep->prep_hopcount, > + rtext->rt_nhops, prep->prep_hopcount + 1, > rtext->rt_metric, metric); > > rtext->rt_flags = IEEE80211_MESHRT_FLAGS_PROXY | From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 08:21:25 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AE512106566B; Tue, 31 Jul 2012 08:21:25 +0000 (UTC) (envelope-from listlog2011@gmail.com) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 8F2D58FC0A; Tue, 31 Jul 2012 08:21:25 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q6V8LMCv081509; Tue, 31 Jul 2012 08:21:23 GMT (envelope-from listlog2011@gmail.com) Message-ID: <50179581.9070805@gmail.com> Date: Tue, 31 Jul 2012 16:21:21 +0800 From: David Xu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Giovanni Trematerra References: <201207310548.q6V5mZHf091624@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, Konstantin Belousov , David Xu , svn-src-head@freebsd.org, bde@freebsd.org Subject: Re: svn commit: r238936 - in head/sys: fs/fifofs kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: davidxu@freebsd.org List-Id: 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, 31 Jul 2012 08:21:25 -0000 On 2012/7/31 15:22, Giovanni Trematerra wrote: > On Tue, Jul 31, 2012 at 7:48 AM, David Xu wrote: >> Author: davidxu >> Date: Tue Jul 31 05:48:35 2012 >> New Revision: 238936 >> URL: http://svn.freebsd.org/changeset/base/238936 >> >> Log: >> I am comparing current pipe code with the one in 8.3-STABLE r236165, >> I found 8.3 is a history BSD version using socket to implement FIFO >> pipe, it uses per-file seqcount to compare with writer generation >> stored in per-pipe object. The concept is after all writers are gone, >> the pipe enters next generation, all old readers have not closed the >> pipe should get the indication that the pipe is disconnected, result >> is they should get EPIPE, SIGPIPE or get POLLHUP in poll(). >> But newcomer should not know that previous writters were gone, it >> should treat it as a fresh session. >> I am trying to bring back FIFO pipe to history behavior. It is still >> unclear that if single EOF flag can represent SBS_CANTSENDMORE and >> SBS_CANTRCVMORE which socket-based version is using, but I have run >> the poll regression test in tool directory, output is same as the one >> on 8.3-STABLE now. >> I think the output "not ok 18 FIFO state 6b: poll result 0 expected 1. >> expected POLLHUP; got 0" might be bogus, because newcomer should not >> know that old writers were gone. I got the same behavior on Linux. >> Our implementation always return POLLIN for disconnected pipe even it >> should return POLLHUP, but I think it is not wise to remove POLLIN for >> compatible reason, this is our history behavior. >> > I'm sorry but I'm failing to understand the reason for this change. > Can you point me out a test that confirm that the change is needed. > The only thing I see is an increase in the memory footprint for the pipes. > There was a lot of discussions on this topic on -arch mailing list > > http://lists.freebsd.org/pipermail/freebsd-arch/2012-January/012131.html > http://lists.freebsd.org/pipermail/freebsd-arch/2012-February/012314.html > > Thank you > > -- > Gianni > The old code broke some history semantic of FIFO pipe, you can try the test tool /usr/src/tools/regression/poll/pipepoll, try it before and after my commit, also compare the result with 8.3-STABLE, without this commit, both sub-tests 6c and 6d failed. I think old code did not mimic original code correctly, in 8.3-STABLE code, seqcount is stored in each file, writer generation detection is based on each copy of seqcount, but your code stored single copy of seqcount in fifoinfo object which is store as vnode data, and made the writer generation flag global by setting PIPE_SAMEWGEN in pipe object and used this flag to determine if it should return POLLHUP/POLLIN or not, this is wrong, for example: when there is no writer but have old readers, new incoming reader will executes: line 174 and 175: fip->fi_seqcount = fip->fi_wgen - fip->fi_writers; FIFO_WPDWGEN(fip, fpipe); this causes fi_seqcount to be equal to fi_wgen because fi_writer is zero, and FIFO_WPDWGEN() turns on flag PIPE_SAMEWGEN. When PIPE_SAMEWGEN is on, pipe_poll() ignores EOF, this breaks old readers, it causes old reader to get nothing while it should get POLLHUP from poll(). The new incoming reader should get nothing, so I think sub-tests 6b is wrong. From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 10:58:51 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56152106564A; Tue, 31 Jul 2012 10:58:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 40D5D8FC16; Tue, 31 Jul 2012 10:58:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6VAwp30019780; Tue, 31 Jul 2012 10:58:51 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6VAwp18019777; Tue, 31 Jul 2012 10:58:51 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201207311058.q6VAwp18019777@svn.freebsd.org> From: Alexander Motin Date: Tue, 31 Jul 2012 10:58:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238943 - head/sys/dev/acpica X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 10:58:51 -0000 Author: mav Date: Tue Jul 31 10:58:50 2012 New Revision: 238943 URL: http://svn.freebsd.org/changeset/base/238943 Log: Add several performance optimizations to acpi_cpu_idle(). For C1 and C2 states use cpu_ticks() to measure sleep time instead of much slower ACPI timer. We can't do it for C3, as TSC may stop there. But it is less important there as wake up latency is high any way. For C1 and C2 states do not check/clear bus mastering activity status, as it is important only for C3. As side effect it can make CPU enter C2 instead of C3 if last BM activity was two sleeps back (unlike one before), but that may be even good because of collecting more statistics. Premature BM wakeup from C3, entered because of overestimation, can easily be worse then entering C2 from both performance and power consumption points of view. Together on dual Xeon E5645 system on sequential 512 bytes read test this change makes cpu_idle_acpi() as fast as simplest cpu_idle_hlt() and only few percents slower then cpu_idle_mwait(), while deeper states are still actively used during idle periods. To help with diagnostics, add C-state type into dev.cpu.X.cx_supported. Sponsored by: iXsystems, Inc. Modified: head/sys/dev/acpica/acpi_cpu.c Modified: head/sys/dev/acpica/acpi_cpu.c ============================================================================== --- head/sys/dev/acpica/acpi_cpu.c Tue Jul 31 08:05:40 2012 (r238942) +++ head/sys/dev/acpica/acpi_cpu.c Tue Jul 31 10:58:50 2012 (r238943) @@ -876,7 +876,8 @@ acpi_cpu_cx_list(struct acpi_cpu_softc * sbuf_new(&sb, sc->cpu_cx_supported, sizeof(sc->cpu_cx_supported), SBUF_FIXEDLEN); for (i = 0; i < sc->cpu_cx_count; i++) - sbuf_printf(&sb, "C%d/%d ", i + 1, sc->cpu_cx_states[i].trans_lat); + sbuf_printf(&sb, "C%d/%d/%d ", i + 1, sc->cpu_cx_states[i].type, + sc->cpu_cx_states[i].trans_lat); sbuf_trim(&sb); sbuf_finish(&sb); } @@ -921,6 +922,7 @@ acpi_cpu_idle() { struct acpi_cpu_softc *sc; struct acpi_cx *cx_next; + uint64_t cputicks; uint32_t start_time, end_time; int bm_active, cx_next_idx, i; @@ -960,11 +962,12 @@ acpi_cpu_idle() * driver polling for new devices keeps this bit set all the * time if USB is loaded. */ - if ((cpu_quirks & CPU_QUIRK_NO_BM_CTRL) == 0) { + if ((cpu_quirks & CPU_QUIRK_NO_BM_CTRL) == 0 && + cx_next_idx > sc->cpu_non_c3) { AcpiReadBitRegister(ACPI_BITREG_BUS_MASTER_STATUS, &bm_active); if (bm_active != 0) { AcpiWriteBitRegister(ACPI_BITREG_BUS_MASTER_STATUS, 1); - cx_next_idx = min(cx_next_idx, sc->cpu_non_c3); + cx_next_idx = sc->cpu_non_c3; } } @@ -980,11 +983,10 @@ acpi_cpu_idle() * we are called inside critical section, delaying context switch. */ if (cx_next->type == ACPI_STATE_C1) { - AcpiHwRead(&start_time, &AcpiGbl_FADT.XPmTimerBlock); + cputicks = cpu_ticks(); acpi_cpu_c1(); - AcpiHwRead(&end_time, &AcpiGbl_FADT.XPmTimerBlock); - end_time = PM_USEC(acpi_TimerDelta(end_time, start_time)); - if (curthread->td_critnest == 0) + end_time = ((cpu_ticks() - cputicks) << 20) / cpu_tickrate(); + if (curthread->td_critnest == 0) end_time = min(end_time, 500000 / hz); sc->cpu_prev_sleep = (sc->cpu_prev_sleep * 3 + end_time) / 4; return; @@ -1008,7 +1010,13 @@ acpi_cpu_idle() * get the time very close to the CPU start/stop clock logic, this * is the only reliable time source. */ - AcpiHwRead(&start_time, &AcpiGbl_FADT.XPmTimerBlock); + if (cx_next->type == ACPI_STATE_C3) { + AcpiHwRead(&start_time, &AcpiGbl_FADT.XPmTimerBlock); + cputicks = 0; + } else { + start_time = 0; + cputicks = cpu_ticks(); + } CPU_GET_REG(cx_next->p_lvlx, 1); /* @@ -1018,7 +1026,11 @@ acpi_cpu_idle() * margin that we are certain to have a correct value. */ AcpiHwRead(&end_time, &AcpiGbl_FADT.XPmTimerBlock); - AcpiHwRead(&end_time, &AcpiGbl_FADT.XPmTimerBlock); + if (cx_next->type == ACPI_STATE_C3) { + AcpiHwRead(&end_time, &AcpiGbl_FADT.XPmTimerBlock); + end_time = acpi_TimerDelta(end_time, start_time); + } else + end_time = ((cpu_ticks() - cputicks) << 20) / cpu_tickrate(); /* Enable bus master arbitration and disable bus master wakeup. */ if (cx_next->type == ACPI_STATE_C3 && @@ -1028,8 +1040,6 @@ acpi_cpu_idle() } ACPI_ENABLE_IRQS(); - /* Find the actual time asleep in microseconds. */ - end_time = acpi_TimerDelta(end_time, start_time); sc->cpu_prev_sleep = (sc->cpu_prev_sleep * 3 + PM_USEC(end_time)) / 4; } From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 11:31:12 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1D4F106564A; Tue, 31 Jul 2012 11:31:12 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AA96F8FC0A; Tue, 31 Jul 2012 11:31:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6VBVCig022461; Tue, 31 Jul 2012 11:31:12 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6VBVCRW022455; Tue, 31 Jul 2012 11:31:12 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201207311131.q6VBVCRW022455@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 31 Jul 2012 11:31:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238945 - in head/sys: net netinet netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 11:31:12 -0000 Author: glebius Date: Tue Jul 31 11:31:12 2012 New Revision: 238945 URL: http://svn.freebsd.org/changeset/base/238945 Log: Some style(9) and whitespace changes. Together with: Andrey Zonov Modified: head/sys/net/if_llatbl.c head/sys/net/if_llatbl.h head/sys/netinet/if_ether.c head/sys/netinet/in.c head/sys/netinet6/in6.c Modified: head/sys/net/if_llatbl.c ============================================================================== --- head/sys/net/if_llatbl.c Tue Jul 31 11:16:19 2012 (r238944) +++ head/sys/net/if_llatbl.c Tue Jul 31 11:31:12 2012 (r238945) @@ -118,8 +118,8 @@ llentry_free(struct llentry *lle) pkts_dropped++; } - KASSERT(lle->la_numheld == 0, - ("%s: la_numheld %d > 0, pkts_droped %zd", __func__, + KASSERT(lle->la_numheld == 0, + ("%s: la_numheld %d > 0, pkts_droped %zd", __func__, lle->la_numheld, pkts_dropped)); lle->la_flags &= ~LLE_VALID; @@ -144,7 +144,7 @@ llentry_update(struct llentry **llep, st la = lla_lookup(lt, LLE_EXCLUSIVE, (struct sockaddr *)dst); IF_AFDATA_RUNLOCK(ifp); - if ((la == NULL) && + if ((la == NULL) && (ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) == 0) { IF_AFDATA_WLOCK(ifp); la = lla_lookup(lt, @@ -182,7 +182,7 @@ lltable_free(struct lltable *llt) SLIST_REMOVE(&V_lltables, llt, lltable, llt_link); LLTABLE_WUNLOCK(); - for (i=0; i < LLTBL_HASHTBL_SIZE; i++) { + for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) { LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) { int canceled; @@ -227,7 +227,7 @@ lltable_drain(int af) void lltable_prefix_free(int af, struct sockaddr *prefix, struct sockaddr *mask, - u_int flags) + u_int flags) { struct lltable *llt; @@ -297,7 +297,7 @@ lla_rt_output(struct rt_msghdr *rtm, str if (rtm->rtm_flags & RTF_ANNOUNCE) { flags |= LLE_PUB; #ifdef INET - if (dst->sa_family == AF_INET && + if (dst->sa_family == AF_INET && ((struct sockaddr_inarp *)dst)->sin_other != 0) { struct rtentry *rt; ((struct sockaddr_inarp *)dst)->sin_other = 0; @@ -378,7 +378,7 @@ lla_rt_output(struct rt_msghdr *rtm, str #ifdef INET /* gratuitous ARP */ if ((laflags & LLE_PUB) && dst->sa_family == AF_INET) { - arprequest(ifp, + arprequest(ifp, &((struct sockaddr_in *)dst)->sin_addr, &((struct sockaddr_in *)dst)->sin_addr, ((laflags & LLE_PROXY) ? Modified: head/sys/net/if_llatbl.h ============================================================================== --- head/sys/net/if_llatbl.h Tue Jul 31 11:16:19 2012 (r238944) +++ head/sys/net/if_llatbl.h Tue Jul 31 11:31:12 2012 (r238945) @@ -61,17 +61,17 @@ struct llentry { struct llentries *lle_head; void (*lle_free)(struct lltable *, struct llentry *); struct mbuf *la_hold; - int la_numheld; /* # of packets currently held */ + int la_numheld; /* # of packets currently held */ time_t la_expire; - uint16_t la_flags; + uint16_t la_flags; uint16_t la_asked; uint16_t la_preempt; uint16_t ln_byhint; int16_t ln_state; /* IPv6 has ND6_LLINFO_NOSTATE == -2 */ - uint16_t ln_router; + uint16_t ln_router; time_t ln_ntick; int lle_refcnt; - + union { uint64_t mac_aligned; uint16_t mac16[3]; @@ -106,6 +106,7 @@ struct llentry { ("negative refcnt %d", (lle)->lle_refcnt)); \ (lle)->lle_refcnt++; \ } while (0) + #define LLE_REMREF(lle) do { \ LLE_WLOCK_ASSERT(lle); \ KASSERT((lle)->lle_refcnt > 1, \ @@ -158,7 +159,7 @@ struct lltable { struct llentry * (*llt_lookup)(struct lltable *, u_int flags, const struct sockaddr *l3addr); int (*llt_dump)(struct lltable *, - struct sysctl_req *); + struct sysctl_req *); }; MALLOC_DECLARE(M_LLTABLE); @@ -171,17 +172,17 @@ MALLOC_DECLARE(M_LLTABLE); #define LLE_VALID 0x0008 /* ll_addr is valid */ #define LLE_PROXY 0x0010 /* proxy entry ??? */ #define LLE_PUB 0x0020 /* publish entry ??? */ +#define LLE_EXCLUSIVE 0x2000 /* return lle xlocked */ #define LLE_DELETE 0x4000 /* delete on a lookup - match LLE_IFADDR */ #define LLE_CREATE 0x8000 /* create on a lookup miss */ -#define LLE_EXCLUSIVE 0x2000 /* return lle xlocked */ #define LLATBL_HASH(key, mask) \ (((((((key >> 8) ^ key) >> 8) ^ key) >> 8) ^ key) & mask) struct lltable *lltable_init(struct ifnet *, int); void lltable_free(struct lltable *); -void lltable_prefix_free(int, struct sockaddr *, - struct sockaddr *, u_int); +void lltable_prefix_free(int, struct sockaddr *, + struct sockaddr *, u_int); #if 0 void lltable_drain(int); #endif @@ -189,7 +190,7 @@ int lltable_sysctl_dumparp(int, struct size_t llentry_free(struct llentry *); int llentry_update(struct llentry **, struct lltable *, - struct sockaddr_storage *, struct ifnet *); + struct sockaddr_storage *, struct ifnet *); /* * Generic link layer address lookup function. Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Tue Jul 31 11:16:19 2012 (r238944) +++ head/sys/netinet/if_ether.c Tue Jul 31 11:31:12 2012 (r238945) @@ -87,8 +87,8 @@ static VNET_DEFINE(int, arp_maxtries) = VNET_DEFINE(int, useloopback) = 1; /* use loopback interface for * local traffic */ static VNET_DEFINE(int, arp_proxyall) = 0; -static VNET_DEFINE(int, arpt_down) = 20; /* keep incomplete entries for - * 20 seconds */ +static VNET_DEFINE(int, arpt_down) = 20; /* keep incomplete entries for + * 20 seconds */ VNET_DEFINE(struct arpstat, arpstat); /* ARP statistics, see if_arp.h */ static VNET_DEFINE(int, arp_maxhold) = 1; @@ -119,7 +119,7 @@ SYSCTL_VNET_STRUCT(_net_link_ether_arp, &VNET_NAME(arpstat), arpstat, "ARP statistics (struct arpstat, net/if_arp.h)"); SYSCTL_VNET_INT(_net_link_ether_inet, OID_AUTO, maxhold, CTLFLAG_RW, - &VNET_NAME(arp_maxhold), 0, + &VNET_NAME(arp_maxhold), 0, "Number of packets to hold per ARP entry"); static void arp_init(void); @@ -197,7 +197,7 @@ arptimer(void *arg) } else { #ifdef DIAGNOSTIC struct sockaddr *l3addr = L3_ADDR(lle); - log(LOG_INFO, + log(LOG_INFO, "arptimer issue: %p, IPv4 address: \"%s\"\n", lle, inet_ntoa( ((const struct sockaddr_in *)l3addr)->sin_addr)); @@ -250,7 +250,7 @@ arprequest(struct ifnet *ifp, struct in_ break; /* found it. */ } IF_ADDR_RUNLOCK(ifp); - if (sip == NULL) { + if (sip == NULL) { printf("%s: cannot find matching address\n", __func__); return; } @@ -339,7 +339,7 @@ retry: inet_ntoa(SIN(dst)->sin_addr)); m_freem(m); return (EINVAL); - } + } if ((la->la_flags & LLE_VALID) && ((la->la_flags & LLE_STATIC) || la->la_expire > time_uptime)) { @@ -358,8 +358,8 @@ retry: *lle = la; error = 0; goto done; - } - + } + if (la->la_flags & LLE_STATIC) { /* should not happen! */ log(LOG_DEBUG, "arpresolve: ouch, empty static llinfo for %s\n", inet_ntoa(SIN(dst)->sin_addr)); @@ -389,13 +389,13 @@ retry: la->la_numheld--; ARPSTAT_INC(dropped); } - } + } if (la->la_hold != NULL) { curr = la->la_hold; while (curr->m_nextpkt != NULL) curr = curr->m_nextpkt; curr->m_nextpkt = m; - } else + } else la->la_hold = m; la->la_numheld++; if (renew == 0 && (flags & LLE_EXCLUSIVE)) { @@ -510,11 +510,11 @@ SYSCTL_INT(_net_link_ether_inet, OID_AUT &log_arp_wrong_iface, 0, "log arp packets arriving on the wrong interface"); SYSCTL_INT(_net_link_ether_inet, OID_AUTO, log_arp_movements, CTLFLAG_RW, - &log_arp_movements, 0, - "log arp replies from MACs different than the one in the cache"); + &log_arp_movements, 0, + "log arp replies from MACs different than the one in the cache"); SYSCTL_INT(_net_link_ether_inet, OID_AUTO, log_arp_permanent_modify, CTLFLAG_RW, - &log_arp_permanent_modify, 0, - "log arp replies from MACs different than the one in the permanent arp entry"); + &log_arp_permanent_modify, 0, + "log arp replies from MACs different than the one in the permanent arp entry"); static void @@ -550,7 +550,7 @@ in_arpinput(struct mbuf *m) } ah = mtod(m, struct arphdr *); - /* + /* * ARP is only for IPv4 so we can reject packets with * a protocol length not equal to an IPv4 address. */ @@ -686,7 +686,7 @@ match: sin.sin_addr = isaddr; flags = (itaddr.s_addr == myaddr.s_addr) ? LLE_CREATE : 0; flags |= LLE_EXCLUSIVE; - IF_AFDATA_LOCK(ifp); + IF_AFDATA_LOCK(ifp); la = lla_lookup(LLTABLE(ifp), flags, (struct sockaddr *)&sin); IF_AFDATA_UNLOCK(ifp); if (la != NULL) { @@ -716,7 +716,7 @@ match: goto reply; } if (log_arp_movements) { - log(LOG_INFO, "arp: %s moved from %*D " + log(LOG_INFO, "arp: %s moved from %*D " "to %*D on %s\n", inet_ntoa(isaddr), ifp->if_addrlen, @@ -725,7 +725,7 @@ match: ifp->if_xname); } } - + if (ifp->if_addrlen != ah->ar_hln) { LLE_WUNLOCK(la); log(LOG_WARNING, "arp from %*D: addr len: new %d, " @@ -751,7 +751,7 @@ match: } la->la_asked = 0; la->la_preempt = V_arp_maxtries; - /* + /* * The packets are all freed within the call to the output * routine. * @@ -787,7 +787,7 @@ reply: struct llentry *lle = NULL; sin.sin_addr = itaddr; - IF_AFDATA_LOCK(ifp); + IF_AFDATA_LOCK(ifp); lle = lla_lookup(LLTABLE(ifp), 0, (struct sockaddr *)&sin); IF_AFDATA_UNLOCK(ifp); @@ -846,8 +846,7 @@ reply: RTFREE_LOCKED(rt); #ifdef DEBUG_PROXY - printf("arp: proxying for %s\n", - inet_ntoa(itaddr)); + printf("arp: proxying for %s\n", inet_ntoa(itaddr)); #endif } } @@ -869,8 +868,8 @@ reply: (void)memcpy(ar_spa(ah), &itaddr, ah->ar_pln); ah->ar_op = htons(ARPOP_REPLY); ah->ar_pro = htons(ETHERTYPE_IP); /* let's be sure! */ - m->m_len = sizeof(*ah) + (2 * ah->ar_pln) + (2 * ah->ar_hln); - m->m_pkthdr.len = m->m_len; + m->m_len = sizeof(*ah) + (2 * ah->ar_pln) + (2 * ah->ar_hln); + m->m_pkthdr.len = m->m_len; m->m_pkthdr.rcvif = NULL; sa.sa_family = AF_ARP; sa.sa_len = 2; @@ -894,7 +893,7 @@ arp_ifinit(struct ifnet *ifp, struct ifa if (ntohl(IA_SIN(ifa)->sin_addr.s_addr) != INADDR_ANY) { arprequest(ifp, &IA_SIN(ifa)->sin_addr, &IA_SIN(ifa)->sin_addr, IF_LLADDR(ifp)); - /* + /* * interface address is considered static entry * because the output of the arp utility shows * that L2 entry as permanent Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Tue Jul 31 11:16:19 2012 (r238944) +++ head/sys/netinet/in.c Tue Jul 31 11:31:12 2012 (r238945) @@ -489,20 +489,20 @@ in_control(struct socket *so, u_long cmd ia->ia_addr.sin_addr.s_addr) hostIsNew = 0; if (ifra->ifra_mask.sin_len) { - /* + /* * QL: XXX * Need to scrub the prefix here in case * the issued command is SIOCAIFADDR with * the same address, but with a different * prefix length. And if the prefix length - * is the same as before, then the call is + * is the same as before, then the call is * un-necessarily executed here. */ in_ifscrub(ifp, ia, LLE_STATIC); ia->ia_sockmask = ifra->ifra_mask; ia->ia_sockmask.sin_family = AF_INET; ia->ia_subnetmask = - ntohl(ia->ia_sockmask.sin_addr.s_addr); + ntohl(ia->ia_sockmask.sin_addr.s_addr); maskIsNew = 1; } if ((ifp->if_flags & IFF_POINTOPOINT) && @@ -886,8 +886,8 @@ in_ifinit(struct ifnet *ifp, struct in_i RT_ADDREF(ia_ro.ro_rt); RTFREE_LOCKED(ia_ro.ro_rt); } else - error = ifa_add_loopback_route((struct ifaddr *)ia, - (struct sockaddr *)&ia->ia_addr); + error = ifa_add_loopback_route((struct ifaddr *)ia, + (struct sockaddr *)&ia->ia_addr); if (error == 0) ia->ia_flags |= IFA_RTSELF; if (ia_ro.ro_rt != NULL) @@ -902,10 +902,10 @@ in_ifinit(struct ifnet *ifp, struct in_i ? RTF_HOST : 0) /* - * Generate a routing message when inserting or deleting + * Generate a routing message when inserting or deleting * an interface address alias. */ -static void in_addralias_rtmsg(int cmd, struct in_addr *prefix, +static void in_addralias_rtmsg(int cmd, struct in_addr *prefix, struct in_ifaddr *target) { struct route pfx_ro; @@ -928,16 +928,13 @@ static void in_addralias_rtmsg(int cmd, /* QL: XXX * Point the gateway to the new interface - * address as if a new prefix route entry has - * been added through the new address alias. - * All other parts of the rtentry is accurate, + * address as if a new prefix route entry has + * been added through the new address alias. + * All other parts of the rtentry is accurate, * e.g., rt_key, rt_mask, rt_ifp etc. */ - msg_rt.rt_gateway = - (struct sockaddr *)&target->ia_addr; - rt_newaddrmsg(cmd, - (struct ifaddr *)target, - 0, &msg_rt); + msg_rt.rt_gateway = (struct sockaddr *)&target->ia_addr; + rt_newaddrmsg(cmd, (struct ifaddr *)target, 0, &msg_rt); RTFREE(pfx_ro.ro_rt); } return; @@ -985,7 +982,7 @@ in_addprefix(struct in_ifaddr *target, i */ if (ia->ia_flags & IFA_ROUTE) { #ifdef RADIX_MPATH - if (ia->ia_addr.sin_addr.s_addr == + if (ia->ia_addr.sin_addr.s_addr == target->ia_addr.sin_addr.s_addr) { IN_IFADDR_RUNLOCK(); return (EEXIST); @@ -1058,7 +1055,7 @@ in_scrubprefix(struct in_ifaddr *target, } if (freeit && (flags & LLE_STATIC)) { error = ifa_del_loopback_route((struct ifaddr *)target, - (struct sockaddr *)&target->ia_addr); + (struct sockaddr *)&target->ia_addr); if (error == 0) target->ia_flags &= ~IFA_RTSELF; } @@ -1141,8 +1138,8 @@ in_scrubprefix(struct in_ifaddr *target, mask0.sin_len = sizeof(mask0); mask0.sin_family = AF_INET; mask0.sin_addr.s_addr = target->ia_subnetmask; - lltable_prefix_free(AF_INET, (struct sockaddr *)&prefix0, - (struct sockaddr *)&mask0, flags); + lltable_prefix_free(AF_INET, (struct sockaddr *)&prefix0, + (struct sockaddr *)&mask0, flags); /* * As no-one seem to have this prefix, we can remove the route. @@ -1184,14 +1181,14 @@ in_broadcast(struct in_addr in, struct i * Check for old-style (host 0) broadcast, but * taking into account that RFC 3021 obsoletes it. */ - (ia->ia_subnetmask != IN_RFC3021_MASK && - t == ia->ia_subnet)) && + (ia->ia_subnetmask != IN_RFC3021_MASK && + t == ia->ia_subnet)) && /* * Check for an all one subnetmask. These * only exist when an interface gets a secondary * address. */ - ia->ia_subnetmask != (u_long)0xffffffff) + ia->ia_subnetmask != (u_long)0xffffffff) return (1); return (0); #undef ia @@ -1300,27 +1297,24 @@ in_lltable_new(const struct sockaddr *l3 (((ntohl((d)->sin_addr.s_addr) ^ (a)->sin_addr.s_addr) & (m)->sin_addr.s_addr)) == 0 ) static void -in_lltable_prefix_free(struct lltable *llt, - const struct sockaddr *prefix, - const struct sockaddr *mask, - u_int flags) +in_lltable_prefix_free(struct lltable *llt, const struct sockaddr *prefix, + const struct sockaddr *mask, u_int flags) { const struct sockaddr_in *pfx = (const struct sockaddr_in *)prefix; const struct sockaddr_in *msk = (const struct sockaddr_in *)mask; struct llentry *lle, *next; - register int i; + int i; size_t pkts_dropped; - for (i=0; i < LLTBL_HASHTBL_SIZE; i++) { + for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) { LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) { - - /* + /* * (flags & LLE_STATIC) means deleting all entries - * including static ARP entries + * including static ARP entries. */ - if (IN_ARE_MASKED_ADDR_EQUAL((struct sockaddr_in *)L3_ADDR(lle), - pfx, msk) && - ((flags & LLE_STATIC) || !(lle->la_flags & LLE_STATIC))) { + if (IN_ARE_MASKED_ADDR_EQUAL(satosin(L3_ADDR(lle)), + pfx, msk) && ((flags & LLE_STATIC) || + !(lle->la_flags & LLE_STATIC))) { int canceled; canceled = callout_drain(&lle->la_timer); @@ -1357,19 +1351,18 @@ in_lltable_rtcheck(struct ifnet *ifp, u_ */ if (rt->rt_flags & RTF_GATEWAY) { if (!(rt->rt_flags & RTF_HOST) || !rt->rt_ifp || - rt->rt_ifp->if_type != IFT_ETHER || - (rt->rt_ifp->if_flags & - (IFF_NOARP | IFF_STATICARP)) != 0 || - memcmp(rt->rt_gateway->sa_data, l3addr->sa_data, - sizeof(in_addr_t)) != 0) { + rt->rt_ifp->if_type != IFT_ETHER || + (rt->rt_ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) != 0 || + memcmp(rt->rt_gateway->sa_data, l3addr->sa_data, + sizeof(in_addr_t)) != 0) { RTFREE_LOCKED(rt); return (EINVAL); } } /* - * Make sure that at least the destination address is covered - * by the route. This is for handling the case where 2 or more + * Make sure that at least the destination address is covered + * by the route. This is for handling the case where 2 or more * interfaces have the same prefix. An incoming packet arrives * on one interface and the corresponding outgoing packet leaves * another interface. @@ -1429,7 +1422,7 @@ in_lltable_lookup(struct lltable *llt, u hashkey = sin->sin_addr.s_addr; lleh = &llt->lle_head[LLATBL_HASH(hashkey, LLTBL_HASHMASK)]; LIST_FOREACH(lle, lleh, lle_next) { - struct sockaddr_in *sa2 = (struct sockaddr_in *)L3_ADDR(lle); + struct sockaddr_in *sa2 = satosin(L3_ADDR(lle)); if (lle->la_flags & LLE_DELETED) continue; if (sa2->sin_addr.s_addr == sin->sin_addr.s_addr) Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Tue Jul 31 11:16:19 2012 (r238944) +++ head/sys/netinet6/in6.c Tue Jul 31 11:31:12 2012 (r238945) @@ -257,10 +257,10 @@ in6_mask2len(struct in6_addr *mask, u_ch #ifdef COMPAT_FREEBSD32 struct in6_ndifreq32 { - char ifname[IFNAMSIZ]; - uint32_t ifindex; + char ifname[IFNAMSIZ]; + uint32_t ifindex; }; -#define SIOCGDEFIFACE32_IN6 _IOWR('i', 86, struct in6_ndifreq32) +#define SIOCGDEFIFACE32_IN6 _IOWR('i', 86, struct in6_ndifreq32) #endif int @@ -485,7 +485,7 @@ in6_control(struct socket *so, u_long cm } if (td != NULL) { - error = priv_check(td, (cmd == SIOCDIFADDR_IN6) ? + error = priv_check(td, (cmd == SIOCDIFADDR_IN6) ? PRIV_NET_DELIFADDR : PRIV_NET_ADDIFADDR); if (error) goto out; @@ -1365,7 +1365,7 @@ in6_purgeaddr_mc(struct ifnet *ifp, stru bzero(&sin6, sizeof(sin6)); sin6.sin6_len = sizeof(sin6); sin6.sin6_family = AF_INET6; - memcpy(&sin6.sin6_addr, &satosin6(ifa0->ifa_addr)->sin6_addr, + memcpy(&sin6.sin6_addr, &satosin6(ifa0->ifa_addr)->sin6_addr, sizeof(sin6.sin6_addr)); error = in6_setscope(&sin6.sin6_addr, ifa0->ifa_ifp, NULL); if (error != 0) @@ -1374,16 +1374,17 @@ in6_purgeaddr_mc(struct ifnet *ifp, stru rt = in6_rtalloc1((struct sockaddr *)&mltaddr, 0, 0UL, RT_DEFAULT_FIB); if (rt != NULL && rt->rt_gateway != NULL && - (memcmp(&satosin6(rt->rt_gateway)->sin6_addr, + (memcmp(&satosin6(rt->rt_gateway)->sin6_addr, &ia->ia_addr.sin6_addr, sizeof(ia->ia_addr.sin6_addr)) == 0)) { - /* + /* * If no more IPv6 address exists on this interface then * remove the multicast address route. */ if (ifa0 == NULL) { - memcpy(&mltaddr.sin6_addr, &satosin6(rt_key(rt))->sin6_addr, - sizeof(mltaddr.sin6_addr)); + memcpy(&mltaddr.sin6_addr, + &satosin6(rt_key(rt))->sin6_addr, + sizeof(mltaddr.sin6_addr)); RTFREE_LOCKED(rt); error = in6_rtrequest(RTM_DELETE, (struct sockaddr *)&mltaddr, @@ -1415,16 +1416,17 @@ in6_purgeaddr_mc(struct ifnet *ifp, stru rt = in6_rtalloc1((struct sockaddr *)&mltaddr, 0, 0UL, RT_DEFAULT_FIB); if (rt != NULL && rt->rt_gateway != NULL && - (memcmp(&satosin6(rt->rt_gateway)->sin6_addr, + (memcmp(&satosin6(rt->rt_gateway)->sin6_addr, &ia->ia_addr.sin6_addr, sizeof(ia->ia_addr.sin6_addr)) == 0)) { - /* + /* * If no more IPv6 address exists on this interface then * remove the multicast address route. */ if (ifa0 == NULL) { - memcpy(&mltaddr.sin6_addr, &satosin6(rt_key(rt))->sin6_addr, - sizeof(mltaddr.sin6_addr)); + memcpy(&mltaddr.sin6_addr, + &satosin6(rt_key(rt))->sin6_addr, + sizeof(mltaddr.sin6_addr)); RTFREE_LOCKED(rt); error = in6_rtrequest(RTM_DELETE, @@ -1471,8 +1473,7 @@ in6_purgeaddr(struct ifaddr *ifa) TAILQ_FOREACH(ifa0, &ifp->if_addrhead, ifa_link) { if ((ifa0->ifa_addr->sa_family != AF_INET6) || memcmp(&satosin6(ifa0->ifa_addr)->sin6_addr, - &ia->ia_addr.sin6_addr, - sizeof(struct in6_addr)) == 0) + &ia->ia_addr.sin6_addr, sizeof(struct in6_addr)) == 0) continue; else break; @@ -1483,12 +1484,12 @@ in6_purgeaddr(struct ifaddr *ifa) /* * Remove the loopback route to the interface address. - * The check for the current setting of "nd6_useloopback" + * The check for the current setting of "nd6_useloopback" * is not needed. */ if (ia->ia_flags & IFA_RTSELF) { error = ifa_del_loopback_route((struct ifaddr *)ia, - (struct sockaddr *)&ia->ia_addr); + (struct sockaddr *)&ia->ia_addr); if (error == 0) ia->ia_flags &= ~IFA_RTSELF; } @@ -1890,7 +1891,7 @@ in6_ifinit(struct ifnet *ifp, struct in6 * Special case: * If a new destination address is specified for a point-to-point * interface, install a route to the destination as an interface - * direct route. + * direct route. * XXX: the logic below rejects assigning multiple addresses on a p2p * interface that share the same destination. */ @@ -1914,7 +1915,7 @@ in6_ifinit(struct ifnet *ifp, struct in6 */ if (!(ia->ia_flags & IFA_RTSELF) && V_nd6_useloopback) { error = ifa_add_loopback_route((struct ifaddr *)ia, - (struct sockaddr *)&ia->ia_addr); + (struct sockaddr *)&ia->ia_addr); if (error == 0) ia->ia_flags |= IFA_RTSELF; } @@ -1941,7 +1942,7 @@ in6ifa_ifpforlinklocal(struct ifnet *ifp continue; if (IN6_IS_ADDR_LINKLOCAL(IFA_IN6(ifa))) { if ((((struct in6_ifaddr *)ifa)->ia6_flags & - ignoreflags) != 0) + ignoreflags) != 0) continue; ifa_ref(ifa); break; @@ -2108,7 +2109,7 @@ in6_is_addr_deprecated(struct sockaddr_i IN6_IFADDR_RLOCK(); TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { if (IN6_ARE_ADDR_EQUAL(&ia->ia_addr.sin6_addr, - &sa6->sin6_addr) && + &sa6->sin6_addr) && (ia->ia6_flags & IN6_IFF_DEPRECATED) != 0) { IN6_IFADDR_RUNLOCK(); return (1); /* true */ @@ -2379,7 +2380,7 @@ in6_setmaxmtu(void) maxmtu = IN6_LINKMTU(ifp); } IFNET_RUNLOCK_NOSLEEP(); - if (maxmtu) /* update only when maxmtu is positive */ + if (maxmtu) /* update only when maxmtu is positive */ V_in6_maxmtu = maxmtu; } @@ -2469,8 +2470,7 @@ in6_lltable_new(const struct sockaddr *l { struct in6_llentry *lle; - lle = malloc(sizeof(struct in6_llentry), M_LLTABLE, - M_DONTWAIT | M_ZERO); + lle = malloc(sizeof(struct in6_llentry), M_LLTABLE, M_NOWAIT | M_ZERO); if (lle == NULL) /* NB: caller generates msg */ return NULL; @@ -2481,29 +2481,27 @@ in6_lltable_new(const struct sockaddr *l callout_init_rw(&lle->base.ln_timer_ch, &lle->base.lle_lock, CALLOUT_RETURNUNLOCKED); - return &lle->base; + return (&lle->base); } static void -in6_lltable_prefix_free(struct lltable *llt, - const struct sockaddr *prefix, - const struct sockaddr *mask, - u_int flags) +in6_lltable_prefix_free(struct lltable *llt, const struct sockaddr *prefix, + const struct sockaddr *mask, u_int flags) { const struct sockaddr_in6 *pfx = (const struct sockaddr_in6 *)prefix; const struct sockaddr_in6 *msk = (const struct sockaddr_in6 *)mask; struct llentry *lle, *next; - register int i; + int i; /* - * (flags & LLE_STATIC) means deleting all entries - * including static ND6 entries + * (flags & LLE_STATIC) means deleting all entries + * including static ND6 entries. */ - for (i=0; i < LLTBL_HASHTBL_SIZE; i++) { + for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) { LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) { if (IN6_ARE_MASKED_ADDR_EQUAL( - &((struct sockaddr_in6 *)L3_ADDR(lle))->sin6_addr, - &pfx->sin6_addr, + &((struct sockaddr_in6 *)L3_ADDR(lle))->sin6_addr, + &pfx->sin6_addr, &msk->sin6_addr) && ((flags & LLE_STATIC) || !(lle->la_flags & LLE_STATIC))) { int canceled; @@ -2519,8 +2517,8 @@ in6_lltable_prefix_free(struct lltable * } static int -in6_lltable_rtcheck(struct ifnet *ifp, - u_int flags, +in6_lltable_rtcheck(struct ifnet *ifp, + u_int flags, const struct sockaddr *l3addr) { struct rtentry *rt; @@ -2535,8 +2533,8 @@ in6_lltable_rtcheck(struct ifnet *ifp, RT_DEFAULT_FIB); if (rt == NULL || (rt->rt_flags & RTF_GATEWAY) || rt->rt_ifp != ifp) { struct ifaddr *ifa; - /* - * Create an ND6 cache for an IPv6 neighbor + /* + * Create an ND6 cache for an IPv6 neighbor * that is not covered by our own prefix. */ /* XXX ifaof_ifpforaddr should take a const param */ @@ -2577,8 +2575,8 @@ in6_lltable_lookup(struct lltable *llt, struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *)L3_ADDR(lle); if (lle->la_flags & LLE_DELETED) continue; - if (bcmp(&sa6->sin6_addr, &sin6->sin6_addr, - sizeof(struct in6_addr)) == 0) + if (bcmp(&sa6->sin6_addr, &sin6->sin6_addr, + sizeof(struct in6_addr)) == 0) break; } @@ -2801,8 +2799,7 @@ in6_sin_2_v4mapsin6_in_sock(struct socka struct sockaddr_in *sin_p; struct sockaddr_in6 *sin6_p; - sin6_p = malloc(sizeof *sin6_p, M_SONAME, - M_WAITOK); + sin6_p = malloc(sizeof *sin6_p, M_SONAME, M_WAITOK); sin_p = (struct sockaddr_in *)*nam; in6_sin_2_v4mapsin6(sin_p, sin6_p); free(*nam, M_SONAME); From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 11:32:14 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 024141065670; Tue, 31 Jul 2012 11:32:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id B27C48FC20; Tue, 31 Jul 2012 11:32:12 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id OAA26846; Tue, 31 Jul 2012 14:32:10 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1SwAgM-0007f1-4i; Tue, 31 Jul 2012 14:32:10 +0300 Message-ID: <5017C236.6090507@FreeBSD.org> Date: Tue, 31 Jul 2012 14:32:06 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:14.0) Gecko/20120728 Thunderbird/14.0 MIME-Version: 1.0 To: Alexander Motin References: <201207311058.q6VAwp18019777@svn.freebsd.org> In-Reply-To: <201207311058.q6VAwp18019777@svn.freebsd.org> X-Enigmail-Version: 1.4.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r238943 - head/sys/dev/acpica X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 11:32:14 -0000 on 31/07/2012 13:58 Alexander Motin said the following: > To help with diagnostics, add C-state type into dev.cpu.X.cx_supported I think that this really should have been a separate commit. Besides it is a POLA violation for those who may parse output of this sysctl for whatever reason. Additionally, it would seem to be better to have sub-tree per state per CPU where all the important/interesting characteristics of the state are exposed. So this part of this commit seems like a half-measure. This all has been recently discussed on acpi@ :-) -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 11:36:55 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C924106564A; Tue, 31 Jul 2012 11:36:55 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail28.syd.optusnet.com.au (mail28.syd.optusnet.com.au [211.29.133.169]) by mx1.freebsd.org (Postfix) with ESMTP id 55A288FC08; Tue, 31 Jul 2012 11:36:54 +0000 (UTC) Received: from c122-106-171-246.carlnfd1.nsw.optusnet.com.au (c122-106-171-246.carlnfd1.nsw.optusnet.com.au [122.106.171.246]) by mail28.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q6VBaiiV019129 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 31 Jul 2012 21:36:46 +1000 Date: Tue, 31 Jul 2012 21:36:44 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: David Xu In-Reply-To: <50179581.9070805@gmail.com> Message-ID: <20120731210253.T1970@besplex.bde.org> References: <201207310548.q6V5mZHf091624@svn.freebsd.org> <50179581.9070805@gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: src-committers@FreeBSD.org, Giovanni Trematerra , svn-src-all@FreeBSD.org, Konstantin Belousov , bde@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r238936 - in head/sys: fs/fifofs kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 11:36:55 -0000 On Tue, 31 Jul 2012, David Xu wrote: > On 2012/7/31 15:22, Giovanni Trematerra wrote: >> On Tue, Jul 31, 2012 at 7:48 AM, David Xu wrote: >>> Log: >>> I am comparing current pipe code with the one in 8.3-STABLE r236165, >>> I found 8.3 is a history BSD version using socket to implement FIFO >>> pipe, it uses per-file seqcount to compare with writer generation >>> stored in per-pipe object. The concept is after all writers are gone, >>> the pipe enters next generation, all old readers have not closed the >>> pipe should get the indication that the pipe is disconnected, result >>> is they should get EPIPE, SIGPIPE or get POLLHUP in poll(). >>> But newcomer should not know that previous writters were gone, it >>> should treat it as a fresh session. Good commit message. Almost worth quoting in 3 followups :-). I wrote most of the code and forgotten some details, and the above made them clear. >>> I am trying to bring back FIFO pipe to history behavior. It is still >>> unclear that if single EOF flag can represent SBS_CANTSENDMORE and >>> SBS_CANTRCVMORE which socket-based version is using, but I have run >>> the poll regression test in tool directory, output is same as the one >>> on 8.3-STABLE now. Not very historic. Only FreeBSD-8 (maybe 9?) did that. >>> I think the output "not ok 18 FIFO state 6b: poll result 0 expected 1. >>> expected POLLHUP; got 0" might be bogus, because newcomer should not >>> know that old writers were gone. I got the same behavior on Linux. 6b is intentionally different from Linux. I forget if it is to reduce races with readers or just to simply the implementation and understanding it. New readers simply joing old readers with a hangup set for all if they manage to open the fifo (necessarily using O_NONBLOCK) after the hangup but before the old readers go away. Since this seems to increase races, I may remember it backwards >>> Our implementation always return POLLIN for disconnected pipe even it >>> should return POLLHUP, but I think it is not wise to remove POLLIN for >>> compatible reason, this is our history behavior. This is historical back to FreeBSD-3 (earlier versions didn't have poll()). I think it is just a bug. POLLHUP was unimplemented for most file types before FreeBSD-8, and setting POLLIN works around this for most callers. I tried to get it fixed for at least fifos when I fixed POLLHUP for some file types. No one uses fifos, so they are safer to fix than sockets :-). >> I'm sorry but I'm failing to understand the reason for this change. >> Can you point me out a test that confirm that the change is needed. >> The only thing I see is an increase in the memory footprint for the pipes. >> There was a lot of discussions on this topic on -arch mailing list Many poll regression tests fail. >> http://lists.freebsd.org/pipermail/freebsd-arch/2012-January/012131.html >> http://lists.freebsd.org/pipermail/freebsd-arch/2012-February/012314.html There are also a lot of old PRs about this for poll() (not for your new fifo implementation). I think the PRs are mentioned in these threads. > The old code broke some history semantic of FIFO pipe, you can try the test > tool /usr/src/tools/regression/poll/pipepoll, try it before and after my > commit, also compare the result with 8.3-STABLE, without this commit, > both sub-tests 6c and 6d failed. > > I think old code did not mimic original code correctly, > in 8.3-STABLE code, seqcount is stored in each file, writer generation > detection is based on each copy of seqcount, but your code stored single > copy of seqcount in fifoinfo object which is store as vnode data, and > made the writer generation flag global by setting PIPE_SAMEWGEN in pipe > object and used this flag to determine if it should return POLLHUP/POLLIN > or not, this is wrong, for example: > when there is no writer but have old readers, new incoming reader will > executes: > line 174 and 175: > fip->fi_seqcount = fip->fi_wgen - fip->fi_writers; > FIFO_WPDWGEN(fip, fpipe); > > this causes fi_seqcount to be equal to fi_wgen because fi_writer is zero, > and FIFO_WPDWGEN() turns on flag PIPE_SAMEWGEN. > When PIPE_SAMEWGEN is on, pipe_poll() ignores EOF, this breaks old readers, > it causes old reader to get nothing while it should get POLLHUP from poll(). > > The new incoming reader should get nothing, so I think sub-tests 6b > is wrong. Luckily I have forgotten the details for fifos and never understood them all for nameless pipes, so you get to fix it :-). Bruce From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 14:56:51 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE3F1106564A; Tue, 31 Jul 2012 14:56:50 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id C2F1D8FC16; Tue, 31 Jul 2012 14:56:50 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 2D9B9B94A; Tue, 31 Jul 2012 10:56:50 -0400 (EDT) From: John Baldwin To: Max Khon Date: Tue, 31 Jul 2012 09:27:24 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p17; KDE/4.5.5; amd64; ; ) References: <201207310523.q6V5NN0j089530@svn.freebsd.org> In-Reply-To: <201207310523.q6V5NN0j089530@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201207310927.24383.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 31 Jul 2012 10:56:50 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r238933 - head/sys/dev/puc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 14:56:51 -0000 On Tuesday, July 31, 2012 1:23:23 am Max Khon wrote: > Author: fjoe > Date: Tue Jul 31 05:23:23 2012 > New Revision: 238933 > URL: http://svn.freebsd.org/changeset/base/238933 > > Log: > - Change back "d_ofs" to int8_t to not pessimize padding and size of "struct puc_cfg". > - Use "puc_config_moxa" for Moxa boards that need d_ofs greater than 0x7f > > Prodded by: marcel@, gavin@ > MFC after: 3 days Thanks! -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 15:13:29 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 58160106564A for ; Tue, 31 Jul 2012 15:13:29 +0000 (UTC) (envelope-from andrey@zonov.org) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id D410E8FC16 for ; Tue, 31 Jul 2012 15:13:28 +0000 (UTC) Received: by eaak11 with SMTP id k11so444789eaa.13 for ; Tue, 31 Jul 2012 08:13:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=4Km2o9pXhWgjzCr43Dmq4TkD4BVXz6Q9hXcMjCRPAsM=; b=C35mquBam5BAeUYxWXkSm2VNUMKjXZSq7Q9hhGGaUj8p03Az9ZNUsafEf//qy6EVL2 x/KckcW2hvJEj6zETg3X7N1blQB3tCfWXAa+46wJLYX9D8gB1stFrX/foJ5NN1Vr0BH4 /6UqwZKxnpBR0knXQhg2ao8py0Rqo2KJSRNObB1xSt7ImIh9aNZhzPXFoIeuIXufCv+P Fgmh4bBL52o796vjbymoNQb229ZO/sRchn0ebb3MRK3xLQqDEMuoWKEK9p1t0hjPCSXl /S6pJaxKwpWK/d0Ie35jYdB1x7QLcnktfryrD9wqlM52B28otuRu7PqXzwmp1om494My jxNA== Received: by 10.14.178.67 with SMTP id e43mr17232102eem.44.1343747607586; Tue, 31 Jul 2012 08:13:27 -0700 (PDT) Received: from dhcp170-243-red.yandex.net ([2a02:6b8:0:401:310a:7c4c:34eb:8b2]) by mx.google.com with ESMTPS id g46sm1025163eep.15.2012.07.31.08.13.25 (version=SSLv3 cipher=OTHER); Tue, 31 Jul 2012 08:13:26 -0700 (PDT) Message-ID: <5017F614.1010304@zonov.org> Date: Tue, 31 Jul 2012 19:13:24 +0400 From: Andrey Zonov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Adrian Chadd References: <201207251128.q6PBSFlt052575@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQnyZfJiPw2Dx0+YjVjNwVH//l5RutL1vcpmXIlVD7NKwMknbjXrdMtaAtkjAm7PoPBOFSly Cc: svn-src-head@freebsd.org, Luigi Rizzo , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r238765 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 15:13:29 -0000 On 7/28/12 2:09 AM, Adrian Chadd wrote: > Hi, > > Can you please revert this commit for now? > > * it has some netmap stuff in it that isn't related to the commit; > * it's causing panics due to lock recursion; I can confirm panics with the latest HEAD running under ESX. _mtx_lock_sleep: recursed on non-recursive mutex em0 @ /usr/src/sys/dev/e1000/if_lem.c:881 Tracing pid 12 tid 100030 td 0xfffffe0002960480 kdb_enter() at kdb_enter+0x3b panic() at panic+0x1d1 _mtx_lock_sleep() at _mtx_lock_sleep+0x35f _mtx_lock_flags() at _mtx_lock_flags+0x111 lem_start() at lem_start+0x34 if_transmit() at if_transmit+0xd6 ether_output_frame() at ether_output_frame+0x45 ether_output() at ether_output+0x548 arpintr() at arpintr+0x10c1 netisr_dispatch_src() at netisr_dispatch_src+0x152 ether_demux() at ether_demux+0x18d ether_nh_input() at ether_nh_input+0x290 netisr_dispatch_src() at netisr_dispatch_src+0x152 lem_intr() at lem_intr+0x3ba intr_event_execute_handlers() at intr_event_execute_handlers+0x6a ithread_loop() at ithread_loop+0xab fork_exit() at fork_exit+0x135 fork_trampoline() at fork_trampoline+0xe --- trap 0, rip = 0, rsp = 0xffffff8000301cb0, rbp = 0 --- > * it likely has other issues you haven't yet found. :) > > > > Adrian > > On 25 July 2012 04:28, Luigi Rizzo wrote: >> Author: luigi >> Date: Wed Jul 25 11:28:15 2012 >> New Revision: 238765 >> URL: http://svn.freebsd.org/changeset/base/238765 >> >> Log: >> Use legacy interrupts as a default. This gives up to 10% speedup >> when used in qemu (and this driver is for non-PCIe cards, >> so probably its largest use is in virtualized environments). >> >> Approved by: Jack Vogel >> MFC after: 3 days >> >> Modified: >> head/sys/dev/e1000/if_lem.c >> >> Modified: head/sys/dev/e1000/if_lem.c >> ============================================================================== >> --- head/sys/dev/e1000/if_lem.c Wed Jul 25 10:55:14 2012 (r238764) >> +++ head/sys/dev/e1000/if_lem.c Wed Jul 25 11:28:15 2012 (r238765) >> @@ -239,6 +239,7 @@ static void lem_enable_wakeup(device >> static int lem_enable_phy_wakeup(struct adapter *); >> static void lem_led_func(void *, int); >> >> +#define EM_LEGACY_IRQ /* slightly faster, at least in qemu */ >> #ifdef EM_LEGACY_IRQ >> static void lem_intr(void *); >> #else /* FAST IRQ */ >> @@ -1549,6 +1550,13 @@ lem_xmit(struct adapter *adapter, struct >> u32 txd_upper, txd_lower, txd_used, txd_saved; >> int error, nsegs, i, j, first, last = 0; >> >> +extern int netmap_drop; >> + if (netmap_drop == 95) { >> +dropme: >> + m_freem(*m_headp); >> + *m_headp = NULL; >> + return (ENOBUFS); >> + } >> m_head = *m_headp; >> txd_upper = txd_lower = txd_used = txd_saved = 0; >> >> @@ -1688,6 +1696,9 @@ lem_xmit(struct adapter *adapter, struct >> } >> } >> >> + if (netmap_drop == 96) >> + goto dropme; >> + >> adapter->next_avail_tx_desc = i; >> >> if (adapter->pcix_82544) >> @@ -1715,6 +1726,16 @@ lem_xmit(struct adapter *adapter, struct >> */ >> ctxd->lower.data |= >> htole32(E1000_TXD_CMD_EOP | E1000_TXD_CMD_RS); >> + >> +if (netmap_drop == 97) { >> + static int count=0; >> + if (count++ & 63 != 0) >> + ctxd->lower.data &= >> + ~htole32(E1000_TXD_CMD_RS); >> + else >> + D("preserve RS"); >> + >> +} >> /* >> * Keep track in the first buffer which >> * descriptor will be written back >> @@ -1733,6 +1754,12 @@ lem_xmit(struct adapter *adapter, struct >> adapter->link_duplex == HALF_DUPLEX) >> lem_82547_move_tail(adapter); >> else { >> +extern int netmap_repeat; >> + if (netmap_repeat) { >> + int x; >> + for (x = 0; x < netmap_repeat; x++) >> + E1000_WRITE_REG(&adapter->hw, E1000_TDT(0), i); >> + } >> E1000_WRITE_REG(&adapter->hw, E1000_TDT(0), i); >> if (adapter->hw.mac.type == e1000_82547) >> lem_82547_update_fifo_head(adapter, >> @@ -2986,6 +3013,13 @@ lem_txeof(struct adapter *adapter) >> return; >> } >> #endif /* DEV_NETMAP */ >> +{ >> + static int drops = 0; >> + if (netmap_copy && drops++ < netmap_copy) >> + return; >> + drops = 0; >> +} >> + >> if (adapter->num_tx_desc_avail == adapter->num_tx_desc) >> return; >> > _______________________________________________ > 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" > -- Andrey Zonov From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 15:16:08 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3BF3A106566B; Tue, 31 Jul 2012 15:16:08 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id BC29B8FC08; Tue, 31 Jul 2012 15:16:07 +0000 (UTC) Received: by obbun3 with SMTP id un3so13849987obb.13 for ; Tue, 31 Jul 2012 08:16:07 -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=ptCa+rFK3Y5F/mlnf9e7qDLYcLzGXz6YSNtv62hu4qU=; b=kWX62nzeuA9IrAD6qUHzOCosF0rRJ2dkg0dWwvLCyP7DEwkFO8kfbiwr9mxBbwTIAG CijUzB1GXAXaE5gW7y24hNh3SZcgdUBVIX8mosByHQQHedNnlmrLGASUHEdlCF07Amsy IOBxbDkXKmPdpomIGrNw7TTKe9YeYNbqVlu6R307Qd336Jenybi/c1F/grrRO4Yn3z4a Uis9p0NCimY/Y8qqagsNwQ6vATlGtMOLSM93r2z3EYbeiXYK+2LjawhQ1CWw3vGb9jAx 9/dGVBSaC9q/ubwcDhs00sWEYGAVJLgO54eTT0ncvIsjndVV7iOhWGxcJlF4148CvnuH dBDg== MIME-Version: 1.0 Received: by 10.182.110.102 with SMTP id hz6mr23861636obb.79.1343747767163; Tue, 31 Jul 2012 08:16:07 -0700 (PDT) Received: by 10.76.84.7 with HTTP; Tue, 31 Jul 2012 08:16:07 -0700 (PDT) In-Reply-To: <5017F614.1010304@zonov.org> References: <201207251128.q6PBSFlt052575@svn.freebsd.org> <5017F614.1010304@zonov.org> Date: Tue, 31 Jul 2012 08:16:07 -0700 Message-ID: From: Garrett Cooper To: Andrey Zonov Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Adrian Chadd , src-committers@freebsd.org, Luigi Rizzo Subject: Re: svn commit: r238765 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 15:16:08 -0000 On Tue, Jul 31, 2012 at 8:13 AM, Andrey Zonov wrote: > On 7/28/12 2:09 AM, Adrian Chadd wrote: >> >> Hi, >> >> Can you please revert this commit for now? >> >> * it has some netmap stuff in it that isn't related to the commit; >> * it's causing panics due to lock recursion; > > > I can confirm panics with the latest HEAD running under ESX. > > _mtx_lock_sleep: recursed on non-recursive mutex em0 @ > /usr/src/sys/dev/e1000/if_lem.c:881 > > Tracing pid 12 tid 100030 td 0xfffffe0002960480 > kdb_enter() at kdb_enter+0x3b > panic() at panic+0x1d1 > _mtx_lock_sleep() at _mtx_lock_sleep+0x35f > _mtx_lock_flags() at _mtx_lock_flags+0x111 > lem_start() at lem_start+0x34 > if_transmit() at if_transmit+0xd6 > ether_output_frame() at ether_output_frame+0x45 > ether_output() at ether_output+0x548 > arpintr() at arpintr+0x10c1 > netisr_dispatch_src() at netisr_dispatch_src+0x152 > ether_demux() at ether_demux+0x18d > ether_nh_input() at ether_nh_input+0x290 > netisr_dispatch_src() at netisr_dispatch_src+0x152 > lem_intr() at lem_intr+0x3ba > intr_event_execute_handlers() at intr_event_execute_handlers+0x6a > ithread_loop() at ithread_loop+0xab > fork_exit() at fork_exit+0x135 > fork_trampoline() at fork_trampoline+0xe > --- trap 0, rip = 0, rsp = 0xffffff8000301cb0, rbp = 0 --- http://lists.freebsd.org/pipermail/freebsd-current/2012-July/035593.html Cheers, -Garrett From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 16:13:04 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D40C6106564A; Tue, 31 Jul 2012 16:13:04 +0000 (UTC) (envelope-from seanbru@yahoo-inc.com) Received: from mrout1-b.corp.bf1.yahoo.com (mrout1-b.corp.bf1.yahoo.com [98.139.253.104]) by mx1.freebsd.org (Postfix) with ESMTP id 859D08FC14; Tue, 31 Jul 2012 16:13:04 +0000 (UTC) Received: from [IPv6:::1] (rideseveral.corp.yahoo.com [10.73.160.231]) by mrout1-b.corp.bf1.yahoo.com (8.14.4/8.14.4/y.out) with ESMTP id q6VGCQcr011234; Tue, 31 Jul 2012 09:12:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yahoo-inc.com; s=cobra; t=1343751147; bh=h/KsTNgyIknbjYKplAYPkvBRQvCh7qBHhgdRSi1VDng=; h=Subject:From:To:Cc:In-Reply-To:References:Content-Type:Date: Message-ID:Mime-Version:Content-Transfer-Encoding; b=UGFq1tfBk/iDAtA4Y24yWh/mVL+u8jc+RNEdZSs1oehkrMHiKj4FMSQSzA6qMkDAq RyHImHmrJNzq8fUdXlkRYL2+SEzAOK+3xOmCnRh7LXYOrX5UxbTAtTWP/y3SPfgxLF cry1fjwY8BZDRl82jNR8JW/ctMjZSL0Qum71VFGE= From: Sean Bruno To: Alexander Motin In-Reply-To: <201207311058.q6VAwp18019777@svn.freebsd.org> References: <201207311058.q6VAwp18019777@svn.freebsd.org> Content-Type: text/plain; charset="UTF-8" Date: Tue, 31 Jul 2012 09:12:26 -0700 Message-ID: <1343751146.2957.3.camel@powernoodle.corp.yahoo.com> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit X-Milter-Version: master.31+4-gbc07cd5+ X-CLX-ID: 751146003 Cc: "svn-src-head@FreeBSD.org" , "svn-src-all@FreeBSD.org" , "src-committers@FreeBSD.org" Subject: Re: svn commit: r238943 - head/sys/dev/acpica X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 16:13:04 -0000 On Tue, 2012-07-31 at 03:58 -0700, Alexander Motin wrote: > To help with diagnostics, add C-state type into > dev.cpu.X.cx_supported. Pretty sure that this breaks /etc/rc.d/power_profile Andiry and I went back and forth on this specific thing quite a bit. If you note my commit/revert at svn r238004 and r238009 where I did a similar thing and then had to yank it out. there's a lot of discussion around this point on the acpi mailing lists. http://lists.freebsd.org/pipermail/freebsd-acpi/2012-July/007645.html Sean From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 16:13:58 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 58E1C106566C; Tue, 31 Jul 2012 16:13:58 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 298828FC1C; Tue, 31 Jul 2012 16:13:58 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 86304B98C; Tue, 31 Jul 2012 12:13:57 -0400 (EDT) From: John Baldwin To: Garrett Cooper Date: Tue, 31 Jul 2012 12:12:21 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p17; KDE/4.5.5; amd64; ; ) References: <201207251128.q6PBSFlt052575@svn.freebsd.org> <5017F614.1010304@zonov.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201207311212.21496.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 31 Jul 2012 12:13:57 -0400 (EDT) Cc: Adrian Chadd , src-committers@freebsd.org, svn-src-all@freebsd.org, Andrey Zonov , Luigi Rizzo , svn-src-head@freebsd.org Subject: Re: svn commit: r238765 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 16:13:58 -0000 On Tuesday, July 31, 2012 11:16:07 am Garrett Cooper wrote: > On Tue, Jul 31, 2012 at 8:13 AM, Andrey Zonov wrote: > > On 7/28/12 2:09 AM, Adrian Chadd wrote: > >> > >> Hi, > >> > >> Can you please revert this commit for now? > >> > >> * it has some netmap stuff in it that isn't related to the commit; > >> * it's causing panics due to lock recursion; > > > > > > I can confirm panics with the latest HEAD running under ESX. > > > > _mtx_lock_sleep: recursed on non-recursive mutex em0 @ > > /usr/src/sys/dev/e1000/if_lem.c:881 > > > > Tracing pid 12 tid 100030 td 0xfffffe0002960480 > > kdb_enter() at kdb_enter+0x3b > > panic() at panic+0x1d1 > > _mtx_lock_sleep() at _mtx_lock_sleep+0x35f > > _mtx_lock_flags() at _mtx_lock_flags+0x111 > > lem_start() at lem_start+0x34 > > if_transmit() at if_transmit+0xd6 > > ether_output_frame() at ether_output_frame+0x45 > > ether_output() at ether_output+0x548 > > arpintr() at arpintr+0x10c1 > > netisr_dispatch_src() at netisr_dispatch_src+0x152 > > ether_demux() at ether_demux+0x18d > > ether_nh_input() at ether_nh_input+0x290 > > netisr_dispatch_src() at netisr_dispatch_src+0x152 > > lem_intr() at lem_intr+0x3ba > > intr_event_execute_handlers() at intr_event_execute_handlers+0x6a > > ithread_loop() at ithread_loop+0xab > > fork_exit() at fork_exit+0x135 > > fork_trampoline() at fork_trampoline+0xe > > --- trap 0, rip = 0, rsp = 0xffffff8000301cb0, rbp = 0 --- > > http://lists.freebsd.org/pipermail/freebsd-current/2012-July/035593.html I'd prefer you not add the 'locked' variable, but instead have the normal code path just return before the 'out' label. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 16:20:25 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D19A3106566C; Tue, 31 Jul 2012 16:20:25 +0000 (UTC) (envelope-from jfvogel@gmail.com) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 2404A8FC16; Tue, 31 Jul 2012 16:20:25 +0000 (UTC) Received: by vbmv11 with SMTP id v11so7284090vbm.13 for ; Tue, 31 Jul 2012 09:20:24 -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=r8cuMQNKtDwdN/hQywc6f7D3EA7RRKEyMcAeCCFr14g=; b=TFdaDTqLCEx6VsOvr+iPoplOjY98OjmghLn3dg4vwVKdqqXy5MA/4N84EfH5u8L6FT Ax0F4qwqkumLKdfbRLIlv9vm4uk0nf9+/GHOBAZ+VzhkvUE8EOS+1zrHG0wUjP0ctb2+ RDcucnuZqqd/ZeZWvh0dYtBpFN5nAU3F/LwdWMc1FGqJFOwzhrCRr846uXfELP2g9DVk kkqc7tetOXTzrzuV63AbxaiYgKzviR5Vn0VId5zcv0miFPiFJxgTJCV5L7FYm5aHta3q 9b+PRu6+KbS8AZ26+m9nTrVhlUkgpZLS6MsdNQGQlmUvy2Hghnd4qGmSjIlvMm/ZDMCg BYtQ== MIME-Version: 1.0 Received: by 10.52.95.116 with SMTP id dj20mr12793577vdb.39.1343751624558; Tue, 31 Jul 2012 09:20:24 -0700 (PDT) Received: by 10.58.187.225 with HTTP; Tue, 31 Jul 2012 09:20:24 -0700 (PDT) In-Reply-To: <201207311212.21496.jhb@freebsd.org> References: <201207251128.q6PBSFlt052575@svn.freebsd.org> <5017F614.1010304@zonov.org> <201207311212.21496.jhb@freebsd.org> Date: Tue, 31 Jul 2012 09:20:24 -0700 Message-ID: From: Jack Vogel To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Adrian Chadd , src-committers@freebsd.org, Garrett Cooper , svn-src-all@freebsd.org, Andrey Zonov , Luigi Rizzo , svn-src-head@freebsd.org Subject: Re: svn commit: r238765 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 16:20:25 -0000 Yes, I agree John, that was ugly, I'm already taking care of it with my changes, I'll send you a copy to check out. Jack On Tue, Jul 31, 2012 at 9:12 AM, John Baldwin wrote: > On Tuesday, July 31, 2012 11:16:07 am Garrett Cooper wrote: > > On Tue, Jul 31, 2012 at 8:13 AM, Andrey Zonov wrote: > > > On 7/28/12 2:09 AM, Adrian Chadd wrote: > > >> > > >> Hi, > > >> > > >> Can you please revert this commit for now? > > >> > > >> * it has some netmap stuff in it that isn't related to the commit; > > >> * it's causing panics due to lock recursion; > > > > > > > > > I can confirm panics with the latest HEAD running under ESX. > > > > > > _mtx_lock_sleep: recursed on non-recursive mutex em0 @ > > > /usr/src/sys/dev/e1000/if_lem.c:881 > > > > > > Tracing pid 12 tid 100030 td 0xfffffe0002960480 > > > kdb_enter() at kdb_enter+0x3b > > > panic() at panic+0x1d1 > > > _mtx_lock_sleep() at _mtx_lock_sleep+0x35f > > > _mtx_lock_flags() at _mtx_lock_flags+0x111 > > > lem_start() at lem_start+0x34 > > > if_transmit() at if_transmit+0xd6 > > > ether_output_frame() at ether_output_frame+0x45 > > > ether_output() at ether_output+0x548 > > > arpintr() at arpintr+0x10c1 > > > netisr_dispatch_src() at netisr_dispatch_src+0x152 > > > ether_demux() at ether_demux+0x18d > > > ether_nh_input() at ether_nh_input+0x290 > > > netisr_dispatch_src() at netisr_dispatch_src+0x152 > > > lem_intr() at lem_intr+0x3ba > > > intr_event_execute_handlers() at intr_event_execute_handlers+0x6a > > > ithread_loop() at ithread_loop+0xab > > > fork_exit() at fork_exit+0x135 > > > fork_trampoline() at fork_trampoline+0xe > > > --- trap 0, rip = 0, rsp = 0xffffff8000301cb0, rbp = 0 --- > > > > > http://lists.freebsd.org/pipermail/freebsd-current/2012-July/035593.html > > I'd prefer you not add the 'locked' variable, but instead have the normal > code > path just return before the 'out' label. > > -- > John Baldwin > From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 16:29:34 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2DA0B106566B; Tue, 31 Jul 2012 16:29:34 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-qa0-f47.google.com (mail-qa0-f47.google.com [209.85.216.47]) by mx1.freebsd.org (Postfix) with ESMTP id 6C2D18FC18; Tue, 31 Jul 2012 16:29:33 +0000 (UTC) Received: by qabg1 with SMTP id g1so2051057qab.13 for ; Tue, 31 Jul 2012 09:29:33 -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=hxjC8iR6A4narS15Iv7XaP0vJNWZZVsdVR9UC4vAJys=; b=xfQB4v7jar37RipnlQmGpeYwaNcJZOY2pu1JK8L+/7rJISxGfaHXb2TAi88PAnjaQK Hhvkx6ODB2Zk41ENUBTI0sMXNSNLRWG9qDN68JINJ9+IUp9ecOcAlmdf90VuxcsCroYi dpIK70WHiFGFpZyLFE92+zf4/Ciw15NNdozy/C6C/5Y1veWgIiof35lGxWB07uqNg4tU 8d9X5YgfRGHIGHCcAlh5cp7tsuOqZ//vMHh8opuRECrKok2ri6rMAQVjVOtUCxCAWRCB 3HRzyNtSp5+YXM+1VRUv2CmWVoJa47oj7Ck5skkxQ6B7Dd79cO6JDDxpR77GWSJlHsQT 5WMw== MIME-Version: 1.0 Received: by 10.60.31.165 with SMTP id b5mr24113822oei.58.1343752172798; Tue, 31 Jul 2012 09:29:32 -0700 (PDT) Received: by 10.76.84.7 with HTTP; Tue, 31 Jul 2012 09:29:32 -0700 (PDT) In-Reply-To: References: <201207251128.q6PBSFlt052575@svn.freebsd.org> <5017F614.1010304@zonov.org> <201207311212.21496.jhb@freebsd.org> Date: Tue, 31 Jul 2012 09:29:32 -0700 Message-ID: From: Garrett Cooper To: Jack Vogel Content-Type: text/plain; charset=ISO-8859-1 Cc: Adrian Chadd , src-committers@freebsd.org, John Baldwin , svn-src-all@freebsd.org, Andrey Zonov , Luigi Rizzo , svn-src-head@freebsd.org Subject: Re: svn commit: r238765 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 16:29:34 -0000 On Tue, Jul 31, 2012 at 9:20 AM, Jack Vogel wrote: > Yes, I agree John, that was ugly, I'm already taking care of it with my > changes, > I'll send you a copy to check out. Like so: --- //depot/user/gcooper/atf-head/src/sys/dev/e1000/if_lem.c 2012-07-25 17:11:00.000000000 0000 +++ /scratch/p4/user/gcooper/atf-head/src/sys/dev/e1000/if_lem.c 2012-07-25 17:11:00.000000000 0000 @@ -1320,9 +1320,10 @@ lem_local_timer, adapter); goto out; } + EM_CORE_UNLOCK(adapter); + lem_rxeof(adapter, -1, NULL); EM_TX_LOCK(adapter); - lem_rxeof(adapter, -1, NULL); lem_txeof(adapter); if (ifp->if_drv_flags & IFF_DRV_RUNNING && !IFQ_DRV_IS_EMPTY(&ifp->if_snd)) @@ -1330,8 +1331,8 @@ EM_TX_UNLOCK(adapter); out: - EM_CORE_UNLOCK(adapter); - return; + if (mtx_owned(&adapter->core_mtx)) + EM_CORE_UNLOCK(adapter); } #else /* EM_FAST_IRQ, then fast interrupt routines only */ From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 16:41:09 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC1C11065673; Tue, 31 Jul 2012 16:41:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A5A418FC19; Tue, 31 Jul 2012 16:41:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6VGf90L047712; Tue, 31 Jul 2012 16:41:09 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6VGf9cR047710; Tue, 31 Jul 2012 16:41:09 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207311641.q6VGf9cR047710@svn.freebsd.org> From: Adrian Chadd Date: Tue, 31 Jul 2012 16:41:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238947 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 16:41:09 -0000 Author: adrian Date: Tue Jul 31 16:41:09 2012 New Revision: 238947 URL: http://svn.freebsd.org/changeset/base/238947 Log: Push the rate control and descriptor chaining into the descriptor "set" functions, for both legacy and 802.11n. This will simplify supporting the EDMA chipsets as these two descriptor setup functions can just be overridden in their entirety, hiding all of the subtle differences in setting things up. It's not a permanent solution, as eventually the AR5416 HAL should grow similar versions of the 11n descriptor functions and then those can be used. TODO: * Push the "clr11naggr" call into the legacy setds, just to ensure that retried frames don't end up with the aggregate bits set inappropriately; * Remove the "setlasttxdesc" call from the 11n TX path and push it into setds_11n. * Ensure that setds_11n will work correctly for non-aggregate frames; * .. and then when it does, just unconditionally call "setds_11n" for 11n NICs and "setds" for non-11n NICs. Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Tue Jul 31 13:11:20 2012 (r238946) +++ head/sys/dev/ath/if_ath_tx.c Tue Jul 31 16:41:09 2012 (r238947) @@ -394,6 +394,50 @@ ath_tx_chaindesclist_subframe(struct ath } /* + * Set the rate control fields in the given descriptor based on + * the bf_state fields and node state. + * + * The bfs fields should already be set with the relevant rate + * control information, including whether MRR is to be enabled. + * + * Since the FreeBSD HAL currently sets up the first TX rate + * in ath_hal_setuptxdesc(), this will setup the MRR + * conditionally for the pre-11n chips, and call ath_buf_set_rate + * unconditionally for 11n chips. These require the 11n rate + * scenario to be set if MCS rates are enabled, so it's easier + * to just always call it. The caller can then only set rates 2, 3 + * and 4 if multi-rate retry is needed. + */ +static void +ath_tx_set_ratectrl(struct ath_softc *sc, struct ieee80211_node *ni, + struct ath_buf *bf) +{ + struct ath_rc_series *rc = bf->bf_state.bfs_rc; + + /* If mrr is disabled, blank tries 1, 2, 3 */ + if (! bf->bf_state.bfs_ismrr) + rc[1].tries = rc[2].tries = rc[3].tries = 0; + + /* + * Always call - that way a retried descriptor will + * have the MRR fields overwritten. + * + * XXX TODO: see if this is really needed - setting up + * the first descriptor should set the MRR fields to 0 + * for us anyway. + */ + if (ath_tx_is_11n(sc)) { + ath_buf_set_rate(sc, ni, bf); + } else { + ath_hal_setupxtxdesc(sc->sc_ah, bf->bf_desc + , rc[1].ratecode, rc[1].tries + , rc[2].ratecode, rc[2].tries + , rc[3].ratecode, rc[3].tries + ); + } +} + +/* * Setup segments+descriptors for an 11n aggregate. * bf_first is the first buffer in the aggregate. * The descriptor list must already been linked together using @@ -471,6 +515,11 @@ ath_tx_setds_11n(struct ath_softc *sc, s */ bf_first->bf_last = bf_prev; + /* + * setup first desc with rate and aggr info + */ + ath_tx_set_ratectrl(sc, bf_first->bf_node, bf_first); + DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, "%s: end\n", __func__); } @@ -1039,7 +1088,9 @@ ath_tx_setds(struct ath_softc *sc, struc bf->bf_lastds = ds; bf->bf_last = bf; - /* XXX TODO: Setup descriptor chain */ + /* Set rate control and descriptor chain for this frame */ + ath_tx_set_ratectrl(sc, bf->bf_node, bf); + ath_tx_chaindesclist(sc, bf); } /* @@ -1088,50 +1139,6 @@ ath_tx_do_ratelookup(struct ath_softc *s } /* - * Set the rate control fields in the given descriptor based on - * the bf_state fields and node state. - * - * The bfs fields should already be set with the relevant rate - * control information, including whether MRR is to be enabled. - * - * Since the FreeBSD HAL currently sets up the first TX rate - * in ath_hal_setuptxdesc(), this will setup the MRR - * conditionally for the pre-11n chips, and call ath_buf_set_rate - * unconditionally for 11n chips. These require the 11n rate - * scenario to be set if MCS rates are enabled, so it's easier - * to just always call it. The caller can then only set rates 2, 3 - * and 4 if multi-rate retry is needed. - */ -static void -ath_tx_set_ratectrl(struct ath_softc *sc, struct ieee80211_node *ni, - struct ath_buf *bf) -{ - struct ath_rc_series *rc = bf->bf_state.bfs_rc; - - /* If mrr is disabled, blank tries 1, 2, 3 */ - if (! bf->bf_state.bfs_ismrr) - rc[1].tries = rc[2].tries = rc[3].tries = 0; - - /* - * Always call - that way a retried descriptor will - * have the MRR fields overwritten. - * - * XXX TODO: see if this is really needed - setting up - * the first descriptor should set the MRR fields to 0 - * for us anyway. - */ - if (ath_tx_is_11n(sc)) { - ath_buf_set_rate(sc, ni, bf); - } else { - ath_hal_setupxtxdesc(sc->sc_ah, bf->bf_desc - , rc[1].ratecode, rc[1].tries - , rc[2].ratecode, rc[2].tries - , rc[3].ratecode, rc[3].tries - ); - } -} - -/* * Transmit the given frame to the hardware. * * The frame must already be setup; rate control must already have @@ -1156,8 +1163,6 @@ ath_tx_xmit_normal(struct ath_softc *sc, ath_tx_set_rtscts(sc, bf); ath_tx_rate_fill_rcflags(sc, bf); ath_tx_setds(sc, bf); - ath_tx_set_ratectrl(sc, bf->bf_node, bf); - ath_tx_chaindesclist(sc, bf); /* Hand off to hardware */ ath_tx_handoff(sc, txq, bf); @@ -2405,8 +2410,6 @@ ath_tx_xmit_aggr(struct ath_softc *sc, s ath_tx_set_rtscts(sc, bf); ath_tx_rate_fill_rcflags(sc, bf); ath_tx_setds(sc, bf); - ath_tx_set_ratectrl(sc, bf->bf_node, bf); - ath_tx_chaindesclist(sc, bf); /* Statistics */ sc->sc_aggr_stats.aggr_low_hwq_single_pkt++; @@ -3848,7 +3851,6 @@ ath_tx_tid_hw_queue_aggr(struct ath_soft struct ath_buf *bf; struct ath_txq *txq = sc->sc_ac2q[tid->ac]; struct ieee80211_tx_ampdu *tap; - struct ieee80211_node *ni = &an->an_node; ATH_AGGR_STATUS status; ath_bufhead bf_q; @@ -3896,8 +3898,6 @@ ath_tx_tid_hw_queue_aggr(struct ath_soft ath_tx_set_rtscts(sc, bf); ath_tx_rate_fill_rcflags(sc, bf); ath_tx_setds(sc, bf); - ath_tx_set_ratectrl(sc, ni, bf); - ath_tx_chaindesclist(sc, bf); ath_hal_clr11n_aggr(sc->sc_ah, bf->bf_desc); sc->sc_aggr_stats.aggr_nonbaw_pkt++; @@ -3956,8 +3956,6 @@ ath_tx_tid_hw_queue_aggr(struct ath_soft "%s: single-frame aggregate\n", __func__); bf->bf_state.bfs_aggr = 0; ath_tx_setds(sc, bf); - ath_tx_set_ratectrl(sc, ni, bf); - ath_tx_chaindesclist(sc, bf); ath_hal_clr11n_aggr(sc->sc_ah, bf->bf_desc); if (status == ATH_AGGR_BAW_CLOSED) sc->sc_aggr_stats.aggr_baw_closed_single_pkt++; @@ -3993,10 +3991,6 @@ ath_tx_tid_hw_queue_aggr(struct ath_soft */ ath_tx_setds_11n(sc, bf); - /* - * setup first desc with rate and aggr info - */ - ath_tx_set_ratectrl(sc, ni, bf); } queuepkt: //txq = bf->bf_state.bfs_txq; @@ -4036,7 +4030,6 @@ ath_tx_tid_hw_queue_norm(struct ath_soft { struct ath_buf *bf; struct ath_txq *txq = sc->sc_ac2q[tid->ac]; - struct ieee80211_node *ni = &an->an_node; DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: node %p: TID %d: called\n", __func__, an, tid->tid); @@ -4085,8 +4078,6 @@ ath_tx_tid_hw_queue_norm(struct ath_soft ath_tx_set_rtscts(sc, bf); ath_tx_rate_fill_rcflags(sc, bf); ath_tx_setds(sc, bf); - ath_tx_set_ratectrl(sc, ni, bf); - ath_tx_chaindesclist(sc, bf); /* Track outstanding buffer count to hardware */ /* aggregates are "one" buffer */ From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 16:55:42 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75286106566B; Tue, 31 Jul 2012 16:55:42 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F0B28FC0C; Tue, 31 Jul 2012 16:55:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6VGtg3G049006; Tue, 31 Jul 2012 16:55:42 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6VGtgLm049004; Tue, 31 Jul 2012 16:55:42 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201207311655.q6VGtgLm049004@svn.freebsd.org> From: Jilles Tjoelker Date: Tue, 31 Jul 2012 16:55:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238948 - head/usr.bin/find X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 16:55:42 -0000 Author: jilles Date: Tue Jul 31 16:55:41 2012 New Revision: 238948 URL: http://svn.freebsd.org/changeset/base/238948 Log: find: Remove unnecessary and inconsistent initialization. Submitted by: jhb Modified: head/usr.bin/find/main.c Modified: head/usr.bin/find/main.c ============================================================================== --- head/usr.bin/find/main.c Tue Jul 31 16:41:09 2012 (r238947) +++ head/usr.bin/find/main.c Tue Jul 31 16:55:41 2012 (r238948) @@ -64,7 +64,7 @@ __FBSDID("$FreeBSD$"); time_t now; /* time find was run */ int dotfd; /* starting directory */ int ftsoptions; /* options for the ftsopen(3) call */ -int ignore_readdir_race = 0; /* ignore readdir race */ +int ignore_readdir_race; /* ignore readdir race */ int isdeprecated; /* using deprecated syntax */ int isdepth; /* do directories on post-order visit */ int isoutput; /* user specified output operator */ From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 17:07:22 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67A56106567E; Tue, 31 Jul 2012 17:07:22 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-wg0-f42.google.com (mail-wg0-f42.google.com [74.125.82.42]) by mx1.freebsd.org (Postfix) with ESMTP id 995CF8FC15; Tue, 31 Jul 2012 17:07:21 +0000 (UTC) Received: by wgbfm10 with SMTP id fm10so3536967wgb.1 for ; Tue, 31 Jul 2012 10:07:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=oqkW+lmhu4DKGyYi+8W4ih3VqRVcAb5dYMGAOJCcMU0=; b=EZzt66fYqjm31Vz79RKNSzdB5e6XcSz+cBjDWsHQ17PkUK0zYLaYtPk8YJwY9nNPgU VfVmKsS4GYhSl4+oxXkA0pyYP5UWcds2WVe46BcLfKcgzhz+Y7YlnsaWYk7/u2+2cwgp tnINLUvCm6rk/e7MiQy88e18PNcclMTv8Kyi1NRBL+j9n/zcBk3yHdlee2BGKBlwlUn+ WUkIcwWL4w+s+aOXVAQ+Ux/8078DuntiU5Ct2o1AuXLdVV/IZV4sL0Tv2njmagUuONRv l6cehCm9rzOfO2bi7EFU1tOwZHmAYZ9WDGlFnSj3SqhOngeIiVPCcsP1/xITHPTDo+rY tZOQ== Received: by 10.180.107.103 with SMTP id hb7mr8689240wib.3.1343754434730; Tue, 31 Jul 2012 10:07:14 -0700 (PDT) Received: from mavbook.mavhome.dp.ua (93-127-73-162.static.vega-ua.net. [93.127.73.162]) by mx.google.com with ESMTPS id bc2sm1532650wib.0.2012.07.31.10.07.12 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 31 Jul 2012 10:07:14 -0700 (PDT) Sender: Alexander Motin Message-ID: <501810BF.9010008@FreeBSD.org> Date: Tue, 31 Jul 2012 20:07:11 +0300 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:13.0) Gecko/20120628 Thunderbird/13.0.1 MIME-Version: 1.0 To: Sean Bruno References: <201207311058.q6VAwp18019777@svn.freebsd.org> <1343751146.2957.3.camel@powernoodle.corp.yahoo.com> In-Reply-To: <1343751146.2957.3.camel@powernoodle.corp.yahoo.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: "svn-src-head@FreeBSD.org" , "svn-src-all@FreeBSD.org" , "src-committers@FreeBSD.org" Subject: Re: svn commit: r238943 - head/sys/dev/acpica X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 17:07:22 -0000 On 31.07.2012 19:12, Sean Bruno wrote: > On Tue, 2012-07-31 at 03:58 -0700, Alexander Motin wrote: >> To help with diagnostics, add C-state type into >> dev.cpu.X.cx_supported. > > Pretty sure that this breaks /etc/rc.d/power_profile No, it doesn't. I've checked it beforehand. At least in my case variable was correctly set to C3. > Andiry and I went back and forth on this specific thing quite a bit. If > you note my commit/revert at svn r238004 and r238009 where I did a > similar thing and then had to yank it out. > > there's a lot of discussion around this point on the acpi mailing lists. > http://lists.freebsd.org/pipermail/freebsd-acpi/2012-July/007645.html I knew about that change and its revert. But it was much more invasive, substituting C-state index with C-state type, that I also consider incorrect. My change is much more simple. Yes, it may affect some POLA, but that is all. I wanted to do this for several years, and I believe that in this case benefits overweight negative side. But if someone tell I should back it out, I will. -- Alexander Motin From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 17:08:29 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D19F7106566B; Tue, 31 Jul 2012 17:08:29 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BCD7B8FC18; Tue, 31 Jul 2012 17:08:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6VH8TpK050118; Tue, 31 Jul 2012 17:08:29 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6VH8Tnb050115; Tue, 31 Jul 2012 17:08:29 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207311708.q6VH8Tnb050115@svn.freebsd.org> From: Adrian Chadd Date: Tue, 31 Jul 2012 17:08:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238949 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 17:08:29 -0000 Author: adrian Date: Tue Jul 31 17:08:29 2012 New Revision: 238949 URL: http://svn.freebsd.org/changeset/base/238949 Log: Shuffle the call to ath_hal_setuplasttxdesc() to _after_ the rate control code is called and remove it from ath_buf_set_rate(). For the legacy (non-11n API) TX routines, ath_hal_filltxdesc() takes care of setting up the intermediary and final descriptors right, complete with copying the rate control info into the final descriptor so the rate modules can grab it. The 11n version doesn't do this - ath_hal_chaintxdesc() doesn't copy the rate control bits over, nor does it clear isaggr/moreaggr/ pad delimiters. So the call to setuplasttxdesc() is needed here. So: * legacy NICs - never call the 11n rate control stuff, so filltxdesc copies the rate control info right; * 11n NICs transmitting legacy or 11n non-aggregate frames - ath_hal_set11nratescenario() is called to setup rate control and then ath_hal_filltxdesc() chains them together - so the rate control info is right; * 11n aggregate frames - set11nratescenario() is called, then ath_hal_chaintxdesc() is called to chain a list of aggregate and subframes together. This requires a call to ath_hal_setuplasttxdesc() to complete things. Tested: * AR9280 in station mode TODO: * I really should make sure that the descriptor contents get blanked out correctly or garbage left over from aggregate frames may show up in non-aggregate frames, leading to badness. Modified: head/sys/dev/ath/if_ath_tx.c head/sys/dev/ath/if_ath_tx_ht.c Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Tue Jul 31 16:55:41 2012 (r238948) +++ head/sys/dev/ath/if_ath_tx.c Tue Jul 31 17:08:29 2012 (r238949) @@ -496,13 +496,6 @@ ath_tx_setds_11n(struct ath_softc *sc, s bf_first->bf_state.bfs_ctsduration); /* - * Setup the last descriptor in the list. - * bf_prev points to the last; bf is NULL here. - */ - ath_hal_setuplasttxdesc(sc->sc_ah, bf_prev->bf_desc, - bf_first->bf_desc); - - /* * Set the first descriptor bf_lastds field to point to * the last descriptor in the last subframe, that's where * the status update will occur. @@ -520,6 +513,13 @@ ath_tx_setds_11n(struct ath_softc *sc, s */ ath_tx_set_ratectrl(sc, bf_first->bf_node, bf_first); + /* + * Setup the last descriptor in the list. + * bf_prev points to the last; bf is NULL here. + */ + ath_hal_setuplasttxdesc(sc->sc_ah, bf_prev->bf_desc, + bf_first->bf_desc); + DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, "%s: end\n", __func__); } Modified: head/sys/dev/ath/if_ath_tx_ht.c ============================================================================== --- head/sys/dev/ath/if_ath_tx_ht.c Tue Jul 31 16:55:41 2012 (r238948) +++ head/sys/dev/ath/if_ath_tx_ht.c Tue Jul 31 17:08:29 2012 (r238949) @@ -560,14 +560,12 @@ ath_rateseries_print(struct ath_softc *s * This isn't useful for sending beacon frames, which has different needs * wrt what's passed into the rate scenario function. */ - void ath_buf_set_rate(struct ath_softc *sc, struct ieee80211_node *ni, struct ath_buf *bf) { HAL_11N_RATE_SERIES series[4]; struct ath_desc *ds = bf->bf_desc; - struct ath_desc *lastds = NULL; struct ath_hal *ah = sc->sc_ah; int is_pspoll = (bf->bf_state.bfs_atype == HAL_PKT_TYPE_PSPOLL); int ctsrate = bf->bf_state.bfs_ctsrate; @@ -578,13 +576,6 @@ ath_buf_set_rate(struct ath_softc *sc, s ath_rateseries_setup(sc, ni, bf, series); - /* Enforce AR5416 aggregate limit - can't do RTS w/ an agg frame > 8k */ - - /* Enforce RTS and CTS are mutually exclusive */ - - /* Get a pointer to the last tx descriptor in the list */ - lastds = bf->bf_lastds; - #if 0 printf("pktlen: %d; flags 0x%x\n", pktlen, flags); ath_rateseries_print(sc, series); @@ -602,21 +593,6 @@ ath_buf_set_rate(struct ath_softc *sc, s 4, /* number of series */ flags); - /* Setup the last descriptor in the chain */ - /* - * XXX Why is this done here, and not in the upper layer? - * The rate control code stores a copy of the RC info in - * the last descriptor as well as the first, then uses - * the shadow copy in the last descriptor to see what the RC - * decisions were. I'm not sure why; perhaps earlier hardware - * overwrote the first descriptor contents. - * - * In the 802.11n case, it also clears the moreaggr/delim - * fields. Again, this should be done by the caller of - * ath_buf_set_rate(). - */ - ath_hal_setuplasttxdesc(ah, lastds, ds); - /* Set burst duration */ /* * This is only required when doing 11n burst, not aggregation From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 17:28:29 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6F7F106564A; Tue, 31 Jul 2012 17:28:29 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 879EC8FC16; Tue, 31 Jul 2012 17:28:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6VHSTD6051658; Tue, 31 Jul 2012 17:28:29 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6VHSTlh051656; Tue, 31 Jul 2012 17:28:29 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207311728.q6VHSTlh051656@svn.freebsd.org> From: Martin Matuska Date: Tue, 31 Jul 2012 17:28:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238950 - head/cddl/contrib/opensolaris/cmd/zpool X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 17:28:30 -0000 Author: mm Date: Tue Jul 31 17:28:28 2012 New Revision: 238950 URL: http://svn.freebsd.org/changeset/base/238950 Log: Fix reporting of root pool upgrade notice. MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Tue Jul 31 17:08:29 2012 (r238949) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Tue Jul 31 17:28:28 2012 (r238950) @@ -4409,6 +4409,7 @@ typedef struct upgrade_cbdata { char **cb_argv; } upgrade_cbdata_t; +#ifdef __FreeBSD__ static int is_root_pool(zpool_handle_t *zhp) { @@ -4434,6 +4435,14 @@ is_root_pool(zpool_handle_t *zhp) return (poolname != NULL && strcmp(poolname, zpool_get_name(zhp)) == 0); } +static void +root_pool_upgrade_check(zpool_handle_t *zhp, char *poolname, int size) { + + if (poolname[0] == '\0' && is_root_pool(zhp)) + (void) strlcpy(poolname, zpool_get_name(zhp), size); +} +#endif /* FreeBSD */ + static int upgrade_version(zpool_handle_t *zhp, uint64_t version) { @@ -4524,12 +4533,8 @@ upgrade_cb(zpool_handle_t *zhp, void *ar if (ret != 0) return (ret); #ifdef __FreeBSD__ - if (cbp->cb_poolname[0] == '\0' && - is_root_pool(zhp)) { - (void) strlcpy(cbp->cb_poolname, - zpool_get_name(zhp), - sizeof(cbp->cb_poolname)); - } + root_pool_upgrade_check(zhp, cbp->cb_poolname, + sizeof(cbp->cb_poolname)); #endif /* ___FreeBSD__ */ printnl = B_TRUE; @@ -4682,17 +4687,12 @@ upgrade_one(zpool_handle_t *zhp, void *d if (cur_version != cbp->cb_version) { printnl = B_TRUE; ret = upgrade_version(zhp, cbp->cb_version); - if (ret != 0) { + if (ret != 0) + return (ret); #ifdef __FreeBSD__ - if (cbp->cb_poolname[0] == '\0' && - is_root_pool(zhp)) { - (void) strlcpy(cbp->cb_poolname, - zpool_get_name(zhp), - sizeof(cbp->cb_poolname)); - } + root_pool_upgrade_check(zhp, cbp->cb_poolname, + sizeof(cbp->cb_poolname)); #endif /* ___FreeBSD__ */ - return (ret); - } } if (cbp->cb_version >= SPA_VERSION_FEATURES) { @@ -4703,15 +4703,15 @@ upgrade_one(zpool_handle_t *zhp, void *d if (count != 0) { printnl = B_TRUE; +#ifdef __FreeBSD__ + root_pool_upgrade_check(zhp, cbp->cb_poolname, + sizeof(cbp->cb_poolname)); +#endif /* __FreeBSD __*/ } else if (cur_version == SPA_VERSION) { (void) printf(gettext("Pool '%s' already has all " "supported features enabled.\n"), zpool_get_name(zhp)); } - if (cbp->cb_poolname[0] == '\0' && is_root_pool(zhp)) { - (void) strlcpy(cbp->cb_poolname, zpool_get_name(zhp), - sizeof(cbp->cb_poolname)); - } } if (printnl) { From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 17:32:29 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 17B381065670; Tue, 31 Jul 2012 17:32:29 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 01F4C8FC08; Tue, 31 Jul 2012 17:32:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6VHWSsp052023; Tue, 31 Jul 2012 17:32:28 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6VHWSKh052021; Tue, 31 Jul 2012 17:32:28 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201207311732.q6VHWSKh052021@svn.freebsd.org> From: Martin Matuska Date: Tue, 31 Jul 2012 17:32:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238951 - head/cddl/contrib/opensolaris/cmd/zpool X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 17:32:29 -0000 Author: mm Date: Tue Jul 31 17:32:28 2012 New Revision: 238951 URL: http://svn.freebsd.org/changeset/base/238951 Log: Fix wrong indent according to style(9) MFC after: 2 weeks > Description of fields to fill in above: 76 columns --| > PR: If a GNATS PR is affected by the change. > Submitted by: If someone else sent in the change. > Reviewed by: If someone else reviewed your modification. > Approved by: If you needed approval for this commit. > Obtained from: If the change is from a third party. > MFC after: N [day[s]|week[s]|month[s]]. Request a reminder email. > Security: Vulnerability reference (one per line) or description. > Empty fields above will be automatically removed. M zpool_main.c Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Tue Jul 31 17:28:28 2012 (r238950) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Tue Jul 31 17:32:28 2012 (r238951) @@ -4704,8 +4704,8 @@ upgrade_one(zpool_handle_t *zhp, void *d if (count != 0) { printnl = B_TRUE; #ifdef __FreeBSD__ - root_pool_upgrade_check(zhp, cbp->cb_poolname, - sizeof(cbp->cb_poolname)); + root_pool_upgrade_check(zhp, cbp->cb_poolname, + sizeof(cbp->cb_poolname)); #endif /* __FreeBSD __*/ } else if (cur_version == SPA_VERSION) { (void) printf(gettext("Pool '%s' already has all " From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 17:47:01 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 02FDD1065670; Tue, 31 Jul 2012 17:47:01 +0000 (UTC) (envelope-from jfvogel@gmail.com) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id EEA3E8FC0A; Tue, 31 Jul 2012 17:46:59 +0000 (UTC) Received: by vcbgb22 with SMTP id gb22so7370641vcb.13 for ; Tue, 31 Jul 2012 10:46:59 -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=64SY12l4mDAfbGSCpQ2YoEm1TUmgq5XX0J30ecIlcfo=; b=OJT9M7wJwwbEbk1vWFeHEyO7Q77FpoE4DSCEMVD8KkyorSB3umkuP4xnZ8G173np1K 5d+8TTTAOPwh1TcdWaVFTq/Ut3vLvJLMOazDOq+vwAEhoq6AxHi6608c7h9xGOgquVqC oKcqwK70erbyOX/r78jUCsVmUv2kbc+7/qM1fvErRPoz7kRW5Lh8dVy1kzIeMGFyhY92 IkYW7W7E9j4TCILifffatQLb02DNmS0eM+ZjZSyDpzJiMIc5wAiLEcCUoI1gC9QpuynG /fheX39mQLe4h4qv5ZozlEIColwT4mYy+C6VubkcgypbnHpUXheFZOhX/gJ1ect1LMmd 1npQ== MIME-Version: 1.0 Received: by 10.52.33.47 with SMTP id o15mr13182274vdi.73.1343756819177; Tue, 31 Jul 2012 10:46:59 -0700 (PDT) Received: by 10.58.187.225 with HTTP; Tue, 31 Jul 2012 10:46:59 -0700 (PDT) In-Reply-To: References: <201207251128.q6PBSFlt052575@svn.freebsd.org> <5017F614.1010304@zonov.org> <201207311212.21496.jhb@freebsd.org> Date: Tue, 31 Jul 2012 10:46:59 -0700 Message-ID: From: Jack Vogel To: Garrett Cooper Content-Type: multipart/mixed; boundary=20cf307ca184df215a04c623c32a X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Adrian Chadd , src-committers@freebsd.org, John Baldwin , svn-src-all@freebsd.org, Andrey Zonov , Luigi Rizzo , svn-src-head@freebsd.org Subject: Re: svn commit: r238765 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 17:47:01 -0000 --20cf307ca184df215a04c623c32a Content-Type: text/plain; charset=ISO-8859-1 No, like so: --- if_lem.c 2012-07-31 18:32:50.000000000 -0700 +++ if_lem.jfv.c 2012-07-31 18:31:25.000000000 -0700 @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2011, Intel Corporation + Copyright (c) 2001-2012, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -85,7 +85,7 @@ /********************************************************************* * Legacy Em Driver version: *********************************************************************/ -char lem_driver_version[] = "1.0.4"; +char lem_driver_version[] = "1.0.5"; /********************************************************************* * PCI Device ID Table @@ -239,16 +239,12 @@ static int lem_enable_phy_wakeup(struct adapter *); static void lem_led_func(void *, int); -#define EM_LEGACY_IRQ /* slightly faster, at least in qemu */ -#ifdef EM_LEGACY_IRQ static void lem_intr(void *); -#else /* FAST IRQ */ static int lem_irq_fast(void *); static void lem_handle_rxtx(void *context, int pending); static void lem_handle_link(void *context, int pending); static void lem_add_rx_process_limit(struct adapter *, const char *, const char *, int *, int); -#endif /* ~EM_LEGACY_IRQ */ #ifdef DEVICE_POLLING static poll_handler_t lem_poll; @@ -305,11 +301,13 @@ TUNABLE_INT("hw.em.smart_pwr_down", &lem_smart_pwr_down); TUNABLE_INT("hw.em.sbp", &lem_debug_sbp); -#ifndef EM_LEGACY_IRQ +/* Interrupt style - default to fast */ +static int lem_use_legacy_irq = 0; +TUNABLE_INT("hw.em.use_legacy_irq", &lem_use_legacy_irq); + /* How many packets rxeof tries to clean at a time */ static int lem_rx_process_limit = 100; TUNABLE_INT("hw.em.rx_process_limit", &lem_rx_process_limit); -#endif /* Flow control setting - default to FULL */ static int lem_fc_setting = e1000_fc_full; @@ -451,12 +449,10 @@ lem_tx_abs_int_delay_dflt); } -#ifndef EM_LEGACY_IRQ /* Sysctls for limiting the amount of work done in the taskqueue */ lem_add_rx_process_limit(adapter, "rx_processing_limit", "max number of rx packets to process", &adapter->rx_process_limit, lem_rx_process_limit); -#endif /* Sysctl for setting the interface flow control */ lem_set_flow_cntrl(adapter, "flow_control", @@ -1198,22 +1194,6 @@ callout_reset(&adapter->timer, hz, lem_local_timer, adapter); e1000_clear_hw_cntrs_base_generic(&adapter->hw); - /* MSI/X configuration for 82574 */ - if (adapter->hw.mac.type == e1000_82574) { - int tmp; - tmp = E1000_READ_REG(&adapter->hw, E1000_CTRL_EXT); - tmp |= E1000_CTRL_EXT_PBA_CLR; - E1000_WRITE_REG(&adapter->hw, E1000_CTRL_EXT, tmp); - /* - ** Set the IVAR - interrupt vector routing. - ** Each nibble represents a vector, high bit - ** is enable, other 3 bits are the MSIX table - ** entry, we map RXQ0 to 0, TXQ0 to 1, and - ** Link (other) to 2, hence the magic number. - */ - E1000_WRITE_REG(&adapter->hw, E1000_IVAR, 0x800A0908); - } - #ifdef DEVICE_POLLING /* * Only enable interrupts if we are not polling, make sure @@ -1282,7 +1262,6 @@ } #endif /* DEVICE_POLLING */ -#ifdef EM_LEGACY_IRQ /********************************************************************* * * Legacy Interrupt Service routine @@ -1296,7 +1275,8 @@ u32 reg_icr; - if (ifp->if_capenable & IFCAP_POLLING) + if ((ifp->if_capenable & IFCAP_POLLING) || + ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)) return; EM_CORE_LOCK(adapter); @@ -1304,11 +1284,10 @@ if (reg_icr & E1000_ICR_RXO) adapter->rx_overruns++; - if ((reg_icr == 0xffffffff) || (reg_icr == 0)) - goto out; - - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) - goto out; + if ((reg_icr == 0xffffffff) || (reg_icr == 0)) { + EM_CORE_UNLOCK(adapter); + return; + } if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { callout_stop(&adapter->timer); @@ -1318,23 +1297,22 @@ lem_tx_purge(adapter); callout_reset(&adapter->timer, hz, lem_local_timer, adapter); - goto out; + EM_CORE_UNLOCK(adapter); + return; } - EM_TX_LOCK(adapter); + EM_CORE_UNLOCK(adapter); lem_rxeof(adapter, -1, NULL); + + EM_TX_LOCK(adapter); lem_txeof(adapter); if (ifp->if_drv_flags & IFF_DRV_RUNNING && !IFQ_DRV_IS_EMPTY(&ifp->if_snd)) lem_start_locked(ifp); EM_TX_UNLOCK(adapter); - -out: - EM_CORE_UNLOCK(adapter); return; } -#else /* EM_FAST_IRQ, then fast interrupt routines only */ static void lem_handle_link(void *context, int pending) @@ -1418,7 +1396,6 @@ adapter->rx_overruns++; return FILTER_HANDLED; } -#endif /* ~EM_LEGACY_IRQ */ /********************************************************************* @@ -2215,19 +2192,21 @@ return (ENXIO); } -#ifdef EM_LEGACY_IRQ - /* We do Legacy setup */ - if ((error = bus_setup_intr(dev, adapter->res[0], - INTR_TYPE_NET | INTR_MPSAFE, NULL, lem_intr, adapter, - &adapter->tag[0])) != 0) { - device_printf(dev, "Failed to register interrupt handler"); - return (error); + /* Do Legacy setup? */ + if (lem_use_legacy_irq) { + if ((error = bus_setup_intr(dev, adapter->res[0], + INTR_TYPE_NET | INTR_MPSAFE, NULL, lem_intr, adapter, + &adapter->tag[0])) != 0) { + device_printf(dev, + "Failed to register interrupt handler"); + return (error); + } + return (0); } -#else /* FAST_IRQ */ /* - * Try allocating a fast interrupt and the associated deferred - * processing contexts. + * Use a Fast interrupt and the associated + * deferred processing contexts. */ TASK_INIT(&adapter->rxtx_task, 0, lem_handle_rxtx, adapter); TASK_INIT(&adapter->link_task, 0, lem_handle_link, adapter); @@ -2244,7 +2223,6 @@ adapter->tq = NULL; return (error); } -#endif /* EM_LEGACY_IRQ */ return (0); } @@ -3302,20 +3280,6 @@ E1000_WRITE_REG(&adapter->hw, E1000_ITR, DEFAULT_ITR); } - /* - ** When using MSIX interrupts we need to throttle - ** using the EITR register (82574 only) - */ - if (adapter->msix) - for (int i = 0; i < 4; i++) - E1000_WRITE_REG(&adapter->hw, - E1000_EITR_82574(i), DEFAULT_ITR); - - /* Disable accelerated ackknowledge */ - if (adapter->hw.mac.type == e1000_82574) - E1000_WRITE_REG(&adapter->hw, - E1000_RFCTL, E1000_RFCTL_ACK_DIS); - /* Setup the Base and Length of the Rx Descriptor Ring */ bus_addr = adapter->rxdma.dma_paddr; E1000_WRITE_REG(&adapter->hw, E1000_RDLEN(0), @@ -3835,10 +3799,6 @@ struct e1000_hw *hw = &adapter->hw; u32 ims_mask = IMS_ENABLE_MASK; - if (adapter->msix) { - E1000_WRITE_REG(hw, EM_EIAC, EM_MSIX_MASK); - ims_mask |= EM_MSIX_MASK; - } E1000_WRITE_REG(hw, E1000_IMS, ims_mask); } @@ -3847,9 +3807,7 @@ { struct e1000_hw *hw = &adapter->hw; - if (adapter->msix) - E1000_WRITE_REG(hw, EM_EIAC, 0); - E1000_WRITE_REG(&adapter->hw, E1000_IMC, 0xffffffff); + E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff); } /* @@ -4683,7 +4641,6 @@ OID_AUTO, name, CTLTYPE_INT|CTLFLAG_RW, limit, value, description); } -#ifndef EM_LEGACY_IRQ static void lem_add_rx_process_limit(struct adapter *adapter, const char *name, const char *description, int *limit, int value) @@ -4693,4 +4650,3 @@ SYSCTL_CHILDREN(device_get_sysctl_tree(adapter->dev)), OID_AUTO, name, CTLTYPE_INT|CTLFLAG_RW, limit, value, description); } -#endif On Tue, Jul 31, 2012 at 9:29 AM, Garrett Cooper wrote: > On Tue, Jul 31, 2012 at 9:20 AM, Jack Vogel wrote: > > Yes, I agree John, that was ugly, I'm already taking care of it with my > > changes, > > I'll send you a copy to check out. > > Like so: > > --- //depot/user/gcooper/atf-head/src/sys/dev/e1000/if_lem.c > 2012-07-25 17:11:00.000000000 0000 > +++ /scratch/p4/user/gcooper/atf-head/src/sys/dev/e1000/if_lem.c > 2012-07-25 17:11:00.000000000 0000 > @@ -1320,9 +1320,10 @@ > lem_local_timer, adapter); > goto out; > } > + EM_CORE_UNLOCK(adapter); > > + lem_rxeof(adapter, -1, NULL); > EM_TX_LOCK(adapter); > - lem_rxeof(adapter, -1, NULL); > lem_txeof(adapter); > if (ifp->if_drv_flags & IFF_DRV_RUNNING && > !IFQ_DRV_IS_EMPTY(&ifp->if_snd)) > @@ -1330,8 +1331,8 @@ > EM_TX_UNLOCK(adapter); > > out: > - EM_CORE_UNLOCK(adapter); > - return; > + if (mtx_owned(&adapter->core_mtx)) > + EM_CORE_UNLOCK(adapter); > } > > #else /* EM_FAST_IRQ, then fast interrupt routines only */ > --20cf307ca184df215a04c623c32a-- From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 17:59:43 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8AA2E106566B; Tue, 31 Jul 2012 17:59:43 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 597F28FC0C; Tue, 31 Jul 2012 17:59:43 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id AF8E8B94A; Tue, 31 Jul 2012 13:59:42 -0400 (EDT) From: John Baldwin To: Garrett Cooper Date: Tue, 31 Jul 2012 13:43:31 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p17; KDE/4.5.5; amd64; ; ) References: <201207251128.q6PBSFlt052575@svn.freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201207311343.31777.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 31 Jul 2012 13:59:42 -0400 (EDT) Cc: Adrian Chadd , src-committers@freebsd.org, svn-src-all@freebsd.org, Andrey Zonov , Luigi Rizzo , Jack Vogel , svn-src-head@freebsd.org Subject: Re: svn commit: r238765 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 17:59:43 -0000 On Tuesday, July 31, 2012 12:29:32 pm Garrett Cooper wrote: > On Tue, Jul 31, 2012 at 9:20 AM, Jack Vogel wrote: > > Yes, I agree John, that was ugly, I'm already taking care of it with my > > changes, > > I'll send you a copy to check out. > > Like so: > > --- //depot/user/gcooper/atf-head/src/sys/dev/e1000/if_lem.c > 2012-07-25 17:11:00.000000000 0000 > +++ /scratch/p4/user/gcooper/atf-head/src/sys/dev/e1000/if_lem.c > 2012-07-25 17:11:00.000000000 0000 > @@ -1320,9 +1320,10 @@ > lem_local_timer, adapter); > goto out; > } > + EM_CORE_UNLOCK(adapter); > > + lem_rxeof(adapter, -1, NULL); > EM_TX_LOCK(adapter); > - lem_rxeof(adapter, -1, NULL); > lem_txeof(adapter); > if (ifp->if_drv_flags & IFF_DRV_RUNNING && > !IFQ_DRV_IS_EMPTY(&ifp->if_snd)) > @@ -1330,8 +1331,8 @@ > EM_TX_UNLOCK(adapter); > > out: > - EM_CORE_UNLOCK(adapter); > - return; > + if (mtx_owned(&adapter->core_mtx)) > + EM_CORE_UNLOCK(adapter); > } No, mtx_owned() is equally bad (I'd rather people be intentional about what locks they hold when, mtx_owned() allows people to be lazy IMO). Just do this: EM_TX_UNLOCK(adapter); return; out: EM_CORE_UNLOCK(adapter); } -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 18:03:06 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B7781065672; Tue, 31 Jul 2012 18:03:06 +0000 (UTC) (envelope-from seanbru@yahoo-inc.com) Received: from mrout2-b.corp.bf1.yahoo.com (mrout2-b.corp.bf1.yahoo.com [98.139.253.105]) by mx1.freebsd.org (Postfix) with ESMTP id C72878FC0A; Tue, 31 Jul 2012 18:03:05 +0000 (UTC) Received: from [IPv6:::1] (rideseveral.corp.yahoo.com [10.73.160.231]) by mrout2-b.corp.bf1.yahoo.com (8.14.4/8.14.4/y.out) with ESMTP id q6VI2jRR023877; Tue, 31 Jul 2012 11:02:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yahoo-inc.com; s=cobra; t=1343757766; bh=24m88A93xrXbV8Mg0j0xaL3l1OojBl95Q3jTdyMHSA8=; h=Subject:From:To:Cc:In-Reply-To:References:Content-Type:Date: Message-ID:Mime-Version:Content-Transfer-Encoding; b=NmfFQxmUntzMbTfW59cvdXvouop/tqnuvHFIC+4Ie0m4pbUIrJziZPmcl5oDBK9Be BPbJhxp7wuhHK/vT0jOf4SV3DuJgynDhBuqXI+Y8C7p9jHu1xdyTFCmpFGWDfPHUmn Rd0Th7mvbzuo012dZ75u36KHhhVWf/Q9xXzmcI4A= From: Sean Bruno To: Alexander Motin In-Reply-To: <1343751146.2957.3.camel@powernoodle.corp.yahoo.com> References: <201207311058.q6VAwp18019777@svn.freebsd.org> <1343751146.2957.3.camel@powernoodle.corp.yahoo.com> Content-Type: text/plain; charset="UTF-8" Date: Tue, 31 Jul 2012 11:02:44 -0700 Message-ID: <1343757764.2957.12.camel@powernoodle.corp.yahoo.com> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit X-Milter-Version: master.31+4-gbc07cd5+ X-CLX-ID: 757765001 Cc: "svn-src-head@FreeBSD.org" , "svn-src-all@FreeBSD.org" , "src-committers@FreeBSD.org" Subject: Re: svn commit: r238943 - head/sys/dev/acpica X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 18:03:06 -0000 On Tue, 2012-07-31 at 09:12 -0700, Sean Bruno wrote: > On Tue, 2012-07-31 at 03:58 -0700, Alexander Motin wrote: > > To help with diagnostics, add C-state type into > > dev.cpu.X.cx_supported. > > Pretty sure that this breaks /etc/rc.d/power_profile > > Andiry and I went back and forth on this specific thing quite a bit. If > you note my commit/revert at svn r238004 and r238009 where I did a > similar thing and then had to yank it out. > > there's a lot of discussion around this point on the acpi mailing lists. > http://lists.freebsd.org/pipermail/freebsd-acpi/2012-July/007645.html > > Sean > Upon further review and discussion, I remove my objection to this commit. It does *not* break power_profile in my test cases. sean From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 18:09:38 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 355B1106566C; Tue, 31 Jul 2012 18:09:38 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 057818FC15; Tue, 31 Jul 2012 18:09:38 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 603BDB94A; Tue, 31 Jul 2012 14:09:37 -0400 (EDT) From: John Baldwin To: Jack Vogel Date: Tue, 31 Jul 2012 14:09:25 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p17; KDE/4.5.5; amd64; ; ) References: <201207251128.q6PBSFlt052575@svn.freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201207311409.25080.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 31 Jul 2012 14:09:37 -0400 (EDT) Cc: Adrian Chadd , src-committers@freebsd.org, Garrett Cooper , svn-src-all@freebsd.org, Andrey Zonov , Luigi Rizzo , svn-src-head@freebsd.org Subject: Re: svn commit: r238765 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 18:09:38 -0000 On Tuesday, July 31, 2012 1:46:59 pm Jack Vogel wrote: > No, like so: This looks good to me. The 82574 is supported by em(4) and not lem(4) it seems, hence removing that? -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 18:11:26 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C2BE1065679; Tue, 31 Jul 2012 18:11:26 +0000 (UTC) (envelope-from jfvogel@gmail.com) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id A6D018FC22; Tue, 31 Jul 2012 18:11:25 +0000 (UTC) Received: by vcbgb22 with SMTP id gb22so7404616vcb.13 for ; Tue, 31 Jul 2012 11:11:25 -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=tJ21HmYcDhSpuFEjSD1RXk/POZikjCTCJSbymKW7Bn4=; b=RIFKcY9ecZ8f3d9ICMMMs63dpqNkQqfOPuCx5Fxk7JlJDNAQd/Kz3clD+pbq5bcF29 nSElya1F8u/+TOBEoI3L5gGJ6FZQpOExofWPMbFkAlzPnzSdc3wKlXV37PJD8dhxacmv rM/6Soa9UztB7rrNSyi4rGL3c5YC/p0FeCKUp0pK7/ClXKw85/3a82i4J+6F13/3yfus U0J3IzeIW4nBeSgkEfVNeebjPCNgEIZ9f0nl0V4MONOgF4HAIzfpzrJevdBOT2yHBGu5 rLu14PxN7w3rYAyMgHxfAKlwIKDQo+6WKyG3CmNoQK9QPazl7Hk0hWKO52Iv6Xz/v912 oZsg== MIME-Version: 1.0 Received: by 10.52.95.116 with SMTP id dj20mr13029441vdb.39.1343758285154; Tue, 31 Jul 2012 11:11:25 -0700 (PDT) Received: by 10.58.187.225 with HTTP; Tue, 31 Jul 2012 11:11:25 -0700 (PDT) In-Reply-To: <201207311409.25080.jhb@freebsd.org> References: <201207251128.q6PBSFlt052575@svn.freebsd.org> <201207311409.25080.jhb@freebsd.org> Date: Tue, 31 Jul 2012 11:11:25 -0700 Message-ID: From: Jack Vogel To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Adrian Chadd , src-committers@freebsd.org, Garrett Cooper , svn-src-all@freebsd.org, Andrey Zonov , Luigi Rizzo , svn-src-head@freebsd.org Subject: Re: svn commit: r238765 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 18:11:26 -0000 Right, that code got left in lem when i split it off from em by mistake, just cleaning that up. Will commit this then. Jack On Tue, Jul 31, 2012 at 11:09 AM, John Baldwin wrote: > On Tuesday, July 31, 2012 1:46:59 pm Jack Vogel wrote: > > No, like so: > > This looks good to me. The 82574 is supported by em(4) and not lem(4) it > seems, hence removing that? > > -- > John Baldwin > From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 18:25:01 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9B8C0106564A; Tue, 31 Jul 2012 18:25:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 801D68FC16; Tue, 31 Jul 2012 18:25:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6VIP1fI056988; Tue, 31 Jul 2012 18:25:01 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6VIP113056983; Tue, 31 Jul 2012 18:25:01 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201207311825.q6VIP113056983@svn.freebsd.org> From: John Baldwin Date: Tue, 31 Jul 2012 18:25:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238952 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 18:25:01 -0000 Author: jhb Date: Tue Jul 31 18:25:00 2012 New Revision: 238952 URL: http://svn.freebsd.org/changeset/base/238952 Log: Reorder the managament of advisory locks on open files so that the advisory lock is obtained before the write count is increased during open() and the lock is released after the write count is decreased during close(). The first change closes a race where an open() that will block with O_SHLOCK or O_EXLOCK can increase the write count while it waits. If the process holding the current lock on the file then tries to call exec() on the file it has locked, it can fail with ETXTBUSY even though the advisory lock is preventing other threads from succesfully completeing a writable open(). The second change closes a race where a read-only open() with O_SHLOCK or O_EXLOCK may return successfully while the write count is non-zero due to another descriptor that had the advisory lock and was blocking the open() still being in the process of closing. If the process that completed the open() then attempts to call exec() on the file it locked, it can fail with ETXTBUSY even though the other process that held a write lock has closed the file and released the lock. Reviewed by: kib MFC after: 1 month Modified: head/sys/kern/vfs_syscalls.c head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Tue Jul 31 17:32:28 2012 (r238951) +++ head/sys/kern/vfs_syscalls.c Tue Jul 31 18:25:00 2012 (r238952) @@ -1093,8 +1093,7 @@ kern_openat(struct thread *td, int fd, c struct file *fp; struct vnode *vp; int cmode; - int type, indx = -1, error; - struct flock lf; + int indx = -1, error; struct nameidata nd; int vfslocked; cap_rights_t rights_needed = CAP_LOOKUP; @@ -1180,26 +1179,11 @@ kern_openat(struct thread *td, int fd, c if (fp->f_ops == &badfileops) { KASSERT(vp->v_type != VFIFO, ("Unexpected fifo.")); fp->f_seqcount = 1; - finit(fp, flags & FMASK, DTYPE_VNODE, vp, &vnops); + finit(fp, (flags & FMASK) | (fp->f_flag & FHASLOCK), DTYPE_VNODE, + vp, &vnops); } VOP_UNLOCK(vp, 0); - if (fp->f_type == DTYPE_VNODE && (flags & (O_EXLOCK | O_SHLOCK)) != 0) { - lf.l_whence = SEEK_SET; - lf.l_start = 0; - lf.l_len = 0; - if (flags & O_EXLOCK) - lf.l_type = F_WRLCK; - else - lf.l_type = F_RDLCK; - type = F_FLOCK; - if ((flags & FNONBLOCK) == 0) - type |= F_WAIT; - if ((error = VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf, - type)) != 0) - goto bad; - atomic_set_int(&fp->f_flag, FHASLOCK); - } if (flags & O_TRUNC) { error = fo_truncate(fp, 0, td->td_ucred, td); if (error) @@ -4483,9 +4467,8 @@ sys_fhopen(td, uap) struct mount *mp; struct vnode *vp; struct fhandle fhp; - struct flock lf; struct file *fp; - int fmode, error, type; + int fmode, error; int vfslocked; int indx; @@ -4542,24 +4525,9 @@ sys_fhopen(td, uap) #endif fp->f_vnode = vp; fp->f_seqcount = 1; - finit(fp, fmode & FMASK, DTYPE_VNODE, vp, &vnops); + finit(fp, (fmode & FMASK) | (fp->f_flag & FHASLOCK), DTYPE_VNODE, vp, + &vnops); VOP_UNLOCK(vp, 0); - if (fmode & (O_EXLOCK | O_SHLOCK)) { - lf.l_whence = SEEK_SET; - lf.l_start = 0; - lf.l_len = 0; - if (fmode & O_EXLOCK) - lf.l_type = F_WRLCK; - else - lf.l_type = F_RDLCK; - type = F_FLOCK; - if ((fmode & FNONBLOCK) == 0) - type |= F_WAIT; - if ((error = VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf, - type)) != 0) - goto bad; - atomic_set_int(&fp->f_flag, FHASLOCK); - } if (fmode & O_TRUNC) { error = fo_truncate(fp, 0, td->td_ucred, td); if (error) Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Tue Jul 31 17:32:28 2012 (r238951) +++ head/sys/kern/vfs_vnops.c Tue Jul 31 18:25:00 2012 (r238952) @@ -229,8 +229,10 @@ int vn_open_vnode(struct vnode *vp, int fmode, struct ucred *cred, struct thread *td, struct file *fp) { + struct mount *mp; accmode_t accmode; - int error; + struct flock lf; + int error, have_flock, lock_flags, type; VFS_ASSERT_GIANT(vp->v_mount); if (vp->v_type == VLNK) @@ -271,6 +273,51 @@ vn_open_vnode(struct vnode *vp, int fmod if ((error = VOP_OPEN(vp, fmode, cred, td, fp)) != 0) return (error); + if (fmode & (O_EXLOCK | O_SHLOCK)) { + KASSERT(fp != NULL, ("open with flock requires fp")); + lock_flags = VOP_ISLOCKED(vp); + VOP_UNLOCK(vp, 0); + lf.l_whence = SEEK_SET; + lf.l_start = 0; + lf.l_len = 0; + if (fmode & O_EXLOCK) + lf.l_type = F_WRLCK; + else + lf.l_type = F_RDLCK; + type = F_FLOCK; + if ((fmode & FNONBLOCK) == 0) + type |= F_WAIT; + error = VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf, type); + have_flock = (error == 0); + vn_lock(vp, lock_flags | LK_RETRY); + if (error == 0 && vp->v_iflag & VI_DOOMED) + error = ENOENT; + /* + * Another thread might have used this vnode as an + * executable while the vnode lock was dropped. + * Ensure the vnode is still able to be opened for + * writing after the lock has been obtained. + */ + if (error == 0 && accmode & VWRITE) + error = vn_writechk(vp); + if (error) { + VOP_UNLOCK(vp, 0); + if (have_flock) { + lf.l_whence = SEEK_SET; + lf.l_start = 0; + lf.l_len = 0; + lf.l_type = F_UNLCK; + (void) VOP_ADVLOCK(vp, fp, F_UNLCK, &lf, + F_FLOCK); + } + vn_start_write(vp, &mp, V_WAIT); + vn_lock(vp, lock_flags | LK_RETRY); + (void)VOP_CLOSE(vp, fmode, cred, td); + vn_finished_write(mp); + return (error); + } + fp->f_flag |= FHASLOCK; + } if (fmode & FWRITE) { vp->v_writecount++; CTR3(KTR_VFS, "%s: vp %p v_writecount increased to %d", @@ -1400,19 +1447,22 @@ vn_closefile(fp, td) int error; vp = fp->f_vnode; + fp->f_ops = &badfileops; vfslocked = VFS_LOCK_GIANT(vp->v_mount); + if (fp->f_type == DTYPE_VNODE && fp->f_flag & FHASLOCK) + vref(vp); + + error = vn_close(vp, fp->f_flag, fp->f_cred, td); + if (fp->f_type == DTYPE_VNODE && fp->f_flag & FHASLOCK) { lf.l_whence = SEEK_SET; lf.l_start = 0; lf.l_len = 0; lf.l_type = F_UNLCK; (void) VOP_ADVLOCK(vp, fp, F_UNLCK, &lf, F_FLOCK); + vrele(vp); } - - fp->f_ops = &badfileops; - - error = vn_close(vp, fp->f_flag, fp->f_cred, td); VFS_UNLOCK_GIANT(vfslocked); return (error); } From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 18:44:10 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5811106566B; Tue, 31 Jul 2012 18:44:10 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CF43A8FC18; Tue, 31 Jul 2012 18:44:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6VIiAcY058979; Tue, 31 Jul 2012 18:44:10 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6VIiAes058977; Tue, 31 Jul 2012 18:44:10 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201207311844.q6VIiAes058977@svn.freebsd.org> From: Jack F Vogel Date: Tue, 31 Jul 2012 18:44:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238953 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 18:44:11 -0000 Author: jfv Date: Tue Jul 31 18:44:10 2012 New Revision: 238953 URL: http://svn.freebsd.org/changeset/base/238953 Log: Clean up some unused leftover code from em Make IRQ style a tuneable Fix lock handling in the interrupt handler MFC after:3 days Modified: head/sys/dev/e1000/if_lem.c Modified: head/sys/dev/e1000/if_lem.c ============================================================================== --- head/sys/dev/e1000/if_lem.c Tue Jul 31 18:25:00 2012 (r238952) +++ head/sys/dev/e1000/if_lem.c Tue Jul 31 18:44:10 2012 (r238953) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2011, Intel Corporation + Copyright (c) 2001-2012, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -85,7 +85,7 @@ /********************************************************************* * Legacy Em Driver version: *********************************************************************/ -char lem_driver_version[] = "1.0.4"; +char lem_driver_version[] = "1.0.5"; /********************************************************************* * PCI Device ID Table @@ -239,16 +239,12 @@ static void lem_enable_wakeup(device static int lem_enable_phy_wakeup(struct adapter *); static void lem_led_func(void *, int); -#define EM_LEGACY_IRQ /* slightly faster, at least in qemu */ -#ifdef EM_LEGACY_IRQ static void lem_intr(void *); -#else /* FAST IRQ */ static int lem_irq_fast(void *); static void lem_handle_rxtx(void *context, int pending); static void lem_handle_link(void *context, int pending); static void lem_add_rx_process_limit(struct adapter *, const char *, const char *, int *, int); -#endif /* ~EM_LEGACY_IRQ */ #ifdef DEVICE_POLLING static poll_handler_t lem_poll; @@ -305,11 +301,13 @@ TUNABLE_INT("hw.em.txd", &lem_txd); TUNABLE_INT("hw.em.smart_pwr_down", &lem_smart_pwr_down); TUNABLE_INT("hw.em.sbp", &lem_debug_sbp); -#ifndef EM_LEGACY_IRQ +/* Interrupt style - default to fast */ +static int lem_use_legacy_irq = 0; +TUNABLE_INT("hw.em.use_legacy_irq", &lem_use_legacy_irq); + /* How many packets rxeof tries to clean at a time */ static int lem_rx_process_limit = 100; TUNABLE_INT("hw.em.rx_process_limit", &lem_rx_process_limit); -#endif /* Flow control setting - default to FULL */ static int lem_fc_setting = e1000_fc_full; @@ -451,12 +449,10 @@ lem_attach(device_t dev) lem_tx_abs_int_delay_dflt); } -#ifndef EM_LEGACY_IRQ /* Sysctls for limiting the amount of work done in the taskqueue */ lem_add_rx_process_limit(adapter, "rx_processing_limit", "max number of rx packets to process", &adapter->rx_process_limit, lem_rx_process_limit); -#endif /* Sysctl for setting the interface flow control */ lem_set_flow_cntrl(adapter, "flow_control", @@ -1198,22 +1194,6 @@ lem_init_locked(struct adapter *adapter) callout_reset(&adapter->timer, hz, lem_local_timer, adapter); e1000_clear_hw_cntrs_base_generic(&adapter->hw); - /* MSI/X configuration for 82574 */ - if (adapter->hw.mac.type == e1000_82574) { - int tmp; - tmp = E1000_READ_REG(&adapter->hw, E1000_CTRL_EXT); - tmp |= E1000_CTRL_EXT_PBA_CLR; - E1000_WRITE_REG(&adapter->hw, E1000_CTRL_EXT, tmp); - /* - ** Set the IVAR - interrupt vector routing. - ** Each nibble represents a vector, high bit - ** is enable, other 3 bits are the MSIX table - ** entry, we map RXQ0 to 0, TXQ0 to 1, and - ** Link (other) to 2, hence the magic number. - */ - E1000_WRITE_REG(&adapter->hw, E1000_IVAR, 0x800A0908); - } - #ifdef DEVICE_POLLING /* * Only enable interrupts if we are not polling, make sure @@ -1282,7 +1262,6 @@ lem_poll(struct ifnet *ifp, enum poll_cm } #endif /* DEVICE_POLLING */ -#ifdef EM_LEGACY_IRQ /********************************************************************* * * Legacy Interrupt Service routine @@ -1296,7 +1275,8 @@ lem_intr(void *arg) u32 reg_icr; - if (ifp->if_capenable & IFCAP_POLLING) + if ((ifp->if_capenable & IFCAP_POLLING) || + ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)) return; EM_CORE_LOCK(adapter); @@ -1304,11 +1284,10 @@ lem_intr(void *arg) if (reg_icr & E1000_ICR_RXO) adapter->rx_overruns++; - if ((reg_icr == 0xffffffff) || (reg_icr == 0)) - goto out; - - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) - goto out; + if ((reg_icr == 0xffffffff) || (reg_icr == 0)) { + EM_CORE_UNLOCK(adapter); + return; + } if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { callout_stop(&adapter->timer); @@ -1318,23 +1297,22 @@ lem_intr(void *arg) lem_tx_purge(adapter); callout_reset(&adapter->timer, hz, lem_local_timer, adapter); - goto out; + EM_CORE_UNLOCK(adapter); + return; } - EM_TX_LOCK(adapter); + EM_CORE_UNLOCK(adapter); lem_rxeof(adapter, -1, NULL); + + EM_TX_LOCK(adapter); lem_txeof(adapter); if (ifp->if_drv_flags & IFF_DRV_RUNNING && !IFQ_DRV_IS_EMPTY(&ifp->if_snd)) lem_start_locked(ifp); EM_TX_UNLOCK(adapter); - -out: - EM_CORE_UNLOCK(adapter); return; } -#else /* EM_FAST_IRQ, then fast interrupt routines only */ static void lem_handle_link(void *context, int pending) @@ -1418,7 +1396,6 @@ lem_irq_fast(void *arg) adapter->rx_overruns++; return FILTER_HANDLED; } -#endif /* ~EM_LEGACY_IRQ */ /********************************************************************* @@ -2215,19 +2192,21 @@ lem_allocate_irq(struct adapter *adapter return (ENXIO); } -#ifdef EM_LEGACY_IRQ - /* We do Legacy setup */ - if ((error = bus_setup_intr(dev, adapter->res[0], - INTR_TYPE_NET | INTR_MPSAFE, NULL, lem_intr, adapter, - &adapter->tag[0])) != 0) { - device_printf(dev, "Failed to register interrupt handler"); - return (error); + /* Do Legacy setup? */ + if (lem_use_legacy_irq) { + if ((error = bus_setup_intr(dev, adapter->res[0], + INTR_TYPE_NET | INTR_MPSAFE, NULL, lem_intr, adapter, + &adapter->tag[0])) != 0) { + device_printf(dev, + "Failed to register interrupt handler"); + return (error); + } + return (0); } -#else /* FAST_IRQ */ /* - * Try allocating a fast interrupt and the associated deferred - * processing contexts. + * Use a Fast interrupt and the associated + * deferred processing contexts. */ TASK_INIT(&adapter->rxtx_task, 0, lem_handle_rxtx, adapter); TASK_INIT(&adapter->link_task, 0, lem_handle_link, adapter); @@ -2244,7 +2223,6 @@ lem_allocate_irq(struct adapter *adapter adapter->tq = NULL; return (error); } -#endif /* EM_LEGACY_IRQ */ return (0); } @@ -3302,20 +3280,6 @@ lem_initialize_receive_unit(struct adapt E1000_WRITE_REG(&adapter->hw, E1000_ITR, DEFAULT_ITR); } - /* - ** When using MSIX interrupts we need to throttle - ** using the EITR register (82574 only) - */ - if (adapter->msix) - for (int i = 0; i < 4; i++) - E1000_WRITE_REG(&adapter->hw, - E1000_EITR_82574(i), DEFAULT_ITR); - - /* Disable accelerated ackknowledge */ - if (adapter->hw.mac.type == e1000_82574) - E1000_WRITE_REG(&adapter->hw, - E1000_RFCTL, E1000_RFCTL_ACK_DIS); - /* Setup the Base and Length of the Rx Descriptor Ring */ bus_addr = adapter->rxdma.dma_paddr; E1000_WRITE_REG(&adapter->hw, E1000_RDLEN(0), @@ -3835,10 +3799,6 @@ lem_enable_intr(struct adapter *adapter) struct e1000_hw *hw = &adapter->hw; u32 ims_mask = IMS_ENABLE_MASK; - if (adapter->msix) { - E1000_WRITE_REG(hw, EM_EIAC, EM_MSIX_MASK); - ims_mask |= EM_MSIX_MASK; - } E1000_WRITE_REG(hw, E1000_IMS, ims_mask); } @@ -3847,9 +3807,7 @@ lem_disable_intr(struct adapter *adapter { struct e1000_hw *hw = &adapter->hw; - if (adapter->msix) - E1000_WRITE_REG(hw, EM_EIAC, 0); - E1000_WRITE_REG(&adapter->hw, E1000_IMC, 0xffffffff); + E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff); } /* @@ -4683,7 +4641,6 @@ lem_set_flow_cntrl(struct adapter *adapt OID_AUTO, name, CTLTYPE_INT|CTLFLAG_RW, limit, value, description); } -#ifndef EM_LEGACY_IRQ static void lem_add_rx_process_limit(struct adapter *adapter, const char *name, const char *description, int *limit, int value) @@ -4693,4 +4650,3 @@ lem_add_rx_process_limit(struct adapter SYSCTL_CHILDREN(device_get_sysctl_tree(adapter->dev)), OID_AUTO, name, CTLTYPE_INT|CTLFLAG_RW, limit, value, description); } -#endif From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 18:47:17 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EBB7D106566C; Tue, 31 Jul 2012 18:47:17 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D62688FC15; Tue, 31 Jul 2012 18:47:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6VIlHdV059381; Tue, 31 Jul 2012 18:47:17 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6VIlHpl059379; Tue, 31 Jul 2012 18:47:17 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207311847.q6VIlHpl059379@svn.freebsd.org> From: Adrian Chadd Date: Tue, 31 Jul 2012 18:47:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238954 - head/sys/dev/pccbb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 18:47:18 -0000 Author: adrian Date: Tue Jul 31 18:47:17 2012 New Revision: 238954 URL: http://svn.freebsd.org/changeset/base/238954 Log: Restore the PCI bridge configuration upon resume. This allows my TI1510 cardbus/PCI bridge to work after a suspend/resume, without having to unload/reload the cbb driver. I've also tested this on stable/9. I'll MFC it shortly. PR: kern/170058 Reviewed by: jhb MFC after: 1 day Modified: head/sys/dev/pccbb/pccbb_pci.c Modified: head/sys/dev/pccbb/pccbb_pci.c ============================================================================== --- head/sys/dev/pccbb/pccbb_pci.c Tue Jul 31 18:44:10 2012 (r238953) +++ head/sys/dev/pccbb/pccbb_pci.c Tue Jul 31 18:47:17 2012 (r238954) @@ -465,6 +465,11 @@ cbb_chipinit(struct cbb_softc *sc) if (pci_read_config(sc->dev, PCIR_LATTIMER, 1) < 0x20) pci_write_config(sc->dev, PCIR_LATTIMER, 0x20, 1); + /* Restore bus configuration */ + pci_write_config(sc->dev, PCIR_PRIBUS_2, sc->pribus, 1); + pci_write_config(sc->dev, PCIR_SECBUS_2, sc->secbus, 1); + pci_write_config(sc->dev, PCIR_SUBBUS_2, sc->subbus, 1); + /* Enable memory access */ PCI_MASK_CONFIG(sc->dev, PCIR_COMMAND, | PCIM_CMD_MEMEN From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 19:07:59 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A41D1106566B; Tue, 31 Jul 2012 19:07:59 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 793368FC14; Tue, 31 Jul 2012 19:07:59 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id CC140B926; Tue, 31 Jul 2012 15:07:58 -0400 (EDT) From: John Baldwin To: src-committers@freebsd.org Date: Tue, 31 Jul 2012 15:07:57 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p17; KDE/4.5.5; amd64; ; ) References: <201207311825.q6VIP113056983@svn.freebsd.org> In-Reply-To: <201207311825.q6VIP113056983@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201207311507.57986.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 31 Jul 2012 15:07:58 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r238952 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 19:07:59 -0000 On Tuesday, July 31, 2012 2:25:01 pm John Baldwin wrote: > Author: jhb > Date: Tue Jul 31 18:25:00 2012 > New Revision: 238952 > URL: http://svn.freebsd.org/changeset/base/238952 > > Log: > Reorder the managament of advisory locks on open files so that the advisory > lock is obtained before the write count is increased during open() and the > lock is released after the write count is decreased during close(). > > The first change closes a race where an open() that will block with O_SHLOCK > or O_EXLOCK can increase the write count while it waits. If the process > holding the current lock on the file then tries to call exec() on the file > it has locked, it can fail with ETXTBUSY even though the advisory lock is > preventing other threads from succesfully completeing a writable open(). > > The second change closes a race where a read-only open() with O_SHLOCK or > O_EXLOCK may return successfully while the write count is non-zero due to > another descriptor that had the advisory lock and was blocking the open() > still being in the process of closing. If the process that completed the > open() then attempts to call exec() on the file it locked, it can fail with > ETXTBUSY even though the other process that held a write lock has closed > the file and released the lock. > > Reviewed by: kib > MFC after: 1 month Oops, should have included: Tested by: pho I have a regression test (of sorts) for this. If you run it on an unpatched system it should start emitting errors within a few seconds. #include #include #include #include #include #include #include #include #include static void usage(void) { fprintf(stderr, "Usage: flock_close_race [args]\n"); exit(1); } static void child(const char *binary) { int fd; /* Exit as soon as our parent exits. */ while (getppid() != 1) { fd = open(binary, O_RDWR | O_EXLOCK); if (fd < 0) { /* * This may get ETXTBSY since exit() will * close its open fd's (thus releasing the * lock), before it releases the vmspace (and * mapping of the binary). */ if (errno == ETXTBSY) continue; err(1, "can't open %s", binary); } close(fd); } exit(0); } static void exec_child(char **av) { int fd; fd = open(av[0], O_RDONLY | O_SHLOCK); execv(av[0], av); err(127, "execv"); } int main(int ac, char **av) { struct stat sb; pid_t pid; if (ac < 2) usage(); if (stat(av[1], &sb) != 0) err(1, "stat(%s)", av[1]); if (!S_ISREG(sb.st_mode)) errx(1, "%s not an executable", av[1]); pid = fork(); if (pid < 0) err(1, "fork"); if (pid == 0) child(av[1]); for (;;) { pid = fork(); if (pid < 0) err(1, "fork"); if (pid == 0) exec_child(av + 1); wait(NULL); } return (0); } -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 19:14:22 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BD9E9106564A; Tue, 31 Jul 2012 19:14:22 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8FBC18FC14; Tue, 31 Jul 2012 19:14:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6VJEMWG062142; Tue, 31 Jul 2012 19:14:22 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6VJEMir062140; Tue, 31 Jul 2012 19:14:22 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201207311914.q6VJEMir062140@svn.freebsd.org> From: Warner Losh Date: Tue, 31 Jul 2012 19:14:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238955 - head/sys/arm/at91 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 19:14:22 -0000 Author: imp Date: Tue Jul 31 19:14:22 2012 New Revision: 238955 URL: http://svn.freebsd.org/changeset/base/238955 Log: Allow chip selects other than 0. The SAM9260EK board has its dataflash on CS1. Modified: head/sys/arm/at91/at91_spi.c Modified: head/sys/arm/at91/at91_spi.c ============================================================================== --- head/sys/arm/at91/at91_spi.c Tue Jul 31 18:47:17 2012 (r238954) +++ head/sys/arm/at91/at91_spi.c Tue Jul 31 19:14:22 2012 (r238955) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include @@ -144,6 +145,7 @@ at91_spi_attach(device_t dev) * memory and APB bandwidth. * Also, currently we lack a way for lettting both the board and the * slave devices take their maximum supported SPI clocks into account. + * Also, we hard-wire SPI mode to 3. */ csr = SPI_CSR_CPOL | (4 << 16) | (0xff << 8); WR4(sc, SPI_CSR0, csr); @@ -285,7 +287,10 @@ at91_spi_transfer(device_t dev, device_t */ WR4(sc, PDC_PTCR, PDC_PTCR_TXTDIS | PDC_PTCR_RXTDIS); -#ifdef SPI_CHIPSEL_SUPPORT + /* + * PSCDEC = 0 has a range of 0..3 for chip select. We + * don't support PSCDEC = 1 which has a range of 0..15. + */ if (cmd->cs < 0 || cmd->cs > 3) { device_printf(dev, "Invalid chip select %d requested by %s\n", cmd->cs, @@ -293,18 +298,23 @@ at91_spi_transfer(device_t dev, device_t err = EINVAL; goto out; } + #ifdef SPI_CHIP_SELECT_HIGH_SUPPORT + /* + * The AT91RM9200 couldn't do CS high for CS 0. Other chips can, but we + * don't support that yet, or other spi modes. + */ if (at91_is_rm92() && cmd->cs == 0 && (cmd->flags & SPI_CHIP_SELECT_HIGH) != 0) { device_printf(dev, - "Invalid chip select high requested by %s\n", + "Invalid chip select high requested by %s for cs 0.\n", device_get_nameunit(child)); err = EINVAL; goto out; } #endif - WR4(sc, SPI_MR, (RD4(sc, SPI_MR) & ~0x000f0000) | CS_TO_MR(cmd->cs)); -#endif + err = (RD4(sc, SPI_MR) & ~0x000f0000) | CS_TO_MR(cmd->cs); + WR4(sc, SPI_MR, err); /* * Set up the TX side of the transfer. From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 19:39:21 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D059F1065670; Tue, 31 Jul 2012 19:39:21 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BAEB08FC0A; Tue, 31 Jul 2012 19:39:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6VJdLY9064394; Tue, 31 Jul 2012 19:39:21 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6VJdLth064392; Tue, 31 Jul 2012 19:39:21 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201207311939.q6VJdLth064392@svn.freebsd.org> From: Warner Losh Date: Tue, 31 Jul 2012 19:39:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238956 - head/sys/arm/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 19:39:21 -0000 Author: imp Date: Tue Jul 31 19:39:21 2012 New Revision: 238956 URL: http://svn.freebsd.org/changeset/base/238956 Log: Note about where we can boot this. Modified: head/sys/arm/conf/ATMEL Modified: head/sys/arm/conf/ATMEL ============================================================================== --- head/sys/arm/conf/ATMEL Tue Jul 31 19:14:22 2012 (r238955) +++ head/sys/arm/conf/ATMEL Tue Jul 31 19:39:21 2012 (r238956) @@ -8,7 +8,8 @@ ident ATMEL include "../at91/std.atmel" -# Arbitrary values for testing purposes. +# Typical values for most SoCs and board configurations. Will not work for +# at91sam9g45 or on some boards with non u-boot boot loaders. options STARTUP_PAGETABLE_ADDR=0x20800000 makeoptions KERNPHYSADDR=0x20000000 makeoptions KERNVIRTADDR=0xc0000000 From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 19:41:13 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13009106564A; Tue, 31 Jul 2012 19:41:13 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F183B8FC14; Tue, 31 Jul 2012 19:41:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6VJfCdG064594; Tue, 31 Jul 2012 19:41:12 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6VJfClu064589; Tue, 31 Jul 2012 19:41:12 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201207311941.q6VJfClu064589@svn.freebsd.org> From: Warner Losh Date: Tue, 31 Jul 2012 19:41:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238957 - head/sys/arm/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 19:41:13 -0000 Author: imp Date: Tue Jul 31 19:41:12 2012 New Revision: 238957 URL: http://svn.freebsd.org/changeset/base/238957 Log: Prefer ate over macb. macb doesn't work anymore, and ate has more errata workarounds in it. Modified: head/sys/arm/conf/HL201 head/sys/arm/conf/QILA9G20 head/sys/arm/conf/SAM9G20EK head/sys/arm/conf/SN9G45 Modified: head/sys/arm/conf/HL201 ============================================================================== --- head/sys/arm/conf/HL201 Tue Jul 31 19:39:21 2012 (r238956) +++ head/sys/arm/conf/HL201 Tue Jul 31 19:41:12 2012 (r238957) @@ -70,7 +70,7 @@ device random device loop device ether device uart -device macb +device ate device mii #device lxtphy Modified: head/sys/arm/conf/QILA9G20 ============================================================================== --- head/sys/arm/conf/QILA9G20 Tue Jul 31 19:39:21 2012 (r238956) +++ head/sys/arm/conf/QILA9G20 Tue Jul 31 19:41:12 2012 (r238957) @@ -86,7 +86,6 @@ device uart # Serial Ports # Ethernet device ate # Ethernet Driver -#device macb # Alternate Ethernet driver device mii option AT91_ATE_USE_RMII Modified: head/sys/arm/conf/SAM9G20EK ============================================================================== --- head/sys/arm/conf/SAM9G20EK Tue Jul 31 19:39:21 2012 (r238956) +++ head/sys/arm/conf/SAM9G20EK Tue Jul 31 19:41:12 2012 (r238957) @@ -85,7 +85,6 @@ device uart # Serial Ports # Ethernet device ate # Ethernet Driver -#device macb # Alternate Ethernet driver device mii option AT91_ATE_USE_RMII Modified: head/sys/arm/conf/SN9G45 ============================================================================== --- head/sys/arm/conf/SN9G45 Tue Jul 31 19:39:21 2012 (r238956) +++ head/sys/arm/conf/SN9G45 Tue Jul 31 19:41:12 2012 (r238957) @@ -85,7 +85,6 @@ device uart # Serial Ports # Ethernet device ate # Ethernet Driver -#device macb # Alternate Ethernet driver device mii option AT91_ATE_USE_RMII From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 23:34:07 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9B43F106566B; Tue, 31 Jul 2012 23:34:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 863498FC19; Tue, 31 Jul 2012 23:34:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6VNY7Hg085174; Tue, 31 Jul 2012 23:34:07 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6VNY7RL085172; Tue, 31 Jul 2012 23:34:07 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201207312334.q6VNY7RL085172@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 31 Jul 2012 23:34:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238960 - head/sys/netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 23:34:07 -0000 Author: bz Date: Tue Jul 31 23:34:06 2012 New Revision: 238960 URL: http://svn.freebsd.org/changeset/base/238960 Log: In case of IPsec he have to do delayed checksum calculations before adding any extension header, or rather before calling into IPsec processing as we may send the packet and not return to IPv6 output processing here. PR: kern/170116 MFC After: 3 days Modified: head/sys/netinet6/ip6_output.c Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Tue Jul 31 22:25:29 2012 (r238959) +++ head/sys/netinet6/ip6_output.c Tue Jul 31 23:34:06 2012 (r238960) @@ -306,6 +306,20 @@ ip6_output(struct mbuf *m0, struct ip6_p goto freehdrs; case -1: /* Do IPSec */ needipsec = 1; + /* + * Do delayed checksums now, as we may send before returning. + */ + if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) { + plen = m->m_pkthdr.len - sizeof(*ip6); + in6_delayed_cksum(m, plen, sizeof(struct ip6_hdr)); + m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6; + } +#ifdef SCTP + if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) { + sctp_delayed_cksum(m, sizeof(struct ip6_hdr)); + m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6; + } +#endif case 0: /* No IPSec */ default: break; From owner-svn-src-head@FreeBSD.ORG Tue Jul 31 23:54:16 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9ED7C106564A; Tue, 31 Jul 2012 23:54:16 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 897208FC21; Tue, 31 Jul 2012 23:54:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6VNsGqq086931; Tue, 31 Jul 2012 23:54:16 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6VNsGfa086926; Tue, 31 Jul 2012 23:54:16 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207312354.q6VNsGfa086926@svn.freebsd.org> From: Adrian Chadd Date: Tue, 31 Jul 2012 23:54:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238961 - in head/sys/dev/ath: . ath_rate/sample X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 31 Jul 2012 23:54:16 -0000 Author: adrian Date: Tue Jul 31 23:54:15 2012 New Revision: 238961 URL: http://svn.freebsd.org/changeset/base/238961 Log: Allow 802.11n hardware to support multi-rate retry when RTS/CTS is enabled. The legacy (pre-802.11n) hardware doesn't support this - although the AR5212 era hardware supports MRR, it doesn't have all the bits needed to support MRR + RTS/CTS. The AR5416 and later support a packet duration and RTS/CTS flags per rate scenario, so we should support it. Tested: * AR9280, STA PR: kern/170302 Modified: head/sys/dev/ath/ath_rate/sample/sample.c head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_ath_tx.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/ath_rate/sample/sample.c ============================================================================== --- head/sys/dev/ath/ath_rate/sample/sample.c Tue Jul 31 23:34:06 2012 (r238960) +++ head/sys/dev/ath/ath_rate/sample/sample.c Tue Jul 31 23:54:15 2012 (r238961) @@ -502,8 +502,10 @@ ath_rate_findrate(struct ath_softc *sc, goto done; } - /* XXX TODO: this doesn't know about 11gn vs 11g protection; teach it */ - mrr = sc->sc_mrretry && !(ic->ic_flags & IEEE80211_F_USEPROT); + mrr = sc->sc_mrretry; + /* XXX check HT protmode too */ + if (mrr && (ic->ic_flags & IEEE80211_F_USEPROT) && !sc->sc_mrrprot) + mrr = 0; best_rix = pick_best_rate(an, rt, size_bin, !mrr); if (best_rix >= 0) { @@ -910,7 +912,11 @@ ath_rate_tx_complete(struct ath_softc *s short_tries, long_tries); return; } - mrr = sc->sc_mrretry && !(ic->ic_flags & IEEE80211_F_USEPROT); + mrr = sc->sc_mrretry; + /* XXX check HT protmode too */ + if (mrr && (ic->ic_flags & IEEE80211_F_USEPROT) && !sc->sc_mrrprot) + mrr = 0; + if (!mrr || ts->ts_finaltsi == 0) { if (!IS_RATE_DEFINED(sn, final_rix)) { badrate(ifp, 0, ts->ts_rate, long_tries, status); Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Tue Jul 31 23:34:06 2012 (r238960) +++ head/sys/dev/ath/if_ath.c Tue Jul 31 23:54:15 2012 (r238961) @@ -705,6 +705,12 @@ ath_attach(u_int16_t devid, struct ath_s (void) ath_hal_settxchainmask(sc->sc_ah, tx_chainmask); } + /* + * Disable MRR with protected frames by default. + * Only 802.11n series NICs can handle this. + */ + sc->sc_mrrprot = 0; /* XXX should be a capability */ + #ifdef ATH_ENABLE_11N /* * Query HT capabilities @@ -714,6 +720,9 @@ ath_attach(u_int16_t devid, struct ath_s int rxs, txs; device_printf(sc->sc_dev, "[HT] enabling HT modes\n"); + + sc->sc_mrrprot = 1; /* XXX should be a capability */ + ic->ic_htcaps = IEEE80211_HTC_HT /* HT operation */ | IEEE80211_HTC_AMPDU /* A-MPDU tx/rx */ | IEEE80211_HTC_AMSDU /* A-MSDU tx/rx */ Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Tue Jul 31 23:34:06 2012 (r238960) +++ head/sys/dev/ath/if_ath_tx.c Tue Jul 31 23:54:15 2012 (r238961) @@ -1051,11 +1051,12 @@ ath_tx_set_rtscts(struct ath_softc *sc, /* * Must disable multi-rate retry when using RTS/CTS. - * XXX TODO: only for pre-11n NICs. */ - bf->bf_state.bfs_ismrr = 0; - bf->bf_state.bfs_try0 = - bf->bf_state.bfs_rc[0].tries = ATH_TXMGTTRY; /* XXX ew */ + if (!sc->sc_mrrprot) { + bf->bf_state.bfs_ismrr = 0; + bf->bf_state.bfs_try0 = + bf->bf_state.bfs_rc[0].tries = ATH_TXMGTTRY; /* XXX ew */ + } } /* Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Tue Jul 31 23:34:06 2012 (r238960) +++ head/sys/dev/ath/if_athvar.h Tue Jul 31 23:54:15 2012 (r238961) @@ -463,6 +463,7 @@ struct ath_softc { void (*sc_setdefantenna)(struct ath_softc *, u_int); unsigned int sc_invalid : 1,/* disable hardware accesses */ sc_mrretry : 1,/* multi-rate retry support */ + sc_mrrprot : 1,/* MRR + protection support */ sc_softled : 1,/* enable LED gpio status */ sc_hardled : 1,/* enable MAC LED status */ sc_splitmic : 1,/* split TKIP MIC keys */ From owner-svn-src-head@FreeBSD.ORG Wed Aug 1 00:18:03 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3EFD81065674; Wed, 1 Aug 2012 00:18:03 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2A9F28FC15; Wed, 1 Aug 2012 00:18:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q710I34p088991; Wed, 1 Aug 2012 00:18:03 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q710I2Uh088989; Wed, 1 Aug 2012 00:18:02 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201208010018.q710I2Uh088989@svn.freebsd.org> From: Adrian Chadd Date: Wed, 1 Aug 2012 00:18:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238962 - head/sys/dev/ath/ath_rate/sample X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Aug 2012 00:18:03 -0000 Author: adrian Date: Wed Aug 1 00:18:02 2012 New Revision: 238962 URL: http://svn.freebsd.org/changeset/base/238962 Log: Fix a case of "mis-located braces". PR: kern/170302 Modified: head/sys/dev/ath/ath_rate/sample/sample.c Modified: head/sys/dev/ath/ath_rate/sample/sample.c ============================================================================== --- head/sys/dev/ath/ath_rate/sample/sample.c Tue Jul 31 23:54:15 2012 (r238961) +++ head/sys/dev/ath/ath_rate/sample/sample.c Wed Aug 1 00:18:02 2012 (r238962) @@ -504,7 +504,7 @@ ath_rate_findrate(struct ath_softc *sc, mrr = sc->sc_mrretry; /* XXX check HT protmode too */ - if (mrr && (ic->ic_flags & IEEE80211_F_USEPROT) && !sc->sc_mrrprot) + if (mrr && (ic->ic_flags & IEEE80211_F_USEPROT && !sc->sc_mrrprot)) mrr = 0; best_rix = pick_best_rate(an, rt, size_bin, !mrr); @@ -914,7 +914,7 @@ ath_rate_tx_complete(struct ath_softc *s } mrr = sc->sc_mrretry; /* XXX check HT protmode too */ - if (mrr && (ic->ic_flags & IEEE80211_F_USEPROT) && !sc->sc_mrrprot) + if (mrr && (ic->ic_flags & IEEE80211_F_USEPROT && !sc->sc_mrrprot)) mrr = 0; if (!mrr || ts->ts_finaltsi == 0) { From owner-svn-src-head@FreeBSD.ORG Wed Aug 1 00:21:56 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 28F901065676; Wed, 1 Aug 2012 00:21:56 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 14CD88FC15; Wed, 1 Aug 2012 00:21:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q710Lt93089447; Wed, 1 Aug 2012 00:21:55 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q710LtR0089445; Wed, 1 Aug 2012 00:21:55 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201208010021.q710LtR0089445@svn.freebsd.org> From: Xin LI Date: Wed, 1 Aug 2012 00:21:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238963 - head/lib/libc/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Aug 2012 00:21:56 -0000 Author: delphij Date: Wed Aug 1 00:21:55 2012 New Revision: 238963 URL: http://svn.freebsd.org/changeset/base/238963 Log: Use calloc(). Modified: head/lib/libc/gen/fts.c Modified: head/lib/libc/gen/fts.c ============================================================================== --- head/lib/libc/gen/fts.c Wed Aug 1 00:18:02 2012 (r238962) +++ head/lib/libc/gen/fts.c Wed Aug 1 00:21:55 2012 (r238963) @@ -134,9 +134,8 @@ fts_open(argv, options, compar) } /* Allocate/initialize the stream. */ - if ((priv = malloc(sizeof(*priv))) == NULL) + if ((priv = calloc(1, sizeof(*priv))) == NULL) return (NULL); - memset(priv, 0, sizeof(*priv)); sp = &priv->ftsp_fts; sp->fts_compar = compar; sp->fts_options = options; From owner-svn-src-head@FreeBSD.ORG Wed Aug 1 00:29:55 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7147C1065781; Wed, 1 Aug 2012 00:29:55 +0000 (UTC) (envelope-from minimarmot@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 346BC8FC1A; Wed, 1 Aug 2012 00:29:55 +0000 (UTC) Received: by pbbro2 with SMTP id ro2so132540pbb.13 for ; Tue, 31 Jul 2012 17:29:55 -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=U6zVgoL8EEpcuoRtCap1KIpuppop2EhOckYs1QkP+3k=; b=Re1Ywc7kLXaY3TePPpnD4Q2LrTNpeGC3Ro82PQMt8yFCMZ2L7Dwmio+2jFBCPjizDG aNrWRi7Rnx4ziabM7CoT7STCElRPlqTYpblDT927ePtogRZYBOUg5HRFfR4xBN86hSuW 38SbaUvhBlnwHkhkG38uC2mMlhYJYh6dEBJ3hVMMEp3itqNRlWlrLh3mB3FxCy57ty/6 llCF9LIKFSxqGK1rmckWu5apUJW8hmDB2U1gp4mm18NUwYDRzLRuDLrziJLWvHZ2J4BH 3ICPpUo9uu3yhhDfUQHMsGwQ+s8i9gRBz2i8ptuDGIeHqh+zT0aj6QTdfbIrXgmFb52b P4gQ== MIME-Version: 1.0 Received: by 10.68.227.201 with SMTP id sc9mr47103339pbc.163.1343780995026; Tue, 31 Jul 2012 17:29:55 -0700 (PDT) Received: by 10.66.149.131 with HTTP; Tue, 31 Jul 2012 17:29:55 -0700 (PDT) In-Reply-To: <201208010018.q710I2Uh088989@svn.freebsd.org> References: <201208010018.q710I2Uh088989@svn.freebsd.org> Date: Tue, 31 Jul 2012 20:29:55 -0400 Message-ID: From: Ben Kaduk To: Adrian Chadd Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r238962 - head/sys/dev/ath/ath_rate/sample X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Aug 2012 00:29:55 -0000 On Tue, Jul 31, 2012 at 8:18 PM, Adrian Chadd wrote: > --- head/sys/dev/ath/ath_rate/sample/sample.c Tue Jul 31 23:54:15 2012 (r238961) > +++ head/sys/dev/ath/ath_rate/sample/sample.c Wed Aug 1 00:18:02 2012 (r238962) > @@ -504,7 +504,7 @@ ath_rate_findrate(struct ath_softc *sc, > > mrr = sc->sc_mrretry; > /* XXX check HT protmode too */ > - if (mrr && (ic->ic_flags & IEEE80211_F_USEPROT) && !sc->sc_mrrprot) > + if (mrr && (ic->ic_flags & IEEE80211_F_USEPROT && !sc->sc_mrrprot)) > mrr = 0; > > best_rix = pick_best_rate(an, rt, size_bin, !mrr); Logical '&&' evaluates left-to-right already, so I do not see that the current parentheses are needed? -Ben From owner-svn-src-head@FreeBSD.ORG Wed Aug 1 00:36:12 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B9AA1106566B; Wed, 1 Aug 2012 00:36:12 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9A3378FC16; Wed, 1 Aug 2012 00:36:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q710aC5x090726; Wed, 1 Aug 2012 00:36:12 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q710aCWS090722; Wed, 1 Aug 2012 00:36:12 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201208010036.q710aCWS090722@svn.freebsd.org> From: Xin LI Date: Wed, 1 Aug 2012 00:36:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238964 - head/sbin/md5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Aug 2012 00:36:12 -0000 Author: delphij Date: Wed Aug 1 00:36:12 2012 New Revision: 238964 URL: http://svn.freebsd.org/changeset/base/238964 Log: Teach md5(1) about sha512. MFC after: 1 month Modified: head/sbin/md5/Makefile head/sbin/md5/md5.1 head/sbin/md5/md5.c Modified: head/sbin/md5/Makefile ============================================================================== --- head/sbin/md5/Makefile Wed Aug 1 00:21:55 2012 (r238963) +++ head/sbin/md5/Makefile Wed Aug 1 00:36:12 2012 (r238964) @@ -5,11 +5,13 @@ PROG= md5 LINKS= ${BINDIR}/md5 ${BINDIR}/rmd160 \ ${BINDIR}/md5 ${BINDIR}/sha1 \ - ${BINDIR}/md5 ${BINDIR}/sha256 + ${BINDIR}/md5 ${BINDIR}/sha256 \ + ${BINDIR}/md5 ${BINDIR}/sha512 MLINKS= md5.1 rmd160.1 \ md5.1 sha1.1 \ - md5.1 sha256.1 + md5.1 sha256.1 \ + md5.1 sha512.1 WFORMAT?= 1 Modified: head/sbin/md5/md5.1 ============================================================================== --- head/sbin/md5/md5.1 Wed Aug 1 00:21:55 2012 (r238963) +++ head/sbin/md5/md5.1 Wed Aug 1 00:36:12 2012 (r238964) @@ -1,9 +1,9 @@ .\" $FreeBSD$ -.Dd September 7, 2008 +.Dd July 31, 2012 .Dt MD5 1 .Os .Sh NAME -.Nm md5 , sha1 , sha256 , rmd160 +.Nm md5 , sha1 , sha256 , sha512, rmd160 .Nd calculate a message-digest fingerprint (checksum) for a file .Sh SYNOPSIS .Nm md5 @@ -21,6 +21,11 @@ .Op Fl c Ar string .Op Fl s Ar string .Op Ar +.Nm sha512 +.Op Fl pqrtx +.Op Fl c Ar string +.Op Fl s Ar string +.Op Ar .Nm rmd160 .Op Fl pqrtx .Op Fl c Ar string @@ -28,7 +33,7 @@ .Op Ar .Sh DESCRIPTION The -.Nm md5 , sha1 , sha256 +.Nm md5 , sha1 , sha256 , sha512 and .Nm rmd160 utilities take as input a message of arbitrary length and produce as @@ -41,7 +46,7 @@ It is conjectured that it is computation produce two messages having the same message digest, or to produce any message having a given prespecified target message digest. The -.Tn MD5 , SHA-1 , SHA-256 +.Tn MD5 , SHA-1 , SHA-256 , SHA-512 and .Tn RIPEMD-160 algorithms are intended for digital signature applications, where a @@ -104,7 +109,7 @@ Run a built-in test script. .El .Sh EXIT STATUS The -.Nm md5 , sha1 , sha256 +.Nm md5 , sha1 , sha256 , sha512 and .Nm rmd160 utilities exit 0 on success, @@ -115,7 +120,8 @@ and 2 if at least one file does not have .Xr md5 3 , .Xr ripemd 3 , .Xr sha 3 , -.Xr sha256 3 +.Xr sha256 3 , +.Xr sha512 3 .Rs .%A R. Rivest .%T The MD5 Message-Digest Algorithm Modified: head/sbin/md5/md5.c ============================================================================== --- head/sbin/md5/md5.c Wed Aug 1 00:21:55 2012 (r238963) +++ head/sbin/md5/md5.c Wed Aug 1 00:36:12 2012 (r238964) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -54,6 +55,7 @@ typedef char *(DIGEST_End)(void *, char extern const char *MD5TestOutput[MDTESTCOUNT]; extern const char *SHA1_TestOutput[MDTESTCOUNT]; extern const char *SHA256_TestOutput[MDTESTCOUNT]; +extern const char *SHA512_TestOutput[MDTESTCOUNT]; extern const char *RIPEMD160_TestOutput[MDTESTCOUNT]; typedef struct Algorithm_t { @@ -78,12 +80,14 @@ typedef union { MD5_CTX md5; SHA1_CTX sha1; SHA256_CTX sha256; + SHA512_CTX sha512; RIPEMD160_CTX ripemd160; } DIGEST_CTX; /* max(MD5_DIGEST_LENGTH, SHA_DIGEST_LENGTH, - SHA256_DIGEST_LENGTH, RIPEMD160_DIGEST_LENGTH)*2+1 */ -#define HEX_DIGEST_LENGTH 65 + SHA256_DIGEST_LENGTH, SHA512_DIGEST_LENGTH, + RIPEMD160_DIGEST_LENGTH)*2+1 */ +#define HEX_DIGEST_LENGTH 129 /* algorithm function table */ @@ -97,6 +101,9 @@ struct Algorithm_t Algorithm[] = { { "sha256", "SHA256", &SHA256_TestOutput, (DIGEST_Init*)&SHA256_Init, (DIGEST_Update*)&SHA256_Update, (DIGEST_End*)&SHA256_End, &SHA256_Data, &SHA256_File }, + { "sha512", "SHA512", &SHA512_TestOutput, (DIGEST_Init*)&SHA512_Init, + (DIGEST_Update*)&SHA512_Update, (DIGEST_End*)&SHA512_End, + &SHA512_Data, &SHA512_File }, { "rmd160", "RMD160", &RIPEMD160_TestOutput, (DIGEST_Init*)&RIPEMD160_Init, (DIGEST_Update*)&RIPEMD160_Update, (DIGEST_End*)&RIPEMD160_End, &RIPEMD160_Data, &RIPEMD160_File } @@ -320,6 +327,17 @@ const char *SHA256_TestOutput[MDTESTCOUN "e6eae09f10ad4122a0e2a4075761d185a272ebd9f5aa489e998ff2f09cbfdd9f" }; +const char *SHA512_TestOutput[MDTESTCOUNT] = { + "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e", + "1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75", + "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f", + "107dbf389d9e9f71a3a95f6c055b9251bc5268c2be16d6c13492ea45b0199f3309e16455ab1e96118e8a905d5597b72038ddb372a89826046de66687bb420e7c", + "4dbff86cc2ca1bae1e16468a05cb9881c97f1753bce3619034898faa1aabe429955a1bf8ec483d7421fe3c1646613a59ed5441fb0f321389f77f48a879c7b1f1", + "1e07be23c26a86ea37ea810c8ec7809352515a970e9253c26f536cfc7a9996c45c8370583e0a78fa4a90041d71a4ceab7423f19c71b9d5a3e01249f0bebd5894", + "72ec1ef1124a45b047e8b7c75a932195135bb61de24ec0d1914042246e0aec3a2354e093d76f3048b456764346900cb130d2a4fd5dd16abb5e30bcb850dee843", + "e8a835195e039708b13d9131e025f4441dbdc521ce625f245a436dcd762f54bf5cb298d96235e6c6a304e087ec8189b9512cbdf6427737ea82793460c367b9c3" +}; + const char *RIPEMD160_TestOutput[MDTESTCOUNT] = { "9c1185a5c5e9fc54612808977ee8f548b2258d31", "0bdc9d2d256b3ee9daae347be6f4dc835a467ffe", From owner-svn-src-head@FreeBSD.ORG Wed Aug 1 01:18:37 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 75DBD106564A; Wed, 1 Aug 2012 01:18:37 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 26DB78FC0A; Wed, 1 Aug 2012 01:18:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q711IbjY094393; Wed, 1 Aug 2012 01:18:37 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q711Ia5p094390; Wed, 1 Aug 2012 01:18:36 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201208010118.q711Ia5p094390@svn.freebsd.org> From: Warner Losh Date: Wed, 1 Aug 2012 01:18:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238965 - head/sys/dev/spibus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Aug 2012 01:18:37 -0000 Author: imp Date: Wed Aug 1 01:18:36 2012 New Revision: 238965 URL: http://svn.freebsd.org/changeset/base/238965 Log: Add the chip select glue. Modified: head/sys/dev/spibus/spi.h head/sys/dev/spibus/spibus.c Modified: head/sys/dev/spibus/spi.h ============================================================================== --- head/sys/dev/spibus/spi.h Wed Aug 1 00:36:12 2012 (r238964) +++ head/sys/dev/spibus/spi.h Wed Aug 1 01:18:36 2012 (r238965) @@ -1,6 +1,7 @@ /* $FreeBSD$ */ struct spi_command { + int cs; void *tx_cmd; uint32_t tx_cmd_sz; void *rx_cmd; @@ -10,3 +11,5 @@ struct spi_command { void *rx_data; uint32_t rx_data_sz; }; + +#define SPI_CHIP_SELECT_HIGH 0x1 /* Chip select high (else low) */ Modified: head/sys/dev/spibus/spibus.c ============================================================================== --- head/sys/dev/spibus/spibus.c Wed Aug 1 00:36:12 2012 (r238964) +++ head/sys/dev/spibus/spibus.c Wed Aug 1 01:18:36 2012 (r238965) @@ -158,6 +158,9 @@ spibus_hinted_child(device_t bus, const static int spibus_transfer_impl(device_t dev, device_t child, struct spi_command *cmd) { + /* Maybe set flags too? spi mode? */ + spibus_get_cs(dev, &cmd->cs); + return (SPIBUS_TRANSFER(device_get_parent(dev), child, cmd)); } From owner-svn-src-head@FreeBSD.ORG Wed Aug 1 09:00:27 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 14A7E106566C; Wed, 1 Aug 2012 09:00:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EAAB18FC08; Wed, 1 Aug 2012 09:00:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7190QrC034292; Wed, 1 Aug 2012 09:00:26 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7190QQv034287; Wed, 1 Aug 2012 09:00:26 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201208010900.q7190QQv034287@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 1 Aug 2012 09:00:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238967 - in head/sys: net netinet netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Aug 2012 09:00:27 -0000 Author: glebius Date: Wed Aug 1 09:00:26 2012 New Revision: 238967 URL: http://svn.freebsd.org/changeset/base/238967 Log: Some more whitespace cleanup. Modified: head/sys/net/if_llatbl.c head/sys/netinet/if_ether.c head/sys/netinet/in.c head/sys/netinet6/in6.c Modified: head/sys/net/if_llatbl.c ============================================================================== --- head/sys/net/if_llatbl.c Wed Aug 1 05:53:20 2012 (r238966) +++ head/sys/net/if_llatbl.c Wed Aug 1 09:00:26 2012 (r238967) @@ -140,7 +140,7 @@ llentry_update(struct llentry **llep, st { struct llentry *la; - IF_AFDATA_RLOCK(ifp); + IF_AFDATA_RLOCK(ifp); la = lla_lookup(lt, LLE_EXCLUSIVE, (struct sockaddr *)dst); IF_AFDATA_RUNLOCK(ifp); @@ -150,7 +150,7 @@ llentry_update(struct llentry **llep, st la = lla_lookup(lt, (LLE_CREATE | LLE_EXCLUSIVE), (struct sockaddr *)dst); - IF_AFDATA_WUNLOCK(ifp); + IF_AFDATA_WUNLOCK(ifp); } if (la != NULL && (*llep != la)) { if (*llep != NULL) @@ -342,7 +342,7 @@ lla_rt_output(struct rt_msghdr *rtm, str if (flags & LLE_CREATE) flags |= LLE_EXCLUSIVE; - + IF_AFDATA_LOCK(ifp); lle = lla_lookup(llt, flags, dst); IF_AFDATA_UNLOCK(ifp); @@ -451,7 +451,7 @@ llatbl_lle_show(struct llentry_sa *la) sin = (struct sockaddr_in *)&la->l3_addr; inet_ntoa_r(sin->sin_addr, l3s); - db_printf(" l3_addr=%s\n", l3s); + db_printf(" l3_addr=%s\n", l3s); break; } #endif @@ -463,7 +463,7 @@ llatbl_lle_show(struct llentry_sa *la) sin6 = (struct sockaddr_in6 *)&la->l3_addr; ip6_sprintf(l3s, &sin6->sin6_addr); - db_printf(" l3_addr=%s\n", l3s); + db_printf(" l3_addr=%s\n", l3s); break; } #endif Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Wed Aug 1 05:53:20 2012 (r238966) +++ head/sys/netinet/if_ether.c Wed Aug 1 09:00:26 2012 (r238967) @@ -322,15 +322,15 @@ arpresolve(struct ifnet *ifp, struct rte } } retry: - IF_AFDATA_RLOCK(ifp); + IF_AFDATA_RLOCK(ifp); la = lla_lookup(LLTABLE(ifp), flags, dst); - IF_AFDATA_RUNLOCK(ifp); + IF_AFDATA_RUNLOCK(ifp); if ((la == NULL) && ((flags & LLE_EXCLUSIVE) == 0) - && ((ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) == 0)) { + && ((ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) == 0)) { flags |= (LLE_CREATE | LLE_EXCLUSIVE); - IF_AFDATA_WLOCK(ifp); + IF_AFDATA_WLOCK(ifp); la = lla_lookup(LLTABLE(ifp), flags, dst); - IF_AFDATA_WUNLOCK(ifp); + IF_AFDATA_WUNLOCK(ifp); } if (la == NULL) { if (flags & LLE_CREATE) @@ -354,7 +354,7 @@ retry: arprequest(ifp, NULL, &SIN(dst)->sin_addr, NULL); la->la_preempt--; } - + *lle = la; error = 0; goto done; @@ -402,7 +402,7 @@ retry: flags &= ~LLE_EXCLUSIVE; LLE_DOWNGRADE(la); } - + } /* * Return EWOULDBLOCK if we have tried less than arp_maxtries. It @@ -802,7 +802,7 @@ reply: if (!V_arp_proxyall) goto drop; - + sin.sin_addr = itaddr; /* XXX MRT use table 0 for arp reply */ rt = in_rtalloc1((struct sockaddr *)&sin, 0, 0UL, 0); @@ -830,7 +830,7 @@ reply: * wrong network. */ sin.sin_addr = isaddr; - + /* XXX MRT use table 0 for arp checks */ rt = in_rtalloc1((struct sockaddr *)&sin, 0, 0UL, 0); if (!rt) Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Wed Aug 1 05:53:20 2012 (r238966) +++ head/sys/netinet/in.c Wed Aug 1 09:00:26 2012 (r238967) @@ -1431,7 +1431,7 @@ in_lltable_lookup(struct lltable *llt, u if (lle == NULL) { #ifdef DIAGNOSTIC if (flags & LLE_DELETE) - log(LOG_INFO, "interface address is missing from cache = %p in delete\n", lle); + log(LOG_INFO, "interface address is missing from cache = %p in delete\n", lle); #endif if (!(flags & LLE_CREATE)) return (NULL); @@ -1465,11 +1465,11 @@ in_lltable_lookup(struct lltable *llt, u EVENTHANDLER_INVOKE(lle_event, lle, LLENTRY_DELETED); LLE_WUNLOCK(lle); #ifdef DIAGNOSTIC - log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle); + log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle); #endif } lle = (void *)-1; - + } if (LLE_IS_VALID(lle)) { if (flags & LLE_EXCLUSIVE) @@ -1501,7 +1501,7 @@ in_lltable_dump(struct lltable *llt, str for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) { LIST_FOREACH(lle, &llt->lle_head[i], lle_next) { struct sockaddr_dl *sdl; - + /* skip deleted entries */ if ((lle->la_flags & LLE_DELETED) == LLE_DELETED) continue; Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Wed Aug 1 05:53:20 2012 (r238966) +++ head/sys/netinet6/in6.c Wed Aug 1 09:00:26 2012 (r238967) @@ -284,7 +284,7 @@ in6_control(struct socket *so, u_long cm switch (cmd) { case SIOCGETSGCNT_IN6: case SIOCGETMIFCNT_IN6: - /* + /* * XXX mrt_ioctl has a 3rd, unused, FIB argument in route.c. * We cannot see how that would be needed, so do not adjust the * KPI blindly; more likely should clean up the IPv4 variant. @@ -2612,8 +2612,8 @@ in6_lltable_lookup(struct lltable *llt, lle->la_flags = LLE_DELETED; LLE_WUNLOCK(lle); #ifdef DIAGNOSTIC - log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle); -#endif + log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle); +#endif } lle = (void *)-1; } From owner-svn-src-head@FreeBSD.ORG Wed Aug 1 09:10:22 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F6EC106566B; Wed, 1 Aug 2012 09:10:22 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3AF348FC0A; Wed, 1 Aug 2012 09:10:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q719AMYh035170; Wed, 1 Aug 2012 09:10:22 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q719AMId035168; Wed, 1 Aug 2012 09:10:22 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201208010910.q719AMId035168@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Wed, 1 Aug 2012 09:10:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238968 - head/sbin/shutdown X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Aug 2012 09:10:22 -0000 Author: des Date: Wed Aug 1 09:10:21 2012 New Revision: 238968 URL: http://svn.freebsd.org/changeset/base/238968 Log: Restore a piece of BSD history. PR: 169127 Submitted by: Ruben de Groot MFC after: 1 week Modified: head/sbin/shutdown/shutdown.c Modified: head/sbin/shutdown/shutdown.c ============================================================================== --- head/sbin/shutdown/shutdown.c Wed Aug 1 09:00:26 2012 (r238967) +++ head/sbin/shutdown/shutdown.c Wed Aug 1 09:10:21 2012 (r238968) @@ -93,7 +93,7 @@ static char mbuf[BUFSIZ]; static const char *nosync, *whom; static void badtime(void); -static void perform_shutdown(void); +static void die_you_gravy_sucking_pig_dog(void); static void finish(int); static void getoffset(char *); static void loop(void); @@ -282,7 +282,7 @@ loop(void) if (!tp->timeleft) break; } - perform_shutdown(); + die_you_gravy_sucking_pig_dog(); } static jmp_buf alarmbuf; @@ -349,7 +349,7 @@ timeout(int signo __unused) } static void -perform_shutdown(void) +die_you_gravy_sucking_pig_dog(void) { char *empty_environ[] = { NULL }; From owner-svn-src-head@FreeBSD.ORG Wed Aug 1 09:33:25 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DDFA11065672; Wed, 1 Aug 2012 09:33:25 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 9454C8FC1E; Wed, 1 Aug 2012 09:33:24 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id MAA11224; Wed, 01 Aug 2012 12:33:20 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1SwVIu-000Bl0-Bq; Wed, 01 Aug 2012 12:33:20 +0300 Message-ID: <5018F7DE.30200@FreeBSD.org> Date: Wed, 01 Aug 2012 12:33:18 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:14.0) Gecko/20120728 Thunderbird/14.0 MIME-Version: 1.0 To: Ben Kaduk , Adrian Chadd References: <201208010018.q710I2Uh088989@svn.freebsd.org> In-Reply-To: X-Enigmail-Version: 1.4.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r238962 - head/sys/dev/ath/ath_rate/sample X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Aug 2012 09:33:26 -0000 on 01/08/2012 03:29 Ben Kaduk said the following: > On Tue, Jul 31, 2012 at 8:18 PM, Adrian Chadd wrote: >> --- head/sys/dev/ath/ath_rate/sample/sample.c Tue Jul 31 23:54:15 2012 (r238961) >> +++ head/sys/dev/ath/ath_rate/sample/sample.c Wed Aug 1 00:18:02 2012 (r238962) >> @@ -504,7 +504,7 @@ ath_rate_findrate(struct ath_softc *sc, >> >> mrr = sc->sc_mrretry; >> /* XXX check HT protmode too */ >> - if (mrr && (ic->ic_flags & IEEE80211_F_USEPROT) && !sc->sc_mrrprot) >> + if (mrr && (ic->ic_flags & IEEE80211_F_USEPROT && !sc->sc_mrrprot)) >> mrr = 0; >> >> best_rix = pick_best_rate(an, rt, size_bin, !mrr); > > Logical '&&' evaluates left-to-right already, so I do not see that the > current parentheses are needed? Yeah, adding "!= 0" after the bitwise operation would be much more logical than shuffling the otherwise useless parentheses. -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Wed Aug 1 11:59:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4DC8106566B; Wed, 1 Aug 2012 11:59:46 +0000 (UTC) (envelope-from ray@dlink.ua) Received: from smtp.dlink.ua (smtp.dlink.ua [193.138.187.146]) by mx1.freebsd.org (Postfix) with ESMTP id 6EF6F8FC19; Wed, 1 Aug 2012 11:59:46 +0000 (UTC) Received: from terran.dlink.ua (unknown [192.168.10.90]) (Authenticated sender: ray) by smtp.dlink.ua (Postfix) with ESMTPSA id 8922BC493C; Wed, 1 Aug 2012 14:59:45 +0300 (EEST) Date: Wed, 1 Aug 2012 14:59:17 +0300 From: Aleksandr Rybalko To: Warner Losh Message-Id: <20120801145917.01cf85f6.ray@dlink.ua> In-Reply-To: <201208010118.q711Ia5p094390@svn.freebsd.org> References: <201208010118.q711Ia5p094390@svn.freebsd.org> Organization: D-Link X-Mailer: Sylpheed 2.7.1 (GTK+ 2.20.1; i386-portbld-freebsd8.0) 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 Subject: Re: svn commit: r238965 - head/sys/dev/spibus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Aug 2012 11:59:46 -0000 On Wed, 1 Aug 2012 01:18:36 +0000 (UTC) Warner Losh wrote: >> Author: imp >> Date: Wed Aug 1 01:18:36 2012 >> New Revision: 238965 >> URL: http://svn.freebsd.org/changeset/base/238965 >> >> Log: >> Add the chip select glue. >> >> Modified: >> head/sys/dev/spibus/spi.h >> head/sys/dev/spibus/spibus.c >> >> Modified: head/sys/dev/spibus/spi.h >> ============================================================================== >> --- head/sys/dev/spibus/spi.h Wed Aug 1 00:36:12 2012 >> (r238964) +++ head/sys/dev/spibus/spi.h Wed Aug 1 01:18:36 >> 2012 (r238965) @@ -1,6 +1,7 @@ >> /* $FreeBSD$ */ >> >> struct spi_command { >> + int cs; >> void *tx_cmd; >> uint32_t tx_cmd_sz; >> void *rx_cmd; >> @@ -10,3 +11,5 @@ struct spi_command { >> void *rx_data; >> uint32_t rx_data_sz; >> }; >> + >> +#define SPI_CHIP_SELECT_HIGH 0x1 /* >> Chip select high (else low) */ >> >> Modified: head/sys/dev/spibus/spibus.c >> ============================================================================== >> --- head/sys/dev/spibus/spibus.c Wed Aug 1 00:36:12 >> 2012 (r238964) +++ head/sys/dev/spibus/spibus.c Wed >> Aug 1 01:18:36 2012 (r238965) @@ -158,6 +158,9 @@ >> spibus_hinted_child(device_t bus, const static int >> spibus_transfer_impl(device_t dev, device_t child, struct >> spi_command *cmd) { >> + /* Maybe set flags too? spi mode? */ >> + spibus_get_cs(dev, &cmd->cs); >> + >> return (SPIBUS_TRANSFER(device_get_parent(dev), child, >> cmd)); } >> Hi Warner, why don't get cs from IVARs in the SPIBUS_TRANSFER method? In many spi drivers it's done this way. For example in sys/mips/atheros/ar71xx_spi.c. WBW -- Alexandr Rybalko aka Alex RAY From owner-svn-src-head@FreeBSD.ORG Wed Aug 1 12:24:14 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 29D891065674; Wed, 1 Aug 2012 12:24:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 15ADB8FC0A; Wed, 1 Aug 2012 12:24:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q71CODvT053134; Wed, 1 Aug 2012 12:24:13 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q71CODfX053132; Wed, 1 Aug 2012 12:24:13 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201208011224.q71CODfX053132@svn.freebsd.org> From: Alexander Motin Date: Wed, 1 Aug 2012 12:24:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238969 - head/sys/dev/mps X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Aug 2012 12:24:14 -0000 Author: mav Date: Wed Aug 1 12:24:13 2012 New Revision: 238969 URL: http://svn.freebsd.org/changeset/base/238969 Log: Fix kernel panic on `camcontrol reset` for specific target, caused by uninitialized cm_targ in mpssas_action_resetdev(). Reviewed by: Desai, Kashyap Sponsored by: iXsystems, Inc. MFC after: 3 days Modified: head/sys/dev/mps/mps_sas.c Modified: head/sys/dev/mps/mps_sas.c ============================================================================== --- head/sys/dev/mps/mps_sas.c Wed Aug 1 09:10:21 2012 (r238968) +++ head/sys/dev/mps/mps_sas.c Wed Aug 1 12:24:13 2012 (r238969) @@ -3003,6 +3003,7 @@ mpssas_action_resetdev(struct mpssas_sof tm->cm_desc.HighPriority.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY; tm->cm_complete = mpssas_resetdev_complete; tm->cm_complete_data = ccb; + tm->cm_targ = targ; mps_map_command(sc, tm); } From owner-svn-src-head@FreeBSD.ORG Wed Aug 1 16:04:13 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C1582106567C; Wed, 1 Aug 2012 16:04:13 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ABCF38FC14; Wed, 1 Aug 2012 16:04:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q71G4Dqt072076; Wed, 1 Aug 2012 16:04:13 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q71G4DYZ072074; Wed, 1 Aug 2012 16:04:13 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201208011604.q71G4DYZ072074@svn.freebsd.org> From: Alan Cox Date: Wed, 1 Aug 2012 16:04:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238970 - head/sys/amd64/amd64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Aug 2012 16:04:13 -0000 Author: alc Date: Wed Aug 1 16:04:13 2012 New Revision: 238970 URL: http://svn.freebsd.org/changeset/base/238970 Log: Revise pmap_enter()'s handling of mapping updates that change the PTE's PG_M and PG_RW bits but not the physical page frame. First, only perform vm_page_dirty() on a managed vm_page when the PG_M bit is being cleared. If the updated PTE continues to have PG_M set, then there is no requirement to perform vm_page_dirty(). Second, flush the mapping from the TLB when PG_M alone is cleared, not just when PG_M and PG_RW are cleared. Otherwise, a stale TLB entry may stop PG_M from being set again on the next store to the virtual page. However, since the vm_page's dirty field already shows the physical page as being dirty, no actual harm comes from the PG_M bit not being set. Nonetheless, it is potentially confusing to someone expecting to see the PTE change after a store to the virtual page. Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Wed Aug 1 12:24:13 2012 (r238969) +++ head/sys/amd64/amd64/pmap.c Wed Aug 1 16:04:13 2012 (r238970) @@ -3439,7 +3439,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, pv_entry_t pv; vm_paddr_t opa, pa; vm_page_t mpte, om; - boolean_t invlva; va = trunc_page(va); KASSERT(va <= VM_MAX_KERNEL_ADDRESS, ("pmap_enter: toobig")); @@ -3537,7 +3536,6 @@ retry: newpte |= PG_MANAGED; if ((newpte & PG_RW) != 0) vm_page_aflag_set(m, PGA_WRITEABLE); - om = m; } if (((origpte ^ newpte) & ~(PG_M | PG_A)) == 0) goto unchanged; @@ -3576,30 +3574,40 @@ retry: */ if ((origpte & PG_V) != 0) { validate: - invlva = FALSE; origpte = pte_load_store(pte, newpte); opa = origpte & PG_FRAME; - if ((origpte & PG_A) != 0 && (opa != pa || - ((origpte & PG_NX) == 0 && (newpte & PG_NX) != 0))) - invlva = TRUE; - if ((origpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) { + if (opa != pa) { + if ((origpte & PG_MANAGED) != 0) { + if ((origpte & (PG_M | PG_RW)) == (PG_M | + PG_RW)) + vm_page_dirty(om); + if ((origpte & PG_A) != 0) + vm_page_aflag_set(om, PGA_REFERENCED); + CHANGE_PV_LIST_LOCK_TO_PHYS(&lock, opa); + pmap_pvh_free(&om->md, pmap, va); + if ((om->aflags & PGA_WRITEABLE) != 0 && + TAILQ_EMPTY(&om->md.pv_list) && + ((om->flags & PG_FICTITIOUS) != 0 || + TAILQ_EMPTY(&pa_to_pvh(opa)->pv_list))) + vm_page_aflag_clear(om, PGA_WRITEABLE); + } + } else if ((newpte & PG_M) == 0 && (origpte & (PG_M | + PG_RW)) == (PG_M | PG_RW)) { if ((origpte & PG_MANAGED) != 0) - vm_page_dirty(om); - if ((newpte & PG_RW) == 0) - invlva = TRUE; - } - if (opa != pa && (origpte & PG_MANAGED) != 0) { - if ((origpte & PG_A) != 0) - vm_page_aflag_set(om, PGA_REFERENCED); - CHANGE_PV_LIST_LOCK_TO_PHYS(&lock, opa); - pmap_pvh_free(&om->md, pmap, va); - if ((om->aflags & PGA_WRITEABLE) != 0 && - TAILQ_EMPTY(&om->md.pv_list) && - ((om->flags & PG_FICTITIOUS) != 0 || - TAILQ_EMPTY(&pa_to_pvh(opa)->pv_list))) - vm_page_aflag_clear(om, PGA_WRITEABLE); + vm_page_dirty(m); + + /* + * Although the PTE may still have PG_RW set, TLB + * invalidation may nonetheless be required because + * the PTE no longer has PG_M set. + */ + } else if ((origpte & PG_NX) != 0 || (newpte & PG_NX) == 0) { + /* + * This PTE change does not require TLB invalidation. + */ + goto unchanged; } - if (invlva) + if ((origpte & PG_A) != 0) pmap_invalidate_page(pmap, va); } else pte_store(pte, newpte); From owner-svn-src-head@FreeBSD.ORG Wed Aug 1 17:24:54 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3BB601065670; Wed, 1 Aug 2012 17:24:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 267888FC14; Wed, 1 Aug 2012 17:24:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q71HOs8Q079461; Wed, 1 Aug 2012 17:24:54 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q71HOrY0079458; Wed, 1 Aug 2012 17:24:53 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208011724.q71HOrY0079458@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 1 Aug 2012 17:24:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238972 - in head/sys: amd64/include i386/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Aug 2012 17:24:54 -0000 Author: kib Date: Wed Aug 1 17:24:53 2012 New Revision: 238972 URL: http://svn.freebsd.org/changeset/base/238972 Log: Add lfence(). MFC after: 1 week Modified: head/sys/amd64/include/cpufunc.h head/sys/i386/include/cpufunc.h Modified: head/sys/amd64/include/cpufunc.h ============================================================================== --- head/sys/amd64/include/cpufunc.h Wed Aug 1 16:32:44 2012 (r238971) +++ head/sys/amd64/include/cpufunc.h Wed Aug 1 17:24:53 2012 (r238972) @@ -290,6 +290,13 @@ popcntq(u_long mask) } static __inline void +lfence(void) +{ + + __asm __volatile("lfence" : : : "memory"); +} + +static __inline void mfence(void) { Modified: head/sys/i386/include/cpufunc.h ============================================================================== --- head/sys/i386/include/cpufunc.h Wed Aug 1 16:32:44 2012 (r238971) +++ head/sys/i386/include/cpufunc.h Wed Aug 1 17:24:53 2012 (r238972) @@ -155,6 +155,13 @@ cpu_mwait(u_long extensions, u_int hints } static __inline void +lfence(void) +{ + + __asm __volatile("lfence" : : : "memory"); +} + +static __inline void mfence(void) { From owner-svn-src-head@FreeBSD.ORG Wed Aug 1 17:26:23 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 278F8106566C; Wed, 1 Aug 2012 17:26:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 11D608FC16; Wed, 1 Aug 2012 17:26:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q71HQMPx079605; Wed, 1 Aug 2012 17:26:22 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q71HQMPi079603; Wed, 1 Aug 2012 17:26:22 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208011726.q71HQMPi079603@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 1 Aug 2012 17:26:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238973 - head/sys/x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Aug 2012 17:26:23 -0000 Author: kib Date: Wed Aug 1 17:26:22 2012 New Revision: 238973 URL: http://svn.freebsd.org/changeset/base/238973 Log: diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c index c253a96..3d8bd30 100644 --- a/sys/x86/x86/tsc.c +++ b/sys/x86/x86/tsc.c @@ -82,7 +82,11 @@ static void tsc_freq_changed(void *arg, const struct cf_level *level, static void tsc_freq_changing(void *arg, const struct cf_level *level, int *status); static unsigned tsc_get_timecount(struct timecounter *tc); -static unsigned tsc_get_timecount_low(struct timecounter *tc); +static inline unsigned tsc_get_timecount_low(struct timecounter *tc); +static unsigned tsc_get_timecount_lfence(struct timecounter *tc); +static unsigned tsc_get_timecount_low_lfence(struct timecounter *tc); +static unsigned tsc_get_timecount_mfence(struct timecounter *tc); +static unsigned tsc_get_timecount_low_mfence(struct timecounter *tc); static void tsc_levels_changed(void *arg, int unit); static struct timecounter tsc_timecounter = { @@ -262,6 +266,10 @@ probe_tsc_freq(void) (vm_guest == VM_GUEST_NO && CPUID_TO_FAMILY(cpu_id) >= 0x10)) tsc_is_invariant = 1; + if (cpu_feature & CPUID_SSE2) { + tsc_timecounter.tc_get_timecount = + tsc_get_timecount_mfence; + } break; case CPU_VENDOR_INTEL: if ((amd_pminfo & AMDPM_TSC_INVARIANT) != 0 || @@ -271,6 +279,10 @@ probe_tsc_freq(void) (CPUID_TO_FAMILY(cpu_id) == 0xf && CPUID_TO_MODEL(cpu_id) >= 0x3)))) tsc_is_invariant = 1; + if (cpu_feature & CPUID_SSE2) { + tsc_timecounter.tc_get_timecount = + tsc_get_timecount_lfence; + } break; case CPU_VENDOR_CENTAUR: if (vm_guest == VM_GUEST_NO && @@ -278,6 +290,10 @@ probe_tsc_freq(void) CPUID_TO_MODEL(cpu_id) >= 0xf && (rdmsr(0x1203) & 0x100000000ULL) == 0) tsc_is_invariant = 1; + if (cpu_feature & CPUID_SSE2) { + tsc_timecounter.tc_get_timecount = + tsc_get_timecount_lfence; + } break; } @@ -328,16 +344,31 @@ init_TSC(void) #ifdef SMP -/* rmb is required here because rdtsc is not a serializing instruction. */ -#define TSC_READ(x) \ -static void \ -tsc_read_##x(void *arg) \ -{ \ - uint32_t *tsc = arg; \ - u_int cpu = PCPU_GET(cpuid); \ - \ - rmb(); \ - tsc[cpu * 3 + x] = rdtsc32(); \ +/* + * RDTSC is not a serializing instruction, and does not drain + * instruction stream, so we need to drain the stream before executing + * it. It could be fixed by use of RDTSCP, except the instruction is + * not available everywhere. + * + * Use CPUID for draining in the boot-time SMP constistency test. The + * timecounters use MFENCE for AMD CPUs, and LFENCE for others (Intel + * and VIA) when SSE2 is present, and nothing on older machines which + * also do not issue RDTSC prematurely. There, testing for SSE2 and + * vendor is too cumbersome, and we learn about TSC presence from + * CPUID. + * + * Do not use do_cpuid(), since we do not need CPUID results, which + * have to be written into memory with do_cpuid(). + */ +#define TSC_READ(x) \ +static void \ +tsc_read_##x(void *arg) \ +{ \ + uint32_t *tsc = arg; \ + u_int cpu = PCPU_GET(cpuid); \ + \ + __asm __volatile("cpuid" : : : "eax", "ebx", "ecx", "edx"); \ + tsc[cpu * 3 + x] = rdtsc32(); \ } TSC_READ(0) TSC_READ(1) @@ -487,7 +518,16 @@ init: for (shift = 0; shift < 31 && (tsc_freq >> shift) > max_freq; shift++) ; if (shift > 0) { - tsc_timecounter.tc_get_timecount = tsc_get_timecount_low; + if (cpu_feature & CPUID_SSE2) { + if (cpu_vendor_id == CPU_VENDOR_AMD) { + tsc_timecounter.tc_get_timecount = + tsc_get_timecount_low_mfence; + } else { + tsc_timecounter.tc_get_timecount = + tsc_get_timecount_low_lfence; + } + } else + tsc_timecounter.tc_get_timecount = tsc_get_timecount_low; tsc_timecounter.tc_name = "TSC-low"; if (bootverbose) printf("TSC timecounter discards lower %d bit(s)\n", @@ -599,16 +639,48 @@ tsc_get_timecount(struct timecounter *tc __unused) return (rdtsc32()); } -static u_int +static inline u_int tsc_get_timecount_low(struct timecounter *tc) { uint32_t rv; __asm __volatile("rdtsc; shrd %%cl, %%edx, %0" - : "=a" (rv) : "c" ((int)(intptr_t)tc->tc_priv) : "edx"); + : "=a" (rv) : "c" ((int)(intptr_t)tc->tc_priv) : "edx"); return (rv); } +static u_int +tsc_get_timecount_lfence(struct timecounter *tc __unused) +{ + + lfence(); + return (rdtsc32()); +} + +static u_int +tsc_get_timecount_low_lfence(struct timecounter *tc) +{ + + lfence(); + return (tsc_get_timecount_low(tc)); +} + +static u_int +tsc_get_timecount_mfence(struct timecounter *tc __unused) +{ + + mfence(); + return (rdtsc32()); +} + +static u_int +tsc_get_timecount_low_mfence(struct timecounter *tc) +{ + + mfence(); + return (tsc_get_timecount_low(tc)); +} + uint32_t cpu_fill_vdso_timehands(struct vdso_timehands *vdso_th) { Modified: head/sys/x86/x86/tsc.c Modified: head/sys/x86/x86/tsc.c ============================================================================== --- head/sys/x86/x86/tsc.c Wed Aug 1 17:24:53 2012 (r238972) +++ head/sys/x86/x86/tsc.c Wed Aug 1 17:26:22 2012 (r238973) @@ -82,7 +82,11 @@ static void tsc_freq_changed(void *arg, static void tsc_freq_changing(void *arg, const struct cf_level *level, int *status); static unsigned tsc_get_timecount(struct timecounter *tc); -static unsigned tsc_get_timecount_low(struct timecounter *tc); +static inline unsigned tsc_get_timecount_low(struct timecounter *tc); +static unsigned tsc_get_timecount_lfence(struct timecounter *tc); +static unsigned tsc_get_timecount_low_lfence(struct timecounter *tc); +static unsigned tsc_get_timecount_mfence(struct timecounter *tc); +static unsigned tsc_get_timecount_low_mfence(struct timecounter *tc); static void tsc_levels_changed(void *arg, int unit); static struct timecounter tsc_timecounter = { @@ -262,6 +266,10 @@ probe_tsc_freq(void) (vm_guest == VM_GUEST_NO && CPUID_TO_FAMILY(cpu_id) >= 0x10)) tsc_is_invariant = 1; + if (cpu_feature & CPUID_SSE2) { + tsc_timecounter.tc_get_timecount = + tsc_get_timecount_mfence; + } break; case CPU_VENDOR_INTEL: if ((amd_pminfo & AMDPM_TSC_INVARIANT) != 0 || @@ -271,6 +279,10 @@ probe_tsc_freq(void) (CPUID_TO_FAMILY(cpu_id) == 0xf && CPUID_TO_MODEL(cpu_id) >= 0x3)))) tsc_is_invariant = 1; + if (cpu_feature & CPUID_SSE2) { + tsc_timecounter.tc_get_timecount = + tsc_get_timecount_lfence; + } break; case CPU_VENDOR_CENTAUR: if (vm_guest == VM_GUEST_NO && @@ -278,6 +290,10 @@ probe_tsc_freq(void) CPUID_TO_MODEL(cpu_id) >= 0xf && (rdmsr(0x1203) & 0x100000000ULL) == 0) tsc_is_invariant = 1; + if (cpu_feature & CPUID_SSE2) { + tsc_timecounter.tc_get_timecount = + tsc_get_timecount_lfence; + } break; } @@ -328,16 +344,31 @@ init_TSC(void) #ifdef SMP -/* rmb is required here because rdtsc is not a serializing instruction. */ -#define TSC_READ(x) \ -static void \ -tsc_read_##x(void *arg) \ -{ \ - uint32_t *tsc = arg; \ - u_int cpu = PCPU_GET(cpuid); \ - \ - rmb(); \ - tsc[cpu * 3 + x] = rdtsc32(); \ +/* + * RDTSC is not a serializing instruction, and does not drain + * instruction stream, so we need to drain the stream before executing + * it. It could be fixed by use of RDTSCP, except the instruction is + * not available everywhere. + * + * Use CPUID for draining in the boot-time SMP constistency test. The + * timecounters use MFENCE for AMD CPUs, and LFENCE for others (Intel + * and VIA) when SSE2 is present, and nothing on older machines which + * also do not issue RDTSC prematurely. There, testing for SSE2 and + * vendor is too cumbersome, and we learn about TSC presence from + * CPUID. + * + * Do not use do_cpuid(), since we do not need CPUID results, which + * have to be written into memory with do_cpuid(). + */ +#define TSC_READ(x) \ +static void \ +tsc_read_##x(void *arg) \ +{ \ + uint32_t *tsc = arg; \ + u_int cpu = PCPU_GET(cpuid); \ + \ + __asm __volatile("cpuid" : : : "eax", "ebx", "ecx", "edx"); \ + tsc[cpu * 3 + x] = rdtsc32(); \ } TSC_READ(0) TSC_READ(1) @@ -487,7 +518,16 @@ init: for (shift = 0; shift < 31 && (tsc_freq >> shift) > max_freq; shift++) ; if (shift > 0) { - tsc_timecounter.tc_get_timecount = tsc_get_timecount_low; + if (cpu_feature & CPUID_SSE2) { + if (cpu_vendor_id == CPU_VENDOR_AMD) { + tsc_timecounter.tc_get_timecount = + tsc_get_timecount_low_mfence; + } else { + tsc_timecounter.tc_get_timecount = + tsc_get_timecount_low_lfence; + } + } else + tsc_timecounter.tc_get_timecount = tsc_get_timecount_low; tsc_timecounter.tc_name = "TSC-low"; if (bootverbose) printf("TSC timecounter discards lower %d bit(s)\n", @@ -599,16 +639,48 @@ tsc_get_timecount(struct timecounter *tc return (rdtsc32()); } -static u_int +static inline u_int tsc_get_timecount_low(struct timecounter *tc) { uint32_t rv; __asm __volatile("rdtsc; shrd %%cl, %%edx, %0" - : "=a" (rv) : "c" ((int)(intptr_t)tc->tc_priv) : "edx"); + : "=a" (rv) : "c" ((int)(intptr_t)tc->tc_priv) : "edx"); return (rv); } +static u_int +tsc_get_timecount_lfence(struct timecounter *tc __unused) +{ + + lfence(); + return (rdtsc32()); +} + +static u_int +tsc_get_timecount_low_lfence(struct timecounter *tc) +{ + + lfence(); + return (tsc_get_timecount_low(tc)); +} + +static u_int +tsc_get_timecount_mfence(struct timecounter *tc __unused) +{ + + mfence(); + return (rdtsc32()); +} + +static u_int +tsc_get_timecount_low_mfence(struct timecounter *tc) +{ + + mfence(); + return (tsc_get_timecount_low(tc)); +} + uint32_t cpu_fill_vdso_timehands(struct vdso_timehands *vdso_th) { From owner-svn-src-head@FreeBSD.ORG Wed Aug 1 17:31:32 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 156FB106564A; Wed, 1 Aug 2012 17:31:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 005E48FC12; Wed, 1 Aug 2012 17:31:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q71HVVed080048; Wed, 1 Aug 2012 17:31:31 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q71HVVsa080043; Wed, 1 Aug 2012 17:31:31 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201208011731.q71HVVsa080043@svn.freebsd.org> From: Alexander Motin Date: Wed, 1 Aug 2012 17:31:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238974 - head/sys/dev/mps X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Aug 2012 17:31:32 -0000 Author: mav Date: Wed Aug 1 17:31:31 2012 New Revision: 238974 URL: http://svn.freebsd.org/changeset/base/238974 Log: Several fixes to allow firmware/BIOS flash access from user-level: - remove special handling of zero length transfers in mpi_pre_fw_upload(); - add missing MPS_CM_FLAGS_DATAIN flag in mpi_pre_fw_upload(); - move mps_user_setup_request() call into proper place; - increase user command timeout from 30 to 60 seconds; - avoid NULL dereference panic in case of firmware crash. Set max DMA segment size to 24bit, as MPI SGE supports it. Use mps_add_dmaseg() to add empty SGE instead of custom code. Tune endianness safety. Reviewed by: Desai, Kashyap Sponsored by: iXsystems, Inc. Modified: head/sys/dev/mps/mps.c head/sys/dev/mps/mps_table.c head/sys/dev/mps/mps_user.c head/sys/dev/mps/mpsvar.h Modified: head/sys/dev/mps/mps.c ============================================================================== --- head/sys/dev/mps/mps.c Wed Aug 1 17:26:22 2012 (r238973) +++ head/sys/dev/mps/mps.c Wed Aug 1 17:31:31 2012 (r238974) @@ -924,7 +924,7 @@ mps_alloc_requests(struct mps_softc *sc) NULL, NULL, /* filter, filterarg */ BUS_SPACE_MAXSIZE_32BIT,/* maxsize */ nsegs, /* nsegments */ - BUS_SPACE_MAXSIZE_32BIT,/* maxsegsize */ + BUS_SPACE_MAXSIZE_24BIT,/* maxsegsize */ BUS_DMA_ALLOCNOW, /* flags */ busdma_lock_mutex, /* lockfunc */ &sc->mps_mtx, /* lockarg */ @@ -2014,7 +2014,6 @@ mps_push_sge(struct mps_command *cm, voi MPI2_SGE_SIMPLE64 *sge = sgep; int error, type; uint32_t saved_buf_len, saved_address_low, saved_address_high; - u32 sge_flags; type = (tc->Flags & MPI2_SGE_FLAGS_ELEMENT_MASK); @@ -2034,14 +2033,12 @@ mps_push_sge(struct mps_command *cm, voi break; case MPI2_SGE_FLAGS_SIMPLE_ELEMENT: /* Driver only uses 64-bit SGE simple elements */ - sge = sgep; if (len != MPS_SGE64_SIZE) panic("SGE simple %p length %u or %zu?", sge, MPS_SGE64_SIZE, len); - if (((sge->FlagsLength >> MPI2_SGE_FLAGS_SHIFT) & + if (((le32toh(sge->FlagsLength) >> MPI2_SGE_FLAGS_SHIFT) & MPI2_SGE_FLAGS_ADDRESS_SIZE) == 0) - panic("SGE simple %p flags %02x not marked 64-bit?", - sge, sge->FlagsLength >> MPI2_SGE_FLAGS_SHIFT); + panic("SGE simple %p not marked 64-bit?", sge); break; default: @@ -2073,8 +2070,8 @@ mps_push_sge(struct mps_command *cm, voi * Mark as last element in this chain if necessary. */ if (type == MPI2_SGE_FLAGS_SIMPLE_ELEMENT) { - sge->FlagsLength |= - (MPI2_SGE_FLAGS_LAST_ELEMENT << MPI2_SGE_FLAGS_SHIFT); + sge->FlagsLength |= htole32( + MPI2_SGE_FLAGS_LAST_ELEMENT << MPI2_SGE_FLAGS_SHIFT); } /* @@ -2083,11 +2080,6 @@ mps_push_sge(struct mps_command *cm, voi * understanding the code. */ cm->cm_sglsize -= len; - /* Endian Safe code */ - sge_flags = sge->FlagsLength; - sge->FlagsLength = htole32(sge_flags); - sge->Address.High = htole32(sge->Address.High); - sge->Address.Low = htole32(sge->Address.Low); bcopy(sgep, cm->cm_sge, len); cm->cm_sge = (MPI2_SGE_IO_UNION *)((uintptr_t)cm->cm_sge + len); return (mps_add_chain(cm)); @@ -2127,27 +2119,22 @@ mps_push_sge(struct mps_command *cm, voi * 2 SGL's for a bi-directional request, they both use the same * DMA buffer (same cm command). */ - saved_buf_len = sge->FlagsLength & 0x00FFFFFF; + saved_buf_len = le32toh(sge->FlagsLength) & 0x00FFFFFF; saved_address_low = sge->Address.Low; saved_address_high = sge->Address.High; if (cm->cm_out_len) { - sge->FlagsLength = cm->cm_out_len | + sge->FlagsLength = htole32(cm->cm_out_len | ((uint32_t)(MPI2_SGE_FLAGS_SIMPLE_ELEMENT | MPI2_SGE_FLAGS_END_OF_BUFFER | MPI2_SGE_FLAGS_HOST_TO_IOC | MPI2_SGE_FLAGS_64_BIT_ADDRESSING) << - MPI2_SGE_FLAGS_SHIFT); + MPI2_SGE_FLAGS_SHIFT)); cm->cm_sglsize -= len; - /* Endian Safe code */ - sge_flags = sge->FlagsLength; - sge->FlagsLength = htole32(sge_flags); - sge->Address.High = htole32(sge->Address.High); - sge->Address.Low = htole32(sge->Address.Low); bcopy(sgep, cm->cm_sge, len); cm->cm_sge = (MPI2_SGE_IO_UNION *)((uintptr_t)cm->cm_sge + len); } - sge->FlagsLength = saved_buf_len | + saved_buf_len |= ((uint32_t)(MPI2_SGE_FLAGS_SIMPLE_ELEMENT | MPI2_SGE_FLAGS_END_OF_BUFFER | MPI2_SGE_FLAGS_LAST_ELEMENT | @@ -2155,24 +2142,20 @@ mps_push_sge(struct mps_command *cm, voi MPI2_SGE_FLAGS_64_BIT_ADDRESSING) << MPI2_SGE_FLAGS_SHIFT); if (cm->cm_flags & MPS_CM_FLAGS_DATAIN) { - sge->FlagsLength |= + saved_buf_len |= ((uint32_t)(MPI2_SGE_FLAGS_IOC_TO_HOST) << MPI2_SGE_FLAGS_SHIFT); } else { - sge->FlagsLength |= + saved_buf_len |= ((uint32_t)(MPI2_SGE_FLAGS_HOST_TO_IOC) << MPI2_SGE_FLAGS_SHIFT); } + sge->FlagsLength = htole32(saved_buf_len); sge->Address.Low = saved_address_low; sge->Address.High = saved_address_high; } cm->cm_sglsize -= len; - /* Endian Safe code */ - sge_flags = sge->FlagsLength; - sge->FlagsLength = htole32(sge_flags); - sge->Address.High = htole32(sge->Address.High); - sge->Address.Low = htole32(sge->Address.Low); bcopy(sgep, cm->cm_sge, len); cm->cm_sge = (MPI2_SGE_IO_UNION *)((uintptr_t)cm->cm_sge + len); return (0); @@ -2190,10 +2173,10 @@ mps_add_dmaseg(struct mps_command *cm, v /* * This driver always uses 64-bit address elements for simplicity. */ + bzero(&sge, sizeof(sge)); flags |= MPI2_SGE_FLAGS_SIMPLE_ELEMENT | MPI2_SGE_FLAGS_64_BIT_ADDRESSING; - /* Set Endian safe macro in mps_push_sge */ - sge.FlagsLength = len | (flags << MPI2_SGE_FLAGS_SHIFT); + sge.FlagsLength = htole32(len | (flags << MPI2_SGE_FLAGS_SHIFT)); mps_from_u64(pa, &sge.Address); return (mps_push_sge(cm, &sge, sizeof sge, segsleft)); @@ -2290,7 +2273,6 @@ mps_data_cb2(void *arg, bus_dma_segment_ int mps_map_command(struct mps_softc *sc, struct mps_command *cm) { - MPI2_SGE_SIMPLE32 *sge; int error = 0; if (cm->cm_flags & MPS_CM_FLAGS_USE_UIO) { @@ -2301,15 +2283,8 @@ mps_map_command(struct mps_softc *sc, st cm->cm_data, cm->cm_length, mps_data_cb, cm, 0); } else { /* Add a zero-length element as needed */ - if (cm->cm_sge != NULL) { - sge = (MPI2_SGE_SIMPLE32 *)cm->cm_sge; - sge->FlagsLength = htole32((MPI2_SGE_FLAGS_LAST_ELEMENT | - MPI2_SGE_FLAGS_END_OF_BUFFER | - MPI2_SGE_FLAGS_END_OF_LIST | - MPI2_SGE_FLAGS_SIMPLE_ELEMENT) << - MPI2_SGE_FLAGS_SHIFT); - sge->Address = 0; - } + if (cm->cm_sge != NULL) + mps_add_dmaseg(cm, 0, 0, 0, 1); mps_enqueue_request(sc, cm); } Modified: head/sys/dev/mps/mps_table.c ============================================================================== --- head/sys/dev/mps/mps_table.c Wed Aug 1 17:26:22 2012 (r238973) +++ head/sys/dev/mps/mps_table.c Wed Aug 1 17:31:31 2012 (r238974) @@ -463,10 +463,12 @@ mps_print_sgl(struct mps_softc *sc, stru sge = (MPI2_SGE_SIMPLE64 *)&frame[offset * 4]; printf("SGL for command %p\n", cm); + hexdump(frame, 128, NULL, 0); while (frame != NULL) { - flags = sge->FlagsLength >> MPI2_SGE_FLAGS_SHIFT; - printf("seg%d flags=0x%x len=0x%x addr=0x%jx\n", i, flags, - sge->FlagsLength & 0xffffff, mps_to_u64(&sge->Address)); + flags = le32toh(sge->FlagsLength) >> MPI2_SGE_FLAGS_SHIFT; + printf("seg%d flags=0x%02x len=0x%06x addr=0x%016jx\n", + i, flags, le32toh(sge->FlagsLength) & 0xffffff, + mps_to_u64(&sge->Address)); if (flags & (MPI2_SGE_FLAGS_END_OF_LIST | MPI2_SGE_FLAGS_END_OF_BUFFER)) break; @@ -475,8 +477,8 @@ mps_print_sgl(struct mps_softc *sc, stru if (flags & MPI2_SGE_FLAGS_LAST_ELEMENT) { sgc = (MPI2_SGE_CHAIN32 *)sge; printf("chain flags=0x%x len=0x%x Offset=0x%x " - "Address=0x%x\n", sgc->Flags, sgc->Length, - sgc->NextChainOffset, sgc->Address); + "Address=0x%x\n", sgc->Flags, le16toh(sgc->Length), + sgc->NextChainOffset, le32toh(sgc->Address)); if (chain == NULL) chain = TAILQ_FIRST(&cm->cm_chain_list); else Modified: head/sys/dev/mps/mps_user.c ============================================================================== --- head/sys/dev/mps/mps_user.c Wed Aug 1 17:26:22 2012 (r238973) +++ head/sys/dev/mps/mps_user.c Wed Aug 1 17:31:31 2012 (r238974) @@ -534,11 +534,6 @@ mpi_pre_fw_upload(struct mps_command *cm return (EINVAL); mpi_init_sge(cm, req, &req->SGL); - if (cmd->len == 0) { - /* Perhaps just asking what the size of the fw is? */ - return (0); - } - bzero(&tc, sizeof tc); /* @@ -554,6 +549,8 @@ mpi_pre_fw_upload(struct mps_command *cm tc.ImageOffset = 0; tc.ImageSize = cmd->len; + cm->cm_flags |= MPS_CM_FLAGS_DATAIN; + return (mps_push_sge(cm, &tc, sizeof tc, 0)); } @@ -692,13 +689,6 @@ mps_user_command(struct mps_softc *sc, s mps_dprint(sc, MPS_INFO, "mps_user_command: Function %02X " "MsgFlags %02X\n", hdr->Function, hdr->MsgFlags ); - err = mps_user_setup_request(cm, cmd); - if (err != 0) { - mps_printf(sc, "mps_user_command: unsupported function 0x%X\n", - hdr->Function ); - goto RetFreeUnlocked; - } - if (cmd->len > 0) { buf = malloc(cmd->len, M_MPSUSER, M_WAITOK|M_ZERO); if(!buf) { @@ -716,8 +706,15 @@ mps_user_command(struct mps_softc *sc, s cm->cm_flags = MPS_CM_FLAGS_SGE_SIMPLE; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; + err = mps_user_setup_request(cm, cmd); + if (err != 0) { + mps_printf(sc, "mps_user_command: unsupported function 0x%X\n", + hdr->Function ); + goto RetFreeUnlocked; + } + mps_lock(sc); - err = mps_wait_command(sc, cm, 30); + err = mps_wait_command(sc, cm, 60); if (err) { mps_printf(sc, "%s: invalid request: error %d\n", @@ -726,7 +723,10 @@ mps_user_command(struct mps_softc *sc, s } rpl = (MPI2_DEFAULT_REPLY *)cm->cm_reply; - sz = rpl->MsgLength * 4; + if (rpl != NULL) + sz = rpl->MsgLength * 4; + else + sz = 0; if (sz > cmd->rpl_len) { mps_printf(sc, Modified: head/sys/dev/mps/mpsvar.h ============================================================================== --- head/sys/dev/mps/mpsvar.h Wed Aug 1 17:26:22 2012 (r238973) +++ head/sys/dev/mps/mpsvar.h Wed Aug 1 17:31:31 2012 (r238974) @@ -32,7 +32,7 @@ #ifndef _MPSVAR_H #define _MPSVAR_H -#define MPS_DRIVER_VERSION "14.00.00.01-fbsd" +#define MPS_DRIVER_VERSION "14.00.00.02-fbsd" #define MPS_DB_MAX_WAIT 2500 @@ -627,15 +627,15 @@ do { \ static __inline void mps_from_u64(uint64_t data, U64 *mps) { - (mps)->High = (uint32_t)((data) >> 32); - (mps)->Low = (uint32_t)((data) & 0xffffffff); + (mps)->High = htole32((uint32_t)((data) >> 32)); + (mps)->Low = htole32((uint32_t)((data) & 0xffffffff)); } static __inline uint64_t mps_to_u64(U64 *data) { - return (((uint64_t)data->High << 32) | data->Low); + return (((uint64_t)le32toh(data->High) << 32) | le32toh(data->Low)); } static __inline void From owner-svn-src-head@FreeBSD.ORG Wed Aug 1 17:32:52 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5270B106566B; Wed, 1 Aug 2012 17:32:52 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id AB4318FC17; Wed, 1 Aug 2012 17:32:50 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q71HWrqd036337; Wed, 1 Aug 2012 20:32:53 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q71HWfjr074696; Wed, 1 Aug 2012 20:32:41 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q71HWeQ8074695; Wed, 1 Aug 2012 20:32:40 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 1 Aug 2012 20:32:40 +0300 From: Konstantin Belousov To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <20120801173240.GR2676@deviant.kiev.zoral.com.ua> References: <201208011726.q71HQMPi079603@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="+QCzO7ZIoRBwAbcw" Content-Disposition: inline In-Reply-To: <201208011726.q71HQMPi079603@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: Subject: Re: svn commit: r238973 - head/sys/x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Aug 2012 17:32:52 -0000 --+QCzO7ZIoRBwAbcw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 01, 2012 at 05:26:22PM +0000, Konstantin Belousov wrote: > Author: kib > Date: Wed Aug 1 17:26:22 2012 > New Revision: 238973 > URL: http://svn.freebsd.org/changeset/base/238973 >=20 > Log: > diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c > index c253a96..3d8bd30 100644 > --- a/sys/x86/x86/tsc.c Oops, I managed to do it: committing with the diff itself as commit log instead of the log message. Sorry. It should have been the text Rdtsc instruction is not synchronized, it seems on some Intel cores it can bypass even the locked instructions. As a result, rdtsc executed on different cores may return unordered TSC values even when the rdtsc appearance in the instruction sequences is provably ordered. Similarly to what has been done in r238755 for TSC synchronization test, add explicit fences right before rdtsc in the timecounters 'get' functions. Intel recommends to use LFENCE, while AMD refers to MFENCE. For VIA follow what Linux does and use LFENCE. With this change, I see no reordered reads of TSC on Nehalem. Change the rmb() to inlined CPUID in the SMP TSC synchronization test. On i386, locked instruction is used for rmb(), and as noted earlier, it is not enough. Since i386 machine may not support SSE2, do simplest possible synchronization with CPUID. MFC after: 1 week Discussed with: avg, bde, jkim --+QCzO7ZIoRBwAbcw Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAlAZaDgACgkQC3+MBN1Mb4j7pACgx7equ77Ip1MbvfodvJEDl1n1 L+wAoJozUUHdc2C+568QvDhpQoXfwEH5 =DZii -----END PGP SIGNATURE----- --+QCzO7ZIoRBwAbcw-- From owner-svn-src-head@FreeBSD.ORG Wed Aug 1 17:34:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 48935106566C; Wed, 1 Aug 2012 17:34:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 33D078FC1B; Wed, 1 Aug 2012 17:34:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q71HYifb080351; Wed, 1 Aug 2012 17:34:44 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q71HYh3C080349; Wed, 1 Aug 2012 17:34:43 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208011734.q71HYh3C080349@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 1 Aug 2012 17:34:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238975 - head/sys/x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Aug 2012 17:34:44 -0000 Author: kib Date: Wed Aug 1 17:34:43 2012 New Revision: 238975 URL: http://svn.freebsd.org/changeset/base/238975 Log: Do a trivial reformatting of the comment, to record the proper commit message for r238973: Rdtsc instruction is not synchronized, it seems on some Intel cores it can bypass even the locked instructions. As a result, rdtsc executed on different cores may return unordered TSC values even when the rdtsc appearance in the instruction sequences is provably ordered. Similarly to what has been done in r238755 for TSC synchronization test, add explicit fences right before rdtsc in the timecounters 'get' functions. Intel recommends to use LFENCE, while AMD refers to MFENCE. For VIA follow what Linux does and use LFENCE. With this change, I see no reordered reads of TSC on Nehalem. Change the rmb() to inlined CPUID in the SMP TSC synchronization test. On i386, locked instruction is used for rmb(), and as noted earlier, it is not enough. Since i386 machine may not support SSE2, do simplest possible synchronization with CPUID. MFC after: 1 week Discussed with: avg, bde, jkim Modified: head/sys/x86/x86/tsc.c Modified: head/sys/x86/x86/tsc.c ============================================================================== --- head/sys/x86/x86/tsc.c Wed Aug 1 17:31:31 2012 (r238974) +++ head/sys/x86/x86/tsc.c Wed Aug 1 17:34:43 2012 (r238975) @@ -354,8 +354,7 @@ init_TSC(void) * timecounters use MFENCE for AMD CPUs, and LFENCE for others (Intel * and VIA) when SSE2 is present, and nothing on older machines which * also do not issue RDTSC prematurely. There, testing for SSE2 and - * vendor is too cumbersome, and we learn about TSC presence from - * CPUID. + * vendor is too cumbersome, and we learn about TSC presence from CPUID. * * Do not use do_cpuid(), since we do not need CPUID results, which * have to be written into memory with do_cpuid(). From owner-svn-src-head@FreeBSD.ORG Wed Aug 1 17:48:39 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB0EE106564A; Wed, 1 Aug 2012 17:48:39 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7CEAA8FC08; Wed, 1 Aug 2012 17:48:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q71Hmdnb081538; Wed, 1 Aug 2012 17:48:39 GMT (envelope-from bdrewery@svn.freebsd.org) Received: (from bdrewery@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q71HmdVK081535; Wed, 1 Aug 2012 17:48:39 GMT (envelope-from bdrewery@svn.freebsd.org) Message-Id: <201208011748.q71HmdVK081535@svn.freebsd.org> From: Bryan Drewery Date: Wed, 1 Aug 2012 17:48:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238976 - in head: share/misc usr.bin/calendar/calendars X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Aug 2012 17:48:40 -0000 Author: bdrewery (ports committer) Date: Wed Aug 1 17:48:38 2012 New Revision: 238976 URL: http://svn.freebsd.org/changeset/base/238976 Log: - Add myself to calendar.freebsd - Add my mentor relationships to committers-ports.dot Approved by: eadler (mentor) Modified: head/share/misc/committers-ports.dot head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/share/misc/committers-ports.dot ============================================================================== --- head/share/misc/committers-ports.dot Wed Aug 1 17:34:43 2012 (r238975) +++ head/share/misc/committers-ports.dot Wed Aug 1 17:48:38 2012 (r238976) @@ -57,6 +57,7 @@ avilla [label="Alberto Villa\navilla@Fre avl [label="Alexander Logvinov\navl@FreeBSD.org\n2009/05/27"] az [label="Andrej Zverev\naz@FreeBSD.org\n2005/10/03"] bapt [label="Baptiste Daroussin\nbapt@FreeBSD.org\n2010/07/27"] +bdrewery [label="Bryan Drewery\nbdrewery@FreeBSD.org\n2012/07/31"] beat [label="Beat Gaetzi\nbeat@FreeBSD.org\n2009/01/28"] beech [label="Beech Rintoul\nbeech@FreeBSD.org\n2007/05/30"] bf [label="Brendan Fabeny\nbf@FreeBSD.org\n2010/06/02"] @@ -226,6 +227,7 @@ asami -> obrien avilla -> rakuco +bapt -> bdrewery bapt -> eadler bapt -> jlaffaye @@ -263,6 +265,7 @@ delphij -> rafan demon -> mat eadler -> ak +eadler -> bdrewery eadler -> gjb eadler -> tj Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Wed Aug 1 17:34:43 2012 (r238975) +++ head/usr.bin/calendar/calendars/calendar.freebsd Wed Aug 1 17:48:38 2012 (r238976) @@ -285,6 +285,7 @@ 09/18 Matthew Fleming born in Cleveland, Ohio, United States, 1975 09/20 Kevin Lo born in Taipei, Taiwan, Republic of China, 1972 09/21 Gleb Kurtsou born in Minsk, Belarus, 1984 +09/22 Bryan Drewery born in San Diego, California, United States, 1984 09/27 Neil Blakey-Milner born in Port Elizabeth, South Africa, 1978 09/27 Renato Botelho born in Araras, Sao Paulo, Brazil, 1979 09/28 Greg Lehey born in Melbourne, Victoria, Australia, 1948 From owner-svn-src-head@FreeBSD.ORG Wed Aug 1 17:57:20 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 31C49106566C; Wed, 1 Aug 2012 17:57:20 +0000 (UTC) (envelope-from giovanni.trematerra@gmail.com) Received: from mail-qc0-f182.google.com (mail-qc0-f182.google.com [209.85.216.182]) by mx1.freebsd.org (Postfix) with ESMTP id 708818FC0A; Wed, 1 Aug 2012 17:57:19 +0000 (UTC) Received: by qcsg15 with SMTP id g15so5774494qcs.13 for ; Wed, 01 Aug 2012 10:57:12 -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 :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=jrXvnx8wQLij0U6Wznu486GuMCraEN4i5pq5y7itcy0=; b=IO5iBbN9toSVYwvy3X4biOa9Qy1lpV2WUxv5EGM8/8+vaIC3AIUz/yOOd5hvC2qcMc aAIhK2ABvQh9doJaliEIKKGu9UkgQdOsgXwch/i5eUOGfH44OcssNOD63wGTlGhj4RD/ a1pTMj2zqSrh+xG1Eqln84vAJpxTgvYSR6Vuul3dr2xHHWDltXMMOZnCgck+VB4Ahrkr +5vhrdjs8uX1EMqcymCgRGrULOX8EgArqjrYHVMuHDx45D/yvzgM2+V5qLkpr+QWRrxy 7qmjyDa7IaydO/VsanMZZYOb5BA8x7/RQTQMnX8fiy5kxN0+4YoyDTLt0j1jvkPaIj4B hJvg== MIME-Version: 1.0 Received: by 10.224.26.195 with SMTP id f3mr24923779qac.71.1343843832790; Wed, 01 Aug 2012 10:57:12 -0700 (PDT) Sender: giovanni.trematerra@gmail.com Received: by 10.229.59.169 with HTTP; Wed, 1 Aug 2012 10:57:12 -0700 (PDT) In-Reply-To: <50179581.9070805@gmail.com> References: <201207310548.q6V5mZHf091624@svn.freebsd.org> <50179581.9070805@gmail.com> Date: Wed, 1 Aug 2012 19:57:12 +0200 X-Google-Sender-Auth: de3WDTBcgRNDzxivqJfyMB4ck-c Message-ID: From: Giovanni Trematerra To: davidxu@freebsd.org Content-Type: text/plain; charset=UTF-8 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Konstantin Belousov , bde@freebsd.org Subject: Re: svn commit: r238936 - in head/sys: fs/fifofs kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Aug 2012 17:57:20 -0000 On Tue, Jul 31, 2012 at 10:21 AM, David Xu wrote: > On 2012/7/31 15:22, Giovanni Trematerra wrote: >> >> On Tue, Jul 31, 2012 at 7:48 AM, David Xu wrote: >>> >>> Author: davidxu >>> Date: Tue Jul 31 05:48:35 2012 >>> New Revision: 238936 >>> URL: http://svn.freebsd.org/changeset/base/238936 >>> >>> Log: >>> I am comparing current pipe code with the one in 8.3-STABLE r236165, >>> I found 8.3 is a history BSD version using socket to implement FIFO >>> pipe, it uses per-file seqcount to compare with writer generation >>> stored in per-pipe object. The concept is after all writers are gone, >>> the pipe enters next generation, all old readers have not closed the >>> pipe should get the indication that the pipe is disconnected, result >>> is they should get EPIPE, SIGPIPE or get POLLHUP in poll(). >>> But newcomer should not know that previous writters were gone, it >>> should treat it as a fresh session. >>> I am trying to bring back FIFO pipe to history behavior. It is still >>> unclear that if single EOF flag can represent SBS_CANTSENDMORE and >>> SBS_CANTRCVMORE which socket-based version is using, but I have run >>> the poll regression test in tool directory, output is same as the one >>> on 8.3-STABLE now. >>> I think the output "not ok 18 FIFO state 6b: poll result 0 expected 1. >>> expected POLLHUP; got 0" might be bogus, because newcomer should not >>> know that old writers were gone. I got the same behavior on Linux. >>> Our implementation always return POLLIN for disconnected pipe even it >>> should return POLLHUP, but I think it is not wise to remove POLLIN for >>> compatible reason, this is our history behavior. >>> >> I'm sorry but I'm failing to understand the reason for this change. >> Can you point me out a test that confirm that the change is needed. >> The only thing I see is an increase in the memory footprint for the pipes. >> There was a lot of discussions on this topic on -arch mailing list >> >> http://lists.freebsd.org/pipermail/freebsd-arch/2012-January/012131.html >> http://lists.freebsd.org/pipermail/freebsd-arch/2012-February/012314.html >> >> Thank you >> >> -- >> Gianni >> > The old code broke some history semantic of FIFO pipe, you can try the test > tool /usr/src/tools/regression/poll/pipepoll, try it before and after my > commit, also compare the result with 8.3-STABLE, without this commit, > both sub-tests 6c and 6d failed. This is on Vanilla 9.0-RELEASE where new fifo implementation weren't backported FreeBSD bombay 9.0-RELEASE FreeBSD 9.0-RELEASE #3: Tue Dec 27 21:59:00 UTC 2011 root@build9x64.pcbsd.org:/usr/obj/builds/i386/pcbsd-build90/fbsd-source/9.0/sys/GENERIC i386 [gianni@bombay] /usr/src/tools/regression/poll#./pipepoll 1..20 ok 1 Pipe state 4: expected 0; got 0 ok 2 Pipe state 5: expected POLLIN; got POLLIN ok 3 Pipe state 6: expected POLLIN | POLLHUP; got POLLIN | POLLHUP not ok 4 Pipe state 6a: expected POLLHUP; got POLLIN | POLLHUP ok 5 Sock state 4: expected 0; got 0 ok 6 Sock state 5: expected POLLIN; got POLLIN ok 7 Sock state 6: expected POLLIN | POLLHUP; got POLLIN | POLLHUP not ok 8 Sock state 6a: expected POLLHUP; got POLLIN | POLLHUP ok 9 FIFO state 0: expected 0; got 0 ok 10 FIFO state 1: expected 0; got 0 ok 11 FIFO state 2: expected POLLIN; got POLLIN ok 12 FIFO state 2a: expected 0; got 0 not ok 13 FIFO state 3: expected POLLHUP; got POLLIN | POLLHUP ok 14 FIFO state 4: expected 0; got 0 ok 15 FIFO state 5: expected POLLIN; got POLLIN ok 16 FIFO state 6: expected POLLIN | POLLHUP; got POLLIN | POLLHUP not ok 17 FIFO state 6a: expected POLLHUP; got POLLIN | POLLHUP not ok 18 FIFO state 6b: poll result 0 expected 1. expected POLLHUP; got 0 not ok 19 FIFO state 6c: expected POLLHUP; got POLLIN | POLLHUP not ok 20 FIFO state 6d: expected POLLHUP; got POLLIN | POLLHUP As you can see, sub-tests 6c and 6d failed too on 9. So it's not a problem with new code though is irrelevant wrt the commit. > > I think old code did not mimic original code correctly, > in 8.3-STABLE code, seqcount is stored in each file, writer generation > detection is based on each copy of seqcount, but your code stored single > copy of seqcount in fifoinfo object which is store as vnode data, and > made the writer generation flag global by setting PIPE_SAMEWGEN in pipe > object and used this flag to determine if it should return POLLHUP/POLLIN > or not, this is wrong, for example: > when there is no writer but have old readers, new incoming reader will > executes: > line 174 and 175: > > fip->fi_seqcount = fip->fi_wgen - fip->fi_writers; > FIFO_WPDWGEN(fip, fpipe); > > this causes fi_seqcount to be equal to fi_wgen because fi_writer is zero, > and FIFO_WPDWGEN() turns on flag PIPE_SAMEWGEN. > When PIPE_SAMEWGEN is on, pipe_poll() ignores EOF, this breaks old readers, > it causes old reader to get nothing while it should get POLLHUP from poll(). > Ops, right. So a pointy hat to me. Thank you -- Gianni From owner-svn-src-head@FreeBSD.ORG Wed Aug 1 18:49:01 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 546CA106564A; Wed, 1 Aug 2012 18:49:01 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3EC0C8FC0A; Wed, 1 Aug 2012 18:49:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q71In10I086829; Wed, 1 Aug 2012 18:49:01 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q71In1ET086827; Wed, 1 Aug 2012 18:49:01 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201208011849.q71In1ET086827@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 1 Aug 2012 18:49:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238977 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Aug 2012 18:49:01 -0000 Author: luigi Date: Wed Aug 1 18:49:00 2012 New Revision: 238977 URL: http://svn.freebsd.org/changeset/base/238977 Log: add a cast to avoid a signed/unsigned warning (to be removed when we will have TUNABLE_UINT constructors) Modified: head/sys/netinet/ipfw/ip_fw2.c Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Wed Aug 1 17:48:38 2012 (r238976) +++ head/sys/netinet/ipfw/ip_fw2.c Wed Aug 1 18:49:00 2012 (r238977) @@ -176,7 +176,7 @@ SYSCTL_INT(_net_inet_ip_fw, OID_AUTO, de &default_to_accept, 0, "Make the default rule accept all packets."); TUNABLE_INT("net.inet.ip.fw.default_to_accept", &default_to_accept); -TUNABLE_INT("net.inet.ip.fw.tables_max", &default_fw_tables); +TUNABLE_INT("net.inet.ip.fw.tables_max", (int *)&default_fw_tables); SYSCTL_VNET_INT(_net_inet_ip_fw, OID_AUTO, static_count, CTLFLAG_RD, &VNET_NAME(layer3_chain.n_rules), 0, "Number of static rules"); From owner-svn-src-head@FreeBSD.ORG Wed Aug 1 18:52:08 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 648E81065673; Wed, 1 Aug 2012 18:52:08 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 450028FC0A; Wed, 1 Aug 2012 18:52:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q71Iq8jJ087183; Wed, 1 Aug 2012 18:52:08 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q71Iq83L087180; Wed, 1 Aug 2012 18:52:08 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201208011852.q71Iq83L087180@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 1 Aug 2012 18:52:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238978 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Aug 2012 18:52:08 -0000 Author: luigi Date: Wed Aug 1 18:52:07 2012 New Revision: 238978 URL: http://svn.freebsd.org/changeset/base/238978 Log: replace inet_ntoa_r with the more standard inet_ntop(). As discussed on -current, inet_ntoa_r() is non standard, has different arguments in userspace and kernel, and almost unused (no clients in userspace, only net/flowtable.c, net/if_llatbl.c, netinet/in_pcb.c, netinet/tcp_subr.c in the kernel) Modified: head/sys/netinet/ipfw/ip_fw_dynamic.c head/sys/netinet/ipfw/ip_fw_log.c Modified: head/sys/netinet/ipfw/ip_fw_dynamic.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_dynamic.c Wed Aug 1 18:49:00 2012 (r238977) +++ head/sys/netinet/ipfw/ip_fw_dynamic.c Wed Aug 1 18:52:07 2012 (r238978) @@ -275,9 +275,9 @@ unlink_dyn_rule_print(struct ipfw_flow_i #endif { da.s_addr = htonl(id->src_ip); - inet_ntoa_r(da, src); + inet_ntop(AF_INET, &da, src, sizeof(src)); da.s_addr = htonl(id->dst_ip); - inet_ntoa_r(da, dst); + inet_ntop(AF_INET, &da, dst, sizeof(dst)); } printf("ipfw: unlink entry %s %d -> %s %d, %d left\n", src, id->src_port, dst, id->dst_port, V_dyn_count - 1); @@ -656,9 +656,9 @@ add_dyn_rule(struct ipfw_flow_id *id, u_ #endif { da.s_addr = htonl(r->id.src_ip); - inet_ntoa_r(da, src); + inet_ntop(AF_INET, &da, src, sizeof(src)); da.s_addr = htonl(r->id.dst_ip); - inet_ntoa_r(da, dst); + inet_ntop(AF_INET, &da, dst, sizeof(dst)); } printf("ipfw: add dyn entry ty %d %s %d -> %s %d, total %d\n", dyn_type, src, r->id.src_port, dst, r->id.dst_port, @@ -740,9 +740,9 @@ ipfw_install_state(struct ip_fw *rule, i #endif { da.s_addr = htonl(args->f_id.src_ip); - inet_ntoa_r(da, src); + inet_ntop(AF_INET, &da, src, sizeof(src)); da.s_addr = htonl(args->f_id.dst_ip); - inet_ntoa_r(da, dst); + inet_ntop(AF_INET, &da, dst, sizeof(dst)); } printf("ipfw: %s: type %d %s %u -> %s %u\n", __func__, cmd->o.opcode, src, args->f_id.src_port, @@ -850,10 +850,12 @@ ipfw_install_state(struct ip_fw *rule, i { da.s_addr = htonl(args->f_id.src_ip); - inet_ntoa_r(da, src); + inet_ntop(AF_INET, &da, src, + sizeof(src)); da.s_addr = htonl(args->f_id.dst_ip); - inet_ntoa_r(da, dst); + inet_ntop(AF_INET, &da, dst, + sizeof(dst)); } log(LOG_SECURITY | LOG_DEBUG, "ipfw: %d %s %s:%u -> %s:%u, %s\n", Modified: head/sys/netinet/ipfw/ip_fw_log.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_log.c Wed Aug 1 18:49:00 2012 (r238977) +++ head/sys/netinet/ipfw/ip_fw_log.c Wed Aug 1 18:52:07 2012 (r238978) @@ -450,8 +450,8 @@ ipfw_log(struct ip_fw *f, u_int hlen, st tcp = L3HDR(struct tcphdr, ip); udp = L3HDR(struct udphdr, ip); - inet_ntoa_r(ip->ip_src, src); - inet_ntoa_r(ip->ip_dst, dst); + inet_ntop(AF_INET, &ip->ip_src, src, sizeof(src)); + inet_ntop(AF_INET, &ip->ip_dst, dst, sizeof(dst)); } switch (args->f_id.proto) { From owner-svn-src-head@FreeBSD.ORG Wed Aug 1 19:03:55 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16A73106566C; Wed, 1 Aug 2012 19:03:55 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id A6EAD8FC14; Wed, 1 Aug 2012 19:03:54 +0000 (UTC) Received: by obbun3 with SMTP id un3so16267324obb.13 for ; Wed, 01 Aug 2012 12:03:53 -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=+YtK0Q2AC2rCMsSxfyn1LT4lDNIfrIxKmttJ3XEJUOM=; b=k6Do38fHGIF3zJMoyPK2zpJnwZ2A03t7i/NASXg6OSmRPMod40CSw2EzoLlkQlCQ3/ N0ZJ6NRTrqQ55kv/E06ZdHdUMMfGLGvglNVMzSv/pQAWl54ctsS01LLHVSo0BiOXS8Tb 9QWRjT3KzKKHOgG58mIHfyKzKfZdMCWkQnpWiC/FhVOPk10ATMo3LQD6AsERZT307H/p nzuOKkhqOkPwT+AtPUxi/mxwMBD/S9gYrVv3L1APSUkcxhBh2Wiu8q2LrUJQADjI5W34 qtg7UUMZy09ym+HwcRllqkD2CglRwu6WCD3biJoVPZ78QS1tH12Yv8jgk7zNtOC2MczE dyqA== MIME-Version: 1.0 Received: by 10.182.2.233 with SMTP id 9mr30543024obx.11.1343847833909; Wed, 01 Aug 2012 12:03:53 -0700 (PDT) Received: by 10.76.84.7 with HTTP; Wed, 1 Aug 2012 12:03:53 -0700 (PDT) In-Reply-To: <201208011849.q71In1ET086827@svn.freebsd.org> References: <201208011849.q71In1ET086827@svn.freebsd.org> Date: Wed, 1 Aug 2012 12:03:53 -0700 Message-ID: From: Garrett Cooper To: Luigi Rizzo Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r238977 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Aug 2012 19:03:55 -0000 On Wed, Aug 1, 2012 at 11:49 AM, Luigi Rizzo wrote: > Author: luigi > Date: Wed Aug 1 18:49:00 2012 > New Revision: 238977 > URL: http://svn.freebsd.org/changeset/base/238977 > > Log: > add a cast to avoid a signed/unsigned warning (to be removed > when we will have TUNABLE_UINT constructors) I have some code I can provide here if you're interested with testcases (it never made it in because I got stuck in review-gatory). Thanks, -Garrett From owner-svn-src-head@FreeBSD.ORG Wed Aug 1 19:27:13 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7B0461065672; Wed, 1 Aug 2012 19:27:13 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6522D8FC14; Wed, 1 Aug 2012 19:27:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q71JRD7A090382; Wed, 1 Aug 2012 19:27:13 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q71JRDAu090380; Wed, 1 Aug 2012 19:27:13 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201208011927.q71JRDAu090380@svn.freebsd.org> From: "George V. Neville-Neil" Date: Wed, 1 Aug 2012 19:27:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238979 - head/cddl/contrib/opensolaris/lib/libdtrace/common X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Aug 2012 19:27:13 -0000 Author: gnn Date: Wed Aug 1 19:27:12 2012 New Revision: 238979 URL: http://svn.freebsd.org/changeset/base/238979 Log: When we return with an error we cannot unlock the mutex, because it's been freed. Protect against that, hopefully unlikely, case. Reviewed by: rpaulo MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c Wed Aug 1 18:52:07 2012 (r238978) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c Wed Aug 1 19:27:12 2012 (r238979) @@ -942,7 +942,8 @@ dt_proc_create_thread(dtrace_hdl_t *dtp, (int)dpr->dpr_pid, strerror(err)); } - (void) pthread_mutex_unlock(&dpr->dpr_lock); + if (err == 0) + (void) pthread_mutex_unlock(&dpr->dpr_lock); (void) pthread_attr_destroy(&a); return (err); From owner-svn-src-head@FreeBSD.ORG Wed Aug 1 19:29:58 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A57DD106566B; Wed, 1 Aug 2012 19:29:58 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by mx1.freebsd.org (Postfix) with ESMTP id 360E28FC14; Wed, 1 Aug 2012 19:29:57 +0000 (UTC) Received: from c122-106-171-246.carlnfd1.nsw.optusnet.com.au (c122-106-171-246.carlnfd1.nsw.optusnet.com.au [122.106.171.246]) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q71JTn61013963 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 2 Aug 2012 05:29:50 +1000 Date: Thu, 2 Aug 2012 05:29:49 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Giovanni Trematerra In-Reply-To: Message-ID: <20120802051805.P3345@besplex.bde.org> References: <201207310548.q6V5mZHf091624@svn.freebsd.org> <50179581.9070805@gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, Konstantin Belousov , davidxu@FreeBSD.org, svn-src-head@FreeBSD.org, bde@FreeBSD.org Subject: Re: svn commit: r238936 - in head/sys: fs/fifofs kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Aug 2012 19:29:58 -0000 On Wed, 1 Aug 2012, Giovanni Trematerra wrote: > On Tue, Jul 31, 2012 at 10:21 AM, David Xu wrote: >> ... >> The old code broke some history semantic of FIFO pipe, you can try the test >> tool /usr/src/tools/regression/poll/pipepoll, try it before and after my >> commit, also compare the result with 8.3-STABLE, without this commit, >> both sub-tests 6c and 6d failed. > > This is on Vanilla 9.0-RELEASE where new fifo implementation weren't backported > > FreeBSD bombay 9.0-RELEASE FreeBSD 9.0-RELEASE #3: Tue Dec 27 21:59:00 > UTC 2011 root@build9x64.pcbsd.org:/usr/obj/builds/i386/pcbsd-build90/fbsd-source/9.0/sys/GENERIC > i386 > > [gianni@bombay] /usr/src/tools/regression/poll#./pipepoll > 1..20 > not ok 17 FIFO state 6a: expected POLLHUP; got POLLIN | POLLHUP > not ok 18 FIFO state 6b: poll result 0 expected 1. expected POLLHUP; got 0 > not ok 19 FIFO state 6c: expected POLLHUP; got POLLIN | POLLHUP > not ok 20 FIFO state 6d: expected POLLHUP; got POLLIN | POLLHUP > > As you can see, sub-tests 6c and 6d failed too on 9. So it's not a problem with > new code though is irrelevant wrt the commit. The failure is very differnt. Failure to clear POLLIN in 6a, 6c and 6d is a normal bug in FreeBSD. Failure to set POLLHUP is apparently a normal bug in FreeBSD (I didn't know about this one). But now, POLLHUP isn't set for 6c or 6d, and consequentially, POLLIN isn't set either. The behaviour is strangely version-depending: - FreeBSD-9 (ref9-amd64): as above (select 6c and 6d pass) - FreeBSD-10 (ref10-amd64 Feb 19 2012): as above - FreeBSD-10 (ref10-i386 Jul 10 2012): not ok 17 FIFO state 6a: expected POLLHUP; got POLLIN | POLLHUP not ok 18 FIFO state 6b: poll result 0 expected 1. expected POLLHUP; got 0 not ok 19 FIFO state 6c: poll result 0 expected 1. expected POLLHUP; got 0 not ok 20 FIFO state 6d: poll result 0 expected 1. expected POLLHUP; got 0 Actually, this is not strange. The difference between the FreeBSD-10's sys_pipe.c is your new pipe implementation. Bruce From owner-svn-src-head@FreeBSD.ORG Wed Aug 1 23:05:57 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DBC021065673; Wed, 1 Aug 2012 23:05:57 +0000 (UTC) (envelope-from avatar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C697C8FC12; Wed, 1 Aug 2012 23:05:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q71N5vNi009603; Wed, 1 Aug 2012 23:05:57 GMT (envelope-from avatar@svn.freebsd.org) Received: (from avatar@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q71N5vD6009601; Wed, 1 Aug 2012 23:05:57 GMT (envelope-from avatar@svn.freebsd.org) Message-Id: <201208012305.q71N5vD6009601@svn.freebsd.org> From: Tai-hwa Liang Date: Wed, 1 Aug 2012 23:05:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238980 - head/sys/gnu/fs/reiserfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 01 Aug 2012 23:05:58 -0000 Author: avatar Date: Wed Aug 1 23:05:57 2012 New Revision: 238980 URL: http://svn.freebsd.org/changeset/base/238980 Log: Just like the other file systems found in /sys/fs, g_vfs_open() should be paried with g_vfs_close(). Though g_vfs_close() is a wrapper around g_wither_geom_close(), r206130 added the following test in g_vfs_open(): if (bo->bo_private != vp) return (EBUSY); Which will cause a 'Device busy' error inside reiserfs_mountfs() if the same file system is re-mounted again after umount or mounting failure: (case 1, /dev/ad4s3 is not a valid REISERFS partition) # mount -t reiserfs -o ro /dev/ad4s3 /mnt mount: /dev/ad4s3: Invalid argument # mount -t msdosfs -o ro /dev/ad4s3 /mnt mount: /dev/ad4s3: Device busy (case 2, /dev/ad4s3 is a valid REISERFS partition) # mount -t reiserfs -o ro /dev/ad4s3 /mnt # umount /mnt # mount -t reiserfs -o ro /dev/ad4s3 /mnt mount: /dev/ad4s3: Device busy On the other hand, g_vfs_close() 'fixed' the above cases by doing an extra step to keep 'sc->sc_bo->bo_private' and 'cp->private' pointers synchronised. Reviewed by: kib MFC after: 1 month Modified: head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c Modified: head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c ============================================================================== --- head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c Wed Aug 1 19:27:12 2012 (r238979) +++ head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c Wed Aug 1 23:05:57 2012 (r238980) @@ -227,7 +227,7 @@ reiserfs_unmount(struct mount *mp, int m DROP_GIANT(); g_topology_lock(); - g_wither_geom_close(rmp->rm_cp->geom, ENXIO); + g_vfs_close(rmp->rm_cp); g_topology_unlock(); PICKUP_GIANT(); vrele(rmp->rm_devvp); @@ -611,7 +611,7 @@ out: if (cp != NULL) { DROP_GIANT(); g_topology_lock(); - g_wither_geom_close(cp->geom, ENXIO); + g_vfs_close(cp); g_topology_unlock(); PICKUP_GIANT(); } From owner-svn-src-head@FreeBSD.ORG Thu Aug 2 00:00:35 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78212106564A; Thu, 2 Aug 2012 00:00:35 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 62B7D8FC0C; Thu, 2 Aug 2012 00:00:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7200ZbY014250; Thu, 2 Aug 2012 00:00:35 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7200ZHu014248; Thu, 2 Aug 2012 00:00:35 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201208020000.q7200ZHu014248@svn.freebsd.org> From: Sean Bruno Date: Thu, 2 Aug 2012 00:00:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238981 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Aug 2012 00:00:35 -0000 Author: sbruno Date: Thu Aug 2 00:00:34 2012 New Revision: 238981 URL: http://svn.freebsd.org/changeset/base/238981 Log: CPU_NEXT() already handles wrapping around to the beginning. Also, in a system with sparse CPU IDs, you can have a valid CPU ID > mp_ncpus (e.g. if you have two CPUs 0 and 4, with mp_maxid == 4 and mp_ncpus == 2). Introduced at svn r235210 Submitted by: jhb@ Reviewed by: jfv@ Modified: head/sys/dev/e1000/if_igb.c Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Wed Aug 1 23:05:57 2012 (r238980) +++ head/sys/dev/e1000/if_igb.c Thu Aug 2 00:00:34 2012 (r238981) @@ -2522,7 +2522,6 @@ igb_allocate_msix(struct adapter *adapte "Bound queue %d to cpu %d\n", i,igb_last_bind_cpu); igb_last_bind_cpu = CPU_NEXT(igb_last_bind_cpu); - igb_last_bind_cpu = igb_last_bind_cpu % mp_ncpus; } #if __FreeBSD_version >= 800000 TASK_INIT(&que->txr->txq_task, 0, igb_deferred_mq_start, From owner-svn-src-head@FreeBSD.ORG Thu Aug 2 03:01:45 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 27D03106564A; Thu, 2 Aug 2012 03:01:45 +0000 (UTC) (envelope-from listlog2011@gmail.com) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id E0C518FC08; Thu, 2 Aug 2012 03:01:44 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q7231fX1051303; Thu, 2 Aug 2012 03:01:42 GMT (envelope-from listlog2011@gmail.com) Message-ID: <5019ED93.8060802@gmail.com> Date: Thu, 02 Aug 2012 11:01:39 +0800 From: David Xu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Bruce Evans References: <201207310548.q6V5mZHf091624@svn.freebsd.org> <50179581.9070805@gmail.com> <20120802051805.P3345@besplex.bde.org> In-Reply-To: <20120802051805.P3345@besplex.bde.org> Content-Type: multipart/mixed; boundary="------------050607040407000205060504" Cc: src-committers@FreeBSD.org, Giovanni Trematerra , svn-src-all@FreeBSD.org, Konstantin Belousov , davidxu@FreeBSD.org, svn-src-head@FreeBSD.org, bde@FreeBSD.org Subject: Re: svn commit: r238936 - in head/sys: fs/fifofs kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: davidxu@FreeBSD.org List-Id: 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, 02 Aug 2012 03:01:45 -0000 This is a multi-part message in MIME format. --------------050607040407000205060504 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 2012/8/2 3:29, Bruce Evans wrote: > On Wed, 1 Aug 2012, Giovanni Trematerra wrote: > >> On Tue, Jul 31, 2012 at 10:21 AM, David Xu >> wrote: >>> ... >>> The old code broke some history semantic of FIFO pipe, you can try >>> the test >>> tool /usr/src/tools/regression/poll/pipepoll, try it before and >>> after my >>> commit, also compare the result with 8.3-STABLE, without this commit, >>> both sub-tests 6c and 6d failed. >> >> This is on Vanilla 9.0-RELEASE where new fifo implementation weren't >> backported >> >> FreeBSD bombay 9.0-RELEASE FreeBSD 9.0-RELEASE #3: Tue Dec 27 21:59:00 >> UTC 2011 >> root@build9x64.pcbsd.org:/usr/obj/builds/i386/pcbsd-build90/fbsd-source/9.0/sys/GENERIC >> i386 >> >> [gianni@bombay] /usr/src/tools/regression/poll#./pipepoll >> 1..20 >> not ok 17 FIFO state 6a: expected POLLHUP; got POLLIN | POLLHUP >> not ok 18 FIFO state 6b: poll result 0 expected 1. expected POLLHUP; >> got 0 >> not ok 19 FIFO state 6c: expected POLLHUP; got POLLIN | POLLHUP >> not ok 20 FIFO state 6d: expected POLLHUP; got POLLIN | POLLHUP >> >> As you can see, sub-tests 6c and 6d failed too on 9. So it's not a >> problem with >> new code though is irrelevant wrt the commit. > > The failure is very differnt. Failure to clear POLLIN in 6a, 6c and 6d > is a normal bug in FreeBSD. I have attached a patch to fix it, it should make the regression tool happy. Is it worth to commit ? --------------050607040407000205060504 Content-Type: text/plain; charset=gb18030; name="sys_pipe.disable_eof_pollin.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="sys_pipe.disable_eof_pollin.diff" Index: sys_pipe.c =================================================================== --- sys_pipe.c (revision 238936) +++ sys_pipe.c (working copy) @@ -1447,7 +1447,6 @@ if ((events & POLLINIGNEOF) == 0) { if (rpipe->pipe_state & PIPE_EOF) { - revents |= (events & (POLLIN | POLLRDNORM)); if (wpipe->pipe_present != PIPE_ACTIVE || (wpipe->pipe_state & PIPE_EOF)) revents |= POLLHUP; --------------050607040407000205060504-- From owner-svn-src-head@FreeBSD.ORG Thu Aug 2 07:35:41 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 427C3106566B; Thu, 2 Aug 2012 07:35:41 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1547F8FC0A; Thu, 2 Aug 2012 07:35:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q727Zeq6051575; Thu, 2 Aug 2012 07:35:40 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q727ZeUd051573; Thu, 2 Aug 2012 07:35:40 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201208020735.q727ZeUd051573@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 2 Aug 2012 07:35:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238982 - head/sys/dev/netmap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Aug 2012 07:35:41 -0000 Author: luigi Date: Thu Aug 2 07:35:40 2012 New Revision: 238982 URL: http://svn.freebsd.org/changeset/base/238982 Log: Add a newline on an error message; rename linux functions to avoid confusion; fix error reporting on linux Modified: head/sys/dev/netmap/netmap.c Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Thu Aug 2 00:00:34 2012 (r238981) +++ head/sys/dev/netmap/netmap.c Thu Aug 2 07:35:40 2012 (r238982) @@ -56,7 +56,7 @@ #ifdef linux #include "bsd_glue.h" -static netdev_tx_t netmap_start_linux(struct sk_buff *skb, struct net_device *dev); +static netdev_tx_t linux_netmap_start(struct sk_buff *skb, struct net_device *dev); #endif /* linux */ #ifdef __APPLE__ @@ -1331,7 +1331,7 @@ netmap_attach(struct netmap_adapter *na, /* prepare a clone of the netdev ops */ na->nm_ndo = *ifp->netdev_ops; } - na->nm_ndo.ndo_start_xmit = netmap_start_linux; + na->nm_ndo.ndo_start_xmit = linux_netmap_start; #endif D("%s for %s", buf ? "ok" : "failed", ifp->if_xname); @@ -1554,7 +1554,7 @@ linux_netmap_poll(struct file * file, st } static int -netmap_mmap(struct file *f, struct vm_area_struct *vma) +linux_netmap_mmap(struct file *f, struct vm_area_struct *vma) { int lut_skip, i, j; int user_skip = 0; @@ -1596,7 +1596,7 @@ netmap_mmap(struct file *f, struct vm_ar } static netdev_tx_t -netmap_start_linux(struct sk_buff *skb, struct net_device *dev) +linux_netmap_start(struct sk_buff *skb, struct net_device *dev) { netmap_start(dev, skb); return (NETDEV_TX_OK); @@ -1637,7 +1637,7 @@ netmap_release(struct inode *inode, stru static struct file_operations netmap_fops = { - .mmap = netmap_mmap, + .mmap = linux_netmap_mmap, LIN_IOCTL_NAME = linux_netmap_ioctl, .poll = linux_netmap_poll, .release = netmap_release, @@ -1652,7 +1652,13 @@ static struct miscdevice netmap_cdevsw = static int netmap_init(void); static void netmap_fini(void); -module_init(netmap_init); +/* Errors have negative values on linux */ +static int linux_netmap_init(void) +{ + return -netmap_init(); +} + +module_init(linux_netmap_init); module_exit(netmap_fini); /* export certain symbols to other modules */ EXPORT_SYMBOL(netmap_attach); // driver attach routines @@ -2038,7 +2044,7 @@ netmap_init(void) error = netmap_memory_init(); if (error != 0) { - printf("netmap: unable to initialize the memory allocator."); + printf("netmap: unable to initialize the memory allocator.\n"); return (error); } printf("netmap: loaded module with %d Mbytes\n", From owner-svn-src-head@FreeBSD.ORG Thu Aug 2 08:13:03 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 898A0106566C; Thu, 2 Aug 2012 08:13:03 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail02.syd.optusnet.com.au (mail02.syd.optusnet.com.au [211.29.132.183]) by mx1.freebsd.org (Postfix) with ESMTP id 1866F8FC0A; Thu, 2 Aug 2012 08:13:02 +0000 (UTC) Received: from c122-106-171-246.carlnfd1.nsw.optusnet.com.au (c122-106-171-246.carlnfd1.nsw.optusnet.com.au [122.106.171.246]) by mail02.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q728CxPc010824 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 2 Aug 2012 18:13:01 +1000 Date: Thu, 2 Aug 2012 18:12:59 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: davidxu@freebsd.org In-Reply-To: <5019ED93.8060802@gmail.com> Message-ID: <20120802173441.X1291@besplex.bde.org> References: <201207310548.q6V5mZHf091624@svn.freebsd.org> <50179581.9070805@gmail.com> <20120802051805.P3345@besplex.bde.org> <5019ED93.8060802@gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: src-committers@freebsd.org, Giovanni Trematerra , svn-src-all@freebsd.org, Konstantin Belousov , bde@freebsd.org, Bruce Evans , svn-src-head@freebsd.org Subject: Re: svn commit: r238936 - in head/sys: fs/fifofs kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Aug 2012 08:13:03 -0000 On Thu, 2 Aug 2012, David Xu wrote: > On 2012/8/2 3:29, Bruce Evans wrote: >> On Wed, 1 Aug 2012, Giovanni Trematerra wrote: >>> ... >>> [gianni@bombay] /usr/src/tools/regression/poll#./pipepoll >>> 1..20 >>> not ok 17 FIFO state 6a: expected POLLHUP; got POLLIN | POLLHUP >>> not ok 18 FIFO state 6b: poll result 0 expected 1. expected POLLHUP; got 0 >>> not ok 19 FIFO state 6c: expected POLLHUP; got POLLIN | POLLHUP >>> not ok 20 FIFO state 6d: expected POLLHUP; got POLLIN | POLLHUP >>> >>> As you can see, sub-tests 6c and 6d failed too on 9. So it's not a problem >>> with >>> new code though is irrelevant wrt the commit. >> >> The failure is very differnt. Failure to clear POLLIN in 6a, 6c and 6d >> is a normal bug in FreeBSD. > > I have attached a patch to fix it, it should make the regression tool happy. > Is it worth to commit ? This is your patch quoted inline: % Index: sys_pipe.c % =================================================================== % --- sys_pipe.c (revision 238936) % +++ sys_pipe.c (working copy) % @@ -1447,7 +1447,6 @@ % % if ((events & POLLINIGNEOF) == 0) { % if (rpipe->pipe_state & PIPE_EOF) { % - revents |= (events & (POLLIN | POLLRDNORM)); % if (wpipe->pipe_present != PIPE_ACTIVE || % (wpipe->pipe_state & PIPE_EOF)) % revents |= POLLHUP; My old patches use this: % Index: sys_pipe.c % =================================================================== % RCS file: /home/ncvs/src/sys/kern/sys_pipe.c,v % retrieving revision 1.171 % diff -u -2 -r1.171 sys_pipe.c % --- sys_pipe.c 27 Mar 2004 19:50:22 -0000 1.171 % +++ sys_pipe.c 13 Aug 2009 11:33:08 -0000 % @@ -1296,6 +1295,5 @@ % if (events & (POLLIN | POLLRDNORM)) % if ((rpipe->pipe_state & PIPE_DIRECTW) || % - (rpipe->pipe_buffer.cnt > 0) || % - (rpipe->pipe_state & PIPE_EOF)) % + (rpipe->pipe_buffer.cnt > 0)) % revents |= events & (POLLIN | POLLRDNORM); % I'm not sure if there is any difference. The pipe code seems to have been changed to be more like the socket code. I made similar patches for sockets (to set POLLHUP on hangup (now in -current) and to not set POLLIN on hangup unless there is still data to be read). I started killing POLLINIGNEOF for sockets. -current added it for nameless pipes instead :-(. With the new fifo implementation, POLLINIGNEOF is even more of a mistake for sockets, but more needed for pipes since named pipes are fifos. % Index: uipc_socket.c % =================================================================== % RCS file: /home/ncvs/src/sys/kern/uipc_socket.c,v % retrieving revision 1.189 % diff -u -2 -r1.189 uipc_socket.c % --- uipc_socket.c 24 Jun 2004 04:28:30 -0000 1.189 % +++ uipc_socket.c 26 Aug 2009 22:49:12 -0000 % @@ -1862,4 +1861,9 @@ % } % % +#define soreadabledata(so) \ % + (((so)->so_rcv.sb_cc > 0 && \ % + (so)->so_rcv.sb_cc >= (so)->so_rcv.sb_lowat) || \ % + !TAILQ_EMPTY(&(so)->so_comp) || (so)->so_error) % + % int % sopoll(struct socket *so, int events, struct ucred *active_cred, -current already has this in a header (don't count hangup as data). But -current still sets POLLIN for compatibility later, except in the bogus POLLINIGNEOF case. It only uses the above change to avoid setting POLLIN initially for hangup in the POLLINIGNEOF case. % @@ -1869,12 +1873,7 @@ % % if (events & (POLLIN | POLLRDNORM)) % - if (soreadable(so)) % + if (soreadabledata(so)) % revents |= events & (POLLIN | POLLRDNORM); Make POLLIN actually track data, not disconnection. % % - if (events & POLLINIGNEOF) % - if (so->so_rcv.sb_cc >= so->so_rcv.sb_lowat || % - !TAILQ_EMPTY(&so->so_comp) || so->so_error) % - revents |= POLLINIGNEOF; % - % if (events & (POLLOUT | POLLWRNORM)) % if (sowriteable(so)) Start killing this. % @@ -1885,8 +1884,15 @@ % revents |= events & (POLLPRI | POLLRDBAND); % % + if ((events & POLLINIGNEOF) == 0) { % + if (so->so_rcv.sb_state & SBS_CANTRCVMORE) { % + if (so->so_snd.sb_state & SBS_CANTSENDMORE) % + revents |= POLLHUP; % + else % + revents |= events & (POLLIN | POLLRDNORM); % + } % + } % + Don't completely kill POLLINIGNEOF. I forget how the 2 socket state EOF flags work. Both this and -current set POLLHUP iff both socket state EOF flags are set. Then this never sets POLLIN, while -current always sets it. Both set POLLIN of SBS_CANTRCVMORE is set but SBS_CANTSENDMORE is not set. Note that POLLIN has already been set if there is actual data, so any setting of it here is bogus, but there seems to be a problem when only SBS_CANTRCVMORE is set. Then !SBS_CANTSENDMORE implies that output is still possible, so we must be able to return POLLOUT, but POLLOUT is incompatible with POLLHUP so we can't set POLLHUP. We apparently set POLLIN to fake this partial EOF. % if (revents == 0) { % - if (events & % - (POLLIN | POLLINIGNEOF | POLLPRI | POLLRDNORM | % - POLLRDBAND)) { % + if (events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) { Continue killing POLLINIGNEOF. % SOCKBUF_LOCK(&so->so_rcv); % selrecord(td, &so->so_rcv.sb_sel); Bruce From owner-svn-src-head@FreeBSD.ORG Thu Aug 2 08:46:09 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 12E4A106566B; Thu, 2 Aug 2012 08:46:09 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EFDB18FC0C; Thu, 2 Aug 2012 08:46:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q728k8HL057060; Thu, 2 Aug 2012 08:46:08 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q728k8AL057056; Thu, 2 Aug 2012 08:46:08 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201208020846.q728k8AL057056@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 2 Aug 2012 08:46:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238983 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Aug 2012 08:46:09 -0000 Author: luigi Date: Thu Aug 2 08:46:08 2012 New Revision: 238983 URL: http://svn.freebsd.org/changeset/base/238983 Log: Update netmap page, fixing the API documentation and usage example. Add a new manpage for the vale switch Added: head/share/man/man4/vale.4 (contents, props changed) Modified: head/share/man/man4/Makefile head/share/man/man4/netmap.4 Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Thu Aug 2 07:35:40 2012 (r238982) +++ head/share/man/man4/Makefile Thu Aug 2 08:46:08 2012 (r238983) @@ -509,6 +509,7 @@ MAN= aac.4 \ utopia.4 \ uvisor.4 \ uvscom.4 \ + vale.4 \ vga.4 \ vge.4 \ viapm.4 \ Modified: head/share/man/man4/netmap.4 ============================================================================== --- head/share/man/man4/netmap.4 Thu Aug 2 07:35:40 2012 (r238982) +++ head/share/man/man4/netmap.4 Thu Aug 2 08:46:08 2012 (r238983) @@ -21,12 +21,12 @@ .\" 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. -.\" +.\" .\" This document is derived in part from the enet man page (enet.4) .\" distributed with 4.3BSD Unix. .\" .\" $FreeBSD$ -.\" $Id: netmap.4 9662 2011-11-16 13:18:06Z luigi $: stable/8/share/man/man4/bpf.4 181694 2008-08-13 17:45:06Z ed $ +.\" $Id: netmap.4 11563 2012-08-02 08:59:12Z luigi $: stable/8/share/man/man4/bpf.4 181694 2008-08-13 17:45:06Z ed $ .\" .Dd February 27, 2012 .Dt NETMAP 4 @@ -43,14 +43,15 @@ is a framework for fast and safe access .Nm uses memory mapped buffers and metadata (buffer indexes and lengths) to communicate with the kernel, -which is in charge of validating information through +which is in charge of validating information through .Pa ioctl() and -.Pa select()/poll() . +.Pa select()/poll(). .Nm can exploit the parallelism in multiqueue devices and multicore systems. .Pp +.Pp .Nm requires explicit support in device drivers. For a list of supported devices, see the end of this manual page. @@ -65,7 +66,7 @@ to bind the file descriptor to a network When a device is put in .Nm mode, its data path is disconnected from the host stack. -The processes owning the file descriptor +The processes owning the file descriptor can exchange packets with the device, or with the host stack, through an mmapped memory region that contains pre-allocated buffers and metadata. @@ -88,6 +89,7 @@ are relative (offsets or indexes). Some them into actual pointers. .Pp The data structures in shared memory are the following: +.Pp .Bl -tag -width XXX .It Dv struct netmap_if (one per interface) indicates the number of rings supported by an interface, their @@ -159,7 +161,8 @@ struct netmap_ring *rxring = NETMAP_RXRI int i = txring->slot[txring->cur].buf_idx; char *buf = NETMAP_BUF(txring, i); .Ed -.Ss IOCTLS +.Sh IOCTLS +.Pp .Nm supports some ioctl() to synchronize the state of the rings between the kernel and the user processes, plus some @@ -172,7 +175,7 @@ defined as follows: struct nmreq { char nr_name[IFNAMSIZ]; uint32_t nr_version; /* API version */ -#define NETMAP_API 2 /* current version */ +#define NETMAP_API 3 /* current version */ uint32_t nr_offset; /* nifp offset in the shared region */ uint32_t nr_memsize; /* size of the shared region */ uint32_t nr_tx_slots; /* slots in tx rings */ @@ -184,6 +187,8 @@ struct nmreq { #define NETMAP_SW_RING 0x2000 /* we process the sw ring */ #define NETMAP_NO_TX_POLL 0x1000 /* no gratuitous txsync on poll */ #define NETMAP_RING_MASK 0xfff /* the actual ring number */ + uint16_t spare1; + uint32_t spare2[4]; }; .Ed @@ -250,7 +255,7 @@ number of slots available for transmissi tells the hardware of consumed packets, and asks for newly available packets. .El -.Ss SYSTEM CALLS +.Sh SYSTEM CALLS .Nm uses .Nm select @@ -279,7 +284,7 @@ fds.fd = fd; fds.events = POLLOUT; for (;;) { poll(list, 1, -1); - while (ring->avail-- > 0) { + for ( ; ring->avail > 0 ; ring->avail--) { i = ring->cur; buf = NETMAP_BUF(ring, ring->slot[i].buf_index); ... prepare packet in buf ... @@ -292,13 +297,31 @@ for (;;) { .Nm supports the following interfaces: .Xr em 4 , +.Xr igb 4 , .Xr ixgbe 4 , -.Xr re 4 , +.Xr lem 4 , +.Xr re 4 +.Sh SEE ALSO +.Xr vale 4 +.Pp +http://info.iet.unipi.it/~luigi/netmap/ +.Pp +Luigi Rizzo, Revisiting network I/O APIs: the netmap framework, +Communications of the ACM, 55 (3), pp.45-51, March 2012 +.Pp +Luigi Rizzo, netmap: a novel framework for fast packet I/O, +Usenix ATC'12, June 2012, Boston .Sh AUTHORS +.An -nosplit The .Nm -framework has been designed and implemented by -.An Luigi Rizzo -and -.An Matteo Landi -in 2011 at the Universita` di Pisa. +framework has been designed and implemented at the +Universita` di Pisa in 2011 by +.An Luigi Rizzo , +with help from +.An Matteo Landi , +.An Gaetano Catalli , +.An Giuseppe Lettieri . +.Pp +.Nm +has been funded by the European Commission within FP7 Project CHANGE (257422). Added: head/share/man/man4/vale.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/vale.4 Thu Aug 2 08:46:08 2012 (r238983) @@ -0,0 +1,134 @@ +.\" Copyright (c) 2012 Luigi Rizzo, Universita` di Pisa +.\" 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. +.\" +.\" This document is derived in part from the enet man page (enet.4) +.\" distributed with 4.3BSD Unix. +.\" +.\" $FreeBSD$ +.\" $Id: $ +.\" +.Dd July 27, 2012 +.Dt VALE 4 +.Os +.Sh NAME +.Nm vale +.Nd a very fast Virtual Local Ethernet using the netmap API +.Sh SYNOPSIS +.Cd device netmap +.Sh DESCRIPTION +.Nm +is a feature of the +.Nm netmap +module that implements multiple Virtual switches that can +be used to interconnect netmap clients, including traffic +sources and sinks, packet forwarders, userspace firewalls, +and so on. +.Pp +.Nm +is implemented completely in software, and is extremely fast. +On a modern machine it can move almost 20 Million packets per +second (Mpps) per core with small frames, and about 70 Gbit/s +with 1500 byte frames. +.Pp +.Sh OPERATION +.Nm +dynamically creates switches and ports as client connect +to it using the +.Xr netmap 4 +API. +.Pp +.Nm +ports are named +.Pa vale[bdg:][port] +where +.Pa vale +is the prefix indicating a VALE switch rather than a standard interface, +.Pa bdg +indicates a specific switch (the colon is a separator), +and +.Pa port +indicates a port within the switch. +Bridge and ports names are arbitrary strings, the only +constraint being that the full name must fit within 16 +characters. +.Pp +See +.Xr netmap 4 +for details on the API. +.Ss LIMITS +.Nm +currently supports up to 4 switches, 16 ports per switch, +1024 buffers per port. These hard limits will be +changed to sysctl variables in future releases. +.Pp +.Sh SYSCTL VARIABLES +.Nm +uses the following sysctl variables to control operation: +.Bl -tag -width 12 +.It dev.netmap.bridge +The maximum number of packets processed internally +in each iteration. +Defaults to 1024, use lower values to trade latency +with throughput. +.Pp +.It dev.netmap.verbose +Set to non-zero values to enable in-kernel diagnostics. +.El +.Pp +.Sh EXAMPLES +Create one switch, with a traffic generator connected to one +port, and a netmap-enabled tcpdump instance on another port: +.Bd -literal -offset indent +tcpdump -ni vale-a:1 & +pkt-gen -i vale-a:0 -f tx & +.Ed +.Pp +Create two switches, +each connected to two qemu machines on different ports. +.Bd -literal -offset indent +qemu -net nic -net netmap,ifname=vale-1:a ... & +qemu -net nic -net netmap,ifname=vale-1:b ... & +qemu -net nic -net netmap,ifname=vale-2:c ... & +qemu -net nic -net netmap,ifname=vale-2:d ... & +.Ed +.Sh SEE ALSO +.Xr netmap 4 +.Pp +.Xr http://info.iet.unipi.it/~luigi/vale/ +.Pp +Luigi Rizzo, Giuseppe Lettieri: VALE, a switched ethernet for virtual machines, +June 2012, http://info.iet.unipi.it/~luigi/vale/ +.Sh AUTHORS +.An -nosplit +The +.Nm +switch has been designed and implemented in 2012 by +.An Luigi Rizzo +and +.An Giuseppe Lettieri +at the Universita` di Pisa. +.Pp +.Nm +has been funded by the European Commission within FP7 Projects +CHANGE (257422) and OPENLAB (287581). From owner-svn-src-head@FreeBSD.ORG Thu Aug 2 10:39:55 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 30A3F106566C; Thu, 2 Aug 2012 10:39:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1B8F78FC0A; Thu, 2 Aug 2012 10:39:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q72AdsLG067246; Thu, 2 Aug 2012 10:39:54 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q72Adss4067244; Thu, 2 Aug 2012 10:39:54 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208021039.q72Adss4067244@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 2 Aug 2012 10:39:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238984 - head/sbin/fsck_ffs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Aug 2012 10:39:55 -0000 Author: kib Date: Thu Aug 2 10:39:54 2012 New Revision: 238984 URL: http://svn.freebsd.org/changeset/base/238984 Log: fsck_ffs shall accept the configured journal size, and not refuse to operate on it if journal size is greater then SUJ_MAX. The later constant is only to select maximal journal size when user did not specified size explicitely. Submitted by: Andrey Zonov Reviewed by: mckusick MFC after: 1 week Modified: head/sbin/fsck_ffs/suj.c Modified: head/sbin/fsck_ffs/suj.c ============================================================================== --- head/sbin/fsck_ffs/suj.c Thu Aug 2 08:46:08 2012 (r238983) +++ head/sbin/fsck_ffs/suj.c Thu Aug 2 10:39:54 2012 (r238984) @@ -2383,7 +2383,7 @@ suj_verifyino(union dinode *ip) return (-1); } - if (DIP(ip, di_size) < SUJ_MIN || DIP(ip, di_size) > SUJ_MAX) { + if (DIP(ip, di_size) < SUJ_MIN) { printf("Invalid size %jd for journal inode %d\n", DIP(ip, di_size), sujino); return (-1); From owner-svn-src-head@FreeBSD.ORG Thu Aug 2 11:59:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F31671065672; Thu, 2 Aug 2012 11:59:43 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DE1798FC0A; Thu, 2 Aug 2012 11:59:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q72Bxh7r078919; Thu, 2 Aug 2012 11:59:43 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q72Bxhcu078913; Thu, 2 Aug 2012 11:59:43 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201208021159.q72Bxhcu078913@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 2 Aug 2012 11:59:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238985 - head/sys/dev/netmap X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Aug 2012 11:59:44 -0000 Author: luigi Date: Thu Aug 2 11:59:43 2012 New Revision: 238985 URL: http://svn.freebsd.org/changeset/base/238985 Log: fix some signed/unsigned warnings in the netmap code. Unfortunately the original drivers still have a lot of sign conversion/comparison warnings. Modified: head/sys/dev/netmap/if_em_netmap.h head/sys/dev/netmap/if_igb_netmap.h head/sys/dev/netmap/ixgbe_netmap.h head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_kern.h Modified: head/sys/dev/netmap/if_em_netmap.h ============================================================================== --- head/sys/dev/netmap/if_em_netmap.h Thu Aug 2 10:39:54 2012 (r238984) +++ head/sys/dev/netmap/if_em_netmap.h Thu Aug 2 11:59:43 2012 (r238985) @@ -171,7 +171,7 @@ em_netmap_txsync(struct ifnet *ifp, u_in u_int j, k, l, n = 0, lim = kring->nkr_num_slots - 1; /* generate an interrupt approximately every half ring */ - int report_frequency = kring->nkr_num_slots >> 1; + u_int report_frequency = kring->nkr_num_slots >> 1; k = ring->cur; if (k > lim) Modified: head/sys/dev/netmap/if_igb_netmap.h ============================================================================== --- head/sys/dev/netmap/if_igb_netmap.h Thu Aug 2 10:39:54 2012 (r238984) +++ head/sys/dev/netmap/if_igb_netmap.h Thu Aug 2 11:59:43 2012 (r238985) @@ -125,7 +125,7 @@ igb_netmap_txsync(struct ifnet *ifp, u_i u_int j, k, l, n = 0, lim = kring->nkr_num_slots - 1; /* generate an interrupt approximately every half ring */ - int report_frequency = kring->nkr_num_slots >> 1; + u_int report_frequency = kring->nkr_num_slots >> 1; k = ring->cur; if (k > lim) Modified: head/sys/dev/netmap/ixgbe_netmap.h ============================================================================== --- head/sys/dev/netmap/ixgbe_netmap.h Thu Aug 2 10:39:54 2012 (r238984) +++ head/sys/dev/netmap/ixgbe_netmap.h Thu Aug 2 11:59:43 2012 (r238985) @@ -233,7 +233,7 @@ ixgbe_netmap_txsync(struct ifnet *ifp, u * seems very expensive, so we interrupt once every half ring, * or when requested with NS_REPORT */ - int report_frequency = kring->nkr_num_slots >> 1; + u_int report_frequency = kring->nkr_num_slots >> 1; if (k > lim) return netmap_ring_reinit(kring); Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Thu Aug 2 10:39:54 2012 (r238984) +++ head/sys/dev/netmap/netmap.c Thu Aug 2 11:59:43 2012 (r238985) @@ -119,8 +119,8 @@ SYSCTL_INT(_dev_netmap, OID_AUTO, verbos CTLFLAG_RW, &netmap_verbose, 0, "Verbose mode"); SYSCTL_INT(_dev_netmap, OID_AUTO, no_timestamp, CTLFLAG_RW, &netmap_no_timestamp, 0, "no_timestamp"); -int netmap_buf_size = 2048; -TUNABLE_INT("hw.netmap.buf_size", &netmap_buf_size); +u_int netmap_buf_size = 2048; +TUNABLE_INT("hw.netmap.buf_size", (u_int *)&netmap_buf_size); SYSCTL_INT(_dev_netmap, OID_AUTO, buf_size, CTLFLAG_RD, &netmap_buf_size, 0, "Size of packet buffers"); int netmap_mitigate = 1; @@ -1379,7 +1379,7 @@ netmap_start(struct ifnet *ifp, struct m struct netmap_adapter *na = NA(ifp); struct netmap_kring *kring = &na->rx_rings[na->num_rx_rings]; u_int i, len = MBUF_LEN(m); - int error = EBUSY, lim = kring->nkr_num_slots - 1; + u_int error = EBUSY, lim = kring->nkr_num_slots - 1; struct netmap_slot *slot; if (netmap_verbose & NM_VERB_HOST) @@ -1955,7 +1955,7 @@ bdg_netmap_rxsync(struct ifnet *ifp, u_i struct netmap_adapter *na = NA(ifp); struct netmap_kring *kring = &na->rx_rings[ring_nr]; struct netmap_ring *ring = kring->ring; - int j, n, lim = kring->nkr_num_slots - 1; + u_int j, n, lim = kring->nkr_num_slots - 1; u_int k = ring->cur, resvd = ring->reserved; ND("%s ring %d lock %d avail %d", Modified: head/sys/dev/netmap/netmap_kern.h ============================================================================== --- head/sys/dev/netmap/netmap_kern.h Thu Aug 2 10:39:54 2012 (r238984) +++ head/sys/dev/netmap/netmap_kern.h Thu Aug 2 11:59:43 2012 (r238985) @@ -241,7 +241,7 @@ struct netmap_slot *netmap_reset(struct enum txrx tx, int n, u_int new_cur); int netmap_ring_reinit(struct netmap_kring *); -extern int netmap_buf_size; +extern u_int netmap_buf_size; #define NETMAP_BUF_SIZE netmap_buf_size extern int netmap_mitigate; extern int netmap_no_pendintr; From owner-svn-src-head@FreeBSD.ORG Thu Aug 2 12:16:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC02A106566C; Thu, 2 Aug 2012 12:16:46 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE05C8FC19; Thu, 2 Aug 2012 12:16:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q72CGkpm080249; Thu, 2 Aug 2012 12:16:46 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q72CGkix080246; Thu, 2 Aug 2012 12:16:46 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201208021216.q72CGkix080246@svn.freebsd.org> From: Joel Dahl Date: Thu, 2 Aug 2012 12:16:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238986 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Aug 2012 12:16:47 -0000 Author: joel (doc committer) Date: Thu Aug 2 12:16:46 2012 New Revision: 238986 URL: http://svn.freebsd.org/changeset/base/238986 Log: mdoc: remove superfluous paragraph macro. Modified: head/share/man/man4/netmap.4 head/share/man/man4/vale.4 Modified: head/share/man/man4/netmap.4 ============================================================================== --- head/share/man/man4/netmap.4 Thu Aug 2 11:59:43 2012 (r238985) +++ head/share/man/man4/netmap.4 Thu Aug 2 12:16:46 2012 (r238986) @@ -51,7 +51,6 @@ and can exploit the parallelism in multiqueue devices and multicore systems. .Pp -.Pp .Nm requires explicit support in device drivers. For a list of supported devices, see the end of this manual page. @@ -89,7 +88,6 @@ are relative (offsets or indexes). Some them into actual pointers. .Pp The data structures in shared memory are the following: -.Pp .Bl -tag -width XXX .It Dv struct netmap_if (one per interface) indicates the number of rings supported by an interface, their @@ -162,7 +160,6 @@ int i = txring->slot[txring->cur].buf_id char *buf = NETMAP_BUF(txring, i); .Ed .Sh IOCTLS -.Pp .Nm supports some ioctl() to synchronize the state of the rings between the kernel and the user processes, plus some Modified: head/share/man/man4/vale.4 ============================================================================== --- head/share/man/man4/vale.4 Thu Aug 2 11:59:43 2012 (r238985) +++ head/share/man/man4/vale.4 Thu Aug 2 12:16:46 2012 (r238986) @@ -50,7 +50,6 @@ is implemented completely in software, a On a modern machine it can move almost 20 Million packets per second (Mpps) per core with small frames, and about 70 Gbit/s with 1500 byte frames. -.Pp .Sh OPERATION .Nm dynamically creates switches and ports as client connect @@ -81,7 +80,6 @@ for details on the API. currently supports up to 4 switches, 16 ports per switch, 1024 buffers per port. These hard limits will be changed to sysctl variables in future releases. -.Pp .Sh SYSCTL VARIABLES .Nm uses the following sysctl variables to control operation: @@ -95,7 +93,6 @@ with throughput. .It dev.netmap.verbose Set to non-zero values to enable in-kernel diagnostics. .El -.Pp .Sh EXAMPLES Create one switch, with a traffic generator connected to one port, and a netmap-enabled tcpdump instance on another port: From owner-svn-src-head@FreeBSD.ORG Thu Aug 2 12:17:53 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 619C61065670; Thu, 2 Aug 2012 12:17:53 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4CEB18FC15; Thu, 2 Aug 2012 12:17:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q72CHrUj080443; Thu, 2 Aug 2012 12:17:53 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q72CHrVc080441; Thu, 2 Aug 2012 12:17:53 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201208021217.q72CHrVc080441@svn.freebsd.org> From: Joel Dahl Date: Thu, 2 Aug 2012 12:17:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238987 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Aug 2012 12:17:53 -0000 Author: joel (doc committer) Date: Thu Aug 2 12:17:52 2012 New Revision: 238987 URL: http://svn.freebsd.org/changeset/base/238987 Log: Remove trailing whitespace. Modified: head/share/man/man4/netmap.4 Modified: head/share/man/man4/netmap.4 ============================================================================== --- head/share/man/man4/netmap.4 Thu Aug 2 12:16:46 2012 (r238986) +++ head/share/man/man4/netmap.4 Thu Aug 2 12:17:52 2012 (r238987) @@ -43,7 +43,7 @@ is a framework for fast and safe access .Nm uses memory mapped buffers and metadata (buffer indexes and lengths) to communicate with the kernel, -which is in charge of validating information through +which is in charge of validating information through .Pa ioctl() and .Pa select()/poll(). @@ -65,7 +65,7 @@ to bind the file descriptor to a network When a device is put in .Nm mode, its data path is disconnected from the host stack. -The processes owning the file descriptor +The processes owning the file descriptor can exchange packets with the device, or with the host stack, through an mmapped memory region that contains pre-allocated buffers and metadata. From owner-svn-src-head@FreeBSD.ORG Thu Aug 2 12:29:49 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B36EB106564A; Thu, 2 Aug 2012 12:29:49 +0000 (UTC) (envelope-from listlog2011@gmail.com) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 95FEC8FC0C; Thu, 2 Aug 2012 12:29:49 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q72CTb9t043734; Thu, 2 Aug 2012 12:29:38 GMT (envelope-from listlog2011@gmail.com) Message-ID: <501A72AE.30309@gmail.com> Date: Thu, 02 Aug 2012 20:29:34 +0800 From: David Xu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Bruce Evans References: <201207310548.q6V5mZHf091624@svn.freebsd.org> <50179581.9070805@gmail.com> <20120802051805.P3345@besplex.bde.org> <5019ED93.8060802@gmail.com> <20120802173441.X1291@besplex.bde.org> In-Reply-To: <20120802173441.X1291@besplex.bde.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, Giovanni Trematerra , svn-src-all@freebsd.org, Konstantin Belousov , davidxu@freebsd.org, svn-src-head@freebsd.org, bde@freebsd.org Subject: Re: svn commit: r238936 - in head/sys: fs/fifofs kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: davidxu@freebsd.org List-Id: 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, 02 Aug 2012 12:29:49 -0000 On 2012/8/2 16:12, Bruce Evans wrote: > On Thu, 2 Aug 2012, David Xu wrote: > >> On 2012/8/2 3:29, Bruce Evans wrote: >>> On Wed, 1 Aug 2012, Giovanni Trematerra wrote: >>>> ... >>>> [gianni@bombay] /usr/src/tools/regression/poll#./pipepoll >>>> 1..20 >>>> not ok 17 FIFO state 6a: expected POLLHUP; got POLLIN | POLLHUP >>>> not ok 18 FIFO state 6b: poll result 0 expected 1. expected >>>> POLLHUP; got 0 >>>> not ok 19 FIFO state 6c: expected POLLHUP; got POLLIN | POLLHUP >>>> not ok 20 FIFO state 6d: expected POLLHUP; got POLLIN | POLLHUP >>>> >>>> As you can see, sub-tests 6c and 6d failed too on 9. So it's not a >>>> problem with >>>> new code though is irrelevant wrt the commit. >>> >>> The failure is very differnt. Failure to clear POLLIN in 6a, 6c and 6d >>> is a normal bug in FreeBSD. >> >> I have attached a patch to fix it, it should make the regression tool >> happy. >> Is it worth to commit ? > > This is your patch quoted inline: > > % Index: sys_pipe.c > % =================================================================== > % --- sys_pipe.c (revision 238936) > % +++ sys_pipe.c (working copy) > % @@ -1447,7 +1447,6 @@ > % % if ((events & POLLINIGNEOF) == 0) { > % if (rpipe->pipe_state & PIPE_EOF) { > % - revents |= (events & (POLLIN | POLLRDNORM)); > % if (wpipe->pipe_present != PIPE_ACTIVE || > % (wpipe->pipe_state & PIPE_EOF)) > % revents |= POLLHUP; > > My old patches use this: > > % Index: sys_pipe.c > % =================================================================== > % RCS file: /home/ncvs/src/sys/kern/sys_pipe.c,v > % retrieving revision 1.171 > % diff -u -2 -r1.171 sys_pipe.c > % --- sys_pipe.c 27 Mar 2004 19:50:22 -0000 1.171 > % +++ sys_pipe.c 13 Aug 2009 11:33:08 -0000 > % @@ -1296,6 +1295,5 @@ > % if (events & (POLLIN | POLLRDNORM)) > % if ((rpipe->pipe_state & PIPE_DIRECTW) || > % - (rpipe->pipe_buffer.cnt > 0) || > % - (rpipe->pipe_state & PIPE_EOF)) > % + (rpipe->pipe_buffer.cnt > 0)) > % revents |= events & (POLLIN | POLLRDNORM); > % > > I'm not sure if there is any difference. The pipe code seems to have > been changed to be more like the socket code. > > I made similar patches for sockets (to set POLLHUP on hangup (now in > -current) and to not set POLLIN on hangup unless there is still data > to be read). I started killing POLLINIGNEOF for sockets. -current > added it for nameless pipes instead :-(. With the new fifo > implementation, POLLINIGNEOF is even more of a mistake for sockets, > but more needed for pipes since named pipes are fifos. > > % Index: uipc_socket.c > % =================================================================== > % RCS file: /home/ncvs/src/sys/kern/uipc_socket.c,v > % retrieving revision 1.189 > % diff -u -2 -r1.189 uipc_socket.c > % --- uipc_socket.c 24 Jun 2004 04:28:30 -0000 1.189 > % +++ uipc_socket.c 26 Aug 2009 22:49:12 -0000 > % @@ -1862,4 +1861,9 @@ > % } > % % +#define soreadabledata(so) \ > % + (((so)->so_rcv.sb_cc > 0 && \ > % + (so)->so_rcv.sb_cc >= (so)->so_rcv.sb_lowat) || \ > % + !TAILQ_EMPTY(&(so)->so_comp) || (so)->so_error) > % + > % int > % sopoll(struct socket *so, int events, struct ucred *active_cred, > > -current already has this in a header (don't count hangup as data). > But -current still sets POLLIN for compatibility later, except in the > bogus POLLINIGNEOF case. It only uses the above change to avoid > setting POLLIN initially for hangup in the POLLINIGNEOF case. > > % @@ -1869,12 +1873,7 @@ > % % if (events & (POLLIN | POLLRDNORM)) > % - if (soreadable(so)) > % + if (soreadabledata(so)) > % revents |= events & (POLLIN | POLLRDNORM); > > Make POLLIN actually track data, not disconnection. > > % % - if (events & POLLINIGNEOF) > % - if (so->so_rcv.sb_cc >= so->so_rcv.sb_lowat || > % - !TAILQ_EMPTY(&so->so_comp) || so->so_error) > % - revents |= POLLINIGNEOF; > % - > % if (events & (POLLOUT | POLLWRNORM)) > % if (sowriteable(so)) > > Start killing this. > > % @@ -1885,8 +1884,15 @@ > % revents |= events & (POLLPRI | POLLRDBAND); > % % + if ((events & POLLINIGNEOF) == 0) { > % + if (so->so_rcv.sb_state & SBS_CANTRCVMORE) { > % + if (so->so_snd.sb_state & SBS_CANTSENDMORE) > % + revents |= POLLHUP; > % + else > % + revents |= events & (POLLIN | POLLRDNORM); > % + } > % + } > % + > > Don't completely kill POLLINIGNEOF. I forget how the 2 socket state EOF > flags work. Both this and -current set POLLHUP iff both socket state > EOF flags are set. Then this never sets POLLIN, while -current always > sets it. Both set POLLIN of SBS_CANTRCVMORE is set but SBS_CANTSENDMORE > is not set. Note that POLLIN has already been set if there is actual > data, > so any setting of it here is bogus, but there seems to be a problem > when only SBS_CANTRCVMORE is set. Then !SBS_CANTSENDMORE implies that > output is still possible, so we must be able to return POLLOUT, but > POLLOUT is incompatible with POLLHUP so we can't set POLLHUP. We > apparently set POLLIN to fake this partial EOF. > > % if (revents == 0) { > % - if (events & > % - (POLLIN | POLLINIGNEOF | POLLPRI | POLLRDNORM | > % - POLLRDBAND)) { > % + if (events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) { > > Continue killing POLLINIGNEOF. > > % SOCKBUF_LOCK(&so->so_rcv); > % selrecord(td, &so->so_rcv.sb_sel); > > Bruce > I think you can kill POLLINIGNEOF at all, I have grepped, and there is no external user, only pipe and socket code use it internally. The POLLINIGNEOF is confusing because it has same prefix with POLLIN, POLLOUT and other POLL flags. From owner-svn-src-head@FreeBSD.ORG Thu Aug 2 12:45:14 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51A60106564A; Thu, 2 Aug 2012 12:45:14 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3CC658FC08; Thu, 2 Aug 2012 12:45:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q72CjEcX082644; Thu, 2 Aug 2012 12:45:14 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q72CjErR082642; Thu, 2 Aug 2012 12:45:14 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201208021245.q72CjErR082642@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 2 Aug 2012 12:45:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238988 - head/sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Aug 2012 12:45:14 -0000 Author: luigi Date: Thu Aug 2 12:45:13 2012 New Revision: 238988 URL: http://svn.freebsd.org/changeset/base/238988 Log: replace __unused with a portable construct; fix a couple of signed/unsigned warnings. Modified: head/sys/netinet/ipfw/ip_dummynet.c Modified: head/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- head/sys/netinet/ipfw/ip_dummynet.c Thu Aug 2 12:17:52 2012 (r238987) +++ head/sys/netinet/ipfw/ip_dummynet.c Thu Aug 2 12:45:13 2012 (r238988) @@ -77,9 +77,10 @@ static struct task dn_task; static struct taskqueue *dn_tq = NULL; static void -dummynet(void * __unused unused) +dummynet(void *arg) { + (void)arg; /* UNUSED */ taskqueue_enqueue(dn_tq, &dn_task); } @@ -1286,7 +1287,7 @@ config_fs(struct dn_fs *nfs, struct dn_i } if (nfs->flags & DN_HAVE_MASK) { /* make sure we have some buckets */ - ipdn_bound_var(&nfs->buckets, dn_cfg.hash_size, + ipdn_bound_var((int *)&nfs->buckets, dn_cfg.hash_size, 1, dn_cfg.max_hash_size, "flowset buckets"); } else { nfs->buckets = 1; /* we only need 1 */ @@ -1371,7 +1372,7 @@ config_sched(struct dn_sch *_nsch, struc return EINVAL; /* make sure we have some buckets */ if (a.sch->flags & DN_HAVE_MASK) - ipdn_bound_var(&a.sch->buckets, dn_cfg.hash_size, + ipdn_bound_var((int *)&a.sch->buckets, dn_cfg.hash_size, 1, dn_cfg.max_hash_size, "sched buckets"); /* XXX other sanity checks */ bzero(&p, sizeof(p)); From owner-svn-src-head@FreeBSD.ORG Thu Aug 2 13:20:45 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C428C106566C; Thu, 2 Aug 2012 13:20:45 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 73DF38FC0C; Thu, 2 Aug 2012 13:20:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q72DKjnO085475; Thu, 2 Aug 2012 13:20:45 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q72DKjfx085470; Thu, 2 Aug 2012 13:20:45 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201208021320.q72DKjfx085470@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 2 Aug 2012 13:20:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238989 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Aug 2012 13:20:45 -0000 Author: glebius Date: Thu Aug 2 13:20:44 2012 New Revision: 238989 URL: http://svn.freebsd.org/changeset/base/238989 Log: The llentry_update() is used only by flowtable and the latter always passes NULL pointer to it. Thus, code can be simplified and function renamed to llentry_alloc() to match rtalloc(). Modified: head/sys/net/flowtable.c head/sys/net/if_llatbl.c head/sys/net/if_llatbl.h Modified: head/sys/net/flowtable.c ============================================================================== --- head/sys/net/flowtable.c Thu Aug 2 12:45:13 2012 (r238988) +++ head/sys/net/flowtable.c Thu Aug 2 13:20:44 2012 (r238989) @@ -1258,7 +1258,7 @@ uncached: else l3addr = (struct sockaddr_storage *)&ro->ro_dst; - llentry_update(&lle, LLTABLE6(ifp), l3addr, ifp); + lle = llentry_alloc(ifp, LLTABLE6(ifp), l3addr); } #endif #ifdef INET @@ -1267,7 +1267,7 @@ uncached: l3addr = (struct sockaddr_storage *)rt->rt_gateway; else l3addr = (struct sockaddr_storage *)&ro->ro_dst; - llentry_update(&lle, LLTABLE(ifp), l3addr, ifp); + lle = llentry_alloc(ifp, LLTABLE(ifp), l3addr); } #endif Modified: head/sys/net/if_llatbl.c ============================================================================== --- head/sys/net/if_llatbl.c Thu Aug 2 12:45:13 2012 (r238988) +++ head/sys/net/if_llatbl.c Thu Aug 2 13:20:44 2012 (r238989) @@ -129,42 +129,33 @@ llentry_free(struct llentry *lle) } /* - * Update an llentry for address dst (equivalent to rtalloc for new-arp) - * Caller must pass in a valid struct llentry * (or NULL) + * (al)locate an llentry for address dst (equivalent to rtalloc for new-arp). * - * if found the llentry * is returned referenced and unlocked + * If found the llentry * is returned referenced and unlocked. */ -int -llentry_update(struct llentry **llep, struct lltable *lt, - struct sockaddr_storage *dst, struct ifnet *ifp) +struct llentry * +llentry_alloc(struct ifnet *ifp, struct lltable *lt, + struct sockaddr_storage *dst) { struct llentry *la; IF_AFDATA_RLOCK(ifp); - la = lla_lookup(lt, LLE_EXCLUSIVE, - (struct sockaddr *)dst); + la = lla_lookup(lt, LLE_EXCLUSIVE, (struct sockaddr *)dst); IF_AFDATA_RUNLOCK(ifp); if ((la == NULL) && (ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) == 0) { IF_AFDATA_WLOCK(ifp); - la = lla_lookup(lt, - (LLE_CREATE | LLE_EXCLUSIVE), + la = lla_lookup(lt, (LLE_CREATE | LLE_EXCLUSIVE), (struct sockaddr *)dst); IF_AFDATA_WUNLOCK(ifp); } - if (la != NULL && (*llep != la)) { - if (*llep != NULL) - LLE_FREE(*llep); + + if (la != NULL) { LLE_ADDREF(la); LLE_WUNLOCK(la); - *llep = la; - } else if (la != NULL) - LLE_WUNLOCK(la); - - if (la == NULL) - return (ENOENT); + } - return (0); + return (la); } /* Modified: head/sys/net/if_llatbl.h ============================================================================== --- head/sys/net/if_llatbl.h Thu Aug 2 12:45:13 2012 (r238988) +++ head/sys/net/if_llatbl.h Thu Aug 2 13:20:44 2012 (r238989) @@ -189,8 +189,8 @@ void lltable_drain(int); int lltable_sysctl_dumparp(int, struct sysctl_req *); size_t llentry_free(struct llentry *); -int llentry_update(struct llentry **, struct lltable *, - struct sockaddr_storage *, struct ifnet *); +struct llentry *llentry_alloc(struct ifnet *, struct lltable *, + struct sockaddr_storage *); /* * Generic link layer address lookup function. From owner-svn-src-head@FreeBSD.ORG Thu Aug 2 13:57:50 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E9F4106564A; Thu, 2 Aug 2012 13:57:50 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 79F458FC16; Thu, 2 Aug 2012 13:57:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q72Dvo0q088433; Thu, 2 Aug 2012 13:57:50 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q72DvoFJ088426; Thu, 2 Aug 2012 13:57:50 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201208021357.q72DvoFJ088426@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 2 Aug 2012 13:57:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238990 - in head/sys: net netinet netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Aug 2012 13:57:50 -0000 Author: glebius Date: Thu Aug 2 13:57:49 2012 New Revision: 238990 URL: http://svn.freebsd.org/changeset/base/238990 Log: Fix races between in_lltable_prefix_free(), lla_lookup(), llentry_free() and arptimer(): o Use callout_init_rw() for lle timeout, this allows us safely disestablish them. - This allows us to simplify the arptimer() and make it race safe. o Consistently use ifp->if_afdata_lock to lock access to linked lists in the lle hashes. o Introduce new lle flag LLE_LINKED, which marks an entry that is attached to the hash. - Use LLE_LINKED to avoid double unlinking via consequent calls to llentry_free(). - Mark lle with LLE_DELETED via |= operation istead of =, so that other flags won't be lost. o Make LLE_ADDREF(), LLE_REMREF() and LLE_FREE_LOCKED() more consistent and provide more informative KASSERTs. The patch is a collaborative work of all submitters and myself. PR: kern/165863 Submitted by: Andrey Zonov Submitted by: Ryan Stone Submitted by: Eric van Gyzen Modified: head/sys/net/if_llatbl.c head/sys/net/if_llatbl.h head/sys/net/if_var.h head/sys/netinet/if_ether.c head/sys/netinet/in.c head/sys/netinet6/in6.c Modified: head/sys/net/if_llatbl.c ============================================================================== --- head/sys/net/if_llatbl.c Thu Aug 2 13:20:44 2012 (r238989) +++ head/sys/net/if_llatbl.c Thu Aug 2 13:57:49 2012 (r238990) @@ -106,10 +106,19 @@ llentry_free(struct llentry *lle) size_t pkts_dropped; struct mbuf *next; - pkts_dropped = 0; + IF_AFDATA_WLOCK_ASSERT(lle->lle_tbl->llt_ifp); LLE_WLOCK_ASSERT(lle); + + /* XXX: guard against race with other llentry_free(). */ + if (!(lle->la_flags & LLE_LINKED)) { + LLE_FREE_LOCKED(lle); + return (0); + } + LIST_REMOVE(lle, lle_next); + lle->la_flags &= ~(LLE_VALID | LLE_LINKED); + pkts_dropped = 0; while ((lle->la_numheld > 0) && (lle->la_hold != NULL)) { next = lle->la_hold->m_nextpkt; m_freem(lle->la_hold); @@ -122,7 +131,6 @@ llentry_free(struct llentry *lle) ("%s: la_numheld %d > 0, pkts_droped %zd", __func__, lle->la_numheld, pkts_dropped)); - lle->la_flags &= ~LLE_VALID; LLE_FREE_LOCKED(lle); return (pkts_dropped); @@ -173,17 +181,16 @@ lltable_free(struct lltable *llt) SLIST_REMOVE(&V_lltables, llt, lltable, llt_link); LLTABLE_WUNLOCK(); + IF_AFDATA_WLOCK(llt->llt_ifp); for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) { LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) { - int canceled; - - canceled = callout_drain(&lle->la_timer); LLE_WLOCK(lle); - if (canceled) + if (callout_stop(&lle->la_timer)) LLE_REMREF(lle); llentry_free(lle); } } + IF_AFDATA_WUNLOCK(llt->llt_ifp); free(llt, M_LLTABLE); } Modified: head/sys/net/if_llatbl.h ============================================================================== --- head/sys/net/if_llatbl.h Thu Aug 2 13:20:44 2012 (r238989) +++ head/sys/net/if_llatbl.h Thu Aug 2 13:57:49 2012 (r238990) @@ -103,26 +103,28 @@ struct llentry { #define LLE_ADDREF(lle) do { \ LLE_WLOCK_ASSERT(lle); \ KASSERT((lle)->lle_refcnt >= 0, \ - ("negative refcnt %d", (lle)->lle_refcnt)); \ + ("negative refcnt %d on lle %p", \ + (lle)->lle_refcnt, (lle))); \ (lle)->lle_refcnt++; \ } while (0) #define LLE_REMREF(lle) do { \ LLE_WLOCK_ASSERT(lle); \ - KASSERT((lle)->lle_refcnt > 1, \ - ("bogus refcnt %d", (lle)->lle_refcnt)); \ + KASSERT((lle)->lle_refcnt > 0, \ + ("bogus refcnt %d on lle %p", \ + (lle)->lle_refcnt, (lle))); \ (lle)->lle_refcnt--; \ } while (0) #define LLE_FREE_LOCKED(lle) do { \ - if ((lle)->lle_refcnt <= 1) \ - (lle)->lle_free((lle)->lle_tbl, (lle));\ + if ((lle)->lle_refcnt == 1) \ + (lle)->lle_free((lle)->lle_tbl, (lle)); \ else { \ - (lle)->lle_refcnt--; \ + LLE_REMREF(lle); \ LLE_WUNLOCK(lle); \ } \ /* guard against invalid refs */ \ - lle = NULL; \ + (lle) = NULL; \ } while (0) #define LLE_FREE(lle) do { \ @@ -172,6 +174,7 @@ MALLOC_DECLARE(M_LLTABLE); #define LLE_VALID 0x0008 /* ll_addr is valid */ #define LLE_PROXY 0x0010 /* proxy entry ??? */ #define LLE_PUB 0x0020 /* publish entry ??? */ +#define LLE_LINKED 0x0040 /* linked to lookup structure */ #define LLE_EXCLUSIVE 0x2000 /* return lle xlocked */ #define LLE_DELETE 0x4000 /* delete on a lookup - match LLE_IFADDR */ #define LLE_CREATE 0x8000 /* create on a lookup miss */ Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Thu Aug 2 13:20:44 2012 (r238989) +++ head/sys/net/if_var.h Thu Aug 2 13:57:49 2012 (r238990) @@ -415,6 +415,8 @@ EVENTHANDLER_DECLARE(group_change_event, #define IF_AFDATA_DESTROY(ifp) rw_destroy(&(ifp)->if_afdata_lock) #define IF_AFDATA_LOCK_ASSERT(ifp) rw_assert(&(ifp)->if_afdata_lock, RA_LOCKED) +#define IF_AFDATA_RLOCK_ASSERT(ifp) rw_assert(&(ifp)->if_afdata_lock, RA_RLOCKED) +#define IF_AFDATA_WLOCK_ASSERT(ifp) rw_assert(&(ifp)->if_afdata_lock, RA_WLOCKED) #define IF_AFDATA_UNLOCK_ASSERT(ifp) rw_assert(&(ifp)->if_afdata_lock, RA_UNLOCKED) int if_handoff(struct ifqueue *ifq, struct mbuf *m, struct ifnet *ifp, Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Thu Aug 2 13:20:44 2012 (r238989) +++ head/sys/netinet/if_ether.c Thu Aug 2 13:57:49 2012 (r238990) @@ -163,49 +163,40 @@ arp_ifscrub(struct ifnet *ifp, uint32_t static void arptimer(void *arg) { + struct llentry *lle = (struct llentry *)arg; struct ifnet *ifp; - struct llentry *lle; - int pkts_dropped; + size_t pkts_dropped; + + if (lle->la_flags & LLE_STATIC) { + LLE_WUNLOCK(lle); + return; + } - KASSERT(arg != NULL, ("%s: arg NULL", __func__)); - lle = (struct llentry *)arg; ifp = lle->lle_tbl->llt_ifp; CURVNET_SET(ifp->if_vnet); + + if (lle->la_flags != LLE_DELETED) { + int evt; + + if (lle->la_flags & LLE_VALID) + evt = LLENTRY_EXPIRED; + else + evt = LLENTRY_TIMEDOUT; + EVENTHANDLER_INVOKE(lle_event, lle, evt); + } + + callout_stop(&lle->la_timer); + + /* XXX: LOR avoidance. We still have ref on lle. */ + LLE_WUNLOCK(lle); IF_AFDATA_LOCK(ifp); LLE_WLOCK(lle); - if (lle->la_flags & LLE_STATIC) - LLE_WUNLOCK(lle); - else { - if (!callout_pending(&lle->la_timer) && - callout_active(&lle->la_timer)) { - callout_stop(&lle->la_timer); - LLE_REMREF(lle); - - if (lle->la_flags != LLE_DELETED) { - int evt; - - if (lle->la_flags & LLE_VALID) - evt = LLENTRY_EXPIRED; - else - evt = LLENTRY_TIMEDOUT; - EVENTHANDLER_INVOKE(lle_event, lle, evt); - } - pkts_dropped = llentry_free(lle); - ARPSTAT_ADD(dropped, pkts_dropped); - ARPSTAT_INC(timeouts); - } else { -#ifdef DIAGNOSTIC - struct sockaddr *l3addr = L3_ADDR(lle); - log(LOG_INFO, - "arptimer issue: %p, IPv4 address: \"%s\"\n", lle, - inet_ntoa( - ((const struct sockaddr_in *)l3addr)->sin_addr)); -#endif - LLE_WUNLOCK(lle); - } - } + LLE_REMREF(lle); + pkts_dropped = llentry_free(lle); IF_AFDATA_UNLOCK(ifp); + ARPSTAT_ADD(dropped, pkts_dropped); + ARPSTAT_INC(timeouts); CURVNET_RESTORE(); } Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Thu Aug 2 13:20:44 2012 (r238989) +++ head/sys/netinet/in.c Thu Aug 2 13:57:49 2012 (r238990) @@ -1280,7 +1280,6 @@ in_lltable_new(const struct sockaddr *l3 if (lle == NULL) /* NB: caller generates msg */ return NULL; - callout_init(&lle->base.la_timer, CALLOUT_MPSAFE); /* * For IPv4 this will trigger "arpresolve" to generate * an ARP request. @@ -1290,7 +1289,10 @@ in_lltable_new(const struct sockaddr *l3 lle->base.lle_refcnt = 1; lle->base.lle_free = in_lltable_free; LLE_LOCK_INIT(&lle->base); - return &lle->base; + callout_init_rw(&lle->base.la_timer, &lle->base.lle_lock, + CALLOUT_RETURNUNLOCKED); + + return (&lle->base); } #define IN_ARE_MASKED_ADDR_EQUAL(d, a, m) ( \ @@ -1306,6 +1308,7 @@ in_lltable_prefix_free(struct lltable *l int i; size_t pkts_dropped; + IF_AFDATA_WLOCK(llt->llt_ifp); for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) { LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) { /* @@ -1315,17 +1318,15 @@ in_lltable_prefix_free(struct lltable *l if (IN_ARE_MASKED_ADDR_EQUAL(satosin(L3_ADDR(lle)), pfx, msk) && ((flags & LLE_STATIC) || !(lle->la_flags & LLE_STATIC))) { - int canceled; - - canceled = callout_drain(&lle->la_timer); LLE_WLOCK(lle); - if (canceled) + if (callout_stop(&lle->la_timer)) LLE_REMREF(lle); pkts_dropped = llentry_free(lle); ARPSTAT_ADD(dropped, pkts_dropped); } } } + IF_AFDATA_WUNLOCK(llt->llt_ifp); } @@ -1457,11 +1458,12 @@ in_lltable_lookup(struct lltable *llt, u lle->lle_tbl = llt; lle->lle_head = lleh; + lle->la_flags |= LLE_LINKED; LIST_INSERT_HEAD(lleh, lle, lle_next); } else if (flags & LLE_DELETE) { if (!(lle->la_flags & LLE_IFADDR) || (flags & LLE_IFADDR)) { LLE_WLOCK(lle); - lle->la_flags = LLE_DELETED; + lle->la_flags |= LLE_DELETED; EVENTHANDLER_INVOKE(lle_event, lle, LLENTRY_DELETED); LLE_WUNLOCK(lle); #ifdef DIAGNOSTIC Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Thu Aug 2 13:20:44 2012 (r238989) +++ head/sys/netinet6/in6.c Thu Aug 2 13:57:49 2012 (r238990) @@ -2497,23 +2497,22 @@ in6_lltable_prefix_free(struct lltable * * (flags & LLE_STATIC) means deleting all entries * including static ND6 entries. */ + IF_AFDATA_WLOCK(llt->llt_ifp); for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) { LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) { if (IN6_ARE_MASKED_ADDR_EQUAL( - &((struct sockaddr_in6 *)L3_ADDR(lle))->sin6_addr, - &pfx->sin6_addr, - &msk->sin6_addr) && - ((flags & LLE_STATIC) || !(lle->la_flags & LLE_STATIC))) { - int canceled; - - canceled = callout_drain(&lle->la_timer); + &satosin6(L3_ADDR(lle))->sin6_addr, + &pfx->sin6_addr, &msk->sin6_addr) && + ((flags & LLE_STATIC) || + !(lle->la_flags & LLE_STATIC))) { LLE_WLOCK(lle); - if (canceled) + if (callout_stop(&lle->la_timer)) LLE_REMREF(lle); llentry_free(lle); } } } + IF_AFDATA_WUNLOCK(llt->llt_ifp); } static int @@ -2605,11 +2604,12 @@ in6_lltable_lookup(struct lltable *llt, lle->lle_tbl = llt; lle->lle_head = lleh; + lle->la_flags |= LLE_LINKED; LIST_INSERT_HEAD(lleh, lle, lle_next); } else if (flags & LLE_DELETE) { if (!(lle->la_flags & LLE_IFADDR) || (flags & LLE_IFADDR)) { LLE_WLOCK(lle); - lle->la_flags = LLE_DELETED; + lle->la_flags |= LLE_DELETED; LLE_WUNLOCK(lle); #ifdef DIAGNOSTIC log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle); From owner-svn-src-head@FreeBSD.ORG Thu Aug 2 14:17:49 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A4BFD106566B; Thu, 2 Aug 2012 14:17:49 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by mx1.freebsd.org (Postfix) with ESMTP id 327F48FC08; Thu, 2 Aug 2012 14:17:48 +0000 (UTC) Received: from c122-106-171-246.carlnfd1.nsw.optusnet.com.au (c122-106-171-246.carlnfd1.nsw.optusnet.com.au [122.106.171.246]) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q72EHkvR008441 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 3 Aug 2012 00:17:47 +1000 Date: Fri, 3 Aug 2012 00:17:46 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: davidxu@freebsd.org In-Reply-To: <501A72AE.30309@gmail.com> Message-ID: <20120803001044.X2863@besplex.bde.org> References: <201207310548.q6V5mZHf091624@svn.freebsd.org> <50179581.9070805@gmail.com> <20120802051805.P3345@besplex.bde.org> <5019ED93.8060802@gmail.com> <20120802173441.X1291@besplex.bde.org> <501A72AE.30309@gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: src-committers@freebsd.org, Giovanni Trematerra , svn-src-all@freebsd.org, Konstantin Belousov , bde@freebsd.org, Bruce Evans , svn-src-head@freebsd.org Subject: Re: svn commit: r238936 - in head/sys: fs/fifofs kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Aug 2012 14:17:49 -0000 On Thu, 2 Aug 2012, David Xu wrote: > On 2012/8/2 16:12, Bruce Evans wrote: >> ... >> I made similar patches for sockets (to set POLLHUP on hangup (now in >> -current) and to not set POLLIN on hangup unless there is still data >> to be read). I started killing POLLINIGNEOF for sockets. -current >> added it for nameless pipes instead :-(. With the new fifo >> implementation, POLLINIGNEOF is even more of a mistake for sockets, >> but more needed for pipes since named pipes are fifos. >> ... > I think you can kill POLLINIGNEOF at all, I have grepped, and there is no > external user, > only pipe and socket code use it internally. The POLLINIGNEOF is confusing > because > it has same prefix with POLLIN, POLLOUT and other POLL flags. Did you grep all of google for it :-). All of ports should be enough. Uses of it in the kernel are certainly gone, but it was intentionally put in the user API to previde a workaround for the policy that was hard-coded in the kernel. The policy changed slightly, and you could set POLLINIGNEOF to either go back to the old policy or get the new policy for more cases. Hopefully this was never actually used except for testing and termporary workarounds. But it was expanded to work on nameless pipes as well as fifos and sockets. Bruce From owner-svn-src-head@FreeBSD.ORG Thu Aug 2 14:37:17 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B9DD106566B; Thu, 2 Aug 2012 14:37:17 +0000 (UTC) (envelope-from listlog2011@gmail.com) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 23FAF8FC0C; Thu, 2 Aug 2012 14:37:17 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q72Eb2QB063036; Thu, 2 Aug 2012 14:37:06 GMT (envelope-from listlog2011@gmail.com) Message-ID: <501A908B.9010001@gmail.com> Date: Thu, 02 Aug 2012 22:36:59 +0800 From: David Xu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Bruce Evans References: <201207310548.q6V5mZHf091624@svn.freebsd.org> <50179581.9070805@gmail.com> <20120802051805.P3345@besplex.bde.org> <5019ED93.8060802@gmail.com> <20120802173441.X1291@besplex.bde.org> <501A72AE.30309@gmail.com> <20120803001044.X2863@besplex.bde.org> In-Reply-To: <20120803001044.X2863@besplex.bde.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, Giovanni Trematerra , svn-src-all@freebsd.org, Konstantin Belousov , davidxu@freebsd.org, svn-src-head@freebsd.org, bde@freebsd.org Subject: Re: svn commit: r238936 - in head/sys: fs/fifofs kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: davidxu@freebsd.org List-Id: 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, 02 Aug 2012 14:37:17 -0000 On 2012/8/2 22:17, Bruce Evans wrote: > On Thu, 2 Aug 2012, David Xu wrote: > >> On 2012/8/2 16:12, Bruce Evans wrote: >>> ... >>> I made similar patches for sockets (to set POLLHUP on hangup (now in >>> -current) and to not set POLLIN on hangup unless there is still data >>> to be read). I started killing POLLINIGNEOF for sockets. -current >>> added it for nameless pipes instead :-(. With the new fifo >>> implementation, POLLINIGNEOF is even more of a mistake for sockets, >>> but more needed for pipes since named pipes are fifos. >>> ... >> I think you can kill POLLINIGNEOF at all, I have grepped, and there >> is no external user, >> only pipe and socket code use it internally. The POLLINIGNEOF is >> confusing because >> it has same prefix with POLLIN, POLLOUT and other POLL flags. > > Did you grep all of google for it :-). All of ports should be enough. > > Uses of it in the kernel are certainly gone, but it was intentionally > put in the user API to previde a workaround for the policy that was > hard-coded in the kernel. The policy changed slightly, and you could > set POLLINIGNEOF to either go back to the old policy or get the new > policy for more cases. Hopefully this was never actually used except > for testing and termporary workarounds. But it was expanded to work > on nameless pipes as well as fifos and sockets. > > Bruce > I don't know it is used by some ports. :-) Anyway, if people don't agree my patches, it is not a problem to me, because I always can apply them locally, though named pipe may be less useful from offical release. Thanks, From owner-svn-src-head@FreeBSD.ORG Thu Aug 2 15:05:35 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2639F106570A; Thu, 2 Aug 2012 15:05:35 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EBCDA8FC08; Thu, 2 Aug 2012 15:05:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q72F5YOH093932; Thu, 2 Aug 2012 15:05:34 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q72F5Y8j093930; Thu, 2 Aug 2012 15:05:34 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201208021505.q72F5Y8j093930@svn.freebsd.org> From: Jaakko Heinonen Date: Thu, 2 Aug 2012 15:05:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238991 - head/sys/dev/md X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Aug 2012 15:05:35 -0000 Author: jh Date: Thu Aug 2 15:05:34 2012 New Revision: 238991 URL: http://svn.freebsd.org/changeset/base/238991 Log: Disallow sectorsize larger than MAXPHYS and mediasize smaller than sectorsize. PR: 169947 Submitted by: Filip Palian (original version) Reviewed by: kib Modified: head/sys/dev/md/md.c Modified: head/sys/dev/md/md.c ============================================================================== --- head/sys/dev/md/md.c Thu Aug 2 13:57:49 2012 (r238990) +++ head/sys/dev/md/md.c Thu Aug 2 15:05:34 2012 (r238991) @@ -1090,7 +1090,7 @@ mdresize(struct md_s *sc, struct md_ioct case MD_VNODE: break; case MD_SWAP: - if (mdio->md_mediasize == 0 || + if (mdio->md_mediasize <= 0 || (mdio->md_mediasize % PAGE_SIZE) != 0) return (EDOM); oldpages = OFF_TO_IDX(round_page(sc->mediasize)); @@ -1148,7 +1148,7 @@ mdcreate_swap(struct md_s *sc, struct md * Range check. Disallow negative sizes or any size less then the * size of a page. Then round to a page. */ - if (sc->mediasize == 0 || (sc->mediasize % PAGE_SIZE) != 0) + if (sc->mediasize <= 0 || (sc->mediasize % PAGE_SIZE) != 0) return (EDOM); /* @@ -1189,6 +1189,7 @@ xmdctlioctl(struct cdev *dev, u_long cmd struct md_ioctl *mdio; struct md_s *sc; int error, i; + unsigned sectsize; if (md_debug) printf("mdctlioctl(%s %lx %p %x %p)\n", @@ -1217,6 +1218,12 @@ xmdctlioctl(struct cdev *dev, u_long cmd default: return (EINVAL); } + if (mdio->md_sectorsize == 0) + sectsize = DEV_BSIZE; + else + sectsize = mdio->md_sectorsize; + if (sectsize > MAXPHYS || mdio->md_mediasize < sectsize) + return (EINVAL); if (mdio->md_options & MD_AUTOUNIT) sc = mdnew(-1, &error, mdio->md_type); else { @@ -1229,10 +1236,7 @@ xmdctlioctl(struct cdev *dev, u_long cmd if (mdio->md_options & MD_AUTOUNIT) mdio->md_unit = sc->unit; sc->mediasize = mdio->md_mediasize; - if (mdio->md_sectorsize == 0) - sc->sectorsize = DEV_BSIZE; - else - sc->sectorsize = mdio->md_sectorsize; + sc->sectorsize = sectsize; error = EDOOFUS; switch (sc->type) { case MD_MALLOC: @@ -1282,6 +1286,8 @@ xmdctlioctl(struct cdev *dev, u_long cmd sc = mdfind(mdio->md_unit); if (sc == NULL) return (ENOENT); + if (mdio->md_mediasize < sc->sectorsize) + return (EINVAL); if (mdio->md_mediasize < sc->mediasize && !(sc->flags & MD_FORCE) && !(mdio->md_options & MD_FORCE)) From owner-svn-src-head@FreeBSD.ORG Thu Aug 2 16:40:14 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 80C421065677; Thu, 2 Aug 2012 16:40:14 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe03.c2i.net [212.247.154.66]) by mx1.freebsd.org (Postfix) with ESMTP id 5C2C08FC20; Thu, 2 Aug 2012 16:40:13 +0000 (UTC) X-T2-Spam-Status: No, hits=-0.2 required=5.0 tests=ALL_TRUSTED, BAYES_50 Received: from [176.74.212.201] (account mc467741@c2i.net HELO laptop015.hselasky.homeunix.org) by mailfe03.swip.net (CommuniGate Pro SMTP 5.4.4) with ESMTPA id 136929389; Thu, 02 Aug 2012 18:40:06 +0200 From: Hans Petter Selasky To: Gleb Smirnoff Date: Thu, 2 Aug 2012 18:40:29 +0200 User-Agent: KMail/1.13.7 (FreeBSD/9.0-STABLE; KDE/4.7.4; amd64; ; ) References: <201208021357.q72DvoFJ088426@svn.freebsd.org> In-Reply-To: <201208021357.q72DvoFJ088426@svn.freebsd.org> X-Face: 'mmZ:T{)),Oru^0c+/}w'`gU1$ubmG?lp!=R4Wy\ELYo2)@'UZ24N@ =?iso-8859-1?q?d2+AyewRX=7DmAm=3BYp=0A=09=7CU=5B?=@, _z/([?1bCfM{_"B<.J>mICJCHAzzGHI{y7{%JVz%R~yJHIji`y> =?iso-8859-1?q?Y=7Dk1C4TfysrsUI=0A=09-=25GU9V5=5DiUZF=26nRn9mJ=27=3F=26?=>O MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <201208021840.29684.hselasky@c2i.net> Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r238990 - in head/sys: net netinet netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Aug 2012 16:40:14 -0000 On Thursday 02 August 2012 15:57:50 Gleb Smirnoff wrote: > + IF_AFDATA_WLOCK_ASSERT(lle->lle_tbl->llt_ifp); I'm seeing a compile error that IF_AFDATA_WLOCK_ASSERT() is not defined ... --HPS From owner-svn-src-head@FreeBSD.ORG Thu Aug 2 16:46:47 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 720811065670; Thu, 2 Aug 2012 16:46:47 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (bird.sbone.de [46.4.1.90]) by mx1.freebsd.org (Postfix) with ESMTP id 1F8D78FC12; Thu, 2 Aug 2012 16:46:46 +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 8658C25D3A0F; Thu, 2 Aug 2012 16:46:45 +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 9C6E5BE85C2; Thu, 2 Aug 2012 16:46:44 +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 OiVW4l8svB1C; Thu, 2 Aug 2012 16:46:43 +0000 (UTC) Received: from nv.sbone.de (nv.sbone.de [IPv6:fde9:577b:c1a9:31::2013:138]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 22D62BE85B2; Thu, 2 Aug 2012 16:46:43 +0000 (UTC) Date: Thu, 2 Aug 2012 16:46:42 +0000 (UTC) From: "Bjoern A. Zeeb" To: Gleb Smirnoff In-Reply-To: <201208021357.q72DvoFJ088426@svn.freebsd.org> Message-ID: References: <201208021357.q72DvoFJ088426@svn.freebsd.org> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r238990 - in head/sys: net netinet netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Aug 2012 16:46:47 -0000 On Thu, 2 Aug 2012, Gleb Smirnoff wrote: > Author: glebius > Date: Thu Aug 2 13:57:49 2012 > New Revision: 238990 > URL: http://svn.freebsd.org/changeset/base/238990 > > Log: > Fix races between in_lltable_prefix_free(), lla_lookup(), > llentry_free() and arptimer(): > > o Use callout_init_rw() for lle timeout, this allows us safely > disestablish them. > - This allows us to simplify the arptimer() and make it > race safe. > o Consistently use ifp->if_afdata_lock to lock access to > linked lists in the lle hashes. > o Introduce new lle flag LLE_LINKED, which marks an entry that > is attached to the hash. > - Use LLE_LINKED to avoid double unlinking via consequent > calls to llentry_free(). > - Mark lle with LLE_DELETED via |= operation istead of =, > so that other flags won't be lost. > o Make LLE_ADDREF(), LLE_REMREF() and LLE_FREE_LOCKED() more > consistent and provide more informative KASSERTs. > > The patch is a collaborative work of all submitters and myself. Quoting from 2 year old memory you just introduced a possible deadlock on tbale (or with that networkstack) teardown adding the extra af_data write locking to the table walk. -- Bjoern A. Zeeb You have to have visions! Stop bit received. Insert coin for new address family. From owner-svn-src-head@FreeBSD.ORG Thu Aug 2 16:51:18 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8A8311065677 for ; Thu, 2 Aug 2012 16:51:18 +0000 (UTC) (envelope-from andrey@zonov.org) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id 010CD8FC26 for ; Thu, 2 Aug 2012 16:51:17 +0000 (UTC) Received: by lbbgm13 with SMTP id gm13so970202lbb.13 for ; Thu, 02 Aug 2012 09:51:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=7h+42Y6ossdVabt/v7QDju0L/B3Hzz899XeLymO2FrM=; b=VnSfqrnZYdKnUBisa408vHVHdOM7b/bBvRhOnL/Fjp3UVQB3JAFrTw1y6pHJC/GY0p iCw0XIU4xcmx8auk/ImQoyuV+pkV0z+rgAZMATVo78BMqeE71VTiY0kdMVio6HpF+PU7 6WHArXvcbBrQgy7ooT043jniqPq8kK0AlBZ0xVWgFl/+tJBDUqRzYRNdOuAxPkF/qR/l M0dlgATcEl/bcs4dmV8tmZSv7FOqBP+tRSL+TI2HP7aPMbqht+rklgfcKBWuO3DzBVmu E49vCnMVm/I66x/u8kodysx4prBdPFATtWUO/WfvmfbnJTDqX+5LpIUmvcCiiL/+4Tf0 JVTQ== Received: by 10.152.124.180 with SMTP id mj20mr22180434lab.43.1343926276502; Thu, 02 Aug 2012 09:51:16 -0700 (PDT) Received: from zont-osx.local (ppp95-165-150-148.pppoe.spdop.ru. [95.165.150.148]) by mx.google.com with ESMTPS id pi16sm6290836lab.7.2012.08.02.09.51.15 (version=SSLv3 cipher=OTHER); Thu, 02 Aug 2012 09:51:16 -0700 (PDT) Message-ID: <501AB001.5070103@zonov.org> Date: Thu, 02 Aug 2012 20:51:13 +0400 From: Andrey Zonov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Hans Petter Selasky References: <201208021357.q72DvoFJ088426@svn.freebsd.org> <201208021840.29684.hselasky@c2i.net> In-Reply-To: <201208021840.29684.hselasky@c2i.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQmtcjwQJspRp283F7KXM9sagyqazcnJItmlWU52mQpoepZgn6vE9vEgI4fF1PVCVj5and/s Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , Gleb Smirnoff , "src-committers@freebsd.org" Subject: Re: svn commit: r238990 - in head/sys: net netinet netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Aug 2012 16:51:18 -0000 On 8/2/12 8:40 PM, Hans Petter Selasky wrote: > On Thursday 02 August 2012 15:57:50 Gleb Smirnoff wrote: >> + IF_AFDATA_WLOCK_ASSERT(lle->lle_tbl->llt_ifp); > > I'm seeing a compile error that IF_AFDATA_WLOCK_ASSERT() is not defined ... > It's in sys/net/if_var.h. [zont@vm020 /usr/src]$ grep IF_AFDATA_WLOCK_ASSERT sys/net/if_var.h #define IF_AFDATA_WLOCK_ASSERT(ifp) rw_assert(&(ifp)->if_afdata_lock, RA_WLOCKED) Please check your environment. (or maybe clean /usr/obj?) -- Andrey Zonov From owner-svn-src-head@FreeBSD.ORG Thu Aug 2 17:41:09 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B5DA51065870; Thu, 2 Aug 2012 17:41:09 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe01.c2i.net [212.247.154.2]) by mx1.freebsd.org (Postfix) with ESMTP id 903E38FC08; Thu, 2 Aug 2012 17:41:08 +0000 (UTC) X-T2-Spam-Status: No, hits=-1.0 required=5.0 tests=ALL_TRUSTED Received: from [176.74.212.201] (account mc467741@c2i.net HELO laptop015.hselasky.homeunix.org) by mailfe01.swip.net (CommuniGate Pro SMTP 5.4.4) with ESMTPA id 306439367; Thu, 02 Aug 2012 19:41:06 +0200 From: Hans Petter Selasky To: Andrey Zonov Date: Thu, 2 Aug 2012 19:41:30 +0200 User-Agent: KMail/1.13.7 (FreeBSD/9.0-STABLE; KDE/4.7.4; amd64; ; ) References: <201208021840.29684.hselasky@c2i.net> <501AB001.5070103@zonov.org> In-Reply-To: <501AB001.5070103@zonov.org> X-Face: 'mmZ:T{)),Oru^0c+/}w'`gU1$ubmG?lp!=R4Wy\ELYo2)@'UZ24N@d2+AyewRX}mAm; Yp |U[@, _z/([?1bCfM{_"B<.J>mICJCHAzzGHI{y7{%JVz%R~yJHIji`y>Y}k1C4TfysrsUI -%GU9V5]iUZF&nRn9mJ'?&>O MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <201208021941.30436.hselasky@c2i.net> Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , Gleb Smirnoff , "src-committers@freebsd.org" Subject: Re: svn commit: r238990 - in head/sys: net netinet netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Aug 2012 17:41:09 -0000 On Thursday 02 August 2012 18:51:13 Andrey Zonov wrote: > On 8/2/12 8:40 PM, Hans Petter Selasky wrote: > > On Thursday 02 August 2012 15:57:50 Gleb Smirnoff wrote: > >> + IF_AFDATA_WLOCK_ASSERT(lle->lle_tbl->llt_ifp); > > > > I'm seeing a compile error that IF_AFDATA_WLOCK_ASSERT() is not defined > > ... > > It's in sys/net/if_var.h. > > [zont@vm020 /usr/src]$ grep IF_AFDATA_WLOCK_ASSERT sys/net/if_var.h > #define IF_AFDATA_WLOCK_ASSERT(ifp) rw_assert(&(ifp)->if_afdata_lock, > RA_WLOCKED) > > Please check your environment. (or maybe clean /usr/obj?) Looks like a non-clean csup checkout. Ran it again, and now it works :-) --HPS From owner-svn-src-head@FreeBSD.ORG Thu Aug 2 19:49:11 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0B8B2106566B; Thu, 2 Aug 2012 19:49:11 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 985BC8FC0C; Thu, 2 Aug 2012 19:49:10 +0000 (UTC) Received: by obbun3 with SMTP id un3so18370693obb.13 for ; Thu, 02 Aug 2012 12:49:09 -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 :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=IAcLsT1o6Obbop5IichYZN6S0LZazPgXFA4eqRwFlKE=; b=Fpanne4EHWDOtGyMs5urZQ8cSHH3vJwSnzMLYgQSSlr64SuDP4gkOcfMp4yXQb6ynb pj7pQNlG/hkB4dCPXEVnIn5X7Xt+uR+VxFA5g/Uo2ie9X7l2cd4a7mvN50xj1DWLmLAO vTr1PJNcv2tpm2jFIlS9VgYyWCfuMX1sa7t+gUuiSSV6JGC9fyHT8VbD7PEZMknjxgsX O8eprii1z5r1llsZKr8ZoptTcUvL316phVG84ILKazQaugBBlxd0mVxfj5WOvqZKHBO8 JnqVkG1B24bpwc9zkVytKnuqNgCxpA1TBmpkK+OaINdjMyLdylyfq2vZKJnSxqzSLYM2 L3LA== MIME-Version: 1.0 Received: by 10.182.207.6 with SMTP id ls6mr39462872obc.36.1343936949835; Thu, 02 Aug 2012 12:49:09 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.76.151.3 with HTTP; Thu, 2 Aug 2012 12:49:09 -0700 (PDT) In-Reply-To: <5018F7DE.30200@FreeBSD.org> References: <201208010018.q710I2Uh088989@svn.freebsd.org> <5018F7DE.30200@FreeBSD.org> Date: Thu, 2 Aug 2012 12:49:09 -0700 X-Google-Sender-Auth: LpXwwk9S8Qvrj_NcjBtAR0v5gvw Message-ID: From: Adrian Chadd To: Andriy Gapon Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Ben Kaduk Subject: Re: svn commit: r238962 - head/sys/dev/ath/ath_rate/sample X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Aug 2012 19:49:11 -0000 I do plan on ripping all of this out and making it cleaner. But thanks for this review. :) Adrian From owner-svn-src-head@FreeBSD.ORG Thu Aug 2 20:14:46 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 371A1106564A; Thu, 2 Aug 2012 20:14:46 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 226DE8FC16; Thu, 2 Aug 2012 20:14:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q72KEjA5021017; Thu, 2 Aug 2012 20:14:45 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q72KEjvA021015; Thu, 2 Aug 2012 20:14:45 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201208022014.q72KEjvA021015@svn.freebsd.org> From: Adrian Chadd Date: Thu, 2 Aug 2012 20:14:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238993 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Aug 2012 20:14:46 -0000 Author: adrian Date: Thu Aug 2 20:14:45 2012 New Revision: 238993 URL: http://svn.freebsd.org/changeset/base/238993 Log: Fix an issue that crept in with the previous descriptor tidyup. When forming aggregates, the last descriptor was now not being correctly setup - instead, the "setuplasttxdesc" call was being handed the first descriptor in the last subframe, rather than the last descriptor in the last subframe. This showed up as "bad series0 hwrate" messages, as the final descriptor just didn't have any of the rate control information squirreled away. Tested: * AR9280 STA -> 11n AP, iperf TCP Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Thu Aug 2 15:13:12 2012 (r238992) +++ head/sys/dev/ath/if_ath_tx.c Thu Aug 2 20:14:45 2012 (r238993) @@ -515,9 +515,12 @@ ath_tx_setds_11n(struct ath_softc *sc, s /* * Setup the last descriptor in the list. - * bf_prev points to the last; bf is NULL here. + * + * bf_first->bf_lastds already points to it; the rate + * control information needs to be squirreled away here + * as well ans clearing the moreaggr/paddelim fields. */ - ath_hal_setuplasttxdesc(sc->sc_ah, bf_prev->bf_desc, + ath_hal_setuplasttxdesc(sc->sc_ah, bf_first->bf_lastds, bf_first->bf_desc); DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, "%s: end\n", __func__); From owner-svn-src-head@FreeBSD.ORG Thu Aug 2 20:56:30 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F1421106564A; Thu, 2 Aug 2012 20:56:29 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.allbsd.org (gatekeeper.allbsd.org [IPv6:2001:2f0:104:e001::32]) by mx1.freebsd.org (Postfix) with ESMTP id CDE598FC18; Thu, 2 Aug 2012 20:56:28 +0000 (UTC) Received: from alph.allbsd.org (p2214-ipbf2707funabasi.chiba.ocn.ne.jp [123.225.119.214]) (authenticated bits=128) by mail.allbsd.org (8.14.5/8.14.5) with ESMTP id q72KuBnB094808 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 3 Aug 2012 05:56:21 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) (authenticated bits=0) by alph.allbsd.org (8.14.5/8.14.5) with ESMTP id q72Ku9uu043447; Fri, 3 Aug 2012 05:56:10 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Fri, 03 Aug 2012 05:55:54 +0900 (JST) Message-Id: <20120803.055554.1380323232583218022.hrs@allbsd.org> To: emax@FreeBSD.org From: Hiroki Sato In-Reply-To: <201207191536.q6JFabOR094467@svn.freebsd.org> References: <201207191536.q6JFabOR094467@svn.freebsd.org> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.5 on Emacs 23.4 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart(Fri_Aug__3_05_55_54_2012_218)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97.4 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (mail.allbsd.org [133.31.130.32]); Fri, 03 Aug 2012 05:56:21 +0900 (JST) X-Spam-Status: No, score=-96.8 required=13.0 tests=CONTENT_TYPE_PRESENT, ONLY1HOPDIRECT, RCVD_IN_RP_RNBL, SAMEHELOBY2HOP, USER_IN_WHITELIST autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on gatekeeper.allbsd.org Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r238622 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Aug 2012 20:56:30 -0000 ----Security_Multipart(Fri_Aug__3_05_55_54_2012_218)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Maksim Yevmenkin wrote in <201207191536.q6JFabOR094467@svn.freebsd.org>: em> Author: emax em> Date: Thu Jul 19 15:36:36 2012 em> New Revision: 238622 em> URL: http://svn.freebsd.org/changeset/base/238622 em> em> Log: em> Allow to specify no source-address-selection policy em> em> MFC after: 1 week em> em> Modified: em> head/etc/rc.d/ip6addrctl em> em> Modified: head/etc/rc.d/ip6addrctl em> ============================================================================== em> --- head/etc/rc.d/ip6addrctl Thu Jul 19 14:43:46 2012 (r238621) em> +++ head/etc/rc.d/ip6addrctl Thu Jul 19 15:36:36 2012 (r238622) em> @@ -83,6 +83,9 @@ ip6addrctl_start() em> # Backward compatibility when ipv6_prefer=NO em> ip6addrctl_prefer_ipv4 em> ;; em> + [Nn][Oo][Nn][Ee]) em> + ip6addrctl flush >/dev/null 2>&1 em> + ;; em> *) em> warn "\$ip6addrctl_policy is invalid: ${ip6addrctl_policy}. " \ em> " \"ipv4_prefer\" is used instead." Just curious, why ip6addrctl_enable=NO is not enough here? I would like to eliminate yes/no/none keywords in $ip6addrctl_policy because such keywords are vague. If we need the empty rule for some reason, "empty" would be a better name for the policy, I think. -- Hiroki ----Security_Multipart(Fri_Aug__3_05_55_54_2012_218)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEABECAAYFAlAa6VoACgkQTyzT2CeTzy1OxACfT/cOvL4UO0kF6HjMM86M593s n5sAnjKBhbaaM1Ojdy3ldOBdsRkFx+QO =/JGV -----END PGP SIGNATURE----- ----Security_Multipart(Fri_Aug__3_05_55_54_2012_218)---- From owner-svn-src-head@FreeBSD.ORG Thu Aug 2 21:25:41 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EB63A1065673; Thu, 2 Aug 2012 21:25:41 +0000 (UTC) (envelope-from maksim.yevmenkin@gmail.com) Received: from mail-qa0-f54.google.com (mail-qa0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 2BA7E8FC1E; Thu, 2 Aug 2012 21:25:40 +0000 (UTC) Received: by qaat11 with SMTP id t11so1903445qaa.13 for ; Thu, 02 Aug 2012 14:25:40 -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 :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=1b/HY9mjcpHHMvTV72x2fWHskTI+0Y9LCxBi8iVc3QE=; b=aBlJP+KyCJI6PyCtYOKUn0rq1kaSgx7pTIqzcDvpfhKJ8YNbWL3iPc84VbT1QmrUE/ 0xLH92Du8Oul/nCpniuXxg0o8pOBmRJ5TMghAD7CVnHf+erOxvvy0aCuR9t/1mae7MTf TWSWuiwNYzA4QiVxLHPA/MA78t8VoArhBg0QomQsqKe9UGFeQLWedLk2CgiOoJ8O+E5x tQUtkim5bQt0FLEdEYvxA+OPg3/36T5sXUzu+hljJsDm0b4w6vqo1AfjoQGhTniAzgpg WW6vy4dOnTVF2RHeilR0rSDUohkt1/suncfLcYQPgHDoxJO625B+66tyeelR7xYADN2Z nBHA== MIME-Version: 1.0 Received: by 10.224.1.130 with SMTP id 2mr43996191qaf.61.1343942740072; Thu, 02 Aug 2012 14:25:40 -0700 (PDT) Sender: maksim.yevmenkin@gmail.com Received: by 10.224.216.72 with HTTP; Thu, 2 Aug 2012 14:25:40 -0700 (PDT) In-Reply-To: <20120803.055554.1380323232583218022.hrs@allbsd.org> References: <201207191536.q6JFabOR094467@svn.freebsd.org> <20120803.055554.1380323232583218022.hrs@allbsd.org> Date: Thu, 2 Aug 2012 14:25:40 -0700 X-Google-Sender-Auth: TJkYq6Yc9g9yBDXSeCfIu-rYCh0 Message-ID: From: Maksim Yevmenkin To: Hiroki Sato Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r238622 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Aug 2012 21:25:42 -0000 On Thu, Aug 2, 2012 at 1:55 PM, Hiroki Sato wrote: > Maksim Yevmenkin wrote > in <201207191536.q6JFabOR094467@svn.freebsd.org>: > > em> Author: emax > em> Date: Thu Jul 19 15:36:36 2012 > em> New Revision: 238622 > em> URL: http://svn.freebsd.org/changeset/base/238622 > em> > em> Log: > em> Allow to specify no source-address-selection policy > em> > em> MFC after: 1 week > em> > em> Modified: > em> head/etc/rc.d/ip6addrctl > em> > em> Modified: head/etc/rc.d/ip6addrctl > em> ============================================================================== > em> --- head/etc/rc.d/ip6addrctl Thu Jul 19 14:43:46 2012 (r238621) > em> +++ head/etc/rc.d/ip6addrctl Thu Jul 19 15:36:36 2012 (r238622) > em> @@ -83,6 +83,9 @@ ip6addrctl_start() > em> # Backward compatibility when ipv6_prefer=NO > em> ip6addrctl_prefer_ipv4 > em> ;; > em> + [Nn][Oo][Nn][Ee]) > em> + ip6addrctl flush >/dev/null 2>&1 > em> + ;; > em> *) > em> warn "\$ip6addrctl_policy is invalid: ${ip6addrctl_policy}. " \ > em> " \"ipv4_prefer\" is used instead." > > Just curious, why ip6addrctl_enable=NO is not enough here? I would > like to eliminate yes/no/none keywords in $ip6addrctl_policy because > such keywords are vague. If we need the empty rule for some reason, > "empty" would be a better name for the policy, I think. i just wanted to make sure that there is a way to absolutely make sure that there is no default address selection policy installed. the wide know rule 9 of rfc 3484 is really messing things up for dns-style load balancing. even when ipv6 is not used. personally, i don't think that "none" is unreasonable word for "ip6addrctl_policy", but i don't feel particularly strongly about it. any name will do as long as original functionality is preserved. thanks, max From owner-svn-src-head@FreeBSD.ORG Thu Aug 2 21:33:47 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C545106564A; Thu, 2 Aug 2012 21:33:47 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117]) by mx1.freebsd.org (Postfix) with ESMTP id 7D7E08FC14; Thu, 2 Aug 2012 21:33:46 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id q72LXiek081440; Fri, 3 Aug 2012 01:33:44 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q72LXiSg081439; Fri, 3 Aug 2012 01:33:44 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Fri, 3 Aug 2012 01:33:44 +0400 From: Gleb Smirnoff To: "Bjoern A. Zeeb" Message-ID: <20120802213344.GF70185@FreeBSD.org> References: <201208021357.q72DvoFJ088426@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r238990 - in head/sys: net netinet netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Aug 2012 21:33:47 -0000 On Thu, Aug 02, 2012 at 04:46:42PM +0000, Bjoern A. Zeeb wrote: B> On Thu, 2 Aug 2012, Gleb Smirnoff wrote: B> B> > Author: glebius B> > Date: Thu Aug 2 13:57:49 2012 B> > New Revision: 238990 B> > URL: http://svn.freebsd.org/changeset/base/238990 B> > B> > Log: B> > Fix races between in_lltable_prefix_free(), lla_lookup(), B> > llentry_free() and arptimer(): B> > B> > o Use callout_init_rw() for lle timeout, this allows us safely B> > disestablish them. B> > - This allows us to simplify the arptimer() and make it B> > race safe. B> > o Consistently use ifp->if_afdata_lock to lock access to B> > linked lists in the lle hashes. B> > o Introduce new lle flag LLE_LINKED, which marks an entry that B> > is attached to the hash. B> > - Use LLE_LINKED to avoid double unlinking via consequent B> > calls to llentry_free(). B> > - Mark lle with LLE_DELETED via |= operation istead of =, B> > so that other flags won't be lost. B> > o Make LLE_ADDREF(), LLE_REMREF() and LLE_FREE_LOCKED() more B> > consistent and provide more informative KASSERTs. B> > B> > The patch is a collaborative work of all submitters and myself. B> B> Quoting from 2 year old memory you just introduced a possible deadlock B> on tbale (or with that networkstack) teardown adding the extra af_data B> write locking to the table walk. Can you please give more details? I didn't get it. What else needs afdata lock and what does it hold which is held by table walk. -- Totus tuus, Glebius. From owner-svn-src-head@FreeBSD.ORG Thu Aug 2 21:51:45 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [69.147.83.53]) by hub.freebsd.org (Postfix) with ESMTP id 7C1BA1065676; Thu, 2 Aug 2012 21:51:45 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from [127.0.0.1] (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 4B3B1152F9E; Thu, 2 Aug 2012 21:51:37 +0000 (UTC) Message-ID: <501AF66A.8020804@FreeBSD.org> Date: Thu, 02 Aug 2012 14:51:38 -0700 From: Doug Barton Organization: http://www.FreeBSD.org/ User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Maksim Yevmenkin References: <201207191536.q6JFabOR094467@svn.freebsd.org> <20120803.055554.1380323232583218022.hrs@allbsd.org> In-Reply-To: X-Enigmail-Version: 1.4.3 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Hiroki Sato , src-committers@freebsd.org Subject: Re: svn commit: r238622 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Aug 2012 21:51:45 -0000 On 8/2/2012 2:25 PM, Maksim Yevmenkin wrote: > On Thu, Aug 2, 2012 at 1:55 PM, Hiroki Sato wrote: > >> Just curious, why ip6addrctl_enable=NO is not enough here? Because the behavior of the script for =NO is to prefer v4. >> I would >> like to eliminate yes/no/none keywords in $ip6addrctl_policy because >> such keywords are vague. If we need the empty rule for some reason, >> "empty" would be a better name for the policy, I think. Personally I think that the established meanings of "yes" and "no" are well understood, but I wouldn't object to emitting a warning for them to help the user make a more explicit selection. While we're at it, the way that the current script replicates the test for checkyesno in case is bogus, and should be changed. I had fixed this in the change set that you(hrs) backed out. To stick with the structure of the current script, something like this would work: http://people.freebsd.org/~dougb/ip6addrctl.diff That also brings in the warning described above. > i just wanted to make sure that there is a way to absolutely make sure > that there is no default address selection policy installed. the wide > know rule 9 of rfc 3484 is really messing things up for dns-style load > balancing. even when ipv6 is not used. Maksim, can you say more about this? Or point me to a reference that has the discussion? > personally, i don't think that > "none" is unreasonable word for "ip6addrctl_policy", but i don't feel > particularly strongly about it. any name will do as long as original > functionality is preserved. I agree that "none" is reasonable, and is in line with other rc.d knobs. I would not object to "empty" being added as a synonym though. One request however, is this new knob documented in rc.conf.5? If not, can you do that please? :) Doug -- I am only one, but I am one. I cannot do everything, but I can do something. And I will not let what I cannot do interfere with what I can do. -- Edward Everett Hale, (1822 - 1909) From owner-svn-src-head@FreeBSD.ORG Thu Aug 2 22:22:36 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7FC7F1065670; Thu, 2 Aug 2012 22:22:36 +0000 (UTC) (envelope-from maksim.yevmenkin@gmail.com) Received: from mail-qc0-f182.google.com (mail-qc0-f182.google.com [209.85.216.182]) by mx1.freebsd.org (Postfix) with ESMTP id D289E8FC0A; Thu, 2 Aug 2012 22:22:35 +0000 (UTC) Received: by qcsg15 with SMTP id g15so28816qcs.13 for ; Thu, 02 Aug 2012 15:22:35 -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 :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=UyTPVOGV9UoS9BfsRteKmNfukSJqUGxHGVXIPwT7kcY=; b=aemCLGfFPaXWw1qzQuypELqZVSN5yPoaVcIGlbFmSOVo7QIyGvZjQiy4mbfYwG+TtY Sjqg/yJzNmRAgFp/cphmu+GpmLcqUm1A1clemx+mUfj4aMAsVy4zSApw34wjrWi5tPSS iQCGWlQrxojNz/Xm/rr9uMmuTs2CFmCqzstFDvBQ8nBmd2FCnqxGSKWcpbUdgm4mDUjS 4eMwenDpu7YMBmVhvorhuWoRbVdRuaxcRPRnxLCQlX7xbTAmIT0BWkom6+d24037EeHi ah+WOv/4X2ZP3/I0bsNayUbA6vm2dhSsbgEOMOzgkr8l5VDe3eejxfNTE0U19WBDSvZZ 18mA== MIME-Version: 1.0 Received: by 10.224.194.1 with SMTP id dw1mr44951960qab.27.1343946155029; Thu, 02 Aug 2012 15:22:35 -0700 (PDT) Sender: maksim.yevmenkin@gmail.com Received: by 10.224.216.72 with HTTP; Thu, 2 Aug 2012 15:22:34 -0700 (PDT) In-Reply-To: <501AF66A.8020804@FreeBSD.org> References: <201207191536.q6JFabOR094467@svn.freebsd.org> <20120803.055554.1380323232583218022.hrs@allbsd.org> <501AF66A.8020804@FreeBSD.org> Date: Thu, 2 Aug 2012 15:22:34 -0700 X-Google-Sender-Auth: kXX_qhn8HdTAdMruGmAtSRG2Cg8 Message-ID: From: Maksim Yevmenkin To: Doug Barton Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Hiroki Sato , src-committers@freebsd.org Subject: Re: svn commit: r238622 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 02 Aug 2012 22:22:36 -0000 On Thu, Aug 2, 2012 at 2:51 PM, Doug Barton wrote: > On 8/2/2012 2:25 PM, Maksim Yevmenkin wrote: >> On Thu, Aug 2, 2012 at 1:55 PM, Hiroki Sato wrote: >> >>> Just curious, why ip6addrctl_enable=NO is not enough here? > > Because the behavior of the script for =NO is to prefer v4. > >>> I would >>> like to eliminate yes/no/none keywords in $ip6addrctl_policy because >>> such keywords are vague. If we need the empty rule for some reason, >>> "empty" would be a better name for the policy, I think. > > Personally I think that the established meanings of "yes" and "no" are > well understood, but I wouldn't object to emitting a warning for them to > help the user make a more explicit selection. > > While we're at it, the way that the current script replicates the test > for checkyesno in case is bogus, and should be changed. I had fixed this > in the change set that you(hrs) backed out. To stick with the structure > of the current script, something like this would work: > > http://people.freebsd.org/~dougb/ip6addrctl.diff > > That also brings in the warning described above. > >> i just wanted to make sure that there is a way to absolutely make sure >> that there is no default address selection policy installed. the wide >> know rule 9 of rfc 3484 is really messing things up for dns-style load >> balancing. even when ipv6 is not used. > > Maksim, can you say more about this? Or point me to a reference that has > the discussion? of course :) we have ipv4 systems in production that make use of getaddrinfo(3) api. when a particular dns name is resolved, and, multiple A records are returned, the results get sorted according to the "default" address selection policy. rfc3484 has a set of rules according to which results should be sorted. all of the rules do not apply in our case, except one - the rule #9. the idea is that ipv4 addresses are "converted" to ipv6 addresses and then longest prefix match sorting is applied. in other words, if your system ip address happens to share high bits with the ip address from the A record, the IP address from the A record will always be preferred. of course, longest prefix match is performed without any extra information such as netmask and/or cidr. it really is just matching high bits of the address. so, what we found out, is that some systems tend to favor a particular ip address (from a bunch of ip addresses returned by name resolution) because 4 high bits were the same. basically, round-robin dns was completely shot. >> personally, i don't think that >> "none" is unreasonable word for "ip6addrctl_policy", but i don't feel >> particularly strongly about it. any name will do as long as original >> functionality is preserved. > > I agree that "none" is reasonable, and is in line with other rc.d knobs. > I would not object to "empty" being added as a synonym though. > > One request however, is this new knob documented in rc.conf.5? If not, > can you do that please? :) sure. i will try to do it later this week or early next week. thank you for pointing it out. thanks, max From owner-svn-src-head@FreeBSD.ORG Fri Aug 3 00:11:14 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 69ACA106566B; Fri, 3 Aug 2012 00:11:14 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 54EC48FC0C; Fri, 3 Aug 2012 00:11:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q730BECk041136; Fri, 3 Aug 2012 00:11:14 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q730BEKb041134; Fri, 3 Aug 2012 00:11:14 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201208030011.q730BEKb041134@svn.freebsd.org> From: Xin LI Date: Fri, 3 Aug 2012 00:11:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238997 - head/sys/dev/mlx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Aug 2012 00:11:14 -0000 Author: delphij Date: Fri Aug 3 00:11:13 2012 New Revision: 238997 URL: http://svn.freebsd.org/changeset/base/238997 Log: Correct a typo. Reported by: Sascha Wildner Reviewed by: scottl MFC after: 3 days Modified: head/sys/dev/mlx/mlxvar.h Modified: head/sys/dev/mlx/mlxvar.h ============================================================================== --- head/sys/dev/mlx/mlxvar.h Thu Aug 2 20:54:59 2012 (r238996) +++ head/sys/dev/mlx/mlxvar.h Fri Aug 3 00:11:13 2012 (r238997) @@ -47,7 +47,7 @@ * making that fit cleanly without crossing page boundaries requires rounding up * to the next power of two. */ -#define MLX_MAXPHYS (128 * 124) +#define MLX_MAXPHYS (128 * 1024) #define MLX_NSEG 64 #define MLX_NSLOTS 256 /* max number of command slots */ From owner-svn-src-head@FreeBSD.ORG Fri Aug 3 01:48:16 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76F63106566B; Fri, 3 Aug 2012 01:48:16 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6220A8FC15; Fri, 3 Aug 2012 01:48:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q731mGqV050432; Fri, 3 Aug 2012 01:48:16 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q731mGcZ050429; Fri, 3 Aug 2012 01:48:16 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201208030148.q731mGcZ050429@svn.freebsd.org> From: Alan Cox Date: Fri, 3 Aug 2012 01:48:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238998 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Aug 2012 01:48:16 -0000 Author: alc Date: Fri Aug 3 01:48:15 2012 New Revision: 238998 URL: http://svn.freebsd.org/changeset/base/238998 Log: Inline vm_page_aflags_clear() and vm_page_aflags_set(). Add comments stating that neither these functions nor the flags that they are used to manipulate are part of the KBI. Modified: head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Fri Aug 3 00:11:13 2012 (r238997) +++ head/sys/vm/vm_page.c Fri Aug 3 01:48:15 2012 (r238998) @@ -450,63 +450,6 @@ vm_page_startup(vm_offset_t vaddr) return (vaddr); } - -CTASSERT(offsetof(struct vm_page, aflags) % sizeof(uint32_t) == 0); - -void -vm_page_aflag_set(vm_page_t m, uint8_t bits) -{ - uint32_t *addr, val; - - /* - * The PGA_WRITEABLE flag can only be set if the page is managed and - * VPO_BUSY. Currently, this flag is only set by pmap_enter(). - */ - KASSERT((bits & PGA_WRITEABLE) == 0 || - (m->oflags & (VPO_UNMANAGED | VPO_BUSY)) == VPO_BUSY, - ("PGA_WRITEABLE and !VPO_BUSY")); - - /* - * We want to use atomic updates for m->aflags, which is a - * byte wide. Not all architectures provide atomic operations - * on the single-byte destination. Punt and access the whole - * 4-byte word with an atomic update. Parallel non-atomic - * updates to the fields included in the update by proximity - * are handled properly by atomics. - */ - addr = (void *)&m->aflags; - MPASS(((uintptr_t)addr & (sizeof(uint32_t) - 1)) == 0); - val = bits; -#if BYTE_ORDER == BIG_ENDIAN - val <<= 24; -#endif - atomic_set_32(addr, val); -} - -void -vm_page_aflag_clear(vm_page_t m, uint8_t bits) -{ - uint32_t *addr, val; - - /* - * The PGA_REFERENCED flag can only be cleared if the object - * containing the page is locked. - */ - KASSERT((bits & PGA_REFERENCED) == 0 || VM_OBJECT_LOCKED(m->object), - ("PGA_REFERENCED and !VM_OBJECT_LOCKED")); - - /* - * See the comment in vm_page_aflag_set(). - */ - addr = (void *)&m->aflags; - MPASS(((uintptr_t)addr & (sizeof(uint32_t) - 1)) == 0); - val = bits; -#if BYTE_ORDER == BIG_ENDIAN - val <<= 24; -#endif - atomic_clear_32(addr, val); -} - void vm_page_reference(vm_page_t m) { Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Fri Aug 3 00:11:13 2012 (r238997) +++ head/sys/vm/vm_page.h Fri Aug 3 01:48:15 2012 (r238998) @@ -239,13 +239,14 @@ extern struct vpglocks pa_lock[]; #define vm_page_queue_free_mtx vm_page_queue_free_lock.data /* - * These are the flags defined for vm_page. - * - * aflags are updated by atomic accesses. Use the vm_page_aflag_set() - * and vm_page_aflag_clear() functions to set and clear the flags. + * The vm_page's aflags are updated using atomic operations. To set or clear + * these flags, the functions vm_page_aflag_set() and vm_page_aflag_clear() + * must be used. Neither these flags nor these functions are part of the KBI. * * PGA_REFERENCED may be cleared only if the object containing the page is - * locked. It is set by both the MI and MD VM layers. + * locked. It is set by both the MI and MD VM layers. However, kernel + * loadable modules should not directly set this flag. They should call + * vm_page_reference() instead. * * PGA_WRITEABLE is set exclusively on managed pages by pmap_enter(). When it * does so, the page must be VPO_BUSY. The MI VM layer must never access this @@ -281,8 +282,12 @@ extern struct vpglocks pa_lock[]; #ifdef _KERNEL +#include + #include +#include + /* * Each pageable resident page falls into one of five lists: * @@ -349,8 +354,6 @@ extern struct vpglocks vm_page_queue_loc #define VM_ALLOC_COUNT_SHIFT 16 #define VM_ALLOC_COUNT(count) ((count) << VM_ALLOC_COUNT_SHIFT) -void vm_page_aflag_set(vm_page_t m, uint8_t bits); -void vm_page_aflag_clear(vm_page_t m, uint8_t bits); void vm_page_busy(vm_page_t m); void vm_page_flash(vm_page_t m); void vm_page_io_start(vm_page_t m); @@ -428,6 +431,75 @@ void vm_page_object_lock_assert(vm_page_ #endif /* + * We want to use atomic updates for the aflags field, which is 8 bits wide. + * However, not all architectures support atomic operations on 8-bit + * destinations. In order that we can easily use a 32-bit operation, we + * require that the aflags field be 32-bit aligned. + */ +CTASSERT(offsetof(struct vm_page, aflags) % sizeof(uint32_t) == 0); + +/* + * Clear the given bits in the specified page. + */ +static inline void +vm_page_aflag_clear(vm_page_t m, uint8_t bits) +{ + uint32_t *addr, val; + + /* + * The PGA_REFERENCED flag can only be cleared if the object + * containing the page is locked. + */ + if ((bits & PGA_REFERENCED) != 0) + VM_PAGE_OBJECT_LOCK_ASSERT(m); + + /* + * Access the whole 32-bit word containing the aflags field with an + * atomic update. Parallel non-atomic updates to the other fields + * within this word are handled properly by the atomic update. + */ + addr = (void *)&m->aflags; + KASSERT(((uintptr_t)addr & (sizeof(uint32_t) - 1)) == 0, + ("vm_page_aflag_clear: aflags is misaligned")); + val = bits; +#if BYTE_ORDER == BIG_ENDIAN + val <<= 24; +#endif + atomic_clear_32(addr, val); +} + +/* + * Set the given bits in the specified page. + */ +static inline void +vm_page_aflag_set(vm_page_t m, uint8_t bits) +{ + uint32_t *addr, val; + + /* + * The PGA_WRITEABLE flag can only be set if the page is managed and + * VPO_BUSY. Currently, this flag is only set by pmap_enter(). + */ + KASSERT((bits & PGA_WRITEABLE) == 0 || + (m->oflags & (VPO_UNMANAGED | VPO_BUSY)) == VPO_BUSY, + ("vm_page_aflag_set: PGA_WRITEABLE and !VPO_BUSY")); + + /* + * Access the whole 32-bit word containing the aflags field with an + * atomic update. Parallel non-atomic updates to the other fields + * within this word are handled properly by the atomic update. + */ + addr = (void *)&m->aflags; + KASSERT(((uintptr_t)addr & (sizeof(uint32_t) - 1)) == 0, + ("vm_page_aflag_set: aflags is misaligned")); + val = bits; +#if BYTE_ORDER == BIG_ENDIAN + val <<= 24; +#endif + atomic_set_32(addr, val); +} + +/* * vm_page_dirty: * * Set all bits in the page's dirty field. From owner-svn-src-head@FreeBSD.ORG Fri Aug 3 02:04:16 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 58852106566B; Fri, 3 Aug 2012 02:04:16 +0000 (UTC) (envelope-from alc@rice.edu) Received: from mh11.mail.rice.edu (mh11.mail.rice.edu [128.42.199.30]) by mx1.freebsd.org (Postfix) with ESMTP id 28AD18FC16; Fri, 3 Aug 2012 02:04:15 +0000 (UTC) Received: from mh11.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh11.mail.rice.edu (Postfix) with ESMTP id 122064C01E2; Thu, 2 Aug 2012 21:04:15 -0500 (CDT) Received: from mh11.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh11.mail.rice.edu (Postfix) with ESMTP id 107244C01E1; Thu, 2 Aug 2012 21:04:15 -0500 (CDT) X-Virus-Scanned: by amavis-2.7.0 at mh11.mail.rice.edu, auth channel Received: from mh11.mail.rice.edu ([127.0.0.1]) by mh11.mail.rice.edu (mh11.mail.rice.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id 4YiviaX6cJ9R; Thu, 2 Aug 2012 21:04:14 -0500 (CDT) Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net (adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh11.mail.rice.edu (Postfix) with ESMTPSA id 79F584C01DD; Thu, 2 Aug 2012 21:04:14 -0500 (CDT) Message-ID: <501B319E.3080305@rice.edu> Date: Thu, 02 Aug 2012 21:04:14 -0500 From: Alan Cox User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:8.0) Gecko/20111113 Thunderbird/8.0 MIME-Version: 1.0 To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201208030148.q731mGcZ050429@svn.freebsd.org> In-Reply-To: <201208030148.q731mGcZ050429@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Alan Cox Subject: Re: svn commit: r238998 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Aug 2012 02:04:16 -0000 On 08/02/2012 20:48, Alan Cox wrote: > Author: alc > Date: Fri Aug 3 01:48:15 2012 > New Revision: 238998 > URL: http://svn.freebsd.org/changeset/base/238998 > > Log: > Inline vm_page_aflags_clear() and vm_page_aflags_set(). > > Add comments stating that neither these functions nor the flags that they > are used to manipulate are part of the KBI. This should have also included: Reviewed by: kib > Modified: > head/sys/vm/vm_page.c > head/sys/vm/vm_page.h > > Modified: head/sys/vm/vm_page.c > ============================================================================== > --- head/sys/vm/vm_page.c Fri Aug 3 00:11:13 2012 (r238997) > +++ head/sys/vm/vm_page.c Fri Aug 3 01:48:15 2012 (r238998) > @@ -450,63 +450,6 @@ vm_page_startup(vm_offset_t vaddr) > return (vaddr); > } > > - > -CTASSERT(offsetof(struct vm_page, aflags) % sizeof(uint32_t) == 0); > - > -void > -vm_page_aflag_set(vm_page_t m, uint8_t bits) > -{ > - uint32_t *addr, val; > - > - /* > - * The PGA_WRITEABLE flag can only be set if the page is managed and > - * VPO_BUSY. Currently, this flag is only set by pmap_enter(). > - */ > - KASSERT((bits& PGA_WRITEABLE) == 0 || > - (m->oflags& (VPO_UNMANAGED | VPO_BUSY)) == VPO_BUSY, > - ("PGA_WRITEABLE and !VPO_BUSY")); > - > - /* > - * We want to use atomic updates for m->aflags, which is a > - * byte wide. Not all architectures provide atomic operations > - * on the single-byte destination. Punt and access the whole > - * 4-byte word with an atomic update. Parallel non-atomic > - * updates to the fields included in the update by proximity > - * are handled properly by atomics. > - */ > - addr = (void *)&m->aflags; > - MPASS(((uintptr_t)addr& (sizeof(uint32_t) - 1)) == 0); > - val = bits; > -#if BYTE_ORDER == BIG_ENDIAN > - val<<= 24; > -#endif > - atomic_set_32(addr, val); > -} > - > -void > -vm_page_aflag_clear(vm_page_t m, uint8_t bits) > -{ > - uint32_t *addr, val; > - > - /* > - * The PGA_REFERENCED flag can only be cleared if the object > - * containing the page is locked. > - */ > - KASSERT((bits& PGA_REFERENCED) == 0 || VM_OBJECT_LOCKED(m->object), > - ("PGA_REFERENCED and !VM_OBJECT_LOCKED")); > - > - /* > - * See the comment in vm_page_aflag_set(). > - */ > - addr = (void *)&m->aflags; > - MPASS(((uintptr_t)addr& (sizeof(uint32_t) - 1)) == 0); > - val = bits; > -#if BYTE_ORDER == BIG_ENDIAN > - val<<= 24; > -#endif > - atomic_clear_32(addr, val); > -} > - > void > vm_page_reference(vm_page_t m) > { > > Modified: head/sys/vm/vm_page.h > ============================================================================== > --- head/sys/vm/vm_page.h Fri Aug 3 00:11:13 2012 (r238997) > +++ head/sys/vm/vm_page.h Fri Aug 3 01:48:15 2012 (r238998) > @@ -239,13 +239,14 @@ extern struct vpglocks pa_lock[]; > #define vm_page_queue_free_mtx vm_page_queue_free_lock.data > > /* > - * These are the flags defined for vm_page. > - * > - * aflags are updated by atomic accesses. Use the vm_page_aflag_set() > - * and vm_page_aflag_clear() functions to set and clear the flags. > + * The vm_page's aflags are updated using atomic operations. To set or clear > + * these flags, the functions vm_page_aflag_set() and vm_page_aflag_clear() > + * must be used. Neither these flags nor these functions are part of the KBI. > * > * PGA_REFERENCED may be cleared only if the object containing the page is > - * locked. It is set by both the MI and MD VM layers. > + * locked. It is set by both the MI and MD VM layers. However, kernel > + * loadable modules should not directly set this flag. They should call > + * vm_page_reference() instead. > * > * PGA_WRITEABLE is set exclusively on managed pages by pmap_enter(). When it > * does so, the page must be VPO_BUSY. The MI VM layer must never access this > @@ -281,8 +282,12 @@ extern struct vpglocks pa_lock[]; > > #ifdef _KERNEL > > +#include > + > #include > > +#include > + > /* > * Each pageable resident page falls into one of five lists: > * > @@ -349,8 +354,6 @@ extern struct vpglocks vm_page_queue_loc > #define VM_ALLOC_COUNT_SHIFT 16 > #define VM_ALLOC_COUNT(count) ((count)<< VM_ALLOC_COUNT_SHIFT) > > -void vm_page_aflag_set(vm_page_t m, uint8_t bits); > -void vm_page_aflag_clear(vm_page_t m, uint8_t bits); > void vm_page_busy(vm_page_t m); > void vm_page_flash(vm_page_t m); > void vm_page_io_start(vm_page_t m); > @@ -428,6 +431,75 @@ void vm_page_object_lock_assert(vm_page_ > #endif > > /* > + * We want to use atomic updates for the aflags field, which is 8 bits wide. > + * However, not all architectures support atomic operations on 8-bit > + * destinations. In order that we can easily use a 32-bit operation, we > + * require that the aflags field be 32-bit aligned. > + */ > +CTASSERT(offsetof(struct vm_page, aflags) % sizeof(uint32_t) == 0); > + > +/* > + * Clear the given bits in the specified page. > + */ > +static inline void > +vm_page_aflag_clear(vm_page_t m, uint8_t bits) > +{ > + uint32_t *addr, val; > + > + /* > + * The PGA_REFERENCED flag can only be cleared if the object > + * containing the page is locked. > + */ > + if ((bits& PGA_REFERENCED) != 0) > + VM_PAGE_OBJECT_LOCK_ASSERT(m); > + > + /* > + * Access the whole 32-bit word containing the aflags field with an > + * atomic update. Parallel non-atomic updates to the other fields > + * within this word are handled properly by the atomic update. > + */ > + addr = (void *)&m->aflags; > + KASSERT(((uintptr_t)addr& (sizeof(uint32_t) - 1)) == 0, > + ("vm_page_aflag_clear: aflags is misaligned")); > + val = bits; > +#if BYTE_ORDER == BIG_ENDIAN > + val<<= 24; > +#endif > + atomic_clear_32(addr, val); > +} > + > +/* > + * Set the given bits in the specified page. > + */ > +static inline void > +vm_page_aflag_set(vm_page_t m, uint8_t bits) > +{ > + uint32_t *addr, val; > + > + /* > + * The PGA_WRITEABLE flag can only be set if the page is managed and > + * VPO_BUSY. Currently, this flag is only set by pmap_enter(). > + */ > + KASSERT((bits& PGA_WRITEABLE) == 0 || > + (m->oflags& (VPO_UNMANAGED | VPO_BUSY)) == VPO_BUSY, > + ("vm_page_aflag_set: PGA_WRITEABLE and !VPO_BUSY")); > + > + /* > + * Access the whole 32-bit word containing the aflags field with an > + * atomic update. Parallel non-atomic updates to the other fields > + * within this word are handled properly by the atomic update. > + */ > + addr = (void *)&m->aflags; > + KASSERT(((uintptr_t)addr& (sizeof(uint32_t) - 1)) == 0, > + ("vm_page_aflag_set: aflags is misaligned")); > + val = bits; > +#if BYTE_ORDER == BIG_ENDIAN > + val<<= 24; > +#endif > + atomic_set_32(addr, val); > +} > + > +/* > * vm_page_dirty: > * > * Set all bits in the page's dirty field. > From owner-svn-src-head@FreeBSD.ORG Fri Aug 3 03:44:07 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B0766106564A; Fri, 3 Aug 2012 03:44:07 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.allbsd.org (gatekeeper.allbsd.org [IPv6:2001:2f0:104:e001::32]) by mx1.freebsd.org (Postfix) with ESMTP id 7ED1D8FC12; Fri, 3 Aug 2012 03:44:05 +0000 (UTC) Received: from alph.allbsd.org (p2214-ipbf2707funabasi.chiba.ocn.ne.jp [123.225.119.214]) (authenticated bits=128) by mail.allbsd.org (8.14.5/8.14.5) with ESMTP id q733hi0H043605 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 3 Aug 2012 12:43:56 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) (authenticated bits=0) by alph.allbsd.org (8.14.5/8.14.5) with ESMTP id q733hgIj071122; Fri, 3 Aug 2012 12:43:44 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Fri, 03 Aug 2012 12:43:05 +0900 (JST) Message-Id: <20120803.124305.1981901625663633450.hrs@allbsd.org> To: emax@FreeBSD.org From: Hiroki Sato In-Reply-To: References: <501AF66A.8020804@FreeBSD.org> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.5 on Emacs 23.4 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart0(Fri_Aug__3_12_43_06_2012_941)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97.4 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (mail.allbsd.org [133.31.130.32]); Fri, 03 Aug 2012 12:43:56 +0900 (JST) X-Spam-Status: No, score=-96.6 required=13.0 tests=CONTENT_TYPE_PRESENT, ONLY1HOPDIRECT, QENCPTR1, RCVD_IN_RP_RNBL, SAMEHELOBY2HOP, USER_IN_WHITELIST autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on gatekeeper.allbsd.org Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, dougb@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r238622 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Aug 2012 03:44:07 -0000 ----Security_Multipart0(Fri_Aug__3_12_43_06_2012_941)-- Content-Type: Multipart/Mixed; boundary="--Next_Part(Fri_Aug__3_12_43_05_2012_962)--" Content-Transfer-Encoding: 7bit ----Next_Part(Fri_Aug__3_12_43_05_2012_962)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Maksim Yevmenkin wrote in : em> of course :) we have ipv4 systems in production that make use of em> getaddrinfo(3) api. when a particular dns name is resolved, and, em> multiple A records are returned, the results get sorted according to em> the "default" address selection policy. rfc3484 has a set of rules em> according to which results should be sorted. all of the rules do not em> apply in our case, except one - the rule #9. the idea is that ipv4 em> addresses are "converted" to ipv6 addresses and then longest prefix em> match sorting is applied. in other words, if your system ip address em> happens to share high bits with the ip address from the A record, the em> IP address from the A record will always be preferred. of course, em> longest prefix match is performed without any extra information such em> as netmask and/or cidr. it really is just matching high bits of the em> address. em> em> so, what we found out, is that some systems tend to favor a particular em> ip address (from a bunch of ip addresses returned by name resolution) em> because 4 high bits were the same. basically, round-robin dns was em> completely shot. Is that issue solved by applying the attached patch and setting net.inet6.ip6.longestmatch_mapped=0? I do not think it is a good idea to use the empty rule to solve it because if the system has to support IPv6 as well the empty rule has negative effect. Adding flag to the IPv4 address line in the policy or adding a sysctl sounds a reasonable solution to me. -- Hiroki ----Next_Part(Fri_Aug__3_12_43_05_2012_962)-- Content-Type: Text/X-Patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ip6_longestmatch-20120802-1.diff" Index: sys/netinet6/in6_proto.c =================================================================== --- sys/netinet6/in6_proto.c (revision 238998) +++ sys/netinet6/in6_proto.c (working copy) @@ -587,6 +587,9 @@ SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_STEALTH, stealth, CTLFLAG_RW, &VNET_NAME(ip6stealth), 0, ""); #endif +SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_LONGESTMATCH_MAPPED, + longestmatch_mapped, CTLFLAG_RW, &VNET_NAME(ip6_longestmatch_mapped), 0, + "Use longest match prefix rule for IPv4-mapped address in addrsel."); #ifdef FLOWTABLE VNET_DEFINE(int, ip6_output_flowtable_size) = 2048; Index: sys/netinet6/in6.h =================================================================== --- sys/netinet6/in6.h (revision 238998) +++ sys/netinet6/in6.h (working copy) @@ -618,7 +618,8 @@ * receiving IF. */ #define IPV6CTL_RFC6204W3 50 /* Accept defroute even when forwarding enabled */ -#define IPV6CTL_MAXID 51 +#define IPV6CTL_LONGESTMATCH_MAPPED 51 +#define IPV6CTL_MAXID 52 #endif /* __BSD_VISIBLE */ /* Index: sys/netinet6/in6_src.c =================================================================== --- sys/netinet6/in6_src.c (revision 238998) +++ sys/netinet6/in6_src.c (working copy) @@ -126,6 +126,7 @@ #define V_defaultaddrpolicy VNET(defaultaddrpolicy) VNET_DEFINE(int, ip6_prefer_tempaddr) = 0; +VNET_DEFINE(int, ip6_longestmatch_mapped) = 1; static int selectroute __P((struct sockaddr_in6 *, struct ip6_pktopts *, struct ip6_moptions *, struct route_in6 *, struct ifnet **, @@ -452,11 +453,13 @@ * a large number so that it is easy to assign smaller numbers * to more preferred rules. */ + if (!IN6_IS_ADDR_V4MAPPED(&dst) || ip6_longestmatch_mapped) { new_matchlen = in6_matchlen(&ia->ia_addr.sin6_addr, &dst); if (best_matchlen < new_matchlen) REPLACE(14); if (new_matchlen < best_matchlen) NEXT(14); + } /* Rule 15 is reserved. */ Index: sys/netinet6/ip6_var.h =================================================================== --- sys/netinet6/ip6_var.h (revision 238998) +++ sys/netinet6/ip6_var.h (working copy) @@ -357,6 +357,9 @@ * zone when unspecified */ #define V_ip6_use_defzone VNET(ip6_use_defzone) +VNET_DECLARE(int, ip6_longestmatch_mapped); /* Use longest match for addrsel */ +#define V_ip6_longestmatch_mapped VNET(ip6_longestmatch_mapped) + VNET_DECLARE (struct pfil_head, inet6_pfil_hook); /* packet filter hooks */ #define V_inet6_pfil_hook VNET(inet6_pfil_hook) #ifdef IPSTEALTH ----Next_Part(Fri_Aug__3_12_43_05_2012_962)---- ----Security_Multipart0(Fri_Aug__3_12_43_06_2012_941)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEABECAAYFAlAbSMoACgkQTyzT2CeTzy12ZwCguPG2rewLOtWCQahfy5pWED+z lR8An3GV8w0F3eB6/fAucl/4ACT1g+u4 =14dw -----END PGP SIGNATURE----- ----Security_Multipart0(Fri_Aug__3_12_43_06_2012_941)---- From owner-svn-src-head@FreeBSD.ORG Fri Aug 3 03:59:17 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A999106566C; Fri, 3 Aug 2012 03:59:16 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.allbsd.org (gatekeeper.allbsd.org [IPv6:2001:2f0:104:e001::32]) by mx1.freebsd.org (Postfix) with ESMTP id 1E2098FC0C; Fri, 3 Aug 2012 03:59:14 +0000 (UTC) Received: from alph.allbsd.org (p2214-ipbf2707funabasi.chiba.ocn.ne.jp [123.225.119.214]) (authenticated bits=128) by mail.allbsd.org (8.14.5/8.14.5) with ESMTP id q733wqif045378 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 3 Aug 2012 12:59:06 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) (authenticated bits=0) by alph.allbsd.org (8.14.5/8.14.5) with ESMTP id q733wpxw071280; Fri, 3 Aug 2012 12:58:52 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Fri, 03 Aug 2012 12:58:03 +0900 (JST) Message-Id: <20120803.125803.269418223701686293.hrs@allbsd.org> To: dougb@FreeBSD.org From: Hiroki Sato In-Reply-To: <501AF66A.8020804@FreeBSD.org> References: <20120803.055554.1380323232583218022.hrs@allbsd.org> <501AF66A.8020804@FreeBSD.org> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.5 on Emacs 23.4 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart(Fri_Aug__3_12_58_03_2012_662)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97.4 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (mail.allbsd.org [133.31.130.32]); Fri, 03 Aug 2012 12:59:07 +0900 (JST) X-Spam-Status: No, score=-96.8 required=13.0 tests=CONTENT_TYPE_PRESENT, ONLY1HOPDIRECT, RCVD_IN_RP_RNBL, SAMEHELOBY2HOP, USER_IN_WHITELIST autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on gatekeeper.allbsd.org Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, emax@FreeBSD.org Subject: Re: svn commit: r238622 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Aug 2012 03:59:17 -0000 ----Security_Multipart(Fri_Aug__3_12_58_03_2012_662)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Doug Barton wrote in <501AF66A.8020804@FreeBSD.org>: do> On 8/2/2012 2:25 PM, Maksim Yevmenkin wrote: do> > On Thu, Aug 2, 2012 at 1:55 PM, Hiroki Sato wrote: do> > do> >> Just curious, why ip6addrctl_enable=NO is not enough here? do> do> Because the behavior of the script for =NO is to prefer v4. No, when ip6addrctl_enable=NO the rc.d/ip6addtctl script will be simply ignored. No rule will be installed in that case. do> >> I would do> >> like to eliminate yes/no/none keywords in $ip6addrctl_policy because do> >> such keywords are vague. If we need the empty rule for some reason, do> >> "empty" would be a better name for the policy, I think. do> do> Personally I think that the established meanings of "yes" and "no" are do> well understood, but I wouldn't object to emitting a warning for them to do> help the user make a more explicit selection. I do not think ip6addrctl_policy={yes|no} is meaningful. do> While we're at it, the way that the current script replicates the test do> for checkyesno in case is bogus, and should be changed. I had fixed this do> in the change set that you(hrs) backed out. To stick with the structure do> of the current script, something like this would work: do> do> http://people.freebsd.org/~dougb/ip6addrctl.diff do> do> That also brings in the warning described above. I think additional warnings are not needed because a warning will be displayed when ipv6_prefer={yes|no} is defined. I have no objection to use checkyesno() itself to check if the variable is defined as yes or no. -- Hiroki ----Security_Multipart(Fri_Aug__3_12_58_03_2012_662)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEABECAAYFAlAbTEsACgkQTyzT2CeTzy1dsgCgv3QnhZMm6Wn3ZbcVDDGVRPWs AMUAoKnqO4kG75kVYYfI+ZKQj+aV7xfK =YbaB -----END PGP SIGNATURE----- ----Security_Multipart(Fri_Aug__3_12_58_03_2012_662)---- From owner-svn-src-head@FreeBSD.ORG Fri Aug 3 04:18:24 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20E15106566C; Fri, 3 Aug 2012 04:18:24 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.allbsd.org (gatekeeper.allbsd.org [IPv6:2001:2f0:104:e001::32]) by mx1.freebsd.org (Postfix) with ESMTP id 5C87E8FC0C; Fri, 3 Aug 2012 04:18:23 +0000 (UTC) Received: from alph.allbsd.org (p2214-ipbf2707funabasi.chiba.ocn.ne.jp [123.225.119.214]) (authenticated bits=128) by mail.allbsd.org (8.14.5/8.14.5) with ESMTP id q734I6Ax047814 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 3 Aug 2012 13:18:17 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) (authenticated bits=0) by alph.allbsd.org (8.14.5/8.14.5) with ESMTP id q734I6wb071548; Fri, 3 Aug 2012 13:18:06 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Fri, 03 Aug 2012 13:17:46 +0900 (JST) Message-Id: <20120803.131746.1643150967050340012.hrs@allbsd.org> To: emax@FreeBSD.org From: Hiroki Sato In-Reply-To: <20120803.124305.1981901625663633450.hrs@allbsd.org> References: <501AF66A.8020804@FreeBSD.org> <20120803.124305.1981901625663633450.hrs@allbsd.org> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.5 on Emacs 23.4 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart(Fri_Aug__3_13_17_46_2012_949)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97.4 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (mail.allbsd.org [133.31.130.32]); Fri, 03 Aug 2012 13:18:17 +0900 (JST) X-Spam-Status: No, score=-96.8 required=13.0 tests=CONTENT_TYPE_PRESENT, ONLY1HOPDIRECT, RCVD_IN_RP_RNBL, SAMEHELOBY2HOP, USER_IN_WHITELIST autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on gatekeeper.allbsd.org Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, dougb@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r238622 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Aug 2012 04:18:24 -0000 ----Security_Multipart(Fri_Aug__3_13_17_46_2012_949)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hiroki Sato wrote in <20120803.124305.1981901625663633450.hrs@allbsd.org>: hr> Maksim Yevmenkin wrote hr> in : hr> hr> em> of course :) we have ipv4 systems in production that make use of hr> em> getaddrinfo(3) api. when a particular dns name is resolved, and, hr> em> multiple A records are returned, the results get sorted according to hr> em> the "default" address selection policy. rfc3484 has a set of rules hr> em> according to which results should be sorted. all of the rules do not hr> em> apply in our case, except one - the rule #9. the idea is that ipv4 hr> em> addresses are "converted" to ipv6 addresses and then longest prefix hr> em> match sorting is applied. in other words, if your system ip address hr> em> happens to share high bits with the ip address from the A record, the hr> em> IP address from the A record will always be preferred. of course, hr> em> longest prefix match is performed without any extra information such hr> em> as netmask and/or cidr. it really is just matching high bits of the hr> em> address. hr> em> hr> em> so, what we found out, is that some systems tend to favor a particular hr> em> ip address (from a bunch of ip addresses returned by name resolution) hr> em> because 4 high bits were the same. basically, round-robin dns was hr> em> completely shot. hr> hr> Is that issue solved by applying the attached patch and setting hr> net.inet6.ip6.longestmatch_mapped=0? hr> hr> I do not think it is a good idea to use the empty rule to solve it hr> because if the system has to support IPv6 as well the empty rule has hr> negative effect. Adding flag to the IPv4 address line in the policy hr> or adding a sysctl sounds a reasonable solution to me. Gr, I got a wrong idea about the issue. What you want is to disable longest match in the dest addr selection. It needs a change in comp_dst() in getaddrinfo.c. -- Hiroki ----Security_Multipart(Fri_Aug__3_13_17_46_2012_949)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEABECAAYFAlAbUOoACgkQTyzT2CeTzy0ECwCg3PSWvaFc6W9mSklO6dt/D1x4 rQ4AoKoVIpTnKPrEInLKTaTgf0LeVdxq =GBkx -----END PGP SIGNATURE----- ----Security_Multipart(Fri_Aug__3_13_17_46_2012_949)---- From owner-svn-src-head@FreeBSD.ORG Fri Aug 3 04:23:05 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7E338106566B; Fri, 3 Aug 2012 04:23:05 +0000 (UTC) (envelope-from jhay@meraka.csir.co.za) Received: from zibbi.meraka.csir.co.za (zibbi.meraka.csir.co.za [IPv6:2001:4200:7000:2::1]) by mx1.freebsd.org (Postfix) with ESMTP id AE4F48FC12; Fri, 3 Aug 2012 04:23:04 +0000 (UTC) Received: by zibbi.meraka.csir.co.za (Postfix, from userid 3973) id F2B39B84B; Fri, 3 Aug 2012 06:23:01 +0200 (SAST) Date: Fri, 3 Aug 2012 06:23:01 +0200 From: John Hay To: Hiroki Sato Message-ID: <20120803042301.GA78461@zibbi.meraka.csir.co.za> References: <501AF66A.8020804@FreeBSD.org> <20120803.124305.1981901625663633450.hrs@allbsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120803.124305.1981901625663633450.hrs@allbsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, dougb@FreeBSD.org, emax@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r238622 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Aug 2012 04:23:05 -0000 While you guys are here, may I add a request that we go back to prefering IPv6 when IPv6 addresses are enabled. That is the way it was from FBSD-4 up to FBSD-8. 9 is a big POLA here. The world is past World IPv6 Launch and I think people expect that if they configure IPv6 addresses, that would be prefered. If you configure IPv6 addresses and do not want them prefered, you are the odd one out and should have to do something. Otherwise when in the future are we going to change it? my 2cents John -- John Hay -- jhay@meraka.csir.co.za / jhay@FreeBSD.org On Fri, Aug 03, 2012 at 12:43:05PM +0900, Hiroki Sato wrote: > Maksim Yevmenkin wrote > in : > > em> of course :) we have ipv4 systems in production that make use of > em> getaddrinfo(3) api. when a particular dns name is resolved, and, > em> multiple A records are returned, the results get sorted according to > em> the "default" address selection policy. rfc3484 has a set of rules > em> according to which results should be sorted. all of the rules do not > em> apply in our case, except one - the rule #9. the idea is that ipv4 > em> addresses are "converted" to ipv6 addresses and then longest prefix > em> match sorting is applied. in other words, if your system ip address > em> happens to share high bits with the ip address from the A record, the > em> IP address from the A record will always be preferred. of course, > em> longest prefix match is performed without any extra information such > em> as netmask and/or cidr. it really is just matching high bits of the > em> address. > em> > em> so, what we found out, is that some systems tend to favor a particular > em> ip address (from a bunch of ip addresses returned by name resolution) > em> because 4 high bits were the same. basically, round-robin dns was > em> completely shot. > > Is that issue solved by applying the attached patch and setting > net.inet6.ip6.longestmatch_mapped=0? > > I do not think it is a good idea to use the empty rule to solve it > because if the system has to support IPv6 as well the empty rule has > negative effect. Adding flag to the IPv4 address line in the policy > or adding a sysctl sounds a reasonable solution to me. > > -- Hiroki From owner-svn-src-head@FreeBSD.ORG Fri Aug 3 05:29:18 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E18A6106566B; Fri, 3 Aug 2012 05:29:18 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.allbsd.org (gatekeeper.allbsd.org [IPv6:2001:2f0:104:e001::32]) by mx1.freebsd.org (Postfix) with ESMTP id 535AD8FC08; Fri, 3 Aug 2012 05:29:17 +0000 (UTC) Received: from alph.allbsd.org (p2214-ipbf2707funabasi.chiba.ocn.ne.jp [123.225.119.214]) (authenticated bits=128) by mail.allbsd.org (8.14.5/8.14.5) with ESMTP id q735Swmt056151 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 3 Aug 2012 14:29:09 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) (authenticated bits=0) by alph.allbsd.org (8.14.5/8.14.5) with ESMTP id q735SsCi072254; Fri, 3 Aug 2012 14:28:58 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Fri, 03 Aug 2012 14:28:47 +0900 (JST) Message-Id: <20120803.142847.874617321595545142.hrs@allbsd.org> To: jhay@meraka.org.za From: Hiroki Sato In-Reply-To: <20120803042301.GA78461@zibbi.meraka.csir.co.za> References: <20120803.124305.1981901625663633450.hrs@allbsd.org> <20120803042301.GA78461@zibbi.meraka.csir.co.za> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.5 on Emacs 23.4 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart(Fri_Aug__3_14_28_47_2012_667)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97.4 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (mail.allbsd.org [133.31.130.32]); Fri, 03 Aug 2012 14:29:09 +0900 (JST) X-Spam-Status: No, score=-96.8 required=13.0 tests=CONTENT_TYPE_PRESENT, ONLY1HOPDIRECT, RCVD_IN_RP_RNBL, SAMEHELOBY2HOP, USER_IN_WHITELIST autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on gatekeeper.allbsd.org Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, dougb@FreeBSD.org, emax@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r238622 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Aug 2012 05:29:19 -0000 ----Security_Multipart(Fri_Aug__3_14_28_47_2012_667)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit John Hay wrote in <20120803042301.GA78461@zibbi.meraka.csir.co.za>: jh> While you guys are here, may I add a request that we go back to prefering jh> IPv6 when IPv6 addresses are enabled. That is the way it was from FBSD-4 jh> up to FBSD-8. 9 is a big POLA here. The world is past World IPv6 Launch jh> and I think people expect that if they configure IPv6 addresses, that jh> would be prefered. If you configure IPv6 addresses and do not want them jh> prefered, you are the odd one out and should have to do something. jh> jh> Otherwise when in the future are we going to change it? IPv4-preferred was chosen as the default because difference of the loopback performance was large. I am a big fun to make FreeBSD IPv6-capable by default and prefer IPv6, but the concern was a possible negative impact for people who are using only IPv4. So, can we change it for 10.X now? We cannot use "whether IPv6 address is configured" because ::1 is always configured in GENERIC kernel. The change will be "IPv6-preferred if the kernel has INET6 support". Preferring IPv6 addresses has needed a knob in rc.conf even in 4.x: 4.X: ipv6_enable="YES" ipv6_ifconfig_em0="2001:db8::1 prefixlen 64" 9.X and later: ip6addrctl_policy="ipv6_prefer" ifconfig_em0_ipv6="inet6 2001:db8::1 prefixlen 64" and if we change the default to ipv6_prefer, ip6addrctl_policy= line will be unnecessary. -- Hiroki ----Security_Multipart(Fri_Aug__3_14_28_47_2012_667)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEABECAAYFAlAbYY8ACgkQTyzT2CeTzy2F6ACfR7DZj1cYRG19VMvXtv9Wj5g+ 9EEAnRJNtUGyL5dDDc/l5LIvBVFlxNUS =Temk -----END PGP SIGNATURE----- ----Security_Multipart(Fri_Aug__3_14_28_47_2012_667)---- From owner-svn-src-head@FreeBSD.ORG Fri Aug 3 06:09:58 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E2D42106564A; Fri, 3 Aug 2012 06:09:58 +0000 (UTC) (envelope-from jhay@meraka.csir.co.za) Received: from zibbi.meraka.csir.co.za (zibbi.meraka.csir.co.za [IPv6:2001:4200:7000:2::1]) by mx1.freebsd.org (Postfix) with ESMTP id 1EF898FC12; Fri, 3 Aug 2012 06:09:58 +0000 (UTC) Received: by zibbi.meraka.csir.co.za (Postfix, from userid 3973) id 2F544B83B; Fri, 3 Aug 2012 08:09:56 +0200 (SAST) Date: Fri, 3 Aug 2012 08:09:56 +0200 From: John Hay To: Hiroki Sato Message-ID: <20120803060955.GB78461@zibbi.meraka.csir.co.za> References: <20120803.124305.1981901625663633450.hrs@allbsd.org> <20120803042301.GA78461@zibbi.meraka.csir.co.za> <20120803.142847.874617321595545142.hrs@allbsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120803.142847.874617321595545142.hrs@allbsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, dougb@FreeBSD.org, emax@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r238622 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Aug 2012 06:09:59 -0000 On Fri, Aug 03, 2012 at 02:28:47PM +0900, Hiroki Sato wrote: > John Hay wrote > in <20120803042301.GA78461@zibbi.meraka.csir.co.za>: > > jh> While you guys are here, may I add a request that we go back to prefering > jh> IPv6 when IPv6 addresses are enabled. That is the way it was from FBSD-4 > jh> up to FBSD-8. 9 is a big POLA here. The world is past World IPv6 Launch > jh> and I think people expect that if they configure IPv6 addresses, that > jh> would be prefered. If you configure IPv6 addresses and do not want them > jh> prefered, you are the odd one out and should have to do something. > jh> > jh> Otherwise when in the future are we going to change it? > > IPv4-preferred was chosen as the default because difference of the > loopback performance was large. I am a big fun to make FreeBSD > IPv6-capable by default and prefer IPv6, but the concern was a > possible negative impact for people who are using only IPv4. > > So, can we change it for 10.X now? We cannot use "whether IPv6 > address is configured" because ::1 is always configured in GENERIC > kernel. The change will be "IPv6-preferred if the kernel has INET6 > support". > > Preferring IPv6 addresses has needed a knob in rc.conf even in 4.x: > > 4.X: > ipv6_enable="YES" > ipv6_ifconfig_em0="2001:db8::1 prefixlen 64" > > 9.X and later: > ip6addrctl_policy="ipv6_prefer" > ifconfig_em0_ipv6="inet6 2001:db8::1 prefixlen 64" > > and if we change the default to ipv6_prefer, ip6addrctl_policy= line > will be unnecessary. > I would be happy with ipv6_prefer if the kernel has INET6 in. I wish IPv6 on FreeBSD was even more automatic, though. :-) I can give a recent use case. Last weekend after a lot of preparation a university turned on IPv6 on the whole campus, dorms included. The next morning 30-50% of their traffic was IPv6. The reason being that MS Windows just worked. They are very happy because they do not have to start an extra drive to get the students to turn on IPv6 on their machines. :-) John -- John Hay -- jhay@meraka.csir.co.za / jhay@FreeBSD.org From owner-svn-src-head@FreeBSD.ORG Fri Aug 3 08:18:01 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E44E1065672 for ; Fri, 3 Aug 2012 08:18:01 +0000 (UTC) (envelope-from andrey@zonov.org) Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 7380F8FC0A for ; Fri, 3 Aug 2012 08:17:59 +0000 (UTC) Received: by laai10 with SMTP id i10so258682laa.13 for ; Fri, 03 Aug 2012 01:17:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=efMmlVVUNBnAjfEp9NXPaTyffyALoSDHT18T2BR6/30=; b=OcXKnm04YYNbEDcnGWuY0jfzuEijc9IYfOo9U/SVAkYg8mq7rfVdZj8rucjTrehH3l lPu5KyuYAPbcdDjJumv5Pyd+vlW/BHqjQI5B6k+XDYw5he4xakFjHHaOfuZGib8Pghfn 2yw0Pplhj8quyLJ7i/rD8Rc6g8zbOVa6B2l/Be5ax9emH/Yh50c1abvgCeYA7coAzV/1 zDjydt7r+egbUhlHMBF+oKz43H6Qq6Nw9NG5swpUgwJCkzEsCGpRis2DWXrRWYw8wVRi J7TzYip1fJnMQfQ1Hqds5pldRIdmD/Gv2wTaIO/6ZILZPzUfj6wNmf3jRDVZ0uHVwcuB 4t/g== Received: by 10.152.124.180 with SMTP id mj20mr810425lab.43.1343981878912; Fri, 03 Aug 2012 01:17:58 -0700 (PDT) Received: from zont-osx.local (ppp95-165-156-247.pppoe.spdop.ru. [95.165.156.247]) by mx.google.com with ESMTPS id lv13sm8083097lab.8.2012.08.03.01.17.57 (version=SSLv3 cipher=OTHER); Fri, 03 Aug 2012 01:17:58 -0700 (PDT) Message-ID: <501B8934.90908@zonov.org> Date: Fri, 03 Aug 2012 12:17:56 +0400 From: Andrey Zonov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Maksim Yevmenkin References: <201207191536.q6JFabOR094467@svn.freebsd.org> <20120803.055554.1380323232583218022.hrs@allbsd.org> <501AF66A.8020804@FreeBSD.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQkl4h3xWPLXlPL78xIA+96LmFOoz4hWvRXBsuqv+gAafLpoNPMxx2o5gsHlns/bNczEilVH Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Doug Barton , src-committers@freebsd.org, Hiroki Sato Subject: Re: svn commit: r238622 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Aug 2012 08:18:01 -0000 On 8/3/12 2:22 AM, Maksim Yevmenkin wrote: >> >>> i just wanted to make sure that there is a way to absolutely make sure >>> that there is no default address selection policy installed. the wide >>> know rule 9 of rfc 3484 is really messing things up for dns-style load >>> balancing. even when ipv6 is not used. Did you try an empty config file? >> >> Maksim, can you say more about this? Or point me to a reference that has >> the discussion? > > of course :) we have ipv4 systems in production that make use of > getaddrinfo(3) api. when a particular dns name is resolved, and, > multiple A records are returned, the results get sorted according to > the "default" address selection policy. rfc3484 has a set of rules > according to which results should be sorted. all of the rules do not > apply in our case, except one - the rule #9. the idea is that ipv4 > addresses are "converted" to ipv6 addresses and then longest prefix > match sorting is applied. in other words, if your system ip address > happens to share high bits with the ip address from the A record, the > IP address from the A record will always be preferred. of course, > longest prefix match is performed without any extra information such > as netmask and/or cidr. it really is just matching high bits of the > address. > > so, what we found out, is that some systems tend to favor a particular > ip address (from a bunch of ip addresses returned by name resolution) > because 4 high bits were the same. basically, round-robin dns was > completely shot. RFC3484 completely breaks round-robin DNS. It's clearly that rule #9 should not apply if resolved name has only A records. That problem was discussed many times at ietf.org, but authors don't want to understand people. For example, for us the problem will be huge when Windows users will update their systems. PS: It would be very useful to have a chance to turn off rule #9 in FreeBSD. -- Andrey Zonov From owner-svn-src-head@FreeBSD.ORG Fri Aug 3 09:08:21 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F273106566B; Fri, 3 Aug 2012 09:08:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 109288FC17; Fri, 3 Aug 2012 09:08:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7398K3g093087; Fri, 3 Aug 2012 09:08:20 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7398Kbf093085; Fri, 3 Aug 2012 09:08:20 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201208030908.q7398Kbf093085@svn.freebsd.org> From: Alexander Motin Date: Fri, 3 Aug 2012 09:08:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239005 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Aug 2012 09:08:21 -0000 Author: mav Date: Fri Aug 3 09:08:20 2012 New Revision: 239005 URL: http://svn.freebsd.org/changeset/base/239005 Log: Microoptimize time math. As soon as our event periods are always below ome second we may not add intereger parts by using bintime_addx() instead of bintime_add(). Profiling shows handleevents() time redction by 15%. Modified: head/sys/kern/kern_clocksource.c Modified: head/sys/kern/kern_clocksource.c ============================================================================== --- head/sys/kern/kern_clocksource.c Fri Aug 3 05:39:32 2012 (r239004) +++ head/sys/kern/kern_clocksource.c Fri Aug 3 09:08:20 2012 (r239005) @@ -205,19 +205,21 @@ handleevents(struct bintime *now, int fa runs = 0; while (bintime_cmp(now, &state->nexthard, >=)) { - bintime_add(&state->nexthard, &hardperiod); + bintime_addx(&state->nexthard, hardperiod.frac); runs++; } - if ((timer->et_flags & ET_FLAGS_PERCPU) == 0 && - bintime_cmp(&state->nexthard, &nexthard, >)) - nexthard = state->nexthard; - if (runs && fake < 2) { - hardclock_cnt(runs, usermode); - done = 1; + if (runs) { + if ((timer->et_flags & ET_FLAGS_PERCPU) == 0 && + bintime_cmp(&state->nexthard, &nexthard, >)) + nexthard = state->nexthard; + if (fake < 2) { + hardclock_cnt(runs, usermode); + done = 1; + } } runs = 0; while (bintime_cmp(now, &state->nextstat, >=)) { - bintime_add(&state->nextstat, &statperiod); + bintime_addx(&state->nextstat, statperiod.frac); runs++; } if (runs && fake < 2) { @@ -227,7 +229,7 @@ handleevents(struct bintime *now, int fa if (profiling) { runs = 0; while (bintime_cmp(now, &state->nextprof, >=)) { - bintime_add(&state->nextprof, &profperiod); + bintime_addx(&state->nextprof, profperiod.frac); runs++; } if (runs && !fake) { @@ -356,7 +358,7 @@ timercb(struct eventtimer *et, void *arg next = &nexttick; if (periodic) { now = *next; /* Ex-next tick time becomes present time. */ - bintime_add(next, &timerperiod); /* Next tick in 1 period. */ + bintime_addx(next, timerperiod.frac); /* Next tick in 1 period. */ } else { binuptime(&now); /* Get present time from hardware. */ next->sec = -1; /* Next tick is not scheduled yet. */ @@ -433,7 +435,7 @@ loadtimer(struct bintime *now, int start new.sec = 0; new.frac = timerperiod.frac - tmp; if (new.frac < tmp) /* Left less then passed. */ - bintime_add(&new, &timerperiod); + bintime_addx(&new, timerperiod.frac); CTR5(KTR_SPARE2, "load p at %d: now %d.%08x first in %d.%08x", curcpu, now->sec, (unsigned int)(now->frac >> 32), new.sec, (unsigned int)(new.frac >> 32)); @@ -531,7 +533,7 @@ configtimer(int start) if (start) { /* Initialize time machine parameters. */ next = now; - bintime_add(&next, &timerperiod); + bintime_addx(&next, timerperiod.frac); if (periodic) nexttick = next; else From owner-svn-src-head@FreeBSD.ORG Fri Aug 3 12:55:32 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4CAD0106567C; Fri, 3 Aug 2012 12:55:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 383E38FC21; Fri, 3 Aug 2012 12:55:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q73CtWri022062; Fri, 3 Aug 2012 12:55:32 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q73CtW8t022060; Fri, 3 Aug 2012 12:55:32 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201208031255.q73CtW8t022060@svn.freebsd.org> From: Alexander Motin Date: Fri, 3 Aug 2012 12:55:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239007 - head/sys/netgraph X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Aug 2012 12:55:32 -0000 Author: mav Date: Fri Aug 3 12:55:31 2012 New Revision: 239007 URL: http://svn.freebsd.org/changeset/base/239007 Log: Remove duplicate check. Submitted by: Dmitry Luhtionov Modified: head/sys/netgraph/ng_pptpgre.c Modified: head/sys/netgraph/ng_pptpgre.c ============================================================================== --- head/sys/netgraph/ng_pptpgre.c Fri Aug 3 11:22:09 2012 (r239006) +++ head/sys/netgraph/ng_pptpgre.c Fri Aug 3 12:55:31 2012 (r239007) @@ -562,7 +562,7 @@ ng_pptpgre_xmit(hpriv_p hpriv, item_p it } /* Sanity check frame length */ - if (m != NULL && m->m_pkthdr.len > PPTP_MAX_PAYLOAD) { + if (m->m_pkthdr.len > PPTP_MAX_PAYLOAD) { priv->stats.xmitTooBig++; ERROUT(EMSGSIZE); } From owner-svn-src-head@FreeBSD.ORG Fri Aug 3 13:50:29 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E20E2106564A; Fri, 3 Aug 2012 13:50:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CBD868FC0C; Fri, 3 Aug 2012 13:50:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q73DoTJs029270; Fri, 3 Aug 2012 13:50:29 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q73DoT8v029267; Fri, 3 Aug 2012 13:50:29 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201208031350.q73DoT8v029267@svn.freebsd.org> From: John Baldwin Date: Fri, 3 Aug 2012 13:50:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239008 - in head/sys: powerpc/powerpc x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Aug 2012 13:50:30 -0000 Author: jhb Date: Fri Aug 3 13:50:29 2012 New Revision: 239008 URL: http://svn.freebsd.org/changeset/base/239008 Log: Improve the handling of static DMA buffers that use non-default memory attributes (currently just BUS_DMA_NOCACHE): - Don't call pmap_change_attr() on the returned address, instead use kmem_alloc_contig() to ask the VM system for memory with the requested attribute. - As a result, always use kmem_alloc_contig() for non-default memory attributes, even for sub-page allocations. This requires adjusting bus_dmamem_free()'s logic for determining which free routine to use. - For x86, add a new dummy bus_dmamap that is used for static DMA buffers allocated via kmem_alloc_contig(). bus_dmamem_free() can then use the map pointer to determine which free routine to use. - For powerpc, add a new flag to the allocated map (bus_dmamem_alloc() always creates a real map on powerpc) to indicate which free routine should be used. Note that the BUS_DMA_NOCACHE handling in powerpc is currently #ifdef'd out. I have left it disabled but updated it to match x86. Reviewed by: scottl MFC after: 1 month Modified: head/sys/powerpc/powerpc/busdma_machdep.c head/sys/x86/x86/busdma_machdep.c Modified: head/sys/powerpc/powerpc/busdma_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/busdma_machdep.c Fri Aug 3 12:55:31 2012 (r239007) +++ head/sys/powerpc/powerpc/busdma_machdep.c Fri Aug 3 13:50:29 2012 (r239008) @@ -46,6 +46,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include @@ -130,6 +132,7 @@ struct bus_dmamap { bus_dmamap_callback_t *callback; void *callback_arg; STAILQ_ENTRY(bus_dmamap) links; + int contigalloc; }; static STAILQ_HEAD(, bus_dmamap) bounce_map_waitinglist; @@ -489,6 +492,7 @@ int bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, bus_dmamap_t *mapp) { + vm_memattr_t attr; int mflags; if (flags & BUS_DMA_NOWAIT) @@ -500,6 +504,12 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi if (flags & BUS_DMA_ZERO) mflags |= M_ZERO; +#ifdef NOTYET + if (flags & BUS_DMA_NOCACHE) + attr = VM_MEMATTR_UNCACHEABLE; + else +#endif + attr = VM_MEMATTR_DEFAULT; /* * XXX: @@ -511,7 +521,8 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi */ if ((dmat->maxsize <= PAGE_SIZE) && (dmat->alignment < dmat->maxsize) && - dmat->lowaddr >= ptoa((vm_paddr_t)Maxmem)) { + dmat->lowaddr >= ptoa((vm_paddr_t)Maxmem) && + attr == VM_MEMATTR_DEFAULT) { *vaddr = malloc(dmat->maxsize, M_DEVBUF, mflags); } else { /* @@ -520,9 +531,10 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi * multi-seg allocations yet though. * XXX Certain AGP hardware does. */ - *vaddr = contigmalloc(dmat->maxsize, M_DEVBUF, mflags, - 0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul, - dmat->boundary); + *vaddr = (void *)kmem_alloc_contig(kernel_map, dmat->maxsize, + mflags, 0ul, dmat->lowaddr, dmat->alignment ? + dmat->alignment : 1ul, dmat->boundary, attr); + (*mapp)->contigalloc = 1; } if (*vaddr == NULL) { CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", @@ -531,11 +543,6 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi } else if (vtophys(*vaddr) & (dmat->alignment - 1)) { printf("bus_dmamem_alloc failed to align memory properly.\n"); } -#ifdef NOTYET - if (flags & BUS_DMA_NOCACHE) - pmap_change_attr((vm_offset_t)*vaddr, dmat->maxsize, - VM_MEMATTR_UNCACHEABLE); -#endif CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", __func__, dmat, dmat->flags, 0); return (0); @@ -548,18 +555,12 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi void bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) { - bus_dmamap_destroy(dmat, map); -#ifdef NOTYET - pmap_change_attr((vm_offset_t)vaddr, dmat->maxsize, VM_MEMATTR_DEFAULT); -#endif - if ((dmat->maxsize <= PAGE_SIZE) && - (dmat->alignment < dmat->maxsize) && - dmat->lowaddr >= ptoa((vm_paddr_t)Maxmem)) + if (!map->contigalloc) free(vaddr, M_DEVBUF); - else { - contigfree(vaddr, dmat->maxsize, M_DEVBUF); - } + else + kmem_free(kernel_map, (vm_offset_t)vaddr, dmat->maxsize); + bus_dmamap_destroy(dmat, map); CTR3(KTR_BUSDMA, "%s: tag %p flags 0x%x", __func__, dmat, dmat->flags); } Modified: head/sys/x86/x86/busdma_machdep.c ============================================================================== --- head/sys/x86/x86/busdma_machdep.c Fri Aug 3 12:55:31 2012 (r239007) +++ head/sys/x86/x86/busdma_machdep.c Fri Aug 3 13:50:29 2012 (r239008) @@ -42,6 +42,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include @@ -131,7 +133,7 @@ struct bus_dmamap { static STAILQ_HEAD(, bus_dmamap) bounce_map_waitinglist; static STAILQ_HEAD(, bus_dmamap) bounce_map_callbacklist; -static struct bus_dmamap nobounce_dmamap; +static struct bus_dmamap nobounce_dmamap, contig_dmamap; static void init_bounce_pages(void *dummy); static int alloc_bounce_zone(bus_dma_tag_t dmat); @@ -465,7 +467,7 @@ bus_dmamap_create(bus_dma_tag_t dmat, in int bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map) { - if (map != NULL && map != &nobounce_dmamap) { + if (map != NULL && map != &nobounce_dmamap && map != &contig_dmamap) { if (STAILQ_FIRST(&map->bpages) != NULL) { CTR3(KTR_BUSDMA, "%s: tag %p error %d", __func__, dmat, EBUSY); @@ -490,6 +492,7 @@ int bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, bus_dmamap_t *mapp) { + vm_memattr_t attr; int mflags; if (flags & BUS_DMA_NOWAIT) @@ -512,6 +515,10 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi } if (flags & BUS_DMA_ZERO) mflags |= M_ZERO; + if (flags & BUS_DMA_NOCACHE) + attr = VM_MEMATTR_UNCACHEABLE; + else + attr = VM_MEMATTR_DEFAULT; /* * XXX: @@ -523,7 +530,8 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi */ if ((dmat->maxsize <= PAGE_SIZE) && (dmat->alignment < dmat->maxsize) && - dmat->lowaddr >= ptoa((vm_paddr_t)Maxmem)) { + dmat->lowaddr >= ptoa((vm_paddr_t)Maxmem) && + attr == VM_MEMATTR_DEFAULT) { *vaddr = malloc(dmat->maxsize, M_DEVBUF, mflags); } else { /* @@ -532,9 +540,10 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi * multi-seg allocations yet though. * XXX Certain AGP hardware does. */ - *vaddr = contigmalloc(dmat->maxsize, M_DEVBUF, mflags, - 0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul, - dmat->boundary); + *vaddr = (void *)kmem_alloc_contig(kernel_map, dmat->maxsize, + mflags, 0ul, dmat->lowaddr, dmat->alignment ? + dmat->alignment : 1ul, dmat->boundary, attr); + *mapp = &contig_dmamap; } if (*vaddr == NULL) { CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", @@ -543,9 +552,6 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi } else if (vtophys(*vaddr) & (dmat->alignment - 1)) { printf("bus_dmamem_alloc failed to align memory properly.\n"); } - if (flags & BUS_DMA_NOCACHE) - pmap_change_attr((vm_offset_t)*vaddr, dmat->maxsize, - PAT_UNCACHEABLE); CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", __func__, dmat, dmat->flags, 0); return (0); @@ -560,18 +566,15 @@ bus_dmamem_free(bus_dma_tag_t dmat, void { /* * dmamem does not need to be bounced, so the map should be - * NULL + * NULL if malloc() was used and contig_dmamap if + * contigmalloc() was used. */ - if (map != NULL) + if (!(map == NULL || map == &contig_dmamap)) panic("bus_dmamem_free: Invalid map freed\n"); - pmap_change_attr((vm_offset_t)vaddr, dmat->maxsize, PAT_WRITE_BACK); - if ((dmat->maxsize <= PAGE_SIZE) && - (dmat->alignment < dmat->maxsize) && - dmat->lowaddr >= ptoa((vm_paddr_t)Maxmem)) + if (map == NULL) free(vaddr, M_DEVBUF); - else { - contigfree(vaddr, dmat->maxsize, M_DEVBUF); - } + else + kmem_free(kernel_map, (vm_offset_t)vaddr, dmat->maxsize); CTR3(KTR_BUSDMA, "%s: tag %p flags 0x%x", __func__, dmat, dmat->flags); } @@ -662,7 +665,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm vm_offset_t vaddr; int seg, error; - if (map == NULL) + if (map == NULL || map == &contig_dmamap) map = &nobounce_dmamap; if ((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0) { @@ -1139,7 +1142,7 @@ add_bounce_page(bus_dma_tag_t dmat, bus_ struct bounce_page *bpage; KASSERT(dmat->bounce_zone != NULL, ("no bounce zone in dma tag")); - KASSERT(map != NULL && map != &nobounce_dmamap, + KASSERT(map != NULL && map != &nobounce_dmamap && map != &contig_dmamap, ("add_bounce_page: bad map %p", map)); bz = dmat->bounce_zone; From owner-svn-src-head@FreeBSD.ORG Fri Aug 3 14:00:27 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 76BCA106564A; Fri, 3 Aug 2012 14:00:27 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 61B8B8FC0C; Fri, 3 Aug 2012 14:00:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q73E0Rq9030548; Fri, 3 Aug 2012 14:00:27 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q73E0Rmo030546; Fri, 3 Aug 2012 14:00:27 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201208031400.q73E0Rmo030546@svn.freebsd.org> From: Luigi Rizzo Date: Fri, 3 Aug 2012 14:00:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239009 - head/sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Aug 2012 14:00:27 -0000 Author: luigi Date: Fri Aug 3 14:00:26 2012 New Revision: 239009 URL: http://svn.freebsd.org/changeset/base/239009 Log: support building vtnet as an embedded driver Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Aug 3 13:50:29 2012 (r239008) +++ head/sys/conf/files Fri Aug 3 14:00:26 2012 (r239009) @@ -2210,6 +2210,16 @@ dev/utopia/idtphy.c optional utopia dev/utopia/suni.c optional utopia dev/utopia/utopia.c optional utopia dev/vge/if_vge.c optional vge +# +# virtio support +# +dev/virtio/pci/virtio_pci.c optional vtnet +dev/virtio/virtio.c optional vtnet +dev/virtio/virtqueue.c optional vtnet +dev/virtio/network/if_vtnet.c optional vtnet +dev/virtio/virtio_bus_if.m optional vtnet +dev/virtio/virtio_if.m optional vtnet + dev/vkbd/vkbd.c optional vkbd dev/vr/if_vr.c optional vr pci dev/vte/if_vte.c optional vte pci From owner-svn-src-head@FreeBSD.ORG Fri Aug 3 14:25:36 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A8C6106564A; Fri, 3 Aug 2012 14:25:36 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 463138FC08; Fri, 3 Aug 2012 14:25:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q73EPavW032993; Fri, 3 Aug 2012 14:25:36 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q73EPaLO032991; Fri, 3 Aug 2012 14:25:36 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201208031425.q73EPaLO032991@svn.freebsd.org> From: Matt Jacob Date: Fri, 3 Aug 2012 14:25:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239010 - head/sys/dev/isp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Aug 2012 14:25:36 -0000 Author: mjacob Date: Fri Aug 3 14:25:35 2012 New Revision: 239010 URL: http://svn.freebsd.org/changeset/base/239010 Log: Oops. We only do allocate room for extended commands and responses for 2300 cards are newer. Sponsored by: Spectralogic Noticed by: Our Friend Manfred MFC after: 1 month X-MFC: 238869 Modified: head/sys/dev/isp/isp_pci.c Modified: head/sys/dev/isp/isp_pci.c ============================================================================== --- head/sys/dev/isp/isp_pci.c Fri Aug 3 14:00:26 2012 (r239009) +++ head/sys/dev/isp/isp_pci.c Fri Aug 3 14:25:35 2012 (r239010) @@ -1482,16 +1482,18 @@ imc(void *arg, bus_dma_segment_t *segs, segs->ds_addr += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(imushp->isp)); imushp->vbase += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(imushp->isp)); - imushp->isp->isp_osinfo.ecmd_dma = segs->ds_addr; - imushp->isp->isp_osinfo.ecmd_free = (isp_ecmd_t *)imushp->vbase; - imushp->isp->isp_osinfo.ecmd_base = imushp->isp->isp_osinfo.ecmd_free; - for (ecmd = imushp->isp->isp_osinfo.ecmd_free; ecmd < &imushp->isp->isp_osinfo.ecmd_free[N_XCMDS]; ecmd++) { - if (ecmd == &imushp->isp->isp_osinfo.ecmd_free[N_XCMDS - 1]) { - ecmd->next = NULL; - } else { - ecmd->next = ecmd + 1; - } - } + if (imushp->isp->isp_type >= ISP_HA_FC_2300) { + imushp->isp->isp_osinfo.ecmd_dma = segs->ds_addr; + imushp->isp->isp_osinfo.ecmd_free = (isp_ecmd_t *)imushp->vbase; + imushp->isp->isp_osinfo.ecmd_base = imushp->isp->isp_osinfo.ecmd_free; + for (ecmd = imushp->isp->isp_osinfo.ecmd_free; ecmd < &imushp->isp->isp_osinfo.ecmd_free[N_XCMDS]; ecmd++) { + if (ecmd == &imushp->isp->isp_osinfo.ecmd_free[N_XCMDS - 1]) { + ecmd->next = NULL; + } else { + ecmd->next = ecmd + 1; + } + } + } #ifdef ISP_TARGET_MODE segs->ds_addr += (N_XCMDS * XCMD_SIZE); imushp->vbase += (N_XCMDS * XCMD_SIZE); From owner-svn-src-head@FreeBSD.ORG Fri Aug 3 14:55:36 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE69D106566B; Fri, 3 Aug 2012 14:55:36 +0000 (UTC) (envelope-from thomas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9EB2E8FC08; Fri, 3 Aug 2012 14:55:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q73EtauI035433; Fri, 3 Aug 2012 14:55:36 GMT (envelope-from thomas@svn.freebsd.org) Received: (from thomas@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q73Etast035428; Fri, 3 Aug 2012 14:55:36 GMT (envelope-from thomas@svn.freebsd.org) Message-Id: <201208031455.q73Etast035428@svn.freebsd.org> From: Thomas Quinot Date: Fri, 3 Aug 2012 14:55:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239012 - in head: sbin/geom/class/multipath sys/geom/multipath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Aug 2012 14:55:37 -0000 Author: thomas Date: Fri Aug 3 14:55:35 2012 New Revision: 239012 URL: http://svn.freebsd.org/changeset/base/239012 Log: New command "gmultipath prefer" to force selection of a specified provider in an Active/Passive configuration. Reviewed by: mav MFC after: 4 weeks Modified: head/sbin/geom/class/multipath/geom_multipath.c head/sbin/geom/class/multipath/gmultipath.8 head/sys/geom/multipath/g_multipath.c Modified: head/sbin/geom/class/multipath/geom_multipath.c ============================================================================== --- head/sbin/geom/class/multipath/geom_multipath.c Fri Aug 3 14:49:18 2012 (r239011) +++ head/sbin/geom/class/multipath/geom_multipath.c Fri Aug 3 14:55:35 2012 (r239012) @@ -49,6 +49,7 @@ uint32_t version = G_MULTIPATH_VERSION; static void mp_main(struct gctl_req *, unsigned int); static void mp_label(struct gctl_req *); static void mp_clear(struct gctl_req *); +static void mp_prefer(struct gctl_req *); struct g_command class_commands[] = { { @@ -87,6 +88,10 @@ struct g_command class_commands[] = { "[-v] name prov" }, { + "prefer", G_FLAG_VERBOSE, mp_main, G_NULL_OPTS, + "[-v] prov ..." + }, + { "fail", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, "[-v] name prov" }, @@ -131,6 +136,8 @@ mp_main(struct gctl_req *req, unsigned i mp_label(req); } else if (strcmp(name, "clear") == 0) { mp_clear(req); + } else if (strcmp(name, "prefer") == 0) { + mp_prefer(req); } else { gctl_error(req, "Unknown command: %s.", name); } @@ -294,3 +301,22 @@ mp_clear(struct gctl_req *req) } } +static void +mp_prefer(struct gctl_req *req) +{ + const char *name, *comp, *errstr; + int nargs; + + nargs = gctl_get_int(req, "nargs"); + if (nargs != 2) { + gctl_error(req, "Usage: prefer GEOM PROVIDER"); + return; + } + name = gctl_get_ascii(req, "arg0"); + comp = gctl_get_ascii(req, "arg1"); + errstr = gctl_issue (req); + if (errstr != NULL) { + fprintf(stderr, "Can't set %s preferred provider to %s: %s.\n", + name, comp, errstr); + } +} Modified: head/sbin/geom/class/multipath/gmultipath.8 ============================================================================== --- head/sbin/geom/class/multipath/gmultipath.8 Fri Aug 3 14:49:18 2012 (r239011) +++ head/sbin/geom/class/multipath/gmultipath.8 Fri Aug 3 14:55:35 2012 (r239012) @@ -66,6 +66,11 @@ .Op Fl v .Ar name .Nm +.Cm prefer +.Op Fl v +.Ar name +.Ar prov +.Nm .Cm getactive .Op Fl v .Ar name @@ -171,7 +176,9 @@ If there are other paths present, new re Mark specified provider as a path of the specified multipath device as operational, allowing it to handle requests. .It Cm rotate -Change the active provider/path in Active/Passive mode. +Change the active provider/path to the next available provider in Active/Passive mode. +.It Cm prefer +Change the active provider/path to the specified provider in Active/Passive mode. .It Cm getactive Get the currently active provider(s)/path(s). .It Cm destroy Modified: head/sys/geom/multipath/g_multipath.c ============================================================================== --- head/sys/geom/multipath/g_multipath.c Fri Aug 3 14:49:18 2012 (r239011) +++ head/sys/geom/multipath/g_multipath.c Fri Aug 3 14:55:35 2012 (r239012) @@ -849,6 +849,78 @@ g_multipath_ctl_add_name(struct gctl_req } static void +g_multipath_ctl_prefer(struct gctl_req *req, struct g_class *mp) +{ + struct g_geom *gp; + struct g_multipath_softc *sc; + struct g_consumer *cp; + const char *name, *mpname; + static const char devpf[6] = "/dev/"; + int *nargs; + + g_topology_assert(); + + mpname = gctl_get_asciiparam(req, "arg0"); + if (mpname == NULL) { + gctl_error(req, "No 'arg0' argument"); + return; + } + gp = g_multipath_find_geom(mp, mpname); + if (gp == NULL) { + gctl_error(req, "Device %s is invalid", mpname); + return; + } + sc = gp->softc; + + nargs = gctl_get_paraml(req, "nargs", sizeof(*nargs)); + if (nargs == NULL) { + gctl_error(req, "No 'nargs' argument"); + return; + } + if (*nargs != 2) { + gctl_error(req, "missing device"); + return; + } + + name = gctl_get_asciiparam(req, "arg1"); + if (name == NULL) { + gctl_error(req, "No 'arg1' argument"); + return; + } + if (strncmp(name, devpf, 5) == 0) { + name += 5; + } + + LIST_FOREACH(cp, &gp->consumer, consumer) { + if (cp->provider != NULL + && strcmp(cp->provider->name, name) == 0) + break; + } + + if (cp == NULL) { + gctl_error(req, "Provider %s not found", name); + return; + } + + mtx_lock(&sc->sc_mtx); + + if (cp->index & MP_BAD) { + gctl_error(req, "Consumer %s is invalid", name); + mtx_unlock(&sc->sc_mtx); + return; + } + + /* Here when the consumer is present and in good shape */ + + sc->sc_active = cp; + if (!sc->sc_active_active) + printf("GEOM_MULTIPATH: %s now active path in %s\n", + sc->sc_active->provider->name, sc->sc_name); + + mtx_unlock(&sc->sc_mtx); +} + +static void g_multipath_ctl_add(struct gctl_req *req, struct g_class *mp) { struct g_multipath_softc *sc; @@ -1278,6 +1350,8 @@ g_multipath_config(struct gctl_req *req, gctl_error(req, "Userland and kernel parts are out of sync"); } else if (strcmp(verb, "add") == 0) { g_multipath_ctl_add(req, mp); + } else if (strcmp(verb, "prefer") == 0) { + g_multipath_ctl_prefer(req, mp); } else if (strcmp(verb, "create") == 0) { g_multipath_ctl_create(req, mp); } else if (strcmp(verb, "configure") == 0) { From owner-svn-src-head@FreeBSD.ORG Fri Aug 3 15:20:00 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F07E106566C; Fri, 3 Aug 2012 15:20:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E4FA8FC08; Fri, 3 Aug 2012 15:20:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q73FK0aK037465; Fri, 3 Aug 2012 15:20:00 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q73FK0mt037463; Fri, 3 Aug 2012 15:20:00 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201208031520.q73FK0mt037463@svn.freebsd.org> From: Alexander Motin Date: Fri, 3 Aug 2012 15:20:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239013 - head/sys/x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Aug 2012 15:20:00 -0000 Author: mav Date: Fri Aug 3 15:19:59 2012 New Revision: 239013 URL: http://svn.freebsd.org/changeset/base/239013 Log: Microoptimize LAPIC timer routines to avoid reading from hardware during programming using earlier cached values. This makes respective routines to disappear from PMC top and reduces total number of active CPU cycles on idle 24-core system by 10%. Modified: head/sys/x86/x86/local_apic.c Modified: head/sys/x86/x86/local_apic.c ============================================================================== --- head/sys/x86/x86/local_apic.c Fri Aug 3 14:55:35 2012 (r239012) +++ head/sys/x86/x86/local_apic.c Fri Aug 3 15:19:59 2012 (r239013) @@ -119,6 +119,7 @@ struct lapic { u_long *la_timer_count; u_long la_timer_period; u_int la_timer_mode; + uint32_t lvt_timer_cache; /* Include IDT_SYSCALL to make indexing easier. */ int la_ioint_irqs[APIC_NUM_IOINTS + 1]; } static lapics[MAX_APIC_ID + 1]; @@ -160,9 +161,11 @@ static struct eventtimer lapic_et; static void lapic_enable(void); static void lapic_resume(struct pic *pic); -static void lapic_timer_oneshot(u_int count, int enable_int); -static void lapic_timer_periodic(u_int count, int enable_int); -static void lapic_timer_stop(void); +static void lapic_timer_oneshot(struct lapic *, + u_int count, int enable_int); +static void lapic_timer_periodic(struct lapic *, + u_int count, int enable_int); +static void lapic_timer_stop(struct lapic *); static void lapic_timer_set_divisor(u_int divisor); static uint32_t lvt_mode(struct lapic *la, u_int pin, uint32_t value); static int lapic_et_start(struct eventtimer *et, @@ -370,7 +373,8 @@ lapic_setup(int boot) lapic->lvt_pcint = lvt_mode(la, LVT_PMC, lapic->lvt_pcint); /* Program timer LVT and setup handler. */ - lapic->lvt_timer = lvt_mode(la, LVT_TIMER, lapic->lvt_timer); + la->lvt_timer_cache = lapic->lvt_timer = + lvt_mode(la, LVT_TIMER, lapic->lvt_timer); if (boot) { snprintf(buf, sizeof(buf), "cpu%d:timer", PCPU_GET(cpuid)); intrcnt_add(buf, &la->la_timer_count); @@ -382,9 +386,9 @@ lapic_setup(int boot) lapic_id())); lapic_timer_set_divisor(lapic_timer_divisor); if (la->la_timer_mode == 1) - lapic_timer_periodic(la->la_timer_period, 1); + lapic_timer_periodic(la, la->la_timer_period, 1); else - lapic_timer_oneshot(la->la_timer_period, 1); + lapic_timer_oneshot(la, la->la_timer_period, 1); } /* Program error LVT and clear any existing errors. */ @@ -489,13 +493,14 @@ lapic_et_start(struct eventtimer *et, struct lapic *la; u_long value; + la = &lapics[PCPU_GET(apic_id)]; if (et->et_frequency == 0) { /* Start off with a divisor of 2 (power on reset default). */ lapic_timer_divisor = 2; /* Try to calibrate the local APIC timer. */ do { lapic_timer_set_divisor(lapic_timer_divisor); - lapic_timer_oneshot(APIC_TIMER_MAX_COUNT, 0); + lapic_timer_oneshot(la, APIC_TIMER_MAX_COUNT, 0); DELAY(1000000); value = APIC_TIMER_MAX_COUNT - lapic->ccr_timer; if (value != APIC_TIMER_MAX_COUNT) @@ -515,22 +520,22 @@ lapic_et_start(struct eventtimer *et, et->et_max_period.frac = ((0xfffffffeLLU << 32) / et->et_frequency) << 32; } - lapic_timer_set_divisor(lapic_timer_divisor); - la = &lapics[lapic_id()]; + if (la->la_timer_mode == 0) + lapic_timer_set_divisor(lapic_timer_divisor); if (period != NULL) { la->la_timer_mode = 1; la->la_timer_period = (et->et_frequency * (period->frac >> 32)) >> 32; if (period->sec != 0) la->la_timer_period += et->et_frequency * period->sec; - lapic_timer_periodic(la->la_timer_period, 1); + lapic_timer_periodic(la, la->la_timer_period, 1); } else { la->la_timer_mode = 2; la->la_timer_period = (et->et_frequency * (first->frac >> 32)) >> 32; if (first->sec != 0) la->la_timer_period += et->et_frequency * first->sec; - lapic_timer_oneshot(la->la_timer_period, 1); + lapic_timer_oneshot(la, la->la_timer_period, 1); } return (0); } @@ -538,10 +543,10 @@ lapic_et_start(struct eventtimer *et, static int lapic_et_stop(struct eventtimer *et) { - struct lapic *la = &lapics[lapic_id()]; + struct lapic *la = &lapics[PCPU_GET(apic_id)]; la->la_timer_mode = 0; - lapic_timer_stop(); + lapic_timer_stop(la); return (0); } @@ -835,11 +840,11 @@ lapic_timer_set_divisor(u_int divisor) } static void -lapic_timer_oneshot(u_int count, int enable_int) +lapic_timer_oneshot(struct lapic *la, u_int count, int enable_int) { u_int32_t value; - value = lapic->lvt_timer; + value = la->lvt_timer_cache; value &= ~APIC_LVTT_TM; value |= APIC_LVTT_TM_ONE_SHOT; if (enable_int) @@ -849,11 +854,11 @@ lapic_timer_oneshot(u_int count, int ena } static void -lapic_timer_periodic(u_int count, int enable_int) +lapic_timer_periodic(struct lapic *la, u_int count, int enable_int) { u_int32_t value; - value = lapic->lvt_timer; + value = la->lvt_timer_cache; value &= ~APIC_LVTT_TM; value |= APIC_LVTT_TM_PERIODIC; if (enable_int) @@ -863,11 +868,11 @@ lapic_timer_periodic(u_int count, int en } static void -lapic_timer_stop(void) +lapic_timer_stop(struct lapic *la) { u_int32_t value; - value = lapic->lvt_timer; + value = la->lvt_timer_cache; value &= ~APIC_LVTT_TM; value |= APIC_LVT_M; lapic->lvt_timer = value; From owner-svn-src-head@FreeBSD.ORG Fri Aug 3 16:32:16 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DA5EC106564A; Fri, 3 Aug 2012 16:32:16 +0000 (UTC) (envelope-from maksim.yevmenkin@gmail.com) Received: from mail-qa0-f47.google.com (mail-qa0-f47.google.com [209.85.216.47]) by mx1.freebsd.org (Postfix) with ESMTP id 386F38FC08; Fri, 3 Aug 2012 16:32:16 +0000 (UTC) Received: by qabg1 with SMTP id g1so4893074qab.13 for ; Fri, 03 Aug 2012 09:32: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 :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=YpugCGgsnxigWQJZBt5fxmIXxd1EBztWx16mWB71KlA=; b=ck9qOsuGlD60gdDvTbMrkMcpVSpGwK/QjM2gcc2mfHIVAx7d2xVqLxQcq2B02tzk0y Zxa/PPWdftnodXABGfKF2s5yg5J3g6xv9SiTQ8DgeH931MsvmSgrVYbxmIDS5tLQnLrj uDcSPK/PgDgRcu/o0VQOV9ANclugqKOVXlfCd0UfnWMfOJXNXFP8DOpOjRaB8b+HW8VP v95B5wf8eaNOFmxtKZWQ6d4G5aVcYSyEwLaJYFtrDrZzc6QTsgcFH7NqMg5UsJj/a8Q4 L6m7BNPQEN6rbRZ0cFcQRn9NuwVa7GYoMcdEZ2+OWI/ESQCZdOEluh9Kaa3JRNq/ERdp vBAg== MIME-Version: 1.0 Received: by 10.224.39.204 with SMTP id h12mr3698952qae.52.1344011535632; Fri, 03 Aug 2012 09:32:15 -0700 (PDT) Sender: maksim.yevmenkin@gmail.com Received: by 10.224.216.72 with HTTP; Fri, 3 Aug 2012 09:32:15 -0700 (PDT) In-Reply-To: <501B8934.90908@zonov.org> References: <201207191536.q6JFabOR094467@svn.freebsd.org> <20120803.055554.1380323232583218022.hrs@allbsd.org> <501AF66A.8020804@FreeBSD.org> <501B8934.90908@zonov.org> Date: Fri, 3 Aug 2012 09:32:15 -0700 X-Google-Sender-Auth: xcLFXZ91YgxTAO8BrzR22YCd-o8 Message-ID: From: Maksim Yevmenkin To: Andrey Zonov Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Doug Barton , src-committers@freebsd.org, Hiroki Sato Subject: Re: svn commit: r238622 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Aug 2012 16:32:17 -0000 On Fri, Aug 3, 2012 at 1:17 AM, Andrey Zonov wrote: > On 8/3/12 2:22 AM, Maksim Yevmenkin wrote: >>> >>> >>>> i just wanted to make sure that there is a way to absolutely make sure >>>> that there is no default address selection policy installed. the wide >>>> know rule 9 of rfc 3484 is really messing things up for dns-style load >>>> balancing. even when ipv6 is not used. > > Did you try an empty config file? no, but it would not matter. please see my commit to libc, i.e. http://svnweb.FreeBSD.org/base?view=revision&revision=238599 before that, results were still sorted according to the rule 9. the only "hidden" sorting that remains in libc is that if name resolution contains both AAAA and A records, AAAA records are put before A records, and, thus, get preferred. however, records order with in a particular group (AAAA or A) should be unchanged. application has control over this by giving desired family to getaddrinfo(). it is reasonable, imo, to return AAAA records when application uses AF_UNSPEC. >>> Maksim, can you say more about this? Or point me to a reference that has >>> the discussion? >> >> of course :) we have ipv4 systems in production that make use of >> getaddrinfo(3) api. when a particular dns name is resolved, and, >> multiple A records are returned, the results get sorted according to >> the "default" address selection policy. rfc3484 has a set of rules >> according to which results should be sorted. all of the rules do not >> apply in our case, except one - the rule #9. the idea is that ipv4 >> addresses are "converted" to ipv6 addresses and then longest prefix >> match sorting is applied. in other words, if your system ip address >> happens to share high bits with the ip address from the A record, the >> IP address from the A record will always be preferred. of course, >> longest prefix match is performed without any extra information such >> as netmask and/or cidr. it really is just matching high bits of the >> address. >> >> so, what we found out, is that some systems tend to favor a particular >> ip address (from a bunch of ip addresses returned by name resolution) >> because 4 high bits were the same. basically, round-robin dns was >> completely shot. > > > RFC3484 completely breaks round-robin DNS. It's clearly that rule #9 should > not apply if resolved name has only A records. That problem was discussed > many times at ietf.org, but authors don't want to understand people. For > example, for us the problem will be huge when Windows users will update > their systems. yes, it does :) but it does not have to be :) yes, sometimes application has to change, but it ok, imo. > PS: It would be very useful to have a chance to turn off rule #9 in FreeBSD. well, may be. my commits to libc and ip6addrctl rc script address our particular problem and, hopefully, do not break things and/or introduce unwanted/unexpected behavior thanks max From owner-svn-src-head@FreeBSD.ORG Fri Aug 3 17:04:42 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 474581065670; Fri, 3 Aug 2012 17:04:42 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 265A98FC18; Fri, 3 Aug 2012 17:04:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q73H4gRl047910; Fri, 3 Aug 2012 17:04:42 GMT (envelope-from kan@svn.freebsd.org) Received: (from kan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q73H4fW1047908; Fri, 3 Aug 2012 17:04:41 GMT (envelope-from kan@svn.freebsd.org) Message-Id: <201208031704.q73H4fW1047908@svn.freebsd.org> From: Alexander Kabaev Date: Fri, 3 Aug 2012 17:04:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239019 - head/libexec/rtld-elf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Aug 2012 17:04:42 -0000 Author: kan Date: Fri Aug 3 17:04:41 2012 New Revision: 239019 URL: http://svn.freebsd.org/changeset/base/239019 Log: Parse notes only after object structure had been allocated. Reported by: kargl Reviewed by: kib (sans whitespace) Modified: head/libexec/rtld-elf/map_object.c Modified: head/libexec/rtld-elf/map_object.c ============================================================================== --- head/libexec/rtld-elf/map_object.c Fri Aug 3 16:18:20 2012 (r239018) +++ head/libexec/rtld-elf/map_object.c Fri Aug 3 17:04:41 2012 (r239019) @@ -153,7 +153,6 @@ map_object(int fd, const char *path, con break; note_start = (Elf_Addr)(char *)hdr + phdr->p_offset; note_end = note_start + phdr->p_filesz; - digest_notes(obj, note_start, note_end); break; } @@ -291,7 +290,8 @@ map_object(int fd, const char *path, con obj->stack_flags = stack_flags; obj->relro_page = obj->relocbase + trunc_page(relro_page); obj->relro_size = round_page(relro_size); - + if (note_start < note_end) + digest_notes(obj, note_start, note_end); munmap(hdr, PAGE_SIZE); return (obj); From owner-svn-src-head@FreeBSD.ORG Fri Aug 3 18:40:45 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 965121065675; Fri, 3 Aug 2012 18:40:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 828678FC15; Fri, 3 Aug 2012 18:40:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q73Iej74056316; Fri, 3 Aug 2012 18:40:45 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q73Iej9L056314; Fri, 3 Aug 2012 18:40:45 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201208031840.q73Iej9L056314@svn.freebsd.org> From: John Baldwin Date: Fri, 3 Aug 2012 18:40:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239020 - head/sys/x86/x86 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Aug 2012 18:40:45 -0000 Author: jhb Date: Fri Aug 3 18:40:44 2012 New Revision: 239020 URL: http://svn.freebsd.org/changeset/base/239020 Log: Correct function name in comment. Submitted by: alc Modified: head/sys/x86/x86/busdma_machdep.c Modified: head/sys/x86/x86/busdma_machdep.c ============================================================================== --- head/sys/x86/x86/busdma_machdep.c Fri Aug 3 17:04:41 2012 (r239019) +++ head/sys/x86/x86/busdma_machdep.c Fri Aug 3 18:40:44 2012 (r239020) @@ -567,7 +567,7 @@ bus_dmamem_free(bus_dma_tag_t dmat, void /* * dmamem does not need to be bounced, so the map should be * NULL if malloc() was used and contig_dmamap if - * contigmalloc() was used. + * kmem_alloc_contig() was used. */ if (!(map == NULL || map == &contig_dmamap)) panic("bus_dmamem_free: Invalid map freed\n"); From owner-svn-src-head@FreeBSD.ORG Fri Aug 3 20:24:17 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 597B7106566B; Fri, 3 Aug 2012 20:24:17 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 443F08FC12; Fri, 3 Aug 2012 20:24:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q73KOHUB065070; Fri, 3 Aug 2012 20:24:17 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q73KOHCE065067; Fri, 3 Aug 2012 20:24:17 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201208032024.q73KOHCE065067@svn.freebsd.org> From: Jim Harris Date: Fri, 3 Aug 2012 20:24:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239021 - head/sys/geom/virstor X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Aug 2012 20:24:17 -0000 Author: jimharris Date: Fri Aug 3 20:24:16 2012 New Revision: 239021 URL: http://svn.freebsd.org/changeset/base/239021 Log: In virstor_ctl_stop(), check for a valid softc before trying to update metadata. Sponsored by: Intel Reported and tested by: Marcelo Gondim PR: kern/170199 MFC after: 3 days Modified: head/sys/geom/virstor/g_virstor.c Modified: head/sys/geom/virstor/g_virstor.c ============================================================================== --- head/sys/geom/virstor/g_virstor.c Fri Aug 3 18:40:44 2012 (r239020) +++ head/sys/geom/virstor/g_virstor.c Fri Aug 3 20:24:16 2012 (r239021) @@ -235,6 +235,12 @@ virstor_ctl_stop(struct gctl_req *req, s return; } sc = virstor_find_geom(cp, name); + if (sc == NULL) { + gctl_error(req, "Don't know anything about '%s'", name); + g_topology_unlock(); + return; + } + LOG_MSG(LVL_INFO, "Stopping %s by the userland command", sc->geom->name); update_metadata(sc); From owner-svn-src-head@FreeBSD.ORG Fri Aug 3 20:30:40 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BD8EA1065678; Fri, 3 Aug 2012 20:30:40 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A81598FC08; Fri, 3 Aug 2012 20:30:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q73KUehf065729; Fri, 3 Aug 2012 20:30:40 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q73KUeYb065727; Fri, 3 Aug 2012 20:30:40 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201208032030.q73KUeYb065727@svn.freebsd.org> From: Jim Harris Date: Fri, 3 Aug 2012 20:30:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239022 - head/sbin/geom/class/virstor X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 03 Aug 2012 20:30:40 -0000 Author: jimharris Date: Fri Aug 3 20:30:40 2012 New Revision: 239022 URL: http://svn.freebsd.org/changeset/base/239022 Log: Document "destroy" as an alias for "stop". Modified: head/sbin/geom/class/virstor/gvirstor.8 Modified: head/sbin/geom/class/virstor/gvirstor.8 ============================================================================== --- head/sbin/geom/class/virstor/gvirstor.8 Fri Aug 3 20:24:16 2012 (r239021) +++ head/sbin/geom/class/virstor/gvirstor.8 Fri Aug 3 20:30:40 2012 (r239022) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 24, 2011 +.Dd August 3, 2012 .Dt GVIRSTOR 8 .Os .Sh NAME @@ -43,6 +43,10 @@ .Op Fl fv .Ar name ... .Nm +.Cm destroy +.Op Fl fv +.Ar name ... +.Nm .Cm add .Op Fl vh .Ar name prov ... @@ -107,6 +111,9 @@ Turn off an existing virtual device with .Ar name . This command does not touch on-disk metadata. As with other GEOM classes, stopped geoms cannot be started manually. +.It Cm destroy +Same as +.Cm stop. .It Cm add Adds new components to existing virtual device with the given .Ar name . From owner-svn-src-head@FreeBSD.ORG Sat Aug 4 00:00:31 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1BF6A1065673; Sat, 4 Aug 2012 00:00:31 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F07918FC08; Sat, 4 Aug 2012 00:00:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7400UXj084675; Sat, 4 Aug 2012 00:00:30 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7400UT9084673; Sat, 4 Aug 2012 00:00:30 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201208040000.q7400UT9084673@svn.freebsd.org> From: Matt Jacob Date: Sat, 4 Aug 2012 00:00:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239023 - head/sys/dev/isp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 04 Aug 2012 00:00:31 -0000 Author: mjacob Date: Sat Aug 4 00:00:30 2012 New Revision: 239023 URL: http://svn.freebsd.org/changeset/base/239023 Log: Add detach logic to SBus variant. Obtained from: Marius MFC after: 1 month Modified: head/sys/dev/isp/isp_sbus.c Modified: head/sys/dev/isp/isp_sbus.c ============================================================================== --- head/sys/dev/isp/isp_sbus.c Fri Aug 3 20:30:40 2012 (r239022) +++ head/sys/dev/isp/isp_sbus.c Sat Aug 4 00:00:30 2012 (r239023) @@ -78,19 +78,22 @@ static struct ispmdvec mdvec = { static int isp_sbus_probe (device_t); static int isp_sbus_attach (device_t); +static int isp_sbus_detach (device_t); #define ISP_SBD(isp) ((struct isp_sbussoftc *)isp)->sbus_dev struct isp_sbussoftc { ispsoftc_t sbus_isp; device_t sbus_dev; - struct resource * sbus_reg; + struct resource * regs; + void * irq; + int iqd; + int rgd; void * ih; int16_t sbus_poff[_NREG_BLKS]; sdparam sbus_param; struct isp_spi sbus_spi; struct ispmdvec sbus_mdvec; - struct resource * sbus_ires; }; @@ -98,6 +101,7 @@ static device_method_t isp_sbus_methods[ /* Device interface */ DEVMETHOD(device_probe, isp_sbus_probe), DEVMETHOD(device_attach, isp_sbus_attach), + DEVMETHOD(device_detach, isp_sbus_detach), { 0, 0 } }; @@ -136,13 +140,21 @@ isp_sbus_probe(device_t dev) static int isp_sbus_attach(device_t dev) { - struct resource *regs; - int tval, iqd, isp_debug, role, rid, ispburst, default_id; + int tval, isp_debug, role, ispburst, default_id; struct isp_sbussoftc *sbs; ispsoftc_t *isp = NULL; int locksetup = 0; int ints_setup = 0; + sbs = device_get_softc(dev); + if (sbs == NULL) { + device_printf(dev, "cannot get softc\n"); + return (ENOMEM); + } + + sbs->sbus_dev = dev; + sbs->sbus_mdvec = mdvec; + /* * Figure out if we're supposed to skip this one. * If we are, we actually go to ISP_ROLE_NONE. @@ -165,23 +177,15 @@ isp_sbus_attach(device_t dev) role = ISP_DEFAULT_ROLES; } - sbs = malloc(sizeof (*sbs), M_DEVBUF, M_NOWAIT | M_ZERO); - if (sbs == NULL) { - device_printf(dev, "cannot allocate softc\n"); - return (ENOMEM); - } + sbs->irq = sbs->regs = NULL; + sbs->rgd = sbs->iqd = 0; - regs = NULL; - iqd = 0; - rid = 0; - regs = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); - if (regs == 0) { + sbs->regs = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sbs->rgd, + RF_ACTIVE); + if (sbs->regs == NULL) { device_printf(dev, "unable to map registers\n"); goto bad; } - sbs->sbus_dev = dev; - sbs->sbus_reg = regs; - sbs->sbus_mdvec = mdvec; sbs->sbus_poff[BIU_BLOCK >> _BLK_REG_SHFT] = BIU_REGS_OFF; sbs->sbus_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = SBUS_MBOX_REGS_OFF; @@ -189,8 +193,8 @@ isp_sbus_attach(device_t dev) sbs->sbus_poff[RISC_BLOCK >> _BLK_REG_SHFT] = SBUS_RISC_REGS_OFF; sbs->sbus_poff[DMA_BLOCK >> _BLK_REG_SHFT] = DMA_REGS_OFF; isp = &sbs->sbus_isp; - isp->isp_bus_tag = rman_get_bustag(regs); - isp->isp_bus_handle = rman_get_bushandle(regs); + isp->isp_bus_tag = rman_get_bustag(sbs->regs); + isp->isp_bus_handle = rman_get_bushandle(sbs->regs); isp->isp_mdvec = &sbs->sbus_mdvec; isp->isp_bustype = ISP_BT_SBUS; isp->isp_type = ISP_HA_SCSI_UNKNOWN; @@ -244,7 +248,6 @@ isp_sbus_attach(device_t dev) SDPARAM(isp, 0)->isp_ptisp = 1; } - isp->isp_osinfo.fw = firmware_get("isp_1000"); if (isp->isp_osinfo.fw) { union { @@ -280,16 +283,15 @@ isp_sbus_attach(device_t dev) mtx_init(&isp->isp_osinfo.lock, "isp", NULL, MTX_DEF); locksetup++; - iqd = 0; - sbs->sbus_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, &iqd, + sbs->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sbs->iqd, RF_ACTIVE | RF_SHAREABLE); - if (sbs->sbus_ires == NULL) { + if (sbs->irq == NULL) { device_printf(dev, "could not allocate interrupt\n"); goto bad; } - if (isp_setup_intr(dev, sbs->sbus_ires, ISP_IFLAGS, NULL, - isp_platform_intr, isp, &sbs->ih)) { + if (isp_setup_intr(dev, sbs->irq, ISP_IFLAGS, NULL, isp_platform_intr, + isp, &sbs->ih)) { device_printf(dev, "could not setup interrupt\n"); goto bad; } @@ -333,25 +335,49 @@ isp_sbus_attach(device_t dev) bad: if (sbs && ints_setup) { - (void) bus_teardown_intr(dev, sbs->sbus_ires, sbs->ih); + (void) bus_teardown_intr(dev, sbs->irq, sbs->ih); } - if (sbs && sbs->sbus_ires) { - bus_release_resource(dev, SYS_RES_IRQ, iqd, sbs->sbus_ires); + if (sbs && sbs->irq) { + bus_release_resource(dev, SYS_RES_IRQ, sbs->iqd, sbs->irq); } if (locksetup && isp) { mtx_destroy(&isp->isp_osinfo.lock); } - if (regs) { - (void) bus_release_resource(dev, SYS_RES_MEMORY, 0, regs); + if (sbs->regs) { + (void) bus_release_resource(dev, SYS_RES_MEMORY, sbs->rgd, + sbs->regs); } + return (ENXIO); +} - if (sbs) { - free(sbs, M_DEVBUF); +static int +isp_sbus_detach(device_t dev) +{ + struct isp_sbussoftc *sbs; + ispsoftc_t *isp; + int status; + + sbs = device_get_softc(dev); + if (sbs == NULL) { + return (ENXIO); } - return (ENXIO); + isp = (ispsoftc_t *) sbs; + status = isp_detach(isp); + if (status) + return (status); + ISP_LOCK(isp); + isp_uninit(isp); + if (sbs->ih) { + (void) bus_teardown_intr(dev, sbs->irq, sbs->ih); + } + ISP_UNLOCK(isp); + mtx_destroy(&isp->isp_osinfo.lock); + (void) bus_release_resource(dev, SYS_RES_IRQ, sbs->iqd, sbs->irq); + (void) bus_release_resource(dev, SYS_RES_MEMORY, sbs->rgd, sbs->regs); + return (0); } #define IspVirt2Off(a, x) \ From owner-svn-src-head@FreeBSD.ORG Sat Aug 4 03:05:02 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38B4B106564A; Sat, 4 Aug 2012 03:05:02 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1BEF68FC0C; Sat, 4 Aug 2012 03:05:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q74351Mr000787; Sat, 4 Aug 2012 03:05:01 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q74351SS000783; Sat, 4 Aug 2012 03:05:01 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201208040305.q74351SS000783@svn.freebsd.org> From: Justin Hibbits Date: Sat, 4 Aug 2012 03:05:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239027 - in head/sys: conf powerpc/conf powerpc/powermac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 04 Aug 2012 03:05:02 -0000 Author: jhibbits Date: Sat Aug 4 03:05:01 2012 New Revision: 239027 URL: http://svn.freebsd.org/changeset/base/239027 Log: Add backlight support for nVidia-based PowerBooks/iBooks/iMacs. Approved by: nwhitehorn (mentor) MFC after: 9.1-RELEASE Added: head/sys/powerpc/powermac/nvbl.c (contents, props changed) Modified: head/sys/conf/files.powerpc head/sys/powerpc/conf/GENERIC head/sys/powerpc/conf/GENERIC64 Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Sat Aug 4 02:38:05 2012 (r239026) +++ head/sys/conf/files.powerpc Sat Aug 4 03:05:01 2012 (r239027) @@ -160,6 +160,7 @@ powerpc/powermac/hrowpic.c optional powe powerpc/powermac/kiic.c optional powermac kiic powerpc/powermac/macgpio.c optional powermac pci powerpc/powermac/macio.c optional powermac pci +powerpc/powermac/nvbl.c optional powermac nvbl powerpc/powermac/openpic_macio.c optional powermac pci powerpc/powermac/platform_powermac.c optional powermac powerpc/powermac/powermac_thermal.c optional powermac Modified: head/sys/powerpc/conf/GENERIC ============================================================================== --- head/sys/powerpc/conf/GENERIC Sat Aug 4 02:38:05 2012 (r239026) +++ head/sys/powerpc/conf/GENERIC Sat Aug 4 03:05:01 2012 (r239027) @@ -197,6 +197,7 @@ device powermac_nvram # Open Firmware c device smu # Apple System Management Unit device windtunnel # Apple G4 MDD fan controller device atibl # ATI-based backlight driver for PowerBooks/iBooks +device nvbl # nVidia-based backlight driver for PowerBooks/iBooks # ADB support device adb Modified: head/sys/powerpc/conf/GENERIC64 ============================================================================== --- head/sys/powerpc/conf/GENERIC64 Sat Aug 4 02:38:05 2012 (r239026) +++ head/sys/powerpc/conf/GENERIC64 Sat Aug 4 03:05:01 2012 (r239027) @@ -194,6 +194,7 @@ device max6690 # PowerMac7,2 temperatu device powermac_nvram # Open Firmware configuration NVRAM device smu # Apple System Management Unit device atibl # ATI-based backlight driver for PowerBooks/iBooks +device nvbl # nVidia-based backlight driver for PowerBooks/iBooks # ADB support device adb Added: head/sys/powerpc/powermac/nvbl.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/powermac/nvbl.c Sat Aug 4 03:05:01 2012 (r239027) @@ -0,0 +1,197 @@ +/*- + * Copyright (c) 2012 Justin Hibbits + * 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 ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#define NVIDIA_BRIGHT_MIN (0x0ec) +#define NVIDIA_BRIGHT_MAX (0x538) +#define NVIDIA_BRIGHT_SCALE ((NVIDIA_BRIGHT_MAX - NVIDIA_BRIGHT_MIN)/100) +/* nVidia's MMIO registers are at PCI BAR[0] */ +#define NVIDIA_MMIO_PMC (0x0) +#define NVIDIA_PMC_OFF (NVIDIA_MMIO_PMC + 0x10f0) +#define NVIDIA_PMC_BL_SHIFT (16) +#define NVIDIA_PMC_BL_EN (1 << 31) + + +struct nvbl_softc { + device_t dev; + struct resource *sc_memr; +}; + +static void nvbl_identify(driver_t *driver, device_t parent); +static int nvbl_probe(device_t dev); +static int nvbl_attach(device_t dev); +static int nvbl_setlevel(struct nvbl_softc *sc, int newlevel); +static int nvbl_getlevel(struct nvbl_softc *sc); +static int nvbl_sysctl(SYSCTL_HANDLER_ARGS); + +static device_method_t nvbl_methods[] = { + /* Device interface */ + DEVMETHOD(device_identify, nvbl_identify), + DEVMETHOD(device_probe, nvbl_probe), + DEVMETHOD(device_attach, nvbl_attach), + {0, 0}, +}; + +static driver_t nvbl_driver = { + "backlight", + nvbl_methods, + sizeof(struct nvbl_softc) +}; + +static devclass_t nvbl_devclass; + +DRIVER_MODULE(nvbl, vgapci, nvbl_driver, nvbl_devclass, 0, 0); + +static void +nvbl_identify(driver_t *driver, device_t parent) +{ + if (device_find_child(parent, "backlight", -1) == NULL) + device_add_child(parent, "backlight", -1); +} + +static int +nvbl_probe(device_t dev) +{ + char control[8]; + phandle_t handle; + + handle = OF_finddevice("mac-io/backlight"); + + if (handle <= 0) + return (ENXIO); + + if (OF_getprop(handle, "backlight-control", &control, sizeof(control)) < 0) + return (ENXIO); + + if (strcmp(control, "mnca") != 0) + return (ENXIO); + + device_set_desc(dev, "PowerBook backlight for nVidia graphics"); + + return (0); +} + +static int +nvbl_attach(device_t dev) +{ + struct nvbl_softc *sc; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *tree; + int rid; + + sc = device_get_softc(dev); + + rid = 0x10; /* BAR[0], for the MMIO register */ + sc->sc_memr = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE | RF_SHAREABLE); + if (sc->sc_memr == NULL) { + device_printf(dev, "Could not alloc mem resource!\n"); + return (ENXIO); + } + + /* Turn on big-endian mode */ + if (!(bus_read_stream_4(sc->sc_memr, NVIDIA_MMIO_PMC + 4) & 0x01000001)) { + bus_write_stream_4(sc->sc_memr, NVIDIA_MMIO_PMC + 4, 0x01000001); + mb(); + } + + ctx = device_get_sysctl_ctx(dev); + tree = device_get_sysctl_tree(dev); + + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "level", CTLTYPE_INT | CTLFLAG_RW, sc, 0, + nvbl_sysctl, "I", "Backlight level (0-100)"); + + return (0); +} + +static int +nvbl_setlevel(struct nvbl_softc *sc, int newlevel) +{ + uint32_t pmc_reg; + + if (newlevel > 100) + newlevel = 100; + + if (newlevel < 0) + newlevel = 0; + + if (newlevel > 0) + newlevel = (newlevel * NVIDIA_BRIGHT_SCALE) + NVIDIA_BRIGHT_MIN; + + pmc_reg = bus_read_stream_4(sc->sc_memr, NVIDIA_PMC_OFF) & 0xffff; + pmc_reg |= NVIDIA_PMC_BL_EN | (newlevel << NVIDIA_PMC_BL_SHIFT); + bus_write_stream_4(sc->sc_memr, NVIDIA_PMC_OFF, pmc_reg); + + return (0); +} + +static int +nvbl_getlevel(struct nvbl_softc *sc) +{ + uint16_t level; + + level = bus_read_stream_2(sc->sc_memr, NVIDIA_PMC_OFF) & 0x7fff; + + if (level < NVIDIA_BRIGHT_MIN) + return 0; + + level = (level - NVIDIA_BRIGHT_MIN) / NVIDIA_BRIGHT_SCALE; + + return (level); +} + +static int +nvbl_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct nvbl_softc *sc; + int newlevel, error; + + sc = arg1; + + newlevel = nvbl_getlevel(sc); + + error = sysctl_handle_int(oidp, &newlevel, 0, req); + + if (error || !req->newptr) + return (error); + + return (nvbl_setlevel(sc, newlevel)); +} From owner-svn-src-head@FreeBSD.ORG Sat Aug 4 05:30:21 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D84A106572F; Sat, 4 Aug 2012 05:30:21 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 15F1E8FC0C; Sat, 4 Aug 2012 05:30:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q745UKmX013974; Sat, 4 Aug 2012 05:30:20 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q745UKpP013972; Sat, 4 Aug 2012 05:30:20 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201208040530.q745UKpP013972@svn.freebsd.org> From: Andrew Turner Date: Sat, 4 Aug 2012 05:30:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239031 - head/libexec/rtld-elf/arm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 04 Aug 2012 05:30:21 -0000 Author: andrew Date: Sat Aug 4 05:30:20 2012 New Revision: 239031 URL: http://svn.freebsd.org/changeset/base/239031 Log: Ensure we align the stack to 8 bytes in rtld. This is not strictly required with the current ABI but will be when we switch to the ARM EABI. The aapcs requires the stack to be 4 byte aligned at all times and 8 byte aligned when calling a public subroutine where the current ABI only requires sp to be a multiple of 4. Modified: head/libexec/rtld-elf/arm/rtld_start.S Modified: head/libexec/rtld-elf/arm/rtld_start.S ============================================================================== --- head/libexec/rtld-elf/arm/rtld_start.S Sat Aug 4 04:30:26 2012 (r239030) +++ head/libexec/rtld-elf/arm/rtld_start.S Sat Aug 4 05:30:20 2012 (r239031) @@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$"); .globl .rtld_start .type .rtld_start,%function .rtld_start: + mov r6, sp /* save the stack pointer */ + bic sp, sp, #7 /* align the stack pointer */ sub sp, sp, #8 /* make room for obj_main & exit proc */ mov r4, r0 /* save ps_strings */ ldr sl, .L2 @@ -52,13 +54,13 @@ __FBSDID("$FreeBSD$"); bl _rtld_relocate_nonplt_self mov r1, sp add r2, sp, #4 - add r0, sp, #8 + mov r0, r6 /* load the sp the kernel gave us */ bl _rtld /* call the shared loader */ mov r3, r0 /* save entry point */ ldr r2, [sp, #0] /* r2 = cleanup */ ldr r1, [sp, #4] /* r1 = obj_main */ - add sp, sp, #8 /* restore stack */ + mov sp, r6 /* restore stack */ mov r0, r4 /* restore ps_strings */ mov pc, r3 /* jump to the entry point */ .L2: From owner-svn-src-head@FreeBSD.ORG Sat Aug 4 05:31:26 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BCBD21065670; Sat, 4 Aug 2012 05:31:26 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A7E338FC1B; Sat, 4 Aug 2012 05:31:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q745VQp0014096; Sat, 4 Aug 2012 05:31:26 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q745VQPT014094; Sat, 4 Aug 2012 05:31:26 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201208040531.q745VQPT014094@svn.freebsd.org> From: Andrew Turner Date: Sat, 4 Aug 2012 05:31:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239032 - head/sys/arm/arm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 04 Aug 2012 05:31:26 -0000 Author: andrew Date: Sat Aug 4 05:31:26 2012 New Revision: 239032 URL: http://svn.freebsd.org/changeset/base/239032 Log: Ensure we align the stack to 8 bytes in system calls. This is not strictly required with the current ABI but will be when we switch to the ARM EABI. The aapcs requires the stack to be 4 byte aligned at all times and 8 byte aligned when calling a public subroutine where the current ABI only requires sp to be a multiple of 4. Modified: head/sys/arm/arm/exception.S Modified: head/sys/arm/arm/exception.S ============================================================================== --- head/sys/arm/arm/exception.S Sat Aug 4 05:30:20 2012 (r239031) +++ head/sys/arm/arm/exception.S Sat Aug 4 05:31:26 2012 (r239032) @@ -80,7 +80,10 @@ ASENTRY_NP(swi_entry) PUSHFRAME mov r0, sp /* Pass the frame to any function */ + mov r6, sp /* Backup the stack pointer */ + bic sp, sp, #7 /* Align the stack pointer */ bl _C_LABEL(swi_handler) /* It's a SWI ! */ + mov sp, r6 /* Restore the stack */ DO_AST PULLFRAME From owner-svn-src-head@FreeBSD.ORG Sat Aug 4 05:38:26 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 80805106564A; Sat, 4 Aug 2012 05:38:26 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6B2478FC0C; Sat, 4 Aug 2012 05:38:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q745cQPC014917; Sat, 4 Aug 2012 05:38:26 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q745cQDP014914; Sat, 4 Aug 2012 05:38:26 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201208040538.q745cQDP014914@svn.freebsd.org> From: Andrew Turner Date: Sat, 4 Aug 2012 05:38:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239033 - head/sys/arm/arm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 04 Aug 2012 05:38:26 -0000 Author: andrew Date: Sat Aug 4 05:38:25 2012 New Revision: 239033 URL: http://svn.freebsd.org/changeset/base/239033 Log: Correctly return EFAULT in copyin & copyout on a fault. This fixes NFS when running FreeBSD on QEMU emulating a Gumstix board. While here remove the use of a magic number in the not-XScale version. Pointed out by: kib Reviewed by: stas Modified: head/sys/arm/arm/bcopyinout.S head/sys/arm/arm/bcopyinout_xscale.S Modified: head/sys/arm/arm/bcopyinout.S ============================================================================== --- head/sys/arm/arm/bcopyinout.S Sat Aug 4 05:31:26 2012 (r239032) +++ head/sys/arm/arm/bcopyinout.S Sat Aug 4 05:38:25 2012 (r239033) @@ -39,6 +39,7 @@ #include "assym.s" #include +#include .L_arm_memcpy: .word _C_LABEL(_arm_memcpy) @@ -310,7 +311,7 @@ ENTRY(copyin) RET .Lcopyfault: - mov r0, #14 /* EFAULT */ + ldr r0, =EFAULT str r5, [r4, #PCB_ONFAULT] RESTORE_REGS Modified: head/sys/arm/arm/bcopyinout_xscale.S ============================================================================== --- head/sys/arm/arm/bcopyinout_xscale.S Sat Aug 4 05:31:26 2012 (r239032) +++ head/sys/arm/arm/bcopyinout_xscale.S Sat Aug 4 05:38:25 2012 (r239033) @@ -108,6 +108,7 @@ ENTRY(copyin) ldmfd sp!, {r10-r11, pc} .Lcopyin_fault: + ldr r0, =EFAULT str r11, [r10, #PCB_ONFAULT] cmp r3, #0x00 ldmgtfd sp!, {r4-r7} /* r3 > 0 Restore r4-r7 */ @@ -559,6 +560,7 @@ ENTRY(copyout) ldmfd sp!, {r10-r11, pc} .Lcopyout_fault: + ldr r0, =EFAULT str r11, [r10, #PCB_ONFAULT] cmp r3, #0x00 ldmgtfd sp!, {r4-r7} /* r3 > 0 Restore r4-r7 */ From owner-svn-src-head@FreeBSD.ORG Sat Aug 4 07:46:59 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9E584106566B; Sat, 4 Aug 2012 07:46:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 88E278FC0C; Sat, 4 Aug 2012 07:46:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q747kxKH026001; Sat, 4 Aug 2012 07:46:59 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q747kx0X025999; Sat, 4 Aug 2012 07:46:59 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201208040746.q747kx0X025999@svn.freebsd.org> From: Alexander Motin Date: Sat, 4 Aug 2012 07:46:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239034 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 04 Aug 2012 07:46:59 -0000 Author: mav Date: Sat Aug 4 07:46:58 2012 New Revision: 239034 URL: http://svn.freebsd.org/changeset/base/239034 Log: Partialy MFcalloutng r236894 (by davide): ... While here, Bruce Evans told me that "unsigned int" is spelled "u_int" in KNF, so replace it where needed. Modified: head/sys/kern/kern_clocksource.c Modified: head/sys/kern/kern_clocksource.c ============================================================================== --- head/sys/kern/kern_clocksource.c Sat Aug 4 05:38:25 2012 (r239033) +++ head/sys/kern/kern_clocksource.c Sat Aug 4 07:46:58 2012 (r239034) @@ -168,8 +168,8 @@ hardclockintr(void) state = DPCPU_PTR(timerstate); now = state->now; CTR4(KTR_SPARE2, "ipi at %d: now %d.%08x%08x", - curcpu, now.sec, (unsigned int)(now.frac >> 32), - (unsigned int)(now.frac & 0xffffffff)); + curcpu, now.sec, (u_int)(now.frac >> 32), + (u_int)(now.frac & 0xffffffff)); done = handleevents(&now, 0); return (done ? FILTER_HANDLED : FILTER_STRAY); } @@ -188,8 +188,8 @@ handleevents(struct bintime *now, int fa int done, runs; CTR4(KTR_SPARE2, "handle at %d: now %d.%08x%08x", - curcpu, now->sec, (unsigned int)(now->frac >> 32), - (unsigned int)(now->frac & 0xffffffff)); + curcpu, now->sec, (u_int)(now->frac >> 32), + (u_int)(now->frac & 0xffffffff)); done = 0; if (fake) { frame = NULL; @@ -332,8 +332,8 @@ getnextevent(struct bintime *event) *event = nexthard; } CTR5(KTR_SPARE2, "next at %d: next %d.%08x%08x by %d", - curcpu, event->sec, (unsigned int)(event->frac >> 32), - (unsigned int)(event->frac & 0xffffffff), c); + curcpu, event->sec, (u_int)(event->frac >> 32), + (u_int)(event->frac & 0xffffffff), c); } /* Hardware timer callback function. */ @@ -365,8 +365,8 @@ timercb(struct eventtimer *et, void *arg } state->now = now; CTR4(KTR_SPARE2, "intr at %d: now %d.%08x%08x", - curcpu, now.sec, (unsigned int)(now.frac >> 32), - (unsigned int)(now.frac & 0xffffffff)); + curcpu, (int)(now.sec), (u_int)(now.frac >> 32), + (u_int)(now.frac & 0xffffffff)); #ifdef SMP /* Prepare broadcasting to other CPUs for non-per-CPU timers. */ @@ -437,8 +437,8 @@ loadtimer(struct bintime *now, int start if (new.frac < tmp) /* Left less then passed. */ bintime_addx(&new, timerperiod.frac); CTR5(KTR_SPARE2, "load p at %d: now %d.%08x first in %d.%08x", - curcpu, now->sec, (unsigned int)(now->frac >> 32), - new.sec, (unsigned int)(new.frac >> 32)); + curcpu, now->sec, (u_int)(now->frac >> 32), + new.sec, (u_int)(new.frac >> 32)); *next = new; bintime_add(next, now); et_start(timer, &new, &timerperiod); @@ -447,8 +447,8 @@ loadtimer(struct bintime *now, int start getnextevent(&new); eq = bintime_cmp(&new, next, ==); CTR5(KTR_SPARE2, "load at %d: next %d.%08x%08x eq %d", - curcpu, new.sec, (unsigned int)(new.frac >> 32), - (unsigned int)(new.frac & 0xffffffff), + curcpu, new.sec, (u_int)(new.frac >> 32), + (u_int)(new.frac & 0xffffffff), eq); if (!eq) { *next = new; @@ -782,8 +782,8 @@ cpu_idleclock(void) else binuptime(&now); CTR4(KTR_SPARE2, "idle at %d: now %d.%08x%08x", - curcpu, now.sec, (unsigned int)(now.frac >> 32), - (unsigned int)(now.frac & 0xffffffff)); + curcpu, now.sec, (u_int)(now.frac >> 32), + (u_int)(now.frac & 0xffffffff)); getnextcpuevent(&t, 1); ET_HW_LOCK(state); state->idle = 1; @@ -811,8 +811,8 @@ cpu_activeclock(void) else binuptime(&now); CTR4(KTR_SPARE2, "active at %d: now %d.%08x%08x", - curcpu, now.sec, (unsigned int)(now.frac >> 32), - (unsigned int)(now.frac & 0xffffffff)); + curcpu, now.sec, (u_int)(now.frac >> 32), + (u_int)(now.frac & 0xffffffff)); spinlock_enter(); td = curthread; td->td_intr_nesting_level++; @@ -835,11 +835,11 @@ clocksource_cyc_set(const struct bintime binuptime(&now); CTR4(KTR_SPARE2, "set_cyc at %d: now %d.%08x%08x", - curcpu, now.sec, (unsigned int)(now.frac >> 32), - (unsigned int)(now.frac & 0xffffffff)); + curcpu, now.sec, (u_int)(now.frac >> 32), + (u_int)(now.frac & 0xffffffff)); CTR4(KTR_SPARE2, "set_cyc at %d: t %d.%08x%08x", - curcpu, t->sec, (unsigned int)(t->frac >> 32), - (unsigned int)(t->frac & 0xffffffff)); + curcpu, t->sec, (u_int)(t->frac >> 32), + (u_int)(t->frac & 0xffffffff)); ET_HW_LOCK(state); if (bintime_cmp(t, &state->nextcyc, ==)) { From owner-svn-src-head@FreeBSD.ORG Sat Aug 4 08:03:30 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C6BB1106566B; Sat, 4 Aug 2012 08:03:30 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 97E258FC0A; Sat, 4 Aug 2012 08:03:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7483UrL027476; Sat, 4 Aug 2012 08:03:30 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7483U0k027474; Sat, 4 Aug 2012 08:03:30 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201208040803.q7483U0k027474@svn.freebsd.org> From: Michael Tuexen Date: Sat, 4 Aug 2012 08:03:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239035 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 04 Aug 2012 08:03:30 -0000 Author: tuexen Date: Sat Aug 4 08:03:30 2012 New Revision: 239035 URL: http://svn.freebsd.org/changeset/base/239035 Log: Testing an interface property should depend on the interface, not on an address. MFC after: 3 days Modified: head/sys/netinet/sctp_bsd_addr.c Modified: head/sys/netinet/sctp_bsd_addr.c ============================================================================== --- head/sys/netinet/sctp_bsd_addr.c Sat Aug 4 07:46:58 2012 (r239034) +++ head/sys/netinet/sctp_bsd_addr.c Sat Aug 4 08:03:30 2012 (r239035) @@ -152,12 +152,12 @@ sctp_gather_internal_ifa_flags(struct sc static uint32_t -sctp_is_desired_interface_type(struct ifaddr *ifa) +sctp_is_desired_interface_type(struct ifnet *ifn) { int result; /* check the interface type to see if it's one we care about */ - switch (ifa->ifa_ifp->if_type) { + switch (ifn->if_type) { case IFT_ETHER: case IFT_ISO88023: case IFT_ISO88024: @@ -216,6 +216,10 @@ sctp_init_ifns_for_vrf(int vrfid) IFNET_RLOCK(); TAILQ_FOREACH(ifn, &MODULE_GLOBAL(ifnet), if_list) { + if (sctp_is_desired_interface_type(ifn) == 0) { + /* non desired type */ + continue; + } IF_ADDR_RLOCK(ifn); TAILQ_FOREACH(ifa, &ifn->if_addrlist, ifa_list) { if (ifa->ifa_addr == NULL) { @@ -240,10 +244,6 @@ sctp_init_ifns_for_vrf(int vrfid) default: continue; } - if (sctp_is_desired_interface_type(ifa) == 0) { - /* non desired type */ - continue; - } switch (ifa->ifa_addr->sa_family) { #ifdef INET case AF_INET: @@ -317,6 +317,10 @@ sctp_addr_change(struct ifaddr *ifa, int if (ifa->ifa_addr == NULL) { return; } + if (sctp_is_desired_interface_type(ifa->ifa_ifp) == 0) { + /* non desired type */ + return; + } switch (ifa->ifa_addr->sa_family) { #ifdef INET case AF_INET: @@ -338,22 +342,16 @@ sctp_addr_change(struct ifaddr *ifa, int /* non inet/inet6 skip */ return; } - - if (sctp_is_desired_interface_type(ifa) == 0) { - /* non desired type */ - return; - } if (cmd == RTM_ADD) { (void)sctp_add_addr_to_vrf(SCTP_DEFAULT_VRFID, (void *)ifa->ifa_ifp, - ifa->ifa_ifp->if_index, ifa->ifa_ifp->if_type, - ifa->ifa_ifp->if_xname, + ifa->ifa_ifp->if_index, ifa->ifa_ifp->if_type, ifa->ifa_ifp->if_xname, (void *)ifa, ifa->ifa_addr, ifa_flags, 1); } else { sctp_del_addr_from_vrf(SCTP_DEFAULT_VRFID, ifa->ifa_addr, ifa->ifa_ifp->if_index, - ifa->ifa_ifp->if_xname - ); + ifa->ifa_ifp->if_xname); + /* * We don't bump refcount here so when it completes the * final delete will happen. From owner-svn-src-head@FreeBSD.ORG Sat Aug 4 08:06:37 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D6F3B106564A; Sat, 4 Aug 2012 08:06:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C1DFC8FC0C; Sat, 4 Aug 2012 08:06:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7486bqk027751; Sat, 4 Aug 2012 08:06:37 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7486bec027749; Sat, 4 Aug 2012 08:06:37 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201208040806.q7486bec027749@svn.freebsd.org> From: Alexander Motin Date: Sat, 4 Aug 2012 08:06:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239036 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 04 Aug 2012 08:06:38 -0000 Author: mav Date: Sat Aug 4 08:06:37 2012 New Revision: 239036 URL: http://svn.freebsd.org/changeset/base/239036 Log: Particlly MFcalloutng r238425 (by davide): Fix an issue related to old periodic timers. The code in kern_clocksource.c uses interrupt to keep track of time, and this time may not match with binuptime(). In order to address such incoherency, switch periodic timers to binuptime(). Except further calloutng it is needed for already present cyclic subsystem. Modified: head/sys/kern/kern_clocksource.c Modified: head/sys/kern/kern_clocksource.c ============================================================================== --- head/sys/kern/kern_clocksource.c Sat Aug 4 08:03:30 2012 (r239035) +++ head/sys/kern/kern_clocksource.c Sat Aug 4 08:06:37 2012 (r239036) @@ -356,13 +356,12 @@ timercb(struct eventtimer *et, void *arg next = &state->nexttick; } else next = &nexttick; - if (periodic) { - now = *next; /* Ex-next tick time becomes present time. */ + binuptime(&now); + if (periodic) { + *next = now; bintime_addx(next, timerperiod.frac); /* Next tick in 1 period. */ - } else { - binuptime(&now); /* Get present time from hardware. */ - next->sec = -1; /* Next tick is not scheduled yet. */ - } + } else + next->sec = -1; /* Next tick is not scheduled yet. */ state->now = now; CTR4(KTR_SPARE2, "intr at %d: now %d.%08x%08x", curcpu, (int)(now.sec), (u_int)(now.frac >> 32), @@ -714,11 +713,7 @@ cpu_initclocks_ap(void) state = DPCPU_PTR(timerstate); binuptime(&now); ET_HW_LOCK(state); - if ((timer->et_flags & ET_FLAGS_PERCPU) == 0 && periodic) { - state->now = nexttick; - bintime_sub(&state->now, &timerperiod); - } else - state->now = now; + state->now = now; hardclock_sync(curcpu); handleevents(&state->now, 2); if (timer->et_flags & ET_FLAGS_PERCPU) From owner-svn-src-head@FreeBSD.ORG Sat Aug 4 15:11:37 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A108A106564A; Sat, 4 Aug 2012 15:11:37 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8B2DE8FC0A; Sat, 4 Aug 2012 15:11:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q74FBbMF066218; Sat, 4 Aug 2012 15:11:37 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q74FBbIm066215; Sat, 4 Aug 2012 15:11:37 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201208041511.q74FBbIm066215@svn.freebsd.org> From: Gavin Atkinson Date: Sat, 4 Aug 2012 15:11:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239037 - in head: share/man/man4 sys/dev/usb/serial X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 04 Aug 2012 15:11:37 -0000 Author: gavin Date: Sat Aug 4 15:11:36 2012 New Revision: 239037 URL: http://svn.freebsd.org/changeset/base/239037 Log: Support multiple interface devices. The driver had previously hardcoded support for only the first port, but the CP2105 can have multiple ports. Although this allowed the first port to mostly work on multi port devices, there could be issues with this arrangement. Update the man page to reflect support for both ports and the CP2105. Many thanks to Silicon Labs (www.silabs.com) for providing a CP2105-EK dev board for testing. MFC after: 2 weeks Modified: head/share/man/man4/uslcom.4 head/sys/dev/usb/serial/uslcom.c Modified: head/share/man/man4/uslcom.4 ============================================================================== --- head/share/man/man4/uslcom.4 Sat Aug 4 08:06:37 2012 (r239036) +++ head/share/man/man4/uslcom.4 Sat Aug 4 15:11:36 2012 (r239037) @@ -16,12 +16,12 @@ .\" .\" $FreeBSD$ .\" -.Dd July 26, 2012 +.Dd August 4, 2012 .Dt USLCOM 4 .Os .Sh NAME .Nm uslcom -.Nd Silicon Laboratories CP2101/CP2102/CP2103/CP2104 based USB serial adapter +.Nd Silicon Laboratories CP2101/CP2102/CP2103/CP2104/CP2105 based USB serial adapter .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -41,7 +41,7 @@ uslcom_load="YES" .Sh DESCRIPTION The .Nm -driver supports Silicon Laboratories CP2101/CP2102/CP2103/CP2104 +driver supports Silicon Laboratories CP2101/CP2102/CP2103/CP2104/CP2105 based USB serial adapters. .Sh HARDWARE The following devices should work with the @@ -155,7 +155,7 @@ Renesas RX-Stick for RX610 .It Siemens MC60 Cable .It -Silicon Laboratories generic CP2101/CP2102/CP2103/CP2104 chips +Silicon Laboratories generic CP2101/CP2102/CP2103/CP2104/CP2105 chips .It Software Bisque Paramount ME .It @@ -210,6 +210,3 @@ The .Nm driver was written by .An Jonathan Gray Aq jsg@openbsd.org . -.Sh CAVEATS -On devices with multiple ports attached to a single chip, -only the first port is currently supported. Modified: head/sys/dev/usb/serial/uslcom.c ============================================================================== --- head/sys/dev/usb/serial/uslcom.c Sat Aug 4 08:06:37 2012 (r239036) +++ head/sys/dev/usb/serial/uslcom.c Sat Aug 4 15:11:36 2012 (r239037) @@ -60,7 +60,6 @@ SYSCTL_INT(_hw_usb_uslcom, OID_AUTO, deb #define USLCOM_BULK_BUF_SIZE 1024 #define USLCOM_CONFIG_INDEX 0 -#define USLCOM_IFACE_INDEX 0 #define USLCOM_SET_DATA_BITS(x) ((x) << 8) @@ -103,8 +102,6 @@ SYSCTL_INT(_hw_usb_uslcom, OID_AUTO, deb #define USLCOM_PARITY_ODD 0x10 #define USLCOM_PARITY_EVEN 0x20 -#define USLCOM_PORT_NO 0x0000 - /* USLCOM_BREAK values */ #define USLCOM_BREAK_OFF 0x00 #define USLCOM_BREAK_ON 0x01 @@ -138,6 +135,7 @@ struct uslcom_softc { uint8_t sc_msr; uint8_t sc_lsr; + uint8_t sc_IfIdx; }; static device_probe_t uslcom_probe; @@ -367,9 +365,6 @@ uslcom_probe(device_t dev) if (uaa->info.bConfigIndex != USLCOM_CONFIG_INDEX) { return (ENXIO); } - if (uaa->info.bIfaceIndex != USLCOM_IFACE_INDEX) { - return (ENXIO); - } return (usbd_lookup_id_by_uaa(uslcom_devs, sizeof(uslcom_devs), uaa)); } @@ -387,6 +382,7 @@ uslcom_attach(device_t dev) usb_callout_init_mtx(&sc->sc_watchdog, &sc->sc_mtx, 0); sc->sc_udev = uaa->device; + sc->sc_IfIdx = uaa->info.bIfaceIndex; error = usbd_transfer_setup(uaa->device, &uaa->info.bIfaceIndex, sc->sc_xfer, uslcom_config, @@ -441,7 +437,7 @@ uslcom_open(struct ucom_softc *ucom) req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_UART; USETW(req.wValue, USLCOM_UART_ENABLE); - USETW(req.wIndex, USLCOM_PORT_NO); + USETW(req.wIndex, sc->sc_IfIdx); USETW(req.wLength, 0); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -465,7 +461,7 @@ uslcom_close(struct ucom_softc *ucom) req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_UART; USETW(req.wValue, USLCOM_UART_DISABLE); - USETW(req.wIndex, USLCOM_PORT_NO); + USETW(req.wIndex, sc->sc_IfIdx); USETW(req.wLength, 0); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -489,7 +485,7 @@ uslcom_set_dtr(struct ucom_softc *ucom, req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_CTRL; USETW(req.wValue, ctl); - USETW(req.wIndex, USLCOM_PORT_NO); + USETW(req.wIndex, sc->sc_IfIdx); USETW(req.wLength, 0); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -513,7 +509,7 @@ uslcom_set_rts(struct ucom_softc *ucom, req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_CTRL; USETW(req.wValue, ctl); - USETW(req.wIndex, USLCOM_PORT_NO); + USETW(req.wIndex, sc->sc_IfIdx); USETW(req.wLength, 0); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -544,7 +540,7 @@ uslcom_param(struct ucom_softc *ucom, st req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_SET_BAUD_RATE; USETW(req.wValue, 0); - USETW(req.wIndex, USLCOM_PORT_NO); + USETW(req.wIndex, sc->sc_IfIdx); USETW(req.wLength, sizeof(baudrate)); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -581,7 +577,7 @@ uslcom_param(struct ucom_softc *ucom, st req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_DATA; USETW(req.wValue, data); - USETW(req.wIndex, USLCOM_PORT_NO); + USETW(req.wIndex, sc->sc_IfIdx); USETW(req.wLength, 0); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -603,7 +599,7 @@ uslcom_param(struct ucom_softc *ucom, st req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_SET_FLOWCTRL; USETW(req.wValue, 0); - USETW(req.wIndex, USLCOM_PORT_NO); + USETW(req.wIndex, sc->sc_IfIdx); USETW(req.wLength, sizeof(flowctrl)); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -633,7 +629,7 @@ uslcom_set_break(struct ucom_softc *ucom req.bmRequestType = USLCOM_WRITE; req.bRequest = USLCOM_BREAK; USETW(req.wValue, brk); - USETW(req.wIndex, USLCOM_PORT_NO); + USETW(req.wIndex, sc->sc_IfIdx); USETW(req.wLength, 0); if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, @@ -787,7 +783,7 @@ uslcom_control_callback(struct usb_xfer req.bmRequestType = USLCOM_READ; req.bRequest = USLCOM_RCTRL; USETW(req.wValue, 0); - USETW(req.wIndex, USLCOM_PORT_NO); + USETW(req.wIndex, sc->sc_IfIdx); USETW(req.wLength, sizeof(buf)); usbd_xfer_set_frames(xfer, 2); From owner-svn-src-head@FreeBSD.ORG Sat Aug 4 18:10:05 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41595106564A; Sat, 4 Aug 2012 18:10:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 257088FC08; Sat, 4 Aug 2012 18:10:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q74IA5AO080571; Sat, 4 Aug 2012 18:10:05 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q74IA4w8080569; Sat, 4 Aug 2012 18:10:04 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208041810.q74IA4w8080569@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 4 Aug 2012 18:10:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239038 - head/sys/dev/md X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 04 Aug 2012 18:10:05 -0000 Author: kib Date: Sat Aug 4 18:10:04 2012 New Revision: 239038 URL: http://svn.freebsd.org/changeset/base/239038 Log: Remove verbose unused commented out debugging printf. MFC after: 1 week Reviewed by: alc Modified: head/sys/dev/md/md.c Modified: head/sys/dev/md/md.c ============================================================================== --- head/sys/dev/md/md.c Sat Aug 4 15:11:36 2012 (r239037) +++ head/sys/dev/md/md.c Sat Aug 4 18:10:04 2012 (r239038) @@ -725,12 +725,6 @@ mdstart_swap(struct md_s *sc, struct bio /* Actions on further pages start at offset 0 */ p += PAGE_SIZE - offs; offs = 0; -#if 0 -if (bootverbose || bp->bio_offset / PAGE_SIZE < 17) -printf("wire_count %d busy %d flags %x hold_count %d act_count %d queue %d valid %d dirty %d @ %d\n", - m->wire_count, m->busy, - m->flags, m->hold_count, m->act_count, m->queue, m->valid, m->dirty, i); -#endif } vm_object_pip_subtract(sc->object, 1); VM_OBJECT_UNLOCK(sc->object); From owner-svn-src-head@FreeBSD.ORG Sat Aug 4 18:12:55 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5794B106564A; Sat, 4 Aug 2012 18:12:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 42AA78FC0C; Sat, 4 Aug 2012 18:12:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q74ICta1080848; Sat, 4 Aug 2012 18:12:55 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q74ICtQt080845; Sat, 4 Aug 2012 18:12:55 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208041812.q74ICtQt080845@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 4 Aug 2012 18:12:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239039 - head/sys/fs/nfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 04 Aug 2012 18:12:55 -0000 Author: kib Date: Sat Aug 4 18:12:54 2012 New Revision: 239039 URL: http://svn.freebsd.org/changeset/base/239039 Log: The header uma_int.h is internal uma header, unused by this source file. Do not include it needlessly. Reviewed by: alc MFC after: 1 week Modified: head/sys/fs/nfs/nfs_commonport.c Modified: head/sys/fs/nfs/nfs_commonport.c ============================================================================== --- head/sys/fs/nfs/nfs_commonport.c Sat Aug 4 18:10:04 2012 (r239038) +++ head/sys/fs/nfs/nfs_commonport.c Sat Aug 4 18:12:54 2012 (r239039) @@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include extern int nfscl_ticks; extern int nfsrv_nfsuserd; From owner-svn-src-head@FreeBSD.ORG Sat Aug 4 18:16:44 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7B913106564A; Sat, 4 Aug 2012 18:16:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 655ED8FC0C; Sat, 4 Aug 2012 18:16:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q74IGiKP081205; Sat, 4 Aug 2012 18:16:44 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q74IGisk081197; Sat, 4 Aug 2012 18:16:44 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201208041816.q74IGisk081197@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 4 Aug 2012 18:16:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239040 - in head/sys: fs/nfsclient fs/nwfs fs/smbfs nfsclient vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 04 Aug 2012 18:16:44 -0000 Author: kib Date: Sat Aug 4 18:16:43 2012 New Revision: 239040 URL: http://svn.freebsd.org/changeset/base/239040 Log: Reduce code duplication and exposure of direct access to struct vm_page oflags by providing helper function vm_page_readahead_finish(), which handles completed reads for pages with indexes other then the requested one, for VOP_GETPAGES(). Reviewed by: alc MFC after: 1 week Modified: head/sys/fs/nfsclient/nfs_clbio.c head/sys/fs/nwfs/nwfs_io.c head/sys/fs/smbfs/smbfs_io.c head/sys/nfsclient/nfs_bio.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h head/sys/vm/vnode_pager.c Modified: head/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clbio.c Sat Aug 4 18:12:54 2012 (r239039) +++ head/sys/fs/nfsclient/nfs_clbio.c Sat Aug 4 18:16:43 2012 (r239040) @@ -223,36 +223,8 @@ ncl_getpages(struct vop_getpages_args *a */ ; } - if (i != ap->a_reqpage) { - /* - * Whether or not to leave the page activated is up in - * the air, but we should put the page on a page queue - * somewhere (it already is in the object). Result: - * It appears that emperical results show that - * deactivating pages is best. - */ - - /* - * Just in case someone was asking for this page we - * now tell them that it is ok to use. - */ - if (!error) { - if (m->oflags & VPO_WANTED) { - vm_page_lock(m); - vm_page_activate(m); - vm_page_unlock(m); - } else { - vm_page_lock(m); - vm_page_deactivate(m); - vm_page_unlock(m); - } - vm_page_wakeup(m); - } else { - vm_page_lock(m); - vm_page_free(m); - vm_page_unlock(m); - } - } + if (i != ap->a_reqpage) + vm_page_readahead_finish(m, error); } VM_OBJECT_UNLOCK(object); return (0); Modified: head/sys/fs/nwfs/nwfs_io.c ============================================================================== --- head/sys/fs/nwfs/nwfs_io.c Sat Aug 4 18:12:54 2012 (r239039) +++ head/sys/fs/nwfs/nwfs_io.c Sat Aug 4 18:16:43 2012 (r239040) @@ -457,36 +457,8 @@ nwfs_getpages(ap) ("nwfs_getpages: page %p is dirty", m)); } - if (i != ap->a_reqpage) { - /* - * Whether or not to leave the page activated is up in - * the air, but we should put the page on a page queue - * somewhere (it already is in the object). Result: - * It appears that emperical results show that - * deactivating pages is best. - */ - - /* - * Just in case someone was asking for this page we - * now tell them that it is ok to use. - */ - if (!error) { - if (m->oflags & VPO_WANTED) { - vm_page_lock(m); - vm_page_activate(m); - vm_page_unlock(m); - } else { - vm_page_lock(m); - vm_page_deactivate(m); - vm_page_unlock(m); - } - vm_page_wakeup(m); - } else { - vm_page_lock(m); - vm_page_free(m); - vm_page_unlock(m); - } - } + if (i != ap->a_reqpage) + vm_page_readahead_finish(m, error); } VM_OBJECT_UNLOCK(object); return 0; Modified: head/sys/fs/smbfs/smbfs_io.c ============================================================================== --- head/sys/fs/smbfs/smbfs_io.c Sat Aug 4 18:12:54 2012 (r239039) +++ head/sys/fs/smbfs/smbfs_io.c Sat Aug 4 18:16:43 2012 (r239040) @@ -521,36 +521,8 @@ smbfs_getpages(ap) ; } - if (i != reqpage) { - /* - * Whether or not to leave the page activated is up in - * the air, but we should put the page on a page queue - * somewhere (it already is in the object). Result: - * It appears that emperical results show that - * deactivating pages is best. - */ - - /* - * Just in case someone was asking for this page we - * now tell them that it is ok to use. - */ - if (!error) { - if (m->oflags & VPO_WANTED) { - vm_page_lock(m); - vm_page_activate(m); - vm_page_unlock(m); - } else { - vm_page_lock(m); - vm_page_deactivate(m); - vm_page_unlock(m); - } - vm_page_wakeup(m); - } else { - vm_page_lock(m); - vm_page_free(m); - vm_page_unlock(m); - } - } + if (i != reqpage) + vm_page_readahead_finish(m, error); } VM_OBJECT_UNLOCK(object); return 0; Modified: head/sys/nfsclient/nfs_bio.c ============================================================================== --- head/sys/nfsclient/nfs_bio.c Sat Aug 4 18:12:54 2012 (r239039) +++ head/sys/nfsclient/nfs_bio.c Sat Aug 4 18:16:43 2012 (r239040) @@ -217,36 +217,8 @@ nfs_getpages(struct vop_getpages_args *a */ ; } - if (i != ap->a_reqpage) { - /* - * Whether or not to leave the page activated is up in - * the air, but we should put the page on a page queue - * somewhere (it already is in the object). Result: - * It appears that emperical results show that - * deactivating pages is best. - */ - - /* - * Just in case someone was asking for this page we - * now tell them that it is ok to use. - */ - if (!error) { - if (m->oflags & VPO_WANTED) { - vm_page_lock(m); - vm_page_activate(m); - vm_page_unlock(m); - } else { - vm_page_lock(m); - vm_page_deactivate(m); - vm_page_unlock(m); - } - vm_page_wakeup(m); - } else { - vm_page_lock(m); - vm_page_free(m); - vm_page_unlock(m); - } - } + if (i != ap->a_reqpage) + vm_page_readahead_finish(m, error); } VM_OBJECT_UNLOCK(object); return (0); Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sat Aug 4 18:12:54 2012 (r239039) +++ head/sys/vm/vm_page.c Sat Aug 4 18:16:43 2012 (r239040) @@ -695,6 +695,39 @@ vm_page_free_zero(vm_page_t m) } /* + * Unbusy and handle the page queueing for a page from the VOP_GETPAGES() + * array which is not the request page. + */ +void +vm_page_readahead_finish(vm_page_t m, int error) +{ + + if (error == 0) { + /* + * Since the page is not the requested page, whether + * it should be activated or deactivated is not + * obvious. Empirical results have shown that + * deactivating the page is usually the best choice, + * unless the page is wanted by another thread. + */ + if (m->oflags & VPO_WANTED) { + vm_page_lock(m); + vm_page_activate(m); + vm_page_unlock(m); + } else { + vm_page_lock(m); + vm_page_deactivate(m); + vm_page_unlock(m); + } + vm_page_wakeup(m); + } else { + vm_page_lock(m); + vm_page_free(m); + vm_page_unlock(m); + } +} + +/* * vm_page_sleep: * * Sleep and release the page and page queues locks. Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Sat Aug 4 18:12:54 2012 (r239039) +++ head/sys/vm/vm_page.h Sat Aug 4 18:16:43 2012 (r239040) @@ -390,6 +390,7 @@ vm_page_t vm_page_next(vm_page_t m); int vm_page_pa_tryrelock(pmap_t, vm_paddr_t, vm_paddr_t *); vm_page_t vm_page_prev(vm_page_t m); void vm_page_putfake(vm_page_t m); +void vm_page_readahead_finish(vm_page_t m, int error); void vm_page_reference(vm_page_t m); void vm_page_remove (vm_page_t); void vm_page_rename (vm_page_t, vm_object_t, vm_pindex_t); Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Sat Aug 4 18:12:54 2012 (r239039) +++ head/sys/vm/vnode_pager.c Sat Aug 4 18:16:43 2012 (r239040) @@ -985,37 +985,8 @@ vnode_pager_generic_getpages(vp, m, byte mt)); } - if (i != reqpage) { - - /* - * whether or not to leave the page activated is up in - * the air, but we should put the page on a page queue - * somewhere. (it already is in the object). Result: - * It appears that empirical results show that - * deactivating pages is best. - */ - - /* - * just in case someone was asking for this page we - * now tell them that it is ok to use - */ - if (!error) { - if (mt->oflags & VPO_WANTED) { - vm_page_lock(mt); - vm_page_activate(mt); - vm_page_unlock(mt); - } else { - vm_page_lock(mt); - vm_page_deactivate(mt); - vm_page_unlock(mt); - } - vm_page_wakeup(mt); - } else { - vm_page_lock(mt); - vm_page_free(mt); - vm_page_unlock(mt); - } - } + if (i != reqpage) + vm_page_readahead_finish(mt, error); } VM_OBJECT_UNLOCK(object); if (error) { From owner-svn-src-head@FreeBSD.ORG Sat Aug 4 20:40:37 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 443B4106564A; Sat, 4 Aug 2012 20:40:37 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2F0ED8FC16; Sat, 4 Aug 2012 20:40:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q74KebLs093981; Sat, 4 Aug 2012 20:40:37 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q74KeagQ093979; Sat, 4 Aug 2012 20:40:36 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201208042040.q74KeagQ093979@svn.freebsd.org> From: Michael Tuexen Date: Sat, 4 Aug 2012 20:40:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239041 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: 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, 04 Aug 2012 20:40:37 -0000 Author: tuexen Date: Sat Aug 4 20:40:36 2012 New Revision: 239041 URL: http://svn.freebsd.org/changeset/base/239041 Log: Fix a bug reported by Simon L. B. Nielsen: If an SCTP endpoint receives an ASCONF with a wildcard lookup address and incorrect verification tag, the system crashes. MFC after: 3 days. Modified: head/sys/netinet/sctp_pcb.c Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Sat Aug 4 18:16:43 2012 (r239040) +++ head/sys/netinet/sctp_pcb.c Sat Aug 4 20:40:36 2012 (r239041) @@ -2055,8 +2055,6 @@ sctp_findassoc_by_vtag(struct sockaddr * struct sctp_nets *net; struct sctp_tcb *stcb; - *netp = NULL; - *inp_p = NULL; SCTP_INP_INFO_RLOCK(); head = &SCTP_BASE_INFO(sctp_asochash)[SCTP_PCBHASH_ASOC(vtag, SCTP_BASE_INFO(hashasocmark))]; From owner-svn-src-head@FreeBSD.ORG Sat Aug 4 20:46:35 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8AF8E106564A; Sat, 4 Aug 2012 20:46:35 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id 713858FC15; Sat, 4 Aug 2012 20:46:34 +0000 (UTC) Received: by lbbgk8 with SMTP id gk8so135283lbb.13 for ; Sat, 04 Aug 2012 13:46:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=Hl3VXaZKtTH2BXNLgSnPOy1+4DrD3CAcLb3i7LX1EgU=; b=GsVsi2kOVhVxZwTmk6xxR0tYqDt+7nzKX6d8PyphIL37IonXNx8zna+QGEWl5XYr9+ lFmRLTN4qG8w0Bk15o0V6OZoZuA6XAvmQZi3jEE4DO06Im+vsZ/ioSvMkaaF6uKcN9gH Gi6UOLkUoaMJU6jX6pxwdFBESt/yuBIf4KaX1znWq43MyY7f3fMDZAWzQ+SbHJx25nsa dLwIz/MzLN8Rz0GzMYbYrMMjd0KwPyKRnUy50DmuD6VzFbD1xVJnFKQk2r0C4lWa+2Bh pJWz44oGkBgrBAUAcbhK6ItziQtqCpGEpKtbHwnls8DLgJRkeNHTLozPS9FZDoJcWz+q x+uA== MIME-Version: 1.0 Received: by 10.152.103.146 with SMTP id fw18mr5709950lab.30.1344113193034; Sat, 04 Aug 2012 13:46:33 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.112.27.65 with HTTP; Sat, 4 Aug 2012 13:46:32 -0700 (PDT) In-Reply-To: <201208041816.q74IGisk081197@svn.freebsd.org> References: <201208041816.q74IGisk081197@svn.freebsd.org> Date: Sat, 4 Aug 2012 21:46:32 +0100 X-Google-Sender-Auth: J0VXUQamVwSq__oCHuQmYj1r29c Message-ID: From: Attilio Rao To: Konstantin Belousov Content-Type: text/plain; charset=UTF-8 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r239040 - in head/sys: fs/nfsclient fs/nwfs fs/smbfs nfsclient vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: attilio@FreeBSD.org List-Id: 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, 04 Aug 2012 20:46:35 -0000 On Sat, Aug 4, 2012 at 7:16 PM, Konstantin Belousov wrote: > Author: kib > Date: Sat Aug 4 18:16:43 2012 > New Revision: 239040 > URL: http://svn.freebsd.org/changeset/base/239040 > > Log: > Reduce code duplication and exposure of direct access to struct > vm_page oflags by providing helper function > vm_page_readahead_finish(), which handles completed reads for pages > with indexes other then the requested one, for VOP_GETPAGES(). The semantic of this new function is very questionable as I don't think we have any other function that accepts error as in-parameter (in particular if it does only a check). The error check should really belong to the consumers IMHO (even if duplicate). Attilio -- Peace can only be achieved by understanding - A. Einstein