svn commit: r262215 - head/sys/net

2014-02-19 Thread Marko Zec
Author: zec
Date: Wed Feb 19 08:29:07 2014
New Revision: 262215
URL: http://svnweb.freebsd.org/changeset/base/262215

Log:
  V_irtualize rtsock refcounting, which reduces the chances for panics
  on teardown of vnets without active routing sockets while at least
  one routing socket is active elsewhere.
  
  Tested by:Vijay Singh
  MFC after:3 days

Modified:
  head/sys/net/rtsock.c

Modified: head/sys/net/rtsock.c
==
--- head/sys/net/rtsock.c   Wed Feb 19 08:15:09 2014(r262214)
+++ head/sys/net/rtsock.c   Wed Feb 19 08:29:07 2014(r262215)
@@ -154,12 +154,14 @@ int   (*carp_get_vhid_p)(struct ifaddr *);
  */
 #defineRTS_FILTER_FIB  M_PROTO8
 
-static struct {
+typedef struct {
int ip_count;   /* attached w/ AF_INET */
int ip6_count;  /* attached w/ AF_INET6 */
int ipx_count;  /* attached w/ AF_IPX */
int any_count;  /* total attached */
-} route_cb;
+} route_cb_t;
+static VNET_DEFINE(route_cb_t, route_cb);
+#defineV_route_cb VNET(route_cb)
 
 struct mtx rtsock_mtx;
 MTX_SYSINIT(rtsock, rtsock_mtx, rtsock route_cb lock, MTX_DEF);
@@ -317,16 +319,16 @@ rts_attach(struct socket *so, int proto,
RTSOCK_LOCK();
switch(rp-rcb_proto.sp_protocol) {
case AF_INET:
-   route_cb.ip_count++;
+   V_route_cb.ip_count++;
break;
case AF_INET6:
-   route_cb.ip6_count++;
+   V_route_cb.ip6_count++;
break;
case AF_IPX:
-   route_cb.ipx_count++;
+   V_route_cb.ipx_count++;
break;
}
-   route_cb.any_count++;
+   V_route_cb.any_count++;
RTSOCK_UNLOCK();
soisconnected(so);
so-so_options |= SO_USELOOPBACK;
@@ -360,16 +362,16 @@ rts_detach(struct socket *so)
RTSOCK_LOCK();
switch(rp-rcb_proto.sp_protocol) {
case AF_INET:
-   route_cb.ip_count--;
+   V_route_cb.ip_count--;
break;
case AF_INET6:
-   route_cb.ip6_count--;
+   V_route_cb.ip6_count--;
break;
case AF_IPX:
-   route_cb.ipx_count--;
+   V_route_cb.ipx_count--;
break;
}
-   route_cb.any_count--;
+   V_route_cb.any_count--;
RTSOCK_UNLOCK();
raw_usrreqs.pru_detach(so);
 }
@@ -943,7 +945,7 @@ flush:
 * Check to see if we don't want our own messages.
 */
if ((so-so_options  SO_USELOOPBACK) == 0) {
-   if (route_cb.any_count = 1) {
+   if (V_route_cb.any_count = 1) {
if (rtm)
Free(rtm);
m_freem(m);
@@ -1274,7 +1276,7 @@ rt_missmsg_fib(int type, struct rt_addri
struct mbuf *m;
struct sockaddr *sa = rtinfo-rti_info[RTAX_DST];
 
-   if (route_cb.any_count == 0)
+   if (V_route_cb.any_count == 0)
return;
m = rt_msg1(type, rtinfo);
if (m == NULL)
@@ -1312,7 +1314,7 @@ rt_ifmsg(struct ifnet *ifp)
struct mbuf *m;
struct rt_addrinfo info;
 
-   if (route_cb.any_count == 0)
+   if (V_route_cb.any_count == 0)
return;
bzero((caddr_t)info, sizeof(info));
m = rt_msg1(RTM_IFINFO, info);
@@ -1342,7 +1344,7 @@ rtsock_addrmsg(int cmd, struct ifaddr *i
struct ifa_msghdr *ifam;
struct ifnet *ifp = ifa-ifa_ifp;
 
-   if (route_cb.any_count == 0)
+   if (V_route_cb.any_count == 0)
return (0);
 
ncmd = cmd == RTM_ADD ? RTM_NEWADDR : RTM_DELADDR;
@@ -1390,7 +1392,7 @@ rtsock_routemsg(int cmd, struct ifnet *i
struct mbuf *m;
struct rt_msghdr *rtm;
 
-   if (route_cb.any_count == 0)
+   if (V_route_cb.any_count == 0)
return (0);
 
bzero((caddr_t)info, sizeof(info));
@@ -1428,7 +1430,7 @@ rt_newmaddrmsg(int cmd, struct ifmultiad
struct ifnet *ifp = ifma-ifma_ifp;
struct ifma_msghdr *ifmam;
 
-   if (route_cb.any_count == 0)
+   if (V_route_cb.any_count == 0)
return;
 
bzero((caddr_t)info, sizeof(info));
@@ -1457,7 +1459,7 @@ rt_makeifannouncemsg(struct ifnet *ifp, 
struct if_announcemsghdr *ifan;
struct mbuf *m;
 
-   if (route_cb.any_count == 0)
+   if (V_route_cb.any_count == 0)
return NULL;
bzero((caddr_t)info, sizeof(*info));
m = rt_msg1(type, info);
___
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: r262217 - head/sys/mips/include

2014-02-19 Thread Robert Watson
Author: rwatson
Date: Wed Feb 19 09:19:09 2014
New Revision: 262217
URL: http://svnweb.freebsd.org/changeset/base/262217

Log:
  Update MIPS bootinfo.h to reflect the actual MIPS boot2/loader boot-time
  interface.
  
  MFC after:3 weeks
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/mips/include/bootinfo.h

Modified: head/sys/mips/include/bootinfo.h
==
--- head/sys/mips/include/bootinfo.hWed Feb 19 09:13:55 2014
(r262216)
+++ head/sys/mips/include/bootinfo.hWed Feb 19 09:19:09 2014
(r262217)
@@ -1,4 +1,5 @@
 /*-
+ * Copyright (c) 2013 Robert N. M. Watson
  * Copyright (C) 1994 by Rodney W. Grimes, Milwaukie, Oregon  97222
  * All rights reserved.
  *
@@ -36,33 +37,15 @@
 #define_MACHINE_BOOTINFO_H_
 
 /* Only change the version number if you break compatibility. */
-#defineBOOTINFO_VERSION1
-
-#defineN_BIOS_GEOM 8
+#defineBOOTINFO_VERSION2
 
 #defineMIPS_BOOTINFO_MAGIC 0xCDEACDEA
 
-/* Extended OLV bootinfo struct.  The data area includes a list of named
-   OIDs and associated data values.  The format is:
-
-   NUL-terminated dotted-string name
-   2 byte length, in big-endian order
-   LENGTH bytes of data
-   [...]
-
-   The two magic fields are used to guard against other bootloaders that
-   may place other sorts of data here.  */
-
-struct bootinfo_ext {
-#defineBOOTINFO_EXT_MAGIC1 0x55aa00ff
-   unsigned intmagic1;
-   unsigned char   *data;
-   unsigned intsize;
-#defineBOOTINFO_EXT_MAGIC2 0x32719187
-   unsigned intmagic2;
-};
-
-#defineBOOTINFO_EXT_MAX_SIZE   16384
+#if defined(__mips_n32) || defined(__mips_n64)
+typedefuint64_tbi_ptr_t;
+#else
+typedefuint32_tbi_ptr_t;
+#endif
 
 /*
  * A zero bootinfo field often means that there is no info available.
@@ -70,73 +53,33 @@ struct bootinfo_ext {
  * normal value.
  */
 struct bootinfo {
-   u_int32_t   bi_version;
-   u_int32_t   bi_kernelname;  /* represents a char * */
-   u_int32_t   bi_nfs_diskless;/* struct nfs_diskless * */
-   /* End of fields that are always present. */
-#definebi_endcommonbi_n_bios_used
-   u_int32_t   bi_n_bios_used;
-   u_int32_t   bi_bios_geom[N_BIOS_GEOM];
-   u_int32_t   bi_size;
-   u_int8_tbi_memsizes_valid;
-   u_int8_tbi_bios_dev;/* bootdev BIOS unit number */
-   u_int8_tbi_pad[2];
-   u_int32_t   bi_basemem;
-   u_int32_t   bi_extmem;
-   u_int32_t   bi_symtab;  /* struct symtab * */
-   u_int32_t   bi_esymtab; /* struct symtab * */
-   /* Items below only from advanced bootloader */
-   u_int32_t   bi_kernend; /* end of kernel space */
-   u_int32_t   bi_envp;/* environment */
-   u_int32_t   bi_modulep; /* preloaded modules */
+   /* bootinfo meta-data. */
+   uint32_tbi_version;
+   uint32_tbi_size;
+
+   /* bootinfo contents. */
+   uint64_tbi_boot2opts;   /* boot2 flags to loader. */
+   bi_ptr_tbi_kernelname;  /* Pointer to name. */
+   bi_ptr_tbi_nfs_diskless;/* Pointer to NFS data. */
+   bi_ptr_tbi_dtb; /* Pointer to dtb. */
+   bi_ptr_tbi_memsize; /* Physical memory size in bytes. */
+   bi_ptr_tbi_modulep; /* Preloaded modules. */
+   bi_ptr_tbi_boot_dev_type;   /* Boot-device type. */
+   bi_ptr_tbi_boot_dev_unitptr;/* Boot-device unit/pointer. */
 };
 
+/*
+ * Possible boot-device types passed from boot2 to loader, loader to kernel.
+ * In most cases, the object pointed to will hold a filesystem; one exception
+ * is BOOTINFO_DEV_TYPE_DRAM, which points to a pre-loaded object (e.g.,
+ * loader, kernel).
+ */
+#defineBOOTINFO_DEV_TYPE_DRAM  0   /* DRAM loader/kernel 
(ptr). */
+#defineBOOTINFO_DEV_TYPE_CFI   1   /* CFI flash (unit). */
+#defineBOOTINFO_DEV_TYPE_SDCARD2   /* SD card (unit). */
+
 #ifdef _KERNEL
 extern struct bootinfo bootinfo;
 #endif
 
-/*
- * Constants for converting boot-style device number to type,
- * adaptor (uba, mba, etc), unit number and partition number.
- * Type (== major device number) is in the low byte
- * for backward compatibility.  Except for that of the magic
- * number, each mask applies to the shifted value.
- * Format:
- *  (4) (4) (4) (4)  (8) (8)
- * 
- * |MA | AD| CT| UN| PART  | TYPE |
- * 
- */
-#defineB_ADAPTORSHIFT  24
-#defineB_ADAPTORMASK 

Re: svn commit: r262196 - head/sys/netpfil/pf

2014-02-19 Thread Gleb Smirnoff
  Martin,

On Tue, Feb 18, 2014 at 10:17:12PM +, Martin Matuska wrote:
M Author: mm
M Date: Tue Feb 18 22:17:12 2014
M New Revision: 262196
M URL: http://svnweb.freebsd.org/changeset/base/262196
M 
M Log:
M   De-virtualize pf_mtag_z [1]
M   Process V_pf_overloadqueue in vnet context [2]
M   
M   This fixes two VIMAGE kernel panics and allows to simultaneously run 
host-pf
M   and vnet jails. pf inside jails remains broken.
M   
M   PR:kern/182964
M   Submitted by:  gleb...@freebsd.org [2], myself [1]
M   Tested by: rodr...@freebsd.org, myself
M   MFC after: 2 weeks

I've sent your patch to Nikos, who is working on pf+vimage. He
also accumulates his work on pf+vimage in projects/pf branch,
planning to do it properly and then merge to head in one go.
I was waiting for his review. Yes, he is slow with reviews,
but that's not a reason to commit w/o review.

-- 
Totus tuus, Glebius.
___
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: r262196 - head/sys/netpfil/pf

2014-02-19 Thread Martin Matuska

 Hi Gleb,

I understand your point - if anything is broken (or more broken than
before) I can revert this patch anytime.

FreeNAS and other folks may fork separate branches and we can wait until
about FreeBSD 12.0 for the patch being reviewed so we can commit it around
14.0 - maybe we have switched to a completely different firewall at that
time and this issue becomes obsolete anyway.

Best regards,
mm

Quoting Gleb Smirnoff gleb...@freebsd.org:


Martin,

On Tue, Feb 18, 2014 at 10:17:12PM +, Martin Matuska wrote:
M Author: mm
M Date: Tue Feb 18 22:17:12 2014
M New Revision: 262196
M URL: http://svnweb.freebsd.org/changeset/base/262196
M
M Log:
M   De-virtualize pf_mtag_z [1]
M   Process V_pf_overloadqueue in vnet context [2]
M
M   This fixes two VIMAGE kernel panics and allows to simultaneously
run host-pf
M   and vnet jails. pf inside jails remains broken.
M
M   PR:                kern/182964
M   Submitted by:        gleb...@freebsd.org [2], myself [1]
M   Tested by:        rodr...@freebsd.org, myself
M   MFC after:        2 weeks

I've sent your patch to Nikos, who is working on pf+vimage. He
also accumulates his work on pf+vimage in projects/pf branch,
planning to do it properly and then merge to head in one go.
I was waiting for his review. Yes, he is slow with reviews,
but that's not a reason to commit w/o review.

--Totus tuus, Glebius.

--
Martin Matuska
FreeBSD committer
http://blog.vx.sk
___
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: r262220 - head/share/termcap

2014-02-19 Thread Bryan Drewery
Author: bdrewery
Date: Wed Feb 19 13:06:50 2014
New Revision: 262220
URL: http://svnweb.freebsd.org/changeset/base/262220

Log:
  Add missing Save Cursor support for VT520
  
  Submitted by: IWAMOTO Kouichi s...@iwmt.org
  PR:   conf/174937
  Obtained from:http://web.mit.edu/dosathena/doc/www/ek-vt520-rm.pdf
  Approved by:  bapt (mentor)
  MFC after:2 weeks

Modified:
  head/share/termcap/termcap.src

Modified: head/share/termcap/termcap.src
==
--- head/share/termcap/termcap.src  Wed Feb 19 09:56:00 2014
(r262219)
+++ head/share/termcap/termcap.src  Wed Feb 19 13:06:50 2014
(r262220)
@@ -2729,7 +2729,7 @@ vt520|DEC VT520 :\
:kb=\b:kd=\E[B:ke=\E:kl=\E[D:\
:kr=\E[C:ks=\E=:ku=\E[A:nd=\E[C:\
:rc=\E8:rf=/usr/lib/tabset/vt100:\
-   :se=\E[m:so=\E[7m:\
+   :sc=\E7:se=\E[m:so=\E[7m:\
:sr=\EM:ue=\E[m:up=\E[A:us=\E[4m:nl=\E[B:ko=do,nd,up:
 #
 vt520nam|vt520-nam|v520n|DEC VT520 with no automargins:\
___
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: r262196 - head/sys/netpfil/pf

2014-02-19 Thread Gleb Smirnoff
  Martin,

M  On Tue, Feb 18, 2014 at 10:17:12PM +, Martin Matuska wrote:
M  M Author: mm
M  M Date: Tue Feb 18 22:17:12 2014
M  M New Revision: 262196
M  M URL: http://svnweb.freebsd.org/changeset/base/262196
M  M
M  M Log:
M  M   De-virtualize pf_mtag_z [1]
M  M   Process V_pf_overloadqueue in vnet context [2]
M  M
M  M   This fixes two VIMAGE kernel panics and allows to simultaneously
M  run host-pf
M  M   and vnet jails. pf inside jails remains broken.
M  M
M  M   PR:                kern/182964
M  M   Submitted by:        gleb...@freebsd.org [2], myself [1]
M  M   Tested by:        rodr...@freebsd.org, myself
M  M   MFC after:        2 weeks
M 
M  I've sent your patch to Nikos, who is working on pf+vimage. He
M  also accumulates his work on pf+vimage in projects/pf branch,
M  planning to do it properly and then merge to head in one go.
M  I was waiting for his review. Yes, he is slow with reviews,
M  but that's not a reason to commit w/o review.

On Wed, Feb 19, 2014 at 02:01:23PM +0100, Martin Matuska wrote:
M I understand your point - if anything is broken (or more broken than
M before) I can revert this patch anytime.
M 
M FreeNAS and other folks may fork separate branches and we can wait until
M about FreeBSD 12.0 for the patch being reviewed so we can commit it around
M 14.0 - maybe we have switched to a completely different firewall at that
M time and this issue becomes obsolete anyway.

No need for sarcasm and top quoting. Since you already got sharp in
your reply, let me too.

First of all. I did not submitted you [2], right now I just checked
my sent mail to ensure that. I submitted you other patch, that later
was rejected by zec@, and that patch was very unlike [2]. So
statement in commit message is not true.

Second, these two changes are absolutely unrelated. They shouldn't
been committed as one patch.

Third. As you already know, there is projects/pf branch, where Nicos
is getting things right wrt pf+VIMAGE. The patches should first go
to this branch and tested in it. Committing to head (even a good
code), you are creating conflicts for Nicos. You are fixing two
particular problems that hurt you, while Nicos tries to get things
right in general, for everyones sake. My approach on taskqueue
context (that was rejected by Marko), was also an attempt to
create a good and generic way of dealing with the problem. Unfortunately,
Marko didn't suggest good alternatives.

Anyway this is not a reason to plumb problems in place.

As you may notice yourself the code you added:

if (IS_DEFAULT_VNET(curvnet))
pf_mtag_z = uma_zcreate(pf mtags, sizeof(struct m_tag) +
sizeof(struct pf_mtag), NULL, NULL, pf_mtag_init, NULL,
UMA_ALIGN_PTR, 0);

Is quite not like the rest of the code of the function. That is because
in head/ the per-VNET initialization in pf isn't separated from global
initialization. This is a generic problem, that Nikos is solving in
projects/pf. Making pf mtag zone in projects/pf would be more clean
than in head. And of course after your change merge of head to
projects/pf would fail. You could join Nikos efforts, but instead
you are just putting obstacles on his way. And mine too, since I
would do next merge.

-- 
Totus tuus, Glebius.
___
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: r262196 - head/sys/netpfil/pf

2014-02-19 Thread Ermal Luçi
On Wed, Feb 19, 2014 at 4:32 PM, Gleb Smirnoff gleb...@freebsd.org wrote:

   Martin,

 M  On Tue, Feb 18, 2014 at 10:17:12PM +, Martin Matuska wrote:
 M  M Author: mm
 M  M Date: Tue Feb 18 22:17:12 2014
 M  M New Revision: 262196
 M  M URL: http://svnweb.freebsd.org/changeset/base/262196
 M  M
 M  M Log:
 M  M   De-virtualize pf_mtag_z [1]
 M  M   Process V_pf_overloadqueue in vnet context [2]
 M  M
 M  M   This fixes two VIMAGE kernel panics and allows to simultaneously
 M  run host-pf
 M  M   and vnet jails. pf inside jails remains broken.
 M  M
 M  M   PR:kern/182964
 M  M   Submitted by:gleb...@freebsd.org [2], myself [1]
 M  M   Tested by:rodr...@freebsd.org, myself
 M  M   MFC after:2 weeks
 M 
 M  I've sent your patch to Nikos, who is working on pf+vimage. He
 M  also accumulates his work on pf+vimage in projects/pf branch,
 M  planning to do it properly and then merge to head in one go.
 M  I was waiting for his review. Yes, he is slow with reviews,
 M  but that's not a reason to commit w/o review.

 On Wed, Feb 19, 2014 at 02:01:23PM +0100, Martin Matuska wrote:
 M I understand your point - if anything is broken (or more broken than
 M before) I can revert this patch anytime.
 M
 M FreeNAS and other folks may fork separate branches and we can wait until
 M about FreeBSD 12.0 for the patch being reviewed so we can commit it
 around
 M 14.0 - maybe we have switched to a completely different firewall at that
 M time and this issue becomes obsolete anyway.

 No need for sarcasm and top quoting. Since you already got sharp in
 your reply, let me too.

 First of all. I did not submitted you [2], right now I just checked
 my sent mail to ensure that. I submitted you other patch, that later
 was rejected by zec@, and that patch was very unlike [2]. So
 statement in commit message is not true.

 Second, these two changes are absolutely unrelated. They shouldn't
 been committed as one patch.

 Third. As you already know, there is projects/pf branch, where Nicos
 is getting things right wrt pf+VIMAGE. The patches should first go
 to this branch and tested in it. Committing to head (even a good
 code), you are creating conflicts for Nicos. You are fixing two
 particular problems that hurt you, while Nicos tries to get things
 right in general, for everyones sake. My approach on taskqueue
 context (that was rejected by Marko), was also an attempt to
 create a good and generic way of dealing with the problem. Unfortunately,
 Marko didn't suggest good alternatives.

 Anyway this is not a reason to plumb problems in place.

 As you may notice yourself the code you added:

 if (IS_DEFAULT_VNET(curvnet))
 pf_mtag_z = uma_zcreate(pf mtags, sizeof(struct m_tag) +
 sizeof(struct pf_mtag), NULL, NULL, pf_mtag_init, NULL,
 UMA_ALIGN_PTR, 0);

 Is quite not like the rest of the code of the function. That is because
 in head/ the per-VNET initialization in pf isn't separated from global
 initialization. This is a generic problem, that Nikos is solving in
 projects/pf. Making pf mtag zone in projects/pf would be more clean
 than in head. And of course after your change merge of head to
 projects/pf would fail. You could join Nikos efforts, but instead
 you are just putting obstacles on his way. And mine too, since I
 would do next merge.


Well go do some work instead of runting around.
You did not listen to me as well when you started doing work on pf.



 --
 Totus tuus, Glebius.




-- 
Ermal
___
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: r262222 - head/sys/netpfil/pf

2014-02-19 Thread Martin Matuska
Author: mm
Date: Wed Feb 19 17:06:04 2014
New Revision: 26
URL: http://svnweb.freebsd.org/changeset/base/26

Log:
  Revert r262196
  
  I am going to split this into two individual patches and test it with
  the projects/pf branch that may get merged later.

Modified:
  head/sys/netpfil/pf/pf.c

Modified: head/sys/netpfil/pf/pf.c
==
--- head/sys/netpfil/pf/pf.cWed Feb 19 15:00:55 2014(r262221)
+++ head/sys/netpfil/pf/pf.cWed Feb 19 17:06:04 2014(r26)
@@ -172,10 +172,7 @@ struct pf_overload_entry {
struct pf_rule  *rule;
 };
 
-struct pf_overload_head {
-   SLIST_HEAD(, pf_overload_entry) head;
-   struct vnet *vnet;
-};
+SLIST_HEAD(pf_overload_head, pf_overload_entry);
 static VNET_DEFINE(struct pf_overload_head, pf_overloadqueue);
 #define V_pf_overloadqueue VNET(pf_overloadqueue)
 static VNET_DEFINE(struct task, pf_overloadtask);
@@ -190,7 +187,8 @@ struct mtx pf_unlnkdrules_mtx;
 
 static VNET_DEFINE(uma_zone_t, pf_sources_z);
 #defineV_pf_sources_z  VNET(pf_sources_z)
-uma_zone_t pf_mtag_z;
+static VNET_DEFINE(uma_zone_t, pf_mtag_z);
+#defineV_pf_mtag_z VNET(pf_mtag_z)
 VNET_DEFINE(uma_zone_t, pf_state_z);
 VNET_DEFINE(uma_zone_t, pf_state_key_z);
 
@@ -512,7 +510,7 @@ pf_src_connlimit(struct pf_state **state
pfoe-rule = (*state)-rule.ptr;
pfoe-dir = (*state)-direction;
PF_OVERLOADQ_LOCK();
-   SLIST_INSERT_HEAD(V_pf_overloadqueue.head, pfoe, next);
+   SLIST_INSERT_HEAD(V_pf_overloadqueue, pfoe, next);
PF_OVERLOADQ_UNLOCK();
taskqueue_enqueue(taskqueue_swi, V_pf_overloadtask);
 
@@ -529,13 +527,11 @@ pf_overload_task(void *c, int pending)
 
PF_OVERLOADQ_LOCK();
queue = *(struct pf_overload_head *)c;
-   SLIST_INIT(((struct pf_overload_head *)c)-head);
+   SLIST_INIT((struct pf_overload_head *)c);
PF_OVERLOADQ_UNLOCK();
 
-   CURVNET_SET(queue.vnet);
-
bzero(p, sizeof(p));
-   SLIST_FOREACH(pfoe, queue.head, next) {
+   SLIST_FOREACH(pfoe, queue, next) {
V_pf_status.lcounters[LCNT_OVERLOAD_TABLE]++;
if (V_pf_status.debug = PF_DEBUG_MISC) {
printf(%s: blocking address , __func__);
@@ -567,18 +563,16 @@ pf_overload_task(void *c, int pending)
/*
 * Remove those entries, that don't need flushing.
 */
-   SLIST_FOREACH_SAFE(pfoe, queue.head, next, pfoe1)
+   SLIST_FOREACH_SAFE(pfoe, queue, next, pfoe1)
if (pfoe-rule-flush == 0) {
-   SLIST_REMOVE(queue.head, pfoe, pf_overload_entry, 
next);
+   SLIST_REMOVE(queue, pfoe, pf_overload_entry, next);
free(pfoe, M_PFTEMP);
} else
V_pf_status.lcounters[LCNT_OVERLOAD_FLUSH]++;
 
/* If nothing to flush, return. */
-   if (SLIST_EMPTY(queue.head)) {
-   CURVNET_RESTORE();
+   if (SLIST_EMPTY(queue))
return;
-   }
 
for (int i = 0; i = V_pf_hashmask; i++) {
struct pf_idhash *ih = V_pf_idhash[i];
@@ -588,7 +582,7 @@ pf_overload_task(void *c, int pending)
PF_HASHROW_LOCK(ih);
LIST_FOREACH(s, ih-states, entry) {
sk = s-key[PF_SK_WIRE];
-   SLIST_FOREACH(pfoe, queue.head, next)
+   SLIST_FOREACH(pfoe, queue, next)
if (sk-af == pfoe-af 
((pfoe-rule-flush  PF_FLUSH_GLOBAL) ||
pfoe-rule == s-rule.ptr) 
@@ -603,12 +597,10 @@ pf_overload_task(void *c, int pending)
}
PF_HASHROW_UNLOCK(ih);
}
-   SLIST_FOREACH_SAFE(pfoe, queue.head, next, pfoe1)
+   SLIST_FOREACH_SAFE(pfoe, queue, next, pfoe1)
free(pfoe, M_PFTEMP);
if (V_pf_status.debug = PF_DEBUG_MISC)
printf(%s: %u states killed, __func__, killed);
-
-   CURVNET_RESTORE();
 }
 
 /*
@@ -798,16 +790,14 @@ pf_initialize()
V_pf_altqs_inactive = V_pf_altqs[1];
 
/* Mbuf tags */
-   if (IS_DEFAULT_VNET(curvnet))
-   pf_mtag_z = uma_zcreate(pf mtags, sizeof(struct m_tag) +
-   sizeof(struct pf_mtag), NULL, NULL, pf_mtag_init, NULL,
-   UMA_ALIGN_PTR, 0);
+   V_pf_mtag_z = uma_zcreate(pf mtags, sizeof(struct m_tag) +
+   sizeof(struct pf_mtag), NULL, NULL, pf_mtag_init, NULL,
+   UMA_ALIGN_PTR, 0);
 
/* Send  overload+flush queues. */
STAILQ_INIT(V_pf_sendqueue);
-   SLIST_INIT(V_pf_overloadqueue.head);
+   SLIST_INIT(V_pf_overloadqueue);
TASK_INIT(V_pf_overloadtask, 0, pf_overload_task, V_pf_overloadqueue);
-   V_pf_overloadqueue.vnet = curvnet;
mtx_init(pf_sendqueue_mtx, pf send 

svn commit: r262224 - head/sys/boot

2014-02-19 Thread Robert Watson
Author: rwatson
Date: Wed Feb 19 17:44:59 2014
New Revision: 262224
URL: http://svnweb.freebsd.org/changeset/base/262224

Log:
  Do build boot-loader FDT code on MIPS.
  
  MFC after:3 weeks
  Sponsored by: DARPA, AFRL

Added:
  head/sys/boot/Makefile.mips   (contents, props changed)

Added: head/sys/boot/Makefile.mips
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/boot/Makefile.mips Wed Feb 19 17:44:59 2014(r262224)
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+.if ${MK_FDT} != no
+SUBDIR+=   fdt
+.endif
___
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: r262196 - head/sys/netpfil/pf

2014-02-19 Thread Mikolaj Golub
On Tue, Feb 18, 2014 at 10:17:12PM +, Martin Matuska wrote:
 Author: mm
 Date: Tue Feb 18 22:17:12 2014
 New Revision: 262196
 URL: http://svnweb.freebsd.org/changeset/base/262196
 
 Log:
   De-virtualize pf_mtag_z [1]
   Process V_pf_overloadqueue in vnet context [2]

Martin I saw you reverted it but it looks you are going to work on it
still, so one comment below.

...

 -SLIST_HEAD(pf_overload_head, pf_overload_entry);
 +struct pf_overload_head {
 + SLIST_HEAD(, pf_overload_entry) head;
 + struct vnet *vnet;
 +};
  static VNET_DEFINE(struct pf_overload_head, pf_overloadqueue);
  #define V_pf_overloadqueue   VNET(pf_overloadqueue)

...

 - SLIST_INIT(V_pf_overloadqueue);
 + SLIST_INIT(V_pf_overloadqueue.head);
   TASK_INIT(V_pf_overloadtask, 0, pf_overload_task, V_pf_overloadqueue);
 + V_pf_overloadqueue.vnet = curvnet;

Why not pass vnet as a context to pf_overload_task instead of
V_pf_overloadqueue? Then you would not need this hack with storing a
vnet inside a vnet variable.

-- 
Mikolaj Golub
___
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: r262196 - head/sys/netpfil/pf

2014-02-19 Thread Gleb Smirnoff
On Wed, Feb 19, 2014 at 08:49:01PM +0200, Mikolaj Golub wrote:
M  -SLIST_HEAD(pf_overload_head, pf_overload_entry);
M  +struct pf_overload_head {
M  +  SLIST_HEAD(, pf_overload_entry) head;
M  +  struct vnet *vnet;
M  +};
M   static VNET_DEFINE(struct pf_overload_head, pf_overloadqueue);
M   #define V_pf_overloadqueueVNET(pf_overloadqueue)
M 
M ...
M 
M  -  SLIST_INIT(V_pf_overloadqueue);
M  +  SLIST_INIT(V_pf_overloadqueue.head);
M TASK_INIT(V_pf_overloadtask, 0, pf_overload_task, V_pf_overloadqueue);
M  +  V_pf_overloadqueue.vnet = curvnet;
M 
M Why not pass vnet as a context to pf_overload_task instead of
M V_pf_overloadqueue? Then you would not need this hack with storing a
M vnet inside a vnet variable.

Yes, that would look much better.

The pf_overloadqueue can be made global after that. Its lock is
already global.

-- 
Totus tuus, Glebius.
___
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: r262233 - head/share/man/man4

2014-02-19 Thread Christian Brueffer
Author: brueffer
Date: Wed Feb 19 21:31:04 2014
New Revision: 262233
URL: http://svnweb.freebsd.org/changeset/base/262233

Log:
  Spelling, grammar and mdoc cleanup.
  
  MFC after:1 week

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

Modified: head/share/man/man4/gpio.4
==
--- head/share/man/man4/gpio.4  Wed Feb 19 19:47:08 2014(r262232)
+++ head/share/man/man4/gpio.4  Wed Feb 19 21:31:04 2014(r262233)
@@ -42,7 +42,7 @@ following lines in your kernel configura
 .Pp
 Additional device entries for the
 .Li ARM
-architecure include:
+architecture include:
 .Bd -ragged -offset indent
 .Cd device a10_gpio
 .Cd device bcm_gpio
@@ -58,7 +58,7 @@ architecure include:
 .Pp
 Additional device entries for the
 .Li MIPS
-architecure include:
+architecture include:
 .Bd -ragged -offset indent
 .Cd device ar71xxx_gpio
 .Cd device octeon_gpio
@@ -67,14 +67,14 @@ architecure include:
 .Pp
 Additional device entries for the
 .Li POWERPC
-architecure include:
+architecture include:
 .Bd -ragged -offset indent
 .Cd device wiigpio
 .Cd device macgpio
 .Ed
 .Sh DESCRIPTION
 The
-.Em gpiobus
+.Nm
 system provides a simple interface to the GPIO pins that are usually
 available on embedded architectures and can provide bit banging style
 devices to the system.
@@ -89,7 +89,7 @@ for input/output, IRQ delivery, SDA/SCL
 .Em iicbus
 use, etc.
 .Pp
-On some embedded architechtures (like MIPS), discovery of the bus and
+On some embedded architectures (like MIPS), discovery of the bus and
 configuration of the pins is done via
 .Xr device.hints 5
 in the platform's kernel
@@ -101,28 +101,30 @@ On some others (like ARM), where
 is used to describe the device tree, the bus discovery is done via the DTS
 passed to the kernel, being either statically compiled in, or by a variety
 of ways where the boot loader (or Open Firmware enabled system) passes the
-DTS blob to kernel at boot.
+DTS blob to the kernel at boot.
 .Pp
-The following are only provided by the
+The following
+.Xr device.hints 5
+are only provided by the
 .Cd ar71xx_gpio
-driver.
+driver:
 .Bl -tag -width .Va hint.gpioiic.%d.atXXX
 .It Va hint.gpio.%d.pinmask
-This is a bitmask of pins on the gpio board that we would like to expose
-for use to the host o/s.
+This is a bitmask of pins on the GPIO board that we would like to expose
+for use to the host operating system.
 To expose pin 0, 4 and 7, use the bitmask of
 10010001 converted to the hexadecimal value 0x0091.
 .It Va hint.gpio.%d.pinon
-This is a bitmask of pins on the gpio board that will be set to ON at host
+This is a bitmask of pins on the GPIO board that will be set to ON at host
 start.
 To set pin 2, 5 and 13 to be set ON at boot, use the bitmask of
 110010 converted to the hexadecimal value 0x2012.
 .It Va hint.gpio.function_set
 .It Va hint.gpio.function_clear
-These are a bitmask of pins that will remap a pin to handle a specific
+These are bitmasks of pins that will remap a pin to handle a specific
 function (USB, UART TX/RX, etc) in the Atheros function registers.
-This is mainly used to set/clear functions that we need when they are setup or
-not setup by uBoot.
+This is mainly used to set/clear functions that we need when they are set up or
+not set up by uBoot.
 .El
 .Pp
 Simply put, each pin of the GPIO interface is connected to an input/output
___
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: r262235 - head/sys/boot/mips

2014-02-19 Thread Robert Watson
Author: rwatson
Date: Wed Feb 19 23:09:25 2014
New Revision: 262235
URL: http://svnweb.freebsd.org/changeset/base/262235

Log:
  Temporarily unhook BERI boot loader from the build until 32-bit MIPS
  properly excludes building our 64-bit only boot-loader adaptation.

Modified:
  head/sys/boot/mips/Makefile

Modified: head/sys/boot/mips/Makefile
==
--- head/sys/boot/mips/Makefile Wed Feb 19 22:02:15 2014(r262234)
+++ head/sys/boot/mips/Makefile Wed Feb 19 23:09:25 2014(r262235)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 
+.if 0
 SUBDIR=beri
+.endif
 
 .include bsd.subdir.mk
___
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: r262236 - in head: sys/amd64/include sys/amd64/vmm sys/amd64/vmm/io usr.sbin/bhyve

2014-02-19 Thread Neel Natu
Author: neel
Date: Thu Feb 20 01:48:25 2014
New Revision: 262236
URL: http://svnweb.freebsd.org/changeset/base/262236

Log:
  Simplify APIC mode switching from MMIO to x2APIC. In part this is done to
  simplify the implementation of the x2APIC virtualization assist in VT-x.
  
  Prior to this change the vlapic allowed the guest to change its mode from
  xAPIC to x2APIC. We don't allow that any more and the vlapic mode is locked
  when the virtual machine is created. This is not very constraining because
  operating systems already have to deal with BIOS setting up the APIC in
  x2APIC mode at boot.
  
  Fix a bug in the CPUID emulation where the x2APIC capability was leaking
  from the host to the guest.
  
  Ignore MMIO reads and writes to the vlapic in x2APIC mode. Similarly, ignore
  MSR accesses to the vlapic when it is in xAPIC mode.
  
  The default configuration of the vlapic is xAPIC. The -x option to bhyve(8)
  can be used to change the mode to x2APIC instead.
  
  Discussed with:   grehan@

Modified:
  head/sys/amd64/include/vmm.h
  head/sys/amd64/vmm/io/vlapic.c
  head/sys/amd64/vmm/io/vlapic.h
  head/sys/amd64/vmm/vmm.c
  head/sys/amd64/vmm/vmm_lapic.c
  head/sys/amd64/vmm/x86.c
  head/usr.sbin/bhyve/bhyverun.c

Modified: head/sys/amd64/include/vmm.h
==
--- head/sys/amd64/include/vmm.hWed Feb 19 23:09:25 2014
(r262235)
+++ head/sys/amd64/include/vmm.hThu Feb 20 01:48:25 2014
(r262236)
@@ -265,9 +265,8 @@ enum vm_cap_type {
 };
 
 enum x2apic_state {
-   X2APIC_ENABLED,
-   X2APIC_AVAILABLE,
X2APIC_DISABLED,
+   X2APIC_ENABLED,
X2APIC_STATE_LAST
 };
 

Modified: head/sys/amd64/vmm/io/vlapic.c
==
--- head/sys/amd64/vmm/io/vlapic.c  Wed Feb 19 23:09:25 2014
(r262235)
+++ head/sys/amd64/vmm/io/vlapic.c  Thu Feb 20 01:48:25 2014
(r262236)
@@ -1119,12 +1119,31 @@ vlapic_svr_write_handler(struct vlapic *
 }
 
 int
-vlapic_read(struct vlapic *vlapic, uint64_t offset, uint64_t *data, bool *retu)
+vlapic_read(struct vlapic *vlapic, int mmio_access, uint64_t offset,
+uint64_t *data, bool *retu)
 {
struct LAPIC*lapic = vlapic-apic_page;
uint32_t*reg;
int  i;
 
+   /* Ignore MMIO accesses in x2APIC mode */
+   if (x2apic(vlapic)  mmio_access) {
+   VLAPIC_CTR1(vlapic, MMIO read from offset %#lx in x2APIC mode,
+   offset);
+   *data = 0;
+   goto done;
+   }
+
+   if (!x2apic(vlapic)  !mmio_access) {
+   /*
+* XXX Generate GP fault for MSR accesses in xAPIC mode
+*/
+   VLAPIC_CTR1(vlapic, x2APIC MSR read from offset %#lx in 
+   xAPIC mode, offset);
+   *data = 0;
+   goto done;
+   }
+
if (offset  sizeof(*lapic)) {
*data = 0;
goto done;
@@ -1221,7 +1240,8 @@ done:
 }
 
 int
-vlapic_write(struct vlapic *vlapic, uint64_t offset, uint64_t data, bool *retu)
+vlapic_write(struct vlapic *vlapic, int mmio_access, uint64_t offset,
+uint64_t data, bool *retu)
 {
struct LAPIC*lapic = vlapic-apic_page;
uint32_t*regptr;
@@ -1230,10 +1250,26 @@ vlapic_write(struct vlapic *vlapic, uint
KASSERT((offset  0xf) == 0  offset  PAGE_SIZE,
(vlapic_write: invalid offset %#lx, offset));
 
-   VLAPIC_CTR2(vlapic, vlapic write offset %#x, data %#lx, offset, data);
+   VLAPIC_CTR2(vlapic, vlapic write offset %#lx, data %#lx,
+   offset, data);
 
-   if (offset  sizeof(*lapic)) {
-   return 0;
+   if (offset  sizeof(*lapic))
+   return (0);
+
+   /* Ignore MMIO accesses in x2APIC mode */
+   if (x2apic(vlapic)  mmio_access) {
+   VLAPIC_CTR2(vlapic, MMIO write of %#lx to offset %#lx 
+   in x2APIC mode, data, offset);
+   return (0);
+   }
+
+   /*
+* XXX Generate GP fault for MSR accesses in xAPIC mode
+*/
+   if (!x2apic(vlapic)  !mmio_access) {
+   VLAPIC_CTR2(vlapic, x2APIC MSR write of %#lx to offset %#lx 
+   in xAPIC mode, data, offset);
+   return (0);
}
 
retval = 0;
@@ -1380,50 +1416,47 @@ vlapic_get_apicbase(struct vlapic *vlapi
return (vlapic-msr_apicbase);
 }
 
-void
+int
 vlapic_set_apicbase(struct vlapic *vlapic, uint64_t new)
 {
-   struct LAPIC *lapic;
-   enum x2apic_state state;
-   uint64_t old;
-   int err;
-
-   err = vm_get_x2apic_state(vlapic-vm, vlapic-vcpuid, state);
-   if (err)
-   panic(vlapic_set_apicbase: err %d fetching x2apic state, err);
-
-   if (state == X2APIC_DISABLED)
-   new = ~APICBASE_X2APIC;
-
-   old = 

svn commit: r262238 - head/sys/dev/netmap

2014-02-19 Thread Luigi Rizzo
Author: luigi
Date: Thu Feb 20 04:56:55 2014
New Revision: 262238
URL: http://svnweb.freebsd.org/changeset/base/262238

Log:
  compile with NOINET

Modified:
  head/sys/dev/netmap/netmap_freebsd.c

Modified: head/sys/dev/netmap/netmap_freebsd.c
==
--- head/sys/dev/netmap/netmap_freebsd.cThu Feb 20 04:50:13 2014
(r262237)
+++ head/sys/dev/netmap/netmap_freebsd.cThu Feb 20 04:56:55 2014
(r262238)
@@ -101,6 +101,7 @@ uint16_t nm_csum_ipv4(struct nm_iphdr *i
 void nm_csum_tcpudp_ipv4(struct nm_iphdr *iph, void *data,
size_t datalen, uint16_t *check)
 {
+#ifdef INET
uint16_t pseudolen = datalen + iph-protocol;
 
/* Compute and insert the pseudo-header cheksum. */
@@ -110,6 +111,13 @@ void nm_csum_tcpudp_ipv4(struct nm_iphdr
 * (includes the pseudo-header).
 */
*check = nm_csum_fold(nm_csum_raw(data, datalen, 0));
+#else
+   static int notsupported = 0;
+   if (!notsupported) {
+   notsupported = 1;
+   D(inet4 segmentation not supported);
+   }
+#endif
 }
 
 void nm_csum_tcpudp_ipv6(struct nm_ipv6hdr *ip6h, void *data,
___
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