svn commit: r251735 - head/sys/contrib/dev/ath/ath_hal/ar9300

2013-06-14 Thread Adrian Chadd
Author: adrian
Date: Fri Jun 14 06:14:49 2013
New Revision: 251735
URL: http://svnweb.freebsd.org/changeset/base/251735

Log:
  If chan is NULL, don't derefrence it.
  
  The bluetooth setup code actually does a channel lookup during setup,
  even though we haven't yet programmed in a channel. Sigh.
  
  Tested:
  
  * WB225 (AR9485) + bluetooth

Modified:
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_reset.c

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_reset.c
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_reset.c  Fri Jun 14 
05:36:47 2013(r251734)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_reset.c  Fri Jun 14 
06:14:49 2013(r251735)
@@ -778,6 +778,11 @@ ar9300_set_delta_slope(struct ath_hal *a
 HAL_CHANNEL_INTERNAL *
 ar9300_check_chan(struct ath_hal *ah, const struct ieee80211_channel *chan)
 {
+
+if (chan == NULL) {
+return AH_NULL;
+}
+
 if ((IS(chan, CHAN_2GHZ) ^ IS(chan, CHAN_5GHZ)) == 0) {
 HALDEBUG(ah, HAL_DEBUG_CHANNEL,
 %s: invalid channel %u/0x%x; not marked as 2GHz or 5GHz\n,
___
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-unsubscr...@freebsd.org


svn commit: r251736 - head/sys/contrib/dev/ath/ath_hal/ar9300

2013-06-14 Thread Adrian Chadd
Author: adrian
Date: Fri Jun 14 06:15:23 2013
New Revision: 251736
URL: http://svnweb.freebsd.org/changeset/base/251736

Log:
  Add bluetooth setup method functions to the HAL.

Modified:
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.cFri Jun 14 
06:14:49 2013(r251735)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.cFri Jun 14 
06:15:23 2013(r251736)
@@ -237,6 +237,14 @@ ar9300_attach_freebsd_ops(struct ath_hal
/* ah_set11nRxClear */
 
/* bluetooth coexistence functions */
+   ah-ah_btCoexSetInfo= ar9300_set_bt_coex_info;
+   ah-ah_btCoexSetConfig  = ar9300_bt_coex_config;
+   ah-ah_btCoexSetQcuThresh   = ar9300_bt_coex_set_qcu_thresh;
+   ah-ah_btCoexSetWeights = ar9300_bt_coex_set_weights;
+   ah-ah_btCoexSetBmissThresh = ar9300_bt_coex_setup_bmiss_thresh;
+   ah-ah_btCoexSetParameter   = ar9300_bt_coex_set_parameter;
+   ah-ah_btCoexDisable= ar9300_bt_coex_disable;
+   ah-ah_btCoexEnable = ar9300_bt_coex_enable;
 
/* LNA diversity functions */
ah-ah_divLnaConfGet = ar9300_ant_div_comb_get_config;
___
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-unsubscr...@freebsd.org


svn commit: r251737 - head/tools/tools/ath/athspectral

2013-06-14 Thread Adrian Chadd
Author: adrian
Date: Fri Jun 14 08:11:45 2013
New Revision: 251737
URL: http://svnweb.freebsd.org/changeset/base/251737

Log:
  Add missing formatting strings.
  
  Thanks to: clang

Modified:
  head/tools/tools/ath/athspectral/athspectral.c

Modified: head/tools/tools/ath/athspectral/athspectral.c
==
--- head/tools/tools/ath/athspectral/athspectral.c  Fri Jun 14 06:15:23 
2013(r251736)
+++ head/tools/tools/ath/athspectral/athspectral.c  Fri Jun 14 08:11:45 
2013(r251737)
@@ -67,7 +67,7 @@ spectral_opendev(struct spectralhandler 
spectral-atd.ad_out_data = (caddr_t) revs;
spectral-atd.ad_out_size = sizeof(revs);
if (ioctl(spectral-s, SIOCGATHDIAG, spectral-atd)  0) {
-   warn(spectral-atd.ad_name);
+   warn(%s, spectral-atd.ad_name);
return 0;
}
spectral-ah_devid = revs.ah_devid;
@@ -116,7 +116,7 @@ spectralset(struct spectralhandler *spec
spectral-atd.ad_in_data = (caddr_t) pe;
spectral-atd.ad_in_size = sizeof(HAL_SPECTRAL_PARAM);
if (ioctl(spectral-s, SIOCGATHSPECTRAL, spectral-atd)  0)
-   err(1, spectral-atd.ad_name);
+   err(1, %s, spectral-atd.ad_name);
 }
 
 static void
@@ -133,7 +133,7 @@ spectral_get(struct spectralhandler *spe
spectral-atd.ad_out_size = sizeof(pe);
 
if (ioctl(spectral-s, SIOCGATHSPECTRAL, spectral-atd)  0)
-   err(1, spectral-atd.ad_name);
+   err(1, %s, spectral-atd.ad_name);
 
printf(Spectral parameters (raw):\n);
printf(   ss_enabled: %d\n, pe.ss_enabled);
@@ -163,7 +163,7 @@ spectral_start(struct spectralhandler *s
spectral-atd.ad_out_size = sizeof(pe);
 
if (ioctl(spectral-s, SIOCGATHSPECTRAL, spectral-atd)  0)
-   err(1, spectral-atd.ad_name);
+   err(1, %s, spectral-atd.ad_name);
 }
 
 static void
@@ -184,7 +184,7 @@ spectral_stop(struct spectralhandler *sp
spectral-atd.ad_out_size = sizeof(pe);
 
if (ioctl(spectral-s, SIOCGATHSPECTRAL, spectral-atd)  0)
-   err(1, spectral-atd.ad_name);
+   err(1, %s, spectral-atd.ad_name);
 }
 
 static void
@@ -207,7 +207,7 @@ spectral_enable_at_reset(struct spectral
printf(%s: val=%d\n, __func__, v);
 
if (ioctl(spectral-s, SIOCGATHSPECTRAL, spectral-atd)  0)
-   err(1, spectral-atd.ad_name);
+   err(1, %s, spectral-atd.ad_name);
 }
 
 static int
___
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-unsubscr...@freebsd.org


svn commit: r251738 - head/tools/tools/ath/ath_ee_9300_print

2013-06-14 Thread Adrian Chadd
Author: adrian
Date: Fri Jun 14 08:12:40 2013
New Revision: 251738
URL: http://svnweb.freebsd.org/changeset/base/251738

Log:
  Begin fleshing out an AR9300 EEPROM dump helper utility.

Added:
  head/tools/tools/ath/ath_ee_9300_print/
  head/tools/tools/ath/ath_ee_9300_print/Makefile   (contents, props changed)
  head/tools/tools/ath/ath_ee_9300_print/main.c   (contents, props changed)

Added: head/tools/tools/ath/ath_ee_9300_print/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/tools/ath/ath_ee_9300_print/Makefile Fri Jun 14 08:12:40 
2013(r251738)
@@ -0,0 +1,19 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../../../sys/dev/ath/ath_hal
+
+PROG=  ath_ee_9300_print
+NOMAN= yes
+NO_MAN=yes
+SRCS=  main.c
+SRCS+= opt_ah.h
+CLEANFILES+=   opt_ah.h
+
+opt_ah.h:
+   echo #define AH_DEBUG 1  opt_ah.h
+   echo #define AH_DEBUG_COUNTRY 1  opt_ah.h
+   echo #define AH_SUPPORT_AR5416 1  opt_ah.h
+
+.include ../Makefile.inc
+
+.include bsd.prog.mk

Added: head/tools/tools/ath/ath_ee_9300_print/main.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/tools/ath/ath_ee_9300_print/main.c   Fri Jun 14 08:12:40 
2013(r251738)
@@ -0,0 +1,229 @@
+
+/*
+ * Copyright (c) 2010-2011 Adrian Chadd, Xenion Pty Ltd.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include stdio.h
+#include stdlib.h
+#include unistd.h
+#include string.h
+#include sys/types.h
+#include err.h
+
+struct ath_hal;
+
+#include ar9300/ar9300eep.h
+
+static void
+eeprom_9300_hdr_print(const uint16_t *buf)
+{
+   const ar9300_eeprom_t *ee = (ar9300_eeprom_t *) buf;
+
+   printf(| Version: %d, Template: %d, MAC: %02x:%02x:%02x:%02x:%02x:%02x 
|\n,
+   ee-eeprom_version,
+   ee-template_version,
+   ee-mac_addr[0],
+   ee-mac_addr[1],
+   ee-mac_addr[2],
+   ee-mac_addr[3],
+   ee-mac_addr[4],
+   ee-mac_addr[5]);
+}
+
+static void
+eeprom_9300_base_print(const uint16_t *buf)
+{
+   const ar9300_eeprom_t *ee = (ar9300_eeprom_t *) buf;
+   const OSPREY_BASE_EEP_HEADER *ee_base = ee-base_eep_header;
+
+   printf(| RegDomain: 0x%02x 0x%02x TxRxMask: 0x%02x OpFlags: 0x%02x 
OpMisc: 0x%02x |\n,
+   ee_base-reg_dmn[0],
+   ee_base-reg_dmn[1],
+   ee_base-txrx_mask,
+   ee_base-op_cap_flags.op_flags,
+   ee_base-op_cap_flags.eepMisc);
+
+   printf(| RfSilent: 0x%02x BtOptions: 0x%02x DeviceCap: 0x%02x 
DeviceType: 0x%02x |\n,
+   ee_base-rf_silent,
+   ee_base-blue_tooth_options,
+   ee_base-device_cap,
+   ee_base-device_type);
+
+   printf(| pwrTableOffset: %d dB, feature_enable: 0x%02x MiscConfig: 
0x%02x |\n,
+   ee_base-pwrTableOffset,
+   ee_base-feature_enable,
+   ee_base-misc_configuration);
+
+   printf(| EepromWriteGpio: %d, WlanDisableGpio: %d, WlanLedGpio: %d 
RxBandSelectGpio: %d |\n,
+   ee_base-eeprom_write_enable_gpio,
+   ee_base-wlan_disable_gpio,
+   ee_base-wlan_led_gpio,
+   ee_base-rx_band_select_gpio);
+
+   printf(| TxRxGain: %d, SwReg: %d |\n,
+   ee_base-txrxgain,
+   ee_base-swreg);
+}
+
+static void
+eeprom_9300_modal_print(const OSPREY_MODAL_EEP_HEADER *m)
+{
+   int i;
+
+   printf(| AntCtrl: 0x%08x AntCtrl2: 0x%08x |\n,
+   m-ant_ctrl_common,
+   m-ant_ctrl_common2);
+
+   for (i = 0; i  OSPREY_MAX_CHAINS; i++) {
+   printf(| 

svn commit: r251740 - head/sys/contrib/dev/ath/ath_hal/ar9300

2013-06-14 Thread Adrian Chadd
Author: adrian
Date: Fri Jun 14 08:13:21 2013
New Revision: 251740
URL: http://svnweb.freebsd.org/changeset/base/251740

Log:
  Flip on AH_PRIVATE_DIAG by default; this will include the AR9300 EEPROM
  dump code that is worth having around.

Modified:
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd_inc.h

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd_inc.h
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd_inc.hFri Jun 
14 08:12:54 2013(r251739)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd_inc.hFri Jun 
14 08:13:21 2013(r251740)
@@ -34,6 +34,7 @@
 #define ATH_SUPPORT_WIFIPOS 0
 #define ATH_SUPPORT_PAPRD   1
 #define ATH_SUPPORT_TxBF0
+#define AH_PRIVATE_DIAG 1
 
 /* XXX need to reverify these; they came in with qcamain */
 #define ATH_SUPPORT_FAST_CC 0
___
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-unsubscr...@freebsd.org


svn commit: r251739 - head/tools/tools/ath

2013-06-14 Thread Adrian Chadd
Author: adrian
Date: Fri Jun 14 08:12:54 2013
New Revision: 251739
URL: http://svnweb.freebsd.org/changeset/base/251739

Log:
  Link the AR9300 EEPROM dump tool into the build.

Modified:
  head/tools/tools/ath/Makefile

Modified: head/tools/tools/ath/Makefile
==
--- head/tools/tools/ath/Makefile   Fri Jun 14 08:12:40 2013
(r251738)
+++ head/tools/tools/ath/Makefile   Fri Jun 14 08:12:54 2013
(r251739)
@@ -2,7 +2,7 @@
 
 SUBDIR=arcode athdebug athdecode athkey athpoke athprom athrd athregs
 SUBDIR+=   athstats ath_prom_read athradar athaggrstats
-SUBDIR+=   ath_ee_v14_print ath_ee_v4k_print ath_ee_9287_print
+SUBDIR+=   ath_ee_v14_print ath_ee_v4k_print ath_ee_9287_print 
ath_ee_9300_print
 SUBDIR+=   athsurvey athratestats athspectral
 
 .include bsd.subdir.mk
___
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-unsubscr...@freebsd.org


svn commit: r251741 - head/sys/contrib/dev/ath/ath_hal/ar9300

2013-06-14 Thread Adrian Chadd
Author: adrian
Date: Fri Jun 14 08:15:28 2013
New Revision: 251741
URL: http://svnweb.freebsd.org/changeset/base/251741

Log:
  The AR9300 HAL uses this config to program AR_PHY_SWITCH_COM_2 on AR9485
  NICs which have bluetooth coexistence enabled.
  
  The WB225 NIC has the common antenna switch configuration set to 0x0 which
  disables all external switch bit setting. This obviously won't work when
  doing coexistence.
  
  This value is a magic value from the windows .inf files. It _looks_ right
  but I haven't yet verified it - unfortunately my AR9285+AR3012 BT combo
  has an earlier BT device which doesn't actually _have_ firmware on it.
  So I have to fix ath3kfw to handle loading in firmware into the newer
  NICs before I can finish testing this.
  
  This may not hold true for CUS198, which is another custom AR9485 board.

Modified:
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.cFri Jun 14 
08:13:21 2013(r251740)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.cFri Jun 14 
08:15:28 2013(r251741)
@@ -249,6 +249,9 @@ ar9300_attach_freebsd_ops(struct ath_hal
/* LNA diversity functions */
ah-ah_divLnaConfGet = ar9300_ant_div_comb_get_config;
ah-ah_divLnaConfSet = ar9300_ant_div_comb_set_config;
+
+   /* Setup HAL configuration defaults */
+   ah-ah_config.ath_hal_ant_ctrl_comm2g_switch_enable = 0x000bbb88;
 }
 
 HAL_BOOL
___
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-unsubscr...@freebsd.org


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

2013-06-14 Thread Adrian Chadd
Author: adrian
Date: Fri Jun 14 08:18:17 2013
New Revision: 251742
URL: http://svnweb.freebsd.org/changeset/base/251742

Log:
  Add in an initial WB225 (AR9485 + AR3012 BT) combo profile.
  
  This hasn't yet been tested as unfortunately the AR3012 I have doesn't
  have the real firmware on it; it shipped with the cut down HCI firmware
  that only understands enough to accept a new firmware image.
  
  * Linux ath9k (GPIO constants)

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

Modified: head/sys/dev/ath/if_ath_btcoex.c
==
--- head/sys/dev/ath/if_ath_btcoex.cFri Jun 14 08:15:28 2013
(r251741)
+++ head/sys/dev/ath/if_ath_btcoex.cFri Jun 14 08:18:17 2013
(r251742)
@@ -129,6 +129,64 @@ ath_btcoex_cfg_wb195(struct ath_softc *s
return (0);
 }
 
+/*
+ * Initial AR9485 / (WB225) bluetooth coexistence settings,
+ * just for experimentation.
+ *
+ * Return 0 for OK; errno for error.
+ */
+static int
+ath_btcoex_cfg_wb225(struct ath_softc *sc)
+{
+   HAL_BT_COEX_INFO btinfo;
+   HAL_BT_COEX_CONFIG btconfig;
+   struct ath_hal *ah = sc-sc_ah;
+
+   if (! ath_hal_btcoex_supported(ah))
+   return (EINVAL);
+
+   bzero(btinfo, sizeof(btinfo));
+   bzero(btconfig, sizeof(btconfig));
+
+   device_printf(sc-sc_dev, Enabling WB225 BTCOEX\n);
+
+   btinfo.bt_module = HAL_BT_MODULE_JANUS; /* XXX not used? */
+   btinfo.bt_coex_config = HAL_BT_COEX_CFG_3WIRE;
+   /*
+* These are the three GPIO pins hooked up between the AR9485 and
+* the bluetooth module.
+*/
+   btinfo.bt_gpio_bt_active = 4;
+   btinfo.bt_gpio_bt_priority = 8;
+   btinfo.bt_gpio_wlan_active = 5;
+
+   btinfo.bt_active_polarity = 1;  /* XXX not used */
+   btinfo.bt_single_ant = 1;   /* 1 antenna on ar9285 ? */
+   btinfo.bt_isolation = 0;/* in dB, not used */
+
+   ath_hal_btcoex_set_info(ah, btinfo);
+
+   btconfig.bt_time_extend = 0;
+   btconfig.bt_txstate_extend = 1; /* true */
+   btconfig.bt_txframe_extend = 1; /* true */
+   btconfig.bt_mode = HAL_BT_COEX_MODE_SLOTTED;
+   btconfig.bt_quiet_collision = 1;/* true */
+   btconfig.bt_rxclear_polarity = 1;   /* true */
+   btconfig.bt_priority_time = 2;
+   btconfig.bt_first_slot_time = 5;
+   btconfig.bt_hold_rxclear = 1;   /* true */
+
+   ath_hal_btcoex_set_config(ah, btconfig);
+
+   /*
+* Enable antenna diversity.
+*/
+   ath_hal_btcoex_set_parameter(ah, HAL_BT_COEX_ANTENNA_DIVERSITY, 1);
+
+   return (0);
+}
+
+
 #if 0
 /*
  * When using bluetooth coexistence, ASPM needs to be disabled
@@ -183,6 +241,8 @@ ath_btcoex_attach(struct ath_softc *sc)
 
if (strncmp(profname, wb195, 5) == 0) {
ret = ath_btcoex_cfg_wb195(sc);
+   } else if (strncmp(profname, wb225, 5) == 0) {
+   ret = ath_btcoex_cfg_wb225(sc);
} else {
return (0);
}
___
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-unsubscr...@freebsd.org


svn commit: r251743 - head/sbin/camcontrol

2013-06-14 Thread Alexander Motin
Author: mav
Date: Fri Jun 14 08:26:58 2013
New Revision: 251743
URL: http://svnweb.freebsd.org/changeset/base/251743

Log:
  Improve firmware download status check.  Previous check was insufficient for
  ATA since it ignored transport errors like command timeouts, while for SCSI
  it was just wrong.

Modified:
  head/sbin/camcontrol/fwdownload.c

Modified: head/sbin/camcontrol/fwdownload.c
==
--- head/sbin/camcontrol/fwdownload.c   Fri Jun 14 08:18:17 2013
(r251742)
+++ head/sbin/camcontrol/fwdownload.c   Fri Jun 14 08:26:58 2013
(r251743)
@@ -370,17 +370,15 @@ fw_download_img(struct cam_device *cam_d
}
if (!sim_mode) {
/* Execute the command. */
-   if (cam_send_ccb(cam_dev, ccb)  0) {
+   if (cam_send_ccb(cam_dev, ccb)  0 ||
+   (ccb-ccb_h.status  CAM_STATUS_MASK) !=
+   CAM_REQ_CMP) {
warnx(Error writing image to device);
if (printerrors)
cam_error_print(cam_dev, ccb, 
CAM_ESF_ALL,
   CAM_EPF_ALL, stderr);
goto bailout;
}
-   if (ccb-ataio.res.status != 0 /* !last_pkt*/) {
-   cam_error_print(cam_dev, ccb, CAM_ESF_ALL,
-  CAM_EPF_ALL, stderr);
-   }
}
/* Prepare next round. */
pkt_count++;
___
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-unsubscr...@freebsd.org


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

2013-06-14 Thread Sergey Kandaurov
Author: pluknet
Date: Fri Jun 14 08:28:08 2013
New Revision: 251744
URL: http://svnweb.freebsd.org/changeset/base/251744

Log:
  Fix and improve filemon(4) example:
  - remove return statements from void function [1]
  - include missing header
  - use O_CLOEXEC instead of separate fcntl() calls
  
  PR:   docs/179459 [1]
  MFC after:1 week

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

Modified: head/share/man/man4/filemon.4
==
--- head/share/man/man4/filemon.4   Fri Jun 14 08:26:58 2013
(r251743)
+++ head/share/man/man4/filemon.4   Fri Jun 14 08:28:08 2013
(r251744)
@@ -31,7 +31,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd May 30, 2012
+.Dd June 14, 2013
 .Dt FILEMON 4
 .Os
 .Sh NAME
@@ -126,6 +126,7 @@ is set to indicate the error.
 #include dev/filemon/filemon.h
 #include fcntl.h
 #include err.h
+#include unistd.h
 
 static void
 open_filemon(void)
@@ -133,29 +134,24 @@ open_filemon(void)
pid_t child;
int fm_fd, fm_log;
 
-   if ((fm_fd = open(/dev/filemon, O_RDWR)) == -1)
+   if ((fm_fd = open(/dev/filemon, O_RDWR | O_CLOEXEC)) == -1)
err(1, open(\e/dev/filemon\e, O_RDWR));
if ((fm_log = open(filemon.out,
-   O_CREAT | O_WRONLY | O_TRUNC, DEFFILEMODE)) == -1)
+   O_CREAT | O_WRONLY | O_TRUNC | O_CLOEXEC, DEFFILEMODE)) == -1)
err(1, open(filemon.out));
 
if (ioctl(fm_fd, FILEMON_SET_FD, fm_log) == -1)
err(1, Cannot set filemon log file descriptor);
-   /* Set up these two fd's to close on exec. */
-   (void)fcntl(fm_fd, F_SETFD, FD_CLOEXEC);
-   (void)fcntl(fm_log, F_SETFD, FD_CLOEXEC);
 
if ((child = fork()) == 0) {
child = getpid();
if (ioctl(fm_fd, FILEMON_SET_PID, child) == -1)
err(1, Cannot set filemon PID);
/* Do something here. */
-   return 0;
} else {
wait(child);
close(fm_fd);
}
-   return 0;
 }
 .Ed
 .Pp
___
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-unsubscr...@freebsd.org


Re: svn commit: r251728 - stable/8/contrib/gcc

2013-06-14 Thread Dimitry Andric
On Jun 14, 2013, at 05:28, Pedro F. Giffuni p...@freebsd.org wrote:
 Author: pfg
 Date: Fri Jun 14 03:28:29 2013
 New Revision: 251728
 URL: http://svnweb.freebsd.org/changeset/base/251728
 
 Log:
  MFC  r250550, r250566;
 
  Update the gcc43 ChangeLog.
 
  Add support for d floating-point suffix, as defined by draft N1312
  of TR 24732.

Hi Pedro,

Unfortunately this breaks tinderbox:

/src/gnu/usr.bin/cc/cc_int/../../../../contrib/gcc/c-lex.c: In function 
'interpret_float':
/src/gnu/usr.bin/cc/cc_int/../../../../contrib/gcc/c-lex.c:644: error: 
'CPP_N_DEFAULT' undeclared (first use in this function)
/src/gnu/usr.bin/cc/cc_int/../../../../contrib/gcc/c-lex.c:644: error: (Each 
undeclared identifier is reported only once
/src/gnu/usr.bin/cc/cc_int/../../../../contrib/gcc/c-lex.c:644: error: for each 
function it appears in.)
*** [c-lex.o] Error code 1

So apparently you need to also MFC the change that introduced the
CPP_N_DEFAULT identifier?

-Dimitry

___
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-unsubscr...@freebsd.org


Re: svn commit: r251703 - in head/sys: amd64/amd64 i386/i386 i386/xen kern mips/mips sparc64/sparc64 sys

2013-06-14 Thread Sergey Kandaurov
On 14 June 2013 02:50, Bryan Drewery bdrew...@freebsd.org wrote:
[..]

 Looks like cpusetobj_ffs() - CPU_FFS() was missed in
 sys/amd64/vmm/io/vlapic.c:

 --- vlapic.o ---
 /usr/src/sys/modules/vmm/../../amd64/vmm/io/vlapic.c:468:15: error: implicit 
 declaration of function 'cpusetobj_ffs' is invalid in C99 
 [-Werror,-Wimplicit-function-declaration]
 while ((i = cpusetobj_ffs(dmask)) != 0) {


It should be fixed in r251745.

-- 
wbr,
pluknet
___
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-unsubscr...@freebsd.org


svn commit: r251746 - in stable/8/contrib/gcclibs/libcpp: . include

2013-06-14 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Jun 14 10:45:31 2013
New Revision: 251746
URL: http://svnweb.freebsd.org/changeset/base/251746

Log:
  MFC   r250550:
  
  (Missing libcpp merge)
  
  Add support for d floating-point suffix, as defined by draft N1312
  of TR 24732.
  
  Reported by:  dim
  Pointy hat:   pfg

Modified:
  stable/8/contrib/gcclibs/libcpp/expr.c
  stable/8/contrib/gcclibs/libcpp/include/cpplib.h
Directory Properties:
  stable/8/contrib/gcclibs/   (props changed)

Modified: stable/8/contrib/gcclibs/libcpp/expr.c
==
--- stable/8/contrib/gcclibs/libcpp/expr.c  Fri Jun 14 10:26:38 2013
(r251745)
+++ stable/8/contrib/gcclibs/libcpp/expr.c  Fri Jun 14 10:45:31 2013
(r251746)
@@ -82,7 +82,7 @@ static void check_promotion (cpp_reader 
 static unsigned int
 interpret_float_suffix (const uchar *s, size_t len)
 {
-  size_t f = 0, l = 0, i = 0, d = 0;
+  size_t f = 0, l = 0, i = 0, d = 0, d0 = 0;
 
   while (len--)
 switch (s[len])
@@ -101,7 +101,12 @@ interpret_float_suffix (const uchar *s, 
return 0;
   }
 
-  if (f + l  1 || i  1)
+  if (d == 1  !f  !l) {
+d = 0;
+d0 = 1;
+  }
+
+  if (f + d0 + l  1 || i  1)
 return 0;
 
   /* Allow dd, df, dl suffixes for decimal float constants.  */
@@ -110,7 +115,8 @@ interpret_float_suffix (const uchar *s, 
 
   return ((i ? CPP_N_IMAGINARY : 0)
  | (f ? CPP_N_SMALL :
-l ? CPP_N_LARGE : CPP_N_MEDIUM)
+d0 ? CPP_N_MEDIUM :
+l ? CPP_N_LARGE : CPP_N_DEFAULT)
  | (d ? CPP_N_DFLOAT : 0));
 }
 
@@ -261,6 +267,13 @@ cpp_classify_number (cpp_reader *pfile, 
   traditional C rejects the \%.*s\ suffix,
   (int) (limit - str), str);
 
+  /* A suffix for double is a GCC extension via decimal float support.
+If the suffix also specifies an imaginary value we'll catch that
+later.  */
+  if ((result == CPP_N_MEDIUM)  CPP_PEDANTIC (pfile))
+   cpp_error (pfile, CPP_DL_PEDWARN,
+  suffix for double constant is a GCC extension);
+
   /* Radix must be 10 for decimal floats.  */
   if ((result  CPP_N_DFLOAT)  radix != 10)
 {

Modified: stable/8/contrib/gcclibs/libcpp/include/cpplib.h
==
--- stable/8/contrib/gcclibs/libcpp/include/cpplib.hFri Jun 14 10:26:38 
2013(r251745)
+++ stable/8/contrib/gcclibs/libcpp/include/cpplib.hFri Jun 14 10:45:31 
2013(r251746)
@@ -748,6 +748,7 @@ struct cpp_num
 #define CPP_N_UNSIGNED 0x1000  /* Properties.  */
 #define CPP_N_IMAGINARY0x2000
 #define CPP_N_DFLOAT   0x4000
+#define CPP_N_DEFAULT  0x8000
 
 /* Classify a CPP_NUMBER token.  The return value is a combination of
the flags from the above sets.  */
___
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-unsubscr...@freebsd.org


Re: svn commit: r251703 - in head/sys: amd64/amd64 i386/i386 i386/xen kern mips/mips sparc64/sparc64 sys

2013-06-14 Thread Bryan Drewery
On 6/14/2013 6:07 AM, Sergey Kandaurov wrote:
 On 14 June 2013 02:50, Bryan Drewery bdrew...@freebsd.org wrote:
 [..]

 Looks like cpusetobj_ffs() - CPU_FFS() was missed in
 sys/amd64/vmm/io/vlapic.c:

 --- vlapic.o ---
 /usr/src/sys/modules/vmm/../../amd64/vmm/io/vlapic.c:468:15: error: 
 implicit declaration of function 'cpusetobj_ffs' is invalid in C99 
 [-Werror,-Wimplicit-function-declaration]
 while ((i = cpusetobj_ffs(dmask)) != 0) {

 
 It should be fixed in r251745.
 

Thanks!

-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


svn commit: r251745 - head/sys/amd64/vmm/io

2013-06-14 Thread Sergey Kandaurov
Author: pluknet
Date: Fri Jun 14 10:26:38 2013
New Revision: 251745
URL: http://svnweb.freebsd.org/changeset/base/251745

Log:
  Replace cpusetffs_obj with CPU_FFS, missed in r251703.
  
  Reported by:  bdrewery, O. Hartmann

Modified:
  head/sys/amd64/vmm/io/vlapic.c

Modified: head/sys/amd64/vmm/io/vlapic.c
==
--- head/sys/amd64/vmm/io/vlapic.c  Fri Jun 14 08:28:08 2013
(r251744)
+++ head/sys/amd64/vmm/io/vlapic.c  Fri Jun 14 10:26:38 2013
(r251745)
@@ -465,7 +465,7 @@ lapic_process_icr(struct vlapic *vlapic,
break;
}
 
-   while ((i = cpusetobj_ffs(dmask)) != 0) {
+   while ((i = CPU_FFS(dmask)) != 0) {
i--;
CPU_CLR(i, dmask);
if (mode == APIC_DELMODE_FIXED) {
___
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-unsubscr...@freebsd.org


Re: svn commit: r251728 - stable/8/contrib/gcc

2013-06-14 Thread Pedro Giffuni

On 14.06.2013 03:46, Dimitry Andric wrote:

On Jun 14, 2013, at 05:28, Pedro F. Giffuni p...@freebsd.org wrote:

Author: pfg
Date: Fri Jun 14 03:28:29 2013
New Revision: 251728
URL: http://svnweb.freebsd.org/changeset/base/251728

Log:
  MFC   r250550, r250566;

  Update the gcc43 ChangeLog.

  Add support for d floating-point suffix, as defined by draft N1312
  of TR 24732.

Hi Pedro,

Unfortunately this breaks tinderbox:

/src/gnu/usr.bin/cc/cc_int/../../../../contrib/gcc/c-lex.c: In function 
'interpret_float':
/src/gnu/usr.bin/cc/cc_int/../../../../contrib/gcc/c-lex.c:644: error: 
'CPP_N_DEFAULT' undeclared (first use in this function)
/src/gnu/usr.bin/cc/cc_int/../../../../contrib/gcc/c-lex.c:644: error: (Each 
undeclared identifier is reported only once
/src/gnu/usr.bin/cc/cc_int/../../../../contrib/gcc/c-lex.c:644: error: for each 
function it appears in.)
*** [c-lex.o] Error code 1

So apparently you need to also MFC the change that introduced the
CPP_N_DEFAULT identifier?


Sorry! It was indeed an incomplete merge.

Fixed in r251746.

Thank you for the notice, and for waiting for me to wake up ;) !

Pedro.

___
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-unsubscr...@freebsd.org


Re: svn commit: r251662 - in head: contrib/llvm/include/llvm contrib/llvm/include/llvm-c contrib/llvm/include/llvm-c/Transforms contrib/llvm/include/llvm/ADT contrib/llvm/include/llvm/Analysis contrib

2013-06-14 Thread Bryan Drewery
On 6/13/2013 12:58 AM, Dimitry Andric wrote:
 On Jun 13, 2013, at 01:13, Bryan Drewery bdrew...@freebsd.org wrote:
 On 6/12/2013 1:48 PM, Dimitry Andric wrote:
 Author: dim
 Date: Wed Jun 12 18:48:53 2013
 New Revision: 251662
 URL: http://svnweb.freebsd.org/changeset/base/251662

 Log:
  Upgrade our copy of llvm/clang to 3.3 release.

  Release notes are still in the works, these will follow soon.

  MFC after: 1 month

 With make -j16 -DNO_CLEAN buildworld:

 --- ExprConstant.o ---
 /usr/src/lib/clang/libclangast/../../../contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp:2173:26:
  error: no member named 'note_constexpr_modify_const_type' in namespace 
 'clang::diag'
  Info.Diag(E, diag::note_constexpr_modify_const_type)  QT;
   ~~^
 /usr/src/lib/clang/libclangast/../../../contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp:2781:42:
  error: no member named 'note_constexpr_no_return' in namespace 
 'clang::diag'; did you mean 'note_constexpr_nonliteral'?
Info.Diag(Callee-getLocEnd(), diag::note_constexpr_no_return);
   ~~^~~~
 note_constexpr_nonliteral
 ./DiagnosticASTKinds.inc.h:51:6: note: 'note_constexpr_nonliteral' declared 
 here
 DIAG(note_constexpr_nonliteral, CLASS_NOTE, diag::MAP_FATAL, non-literal 
 type %0 cannot be used in a constant expression, 0, true, false, false, 
 false, 0)
 ^
 /usr/src/lib/clang/libclangast/../../../contrib/llvm/tools/clang/include/clang/AST/ASTDiagnostic.h:19:63:
  note: expanded from macro 'DIAG'
 SFINAE,ACCESS,NOWERROR,SHOWINSYSHEADER,CATEGORY) ENUM,
  ^
 --- RecordLayout.o ---
 c++  -O2 -pipe 
 -I/usr/src/lib/clang/libclangast/../../../contrib/llvm/include 
 -I/usr/src/lib/clang/libclangast/../../../contrib/llvm/tools/clang/include 
 -I/usr/src/lib/clang/libclangast/../../../contrib/llvm/tools/clang/lib/AST 
 -I. -I/us
 r/src/lib/clang/libclangast/../../../contrib/llvm/../../lib/clang/include 
 -DLLVM_ON_UNIX -DLLVM_ON_FREEBSD -D__STDC_LIMIT_MACROS 
 -D__STDC_CONSTANT_MACROS -fno-strict-aliasing 
 -DLLVM_DEFAULT_TARGET_TRIPLE=\x86_64-unknown-freebsd10.0\ -D
 LLVM_HOST_TRIPLE=\x86_64-unknown-freebsd10.0\ 
 -DDEFAULT_SYSROOT=\/usr/obj/usr/src/tmp\ -g 
 -I/usr/obj/usr/src/tmp/legacy/usr/include -fno-exceptions -fno-rtti -c 
 /usr/src/lib/clang/libclangast/../../../contrib/llvm/tools/clang/lib/AST
 /RecordLayout.cpp -o RecordLayout.o
 --- Stmt.o ---
 c++  -O2 -pipe 
 -I/usr/src/lib/clang/libclangast/../../../contrib/llvm/include 
 -I/usr/src/lib/clang/libclangast/../../../contrib/llvm/tools/clang/include 
 -I/usr/src/lib/clang/libclangast/../../../contrib/llvm/tools/clang/lib/AST 
 -I. -I/us
 r/src/lib/clang/libclangast/../../../contrib/llvm/../../lib/clang/include 
 -DLLVM_ON_UNIX -DLLVM_ON_FREEBSD -D__STDC_LIMIT_MACROS 
 -D__STDC_CONSTANT_MACROS -fno-strict-aliasing 
 -DLLVM_DEFAULT_TARGET_TRIPLE=\x86_64-unknown-freebsd10.0\ -D
 LLVM_HOST_TRIPLE=\x86_64-unknown-freebsd10.0\ 
 -DDEFAULT_SYSROOT=\/usr/obj/usr/src/tmp\ -g 
 -I/usr/obj/usr/src/tmp/legacy/usr/include -fno-exceptions -fno-rtti -c 
 /usr/src/lib/clang/libclangast/../../../contrib/llvm/tools/clang/lib/AST
 /Stmt.cpp -o Stmt.o
 --- ExprConstant.o ---
 14 errors generated.
 *** [ExprConstant.o] Error code 1
 
 Can you please try a clean build?
 

Worked

-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r251732 - in head/sys: kern sys

2013-06-14 Thread Bryan Drewery
On 6/13/2013 11:10 PM, Lawrence Stewart wrote:
 Author: lstewart
 Date: Fri Jun 14 04:10:34 2013
 New Revision: 251732
 URL: http://svnweb.freebsd.org/changeset/base/251732
 
 Log:
   Add support for non-virtualised hhook points, which are uniquely identified 
 by
   type and id, as compared to virtualised hook points which are now uniquely
   identified by type, id and a vid (which for vimage is the pointer to the 
 vnet
   that the hhook resides in).
   
   All hhook_head structs for both virtualised and non-virtualised hook points
   coexist in hhook_head_list, and a separate list is maintained for hhook 
 points
   within each vnet to simplify some vimage-related housekeeping.
   
   Reviewed by:scottl
   MFC after:  1 week
 
 Modified:
   head/sys/kern/kern_hhook.c
   head/sys/sys/hhook.h
 
 Modified: head/sys/kern/kern_hhook.c
 ==
 --- head/sys/kern/kern_hhook.cFri Jun 14 03:58:52 2013
 (r251731)
 +++ head/sys/kern/kern_hhook.cFri Jun 14 04:10:34 2013
 (r251732)
 @@ -61,8 +61,9 @@ struct hhook {
  static MALLOC_DEFINE(M_HHOOK, hhook, Helper hooks are linked off 
 hhook_head lists);
  
  LIST_HEAD(hhookheadhead, hhook_head);
 -VNET_DEFINE(struct hhookheadhead, hhook_head_list);
 -#define  V_hhook_head_list VNET(hhook_head_list)
 +struct hhookheadhead hhook_head_list;
 +VNET_DEFINE(struct hhookheadhead, hhook_vhead_list);
 +#define  V_hhook_vhead_list VNET(hhook_vhead_list)
  
  static struct mtx hhook_head_list_lock;
  MTX_SYSINIT(hhookheadlistlock, hhook_head_list_lock, hhook_head list lock,
 @@ -245,13 +246,6 @@ hhook_head_register(int32_t hhook_type, 
   return (EEXIST);
   }
  
 - /* XXXLAS: Need to implement support for non-virtualised hooks. */
 - if ((flags  HHOOK_HEADISINVNET) == 0) {
 - printf(%s: only vnet-style virtualised hooks can be used\n,
 - __func__);
 - return (EINVAL);
 - }
 -
   tmphhh = malloc(sizeof(struct hhook_head), M_HHOOK,
   M_ZERO | ((flags  HHOOK_WAITOK) ? M_WAITOK : M_NOWAIT));
  
 @@ -270,14 +264,15 @@ hhook_head_register(int32_t hhook_type, 
   } else
   refcount_init(tmphhh-hhh_refcount, 0);
  
 + HHHLIST_LOCK();
   if (flags  HHOOK_HEADISINVNET) {
   tmphhh-hhh_flags |= HHH_ISINVNET;
 - HHHLIST_LOCK();
 - LIST_INSERT_HEAD(V_hhook_head_list, tmphhh, hhh_next);
 - HHHLIST_UNLOCK();
 - } else {
 - /* XXXLAS: Add tmphhh to the non-virtualised list. */
 + KASSERT(curvnet != NULL, (curvnet is NULL));

I am hitting this on boot now. I'm having unrelated trouble with console
so am unable to get much more information from the panic.

https://dl.dropboxusercontent.com/u/8732004/curvnet.jpg

-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


svn commit: r251747 - stable/9/etc/mtree

2013-06-14 Thread John Baldwin
Author: jhb
Date: Fri Jun 14 15:58:24 2013
New Revision: 251747
URL: http://svnweb.freebsd.org/changeset/base/251747

Log:
  Merge a missing part of 235613 to add the new dirs to mtree.

Modified:
  stable/9/etc/mtree/BSD.usr.dist
Directory Properties:
  stable/9/etc/mtree/   (props changed)

Modified: stable/9/etc/mtree/BSD.usr.dist
==
--- stable/9/etc/mtree/BSD.usr.dist Fri Jun 14 10:45:31 2013
(r251746)
+++ stable/9/etc/mtree/BSD.usr.dist Fri Jun 14 15:58:24 2013
(r251747)
@@ -200,6 +200,10 @@
 ..
 ..
 ..
+dtrace
+toolkit
+..
+..  
 examples
 BSD_daemon
 ..
___
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-unsubscr...@freebsd.org


svn commit: r251748 - head/share/mk

2013-06-14 Thread Simon J. Gerraty
Author: sjg
Date: Fri Jun 14 16:24:07 2013
New Revision: 251748
URL: http://svnweb.freebsd.org/changeset/base/251748

Log:
  We cannot remove the _+_ trick, until old make is completely deprecated.
  But we don't want to set it to + for bmake since it breaks make -N
  which is used to supress the normal handling of targets marked with .MAKE
  (which seems broken in fmake and might be why _+_ was introduced).
  Add some comments to explain what's gong on.
  
  Reviewed by:  obrien

Modified:
  head/share/mk/sys.mk

Modified: head/share/mk/sys.mk
==
--- head/share/mk/sys.mkFri Jun 14 15:58:24 2013(r251747)
+++ head/share/mk/sys.mkFri Jun 14 16:24:07 2013(r251748)
@@ -95,7 +95,13 @@ ECHODIR  ?=  true
 .endif
 .endif
 
-.if !empty(.MAKEFLAGS:M-n)  ${.MAKEFLAGS:M-n} == -n
+.if defined(.PARSEDIR)
+# _+_ appears to be a workaround for the special src .MAKE not working.
+# setting it to + interferes with -N
+_+_?=
+.elif !empty(.MAKEFLAGS:M-n)  ${.MAKEFLAGS:M-n} == -n
+# the check above matches only a single -n, so -n -n will result
+# in _+_ = +
 _+_?=
 .else
 _+_?=  +
___
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-unsubscr...@freebsd.org


svn commit: r251749 - head/share/mk

2013-06-14 Thread Simon J. Gerraty
Author: sjg
Date: Fri Jun 14 16:25:41 2013
New Revision: 251749
URL: http://svnweb.freebsd.org/changeset/base/251749

Log:
  Flag recursive make targets with .MAKE (has no effect on fmake)
  make -n will still exectute such targets
  make -N will not.
  
  Reviewed by:  obrien

Modified:
  head/share/mk/bsd.subdir.mk

Modified: head/share/mk/bsd.subdir.mk
==
--- head/share/mk/bsd.subdir.mk Fri Jun 14 16:24:07 2013(r251748)
+++ head/share/mk/bsd.subdir.mk Fri Jun 14 16:25:41 2013(r251749)
@@ -36,14 +36,14 @@ __bsd.subdir.mk__:
 
 DISTRIBUTION?= base
 .if !target(distribute)
-distribute:
+distribute: .MAKE
 .for dist in ${DISTRIBUTION}
${_+_}cd ${.CURDIR}; \
${MAKE} install -DNO_SUBDIR DESTDIR=${DISTDIR}/${dist} SHARED=copies
 .endfor
 .endif
 
-_SUBDIR: .USE
+_SUBDIR: .USE .MAKE
 .if defined(SUBDIR)  !empty(SUBDIR)  !defined(NO_SUBDIR)
@${_+_}set -e; for entry in ${SUBDIR}; do \
if test -d ${.CURDIR}/$${entry}.${MACHINE_ARCH}; then \
@@ -60,7 +60,7 @@ _SUBDIR: .USE
done
 .endif
 
-${SUBDIR}: .PHONY
+${SUBDIR}: .PHONY .MAKE
${_+_}@if test -d ${.TARGET}.${MACHINE_ARCH}; then \
cd ${.CURDIR}/${.TARGET}.${MACHINE_ARCH}; \
else \
@@ -81,7 +81,7 @@ ${__stage}${__target}:
 ${__stage}${__target}: _SUBDIR
 .endif
 .endfor
-${__target}:
+${__target}: .MAKE
${_+_}set -e; cd ${.CURDIR}; ${MAKE} build${__target}; ${MAKE} 
install${__target}
 .endfor
 
___
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-unsubscr...@freebsd.org


svn commit: r251750 - head

2013-06-14 Thread Simon J. Gerraty
Author: sjg
Date: Fri Jun 14 16:30:11 2013
New Revision: 251750
URL: http://svnweb.freebsd.org/changeset/base/251750

Log:
  Flag recursive make targets with .MAKE
  so that job token pipe is passed to them.
  To avoid surprising anyone, only add .MAKE to ${TGTS} when -n
  has not been specified (at least for Makefile).
  
  Reviewed by:  obrien

Modified:
  head/Makefile
  head/Makefile.inc1

Modified: head/Makefile
==
--- head/Makefile   Fri Jun 14 16:25:41 2013(r251749)
+++ head/Makefile   Fri Jun 14 16:30:11 2013(r251750)
@@ -209,6 +209,12 @@ cleanworld:
 # Handle the user-driven targets, using the source relative mk files.
 #
 
+.if empty(.MAKEFLAGS:M-n)
+# skip this for -n to avoid changing previous behavior of 
+# 'make -n buildworld' etc.
+${TGTS}: .MAKE
+.endif
+
 ${TGTS}:
${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET}
 

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Fri Jun 14 16:25:41 2013(r251749)
+++ head/Makefile.inc1  Fri Jun 14 16:30:11 2013(r251750)
@@ -1890,3 +1890,5 @@ _xi-links:
 xdev xdev-build xdev-install:
@echo *** Error: Both XDEV and XDEV_ARCH must be defined for 
\${.TARGET}\ target
 .endif
+
+buildkernel ${WMAKE_TGTS} ${.ALLTARGETS:M_*}: .MAKE
___
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-unsubscr...@freebsd.org


svn commit: r251751 - head/sys/dev/xen/blkfront

2013-06-14 Thread Justin T. Gibbs
Author: gibbs
Date: Fri Jun 14 17:00:58 2013
New Revision: 251751
URL: http://svnweb.freebsd.org/changeset/base/251751

Log:
  Improve debugger visibility into queuing functions by removing the macro
  scheme for defining inline command queuing functions.
  
  Prefer enums to #defines.
  
  sys/dev/xen/blkfront/block.h
Replace inline function generation performed by the
XBDQ_COMMAND_QUEUE() macro with single instances of each
inline function (init, enqueue, dequeue, remove).  This was
made possible by using queue indexes instead of bit flags
in the command structure, and passing the index enum as
an argument to the functions.
  
Improve panic/assert messages in the queue functions.
  
Combine queue data and stats into a single data structure
and declare an array of them instead of each queue individually.
  
Convert command flags, softc state, and softc flags to enums.
  
  sys/dev/xen/blkfront/blkfront.c
Mechanical adjustments for new queue api.
  
  Sponsored by: Spectra Logic Corporation
  MFC after:1 week

Modified:
  head/sys/dev/xen/blkfront/blkfront.c
  head/sys/dev/xen/blkfront/block.h

Modified: head/sys/dev/xen/blkfront/blkfront.c
==
--- head/sys/dev/xen/blkfront/blkfront.cFri Jun 14 16:30:11 2013
(r251750)
+++ head/sys/dev/xen/blkfront/blkfront.cFri Jun 14 17:00:58 2013
(r251751)
@@ -83,10 +83,6 @@ static void xbd_startio(struct xbd_softc
 
 #define XBD_SECTOR_SHFT9
 
-#define XBD_STATE_DISCONNECTED 0
-#define XBD_STATE_CONNECTED1
-#define XBD_STATE_SUSPENDED2
-
 /* Global Static Data 
*/
 static MALLOC_DEFINE(M_XENBLOCKFRONT, xbd, Xen Block Front driver data);
 
@@ -106,13 +102,14 @@ static void
 xbd_free_command(struct xbd_command *cm)
 {
 
-   KASSERT((cm-cm_flags  XBD_ON_XBDQ_MASK) == 0,
-   (Freeing command that is still on a queue\n));
+   KASSERT((cm-cm_flags  XBDCF_Q_MASK) == XBD_Q_NONE,
+   (Freeing command that is still on queue %d.,
+   cm-cm_flags  XBDCF_Q_MASK));
 
-   cm-cm_flags = 0;
+   cm-cm_flags = XBDCF_INITIALIZER;
cm-cm_bp = NULL;
cm-cm_complete = NULL;
-   xbd_enqueue_free(cm);
+   xbd_enqueue_cm(cm, XBD_Q_FREE);
 }
 
 static void
@@ -212,13 +209,13 @@ xbd_queue_cb(void *arg, bus_dma_segment_
 
gnttab_free_grant_references(cm-cm_gref_head);
 
-   xbd_enqueue_busy(cm);
+   xbd_enqueue_cm(cm, XBD_Q_BUSY);
 
/*
 * This flag means that we're probably executing in the busdma swi
 * instead of in the startio context, so an explicit flush is needed.
 */
-   if (cm-cm_flags  XBD_CMD_FROZEN)
+   if (cm-cm_flags  XBDCF_FROZEN)
xbd_flush_requests(sc);
 
return;
@@ -233,8 +230,8 @@ xbd_queue_request(struct xbd_softc *sc, 
cm-cm_datalen, xbd_queue_cb, cm, 0);
if (error == EINPROGRESS) {
printf(EINPROGRESS\n);
-   sc-xbd_flags |= XBD_FROZEN;
-   cm-cm_flags |= XBD_CMD_FROZEN;
+   sc-xbd_flags |= XBDF_FROZEN;
+   cm-cm_flags |= XBDCF_FROZEN;
return (0);
}
 
@@ -259,14 +256,14 @@ xbd_bio_command(struct xbd_softc *sc)
struct xbd_command *cm;
struct bio *bp;
 
-   if (unlikely(sc-xbd_connected != XBD_STATE_CONNECTED))
+   if (unlikely(sc-xbd_state != XBD_STATE_CONNECTED))
return (NULL);
 
bp = xbd_dequeue_bio(sc);
if (bp == NULL)
return (NULL);
 
-   if ((cm = xbd_dequeue_free(sc)) == NULL) {
+   if ((cm = xbd_dequeue_cm(sc, XBD_Q_FREE)) == NULL) {
xbd_requeue_bio(sc, bp);
return (NULL);
}
@@ -277,8 +274,8 @@ xbd_bio_command(struct xbd_softc *sc)
xbd_restart_queue_callback, sc,
sc-xbd_max_request_segments);
xbd_requeue_bio(sc, bp);
-   xbd_enqueue_free(cm);
-   sc-xbd_flags |= XBD_FROZEN;
+   xbd_enqueue_cm(cm, XBD_Q_FREE);
+   sc-xbd_flags |= XBDF_FROZEN;
return (NULL);
}
 
@@ -307,15 +304,15 @@ xbd_startio(struct xbd_softc *sc)
 
mtx_assert(sc-xbd_io_lock, MA_OWNED);
 
-   if (sc-xbd_connected != XBD_STATE_CONNECTED)
+   if (sc-xbd_state != XBD_STATE_CONNECTED)
return;
 
while (RING_FREE_REQUESTS(sc-xbd_ring) =
sc-xbd_max_request_blocks) {
-   if (sc-xbd_flags  XBD_FROZEN)
+   if (sc-xbd_flags  XBDF_FROZEN)
break;
 
-   cm = xbd_dequeue_ready(sc);
+   cm = xbd_dequeue_cm(sc, XBD_Q_READY);
 
if (cm == NULL)
cm = xbd_bio_command(sc);
@@ -374,7 +371,7 @@ xbd_int(void 

svn commit: r251752 - head/sys/kern

2013-06-14 Thread Lawrence Stewart
Author: lstewart
Date: Fri Jun 14 18:11:21 2013
New Revision: 251752
URL: http://svnweb.freebsd.org/changeset/base/251752

Log:
  Fix a major oversight in r251732 which causes non-VIMAGE kernels to trigger a
  KASSERT during TCP hhook registration at boot. Virtualised hook points only
  require extra housekeeping and sanity checking when options VIMAGE is 
present.
  
  Reported by:  bdrewery,jh,dhw
  Tested by:dhw
  MFC after:1 week
  X-MFC with:   251732

Modified:
  head/sys/kern/kern_hhook.c

Modified: head/sys/kern/kern_hhook.c
==
--- head/sys/kern/kern_hhook.c  Fri Jun 14 17:00:58 2013(r251751)
+++ head/sys/kern/kern_hhook.c  Fri Jun 14 18:11:21 2013(r251752)
@@ -267,9 +267,11 @@ hhook_head_register(int32_t hhook_type, 
HHHLIST_LOCK();
if (flags  HHOOK_HEADISINVNET) {
tmphhh-hhh_flags |= HHH_ISINVNET;
+#ifdef VIMAGE
KASSERT(curvnet != NULL, (curvnet is NULL));
tmphhh-hhh_vid = (uintptr_t)curvnet;
LIST_INSERT_HEAD(V_hhook_vhead_list, tmphhh, hhh_vnext);
+#endif
}
LIST_INSERT_HEAD(hhook_head_list, tmphhh, hhh_next);
HHHLIST_UNLOCK();
@@ -285,8 +287,10 @@ hhook_head_destroy(struct hhook_head *hh
HHHLIST_LOCK_ASSERT();
 
LIST_REMOVE(hhh, hhh_next);
+#ifdef VIMAGE
if (hhook_head_is_virtualised(hhh) == HHOOK_HEADISINVNET)
LIST_REMOVE(hhh, hhh_vnext);
+#endif
HHH_WLOCK(hhh);
STAILQ_FOREACH_SAFE(tmp, hhh-hhh_hooks, hhk_next, tmp2)
free(tmp, M_HHOOK);
@@ -347,12 +351,14 @@ hhook_head_get(int32_t hhook_type, int32
HHHLIST_LOCK();
LIST_FOREACH(hhh, hhook_head_list, hhh_next) {
if (hhh-hhh_type == hhook_type  hhh-hhh_id == hhook_id) {
+#ifdef VIMAGE
if (hhook_head_is_virtualised(hhh) ==
HHOOK_HEADISINVNET) {
KASSERT(curvnet != NULL, (curvnet is NULL));
if (hhh-hhh_vid != (uintptr_t)curvnet)
continue;
}
+#endif
refcount_acquire(hhh-hhh_refcount);
break;
}
___
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-unsubscr...@freebsd.org


svn commit: r251754 - stable/9/sys/dev/acpica

2013-06-14 Thread John Baldwin
Author: jhb
Date: Fri Jun 14 18:30:43 2013
New Revision: 251754
URL: http://svnweb.freebsd.org/changeset/base/251754

Log:
  MFC 249767:
  - Some BIOSes use an Extended IRQ resource descriptor in _PRS for a link
that uses non-ISA IRQs but use a plain IRQ resource in _CRS.  However,
a non-ISA IRQ can't fit into a plain IRQ resource.  If we encounter a
link like this, build the resource buffer from _PRS instead of _CRS.
  - Set the correct size of the end tag in a resource buffer.

Modified:
  stable/9/sys/dev/acpica/acpi.c
  stable/9/sys/dev/acpica/acpi_pci_link.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/acpica/acpi.c
==
--- stable/9/sys/dev/acpica/acpi.c  Fri Jun 14 18:26:57 2013
(r251753)
+++ stable/9/sys/dev/acpica/acpi.c  Fri Jun 14 18:30:43 2013
(r251754)
@@ -2332,7 +2332,7 @@ acpi_AppendBufferResource(ACPI_BUFFER *b
return (AE_NO_MEMORY);
rp = (ACPI_RESOURCE *)buf-Pointer;
rp-Type = ACPI_RESOURCE_TYPE_END_TAG;
-   rp-Length = 0;
+   rp-Length = ACPI_RS_SIZE_MIN;
 }
 if (res == NULL)
return (AE_OK);
@@ -2382,7 +2382,7 @@ acpi_AppendBufferResource(ACPI_BUFFER *b
 /* And add the terminator. */
 rp = ACPI_NEXT_RESOURCE(rp);
 rp-Type = ACPI_RESOURCE_TYPE_END_TAG;
-rp-Length = 0;
+rp-Length = ACPI_RS_SIZE_MIN;
 
 return (AE_OK);
 }

Modified: stable/9/sys/dev/acpica/acpi_pci_link.c
==
--- stable/9/sys/dev/acpica/acpi_pci_link.c Fri Jun 14 18:26:57 2013
(r251753)
+++ stable/9/sys/dev/acpica/acpi_pci_link.c Fri Jun 14 18:30:43 2013
(r251754)
@@ -99,6 +99,7 @@ struct link {
uint8_t l_bios_irq;
uint8_t l_irq;
uint8_t l_initial_irq;
+   UINT32  l_crs_type;
int l_res_index;
int l_num_irqs;
int *l_irqs;
@@ -236,6 +237,7 @@ link_add_crs(ACPI_RESOURCE *res, void *c
(%s: array boundary violation, __func__));
link = req-sc-pl_links[req-link_index];
link-l_res_index = req-res_index;
+   link-l_crs_type = res-Type;
req-link_index++;
req-res_index++;
 
@@ -364,6 +366,14 @@ link_add_prs(ACPI_RESOURCE *res, void *c
link-l_isa_irq = FALSE;
}
}
+
+   /*
+* If this is not an ISA IRQ but _CRS used a non-extended
+* IRQ descriptor, don't use _CRS as a template for _SRS.
+*/
+   if (!req-sc-pl_crs_bad  !link-l_isa_irq 
+   link-l_crs_type == ACPI_RESOURCE_TYPE_IRQ)
+   req-sc-pl_crs_bad = TRUE;
break;
default:
if (req-in_dpf == DPF_IGNORE)
___
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-unsubscr...@freebsd.org


svn commit: r251755 - stable/8/sys/dev/acpica

2013-06-14 Thread John Baldwin
Author: jhb
Date: Fri Jun 14 18:42:08 2013
New Revision: 251755
URL: http://svnweb.freebsd.org/changeset/base/251755

Log:
  MFC 249767:
  - Some BIOSes use an Extended IRQ resource descriptor in _PRS for a link
that uses non-ISA IRQs but use a plain IRQ resource in _CRS.  However,
a non-ISA IRQ can't fit into a plain IRQ resource.  If we encounter a
link like this, build the resource buffer from _PRS instead of _CRS.
  - Set the correct size of the end tag in a resource buffer.

Modified:
  stable/8/sys/dev/acpica/acpi.c
  stable/8/sys/dev/acpica/acpi_pci_link.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/dev/   (props changed)
  stable/8/sys/dev/acpica/   (props changed)

Modified: stable/8/sys/dev/acpica/acpi.c
==
--- stable/8/sys/dev/acpica/acpi.c  Fri Jun 14 18:30:43 2013
(r251754)
+++ stable/8/sys/dev/acpica/acpi.c  Fri Jun 14 18:42:08 2013
(r251755)
@@ -2198,7 +2198,7 @@ acpi_AppendBufferResource(ACPI_BUFFER *b
return (AE_NO_MEMORY);
rp = (ACPI_RESOURCE *)buf-Pointer;
rp-Type = ACPI_RESOURCE_TYPE_END_TAG;
-   rp-Length = 0;
+   rp-Length = ACPI_RS_SIZE_MIN;
 }
 if (res == NULL)
return (AE_OK);
@@ -2248,7 +2248,7 @@ acpi_AppendBufferResource(ACPI_BUFFER *b
 /* And add the terminator. */
 rp = ACPI_NEXT_RESOURCE(rp);
 rp-Type = ACPI_RESOURCE_TYPE_END_TAG;
-rp-Length = 0;
+rp-Length = ACPI_RS_SIZE_MIN;
 
 return (AE_OK);
 }

Modified: stable/8/sys/dev/acpica/acpi_pci_link.c
==
--- stable/8/sys/dev/acpica/acpi_pci_link.c Fri Jun 14 18:30:43 2013
(r251754)
+++ stable/8/sys/dev/acpica/acpi_pci_link.c Fri Jun 14 18:42:08 2013
(r251755)
@@ -99,6 +99,7 @@ struct link {
uint8_t l_bios_irq;
uint8_t l_irq;
uint8_t l_initial_irq;
+   UINT32  l_crs_type;
int l_res_index;
int l_num_irqs;
int *l_irqs;
@@ -236,6 +237,7 @@ link_add_crs(ACPI_RESOURCE *res, void *c
(%s: array boundary violation, __func__));
link = req-sc-pl_links[req-link_index];
link-l_res_index = req-res_index;
+   link-l_crs_type = res-Type;
req-link_index++;
req-res_index++;
 
@@ -364,6 +366,14 @@ link_add_prs(ACPI_RESOURCE *res, void *c
link-l_isa_irq = FALSE;
}
}
+
+   /*
+* If this is not an ISA IRQ but _CRS used a non-extended
+* IRQ descriptor, don't use _CRS as a template for _SRS.
+*/
+   if (!req-sc-pl_crs_bad  !link-l_isa_irq 
+   link-l_crs_type == ACPI_RESOURCE_TYPE_IRQ)
+   req-sc-pl_crs_bad = TRUE;
break;
default:
if (req-in_dpf == DPF_IGNORE)
___
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-unsubscr...@freebsd.org


svn commit: r251756 - stable/9/sys/net

2013-06-14 Thread Guy Helmer
Author: ghelmer
Date: Fri Jun 14 18:56:37 2013
New Revision: 251756
URL: http://svnweb.freebsd.org/changeset/base/251756

Log:
  MFC   r244090, r250945
  
  Changes to resolve races in bpfread() and catchpacket() that, at worst,
  cause kernel panics.
  
  Add a flag to the bpf descriptor to indicate whether the hold buffer
  is in use. In bpfread(), set the hold buffer in use flag before
  dropping the descriptor lock during the call to bpf_uiomove().
  Everywhere else the hold buffer is used or changed, wait while
  the hold buffer is in use by bpfread(). Add a KASSERT in bpfread()
  after re-acquiring the descriptor lock to assist uncovering any
  additional hold buffer races.
  
  While waiting for the bpf hold buffer to become idle, check
  the return value from mtx_sleep() and exit bpfread() on
  errors such as EINTR.

Modified:
  stable/9/sys/net/bpf.c
  stable/9/sys/net/bpf.h
  stable/9/sys/net/bpf_buffer.c
  stable/9/sys/net/bpfdesc.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/net/   (props changed)

Modified: stable/9/sys/net/bpf.c
==
--- stable/9/sys/net/bpf.c  Fri Jun 14 18:42:08 2013(r251755)
+++ stable/9/sys/net/bpf.c  Fri Jun 14 18:56:37 2013(r251756)
@@ -819,6 +819,7 @@ bpfopen(struct cdev *dev, int flags, int
 * particular buffer method.
 */
bpf_buffer_init(d);
+   d-bd_hbuf_in_use = 0;
d-bd_bufmode = BPF_BUFMODE_BUFFER;
d-bd_sig = SIGIO;
d-bd_direction = BPF_D_INOUT;
@@ -872,6 +873,14 @@ bpfread(struct cdev *dev, struct uio *ui
callout_stop(d-bd_callout);
timed_out = (d-bd_state == BPF_TIMED_OUT);
d-bd_state = BPF_IDLE;
+   while (d-bd_hbuf_in_use) {
+   error = mtx_sleep(d-bd_hbuf_in_use, d-bd_lock,
+   PRINET|PCATCH, bd_hbuf, 0);
+   if (error != 0) {
+   BPFD_UNLOCK(d);
+   return (error);
+   }
+   }
/*
 * If the hold buffer is empty, then do a timed sleep, which
 * ends when the timeout expires or when enough packets
@@ -940,24 +949,27 @@ bpfread(struct cdev *dev, struct uio *ui
/*
 * At this point, we know we have something in the hold slot.
 */
+   d-bd_hbuf_in_use = 1;
BPFD_UNLOCK(d);
 
/*
 * Move data from hold buffer into user space.
 * We know the entire buffer is transferred since
 * we checked above that the read buffer is bpf_bufsize bytes.
-*
-* XXXRW: More synchronization needed here: what if a second thread
-* issues a read on the same fd at the same time?  Don't want this
-* getting invalidated.
+*
+* We do not have to worry about simultaneous reads because
+* we waited for sole access to the hold buffer above.
 */
error = bpf_uiomove(d, d-bd_hbuf, d-bd_hlen, uio);
 
BPFD_LOCK(d);
+   KASSERT(d-bd_hbuf != NULL, (bpfread: lost bd_hbuf));
d-bd_fbuf = d-bd_hbuf;
d-bd_hbuf = NULL;
d-bd_hlen = 0;
bpf_buf_reclaimed(d);
+   d-bd_hbuf_in_use = 0;
+   wakeup(d-bd_hbuf_in_use);
BPFD_UNLOCK(d);
 
return (error);
@@ -,6 +1123,9 @@ reset_d(struct bpf_d *d)
 
BPFD_LOCK_ASSERT(d);
 
+   while (d-bd_hbuf_in_use)
+   mtx_sleep(d-bd_hbuf_in_use, d-bd_lock, PRINET,
+   bd_hbuf, 0);
if ((d-bd_hbuf != NULL) 
(d-bd_bufmode != BPF_BUFMODE_ZBUF || bpf_canfreebuf(d))) {
/* Free the hold buffer. */
@@ -1251,6 +1266,9 @@ bpfioctl(struct cdev *dev, u_long cmd, c
 
BPFD_LOCK(d);
n = d-bd_slen;
+   while (d-bd_hbuf_in_use)
+   mtx_sleep(d-bd_hbuf_in_use, d-bd_lock,
+   PRINET, bd_hbuf, 0);
if (d-bd_hbuf)
n += d-bd_hlen;
BPFD_UNLOCK(d);
@@ -1964,6 +1982,9 @@ filt_bpfread(struct knote *kn, long hint
ready = bpf_ready(d);
if (ready) {
kn-kn_data = d-bd_slen;
+   while (d-bd_hbuf_in_use)
+   mtx_sleep(d-bd_hbuf_in_use, d-bd_lock,
+   PRINET, bd_hbuf, 0);
if (d-bd_hbuf)
kn-kn_data += d-bd_hlen;
} else if (d-bd_rtout  0  d-bd_state == BPF_IDLE) {
@@ -2296,6 +2317,9 @@ catchpacket(struct bpf_d *d, u_char *pkt
 * spot to do it.
 */
if (d-bd_fbuf == NULL  bpf_canfreebuf(d)) {
+   while (d-bd_hbuf_in_use)
+   mtx_sleep(d-bd_hbuf_in_use, d-bd_lock,
+   PRINET, bd_hbuf, 0);
d-bd_fbuf = d-bd_hbuf;
d-bd_hbuf = NULL;
d-bd_hlen = 0;
@@ 

svn commit: r251757 - in stable/8: . cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zhack cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris...

2013-06-14 Thread Martin Matuska
Author: mm
Date: Fri Jun 14 19:26:32 2013
New Revision: 251757
URL: http://svnweb.freebsd.org/changeset/base/251757

Log:
  MFC 246619,247187,247265,247348,247398,247540,247585,248265,248267,248571,
  248976,249004,249042,249047,249188,249195,249196,249206,249207,249319,
  249326,249356,249357,249787,249883,249858
  
  Merge libzfs_core, zfs deadman thread and other ZFS bugfixes and improvements.
  
  MFC r246619:
Correct spelling of daemon.  No .Dd bump.
Noticed by: Nathan Rich Nathan.Rich dynastysystems com
  
  MFC r247187:
Import vendor change to avoid unitialized variable warnings.
  
Illumos ZFS issues:
3522 zfs module should not allow uninitialized variables
  
  MFC r247265:
Merge the ZFS I/O deadman thread from vendor (illumos).
This feature panics the system on hanging ZFS I/O, helps debugging
and resumes failed service.
  
The panic behavior can be controlled with the loader-only tunables:
vfs.zfs.deadman_enabled (enable or disable panic on stalled ZFS I/O)
vfs.zfs.deadman_synctime (expiration time for stalled ZFS I/O)
  
By default, ZFS I/O deadman is enabled by default on amd64 and i386
excluding virtual guest machines.
  
  MFC r247348:
Be more verbose on ZFS deadman I/O panic
Patch suggested upstream.
  
  MFC r247398:
Import metaslab_sync() speedup from vendor (illumos).
  
Illumos ZFS issues:
3552 condensing one space map burns 3 seconds of CPU in spa_sync() thread
3564 spa_sync() spends 5-10% of its time in metaslab_sync() (when not
condensing)
3578 transferring the freed map to the defer map should be constant time
3579 ztest trips assertion in metaslab_weight()
  
  MFC r247540:
Fix the zfs_ioctl compat layer to support zfs_cmd size change introduced
in r247265 (ZFS deadman thread). Both new utilities now support the old
kernel and new kernel properly detects old utilities.
  
For future backwards compatibility, the vfs.zfs.version.ioctl read-only
sysctl has been introduced. With this sysctl zfs utilities will be able
to detect the ioctl interface version of the currently loaded zfs module.
  
  MFC r247585:
Merge new read-only zfs properties from vendor (illumos)
  
Illumos ZFS issues:
3588 provide zfs properties for logical (uncompressed) space used and
 referenced
  
  MFC r248265:
Update zfs.8 manpage date (missing in r247585)
  
  MFC r248267:
Import minor ZFS changes from vendor
  
Illumos ZFS issues:
3604 zdb should print bpobjs more verbosely (fix zdb hang)
3606 zpool status -x shouldn't warn about old on-disk format
  
  MFC r248571:
MFV 238590, 238592:
In the first zfs ioctl restructuring phase, the libzfs_core library was
introduced. It is a new thin library that wraps around kernel ioctl's.
The idea is to provide a forward-compatible way of dealing with new
features. Arguments are passed in nvlists and not random zfs_cmd fields,
new-style ioctls are logged to pool history using a new method of
history logging.
  
http://blog.delphix.com/matt/2012/01/17/the-future-of-libzfs/
  
MFV 247580 [1]:
To address issues of several deadlocks and race conditions the locking
code around dsl_dataset was rewritten and the interface to synctasks
was changed.
  
User-Visible Changes:
zfs snapshot can create more arbitrary snapshots at once (atomically)
zfs destroy destroys multiple snapshots at once
zfs recv has improved performance
  
Backward Compatibility:
I have extended the compatibility layer to support full backward
compatibility by remapping or rewriting the responsible ioctl arguments.
Old utilities are fully supported by the new kernel module.
  
Forward Compatibility:
New utilities work with old kernels with the following restrictions:
  - creating, destroying, holding and releasing of multiple snapshots
at once is not supported, this includes recursive (-r) commands
  
Illumos ZFS issues:
  2882 implement libzfs_core
  2900 zfs snapshot should be able to create multiple,
   arbitrary snapshots at once
  3464 zfs synctask code needs restructuring
  
  MFC r248976:
Call dmu_snapshot_list_next() in zvol.c with dsl_pool_config lock held
  
  MFC r249004:
Do not check against uninitialized rc and comment out vendor code
  
  MFC r249042:
Fix possible pool hold leak in dmu_send_impl()
  
Illumos ZFS issues:
  3645 dmu_send_impl: possibilty of pool hold leak
  
  MFC r249047 (avg):
spa_open_common: fix argument to zvol_create_minors
  
Prior to r248571 spa_open was always called with a bare pool name,
but now it is called with a dataset name instead (spa_lookup handles
that).
So, when a ZFS root is mounted spa_open is called with a name of a root
dataset, which can very well be different from the pool name.
But zvol_create_minors should be called with the 

svn commit: r251758 - head/usr.sbin/bsdconfig/share/packages

2013-06-14 Thread Devin Teske
Author: dteske
Date: Fri Jun 14 19:35:30 2013
New Revision: 251758
URL: http://svnweb.freebsd.org/changeset/base/251758

Log:
  Add skeleton processing of selected packages in the order in which they
  should be processed. De-select each package as we process (actual
  processing still pending) each package so that if we get an error, we can
  return to an accurate state of selected packages.

Modified:
  head/usr.sbin/bsdconfig/share/packages/packages.subr

Modified: head/usr.sbin/bsdconfig/share/packages/packages.subr
==
--- head/usr.sbin/bsdconfig/share/packages/packages.subrFri Jun 14 
19:26:32 2013(r251757)
+++ head/usr.sbin/bsdconfig/share/packages/packages.subrFri Jun 14 
19:35:30 2013(r251758)
@@ -603,18 +603,53 @@ f_package_review()
--menu \\$prompt\\
$height $width $rows   \
$menu_list \
-   2 /dev/null
-   local retval=$?
+   2 /dev/null || return $?
+   # Return if the user pressed ESC or chose Cancel/No
 
#
-   # XXX
-   #
-   f_show_msg Coming soon...
+   # Process each of the selected packages:
+   # + First, process dependencies.
+   # + Second, process packages marked for Install.
+   # + Third, process packages marked for Re-install.
+   # + Finally, process packages marked for Uninstall.
#
+   for package in $SELECTED_PACKAGES; do
+   mark=
+   f_str2varname $package varpkg
+   f_getvar _mark_$varpkg mark
+   [ $mark = D ] || continue
+   # XXX Install dependency
+   f_package_deselect $package
+   done
+   for package in $SELECTED_PACKAGES; do
+   mark=
+   f_str2varname $package varpkg
+   f_getvar _mark_$varpkg mark
+   [ $mark = I ] || continue
+   # XXX Install package
+   f_package_deselect $package
+   done
+   for package in $SELECTED_PACKAGES; do
+   mark=
+   f_str2varname $package varpkg
+   f_getvar _mark_$varpkg mark
+   [ $mark = R ] || continue
+   # XXX Re-install package
+   f_package_deselect $package
+   done
+   for package in $SELECTED_PACKAGES; do
+   mark=
+   f_str2varname $package varpkg
+   f_getvar _mark_$varpkg mark
+   [ $mark = U ] || continue
+   # XXX Uninstall package
+   f_package_deselect $package
+   done
+
# XXX
-   #
+   f_show_msg Coming soon...
 
-   return $retval
+   return $SUCCESS
 }
 
 # f_package_config
___
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-unsubscr...@freebsd.org


svn commit: r251759 - stable/9/sys/dev/acpi_support

2013-06-14 Thread John Baldwin
Author: jhb
Date: Fri Jun 14 20:32:33 2013
New Revision: 251759
URL: http://svnweb.freebsd.org/changeset/base/251759

Log:
  MFC 250053:
  Only cleanup CMI-related state on detach if the system supports CMI.

Modified:
  stable/9/sys/dev/acpi_support/acpi_hp.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/acpi_support/acpi_hp.c
==
--- stable/9/sys/dev/acpi_support/acpi_hp.c Fri Jun 14 19:35:30 2013
(r251758)
+++ stable/9/sys/dev/acpi_support/acpi_hp.c Fri Jun 14 20:32:33 2013
(r251759)
@@ -573,28 +573,26 @@ acpi_hp_attach(device_t dev)
 static int
 acpi_hp_detach(device_t dev)
 {
-   int ret;
+   struct acpi_hp_softc *sc;

ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__);
-   struct acpi_hp_softc *sc = device_get_softc(dev);
-   if (sc-has_cmi  sc-hpcmi_open_pid != 0) {
-   ret = EBUSY;
-   }
-   else {
-   if (sc-has_notify) {
-   ACPI_WMI_REMOVE_EVENT_HANDLER(dev,
-   ACPI_HP_WMI_EVENT_GUID);
-   }
+   sc = device_get_softc(dev);
+   if (sc-has_cmi  sc-hpcmi_open_pid != 0)
+   return (EBUSY);
+
+   if (sc-has_notify)
+   ACPI_WMI_REMOVE_EVENT_HANDLER(dev, ACPI_HP_WMI_EVENT_GUID);
+
+   if (sc-has_cmi) {
if (sc-hpcmi_bufptr != -1) {
sbuf_delete(sc-hpcmi_sbuf);
sc-hpcmi_bufptr = -1;
}
sc-hpcmi_open_pid = 0;
destroy_dev(sc-hpcmi_dev_t);
-   ret = 0;
}
 
-   return (ret);
+   return (0);
 }
 
 static int
___
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-unsubscr...@freebsd.org


svn commit: r251760 - stable/8/sys/dev/acpi_support

2013-06-14 Thread John Baldwin
Author: jhb
Date: Fri Jun 14 20:44:23 2013
New Revision: 251760
URL: http://svnweb.freebsd.org/changeset/base/251760

Log:
  MFC 250053:
  Only cleanup CMI-related state on detach if the system supports CMI.

Modified:
  stable/8/sys/dev/acpi_support/acpi_hp.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/dev/   (props changed)
  stable/8/sys/dev/acpi_support/   (props changed)

Modified: stable/8/sys/dev/acpi_support/acpi_hp.c
==
--- stable/8/sys/dev/acpi_support/acpi_hp.c Fri Jun 14 20:32:33 2013
(r251759)
+++ stable/8/sys/dev/acpi_support/acpi_hp.c Fri Jun 14 20:44:23 2013
(r251760)
@@ -573,28 +573,26 @@ acpi_hp_attach(device_t dev)
 static int
 acpi_hp_detach(device_t dev)
 {
-   int ret;
+   struct acpi_hp_softc *sc;

ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__);
-   struct acpi_hp_softc *sc = device_get_softc(dev);
-   if (sc-has_cmi  sc-hpcmi_open_pid != 0) {
-   ret = EBUSY;
-   }
-   else {
-   if (sc-has_notify) {
-   ACPI_WMI_REMOVE_EVENT_HANDLER(dev,
-   ACPI_HP_WMI_EVENT_GUID);
-   }
+   sc = device_get_softc(dev);
+   if (sc-has_cmi  sc-hpcmi_open_pid != 0)
+   return (EBUSY);
+
+   if (sc-has_notify)
+   ACPI_WMI_REMOVE_EVENT_HANDLER(dev, ACPI_HP_WMI_EVENT_GUID);
+
+   if (sc-has_cmi) {
if (sc-hpcmi_bufptr != -1) {
sbuf_delete(sc-hpcmi_sbuf);
sc-hpcmi_bufptr = -1;
}
sc-hpcmi_open_pid = 0;
destroy_dev(sc-hpcmi_dev_t);
-   ret = 0;
}
 
-   return (ret);
+   return (0);
 }
 
 static int
___
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-unsubscr...@freebsd.org


svn commit: r251761 - in head/contrib/llvm/lib/Target/X86: . AsmParser

2013-06-14 Thread Dimitry Andric
Author: dim
Date: Fri Jun 14 21:14:36 2013
New Revision: 251761
URL: http://svnweb.freebsd.org/changeset/base/251761

Log:
  Pull in r181620 from llvm trunk:
  
[ms-inline asm] Fix a crasher when we fail on a direct match.
  
The issue was that the MatchingInlineAsm and VariantID args to the
MatchInstructionImpl function weren't being set properly.  Specifically, 
when
parsing intel syntax, the parser thought it was parsing inline assembly in 
the
att dialect; that will never be the case.
  
The crash was caused when the emitter tried to emit the instruction, but the
operands weren't set.  When parsing inline assembly we only set the opcode, 
not
the operands, which is used to lookup the instruction descriptor.
rdar://13854391 and PR15945
  
Also, this commit reverts r176036.  Now that we're correctly parsing the 
intel
syntax the pushad/popad don't match properly.  I've reimplemented that fix 
using
a MnemonicAlias.
  
  Pull in r183907 from llvm trunk:
  
X86: Make the cmov aliases work with intel syntax too.
  
  These commits make a number of Intel-style inline assembly mnemonics
  aliases (occurring in several ports) work properly, which could cause
  assertions otherwise.
  
  Reported by:  kwm, bapt

Modified:
  head/contrib/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
  head/contrib/llvm/lib/Target/X86/X86InstrInfo.td

Modified: head/contrib/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
==
--- head/contrib/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp Fri Jun 14 
20:44:23 2013(r251760)
+++ head/contrib/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp Fri Jun 14 
21:14:36 2013(r251761)
@@ -2306,25 +2306,25 @@ MatchAndEmitInstruction(SMLoc IDLoc, uns
   unsigned Match1, Match2, Match3, Match4;
 
   Match1 = MatchInstructionImpl(Operands, Inst, ErrorInfoIgnore,
-isParsingIntelSyntax());
+MatchingInlineAsm, isParsingIntelSyntax());
   // If this returned as a missing feature failure, remember that.
   if (Match1 == Match_MissingFeature)
 ErrorInfoMissingFeature = ErrorInfoIgnore;
   Tmp[Base.size()] = Suffixes[1];
   Match2 = MatchInstructionImpl(Operands, Inst, ErrorInfoIgnore,
-isParsingIntelSyntax());
+MatchingInlineAsm, isParsingIntelSyntax());
   // If this returned as a missing feature failure, remember that.
   if (Match2 == Match_MissingFeature)
 ErrorInfoMissingFeature = ErrorInfoIgnore;
   Tmp[Base.size()] = Suffixes[2];
   Match3 = MatchInstructionImpl(Operands, Inst, ErrorInfoIgnore,
-isParsingIntelSyntax());
+MatchingInlineAsm, isParsingIntelSyntax());
   // If this returned as a missing feature failure, remember that.
   if (Match3 == Match_MissingFeature)
 ErrorInfoMissingFeature = ErrorInfoIgnore;
   Tmp[Base.size()] = Suffixes[3];
   Match4 = MatchInstructionImpl(Operands, Inst, ErrorInfoIgnore,
-isParsingIntelSyntax());
+MatchingInlineAsm, isParsingIntelSyntax());
   // If this returned as a missing feature failure, remember that.
   if (Match4 == Match_MissingFeature)
 ErrorInfoMissingFeature = ErrorInfoIgnore;

Modified: head/contrib/llvm/lib/Target/X86/X86InstrInfo.td
==
--- head/contrib/llvm/lib/Target/X86/X86InstrInfo.tdFri Jun 14 20:44:23 
2013(r251760)
+++ head/contrib/llvm/lib/Target/X86/X86InstrInfo.tdFri Jun 14 21:14:36 
2013(r251761)
@@ -884,12 +884,12 @@ def PUSHF64: I0x9C, RawFrm, (outs),
 
 let Defs = [EDI, ESI, EBP, EBX, EDX, ECX, EAX, ESP], Uses = [ESP],
 mayLoad = 1, neverHasSideEffects = 1, SchedRW = [WriteLoad] in {
-def POPA32   : I0x61, RawFrm, (outs), (ins), popa{l|d}, [], IIC_POP_A,
+def POPA32   : I0x61, RawFrm, (outs), (ins), popa{l}, [], IIC_POP_A,
Requires[In32BitMode];
 }
 let Defs = [ESP], Uses = [EDI, ESI, EBP, EBX, EDX, ECX, EAX, ESP],
 mayStore = 1, neverHasSideEffects = 1, SchedRW = [WriteStore] in {
-def PUSHA32  : I0x60, RawFrm, (outs), (ins), pusha{l|d}, [], IIC_PUSH_A,
+def PUSHA32  : I0x60, RawFrm, (outs), (ins), pusha{l}, [], IIC_PUSH_A,
Requires[In32BitMode];
 }
 
@@ -1867,6 +1867,9 @@ def : MnemonicAliaspushf,  pushfl, 
 def : MnemonicAliaspushf,  pushfq, att, Requires[In64BitMode];
 def : MnemonicAliaspushfd, pushfl, att;
 
+def : MnemonicAliaspopad,   popa, intel, Requires[In32BitMode];
+def : MnemonicAliaspushad,  pusha, intel, Requires[In32BitMode];
+
 def : MnemonicAliasrepe,  rep,   att;
 def : MnemonicAliasrepz,  rep,   att;
 def : MnemonicAliasrepnz, repne, att;
@@ -1919,29 +1922,31 @@ def : MnemonicAliasfucomip,  fucompi
 def : MnemonicAliasfwait,wait, att;
 
 
-class 

svn commit: r251762 - stable/9/sys/kern

2013-06-14 Thread John Baldwin
Author: jhb
Date: Fri Jun 14 21:56:10 2013
New Revision: 251762
URL: http://svnweb.freebsd.org/changeset/base/251762

Log:
  MFC 250220:
  Fix FIONREAD on regular files.  The computed result was being ignored and
  it was being passed down to VOP_IOCTL() where it promptly resulted in
  ENOTTY due to a missing else for the past 8 years.  While here, use a
  shared vnode lock while fetching the current file's size.

Modified:
  stable/9/sys/kern/vfs_vnops.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/vfs_vnops.c
==
--- stable/9/sys/kern/vfs_vnops.c   Fri Jun 14 21:14:36 2013
(r251761)
+++ stable/9/sys/kern/vfs_vnops.c   Fri Jun 14 21:56:10 2013
(r251762)
@@ -1333,13 +1333,12 @@ vn_ioctl(fp, com, data, active_cred, td)
case VREG:
case VDIR:
if (com == FIONREAD) {
-   vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+   vn_lock(vp, LK_SHARED | LK_RETRY);
error = VOP_GETATTR(vp, vattr, active_cred);
VOP_UNLOCK(vp, 0);
if (!error)
*(int *)data = vattr.va_size - fp-f_offset;
-   }
-   if (com == FIONBIO || com == FIOASYNC)  /* XXX */
+   } else if (com == FIONBIO || com == FIOASYNC)   /* XXX */
error = 0;
else
error = VOP_IOCTL(vp, com, data, fp-f_flag,
___
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-unsubscr...@freebsd.org


svn commit: r251763 - head/bin/sh

2013-06-14 Thread Jilles Tjoelker
Author: jilles
Date: Fri Jun 14 22:06:18 2013
New Revision: 251763
URL: http://svnweb.freebsd.org/changeset/base/251763

Log:
  sh(1): A subshell environment has its own rlimits (ulimit).
  
  This has always been the case and is intended (just like cd).
  
  This matches Austin group issue #706.

Modified:
  head/bin/sh/sh.1

Modified: head/bin/sh/sh.1
==
--- head/bin/sh/sh.1Fri Jun 14 21:56:10 2013(r251762)
+++ head/bin/sh/sh.1Fri Jun 14 22:06:18 2013(r251763)
@@ -32,7 +32,7 @@
 .\from: @(#)sh.1  8.6 (Berkeley) 5/4/95
 .\ $FreeBSD$
 .\
-.Dd June 5, 2013
+.Dd June 14, 2013
 .Dt SH 1
 .Os
 .Sh NAME
@@ -1036,6 +1036,9 @@ The current working directory as set by
 The file creation mask as set by
 .Ic umask .
 .It
+Resource limits as set by
+.Ic ulimit .
+.It
 References to open files.
 .It
 Traps as set by
___
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-unsubscr...@freebsd.org


svn commit: r251764 - stable/8/sys/kern

2013-06-14 Thread John Baldwin
Author: jhb
Date: Fri Jun 14 22:06:45 2013
New Revision: 251764
URL: http://svnweb.freebsd.org/changeset/base/251764

Log:
  MFC 250220:
  Fix FIONREAD on regular files.  The computed result was being ignored and
  it was being passed down to VOP_IOCTL() where it promptly resulted in
  ENOTTY due to a missing else for the past 8 years.  While here, use a
  shared vnode lock while fetching the current file's size.

Modified:
  stable/8/sys/kern/vfs_vnops.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/kern/   (props changed)

Modified: stable/8/sys/kern/vfs_vnops.c
==
--- stable/8/sys/kern/vfs_vnops.c   Fri Jun 14 22:06:18 2013
(r251763)
+++ stable/8/sys/kern/vfs_vnops.c   Fri Jun 14 22:06:45 2013
(r251764)
@@ -952,13 +952,12 @@ vn_ioctl(fp, com, data, active_cred, td)
case VREG:
case VDIR:
if (com == FIONREAD) {
-   vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+   vn_lock(vp, LK_SHARED | LK_RETRY);
error = VOP_GETATTR(vp, vattr, active_cred);
VOP_UNLOCK(vp, 0);
if (!error)
*(int *)data = vattr.va_size - fp-f_offset;
-   }
-   if (com == FIONBIO || com == FIOASYNC)  /* XXX */
+   } else if (com == FIONBIO || com == FIOASYNC)   /* XXX */
error = 0;
else
error = VOP_IOCTL(vp, com, data, fp-f_flag,
___
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-unsubscr...@freebsd.org


svn commit: r251765 - head

2013-06-14 Thread Brooks Davis
Author: brooks
Date: Fri Jun 14 22:32:47 2013
New Revision: 251765
URL: http://svnweb.freebsd.org/changeset/base/251765

Log:
  Simplify the hierarchy target's logic. [0]
  
  Run hierarchy with WORLDTMP in the path so it works when it is invoked
  directly.  Such use is nearly alwasy wrong but appears to be common.[1]
  
  PR:   conf/178209 [0], conf/178547 [1]
  Submitted by: Garrett Cooper yaneurab...@gmail.com [0]
  MFC after:5 days

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Fri Jun 14 22:06:45 2013(r251764)
+++ head/Makefile.inc1  Fri Jun 14 22:32:47 2013(r251765)
@@ -263,6 +263,13 @@ WMAKEENV=  ${CROSSENV} \
VERSION=${VERSION} \
INSTALL=sh ${.CURDIR}/tools/install.sh \
PATH=${TMPPATH}
+
+# make hierarchy
+HMAKE= PATH=${TMPPATH} ${MAKE} LOCAL_MTREE=${LOCAL_MTREE}
+.if defined(NO_ROOT)
+HMAKE+=PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT
+.endif
+
 .if ${MK_CDDL} == no
 WMAKEENV+= NO_CTF=1
 .endif
@@ -1367,12 +1374,7 @@ cross-tools:
 # hierarchy - ensure that all the needed directories are present
 #
 hierarchy hier:
-.if defined(NO_ROOT)
-   cd ${.CURDIR}/etc; ${MAKE} LOCAL_MTREE=${LOCAL_MTREE} \
-   -DNO_ROOT METALOG=${METALOG} distrib-dirs
-.else
-   cd ${.CURDIR}/etc; ${MAKE} LOCAL_MTREE=${LOCAL_MTREE} distrib-dirs
-.endif
+   cd ${.CURDIR}/etc  ${HMAKE} distrib-dirs
 
 #
 # libraries - build all libraries, and install them under ${DESTDIR}.
___
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-unsubscr...@freebsd.org


svn commit: r251766 - head/sys/net80211

2013-06-14 Thread Eitan Adler
Author: eadler
Date: Fri Jun 14 23:04:31 2013
New Revision: 251766
URL: http://svnweb.freebsd.org/changeset/base/251766

Log:
  Fix typo (dbM - dBm)
  
  Submitted by: d...@vitsch.nl
  Reviewed by:  adrian

Modified:
  head/sys/net80211/ieee80211_var.h

Modified: head/sys/net80211/ieee80211_var.h
==
--- head/sys/net80211/ieee80211_var.h   Fri Jun 14 22:32:47 2013
(r251765)
+++ head/sys/net80211/ieee80211_var.h   Fri Jun 14 23:04:31 2013
(r251766)
@@ -55,7 +55,7 @@
 #include net80211/ieee80211_radiotap.h
 #include net80211/ieee80211_scan.h
 
-#defineIEEE80211_TXPOWER_MAX   100 /* .5 dbM (XXX units?) */
+#defineIEEE80211_TXPOWER_MAX   100 /* .5 dBm (XXX units?) */
 #defineIEEE80211_TXPOWER_MIN   0   /* kill radio */
 
 #defineIEEE80211_DTIM_DEFAULT  1   /* default DTIM period */
___
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-unsubscr...@freebsd.org


svn commit: r251767 - in head/sys: amd64/include/xen i386/include/xen xen xen/interface xen/interface/arch-arm/hvm xen/interface/arch-ia64 xen/interface/arch-ia64/hvm xen/interface/arch-x86 xen/int...

2013-06-14 Thread Justin T. Gibbs
Author: gibbs
Date: Fri Jun 14 23:43:44 2013
New Revision: 251767
URL: http://svnweb.freebsd.org/changeset/base/251767

Log:
  Upgrade Xen interface headers to Xen 4.2.1.
  
  Move FreeBSD from interface version 0x00030204 to 0x00030208.
  Updates are required to our grant table implementation before we
  can bump this further.
  
  sys/xen/hvm.h:
Replace the implementation of hvm_get_parameter(), formerly located
in sys/xen/interface/hvm/params.h.  Linux has a similar file which
primarily stores this function.
  
  sys/xen/xenstore/xenstore.c:
Include new xen/hvm.h header file to get hvm_get_parameter().
  
  sys/amd64/include/xen/xen-os.h:
  sys/i386/include/xen/xen-os.h:
Correctly protect function definition and variables from being
included into assembly files in xen-os.h
  
Xen memory barriers are now prefixed with xen_ to avoid conflicts
with OS native primatives.  Define Xen memory barriers in terms of
the native FreeBSD primatives.
  
  Sponsored by: Spectra Logic Corporation
  Reviewed by:  Roger Pau Monné
  Tested by:Roger Pau Monné
  Obtained from:Roger Pau Monné (bug fixes)

Added:
  head/sys/xen/hvm.h   (contents, props changed)
  head/sys/xen/interface/arch-arm.h   (contents, props changed)
  head/sys/xen/interface/arch-arm/hvm/save.h   (contents, props changed)
  head/sys/xen/interface/arch-ia64/debug_op.h   (contents, props changed)
  head/sys/xen/interface/arch-ia64/hvm/memmap.h   (contents, props changed)
  head/sys/xen/interface/arch-ia64/hvm/save.h   (contents, props changed)
  head/sys/xen/interface/arch-ia64/sioemu.h   (contents, props changed)
  head/sys/xen/interface/io/fsif.h   (contents, props changed)
  head/sys/xen/interface/io/libxenvchan.h   (contents, props changed)
  head/sys/xen/interface/io/usbif.h   (contents, props changed)
  head/sys/xen/interface/io/vscsiif.h   (contents, props changed)
  head/sys/xen/interface/mem_event.h   (contents, props changed)
  head/sys/xen/interface/tmem.h   (contents, props changed)
  head/sys/xen/interface/xsm/flask_op.h   (contents, props changed)
Directory Properties:
  head/sys/xen/interface/arch-arm/   (props changed)
  head/sys/xen/interface/arch-arm/hvm/   (props changed)
  head/sys/xen/interface/arch-ia64/   (props changed)
  head/sys/xen/interface/arch-ia64/hvm/   (props changed)
  head/sys/xen/interface/xsm/   (props changed)
Deleted:
  head/sys/xen/interface/hvm/vmx_assist.h
Modified:
  head/sys/amd64/include/xen/xen-os.h
  head/sys/i386/include/xen/xen-os.h
  head/sys/xen/interface/arch-ia64.h   (contents, props changed)
  head/sys/xen/interface/arch-x86/cpuid.h   (contents, props changed)
  head/sys/xen/interface/arch-x86/hvm/save.h   (contents, props changed)
  head/sys/xen/interface/arch-x86/xen-mca.h   (contents, props changed)
  head/sys/xen/interface/arch-x86/xen-x86_32.h   (contents, props changed)
  head/sys/xen/interface/arch-x86/xen-x86_64.h   (contents, props changed)
  head/sys/xen/interface/arch-x86/xen.h   (contents, props changed)
  head/sys/xen/interface/arch-x86_32.h   (contents, props changed)
  head/sys/xen/interface/arch-x86_64.h   (contents, props changed)
  head/sys/xen/interface/domctl.h   (contents, props changed)
  head/sys/xen/interface/elfnote.h   (contents, props changed)
  head/sys/xen/interface/event_channel.h   (contents, props changed)
  head/sys/xen/interface/features.h   (contents, props changed)
  head/sys/xen/interface/grant_table.h   (contents, props changed)
  head/sys/xen/interface/hvm/hvm_info_table.h   (contents, props changed)
  head/sys/xen/interface/hvm/hvm_op.h   (contents, props changed)
  head/sys/xen/interface/hvm/ioreq.h   (contents, props changed)
  head/sys/xen/interface/hvm/params.h   (contents, props changed)
  head/sys/xen/interface/hvm/save.h   (contents, props changed)
  head/sys/xen/interface/io/blkif.h   (contents, props changed)
  head/sys/xen/interface/io/netif.h   (contents, props changed)
  head/sys/xen/interface/io/pciif.h   (contents, props changed)
  head/sys/xen/interface/io/protocols.h   (contents, props changed)
  head/sys/xen/interface/io/ring.h   (contents, props changed)
  head/sys/xen/interface/io/xs_wire.h   (contents, props changed)
  head/sys/xen/interface/kexec.h   (contents, props changed)
  head/sys/xen/interface/memory.h   (contents, props changed)
  head/sys/xen/interface/nmi.h   (contents, props changed)
  head/sys/xen/interface/physdev.h   (contents, props changed)
  head/sys/xen/interface/platform.h   (contents, props changed)
  head/sys/xen/interface/sched.h   (contents, props changed)
  head/sys/xen/interface/sysctl.h   (contents, props changed)
  head/sys/xen/interface/trace.h   (contents, props changed)
  head/sys/xen/interface/vcpu.h   (contents, props changed)
  head/sys/xen/interface/version.h   (contents, props changed)
  head/sys/xen/interface/xen-compat.h   (contents, props changed)
  head/sys/xen/interface/xen.h   (contents, props changed)
  

svn commit: r251768 - in stable/8/sys: fs/nfsclient nfsclient

2013-06-14 Thread Rick Macklem
Author: rmacklem
Date: Sat Jun 15 01:35:52 2013
New Revision: 251768
URL: http://svnweb.freebsd.org/changeset/base/251768

Log:
  MFC: r249623
  Both NFS clients can deadlock when using the rdirplus mount
  option. This can occur when an nfsiod thread that already holds
  a buffer lock attempts to acquire a vnode lock on an entry in
  the directory (a LOR) when another thread holding the vnode lock
  is waiting on an nfsiod thread. This patch avoids the deadlock by disabling
  readahead for this case, so the nfsiod threads never do readdirplus.
  Since readaheads for directories need the directory offset cookie
  from the previous read, they cannot normally happen in parallel.
  As such, testing by jhb@ and myself didn't find any performance
  degredation when this patch is applied. If there is a case where
  this results in a significant performance degradation, mounting
  without the rdirplus option can be done to re-enable readahead
  for directories.

Modified:
  stable/8/sys/fs/nfsclient/nfs_clbio.c
  stable/8/sys/nfsclient/nfs_bio.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/fs/   (props changed)
  stable/8/sys/nfsclient/   (props changed)

Modified: stable/8/sys/fs/nfsclient/nfs_clbio.c
==
--- stable/8/sys/fs/nfsclient/nfs_clbio.c   Fri Jun 14 23:43:44 2013
(r251767)
+++ stable/8/sys/fs/nfsclient/nfs_clbio.c   Sat Jun 15 01:35:52 2013
(r251768)
@@ -1368,10 +1368,18 @@ ncl_asyncio(struct nfsmount *nmp, struct
 * Commits are usually short and sweet so lets save some cpu and
 * leave the async daemons for more important rpc's (such as reads
 * and writes).
+*
+* Readdirplus RPCs do vget()s to acquire the vnodes for entries
+* in the directory in order to update attributes. This can deadlock
+* with another thread that is waiting for async I/O to be done by
+* an nfsiod thread while holding a lock on one of these vnodes.
+* To avoid this deadlock, don't allow the async nfsiod threads to
+* perform Readdirplus RPCs.
 */
mtx_lock(ncl_iod_mutex);
-   if (bp-b_iocmd == BIO_WRITE  (bp-b_flags  B_NEEDCOMMIT) 
-   (nmp-nm_bufqiods  ncl_numasync / 2)) {
+   if ((bp-b_iocmd == BIO_WRITE  (bp-b_flags  B_NEEDCOMMIT) 
+(nmp-nm_bufqiods  ncl_numasync / 2)) ||
+   (bp-b_vp-v_type == VDIR  (nmp-nm_flag  NFSMNT_RDIRPLUS))) {
mtx_unlock(ncl_iod_mutex);
return(EIO);
}

Modified: stable/8/sys/nfsclient/nfs_bio.c
==
--- stable/8/sys/nfsclient/nfs_bio.cFri Jun 14 23:43:44 2013
(r251767)
+++ stable/8/sys/nfsclient/nfs_bio.cSat Jun 15 01:35:52 2013
(r251768)
@@ -1360,10 +1360,18 @@ nfs_asyncio(struct nfsmount *nmp, struct
 * Commits are usually short and sweet so lets save some cpu and
 * leave the async daemons for more important rpc's (such as reads
 * and writes).
+*
+* Readdirplus RPCs do vget()s to acquire the vnodes for entries
+* in the directory in order to update attributes. This can deadlock
+* with another thread that is waiting for async I/O to be done by
+* an nfsiod thread while holding a lock on one of these vnodes.
+* To avoid this deadlock, don't allow the async nfsiod threads to
+* perform Readdirplus RPCs.
 */
mtx_lock(nfs_iod_mtx);
-   if (bp-b_iocmd == BIO_WRITE  (bp-b_flags  B_NEEDCOMMIT) 
-   (nmp-nm_bufqiods  nfs_numasync / 2)) {
+   if ((bp-b_iocmd == BIO_WRITE  (bp-b_flags  B_NEEDCOMMIT) 
+(nmp-nm_bufqiods  nfs_numasync / 2)) ||
+   (bp-b_vp-v_type == VDIR  (nmp-nm_flag  NFSMNT_RDIRPLUS))) {
mtx_unlock(nfs_iod_mtx);
return(EIO);
}
___
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-unsubscr...@freebsd.org


svn commit: r251769 - head/sys/dev/virtio/network

2013-06-14 Thread Bryan Venteicher
Author: bryanv
Date: Sat Jun 15 03:55:04 2013
New Revision: 251769
URL: http://svnweb.freebsd.org/changeset/base/251769

Log:
  Merge r250802 from bryanv/vtnetmq - Fix setting of the Rx filters
  
  QEMU 1.4 made the descriptor requirement stricter - the size of buffer
  descriptor must exactly match the number of MAC addresses provided.
  
  PR:   kern/178955
  MFC after:5 days

Modified:
  head/sys/dev/virtio/network/if_vtnet.c

Modified: head/sys/dev/virtio/network/if_vtnet.c
==
--- head/sys/dev/virtio/network/if_vtnet.c  Sat Jun 15 01:35:52 2013
(r251768)
+++ head/sys/dev/virtio/network/if_vtnet.c  Sat Jun 15 03:55:04 2013
(r251769)
@@ -2470,9 +2470,9 @@ vtnet_rx_filter_mac(struct vtnet_softc *
sglist_init(sg, 4, segs);
error |= sglist_append(sg, hdr, sizeof(struct virtio_net_ctrl_hdr));
error |= sglist_append(sg, filter-vmf_unicast,
-   sizeof(struct vtnet_mac_table));
+   sizeof(uint32_t) + filter-vmf_unicast.nentries * ETHER_ADDR_LEN);
error |= sglist_append(sg, filter-vmf_multicast,
-   sizeof(struct vtnet_mac_table));
+   sizeof(uint32_t) + filter-vmf_multicast.nentries * ETHER_ADDR_LEN);
error |= sglist_append(sg, ack, sizeof(uint8_t));
KASSERT(error == 0  sg.sg_nseg == 4,
(error adding MAC filtering message to sglist));
___
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-unsubscr...@freebsd.org


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

2013-06-14 Thread Lawrence Stewart
Author: lstewart
Date: Sat Jun 15 04:03:40 2013
New Revision: 251770
URL: http://svnweb.freebsd.org/changeset/base/251770

Log:
  Internalise handling of virtualised hook points inside
  hhook_{add|remove}_hook_lookup() so that khelp (and other potential API
  consumers) do not have to care when they attempt to (un)hook a particular hook
  point identified by id and type.
  
  Reviewed by:  scottl
  MFC after:1 week

Modified:
  head/sys/kern/kern_hhook.c
  head/sys/kern/kern_khelp.c
  head/sys/sys/hhook.h

Modified: head/sys/kern/kern_hhook.c
==
--- head/sys/kern/kern_hhook.c  Sat Jun 15 03:55:04 2013(r251769)
+++ head/sys/kern/kern_hhook.c  Sat Jun 15 04:03:40 2013(r251770)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2010 Lawrence Stewart lstew...@freebsd.org
+ * Copyright (c) 2010,2013 Lawrence Stewart lstew...@freebsd.org
  * Copyright (c) 2010 The FreeBSD Foundation
  * All rights reserved.
  *
@@ -69,6 +69,9 @@ static struct mtx hhook_head_list_lock;
 MTX_SYSINIT(hhookheadlistlock, hhook_head_list_lock, hhook_head list lock,
 MTX_DEF);
 
+/* Protected by hhook_head_list_lock. */
+static uint32_t n_hhookheads;
+
 /* Private function prototypes. */
 static void hhook_head_destroy(struct hhook_head *hhh);
 
@@ -165,21 +168,71 @@ hhook_add_hook(struct hhook_head *hhh, s
 }
 
 /*
- * Lookup a helper hook point and register a new helper hook function with it.
+ * Register a helper hook function with a helper hook point (including all
+ * virtual instances of the hook point if it is virtualised).
+ *
+ * The logic is unfortunately far more complex than for
+ * hhook_remove_hook_lookup() because hhook_add_hook() can call malloc() with
+ * M_WAITOK and thus we cannot call hhook_add_hook() with the
+ * hhook_head_list_lock held.
+ *
+ * The logic assembles an array of hhook_head structs that correspond to the
+ * helper hook point being hooked and bumps the refcount on each (all done with
+ * the hhook_head_list_lock held). The hhook_head_list_lock is then dropped, 
and
+ * hhook_add_hook() is called and the refcount dropped for each hhook_head
+ * struct in the array.
  */
 int
 hhook_add_hook_lookup(struct hookinfo *hki, uint32_t flags)
 {
-   struct hhook_head *hhh;
-   int error;
+   struct hhook_head **heads_to_hook, *hhh;
+   int error, i, n_heads_to_hook;
 
-   hhh = hhook_head_get(hki-hook_type, hki-hook_id);
+tryagain:
+   error = i = 0;
+   /*
+* Accessing n_hhookheads without hhook_head_list_lock held opens up a
+* race with hhook_head_register() which we are unlikely to lose, but
+* nonetheless have to cope with - hence the complex goto logic.
+*/
+   n_heads_to_hook = n_hhookheads;
+   heads_to_hook = malloc(n_heads_to_hook * sizeof(struct hhook_head *),
+   M_HHOOK, flags  HHOOK_WAITOK ? M_WAITOK : M_NOWAIT);
+   if (heads_to_hook == NULL)
+   return (ENOMEM);
 
-   if (hhh == NULL)
-   return (ENOENT);
+   HHHLIST_LOCK();
+   LIST_FOREACH(hhh, hhook_head_list, hhh_next) {
+   if (hhh-hhh_type == hki-hook_type 
+   hhh-hhh_id == hki-hook_id) {
+   if (i  n_heads_to_hook) {
+   heads_to_hook[i] = hhh;
+   
refcount_acquire(heads_to_hook[i]-hhh_refcount);
+   i++;
+   } else {
+   /*
+* We raced with hhook_head_register() which
+* inserted a hhook_head that we need to hook
+* but did not malloc space for. Abort this run
+* and try again.
+*/
+   for (i--; i = 0; i--)
+   
refcount_release(heads_to_hook[i]-hhh_refcount);
+   free(heads_to_hook, M_HHOOK);
+   HHHLIST_UNLOCK();
+   goto tryagain;
+   }
+   }
+   }
+   HHHLIST_UNLOCK();
 
-   error = hhook_add_hook(hhh, hki, flags);
-   hhook_head_release(hhh);
+   for (i--; i = 0; i--) {
+   if (!error)
+   error = hhook_add_hook(heads_to_hook[i], hki, flags);
+   refcount_release(heads_to_hook[i]-hhh_refcount);
+   }
+
+   free(heads_to_hook, M_HHOOK);
 
return (error);
 }
@@ -211,20 +264,21 @@ hhook_remove_hook(struct hhook_head *hhh
 }
 
 /*
- * Lookup a helper hook point and remove a helper hook function from it.
+ * Remove a helper hook function from a helper hook point (including all
+ * virtual instances of the hook point if it is virtualised).
  */
 int
 hhook_remove_hook_lookup(struct hookinfo *hki)
 {
struct hhook_head *hhh;
 
-   

svn commit: r251772 - head/sys/dev/xen/blkfront

2013-06-14 Thread Justin T. Gibbs
Author: gibbs
Date: Sat Jun 15 04:51:31 2013
New Revision: 251772
URL: http://svnweb.freebsd.org/changeset/base/251772

Log:
  Properly track the different reasons new I/O is temporarily disabled, and
  only re-enable I/O when all reasons have cleared.
  
  sys/dev/xen/blkfront/block.h:
In the block front driver softc, replace the boolean
XBDF_FROZEN flag with a count of commands and driver global
issues that freeze the I/O queue.  So long xbd_qfrozen_cnt
is non-zero, I/O is halted.
  
Add flags to xbd_flags for tracking grant table entry and
free command resource shortages.  Each of these classes can
increment xbd_qfrozen_cnt at most once.
  
Add a command flag (XBDCF_ASYNC_MAPPING) that is set whenever
the initial mapping attempt of a command fails with EINPROGRESS.
  
  sys/dev/xen/blkfront/blkfront.c:
In xbd_queue_cb(), use new XBDCF_ASYNC_MAPPING flag to definitively
know if an async bus dmamap load has occurred.
  
Add xbd_freeze() and xbd_thaw() helper methods for managing
xbd_qfrozen_cnt and use them to implement all queue freezing logic.
  
Add missing thaw to restart I/O processing once grant references
become available.
  
  Sponsored by: Spectra Logic Corporation

Modified:
  head/sys/dev/xen/blkfront/blkfront.c
  head/sys/dev/xen/blkfront/block.h

Modified: head/sys/dev/xen/blkfront/blkfront.c
==
--- head/sys/dev/xen/blkfront/blkfront.cSat Jun 15 04:45:33 2013
(r251771)
+++ head/sys/dev/xen/blkfront/blkfront.cSat Jun 15 04:51:31 2013
(r251772)
@@ -87,6 +87,30 @@ static void xbd_startio(struct xbd_softc
 static MALLOC_DEFINE(M_XENBLOCKFRONT, xbd, Xen Block Front driver data);
 
 /* Command Processing 
*/
+static void
+xbd_freeze(struct xbd_softc *sc, xbd_flag_t xbd_flag)
+{
+   if (xbd_flag != XBDF_NONE  (sc-xbd_flags  xbd_flag) != 0)
+   return;
+
+   sc-xbd_flags |= xbd_flag;
+   sc-xbd_qfrozen_cnt++;
+}
+
+static void
+xbd_thaw(struct xbd_softc *sc, xbd_flag_t xbd_flag)
+{
+   if (xbd_flag != XBDF_NONE  (sc-xbd_flags  xbd_flag) == 0)
+   return;
+
+   if (sc-xbd_qfrozen_cnt != 0)
+   panic(%s: Thaw with flag 0x%x while not frozen.,
+   __func__, xbd_flag);
+
+   sc-xbd_flags = ~xbd_flag;
+   sc-xbd_qfrozen_cnt--;
+}
+
 static inline void 
 xbd_flush_requests(struct xbd_softc *sc)
 {
@@ -110,6 +134,7 @@ xbd_free_command(struct xbd_command *cm)
cm-cm_bp = NULL;
cm-cm_complete = NULL;
xbd_enqueue_cm(cm, XBD_Q_FREE);
+   xbd_thaw(cm-cm_sc, XBDF_CM_SHORTAGE);
 }
 
 static void
@@ -212,10 +237,13 @@ xbd_queue_cb(void *arg, bus_dma_segment_
xbd_enqueue_cm(cm, XBD_Q_BUSY);
 
/*
-* This flag means that we're probably executing in the busdma swi
-* instead of in the startio context, so an explicit flush is needed.
+* If bus dma had to asynchronously call us back to dispatch
+* this command, we are no longer executing in the context of 
+* xbd_startio().  Thus we cannot rely on xbd_startio()'s call to
+* xbd_flush_requests() to publish this command to the backend
+* along with any other commands that it could batch.
 */
-   if (cm-cm_flags  XBDCF_FROZEN)
+   if ((cm-cm_flags  XBDCF_ASYNC_MAPPING) != 0)
xbd_flush_requests(sc);
 
return;
@@ -229,9 +257,14 @@ xbd_queue_request(struct xbd_softc *sc, 
error = bus_dmamap_load(sc-xbd_io_dmat, cm-cm_map, cm-cm_data,
cm-cm_datalen, xbd_queue_cb, cm, 0);
if (error == EINPROGRESS) {
-   printf(EINPROGRESS\n);
-   sc-xbd_flags |= XBDF_FROZEN;
-   cm-cm_flags |= XBDCF_FROZEN;
+   /*
+* Maintain queuing order by freezing the queue.  The next
+* command may not require as many resources as the command
+* we just attempted to map, so we can't rely on bus dma
+* blocking for it too.
+*/
+   xbd_freeze(sc, XBDF_NONE);
+   cm-cm_flags |= XBDCF_FROZEN|XBDCF_ASYNC_MAPPING;
return (0);
}
 
@@ -245,6 +278,8 @@ xbd_restart_queue_callback(void *arg)
 
mtx_lock(sc-xbd_io_lock);
 
+   xbd_thaw(sc, XBDF_GNT_SHORTAGE);
+
xbd_startio(sc);
 
mtx_unlock(sc-xbd_io_lock);
@@ -264,6 +299,7 @@ xbd_bio_command(struct xbd_softc *sc)
return (NULL);
 
if ((cm = xbd_dequeue_cm(sc, XBD_Q_FREE)) == NULL) {
+   xbd_freeze(sc, XBDF_CM_SHORTAGE);
xbd_requeue_bio(sc, bp);
return (NULL);
}
@@ -273,9 +309,9 @@ xbd_bio_command(struct xbd_softc *sc)

svn commit: r251774 - head/sys/kern

2013-06-14 Thread Lawrence Stewart
Author: lstewart
Date: Sat Jun 15 05:57:29 2013
New Revision: 251774
URL: http://svnweb.freebsd.org/changeset/base/251774

Log:
  Add a private KPI between hhook and khelp that allows khelp modules to insert
  hook functions into hhook points which register after the modules were loaded 
-
  potentially useful during boot or if hhook points are dynamically registered.
  
  MFC after:1 week

Modified:
  head/sys/kern/kern_hhook.c
  head/sys/kern/kern_khelp.c

Modified: head/sys/kern/kern_hhook.c
==
--- head/sys/kern/kern_hhook.c  Sat Jun 15 05:04:14 2013(r251773)
+++ head/sys/kern/kern_hhook.c  Sat Jun 15 05:57:29 2013(r251774)
@@ -74,6 +74,7 @@ static uint32_t n_hhookheads;
 
 /* Private function prototypes. */
 static void hhook_head_destroy(struct hhook_head *hhh);
+void khelp_new_hhook_registered(struct hhook_head *hhh, uint32_t flags);
 
 #defineHHHLIST_LOCK() mtx_lock(hhook_head_list_lock)
 #defineHHHLIST_UNLOCK() mtx_unlock(hhook_head_list_lock)
@@ -311,12 +312,7 @@ hhook_head_register(int32_t hhook_type, 
tmphhh-hhh_nhooks = 0;
STAILQ_INIT(tmphhh-hhh_hooks);
HHH_LOCK_INIT(tmphhh);
-
-   if (hhh != NULL) {
-   refcount_init(tmphhh-hhh_refcount, 1);
-   *hhh = tmphhh;
-   } else
-   refcount_init(tmphhh-hhh_refcount, 0);
+   refcount_init(tmphhh-hhh_refcount, 1);
 
HHHLIST_LOCK();
if (flags  HHOOK_HEADISINVNET) {
@@ -331,6 +327,13 @@ hhook_head_register(int32_t hhook_type, 
n_hhookheads++;
HHHLIST_UNLOCK();
 
+   khelp_new_hhook_registered(tmphhh, flags);
+
+   if (hhh != NULL)
+   *hhh = tmphhh;
+   else
+   refcount_release(tmphhh-hhh_refcount);
+
return (0);
 }
 

Modified: head/sys/kern/kern_khelp.c
==
--- head/sys/kern/kern_khelp.c  Sat Jun 15 05:04:14 2013(r251773)
+++ head/sys/kern/kern_khelp.c  Sat Jun 15 05:57:29 2013(r251774)
@@ -40,7 +40,6 @@ __FBSDID($FreeBSD$);
 #include sys/param.h
 #include sys/kernel.h
 #include sys/hhook.h
-#include sys/jail.h
 #include sys/khelp.h
 #include sys/lock.h
 #include sys/malloc.h
@@ -52,8 +51,6 @@ __FBSDID($FreeBSD$);
 #include sys/rwlock.h
 #include sys/systm.h
 
-#include net/vnet.h
-
 static struct rwlock khelp_list_lock;
 RW_SYSINIT(khelplistlock, khelp_list_lock, helper list lock);
 
@@ -61,6 +58,7 @@ static TAILQ_HEAD(helper_head, helper) h
 
 /* Private function prototypes. */
 static inline void khelp_remove_osd(struct helper *h, struct osd *hosd);
+void khelp_new_hhook_registered(struct hhook_head *hhh, uint32_t flags);
 
 #defineKHELP_LIST_WLOCK() rw_wlock(khelp_list_lock)
 #defineKHELP_LIST_WUNLOCK() rw_wunlock(khelp_list_lock)
@@ -289,6 +287,36 @@ khelp_remove_hhook(struct hookinfo *hki)
return (error);
 }
 
+/*
+ * Private KPI between hhook and khelp that allows khelp modules to insert hook
+ * functions into hhook points which register after the modules were loaded.
+ */
+void
+khelp_new_hhook_registered(struct hhook_head *hhh, uint32_t flags)
+{
+   struct helper *h;
+   int error, i;
+
+   KHELP_LIST_RLOCK();
+   TAILQ_FOREACH(h, helpers, h_next) {
+   for (i = 0; i  h-h_nhooks; i++) {
+   if (hhh-hhh_type != h-h_hooks[i].hook_type ||
+   hhh-hhh_id != h-h_hooks[i].hook_id)
+   continue;
+   error = hhook_add_hook(hhh, h-h_hooks[i], flags);
+   if (error) {
+   printf(%s: \%s\ khelp module unable to 
+   hook type %d id %d due to error %d\n,
+   __func__, h-h_name,
+   h-h_hooks[i].hook_type,
+   h-h_hooks[i].hook_id, error);
+   error = 0;
+   }
+   }
+   }
+   KHELP_LIST_RUNLOCK();
+}
+
 int
 khelp_modevent(module_t mod, int event_type, void *data)
 {
@@ -348,95 +376,3 @@ khelp_modevent(module_t mod, int event_t
 
return (error);
 }
-
-/*
- * This function is called in two separate situations:
- *
- * - When the kernel is booting, it is called directly by the SYSINIT framework
- * to allow Khelp modules which were compiled into the kernel or loaded by the
- * boot loader to insert their non-virtualised hook functions into the kernel.
- *
- * - When the kernel is booting or a vnet is created, this function is also
- * called indirectly through khelp_vnet_init() by the vnet initialisation code.
- * In this situation, Khelp modules are able to insert their virtualised hook
- * functions into the virtualised hook points in the vnet which is being
- * initialised. In the case where the kernel is not compiled