svn commit: r248543 - head/sys/dev/ath

2013-03-19 Thread Adrian Chadd
Author: adrian
Date: Wed Mar 20 05:44:03 2013
New Revision: 248543
URL: http://svnweb.freebsd.org/changeset/base/248543

Log:
  Fix the EDMA CABQ handling - for now, the CABQ takes a descriptor chain
  like the legacy chips expect.

Modified:
  head/sys/dev/ath/if_ath_tx_edma.c

Modified: head/sys/dev/ath/if_ath_tx_edma.c
==
--- head/sys/dev/ath/if_ath_tx_edma.c   Wed Mar 20 05:31:34 2013
(r248542)
+++ head/sys/dev/ath/if_ath_tx_edma.c   Wed Mar 20 05:44:03 2013
(r248543)
@@ -267,6 +267,9 @@ ath_edma_xmit_handoff_mcast(struct ath_s
/* sync descriptor to memory */
bus_dmamap_sync(sc->sc_dmat, bf_last->bf_dmamap,
   BUS_DMASYNC_PREWRITE);
+
+   /* link descriptor */
+   *txq->axq_link = bf->bf_daddr;
}
 
 #ifdef ATH_DEBUG_ALQ
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r248542 - head/sys/dev/mii

2013-03-19 Thread Pyun YongHyeon
Author: yongari
Date: Wed Mar 20 05:31:34 2013
New Revision: 248542
URL: http://svnweb.freebsd.org/changeset/base/248542

Log:
  For RTL8211B or later PHYs, enable crossover detection and
  auto-correction. This change makes re(4) establish a link with
  a system using non-crossover UTP cable.
  
  Tested by:Michael BlackHeart < amdmiek <> gmail dot com >

Modified:
  head/sys/dev/mii/rgephy.c
  head/sys/dev/mii/rgephyreg.h

Modified: head/sys/dev/mii/rgephy.c
==
--- head/sys/dev/mii/rgephy.c   Wed Mar 20 05:23:23 2013(r248541)
+++ head/sys/dev/mii/rgephy.c   Wed Mar 20 05:31:34 2013(r248542)
@@ -488,7 +488,7 @@ rgephy_load_dspcode(struct mii_softc *sc
 static void
 rgephy_reset(struct mii_softc *sc)
 {
-   uint16_t ssr;
+   uint16_t pcr, ssr;
 
if ((sc->mii_flags & MIIF_PHYPRIV0) == 0 && sc->mii_mpd_rev == 3) {
/* RTL8211C(L) */
@@ -499,6 +499,15 @@ rgephy_reset(struct mii_softc *sc)
}
}
 
+   if (sc->mii_mpd_rev >= 2) {
+   pcr = PHY_READ(sc, RGEPHY_MII_PCR);
+   if ((pcr & RGEPHY_PCR_MDIX_AUTO) == 0) {
+   pcr &= ~RGEPHY_PCR_MDI_MASK;
+   pcr |= RGEPHY_PCR_MDIX_AUTO;
+   PHY_WRITE(sc, RGEPHY_MII_PCR, pcr);
+   }
+   }
+
mii_phy_reset(sc);
DELAY(1000);
rgephy_load_dspcode(sc);

Modified: head/sys/dev/mii/rgephyreg.h
==
--- head/sys/dev/mii/rgephyreg.hWed Mar 20 05:23:23 2013
(r248541)
+++ head/sys/dev/mii/rgephyreg.hWed Mar 20 05:31:34 2013
(r248542)
@@ -138,6 +138,17 @@
 #define RGEPHY_EXTSTS_T_HD_CAP 0x1000  /* 1000base-T HD capable */
 
 /* RTL8211B(L)/RTL8211C(L) */
+#define RGEPHY_MII_PCR 0x10/* PHY Specific control register */
+#define RGEPHY_PCR_ASSERT_CRS  0x0800
+#define RGEPHY_PCR_FORCE_LINK  0x0400
+#define RGEPHY_PCR_MDI_MASK0x0060
+#define RGEPHY_PCR_MDIX_AUTO   0x0040
+#define RGEPHY_PCR_MDIX_MANUAL 0x0020
+#define RGEPHY_PCR_MDI_MANUAL  0x
+#define RGEPHY_PCR_CLK125_DIS  0x0010
+#define RGEPHY_PCR_JABBER_DIS  0x0001
+
+/* RTL8211B(L)/RTL8211C(L) */
 #define RGEPHY_MII_SSR 0x11/* PHY Specific status register */
 #defineRGEPHY_SSR_S10000x8000  /* 1000Mbps */
 #defineRGEPHY_SSR_S100 0x4000  /* 100Mbps */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r248539 - head/sys/net80211

2013-03-19 Thread Adrian Chadd
Author: adrian
Date: Wed Mar 20 02:42:52 2013
New Revision: 248539
URL: http://svnweb.freebsd.org/changeset/base/248539

Log:
  Add VNET wrappers around the rest of the ieee80211 rtsock messages.
  
  I triggered the cac/radar messages when doing testing in DFS channels.

Modified:
  head/sys/net80211/ieee80211_freebsd.c

Modified: head/sys/net80211/ieee80211_freebsd.c
==
--- head/sys/net80211/ieee80211_freebsd.c   Tue Mar 19 22:27:15 2013
(r248538)
+++ head/sys/net80211/ieee80211_freebsd.c   Wed Mar 20 02:42:52 2013
(r248539)
@@ -702,7 +702,9 @@ ieee80211_notify_csa(struct ieee80211com
iev.iev_ieee = c->ic_ieee;
iev.iev_mode = mode;
iev.iev_count = count;
+   CURVNET_SET(ifp->if_vnet);
rt_ieee80211msg(ifp, RTM_IEEE80211_CSA, &iev, sizeof(iev));
+   CURVNET_RESTORE();
 }
 
 void
@@ -716,7 +718,9 @@ ieee80211_notify_radar(struct ieee80211c
iev.iev_flags = c->ic_flags;
iev.iev_freq = c->ic_freq;
iev.iev_ieee = c->ic_ieee;
+   CURVNET_SET(ifp->if_vnet);
rt_ieee80211msg(ifp, RTM_IEEE80211_RADAR, &iev, sizeof(iev));
+   CURVNET_RESTORE();
 }
 
 void
@@ -731,7 +735,9 @@ ieee80211_notify_cac(struct ieee80211com
iev.iev_freq = c->ic_freq;
iev.iev_ieee = c->ic_ieee;
iev.iev_type = type;
+   CURVNET_SET(ifp->if_vnet);
rt_ieee80211msg(ifp, RTM_IEEE80211_CAC, &iev, sizeof(iev));
+   CURVNET_RESTORE();
 }
 
 void
@@ -767,7 +773,9 @@ ieee80211_notify_country(struct ieee8021
IEEE80211_ADDR_COPY(iev.iev_addr, bssid);
iev.iev_cc[0] = cc[0];
iev.iev_cc[1] = cc[1];
+   CURVNET_SET(ifp->if_vnet);
rt_ieee80211msg(ifp, RTM_IEEE80211_COUNTRY, &iev, sizeof(iev));
+   CURVNET_RESTORE();
 }
 
 void
@@ -778,7 +786,9 @@ ieee80211_notify_radio(struct ieee80211c
 
memset(&iev, 0, sizeof(iev));
iev.iev_state = state;
+   CURVNET_SET(ifp->if_vnet);
rt_ieee80211msg(ifp, RTM_IEEE80211_RADIO, &iev, sizeof(iev));
+   CURVNET_RESTORE();
 }
 
 void
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r248535 - head/sbin/shutdown

2013-03-19 Thread Joel Dahl
Author: joel (doc committer)
Date: Tue Mar 19 21:40:14 2013
New Revision: 248535
URL: http://svnweb.freebsd.org/changeset/base/248535

Log:
  Add simple example.

Modified:
  head/sbin/shutdown/shutdown.8

Modified: head/sbin/shutdown/shutdown.8
==
--- head/sbin/shutdown/shutdown.8   Tue Mar 19 20:58:17 2013
(r248534)
+++ head/sbin/shutdown/shutdown.8   Tue Mar 19 21:40:14 2013
(r248535)
@@ -28,7 +28,7 @@
 .\" @(#)shutdown.8 8.2 (Berkeley) 4/27/95
 .\" $FreeBSD$
 .\"
-.Dd July 13, 2011
+.Dd March 19, 2013
 .Dt SHUTDOWN 8
 .Os
 .Sh NAME
@@ -189,6 +189,11 @@ tells
 .Xr login 1
 not to let anyone log in
 .El
+.Sh EXAMPLES
+Reboot the system in 30 minutes and display a warning message on the terminals
+of all users currently logged in:
+.Pp
+.Dl # shutdown -r +30 \&"System will reboot\&"
 .Sh COMPATIBILITY
 The hours and minutes in the second time format may be separated by
 a colon (``:'') for backward compatibility.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r248534 - in head: lib/libc/sys share/man/man4 sys/kern sys/sys

2013-03-19 Thread Jilles Tjoelker
Author: jilles
Date: Tue Mar 19 20:58:17 2013
New Revision: 248534
URL: http://svnweb.freebsd.org/changeset/base/248534

Log:
  Implement SOCK_CLOEXEC, SOCK_NONBLOCK and MSG_CMSG_CLOEXEC.
  
  This change allows creating file descriptors with close-on-exec set in some
  situations. SOCK_CLOEXEC and SOCK_NONBLOCK can be OR'ed in socket() and
  socketpair()'s type parameter, and MSG_CMSG_CLOEXEC to recvmsg() makes file
  descriptors (SCM_RIGHTS) atomically close-on-exec.
  
  The numerical values for SOCK_CLOEXEC and SOCK_NONBLOCK are as in NetBSD.
  MSG_CMSG_CLOEXEC is the first free bit for MSG_*.
  
  The SOCK_* flags are not passed to MAC because this may cause incorrect
  failures and can be done later via fcntl() anyway. On the other hand, audit
  is expected to cope with the new flags.
  
  For MSG_CMSG_CLOEXEC, unp_externalize() is extended to take a flags
  argument.
  
  Reviewed by:  kib

Modified:
  head/lib/libc/sys/recv.2
  head/lib/libc/sys/socket.2
  head/lib/libc/sys/socketpair.2
  head/share/man/man4/unix.4
  head/sys/kern/uipc_socket.c
  head/sys/kern/uipc_syscalls.c
  head/sys/kern/uipc_usrreq.c
  head/sys/sys/domain.h
  head/sys/sys/socket.h

Modified: head/lib/libc/sys/recv.2
==
--- head/lib/libc/sys/recv.2Tue Mar 19 20:20:00 2013(r248533)
+++ head/lib/libc/sys/recv.2Tue Mar 19 20:58:17 2013(r248534)
@@ -28,7 +28,7 @@
 .\" @(#)recv.2 8.3 (Berkeley) 2/21/94
 .\" $FreeBSD$
 .\"
-.Dd September 12, 2012
+.Dd March 19, 2013
 .Dt RECV 2
 .Os
 .Sh NAME
@@ -121,11 +121,12 @@ argument to a
 function is formed by
 .Em or Ap ing
 one or more of the values:
-.Bl -column ".Dv MSG_DONTWAIT" -offset indent
+.Bl -column ".Dv MSG_CMSG_CLOEXEC" -offset indent
 .It Dv MSG_OOB Ta process out-of-band data
 .It Dv MSG_PEEK Ta peek at incoming message
 .It Dv MSG_WAITALL Ta wait for full request or error
 .It Dv MSG_DONTWAIT Ta do not block
+.It Dv MSG_CMSG_CLOEXEC Ta set received fds close-on-exec
 .El
 .Pp
 The
@@ -227,6 +228,10 @@ and
 .Fa cmsg_type
 set to
 .Dv SCM_RIGHTS .
+The close-on-exec flag on received descriptors is set according to the
+.Dv MSG_CMSG_CLOEXEC
+flag passed to
+.Fn recvmsg .
 .Pp
 Process credentials can also be passed as ancillary data for
 .Dv AF_UNIX

Modified: head/lib/libc/sys/socket.2
==
--- head/lib/libc/sys/socket.2  Tue Mar 19 20:20:00 2013(r248533)
+++ head/lib/libc/sys/socket.2  Tue Mar 19 20:58:17 2013(r248534)
@@ -28,7 +28,7 @@
 .\" From: @(#)socket.2 8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd December 7, 2012
+.Dd March 19, 2013
 .Dt SOCKET 2
 .Os
 .Sh NAME
@@ -115,6 +115,15 @@ which is available only to the super-use
 which is planned,
 but not yet implemented, are not described here.
 .Pp
+Additionally, the following flags are allowed in the
+.Fa type
+argument:
+.Pp
+.Bd -literal -offset indent -compact
+SOCK_CLOEXEC   Set close-on-exec on the new descriptor,
+SOCK_NONBLOCK  Set non-blocking mode on the new socket
+.Ed
+.Pp
 The
 .Fa protocol
 argument

Modified: head/lib/libc/sys/socketpair.2
==
--- head/lib/libc/sys/socketpair.2  Tue Mar 19 20:20:00 2013
(r248533)
+++ head/lib/libc/sys/socketpair.2  Tue Mar 19 20:58:17 2013
(r248534)
@@ -28,7 +28,7 @@
 .\" @(#)socketpair.2   8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd June 4, 1993
+.Dd March 19, 2013
 .Dt SOCKETPAIR 2
 .Os
 .Sh NAME
@@ -57,6 +57,14 @@ are returned in
 and
 .Fa sv Ns [1] .
 The two sockets are indistinguishable.
+.Pp
+The
+.Dv SOCK_CLOEXEC
+and
+.Dv SOCK_NONBLOCK
+flags in the
+.Fa type
+argument apply to both descriptors.
 .Sh RETURN VALUES
 .Rv -std socketpair
 .Sh ERRORS
@@ -79,6 +87,7 @@ process address space.
 .Sh SEE ALSO
 .Xr pipe 2 ,
 .Xr read 2 ,
+.Xr socket 2 ,
 .Xr write 2
 .Sh HISTORY
 The

Modified: head/share/man/man4/unix.4
==
--- head/share/man/man4/unix.4  Tue Mar 19 20:20:00 2013(r248533)
+++ head/share/man/man4/unix.4  Tue Mar 19 20:58:17 2013(r248534)
@@ -32,7 +32,7 @@
 .\" @(#)unix.4 8.1 (Berkeley) 6/9/93
 .\" $FreeBSD$
 .\"
-.Dd November 16, 2012
+.Dd March 19, 2013
 .Dt UNIX 4
 .Os
 .Sh NAME
@@ -153,13 +153,15 @@ plus the size of the array of file descr
 .Pp
 The received descriptor is a
 .Em duplicate
-of the sender's descriptor, as if it were created with a call to
-.Xr dup 2 .
-Per-process descriptor flags, set with
-.Xr fcntl 2 ,
-are
-.Em not
-passed to a receiver.
+of the sender's descriptor, as if it were created via
+.Li dup(fd)
+or
+.Li fcntl(fd, F_DUPFD_CLOEXEC, 0)
+depending on whether
+.Dv MSG_CMSG_CLOEXEC
+is passed in the
+.Xr recvmsg 2
+call.
 Descriptors that are awaiting delivery, or that are
 purposely not received, are automatically closed by 

svn commit: r248529 - head/sys/dev/ath

2013-03-19 Thread Adrian Chadd
Author: adrian
Date: Tue Mar 19 19:32:28 2013
New Revision: 248529
URL: http://svnweb.freebsd.org/changeset/base/248529

Log:
  Break out the RX completion path into "FIFO check / refill" and
  "complete RX frames."
  
  The 128 entry RX FIFO is really easy to fill up and miss refilling
  when it's done in the ath taskq - as that gets blocked up doing
  RX completion, TX completion and other random things.
  
  So the 128 entry RX FIFO now gets emptied and refilled in the ath_intr()
  task (and it grabs / releases locks, so now ath_intr() can't just be
  a FAST handler yet!) but the locks aren't held for very long. The
  completion part is done in the ath taskqueue context.
  
  Details:
  
  * Create a new completed frame list - sc->sc_rx_rxlist;
  * Split the EDMA RX process queue into two halves - one that
processes the RX FIFO and refills it with new frames; another
that completes the completed frame list;
  * When tearing down the driver, flush whatever is in the deferred
queue as well as what's in the FIFO;
  * Create two new RX methods - one that processes all RX queues,
one that processes the given RX queue.  When MSI is implemented,
we get told which RX queue the interrupt came in on so we can
specifically schedule that.  (And I can do that with the non-MSI
path too; I'll figure that out later.)
  * Convert the legacy code over to use these new RX methods;
  * Replace all the instances of the RX taskqueue enqueue with a call
to a relevant RX method to enqueue one or all RX queues.
  
  Tested:
  
  * AR9380, STA
  * AR9580, STA
  * AR5413, STA

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_rx.c
  head/sys/dev/ath/if_ath_rx_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 Mar 19 17:55:36 2013(r248528)
+++ head/sys/dev/ath/if_ath.c   Tue Mar 19 19:32:28 2013(r248529)
@@ -837,6 +837,11 @@ ath_attach(u_int16_t devid, struct ath_s
}
 
/*
+* Initialise the deferred completed RX buffer list.
+*/
+   TAILQ_INIT(&sc->sc_rx_rxlist);
+
+   /*
 * Indicate we need the 802.11 header padded to a
 * 32-bit boundary for 4-address and QoS frames.
 */
@@ -1711,7 +1716,7 @@ ath_intr(void *arg)
 * traffic so any frames held on the staging
 * queue are aged and potentially flushed.
 */
-   taskqueue_enqueue(sc->sc_tq, &sc->sc_rxtask);
+   sc->sc_rx.recv_sched(sc, 1);
 #endif
}
}
@@ -1751,13 +1756,13 @@ ath_intr(void *arg)
if (! sc->sc_kickpcu)
sc->sc_rxlink = NULL;
sc->sc_kickpcu = 1;
+   ATH_PCU_UNLOCK(sc);
/*
 * Enqueue an RX proc, to handled whatever
 * is in the RX queue.
 * This will then kick the PCU.
 */
-   taskqueue_enqueue(sc->sc_tq, &sc->sc_rxtask);
-   ATH_PCU_UNLOCK(sc);
+   sc->sc_rx.recv_sched(sc, 1);
}
if (status & HAL_INT_TXURN) {
sc->sc_stats.ast_txurn++;
@@ -1770,7 +1775,7 @@ ath_intr(void *arg)
 */
if (status & (HAL_INT_RX | HAL_INT_RXHP | HAL_INT_RXLP)) {
sc->sc_stats.ast_rx_intr++;
-   taskqueue_enqueue(sc->sc_tq, &sc->sc_rxtask);
+   sc->sc_rx.recv_sched(sc, 1);
}
if (status & HAL_INT_TX) {
sc->sc_stats.ast_tx_intr++;

Modified: head/sys/dev/ath/if_ath_rx.c
==
--- head/sys/dev/ath/if_ath_rx.cTue Mar 19 17:55:36 2013
(r248528)
+++ head/sys/dev/ath/if_ath_rx.cTue Mar 19 19:32:28 2013
(r248529)
@@ -1030,7 +1030,7 @@ rx_proc_next:
 * will reduce latency.
 */
if (npkts >= ATH_RX_MAX)
-   taskqueue_enqueue(sc->sc_tq, &sc->sc_rxtask);
+   sc->sc_rx.recv_sched(sc, resched);
 
ATH_PCU_LOCK(sc);
sc->sc_rxproc_cnt--;
@@ -1181,6 +1181,21 @@ ath_legacy_dma_rxteardown(struct ath_sof
return (0);
 }
 
+static void
+ath_legacy_recv_sched(struct ath_softc *sc, int dosched)
+{
+
+   taskqueue_enqueue(sc->sc_tq, &sc->sc_rxtask);
+}
+
+static void
+ath_legacy_recv_sched_queue(struct ath_softc *sc, HAL_RX_QUEUE q,
+int dosched)
+{
+
+   taskqueue_enqueue(sc->sc_tq, &sc->sc_rxtask);
+}
+
 void
 ath_recv_setup_legacy(struct ath_softc *sc)
 {
@@ -1200,4 +1215,6 @@ ath_recv_setup_legacy(struct ath_sof

svn commit: r248528 - head/sys/dev/ath

2013-03-19 Thread Adrian Chadd
Author: adrian
Date: Tue Mar 19 17:55:36 2013
New Revision: 248528
URL: http://svnweb.freebsd.org/changeset/base/248528

Log:
  Add more TODO items.

Modified:
  head/sys/dev/ath/if_ath_beacon.c

Modified: head/sys/dev/ath/if_ath_beacon.c
==
--- head/sys/dev/ath/if_ath_beacon.cTue Mar 19 17:54:37 2013
(r248527)
+++ head/sys/dev/ath/if_ath_beacon.cTue Mar 19 17:55:36 2013
(r248528)
@@ -570,7 +570,14 @@ ath_beacon_generate(struct ath_softc *sc
 
/*
 * Move frames from the s/w mcast q to the h/w cab q.
-* XXX MORE_DATA bit
+* XXX TODO: walk the list, update MORE_DATA bit
+* XXX TODO: or maybe, set the MORE data bit in the
+*   TX descriptor(s) here?
+*
+* XXX TODO: we're still pushing a CABQ frame list to
+*   AR9380 hosts; but we don't (yet) populate
+*   the ATH_BUF_BUSY flag in the EDMA
+*   completion task (for CABQ, though!)
 */
bfm = TAILQ_FIRST(&avp->av_mcastq.axq_q);
if (cabq->axq_link != NULL) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r248527 - head/sys/dev/ath

2013-03-19 Thread Adrian Chadd
Author: adrian
Date: Tue Mar 19 17:54:37 2013
New Revision: 248527
URL: http://svnweb.freebsd.org/changeset/base/248527

Log:
  Now that the tx map field is correctly populated for both edma and
  legacy chips, just use that.

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.cTue Mar 19 17:13:47 2013
(r248526)
+++ head/sys/dev/ath/if_ath_tx.cTue Mar 19 17:54:37 2013
(r248527)
@@ -384,14 +384,11 @@ ath_tx_chaindesclist(struct ath_softc *s
 */
 
/*
-* For now the HAL doesn't implement halNumTxMaps for non-EDMA
-* (ie it's 0.)  So just work around it.
-*
-* XXX TODO: populate halNumTxMaps for each HAL chip and
-* then undo this hack.
+* We need the number of TX data pointers in each descriptor.
+* EDMA and later chips support 4 TX buffers per descriptor;
+* previous chips just support one.
 */
-   if (sc->sc_ah->ah_magic == 0x19741014)
-   numTxMaps = 4;
+   numTxMaps = sc->sc_tx_nmaps;
 
/*
 * For EDMA and later chips ensure the TX map is fully populated
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r248525 - head/sbin/ldconfig

2013-03-19 Thread Warner Losh
Author: imp
Date: Tue Mar 19 16:57:04 2013
New Revision: 248525
URL: http://svnweb.freebsd.org/changeset/base/248525

Log:
  Add a comment about why aout support is still here: We need it for
  compat2x, which is still in use, as evidence by recent bug reports.

Modified:
  head/sbin/ldconfig/ldconfig.c

Modified: head/sbin/ldconfig/ldconfig.c
==
--- head/sbin/ldconfig/ldconfig.c   Tue Mar 19 16:33:43 2013
(r248524)
+++ head/sbin/ldconfig/ldconfig.c   Tue Mar 19 16:57:04 2013
(r248525)
@@ -97,6 +97,13 @@ static void  listhints(void);
 static int readhints(void);
 static voidusage(void);
 
+/*
+ * Note on aout/a.out support.
+ * To properly support shared libraries for compat2x, which are a.out, we need
+ * to support a.out here.  As of 2013, bug reports are still coming in for this
+ * feature (on amd64 no less), so we know it is still in use.
+ */
+
 int
 main(int argc, char **argv)
 {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r248522 - in head/sys/dev: ahci siis

2013-03-19 Thread Konstantin Belousov
Author: kib
Date: Tue Mar 19 15:09:32 2013
New Revision: 248522
URL: http://svnweb.freebsd.org/changeset/base/248522

Log:
  ahci(4) and siis(4) are ready to process the unmapped i/o requests
  
  Sponsored by: The FreeBSD Foundation
  Tested by:pho
  Submitted by: bf (siis patch)

Modified:
  head/sys/dev/ahci/ahci.c
  head/sys/dev/siis/siis.c

Modified: head/sys/dev/ahci/ahci.c
==
--- head/sys/dev/ahci/ahci.cTue Mar 19 15:08:15 2013(r248521)
+++ head/sys/dev/ahci/ahci.cTue Mar 19 15:09:32 2013(r248522)
@@ -2903,7 +2903,7 @@ ahciaction(struct cam_sim *sim, union cc
if (ch->caps & AHCI_CAP_SPM)
cpi->hba_inquiry |= PI_SATAPM;
cpi->target_sprt = 0;
-   cpi->hba_misc = PIM_SEQSCAN;
+   cpi->hba_misc = PIM_SEQSCAN | PIM_UNMAPPED;
cpi->hba_eng_cnt = 0;
if (ch->caps & AHCI_CAP_SPM)
cpi->max_target = 15;

Modified: head/sys/dev/siis/siis.c
==
--- head/sys/dev/siis/siis.cTue Mar 19 15:08:15 2013(r248521)
+++ head/sys/dev/siis/siis.cTue Mar 19 15:09:32 2013(r248522)
@@ -1939,7 +1939,7 @@ siisaction(struct cam_sim *sim, union cc
cpi->hba_inquiry = PI_SDTR_ABLE | PI_TAG_ABLE;
cpi->hba_inquiry |= PI_SATAPM;
cpi->target_sprt = 0;
-   cpi->hba_misc = PIM_SEQSCAN;
+   cpi->hba_misc = PIM_SEQSCAN | PIM_UNMAPPED;
cpi->hba_eng_cnt = 0;
cpi->max_target = 15;
cpi->max_lun = 0;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r248521 - in head/sys/ufs: ffs ufs

2013-03-19 Thread Konstantin Belousov
Author: kib
Date: Tue Mar 19 15:08:15 2013
New Revision: 248521
URL: http://svnweb.freebsd.org/changeset/base/248521

Log:
  UFS support of the unmapped i/o for the user data buffers.
  
  Sponsored by: The FreeBSD Foundation
  Tested by:pho, scottl, jhb, bf

Modified:
  head/sys/ufs/ffs/ffs_alloc.c
  head/sys/ufs/ffs/ffs_balloc.c
  head/sys/ufs/ffs/ffs_vfsops.c
  head/sys/ufs/ffs/ffs_vnops.c
  head/sys/ufs/ufs/ufs_extern.h

Modified: head/sys/ufs/ffs/ffs_alloc.c
==
--- head/sys/ufs/ffs/ffs_alloc.cTue Mar 19 15:05:21 2013
(r248520)
+++ head/sys/ufs/ffs/ffs_alloc.cTue Mar 19 15:08:15 2013
(r248521)
@@ -254,7 +254,7 @@ ffs_realloccg(ip, lbprev, bprev, bpref, 
struct buf *bp;
struct ufsmount *ump;
u_int cg, request, reclaimed;
-   int error;
+   int error, gbflags;
ufs2_daddr_t bno;
static struct timeval lastfail;
static int curfail;
@@ -265,6 +265,8 @@ ffs_realloccg(ip, lbprev, bprev, bpref, 
fs = ip->i_fs;
bp = NULL;
ump = ip->i_ump;
+   gbflags = (flags & BA_UNMAPPED) != 0 ? GB_UNMAPPED : 0;
+
mtx_assert(UFS_MTX(ump), MA_OWNED);
 #ifdef INVARIANTS
if (vp->v_mount->mnt_kern_flag & MNTK_SUSPENDED)
@@ -296,7 +298,7 @@ retry:
/*
 * Allocate the extra space in the buffer.
 */
-   error = bread(vp, lbprev, osize, NOCRED, &bp);
+   error = bread_gb(vp, lbprev, osize, NOCRED, gbflags, &bp);
if (error) {
brelse(bp);
return (error);
@@ -332,7 +334,7 @@ retry:
ip->i_flag |= IN_CHANGE | IN_UPDATE;
allocbuf(bp, nsize);
bp->b_flags |= B_DONE;
-   bzero(bp->b_data + osize, nsize - osize);
+   vfs_bio_bzero_buf(bp, osize, nsize - osize);
if ((bp->b_flags & (B_MALLOC | B_VMIO)) == B_VMIO)
vfs_bio_set_valid(bp, osize, nsize - osize);
*bpp = bp;
@@ -400,7 +402,7 @@ retry:
ip->i_flag |= IN_CHANGE | IN_UPDATE;
allocbuf(bp, nsize);
bp->b_flags |= B_DONE;
-   bzero(bp->b_data + osize, nsize - osize);
+   vfs_bio_bzero_buf(bp, osize, nsize - osize);
if ((bp->b_flags & (B_MALLOC | B_VMIO)) == B_VMIO)
vfs_bio_set_valid(bp, osize, nsize - osize);
*bpp = bp;

Modified: head/sys/ufs/ffs/ffs_balloc.c
==
--- head/sys/ufs/ffs/ffs_balloc.c   Tue Mar 19 15:05:21 2013
(r248520)
+++ head/sys/ufs/ffs/ffs_balloc.c   Tue Mar 19 15:08:15 2013
(r248521)
@@ -107,7 +107,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t 
int saved_inbdflush;
static struct timeval lastfail;
static int curfail;
-   int reclaimed;
+   int gbflags, reclaimed;
 
ip = VTOI(vp);
dp = ip->i_din1;
@@ -123,6 +123,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t 
return (EOPNOTSUPP);
if (lbn < 0)
return (EFBIG);
+   gbflags = (flags & BA_UNMAPPED) != 0 ? GB_UNMAPPED : 0;
 
if (DOINGSOFTDEP(vp))
softdep_prealloc(vp, MNT_WAIT);
@@ -211,7 +212,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t 
nsize, flags, cred, &newb);
if (error)
return (error);
-   bp = getblk(vp, lbn, nsize, 0, 0, 0);
+   bp = getblk(vp, lbn, nsize, 0, 0, gbflags);
bp->b_blkno = fsbtodb(fs, newb);
if (flags & BA_CLRBUF)
vfs_bio_clrbuf(bp);
@@ -255,7 +256,7 @@ ffs_balloc_ufs1(struct vnode *vp, off_t 
nb = newb;
*allocblk++ = nb;
*lbns_remfree++ = indirs[1].in_lbn;
-   bp = getblk(vp, indirs[1].in_lbn, fs->fs_bsize, 0, 0, 0);
+   bp = getblk(vp, indirs[1].in_lbn, fs->fs_bsize, 0, 0, gbflags);
bp->b_blkno = fsbtodb(fs, nb);
vfs_bio_clrbuf(bp);
if (DOINGSOFTDEP(vp)) {
@@ -389,7 +390,7 @@ retry:
nb = newb;
*allocblk++ = nb;
*lbns_remfree++ = lbn;
-   nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0, 0);
+   nbp = getblk(vp, lbn, fs->fs_bsize, 0, 0, gbflags);
nbp->b_blkno = fsbtodb(fs, nb);
if (flags & BA_CLRBUF)
vfs_bio_clrbuf(nbp);
@@ -418,16 +419,17 @@ retry:
if (seqcount && (vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) {
error = cluster_read(vp, ip->i_size, lbn,
(int)fs->fs_bsize, NOCRED,
-   MAXBSIZE, seqcount, 0, &nbp);
+  

svn commit: r248520 - head/sys/cam

2013-03-19 Thread Konstantin Belousov
Author: kib
Date: Tue Mar 19 15:05:21 2013
New Revision: 248520
URL: http://svnweb.freebsd.org/changeset/base/248520

Log:
  Commit the removal of a whitespace to record the proper commit message
  for the r248519:
  
  For the cam-attached HBAs, allow the driver to specify that it accepts
  the unmapped bio by the PIM_UNMAPPED flag.  The CAM passes the
  CAM_DATA_BIO data transfer type request for the unmapped bio, and the
  driver could use the bus_dmamap_load_ccb() as a helper to
  transparently handle the ccb.
  
  Sponsored by: The FreeBSD Foundation
  Reviewed by:  scottl
  Tested by:pho, scottl

Modified:
  head/sys/cam/cam_ccb.h

Modified: head/sys/cam/cam_ccb.h
==
--- head/sys/cam/cam_ccb.h  Tue Mar 19 15:01:50 2013(r248519)
+++ head/sys/cam/cam_ccb.h  Tue Mar 19 15:05:21 2013(r248520)
@@ -99,7 +99,7 @@ typedef enum {
CAM_MSGB_VALID  = 0x1000,/* Message buffer valid  */
CAM_STATUS_VALID= 0x2000,/* Status buffer valid   */
CAM_DATAB_VALID = 0x4000,/* Data buffer valid */
-   
+
 /* Host target Mode flags */
CAM_SEND_SENSE  = 0x0800,/* Send sense data with status   */
CAM_TERM_IO = 0x1000,/* Terminate I/O Message sup.*/
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r248519 - in head/sys/cam: . ata scsi

2013-03-19 Thread Konstantin Belousov
Author: kib
Date: Tue Mar 19 15:01:50 2013
New Revision: 248519
URL: http://svnweb.freebsd.org/changeset/base/248519

Log:
  Support unmapped i/o for the md(4).
  
  The vnode-backed md(4) has to map the unmapped bio because VOP_READ()
  and VOP_WRITE() interfaces do not allow to pass unmapped requests to
  the filesystem. Vnode-backed md(4) uses pbufs instead of relying on
  the bio_transient_map, to avoid usual md deadlock.
  
  Sponsored by: The FreeBSD Foundation
  Tested by:pho, scottl

Modified:
  head/sys/cam/ata/ata_da.c
  head/sys/cam/cam_ccb.h
  head/sys/cam/scsi/scsi_all.c
  head/sys/cam/scsi/scsi_all.h
  head/sys/cam/scsi/scsi_cd.c
  head/sys/cam/scsi/scsi_da.c

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Tue Mar 19 14:53:23 2013(r248518)
+++ head/sys/cam/ata/ata_da.c   Tue Mar 19 15:01:50 2013(r248519)
@@ -1167,6 +1167,8 @@ adaregister(struct cam_periph *periph, v
((softc->flags & ADA_FLAG_CAN_CFA) &&
!(softc->flags & ADA_FLAG_CAN_48BIT)))
softc->disk->d_flags |= DISKFLAG_CANDELETE;
+   if ((cpi.hba_misc & PIM_UNMAPPED) != 0)
+   softc->disk->d_flags |= DISKFLAG_UNMAPPED_BIO;
strlcpy(softc->disk->d_descr, cgd->ident_data.model,
MIN(sizeof(softc->disk->d_descr), sizeof(cgd->ident_data.model)));
strlcpy(softc->disk->d_ident, cgd->ident_data.serial,
@@ -1431,13 +1433,19 @@ adastart(struct cam_periph *periph, unio
return;
}
 #endif
+   KASSERT((bp->bio_flags & BIO_UNMAPPED) == 0 ||
+   round_page(bp->bio_bcount + bp->bio_ma_offset) /
+   PAGE_SIZE == bp->bio_ma_n,
+   ("Short bio %p", bp));
cam_fill_ataio(ataio,
ada_retry_count,
adadone,
-   bp->bio_cmd == BIO_READ ?
-   CAM_DIR_IN : CAM_DIR_OUT,
+   (bp->bio_cmd == BIO_READ ? CAM_DIR_IN :
+   CAM_DIR_OUT) | ((bp->bio_flags & BIO_UNMAPPED)
+   != 0 ? CAM_DATA_BIO : 0),
tag_code,
-   bp->bio_data,
+   ((bp->bio_flags & BIO_UNMAPPED) != 0) ? (void *)bp :
+   bp->bio_data,
bp->bio_bcount,
ada_default_timeout*1000);
 

Modified: head/sys/cam/cam_ccb.h
==
--- head/sys/cam/cam_ccb.h  Tue Mar 19 14:53:23 2013(r248518)
+++ head/sys/cam/cam_ccb.h  Tue Mar 19 15:01:50 2013(r248519)
@@ -42,7 +42,6 @@
 #include 
 #include 
 
-
 /* General allocation length definitions for CCB structures */
 #defineIOCDBLENCAM_MAX_CDBLEN  /* Space for CDB bytes/pointer 
*/
 #defineVUHBALEN14  /* Vendor Unique HBA length */
@@ -572,7 +571,8 @@ typedef enum {
PIM_NOINITIATOR = 0x20, /* Initiator role not supported. */
PIM_NOBUSRESET  = 0x10, /* User has disabled initial BUS RESET */
PIM_NO_6_BYTE   = 0x08, /* Do not send 6-byte commands */
-   PIM_SEQSCAN = 0x04  /* Do bus scans sequentially, not in parallel */
+   PIM_SEQSCAN = 0x04, /* Do bus scans sequentially, not in parallel */
+   PIM_UNMAPPED= 0x02,
 } pi_miscflag;
 
 /* Path Inquiry CCB */

Modified: head/sys/cam/scsi/scsi_all.c
==
--- head/sys/cam/scsi/scsi_all.cTue Mar 19 14:53:23 2013
(r248518)
+++ head/sys/cam/scsi/scsi_all.cTue Mar 19 15:01:50 2013
(r248519)
@@ -5679,7 +5679,11 @@ scsi_read_write(struct ccb_scsiio *csio,
u_int8_t *data_ptr, u_int32_t dxfer_len, u_int8_t sense_len,
u_int32_t timeout)
 {
+   int read;
u_int8_t cdb_len;
+
+   read = (readop & SCSI_RW_DIRMASK) == SCSI_RW_READ;
+
/*
 * Use the smallest possible command to perform the operation
 * as some legacy hardware does not support the 10 byte commands.
@@ -5696,7 +5700,7 @@ scsi_read_write(struct ccb_scsiio *csio,
struct scsi_rw_6 *scsi_cmd;
 
scsi_cmd = (struct scsi_rw_6 *)&csio->cdb_io.cdb_bytes;
-   scsi_cmd->opcode = readop ? READ_6 : WRITE_6;
+   scsi_cmd->opcode = read ? READ_6 : WRITE_6;
scsi_ulto3b(lba, scsi_cmd->addr);
scsi_cmd->length = block_count & 0xff;
scsi_cmd->control = 0;
@@ -5715,7 +5719,7 @@ scsi_read_write(struct ccb_scsiio *csio,
struct scsi_rw_10 *scsi_cmd;
 
scsi_cmd = (struct scsi_rw_10 *)&csio->cdb_io.cdb_bytes;

svn commit: r248518 - head/sys/dev/md

2013-03-19 Thread Konstantin Belousov
Author: kib
Date: Tue Mar 19 14:53:23 2013
New Revision: 248518
URL: http://svnweb.freebsd.org/changeset/base/248518

Log:
  Support unmapped i/o for the md(4).
  
  The vnode-backed md(4) has to map the unmapped bio because VOP_READ()
  and VOP_WRITE() interfaces do not allow to pass unmapped requests to
  the filesystem. Vnode-backed md(4) uses pbufs instead of relying on
  the bio_transient_map, to avoid usual md deadlock.
  
  Sponsored by: The FreeBSD Foundation
  Tested by:pho, scottl

Modified:
  head/sys/dev/md/md.c

Modified: head/sys/dev/md/md.c
==
--- head/sys/dev/md/md.cTue Mar 19 14:50:24 2013(r248517)
+++ head/sys/dev/md/md.cTue Mar 19 14:53:23 2013(r248518)
@@ -18,11 +18,16 @@
  * Copyright (c) 1988 University of Utah.
  * Copyright (c) 1990, 1993
  * The Regents of the University of California.  All rights reserved.
+ * Copyright (c) 2013 The FreeBSD Foundation
+ * All rights reserved.
  *
  * This code is derived from software contributed to Berkeley by
  * the Systems Programming Group of the University of Utah Computer
  * Science Department.
  *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -59,6 +64,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -169,6 +175,8 @@ static LIST_HEAD(, md_s) md_softc_list =
 #define NMASK  (NINDIR-1)
 static int nshift;
 
+static int md_vnode_pbuf_freecnt;
+
 struct indir {
uintptr_t   *array;
u_int   total;
@@ -415,11 +423,103 @@ g_md_start(struct bio *bp)
wakeup(sc);
 }
 
+#defineMD_MALLOC_MOVE_ZERO 1
+#defineMD_MALLOC_MOVE_FILL 2
+#defineMD_MALLOC_MOVE_READ 3
+#defineMD_MALLOC_MOVE_WRITE4
+#defineMD_MALLOC_MOVE_CMP  5
+
+static int
+md_malloc_move(vm_page_t **mp, int *ma_offs, unsigned sectorsize,
+void *ptr, u_char fill, int op)
+{
+   struct sf_buf *sf;
+   vm_page_t m, *mp1;
+   char *p, first;
+   off_t *uc;
+   unsigned n;
+   int error, i, ma_offs1, sz, first_read;
+
+   m = NULL;
+   error = 0;
+   sf = NULL;
+   /* if (op == MD_MALLOC_MOVE_CMP) { gcc */
+   first = 0;
+   first_read = 0;
+   uc = ptr;
+   mp1 = *mp;
+   ma_offs1 = *ma_offs;
+   /* } */
+   sched_pin();
+   for (n = sectorsize; n != 0; n -= sz) {
+   sz = imin(PAGE_SIZE - *ma_offs, n);
+   if (m != **mp) {
+   if (sf != NULL)
+   sf_buf_free(sf);
+   m = **mp;
+   sf = sf_buf_alloc(m, SFB_CPUPRIVATE |
+   (md_malloc_wait ? 0 : SFB_NOWAIT));
+   if (sf == NULL) {
+   error = ENOMEM;
+   break;
+   }
+   }
+   p = (char *)sf_buf_kva(sf) + *ma_offs;
+   switch (op) {
+   case MD_MALLOC_MOVE_ZERO:
+   bzero(p, sz);
+   break;
+   case MD_MALLOC_MOVE_FILL:
+   memset(p, fill, sz);
+   break;
+   case MD_MALLOC_MOVE_READ:
+   bcopy(ptr, p, sz);
+   cpu_flush_dcache(p, sz);
+   break;
+   case MD_MALLOC_MOVE_WRITE:
+   bcopy(p, ptr, sz);
+   break;
+   case MD_MALLOC_MOVE_CMP:
+   for (i = 0; i < sz; i++, p++) {
+   if (!first_read) {
+   *uc = (u_char)*p;
+   first = *p;
+   first_read = 1;
+   } else if (*p != first) {
+   error = EDOOFUS;
+   break;
+   }
+   }
+   break;
+   default:
+   KASSERT(0, ("md_malloc_move unknown op %d\n", op));
+   break;
+   }
+   if (error != 0)
+   break;
+   *ma_offs += sz;
+   *ma_offs %= PAGE_SIZE;
+   if (*ma_offs == 0)
+   (*mp)++;
+   ptr = (char *)ptr + sz;
+   }
+
+   if (sf != NULL)
+   sf_buf_free(sf);
+   sched_unpin();
+   if (op == MD_MALLOC_MOVE_CMP && error != 0) {
+   *mp = mp1;
+   *ma_offs = ma_offs1;
+   }
+  

svn commit: r248517 - head/sys/geom/part

2013-03-19 Thread Konstantin Belousov
Author: kib
Date: Tue Mar 19 14:50:24 2013
New Revision: 248517
URL: http://svnweb.freebsd.org/changeset/base/248517

Log:
  The geom_part provider supports unmapped bio iff the underlying
  provider does so, since geom_part never inspects the bio_data.
  
  Sponsored by: The FreeBSD Foundation
  Tested by:pho

Modified:
  head/sys/geom/part/g_part.c

Modified: head/sys/geom/part/g_part.c
==
--- head/sys/geom/part/g_part.c Tue Mar 19 14:49:15 2013(r248516)
+++ head/sys/geom/part/g_part.c Tue Mar 19 14:50:24 2013(r248517)
@@ -428,6 +428,7 @@ g_part_new_provider(struct g_geom *gp, s
entry->gpe_pp->stripeoffset = pp->stripeoffset + entry->gpe_offset;
if (pp->stripesize > 0)
entry->gpe_pp->stripeoffset %= pp->stripesize;
+   entry->gpe_pp->flags |= pp->flags & G_PF_ACCEPT_UNMAPPED;
g_error_provider(entry->gpe_pp, 0);
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r248516 - head/sys/geom

2013-03-19 Thread Konstantin Belousov
Author: kib
Date: Tue Mar 19 14:49:15 2013
New Revision: 248516
URL: http://svnweb.freebsd.org/changeset/base/248516

Log:
  A flag for the geom disk driver to indicate that it accepts the
  unmapped i/o requests.
  
  Sponsored by: The FreeBSD Foundation
  Tested by:pho

Modified:
  head/sys/geom/geom_disk.c
  head/sys/geom/geom_disk.h

Modified: head/sys/geom/geom_disk.c
==
--- head/sys/geom/geom_disk.c   Tue Mar 19 14:43:57 2013(r248515)
+++ head/sys/geom/geom_disk.c   Tue Mar 19 14:49:15 2013(r248516)
@@ -320,13 +320,29 @@ g_disk_start(struct bio *bp)
do {
bp2->bio_offset += off;
bp2->bio_length -= off;
-   bp2->bio_data += off;
+   if ((bp->bio_flags & BIO_UNMAPPED) == 0) {
+   bp2->bio_data += off;
+   } else {
+   KASSERT((dp->d_flags & DISKFLAG_UNMAPPED_BIO)
+   != 0,
+   ("unmapped bio not supported by disk %s",
+   dp->d_name));
+   bp2->bio_ma += off / PAGE_SIZE;
+   bp2->bio_ma_offset += off;
+   bp2->bio_ma_offset %= PAGE_SIZE;
+   bp2->bio_ma_n -= off / PAGE_SIZE;
+   }
if (bp2->bio_length > dp->d_maxsize) {
/*
 * XXX: If we have a stripesize we should really
 * use it here.
 */
bp2->bio_length = dp->d_maxsize;
+   if ((bp->bio_flags & BIO_UNMAPPED) != 0) {
+   bp2->bio_ma_n = howmany(
+   bp2->bio_ma_offset +
+   bp2->bio_length, PAGE_SIZE);
+   }
off += dp->d_maxsize;
/*
 * To avoid a race, we need to grab the next bio
@@ -488,6 +504,8 @@ g_disk_create(void *arg, int flag)
pp->sectorsize = dp->d_sectorsize;
pp->stripeoffset = dp->d_stripeoffset;
pp->stripesize = dp->d_stripesize;
+   if ((dp->d_flags & DISKFLAG_UNMAPPED_BIO) != 0)
+   pp->flags |= G_PF_ACCEPT_UNMAPPED;
if (bootverbose)
printf("GEOM: new disk %s\n", gp->name);
sysctl_ctx_init(&sc->sysctl_ctx);

Modified: head/sys/geom/geom_disk.h
==
--- head/sys/geom/geom_disk.h   Tue Mar 19 14:43:57 2013(r248515)
+++ head/sys/geom/geom_disk.h   Tue Mar 19 14:49:15 2013(r248516)
@@ -103,6 +103,7 @@ struct disk {
 #define DISKFLAG_OPEN  0x2
 #define DISKFLAG_CANDELETE 0x4
 #define DISKFLAG_CANFLUSHCACHE 0x8
+#defineDISKFLAG_UNMAPPED_BIO   0x10
 
 struct disk *disk_alloc(void);
 void disk_create(struct disk *disk, int version);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r248515 - in head/sys: cam kern sys ufs/ffs

2013-03-19 Thread Konstantin Belousov
Author: kib
Date: Tue Mar 19 14:43:57 2013
New Revision: 248515
URL: http://svnweb.freebsd.org/changeset/base/248515

Log:
  Do not remap usermode pages into KVA for physio.
  
  Sponsored by: The FreeBSD Foundation
  Tested by:pho

Modified:
  head/sys/cam/cam_periph.c
  head/sys/kern/kern_physio.c
  head/sys/kern/vfs_aio.c
  head/sys/kern/vfs_bio.c
  head/sys/sys/buf.h
  head/sys/ufs/ffs/ffs_rawread.c

Modified: head/sys/cam/cam_periph.c
==
--- head/sys/cam/cam_periph.c   Tue Mar 19 14:39:27 2013(r248514)
+++ head/sys/cam/cam_periph.c   Tue Mar 19 14:43:57 2013(r248515)
@@ -850,7 +850,7 @@ cam_periph_mapmem(union ccb *ccb, struct
 * into a larger area of VM, or if userland races against
 * vmapbuf() after the useracc() check.
 */
-   if (vmapbuf(mapinfo->bp[i]) < 0) {
+   if (vmapbuf(mapinfo->bp[i], 1) < 0) {
for (j = 0; j < i; ++j) {
*data_ptrs[j] = mapinfo->bp[j]->b_saveaddr;
vunmapbuf(mapinfo->bp[j]);

Modified: head/sys/kern/kern_physio.c
==
--- head/sys/kern/kern_physio.c Tue Mar 19 14:39:27 2013(r248514)
+++ head/sys/kern/kern_physio.c Tue Mar 19 14:43:57 2013(r248515)
@@ -92,7 +92,7 @@ physio(struct cdev *dev, struct uio *uio
bp->b_blkno = btodb(bp->b_offset);
 
if (uio->uio_segflg == UIO_USERSPACE)
-   if (vmapbuf(bp) < 0) {
+   if (vmapbuf(bp, 0) < 0) {
error = EFAULT;
goto doerror;
}

Modified: head/sys/kern/vfs_aio.c
==
--- head/sys/kern/vfs_aio.c Tue Mar 19 14:39:27 2013(r248514)
+++ head/sys/kern/vfs_aio.c Tue Mar 19 14:43:57 2013(r248515)
@@ -1323,7 +1323,7 @@ aio_qphysio(struct proc *p, struct aiocb
/*
 * Bring buffer into kernel space.
 */
-   if (vmapbuf(bp) < 0) {
+   if (vmapbuf(bp, 1) < 0) {
error = EFAULT;
goto doerror;
}

Modified: head/sys/kern/vfs_bio.c
==
--- head/sys/kern/vfs_bio.c Tue Mar 19 14:39:27 2013(r248514)
+++ head/sys/kern/vfs_bio.c Tue Mar 19 14:43:57 2013(r248515)
@@ -4279,7 +4279,7 @@ vm_hold_free_pages(struct buf *bp, int n
  * check the return value.
  */
 int
-vmapbuf(struct buf *bp)
+vmapbuf(struct buf *bp, int mapbuf)
 {
caddr_t kva;
vm_prot_t prot;
@@ -4294,12 +4294,19 @@ vmapbuf(struct buf *bp)
(vm_offset_t)bp->b_data, bp->b_bufsize, prot, bp->b_pages,
btoc(MAXPHYS))) < 0)
return (-1);
-   pmap_qenter((vm_offset_t)bp->b_saveaddr, bp->b_pages, pidx);
-   
-   kva = bp->b_saveaddr;
bp->b_npages = pidx;
-   bp->b_saveaddr = bp->b_data;
-   bp->b_data = kva + (((vm_offset_t) bp->b_data) & PAGE_MASK);
+   if (mapbuf || !unmapped_buf_allowed) {
+   pmap_qenter((vm_offset_t)bp->b_saveaddr, bp->b_pages, pidx);
+   kva = bp->b_saveaddr;
+   bp->b_saveaddr = bp->b_data;
+   bp->b_data = kva + (((vm_offset_t)bp->b_data) & PAGE_MASK);
+   bp->b_flags &= ~B_UNMAPPED;
+   } else {
+   bp->b_flags |= B_UNMAPPED;
+   bp->b_offset = ((vm_offset_t)bp->b_data) & PAGE_MASK;
+   bp->b_saveaddr = bp->b_data;
+   bp->b_data = unmapped_buf;
+   }
return(0);
 }
 
@@ -4313,7 +4320,10 @@ vunmapbuf(struct buf *bp)
int npages;
 
npages = bp->b_npages;
-   pmap_qremove(trunc_page((vm_offset_t)bp->b_data), npages);
+   if (bp->b_flags & B_UNMAPPED)
+   bp->b_flags &= ~B_UNMAPPED;
+   else
+   pmap_qremove(trunc_page((vm_offset_t)bp->b_data), npages);
vm_page_unhold_pages(bp->b_pages, npages);

bp->b_data = bp->b_saveaddr;

Modified: head/sys/sys/buf.h
==
--- head/sys/sys/buf.h  Tue Mar 19 14:39:27 2013(r248514)
+++ head/sys/sys/buf.h  Tue Mar 19 14:43:57 2013(r248515)
@@ -524,7 +524,7 @@ voidvfs_bio_set_valid(struct buf *, int
 void   vfs_bio_clrbuf(struct buf *);
 void   vfs_busy_pages(struct buf *, int clear_modify);
 void   vfs_unbusy_pages(struct buf *);
-intvmapbuf(struct buf *);
+intvmapbuf(struct buf *, int);
 void   vunmapbuf(struct buf *);
 void   relpbuf(struct buf *, int *);
 void   brelvp(struct buf *);

Modified: head/sys/ufs/ffs/ffs_rawread.c
=

svn commit: r248514 - head/sys/vm

2013-03-19 Thread Konstantin Belousov
Author: kib
Date: Tue Mar 19 14:39:27 2013
New Revision: 248514
URL: http://svnweb.freebsd.org/changeset/base/248514

Log:
  Do not map the swap i/o pbufs if the geom provider for the swap
  partition accepts unmapped requests.
  
  Sponsored by: The FreeBSD Foundation
  Tested by:pho

Modified:
  head/sys/vm/swap_pager.c
  head/sys/vm/swap_pager.h

Modified: head/sys/vm/swap_pager.c
==
--- head/sys/vm/swap_pager.cTue Mar 19 14:39:19 2013(r248513)
+++ head/sys/vm/swap_pager.cTue Mar 19 14:39:27 2013(r248514)
@@ -758,6 +758,17 @@ swp_pager_strategy(struct buf *bp)
TAILQ_FOREACH(sp, &swtailq, sw_list) {
if (bp->b_blkno >= sp->sw_first && bp->b_blkno < sp->sw_end) {
mtx_unlock(&sw_dev_mtx);
+   if ((sp->sw_flags & SW_UNMAPPED) != 0 &&
+   unmapped_buf_allowed) {
+   bp->b_kvaalloc = bp->b_data;
+   bp->b_data = unmapped_buf;
+   bp->b_kvabase = unmapped_buf;
+   bp->b_offset = 0;
+   bp->b_flags |= B_UNMAPPED;
+   } else {
+   pmap_qenter((vm_offset_t)bp->b_data,
+   &bp->b_pages[0], bp->b_bcount / PAGE_SIZE);
+   }
sp->sw_strategy(bp, sp);
return;
}
@@ -1155,11 +1166,6 @@ swap_pager_getpages(vm_object_t object, 
bp = getpbuf(&nsw_rcount);
bp->b_flags |= B_PAGING;
 
-   /*
-* map our page(s) into kva for input
-*/
-   pmap_qenter((vm_offset_t)bp->b_data, m + i, j - i);
-
bp->b_iocmd = BIO_READ;
bp->b_iodone = swp_pager_async_iodone;
bp->b_rcred = crhold(thread0.td_ucred);
@@ -1371,8 +1377,6 @@ swap_pager_putpages(vm_object_t object, 
bp->b_flags |= B_PAGING;
bp->b_iocmd = BIO_WRITE;
 
-   pmap_qenter((vm_offset_t)bp->b_data, &m[i], n);
-
bp->b_rcred = crhold(thread0.td_ucred);
bp->b_wcred = crhold(thread0.td_ucred);
bp->b_bcount = PAGE_SIZE * n;
@@ -1484,7 +1488,12 @@ swp_pager_async_iodone(struct buf *bp)
/*
 * remove the mapping for kernel virtual
 */
-   pmap_qremove((vm_offset_t)bp->b_data, bp->b_npages);
+   if ((bp->b_flags & B_UNMAPPED) != 0) {
+   bp->b_data = bp->b_kvaalloc;
+   bp->b_kvabase = bp->b_kvaalloc;
+   bp->b_flags &= ~B_UNMAPPED;
+   } else
+   pmap_qremove((vm_offset_t)bp->b_data, bp->b_npages);
 
if (bp->b_npages) {
object = bp->b_pages[0]->object;
@@ -2144,7 +2153,8 @@ swapon_check_swzone(unsigned long npages
 }
 
 static void
-swaponsomething(struct vnode *vp, void *id, u_long nblks, sw_strategy_t 
*strategy, sw_close_t *close, dev_t dev)
+swaponsomething(struct vnode *vp, void *id, u_long nblks,
+sw_strategy_t *strategy, sw_close_t *close, dev_t dev, int flags)
 {
struct swdevt *sp, *tsp;
swblk_t dvbase;
@@ -2180,6 +2190,7 @@ swaponsomething(struct vnode *vp, void *
sp->sw_used = 0;
sp->sw_strategy = strategy;
sp->sw_close = close;
+   sp->sw_flags = flags;
 
sp->sw_blist = blist_create(nblks, M_WAITOK);
/*
@@ -2537,10 +2548,19 @@ swapgeom_strategy(struct buf *bp, struct
 
bio->bio_caller2 = bp;
bio->bio_cmd = bp->b_iocmd;
-   bio->bio_data = bp->b_data;
bio->bio_offset = (bp->b_blkno - sp->sw_first) * PAGE_SIZE;
bio->bio_length = bp->b_bcount;
bio->bio_done = swapgeom_done;
+   if ((bp->b_flags & B_UNMAPPED) != 0) {
+   bio->bio_ma = bp->b_pages;
+   bio->bio_data = unmapped_buf;
+   bio->bio_ma_offset = (vm_offset_t)bp->b_offset & PAGE_MASK;
+   bio->bio_ma_n = bp->b_npages;
+   bio->bio_flags |= BIO_UNMAPPED;
+   } else {
+   bio->bio_data = bp->b_data;
+   bio->bio_ma = NULL;
+   }
g_io_request(bio, cp);
return;
 }
@@ -2630,9 +2650,9 @@ swapongeom_ev(void *arg, int flags)
}
nblks = pp->mediasize / DEV_BSIZE;
swaponsomething(swh->vp, cp, nblks, swapgeom_strategy,
-   swapgeom_close, dev2udev(swh->dev));
+   swapgeom_close, dev2udev(swh->dev),
+   (pp->flags & G_PF_ACCEPT_UNMAPPED) != 0 ? SW_UNMAPPED : 0);
swh->error = 0;
-   return;
 }
 
 static int
@@ -2721,6 +2741,6 @@ swaponvp(struct thread *td, struct vnode
return (error);
 
swaponsomething(vp, vp, nblks, swapdev_strategy, swapdev_close,
-   NODEV);
+   NODEV, 0);
return (0);
 }

Modified: head/sys/vm/swap_pager.h
==

svn commit: r248512 - head/sys/vm

2013-03-19 Thread Konstantin Belousov
Author: kib
Date: Tue Mar 19 14:36:28 2013
New Revision: 248512
URL: http://svnweb.freebsd.org/changeset/base/248512

Log:
  Pass unmapped buffers for page in requests if the filesystem indicated support
  for the unmapped i/o.
  
  Sponsored by: The FreeBSD Foundation
  Tested by:pho

Modified:
  head/sys/vm/vnode_pager.c

Modified: head/sys/vm/vnode_pager.c
==
--- head/sys/vm/vnode_pager.c   Tue Mar 19 14:33:01 2013(r248511)
+++ head/sys/vm/vnode_pager.c   Tue Mar 19 14:36:28 2013(r248512)
@@ -698,6 +698,7 @@ vnode_pager_generic_getpages(vp, m, byte
int runpg;
int runend;
struct buf *bp;
+   struct mount *mp;
int count;
int error;
 
@@ -903,9 +904,21 @@ vnode_pager_generic_getpages(vp, m, byte
kva = (vm_offset_t)bp->b_data;
 
/*
-* and map the pages to be read into the kva
+* and map the pages to be read into the kva, if the filesystem
+* requires mapped buffers.
 */
-   pmap_qenter(kva, m, count);
+   mp = vp->v_mount;
+   if (mp != NULL && (mp->mnt_kern_flag & MNTK_UNMAPPED_BUFS) != 0 &&
+   unmapped_buf_allowed) {
+   bp->b_data = unmapped_buf;
+   bp->b_kvabase = unmapped_buf;
+   bp->b_offset = 0;
+   bp->b_flags |= B_UNMAPPED;
+   bp->b_npages = count;
+   for (i = 0; i < count; i++)
+   bp->b_pages[i] = m[i];
+   } else
+   pmap_qenter(kva, m, count);
 
/* build a minimal buffer header */
bp->b_iocmd = BIO_READ;
@@ -934,11 +947,22 @@ vnode_pager_generic_getpages(vp, m, byte
if ((bp->b_ioflags & BIO_ERROR) != 0)
error = EIO;
 
-   if (!error) {
-   if (size != count * PAGE_SIZE)
-   bzero((caddr_t) kva + size, PAGE_SIZE * count - size);
+   if (error != 0 && size != count * PAGE_SIZE) {
+   if ((bp->b_flags & B_UNMAPPED) != 0) {
+   bp->b_flags &= ~B_UNMAPPED;
+   pmap_qenter(kva, m, count);
+   }
+   bzero((caddr_t)kva + size, PAGE_SIZE * count - size);
+   }
+   if ((bp->b_flags & B_UNMAPPED) == 0)
+   pmap_qremove(kva, count);
+   if (mp != NULL && (mp->mnt_kern_flag & MNTK_UNMAPPED_BUFS) != 0) {
+   bp->b_data = (caddr_t)kva;
+   bp->b_kvabase = (caddr_t)kva;
+   bp->b_flags &= ~B_UNMAPPED;
+   for (i = 0; i < count; i++)
+   bp->b_pages[i] = NULL;
}
-   pmap_qremove(kva, count);
 
/*
 * free the buffer header back to the swap buffer pool
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r248511 - head/sys/sys

2013-03-19 Thread Konstantin Belousov
Author: kib
Date: Tue Mar 19 14:33:01 2013
New Revision: 248511
URL: http://svnweb.freebsd.org/changeset/base/248511

Log:
  A flag for the filesystem to indicate to the upper levels that it accepts
  unmapped buffers for the VOP_STRATEGY().
  
  Sponsored by: The FreeBSD Foundation
  Tested by:pho

Modified:
  head/sys/sys/mount.h

Modified: head/sys/sys/mount.h
==
--- head/sys/sys/mount.hTue Mar 19 14:27:14 2013(r248510)
+++ head/sys/sys/mount.hTue Mar 19 14:33:01 2013(r248511)
@@ -351,6 +351,7 @@ void  __mnt_vnode_markerfree_act
 #defineMNTK_VGONE_WAITER   0x0400
 #defineMNTK_LOOKUP_EXCL_DOTDOT 0x0800
 #defineMNTK_MARKER 0x1000
+#defineMNTK_UNMAPPED_BUFS  0x2000
 #define MNTK_NOASYNC   0x0080  /* disable async */
 #define MNTK_UNMOUNT   0x0100  /* unmount in progress */
 #defineMNTK_MWAIT  0x0200  /* waiting for unmount to 
finish */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r248510 - in head/sys: kern sys

2013-03-19 Thread Konstantin Belousov
Author: kib
Date: Tue Mar 19 14:27:14 2013
New Revision: 248510
URL: http://svnweb.freebsd.org/changeset/base/248510

Log:
  Add a helper function vfs_bio_bzero_buf() to zero the portion of the
  buffer, transparently handling mapped or unmapped buffers.  Its intent
  is to replace the use of bzero(bp->b_data) in cases where the buffer
  might be unmapped, to avoid unneeded upgrades.
  
  Sponsored by: The FreeBSD Foundation
  Tested by:pho

Modified:
  head/sys/kern/vfs_bio.c
  head/sys/sys/buf.h

Modified: head/sys/kern/vfs_bio.c
==
--- head/sys/kern/vfs_bio.c Tue Mar 19 14:15:41 2013(r248509)
+++ head/sys/kern/vfs_bio.c Tue Mar 19 14:27:14 2013(r248510)
@@ -4176,6 +4176,32 @@ unlock:
bp->b_resid = 0;
 }
 
+void
+vfs_bio_bzero_buf(struct buf *bp, int base, int size)
+{
+   vm_page_t m;
+   int i, n;
+
+   if ((bp->b_flags & B_UNMAPPED) == 0) {
+   BUF_CHECK_MAPPED(bp);
+   bzero(bp->b_data + base, size);
+   } else {
+   BUF_CHECK_UNMAPPED(bp);
+   n = PAGE_SIZE - (base & PAGE_MASK);
+   VM_OBJECT_WLOCK(bp->b_bufobj->bo_object);
+   for (i = base / PAGE_SIZE; size > 0 && i < bp->b_npages; ++i) {
+   m = bp->b_pages[i];
+   if (n > size)
+   n = size;
+   pmap_zero_page_area(m, base & PAGE_MASK, n);
+   base += n;
+   size -= n;
+   n = PAGE_SIZE;
+   }
+   VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object);
+   }
+}
+
 /*
  * vm_hold_load_pages and vm_hold_free_pages get pages into
  * a buffers address space.  The pages are anonymous and are

Modified: head/sys/sys/buf.h
==
--- head/sys/sys/buf.h  Tue Mar 19 14:15:41 2013(r248509)
+++ head/sys/sys/buf.h  Tue Mar 19 14:27:14 2013(r248510)
@@ -519,6 +519,7 @@ int cluster_read(struct vnode *, u_quad_
struct ucred *, long, int, int, struct buf **);
 intcluster_wbuild(struct vnode *, long, daddr_t, int, int);
 void   cluster_write(struct vnode *, struct buf *, u_quad_t, int, int);
+void   vfs_bio_bzero_buf(struct buf *bp, int base, int size);
 void   vfs_bio_set_valid(struct buf *, int base, int size);
 void   vfs_bio_clrbuf(struct buf *);
 void   vfs_busy_pages(struct buf *, int clear_modify);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r248509 - head/sys/dev/fdt

2013-03-19 Thread Aleksandr Rybalko
Author: ray
Date: Tue Mar 19 14:15:41 2013
New Revision: 248509
URL: http://svnweb.freebsd.org/changeset/base/248509

Log:
  Return "start" and "end" to u_long world. Because rman handle addresses as
  u_long too.
  
  Discussed with:   ian@
  Pointy hat to:ray@

Modified:
  head/sys/dev/fdt/fdt_common.c

Modified: head/sys/dev/fdt/fdt_common.c
==
--- head/sys/dev/fdt/fdt_common.c   Tue Mar 19 14:13:12 2013
(r248508)
+++ head/sys/dev/fdt/fdt_common.c   Tue Mar 19 14:15:41 2013
(r248509)
@@ -421,12 +421,11 @@ fdt_regsize(phandle_t node, u_long *base
 int
 fdt_reg_to_rl(phandle_t node, struct resource_list *rl)
 {
-   u_long count;
+   u_long end, count, start;
pcell_t *reg, *regptr;
pcell_t addr_cells, size_cells;
int tuple_size, tuples;
int i, rv;
-   bus_space_handle_t start, end;
long busaddr, bussize;
 
if (fdt_addrsize_cells(OF_parent(node), &addr_cells, &size_cells) != 0)
@@ -447,8 +446,8 @@ fdt_reg_to_rl(phandle_t node, struct res
regptr = reg;
for (i = 0; i < tuples; i++) {
 
-   rv = fdt_data_to_res(reg, addr_cells, size_cells,
-   (u_long *)&start, &count);
+   rv = fdt_data_to_res(reg, addr_cells, size_cells, &start,
+   &count);
if (rv != 0) {
resource_list_free(rl);
goto out;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r248508 - in head/sys: amd64/amd64 arm/arm geom i386/i386 i386/xen ia64/ia64 kern mips/mips powerpc/aim powerpc/powerpc sparc64/sparc64 sys vm

2013-03-19 Thread Konstantin Belousov
Author: kib
Date: Tue Mar 19 14:13:12 2013
New Revision: 248508
URL: http://svnweb.freebsd.org/changeset/base/248508

Log:
  Implement the concept of the unmapped VMIO buffers, i.e. buffers which
  do not map the b_pages pages into buffer_map KVA.  The use of the
  unmapped buffers eliminate the need to perform TLB shootdown for
  mapping on the buffer creation and reuse, greatly reducing the amount
  of IPIs for shootdown on big-SMP machines and eliminating up to 25-30%
  of the system time on i/o intensive workloads.
  
  The unmapped buffer should be explicitely requested by the GB_UNMAPPED
  flag by the consumer.  For unmapped buffer, no KVA reservation is
  performed at all. The consumer might request unmapped buffer which
  does have a KVA reserve, to manually map it without recursing into
  buffer cache and blocking, with the GB_KVAALLOC flag.
  
  When the mapped buffer is requested and unmapped buffer already
  exists, the cache performs an upgrade, possibly reusing the KVA
  reservation.
  
  Unmapped buffer is translated into unmapped bio in g_vfs_strategy().
  Unmapped bio carry a pointer to the vm_page_t array, offset and length
  instead of the data pointer.  The provider which processes the bio
  should explicitely specify a readiness to accept unmapped bio,
  otherwise g_down geom thread performs the transient upgrade of the bio
  request by mapping the pages into the new bio_transient_map KVA
  submap.
  
  The bio_transient_map submap claims up to 10% of the buffer map, and
  the total buffer_map + bio_transient_map KVA usage stays the
  same. Still, it could be manually tuned by kern.bio_transient_maxcnt
  tunable, in the units of the transient mappings.  Eventually, the
  bio_transient_map could be removed after all geom classes and drivers
  can accept unmapped i/o requests.
  
  Unmapped support can be turned off by the vfs.unmapped_buf_allowed
  tunable, disabling which makes the buffer (or cluster) creation
  requests to ignore GB_UNMAPPED and GB_KVAALLOC flags.  Unmapped
  buffers are only enabled by default on the architectures where
  pmap_copy_page() was implemented and tested.
  
  In the rework, filesystem metadata is not the subject to maxbufspace
  limit anymore. Since the metadata buffers are always mapped, the
  buffers still have to fit into the buffer map, which provides a
  reasonable (but practically unreachable) upper bound on it. The
  non-metadata buffer allocations, both mapped and unmapped, is
  accounted against maxbufspace, as before. Effectively, this means that
  the maxbufspace is forced on mapped and unmapped buffers separately.
  The pre-patch bufspace limiting code did not worked, because
  buffer_map fragmentation does not allow the limit to be reached.
  
  By Jeff Roberson request, the getnewbuf() function was split into
  smaller single-purpose functions.
  
  Sponsored by: The FreeBSD Foundation
  Discussed with:   jeff (previous version)
  Tested by:pho, scottl (previous version), jhb, bf
  MFC after:2 weeks

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/arm/arm/pmap-v6.c
  head/sys/arm/arm/pmap.c
  head/sys/geom/geom.h
  head/sys/geom/geom_io.c
  head/sys/geom/geom_vfs.c
  head/sys/i386/i386/pmap.c
  head/sys/i386/xen/pmap.c
  head/sys/ia64/ia64/pmap.c
  head/sys/kern/subr_bus_dma.c
  head/sys/kern/subr_param.c
  head/sys/kern/vfs_bio.c
  head/sys/kern/vfs_cluster.c
  head/sys/mips/mips/pmap.c
  head/sys/powerpc/aim/mmu_oea64.c
  head/sys/powerpc/powerpc/pmap_dispatch.c
  head/sys/sparc64/sparc64/pmap.c
  head/sys/sys/bio.h
  head/sys/sys/buf.h
  head/sys/sys/systm.h
  head/sys/vm/vm.h
  head/sys/vm/vm_init.c
  head/sys/vm/vm_kern.c

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Tue Mar 19 13:43:55 2013(r248507)
+++ head/sys/amd64/amd64/pmap.c Tue Mar 19 14:13:12 2013(r248508)
@@ -4235,6 +4235,8 @@ pmap_copy_page(vm_page_t msrc, vm_page_t
pagecopy((void *)src, (void *)dst);
 }
 
+int unmapped_buf_allowed = 1;
+
 void
 pmap_copy_pages(vm_page_t ma[], vm_offset_t a_offset, vm_page_t mb[],
 vm_offset_t b_offset, int xfersize)

Modified: head/sys/arm/arm/pmap-v6.c
==
--- head/sys/arm/arm/pmap-v6.c  Tue Mar 19 13:43:55 2013(r248507)
+++ head/sys/arm/arm/pmap-v6.c  Tue Mar 19 14:13:12 2013(r248508)
@@ -3312,6 +3312,8 @@ pmap_copy_page_generic(vm_paddr_t src, v
mtx_unlock(&cmtx);
 }
 
+int unmapped_buf_allowed = 1;
+
 void
 pmap_copy_pages(vm_page_t ma[], vm_offset_t a_offset, vm_page_t mb[],
 vm_offset_t b_offset, int xfersize)

Modified: head/sys/arm/arm/pmap.c
==
--- head/sys/arm/arm/pmap.c Tue Mar 19 13:43:55 2013(r248507)
+++ head/sys/arm/arm/pmap.c Tue Mar 19 14:13:12 2013(r248508)
@@ -4428,6 +4428,8 @@ p

svn commit: r248507 - head/share/man/man4

2013-03-19 Thread Gleb Smirnoff
Author: glebius
Date: Tue Mar 19 13:43:55 2013
New Revision: 248507
URL: http://svnweb.freebsd.org/changeset/base/248507

Log:
  iwn(4) doesn't support adhoc mode.
  
  PR:   misc/177106
  Submitted by: Hiren Panchasara 

Modified:
  head/share/man/man4/iwn.4

Modified: head/share/man/man4/iwn.4
==
--- head/share/man/man4/iwn.4   Tue Mar 19 13:36:19 2013(r248506)
+++ head/share/man/man4/iwn.4   Tue Mar 19 13:43:55 2013(r248507)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 27, 2012
+.Dd March 19, 2013
 .Dt IWN 4
 .Os
 .Sh NAME
@@ -100,8 +100,7 @@ driver provides support for:
 .Pp
 .Nm
 supports
-.Cm station ,
-.Cm adhoc ,
+.Cm station
 and
 .Cm monitor
 mode operation.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r248504 - head/sys/sys

2013-03-19 Thread Konstantin Belousov
Author: kib
Date: Tue Mar 19 13:21:39 2013
New Revision: 248504
URL: http://svnweb.freebsd.org/changeset/base/248504

Log:
  Add a convenience macro bread_gb() to wrap a call to
  breadn_flags(). Comparing with bread(), it adds an argument to pass
  the flags to getblk().
  
  Sponsored by: The FreeBSD Foundation
  Tested by:pho
  MFC after:2 weeks

Modified:
  head/sys/sys/buf.h

Modified: head/sys/sys/buf.h
==
--- head/sys/sys/buf.h  Tue Mar 19 13:14:06 2013(r248503)
+++ head/sys/sys/buf.h  Tue Mar 19 13:21:39 2013(r248504)
@@ -480,7 +480,10 @@ intbuf_dirty_count_severe(void);
 void   bremfree(struct buf *);
 void   bremfreef(struct buf *);/* XXX Force bremfree, only for nfs. */
 #define bread(vp, blkno, size, cred, bpp) \
-   breadn_flags(vp, blkno, size, 0, 0, 0, cred, 0, bpp)
+   breadn_flags(vp, blkno, size, NULL, NULL, 0, cred, 0, bpp)
+#define bread_gb(vp, blkno, size, cred, gbflags, bpp) \
+   breadn_flags(vp, blkno, size, NULL, NULL, 0, cred, \
+   gbflags, bpp)
 #define breadn(vp, blkno, size, rablkno, rabsize, cnt, cred, bpp) \
breadn_flags(vp, blkno, size, rablkno, rabsize, cnt, cred, 0, bpp)
 intbreadn_flags(struct vnode *, daddr_t, int, daddr_t *, int *, int,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r248502 - head/sys/dev/fdt

2013-03-19 Thread Aleksandr Rybalko
Author: ray
Date: Tue Mar 19 13:13:26 2013
New Revision: 248502
URL: http://svnweb.freebsd.org/changeset/base/248502

Log:
  Cast "start" to u_long. Temporary fix to unbreak tinderbox.
  We need here max possible storage or dynamic, depend on size of address cell.

Modified:
  head/sys/dev/fdt/fdt_common.c

Modified: head/sys/dev/fdt/fdt_common.c
==
--- head/sys/dev/fdt/fdt_common.c   Tue Mar 19 13:10:14 2013
(r248501)
+++ head/sys/dev/fdt/fdt_common.c   Tue Mar 19 13:13:26 2013
(r248502)
@@ -447,8 +447,8 @@ fdt_reg_to_rl(phandle_t node, struct res
regptr = reg;
for (i = 0; i < tuples; i++) {
 
-   rv = fdt_data_to_res(reg, addr_cells, size_cells, &start,
-   &count);
+   rv = fdt_data_to_res(reg, addr_cells, size_cells,
+   (u_long *)&start, &count);
if (rv != 0) {
resource_list_free(rl);
goto out;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r248501 - head/sys/cam

2013-03-19 Thread Konstantin Belousov
Author: kib
Date: Tue Mar 19 13:10:14 2013
New Revision: 248501
URL: http://svnweb.freebsd.org/changeset/base/248501

Log:
  Assert that a ccb passed to cam_periph_mapmem() for XPT_SCSI_IO and
  XPT_ATA_IO holds virtual buffer address.
  
  Sponsored by: The FreeBSD Foundation
  Tested by:pho

Modified:
  head/sys/cam/cam_periph.c

Modified: head/sys/cam/cam_periph.c
==
--- head/sys/cam/cam_periph.c   Tue Mar 19 13:06:11 2013(r248500)
+++ head/sys/cam/cam_periph.c   Tue Mar 19 13:10:14 2013(r248501)
@@ -734,6 +734,8 @@ cam_periph_mapmem(union ccb *ccb, struct
case XPT_CONT_TARGET_IO:
if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_NONE)
return(0);
+   KASSERT((ccb->ccb_h.flags & CAM_DATA_MASK) == CAM_DATA_VADDR,
+   ("not VADDR for SCSI_IO %p %x\n", ccb, ccb->ccb_h.flags));
 
data_ptrs[0] = &ccb->csio.data_ptr;
lengths[0] = ccb->csio.dxfer_len;
@@ -743,6 +745,8 @@ cam_periph_mapmem(union ccb *ccb, struct
case XPT_ATA_IO:
if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_NONE)
return(0);
+   KASSERT((ccb->ccb_h.flags & CAM_DATA_MASK) == CAM_DATA_VADDR,
+   ("not VADDR for ATA_IO %p %x\n", ccb, ccb->ccb_h.flags));
 
data_ptrs[0] = &ccb->ataio.data_ptr;
lengths[0] = ccb->ataio.dxfer_len;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r248500 - in head/sys: fs/nfsclient nfsclient

2013-03-19 Thread Ed Maste
Author: emaste
Date: Tue Mar 19 13:06:11 2013
New Revision: 248500
URL: http://svnweb.freebsd.org/changeset/base/248500

Log:
  Fix remainder calculation when biosize is not a power of 2
  
  In common configurations biosize is a power of two, but is not required to
  be so.  Thanks to markj@ for spotting an additional case beyond my original
  patch.
  
  Reviewed by: rmacklem@

Modified:
  head/sys/fs/nfsclient/nfs_clbio.c
  head/sys/nfsclient/nfs_bio.c

Modified: head/sys/fs/nfsclient/nfs_clbio.c
==
--- head/sys/fs/nfsclient/nfs_clbio.c   Tue Mar 19 12:52:13 2013
(r248499)
+++ head/sys/fs/nfsclient/nfs_clbio.c   Tue Mar 19 13:06:11 2013
(r248500)
@@ -484,7 +484,7 @@ ncl_bioread(struct vnode *vp, struct uio
case VREG:
NFSINCRGLOBAL(newnfsstats.biocache_reads);
lbn = uio->uio_offset / biosize;
-   on = uio->uio_offset & (biosize - 1);
+   on = uio->uio_offset - (lbn * biosize);
 
/*
 * Start the read ahead(s), as required.
@@ -1029,7 +1029,7 @@ flush_and_restart:
do {
NFSINCRGLOBAL(newnfsstats.biocache_writes);
lbn = uio->uio_offset / biosize;
-   on = uio->uio_offset & (biosize-1);
+   on = uio->uio_offset - (lbn * biosize);
n = MIN((unsigned)(biosize - on), uio->uio_resid);
 again:
/*
@@ -1847,7 +1847,7 @@ ncl_meta_setsize(struct vnode *vp, struc
 */
error = vtruncbuf(vp, cred, nsize, biosize);
lbn = nsize / biosize;
-   bufsize = nsize & (biosize - 1);
+   bufsize = nsize - (lbn * biosize);
bp = nfs_getcacheblk(vp, lbn, bufsize, td);
if (!bp)
return EINTR;

Modified: head/sys/nfsclient/nfs_bio.c
==
--- head/sys/nfsclient/nfs_bio.cTue Mar 19 12:52:13 2013
(r248499)
+++ head/sys/nfsclient/nfs_bio.cTue Mar 19 13:06:11 2013
(r248500)
@@ -475,7 +475,7 @@ nfs_bioread(struct vnode *vp, struct uio
case VREG:
nfsstats.biocache_reads++;
lbn = uio->uio_offset / biosize;
-   on = uio->uio_offset & (biosize - 1);
+   on = uio->uio_offset - (lbn * biosize);
 
/*
 * Start the read ahead(s), as required.
@@ -1011,7 +1011,7 @@ flush_and_restart:
do {
nfsstats.biocache_writes++;
lbn = uio->uio_offset / biosize;
-   on = uio->uio_offset & (biosize-1);
+   on = uio->uio_offset - (lbn * biosize);
n = MIN((unsigned)(biosize - on), uio->uio_resid);
 again:
/*
@@ -1781,7 +1781,7 @@ nfs_meta_setsize(struct vnode *vp, struc
 */
error = vtruncbuf(vp, cred, nsize, biosize);
lbn = nsize / biosize;
-   bufsize = nsize & (biosize - 1);
+   bufsize = nsize - (lbn * biosize);
bp = nfs_getcacheblk(vp, lbn, bufsize, td);
if (!bp)
return EINTR;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r248499 - in head/sys/dev/usb: . serial

2013-03-19 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Mar 19 12:52:13 2013
New Revision: 248499
URL: http://svnweb.freebsd.org/changeset/base/248499

Log:
  Add new USB ID.
  
  PR:   usb/177105
  MFC after:1 week

Modified:
  head/sys/dev/usb/serial/u3g.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/serial/u3g.c
==
--- head/sys/dev/usb/serial/u3g.c   Tue Mar 19 12:51:18 2013
(r248498)
+++ head/sys/dev/usb/serial/u3g.c   Tue Mar 19 12:52:13 2013
(r248499)
@@ -242,6 +242,8 @@ static const STRUCT_USB_HOST_ID u3g_devs
U3G_DEV(DELL, U5730_2, 0),
U3G_DEV(DELL, U5730_3, 0),
U3G_DEV(DELL, U740, 0),
+   U3G_DEV(DLINK, DWR510_CD, U3GINIT_SCSIEJECT),
+   U3G_DEV(DLINK, DWR510, 0),
U3G_DEV(DLINK3, DWM652, 0),
U3G_DEV(HP, EV2200, 0),
U3G_DEV(HP, HS2300, 0),

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsTue Mar 19 12:51:18 2013(r248498)
+++ head/sys/dev/usb/usbdevsTue Mar 19 12:52:13 2013(r248499)
@@ -1516,6 +1516,8 @@ product DLINK DSB650TX3   0x400b  10/100 E
 product DLINK DSB650TX20x4102  10/100 Ethernet
 product DLINK DSB650   0xabc1  10/100 Ethernet
 product DLINK DUBH70xf103  DUB-H7 USB 2.0 7-Port Hub
+product DLINK DWR510_CD0xa805  DWR-510 CD-ROM Mode
+product DLINK DWR510   0x7e12  DWR-510
 product DLINK2 DWA120  0x3a0c  DWA-120
 product DLINK2 DWA120_NF   0x3a0d  DWA-120 (no firmware)
 product DLINK2 DWLG122C1   0x3c03  DWL-G122 c1
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r248496 - head/sbin/ldconfig

2013-03-19 Thread Joel Dahl
Author: joel (doc committer)
Date: Tue Mar 19 12:35:33 2013
New Revision: 248496
URL: http://svnweb.freebsd.org/changeset/base/248496

Log:
  Remove obsolete objformat information.
  
  Submitted by: db

Modified:
  head/sbin/ldconfig/ldconfig.8

Modified: head/sbin/ldconfig/ldconfig.8
==
--- head/sbin/ldconfig/ldconfig.8   Tue Mar 19 11:09:15 2013
(r248495)
+++ head/sbin/ldconfig/ldconfig.8   Tue Mar 19 12:35:33 2013
(r248496)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 11, 2005
+.Dd March 19, 2013
 .Dt LDCONFIG 8
 .Os
 .Sh NAME
@@ -162,21 +162,6 @@ In
 addition to building a set of hints for quick lookup, it also serves to
 specify the trusted collection of directories from which shared objects can
 be safely loaded.
-.Sh ENVIRONMENT
-.Bl -tag -width OBJFORMATxxx -compact
-.It Ev OBJFORMAT
-Overrides
-.Pa /etc/objformat
-(see below) to determine whether
-.Fl aout
-or
-.Fl elf
-is the default.
-If set, its value should be either
-.Ql aout
-or
-.Ql elf .
-.El
 .Sh FILES
 .Bl -tag -width /var/run/ld-elf.so.hintsxxx -compact
 .It Pa /var/run/ld.so.hints
@@ -196,17 +181,6 @@ invocations with
 Conventional configuration files containing directory names for
 invocations with
 .Fl 32 .
-.It Pa /etc/objformat
-Determines whether
-.Fl aout
-or
-.Fl elf
-is the default.
-If present, it must consist of a single line
-containing either
-.Ql OBJFORMAT=aout
-or
-.Ql OBJFORMAT=elf .
 .El
 .Sh SEE ALSO
 .Xr ld 1 ,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r248478 - in head: share/man/man4 sys/dev/atkbdc sys/sys usr.sbin/moused

2013-03-19 Thread Gleb Smirnoff
On Mon, Mar 18, 2013 at 11:22:47PM +, Jung-uk Kim wrote:
J> Author: jkim
J> Date: Mon Mar 18 23:22:47 2013
J> New Revision: 248478
J> URL: http://svnweb.freebsd.org/changeset/base/248478
J> 
J> Log:
J>   Add preliminary support for IBM/Lenovo TrackPoint.
J>   
J>   PR:kern/147237 (based on the initial patch for 8.x)
J>   Tested by: glebius (device detection and suspend/resume)
J>   MFC after: 1 month

Thanks, Jung-uk!

-- 
Totus tuus, Glebius.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r248493 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2013-03-19 Thread Martin Matuska
Author: mm
Date: Tue Mar 19 07:47:51 2013
New Revision: 248493
URL: http://svnweb.freebsd.org/changeset/base/248493

Log:
  Plug memory leak in dsl_check_snap_cb()
  This was unnoticed because the function is very rarely used.
  
  MFC after:3 days

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c   Tue Mar 
19 07:25:58 2013(r248492)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c   Tue Mar 
19 07:47:51 2013(r248493)
@@ -919,7 +919,8 @@ dsl_check_snap_cb(const char *name, void
char *dsname;
 
dsname = kmem_asprintf("%s@%s", name, da->snapname);
-   VERIFY(nvlist_add_boolean(da->nvl, dsname) == 0);
+   fnvlist_add_boolean(da->nvl, dsname);
+   kmem_free(dsname, strlen(dsname) + 1);
 
return (0);
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r248492 - head/usr.sbin/bhyveload

2013-03-19 Thread Joel Dahl
Author: joel (doc committer)
Date: Tue Mar 19 07:25:58 2013
New Revision: 248492
URL: http://svnweb.freebsd.org/changeset/base/248492

Log:
  mdoc: remove superfluous paragraph macro.

Modified:
  head/usr.sbin/bhyveload/bhyveload.8

Modified: head/usr.sbin/bhyveload/bhyveload.8
==
--- head/usr.sbin/bhyveload/bhyveload.8 Tue Mar 19 06:04:17 2013
(r248491)
+++ head/usr.sbin/bhyveload/bhyveload.8 Tue Mar 19 07:25:58 2013
(r248492)
@@ -84,7 +84,6 @@ that boots off the ISO image
 and has 1GB memory allocated to it:
 .Pp
 .Dl "bhyveload -m 1024 -d /freebsd/release.iso freebsd-vm"
-.Pp
 .Sh SEE ALSO
 .Xr bhyve 4 ,
 .Xr bhyve 8 ,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"