svn commit: r249398 - head/sys/netinet6

2013-04-12 Thread Andrey V. Elsukov
Author: ae
Date: Fri Apr 12 07:59:54 2013
New Revision: 249398
URL: http://svnweb.freebsd.org/changeset/base/249398

Log:
  Free memory after deleting an address policy entry.
  
  MFC after:1 week

Modified:
  head/sys/netinet6/in6_src.c

Modified: head/sys/netinet6/in6_src.c
==
--- head/sys/netinet6/in6_src.c Fri Apr 12 02:01:17 2013(r249397)
+++ head/sys/netinet6/in6_src.c Fri Apr 12 07:59:54 2013(r249398)
@@ -1100,6 +1100,7 @@ delete_addrsel_policyent(struct in6_addr
TAILQ_REMOVE(&V_addrsel_policytab, pol, ape_entry);
ADDRSEL_UNLOCK();
ADDRSEL_XUNLOCK();
+   free(pol, M_IFADDR);
 
return (0);
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r249399 - head/share/misc

2013-04-12 Thread Gavin Atkinson
Author: gavin
Date: Fri Apr 12 08:39:18 2013
New Revision: 249399
URL: http://svnweb.freebsd.org/changeset/base/249399

Log:
  Update with several early mentor/mentee relationships and dates commit
  bits were granted.  Relationships have been provided by the mentees,
  dates have been sourced from either the mentees or the CVS mailing list
  archives.
  
  Obtained from:mux, wilko, msmith, peter, schweikh
  Obtained from:gallatin, dfr, murray, jkoshy

Modified:
  head/share/misc/committers-src.dot

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Fri Apr 12 07:59:54 2013
(r249398)
+++ head/share/misc/committers-src.dot  Fri Apr 12 08:39:18 2013
(r249399)
@@ -52,7 +52,7 @@ groudier [label="Gerard Roudier\ngroudie
 jake [label="Jake Burkholder\nj...@freebsd.org\n2000/05/16\n2008/11/10"]
 jayanth [label="Jayanth 
Vijayaraghavan\njaya...@freebsd.org\n2000/05/08\n2008/11/10"]
 jb [label="John Birrell\n...@freebsd.org\n/??/??\n2009/12/15"]
-jdp [label="John Polstra\n...@freebsd.org\n/??/??\n2008/02/26"]
+jdp [label="John Polstra\n...@freebsd.org\n1995/12/07\n2008/02/26"]
 jedgar [label="Chris D. Faulhaber\njed...@freebsd.org\n1999/12/15\n2006/04/07"]
 jkh [label="Jordan K. Hubbard\n...@freebsd.org\n1993/06/12\n2008/06/13"]
 jlemon [label="Jonathan Lemon\njle...@freebsd.org\n1997/08/14\n2008/11/10"]
@@ -65,7 +65,7 @@ lulf [label="Ulf Lilleengen\nlulf@FreeBS
 mb [label="Maxim Bolotin\n...@freebsd.org\n2000/04/06\n2003/03/08"]
 marks [label="Mark Santcroos\nma...@freebsd.org\n2004/03/18\n2008/09/29"]
 mike [label="Mike Barcroft\nm...@freebsd.org\n2001/07/17\n2006/04/28"]
-msmith [label="Mike Smith\nmsm...@freebsd.org\n/??/??\n2003/12/15"]
+msmith [label="Mike Smith\nmsm...@freebsd.org\n1996/10/22\n2003/12/15"]
 murray [label="Murray Stokely\nmur...@freebsd.org\n2000/04/05\n2010/07/25"]
 mux [label="Maxime Henrion\n...@freebsd.org\n2002/03/03\n2011/06/22"]
 nate [label="Nate Willams\nn...@freebsd.org\n1993/06/12\n2003/12/15"]
@@ -153,7 +153,7 @@ fjoe [label="Max Khon\nf...@freebsd.org\
 flz [label="Florent Thoumie\n...@freebsd.org\n2006/03/30"]
 gabor [label="Gabor Kovesdan\nga...@freebsd.org\n2010/02/02"]
 gad [label="Garance A. Drosehn\n...@freebsd.org\n2000/10/27"]
-gallatin [label="Andrew Gallatin\ngalla...@freebsd.org\n/??/??"]
+gallatin [label="Andrew Gallatin\ngalla...@freebsd.org\n1999/01/15"]
 gavin [label="Gavin Atkinson\nga...@freebsd.org\n2009/12/07"]
 gibbs [label="Justin T. Gibbs\ngi...@freebsd.org\n/??/??"]
 gleb [label="Gleb Kurtsou\ng...@freebsd.org\n2011/09/19"]
@@ -188,7 +188,7 @@ joerg [label="Joerg Wunsch\njoerg@FreeBS
 jon [label="Jonathan Chen\n...@freebsd.org\n2000/10/17"]
 jonathan [label="Jonathan Anderson\njonat...@freebsd.org\n2010/10/07"]
 jpaetzel [label="Josh Paetzel\njpaet...@freebsd.org\n2011/01/21"]
-julian [label="Julian Elischer\njul...@freebsd.org\n1993/??/??"]
+julian [label="Julian Elischer\njul...@freebsd.org\n1993/04/19"]
 jwd [label="John De Boskey\n...@freebsd.org\n2000/05/19"]
 kaiw [label="Kai Wang\nk...@freebsd.org\n2007/09/26"]
 kan [label="Alexander Kabaev\n...@freebsd.org\n2002/07/21"]
@@ -202,7 +202,7 @@ lstewart [label="Lawrence Stewart\nlstew
 marcel [label="Marcel Moolenaar\nmar...@freebsd.org\n1999/07/03"]
 marius [label="Marius Strobl\nmar...@freebsd.org\n2004/04/17"]
 markj [label="Mark Johnston\nma...@freebsd.org\n2012/12/18"]
-markm [label="Mark Murray\nma...@freebsd.org\n199?/??/??"]
+markm [label="Mark Murray\nma...@freebsd.org\n1995/04/24"]
 markus [label="Markus Brueffer\nmar...@freebsd.org\n2006/06/01"]
 matteo [label="Matteo Riondato\nmat...@freebsd.org\n2006/01/18"]
 mav [label="Alexander Motin\n...@freebsd.org\n2007/04/12"]
@@ -223,7 +223,7 @@ nwhitehorn [label="Nathan Whitehorn\nnwh
 obrien [label="David E. O'Brien\nobr...@freebsd.org\n1996/10/29"]
 olli [label="Oliver Fromme\no...@freebsd.org\n2008/02/14"]
 peadar [label="Peter Edwards\npea...@freebsd.org\n2004/03/08"]
-peter [label="Peter Wemm\npe...@freebsd.org\n/??/??"]
+peter [label="Peter Wemm\npe...@freebsd.org\n1995/07/04"]
 peterj [label="Peter Jeremy\npet...@freebsd.org\n2012/09/14"]
 pfg [label="Pedro Giffuni\n...@freebsd.org\n2011/12/01"]
 philip [label="Philip Paeps\nphi...@freebsd.org\n2004/01/21"]
@@ -367,8 +367,11 @@ des -> bapt
 
 dds -> versus
 
+dfr -> gallatin
 dfr -> zml
 
+dg -> peter
+
 dim -> theraven
 
 dwmalone -> fanf
@@ -469,6 +472,8 @@ jkh -> imp
 jkh -> jlemon
 jkh -> joerg
 jkh -> jwd
+jkh -> msmith
+jkh -> murray
 jkh -> phk
 jkh -> wes
 jkh -> yar
@@ -484,6 +489,7 @@ joerg -> brian
 joerg -> eik
 joerg -> le
 joerg -> netchild
+joerg -> schweikh
 
 julian -> glebius
 julian -> davidxu
___
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: r249355 - head/lib/libkvm

2013-04-12 Thread Bruce Evans

On Thu, 11 Apr 2013, Garrett Cooper wrote:


On Apr 11, 2013, at 11:13 AM, Colin Percival wrote:


On 04/11/13 00:59, Bruce Evans wrote:

Log:
Include types.h for C99 uintXX_t types.


This adds namespace pollution that was carefully left out.


... and as a developer, I wish we left out such namespace pollution more often.

I write code on FreeBSD which I then publish with the intention that people will
be able to use it on any POSIX-compliant system, and I've lost count of the
number of times I've been hit by "this won't build on OS X or Linux because you
forgot to #include ".


Declaring uint64_t and a few other stdint types in  does tend
to give bugs like that.  And the pollution is pointless for the kernel
(which was originally the only place that used it), since  is
now polluted with an include of  -- a change that I disagee
with.  I also disagree with the existence of so many foo/[_]stdint.h headers.
There is a machine/_stdint.h and a sys/_stdint.h, a sys/stdint.h and of
course a plain stdint.h.  At least sys/_stdint.h shouldn't exist.  All it
does is avoid repeatung the ifdefs for the stdint pollution in sys/types.h.
But it was created long after the much larger pollution in sys/systm.h, so
it does nothing for the kernel.  For userland, it gives the above problem,
but it has been there for so long that it is very hard to untangle.

sys/types.h still has a comment saying that it shoudn't do this.  I have
only fixed bugs in this comment and a few nearby things:

@ Index: types.h
@ ===
@ RCS file: /home/ncvs/src/sys/sys/types.h,v
@ retrieving revision 1.90
@ diff -u -2 -r1.90 types.h
@ --- types.h   19 Jun 2004 17:58:32 -  1.90
@ +++ types.h   20 Jun 2004 02:03:26 -
@ @@ -40,8 +40,7 @@
@ 
@  #include 

@ +#include 
@ 
@ -/* Machine type dependent parameters. */

@  #include 
@ -#include 
@ 
@  #if __BSD_VISIBLE


Sort includes and remove wrong comment.  machine/endian.h doesn't contain
type parameters.  sys/_types.h contains typedefs, not parameters.

@ @@ -57,5 +56,5 @@
@ 
@  /*

@ - * XXX POSIX sized integrals that should appear only in .
@ + * XXX C99 integer types that should appear only in .
@   */
@  #ifndef _INT8_T_DECLARED

These types have nothing to do with POSIX,


Funny this would be mentioned. I've seen the converse a lot with Linux 
devs because they fail to understand that headers on Linux #include a lot more 
crud than they need to..
Devs in general don't read the [POSIX] manpages like they should to 
figure out what needs to be #include'd in order to get function/constant 
definitions. Third party devs are usually the worst offenders.


That's a bit surprising, since glibc tries much harder than FreeBSD to
avoid namespace pollution.  It has labyrinth includes, partly to avoid
namespace pollution and partly to handle machine dependencies.  This
makes even simple headers unreadable.  E.g., fcntl.h.

Bruce
___
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: r249400 - head/sys/netgraph/netflow

2013-04-12 Thread Gleb Smirnoff
Author: glebius
Date: Fri Apr 12 08:52:19 2013
New Revision: 249400
URL: http://svnweb.freebsd.org/changeset/base/249400

Log:
  Attempt to clean up spacing and long lines.

Modified:
  head/sys/netgraph/netflow/ng_netflow.h

Modified: head/sys/netgraph/netflow/ng_netflow.h
==
--- head/sys/netgraph/netflow/ng_netflow.h  Fri Apr 12 08:39:18 2013
(r249399)
+++ head/sys/netgraph/netflow/ng_netflow.h  Fri Apr 12 08:52:19 2013
(r249400)
@@ -90,7 +90,7 @@ struct ng_netflow_ifinfo {
uint32_tifinfo_packets; /* number of packets for this iface */
uint8_t ifinfo_dlt; /* Data Link Type, DLT_XXX */
 #defineMAXDLTNAMELEN   20
-   u_int16_t   ifinfo_index;   /* connected iface index */
+   uint16_tifinfo_index;   /* connected iface index */
uint32_tconf;
 };
 
@@ -98,13 +98,13 @@ struct ng_netflow_ifinfo {
 /* This structure is passed to NGM_NETFLOW_SETDLT message */
 struct ng_netflow_setdlt {
uint16_t iface; /* which iface dlt change */
-   uint8_t  dlt;   /* DLT_XXX from bpf.h */
+   uint8_t  dlt;   /* DLT_XXX from bpf.h */
 };
 
 /* This structure is passed to NGM_NETFLOW_SETIFINDEX */
 struct ng_netflow_setifindex {
-   u_int16_t iface;/* which iface index change */
-   u_int16_t index;/* new index */
+   uint16_t iface; /* which iface index change */
+   uint16_t index; /* new index */
 };
 
 /* This structure is passed to NGM_NETFLOW_SETTIMEOUTS */
@@ -126,8 +126,8 @@ struct ng_netflow_settimeouts {
 
 /* This structure is passed to NGM_NETFLOW_SETCONFIG */
 struct ng_netflow_setconfig {
-   u_int16_t iface;/* which iface config change */
-   u_int32_t conf; /* new config */
+   uint16_t iface; /* which iface config change */
+   uint32_t conf;  /* new config */
 };
 
 /* This structure is passed to NGM_NETFLOW_SETTEMPLATE */
@@ -145,7 +145,7 @@ struct ng_netflow_setmtu {
 struct ngnf_show_header {
u_char  version;/* IPv4 or IPv6 */
uint32_thash_id;/* current hash index */
-   uint32_tlist_id;/* current record number in given hash 
*/
+   uint32_tlist_id;/* current record number in hash */
uint32_tnentries;   /* number of records in response */
 };
 
@@ -164,7 +164,7 @@ struct ng_netflow_v9info {
 
 /* This is unique data, which identifies flow */
 struct flow_rec {
-   uint16_tflow_type; /* IPv4 L4/L3 flow, see NETFLOW_V9_FLOW* */
+   uint16_tflow_type;
uint16_tfib;
struct in_addr  r_src;
struct in_addr  r_dst;
@@ -187,7 +187,7 @@ struct flow_rec {
 
 /* This is unique data, which identifies flow */
 struct flow6_rec {
-   uint16_tflow_type; /* IPv4 L4/L3 Ipv6 L4/L3 flow, see 
NETFLOW_V9_FLOW* */
+   uint16_tflow_type;
uint16_tfib;
union {
struct in_addr  r_src;
@@ -224,48 +224,48 @@ struct flow6_rec {

 /* A flow entry which accumulates statistics */
 struct flow_entry_data {
-   uint16_tversion;/* Protocol version */
-   struct flow_rec r;
-   struct in_addr  next_hop;
-   uint16_tfle_o_ifx;  /* output interface index */
-#definefle_i_ifx   r.misc.i.i_ifx
+   uint16_tversion;/* Protocol version */
+   struct flow_rec r;
+   struct in_addr  next_hop;
+   uint16_tfle_o_ifx;  /* output interface index */
+#definefle_i_ifx   r.misc.i.i_ifx
uint8_t dst_mask;   /* destination route mask bits */
uint8_t src_mask;   /* source route mask bits */
-   u_long  packets;
-   u_long  bytes;
-   longfirst;  /* uptime on first packet */
-   longlast;   /* uptime on last packet */
-   u_char  tcp_flags;  /* cumulative OR */
+   u_long  packets;
+   u_long  bytes;
+   longfirst;  /* uptime on first packet */
+   longlast;   /* uptime on last packet */
+   u_char  tcp_flags;  /* cumulative OR */
 };
 
 struct flow6_entry_data {
uint16_tversion;/* Protocol version */
struct flow6_recr;
union {
-   struct in_addr  next_hop;
-   struct in6_addr next_hop6;
+   struct in_addr  next_hop;
+   struct in6_addr next_hop6;
} n;
-   uint16_tfle_o_ifx;  /* output interface index */
-#define   

Re: svn commit: r249355 - head/lib/libkvm

2013-04-12 Thread Bruce Evans

On Thu, 11 Apr 2013, Gleb Smirnoff wrote:


 Juli,

On Thu, Apr 11, 2013 at 11:05:28AM -0700, Juli Mallett wrote:
J> > On Thu, Apr 11, 2013 at 09:07:25PM +1000, Bruce Evans wrote:
J> > B> Just routine avoidance of namespace pollution.  This is easy in such a
J> > B> simple header.
J> >
J> > Sorry, with all respect, but I can't call including sys/types.h
J> > a namespace pollution.
J> >
J> > Ok, even you force me to name it that way, still I would prefer
J> > namespace pollution instead of handmade copy pasted typedefs.
J>
J> But Gleb, making such changes unilaterally is a bit of a leap.  The
J> project has mostly accepted Bruce's wisdom about trying to minimize
J> and reduce namespace pollution.  Now, this isn't a standard header so
J> it's quite a bit less of a concern, but it's not no concern.  If you
J> think that we should reverse our trend on including
J> namespace-polluting headers in system headers, we should discuss that
J> on arch@, and it shouldn't be something that's done without any
J> discussion or consideration.
J>
J> Should we expect further changes of this nature (and of the proposed
J> nature removing __size_t and __ssize_t use) if you make changes to
J> other headers as part of your work?  Are you going to add
J>  to every header currently using  in a
J> single go, or will you be doing that a little at a time when making
J> functional changes?

Your suggestion? Typedef standard uint64_t manually as size_t and ssize_t
already are done? Can you please define amount of standard types needed
for kvm.h (or any abstract header) that would give a permission to include
sys/types.h instead of typedefing all these types via a cut-n-paste
surrounded by ifdefs?


A number larger than any header needs.

 has 7 ifdefs for types (as part of carefully avoiding including
sys/types.h>) and 13 _FOO_DECLARED ifdefs for other things (maily for
functions).   has 8 for types.   has 10 for functions.
These are the largest users of _FOO_DECLARED in the installed /usr/include.


I am all against namespace pollution, but not when it comes to sys/types.h.


It has lots of historical BSD pollution (mainly endian and select).
This is carefully ifdefed under _BSD_VISIBLE.  This is another reason
not to depend on sys/types.h declaring uint64_t or anything else not
specifed by POSIX in any other header -- someone might define
_BSD_VISIBLE as 0.  It happens that uint64_t is not under any ifdef.
This is justified since it is a type ending with the reserved suffix
_t.  kvm.h is a BSD header, so defining _BSD_VISIBLE as 0 before
including it is probably invalid.  POSIX headers need to be more
careful.

The tinderbox failure mail showed another namespace error -- a new prototype
in kvm.h uses u_long.  The declaration of this in sys/types.h would _is_
turned off by BSD_VISIBLE = 0.  Old prototypes in kvm.h avoid this problem
by spelling unsigned long as itself.  Using the verbose spelling would be
a style bug in the kernel or system applications, but it must be used in
application headers since using u_long would depend on namespace pollution.

Newer pollution in sys/types.h includes everything in sys/_pthreadtypes.h,
further pollution for select (pselect(), struct timespec and everything in
sys/timespec.h.  Perhaps current POSIX allows or requires this (I know it
requires pthread stuff, since it standardized some namespace errors).  But
none of this is properly ifdefed, so you get pthread stuff and pselect()
for old POSIXes where they are not permitted in the namespace.

We have a labyrinth of timespec and timeval headers from old attempts to
avoid namespace pollution.  sys/_timespec.h is now nonsense.  Its reason
for existence was to declare struct _timespec for use in contexts where
struct timespec would be pollution.  Now it just declares struct timespec
and time_t.  The layer above this, sys/timespec.h adds just a little to it.
For timevals, there is no intermediate layer (just sys/_timeval.h).

The non-polluting sys/_timespec.h was only used in sys/stat.h, only in
old versions of FreeBSD (FreeBSD-5 and maybe some later versions).  Now
sys/stat.h just uses struct timespec, so it has namespace pollution for
old versions of POSIX.  Old versions of FreeBSD avoided this pollution
by hiding it in !_POSIX_SOURCE ifdefs.  E.g., in FreeBSD-4:

@ #ifndef _POSIX_SOURCE
@   struct  timespec st_atimespec;  /* time of last access */
@   struct  timespec st_mtimespec;  /* time of last data modification */
@   struct  timespec st_ctimespec;  /* time of last file status change */
@ #else
@   time_tst_atime; /* time of last access */
@   long  st_atimensec; /* nsec of last access */
@   time_tst_mtime; /* time of last data modification */
@   long  st_mtimensec; /* nsec of last data modification */
@   time_tst_ctime; /* time of last file status change */
@   long  st_ctimensec; /* nsec of last file status change */
@ #

Re: svn commit: r249355 - head/lib/libkvm

2013-04-12 Thread Bruce Evans

On Thu, 11 Apr 2013, Juli Mallett wrote:


On Thu, Apr 11, 2013 at 11:00 AM, Gleb Smirnoff  wrote:

  Bruce,

On Thu, Apr 11, 2013 at 09:07:25PM +1000, Bruce Evans wrote:
B> Just routine avoidance of namespace pollution.  This is easy in such a
B> simple header.

Sorry, with all respect, but I can't call including sys/types.h
a namespace pollution.

Ok, even you force me to name it that way, still I would prefer
namespace pollution instead of handmade copy pasted typedefs.


The copying gives a good implementation.  Much easier to read (though
not write) than definitions in deeply nested includes.  We have too
many little include files to avoid duplication, but a few big nested
include files like machine/_types.h are hard to avoid.


But Gleb, making such changes unilaterally is a bit of a leap.  The
project has mostly accepted Bruce's wisdom about trying to minimize
and reduce namespace pollution.  Now, this isn't a standard header so
it's quite a bit less of a concern, but it's not no concern.  If you
think that we should reverse our trend on including
namespace-polluting headers in system headers, we should discuss that
on arch@, and it shouldn't be something that's done without any
discussion or consideration.

Should we expect further changes of this nature (and of the proposed
nature removing __size_t and __ssize_t use) if you make changes to
other headers as part of your work?  Are you going to add
 to every header currently using  in a
single go, or will you be doing that a little at a time when making
functional changes?


That would be a large policy change, not to mention it would break most
C99 headers like .  C99 headers can't include POSIX headers like
 since the POSIX namespace rules don't apply to them.  Most
of them include sys/_types.h or machine/_types.h to get declarararions
like __size_t which they use to declare the limited set of typedefs
specified by C99.  C99 headers are relatively simple and mostly de-polluted.

Bruce
___
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: r249334 - head/usr.bin/ctlstat

2013-04-12 Thread Bruce Evans

On Thu, 11 Apr 2013, Kenneth D. Merry wrote:


On Thu, Apr 11, 2013 at 17:06:44 +1000, Bruce Evans wrote:

...
It is now clear that this is still too verbose, since cur_secs and prev_secs
are not used except to initialize etime.  Simplifying this gives:

etime = ctx->cur_time.tv_sec - ctx->prev_time.tv_sec +
(ctx->prev_time.tv_nsec - ctx->cur_time.tv_nsec) * 1e-9;

This might need casting to double of ctx->cur_time.tv_sec, in case time_t
is unsigned and the time went backwards.  Otherwise, this should be the
usual expression for subtracting timespecs.


The time can't go backwards in this case, because it is the system uptime.


I expected this, but was not sure where the timestamps are generated.


Using wall clock time causes problems measuring performance when NTP
decides that the system time needs to change.  I have a local patch to dd
to fix instances of bogus performance numbers due to its using wall clock
time to measure elapsed time.


All uses of gettimeofday() are suspect.  A quick grep shows other obviously
wrong ones in ping*, time and systat.

Uses of CLOCK_REALTIME are hopefully correct, but about half of them in
/usr/src/*bin seem to be incorrect.  ktrace and truss are interesting.
Real times are used and are probably best for absolute times but wrong
for relative times.

Bruce
___
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: r249403 - head/sys/modules/ata/atacbus

2013-04-12 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Apr 12 13:56:21 2013
New Revision: 249403
URL: http://svnweb.freebsd.org/changeset/base/249403

Log:
  isa_if.h is indirectly included.
  Depend on it to unbreak pc98 builds.

Modified:
  head/sys/modules/ata/atacbus/Makefile

Modified: head/sys/modules/ata/atacbus/Makefile
==
--- head/sys/modules/ata/atacbus/Makefile   Fri Apr 12 13:04:23 2013
(r249402)
+++ head/sys/modules/ata/atacbus/Makefile   Fri Apr 12 13:56:21 2013
(r249403)
@@ -4,6 +4,6 @@
 
 KMOD=  atacbus
 SRCS=  ata-cbus.c
-SRCS+= ata_if.h bus_if.h device_if.h bus_if.h
+SRCS+= ata_if.h isa_if.h bus_if.h device_if.h bus_if.h
 
 .include 
___
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: r249404 - head/usr.bin/at

2013-04-12 Thread Pietro Cerutti
Author: gahr (ports committer)
Date: Fri Apr 12 14:19:44 2013
New Revision: 249404
URL: http://svnweb.freebsd.org/changeset/base/249404

Log:
  - Switch order of setting real uid and gid. If we set uid first, then we
don't have enough privileges to set gid.
  
This looks like a long standing bug, just recently revealed by r241852.
  
  Approved by:  cognet

Modified:
  head/usr.bin/at/privs.h   (contents, props changed)

Modified: head/usr.bin/at/privs.h
==
--- head/usr.bin/at/privs.h Fri Apr 12 13:56:21 2013(r249403)
+++ head/usr.bin/at/privs.h Fri Apr 12 14:19:44 2013(r249404)
@@ -99,8 +99,8 @@ gid_t real_gid, effective_gid;
PRIV_START \
effective_uid = (a); \
effective_gid = (b); \
-   if (setreuid((uid_t)-1, effective_uid) != 0) err(1, "setreuid failed"); 
\
if (setregid((gid_t)-1, effective_gid) != 0) err(1, "setregid failed"); 
\
+   if (setreuid((uid_t)-1, effective_uid) != 0) err(1, "setreuid failed"); 
\
PRIV_END \
 }
 #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"


svn commit: r249406 - head/usr.bin/at

2013-04-12 Thread Pietro Cerutti
Author: gahr (ports committer)
Date: Fri Apr 12 14:32:16 2013
New Revision: 249406
URL: http://svnweb.freebsd.org/changeset/base/249406

Log:
  - Do not bail out if stat(2) fails with ENOENT in the spool directory. This
happens if another atrm process removes a job while we're scanning through
the directory.
  - While at it, optimize a bit the directory scanning, so that we quit looping
as soon as all jobs specified in argv have been dealt with.
  
  Approved by:  cognet

Modified:
  head/usr.bin/at/at.c

Modified: head/usr.bin/at/at.c
==
--- head/usr.bin/at/at.cFri Apr 12 14:23:21 2013(r249405)
+++ head/usr.bin/at/at.cFri Apr 12 14:32:16 2013(r249406)
@@ -531,6 +531,10 @@ process_jobs(int argc, char **argv, int 
 /* Delete every argument (job - ID) given
  */
 int i;
+int rc;
+int nofJobs;
+int nofDone;
+int statErrno;
 struct stat buf;
 DIR *spool;
 struct dirent *dirent;
@@ -538,6 +542,9 @@ process_jobs(int argc, char **argv, int 
 char queue;
 long jobno;
 
+nofJobs = argc - optind;
+nofDone = 0;
+
 PRIV_START
 
 if (chdir(ATJOB_DIR) != 0)
@@ -553,9 +560,20 @@ process_jobs(int argc, char **argv, int 
 while((dirent = readdir(spool)) != NULL) {
 
PRIV_START
-   if (stat(dirent->d_name, &buf) != 0)
-   perr("cannot stat in " ATJOB_DIR);
+   rc = stat(dirent->d_name, &buf);
+   statErrno = errno;
PRIV_END
+   /* There's a race condition between readdir above and stat here:
+* another atrm process could have removed the file from the spool
+* directory under our nose. If this happens, stat will set errno to
+* ENOENT, which we shouldn't treat as fatal.
+*/
+   if (rc != 0) {
+   if (statErrno == ENOENT)
+   continue;
+   else
+   perr("cannot stat in " ATJOB_DIR);
+   }
 
if(sscanf(dirent->d_name, "%c%5lx%8lx", &queue, &jobno, &ctm)!=3)
continue;
@@ -601,9 +619,15 @@ process_jobs(int argc, char **argv, int 
errx(EXIT_FAILURE, "internal error, process_jobs = %d",
what);
}
+
+   /* All arguments have been processed
+*/
+   if (++nofDone == nofJobs)
+   goto end;
}
}
 }
+end:
 closedir(spool);
 } /* delete_jobs */
 
___
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: r249407 - in head: bin/sh tools/regression/bin/sh/execution

2013-04-12 Thread Jilles Tjoelker
Author: jilles
Date: Fri Apr 12 15:19:35 2013
New Revision: 249407
URL: http://svnweb.freebsd.org/changeset/base/249407

Log:
  sh: Don't modify exit status when break/continue/return passes !.
  
  This matches what would happen if  ! P  were to be replaced with
  if P; then false; else true; fi.
  
  Example:
f() { ! return 0; }; f

Added:
  head/tools/regression/bin/sh/execution/not1.0   (contents, props changed)
  head/tools/regression/bin/sh/execution/not2.0   (contents, props changed)
Modified:
  head/bin/sh/eval.c

Modified: head/bin/sh/eval.c
==
--- head/bin/sh/eval.c  Fri Apr 12 14:32:16 2013(r249406)
+++ head/bin/sh/eval.c  Fri Apr 12 15:19:35 2013(r249407)
@@ -279,6 +279,8 @@ evaltree(union node *n, int flags)
break;
case NNOT:
evaltree(n->nnot.com, EV_TESTED);
+   if (evalskip)
+   goto out;
exitstatus = !exitstatus;
break;
 

Added: head/tools/regression/bin/sh/execution/not1.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/bin/sh/execution/not1.0   Fri Apr 12 15:19:35 
2013(r249407)
@@ -0,0 +1,4 @@
+# $FreeBSD$
+
+f() { ! return $1; }
+f 0 && ! f 1

Added: head/tools/regression/bin/sh/execution/not2.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/bin/sh/execution/not2.0   Fri Apr 12 15:19:35 
2013(r249407)
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+while :; do
+   ! break
+   exit 3
+done
___
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: r249408 - head/sys/kern

2013-04-12 Thread Jayachandran C.
Author: jchandra
Date: Fri Apr 12 15:58:53 2013
New Revision: 249408
URL: http://svnweb.freebsd.org/changeset/base/249408

Log:
  Fix kenv behavior when there is no static environment
  
  In case where there are no static kernel environment entries, the
  function init_dynamic_kenv() adds an incorrect entry at position 0 of
  the dynamic kernel environment. This in turn causes kenv(1) to print
  and empty list even though there are dynamic entries added later.
  
  Fix this by checking env_pos in init_dynamic_kenv() and adding dynamic
  entries only if there are static entries.

Modified:
  head/sys/kern/kern_environment.c

Modified: head/sys/kern/kern_environment.c
==
--- head/sys/kern/kern_environment.cFri Apr 12 15:19:35 2013
(r249407)
+++ head/sys/kern/kern_environment.cFri Apr 12 15:58:53 2013
(r249408)
@@ -231,20 +231,23 @@ init_dynamic_kenv(void *data __unused)
kenvp = malloc((KENV_SIZE + 1) * sizeof(char *), M_KENV,
M_WAITOK | M_ZERO);
i = 0;
-   for (cp = kern_envp; cp != NULL; cp = kernenv_next(cp)) {
-   len = strlen(cp) + 1;
-   if (len > KENV_MNAMELEN + 1 + KENV_MVALLEN + 1) {
-   printf("WARNING: too long kenv string, ignoring %s\n",
-   cp);
-   continue;
+   if (env_pos > 0) {
+   for (cp = kern_envp; cp != NULL; cp = kernenv_next(cp)) {
+   len = strlen(cp) + 1;
+   if (len > KENV_MNAMELEN + 1 + KENV_MVALLEN + 1) {
+   printf(
+   "WARNING: too long kenv string, ignoring %s\n",
+   cp);
+   continue;
+   }
+   if (i < KENV_SIZE) {
+   kenvp[i] = malloc(len, M_KENV, M_WAITOK);
+   strcpy(kenvp[i++], cp);
+   } else
+   printf(
+   "WARNING: too many kenv strings, ignoring %s\n",
+   cp);
}
-   if (i < KENV_SIZE) {
-   kenvp[i] = malloc(len, M_KENV, M_WAITOK);
-   strcpy(kenvp[i++], cp);
-   } else
-   printf(
-   "WARNING: too many kenv strings, ignoring %s\n",
-   cp);
}
kenvp[i] = NULL;
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r249409 - head/sys/mips/nlm/dev/net

2013-04-12 Thread Jayachandran C.
Author: jchandra
Date: Fri Apr 12 16:03:22 2013
New Revision: 249409
URL: http://svnweb.freebsd.org/changeset/base/249409

Log:
  Fix incorrect KASSERTs in xlpge
  
  Fix for crash in Netlogic XLP network accelerator driver when invariants
  are enabled - use correct the condition for KASSERT.

Modified:
  head/sys/mips/nlm/dev/net/xlpge.c

Modified: head/sys/mips/nlm/dev/net/xlpge.c
==
--- head/sys/mips/nlm/dev/net/xlpge.c   Fri Apr 12 15:58:53 2013
(r249408)
+++ head/sys/mips/nlm/dev/net/xlpge.c   Fri Apr 12 16:03:22 2013
(r249409)
@@ -975,7 +975,7 @@ nlm_mii_pollstat(void *arg)
if (sc->mii_bus) {
mii = device_get_softc(sc->mii_bus);
 
-   KASSERT(mii == NULL, ("mii ptr is NULL"));
+   KASSERT(mii != NULL, ("mii ptr is NULL"));
 
mii_pollstat(mii);
 
@@ -1143,7 +1143,7 @@ get_buf(void)
 #ifdef INVARIANTS
temp1 = vtophys((vm_offset_t) m_new->m_data);
temp2 = vtophys((vm_offset_t) m_new->m_data + 1536);
-   KASSERT((temp1 + 1536) != temp2,
+   KASSERT((temp1 + 1536) == temp2,
("Alloced buffer is not contiguous"));
 #endif
return ((void *)m_new->m_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: r249410 - in head/sys: amd64/conf arm/conf cam/ctl conf i386/conf ia64/conf modules/ctl sparc64/conf

2013-04-12 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri Apr 12 16:25:03 2013
New Revision: 249410
URL: http://svnweb.freebsd.org/changeset/base/249410

Log:
  Remove ctl(4) from GENERIC.  Also remove 'options CTL_DISABLE'
  and kern.cam.ctl.disable tunable; those were introduced as a workaround
  to make it possible to boot GENERIC on low memory machines.
  
  With ctl(4) being built as a module and automatically loaded by ctladm(8),
  this makes CTL work out of the box.
  
  Reviewed by:  ken
  Sponsored by: FreeBSD Foundation

Modified:
  head/sys/amd64/conf/GENERIC
  head/sys/arm/conf/ATMEL
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl_backend.c
  head/sys/cam/ctl/ctl_frontend_cam_sim.c
  head/sys/cam/ctl/ctl_frontend_internal.c
  head/sys/cam/ctl/scsi_ctl.c
  head/sys/conf/options
  head/sys/i386/conf/GENERIC
  head/sys/i386/conf/PAE
  head/sys/ia64/conf/GENERIC
  head/sys/modules/ctl/Makefile
  head/sys/sparc64/conf/GENERIC

Modified: head/sys/amd64/conf/GENERIC
==
--- head/sys/amd64/conf/GENERIC Fri Apr 12 16:03:22 2013(r249409)
+++ head/sys/amd64/conf/GENERIC Fri Apr 12 16:25:03 2013(r249410)
@@ -137,10 +137,7 @@ device sa  # Sequential Access 
(tape et
 device cd  # CD
 device pass# Passthrough device (direct ATA/SCSI access)
 device ses # Enclosure Services (SES and SAF-TE)
-device ctl # CAM Target Layer
-optionsCTL_DISABLE # Disable CTL by default to save memory.
-   # Re-enable with kern.cam.ctl.disable=0 in
-   # /boot/loader.conf
+#devicectl # CAM Target Layer
 
 # RAID controllers interfaced to the SCSI subsystem
 device amr # AMI MegaRAID

Modified: head/sys/arm/conf/ATMEL
==
--- head/sys/arm/conf/ATMEL Fri Apr 12 16:03:22 2013(r249409)
+++ head/sys/arm/conf/ATMEL Fri Apr 12 16:25:03 2013(r249410)
@@ -150,7 +150,7 @@ device  sa  # Sequential Access 
(tape et
 device cd  # CD
 device pass# Passthrough device (direct ATA/SCSI access)
 device ses # Enclosure Services (SES and SAF-TE)
-device ctl # CAM Target Layer
+#devicectl # CAM Target Layer
 
 # Serial (COM) ports
 device uart# Multi-uart driver

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Fri Apr 12 16:03:22 2013(r249409)
+++ head/sys/cam/ctl/ctl.c  Fri Apr 12 16:25:03 2013(r249410)
@@ -79,8 +79,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "opt_ctl.h"
-
 struct ctl_softc *control_softc = NULL;
 
 /*
@@ -320,16 +318,8 @@ static int persis_offset;
 static uint8_t ctl_pause_rtr;
 static int ctl_is_single = 1;
 static int index_to_aps_page;
-#ifdef CTL_DISABLE
-int   ctl_disable = 1;
-#else
-int   ctl_disable = 0;
-#endif
 
 SYSCTL_NODE(_kern_cam, OID_AUTO, ctl, CTLFLAG_RD, 0, "CAM Target Layer");
-SYSCTL_INT(_kern_cam_ctl, OID_AUTO, disable, CTLFLAG_RDTUN, &ctl_disable, 0,
-  "Disable CTL");
-TUNABLE_INT("kern.cam.ctl.disable", &ctl_disable);
 
 /*
  * Serial number (0x80), device id (0x83), and supported pages (0x00)
@@ -966,10 +956,6 @@ ctl_init(void)
ctl_pause_rtr = 0;
 rcv_sync_msg = 0;
 
-   /* If we're disabled, don't initialize. */
-   if (ctl_disable != 0)
-   return (0);
-
control_softc = malloc(sizeof(*control_softc), M_DEVBUF,
   M_WAITOK | M_ZERO);
softc = control_softc;

Modified: head/sys/cam/ctl/ctl_backend.c
==
--- head/sys/cam/ctl/ctl_backend.c  Fri Apr 12 16:03:22 2013
(r249409)
+++ head/sys/cam/ctl/ctl_backend.c  Fri Apr 12 16:25:03 2013
(r249410)
@@ -62,7 +62,6 @@ __FBSDID("$FreeBSD$");
 #include 
 
 extern struct ctl_softc *control_softc;
-extern int ctl_disable;
 
 int
 ctl_backend_register(struct ctl_backend_driver *be)
@@ -72,10 +71,6 @@ ctl_backend_register(struct ctl_backend_
 
ctl_softc = control_softc;
 
-   /* Don't continue if CTL is disabled */
-   if (ctl_disable != 0)
-   return (0);
-
mtx_lock(&ctl_softc->ctl_lock);
/*
 * Sanity check, make sure this isn't a duplicate registration.

Modified: head/sys/cam/ctl/ctl_frontend_cam_sim.c
==
--- head/sys/cam/ctl/ctl_frontend_cam_sim.c Fri Apr 12 16:03:22 2013
(r249409)
+++ head/sys/cam/ctl/ctl_frontend_cam_sim.c Fri Apr 12 16:25:03 2013
(r249410)
@@ -

svn commit: r249411 - head/sys/netinet

2013-04-12 Thread Andrey V. Elsukov
Author: ae
Date: Fri Apr 12 16:29:15 2013
New Revision: 249411
URL: http://svnweb.freebsd.org/changeset/base/249411

Log:
  Reflect removing of the counter_u64_subtract() function in the macro.

Modified:
  head/sys/netinet/ip_var.h

Modified: head/sys/netinet/ip_var.h
==
--- head/sys/netinet/ip_var.h   Fri Apr 12 16:25:03 2013(r249410)
+++ head/sys/netinet/ip_var.h   Fri Apr 12 16:29:15 2013(r249411)
@@ -173,9 +173,9 @@ VNET_DECLARE(struct ipstat_p, ipstatp);
  * stats.
  */
 #defineIPSTAT_ADD(name, val)   counter_u64_add(V_ipstatp.name, (val))
-#defineIPSTAT_SUB(name, val)   counter_u64_subtract(V_ipstatp.name, 
(val))
+#defineIPSTAT_SUB(name, val)   IPSTAT_ADD(name, -(val))
 #defineIPSTAT_INC(name)IPSTAT_ADD(name, 1)
-#defineIPSTAT_DEC(name)IPSTAT_ADD(name, -1)
+#defineIPSTAT_DEC(name)IPSTAT_SUB(name, 1)
 
 /*
  * Kernel module consumers must use this accessor macro.
___
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: r249412 - head/share/man/man9

2013-04-12 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri Apr 12 16:36:18 2013
New Revision: 249412
URL: http://svnweb.freebsd.org/changeset/base/249412

Log:
  Fix usage for soreceive(9) - uio must always be non-NULL.
  
  MFC after:1 week

Modified:
  head/share/man/man9/socket.9

Modified: head/share/man/man9/socket.9
==
--- head/share/man/man9/socket.9Fri Apr 12 16:29:15 2013
(r249411)
+++ head/share/man/man9/socket.9Fri Apr 12 16:36:18 2013
(r249412)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 14, 2006
+.Dd April 12, 2013
 .Dt SOCKET 9
 .Os
 .Sh NAME
@@ -208,12 +208,19 @@ Data may be retrieved directly to kernel
 argument, or as an mbuf chain returned to the caller via
 .Fa mp0 ,
 avoiding a data copy.
-Only one of the
+The
 .Fa uio
-or
-.Fa mp0
-pointers may be
+must always be
 .Pf non- Dv NULL .
+If
+.Fa mp0
+is
+.Pf non- Dv NULL ,
+only the
+.Pf uio_resid
+of
+.Fa uio
+is used.
 The caller may optionally retrieve a socket address on a protocol with the
 .Dv PR_ADDR
 capability by providing storage via
___
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: r249413 - head/share/misc

2013-04-12 Thread Gavin Atkinson
Author: gavin
Date: Fri Apr 12 17:01:07 2013
New Revision: 249413
URL: http://svnweb.freebsd.org/changeset/base/249413

Log:
  Add some more dates and relationships.
  
  Submitted by: jkoshy, gj, dfr

Modified:
  head/share/misc/committers-src.dot

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Fri Apr 12 16:36:18 2013
(r249412)
+++ head/share/misc/committers-src.dot  Fri Apr 12 17:01:07 2013
(r249413)
@@ -48,10 +48,11 @@ dmlb [label="Duncan Barclay\ndmlb@FreeBS
 dougb [label="Doug Barton\ndo...@freebsd.org\n2000/10/26\n2012/10/08"]
 eik [label="Oliver Eikemeier\n...@freebsd.org\n2004/05/20\n2008/11/10"]
 furuta [label="Atsushi Furuta\nfur...@freebsd.org\n2000/06/21\n2003/03/08"]
+gj [label="Gary L. Jennejohn\n...@freebsd.org\n1994/??/??\n2006/04/28"]
 groudier [label="Gerard Roudier\ngroud...@freebsd.org\n1999/12/30\n2006/04/06"]
 jake [label="Jake Burkholder\nj...@freebsd.org\n2000/05/16\n2008/11/10"]
 jayanth [label="Jayanth 
Vijayaraghavan\njaya...@freebsd.org\n2000/05/08\n2008/11/10"]
-jb [label="John Birrell\n...@freebsd.org\n/??/??\n2009/12/15"]
+jb [label="John Birrell\n...@freebsd.org\n1997/03/27\n2009/12/15"]
 jdp [label="John Polstra\n...@freebsd.org\n1995/12/07\n2008/02/26"]
 jedgar [label="Chris D. Faulhaber\njed...@freebsd.org\n1999/12/15\n2006/04/07"]
 jkh [label="Jordan K. Hubbard\n...@freebsd.org\n1993/06/12\n2008/06/13"]
@@ -143,7 +144,7 @@ dwmalone [label="David Malone\ndwmalone@
 eadler [label="Eitan Adler\nead...@freebsd.org\n2012/01/18"]
 ed [label="Ed Schouten\n...@freebsd.org\n2008/05/22"]
 edwin [label="Edwin Groothuis\ned...@freebsd.org\n2007/06/25"]
-eivind [label="Eivind Eklund\neiv...@freebsd.org\n/??/??"]
+eivind [label="Eivind Eklund\neiv...@freebsd.org\n1997/02/02"]
 emaste [label="Ed Maste\nema...@freebsd.org\n2005/10/04"]
 emax [label="Maksim Yevmenkin\ne...@freebsd.org\n2003/10/12"]
 eri [label="Ermal Luci\n...@freebsd.org\n2008/06/11"]
@@ -467,6 +468,8 @@ jhb -> rnoland
 
 jimharris -> carl
 
+jkh -> dfr
+jkh -> gj
 jkh -> grog
 jkh -> imp
 jkh -> jlemon
@@ -574,6 +577,7 @@ philip -> jls
 philip -> matteo
 philip -> uqs
 
+phk -> jkoshy
 phk -> mux
 
 pjd -> kib
___
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: r249415 - in head/sys/mips: include mips

2013-04-12 Thread Jayachandran C.
Author: jchandra
Date: Fri Apr 12 17:22:12 2013
New Revision: 249415
URL: http://svnweb.freebsd.org/changeset/base/249415

Log:
  Move MIPS_MAX_TLB_ENTRIES definition from cpuregs.h to tlb.c
  
  Having MIPS_MAX_TLB_ENTRIES defined to 128 is misleading, since it used
  to be 64 in older releases of MIPS architecture (where it could be read
  from Config1) and can be much more than 128 for the newer processors.
  
  For now, move the definition to the only file using it (mips/mips/tlb.c)
  and define MIPS_MAX_TLB_ENTRIES depending on the MIPS cpu defined. Also
  add few checks so that we do not write beyond the end of the tlb_state
  array.
  
  This fixes a kernel data corruption seen in Netlogic XLP, which was casued
  by tlb_save() writing beyond the end of tlb_state array when breaking into
  debugger.

Modified:
  head/sys/mips/include/cpuregs.h
  head/sys/mips/mips/tlb.c

Modified: head/sys/mips/include/cpuregs.h
==
--- head/sys/mips/include/cpuregs.h Fri Apr 12 17:15:47 2013
(r249414)
+++ head/sys/mips/include/cpuregs.h Fri Apr 12 17:22:12 2013
(r249415)
@@ -521,7 +521,6 @@
 
 #define MIPS_CONFIG1_TLBSZ_MASK0x7E00  /* bits 30..25 
# tlb entries minus one */
 #define MIPS_CONFIG1_TLBSZ_SHIFT   25
-#defineMIPS_MAX_TLB_ENTRIES128
 
 #define MIPS_CONFIG1_IS_MASK   0x01C0  /* bits 24..22 icache 
sets per way */
 #define MIPS_CONFIG1_IS_SHIFT  22

Modified: head/sys/mips/mips/tlb.c
==
--- head/sys/mips/mips/tlb.cFri Apr 12 17:15:47 2013(r249414)
+++ head/sys/mips/mips/tlb.cFri Apr 12 17:22:12 2013(r249415)
@@ -40,6 +40,14 @@
 #include 
 #include 
 
+#if defined(CPU_CNMIPS)
+#defineMIPS_MAX_TLB_ENTRIES128
+#elif defined(CPU_NLM)
+#defineMIPS_MAX_TLB_ENTRIES(2048 + 128)
+#else
+#defineMIPS_MAX_TLB_ENTRIES64
+#endif
+
 struct tlb_state {
unsigned wired;
struct tlb_entry {
@@ -264,12 +272,15 @@ tlb_invalidate_range(pmap_t pmap, vm_off
 void
 tlb_save(void)
 {
-   unsigned i, cpu;
+   unsigned ntlb, i, cpu;
 
cpu = PCPU_GET(cpuid);
-
+   if (num_tlbentries > MIPS_MAX_TLB_ENTRIES)
+   ntlb = MIPS_MAX_TLB_ENTRIES;
+   else
+   ntlb = num_tlbentries;
tlb_state[cpu].wired = mips_rd_wired();
-   for (i = 0; i < num_tlbentries; i++) {
+   for (i = 0; i < ntlb; i++) {
mips_wr_index(i);
tlb_read();
 
@@ -329,7 +340,7 @@ tlb_invalidate_one(unsigned i)
 DB_SHOW_COMMAND(tlb, ddb_dump_tlb)
 {
register_t ehi, elo0, elo1;
-   unsigned i, cpu;
+   unsigned i, cpu, ntlb;
 
/*
 * XXX
@@ -344,12 +355,18 @@ DB_SHOW_COMMAND(tlb, ddb_dump_tlb)
db_printf("Invalid CPU %u\n", cpu);
return;
}
+   if (num_tlbentries > MIPS_MAX_TLB_ENTRIES) {
+   ntlb = MIPS_MAX_TLB_ENTRIES;
+   db_printf("Warning: Only %d of %d TLB entries saved!\n",
+   ntlb, num_tlbentries);
+   } else
+   ntlb = num_tlbentries;
 
if (cpu == PCPU_GET(cpuid))
tlb_save();
 
db_printf("Beginning TLB dump for CPU %u...\n", cpu);
-   for (i = 0; i < num_tlbentries; i++) {
+   for (i = 0; i < ntlb; i++) {
if (i == tlb_state[cpu].wired) {
if (i != 0)
db_printf("^^^ WIRED ENTRIES ^^^\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: r249416 - head/sys/dev/nvme

2013-04-12 Thread Jim Harris
Author: jimharris
Date: Fri Apr 12 17:34:49 2013
New Revision: 249416
URL: http://svnweb.freebsd.org/changeset/base/249416

Log:
  Do not panic when a busdma mapping operation fails.
  
  Instead, print an error message and fail the associated command with
  DATA_TRANSFER_ERROR NVMe completion status.
  
  Sponsored by: Intel

Modified:
  head/sys/dev/nvme/nvme.c
  head/sys/dev/nvme/nvme_qpair.c

Modified: head/sys/dev/nvme/nvme.c
==
--- head/sys/dev/nvme/nvme.cFri Apr 12 17:22:12 2013(r249415)
+++ head/sys/dev/nvme/nvme.cFri Apr 12 17:34:49 2013(r249416)
@@ -235,7 +235,13 @@ nvme_payload_map(void *arg, bus_dma_segm
struct nvme_tracker *tr = arg;
uint32_tcur_nseg;
 
-   KASSERT(error == 0, ("nvme_payload_map error != 0\n"));
+   /*
+* If the mapping operation failed, return immediately.  The caller
+*  is responsible for detecting the error status and failing the
+*  tracker manually.
+*/
+   if (error != 0)
+   return;
 
/*
 * Note that we specified PAGE_SIZE for alignment and max

Modified: head/sys/dev/nvme/nvme_qpair.c
==
--- head/sys/dev/nvme/nvme_qpair.c  Fri Apr 12 17:22:12 2013
(r249415)
+++ head/sys/dev/nvme/nvme_qpair.c  Fri Apr 12 17:34:49 2013
(r249416)
@@ -702,7 +702,7 @@ static void
 _nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req)
 {
struct nvme_tracker *tr;
-   int err;
+   int err = 0;
 
mtx_assert(&qpair->lock, MA_OWNED);
 
@@ -745,7 +745,8 @@ _nvme_qpair_submit_request(struct nvme_q
err = bus_dmamap_load(tr->qpair->dma_tag, tr->payload_dma_map,
req->u.payload, req->payload_size, nvme_payload_map, tr, 0);
if (err != 0)
-   panic("bus_dmamap_load returned non-zero!\n");
+   nvme_printf(qpair->ctrlr,
+   "bus_dmamap_load returned 0x%x!\n", err);
break;
case NVME_REQUEST_NULL:
nvme_qpair_submit_tracker(tr->qpair, tr);
@@ -755,20 +756,36 @@ _nvme_qpair_submit_request(struct nvme_q
tr->payload_dma_map, req->u.uio, nvme_payload_map_uio,
tr, 0);
if (err != 0)
-   panic("bus_dmamap_load_uio returned non-zero!\n");
+   nvme_printf(qpair->ctrlr,
+   "bus_dmamap_load_uio returned 0x%x!\n", err);
break;
 #ifdef NVME_UNMAPPED_BIO_SUPPORT
case NVME_REQUEST_BIO:
err = bus_dmamap_load_bio(tr->qpair->dma_tag,
tr->payload_dma_map, req->u.bio, nvme_payload_map, tr, 0);
if (err != 0)
-   panic("bus_dmamap_load_bio returned non-zero!\n");
+   nvme_printf(qpair->ctrlr,
+   "bus_dmamap_load_bio returned 0x%x!\n", err);
break;
 #endif
default:
panic("unknown nvme request type 0x%x\n", req->type);
break;
}
+
+   if (err != 0) {
+   /*
+* The dmamap operation failed, so we manually fail the
+*  tracker here with DATA_TRANSFER_ERROR status.
+*
+* nvme_qpair_manual_complete_tracker must not be called
+*  with the qpair lock held.
+*/
+   mtx_unlock(&qpair->lock);
+   nvme_qpair_manual_complete_tracker(qpair, tr, NVME_SCT_GENERIC,
+   NVME_SC_DATA_TRANSFER_ERROR, 1 /* do not retry */, TRUE);
+   mtx_lock(&qpair->lock);
+   }
 }
 
 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: r249417 - head/sys/dev/nvme

2013-04-12 Thread Jim Harris
Author: jimharris
Date: Fri Apr 12 17:36:48 2013
New Revision: 249417
URL: http://svnweb.freebsd.org/changeset/base/249417

Log:
  Rename the controller's fail_req_lock, so that it can be used for other
  locking operations on the controller.
  
  Sponsored by: Intel

Modified:
  head/sys/dev/nvme/nvme_ctrlr.c
  head/sys/dev/nvme/nvme_private.h

Modified: head/sys/dev/nvme/nvme_ctrlr.c
==
--- head/sys/dev/nvme/nvme_ctrlr.c  Fri Apr 12 17:34:49 2013
(r249416)
+++ head/sys/dev/nvme/nvme_ctrlr.c  Fri Apr 12 17:36:48 2013
(r249417)
@@ -307,9 +307,9 @@ nvme_ctrlr_post_failed_request(struct nv
 struct nvme_request *req)
 {
 
-   mtx_lock(&ctrlr->fail_req_lock);
+   mtx_lock(&ctrlr->lock);
STAILQ_INSERT_TAIL(&ctrlr->fail_req, req, stailq);
-   mtx_unlock(&ctrlr->fail_req_lock);
+   mtx_unlock(&ctrlr->lock);
taskqueue_enqueue(ctrlr->taskqueue, &ctrlr->fail_req_task);
 }
 
@@ -319,14 +319,14 @@ nvme_ctrlr_fail_req_task(void *arg, int 
struct nvme_controller  *ctrlr = arg;
struct nvme_request *req;
 
-   mtx_lock(&ctrlr->fail_req_lock);
+   mtx_lock(&ctrlr->lock);
while (!STAILQ_EMPTY(&ctrlr->fail_req)) {
req = STAILQ_FIRST(&ctrlr->fail_req);
STAILQ_REMOVE_HEAD(&ctrlr->fail_req, stailq);
nvme_qpair_manual_complete_request(req->qpair, req,
NVME_SCT_GENERIC, NVME_SC_ABORTED_BY_REQUEST, TRUE);
}
-   mtx_unlock(&ctrlr->fail_req_lock);
+   mtx_unlock(&ctrlr->lock);
 }
 
 static int
@@ -935,6 +935,8 @@ nvme_ctrlr_construct(struct nvme_control
 
ctrlr->dev = dev;
 
+   mtx_init(&ctrlr->lock, "nvme ctrlr lock", NULL, MTX_DEF);
+
status = nvme_ctrlr_allocate_bar(ctrlr);
 
if (status != 0)
@@ -1033,8 +1035,6 @@ intx:
TASK_INIT(&ctrlr->reset_task, 0, nvme_ctrlr_reset_task, ctrlr);
 
TASK_INIT(&ctrlr->fail_req_task, 0, nvme_ctrlr_fail_req_task, ctrlr);
-   mtx_init(&ctrlr->fail_req_lock, "nvme ctrlr fail req lock", NULL,
-   MTX_DEF);
STAILQ_INIT(&ctrlr->fail_req);
ctrlr->is_failed = FALSE;
 

Modified: head/sys/dev/nvme/nvme_private.h
==
--- head/sys/dev/nvme/nvme_private.hFri Apr 12 17:34:49 2013
(r249416)
+++ head/sys/dev/nvme/nvme_private.hFri Apr 12 17:36:48 2013
(r249417)
@@ -247,6 +247,8 @@ struct nvme_controller {
 
device_tdev;
 
+   struct mtx  lock;
+
uint32_tready_timeout_in_ms;
 
bus_space_tag_t bus_tag;
@@ -325,7 +327,6 @@ struct nvme_controller {
 
uint32_tis_resetting;
 
-   struct mtx  fail_req_lock;
boolean_t   is_failed;
STAILQ_HEAD(, nvme_request) fail_req;
 
___
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: r249418 - head/sys/dev/nvme

2013-04-12 Thread Jim Harris
Author: jimharris
Date: Fri Apr 12 17:41:24 2013
New Revision: 249418
URL: http://svnweb.freebsd.org/changeset/base/249418

Log:
  Add a mutex to each namespace, for general locking operations on the 
namespace.
  
  Sponsored by: Intel

Modified:
  head/sys/dev/nvme/nvme_ns.c
  head/sys/dev/nvme/nvme_private.h

Modified: head/sys/dev/nvme/nvme_ns.c
==
--- head/sys/dev/nvme/nvme_ns.c Fri Apr 12 17:36:48 2013(r249417)
+++ head/sys/dev/nvme/nvme_ns.c Fri Apr 12 17:41:24 2013(r249418)
@@ -300,6 +300,17 @@ nvme_ns_construct(struct nvme_namespace 
ns->ctrlr = ctrlr;
ns->id = id;
 
+   /*
+* Namespaces are reconstructed after a controller reset, so check
+*  to make sure we only call mtx_init once on each mtx.
+*
+* TODO: Move this somewhere where it gets called at controller
+*  construction time, which is not invoked as part of each
+*  controller reset.
+*/
+   if (!mtx_initialized(&ns->lock))
+   mtx_init(&ns->lock, "nvme ns lock", NULL, MTX_DEF);
+
 #ifdef CHATHAM2
if (pci_get_devid(ctrlr->dev) == CHATHAM_PCI_ID)
nvme_ns_populate_chatham_data(ns);

Modified: head/sys/dev/nvme/nvme_private.h
==
--- head/sys/dev/nvme/nvme_private.hFri Apr 12 17:36:48 2013
(r249417)
+++ head/sys/dev/nvme/nvme_private.hFri Apr 12 17:41:24 2013
(r249418)
@@ -238,6 +238,7 @@ struct nvme_namespace {
uint16_tflags;
struct cdev *cdev;
void*cons_cookie[NVME_MAX_CONSUMERS];
+   struct mtx  lock;
 };
 
 /*
___
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: r249419 - head/sys/dev/nvme

2013-04-12 Thread Jim Harris
Author: jimharris
Date: Fri Apr 12 17:44:55 2013
New Revision: 249419
URL: http://svnweb.freebsd.org/changeset/base/249419

Log:
  Remove the NVMe-specific physio and associated routines.
  
  These were added early on for benchmarking purposes to avoid the mapped I/O
  penalties incurred in kern_physio.  Now that FreeBSD (including kern_physio)
  supports unmapped I/O, the need for these NVMe-specific routines no longer 
exists.
  
  Sponsored by: Intel

Modified:
  head/sys/dev/nvme/nvme_ns.c
  head/sys/dev/nvme/nvme_uio.c

Modified: head/sys/dev/nvme/nvme_ns.c
==
--- head/sys/dev/nvme/nvme_ns.c Fri Apr 12 17:41:24 2013(r249418)
+++ head/sys/dev/nvme/nvme_ns.c Fri Apr 12 17:44:55 2013(r249419)
@@ -152,13 +152,11 @@ static struct cdevsw nvme_ns_cdevsw = {
.d_version =D_VERSION,
 #ifdef NVME_UNMAPPED_BIO_SUPPORT
.d_flags =  D_DISK | D_UNMAPPED_IO,
-   .d_read =   physread,
-   .d_write =  physwrite,
 #else
.d_flags =  D_DISK,
-   .d_read =   nvme_ns_physio,
-   .d_write =  nvme_ns_physio,
 #endif
+   .d_read =   physread,
+   .d_write =  physwrite,
.d_open =   nvme_ns_open,
.d_close =  nvme_ns_close,
.d_strategy =   nvme_ns_strategy,

Modified: head/sys/dev/nvme/nvme_uio.c
==
--- head/sys/dev/nvme/nvme_uio.cFri Apr 12 17:41:24 2013
(r249418)
+++ head/sys/dev/nvme/nvme_uio.cFri Apr 12 17:44:55 2013
(r249419)
@@ -34,171 +34,10 @@ __FBSDID("$FreeBSD$");
 
 #include "nvme_private.h"
 
-static void
-nvme_uio_done(void *arg, const struct nvme_completion *cpl)
-{
-   struct mtx *mtx;
-   struct uio *uio = arg;
-
-   if (!nvme_completion_is_error(cpl))
-   uio->uio_resid = 0;
-
-   mtx = mtx_pool_find(mtxpool_sleep, arg);
-   mtx_lock(mtx);
-   wakeup(arg);
-   mtx_unlock(mtx);
-}
-
 void
 nvme_payload_map_uio(void *arg, bus_dma_segment_t *seg, int nseg,
 bus_size_t mapsize, int error)
 {
-   struct nvme_tracker *tr = arg;
 
-   /*
-* Now that we know the actual size of the uio, divide it by the
-*  sector size that we stored in cdw12.
-*/
-   tr->req->cmd.cdw12 = (mapsize / tr->req->cmd.cdw12)-1;
nvme_payload_map(arg, seg, nseg, error);
 }
-
-static int
-nvme_read_uio(struct nvme_namespace *ns, struct uio *uio)
-{
-   struct nvme_request *req;
-   struct nvme_command *cmd;
-   uint64_tlba;
-
-   req = nvme_allocate_request_uio(uio, nvme_uio_done, uio);
-
-   if (req == NULL)
-   return (ENOMEM);
-
-   cmd = &req->cmd;
-   cmd->opc = NVME_OPC_READ;
-   cmd->nsid = ns->id;
-   lba = uio->uio_offset / nvme_ns_get_sector_size(ns);
-
-   *(uint64_t *)&cmd->cdw10 = lba;
-   /*
-* Store the sector size in cdw12 (where the LBA count normally goes).
-*  We'll adjust cdw12 in the map_uio callback based on the mapsize
-*  parameter.  This allows us to not have to store the namespace
-*  in the request simply to get the sector size in the map_uio
-*  callback.
-*/
-   cmd->cdw12 = nvme_ns_get_sector_size(ns);
-
-   nvme_ctrlr_submit_io_request(ns->ctrlr, req);
-
-   return (0);
-}
-
-static int
-nvme_write_uio(struct nvme_namespace *ns, struct uio *uio)
-{
-   struct nvme_request *req;
-   struct nvme_command *cmd;
-   uint64_tlba;
-
-   req = nvme_allocate_request_uio(uio, nvme_uio_done, uio);
-
-   if (req == NULL)
-   return (ENOMEM);
-
-   cmd = &req->cmd;
-   cmd->opc = NVME_OPC_WRITE;
-   cmd->nsid = ns->id;
-   lba = uio->uio_offset / nvme_ns_get_sector_size(ns);
-
-   *(uint64_t *)&cmd->cdw10 = lba;
-   /*
-* Store the sector size in cdw12 (where the LBA count normally goes).
-*  We'll adjust cdw12 in the map_uio callback based on the mapsize
-*  parameter.  This allows us to not have to store the namespace
-*  in the request simply to get the sector size in the map_uio
-*  callback.
-*/
-   cmd->cdw12 = nvme_ns_get_sector_size(ns);
-
-   nvme_ctrlr_submit_io_request(ns->ctrlr, req);
-
-   return (0);
-}
-
-int
-nvme_ns_physio(struct cdev *dev, struct uio *uio, int ioflag)
-{
-   struct uio  uio_tmp;
-   struct iovecuio_iov_tmp;
-   struct nvme_namespace   *ns;
-   struct mtx  *mtx;
-   int i, nvme_err, physio_err = 0;
-#if __FreeBSD_version > 900017
-   int ref;
-#endif
-
-   PHOLD(curproc);
-
-   ns = dev->si_drv1;
-   mtx = mtx_pool_find(mtxpool_sleep, &uio_tmp);
-
-#if __FreeBSD_version > 900017
-   dev_refthread(dev, &ref);

svn commit: r249420 - in head/sys: dev/nvme modules/nvme

2013-04-12 Thread Jim Harris
Author: jimharris
Date: Fri Apr 12 17:48:45 2013
New Revision: 249420
URL: http://svnweb.freebsd.org/changeset/base/249420

Log:
  Move the busdma mapping functions to nvme_qpair.c.
  
  This removes nvme_uio.c completely.
  
  Sponsored by: Intel

Deleted:
  head/sys/dev/nvme/nvme_uio.c
Modified:
  head/sys/dev/nvme/nvme.c
  head/sys/dev/nvme/nvme_private.h
  head/sys/dev/nvme/nvme_qpair.c
  head/sys/modules/nvme/Makefile

Modified: head/sys/dev/nvme/nvme.c
==
--- head/sys/dev/nvme/nvme.cFri Apr 12 17:44:55 2013(r249419)
+++ head/sys/dev/nvme/nvme.cFri Apr 12 17:48:45 2013(r249420)
@@ -229,43 +229,6 @@ nvme_dump_completion(struct nvme_complet
cpl->status.m, cpl->status.dnr);
 }
 
-void
-nvme_payload_map(void *arg, bus_dma_segment_t *seg, int nseg, int error)
-{
-   struct nvme_tracker *tr = arg;
-   uint32_tcur_nseg;
-
-   /*
-* If the mapping operation failed, return immediately.  The caller
-*  is responsible for detecting the error status and failing the
-*  tracker manually.
-*/
-   if (error != 0)
-   return;
-
-   /*
-* Note that we specified PAGE_SIZE for alignment and max
-*  segment size when creating the bus dma tags.  So here
-*  we can safely just transfer each segment to its
-*  associated PRP entry.
-*/
-   tr->req->cmd.prp1 = seg[0].ds_addr;
-
-   if (nseg == 2) {
-   tr->req->cmd.prp2 = seg[1].ds_addr;
-   } else if (nseg > 2) {
-   cur_nseg = 1;
-   tr->req->cmd.prp2 = (uint64_t)tr->prp_bus_addr;
-   while (cur_nseg < nseg) {
-   tr->prp[cur_nseg-1] =
-   (uint64_t)seg[cur_nseg].ds_addr;
-   cur_nseg++;
-   }
-   }
-
-   nvme_qpair_submit_tracker(tr->qpair, tr);
-}
-
 static int
 nvme_attach(device_t dev)
 {

Modified: head/sys/dev/nvme/nvme_private.h
==
--- head/sys/dev/nvme/nvme_private.hFri Apr 12 17:44:55 2013
(r249419)
+++ head/sys/dev/nvme/nvme_private.hFri Apr 12 17:48:45 2013
(r249420)
@@ -429,10 +429,6 @@ void   nvme_ctrlr_cmd_set_async_event_conf
 void   nvme_ctrlr_cmd_abort(struct nvme_controller *ctrlr, uint16_t cid,
 uint16_t sqid, nvme_cb_fn_t cb_fn, void *cb_arg);
 
-void   nvme_payload_map(void *arg, bus_dma_segment_t *seg, int nseg,
-int error);
-void   nvme_payload_map_uio(void *arg, bus_dma_segment_t *seg, int nseg,
-bus_size_t mapsize, int error);
 void   nvme_completion_poll_cb(void *arg, const struct nvme_completion *cpl);
 
 intnvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev);

Modified: head/sys/dev/nvme/nvme_qpair.c
==
--- head/sys/dev/nvme/nvme_qpair.c  Fri Apr 12 17:44:55 2013
(r249419)
+++ head/sys/dev/nvme/nvme_qpair.c  Fri Apr 12 17:48:45 2013
(r249420)
@@ -699,6 +699,51 @@ nvme_qpair_submit_tracker(struct nvme_qp
 }
 
 static void
+nvme_payload_map(void *arg, bus_dma_segment_t *seg, int nseg, int error)
+{
+   struct nvme_tracker *tr = arg;
+   uint32_tcur_nseg;
+
+   /*
+* If the mapping operation failed, return immediately.  The caller
+*  is responsible for detecting the error status and failing the
+*  tracker manually.
+*/
+   if (error != 0)
+   return;
+
+   /*
+* Note that we specified PAGE_SIZE for alignment and max
+*  segment size when creating the bus dma tags.  So here
+*  we can safely just transfer each segment to its
+*  associated PRP entry.
+*/
+   tr->req->cmd.prp1 = seg[0].ds_addr;
+
+   if (nseg == 2) {
+   tr->req->cmd.prp2 = seg[1].ds_addr;
+   } else if (nseg > 2) {
+   cur_nseg = 1;
+   tr->req->cmd.prp2 = (uint64_t)tr->prp_bus_addr;
+   while (cur_nseg < nseg) {
+   tr->prp[cur_nseg-1] =
+   (uint64_t)seg[cur_nseg].ds_addr;
+   cur_nseg++;
+   }
+   }
+
+   nvme_qpair_submit_tracker(tr->qpair, tr);
+}
+
+static void
+nvme_payload_map_uio(void *arg, bus_dma_segment_t *seg, int nseg,
+bus_size_t mapsize, int error)
+{
+
+   nvme_payload_map(arg, seg, nseg, error);
+}
+
+static void
 _nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req)
 {
struct nvme_tracker *tr;

Modified: head/sys/modules/nvme/Makefile
==
--- head/sys/modules/nvme/Makefile  Fri Apr 12 17:44:55 2013
(r

svn commit: r249421 - head/sys/dev/nvme

2013-04-12 Thread Jim Harris
Author: jimharris
Date: Fri Apr 12 17:52:17 2013
New Revision: 249421
URL: http://svnweb.freebsd.org/changeset/base/249421

Log:
  Add support for passthrough NVMe commands.
  
  This includes a new IOCTL to support a generic method for nvmecontrol(8) to 
pass
  IDENTIFY, GET_LOG_PAGE, GET_FEATURES and other commands to the controller, 
rather than
  separate IOCTLs for each.
  
  Sponsored by: Intel

Modified:
  head/sys/dev/nvme/nvme.h
  head/sys/dev/nvme/nvme_ctrlr.c
  head/sys/dev/nvme/nvme_ns.c

Modified: head/sys/dev/nvme/nvme.h
==
--- head/sys/dev/nvme/nvme.hFri Apr 12 17:48:45 2013(r249420)
+++ head/sys/dev/nvme/nvme.hFri Apr 12 17:52:17 2013(r249421)
@@ -38,6 +38,7 @@
 #defineNVME_IO_TEST_IOWR('n', 2, struct 
nvme_io_test)
 #defineNVME_BIO_TEST   _IOWR('n', 4, struct 
nvme_io_test)
 #defineNVME_RESET_CONTROLLER   _IO('n', 5)
+#defineNVME_PASSTHROUGH_CMD_IOWR('n', 6, struct 
nvme_pt_command)
 
 /*
  * Use to mark a command to apply to all namespaces, or to retrieve global
@@ -716,6 +717,59 @@ enum nvme_io_test_flags {
NVME_TEST_FLAG_REFTHREAD =  0x1,
 };
 
+struct nvme_pt_command {
+
+   /*
+* cmd is used to specify a passthrough command to a controller or
+*  namespace.
+*
+* The following fields from cmd may be specified by the caller:
+*  * opc  (opcode)
+*  * nsid (namespace id) - for admin commands only
+*  * cdw10-cdw15
+*
+* Remaining fields must be set to 0 by the caller.
+*/
+   struct nvme_command cmd;
+
+   /*
+* cpl returns completion status for the passthrough command
+*  specified by cmd.
+*
+* The following fields will be filled out by the driver, for
+*  consumption by the caller:
+*  * cdw0
+*  * status (except for phase)
+*
+* Remaining fields will be set to 0 by the driver.
+*/
+   struct nvme_completion  cpl;
+
+   /* buf is the data buffer associated with this passthrough command. */
+   void *  buf;
+
+   /*
+* len is the length of the data buffer associated with this
+*  passthrough command.
+*/
+   uint32_tlen;
+
+   /*
+* is_read = 1 if the passthrough command will read data into the
+*  supplied buffer.
+*
+* is_read = 0 if the passthrough command will write data into the
+*  supplied buffer.
+*/
+   uint32_tis_read;
+
+   /*
+* driver_lock is used by the driver only.  It must be set to 0
+*  by the caller.
+*/
+   struct mtx *driver_lock;
+};
+
 #define nvme_completion_is_error(cpl)  \
((cpl)->status.sc != 0 || (cpl)->status.sct != 0)
 
@@ -740,6 +794,11 @@ enum nvme_namespace_flags {
NVME_NS_FLUSH_SUPPORTED = 0x2,
 };
 
+intnvme_ctrlr_passthrough_cmd(struct nvme_controller *ctrlr,
+  struct nvme_pt_command *pt,
+  uint32_t nsid, int is_user_buffer,
+  int is_admin_cmd);
+
 /* Admin functions */
 void   nvme_ctrlr_cmd_set_feature(struct nvme_controller *ctrlr,
   uint8_t feature, uint32_t cdw11,

Modified: head/sys/dev/nvme/nvme_ctrlr.c
==
--- head/sys/dev/nvme/nvme_ctrlr.c  Fri Apr 12 17:48:45 2013
(r249420)
+++ head/sys/dev/nvme/nvme_ctrlr.c  Fri Apr 12 17:52:17 2013
(r249421)
@@ -28,10 +28,14 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 
 #include 
 #include 
@@ -878,12 +882,103 @@ nvme_ctrlr_configure_intx(struct nvme_co
return (0);
 }
 
+static void
+nvme_pt_done(void *arg, const struct nvme_completion *cpl)
+{
+   struct nvme_pt_command *pt = arg;
+
+   bzero(&pt->cpl, sizeof(pt->cpl));
+   pt->cpl.cdw0 = cpl->cdw0;
+   pt->cpl.status = cpl->status;
+   pt->cpl.status.p = 0;
+
+   mtx_lock(pt->driver_lock);
+   wakeup(pt);
+   mtx_unlock(pt->driver_lock);
+}
+
+int
+nvme_ctrlr_passthrough_cmd(struct nvme_controller *ctrlr,
+struct nvme_pt_command *pt, uint32_t nsid, int is_user_buffer,
+int is_admin_cmd)
+{
+   struct nvme_request *req;
+   struct mtx  *mtx;
+   struct buf  *buf = NULL;
+   int ret = 0;
+
+   if (pt->len > 0)
+   if (is_user_buffer) {
+   /*
+* Ensure the user buffer is wired for the duration of
+*  this passthrough

svn commit: r249422 - in head: sbin/nvmecontrol sys/dev/nvme

2013-04-12 Thread Jim Harris
Author: jimharris
Date: Fri Apr 12 17:56:47 2013
New Revision: 249422
URL: http://svnweb.freebsd.org/changeset/base/249422

Log:
  Remove the NVME_IDENTIFY_CONTROLLER and NVME_IDENTIFY_NAMESPACE IOCTLs and 
replace
  them with the NVMe passthrough equivalent.
  
  Sponsored by: Intel

Modified:
  head/sbin/nvmecontrol/nvmecontrol.c
  head/sys/dev/nvme/nvme.h
  head/sys/dev/nvme/nvme_ctrlr.c
  head/sys/dev/nvme/nvme_ns.c

Modified: head/sbin/nvmecontrol/nvmecontrol.c
==
--- head/sbin/nvmecontrol/nvmecontrol.c Fri Apr 12 17:52:17 2013
(r249421)
+++ head/sbin/nvmecontrol/nvmecontrol.c Fri Apr 12 17:56:47 2013
(r249422)
@@ -210,6 +210,53 @@ ns_get_sector_size(struct nvme_namespace
return (1 << nsdata->lbaf[0].lbads);
 }
 
+static void
+read_controller_data(int fd, struct nvme_controller_data *cdata)
+{
+   struct nvme_pt_command  pt;
+
+   memset(&pt, 0, sizeof(pt));
+   pt.cmd.opc = NVME_OPC_IDENTIFY;
+   pt.cmd.cdw10 = 1;
+   pt.buf = cdata;
+   pt.len = sizeof(*cdata);
+   pt.is_read = 1;
+
+   if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) {
+   printf("Identify request failed. errno=%d (%s)\n",
+   errno, strerror(errno));
+   exit(EX_IOERR);
+   }
+
+   if (nvme_completion_is_error(&pt.cpl)) {
+   printf("Passthrough command returned error.\n");
+   exit(EX_IOERR);
+   }
+}
+
+static void
+read_namespace_data(int fd, int nsid, struct nvme_namespace_data *nsdata)
+{
+   struct nvme_pt_command  pt;
+
+   memset(&pt, 0, sizeof(pt));
+   pt.cmd.opc = NVME_OPC_IDENTIFY;
+   pt.cmd.nsid = nsid;
+   pt.buf = nsdata;
+   pt.len = sizeof(*nsdata);
+   pt.is_read = 1;
+
+   if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) {
+   printf("Identify request failed. errno=%d (%s)\n",
+   errno, strerror(errno));
+   exit(EX_IOERR);
+   }
+
+   if (nvme_completion_is_error(&pt.cpl)) {
+   printf("Passthrough command returned error.\n");
+   exit(EX_IOERR);
+   }
+}
 
 static void
 devlist(int argc, char *argv[])
@@ -251,33 +298,12 @@ devlist(int argc, char *argv[])
continue;
}
 
-   if (ioctl(fd, NVME_IDENTIFY_CONTROLLER, &cdata) < 0) {
-   printf("Identify request to %s failed. errno=%d (%s)\n",
-   path, errno, strerror(errno));
-   exit_code = EX_IOERR;
-   continue;
-   }
-
+   read_controller_data(fd, &cdata);
printf("%6s: %s\n", name, cdata.mn);
 
for (i = 0; i < cdata.nn; i++) {
sprintf(name, "nvme%dns%d", ctrlr, i+1);
-   sprintf(path, "/dev/%s", name);
-
-   fd = open(path, O_RDWR);
-   if (fd < 0) {
-   printf("Could not open %s. errno=%d (%s)\n",
-   path, errno, strerror(errno));
-   exit_code = EX_NOPERM;
-   continue;
-   }
-   if (ioctl(fd, NVME_IDENTIFY_NAMESPACE, &nsdata) < 0) {
-   printf("Identify request to %s failed. "
-   "errno=%d (%s)\n", path, errno,
-   strerror(errno));
-   exit_code = EX_IOERR;
-   continue;
-   }
+   read_namespace_data(fd, i+1, &nsdata);
printf("  %10s (%lldGB)\n",
name,
nsdata.nsze *
@@ -329,11 +355,7 @@ identify_ctrlr(int argc, char *argv[])
exit(EX_NOPERM);
}
 
-   if (ioctl(fd, NVME_IDENTIFY_CONTROLLER, &cdata) < 0) {
-   printf("Identify request to %s failed. errno=%d (%s)\n", path,
-   errno, strerror(errno));
-   exit(EX_IOERR);
-   }
+   read_controller_data(fd, &cdata);
 
if (hexflag == 1) {
if (verboseflag == 1)
@@ -360,7 +382,8 @@ identify_ns(int argc, char *argv[])
struct nvme_namespace_data  nsdata;
struct stat devstat;
charpath[64];
-   int ch, fd, hexflag = 0, hexlength;
+   char*nsloc;
+   int ch, fd, hexflag = 0, hexlength, nsid;
int verboseflag = 0;
 
while ((ch = getopt(argc, argv, "vx")) != -1) {
@@ -376,8 +399,41 @@ identify_ns(int argc, char *argv[])
}
}
 
+   /*
+* Check if the specified device node exists 

svn commit: r249425 - head/lib/libthr/thread

2013-04-12 Thread Jilles Tjoelker
Author: jilles
Date: Fri Apr 12 19:47:32 2013
New Revision: 249425
URL: http://svnweb.freebsd.org/changeset/base/249425

Log:
  libthr: Remove _thr_rtld_fini(), unused since r245630.

Modified:
  head/lib/libthr/thread/thr_private.h
  head/lib/libthr/thread/thr_rtld.c

Modified: head/lib/libthr/thread/thr_private.h
==
--- head/lib/libthr/thread/thr_private.hFri Apr 12 19:36:53 2013
(r249424)
+++ head/lib/libthr/thread/thr_private.hFri Apr 12 19:47:32 2013
(r249425)
@@ -746,7 +746,6 @@ void_thr_ref_delete(struct pthread *, s
 void   _thr_ref_delete_unlocked(struct pthread *, struct pthread *) __hidden;
 int_thr_find_thread(struct pthread *, struct pthread *, int) __hidden;
 void   _thr_rtld_init(void) __hidden;
-void   _thr_rtld_fini(void) __hidden;
 void   _thr_rtld_postfork_child(void) __hidden;
 int_thr_stack_alloc(struct pthread_attr *) __hidden;
 void   _thr_stack_free(struct pthread_attr *) __hidden;

Modified: head/lib/libthr/thread/thr_rtld.c
==
--- head/lib/libthr/thread/thr_rtld.c   Fri Apr 12 19:36:53 2013
(r249424)
+++ head/lib/libthr/thread/thr_rtld.c   Fri Apr 12 19:47:32 2013
(r249425)
@@ -213,14 +213,3 @@ _thr_rtld_init(void)
_rtld_thread_init(&li);
_thr_signal_unblock(curthread);
 }
-
-void
-_thr_rtld_fini(void)
-{
-   struct pthread  *curthread;
-
-   curthread = _get_curthread();
-   _thr_signal_block(curthread);
-   _rtld_thread_init(NULL);
-   _thr_signal_unblock(curthread);
-}
___
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: r249426 - in head/cddl/contrib/opensolaris: cmd/dtrace/test/tst/common/funcs cmd/dtrace/test/tst/common/pointers cmd/dtrace/test/tst/common/print cmd/dtrace/test/tst/common/safety cmd/d...

2013-04-12 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Apr 12 20:10:27 2013
New Revision: 249426
URL: http://svnweb.freebsd.org/changeset/base/249426

Log:
  Dtrace: resolve const types from fbt and other fixes.
  
  Merge change from illumos:
  
  3519 DTrace fails to resolve const types from fbt
  3520 dtrace internal error -- token type 316 is not a valid D
   compilation token
  3521 clean up dtrace unit tests
  
  Illumos Revision: e98f46c
  
  Reference:
  https://www.illumos.org/issues/3519
  https://www.illumos.org/issues/3520
  https://www.illumos.org/issues/3521
  
  Tested by:Fabian Keil
  Obtained from:Illumos
  MFC after:1 month

Added:
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PRINT_AGG.bad.d
 - copied unchanged from r249381, 
vendor/illumos/dist/cmd/dtrace/test/tst/common/print/err.D_PRINT_AGG.bad.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/trace/err.D_TRACE_AGG.bad.d
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/types/tst.const.d
 - copied unchanged from r249381, 
vendor/illumos/dist/cmd/dtrace/test/tst/common/types/tst.const.d
Modified:
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.strjoin.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.BadAlign.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress2.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress3.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress4.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PRINT_VOID.bad.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PROTO_LEN.bad.d
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/safety/tst.copyin.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/err.BufSizeVariations2.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/trace/err.D_PROTO_LEN.bad.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/trace/err.D_TRACE_VOID.bad.d
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_decl.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_errtags.h

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.strjoin.d
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.strjoin.d
Fri Apr 12 19:47:32 2013(r249425)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/funcs/tst.strjoin.d
Fri Apr 12 20:10:27 2013(r249426)
@@ -24,7 +24,9 @@
  * Use is subject to license terms.
  */
 
-#pragma ident  "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
 
 #pragma D option quiet
 
@@ -36,3 +38,8 @@ BEGIN
printf("%s\n", strjoin("", ""));
exit(0);
 }
+
+BEGIN
+{
+   exit(1);
+}

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.BadAlign.d
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.BadAlign.d
Fri Apr 12 19:47:32 2013(r249425)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.BadAlign.d
Fri Apr 12 20:10:27 2013(r249426)
@@ -24,7 +24,9 @@
  * Use is subject to license terms.
  */
 
-#pragma ident  "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
 
 /*
  * ASSERTION: This test reproduces the alignment error.
@@ -39,9 +41,10 @@
 
 BEGIN
 {
-   x = (int *) 64;
+   x = (int *)64;
y = *x;
trace(y);
+   exit(0);
 }
 
 ERROR

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress2.d
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress2.d
 Fri Apr 12 19:47:32 2013(r249425)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress2.d
 Fri Apr 12 20:10:27 2013(r249426)
@@ -24,7 +24,9 @@
  * Use is subject to license terms.
  */
 
-#pragma ident  "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
 
 /*
  * ASSERTION: D pointers do not allow invalid pointer accesses.
@@ -44,6 +46,7 @@ BEGIN
y = (int *) (x - 3300778156056);
*y = 3;
trace(*y);
+   exit(0);
 }
 
 ERROR

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress3.d
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress3.d
 Fri Apr 12 19:47:32 2013(r249425)
+++ 
head/cddl

svn commit: r249427 - head/sys/vm

2013-04-12 Thread Alan Cox
Author: alc
Date: Fri Apr 12 20:21:28 2013
New Revision: 249427
URL: http://svnweb.freebsd.org/changeset/base/249427

Log:
  Although we perform path compression to reduce the height of the trie and
  the number of interior nodes, we always create a level zero interior node at
  the root of every non-empty trie, even when that node is not strictly
  necessary, i.e., it has only one child.  This change is the first step in
  eliminating those unnecessary level zero interior nodes.  Specifically, it
  updates all of the lookup functions so that they do not require a level zero
  interior node at the root.
  
  Reviewed by:  attilio, jeff (an earlier version)
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/vm/vm_radix.c

Modified: head/sys/vm/vm_radix.c
==
--- head/sys/vm/vm_radix.c  Fri Apr 12 20:10:27 2013(r249426)
+++ head/sys/vm/vm_radix.c  Fri Apr 12 20:21:28 2013(r249427)
@@ -270,11 +270,7 @@ vm_radix_addlev(vm_pindex_t *idx, boolea
for (; levels[ilev] == FALSE ||
vm_radix_slot(*idx, ilev) == (VM_RADIX_COUNT - 1); ilev--)
if (ilev == 0)
-   break;
-   KASSERT(ilev > 0 || levels[0],
-   ("%s: levels back-scanning problem", __func__));
-   if (ilev == 0 && vm_radix_slot(*idx, ilev) == (VM_RADIX_COUNT - 1))
-   return (1);
+   return (1);
wrapidx = *idx;
*idx = vm_radix_trimkey(*idx, ilev);
*idx += VM_RADIX_UNITLEVEL(ilev);
@@ -295,11 +291,7 @@ vm_radix_declev(vm_pindex_t *idx, boolea
for (; levels[ilev] == FALSE ||
vm_radix_slot(*idx, ilev) == 0; ilev--)
if (ilev == 0)
-   break;
-   KASSERT(ilev > 0 || levels[0],
-   ("%s: levels back-scanning problem", __func__));
-   if (ilev == 0 && vm_radix_slot(*idx, ilev) == 0)
-   return (1);
+   return (1);
wrapidx = *idx;
*idx = vm_radix_trimkey(*idx, ilev);
*idx |= VM_RADIX_UNITLEVEL(ilev) - 1;
@@ -474,17 +466,16 @@ vm_radix_lookup(struct vm_radix *rtree, 
 
rnode = vm_radix_getroot(rtree);
while (rnode != NULL) {
-   if (vm_radix_keybarr(rnode, index))
-   return (NULL);
-   slot = vm_radix_slot(index, rnode->rn_clev);
-   rnode = rnode->rn_child[slot];
if (vm_radix_isleaf(rnode)) {
m = vm_radix_topage(rnode);
if (m->pindex == index)
return (m);
else
-   return (NULL);
-   }
+   break;
+   } else if (vm_radix_keybarr(rnode, index))
+   break;
+   slot = vm_radix_slot(index, rnode->rn_clev);
+   rnode = rnode->rn_child[slot];
}
return (NULL);
 }
@@ -505,12 +496,21 @@ vm_radix_lookup_ge(struct vm_radix *rtre
int loops = 0;
 #endif
 
+   rnode = vm_radix_getroot(rtree);
+   if (rnode == NULL)
+   return (NULL);
+   else if (vm_radix_isleaf(rnode)) {
+   m = vm_radix_topage(rnode);
+   if (m->pindex >= index)
+   return (m);
+   else
+   return (NULL);
+   }
 restart:
KASSERT(++loops < 1000, ("%s: too many loops", __func__));
for (difflev = 0; difflev < (VM_RADIX_LIMIT + 1); difflev++)
maplevels[difflev] = FALSE;
-   rnode = vm_radix_getroot(rtree);
-   while (rnode != NULL) {
+   for (;;) {
maplevels[rnode->rn_clev] = TRUE;
 
/*
@@ -532,6 +532,7 @@ restart:
} else
index = vm_radix_trimkey(rnode->rn_owner,
difflev);
+   rnode = vm_radix_getroot(rtree);
goto restart;
}
slot = vm_radix_slot(index, rnode->rn_clev);
@@ -572,6 +573,7 @@ restart:
if (rnode->rn_clev == 0 || vm_radix_addlev(&index, maplevels,
rnode->rn_clev - 1) > 0)
break;
+   rnode = vm_radix_getroot(rtree);
goto restart;
 descend:
rnode = child;
@@ -595,12 +597,21 @@ vm_radix_lookup_le(struct vm_radix *rtre
int loops = 0;
 #endif
 
+   rnode = vm_radix_getroot(rtree);
+   if (rnode == NULL)
+   return (NULL);
+   else if (vm_radix_isleaf(rnode)) {
+   m = vm_radix_topage(rnode);
+   if (m->pindex <= index)
+   return (m);
+   else
+   return (NULL);
+   }
 restart:
KASSERT(++loops < 1000, ("%s: too many loops", __func__));
for (dif

svn commit: r249428 - head/sys/dev/hwpmc

2013-04-12 Thread Ryan Stone
Author: rstone
Date: Fri Apr 12 20:43:14 2013
New Revision: 249428
URL: http://svnweb.freebsd.org/changeset/base/249428

Log:
  Cosmetic change: make a comment reference Sandy Bridge *Xeon*
  
  Reviewed by:  sbruno
  MFC after:1 week

Modified:
  head/sys/dev/hwpmc/hwpmc_core.c

Modified: head/sys/dev/hwpmc/hwpmc_core.c
==
--- head/sys/dev/hwpmc/hwpmc_core.c Fri Apr 12 20:21:28 2013
(r249427)
+++ head/sys/dev/hwpmc/hwpmc_core.c Fri Apr 12 20:43:14 2013
(r249428)
@@ -560,7 +560,7 @@ struct iap_event_descr {
 #defineIAP_F_SB(1 << 6)/* CPU: Sandy Bridge */
 #defineIAP_F_IB(1 << 7)/* CPU: Ivy Bridge */
 #defineIAP_F_SBX   (1 << 8)/* CPU: Sandy Bridge Xeon */
-#defineIAP_F_IBX   (1 << 9)/* CPU: Ivy Bridge */
+#defineIAP_F_IBX   (1 << 9)/* CPU: Ivy Bridge Xeon */
 #defineIAP_F_HW(1 << 10)   /* CPU: Haswell */
 #defineIAP_F_FM(1 << 11)   /* Fixed mask */
 
___
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: r249430 - head/tools/tools/umastat

2013-04-12 Thread Sergey Kandaurov
Author: pluknet
Date: Fri Apr 12 21:29:37 2013
New Revision: 249430
URL: http://svnweb.freebsd.org/changeset/base/249430

Log:
  Fix build.
  - pass a format string to printf
  - catch up with constifying uz_name
  
  MFC after:3 days

Modified:
  head/tools/tools/umastat/umastat.c

Modified: head/tools/tools/umastat/umastat.c
==
--- head/tools/tools/umastat/umastat.c  Fri Apr 12 20:48:55 2013
(r249429)
+++ head/tools/tools/umastat/umastat.c  Fri Apr 12 21:29:37 2013
(r249430)
@@ -79,7 +79,7 @@ kread(kvm_t *kvm, void *kvm_pointer, voi
 }
 
 static int
-kread_string(kvm_t *kvm, void *kvm_pointer, char *buffer, int buflen)
+kread_string(kvm_t *kvm, const void *kvm_pointer, char *buffer, int buflen)
 {
ssize_t ret;
int i;
@@ -151,7 +151,7 @@ uma_print_keg_flags(struct uma_keg *ukp,
if (ukp->uk_flags & flaginfo[i].fi_flag) {
if (count++ > 0)
printf(" | ");
-   printf(flaginfo[i].fi_name);
+   printf("%s", flaginfo[i].fi_name);
}
 
}
___
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: r249408 - head/sys/kern

2013-04-12 Thread Navdeep Parhar
This prevents my system from booting up properly.  Backing out this
change restores normal operation.

The symptoms are that the kernel doesn't find the root fs itself but
waits at the mountroot> prompt instead.  I'm able to specify the
filesystem to use and then the boot proceeds as normal.  Once the
system has booted up I see only two entries in kenv, indicating that
something clobbered the environment.

# kenv
kern.devalias.ada0="ad4"
kern.devalias.ada1="ad6"

Regards,
Navdeep

On Fri, Apr 12, 2013 at 8:58 AM, Jayachandran C.  wrote:
> Author: jchandra
> Date: Fri Apr 12 15:58:53 2013
> New Revision: 249408
> URL: http://svnweb.freebsd.org/changeset/base/249408
>
> Log:
>   Fix kenv behavior when there is no static environment
>
>   In case where there are no static kernel environment entries, the
>   function init_dynamic_kenv() adds an incorrect entry at position 0 of
>   the dynamic kernel environment. This in turn causes kenv(1) to print
>   and empty list even though there are dynamic entries added later.
>
>   Fix this by checking env_pos in init_dynamic_kenv() and adding dynamic
>   entries only if there are static entries.
>
> Modified:
>   head/sys/kern/kern_environment.c
>
> Modified: head/sys/kern/kern_environment.c
> ==
> --- head/sys/kern/kern_environment.cFri Apr 12 15:19:35 2013
> (r249407)
> +++ head/sys/kern/kern_environment.cFri Apr 12 15:58:53 2013
> (r249408)
> @@ -231,20 +231,23 @@ init_dynamic_kenv(void *data __unused)
> kenvp = malloc((KENV_SIZE + 1) * sizeof(char *), M_KENV,
> M_WAITOK | M_ZERO);
> i = 0;
> -   for (cp = kern_envp; cp != NULL; cp = kernenv_next(cp)) {
> -   len = strlen(cp) + 1;
> -   if (len > KENV_MNAMELEN + 1 + KENV_MVALLEN + 1) {
> -   printf("WARNING: too long kenv string, ignoring %s\n",
> -   cp);
> -   continue;
> +   if (env_pos > 0) {
> +   for (cp = kern_envp; cp != NULL; cp = kernenv_next(cp)) {
> +   len = strlen(cp) + 1;
> +   if (len > KENV_MNAMELEN + 1 + KENV_MVALLEN + 1) {
> +   printf(
> +   "WARNING: too long kenv string, ignoring 
> %s\n",
> +   cp);
> +   continue;
> +   }
> +   if (i < KENV_SIZE) {
> +   kenvp[i] = malloc(len, M_KENV, M_WAITOK);
> +   strcpy(kenvp[i++], cp);
> +   } else
> +   printf(
> +   "WARNING: too many kenv strings, ignoring 
> %s\n",
> +   cp);
> }
> -   if (i < KENV_SIZE) {
> -   kenvp[i] = malloc(len, M_KENV, M_WAITOK);
> -   strcpy(kenvp[i++], cp);
> -   } else
> -   printf(
> -   "WARNING: too many kenv strings, ignoring %s\n",
> -   cp);
> }
> kenvp[i] = NULL;
>
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r249431 - head/lib/libfetch

2013-04-12 Thread Dag-Erling Smørgrav
Author: des
Date: Fri Apr 12 22:05:15 2013
New Revision: 249431
URL: http://svnweb.freebsd.org/changeset/base/249431

Log:
  Use the CONNECT method to proxy HTTPS connections through HTTP proxies.
  
  PR:   bin/80176
  Submitted by: Yuichiro NAITO 

Modified:
  head/lib/libfetch/http.c

Modified: head/lib/libfetch/http.c
==
--- head/lib/libfetch/http.cFri Apr 12 21:29:37 2013(r249430)
+++ head/lib/libfetch/http.cFri Apr 12 22:05:15 2013(r249431)
@@ -1373,6 +1373,7 @@ http_authorize(conn_t *conn, const char 
 static conn_t *
 http_connect(struct url *URL, struct url *purl, const char *flags)
 {
+   struct url *curl;
conn_t *conn;
int verbose;
int af, val;
@@ -1391,17 +1392,21 @@ http_connect(struct url *URL, struct url
af = AF_INET6;
 #endif
 
-   if (purl && strcasecmp(URL->scheme, SCHEME_HTTPS) != 0) {
-   URL = purl;
-   } else if (strcasecmp(URL->scheme, SCHEME_FTP) == 0) {
-   /* can't talk http to an ftp server */
-   /* XXX should set an error code */
-   return (NULL);
-   }
+   curl = (purl != NULL) ? purl : URL;
 
-   if ((conn = fetch_connect(URL->host, URL->port, af, verbose)) == NULL)
+   if ((conn = fetch_connect(curl->host, curl->port, af, verbose)) == NULL)
/* fetch_connect() has already set an error code */
return (NULL);
+   if (strcasecmp(URL->scheme, SCHEME_HTTPS) == 0 && purl) {
+   http_cmd(conn, "CONNECT %s:%d HTTP/1.1",
+   URL->host, URL->port);
+   http_cmd(conn, "");
+   if (http_get_reply(conn) != HTTP_OK) {
+   fetch_close(conn);
+   return (NULL);
+   }
+   http_get_reply(conn);
+   }
if (strcasecmp(URL->scheme, SCHEME_HTTPS) == 0 &&
fetch_ssl(conn, verbose) == -1) {
fetch_close(conn);
___
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: r249431 - head/lib/libfetch

2013-04-12 Thread Baptiste Daroussin
On Fri, Apr 12, 2013 at 10:05:15PM +, Dag-Erling Smørgrav wrote:
> Author: des
> Date: Fri Apr 12 22:05:15 2013
> New Revision: 249431
> URL: http://svnweb.freebsd.org/changeset/base/249431
> 
> Log:
>   Use the CONNECT method to proxy HTTPS connections through HTTP proxies.
>   
>   PR: bin/80176
>   Submitted by:   Yuichiro NAITO 
> 

I don't see any MFC period here :), does that mean you don't plan to MFC it?

regards,
Bapt


pgpXvh9qsItiF.pgp
Description: PGP signature


Re: svn commit: r249431 - head/lib/libfetch

2013-04-12 Thread Dag-Erling Smørgrav
Baptiste Daroussin  writes:
> I don't see any MFC period here :), does that mean you don't plan to
> MFC it?

No, just that I forgot to mark it.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
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: r249432 - head/sys/conf

2013-04-12 Thread Jung-uk Kim
Author: jkim
Date: Fri Apr 12 23:10:56 2013
New Revision: 249432
URL: http://svnweb.freebsd.org/changeset/base/249432

Log:
  Unbreak tinderbox build after r249420.

Modified:
  head/sys/conf/files.amd64
  head/sys/conf/files.i386

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Fri Apr 12 22:05:15 2013(r249431)
+++ head/sys/conf/files.amd64   Fri Apr 12 23:10:56 2013(r249432)
@@ -221,7 +221,6 @@ dev/nvme/nvme_ns_cmd.c  optionalnvme
 dev/nvme/nvme_qpair.c  optionalnvme
 dev/nvme/nvme_sysctl.c optionalnvme
 dev/nvme/nvme_test.c   optionalnvme
-dev/nvme/nvme_uio.coptionalnvme
 dev/nvram/nvram.c  optionalnvram isa
 dev/random/ivy.c   optionalrandom rdrand_rng
 dev/random/nehemiah.c  optionalrandom padlock_rng

Modified: head/sys/conf/files.i386
==
--- head/sys/conf/files.i386Fri Apr 12 22:05:15 2013(r249431)
+++ head/sys/conf/files.i386Fri Apr 12 23:10:56 2013(r249432)
@@ -233,7 +233,6 @@ dev/nvme/nvme_ns_cmd.c  optional nvme
 dev/nvme/nvme_qpair.c  optional nvme
 dev/nvme/nvme_sysctl.c optional nvme
 dev/nvme/nvme_test.c   optional nvme
-dev/nvme/nvme_uio.coptional nvme
 dev/nvram/nvram.c  optional nvram isa
 dev/pcf/pcf_isa.c  optional pcf
 dev/random/ivy.c   optional random rdrand_rng
___
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: r249432 - head/sys/conf

2013-04-12 Thread Jim Harris
On Fri, Apr 12, 2013 at 4:10 PM, Jung-uk Kim  wrote:

> Author: jkim
> Date: Fri Apr 12 23:10:56 2013
> New Revision: 249432
> URL: http://svnweb.freebsd.org/changeset/base/249432
>
> Log:
>   Unbreak tinderbox build after r249420.
>
> Modified:
>   head/sys/conf/files.amd64
>   head/sys/conf/files.i386
>
>
Pointy hat to: jimharris
___
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: r249428 - head/sys/dev/hwpmc

2013-04-12 Thread poyopoyo
At Fri, 12 Apr 2013 20:43:14 + (UTC),
Ryan Stone wrote:
>   Cosmetic change: make a comment reference Sandy Bridge *Xeon*
..
>  #define  IAP_F_SBX   (1 << 8)/* CPU: Sandy Bridge Xeon */
> -#define  IAP_F_IBX   (1 << 9)/* CPU: Ivy Bridge */
> +#define  IAP_F_IBX   (1 << 9)/* CPU: Ivy Bridge Xeon */
>  #define  IAP_F_HW(1 << 10)   /* CPU: Haswell */
..
and *Ivy* Bridge Xeon? :)
___
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: r249435 - head/sys/amd64/vmm

2013-04-12 Thread Neel Natu
Author: neel
Date: Sat Apr 13 05:11:21 2013
New Revision: 249435
URL: http://svnweb.freebsd.org/changeset/base/249435

Log:
  Use the MAKEDEV_CHECKNAME flag to check for an invalid device name and return
  an error instead of panicking.
  
  Obtained from:NetApp

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

Modified: head/sys/amd64/vmm/vmm_dev.c
==
--- head/sys/amd64/vmm/vmm_dev.cSat Apr 13 02:15:59 2013
(r249434)
+++ head/sys/amd64/vmm/vmm_dev.cSat Apr 13 05:11:21 2013
(r249435)
@@ -497,8 +497,12 @@ sysctl_vmm_create(SYSCTL_HANDLER_ARGS)
return (EEXIST);
}
 
-   sc->cdev = make_dev(&vmmdevsw, 0, UID_ROOT, GID_WHEEL, 0600,
-   "vmm/%s", buf);
+   error = make_dev_p(MAKEDEV_CHECKNAME, &sc->cdev, &vmmdevsw, NULL,
+  UID_ROOT, GID_WHEEL, 0600, "vmm/%s", buf);
+   if (error != 0) {
+   vmmdev_destroy(sc, TRUE);
+   return (error);
+   }
sc->cdev->si_drv1 = sc;
 
return (0);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r249408 - head/sys/kern

2013-04-12 Thread Jayachandran C.
On Sat, Apr 13, 2013 at 3:12 AM, Navdeep Parhar  wrote:

> This prevents my system from booting up properly.  Backing out this
> change restores normal operation.
>
> The symptoms are that the kernel doesn't find the root fs itself but
> waits at the mountroot> prompt instead.  I'm able to specify the
> filesystem to use and then the boot proceeds as normal.  Once the
> system has booted up I see only two entries in kenv, indicating that
> something clobbered the environment.
>
> # kenv
> kern.devalias.ada0="ad4"
> kern.devalias.ada1="ad6"
>
>
After looking at the changes again, I realized that most architectures do
not update the env_pos when they setup kern_envp.

If there are no objections, I will check-in the attached change, otherwise
I will revert this commit.

Thanks for reporting this, and sorry for the mess.

JC.




> On Fri, Apr 12, 2013 at 8:58 AM, Jayachandran C. 
> wrote:
> > Author: jchandra
> > Date: Fri Apr 12 15:58:53 2013
> > New Revision: 249408
> > URL: http://svnweb.freebsd.org/changeset/base/249408
> >
> > Log:
> >   Fix kenv behavior when there is no static environment
> >
> >   In case where there are no static kernel environment entries, the
> >   function init_dynamic_kenv() adds an incorrect entry at position 0 of
> >   the dynamic kernel environment. This in turn causes kenv(1) to print
> >   and empty list even though there are dynamic entries added later.
> >
> >   Fix this by checking env_pos in init_dynamic_kenv() and adding dynamic
> >   entries only if there are static entries.
> >
> > Modified:
> >   head/sys/kern/kern_environment.c
> >
> > Modified: head/sys/kern/kern_environment.c
> >
> ==
> > --- head/sys/kern/kern_environment.cFri Apr 12 15:19:35 2013
>  (r249407)
> > +++ head/sys/kern/kern_environment.cFri Apr 12 15:58:53 2013
>  (r249408)
> > @@ -231,20 +231,23 @@ init_dynamic_kenv(void *data __unused)
> > kenvp = malloc((KENV_SIZE + 1) * sizeof(char *), M_KENV,
> > M_WAITOK | M_ZERO);
> > i = 0;
> > -   for (cp = kern_envp; cp != NULL; cp = kernenv_next(cp)) {
> > -   len = strlen(cp) + 1;
> > -   if (len > KENV_MNAMELEN + 1 + KENV_MVALLEN + 1) {
> > -   printf("WARNING: too long kenv string, ignoring
> %s\n",
> > -   cp);
> > -   continue;
> > +   if (env_pos > 0) {
> > +   for (cp = kern_envp; cp != NULL; cp = kernenv_next(cp)) {
> > +   len = strlen(cp) + 1;
> > +   if (len > KENV_MNAMELEN + 1 + KENV_MVALLEN + 1) {
> > +   printf(
> > +   "WARNING: too long kenv string, ignoring
> %s\n",
> > +   cp);
> > +   continue;
> > +   }
> > +   if (i < KENV_SIZE) {
> > +   kenvp[i] = malloc(len, M_KENV, M_WAITOK);
> > +   strcpy(kenvp[i++], cp);
> > +   } else
> > +   printf(
> > +   "WARNING: too many kenv strings,
> ignoring %s\n",
> > +   cp);
> > }
> > -   if (i < KENV_SIZE) {
> > -   kenvp[i] = malloc(len, M_KENV, M_WAITOK);
> > -   strcpy(kenvp[i++], cp);
> > -   } else
> > -   printf(
> > -   "WARNING: too many kenv strings, ignoring
> %s\n",
> > -   cp);
> > }
> > kenvp[i] = NULL;
> >
>


kenv-fix.diff
Description: Binary 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"