Re: svn commit: r273295 - in head/sbin: ping ping6

2014-10-20 Thread Hiroki Sato
Hi Bruce,

 Thank you for your review.  I fixed lines you pointed out and
 attached a patch candidate.  I will show each change line by line in
 this email, too:

Bruce Evans b...@optusnet.com.au wrote
  in 20141020140848.d...@besplex.bde.org:

br  - if (cc - ICMP_MINLEN - phdr_len = sizeof(tv1)) {
br  + if ((size_t)(cc - ICMP_MINLEN - phdr_len) =
br  + sizeof(tv1)) {
br/* Copy to avoid alignment problems: */
brmemcpy(tv32, tp, sizeof(tv32));
brtv1.tv_sec = ntohl(tv32.tv32_sec);
br
br This breaks the warning, and breaks the code on exotic (unsupported)
br where it used to work accidentally.  The code was already broken on
br non-exotic arches.

-   if ((size_t)(cc - ICMP_MINLEN - phdr_len) =
-   sizeof(tv1)) {
+   if (cc - ICMP_MINLEN - phdr_len = (int)sizeof(tv1)) {

br  -struct sockaddr_in6 dst; /* who to ping6 */
br  -struct sockaddr_in6 src; /* src addr of this packet */
br  -socklen_t srclen;
br
br Old code like ping uses plain int for almost everything except where
br the broken ABI requires an unsigned type like socklen_t.

-static socklen_t srclen;
-static size_t datalen = DEFDATALEN;
+static int srclen;
+static int datalen = DEFDATALEN;

br  +static u_int8_t nonce[8];/* nonce field for node information */
br
br This uses the deprecated nonstandard spelling of uint8_t.

 s/u_int_{8,16,32}_t/uint_{8,16,32}_t/ in various places.

br  -void  pr_suptypes(struct icmp6_nodeinfo *, size_t);

 s/size_t/int/

br  - sockbufsize = lsockbufsize;
br  + sockbufsize = (int)lsockbufsize;
brif (errno || !*optarg || *e ||
br  - sockbufsize != lsockbufsize)
br  + lsockbufsize  INT_MAX)
brerrx(1, invalid socket buffer size);

br I don't like warnings about hackish but correct code like the previous
br version of the above.  Does the compiler actually complain about
br comparing
br ints with unsigned longs for equality?

 Yes, this part caused the following warning:

 /usr/src/head/sbin/ping6/ping6.c:395:20: error: comparison of integers of
  different signs: 'int' and 'u_long' (aka 'unsigned long')
  [-Werror,-Wsign-compare]
sockbufsize != lsockbufsize)

br If you are going to change the range check, then rearrange the code.
br It
br was arranged to set sockbufsize before the value is known to fit so
br that
br non-fitting values can be checked.  With range checking on the
br
br original
br value, it is more natural to not do the assignment until after the
br check has passed.  Then the cast should be unnecessary since a smart
br compiler would see from the range check that the assignment can't
br overflow.

-   lsockbufsize = strtoul(optarg, e, 10);
-   sockbufsize = (int)lsockbufsize;
-   if (errno || !*optarg || *e ||
-   lsockbufsize  INT_MAX)
+   ultmp = strtoul(optarg, e, 10);
+   if (errno || !*optarg || *e || ultmp  INT_MAX)
errx(1, invalid socket buffer size);
+   sockbufsize = ultmp;

br  - if (l = sizeof(cresult) || l  0)
br  + if ((size_t)l = sizeof(cresult) || l  0)
br
br The conversion is backwards.
br

-   if ((size_t)l = sizeof(cresult) || l  0)
+   if (l = (int)sizeof(cresult) || l  0)

br  - if (end - (u_char *)ip6  sizeof(*ip6)) {
br  + if ((size_t)(end - (u_char *)ip6)  sizeof(*ip6)) {
brprintf(IP6);
brgoto trunc;
br}
br
br Backwards.  The RHS should be cast to ptrdiff_t.  Pointer difference
br are only required to work up to 64K, but that is enough for the size
br of small objects.

-   if ((size_t)(end - (u_char *)ip6)  sizeof(*ip6)) {
+   if (end - (u_char *)ip6  (ptrdiff_t)sizeof(*ip6)) {


br  - kk = MAXDATALEN - (8 + sizeof(struct tv32) + ii);
br  + (size_t)kk = MAXDATALEN - 8 + sizeof(struct tv32) + ii;

-   (size_t)kk = MAXDATALEN - 8 + sizeof(struct tv32) + ii;
+   kk = MAXDATALEN - 8 + (int)sizeof(struct tv32) + ii;

-- Hiroki
Index: ping6.c
===
--- ping6.c	(revision 273295)
+++ ping6.c	(working copy)
@@ -122,6 +122,7 @@
 #include fcntl.h
 #include math.h
 #include signal.h
+#include stddef.h
 #include stdio.h
 #include stdlib.h
 #include string.h
@@ -136,8 +137,8 @@
 #include md5.h

 struct tv32 {
-	u_int32_t tv32_sec;
-	u_int32_t tv32_usec;
+	uint32_t tv32_sec;
+	uint32_t tv32_usec;
 };

 #define MAXPACKETLEN	131072
@@ -210,8 +211,8 @@

 static struct sockaddr_in6 dst;	/* who to ping6 */
 static struct sockaddr_in6 src;	/* src addr 

svn commit: r273327 - head/sys/netpfil/ipfw

2014-10-20 Thread Alexander V. Chernikov
Author: melifaro
Date: Mon Oct 20 11:21:07 2014
New Revision: 273327
URL: https://svnweb.freebsd.org/changeset/base/273327

Log:
  Use copyout() directly instead of updating various fields
  before/after each sooptcopyout() call.
  
  Found by: luigi
  Sponsored by: Yandex LLC

Modified:
  head/sys/netpfil/ipfw/ip_fw_sockopt.c

Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c
==
--- head/sys/netpfil/ipfw/ip_fw_sockopt.c   Mon Oct 20 08:59:30 2014
(r273326)
+++ head/sys/netpfil/ipfw/ip_fw_sockopt.c   Mon Oct 20 11:21:07 2014
(r273327)
@@ -2535,30 +2535,33 @@ ipfw_del_sopt_handler(struct ipfw_sopt_h
 static int
 ipfw_flush_sopt_data(struct sockopt_data *sd)
 {
-#defineRULE_MAXSIZE(512*sizeof(u_int32_t))
+   struct sockopt *sopt;
int error;
size_t sz;
 
-   if ((sz = sd-koff) == 0)
+   sz = sd-koff;
+   if (sz == 0)
return (0);
 
-   if (sd-sopt-sopt_dir == SOPT_GET) {
-   error = sooptcopyout(sd-sopt, sd-kbuf, sz);
+   sopt = sd-sopt;
+
+   if (sopt-sopt_dir == SOPT_GET) {
+   error = copyout(sd-kbuf, sopt-sopt_val, sz);
if (error != 0)
return (error);
}
 
memset(sd-kbuf, 0, sd-ksize);
-   sd-ktotal += sd-koff;
+   sd-ktotal += sz;
sd-koff = 0;
if (sd-ktotal + sd-ksize  sd-valsize)
sd-kavail = sd-ksize;
else
sd-kavail = sd-valsize - sd-ktotal;
 
-   /* Update sopt buffer */
-   sd-sopt-sopt_valsize = sd-ktotal;
-   sd-sopt-sopt_val = sd-sopt_val + sd-ktotal;
+   /* Update sopt buffer data */
+   sopt-sopt_valsize = sd-ktotal;
+   sopt-sopt_val = sd-sopt_val + sd-ktotal;
 
return (0);
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r273295 - in head/sbin: ping ping6

2014-10-20 Thread Bruce Evans

On Mon, 20 Oct 2014, Hiroki Sato wrote:


Thank you for your review.  I fixed lines you pointed out and
attached a patch candidate.  I will show each change line by line in
this email, too:


Thanks.


Bruce Evans b...@optusnet.com.au wrote
 in 20141020140848.d...@besplex.bde.org:

br  -   if (cc - ICMP_MINLEN - phdr_len = sizeof(tv1)) {
br  +   if ((size_t)(cc - ICMP_MINLEN - phdr_len) =
br  +   sizeof(tv1)) {
br  /* Copy to avoid alignment problems: */
br  memcpy(tv32, tp, sizeof(tv32));
br  tv1.tv_sec = ntohl(tv32.tv32_sec);
br
br This breaks the warning, and breaks the code on exotic (unsupported)
br where it used to work accidentally.  The code was already broken on
br non-exotic arches.

-   if ((size_t)(cc - ICMP_MINLEN - phdr_len) =
-   sizeof(tv1)) {
+   if (cc - ICMP_MINLEN - phdr_len = (int)sizeof(tv1)) {


I tested this.  I couldn't get it to fail, but noticed another type
error and re-noticed associated style bugs.  The packet format is a
network 32+32-bit timeval, and that is what is copied, but the bounds
check is for a host timeval.  On i386, network timeval == host timeval
so there is no problem.  On other 32-bit systems with 32+32-bit
timevals, ntohl() fixes up the byte order if necessary.  But on N-bit
systems with 64-bit timevals, ping -s 8 is broken.  It should send a
32+32-bit timeval but either doesn't send it or can't receive it.  Such
systems include:
- most 64-bit systems.  All supported ones.  Most have a 64-bit time_t,
  and if they didn't then all supported ones have 64-bit longs so a
  timeval would consist of a 32-bit time_t, 32 bits of padding, and a
  64-bit long.  ping -s 15 doesn't work on these systems, but ping -s 16
  does.
- 32-bit systems with 64-bit time_t.  All supported ones have only 32-bit
  32-bit longs and probably have no padding, so they have 96-bit time_t
  and ping -s 12 would work.

ping -s 8 worked on i386 in my simple tests because phdr_len is normally
0 (I don't know how to make it nonzero).  The full packet size is then
36.  This consists of hlen = 20, ICMP_MINLEN = 8, phdr_len = 0, and a
payload consisting of the network 8-byte timeval.

The style bugs here are that there is a macro TIMEVAL_LEN that is used in
some places to obfuscate the problem.  I don't know much about networking
but have hacked on ping a bit and have old code with comments about this:

% diff -u2 ping.c~ ping.c
*** ping.c~ Sat Apr 10 12:10:59 2004
--- ping.c  Sat Apr 10 12:11:00 2004
% @@ -93,4 +93,9 @@
% 
%  #define	INADDR_LEN	((int)sizeof(in_addr_t))

% +/*
% + * XXX this macro used to hide the details of the packet layout, but it now
% + * just obfuscates timevals and is not even consistently used for the size
% + * of a timeval.
% + */
%  #define  TIMEVAL_LEN ((int)sizeof(struct timeval))
%  #define  MASK_LEN(ICMP_MASKLEN - ICMP_MINLEN)

The obfuscation has increased in -current.  The above is broken since it
uses host timevals.  This has been fixed in -current by replacing 'timeval'
by 'tv32', but that increases the obfuscation because the macro still
looks like it is for a host timeval.

Note that the macro already has a cast to int in it (presumably to fix
warnings), so changing the patch to use it will fix both problems.  But
I don't like the obfuscation of that.  It is good practice to use
sizeof(var) instead of sizeof(typedef_name) like the code does now.
This gives a better chance of applying sizeof() to the right variable
although that is not done now.  It was done in the old version that was
broken by using host timevals.  That version was consistently broken --
it didn't have tv2, and it both the sizeof and the copy were done on tv1.

Further review showed that TIMEVAL_LEN is used a lot and is clearer
than '(int)sizeof(struct tv32)' all over.  Just rename it to something
like NTIMEVAL_LEN so that it is clear that it is for a network timeval.

Grepping for sizeof shows just one place where sizeof() is applied to
struct timeval.  This allocates space for a message.  I think this
should use struct tv32 too, but allocating more space than is needed
and sending a larger message than needed is fairly harmless.  Only
6 out of 32 lines have the style bug of following sizeof by a space.
All of these also have the style bug of not parenthesizing the arg.

ping6.c doesn't have TIMEVAL, and also doesn't seem to have the bug
-- ping6 -s 8 works on freefall.


br  +static u_int8_t nonce[8];  /* nonce field for node information */
br
br This uses the deprecated nonstandard spelling of uint8_t.

s/u_int_{8,16,32}_t/uint_{8,16,32}_t/ in various places.


I don't like changing old code like that.  Makes it hard to see
important changes.  You actually changed u_int8_t to u_char.


br  -   sockbufsize = lsockbufsize;
br  +   

svn commit: r273328 - in head/sys/dev/ata: . chipsets

2014-10-20 Thread Alexander Motin
Author: mav
Date: Mon Oct 20 13:18:52 2014
New Revision: 273328
URL: https://svnweb.freebsd.org/changeset/base/273328

Log:
  Add another PCI ID for JMB368 PATA controller.
  
  MFC after:1 week

Modified:
  head/sys/dev/ata/ata-pci.h
  head/sys/dev/ata/chipsets/ata-jmicron.c

Modified: head/sys/dev/ata/ata-pci.h
==
--- head/sys/dev/ata/ata-pci.h  Mon Oct 20 11:21:07 2014(r273327)
+++ head/sys/dev/ata/ata-pci.h  Mon Oct 20 13:18:52 2014(r273328)
@@ -306,6 +306,7 @@ struct ata_pci_controller {
 #define ATA_JMB365  0x2365197b
 #define ATA_JMB366  0x2366197b
 #define ATA_JMB368  0x2368197b
+#define ATA_JMB368_20x0368197b
 
 #define ATA_MARVELL_ID  0x11ab
 #define ATA_M88SX5040   0x504011ab

Modified: head/sys/dev/ata/chipsets/ata-jmicron.c
==
--- head/sys/dev/ata/chipsets/ata-jmicron.c Mon Oct 20 11:21:07 2014
(r273327)
+++ head/sys/dev/ata/chipsets/ata-jmicron.c Mon Oct 20 13:18:52 2014
(r273328)
@@ -71,6 +71,7 @@ ata_jmicron_probe(device_t dev)
  { ATA_JMB365, 0, 1, 2, ATA_UDMA6, JMB365 },
  { ATA_JMB366, 0, 2, 2, ATA_UDMA6, JMB366 },
  { ATA_JMB368, 0, 0, 1, ATA_UDMA6, JMB368 },
+ { ATA_JMB368_2, 0, 0, 1, ATA_UDMA6, JMB368 },
  { 0, 0, 0, 0, 0, 0}};
 char buffer[64];
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r273329 - head/sys/arm/broadcom/bcm2835

2014-10-20 Thread Luiz Otavio O Souza
Author: loos
Date: Mon Oct 20 13:36:52 2014
New Revision: 273329
URL: https://svnweb.freebsd.org/changeset/base/273329

Log:
  Add another wakeup() after actually set the bus as free.
  
  This fix a race where the threads waiting for the bus would wake up early
  and still see bus as busy.
  
  While here, give a better description to wmesg for the two use cases we
  have (bus and io waiting).
  
  MFC after:1 week

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Mon Oct 20 13:18:52 2014
(r273328)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Mon Oct 20 13:36:52 2014
(r273329)
@@ -395,7 +395,7 @@ bcm_bsc_transfer(device_t dev, struct ii
 
/* If the controller is busy wait until it is available. */
while (sc-sc_flags  BCM_I2C_BUSY)
-   mtx_sleep(dev, sc-sc_mtx, 0, bcm_bsc, 0);
+   mtx_sleep(dev, sc-sc_mtx, 0, bscbusw, 0);
 
/* Now we have control over the BSC controller. */
sc-sc_flags = BCM_I2C_BUSY;
@@ -439,7 +439,7 @@ bcm_bsc_transfer(device_t dev, struct ii
BCM_BSC_CTRL_ST | read | intr);
 
/* Wait for the transaction to complete. */
-   err = mtx_sleep(dev, sc-sc_mtx, 0, bcm_bsc, hz);
+   err = mtx_sleep(dev, sc-sc_mtx, 0, bsciow, hz);
 
/* Check if we have a timeout or an I2C error. */
if ((sc-sc_flags  BCM_I2C_ERROR) || err == EWOULDBLOCK) {
@@ -452,6 +452,9 @@ bcm_bsc_transfer(device_t dev, struct ii
/* Clean the controller flags. */
sc-sc_flags = 0;
 
+   /* Wake up the threads waiting for bus. */
+   wakeup(dev);
+
BCM_BSC_UNLOCK(sc);
 
return (err);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r273330 - head/sys/dev/vt

2014-10-20 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Mon Oct 20 14:25:23 2014
New Revision: 273330
URL: https://svnweb.freebsd.org/changeset/base/273330

Log:
  vt(4): Refuse to load a font if hw.vga.textmode is selected
  
  Before, the font was loaded and the window size recalculated, giving an
  unusable terminal, even if the actual font didn't change.
  
  Reported by:  beeess...@ruggedinbox.com
  MFC after:3 days

Modified:
  head/sys/dev/vt/vt_core.c

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Mon Oct 20 13:36:52 2014(r273329)
+++ head/sys/dev/vt/vt_core.c   Mon Oct 20 14:25:23 2014(r273330)
@@ -2207,6 +2207,9 @@ skip_thunk:
case PIO_VFONT: {
struct vt_font *vf;
 
+   if (vd-vd_flags  VDF_TEXTMODE)
+   return (ENOTSUP);
+
error = vtfont_load((void *)data, vf);
if (error != 0)
return (error);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r273331 - in head: sbin/ifconfig share/man/man4 sys/conf sys/modules sys/modules/if_vxlan sys/net sys/sys

2014-10-20 Thread Bryan Venteicher
Author: bryanv
Date: Mon Oct 20 14:42:42 2014
New Revision: 273331
URL: https://svnweb.freebsd.org/changeset/base/273331

Log:
  Add vxlan interface
  
  vxlan creates a virtual LAN by encapsulating the inner Ethernet frame in
  a UDP packet. This implementation is based on RFC7348.
  
  Currently, the IPv6 support is not fully compliant with the specification:
  we should be able to receive UPDv6 packets with a zero checksum, but we
  need to support RFC6935 first. Patches for this should come soon.
  
  Encapsulation protocols such as vxlan emphasize the need for the FreeBSD
  network stack to support batching, GRO, and GSO. Each frame has to make
  two trips through the network stack, and each frame will be at most MTU
  sized. Performance suffers accordingly.
  
  Some latest generation NICs have begun to support vxlan HW offloads that
  we should also take advantage of. VIMAGE support should also be added soon.
  
  Differential Revision:https://reviews.freebsd.org/D384
  Reviewed by:  gnn
  Relnotes: yes

Added:
  head/sbin/ifconfig/ifvxlan.c   (contents, props changed)
  head/share/man/man4/vxlan.4   (contents, props changed)
  head/sys/modules/if_vxlan/
  head/sys/modules/if_vxlan/Makefile   (contents, props changed)
  head/sys/net/if_vxlan.c   (contents, props changed)
  head/sys/net/if_vxlan.h   (contents, props changed)
Modified:
  head/sbin/ifconfig/Makefile
  head/sbin/ifconfig/ifconfig.8
  head/share/man/man4/Makefile
  head/sys/conf/NOTES
  head/sys/conf/files
  head/sys/modules/Makefile
  head/sys/sys/priv.h

Modified: head/sbin/ifconfig/Makefile
==
--- head/sbin/ifconfig/Makefile Mon Oct 20 14:25:23 2014(r273330)
+++ head/sbin/ifconfig/Makefile Mon Oct 20 14:42:42 2014(r273331)
@@ -30,6 +30,7 @@ SRCS+=ifmac.c # MAC support
 SRCS+= ifmedia.c   # SIOC[GS]IFMEDIA support
 SRCS+= iffib.c # non-default FIB support
 SRCS+= ifvlan.c# SIOC[GS]ETVLAN support
+SRCS+= ifvxlan.c   # VXLAN support
 SRCS+= ifgre.c # GRE keys etc
 SRCS+= ifgif.c # GIF reversed header workaround
 

Modified: head/sbin/ifconfig/ifconfig.8
==
--- head/sbin/ifconfig/ifconfig.8   Mon Oct 20 14:25:23 2014
(r273330)
+++ head/sbin/ifconfig/ifconfig.8   Mon Oct 20 14:42:42 2014
(r273331)
@@ -28,7 +28,7 @@
 .\ From: @(#)ifconfig.8   8.3 (Berkeley) 1/5/94
 .\ $FreeBSD$
 .\
-.Dd October 1, 2014
+.Dd October 20, 2014
 .Dt IFCONFIG 8
 .Os
 .Sh NAME
@@ -2541,6 +2541,76 @@ argument is useless and hence deprecated
 .El
 .Pp
 The following parameters are used to configure
+.Xr vxlan 4
+interfaces.
+.Bl -tag -width indent
+.It Cm vni Ar identifier
+This value is a 24-bit VXLAN Network Identifier (VNI) that identifies the
+virtual network segment membership of the interface.
+.It Cm local Ar address
+The source address used in the encapsulating IPv4/IPv6 header.
+The address should already be assigned to an existing interface.
+When the interface is configured in unicast mode, the listening socket
+is bound to this address.
+.It Cm remote Ar address
+The interface can be configured in a unicast, or point-to-point, mode
+to create a tunnel between two hosts.
+This is the IP address of the remote end of the tunnel.
+.It Cm group Ar address
+The interface can be configured in a multicast mode
+to create a virtual network of hosts.
+This is the IP multicast group address the interface will join.
+.It Cm localport Ar port
+The port number the interface will listen on.
+The default port number is 4789.
+.It Cm remoteport Ar port
+The destination port number used in the encapsulating IPv4/IPv6 header.
+The remote host should be listening on this port.
+The default port number is 4789.
+Note some other implementations, such as Linux,
+do not default to the IANA assigned port,
+but instead listen on port 8472.
+.It Cm portrange Ar low high
+The range of source ports used in the encapsulating IPv4/IPv6 header.
+The port selected within the range is based on a hash of the inner frame.
+A range is useful to provide entropy within the outer IP header
+for more effective load balancing.
+The default range is between the
+.Xr sysctl 8
+variables
+.Va net.inet.ip.portrange.first
+and
+.Va net.inet.ip.portrange.last
+.It Cm timeout Ar timeout
+The maximum time, in seconds, before an entry in the forwarding table
+is pruned.
+The default is 1200 seconds (20 minutes).
+.It Cm maxaddr Ar max
+The maximum number of entries in the forwarding table.
+The default is 2000.
+.It Cm vxlandev Ar dev
+When the interface is configured in multicast mode, the
+.Cm dev
+interface is used to transmit IP multicast packets.
+.It Cm ttl Ar ttl
+The TTL used in the encapsulating IPv4/IPv6 header.
+The default is 64.
+.It Cm learn
+The source IP address and inner 

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

2014-10-20 Thread Ed Maste
Author: emaste
Date: Mon Oct 20 14:48:20 2014
New Revision: 273332
URL: https://svnweb.freebsd.org/changeset/base/273332

Log:
  Add vtfontcvt(8) cross-reference to vt(4) man page
  
  Reported by:  beeess...@ruggedinbox.com
  MFC after:3 days

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

Modified: head/share/man/man4/vt.4
==
--- head/share/man/man4/vt.4Mon Oct 20 14:42:42 2014(r273331)
+++ head/share/man/man4/vt.4Mon Oct 20 14:48:20 2014(r273332)
@@ -24,7 +24,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd October 16, 2014
+.Dd October 20, 2014
 .Dt VIRTUAL TERMINALS 4
 .Os
 .Sh NAME
@@ -273,7 +273,8 @@ on a black background, or black on a bri
 .Xr getty 8 ,
 .Xr kbdmux 8 ,
 .Xr kldload 8 ,
-.Xr moused 8
+.Xr moused 8 ,
+.Xr vtfontcvt 8
 .Sh HISTORY
 The
 .Nm
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r273333 - head/share/misc

2014-10-20 Thread Sergey Kandaurov
Author: pluknet
Date: Mon Oct 20 15:41:11 2014
New Revision: 27
URL: https://svnweb.freebsd.org/changeset/base/27

Log:
  Mac OS X 10.10 added.

Modified:
  head/share/misc/bsd-family-tree

Modified: head/share/misc/bsd-family-tree
==
--- head/share/misc/bsd-family-tree Mon Oct 20 14:48:20 2014
(r273332)
+++ head/share/misc/bsd-family-tree Mon Oct 20 15:41:11 2014
(r27)
@@ -315,6 +315,8 @@ FreeBSD 5.2   |  |  
  |  FreeBSD   |  | |   |
  |9.3 |  | |   |
  ||  | |   DragonFly 3.8.2
+ | Mac OS X  | |   |
+ |   10.10   | |   |
  ||  | |   |
  ||  | |   |
  ||  | |   |
@@ -653,6 +655,7 @@ DragonFly 3.8.1 2014-06-16 [DFB]
 DragonFly 3.6.32014-06-17 [DFB]
 FreeBSD 9.32014-07-05 [FBD]
 DragonFly 3.8.22014-08-08 [DFB]
+Mac OS X 10.10 2014-10-16 [APL]
 
 Bibliography
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r273331 - in head: sbin/ifconfig share/man/man4 sys/conf sys/modules sys/modules/if_vxlan sys/net sys/sys

2014-10-20 Thread Adrian Chadd
Hi,

Can you please create a PR that says something like review vxlan code
for RSS after de-capsulation and assign it to me?

I'm going to have to insert a hash recalculation after decapsulation
but I'm too busy at the moment to do it.

Thanks,


-a


On 20 October 2014 07:42, Bryan Venteicher bry...@freebsd.org wrote:
 Author: bryanv
 Date: Mon Oct 20 14:42:42 2014
 New Revision: 273331
 URL: https://svnweb.freebsd.org/changeset/base/273331

 Log:
   Add vxlan interface

   vxlan creates a virtual LAN by encapsulating the inner Ethernet frame in
   a UDP packet. This implementation is based on RFC7348.

   Currently, the IPv6 support is not fully compliant with the specification:
   we should be able to receive UPDv6 packets with a zero checksum, but we
   need to support RFC6935 first. Patches for this should come soon.

   Encapsulation protocols such as vxlan emphasize the need for the FreeBSD
   network stack to support batching, GRO, and GSO. Each frame has to make
   two trips through the network stack, and each frame will be at most MTU
   sized. Performance suffers accordingly.

   Some latest generation NICs have begun to support vxlan HW offloads that
   we should also take advantage of. VIMAGE support should also be added soon.

   Differential Revision:https://reviews.freebsd.org/D384
   Reviewed by:  gnn
   Relnotes: yes

 Added:
   head/sbin/ifconfig/ifvxlan.c   (contents, props changed)
   head/share/man/man4/vxlan.4   (contents, props changed)
   head/sys/modules/if_vxlan/
   head/sys/modules/if_vxlan/Makefile   (contents, props changed)
   head/sys/net/if_vxlan.c   (contents, props changed)
   head/sys/net/if_vxlan.h   (contents, props changed)
 Modified:
   head/sbin/ifconfig/Makefile
   head/sbin/ifconfig/ifconfig.8
   head/share/man/man4/Makefile
   head/sys/conf/NOTES
   head/sys/conf/files
   head/sys/modules/Makefile
   head/sys/sys/priv.h

 Modified: head/sbin/ifconfig/Makefile
 ==
 --- head/sbin/ifconfig/Makefile Mon Oct 20 14:25:23 2014(r273330)
 +++ head/sbin/ifconfig/Makefile Mon Oct 20 14:42:42 2014(r273331)
 @@ -30,6 +30,7 @@ SRCS+=ifmac.c # MAC support
  SRCS+= ifmedia.c   # SIOC[GS]IFMEDIA support
  SRCS+= iffib.c # non-default FIB support
  SRCS+= ifvlan.c# SIOC[GS]ETVLAN support
 +SRCS+= ifvxlan.c   # VXLAN support
  SRCS+= ifgre.c # GRE keys etc
  SRCS+= ifgif.c # GIF reversed header workaround


 Modified: head/sbin/ifconfig/ifconfig.8
 ==
 --- head/sbin/ifconfig/ifconfig.8   Mon Oct 20 14:25:23 2014
 (r273330)
 +++ head/sbin/ifconfig/ifconfig.8   Mon Oct 20 14:42:42 2014
 (r273331)
 @@ -28,7 +28,7 @@
  .\ From: @(#)ifconfig.8   8.3 (Berkeley) 1/5/94
  .\ $FreeBSD$
  .\
 -.Dd October 1, 2014
 +.Dd October 20, 2014
  .Dt IFCONFIG 8
  .Os
  .Sh NAME
 @@ -2541,6 +2541,76 @@ argument is useless and hence deprecated
  .El
  .Pp
  The following parameters are used to configure
 +.Xr vxlan 4
 +interfaces.
 +.Bl -tag -width indent
 +.It Cm vni Ar identifier
 +This value is a 24-bit VXLAN Network Identifier (VNI) that identifies the
 +virtual network segment membership of the interface.
 +.It Cm local Ar address
 +The source address used in the encapsulating IPv4/IPv6 header.
 +The address should already be assigned to an existing interface.
 +When the interface is configured in unicast mode, the listening socket
 +is bound to this address.
 +.It Cm remote Ar address
 +The interface can be configured in a unicast, or point-to-point, mode
 +to create a tunnel between two hosts.
 +This is the IP address of the remote end of the tunnel.
 +.It Cm group Ar address
 +The interface can be configured in a multicast mode
 +to create a virtual network of hosts.
 +This is the IP multicast group address the interface will join.
 +.It Cm localport Ar port
 +The port number the interface will listen on.
 +The default port number is 4789.
 +.It Cm remoteport Ar port
 +The destination port number used in the encapsulating IPv4/IPv6 header.
 +The remote host should be listening on this port.
 +The default port number is 4789.
 +Note some other implementations, such as Linux,
 +do not default to the IANA assigned port,
 +but instead listen on port 8472.
 +.It Cm portrange Ar low high
 +The range of source ports used in the encapsulating IPv4/IPv6 header.
 +The port selected within the range is based on a hash of the inner frame.
 +A range is useful to provide entropy within the outer IP header
 +for more effective load balancing.
 +The default range is between the
 +.Xr sysctl 8
 +variables
 +.Va net.inet.ip.portrange.first
 +and
 +.Va net.inet.ip.portrange.last
 +.It Cm timeout Ar timeout
 +The maximum time, in seconds, before an entry in the forwarding table
 +is pruned.
 +The 

svn commit: r273334 - in head/sys: boot/common kern sys

2014-10-20 Thread Marcel Moolenaar
Author: marcel
Date: Mon Oct 20 17:04:03 2014
New Revision: 273334
URL: https://svnweb.freebsd.org/changeset/base/273334

Log:
  Fully support constructors for the purpose of code coverage analysis.
  This involves:
  1.  Have the loader pass the start and size of the .ctors section to the
  kernel in 2 new metadata elements.
  2.  Have the linker backends look for and record the start and size of
  the .ctors section in dynamically loaded modules.
  3.  Have the linker backends call the constructors as part of the final
  work of initializing preloaded or dynamically loaded modules.
  
  Note that LLVM appends the priority of the constructors to the name of
  the .ctors section. Not so when compiling with GCC. The code currently
  works for GCC and not for LLVM.
  
  Submitted by: Dmitry Mikulin dmit...@juniper.net
  Obtained from:Juniper Networks, Inc.

Modified:
  head/sys/boot/common/load_elf.c
  head/sys/kern/kern_linker.c
  head/sys/kern/link_elf.c
  head/sys/kern/link_elf_obj.c
  head/sys/kern/subr_prof.c
  head/sys/sys/linker.h

Modified: head/sys/boot/common/load_elf.c
==
--- head/sys/boot/common/load_elf.c Mon Oct 20 15:41:11 2014
(r27)
+++ head/sys/boot/common/load_elf.c Mon Oct 20 17:04:03 2014
(r273334)
@@ -240,6 +240,7 @@ __elfN(loadimage)(struct preloaded_file 
 Elf_Ehdr   *ehdr;
 Elf_Phdr   *phdr, *php;
 Elf_Shdr   *shdr;
+char   *shstr;
 intret;
 vm_offset_t firstaddr;
 vm_offset_t lastaddr;
@@ -248,6 +249,7 @@ __elfN(loadimage)(struct preloaded_file 
 Elf_Addr   ssym, esym;
 Elf_Dyn*dp;
 Elf_Addr   adp;
+Elf_Addr   ctors;
 intndp;
 intsymstrindex;
 intsymtabindex;
@@ -383,10 +385,11 @@ __elfN(loadimage)(struct preloaded_file 
 lastaddr = roundup(lastaddr, sizeof(long));
 
 /*
- * Now grab the symbol tables.  This isn't easy if we're reading a
- * .gz file.  I think the rule is going to have to be that you must
- * strip a file to remove symbols before gzipping it so that we do not
- * try to lseek() on it.
+ * Get the section headers.  We need this for finding the .ctors
+ * section as well as for loading any symbols.  Both may be hard
+ * to do if reading from a .gz file as it involves seeking.  I
+ * think the rule is going to have to be that you must strip a
+ * file to remove symbols before gzipping it.
  */
 chunk = ehdr-e_shnum * ehdr-e_shentsize;
 if (chunk == 0 || ehdr-e_shoff == 0)
@@ -399,6 +402,33 @@ __elfN(loadimage)(struct preloaded_file 
 }
 file_addmetadata(fp, MODINFOMD_SHDR, chunk, shdr);
 
+/*
+ * Read the section string table and look for the .ctors section.
+ * We need to tell the kernel where it is so that it can call the
+ * ctors.
+ */
+chunk = shdr[ehdr-e_shstrndx].sh_size;
+if (chunk) {
+   shstr = alloc_pread(ef-fd, shdr[ehdr-e_shstrndx].sh_offset, chunk);
+   if (shstr) {
+   for (i = 0; i  ehdr-e_shnum; i++) {
+   if (strcmp(shstr + shdr[i].sh_name, .ctors) != 0)
+   continue;
+   ctors = shdr[i].sh_addr;
+   file_addmetadata(fp, MODINFOMD_CTORS_ADDR, sizeof(ctors),
+   ctors);
+   size = shdr[i].sh_size;
+   file_addmetadata(fp, MODINFOMD_CTORS_SIZE, sizeof(size),
+   size);
+   break;
+   }
+   free(shstr);
+   }
+}
+
+/*
+ * Now load any symbols.
+ */
 symtabindex = -1;
 symstrindex = -1;
 for (i = 0; i  ehdr-e_shnum; i++) {

Modified: head/sys/kern/kern_linker.c
==
--- head/sys/kern/kern_linker.c Mon Oct 20 15:41:11 2014(r27)
+++ head/sys/kern/kern_linker.c Mon Oct 20 17:04:03 2014(r273334)
@@ -573,6 +573,8 @@ linker_make_file(const char *pathname, l
lf = (linker_file_t)kobj_create((kobj_class_t)lc, M_LINKER, M_WAITOK);
if (lf == NULL)
return (NULL);
+   lf-ctors_addr = 0;
+   lf-ctors_size = 0;
lf-refs = 1;
lf-userrefs = 0;
lf-flags = 0;

Modified: head/sys/kern/link_elf.c
==
--- head/sys/kern/link_elf.cMon Oct 20 15:41:11 2014(r27)
+++ head/sys/kern/link_elf.cMon Oct 20 17:04:03 2014(r273334)
@@ -331,6 +331,22 @@ link_elf_error(const char *filename, con
printf(kldload: %s: %s\n, filename, s);
 }
 
+static void
+link_elf_invoke_ctors(caddr_t addr, size_t size)
+{
+   void (**ctor)(void);
+   size_t i, cnt;
+
+   if (addr == NULL || size == 0)
+   return;
+   cnt = size / sizeof(*ctor);
+   ctor = (void *)addr;
+   for (i = 0; i 

svn commit: r273335 - head/sys/fs/unionfs

2014-10-20 Thread Mateusz Guzik
Author: mjg
Date: Mon Oct 20 17:53:49 2014
New Revision: 273335
URL: https://svnweb.freebsd.org/changeset/base/273335

Log:
  unionfs: hold mount interlock while manipulating mnt_flag
  
  This is for consistency with other filesystems.

Modified:
  head/sys/fs/unionfs/union_vfsops.c

Modified: head/sys/fs/unionfs/union_vfsops.c
==
--- head/sys/fs/unionfs/union_vfsops.c  Mon Oct 20 17:04:03 2014
(r273334)
+++ head/sys/fs/unionfs/union_vfsops.c  Mon Oct 20 17:53:49 2014
(r273335)
@@ -290,12 +290,14 @@ unionfs_domount(struct mount *mp)
return (error);
}
 
+   MNT_ILOCK(mp);
/*
 * Check mnt_flag
 */
if ((ump-um_lowervp-v_mount-mnt_flag  MNT_LOCAL) 
(ump-um_uppervp-v_mount-mnt_flag  MNT_LOCAL))
mp-mnt_flag |= MNT_LOCAL;
+   MNT_IUNLOCK(mp);
 
/*
 * Get new fsid
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r273336 - in head/sys: fs/nullfs fs/tmpfs fs/unionfs kern sys ufs/ffs

2014-10-20 Thread Mateusz Guzik
Author: mjg
Date: Mon Oct 20 18:00:50 2014
New Revision: 273336
URL: https://svnweb.freebsd.org/changeset/base/273336

Log:
  Provide vfs suspension support only for filesystems which need it, take
  two.
  
  nullfs and unionfs need to request suspension if underlying filesystem(s)
  use it. Utilize mnt_kern_flag for this purpose.
  
  This is a fixup for 273271.
  
  No strong objections from: kib
  Pointy hat to: mjg
  MFC after:2 weeks

Modified:
  head/sys/fs/nullfs/null_vfsops.c
  head/sys/fs/tmpfs/tmpfs_vfsops.c
  head/sys/fs/unionfs/union_vfsops.c
  head/sys/kern/vfs_vnops.c
  head/sys/sys/mount.h
  head/sys/ufs/ffs/ffs_vfsops.c

Modified: head/sys/fs/nullfs/null_vfsops.c
==
--- head/sys/fs/nullfs/null_vfsops.cMon Oct 20 17:53:49 2014
(r273335)
+++ head/sys/fs/nullfs/null_vfsops.cMon Oct 20 18:00:50 2014
(r273336)
@@ -198,6 +198,8 @@ nullfs_mount(struct mount *mp)
MNTK_EXTENDED_SHARED);
}
mp-mnt_kern_flag |= MNTK_LOOKUP_EXCL_DOTDOT;
+   mp-mnt_kern_flag |= lowerrootvp-v_mount-mnt_kern_flag 
+   MNTK_SUSPENDABLE;
MNT_IUNLOCK(mp);
mp-mnt_data = xmp;
vfs_getnewfsid(mp);

Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c
==
--- head/sys/fs/tmpfs/tmpfs_vfsops.cMon Oct 20 17:53:49 2014
(r273335)
+++ head/sys/fs/tmpfs/tmpfs_vfsops.cMon Oct 20 18:00:50 2014
(r273336)
@@ -255,6 +255,7 @@ tmpfs_mount(struct mount *mp)
 
MNT_ILOCK(mp);
mp-mnt_flag |= MNT_LOCAL;
+   mp-mnt_kern_flag |= MNTK_SUSPENDABLE;
MNT_IUNLOCK(mp);
 
mp-mnt_data = tmp;
@@ -427,14 +428,6 @@ tmpfs_sync(struct mount *mp, int waitfor
 }
 
 /*
- * A stub created so that vfs does vn_start_write for this filesystem
- */
-static void
-tmpfs_susp_clean(struct mount *mp)
-{
-}
-
-/*
  * tmpfs vfs operations.
  */
 
@@ -445,6 +438,5 @@ struct vfsops tmpfs_vfsops = {
.vfs_statfs =   tmpfs_statfs,
.vfs_fhtovp =   tmpfs_fhtovp,
.vfs_sync = tmpfs_sync,
-   .vfs_susp_clean =   tmpfs_susp_clean,
 };
 VFS_SET(tmpfs_vfsops, tmpfs, VFCF_JAIL);

Modified: head/sys/fs/unionfs/union_vfsops.c
==
--- head/sys/fs/unionfs/union_vfsops.c  Mon Oct 20 17:53:49 2014
(r273335)
+++ head/sys/fs/unionfs/union_vfsops.c  Mon Oct 20 18:00:50 2014
(r273336)
@@ -297,6 +297,13 @@ unionfs_domount(struct mount *mp)
if ((ump-um_lowervp-v_mount-mnt_flag  MNT_LOCAL) 
(ump-um_uppervp-v_mount-mnt_flag  MNT_LOCAL))
mp-mnt_flag |= MNT_LOCAL;
+
+   /*
+* Check mnt_kern_flag
+*/
+   if ((ump-um_lowervp-v_mount-mnt_flag  MNTK_SUSPENDABLE) ||
+   (ump-um_uppervp-v_mount-mnt_flag  MNTK_SUSPENDABLE))
+   mp-mnt_kern_flag |= MNTK_SUSPENDABLE;
MNT_IUNLOCK(mp);
 
/*

Modified: head/sys/kern/vfs_vnops.c
==
--- head/sys/kern/vfs_vnops.c   Mon Oct 20 17:53:49 2014(r273335)
+++ head/sys/kern/vfs_vnops.c   Mon Oct 20 18:00:50 2014(r273336)
@@ -1576,7 +1576,7 @@ static bool
 vn_suspendable_mp(struct mount *mp)
 {
 
-   return (mp-mnt_op-vfs_susp_clean != NULL);
+   return ((mp-mnt_kern_flag  MNTK_SUSPENDABLE) != 0);
 }
 
 static bool

Modified: head/sys/sys/mount.h
==
--- head/sys/sys/mount.hMon Oct 20 17:53:49 2014(r273335)
+++ head/sys/sys/mount.hMon Oct 20 18:00:50 2014(r273336)
@@ -361,7 +361,7 @@ void  __mnt_vnode_markerfree_act
 #defineMNTK_SUSPEND0x0800  /* request write suspension */
 #defineMNTK_SUSPEND2   0x0400  /* block secondary writes */
 #defineMNTK_SUSPENDED  0x1000  /* write operations are 
suspended */
-#defineMNTK_UNUSED25   0x2000  /*  --available-- */
+#defineMNTK_SUSPENDABLE0x2000 /* writes can be suspended */
 #define MNTK_LOOKUP_SHARED 0x4000 /* FS supports shared lock lookups */
 #defineMNTK_NOKNOTE0x8000  /* Don't send KNOTEs from VOP 
hooks */
 
@@ -754,10 +754,11 @@ vfs_statfs_t  __vfs_statfs;
_rc; })
 
 #defineVFS_SUSP_CLEAN(MP) do { 
\
-   MPASS(*(MP)-mnt_op-vfs_susp_clean != NULL);   \
-   VFS_PROLOGUE(MP);   \
-   (*(MP)-mnt_op-vfs_susp_clean)(MP);\
-   VFS_EPILOGUE(MP);   \
+   if (*(MP)-mnt_op-vfs_susp_clean != NULL) {\
+   

svn commit: r273337 - head/sys/arm/broadcom/bcm2835

2014-10-20 Thread Luiz Otavio O Souza
Author: loos
Date: Mon Oct 20 18:04:20 2014
New Revision: 273337
URL: https://svnweb.freebsd.org/changeset/base/273337

Log:
  Fix the mtx_sleep() error checking, catch all errors and not only
  EWOULDBLOCK.
  
  Do not print any message at errors.  The errors are properly sent to upper
  layers which should be able to deal with it, including printing the errors
  when they need to.
  
  The error message was quite annoying while scanning the i2c bus.
  
  MFC after:1 week

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Mon Oct 20 18:00:50 2014
(r273336)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Mon Oct 20 18:04:20 2014
(r273337)
@@ -441,12 +441,11 @@ bcm_bsc_transfer(device_t dev, struct ii
/* Wait for the transaction to complete. */
err = mtx_sleep(dev, sc-sc_mtx, 0, bsciow, hz);
 
-   /* Check if we have a timeout or an I2C error. */
-   if ((sc-sc_flags  BCM_I2C_ERROR) || err == EWOULDBLOCK) {
-   device_printf(sc-sc_dev, I2C error\n);
+   /* Check for errors. */
+   if (err != 0  (sc-sc_flags  BCM_I2C_ERROR))
err = EIO;
+   if (err != 0)
break;
-   }
}
 
/* Clean the controller flags. */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r273334 - in head/sys: boot/common kern sys

2014-10-20 Thread Roman Divacky
   Note that LLVM appends the priority of the constructors to the name of
   the .ctors section. Not so when compiling with GCC. The code currently
   works for GCC and not for LLVM.

Uhm? LLVM here creates .ctors section, nothing is appended. Can you be more
specific on what you're seing?

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


svn commit: r273338 - in head/sys: amd64/amd64 sys x86/include

2014-10-20 Thread Neel Natu
Author: neel
Date: Mon Oct 20 18:09:33 2014
New Revision: 273338
URL: https://svnweb.freebsd.org/changeset/base/273338

Log:
  Merge from projects/bhyve_svm all the changes outside vmm.ko or bhyve 
utilities:
  
  Add support for AMD's nested page tables in pmap.c:
  - Provide the correct bit mask for various bit fields in a PTE (e.g. valid 
bit)
for a pmap of type PT_RVI.
  - Add a function 'pmap_type_guest(pmap)' that returns TRUE if the pmap is of
type PT_EPT or PT_RVI.
  
  Add CPU_SET_ATOMIC_ACQ(num, cpuset):
  This is used when activating a vcpu in the nested pmap. Using the 'acquire'
  variant guarantees that the load of the 'pm_eptgen' will happen only after
  the vcpu is activated in 'pm_active'.
  
  Add defines for various AMD-specific MSRs.
  
  Submitted by: Anish Gupta (akgu...@gmail.com)

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/sys/bitset.h
  head/sys/sys/cpuset.h
  head/sys/x86/include/specialreg.h

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Mon Oct 20 18:04:20 2014(r273337)
+++ head/sys/amd64/amd64/pmap.c Mon Oct 20 18:09:33 2014(r273338)
@@ -146,6 +146,13 @@ __FBSDID($FreeBSD$);
 #endif
 
 static __inline boolean_t
+pmap_type_guest(pmap_t pmap)
+{
+
+   return ((pmap-pm_type == PT_EPT) || (pmap-pm_type == PT_RVI));
+}
+
+static __inline boolean_t
 pmap_emulate_ad_bits(pmap_t pmap)
 {
 
@@ -159,6 +166,7 @@ pmap_valid_bit(pmap_t pmap)
 
switch (pmap-pm_type) {
case PT_X86:
+   case PT_RVI:
mask = X86_PG_V;
break;
case PT_EPT:
@@ -181,6 +189,7 @@ pmap_rw_bit(pmap_t pmap)
 
switch (pmap-pm_type) {
case PT_X86:
+   case PT_RVI:
mask = X86_PG_RW;
break;
case PT_EPT:
@@ -205,6 +214,7 @@ pmap_global_bit(pmap_t pmap)
case PT_X86:
mask = X86_PG_G;
break;
+   case PT_RVI:
case PT_EPT:
mask = 0;
break;
@@ -222,6 +232,7 @@ pmap_accessed_bit(pmap_t pmap)
 
switch (pmap-pm_type) {
case PT_X86:
+   case PT_RVI:
mask = X86_PG_A;
break;
case PT_EPT:
@@ -244,6 +255,7 @@ pmap_modified_bit(pmap_t pmap)
 
switch (pmap-pm_type) {
case PT_X86:
+   case PT_RVI:
mask = X86_PG_M;
break;
case PT_EPT:
@@ -1103,6 +1115,7 @@ pmap_swap_pat(pmap_t pmap, pt_entry_t en
 
switch (pmap-pm_type) {
case PT_X86:
+   case PT_RVI:
/* Verify that both PAT bits are not set at the same time */
KASSERT((entry  x86_pat_bits) != x86_pat_bits,
(Invalid PAT bits in entry %#lx, entry));
@@ -1138,6 +1151,7 @@ pmap_cache_bits(pmap_t pmap, int mode, b
 
switch (pmap-pm_type) {
case PT_X86:
+   case PT_RVI:
/* The PAT bit is different for PTE's and PDE's. */
pat_flag = is_pde ? X86_PG_PDE_PAT : X86_PG_PTE_PAT;
 
@@ -1172,6 +1186,7 @@ pmap_cache_mask(pmap_t pmap, boolean_t i
 
switch (pmap-pm_type) {
case PT_X86:
+   case PT_RVI:
mask = is_pde ? X86_PG_PDE_CACHE : X86_PG_PTE_CACHE;
break;
case PT_EPT:
@@ -1198,6 +1213,7 @@ pmap_update_pde_store(pmap_t pmap, pd_en
switch (pmap-pm_type) {
case PT_X86:
break;
+   case PT_RVI:
case PT_EPT:
/*
 * XXX
@@ -1233,7 +1249,7 @@ pmap_update_pde_invalidate(pmap_t pmap, 
 {
pt_entry_t PG_G;
 
-   if (pmap-pm_type == PT_EPT)
+   if (pmap_type_guest(pmap))
return;
 
KASSERT(pmap-pm_type == PT_X86,
@@ -1347,7 +1363,7 @@ pmap_invalidate_page(pmap_t pmap, vm_off
cpuset_t other_cpus;
u_int cpuid;
 
-   if (pmap-pm_type == PT_EPT) {
+   if (pmap_type_guest(pmap)) {
pmap_invalidate_ept(pmap);
return;
}
@@ -1425,7 +1441,7 @@ pmap_invalidate_range(pmap_t pmap, vm_of
vm_offset_t addr;
u_int cpuid;
 
-   if (pmap-pm_type == PT_EPT) {
+   if (pmap_type_guest(pmap)) {
pmap_invalidate_ept(pmap);
return;
}
@@ -1484,7 +1500,7 @@ pmap_invalidate_all(pmap_t pmap)
uint64_t cr3;
u_int cpuid;
 
-   if (pmap-pm_type == PT_EPT) {
+   if (pmap_type_guest(pmap)) {
pmap_invalidate_ept(pmap);
return;
}
@@ -1606,7 +1622,7 @@ pmap_update_pde(pmap_t pmap, vm_offset_t
cpuid = PCPU_GET(cpuid);
other_cpus = all_cpus;
CPU_CLR(cpuid, other_cpus);
-   if (pmap == kernel_pmap || pmap-pm_type == PT_EPT)
+   if (pmap == kernel_pmap || pmap_type_guest(pmap)) 
active = all_cpus;
else {
active = pmap-pm_active;
@@ -1644,6 +1660,7 @@ 

Re: svn commit: r273334 - in head/sys: boot/common kern sys

2014-10-20 Thread Marcel Moolenaar

 On Oct 20, 2014, at 11:00 AM, Roman Divacky rdiva...@vlakno.cz wrote:
 
  Note that LLVM appends the priority of the constructors to the name of
  the .ctors section. Not so when compiling with GCC. The code currently
  works for GCC and not for LLVM.
 
 Uhm? LLVM here creates .ctors section, nothing is appended. Can you be more
 specific on what you're seing?

Go to a module build directory (I picked uart) and build on amd64:

% make DEBUG_FLAGS=-ftest-coverage -fprofile-arcs

Check with objdump:

% objdump -x /usr/obj/usr/src/sys/modules/uart/uart.ko | grep ctors
 16 .ctors.65535  0080      00020320  2**3
 ld  .ctors.65535    .ctors.65535
RELOCATION RECORDS FOR [.ctors.65535]:

As you can see, the section is not called .ctors, but it's called
.ctors.$((65536-priority)).

The priority suffix is removed as part of linking, but on amd64,
kernel modules are relocatables...

FYI,

-- 
Marcel Moolenaar
mar...@xcllnt.net

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


Re: svn commit: r273274 - head/sys/netpfil/ipfw

2014-10-20 Thread Bruce Simpson


On Sun, 19 Oct 2014, at 13:02, Andriy Gapon wrote:
 I think that on platforms where an optimized version of fls() is
 available that
 would work faster than this cool piece of bit magic.

This is a common enough idiom that perhaps a macro should be added:

sys/param.h:
#define roundup(x, y)   x)+((y)-1))/(y))*(y))  /* to any y */
#define roundup2(x, y)  (((x)+((y)-1))(~((y)-1))) /* if y is powers of
two */
#define powerof2(x) x)-1)(x))==0)

sys/amd64/amd64/mp_machdep.c:
/*
 * Round up to the next power of two, if necessary, and then
 * take log2.
 * Returns -1 if argument is zero.
 */
static __inline int
mask_width(u_int x)
{

return (fls(x  (1 - powerof2(x))) - 1);
}


-- 
BMS (sent via webmail)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r273342 - head/sys/kern

2014-10-20 Thread Mark Johnston
Author: markj
Date: Mon Oct 20 20:21:40 2014
New Revision: 273342
URL: https://svnweb.freebsd.org/changeset/base/273342

Log:
  Fix a typo from r189544, which replaced unp_global_rwlock with unp_list_lock
  and unp_link_rwlock.
  
  MFC after:3 days

Modified:
  head/sys/kern/subr_witness.c

Modified: head/sys/kern/subr_witness.c
==
--- head/sys/kern/subr_witness.cMon Oct 20 18:58:45 2014
(r273341)
+++ head/sys/kern/subr_witness.cMon Oct 20 20:21:40 2014
(r273342)
@@ -528,7 +528,7 @@ static struct witness_order_list_entry o
/*
 * UNIX Domain Sockets
 */
-   { unp_global_rwlock, lock_class_rw },
+   { unp_link_rwlock, lock_class_rw },
{ unp_list_lock, lock_class_mtx_sleep },
{ unp, lock_class_mtx_sleep },
{ so_snd, lock_class_mtx_sleep },
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r273344 - head/sys/kern

2014-10-20 Thread Mateusz Guzik
Author: mjg
Date: Mon Oct 20 21:57:24 2014
New Revision: 273344
URL: https://svnweb.freebsd.org/changeset/base/273344

Log:
  filedesc: plug 2 write-only variables
  
  Reported by: Coverity
  CID: 1245745, 1245746

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cMon Oct 20 21:53:51 2014
(r273343)
+++ head/sys/kern/kern_descrip.cMon Oct 20 21:57:24 2014
(r273344)
@@ -3138,7 +3138,6 @@ export_vnode_to_sb(struct vnode *vp, int
 int
 kern_proc_filedesc_out(struct proc *p,  struct sbuf *sb, ssize_t maxlen)
 {
-   struct thread *td;
struct file *fp;
struct filedesc *fdp;
struct export_fd_buf *efbuf;
@@ -3146,7 +3145,6 @@ kern_proc_filedesc_out(struct proc *p,  
int error, i;
cap_rights_t rights;
 
-   td = curthread;
PROC_LOCK_ASSERT(p, MA_OWNED);
 
/* ktrace vnode */
@@ -3301,12 +3299,10 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLE
struct kinfo_ofile *okif;
struct kinfo_file *kif;
struct filedesc *fdp;
-   struct thread *td;
int error, i, *name;
struct file *fp;
struct proc *p;
 
-   td = curthread;
name = (int *)arg1;
error = pget((pid_t)name[0], PGET_CANDEBUG | PGET_NOTWEXIT, p);
if (error != 0)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r273331 - in head: sbin/ifconfig share/man/man4 sys/conf sys/modules sys/modules/if_vxlan sys/net sys/sys

2014-10-20 Thread Andrew Thompson
On 21 October 2014 03:42, Bryan Venteicher bry...@freebsd.org wrote:

 Author: bryanv
 Date: Mon Oct 20 14:42:42 2014
 New Revision: 273331
 URL: https://svnweb.freebsd.org/changeset/base/273331

 Log:
   Add vxlan interface

   vxlan creates a virtual LAN by encapsulating the inner Ethernet frame in
   a UDP packet. This implementation is based on RFC7348.

   Currently, the IPv6 support is not fully compliant with the
 specification:
   we should be able to receive UPDv6 packets with a zero checksum, but we
   need to support RFC6935 first. Patches for this should come soon.



Given it is self contained new code is it a 10.1 MFC candidate?


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


svn commit: r273351 - head/sys/kern

2014-10-20 Thread Mateusz Guzik
Author: mjg
Date: Mon Oct 20 22:52:15 2014
New Revision: 273351
URL: https://svnweb.freebsd.org/changeset/base/273351

Log:
  Plug unnecessary binvp NULL initialization and test.
  
  Reported by: Coverity
  CID: 1018889

Modified:
  head/sys/kern/kern_exec.c

Modified: head/sys/kern/kern_exec.c
==
--- head/sys/kern/kern_exec.c   Mon Oct 20 22:22:39 2014(r273350)
+++ head/sys/kern/kern_exec.c   Mon Oct 20 22:52:15 2014(r273351)
@@ -348,7 +348,7 @@ do_execve(td, args, mac_p)
struct vnode *tracevp = NULL;
struct ucred *tracecred = NULL;
 #endif
-   struct vnode *textvp = NULL, *binvp = NULL;
+   struct vnode *textvp = NULL, *binvp;
cap_rights_t rights;
int credential_changing;
int textset;
@@ -422,7 +422,7 @@ interpret:
if (error)
goto exec_fail;
 
-   binvp  = nd.ni_vp;
+   binvp = nd.ni_vp;
imgp-vp = binvp;
} else {
AUDIT_ARG_FD(args-fd);
@@ -839,7 +839,7 @@ done1:
 */
if (textvp != NULL)
vrele(textvp);
-   if (binvp  error != 0)
+   if (error != 0)
vrele(binvp);
 #ifdef KTRACE
if (tracevp != NULL)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r273331 - in head: sbin/ifconfig share/man/man4 sys/conf sys/modules sys/modules/if_vxlan sys/net sys/sys

2014-10-20 Thread Bryan Venteicher
On Mon, Oct 20, 2014 at 5:37 PM, Andrew Thompson thom...@freebsd.org
wrote:



 On 21 October 2014 03:42, Bryan Venteicher bry...@freebsd.org wrote:

 Author: bryanv
 Date: Mon Oct 20 14:42:42 2014
 New Revision: 273331
 URL: https://svnweb.freebsd.org/changeset/base/273331

 Log:
   Add vxlan interface

   vxlan creates a virtual LAN by encapsulating the inner Ethernet frame in
   a UDP packet. This implementation is based on RFC7348.

   Currently, the IPv6 support is not fully compliant with the
 specification:
   we should be able to receive UPDv6 packets with a zero checksum, but we
   need to support RFC6935 first. Patches for this should come soon.



 Given it is self contained new code is it a 10.1 MFC candidate?




I hope to merge vxlan to 10-STABLE in a couple of months, but need to
determine how to handle prerequisite commit r272886. There's ways without
it - use a mbuf tag and a reserved field in the inpcb - but it would be
nice if that commit is MFC'able.

https://svnweb.freebsd.org/base?view=revisionrevision=272886



 Andrew


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


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

2014-10-20 Thread Andriy Gapon
On 02/08/2014 02:16, Steven Hartland wrote:
 Author: smh
 Date: Fri Aug  1 23:16:48 2014
 New Revision: 269407
 URL: http://svnweb.freebsd.org/changeset/base/269407
 
 Log:
   Don't return ZIO_PIPELINE_CONTINUE from vdev_op_io_start methods
   
   This prevents recursion of vdev_queue_io_done as per r265321 but
   using a different method as recommended on the openzfs list.
   
   We now use zio_interrupt(zio) and return ZIO_PIPELINE_STOP instead
   of returning ZIO_PIPELINE_CONTINUE from vdev_*_io_start methods.
   
   zio_vdev_io_start now ASSERTS the that vdev_op_io_start returns
   ZIO_PIPELINE_STOP to ensure future changes don't reintroduce
   ZIO_PIPELINE_CONTINUE returns.


Steve,

it seems that the issue is applicable to OpenZFS in general, but unfortunately,
as far as I can see, it's been applied only to FreeBSD.

Now, I see the following bug report and a proposed fix:
https://www.illumos.org/projects/illumos-gate//issues/5244
https://reviews.csiden.org/r/119/

I am not 100% sure, but it seems that those upstream changes could fix the
problem that you've found.

What do you think?
Thanks!

   Cleanup flow in vdev_geom_io_start while I'm here.
   
   Also fix some cases not using SET_ERROR(..)
   
   MFC after:  2 weeks
   X-MFC-With: r265321
 
 Modified:
   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c
   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c
   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c
   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c
   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c
   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c
   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
 
 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
 ==
 --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Fri Aug 
  1 23:06:38 2014(r269406)
 +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Fri Aug 
  1 23:16:48 2014(r269407)
 @@ -208,7 +208,6 @@ enum zio_flag {
   ZIO_FLAG_NOPWRITE   = 1  26,
   ZIO_FLAG_REEXECUTED = 1  27,
   ZIO_FLAG_DELEGATED  = 1  28,
 - ZIO_FLAG_QUEUE_IO_DONE  = 1  29,
  };
  
  #define  ZIO_FLAG_MUSTSUCCEED0
 @@ -363,7 +362,7 @@ typedef struct zio_transform {
   struct zio_transform*zt_next;
  } zio_transform_t;
  
 -typedef int zio_pipe_stage_t(zio_t **ziop);
 +typedef int zio_pipe_stage_t(zio_t *zio);
  
  /*
   * The io_reexecute flags are distinct from io_flags because the child must
 
 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c
 ==
 --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c   Fri Aug 
  1 23:06:38 2014(r269406)
 +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c   Fri Aug 
  1 23:16:48 2014(r269407)
 @@ -684,7 +684,7 @@ vdev_disk_io_intr(buf_t *bp)
* Rather than teach the rest of the stack about other error
* possibilities (EFAULT, etc), we normalize the error value here.
*/
 - zio-io_error = (geterror(bp) != 0 ? EIO : 0);
 + zio-io_error = (geterror(bp) != 0 ? SET_ERROR(EIO) : 0);
  
   if (zio-io_error == 0  bp-b_resid != 0)
   zio-io_error = SET_ERROR(EIO);
 @@ -730,15 +730,17 @@ vdev_disk_io_start(zio_t *zio)
* Nothing to be done here but return failure.
*/
   if (dvd == NULL || (dvd-vd_ldi_offline  dvd-vd_lh == NULL)) {
 - zio-io_error = ENXIO;
 - return (ZIO_PIPELINE_CONTINUE);
 + zio-io_error = SET_ERROR(ENXIO);
 + zio_interrupt(zio);
 + return (ZIO_PIPELINE_STOP);
   }
  
   if (zio-io_type == ZIO_TYPE_IOCTL) {
   /* XXPOLICY */
   if (!vdev_readable(vd)) {
   zio-io_error = SET_ERROR(ENXIO);
 - return (ZIO_PIPELINE_CONTINUE);
 + zio_interrupt(zio);
 + return (ZIO_PIPELINE_STOP);
   }
  
   switch (zio-io_cmd) {
 @@ -790,7 +792,8 @@ vdev_disk_io_start(zio_t *zio)
   zio-io_error = SET_ERROR(ENOTSUP);
   }
  
 - return (ZIO_PIPELINE_CONTINUE);
 + zio_interrupt(zio);
 + return (ZIO_PIPELINE_STOP);
   }
  
   vb = kmem_alloc(sizeof (vdev_buf_t), KM_SLEEP);
 
 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c
 ==
 --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c   Fri Aug 
  1 23:06:38 2014

svn commit: r273352 - head/sys/arm/freescale/imx

2014-10-20 Thread Ian Lepore
Author: ian
Date: Mon Oct 20 23:32:34 2014
New Revision: 273352
URL: https://svnweb.freebsd.org/changeset/base/273352

Log:
  The imx6 hardware is fast enough to make good use of however much
  timecounter resolution is available, so ask for a 1 GHz frequency.  It
  won't actually get one that fast, but that'll get the fastest available
  clock and use a divisor of 1 (probably 132 or 66mhz on current hardware).

Modified:
  head/sys/arm/freescale/imx/imx_gpt.c

Modified: head/sys/arm/freescale/imx/imx_gpt.c
==
--- head/sys/arm/freescale/imx/imx_gpt.cMon Oct 20 22:52:15 2014
(r273351)
+++ head/sys/arm/freescale/imx/imx_gpt.cMon Oct 20 23:32:34 2014
(r273352)
@@ -95,7 +95,7 @@ struct imx_gpt_softc *imx_gpt_sc = NULL;
 static const int imx_gpt_delay_count = 78;
 
 /* Try to divide down an available fast clock to this frequency. */
-#defineTARGET_FREQUENCY1000
+#defineTARGET_FREQUENCY10
 
 /* Don't try to set an event timer period smaller than this. */
 #defineMIN_ET_PERIOD   10LLU
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r273353 - head/sys/arm/freescale/imx

2014-10-20 Thread Ian Lepore
Author: ian
Date: Mon Oct 20 23:34:47 2014
New Revision: 273353
URL: https://svnweb.freebsd.org/changeset/base/273353

Log:
  Attach the imx6 CCM driver during BUS_PASS_CPU.  It controls the clocks
  for most on-chip devices and needs to be available before other drivers
  start attaching and asking to have their clocks enabled.

Modified:
  head/sys/arm/freescale/imx/imx6_ccm.c

Modified: head/sys/arm/freescale/imx/imx6_ccm.c
==
--- head/sys/arm/freescale/imx/imx6_ccm.c   Mon Oct 20 23:32:34 2014
(r273352)
+++ head/sys/arm/freescale/imx/imx6_ccm.c   Mon Oct 20 23:34:47 2014
(r273353)
@@ -261,5 +261,6 @@ static driver_t ccm_driver = {
 
 static devclass_t ccm_devclass;
 
-DRIVER_MODULE(ccm, simplebus, ccm_driver, ccm_devclass, 0, 0);
+EARLY_DRIVER_MODULE(ccm, simplebus, ccm_driver, ccm_devclass, 0, 0, 
+BUS_PASS_CPU + BUS_PASS_ORDER_EARLY);
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


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

2014-10-20 Thread Steven Hartland


On 20/10/2014 23:54, Andriy Gapon wrote:

On 02/08/2014 02:16, Steven Hartland wrote:

Author: smh
Date: Fri Aug  1 23:16:48 2014
New Revision: 269407
URL: http://svnweb.freebsd.org/changeset/base/269407

Log:
   Don't return ZIO_PIPELINE_CONTINUE from vdev_op_io_start methods
   
   This prevents recursion of vdev_queue_io_done as per r265321 but

   using a different method as recommended on the openzfs list.
   
   We now use zio_interrupt(zio) and return ZIO_PIPELINE_STOP instead

   of returning ZIO_PIPELINE_CONTINUE from vdev_*_io_start methods.
   
   zio_vdev_io_start now ASSERTS the that vdev_op_io_start returns

   ZIO_PIPELINE_STOP to ensure future changes don't reintroduce
   ZIO_PIPELINE_CONTINUE returns.


Steve,

it seems that the issue is applicable to OpenZFS in general, but unfortunately,
as far as I can see, it's been applied only to FreeBSD.

Now, I see the following bug report and a proposed fix:
https://www.illumos.org/projects/illumos-gate//issues/5244
https://reviews.csiden.org/r/119/

I am not 100% sure, but it seems that those upstream changes could fix the
problem that you've found.

What do you think?

Yep very similar change overall.

The only real difference is they changed the vdev_op_io_start call to a 
void and return stop direct from zio_vdev_io_start.


The result should be identical and it will be easy to merge the upstream 
change when it gets committed.


Shame that wasn't suggested when I posted my suggested patch ;-)

Regards
Steve
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r273356 - head/sys/amd64/amd64

2014-10-20 Thread Neel Natu
Author: neel
Date: Tue Oct 21 01:06:58 2014
New Revision: 273356
URL: https://svnweb.freebsd.org/changeset/base/273356

Log:
  Fix a race in pmap_emulate_accessed_dirty() that could trigger a EPT
  misconfiguration VM-exit.
  
  An EPT misconfiguration is triggered when the processor encounters a PTE
  that is writable but not readable (WR=10). On processors that require A/D
  bit emulation PG_M and PG_A map to EPT_PG_WRITE and EPT_PG_READ respectively.
  
  If the PTE is updated as in the following code snippet:
*pte |= PG_M;
*pte |= PG_A;
  then it is possible for another processor to observe the PTE after the PG_M
  (aka EPT_PG_WRITE) bit is set but before PG_A (aka EPT_PG_READ) bit is set.
  
  This will trigger an EPT misconfiguration VM-exit on the other processor.
  
  Reported by:  rodrigc
  Reviewed by:  grehan
  MFC after:3 days

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

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Tue Oct 21 00:07:37 2014(r273355)
+++ head/sys/amd64/amd64/pmap.c Tue Oct 21 01:06:58 2014(r273356)
@@ -6810,9 +6810,19 @@ retry:
if (ftype == VM_PROT_WRITE) {
if ((*pte  PG_RW) == 0)
goto done;
-   *pte |= PG_M;
+   /*
+* Set the modified and accessed bits simultaneously.
+*
+* Intel EPT PTEs that do software emulation of A/D bits map
+* PG_A and PG_M to EPT_PG_READ and EPT_PG_WRITE respectively.
+* An EPT misconfiguration is triggered if the PTE is writable
+* but not readable (WR=10). This is avoided by setting PG_A
+* and PG_M simultaneously.
+*/
+   *pte |= PG_M | PG_A;
+   } else {
+   *pte |= PG_A;
}
-   *pte |= PG_A;
 
/* try to promote the mapping */
if (va  VM_MAXUSER_ADDRESS)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r273359 - head/sys/dev/re

2014-10-20 Thread Pyun YongHyeon
Author: yongari
Date: Tue Oct 21 01:31:24 2014
New Revision: 273359
URL: https://svnweb.freebsd.org/changeset/base/273359

Log:
  It seems multicast filtering of RTL8168F does not work.  Workaround
  the silicon bug by accepting any multicast packets.
  
  PR:   193488
  MFC After:1 week

Modified:
  head/sys/dev/re/if_re.c

Modified: head/sys/dev/re/if_re.c
==
--- head/sys/dev/re/if_re.c Tue Oct 21 01:15:43 2014(r273358)
+++ head/sys/dev/re/if_re.c Tue Oct 21 01:31:24 2014(r273359)
@@ -703,6 +703,12 @@ re_set_rxmode(struct rl_softc *sc)
rxfilt |= RL_RXCFG_RX_MULTI;
}
 
+   if  (sc-rl_hwrev-rl_rev == RL_HWREV_8168F) {
+   /* Disable multicast filtering due to silicon bug. */
+   hashes[0] = 0x;
+   hashes[1] = 0x;
+   }
+
 done:
CSR_WRITE_4(sc, RL_MAR0, hashes[0]);
CSR_WRITE_4(sc, RL_MAR4, hashes[1]);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r273360 - head/tools/tools/cxgbetool

2014-10-20 Thread Navdeep Parhar
Author: np
Date: Tue Oct 21 01:34:18 2014
New Revision: 273360
URL: https://svnweb.freebsd.org/changeset/base/273360

Log:
  cxgbetool: Catch up with r185979.  One of MAP_ANON, MAP_PRIVATE,
  MAP_SHARED, or MAP_STACK must be specified.
  
  This fixes the loadfw subcommand.
  
  MFC after:1 week

Modified:
  head/tools/tools/cxgbetool/cxgbetool.c

Modified: head/tools/tools/cxgbetool/cxgbetool.c
==
--- head/tools/tools/cxgbetool/cxgbetool.c  Tue Oct 21 01:31:24 2014
(r273359)
+++ head/tools/tools/cxgbetool/cxgbetool.c  Tue Oct 21 01:34:18 2014
(r273360)
@@ -1462,7 +1462,7 @@ loadfw(int argc, const char *argv[])
}
 
data.len = st.st_size;
-   data.data = mmap(0, data.len, PROT_READ, 0, fd, 0);
+   data.data = mmap(0, data.len, PROT_READ, MAP_PRIVATE, fd, 0);
if (data.data == MAP_FAILED) {
warn(mmap);
close(fd);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r273360 - head/tools/tools/cxgbetool

2014-10-20 Thread Navdeep Parhar

On 10/20/14 18:34, Navdeep Parhar wrote:

Author: np
Date: Tue Oct 21 01:34:18 2014
New Revision: 273360
URL: https://svnweb.freebsd.org/changeset/base/273360

Log:
   cxgbetool: Catch up with r185979.  One of MAP_ANON, MAP_PRIVATE,
   MAP_SHARED, or MAP_STACK must be specified.


Sorry, I meant r271635.  (185979 isn't a random number in case you're 
wondering -- it's the mercurial changelog number for r271635 in my 
workspace).


Regards,
Navdeep
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r273365 - head/share/mk

2014-10-20 Thread Mark Johnston
Author: markj
Date: Tue Oct 21 04:30:00 2014
New Revision: 273365
URL: https://svnweb.freebsd.org/changeset/base/273365

Log:
  Fix a few small bugs in the DTrace USDT rules:
  * anchor search strings appropriately,
  * use .ALLSRC to pass the full path to the D script to dtrace(1),
  * don't insert the auto-generated header into SRCS - it doesn't
accomplish anything, and we end up having to remove it from OBJS anyway.
  
  Reviewed by:  rpaulo
  Differential Revision:https://reviews.freebsd.org/D978
  MFC after:3 weeks
  Sponsored by: EMC / Isilon Storage Division

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

Modified: head/share/mk/bsd.dep.mk
==
--- head/share/mk/bsd.dep.mkTue Oct 21 02:41:40 2014(r273364)
+++ head/share/mk/bsd.dep.mkTue Oct 21 04:30:00 2014(r273365)
@@ -132,20 +132,17 @@ CFLAGS+=  -I${.OBJDIR}
 DHDRS+=${_D}.h
 ${_D}.h: ${_DSRC}
${DTRACE} -xnolibs -h -s ${.ALLSRC}
-SRCS:= ${SRCS:S/${_DSRC}/${_D}.h/}
+SRCS:= ${SRCS:S/^${_DSRC}$//}
 OBJS+= ${_D}.o
 CLEANFILES+= ${_D}.h ${_D}.o
-${_D}.o: ${_D}.h ${OBJS:S/${_D}.o//}
-   ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${.CURDIR}/${_DSRC} \
-   ${OBJS:S/${_D}.o//}
+${_D}.o: ${_DSRC} ${OBJS:S/^${_D}.o$//}
+   ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${.ALLSRC}
 .if defined(LIB)
 CLEANFILES+= ${_D}.So ${_D}.po
-${_D}.So: ${_D}.h ${SOBJS:S/${_D}.So//}
-   ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${.CURDIR}/${_DSRC} \
-   ${SOBJS:S/${_D}.So//}
-${_D}.po: ${_D}.h ${POBJS:S/${_D}.po//}
-   ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${.CURDIR}/${_DSRC} \
-   ${POBJS:S/${_D}.po//}
+${_D}.So: ${_DSRC} ${SOBJS:S/^${_D}.So$//}
+   ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${.ALLSRC}
+${_D}.po: ${_DSRC} ${POBJS:S/^${_D}.po$//}
+   ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${.ALLSRC}
 .endif
 .endfor
 .endfor
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r273370 - head/cddl/lib/libdtrace

2014-10-20 Thread Mark Johnston
Author: markj
Date: Tue Oct 21 05:19:08 2014
New Revision: 273370
URL: https://svnweb.freebsd.org/changeset/base/273370

Log:
  Correct the calculation of tcps_rto in the struct tcpcb - tcpsinfo_t
  translator.
  
  Submitted by: Grenville Armitage garmit...@swin.edu.au
  MFC after:1 week

Modified:
  head/cddl/lib/libdtrace/tcp.d

Modified: head/cddl/lib/libdtrace/tcp.d
==
--- head/cddl/lib/libdtrace/tcp.d   Tue Oct 21 04:55:55 2014
(r273369)
+++ head/cddl/lib/libdtrace/tcp.d   Tue Oct 21 05:19:08 2014
(r273370)
@@ -198,7 +198,7 @@ translator tcpsinfo_t  struct tcpcb *p 
tcps_cwnd_ssthresh =p == NULL ? -1  : p-snd_ssthresh;
tcps_sack_fack =p == NULL ? 0  : p-snd_fack;
tcps_sack_snxt =p == NULL ? 0  : p-sack_newdata;
-   tcps_rto =  p == NULL ? -1  : p-t_rxtcur / 1000; /* XXX */
+   tcps_rto =  p == NULL ? -1 : (p-t_rxtcur * 1000) / `hz;
tcps_mss =  p == NULL ? -1  : p-t_maxseg;
tcps_retransmit =   p == NULL ? -1 : p-t_rxtshift  0 ? 1 : 0;
tcps_srtt = p == NULL ? -1  : p-t_srtt;   /* smoothed RTT 
in units of (TCP_RTT_SCALE*hz) */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r273356 - head/sys/amd64/amd64

2014-10-20 Thread Craig Rodrigues
Hi,

Just to add some background to this fix, in the https://jenkins.freebsd.org
cluster,
we are using several bhyve VM's to host the environment for doing builds
and tests.  We are hammering on the VM's
quite nicely.  We found one problem where the bhyve binary would crash.

Neel looked at the problem, and came up with this fix.

Thanks, Neel!

--
Craig


On Mon, Oct 20, 2014 at 6:06 PM, Neel Natu n...@freebsd.org wrote:

 Author: neel
 Date: Tue Oct 21 01:06:58 2014
 New Revision: 273356
 URL: https://svnweb.freebsd.org/changeset/base/273356

 Log:
   Fix a race in pmap_emulate_accessed_dirty() that could trigger a EPT
   misconfiguration VM-exit.

   An EPT misconfiguration is triggered when the processor encounters a PTE
   that is writable but not readable (WR=10). On processors that require A/D
   bit emulation PG_M and PG_A map to EPT_PG_WRITE and EPT_PG_READ
 respectively.

   If the PTE is updated as in the following code snippet:
 *pte |= PG_M;
 *pte |= PG_A;
   then it is possible for another processor to observe the PTE after the
 PG_M
   (aka EPT_PG_WRITE) bit is set but before PG_A (aka EPT_PG_READ) bit is
 set.

   This will trigger an EPT misconfiguration VM-exit on the other processor.

   Reported by:  rodrigc
   Reviewed by:  grehan
   MFC after:3 days

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

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

 ==
 --- head/sys/amd64/amd64/pmap.c Tue Oct 21 00:07:37 2014(r273355)
 +++ head/sys/amd64/amd64/pmap.c Tue Oct 21 01:06:58 2014(r273356)
 @@ -6810,9 +6810,19 @@ retry:
 if (ftype == VM_PROT_WRITE) {
 if ((*pte  PG_RW) == 0)
 goto done;
 -   *pte |= PG_M;
 +   /*
 +* Set the modified and accessed bits simultaneously.
 +*
 +* Intel EPT PTEs that do software emulation of A/D bits
 map
 +* PG_A and PG_M to EPT_PG_READ and EPT_PG_WRITE
 respectively.
 +* An EPT misconfiguration is triggered if the PTE is
 writable
 +* but not readable (WR=10). This is avoided by setting
 PG_A
 +* and PG_M simultaneously.
 +*/
 +   *pte |= PG_M | PG_A;
 +   } else {
 +   *pte |= PG_A;
 }
 -   *pte |= PG_A;

 /* try to promote the mapping */
 if (va  VM_MAXUSER_ADDRESS)


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


svn commit: r273371 - head/sys/net

2014-10-20 Thread Bryan Venteicher
Author: bryanv
Date: Tue Oct 21 05:45:57 2014
New Revision: 273371
URL: https://svnweb.freebsd.org/changeset/base/273371

Log:
  Use the size of the Ethernet address, not the entire header, when
  copying into forwarding entry.
  
  Reported by:  Coverity
  CID:  1248849

Modified:
  head/sys/net/if_vxlan.c

Modified: head/sys/net/if_vxlan.c
==
--- head/sys/net/if_vxlan.c Tue Oct 21 05:19:08 2014(r273370)
+++ head/sys/net/if_vxlan.c Tue Oct 21 05:45:57 2014(r273371)
@@ -716,7 +716,7 @@ vxlan_ftable_entry_init(struct vxlan_sof
 
fe-vxlfe_flags = flags;
fe-vxlfe_expire = time_uptime + sc-vxl_ftable_timeout;
-   memcpy(fe-vxlfe_mac, mac, ETHER_HDR_LEN);
+   memcpy(fe-vxlfe_mac, mac, ETHER_ADDR_LEN);
vxlan_sockaddr_copy(fe-vxlfe_raddr, sa);
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org