svn commit: r315930 - stable/11/sys/dev/usb/input

2017-03-24 Thread Peter Grehan
Author: grehan
Date: Sat Mar 25 05:41:34 2017
New Revision: 315930
URL: https://svnweb.freebsd.org/changeset/base/315930

Log:
  MFC r315716
Bring the handling of the y axis in the ums driver in-line with the other
axes.
  
No functional change.

Modified:
  stable/11/sys/dev/usb/input/ums.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/usb/input/ums.c
==
--- stable/11/sys/dev/usb/input/ums.c   Sat Mar 25 05:21:49 2017
(r315929)
+++ stable/11/sys/dev/usb/input/ums.c   Sat Mar 25 05:41:34 2017
(r315930)
@@ -283,7 +283,7 @@ ums_intr_callback(struct usb_xfer *xfer,
 
if ((info->sc_flags & UMS_FLAG_Y_AXIS) &&
(id == info->sc_iid_y))
-   dy = -hid_get_data(buf, len, >sc_loc_y);
+   dy -= hid_get_data(buf, len, >sc_loc_y);
 
if ((info->sc_flags & UMS_FLAG_Z_AXIS) &&
(id == info->sc_iid_z)) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315929 - stable/11/usr.sbin/bhyve

2017-03-24 Thread Peter Grehan
Author: grehan
Date: Sat Mar 25 05:21:49 2017
New Revision: 315929
URL: https://svnweb.freebsd.org/changeset/base/315929

Log:
  MFC r315715  Fix a type in bhyve's USB mouse emulation.

Modified:
  stable/11/usr.sbin/bhyve/usb_mouse.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/bhyve/usb_mouse.c
==
--- stable/11/usr.sbin/bhyve/usb_mouse.cSat Mar 25 05:09:03 2017
(r315928)
+++ stable/11/usr.sbin/bhyve/usb_mouse.cSat Mar 25 05:21:49 2017
(r315929)
@@ -284,7 +284,7 @@ umouse_event(uint8_t button, int x, int 
 
/* scale coords to mouse resolution */
sc->um_report.x = MOUSE_MAX_X * x / gc->width;
-   sc->um_report.y = MOUSE_MAX_X * y / gc->height;
+   sc->um_report.y = MOUSE_MAX_Y * y / gc->height;
sc->newdata = 1;
pthread_mutex_unlock(>mtx);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315928 - in stable/10/sys: amd64/vmm x86/include x86/x86

2017-03-24 Thread Peter Grehan
Author: grehan
Date: Sat Mar 25 05:09:03 2017
New Revision: 315928
URL: https://svnweb.freebsd.org/changeset/base/315928

Log:
  MFC  r315361 and  r315364: Hide MONITORX/MWAITX from guests.
  
  r315361
Add the AMD MONITORX/MWAITX feature definition introduced in
Bulldozer/Ryzen CPUs.
  
  r315364
Hide the AMD MONITORX/MWAITX capability.
Otherwise, recent Linux guests will use these instructions, resulting
in #UD exceptions since bhyve doesn't implement MONITOR/MWAIT exits.
  
This fixes boot-time hangs in recent Linux guests on Ryzen CPUs
(and probably Bulldozer aka AMD FX as well).

Modified:
  stable/10/sys/amd64/vmm/x86.c
  stable/10/sys/x86/include/specialreg.h
  stable/10/sys/x86/x86/identcpu.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/vmm/x86.c
==
--- stable/10/sys/amd64/vmm/x86.c   Sat Mar 25 05:05:12 2017
(r315927)
+++ stable/10/sys/amd64/vmm/x86.c   Sat Mar 25 05:09:03 2017
(r315928)
@@ -176,6 +176,9 @@ x86_emulate_cpuid(struct vm *vm, int vcp
/* Don't advertise the OS visible workaround feature */
regs[2] &= ~AMDID2_OSVW;
 
+   /* Hide mwaitx/monitorx capability from the guest */
+   regs[2] &= ~AMDID2_MWAITX;
+
/*
 * Hide rdtscp/ia32_tsc_aux until we know how
 * to deal with them.

Modified: stable/10/sys/x86/include/specialreg.h
==
--- stable/10/sys/x86/include/specialreg.h  Sat Mar 25 05:05:12 2017
(r315927)
+++ stable/10/sys/x86/include/specialreg.h  Sat Mar 25 05:09:03 2017
(r315928)
@@ -226,6 +226,7 @@
 #defineAMDID2_DBE  0x0400
 #defineAMDID2_PTSC 0x0800
 #defineAMDID2_PTSCEL2I 0x1000
+#defineAMDID2_MWAITX   0x2000
 
 /*
  * CPUID instruction 1 eax info

Modified: stable/10/sys/x86/x86/identcpu.c
==
--- stable/10/sys/x86/x86/identcpu.cSat Mar 25 05:05:12 2017
(r315927)
+++ stable/10/sys/x86/x86/identcpu.cSat Mar 25 05:09:03 2017
(r315928)
@@ -875,7 +875,7 @@ printcpuinfo(void)
"\033DBE"   /* Data Breakpoint extension */
"\034PTSC"  /* Performance TSC */
"\035PL2I"  /* L2I perf count */
-   "\036"
+   "\036MWAITX"/* MONITORX/MWAITX instructions 
*/
"\037"
"\040"
);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315927 - in stable/11/sys: amd64/vmm x86/include x86/x86

2017-03-24 Thread Peter Grehan
Author: grehan
Date: Sat Mar 25 05:05:12 2017
New Revision: 315927
URL: https://svnweb.freebsd.org/changeset/base/315927

Log:
  MFC  r315361 and  r315364: Hide MONITORX/MWAITX from guests.
  
  r315361
Add the AMD MONITORX/MWAITX feature definition introduced in
Bulldozer/Ryzen CPUs.
  
  r315364
Hide the AMD MONITORX/MWAITX capability.
Otherwise, recent Linux guests will use these instructions, resulting
in #UD exceptions since bhyve doesn't implement MONITOR/MWAIT exits.
  
This fixes boot-time hangs in recent Linux guests on Ryzen CPUs
(and probably Bulldozer aka AMD FX as well).

Modified:
  stable/11/sys/amd64/vmm/x86.c
  stable/11/sys/x86/include/specialreg.h
  stable/11/sys/x86/x86/identcpu.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/vmm/x86.c
==
--- stable/11/sys/amd64/vmm/x86.c   Sat Mar 25 02:55:13 2017
(r315926)
+++ stable/11/sys/amd64/vmm/x86.c   Sat Mar 25 05:05:12 2017
(r315927)
@@ -176,6 +176,9 @@ x86_emulate_cpuid(struct vm *vm, int vcp
/* Don't advertise the OS visible workaround feature */
regs[2] &= ~AMDID2_OSVW;
 
+   /* Hide mwaitx/monitorx capability from the guest */
+   regs[2] &= ~AMDID2_MWAITX;
+
/*
 * Hide rdtscp/ia32_tsc_aux until we know how
 * to deal with them.

Modified: stable/11/sys/x86/include/specialreg.h
==
--- stable/11/sys/x86/include/specialreg.h  Sat Mar 25 02:55:13 2017
(r315926)
+++ stable/11/sys/x86/include/specialreg.h  Sat Mar 25 05:05:12 2017
(r315927)
@@ -227,6 +227,7 @@
 #defineAMDID2_DBE  0x0400
 #defineAMDID2_PTSC 0x0800
 #defineAMDID2_PTSCEL2I 0x1000
+#defineAMDID2_MWAITX   0x2000
 
 /*
  * CPUID instruction 1 eax info

Modified: stable/11/sys/x86/x86/identcpu.c
==
--- stable/11/sys/x86/x86/identcpu.cSat Mar 25 02:55:13 2017
(r315926)
+++ stable/11/sys/x86/x86/identcpu.cSat Mar 25 05:05:12 2017
(r315927)
@@ -906,7 +906,7 @@ printcpuinfo(void)
"\033DBE"   /* Data Breakpoint extension */
"\034PTSC"  /* Performance TSC */
"\035PL2I"  /* L2I perf count */
-   "\036"
+   "\036MWAITX"/* MONITORX/MWAITX instructions 
*/
"\037"
"\040"
);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315926 - head/sys/dev/iwm

2017-03-24 Thread Adrian Chadd
Author: adrian
Date: Sat Mar 25 02:55:13 2017
New Revision: 315926
URL: https://svnweb.freebsd.org/changeset/base/315926

Log:
  [iwm] Add the BSS's basic rates to iwm's LQ command, not all the rates.
  
  Makes the firmware use appropriate Tx rates for ACKs.
  
  Obtained from: dragonflybsd.git ab1d3efc208e797c1e09759cd506c95c0aeaa06e

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwm_mac_ctxt.c
  head/sys/dev/iwm/if_iwm_util.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Sat Mar 25 02:49:20 2017(r315925)
+++ head/sys/dev/iwm/if_iwm.c   Sat Mar 25 02:55:13 2017(r315926)
@@ -4291,6 +4291,21 @@ iwm_node_alloc(struct ieee80211vap *vap,
M_NOWAIT | M_ZERO);
 }
 
+uint8_t
+iwm_ridx2rate(struct ieee80211_rateset *rs, int ridx)
+{
+   int i;
+   uint8_t rval;
+
+   for (i = 0; i < rs->rs_nrates; i++) {
+   rval = (rs->rs_rates[i] & IEEE80211_RATE_VAL);
+   if (rval == iwm_rates[ridx].rate)
+   return rs->rs_rates[i];
+   }
+
+   return 0;
+}
+
 static void
 iwm_setrates(struct iwm_softc *sc, struct iwm_node *in)
 {

Modified: head/sys/dev/iwm/if_iwm_mac_ctxt.c
==
--- head/sys/dev/iwm/if_iwm_mac_ctxt.c  Sat Mar 25 02:49:20 2017
(r315925)
+++ head/sys/dev/iwm/if_iwm_mac_ctxt.c  Sat Mar 25 02:55:13 2017
(r315926)
@@ -162,24 +162,28 @@ __FBSDID("$FreeBSD$");
 
 static void
 iwm_mvm_ack_rates(struct iwm_softc *sc, int is2ghz,
-   int *cck_rates, int *ofdm_rates)
+   int *cck_rates, int *ofdm_rates, struct iwm_node *in)
 {
int lowest_present_ofdm = 100;
int lowest_present_cck = 100;
uint8_t cck = 0;
uint8_t ofdm = 0;
int i;
+   struct ieee80211_rateset *rs = >in_ni.ni_rates;
 
if (is2ghz) {
-   for (i = 0; i <= IWM_LAST_CCK_RATE; i++) {
+   for (i = IWM_FIRST_CCK_RATE; i <= IWM_LAST_CCK_RATE; i++) {
+   if ((iwm_ridx2rate(rs, i) & IEEE80211_RATE_BASIC) == 0)
+   continue;
cck |= (1 << i);
if (lowest_present_cck > i)
lowest_present_cck = i;
}
}
for (i = IWM_FIRST_OFDM_RATE; i <= IWM_LAST_NON_HT_RATE; i++) {
-   int adj = i - IWM_FIRST_OFDM_RATE;
-   ofdm |= (1 << adj);
+   if ((iwm_ridx2rate(rs, i) & IEEE80211_RATE_BASIC) == 0)
+   continue;
+   ofdm |= (1 << (i - IWM_FIRST_OFDM_RATE));
if (lowest_present_ofdm > i)
lowest_present_ofdm = i;
}
@@ -307,7 +311,7 @@ iwm_mvm_mac_ctxt_cmd_common(struct iwm_s
} else {
is2ghz = 1;
}
-   iwm_mvm_ack_rates(sc, is2ghz, _ack_rates, _ack_rates);
+   iwm_mvm_ack_rates(sc, is2ghz, _ack_rates, _ack_rates, in);
cmd->cck_rates = htole32(cck_ack_rates);
cmd->ofdm_rates = htole32(ofdm_ack_rates);
 
@@ -446,13 +450,11 @@ iwm_mvm_mac_ctxt_cmd_station(struct iwm_
 {
struct ieee80211_node *ni = vap->iv_bss;
struct iwm_node *in = IWM_NODE(ni);
-   struct iwm_mac_ctx_cmd cmd;
+   struct iwm_mac_ctx_cmd cmd = {};
 
IWM_DPRINTF(sc, IWM_DEBUG_RESET,
"%s: called; action=%d\n", __func__, action);
 
-   memset(, 0, sizeof(cmd));
-
/* Fill the common data for all mac context types */
iwm_mvm_mac_ctxt_cmd_common(sc, in, , action);
 

Modified: head/sys/dev/iwm/if_iwm_util.h
==
--- head/sys/dev/iwm/if_iwm_util.h  Sat Mar 25 02:49:20 2017
(r315925)
+++ head/sys/dev/iwm/if_iwm_util.h  Sat Mar 25 02:55:13 2017
(r315926)
@@ -120,6 +120,8 @@ extern  int iwm_dma_contig_alloc(bus_dma_
 bus_size_t size, bus_size_t alignment);
 extern void iwm_dma_contig_free(struct iwm_dma_info *);
 
+extern uint8_t iwm_ridx2rate(struct ieee80211_rateset *rs, int ridx);
+
 static inline uint8_t
 iwm_mvm_get_valid_tx_ant(struct iwm_softc *sc)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315923 - head/sys/dev/iwm

2017-03-24 Thread Adrian Chadd
Author: adrian
Date: Sat Mar 25 02:42:52 2017
New Revision: 315923
URL: https://svnweb.freebsd.org/changeset/base/315923

Log:
  [iwm]  Tiny cleanup in iwm_rx_addbuf().
  
  Obtained from:dragonflybsd.git 
3370bc5504ebb3c1b9bb960a185cd0c8052a2845

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Sat Mar 25 02:28:21 2017(r315922)
+++ head/sys/dev/iwm/if_iwm.c   Sat Mar 25 02:42:52 2017(r315923)
@@ -3032,7 +3032,7 @@ iwm_rx_addbuf(struct iwm_softc *sc, int 
struct iwm_rx_ring *ring = >rxq;
struct iwm_rx_data *data = >data[idx];
struct mbuf *m;
-   bus_dmamap_t dmamap = NULL;
+   bus_dmamap_t dmamap;
bus_dma_segment_t seg;
int nsegs, error;
 
@@ -3046,7 +3046,8 @@ iwm_rx_addbuf(struct iwm_softc *sc, int 
if (error != 0) {
device_printf(sc->sc_dev,
"%s: can't map mbuf, error %d\n", __func__, error);
-   goto fail;
+   m_freem(m);
+   return error;
}
 
if (data->m != NULL)
@@ -3067,9 +3068,6 @@ iwm_rx_addbuf(struct iwm_softc *sc, int 
BUS_DMASYNC_PREWRITE);
 
return 0;
-fail:
-   m_freem(m);
-   return error;
 }
 
 /* iwlwifi: mvm/rx.c */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315925 - head/sys/dev/iwm

2017-03-24 Thread Adrian Chadd
Author: adrian
Date: Sat Mar 25 02:49:20 2017
New Revision: 315925
URL: https://svnweb.freebsd.org/changeset/base/315925

Log:
  [iwm] Enable Energy Based Scan (EBS).
  
  This can significantly reduce scan duration thus saving time and power.
  EBS failure reported by FW disables EBS for current connection. It is
  re-enabled upon new connection attempt on any WLAN interface.
  
  Obtained from:dragonflybsd.git 
89f579e9823a5c446ca172cf82bbc210d6a054a4

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwm_scan.c
  head/sys/dev/iwm/if_iwm_scan.h
  head/sys/dev/iwm/if_iwmreg.h
  head/sys/dev/iwm/if_iwmvar.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Sat Mar 25 02:44:25 2017(r315924)
+++ head/sys/dev/iwm/if_iwm.c   Sat Mar 25 02:49:20 2017(r315925)
@@ -4518,6 +4518,11 @@ iwm_newstate(struct ieee80211vap *vap, e
break;
 
case IEEE80211_S_ASSOC:
+   /*
+* EBS may be disabled due to previous failures reported by FW.
+* Reset EBS status here assuming environment has been changed.
+*/
+sc->last_ebs_successful = TRUE;
if ((error = iwm_assoc(vap, sc)) != 0) {
device_printf(sc->sc_dev,
"%s: failed to associate: %d\n", __func__,
@@ -5525,36 +5530,27 @@ iwm_notif_intr(struct iwm_softc *sc)
case IWM_INIT_COMPLETE_NOTIF:
break;
 
-   case IWM_SCAN_OFFLOAD_COMPLETE: {
-   struct iwm_periodic_scan_complete *notif;
-   notif = (void *)pkt->data;
+   case IWM_SCAN_OFFLOAD_COMPLETE:
+   iwm_mvm_rx_lmac_scan_complete_notif(sc, pkt);
if (sc->sc_flags & IWM_FLAG_SCAN_RUNNING) {
sc->sc_flags &= ~IWM_FLAG_SCAN_RUNNING;
ieee80211_runtask(ic, >sc_es_task);
}
break;
-   }
 
case IWM_SCAN_ITERATION_COMPLETE: {
struct iwm_lmac_scan_complete_notif *notif;
notif = (void *)pkt->data;
-   ieee80211_runtask(>sc_ic, >sc_es_task);
-   break;
+   break;
}
- 
-   case IWM_SCAN_COMPLETE_UMAC: {
-   struct iwm_umac_scan_complete *notif;
-   notif = (void *)pkt->data;
 
-   IWM_DPRINTF(sc, IWM_DEBUG_SCAN,
-   "UMAC scan complete, status=0x%x\n",
-   notif->status);
+   case IWM_SCAN_COMPLETE_UMAC:
+   iwm_mvm_rx_umac_scan_complete_notif(sc, pkt);
if (sc->sc_flags & IWM_FLAG_SCAN_RUNNING) {
sc->sc_flags &= ~IWM_FLAG_SCAN_RUNNING;
ieee80211_runtask(ic, >sc_es_task);
}
break;
-   }
 
case IWM_SCAN_ITERATION_COMPLETE_UMAC: {
struct iwm_umac_scan_iter_complete_notif *notif;
@@ -5563,7 +5559,6 @@ iwm_notif_intr(struct iwm_softc *sc)
IWM_DPRINTF(sc, IWM_DEBUG_SCAN, "UMAC scan iteration "
"complete, status=0x%x, %d channels scanned\n",
notif->status, notif->scanned_channels);
-   ieee80211_runtask(>sc_ic, >sc_es_task);
break;
}
 
@@ -5967,6 +5962,9 @@ iwm_attach(device_t dev)
goto fail;
}
 
+   /* Set EBS as successful as long as not stated otherwise by the FW. */
+   sc->last_ebs_successful = TRUE;
+
/* PCI attach */
error = iwm_pci_attach(dev);
if (error != 0)

Modified: head/sys/dev/iwm/if_iwm_scan.c
==
--- head/sys/dev/iwm/if_iwm_scan.c  Sat Mar 25 02:44:25 2017
(r315924)
+++ head/sys/dev/iwm/if_iwm_scan.c  Sat Mar 25 02:49:20 2017
(r315925)
@@ -161,6 +161,9 @@ __FBSDID("$FreeBSD$");
  * BEGIN mvm/scan.c
  */
 
+#define IWM_DENSE_EBS_SCAN_RATIO 5
+#define IWM_SPARSE_EBS_SCAN_RATIO 1
+
 static uint16_t
 iwm_mvm_scan_rx_chain(struct iwm_softc *sc)
 {
@@ -198,6 +201,67 @@ iwm_mvm_scan_rate_n_flags(struct iwm_sof
return htole32(IWM_RATE_6M_PLCP | tx_ant);
 }
 
+static const char *
+iwm_mvm_ebs_status_str(enum iwm_scan_ebs_status status)
+{
+   switch (status) {
+   case IWM_SCAN_EBS_SUCCESS:
+   return "successful";
+   case IWM_SCAN_EBS_INACTIVE:
+   return "inactive";
+   case IWM_SCAN_EBS_FAILED:
+   case IWM_SCAN_EBS_CHAN_NOT_FOUND:
+   default:
+   

svn commit: r315924 - head/sys/dev/iwm

2017-03-24 Thread Adrian Chadd
Author: adrian
Date: Sat Mar 25 02:44:25 2017
New Revision: 315924
URL: https://svnweb.freebsd.org/changeset/base/315924

Log:
  [iwm] GC unused code from if_iwm_scan.c, copyied from iwn or iwlwifi/dvm.
  
  Obtained from:dragonflybsd.git 
10881df269b93c26e5ee6af629c36db5672e6e52

Modified:
  head/sys/dev/iwm/if_iwm_scan.c

Modified: head/sys/dev/iwm/if_iwm_scan.c
==
--- head/sys/dev/iwm/if_iwm_scan.c  Sat Mar 25 02:42:52 2017
(r315923)
+++ head/sys/dev/iwm/if_iwm_scan.c  Sat Mar 25 02:44:25 2017
(r315924)
@@ -161,12 +161,6 @@ __FBSDID("$FreeBSD$");
  * BEGIN mvm/scan.c
  */
 
-#define IWM_PLCP_QUIET_THRESH 1
-#define IWM_ACTIVE_QUIET_TIME 10
-#define LONG_OUT_TIME_PERIOD (600 * IEEE80211_DUR_TU)
-#define SHORT_OUT_TIME_PERIOD (200 * IEEE80211_DUR_TU)
-#define SUSPEND_TIME_PERIOD (100 * IEEE80211_DUR_TU)
-
 static uint16_t
 iwm_mvm_scan_rx_chain(struct iwm_softc *sc)
 {
@@ -181,26 +175,6 @@ iwm_mvm_scan_rx_chain(struct iwm_softc *
return htole16(rx_chain);
 }
 
-#if 0
-static uint32_t
-iwm_mvm_scan_max_out_time(struct iwm_softc *sc, uint32_t flags, int is_assoc)
-{
-   if (!is_assoc)
-   return 0;
-   if (flags & 0x1)
-   return htole32(SHORT_OUT_TIME_PERIOD);
-   return htole32(LONG_OUT_TIME_PERIOD);
-}
-
-static uint32_t
-iwm_mvm_scan_suspend_time(struct iwm_softc *sc, int is_assoc)
-{
-   if (!is_assoc)
-   return 0;
-   return htole32(SUSPEND_TIME_PERIOD);
-}
-#endif
-
 static uint32_t
 iwm_mvm_scan_rate_n_flags(struct iwm_softc *sc, int flags, int no_cck)
 {
@@ -224,32 +198,6 @@ iwm_mvm_scan_rate_n_flags(struct iwm_sof
return htole32(IWM_RATE_6M_PLCP | tx_ant);
 }
 
-#if 0
-/*
- * If req->n_ssids > 0, it means we should do an active scan.
- * In case of active scan w/o directed scan, we receive a zero-length SSID
- * just to notify that this scan is active and not passive.
- * In order to notify the FW of the number of SSIDs we wish to scan (including
- * the zero-length one), we need to set the corresponding bits in chan->type,
- * one for each SSID, and set the active bit (first). If the first SSID is
- * already included in the probe template, so we need to set only
- * req->n_ssids - 1 bits in addition to the first bit.
- */
-static uint16_t
-iwm_mvm_get_active_dwell(struct iwm_softc *sc, int flags, int n_ssids)
-{
-   if (flags & IEEE80211_CHAN_2GHZ)
-   return 30  + 3 * (n_ssids + 1);
-   return 20  + 2 * (n_ssids + 1);
-}
-
-static uint16_t
-iwm_mvm_get_passive_dwell(struct iwm_softc *sc, int flags)
-{
-   return (flags & IEEE80211_CHAN_2GHZ) ? 100 + 20 : 100 + 10;
-}
-#endif
-
 static int
 iwm_mvm_scan_skip_channel(struct ieee80211_channel *c)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315922 - head/sys/dev/cxgbe/iw_cxgbe

2017-03-24 Thread Navdeep Parhar
Author: np
Date: Sat Mar 25 02:28:21 2017
New Revision: 315922
URL: https://svnweb.freebsd.org/changeset/base/315922

Log:
  cxgbe/iw_cxgbe: allocations that use GFP_KERNEL (which is M_WAITOK on
  FreeBSD) cannot fail.
  
  MFC after:3 days

Modified:
  head/sys/dev/cxgbe/iw_cxgbe/cm.c

Modified: head/sys/dev/cxgbe/iw_cxgbe/cm.c
==
--- head/sys/dev/cxgbe/iw_cxgbe/cm.cSat Mar 25 01:45:04 2017
(r315921)
+++ head/sys/dev/cxgbe/iw_cxgbe/cm.cSat Mar 25 02:28:21 2017
(r315922)
@@ -2135,14 +2135,6 @@ int c4iw_connect(struct iw_cm_id *cm_id,
goto out;
}
ep = alloc_ep(sizeof(*ep), GFP_KERNEL);
-
-   if (!ep) {
-
-   CTR2(KTR_IW_CXGBE, "%s:cc2 %p", __func__, cm_id);
-   printk(KERN_ERR MOD "%s - cannot alloc ep.\n", __func__);
-   err = -ENOMEM;
-   goto out;
-   }
init_timer(>timer);
ep->plen = conn_param->private_data_len;
 
@@ -2229,21 +2221,11 @@ out:
 int
 c4iw_create_listen_ep(struct iw_cm_id *cm_id, int backlog)
 {
-   int rc;
struct c4iw_dev *dev = to_c4iw_dev(cm_id->device);
struct c4iw_listen_ep *ep;
struct socket *so = cm_id->so;
 
ep = alloc_ep(sizeof(*ep), GFP_KERNEL);
-   CTR5(KTR_IW_CXGBE, "%s: cm_id %p, lso %p, ep %p, inp %p", __func__,
-   cm_id, so, ep, so->so_pcb);
-   if (ep == NULL) {
-   log(LOG_ERR, "%s: failed to alloc memory for endpoint\n",
-   __func__);
-   rc = ENOMEM;
-   goto failed;
-   }
-
ep->com.cm_id = cm_id;
ref_cm_id(>com);
ep->com.dev = dev;
@@ -2255,10 +2237,6 @@ c4iw_create_listen_ep(struct iw_cm_id *c
 
cm_id->provider_data = ep;
return (0);
-
-failed:
-   CTR3(KTR_IW_CXGBE, "%s: cm_id %p, FAILED (%d)", __func__, cm_id, rc);
-   return (-rc);
 }
 
 void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315921 - head/sys/dev/cxgbe/iw_cxgbe

2017-03-24 Thread Navdeep Parhar
Author: np
Date: Sat Mar 25 01:45:04 2017
New Revision: 315921
URL: https://svnweb.freebsd.org/changeset/base/315921

Log:
  cxgbe/iw_cxgbe: alloc_ep expects a gfp_t, and it's always ok to sleep during
  alloc_ep.

Modified:
  head/sys/dev/cxgbe/iw_cxgbe/cm.c

Modified: head/sys/dev/cxgbe/iw_cxgbe/cm.c
==
--- head/sys/dev/cxgbe/iw_cxgbe/cm.cSat Mar 25 01:38:17 2017
(r315920)
+++ head/sys/dev/cxgbe/iw_cxgbe/cm.cSat Mar 25 01:45:04 2017
(r315921)
@@ -695,7 +695,7 @@ process_newconn(struct iw_cm_id *parent_
 
MPASS(child_so != NULL);
 
-   child_ep = alloc_ep(sizeof(*child_ep), M_WAITOK);
+   child_ep = alloc_ep(sizeof(*child_ep), GFP_KERNEL);
 
CTR5(KTR_IW_CXGBE,
"%s: parent so %p, parent ep %p, child so %p, child ep %p",
@@ -2134,7 +2134,7 @@ int c4iw_connect(struct iw_cm_id *cm_id,
err = -EINVAL;
goto out;
}
-   ep = alloc_ep(sizeof(*ep), M_NOWAIT);
+   ep = alloc_ep(sizeof(*ep), GFP_KERNEL);
 
if (!ep) {
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315920 - head/sys/dev/cxgbe/iw_cxgbe

2017-03-24 Thread Navdeep Parhar
Author: np
Date: Sat Mar 25 01:38:17 2017
New Revision: 315920
URL: https://svnweb.freebsd.org/changeset/base/315920

Log:
  cxgbe/iw_cxgbe: c4iw_connect should always returns a -ve errno on failure.
  
  MFC after:3 days

Modified:
  head/sys/dev/cxgbe/iw_cxgbe/cm.c

Modified: head/sys/dev/cxgbe/iw_cxgbe/cm.c
==
--- head/sys/dev/cxgbe/iw_cxgbe/cm.cSat Mar 25 00:52:33 2017
(r315919)
+++ head/sys/dev/cxgbe/iw_cxgbe/cm.cSat Mar 25 01:38:17 2017
(r315920)
@@ -2202,7 +2202,7 @@ int c4iw_connect(struct iw_cm_id *cm_id,
ep->tos = 0;
ep->com.local_addr = cm_id->local_addr;
ep->com.remote_addr = cm_id->remote_addr;
-   err = soconnect(ep->com.so, (struct sockaddr *)>com.remote_addr,
+   err = -soconnect(ep->com.so, (struct sockaddr *)>com.remote_addr,
ep->com.thread);
 
if (!err) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315919 - stable/11/lib/libc/sys

2017-03-24 Thread Eric van Gyzen
Author: vangyzen
Date: Sat Mar 25 00:52:33 2017
New Revision: 315919
URL: https://svnweb.freebsd.org/changeset/base/315919

Log:
  MFC r315694
  
  clock_gettime.2: add some clock IDs
  
  Add the CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID clock_id
  values to the clock_gettime(2) man page.  Reformat the excessively
  long paragraph (sentence!) into a tag list.
  
  Sponsored by: Dell EMC

Modified:
  stable/11/lib/libc/sys/clock_gettime.2
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/sys/clock_gettime.2
==
--- stable/11/lib/libc/sys/clock_gettime.2  Fri Mar 24 22:33:03 2017
(r315918)
+++ stable/11/lib/libc/sys/clock_gettime.2  Sat Mar 25 00:52:33 2017
(r315919)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 27, 2015
+.Dd March 20, 2017
 .Dt CLOCK_GETTIME 2
 .Os
 .Sh NAME
@@ -58,31 +58,39 @@ used by a clock which is specified by
 .Pp
 The
 .Fa clock_id
-argument
-can be one of the following values:
-.Dv CLOCK_REALTIME ,
-.Dv CLOCK_REALTIME_PRECISE ,
-.Dv CLOCK_REALTIME_FAST
-for time that increments as
-a wall clock should;
-.Dv CLOCK_MONOTONIC ,
-.Dv CLOCK_MONOTONIC_PRECISE ,
-.Dv CLOCK_MONOTONIC_FAST
-which increments in SI seconds;
-.Dv CLOCK_UPTIME ,
-.Dv CLOCK_UPTIME_PRECISE ,
-.Dv CLOCK_UPTIME_FAST
-which starts at zero when the kernel boots and increments
-monotonically in SI seconds while the machine is running;
-.Dv CLOCK_VIRTUAL
-for time that increments only when
-the CPU is running in user mode on behalf of the calling process;
-.Dv CLOCK_PROF
-for time that increments when the CPU is running in user or
-kernel mode; or
-.Dv CLOCK_SECOND
-which returns the current second without performing a full time counter
-query, using in-kernel cached value of current second.
+argument can be a value obtained from
+.Xr clock_getcpuclockid 3
+or
+.Xr pthread_getcpuclockid 3
+as well as the following values:
+.Pp
+.Bl -tag -width indent -compact
+.It Dv CLOCK_REALTIME
+.It Dv CLOCK_REALTIME_PRECISE
+.It Dv CLOCK_REALTIME_FAST
+Increments as a wall clock should.
+.It Dv CLOCK_MONOTONIC
+.It Dv CLOCK_MONOTONIC_PRECISE
+.It Dv CLOCK_MONOTONIC_FAST
+Increments in SI seconds.
+.It Dv CLOCK_UPTIME
+.It Dv CLOCK_UPTIME_PRECISE
+.It Dv CLOCK_UPTIME_FAST
+Starts at zero when the kernel boots and increments
+monotonically in SI seconds while the machine is running.
+.It Dv CLOCK_VIRTUAL
+Increments only when
+the CPU is running in user mode on behalf of the calling process.
+.It Dv CLOCK_PROF
+Increments when the CPU is running in user or kernel mode.
+.It Dv CLOCK_SECOND
+Returns the current second without performing a full time counter
+query, using an in-kernel cached value of the current second.
+.It Dv CLOCK_PROCESS_CPUTIME_ID
+Returns the execution time of the calling process.
+.It Dv CLOCK_THREAD_CPUTIME_ID
+Returns the execution time of the calling thread.
+.El
 .Pp
 The clock IDs
 .Fa CLOCK_REALTIME_FAST ,
@@ -144,7 +152,9 @@ A user other than the super-user attempt
 .Sh SEE ALSO
 .Xr date 1 ,
 .Xr adjtime 2 ,
+.Xr clock_getcpuclockid 3 ,
 .Xr ctime 3 ,
+.Xr pthread_getcpuclockid 3 ,
 .Xr timed 8
 .Sh STANDARDS
 The
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315918 - head/sys/arm64/conf

2017-03-24 Thread Warner Losh
Author: imp
Date: Fri Mar 24 22:33:03 2017
New Revision: 315918
URL: https://svnweb.freebsd.org/changeset/base/315918

Log:
  Add 'device iic' to bring in userland I2C driver.
  
  Submitted by: karl@

Modified:
  head/sys/arm64/conf/GENERIC

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Fri Mar 24 22:29:51 2017(r315917)
+++ head/sys/arm64/conf/GENERIC Fri Mar 24 22:33:03 2017(r315918)
@@ -174,6 +174,7 @@ device  fdt_pinctrl
 device aw_rsb  # Allwinner Reduced Serial Bus
 device bcm2835_bsc # Broadcom BCM283x I2C bus
 device iicbus
+device iic
 
 # Clock and reset controllers
 device aw_ccu  # Allwinner clock controller
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315917 - head/sys/net80211

2017-03-24 Thread Andriy Voskoboinyk
Author: avos
Date: Fri Mar 24 22:29:51 2017
New Revision: 315917
URL: https://svnweb.freebsd.org/changeset/base/315917

Log:
  net80211: fix possible panic when wlan(4) interface is destroyed.
  
  If this is the last running vap wait until device will be powered off
  (fixes panic when 'ifconfig wlan0 destroy' is executed for running iwn(4)
  interface).
  
  Tested with:
   - Intel 6205, STA mode.
   - RTL8188EU, STA / IBSS modes.
   - RTL8821AU, STA / HOSTAP modes.

Modified:
  head/sys/net80211/ieee80211.c

Modified: head/sys/net80211/ieee80211.c
==
--- head/sys/net80211/ieee80211.c   Fri Mar 24 18:28:48 2017
(r315916)
+++ head/sys/net80211/ieee80211.c   Fri Mar 24 22:29:51 2017
(r315917)
@@ -728,6 +728,7 @@ ieee80211_vap_detach(struct ieee80211vap
ieee80211_draintask(ic, >iv_nstate_task);
ieee80211_draintask(ic, >iv_swbmiss_task);
ieee80211_draintask(ic, >iv_wme_task);
+   ieee80211_draintask(ic, >ic_parent_task);
 
/* XXX band-aid until ifnet handles this for us */
taskqueue_drain(taskqueue_swi, >if_linktask);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r315901 - head/sbin/devd

2017-03-24 Thread Cy Schubert
In message <201703241346.v2odkqtj019...@repo.freebsd.org>, Warner Losh 
writes:
> Author: imp
> Date: Fri Mar 24 13:46:26 2017
> New Revision: 315901
> URL: https://svnweb.freebsd.org/changeset/base/315901
> 
> Log:
>   Use a more stream-lined version of fix_value.
>   
>   Submitted by: ian@
> 
> Modified:
>   head/sbin/devd/devd.cc
>   head/sbin/devd/devd.hh
> 
> Modified: head/sbin/devd/devd.cc
> =
> =
> --- head/sbin/devd/devd.ccFri Mar 24 11:46:49 2017(r315900)
> +++ head/sbin/devd/devd.ccFri Mar 24 13:46:26 2017(r315901)
> @@ -417,24 +417,16 @@ var_list::is_set(const string ) cons
>   * converted to ". For all other characters, both \ and following
>   * character. So the string 'fre\:\"' is translated to 'fred\:"'.
>   */
> -const std::string &
> +std::string
>  var_list::fix_value(const std::string ) const
>  {
> - char *tmp, *dst;
> - const char *src;
> - std::string *rv;
> -
> - dst = tmp = new char[val.length()];
> - src = val.c_str();
> - while (*src) {
> - if (*src == '\\' && src[1] == '"')
> - src++;
> - else
> - *dst++ = *src++;
> - }
> - rv = new string(tmp);
> - delete tmp;
> - return *rv;
> +std::string rv(val);
> +std::string::size_type pos(0);
> +
> +while ((pos = rv.find("\\\"", pos)) != rv.npos) {
> +rv.erase(pos, 1);
> +}
> +return (rv);
>  }
>  
>  void
> 
> Modified: head/sbin/devd/devd.hh
> =
> =
> --- head/sbin/devd/devd.hhFri Mar 24 11:46:49 2017(r315900)
> +++ head/sbin/devd/devd.hhFri Mar 24 13:46:26 2017(r315901)
> @@ -57,7 +57,7 @@ public:
>   static const std::string nothing;
>  
>  private:
> - const std::string _value(const std::string ) const;
> + std::string fix_value(const std::string ) const;
>  
>   std::map _vars;
>  };
> 
> 

Thank you Warner.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX:     Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r315662 - in head: contrib/bsnmp/snmp_mibII contrib/ipfilter/ipsend lib/libprocstat sys/netinet sys/sys usr.bin/netstat usr.bin/sockstat usr.bin/systat usr.sbin/tcpdrop usr.sbin/trpt

2017-03-24 Thread John Baldwin
On Friday, March 24, 2017 10:45:09 AM Gleb Smirnoff wrote:
>   John,
> 
> On Tue, Mar 21, 2017 at 02:24:30PM -0700, John Baldwin wrote:
> J> > I have very much anticipated this comment from you, John.
> J> > 
> J> > I would like to remind you, that we have had this very exact conversation
> J> > back when I removed kvm support from netstat/route.c. Let me search the
> J> > archives:
> J> > 
> J> > https://lists.freebsd.org/pipermail/svn-src-head/2015-April/070480.html
> J> > 
> J> > This conversation has had a continuation on IRC, which I don't archive.
> J> > 
> J> > AFAIR, first I told that with all my involvement into networking stack,
> J> > I never ever had experienced a need to run route stats on a core. The
> J> > debugger were the only useful tool. And that opinion was seconded by
> J> > other network hackers. Then we discussed that a proper tool chould use
> J> > dynamic type parsing and not kvm(3). You said that future gdb has python
> J> > scripting and that would work fine. Meanwhile, you insisted that I 
> restore
> J> > the functionality. I resisted to put kvm(3) back into netstat/route.c, 
> and
> J> > instead I created a gdb script that prints exactly what 'nestat -anr -M 
> core'
> J> > prints. And I committed the script just to satisfy your demand:
> J> > 
> J> > tools/debugscripts/netstat-anr.gdb
> J> > 
> J> > Can you please fairly answer, have you (or anyone else) ever used the
> J> > script during these 2 years?
> J> 
> J> You never updated crashinfo to use the script (the point of crashinfo is to
> J> give an automated bit of information users can include in bug reports).
> J> crashinfo came from Yahoo! where knowing the active state of the system
> J> during a crash was indeed useful.  It wasn't necessarily about debugging a
> J> panic in the network stack, but about obtaining information about the 
> system
> J> useful in debugging crashes in arbitrary parts of the kernel.  I don't work
> J> at Y! anymore, so I'm not in the same environment.  Those things tend to be
> J> more useful when dealing with a large deployment of hetergenous systems
> J> rather than doing focused development on a driver or a bunch of identical
> J> systems with the same workload / role (e.g. appliances).
> 
> Since you outlined that it is important that systems are heterogenous, looks
> like you anticipated my reply that at Netflix we also do automated crash
> collection. :)
> 
> Still, my personal experience is that when analyzing a crash, you aren't
> interested in full table, be it a routing table or a PCB list. You are
> focused on the entry that crashed. This experience comes from my previous
> job Rambler, which is a Russian version of Yahoo! :)
> All the time I analyzed our internal crashes, or FreeBSD PRs, I always
> PgDown-ed this tons of information.

I'm not saying it is always useful, but it is sometimes useful.  And it may
not be a panic in the network stack, but more "which connections and on which
mix of ports were active when it crashed".  'ps' output isn't only useful
when you have a crash in fork().  It happens to be useful for other types of
panics as well.
 
> J> Also, the setgid thing is a red herring.  You don't need setgid to read 
> from
> J> a core, only to use kvm against a live system.  I'm all for using sysctls 
> to
> J> fetch data against live system and only keeping kvm for use with core dumps
> J> which doesn't require setgid.
> 
> Which means that if you want a tool to print out stats from a core, that 
> should
> be a separate tool. And the runtime tool netstat should get free of kvm, and 
> of
> setgid bit.

A separate tool means that you have to reproduce the formatting bits, and it
is convenient to have consistent output.
 
> Here we again come to the need of debugger with better scripting support. What
> are the expectations for newer gdb which has python scripting?

'pkg install gdb' has provided a working kgdb for over a year now.  crashinfo
will even look for and prefer kgdb from ports over kgdb from base.

-- 
John Baldwin
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315916 - stable/10/sys/dev/ixgbe

2017-03-24 Thread Eric Joyner
Author: erj
Date: Fri Mar 24 18:28:48 2017
New Revision: 315916
URL: https://svnweb.freebsd.org/changeset/base/315916

Log:
  ixgbe(4): Re-add mutex lock call that was dropped in a previous commit.
  
  PR:   218062
  Reported by:  Terry Kennedy 
  Sponsored by: Intel Corporation

Modified:
  stable/10/sys/dev/ixgbe/if_ix.c

Modified: stable/10/sys/dev/ixgbe/if_ix.c
==
--- stable/10/sys/dev/ixgbe/if_ix.c Fri Mar 24 18:28:13 2017
(r315915)
+++ stable/10/sys/dev/ixgbe/if_ix.c Fri Mar 24 18:28:48 2017
(r315916)
@@ -3929,6 +3929,7 @@ ixgbe_handle_msf(void *context, int pend
u32 autoneg;
boolnegotiate;
 
+   IXGBE_CORE_LOCK(adapter);
/* get_supported_phy_layer will call hw->phy.ops.identify_sfp() */
adapter->phy_layer = ixgbe_get_supported_physical_layer(hw);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315915 - in stable: 10/contrib/libc++/include 9/contrib/libc++/include

2017-03-24 Thread Dimitry Andric
Author: dim
Date: Fri Mar 24 18:28:13 2017
New Revision: 315915
URL: https://svnweb.freebsd.org/changeset/base/315915

Log:
  Pull in r283944 from upstream libc++ trunk (by Eric Fiselier):
  
Fix std::pair on FreeBSD
  
Summary:
FreeBSD ships an old ABI for std::pair which requires that it have
non-trivial copy/move constructors. Currently the non-trivial
copy/move is achieved by providing explicit definitions of the
constructors. This is problematic because it means the constructors
don't SFINAE properly. In order to SFINAE copy/move constructors they
have to be explicitly defaulted and hense non-trivial.
  
This patch attempts to provide SFINAE'ing copy/move constructors for
std::pair while still making them non-trivial. It does this by adding
a base class with a non-trivial copy constructor and then allowing
pair's constructors to be generated by the compiler. This also allows
the constructors to be constexpr.
  
Reviewers: emaste, theraven, rsmith, dim
  
Subscribers: cfe-commits
  
Differential Revision: https://reviews.llvm.org/D25389
  
  This should fix building www/chromium 57.0.2987.110 on stable/10 and
  stable/9 without having to use -D_LIBCPP_TRIVIAL_PAIR_COPY_CTOR=1 (which
  changes the ABI).  Direct commit to stable/10 and stable/9, since head
  already has libc++ 4.0, which includes this fix.

Modified:
  stable/10/contrib/libc++/include/utility

Changes in other areas also in this revision:
Modified:
  stable/9/contrib/libc++/include/utility

Modified: stable/10/contrib/libc++/include/utility
==
--- stable/10/contrib/libc++/include/utilityFri Mar 24 17:34:55 2017
(r315914)
+++ stable/10/contrib/libc++/include/utilityFri Mar 24 18:28:13 2017
(r315915)
@@ -244,8 +244,20 @@ extern const piecewise_construct_t piece
 constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
 #endif
 
+#if !_LIBCPP_TRIVIAL_PAIR_COPY_CTOR
+struct __non_trivially_copyable_base {
+  _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
+  __non_trivially_copyable_base() _NOEXCEPT {}
+  _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+  __non_trivially_copyable_base(__non_trivially_copyable_base const&) 
_NOEXCEPT {}
+};
+#endif
+
 template 
 struct _LIBCPP_TYPE_VIS_ONLY pair
+#if !_LIBCPP_TRIVIAL_PAIR_COPY_CTOR
+: private __non_trivially_copyable_base
+#endif
 {
 typedef _T1 first_type;
 typedef _T2 second_type;
@@ -253,9 +265,6 @@ struct _LIBCPP_TYPE_VIS_ONLY pair
 _T1 first;
 _T2 second;
 
-// pair(const pair&) = default;
-// pair(pair&&) = default;
-
 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR pair() : first(), second() {}
 
 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
@@ -272,18 +281,11 @@ struct _LIBCPP_TYPE_VIS_ONLY pair
   )
 : first(__p.first), second(__p.second) {}
 
-#if !defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && 
_LIBCPP_TRIVIAL_PAIR_COPY_CTOR
-_LIBCPP_INLINE_VISIBILITY
-pair(const pair& __p) = default;
-#elif !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) || 
!_LIBCPP_TRIVIAL_PAIR_COPY_CTOR
-_LIBCPP_INLINE_VISIBILITY
-pair(const pair& __p)
-_NOEXCEPT_(is_nothrow_copy_constructible::value &&
-   is_nothrow_copy_constructible::value)
-: first(__p.first),
-  second(__p.second)
-{
-}
+#if !defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS)
+pair(pair const&) = default;
+pair(pair&&) = default;
+#else
+  // Use the implicitly declared copy constructor in C++03
 #endif
 
 _LIBCPP_INLINE_VISIBILITY
@@ -315,19 +317,6 @@ struct _LIBCPP_TYPE_VIS_ONLY pair
 : first(_VSTD::forward<_U1>(__p.first)),
   second(_VSTD::forward<_U2>(__p.second)) {}
 
-#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
-_LIBCPP_INLINE_VISIBILITY
-pair(pair&& __p) = default;
-#else
-_LIBCPP_INLINE_VISIBILITY
-pair(pair&& __p) 
_NOEXCEPT_(is_nothrow_move_constructible::value &&
-
is_nothrow_move_constructible::value)
-: first(_VSTD::forward(__p.first)),
-  second(_VSTD::forward(__p.second))
-{
-}
-#endif
-
 _LIBCPP_INLINE_VISIBILITY
 pair&
 operator=(pair&& __p) 
_NOEXCEPT_(is_nothrow_move_assignable::value &&
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315915 - in stable: 10/contrib/libc++/include 9/contrib/libc++/include

2017-03-24 Thread Dimitry Andric
Author: dim
Date: Fri Mar 24 18:28:13 2017
New Revision: 315915
URL: https://svnweb.freebsd.org/changeset/base/315915

Log:
  Pull in r283944 from upstream libc++ trunk (by Eric Fiselier):
  
Fix std::pair on FreeBSD
  
Summary:
FreeBSD ships an old ABI for std::pair which requires that it have
non-trivial copy/move constructors. Currently the non-trivial
copy/move is achieved by providing explicit definitions of the
constructors. This is problematic because it means the constructors
don't SFINAE properly. In order to SFINAE copy/move constructors they
have to be explicitly defaulted and hense non-trivial.
  
This patch attempts to provide SFINAE'ing copy/move constructors for
std::pair while still making them non-trivial. It does this by adding
a base class with a non-trivial copy constructor and then allowing
pair's constructors to be generated by the compiler. This also allows
the constructors to be constexpr.
  
Reviewers: emaste, theraven, rsmith, dim
  
Subscribers: cfe-commits
  
Differential Revision: https://reviews.llvm.org/D25389
  
  This should fix building www/chromium 57.0.2987.110 on stable/10 and
  stable/9 without having to use -D_LIBCPP_TRIVIAL_PAIR_COPY_CTOR=1 (which
  changes the ABI).  Direct commit to stable/10 and stable/9, since head
  already has libc++ 4.0, which includes this fix.

Modified:
  stable/9/contrib/libc++/include/utility

Changes in other areas also in this revision:
Modified:
  stable/10/contrib/libc++/include/utility

Modified: stable/9/contrib/libc++/include/utility
==
--- stable/9/contrib/libc++/include/utility Fri Mar 24 17:34:55 2017
(r315914)
+++ stable/9/contrib/libc++/include/utility Fri Mar 24 18:28:13 2017
(r315915)
@@ -244,8 +244,20 @@ extern const piecewise_construct_t piece
 constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
 #endif
 
+#if !_LIBCPP_TRIVIAL_PAIR_COPY_CTOR
+struct __non_trivially_copyable_base {
+  _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
+  __non_trivially_copyable_base() _NOEXCEPT {}
+  _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
+  __non_trivially_copyable_base(__non_trivially_copyable_base const&) 
_NOEXCEPT {}
+};
+#endif
+
 template 
 struct _LIBCPP_TYPE_VIS_ONLY pair
+#if !_LIBCPP_TRIVIAL_PAIR_COPY_CTOR
+: private __non_trivially_copyable_base
+#endif
 {
 typedef _T1 first_type;
 typedef _T2 second_type;
@@ -253,9 +265,6 @@ struct _LIBCPP_TYPE_VIS_ONLY pair
 _T1 first;
 _T2 second;
 
-// pair(const pair&) = default;
-// pair(pair&&) = default;
-
 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR pair() : first(), second() {}
 
 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
@@ -272,18 +281,11 @@ struct _LIBCPP_TYPE_VIS_ONLY pair
   )
 : first(__p.first), second(__p.second) {}
 
-#if !defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && 
_LIBCPP_TRIVIAL_PAIR_COPY_CTOR
-_LIBCPP_INLINE_VISIBILITY
-pair(const pair& __p) = default;
-#elif !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) || 
!_LIBCPP_TRIVIAL_PAIR_COPY_CTOR
-_LIBCPP_INLINE_VISIBILITY
-pair(const pair& __p)
-_NOEXCEPT_(is_nothrow_copy_constructible::value &&
-   is_nothrow_copy_constructible::value)
-: first(__p.first),
-  second(__p.second)
-{
-}
+#if !defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS)
+pair(pair const&) = default;
+pair(pair&&) = default;
+#else
+  // Use the implicitly declared copy constructor in C++03
 #endif
 
 _LIBCPP_INLINE_VISIBILITY
@@ -315,19 +317,6 @@ struct _LIBCPP_TYPE_VIS_ONLY pair
 : first(_VSTD::forward<_U1>(__p.first)),
   second(_VSTD::forward<_U2>(__p.second)) {}
 
-#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
-_LIBCPP_INLINE_VISIBILITY
-pair(pair&& __p) = default;
-#else
-_LIBCPP_INLINE_VISIBILITY
-pair(pair&& __p) 
_NOEXCEPT_(is_nothrow_move_constructible::value &&
-
is_nothrow_move_constructible::value)
-: first(_VSTD::forward(__p.first)),
-  second(_VSTD::forward(__p.second))
-{
-}
-#endif
-
 _LIBCPP_INLINE_VISIBILITY
 pair&
 operator=(pair&& __p) 
_NOEXCEPT_(is_nothrow_move_assignable::value &&
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r315662 - in head: contrib/bsnmp/snmp_mibII contrib/ipfilter/ipsend lib/libprocstat sys/netinet sys/sys usr.bin/netstat usr.bin/sockstat usr.bin/systat usr.sbin/tcpdrop usr.sbin/trpt

2017-03-24 Thread Gleb Smirnoff
  John,

On Tue, Mar 21, 2017 at 02:24:30PM -0700, John Baldwin wrote:
J> > I have very much anticipated this comment from you, John.
J> > 
J> > I would like to remind you, that we have had this very exact conversation
J> > back when I removed kvm support from netstat/route.c. Let me search the
J> > archives:
J> > 
J> > https://lists.freebsd.org/pipermail/svn-src-head/2015-April/070480.html
J> > 
J> > This conversation has had a continuation on IRC, which I don't archive.
J> > 
J> > AFAIR, first I told that with all my involvement into networking stack,
J> > I never ever had experienced a need to run route stats on a core. The
J> > debugger were the only useful tool. And that opinion was seconded by
J> > other network hackers. Then we discussed that a proper tool chould use
J> > dynamic type parsing and not kvm(3). You said that future gdb has python
J> > scripting and that would work fine. Meanwhile, you insisted that I restore
J> > the functionality. I resisted to put kvm(3) back into netstat/route.c, and
J> > instead I created a gdb script that prints exactly what 'nestat -anr -M 
core'
J> > prints. And I committed the script just to satisfy your demand:
J> > 
J> > tools/debugscripts/netstat-anr.gdb
J> > 
J> > Can you please fairly answer, have you (or anyone else) ever used the
J> > script during these 2 years?
J> 
J> You never updated crashinfo to use the script (the point of crashinfo is to
J> give an automated bit of information users can include in bug reports).
J> crashinfo came from Yahoo! where knowing the active state of the system
J> during a crash was indeed useful.  It wasn't necessarily about debugging a
J> panic in the network stack, but about obtaining information about the system
J> useful in debugging crashes in arbitrary parts of the kernel.  I don't work
J> at Y! anymore, so I'm not in the same environment.  Those things tend to be
J> more useful when dealing with a large deployment of hetergenous systems
J> rather than doing focused development on a driver or a bunch of identical
J> systems with the same workload / role (e.g. appliances).

Since you outlined that it is important that systems are heterogenous, looks
like you anticipated my reply that at Netflix we also do automated crash
collection. :)

Still, my personal experience is that when analyzing a crash, you aren't
interested in full table, be it a routing table or a PCB list. You are
focused on the entry that crashed. This experience comes from my previous
job Rambler, which is a Russian version of Yahoo! :)
All the time I analyzed our internal crashes, or FreeBSD PRs, I always
PgDown-ed this tons of information.

J> Also, the setgid thing is a red herring.  You don't need setgid to read from
J> a core, only to use kvm against a live system.  I'm all for using sysctls to
J> fetch data against live system and only keeping kvm for use with core dumps
J> which doesn't require setgid.

Which means that if you want a tool to print out stats from a core, that should
be a separate tool. And the runtime tool netstat should get free of kvm, and of
setgid bit.

Here we again come to the need of debugger with better scripting support. What
are the expectations for newer gdb which has python scripting?

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


svn commit: r315914 - in head/sys: amd64/amd64 i386/i386

2017-03-24 Thread Bruce Evans
Author: bde
Date: Fri Mar 24 17:34:55 2017
New Revision: 315914
URL: https://svnweb.freebsd.org/changeset/base/315914

Log:
  Remove buggy adjustment of page tables in db_write_bytes().
  
  Long ago, perhaps only on i386, kernel text was mapped read-only and
  it was necessary to change the mapping to read-write to set breakpoints
  in kernel text.  Other writes by ddb to kernel text were also allowed.
  This write protection is harder to implement with 4MB pages, and was
  lost even for 4K pages when 4MB pages were implemented.  So changing
  the mapping became useless.  It was actually worse than useless since
  it followed followed various null and otherwise garbage pointers to
  not change random memory instead of the mapping.  (On i386s, the
  pointers became good in pmap_bootstrap(), and on amd64 the pointers
  became bad in pmap_bootstrap() if not before.)
  
  Another bug broke detection of following of null pointers on i386,
  except early in boot where not detecting this was a feature.  When
  I fixed the bug, I accidentally broke the feature and soon got traps
  in db_write_bytes().  Setting breakpoints early in ddb was broken.
  
  kib pointed out that a clean way to do the adjustment would be to use
  a special [sub]map giving a small window on the bytes to be written.
  
  The trap handler didn't know how to fix up errors for pagefaults
  accessing the map itself.  Such errors rarely need fixups, since most
  traps for the map are for the first access which is a read.
  
  Reviewed by:  kib

Modified:
  head/sys/amd64/amd64/db_interface.c
  head/sys/i386/i386/db_interface.c

Modified: head/sys/amd64/amd64/db_interface.c
==
--- head/sys/amd64/amd64/db_interface.c Fri Mar 24 16:26:11 2017
(r315913)
+++ head/sys/amd64/amd64/db_interface.c Fri Mar 24 17:34:55 2017
(r315914)
@@ -30,17 +30,11 @@ __FBSDID("$FreeBSD$");
 /*
  * Interface to new debugger.
  */
+
 #include 
 #include 
 #include 
-#include 
 #include 
-#include 
-
-#include 
-
-#include 
-#include 
 
 #include 
 
@@ -75,63 +69,16 @@ db_write_bytes(vm_offset_t addr, size_t 
jmp_buf jb;
void *prev_jb;
char *dst;
-   pt_entry_t  *ptep0 = NULL;
-   pt_entry_t  oldmap0 = 0;
-   vm_offset_t addr1;
-   pt_entry_t  *ptep1 = NULL;
-   pt_entry_t  oldmap1 = 0;
int ret;
 
prev_jb = kdb_jmpbuf(jb);
ret = setjmp(jb);
if (ret == 0) {
-   if (addr > trunc_page((vm_offset_t)btext) - size &&
-   addr < round_page((vm_offset_t)etext)) {
-
-   ptep0 = vtopte(addr);
-   oldmap0 = *ptep0;
-   *ptep0 |= PG_RW;
-
-   /*
-* Map another page if the data crosses a page
-* boundary.
-*/
-   if ((*ptep0 & PG_PS) == 0) {
-   addr1 = trunc_page(addr + size - 1);
-   if (trunc_page(addr) != addr1) {
-   ptep1 = vtopte(addr1);
-   oldmap1 = *ptep1;
-   *ptep1 |= PG_RW;
-   }
-   } else {
-   addr1 = trunc_2mpage(addr + size - 1);
-   if (trunc_2mpage(addr) != addr1) {
-   ptep1 = vtopte(addr1);
-   oldmap1 = *ptep1;
-   *ptep1 |= PG_RW;
-   }
-   }
-
-   invltlb();
-   }
-
dst = (char *)addr;
-
while (size-- > 0)
*dst++ = *data++;
}
-
(void)kdb_jmpbuf(prev_jb);
-
-   if (ptep0) {
-   *ptep0 = oldmap0;
-
-   if (ptep1)
-   *ptep1 = oldmap1;
-
-   invltlb();
-   }
-
return (ret);
 }
 

Modified: head/sys/i386/i386/db_interface.c
==
--- head/sys/i386/i386/db_interface.c   Fri Mar 24 16:26:11 2017
(r315913)
+++ head/sys/i386/i386/db_interface.c   Fri Mar 24 17:34:55 2017
(r315914)
@@ -30,17 +30,14 @@ __FBSDID("$FreeBSD$");
 /*
  * Interface to new debugger.
  */
+
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 
-#include 
-
-#include 
-#include 
+#include 
 
 #include 
 
@@ -75,63 +72,16 @@ db_write_bytes(vm_offset_t addr, size_t 
jmp_buf jb;
void *prev_jb;
char *dst;
-   pt_entry_t *ptep0 = NULL;
-   pt_entry_t oldmap0 = 0;
-   vm_offset_t addr1;
-   pt_entry_t *ptep1 = NULL;
-   pt_entry_t oldmap1 = 0;
int ret;
 
prev_jb = 

svn commit: r315913 - head/sys/dev/isp

2017-03-24 Thread Alexander Motin
Author: mav
Date: Fri Mar 24 16:26:11 2017
New Revision: 315913
URL: https://svnweb.freebsd.org/changeset/base/315913

Log:
  Add brackets to fix incorrect macro expansion.
  
  Reported by:  Andreas Hollmann / PVS-Studio
  MFC after:2 weeks

Modified:
  head/sys/dev/isp/ispmbox.h

Modified: head/sys/dev/isp/ispmbox.h
==
--- head/sys/dev/isp/ispmbox.h  Fri Mar 24 16:18:57 2017(r315912)
+++ head/sys/dev/isp/ispmbox.h  Fri Mar 24 16:26:11 2017(r315913)
@@ -1207,7 +1207,7 @@ typedef struct {
 #defineICB2400_VPINFO_OFF  0x80/* offset from start of ICB */
 #defineICB2400_VPINFO_PORT_OFF(chan)   \
 (ICB2400_VPINFO_OFF +  \
- sizeof (isp_icb_2400_vpinfo_t) + (chan * ICB2400_VPOPT_WRITE_SIZE))
+ sizeof (isp_icb_2400_vpinfo_t) + ((chan) * ICB2400_VPOPT_WRITE_SIZE))
 
 #defineICB2400_VPGOPT_FCA  0x01/* Assume Clean Address 
bit in FLOGI ACC set (works only in static configurations) */
 #defineICB2400_VPGOPT_MID_DISABLE  0x02/* when set, connection 
mode2 will work with NPIV-capable switched */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315912 - head/usr.sbin/pw

2017-03-24 Thread Eugene Grosbein
Author: eugen (ports committer)
Date: Fri Mar 24 16:18:57 2017
New Revision: 315912
URL: https://svnweb.freebsd.org/changeset/base/315912

Log:
  Properly initialise with content of pw.conf(5) that was mistakenly ignored.
  Also, respect "defaultgroup" if specified there.
  
  PR:   217934
  Reported by:  Victor Sudakov 
  Reviewed by:  bapt
  Approved by:  bapt, vsevolod (mentor)
  MFC after:1 week

Modified:
  head/usr.sbin/pw/pw_user.c

Modified: head/usr.sbin/pw/pw_user.c
==
--- head/usr.sbin/pw/pw_user.c  Fri Mar 24 16:18:20 2017(r315911)
+++ head/usr.sbin/pw/pw_user.c  Fri Mar 24 16:18:57 2017(r315912)
@@ -1177,7 +1177,7 @@ pw_user_add(int argc, char **argv, char 
char line[_PASSWORD_LEN+1], path[MAXPATHLEN];
char *gecos, *homedir, *skel, *walk, *userid, *groupid, *grname;
char *default_passwd, *name, *p;
-   const char *cfg;
+   const char *cfg = NULL;
login_cap_t *lc;
FILE *pfp, *fp;
intmax_t id = -1;
@@ -1356,6 +1356,9 @@ pw_user_add(int argc, char **argv, char 
if (GETPWNAM(name) != NULL)
errx(EX_DATAERR, "login name `%s' already exists", name);
 
+   if (!grname)
+   grname = cmdcnf->default_group;
+
pwd = 
pwd->pw_name = name;
pwd->pw_class = cmdcnf->default_class ? cmdcnf->default_class : "";
@@ -1485,7 +1488,7 @@ pw_user_mod(int argc, char **argv, char 
struct group *grp;
StringList *groups = NULL;
char args[] = "C:qn:u:c:d:e:p:g:G:mM:l:k:s:w:L:h:H:NPYy:";
-   const char *cfg;
+   const char *cfg = NULL;
char *gecos, *homedir, *grname, *name, *newname, *walk, *skel, *shell;
char *passwd, *class, *nispasswd;
login_cap_t *lc;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315911 - head/sys/x86/x86

2017-03-24 Thread Gavin Atkinson
Author: gavin
Date: Fri Mar 24 16:18:20 2017
New Revision: 315911
URL: https://svnweb.freebsd.org/changeset/base/315911

Log:
  Improve grammar on a warning, and only use one line rather than two when
  printing it.

Modified:
  head/sys/x86/x86/mp_x86.c

Modified: head/sys/x86/x86/mp_x86.c
==
--- head/sys/x86/x86/mp_x86.c   Fri Mar 24 16:01:19 2017(r315910)
+++ head/sys/x86/x86/mp_x86.c   Fri Mar 24 16:18:20 2017(r315911)
@@ -209,14 +209,14 @@ add_deterministic_cache(int type, int le
 
if (caches[level - 1].id_shift > pkg_id_shift) {
printf("WARNING: L%u data cache covers more "
-   "APIC IDs than a package\n", level);
-   printf("%u > %u\n", caches[level - 1].id_shift, pkg_id_shift);
+   "APIC IDs than a package (%u > %u)\n", level,
+   caches[level - 1].id_shift, pkg_id_shift);
caches[level - 1].id_shift = pkg_id_shift;
}
if (caches[level - 1].id_shift < core_id_shift) {
-   printf("WARNING: L%u data cache covers less "
-   "APIC IDs than a core\n", level);
-   printf("%u < %u\n", caches[level - 1].id_shift, core_id_shift);
+   printf("WARNING: L%u data cache covers fewer "
+   "APIC IDs than a core (%u < %u)\n", level,
+   caches[level - 1].id_shift, core_id_shift);
caches[level - 1].id_shift = core_id_shift;
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315910 - head/sys/kern

2017-03-24 Thread Gleb Smirnoff
Author: glebius
Date: Fri Mar 24 16:01:19 2017
New Revision: 315910
URL: https://svnweb.freebsd.org/changeset/base/315910

Log:
  Make sendfile(2) more robust against file change.  This fixes a possible
  crash when the file shrinks.  This also fixes sendfile(2) not sending more
  data in a case when the file grows, and the request is open-ended or
  specifies a size that is greater than old file size.
  
  PR:   217789
  Reviewed by:  gallatin
  MFC after:10 days

Modified:
  head/sys/kern/kern_sendfile.c

Modified: head/sys/kern/kern_sendfile.c
==
--- head/sys/kern/kern_sendfile.c   Fri Mar 24 14:45:58 2017
(r315909)
+++ head/sys/kern/kern_sendfile.c   Fri Mar 24 16:01:19 2017
(r315910)
@@ -689,11 +689,10 @@ retry_space:
goto done;
}
if (va.va_size != obj_size) {
-   if (nbytes == 0)
-   rem += va.va_size - obj_size;
-   else if (offset + nbytes > va.va_size)
-   rem -= (offset + nbytes - va.va_size);
obj_size = va.va_size;
+   rem = nbytes ?
+   omin(nbytes + offset, obj_size) : obj_size;
+   rem -= off;
}
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315909 - in head/contrib/openpam: include/security lib/libpam

2017-03-24 Thread Dag-Erling Smørgrav
Author: des
Date: Fri Mar 24 14:45:58 2017
New Revision: 315909
URL: https://svnweb.freebsd.org/changeset/base/315909

Log:
  Restore the NULL check that was removed in upstream r913.  It is not
  unreasonable to call pam_end() with a NULL pamh in error handling code.
  
  Reported by:  rwatson

Modified:
  head/contrib/openpam/include/security/pam_appl.h
  head/contrib/openpam/lib/libpam/pam_end.c

Modified: head/contrib/openpam/include/security/pam_appl.h
==
--- head/contrib/openpam/include/security/pam_appl.hFri Mar 24 14:44:03 
2017(r315908)
+++ head/contrib/openpam/include/security/pam_appl.hFri Mar 24 14:45:58 
2017(r315909)
@@ -72,8 +72,7 @@ pam_close_session(pam_handle_t *_pamh,
 
 int
 pam_end(pam_handle_t *_pamh,
-   int _status)
-   OPENPAM_NONNULL((1));
+   int _status);
 
 int
 pam_get_data(const pam_handle_t *_pamh,

Modified: head/contrib/openpam/lib/libpam/pam_end.c
==
--- head/contrib/openpam/lib/libpam/pam_end.c   Fri Mar 24 14:44:03 2017
(r315908)
+++ head/contrib/openpam/lib/libpam/pam_end.c   Fri Mar 24 14:45:58 2017
(r315909)
@@ -60,6 +60,8 @@ pam_end(pam_handle_t *pamh,
int i;
 
ENTER();
+   if (pamh == NULL)
+   RETURNC(PAM_SYSTEM_ERR);
 
/* clear module data */
while ((dp = pamh->module_data) != NULL) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315908 - head/sys/dev/isp

2017-03-24 Thread Alexander Motin
Author: mav
Date: Fri Mar 24 14:44:03 2017
New Revision: 315908
URL: https://svnweb.freebsd.org/changeset/base/315908

Log:
  Unify initiator and target DMA setup and command sending.
  
  The code is so alike that it is pointless to keep it separate.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/isp/isp_freebsd.c
  head/sys/dev/isp/isp_freebsd.h
  head/sys/dev/isp/isp_library.c
  head/sys/dev/isp/isp_library.h
  head/sys/dev/isp/isp_pci.c
  head/sys/dev/isp/isp_sbus.c
  head/sys/dev/isp/ispvar.h

Modified: head/sys/dev/isp/isp_freebsd.c
==
--- head/sys/dev/isp/isp_freebsd.c  Fri Mar 24 14:40:53 2017
(r315907)
+++ head/sys/dev/isp/isp_freebsd.c  Fri Mar 24 14:44:03 2017
(r315908)
@@ -1372,10 +1372,7 @@ isp_target_start_ctio(ispsoftc_t *isp, u
} else {
ct2_entry_t *cto = (ct2_entry_t *) local;
 
-   if (isp->isp_osinfo.sixtyfourbit)
-   cto->ct_header.rqs_entry_type = RQSTYPE_CTIO3;
-   else
-   cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2;
+   cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2;
cto->ct_header.rqs_entry_count = 1;
cto->ct_header.rqs_seqno |= ATPD_SEQ_NOTIFY_CAM;
ATPD_SET_SEQNO(cto, atp);
@@ -1468,14 +1465,8 @@ isp_target_start_ctio(ispsoftc_t *isp, u
isp_prt(isp, ISP_LOGTDEBUG0, "%s: ests 
base %p vaddr %p ecmd_dma %jx addr %jx len %u", __func__, 
isp->isp_osinfo.ecmd_base, atp->ests,
(uintmax_t) 
isp->isp_osinfo.ecmd_dma, (uintmax_t)addr, MIN_FCP_RESPONSE_SIZE + 
sense_length);
cto->rsp.m2.ct_datalen = 
MIN_FCP_RESPONSE_SIZE + sense_length;
-   if (cto->ct_header.rqs_entry_type == 
RQSTYPE_CTIO3) {
-   
cto->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_base = DMA_LO32(addr);
-   
cto->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_basehi = DMA_HI32(addr);
-   
cto->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_count = MIN_FCP_RESPONSE_SIZE + 
sense_length;
-   } else {
-   
cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base = DMA_LO32(addr);
-   
cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count = MIN_FCP_RESPONSE_SIZE + 
sense_length;
-   }
+   
cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base = DMA_LO32(addr);
+   
cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count = MIN_FCP_RESPONSE_SIZE + 
sense_length;
}
if (sense_length) {
isp_prt(isp, ISP_LOGTDEBUG0, "%s: 
CTIO2[0x%x] seq %u nc %d CDB0=%x sstatus=0x%x flags=0x%x resid=%d sense: %x 
%x/%x/%x", __func__,
@@ -3468,7 +3459,7 @@ isp_action(struct cam_sim *sim, union cc
cpi->max_lun = ISP_MAX_LUNS(isp) == 0 ?
255 : ISP_MAX_LUNS(isp) - 1;
cpi->bus_id = cam_sim_bus(sim);
-   if (isp->isp_osinfo.sixtyfourbit)
+   if (sizeof (bus_size_t) > 4)
cpi->maxio = (ISP_NSEG64_MAX - 1) * PAGE_SIZE;
else
cpi->maxio = (ISP_NSEG_MAX - 1) * PAGE_SIZE;

Modified: head/sys/dev/isp/isp_freebsd.h
==
--- head/sys/dev/isp/isp_freebsd.h  Fri Mar 24 14:40:53 2017
(r315907)
+++ head/sys/dev/isp/isp_freebsd.h  Fri Mar 24 14:44:03 2017
(r315908)
@@ -293,7 +293,6 @@ struct isposinfo {
struct isp_pcmd *   pcmd_pool;
struct isp_pcmd *   pcmd_free;
 
-   int sixtyfourbit;   /* sixtyfour bit platform */
int mbox_sleeping;
int mbox_sleep_ok;
int mboxbsy;
@@ -505,6 +504,13 @@ default:   
\
 d->ds_base = DMA_LO32(e->ds_addr); \
 d->ds_count = e->ds_len;   \
 }
+#if (BUS_SPACE_MAXADDR > UINT32_MAX)
+#define XS_NEED_DMA64_SEG(s, n)\
+   (((bus_dma_segment_t *)s)[n].ds_addr +  \
+   ((bus_dma_segment_t *)s)[n].ds_len > UINT32_MAX)
+#else
+#define XS_NEED_DMA64_SEG(s, n)(0)
+#endif
 #defineXS_ISP(ccb) 
cam_sim_softc(xpt_path_sim((ccb)->ccb_h.path))
 #defineXS_CHANNEL(ccb) 
cam_sim_bus(xpt_path_sim((ccb)->ccb_h.path))
 #defineXS_TGT(ccb)  

svn commit: r315907 - stable/10/contrib/openpam/lib/libpam

2017-03-24 Thread Dag-Erling Smørgrav
Author: des
Date: Fri Mar 24 14:40:53 2017
New Revision: 315907
URL: https://svnweb.freebsd.org/changeset/base/315907

Log:
  Subset of upstream r902 which fixes custom prompts.
  
  PR:   216172

Modified:
  stable/10/contrib/openpam/lib/libpam/pam_get_authtok.c
  stable/10/contrib/openpam/lib/libpam/pam_get_user.c

Modified: stable/10/contrib/openpam/lib/libpam/pam_get_authtok.c
==
--- stable/10/contrib/openpam/lib/libpam/pam_get_authtok.c  Fri Mar 24 
14:39:00 2017(r315906)
+++ stable/10/contrib/openpam/lib/libpam/pam_get_authtok.c  Fri Mar 24 
14:40:53 2017(r315907)
@@ -122,9 +122,11 @@ pam_get_authtok(pam_handle_t *pamh,
if ((promptp = openpam_get_option(pamh, prompt_option)) != NULL)
prompt = promptp;
/* no prompt provided, see if there is one tucked away somewhere */
-   if (prompt == NULL)
-   if (pam_get_item(pamh, pitem, ) && promptp != NULL)
+   if (prompt == NULL) {
+   r = pam_get_item(pamh, pitem, );
+   if (r == PAM_SUCCESS && promptp != NULL)
prompt = promptp;
+   }
/* fall back to hardcoded default */
if (prompt == NULL)
prompt = default_prompt;

Modified: stable/10/contrib/openpam/lib/libpam/pam_get_user.c
==
--- stable/10/contrib/openpam/lib/libpam/pam_get_user.c Fri Mar 24 14:39:00 
2017(r315906)
+++ stable/10/contrib/openpam/lib/libpam/pam_get_user.c Fri Mar 24 14:40:53 
2017(r315907)
@@ -78,10 +78,11 @@ pam_get_user(pam_handle_t *pamh,
if ((promptp = openpam_get_option(pamh, "user_prompt")) != NULL)
prompt = promptp;
/* no prompt provided, see if there is one tucked away somewhere */
-   if (prompt == NULL)
-   if (pam_get_item(pamh, PAM_USER_PROMPT, ) &&
-   promptp != NULL)
+   if (prompt == NULL) {
+   r = pam_get_item(pamh, PAM_USER_PROMPT, );
+   if (r == PAM_SUCCESS && promptp != NULL)
prompt = promptp;
+   }
/* fall back to hardcoded default */
if (prompt == NULL)
prompt = user_prompt;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315906 - stable/11/contrib/openpam/lib/libpam

2017-03-24 Thread Dag-Erling Smørgrav
Author: des
Date: Fri Mar 24 14:39:00 2017
New Revision: 315906
URL: https://svnweb.freebsd.org/changeset/base/315906

Log:
  Subset of upstream r902 which fixes custom prompts.
  
  PR:   216172

Modified:
  stable/11/contrib/openpam/lib/libpam/pam_get_authtok.c
  stable/11/contrib/openpam/lib/libpam/pam_get_user.c

Modified: stable/11/contrib/openpam/lib/libpam/pam_get_authtok.c
==
--- stable/11/contrib/openpam/lib/libpam/pam_get_authtok.c  Fri Mar 24 
14:27:29 2017(r315905)
+++ stable/11/contrib/openpam/lib/libpam/pam_get_authtok.c  Fri Mar 24 
14:39:00 2017(r315906)
@@ -122,9 +122,11 @@ pam_get_authtok(pam_handle_t *pamh,
if ((promptp = openpam_get_option(pamh, prompt_option)) != NULL)
prompt = promptp;
/* no prompt provided, see if there is one tucked away somewhere */
-   if (prompt == NULL)
-   if (pam_get_item(pamh, pitem, ) && promptp != NULL)
+   if (prompt == NULL) {
+   r = pam_get_item(pamh, pitem, );
+   if (r == PAM_SUCCESS && promptp != NULL)
prompt = promptp;
+   }
/* fall back to hardcoded default */
if (prompt == NULL)
prompt = default_prompt;

Modified: stable/11/contrib/openpam/lib/libpam/pam_get_user.c
==
--- stable/11/contrib/openpam/lib/libpam/pam_get_user.c Fri Mar 24 14:27:29 
2017(r315905)
+++ stable/11/contrib/openpam/lib/libpam/pam_get_user.c Fri Mar 24 14:39:00 
2017(r315906)
@@ -78,10 +78,11 @@ pam_get_user(pam_handle_t *pamh,
if ((promptp = openpam_get_option(pamh, "user_prompt")) != NULL)
prompt = promptp;
/* no prompt provided, see if there is one tucked away somewhere */
-   if (prompt == NULL)
-   if (pam_get_item(pamh, PAM_USER_PROMPT, ) &&
-   promptp != NULL)
+   if (prompt == NULL) {
+   r = pam_get_item(pamh, PAM_USER_PROMPT, );
+   if (r == PAM_SUCCESS && promptp != NULL)
prompt = promptp;
+   }
/* fall back to hardcoded default */
if (prompt == NULL)
prompt = user_prompt;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315904 - stable/10/lib/libfetch

2017-03-24 Thread Dag-Erling Smørgrav
Author: des
Date: Fri Mar 24 14:26:01 2017
New Revision: 315904
URL: https://svnweb.freebsd.org/changeset/base/315904

Log:
  MFH (r313974,r314596): open .netrc early in case we want to drop privs
  MFH (r314396,r315143): fix a crash caused by an incorrect format string
  MFH (r314701): fix handling of 416 errors when requesting a range
  MFH (r315455): fix parsing of IP literals (square brackets)
  
  PR:   212065, 217723

Modified:
  stable/10/lib/libfetch/common.c
  stable/10/lib/libfetch/common.h
  stable/10/lib/libfetch/fetch.c
  stable/10/lib/libfetch/fetch.h
  stable/10/lib/libfetch/http.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libfetch/common.c
==
--- stable/10/lib/libfetch/common.c Fri Mar 24 14:25:56 2017
(r315903)
+++ stable/10/lib/libfetch/common.c Fri Mar 24 14:26:01 2017
(r315904)
@@ -153,7 +153,7 @@ fetch_syserr(void)
case EHOSTDOWN:
fetchLastErrCode = FETCH_DOWN;
break;
-default:
+   default:
fetchLastErrCode = FETCH_UNKNOWN;
}
snprintf(fetchLastErrString, MAXERRSTRING, "%s", strerror(errno));
@@ -248,37 +248,51 @@ fetch_resolve(const char *addr, int port
 {
char hbuf[256], sbuf[8];
struct addrinfo hints, *res;
-   const char *sep, *host, *service;
+   const char *hb, *he, *sep;
+   const char *host, *service;
int err, len;
 
-   /* split address if necessary */
-   err = EAI_SYSTEM;
-   if ((sep = strchr(addr, ':')) != NULL) {
+   /* first, check for a bracketed IPv6 address */
+   if (*addr == '[') {
+   hb = addr + 1;
+   if ((sep = strchr(hb, ']')) == NULL) {
+   errno = EINVAL;
+   goto syserr;
+   }
+   he = sep++;
+   } else {
+   hb = addr;
+   sep = strchrnul(hb, ':');
+   he = sep;
+   }
+
+   /* see if we need to copy the host name */
+   if (*he != '\0') {
len = snprintf(hbuf, sizeof(hbuf),
-   "%.*s", (int)(sep - addr), addr);
+   "%.*s", (int)(he - hb), hb);
if (len < 0)
-   return (NULL);
+   goto syserr;
if (len >= (int)sizeof(hbuf)) {
errno = ENAMETOOLONG;
-   fetch_syserr();
-   return (NULL);
+   goto syserr;
}
host = hbuf;
-   service = sep + 1;
-   } else if (port != 0) {
+   } else {
+   host = hb;
+   }
+
+   /* was it followed by a service name? */
+   if (*sep == '\0' && port != 0) {
if (port < 1 || port > 65535) {
errno = EINVAL;
-   fetch_syserr();
-   return (NULL);
-   }
-   if (snprintf(sbuf, sizeof(sbuf), "%d", port) < 0) {
-   fetch_syserr();
-   return (NULL);
+   goto syserr;
}
-   host = addr;
+   if (snprintf(sbuf, sizeof(sbuf), "%d", port) < 0)
+   goto syserr;
service = sbuf;
+   } else if (*sep != '\0') {
+   service = sep;
} else {
-   host = addr;
service = NULL;
}
 
@@ -292,6 +306,9 @@ fetch_resolve(const char *addr, int port
return (NULL);
}
return (res);
+syserr:
+   fetch_syserr();
+   return (NULL);
 }
 
 
@@ -371,7 +388,7 @@ fetch_connect(const char *host, int port
}
if (err != 0) {
if (verbose)
-   fetch_info("failed to connect to %s:%s", host, port);
+   fetch_info("failed to connect to %s:%d", host, port);
goto syserr;
}
 
@@ -1339,16 +1356,11 @@ fetch_read_word(FILE *f)
return (word);
 }
 
-/*
- * Get authentication data for a URL from .netrc
- */
-int
-fetch_netrc_auth(struct url *url)
+static int
+fetch_netrc_open(void)
 {
+   const char *p;
char fn[PATH_MAX];
-   const char *word;
-   char *p;
-   FILE *f;
 
if ((p = getenv("NETRC")) != NULL) {
if (snprintf(fn, sizeof(fn), "%s", p) >= (int)sizeof(fn)) {
@@ -1368,8 +1380,25 @@ fetch_netrc_auth(struct url *url)
return (-1);
}
 
-   if ((f = fopen(fn, "r")) == NULL)
+   return (open(fn, O_RDONLY));
+}
+
+/*
+ * Get authentication data for a URL from .netrc
+ */
+int
+fetch_netrc_auth(struct url *url)
+{
+   const char *word;
+   FILE *f;
+
+   if (url->netrcfd == -2)
+   url->netrcfd = fetch_netrc_open();
+   if (url->netrcfd < 0)
+   return 

svn commit: r315905 - head/sys/dev/e1000

2017-03-24 Thread Sean Bruno
Author: sbruno
Date: Fri Mar 24 14:27:29 2017
New Revision: 315905
URL: https://svnweb.freebsd.org/changeset/base/315905

Log:
  Add missing 'else' to conditional.  This doesn't really affect the code
  flow or configuration in any way.

Modified:
  head/sys/dev/e1000/if_em.c

Modified: head/sys/dev/e1000/if_em.c
==
--- head/sys/dev/e1000/if_em.c  Fri Mar 24 14:26:01 2017(r315904)
+++ head/sys/dev/e1000/if_em.c  Fri Mar 24 14:27:29 2017(r315905)
@@ -3231,7 +3231,7 @@ em_if_enable_intr(if_ctx_t ctx)
if (hw->mac.type == e1000_82574) {
E1000_WRITE_REG(hw, EM_EIAC, EM_MSIX_MASK);
ims_mask |= adapter->ims;
-   } if (adapter->intr_type == IFLIB_INTR_MSIX && hw->mac.type >= 
igb_mac_min)  {
+   } else if (adapter->intr_type == IFLIB_INTR_MSIX && hw->mac.type >= 
igb_mac_min)  {
u32 mask = (adapter->que_mask | adapter->link_mask);
 
E1000_WRITE_REG(>hw, E1000_EIAC, mask);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315903 - head/sys/dev/e1000

2017-03-24 Thread Sean Bruno
Author: sbruno
Date: Fri Mar 24 14:25:56 2017
New Revision: 315903
URL: https://svnweb.freebsd.org/changeset/base/315903

Log:
  Add missing 'else' to 3-state conditional during setup of interrupts.
  
  We don't want to overwrite the 82574 interrupt setup with a different
  configuration.
  
  PR:   218041
  Submitted by: razmys...@viva64.com

Modified:
  head/sys/dev/e1000/if_em.c

Modified: head/sys/dev/e1000/if_em.c
==
--- head/sys/dev/e1000/if_em.c  Fri Mar 24 14:19:52 2017(r315902)
+++ head/sys/dev/e1000/if_em.c  Fri Mar 24 14:25:56 2017(r315903)
@@ -1941,10 +1941,11 @@ em_if_msix_intr_assign(if_ctx_t ctx, int
tx_que->eims = 1 << (22 + i);
adapter->ims |= tx_que->eims;
adapter->ivars |= (8 | tx_que->msix) << (8 + (i * 4));
-   } if (adapter->hw.mac.type == e1000_82575)
+   } else if (adapter->hw.mac.type == e1000_82575) {
tx_que->eims = E1000_EICR_TX_QUEUE0 << (i %  
adapter->tx_num_queues);
-   else
+   } else {
tx_que->eims = 1 << (i %  adapter->tx_num_queues);
+   }
}
 
/* Link interrupt */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315902 - stable/11/lib/libfetch

2017-03-24 Thread Dag-Erling Smørgrav
Author: des
Date: Fri Mar 24 14:19:52 2017
New Revision: 315902
URL: https://svnweb.freebsd.org/changeset/base/315902

Log:
  MFH (r313974,r314596): open .netrc early in case we want to drop privs
  MFH (r314396,r315143): fix a crash caused by an incorrect format string
  MFH (r314701): fix handling of 416 errors when requesting a range
  MFH (r315455): fix parsing of IP literals (square brackets)
  
  PR:   212065, 217723

Modified:
  stable/11/lib/libfetch/common.c
  stable/11/lib/libfetch/common.h
  stable/11/lib/libfetch/fetch.c
  stable/11/lib/libfetch/fetch.h
  stable/11/lib/libfetch/http.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libfetch/common.c
==
--- stable/11/lib/libfetch/common.c Fri Mar 24 13:46:26 2017
(r315901)
+++ stable/11/lib/libfetch/common.c Fri Mar 24 14:19:52 2017
(r315902)
@@ -153,7 +153,7 @@ fetch_syserr(void)
case EHOSTDOWN:
fetchLastErrCode = FETCH_DOWN;
break;
-default:
+   default:
fetchLastErrCode = FETCH_UNKNOWN;
}
snprintf(fetchLastErrString, MAXERRSTRING, "%s", strerror(errno));
@@ -248,37 +248,51 @@ fetch_resolve(const char *addr, int port
 {
char hbuf[256], sbuf[8];
struct addrinfo hints, *res;
-   const char *sep, *host, *service;
+   const char *hb, *he, *sep;
+   const char *host, *service;
int err, len;
 
-   /* split address if necessary */
-   err = EAI_SYSTEM;
-   if ((sep = strchr(addr, ':')) != NULL) {
+   /* first, check for a bracketed IPv6 address */
+   if (*addr == '[') {
+   hb = addr + 1;
+   if ((sep = strchr(hb, ']')) == NULL) {
+   errno = EINVAL;
+   goto syserr;
+   }
+   he = sep++;
+   } else {
+   hb = addr;
+   sep = strchrnul(hb, ':');
+   he = sep;
+   }
+
+   /* see if we need to copy the host name */
+   if (*he != '\0') {
len = snprintf(hbuf, sizeof(hbuf),
-   "%.*s", (int)(sep - addr), addr);
+   "%.*s", (int)(he - hb), hb);
if (len < 0)
-   return (NULL);
+   goto syserr;
if (len >= (int)sizeof(hbuf)) {
errno = ENAMETOOLONG;
-   fetch_syserr();
-   return (NULL);
+   goto syserr;
}
host = hbuf;
-   service = sep + 1;
-   } else if (port != 0) {
+   } else {
+   host = hb;
+   }
+
+   /* was it followed by a service name? */
+   if (*sep == '\0' && port != 0) {
if (port < 1 || port > 65535) {
errno = EINVAL;
-   fetch_syserr();
-   return (NULL);
-   }
-   if (snprintf(sbuf, sizeof(sbuf), "%d", port) < 0) {
-   fetch_syserr();
-   return (NULL);
+   goto syserr;
}
-   host = addr;
+   if (snprintf(sbuf, sizeof(sbuf), "%d", port) < 0)
+   goto syserr;
service = sbuf;
+   } else if (*sep != '\0') {
+   service = sep;
} else {
-   host = addr;
service = NULL;
}
 
@@ -292,6 +306,9 @@ fetch_resolve(const char *addr, int port
return (NULL);
}
return (res);
+syserr:
+   fetch_syserr();
+   return (NULL);
 }
 
 
@@ -371,7 +388,7 @@ fetch_connect(const char *host, int port
}
if (err != 0) {
if (verbose)
-   fetch_info("failed to connect to %s:%s", host, port);
+   fetch_info("failed to connect to %s:%d", host, port);
goto syserr;
}
 
@@ -1339,16 +1356,11 @@ fetch_read_word(FILE *f)
return (word);
 }
 
-/*
- * Get authentication data for a URL from .netrc
- */
-int
-fetch_netrc_auth(struct url *url)
+static int
+fetch_netrc_open(void)
 {
+   const char *p;
char fn[PATH_MAX];
-   const char *word;
-   char *p;
-   FILE *f;
 
if ((p = getenv("NETRC")) != NULL) {
if (snprintf(fn, sizeof(fn), "%s", p) >= (int)sizeof(fn)) {
@@ -1368,8 +1380,25 @@ fetch_netrc_auth(struct url *url)
return (-1);
}
 
-   if ((f = fopen(fn, "r")) == NULL)
+   return (open(fn, O_RDONLY));
+}
+
+/*
+ * Get authentication data for a URL from .netrc
+ */
+int
+fetch_netrc_auth(struct url *url)
+{
+   const char *word;
+   FILE *f;
+
+   if (url->netrcfd == -2)
+   url->netrcfd = fetch_netrc_open();
+   if (url->netrcfd < 0)
+   return 

svn commit: r315901 - head/sbin/devd

2017-03-24 Thread Warner Losh
Author: imp
Date: Fri Mar 24 13:46:26 2017
New Revision: 315901
URL: https://svnweb.freebsd.org/changeset/base/315901

Log:
  Use a more stream-lined version of fix_value.
  
  Submitted by: ian@

Modified:
  head/sbin/devd/devd.cc
  head/sbin/devd/devd.hh

Modified: head/sbin/devd/devd.cc
==
--- head/sbin/devd/devd.cc  Fri Mar 24 11:46:49 2017(r315900)
+++ head/sbin/devd/devd.cc  Fri Mar 24 13:46:26 2017(r315901)
@@ -417,24 +417,16 @@ var_list::is_set(const string ) cons
  * converted to ". For all other characters, both \ and following
  * character. So the string 'fre\:\"' is translated to 'fred\:"'.
  */
-const std::string &
+std::string
 var_list::fix_value(const std::string ) const
 {
-   char *tmp, *dst;
-   const char *src;
-   std::string *rv;
-
-   dst = tmp = new char[val.length()];
-   src = val.c_str();
-   while (*src) {
-   if (*src == '\\' && src[1] == '"')
-   src++;
-   else
-   *dst++ = *src++;
-   }
-   rv = new string(tmp);
-   delete tmp;
-   return *rv;
+std::string rv(val);
+std::string::size_type pos(0);
+
+while ((pos = rv.find("\\\"", pos)) != rv.npos) {
+rv.erase(pos, 1);
+}
+return (rv);
 }
 
 void

Modified: head/sbin/devd/devd.hh
==
--- head/sbin/devd/devd.hh  Fri Mar 24 11:46:49 2017(r315900)
+++ head/sbin/devd/devd.hh  Fri Mar 24 13:46:26 2017(r315901)
@@ -57,7 +57,7 @@ public:
static const std::string nothing;
 
 private:
-   const std::string _value(const std::string ) const;
+   std::string fix_value(const std::string ) const;
 
std::map _vars;
 };
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315900 - in head: lib/libthread_db/arch/arm sys/arm/arm sys/arm/include

2017-03-24 Thread Michal Meloun
Author: mmel
Date: Fri Mar 24 11:46:49 2017
New Revision: 315900
URL: https://svnweb.freebsd.org/changeset/base/315900

Log:
  Cleanup structures related to VFP and/or mcontext_t.
  - in mcontext_t, rename newer used 'union __vfp' to equaly sized 'mc_spare'.
Space allocated by 'union __vfp' is too small and cannot hold full
VFP context.
  - move structures defined in fp.h to more appropriate headers.
  - remove all unused VFP structures.
  
  MFC after:2 weeks

Deleted:
  head/sys/arm/include/fp.h
Modified:
  head/lib/libthread_db/arch/arm/libpthread_md.c
  head/sys/arm/arm/vfp.c
  head/sys/arm/include/pcb.h
  head/sys/arm/include/reg.h
  head/sys/arm/include/ucontext.h
  head/sys/arm/include/vfp.h

Modified: head/lib/libthread_db/arch/arm/libpthread_md.c
==
--- head/lib/libthread_db/arch/arm/libpthread_md.c  Fri Mar 24 10:27:05 
2017(r315899)
+++ head/lib/libthread_db/arch/arm/libpthread_md.c  Fri Mar 24 11:46:49 
2017(r315900)
@@ -90,7 +90,7 @@ pt_fpreg_to_ucontext(const struct fpreg 
mcontext_t *mc = >uc_mcontext;
 
/* XXX */
-   memset(>__fpu, 0, sizeof(mc->__fpu));
+   memset(>mc_spare, 0, sizeof(mc->mc_spare));
 }
 
 void

Modified: head/sys/arm/arm/vfp.c
==
--- head/sys/arm/arm/vfp.c  Fri Mar 24 10:27:05 2017(r315899)
+++ head/sys/arm/arm/vfp.c  Fri Mar 24 11:46:49 2017(r315900)
@@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Modified: head/sys/arm/include/pcb.h
==
--- head/sys/arm/include/pcb.h  Fri Mar 24 10:27:05 2017(r315899)
+++ head/sys/arm/include/pcb.h  Fri Mar 24 11:46:49 2017(r315900)
@@ -38,8 +38,8 @@
 #ifndef_MACHINE_PCB_H_
 #define_MACHINE_PCB_H_
 
-#include 
 #include 
+#include 
 
 
 /*

Modified: head/sys/arm/include/reg.h
==
--- head/sys/arm/include/reg.h  Fri Mar 24 10:27:05 2017(r315899)
+++ head/sys/arm/include/reg.h  Fri Mar 24 11:46:49 2017(r315900)
@@ -3,8 +3,6 @@
 #ifndef MACHINE_REG_H
 #define MACHINE_REG_H
 
-#include 
-
 struct reg {
unsigned int r[13];
unsigned int r_sp;
@@ -13,6 +11,14 @@ struct reg {
unsigned int r_cpsr;
 };
 
+struct fp_extended_precision {
+   u_int32_t fp_exponent;
+   u_int32_t fp_mantissa_hi;
+   u_int32_t fp_mantissa_lo;
+};
+
+typedef struct fp_extended_precision fp_reg_t;
+
 struct fpreg {
unsigned int fpr_fpsr;
fp_reg_t fpr[8];

Modified: head/sys/arm/include/ucontext.h
==
--- head/sys/arm/include/ucontext.h Fri Mar 24 10:27:05 2017
(r315899)
+++ head/sys/arm/include/ucontext.h Fri Mar 24 11:46:49 2017
(r315900)
@@ -63,38 +63,14 @@ typedef __greg_t__gregset_t[_NGREG];
 #define _REG_LR_REG_R14
 #define _REG_PC_REG_R15
 
-/*
- * Floating point register state
- */
-/* Note: the storage layout of this structure must be identical to ARMFPE! */
-typedef struct {
-   unsigned int__fp_fpsr;
-   struct {
-   unsigned int__fp_exponent;
-   unsigned int__fp_mantissa_hi;
-   unsigned int__fp_mantissa_lo;
-   }   __fp_fr[8];
-} __fpregset_t;
-
-typedef struct {
-   unsigned int__vfp_fpscr;
-   unsigned int__vfp_fstmx[33];
-   unsigned int__vfp_fpsid;
-} __vfpregset_t;
-
 typedef struct {
__gregset_t __gregs;
-   union {
-   __fpregset_t __fpregs;
-   __vfpregset_t __vfpregs;
-   } __fpu;
-} mcontext_t;
-
-/* Machine-dependent uc_flags */
-#define_UC_ARM_VFP 0x0001  /* FPU field is VFP */
 
-/* used by signal delivery to indicate status of signal stack */
-#define _UC_SETSTACK   0x0002
-#define _UC_CLRSTACK   0x0004
+   /*
+* Originally, rest of this structure was named __fpu, 35 * 4 bytes
+* long, never accessed from kernel. 
+*/
+   unsigned intmc_spare[35];
+} mcontext_t;
 
 #endif /* !_MACHINE_MCONTEXT_H_ */

Modified: head/sys/arm/include/vfp.h
==
--- head/sys/arm/include/vfp.h  Fri Mar 24 10:27:05 2017(r315899)
+++ head/sys/arm/include/vfp.h  Fri Mar 24 11:46:49 2017(r315900)
@@ -133,9 +133,19 @@
 #define COPROC11   (0x3 << 22)
 
 #ifndef LOCORE
+struct vfp_state {
+   uint64_t reg[32];
+   uint32_t fpscr;
+   uint32_t fpexec;
+   uint32_t fpinst;
+   uint32_t fpinst2;
+};
+
+#ifdef _KERNEL
 voidvfp_init(void);
 voidvfp_store(struct vfp_state *, 

svn commit: r315896 - in head: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzpool/common sys/cddl/compat/opensolaris/kern sys/cddl/compat/open...

2017-03-24 Thread Alexander Motin
Author: mav
Date: Fri Mar 24 09:37:00 2017
New Revision: 315896
URL: https://svnweb.freebsd.org/changeset/base/315896

Log:
  MFV r315290, r315291: 7303 dynamic metaslab selection
  
  illumos/illumos-gate@8363e80ae72609660f6090766ca8c2c18aa53f0c
  
https://github.com/illumos/illumos-gate/commit/8363e80ae72609660f6090766ca8c2c18
  
  https://www.illumos.org/issues/7303
  
This change introduces a new weighting algorithm to improve metaslab 
selection.
The new weighting algorithm relies on the SPACEMAP_HISTOGRAM feature. As a 
result,
the metaslab weight now encodes the type of weighting algorithm used
(size-based vs segment-based).
  
This also introduce a new allocation tracing facility and two new dcmds to 
help
debug allocation problems. Each zio now contains a zio_alloc_list_t 
structure
that is populated as the zio goes through the allocations stage. Here's an
example of how to use the tracing facility:
  
  > c5ec000::print zio_t io_alloc_list | ::walk list | ::metaslab_trace
MSIDDVAASIZE  WEIGHT RESULT   VDEV
   -  0  400   0NOT_ALLOCATABLE   ztest.0a
   -  0  400   0NOT_ALLOCATABLE   ztest.0a
   -  0  400   0 ENOSPC   ztest.0a
   -  0  200   0NOT_ALLOCATABLE   ztest.0a
   -  0  200   0NOT_ALLOCATABLE   ztest.0a
   -  0  200   0 ENOSPC   ztest.0a
   1  0  400  1 x 8M17b1a00   ztest.0a
  
  > 1ff2400::print zio_t io_alloc_list | ::walk list | ::metaslab_trace
MSIDDVAASIZE  WEIGHT RESULT   VDEV
   -  0  200   0NOT_ALLOCATABLE   mirror-2
   -  0  200   0NOT_ALLOCATABLE   mirror-0
   1  0  200  1 x 4M112ae00   mirror-1
   -  1  200   0NOT_ALLOCATABLE   mirror-2
   -  1  200   0NOT_ALLOCATABLE   mirror-0
   1  1  200  1 x 4M112b000   mirror-1
   -  2  200   0NOT_ALLOCATABLE   mirror-2
  
If the metaslab is using segment-based weighting then the WEIGHT column will
display the number of segments available in the bucket where the allocation
attempt was made.
  
  Author: George Wilson 
  Reviewed by: Alex Reece 
  Reviewed by: Chris Siden 
  Reviewed by: Dan Kimmel 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Paul Dagnelie 
  Reviewed by: Pavel Zakharov 
  Reviewed by: Prakash Surya 
  Reviewed by: Don Brady 
  Approved by: Richard Lowe 

Modified:
  head/cddl/contrib/opensolaris/cmd/zdb/zdb.c
  head/cddl/contrib/opensolaris/cmd/ztest/ztest.c
  head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c
  head/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c
  head/sys/cddl/compat/opensolaris/sys/kstat.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_debug.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/cmd/zdb/   (props changed)
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c
==
--- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Fri Mar 24 08:06:00 2017
(r315895)
+++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Fri Mar 24 09:37:00 2017
(r315896)
@@ -2589,10 +2589,21 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb)
 
if (!dump_opt['L']) {
vdev_t *rvd = spa->spa_root_vdev;
+
+   /*
+* We are going to be changing the meaning of the metaslab's
+* ms_tree.  Ensure that the allocator doesn't try to
+* use the tree.
+*/
+   spa->spa_normal_class->mc_ops = _metaslab_ops;
+   spa->spa_log_class->mc_ops = _metaslab_ops;
+
for (uint64_t c = 0; c < rvd->vdev_children; c++) {
vdev_t *vd = 

svn commit: r315895 - stable/11/sys/sys

2017-03-24 Thread Mateusz Guzik
Author: mjg
Date: Fri Mar 24 08:06:00 2017
New Revision: 315895
URL: https://svnweb.freebsd.org/changeset/base/315895

Log:
  MFC r305383:
  
  fd: fix up fdeget_file
  
  It was supposed to return NULL if a fp is not installed.

Modified:
  stable/11/sys/sys/filedesc.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/sys/filedesc.h
==
--- stable/11/sys/sys/filedesc.hFri Mar 24 07:22:32 2017
(r315894)
+++ stable/11/sys/sys/filedesc.hFri Mar 24 08:06:00 2017
(r315895)
@@ -215,13 +215,18 @@ fget_locked(struct filedesc *fdp, int fd
 static __inline struct filedescent *
 fdeget_locked(struct filedesc *fdp, int fd)
 {
+   struct filedescent *fde;
 
FILEDESC_LOCK_ASSERT(fdp);
 
if ((u_int)fd > fdp->fd_lastfile)
return (NULL);
 
-   return (>fd_ofiles[fd]);
+   fde = >fd_ofiles[fd];
+   if (fde->fde_file == NULL)
+   return (NULL);
+
+   return (fde);
 }
 
 static __inline bool
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r315850 - head/sys/boot/forth

2017-03-24 Thread Dag-Erling Smørgrav
Conrad Meyer  writes:
> Yep.  In this context an 'em' dash should be used instead of an 'en'
> dash.  Theoretically, there also should not be spaces around the
> dashes.  I'm not sure that's easy to do in manual pages, though.

The Chicago Manual of Style agrees with you.  The Oxford Style Manual
agrees with me.  I actually prefer the former style, but don't trust
software to break lines correctly.  It's easy enough to do, though:

Index: sys/boot/forth/beastie.4th.8
===
--- sys/boot/forth/beastie.4th.8(revision 315894)
+++ sys/boot/forth/beastie.4th.8(working copy)
@@ -33,10 +33,10 @@
 .Sh DESCRIPTION
 The file that goes by the name of
 .Nm
-is a set of commands designed to draw the ASCII art FreeBSD mascot
-\(en known simply as
-.Em beastie
-\(en to the right of the boot loader menu.
+is a set of commands designed to draw the ASCII art FreeBSD
+mascot\(emknown simply as
+.Em beastie Ns
+\(emto the right of the boot loader menu.
 The commands of
 .Nm
 by themselves are not enough for most uses.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Re: svn commit: r315773 - head/sbin/devd

2017-03-24 Thread Cy Schubert
In message <201703240340.v2o3eekh002...@slippy.cwsent.com>, Cy Schubert 
writes:
> In message <1490297671.58015.102.ca...@freebsd.org>, Ian Lepore writes:
> > On Thu, 2017-03-23 at 19:58 +0100, Roman Divacky wrote:
> > > On Thu, Mar 23, 2017 at 02:36:51AM +, Warner Losh wrote:
> > > > 
> > > > Author: imp
> > > > Date: Thu Mar 23 02:36:51 2017
> > > > New Revision: 315773
> > > > URL: https://svnweb.freebsd.org/changeset/base/315773
> > > > 
> > > > Log:
> > > >   Implement quote escaping. String values may now contain " if you
> > > >   it is preceded by \.
> > > >   
> > > >   foo="I \"like\" C++"
> > > >   
> > > >   gives the value 'I "like" C++' to the variable 'foo'. If a
> > > > character
> > > >   other than " follows the \, both the \ and that character are
> > > > passed
> > > >   through.
> > > >   
> > > >   Differential Revision: https://reviews.freebsd.org/D6286
> > > >   Sponsored by: Netflix
> > > > 
> > > > Modified:
> > > >   head/sbin/devd/devd.cc
> > > >   head/sbin/devd/devd.hh
> > > > 
> > > > Modified: head/sbin/devd/devd.cc
> > > > ===
> > > > ===
> > > > --- head/sbin/devd/devd.cc  Thu Mar 23 02:33:27 2017(
> > > > r315772)
> > > > +++ head/sbin/devd/devd.cc  Thu Mar 23 02:36:51 2017(
> > > > r315773)
> > > > @@ -411,6 +411,32 @@ var_list::is_set(const string ) cons
> > > >    return (_vars.find(var) != _vars.end());
> > > >  }
> > > >  
> > > > +/** fix_value
> > > > + *
> > > > + * Removes quoted characters that have made it this far. \" are
> > > > + * converted to ". For all other characters, both \ and following
> > > > + * character. So the string 'fre\:\"' is translated to 'fred\:"'.
> > > > + */
> > > > +const std::string &
> > > > +var_list::fix_value(const std::string ) const
> > > > +{
> > > > +   char *tmp, *dst;
> > > > +   const char *src;
> > > > +   std::string *rv;
> > > > +
> > > > +   dst = tmp = new char[val.length()];
> > > > +   src = val.c_str();
> > > > +   while (*src) {
> > > > +   if (*src == '\\' && src[1] == '"')
> > > > +   src++;
> > > > +   else
> > > > +   *dst++ = *src++;
> > > > +   }
> > > > +   rv = new string(tmp);
> > > > +   delete tmp;
> > > > +   return *rv;
> > > > +}
> > > Can the temporary char[] be stack allocated? Also, when returning a
> > > reference to
> > > a heap allocated string who is responsible for freeing it? Perhaps
> > > you can just
> > > return std::string and let the compiler optimize it?
> > > 
> > > Roman
> > > 
> > 
> > Returning a reference to a new'd string is not good.
> > 
> > IMO, the implementation of the function should take into account the
> > idea that embedded escaped quotes are rare.  The function should be
> > optimized for readability and the common case of simply copying the
> > string unmodified, something like:
> > 
> > 
> > std::string
> > var_list::fix_value(const std::string ) const
> > {
> > std::string rv(val);
> > std::string::size_type pos(0);
> > 
> > while ((pos = rv.find("\\\"", pos)) != rv.npos) {
> > rv.erase(pos, 1);
> > }
> > return (rv);
> > }
> 
> This revision caused devd a little gas. It failed to start moused for usb 
> attached mice (ums0 & ums1) to my latpop and nut failed to recognize my USB 
> connected UPS on a server.  downstairs due to a permission issue which nut 
> provides a devd.conf file with:
> 
>   chgrp uucp /dev/$cdev; chmod g+rw /dev/$cdev

Hi Ian,

Your example above fixes the problem.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX:     Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315894 - stable/10/sys/kern

2017-03-24 Thread Konstantin Belousov
Author: kib
Date: Fri Mar 24 07:22:32 2017
New Revision: 315894
URL: https://svnweb.freebsd.org/changeset/base/315894

Log:
  MFC r315453:
  When clearing altsigstack settings on exec, do it to the right thread.

Modified:
  stable/10/sys/kern/kern_sig.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/kern_sig.c
==
--- stable/10/sys/kern/kern_sig.c   Fri Mar 24 07:14:46 2017
(r315893)
+++ stable/10/sys/kern/kern_sig.c   Fri Mar 24 07:22:32 2017
(r315894)
@@ -964,7 +964,6 @@ execsigs(struct proc *p)
 * and are now ignored by default).
 */
PROC_LOCK_ASSERT(p, MA_OWNED);
-   td = FIRST_THREAD_IN_PROC(p);
ps = p->p_sigacts;
mtx_lock(>ps_mtx);
while (SIGNOTEMPTY(ps->ps_sigcatch)) {
@@ -977,6 +976,8 @@ execsigs(struct proc *p)
 * Reset stack state to the user stack.
 * Clear set of signals caught on the signal stack.
 */
+   td = curthread;
+   MPASS(td->td_proc == p);
td->td_sigstk.ss_flags = SS_DISABLE;
td->td_sigstk.ss_size = 0;
td->td_sigstk.ss_sp = 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315893 - stable/11/sys/kern

2017-03-24 Thread Konstantin Belousov
Author: kib
Date: Fri Mar 24 07:14:46 2017
New Revision: 315893
URL: https://svnweb.freebsd.org/changeset/base/315893

Log:
  MFC r315453:
  When clearing altsigstack settings on exec, do it to the right thread.

Modified:
  stable/11/sys/kern/kern_sig.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/kern_sig.c
==
--- stable/11/sys/kern/kern_sig.c   Fri Mar 24 07:09:33 2017
(r315892)
+++ stable/11/sys/kern/kern_sig.c   Fri Mar 24 07:14:46 2017
(r315893)
@@ -963,7 +963,6 @@ execsigs(struct proc *p)
 * and are now ignored by default).
 */
PROC_LOCK_ASSERT(p, MA_OWNED);
-   td = FIRST_THREAD_IN_PROC(p);
ps = p->p_sigacts;
mtx_lock(>ps_mtx);
while (SIGNOTEMPTY(ps->ps_sigcatch)) {
@@ -994,6 +993,8 @@ execsigs(struct proc *p)
 * Reset stack state to the user stack.
 * Clear set of signals caught on the signal stack.
 */
+   td = curthread;
+   MPASS(td->td_proc == p);
td->td_sigstk.ss_flags = SS_DISABLE;
td->td_sigstk.ss_size = 0;
td->td_sigstk.ss_sp = 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315892 - head/sys/compat/cloudabi

2017-03-24 Thread Ed Schouten
Author: ed
Date: Fri Mar 24 07:09:33 2017
New Revision: 315892
URL: https://svnweb.freebsd.org/changeset/base/315892

Log:
  Include  to obtain the memcpy() prototype.
  
  I got a report of this source file not building on Raspberry Pi. It's
  interesting that this only fails for that target and not for others.
  Again, that's no reason not to include the right headers.
  
  PR:   217969
  Reported by:  Johannes Jost Meixner
  MFC after:1 week

Modified:
  head/sys/compat/cloudabi/cloudabi_clock.c

Modified: head/sys/compat/cloudabi/cloudabi_clock.c
==
--- head/sys/compat/cloudabi/cloudabi_clock.c   Fri Mar 24 07:03:26 2017
(r315891)
+++ head/sys/compat/cloudabi/cloudabi_clock.c   Fri Mar 24 07:09:33 2017
(r315892)
@@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315891 - stable/10/sys/cam/ctl

2017-03-24 Thread Alexander Motin
Author: mav
Date: Fri Mar 24 07:03:26 2017
New Revision: 315891
URL: https://svnweb.freebsd.org/changeset/base/315891

Log:
  MFC r315022: Request change of SIM target role only when it is different.
  
  Separate WWNs change into separate request to know what actually failed.

Modified:
  stable/10/sys/cam/ctl/scsi_ctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/scsi_ctl.c
==
--- stable/10/sys/cam/ctl/scsi_ctl.cFri Mar 24 07:02:51 2017
(r315890)
+++ stable/10/sys/cam/ctl/scsi_ctl.cFri Mar 24 07:03:26 2017
(r315891)
@@ -1502,18 +1502,14 @@ out:
 static void
 ctlfe_onoffline(void *arg, int online)
 {
-   struct ctlfe_softc *bus_softc;
+   struct ctlfe_softc *bus_softc = arg;
union ccb *ccb;
cam_status status;
struct cam_path *path;
-   int set_wwnn;
-
-   bus_softc = (struct ctlfe_softc *)arg;
-
-   set_wwnn = 0;
+   int set_wwnn = 0;
 
status = xpt_create_path(, /*periph*/ NULL, bus_softc->path_id,
-   CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD);
+   CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD);
if (status != CAM_REQ_CMP) {
printf("%s: unable to create path!\n", __func__);
return;
@@ -1523,21 +1519,9 @@ ctlfe_onoffline(void *arg, int online)
ccb->ccb_h.func_code = XPT_GET_SIM_KNOB;
xpt_action(ccb);
 
-   /*
-* Copan WWN format:
-*
-* Bits 63-60:  0x5 NAA, IEEE registered name
-* Bits 59-36:  0x000ED5IEEE Company name assigned to Copan
-* Bits 35-12:  Copan SSN (Sequential Serial Number)
-* Bits 11-8:   Type of port:
-*  1 == N-Port
-*  2 == F-Port
-*  3 == NL-Port
-* Bits 7-0:0 == Node Name, >0 == Port Number
-*/
+   /* Check whether we should change WWNs. */
if (online != 0) {
if ((ccb->knob.xport_specific.valid & KNOB_VALID_ADDRESS) != 0){
-
printf("%s: %s current WWNN %#jx\n", __func__,
   bus_softc->port_name,
   ccb->knob.xport_specific.fc.wwnn);
@@ -1570,43 +1554,59 @@ ctlfe_onoffline(void *arg, int online)
false, 0,
true, ccb->knob.xport_specific.fc.wwpn);
}
-
-
-   if (set_wwnn != 0) {
-   printf("%s: %s new WWNN %#jx\n", __func__,
-  bus_softc->port_name,
-   ccb->knob.xport_specific.fc.wwnn);
-   printf("%s: %s new WWPN %#jx\n", __func__,
-  bus_softc->port_name,
-  ccb->knob.xport_specific.fc.wwpn);
-   }
} else {
printf("%s: %s has no valid WWNN/WWPN\n", __func__,
   bus_softc->port_name);
+   if (bus_softc->port.wwnn != 0) {
+   ccb->knob.xport_specific.fc.wwnn =
+   bus_softc->port.wwnn;
+   set_wwnn = 1;
+   }
+   if (bus_softc->port.wwpn != 0) {
+   ccb->knob.xport_specific.fc.wwpn =
+   bus_softc->port.wwpn;
+   set_wwnn = 1;
+   }
+   }
+   }
+   if (set_wwnn) {
+   ccb->ccb_h.func_code = XPT_SET_SIM_KNOB;
+   ccb->knob.xport_specific.valid = KNOB_VALID_ADDRESS;
+   xpt_action(ccb);
+   if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
+   printf("%s: %s (path id %d) failed set WWNs: %#x\n",
+   __func__, bus_softc->port_name, bus_softc->path_id,
+   ccb->ccb_h.status);
+   } else {
+   printf("%s: %s new WWNN %#jx\n", __func__,
+  bus_softc->port_name,
+  ccb->knob.xport_specific.fc.wwnn);
+   printf("%s: %s new WWPN %#jx\n", __func__,
+  bus_softc->port_name,
+  ccb->knob.xport_specific.fc.wwpn);
}
}
-   ccb->ccb_h.func_code = XPT_SET_SIM_KNOB;
-   ccb->knob.xport_specific.valid = KNOB_VALID_ROLE;
-   if (set_wwnn != 0)
-   ccb->knob.xport_specific.valid |= KNOB_VALID_ADDRESS;
-
-   if (online != 0)
-   ccb->knob.xport_specific.fc.role |= 

svn commit: r315890 - stable/11/sys/cam/ctl

2017-03-24 Thread Alexander Motin
Author: mav
Date: Fri Mar 24 07:02:51 2017
New Revision: 315890
URL: https://svnweb.freebsd.org/changeset/base/315890

Log:
  MFC r315022: Request change of SIM target role only when it is different.
  
  Separate WWNs change into separate request to know what actually failed.

Modified:
  stable/11/sys/cam/ctl/scsi_ctl.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/ctl/scsi_ctl.c
==
--- stable/11/sys/cam/ctl/scsi_ctl.cFri Mar 24 07:02:03 2017
(r315889)
+++ stable/11/sys/cam/ctl/scsi_ctl.cFri Mar 24 07:02:51 2017
(r315890)
@@ -1503,18 +1503,14 @@ out:
 static void
 ctlfe_onoffline(void *arg, int online)
 {
-   struct ctlfe_softc *bus_softc;
+   struct ctlfe_softc *bus_softc = arg;
union ccb *ccb;
cam_status status;
struct cam_path *path;
-   int set_wwnn;
-
-   bus_softc = (struct ctlfe_softc *)arg;
-
-   set_wwnn = 0;
+   int set_wwnn = 0;
 
status = xpt_create_path(, /*periph*/ NULL, bus_softc->path_id,
-   CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD);
+   CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD);
if (status != CAM_REQ_CMP) {
printf("%s: unable to create path!\n", __func__);
return;
@@ -1524,21 +1520,9 @@ ctlfe_onoffline(void *arg, int online)
ccb->ccb_h.func_code = XPT_GET_SIM_KNOB;
xpt_action(ccb);
 
-   /*
-* Copan WWN format:
-*
-* Bits 63-60:  0x5 NAA, IEEE registered name
-* Bits 59-36:  0x000ED5IEEE Company name assigned to Copan
-* Bits 35-12:  Copan SSN (Sequential Serial Number)
-* Bits 11-8:   Type of port:
-*  1 == N-Port
-*  2 == F-Port
-*  3 == NL-Port
-* Bits 7-0:0 == Node Name, >0 == Port Number
-*/
+   /* Check whether we should change WWNs. */
if (online != 0) {
if ((ccb->knob.xport_specific.valid & KNOB_VALID_ADDRESS) != 0){
-
printf("%s: %s current WWNN %#jx\n", __func__,
   bus_softc->port_name,
   ccb->knob.xport_specific.fc.wwnn);
@@ -1571,43 +1555,59 @@ ctlfe_onoffline(void *arg, int online)
false, 0,
true, ccb->knob.xport_specific.fc.wwpn);
}
-
-
-   if (set_wwnn != 0) {
-   printf("%s: %s new WWNN %#jx\n", __func__,
-  bus_softc->port_name,
-   ccb->knob.xport_specific.fc.wwnn);
-   printf("%s: %s new WWPN %#jx\n", __func__,
-  bus_softc->port_name,
-  ccb->knob.xport_specific.fc.wwpn);
-   }
} else {
printf("%s: %s has no valid WWNN/WWPN\n", __func__,
   bus_softc->port_name);
+   if (bus_softc->port.wwnn != 0) {
+   ccb->knob.xport_specific.fc.wwnn =
+   bus_softc->port.wwnn;
+   set_wwnn = 1;
+   }
+   if (bus_softc->port.wwpn != 0) {
+   ccb->knob.xport_specific.fc.wwpn =
+   bus_softc->port.wwpn;
+   set_wwnn = 1;
+   }
+   }
+   }
+   if (set_wwnn) {
+   ccb->ccb_h.func_code = XPT_SET_SIM_KNOB;
+   ccb->knob.xport_specific.valid = KNOB_VALID_ADDRESS;
+   xpt_action(ccb);
+   if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
+   printf("%s: %s (path id %d) failed set WWNs: %#x\n",
+   __func__, bus_softc->port_name, bus_softc->path_id,
+   ccb->ccb_h.status);
+   } else {
+   printf("%s: %s new WWNN %#jx\n", __func__,
+  bus_softc->port_name,
+  ccb->knob.xport_specific.fc.wwnn);
+   printf("%s: %s new WWPN %#jx\n", __func__,
+  bus_softc->port_name,
+  ccb->knob.xport_specific.fc.wwpn);
}
}
-   ccb->ccb_h.func_code = XPT_SET_SIM_KNOB;
-   ccb->knob.xport_specific.valid = KNOB_VALID_ROLE;
-   if (set_wwnn != 0)
-   ccb->knob.xport_specific.valid |= KNOB_VALID_ADDRESS;
-
-   if (online != 0)
-   ccb->knob.xport_specific.fc.role |= 

svn commit: r315889 - stable/10/sys/cam/ctl

2017-03-24 Thread Alexander Motin
Author: mav
Date: Fri Mar 24 07:02:03 2017
New Revision: 315889
URL: https://svnweb.freebsd.org/changeset/base/315889

Log:
  MFC r315030: Abort all ATIOs and INOTs queued to SIM on LUN disable.
  
  Some SIMs may not abort them implicitly, that either fail the LUN disable
  request or just make us wait for those CCBs forever.  With this change
  I can successfully disable LUNs on mpt(4).  For isp(4), which aborts them
  implicitly, this change should be irrelevant.

Modified:
  stable/10/sys/cam/ctl/scsi_ctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/scsi_ctl.c
==
--- stable/10/sys/cam/ctl/scsi_ctl.cFri Mar 24 07:01:31 2017
(r315888)
+++ stable/10/sys/cam/ctl/scsi_ctl.cFri Mar 24 07:02:03 2017
(r315889)
@@ -106,6 +106,8 @@ struct ctlfe_lun_softc {
int  inots_alloced; /* Number of INOTs not freed */
struct task refdrain_task;
STAILQ_HEAD(, ccb_hdr) work_queue;
+   LIST_HEAD(, ccb_hdr) atio_list; /* List of ATIOs queued to SIM. */
+   LIST_HEAD(, ccb_hdr) inot_list; /* List of INOTs queued to SIM. */
STAILQ_ENTRY(ctlfe_lun_softc) links;
 };
 
@@ -442,7 +444,7 @@ ctlferegister(struct cam_periph *periph,
 {
struct ctlfe_softc *bus_softc;
struct ctlfe_lun_softc *softc;
-   union ccb en_lun_ccb;
+   union ccb ccb;
cam_status status;
int i;
 
@@ -450,19 +452,21 @@ ctlferegister(struct cam_periph *periph,
bus_softc = softc->parent_softc;

STAILQ_INIT(>work_queue);
+   LIST_INIT(>atio_list);
+   LIST_INIT(>inot_list);
softc->periph = periph;
periph->softc = softc;
 
-   xpt_setup_ccb(_lun_ccb.ccb_h, periph->path, CAM_PRIORITY_NONE);
-   en_lun_ccb.ccb_h.func_code = XPT_EN_LUN;
-   en_lun_ccb.cel.grp6_len = 0;
-   en_lun_ccb.cel.grp7_len = 0;
-   en_lun_ccb.cel.enable = 1;
-   xpt_action(_lun_ccb);
-   status = (en_lun_ccb.ccb_h.status & CAM_STATUS_MASK);
+   xpt_setup_ccb(_h, periph->path, CAM_PRIORITY_NONE);
+   ccb.ccb_h.func_code = XPT_EN_LUN;
+   ccb.cel.grp6_len = 0;
+   ccb.cel.grp7_len = 0;
+   ccb.cel.enable = 1;
+   xpt_action();
+   status = (ccb.ccb_h.status & CAM_STATUS_MASK);
if (status != CAM_REQ_CMP) {
xpt_print(periph->path, "%s: Enable LUN failed, status 0x%x\n", 
- __func__, en_lun_ccb.ccb_h.status);
+ __func__, ccb.ccb_h.status);
return (status);
}
 
@@ -496,6 +500,7 @@ ctlferegister(struct cam_periph *periph,
PRIV_INFO(new_io) = cmd_info;
softc->atios_alloced++;
new_ccb->ccb_h.io_ptr = new_io;
+   LIST_INSERT_HEAD(>atio_list, _ccb->ccb_h, 
periph_links.le);
 
xpt_setup_ccb(_ccb->ccb_h, periph->path, /*priority*/ 1);
new_ccb->ccb_h.func_code = XPT_ACCEPT_TARGET_IO;
@@ -542,6 +547,7 @@ ctlferegister(struct cam_periph *periph,
}
softc->inots_alloced++;
new_ccb->ccb_h.io_ptr = new_io;
+   LIST_INSERT_HEAD(>inot_list, _ccb->ccb_h, 
periph_links.le);
 
xpt_setup_ccb(_ccb->ccb_h, periph->path, /*priority*/ 1);
new_ccb->ccb_h.func_code = XPT_IMMEDIATE_NOTIFY;
@@ -578,23 +584,34 @@ ctlferegister(struct cam_periph *periph,
 static void
 ctlfeoninvalidate(struct cam_periph *periph)
 {
-   union ccb en_lun_ccb;
-   cam_status status;
+   struct ctlfe_lun_softc *softc = (struct ctlfe_lun_softc *)periph->softc;
struct ctlfe_softc *bus_softc;
-   struct ctlfe_lun_softc *softc;
-
-   softc = (struct ctlfe_lun_softc *)periph->softc;
+   union ccb ccb;
+   struct ccb_hdr *hdr;
+   cam_status status;
 
-   xpt_setup_ccb(_lun_ccb.ccb_h, periph->path, CAM_PRIORITY_NONE);
-   en_lun_ccb.ccb_h.func_code = XPT_EN_LUN;
-   en_lun_ccb.cel.grp6_len = 0;
-   en_lun_ccb.cel.grp7_len = 0;
-   en_lun_ccb.cel.enable = 0;
-   xpt_action(_lun_ccb);
-   status = (en_lun_ccb.ccb_h.status & CAM_STATUS_MASK);
+   /* Abort all ATIOs and INOTs queued to SIM. */
+   xpt_setup_ccb(_h, periph->path, CAM_PRIORITY_NONE);
+   ccb.ccb_h.func_code = XPT_ABORT;
+   LIST_FOREACH(hdr, >atio_list, periph_links.le) {
+   ccb.cab.abort_ccb = (union ccb *)hdr;
+   xpt_action();
+   }
+   LIST_FOREACH(hdr, >inot_list, periph_links.le) {
+   ccb.cab.abort_ccb = (union ccb *)hdr;
+   xpt_action();
+   }
+
+   /* Disable the LUN in SIM. */
+   ccb.ccb_h.func_code = XPT_EN_LUN;
+   ccb.cel.grp6_len = 0;
+   ccb.cel.grp7_len = 0;
+   ccb.cel.enable = 0;
+   xpt_action();
+   status = (ccb.ccb_h.status & CAM_STATUS_MASK);
if (status != CAM_REQ_CMP) {
   

svn commit: r315888 - stable/11/sys/cam/ctl

2017-03-24 Thread Alexander Motin
Author: mav
Date: Fri Mar 24 07:01:31 2017
New Revision: 315888
URL: https://svnweb.freebsd.org/changeset/base/315888

Log:
  MFC r315030: Abort all ATIOs and INOTs queued to SIM on LUN disable.
  
  Some SIMs may not abort them implicitly, that either fail the LUN disable
  request or just make us wait for those CCBs forever.  With this change
  I can successfully disable LUNs on mpt(4).  For isp(4), which aborts them
  implicitly, this change should be irrelevant.

Modified:
  stable/11/sys/cam/ctl/scsi_ctl.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/ctl/scsi_ctl.c
==
--- stable/11/sys/cam/ctl/scsi_ctl.cFri Mar 24 07:00:16 2017
(r315887)
+++ stable/11/sys/cam/ctl/scsi_ctl.cFri Mar 24 07:01:31 2017
(r315888)
@@ -106,6 +106,8 @@ struct ctlfe_lun_softc {
int  inots_alloced; /* Number of INOTs not freed */
struct task refdrain_task;
STAILQ_HEAD(, ccb_hdr) work_queue;
+   LIST_HEAD(, ccb_hdr) atio_list; /* List of ATIOs queued to SIM. */
+   LIST_HEAD(, ccb_hdr) inot_list; /* List of INOTs queued to SIM. */
STAILQ_ENTRY(ctlfe_lun_softc) links;
 };
 
@@ -442,7 +444,7 @@ ctlferegister(struct cam_periph *periph,
 {
struct ctlfe_softc *bus_softc;
struct ctlfe_lun_softc *softc;
-   union ccb en_lun_ccb;
+   union ccb ccb;
cam_status status;
int i;
 
@@ -450,19 +452,21 @@ ctlferegister(struct cam_periph *periph,
bus_softc = softc->parent_softc;

STAILQ_INIT(>work_queue);
+   LIST_INIT(>atio_list);
+   LIST_INIT(>inot_list);
softc->periph = periph;
periph->softc = softc;
 
-   xpt_setup_ccb(_lun_ccb.ccb_h, periph->path, CAM_PRIORITY_NONE);
-   en_lun_ccb.ccb_h.func_code = XPT_EN_LUN;
-   en_lun_ccb.cel.grp6_len = 0;
-   en_lun_ccb.cel.grp7_len = 0;
-   en_lun_ccb.cel.enable = 1;
-   xpt_action(_lun_ccb);
-   status = (en_lun_ccb.ccb_h.status & CAM_STATUS_MASK);
+   xpt_setup_ccb(_h, periph->path, CAM_PRIORITY_NONE);
+   ccb.ccb_h.func_code = XPT_EN_LUN;
+   ccb.cel.grp6_len = 0;
+   ccb.cel.grp7_len = 0;
+   ccb.cel.enable = 1;
+   xpt_action();
+   status = (ccb.ccb_h.status & CAM_STATUS_MASK);
if (status != CAM_REQ_CMP) {
xpt_print(periph->path, "%s: Enable LUN failed, status 0x%x\n", 
- __func__, en_lun_ccb.ccb_h.status);
+ __func__, ccb.ccb_h.status);
return (status);
}
 
@@ -496,6 +500,7 @@ ctlferegister(struct cam_periph *periph,
PRIV_INFO(new_io) = cmd_info;
softc->atios_alloced++;
new_ccb->ccb_h.io_ptr = new_io;
+   LIST_INSERT_HEAD(>atio_list, _ccb->ccb_h, 
periph_links.le);
 
xpt_setup_ccb(_ccb->ccb_h, periph->path, /*priority*/ 1);
new_ccb->ccb_h.func_code = XPT_ACCEPT_TARGET_IO;
@@ -542,6 +547,7 @@ ctlferegister(struct cam_periph *periph,
}
softc->inots_alloced++;
new_ccb->ccb_h.io_ptr = new_io;
+   LIST_INSERT_HEAD(>inot_list, _ccb->ccb_h, 
periph_links.le);
 
xpt_setup_ccb(_ccb->ccb_h, periph->path, /*priority*/ 1);
new_ccb->ccb_h.func_code = XPT_IMMEDIATE_NOTIFY;
@@ -578,23 +584,34 @@ ctlferegister(struct cam_periph *periph,
 static void
 ctlfeoninvalidate(struct cam_periph *periph)
 {
-   union ccb en_lun_ccb;
-   cam_status status;
+   struct ctlfe_lun_softc *softc = (struct ctlfe_lun_softc *)periph->softc;
struct ctlfe_softc *bus_softc;
-   struct ctlfe_lun_softc *softc;
-
-   softc = (struct ctlfe_lun_softc *)periph->softc;
+   union ccb ccb;
+   struct ccb_hdr *hdr;
+   cam_status status;
 
-   xpt_setup_ccb(_lun_ccb.ccb_h, periph->path, CAM_PRIORITY_NONE);
-   en_lun_ccb.ccb_h.func_code = XPT_EN_LUN;
-   en_lun_ccb.cel.grp6_len = 0;
-   en_lun_ccb.cel.grp7_len = 0;
-   en_lun_ccb.cel.enable = 0;
-   xpt_action(_lun_ccb);
-   status = (en_lun_ccb.ccb_h.status & CAM_STATUS_MASK);
+   /* Abort all ATIOs and INOTs queued to SIM. */
+   xpt_setup_ccb(_h, periph->path, CAM_PRIORITY_NONE);
+   ccb.ccb_h.func_code = XPT_ABORT;
+   LIST_FOREACH(hdr, >atio_list, periph_links.le) {
+   ccb.cab.abort_ccb = (union ccb *)hdr;
+   xpt_action();
+   }
+   LIST_FOREACH(hdr, >inot_list, periph_links.le) {
+   ccb.cab.abort_ccb = (union ccb *)hdr;
+   xpt_action();
+   }
+
+   /* Disable the LUN in SIM. */
+   ccb.ccb_h.func_code = XPT_EN_LUN;
+   ccb.cel.grp6_len = 0;
+   ccb.cel.grp7_len = 0;
+   ccb.cel.enable = 0;
+   xpt_action();
+   status = (ccb.ccb_h.status & CAM_STATUS_MASK);
if (status != CAM_REQ_CMP) {
   

svn commit: r315887 - stable/10/sys/cam/ctl

2017-03-24 Thread Alexander Motin
Author: mav
Date: Fri Mar 24 07:00:16 2017
New Revision: 315887
URL: https://svnweb.freebsd.org/changeset/base/315887

Log:
  MFC r315025: Switch work_queue from TAILQ to STAILQ.
  
  It is mostly FIFO and we don't need random removal there.

Modified:
  stable/10/sys/cam/ctl/scsi_ctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/scsi_ctl.c
==
--- stable/10/sys/cam/ctl/scsi_ctl.cFri Mar 24 06:59:40 2017
(r315886)
+++ stable/10/sys/cam/ctl/scsi_ctl.cFri Mar 24 07:00:16 2017
(r315887)
@@ -105,7 +105,7 @@ struct ctlfe_lun_softc {
int  atios_alloced; /* Number of ATIOs not freed */
int  inots_alloced; /* Number of INOTs not freed */
struct task refdrain_task;
-   TAILQ_HEAD(, ccb_hdr) work_queue;
+   STAILQ_HEAD(, ccb_hdr) work_queue;
STAILQ_ENTRY(ctlfe_lun_softc) links;
 };
 
@@ -449,7 +449,7 @@ ctlferegister(struct cam_periph *periph,
softc = (struct ctlfe_lun_softc *)arg;
bus_softc = softc->parent_softc;

-   TAILQ_INIT(>work_queue);
+   STAILQ_INIT(>work_queue);
softc->periph = periph;
periph->softc = softc;
 
@@ -738,14 +738,13 @@ ctlfestart(struct cam_periph *periph, un
softc = (struct ctlfe_lun_softc *)periph->softc;
 
 next:
-   ccb_h = TAILQ_FIRST(>work_queue);
+   /* Take the ATIO off the work queue */
+   ccb_h = STAILQ_FIRST(>work_queue);
if (ccb_h == NULL) {
xpt_release_ccb(start_ccb);
return;
}
-
-   /* Take the ATIO off the work queue */
-   TAILQ_REMOVE(>work_queue, ccb_h, periph_links.tqe);
+   STAILQ_REMOVE_HEAD(>work_queue, periph_links.stqe);
atio = (struct ccb_accept_tio *)ccb_h;
io = (union ctl_io *)ccb_h->io_ptr;
csio = _ccb->csio;
@@ -870,7 +869,7 @@ next:
/*
 * If we still have work to do, ask for another CCB.
 */
-   if (!TAILQ_EMPTY(>work_queue))
+   if (!STAILQ_EMPTY(>work_queue))
xpt_schedule(periph, CAM_PRIORITY_NORMAL);
 }
 
@@ -1196,8 +1195,8 @@ ctlfedone(struct cam_periph *periph, uni
io->scsiio.io_hdr.status = CTL_STATUS_NONE;
io->io_hdr.flags |= CTL_FLAG_DMA_QUEUED;
xpt_release_ccb(done_ccb);
-   TAILQ_INSERT_HEAD(>work_queue, >ccb_h,
- periph_links.tqe);
+   STAILQ_INSERT_HEAD(>work_queue, >ccb_h,
+ periph_links.stqe);
xpt_schedule(periph, CAM_PRIORITY_NORMAL);
break;
}
@@ -1811,7 +1810,7 @@ ctlfe_dump_queue(struct ctlfe_lun_softc 
periph = softc->periph;
num_items = 0;
 
-   TAILQ_FOREACH(hdr, >work_queue, periph_links.tqe) {
+   STAILQ_FOREACH(hdr, >work_queue, periph_links.stqe) {
union ctl_io *io = hdr->io_ptr;
 
num_items++;
@@ -1866,8 +1865,8 @@ ctlfe_datamove(union ctl_io *io)
io->io_hdr.flags |= CTL_FLAG_DMA_QUEUED;
if ((io->io_hdr.status & CTL_STATUS_MASK) != CTL_STATUS_NONE)
io->io_hdr.flags |= CTL_FLAG_STATUS_QUEUED;
-   TAILQ_INSERT_TAIL(>work_queue, >ccb_h,
- periph_links.tqe);
+   STAILQ_INSERT_TAIL(>work_queue, >ccb_h,
+ periph_links.stqe);
xpt_schedule(periph, CAM_PRIORITY_NORMAL);
cam_periph_unlock(periph);
 }
@@ -1919,8 +1918,8 @@ ctlfe_done(union ctl_io *io)
return;
} else {
io->io_hdr.flags |= CTL_FLAG_STATUS_QUEUED;
-   TAILQ_INSERT_TAIL(>work_queue, >ccb_h,
- periph_links.tqe);
+   STAILQ_INSERT_TAIL(>work_queue, >ccb_h,
+ periph_links.stqe);
xpt_schedule(periph, CAM_PRIORITY_NORMAL);
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r315886 - stable/11/sys/cam/ctl

2017-03-24 Thread Alexander Motin
Author: mav
Date: Fri Mar 24 06:59:40 2017
New Revision: 315886
URL: https://svnweb.freebsd.org/changeset/base/315886

Log:
  MFC r315025: Switch work_queue from TAILQ to STAILQ.
  
  It is mostly FIFO and we don't need random removal there.

Modified:
  stable/11/sys/cam/ctl/scsi_ctl.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/ctl/scsi_ctl.c
==
--- stable/11/sys/cam/ctl/scsi_ctl.cFri Mar 24 03:37:58 2017
(r315885)
+++ stable/11/sys/cam/ctl/scsi_ctl.cFri Mar 24 06:59:40 2017
(r315886)
@@ -105,7 +105,7 @@ struct ctlfe_lun_softc {
int  atios_alloced; /* Number of ATIOs not freed */
int  inots_alloced; /* Number of INOTs not freed */
struct task refdrain_task;
-   TAILQ_HEAD(, ccb_hdr) work_queue;
+   STAILQ_HEAD(, ccb_hdr) work_queue;
STAILQ_ENTRY(ctlfe_lun_softc) links;
 };
 
@@ -449,7 +449,7 @@ ctlferegister(struct cam_periph *periph,
softc = (struct ctlfe_lun_softc *)arg;
bus_softc = softc->parent_softc;

-   TAILQ_INIT(>work_queue);
+   STAILQ_INIT(>work_queue);
softc->periph = periph;
periph->softc = softc;
 
@@ -738,14 +738,13 @@ ctlfestart(struct cam_periph *periph, un
softc = (struct ctlfe_lun_softc *)periph->softc;
 
 next:
-   ccb_h = TAILQ_FIRST(>work_queue);
+   /* Take the ATIO off the work queue */
+   ccb_h = STAILQ_FIRST(>work_queue);
if (ccb_h == NULL) {
xpt_release_ccb(start_ccb);
return;
}
-
-   /* Take the ATIO off the work queue */
-   TAILQ_REMOVE(>work_queue, ccb_h, periph_links.tqe);
+   STAILQ_REMOVE_HEAD(>work_queue, periph_links.stqe);
atio = (struct ccb_accept_tio *)ccb_h;
io = (union ctl_io *)ccb_h->io_ptr;
csio = _ccb->csio;
@@ -870,7 +869,7 @@ next:
/*
 * If we still have work to do, ask for another CCB.
 */
-   if (!TAILQ_EMPTY(>work_queue))
+   if (!STAILQ_EMPTY(>work_queue))
xpt_schedule(periph, CAM_PRIORITY_NORMAL);
 }
 
@@ -1196,8 +1195,8 @@ ctlfedone(struct cam_periph *periph, uni
io->scsiio.io_hdr.status = CTL_STATUS_NONE;
io->io_hdr.flags |= CTL_FLAG_DMA_QUEUED;
xpt_release_ccb(done_ccb);
-   TAILQ_INSERT_HEAD(>work_queue, >ccb_h,
- periph_links.tqe);
+   STAILQ_INSERT_HEAD(>work_queue, >ccb_h,
+ periph_links.stqe);
xpt_schedule(periph, CAM_PRIORITY_NORMAL);
break;
}
@@ -1812,7 +1811,7 @@ ctlfe_dump_queue(struct ctlfe_lun_softc 
periph = softc->periph;
num_items = 0;
 
-   TAILQ_FOREACH(hdr, >work_queue, periph_links.tqe) {
+   STAILQ_FOREACH(hdr, >work_queue, periph_links.stqe) {
union ctl_io *io = hdr->io_ptr;
 
num_items++;
@@ -1867,8 +1866,8 @@ ctlfe_datamove(union ctl_io *io)
io->io_hdr.flags |= CTL_FLAG_DMA_QUEUED;
if ((io->io_hdr.status & CTL_STATUS_MASK) != CTL_STATUS_NONE)
io->io_hdr.flags |= CTL_FLAG_STATUS_QUEUED;
-   TAILQ_INSERT_TAIL(>work_queue, >ccb_h,
- periph_links.tqe);
+   STAILQ_INSERT_TAIL(>work_queue, >ccb_h,
+ periph_links.stqe);
xpt_schedule(periph, CAM_PRIORITY_NORMAL);
cam_periph_unlock(periph);
 }
@@ -1920,8 +1919,8 @@ ctlfe_done(union ctl_io *io)
return;
} else {
io->io_hdr.flags |= CTL_FLAG_STATUS_QUEUED;
-   TAILQ_INSERT_TAIL(>work_queue, >ccb_h,
- periph_links.tqe);
+   STAILQ_INSERT_TAIL(>work_queue, >ccb_h,
+ periph_links.stqe);
xpt_schedule(periph, CAM_PRIORITY_NORMAL);
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"