Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool

2018-05-30 Thread Hans Petter Selasky

On 05/30/18 08:04, Antoine Brodin wrote:

On Mon, May 28, 2018 at 10:12 AM, Hans Petter Selasky
 wrote:

Author: hselasky
Date: Mon May 28 08:12:18 2018
New Revision: 334277
URL: https://svnweb.freebsd.org/changeset/base/334277

Log:
   MFV r333789: libpcap 1.9.0 (pre-release)

   MFC after:1 month
   Sponsored by: Mellanox Technologies


Hi,

Some things seem to be missing.
For instance,  pcap_setsampling and pcap_open are now declared in
pcap.h but they are not compiled in libpcap.so.
net/p5-Net-Pcap is confused by this:
http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/p5-Net-Pcap-0.18.log



I'll have a look.

--HPS
___
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: r334375 - in head/sys: net netpfil/pf

2018-05-30 Thread Kristof Provost
Author: kp
Date: Wed May 30 07:11:33 2018
New Revision: 334375
URL: https://svnweb.freebsd.org/changeset/base/334375

Log:
  pf: Replace rwlock on PF_RULES_LOCK with rmlock
  
  Given that PF_RULES_LOCK is a mostly read lock, replace the rwlock with 
rmlock.
  This change improves packet processing rate in high pps environments.
  Benchmarking by olivier@ shows a 65% improvement in pps.
  
  While here, also eliminate all appearances of "sys/rwlock.h" includes since it
  is not used anymore.
  
  Submitted by: farrokhi@
  Differential Revision:https://reviews.freebsd.org/D15502

Modified:
  head/sys/net/pfvar.h
  head/sys/netpfil/pf/if_pfsync.c
  head/sys/netpfil/pf/pf.c
  head/sys/netpfil/pf/pf_if.c
  head/sys/netpfil/pf/pf_ioctl.c
  head/sys/netpfil/pf/pf_lb.c
  head/sys/netpfil/pf/pf_norm.c
  head/sys/netpfil/pf/pf_osfp.c
  head/sys/netpfil/pf/pf_table.c

Modified: head/sys/net/pfvar.h
==
--- head/sys/net/pfvar.hWed May 30 06:29:22 2018(r334374)
+++ head/sys/net/pfvar.hWed May 30 07:11:33 2018(r334375)
@@ -38,8 +38,10 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -147,14 +149,15 @@ extern struct mtx pf_unlnkdrules_mtx;
 #definePF_UNLNKDRULES_LOCK()   mtx_lock(&pf_unlnkdrules_mtx)
 #definePF_UNLNKDRULES_UNLOCK() mtx_unlock(&pf_unlnkdrules_mtx)
 
-extern struct rwlock pf_rules_lock;
-#definePF_RULES_RLOCK()rw_rlock(&pf_rules_lock)
-#definePF_RULES_RUNLOCK()  rw_runlock(&pf_rules_lock)
-#definePF_RULES_WLOCK()rw_wlock(&pf_rules_lock)
-#definePF_RULES_WUNLOCK()  rw_wunlock(&pf_rules_lock)
-#definePF_RULES_ASSERT()   rw_assert(&pf_rules_lock, RA_LOCKED)
-#definePF_RULES_RASSERT()  rw_assert(&pf_rules_lock, RA_RLOCKED)
-#definePF_RULES_WASSERT()  rw_assert(&pf_rules_lock, RA_WLOCKED)
+extern struct rmlock pf_rules_lock;
+#definePF_RULES_RLOCK_TRACKER  struct rm_priotracker _pf_rules_tracker
+#definePF_RULES_RLOCK()rm_rlock(&pf_rules_lock, 
&_pf_rules_tracker)
+#definePF_RULES_RUNLOCK()  rm_runlock(&pf_rules_lock, 
&_pf_rules_tracker)
+#definePF_RULES_WLOCK()rm_wlock(&pf_rules_lock)
+#definePF_RULES_WUNLOCK()  rm_wunlock(&pf_rules_lock)
+#definePF_RULES_ASSERT()   rm_assert(&pf_rules_lock, RA_LOCKED)
+#definePF_RULES_RASSERT()  rm_assert(&pf_rules_lock, RA_RLOCKED)
+#definePF_RULES_WASSERT()  rm_assert(&pf_rules_lock, RA_WLOCKED)
 
 extern struct sx pf_end_lock;
 

Modified: head/sys/netpfil/pf/if_pfsync.c
==
--- head/sys/netpfil/pf/if_pfsync.c Wed May 30 06:29:22 2018
(r334374)
+++ head/sys/netpfil/pf/if_pfsync.c Wed May 30 07:11:33 2018
(r334375)
@@ -587,6 +587,8 @@ pfsync_input(struct mbuf **mp, int *offp __unused, int
int rv;
uint16_t count;
 
+   PF_RULES_RLOCK_TRACKER;
+
*mp = NULL;
V_pfsyncstats.pfsyncs_ipackets++;
 

Modified: head/sys/netpfil/pf/pf.c
==
--- head/sys/netpfil/pf/pf.cWed May 30 06:29:22 2018(r334374)
+++ head/sys/netpfil/pf/pf.cWed May 30 07:11:33 2018(r334375)
@@ -5874,6 +5874,8 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct
struct pf_pdesc  pd;
int  off, dirndx, pqid = 0;
 
+   PF_RULES_RLOCK_TRACKER;
+
M_ASSERTPKTHDR(m);
 
if (!V_pf_status.running)
@@ -6261,6 +6263,7 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struc
struct pf_pdesc  pd;
int  off, terminal = 0, dirndx, rh_cnt = 0, pqid = 
0;
 
+   PF_RULES_RLOCK_TRACKER;
M_ASSERTPKTHDR(m);
 
if (!V_pf_status.running)

Modified: head/sys/netpfil/pf/pf_if.c
==
--- head/sys/netpfil/pf/pf_if.c Wed May 30 06:29:22 2018(r334374)
+++ head/sys/netpfil/pf/pf_if.c Wed May 30 07:11:33 2018(r334375)
@@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 

Modified: head/sys/netpfil/pf/pf_ioctl.c
==
--- head/sys/netpfil/pf/pf_ioctl.c  Wed May 30 06:29:22 2018
(r334374)
+++ head/sys/netpfil/pf/pf_ioctl.c  Wed May 30 07:11:33 2018
(r334375)
@@ -59,7 +59,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -202,7 +201,7 @@ VNET_DEFINE(int, pf_vnet_active);
 int pf_end_threads;
 struct proc *pf_purge_proc;
 
-struct rwlock  pf_rules_lock;
+struct rmlock  pf_rules_lock;
 str

Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool

2018-05-30 Thread Hans Petter Selasky

On 05/30/18 09:04, Hans Petter Selasky wrote:

On 05/30/18 08:04, Antoine Brodin wrote:

On Mon, May 28, 2018 at 10:12 AM, Hans Petter Selasky
 wrote:

Author: hselasky
Date: Mon May 28 08:12:18 2018
New Revision: 334277
URL: https://svnweb.freebsd.org/changeset/base/334277

Log:
   MFV r333789: libpcap 1.9.0 (pre-release)

   MFC after:    1 month
   Sponsored by: Mellanox Technologies


Hi,

Some things seem to be missing.
For instance,  pcap_setsampling and pcap_open are now declared in
pcap.h but they are not compiled in libpcap.so.
net/p5-Net-Pcap is confused by this:
http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/p5-Net-Pcap-0.18.log 




Hi,

net/p5-Net-Pcap is supposed to depend on and use net/libpcap which 
install into /usr/local/lib and /usr/local/include from what I understand.


--HPS
___
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: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool

2018-05-30 Thread Antoine Brodin
On Wed, May 30, 2018 at 7:31 AM, Hans Petter Selasky  wrote:
> On 05/30/18 09:04, Hans Petter Selasky wrote:
>>
>> On 05/30/18 08:04, Antoine Brodin wrote:
>>>
>>> On Mon, May 28, 2018 at 10:12 AM, Hans Petter Selasky
>>>  wrote:

 Author: hselasky
 Date: Mon May 28 08:12:18 2018
 New Revision: 334277
 URL: https://svnweb.freebsd.org/changeset/base/334277

 Log:
MFV r333789: libpcap 1.9.0 (pre-release)

MFC after:1 month
Sponsored by: Mellanox Technologies
>>>
>>>
>>> Hi,
>>>
>>> Some things seem to be missing.
>>> For instance,  pcap_setsampling and pcap_open are now declared in
>>> pcap.h but they are not compiled in libpcap.so.
>>> net/p5-Net-Pcap is confused by this:
>>>
>>> http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/p5-Net-Pcap-0.18.log
>>
>>
>
> Hi,
>
> net/p5-Net-Pcap is supposed to depend on and use net/libpcap which install
> into /usr/local/lib and /usr/local/include from what I understand.

No,  it worked fine with libpcap from base previously.
pcap/pcap.h now exposes functions from pcap-new.c but pcap-new.c is
not compiled.

Antoine
___
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: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool

2018-05-30 Thread Hans Petter Selasky

On 05/30/18 09:36, Antoine Brodin wrote:

On Wed, May 30, 2018 at 7:31 AM, Hans Petter Selasky  wrote:

On 05/30/18 09:04, Hans Petter Selasky wrote:


On 05/30/18 08:04, Antoine Brodin wrote:


On Mon, May 28, 2018 at 10:12 AM, Hans Petter Selasky
 wrote:


Author: hselasky
Date: Mon May 28 08:12:18 2018
New Revision: 334277
URL: https://svnweb.freebsd.org/changeset/base/334277

Log:
MFV r333789: libpcap 1.9.0 (pre-release)

MFC after:1 month
Sponsored by: Mellanox Technologies



Hi,

Some things seem to be missing.
For instance,  pcap_setsampling and pcap_open are now declared in
pcap.h but they are not compiled in libpcap.so.
net/p5-Net-Pcap is confused by this:

http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/p5-Net-Pcap-0.18.log





Hi,

net/p5-Net-Pcap is supposed to depend on and use net/libpcap which install
into /usr/local/lib and /usr/local/include from what I understand.


No,  it worked fine with libpcap from base previously.
pcap/pcap.h now exposes functions from pcap-new.c but pcap-new.c is
not compiled.


Hi,

pcap-new.c is only compiled if libpcap should have remote support, which 
the in-base library didn't have?


Can you try to modify the net/p5-Net-Pcap Makefile like this:

BUILD_DEPENDS=  p5-IO-Interface>=0:net/p5-IO-Interface \
libpcap>=0:net/libpcap

CFLAGS+=-I${PREFIX}/include
LDFLAGS+=   -L${PREFIX}/lib

--HPS

___
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: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool

2018-05-30 Thread Antoine Brodin
On Wed, May 30, 2018 at 7:52 AM, Hans Petter Selasky  wrote:
> On 05/30/18 09:36, Antoine Brodin wrote:
>>
>> On Wed, May 30, 2018 at 7:31 AM, Hans Petter Selasky 
>> wrote:
>>>
>>> On 05/30/18 09:04, Hans Petter Selasky wrote:


 On 05/30/18 08:04, Antoine Brodin wrote:
>
>
> On Mon, May 28, 2018 at 10:12 AM, Hans Petter Selasky
>  wrote:
>>
>>
>> Author: hselasky
>> Date: Mon May 28 08:12:18 2018
>> New Revision: 334277
>> URL: https://svnweb.freebsd.org/changeset/base/334277
>>
>> Log:
>> MFV r333789: libpcap 1.9.0 (pre-release)
>>
>> MFC after:1 month
>> Sponsored by: Mellanox Technologies
>
>
>
> Hi,
>
> Some things seem to be missing.
> For instance,  pcap_setsampling and pcap_open are now declared in
> pcap.h but they are not compiled in libpcap.so.
> net/p5-Net-Pcap is confused by this:
>
>
> http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/p5-Net-Pcap-0.18.log



>>>
>>> Hi,
>>>
>>> net/p5-Net-Pcap is supposed to depend on and use net/libpcap which
>>> install
>>> into /usr/local/lib and /usr/local/include from what I understand.
>>
>>
>> No,  it worked fine with libpcap from base previously.
>> pcap/pcap.h now exposes functions from pcap-new.c but pcap-new.c is
>> not compiled.
>
>
> Hi,
>
> pcap-new.c is only compiled if libpcap should have remote support, which the
> in-base library didn't have?
>
> Can you try to modify the net/p5-Net-Pcap Makefile like this:
>
> BUILD_DEPENDS=  p5-IO-Interface>=0:net/p5-IO-Interface \
> libpcap>=0:net/libpcap
>
> CFLAGS+=-I${PREFIX}/include
> LDFLAGS+=   -L${PREFIX}/lib

Could the pcap/pcap.h header be fixed instead with #ifdef HAVE_REMOTE
as it previously had?

Antoine
___
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: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool

2018-05-30 Thread Hans Petter Selasky

On 05/30/18 10:02, Antoine Brodin wrote:

Could the pcap/pcap.h header be fixed instead with #ifdef HAVE_REMOTE
as it previously had?


The HAVE_REMOTE was removed upstream:

https://github.com/the-tcpdump-group/libpcap/commit/a372536befc9b1ee1d355058daa2eb9f66aa0c59#diff-46964bcbd8e8a5cec9a75c66ab26a97b

What do you think? Shall we re-add it to base?

--HPS
___
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: r334376 - head/lib/libpcap

2018-05-30 Thread Hans Petter Selasky
Author: hselasky
Date: Wed May 30 08:24:57 2018
New Revision: 334376
URL: https://svnweb.freebsd.org/changeset/base/334376

Log:
  Remove redundant header file from source list in libpcap.
  
  MFC after:3 weeks
  Sponsored by: Mellanox Technologies

Modified:
  head/lib/libpcap/Makefile

Modified: head/lib/libpcap/Makefile
==
--- head/lib/libpcap/Makefile   Wed May 30 07:11:33 2018(r334375)
+++ head/lib/libpcap/Makefile   Wed May 30 08:24:57 2018(r334376)
@@ -21,7 +21,6 @@ SRCS= bpf_dump.c \
pcap-bpf.c \
pcap-common.c \
pcap-netmap.c \
-   pcap-netmap.h \
pcap.c \
savefile.c \
scanner.l \
___
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: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool

2018-05-30 Thread Antoine Brodin
On Wed, May 30, 2018 at 8:20 AM, Hans Petter Selasky  wrote:
> On 05/30/18 10:02, Antoine Brodin wrote:
>>
>> Could the pcap/pcap.h header be fixed instead with #ifdef HAVE_REMOTE
>> as it previously had?
>
>
> The HAVE_REMOTE was removed upstream:
>
> https://github.com/the-tcpdump-group/libpcap/commit/a372536befc9b1ee1d355058daa2eb9f66aa0c59#diff-46964bcbd8e8a5cec9a75c66ab26a97b
>
> What do you think? Shall we re-add it to base?

Either hide remote packet capture functions from the header or enable
remote capture functions?
Note that net/p5-Net-Pcap will fail to build with libpcap from ports
too when libpcap from ports is updated to version 1.9.0 (pre-release).

Antoine
___
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: r334361 - head/usr.sbin/pmc

2018-05-30 Thread Konstantin Belousov
On Wed, May 30, 2018 at 12:06:17AM +, Matt Macy wrote:
> Author: mmacy
> Date: Wed May 30 00:06:17 2018
> New Revision: 334361
> URL: https://svnweb.freebsd.org/changeset/base/334361
> 
> Log:
>   pmc: don't break build with format issues
> 
> Modified:
>   head/usr.sbin/pmc/Makefile
> 
> Modified: head/usr.sbin/pmc/Makefile
> ==
> --- head/usr.sbin/pmc/MakefileTue May 29 23:08:33 2018
> (r334360)
> +++ head/usr.sbin/pmc/MakefileWed May 30 00:06:17 2018
> (r334361)
> @@ -9,4 +9,5 @@ LIBADD=   kvm pmc m ncursesw pmcstat elf
>  
>  SRCS=pmc.c pmc_util.c cmd_pmc_stat.c
>  
> +CWARNFLAGS.cmd_pmc_stat.c=   -Wno-format
>  .include 
So this builds knownly broken binary instead of stopping.

If I understand your troubles right, the usual solution for them is
printf("%jx", (uintmax_t)trouble);
used in many places around the kernel, less so in userspace.
___
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: r334365 - head/sys/dev/pci

2018-05-30 Thread Peter Grehan

   PCIe only permits 1 device on an endpoint, so some devices ignore the device
   part of B:D:F probing.  Although ARI likely fixes this, not all platforms
   support ARI completely or correctly, so some devices end up showing up 32
   times on the bus.


 I think this might have broken bhyve - a fake PCIe capability is put 
on the root port so that guests will use MSI/MSI-x, but otherwise it 
looks like parallel PCI. Not exactly spec-compliant, but then neither is 
most of the world of PCI/PCIe.


 It may be worth #ifdef'ing this with powerpc.

later,

Peter.
___
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: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool

2018-05-30 Thread Hans Petter Selasky

On 05/30/18 11:00, Antoine Brodin wrote:

On Wed, May 30, 2018 at 8:20 AM, Hans Petter Selasky  wrote:

On 05/30/18 10:02, Antoine Brodin wrote:


Could the pcap/pcap.h header be fixed instead with #ifdef HAVE_REMOTE
as it previously had?



The HAVE_REMOTE was removed upstream:

https://github.com/the-tcpdump-group/libpcap/commit/a372536befc9b1ee1d355058daa2eb9f66aa0c59#diff-46964bcbd8e8a5cec9a75c66ab26a97b

What do you think? Shall we re-add it to base?


Hi,

Either hide remote packet capture functions from the header or enable
remote capture functions?


This feature is disabled by default for UNIX.


Note that net/p5-Net-Pcap will fail to build with libpcap from ports
too when libpcap from ports is updated to version 1.9.0 (pre-release).


No, libpcap from ports has own header files and libraries and does not 
use anything from libpcap in base.


Enabling remote packet capture in libcap won't solve the build failure.

The right solution from my point of view is to extend the BUILD_DEPENDS 
and CFLAGS and LDFLAGS like shown:


BUILD_DEPENDS=  p5-IO-Interface>=0:net/p5-IO-Interface \
libpcap>=0:net/libpcap

CFLAGS+=-I${PREFIX}/include
LDFLAGS+=   -L${PREFIX}/lib

After the upgrade to 1.9.0 (pre-release) in ports you simply add:

CFLAGS+=-DHAVE_PCAP_SETSAMPLING -DHAVE_PCAP_OPEN

--HPS
___
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: r334361 - head/usr.sbin/pmc

2018-05-30 Thread Dimitry Andric
On 30 May 2018, at 11:24, Konstantin Belousov  wrote:
> 
> On Wed, May 30, 2018 at 12:06:17AM +, Matt Macy wrote:
>> Author: mmacy
>> Date: Wed May 30 00:06:17 2018
>> New Revision: 334361
>> URL: https://svnweb.freebsd.org/changeset/base/334361
>> 
>> Log:
>>  pmc: don't break build with format issues
>> 
>> Modified:
>>  head/usr.sbin/pmc/Makefile
>> 
>> Modified: head/usr.sbin/pmc/Makefile
>> ==
>> --- head/usr.sbin/pmc/Makefile   Tue May 29 23:08:33 2018
>> (r334360)
>> +++ head/usr.sbin/pmc/Makefile   Wed May 30 00:06:17 2018
>> (r334361)
>> @@ -9,4 +9,5 @@ LIBADD=  kvm pmc m ncursesw pmcstat elf
>> 
>> SRCS=pmc.c pmc_util.c cmd_pmc_stat.c
>> 
>> +CWARNFLAGS.cmd_pmc_stat.c=  -Wno-format
>> .include 
> So this builds knownly broken binary instead of stopping.
> 
> If I understand your troubles right, the usual solution for them is
>   printf("%jx", (uintmax_t)trouble);
> used in many places around the kernel, less so in userspace.

Yes, or include  and use the PRIu64 macro, even though Bruce
hates it. :)

-Dimitry



signature.asc
Description: Message signed with OpenPGP


Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool

2018-05-30 Thread Antoine Brodin
On Wed, May 30, 2018 at 9:42 AM, Hans Petter Selasky  wrote:
> On 05/30/18 11:00, Antoine Brodin wrote:
>>
>> On Wed, May 30, 2018 at 8:20 AM, Hans Petter Selasky 
>> wrote:
>>>
>>> On 05/30/18 10:02, Antoine Brodin wrote:


 Could the pcap/pcap.h header be fixed instead with #ifdef HAVE_REMOTE
 as it previously had?
>>>
>>>
>>>
>>> The HAVE_REMOTE was removed upstream:
>>>
>>>
>>> https://github.com/the-tcpdump-group/libpcap/commit/a372536befc9b1ee1d355058daa2eb9f66aa0c59#diff-46964bcbd8e8a5cec9a75c66ab26a97b
>>>
>>> What do you think? Shall we re-add it to base?
>
>
> Hi,
>>
>> Either hide remote packet capture functions from the header or enable
>> remote capture functions?
>
>
> This feature is disabled by default for UNIX.
>
>> Note that net/p5-Net-Pcap will fail to build with libpcap from ports
>> too when libpcap from ports is updated to version 1.9.0 (pre-release).
>
>
> No, libpcap from ports has own header files and libraries and does not use
> anything from libpcap in base.
>
> Enabling remote packet capture in libcap won't solve the build failure.
>
> The right solution from my point of view is to extend the BUILD_DEPENDS and
> CFLAGS and LDFLAGS like shown:
>
> BUILD_DEPENDS=  p5-IO-Interface>=0:net/p5-IO-Interface \
> libpcap>=0:net/libpcap
>
> CFLAGS+=-I${PREFIX}/include
> LDFLAGS+=   -L${PREFIX}/lib
>
> After the upgrade to 1.9.0 (pre-release) in ports you simply add:
>
> CFLAGS+=-DHAVE_PCAP_SETSAMPLING -DHAVE_PCAP_OPEN

No this won't solve the issue,  libpcap from ports isn't compiled with
remote support.

Antoine
___
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: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool

2018-05-30 Thread Hans Petter Selasky

On 05/30/18 12:41, Antoine Brodin wrote:

No this won't solve the issue,  libpcap from ports isn't compiled with
remote support.


Hi,

Remote support is for WIN32 only from what I can see.

Did you try my suggestions?

The port builds fine over here with my patches.

--HPS


___
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: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool

2018-05-30 Thread Antoine Brodin
On Wed, May 30, 2018 at 11:09 AM, Hans Petter Selasky  wrote:
> On 05/30/18 12:41, Antoine Brodin wrote:
>>
>> No this won't solve the issue,  libpcap from ports isn't compiled with
>> remote support.
>
>
> Hi,
>
> Remote support is for WIN32 only from what I can see.
>
> Did you try my suggestions?
>
> The port builds fine over here with my patches.

I tried your patch with libpcap from ports updated to last commit in
github, it fails with the same error as with base libpcap.

I suggest the attached patch which fixes the issue for me.  (in my
opinion upstream should generate the pcap/pcap.h file depending on the
configure args)

Cheers,

Antoine
Index: contrib/libpcap/pcap/pcap.h
===
--- contrib/libpcap/pcap/pcap.h	(revision 334373)
+++ contrib/libpcap/pcap/pcap.h	(working copy)
@@ -607,6 +607,7 @@
 
 #endif /* _WIN32/MSDOS/UN*X */
 
+#if 0	/* Remote capture is disabled on FreeBSD */
 /*
  * Remote capture definitions.
  *
@@ -965,6 +966,7 @@
 	char *errbuf);
 PCAP_API int	pcap_remoteact_close(const char *host, char *errbuf);
 PCAP_API void	pcap_remoteact_cleanup(void);
+#endif	/* Remote capture is disabled on FreeBSD */
 
 #ifdef __cplusplus
 }
___
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: r334378 - head/contrib/libpcap/pcap

2018-05-30 Thread Hans Petter Selasky
Author: hselasky
Date: Wed May 30 11:45:29 2018
New Revision: 334378
URL: https://svnweb.freebsd.org/changeset/base/334378

Log:
  Hide unsupported remote capture definitions to avoid breakage in ports.
  
  Suggested by: antoine@
  MFC after:3 weeks
  Sponsored by: Mellanox Technologies

Modified:
  head/contrib/libpcap/pcap/pcap.h

Modified: head/contrib/libpcap/pcap/pcap.h
==
--- head/contrib/libpcap/pcap/pcap.hWed May 30 08:34:19 2018
(r334377)
+++ head/contrib/libpcap/pcap/pcap.hWed May 30 11:45:29 2018
(r334378)
@@ -607,6 +607,7 @@ PCAP_API void   bpf_dump(const struct bpf_program *, int
 
 #endif /* _WIN32/MSDOS/UN*X */
 
+#if 0  /* Remote capture is disabled on FreeBSD */
 /*
  * Remote capture definitions.
  *
@@ -965,6 +966,7 @@ PCAP_API intpcap_remoteact_list(char *hostlist, 
char 
char *errbuf);
 PCAP_API int   pcap_remoteact_close(const char *host, char *errbuf);
 PCAP_API void  pcap_remoteact_cleanup(void);
+#endif /* Remote capture is disabled on FreeBSD */
 
 #ifdef __cplusplus
 }
___
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: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool

2018-05-30 Thread Hans Petter Selasky

On 05/30/18 13:36, Antoine Brodin wrote:

On Wed, May 30, 2018 at 11:09 AM, Hans Petter Selasky  wrote:

On 05/30/18 12:41, Antoine Brodin wrote:


No this won't solve the issue,  libpcap from ports isn't compiled with
remote support.



Hi,

Remote support is for WIN32 only from what I can see.

Did you try my suggestions?

The port builds fine over here with my patches.


I tried your patch with libpcap from ports updated to last commit in
github, it fails with the same error as with base libpcap.

I suggest the attached patch which fixes the issue for me.  (in my
opinion upstream should generate the pcap/pcap.h file depending on the
configure args)


OK, then we agree :-)

https://svnweb.freebsd.org/changeset/base/334378

--HPS
___
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: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool

2018-05-30 Thread Hans Petter Selasky

On 05/30/18 13:46, Hans Petter Selasky wrote:

On 05/30/18 13:36, Antoine Brodin wrote:
On Wed, May 30, 2018 at 11:09 AM, Hans Petter Selasky 
 wrote:

On 05/30/18 12:41, Antoine Brodin wrote:


No this won't solve the issue,  libpcap from ports isn't compiled with
remote support.



Hi,

Remote support is for WIN32 only from what I can see.

Did you try my suggestions?

The port builds fine over here with my patches.


I tried your patch with libpcap from ports updated to last commit in
github, it fails with the same error as with base libpcap.

I suggest the attached patch which fixes the issue for me.  (in my
opinion upstream should generate the pcap/pcap.h file depending on the
configure args)


OK, then we agree :-)

https://svnweb.freebsd.org/changeset/base/334378



FYI:

https://github.com/the-tcpdump-group/libpcap/issues/723

--HPS

___
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: r334375 - in head/sys: net netpfil/pf

2018-05-30 Thread Hartmann, O.
On Wed, 30 May 2018 07:11:34 + (UTC)
Kristof Provost  wrote:

> Author: kp
> Date: Wed May 30 07:11:33 2018
> New Revision: 334375
> URL: https://svnweb.freebsd.org/changeset/base/334375
> 
> Log:
>   pf: Replace rwlock on PF_RULES_LOCK with rmlock
>   
>   Given that PF_RULES_LOCK is a mostly read lock, replace the rwlock
> with rmlock. This change improves packet processing rate in high pps
> environments. Benchmarking by olivier@ shows a 65% improvement in pps.
>   
>   While here, also eliminate all appearances of "sys/rwlock.h"
> includes since it is not used anymore.
>   
>   Submitted by:   farrokhi@
>   Differential Revision:  https://reviews.freebsd.org/D15502
> 
> Modified:
>   head/sys/net/pfvar.h
>   head/sys/netpfil/pf/if_pfsync.c
>   head/sys/netpfil/pf/pf.c
>   head/sys/netpfil/pf/pf_if.c
>   head/sys/netpfil/pf/pf_ioctl.c
>   head/sys/netpfil/pf/pf_lb.c
>   head/sys/netpfil/pf/pf_norm.c
>   head/sys/netpfil/pf/pf_osfp.c
>   head/sys/netpfil/pf/pf_table.c
> 
> Modified: head/sys/net/pfvar.h
> ==
> --- head/sys/net/pfvar.h  Wed May 30 06:29:22 2018
> (r334374) +++ head/sys/net/pfvar.hWed May 30 07:11:33
> 2018  (r334375) @@ -38,8 +38,10 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  
> @@ -147,14 +149,15 @@ extern struct mtx pf_unlnkdrules_mtx;
>  #define  PF_UNLNKDRULES_LOCK()
> mtx_lock(&pf_unlnkdrules_mtx) #define
> PF_UNLNKDRULES_UNLOCK()   mtx_unlock(&pf_unlnkdrules_mtx) 
> -extern struct rwlock pf_rules_lock;
> -#define  PF_RULES_RLOCK()rw_rlock(&pf_rules_lock)
> -#define  PF_RULES_RUNLOCK()  rw_runlock(&pf_rules_lock)
> -#define  PF_RULES_WLOCK()rw_wlock(&pf_rules_lock)
> -#define  PF_RULES_WUNLOCK()  rw_wunlock(&pf_rules_lock)
> -#define  PF_RULES_ASSERT()   rw_assert(&pf_rules_lock,
> RA_LOCKED) -#define   PF_RULES_RASSERT()
> rw_assert(&pf_rules_lock, RA_RLOCKED) -#define
> PF_RULES_WASSERT()rw_assert(&pf_rules_lock, RA_WLOCKED)
> +extern struct rmlock pf_rules_lock; +#define
> PF_RULES_RLOCK_TRACKERstruct rm_priotracker _pf_rules_tracker
> +#define  PF_RULES_RLOCK()rm_rlock(&pf_rules_lock,
> &_pf_rules_tracker) +#define  PF_RULES_RUNLOCK()
> rm_runlock(&pf_rules_lock, &_pf_rules_tracker) +#define
> PF_RULES_WLOCK()  rm_wlock(&pf_rules_lock) +#define
> PF_RULES_WUNLOCK()rm_wunlock(&pf_rules_lock) +#define
> PF_RULES_ASSERT() rm_assert(&pf_rules_lock, RA_LOCKED)
> +#define  PF_RULES_RASSERT()  rm_assert(&pf_rules_lock,
> RA_RLOCKED) +#define  PF_RULES_WASSERT()
> rm_assert(&pf_rules_lock, RA_WLOCKED) extern struct sx pf_end_lock; 
> 
> Modified: head/sys/netpfil/pf/if_pfsync.c
> ==
> --- head/sys/netpfil/pf/if_pfsync.c   Wed May 30 06:29:22
> 2018  (r334374) +++ head/sys/netpfil/pf/if_pfsync.c   Wed
> May 30 07:11:33 2018  (r334375) @@ -587,6 +587,8 @@
> pfsync_input(struct mbuf **mp, int *offp __unused, int int rv;
>   uint16_t count;
>  
> + PF_RULES_RLOCK_TRACKER;
> +
>   *mp = NULL;
>   V_pfsyncstats.pfsyncs_ipackets++;
>  
> 
> Modified: head/sys/netpfil/pf/pf.c
> ==
> --- head/sys/netpfil/pf/pf.c  Wed May 30 06:29:22 2018
> (r334374) +++ head/sys/netpfil/pf/pf.cWed May 30 07:11:33
> 2018  (r334375) @@ -5874,6 +5874,8 @@ pf_test(int dir, int
> pflags, struct ifnet *ifp, struct struct pf_pdesc  pd;
>   int  off, dirndx, pqid = 0;
>  
> + PF_RULES_RLOCK_TRACKER;
> +
>   M_ASSERTPKTHDR(m);
>  
>   if (!V_pf_status.running)
> @@ -6261,6 +6263,7 @@ pf_test6(int dir, int pflags, struct ifnet
> *ifp, struc struct pf_pdescpd;
>   int  off, terminal = 0, dirndx,
> rh_cnt = 0, pqid = 0; 
> + PF_RULES_RLOCK_TRACKER;
>   M_ASSERTPKTHDR(m);
>  
>   if (!V_pf_status.running)
> 
> Modified: head/sys/netpfil/pf/pf_if.c
> ==
> --- head/sys/netpfil/pf/pf_if.c   Wed May 30 06:29:22
> 2018  (r334374) +++ head/sys/netpfil/pf/pf_if.c   Wed May
> 30 07:11:33 2018  (r334375) @@ -46,7 +46,6 @@
> __FBSDID("$FreeBSD$"); #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  
>  #include 
> 
> Modified: head/sys/netpfil/pf/pf_ioctl.c
> ==
> --- head/sys/netpfil/pf/pf_ioctl.cWed May 30 06:29:22
> 2018  (r334374) +++ head/sys/netpfil/pf/pf_ioctl.cWed
> May 30 07:11:33 2018  (r334375) @@ -59,7 +59,6 @@
> __FBSDID("$FreeBSD$"); #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -202,7 +201,7 @@ VNET_DEFINE(int, pf_vnet_active);
>  int pf_end_threads;
>  str

Re: svn commit: r334363 - head/usr.bin/elfdump

2018-05-30 Thread Ed Maste
On 30 May 2018 at 08:10, Shawn Webb  wrote:
>
> I wonder if it would be a good idea to handle .note.ABI-tag and
> .note.tag so that it can handle binaries compiled both before and
> after r232832.

As I said in the commit message, elfdump's note parsing needs a bunch
of rework. r232832 was years ago and today I think it's much more
likely that if elfdump encounters a .note.ABI-tag section that's going
to be a GNU note (that will be misinterpreted) than one from a
years-old FreeBSD binary.
___
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: r334375 - in head/sys: net netpfil/pf

2018-05-30 Thread Kristof Provost
On 30 May 2018, at 14:13, Hartmann, O. wrote:
> On Wed, 30 May 2018 07:11:34 + (UTC)
> Kristof Provost  wrote:
>
>> Author: kp
>> Date: Wed May 30 07:11:33 2018
>> New Revision: 334375
>> URL: https://svnweb.freebsd.org/changeset/base/334375
>>
>> Log:
>>   pf: Replace rwlock on PF_RULES_LOCK with rmlock
>>
>>   Given that PF_RULES_LOCK is a mostly read lock, replace the rwlock
>> with rmlock. This change improves packet processing rate in high pps
>> environments. Benchmarking by olivier@ shows a 65% improvement in pps.
>>
>>   While here, also eliminate all appearances of "sys/rwlock.h"
>> includes since it is not used anymore.
>>
>>   Submitted by:  farrokhi@
>>   Differential Revision: https://reviews.freebsd.org/D15502
>
> It seems, this commit issues an error while compiling the kernel:
>
>
> [...]
> --- all_subdir_pf ---
> --- pf_ruleset.o ---
> In file included from /usr/src/sys/netpfil/pf/pf_ruleset.c:57:
> In file included from /usr/src/sys/net/pfvar.h:44:
> In file included from /usr/src/sys/sys/rmlock.h:37:
> /usr/src/sys/sys/mutex.h:96:52: error: expected ')'
> int _mtx_trylock_flags_int(struct mtx *m, int opts
> LOCK_FILE_LINE_ARG_DEF); ^
> /usr/src/sys/sys/mutex.h:96:27: note: to match this '('
> int _mtx_trylock_flags_int(struct mtx *m, int opts
> LOCK_FILE_LINE_ARG_DEF); ^
> /usr/src/sys/sys/mutex.h:100:5: error: 'LOCK_DEBUG' is not defined,
> evaluates to 0 [-Werror,-Wundef] #if LOCK_DEBUG > 0
> ^
> /usr/src/sys/sys/mutex.h:111:5: error: 'LOCK_DEBUG' is not defined,
> evaluates to 0 [-Werror,-Wundef] #if LOCK_DEBUG > 0

Just to confirm: are you building for mips?

Regards,
Kristof
___
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: r334375 - in head/sys: net netpfil/pf

2018-05-30 Thread Hartmann, O.
On Wed, 30 May 2018 14:17:30 +0200
"Kristof Provost"  wrote:

> On 30 May 2018, at 14:13, Hartmann, O. wrote:
> > On Wed, 30 May 2018 07:11:34 + (UTC)
> > Kristof Provost  wrote:
> >  
> >> Author: kp
> >> Date: Wed May 30 07:11:33 2018
> >> New Revision: 334375
> >> URL: https://svnweb.freebsd.org/changeset/base/334375
> >>
> >> Log:
> >>   pf: Replace rwlock on PF_RULES_LOCK with rmlock
> >>
> >>   Given that PF_RULES_LOCK is a mostly read lock, replace the
> >> rwlock with rmlock. This change improves packet processing rate in
> >> high pps environments. Benchmarking by olivier@ shows a 65%
> >> improvement in pps.
> >>
> >>   While here, also eliminate all appearances of "sys/rwlock.h"
> >> includes since it is not used anymore.
> >>
> >>   Submitted by:farrokhi@
> >>   Differential Revision:
> >> https://reviews.freebsd.org/D15502  
> >
> > It seems, this commit issues an error while compiling the kernel:
> >
> >
> > [...]
> > --- all_subdir_pf ---
> > --- pf_ruleset.o ---
> > In file included from /usr/src/sys/netpfil/pf/pf_ruleset.c:57:
> > In file included from /usr/src/sys/net/pfvar.h:44:
> > In file included from /usr/src/sys/sys/rmlock.h:37:
> > /usr/src/sys/sys/mutex.h:96:52: error: expected ')'
> > int _mtx_trylock_flags_int(struct mtx *m, int opts
> > LOCK_FILE_LINE_ARG_DEF); ^
> > /usr/src/sys/sys/mutex.h:96:27: note: to match this '('
> > int _mtx_trylock_flags_int(struct mtx *m, int opts
> > LOCK_FILE_LINE_ARG_DEF); ^
> > /usr/src/sys/sys/mutex.h:100:5: error: 'LOCK_DEBUG' is not defined,
> > evaluates to 0 [-Werror,-Wundef] #if LOCK_DEBUG > 0
> > ^
> > /usr/src/sys/sys/mutex.h:111:5: error: 'LOCK_DEBUG' is not defined,
> > evaluates to 0 [-Werror,-Wundef] #if LOCK_DEBUG > 0  
> 
> Just to confirm: are you building for mips?
> 
> Regards,
> Kristof


No, the hardware is a Lenovo E540 notebook equipted with a Intel 4200M
CPU (Haswell) -> amd64.

Regards,

oh
___
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: r334379 - head/sys/net

2018-05-30 Thread Kristof Provost
Author: kp
Date: Wed May 30 12:40:37 2018
New Revision: 334379
URL: https://svnweb.freebsd.org/changeset/base/334379

Log:
  pf: Add missing include statement
  
  rmlocks require  as well as .
  Unbreak mips build.

Modified:
  head/sys/net/pfvar.h

Modified: head/sys/net/pfvar.h
==
--- head/sys/net/pfvar.hWed May 30 11:45:29 2018(r334378)
+++ head/sys/net/pfvar.hWed May 30 12:40:37 2018(r334379)
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#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"


Re: svn commit: r334375 - in head/sys: net netpfil/pf

2018-05-30 Thread Kristof Provost
On 30 May 2018, at 14:33, Hartmann, O. wrote:
> On Wed, 30 May 2018 14:17:30 +0200
> "Kristof Provost"  wrote:
>
>> On 30 May 2018, at 14:13, Hartmann, O. wrote:
>>> On Wed, 30 May 2018 07:11:34 + (UTC)
>>> Kristof Provost  wrote:
>>>
 Author: kp
 Date: Wed May 30 07:11:33 2018
 New Revision: 334375
 URL: https://svnweb.freebsd.org/changeset/base/334375

 Log:
   pf: Replace rwlock on PF_RULES_LOCK with rmlock

   Given that PF_RULES_LOCK is a mostly read lock, replace the
 rwlock with rmlock. This change improves packet processing rate in
 high pps environments. Benchmarking by olivier@ shows a 65%
 improvement in pps.

   While here, also eliminate all appearances of "sys/rwlock.h"
 includes since it is not used anymore.

   Submitted by:farrokhi@
   Differential Revision:
 https://reviews.freebsd.org/D15502
>>>
>>> It seems, this commit issues an error while compiling the kernel:
>>>
>>>
>>> [...]
>>> --- all_subdir_pf ---
>>> --- pf_ruleset.o ---
>>> In file included from /usr/src/sys/netpfil/pf/pf_ruleset.c:57:
>>> In file included from /usr/src/sys/net/pfvar.h:44:
>>> In file included from /usr/src/sys/sys/rmlock.h:37:
>>> /usr/src/sys/sys/mutex.h:96:52: error: expected ')'
>>> int _mtx_trylock_flags_int(struct mtx *m, int opts
>>> LOCK_FILE_LINE_ARG_DEF); ^
>>> /usr/src/sys/sys/mutex.h:96:27: note: to match this '('
>>> int _mtx_trylock_flags_int(struct mtx *m, int opts
>>> LOCK_FILE_LINE_ARG_DEF); ^
>>> /usr/src/sys/sys/mutex.h:100:5: error: 'LOCK_DEBUG' is not defined,
>>> evaluates to 0 [-Werror,-Wundef] #if LOCK_DEBUG > 0
>>> ^
>>> /usr/src/sys/sys/mutex.h:111:5: error: 'LOCK_DEBUG' is not defined,
>>> evaluates to 0 [-Werror,-Wundef] #if LOCK_DEBUG > 0
>>
>> Just to confirm: are you building for mips?
>>
>> Regards,
>> Kristof
>
>
> No, the hardware is a Lenovo E540 notebook equipted with a Intel 4200M
> CPU (Haswell) -> amd64.
>
Odd. The other reports I got were mips only. I did test amd64.
Are you using gcc to build perhaps?

r334379 should fix it.

Regards,
Kristof
___
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: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool

2018-05-30 Thread Rodney W. Grimes
> On Wed, May 30, 2018 at 8:20 AM, Hans Petter Selasky  wrote:
> > On 05/30/18 10:02, Antoine Brodin wrote:
> >>
> >> Could the pcap/pcap.h header be fixed instead with #ifdef HAVE_REMOTE
> >> as it previously had?
> >
> >
> > The HAVE_REMOTE was removed upstream:
> >
> > https://github.com/the-tcpdump-group/libpcap/commit/a372536befc9b1ee1d355058daa2eb9f66aa0c59#diff-46964bcbd8e8a5cec9a75c66ab26a97b
> >
> > What do you think? Shall we re-add it to base?
> 
> Either hide remote packet capture functions from the header or enable
> remote capture functions?
> Note that net/p5-Net-Pcap will fail to build with libpcap from ports
> too when libpcap from ports is updated to version 1.9.0 (pre-release).

If there is any thoughs of merging this to stable/11 wont the
HAVE_REMOTE have to be turned on anyway?

I suppose it get be #ifdef FreeBSD_VERSION.

-- 
Rod Grimes rgri...@freebsd.org
___
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: r334380 - head/sys/kern

2018-05-30 Thread Ed Maste
Author: emaste
Date: Wed May 30 12:55:27 2018
New Revision: 334380
URL: https://svnweb.freebsd.org/changeset/base/334380

Log:
  link_elf_obj: correct an error message
  
  Previously we'd report that a file has "no valid symbol table" if it in
  fact had two or more.  Change the message to report that there must be
  exactly one.

Modified:
  head/sys/kern/link_elf_obj.c

Modified: head/sys/kern/link_elf_obj.c
==
--- head/sys/kern/link_elf_obj.cWed May 30 12:40:37 2018
(r334379)
+++ head/sys/kern/link_elf_obj.cWed May 30 12:55:27 2018
(r334380)
@@ -656,7 +656,8 @@ link_elf_load_file(linker_class_t cls, const char *fil
}
if (nsym != 1) {
/* Only allow one symbol table for now */
-   link_elf_error(filename, "file has no valid symbol table");
+   link_elf_error(filename,
+   "file must have exactly one symbol table");
error = ENOEXEC;
goto out;
}
___
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: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool

2018-05-30 Thread Hans Petter Selasky

On 05/30/18 14:41, Rodney W. Grimes wrote:

Either hide remote packet capture functions from the header or enable
remote capture functions?
Note that net/p5-Net-Pcap will fail to build with libpcap from ports
too when libpcap from ports is updated to version 1.9.0 (pre-release).

If there is any thoughs of merging this to stable/11 wont the
HAVE_REMOTE have to be turned on anyway?

I suppose it get be #ifdef FreeBSD_VERSION.


Yes, #if 0 is fine.

--HPS
___
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: r334365 - head/sys/dev/pci

2018-05-30 Thread Justin Hibbits
On Wed, May 30, 2018 at 4:42 AM, Peter Grehan  wrote:
>>PCIe only permits 1 device on an endpoint, so some devices ignore the
>> device
>>part of B:D:F probing.  Although ARI likely fixes this, not all
>> platforms
>>support ARI completely or correctly, so some devices end up showing up
>> 32
>>times on the bus.
>
>
>  I think this might have broken bhyve - a fake PCIe capability is put on the
> root port so that guests will use MSI/MSI-x, but otherwise it looks like
> parallel PCI. Not exactly spec-compliant, but then neither is most of the
> world of PCI/PCIe.
>
>  It may be worth #ifdef'ing this with powerpc.
>
> later,
>
> Peter.

I can special case i386 and amd64, but this change should (eventually)
remove the majority of the current special case overrides for
alternative architectures.

I think it'd be better to have a bhyve root bridge driver that itself
overrides pci_maxslots(), and have the 'compliant' path be the common.

Thoughts?

- Justin
___
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: r334381 - head/tools/tools/makeroot

2018-05-30 Thread Ed Maste
Author: emaste
Date: Wed May 30 13:51:00 2018
New Revision: 334381
URL: https://svnweb.freebsd.org/changeset/base/334381

Log:
  makeroot.sh: allow duplicate entries even with -f 
  
  makefs disallows duplicate entries unless the -D option is specified.
  
  Previously makeroot.sh enabled -D unless a filelist was provided via
  the -f options.  The filelist logic creates an mtree manifest from the
  METALOG and the provided filelist by passing them through `sort -u`,
  so duplicates were not expected.  However, duplicates can still occur
  when a directory appears in multiple packages -- for example,
  
  ./etc/pam.d type=dir uname=root gname=wheel mode=0755
  ./etc/pam.d type=dir mode=0755 tags=package=runtime
  ./etc/pam.d type=dir mode=0755 tags=package=at
  ./etc/pam.d type=dir mode=0755 tags=package=ftp
  ./etc/pam.d type=dir mode=0755 tags=package=telnet
  
  For the purposes of makefs these directory entries are identical, but
  are of course not identical for sort -u.
  
  For now just leave the allow duplicates -D flag enabled.
  
  PR:   228606
  Sponsored by: The FreeBSD Foundation

Modified:
  head/tools/tools/makeroot/makeroot.sh

Modified: head/tools/tools/makeroot/makeroot.sh
==
--- head/tools/tools/makeroot/makeroot.sh   Wed May 30 12:55:27 2018
(r334380)
+++ head/tools/tools/makeroot/makeroot.sh   Wed May 30 13:51:00 2018
(r334381)
@@ -80,7 +80,7 @@ while getopts "B:de:f:g:K:k:l:p:s:" opt; do
B)  BFLAG="-B ${OPTARG}" ;;
d)  DEBUG=1 ;;
e)  EXTRAS="${EXTRAS} ${OPTARG}" ;;
-   f)  FILELIST="${OPTARG}"; DUPFLAG= ;;
+   f)  FILELIST="${OPTARG}";;
g)  GROUP="${OPTARG}" ;;
K)  KEYUSERS="${KEYUSERS} ${OPTARG}" ;;
k)  KEYDIR="${OPTARG}" ;;
___
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: r334382 - head/sys/arm64/arm64

2018-05-30 Thread Andrew Turner
Author: andrew
Date: Wed May 30 14:18:19 2018
New Revision: 334382
URL: https://svnweb.freebsd.org/changeset/base/334382

Log:
  Push down the locking in pmap_fault to just be around the calls to
  arm64_address_translate_*. There is no need to lock around the switch
  statement as we only care about a few cases.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/arm64/arm64/pmap.c

Modified: head/sys/arm64/arm64/pmap.c
==
--- head/sys/arm64/arm64/pmap.c Wed May 30 13:51:00 2018(r334381)
+++ head/sys/arm64/arm64/pmap.c Wed May 30 14:18:19 2018(r334382)
@@ -4964,12 +4964,12 @@ pmap_fault(pmap_t pmap, uint64_t esr, uint64_t far)
}
 
/* Data and insn aborts use same encoding for FCS field. */
-   PMAP_LOCK(pmap);
switch (esr & ISS_DATA_DFSC_MASK) {
case ISS_DATA_DFSC_TF_L0:
case ISS_DATA_DFSC_TF_L1:
case ISS_DATA_DFSC_TF_L2:
case ISS_DATA_DFSC_TF_L3:
+   PMAP_LOCK(pmap);
/* Ask the MMU to check the address */
intr = intr_disable();
if (pmap == kernel_pmap)
@@ -4977,21 +4977,19 @@ pmap_fault(pmap_t pmap, uint64_t esr, uint64_t far)
else
par = arm64_address_translate_s1e0r(far);
intr_restore(intr);
+   PMAP_UNLOCK(pmap);
 
/*
 * If the translation was successful the address was invalid
 * due to a break-before-make sequence. We can unlock and
 * return success to the trap handler.
 */
-   if (PAR_SUCCESS(par)) {
-   PMAP_UNLOCK(pmap);
+   if (PAR_SUCCESS(par))
return (KERN_SUCCESS);
-   }
break;
default:
break;
}
-   PMAP_UNLOCK(pmap);
 #endif
 
return (KERN_FAILURE);
___
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: r334365 - head/sys/dev/pci

2018-05-30 Thread Nathan Whitehorn



On 05/30/18 02:42, Peter Grehan wrote:
   PCIe only permits 1 device on an endpoint, so some devices ignore 
the device
   part of B:D:F probing.  Although ARI likely fixes this, not all 
platforms
   support ARI completely or correctly, so some devices end up 
showing up 32

   times on the bus.


 I think this might have broken bhyve - a fake PCIe capability is put 
on the root port so that guests will use MSI/MSI-x, but otherwise it 
looks like parallel PCI. Not exactly spec-compliant, but then neither 
is most of the world of PCI/PCIe.


 It may be worth #ifdef'ing this with powerpc.

later,

Peter.



There are a ton of ARM boards that need this too. You can find one-off 
hacks all through the tree and one of the nice things about this change 
is that all of those can be consolidated/removed now. If we are going to 
have some #ifdef and special cases, it would be better to make them for 
bhyve.

-Nathan
___
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: r334383 - head/lib/libdevinfo

2018-05-30 Thread Warner Losh
Author: imp
Date: Wed May 30 15:08:46 2018
New Revision: 334383
URL: https://svnweb.freebsd.org/changeset/base/334383

Log:
  There's no meaningful errno when there's a version mismatch, so use
  warnx. Also, report the mis-matched versions.

Modified:
  head/lib/libdevinfo/devinfo.c

Modified: head/lib/libdevinfo/devinfo.c
==
--- head/lib/libdevinfo/devinfo.c   Wed May 30 14:18:19 2018
(r334382)
+++ head/lib/libdevinfo/devinfo.c   Wed May 30 15:08:46 2018
(r334383)
@@ -125,7 +125,8 @@ devinfo_init(void)
}
if ((ub_size != sizeof(ubus)) ||
(ubus.ub_version != BUS_USER_VERSION)) {
-   warn("kernel bus interface version mismatch");
+   warnx("kernel bus interface version mismatch: kernel %d 
expected %d",
+   ubus.ub_version, BUS_USER_VERSION);
return(EINVAL);
}
debug("generation count is %d", ubus.ub_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"


svn commit: r334384 - head/usr.sbin/devinfo

2018-05-30 Thread Warner Losh
Author: imp
Date: Wed May 30 15:08:59 2018
New Revision: 334384
URL: https://svnweb.freebsd.org/changeset/base/334384

Log:
  devinfo_init() returns an errno, but doesn't set errno, so the error
  message when it fails reflects some random thing rather than what it
  returned. Set errno to the return value.

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

Modified: head/usr.sbin/devinfo/devinfo.c
==
--- head/usr.sbin/devinfo/devinfo.c Wed May 30 15:08:46 2018
(r334383)
+++ head/usr.sbin/devinfo/devinfo.c Wed May 30 15:08:59 2018
(r334384)
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -242,7 +243,7 @@ int
 main(int argc, char *argv[]) 
 {
struct devinfo_dev  *root;
-   int c, uflag;
+   int c, uflag, rv;
char*path = NULL;
 
uflag = 0;
@@ -268,8 +269,10 @@ main(int argc, char *argv[]) 
if (path && (rflag || uflag))
usage();
 
-   if (devinfo_init())
+   if ((rv = devinfo_init()) != 0) {
+   errno = rv;
err(1, "devinfo_init");
+   }
 
if ((root = devinfo_handle_to_device(DEVINFO_ROOT_DEVICE)) == NULL)
errx(1, "can't find root 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: r334385 - head/sys/arm64/arm64

2018-05-30 Thread Andrew Turner
Author: andrew
Date: Wed May 30 15:25:48 2018
New Revision: 334385
URL: https://svnweb.freebsd.org/changeset/base/334385

Log:
  Further limit when we call pmap_fault.
  
  We should only call pmap_fault in the kernel when accessing a userspace
  address. As this should always happen through specific functions that set
  a fault handler we can use this to limit calls to pmap_fault to when this
  is set.
  
  This should help with NULL pointer dereferences when we are unable to sleep
  so we fall into the correct case.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/arm64/arm64/trap.c

Modified: head/sys/arm64/arm64/trap.c
==
--- head/sys/arm64/arm64/trap.c Wed May 30 15:08:59 2018(r334384)
+++ head/sys/arm64/arm64/trap.c Wed May 30 15:25:48 2018(r334385)
@@ -190,16 +190,32 @@ data_abort(struct thread *td, struct trapframe *frame,
}
 
/*
-* We may fault from userspace or when in a DMAP region due to
-* a superpage being unmapped when the access took place. In these
-* cases we need to wait for the pmap to be unlocked and check
-* if the translation is still invalid.
+* The call to pmap_fault can be dangerous when coming from the
+* kernel as it may be not be able to lock the pmap to check if
+* the address is now valid. Because of this we filter the cases
+* when we are not going to see superpage activity.
 */
-   if (map != kernel_map || VIRT_IN_DMAP(far)) {
-   if (pmap_fault(map->pmap, esr, far) == KERN_SUCCESS)
-   return;
+   if (!lower) {
+   /*
+* We may fault in a DMAP region due to a superpage being
+* unmapped when the access took place.
+*/
+   if (map == kernel_map && !VIRT_IN_DMAP(far))
+   goto no_pmap_fault;
+   /*
+* We can also fault in the userspace handling functions,
+* e.g. copyin. In these cases we will have set a fault
+* handler so we can check if this is set before calling
+* pmap_fault.
+*/
+   if (map != kernel_map && pcb->pcb_onfault == 0)
+   goto no_pmap_fault;
}
 
+   if (pmap_fault(map->pmap, esr, far) == KERN_SUCCESS)
+   return;
+
+no_pmap_fault:
KASSERT(td->td_md.md_spinlock_count == 0,
("data abort with spinlock held"));
if (td->td_critnest != 0 || WITNESS_CHECK(WARN_SLEEPOK |
___
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: r334386 - head/sys/dev/extres/regulator

2018-05-30 Thread Emmanuel Vadot
Author: manu
Date: Wed May 30 15:32:31 2018
New Revision: 334386
URL: https://svnweb.freebsd.org/changeset/base/334386

Log:
  regulator: Fix typo (shuting/shutting)
  
  Submitted by: Jose Luis Duran (github pull #151)

Modified:
  head/sys/dev/extres/regulator/regulator.c

Modified: head/sys/dev/extres/regulator/regulator.c
==
--- head/sys/dev/extres/regulator/regulator.c   Wed May 30 15:25:48 2018
(r334385)
+++ head/sys/dev/extres/regulator/regulator.c   Wed May 30 15:32:31 2018
(r334386)
@@ -174,7 +174,7 @@ regulator_shutdown(void *dummy)
TAILQ_FOREACH(entry, ®node_list, reglist_link) {
if (entry->std_param.always_on == 0 && disable) {
if (bootverbose)
-   printf("regulator: shuting down %s\n",
+   printf("regulator: shutting down %s\n",
entry->name);
ret = regnode_status(entry, &status);
if (ret == 0 && status == REGULATOR_STATUS_ENABLED)
___
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: r334387 - head/sys/arm64/arm64

2018-05-30 Thread Andrew Turner
Author: andrew
Date: Wed May 30 15:37:09 2018
New Revision: 334387
URL: https://svnweb.freebsd.org/changeset/base/334387

Log:
  Remove max_pa, it's unused.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/arm64/arm64/pmap.c

Modified: head/sys/arm64/arm64/pmap.c
==
--- head/sys/arm64/arm64/pmap.c Wed May 30 15:32:31 2018(r334386)
+++ head/sys/arm64/arm64/pmap.c Wed May 30 15:37:09 2018(r334387)
@@ -766,7 +766,7 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_
pt_entry_t *l2;
vm_offset_t va, freemempos;
vm_offset_t dpcpu, msgbufpv;
-   vm_paddr_t start_pa, pa, max_pa, min_pa;
+   vm_paddr_t start_pa, pa, min_pa;
int i;
 
kern_delta = KERNBASE - kernstart;
@@ -780,7 +780,7 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_
PMAP_LOCK_INIT(kernel_pmap);
 
/* Assume the address we were loaded to is a valid physical address */
-   min_pa = max_pa = KERNBASE - kern_delta;
+   min_pa = KERNBASE - kern_delta;
 
physmap_idx = arm_physmem_avail(physmap, nitems(physmap));
physmap_idx /= 2;
@@ -794,8 +794,6 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_
continue;
if (physmap[i] <= min_pa)
min_pa = physmap[i];
-   if (physmap[i + 1] > max_pa)
-   max_pa = physmap[i + 1];
}
 
freemempos = KERNBASE + kernlen;
___
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: r334375 - in head/sys: net netpfil/pf

2018-05-30 Thread Conrad Meyer
On Wed, May 30, 2018 at 5:41 AM, Kristof Provost  wrote:
> Odd. The other reports I got were mips only. I did test amd64.
> Are you using gcc to build perhaps?
>
> r334379 should fix it.

Hi Kristof,

Oliver uses a non-GENERIC kernel, which often catches some oversights
:-).  I appreciate the prompt testing and reports he seems to do
continuously, it's fantastic.

Best,
Conrad
___
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: r334375 - in head/sys: net netpfil/pf

2018-05-30 Thread Kristof Provost

On 30 May 2018, at 17:43, Conrad Meyer wrote:
On Wed, May 30, 2018 at 5:41 AM, Kristof Provost  
wrote:

Odd. The other reports I got were mips only. I did test amd64.
Are you using gcc to build perhaps?

r334379 should fix it.


Hi Kristof,

Oliver uses a non-GENERIC kernel, which often catches some oversights
:-).  I appreciate the prompt testing and reports he seems to do
continuously, it's fantastic.


This was very much not criticism of Olivier’s choices ;)
I broke it, so it’s good that someone told me so.

I’m just interested in understanding why he saw the build failure on 
amd64 and I didn’t.


Regards,
Kristof
___
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: r334388 - head/contrib/openbsm/bsm

2018-05-30 Thread Alan Somers
Author: asomers
Date: Wed May 30 15:51:48 2018
New Revision: 334388
URL: https://svnweb.freebsd.org/changeset/base/334388

Log:
  Fix OpenBSM with GCC with -Wredundant-decls
  
  Upstream change ed47534 consciously added some redundant functional
  declarations, and I'm not sure why. AFAICT they were never required. On
  FreeBSD, they break the build with GCC (but not Clang) for any program
  including libbsm.h with WARNS=6.
  
  Fix by cherry-picking upstream change
  https://github.com/openbsm/openbsm/commit/0553c27
  
  Reported by:  emaste
  Reviewed by:  cem
  Obtained from:OpenBSM
  MFC after:2 weeks
  Pull Request: https://github.com/openbsm/openbsm/pull/31

Modified:
  head/contrib/openbsm/bsm/libbsm.h

Modified: head/contrib/openbsm/bsm/libbsm.h
==
--- head/contrib/openbsm/bsm/libbsm.h   Wed May 30 15:37:09 2018
(r334387)
+++ head/contrib/openbsm/bsm/libbsm.h   Wed May 30 15:51:48 2018
(r334388)
@@ -872,21 +872,6 @@ voidau_print_tok_xml(FILE *outfp, 
tokenstr_t *tok,
 voidau_print_xml_header(FILE *outfp);
 voidau_print_xml_footer(FILE *outfp);
 
-/*
- * BSM library routines for converting between local and BSM constant spaces.
- * (Note: some of these are replicated in audit_record.h for the benefit of
- * the FreeBSD and Mac OS X kernels)
- */
-int au_bsm_to_domain(u_short bsm_domain, int *local_domainp);
-int au_bsm_to_errno(u_char bsm_error, int *errorp);
-int au_bsm_to_fcntl_cmd(u_short bsm_fcntl_cmd, int *local_fcntl_cmdp);
-int au_bsm_to_socket_type(u_short bsm_socket_type,
-   int *local_socket_typep);
-u_short au_domain_to_bsm(int local_domain);
-u_char  au_errno_to_bsm(int local_errno);
-u_short au_fcntl_cmd_to_bsm(int local_fcntl_command);
-u_short au_socket_type_to_bsm(int local_socket_type);
-
 const char  *au_strerror(u_char bsm_error);
 __END_DECLS
 
___
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: r334360 - in head: etc/mtree tests/sys tests/sys/audit

2018-05-30 Thread Alan Somers
On Tue, May 29, 2018 at 6:10 PM, Ed Maste  wrote:

> On 29 May 2018 at 19:08, Alan Somers  wrote:
> > Author: asomers
> > Date: Tue May 29 23:08:33 2018
> > New Revision: 334360
> > URL: https://svnweb.freebsd.org/changeset/base/334360
> >
> > Log:
> >   Add initial set of tests for audit(4)
>
> This has broken the build on many architectures, e.g. mips:
> https://ci.freebsd.org/job/FreeBSD-head-mips-build/2467/console
>
> 23:15:17 In file included from /usr/src/tests/sys/audit/utils.c:38:
> 23:15:17 /usr/obj/usr/src/mips.mips/tmp/usr/include/bsm/libbsm.h:880:
> warning: redundant redeclaration of 'au_bsm_to_domain'
> 23:15:17 /usr/obj/usr/src/mips.mips/tmp/usr/include/bsm/audit_
> record.h:301:
> warning: previous declaration of 'au_bsm_to_domain' was here
> ...
>

Fixed by r334388.
___
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: r334389 - head/sys/vm

2018-05-30 Thread Mark Johnston
Author: markj
Date: Wed May 30 16:48:48 2018
New Revision: 334389
URL: https://svnweb.freebsd.org/changeset/base/334389

Log:
  Typo.
  
  PR:   228533
  Submitted by: Jakub Piecuch 
  MFC after:1 week

Modified:
  head/sys/vm/vm_fault.c

Modified: head/sys/vm/vm_fault.c
==
--- head/sys/vm/vm_fault.c  Wed May 30 15:51:48 2018(r334388)
+++ head/sys/vm/vm_fault.c  Wed May 30 16:48:48 2018(r334389)
@@ -1671,7 +1671,7 @@ vm_fault_copy_entry(vm_map_t dst_map, vm_map_t src_map
 * range, copying each page from the source object to the
 * destination object.  Since the source is wired, those pages
 * must exist.  In contrast, the destination is pageable.
-* Since the destination object does share any backing storage
+* Since the destination object doesn't share any backing storage
 * with the source object, all of its pages must be dirtied,
 * regardless of whether they can be written.
 */
___
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: r334390 - head/contrib/openbsm/libbsm

2018-05-30 Thread Alan Somers
Author: asomers
Date: Wed May 30 17:05:48 2018
New Revision: 334390
URL: https://svnweb.freebsd.org/changeset/base/334390

Log:
  au_read_rec(3): correct return value in man page
  
  Submitted by: aniketp
  Reviewed by:  csjp (earlier version)
  MFC after:2 weeks
  Sponsored by: Google, Inc. (GSoC 2018)
  Differential Revision:https://reviews.freebsd.org/D15618

Modified:
  head/contrib/openbsm/libbsm/au_io.3

Modified: head/contrib/openbsm/libbsm/au_io.3
==
--- head/contrib/openbsm/libbsm/au_io.3 Wed May 30 16:48:48 2018
(r334389)
+++ head/contrib/openbsm/libbsm/au_io.3 Wed May 30 17:05:48 2018
(r334390)
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd August 4, 2009
+.Dd May 30, 2018
 .Dt AU_IO 3
 .Os
 .Sh NAME
@@ -129,14 +129,14 @@ would be used to free the record buffer.
 Finally, the source stream would be closed by a call to
 .Xr fclose 3 .
 .Sh RETURN VALUES
-The
+On success,
 .Fn au_fetch_tok
-and
+returns 0 while
 .Fn au_read_rec
-functions
-return 0 on success, or \-1 on failure along with additional error information
-returned via
-.Va errno .
+returns the number of bytes read.
+Both functions return \-1 on failure with
+.Va errno
+set appropriately.
 .Sh SEE ALSO
 .Xr free 3 ,
 .Xr libbsm 3
___
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: r334391 - head/share/mk

2018-05-30 Thread Ed Maste
Author: emaste
Date: Wed May 30 18:04:25 2018
New Revision: 334391
URL: https://svnweb.freebsd.org/changeset/base/334391

Log:
  Enable lld as the system linker by default on amd64
  
  The migration to LLVM's lld linker has been in progress for quite some
  time - about three years ago I opened an upstream LLVM meta-bug to track
  issues using lld as FreeBSD's linker, and about 1.5 years ago requested
  the first exp-run with lld as the system linker.
  
  As of r327783 we enabled LLD_BOOTSTRAP by default on amd64, using lld as
  the linker to link the kernel and world, but GNU ld was still installed
  as /usr/bin/ld.
  
  The vast majority of issues observed when building ports with lld as the
  system linker have now been solved, so set LLD_IS_LD by default on amd64
  and install lld as /usr/bin/ld.  A small number of port failures remain
  and these will be addressed in the near future.
  
  Thanks to antoine@ for handling the exp-runs, krion@ for investigating
  many port failures and adding LLD_UNSAFE or other fixes or workarounds,
  and everyone who helped investigate, fix or tag ports.
  
  PR:   214864 (exp-run)
  Sponsored by: The FreeBSD Foundation

Modified:
  head/share/mk/src.opts.mk

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Wed May 30 17:05:48 2018(r334390)
+++ head/share/mk/src.opts.mk   Wed May 30 18:04:25 2018(r334391)
@@ -263,11 +263,8 @@ __DEFAULT_YES_OPTIONS+=LLVM_LIBUNWIND
 .else
 __DEFAULT_NO_OPTIONS+=LLVM_LIBUNWIND
 .endif
-.if ${__T} == "aarch64"
+.if ${__T} == "aarch64" || ${__T} == "amd64"
 __DEFAULT_YES_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD
-.elif ${__T} == "amd64"
-__DEFAULT_YES_OPTIONS+=LLD_BOOTSTRAP
-__DEFAULT_NO_OPTIONS+=LLD_IS_LD
 .else
 __DEFAULT_NO_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD
 .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"


Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool

2018-05-30 Thread Antoine Brodin
On Mon, May 28, 2018 at 10:12 AM, Hans Petter Selasky
 wrote:
> Author: hselasky
> Date: Mon May 28 08:12:18 2018
> New Revision: 334277
> URL: https://svnweb.freebsd.org/changeset/base/334277
>
> Log:
>   MFV r333789: libpcap 1.9.0 (pre-release)
>
>   MFC after:1 month
>   Sponsored by: Mellanox Technologies

Hi,

It seems that this local change was lost during the upgrade:
https://svnweb.freebsd.org/base/head/contrib/libpcap/pcap/pcap.h?r1=190640&r2=190639&pathrev=190640

I think this broke at least the following ports:

http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/packetdrill-0.0.2018012501.log
http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/spamd-4.9.1_4.log
http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/vde2-2.3.2_2.log
http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/xprobe2-0.3.log

Cheers,

Antoine
___
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: r334393 - head/share/man/man5

2018-05-30 Thread Ed Maste
Author: emaste
Date: Wed May 30 18:34:45 2018
New Revision: 334393
URL: https://svnweb.freebsd.org/changeset/base/334393

Log:
  Regen src.conf.5 after r334391 - LLD_IS_LD default on amd64
  
  Relnotes: yes
  Sponsored by: The FreeBSD Foundation

Modified:
  head/share/man/man5/src.conf.5

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Wed May 30 18:27:48 2018
(r334392)
+++ head/share/man/man5/src.conf.5  Wed May 30 18:34:45 2018
(r334393)
@@ -1,6 +1,6 @@
 .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman.
 .\" $FreeBSD$
-.Dd May 26, 2018
+.Dd May 30, 2018
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -989,12 +989,12 @@ amd64/amd64 and arm64/aarch64.
 Set to use GNU binutils ld as the system linker, instead of LLVM's LLD.
 .Pp
 This is a default setting on
-amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, i386/i386, mips/mipsel, 
mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, 
mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, 
powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64, riscv/riscv64sf and 
sparc64/sparc64.
+arm/arm, arm/armeb, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, 
mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, 
mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, 
powerpc/powerpcspe, riscv/riscv64, riscv/riscv64sf and sparc64/sparc64.
 .It Va WITH_LLD_IS_LD
 Set to use LLVM's LLD as the system linker, instead of GNU binutils ld.
 .Pp
 This is a default setting on
-arm64/aarch64.
+amd64/amd64 and arm64/aarch64.
 .It Va WITHOUT_LLVM_COV
 Set to not build the
 .Xr llvm-cov 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"


Re: svn commit: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool

2018-05-30 Thread Navdeep Parhar
On 05/30/18 11:32, Antoine Brodin wrote:
> On Mon, May 28, 2018 at 10:12 AM, Hans Petter Selasky
>  wrote:
>> Author: hselasky
>> Date: Mon May 28 08:12:18 2018
>> New Revision: 334277
>> URL: https://svnweb.freebsd.org/changeset/base/334277
>>
>> Log:
>>   MFV r333789: libpcap 1.9.0 (pre-release)
>>
>>   MFC after:1 month
>>   Sponsored by: Mellanox Technologies
> 
> Hi,
> 
> It seems that this local change was lost during the upgrade:
> https://svnweb.freebsd.org/base/head/contrib/libpcap/pcap/pcap.h?r1=190640&r2=190639&pathrev=190640

Hi Hans,

If pcap.h is changed to include net/bpf.h like it used to then the
change made to cxgbetool in r334277 should be reverted too.

Regards,
Navdeep

> 
> I think this broke at least the following ports:
> 
> http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/packetdrill-0.0.2018012501.log
> http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/spamd-4.9.1_4.log
> http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/vde2-2.3.2_2.log
> http://gohan2.ysv.freebsd.org/data/head-amd64-default-baseline/p471115_s334360/logs/errors/xprobe2-0.3.log
> 
> Cheers,
> 
> Antoine
> 

___
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: r334394 - head/share/man/man4

2018-05-30 Thread Alan Somers
Author: asomers
Date: Wed May 30 19:57:15 2018
New Revision: 334394
URL: https://svnweb.freebsd.org/changeset/base/334394

Log:
  auditpipe(4): fix some ioctl arguments in the man page
  
  Fix the argument types for the AUDITPIPE_[GS]ET_PRESELECT_(NA)?FLAGS ioctls.
  Also, fix some grammar.
  
  [skip ci]
  
  PR:   226713
  Submitted by: aniketp
  MFC after:2 weeks
  Sponsored by: Google, Inc. (GSoC 2018)
  Differential Revision:https://reviews.freebsd.org/D15620

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

Modified: head/share/man/man4/auditpipe.4
==
--- head/share/man/man4/auditpipe.4 Wed May 30 18:34:45 2018
(r334393)
+++ head/share/man/man4/auditpipe.4 Wed May 30 19:57:15 2018
(r334394)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 5, 2006
+.Dd May 30, 2018
 .Dt AUDITPIPE 4
 .Os
 .Sh NAME
@@ -154,7 +154,7 @@ These flags correspond to the
 field in
 .Xr audit_control 5 .
 The ioctl argument should be of type
-.Vt u_int .
+.Vt au_mask_t .
 .It Dv AUDITPIPE_SET_PRESELECT_FLAGS
 Set the current default preselection flags for attributable events on the
 pipe.
@@ -163,7 +163,7 @@ These flags correspond to the
 field in
 .Xr audit_control 5 .
 The ioctl argument should be of type
-.Vt u_int .
+.Vt au_mask_t .
 .It Dv AUDITPIPE_GET_PRESELECT_NAFLAGS
 Retrieve the current default preselection flags for non-attributable events
 on the pipe.
@@ -172,7 +172,7 @@ These flags correspond to the
 field in
 .Xr audit_control 5 .
 The ioctl argument should be of type
-.Vt u_int .
+.Vt au_mask_t .
 .It Dv AUDITPIPE_SET_PRESELECT_NAFLAGS
 Set the current default preselection flags for non-attributable events on the
 pipe.
@@ -181,7 +181,7 @@ These flags correspond to the
 field in
 .Xr audit_control 5 .
 The ioctl argument should be of type
-.Vt u_int .
+.Vt au_mask_t .
 .It Dv AUDITPIPE_GET_PRESELECT_AUID
 Query the current preselection masks for a specific auid on the pipe.
 The ioctl argument should be of type
@@ -245,7 +245,7 @@ manual page for information on audit-related bugs and 
 .Pp
 The configurable preselection mechanism mirrors the selection model present
 for the global audit trail.
-It might be desirable to provided a more flexible selection model.
+It might be desirable to provide a more flexible selection model.
 .Pp
 The per-pipe audit event queue is fifo, with drops occurring if either the
 user thread provides in sufficient for the record on the queue head, or on
___
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: r334395 - head/tests/sys

2018-05-30 Thread Alan Somers
Author: asomers
Date: Wed May 30 19:58:36 2018
New Revision: 334395
URL: https://svnweb.freebsd.org/changeset/base/334395

Log:
  Revert r334362
  
  Reconnect tests/sys/audit now that the GCC issue is fixed by 334388
  
  MFC after:2 weeks
  X-MFC-With:   334362, 334360, 334388

Modified:
  head/tests/sys/Makefile

Modified: head/tests/sys/Makefile
==
--- head/tests/sys/Makefile Wed May 30 19:57:15 2018(r334394)
+++ head/tests/sys/Makefile Wed May 30 19:58:36 2018(r334395)
@@ -6,6 +6,7 @@ TESTSDIR=   ${TESTSBASE}/sys
 
 TESTS_SUBDIRS+=acl
 TESTS_SUBDIRS+=aio
+TESTS_SUBDIRS+=audit
 TESTS_SUBDIRS+=capsicum
 TESTS_SUBDIRS+=${_cddl}
 TESTS_SUBDIRS+=fifo
___
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: r334277 - in head: contrib/libpcap contrib/ofed/usr.lib/3 contrib/pf/pflogd contrib/wpa/src/l2_packet lib lib/libpcap share/mk usr.sbin/cxgbetool

2018-05-30 Thread Xin LI
On Mon, May 28, 2018 at 1:14 AM Hans Petter Selasky 
wrote:

> Author: hselasky
> Date: Mon May 28 08:12:18 2018
> New Revision: 334277
> URL: https://svnweb.freebsd.org/changeset/base/334277

> Log:
>MFV r333789: libpcap 1.9.0 (pre-release)

>MFC after:1 month
>Sponsored by: Mellanox Technologies

> Replaced:
>head/contrib/libpcap/
>   - copied from r333789, vendor/libpcap/dist/

This would make vendor/libpcap/dist history replace head/contrib/libpcap,
which effectively discards all FreeBSD local changes for base purposes, and
hides its change history. Is this intentional?  If not, could you please
revert the tree back to its previous state and redo the merge?

(You should probably also update sys/net/bpf.h and/or sys/net/dlt.h, by the
way).
___
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: r334396 - head/sys/fs/nfsserver

2018-05-30 Thread Rick Macklem
Author: rmacklem
Date: Wed May 30 20:16:17 2018
New Revision: 334396
URL: https://svnweb.freebsd.org/changeset/base/334396

Log:
  Strengthen locking for the NFSv4.1 server DestroySession operation.
  
  If a client did a DestroySession on a session while it was still in use,
  the server might try to use the session structure after it is free'd.
  I think the client has violated RFC5661 if it does this, but this patch
  makes DestroySession block all other nfsd threads so no thread could
  be using the session when it is free'd. After the DestroySession, nfsd
  threads will not be able to find the session. The patch also adds a check
  for nd_sessionid being set, although if that was not the case it would have
  been all 0s and unlikely to have a false match.
  This might fix the crashes described in PR#228497 for the FreeNAS server.
  
  PR:   228497
  MFC after:1 week

Modified:
  head/sys/fs/nfsserver/nfs_nfsdstate.c

Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c
==
--- head/sys/fs/nfsserver/nfs_nfsdstate.c   Wed May 30 19:58:36 2018
(r334395)
+++ head/sys/fs/nfsserver/nfs_nfsdstate.c   Wed May 30 20:16:17 2018
(r334396)
@@ -6006,17 +6006,32 @@ nfsrv_findsession(uint8_t *sessionid)
 int
 nfsrv_destroysession(struct nfsrv_descript *nd, uint8_t *sessionid)
 {
-   int error, samesess;
+   int error, igotlock, samesess;
 
samesess = 0;
-   if (!NFSBCMP(sessionid, nd->nd_sessionid, NFSX_V4SESSIONID)) {
+   if (!NFSBCMP(sessionid, nd->nd_sessionid, NFSX_V4SESSIONID) &&
+   (nd->nd_flag & ND_HASSEQUENCE) != 0) {
samesess = 1;
if ((nd->nd_flag & ND_LASTOP) == 0)
return (NFSERR_BADSESSION);
}
+
+   /* Lock out other nfsd threads */
+   NFSLOCKV4ROOTMUTEX();
+   nfsv4_relref(&nfsv4rootfs_lock);
+   do {
+   igotlock = nfsv4_lock(&nfsv4rootfs_lock, 1, NULL,
+   NFSV4ROOTLOCKMUTEXPTR, NULL);
+   } while (igotlock == 0);
+   NFSUNLOCKV4ROOTMUTEX();
+
error = nfsrv_freesession(NULL, sessionid);
if (error == 0 && samesess != 0)
nd->nd_flag &= ~ND_HASSEQUENCE;
+
+   NFSLOCKV4ROOTMUTEX();
+   nfsv4_unlock(&nfsv4rootfs_lock, 1);
+   NFSUNLOCKV4ROOTMUTEX();
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: r334397 - head/sys/i386/i386

2018-05-30 Thread Konstantin Belousov
Author: kib
Date: Wed May 30 20:24:21 2018
New Revision: 334397
URL: https://svnweb.freebsd.org/changeset/base/334397

Log:
  Avoid unneccessary TLB shootdowns in pmap_unwire_ptp() for user pmaps,
  which no longer create recursive page table mappings.
  
  Benchmarked by:   bde
  Tested by:pho
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/i386/i386/pmap.c

Modified: head/sys/i386/i386/pmap.c
==
--- head/sys/i386/i386/pmap.c   Wed May 30 20:16:17 2018(r334396)
+++ head/sys/i386/i386/pmap.c   Wed May 30 20:24:21 2018(r334397)
@@ -1872,7 +1872,6 @@ pmap_unwire_ptp(pmap_t pmap, vm_page_t m, struct spgli
 static void
 _pmap_unwire_ptp(pmap_t pmap, vm_page_t m, struct spglist *free)
 {
-   vm_offset_t pteva;
 
/*
 * unmap the page table page
@@ -1881,16 +1880,13 @@ _pmap_unwire_ptp(pmap_t pmap, vm_page_t m, struct spgl
--pmap->pm_stats.resident_count;
 
/*
-* Do an invltlb to make the invalidated mapping
-* take effect immediately.
+* There is not need to invalidate the recursive mapping since
+* we never instantiate such mapping for the usermode pmaps,
+* and never remove page table pages from the kernel pmap.
+* Put page on a list so that it is released since all TLB
+* shootdown is done.
 */
-   pteva = VM_MAXUSER_ADDRESS + i386_ptob(m->pindex);
-   pmap_invalidate_page(pmap, pteva);
-
-   /* 
-* Put page on a list so that it is released after
-* *ALL* TLB shootdown is done
-*/
+   MPASS(pmap != kernel_pmap);
pmap_add_delayed_free_list(m, free, TRUE);
 }
 
___
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: r334398 - head/sys/i386/i386

2018-05-30 Thread Konstantin Belousov
Author: kib
Date: Wed May 30 20:26:47 2018
New Revision: 334398
URL: https://svnweb.freebsd.org/changeset/base/334398

Log:
  Do use pmap_pte_quick() in pmap_enter_quick_locked().
  
  Benchmarked by:   bde
  Tested by:pho
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/i386/i386/pmap.c

Modified: head/sys/i386/i386/pmap.c
==
--- head/sys/i386/i386/pmap.c   Wed May 30 20:24:21 2018(r334397)
+++ head/sys/i386/i386/pmap.c   Wed May 30 20:26:47 2018(r334398)
@@ -3916,14 +3916,14 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v
mpte = NULL;
}
 
-   /* XXXKIB: pmap_pte_quick() instead ? */
-   pte = pmap_pte(pmap, va);
+   sched_pin();
+   pte = pmap_pte_quick(pmap, va);
if (*pte) {
if (mpte != NULL) {
mpte->wire_count--;
mpte = NULL;
}
-   pmap_pte_release(pte);
+   sched_unpin();
return (mpte);
}
 
@@ -3941,7 +3941,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v

mpte = NULL;
}
-   pmap_pte_release(pte);
+   sched_unpin();
return (mpte);
}
 
@@ -3963,7 +3963,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v
pte_store(pte, pa | PG_V | PG_U);
else
pte_store(pte, pa | PG_V | PG_U | PG_MANAGED);
-   pmap_pte_release(pte);
+   sched_unpin();
return (mpte);
 }
 
___
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: r334399 - head/sys/i386/i386

2018-05-30 Thread Konstantin Belousov
Author: kib
Date: Wed May 30 20:39:22 2018
New Revision: 334399
URL: https://svnweb.freebsd.org/changeset/base/334399

Log:
  Restore pmap_copy() for 4/4 i386 pmap.
  
  Create yet another temporal pte mapping routine pmap_pte_quick3(),
  which is the copy of the pmap_pte_quick() and relies on the
  pvh_global_lock to protect the frame.  It accounts into the same
  counters as pmap_pte_quick().  It is needed since pmap_copy() uses
  pmap_pte_quick() already, and since a user pmap is no longer current
  pmap.
  
  pmap_copy() still provides the advantage for real-world workloads
  involving lot of forks where processes do not exec immediately.
  
  Benchmarked by:   bde
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/i386/i386/pmap.c

Modified: head/sys/i386/i386/pmap.c
==
--- head/sys/i386/i386/pmap.c   Wed May 30 20:26:47 2018(r334398)
+++ head/sys/i386/i386/pmap.c   Wed May 30 20:39:22 2018(r334399)
@@ -264,10 +264,10 @@ caddr_t CADDR3;
  */
 static caddr_t crashdumpmap;
 
-static pt_entry_t *PMAP1 = NULL, *PMAP2;
-static pt_entry_t *PADDR1 = NULL, *PADDR2;
+static pt_entry_t *PMAP1 = NULL, *PMAP2, *PMAP3;
+static pt_entry_t *PADDR1 = NULL, *PADDR2, *PADDR3;
 #ifdef SMP
-static int PMAP1cpu;
+static int PMAP1cpu, PMAP3cpu;
 static int PMAP1changedcpu;
 SYSCTL_INT(_debug, OID_AUTO, PMAP1changedcpu, CTLFLAG_RD, 
   &PMAP1changedcpu, 0,
@@ -658,6 +658,7 @@ pmap_bootstrap(vm_paddr_t firstaddr)
 */
SYSMAP(pt_entry_t *, PMAP1, PADDR1, 1)
SYSMAP(pt_entry_t *, PMAP2, PADDR2, 1)
+   SYSMAP(pt_entry_t *, PMAP3, PADDR3, 1)
 
mtx_init(&PMAP2mutex, "PMAP2", NULL, MTX_DEF);
 
@@ -1563,6 +1564,40 @@ pmap_pte_quick(pmap_t pmap, vm_offset_t va)
return (0);
 }
 
+static pt_entry_t *
+pmap_pte_quick3(pmap_t pmap, vm_offset_t va)
+{
+   pd_entry_t newpf;
+   pd_entry_t *pde;
+
+   pde = pmap_pde(pmap, va);
+   if (*pde & PG_PS)
+   return (pde);
+   if (*pde != 0) {
+   rw_assert(&pvh_global_lock, RA_WLOCKED);
+   KASSERT(curthread->td_pinned > 0, ("curthread not pinned"));
+   newpf = *pde & PG_FRAME;
+   if ((*PMAP3 & PG_FRAME) != newpf) {
+   *PMAP3 = newpf | PG_RW | PG_V | PG_A | PG_M;
+#ifdef SMP
+   PMAP3cpu = PCPU_GET(cpuid);
+#endif
+   invlcaddr(PADDR3);
+   PMAP1changed++;
+   } else
+#ifdef SMP
+   if (PMAP3cpu != PCPU_GET(cpuid)) {
+   PMAP3cpu = PCPU_GET(cpuid);
+   invlcaddr(PADDR3);
+   PMAP1changedcpu++;
+   } else
+#endif
+   PMAP1unchanged++;
+   return (PADDR3 + (i386_btop(va) & (NPTEPG - 1)));
+   }
+   return (0);
+}
+
 /*
  * Routine:pmap_extract
  * Function:
@@ -4166,6 +4201,109 @@ void
 pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t 
len,
 vm_offset_t src_addr)
 {
+   struct spglist free;
+   pt_entry_t *src_pte, *dst_pte, ptetemp;
+   pd_entry_t srcptepaddr;
+   vm_page_t dstmpte, srcmpte;
+   vm_offset_t addr, end_addr, pdnxt;
+   u_int ptepindex;
+
+   if (dst_addr != src_addr)
+   return;
+
+   end_addr = src_addr + len;
+
+   rw_wlock(&pvh_global_lock);
+   if (dst_pmap < src_pmap) {
+   PMAP_LOCK(dst_pmap);
+   PMAP_LOCK(src_pmap);
+   } else {
+   PMAP_LOCK(src_pmap);
+   PMAP_LOCK(dst_pmap);
+   }
+   sched_pin();
+   for (addr = src_addr; addr < end_addr; addr = pdnxt) {
+   KASSERT(addr < PMAP_TRM_MIN_ADDRESS,
+   ("pmap_copy: invalid to pmap_copy the trampoline"));
+
+   pdnxt = (addr + NBPDR) & ~PDRMASK;
+   if (pdnxt < addr)
+   pdnxt = end_addr;
+   ptepindex = addr >> PDRSHIFT;
+
+   srcptepaddr = src_pmap->pm_pdir[ptepindex];
+   if (srcptepaddr == 0)
+   continue;
+
+   if (srcptepaddr & PG_PS) {
+   if ((addr & PDRMASK) != 0 || addr + NBPDR > end_addr)
+   continue;
+   if (dst_pmap->pm_pdir[ptepindex] == 0 &&
+   ((srcptepaddr & PG_MANAGED) == 0 ||
+   pmap_pv_insert_pde(dst_pmap, addr, srcptepaddr &
+   PG_PS_FRAME))) {
+   dst_pmap->pm_pdir[ptepindex] = srcptepaddr &
+   ~PG_W;
+   dst_pmap->pm_stats.resident_count +=
+   NBPDR / PAGE_SIZE;
+   pmap_pde_mappings++;
+   }
+   continue;
+   }
+
+

svn commit: r334400 - head/sys/i386/i386

2018-05-30 Thread Konstantin Belousov
Author: kib
Date: Wed May 30 20:43:48 2018
New Revision: 334400
URL: https://svnweb.freebsd.org/changeset/base/334400

Log:
  Extract code for fast mapping of pte from pmap_extract_and_hold()
  into the helper function pmap_pte_ufast().
  
  Benchmarked by:   bde
  Tested by:pho
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/i386/i386/pmap.c

Modified: head/sys/i386/i386/pmap.c
==
--- head/sys/i386/i386/pmap.c   Wed May 30 20:39:22 2018(r334399)
+++ head/sys/i386/i386/pmap.c   Wed May 30 20:43:48 2018(r334400)
@@ -1598,6 +1598,26 @@ pmap_pte_quick3(pmap_t pmap, vm_offset_t va)
return (0);
 }
 
+static pt_entry_t
+pmap_pte_ufast(pmap_t pmap, vm_offset_t va, pd_entry_t pde)
+{
+   pt_entry_t *eh_ptep, pte, *ptep;
+
+   PMAP_LOCK_ASSERT(pmap, MA_OWNED);
+   pde &= PG_FRAME;
+   critical_enter();
+   eh_ptep = (pt_entry_t *)PCPU_GET(pmap_eh_ptep);
+   if ((*eh_ptep & PG_FRAME) != pde) {
+   *eh_ptep = pde | PG_RW | PG_V | PG_A | PG_M;
+   invlcaddr((void *)PCPU_GET(pmap_eh_va));
+   }
+   ptep = (pt_entry_t *)PCPU_GET(pmap_eh_va) + (i386_btop(va) &
+   (NPTEPG - 1));
+   pte = *ptep;
+   critical_exit();
+   return (pte);
+}
+
 /*
  * Routine:pmap_extract
  * Function:
@@ -1637,8 +1657,8 @@ pmap_extract(pmap_t pmap, vm_offset_t va)
 vm_page_t
 pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot)
 {
-   pd_entry_t pde, newpf;
-   pt_entry_t *eh_ptep, pte, *ptep;
+   pd_entry_t pde;
+   pt_entry_t pte;
vm_page_t m;
vm_paddr_t pa;
 
@@ -1658,17 +1678,7 @@ retry:
vm_page_hold(m);
}
} else {
-   newpf = pde & PG_FRAME;
-   critical_enter();
-   eh_ptep = (pt_entry_t *)PCPU_GET(pmap_eh_ptep);
-   if ((*eh_ptep & PG_FRAME) != newpf) {
-   *eh_ptep = newpf | PG_RW | PG_V | PG_A | PG_M;
-   invlcaddr((void *)PCPU_GET(pmap_eh_va));
-   }
-   ptep = (pt_entry_t *)PCPU_GET(pmap_eh_va) +
-   (i386_btop(va) & (NPTEPG - 1));
-   pte = *ptep;
-   critical_exit();
+   pte = pmap_pte_ufast(pmap, va, pde);
if (pte != 0 &&
((pte & PG_RW) || (prot & VM_PROT_WRITE) == 0)) {
if (vm_page_pa_tryrelock(pmap, pte & PG_FRAME,
___
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: r334365 - head/sys/dev/pci

2018-05-30 Thread Peter Grehan

Hi Nathan,

There are a ton of ARM boards that need this too. You can find one-off 
hacks all through the tree and one of the nice things about this change 
is that all of those can be consolidated/removed now. If we are going to 
have some #ifdef and special cases, it would be better to make them for 
bhyve.


 Sure, but there are multiple orders of magnitude more users of bhyve 
than power9/affected ARM boards, so can a amd64/i386 ifdef be put there 
until that work is done ?


later,

Peter.
___
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: r334401 - head/sys/i386/i386

2018-05-30 Thread Konstantin Belousov
Author: kib
Date: Wed May 30 20:47:20 2018
New Revision: 334401
URL: https://svnweb.freebsd.org/changeset/base/334401

Log:
  Use pmap_pte_ufast() instead of pmap_pte() in pmap_extract(),
  pmap_is_prefaultable() and pmap_incore(), pushing the number of
  shootdown IPIs back to the 3/1 kernel.
  
  Benchmarked by:   bde
  Tested by:pho
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/i386/i386/pmap.c

Modified: head/sys/i386/i386/pmap.c
==
--- head/sys/i386/i386/pmap.c   Wed May 30 20:43:48 2018(r334400)
+++ head/sys/i386/i386/pmap.c   Wed May 30 20:47:20 2018(r334401)
@@ -1628,7 +1628,7 @@ vm_paddr_t 
 pmap_extract(pmap_t pmap, vm_offset_t va)
 {
vm_paddr_t rtval;
-   pt_entry_t *pte;
+   pt_entry_t pte;
pd_entry_t pde;
 
rtval = 0;
@@ -1638,9 +1638,8 @@ pmap_extract(pmap_t pmap, vm_offset_t va)
if ((pde & PG_PS) != 0)
rtval = (pde & PG_PS_FRAME) | (va & PDRMASK);
else {
-   pte = pmap_pte(pmap, va);
-   rtval = (*pte & PG_FRAME) | (va & PAGE_MASK);
-   pmap_pte_release(pte);
+   pte = pmap_pte_ufast(pmap, va, pde);
+   rtval = (pte & PG_FRAME) | (va & PAGE_MASK);
}
}
PMAP_UNLOCK(pmap);
@@ -4787,19 +4786,14 @@ pmap_is_modified_pvh(struct md_page *pvh)
 boolean_t
 pmap_is_prefaultable(pmap_t pmap, vm_offset_t addr)
 {
-   pd_entry_t *pde;
-   pt_entry_t *pte;
+   pd_entry_t pde;
boolean_t rv;
 
rv = FALSE;
PMAP_LOCK(pmap);
-   pde = pmap_pde(pmap, addr);
-   if (*pde != 0 && (*pde & PG_PS) == 0) {
-   pte = pmap_pte(pmap, addr);
-   if (pte != NULL)
-   rv = *pte == 0;
-   pmap_pte_release(pte);
-   }
+   pde = *pmap_pde(pmap, addr);
+   if (pde != 0 && (pde & PG_PS) == 0)
+   rv = pmap_pte_ufast(pmap, addr, pde) == 0;
PMAP_UNLOCK(pmap);
return (rv);
 }
@@ -5584,25 +5578,23 @@ pmap_change_attr(vm_offset_t va, vm_size_t size, int m
 int
 pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *locked_pa)
 {
-   pd_entry_t *pdep;
-   pt_entry_t *ptep, pte;
+   pd_entry_t pde;
+   pt_entry_t pte;
vm_paddr_t pa;
int val;
 
PMAP_LOCK(pmap);
 retry:
-   pdep = pmap_pde(pmap, addr);
-   if (*pdep != 0) {
-   if (*pdep & PG_PS) {
-   pte = *pdep;
+   pde = *pmap_pde(pmap, addr);
+   if (pde != 0) {
+   if ((pde & PG_PS) != 0) {
+   pte = pde;
/* Compute the physical address of the 4KB page. */
-   pa = ((*pdep & PG_PS_FRAME) | (addr & PDRMASK)) &
+   pa = ((pde & PG_PS_FRAME) | (addr & PDRMASK)) &
PG_FRAME;
val = MINCORE_SUPER;
} else {
-   ptep = pmap_pte(pmap, addr);
-   pte = *ptep;
-   pmap_pte_release(ptep);
+   pte = pmap_pte_ufast(pmap, addr, pde);
pa = pte & PG_FRAME;
val = 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"


Re: svn commit: r334365 - head/sys/dev/pci

2018-05-30 Thread Justin Hibbits
Hi Peter,

On Wed, May 30, 2018, 15:44 Peter Grehan  wrote:

> Hi Nathan,
>
> > There are a ton of ARM boards that need this too. You can find one-off
> > hacks all through the tree and one of the nice things about this change
> > is that all of those can be consolidated/removed now. If we are going to
> > have some #ifdef and special cases, it would be better to make them for
> > bhyve.
>
>   Sure, but there are multiple orders of magnitude more users of bhyve
> than power9/affected ARM boards, so can a amd64/i386 ifdef be put there
> until that work is done ?
>

I can add one either tonight or tomorrow.  If bhyve has its own attachment
id, it is trivial to add a special case on it quickly, too.


> later,
>
> Peter.
>

- Justin

>
___
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: r334365 - head/sys/dev/pci

2018-05-30 Thread Peter Grehan

Hi Justin,


I can add one either tonight or tomorrow.


 Thanks.


If bhyve has its own  attachment id, it is trivial
to add a special case on it quickly, too.


 vendor_id -- 0x1275

later,

Peter.
___
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: r334365 - head/sys/dev/pci

2018-05-30 Thread Peter Grehan

If bhyve has its own  attachment id, it is trivial
to add a special case on it quickly, too.


  vendor_id -- 0x1275


 Actually, this can also be AMD. A better check would be if the system 
is running virtualized.


later,

Peter.
___
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: r334365 - head/sys/dev/pci

2018-05-30 Thread Justin Hibbits
On Wed, May 30, 2018, 15:55 Peter Grehan  wrote:

> >> If bhyve has its own  attachment id, it is trivial
> >> to add a special case on it quickly, too.
> >
> >   vendor_id -- 0x1275
>
>   Actually, this can also be AMD. A better check would be if the system
> is running virtualized.
>

I'm thinking more of a root complex driver. If there is something
characterized for bhyve, we can just make a driver that had the override.


> later,
>
> Peter.
>

- Justin

>
___
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: r334402 - head/sys/net

2018-05-30 Thread Matt Macy
Author: mmacy
Date: Wed May 30 21:46:10 2018
New Revision: 334402
URL: https://svnweb.freebsd.org/changeset/base/334402

Log:
  if_setlladdr: don't call ioctl in epoch context
  
  PR: 228612
  Reported by: markj

Modified:
  head/sys/net/if.c

Modified: head/sys/net/if.c
==
--- head/sys/net/if.c   Wed May 30 20:47:20 2018(r334401)
+++ head/sys/net/if.c   Wed May 30 21:46:10 2018(r334402)
@@ -3839,6 +3839,7 @@ if_setlladdr(struct ifnet *ifp, const u_char *lladdr, 
 * to re-init it in order to reprogram its
 * address filter.
 */
+   NET_EPOCH_EXIT();
if ((ifp->if_flags & IFF_UP) != 0) {
if (ifp->if_ioctl) {
ifp->if_flags &= ~IFF_UP;
@@ -3852,6 +3853,7 @@ if_setlladdr(struct ifnet *ifp, const u_char *lladdr, 
}
}
EVENTHANDLER_INVOKE(iflladdr_event, ifp);
+   return (0);
  out:
NET_EPOCH_EXIT();
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: r334403 - head/sys/security/audit

2018-05-30 Thread Alan Somers
Author: asomers
Date: Wed May 30 21:50:23 2018
New Revision: 334403
URL: https://svnweb.freebsd.org/changeset/base/334403

Log:
  #include  in security/audit/audit_ioctl.h
  
  security/audit/audit_ioctl.h uses a type from bsm/audit.h, so needs to
  include it.  And it needs to know the type's size, so it can't just
  forward-declare.
  
  PR:   228470
  Submitted by: aniketp
  MFC after:2 weeks
  Sponsored by: Google, Inc. (GSoC 2018)
  Differential Revision:https://reviews.freebsd.org/D15561

Modified:
  head/sys/security/audit/audit_ioctl.h

Modified: head/sys/security/audit/audit_ioctl.h
==
--- head/sys/security/audit/audit_ioctl.h   Wed May 30 21:46:10 2018
(r334402)
+++ head/sys/security/audit/audit_ioctl.h   Wed May 30 21:50:23 2018
(r334403)
@@ -31,6 +31,8 @@
 #ifndef _SECURITY_AUDIT_AUDIT_IOCTL_H_
 #define_SECURITY_AUDIT_AUDIT_IOCTL_H_
 
+#include 
+
 #defineAUDITPIPE_IOBASE'A'
 
 /*
___
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: r334404 - head/usr.sbin/pmc

2018-05-30 Thread Matt Macy
Author: mmacy
Date: Wed May 30 22:03:02 2018
New Revision: 334404
URL: https://svnweb.freebsd.org/changeset/base/334404

Log:
  pmc stat: fix format strings for 32-bit

Modified:
  head/usr.sbin/pmc/Makefile   (contents, props changed)
  head/usr.sbin/pmc/cmd_pmc_stat.c   (contents, props changed)

Modified: head/usr.sbin/pmc/Makefile
==
--- head/usr.sbin/pmc/Makefile  Wed May 30 21:50:23 2018(r334403)
+++ head/usr.sbin/pmc/Makefile  Wed May 30 22:03:02 2018(r334404)
@@ -9,5 +9,4 @@ LIBADD= kvm pmc m ncursesw pmcstat elf
 
 SRCS=  pmc.c pmc_util.c cmd_pmc_stat.c
 
-CWARNFLAGS.cmd_pmc_stat.c= -Wno-format
 .include 

Modified: head/usr.sbin/pmc/cmd_pmc_stat.c
==
--- head/usr.sbin/pmc/cmd_pmc_stat.cWed May 30 21:50:23 2018
(r334403)
+++ head/usr.sbin/pmc/cmd_pmc_stat.cWed May 30 22:03:02 2018
(r334404)
@@ -271,23 +271,23 @@ pmc_stat_print_stat(struct rusage *ru)
fprintf(pmc_args.pa_printfile, "%16ld  %s\t#\t%02.03f M/sec\n",
ru->ru_nivcsw, "involuntary csw", ((double)ru->ru_nivcsw / 
(double)ticks) / hz);
 
-   fprintf(pmc_args.pa_printfile, "%16ld  %s\n", cvals[CYCLES], 
stat_mode_names[CYCLES]);
-   fprintf(pmc_args.pa_printfile, "%16ld  %s\t\t#\t%01.03f inst/cycle\n", 
cvals[INST], stat_mode_names[INST],
+   fprintf(pmc_args.pa_printfile, "%16jd  %s\n", (uintmax_t)cvals[CYCLES], 
stat_mode_names[CYCLES]);
+   fprintf(pmc_args.pa_printfile, "%16jd  %s\t\t#\t%01.03f inst/cycle\n", 
(uintmax_t)cvals[INST], stat_mode_names[INST],
(double)cvals[INST] / cvals[CYCLES]);
-   fprintf(pmc_args.pa_printfile, "%16ld  %s\n", cvals[BR], 
stat_mode_names[BR]);
+   fprintf(pmc_args.pa_printfile, "%16jd  %s\n", (uintmax_t)cvals[BR], 
stat_mode_names[BR]);
if (stat_mode_names[BR_MISS] == pmc_stat_mode_names[BR_MISS])
-   fprintf(pmc_args.pa_printfile, "%16ld  %s\t\t#\t%.03f%%\n",
-   cvals[BR_MISS], stat_mode_names[BR_MISS],
+   fprintf(pmc_args.pa_printfile, "%16jd  %s\t\t#\t%.03f%%\n",
+   (uintmax_t)cvals[BR_MISS], stat_mode_names[BR_MISS],
100 * ((double)cvals[BR_MISS] / cvals[BR]));
else
-   fprintf(pmc_args.pa_printfile, "%16ld  %s\n",
-   cvals[BR_MISS], stat_mode_names[BR_MISS]);
-   fprintf(pmc_args.pa_printfile, "%16ld  %s%s", cvals[CACHE], 
stat_mode_names[CACHE],
+   fprintf(pmc_args.pa_printfile, "%16jd  %s\n",
+   (uintmax_t)cvals[BR_MISS], stat_mode_names[BR_MISS]);
+   fprintf(pmc_args.pa_printfile, "%16jd  %s%s", (uintmax_t)cvals[CACHE], 
stat_mode_names[CACHE],
stat_mode_names[CACHE] != pmc_stat_mode_names[CACHE] ? "\n" : "");
if (stat_mode_names[CACHE] == pmc_stat_mode_names[CACHE])
fprintf(pmc_args.pa_printfile, "\t#\t%.03f refs/inst\n",
((double)cvals[CACHE] / cvals[INST]));
-   fprintf(pmc_args.pa_printfile, "%16ld  %s%s", cvals[CACHE_MISS], 
stat_mode_names[CACHE_MISS],
+   fprintf(pmc_args.pa_printfile, "%16jd  %s%s", 
(uintmax_t)cvals[CACHE_MISS], stat_mode_names[CACHE_MISS],
stat_mode_names[CACHE_MISS] != pmc_stat_mode_names[CACHE_MISS] ? 
"\n" : "");
if (stat_mode_names[CACHE_MISS] == pmc_stat_mode_names[CACHE_MISS])
fprintf(pmc_args.pa_printfile, "\t\t#\t%.03f%%\n",
@@ -296,7 +296,6 @@ pmc_stat_print_stat(struct rusage *ru)
 
showtime(pmc_args.pa_printfile, &before_ts, &after, ru);
 }
-
 
 static struct option longopts[] = {
{"events", required_argument, NULL, 'j'},
___
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: r334405 - in head/sys: compat/freebsd32 kern

2018-05-30 Thread Brooks Davis
Author: brooks
Date: Wed May 30 22:22:58 2018
New Revision: 334405
URL: https://svnweb.freebsd.org/changeset/base/334405

Log:
  Remove alternative names that are identical to the default.
  
  Verified by make sysent producing no changes.

Modified:
  head/sys/compat/freebsd32/syscalls.master
  head/sys/kern/syscalls.master

Modified: head/sys/compat/freebsd32/syscalls.master
==
--- head/sys/compat/freebsd32/syscalls.master   Wed May 30 22:03:02 2018
(r334404)
+++ head/sys/compat/freebsd32/syscalls.master   Wed May 30 22:22:58 2018
(r334405)
@@ -156,8 +156,7 @@
size_t count); }
 59 AUE_EXECVE  STD { int freebsd32_execve(char *fname, \
uint32_t *argv, uint32_t *envv); }
-60 AUE_UMASK   NOPROTO { int umask(int newmask); } umask \
-   umask_args int
+60 AUE_UMASK   NOPROTO { int umask(int newmask); }
 61 AUE_CHROOT  NOPROTO { int chroot(char *path); }
 62 AUE_FSTAT   COMPAT  { int freebsd32_fstat(int fd, \
struct ostat32 *ub); }

Modified: head/sys/kern/syscalls.master
==
--- head/sys/kern/syscalls.master   Wed May 30 22:03:02 2018
(r334404)
+++ head/sys/kern/syscalls.master   Wed May 30 22:22:58 2018
(r334405)
@@ -210,8 +210,7 @@
_In_z_ char *fname, \
_In_z_ char **argv, \
_In_z_ char **envv); }
-60 AUE_UMASK   STD { int umask(int newmask); } umask umask_args \
-   int
+60 AUE_UMASK   STD { int umask(int newmask); }
 61 AUE_CHROOT  STD { int chroot(_In_z_ char *path); }
 62 AUE_FSTAT   COMPAT  { int fstat(int fd, _Out_ struct ostat *sb); }
 63 AUE_NULLCOMPAT  { int getkerninfo(int op, \
___
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: r334406 - in head/sys/dev/cxgbe: . common

2018-05-30 Thread Navdeep Parhar
Author: np
Date: Wed May 30 22:36:09 2018
New Revision: 334406
URL: https://svnweb.freebsd.org/changeset/base/334406

Log:
  cxgbe(4): Consider all supported speeds when building the ifmedia list
  for a port.  Fix other related issues while here:
  - Require port lock for access to link_config.
  - Allow 100Mbps operation by tracking the speed in Mbps.  Yes, really.
  - New port flag to indicate that the media list is immutable.  It will
be used in future refinements.
  
  This also fixes a bug where the driver reports incorrect media with
  recent firmwares.
  
  MFC after:2 days
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/common/common.h
  head/sys/dev/cxgbe/common/t4_hw.c
  head/sys/dev/cxgbe/t4_main.c

Modified: head/sys/dev/cxgbe/adapter.h
==
--- head/sys/dev/cxgbe/adapter.hWed May 30 22:22:58 2018
(r334405)
+++ head/sys/dev/cxgbe/adapter.hWed May 30 22:36:09 2018
(r334406)
@@ -164,6 +164,7 @@ enum {
 
/* port flags */
HAS_TRACEQ  = (1 << 3),
+   FIXED_IFMEDIA   = (1 << 4), /* ifmedia list doesn't change. */
 
/* VI flags */
DOOMED  = (1 << 0),

Modified: head/sys/dev/cxgbe/common/common.h
==
--- head/sys/dev/cxgbe/common/common.h  Wed May 30 22:22:58 2018
(r334405)
+++ head/sys/dev/cxgbe/common/common.h  Wed May 30 22:36:09 2018
(r334406)
@@ -418,12 +418,12 @@ struct link_config {
unsigned char  requested_aneg;   /* link aneg user has requested */
unsigned char  requested_fc; /* flow control user has requested */
unsigned char  requested_fec;/* FEC user has requested */
-   unsigned int   requested_speed;  /* speed user has requested */
+   unsigned int   requested_speed;  /* speed user has requested (Mbps) */
 
unsigned short supported;/* link capabilities */
unsigned short advertising;  /* advertised capabilities */
unsigned short lp_advertising;   /* peer advertised capabilities */
-   unsigned int   speed;/* actual link speed */
+   unsigned int   speed;/* actual link speed (Mbps) */
unsigned char  fc;   /* actual link flow control */
unsigned char  fec;  /* actual FEC */
unsigned char  link_ok;  /* link up? */

Modified: head/sys/dev/cxgbe/common/t4_hw.c
==
--- head/sys/dev/cxgbe/common/t4_hw.c   Wed May 30 22:22:58 2018
(r334405)
+++ head/sys/dev/cxgbe/common/t4_hw.c   Wed May 30 22:36:09 2018
(r334406)
@@ -3727,21 +3727,24 @@ int t4_link_l1cfg(struct adapter *adap, unsigned int m
lc->requested_aneg == AUTONEG_DISABLE) {
aneg = 0;
switch (lc->requested_speed) {
-   case 100:
+   case 10:
speed = FW_PORT_CAP_SPEED_100G;
break;
-   case 40:
+   case 4:
speed = FW_PORT_CAP_SPEED_40G;
break;
-   case 25:
+   case 25000:
speed = FW_PORT_CAP_SPEED_25G;
break;
-   case 10:
+   case 1:
speed = FW_PORT_CAP_SPEED_10G;
break;
-   case 1:
+   case 1000:
speed = FW_PORT_CAP_SPEED_1G;
break;
+   case 100:
+   speed = FW_PORT_CAP_SPEED_100M;
+   break;
default:
return -EINVAL;
break;
@@ -7715,9 +7718,9 @@ static void handle_port_info(struct port_info *pi, con
 
fec = 0;
if (lc->advertising & FW_PORT_CAP_FEC_RS)
-   fec |= FEC_RS;
-   if (lc->advertising & FW_PORT_CAP_FEC_BASER_RS)
-   fec |= FEC_BASER_RS;
+   fec = FEC_RS;
+   else if (lc->advertising & FW_PORT_CAP_FEC_BASER_RS)
+   fec = FEC_BASER_RS;
lc->fec = fec;
 }
 
@@ -7778,14 +7781,16 @@ int t4_handle_fw_rpl(struct adapter *adap, const __be6
}
 
lc = &pi->link_cfg;
+   PORT_LOCK(pi);
old_lc = &pi->old_link_cfg;
old_ptype = pi->port_type;
old_mtype = pi->mod_type;
-
handle_port_info(pi, &p->u.info);
+   PORT_UNLOCK(pi);
if (old_ptype != pi->port_type || old_mtype != pi->mod_type) {
t4_os_portmod_changed(pi);
}
+   PORT_LOCK(pi);
if (old_lc->link_ok != lc->link_ok ||
ol

svn commit: r334407 - head/sys/dev/pci

2018-05-30 Thread Justin Hibbits
Author: jhibbits
Date: Wed May 30 22:39:41 2018
New Revision: 334407
URL: https://svnweb.freebsd.org/changeset/base/334407

Log:
  Only conform to PCIe spec of 1 device per bus on !x86
  
  bhyve's root PCI complex shows up as PCIe, but behaves as traditional PCI.
  Until that is special cased in a root complex driver, leave x86 as it was.
  
  Requested by: grehan

Modified:
  head/sys/dev/pci/pci_pci.c

Modified: head/sys/dev/pci/pci_pci.c
==
--- head/sys/dev/pci/pci_pci.c  Wed May 30 22:36:09 2018(r334406)
+++ head/sys/dev/pci/pci_pci.c  Wed May 30 22:39:41 2018(r334407)
@@ -2545,6 +2545,7 @@ pcib_enable_ari(struct pcib_softc *sc, uint32_t pcie_p
 int
 pcib_maxslots(device_t dev)
 {
+#if !defined(__amd64__) && !defined(__i386__)
uint32_t pcie_pos;
uint16_t val;
 
@@ -2559,6 +2560,7 @@ pcib_maxslots(device_t dev)
val == PCIEM_TYPE_DOWNSTREAM_PORT)
return (0);
}
+#endif
return (PCI_SLOTMAX);
 }
 
___
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: r334407 - head/sys/dev/pci

2018-05-30 Thread Peter Grehan

Log:
   Only conform to PCIe spec of 1 device per bus on !x86
   
   bhyve's root PCI complex shows up as PCIe, but behaves as traditional PCI.

   Until that is special cased in a root complex driver, leave x86 as it was.


 Thanks Justin !

later,

Peter.
___
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: r334408 - head

2018-05-30 Thread Matt Macy
Author: mmacy
Date: Thu May 31 01:01:35 2018
New Revision: 334408
URL: https://svnweb.freebsd.org/changeset/base/334408

Log:
  libpmc/jevents: fix cross-compile _to_ amd64
  
  Reported by:  emaste

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Wed May 30 22:39:41 2018(r334407)
+++ head/Makefile.inc1  Thu May 31 01:01:35 2018(r334408)
@@ -2030,7 +2030,7 @@ _tcsh=bin/csh
 _libmagic=lib/libmagic
 .endif
 
-.if ${MACHINE_CPUARCH} == "amd64"
+.if ${TARGET_ARCH} == "amd64"
 _jevents=lib/libpmc/pmu-events
 .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: r334409 - head/sys/dev/cxgbe

2018-05-30 Thread Navdeep Parhar
Author: np
Date: Thu May 31 02:10:50 2018
New Revision: 334409
URL: https://svnweb.freebsd.org/changeset/base/334409

Log:
  cxgbe(4): Implement ifm_change callback.
  
  Sponsored by: Chelsio Communications

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

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cThu May 31 01:01:35 2018
(r334408)
+++ head/sys/dev/cxgbe/t4_main.cThu May 31 02:10:50 2018
(r334409)
@@ -529,6 +529,7 @@ static int set_params__post_init(struct adapter *);
 static void t4_set_desc(struct adapter *);
 static void build_medialist(struct port_info *, struct ifmedia *);
 static void init_l1cfg(struct port_info *);
+static int apply_l1cfg(struct port_info *);
 static int cxgbe_init_synchronized(struct vi_info *);
 static int cxgbe_uninit_synchronized(struct vi_info *);
 static void quiesce_txq(struct adapter *, struct sge_txq *);
@@ -2077,14 +2078,42 @@ cxgbe_get_counter(struct ifnet *ifp, ift_counter c)
}
 }
 
+/*
+ * The kernel picks a media from the list we had provided so we do not have to
+ * validate the request.
+ */
 static int
 cxgbe_media_change(struct ifnet *ifp)
 {
struct vi_info *vi = ifp->if_softc;
+   struct port_info *pi = vi->pi;
+   struct ifmedia *ifm = &pi->media;
+   struct link_config *lc = &pi->link_cfg;
+   struct adapter *sc = pi->adapter;
+   int rc;
 
-   device_printf(vi->dev, "%s unimplemented.\n", __func__);
-
-   return (EOPNOTSUPP);
+   rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4mec");
+   if (rc != 0)
+   return (rc);
+   PORT_LOCK(pi);
+   if (IFM_SUBTYPE(ifm->ifm_media) == IFM_AUTO) {
+   MPASS(lc->supported & FW_PORT_CAP_ANEG);
+   lc->requested_aneg = AUTONEG_ENABLE;
+   } else {
+   lc->requested_aneg = AUTONEG_DISABLE;
+   lc->requested_speed =
+   ifmedia_baudrate(ifm->ifm_media) / 100;
+   lc->requested_fc = 0;
+   if (IFM_OPTIONS(ifm->ifm_media) & IFM_ETH_RXPAUSE)
+   lc->requested_fc |= PAUSE_RX;
+   if (IFM_OPTIONS(ifm->ifm_media) & IFM_ETH_TXPAUSE)
+   lc->requested_fc |= PAUSE_TX;
+   }
+   if (pi->up_vis > 0)
+   rc = apply_l1cfg(pi);
+   PORT_UNLOCK(pi);
+   end_synchronized_op(sc, 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: r334410 - head/sys/dev/cxgbe

2018-05-30 Thread Navdeep Parhar
Author: np
Date: Thu May 31 02:22:40 2018
New Revision: 334410
URL: https://svnweb.freebsd.org/changeset/base/334410

Log:
  cxgbe(4): Use ifm for ifmedia just like the rest of the kernel.
  
  No functional change.

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

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cThu May 31 02:10:50 2018
(r334409)
+++ head/sys/dev/cxgbe/t4_main.cThu May 31 02:22:40 2018
(r334410)
@@ -4167,17 +4167,17 @@ t4_set_desc(struct adapter *sc)
 }
 
 static inline void
-ifmedia_add4(struct ifmedia *media, int m)
+ifmedia_add4(struct ifmedia *ifm, int m)
 {
 
-   ifmedia_add(media, m, 0, NULL);
-   ifmedia_add(media, m | IFM_ETH_TXPAUSE, 0, NULL);
-   ifmedia_add(media, m | IFM_ETH_RXPAUSE, 0, NULL);
-   ifmedia_add(media, m | IFM_ETH_TXPAUSE | IFM_ETH_RXPAUSE, 0, NULL);
+   ifmedia_add(ifm, m, 0, NULL);
+   ifmedia_add(ifm, m | IFM_ETH_TXPAUSE, 0, NULL);
+   ifmedia_add(ifm, m | IFM_ETH_RXPAUSE, 0, NULL);
+   ifmedia_add(ifm, m | IFM_ETH_TXPAUSE | IFM_ETH_RXPAUSE, 0, NULL);
 }
 
 static void
-set_current_media(struct port_info *pi, struct ifmedia *media)
+set_current_media(struct port_info *pi, struct ifmedia *ifm)
 {
struct link_config *lc;
int mword;
@@ -4185,15 +4185,15 @@ set_current_media(struct port_info *pi, struct ifmedia
PORT_LOCK_ASSERT_OWNED(pi);
 
/* Leave current media alone if it's already set to IFM_NONE. */
-   if (media->ifm_cur != NULL &&
-   IFM_SUBTYPE(media->ifm_cur->ifm_media) == IFM_NONE)
+   if (ifm->ifm_cur != NULL &&
+   IFM_SUBTYPE(ifm->ifm_cur->ifm_media) == IFM_NONE)
return;
 
mword = IFM_ETHER;
lc = &pi->link_cfg;
if (lc->requested_aneg == AUTONEG_ENABLE &&
lc->supported & FW_PORT_CAP_ANEG) {
-   ifmedia_set(media, mword | IFM_AUTO);
+   ifmedia_set(ifm, mword | IFM_AUTO);
return;
}
if (lc->requested_fc & PAUSE_TX)
@@ -4201,11 +4201,11 @@ set_current_media(struct port_info *pi, struct ifmedia
if (lc->requested_fc & PAUSE_RX)
mword |= IFM_ETH_RXPAUSE;
mword |= port_mword(pi, speed_to_fwspeed(lc->requested_speed));
-   ifmedia_set(media, mword);
+   ifmedia_set(ifm, mword);
 }
 
 static void
-build_medialist(struct port_info *pi, struct ifmedia *media)
+build_medialist(struct port_info *pi, struct ifmedia *ifm)
 {
uint16_t ss, speed;
int unknown, mword, bit;
@@ -4226,15 +4226,15 @@ build_medialist(struct port_info *pi, struct ifmedia *
/*
 * Now (re)build the ifmedia list.
 */
-   ifmedia_removeall(media);
+   ifmedia_removeall(ifm);
lc = &pi->link_cfg;
ss = G_FW_PORT_CAP_SPEED(lc->supported); /* Supported Speeds */
if (__predict_false(ss == 0)) { /* not supposed to happen. */
MPASS(ss != 0);
 no_media:
-   MPASS(LIST_EMPTY(&media->ifm_list));
-   ifmedia_add(media, IFM_ETHER | IFM_NONE, 0, NULL);
-   ifmedia_set(media, IFM_ETHER | IFM_NONE);
+   MPASS(LIST_EMPTY(&ifm->ifm_list));
+   ifmedia_add(ifm, IFM_ETHER | IFM_NONE, 0, NULL);
+   ifmedia_set(ifm, IFM_ETHER | IFM_NONE);
return;
}
 
@@ -4249,15 +4249,15 @@ no_media:
} else if (mword == IFM_UNKNOWN)
unknown++;
else
-   ifmedia_add4(media, IFM_ETHER | mword);
+   ifmedia_add4(ifm, IFM_ETHER | mword);
}
}
if (unknown > 0) /* Add one unknown for all unknown media types. */
-   ifmedia_add4(media, IFM_ETHER | IFM_UNKNOWN);
+   ifmedia_add4(ifm, IFM_ETHER | IFM_UNKNOWN);
if (lc->supported & FW_PORT_CAP_ANEG)
-   ifmedia_add(media, IFM_ETHER | IFM_AUTO, 0, NULL);
+   ifmedia_add(ifm, IFM_ETHER | IFM_AUTO, 0, NULL);
 
-   set_current_media(pi, media);
+   set_current_media(pi, ifm);
 }
 
 /*
___
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: r334412 - head/stand/userboot/userboot

2018-05-30 Thread Warner Losh
Author: imp
Date: Thu May 31 02:54:11 2018
New Revision: 334412
URL: https://svnweb.freebsd.org/changeset/base/334412

Log:
  Pass a struct devdesc to the format commands. Use proper type rather
  than doing weird type-punning that happened to work because the size
  was right. We copied a zfs devdesc into a disk_devdesc and then after
  passing through a NULL pointer reinterpreted it as a
  zfs_devdesc. Instead, pass the base devdesc around and 'upcase' when
  we know the types are right.
  
  This has the happy side effect of fixing a gcc warning about bad
  type punning.
  
  Differential Revision: https://reviews.freebsd.org/D15629

Modified:
  head/stand/userboot/userboot/devicename.c
  head/stand/userboot/userboot/main.c

Modified: head/stand/userboot/userboot/devicename.c
==
--- head/stand/userboot/userboot/devicename.c   Thu May 31 02:25:46 2018
(r334411)
+++ head/stand/userboot/userboot/devicename.c   Thu May 31 02:54:11 2018
(r334412)
@@ -175,30 +175,30 @@ userboot_parsedev(struct disk_devdesc **dev, const cha
 char *
 userboot_fmtdev(void *vdev)
 {
-struct disk_devdesc*dev = (struct disk_devdesc *)vdev;
+struct devdesc *dev = (struct devdesc *)vdev;
 static charbuf[128];   /* XXX device length constant? 
*/
 
-switch(dev->dd.d_dev->dv_type) {
+switch(dev->d_dev->dv_type) {
 case DEVT_NONE:
strcpy(buf, "(no device)");
break;
 
 case DEVT_CD:
-   sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit);
+   sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
break;
 
 case DEVT_DISK:
return (disk_fmtdev(vdev));
 
 case DEVT_NET:
-   sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit);
+   sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
break;
 
 case DEVT_ZFS:
 #if defined(USERBOOT_ZFS_SUPPORT)
return (zfs_fmtdev(vdev));
 #else
-   sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit);
+   sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
 #endif
break;
 }

Modified: head/stand/userboot/userboot/main.c
==
--- head/stand/userboot/userboot/main.c Thu May 31 02:25:46 2018
(r334411)
+++ head/stand/userboot/userboot/main.c Thu May 31 02:54:11 2018
(r334412)
@@ -155,20 +155,19 @@ static void
 extract_currdev(void)
 {
struct disk_devdesc dev;
-
-   //bzero(&dev, sizeof(dev));
-
+   struct devdesc *dd;
 #if defined(USERBOOT_ZFS_SUPPORT)
+   struct zfs_devdesc zdev;
+
CTASSERT(sizeof(struct disk_devdesc) >= sizeof(struct zfs_devdesc));
if (userboot_zfs_found) {
-   struct zfs_devdesc zdev;

/* Leave the pool/root guid's unassigned */
bzero(&zdev, sizeof(zdev));
zdev.dd.d_dev = &zfs_dev;

-   dev = *(struct disk_devdesc *)&zdev;
-   init_zfs_bootenv(zfs_fmtdev(&dev));
+   init_zfs_bootenv(zfs_fmtdev(&zdev));
+   dd = &zdev.dd;
} else
 #endif
 
@@ -185,14 +184,16 @@ extract_currdev(void)
dev.d_slice = -1;
dev.d_partition = -1;
}
+   dd = &dev.dd;
} else {
dev.dd.d_dev = &host_dev;
dev.dd.d_unit = 0;
+   dd = &dev.dd;
}
 
-   env_setenv("currdev", EV_VOLATILE, userboot_fmtdev(&dev),
+   env_setenv("currdev", EV_VOLATILE, userboot_fmtdev(dd),
userboot_setcurrdev, env_nounset);
-   env_setenv("loaddev", EV_VOLATILE, userboot_fmtdev(&dev),
+   env_setenv("loaddev", EV_VOLATILE, userboot_fmtdev(dd),
env_noset, env_nounset);
 }
 
___
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: r334413 - head/lib/libdevinfo

2018-05-30 Thread Warner Losh
Author: imp
Date: Thu May 31 02:57:51 2018
New Revision: 334413
URL: https://svnweb.freebsd.org/changeset/base/334413

Log:
  Sanity check the return from the kernel.
  
  We should be getting back as many bytes as we asked for, and we
  don't handle shortages at all, so just reject anything that's
  not right.
  
  Differential Revision: https://reviews.freebsd.org/D15629

Modified:
  head/lib/libdevinfo/devinfo.c

Modified: head/lib/libdevinfo/devinfo.c
==
--- head/lib/libdevinfo/devinfo.c   Thu May 31 02:54:11 2018
(r334412)
+++ head/lib/libdevinfo/devinfo.c   Thu May 31 02:57:51 2018
(r334413)
@@ -220,6 +220,11 @@ devinfo_init_devices(int generation)
warn("sysctl hw.bus.devices.%d", dev_idx);
return(errno);
}
+   if (rlen != sizeof(udev)) {
+   warnx("sysctl returned wrong data %zd bytes instead of 
%zd",
+   rlen, sizeof(udev));
+   return (EINVAL);
+   }
if ((dd = malloc(sizeof(*dd))) == NULL)
return(ENOMEM);
dd->dd_dev.dd_handle = udev.dv_handle;
___
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: r334414 - in head/sys: kern sys

2018-05-30 Thread Warner Losh
Author: imp
Date: Thu May 31 02:57:58 2018
New Revision: 334414
URL: https://svnweb.freebsd.org/changeset/base/334414

Log:
  Make the data returned by devinfo harder to overflow.
  
  Rather than using fixed-length strings, pack them into a string table
  to return. Also expand the buffer from ~300 charaters to 3k. This should
  be enough, even for USB.
  
  This fixes a problem where USB pnp info is truncated on return to
  userland.
  
  Differential Revision: https://reviews.freebsd.org/D15629

Modified:
  head/sys/kern/subr_bus.c
  head/sys/sys/bus.h

Modified: head/sys/kern/subr_bus.c
==
--- head/sys/kern/subr_bus.cThu May 31 02:57:51 2018(r334413)
+++ head/sys/kern/subr_bus.cThu May 31 02:57:58 2018(r334414)
@@ -5264,8 +5264,9 @@ sysctl_devices(SYSCTL_HANDLER_ARGS)
u_int   namelen = arg2;
int index;
device_tdev;
-   struct u_device udev;   /* XXX this is a bit big */
+   struct u_device *udev;
int error;
+   char*walker, *ep;
 
if (namelen != 2)
return (EINVAL);
@@ -5286,24 +5287,45 @@ sysctl_devices(SYSCTL_HANDLER_ARGS)
return (ENOENT);
 
/*
-* Populate the return array.
+* Populate the return item, careful not to overflow the buffer.
 */
-   bzero(&udev, sizeof(udev));
-   udev.dv_handle = (uintptr_t)dev;
-   udev.dv_parent = (uintptr_t)dev->parent;
-   if (dev->nameunit != NULL)
-   strlcpy(udev.dv_name, dev->nameunit, sizeof(udev.dv_name));
-   if (dev->desc != NULL)
-   strlcpy(udev.dv_desc, dev->desc, sizeof(udev.dv_desc));
-   if (dev->driver != NULL && dev->driver->name != NULL)
-   strlcpy(udev.dv_drivername, dev->driver->name,
-   sizeof(udev.dv_drivername));
-   bus_child_pnpinfo_str(dev, udev.dv_pnpinfo, sizeof(udev.dv_pnpinfo));
-   bus_child_location_str(dev, udev.dv_location, sizeof(udev.dv_location));
-   udev.dv_devflags = dev->devflags;
-   udev.dv_flags = dev->flags;
-   udev.dv_state = dev->state;
-   error = SYSCTL_OUT(req, &udev, sizeof(udev));
+   udev = malloc(sizeof(*udev), M_BUS, M_WAITOK | M_ZERO);
+   if (udev == NULL)
+   return (ENOMEM);
+   udev->dv_handle = (uintptr_t)dev;
+   udev->dv_parent = (uintptr_t)dev->parent;
+   udev->dv_devflags = dev->devflags;
+   udev->dv_flags = dev->flags;
+   udev->dv_state = dev->state;
+   walker = udev->dv_fields;
+   ep = walker + sizeof(udev->dv_fields);
+#define CP(src)\
+   if ((src) == NULL)  \
+   *walker++ = '\0';   \
+   else {  \
+   strlcpy(walker, (src), ep - walker);\
+   walker += strlen(walker) + 1;   \
+   }   \
+   if (walker >= ep)   \
+   break;
+
+   do {
+   CP(dev->nameunit);
+   CP(dev->desc);
+   CP(dev->driver != NULL ? dev->driver->name : NULL);
+   bus_child_pnpinfo_str(dev, walker, ep - walker);
+   walker += strlen(walker) + 1;
+   if (walker >= ep)
+   break;
+   bus_child_location_str(dev, walker, ep - walker);
+   walker += strlen(walker) + 1;
+   if (walker >= ep)
+   break;
+   *walker++ = '\0';
+   } while (0);
+#undef CP
+   error = SYSCTL_OUT(req, udev, sizeof(*udev));
+   free(udev, M_BUS);
return (error);
 }
 

Modified: head/sys/sys/bus.h
==
--- head/sys/sys/bus.h  Thu May 31 02:57:51 2018(r334413)
+++ head/sys/sys/bus.h  Thu May 31 02:57:58 2018(r334414)
@@ -46,7 +46,7 @@
  */
 struct u_businfo {
int ub_version; /**< @brief interface version */
-#define BUS_USER_VERSION   1
+#define BUS_USER_VERSION   2
int ub_generation;  /**< @brief generation count */
 };
 
@@ -63,20 +63,23 @@ typedef enum device_state {
 
 /**
  * @brief Device information exported to userspace.
+ * The strings are placed one after the other, separated by NUL characters.
+ * Fields should be added after the last one and order maintained for 
compatibility
  */
+#define BUS_USER_BUFFER(3*1024)
 struct u_device {
uintptr_t   dv_handle;
uintptr_t   dv_parent;
-
-   chardv_name[32];/**< @brief Name of device in 
tree. */
-   chardv_desc[32];/**< @brief Driver descripti

svn commit: r334416 - head

2018-05-30 Thread Warner Losh
Author: imp
Date: Thu May 31 02:58:08 2018
New Revision: 334416
URL: https://svnweb.freebsd.org/changeset/base/334416

Log:
  Note the need for a new kernel / userland for devinfo to work
  
  Differential Revision: https://reviews.freebsd.org/D15628

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Thu May 31 02:58:03 2018(r334415)
+++ head/UPDATING   Thu May 31 02:58:08 2018(r334416)
@@ -32,6 +32,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
 
+20180530:
+   The kernel / userland interface for devinfo changed, so you'll
+   need a new kernel and userland as a pair for it to work (rebuilding
+   lib/libdevinfo is all that's required). devinfo and devmatch will
+   not work, but everything else will when there's a mismatch.
+
 20180523:
The on-disk format for hwpmc callchain records has changed to include
threadid corresponding to a given record. This changes the field offsets
___
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: r334415 - head/lib/libdevinfo

2018-05-30 Thread Warner Losh
Author: imp
Date: Thu May 31 02:58:03 2018
New Revision: 334415
URL: https://svnweb.freebsd.org/changeset/base/334415

Log:
  Update to device enumeration protocol 2
  
  The new protocol from the kernel encodes things as a string table,
  extract it into fields. strdup the strings, and free them when we're
  done.
  
  Differential Revision: https://reviews.freebsd.org/D15629

Modified:
  head/lib/libdevinfo/devinfo.c
  head/lib/libdevinfo/devinfo_var.h

Modified: head/lib/libdevinfo/devinfo.c
==
--- head/lib/libdevinfo/devinfo.c   Thu May 31 02:57:58 2018
(r334414)
+++ head/lib/libdevinfo/devinfo.c   Thu May 31 02:58:03 2018
(r334415)
@@ -175,7 +175,7 @@ devinfo_init_devices(int generation)
int name2oid[2];
int oid[CTL_MAXNAME + 12];
size_t  oidlen, rlen;
-   char*name;
+   char*name, *walker, *ep;
int error;
 
/* 
@@ -229,22 +229,31 @@ devinfo_init_devices(int generation)
return(ENOMEM);
dd->dd_dev.dd_handle = udev.dv_handle;
dd->dd_dev.dd_parent = udev.dv_parent;
-   snprintf(dd->dd_name, sizeof(dd->dd_name), "%s", udev.dv_name);
-   dd->dd_dev.dd_name = &dd->dd_name[0];
-   snprintf(dd->dd_desc, sizeof(dd->dd_desc), "%s", udev.dv_desc);
-   dd->dd_dev.dd_desc = &dd->dd_desc[0];
-   snprintf(dd->dd_drivername, sizeof(dd->dd_drivername), "%s",
-   udev.dv_drivername);
-   dd->dd_dev.dd_drivername = &dd->dd_drivername[0];
-   snprintf(dd->dd_pnpinfo, sizeof(dd->dd_pnpinfo), "%s",
-   udev.dv_pnpinfo);
-   dd->dd_dev.dd_pnpinfo = &dd->dd_pnpinfo[0];
-   snprintf(dd->dd_location, sizeof(dd->dd_location), "%s",
-   udev.dv_location);
-   dd->dd_dev.dd_location = &dd->dd_location[0];
dd->dd_dev.dd_devflags = udev.dv_devflags;
dd->dd_dev.dd_flags = udev.dv_flags;
dd->dd_dev.dd_state = udev.dv_state;
+
+   walker = udev.dv_fields;
+   ep = walker + sizeof(udev.dv_fields);
+   dd->dd_name = NULL;
+   dd->dd_desc = NULL;
+   dd->dd_drivername = NULL;
+   dd->dd_pnpinfo = NULL;
+   dd->dd_location = NULL;
+#define UNPACK(x)  \
+   dd->dd_dev.x = dd->x = strdup(walker);  \
+   if (dd->x == NULL)  \
+   return(ENOMEM); \
+   if (walker + strnlen(walker, ep - walker) >= ep)\
+   return(EINVAL); \
+   walker += strlen(walker) + 1;
+
+   UNPACK(dd_name);
+   UNPACK(dd_desc);
+   UNPACK(dd_drivername);
+   UNPACK(dd_pnpinfo);
+   UNPACK(dd_location);
+#undef UNPACK
TAILQ_INSERT_TAIL(&devinfo_dev, dd, dd_link);
}
debug("fetched %d devices", dev_idx);
@@ -367,6 +376,11 @@ devinfo_free(void)
 
while ((dd = TAILQ_FIRST(&devinfo_dev)) != NULL) {
TAILQ_REMOVE(&devinfo_dev, dd, dd_link);
+   free(dd->dd_name);
+   free(dd->dd_desc);
+   free(dd->dd_drivername);
+   free(dd->dd_pnpinfo);
+   free(dd->dd_location);
free(dd);
}
while ((dm = TAILQ_FIRST(&devinfo_rman)) != NULL) {

Modified: head/lib/libdevinfo/devinfo_var.h
==
--- head/lib/libdevinfo/devinfo_var.h   Thu May 31 02:57:58 2018
(r334414)
+++ head/lib/libdevinfo/devinfo_var.h   Thu May 31 02:58:03 2018
(r334415)
@@ -45,11 +45,11 @@
  */
 struct devinfo_i_dev {
struct devinfo_dev  dd_dev;
-   chardd_name[DEVINFO_STRLEN];
-   chardd_desc[DEVINFO_STRLEN];
-   chardd_drivername[DEVINFO_STRLEN];
-   chardd_pnpinfo[DEVINFO_STRLEN * 4];
-   chardd_location[DEVINFO_STRLEN * 4];
+   char*dd_name;
+   char*dd_desc;
+   char*dd_drivername;
+   char*dd_pnpinfo;
+   char*dd_location;
uint32_tdd_devflags;
uint16_tdd_flags;
device_state_t  dd_state;
___
svn-s

Re: svn commit: r334412 - head/stand/userboot/userboot

2018-05-30 Thread Warner Losh
On Wed, May 30, 2018 at 8:54 PM, Warner Losh  wrote:

> Author: imp
> Date: Thu May 31 02:54:11 2018
> New Revision: 334412
> URL: https://svnweb.freebsd.org/changeset/base/334412
>
> Log:
>   Pass a struct devdesc to the format commands. Use proper type rather
>   than doing weird type-punning that happened to work because the size
>   was right. We copied a zfs devdesc into a disk_devdesc and then after
>   passing through a NULL pointer reinterpreted it as a
>   zfs_devdesc. Instead, pass the base devdesc around and 'upcase' when
>   we know the types are right.
>
>   This has the happy side effect of fixing a gcc warning about bad
>   type punning.
>
>   Differential Revision: https://reviews.freebsd.org/D15629


This should have been https://reviews.freebsd.org/D15628. Closed manually.

Warner


>
> Modified:
>   head/stand/userboot/userboot/devicename.c
>   head/stand/userboot/userboot/main.c
>
> Modified: head/stand/userboot/userboot/devicename.c
> 
> ==
> --- head/stand/userboot/userboot/devicename.c   Thu May 31 02:25:46 2018
>   (r334411)
> +++ head/stand/userboot/userboot/devicename.c   Thu May 31 02:54:11 2018
>   (r334412)
> @@ -175,30 +175,30 @@ userboot_parsedev(struct disk_devdesc **dev, const
> cha
>  char *
>  userboot_fmtdev(void *vdev)
>  {
> -struct disk_devdesc*dev = (struct disk_devdesc *)vdev;
> +struct devdesc *dev = (struct devdesc *)vdev;
>  static charbuf[128];   /* XXX device length
> constant? */
>
> -switch(dev->dd.d_dev->dv_type) {
> +switch(dev->d_dev->dv_type) {
>  case DEVT_NONE:
> strcpy(buf, "(no device)");
> break;
>
>  case DEVT_CD:
> -   sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit);
> +   sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
> break;
>
>  case DEVT_DISK:
> return (disk_fmtdev(vdev));
>
>  case DEVT_NET:
> -   sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit);
> +   sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
> break;
>
>  case DEVT_ZFS:
>  #if defined(USERBOOT_ZFS_SUPPORT)
> return (zfs_fmtdev(vdev));
>  #else
> -   sprintf(buf, "%s%d:", dev->dd.d_dev->dv_name, dev->dd.d_unit);
> +   sprintf(buf, "%s%d:", dev->d_dev->dv_name, dev->d_unit);
>  #endif
> break;
>  }
>
> Modified: head/stand/userboot/userboot/main.c
> 
> ==
> --- head/stand/userboot/userboot/main.c Thu May 31 02:25:46 2018
> (r334411)
> +++ head/stand/userboot/userboot/main.c Thu May 31 02:54:11 2018
> (r334412)
> @@ -155,20 +155,19 @@ static void
>  extract_currdev(void)
>  {
> struct disk_devdesc dev;
> -
> -   //bzero(&dev, sizeof(dev));
> -
> +   struct devdesc *dd;
>  #if defined(USERBOOT_ZFS_SUPPORT)
> +   struct zfs_devdesc zdev;
> +
> CTASSERT(sizeof(struct disk_devdesc) >= sizeof(struct
> zfs_devdesc));
> if (userboot_zfs_found) {
> -   struct zfs_devdesc zdev;
>
> /* Leave the pool/root guid's unassigned */
> bzero(&zdev, sizeof(zdev));
> zdev.dd.d_dev = &zfs_dev;
>
> -   dev = *(struct disk_devdesc *)&zdev;
> -   init_zfs_bootenv(zfs_fmtdev(&dev));
> +   init_zfs_bootenv(zfs_fmtdev(&zdev));
> +   dd = &zdev.dd;
> } else
>  #endif
>
> @@ -185,14 +184,16 @@ extract_currdev(void)
> dev.d_slice = -1;
> dev.d_partition = -1;
> }
> +   dd = &dev.dd;
> } else {
> dev.dd.d_dev = &host_dev;
> dev.dd.d_unit = 0;
> +   dd = &dev.dd;
> }
>
> -   env_setenv("currdev", EV_VOLATILE, userboot_fmtdev(&dev),
> +   env_setenv("currdev", EV_VOLATILE, userboot_fmtdev(dd),
> userboot_setcurrdev, env_nounset);
> -   env_setenv("loaddev", EV_VOLATILE, userboot_fmtdev(&dev),
> +   env_setenv("loaddev", EV_VOLATILE, userboot_fmtdev(dd),
> env_noset, env_nounset);
>  }
>
>
>
___
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: r334417 - head/sys/powerpc/powernv

2018-05-30 Thread Justin Hibbits
Author: jhibbits
Date: Thu May 31 04:11:40 2018
New Revision: 334417
URL: https://svnweb.freebsd.org/changeset/base/334417

Log:
  Remove a debug printf from opal_pci driver

Modified:
  head/sys/powerpc/powernv/opal_pci.c

Modified: head/sys/powerpc/powernv/opal_pci.c
==
--- head/sys/powerpc/powernv/opal_pci.c Thu May 31 02:58:08 2018
(r334416)
+++ head/sys/powerpc/powernv/opal_pci.c Thu May 31 04:11:40 2018
(r334417)
@@ -364,7 +364,6 @@ opalpci_attach(device_t dev)
maxmem = roundup2(powerpc_ptob(Maxmem), tce_size);
entries = round_pow2(maxmem / tce_size);
tce_tbl_size = max(entries * sizeof(uint64_t), 4096);
-   device_printf(dev, "Entries: %ld, tce_size: %#lx\n", entries, tce_size);
if (entries > OPAL_PCI_TCE_MAX_ENTRIES)
panic("POWERNV supports only %jdGB of memory space\n",
(uintmax_t)((OPAL_PCI_TCE_MAX_ENTRIES * tce_size) >> 30));
___
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"