svn commit: r312563 - head/share/man/man7

2017-01-20 Thread Kevin Lo
Author: kevlo
Date: Sat Jan 21 07:07:50 2017
New Revision: 312563
URL: https://svnweb.freebsd.org/changeset/base/312563

Log:
  Mention softfloat and hardfloat supports for RISC-V.
  
  Reviewed by:  br

Modified:
  head/share/man/man7/arch.7

Modified: head/share/man/man7/arch.7
==
--- head/share/man/man7/arch.7  Sat Jan 21 06:53:30 2017(r312562)
+++ head/share/man/man7/arch.7  Sat Jan 21 07:07:50 2017(r312563)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 20, 2016
+.Dd January 21, 2017
 .Dt ARCH 7
 .Os
 .Sh NAME
@@ -135,7 +135,8 @@ On all supported architectures,
 .It mips64hfTa hard Ta identical to double
 .It powerpc Ta hard Ta hard, double precision
 .It powerpc64   Ta hard Ta hard, double precision
-.It riscv   Ta
+.It riscv64 Ta hard Ta hard, double precision
+.It riscv64sf   Ta soft Ta soft, double precision
 .It sparc64 Ta hard Ta hard, quad precision
 .El
 .Ss Predefined Macros
___
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: r312562 - head/sys/dev/ath

2017-01-20 Thread Adrian Chadd
Author: adrian
Date: Sat Jan 21 06:53:30 2017
New Revision: 312562
URL: https://svnweb.freebsd.org/changeset/base/312562

Log:
  [ath] ensure both iv_ampdu_limit and iv_ampdu_rxmax is set.
  
  A recent change enforced the VAP limit as well as the peer limit.
  I now need to actually set iv_ampdu_limit or we don't transmit more
  than 8K sized aggregates.
  
  This restores the expected (suboptimal, but still much faster) behaviour.
  
  Tested:
  
  * AR9380, STA mode

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

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Sat Jan 21 06:48:52 2017(r312561)
+++ head/sys/dev/ath/if_ath.c   Sat Jan 21 06:53:30 2017(r312562)
@@ -1638,6 +1638,7 @@ ath_vap_create(struct ieee80211com *ic, 
 * However, for now that's enforced by the TX path.
 */
vap->iv_ampdu_rxmax = IEEE80211_HTCAP_MAXRXAMPDU_64K;
+   vap->iv_ampdu_limit = IEEE80211_HTCAP_MAXRXAMPDU_64K;
 
avp->av_bslot = -1;
if (needbeacon) {
___
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: r286700 - in head: sbin/ifconfig sys/net

2017-01-20 Thread Ravi Pokala
-Original Message-
> From:  on behalf of Hiren Panchasara 
> 
> Date: 2017-01-18, Wednesday at 14:38
> To: Alan Somers , , 
> , 
> Cc: "src-committ...@freebsd.org" , 
> "svn-src-...@freebsd.org" , 
> "svn-src-head@freebsd.org" 
> Subject: Re: svn commit: r286700 - in head: sbin/ifconfig sys/net
> 
> Adding the submitter and other reviewers for their comments.
> 
> On 01/18/17 at 03:03P, Alan Somers wrote:
>> Is the change to lacp_port_create correct?  The comment indicates that
>> fast is configurable, but it's actually constant.  Later on, there's
>> some dead code that depends on the value of fast (it was dead before
>> this commit, too).
>>
>> CID: 1305734
>> CID: 1305692

You're right that in lacp_port_create(), "fast" (and "active") are both 
constant. I think the comment intended to indicate that "fast" could be changed 
via ioctl *after create*.

It seems to me that the right thing to do would be to remove both "fast" and 
"active" from lacp_port_create(), and have it unconditionally set 
"lp->lp_state" to LACP_STATE_ACTIVITY. That would eliminate the unclear 
comments and fix both Coverity issues, without changing any behavior.

-Ravi (rpokala@)

>> -Alan
>> 
>> On Wed, Aug 12, 2015 at 2:21 PM, Hiren Panchasara  wrote:
>>> Author: hiren
>>> Date: Wed Aug 12 20:21:04 2015
>>> New Revision: 286700
>>> URL: https://svnweb.freebsd.org/changeset/base/286700
>>>
>>> Log:
>>>   Make LAG LACP fast timeout tunable through IOCTL.
>>>
>>>   Differential Revision:D3300
>>>   Submitted by: LN Sundararajan 
>>>   Reviewed by:  wblock, smh, gnn, hiren, rpokala at panasas
>>>   MFC after:2 weeks
>>>   Sponsored by: Panasas
>>>
>>> Modified:
>>>   head/sbin/ifconfig/ifconfig.8
>>>   head/sbin/ifconfig/iflagg.c
>>>   head/sys/net/ieee8023ad_lacp.c
>>>   head/sys/net/ieee8023ad_lacp.h
>>>   head/sys/net/if_lagg.c
>>>   head/sys/net/if_lagg.h
>>>
>>> Modified: head/sbin/ifconfig/ifconfig.8
>>> ==
>>> --- head/sbin/ifconfig/ifconfig.8   Wed Aug 12 20:16:13 2015
>>> (r286699)
>>> +++ head/sbin/ifconfig/ifconfig.8   Wed Aug 12 20:21:04 2015
>>> (r286700)
>>> @@ -28,7 +28,7 @@
>>>  .\" From: @(#)ifconfig.8   8.3 (Berkeley) 1/5/94
>>>  .\" $FreeBSD$
>>>  .\"
>>> -.Dd May 15, 2015
>>> +.Dd Aug 12, 2015
>>>  .Dt IFCONFIG 8
>>>  .Os
>>>  .Sh NAME
>>> @@ -2396,6 +2396,10 @@ Disable local hash computation for RSS h
>>>  Set a shift parameter for RSS local hash computation.
>>>  Hash is calculated by using flowid bits in a packet header mbuf
>>>  which are shifted by the number of this parameter.
>>> +.It Cm lacp_fast_timeout
>>> +Enable lacp fast-timeout on the interface.
>>> +.It Cm -lacp_fast_timeout
>>> +Disable lacp fast-timeout on the interface.
>>>  .El
>>>  .Pp
>>>  The following parameters are specific to IP tunnel interfaces,
>>>
>>> Modified: head/sbin/ifconfig/iflagg.c
>>> ==
>>> --- head/sbin/ifconfig/iflagg.c Wed Aug 12 20:16:13 2015(r286699)
>>> +++ head/sbin/ifconfig/iflagg.c Wed Aug 12 20:21:04 2015(r286700)
>>> @@ -115,6 +115,8 @@ setlaggsetopt(const char *val, int d, in
>>> case -LAGG_OPT_LACP_TXTEST:
>>> case LAGG_OPT_LACP_RXTEST:
>>> case -LAGG_OPT_LACP_RXTEST:
>>> +   case LAGG_OPT_LACP_TIMEOUT:
>>> +   case -LAGG_OPT_LACP_TIMEOUT:
>>> break;
>>> default:
>>> err(1, "Invalid lagg option");
>>> @@ -293,6 +295,8 @@ static struct cmd lagg_cmds[] = {
>>> DEF_CMD("-lacp_txtest", -LAGG_OPT_LACP_TXTEST,  setlaggsetopt),
>>> DEF_CMD("lacp_rxtest",  LAGG_OPT_LACP_RXTEST,   setlaggsetopt),
>>> DEF_CMD("-lacp_rxtest", -LAGG_OPT_LACP_RXTEST,  setlaggsetopt),
>>> +   DEF_CMD("lacp_fast_timeout",LAGG_OPT_LACP_TIMEOUT,  
>>> setlaggsetopt),
>>> +   DEF_CMD("-lacp_fast_timeout",   -LAGG_OPT_LACP_TIMEOUT, 
>>> setlaggsetopt),
>>> DEF_CMD_ARG("flowid_shift", setlaggflowidshift),
>>>  };
>>>  static struct afswtch af_lagg = {
>>>
>>> Modified: head/sys/net/ieee8023ad_lacp.c
>>> ==
>>> --- head/sys/net/ieee8023ad_lacp.c  Wed Aug 12 20:16:13 2015
>>> (r286699)
>>> +++ head/sys/net/ieee8023ad_lacp.c  Wed Aug 12 20:21:04 2015
>>> (r286700)
>>> @@ -522,7 +522,7 @@ lacp_port_create(struct lagg_port *lgp)
>>> int error;
>>>
>>> boolean_t active = TRUE; /* XXX should be configurable */
>>> -   boolean_t fast = FALSE; /* XXX should be configurable */
>>> +   boolean_t fast = FALSE; /* Configurable via ioctl */

Re: svn commit: r312522 - head/sys/net80211

2017-01-20 Thread Adrian Chadd
... MCS16-31. God, don't commit late at night adrian.


-a


On 19 January 2017 at 23:43, Adrian Chadd  wrote:
> Author: adrian
> Date: Fri Jan 20 07:43:40 2017
> New Revision: 312522
> URL: https://svnweb.freebsd.org/changeset/base/312522
>
> Log:
>   [net80211] allow for MCS16-23 to be statically configured.
>
>   Tested:
>
>   * AR9380, STA mode
>
> Modified:
>   head/sys/net80211/ieee80211_ioctl.c
>
> Modified: head/sys/net80211/ieee80211_ioctl.c
> ==
> --- head/sys/net80211/ieee80211_ioctl.c Fri Jan 20 07:11:21 2017
> (r312521)
> +++ head/sys/net80211/ieee80211_ioctl.c Fri Jan 20 07:43:40 2017
> (r312522)
> @@ -2225,7 +2225,7 @@ checkmcs(int mcs)
> return 1;
> if ((mcs & IEEE80211_RATE_MCS) == 0)/* MCS always have 0x80 set */
> return 0;
> -   return (mcs & 0x7f) <= 15;  /* XXX could search ht rate set */
> +   return (mcs & 0x7f) <= 31;  /* XXX could search ht rate set */
>  }
>
>  static int
>
___
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: r312560 - head/sbin/ifconfig

2017-01-20 Thread Andriy Voskoboinyk
Author: avos
Date: Fri Jan 20 22:41:16 2017
New Revision: 312560
URL: https://svnweb.freebsd.org/changeset/base/312560

Log:
  ifconfig(8): fix '-stbc' parameter name.
  
  MFC after:5 days

Modified:
  head/sbin/ifconfig/ifieee80211.c

Modified: head/sbin/ifconfig/ifieee80211.c
==
--- head/sbin/ifconfig/ifieee80211.cFri Jan 20 21:40:04 2017
(r312559)
+++ head/sbin/ifconfig/ifieee80211.cFri Jan 20 22:41:16 2017
(r312560)
@@ -5602,7 +5602,7 @@ static struct cmd ieee80211_cmds[] = {
DEF_CMD("stbctx",   1,  set80211stbc),
DEF_CMD("-stbctx",  -1, set80211stbc),
DEF_CMD("stbc", 3,  set80211stbc),  /* NB: tx+rx */
-   DEF_CMD("-ampdu",   -3, set80211stbc),
+   DEF_CMD("-stbc",-3, set80211stbc),
DEF_CMD("puren",1,  set80211puren),
DEF_CMD("-puren",   0,  set80211puren),
DEF_CMD("doth", 1,  set80211doth),
___
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: r312559 - head/usr.sbin/camdd

2017-01-20 Thread Alan Somers
Author: asomers
Date: Fri Jan 20 21:40:04 2017
New Revision: 312559
URL: https://svnweb.freebsd.org/changeset/base/312559

Log:
  Fix misc Coverity defects in camdd(8)
  
  CID 1341620   Fix a small memory leak
  CID 1341630   Though this is technically a false positive, rearrange the
code for clarity.
  CID 1341635   Eliminate dead code
  CID 1368663   Fix a double mutex unlock in the error path
  
  Also:
  * Use sig_atomic_t for variables accessed from signal handlers
  * Don't conditionalize free(3) on its argument being non-null
  
  Reported by:  Coverity
  CID:  1341620 1341630 1341635 1368663
  Reviewed by:  ken
  MFC after:4 weeks
  Sponsored by: Spectra Logic Corp
  Differential Revision:https://reviews.freebsd.org/D9237

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

Modified: head/usr.sbin/camdd/camdd.c
==
--- head/usr.sbin/camdd/camdd.c Fri Jan 20 21:21:41 2017(r312558)
+++ head/usr.sbin/camdd/camdd.c Fri Jan 20 21:40:04 2017(r312559)
@@ -420,9 +420,9 @@ struct camdd_dev {
 };
 
 static sem_t camdd_sem;
-static int need_exit = 0;
-static int error_exit = 0;
-static int need_status = 0;
+static sig_atomic_t need_exit = 0;
+static sig_atomic_t error_exit = 0;
+static sig_atomic_t need_status = 0;
 
 #ifndef min
 #definemin(a, b) (a < b) ? a : b
@@ -712,11 +712,7 @@ camdd_alloc_buf(struct camdd_dev *dev, c
return (buf);
 
 bailout_error:
-   if (data_ptr != NULL)
-   free(data_ptr);
-
-   if (buf != NULL)
-   free(buf);
+   free(data_ptr);
 
return (NULL);
 }
@@ -2262,6 +2258,7 @@ camdd_file_run(struct camdd_dev *dev)
if (file_dev->tmp_buf == NULL) {
buf->status = CAMDD_STATUS_ERROR;
error_count++;
+   pthread_mutex_lock(>mutex);
goto bailout;
}
for (i = 0, cur_offset = 0; i < data->sg_count; i++) {
@@ -2984,7 +2981,6 @@ int
 camdd_rw(struct camdd_io_opts *io_opts, int num_io_opts, uint64_t max_io,
 int retry_count, int timeout)
 {
-   char *device = NULL;
struct cam_device *new_cam_dev = NULL;
struct camdd_dev *devs[2];
struct timespec start_time;
@@ -3004,12 +3000,11 @@ camdd_rw(struct camdd_io_opts *io_opts, 
for (i = 0; i < num_io_opts; i++) {
switch (io_opts[i].dev_type) {
case CAMDD_DEV_PASS: {
-   camdd_argmask new_arglist = CAMDD_ARG_NONE;
-   int bus = 0, target = 0, lun = 0;
-   char name[30];
-   int rv;
-
if (isdigit(io_opts[i].dev_name[0])) {
+   camdd_argmask new_arglist = CAMDD_ARG_NONE;
+   int bus = 0, target = 0, lun = 0;
+   int rv;
+
/* device specified as bus:target[:lun] */
rv = parse_btl(io_opts[i].dev_name, ,
, , _arglist);
@@ -3025,23 +3020,21 @@ camdd_rw(struct camdd_io_opts *io_opts, 
lun = 0;
new_arglist |= CAMDD_ARG_LUN;
}
+   new_cam_dev = cam_open_btl(bus, target, lun,
+   O_RDWR, NULL);
} else {
+   char name[30];
+
if (cam_get_device(io_opts[i].dev_name, name,
   sizeof name, ) == -1) {
warnx("%s", cam_errbuf);
error = 1;
goto bailout;
}
-   device = strdup(name);
-   new_arglist |= CAMDD_ARG_DEVICE |CAMDD_ARG_UNIT;
+   new_cam_dev = cam_open_spec_device(name, unit,
+   O_RDWR, NULL);
}
 
-   if (new_arglist & (CAMDD_ARG_BUS | CAMDD_ARG_TARGET))
-   new_cam_dev = cam_open_btl(bus, target, lun,
-   O_RDWR, NULL);
-   else
-   new_cam_dev = cam_open_spec_device(device, unit,
-   O_RDWR, NULL);
if (new_cam_dev == NULL) {
warnx("%s", cam_errbuf);
error = 1;
___
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: r312558 - head/sbin/camcontrol

2017-01-20 Thread Alan Somers
Author: asomers
Date: Fri Jan 20 21:21:41 2017
New Revision: 312558
URL: https://svnweb.freebsd.org/changeset/base/312558

Log:
  Misc Coverity fixes in camcontrol(8)
  
  CID 1229913   Fix output of "camcontrol persist -i report_capabilities".
The reported Persistent Reservation Types were wrong in all
cases.
  CID 1356029   Annotate the code so Coverity will know that this is a false
positive.
  CID 1366830   Fix a memory leak in "camcontrol timestamp -s"
  CID 1366832   Fix a segfault that could be caused by bad drive firmware
  
  Also, fix the man page entry for the "camcontrol epc state" command to match
  what the code does.
  
  Reviewed by:  ken, wblock
  MFC after:4 weeks
  Sponsored by: Spectra Logic Corp
  Differential Revision:https://reviews.freebsd.org/D9239

Modified:
  head/sbin/camcontrol/camcontrol.8
  head/sbin/camcontrol/epc.c
  head/sbin/camcontrol/persist.c
  head/sbin/camcontrol/timestamp.c

Modified: head/sbin/camcontrol/camcontrol.8
==
--- head/sbin/camcontrol/camcontrol.8   Fri Jan 20 21:15:22 2017
(r312557)
+++ head/sbin/camcontrol/camcontrol.8   Fri Jan 20 21:21:41 2017
(r312558)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 15, 2017
+.Dd January 20, 2017
 .Dt CAMCONTROL 8
 .Os
 .Sh NAME
@@ -2374,6 +2374,20 @@ this power condition will be affected.
 .It state
 Enable or disable a particular power condition.
 .Bl -tag -width 7n
+.It Fl e
+Enable the power condition.
+One of 
+.Fl e
+or
+.Fl d
+is required.
+.It Fl d
+Disable the power condition.
+One of
+.Fl d
+or
+.Fl e
+is required.
 .It Fl p Ar cond
 Specify the power condition: Idle_a, Idle_b, Idle_c, Standby_y, Standby_z.
 This argument is required.

Modified: head/sbin/camcontrol/epc.c
==
--- head/sbin/camcontrol/epc.c  Fri Jan 20 21:15:22 2017(r312557)
+++ head/sbin/camcontrol/epc.c  Fri Jan 20 21:21:41 2017(r312558)
@@ -783,6 +783,7 @@ epc(struct cam_device *device, int argc,
warnx("Must specify a timer value (-T time)");
error = 1;
}
+   /* FALLTHROUGH */
case ATA_SF_EPC_SET_STATE:
if (enable == -1) {
warnx("Must specify enable (-e) or disable (-d)");

Modified: head/sbin/camcontrol/persist.c
==
--- head/sbin/camcontrol/persist.c  Fri Jan 20 21:15:22 2017
(r312557)
+++ head/sbin/camcontrol/persist.c  Fri Jan 20 21:21:41 2017
(r312558)
@@ -241,9 +241,11 @@ persist_print_cap(struct scsi_per_res_ca
 {
uint32_t length;
int check_type_mask = 0;
+   uint32_t type_mask;
 
length = scsi_2btoul(cap->length);
length = MIN(length, valid_len);
+   type_mask = scsi_2btoul(cap->type_mask);
 
if (length < __offsetof(struct scsi_per_res_cap, type_mask)) {
fprintf(stdout, "Insufficient data (%u bytes) to report "
@@ -345,20 +347,20 @@ persist_print_cap(struct scsi_per_res_ca
fprintf(stdout, "Supported Persistent Reservation Types:\n");
fprintf(stdout, "Write Exclusive - All Registrants "
"(WR_EX_AR): %d\n",
-   (cap->type_mask[0] & SPRI_TM_WR_EX_AR)? 1 : 0);
+   (type_mask & SPRI_TM_WR_EX_AR)? 1 : 0);
fprintf(stdout, "Exclusive Access - Registrants Only "
"(EX_AC_RO): %d\n",
-   (cap->type_mask[0] & SPRI_TM_EX_AC_RO) ? 1 : 0);
+   (type_mask & SPRI_TM_EX_AC_RO) ? 1 : 0);
fprintf(stdout, "Write Exclusive - Registrants Only "
"(WR_EX_RO): %d\n",
-   (cap->type_mask[0] & SPRI_TM_WR_EX_RO)? 1 : 0);
+   (type_mask & SPRI_TM_WR_EX_RO)? 1 : 0);
fprintf(stdout, "Exclusive Access (EX_AC): %d\n",
-   (cap->type_mask[0] & SPRI_TM_EX_AC) ? 1 : 0);
+   (type_mask & SPRI_TM_EX_AC) ? 1 : 0);
fprintf(stdout, "Write Exclusive (WR_EX): %d\n",
-   (cap->type_mask[0] & SPRI_TM_WR_EX) ? 1 : 0);
+   (type_mask & SPRI_TM_WR_EX) ? 1 : 0);
fprintf(stdout, "Exclusive Access - All Registrants "
"(EX_AC_AR): %d\n",
-   (cap->type_mask[1] & SPRI_TM_EX_AC_AR) ? 1 : 0);
+   (type_mask & SPRI_TM_EX_AC_AR) ? 1 : 0);
} else {
fprintf(stdout, "Persistent Reservation Type Mask is NOT "
"valid\n");

Modified: head/sbin/camcontrol/timestamp.c
==
--- 

svn commit: r312555 - in head/sys: amd64/amd64 amd64/include i386/i386 i386/include

2017-01-20 Thread Konstantin Belousov
Author: kib
Date: Fri Jan 20 19:08:44 2017
New Revision: 312555
URL: https://svnweb.freebsd.org/changeset/base/312555

Log:
  Use SFENCE for ordering CLFLUSHOPT.
  
  SDM states that CLFLUSHOPT instructions can be ordered with other
  writes by SFENCE, heavier MFENCE is not required.
  
  Reviewed by:  alc
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/amd64/include/cpufunc.h
  head/sys/i386/i386/pmap.c
  head/sys/i386/include/cpufunc.h

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Fri Jan 20 18:37:14 2017(r312554)
+++ head/sys/amd64/amd64/pmap.c Fri Jan 20 19:08:44 2017(r312555)
@@ -1862,16 +1862,16 @@ pmap_invalidate_cache_range(vm_offset_t 
return;
 
/*
-* Otherwise, do per-cache line flush.  Use the mfence
+* Otherwise, do per-cache line flush.  Use the sfence
 * instruction to insure that previous stores are
 * included in the write-back.  The processor
 * propagates flush to other processors in the cache
 * coherence domain.
 */
-   mfence();
+   sfence();
for (; sva < eva; sva += cpu_clflush_line_size)
clflushopt(sva);
-   mfence();
+   sfence();
} else if ((cpu_feature & CPUID_CLFSH) != 0 &&
eva - sva < PMAP_CLFLUSH_THRESHOLD) {
if (pmap_kextract(sva) == lapic_paddr)
@@ -1915,7 +1915,9 @@ pmap_invalidate_cache_pages(vm_page_t *p
((cpu_feature & CPUID_CLFSH) == 0 && !useclflushopt))
pmap_invalidate_cache();
else {
-   if (useclflushopt || cpu_vendor_id != CPU_VENDOR_INTEL)
+   if (useclflushopt)
+   sfence();
+   else if (cpu_vendor_id != CPU_VENDOR_INTEL)
mfence();
for (i = 0; i < count; i++) {
daddr = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(pages[i]));
@@ -1927,7 +1929,9 @@ pmap_invalidate_cache_pages(vm_page_t *p
clflush(daddr);
}
}
-   if (useclflushopt || cpu_vendor_id != CPU_VENDOR_INTEL)
+   if (useclflushopt)
+   sfence();
+   else if (cpu_vendor_id != CPU_VENDOR_INTEL)
mfence();
}
 }

Modified: head/sys/amd64/include/cpufunc.h
==
--- head/sys/amd64/include/cpufunc.hFri Jan 20 18:37:14 2017
(r312554)
+++ head/sys/amd64/include/cpufunc.hFri Jan 20 19:08:44 2017
(r312555)
@@ -327,6 +327,13 @@ mfence(void)
 }
 
 static __inline void
+sfence(void)
+{
+
+   __asm __volatile("sfence" : : : "memory");
+}
+
+static __inline void
 ia32_pause(void)
 {
__asm __volatile("pause");

Modified: head/sys/i386/i386/pmap.c
==
--- head/sys/i386/i386/pmap.c   Fri Jan 20 18:37:14 2017(r312554)
+++ head/sys/i386/i386/pmap.c   Fri Jan 20 19:08:44 2017(r312555)
@@ -1283,16 +1283,16 @@ pmap_invalidate_cache_range(vm_offset_t 
return;
 #endif
/*
-* Otherwise, do per-cache line flush.  Use the mfence
+* Otherwise, do per-cache line flush.  Use the sfence
 * instruction to insure that previous stores are
 * included in the write-back.  The processor
 * propagates flush to other processors in the cache
 * coherence domain.
 */
-   mfence();
+   sfence();
for (; sva < eva; sva += cpu_clflush_line_size)
clflushopt(sva);
-   mfence();
+   sfence();
} else if ((cpu_feature & CPUID_CLFSH) != 0 &&
eva - sva < PMAP_CLFLUSH_THRESHOLD) {
 #ifdef DEV_APIC
@@ -5300,12 +5300,14 @@ pmap_flush_page(vm_page_t m)
eva = sva + PAGE_SIZE;
 
/*
-* Use mfence despite the ordering implied by
+* Use mfence or sfence despite the ordering implied by
 * mtx_{un,}lock() because clflush on non-Intel CPUs
 * and clflushopt are not guaranteed to be ordered by
 * any other instruction.
 */
-   if (useclflushopt || cpu_vendor_id != CPU_VENDOR_INTEL)
+   if (useclflushopt)
+   sfence();
+   else if (cpu_vendor_id != CPU_VENDOR_INTEL)
mfence();
for (; sva < eva; sva += cpu_clflush_line_size) {

svn commit: r312554 - head/lib/libc/sys

2017-01-20 Thread Maxim Sobolev
Author: sobomax
Date: Fri Jan 20 18:37:14 2017
New Revision: 312554
URL: https://svnweb.freebsd.org/changeset/base/312554

Log:
  Improve wording around SO_TS_CLOCK documentation.
  
  Submitted by: wblock
  Differential Revision:https://reviews.freebsd.org/D9171

Modified:
  head/lib/libc/sys/getsockopt.2

Modified: head/lib/libc/sys/getsockopt.2
==
--- head/lib/libc/sys/getsockopt.2  Fri Jan 20 17:54:24 2017
(r312553)
+++ head/lib/libc/sys/getsockopt.2  Fri Jan 20 18:37:14 2017
(r312554)
@@ -456,10 +456,10 @@ Additional timestamp types are available
 .Dv SO_TIMESTAMP
 with
 .Dv SO_TS_CLOCK ,
-which requests specific timestamp format to be returned instead of
+which requests a specific timestamp format to be returned instead of
 .Dv SCM_TIMESTAMP when
 .Dv SO_TIMESTAMP is enabled.
-The following
+These
 .Dv SO_TS_CLOCK
 values are recognized in
 .Fx :
___
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: r312553 - head/sys/cam/scsi

2017-01-20 Thread Alan Somers
Author: asomers
Date: Fri Jan 20 17:54:24 2017
New Revision: 312553
URL: https://svnweb.freebsd.org/changeset/base/312553

Log:
  Fix "camcontrol timestamp -s" with LTO-7 drives
  
  The length of the scsi_set_timestamp_parameters struct was incorrect.  LTO-5
  drives don't care, but LTO-7 drives do.
  
  Reviewed by:  Sam Klopsch
  MFC after:2 weeks
  Sponsored by: Spectra Logic Corp

Modified:
  head/sys/cam/scsi/scsi_all.h

Modified: head/sys/cam/scsi/scsi_all.h
==
--- head/sys/cam/scsi/scsi_all.hFri Jan 20 17:43:36 2017
(r312552)
+++ head/sys/cam/scsi/scsi_all.hFri Jan 20 17:54:24 2017
(r312553)
@@ -3039,7 +3039,7 @@ struct scsi_set_timestamp_parameters
 {
uint8_t reserved1[4];
uint8_t timestamp[6];
-   uint8_t reserved2[4];
+   uint8_t reserved2[2];
 };
 
 struct scsi_report_timestamp_parameter_data
___
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: r312552 - head/usr.sbin/ctld

2017-01-20 Thread Alexander Motin
Author: mav
Date: Fri Jan 20 17:43:36 2017
New Revision: 312552
URL: https://svnweb.freebsd.org/changeset/base/312552

Log:
  Fix build with ICL_KERNEL_PROXY.
  
  MFC after:2 weeks

Modified:
  head/usr.sbin/ctld/pdu.c

Modified: head/usr.sbin/ctld/pdu.c
==
--- head/usr.sbin/ctld/pdu.cFri Jan 20 17:40:31 2017(r312551)
+++ head/usr.sbin/ctld/pdu.cFri Jan 20 17:43:36 2017(r312552)
@@ -106,9 +106,11 @@ pdu_new_response(struct pdu *request)
 static void
 pdu_receive_proxy(struct pdu *pdu)
 {
+   struct connection *conn;
size_t len;
 
assert(proxy_mode);
+   conn = pdu->pdu_connection;
 
kernel_receive(pdu);
 
@@ -117,7 +119,7 @@ pdu_receive_proxy(struct pdu *pdu)
log_errx(1, "protocol error: non-empty AHS");
 
len = pdu_data_segment_length(pdu);
-   assert(len <= pdu->pdu_connection->conn_max_recv_data_segment_length);
+   assert(len <= (size_t)conn->conn_max_recv_data_segment_length);
pdu->pdu_data_len = len;
 }
 
@@ -185,7 +187,7 @@ pdu_receive(struct pdu *pdu)
 
len = pdu_data_segment_length(pdu);
if (len > 0) {
-   if ((int)len > conn->conn_max_recv_data_segment_length) {
+   if (len > (size_t)conn->conn_max_recv_data_segment_length) {
log_errx(1, "protocol error: received PDU "
"with DataSegmentLength exceeding %d",
conn->conn_max_recv_data_segment_length);
___
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: r312551 - head/sys/kern

2017-01-20 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Jan 20 17:40:31 2017
New Revision: 312551
URL: https://svnweb.freebsd.org/changeset/base/312551

Log:
  Fix for race leading to endless timer interrupts related to
  configtimer().
  
  During normal operation "state->nextcallopt" will always be less than
  or equal to "state->nextcall" and checking only "state->nextcallopt"
  before calling "callout_process()" is sufficient. However when
  "configtimer()" is called a race might happen requiring both of these
  binary times to be checked.
  
  Short description of race:
  
  1) A configtimer() call will reset both "state->nextcall" and
  "state->nextcallopt" to the same binary time.
  
  2) If a "callout_reset()" call happens between "configtimer()" and the
  next "callout_process()" call, "state->nextcallopt" will get updated
  and "state->nextcall" will remain at the current time. Refer to logic
  inside cpu_new_callout().
  
  3) getnextcpuevent() only respects "state->nextcall" and returns this
  value over and over again, even if it is in the past, until "now >=
  state->nextcallopt" becomes true. Then these two time variables are
  corrected by a "callout_process()" call and the situation goes back to
  normal.
  
  The problem manifests itself in different ways. The common factor is
  the timer process(es) consume all CPU on one or more CPU cores for a
  long time, blocking other kernel processes from getting execution
  time. This can be seen by very high interrupt counts as displayed by
  "vmstat -i | grep timer" right after boot.
  
  When EARLY_AP_STARTUP was enabled in r310177 the likelyhood of hitting
  this bug apparently increased.
  
  Example output from "vmstat -i" before patch:
  cpu0:timer  7591 69
  cpu9:timer  39031773 358089
  cpu4:timer  9359 85
  cpu3:timer  9100 83
  cpu2:timer  9620 88
  
  Example output from "vmstat -i" after patch:
  cpu0:timer  4242 34
  cpu6:timer  5531 44
  cpu3:timer  6450 52
  cpu1:timer  4545 36
  cpu9:timer  7153 58
  
  Before the patch cpu9 in the example above, was spinning in a loop in
  order to reach 39 million interrupts just a few seconds after
  bootup. After the patch the timer interrupt counts are more or less
  consistent.
  
  Discussed with:   mav @
  Reported by:  several people
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/kern/kern_clocksource.c

Modified: head/sys/kern/kern_clocksource.c
==
--- head/sys/kern/kern_clocksource.cFri Jan 20 17:39:38 2017
(r312550)
+++ head/sys/kern/kern_clocksource.cFri Jan 20 17:40:31 2017
(r312551)
@@ -207,7 +207,7 @@ handleevents(sbintime_t now, int fake)
}
} else
state->nextprof = state->nextstat;
-   if (now >= state->nextcallopt) {
+   if (now >= state->nextcallopt || now >= state->nextcall) {
state->nextcall = state->nextcallopt = SBT_MAX;
callout_process(now);
}
___
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: r312547 - head/lib/libc/sys

2017-01-20 Thread Warren Block
Author: wblock (doc committer)
Date: Fri Jan 20 17:29:59 2017
New Revision: 312547
URL: https://svnweb.freebsd.org/changeset/base/312547

Log:
  Mention sendfile(2) by popular demand.
  
  Submitted by: alc, kib
  MFC after:1 week
  Sponsored by: iXsystems
  Differential Revision:https://reviews.freebsd.org/D9259

Modified:
  head/lib/libc/sys/shm_open.2

Modified: head/lib/libc/sys/shm_open.2
==
--- head/lib/libc/sys/shm_open.2Fri Jan 20 17:28:52 2017
(r312546)
+++ head/lib/libc/sys/shm_open.2Fri Jan 20 17:29:59 2017
(r312547)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 13, 2017
+.Dd January 20, 2017
 .Dt SHM_OPEN 2
 .Os
 .Sh NAME
@@ -187,6 +187,11 @@ kernel implementation explicitly include
 and
 .Xr write 2 .
 .Pp
+.Fx
+also supports zero-copy transmission of data from shared memory
+objects with
+.Xr sendfile 2 .
+.Pp
 Neither shared memory objects nor their contents persist across reboots.
 .Pp
 Writes do not extend shared memory objects, so
@@ -281,7 +286,8 @@ requires write permission to the shared 
 .Xr fstat 2 ,
 .Xr ftruncate 2 ,
 .Xr mmap 2 ,
-.Xr munmap 2
+.Xr munmap 2 ,
+.Xr sendfile 2
 .Sh STANDARDS
 The
 .Fn shm_open
___
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: r312544 - in head/sys: dev/ixgbe net

2017-01-20 Thread Ryan Stone
Author: rstone
Date: Fri Jan 20 17:16:48 2017
New Revision: 312544
URL: https://svnweb.freebsd.org/changeset/base/312544

Log:
  Fix reference to free memory in ixgbe/if_media.c
  
  When ixgbe receives an interrupt indicating that a new optical module
  may have been inserted, it discards all of its current media types
  by calling ifmedia_removeall() and then creates a new set of media
  types for the supported media on the new module.  However,
  ifmedia_removeall() was maintaining a pointer to whatever the
  current media type was before the call to ifmedia_removealL().
  The result of this was that any attempt to read the current media
  type of the interface (e.g. via ifconfig) would return potentially
  garbage data from free memory (or if one were particularly unlucky
  on an architecture that does not malloc() from a direct map, page
  fault the kernel).
  
  Fix this by NULL'ing out the current media field in if_media.c,
  and have ixgbe update the current media type after recreating
  them.
  
  Submitted by: Matt Joras 
  Reviewed by:  sbruno, erj
  MFC after:1 week
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D9164

Modified:
  head/sys/dev/ixgbe/if_ix.c
  head/sys/net/if_media.c

Modified: head/sys/dev/ixgbe/if_ix.c
==
--- head/sys/dev/ixgbe/if_ix.c  Fri Jan 20 17:14:10 2017(r312543)
+++ head/sys/dev/ixgbe/if_ix.c  Fri Jan 20 17:16:48 2017(r312544)
@@ -3878,6 +3878,7 @@ ixgbe_handle_msf(void *context, int pend
/* Adjust media types shown in ifconfig */
ifmedia_removeall(>media);
ixgbe_add_media_types(adapter);
+   ifmedia_set(>media, IFM_ETHER | IFM_AUTO);
IXGBE_CORE_UNLOCK(adapter);
return;
 }

Modified: head/sys/net/if_media.c
==
--- head/sys/net/if_media.c Fri Jan 20 17:14:10 2017(r312543)
+++ head/sys/net/if_media.c Fri Jan 20 17:16:48 2017(r312544)
@@ -107,6 +107,7 @@ ifmedia_removeall(ifm)
LIST_REMOVE(entry, ifm_list);
free(entry, M_IFADDR);
}
+   ifm->ifm_cur = NULL;
 }
 
 /*
___
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: r312543 - head/usr.sbin/iscsid

2017-01-20 Thread Alexander Motin
Author: mav
Date: Fri Jan 20 17:14:10 2017
New Revision: 312543
URL: https://svnweb.freebsd.org/changeset/base/312543

Log:
  Remove ISCSI_MAX_DATA_SEGMENT_LENGTH, using negotiated value.
  
  MFC after:2 weeks

Modified:
  head/usr.sbin/iscsid/pdu.c

Modified: head/usr.sbin/iscsid/pdu.c
==
--- head/usr.sbin/iscsid/pdu.c  Fri Jan 20 17:03:44 2017(r312542)
+++ head/usr.sbin/iscsid/pdu.c  Fri Jan 20 17:14:10 2017(r312543)
@@ -106,13 +106,15 @@ pdu_new_response(struct pdu *request)
 static void
 pdu_receive_proxy(struct pdu *pdu)
 {
+   struct connection *conn;
struct iscsi_daemon_receive *idr;
size_t len;
int error;
 
-   assert(pdu->pdu_connection->conn_conf.isc_iser != 0);
+   conn = pdu->pdu_connection;
+   assert(conn->conn_conf.isc_iser != 0);
 
-   pdu->pdu_data = malloc(ISCSI_MAX_DATA_SEGMENT_LENGTH);
+   pdu->pdu_data = malloc(conn->conn_max_recv_data_segment_length);
if (pdu->pdu_data == NULL)
log_err(1, "malloc");
 
@@ -120,12 +122,12 @@ pdu_receive_proxy(struct pdu *pdu)
if (idr == NULL)
log_err(1, "calloc");
 
-   idr->idr_session_id = pdu->pdu_connection->conn_session_id;
+   idr->idr_session_id = conn->conn_session_id;
idr->idr_bhs = pdu->pdu_bhs;
-   idr->idr_data_segment_len = ISCSI_MAX_DATA_SEGMENT_LENGTH;
+   idr->idr_data_segment_len = conn->conn_max_recv_data_segment_length;
idr->idr_data_segment = pdu->pdu_data;
 
-   error = ioctl(pdu->pdu_connection->conn_iscsi_fd, ISCSIDRECEIVE, idr);
+   error = ioctl(conn->conn_iscsi_fd, ISCSIDRECEIVE, idr);
if (error != 0)
log_err(1, "ISCSIDRECEIVE");
 
@@ -134,7 +136,7 @@ pdu_receive_proxy(struct pdu *pdu)
log_errx(1, "protocol error: non-empty AHS");
 
len = pdu_data_segment_length(pdu);
-   assert(len <= ISCSI_MAX_DATA_SEGMENT_LENGTH);
+   assert(len <= (size_t)conn->conn_max_recv_data_segment_length);
pdu->pdu_data_len = len;
 
free(idr);
@@ -143,10 +145,12 @@ pdu_receive_proxy(struct pdu *pdu)
 static void
 pdu_send_proxy(struct pdu *pdu)
 {
+   struct connection *conn;
struct iscsi_daemon_send *ids;
int error;
 
-   assert(pdu->pdu_connection->conn_conf.isc_iser != 0);
+   conn = pdu->pdu_connection;
+   assert(conn->conn_conf.isc_iser != 0);
 
pdu_set_data_segment_length(pdu, pdu->pdu_data_len);
 
@@ -154,12 +158,12 @@ pdu_send_proxy(struct pdu *pdu)
if (ids == NULL)
log_err(1, "calloc");
 
-   ids->ids_session_id = pdu->pdu_connection->conn_session_id;
+   ids->ids_session_id = conn->conn_session_id;
ids->ids_bhs = pdu->pdu_bhs;
ids->ids_data_segment_len = pdu->pdu_data_len;
ids->ids_data_segment = pdu->pdu_data;
 
-   error = ioctl(pdu->pdu_connection->conn_iscsi_fd, ISCSIDSEND, ids);
+   error = ioctl(conn->conn_iscsi_fd, ISCSIDSEND, ids);
if (error != 0)
log_err(1, "ISCSIDSEND");
 
@@ -204,18 +208,18 @@ pdu_read(const struct connection *conn, 
 void
 pdu_receive(struct pdu *pdu)
 {
+   struct connection *conn;
size_t len, padding;
char dummy[4];
 
+   conn = pdu->pdu_connection;
 #ifdef ICL_KERNEL_PROXY
-   if (pdu->pdu_connection->conn_conf.isc_iser != 0)
+   if (conn->conn_conf.isc_iser != 0)
return (pdu_receive_proxy(pdu));
 #endif
+   assert(conn->conn_conf.isc_iser == 0);
 
-   assert(pdu->pdu_connection->conn_conf.isc_iser == 0);
-
-   pdu_read(pdu->pdu_connection,
-   (char *)pdu->pdu_bhs, sizeof(*pdu->pdu_bhs));
+   pdu_read(conn, (char *)pdu->pdu_bhs, sizeof(*pdu->pdu_bhs));
 
len = pdu_ahs_length(pdu);
if (len > 0)
@@ -223,10 +227,10 @@ pdu_receive(struct pdu *pdu)
 
len = pdu_data_segment_length(pdu);
if (len > 0) {
-   if (len > ISCSI_MAX_DATA_SEGMENT_LENGTH) {
+   if (len > (size_t)conn->conn_max_recv_data_segment_length) {
log_errx(1, "protocol error: received PDU "
"with DataSegmentLength exceeding %d",
-   ISCSI_MAX_DATA_SEGMENT_LENGTH);
+   conn->conn_max_recv_data_segment_length);
}
 
pdu->pdu_data_len = len;
@@ -234,14 +238,12 @@ pdu_receive(struct pdu *pdu)
if (pdu->pdu_data == NULL)
log_err(1, "malloc");
 
-   pdu_read(pdu->pdu_connection,
-   (char *)pdu->pdu_data, pdu->pdu_data_len);
+   pdu_read(conn, (char *)pdu->pdu_data, pdu->pdu_data_len);
 
padding = pdu_padding(pdu);
if (padding != 0) {
assert(padding < sizeof(dummy));
-   pdu_read(pdu->pdu_connection,
-   

svn commit: r312539 - head/usr.bin/iscsictl

2017-01-20 Thread Alexander Motin
Author: mav
Date: Fri Jan 20 16:01:01 2017
New Revision: 312539
URL: https://svnweb.freebsd.org/changeset/base/312539

Log:
  Remove some unused code.
  
  MFC after:2 weeks

Modified:
  head/usr.bin/iscsictl/iscsictl.c
  head/usr.bin/iscsictl/iscsictl.h

Modified: head/usr.bin/iscsictl/iscsictl.c
==
--- head/usr.bin/iscsictl/iscsictl.cFri Jan 20 15:56:40 2017
(r312538)
+++ head/usr.bin/iscsictl/iscsictl.cFri Jan 20 16:01:01 2017
(r312539)
@@ -704,17 +704,6 @@ usage(void)
exit(1);
 }
 
-char *
-checked_strdup(const char *s)
-{
-   char *c;
-
-   c = strdup(s);
-   if (c == NULL)
-   xo_err(1, "strdup");
-   return (c);
-}
-
 int
 main(int argc, char **argv)
 {

Modified: head/usr.bin/iscsictl/iscsictl.h
==
--- head/usr.bin/iscsictl/iscsictl.hFri Jan 20 15:56:40 2017
(r312538)
+++ head/usr.bin/iscsictl/iscsictl.hFri Jan 20 16:01:01 2017
(r312539)
@@ -40,7 +40,6 @@
 #defineDEFAULT_IQN "iqn.1994-09.org.freebsd:"
 
 #defineMAX_NAME_LEN223
-#defineMAX_DATA_SEGMENT_LENGTH 65536
 
 #defineAUTH_METHOD_UNSPECIFIED 0
 #defineAUTH_METHOD_NONE1
@@ -88,23 +87,6 @@ struct conf {
TAILQ_HEAD(, target)conf_targets;
 };
 
-#defineCONN_SESSION_TYPE_NONE  0
-#defineCONN_SESSION_TYPE_DISCOVERY 1
-#defineCONN_SESSION_TYPE_NORMAL2
-
-struct connection {
-   struct target   *conn_target;
-   int conn_socket;
-   int conn_session_type;
-   uint32_tconn_cmdsn;
-   uint32_tconn_statsn;
-   size_t  conn_max_data_segment_length;
-   size_t  conn_max_burst_length;
-   size_t  conn_max_outstanding_r2t;
-   int conn_header_digest;
-   int conn_data_digest;
-};
-
 struct conf*conf_new(void);
 struct conf*conf_new_from_file(const char *path);
 void   conf_delete(struct conf *conf);
@@ -116,7 +98,6 @@ void target_delete(struct target *ic);
 
 void   print_periphs(int session_id);
 
-char   *checked_strdup(const char *);
 bool   valid_iscsi_name(const char *name);
 intparse_enable(const char *enable);
 
___
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: r312538 - head/sys/sys

2017-01-20 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Jan 20 15:56:40 2017
New Revision: 312538
URL: https://svnweb.freebsd.org/changeset/base/312538

Log:
  Addition of clang nullability qualifiers.
  
  For consistency with the qualifiers added in r310977, define a new
  qualifier _Null_unspecified which is also defined in clang 3.7+.
  
  Add two new macros:
  __NULLABILITY_PRAGMA_PUSH
  __NULLABILITY_PRAGMA_POP
  
  These are for use in headers when we want avoid noisy warnings if
  some pointers are left without nullability annotations.
  
  These are added with way ahead of their first use to teach the GCC
  ports headers of their existance before their first use.

Modified:
  head/sys/sys/cdefs.h

Modified: head/sys/sys/cdefs.h
==
--- head/sys/sys/cdefs.hFri Jan 20 15:47:29 2017(r312537)
+++ head/sys/sys/cdefs.hFri Jan 20 15:56:40 2017(r312538)
@@ -793,6 +793,13 @@
 #if !(defined(__clang__) && __has_feature(nullability))
 #define_Nonnull
 #define_Nullable
+#define_Null_unspecified
+#define__NULLABILITY_PRAGMA_PUSH
+#define__NULLABILITY_PRAGMA_POP
+#else
+#define__NULLABILITY_PRAGMA_PUSH _Pragma("clang diagnostic push")  
\
+   _Pragma("clang diagnostic ignored \"-Wnullability-completeness\"")
+#define__NULLABILITY_PRAGMA_POP _Pragma("clang diagnostic pop")
 #endif
 
 /*
___
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: r312537 - head/sys/dev/mlx5/mlx5_en

2017-01-20 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Jan 20 15:47:29 2017
New Revision: 312537
URL: https://svnweb.freebsd.org/changeset/base/312537

Log:
  Remove superfluous return statement.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cFri Jan 20 15:45:21 2017
(r312536)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cFri Jan 20 15:47:29 2017
(r312537)
@@ -1191,7 +1191,6 @@ done:
mlx5e_tx_notify_hw(sq, sq->doorbell.d32, 0);
sq->doorbell.d64 = 0;
}
-   return;
 }
 
 void
___
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: r312536 - head/sys/dev/mlx5/mlx5_en

2017-01-20 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Jan 20 15:45:21 2017
New Revision: 312536
URL: https://svnweb.freebsd.org/changeset/base/312536

Log:
  Allow transmit packet bufring in software to be disabled.
  
  - Add new sysctl node to control the transmit packet bufring.
  
  - Add optimised version of the transmit routine which output packets
  directly to the DMA ring instead of using bufring in case the transmit
  lock is congested. This can reduce the number of taskswitches which in
  turn influence the overall system CPU usage, depending on the
  workload.
  
  - Add " TX" suffix to debug name for transmit mutexes to silence some
  witness warnings about aquiring duplicate locks having same name.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies
  Suggested by: gallatin @

Modified:
  head/sys/dev/mlx5/mlx5_en/en.h
  head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c

Modified: head/sys/dev/mlx5/mlx5_en/en.h
==
--- head/sys/dev/mlx5/mlx5_en/en.h  Fri Jan 20 15:01:04 2017
(r312535)
+++ head/sys/dev/mlx5/mlx5_en/en.h  Fri Jan 20 15:45:21 2017
(r312536)
@@ -402,6 +402,7 @@ struct mlx5e_params {
   m(+1, u64 tx_coalesce_usecs, "tx_coalesce_usecs", "Limit in usec for joining 
tx packets") \
   m(+1, u64 tx_coalesce_pkts, "tx_coalesce_pkts", "Maximum number of tx 
packets to join") \
   m(+1, u64 tx_coalesce_mode, "tx_coalesce_mode", "0: EQE mode 1: CQE mode") \
+  m(+1, u64 tx_bufring_disable, "tx_bufring_disable", "0: Enable bufring 1: 
Disable bufring") \
   m(+1, u64 tx_completion_fact, "tx_completion_fact", "1..MAX: Completion 
event ratio") \
   m(+1, u64 tx_completion_fact_max, "tx_completion_fact_max", "Maximum 
completion event ratio") \
   m(+1, u64 hw_lro, "hw_lro", "set to enable hw_lro") \

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Fri Jan 20 15:01:04 2017
(r312535)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Fri Jan 20 15:45:21 2017
(r312536)
@@ -352,6 +352,18 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARG
mlx5e_open_locked(priv->ifp);
break;
 
+   case MLX5_PARAM_OFFSET(tx_bufring_disable):
+   /* rangecheck input value */
+   priv->params_ethtool.tx_bufring_disable =
+   priv->params_ethtool.tx_bufring_disable ? 1 : 0;
+
+   /* reconfigure the sendqueues, if any */
+   if (was_opened) {
+   mlx5e_close_locked(priv->ifp);
+   mlx5e_open_locked(priv->ifp);
+   }
+   break;
+
case MLX5_PARAM_OFFSET(tx_completion_fact):
/* network interface must be down */
if (was_opened)

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cFri Jan 20 15:01:04 2017
(r312535)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cFri Jan 20 15:45:21 2017
(r312536)
@@ -439,7 +439,8 @@ mlx5e_update_stats_work(struct work_stru
tso_packets += sq_stats->tso_packets;
tso_bytes += sq_stats->tso_bytes;
tx_queue_dropped += sq_stats->dropped;
-   tx_queue_dropped += sq_br->br_drops;
+   if (sq_br != NULL)
+   tx_queue_dropped += sq_br->br_drops;
tx_defragged += sq_stats->defragged;
tx_offload_none += sq_stats->csum_offload_none;
}
@@ -987,34 +988,37 @@ mlx5e_create_sq(struct mlx5e_channel *c,
sq->priv = priv;
sq->tc = tc;
 
-   sq->br = buf_ring_alloc(MLX5E_SQ_TX_QUEUE_SIZE, M_MLX5EN,
-   M_WAITOK, >lock);
-   if (sq->br == NULL) {
-   if_printf(c->ifp, "%s: Failed allocating sq drbr buffer\n",
-   __func__);
-   err = -ENOMEM;
-   goto err_free_sq_db;
-   }
-
-   sq->sq_tq = taskqueue_create_fast("mlx5e_que", M_WAITOK,
-   taskqueue_thread_enqueue, >sq_tq);
-   if (sq->sq_tq == NULL) {
-   if_printf(c->ifp, "%s: Failed allocating taskqueue\n",
-   __func__);
-   err = -ENOMEM;
-   goto err_free_drbr;
-   }
+   /* check if we should allocate a second packet buffer */
+   if (priv->params_ethtool.tx_bufring_disable == 0) {
+   sq->br = buf_ring_alloc(MLX5E_SQ_TX_QUEUE_SIZE, M_MLX5EN,
+   M_WAITOK, >lock);
+   if (sq->br == NULL) {
+   if_printf(c->ifp, "%s: Failed allocating sq drbr 
buffer\n",
+

svn commit: r312535 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2017-01-20 Thread Josh Paetzel
Author: jpaetzel
Date: Fri Jan 20 15:01:04 2017
New Revision: 312535
URL: https://svnweb.freebsd.org/changeset/base/312535

Log:
  MFV 312436
  
   6569 large file delete can starve out write ops
  
illumos/illumos-gate@ff5177ee8bf9a355131ce2cc61ae2da6a5a6fdd6

https://github.com/illumos/illumos-gate/commit/ff5177ee8bf9a355131ce2cc61ae2da6a5a6fdd6
  
https://www.illumos.org/issues/6569
  The core issue I've found is that there is no throttle for how many
  deletes get assigned to one TXG. As a results when deleting large files
  we end up filling consecutive TXGs with deletes/frees, then write
  throttling other (more important) ops.
  
  There is an easy test case for this problem. Try deleting several
  large files (at least 1/2 TB) while you do write ops on the same
  pool. What we've seen is performance of these write ops (let's
  call it sideload I/O) would drop to zero.
  
  More specifically the problem is that dmu_free_long_range_impl()
  can/will fill up all of the dirty data in the pool "instantly",
  before many of the sideload ops can get in. So sideload
  performance will be impacted until all the files are freed.
  
  The solution we have tested at Nexenta (with positive results)
  creates a relatively simple throttle for how many "free" ops we let
  into one TXG.
  
  However this solution exposes other problems that should also be
  addressed. If we are to slow down freeing of data that means one
  has to wait even longer (assuming vnode ref count of 1) to get shell
  back after an rm or for NFS thread to finish the free-ing op.
  To avoid this the proposed solution is to call zfs_inactive() async
  for "large" files. Async freeing then begs for the reclaimed space
  to be accounted for in the zpool's "freeing" prop.
  
  The other issue with having a longer delete is the inability to
  export/unmount for a longer period of time. The proposed solution
  is to interrupt freeing of blocks when a fs is unmounted.
  
Author: Alek Pinchuk 
Reviewed by: Matt Ahrens 
Reviewed by: Sanjay Nadkarni 
Reviewed by: Pavel Zakharov 
Approved by: Dan McDonald 
  
  Reviewed by:  avg
  Differential Revision:D9008

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c   Fri Jan 20 
14:59:56 2017(r312534)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c   Fri Jan 20 
15:01:04 2017(r312535)
@@ -60,6 +60,16 @@ SYSCTL_DECL(_vfs_zfs);
 SYSCTL_INT(_vfs_zfs, OID_AUTO, nopwrite_enabled, CTLFLAG_RDTUN,
 _nopwrite_enabled, 0, "Enable nopwrite feature");
 
+/*
+ * Tunable to control percentage of dirtied blocks from frees in one TXG.
+ * After this threshold is crossed, additional dirty blocks from frees
+ * wait until the next TXG.
+ * A value of zero will disable this throttle.
+ */
+uint32_t zfs_per_txg_dirty_frees_percent = 30;
+SYSCTL_INT(_vfs_zfs, OID_AUTO, per_txg_dirty_frees_percent, CTLFLAG_RWTUN,
+   _per_txg_dirty_frees_percent, 0, "Percentage of dirtied blocks from 
frees in one txg");
+
 const dmu_object_type_info_t dmu_ot[DMU_OT_NUMTYPES] = {
{   DMU_BSWAP_UINT8,TRUE,   "unallocated"   },
{   DMU_BSWAP_ZAP,  TRUE,   "object directory"  },
@@ -718,15 +728,25 @@ dmu_free_long_range_impl(objset_t *os, d
 {
uint64_t object_size = (dn->dn_maxblkid + 1) * dn->dn_datablksz;
int err;
+   uint64_t dirty_frees_threshold;
+   dsl_pool_t *dp = dmu_objset_pool(os);
 
if (offset >= object_size)
return (0);
 
+   if (zfs_per_txg_dirty_frees_percent <= 100)
+   dirty_frees_threshold =
+   zfs_per_txg_dirty_frees_percent * zfs_dirty_data_max / 100;
+   else
+   dirty_frees_threshold = zfs_dirty_data_max / 4;
+
if (length == DMU_OBJECT_END || offset + length > object_size)
length = object_size - offset;
 
while (length != 0) {
-   uint64_t chunk_end, chunk_begin;
+   uint64_t chunk_end, chunk_begin, chunk_len;
+   uint64_t long_free_dirty_all_txgs = 0;
+   dmu_tx_t *tx;
 
chunk_end = chunk_begin = offset + length;
 
@@ -737,9 +757,28 @@ dmu_free_long_range_impl(objset_t *os, d
ASSERT3U(chunk_begin, >=, offset);
ASSERT3U(chunk_begin, <=, 

svn commit: r312534 - head/sys/kern

2017-01-20 Thread Ed Maste
Author: emaste
Date: Fri Jan 20 14:59:56 2017
New Revision: 312534
URL: https://svnweb.freebsd.org/changeset/base/312534

Log:
  ANSYfy kern_ktrace.c and remove archaic register keyword
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/kern_ktrace.c

Modified: head/sys/kern/kern_ktrace.c
==
--- head/sys/kern/kern_ktrace.c Fri Jan 20 13:49:04 2017(r312533)
+++ head/sys/kern/kern_ktrace.c Fri Jan 20 14:59:56 2017(r312534)
@@ -437,9 +437,7 @@ ktr_freeproc(struct proc *p, struct ucre
 }
 
 void
-ktrsyscall(code, narg, args)
-   int code, narg;
-   register_t args[];
+ktrsyscall(int code, int narg, register_t args[])
 {
struct ktr_request *req;
struct ktr_syscall *ktp;
@@ -468,9 +466,7 @@ ktrsyscall(code, narg, args)
 }
 
 void
-ktrsysret(code, error, retval)
-   int code, error;
-   register_t retval;
+ktrsysret(int code, int error, register_t retval)
 {
struct ktr_request *req;
struct ktr_sysret *ktp;
@@ -637,9 +633,7 @@ ktrnamei(path)
 }
 
 void
-ktrsysctl(name, namelen)
-   int *name;
-   u_int namelen;
+ktrsysctl(int *name, u_int namelen)
 {
struct ktr_request *req;
u_int mib[CTL_MAXNAME + 2];
@@ -671,11 +665,7 @@ ktrsysctl(name, namelen)
 }
 
 void
-ktrgenio(fd, rw, uio, error)
-   int fd;
-   enum uio_rw rw;
-   struct uio *uio;
-   int error;
+ktrgenio(int fd, enum uio_rw rw, struct uio *uio, int error)
 {
struct ktr_request *req;
struct ktr_genio *ktg;
@@ -710,11 +700,7 @@ ktrgenio(fd, rw, uio, error)
 }
 
 void
-ktrpsig(sig, action, mask, code)
-   int sig;
-   sig_t action;
-   sigset_t *mask;
-   int code;
+ktrpsig(int sig, sig_t action, sigset_t *mask, int code)
 {
struct thread *td = curthread;
struct ktr_request *req;
@@ -733,9 +719,7 @@ ktrpsig(sig, action, mask, code)
 }
 
 void
-ktrcsw(out, user, wmesg)
-   int out, user;
-   const char *wmesg;
+ktrcsw(int out, int user, const char *wmesg)
 {
struct thread *td = curthread;
struct ktr_request *req;
@@ -756,10 +740,7 @@ ktrcsw(out, user, wmesg)
 }
 
 void
-ktrstruct(name, data, datalen)
-   const char *name;
-   void *data;
-   size_t datalen;
+ktrstruct(const char *name, void *data, size_t datalen)
 {
struct ktr_request *req;
char *buf;
@@ -782,10 +763,8 @@ ktrstruct(name, data, datalen)
 }
 
 void
-ktrcapfail(type, needed, held)
-   enum ktr_cap_fail_type type;
-   const cap_rights_t *needed;
-   const cap_rights_t *held;
+ktrcapfail(enum ktr_cap_fail_type type, const cap_rights_t *needed,
+const cap_rights_t *held)
 {
struct thread *td = curthread;
struct ktr_request *req;
@@ -809,9 +788,7 @@ ktrcapfail(type, needed, held)
 }
 
 void
-ktrfault(vaddr, type)
-   vm_offset_t vaddr;
-   int type;
+ktrfault(vm_offset_t vaddr, int type)
 {
struct thread *td = curthread;
struct ktr_request *req;
@@ -828,8 +805,7 @@ ktrfault(vaddr, type)
 }
 
 void
-ktrfaultend(result)
-   int result;
+ktrfaultend(int result)
 {
struct thread *td = curthread;
struct ktr_request *req;
@@ -857,13 +833,11 @@ struct ktrace_args {
 #endif
 /* ARGSUSED */
 int
-sys_ktrace(td, uap)
-   struct thread *td;
-   register struct ktrace_args *uap;
+sys_ktrace(struct thread *td, struct ktrace_args *uap)
 {
 #ifdef KTRACE
-   register struct vnode *vp = NULL;
-   register struct proc *p;
+   struct vnode *vp = NULL;
+   struct proc *p;
struct pgrp *pg;
int facs = uap->facs & ~KTRFAC_ROOT;
int ops = KTROP(uap->ops);
@@ -1002,9 +976,7 @@ done:
 
 /* ARGSUSED */
 int
-sys_utrace(td, uap)
-   struct thread *td;
-   register struct utrace_args *uap;
+sys_utrace(struct thread *td, struct utrace_args *uap)
 {
 
 #ifdef KTRACE
@@ -1038,11 +1010,7 @@ sys_utrace(td, uap)
 
 #ifdef KTRACE
 static int
-ktrops(td, p, ops, facs, vp)
-   struct thread *td;
-   struct proc *p;
-   int ops, facs;
-   struct vnode *vp;
+ktrops(struct thread *td, struct proc *p, int ops, int facs, struct vnode *vp)
 {
struct vnode *tracevp = NULL;
struct ucred *tracecred = NULL;
@@ -1093,14 +1061,11 @@ ktrops(td, p, ops, facs, vp)
 }
 
 static int
-ktrsetchildren(td, top, ops, facs, vp)
-   struct thread *td;
-   struct proc *top;
-   int ops, facs;
-   struct vnode *vp;
+ktrsetchildren(struct thread *td, struct proc *top, int ops, int facs,
+struct vnode *vp)
 {
-   register struct proc *p;
-   register int ret = 0;
+   struct proc *p;
+   int ret = 0;
 
p = top;
PROC_LOCK_ASSERT(p, MA_OWNED);
@@ -1260,9 +1225,7 @@ ktr_writerequest(struct thread *td, stru
  * so, only root may further change it.
  */
 static int
-ktrcanset(td, targetp)
-   struct thread *td;
-   struct proc *targetp;
+ktrcanset(struct 

svn commit: r312533 - head/sys/geom/multipath

2017-01-20 Thread Alexander Motin
Author: mav
Date: Fri Jan 20 13:49:04 2017
New Revision: 312533
URL: https://svnweb.freebsd.org/changeset/base/312533

Log:
  Report disk addition errors on `add` or `create` subcommand.
  
  MFC after:1 week

Modified:
  head/sys/geom/multipath/g_multipath.c

Modified: head/sys/geom/multipath/g_multipath.c
==
--- head/sys/geom/multipath/g_multipath.c   Fri Jan 20 13:39:07 2017
(r312532)
+++ head/sys/geom/multipath/g_multipath.c   Fri Jan 20 13:49:04 2017
(r312533)
@@ -923,6 +923,7 @@ g_multipath_ctl_add_name(struct gctl_req
struct g_provider *pp;
const char *mpname;
static const char devpf[6] = "/dev/";
+   int error;
 
g_topology_assert();
 
@@ -972,10 +973,9 @@ g_multipath_ctl_add_name(struct gctl_req
return;
}
 
-   /*
-* Now add
-*/
-   (void) g_multipath_add_disk(gp, pp);
+   error = g_multipath_add_disk(gp, pp);
+   if (error != 0)
+   gctl_error(req, "Provider addition error: %d", error);
 }
 
 static void
___
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: r312532 - head/sys/kern

2017-01-20 Thread Andriy Gapon
Author: avg
Date: Fri Jan 20 13:39:07 2017
New Revision: 312532
URL: https://svnweb.freebsd.org/changeset/base/312532

Log:
  don't abort writing of a core dump after EFAULT
  
  It's possible to get EFAULT when writing a segment backed by a file
  if the segment extends beyond the file.
  The core dump could still be useful if we skip the rest of the segment
  and proceed to other segements.
  The skipped segment (or a portion of it) will be zero-filled.
  
  While there, use 'const' to signify that core_write() only reads the
  buffer and use __DECONST before calling vn_rdwr_inchunks() because it
  can be used for both reading and writing.
  
  Before the change:
  kernel: Failed to write core file for process mmap_trunc_core (error 14)
  kernel: pid 77718 (mmap_trunc_core), uid 1001: exited on signal 6
  
  After the change:
  kernel: Failed to fully fault in a core file segment at VA 0x800645000 with 
size 0x4000 to be written at offset 0x29000 for process mmap_trunc_core
  kernel: pid 4901 (mmap_trunc_core), uid 1001: exited on signal 6 (core dumped)
  
  Reviewed by:  julian, kib
  Obtained from:Panzura (older version of the change)
  MFC after:5 days
  Sponsored by: Panzura
  Differential Revision: https://reviews.freebsd.org/D9233

Modified:
  head/sys/kern/imgact_elf.c

Modified: head/sys/kern/imgact_elf.c
==
--- head/sys/kern/imgact_elf.c  Fri Jan 20 13:21:27 2017(r312531)
+++ head/sys/kern/imgact_elf.c  Fri Jan 20 13:39:07 2017(r312532)
@@ -1160,7 +1160,7 @@ struct coredump_params {
 
 static void cb_put_phdr(vm_map_entry_t, void *);
 static void cb_size_segment(vm_map_entry_t, void *);
-static int core_write(struct coredump_params *, void *, size_t, off_t,
+static int core_write(struct coredump_params *, const void *, size_t, off_t,
 enum uio_seg);
 static void each_dumpable_segment(struct thread *, segment_callback, void *);
 static int __elfN(corehdr)(struct coredump_params *, int, void *, size_t,
@@ -1202,7 +1202,14 @@ compress_chunk(struct coredump_params *p
 
while (len > 0) {
chunk_len = MIN(len, CORE_BUF_SIZE);
-   copyin(base, buf, chunk_len);
+
+   /*
+* We can get EFAULT error here.
+* In that case zero out the current chunk of the segment.
+*/
+   error = copyin(base, buf, chunk_len);
+   if (error != 0)
+   bzero(buf, chunk_len);
error = gzio_write(p->gzs, buf, chunk_len);
if (error != 0)
break;
@@ -1222,12 +1229,12 @@ core_gz_write(void *base, size_t len, of
 #endif /* GZIO */
 
 static int
-core_write(struct coredump_params *p, void *base, size_t len, off_t offset,
-enum uio_seg seg)
+core_write(struct coredump_params *p, const void *base, size_t len,
+off_t offset, enum uio_seg seg)
 {
 
-   return (vn_rdwr_inchunks(UIO_WRITE, p->vp, base, len, offset,
-   seg, IO_UNIT | IO_DIRECT | IO_RANGELOCKED,
+   return (vn_rdwr_inchunks(UIO_WRITE, p->vp, __DECONST(void *, base),
+   len, offset, seg, IO_UNIT | IO_DIRECT | IO_RANGELOCKED,
p->active_cred, p->file_cred, NULL, p->td));
 }
 
@@ -1235,12 +1242,32 @@ static int
 core_output(void *base, size_t len, off_t offset, struct coredump_params *p,
 void *tmpbuf)
 {
+   int error;
 
 #ifdef GZIO
if (p->gzs != NULL)
return (compress_chunk(p, base, tmpbuf, len));
 #endif
-   return (core_write(p, base, len, offset, UIO_USERSPACE));
+   /*
+* EFAULT is a non-fatal error that we can get, for example,
+* if the segment is backed by a file but extends beyond its
+* end.
+*/
+   error = core_write(p, base, len, offset, UIO_USERSPACE);
+   if (error == EFAULT) {
+   log(LOG_WARNING, "Failed to fully fault in a core file segment "
+   "at VA %p with size 0x%zx to be written at offset 0x%jx "
+   "for process %s\n", base, len, offset, curproc->p_comm);
+
+   /*
+* Write a "real" zero byte at the end of the target region
+* in the case this is the last segment.
+* The intermediate space will be implicitly zero-filled.
+*/
+   error = core_write(p, zero_region, 1, offset + len - 1,
+   UIO_SYSSPACE);
+   }
+   return (error);
 }
 
 /*
___
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: r312531 - head/sys/amd64/vmm

2017-01-20 Thread Andriy Gapon
Author: avg
Date: Fri Jan 20 13:21:27 2017
New Revision: 312531
URL: https://svnweb.freebsd.org/changeset/base/312531

Log:
  vmm_dev: work around a bogus error with gcc 6.3.0
  
  The error is:
  vmm_dev.c: In function 'alloc_memseg':
  vmm_dev.c:261:11: error: null argument where non-null required (argument 1) 
[-Werror=nonnull]
  
  Apparently, the gcc is unable to figure out that if a ternary operator
  produced a non-NULL value once, then the operator with exactly the same
  operands would produce the same value again.
  
  MFC after:1 week

Modified:
  head/sys/amd64/vmm/vmm_dev.c

Modified: head/sys/amd64/vmm/vmm_dev.c
==
--- head/sys/amd64/vmm/vmm_dev.cFri Jan 20 13:01:25 2017
(r312530)
+++ head/sys/amd64/vmm/vmm_dev.cFri Jan 20 13:21:27 2017
(r312531)
@@ -258,7 +258,7 @@ alloc_memseg(struct vmmdev_softc *sc, st
if (VM_MEMSEG_NAME(mseg)) {
sysmem = false;
name = malloc(SPECNAMELEN + 1, M_VMMDEV, M_WAITOK);
-   error = copystr(VM_MEMSEG_NAME(mseg), name, SPECNAMELEN + 1, 0);
+   error = copystr(mseg->name, name, SPECNAMELEN + 1, 0);
if (error)
goto done;
}
___
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: r312528 - head/sys/dev/mlx5/mlx5_en

2017-01-20 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Jan 20 12:02:40 2017
New Revision: 312528
URL: https://svnweb.freebsd.org/changeset/base/312528

Log:
  Make draining a sendqueue more robust.
  
  Add own state variable to track if a sendqueue is stopped or not.
  This will prevent traffic from entering the sendqueue while it is
  being destroyed.
  
  Update drain function to wait for traffic to be transmitted before
  returning when the link state is active.
  
  Add extra checks in transmit path for stopped SQ's.
  
  While at it:
  - Use likely() for a mbuf pointer check.
  - Remove redundant IFF_DRV_RUNNING check.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_en/en.h
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c

Modified: head/sys/dev/mlx5/mlx5_en/en.h
==
--- head/sys/dev/mlx5/mlx5_en/en.h  Fri Jan 20 11:11:49 2017
(r312527)
+++ head/sys/dev/mlx5/mlx5_en/en.h  Fri Jan 20 12:02:40 2017
(r312528)
@@ -507,10 +507,11 @@ struct mlx5e_sq {
u16 bf_offset;
u16 cev_counter;/* completion event counter */
u16 cev_factor; /* completion event factor */
-   u32 cev_next_state; /* next completion event state */
+   u16 cev_next_state; /* next completion event state */
 #defineMLX5E_CEV_STATE_INITIAL 0   /* timer not started */
 #defineMLX5E_CEV_STATE_SEND_NOPS 1 /* send NOPs */
 #defineMLX5E_CEV_STATE_HOLD_NOPS 2 /* don't send NOPs yet */
+   u16 stopped;/* set if SQ is stopped */
struct callout cev_callout;
union {
u32 d32[2];

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cFri Jan 20 11:11:49 2017
(r312527)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cFri Jan 20 12:02:40 2017
(r312528)
@@ -1219,8 +1219,25 @@ mlx5e_sq_cev_timeout(void *arg)
 void
 mlx5e_drain_sq(struct mlx5e_sq *sq)
 {
+   int error;
+
+   /*
+* Check if already stopped.
+*
+* NOTE: The "stopped" variable is only written when both the
+* priv's configuration lock and the SQ's lock is locked. It
+* can therefore safely be read when only one of the two locks
+* is locked. This function is always called when the priv's
+* configuration lock is locked.
+*/
+   if (sq->stopped != 0)
+   return;
 
mtx_lock(>lock);
+
+   /* don't put more packets into the SQ */
+   sq->stopped = 1;
+
/* teardown event factor timer, if any */
sq->cev_next_state = MLX5E_CEV_STATE_HOLD_NOPS;
callout_stop(>cev_callout);
@@ -1232,14 +1249,29 @@ mlx5e_drain_sq(struct mlx5e_sq *sq)
/* make sure it is safe to free the callout */
callout_drain(>cev_callout);
 
+   /* wait till SQ is empty or link is down */
+   mtx_lock(>lock);
+   while (sq->cc != sq->pc &&
+   (sq->priv->media_status_last & IFM_ACTIVE) != 0) {
+   mtx_unlock(>lock);
+   msleep(1);
+   sq->cq.mcq.comp(>cq.mcq);
+   mtx_lock(>lock);
+   }
+   mtx_unlock(>lock);
+
/* error out remaining requests */
-   mlx5e_modify_sq(sq, MLX5_SQC_STATE_RDY, MLX5_SQC_STATE_ERR);
+   error = mlx5e_modify_sq(sq, MLX5_SQC_STATE_RDY, MLX5_SQC_STATE_ERR);
+   if (error != 0) {
+   if_printf(sq->ifp,
+   "mlx5e_modify_sq() from RDY to ERR failed: %d\n", error);
+   }
 
/* wait till SQ is empty */
mtx_lock(>lock);
while (sq->cc != sq->pc) {
mtx_unlock(>lock);
-   msleep(4);
+   msleep(1);
sq->cq.mcq.comp(>cq.mcq);
mtx_lock(>lock);
}

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c  Fri Jan 20 11:11:49 2017
(r312527)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c  Fri Jan 20 12:02:40 2017
(r312528)
@@ -81,11 +81,15 @@ static struct mlx5e_sq *
 mlx5e_select_queue(struct ifnet *ifp, struct mbuf *mb)
 {
struct mlx5e_priv *priv = ifp->if_softc;
+   struct mlx5e_channel * volatile *ppch;
+   struct mlx5e_channel *pch;
u32 ch;
u32 tc;
 
+   ppch = priv->channel;
+
/* check if channels are successfully opened */
-   if (unlikely(priv->channel == NULL))
+   if (unlikely(ppch == NULL))
return (NULL);
 
/* obtain VLAN information if present */
@@ -123,11 +127,11 @@ mlx5e_select_queue(struct ifnet *ifp, st
 #endif
}
 
-   /* check if 

svn commit: r312527 - in head/sys/dev/mlx5: . mlx5_core mlx5_en

2017-01-20 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Jan 20 11:11:49 2017
New Revision: 312527
URL: https://svnweb.freebsd.org/changeset/base/312527

Log:
  Add runtime support for modifying the SQ and RQ completion event
  moderation mode. The presence of this feature is indicated through the
  firmware capabilities.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx5/cq.h
  head/sys/dev/mlx5/mlx5_core/mlx5_cq.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c

Modified: head/sys/dev/mlx5/cq.h
==
--- head/sys/dev/mlx5/cq.h  Fri Jan 20 10:47:32 2017(r312526)
+++ head/sys/dev/mlx5/cq.h  Fri Jan 20 11:11:49 2017(r312527)
@@ -88,6 +88,7 @@ enum {
MLX5_CQ_MODIFY_PERIOD   = 1 << 0,
MLX5_CQ_MODIFY_COUNT= 1 << 1,
MLX5_CQ_MODIFY_OVERRUN  = 1 << 2,
+   MLX5_CQ_MODIFY_PERIOD_MODE = 1 << 4,
 };
 
 enum {
@@ -165,6 +166,11 @@ int mlx5_core_modify_cq(struct mlx5_core
 int mlx5_core_modify_cq_moderation(struct mlx5_core_dev *dev,
   struct mlx5_core_cq *cq, u16 cq_period,
   u16 cq_max_count);
+int mlx5_core_modify_cq_moderation_mode(struct mlx5_core_dev *dev,
+   struct mlx5_core_cq *cq,
+   u16 cq_period,
+   u16 cq_max_count,
+   u8 cq_mode);
 int mlx5_debug_cq_add(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq);
 void mlx5_debug_cq_remove(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq);
 

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_cq.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_cq.c   Fri Jan 20 10:47:32 2017
(r312526)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_cq.c   Fri Jan 20 11:11:49 2017
(r312527)
@@ -266,6 +266,28 @@ int mlx5_core_modify_cq_moderation(struc
return mlx5_core_modify_cq(dev, cq, , sizeof(in));
 }
 
+int mlx5_core_modify_cq_moderation_mode(struct mlx5_core_dev *dev,
+   struct mlx5_core_cq *cq,
+   u16 cq_period,
+   u16 cq_max_count,
+   u8 cq_mode)
+{
+   struct mlx5_modify_cq_mbox_in in;
+
+   memset(, 0, sizeof(in));
+
+   in.cqn  = cpu_to_be32(cq->cqn);
+   in.ctx.cq_period= cpu_to_be16(cq_period);
+   in.ctx.cq_max_count = cpu_to_be16(cq_max_count);
+   in.ctx.cqe_sz_flags = (cq_mode & 2) >> 1;
+   in.ctx.st   = (cq_mode & 1) << 7;
+   in.field_select = cpu_to_be32(MLX5_CQ_MODIFY_PERIOD |
+ MLX5_CQ_MODIFY_COUNT |
+ MLX5_CQ_MODIFY_PERIOD_MODE);
+
+   return mlx5_core_modify_cq(dev, cq, , sizeof(in));
+}
+
 int mlx5_init_cq_table(struct mlx5_core_dev *dev)
 {
struct mlx5_cq_table *table = >priv.cq_table;

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Fri Jan 20 10:47:32 2017
(r312526)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Fri Jan 20 11:11:49 2017
(r312527)
@@ -92,6 +92,7 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARG
 {
struct mlx5e_priv *priv = arg1;
uint64_t value;
+   int mode_modify;
int was_opened;
int error;
 
@@ -114,6 +115,7 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARG
goto done;
}
was_opened = test_bit(MLX5E_STATE_OPENED, >state);
+   mode_modify = MLX5_CAP_GEN(priv->mdev, cq_period_mode_modify);
 
switch (MLX5_PARAM_OFFSET(arg[arg2])) {
case MLX5_PARAM_OFFSET(rx_coalesce_usecs):
@@ -266,7 +268,7 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARG
 
case MLX5_PARAM_OFFSET(rx_coalesce_mode):
/* network interface must be down */
-   if (was_opened)
+   if (was_opened != 0 && mode_modify == 0)
mlx5e_close_locked(priv->ifp);
 
/* import RX coalesce mode */
@@ -276,13 +278,17 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARG
priv->params_ethtool.rx_coalesce_mode;
 
/* restart network interface, if any */
-   if (was_opened)
-   mlx5e_open_locked(priv->ifp);
+   if (was_opened != 0) {
+   if (mode_modify == 0)
+   mlx5e_open_locked(priv->ifp);
+   else
+   error = mlx5e_refresh_channel_params(priv);
+   }
break;
 
case MLX5_PARAM_OFFSET(tx_coalesce_mode):
 

svn commit: r312526 - head/sys/dev/mlx5

2017-01-20 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Jan 20 10:47:32 2017
New Revision: 312526
URL: https://svnweb.freebsd.org/changeset/base/312526

Log:
  Update firmware interface structures and definitions adding support
  for new features and commands.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_ifc.h

Modified: head/sys/dev/mlx5/mlx5_ifc.h
==
--- head/sys/dev/mlx5/mlx5_ifc.hFri Jan 20 10:13:40 2017
(r312525)
+++ head/sys/dev/mlx5/mlx5_ifc.hFri Jan 20 10:47:32 2017
(r312526)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2013-2015, Mellanox Technologies, Ltd.  All rights reserved.
+ * Copyright (c) 2013-2017, Mellanox Technologies, Ltd.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -23,13 +23,8 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD$
+ */
 
-   Autogenerated file.
-   Date: 2015-04-13 14:59
-   Source Document Name: Mellanox 
-   Source Document Version: 0.28
-   Generated by adb_to_c.py (EAT.ME Version: 1.0.70)
-*/
 #ifndef MLX5_IFC_H
 #define MLX5_IFC_H
 
@@ -56,6 +51,8 @@ enum {
MLX5_EVENT_TYPE_CODING_TEMP_WARNING_EVENT  = 0x17,
MLX5_EVENT_TYPE_REMOTE_CONFIG  = 0x19,
MLX5_EVENT_TYPE_CODING_DCBX_CHANGE_EVENT   = 0x1e,
+   MLX5_EVENT_TYPE_CODING_PPS_EVENT   = 0x25,
+   MLX5_EVENT_TYPE_CODING_GENERAL_NOTIFICATION_EVENT  = 0x22,
MLX5_EVENT_TYPE_DB_BF_CONGESTION   = 0x1a,
MLX5_EVENT_TYPE_STALL_EVENT= 0x1b,
MLX5_EVENT_TYPE_DROPPED_PACKET_LOGGED_EVENT= 0x1f,
@@ -89,6 +86,8 @@ enum {
MLX5_CMD_OP_QUERY_ISSI= 0x10a,
MLX5_CMD_OP_SET_ISSI  = 0x10b,
MLX5_CMD_OP_SET_DRIVER_VERSION= 0x10d,
+   MLX5_CMD_OP_QUERY_OTHER_HCA_CAP   = 0x10e,
+   MLX5_CMD_OP_MODIFY_OTHER_HCA_CAP  = 0x10f,
MLX5_CMD_OP_CREATE_MKEY   = 0x200,
MLX5_CMD_OP_QUERY_MKEY= 0x201,
MLX5_CMD_OP_DESTROY_MKEY  = 0x202,
@@ -190,6 +189,12 @@ enum {
MLX5_CMD_OP_DELETE_L2_TABLE_ENTRY = 0x82b,
MLX5_CMD_OP_SET_WOL_ROL   = 0x830,
MLX5_CMD_OP_QUERY_WOL_ROL = 0x831,
+   MLX5_CMD_OP_CREATE_LAG= 0x840,
+   MLX5_CMD_OP_MODIFY_LAG= 0x841,
+   MLX5_CMD_OP_QUERY_LAG = 0x842,
+   MLX5_CMD_OP_DESTROY_LAG   = 0x843,
+   MLX5_CMD_OP_CREATE_VPORT_LAG  = 0x844,
+   MLX5_CMD_OP_DESTROY_VPORT_LAG = 0x845,
MLX5_CMD_OP_CREATE_TIR= 0x900,
MLX5_CMD_OP_MODIFY_TIR= 0x901,
MLX5_CMD_OP_DESTROY_TIR   = 0x902,
@@ -206,6 +211,8 @@ enum {
MLX5_CMD_OP_MODIFY_RMP= 0x90d,
MLX5_CMD_OP_DESTROY_RMP   = 0x90e,
MLX5_CMD_OP_QUERY_RMP = 0x90f,
+   MLX5_CMD_OP_SET_DELAY_DROP_PARAMS = 0x910,
+   MLX5_CMD_OP_QUERY_DELAY_DROP_PARAMS   = 0x911,
MLX5_CMD_OP_CREATE_TIS= 0x912,
MLX5_CMD_OP_MODIFY_TIS= 0x913,
MLX5_CMD_OP_DESTROY_TIS   = 0x914,
@@ -226,7 +233,10 @@ enum {
MLX5_CMD_OP_DELETE_FLOW_TABLE_ENTRY   = 0x938,
MLX5_CMD_OP_ALLOC_FLOW_COUNTER= 0x939,
MLX5_CMD_OP_DEALLOC_FLOW_COUNTER  = 0x93a,
-   MLX5_CMD_OP_QUERY_FLOW_COUNTER= 0x93b
+   MLX5_CMD_OP_QUERY_FLOW_COUNTER= 0x93b,
+   MLX5_CMD_OP_MODIFY_FLOW_TABLE = 0x93c,
+   MLX5_CMD_OP_ALLOC_ENCAP_HEADER= 0x93d,
+   MLX5_CMD_OP_DEALLOC_ENCAP_HEADER  = 0x93e,
 };
 
 enum {
@@ -271,7 +281,11 @@ struct mlx5_ifc_flow_table_fields_suppor
u8 outer_gre_protocol[0x1];
u8 outer_gre_key[0x1];
u8 outer_vxlan_vni[0x1];
-   u8 reserved_2[0x5];
+   u8 outer_geneve_vni[0x1];
+   u8 outer_geneve_oam[0x1];
+   u8 outer_geneve_protocol_type[0x1];
+   u8 outer_geneve_opt_len[0x1];
+   u8 reserved_2[0x1];
u8 source_eswitch_port[0x1];
 
u8 inner_dmac[0x1];
@@ -299,10 +313,12 @@ struct mlx5_ifc_flow_table_fields_suppor
u8 inner_tcp_flags[0x1];
u8 reserved_5[0x9];
 
-   u8 reserved_6[0x1f];
+   u8 reserved_6[0x1a];
+   u8 bth_dst_qp[0x1];
+   u8 reserved_7[0x4];
u8 source_sqn[0x1];
 
-   u8 

svn commit: r312523 - head/usr.bin/cut/tests

2017-01-20 Thread Ngie Cooper
Author: ngie
Date: Fri Jan 20 08:00:36 2017
New Revision: 312523
URL: https://svnweb.freebsd.org/changeset/base/312523

Log:
  Add some basic -s flag testcases for cut(1)
  
  The remaining functionality seems to be covered in one form or
  another via the NetBSD ATF testcase.
  
  MFC after:3 weeks
  Sponsored by: Dell EMC Isilon

Added:
  head/usr.bin/cut/tests/cut2_test.sh   (contents, props changed)
Modified:
  head/usr.bin/cut/tests/Makefile

Modified: head/usr.bin/cut/tests/Makefile
==
--- head/usr.bin/cut/tests/Makefile Fri Jan 20 07:43:40 2017
(r312522)
+++ head/usr.bin/cut/tests/Makefile Fri Jan 20 08:00:36 2017
(r312523)
@@ -2,6 +2,7 @@
 
 PACKAGE=   tests
 
+ATF_TESTS_SH+= cut2_test
 NETBSD_ATF_TESTS_SH=   cut_test
 
 ${PACKAGE}FILES=   d_basic.out

Added: head/usr.bin/cut/tests/cut2_test.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/cut/tests/cut2_test.sh Fri Jan 20 08:00:36 2017
(r312523)
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 2017 Dell EMC
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+atf_test_case s_flag
+s_flag_head()
+{
+   atf_set "descr" "Check -s flag"
+}
+
+s_flag_body()
+{
+   cat >input