svn commit: r314251 - in stable: 10/contrib/ipfilter/lib 10/sys/contrib/ipfilter/netinet 11/contrib/ipfilter/lib 11/sys/contrib/ipfilter/netinet

2017-02-25 Thread Cy Schubert
Author: cy
Date: Sat Feb 25 08:07:28 2017
New Revision: 314251
URL: https://svnweb.freebsd.org/changeset/base/314251

Log:
  MFC r312787:
  
  Currently the fragment info is placed at the top of the linked list
  under a shared read lock. This patch attempts to upgrade the lock to
  an exclusive write lock. If the exclusive write lock fails to be
  obtained, the current fragment is not placed at the head of the list.
  
  This portion of the patch was inspired by NetBSD ip_frag.c r1.4 (which
  effectively removed the section of code that performed the reordering).
  
  The patch to sys/contrib/ipfilter/netinet/ip_compat.h adds the
  MUTEX_TRY_UPGRADE macro to support the patch to ip_frag.c.
  
  The patch to contrib/ipfilter/lib/rwlock_emul.c supports this patch
  by emulating the mutex in userspace when exercised by ipftest(1).
  
  Inspired by:  NetBSD ip_frag.c r1.4

Modified:
  stable/11/contrib/ipfilter/lib/rwlock_emul.c
  stable/11/sys/contrib/ipfilter/netinet/ip_compat.h
  stable/11/sys/contrib/ipfilter/netinet/ip_frag.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/contrib/ipfilter/lib/rwlock_emul.c
  stable/10/sys/contrib/ipfilter/netinet/ip_compat.h
  stable/10/sys/contrib/ipfilter/netinet/ip_frag.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/11/contrib/ipfilter/lib/rwlock_emul.c
==
--- stable/11/contrib/ipfilter/lib/rwlock_emul.cSat Feb 25 06:11:59 
2017(r314250)
+++ stable/11/contrib/ipfilter/lib/rwlock_emul.cSat Feb 25 08:07:28 
2017(r314251)
@@ -56,6 +56,27 @@ void eMrwlock_write_enter(rw, file, line
 }
 
 
+void eMrwlock_try_upgrade(rw, file, line)
+   eMrwlock_t *rw;
+   char *file;
+   int line;
+{
+   if (rw->eMrw_magic != EMM_MAGIC) {
+   fprintf(stderr, "%s:eMrwlock_write_enter(%p): bad magic: %#x\n",
+   rw->eMrw_owner, rw, rw->eMrw_magic);
+   abort();
+   }
+   if (rw->eMrw_read != 0 || rw->eMrw_write != 0) {
+   fprintf(stderr,
+   "%s:eMrwlock_try_upgrade(%p): already locked: %d/%d\n",
+   rw->eMrw_owner, rw, rw->eMrw_read, rw->eMrw_write);
+   abort();
+   }
+   rw->eMrw_write++;
+   rw->eMrw_heldin = file;
+   rw->eMrw_heldat = line;
+}
+
 void eMrwlock_downgrade(rw, file, line)
eMrwlock_t *rw;
char *file;

Modified: stable/11/sys/contrib/ipfilter/netinet/ip_compat.h
==
--- stable/11/sys/contrib/ipfilter/netinet/ip_compat.h  Sat Feb 25 06:11:59 
2017(r314250)
+++ stable/11/sys/contrib/ipfilter/netinet/ip_compat.h  Sat Feb 25 08:07:28 
2017(r314251)
@@ -165,6 +165,7 @@ struct  ether_addr {
 #defineREAD_ENTER(x)   rw_rlock(&(x)->ipf_lk)
 #defineWRITE_ENTER(x)  rw_wlock(&(x)->ipf_lk)
 #defineMUTEX_DOWNGRADE(x)  rw_downgrade(&(x)->ipf_lk)
+#defineMUTEX_TRY_UPGRADE(x)rw_try_upgrade(&(x)->ipf_lk)
 #defineRWLOCK_INIT(x,y)rw_init(&(x)->ipf_lk, (y))
 #defineRW_DESTROY(x)   rw_destroy(&(x)->ipf_lk)
 #defineRWLOCK_EXIT(x)  do { \
@@ -420,6 +421,8 @@ extern  voidfreembt __P((mb_t *));
 
 # define   MUTEX_DOWNGRADE(x)  eMrwlock_downgrade(&(x)->ipf_emu, \
   __FILE__, __LINE__)
+# define   MUTEX_TRY_UPGRADE(x)eMrwlock_try_upgrade(&(x)->ipf_emu, \
+  __FILE__, __LINE__)
 # define   READ_ENTER(x)   eMrwlock_read_enter(&(x)->ipf_emu, \
__FILE__, __LINE__)
 # define   RWLOCK_INIT(x, y)   eMrwlock_init(&(x)->ipf_emu, y)
@@ -670,6 +673,7 @@ extern  char*ipf_getifname __P((struct i
 # define   READ_ENTER(x)   ;
 # define   WRITE_ENTER(x)  ;
 # define   MUTEX_DOWNGRADE(x)  ;
+# define   MUTEX_TRY_UPGRADE(x);
 # define   RWLOCK_INIT(x, y)   ;
 # define   RWLOCK_EXIT(x)  ;
 # define   RW_DESTROY(x)   ;

Modified: stable/11/sys/contrib/ipfilter/netinet/ip_frag.c
==
--- stable/11/sys/contrib/ipfilter/netinet/ip_frag.cSat Feb 25 06:11:59 
2017(r314250)
+++ stable/11/sys/contrib/ipfilter/netinet/ip_frag.cSat Feb 25 08:07:28 
2017(r314251)
@@ -745,7 +745,7 @@ ipf_frag_lookup(softc, softf, fin, table
} else if (off == 0)
f->ipfr_seen0 = 1;
 
-   if (f != table[idx]) {
+   if (f != table[idx] && MUTEX_TRY_UPGRADE(lock)) {
ipfr_t **fp;
 

svn commit: r314251 - in stable: 10/contrib/ipfilter/lib 10/sys/contrib/ipfilter/netinet 11/contrib/ipfilter/lib 11/sys/contrib/ipfilter/netinet

2017-02-25 Thread Cy Schubert
Author: cy
Date: Sat Feb 25 08:07:28 2017
New Revision: 314251
URL: https://svnweb.freebsd.org/changeset/base/314251

Log:
  MFC r312787:
  
  Currently the fragment info is placed at the top of the linked list
  under a shared read lock. This patch attempts to upgrade the lock to
  an exclusive write lock. If the exclusive write lock fails to be
  obtained, the current fragment is not placed at the head of the list.
  
  This portion of the patch was inspired by NetBSD ip_frag.c r1.4 (which
  effectively removed the section of code that performed the reordering).
  
  The patch to sys/contrib/ipfilter/netinet/ip_compat.h adds the
  MUTEX_TRY_UPGRADE macro to support the patch to ip_frag.c.
  
  The patch to contrib/ipfilter/lib/rwlock_emul.c supports this patch
  by emulating the mutex in userspace when exercised by ipftest(1).
  
  Inspired by:  NetBSD ip_frag.c r1.4

Modified:
  stable/10/contrib/ipfilter/lib/rwlock_emul.c
  stable/10/sys/contrib/ipfilter/netinet/ip_compat.h
  stable/10/sys/contrib/ipfilter/netinet/ip_frag.c
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/contrib/ipfilter/lib/rwlock_emul.c
  stable/11/sys/contrib/ipfilter/netinet/ip_compat.h
  stable/11/sys/contrib/ipfilter/netinet/ip_frag.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/10/contrib/ipfilter/lib/rwlock_emul.c
==
--- stable/10/contrib/ipfilter/lib/rwlock_emul.cSat Feb 25 06:11:59 
2017(r314250)
+++ stable/10/contrib/ipfilter/lib/rwlock_emul.cSat Feb 25 08:07:28 
2017(r314251)
@@ -56,6 +56,27 @@ void eMrwlock_write_enter(rw, file, line
 }
 
 
+void eMrwlock_try_upgrade(rw, file, line)
+   eMrwlock_t *rw;
+   char *file;
+   int line;
+{
+   if (rw->eMrw_magic != EMM_MAGIC) {
+   fprintf(stderr, "%s:eMrwlock_write_enter(%p): bad magic: %#x\n",
+   rw->eMrw_owner, rw, rw->eMrw_magic);
+   abort();
+   }
+   if (rw->eMrw_read != 0 || rw->eMrw_write != 0) {
+   fprintf(stderr,
+   "%s:eMrwlock_try_upgrade(%p): already locked: %d/%d\n",
+   rw->eMrw_owner, rw, rw->eMrw_read, rw->eMrw_write);
+   abort();
+   }
+   rw->eMrw_write++;
+   rw->eMrw_heldin = file;
+   rw->eMrw_heldat = line;
+}
+
 void eMrwlock_downgrade(rw, file, line)
eMrwlock_t *rw;
char *file;

Modified: stable/10/sys/contrib/ipfilter/netinet/ip_compat.h
==
--- stable/10/sys/contrib/ipfilter/netinet/ip_compat.h  Sat Feb 25 06:11:59 
2017(r314250)
+++ stable/10/sys/contrib/ipfilter/netinet/ip_compat.h  Sat Feb 25 08:07:28 
2017(r314251)
@@ -162,6 +162,7 @@ struct  ether_addr {
 #defineREAD_ENTER(x)   rw_rlock(&(x)->ipf_lk)
 #defineWRITE_ENTER(x)  rw_wlock(&(x)->ipf_lk)
 #defineMUTEX_DOWNGRADE(x)  rw_downgrade(&(x)->ipf_lk)
+#defineMUTEX_TRY_UPGRADE(x)rw_try_upgrade(&(x)->ipf_lk)
 #defineRWLOCK_INIT(x,y)rw_init(&(x)->ipf_lk, (y))
 #defineRW_DESTROY(x)   rw_destroy(&(x)->ipf_lk)
 #defineRWLOCK_EXIT(x)  do { \
@@ -406,6 +407,8 @@ extern  voidfreembt __P((mb_t *));
 
 # define   MUTEX_DOWNGRADE(x)  eMrwlock_downgrade(&(x)->ipf_emu, \
   __FILE__, __LINE__)
+# define   MUTEX_TRY_UPGRADE(x)eMrwlock_try_upgrade(&(x)->ipf_emu, \
+  __FILE__, __LINE__)
 # define   READ_ENTER(x)   eMrwlock_read_enter(&(x)->ipf_emu, \
__FILE__, __LINE__)
 # define   RWLOCK_INIT(x, y)   eMrwlock_init(&(x)->ipf_emu, y)
@@ -656,6 +659,7 @@ extern  char*ipf_getifname __P((struct i
 # define   READ_ENTER(x)   ;
 # define   WRITE_ENTER(x)  ;
 # define   MUTEX_DOWNGRADE(x)  ;
+# define   MUTEX_TRY_UPGRADE(x);
 # define   RWLOCK_INIT(x, y)   ;
 # define   RWLOCK_EXIT(x)  ;
 # define   RW_DESTROY(x)   ;

Modified: stable/10/sys/contrib/ipfilter/netinet/ip_frag.c
==
--- stable/10/sys/contrib/ipfilter/netinet/ip_frag.cSat Feb 25 06:11:59 
2017(r314250)
+++ stable/10/sys/contrib/ipfilter/netinet/ip_frag.cSat Feb 25 08:07:28 
2017(r314251)
@@ -743,7 +743,7 @@ ipf_frag_lookup(softc, softf, fin, table
} else if (off == 0)
f->ipfr_seen0 = 1;
 
-   if (f != table[idx]) {
+   if (f != table[idx] && MUTEX_TRY_UPGRADE(lock)) {
ipfr_t **fp;
 

Re: svn commit: r314216 - head/sys/x86/x86

2017-02-25 Thread Konstantin Belousov
On Sat, Feb 25, 2017 at 09:50:32AM +0200, Andriy Gapon wrote:
> On 24/02/2017 20:56, Jonathan T. Looney wrote:
> > Author: jtl
> > Date: Fri Feb 24 18:56:00 2017
> > New Revision: 314216
> > URL: https://svnweb.freebsd.org/changeset/base/314216
> > 
> > Log:
> >   We have seen several cases recently where we appear to get a double-fault:
> >   We have an original panic. Then, instead of writing the core to the dump
> >   device, the kernel has a second panic: "smp_targeted_tlb_shootdown:
> >   interrupts disabled". This change is an attempt to fix that second panic.
> 
> Just curious if you were able to find out what code caused those shootdowns to
> be sent.
> It's pretty unusual for the after-panic code to do things like that.
Memory allocations for busdma in coredumping path do that.

I know this from spending a lot of time making core dumps working with
DMAR busdma.
> 
> 
> >   When the other CPUs are stopped, we can't notify them of the TLB 
> > shootdown,
> >   so we skip that operation. However, when the CPUs come back up, we
> >   invalidate the TLB to ensure they correctly observe any changes to the
> >   page mappings.
> >   
> >   Reviewed by:  kib
> >   Sponsored by: Netflix
> >   Differential Revision:https://reviews.freebsd.org/D9786
> > 
> > Modified:
> >   head/sys/x86/x86/mp_x86.c
> > 
> > Modified: head/sys/x86/x86/mp_x86.c
> > ==
> > --- head/sys/x86/x86/mp_x86.c   Fri Feb 24 17:36:55 2017
> > (r314215)
> > +++ head/sys/x86/x86/mp_x86.c   Fri Feb 24 18:56:00 2017
> > (r314216)
> > @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
> >  #ifdef GPROF 
> >  #include 
> >  #endif
> > +#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -1269,6 +1270,12 @@ cpustop_handler_post(u_int cpu)
> > CPU_CLR_ATOMIC(cpu, &started_cpus);
> > CPU_CLR_ATOMIC(cpu, &stopped_cpus);
> >  
> > +   /*
> > +* We don't broadcast TLB invalidations to other CPUs when they are
> > +* stopped. Hence, we clear the TLB before resuming.
> > +*/
> > +   invltlb_glob();
> > +
> >  #if defined(__amd64__) && defined(DDB)
> > amd64_db_resume_dbreg();
> >  #endif
> > @@ -1427,6 +1434,10 @@ smp_targeted_tlb_shootdown(cpuset_t mask
> > uint32_t generation;
> > int cpu;
> >  
> > +   /* It is not necessary to signal other CPUs while in the debugger. */
> > +   if (kdb_active || panicstr != NULL)
> > +   return;
> > +
> > /*
> >  * Check for other cpus.  Return if none.
> >  */
> > 
> 
> 
> -- 
> Andriy Gapon
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r314210 - in stable/11/sys: conf i386/conf i386/i386 i386/include i386/isa i386/linux x86/acpica x86/x86

2017-02-25 Thread Konstantin Belousov
On Sat, Feb 25, 2017 at 11:18:30AM +1100, Bruce Evans wrote:
> On Fri, 24 Feb 2017, John Baldwin wrote:
> 
> > On Friday, February 24, 2017 07:14:05 PM Konstantin Belousov wrote:
> >> On Fri, Feb 24, 2017 at 08:53:27AM -0800, Rodney W. Grimes wrote:
>  Author: kib
>  Date: Fri Feb 24 16:02:01 2017
>  New Revision: 314210
>  URL: https://svnweb.freebsd.org/changeset/base/314210
> 
>  Log:
>    MFC r313154:
>    For i386, remove config options CPU_DISABLE_CMPXCHG, CPU_DISABLE_SSE
>    and device npx.
> >>>
> >>> Um, why?
> 
> Since the static configuration is only useful for testing, and complicates
> the code, and tends to rot (it was most recently broken by only adding
> fcmpset() in the !CPU_DISABLE_CMPXCHG clause of atomic.h and then using
> fcmpset() in MI code without any ifdef).
> 
> >>> Makes it much easier to test soft float if we can remove
> >>> the npx device.   Or has soft float support died yet again?
> 
> Not much easier.  First you have to fix the bitrot.  Than maybe rewrite
> the static configuration code to be less complicated and more maintainable.
> It is easier to use dynamic configuration for everything.  This only costs
> a few hundred bytes (unless you have really large and complicated ifdefs
> to omit more code statically) and a few cycles quite often at runtime.  No
> one cares much about the few cycles.
> 
> >> Soft float was removed very long time ago.
> >
> > I think it was gone in 5.0.
> >
> >>> Yes, an i386 without an FPU is anchient by why are we removing working
> >>> functionality?
> >> This question makes an impression that you think that kernel would not
> >> boot on a machine without FPU.  The code to tolerate such configuration
> >> is there, but it is not tested for obvious reasons.
> >>
> >> Completely different issue is that userspace requires FPU and e.g. /bin/sh
> >> traps on the next setjmp(3) call.
> 
> This is my context-switching code for the FPU in setjmp().  It requires
> either an FPU or an emulator, and there was an emulator when it was written.
> 
> When I discussed removing the static configuration code with kib, I
> mentioned that SSE is still not properly supported on i386, but haven't
> got around to responding with the details.  The main one is this code
> in setjmp().  It is is still completely missing SSE support.  So FPU+SSE
> states set by fenv get restored inconsistently by longjmp().  The current
> brokenness seems to be:
> - i386 restores the control word for the i387 only.  fenve has dynamic
>SSE tests, and it sets both the x87 and the SSE control works for
>things like fesetround().  Then longjmp() leaves the SSE control word
>inconsistent.
We do not have unused space in the jmp_buf to preserve SSE state.
Do you mean to restore SSE MXCSR control bits to the same state as x87 cw ?

> - both amd64 and i386 attempt to preserve the exception flags.  This
>might be useful, but is quite broken.
> 
>My original fixes cleared the i387 env before restoring the control
>word.  Other systems were broken in not restoring anything or more
>broken in not clearing anything.  According to das's commits that
>changed this, other systems still didn't restore the control word(s)
>16 years later in 2008, and C99 doesn't require restoring the control
>words, but C99 does require restoring the status word.  I couldn't
>find where C99 requires this.
> 
>For the i387 or any FPU with similar or even more imprecise exceptions,
>leaving unmasked exceptions to trap again later would be painful.
> 
>Anyway, das's changes don't really work:
>- kib committed my fix to stop clearing x87 exception flags in the
>  kernel part of the SIGFPE handler in 2012.  This makes x87 exceptions
>  faults (repeat at the FP instruction that trapped, if a SIGFPE handler
>  returns), which is too surprising for most applications, but few notice
>  because few even unmask the traps.  So it is now possible to recover
>  the exception flags.  But this is quite complicated, and far too hard
>  to do in longjmp() from a signal handler.  So the flags aren't actually
>  preserved for the longjmp() freom a signal handler.
>- for the x87, there is other state to restore or clear.  The status word
>  contains the stack pointer together with the exception flags.  The tag
>  word contains the status of the 8 registers on the stack.  The stack
>  pointer can be anything provided the tag word is clear.  For longjmp()
>  from signal handlers, we depend on signal handlers getting a clean
>  state so that there is no garbage on the stack.  I'm not sure if all
>  combinations of kernels and libraries are consistent about this (old
>  signal handlers don't do this, but should only be used with old
>  setjmp()/longjmp() that clear the state).  For longjmp() not from
>  signal handlers, we depend on the ABI guaranteeing that there is
>  no garb

Re: svn commit: r314239 - head/rescue/rescue

2017-02-25 Thread Ngie Cooper (yaneurabeya)

> On Feb 24, 2017, at 23:52, Andriy Gapon  wrote:
> 
> On 25/02/2017 05:11, Ngie Cooper wrote:
>> Author: ngie
>> Date: Sat Feb 25 03:11:08 2017
>> New Revision: 314239
>> URL: https://svnweb.freebsd.org/changeset/base/314239
>> 
>> Log:
>>  Add shutdown/poweroff support to rescue(8)
>> 
>>  shutdown is a safer way to power off than reboot (in general), because of
>>  the added shutdown process that it executes via /etc/rc.shutdown . It was
>>  odd that it was missing from rescue(8) since reboot and friends were
>>  added in past commits.
> 
> Just a note that rescue is typically used in situations where rc.shutdown is 
> of
> little use.  E.g., most likely there won't be any daemons running, etc.

Yeah.. or arguably ones of value. I still like the fact that it’s running 
“service  stop” on /etc/rc.d scripts in reverse to shut things down 
cleanly, as opposed to reboot(8) which just reboots. This can make a bit of a 
difference if you just set up a system and still have mount points setup, etc.

But in most cases, yes, I would totally agree.

-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r314087 - head/sys/x86/x86

2017-02-25 Thread Konstantin Belousov
On Sat, Feb 25, 2017 at 02:17:23PM +1100, Bruce Evans wrote:
> On Fri, 24 Feb 2017, Konstantin Belousov wrote:
> 
> > On Thu, Feb 23, 2017 at 06:33:43AM +1100, Bruce Evans wrote:
> >> On Wed, 22 Feb 2017, Konstantin Belousov wrote:
> >>
> >>> Log:
> >>>  More fixes for regression in r313898 on i386.
> >>>  Use long long constants where needed.
> >>
> >> The long long abomination is never needed, and is always a style bug.
> > I never saw any explanation behind this claim.  Esp. the first part
> > of it, WRT 'never needed'.
> 
> I hope I wrote enough about this in log messages when I cleaned up the
> long longs 20 years ago :-).
> 
> long long was a hack to work around intmax_t not existing and long being
> unexpandable in practice because it was used in ABIs.  It should have gone
> away when intmax_t was standardized.  Unfortunately, long long was
> standardised too.
It does not make a sense even more.  long long is native compiler type,
while anything_t is a typename to provide MI fixed type.  long long was
obviosvly choosen to extend types without requiring new keyword.

> 
> It is "never needed" since anything that can be done with it can be done
> better using intmax_t or intN_t or int_fastN_T or int_leastN_t.  Except,
> there is no suffix for explicit intmax_t constants, so you would have to
> write such constants using INTMAX_C() or better a cast to intmax_t if
> the constant is not needed in a cpp expression.
If you replace long long with int there, the same logical structure of
sentences will hold.  Does it mean that 'int' is abomination since we
have int32_t which allows everything to be done better ?

> 
> >> I don't like using explicit long constants either.  Here the number of bits
> >> in the register is fixed by the hardware at 64.  The number of bits in a
> >> long on amd64 and a long on i386 is only fixed by ABI because the ABI is
> >> broken for historical reasons.
> > I really cannot make any sense of this statement.
> 
> To know that the ULL suffix is correct for 64-bit types, you have to now
> that long longs are 64 bits on all arches supported by the code.  Then
> to use this suffix, you have to hard-code this knowledge.  Then to read
> the code, the reader has to translate back to 64 bits.  The translations
> were easier 1 arch at a time.
And why it is bad ?  Same is true for int and long, which are often used
in MD code to provide specific word size.  In fact, there is not much for
a programmer to know: we and any other UNIX supports either ILP32 or LP64
for the given architecture.

> Casting to uint64_t is clearer, but doesn't
> work in cpp expressions.  In cpp expressions, use UINT64_C().  Almost no
> one knows about it uses this.  There are 5 examples of using it in /sys
> (3 in arm64 pte.h, 1 in powerpc pte.h, and 1 in mips xlr_machdep.c,
> where the use is unnecessary but interesting: it is ~UINT64_C(0).  We
> used to have squillions of magic ~0's for the rman max limit.  This was
> spelled ~0U, ~0UL and perhaps even plain ~0.  Plain ~0 worked best except
> on unsupported 1's complement machines, since it normally gets sign extended
> to as many bits as necessary.  Now this is spelled RM_MAX_END, which is
> implemented non-magically using a cast: (~(rman_res_t)0).  Grepping for
> ~0[uU] in dev/* shows only 1 obvious unconverted place.
This clearly demonstrates why ULL/UL notation is superior to UINT64_C() or
any other obfuscation.

> 
> >>  Only very MD code can safely assume the
> >> size of long and long long.  This code was MD enough before it was merged,
> >> but now it shouldn't use long since that varies between amd64 and i386,
> >> and it shouldn't use long long since that is a style bug.
> >
> > Well, I do not see anything wrong with long long, at least until
> > explained.
> >
> > Anyway, below is the patch to use uint64_t cast in important place,
> > and removal of LL suffix in unimportant expression.
> 
> This is correct.
> 
> > diff --git a/sys/x86/x86/x86_mem.c b/sys/x86/x86/x86_mem.c
> > index d639224f840..8bc4d3917a0 100644
> > --- a/sys/x86/x86/x86_mem.c
> > +++ b/sys/x86/x86/x86_mem.c
> > @@ -260,7 +260,7 @@ x86_mrfetch(struct mem_range_softc *sc)
> >
> > /* Compute the range from the mask. Ick. */
> > mrd->mr_len = (~(msrv & mtrr_physmask) &
> > -   (mtrr_physmask | 0xfffLL)) + 1;
> > +   (mtrr_physmask | 0xfff)) + 1;
> > if (!mrvalid(mrd->mr_base, mrd->mr_len))
> > mrd->mr_flags |= MDF_BOGUS;
> >
> > @@ -638,7 +638,8 @@ x86_mrinit(struct mem_range_softc *sc)
> >  * Determine the size of the PhysMask and PhysBase fields in
> >  * the variable range MTRRs.
> >  */
> > -   mtrr_physmask = (((uint64_t)1 << cpu_maxphyaddr) - 1) & ~0xfffULL;
> > +   mtrr_physmask = (((uint64_t)1 << cpu_maxphyaddr) - 1) &
> > +   ~(uint64_t)0xfff;
> >
> > /* If fixed MTRRs supported and enabled. */
> > if ((mtrrcap & MTRR_CAP_FIXED) && (mtrrdef & MTRR_DEF_FIXED_ENABLE)) {
> 
> Now 

svn commit: r314252 - head/sys/x86/x86

2017-02-25 Thread Konstantin Belousov
Author: kib
Date: Sat Feb 25 10:32:49 2017
New Revision: 314252
URL: https://svnweb.freebsd.org/changeset/base/314252

Log:
  Do not use ULL suffix.  Cast to uint64_t where the suffix is needed,
  and just remove it in another place.
  
  Requested by: bde
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/x86/x86/x86_mem.c

Modified: head/sys/x86/x86/x86_mem.c
==
--- head/sys/x86/x86/x86_mem.c  Sat Feb 25 08:07:28 2017(r314251)
+++ head/sys/x86/x86/x86_mem.c  Sat Feb 25 10:32:49 2017(r314252)
@@ -260,7 +260,7 @@ x86_mrfetch(struct mem_range_softc *sc)
 
/* Compute the range from the mask. Ick. */
mrd->mr_len = (~(msrv & mtrr_physmask) &
-   (mtrr_physmask | 0xfffLL)) + 1;
+   (mtrr_physmask | 0xfff)) + 1;
if (!mrvalid(mrd->mr_base, mrd->mr_len))
mrd->mr_flags |= MDF_BOGUS;
 
@@ -638,7 +638,8 @@ x86_mrinit(struct mem_range_softc *sc)
 * Determine the size of the PhysMask and PhysBase fields in
 * the variable range MTRRs.
 */
-   mtrr_physmask = (((uint64_t)1 << cpu_maxphyaddr) - 1) & ~0xfffULL;
+   mtrr_physmask = (((uint64_t)1 << cpu_maxphyaddr) - 1) &
+   ~(uint64_t)0xfff;
 
/* If fixed MTRRs supported and enabled. */
if ((mtrrcap & MTRR_CAP_FIXED) && (mtrrdef & MTRR_DEF_FIXED_ENABLE)) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r314253 - in head/sys: fs/nfsserver kern sys ufs/ffs

2017-02-25 Thread Konstantin Belousov
Author: kib
Date: Sat Feb 25 10:38:18 2017
New Revision: 314253
URL: https://svnweb.freebsd.org/changeset/base/314253

Log:
  Do not leak mount references for dying threads.
  
  Thread might create a condition for delayed SU cleanup, which creates
  a reference to the mount point in td_su, but exit without returning
  through userret(), e.g. when terminating due to single-threading or
  process exit.  In this case, td_su reference is not dropped and mount
  point cannot be freed.
  
  Handle the situation by clearing td_su also in the thread destructor
  and in exit1().  softdep_ast_cleanup() has to receive the thread as
  argument, since e.g. thread destructor is executed in different
  context.
  
  Reported and tested by:   pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/fs/nfsserver/nfs_nfsdkrpc.c
  head/sys/kern/kern_exit.c
  head/sys/kern/kern_thread.c
  head/sys/kern/subr_trap.c
  head/sys/sys/proc.h
  head/sys/sys/systm.h
  head/sys/ufs/ffs/ffs_softdep.c

Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c
==
--- head/sys/fs/nfsserver/nfs_nfsdkrpc.cSat Feb 25 10:32:49 2017
(r314252)
+++ head/sys/fs/nfsserver/nfs_nfsdkrpc.cSat Feb 25 10:38:18 2017
(r314253)
@@ -304,8 +304,7 @@ nfssvc_program(struct svc_req *rqst, SVC
svc_freereq(rqst);
 
 out:
-   if (softdep_ast_cleanup != NULL)
-   softdep_ast_cleanup();
+   td_softdep_cleanup(curthread);
NFSEXITCODE(0);
 }
 

Modified: head/sys/kern/kern_exit.c
==
--- head/sys/kern/kern_exit.c   Sat Feb 25 10:32:49 2017(r314252)
+++ head/sys/kern/kern_exit.c   Sat Feb 25 10:38:18 2017(r314253)
@@ -207,8 +207,7 @@ exit1(struct thread *td, int rval, int s
/*
 * Deref SU mp, since the thread does not return to userspace.
 */
-   if (softdep_ast_cleanup != NULL)
-   softdep_ast_cleanup();
+   td_softdep_cleanup(td);
 
/*
 * MUST abort all other threads before proceeding past here.

Modified: head/sys/kern/kern_thread.c
==
--- head/sys/kern/kern_thread.c Sat Feb 25 10:32:49 2017(r314252)
+++ head/sys/kern/kern_thread.c Sat Feb 25 10:38:18 2017(r314253)
@@ -192,6 +192,8 @@ thread_dtor(void *mem, int size, void *a
 #endif
/* Free all OSD associated to this thread. */
osd_thread_exit(td);
+   td_softdep_cleanup(td);
+   MPASS(td->td_su == NULL);
 
EVENTHANDLER_INVOKE(thread_dtor, td);
tid_free(td->td_tid);

Modified: head/sys/kern/subr_trap.c
==
--- head/sys/kern/subr_trap.c   Sat Feb 25 10:32:49 2017(r314252)
+++ head/sys/kern/subr_trap.c   Sat Feb 25 10:38:18 2017(r314253)
@@ -86,7 +86,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-void (*softdep_ast_cleanup)(void);
+void (*softdep_ast_cleanup)(struct thread *);
 
 /*
  * Define the code needed before returning to user mode, for trap and
@@ -128,8 +128,8 @@ userret(struct thread *td, struct trapfr
 #ifdef KTRACE
KTRUSERRET(td);
 #endif
-   if (softdep_ast_cleanup != NULL)
-   softdep_ast_cleanup();
+   td_softdep_cleanup(td);
+   MPASS(td->td_su == NULL);
 
/*
 * If this thread tickled GEOM, we need to wait for the giggling to

Modified: head/sys/sys/proc.h
==
--- head/sys/sys/proc.h Sat Feb 25 10:32:49 2017(r314252)
+++ head/sys/sys/proc.h Sat Feb 25 10:38:18 2017(r314253)
@@ -1114,6 +1114,15 @@ td_get_sched(struct thread *td)
return ((struct td_sched *)&td[1]);
 }
 
+extern void (*softdep_ast_cleanup)(struct thread *);
+static __inline void
+td_softdep_cleanup(struct thread *td)
+{
+
+   if (td->td_su != NULL && softdep_ast_cleanup != NULL)
+   softdep_ast_cleanup(td);
+}
+
 #endif /* _KERNEL */
 
 #endif /* !_SYS_PROC_H_ */

Modified: head/sys/sys/systm.h
==
--- head/sys/sys/systm.hSat Feb 25 10:32:49 2017(r314252)
+++ head/sys/sys/systm.hSat Feb 25 10:38:18 2017(r314253)
@@ -452,8 +452,6 @@ void free_unr(struct unrhdr *uh, u_int i
 
 void   intr_prof_stack_use(struct thread *td, struct trapframe *frame);
 
-extern void (*softdep_ast_cleanup)(void);
-
 void counted_warning(unsigned *counter, const char *msg);
 
 __NULLABILITY_PRAGMA_POP

Modified: head/sys/ufs/ffs/ffs_softdep.c
==
--- head/sys/ufs/ffs/ffs_softdep.c  Sat Feb 25 10:32:49 2017
(r314252)
+++ head/sys/ufs/ffs/ffs_softdep.c  Sat Feb 25 10:38:18 2017  

svn commit: r314254 - head/sys/dev/usb/storage

2017-02-25 Thread Alexander Motin
Author: mav
Date: Sat Feb 25 12:11:07 2017
New Revision: 314254
URL: https://svnweb.freebsd.org/changeset/base/314254

Log:
  Update kern_data_resid according to r312291.
  
  This now mandatory for correct operation.

Modified:
  head/sys/dev/usb/storage/cfumass.c

Modified: head/sys/dev/usb/storage/cfumass.c
==
--- head/sys/dev/usb/storage/cfumass.c  Sat Feb 25 10:38:18 2017
(r314253)
+++ head/sys/dev/usb/storage/cfumass.c  Sat Feb 25 12:11:07 2017
(r314254)
@@ -720,11 +720,6 @@ cfumass_t_data_out_callback(struct usb_x
int actlen, ctl_sg_count;
 
sc = usbd_xfer_softc(xfer);
-
-   CFUMASS_DEBUG(sc, "go");
-
-   usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL);
-
io = sc->sc_ctl_io;
 
if (io->scsiio.kern_sg_entries > 0) {
@@ -741,25 +736,17 @@ cfumass_t_data_out_callback(struct usb_x
case USB_ST_TRANSFERRED:
CFUMASS_DEBUG(sc, "USB_ST_TRANSFERRED");
 
-   /*
-* If the host sent less data than required, zero-out
-* the remaining buffer space, to prevent a malicious host
-* to writing uninitialized kernel memory to the disk.
-*/
+   usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL);
if (actlen != ctl_sglist[0].len) {
KASSERT(actlen <= ctl_sglist[0].len,
("actlen %d > ctl_sglist.len %zd",
actlen, ctl_sglist[0].len));
-
CFUMASS_DEBUG(sc, "host transferred %d bytes"
"instead of expected %zd bytes",
actlen, ctl_sglist[0].len);
-
-   memset((char *)(ctl_sglist[0].addr) + actlen, 0,
-   ctl_sglist[0].len - actlen);
}
-
-   sc->sc_current_residue = 0;
+   sc->sc_current_residue -= actlen;
+   io->scsiio.kern_data_resid -= actlen;
io->scsiio.be_move_done(io);
sc->sc_ctl_io = NULL;
break;
@@ -795,17 +782,18 @@ cfumass_t_data_in_callback(struct usb_xf
union ctl_io *io;
uint32_t max_bulk;
struct ctl_sg_entry ctl_sg_entry, *ctl_sglist;
-   int ctl_sg_count;
+   int actlen, ctl_sg_count;
 
sc = usbd_xfer_softc(xfer);
-   max_bulk = usbd_xfer_max_len(xfer);
-
io = sc->sc_ctl_io;
 
switch (USB_GET_STATE(xfer)) {
case USB_ST_TRANSFERRED:
CFUMASS_DEBUG(sc, "USB_ST_TRANSFERRED");
 
+   usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL);
+   sc->sc_current_residue -= actlen;
+   io->scsiio.kern_data_resid -= actlen;
io->scsiio.be_move_done(io);
sc->sc_ctl_io = NULL;
break;
@@ -829,12 +817,9 @@ tr_setup:
"we will send %ju and stall",
sc->sc_current_transfer_length,
(uintmax_t)io->scsiio.kern_total_len);
-   sc->sc_current_residue = sc->sc_current_transfer_length 
-
-   io->scsiio.kern_total_len;
-   } else {
-   sc->sc_current_residue = 0;
}
 
+   max_bulk = usbd_xfer_max_len(xfer);
CFUMASS_DEBUG(sc, "max_bulk %d, requested size %d, "
"CTL segment size %zd", max_bulk,
sc->sc_current_transfer_length, ctl_sglist[0].len);
@@ -956,8 +941,6 @@ cfumass_datamove(union ctl_io *io)
goto fail;
}
 
-   /* We hadn't received anything during this datamove yet. */
-   io->scsiio.ext_data_filled = 0;
cfumass_transfer_start(sc, CFUMASS_T_DATA_OUT);
}
 
@@ -1028,8 +1011,7 @@ cfumass_init(void)
 
cfumass_port.frontend = &cfumass_frontend;
cfumass_port.port_type = CTL_PORT_UMASS;
-   /* XXX KDM what should the real number be here? */
-   cfumass_port.num_requested_ctl_io = 4096;
+   cfumass_port.num_requested_ctl_io = 1;
cfumass_port.port_name = "cfumass";
cfumass_port.physical_port = 0;
cfumass_port.virtual_port = 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r314255 - head/sys/cam/ctl

2017-02-25 Thread Alexander Motin
Author: mav
Date: Sat Feb 25 14:20:30 2017
New Revision: 314255
URL: https://svnweb.freebsd.org/changeset/base/314255

Log:
  Reenable CTL_WITH_CA, optimizing it for lower memory usage.
  
  This code was disabled due to its high memory usage.  But now we need this
  functionality for cfumass(4) frontend, since USB MS BBB transport does not
  support autosense.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl_private.h

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Sat Feb 25 12:11:07 2017(r314254)
+++ head/sys/cam/ctl/ctl.c  Sat Feb 25 14:20:30 2017(r314255)
@@ -2146,8 +2146,8 @@ ctl_add_initiator(struct ctl_port *port,
port->wwpn_iid[iid].name);
 
/*
-* XXX KDM clear have_ca and ua_pending on each LUN for
-* this initiator.
+* XXX KDM clear pending_sense and pending_ua on each LUN
+* for this initiator.
 */
}
 take:
@@ -9145,7 +9145,7 @@ ctl_request_sense(struct ctl_scsiio *cts
struct ctl_softc *softc = CTL_SOFTC(ctsio);
struct ctl_lun *lun = CTL_LUN(ctsio);
struct scsi_request_sense *cdb;
-   struct scsi_sense_data *sense_ptr;
+   struct scsi_sense_data *sense_ptr, *ps;
uint32_t initidx;
int have_error;
u_int sense_len = SSD_FULL_SIZE;
@@ -9201,15 +9201,17 @@ ctl_request_sense(struct ctl_scsiio *cts
 * Pending sense gets returned first, then pending unit attentions.
 */
mtx_lock(&lun->lun_lock);
-#ifdef CTL_WITH_CA
-   if (ctl_is_set(lun->have_ca, initidx)) {
+   ps = lun->pending_sense[initidx / CTL_MAX_INIT_PER_PORT];
+   if (ps != NULL)
+   ps += initidx % CTL_MAX_INIT_PER_PORT;
+   if (ps != NULL && ps->error_code != 0) {
scsi_sense_data_type stored_format;
 
/*
 * Check to see which sense format was used for the stored
 * sense data.
 */
-   stored_format = scsi_sense_type(&lun->pending_sense[initidx]);
+   stored_format = scsi_sense_type(ps);
 
/*
 * If the user requested a different sense format than the
@@ -9224,23 +9226,17 @@ ctl_request_sense(struct ctl_scsiio *cts
if ((stored_format == SSD_TYPE_FIXED)
 && (sense_format == SSD_TYPE_DESC))
ctl_sense_to_desc((struct scsi_sense_data_fixed *)
-   &lun->pending_sense[initidx],
-   (struct scsi_sense_data_desc *)sense_ptr);
+   ps, (struct scsi_sense_data_desc *)sense_ptr);
else if ((stored_format == SSD_TYPE_DESC)
  && (sense_format == SSD_TYPE_FIXED))
ctl_sense_to_fixed((struct scsi_sense_data_desc *)
-   &lun->pending_sense[initidx],
-   (struct scsi_sense_data_fixed *)sense_ptr);
+   ps, (struct scsi_sense_data_fixed *)sense_ptr);
else
-   memcpy(sense_ptr, &lun->pending_sense[initidx],
-  MIN(sizeof(*sense_ptr),
-  sizeof(lun->pending_sense[initidx])));
+   memcpy(sense_ptr, ps, sizeof(*sense_ptr));
 
-   ctl_clear_mask(lun->have_ca, initidx);
+   ps->error_code = 0;
have_error = 1;
-   } else
-#endif
-   if (have_error == 0) {
+   } else {
ua_type = ctl_build_ua(lun, initidx, sense_ptr, &sense_len,
sense_format);
if (ua_type != CTL_UA_NONE)
@@ -11360,17 +11356,19 @@ ctl_scsiio_precheck(struct ctl_softc *so
 
initidx = ctl_get_initindex(&ctsio->io_hdr.nexus);
 
-#ifdef CTL_WITH_CA
/*
 * If we've got a request sense, it'll clear the contingent
 * allegiance condition.  Otherwise, if we have a CA condition for
 * this initiator, clear it, because it sent down a command other
 * than request sense.
 */
-   if ((ctsio->cdb[0] != REQUEST_SENSE)
-&& (ctl_is_set(lun->have_ca, initidx)))
-   ctl_clear_mask(lun->have_ca, initidx);
-#endif
+   if (ctsio->cdb[0] != REQUEST_SENSE) {
+   struct scsi_sense_data *ps;
+
+   ps = lun->pending_sense[initidx / CTL_MAX_INIT_PER_PORT];
+   if (ps != NULL)
+   ps[initidx % CTL_MAX_INIT_PER_PORT].error_code = 0;
+   }
 
/*
 * If the command has this flag set, it handles its own unit
@@ -11708,10 +11706,10 @@ ctl_do_lun_reset(struct ctl_lun *lun, un
 */
lun->flags &= ~CTL_LUN_RESERVED;
 
-#ifdef CTL_WITH_CA
-   for (i = 0; i < CTL_MAX_INITIATORS; i++)
- 

svn commit: r314256 - head/sys/dev/usb/storage

2017-02-25 Thread Alexander Motin
Author: mav
Date: Sat Feb 25 14:24:29 2017
New Revision: 314256
URL: https://svnweb.freebsd.org/changeset/base/314256

Log:
  Use ctl_queue_sense() to implement sense data reporting.
  
  USB MS BBB transport does not support autosense, so we have to queue any
  sense data back to CTL for later fetching via REQUEST SENSE.

Modified:
  head/sys/dev/usb/storage/cfumass.c

Modified: head/sys/dev/usb/storage/cfumass.c
==
--- head/sys/dev/usb/storage/cfumass.c  Sat Feb 25 14:20:30 2017
(r314255)
+++ head/sys/dev/usb/storage/cfumass.c  Sat Feb 25 14:24:29 2017
(r314256)
@@ -987,19 +987,21 @@ cfumass_done(union ctl_io *io)
return;
}
 
-   switch (io->scsiio.scsi_status) {
-   case SCSI_STATUS_OK:
+   if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)
sc->sc_current_status = 0;
-   break;
-   default:
+   else
sc->sc_current_status = 1;
-   break;
-   }
+
+   /* XXX: How should we report BUSY, RESERVATION CONFLICT, etc? */
+   if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SCSI_ERROR &&
+   io->scsiio.scsi_status == SCSI_STATUS_CHECK_COND)
+   ctl_queue_sense(io);
+   else
+   ctl_free_io(io);
 
CFUMASS_LOCK(sc);
cfumass_transfer_start(sc, CFUMASS_T_STATUS);
CFUMASS_UNLOCK(sc);
-   ctl_free_io(io);
 
refcount_release(&sc->sc_queued);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r314257 - head/sys/cam/ctl

2017-02-25 Thread Alexander Motin
Author: mav
Date: Sat Feb 25 14:36:24 2017
New Revision: 314257
URL: https://svnweb.freebsd.org/changeset/base/314257

Log:
  Add reporting SAS protocol, in case we ever have one.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl_frontend.c

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Sat Feb 25 14:24:29 2017(r314256)
+++ head/sys/cam/ctl/ctl.c  Sat Feb 25 14:36:24 2017(r314257)
@@ -9549,6 +9549,8 @@ ctl_inquiry_evpd_devid(struct ctl_scsiio
 
if (port && port->port_type == CTL_PORT_FC)
proto = SCSI_PROTO_FC << 4;
+   else if (port->port_type == CTL_PORT_SAS)
+   proto = SCSI_PROTO_SAS << 4;
else if (port && port->port_type == CTL_PORT_ISCSI)
proto = SCSI_PROTO_ISCSI << 4;
else

Modified: head/sys/cam/ctl/ctl_frontend.c
==
--- head/sys/cam/ctl/ctl_frontend.c Sat Feb 25 14:24:29 2017
(r314256)
+++ head/sys/cam/ctl/ctl_frontend.c Sat Feb 25 14:36:24 2017
(r314257)
@@ -264,6 +264,8 @@ ctl_port_set_wwns(struct ctl_port *port,
 
if (port->port_type == CTL_PORT_FC)
proto = SCSI_PROTO_FC << 4;
+   else if (port->port_type == CTL_PORT_SAS)
+   proto = SCSI_PROTO_SAS << 4;
else if (port->port_type == CTL_PORT_ISCSI)
proto = SCSI_PROTO_ISCSI << 4;
else
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r314259 - vendor/llvm/llvm-release_40-r296202

2017-02-25 Thread Dimitry Andric
Author: dim
Date: Sat Feb 25 14:40:37 2017
New Revision: 314259
URL: https://svnweb.freebsd.org/changeset/base/314259

Log:
  Tag llvm release_40 branch r296202.

Added:
  vendor/llvm/llvm-release_40-r296202/
 - copied from r314258, vendor/llvm/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r314261 - vendor/clang/clang-release_40-r296202

2017-02-25 Thread Dimitry Andric
Author: dim
Date: Sat Feb 25 14:40:46 2017
New Revision: 314261
URL: https://svnweb.freebsd.org/changeset/base/314261

Log:
  Tag clang release_40 branch r296202.

Added:
  vendor/clang/clang-release_40-r296202/
 - copied from r314260, vendor/clang/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r314260 - in vendor/clang/dist: docs lib/CodeGen lib/Frontend lib/StaticAnalyzer/Checkers test/Analysis test/OpenMP test/Sema

2017-02-25 Thread Dimitry Andric
Author: dim
Date: Sat Feb 25 14:40:42 2017
New Revision: 314260
URL: https://svnweb.freebsd.org/changeset/base/314260

Log:
  Vendor import of clang release_40 branch r296202:
  https://llvm.org/svn/llvm-project/cfe/branches/release_40@296202

Modified:
  vendor/clang/dist/docs/ReleaseNotes.rst
  vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp
  vendor/clang/dist/lib/Frontend/InitPreprocessor.cpp
  vendor/clang/dist/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
  vendor/clang/dist/test/Analysis/virtualcall.cpp
  vendor/clang/dist/test/OpenMP/cancellation_point_codegen.cpp
  vendor/clang/dist/test/Sema/atomic-ops.c

Modified: vendor/clang/dist/docs/ReleaseNotes.rst
==
--- vendor/clang/dist/docs/ReleaseNotes.rst Sat Feb 25 14:40:37 2017
(r314259)
+++ vendor/clang/dist/docs/ReleaseNotes.rst Sat Feb 25 14:40:42 2017
(r314260)
@@ -1,6 +1,6 @@
-===
-Clang 4.0.0 (In-Progress) Release Notes
-===
+=
+Clang 4.0.0 Release Notes
+=
 
 .. contents::
:local:
@@ -8,12 +8,6 @@ Clang 4.0.0 (In-Progress) Release Notes
 
 Written by the `LLVM Team `_
 
-.. warning::
-
-   These are in-progress notes for the upcoming Clang 4.0.0 release. You may
-   prefer the `Clang 3.9 Release Notes
-   `_.
-
 Introduction
 
 
@@ -42,7 +36,8 @@ sections with improvements to Clang's su
 Major New Features
 --
 
-- The ``diagnose_if`` attribute has been added to clang. This attribute allows
+- The `diagnose_if `_ attribute has been
+  added to clang. This attribute allows
   clang to emit a warning or error if a function call meets one or more
   user-specified conditions.
 
@@ -65,76 +60,24 @@ Major New Features
}
 
 
--  ...
-
 Improvements to ThinLTO (-flto=thin)
 
 - Integration with profile data (PGO). When available, profile data enables
   more accurate function importing decisions, as well as cross-module indirect
   call promotion.
 - Significant build-time and binary-size improvements when compiling with debug
-  info (-g).
-
-Improvements to Clang's diagnostics
-^^^
-
--  ...
+  info (``-g``).
 
 New Compiler Flags
 --
 
-The option -Og has been added to optimize the debugging experience.
-For now, this option is exactly the same as -O1. However, in the future,
-some other optimizations might be enabled or disabled.
-
-The option -MJ has been added to simplify adding JSON compilation
-database output into existing build systems.
-
-The option 
-
-New Pragmas in Clang

-
-Clang now supports the ...
-
-
-Attribute Changes in Clang
---
-
--  ...
-
-Windows Support

-
-Clang's support for building native Windows programs ...
-
-
-C Language Changes in Clang

-
-- ...
-
-...
-
-C11 Feature Support
-^^^
-
-...
+- The option ``-Og`` has been added to optimize the debugging experience.
+  For now, this option is exactly the same as ``-O1``. However, in the future,
+  some other optimizations might be enabled or disabled.
 
-C++ Language Changes in Clang
--
+- The option ``-MJ`` has been added to simplify adding JSON compilation
+  database output into existing build systems.
 
-...
-
-C++1z Feature Support
-^
-
-...
-
-Objective-C Language Changes in Clang
--
-
-...
 
 OpenCL C Language Changes in Clang
 --
@@ -206,42 +149,14 @@ OpenCL C Language Changes in Clang
   which is now handled as a compiler builtin function with an integer value
   passed into it.
 * Change fake address space map to use the SPIR convention.
-* Added `the OpenCL manual
-  `_ to Clang
+* Added `the OpenCL manual `_ to Clang
   documentation.
 
-OpenMP Support in Clang
---
-
-...
-
-Internal API Changes
-
-
-These are major API changes that have happened since the 3.9 release of
-Clang. If upgrading an external codebase that uses Clang as a library,
-this section should help get you past the largest hurdles of upgrading.
-
--  ...
-
-AST Matchers
-
-
-...
-
-libclang
-
-
-...
-
-With the option --show-description, scan-build's list of defects will also
-show the description of the defects.
-
 
 Static Analyzer
 ---
 
-With the option --show-description, scan-build's list of defects will also
+With the option ``--show-description``, scan-build's list of defects will also
 show the description of the defects.
 
 The analyzer now provides better support of code that uses gte

svn commit: r314262 - vendor/compiler-rt/compiler-rt-release_40-r296202

2017-02-25 Thread Dimitry Andric
Author: dim
Date: Sat Feb 25 14:40:51 2017
New Revision: 314262
URL: https://svnweb.freebsd.org/changeset/base/314262

Log:
  Tag compiler-rt release_40 branch r296202.

Added:
  vendor/compiler-rt/compiler-rt-release_40-r296202/
 - copied from r314261, vendor/compiler-rt/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r314258 - in vendor/llvm/dist: docs include/llvm/Transforms/Vectorize lib/Target/AMDGPU lib/Transforms/Scalar lib/Transforms/Vectorize test/CodeGen/AMDGPU test/Transforms/CorrelatedValu...

2017-02-25 Thread Dimitry Andric
Author: dim
Date: Sat Feb 25 14:40:33 2017
New Revision: 314258
URL: https://svnweb.freebsd.org/changeset/base/314258

Log:
  Vendor import of llvm release_40 branch r296202:
  https://llvm.org/svn/llvm-project/llvm/branches/release_40@296202

Modified:
  vendor/llvm/dist/docs/ReleaseNotes.rst
  vendor/llvm/dist/include/llvm/Transforms/Vectorize/SLPVectorizer.h
  vendor/llvm/dist/lib/Target/AMDGPU/SIInstructions.td
  vendor/llvm/dist/lib/Target/AMDGPU/VOP1Instructions.td
  vendor/llvm/dist/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
  vendor/llvm/dist/lib/Transforms/Scalar/Reassociate.cpp
  vendor/llvm/dist/lib/Transforms/Vectorize/SLPVectorizer.cpp
  vendor/llvm/dist/test/CodeGen/AMDGPU/trunc.ll
  vendor/llvm/dist/test/Transforms/CorrelatedValuePropagation/add.ll
  vendor/llvm/dist/test/Transforms/Reassociate/basictest.ll
  vendor/llvm/dist/test/Transforms/SLPVectorizer/X86/horizontal-list.ll

Modified: vendor/llvm/dist/docs/ReleaseNotes.rst
==
--- vendor/llvm/dist/docs/ReleaseNotes.rst  Sat Feb 25 14:36:24 2017
(r314257)
+++ vendor/llvm/dist/docs/ReleaseNotes.rst  Sat Feb 25 14:40:33 2017
(r314258)
@@ -5,12 +5,6 @@ LLVM 4.0.0 Release Notes
 .. contents::
 :local:
 
-.. warning::
-   These are in-progress notes for the upcoming LLVM 4.0.0 release.  You may
-   prefer the `LLVM 3.9 Release Notes `_.
-
-
 Introduction
 
 
@@ -28,74 +22,56 @@ them.
 
 Non-comprehensive list of changes in this release
 =
-* The C API functions LLVMAddFunctionAttr, LLVMGetFunctionAttr,
-  LLVMRemoveFunctionAttr, LLVMAddAttribute, LLVMRemoveAttribute,
-  LLVMGetAttribute, LLVMAddInstrAttribute and
-  LLVMRemoveInstrAttribute have been removed.
-
-* The C API enum LLVMAttribute has been deleted.
-
-.. NOTE
-   For small 1-3 sentence descriptions, just add an entry at the end of
-   this list. If your description won't fit comfortably in one bullet
-   point (e.g. maybe you would like to give an example of the
-   functionality, or simply have a lot to talk about), see the `NOTE` below
-   for adding a new subsection.
-
-* The definition and uses of LLVM_ATRIBUTE_UNUSED_RESULT in the LLVM source
-  were replaced with LLVM_NODISCARD, which matches the C++17 [[nodiscard]]
-  semantics rather than gcc's __attribute__((warn_unused_result)).
-
 * Minimum compiler version to build has been raised to GCC 4.8 and VS 2015.
 
+* The C API functions ``LLVMAddFunctionAttr``, ``LLVMGetFunctionAttr``,
+  ``LLVMRemoveFunctionAttr``, ``LLVMAddAttribute``, ``LLVMRemoveAttribute``,
+  ``LLVMGetAttribute``, ``LLVMAddInstrAttribute`` and
+  ``LLVMRemoveInstrAttribute`` have been removed.
+
+* The C API enum ``LLVMAttribute`` has been deleted.
+
+* The definition and uses of ``LLVM_ATRIBUTE_UNUSED_RESULT`` in the LLVM source
+  were replaced with ``LLVM_NODISCARD``, which matches the C++17 
``[[nodiscard]]``
+  semantics rather than gcc's ``__attribute__((warn_unused_result))``.
+
 * The Timer related APIs now expect a Name and Description. When upgrading code
   the previously used names should become descriptions and a short name in the
   style of a programming language identifier should be added.
 
-* LLVM now handles invariant.group across different basic blocks, which makes
+* LLVM now handles ``invariant.group`` across different basic blocks, which 
makes
   it possible to devirtualize virtual calls inside loops.
 
-* The aggressive dead code elimination phase ("adce") now remove
+* The aggressive dead code elimination phase ("adce") now removes
   branches which do not effect program behavior. Loops are retained by
   default since they may be infinite but these can also be removed
-  with LLVM option -adce-remove-loops when the loop body otherwise has
+  with LLVM option ``-adce-remove-loops`` when the loop body otherwise has
   no live operations.
 
 * The GVNHoist pass is now enabled by default. The new pass based on Global
   Value Numbering detects similar computations in branch code and replaces
   multiple instances of the same computation with a unique expression.  The
   transform benefits code size and generates better schedules.  GVNHoist is
-  more aggressive at -Os and -Oz, hoisting more expressions at the expense of
-  execution time degradations.
+  more aggressive at ``-Os`` and ``-Oz``, hoisting more expressions at the
+  expense of execution time degradations.
 
  * The llvm-cov tool can now export coverage data as json. Its html output mode
has also improved.
 
-* ... next change ...
+Improvements to ThinLTO (-flto=thin)
+
+Integration with profile data (PGO). When available, profile data
+enables more accurate function importing decisions, as well as
+cross-module indirect call promotion.
 
-.. NOTE
-   If you would like to document a larger change, then 

svn commit: r314266 - vendor/lldb/lldb-release_40-r296202

2017-02-25 Thread Dimitry Andric
Author: dim
Date: Sat Feb 25 14:41:06 2017
New Revision: 314266
URL: https://svnweb.freebsd.org/changeset/base/314266

Log:
  Tag lldb release_40 branch r296202.

Added:
  vendor/lldb/lldb-release_40-r296202/
 - copied from r314265, vendor/lldb/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r314265 - vendor/lld/lld-release_40-r296202

2017-02-25 Thread Dimitry Andric
Author: dim
Date: Sat Feb 25 14:41:01 2017
New Revision: 314265
URL: https://svnweb.freebsd.org/changeset/base/314265

Log:
  Tag lld release_40 branch r296202.

Added:
  vendor/lld/lld-release_40-r296202/
 - copied from r314264, vendor/lld/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r314263 - vendor/libc++/libc++-release_40-r296202

2017-02-25 Thread Dimitry Andric
Author: dim
Date: Sat Feb 25 14:40:54 2017
New Revision: 314263
URL: https://svnweb.freebsd.org/changeset/base/314263

Log:
  Tag libc++ release_40 branch r296202.

Added:
  vendor/libc++/libc++-release_40-r296202/
 - copied from r314262, vendor/libc++/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r314264 - vendor/lld/dist/docs

2017-02-25 Thread Dimitry Andric
Author: dim
Date: Sat Feb 25 14:40:58 2017
New Revision: 314264
URL: https://svnweb.freebsd.org/changeset/base/314264

Log:
  Vendor import of lld release_40 branch r296202:
  https://llvm.org/svn/llvm-project/lld/branches/release_40@296202

Modified:
  vendor/lld/dist/docs/ReleaseNotes.rst

Modified: vendor/lld/dist/docs/ReleaseNotes.rst
==
--- vendor/lld/dist/docs/ReleaseNotes.rst   Sat Feb 25 14:40:54 2017
(r314263)
+++ vendor/lld/dist/docs/ReleaseNotes.rst   Sat Feb 25 14:40:58 2017
(r314264)
@@ -5,9 +5,6 @@ LLD 4.0.0 Release Notes
 .. contents::
 :local:
 
-.. warning::
-   These are in-progress notes for the upcoming LLVM 4.0.0 release.
-
 Introduction
 
 
@@ -15,7 +12,7 @@ LLD is a linker which supports ELF (Unix
 (macOS). It is generally faster than the GNU BFD/gold linkers or the
 MSVC linker.
 
-LLD is designed to be a drop-in replacmenet for the system linkers, so
+LLD is designed to be a drop-in replacement for the system linkers, so
 that users don't need to change their build systems other than swapping
 the linker command.
 
@@ -49,17 +46,17 @@ Other notable changes are listed below:
   but the source location of unresolved symbols.
 
 * Error messages are printed in red just like Clang by default. You
-  can disable it by passing -no-color-diagnostics.
+  can disable it by passing ``-no-color-diagnostics``.
 
 * LLD's version string is now embedded in a .comment section in the
   result output file. You can dump it with this command: ``objdump -j -s
   .comment ``.
 
-* The -Map option is supported. With that, you can print out section
+* The ``-Map`` option is supported. With that, you can print out section
   and symbol information to a specified file. This feature is useful
   for analyzing link results.
 
-* The file format for the -reproduce option has changed from cpio to
+* The file format for the ``-reproduce`` option has changed from cpio to
   tar.
 
 * When creating a copy relocation for a symbol, LLD now scans the
@@ -67,8 +64,8 @@ Other notable changes are listed below:
   space for the copy relocation is reserved in .bss.rel.ro instead of
   .bss. This fixes a security issue that read-only data in a DSO
   becomes writable if it is copied by a copy relocation. This issue
-  was disclosed originally on the binutils mailing list at
-  ``.
+  was disclosed originally on the
+  `binutils mailing list 
`_.
 
 * Compressed input sections are supported.
 
@@ -76,7 +73,7 @@ Other notable changes are listed below:
   ``-Ttext``, ``-b binary``, ``-build-id=uuid``, ``-no-rosegment``,
   ``-nopie``, ``-nostdlib``, ``-omagic``, ``-retain-symbols-file``,
   ``-sort-section``, ``-z max-page-size`` and ``-z wxneeded`` are
-  suppoorted.
+  supported.
 
 * A lot of linker script directives have been added.
 
@@ -84,15 +81,15 @@ Other notable changes are listed below:
   0x20 to make it huge-page friendly.
 
 * ARM port now supports GNU ifunc, the ARM C++ exceptions ABI, TLS
-  relocations and static linking. Problems with dlopen() on systems
+  relocations and static linking. Problems with ``dlopen()`` on systems
   using eglibc fixed.
 
 * MIPS port now supports input files in new R6 revision of MIPS ABIs
   or N32 ABI. Generated file now contains .MIPS.abiflags section and
   complete set of ELF headers flags.
 
-* Relocations produced by the ``-mxgot`` compiler's flag is supported
-  for MIPS. Now it is possible to generate "large" GOT exceeds 64K
+* Relocations produced by the ``-mxgot`` compiler flag is supported
+  for MIPS. Now it is possible to generate "large" GOT that exceeds the 64K
   limit.
 
 COFF Improvements
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2017-02-25 Thread Josh Paetzel
Author: jpaetzel
Date: Sat Feb 25 14:45:54 2017
New Revision: 314267
URL: https://svnweb.freebsd.org/changeset/base/314267

Log:
  MFV 314243
  
  6676 Race between unique_insert() and unique_remove() causes ZFS fsid change
  
  illumos/illumos-gate@40510e8eba18690b9a9843b26393725eeb0f1dac
  
https://github.com/illumos/illumos-gate/commit/40510e8eba18690b9a9843b26393725eeb0f1dac
  
  https://www.illumos.org/issues/6676
  
The fsid of zfs filesystems might change after reboot or remount. The 
problem seems to
be caused by a race between unique_insert() and unique_remove(). The 
unique_remove()
is called from dsl_dataset_evict() which is now an asynchronous thread. In 
a case the
dsl_dataset_evict() thread is very slow and calls unique_remove() too late 
we will end
up with changed fsid on zfs mount.
  
This problem is very likely caused by #5056.
  
Steps to Reproduce
Note: I'm able to reproduce this always on a single core (virtual) machine. 
On multicore
machines it is not so easy to reproduce.
  
  # uname -a
  SunOS openindiana 5.11 illumos-633aa80 i86pc i386 i86pc Solaris
  # zfs create rpool/TEST
  # FS=$(echo ::fsinfo | mdb -k | grep TEST | awk '{print $1}')
  # echo $FS::print vfs_t vfs_fsid | mdb -k
  vfs_fsid = {
  vfs_fsid.val = [ 0x54d7028a, 0x70311508 ]
  }
  # zfs umount rpool/TEST
  # zfs mount rpool/TEST
  # FS=$(echo ::fsinfo | mdb -k | grep TEST | awk '{print $1}')
  # echo $FS::print vfs_t vfs_fsid | mdb -k
  vfs_fsid = {
  vfs_fsid.val = [ 0xd9454e49, 0x6b36d08 ]
  }
  #
  
Impact
The persistent fsid (filesystem id) is essential for proper NFS 
functionality.
If the fsid of a filesystem changes on remount (or after reboot) the NFS
clients might not be able to automatically recover from such event and the
manual remount of the NFS filesystems on every NFS client might be needed.
  
  Author: Josef 'Jeff' Sipek 
  Reviewed by: Saso Kiselkov 
  Reviewed by: Sanjay Nadkarni 
  Reviewed by: Dan Vatca 
  Reviewed by: Matthew Ahrens 
  Reviewed by: George Wilson 
  Reviewed by: Sebastien Roy 
  Approved by: Robert Mustacchi 

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Sat Feb 25 
14:41:06 2017(r314266)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Sat Feb 25 
14:45:54 2017(r314267)
@@ -54,7 +54,9 @@ static void dbuf_write(dbuf_dirty_record
 
 #ifndef __lint
 extern inline void dmu_buf_init_user(dmu_buf_user_t *dbu,
-dmu_buf_evict_func_t *evict_func, dmu_buf_t **clear_on_evict_dbufp);
+dmu_buf_evict_func_t *evict_func_sync,
+dmu_buf_evict_func_t *evict_func_async,
+dmu_buf_t **clear_on_evict_dbufp);
 #endif /* ! __lint */
 
 /*
@@ -361,11 +363,24 @@ dbuf_evict_user(dmu_buf_impl_t *db)
 #endif
 
/*
-* Invoke the callback from a taskq to avoid lock order reversals
-* and limit stack depth.
-*/
-   taskq_dispatch_ent(dbu_evict_taskq, dbu->dbu_evict_func, dbu, 0,
-   &dbu->dbu_tqent);
+* There are two eviction callbacks - one that we call synchronously
+* and one that we invoke via a taskq.  The async one is useful for
+* avoiding lock order reversals and limiting stack depth.
+*
+* Note that if we have a sync callback but no async callback,
+* it's likely that the sync callback will free the structure
+* containing the dbu.  In that case we need to take care to not
+* dereference dbu after calling the sync evict func.
+*/
+   boolean_t has_async = (dbu->dbu_evict_func_async != NULL);
+
+   if (dbu->dbu_evict_func_sync != NULL)
+   dbu->dbu_evict_func_sync(dbu);
+
+   if (has_async) {
+   taskq_dispatch_ent(dbu_evict_taskq, dbu->dbu_evict_func_async,
+   dbu, 0, &dbu->dbu_tqent);
+   }
 }
 
 boolean_t

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Sat Feb 25 
14:41:06 2017(r314266)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/

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

2017-02-25 Thread Andriy Gapon
Author: avg
Date: Sat Feb 25 14:50:53 2017
New Revision: 314268
URL: https://svnweb.freebsd.org/changeset/base/314268

Log:
  add chromebook_platform.4 to the list of manual pages
  
  Reported by:  Wolfgang Zenker 
  Pointyhat to: avg
  MFC after:5 days

Modified:
  head/share/man/man4/Makefile

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileSat Feb 25 14:45:54 2017
(r314267)
+++ head/share/man/man4/MakefileSat Feb 25 14:50:53 2017
(r314268)
@@ -104,6 +104,7 @@ MAN=aac.4 \
cfi.4 \
cfumass.4 \
ch.4 \
+   chromebook_platform.4 \
ciss.4 \
cloudabi.4 \
cm.4 \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r314271 - head/sys/dev/chromebook_platform

2017-02-25 Thread Andriy Gapon
Author: avg
Date: Sat Feb 25 15:55:46 2017
New Revision: 314271
URL: https://svnweb.freebsd.org/changeset/base/314271

Log:
  chromebook_platform: catch up with ig4iic -> ig4iic_pci in r310621
  
  Reported by:  Wolfgang Zenker 
  Tested by:Wolfgang Zenker 
  MFC after:5 days

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

Modified: head/sys/dev/chromebook_platform/chromebook_platform.c
==
--- head/sys/dev/chromebook_platform/chromebook_platform.c  Sat Feb 25 
15:04:19 2017(r314270)
+++ head/sys/dev/chromebook_platform/chromebook_platform.c  Sat Feb 25 
15:55:46 2017(r314271)
@@ -69,7 +69,7 @@ chromebook_i2c_identify(driver_t *driver
 * See 
http://lxr.free-electrons.com/source/drivers/platform/chrome/chromeos_laptop.c
 */
controller = device_get_parent(bus);
-   if (strcmp(device_get_name(controller), "ig4iic") != 0)
+   if (strcmp(device_get_name(controller), "ig4iic_pci") != 0)
return;
 
for (i = 0; i < nitems(slaves); i++) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2017-02-25 Thread Warner Losh
On Fri, Feb 24, 2017 at 11:11 PM, Warner Losh  wrote:
> Author: imp
> Date: Sat Feb 25 06:11:36 2017
> New Revision: 314248
> URL: https://svnweb.freebsd.org/changeset/base/314248
>
> Log:
>   Create pcib_request_feature.
>
>   pcib_request_feature allows drivers to request the firmware (ACPI)
>   release certain features it may be using. ACPI normally manages things
>   like hot plug, advanced error reporting and other features until the
>   OS requests ACPI to relenquish control since it is taking over.
>
>   Sponsored by: Netflix

Forgot to add 'Differential Review: https://reviews.freebsd.org/D9715


> Modified:
>   head/sys/dev/pci/pci_if.m
>   head/sys/dev/pci/pci_pci.c
>   head/sys/dev/pci/pcib_if.m
>
> Modified: head/sys/dev/pci/pci_if.m
> ==
> --- head/sys/dev/pci/pci_if.m   Sat Feb 25 04:24:51 2017(r314247)
> +++ head/sys/dev/pci/pci_if.m   Sat Feb 25 06:11:36 2017(r314248)
> @@ -60,6 +60,11 @@ HEADER {
> PCI_ID_RID,
> PCI_ID_MSI,
> };
> +
> +   enum pci_feature {
> +   PCI_FEATURE_HP, /* Hot Plug feature */
> +   PCI_FEATURE_AER,/* Advanced Error Reporting */
> +   };
>  }
>
>
>
> Modified: head/sys/dev/pci/pci_pci.c
> ==
> --- head/sys/dev/pci/pci_pci.c  Sat Feb 25 04:24:51 2017(r314247)
> +++ head/sys/dev/pci/pci_pci.c  Sat Feb 25 06:11:36 2017(r314248)
> @@ -76,6 +76,8 @@ static void   pcib_pcie_ab_timeout(void *
>  static voidpcib_pcie_cc_timeout(void *arg);
>  static voidpcib_pcie_dll_timeout(void *arg);
>  #endif
> +static int pcib_request_feature(device_t pcib, device_t dev,
> +   enum pci_feature feature);
>
>  static device_method_t pcib_methods[] = {
>  /* Device interface */
> @@ -119,6 +121,7 @@ static device_method_t pcib_methods[] =
>  DEVMETHOD(pcib_try_enable_ari, pcib_try_enable_ari),
>  DEVMETHOD(pcib_ari_enabled,pcib_ari_enabled),
>  DEVMETHOD(pcib_decode_rid, pcib_ari_decode_rid),
> +DEVMETHOD(pcib_request_feature,pcib_request_feature),
>
>  DEVMETHOD_END
>  };
> @@ -2829,3 +2832,24 @@ pcib_try_enable_ari(device_t pcib, devic
>
> return (0);
>  }
> +
> +/*
> + * Pass the request to use this PCI feature up the tree. Either there's a
> + * firmware like ACPI that's using this feature that will approve (or deny) 
> the
> + * request to take it over, or the platform has no such firmware, in which 
> case
> + * the request will be approved. If the request is approved, the OS is 
> expected
> + * to make use of the feature or render it harmless.
> + */
> +static int
> +pcib_request_feature(device_t pcib, device_t dev, enum pci_feature feature)
> +{
> +   device_t bus;
> +
> +   /*
> +* Our parent is necessarily a pci bus. Its parent will either be
> +* another pci bridge (which passes it up) or a host bridge that can
> +* approve or reject the request.
> +*/
> +   bus = device_get_parent(pcib);
> +   return (PCIB_REQUEST_FEATURE(device_get_parent(bus), dev, feature));
> +}
>
> Modified: head/sys/dev/pci/pcib_if.m
> ==
> --- head/sys/dev/pci/pcib_if.m  Sat Feb 25 04:24:51 2017(r314247)
> +++ head/sys/dev/pci/pcib_if.m  Sat Feb 25 06:11:36 2017(r314248)
> @@ -212,3 +212,12 @@ METHOD void decode_rid {
> int *slot;
> int *func;
>  } DEFAULT pcib_decode_rid;
> +
> +#
> +# Request control of PCI features from host firmware, if any.
> +#
> +METHOD int request_feature {
> +   device_tpcib;
> +   device_tdev;
> +   enum pci_feature feature;
> +};
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2017-02-25 Thread Warner Losh
On Fri, Feb 24, 2017 at 11:11 PM, Warner Losh  wrote:
> Author: imp
> Date: Sat Feb 25 06:11:50 2017
> New Revision: 314249
> URL: https://svnweb.freebsd.org/changeset/base/314249
>
> Log:
>   Rename pci_pcie_intr to pci_pcie_intr_hotplug.
>
>   Sponsored by: Netflix

Forgot to add

Differential Review: https://reviews.freebsd.org/D9716

> Modified:
>   head/sys/dev/pci/pci_pci.c
>
> Modified: head/sys/dev/pci/pci_pci.c
> ==
> --- head/sys/dev/pci/pci_pci.c  Sat Feb 25 06:11:36 2017(r314248)
> +++ head/sys/dev/pci/pci_pci.c  Sat Feb 25 06:11:50 2017(r314249)
> @@ -1148,7 +1148,7 @@ pcib_pcie_hotplug_update(struct pcib_sof
>  }
>
>  static void
> -pcib_pcie_intr(void *arg)
> +pcib_pcie_intr_hotplug(void *arg)
>  {
> struct pcib_softc *sc;
> device_t dev;
> @@ -1261,7 +1261,7 @@ pcib_pcie_cc_timeout(void *arg)
> } else {
> device_printf(dev,
> "Missed HotPlug interrupt waiting for Command Completion\n");
> -   pcib_pcie_intr(sc);
> +   pcib_pcie_intr_hotplug(sc);
> }
>  }
>
> @@ -1284,7 +1284,7 @@ pcib_pcie_dll_timeout(void *arg)
> } else if (sta != sc->pcie_link_sta) {
> device_printf(dev,
> "Missed HotPlug interrupt waiting for DLL Active\n");
> -   pcib_pcie_intr(sc);
> +   pcib_pcie_intr_hotplug(sc);
> }
>  }
>
> @@ -1330,7 +1330,7 @@ pcib_alloc_pcie_irq(struct pcib_softc *s
> }
>
> error = bus_setup_intr(dev, sc->pcie_irq, INTR_TYPE_MISC,
> -   NULL, pcib_pcie_intr, sc, &sc->pcie_ihand);
> +   NULL, pcib_pcie_intr_hotplug, sc, &sc->pcie_ihand);
> if (error) {
> device_printf(dev, "Failed to setup PCI-e interrupt 
> handler\n");
> bus_release_resource(dev, SYS_RES_IRQ, rid, sc->pcie_irq);
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r314250 - in head/sys: arm/mv arm/nvidia arm/versatile arm/xscale/i8134x arm/xscale/ixp425 dev/acpica dev/hyperv/pcib dev/ofw dev/pci dev/xen/pcifront mips/adm5120 mips/atheros mips/ca

2017-02-25 Thread Warner Losh
On Fri, Feb 24, 2017 at 11:11 PM, Warner Losh  wrote:
> Author: imp
> Date: Sat Feb 25 06:11:59 2017
> New Revision: 314250
> URL: https://svnweb.freebsd.org/changeset/base/314250
>
> Log:
>   Convert PCIe Hot Plug to using pci_request_feature
>
>   Convert PCIe hot plug support over to asking the firmware, if any, for
>   permission to use the HotPlug hardware. Implement pci_request_feature
>   for ACPI. All other host pci connections to allowing all valid feature
>   requests.
>
>   Sponsored by: Netflix

Forgot to add

Differential Review: https://reviews.freebsd.org/D9718

> Modified:
>   head/sys/arm/mv/mv_pci.c
>   head/sys/arm/nvidia/tegra_pcie.c
>   head/sys/arm/versatile/versatile_pci.c
>   head/sys/arm/xscale/i8134x/i81342_pci.c
>   head/sys/arm/xscale/ixp425/ixp425_pci.c
>   head/sys/dev/acpica/acpi_pcib_acpi.c
>   head/sys/dev/hyperv/pcib/vmbus_pcib.c
>   head/sys/dev/ofw/ofwpci.c
>   head/sys/dev/pci/pci_host_generic_fdt.c
>   head/sys/dev/pci/pci_pci.c
>   head/sys/dev/pci/pcib_private.h
>   head/sys/dev/xen/pcifront/pcifront.c
>   head/sys/mips/adm5120/admpci.c
>   head/sys/mips/atheros/ar71xx_pci.c
>   head/sys/mips/atheros/ar724x_pci.c
>   head/sys/mips/atheros/qca955x_pci.c
>   head/sys/mips/cavium/octopci.c
>   head/sys/mips/idt/idtpci.c
>   head/sys/mips/malta/gt_pci.c
>   head/sys/mips/mediatek/mtk_pcie.c
>   head/sys/mips/nlm/xlp_pci.c
>   head/sys/mips/rmi/xlr_pci.c
>   head/sys/mips/rt305x/rt305x_pci.c
>   head/sys/mips/sibyte/sb_zbpci.c
>   head/sys/powerpc/ofw/ofw_pcib_pci.c
>   head/sys/powerpc/powermac/cpcht.c
>   head/sys/sparc64/pci/apb.c
>   head/sys/sparc64/pci/fire.c
>   head/sys/sparc64/pci/ofw_pcib.c
>   head/sys/sparc64/pci/psycho.c
>   head/sys/sparc64/pci/schizo.c
>   head/sys/x86/pci/pci_bus.c
>[truncated]
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r314272 - head/sys/vm

2017-02-25 Thread Andriy Gapon
Author: avg
Date: Sat Feb 25 16:39:21 2017
New Revision: 314272
URL: https://svnweb.freebsd.org/changeset/base/314272

Log:
  call vm_lowmem hook in uma_reclaim_worker
  
  A comment near kmem_reclaim() implies that we already did that.
  Calling the hook is useful, because some handlers, e.g. ARC,
  might be able to release significant amounts of KVA.
  
  Now that we have more than one place where vm_lowmem hook is called,
  use this change as an opportunity to introduce flags that describe
  a reason for calling the hook.  No handler makes use of the flags yet.
  
  Reviewed by:  markj, kib
  MFC after:1 week
  Sponsored by: Panzura
  Differential Revision: https://reviews.freebsd.org/D9764

Modified:
  head/sys/vm/uma_core.c
  head/sys/vm/vm_kern.c
  head/sys/vm/vm_pageout.c
  head/sys/vm/vm_pageout.h

Modified: head/sys/vm/uma_core.c
==
--- head/sys/vm/uma_core.c  Sat Feb 25 15:55:46 2017(r314271)
+++ head/sys/vm/uma_core.c  Sat Feb 25 16:39:21 2017(r314272)
@@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -3199,6 +3200,9 @@ uma_reclaim_worker(void *arg __unused)
"umarcl", 0);
if (uma_reclaim_needed) {
uma_reclaim_needed = 0;
+   sx_xunlock(&uma_drain_lock);
+   EVENTHANDLER_INVOKE(vm_lowmem, VM_LOW_KMEM);
+   sx_xlock(&uma_drain_lock);
uma_reclaim_locked(true);
}
}

Modified: head/sys/vm/vm_kern.c
==
--- head/sys/vm/vm_kern.c   Sat Feb 25 15:55:46 2017(r314271)
+++ head/sys/vm/vm_kern.c   Sat Feb 25 16:39:21 2017(r314272)
@@ -552,11 +552,13 @@ debug_vm_lowmem(SYSCTL_HANDLER_ARGS)
error = sysctl_handle_int(oidp, &i, 0, req);
if (error)
return (error);
-   if (i)   
-   EVENTHANDLER_INVOKE(vm_lowmem, 0);
+   if ((i & ~(VM_LOW_KMEM | VM_LOW_PAGES)) != 0)
+   return (EINVAL);
+   if (i != 0)
+   EVENTHANDLER_INVOKE(vm_lowmem, i);
return (0);
 }
 
 SYSCTL_PROC(_debug, OID_AUTO, vm_lowmem, CTLTYPE_INT | CTLFLAG_RW, 0, 0,
-debug_vm_lowmem, "I", "set to trigger vm_lowmem event");
+debug_vm_lowmem, "I", "set to trigger vm_lowmem event with given flags");
 #endif

Modified: head/sys/vm/vm_pageout.c
==
--- head/sys/vm/vm_pageout.cSat Feb 25 15:55:46 2017(r314271)
+++ head/sys/vm/vm_pageout.cSat Feb 25 16:39:21 2017(r314272)
@@ -1332,7 +1332,7 @@ vm_pageout_scan(struct vm_domain *vmd, i
 * Decrease registered cache sizes.
 */
SDT_PROBE0(vm, , , vm__lowmem_scan);
-   EVENTHANDLER_INVOKE(vm_lowmem, 0);
+   EVENTHANDLER_INVOKE(vm_lowmem, VM_LOW_PAGES);
/*
 * We do this explicitly after the caches have been
 * drained above.

Modified: head/sys/vm/vm_pageout.h
==
--- head/sys/vm/vm_pageout.hSat Feb 25 15:55:46 2017(r314271)
+++ head/sys/vm/vm_pageout.hSat Feb 25 16:39:21 2017(r314272)
@@ -87,6 +87,12 @@ extern bool vm_pages_needed;
 #defineVM_OOM_SWAPZ2
 
 /*
+ * vm_lowmem flags.
+ */
+#defineVM_LOW_KMEM 0x01
+#defineVM_LOW_PAGES0x02
+
+/*
  * Exported routines.
  */
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2017-02-25 Thread Andriy Gapon
Author: avg
Date: Sat Feb 25 16:45:53 2017
New Revision: 314273
URL: https://svnweb.freebsd.org/changeset/base/314273

Log:
  zfs: call spa_deadman on a taskqueue thread
  
  callout(9) prohibits callout functions from sleeping.
  illumos mutexes are emulated using sx(9).
  spa_deadman() calls vdev_deadman() and the latter acquires vq_lock.
  
  As a result we can get a more confusing panic instead of a specific
  panic or no panic:
  sleepq_add: td 0xf80019669960 to sleep on wchan 0xf8001cff4d88 with 
sleeping prohibited
  
  This change adds another level of indirection where the deadman
  callout schedules spa_deadman() to be executed on taskqueue_thread.
  
  While there, use callout_schedule(0 instead of callout_reset()
  in spa_sync().
  
  Discussed with:   mav
  MFC after:1 week
  Differential Revision: https://reviews.freebsd.org/D9762

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c   Sat Feb 25 
16:39:21 2017(r314272)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c   Sat Feb 25 
16:45:53 2017(r314273)
@@ -174,10 +174,6 @@ uint_t zio_taskq_basedc = 80;  /* base 
 boolean_t  spa_create_process = B_TRUE;/* no process ==> no sysdc */
 extern int zfs_sync_pass_deferred_free;
 
-#ifndef illumos
-extern void spa_deadman(void *arg);
-#endif
-
 /*
  * This (illegal) pool name is used when temporarily importing a spa_t in order
  * to get the vdev stats associated with the imported devices.
@@ -6883,8 +6879,8 @@ spa_sync(spa_t *spa, uint64_t txg)
spa->spa_sync_starttime + spa->spa_deadman_synctime));
 #else  /* !illumos */
 #ifdef _KERNEL
-   callout_reset(&spa->spa_deadman_cycid,
-   hz * spa->spa_deadman_synctime / NANOSEC, spa_deadman, spa);
+   callout_schedule(&spa->spa_deadman_cycid,
+   hz * spa->spa_deadman_synctime / NANOSEC);
 #endif
 #endif /* illumos */
 

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c  Sat Feb 
25 16:39:21 2017(r314272)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c  Sat Feb 
25 16:45:53 2017(r314273)
@@ -597,8 +597,8 @@ spa_lookup(const char *name)
  * If the zfs_deadman_enabled flag is set then it inspects all vdev queues
  * looking for potentially hung I/Os.
  */
-void
-spa_deadman(void *arg)
+static void
+spa_deadman(void *arg, int pending)
 {
spa_t *spa = arg;
 
@@ -627,6 +627,16 @@ spa_deadman(void *arg)
 #endif
 }
 
+#if defined(__FreeBSD__) && defined(_KERNEL)
+static void
+spa_deadman_timeout(void *arg)
+{
+   spa_t *spa = arg;
+
+   taskqueue_enqueue(taskqueue_thread, &spa->spa_deadman_task);
+}
+#endif
+
 /*
  * Create an uninitialized spa_t with the given name.  Requires
  * spa_namespace_lock.  The caller must ensure that the spa_t doesn't already
@@ -698,7 +708,23 @@ spa_add(const char *name, nvlist_t *conf
mutex_exit(&cpu_lock);
 #else  /* !illumos */
 #ifdef _KERNEL
+   /*
+* callout(9) does not provide a way to initialize a callout with
+* a function and an argument, so we use callout_reset() to schedule
+* the callout in the very distant future.  Even if that event ever
+* fires, it should be okayas we won't have any active zio-s.
+* But normally spa_sync() will reschedule the callout with a proper
+* timeout.
+* callout(9) does not allow the callback function to sleep but
+* vdev_deadman() needs to acquire vq_lock and illumos mutexes are
+* emulated using sx(9).  For this reason spa_deadman_timeout()
+* will schedule spa_deadman() as task on a taskqueue that allows
+* sleeping.
+*/
+   TASK_INIT(&spa->spa_deadman_task, 0, spa_deadman, spa);
callout_init(&spa->spa_deadman_cycid, 1);
+   callout_reset_sbt(&spa->spa_deadman_cycid, SBT_MAX, 0,
+   spa_deadman_timeout, spa, 0);
 #endif
 #endif
refcount_create(&spa->spa_refcount);
@@ -811,6 +837,7 @@ spa_remove(spa_t *spa)
 #else  /* !illumos */
 #ifdef _KERNEL
callout_drain(&spa->spa_deadman_cycid);
+   taskqueue_drain(taskqueue_thread, &spa->spa_deadman_task);
 #endif
 #endif
 

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h  Sat Feb 
25 16:39:21 2017(r314272)
+++ head/sys/cddl/

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

2017-02-25 Thread Andriy Gapon
On 25/02/2017 18:45, Andriy Gapon wrote:
> Author: avg
> Date: Sat Feb 25 16:45:53 2017
> New Revision: 314273
> URL: https://svnweb.freebsd.org/changeset/base/314273
> 
> Log:
>   zfs: call spa_deadman on a taskqueue thread
>   
>   callout(9) prohibits callout functions from sleeping.
>   illumos mutexes are emulated using sx(9).
>   spa_deadman() calls vdev_deadman() and the latter acquires vq_lock.
>   
>   As a result we can get a more confusing panic instead of a specific
>   panic or no panic:
>   sleepq_add: td 0xf80019669960 to sleep on wchan 0xf8001cff4d88 with 
> sleeping prohibited
>   
>   This change adds another level of indirection where the deadman
>   callout schedules spa_deadman() to be executed on taskqueue_thread.
>   
>   While there, use callout_schedule(0 instead of callout_reset()
>   in spa_sync().
>   
>   Discussed with: mav
>   MFC after:  1 week
>   Differential Revision: https://reviews.freebsd.org/D9762

Sponsored by:   Panzura

-- 
Andriy Gapon
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r314274 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2017-02-25 Thread Andriy Gapon
Author: avg
Date: Sat Feb 25 17:03:48 2017
New Revision: 314274
URL: https://svnweb.freebsd.org/changeset/base/314274

Log:
  l2arc: try to fix write size calculation broken by Compressed ARC commit
  
  While there, make a change to not evict a first buffer outside the
  requested eviciton range.
  
  To do:
  - give more consistent names to the size variables
  - upstream to OpenZFS
  
  PR:   216178
  Reported by:  lev
  Tested by:lev
  MFC after:2 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Sat Feb 25 
16:45:53 2017(r314273)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Sat Feb 25 
17:03:48 2017(r314274)
@@ -6897,7 +6897,7 @@ top:
}
 
if (!all && HDR_HAS_L2HDR(hdr) &&
-   (hdr->b_l2hdr.b_daddr > taddr ||
+   (hdr->b_l2hdr.b_daddr >= taddr ||
hdr->b_l2hdr.b_daddr < dev->l2ad_hand)) {
/*
 * We've evicted to the target address,
@@ -7031,7 +7031,22 @@ l2arc_write_buffers(spa_t *spa, l2arc_de
continue;
}
 
-   if ((write_asize + HDR_GET_LSIZE(hdr)) > target_sz) {
+   /*
+* We rely on the L1 portion of the header below, so
+* it's invalid for this header to have been evicted out
+* of the ghost cache, prior to being written out. The
+* ARC_FLAG_L2_WRITING bit ensures this won't happen.
+*/
+   ASSERT(HDR_HAS_L1HDR(hdr));
+
+   ASSERT3U(HDR_GET_PSIZE(hdr), >, 0);
+   ASSERT3P(hdr->b_l1hdr.b_pdata, !=, NULL);
+   ASSERT3U(arc_hdr_size(hdr), >, 0);
+   uint64_t size = arc_hdr_size(hdr);
+   uint64_t asize = vdev_psize_to_asize(dev->l2ad_vdev,
+   size);
+
+   if ((write_psize + asize) > target_sz) {
full = B_TRUE;
mutex_exit(hash_lock);
ARCSTAT_BUMP(arcstat_l2_write_full);
@@ -7066,21 +7081,6 @@ l2arc_write_buffers(spa_t *spa, l2arc_de
list_insert_head(&dev->l2ad_buflist, hdr);
mutex_exit(&dev->l2ad_mtx);
 
-   /*
-* We rely on the L1 portion of the header below, so
-* it's invalid for this header to have been evicted out
-* of the ghost cache, prior to being written out. The
-* ARC_FLAG_L2_WRITING bit ensures this won't happen.
-*/
-   ASSERT(HDR_HAS_L1HDR(hdr));
-
-   ASSERT3U(HDR_GET_PSIZE(hdr), >, 0);
-   ASSERT3P(hdr->b_l1hdr.b_pdata, !=, NULL);
-   ASSERT3U(arc_hdr_size(hdr), >, 0);
-   uint64_t size = arc_hdr_size(hdr);
-   uint64_t asize = vdev_psize_to_asize(dev->l2ad_vdev,
-   size);
-
(void) refcount_add_many(&dev->l2ad_alloc, size, hdr);
 
/*
@@ -7142,7 +7142,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_de
return (0);
}
 
-   ASSERT3U(write_asize, <=, target_sz);
+   ASSERT3U(write_psize, <=, target_sz);
ARCSTAT_BUMP(arcstat_l2_writes_sent);
ARCSTAT_INCR(arcstat_l2_write_bytes, write_asize);
ARCSTAT_INCR(arcstat_l2_size, write_sz);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r314087 - head/sys/x86/x86

2017-02-25 Thread Bruce Evans

On Sat, 25 Feb 2017, Konstantin Belousov wrote:


On Sat, Feb 25, 2017 at 02:17:23PM +1100, Bruce Evans wrote:

On Fri, 24 Feb 2017, Konstantin Belousov wrote:


On Thu, Feb 23, 2017 at 06:33:43AM +1100, Bruce Evans wrote:

On Wed, 22 Feb 2017, Konstantin Belousov wrote:


Log:
 More fixes for regression in r313898 on i386.
 Use long long constants where needed.


The long long abomination is never needed, and is always a style bug.

I never saw any explanation behind this claim.  Esp. the first part
of it, WRT 'never needed'.


I hope I wrote enough about this in log messages when I cleaned up the
long longs 20 years ago :-).

long long was a hack to work around intmax_t not existing and long being
unexpandable in practice because it was used in ABIs.  It should have gone
away when intmax_t was standardized.  Unfortunately, long long was
standardised too.

It does not make a sense even more.  long long is native compiler type,


It is only native since C99 broke C under pressure from misimplementatations
with long long.  In unbroken C, long is the longest type, and lots of code
depended on this (the main correct main was casting integers to long for
printing, and the main incorrect use was using long for almost everything
while assuming that int is 16 or 32 bits and not using typedefs much).
Correct implementations used an extended integer type (extended integer
types were also nonstandard before C99, and making them longer than long
also breaks C).

4.4BSD used quad_t and required it to be not actually a quad int, but
precisely 64 bits, and used long excessively (for example, pid_t was
long on all arches).  This is essentially the long long mistake, with
long long spelled better as quad_t, combined with similar mistakes
from a previous generation where int was 16 bits.  Long was used
excessively as a simple way to get integers with at least 32 bits,
although BSD never supported systems with int smaller than 32 bits
AFAIK, and 4.4BSD certainly didn't support such systems.  But BSD
broke the type of at least pid_t by sprinkling longs.  In FreeBSD-1
from Net/2, pid_t was short.  BSD wanted to expand PID_MAX from 3,
and did this wrong by expanding pid_t from short to long, just in time
for this to be wrong in practice since 64-bit systems were becoming
available so that long could easily be longer than int.

(Net)BSD for alpha wasn't burdened with ABIs requiring long to be 32
bits, so it made long 64 bits and didn't need long long (except even
plain long should be actually long, so it should be twice as wide as
a register and thus 128 bits on alpha).  NetBSD cleaned up the
sprinkling of longs at much the same time that 4.4BSD-Lite1 sprinkled
them, to avoid getting silly sizes like 64 bits for pid_t and related
compatibilityroblems.  I think NetBSD actually never imported 4.4BSD-
Lite1, but later merged Lite1 or Lite2 and kept its typedefs instead
of clobbering them with the long sprinkling.  FreeBSD was handicapped
by the USL lawsuit.  It had to import Lite1.  It only fixed the long
sprinkling much later by merging Lite2.  I think Lite2 got got the
better types from NetBSD.  This is summarised in the FreeBSD commit
log using essentially "Splat!" :-(.


while anything_t is a typename to provide MI fixed type.  long long was
obviosvly choosen to extend types without requiring new keyword.


Abusing a standard keyword doesn't do much except ensure a syntax error
if code with the extended type is compiler with a compiler that doesn't
support the extension.  BSD's quad_t is in the application namespace.
__quad_t would be better.

The errors are now being repeated with extensions to 128-bit integers.
At least they are being spelled better as __int128_t instead of long
long long or full doubling (long long long long = 128 bits).  C doesn't
alllow __int128_t even as an extended type unless intmax_t is at least
128 bits.  Compatibility, ABI and bloat problems prevent enlarging
intmax_t from 64 bits to 128 bits on LP64 systems just like they prevented
the misimplementations enlarging long from 32 bits on LP32 and L32P64
systems.


It is "never needed" since anything that can be done with it can be done
better using intmax_t or intN_t or int_fastN_T or int_leastN_t.  Except,
there is no suffix for explicit intmax_t constants, so you would have to
write such constants using INTMAX_C() or better a cast to intmax_t if
the constant is not needed in a cpp expression.

If you replace long long with int there, the same logical structure of
sentences will hold.  Does it mean that 'int' is abomination since we
have int32_t which allows everything to be done better ?


No, since correct uses of int are possible.  int32_t allows almost
everything to be done worse.  It should only be used in software and
hardware ABIs (like pid_t and network software packet layouts in
software, and memory-mapped device registers and network hardware
packet layouts in hardware).  Using it asks precisely 32 bits 2's
complement with no padding b

svn commit: r314275 - in head/sys/boot/i386: boot2 common

2017-02-25 Thread Mariusz Zaborski
Author: oshogbo
Date: Sat Feb 25 18:14:32 2017
New Revision: 314275
URL: https://svnweb.freebsd.org/changeset/base/314275

Log:
  Remove unused macro from common/drv.c.
  
  When we was compering it to code from boot2 it also looks like
  this code is buggy and boot2 was never updated to use this code.
  USE_XREAD flag is unused in boot2, and common/drv.c was never
  build with that flag.
  
  Reviewed by:  jhb
  Differential Revision:https://reviews.freebsd.org/D9780

Modified:
  head/sys/boot/i386/boot2/Makefile
  head/sys/boot/i386/common/drv.c

Modified: head/sys/boot/i386/boot2/Makefile
==
--- head/sys/boot/i386/boot2/Makefile   Sat Feb 25 17:03:48 2017
(r314274)
+++ head/sys/boot/i386/boot2/Makefile   Sat Feb 25 18:14:32 2017
(r314275)
@@ -25,7 +25,6 @@ BOOT2_UFS?=   UFS1_AND_UFS2
 CFLAGS=-fomit-frame-pointer \
-mrtd \
-mregparm=3 \
-   -DUSE_XREAD \
-D${BOOT2_UFS} \
-DFLAGS=${BOOT_BOOT1_FLAGS} \
-DSIOPRT=${BOOT_COMCONSOLE_PORT} \

Modified: head/sys/boot/i386/common/drv.c
==
--- head/sys/boot/i386/common/drv.c Sat Feb 25 17:03:48 2017
(r314274)
+++ head/sys/boot/i386/common/drv.c Sat Feb 25 18:14:32 2017
(r314275)
@@ -25,9 +25,6 @@ __FBSDID("$FreeBSD$");
 #include "util.h"
 #include "drv.h"
 #include "edd.h"
-#ifdef USE_XREAD
-#include "xreadorg.h"
-#endif
 
 static struct edd_params params;
 
@@ -50,9 +47,7 @@ drvsize(struct dsk *dskp)
return (params.sectors);
 }
 
-#ifndef USE_XREAD
 static struct edd_packet packet;
-#endif
 
 int
 drvread(struct dsk *dskp, void *buf, daddr_t lba, unsigned nblk)
@@ -61,7 +56,6 @@ drvread(struct dsk *dskp, void *buf, dad
 
if (!OPT_CHECK(RBX_QUIET))
printf("%c\b", c = c << 8 | c >> 24);
-#ifndef USE_XREAD
packet.len = sizeof(struct edd_packet);
packet.count = nblk;
packet.off = VTOPOFF(buf);
@@ -73,15 +67,6 @@ drvread(struct dsk *dskp, void *buf, dad
v86.edx = dskp->drive;
v86.ds = VTOPSEG(&packet);
v86.esi = VTOPOFF(&packet);
-#else  /* USE_XREAD */
-   v86.ctl = V86_ADDR | V86_CALLF | V86_FLAGS;
-   v86.addr = XREADORG;/* call to xread in boot1 */
-   v86.es = VTOPSEG(buf);
-   v86.eax = lba;
-   v86.ebx = VTOPOFF(buf);
-   v86.ecx = lba >> 32;
-   v86.edx = nblk << 8 | dskp->drive;
-#endif /* USE_XREAD */
v86int();
if (V86_CY(v86.efl)) {
printf("%s: error %u lba %u\n",
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r314276 - vendor-sys/illumos/dist/uts/common/fs/zfs

2017-02-25 Thread Josh Paetzel
Author: jpaetzel
Date: Sat Feb 25 19:16:20 2017
New Revision: 314276
URL: https://svnweb.freebsd.org/changeset/base/314276

Log:
  7570 tunable to allow zvol SCSI unmap to return on commit of txn to ZIL
  
  illumos/illumos-gate@1c9272b861cd640a8342f4407da026ed98615517
  
https://github.com/illumos/illumos-gate/commit/1c9272b861cd640a8342f4407da026ed98615517
  
  https://www.illumos.org/issues/7570
  
Based on the discovery that every unmap waits for the commit of the txn to 
the ZIL,
introducing a very high latency to unmap commands, this behavior was made 
into a
tunable zvol_unmap_sync_enabled and set to false. The net impact of this 
change is
that by default SCSI unmap commands will result in space being freed within 
the zvol
(today they are ignored and returned with good status). However, unlike the 
code
today, instead of 18+ms per unmap, they take about 30us.
  
With the testing done on NTFS against a Win2k12 target, the new behavior 
should work
seamlessly. Files on the zvol that have already been set with the zfree 
application
will continue to write 0's when deleted, and any new files created since 
zvol
creation will send unmap commands when deleted. This behavior exists today, 
but with
this change the unmap commands will be processed and result in reclaim of 
space.
  
  Author: Stephen Blinick 
  Reviewed by: Dan Kimmel 
  Reviewed by: Matt Ahrens 
  Reviewed by: Steve Gonczi 
  Reviewed by: Pavel Zakharov 
  Reviewed by: Saso Kiselkov 
  Reviewed by: Yuri Pankov 
  Approved by: Robert Mustacchi 

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.cSat Feb 25 18:14:32 
2017(r314275)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/zvol.cSat Feb 25 19:16:20 
2017(r314276)
@@ -24,7 +24,7 @@
  * Portions Copyright 2010 Robert Milkowski
  *
  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
- * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2016 by Delphix. All rights reserved.
  * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
  */
@@ -148,6 +148,12 @@ int zvol_maxphys = DMU_MAX_ACCESS/2;
  */
 boolean_t zvol_unmap_enabled = B_TRUE;
 
+/*
+ * If true, unmaps requested as synchronous are executed synchronously,
+ * otherwise all unmaps are asynchronous.
+ */
+boolean_t zvol_unmap_sync_enabled = B_FALSE;
+
 extern int zfs_set_prop_nvlist(const char *, zprop_source_t,
 nvlist_t *, nvlist_t *);
 static int zvol_remove_zv(zvol_state_t *);
@@ -1811,26 +1817,21 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t 
 
zfs_range_unlock(rl);
 
-   if (error == 0) {
-   /*
-* If the write-cache is disabled or 'sync' property
-* is set to 'always' then treat this as a synchronous
-* operation (i.e. commit to zil).
-*/
-   if (!(zv->zv_flags & ZVOL_WCE) ||
-   (zv->zv_objset->os_sync == ZFS_SYNC_ALWAYS))
-   zil_commit(zv->zv_zilog, ZVOL_OBJ);
-
-   /*
-* If the caller really wants synchronous writes, and
-* can't wait for them, don't return until the write
-* is done.
-*/
-   if (df.df_flags & DF_WAIT_SYNC) {
-   txg_wait_synced(
-   dmu_objset_pool(zv->zv_objset), 0);
-   }
+   /*
+* If the write-cache is disabled, 'sync' property
+* is set to 'always', or if the caller is asking for
+* a synchronous free, commit this operation to the zil.
+* This will sync any previous uncommitted writes to the
+* zvol object.
+* Can be overridden by the zvol_unmap_sync_enabled tunable.
+*/
+   if ((error == 0) && zvol_unmap_sync_enabled &&
+   (!(zv->zv_flags & ZVOL_WCE) ||
+   (zv->zv_objset->os_sync == ZFS_SYNC_ALWAYS) ||
+   (df.df_flags & DF_WAIT_SYNC))) {
+   zil_commit(zv->zv_zilog, ZVOL_OBJ);
}
+
return (error);
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r314277 - in stable/10/usr.sbin/pw: . tests

2017-02-25 Thread Baptiste Daroussin
Author: bapt
Date: Sat Feb 25 19:28:49 2017
New Revision: 314277
URL: https://svnweb.freebsd.org/changeset/base/314277

Log:
  MFC r312644, r312650
  
  r312644:
  Readd a feature lost in pw(8) refactoring
  
  pw usermod foo -m
  
  It used to be able to (re)create the home directory if it didn't exists
  
  r312650:
  Really restore the old behaviour for pw usermod -m
  
  It again reinstall missing skel files without overwriting changed one
  Add a regression test about it
  
  PR:   216224
  Reported by:  ae

Modified:
  stable/10/usr.sbin/pw/psdate.c
  stable/10/usr.sbin/pw/pw_user.c
  stable/10/usr.sbin/pw/tests/pw_usermod.sh
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/pw/psdate.c
==
--- stable/10/usr.sbin/pw/psdate.c  Sat Feb 25 19:16:20 2017
(r314276)
+++ stable/10/usr.sbin/pw/psdate.c  Sat Feb 25 19:28:49 2017
(r314277)
@@ -41,12 +41,8 @@ static const char rcsid[] =
 static int
 numerics(char const * str)
 {
-   int rc = isdigit((unsigned char)*str);
 
-   if (rc)
-   while (isdigit((unsigned char)*str) || *str == 'x')
-   ++str;
-   return rc && !*str;
+   return (str[strspn(str, "0123456789x")] == '\0');
 }
 
 static int

Modified: stable/10/usr.sbin/pw/pw_user.c
==
--- stable/10/usr.sbin/pw/pw_user.c Sat Feb 25 19:16:20 2017
(r314276)
+++ stable/10/usr.sbin/pw/pw_user.c Sat Feb 25 19:28:49 2017
(r314277)
@@ -1495,7 +1495,7 @@ pw_user_mod(int argc, char **argv, char 
intmax_t id = -1;
int ch, fd = -1;
size_t i, j;
-   bool quiet, createhome, pretty, dryrun, nis, edited, docreatehome;
+   bool quiet, createhome, pretty, dryrun, nis, edited;
bool precrypted;
mode_t homemode = 0;
time_t expire_days, password_days, now;
@@ -1505,7 +1505,7 @@ pw_user_mod(int argc, char **argv, char 
passwd = NULL;
class = nispasswd = NULL;
quiet = createhome = pretty = dryrun = nis = precrypted = false;
-   edited = docreatehome = false;
+   edited = false;
 
if (arg1 != NULL) {
if (arg1[strspn(arg1, "0123456789")] == '\0')
@@ -1706,8 +1706,6 @@ pw_user_mod(int argc, char **argv, char 
if (!createhome)
warnx("WARNING: home `%s' does not exist",
pwd->pw_dir);
-   else
-   docreatehome = true;
} else if (!S_ISDIR(st.st_mode)) {
warnx("WARNING: home `%s' is not a directory",
pwd->pw_dir);
@@ -1799,7 +1797,7 @@ pw_user_mod(int argc, char **argv, char 
 * that this also `works' for editing users if -m is used, but
 * existing files will *not* be overwritten.
 */
-   if (PWALTDIR() != PWF_ALT && docreatehome && pwd->pw_dir &&
+   if (PWALTDIR() != PWF_ALT && createhome && pwd->pw_dir &&
*pwd->pw_dir == '/' && pwd->pw_dir[1]) {
if (!skel)
skel = cnf->dotdir;

Modified: stable/10/usr.sbin/pw/tests/pw_usermod.sh
==
--- stable/10/usr.sbin/pw/tests/pw_usermod.sh   Sat Feb 25 19:16:20 2017
(r314276)
+++ stable/10/usr.sbin/pw/tests/pw_usermod.sh   Sat Feb 25 19:28:49 2017
(r314277)
@@ -253,6 +253,26 @@ user_mod_w_yes_body() {
$(atf_get_srcdir)/crypt $passhash "foo"
 }
 
+atf_test_case user_mod_m
+user_mod_m_body() {
+   populate_root_etc_skel
+
+   mkdir -p ${HOME}/home
+   mkdir -p ${HOME}/skel
+   echo "entry" > ${HOME}/skel/.file
+   atf_check -s exit:0 ${RPW} useradd foo
+   ! test -d ${HOME}/home/foo || atf_fail "Directory should not have been 
created"
+   atf_check -s exit:0 ${RPW} usermod foo -m -k /skel
+   test -d ${HOME}/home/foo || atf_fail "Directory should have been 
created"
+   test -f ${HOME}/home/foo/.file || atf_fail "Skell files not added"
+   echo "entry" > ${HOME}/skel/.file2
+   atf_check -s exit:0 ${RPW} usermod foo -m -k /skel
+   test -f ${HOME}/home/foo/.file2 || atf_fail "Skell files not added"
+   echo > ${HOME}/home/foo/.file2
+   atf_check -s exit:0 ${RPW} usermod foo -m -k /skel
+   atf_check -s exit:0 -o inline:"\n" cat ${HOME}/home/foo/.file2
+}
+
 
 atf_init_test_cases() {
atf_add_test_case user_mod
@@ -275,4 +295,5 @@ atf_init_test_cases() {
atf_add_test_case user_mod_w_none
atf_add_test_case user_mod_w_random
atf_add_test_case user_mod_w_yes
+   atf_add_test_case user_mod_m
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/li

svn commit: r314278 - in stable/11/contrib/libucl: . include lua src

2017-02-25 Thread Baptiste Daroussin
Author: bapt
Date: Sat Feb 25 19:31:14 2017
New Revision: 314278
URL: https://svnweb.freebsd.org/changeset/base/314278

Log:
  MFC r313953:
  
  Import libucl 20170219

Modified:
  stable/11/contrib/libucl/ChangeLog.md
  stable/11/contrib/libucl/README.md
  stable/11/contrib/libucl/configure.ac
  stable/11/contrib/libucl/include/ucl.h
  stable/11/contrib/libucl/lua/lua_ucl.c
  stable/11/contrib/libucl/src/ucl_emitter_utils.c
  stable/11/contrib/libucl/src/ucl_internal.h
  stable/11/contrib/libucl/src/ucl_parser.c
  stable/11/contrib/libucl/src/ucl_util.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/libucl/ChangeLog.md
==
--- stable/11/contrib/libucl/ChangeLog.md   Sat Feb 25 19:28:49 2017
(r314277)
+++ stable/11/contrib/libucl/ChangeLog.md   Sat Feb 25 19:31:14 2017
(r314278)
@@ -35,7 +35,7 @@
 
 ### Libucl 0.7.3
 
-- Fixed a bug with macroes that come after an empty object
+- Fixed a bug with macros that come after an empty object
 - Fixed a bug in include processing when an incorrect variable has been 
destroyed (use-after-free)
 
 ### Libucl 0.8.0

Modified: stable/11/contrib/libucl/README.md
==
--- stable/11/contrib/libucl/README.md  Sat Feb 25 19:28:49 2017
(r314277)
+++ stable/11/contrib/libucl/README.md  Sat Feb 25 19:31:14 2017
(r314278)
@@ -1,6 +1,8 @@
 # LIBUCL
 
-[![Build 
Status](https://travis-ci.org/vstakhov/libucl.svg?branch=master)](https://travis-ci.org/vstakhov/libucl)[![Coverity](https://scan.coverity.com/projects/4138/badge.svg)](https://scan.coverity.com/projects/4138)[![Coverage
 
Status](https://coveralls.io/repos/github/vstakhov/libucl/badge.svg?branch=master)](https://coveralls.io/github/vstakhov/libucl?branch=master)
+[![Build 
Status](https://travis-ci.org/vstakhov/libucl.svg?branch=master)](https://travis-ci.org/vstakhov/libucl)
+[![Coverity](https://scan.coverity.com/projects/4138/badge.svg)](https://scan.coverity.com/projects/4138)
+[![Coverage 
Status](https://coveralls.io/repos/github/vstakhov/libucl/badge.svg?branch=master)](https://coveralls.io/github/vstakhov/libucl?branch=master)
 
 **Table of Contents**  *generated with [DocToc](http://doctoc.herokuapp.com/)*
 
@@ -217,8 +219,8 @@ Multiline comments may be nested:
 
 UCL supports external macros both multiline and single line ones:
 ```nginx
-.macro "sometext";
-.macro {
+.macro_name "sometext";
+.macro_name {
 Some long text
 
 };
@@ -229,12 +231,12 @@ arguments themselves are the UCL object 
 options:
 
 ```nginx
-.macro(param=value) "something";
-.macro(param={key=value}) "something";
-.macro(.include "params.conf") "something";
-.macro(#this is multiline macro
+.macro_name(param=value) "something";
+.macro_name(param={key=value}) "something";
+.macro_name(.include "params.conf") "something";
+.macro_name(#this is multiline macro
 param = [value1, value2]) "something";
-.macro(key="()") "something";
+.macro_name(key="()") "something";
 ```
 
 UCL also provide a convenient `include` macro to load content from another 
files

Modified: stable/11/contrib/libucl/configure.ac
==
--- stable/11/contrib/libucl/configure.ac   Sat Feb 25 19:28:49 2017
(r314277)
+++ stable/11/contrib/libucl/configure.ac   Sat Feb 25 19:31:14 2017
(r314278)
@@ -39,6 +39,7 @@ AC_CHECK_HEADERS_ONCE([stdarg.h])
 AC_CHECK_HEADERS_ONCE([stdbool.h])
 AC_CHECK_HEADERS_ONCE([stdint.h])
 AC_CHECK_HEADERS_ONCE([string.h])
+AC_CHECK_HEADERS_ONCE([strings.h])
 AC_CHECK_HEADERS_ONCE([unistd.h])
 AC_CHECK_HEADERS_ONCE([ctype.h])
 AC_CHECK_HEADERS_ONCE([errno.h])

Modified: stable/11/contrib/libucl/include/ucl.h
==
--- stable/11/contrib/libucl/include/ucl.h  Sat Feb 25 19:28:49 2017
(r314277)
+++ stable/11/contrib/libucl/include/ucl.h  Sat Feb 25 19:31:14 2017
(r314278)
@@ -154,7 +154,8 @@ typedef enum ucl_parser_flags {
UCL_PARSER_NO_TIME = (1 << 2), /**< Do not parse time and treat time 
values as strings */
UCL_PARSER_NO_IMPLICIT_ARRAYS = (1 << 3), /** Create explicit arrays 
instead of implicit ones */
UCL_PARSER_SAVE_COMMENTS = (1 << 4), /** Save comments in the parser 
context */
-   UCL_PARSER_DISABLE_MACRO = (1 << 5) /** Treat macros as comments */
+   UCL_PARSER_DISABLE_MACRO = (1 << 5), /** Treat macros as comments */
+   UCL_PARSER_NO_FILEVARS = (1 << 6) /** Do not set file vars */
 } ucl_parser_flags_t;
 
 /**
@@ -205,7 +206,8 @@ enum ucl_duplicate_strategy {
 enum ucl_parse_type {
UCL_PARSE_UCL = 0, /**< Default ucl format */
UCL_PARSE_MSGPACK, /**< Message pack input format */
-   UCL_PARSE_CSEXP /**< Canonical S-expressions */
+   UCL_PARSE_CSEXP, /**< C

svn commit: r314279 - stable/11/share/misc

2017-02-25 Thread Baptiste Daroussin
Author: bapt
Date: Sat Feb 25 19:39:58 2017
New Revision: 314279
URL: https://svnweb.freebsd.org/changeset/base/314279

Log:
  MFC r313961:
  
  Update pci_vendors to 2017.02.15

Modified:
  stable/11/share/misc/pci_vendors
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/misc/pci_vendors
==
--- stable/11/share/misc/pci_vendorsSat Feb 25 19:31:14 2017
(r314278)
+++ stable/11/share/misc/pci_vendorsSat Feb 25 19:39:58 2017
(r314279)
@@ -3,8 +3,8 @@
 #
 #  List of PCI ID's
 #
-#  Version: 2017.01.08
-#  Date:2017-01-08 03:15:02
+#  Version: 2017.02.15
+#  Date:2017-02-15 03:15:02
 #
 #  Maintained by Albert Pool, Martin Mares, and other volunteers from
 #  the PCI ID Project at http://pci-ids.ucw.cz/.
@@ -2254,6 +2254,7 @@
1043 2016  Trinidad PRO [Radeon R9 370 OEM]
1458 2016  Trinidad PRO [Radeon R9 370 OEM]
1462 2016  Trinidad PRO [Radeon R9 370 OEM]
+   1462 3050  R9 270 Gaming OC
148c 2016  Trinidad PRO [Radeon R9 370 OEM]
1682 2015  Trinidad PRO [Radeon R7 370]
174b 2016  Trinidad PRO [Radeon R9 370 OEM]
@@ -5520,6 +5521,10 @@
8056  Rockwell HCF 56K modem
808a  Memory Stick Controller
81ce  SxS Pro memory card
+# 2nd ID
+   905c  SxS Pro memory card
+# 2nd ID
+   907f  SxS Pro+ memory card
908f  Aeolia ACPI
909e  Aeolia Ethernet Controller (Marvell Yukon 2 Family)
909f  Aeolia SATA AHCI Controller
@@ -5528,6 +5533,7 @@
90a2  Aeolia DMA Controller
90a3  Aeolia Memory (DDR3/SPM)
90a4  Aeolia USB 3.0 xHCI Host Controller
+   90bc  SxS Pro+ memory card
 104e  Oak Technology, Inc
0017  OTI-64017
0107  OTI-107 [Spitfire]
@@ -6093,6 +6099,20 @@
1077 0246  8300 Series Dual Port 10GbE Converged Network 
Adapter (TCP/IP Networking)
8031  8300 Series 10GbE Converged Network Adapter (FCoE)
8032  8300 Series 10GbE Converged Network Adapter (iSCSI)
+   8070  FastLinQ QL41000 Series 10/25/40/50GbE Controller
+   1077 0011  FastLinQ QL41212H 25GbE Adapter
+   1077 0012  FastLinQ QL41112H 10GbE Adapter
+   8080  FastLinQ QL41000 Series 10/25/40/50GbE Controller (FCoE)
+   1077 000d  FastLinQ QL41262H 25GbE FCoE Adapter
+   1077 000e  FastLinQ QL41162H 10GbE FCoE Adapter
+   8084  FastLinQ QL41000 Series 10/25/40/50GbE Controller (iSCSI)
+   1077 000d  FastLinQ QL41262H 25GbE iSCSI Adapter
+   1077 000e  FastLinQ QL41162H 10GbE iSCSI Adapter
+   8090  FastLinQ QL41000 Series Gigabit Ethernet Controller (SR-IOV VF)
+   1077 000d  FastLinQ QL41262H 25GbE FCoE Adapter (SR-IOV VF)
+   1077 000e  FastLinQ QL41162H 10GbE iSCSI Adapter (SR-IOV VF)
+   1077 0011  FastLinQ QL41212H 25GbE Adapter (SR-IOV VF)
+   1077 0012  FastLinQ QL41112H 10GbE Adapter (SR-IOV VF)
8430  ISP8324 1/10GbE Converged Network Controller (NIC VF)
8431  8300 Series 10GbE Converged Network Adapter (FCoE VF)
8432  ISP2432M-based 10GbE Converged Network Adapter (CNA)
@@ -10584,6 +10604,7 @@
1347  GM108M [GeForce 940M]
1348  GM108M [GeForce 945M / 945A]
1349  GM108M [GeForce 930M]
+   134b  GM108M [GeForce 940MX]
134d  GM108M [GeForce 940MX]
134e  GM108M [GeForce 930MX]
134f  GM108M [GeForce 920MX]
@@ -10616,6 +10637,8 @@
13b1  GM107GLM [Quadro M1000M]
13b2  GM107GLM [Quadro M600M]
13b3  GM107GLM [Quadro K2200M]
+   13b4  GM107GLM [Quadro M620 Mobile]
+   13b6  GM107GLM [Quadro M1200 Mobile]
13b9  GM107GL [NVS 810]
13ba  GM107GL [Quadro K2200]
13bb  GM107GL [Quadro K620]
@@ -10648,6 +10671,7 @@
1427  GM206M [GeForce GTX 965M]
1430  GM206GL [Quadro M2000]
1431  GM206GL [Tesla M4]
+   1436  GM206GLM [Quadro M2200 Mobile]
15f0  GP100GL
15f1  GP100GL
15f7  GP100GL [Tesla P100 PCIe 12GB]
@@ -10677,28 +10701,31 @@
1b82  GP104
1b83  GP104
1b84  GP104 [GeForce GTX 1060 3GB]
-   1ba0  GP104M [GeForce GTX 1080]
-   1ba1  GP104M [GeForce GTX 1070]
+   1ba0  GP104M [GeForce GTX 1080 Mobile]
+   1ba1  GP104M [GeForce GTX 1070 Mobile]
1bb0  GP104GL [Quadro P5000]
1bb1  GP104GL
1bb3  GP104GL [Tesla P4]
1bb4  GP104GL
-   1be0  GP104M [GeForce GTX 1080]
-   1be1  GP104M [GeForce GTX 1070]
+   1bb6  GP104GLM [Quadro P5000 Mobile]
+   1bb7  GP104GLM [Quadro P4000 Mobile]
+   1bb8  GP104GLM [Quadro P3000 Mobile]
+   1be0  GP104M [GeForce GTX 1080 Mobile]
+   1be1  GP104M [GeForce GTX 1070 Mobile]
1c00  GP106
1c01  GP106
1c02  GP106 [GeForce GT

svn commit: r314280 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2017-02-25 Thread Josh Paetzel
Author: jpaetzel
Date: Sat Feb 25 20:01:17 2017
New Revision: 314280
URL: https://svnweb.freebsd.org/changeset/base/314280

Log:
  MFV 314276
  
  7570 tunable to allow zvol SCSI unmap to return on commit of txn to ZIL
  
  illumos/illumos-gate@1c9272b861cd640a8342f4407da026ed98615517
  
https://github.com/illumos/illumos-gate/commit/1c9272b861cd640a8342f4407da026ed98615517
  
  https://www.illumos.org/issues/7570
  
Based on the discovery that every unmap waits for the commit of the txn to 
the ZIL,
introducing a very high latency to unmap commands, this behavior was made 
into a
tunable zvol_unmap_sync_enabled and set to false. The net impact of this 
change is
that by default SCSI unmap commands will result in space being freed within 
the zvol
(today they are ignored and returned with good status). However, unlike the 
code
today, instead of 18+ms per unmap, they take about 30us.
  
With the testing done on NTFS against a Win2k12 target, the new behavior 
should work
seamlessly. Files on the zvol that have already been set with the zfree 
application
will continue to write 0's when deleted, and any new files created since 
zvol
creation will send unmap commands when deleted. This behavior exists today, 
but with
this change the unmap commands will be processed and result in reclaim of 
space.
  
  Author: Stephen Blinick 
  Reviewed by: Dan Kimmel 
  Reviewed by: Matt Ahrens 
  Reviewed by: Steve Gonczi 
  Reviewed by: Pavel Zakharov 
  Reviewed by: Saso Kiselkov 
  Reviewed by: Yuri Pankov 
  Approved by: Robert Mustacchi 

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c  Sat Feb 25 
19:39:58 2017(r314279)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c  Sat Feb 25 
20:01:17 2017(r314280)
@@ -27,7 +27,7 @@
  * Portions Copyright 2010 Robert Milkowski
  *
  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
- * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2016 by Delphix. All rights reserved.
  * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
  */
@@ -202,11 +202,22 @@ int zvol_maxphys = DMU_MAX_ACCESS/2;
  * Toggle unmap functionality.
  */
 boolean_t zvol_unmap_enabled = B_TRUE;
+
+/*
+ * If true, unmaps requested as synchronous are executed synchronously,
+ * otherwise all unmaps are asynchronous.
+ */
+boolean_t zvol_unmap_sync_enabled = B_FALSE;
+
 #ifndef illumos
 SYSCTL_INT(_vfs_zfs_vol, OID_AUTO, unmap_enabled, CTLFLAG_RWTUN,
 &zvol_unmap_enabled, 0,
 "Enable UNMAP functionality");
 
+SYSCTL_INT(_vfs_zfs_vol, OID_AUTO, unmap_sync_enabled, CTLFLAG_RWTUN,
+&zvol_unmap_sync_enabled, 0,
+"UNMAPs requested as sync are executed synchronously");
+
 static d_open_tzvol_d_open;
 static d_close_t   zvol_d_close;
 static d_read_tzvol_read;
@@ -2268,26 +2279,21 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t 
 
zfs_range_unlock(rl);
 
-   if (error == 0) {
-   /*
-* If the write-cache is disabled or 'sync' property
-* is set to 'always' then treat this as a synchronous
-* operation (i.e. commit to zil).
-*/
-   if (!(zv->zv_flags & ZVOL_WCE) ||
-   (zv->zv_objset->os_sync == ZFS_SYNC_ALWAYS))
-   zil_commit(zv->zv_zilog, ZVOL_OBJ);
-
-   /*
-* If the caller really wants synchronous writes, and
-* can't wait for them, don't return until the write
-* is done.
-*/
-   if (df.df_flags & DF_WAIT_SYNC) {
-   txg_wait_synced(
-   dmu_objset_pool(zv->zv_objset), 0);
-   }
+   /*
+* If the write-cache is disabled, 'sync' property
+* is set to 'always', or if the caller is asking for
+* a synchronous free, commit this operation to the zil.
+* This will sync any previous uncommitted writes to the
+* zvol object.
+* Can be overridden by the zvol_unmap_sync_enabled tunable.
+*/
+   if ((error == 0) && zvol_unmap_sync_enabled &&
+   (!(zv->zv_flags & ZVOL_WCE) ||
+   (zv->zv_objset->os_sync == ZFS_SYNC_ALWAYS) ||
+   (df.df_flags & DF_WAIT_SYNC))) {
+   zil_commit(zv->zv_

svn commit: r314281 - stable/11/sys/dev/e1000

2017-02-25 Thread Luiz Otavio O Souza
Author: loos
Date: Sat Feb 25 20:21:39 2017
New Revision: 314281
URL: https://svnweb.freebsd.org/changeset/base/314281

Log:
  Disable the driver managed queue for igb(4) when the legacy transmit
  interface is used.
  
  The legacy API (IGB_LEGACY_TX) is enabled when ALTQ is built into kernel.
  
  As noted in altq(9), it is responsibility of the caller to protect this
  queue against concurrent access and, in the igb case, the interface send
  queue is protected by tx queue mutex.  This obviously cannot protect the
  driver managed queue against concurrent access from different tx queues
  and leads to numerous and quite strange panic traces (usually shown as
  packets disappearing into thin air).
  
  Improving the locking to cope with this means serialize all access to this
  (single) queue and produces no gain, it actually affects the performance
  quite noticeabily.
  
  The driver managed queue is already disabled when an ALTQ queue discipline
  is set on interface (in altq_enable()), because the driver managed queue
  can interfere with ALTQ timing (whence the reports that setting an ALTQ
  queue discipline on interface also fixes the issue).
  
  Disabling this additional queue keeps the ability to use if_start() to
  send packets to individual NIC queues while it simply eliminate the race.
  
  This is a direct commit to stable/11 as -head driver does not support ALTQ
  anymore.
  
  PR:   213257
  PR:   212413
  Discussed with:   sbruno
  Tested by:Konstantin Kormashev 
  Obtained from:pfSense
  Sponsored by: Rubicon Communications, LLC (Netgate)

Modified:
  stable/11/sys/dev/e1000/if_igb.c

Modified: stable/11/sys/dev/e1000/if_igb.c
==
--- stable/11/sys/dev/e1000/if_igb.cSat Feb 25 20:01:17 2017
(r314280)
+++ stable/11/sys/dev/e1000/if_igb.cSat Feb 25 20:21:39 2017
(r314281)
@@ -3182,7 +3182,7 @@ igb_setup_interface(device_t dev, struct
 #else
ifp->if_start = igb_start;
IFQ_SET_MAXLEN(&ifp->if_snd, adapter->num_tx_desc - 1);
-   ifp->if_snd.ifq_drv_maxlen = adapter->num_tx_desc - 1;
+   ifp->if_snd.ifq_drv_maxlen = 0;
IFQ_SET_READY(&ifp->if_snd);
 #endif
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r314282 - in head/sys: amd64/linux32 compat/linux i386/linux

2017-02-25 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Feb 25 20:32:37 2017
New Revision: 314282
URL: https://svnweb.freebsd.org/changeset/base/314282

Log:
  Fix linux_fstatfs() to return proper value for f_frsize. Without it,
  linux df(1) binary from Xenial shows garbage.
  
  Reviewed by:  dchagin
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D9692

Modified:
  head/sys/amd64/linux32/linux.h
  head/sys/compat/linux/linux_stats.c
  head/sys/i386/linux/linux.h

Modified: head/sys/amd64/linux32/linux.h
==
--- head/sys/amd64/linux32/linux.h  Sat Feb 25 20:21:39 2017
(r314281)
+++ head/sys/amd64/linux32/linux.h  Sat Feb 25 20:32:37 2017
(r314282)
@@ -250,7 +250,9 @@ struct l_statfs64 { 
 uint64_tf_ffree; 
 l_fsid_tf_fsid;
 l_int   f_namelen;
-l_int   f_spare[6];
+l_int   f_frsize;
+l_int   f_flags;
+l_int   f_spare[4];
 } __packed;
 
 /* sigaction flags */

Modified: head/sys/compat/linux/linux_stats.c
==
--- head/sys/compat/linux/linux_stats.c Sat Feb 25 20:21:39 2017
(r314281)
+++ head/sys/compat/linux/linux_stats.c Sat Feb 25 20:32:37 2017
(r314282)
@@ -303,7 +303,9 @@ struct l_statfs {
l_long  f_ffree;
l_fsid_tf_fsid;
l_long  f_namelen;
-   l_long  f_spare[6];
+   l_long  f_frsize;
+   l_long  f_flags;
+   l_long  f_spare[4];
 };
 
 #defineLINUX_CODA_SUPER_MAGIC  0x73757245L
@@ -371,6 +373,9 @@ bsd_to_linux_statfs(struct statfs *bsd_s
linux_statfs->f_fsid.val[0] = bsd_statfs->f_fsid.val[0];
linux_statfs->f_fsid.val[1] = bsd_statfs->f_fsid.val[1];
linux_statfs->f_namelen = MAXNAMLEN;
+   linux_statfs->f_frsize = bsd_statfs->f_bsize;
+   linux_statfs->f_flags = 0;
+   memset(linux_statfs->f_spare, 0, sizeof(linux_statfs->f_spare));
 
return (0);
 }
@@ -415,6 +420,9 @@ bsd_to_linux_statfs64(struct statfs *bsd
linux_statfs->f_fsid.val[0] = bsd_statfs->f_fsid.val[0];
linux_statfs->f_fsid.val[1] = bsd_statfs->f_fsid.val[1];
linux_statfs->f_namelen = MAXNAMLEN;
+   linux_statfs->f_frsize = bsd_statfs->f_bsize;
+   linux_statfs->f_flags = 0;
+   memset(linux_statfs->f_spare, 0, sizeof(linux_statfs->f_spare));
 }
 
 int

Modified: head/sys/i386/linux/linux.h
==
--- head/sys/i386/linux/linux.h Sat Feb 25 20:21:39 2017(r314281)
+++ head/sys/i386/linux/linux.h Sat Feb 25 20:32:37 2017(r314282)
@@ -225,7 +225,9 @@ struct l_statfs64 { 
 uint64_tf_ffree; 
 l_fsid_tf_fsid;
 l_int   f_namelen;
-l_int   f_spare[6];
+l_int   f_frsize;
+l_int   f_flags;
+l_int   f_spare[4];
 };
 
 #defineLINUX_NSIG_WORDS2
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r314283 - in head/sys: cam conf modules/cam

2017-02-25 Thread Warner Losh
Author: imp
Date: Sat Feb 25 22:11:10 2017
New Revision: 314283
URL: https://svnweb.freebsd.org/changeset/base/314283

Log:
  Move inclusion of opt_printf.h around so that we can compile all the
  SCSI modules outside of a sub-build from the kernel.
  
  Differential Revision: https://reviews.freebsd.org/D9653
  Sponsored by: Netflix

Modified:
  head/sys/cam/cam_xpt.c
  head/sys/cam/cam_xpt.h
  head/sys/conf/config.mk
  head/sys/modules/cam/Makefile

Modified: head/sys/cam/cam_xpt.c
==
--- head/sys/cam/cam_xpt.c  Sat Feb 25 20:32:37 2017(r314282)
+++ head/sys/cam/cam_xpt.c  Sat Feb 25 22:11:10 2017(r314283)
@@ -27,6 +27,8 @@
  * SUCH DAMAGE.
  */
 
+#include "opt_printf.h"
+
 #include 
 __FBSDID("$FreeBSD$");
 
@@ -72,6 +74,15 @@ __FBSDID("$FreeBSD$");
 
 #include "opt_cam.h"
 
+/* Wild guess based on not wanting to grow the stack too much */
+#define XPT_PRINT_MAXLEN   512
+#ifdef PRINTF_BUFR_SIZE
+#define XPT_PRINT_LEN  PRINTF_BUFR_SIZE
+#else
+#define XPT_PRINT_LEN  128
+#endif
+_Static_assert(XPT_PRINT_LEN <= XPT_PRINT_MAXLEN, "XPT_PRINT_LEN is too 
large");
+
 /*
  * This is the maximum number of high powered commands (e.g. start unit)
  * that can be outstanding at a particular time.

Modified: head/sys/cam/cam_xpt.h
==
--- head/sys/cam/cam_xpt.h  Sat Feb 25 20:32:37 2017(r314282)
+++ head/sys/cam/cam_xpt.h  Sat Feb 25 22:11:10 2017(r314283)
@@ -34,7 +34,6 @@
 
 #ifdef _KERNEL
 #include 
-#include "opt_printf.h"
 #endif
 
 /* Forward Declarations */
@@ -55,15 +54,6 @@ struct cam_path;
 
 #ifdef _KERNEL
 
-/* Wild guess based on not wanting to grow the stack too much */
-#define XPT_PRINT_MAXLEN   512
-#ifdef PRINTF_BUFR_SIZE
-#define XPT_PRINT_LEN  PRINTF_BUFR_SIZE
-#else
-#define XPT_PRINT_LEN  128
-#endif
-_Static_assert(XPT_PRINT_LEN <= XPT_PRINT_MAXLEN, "XPT_PRINT_LEN is too 
large");
-
 /*
  * Definition of an async handler callback block.  These are used to add
  * SIMs and peripherals to the async callback lists.

Modified: head/sys/conf/config.mk
==
--- head/sys/conf/config.mk Sat Feb 25 20:32:37 2017(r314282)
+++ head/sys/conf/config.mk Sat Feb 25 22:11:10 2017(r314283)
@@ -27,6 +27,8 @@ opt_mrouting.h:
echo "#define MROUTING 1" > ${.TARGET}
 opt_natm.h:
echo "#define NATM 1" > ${.TARGET}
+opt_printf.h:
+   echo "#define PRINTF_BUFR_SIZE 128" > ${.TARGET}
 opt_scsi.h:
echo "#define SCSI_DELAY 15000" > ${.TARGET}
 opt_wlan.h:

Modified: head/sys/modules/cam/Makefile
==
--- head/sys/modules/cam/Makefile   Sat Feb 25 20:32:37 2017
(r314282)
+++ head/sys/modules/cam/Makefile   Sat Feb 25 22:11:10 2017
(r314283)
@@ -15,6 +15,7 @@ SRCS+=opt_pt.h
 SRCS+= opt_sa.h
 SRCS+= opt_ses.h
 SRCS+= opt_ddb.h
+SRCS+= opt_printf.h
 SRCS+= device_if.h bus_if.h vnode_if.h
 SRCS+= cam.c
 SRCS+= cam_compat.c
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r314286 - head/sys/net

2017-02-25 Thread Jonathan T. Looney
Author: jtl
Date: Sun Feb 26 00:19:02 2017
New Revision: 314286
URL: https://svnweb.freebsd.org/changeset/base/314286

Log:
  Do some minimal work to better conform to the 802.3ad (LACP) standard.
  In particular, don't set the synchronized bit for the peer unless it truly
  appears to be synchronized to us. Also, don't set our own synchronized bit
  unless we have actually seen a remote system.
  
  Prior to this change, we were seeing some strange behavior, such as:
  
  1. We send an advertisement with the Activity, Aggregation, and Default
  flags, followed by an advertisement with the Activity, Aggregation,
  Synchronization, and Default flags. However, we hadn't seen an
  advertisement from another peer and were still advertising the default
  (NULL) peer. A closer examination of the in-kernel data structures (using
  kgdb) showed that the system had added the default (NULL) peer as a valid
  aggregator for the segment.
  2. We were receiving an advertisement from a peer that included the
  default (NULL) peer instead of including our system information. However,
  we responded with an advertisement that included the Synchronization flag
  for both our system and the peer. (Since the peer's advertisement did not
  include our system information, we shouldn't add the synchronization bit
  for the peer.)
  
  This patch corrects those two items.
  
  Reviewed by:  smh
  MFC after:2 weeks
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D9485

Modified:
  head/sys/net/ieee8023ad_lacp.c

Modified: head/sys/net/ieee8023ad_lacp.c
==
--- head/sys/net/ieee8023ad_lacp.c  Sat Feb 25 23:06:10 2017
(r314285)
+++ head/sys/net/ieee8023ad_lacp.c  Sun Feb 26 00:19:02 2017
(r314286)
@@ -1331,6 +1331,10 @@ lacp_select(struct lacp_port *lp)
return;
}
 
+   /* If we haven't heard from our peer, skip this step. */
+   if (lp->lp_state & LACP_STATE_DEFAULTED)
+   return;
+
KASSERT(!LACP_TIMER_ISARMED(lp, LACP_TIMER_WAIT_WHILE),
("timer_wait_while still active"));
 
@@ -1686,7 +1690,15 @@ lacp_sm_rx_record_pdu(struct lacp_port *
LACP_STATE_AGGREGATION) &&
!lacp_compare_peerinfo(&lp->lp_actor, &du->ldu_partner))
|| (du->ldu_partner.lip_state & LACP_STATE_AGGREGATION) == 0)) {
-   /* XXX nothing? */
+   /*
+* XXX Maintain legacy behavior of leaving the
+* LACP_STATE_SYNC bit unchanged from the partner's
+* advertisement if lsc_strict_mode is false.
+* TODO: We should re-examine the concept of the "strict mode"
+* to ensure it makes sense to maintain a non-strict mode.
+*/
+   if (lp->lp_lsc->lsc_strict_mode)
+   lp->lp_partner.lip_state |= LACP_STATE_SYNC;
} else {
lp->lp_partner.lip_state &= ~LACP_STATE_SYNC;
}
@@ -1701,10 +1713,6 @@ lacp_sm_rx_record_pdu(struct lacp_port *
sizeof(buf;
}
 
-   /* XXX Hack, still need to implement 5.4.9 para 2,3,4 */
-   if (lp->lp_lsc->lsc_strict_mode)
-   lp->lp_partner.lip_state |= LACP_STATE_SYNC;
-
lacp_sm_ptx_update_timeout(lp, oldpstate);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r314287 - head/sys/dev/iwn

2017-02-25 Thread Andriy Voskoboinyk
Author: avos
Date: Sun Feb 26 01:05:27 2017
New Revision: 314287
URL: https://svnweb.freebsd.org/changeset/base/314287

Log:
  iwn: stop all watchdogs on device shutdown.
  
  Tested with Intel 6205, STA mode.
  
  MFC after:5 days

Modified:
  head/sys/dev/iwn/if_iwn.c

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Sun Feb 26 00:19:02 2017(r314286)
+++ head/sys/dev/iwn/if_iwn.c   Sun Feb 26 01:05:27 2017(r314287)
@@ -8834,6 +8834,7 @@ iwn_stop_locked(struct iwn_softc *sc)
sc->sc_is_scanning = 0;
sc->sc_tx_timer = 0;
callout_stop(&sc->watchdog_to);
+   callout_stop(&sc->scan_timeout);
callout_stop(&sc->calib_to);
sc->sc_flags &= ~IWN_FLAG_RUNNING;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r314288 - head/usr.bin/fortune/datfiles

2017-02-25 Thread Alfred Perlstein
Author: alfred
Date: Sun Feb 26 04:41:37 2017
New Revision: 314288
URL: https://svnweb.freebsd.org/changeset/base/314288

Log:
  More FreeBSD tips for fortune(6)
  
  Submitted by: lme
  PR: 192373

Modified:
  head/usr.bin/fortune/datfiles/freebsd-tips

Modified: head/usr.bin/fortune/datfiles/freebsd-tips
==
--- head/usr.bin/fortune/datfiles/freebsd-tips  Sun Feb 26 01:05:27 2017
(r314287)
+++ head/usr.bin/fortune/datfiles/freebsd-tips  Sun Feb 26 04:41:37 2017
(r314288)
@@ -7,6 +7,7 @@ a root login. You can add a user to the 
 %
 By pressing "Scroll Lock" you can use the arrow keys to scroll backward
 through the console output.  Press "Scroll Lock" again to turn it off.
+Don't have a "Scroll Lock" key? The "Pause / Break" key acts alike.
 %
 Can't remember if you've installed a certain port or not? Try "pkg info
 -x port_name".
@@ -40,8 +41,8 @@ Having trouble using fetch through a fir
 variable FTP_PASSIVE_MODE to yes, and see fetch(3) for more details.
 %
 If other operating systems have damaged your Master Boot Record, you can
-reinstall it with boot0cfg(8). See
-"man boot0cfg" for details.
+reinstall it with gpart(8). See
+"man gpart" for details.
 %
 If you accidentally end up inside vi, you can quit it by pressing Escape, colon
 (:), q (q), bang (!) and pressing return.
@@ -116,7 +117,7 @@ In order to support national characters 
 less without creating other nationalisation aspects, set the environment
 variable LC_ALL to 'en_US.ISO8859-1'.
 %
-"man firewall" will give advice for building a FreeBSD firewall
+"man firewall" will give advice for building a FreeBSD firewall using ipfw(8).
-- David Scheidt 
 %
 "man hier" will explain the way FreeBSD filesystems are normally laid out.
@@ -141,7 +142,8 @@ FreeBSD system.
-- David Scheidt 
 %
 Need to do a search in a manpage or in a file you've sent to a pager? Use
-"/search_word". To repeat the same search, type "n" for next.
+"/search_word". To repeat the same search, type "n" for next or "p" for
+previous.
-- Dru 
 %
 Need to find the location of a program? Use "locate program_name".
@@ -183,7 +185,7 @@ flag is your gateway.
 Nice bash prompt: PS1='(\[$(tput md)\]\t <\w>\[$(tput me)\]) $(echo $?) \$ '
-- Mathieu 
 %
-Over quota?  "du -s * | sort -n " will give you a sorted list of your
+Over quota?  "du -sh * | sort -h " will give you a sorted list of your
 directory sizes.
-- David Scheidt 
 %
@@ -191,7 +193,8 @@ nc(1) (or netcat) is useful not only for
 TCP or UDP connections, but also for proxying them with inetd(8).
 %
 sh (the default Bourne shell in FreeBSD) supports command-line editing.  Just
-``set -o emacs'' or ``set -o vi'' to enable it.
+``set -o emacs'' or ``set -o vi'' to enable it. Use "" key to complete
+paths.
 %
 Simple tcsh prompt: set prompt = '%# '
 %
@@ -215,6 +218,8 @@ the scroll lock key and use your page up
 press the scroll lock key again to get your prompt back.
-- Dru 
 %
+You can press Ctrl-L while in the shell to clear the screen.
+%
 To determine whether a file is a text file, executable, or some other type
 of file, use
 
@@ -231,10 +236,10 @@ is running FreeBSD at the time) to quick
 To erase a line you've written at the command prompt, use "Ctrl-U".
-- Dru 
 %
-To find the hostname associated with an IP address, use
+To find out the hostname associated with an IP address, use
 
drill -x IP_address
-   -- Allan Jude 
+   -- Dru 
 %
 To obtain a neat PostScript rendering of a manual page, use ``-t'' switch
 of the man(1) utility: ``man -t ''.  For example:
@@ -247,7 +252,8 @@ To quickly create an empty file, use "to
-- Dru 
 %
 To read a compressed file without having to first uncompress it, use
-"zcat" or "zless" to view it.
+"zcat" or "zless" to view it. There is also "bzcat", "bzless", "xzcat"
+and "xzless".
-- Dru 
 %
 To repeat the last command in the C shell, type "!!".
@@ -283,7 +289,7 @@ To see how much disk space is left on yo
 %
 To see the 10 largest files on a directory or partition, use
 
-   du /partition_or_directory_name | sort -rn | head
+   du -h /partition_or_directory_name | sort -rh | head
-- Dru 
 %
 To see the IP addresses currently set on your active interfaces, type
@@ -291,7 +297,8 @@ To see the IP addresses currently set on
-- Dru 
 %
 To see the last 10 lines of a long file, use "tail filename". To see the
-first 10 lines, use "head filename".
+first 10 lines, use "head filename". To see new lines as they're appended
+to a file, use "tail -f filename".
-- Dru 
 %
 To see the last time that you logged in, use lastlogin(8).
@@ -343,6 +350,9 @@ write
 
 This won't work if you don't have write permissions to the directory
 and probably won't be suitable if you're editing throu

svn commit: r314289 - head/usr.bin/fortune/datfiles

2017-02-25 Thread Alfred Perlstein
Author: alfred
Date: Sun Feb 26 06:05:29 2017
New Revision: 314289
URL: https://svnweb.freebsd.org/changeset/base/314289

Log:
  spelling fix
  
  Submitted by: adamw

Modified:
  head/usr.bin/fortune/datfiles/freebsd-tips

Modified: head/usr.bin/fortune/datfiles/freebsd-tips
==
--- head/usr.bin/fortune/datfiles/freebsd-tips  Sun Feb 26 04:41:37 2017
(r314288)
+++ head/usr.bin/fortune/datfiles/freebsd-tips  Sun Feb 26 06:05:29 2017
(r314289)
@@ -494,7 +494,7 @@ attributes use
-- Lars Engels 
 %
 Do you wonder what a terminal program is doing at the moment? dd(1) does not
-show any troughput? Hit "^T" (Control + t) to send SIGINFO to the process
+show any throughput? Hit "^T" (Control + t) to send SIGINFO to the process
 and see what it is doing.
 
-- Lars Engels 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r314290 - head/sys/dev/usb/storage

2017-02-25 Thread Alexander Motin
Author: mav
Date: Sun Feb 26 06:25:55 2017
New Revision: 314290
URL: https://svnweb.freebsd.org/changeset/base/314290

Log:
  Implement use of multiple transfers per I/O.
  
  This change removes limitation of single S/G list entry and limitation on
  maximal I/O size, using multiple data transfers per I/O if needed.  Also
  it removes code duplication between send and receive paths, which are now
  completely equal.

Modified:
  head/sys/dev/usb/storage/cfumass.c

Modified: head/sys/dev/usb/storage/cfumass.c
==
--- head/sys/dev/usb/storage/cfumass.c  Sun Feb 26 06:05:29 2017
(r314289)
+++ head/sys/dev/usb/storage/cfumass.c  Sun Feb 26 06:25:55 2017
(r314290)
@@ -200,8 +200,7 @@ static device_resume_t  cfumass_resume;
 static usb_handle_request_tcfumass_handle_request;
 
 static usb_callback_t  cfumass_t_command_callback;
-static usb_callback_t  cfumass_t_data_out_callback;
-static usb_callback_t  cfumass_t_data_in_callback;
+static usb_callback_t  cfumass_t_data_callback;
 static usb_callback_t  cfumass_t_status_callback;
 
 static device_method_t cfumass_methods[] = {
@@ -250,7 +249,7 @@ static struct usb_config cfumass_config[
.bufsize = CFUMASS_BULK_SIZE,
.flags = {.proxy_buffer = 1, .short_xfer_ok = 1,
.ext_buffer = 1},
-   .callback = &cfumass_t_data_out_callback,
+   .callback = &cfumass_t_data_callback,
.usb_mode = USB_MODE_DEVICE,
},
 
@@ -261,7 +260,7 @@ static struct usb_config cfumass_config[
.bufsize = CFUMASS_BULK_SIZE,
.flags = {.proxy_buffer = 1, .short_xfer_ok = 1,
.ext_buffer = 1},
-   .callback = &cfumass_t_data_in_callback,
+   .callback = &cfumass_t_data_callback,
.usb_mode = USB_MODE_DEVICE,
},
 
@@ -712,124 +711,66 @@ tr_setup:
 }
 
 static void
-cfumass_t_data_out_callback(struct usb_xfer *xfer, usb_error_t usb_error)
+cfumass_t_data_callback(struct usb_xfer *xfer, usb_error_t usb_error)
 {
-   struct cfumass_softc *sc;
-   union ctl_io *io;
-   struct ctl_sg_entry ctl_sg_entry, *ctl_sglist;
-   int actlen, ctl_sg_count;
-
-   sc = usbd_xfer_softc(xfer);
-   io = sc->sc_ctl_io;
-
-   if (io->scsiio.kern_sg_entries > 0) {
-   ctl_sglist = (struct ctl_sg_entry *)io->scsiio.kern_data_ptr;
-   ctl_sg_count = io->scsiio.kern_sg_entries;
-   } else {
-   ctl_sglist = &ctl_sg_entry;
-   ctl_sglist->addr = io->scsiio.kern_data_ptr;
-   ctl_sglist->len = io->scsiio.kern_data_len;
-   ctl_sg_count = 1;
-   }
+   struct cfumass_softc *sc = usbd_xfer_softc(xfer);
+   union ctl_io *io = sc->sc_ctl_io;
+   uint32_t max_bulk;
+   struct ctl_sg_entry sg_entry, *sglist;
+   int actlen, sumlen, sg_count;
 
switch (USB_GET_STATE(xfer)) {
case USB_ST_TRANSFERRED:
CFUMASS_DEBUG(sc, "USB_ST_TRANSFERRED");
 
-   usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL);
-   if (actlen != ctl_sglist[0].len) {
-   KASSERT(actlen <= ctl_sglist[0].len,
-   ("actlen %d > ctl_sglist.len %zd",
-   actlen, ctl_sglist[0].len));
-   CFUMASS_DEBUG(sc, "host transferred %d bytes"
-   "instead of expected %zd bytes",
-   actlen, ctl_sglist[0].len);
-   }
+   usbd_xfer_status(xfer, &actlen, &sumlen, NULL, NULL);
sc->sc_current_residue -= actlen;
+   io->scsiio.ext_data_filled += actlen;
io->scsiio.kern_data_resid -= actlen;
-   io->scsiio.be_move_done(io);
-   sc->sc_ctl_io = NULL;
-   break;
-
-   case USB_ST_SETUP:
-tr_setup:
-   CFUMASS_DEBUG(sc, "USB_ST_SETUP");
-
-   CFUMASS_DEBUG(sc, "requested size %d, CTL segment size %zd",
-   sc->sc_current_transfer_length, ctl_sglist[0].len);
-
-   usbd_xfer_set_frame_data(xfer, 0, ctl_sglist[0].addr, 
ctl_sglist[0].len);
-   usbd_transfer_submit(xfer);
-   break;
-
-   default:
-   if (usb_error == USB_ERR_CANCELLED) {
-   CFUMASS_DEBUG(sc, "USB_ERR_CANCELLED");
+   if (actlen < sumlen ||
+   sc->sc_current_residue == 0 ||
+   io->scsiio.kern_data_resid == 0) {
+   sc->sc_ctl_io = NULL;
+   io->scsiio.be_move_done(io);
break;
}
-
-   CFUMASS_DEBUG(sc, "USB_ST_ERROR: %s",
-   usbd_errstr(usb_error));
-
-   goto tr_setup;
-   }
-}
-
-static void
-c

Re: svn commit: r314250 - in head/sys: arm/mv arm/nvidia arm/versatile arm/xscale/i8134x arm/xscale/ixp425 dev/acpica dev/hyperv/pcib dev/ofw dev/pci dev/xen/pcifront mips/adm5120 mips/atheros mips/ca

2017-02-25 Thread John Baldwin
On Saturday, February 25, 2017 06:11:59 AM Warner Losh wrote:
> Author: imp
> Date: Sat Feb 25 06:11:59 2017
> New Revision: 314250
> URL: https://svnweb.freebsd.org/changeset/base/314250
> 
> Log:
>   Convert PCIe Hot Plug to using pci_request_feature
>   
>   Convert PCIe hot plug support over to asking the firmware, if any, for
>   permission to use the HotPlug hardware. Implement pci_request_feature
>   for ACPI. All other host pci connections to allowing all valid feature
>   requests.
>   
>   Sponsored by: Netflix

This lost one good feature from the first version:

> @@ -722,3 +720,25 @@ acpi_pcib_acpi_release_resource(device_t
>  }
>  #endif
>  #endif
> +
> +static int
> +acpi_pcib_request_feature(device_t pcib, device_t dev, enum pci_feature 
> feature)
> +{
> + uint32_t osc_ctl;
> + struct acpi_hpcib_softc *sc;
> +
> + sc = device_get_softc(dev);
> +
> + switch (feature) {
> + case PCI_FEATURE_HP:
> + osc_ctl = PCIM_OSC_CTL_PCIE_HP;
> + break;
> + case PCI_FEATURE_AER:
> + osc_ctl = PCIM_OSC_CTL_PCIE_AER;
> + break;
> + default:
> + return (EINVAL);
> + }
> +
> + return (acpi_pcib_osc(sc, osc_ctl));
> +}

We should check for the desired 'osc_ctl' in the already-enabled
sc->ap_osc_ctl and not bother invoking _OSC if the specific feature
has already been granted.

-- 
John Baldwin
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r314250 - in head/sys: arm/mv arm/nvidia arm/versatile arm/xscale/i8134x arm/xscale/ixp425 dev/acpica dev/hyperv/pcib dev/ofw dev/pci dev/xen/pcifront mips/adm5120 mips/atheros mips/ca

2017-02-25 Thread Warner Losh
On Sat, Feb 25, 2017 at 11:28 PM, John Baldwin  wrote:
> On Saturday, February 25, 2017 06:11:59 AM Warner Losh wrote:
>> Author: imp
>> Date: Sat Feb 25 06:11:59 2017
>> New Revision: 314250
>> URL: https://svnweb.freebsd.org/changeset/base/314250
>>
>> Log:
>>   Convert PCIe Hot Plug to using pci_request_feature
>>
>>   Convert PCIe hot plug support over to asking the firmware, if any, for
>>   permission to use the HotPlug hardware. Implement pci_request_feature
>>   for ACPI. All other host pci connections to allowing all valid feature
>>   requests.
>>
>>   Sponsored by: Netflix
>
> This lost one good feature from the first version:
>
>> @@ -722,3 +720,25 @@ acpi_pcib_acpi_release_resource(device_t
>>  }
>>  #endif
>>  #endif
>> +
>> +static int
>> +acpi_pcib_request_feature(device_t pcib, device_t dev, enum pci_feature 
>> feature)
>> +{
>> + uint32_t osc_ctl;
>> + struct acpi_hpcib_softc *sc;
>> +
>> + sc = device_get_softc(dev);
>> +
>> + switch (feature) {
>> + case PCI_FEATURE_HP:
>> + osc_ctl = PCIM_OSC_CTL_PCIE_HP;
>> + break;
>> + case PCI_FEATURE_AER:
>> + osc_ctl = PCIM_OSC_CTL_PCIE_AER;
>> + break;
>> + default:
>> + return (EINVAL);
>> + }
>> +
>> + return (acpi_pcib_osc(sc, osc_ctl));
>> +}
>
> We should check for the desired 'osc_ctl' in the already-enabled
> sc->ap_osc_ctl and not bother invoking _OSC if the specific feature
> has already been granted.

OK. I think I must have misunderstood your comments. I'd gotten the
impression thought you wanted me to remove it, so I did. It's easy
enough to add back. For current uses, it won't matter, but it might in
the future.

Warner
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"