svn commit: r265085 - head/usr.sbin/pmcstat

2014-04-29 Thread Scott Long
Author: scottl
Date: Tue Apr 29 07:17:33 2014
New Revision: 265085
URL: http://svnweb.freebsd.org/changeset/base/265085

Log:
  Document the -a option that was added in r262424.
  
  Obtained from:Netflix, Inc.
  MFC after:3 days

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

Modified: head/usr.sbin/pmcstat/pmcstat.8
==
--- head/usr.sbin/pmcstat/pmcstat.8 Tue Apr 29 06:18:06 2014
(r265084)
+++ head/usr.sbin/pmcstat/pmcstat.8 Tue Apr 29 07:17:33 2014
(r265085)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 19, 2008
+.Dd April 29, 2014
 .Dt PMCSTAT 8
 .Os
 .Sh NAME
@@ -46,6 +46,7 @@
 .Op Fl S Ar event-spec
 .Op Fl T
 .Op Fl W
+.Op Fl a Ar pathname
 .Op Fl c Ar cpu-spec
 .Op Fl d
 .Op Fl f Ar pluginopt
@@ -221,6 +222,21 @@ This is an experimental feature intended
 dynamic behaviour of processes in the system.
 It may incur substantial overhead if enabled.
 The default is for this feature to be disabled.
+.It Fl a Ar pathname
+Perform a symbol and file:line lookup for each address in each
+callgraph and save the output to
+.Ar pathname .
+Unlike
+.Fl m
+that only resolves the first symbol in the graph, this resolves
+every node in the callgraph, or prints out addresses if no
+lookup information is available.
+This option requires the
+.Fl R
+option to read in samples that were previously collected and
+saved with the 
+.Fl o
+option.
 .It Fl c Ar cpu-spec
 Set the cpus for subsequent system mode PMCs specified on the
 command line to
___
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: r265086 - head/usr.sbin/pmcstat

2014-04-29 Thread Scott Long
Author: scottl
Date: Tue Apr 29 07:19:22 2014
New Revision: 265086
URL: http://svnweb.freebsd.org/changeset/base/265086

Log:
  Fix formatting of the -a option in usage() to be consistent.
  
  Obtained from:Netflix, Inc.
  MFC after:3 days

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

Modified: head/usr.sbin/pmcstat/pmcstat.c
==
--- head/usr.sbin/pmcstat/pmcstat.c Tue Apr 29 07:17:33 2014
(r265085)
+++ head/usr.sbin/pmcstat/pmcstat.c Tue Apr 29 07:19:22 2014
(r265086)
@@ -503,7 +503,7 @@ pmcstat_show_usage(void)
"\t -S spec\t allocate a system-wide sampling PMC\n"
"\t -T\t\t start in top mode\n"
"\t -W\t\t (toggle) show counts per context switch\n"
-   "\t -a \t print sampled PCs and callgraph to \"file\"\n"
+   "\t -a file\t print sampled PCs and callgraph to \"file\"\n"
"\t -c cpu-list\t set cpus for subsequent system-wide PMCs\n"
"\t -d\t\t (toggle) track descendants\n"
"\t -f spec\t pass \"spec\" to as plugin option\n"
___
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: r265088 - head/share/man/man4

2014-04-29 Thread Christian Brueffer
Author: brueffer
Date: Tue Apr 29 07:45:21 2014
New Revision: 265088
URL: http://svnweb.freebsd.org/changeset/base/265088

Log:
  Add standard SYNOPSIS wording, fix typos, contractions and new sentence -> 
new line.

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

Modified: head/share/man/man4/proto.4
==
--- head/share/man/man4/proto.4 Tue Apr 29 07:29:13 2014(r265087)
+++ head/share/man/man4/proto.4 Tue Apr 29 07:45:21 2014(r265088)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 21, 2014
+.Dd April 29, 2014
 .Dt PROTO 4
 .Os
 .\"
@@ -34,7 +34,19 @@
 .Nd Driver for prototyping and H/W diagnostics
 .\"
 .Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following line in your
+kernel configuration file:
+.Bd -ragged -offset indent
 .Cd "device proto"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+proto_load="YES"
+.Ed
 .\"
 .Sh DESCRIPTION
 The
@@ -43,7 +55,7 @@ device driver attaches to PCI devices wh
 present and creates device special files for all resources associated
 with the device.
 The driver itself has no knowledge of the device it attaches to.
-Programs can open these device special files and peform register-level
+Programs can open these device special files and perform register-level
 reads and writes.
 As such, the
 .Nm
@@ -51,7 +63,7 @@ device driver is nothing but a conduit o
 programs and the hardware device.
 .Pp
 Examples for why this is useful include hardware diagnostics and prototyping.
-In both these use cases, it's far more convenient to develop and run the
+In both these use cases, it is far more convenient to develop and run the
 logic in user space.
 Especially hardware diagnostics requires a somewhat user-friendly interface
 and adequate reporting.
@@ -108,8 +120,9 @@ Since interrupts cannot be handled by th
 into signals and delivered to the program that has registered for interrupts.
 .Pp
 In order to test the transmission or reception of data, some means of doing
-direct memory access (DMA) by the device must be possible. This too much be
-under the control of the program. The details of how a program can setup and
+direct memory access (DMA) by the device must be possible.
+This too must be under the control of the program.
+The details of how a program can set up and
 initiate DMA still need to be fleshed out.
 .Pp
 Support for non-PCI devices has not been implemented yet.
___
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: r265089 - head/sys/mips/beri

2014-04-29 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Apr 29 07:48:07 2014
New Revision: 265089
URL: http://svnweb.freebsd.org/changeset/base/265089

Log:
  After r264897 restore the ability to add bootoptions from FDT for
  platforms which do not use loaders or kernels that want to hardcode
  options or for FDT passed in by loader.
  
  Also fix a build issue by putting the kmdp variable accessed back under
  the #ifdef FDT;  we may wish to revisit decision in which case more
  code needs changing.
  
  Submitted by: brooks

Modified:
  head/sys/mips/beri/beri_machdep.c

Modified: head/sys/mips/beri/beri_machdep.c
==
--- head/sys/mips/beri/beri_machdep.c   Tue Apr 29 07:45:21 2014
(r265088)
+++ head/sys/mips/beri/beri_machdep.c   Tue Apr 29 07:48:07 2014
(r265089)
@@ -132,6 +132,46 @@ platform_reset(void)
__asm__ __volatile("wait");
 }
 
+#ifdef FDT
+/* Parse cmd line args as env - copied from xlp_machdep. */
+/* XXX-BZ this should really be centrally provided for all (boot) code. */
+static void
+_parse_bootargs(char *cmdline)
+{
+   char *n, *v;
+
+   while ((v = strsep(&cmdline, " \n")) != NULL) {
+   if (*v == '\0')
+   continue;
+   if (*v == '-') {
+   while (*v != '\0') {
+   v++;
+   switch (*v) {
+   case 'a': boothowto |= RB_ASKNAME; break;
+   /* Someone should simulate that ;-) */
+   case 'C': boothowto |= RB_CDROM; break;
+   case 'd': boothowto |= RB_KDB; break;
+   case 'D': boothowto |= RB_MULTIPLE; break;
+   case 'm': boothowto |= RB_MUTE; break;
+   case 'g': boothowto |= RB_GDB; break;
+   case 'h': boothowto |= RB_SERIAL; break;
+   case 'p': boothowto |= RB_PAUSE; break;
+   case 'r': boothowto |= RB_DFLTROOT; break;
+   case 's': boothowto |= RB_SINGLE; break;
+   case 'v': boothowto |= RB_VERBOSE; break;
+   }
+   }
+   } else {
+   n = strsep(&v, "=");
+   if (v == NULL)
+   setenv(n, "1");
+   else
+   setenv(n, v);
+   }
+   }
+}
+#endif
+
 void
 platform_start(__register_t a0, __register_t a1,  __register_t a2, 
 __register_t a3)
@@ -144,7 +184,9 @@ platform_start(__register_t a0, __regist
char **envp = (char **)a2;
long memsize;
 #ifdef FDT
+   char buf[2048]; /* early stack supposedly big enough */
vm_offset_t dtbp;
+   phandle_t chosen;
void *kmdp;
 #endif
int i;
@@ -201,7 +243,6 @@ platform_start(__register_t a0, __regist
while (1);
if (OF_init((void *)dtbp) != 0)
while (1);
-#endif
 
/*
 * Configure more boot-time parameters passed in by loader.
@@ -210,6 +251,14 @@ platform_start(__register_t a0, __regist
kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *);
 
/*
+* Get bootargs from FDT if specified.
+*/
+   chosen = OF_finddevice("/chosen");
+   if (OF_getprop(chosen, "bootargs", buf, sizeof(buf)) != -1)
+   _parse_bootargs(buf);
+#endif
+
+   /*
 * XXXRW: We have no way to compare wallclock time to cycle rate on
 * BERI, so for now assume we run at the MALTA default (100MHz).
 */
___
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: r259638 - head/usr.bin/netstat

2014-04-29 Thread Olivier Cochard-Labbé
On Fri, Dec 20, 2013 at 1:17 AM, Alexander V. Chernikov <
melif...@freebsd.org> wrote:

> Author: melifaro
> Date: Fri Dec 20 00:17:26 2013
> New Revision: 259638
> URL: http://svnweb.freebsd.org/changeset/base/259638
>
> Log:
>   Use more fine-grained kvm(3) symbol lookup: routing code retrieves only
>   necessary symbols needed per subsystem. Main kvm(3) init is now delayed
>   as much as possbile. This finally fixes performance issues reported in
>   kern/167204.
>   Some non-working code (ng_socket.ko symbol addresses calculation)
> removed.
>   Some global variables eliminated.
>
>   PR:   kern/167204
>   MFC after:4 weeks
>
>
Hi Alexander,

"netstat -gW" no more correctly detect inet4 MROUTING after this commit
(that was MFC to stable).

Behavior of my MROUTING enabled system before your commit:

-
[root@router]~# uname -a
FreeBSD router.bsdrp.net 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r259635: Tue
Apr 29 09:08:10 CEST 2014
r...@orange.bsdrp.net:/usr/obj/TESTING.amd64/usr/local/BSDRP/TESTING/FreeBSD/src/sys/amd64
amd64
[root@router]~# sysctl kern.conftxt | grep MROUTING
options MROUTING
[root@router]~# netstat -gW

IPv4 Virtual Interface Table is empty

IPv4 Multicast Forwarding Table is empty


IPv6 Multicast Interface Table is empty

IPv6 Multicast Forwarding Table is empty
-

And the new behavior after your commit:

-
[root@router]~# uname -a
FreeBSD router.bsdrp.net 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r259638: Mon
Apr 28 20:58:06 CEST 2014
r...@orange.bsdrp.net:/usr/obj/TESTING.amd64/usr/local/BSDRP/TESTING/FreeBSD/src/sys/amd64
amd64
[root@router]~# sysctl kern.conftxt | grep MROUTING
options MROUTING
[root@router]~# netstat -gW
No IPv4 MROUTING kernel support.

IPv6 Multicast Interface Table is empty

IPv6 Multicast Forwarding Table is empty
-

Regards,

Olivier
___
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: r265090 - head/contrib/libstdc++/include/bits

2014-04-29 Thread Marius Strobl
Author: marius
Date: Tue Apr 29 11:31:22 2014
New Revision: 265090
URL: http://svnweb.freebsd.org/changeset/base/265090

Log:
  Merge r133175 from upstream:
  
  2008-03-13  Dennis Czeremin  
  
PR libstdc++/35566
* include/bits/stl_multimap.h (multimap<>::multimap(_InputIterator,
_InputIterator)): Forward to _M_insert_equal, not _M_insert_unique.
  
  This patch was GPL2 at the time and fixes a regression introduced with
  the merge of GCC r129013 in FreeBSD r236829.
  
  MFC after:3 days
  Sponsored by: Bally Wulff Games & Entertainment GmbH

Modified:
  head/contrib/libstdc++/include/bits/stl_multimap.h

Modified: head/contrib/libstdc++/include/bits/stl_multimap.h
==
--- head/contrib/libstdc++/include/bits/stl_multimap.h  Tue Apr 29 07:48:07 
2014(r265089)
+++ head/contrib/libstdc++/include/bits/stl_multimap.h  Tue Apr 29 11:31:22 
2014(r265090)
@@ -185,7 +185,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL
   template 
 multimap(_InputIterator __first, _InputIterator __last)
: _M_t()
-{ _M_t._M_insert_unique(__first, __last); }
+{ _M_t._M_insert_equal(__first, __last); }
 
   /**
*  @brief  Builds a %multimap from a range.
___
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: r265091 - head/sys/net

2014-04-29 Thread Alexander V. Chernikov
Author: melifaro
Date: Tue Apr 29 12:52:36 2014
New Revision: 265091
URL: http://svnweb.freebsd.org/changeset/base/265091

Log:
  Do not use senderr() in rtrequest1_fib_change().
  
  Suggested by: glebius
  MFC after:4 weeks

Modified:
  head/sys/net/route.c

Modified: head/sys/net/route.c
==
--- head/sys/net/route.cTue Apr 29 11:31:22 2014(r265090)
+++ head/sys/net/route.cTue Apr 29 12:52:36 2014(r265091)
@@ -1431,7 +1431,6 @@ bad:
 #undef ifpaddr
 #undef flags
 
-#definesenderr(e) { error = e; goto bad; }
 static int
 rtrequest1_fib_change(struct radix_node_head *rnh, struct rt_addrinfo *info,
 struct rtentry **ret_nrt, u_int fibnum)
@@ -1476,7 +1475,7 @@ rtrequest1_fib_change(struct radix_node_
free_ifa = 1;
 
if (error != 0)
-   senderr(error);
+   goto bad;
}
 
/* Check if outgoing interface has changed */
@@ -1489,7 +1488,7 @@ rtrequest1_fib_change(struct radix_node_
if (info->rti_info[RTAX_GATEWAY] != NULL) {
error = rt_setgate(rt, rt_key(rt), 
info->rti_info[RTAX_GATEWAY]);
if (error != 0)
-   senderr(error);
+   goto bad;
 
rt->rt_flags &= ~RTF_GATEWAY;
rt->rt_flags |= (RTF_GATEWAY & info->rti_flags);
@@ -1517,8 +1516,6 @@ bad:
ifa_free(info->rti_ifa);
return (error);
 }
-#undef senderr
-
 
 int
 rt_setgate(struct rtentry *rt, struct sockaddr *dst, struct sockaddr *gate)
___
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: r264986 - head/sys/net

2014-04-29 Thread Alexander V. Chernikov

On 28.04.2014 12:59, Gleb Smirnoff wrote:

On Sat, Apr 26, 2014 at 09:03:41PM +, Alexander V. Chernikov wrote:
A> @@ -1425,6 +1431,95 @@ bad:
A>  #undef ifpaddr
A>  #undef flags
A>
A> +#define  senderr(e) { error = e; goto bad; }

...

A> + if (error != 0)
A> + senderr(error);

This resolves to "error = error". Surprised that compiler is silent.

Can this line and others like it be replaced with?

Yup. done in r265091.

if (error)
goto bad;



___
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: r265092 - in head: sys/netinet tests/sys/netinet

2014-04-29 Thread Alan Somers
Author: asomers
Date: Tue Apr 29 14:46:45 2014
New Revision: 265092
URL: http://svnweb.freebsd.org/changeset/base/265092

Log:
  Fix a panic when removing an IP address from an interface, if the same address
  exists on another interface.  The panic was introduced by change 264887, which
  changed the fibnum parameter in the call to rtalloc1_fib() in
  ifa_switch_loopback_route() from RT_DEFAULT_FIB to RT_ALL_FIBS.  The solution
  is to use the interface fib in that call.  For the majority of users, that 
will
  be equivalent to the legacy behavior.
  
  PR:   kern/189089
  Reported by:  neel
  Reviewed by:  neel
  MFC after:3 weeks
  X-MFC with:   264887
  Sponsored by: Spectra Logic

Modified:
  head/sys/netinet/in.c
  head/tests/sys/netinet/fibs_test.sh

Modified: head/sys/netinet/in.c
==
--- head/sys/netinet/in.c   Tue Apr 29 12:52:36 2014(r265091)
+++ head/sys/netinet/in.c   Tue Apr 29 14:46:45 2014(r265092)
@@ -696,11 +696,9 @@ in_scrubprefix(struct in_ifaddr *target,
 {
struct in_ifaddr *ia;
struct in_addr prefix, mask, p, m;
-   int error = 0, fibnum;
+   int error = 0;
struct sockaddr_in prefix0, mask0;
 
-   fibnum = rt_add_addr_allfibs ? RT_ALL_FIBS : target->ia_ifp->if_fib;
-
/*
 * Remove the loopback route to the interface address.
 */
@@ -712,6 +710,8 @@ in_scrubprefix(struct in_ifaddr *target,
eia = in_localip_more(target);
 
if (eia != NULL) {
+   int fibnum = target->ia_ifp->if_fib;
+
error = ifa_switch_loopback_route((struct ifaddr *)eia,
(struct sockaddr *)&target->ia_addr, fibnum);
ifa_free(&eia->ia_ifa);
@@ -736,6 +736,10 @@ in_scrubprefix(struct in_ifaddr *target,
}
 
if ((target->ia_flags & IFA_ROUTE) == 0) {
+   int fibnum;
+   
+   fibnum = rt_add_addr_allfibs ? RT_ALL_FIBS :
+   target->ia_ifp->if_fib;
rt_addrmsg(RTM_DELETE, &target->ia_ifa, fibnum);
return (0);
}

Modified: head/tests/sys/netinet/fibs_test.sh
==
--- head/tests/sys/netinet/fibs_test.sh Tue Apr 29 12:52:36 2014
(r265091)
+++ head/tests/sys/netinet/fibs_test.sh Tue Apr 29 14:46:45 2014
(r265092)
@@ -213,6 +213,45 @@ default_route_with_multiple_fibs_on_same
 }
 
 
+# Regression test for PR kern/189089
+# Create two tap interfaces and assign them both the same IP address but with
+# different netmasks, and both on the default FIB.  Then remove one's IP
+# address.  Hopefully the machine won't panic.
+atf_test_case same_ip_multiple_ifaces_fib0 cleanup
+same_ip_multiple_ifaces_fib0_head()
+{
+   atf_set "descr" "Can remove an IP alias from an interface when the same 
IP is also assigned to another interface."
+   atf_set "require.user" "root"
+   atf_set "require.config" "fibs"
+}
+same_ip_multiple_ifaces_fib0_body()
+{
+   ADDR="192.0.2.2"
+   MASK0="24"
+   MASK1="32"
+
+   # Unlike most of the tests in this file, this is applicable regardless
+   # of net.add_addr_allfibs
+
+   # Setup the interfaces, then remove one alias.  It should not panic.
+   setup_tap 0 ${ADDR} ${MASK0}
+   TAP0=${TAP}
+   setup_tap 0 ${ADDR} ${MASK1}
+   TAP1=${TAP}
+   ifconfig ${TAP1} -alias ${ADDR}
+
+   # Do it again, in the opposite order.  It should not panic.
+   setup_tap 0 ${ADDR} ${MASK0}
+   TAP0=${TAP}
+   setup_tap 0 ${ADDR} ${MASK1}
+   TAP1=${TAP}
+   ifconfig ${TAP0} -alias ${ADDR}
+}
+same_ip_multiple_ifaces_fib0_cleanup()
+{
+   cleanup_tap
+}
+
 # Regression test for kern/187550
 atf_test_case subnet_route_with_multiple_fibs_on_same_subnet cleanup
 subnet_route_with_multiple_fibs_on_same_subnet_head()
@@ -309,6 +348,7 @@ atf_init_test_cases()
atf_add_test_case arpresolve_checks_interface_fib
atf_add_test_case loopback_and_network_routes_on_nondefault_fib
atf_add_test_case default_route_with_multiple_fibs_on_same_subnet
+   atf_add_test_case same_ip_multiple_ifaces_fib0
atf_add_test_case subnet_route_with_multiple_fibs_on_same_subnet
atf_add_test_case udp_dontroute
 }
___
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: r265093 - head/share/mk

2014-04-29 Thread Warner Losh
Author: imp
Date: Tue Apr 29 14:52:39 2014
New Revision: 265093
URL: http://svnweb.freebsd.org/changeset/base/265093

Log:
  NLS is used by the build system.

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

Modified: head/share/mk/bsd.opts.mk
==
--- head/share/mk/bsd.opts.mk   Tue Apr 29 14:46:45 2014(r265092)
+++ head/share/mk/bsd.opts.mk   Tue Apr 29 14:52:39 2014(r265093)
@@ -56,6 +56,7 @@ __DEFAULT_YES_OPTIONS = \
 MAN \
 MANCOMPRESS \
 NIS \
+NLS \
 OPENSSH \
 PROFILE \
 SSP \
@@ -149,7 +150,6 @@ __DEFAULT_YES_OPTIONS = \
 NDIS \
 NETCAT \
 NETGRAPH \
-NLS \
 NLS_CATALOGS \
 NS_CACHING \
 NTP \
___
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: r265094 - head/tests/sys/netinet

2014-04-29 Thread Alan Somers
Author: asomers
Date: Tue Apr 29 15:12:23 2014
New Revision: 265094
URL: http://svnweb.freebsd.org/changeset/base/265094

Log:
  Add regression test for PR kern/189088.
  
  PR:   kern/189088
  MFC after:3 weeks
  Sponsored by: Spectra Logic

Modified:
  head/tests/sys/netinet/fibs_test.sh

Modified: head/tests/sys/netinet/fibs_test.sh
==
--- head/tests/sys/netinet/fibs_test.sh Tue Apr 29 14:52:39 2014
(r265093)
+++ head/tests/sys/netinet/fibs_test.sh Tue Apr 29 15:12:23 2014
(r265094)
@@ -252,6 +252,59 @@ same_ip_multiple_ifaces_fib0_cleanup()
cleanup_tap
 }
 
+# Regression test for PR kern/189088
+# Test that removing an IP address works even if the same IP is assigned to a
+# different interface, on a different FIB.  Tests the same code that whose
+# panic was regressed by same_ip_multiple_ifaces_fib0.  
+# Create two tap interfaces and assign them both the same IP address but with
+# different netmasks, and on different FIBs.  Then remove one's IP
+# address.  Hopefully the machine won't panic.  Also, the IP's hostroute should
+# dissappear from the correct fib.
+atf_test_case same_ip_multiple_ifaces cleanup
+same_ip_multiple_ifaces_head()
+{
+   atf_set "descr" "Can remove an IP alias from an interface when the same 
IP is also assigned to another interface, on non-default FIBs."
+   atf_set "require.user" "root"
+   atf_set "require.config" "fibs"
+}
+same_ip_multiple_ifaces_body()
+{
+   atf_expect_fail "kern/189088 Assigning the same IP to multiple 
interfaces in different FIBs creates a host route for only one"
+   ADDR="192.0.2.2"
+   MASK0="24"
+   MASK1="32"
+
+   # Unlike most of the tests in this file, this is applicable regardless
+   # of net.add_addr_allfibs
+   get_fibs 2
+
+   # Setup the interfaces, then remove one alias.  It should not panic.
+   setup_tap ${FIB0} ${ADDR} ${MASK0}
+   TAP0=${TAP}
+   setup_tap ${FIB1} ${ADDR} ${MASK1}
+   TAP1=${TAP}
+   ifconfig ${TAP1} -alias ${ADDR}
+   atf_check -o not-match:"^${ADDR}[[:space:]]" \
+   setfib ${FIB1} netstat -rn -f inet
+
+   # Do it again, in the opposite order.  It should not panic.
+   setup_tap ${FIB0} ${ADDR} ${MASK0}
+   TAP0=${TAP}
+   setup_tap ${FIB1} ${ADDR} ${MASK1}
+   TAP1=${TAP}
+   ifconfig ${TAP0} -alias ${ADDR}
+   atf_check -o not-match:"^${ADDR}[[:space:]]" \
+   setfib ${FIB0} netstat -rn -f inet
+}
+same_ip_multiple_ifaces_cleanup()
+{
+   # Due to PR kern/189088, we must destroy the interfaces in LIFO order
+   # in order for the routes to be correctly cleaned up.
+   for TAPD in `tail -r "tap_devices_to_cleanup"`; do
+   ifconfig ${TAPD} destroy
+   done
+}
+
 # Regression test for kern/187550
 atf_test_case subnet_route_with_multiple_fibs_on_same_subnet cleanup
 subnet_route_with_multiple_fibs_on_same_subnet_head()
@@ -349,6 +402,7 @@ atf_init_test_cases()
atf_add_test_case loopback_and_network_routes_on_nondefault_fib
atf_add_test_case default_route_with_multiple_fibs_on_same_subnet
atf_add_test_case same_ip_multiple_ifaces_fib0
+   atf_add_test_case same_ip_multiple_ifaces
atf_add_test_case subnet_route_with_multiple_fibs_on_same_subnet
atf_add_test_case udp_dontroute
 }
___
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: r265095 - head/lib/libc/locale

2014-04-29 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Apr 29 15:25:57 2014
New Revision: 265095
URL: http://svnweb.freebsd.org/changeset/base/265095

Log:
  citrus: Avoid invalid code points.
  
  From the OpenBSD log:
  The UTF-8 decoder should not accept byte sequences which decode to unicode
  code positions U+D800 to U+DFFF (UTF-16 surrogates), U+FFFE, and U+.
  
  http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
  http://unicode.org/faq/utf_bom.html#utf8-4
  
  Reported by:  Stefan Sperling
  Obtained from:OpenBSD
  MFC after:5 days

Modified:
  head/lib/libc/locale/utf8.c

Modified: head/lib/libc/locale/utf8.c
==
--- head/lib/libc/locale/utf8.c Tue Apr 29 15:12:23 2014(r265094)
+++ head/lib/libc/locale/utf8.c Tue Apr 29 15:25:57 2014(r265095)
@@ -203,6 +203,14 @@ _UTF8_mbrtowc(wchar_t * __restrict pwc, 
errno = EILSEQ;
return ((size_t)-1);
}
+   if ((wch >= 0xd800 && wch <= 0xdfff) ||
+   wch == 0xfffe || wch == 0x) {
+   /*
+* Malformed input; invalid code points.
+*/
+   errno = EILSEQ;
+   return ((size_t)-1);
+   }
if (pwc != NULL)
*pwc = wch;
us->want = 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"


svn commit: r265096 - head/usr.bin/netstat

2014-04-29 Thread Alexander V. Chernikov
Author: melifaro
Date: Tue Apr 29 16:51:28 2014
New Revision: 265096
URL: http://svnweb.freebsd.org/changeset/base/265096

Log:
  Fix "netstat -gW" behavior broken in r259638.
  netstat has two options for printing multicast tables:
  sysctl (the default one for live systems) and kvm-based one (for cores).
  It looks like kvm-based one hasn't been working since it's been introduced
  in r190012 due to absence of mfctablesize kernel symbol.
  Check for all ipv4-multicast symbols being correctly resolved was introduced
  in r259638 regardless of 'live' value leading to "No IPv4 MROUTING" error
  message.
  
  Reported by:  Olivier Cochard-Labbé
  MFC after:1 week

Modified:
  head/usr.bin/netstat/mroute.c

Modified: head/usr.bin/netstat/mroute.c
==
--- head/usr.bin/netstat/mroute.c   Tue Apr 29 15:25:57 2014
(r265095)
+++ head/usr.bin/netstat/mroute.c   Tue Apr 29 16:51:28 2014
(r265096)
@@ -236,16 +236,7 @@ mroutepr()
 * functionality was deprecated, as PIM does not use it.
 */
maxvif = 0;
-
-   kresolve_list(mrl);
-   pmfchashtbl = mrl[N_MFCHASHTBL].n_value;
-   pmfctablesize = mrl[N_MFCTABLESIZE].n_value;
-   pviftbl = mrl[N_VIFTABLE].n_value;
-
-   if (pmfchashtbl == 0 || pmfctablesize == 0 || pviftbl == 0) {
-   fprintf(stderr, "No IPv4 MROUTING kernel support.\n");
-   return;
-   }
+   pmfchashtbl = pmfctablesize = pviftbl = 0;
 
len = sizeof(viftable);
if (live) {
@@ -254,8 +245,19 @@ mroutepr()
warn("sysctl: net.inet.ip.viftable");
return;
}
-   } else
+   } else {
+   kresolve_list(mrl);
+   pmfchashtbl = mrl[N_MFCHASHTBL].n_value;
+   pmfctablesize = mrl[N_MFCTABLESIZE].n_value;
+   pviftbl = mrl[N_VIFTABLE].n_value;
+
+   if (pmfchashtbl == 0 || pmfctablesize == 0 || pviftbl == 0) {
+   fprintf(stderr, "No IPv4 MROUTING kernel support.\n");
+   return;
+   }
+
kread(pviftbl, (char *)viftable, sizeof(viftable));
+   }
 
banner_printed = 0;
for (vifi = 0, v = viftable; vifi < MAXVIFS; ++vifi, ++v) {
___
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: r259638 - head/usr.bin/netstat

2014-04-29 Thread Alexander V. Chernikov

On 29.04.2014 12:35, Olivier Cochard-Labbé wrote:
On Fri, Dec 20, 2013 at 1:17 AM, Alexander V. Chernikov 
mailto:melif...@freebsd.org>> wrote:


Author: melifaro
Date: Fri Dec 20 00:17:26 2013
New Revision: 259638
URL: http://svnweb.freebsd.org/changeset/base/259638

Log:
  Use more fine-grained kvm(3) symbol lookup: routing code
retrieves only
  necessary symbols needed per subsystem. Main kvm(3) init is now
delayed
  as much as possbile. This finally fixes performance issues
reported in
  kern/167204.
  Some non-working code (ng_socket.ko symbol addresses
calculation) removed.
  Some global variables eliminated.

  PR:   kern/167204
  MFC after:4 weeks


Hi Alexander,

"netstat -gW" no more correctly detect inet4 MROUTING after this 
commit (that was MFC to stable).


Behavior of my MROUTING enabled system before your commit:

Whoops. Fixed in r265096, thank you!


-
[root@router]~# uname -a
FreeBSD router.bsdrp.net  11.0-CURRENT 
FreeBSD 11.0-CURRENT #0 r259635: Tue Apr 29 09:08:10 CEST 2014 
r...@orange.bsdrp.net:/usr/obj/TESTING.amd64/usr/local/BSDRP/TESTING/FreeBSD/src/sys/amd64 
amd64

[root@router]~# sysctl kern.conftxt | grep MROUTING
options MROUTING
[root@router]~# netstat -gW

IPv4 Virtual Interface Table is empty

IPv4 Multicast Forwarding Table is empty


IPv6 Multicast Interface Table is empty

IPv6 Multicast Forwarding Table is empty
-

And the new behavior after your commit:

-
[root@router]~# uname -a
FreeBSD router.bsdrp.net  11.0-CURRENT 
FreeBSD 11.0-CURRENT #0 r259638: Mon Apr 28 20:58:06 CEST 2014 
r...@orange.bsdrp.net:/usr/obj/TESTING.amd64/usr/local/BSDRP/TESTING/FreeBSD/src/sys/amd64 
amd64

[root@router]~# sysctl kern.conftxt | grep MROUTING
options MROUTING
[root@router]~# netstat -gW
No IPv4 MROUTING kernel support.

IPv6 Multicast Interface Table is empty

IPv6 Multicast Forwarding Table is empty
-

Regards,

Olivier



___
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: r265097 - head

2014-04-29 Thread Brooks Davis
Author: brooks
Date: Tue Apr 29 16:57:25 2014
New Revision: 265097
URL: http://svnweb.freebsd.org/changeset/base/265097

Log:
  Merge from CheriBSD:
  
  commit 1d1b908107255ffdff4d17f015d8f057d73cc6cb
  Author: Brooks Davis 
  Date:   Fri Mar 28 16:24:45 2014 +
  
  Add a long needed seatbelt.
  
  Exit with an error when make is called without a target at the top level
  rather than poluting the source tree and causing use confusion in future
  builds.
  
  commit a9d9aa341b2f4308a227ab460ba85f1f287ad028
  Author: Brooks Davis 
  Date:   Tue Apr 29 16:06:12 2014 +
  
  Simplify seatbelt added in 1d1b908 based in feedback.
  
  Discussed with:   i...@freebsd.org
  
  Reviewed by:  imp
  Sponsored by: DARPA, AFRL

Modified:
  head/Makefile

Modified: head/Makefile
==
--- head/Makefile   Tue Apr 29 16:51:28 2014(r265096)
+++ head/Makefile   Tue Apr 29 16:57:25 2014(r265097)
@@ -238,8 +238,17 @@ tinderbox toolchains kernel-toolchains: 
 ${TGTS}:
${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET}
 
-# Set a reasonable default
-.MAIN: all
+# The historic default "all" target creates files which may cause stale
+# or (in the cross build case) unlinkable results. Fail with an error
+# when no target is given. The users can explicitly specify "all"
+# if they want the historic behavior.
+.MAIN: _guard
+
+_guard:
+   @echo
+   @echo "Explicit target required (use \"all\" for historic behavior)"
+   @echo
+   @false
 
 STARTTIME!= LC_ALL=C date
 CHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0s ; echo
___
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: r265098 - head/sys/kern

2014-04-29 Thread Peter Grehan
Author: grehan
Date: Tue Apr 29 17:22:29 2014
New Revision: 265098
URL: http://svnweb.freebsd.org/changeset/base/265098

Log:
  Bump WITNESS_PENDLIST by MAXCPU to account for the
  pmap pvlist locks which are scaled by MAXCPU.
  
  This allows an amd64 system to boot with MAXCPU set
  to 256, which is currently FreeBSD's hard limit without
  x2apic support.
  
  Compile-tested for other arch's.
  
  PR:   185831
  Discussed with:   jhb
  MFC after:3 weeks

Modified:
  head/sys/kern/subr_witness.c

Modified: head/sys/kern/subr_witness.c
==
--- head/sys/kern/subr_witness.cTue Apr 29 16:57:25 2014
(r265097)
+++ head/sys/kern/subr_witness.cTue Apr 29 17:22:29 2014
(r265098)
@@ -135,7 +135,7 @@ __FBSDID("$FreeBSD$");
 #defineWITNESS_COUNT   1536
 #defineWITNESS_CHILDCOUNT  (WITNESS_COUNT * 4)
 #defineWITNESS_HASH_SIZE   251 /* Prime, gives load factor < 2 
*/
-#defineWITNESS_PENDLIST1024
+#defineWITNESS_PENDLIST(1024 + MAXCPU)
 
 /* Allocate 256 KB of stack data space */
 #defineWITNESS_LO_DATA_COUNT   2048
___
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: r265099 - in head/sys/arm: conf xilinx

2014-04-29 Thread Ian Lepore
Author: ian
Date: Tue Apr 29 17:48:57 2014
New Revision: 265099
URL: http://svnweb.freebsd.org/changeset/base/265099

Log:
  Add SMP support for Zedboard.
  
  Submitted by: Thomas Skibo 

Added:
  head/sys/arm/xilinx/zy7_mp.c   (contents, props changed)
Modified:
  head/sys/arm/conf/ZEDBOARD
  head/sys/arm/xilinx/files.zynq7
  head/sys/arm/xilinx/std.zynq7

Modified: head/sys/arm/conf/ZEDBOARD
==
--- head/sys/arm/conf/ZEDBOARD  Tue Apr 29 17:22:29 2014(r265098)
+++ head/sys/arm/conf/ZEDBOARD  Tue Apr 29 17:48:57 2014(r265099)
@@ -56,6 +56,7 @@ options   SYSVSEM # SYSV-style semaphor
 options_KPOSIX_PRIORITY_SCHEDULING # Posix P1003_1B real-time 
extensions
 optionsFREEBSD_BOOT_LOADER
 optionsVFP # vfp/neon
+optionsSMP # Symmetric MultiProcessor Kernel
 
 # Debugging
 makeoptionsDEBUG=-g

Modified: head/sys/arm/xilinx/files.zynq7
==
--- head/sys/arm/xilinx/files.zynq7 Tue Apr 29 17:22:29 2014
(r265098)
+++ head/sys/arm/xilinx/files.zynq7 Tue Apr 29 17:48:57 2014
(r265099)
@@ -21,6 +21,7 @@ arm/xilinx/zy7_l2cache.c  standard
 arm/xilinx/zy7_bus_space.c standard
 arm/xilinx/zy7_slcr.c  standard
 arm/xilinx/zy7_devcfg.cstandard
+arm/xilinx/zy7_mp.coptional smp
 
 dev/cadence/if_cgem.c  optional if_cgem
 dev/sdhci/sdhci_fdt.c  optional sdhci

Modified: head/sys/arm/xilinx/std.zynq7
==
--- head/sys/arm/xilinx/std.zynq7   Tue Apr 29 17:22:29 2014
(r265098)
+++ head/sys/arm/xilinx/std.zynq7   Tue Apr 29 17:48:57 2014
(r265099)
@@ -20,3 +20,5 @@ makeoptions   KERNVIRTADDR=0xc010
 
 optionsARM_L2_PIPT
 
+optionsIPI_IRQ_START=0
+optionsIPI_IRQ_END=15

Added: head/sys/arm/xilinx/zy7_mp.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/xilinx/zy7_mp.cTue Apr 29 17:48:57 2014
(r265099)
@@ -0,0 +1,99 @@
+/*-
+ * Copyright (c) 2013 Thomas Skibo.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+
+#defineZYNQ7_CPU1_ENTRY0xfff0
+
+void
+platform_mp_init_secondary(void)
+{
+
+   gic_init_secondary();
+}
+
+void
+platform_mp_setmaxid(void)
+{
+
+   mp_maxid = 1;
+}
+
+int
+platform_mp_probe(void)
+{
+
+   mp_ncpus = 2;
+   return (1);
+}
+
+void
+platform_mp_start_ap(void)
+{
+   bus_space_handle_t ocm_handle;
+
+   /* Map in magic location to give entry address to CPU1. */
+   if (bus_space_map(fdtbus_bs_tag, ZYNQ7_CPU1_ENTRY, 4,
+   0, &ocm_handle) != 0)
+   panic("platform_mp_start_ap: Couldn't map OCM\n");
+
+   /* Write start address for CPU1. */
+   bus_space_write_4(fdtbus_bs_tag, ocm_handle, 0,
+   pmap_kextract((vm_offset_t)mpentry));
+
+   /*
+* The SCU is enabled by the BOOTROM but I think the second CPU doesn't
+* turn on filtering until after the wake-up below. I think that's why
+* things don't work if I don't put these cache ops here.  Also, the
+* magic location, 0xfff0, isn't in t

svn commit: r265101 - in head: sys/amd64/include sys/amd64/vmm usr.sbin/bhyve

2014-04-29 Thread Neel Natu
Author: neel
Date: Tue Apr 29 18:42:56 2014
New Revision: 265101
URL: http://svnweb.freebsd.org/changeset/base/265101

Log:
  Some Linux guests will implement a 'halt' by disabling the APIC and executing
  the 'HLT' instruction. This condition was detected by 'vm_handle_hlt()' and
  converted into the SPINDOWN_CPU exitcode . The bhyve(8) process would exit
  the vcpu thread in response to a SPINDOWN_CPU and when the last vcpu was
  spun down it would reset the virtual machine via vm_suspend(VM_SUSPEND_RESET).
  
  This functionality was broken in r263780 in a way that made it impossible
  to kill the bhyve(8) process because it would loop forever in
  vm_handle_suspend().
  
  Unbreak this by removing the code to spindown vcpus. Thus a 'halt' from
  a Linux guest will appear to be hung but this is consistent with the
  behavior on bare metal. The guest can be rebooted by using the bhyvectl
  options '--force-reset' or '--force-poweroff'.
  
  Reviewed by:  grehan@

Modified:
  head/sys/amd64/include/vmm.h
  head/sys/amd64/vmm/vmm.c
  head/usr.sbin/bhyve/bhyverun.c

Modified: head/sys/amd64/include/vmm.h
==
--- head/sys/amd64/include/vmm.hTue Apr 29 18:42:37 2014
(r265100)
+++ head/sys/amd64/include/vmm.hTue Apr 29 18:42:56 2014
(r265101)
@@ -325,7 +325,7 @@ enum vm_exitcode {
VM_EXITCODE_PAGING,
VM_EXITCODE_INST_EMUL,
VM_EXITCODE_SPINUP_AP,
-   VM_EXITCODE_SPINDOWN_CPU,
+   VM_EXITCODE_DEPRECATED1,/* used to be SPINDOWN_CPU */
VM_EXITCODE_RENDEZVOUS,
VM_EXITCODE_IOAPIC_EOI,
VM_EXITCODE_SUSPENDED,

Modified: head/sys/amd64/vmm/vmm.c
==
--- head/sys/amd64/vmm/vmm.cTue Apr 29 18:42:37 2014(r265100)
+++ head/sys/amd64/vmm/vmm.cTue Apr 29 18:42:56 2014(r265101)
@@ -191,8 +191,6 @@ static int vmm_ipinum;
 SYSCTL_INT(_hw_vmm, OID_AUTO, ipinum, CTLFLAG_RD, &vmm_ipinum, 0,
 "IPI vector used for vcpu notifications");
 
-static void vm_deactivate_cpu(struct vm *vm, int vcpuid);
-
 static void
 vcpu_cleanup(struct vm *vm, int i)
 {
@@ -1006,60 +1004,47 @@ vm_handle_rendezvous(struct vm *vm, int 
 static int
 vm_handle_hlt(struct vm *vm, int vcpuid, bool intr_disabled, bool *retu)
 {
-   struct vm_exit *vmexit;
struct vcpu *vcpu;
-   int t, timo, spindown;
+   const char *wmesg;
+   int t;
 
vcpu = &vm->vcpu[vcpuid];
-   spindown = 0;
 
vcpu_lock(vcpu);
+   while (1) {
+   /*
+* Do a final check for pending NMI or interrupts before
+* really putting this thread to sleep. Also check for
+* software events that would cause this vcpu to wakeup.
+*
+* These interrupts/events could have happened after the
+* vcpu returned from VMRUN() and before it acquired the
+* vcpu lock above.
+*/
+   if (vm->rendezvous_func != NULL || vm->suspend)
+   break;
+   if (vm_nmi_pending(vm, vcpuid))
+   break;
+   if (!intr_disabled) {
+   if (vm_extint_pending(vm, vcpuid) ||
+   vlapic_pending_intr(vcpu->vlapic, NULL)) {
+   break;
+   }
+   }
+
+   if (vlapic_enabled(vcpu->vlapic))
+   wmesg = "vmidle";
+   else
+   wmesg = "vmhalt";
 
-   /*
-* Do a final check for pending NMI or interrupts before
-* really putting this thread to sleep.
-*
-* These interrupts could have happened any time after we
-* returned from VMRUN() and before we grabbed the vcpu lock.
-*/
-   if (vm->rendezvous_func == NULL &&
-   !vm_nmi_pending(vm, vcpuid) &&
-   (intr_disabled || !vlapic_pending_intr(vcpu->vlapic, NULL))) {
t = ticks;
vcpu_require_state_locked(vcpu, VCPU_SLEEPING);
-   if (vlapic_enabled(vcpu->vlapic)) {
-   /*
-* XXX msleep_spin() is not interruptible so use the
-* 'timo' to put an upper bound on the sleep time.
-*/
-   timo = hz;
-   msleep_spin(vcpu, &vcpu->mtx, "vmidle", timo);
-   } else {
-   /*
-* Spindown the vcpu if the APIC is disabled and it
-* had entered the halted state, but never spin
-* down the BSP.
-*/
-   if (vcpuid != 0)
-   spindown = 1;
-   }
+   msleep_spin(vcpu, &vcpu->mtx, wmesg, 0);

svn commit: r265100 - head/sys/vm

2014-04-29 Thread Konstantin Belousov
Author: kib
Date: Tue Apr 29 18:42:37 2014
New Revision: 265100
URL: http://svnweb.freebsd.org/changeset/base/265100

Log:
  For the VM_PHYSSEG_DENSE case, checking the requested range to fall
  into the area backed by vm_page_array wrongly compared end with
  vm_page_array_size.  It should be adjusted by first_page index to be
  correct.
  
  Also, the corner and incorrect case of the requested range extending
  after the end of the vm_page_array was incorrectly handled by
  allocating the segment.
  
  Fix the comparision for the end of range and return EINVAL if the end
  extends beyond vm_page_array.
  
  Discussed with:   royger
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/vm/vm_phys.c

Modified: head/sys/vm/vm_phys.c
==
--- head/sys/vm/vm_phys.c   Tue Apr 29 17:48:57 2014(r265099)
+++ head/sys/vm/vm_phys.c   Tue Apr 29 18:42:37 2014(r265100)
@@ -551,7 +551,9 @@ vm_phys_fictitious_reg_range(vm_paddr_t 
 
 #ifdef VM_PHYSSEG_DENSE
pi = atop(start);
-   if (pi >= first_page && atop(end) < vm_page_array_size) {
+   if (pi >= first_page && pi < vm_page_array_size + first_page) {
+   if (atop(end) >= vm_page_array_size + first_page)
+   return (EINVAL);
fp = &vm_page_array[pi - first_page];
malloced = FALSE;
} else
___
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: r265102 - head/sys/dev/drm2/i915

2014-04-29 Thread Konstantin Belousov
Author: kib
Date: Tue Apr 29 19:02:34 2014
New Revision: 265102
URL: http://svnweb.freebsd.org/changeset/base/265102

Log:
  Fix two cases of recursive acquisitions of the vm object lock, only
  possible in rare failure situations.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/dev/drm2/i915/i915_gem.c

Modified: head/sys/dev/drm2/i915/i915_gem.c
==
--- head/sys/dev/drm2/i915/i915_gem.c   Tue Apr 29 18:42:56 2014
(r265101)
+++ head/sys/dev/drm2/i915/i915_gem.c   Tue Apr 29 19:02:34 2014
(r265102)
@@ -1431,6 +1431,7 @@ retry:
m = vm_phys_fictitious_to_vm_page(dev->agp->base + obj->gtt_offset +
offset);
if (m == NULL) {
+   VM_OBJECT_WUNLOCK(vm_obj);
cause = 60;
ret = -EFAULT;
goto unlock;
@@ -1450,7 +1451,6 @@ retry:
DRM_UNLOCK(dev);
VM_OBJECT_WUNLOCK(vm_obj);
VM_WAIT;
-   VM_OBJECT_WLOCK(vm_obj);
goto retry;
}
m->valid = VM_PAGE_BITS_ALL;
___
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: r265103 - head/sys/net

2014-04-29 Thread Alexander V. Chernikov
Author: melifaro
Date: Tue Apr 29 19:14:42 2014
New Revision: 265103
URL: http://svnweb.freebsd.org/changeset/base/265103

Log:
  Move rt_setmetrics() from rtsock.c to route.c.
  All rtsock-initiated rte creation/modification are now
  performed in route.c holding radix tree write lock.
  This reduces the need for per-rte mutex.
  
  Sponsored by: Yandex LLC
  MFC after:1 month

Modified:
  head/sys/net/route.c
  head/sys/net/route.h
  head/sys/net/rtsock.c

Modified: head/sys/net/route.c
==
--- head/sys/net/route.cTue Apr 29 19:02:34 2014(r265102)
+++ head/sys/net/route.cTue Apr 29 19:14:42 2014(r265103)
@@ -142,6 +142,7 @@ static VNET_DEFINE(uma_zone_t, rtzone); 
 
 static int rtrequest1_fib_change(struct radix_node_head *, struct rt_addrinfo 
*,
 struct rtentry **, u_int);
+static void rt_setmetrics(const struct rt_addrinfo *, struct rtentry *);
 
 /*
  * handler for net.my_fibnum
@@ -1401,6 +1402,8 @@ rtrequest1_fib(int req, struct rt_addrin
if (ifa->ifa_rtrequest)
ifa->ifa_rtrequest(req, rt, info);
 
+   rt_setmetrics(info, rt);
+
/*
 * actually return a resultant rtentry and
 * give the caller a single reference.
@@ -1506,6 +1509,8 @@ rtrequest1_fib_change(struct radix_node_
if (rt->rt_ifa && rt->rt_ifa->ifa_rtrequest != NULL)
   rt->rt_ifa->ifa_rtrequest(RTM_ADD, rt, info);
 
+   rt_setmetrics(info, rt);
+
if (ret_nrt) {
*ret_nrt = rt;
RT_ADDREF(rt);
@@ -1517,6 +1522,20 @@ bad:
return (error);
 }
 
+static void
+rt_setmetrics(const struct rt_addrinfo *info, struct rtentry *rt)
+{
+
+   if (info->rti_mflags & RTV_MTU)
+   rt->rt_mtu = info->rti_rmx->rmx_mtu;
+   if (info->rti_mflags & RTV_WEIGHT)
+   rt->rt_weight = info->rti_rmx->rmx_weight;
+   /* Kernel -> userland timebase conversion. */
+   if (info->rti_mflags & RTV_EXPIRE)
+   rt->rt_expire = info->rti_rmx->rmx_expire ?
+   info->rti_rmx->rmx_expire - time_second + time_uptime : 0;
+}
+
 int
 rt_setgate(struct rtentry *rt, struct sockaddr *dst, struct sockaddr *gate)
 {

Modified: head/sys/net/route.h
==
--- head/sys/net/route.hTue Apr 29 19:02:34 2014(r265102)
+++ head/sys/net/route.hTue Apr 29 19:14:42 2014(r265103)
@@ -261,6 +261,8 @@ struct rt_addrinfo {
int rti_flags;
struct  ifaddr *rti_ifa;
struct  ifnet *rti_ifp;
+   u_long  rti_mflags;
+   struct  rt_metrics *rti_rmx;
 };
 
 /*

Modified: head/sys/net/rtsock.c
==
--- head/sys/net/rtsock.c   Tue Apr 29 19:02:34 2014(r265102)
+++ head/sys/net/rtsock.c   Tue Apr 29 19:14:42 2014(r265103)
@@ -160,7 +160,6 @@ static int  sysctl_dumpentry(struct radix
 static int sysctl_iflist(int af, struct walkarg *w);
 static int sysctl_ifmalist(int af, struct walkarg *w);
 static int route_output(struct mbuf *m, struct socket *so);
-static voidrt_setmetrics(const struct rt_msghdr *rtm, struct rtentry *rt);
 static voidrt_getmetrics(const struct rtentry *rt, struct rt_metrics *out);
 static voidrt_dispatch(struct mbuf *, sa_family_t);
 
@@ -584,6 +583,10 @@ route_output(struct mbuf *m, struct sock
 
rtm->rtm_pid = curproc->p_pid;
info.rti_addrs = rtm->rtm_addrs;
+
+   info.rti_mflags = rtm->rtm_inits;
+   info.rti_rmx = &rtm->rtm_rmx;
+
/*
 * rt_xaddrs() performs s6_addr[2] := sin6_scope_id for AF_INET6
 * link-local address because rtrequest requires addresses with
@@ -670,7 +673,6 @@ route_output(struct mbuf *m, struct sock
rti_need_deembed = (V_deembed_scopeid) ? 1 : 0;
 #endif
RT_LOCK(saved_nrt);
-   rt_setmetrics(rtm, saved_nrt);
rtm->rtm_index = saved_nrt->rt_ifp->if_index;
RT_REMREF(saved_nrt);
RT_UNLOCK(saved_nrt);
@@ -920,20 +922,6 @@ flush:
 }
 
 static void
-rt_setmetrics(const struct rt_msghdr *rtm, struct rtentry *rt)
-{
-
-   if (rtm->rtm_inits & RTV_MTU)
-   rt->rt_mtu = rtm->rtm_rmx.rmx_mtu;
-   if (rtm->rtm_inits & RTV_WEIGHT)
-   rt->rt_weight = rtm->rtm_rmx.rmx_weight;
-   /* Kernel -> userland timebase conversion. */
-   if (rtm->rtm_inits & RTV_EXPIRE)
-   rt->rt_expire = rtm->rtm_rmx.rmx_expire ?
-   rtm->rtm_rmx.rmx_expire - time_second + time_uptime : 0;
-}
-
-static void
 rt_getmetrics(const struct rtentry *rt, struct rt_metrics *out)
 {
 
___
svn-src-head@freebsd.org m

svn commit: r265104 - head/sys/net

2014-04-29 Thread Alexander V. Chernikov
Author: melifaro
Date: Tue Apr 29 19:48:11 2014
New Revision: 265104
URL: http://svnweb.freebsd.org/changeset/base/265104

Log:
  Partially revert r265019 - allocating 512 bytes on stack
  can be too much for architectures like ARM. Always use rounded
  malloc instead.
  
  Discussed with:   jmallett
  MFC after:4 weeks

Modified:
  head/sys/net/rtsock.c

Modified: head/sys/net/rtsock.c
==
--- head/sys/net/rtsock.c   Tue Apr 29 19:14:42 2014(r265103)
+++ head/sys/net/rtsock.c   Tue Apr 29 19:48:11 2014(r265104)
@@ -531,7 +531,6 @@ route_output(struct mbuf *m, struct sock
sa_family_t saf = AF_UNSPEC;
struct rawcb *rp = NULL;
struct walkarg w;
-   char msgbuf[512];
 
fibnum = so->so_fibnum;
 
@@ -548,20 +547,12 @@ route_output(struct mbuf *m, struct sock
 
/*
 * Most of current messages are in range 200-240 bytes,
-* minimize possible failures by using on-stack buffer
-* which should fit for most messages.
-* However, use stable memory if we need to handle
-* something large.
+* minimize possible re-allocation on reply using larger size
+* buffer aligned on 1k boundaty.
 */
-   if (len < sizeof(msgbuf)) {
-   alloc_len = sizeof(msgbuf);
-   rtm = (struct rt_msghdr *)msgbuf;
-   } else {
-   alloc_len = roundup2(len, 1024);
-   rtm = malloc(alloc_len, M_TEMP, M_NOWAIT);
-   if (rtm == NULL)
-   senderr(ENOBUFS);
-   }
+   alloc_len = roundup2(len, 1024);
+   if ((rtm = malloc(alloc_len, M_TEMP, M_NOWAIT)) == NULL)
+   senderr(ENOBUFS);
 
m_copydata(m, 0, len, (caddr_t)rtm);
bzero(&info, sizeof(info));
@@ -569,8 +560,7 @@ route_output(struct mbuf *m, struct sock
 
if (rtm->rtm_version != RTM_VERSION) {
/* Do not touch message since format is unknown */
-   if ((char *)rtm != msgbuf)
-   free(rtm, M_TEMP);
+   free(rtm, M_TEMP);
rtm = NULL;
senderr(EPROTONOSUPPORT);
}
@@ -861,7 +851,7 @@ flush:
 */
if ((so->so_options & SO_USELOOPBACK) == 0) {
if (V_route_cb.any_count <= 1) {
-   if (rtm != NULL && (char *)rtm != msgbuf)
+   if (rtm != NULL)
free(rtm, M_TEMP);
m_freem(m);
return (error);
@@ -899,8 +889,7 @@ flush:
} else if (m->m_pkthdr.len > rtm->rtm_msglen)
m_adj(m, rtm->rtm_msglen - m->m_pkthdr.len);
 
-   if ((char *)rtm != msgbuf)
-   free(rtm, M_TEMP);
+   free(rtm, M_TEMP);
}
if (m != NULL) {
M_SETFIB(m, fibnum);
___
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: r265107 - head/sys/dev/pci

2014-04-29 Thread Ryan Stone
Author: rstone
Date: Tue Apr 29 20:49:47 2014
New Revision: 265107
URL: http://svnweb.freebsd.org/changeset/base/265107

Log:
  Be consistent with the whitespace in the rest of these files.
  
  X-MFC-With: r264007

Modified:
  head/sys/dev/pci/pci_if.m
  head/sys/dev/pci/pcib_if.m

Modified: head/sys/dev/pci/pci_if.m
==
--- head/sys/dev/pci/pci_if.m   Tue Apr 29 20:48:15 2014(r265106)
+++ head/sys/dev/pci/pci_if.m   Tue Apr 29 20:49:47 2014(r265107)
@@ -161,7 +161,7 @@ METHOD int msix_count {
 } DEFAULT null_msi_count;
 
 METHOD uint16_t get_rid {
-   device_t dev;
-   device_t child;
+   device_tdev;
+   device_tchild;
 };
 

Modified: head/sys/dev/pci/pcib_if.m
==
--- head/sys/dev/pci/pcib_if.m  Tue Apr 29 20:48:15 2014(r265106)
+++ head/sys/dev/pci/pcib_if.m  Tue Apr 29 20:49:47 2014(r265107)
@@ -169,8 +169,8 @@ METHOD int power_for_sleep {
 # Return the PCI Routing Identifier (RID) for the device.
 #
 METHOD uint16_t get_rid {
-   device_t pcib;
-   device_t dev;
+   device_tpcib;
+   device_tdev;
 } DEFAULT pcib_get_rid;
 
 #
___
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: r265108 - head/sys/kern

2014-04-29 Thread Marius Strobl
Author: marius
Date: Tue Apr 29 20:51:57 2014
New Revision: 265108
URL: http://svnweb.freebsd.org/changeset/base/265108

Log:
  Given that as of r258002 the last external user is gone, make sched_lock
  static.

Modified:
  head/sys/kern/sched_4bsd.c

Modified: head/sys/kern/sched_4bsd.c
==
--- head/sys/kern/sched_4bsd.c  Tue Apr 29 20:49:47 2014(r265107)
+++ head/sys/kern/sched_4bsd.c  Tue Apr 29 20:51:57 2014(r265108)
@@ -116,7 +116,7 @@ struct td_sched {
 CPU_ISSET((cpu), &(td)->td_cpuset->cs_mask)
 
 static struct td_sched td_sched0;
-struct mtx sched_lock;
+static struct mtx sched_lock;
 
 static int realstathz = 127; /* stathz is sometimes 0 and run off of hz. */
 static int sched_tdcnt;/* Total runnable threads in the system. */
___
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: r265110 - head/sys/mips/mips

2014-04-29 Thread Marius Strobl
Author: marius
Date: Tue Apr 29 20:57:25 2014
New Revision: 265110
URL: http://svnweb.freebsd.org/changeset/base/265110

Log:
  Update comment.

Modified:
  head/sys/mips/mips/vm_machdep.c

Modified: head/sys/mips/mips/vm_machdep.c
==
--- head/sys/mips/mips/vm_machdep.c Tue Apr 29 20:52:39 2014
(r265109)
+++ head/sys/mips/mips/vm_machdep.c Tue Apr 29 20:57:25 2014
(r265110)
@@ -438,7 +438,7 @@ cpu_set_upcall(struct thread *td, struct
 * that are needed.
 */
 
-   /* SMP Setup to release sched_lock in fork_exit(). */
+   /* Setup to release spin count in in fork_exit(). */
td->td_md.md_spinlock_count = 1;
td->td_md.md_saved_intr = MIPS_SR_INT_IE;
 #if 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: r264864 - head/sys/dev/usb/wlan

2014-04-29 Thread Rui Paulo

On Apr 23, 2014, at 20:16, Kevin Lo  wrote:

> Author: kevlo
> Date: Thu Apr 24 03:16:47 2014
> New Revision: 264864
> URL: http://svnweb.freebsd.org/changeset/base/264864
> 
> Log:
>  Fix panic by adding mtx_assert() to urtwn_init_locked() and
>  urtwn_stop_locked().

This was not a panic, but a LOR.

> Modified:
>  head/sys/dev/usb/wlan/if_urtwn.c
> 
> Modified: head/sys/dev/usb/wlan/if_urtwn.c
> ==
> --- head/sys/dev/usb/wlan/if_urtwn.c  Thu Apr 24 02:16:23 2014
> (r264863)
> +++ head/sys/dev/usb/wlan/if_urtwn.c  Thu Apr 24 03:16:47 2014
> (r264864)
> @@ -2054,6 +2054,7 @@ urtwn_load_firmware(struct urtwn_softc *
>   uint32_t reg;
>   int mlen, ntries, page, error;
> 
> + URTWN_UNLOCK(sc);

You didn't need to unlock this early.  The problem was in firmware_get().

>   /* Read firmware image from the filesystem. */
>   if ((sc->chip & (URTWN_CHIP_UMC_A_CUT | URTWN_CHIP_92C)) ==
>   URTWN_CHIP_UMC_A_CUT)
> @@ -2062,6 +2063,7 @@ urtwn_load_firmware(struct urtwn_softc *
>   imagename = "urtwn-rtl8192cfwT";
> 
>   fw = firmware_get(imagename);
> + URTWN_LOCK(sc);
>   if (fw == NULL) {
>   device_printf(sc->sc_dev,
>   "failed loadfirmware of file %s\n", imagename);
> @@ -2816,6 +2818,8 @@ urtwn_init_locked(void *arg)
>   uint32_t reg;
>   int error;
> 
> + URTWN_ASSERT_LOCKED(sc);
> +
>   if (ifp->if_drv_flags & IFF_DRV_RUNNING)
>   urtwn_stop_locked(ifp);
> 
> @@ -2979,6 +2983,8 @@ urtwn_stop_locked(struct ifnet *ifp)
> {
>   struct urtwn_softc *sc = ifp->if_softc;
> 
> + URTWN_ASSERT_LOCKED(sc);
> +
>   ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
> 
>   callout_stop(&sc->sc_watchdog_ch);

This is fine, but I wonder if the firmware API should be changed.  The problem 
with this approach, and all USB WiFi drivers, is that by unlocking the mutex, 
the mutual exclusion protection is lost... 

--
Rui Paulo



___
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: r265111 - head/sys/arm/include

2014-04-29 Thread Ian Lepore
Author: ian
Date: Tue Apr 29 23:29:28 2014
New Revision: 265111
URL: http://svnweb.freebsd.org/changeset/base/265111

Log:
  Make this declaration into a proper function prototype.

Modified:
  head/sys/arm/include/cpufunc.h

Modified: head/sys/arm/include/cpufunc.h
==
--- head/sys/arm/include/cpufunc.h  Tue Apr 29 20:57:25 2014
(r265110)
+++ head/sys/arm/include/cpufunc.h  Tue Apr 29 23:29:28 2014
(r265111)
@@ -411,7 +411,7 @@ voidarmv6_idcache_wbinv_range   (vm_offse
 void   armv7_setttb(u_int);
 void   armv7_tlb_flushID   (void);
 void   armv7_tlb_flushID_SE(u_int);
-void   armv7_icache_sync_all   ();
+void   armv7_icache_sync_all   (void);
 void   armv7_icache_sync_range (vm_offset_t, vm_size_t);
 void   armv7_idcache_wbinv_range   (vm_offset_t, vm_size_t);
 void   armv7_idcache_inv_all   (void);
___
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: r265112 - in head/sys/dev/ath/ath_hal: ar5210 ar5211 ar5212 ar5416

2014-04-29 Thread Adrian Chadd
Author: adrian
Date: Wed Apr 30 02:03:13 2014
New Revision: 265112
URL: http://svnweb.freebsd.org/changeset/base/265112

Log:
  * Only update ah_powerMode if we're setting the chip sleep state.
Some code will appear soon that is actually setting the chip powerstate
separate from the self-generated frames power state.
  * Allow the AR5416 family chips to actually have the power state changed
from the self generated state change.
  
  Tested (STA mode):
  
  * AR5210
  * AR5211
  * AR5412
  * AR5413
  * AR5416
  * AR9285

Modified:
  head/sys/dev/ath/ath_hal/ar5210/ar5210_power.c
  head/sys/dev/ath/ath_hal/ar5211/ar5211_power.c
  head/sys/dev/ath/ath_hal/ar5212/ar5212_power.c
  head/sys/dev/ath/ath_hal/ar5416/ar5416_power.c

Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210_power.c
==
--- head/sys/dev/ath/ath_hal/ar5210/ar5210_power.c  Tue Apr 29 23:29:28 
2014(r265111)
+++ head/sys/dev/ath/ath_hal/ar5210/ar5210_power.c  Wed Apr 30 02:03:13 
2014(r265112)
@@ -108,16 +108,19 @@ ar5210SetPowerMode(struct ath_hal *ah, H
setChip ? "set chip " : "");
switch (mode) {
case HAL_PM_AWAKE:
-   ah->ah_powerMode = mode;
+   if (setChip)
+   ah->ah_powerMode = mode;
status = ar5210SetPowerModeAwake(ah, setChip);
break;
case HAL_PM_FULL_SLEEP:
ar5210SetPowerModeSleep(ah, setChip);
-   ah->ah_powerMode = mode;
+   if (setChip)
+   ah->ah_powerMode = mode;
break;
case HAL_PM_NETWORK_SLEEP:
ar5210SetPowerModeAuto(ah, setChip);
-   ah->ah_powerMode = mode;
+   if (setChip)
+   ah->ah_powerMode = mode;
break;
default:
HALDEBUG(ah, HAL_DEBUG_ANY, "%s: unknown power mode %u\n",

Modified: head/sys/dev/ath/ath_hal/ar5211/ar5211_power.c
==
--- head/sys/dev/ath/ath_hal/ar5211/ar5211_power.c  Tue Apr 29 23:29:28 
2014(r265111)
+++ head/sys/dev/ath/ath_hal/ar5211/ar5211_power.c  Wed Apr 30 02:03:13 
2014(r265112)
@@ -110,16 +110,19 @@ ar5211SetPowerMode(struct ath_hal *ah, H
setChip ? "set chip " : "");
switch (mode) {
case HAL_PM_AWAKE:
-   ah->ah_powerMode = mode;
+   if (setChip)
+   ah->ah_powerMode = mode;
status = ar5211SetPowerModeAwake(ah, setChip);
break;
case HAL_PM_FULL_SLEEP:
ar5211SetPowerModeSleep(ah, setChip);
-   ah->ah_powerMode = mode;
+   if (setChip)
+   ah->ah_powerMode = mode;
break;
case HAL_PM_NETWORK_SLEEP:
ar5211SetPowerModeNetworkSleep(ah, setChip);
-   ah->ah_powerMode = mode;
+   if (setChip)
+   ah->ah_powerMode = mode;
break;
default:
HALDEBUG(ah, HAL_DEBUG_ANY, "%s: unknown power mode %u\n",

Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_power.c
==
--- head/sys/dev/ath/ath_hal/ar5212/ar5212_power.c  Tue Apr 29 23:29:28 
2014(r265111)
+++ head/sys/dev/ath/ath_hal/ar5212/ar5212_power.c  Wed Apr 30 02:03:13 
2014(r265112)
@@ -134,16 +134,19 @@ ar5212SetPowerMode(struct ath_hal *ah, H
setChip ? "set chip " : "");
switch (mode) {
case HAL_PM_AWAKE:
-   ah->ah_powerMode = mode;
+   if (setChip)
+   ah->ah_powerMode = mode;
status = ar5212SetPowerModeAwake(ah, setChip);
break;
case HAL_PM_FULL_SLEEP:
ar5212SetPowerModeSleep(ah, setChip);
-   ah->ah_powerMode = mode;
+   if (setChip)
+   ah->ah_powerMode = mode;
break;
case HAL_PM_NETWORK_SLEEP:
ar5212SetPowerModeNetworkSleep(ah, setChip);
-   ah->ah_powerMode = mode;
+   if (setChip)
+   ah->ah_powerMode = mode;
break;
default:
HALDEBUG(ah, HAL_DEBUG_ANY, "%s: unknown power mode %u\n",

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_power.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_power.c  Tue Apr 29 23:29:28 
2014(r265111)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_power.c  Wed Apr 30 02:03:13 
2014(r265112)
@@ -133,23 +133,29 @@ ar5416SetPowerMode(struct ath_hal *ah, H
};
 #endif
int status = AH_TRUE;
+
+#if 0
if (!setChip)
  

svn commit: r265113 - head/sys/contrib/dev/ath/ath_hal/ar9300

2014-04-29 Thread Adrian Chadd
Author: adrian
Date: Wed Apr 30 02:03:47 2014
New Revision: 265113
URL: http://svnweb.freebsd.org/changeset/base/265113

Log:
  Only track the power state variable if the power state is changed,
  not if the self-generated frame state is changed.

Modified:
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_power.c

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_power.c
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_power.c  Wed Apr 30 
02:03:13 2014(r265112)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_power.c  Wed Apr 30 
02:03:47 2014(r265113)
@@ -669,7 +669,8 @@ ar9300_set_power_mode(struct ath_hal *ah
 
 switch (mode) {
 case HAL_PM_AWAKE:
-ah->ah_powerMode = mode;
+if (set_chip)
+ah->ah_powerMode = mode;
 status = ar9300_set_power_mode_awake(ah, set_chip);
 #if ATH_SUPPORT_MCI
 if (AH_PRIVATE(ah)->ah_caps.halMciSupport) {
@@ -699,8 +700,10 @@ ar9300_set_power_mode(struct ath_hal *ah
 }
 #endif
 ar9300_set_power_mode_sleep(ah, set_chip);
-ahp->ah_chip_full_sleep = AH_TRUE;
-ah->ah_powerMode = mode;
+if (set_chip) {
+ahp->ah_chip_full_sleep = AH_TRUE;
+ah->ah_powerMode = mode;
+}
 break;
 case HAL_PM_NETWORK_SLEEP:
 #if ATH_SUPPORT_MCI
@@ -709,7 +712,9 @@ ar9300_set_power_mode(struct ath_hal *ah
 }
 #endif
 ar9300_set_power_mode_network_sleep(ah, set_chip);
-ah->ah_powerMode = mode;
+if (set_chip) {
+ah->ah_powerMode = mode;
+}
 break;
 default:
 HALDEBUG(ah, HAL_DEBUG_POWER_MGMT,
___
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: r265114 - in head: sys/amd64/vmm/intel usr.sbin/bhyve

2014-04-29 Thread Neel Natu
Author: neel
Date: Wed Apr 30 02:08:27 2014
New Revision: 265114
URL: http://svnweb.freebsd.org/changeset/base/265114

Log:
  Ignore writes to microcode update MSR. This MSR is accessed by RHEL7 guest.
  Add KTR tracepoints to annotate wrmsr and rdmsr VM exits.

Modified:
  head/sys/amd64/vmm/intel/vmx.c
  head/usr.sbin/bhyve/xmsr.c

Modified: head/sys/amd64/vmm/intel/vmx.c
==
--- head/sys/amd64/vmm/intel/vmx.c  Wed Apr 30 02:03:47 2014
(r265113)
+++ head/sys/amd64/vmm/intel/vmx.c  Wed Apr 30 02:08:27 2014
(r265114)
@@ -1797,6 +1797,7 @@ vmx_exit_process(struct vmx *vmx, int vc
vmm_stat_incr(vmx->vm, vcpu, VMEXIT_RDMSR, 1);
retu = false;
ecx = vmxctx->guest_rcx;
+   VCPU_CTR1(vmx->vm, vcpu, "rdmsr 0x%08x", ecx);
error = emulate_rdmsr(vmx->vm, vcpu, ecx, &retu);
if (error) {
vmexit->exitcode = VM_EXITCODE_RDMSR;
@@ -1815,6 +1816,8 @@ vmx_exit_process(struct vmx *vmx, int vc
eax = vmxctx->guest_rax;
ecx = vmxctx->guest_rcx;
edx = vmxctx->guest_rdx;
+   VCPU_CTR2(vmx->vm, vcpu, "wrmsr 0x%08x value 0x%016lx",
+   ecx, (uint64_t)edx << 32 | eax);
error = emulate_wrmsr(vmx->vm, vcpu, ecx,
(uint64_t)edx << 32 | eax, &retu);
if (error) {

Modified: head/usr.sbin/bhyve/xmsr.c
==
--- head/usr.sbin/bhyve/xmsr.c  Wed Apr 30 02:03:47 2014(r265113)
+++ head/usr.sbin/bhyve/xmsr.c  Wed Apr 30 02:08:27 2014(r265114)
@@ -47,6 +47,8 @@ emulate_wrmsr(struct vmctx *ctx, int vcp
case 0xd04: /* Sandy Bridge uncore PMC MSRs */
case 0xc24:
return (0);
+   case 0x79:
+   return (0); /* IA32_BIOS_UPDT_TRIG MSR */
default:
break;
}
___
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: r265115 - head/sys/dev/ath

2014-04-29 Thread Adrian Chadd
Author: adrian
Date: Wed Apr 30 02:19:41 2014
New Revision: 265115
URL: http://svnweb.freebsd.org/changeset/base/265115

Log:
  Bring over some initial power save management support, reset path
  fixes and beacon programming / debugging into the ath(4) driver.
  
  The basic power save tracking:
  
  * Add some new code to track the current desired powersave state; and
  * Add some reference count tracking so we know when the NIC is awake; then
  * Add code in all the points where we're about to touch the hardware and
push it to force-wake.
  
  Then, how things are moved into power save:
  
  * Only move into network-sleep during a RUN->SLEEP transition;
  * Force wake the hardware up everywhere that we're about to touch
the hardware.
  
  The net80211 stack takes care of doing RUN<->SLEEP<->(other) state
  transitions so we don't have to do it in the driver.
  
  Next, when to wake things up:
  
  * In short - everywhere we touch the hardware.
  * The hardware will take care of staying awake if things are queued
in the transmit queue(s); it'll then transit down to sleep if
there's nothing left.  This way we don't have to track the
software / hardware transmit queue(s) and keep the hardware
awake for those.
  
  Then, some transmit path fixes that aren't related but useful:
  
  * Force EAPOL frames to go out at the lowest rate.  This improves
reliability during the encryption handshake after 802.11
negotiation.
  
  Next, some reset path fixes!
  
  * Fix the overlap between reset and transmit pause so we don't
transmit frames during a reset.
  * Some noisy environments will end up taking a lot longer to reset
than normal, so extend the reset period and drop the raise the
reset interval to be more realistic and give the hardware some
time to finish calibration.
  * Skip calibration during the reset path.  Tsk!
  
  Then, beacon fixes in station mode!
  
  * Add a _lot_ more debugging in the station beacon reset path.
This is all quite fluid right now.
  * Modify the STA beacon programming code to try and take
the TU gap between desired TSF and the target TU into
account.  (Lifted from QCA.)
  
  Tested:
  
  * AR5210
  * AR5211
  * AR5212
  * AR5413
  * AR5416
  * AR9280
  * AR9285
  
  TODO:
  
  * More AP, IBSS, mesh, TDMA testing
  * Thorough AR9380 and later testing!
  * AR9160 and AR9287 testing
  
  Obtained from:QCA

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_beacon.c
  head/sys/dev/ath/if_ath_beacon.h
  head/sys/dev/ath/if_ath_debug.h
  head/sys/dev/ath/if_ath_keycache.c
  head/sys/dev/ath/if_ath_led.c
  head/sys/dev/ath/if_ath_misc.h
  head/sys/dev/ath/if_ath_rx.c
  head/sys/dev/ath/if_ath_rx_edma.c
  head/sys/dev/ath/if_ath_sysctl.c
  head/sys/dev/ath/if_ath_tx.c
  head/sys/dev/ath/if_athvar.h

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Wed Apr 30 02:08:27 2014(r265114)
+++ head/sys/dev/ath/if_ath.c   Wed Apr 30 02:19:41 2014(r265115)
@@ -279,6 +279,95 @@ ath_legacy_attach_comp_func(struct ath_s
}
 }
 
+/*
+ * Set the target power mode.
+ *
+ * If this is called during a point in time where
+ * the hardware is being programmed elsewhere, it will
+ * simply store it away and update it when all current
+ * uses of the hardware are completed.
+ */
+void
+_ath_power_setpower(struct ath_softc *sc, int power_state, const char *file, 
int line)
+{
+   ATH_LOCK_ASSERT(sc);
+
+   sc->sc_target_powerstate = power_state;
+
+   DPRINTF(sc, ATH_DEBUG_PWRSAVE, "%s: (%s:%d) state=%d, refcnt=%d\n",
+   __func__,
+   file,
+   line,
+   power_state,
+   sc->sc_powersave_refcnt);
+
+   if (sc->sc_powersave_refcnt == 0 &&
+   power_state != sc->sc_cur_powerstate) {
+   sc->sc_cur_powerstate = power_state;
+   ath_hal_setpower(sc->sc_ah, power_state);
+   }
+}
+
+/*
+ * Set the hardware power mode and take a reference.
+ *
+ * This doesn't update the target power mode in the driver;
+ * it just updates the hardware power state.
+ *
+ * XXX it should only ever force the hardware awake; it should
+ * never be called to set it asleep.
+ */
+void
+_ath_power_set_power_state(struct ath_softc *sc, int power_state, const char 
*file, int line)
+{
+   ATH_LOCK_ASSERT(sc);
+
+   DPRINTF(sc, ATH_DEBUG_PWRSAVE, "%s: (%s:%d) state=%d, refcnt=%d\n",
+   __func__,
+   file,
+   line,
+   power_state,
+   sc->sc_powersave_refcnt);
+
+   sc->sc_powersave_refcnt++;
+
+   if (power_state != sc->sc_cur_powerstate) {
+   ath_hal_setpower(sc->sc_ah, power_state);
+   sc->sc_cur_powerstate = power_state;
+   }
+}
+
+/*
+ * Restore the power save mode to what it once was.
+ *
+ * This will decrement the reference counter and once it hits
+ * zero, it'

svn commit: r265116 - head/sys/contrib/dev/ath/ath_hal/ar9300

2014-04-29 Thread Adrian Chadd
Author: adrian
Date: Wed Apr 30 02:29:31 2014
New Revision: 265116
URL: http://svnweb.freebsd.org/changeset/base/265116

Log:
  Add ar9300_get_next_tbtt().
  
  Tested:
  
  * AR9380, STA mode

Modified:
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.cWed Apr 30 
02:19:41 2014(r265115)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.cWed Apr 30 
02:29:31 2014(r265116)
@@ -60,6 +60,11 @@ ar9300_freebsd_set_tx_power_limit(struct
return (ar9300_set_tx_power_limit(ah, limit, 0, 0));
 }
 
+static uint64_t
+ar9300_get_next_tbtt(struct ath_hal *ah)
+{
+   return (OS_REG_READ(ah, AR_NEXT_TBTT_TIMER));
+}
 
 void
 ar9300_attach_freebsd_ops(struct ath_hal *ah)
@@ -195,6 +200,7 @@ ar9300_attach_freebsd_ops(struct ath_hal
ah->ah_setStationBeaconTimers = ar9300_set_sta_beacon_timers;
/* ah_resetStationBeaconTimers */
/* ah_getNextTBTT */
+   ah->ah_getNextTBTT = ar9300_get_next_tbtt;
 
/* Interrupt functions */
ah->ah_isInterruptPending   = ar9300_is_interrupt_pending;
___
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: r265117 - head/sys/dev/ath

2014-04-29 Thread Adrian Chadd
Author: adrian
Date: Wed Apr 30 02:44:07 2014
New Revision: 265117
URL: http://svnweb.freebsd.org/changeset/base/265117

Log:
  * Modify the beacon interval in debugging to be ni_intval, not 102400
  * Be paranoid about avoiding divide-by-zero.
  
  Tested:
  
  * AR9380, STA mode

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

Modified: head/sys/dev/ath/if_ath_rx.c
==
--- head/sys/dev/ath/if_ath_rx.cWed Apr 30 02:29:31 2014
(r265116)
+++ head/sys/dev/ath/if_ath_rx.cWed Apr 30 02:44:07 2014
(r265117)
@@ -335,10 +335,18 @@ ath_recv_mgmt(struct ieee80211_node *ni,
int32_t tsf_delta_bmiss;
int32_t tsf_remainder;
uint64_t tsf_beacon_target;
+   int tsf_intval;
 
tsf_beacon_old = ((uint64_t) LE_READ_4(ni->ni_tstamp.data + 4)) << 32;
tsf_beacon_old |= LE_READ_4(ni->ni_tstamp.data);
 
+#defineTU_TO_TSF(_tu)  (((u_int64_t)(_tu)) << 10)
+   tsf_intval = 1;
+   if (ni != NULL && ni->ni_intval > 0) {
+   tsf_intval = TU_TO_TSF(ni->ni_intval);
+   }
+#undef TU_TO_TSF
+
/*
 * Call up first so subsequent work can use information
 * potentially stored in the node (e.g. for ibss merge).
@@ -362,12 +370,7 @@ ath_recv_mgmt(struct ieee80211_node *ni,
 */
tsf_delta = (long long) tsf_beacon - (long long) tsf_beacon_old;
 
-   /*
-* For now let's just assume the intval is 100TU, which is
-* 102400uS.  So, we can just calculate the remainder from
-* that.
-*/
-   tsf_delta_bmiss = tsf_delta / 102400;
+   tsf_delta_bmiss = tsf_delta / tsf_intval;
 
/*
 * If our delta is greater than half the beacon interval,
@@ -375,25 +378,26 @@ ath_recv_mgmt(struct ieee80211_node *ni,
 * interval.  Ie, we're running really, really early
 * on the next beacon.
 */
-   if (tsf_delta % 102400 > 51200)
+   if (tsf_delta % tsf_intval > (tsf_intval / 2))
tsf_delta_bmiss ++;
 
tsf_beacon_target = tsf_beacon_old +
-   (((unsigned long long) tsf_delta_bmiss) * 102400ULL);
+   (((unsigned long long) tsf_delta_bmiss) * (long long) 
tsf_intval);
 
/*
-* The remainder using '%' is between 0 .. 102400-1.
+* The remainder using '%' is between 0 .. intval-1.
 * If we're actually running too fast, then the remainder
-* will be some large number just under 102400-1.
+* will be some large number just under intval-1.
 * So we need to look at whether we're running
 * before or after the target beacon interval
 * and if we are, modify how we do the remainder
 * calculation.
 */
if (tsf_beacon < tsf_beacon_target) {
-   tsf_remainder = -(102400 - ((tsf_beacon - 
tsf_beacon_old) % 102400));
+   tsf_remainder =
+   -(tsf_intval - ((tsf_beacon - tsf_beacon_old) % 
tsf_intval));
} else {
-   tsf_remainder = (tsf_beacon - tsf_beacon_old) % 102400;
+   tsf_remainder = (tsf_beacon - tsf_beacon_old) % 
tsf_intval;
}
 
DPRINTF(sc, ATH_DEBUG_BEACON, "%s: old_tsf=%llu, new_tsf=%llu, 
target_tsf=%llu, delta=%lld, bmiss=%d, remainder=%d\n",
@@ -409,7 +413,7 @@ ath_recv_mgmt(struct ieee80211_node *ni,
__func__,
(unsigned long long) tsf_beacon,
(unsigned long long) nexttbtt,
-   (int32_t) tsf_beacon - (int32_t) nexttbtt + 102400);
+   (int32_t) tsf_beacon - (int32_t) nexttbtt + tsf_intval);
 
if (sc->sc_syncbeacon &&
ni == vap->iv_bss &&
___
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: r265120 - head/crypto/openssl/ssl

2014-04-29 Thread Xin LI
Author: delphij
Date: Wed Apr 30 04:02:36 2014
New Revision: 265120
URL: http://svnweb.freebsd.org/changeset/base/265120

Log:
  Fix OpenSSL use-after-free vulnerability.
  
  Obtained from:OpenBSD
  Security: FreeBSD-SA-14:09.openssl
  Security: CVE-2010-5298

Modified:
  head/crypto/openssl/ssl/s3_pkt.c

Modified: head/crypto/openssl/ssl/s3_pkt.c
==
--- head/crypto/openssl/ssl/s3_pkt.cWed Apr 30 04:02:32 2014
(r265119)
+++ head/crypto/openssl/ssl/s3_pkt.cWed Apr 30 04:02:36 2014
(r265120)
@@ -1055,7 +1055,7 @@ start:
{
s->rstate=SSL_ST_READ_HEADER;
rr->off=0;
-   if (s->mode & SSL_MODE_RELEASE_BUFFERS)
+   if (s->mode & SSL_MODE_RELEASE_BUFFERS && 
s->s3->rbuf.left == 0)
ssl3_release_read_buffer(s);
}
}
___
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: r265121 - head/sys/netinet

2014-04-29 Thread Xin LI
Author: delphij
Date: Wed Apr 30 04:02:57 2014
New Revision: 265121
URL: http://svnweb.freebsd.org/changeset/base/265121

Log:
  Fix TCP reassembly vulnerability.
  
  Patch done by:glebius
  Security: FreeBSD-SA-14:08.tcp
  Security: CVE-2014-3000

Modified:
  head/sys/netinet/tcp_reass.c

Modified: head/sys/netinet/tcp_reass.c
==
--- head/sys/netinet/tcp_reass.cWed Apr 30 04:02:36 2014
(r265120)
+++ head/sys/netinet/tcp_reass.cWed Apr 30 04:02:57 2014
(r265121)
@@ -194,7 +194,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd
 * Investigate why and re-evaluate the below limit after the behaviour
 * is understood.
 */
-   if (th->th_seq != tp->rcv_nxt &&
+   if ((th->th_seq != tp->rcv_nxt || !TCPS_HAVEESTABLISHED(tp->t_state)) &&
tp->t_segqlen >= (so->so_rcv.sb_hiwat / tp->t_maxseg) + 1) {
V_tcp_reass_overflows++;
TCPSTAT_INC(tcps_rcvmemdrop);
@@ -217,7 +217,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd
 */
te = uma_zalloc(V_tcp_reass_zone, M_NOWAIT);
if (te == NULL) {
-   if (th->th_seq != tp->rcv_nxt) {
+   if (th->th_seq != tp->rcv_nxt || 
!TCPS_HAVEESTABLISHED(tp->t_state)) {
TCPSTAT_INC(tcps_rcvmemdrop);
m_freem(m);
*tlenp = 0;
@@ -265,7 +265,8 @@ tcp_reass(struct tcpcb *tp, struct tcphd
TCPSTAT_INC(tcps_rcvduppack);
TCPSTAT_ADD(tcps_rcvdupbyte, *tlenp);
m_freem(m);
-   uma_zfree(V_tcp_reass_zone, te);
+   if (te != &tqs)
+   uma_zfree(V_tcp_reass_zone, te);
tp->t_segqlen--;
/*
 * Try to present any queued 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"


svn commit: r265119 - head/etc/defaults

2014-04-29 Thread Xin LI
Author: delphij
Date: Wed Apr 30 04:02:32 2014
New Revision: 265119
URL: http://svnweb.freebsd.org/changeset/base/265119

Log:
  Fix devfs rules not applied by default for jails.
  
  Security: FreeBSD-SA-14:07.devfs
  Security: CVE-2014-3001

Modified:
  head/etc/defaults/rc.conf

Modified: head/etc/defaults/rc.conf
==
--- head/etc/defaults/rc.conf   Wed Apr 30 03:49:21 2014(r265118)
+++ head/etc/defaults/rc.conf   Wed Apr 30 04:02:32 2014(r265119)
@@ -641,7 +641,7 @@ devfs_rulesets="/etc/defaults/devfs.rule
 devfs_system_ruleset=""# The name (NOT number) of a ruleset to apply 
to /dev
 devfs_set_rulesets=""  # A list of /mount/dev=ruleset_name settings to
# apply (must be mounted already, i.e. fstab(5))
-devfs_load_rulesets="NO"   # Enable to always load the default rulesets
+devfs_load_rulesets="YES"  # Enable to always load the default rulesets
 performance_cx_lowest="HIGH"   # Online CPU idle state
 performance_cpu_freq="NONE"# Online CPU frequency
 economy_cx_lowest="HIGH"   # Offline CPU idle state
___
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: r264907 - in head/release: amd64 i386

2014-04-29 Thread Nathan Whitehorn

On 04/25/14 06:07, Glen Barber wrote:

On Fri, Apr 25, 2014 at 02:00:13PM +0400, Dmitry Morozovsky wrote:

seconded, till now the most bootable case for machines under my hands were
happy with no-partition at all (fake MBR with 50k@s4, dd from UFS)


I'm working on restoring the MBR, but need some time to test.  If
I can't get a working memstick image with the addition of an EFI
partition for the UEFI boot loader in a few hours, I'll revert this
commit.

Glen



The amd64 release scripts now include variants that build EFI/BIOS dual 
mode images. These should be bootable everywhere: stupid BIOSes that see 
GPT and try to boot with EFI will succeed since there actually is EFI. 
If you try to boot with BIOS, it will also boot that way. (Thanks to 
Marcel for mkimg, by the way, which have made the scripts much cleaner)


These cannot, however, become the defaults for the time being because 
GENERIC uses syscons and syscons does not support EFI. Adding EFI 
loaders to the image means there is an increased likelihood they will be 
used and failing to give a console afterward is not friendly behavior. 
The VT kernel configuration works with both.


So, to make universally bootable install media, we have to switch the 
default console driver to newcons. This means we need to finish 
polishing newcons and need to think about what, exactly, the missing 
pieces are to enable it as the default.

-Nathan
___
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: r262957 - in head/etc: etc.arm etc.ia64 etc.mips etc.powerpc etc.sparc64

2014-04-29 Thread Nathan Whitehorn

On 03/09/14 14:06, Marcel Moolenaar wrote:

Author: marcel
Date: Sun Mar  9 21:06:22 2014
New Revision: 262957
URL: http://svnweb.freebsd.org/changeset/base/262957

Log:
   Change the terminal type/class for enabled serial lines to 3wire. This
   allows us to change the uart(4) driver to not hardcode specific line
   settings for the serial console.
   
   A terminal type of 3wire makes sure the console still works when no DCD

   signal is present, which preserves behviour. When it is known that the
   terminal server (or DCE in general) provides DCD, a terminal type/class
   of std can be used. This has the effect of being logged out when one
   disconnects from the console -- improving security overall.
   
   Likewise, when uart(4) does not fixate the baudrate, one can change

   the terminal type/class to set a specific baudrate. An operator can use
   this to change the console speed mid-flight, without needing a reboot.
   Of course it helps in this respect if and when the firmware can be
   configured from the OS.
   
   The above mentioned capabilities depend on uart(4) being changed, which

   is to happen next.



Should we set onifconsole for x86 UARTs as well? That enables them if 
they are the kernel console and is probably a user friendliness improvement.

-Nathan
___
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: r265132 - in head: share/man/man4 sys/dev/null

2014-04-29 Thread Eitan Adler
Author: eadler
Date: Wed Apr 30 06:20:48 2014
New Revision: 265132
URL: http://svnweb.freebsd.org/changeset/base/265132

Log:
  Add a /dev/full device.
  
  /dev/full is similar to /dev/zero except it always returns
  ENOSPC when you attempt to write to it.
  
  Reviewed by:  jhibbits
  Discussed with:   rpaulo

Added:
  head/share/man/man4/full.4   (contents, props changed)
Modified:
  head/share/man/man4/null.4
  head/share/man/man4/zero.4
  head/sys/dev/null/null.c

Added: head/share/man/man4/full.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/full.4  Wed Apr 30 06:20:48 2014(r265132)
@@ -0,0 +1,47 @@
+.\" Copyright (c) 2014
+.\"Eitan Adler .  All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd March 29, 2014
+.Dt FULL 4
+.Os
+.Sh NAME
+.Nm full
+.Nd the full device
+.Sh DESCRIPTION
+The
+.Nm
+device supplies an endless stream of zeros when read.
+However, it will always be full when writing to it.
+.Sh FILES
+.Bl -tag -width /dev/full
+.It Pa /dev/full
+.El
+.Sh SEE ALSO
+.Xr null 4
+.Xr zero 4
+.Sh Author
+This device and man page was written by
+.An Eitan Adler Aq ead...@freebsd.org .

Modified: head/share/man/man4/null.4
==
--- head/share/man/man4/null.4  Wed Apr 30 06:03:01 2014(r265131)
+++ head/share/man/man4/null.4  Wed Apr 30 06:20:48 2014(r265132)
@@ -48,6 +48,7 @@ device is always zero.
 .It Pa /dev/null
 .El
 .Sh SEE ALSO
+.Xr full 4
 .Xr zero 4
 .Sh HISTORY
 A

Modified: head/share/man/man4/zero.4
==
--- head/share/man/man4/zero.4  Wed Apr 30 06:03:01 2014(r265131)
+++ head/share/man/man4/zero.4  Wed Apr 30 06:20:48 2014(r265132)
@@ -49,6 +49,7 @@ supply of null bytes when read.
 .It Pa /dev/zero
 .El
 .Sh SEE ALSO
+.Xr full 4
 .Xr null 4
 .Sh HISTORY
 A

Modified: head/sys/dev/null/null.c
==
--- head/sys/dev/null/null.cWed Apr 30 06:03:01 2014(r265131)
+++ head/sys/dev/null/null.cWed Apr 30 06:20:48 2014(r265132)
@@ -1,6 +1,7 @@
 /*-
  * Copyright (c) 2000 Mark R. V. Murray & Jeroen C. van Gelderen
  * Copyright (c) 2001-2004 Mark R. V. Murray
+ * Copyright (c) 2014 Eitan Adler
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -47,7 +48,9 @@ __FBSDID("$FreeBSD$");
 /* For use with destroy_dev(9). */
 static struct cdev *null_dev;
 static struct cdev *zero_dev;
+static struct cdev *full_dev;
 
+static d_write_t full_write;
 static d_write_t null_write;
 static d_ioctl_t null_ioctl;
 static d_ioctl_t zero_ioctl;
@@ -70,6 +73,23 @@ static struct cdevsw zero_cdevsw = {
.d_flags =  D_MMAP_ANON,
 };
 
+static struct cdevsw full_cdevsw = {
+   .d_version =D_VERSION,
+   .d_read =   zero_read,
+   .d_write =  full_write,
+   .d_ioctl =  zero_ioctl,
+   .d_name =   "full",
+};
+
+
+/* ARGSUSED */
+static int
+full_write(struct cdev *dev __unused, struct uio *uio, int flags __unused)
+{
+
+   return (ENOSPC);
+}
+
 /* ARGSUSED */
 static int
 null_write(struct cdev *dev __unused, struct uio *uio, int flags __unused)
@@ -155,7 +175,9 @@ null_modevent(module_t mod __unused, int
switch(type) {
case MOD_LOAD:
if (bootverbose)
-   printf("null: \n");
+   printf("null: \n");
+   full_dev = make_

svn commit: r265134 - head/sys/dev/null

2014-04-29 Thread Eitan Adler
Author: eadler
Date: Wed Apr 30 06:30:37 2014
New Revision: 265134
URL: http://svnweb.freebsd.org/changeset/base/265134

Log:
  null.c: fix ordering
  
  Use a consistent ordering of full -> null -> zero (alphabetical) in null.c
  
  Reported by:  mjg

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

Modified: head/sys/dev/null/null.c
==
--- head/sys/dev/null/null.cWed Apr 30 06:27:23 2014(r265133)
+++ head/sys/dev/null/null.cWed Apr 30 06:30:37 2014(r265134)
@@ -46,9 +46,9 @@ __FBSDID("$FreeBSD$");
 #include 
 
 /* For use with destroy_dev(9). */
+static struct cdev *full_dev;
 static struct cdev *null_dev;
 static struct cdev *zero_dev;
-static struct cdev *full_dev;
 
 static d_write_t full_write;
 static d_write_t null_write;
@@ -56,6 +56,14 @@ static d_ioctl_t null_ioctl;
 static d_ioctl_t zero_ioctl;
 static d_read_t zero_read;
 
+static struct cdevsw full_cdevsw = {
+   .d_version =D_VERSION,
+   .d_read =   zero_read,
+   .d_write =  full_write,
+   .d_ioctl =  zero_ioctl,
+   .d_name =   "full",
+};
+
 static struct cdevsw null_cdevsw = {
.d_version =D_VERSION,
.d_read =   (d_read_t *)nullop,
@@ -73,13 +81,6 @@ static struct cdevsw zero_cdevsw = {
.d_flags =  D_MMAP_ANON,
 };
 
-static struct cdevsw full_cdevsw = {
-   .d_version =D_VERSION,
-   .d_read =   zero_read,
-   .d_write =  full_write,
-   .d_ioctl =  zero_ioctl,
-   .d_name =   "full",
-};
 
 
 /* ARGSUSED */
___
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: r265135 - head/share/man/man4

2014-04-29 Thread Eitan Adler
Author: eadler
Date: Wed Apr 30 06:34:53 2014
New Revision: 265135
URL: http://svnweb.freebsd.org/changeset/base/265135

Log:
  man pages: add missing comma
  
  Reported by:  brueffer

Modified:
  head/share/man/man4/null.4
  head/share/man/man4/zero.4

Modified: head/share/man/man4/null.4
==
--- head/share/man/man4/null.4  Wed Apr 30 06:30:37 2014(r265134)
+++ head/share/man/man4/null.4  Wed Apr 30 06:34:53 2014(r265135)
@@ -48,7 +48,7 @@ device is always zero.
 .It Pa /dev/null
 .El
 .Sh SEE ALSO
-.Xr full 4
+.Xr full 4 ,
 .Xr zero 4
 .Sh HISTORY
 A

Modified: head/share/man/man4/zero.4
==
--- head/share/man/man4/zero.4  Wed Apr 30 06:30:37 2014(r265134)
+++ head/share/man/man4/zero.4  Wed Apr 30 06:34:53 2014(r265135)
@@ -49,7 +49,7 @@ supply of null bytes when read.
 .It Pa /dev/zero
 .El
 .Sh SEE ALSO
-.Xr full 4
+.Xr full 4 ,
 .Xr null 4
 .Sh HISTORY
 A
___
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: r265136 - head/sys/dev/null

2014-04-29 Thread Eitan Adler
Author: eadler
Date: Wed Apr 30 06:40:30 2014
New Revision: 265136
URL: http://svnweb.freebsd.org/changeset/base/265136

Log:
  null.c: uio is unused
  
  Mark another parameter as unused
  
  Reported by:  rpaulo

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

Modified: head/sys/dev/null/null.c
==
--- head/sys/dev/null/null.cWed Apr 30 06:34:53 2014(r265135)
+++ head/sys/dev/null/null.cWed Apr 30 06:40:30 2014(r265136)
@@ -85,7 +85,7 @@ static struct cdevsw zero_cdevsw = {
 
 /* ARGSUSED */
 static int
-full_write(struct cdev *dev __unused, struct uio *uio, int flags __unused)
+full_write(struct cdev *dev __unused, struct uio *uio __unused, int flags 
__unused)
 {
 
return (ENOSPC);
___
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: r265137 - head/share/man/man4

2014-04-29 Thread Eitan Adler
Author: eadler
Date: Wed Apr 30 06:54:35 2014
New Revision: 265137
URL: http://svnweb.freebsd.org/changeset/base/265137

Log:
  Add missing comma
  
  Relnotes: yes (/dev/full)

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

Modified: head/share/man/man4/full.4
==
--- head/share/man/man4/full.4  Wed Apr 30 06:40:30 2014(r265136)
+++ head/share/man/man4/full.4  Wed Apr 30 06:54:35 2014(r265137)
@@ -40,7 +40,7 @@ However, it will always be full when wri
 .It Pa /dev/full
 .El
 .Sh SEE ALSO
-.Xr null 4
+.Xr null 4 ,
 .Xr zero 4
 .Sh Author
 This device and man page was written by
___
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"