svn commit: r307901 - in head/sys/netinet: . cc tcp_stacks

2016-10-24 Thread Hiren Panchasara
Author: hiren
Date: Tue Oct 25 05:45:47 2016
New Revision: 307901
URL: https://svnweb.freebsd.org/changeset/base/307901

Log:
  FreeBSD tcp stack used to inform respective congestion control module about 
the
  loss event but not use or obay the recommendations i.e. values set by it in 
some
  cases.
  
  Here is an attempt to solve that confusion by following relevant RFCs/drafts.
  Stack only sets congestion window/slow start threshold values when there is no
  CC module availalbe to take that action. All CC modules are inspected and
  updated when needed to take appropriate action on loss.
  
  tcp_stacks/fastpath module has been updated to adapt these changes.
  
  Note: Probably, the most significant change would be to not bring congestion
  window down to 1MSS on a loss signaled by 3-duplicate acks and letting
  respective CC decide that value.
  
  In collaboration with:Matt Macy 
  Discussed on: transport@ mailing list
  Reviewed by:  jtl
  MFC after:1 month
  Sponsored by: Limelight Networks
  Differential Revision:https://reviews.freebsd.org/D8225

Modified:
  head/sys/netinet/cc/cc_cdg.c
  head/sys/netinet/cc/cc_chd.c
  head/sys/netinet/cc/cc_cubic.c
  head/sys/netinet/cc/cc_dctcp.c
  head/sys/netinet/cc/cc_htcp.c
  head/sys/netinet/cc/cc_newreno.c
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_stacks/fastpath.c

Modified: head/sys/netinet/cc/cc_cdg.c
==
--- head/sys/netinet/cc/cc_cdg.cTue Oct 25 05:07:51 2016
(r307900)
+++ head/sys/netinet/cc/cc_cdg.cTue Oct 25 05:45:47 2016
(r307901)
@@ -431,6 +431,11 @@ static void
 cdg_cong_signal(struct cc_var *ccv, uint32_t signal_type)
 {
struct cdg *cdg_data = ccv->cc_data;
+   uint32_t cwin;
+   u_int mss;
+
+   cwin = CCV(ccv, snd_cwnd);
+   mss = CCV(ccv, t_maxseg);
 
switch(signal_type) {
case CC_CDG_DELAY:
@@ -448,7 +453,7 @@ cdg_cong_signal(struct cc_var *ccv, uint
 */
if (IN_CONGRECOVERY(CCV(ccv, t_flags)) ||
cdg_data->queue_state < CDG_Q_FULL) {
-   CCV(ccv, snd_ssthresh) = CCV(ccv, snd_cwnd);
+   CCV(ccv, snd_ssthresh) = cwin;
CCV(ccv, snd_recover) = CCV(ccv, snd_max);
} else {
/*
@@ -461,13 +466,17 @@ cdg_cong_signal(struct cc_var *ccv, uint
cdg_data->shadow_w, RENO_BETA);
 
CCV(ccv, snd_ssthresh) = max(cdg_data->shadow_w,
-   cdg_window_decrease(ccv, CCV(ccv, snd_cwnd),
-   V_cdg_beta_loss));
+   cdg_window_decrease(ccv, cwin, V_cdg_beta_loss));
+   CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh);
 
cdg_data->window_incr = cdg_data->rtt_count = 0;
}
ENTER_RECOVERY(CCV(ccv, t_flags));
break;
+   case CC_RTO:
+   CCV(ccv, snd_ssthresh) = max(2*mss, cwin/2);
+   CCV(ccv, snd_cwnd) = mss;
+   break;
default:
newreno_cc_algo.cong_signal(ccv, signal_type);
break;

Modified: head/sys/netinet/cc/cc_chd.c
==
--- head/sys/netinet/cc/cc_chd.cTue Oct 25 05:07:51 2016
(r307900)
+++ head/sys/netinet/cc/cc_chd.cTue Oct 25 05:45:47 2016
(r307901)
@@ -330,10 +330,14 @@ chd_cong_signal(struct cc_var *ccv, uint
struct ertt *e_t;
struct chd *chd_data;
int qdly;
+   uint32_t cwin;
+   u_int mss;
 
e_t = khelp_get_osd(CCV(ccv, osd), ertt_id);
chd_data = ccv->cc_data;
qdly = imax(e_t->rtt, chd_data->maxrtt_in_rtt) - e_t->minrtt;
+   cwin = CCV(ccv, snd_cwnd);
+   mss = CCV(ccv, t_maxseg);
 
switch(signal_type) {
case CC_CHD_DELAY:
@@ -373,6 +377,10 @@ chd_cong_signal(struct cc_var *ccv, uint
}
ENTER_FASTRECOVERY(CCV(ccv, t_flags));
break;
+   case CC_RTO:
+   CCV(ccv, snd_ssthresh) = max(2*mss, cwin/2);
+   CCV(ccv, snd_cwnd) = mss;
+   break;
 
default:
newreno_cc_algo.cong_signal(ccv, signal_type);

Modified: head/sys/netinet/cc/cc_cubic.c
==
--- head/sys/netinet/cc/cc_cubic.c  Tue Oct 25 05:07:51 2016
(r307900)
+++ head/sys/netinet/cc/cc_cubic.c  Tue Oct 25 05:45:47 2016
(r307901)
@@ -225,8 +225,12 @@ static void
 cubic_cong_signal(struct cc_var *ccv, uint32_t type)
 {
struct cubic *cubic_data;
+   uint32_t cwin;
+   u_int mss;
 
cubic_data = ccv->cc_data;
+   cwin = CCV(ccv, snd_cwnd);
+ 

svn commit: r307900 - in head/sys/netinet: . cc

2016-10-24 Thread Hiren Panchasara
Author: hiren
Date: Tue Oct 25 05:07:51 2016
New Revision: 307900
URL: https://svnweb.freebsd.org/changeset/base/307900

Log:
  Undo r307899. It needs a bit more work and proper commit log.

Modified:
  head/sys/netinet/cc/cc_cdg.c
  head/sys/netinet/cc/cc_chd.c
  head/sys/netinet/cc/cc_cubic.c
  head/sys/netinet/cc/cc_dctcp.c
  head/sys/netinet/cc/cc_htcp.c
  head/sys/netinet/cc/cc_newreno.c
  head/sys/netinet/tcp_input.c

Modified: head/sys/netinet/cc/cc_cdg.c
==
--- head/sys/netinet/cc/cc_cdg.cTue Oct 25 05:03:33 2016
(r307899)
+++ head/sys/netinet/cc/cc_cdg.cTue Oct 25 05:07:51 2016
(r307900)
@@ -431,11 +431,6 @@ static void
 cdg_cong_signal(struct cc_var *ccv, uint32_t signal_type)
 {
struct cdg *cdg_data = ccv->cc_data;
-   uint32_t cwin;
-   u_int mss;
-
-   cwin = CCV(ccv, snd_cwnd);
-   mss = CCV(ccv, t_maxseg);
 
switch(signal_type) {
case CC_CDG_DELAY:
@@ -453,7 +448,7 @@ cdg_cong_signal(struct cc_var *ccv, uint
 */
if (IN_CONGRECOVERY(CCV(ccv, t_flags)) ||
cdg_data->queue_state < CDG_Q_FULL) {
-   CCV(ccv, snd_ssthresh) = cwin;
+   CCV(ccv, snd_ssthresh) = CCV(ccv, snd_cwnd);
CCV(ccv, snd_recover) = CCV(ccv, snd_max);
} else {
/*
@@ -466,17 +461,13 @@ cdg_cong_signal(struct cc_var *ccv, uint
cdg_data->shadow_w, RENO_BETA);
 
CCV(ccv, snd_ssthresh) = max(cdg_data->shadow_w,
-   cdg_window_decrease(ccv, cwin, V_cdg_beta_loss));
-   CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh);
+   cdg_window_decrease(ccv, CCV(ccv, snd_cwnd),
+   V_cdg_beta_loss));
 
cdg_data->window_incr = cdg_data->rtt_count = 0;
}
ENTER_RECOVERY(CCV(ccv, t_flags));
break;
-   case CC_RTO:
-   CCV(ccv, snd_ssthresh) = max(2*mss, cwin/2);
-   CCV(ccv, snd_cwnd) = mss;
-   break;
default:
newreno_cc_algo.cong_signal(ccv, signal_type);
break;

Modified: head/sys/netinet/cc/cc_chd.c
==
--- head/sys/netinet/cc/cc_chd.cTue Oct 25 05:03:33 2016
(r307899)
+++ head/sys/netinet/cc/cc_chd.cTue Oct 25 05:07:51 2016
(r307900)
@@ -330,14 +330,10 @@ chd_cong_signal(struct cc_var *ccv, uint
struct ertt *e_t;
struct chd *chd_data;
int qdly;
-   uint32_t cwin;
-   u_int mss;
 
e_t = khelp_get_osd(CCV(ccv, osd), ertt_id);
chd_data = ccv->cc_data;
qdly = imax(e_t->rtt, chd_data->maxrtt_in_rtt) - e_t->minrtt;
-   cwin = CCV(ccv, snd_cwnd);
-   mss = CCV(ccv, t_maxseg);
 
switch(signal_type) {
case CC_CHD_DELAY:
@@ -377,10 +373,6 @@ chd_cong_signal(struct cc_var *ccv, uint
}
ENTER_FASTRECOVERY(CCV(ccv, t_flags));
break;
-   case CC_RTO:
-   CCV(ccv, snd_ssthresh) = max(2*mss, cwin/2);
-   CCV(ccv, snd_cwnd) = mss;
-   break;
 
default:
newreno_cc_algo.cong_signal(ccv, signal_type);

Modified: head/sys/netinet/cc/cc_cubic.c
==
--- head/sys/netinet/cc/cc_cubic.c  Tue Oct 25 05:03:33 2016
(r307899)
+++ head/sys/netinet/cc/cc_cubic.c  Tue Oct 25 05:07:51 2016
(r307900)
@@ -225,12 +225,8 @@ static void
 cubic_cong_signal(struct cc_var *ccv, uint32_t type)
 {
struct cubic *cubic_data;
-   uint32_t cwin;
-   u_int mss;
 
cubic_data = ccv->cc_data;
-   cwin = CCV(ccv, snd_cwnd);
-   mss = CCV(ccv, t_maxseg);
 
switch (type) {
case CC_NDUPACK:
@@ -239,8 +235,7 @@ cubic_cong_signal(struct cc_var *ccv, ui
cubic_ssthresh_update(ccv);
cubic_data->num_cong_events++;
cubic_data->prev_max_cwnd = 
cubic_data->max_cwnd;
-   cubic_data->max_cwnd = cwin;
-   CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh);
+   cubic_data->max_cwnd = CCV(ccv, snd_cwnd);
}
ENTER_RECOVERY(CCV(ccv, t_flags));
}
@@ -251,7 +246,7 @@ cubic_cong_signal(struct cc_var *ccv, ui
cubic_ssthresh_update(ccv);
cubic_data->num_cong_events++;
cubic_data->prev_max_cwnd = cubic_data->max_cwnd;
-   cubic_data->max_cwnd = cwin;
+   

Re: svn commit: r307899 - in head/sys/netinet: . cc

2016-10-24 Thread Hiren Panchasara
Sigh. I'll revert this and do it right.

On 10/25/16 at 05:03P, Hiren Panchasara wrote:
> Author: hiren
> Date: Tue Oct 25 05:03:33 2016
> New Revision: 307899
> URL: https://svnweb.freebsd.org/changeset/base/307899
> 
> Log:
>   In Collaboration with:  Matt Macy 
>   Reviewed by:jtl
>   Sponsored by:   Limelight Networks
>   Differential Revision:  https://reviews.freebsd.org/D8225
> 
> Modified:
>   head/sys/netinet/cc/cc_cdg.c
>   head/sys/netinet/cc/cc_chd.c
>   head/sys/netinet/cc/cc_cubic.c
>   head/sys/netinet/cc/cc_dctcp.c
>   head/sys/netinet/cc/cc_htcp.c
>   head/sys/netinet/cc/cc_newreno.c
>   head/sys/netinet/tcp_input.c
> 
> Modified: head/sys/netinet/cc/cc_cdg.c
> ==
> --- head/sys/netinet/cc/cc_cdg.c  Tue Oct 25 04:14:03 2016
> (r307898)
> +++ head/sys/netinet/cc/cc_cdg.c  Tue Oct 25 05:03:33 2016
> (r307899)
> @@ -431,6 +431,11 @@ static void
>  cdg_cong_signal(struct cc_var *ccv, uint32_t signal_type)
>  {
>   struct cdg *cdg_data = ccv->cc_data;
> + uint32_t cwin;
> + u_int mss;
> +
> + cwin = CCV(ccv, snd_cwnd);
> + mss = CCV(ccv, t_maxseg);
>  
>   switch(signal_type) {
>   case CC_CDG_DELAY:
> @@ -448,7 +453,7 @@ cdg_cong_signal(struct cc_var *ccv, uint
>*/
>   if (IN_CONGRECOVERY(CCV(ccv, t_flags)) ||
>   cdg_data->queue_state < CDG_Q_FULL) {
> - CCV(ccv, snd_ssthresh) = CCV(ccv, snd_cwnd);
> + CCV(ccv, snd_ssthresh) = cwin;
>   CCV(ccv, snd_recover) = CCV(ccv, snd_max);
>   } else {
>   /*
> @@ -461,13 +466,17 @@ cdg_cong_signal(struct cc_var *ccv, uint
>   cdg_data->shadow_w, RENO_BETA);
>  
>   CCV(ccv, snd_ssthresh) = max(cdg_data->shadow_w,
> - cdg_window_decrease(ccv, CCV(ccv, snd_cwnd),
> - V_cdg_beta_loss));
> + cdg_window_decrease(ccv, cwin, V_cdg_beta_loss));
> + CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh);
>  
>   cdg_data->window_incr = cdg_data->rtt_count = 0;
>   }
>   ENTER_RECOVERY(CCV(ccv, t_flags));
>   break;
> + case CC_RTO:
> + CCV(ccv, snd_ssthresh) = max(2*mss, cwin/2);
> + CCV(ccv, snd_cwnd) = mss;
> + break;
>   default:
>   newreno_cc_algo.cong_signal(ccv, signal_type);
>   break;
> 
> Modified: head/sys/netinet/cc/cc_chd.c
> ==
> --- head/sys/netinet/cc/cc_chd.c  Tue Oct 25 04:14:03 2016
> (r307898)
> +++ head/sys/netinet/cc/cc_chd.c  Tue Oct 25 05:03:33 2016
> (r307899)
> @@ -330,10 +330,14 @@ chd_cong_signal(struct cc_var *ccv, uint
>   struct ertt *e_t;
>   struct chd *chd_data;
>   int qdly;
> + uint32_t cwin;
> + u_int mss;
>  
>   e_t = khelp_get_osd(CCV(ccv, osd), ertt_id);
>   chd_data = ccv->cc_data;
>   qdly = imax(e_t->rtt, chd_data->maxrtt_in_rtt) - e_t->minrtt;
> + cwin = CCV(ccv, snd_cwnd);
> + mss = CCV(ccv, t_maxseg);
>  
>   switch(signal_type) {
>   case CC_CHD_DELAY:
> @@ -373,6 +377,10 @@ chd_cong_signal(struct cc_var *ccv, uint
>   }
>   ENTER_FASTRECOVERY(CCV(ccv, t_flags));
>   break;
> + case CC_RTO:
> + CCV(ccv, snd_ssthresh) = max(2*mss, cwin/2);
> + CCV(ccv, snd_cwnd) = mss;
> + break;
>  
>   default:
>   newreno_cc_algo.cong_signal(ccv, signal_type);
> 
> Modified: head/sys/netinet/cc/cc_cubic.c
> ==
> --- head/sys/netinet/cc/cc_cubic.cTue Oct 25 04:14:03 2016
> (r307898)
> +++ head/sys/netinet/cc/cc_cubic.cTue Oct 25 05:03:33 2016
> (r307899)
> @@ -225,8 +225,12 @@ static void
>  cubic_cong_signal(struct cc_var *ccv, uint32_t type)
>  {
>   struct cubic *cubic_data;
> + uint32_t cwin;
> + u_int mss;
>  
>   cubic_data = ccv->cc_data;
> + cwin = CCV(ccv, snd_cwnd);
> + mss = CCV(ccv, t_maxseg);
>  
>   switch (type) {
>   case CC_NDUPACK:
> @@ -235,7 +239,8 @@ cubic_cong_signal(struct cc_var *ccv, ui
>   cubic_ssthresh_update(ccv);
>   cubic_data->num_cong_events++;
>   cubic_data->prev_max_cwnd = 
> cubic_data->max_cwnd;
> - cubic_data->max_cwnd = CCV(ccv, snd_cwnd);
> + cubic_data->max_cwnd = cwin;
> + CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh);
>   }
>   ENTER_RECOVERY(CCV(ccv, 

svn commit: r307899 - in head/sys/netinet: . cc

2016-10-24 Thread Hiren Panchasara
Author: hiren
Date: Tue Oct 25 05:03:33 2016
New Revision: 307899
URL: https://svnweb.freebsd.org/changeset/base/307899

Log:
  In Collaboration with:Matt Macy 
  Reviewed by:  jtl
  Sponsored by: Limelight Networks
  Differential Revision:https://reviews.freebsd.org/D8225

Modified:
  head/sys/netinet/cc/cc_cdg.c
  head/sys/netinet/cc/cc_chd.c
  head/sys/netinet/cc/cc_cubic.c
  head/sys/netinet/cc/cc_dctcp.c
  head/sys/netinet/cc/cc_htcp.c
  head/sys/netinet/cc/cc_newreno.c
  head/sys/netinet/tcp_input.c

Modified: head/sys/netinet/cc/cc_cdg.c
==
--- head/sys/netinet/cc/cc_cdg.cTue Oct 25 04:14:03 2016
(r307898)
+++ head/sys/netinet/cc/cc_cdg.cTue Oct 25 05:03:33 2016
(r307899)
@@ -431,6 +431,11 @@ static void
 cdg_cong_signal(struct cc_var *ccv, uint32_t signal_type)
 {
struct cdg *cdg_data = ccv->cc_data;
+   uint32_t cwin;
+   u_int mss;
+
+   cwin = CCV(ccv, snd_cwnd);
+   mss = CCV(ccv, t_maxseg);
 
switch(signal_type) {
case CC_CDG_DELAY:
@@ -448,7 +453,7 @@ cdg_cong_signal(struct cc_var *ccv, uint
 */
if (IN_CONGRECOVERY(CCV(ccv, t_flags)) ||
cdg_data->queue_state < CDG_Q_FULL) {
-   CCV(ccv, snd_ssthresh) = CCV(ccv, snd_cwnd);
+   CCV(ccv, snd_ssthresh) = cwin;
CCV(ccv, snd_recover) = CCV(ccv, snd_max);
} else {
/*
@@ -461,13 +466,17 @@ cdg_cong_signal(struct cc_var *ccv, uint
cdg_data->shadow_w, RENO_BETA);
 
CCV(ccv, snd_ssthresh) = max(cdg_data->shadow_w,
-   cdg_window_decrease(ccv, CCV(ccv, snd_cwnd),
-   V_cdg_beta_loss));
+   cdg_window_decrease(ccv, cwin, V_cdg_beta_loss));
+   CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh);
 
cdg_data->window_incr = cdg_data->rtt_count = 0;
}
ENTER_RECOVERY(CCV(ccv, t_flags));
break;
+   case CC_RTO:
+   CCV(ccv, snd_ssthresh) = max(2*mss, cwin/2);
+   CCV(ccv, snd_cwnd) = mss;
+   break;
default:
newreno_cc_algo.cong_signal(ccv, signal_type);
break;

Modified: head/sys/netinet/cc/cc_chd.c
==
--- head/sys/netinet/cc/cc_chd.cTue Oct 25 04:14:03 2016
(r307898)
+++ head/sys/netinet/cc/cc_chd.cTue Oct 25 05:03:33 2016
(r307899)
@@ -330,10 +330,14 @@ chd_cong_signal(struct cc_var *ccv, uint
struct ertt *e_t;
struct chd *chd_data;
int qdly;
+   uint32_t cwin;
+   u_int mss;
 
e_t = khelp_get_osd(CCV(ccv, osd), ertt_id);
chd_data = ccv->cc_data;
qdly = imax(e_t->rtt, chd_data->maxrtt_in_rtt) - e_t->minrtt;
+   cwin = CCV(ccv, snd_cwnd);
+   mss = CCV(ccv, t_maxseg);
 
switch(signal_type) {
case CC_CHD_DELAY:
@@ -373,6 +377,10 @@ chd_cong_signal(struct cc_var *ccv, uint
}
ENTER_FASTRECOVERY(CCV(ccv, t_flags));
break;
+   case CC_RTO:
+   CCV(ccv, snd_ssthresh) = max(2*mss, cwin/2);
+   CCV(ccv, snd_cwnd) = mss;
+   break;
 
default:
newreno_cc_algo.cong_signal(ccv, signal_type);

Modified: head/sys/netinet/cc/cc_cubic.c
==
--- head/sys/netinet/cc/cc_cubic.c  Tue Oct 25 04:14:03 2016
(r307898)
+++ head/sys/netinet/cc/cc_cubic.c  Tue Oct 25 05:03:33 2016
(r307899)
@@ -225,8 +225,12 @@ static void
 cubic_cong_signal(struct cc_var *ccv, uint32_t type)
 {
struct cubic *cubic_data;
+   uint32_t cwin;
+   u_int mss;
 
cubic_data = ccv->cc_data;
+   cwin = CCV(ccv, snd_cwnd);
+   mss = CCV(ccv, t_maxseg);
 
switch (type) {
case CC_NDUPACK:
@@ -235,7 +239,8 @@ cubic_cong_signal(struct cc_var *ccv, ui
cubic_ssthresh_update(ccv);
cubic_data->num_cong_events++;
cubic_data->prev_max_cwnd = 
cubic_data->max_cwnd;
-   cubic_data->max_cwnd = CCV(ccv, snd_cwnd);
+   cubic_data->max_cwnd = cwin;
+   CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh);
}
ENTER_RECOVERY(CCV(ccv, t_flags));
}
@@ -246,7 +251,7 @@ cubic_cong_signal(struct cc_var *ccv, ui
cubic_ssthresh_update(ccv);
cubic_data->num_cong_events++;
   

svn commit: r307897 - head/sys/dev/bxe

2016-10-24 Thread Bryan Drewery
Author: bdrewery
Date: Tue Oct 25 03:55:56 2016
New Revision: 307897
URL: https://svnweb.freebsd.org/changeset/base/307897

Log:
  Use proper if_getdrvflags() API.
  
  This is a NOP.
  
  Sponsored by: Dell EMC Isilon

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

Modified: head/sys/dev/bxe/bxe.c
==
--- head/sys/dev/bxe/bxe.c  Tue Oct 25 03:34:24 2016(r307896)
+++ head/sys/dev/bxe/bxe.c  Tue Oct 25 03:55:56 2016(r307897)
@@ -5603,7 +5603,7 @@ bxe_tx_start(if_t ifp)
 
 fp = >fp[0];
 
-if (ifp->if_drv_flags & IFF_DRV_OACTIVE) {
+if (if_getdrvflags(ifp) & IFF_DRV_OACTIVE) {
 fp->eth_q_stats.tx_queue_full_return++;
 return;
 }
@@ -5643,7 +5643,7 @@ bxe_tx_mq_start_locked(struct bxe_softc 
 }
 }
 
-if (!sc->link_vars.link_up || !(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
+if (!sc->link_vars.link_up || !(if_getdrvflags(ifp) & IFF_DRV_RUNNING)) {
 fp->eth_q_stats.tx_request_link_down_failures++;
 goto bxe_tx_mq_start_locked_exit;
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307893 - head/sys/dev/hyperv/netvsc

2016-10-24 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Oct 25 01:41:39 2016
New Revision: 307893
URL: https://svnweb.freebsd.org/changeset/base/307893

Log:
  hyperv/hn: Set baudrate properly
  
  PR:   208931
  Submitted by: Eugene Grosbein 
  Reported by:  Eugene Grosbein 
  MFC after:1 week
  Sponsored by: Microsoft

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Tue Oct 25 01:32:35 
2016(r307892)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Tue Oct 25 01:41:39 
2016(r307893)
@@ -789,6 +789,7 @@ netvsc_attach(device_t dev)
 * Setup the ifnet for this interface.
 */
 
+   ifp->if_baudrate = IF_Gbps(10);
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_ioctl = hn_ioctl;
ifp->if_init = hn_init;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307892 - head/lib/libc/powerpc/gen

2016-10-24 Thread Justin Hibbits
Author: jhibbits
Date: Tue Oct 25 01:32:35 2016
New Revision: 307892
URL: https://svnweb.freebsd.org/changeset/base/307892

Log:
  Fix a typo which broke the build for powerpc.
  
  It's spelled LIBC_SRCTOP not LIBC_SRC.
  
  Pointy-hat to:jhibbits
  Reported by:  kib

Modified:
  head/lib/libc/powerpc/gen/Makefile.inc

Modified: head/lib/libc/powerpc/gen/Makefile.inc
==
--- head/lib/libc/powerpc/gen/Makefile.inc  Tue Oct 25 00:59:23 2016
(r307891)
+++ head/lib/libc/powerpc/gen/Makefile.inc  Tue Oct 25 01:32:35 2016
(r307892)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 
-.include "${LIBC_SRC}/powerpc/gen/Makefile.common"
+.include "${LIBC_SRCTOP}/powerpc/gen/Makefile.common"
 
 SRCS += fabs.S flt_rounds.c fpgetmask.c fpgetround.c \
fpgetsticky.c fpsetmask.c fpsetround.c \
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307891 - head/usr.sbin/mountd

2016-10-24 Thread Rick Macklem
Author: rmacklem
Date: Tue Oct 25 00:59:23 2016
New Revision: 307891
URL: https://svnweb.freebsd.org/changeset/base/307891

Log:
  Fix the man page to reflect the change done by r307890 to mountd.c
  so that the "-n" option uses the sysctl for the new NFS server.
  This is a content change.
  
  PR:   213450
  Submitted by: r...@bytecamp.net
  MFC after:2 weeks

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

Modified: head/usr.sbin/mountd/mountd.8
==
--- head/usr.sbin/mountd/mountd.8   Tue Oct 25 00:52:42 2016
(r307890)
+++ head/usr.sbin/mountd/mountd.8   Tue Oct 25 00:59:23 2016
(r307891)
@@ -28,7 +28,7 @@
 .\" @(#)mountd.8   8.4 (Berkeley) 4/28/95
 .\" $FreeBSD$
 .\"
-.Dd October 14, 2012
+.Dd October 24, 2016
 .Dt MOUNTD 8
 .Os
 .Sh NAME
@@ -95,7 +95,7 @@ requests to be logged.
 Allow non-root mount requests to be served.
 This should only be specified if there are clients such as PC's,
 that require it.
-It will automatically clear the vfs.nfsrv.nfs_privport sysctl flag, which
+It will automatically clear the vfs.nfsd.nfs_privport sysctl flag, which
 controls if the kernel will accept NFS requests from reserved ports only.
 .It Fl p Ar port
 Force
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307890 - head/usr.sbin/mountd

2016-10-24 Thread Rick Macklem
Author: rmacklem
Date: Tue Oct 25 00:52:42 2016
New Revision: 307890
URL: https://svnweb.freebsd.org/changeset/base/307890

Log:
  mountd(8) was erroneously setting the sysctl for the old NFS server
  when the new/default NFS server was running, for the "-n" option.
  
  This patch fixes the problem for head and stable/11. For stable/10 the
  patch will need to be modified when MFC'd, since the stable/10 mountd.c
  handles both old and new NFS servers.
  Since the new NFS server uses vfs.nfsd.nfs_privport == 0 by default,
  there wouldn't have been many users affected by the code not setting
  it to 0 when the "-n" option was specified.
  
  PR:   213450
  Submitted by: r...@bytecamp.net
  MFC after:2 weeks

Modified:
  head/usr.sbin/mountd/mountd.c

Modified: head/usr.sbin/mountd/mountd.c
==
--- head/usr.sbin/mountd/mountd.c   Mon Oct 24 22:35:45 2016
(r307889)
+++ head/usr.sbin/mountd/mountd.c   Tue Oct 25 00:52:42 2016
(r307890)
@@ -476,7 +476,7 @@ main(int argc, char **argv)
rpc_control(RPC_SVC_CONNMAXREC_SET, );
 
if (!resvport_only) {
-   if (sysctlbyname("vfs.nfsrv.nfs_privport", NULL, NULL,
+   if (sysctlbyname("vfs.nfsd.nfs_privport", NULL, NULL,
_only, sizeof(resvport_only)) != 0 &&
errno != ENOENT) {
syslog(LOG_ERR, "sysctl: %m");
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307889 - head/sys/arm/conf

2016-10-24 Thread Jared McNeill
Author: jmcneill
Date: Mon Oct 24 22:35:45 2016
New Revision: 307889
URL: https://svnweb.freebsd.org/changeset/base/307889

Log:
  Enable driver for SY8106A Buck Regulator.

Modified:
  head/sys/arm/conf/GENERIC

Modified: head/sys/arm/conf/GENERIC
==
--- head/sys/arm/conf/GENERIC   Mon Oct 24 22:35:12 2016(r307888)
+++ head/sys/arm/conf/GENERIC   Mon Oct 24 22:35:45 2016(r307889)
@@ -112,6 +112,7 @@ device  axp209  # AXP209 Power 
Manageme
 device axp81x  # AXP813/818 Power Management Unit
 device bcm2835_bsc
 device icee
+device sy8106a # SY8106A Buck Regulator
 
 # GPIO
 device gpio
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307888 - head/sys/arm/allwinner

2016-10-24 Thread Jared McNeill
Author: jmcneill
Date: Mon Oct 24 22:35:12 2016
New Revision: 307888
URL: https://svnweb.freebsd.org/changeset/base/307888

Log:
  Defer cpufreq updates from intr handler to the taskqueue_thread queue.

Modified:
  head/sys/arm/allwinner/aw_thermal.c

Modified: head/sys/arm/allwinner/aw_thermal.c
==
--- head/sys/arm/allwinner/aw_thermal.c Mon Oct 24 22:11:33 2016
(r307887)
+++ head/sys/arm/allwinner/aw_thermal.c Mon Oct 24 22:35:12 2016
(r307888)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -249,6 +250,7 @@ struct aw_thermal_softc {
struct resource *res[2];
struct aw_thermal_config*conf;
 
+   struct task cf_task;
int throttle;
int min_freq;
struct cf_level levels[MAX_CF_LEVELS];
@@ -390,6 +392,16 @@ aw_thermal_throttle(struct aw_thermal_so
 }
 
 static void
+aw_thermal_cf_task(void *arg, int pending)
+{
+   struct aw_thermal_softc *sc;
+
+   sc = arg;
+
+   aw_thermal_throttle(sc, 1);
+}
+
+static void
 aw_thermal_cf_pre_change(void *arg, const struct cf_level *level, int *status)
 {
struct aw_thermal_softc *sc;
@@ -430,7 +442,7 @@ aw_thermal_intr(void *arg)
}
 
if ((ints & ALARM_INT_ALL) != 0)
-   aw_thermal_throttle(sc, 1);
+   taskqueue_enqueue(taskqueue_thread, >cf_task);
 }
 
 static int
@@ -461,6 +473,7 @@ aw_thermal_attach(device_t dev)
ih = NULL;
 
sc->conf = THS_CONF(dev);
+   TASK_INIT(>cf_task, 0, aw_thermal_cf_task, sc);
 
if (bus_alloc_resources(dev, aw_thermal_spec, sc->res) != 0) {
device_printf(dev, "cannot allocate resources for device\n");
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307887 - head/sys/netinet

2016-10-24 Thread Ryan Stone
Author: rstone
Date: Mon Oct 24 22:11:33 2016
New Revision: 307887
URL: https://svnweb.freebsd.org/changeset/base/307887

Log:
  Fix ip_output() on point-to-point links
  
  In r304435, ip_output() was changed to use the result of the route
  lookup to decide whether the outgoing packet was a broadcast or
  not.  This introduced a regression on interfaces where
  IFF_BROADCAST was not set (e.g. point-to-point links), as the
  algorithm could incorrectly treat the destination address as a
  broadcast address, and ip_output() would subsequently drop the
  packet as broadcasting on a non-IFF_BROADCAST interface is not
  allowed.
  
  Differential Revision:https://reviews.freebsd.org/D8303
  Reviewed by:  jtl
  Reported by:  ambrisko
  MFC after:2 weeks
  X-MFC-With:   r304435
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/netinet/ip_output.c

Modified: head/sys/netinet/ip_output.c
==
--- head/sys/netinet/ip_output.cMon Oct 24 21:33:00 2016
(r307886)
+++ head/sys/netinet/ip_output.cMon Oct 24 22:11:33 2016
(r307887)
@@ -350,7 +350,8 @@ again:
have_ia_ref = 1;
ifp = ia->ia_ifp;
ip->ip_ttl = 1;
-   isbroadcast = in_ifaddr_broadcast(dst->sin_addr, ia);
+   isbroadcast = ifp->if_flags & IFF_BROADCAST ?
+   in_ifaddr_broadcast(dst->sin_addr, ia) : 0;
} else if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) &&
imo != NULL && imo->imo_multicast_ifp != NULL) {
/*
@@ -403,8 +404,10 @@ again:
gw = (struct sockaddr_in *)rte->rt_gateway;
if (rte->rt_flags & RTF_HOST)
isbroadcast = (rte->rt_flags & RTF_BROADCAST);
-   else
+   else if (ifp->if_flags & IFF_BROADCAST)
isbroadcast = in_ifaddr_broadcast(gw->sin_addr, ia);
+   else
+   isbroadcast = 0;
}
 
/*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307884 - head/release/tools

2016-10-24 Thread Glen Barber
Author: gjb
Date: Mon Oct 24 21:16:21 2016
New Revision: 307884
URL: https://svnweb.freebsd.org/changeset/base/307884

Log:
  Belatedly revert r303119, which was determined to not be
  needed.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/release/tools/arm.subr

Modified: head/release/tools/arm.subr
==
--- head/release/tools/arm.subr Mon Oct 24 21:09:48 2016(r307883)
+++ head/release/tools/arm.subr Mon Oct 24 21:16:21 2016(r307884)
@@ -88,7 +88,6 @@ arm_create_user() {
-c 'FreeBSD User' -d '/home/freebsd' -s '/bin/csh'
chroot ${CHROOTDIR} /usr/sbin/pw -R ${DESTDIR} \
usermod root -w yes
-   chroot ${CHROOTDIR} ln -s /home ${DESTDIR}/usr/home
 
return 0
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307883 - head/sys/boot/fdt/dts/arm

2016-10-24 Thread Emmanuel Vadot
Author: manu
Date: Mon Oct 24 21:09:48 2016
New Revision: 307883
URL: https://svnweb.freebsd.org/changeset/base/307883

Log:
  Add needed cpu-supply property for cpufreq.
  
  Patch is merged upstream, in the meantime add it in our DTS.

Modified:
  head/sys/boot/fdt/dts/arm/olimex-a20-som-evb.dts

Modified: head/sys/boot/fdt/dts/arm/olimex-a20-som-evb.dts
==
--- head/sys/boot/fdt/dts/arm/olimex-a20-som-evb.dtsMon Oct 24 21:05:23 
2016(r307882)
+++ head/sys/boot/fdt/dts/arm/olimex-a20-som-evb.dtsMon Oct 24 21:09:48 
2016(r307883)
@@ -41,3 +41,7 @@
};
};
 };
+
+ {
+   cpu-supply = <_dcdc2>;
+};
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307882 - head/contrib/bsnmp/lib

2016-10-24 Thread Shteryana Shopova
Author: syrinx
Date: Mon Oct 24 21:05:23 2016
New Revision: 307882
URL: https://svnweb.freebsd.org/changeset/base/307882

Log:
  Fix a regression introduced in SVN r256678 that breaks USM header parsing
  
  Reviewed by:  bz@

Modified:
  head/contrib/bsnmp/lib/snmp.c

Modified: head/contrib/bsnmp/lib/snmp.c
==
--- head/contrib/bsnmp/lib/snmp.c   Mon Oct 24 20:53:44 2016
(r307881)
+++ head/contrib/bsnmp/lib/snmp.c   Mon Oct 24 21:05:23 2016
(r307882)
@@ -288,7 +288,7 @@ parse_secparams(struct asn_buf *b, struc
memset(buf, 0, 256);
tb.asn_ptr = buf;
tb.asn_len = 256;
-   u_int len;
+   u_int len = 256;
 
if (asn_get_octetstring(b, buf, ) != ASN_ERR_OK) {
snmp_error("cannot parse usm header");
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307881 - head/sys/contrib/rdma/krping

2016-10-24 Thread Navdeep Parhar
Author: np
Date: Mon Oct 24 20:53:44 2016
New Revision: 307881
URL: https://svnweb.freebsd.org/changeset/base/307881

Log:
  krping: Allow the underlying ib_device to handle DMA mappings.
  
  Submitted by: Vijay Singh @ Netapp

Modified:
  head/sys/contrib/rdma/krping/krping.c

Modified: head/sys/contrib/rdma/krping/krping.c
==
--- head/sys/contrib/rdma/krping/krping.c   Mon Oct 24 20:47:46 2016
(r307880)
+++ head/sys/contrib/rdma/krping/krping.c   Mon Oct 24 20:53:44 2016
(r307881)
@@ -548,11 +548,11 @@ static int krping_setup_buffers(struct k
 
DEBUG_LOG(cb, "krping_setup_buffers called on cb %p\n", cb);
 
-   cb->recv_dma_addr = dma_map_single(cb->pd->device->dma_device, 
+   cb->recv_dma_addr = ib_dma_map_single(cb->pd->device, 
   >recv_buf, 
   sizeof(cb->recv_buf), DMA_BIDIRECTIONAL);
pci_unmap_addr_set(cb, recv_mapping, cb->recv_dma_addr);
-   cb->send_dma_addr = dma_map_single(cb->pd->device->dma_device, 
+   cb->send_dma_addr = ib_dma_map_single(cb->pd->device, 
   >send_buf, sizeof(cb->send_buf),
   DMA_BIDIRECTIONAL);
pci_unmap_addr_set(cb, send_mapping, cb->send_dma_addr);
@@ -606,7 +606,7 @@ static int krping_setup_buffers(struct k
goto bail;
}
 
-   cb->rdma_dma_addr = dma_map_single(cb->pd->device->dma_device, 
+   cb->rdma_dma_addr = ib_dma_map_single(cb->pd->device, 
   cb->rdma_buf, cb->size, 
   DMA_BIDIRECTIONAL);
pci_unmap_addr_set(cb, rdma_mapping, cb->rdma_dma_addr);
@@ -676,7 +676,7 @@ static int krping_setup_buffers(struct k
goto bail;
}
 
-   cb->start_dma_addr = dma_map_single(cb->pd->device->dma_device, 
+   cb->start_dma_addr = ib_dma_map_single(cb->pd->device, 
   cb->start_buf, cb->size, 
   DMA_BIDIRECTIONAL);
pci_unmap_addr_set(cb, start_mapping, cb->start_dma_addr);
@@ -1707,7 +1707,7 @@ static void krping_fr_test5(struct krpin
goto err2;
}
DEBUG_LOG(cb, "%s buf[%u] %p\n", __func__, scnt, buf[scnt]);
-   dma_addr[scnt] = dma_map_single(cb->pd->device->dma_device,
+   dma_addr[scnt] = ib_dma_map_single(cb->pd->device,
   buf[scnt], cb->size,
   DMA_BIDIRECTIONAL);
if (dma_mapping_error(cb->pd->device->dma_device,
@@ -2032,7 +2032,7 @@ static void krping_fr_test6(struct krpin
goto err2;
}
DEBUG_LOG(cb, "%s buf[%u] %p\n", __func__, scnt, buf[scnt]);
-   dma_addr[scnt] = dma_map_single(cb->pd->device->dma_device,
+   dma_addr[scnt] = ib_dma_map_single(cb->pd->device,
   buf[scnt], cb->size,
   DMA_BIDIRECTIONAL);
if (dma_mapping_error(cb->pd->device->dma_device,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307880 - in head/sys: amd64/amd64 i386/i386 x86/include x86/x86

2016-10-24 Thread Konstantin Belousov
Author: kib
Date: Mon Oct 24 20:47:46 2016
New Revision: 307880
URL: https://svnweb.freebsd.org/changeset/base/307880

Log:
  Follow-up to r307866:
  - Make !KDB config buildable.
  - Simplify interface to nmi_handle_intr() by evaluating panic_on_nmi
in one place, namely nmi_call_kdb().  This allows to remove do_panic
argument from the functions, and to remove i386/amd64 duplication of
the variable and sysctl definitions.  Note that now NMI causes
panic(9) instead of trap_fatal() reporting and then panic(9),
consistently for NMIs delivered while CPU operated in ring 0 and 3.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/amd64/amd64/trap.c
  head/sys/i386/i386/trap.c
  head/sys/x86/include/x86_var.h
  head/sys/x86/x86/cpu_machdep.c
  head/sys/x86/x86/mp_x86.c

Modified: head/sys/amd64/amd64/trap.c
==
--- head/sys/amd64/amd64/trap.c Mon Oct 24 20:36:54 2016(r307879)
+++ head/sys/amd64/amd64/trap.c Mon Oct 24 20:47:46 2016(r307880)
@@ -144,9 +144,6 @@ static char *trap_msg[] = {
"DTrace pid return trap",   /* 32 T_DTRACE_RET */
 };
 
-static int panic_on_nmi = 1;
-SYSCTL_INT(_machdep, OID_AUTO, panic_on_nmi, CTLFLAG_RWTUN,
-   _on_nmi, 0, "Panic on NMI");
 static int prot_fault_translation;
 SYSCTL_INT(_machdep, OID_AUTO, prot_fault_translation, CTLFLAG_RWTUN,
 _fault_translation, 0,
@@ -372,7 +369,7 @@ trap(struct trapframe *frame)
 
 #ifdef DEV_ISA
case T_NMI:
-   nmi_handle_intr(type, frame, true);
+   nmi_handle_intr(type, frame);
break;
 #endif /* DEV_ISA */
 
@@ -544,10 +541,8 @@ trap(struct trapframe *frame)
 
 #ifdef DEV_ISA
case T_NMI:
-   if (nmi_handle_intr(type, frame, false) ||
-   !panic_on_nmi)
-   goto out;
-   /* FALLTHROUGH */
+   nmi_handle_intr(type, frame);
+   goto out;
 #endif /* DEV_ISA */
}
 

Modified: head/sys/i386/i386/trap.c
==
--- head/sys/i386/i386/trap.c   Mon Oct 24 20:36:54 2016(r307879)
+++ head/sys/i386/i386/trap.c   Mon Oct 24 20:47:46 2016(r307880)
@@ -158,14 +158,6 @@ static char *trap_msg[] = {
 int has_f00f_bug = 0;  /* Initialized so that it can be patched. */
 #endif
 
-#ifdef KDB
-static int kdb_on_nmi = 1;
-SYSCTL_INT(_machdep, OID_AUTO, kdb_on_nmi, CTLFLAG_RWTUN,
-   _on_nmi, 0, "Go to KDB on NMI");
-#endif
-static int panic_on_nmi = 1;
-SYSCTL_INT(_machdep, OID_AUTO, panic_on_nmi, CTLFLAG_RWTUN,
-   _on_nmi, 0, "Panic on NMI");
 static int prot_fault_translation = 0;
 SYSCTL_INT(_machdep, OID_AUTO, prot_fault_translation, CTLFLAG_RW,
_fault_translation, 0, "Select signal to deliver on protection 
fault");
@@ -467,7 +459,7 @@ user_trctrap_out:
}
goto userout;
 #else /* !POWERFAIL_NMI */
-   nmi_handle_intr(type, frame, true);
+   nmi_handle_intr(type, frame);
break;
 #endif /* POWERFAIL_NMI */
 #endif /* DEV_ISA */
@@ -716,10 +708,8 @@ kernel_trctrap:
}
goto out;
 #else /* !POWERFAIL_NMI */
-   if (nmi_handle_intr(type, frame, false) ||
-   !panic_on_nmi)
-   goto out;
-   /* FALLTHROUGH */
+   nmi_handle_intr(type, frame);
+   goto out;
 #endif /* POWERFAIL_NMI */
 #endif /* DEV_ISA */
}

Modified: head/sys/x86/include/x86_var.h
==
--- head/sys/x86/include/x86_var.h  Mon Oct 24 20:36:54 2016
(r307879)
+++ head/sys/x86/include/x86_var.h  Mon Oct 24 20:47:46 2016
(r307880)
@@ -108,10 +108,9 @@ bool   fix_cpuid(void);
 void   fillw(int /*u_short*/ pat, void *base, size_t cnt);
 intis_physical_memory(vm_paddr_t addr);
 intisa_nmi(int cd);
-bool   nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame,
-   bool panic);
-bool   nmi_call_kdb_smp(u_int type, struct trapframe *frame, bool panic);
-intnmi_handle_intr(u_int type, struct trapframe *frame, bool panic);
+void   nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame);
+void   nmi_call_kdb_smp(u_int type, struct trapframe *frame);
+void   nmi_handle_intr(u_int type, struct trapframe *frame);
 void   pagecopy(void *from, void *to);
 void   printcpuinfo(void);
 intuser_dbreg_trap(void);

Modified: head/sys/x86/x86/cpu_machdep.c
==
--- head/sys/x86/x86/cpu_machdep.c  

svn commit: r307879 - in head/sys/boot: efi/libefi efi/loader ficl forth

2016-10-24 Thread Warner Losh
Author: imp
Date: Mon Oct 24 20:36:54 2016
New Revision: 307879
URL: https://svnweb.freebsd.org/changeset/base/307879

Log:
  Preliminary support for EFI in boot loader. Define efi-boot forth
  environment variable to allow conditional compilation based on EFI
  being present or not. Provide efi-setenv, efi-getenv, and
  efi-unsetenv, though those need improvement. Move the efi definition
  to libefi (but include a reference so they get included).

Added:
  head/sys/boot/forth/efi.4th   (contents, props changed)
Deleted:
  head/sys/boot/ficl/efi.c
Modified:
  head/sys/boot/efi/libefi/Makefile
  head/sys/boot/efi/libefi/env.c
  head/sys/boot/efi/loader/main.c
  head/sys/boot/ficl/loader.c
  head/sys/boot/forth/Makefile.inc
  head/sys/boot/forth/loader.4th

Modified: head/sys/boot/efi/libefi/Makefile
==
--- head/sys/boot/efi/libefi/Makefile   Mon Oct 24 20:33:42 2016
(r307878)
+++ head/sys/boot/efi/libefi/Makefile   Mon Oct 24 20:36:54 2016
(r307879)
@@ -26,6 +26,7 @@ CFLAGS+=  -msoft-float -mgeneral-regs-onl
 .if ${MACHINE_ARCH} == "amd64"
 CFLAGS+= -fPIC -mno-red-zone
 .endif
+CFLAGS+= -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/${MACHINE}
 CFLAGS+= -I${.CURDIR}/../include
 CFLAGS+= -I${.CURDIR}/../include/${MACHINE}
 CFLAGS+= -I${.CURDIR}/../../../../lib/libstand

Modified: head/sys/boot/efi/libefi/env.c
==
--- head/sys/boot/efi/libefi/env.c  Mon Oct 24 20:33:42 2016
(r307878)
+++ head/sys/boot/efi/libefi/env.c  Mon Oct 24 20:36:54 2016
(r307879)
@@ -26,8 +26,15 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
+#include 
 #include 
 #include 
+#include 
+#include "bootstrap.h"
+#include "ficl.h"
+
+int efi_variable_support = 1;
 
 /*
  * Simple wrappers to the underlying UEFI functions.
@@ -53,3 +60,175 @@ efi_set_variable(CHAR16 *variable_name, 
 {
return RS->SetVariable(variable_name, vendor_guid, attributes, 
data_size, data);
 }
+
+/*
+ * FreeBSD's loader interaction words and extras
+ *
+ * efi-setenv  ( value n name n guid n attr -- 0 | -1)
+ * efi-getenv  ( guid n addr n -- addr' n' | -1 )
+ * efi-unsetenv ( name n guid n'' -- )
+ */
+
+/*
+ * efi-setenv
+ * efi-setenv  ( value n name n guid n attr -- 0 | -1)
+ *
+ * Set environment variables using the SetVariable EFI runtime service.
+ *
+ * Value and guid are passed through in binary form (so guid needs to be
+ * converted to binary form from its string form). Name is converted from
+ * ASCII to CHAR16. Since ficl doesn't have support for internationalization,
+ * there's no native CHAR16 interface provided.
+ *
+ * attr is an int in the bitmask of the following attributes for this variable.
+ *
+ * 1   Non volatile
+ * 2   Boot service access
+ * 4   Run time access
+ * (corresponding to the same bits in the UEFI spec).
+ */
+void
+ficlEfiSetenv(FICL_VM *pVM)
+{
+#ifndef TESTMAIN
+   char*value = NULL, *guid = NULL;
+   CHAR16  *name = NULL;
+   int i;
+#endif
+   char*namep, *valuep, *guidp;
+   int names, values, guids, attr;
+   int status;
+   uuid_t  u;
+   uint32_t ustatus;
+
+#if FICL_ROBUST > 1
+   vmCheckStack(pVM, 6, 0);
+#endif
+   attr = stackPopINT(pVM->pStack);
+   guids = stackPopINT(pVM->pStack);
+   guidp = (char*)stackPopPtr(pVM->pStack);
+   names = stackPopINT(pVM->pStack);
+   namep = (char*)stackPopPtr(pVM->pStack);
+   values = stackPopINT(pVM->pStack);
+   valuep = (char*)stackPopPtr(pVM->pStack);
+
+#ifndef TESTMAIN
+   guid = (char*)ficlMalloc(guids);
+   if (guid != NULL)
+   vmThrowErr(pVM, "Error: out of memory");
+   memcpy(guid, guidp, guids);
+   uuid_from_string(guid, , );
+   if (ustatus != uuid_s_ok) {
+   stackPushINT(pVM->pStack, -1);
+   goto out;
+   }
+
+   name = (CHAR16 *)ficlMalloc((names + 1) * sizeof(CHAR16));
+   if (name == NULL)
+   vmThrowErr(pVM, "Error: out of memory");
+   for (i = 0; i < names; i++)
+   name[i] = namep[i];
+   name[names] = (CHAR16)0;
+
+   value = (char*)ficlMalloc(values + 1);
+   if (value != NULL)
+   vmThrowErr(pVM, "Error: out of memory");
+   memcpy(value, valuep, values);
+
+   status = efi_set_variable(name, (EFI_GUID *), attr, values, value);
+   if (status == EFI_SUCCESS)
+   stackPushINT(pVM->pStack, 0);
+   else
+   stackPushINT(pVM->pStack, -1);
+out:
+   ficlFree(name);
+   ficlFree(value);
+   ficlFree(guid);
+#endif
+
+   return;
+}
+
+void
+ficlEfiGetenv(FICL_VM *pVM)
+{
+#ifndef TESTMAIN
+   char*name, *value;
+#endif
+   char*namep;
+   int names;
+
+#if FICL_ROBUST > 1
+   

svn commit: r307878 - in head/sys/arm: allwinner conf

2016-10-24 Thread Emmanuel Vadot
Author: manu
Date: Mon Oct 24 20:33:42 2016
New Revision: 307878
URL: https://svnweb.freebsd.org/changeset/base/307878

Log:
  allwinner: Add support for P2WI in RSB driver
  
  Push-Pull Two Wire interface is a almost compatible iic like bus used
  in sun6i SoC. It's only use is to communicate with the power management IC.
  
  Reviewed by:  jmcneill
  MFC after:1 week
  Relnotes: yes

Modified:
  head/sys/arm/allwinner/aw_rsb.c
  head/sys/arm/allwinner/files.allwinner
  head/sys/arm/conf/GENERIC

Modified: head/sys/arm/allwinner/aw_rsb.c
==
--- head/sys/arm/allwinner/aw_rsb.c Mon Oct 24 19:24:07 2016
(r307877)
+++ head/sys/arm/allwinner/aw_rsb.c Mon Oct 24 20:33:42 2016
(r307878)
@@ -27,7 +27,7 @@
  */
 
 /*
- * Allwinner RSB (Reduced Serial Bus)
+ * Allwinner RSB (Reduced Serial Bus) and P2WI (Push-Pull Two Wire Interface)
  */
 
 #include 
@@ -92,8 +92,12 @@ __FBSDID("$FreeBSD$");
 #defineRSB_ADDR_PMIC_SECONDARY 0x745
 #defineRSB_ADDR_PERIPH_IC  0xe89
 
+#defineA31_P2WI1
+#defineA23_RSB 2
+
 static struct ofw_compat_data compat_data[] = {
-   { "allwinner,sun8i-a23-rsb",1 },
+   { "allwinner,sun6i-a31-p2wi",   A31_P2WI },
+   { "allwinner,sun8i-a23-rsb",A23_RSB },
{ NULL, 0 }
 };
 
@@ -131,6 +135,7 @@ struct rsb_softc {
int busy;
uint32_tstatus;
uint16_tcur_addr;
+   int type;
 
struct iic_msg  *msg;
 };
@@ -270,8 +275,8 @@ rsb_transfer(device_t dev, struct iic_ms
sc = device_get_softc(dev);
 
/*
-* RSB is not really an I2C or SMBus controller, so there are some
-* restrictions imposed by the driver.
+* P2WI and RSB are not really I2C or SMBus controllers, so there are
+* some restrictions imposed by the driver.
 *
 * Transfers must contain exactly two messages. The first is always
 * a write, containing a single data byte offset. Data will either
@@ -284,34 +289,36 @@ rsb_transfer(device_t dev, struct iic_ms
msgs[0].len != 1 || msgs[1].len > RSB_MAXLEN)
return (EINVAL);
 
-   /* The controller can read or write 1, 2, or 4 bytes at a time. */
-   if ((msgs[1].flags & IIC_M_RD) != 0) {
-   switch (msgs[1].len) {
-   case 1:
-   cmd = CMD_RD8;
-   break;
-   case 2:
-   cmd = CMD_RD16;
-   break;
-   case 4:
-   cmd = CMD_RD32;
-   break;
-   default:
-   return (EINVAL);
-   }
-   } else {
-   switch (msgs[1].len) {
-   case 1:
-   cmd = CMD_WR8;
-   break;
-   case 2:
-   cmd = CMD_WR16;
-   break;
-   case 4: 
-   cmd = CMD_WR32;
-   break;
-   default:
-   return (EINVAL);
+   /* The RSB controller can read or write 1, 2, or 4 bytes at a time. */
+   if (sc->type == A23_RSB) {
+   if ((msgs[1].flags & IIC_M_RD) != 0) {
+   switch (msgs[1].len) {
+   case 1:
+   cmd = CMD_RD8;
+   break;
+   case 2:
+   cmd = CMD_RD16;
+   break;
+   case 4:
+   cmd = CMD_RD32;
+   break;
+   default:
+   return (EINVAL);
+   }
+   } else {
+   switch (msgs[1].len) {
+   case 1:
+   cmd = CMD_WR8;
+   break;
+   case 2:
+   cmd = CMD_WR16;
+   break;
+   case 4:
+   cmd = CMD_WR32;
+   break;
+   default:
+   return (EINVAL);
+   }
}
}
 
@@ -322,13 +329,15 @@ rsb_transfer(device_t dev, struct iic_ms
sc->status = 0;
 
/* Select current run-time address if necessary */
-   device_addr = msgs[0].slave >> 1;
-   if (sc->cur_addr != device_addr) {
-   error = rsb_set_rta(dev, device_addr);
-   if (error != 0)
-   goto done;
-   sc->cur_addr = device_addr;
-   sc->status = 0;
+   if (sc->type == A23_RSB) {
+   

svn commit: r307876 - head/sys/dev/cxgbe

2016-10-24 Thread Navdeep Parhar
Author: np
Date: Mon Oct 24 19:09:56 2016
New Revision: 307876
URL: https://svnweb.freebsd.org/changeset/base/307876

Log:
  cxgbe(4): Fix bug in the calculation of the number of physically
  contiguous regions in an mbuf chain.
  
  If the payload of an mbuf ends at a page boundary count_mbuf_nsegs would
  incorrectly consider the next mbuf's payload physically contiguous based
  solely on a KVA comparison.
  
  MFC after:1 week
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/t4_sge.c

Modified: head/sys/dev/cxgbe/t4_sge.c
==
--- head/sys/dev/cxgbe/t4_sge.c Mon Oct 24 18:27:24 2016(r307875)
+++ head/sys/dev/cxgbe/t4_sge.c Mon Oct 24 19:09:56 2016(r307876)
@@ -2110,24 +2110,6 @@ m_advance(struct mbuf **pm, int *poffset
return ((void *)p);
 }
 
-static inline int
-same_paddr(char *a, char *b)
-{
-
-   if (a == b)
-   return (1);
-   else if (a != NULL && b != NULL) {
-   vm_offset_t x = (vm_offset_t)a;
-   vm_offset_t y = (vm_offset_t)b;
-
-   if ((x & PAGE_MASK) == (y & PAGE_MASK) &&
-   pmap_kextract(x) == pmap_kextract(y))
-   return (1);
-   }
-
-   return (0);
-}
-
 /*
  * Can deal with empty mbufs in the chain that have m_len = 0, but the chain
  * must have at least one mbuf that's not empty.
@@ -2135,24 +2117,25 @@ same_paddr(char *a, char *b)
 static inline int
 count_mbuf_nsegs(struct mbuf *m)
 {
-   char *prev_end, *start;
+   vm_paddr_t lastb, next;
+   vm_offset_t va;
int len, nsegs;
 
MPASS(m != NULL);
 
nsegs = 0;
-   prev_end = NULL;
+   lastb = 0;
for (; m; m = m->m_next) {
 
len = m->m_len;
if (__predict_false(len == 0))
continue;
-   start = mtod(m, char *);
-
-   nsegs += sglist_count(start, len);
-   if (same_paddr(prev_end, start))
+   va = mtod(m, vm_offset_t);
+   next = pmap_kextract(va);
+   nsegs += sglist_count(m->m_data, len);
+   if (lastb + 1 == next)
nsegs--;
-   prev_end = start + len;
+   lastb = pmap_kextract(va + len - 1);
}
 
MPASS(nsegs > 0);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307874 - head/sys/ufs/ffs

2016-10-24 Thread Marcel Moolenaar
Author: marcel
Date: Mon Oct 24 18:12:57 2016
New Revision: 307874
URL: https://svnweb.freebsd.org/changeset/base/307874

Log:
  Include  explicitly instead of depending on that
  header being included by . When compiled as part
  of makefs(8) and on macOS or Linux,  is not our
  own.

Modified:
  head/sys/ufs/ffs/ffs_tables.c

Modified: head/sys/ufs/ffs/ffs_tables.c
==
--- head/sys/ufs/ffs/ffs_tables.c   Mon Oct 24 18:03:04 2016
(r307873)
+++ head/sys/ufs/ffs/ffs_tables.c   Mon Oct 24 18:12:57 2016
(r307874)
@@ -33,6 +33,7 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
 #include 
 #include 
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307873 - head/sys/kern

2016-10-24 Thread Marcel Moolenaar
Author: marcel
Date: Mon Oct 24 18:03:04 2016
New Revision: 307873
URL: https://svnweb.freebsd.org/changeset/base/307873

Log:
  Include  instead of  when compiled as
  part of libsbuf. The former is the standard header, and allows us
  to compile libsbuf on macOS/linux.

Modified:
  head/sys/kern/subr_prf.c

Modified: head/sys/kern/subr_prf.c
==
--- head/sys/kern/subr_prf.cMon Oct 24 17:59:25 2016(r307872)
+++ head/sys/kern/subr_prf.cMon Oct 24 18:03:04 2016(r307873)
@@ -72,7 +72,11 @@ __FBSDID("$FreeBSD$");
  * Note that stdarg.h and the ANSI style va_start macro is used for both
  * ANSI and traditional C compilers.
  */
+#ifdef _KERNEL
 #include 
+#else
+#include 
+#endif
 
 #ifdef _KERNEL
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307872 - head/share/mk

2016-10-24 Thread Marcel Moolenaar
Author: marcel
Date: Mon Oct 24 17:59:25 2016
New Revision: 307872
URL: https://svnweb.freebsd.org/changeset/base/307872

Log:
  Detect clang on macOS. The version string is slightly different.

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

Modified: head/share/mk/bsd.compiler.mk
==
--- head/share/mk/bsd.compiler.mk   Mon Oct 24 17:57:46 2016
(r307871)
+++ head/share/mk/bsd.compiler.mk   Mon Oct 24 17:59:25 2016
(r307872)
@@ -147,7 +147,7 @@ ${X_}COMPILER_TYPE:=clang
 ${X_}COMPILER_TYPE:=   gcc
 . elif ${_v:M\(GCC\)}
 ${X_}COMPILER_TYPE:=   gcc
-. elif ${_v:Mclang}
+. elif ${_v:Mclang} || ${_v:M(clang-*.*.*)}
 ${X_}COMPILER_TYPE:=   clang
 . else
 .error Unable to determine compiler type for ${cc}=${${cc}}.  Consider setting 
${X_}COMPILER_TYPE.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307871 - head/lib/libnetbsd

2016-10-24 Thread Marcel Moolenaar
Author: marcel
Date: Mon Oct 24 17:57:46 2016
New Revision: 307871
URL: https://svnweb.freebsd.org/changeset/base/307871

Log:
  Include "util.h", not . The header is in the same directory
  as the C file. There may be a  on the host when compiling
  on macOS or Linux, causing conflicts.

Modified:
  head/lib/libnetbsd/util.c

Modified: head/lib/libnetbsd/util.c
==
--- head/lib/libnetbsd/util.c   Mon Oct 24 17:56:08 2016(r307870)
+++ head/lib/libnetbsd/util.c   Mon Oct 24 17:57:46 2016(r307871)
@@ -36,7 +36,8 @@
 #include 
 #include 
 #include 
-#include 
+
+#include "util.h"
 
 char *
 flags_to_string(u_long flags, const char *def)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307870 - head/lib/libnetbsd/sys

2016-10-24 Thread Marcel Moolenaar
Author: marcel
Date: Mon Oct 24 17:56:08 2016
New Revision: 307870
URL: https://svnweb.freebsd.org/changeset/base/307870

Log:
  When compiling on macOS or Linux, __dead can be defined already.
  Conditionally define __dead.

Modified:
  head/lib/libnetbsd/sys/cdefs.h

Modified: head/lib/libnetbsd/sys/cdefs.h
==
--- head/lib/libnetbsd/sys/cdefs.h  Mon Oct 24 17:37:21 2016
(r307869)
+++ head/lib/libnetbsd/sys/cdefs.h  Mon Oct 24 17:56:08 2016
(r307870)
@@ -35,11 +35,13 @@
 
 #include_next 
 
+#ifndef __dead
 #ifdef __dead2
 #define __dead __dead2
 #else
 #define __dead
 #endif
+#endif /* !__dead */
 
 /*
  * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2016-10-24 Thread Konstantin Belousov
Author: kib
Date: Mon Oct 24 17:37:21 2016
New Revision: 307869
URL: https://svnweb.freebsd.org/changeset/base/307869

Log:
  Fix typo.
  
  Submitted by: alc
  MFC after:3 days

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

Modified: head/sys/x86/x86/mp_x86.c
==
--- head/sys/x86/x86/mp_x86.c   Mon Oct 24 17:08:12 2016(r307868)
+++ head/sys/x86/x86/mp_x86.c   Mon Oct 24 17:37:21 2016(r307869)
@@ -1351,7 +1351,7 @@ invlcache_handler(void)
 * Reading the generation here allows greater parallelism
 * since wbinvd is a serializing instruction.  Without the
 * temporary, we'd wait for wbinvd to complete, then the read
-* would execute, then the dependent write, whuch must then
+* would execute, then the dependent write, which must then
 * complete before return from interrupt.
 */
generation = smp_tlb_generation;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r307756 - in head: include sys/sys

2016-10-24 Thread John Baldwin
On Saturday, October 22, 2016 12:00:56 AM Brooks Davis wrote:
> On Fri, Oct 21, 2016 at 11:50:02PM +, John Baldwin wrote:
> > Author: jhb
> > Date: Fri Oct 21 23:50:02 2016
> > New Revision: 307756
> > URL: https://svnweb.freebsd.org/changeset/base/307756
> > 
> > Log:
> >   Define max_align_t for C11.
> >   
> >   libc++'s stddef.h includes an existing definition of max_align_t for
> >   C++11, but it is only defined for C++, not for C.  In addition, GCC and
> >   clang both define an alternate version of max_align_t that uses a
> >   union of multiple types rather than a plain long double as in libc++.
> >   This adds a __max_align_t to  that matches the GCC and
> >   clang definition that is mapped to max_align_t in .
> >   
> >   PR:   210890
> >   Reviewed by:  dim
> >   MFC after:1 month
> >   Differential Revision:https://reviews.freebsd.org/D8194
> > 
> > Modified:
> >   head/include/stddef.h
> >   head/sys/sys/_types.h
> > 
> > Modified: head/include/stddef.h
> > ==
> > --- head/include/stddef.h   Fri Oct 21 21:55:50 2016(r307755)
> > +++ head/include/stddef.h   Fri Oct 21 23:50:02 2016(r307756)
> > @@ -62,6 +62,14 @@ typedef  ___wchar_t  wchar_t;
> >  #endif
> >  #endif
> >  
> > +#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L
> > +#ifndef __CLANG_MAX_ALIGN_T_DEFINED
> > +typedef__max_align_t   max_align_t;
> > +#define __CLANG_MAX_ALIGN_T_DEFINED
> > +#define __GCC_MAX_ALIGN_T
> > +#endif
> > +#endif
> > +
> >  #defineoffsetof(type, member)  __offsetof(type, member)
> >  
> >  #endif /* _STDDEF_H_ */
> > 
> > Modified: head/sys/sys/_types.h
> > ==
> > --- head/sys/sys/_types.h   Fri Oct 21 21:55:50 2016(r307755)
> > +++ head/sys/sys/_types.h   Fri Oct 21 23:50:02 2016(r307756)
> > @@ -100,6 +100,11 @@ typedef__uint_least32_t __char32_t;
> >  #define_CHAR32_T_DECLARED
> >  #endif
> >  
> > +typedef struct {
> 
> Should this be union per the commit message?

Dimitry's response is correct of course.  I think my brain had "fixed" this
when I read it to be a union instead of a struct since a struct seems so
obviously wrong.

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


svn commit: r307866 - in head/sys: amd64/amd64 i386/i386 kern x86/include x86/x86

2016-10-24 Thread Konstantin Belousov
Author: kib
Date: Mon Oct 24 16:40:27 2016
New Revision: 307866
URL: https://svnweb.freebsd.org/changeset/base/307866

Log:
  Handle broadcast NMIs.
  
  On several Intel chipsets, diagnostic NMIs sent from BMC or NMIs
  reporting hardware errors are broadcasted to all CPUs.
  
  When kernel is configured to enter kdb on NMI, the outcome is
  problematic, because each CPU tries to enter kdb.  All CPUs are
  executing NMI handlers, which set the latches disabling the nested NMI
  delivery; this means that stop_cpus_hard(), used by kdb_enter() to
  stop other cpus by broadcasting IPI_STOP_HARD NMI, cannot work.  One
  indication of this is the harmless but annoying diagnostic "timeout
  stopping cpus".
  
  Much more harming behaviour is that because all CPUs try to enter kdb,
  and if ddb is used as debugger, all CPUs issue prompt on console and
  race for the input, not to mention the simultaneous use of the ddb
  shared state.
  
  Try to fix this by introducing a pseudo-lock for simultaneous attempts
  to handle NMIs.  If one core happens to enter NMI trap handler, other
  cores see it and simulate reception of the IPI_STOP_HARD.  More,
  generic_stop_cpus() avoids sending IPI_STOP_HARD and avoids waiting
  for the acknowledgement, relying on the nmi handler on other cores
  suspending and then restarting the CPU.
  
  Since it is impossible to detect at runtime whether some stray NMI is
  broadcast or unicast, add a knob for administrator (really developer)
  to configure debugging NMI handling mode.
  
  The updated patch was debugged with the help from Andrey Gapon (avg)
  and discussed with him.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks
  Differential revision:https://reviews.freebsd.org/D8249

Modified:
  head/sys/amd64/amd64/trap.c
  head/sys/i386/i386/trap.c
  head/sys/kern/subr_smp.c
  head/sys/x86/include/x86_smp.h
  head/sys/x86/include/x86_var.h
  head/sys/x86/x86/cpu_machdep.c
  head/sys/x86/x86/mp_x86.c

Modified: head/sys/amd64/amd64/trap.c
==
--- head/sys/amd64/amd64/trap.c Mon Oct 24 16:28:54 2016(r307865)
+++ head/sys/amd64/amd64/trap.c Mon Oct 24 16:40:27 2016(r307866)
@@ -144,11 +144,6 @@ static char *trap_msg[] = {
"DTrace pid return trap",   /* 32 T_DTRACE_RET */
 };
 
-#ifdef KDB
-static int kdb_on_nmi = 1;
-SYSCTL_INT(_machdep, OID_AUTO, kdb_on_nmi, CTLFLAG_RWTUN,
-   _on_nmi, 0, "Go to KDB on NMI");
-#endif
 static int panic_on_nmi = 1;
 SYSCTL_INT(_machdep, OID_AUTO, panic_on_nmi, CTLFLAG_RWTUN,
_on_nmi, 0, "Panic on NMI");
@@ -377,21 +372,7 @@ trap(struct trapframe *frame)
 
 #ifdef DEV_ISA
case T_NMI:
-   /* machine/parity/power fail/"kitchen sink" faults */
-   if (isa_nmi(frame->tf_err) == 0) {
-#ifdef KDB
-   /*
-* NMI can be hooked up to a pushbutton
-* for debugging.
-*/
-   if (kdb_on_nmi) {
-   printf ("NMI ... going to debugger\n");
-   kdb_trap(type, 0, frame);
-   }
-#endif /* KDB */
-   goto userout;
-   } else if (panic_on_nmi)
-   panic("NMI indicates hardware failure");
+   nmi_handle_intr(type, frame, true);
break;
 #endif /* DEV_ISA */
 
@@ -563,20 +544,8 @@ trap(struct trapframe *frame)
 
 #ifdef DEV_ISA
case T_NMI:
-   /* machine/parity/power fail/"kitchen sink" faults */
-   if (isa_nmi(frame->tf_err) == 0) {
-#ifdef KDB
-   /*
-* NMI can be hooked up to a pushbutton
-* for debugging.
-*/
-   if (kdb_on_nmi) {
-   printf ("NMI ... going to debugger\n");
-   kdb_trap(type, 0, frame);
-   }
-#endif /* KDB */
-   goto out;
-   } else if (panic_on_nmi == 0)
+   if (nmi_handle_intr(type, frame, false) ||
+   !panic_on_nmi)
goto out;
/* FALLTHROUGH */
 #endif /* DEV_ISA */

Modified: head/sys/i386/i386/trap.c
==
--- head/sys/i386/i386/trap.c   Mon Oct 24 16:28:54 2016(r307865)
+++ head/sys/i386/i386/trap.c   Mon Oct 24 16:40:27 2016(r307866)
@@ -467,21 +467,7 @@ user_trctrap_out:
}
goto userout;
 #else /* 

svn commit: r307865 - head/sys/boot/zfs

2016-10-24 Thread Toomas Soome
Author: tsoome
Date: Mon Oct 24 16:28:54 2016
New Revision: 307865
URL: https://svnweb.freebsd.org/changeset/base/307865

Log:
  loader should boot pre-feature flags pools.
  
  The feature flags chek is missing the corner case where we have valid pool
  version, but feature flags are not enabled - as for example plain v28 pool.
  
  This update does fix the boot support for such pools.
  
  Reviewed by:  avg, allanjude
  Approved by:  allanjude (mentor)
  Differential Revision:https://reviews.freebsd.org/D8331

Modified:
  head/sys/boot/zfs/zfsimpl.c

Modified: head/sys/boot/zfs/zfsimpl.c
==
--- head/sys/boot/zfs/zfsimpl.c Mon Oct 24 14:56:13 2016(r307864)
+++ head/sys/boot/zfs/zfsimpl.c Mon Oct 24 16:28:54 2016(r307865)
@@ -2122,8 +2122,13 @@ check_mos_features(const spa_t *spa)
)) != 0)
return (rc);
if ((rc = zap_lookup(spa, , DMU_POOL_FEATURES_FOR_READ,
-   sizeof (objnum), 1, )) != 0)
-   return (rc);
+   sizeof (objnum), 1, )) != 0) {
+   /*
+* It is older pool without features. As we have already
+* tested the label, just return without raising the error.
+*/
+   return (0);
+   }
 
if ((rc = objset_get_dnode(spa, >spa_mos, objnum, )) != 0)
return (rc);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307864 - head/lib/libgcc_s

2016-10-24 Thread Ed Maste
Author: emaste
Date: Mon Oct 24 14:56:13 2016
New Revision: 307864
URL: https://svnweb.freebsd.org/changeset/base/307864

Log:
  Move the LLVM-based libgcc_s to /lib
  
  When enabled, it should install in the same location as the existing
  library.
  
  Reported by:  antoine

Modified:
  head/lib/libgcc_s/Makefile

Modified: head/lib/libgcc_s/Makefile
==
--- head/lib/libgcc_s/Makefile  Mon Oct 24 14:37:18 2016(r307863)
+++ head/lib/libgcc_s/Makefile  Mon Oct 24 14:56:13 2016(r307864)
@@ -2,6 +2,7 @@
 
 PKG=   clibs
 SHLIB_NAME=libgcc_s.so.1
+SHLIBDIR?= /lib
 
 WARNS?=2
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307863 - in head/lib/libcasper/services: cap_dns cap_grp cap_pwd cap_sysctl

2016-10-24 Thread Ed Maste
Author: emaste
Date: Mon Oct 24 14:37:18 2016
New Revision: 307863
URL: https://svnweb.freebsd.org/changeset/base/307863

Log:
  Set SHLIBDIR before .including src.opts.mk in libcapser services
  
  bsd.own.mk (included from src.opts.mk) sets SHLIBDIR?=${LIBDIR}, so
  SHLIBDIR must be set before including either one of them.
  
  MFC with: 305626
  Sponsored by: The FreeBSD Foundation

Modified:
  head/lib/libcasper/services/cap_dns/Makefile
  head/lib/libcasper/services/cap_grp/Makefile
  head/lib/libcasper/services/cap_pwd/Makefile
  head/lib/libcasper/services/cap_sysctl/Makefile

Modified: head/lib/libcasper/services/cap_dns/Makefile
==
--- head/lib/libcasper/services/cap_dns/MakefileMon Oct 24 14:24:12 
2016(r307862)
+++ head/lib/libcasper/services/cap_dns/MakefileMon Oct 24 14:37:18 
2016(r307863)
@@ -1,12 +1,13 @@
 # $FreeBSD$
 
+SHLIBDIR?= /lib/casper
+
 .include 
 
 PACKAGE=libcasper
 LIB=   cap_dns
 
 SHLIB_MAJOR=   0
-SHLIBDIR?= /lib/casper
 INCSDIR?=  ${INCLUDEDIR}/casper
 
 SRCS=  cap_dns.c

Modified: head/lib/libcasper/services/cap_grp/Makefile
==
--- head/lib/libcasper/services/cap_grp/MakefileMon Oct 24 14:24:12 
2016(r307862)
+++ head/lib/libcasper/services/cap_grp/MakefileMon Oct 24 14:37:18 
2016(r307863)
@@ -1,12 +1,13 @@
 # $FreeBSD$
 
+SHLIBDIR?= /lib/casper
+
 .include 
 
 PACKAGE=libcasper
 LIB=   cap_grp
 
 SHLIB_MAJOR=   0
-SHLIBDIR?= /lib/casper
 INCSDIR?=  ${INCLUDEDIR}/casper
 
 SRCS=  cap_grp.c

Modified: head/lib/libcasper/services/cap_pwd/Makefile
==
--- head/lib/libcasper/services/cap_pwd/MakefileMon Oct 24 14:24:12 
2016(r307862)
+++ head/lib/libcasper/services/cap_pwd/MakefileMon Oct 24 14:37:18 
2016(r307863)
@@ -1,12 +1,13 @@
 # $FreeBSD$
 
+SHLIBDIR?= /lib/casper
+
 .include 
 
 PACKAGE=libcasper
 LIB=   cap_pwd
 
 SHLIB_MAJOR=   0
-SHLIBDIR?= /lib/casper
 INCSDIR?=  ${INCLUDEDIR}/casper
 
 SRCS=  cap_pwd.c

Modified: head/lib/libcasper/services/cap_sysctl/Makefile
==
--- head/lib/libcasper/services/cap_sysctl/Makefile Mon Oct 24 14:24:12 
2016(r307862)
+++ head/lib/libcasper/services/cap_sysctl/Makefile Mon Oct 24 14:37:18 
2016(r307863)
@@ -1,12 +1,13 @@
 # $FreeBSD$
 
+SHLIBDIR?= /lib/casper
+
 .include 
 
 PACKAGE=libcasper
 LIB=   cap_sysctl
 
 SHLIB_MAJOR=   0
-SHLIBDIR?= /lib/casper
 INCSDIR?=  ${INCLUDEDIR}/casper
 
 SRCS=  cap_sysctl.c
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307862 - in head/sys/arm: allwinner conf

2016-10-24 Thread Emmanuel Vadot
Author: manu
Date: Mon Oct 24 14:24:12 2016
New Revision: 307862
URL: https://svnweb.freebsd.org/changeset/base/307862

Log:
  Revert 307822
  
  P2WI is almost compatible with RSB which we already support.
  I'll add support for P2WI in aw_rsb instead.
  
  Discussed with:jmcneill

Deleted:
  head/sys/arm/allwinner/aw_p2wi.c
  head/sys/arm/allwinner/aw_p2wi.h
Modified:
  head/sys/arm/allwinner/files.allwinner
  head/sys/arm/conf/GENERIC

Modified: head/sys/arm/allwinner/files.allwinner
==
--- head/sys/arm/allwinner/files.allwinner  Mon Oct 24 14:08:05 2016
(r307861)
+++ head/sys/arm/allwinner/files.allwinner  Mon Oct 24 14:24:12 2016
(r307862)
@@ -12,7 +12,6 @@ arm/allwinner/a10_mmc.c   optional
mmc
 arm/allwinner/a10_sramc.c  standard
 arm/allwinner/aw_nmi.c optionalintrng
 arm/allwinner/aw_if_dwc.c  optionaldwc
-arm/allwinner/aw_p2wi.coptionalp2wi
 arm/allwinner/aw_rsb.c optionalrsb
 arm/allwinner/aw_rtc.c standard
 arm/allwinner/aw_ts.c  standard

Modified: head/sys/arm/conf/GENERIC
==
--- head/sys/arm/conf/GENERIC   Mon Oct 24 14:08:05 2016(r307861)
+++ head/sys/arm/conf/GENERIC   Mon Oct 24 14:24:12 2016(r307862)
@@ -107,7 +107,6 @@ device  iicbus
 device iic
 device twsi
 device rsb
-device p2wi# Allwinner Push-Pull Two Wire interface
 device axp209  # AXP209 Power Management Unit
 device axp81x  # AXP813/818 Power Management Unit
 device bcm2835_bsc
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307861 - in head: contrib/libarchive contrib/libarchive/cat/test contrib/libarchive/cpio/test contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/tar/te...

2016-10-24 Thread Martin Matuska
Author: mm
Date: Mon Oct 24 14:08:05 2016
New Revision: 307861
URL: https://svnweb.freebsd.org/changeset/base/307861

Log:
  MFV r307859:
  Update libarchive to 3.2.2

Modified:
  head/contrib/libarchive/NEWS
  head/contrib/libarchive/cat/test/main.c
  head/contrib/libarchive/cat/test/test.h
  head/contrib/libarchive/cpio/test/main.c
  head/contrib/libarchive/cpio/test/test.h
  head/contrib/libarchive/libarchive/archive.h
  head/contrib/libarchive/libarchive/archive_entry.h
  head/contrib/libarchive/libarchive/test/main.c
  head/contrib/libarchive/libarchive/test/test.h
  head/contrib/libarchive/libarchive/test/test_read_format_mtree_crash747.c
  
head/contrib/libarchive/libarchive/test/test_read_format_zip_high_compression.c
  head/contrib/libarchive/libarchive/test/test_read_set_format.c
  head/contrib/libarchive/libarchive/test/test_write_format_iso9660.c
  head/contrib/libarchive/tar/test/main.c
  head/contrib/libarchive/tar/test/test.h
  head/contrib/libarchive/tar/test/test_option_b.c
  head/contrib/libarchive/tar/test/test_symlink_dir.c
  head/usr.bin/bsdcat/Makefile
  head/usr.bin/cpio/Makefile
  head/usr.bin/tar/Makefile
Directory Properties:
  head/contrib/libarchive/   (props changed)

Modified: head/contrib/libarchive/NEWS
==
--- head/contrib/libarchive/NEWSMon Oct 24 13:52:53 2016
(r307860)
+++ head/contrib/libarchive/NEWSMon Oct 24 14:08:05 2016
(r307861)
@@ -1,3 +1,6 @@
+Oct 23, 2016: libarchive 3.2.2 released
+Security release
+
 Jun 20, 2016: libarchive 3.2.1 released
 This fixes a handful of security and other critical issues with 3.2.0
 

Modified: head/contrib/libarchive/cat/test/main.c
==
--- head/contrib/libarchive/cat/test/main.c Mon Oct 24 13:52:53 2016
(r307860)
+++ head/contrib/libarchive/cat/test/main.c Mon Oct 24 14:08:05 2016
(r307861)
@@ -129,6 +129,13 @@
 # include 
 #endif
 
+mode_t umasked(mode_t expected_mode)
+{
+   mode_t mode = umask(0);
+   umask(mode);
+   return expected_mode & ~mode;
+}
+
 /* Path to working directory for current test */
 const char *testworkdir;
 #ifdef PROGRAM
@@ -1156,6 +1163,35 @@ assertion_file_contains_lines_any_order(
return (0);
 }
 
+/* Verify that a text file does not contains the specified strings */
+int
+assertion_file_contains_no_invalid_strings(const char *file, int line,
+const char *pathname, const char *strings[])
+{
+   char *buff;
+   int i;
+
+   buff = slurpfile(NULL, "%s", pathname);
+   if (buff == NULL) {
+   failure_start(file, line, "Can't read file: %s", pathname);
+   failure_finish(NULL);
+   return (0);
+   }
+
+   for (i = 0; strings[i] != NULL; ++i) {
+   if (strstr(buff, strings[i]) != NULL) {
+   failure_start(file, line, "Invalid string in %s: %s", 
pathname,
+   strings[i]);
+   failure_finish(NULL);
+   free(buff);
+   return(0);
+   }
+   }
+
+   free(buff);
+   return (0);
+}
+
 /* Test that two paths point to the same file. */
 /* As a side-effect, asserts that both files exist. */
 static int
@@ -1293,6 +1329,11 @@ assertion_file_time(const char *file, in
switch (type) {
case 'a': filet_nsec = st.st_atimespec.tv_nsec; break;
case 'b': filet = st.st_birthtime;
+   /* FreeBSD filesystems that don't support birthtime
+* (e.g., UFS1) always return -1 here. */
+   if (filet == -1) {
+   return (1);
+   }
filet_nsec = st.st_birthtimespec.tv_nsec; break;
case 'm': filet_nsec = st.st_mtimespec.tv_nsec; break;
default: fprintf(stderr, "INTERNAL: Bad type %c for file time", type);
@@ -1370,6 +1411,8 @@ assertion_file_mode(const char *file, in
assertion_count(file, line);
 #if defined(_WIN32) && !defined(__CYGWIN__)
failure_start(file, line, "assertFileMode not yet implemented for 
Windows");
+   (void)mode; /* UNUSED */
+   (void)r; /* UNUSED */
 #else
{
struct stat st;
@@ -1424,7 +1467,7 @@ assertion_file_nlinks(const char *file, 
assertion_count(file, line);
r = lstat(pathname, );
if (r == 0 && (int)st.st_nlink == nlinks)
-   return (1);
+   return (1);
failure_start(file, line, "File %s has %d links, expected %d",
pathname, st.st_nlink, nlinks);
failure_finish(NULL);
@@ -1660,6 +1703,7 @@ assertion_make_file(const char *file, in
if (0 != chmod(path, mode)) {
failure_start(file, line, "Could not chmod %s", path);
failure_finish(NULL);
+   close(fd);
return (0);
 

svn commit: r307858 - head/sys/arm64/include

2016-10-24 Thread Andrew Turner
Author: andrew
Date: Mon Oct 24 13:44:24 2016
New Revision: 307858
URL: https://svnweb.freebsd.org/changeset/base/307858

Log:
  Increase CACHE_LINE_SHIFT to 7 as cache lines are 128 bytes on ThunderX.
  
  MFC after:1 week
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/arm64/include/param.h

Modified: head/sys/arm64/include/param.h
==
--- head/sys/arm64/include/param.h  Mon Oct 24 12:24:24 2016
(r307857)
+++ head/sys/arm64/include/param.h  Mon Oct 24 13:44:24 2016
(r307858)
@@ -77,7 +77,7 @@
  * CACHE_LINE_SIZE is the compile-time maximum cache line size for an
  * architecture.  It should be used with appropriate caution.
  */
-#defineCACHE_LINE_SHIFT6
+#defineCACHE_LINE_SHIFT7
 #defineCACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT)
 
 #definePAGE_SHIFT  12
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2016-10-24 Thread Alexander Motin
Author: mav
Date: Mon Oct 24 12:24:24 2016
New Revision: 307857
URL: https://svnweb.freebsd.org/changeset/base/307857

Log:
  Fix panic after ZVOL renamed to name invalid for DEVFS.
  
  MFC after:2 weeks

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c  Mon Oct 24 
11:47:27 2016(r307856)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c  Mon Oct 24 
12:24:24 2016(r307857)
@@ -782,8 +782,10 @@ zvol_remove_zv(zvol_state_t *zv)
g_topology_lock();
zvol_geom_destroy(zv);
g_topology_unlock();
-   } else if (zv->zv_volmode == ZFS_VOLMODE_DEV)
-   destroy_dev(zv->zv_dev);
+   } else if (zv->zv_volmode == ZFS_VOLMODE_DEV) {
+   if (zv->zv_dev != NULL)
+   destroy_dev(zv->zv_dev);
+   }
 #endif
 
avl_destroy(>zv_znode.z_range_avl);
@@ -2973,14 +2975,14 @@ zvol_rename_minor(zvol_state_t *zv, cons
} else if (zv->zv_volmode == ZFS_VOLMODE_DEV) {
struct make_dev_args args;
 
-   dev = zv->zv_dev;
-   ASSERT(dev != NULL);
-   zv->zv_dev = NULL;
-   destroy_dev(dev);
-   if (zv->zv_total_opens > 0) {
-   zv->zv_flags &= ~ZVOL_EXCL;
-   zv->zv_total_opens = 0;
-   zvol_last_close(zv);
+   if ((dev = zv->zv_dev) != NULL) {
+   zv->zv_dev = NULL;
+   destroy_dev(dev);
+   if (zv->zv_total_opens > 0) {
+   zv->zv_flags &= ~ZVOL_EXCL;
+   zv->zv_total_opens = 0;
+   zvol_last_close(zv);
+   }
}
 
make_dev_args_init();
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"