Re: svn commit: r330236 - head/sys/compat/linuxkpi/common/src

2018-03-04 Thread Alexey Dokuchaev
On Sun, Mar 04, 2018 at 01:25:17AM +, Colin Percival wrote:
> On 03/01/18 02:31, Hans Petter Selasky wrote:
> > New Revision: 330236
> >   Correct the return value from flush_work() and flush_delayed_work()
> >   in the LinuxKPI to comply more with Linux. This fixes an issue when
> >   these functions are used in waiting loops.
> >   
> >   MFC after:1 week
> >   Sponsored by: Mellanox Technologies
> 
> In case the data point is useful: Merging this to stable/11 unbroke S3
> suspend/resume on my laptop (system76 Galago Pro, kabylake, using the
> drm-next-kmod port).

Any data point about laptops and, particularly, suspend/resume is useful,
thanks for sharing Colin!

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


Re: svn commit: r320579 - head/usr.bin/patch

2018-03-04 Thread Eitan Adler
On 2 July 2017 at 14:00, Pedro F. Giffuni  wrote:
> +   } else if (strnEQ(s, "diff --git a/", 13)) {
> +   /* Git-style diffs. */
> +   piece_of_git = 1;

This is incomplete and leaves to confusing behavior for some git
diffs. In particular with 'diff.mnemonicprefix = true' the prefix is
awesome something other than 'a/'. It can be 'w' for working copy, 'i'
for index, 'c' for commit, or some other values.

While I don't oppose this feature, it'd be better if we did not tie it
to a single specific prefix.


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


Re: svn commit: r330236 - head/sys/compat/linuxkpi/common/src

2018-03-04 Thread Ronald Klop
On Sun, 04 Mar 2018 02:25:17 +0100, Colin Percival   
wrote:



On 03/01/18 02:31, Hans Petter Selasky wrote:

New Revision: 330236
  Correct the return value from flush_work() and flush_delayed_work()  
in the
  LinuxKPI to comply more with Linux. This fixes an issue when these  
functions

  are used in waiting loops.

  MFC after:1 week
  Sponsored by: Mellanox Technologies


In case the data point is useful: Merging this to stable/11 unbroke S3
suspend/resume on my laptop (system76 Galago Pro, kabylake, using the
drm-next-kmod port).




These data points are much more useful than commit messages that describe  
what the patch already shows and talk about 'an issue'. Every patch solves  
'an issue' (or creates some :-) ).


No personal pun intended. Just taking this example as general thoughts  
about commit messages.


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


Re: svn commit: r330277 - in head: bin/stty libexec/getty

2018-03-04 Thread Ronald Klop
On Fri, 02 Mar 2018 15:16:19 +0100, Edward Tomasz Napierala  
 wrote:



Author: trasz
Date: Fri Mar  2 14:16:19 2018
New Revision: 330277
URL: https://svnweb.freebsd.org/changeset/base/330277

Log:
  .Xr pstat(8), so that people have a chance to learn how to get a list
  of terminal devices using "pstat -t".



Nice tip. Never seen pstat -t before. I have a feeling it will be useful  
to me some day. :-)

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


svn commit: r330374 - head/sys/ddb

2018-03-04 Thread Andriy Gapon
Author: avg
Date: Sun Mar  4 13:27:21 2018
New Revision: 330374
URL: https://svnweb.freebsd.org/changeset/base/330374

Log:
  db_script_exec: use a saved script name when reporting commands executed
  
  Before executing a command in a ddb script ddb prints an information
  line of the form:
db:1:my-script> command
  where 1 is the script's depth level, "my-script" is the scipt's name,
  and "command" is the current command in the script.
  db_script_exec() uses its 'scriptname' parameter to produce that string.
  In the case when db_script_exec() is called from db_run_cmd() the
  argument points to db_tok_string that is a global variable used for
  command parsing.  So, its value changes with every command executed.
  
  This commit changes the code to use the script's name stored in
  ds_scriptname to print the line.
  
  MFC after:2 weeks

Modified:
  head/sys/ddb/db_script.c

Modified: head/sys/ddb/db_script.c
==
--- head/sys/ddb/db_script.cSun Mar  4 08:00:07 2018(r330373)
+++ head/sys/ddb/db_script.cSun Mar  4 13:27:21 2018(r330374)
@@ -296,7 +296,7 @@ db_script_exec(const char *scriptname, int warnifnotfo
buffer = drd->drd_buffer;
strcpy(buffer, dsp->ds_script);
while ((command = strsep(&buffer, ";")) != NULL) {
-   db_printf("db:%d:%s> %s\n", db_recursion, scriptname,
+   db_printf("db:%d:%s> %s\n", db_recursion, dsp->ds_scriptname,
command);
db_command_trim(&command);
prev_jb = kdb_jmpbuf(jb);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330384 - in head: contrib/llvm/lib/Target/AArch64 contrib/llvm/lib/Target/X86 contrib/llvm/tools/clang/include/clang/Basic contrib/llvm/tools/clang/lib/Basic lib/clang lib/clang/includ...

2018-03-04 Thread Dimitry Andric
Author: dim
Date: Sun Mar  4 17:06:37 2018
New Revision: 330384
URL: https://svnweb.freebsd.org/changeset/base/330384

Log:
  Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
  6.0.0 release (upstream r326565).
  
  Release notes for llvm, clang and lld will be available here soon:
  
  
  
  
  Relnotes: yes
  MFC after:3 months
  X-MFC-With:   r327952
  PR:   224669

Modified:
  head/contrib/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
  head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp
  head/contrib/llvm/tools/clang/include/clang/Basic/AttrDocs.td
  head/contrib/llvm/tools/clang/lib/Basic/Version.cpp
  head/lib/clang/freebsd_cc_version.h
  head/lib/clang/include/clang/Basic/Version.inc
  head/lib/clang/include/lld/Common/Version.inc
  head/lib/clang/include/llvm/Support/VCSRevision.h
  head/sys/sys/param.h
Directory Properties:
  head/contrib/compiler-rt/   (props changed)
  head/contrib/libc++/   (props changed)
  head/contrib/llvm/   (props changed)
  head/contrib/llvm/tools/clang/   (props changed)
  head/contrib/llvm/tools/lld/   (props changed)
  head/contrib/llvm/tools/lldb/   (props changed)

Modified: head/contrib/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
==
--- head/contrib/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp Sun Mar 
 4 15:07:23 2018(r330383)
+++ head/contrib/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp Sun Mar 
 4 17:06:37 2018(r330384)
@@ -840,6 +840,7 @@ bool AArch64InstructionSelector::select(MachineInstr &
   case TargetOpcode::G_EXTRACT: {
 LLT SrcTy = MRI.getType(I.getOperand(1).getReg());
 LLT DstTy = MRI.getType(I.getOperand(0).getReg());
+(void)DstTy;
 unsigned SrcSize = SrcTy.getSizeInBits();
 // Larger extracts are vectors, same-size extracts should be something else
 // by now (either split up or simplified to a COPY).

Modified: head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp
==
--- head/contrib/llvm/lib/Target/X86/X86ISelLowering.cppSun Mar  4 
15:07:23 2018(r330383)
+++ head/contrib/llvm/lib/Target/X86/X86ISelLowering.cppSun Mar  4 
17:06:37 2018(r330384)
@@ -35520,7 +35520,7 @@ static SDValue combineFneg(SDNode *N, SelectionDAG &DA
   // If we're negating an FMA node, then we can adjust the
   // instruction to include the extra negation.
   unsigned NewOpcode = 0;
-  if (Arg.hasOneUse()) {
+  if (Arg.hasOneUse() && Subtarget.hasAnyFMA()) {
 switch (Arg.getOpcode()) {
 case ISD::FMA: NewOpcode = X86ISD::FNMSUB;   break;
 case X86ISD::FMSUB:NewOpcode = X86ISD::FNMADD;   break;

Modified: head/contrib/llvm/tools/clang/include/clang/Basic/AttrDocs.td
==
--- head/contrib/llvm/tools/clang/include/clang/Basic/AttrDocs.td   Sun Mar 
 4 15:07:23 2018(r330383)
+++ head/contrib/llvm/tools/clang/include/clang/Basic/AttrDocs.td   Sun Mar 
 4 17:06:37 2018(r330384)
@@ -353,7 +353,7 @@ available in C.
 
   int isdigit(int c);
   int isdigit(int c) __attribute__((enable_if(c <= -1 || c > 255, "chosen when 
'c' is out of range"))) __attribute__((unavailable("'c' must have the value of 
an unsigned char or EOF")));
-  
+
   void foo(char c) {
 isdigit(c);
 isdigit(10);
@@ -406,7 +406,7 @@ overload out of a number of viable overloads using ena
 
   void f() __attribute__((enable_if(true, "")));  // #1
   void f() __attribute__((enable_if(true, ""))) __attribute__((enable_if(true, 
"")));  // #2
-  
+
   void g(int i, int j) __attribute__((enable_if(i, "")));  // #1
   void g(int i, int j) __attribute__((enable_if(j, ""))) 
__attribute__((enable_if(true)));  // #2
 
@@ -918,11 +918,11 @@ default name.
 can only be placed before an @protocol or @interface declaration:
 
 .. code-block:: objc
-
+
   __attribute__((objc_runtime_name("MyLocalName")))
   @interface Message
   @end
-
+
 }];
 }
 
@@ -1228,7 +1228,7 @@ potentially-evaluated discarded-value expression that 
 .. code-block: c++
   struct [[nodiscard]] error_info { /*...*/ };
   error_info enable_missile_safety_mode();
-  
+
   void launch_missiles();
   void test_missiles() {
 enable_missile_safety_mode(); // diagnoses
@@ -2641,23 +2641,23 @@ used to process multiple arguments from a single invoc
 concurrently.
 The syntax of the `declare simd` construct is as follows:
 
-  .. code-block:: c
+  .. code-block:: none
 
-  #pragma omp declare simd [clause[[,] clause] ...] new-line
-  [#pragma omp declare simd [clause[[,] clause] ...] new-line]
-  [...]
-  function

svn commit: r330385 - head/sys/dev/usb/serial

2018-03-04 Thread Ian Lepore
Author: ian
Date: Sun Mar  4 17:30:16 2018
New Revision: 330385
URL: https://svnweb.freebsd.org/changeset/base/330385

Log:
  Flag the first interface on a KTLINK FTDI-based jtag+uart device as being
  the jtag port, so that a tty is not created for it.
  
  This is based on information in the PR and from the vendor website.  When
  the PR was first opened we had no facility for flagging the jtag ports.  I
  stumbled across the still-open PR with the idea of closing it, and noticed
  that this wee update was needed.
  
  PR:   175893

Modified:
  head/sys/dev/usb/serial/uftdi.c

Modified: head/sys/dev/usb/serial/uftdi.c
==
--- head/sys/dev/usb/serial/uftdi.c Sun Mar  4 17:06:37 2018
(r330384)
+++ head/sys/dev/usb/serial/uftdi.c Sun Mar  4 17:30:16 2018
(r330385)
@@ -441,7 +441,7 @@ static const STRUCT_USB_HOST_ID uftdi_devs[] = {
UFTDI_DEV(FTDI, IPLUS2, 0),
UFTDI_DEV(FTDI, IRTRANS, 0),
UFTDI_DEV(FTDI, KBS, 0),
-   UFTDI_DEV(FTDI, KTLINK, 0),
+   UFTDI_DEV(FTDI, KTLINK, UFTDI_JTAG_IFACE(0)),
UFTDI_DEV(FTDI, LENZ_LIUSB, 0),
UFTDI_DEV(FTDI, LK202, 0),
UFTDI_DEV(FTDI, LK204, 0),
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330386 - head/lib/libutil

2018-03-04 Thread Eitan Adler
Author: eadler
Date: Sun Mar  4 18:00:32 2018
New Revision: 330386
URL: https://svnweb.freebsd.org/changeset/base/330386

Log:
  open.3: Use .Fa where appropriate
  
  Obtained From:DragonFlyBSD (78732326a796ca521f3c0fe33c6fc9c695742ede)

Modified:
  head/lib/libutil/flopen.3

Modified: head/lib/libutil/flopen.3
==
--- head/lib/libutil/flopen.3   Sun Mar  4 17:30:16 2018(r330385)
+++ head/lib/libutil/flopen.3   Sun Mar  4 18:00:32 2018(r330386)
@@ -54,7 +54,7 @@ It is essentially equivalent with calling
 with the same parameters followed by
 .Fn flock
 with an
-.Va operation
+.Fa operation
 argument of
 .Dv LOCK_EX ,
 except that
@@ -66,7 +66,7 @@ files, mailboxes and other kinds of files which are us
 synchronization between processes.
 .Pp
 If
-.Va flags
+.Fa flags
 includes
 .Dv O_NONBLOCK
 and the file is already locked,
@@ -79,9 +79,9 @@ to
 As with
 .Fn open ,
 the additional
-.Va mode
+.Fa mode
 argument is required if
-.Va flags
+.Fa flags
 includes
 .Dv O_CREAT .
 .Pp
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330387 - in head/sys/compat/linuxkpi/common: include/linux src

2018-03-04 Thread Hans Petter Selasky
Author: hselasky
Date: Sun Mar  4 18:04:37 2018
New Revision: 330387
URL: https://svnweb.freebsd.org/changeset/base/330387

Log:
  Rename the SLAB_DESTROY_BY_RCU flag into SLAB_TYPESAFE_BY_RCU in the LinuxKPI
  to be compatible with Linux.
  
  MFC after:1 week
  Requested by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/slab.h
  head/sys/compat/linuxkpi/common/src/linux_slab.c

Modified: head/sys/compat/linuxkpi/common/include/linux/slab.h
==
--- head/sys/compat/linuxkpi/common/include/linux/slab.hSun Mar  4 
18:00:32 2018(r330386)
+++ head/sys/compat/linuxkpi/common/include/linux/slab.hSun Mar  4 
18:04:37 2018(r330387)
@@ -79,7 +79,7 @@ struct linux_kmem_cache {
 };
 
 #defineSLAB_HWCACHE_ALIGN  (1 << 0)
-#defineSLAB_DESTROY_BY_RCU (1 << 1)
+#defineSLAB_TYPESAFE_BY_RCU(1 << 1)
 #defineSLAB_RECLAIM_ACCOUNT(1 << 2)
 
 static inline gfp_t
@@ -162,7 +162,7 @@ extern void linux_kmem_cache_free_rcu(struct linux_kme
 static inline void
 linux_kmem_cache_free(struct linux_kmem_cache *c, void *m)
 {
-   if (unlikely(c->cache_flags & SLAB_DESTROY_BY_RCU))
+   if (unlikely(c->cache_flags & SLAB_TYPESAFE_BY_RCU))
linux_kmem_cache_free_rcu(c, m);
else
uma_zfree(c->cache_zone, m);

Modified: head/sys/compat/linuxkpi/common/src/linux_slab.c
==
--- head/sys/compat/linuxkpi/common/src/linux_slab.cSun Mar  4 18:00:32 
2018(r330386)
+++ head/sys/compat/linuxkpi/common/src/linux_slab.cSun Mar  4 18:04:37 
2018(r330387)
@@ -49,7 +49,7 @@ linux_kmem_ctor(void *mem, int size, void *arg, int fl
 {
struct linux_kmem_cache *c = arg;
 
-   if (unlikely(c->cache_flags & SLAB_DESTROY_BY_RCU)) {
+   if (unlikely(c->cache_flags & SLAB_TYPESAFE_BY_RCU)) {
struct linux_kmem_rcu *rcu = LINUX_KMEM_TO_RCU(c, mem);
 
/* duplicate cache pointer */
@@ -85,7 +85,7 @@ linux_kmem_cache_create(const char *name, size_t size,
else if (align != 0)
align--;
 
-   if (flags & SLAB_DESTROY_BY_RCU) {
+   if (flags & SLAB_TYPESAFE_BY_RCU) {
/* make room for RCU structure */
size = ALIGN(size, sizeof(void *));
size += sizeof(struct linux_kmem_rcu);
@@ -118,7 +118,7 @@ linux_kmem_cache_free_rcu(struct linux_kmem_cache *c, 
 void
 linux_kmem_cache_destroy(struct linux_kmem_cache *c)
 {
-   if (unlikely(c->cache_flags & SLAB_DESTROY_BY_RCU)) {
+   if (unlikely(c->cache_flags & SLAB_TYPESAFE_BY_RCU)) {
/* make sure all free callbacks have been called */
rcu_barrier();
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330388 - head/sys/compat/linuxkpi/common/include/linux

2018-03-04 Thread Hans Petter Selasky
Author: hselasky
Date: Sun Mar  4 18:08:21 2018
New Revision: 330388
URL: https://svnweb.freebsd.org/changeset/base/330388

Log:
  Implement GENMASK_ULL() function macro in the LinuxKPI.
  
  MFC after:1 week
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  head/sys/compat/linuxkpi/common/include/linux/bitops.h

Modified: head/sys/compat/linuxkpi/common/include/linux/bitops.h
==
--- head/sys/compat/linuxkpi/common/include/linux/bitops.h  Sun Mar  4 
18:04:37 2018(r330387)
+++ head/sys/compat/linuxkpi/common/include/linux/bitops.h  Sun Mar  4 
18:08:21 2018(r330388)
@@ -45,12 +45,15 @@
 #defineBITS_PER_LONG   32
 #endif
 
+#defineBITS_PER_LONG_LONG  64
+
 #defineBITMAP_FIRST_WORD_MASK(start)   (~0UL << ((start) % 
BITS_PER_LONG))
 #defineBITMAP_LAST_WORD_MASK(n)(~0UL >> (BITS_PER_LONG - (n)))
 #defineBITS_TO_LONGS(n)howmany((n), BITS_PER_LONG)
 #defineBIT_MASK(nr)(1UL << ((nr) & (BITS_PER_LONG - 1)))
 #define BIT_WORD(nr)   ((nr) / BITS_PER_LONG)
 #defineGENMASK(h, l)   (((~0UL) >> (BITS_PER_LONG - (h) - 1)) 
& ((~0UL) << (l)))
+#defineGENMASK_ULL(h, l)   (((~0ULL) >> (BITS_PER_LONG_LONG - (h) 
- 1)) & ((~0ULL) << (l)))
 #define BITS_PER_BYTE   8
 
 #definehweight8(x) bitcount((uint8_t)(x))
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330389 - head/sys/compat/linuxkpi/common/include/linux

2018-03-04 Thread Hans Petter Selasky
Author: hselasky
Date: Sun Mar  4 18:10:18 2018
New Revision: 330389
URL: https://svnweb.freebsd.org/changeset/base/330389

Log:
  Implement for_each_clear_bit() function macro in the LinuxKPI.
  
  MFC after:1 week
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  head/sys/compat/linuxkpi/common/include/linux/bitops.h

Modified: head/sys/compat/linuxkpi/common/include/linux/bitops.h
==
--- head/sys/compat/linuxkpi/common/include/linux/bitops.h  Sun Mar  4 
18:08:21 2018(r330388)
+++ head/sys/compat/linuxkpi/common/include/linux/bitops.h  Sun Mar  4 
18:10:18 2018(r330389)
@@ -390,6 +390,10 @@ done:
 (bit) < (size);\
 (bit) = find_next_bit((addr), (size), (bit) + 1))
 
+#definefor_each_clear_bit(bit, addr, size) \
+   for ((bit) = find_first_zero_bit((addr), (size));   \
+(bit) < (size);\
+(bit) = find_next_zero_bit((addr), (size), (bit) + 1))
 
 static inline uint64_t
 sign_extend64(uint64_t value, int index)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330390 - head/sys/compat/linuxkpi/common/include/linux

2018-03-04 Thread Hans Petter Selasky
Author: hselasky
Date: Sun Mar  4 18:13:31 2018
New Revision: 330390
URL: https://svnweb.freebsd.org/changeset/base/330390

Log:
  Define noinline and __maybe_unused macros in the LinuxKPI.
  
  MFC after:1 week
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  head/sys/compat/linuxkpi/common/include/linux/compiler.h

Modified: head/sys/compat/linuxkpi/common/include/linux/compiler.h
==
--- head/sys/compat/linuxkpi/common/include/linux/compiler.hSun Mar  4 
18:10:18 2018(r330389)
+++ head/sys/compat/linuxkpi/common/include/linux/compiler.hSun Mar  4 
18:13:31 2018(r330390)
@@ -64,6 +64,7 @@
 #define__attribute_const__ __attribute__((__const__))
 #undef __always_inline
 #define__always_inline inline
+#definenoinline__noinline
 #definecacheline_aligned   __aligned(CACHE_LINE_SIZE)
 
 #definelikely(x)   __builtin_expect(!!(x), 1)
@@ -71,6 +72,7 @@
 #define typeof(x)  __typeof(x)
 
 #defineuninitialized_var(x)x = x
+#define__maybe_unused  __unused
 #define__always_unused __unused
 #define__must_check__result_use_check
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330391 - head/sys/compat/linuxkpi/common/include/linux

2018-03-04 Thread Hans Petter Selasky
Author: hselasky
Date: Sun Mar  4 18:17:54 2018
New Revision: 330391
URL: https://svnweb.freebsd.org/changeset/base/330391

Log:
  Implement writel_relaxed() in the LinuxKPI.
  
  MFC after:1 week
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  head/sys/compat/linuxkpi/common/include/linux/io.h

Modified: head/sys/compat/linuxkpi/common/include/linux/io.h
==
--- head/sys/compat/linuxkpi/common/include/linux/io.h  Sun Mar  4 18:13:31 
2018(r330390)
+++ head/sys/compat/linuxkpi/common/include/linux/io.h  Sun Mar  4 18:17:54 
2018(r330391)
@@ -74,6 +74,13 @@ writel(uint32_t b, void *addr)
 *(volatile uint32_t *)addr = b;
 }
 
+#undef writel_relaxed
+static inline void
+writel_relaxed(uint32_t b, void *addr)
+{
+   *(volatile uint32_t *)addr = b;
+}
+
 #undef writeq
 static inline void
 writeq(uint64_t b, void *addr)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330392 - head/sys/compat/linuxkpi/common/include/linux

2018-03-04 Thread Hans Petter Selasky
Author: hselasky
Date: Sun Mar  4 18:19:44 2018
New Revision: 330392
URL: https://svnweb.freebsd.org/changeset/base/330392

Log:
  Implement BUILD_BUG() function macro in the LinuxKPI.
  
  MFC after:1 week
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  head/sys/compat/linuxkpi/common/include/linux/kernel.h

Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h
==
--- head/sys/compat/linuxkpi/common/include/linux/kernel.h  Sun Mar  4 
18:17:54 2018(r330391)
+++ head/sys/compat/linuxkpi/common/include/linux/kernel.h  Sun Mar  4 
18:19:44 2018(r330392)
@@ -86,6 +86,7 @@
 #defineS64_C(x) x ## LL
 #defineU64_C(x) x ## ULL
 
+#defineBUILD_BUG() CTASSERT(0)
 #defineBUILD_BUG_ON(x) CTASSERT(!(x))
 #defineBUILD_BUG_ON_MSG(x, msg)BUILD_BUG_ON(x)
 #defineBUILD_BUG_ON_NOT_POWER_OF_2(x)  BUILD_BUG_ON(!powerof2(x))
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330393 - head/sys/compat/linuxkpi/common/include/linux

2018-03-04 Thread Hans Petter Selasky
Author: hselasky
Date: Sun Mar  4 18:21:21 2018
New Revision: 330393
URL: https://svnweb.freebsd.org/changeset/base/330393

Log:
  Implement __MODULE_STRING() function macro in the LinuxKPI.
  
  MFC after:1 week
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  head/sys/compat/linuxkpi/common/include/linux/module.h

Modified: head/sys/compat/linuxkpi/common/include/linux/module.h
==
--- head/sys/compat/linuxkpi/common/include/linux/module.h  Sun Mar  4 
18:19:44 2018(r330392)
+++ head/sys/compat/linuxkpi/common/include/linux/module.h  Sun Mar  4 
18:21:21 2018(r330393)
@@ -53,6 +53,7 @@
 
 #defineEXPORT_SYMBOL(name)
 #defineEXPORT_SYMBOL_GPL(name)
+#define__MODULE_STRING(x) __stringify(x)
 
 /* OFED pre-module initialization */
 #defineSI_SUB_OFED_PREINIT (SI_SUB_ROOT_CONF - 2)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330394 - head/sys/compat/linuxkpi/common/include/linux

2018-03-04 Thread Hans Petter Selasky
Author: hselasky
Date: Sun Mar  4 18:27:50 2018
New Revision: 330394
URL: https://svnweb.freebsd.org/changeset/base/330394

Log:
  Implement pr_err_ratelimited() function macro in the LinuxKPI.
  
  MFC after:1 week
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  head/sys/compat/linuxkpi/common/include/linux/printk.h

Modified: head/sys/compat/linuxkpi/common/include/linux/printk.h
==
--- head/sys/compat/linuxkpi/common/include/linux/printk.h  Sun Mar  4 
18:21:21 2018(r330393)
+++ head/sys/compat/linuxkpi/common/include/linux/printk.h  Sun Mar  4 
18:27:50 2018(r330394)
@@ -118,4 +118,7 @@ print_hex_dump_bytes(const char *prefix_str, const int
__retval;   \
 })
 
+#definepr_err_ratelimited(fmt, ...) \
+   printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
+
 #endif /* _LINUX_PRINTK_H_ */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330395 - in head/sys/compat/linuxkpi/common: include/linux src

2018-03-04 Thread Hans Petter Selasky
Author: hselasky
Date: Sun Mar  4 18:51:43 2018
New Revision: 330395
URL: https://svnweb.freebsd.org/changeset/base/330395

Log:
  Implement DEFINE_WAIT_FUNC() function macro and default_wake_function()
  in the LinuxKPI.
  
  MFC after:1 week
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  head/sys/compat/linuxkpi/common/include/linux/wait.h
  head/sys/compat/linuxkpi/common/src/linux_schedule.c

Modified: head/sys/compat/linuxkpi/common/include/linux/wait.h
==
--- head/sys/compat/linuxkpi/common/include/linux/wait.hSun Mar  4 
18:27:50 2018(r330394)
+++ head/sys/compat/linuxkpi/common/include/linux/wait.hSun Mar  4 
18:51:43 2018(r330395)
@@ -76,13 +76,17 @@ struct wait_queue_head {
  * renamed and furthermore must be the default wait queue callback.
  */
 extern wait_queue_func_t autoremove_wake_function;
+extern wait_queue_func_t default_wake_function;
 
-#defineDEFINE_WAIT(name)   
\
+#defineDEFINE_WAIT_FUNC(name, function)
\
wait_queue_t name = {   \
.private = current, \
-   .func = autoremove_wake_function,   \
+   .func = function,   \
.task_list = LINUX_LIST_HEAD_INIT(name.task_list)   \
}
+
+#defineDEFINE_WAIT(name) \
+   DEFINE_WAIT_FUNC(name, autoremove_wake_function)
 
 #defineDECLARE_WAITQUEUE(name, task)   
\
wait_queue_t name = {   \

Modified: head/sys/compat/linuxkpi/common/src/linux_schedule.c
==
--- head/sys/compat/linuxkpi/common/src/linux_schedule.cSun Mar  4 
18:27:50 2018(r330394)
+++ head/sys/compat/linuxkpi/common/src/linux_schedule.cSun Mar  4 
18:51:43 2018(r330395)
@@ -176,6 +176,13 @@ autoremove_wake_function(wait_queue_t *wq, unsigned in
return (ret);
 }
 
+int
+default_wake_function(wait_queue_t *wq, unsigned int state, int flags,
+void *key __unused)
+{
+   return (wake_up_task(wq->private, state));
+}
+
 void
 linux_wake_up(wait_queue_head_t *wqh, unsigned int state, int nr, bool locked)
 {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330396 - head/sys/compat/linuxkpi/common/include/linux

2018-03-04 Thread Hans Petter Selasky
Author: hselasky
Date: Sun Mar  4 18:53:41 2018
New Revision: 330396
URL: https://svnweb.freebsd.org/changeset/base/330396

Log:
  Keep the old SLAB_DESTROY_BY_RCU macro definition around in the LinuxKPI
  to avoid compilation breakage in external kernel modules.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/slab.h

Modified: head/sys/compat/linuxkpi/common/include/linux/slab.h
==
--- head/sys/compat/linuxkpi/common/include/linux/slab.hSun Mar  4 
18:51:43 2018(r330395)
+++ head/sys/compat/linuxkpi/common/include/linux/slab.hSun Mar  4 
18:53:41 2018(r330396)
@@ -82,6 +82,9 @@ struct linux_kmem_cache {
 #defineSLAB_TYPESAFE_BY_RCU(1 << 1)
 #defineSLAB_RECLAIM_ACCOUNT(1 << 2)
 
+#defineSLAB_DESTROY_BY_RCU \
+   SLAB_TYPESAFE_BY_RCU
+
 static inline gfp_t
 linux_check_m_flags(gfp_t flags)
 {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330397 - head/sys/dev/iicbus

2018-03-04 Thread Ian Lepore
Author: ian
Date: Sun Mar  4 18:58:24 2018
New Revision: 330397
URL: https://svnweb.freebsd.org/changeset/base/330397

Log:
  Fix a paste-o: use the IICBUS version constants, not IICBB bitbang driver's.

Modified:
  head/sys/dev/iicbus/nxprtc.c

Modified: head/sys/dev/iicbus/nxprtc.c
==
--- head/sys/dev/iicbus/nxprtc.cSun Mar  4 18:53:41 2018
(r330396)
+++ head/sys/dev/iicbus/nxprtc.cSun Mar  4 18:58:24 2018
(r330397)
@@ -823,4 +823,4 @@ static devclass_t nxprtc_devclass;
 
 DRIVER_MODULE(nxprtc, iicbus, nxprtc_driver, nxprtc_devclass, NULL, NULL);
 MODULE_VERSION(nxprtc, 1);
-MODULE_DEPEND(nxprtc, iicbus, IICBB_MINVER, IICBB_PREFVER, IICBB_MAXVER);
+MODULE_DEPEND(nxprtc, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330398 - head/sys/compat/linuxkpi/common/include/linux

2018-03-04 Thread Hans Petter Selasky
Author: hselasky
Date: Sun Mar  4 19:07:10 2018
New Revision: 330398
URL: https://svnweb.freebsd.org/changeset/base/330398

Log:
  Implement wait_event_lock_irq() macro function in the LinuxKPI.
  
  MFC after:1 week
  Requested by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/wait.h

Modified: head/sys/compat/linuxkpi/common/include/linux/wait.h
==
--- head/sys/compat/linuxkpi/common/include/linux/wait.hSun Mar  4 
18:58:24 2018(r330397)
+++ head/sys/compat/linuxkpi/common/include/linux/wait.hSun Mar  4 
19:07:10 2018(r330398)
@@ -194,11 +194,19 @@ int linux_wait_event_common(wait_queue_head_t *, wait_
 })
 
 /*
- * Hold the (locked) spinlock when testing the cond.
+ * The passed spinlock is held when testing the condition.
  */
 #definewait_event_interruptible_lock_irq(wqh, cond, lock) ({   
\
__wait_event_common(wqh, cond, MAX_SCHEDULE_TIMEOUT,\
TASK_INTERRUPTIBLE, &(lock));   \
+})
+
+/*
+ * The passed spinlock is held when testing the condition.
+ */
+#definewait_event_lock_irq(wqh, cond, lock) ({ \
+   __wait_event_common(wqh, cond, MAX_SCHEDULE_TIMEOUT,\
+   TASK_UNINTERRUPTIBLE, &(lock)); \
 })
 
 static inline void
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330399 - head/sys/compat/linuxkpi/common/include/linux

2018-03-04 Thread Hans Petter Selasky
Author: hselasky
Date: Sun Mar  4 19:10:30 2018
New Revision: 330399
URL: https://svnweb.freebsd.org/changeset/base/330399

Log:
  Stub kernel_param_lock() and kernel_param_unlock() in the LinuxKPI.
  
  MFC after:1 week
  Submitted by: Johannes Lundberg 
  Sponsored by: Mellanox Technologies
  Sponsored by: Limelight Networks

Modified:
  head/sys/compat/linuxkpi/common/include/linux/moduleparam.h

Modified: head/sys/compat/linuxkpi/common/include/linux/moduleparam.h
==
--- head/sys/compat/linuxkpi/common/include/linux/moduleparam.h Sun Mar  4 
19:07:10 2018(r330398)
+++ head/sys/compat/linuxkpi/common/include/linux/moduleparam.h Sun Mar  4 
19:10:30 2018(r330399)
@@ -125,6 +125,9 @@
 #defineMODULE_PARM_DESC(name, desc) \
const char LINUXKPI_PARAM_DESC(name)[] = { desc }
 
+#definekernel_param_lock(...) do {} while (0)
+#definekernel_param_unlock(...) do {} while (0)
+
 SYSCTL_DECL(_compat_linuxkpi);
 
 #endif /* _LINUX_MODULEPARAM_H_ */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330400 - head/sys/kern

2018-03-04 Thread Mateusz Guzik
Author: mjg
Date: Sun Mar  4 19:12:54 2018
New Revision: 330400
URL: https://svnweb.freebsd.org/changeset/base/330400

Log:
  lockmgr: start decomposing the main routine
  
  The main routine takes 8 args, 3 of which are almost the same for most uses.
  This in particular pushes it above the limit of 6 arguments passable through
  registers on amd64 making it impossible to tail call.
  
  This is a prerequisite for further cleanups.
  
  Tested by:pho

Modified:
  head/sys/kern/kern_lock.c

Modified: head/sys/kern/kern_lock.c
==
--- head/sys/kern/kern_lock.c   Sun Mar  4 19:10:30 2018(r330399)
+++ head/sys/kern/kern_lock.c   Sun Mar  4 19:12:54 2018(r330400)
@@ -160,11 +160,31 @@ struct lock_class lock_class_lockmgr = {
 #endif
 };
 
+struct lockmgr_wait {
+   const char *iwmesg;
+   int ipri;
+   int itimo;
+};
+
 static bool __always_inline lockmgr_slock_try(struct lock *lk, uintptr_t *xp,
 int flags);
-static bool __always_inline lockmgr_sunlock_try(struct lock *lk, uintptr_t x);
+static bool __always_inline lockmgr_sunlock_try(struct lock *lk, uintptr_t 
*xp);
 
 static void
+lockmgr_exit(u_int flags, struct lock_object *ilk, int wakeup_swapper)
+{
+   struct lock_class *class;
+
+   if (flags & LK_INTERLOCK) {
+   class = LOCK_CLASS(ilk);
+   class->lc_unlock(ilk);
+   }
+
+   if (__predict_false(wakeup_swapper))
+   kick_proc0();
+}
+
+static void
 lockmgr_note_shared_acquire(struct lock *lk, int contested,
 uint64_t waittime, const char *file, int line, int flags)
 {
@@ -295,7 +315,7 @@ wakeupshlk(struct lock *lk, const char *file, int line
wakeup_swapper = 0;
for (;;) {
x = lk->lk_lock;
-   if (lockmgr_sunlock_try(lk, x))
+   if (lockmgr_sunlock_try(lk, &x))
break;
 
/*
@@ -502,7 +522,7 @@ lockmgr_slock_try(struct lock *lk, uintptr_t *xp, int 
 }
 
 static bool __always_inline
-lockmgr_sunlock_try(struct lock *lk, uintptr_t x)
+lockmgr_sunlock_try(struct lock *lk, uintptr_t *xp)
 {
 
for (;;) {
@@ -510,9 +530,9 @@ lockmgr_sunlock_try(struct lock *lk, uintptr_t x)
 * If there is more than one shared lock held, just drop one
 * and return.
 */
-   if (LK_SHARERS(x) > 1) {
-   if (atomic_fcmpset_rel_ptr(&lk->lk_lock, &x,
-   x - LK_ONE_SHARER))
+   if (LK_SHARERS(*xp) > 1) {
+   if (atomic_fcmpset_rel_ptr(&lk->lk_lock, xp,
+   *xp - LK_ONE_SHARER))
return (true);
continue;
}
@@ -521,10 +541,10 @@ lockmgr_sunlock_try(struct lock *lk, uintptr_t x)
 * If there are not waiters on the exclusive queue, drop the
 * lock quickly.
 */
-   if ((x & LK_ALL_WAITERS) == 0) {
-   MPASS((x & ~LK_EXCLUSIVE_SPINNERS) ==
+   if ((*xp & LK_ALL_WAITERS) == 0) {
+   MPASS((*xp & ~LK_EXCLUSIVE_SPINNERS) ==
LK_SHARERS_LOCK(1));
-   if (atomic_fcmpset_rel_ptr(&lk->lk_lock, &x,
+   if (atomic_fcmpset_rel_ptr(&lk->lk_lock, xp,
LK_UNLOCKED))
return (true);
continue;
@@ -534,12 +554,373 @@ lockmgr_sunlock_try(struct lock *lk, uintptr_t x)
return (false);
 }
 
+static __noinline int
+lockmgr_slock_hard(struct lock *lk, u_int flags, struct lock_object *ilk,
+const char *file, int line, struct lockmgr_wait *lwa)
+{
+   uintptr_t tid, x;
+   int error = 0;
+   const char *iwmesg;
+   int ipri, itimo;
+
+#ifdef LOCK_PROFILING
+   uint64_t waittime = 0;
+   int contested = 0;
+#endif
+
+   if (__predict_false(panicstr != NULL))
+   goto out;
+
+   tid = (uintptr_t)curthread;
+
+   if (LK_CAN_WITNESS(flags))
+   WITNESS_CHECKORDER(&lk->lock_object, LOP_NEWORDER,
+   file, line, flags & LK_INTERLOCK ? ilk : NULL);
+   for (;;) {
+   if (lockmgr_slock_try(lk, &x, flags))
+   break;
+#ifdef HWPMC_HOOKS
+   PMC_SOFT_CALL( , , lock, failed);
+#endif
+   lock_profile_obtain_lock_failed(&lk->lock_object,
+   &contested, &waittime);
+
+   /*
+* If the lock is already held by curthread in
+* exclusive way avoid a deadlock.
+*/
+   if (LK_HOLDER(x) == tid) {
+   LOCK_LOG2(lk,
+   "%s: %p already held in exclusive mode",
+   __func__, lk);
+   error = EDEADLK;
+  

Re: svn commit: r330236 - head/sys/compat/linuxkpi/common/src

2018-03-04 Thread Hans Petter Selasky

On 03/04/18 02:25, Colin Percival wrote:

In case the data point is useful: Merging this to stable/11 unbroke S3
suspend/resume on my laptop (system76 Galago Pro, kabylake, using the
drm-next-kmod port).


FYI: Now MFC'ed to stable/11.

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


svn commit: r330403 - head/sys/dev/iicbus

2018-03-04 Thread Ian Lepore
Author: ian
Date: Sun Mar  4 19:20:11 2018
New Revision: 330403
URL: https://svnweb.freebsd.org/changeset/base/330403

Log:
  Add calls to the new clock_dbgprint_xxx() functions.

Modified:
  head/sys/dev/iicbus/ds1307.c

Modified: head/sys/dev/iicbus/ds1307.c
==
--- head/sys/dev/iicbus/ds1307.cSun Mar  4 19:17:32 2018
(r330402)
+++ head/sys/dev/iicbus/ds1307.cSun Mar  4 19:20:11 2018
(r330403)
@@ -359,6 +359,7 @@ ds1307_gettime(device_t dev, struct timespec *ts)
bct.mon  = data[DS1307_MONTH] & DS1307_MONTH_MASK;
bct.year = data[DS1307_YEAR]  & DS1307_YEAR_MASK;
 
+   clock_dbgprint_bcd(sc->sc_dev, CLOCK_DBG_READ, &bct); 
return (clock_bcd_to_ts(&bct, ts, sc->sc_use_ampm));
 }
 
@@ -379,6 +380,7 @@ ds1307_settime(device_t dev, struct timespec *ts)
 */
ts->tv_sec -= utc_offset();
clock_ts_to_bcd(ts, &bct, sc->sc_use_ampm);
+   clock_dbgprint_bcd(sc->sc_dev, CLOCK_DBG_WRITE, &bct);
 
/* If the chip is in AM/PM mode, adjust hour and set flags as needed. */
if (sc->sc_use_ampm) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330404 - head/sys/dev/iicbus

2018-03-04 Thread Ian Lepore
Author: ian
Date: Sun Mar  4 19:23:48 2018
New Revision: 330404
URL: https://svnweb.freebsd.org/changeset/base/330404

Log:
  Add calls to the new clock_dbgprint_xxx() functions.

Modified:
  head/sys/dev/iicbus/ds13rtc.c

Modified: head/sys/dev/iicbus/ds13rtc.c
==
--- head/sys/dev/iicbus/ds13rtc.c   Sun Mar  4 19:20:11 2018
(r330403)
+++ head/sys/dev/iicbus/ds13rtc.c   Sun Mar  4 19:23:48 2018
(r330404)
@@ -395,6 +395,7 @@ ds13rtc_gettime(device_t dev, struct timespec *ts)
if (sc->use_century)
bct.year += (tregs.month & DS13xx_B_MONTH_CENTURY) ? 0x100 : 0;
 
+   clock_dbgprint_bcd(sc->sc_dev, CLOCK_DBG_READ, &bct); 
err = clock_bcd_to_ts(&bct, ts, sc->use_ampm);
 
return (err);
@@ -422,6 +423,7 @@ ds13rtc_settime(device_t dev, struct timespec *ts)
return (write_timeword(sc, ts->tv_sec));
 
clock_ts_to_bcd(ts, &bct, sc->use_ampm);
+   clock_dbgprint_bcd(sc->sc_dev, CLOCK_DBG_WRITE, &bct); 
 
/* If the chip is in AMPM mode deal with the PM flag. */
pmflags = 0;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330405 - head/sys/dev/iicbus

2018-03-04 Thread Ian Lepore
Author: ian
Date: Sun Mar  4 19:25:54 2018
New Revision: 330405
URL: https://svnweb.freebsd.org/changeset/base/330405

Log:
  Oops, fix a paste-o.

Modified:
  head/sys/dev/iicbus/ds13rtc.c

Modified: head/sys/dev/iicbus/ds13rtc.c
==
--- head/sys/dev/iicbus/ds13rtc.c   Sun Mar  4 19:23:48 2018
(r330404)
+++ head/sys/dev/iicbus/ds13rtc.c   Sun Mar  4 19:25:54 2018
(r330405)
@@ -395,7 +395,7 @@ ds13rtc_gettime(device_t dev, struct timespec *ts)
if (sc->use_century)
bct.year += (tregs.month & DS13xx_B_MONTH_CENTURY) ? 0x100 : 0;
 
-   clock_dbgprint_bcd(sc->sc_dev, CLOCK_DBG_READ, &bct); 
+   clock_dbgprint_bcd(sc->dev, CLOCK_DBG_READ, &bct); 
err = clock_bcd_to_ts(&bct, ts, sc->use_ampm);
 
return (err);
@@ -423,7 +423,7 @@ ds13rtc_settime(device_t dev, struct timespec *ts)
return (write_timeword(sc, ts->tv_sec));
 
clock_ts_to_bcd(ts, &bct, sc->use_ampm);
-   clock_dbgprint_bcd(sc->sc_dev, CLOCK_DBG_WRITE, &bct); 
+   clock_dbgprint_bcd(sc->dev, CLOCK_DBG_WRITE, &bct); 
 
/* If the chip is in AMPM mode deal with the PM flag. */
pmflags = 0;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330406 - head/sys/dev/iicbus

2018-03-04 Thread Ian Lepore
Author: ian
Date: Sun Mar  4 19:26:47 2018
New Revision: 330406
URL: https://svnweb.freebsd.org/changeset/base/330406

Log:
  Add calls to the new clock_dbgprint_xxx() functions.

Modified:
  head/sys/dev/iicbus/nxprtc.c

Modified: head/sys/dev/iicbus/nxprtc.c
==
--- head/sys/dev/iicbus/nxprtc.cSun Mar  4 19:25:54 2018
(r330405)
+++ head/sys/dev/iicbus/nxprtc.cSun Mar  4 19:26:47 2018
(r330406)
@@ -608,6 +608,7 @@ nxprtc_gettime(device_t dev, struct timespec *ts)
sc->flags |= SC_F_CPOL;
}
 
+   clock_dbgprint_bcd(sc->dev, CLOCK_DBG_READ, &bct); 
err = clock_bcd_to_ts(&bct, ts, sc->use_ampm);
ts->tv_sec += utc_offset();
 
@@ -648,6 +649,7 @@ nxprtc_settime(device_t dev, struct timespec *ts)
ts->tv_sec -= utc_offset();
ts->tv_nsec = 0;
clock_ts_to_bcd(ts, &bct, sc->use_ampm);
+   clock_dbgprint_bcd(sc->dev, CLOCK_DBG_WRITE, &bct);
 
/* On 8563 set the century based on the polarity seen when reading. */
cflag = 0;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330407 - head/sys/dev/iicbus

2018-03-04 Thread Ian Lepore
Author: ian
Date: Sun Mar  4 19:32:52 2018
New Revision: 330407
URL: https://svnweb.freebsd.org/changeset/base/330407

Log:
  Add calls to the new clock_dbgprint_xxx() functions.  Also, stop applying
  a local .5 second adjustment to the time, since that is now done by the
  code in subr_rtc.c.

Modified:
  head/sys/dev/iicbus/ds1672.c

Modified: head/sys/dev/iicbus/ds1672.c
==
--- head/sys/dev/iicbus/ds1672.cSun Mar  4 19:26:47 2018
(r330406)
+++ head/sys/dev/iicbus/ds1672.cSun Mar  4 19:32:52 2018
(r330407)
@@ -54,8 +54,6 @@ __FBSDID("$FreeBSD$");
 
 #defineDS1672_CTRL_EOSC(1 << 7)/* Stop/start flag. */
 
-#define NANOSEC10
-
 #defineMAX_IIC_DATA_SIZE   4
 
 struct ds1672_softc {
@@ -144,8 +142,9 @@ ds1672_gettime(device_t dev, struct timespec *ts)
/* counter has seconds since epoch */
ts->tv_sec = (secs[3] << 24) | (secs[2] << 16)
   | (secs[1] <<  8) | (secs[0] <<  0);
-   ts->tv_nsec = NANOSEC / 2;
+   ts->tv_nsec = 0;
}
+   clock_dbgprint_ts(sc->sc_dev, CLOCK_DBG_READ, ts); 
return (error);
 }
 
@@ -159,6 +158,8 @@ ds1672_settime(device_t dev, struct timespec *ts)
data[2] = (ts->tv_sec >> 16) & 0xff;
data[3] = (ts->tv_sec >> 24) & 0xff;
 
+   ts->tv_nsec = 0;
+   clock_dbgprint_ts(sc->sc_dev, CLOCK_DBG_WRITE, ts);
return (ds1672_write(dev, DS1672_COUNTER, data, 4));
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330408 - head/sys/compat/linuxkpi/common/include/linux

2018-03-04 Thread Hans Petter Selasky
Author: hselasky
Date: Sun Mar  4 19:42:50 2018
New Revision: 330408
URL: https://svnweb.freebsd.org/changeset/base/330408

Log:
  Properly wrap the BUILD_BUG() function macro in the LinuxKPI.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/kernel.h

Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h
==
--- head/sys/compat/linuxkpi/common/include/linux/kernel.h  Sun Mar  4 
19:32:52 2018(r330407)
+++ head/sys/compat/linuxkpi/common/include/linux/kernel.h  Sun Mar  4 
19:42:50 2018(r330408)
@@ -86,7 +86,7 @@
 #defineS64_C(x) x ## LL
 #defineU64_C(x) x ## ULL
 
-#defineBUILD_BUG() CTASSERT(0)
+#defineBUILD_BUG() do { CTASSERT(0); } while (0)
 #defineBUILD_BUG_ON(x) CTASSERT(!(x))
 #defineBUILD_BUG_ON_MSG(x, msg)BUILD_BUG_ON(x)
 #defineBUILD_BUG_ON_NOT_POWER_OF_2(x)  BUILD_BUG_ON(!powerof2(x))
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330409 - head/lib/libc/sys

2018-03-04 Thread Brooks Davis
Author: brooks
Date: Sun Mar  4 20:06:02 2018
New Revision: 330409
URL: https://svnweb.freebsd.org/changeset/base/330409

Log:
  Refer to SysV IPC permissions as numeric constants.
  
  POSIX defines no macros for these permissions.
  
  Also remove unneeded headers from synopsis.
  
  PR:   225905
  Reviewed by:  wblock
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D14461

Modified:
  head/lib/libc/sys/msgget.2
  head/lib/libc/sys/semget.2
  head/lib/libc/sys/shmget.2

Modified: head/lib/libc/sys/msgget.2
==
--- head/lib/libc/sys/msgget.2  Sun Mar  4 19:42:50 2018(r330408)
+++ head/lib/libc/sys/msgget.2  Sun Mar  4 20:06:02 2018(r330409)
@@ -31,7 +31,7 @@
 .\" $FreeBSD$
 .\"
 .\"/
-.Dd July 9, 2009
+.Dd March 4, 2018
 .Dt MSGGET 2
 .Os
 .Sh NAME
@@ -40,8 +40,6 @@
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.In sys/types.h
-.In sys/ipc.h
 .In sys/msg.h
 .Ft int
 .Fn msgget "key_t key" "int msgflg"
@@ -83,7 +81,22 @@ are set to the effective gid of the calling process.
 .It
 .Va msg_perm.mode
 is set to the lower 9 bits of
-.Fa msgflg .
+.Fa msgflg
+which are set by ORing these constants:
+.Bl -tag -width 
+.It Dv 0400
+Read access for user.
+.It Dv 0200
+Write access for user.
+.It Dv 0040
+Read access for group.
+.It Dv 0020
+Write access for group.
+.It Dv 0004
+Read access for other.
+.It Dv 0002
+Write access for other.
+.El
 .It
 .Va msg_cbytes ,
 .Va msg_qnum ,

Modified: head/lib/libc/sys/semget.2
==
--- head/lib/libc/sys/semget.2  Sun Mar  4 19:42:50 2018(r330408)
+++ head/lib/libc/sys/semget.2  Sun Mar  4 20:06:02 2018(r330409)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 7, 2016
+.Dd March 4, 2018
 .Dt SEMGET 2
 .Os
 .Sh NAME
@@ -34,8 +34,6 @@
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.In sys/types.h
-.In sys/ipc.h
 .In sys/sem.h
 .Ft int
 .Fn semget "key_t key" "int nsems" "int flag"
@@ -77,23 +75,22 @@ may be used to generate a key from a pathname.
 .\" Likewise for this section, except SHM_* becomes SEM_*.
 .\"
 .Pp
-The mode of a newly created IPC object is determined by
-.Em OR Ns 'ing
-the following constants into the
+The mode of a newly created IPC object is determined by ORing these constants
+into the
 .Fa flag
 argument:
-.Bl -tag -width XSEM_WXX6XXX
-.It Dv SEM_R
+.Bl -tag -width 
+.It Dv 0400
 Read access for user.
-.It Dv SEM_A
+.It Dv 0200
 Alter access for user.
-.It Dv ( SEM_R>>3 )
+.It Dv 0040
 Read access for group.
-.It Dv ( SEM_A>>3 )
+.It Dv 0020
 Alter access for group.
-.It Dv ( SEM_R>>6 )
+.It Dv 0004
 Read access for other.
-.It Dv ( SEM_A>>6 )
+.It Dv 0002
 Alter access for other.
 .El
 .Pp

Modified: head/lib/libc/sys/shmget.2
==
--- head/lib/libc/sys/shmget.2  Sun Mar  4 19:42:50 2018(r330408)
+++ head/lib/libc/sys/shmget.2  Sun Mar  4 20:06:02 2018(r330409)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 12, 2017
+.Dd March 4, 2018
 .Dt SHMGET 2
 .Os
 .Sh NAME
@@ -34,9 +34,6 @@
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.In sys/types.h
-.In sys/stat.h
-.In sys/ipc.h
 .In sys/shm.h
 .Ft int
 .Fn shmget "key_t key" "size_t size" "int flag"
@@ -75,22 +72,21 @@ may be used to generate a key from a pathname.
 .El
 .Pp
 The mode of a newly created IPC object is determined by
-.Em OR Ns 'ing
-the following constants into the
+which are set by ORing these constants into the
 .Fa flag
 argument:
-.Bl -tag -width XSHM_WXX6XXX
-.It Dv S_IRUSR
+.Bl -tag -width 
+.It Dv 0400
 Read access for owner.
-.It Dv S_IWUSR
+.It Dv 0200
 Write access for owner.
-.It Dv S_IRGRP
+.It Dv 0040
 Read access for group.
-.It Dv S_IWGRP
+.It Dv 0020
 Write access for group.
-.It Dv S_IROTH
+.It Dv 0004
 Read access for other.
-.It Dv S_IWOTH
+.It Dv 0002
 Write access for other.
 .El
 .\"
@@ -143,5 +139,4 @@ already exists.
 .Xr shmat 2 ,
 .Xr shmctl 2 ,
 .Xr shmdt 2 ,
-.Xr stat 2 ,
 .Xr ftok 3
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330410 - in head/sys: amd64/amd64 arm/arm arm64/arm64 i386/i386 riscv/riscv vm

2018-03-04 Thread Konstantin Belousov
Author: kib
Date: Sun Mar  4 20:53:20 2018
New Revision: 330410
URL: https://svnweb.freebsd.org/changeset/base/330410

Log:
  Unify bulk free operations in several pmaps.
  
  Submitted by: Yoshihiro Ota
  Reviewed by:  markj
  MFC after:2 weeks
  Differential revision:https://reviews.freebsd.org/D13485

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/arm/arm/pmap-v6.c
  head/sys/arm64/arm64/pmap.c
  head/sys/i386/i386/pmap.c
  head/sys/riscv/riscv/pmap.c
  head/sys/vm/vm_page.c
  head/sys/vm/vm_page.h

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Sun Mar  4 20:06:02 2018(r330409)
+++ head/sys/amd64/amd64/pmap.c Sun Mar  4 20:53:20 2018(r330410)
@@ -2369,20 +2369,6 @@ pmap_qremove(vm_offset_t sva, int count)
 /***
  * Page table page management routines.
  ***/
-static __inline void
-pmap_free_zero_pages(struct spglist *free)
-{
-   vm_page_t m;
-   int count;
-
-   for (count = 0; (m = SLIST_FIRST(free)) != NULL; count++) {
-   SLIST_REMOVE_HEAD(free, plinks.s.ss);
-   /* Preserve the page's PG_ZERO setting. */
-   vm_page_free_toq(m);
-   }
-   vm_wire_sub(count);
-}
-
 /*
  * Schedule the specified unused page table page to be freed.  Specifically,
  * add the page to the specified list of pages that will be released to the
@@ -3282,7 +3268,7 @@ next_chunk:
/* Recycle a freed page table page. */
m_pc->wire_count = 1;
}
-   pmap_free_zero_pages(&free);
+   vm_page_free_pages_toq(&free, true);
return (m_pc);
 }
 
@@ -3781,7 +3767,7 @@ pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, v
pmap_remove_pde(pmap, pde, sva, &free, lockp);
if ((oldpde & PG_G) == 0)
pmap_invalidate_pde_page(pmap, sva, oldpde);
-   pmap_free_zero_pages(&free);
+   vm_page_free_pages_toq(&free, true);
CTR2(KTR_PMAP, "pmap_demote_pde: failure for va %#lx"
" in pmap %p", va, pmap);
return (FALSE);
@@ -4183,7 +4169,7 @@ out:
pmap_invalidate_all(pmap);
PMAP_UNLOCK(pmap);
pmap_delayed_invl_finished();
-   pmap_free_zero_pages(&free);
+   vm_page_free_pages_toq(&free, true);
 }
 
 /*
@@ -4281,7 +4267,7 @@ retry:
vm_page_aflag_clear(m, PGA_WRITEABLE);
rw_wunlock(lock);
pmap_delayed_invl_wait(m);
-   pmap_free_zero_pages(&free);
+   vm_page_free_pages_toq(&free, true);
 }
 
 /*
@@ -4949,7 +4935,7 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t
   pmap_invalidate_all(pmap);
pmap_delayed_invl_finished();
}
-   pmap_free_zero_pages(&free);
+   vm_page_free_pages_toq(&free, true);
if (va >= VM_MAXUSER_ADDRESS) {
mt = PHYS_TO_VM_PAGE(*pde & PG_FRAME);
if (pmap_insert_pt_page(pmap, mt)) {
@@ -4978,7 +4964,7 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t
 * pages.  Invalidate those entries.
 */
pmap_invalidate_page(pmap, va);
-   pmap_free_zero_pages(&free);
+   vm_page_free_pages_toq(&free, true);
}
CTR2(KTR_PMAP, "pmap_enter_pde: failure for va %#lx"
" in pmap %p", va, pmap);
@@ -5159,7 +5145,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v
 * pages.  Invalidate those entries.
 */
pmap_invalidate_page(pmap, va);
-   pmap_free_zero_pages(&free);
+   vm_page_free_pages_toq(&free, true);
}
mpte = NULL;
}
@@ -5537,7 +5523,8 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_
 */
pmap_invalidate_page(dst_pmap,
addr);
-   pmap_free_zero_pages(&free);
+   vm_page_free_pages_toq(&free,
+   true);
}
goto out;
}
@@ -5955,7 +5942,7 @@ pmap_remove_pages(pmap_t pmap)
rw_wunlock(lock);
pmap_invalidate_all(pmap);
   

svn commit: r330411 - head/sys/dev/iicbus

2018-03-04 Thread Ian Lepore
Author: ian
Date: Sun Mar  4 21:04:30 2018
New Revision: 330411
URL: https://svnweb.freebsd.org/changeset/base/330411

Log:
  Convert to the new(ish) bcd_clocktime conversion functions, add calls to
  the new debug output functions, and when setting the clock, propagate the
  timespec nsecs to the 1/100ths register.

Modified:
  head/sys/dev/iicbus/rtc8583.c

Modified: head/sys/dev/iicbus/rtc8583.c
==
--- head/sys/dev/iicbus/rtc8583.c   Sun Mar  4 20:53:20 2018
(r330410)
+++ head/sys/dev/iicbus/rtc8583.c   Sun Mar  4 21:04:30 2018
(r330411)
@@ -190,7 +190,7 @@ static int
 rtc8583_gettime(device_t dev, struct timespec *ts)
 {
struct rtc8583_softc*sc;
-   struct clocktime ct;
+   struct bcd_clocktime bct;
struct time_regs tregs;
uint8_t  y, ytmp, sreg;
int  err;
@@ -227,42 +227,49 @@ rtc8583_gettime(device_t dev, struct timespec *ts)
iicbus_release_bus(sc->busdev, sc->dev);
}
 
-   ct.nsec = FROMBCD(tregs.msec) * 10 * 1000 * 1000;
-   ct.sec  = FROMBCD(tregs.sec);
-   ct.min  = FROMBCD(tregs.min);
-   ct.hour = FROMBCD(tregs.hour & 0x3f);
-   ct.day  = FROMBCD(tregs.day & 0x3f);
-   ct.mon  = FROMBCD(tregs.month & 0x1f);
-   ct.year = 2000 + sreg;
+   if (!validbcd(tregs.msec))
+   return (EINVAL);
 
-   return (clock_ct_to_ts(&ct, ts));
+/* The 'msec' reg is actually 1/100ths, in bcd.  */
+   bct.nsec = bcd2bin(tregs.msec) * 10 * 1000 * 1000;
+   bct.sec  = tregs.sec;
+   bct.min  = tregs.min;
+   bct.hour = tregs.hour & 0x3f;
+   bct.day  = tregs.day & 0x3f;
+   bct.mon  = tregs.month & 0x1f;
+   bct.year = (bin2bcd(sreg / 100) << 8) | bin2bcd(sreg % 100);
+
+   clock_dbgprint_bcd(sc->dev, CLOCK_DBG_READ, &bct); 
+   return (clock_bcd_to_ts(&bct, ts, false));
 }
 
 static int
 rtc8583_settime(device_t dev, struct timespec *ts)
 {
struct rtc8583_softc*sc;
-   struct clocktime ct;
+   struct bcd_clocktime bct;
struct time_regs tregs;
uint8_t  sreg;
int  err;
 
sc = device_get_softc(dev);
ts->tv_sec -= utc_offset();
-   ts->tv_nsec = 0;
-   clock_ts_to_ct(ts, &ct);
+   clock_ts_to_bcd(ts, &bct, false);
+   clock_dbgprint_bcd(sc->dev, CLOCK_DBG_WRITE, &bct);
 
-   tregs.sec   = TOBCD(ct.sec);
-   tregs.min   = TOBCD(ct.min);
-   tregs.hour  = TOBCD(ct.hour);
-   tregs.day   = TOBCD(ct.day) | ((ct.year & 0x03) << 6);
-   tregs.month = TOBCD(ct.mon);
+   /* The 'msec' reg is actually 1/100ths, in bcd.  */
+   tregs.msec  = bin2bcd(ts->tv_nsec / (10 * 1000 * 1000));
+   tregs.sec   = bct.sec;
+   tregs.min   = bct.min;
+   tregs.hour  = bct.hour;
+   tregs.day   = bct.day | (bct.year & 0x03 << 6);
+   tregs.month = bct.mon;
 
if ((err = iicbus_request_bus(sc->busdev, sc->dev, IIC_WAIT)) != 0)
return (err);
err = rtc8583_writeto(sc->dev, RTC8583_SC_REG, &tregs,
sizeof(tregs), IIC_WAIT);
-   sreg = ct.year - 2000;
+   sreg = bcd2bin(bct.year & 0xff) + 100 * bcd2bin(bct.year >> 8);
/* save to year to sram */
rtc8583_write1(sc, RTC8583_USERSRAM_REG, sreg);
iicbus_release_bus(sc->busdev, sc->dev);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330412 - in head/sys/modules/i2c: . rtc8583

2018-03-04 Thread Ian Lepore
Author: ian
Date: Sun Mar  4 21:06:21 2018
New Revision: 330412
URL: https://svnweb.freebsd.org/changeset/base/330412

Log:
  Build iicbus/rtc8583 as a module.

Added:
  head/sys/modules/i2c/rtc8583/
  head/sys/modules/i2c/rtc8583/Makefile   (contents, props changed)
Modified:
  head/sys/modules/i2c/Makefile

Modified: head/sys/modules/i2c/Makefile
==
--- head/sys/modules/i2c/Makefile   Sun Mar  4 21:04:30 2018
(r330411)
+++ head/sys/modules/i2c/Makefile   Sun Mar  4 21:06:21 2018
(r330412)
@@ -17,6 +17,7 @@ SUBDIR = \
jedec_dimm \
jedec_ts \
nxprtc \
+   rtc8583 \
s35390a \
smb \
smbus \

Added: head/sys/modules/i2c/rtc8583/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/i2c/rtc8583/Makefile   Sun Mar  4 21:06:21 2018
(r330412)
@@ -0,0 +1,19 @@
+# $FreeBSD$
+
+.PATH: ${SRCTOP}/sys/dev/iicbus
+KMOD   = rtc8583
+SRCS   = rtc8583.c 
+
+# Generated files...
+SRCS+= \
+   bus_if.h \
+   clock_if.h \
+   device_if.h \
+   iicbus_if.h \
+   opt_platform.h \
+
+.if !empty(OPT_FDT)
+SRCS+= ofw_bus_if.h
+.endif
+
+.include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330413 - head/sys/vm

2018-03-04 Thread Konstantin Belousov
Author: kib
Date: Sun Mar  4 21:15:31 2018
New Revision: 330413
URL: https://svnweb.freebsd.org/changeset/base/330413

Log:
  Remove redundant test from r330410.
  
  If the input slist is non-empty, counter cannot be zero after freeing.
  
  Noted by: mjg
  MFC after:2 weeks

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Sun Mar  4 21:06:21 2018(r330412)
+++ head/sys/vm/vm_page.c   Sun Mar  4 21:15:31 2018(r330413)
@@ -3268,7 +3268,7 @@ vm_page_free_pages_toq(struct spglist *free, bool upda
 
vm_page_free_phys_pglist(&pgl);
 
-   if (update_wire_count && count > 0)
+   if (update_wire_count)
vm_wire_sub(count);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330414 - head/sys/kern

2018-03-04 Thread Mateusz Guzik
Author: mjg
Date: Sun Mar  4 21:38:30 2018
New Revision: 330414
URL: https://svnweb.freebsd.org/changeset/base/330414

Log:
  locks: fix a corner case in r327399
  
  If there were exactly rowner_retries/asx_retries (by default: 10) transitions
  between read and write state and the waiters still did not get the lock, the
  next owner -> reader transition would result in the code correctly falling
  back to turnstile/sleepq where it would incorrectly think it was waiting
  for a writer and decide to leave turnstile/sleepq to loop back. From this
  point it would take ts/sq trips until the lock gets released.
  
  The bug sometimes manifested itself in stalls during -j 128 package builds.
  
  Refactor the code to fix the bug, while here remove some of the gratituous
  differences between rw and sx locks.

Modified:
  head/sys/kern/kern_rwlock.c
  head/sys/kern/kern_sx.c

Modified: head/sys/kern/kern_rwlock.c
==
--- head/sys/kern/kern_rwlock.c Sun Mar  4 21:15:31 2018(r330413)
+++ head/sys/kern/kern_rwlock.c Sun Mar  4 21:38:30 2018(r330414)
@@ -875,7 +875,7 @@ __rw_wlock_hard(volatile uintptr_t *c, uintptr_t v LOC
 #ifdef ADAPTIVE_RWLOCKS
int spintries = 0;
int i, n;
-   int sleep_reason = 0;
+   enum { READERS, WRITER } sleep_reason;
 #endif
uintptr_t x;
 #ifdef LOCK_PROFILING
@@ -956,9 +956,11 @@ __rw_wlock_hard(volatile uintptr_t *c, uintptr_t v LOC
 * running on another CPU, spin until the owner stops
 * running or the state of the lock changes.
 */
-   sleep_reason = 1;
-   owner = lv_rw_wowner(v);
-   if (!(v & RW_LOCK_READ) && TD_IS_RUNNING(owner)) {
+   if (!(v & RW_LOCK_READ)) {
+   sleep_reason = WRITER;
+   owner = lv_rw_wowner(v);
+   if (!TD_IS_RUNNING(owner))
+   goto ts;
if (LOCK_LOG_TEST(&rw->lock_object, 0))
CTR3(KTR_LOCK, "%s: spinning on %p held by %p",
__func__, rw, owner);
@@ -973,9 +975,10 @@ __rw_wlock_hard(volatile uintptr_t *c, uintptr_t v LOC
KTR_STATE0(KTR_SCHED, "thread", sched_tdname(curthread),
"running");
continue;
-   }
-   if ((v & RW_LOCK_READ) && RW_READERS(v) &&
-   spintries < rowner_retries) {
+   } else if (RW_READERS(v) > 0) {
+   sleep_reason = READERS;
+   if (spintries == rowner_retries)
+   goto ts;
if (!(v & RW_LOCK_WRITE_SPINNER)) {
if (!atomic_fcmpset_ptr(&rw->rw_lock, &v,
v | RW_LOCK_WRITE_SPINNER)) {
@@ -993,15 +996,15 @@ __rw_wlock_hard(volatile uintptr_t *c, uintptr_t v LOC
if ((v & RW_LOCK_WRITE_SPINNER) == 0)
break;
}
-   KTR_STATE0(KTR_SCHED, "thread", sched_tdname(curthread),
-   "running");
 #ifdef KDTRACE_HOOKS
-   lda.spin_cnt += rowner_loops - i;
+   lda.spin_cnt += i;
 #endif
+   KTR_STATE0(KTR_SCHED, "thread", sched_tdname(curthread),
+   "running");
if (i < rowner_loops)
continue;
-   sleep_reason = 2;
}
+ts:
 #endif
ts = turnstile_trywait(&rw->lock_object);
v = RW_READ_VALUE(rw);
@@ -1021,7 +1024,7 @@ retry_ts:
turnstile_cancel(ts);
continue;
}
-   } else if (RW_READERS(v) > 0 && sleep_reason == 1) {
+   } else if (RW_READERS(v) > 0 && sleep_reason == WRITER) {
turnstile_cancel(ts);
continue;
}

Modified: head/sys/kern/kern_sx.c
==
--- head/sys/kern/kern_sx.c Sun Mar  4 21:15:31 2018(r330413)
+++ head/sys/kern/kern_sx.c Sun Mar  4 21:38:30 2018(r330414)
@@ -533,8 +533,8 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LO
 #ifdef ADAPTIVE_SX
volatile struct thread *owner;
u_int i, n, spintries = 0;
+   enum { READERS, WRITER } sleep_reason;
bool adaptive;
-   int sleep_reason = 0;
 #endif
 #ifdef LOCK_PROFILING
uint64_t waittime = 0;
@@ -628,37 +628,33 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LO
 * running or the state of the lock changes.
 */
if ((x & 

svn commit: r330415 - head/sys/kern

2018-03-04 Thread Mateusz Guzik
Author: mjg
Date: Sun Mar  4 21:41:05 2018
New Revision: 330415
URL: https://svnweb.freebsd.org/changeset/base/330415

Log:
  sx: don't do an atomic op in upgrade if it cananot succeed
  
  The code already pays the cost of reading the lock to obtain the waiters
  flag. Checking whether there is more than one reader is not a problem and
  avoids dirtying the line.
  
  This also fixes a small corner case: if waiters were to show up between
  reading the flag and upgrading the lock, the operation would fail even
  though it should not. No correctness change here though.

Modified:
  head/sys/kern/kern_sx.c

Modified: head/sys/kern/kern_sx.c
==
--- head/sys/kern/kern_sx.c Sun Mar  4 21:38:30 2018(r330414)
+++ head/sys/kern/kern_sx.c Sun Mar  4 21:41:05 2018(r330415)
@@ -413,6 +413,7 @@ int
 sx_try_upgrade_int(struct sx *sx LOCK_FILE_LINE_ARG_DEF)
 {
uintptr_t x;
+   uintptr_t waiters;
int success;
 
if (SCHEDULER_STOPPED())
@@ -427,9 +428,18 @@ sx_try_upgrade_int(struct sx *sx LOCK_FILE_LINE_ARG_DE
 * to maintain the SX_LOCK_EXCLUSIVE_WAITERS flag if set so that
 * we will wake up the exclusive waiters when we drop the lock.
 */
-   x = sx->sx_lock & SX_LOCK_EXCLUSIVE_WAITERS;
-   success = atomic_cmpset_acq_ptr(&sx->sx_lock, SX_SHARERS_LOCK(1) | x,
-   (uintptr_t)curthread | x);
+   success = 0;
+   x = SX_READ_VALUE(sx);
+   for (;;) {
+   if (SX_SHARERS(x) > 1)
+   break;
+   waiters = (x & SX_LOCK_EXCLUSIVE_WAITERS);
+   if (atomic_fcmpset_acq_ptr(&sx->sx_lock, &x,
+   (uintptr_t)curthread | waiters)) {
+   success = 1;
+   break;
+   }
+   }
LOCK_LOG_TRY("XUPGRADE", &sx->lock_object, 0, success, file, line);
if (success) {
WITNESS_UPGRADE(&sx->lock_object, LOP_EXCLUSIVE | LOP_TRYLOCK,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330416 - head/sys/dev/iicbus

2018-03-04 Thread Ian Lepore
Author: ian
Date: Sun Mar  4 21:58:32 2018
New Revision: 330416
URL: https://svnweb.freebsd.org/changeset/base/330416

Log:
  The year is stored in a single byte in sram, in binary format, as a count
  of years since the century, so strip the century out when converting to or
  from bcd_clocktime format (the conversion routines will infer century by
  pivoting on 70).

Modified:
  head/sys/dev/iicbus/rtc8583.c

Modified: head/sys/dev/iicbus/rtc8583.c
==
--- head/sys/dev/iicbus/rtc8583.c   Sun Mar  4 21:41:05 2018
(r330415)
+++ head/sys/dev/iicbus/rtc8583.c   Sun Mar  4 21:58:32 2018
(r330416)
@@ -237,7 +237,7 @@ rtc8583_gettime(device_t dev, struct timespec *ts)
bct.hour = tregs.hour & 0x3f;
bct.day  = tregs.day & 0x3f;
bct.mon  = tregs.month & 0x1f;
-   bct.year = (bin2bcd(sreg / 100) << 8) | bin2bcd(sreg % 100);
+   bct.year = bin2bcd(sreg % 100);
 
clock_dbgprint_bcd(sc->dev, CLOCK_DBG_READ, &bct); 
return (clock_bcd_to_ts(&bct, ts, false));
@@ -269,7 +269,7 @@ rtc8583_settime(device_t dev, struct timespec *ts)
return (err);
err = rtc8583_writeto(sc->dev, RTC8583_SC_REG, &tregs,
sizeof(tregs), IIC_WAIT);
-   sreg = bcd2bin(bct.year & 0xff) + 100 * bcd2bin(bct.year >> 8);
+   sreg = bcd2bin(bct.year & 0xff);
/* save to year to sram */
rtc8583_write1(sc, RTC8583_USERSRAM_REG, sreg);
iicbus_release_bus(sc->busdev, sc->dev);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330418 - head/sys/kern

2018-03-04 Thread Mateusz Guzik
Author: mjg
Date: Sun Mar  4 22:01:23 2018
New Revision: 330418
URL: https://svnweb.freebsd.org/changeset/base/330418

Log:
  mtx: tidy up recursion handling in thread lock
  
  Normally after grabbing the lock it has to be verified we got the right one
  to begin with. However, if we are recursing, it must not change thus the
  check can be avoided. In particular this avoids a lock read for non-recursing
  case which found out the lock was changed.
  
  While here avoid an irq trip of this happens.
  
  Tested by:pho (previous version)

Modified:
  head/sys/kern/kern_mutex.c

Modified: head/sys/kern/kern_mutex.c
==
--- head/sys/kern/kern_mutex.c  Sun Mar  4 21:58:55 2018(r330417)
+++ head/sys/kern/kern_mutex.c  Sun Mar  4 22:01:23 2018(r330418)
@@ -829,10 +829,8 @@ _thread_lock(struct thread *td)
WITNESS_LOCK(&m->lock_object, LOP_EXCLUSIVE, file, line);
return;
}
-   if (m->mtx_recurse != 0)
-   m->mtx_recurse--;
-   else
-   _mtx_release_lock_quick(m);
+   MPASS(m->mtx_recurse == 0);
+   _mtx_release_lock_quick(m);
 slowpath_unlocked:
spinlock_exit();
 slowpath_noirq:
@@ -886,9 +884,10 @@ thread_lock_flags_(struct thread *td, int opts, const 
if (__predict_false(doing_lockprof))
spin_time -= lockstat_nsecs(&td->td_lock->lock_object);
 #endif
+   spinlock_enter();
+
for (;;) {
 retry:
-   spinlock_enter();
m = td->td_lock;
thread_lock_validate(m, opts, file, line);
v = MTX_READ_VALUE(m);
@@ -900,6 +899,7 @@ retry:
}
if (v == tid) {
m->mtx_recurse++;
+   MPASS(m == td->td_lock);
break;
}
lock_profile_obtain_lock_failed(&m->lock_object,
@@ -912,15 +912,18 @@ retry:
} else {
_mtx_lock_indefinite_check(m, &lda);
}
-   if (m != td->td_lock)
+   if (m != td->td_lock) {
+   spinlock_enter();
goto retry;
+   }
v = MTX_READ_VALUE(m);
} while (v != MTX_UNOWNED);
spinlock_enter();
}
if (m == td->td_lock)
break;
-   __mtx_unlock_spin(m);   /* does spinlock_exit() */
+   MPASS(m->mtx_recurse == 0);
+   _mtx_release_lock_quick(m);
}
LOCK_LOG_LOCK("LOCK", &m->lock_object, opts, m->mtx_recurse, file,
line);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330419 - head/sys/kern

2018-03-04 Thread Mateusz Guzik
Author: mjg
Date: Sun Mar  4 22:14:20 2018
New Revision: 330419
URL: https://svnweb.freebsd.org/changeset/base/330419

Log:
  lockmgr: whack unused lockmgr_note_exclusive_upgrade

Modified:
  head/sys/kern/kern_lock.c

Modified: head/sys/kern/kern_lock.c
==
--- head/sys/kern/kern_lock.c   Sun Mar  4 22:01:23 2018(r330418)
+++ head/sys/kern/kern_lock.c   Sun Mar  4 22:14:20 2018(r330419)
@@ -234,18 +234,6 @@ lockmgr_note_exclusive_release(struct lock *lk, const 
TD_LOCKS_DEC(curthread);
 }
 
-static void
-lockmgr_note_exclusive_upgrade(struct lock *lk, const char *file, int line,
-int flags)
-{
-
-   LOCK_LOG_LOCK("XUPGRADE", &lk->lock_object, 0, 0, file,
-   line);
-   WITNESS_UPGRADE(&lk->lock_object, LOP_EXCLUSIVE |
-   LK_TRYWIT(flags), file, line);
-   TD_SLOCKS_DEC(curthread);
-}
-
 static __inline struct thread *
 lockmgr_xholder(const struct lock *lk)
 {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330430 - head/sys/dev/iicbus

2018-03-04 Thread Ian Lepore
Author: ian
Date: Sun Mar  4 23:39:40 2018
New Revision: 330430
URL: https://svnweb.freebsd.org/changeset/base/330430

Log:
  Switch to the new bcd_clocktime conversion routines, and add calls to the
  new clock_dbgprint_xxx() functions.

Modified:
  head/sys/dev/iicbus/isl12xx.c

Modified: head/sys/dev/iicbus/isl12xx.c
==
--- head/sys/dev/iicbus/isl12xx.c   Sun Mar  4 23:39:12 2018
(r330429)
+++ head/sys/dev/iicbus/isl12xx.c   Sun Mar  4 23:39:40 2018
(r330430)
@@ -233,7 +233,7 @@ static int
 isl12xx_gettime(device_t dev, struct timespec *ts)
 {
struct isl12xx_softc *sc = device_get_softc(dev);
-   struct clocktime ct;
+   struct bcd_clocktime bct;
struct time_regs tregs;
int err;
uint8_t hourmask, sreg;
@@ -263,29 +263,24 @@ isl12xx_gettime(device_t dev, struct timespec *ts)
hourmask = ISL12xx_12HR_MASK;
}
 
-   ct.nsec = 0;
-   ct.sec  = FROMBCD(tregs.sec);
-   ct.min  = FROMBCD(tregs.min);
-   ct.hour = FROMBCD(tregs.hour & hourmask);
-   ct.day  = FROMBCD(tregs.day);
-   ct.mon  = FROMBCD(tregs.month);
-   ct.year = FROMBCD(tregs.year);
+   bct.nsec = 0;
+   bct.sec  = tregs.sec;
+   bct.min  = tregs.min;
+   bct.hour = tregs.hour & hourmask;
+   bct.day  = tregs.day;
+   bct.mon  = tregs.month;
+   bct.year = tregs.year;
+   bct.ispm = tregs.hour & ISL12XX_PM_FLAG;
 
-   if (sc->use_ampm) {
-   if (ct.hour == 12)
-   ct.hour = 0;
-   if (tregs.hour & ISL12XX_PM_FLAG)
-   ct.hour += 12;
-   }
-
-   return (clock_ct_to_ts(&ct, ts));
+   clock_dbgprint_bcd(sc->dev, CLOCK_DBG_READ, &bct); 
+   return (clock_bcd_to_ts(&bct, ts, sc->use_ampm));
 }
 
 static int
 isl12xx_settime(device_t dev, struct timespec *ts)
 {
struct isl12xx_softc *sc = device_get_softc(dev);
-   struct clocktime ct;
+   struct bcd_clocktime bct;
struct time_regs tregs;
int err;
uint8_t ampmflags, sreg;
@@ -296,27 +291,21 @@ isl12xx_settime(device_t dev, struct timespec *ts)
 */
ts->tv_sec -= utc_offset();
ts->tv_nsec = 0;
-   clock_ts_to_ct(ts, &ct);
+   clock_ts_to_bcd(ts, &bct, sc->use_ampm);
+   clock_dbgprint_bcd(sc->dev, CLOCK_DBG_WRITE, &bct); 
 
-   /* If the chip is in AM/PM mode, adjust hour and set flags as needed. */
-   if (!sc->use_ampm) {
+   /* If the chip is in AM/PM mode, set flags as needed. */
+   if (!sc->use_ampm)
ampmflags = ISL12XX_24HR_FLAG;
-   } else {
-   ampmflags = 0;
-   if (ct.hour >= 12) {
-   ct.hour -= 12;
-   ampmflags |= ISL12XX_PM_FLAG;
-   }
-   if (ct.hour == 0)
-   ct.hour = 12;
-   }
+   else
+   ampmflags = bct.ispm ? ISL12XX_PM_FLAG : 0;
 
-   tregs.sec   = TOBCD(ct.sec);
-   tregs.min   = TOBCD(ct.min);
-   tregs.hour  = TOBCD(ct.hour) | ampmflags;
-   tregs.day   = TOBCD(ct.day);
-   tregs.month = TOBCD(ct.mon);
-   tregs.year  = TOBCD(ct.year % 100);
+   tregs.sec   = bct.sec;
+   tregs.min   = bct.min;
+   tregs.hour  = bct.hour | ampmflags;
+   tregs.day   = bct.day;
+   tregs.month = bct.mon;
+   tregs.year  = bct.year % 100;
 
/*
 * To set the time we have to set the WRTC enable bit in the control
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r330384 - in head: contrib/llvm/lib/Target/AArch64 contrib/llvm/lib/Target/X86 contrib/llvm/tools/clang/include/clang/Basic contrib/llvm/tools/clang/lib/Basic lib/clang lib/clang/inclu

2018-03-04 Thread Bryan Drewery
On 3/4/2018 9:06 AM, Dimitry Andric wrote:
> Modified: head/lib/clang/include/lld/Common/Version.inc
> ==
> --- head/lib/clang/include/lld/Common/Version.inc Sun Mar  4 15:07:23 
> 2018(r330383)
> +++ head/lib/clang/include/lld/Common/Version.inc Sun Mar  4 17:06:37 
> 2018(r330384)
> @@ -4,5 +4,5 @@
>  #define LLD_VERSION_STRING "6.0.0"
>  #define LLD_VERSION_MAJOR 6
>  #define LLD_VERSION_MINOR 0
> -#define LLD_REVISION_STRING "325932"
> +#define LLD_REVISION_STRING "326565"
>  #define LLD_REPOSITORY_STRING "FreeBSD"
> 
> Modified: head/lib/clang/include/llvm/Support/VCSRevision.h
> ==
> --- head/lib/clang/include/llvm/Support/VCSRevision.h Sun Mar  4 15:07:23 
> 2018(r330383)
> +++ head/lib/clang/include/llvm/Support/VCSRevision.h Sun Mar  4 17:06:37 
> 2018(r330384)
> @@ -1,2 +1,2 @@
>  /* $FreeBSD$ */
> -#define LLVM_REVISION "svn-r325932"
> +#define LLVM_REVISION "svn-r326565"

Thanks for handling these. I need to finish my WITH_SYSTEM_LINKER patch.

-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


svn commit: r330431 - head/sys/dev/iicbus

2018-03-04 Thread Ian Lepore
Author: ian
Date: Mon Mar  5 00:15:56 2018
New Revision: 330431
URL: https://svnweb.freebsd.org/changeset/base/330431

Log:
  Switch to the new bcd_clocktime conversion routines, and add calls to the
  new clock_dbgprint_xxx() functions.

Modified:
  head/sys/dev/iicbus/ds3231.c

Modified: head/sys/dev/iicbus/ds3231.c
==
--- head/sys/dev/iicbus/ds3231.cSun Mar  4 23:39:40 2018
(r330430)
+++ head/sys/dev/iicbus/ds3231.cMon Mar  5 00:15:56 2018
(r330431)
@@ -377,7 +377,7 @@ ds3231_attach(device_t dev)
sc->sc_dev = dev;
sc->sc_addr = iicbus_get_addr(dev);
sc->sc_last_c = -1;
-   sc->sc_year0 = 1900;
+   sc->sc_year0 = 0;
sc->enum_hook.ich_func = ds3231_start;
sc->enum_hook.ich_arg = dev;
 
@@ -477,7 +477,7 @@ static int
 ds3231_gettime(device_t dev, struct timespec *ts)
 {
int c, error;
-   struct clocktime ct;
+   struct bcd_clocktime bct;
struct ds3231_softc *sc;
uint8_t data[7], hourmask;
 
@@ -505,13 +505,14 @@ ds3231_gettime(device_t dev, struct timespec *ts)
} else
hourmask = DS3231_HOUR_MASK_24HR;
 
-   ct.nsec = 0;
-   ct.sec  = FROMBCD(data[DS3231_SECS]  & DS3231_SECS_MASK);
-   ct.min  = FROMBCD(data[DS3231_MINS]  & DS3231_MINS_MASK);
-   ct.hour = FROMBCD(data[DS3231_HOUR]  & hourmask);
-   ct.day  = FROMBCD(data[DS3231_DATE]  & DS3231_DATE_MASK);
-   ct.mon  = FROMBCD(data[DS3231_MONTH] & DS3231_MONTH_MASK);
-   ct.year = FROMBCD(data[DS3231_YEAR]  & DS3231_YEAR_MASK);
+   bct.nsec = 0;
+   bct.sec  = data[DS3231_SECS]  & DS3231_SECS_MASK;
+   bct.min  = data[DS3231_MINS]  & DS3231_MINS_MASK;
+   bct.hour = data[DS3231_HOUR]  & hourmask;
+   bct.day  = data[DS3231_DATE]  & DS3231_DATE_MASK;
+   bct.mon  = data[DS3231_MONTH] & DS3231_MONTH_MASK;
+   bct.year = data[DS3231_YEAR]  & DS3231_YEAR_MASK;
+   bct.ispm = data[DS3231_HOUR]  & DS3231_HOUR_IS_PM;
 
/*
 * If the century flag has toggled since we last saw it, there has been
@@ -522,29 +523,20 @@ ds3231_gettime(device_t dev, struct timespec *ts)
if (sc->sc_last_c == -1)
sc->sc_last_c = c;
else if (c != sc->sc_last_c) {
-   sc->sc_year0 += 100;
+   sc->sc_year0 += 0x100;
sc->sc_last_c = c;
}
-   ct.year += sc->sc_year0;
-   if (ct.year < POSIX_BASE_YEAR)
-   ct.year += 100; /* assume [1970, 2069] */
+   bct.year |= sc->sc_year0;
 
-   /* If running in AM/PM mode, deal with it. */
-   if (sc->sc_use_ampm) {
-   if (ct.hour == 12)
-   ct.hour = 0;
-   if (data[DS3231_HOUR] & DS3231_HOUR_IS_PM)
-   ct.hour += 12;
-   }
-
-   return (clock_ct_to_ts(&ct, ts));
+   clock_dbgprint_bcd(sc->sc_dev, CLOCK_DBG_READ, &bct); 
+   return (clock_bcd_to_ts(&bct, ts, sc->sc_use_ampm));
 }
 
 static int
 ds3231_settime(device_t dev, struct timespec *ts)
 {
int error;
-   struct clocktime ct;
+   struct bcd_clocktime bct;
struct ds3231_softc *sc;
uint8_t data[7];
uint8_t pmflags;
@@ -556,27 +548,24 @@ ds3231_settime(device_t dev, struct timespec *ts)
 * disables utc adjustment, so apply that ourselves.
 */
ts->tv_sec -= utc_offset();
-   clock_ts_to_ct(ts, &ct);
+   clock_ts_to_bcd(ts, &bct, sc->sc_use_ampm);
+   clock_dbgprint_bcd(sc->sc_dev, CLOCK_DBG_WRITE, &bct); 
 
/* If the chip is in AM/PM mode, adjust hour and set flags as needed. */
if (sc->sc_use_ampm) {
pmflags = DS3231_HOUR_USE_AMPM;
-   if (ct.hour >= 12) {
-   ct.hour -= 12;
+   if (bct.ispm)
pmflags |= DS3231_HOUR_IS_PM;
-   }
-   if (ct.hour == 0)
-   ct.hour = 12;
} else
pmflags = 0;
 
-   data[DS3231_SECS]= TOBCD(ct.sec);
-   data[DS3231_MINS]= TOBCD(ct.min);
-   data[DS3231_HOUR]= TOBCD(ct.hour) | pmflags;
-   data[DS3231_DATE]= TOBCD(ct.day);
-   data[DS3231_WEEKDAY] = ct.dow + 1;
-   data[DS3231_MONTH]   = TOBCD(ct.mon);
-   data[DS3231_YEAR]= TOBCD(ct.year % 100);
+   data[DS3231_SECS]= bct.sec;
+   data[DS3231_MINS]= bct.min;
+   data[DS3231_HOUR]= bct.hour | pmflags;
+   data[DS3231_DATE]= bct.day;
+   data[DS3231_WEEKDAY] = bct.dow + 1;
+   data[DS3231_MONTH]   = bct.mon;
+   data[DS3231_YEAR]= bct.year & 0xff;
if (sc->sc_last_c)
data[DS3231_MONTH] |= DS3231_C_MASK;
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr.

svn commit: r330432 - head/sys/kern

2018-03-04 Thread Mateusz Guzik
Author: mjg
Date: Mon Mar  5 00:30:07 2018
New Revision: 330432
URL: https://svnweb.freebsd.org/changeset/base/330432

Log:
  lockmgr: save on sleepq when cmpset fails

Modified:
  head/sys/kern/kern_lock.c

Modified: head/sys/kern/kern_lock.c
==
--- head/sys/kern/kern_lock.c   Mon Mar  5 00:15:56 2018(r330431)
+++ head/sys/kern/kern_lock.c   Mon Mar  5 00:30:07 2018(r330432)
@@ -296,7 +296,7 @@ sleeplk(struct lock *lk, u_int flags, struct lock_obje
 static __inline int
 wakeupshlk(struct lock *lk, const char *file, int line)
 {
-   uintptr_t v, x;
+   uintptr_t v, x, orig_x;
u_int realexslp;
int queue, wakeup_swapper;
 
@@ -311,7 +311,9 @@ wakeupshlk(struct lock *lk, const char *file, int line
 * path in order to handle wakeups correctly.
 */
sleepq_lock(&lk->lock_object);
-   x = lk->lk_lock & (LK_ALL_WAITERS | LK_EXCLUSIVE_SPINNERS);
+   orig_x = lk->lk_lock;
+retry_sleepq:
+   x = orig_x & (LK_ALL_WAITERS | LK_EXCLUSIVE_SPINNERS);
v = LK_UNLOCKED;
 
/*
@@ -360,11 +362,16 @@ wakeupshlk(struct lock *lk, const char *file, int line
queue = SQ_SHARED_QUEUE;
}
 
-   if (!atomic_cmpset_rel_ptr(&lk->lk_lock, LK_SHARERS_LOCK(1) | x,
-   v)) {
+   if (lockmgr_sunlock_try(lk, &orig_x)) {
sleepq_release(&lk->lock_object);
-   continue;
+   break;
}
+
+   x |= LK_SHARERS_LOCK(1);
+   if (!atomic_fcmpset_rel_ptr(&lk->lk_lock, &x, v)) {
+   orig_x = x;
+   goto retry_sleepq;
+   }
LOCK_LOG3(lk, "%s: %p waking up threads on the %s queue",
__func__, lk, queue == SQ_SHARED_QUEUE ? "shared" :
"exclusive");
@@ -602,6 +609,7 @@ lockmgr_slock_hard(struct lock *lk, u_int flags, struc
 */
sleepq_lock(&lk->lock_object);
x = lk->lk_lock;
+retry_sleepq:
 
/*
 * if the lock can be acquired in shared mode, try
@@ -617,10 +625,9 @@ lockmgr_slock_hard(struct lock *lk, u_int flags, struc
 * loop back and retry.
 */
if ((x & LK_SHARED_WAITERS) == 0) {
-   if (!atomic_cmpset_acq_ptr(&lk->lk_lock, x,
+   if (!atomic_fcmpset_acq_ptr(&lk->lk_lock, &x,
x | LK_SHARED_WAITERS)) {
-   sleepq_release(&lk->lock_object);
-   continue;
+   goto retry_sleepq;
}
LOCK_LOG2(lk, "%s: %p set shared waiters flag",
__func__, lk);
@@ -755,6 +762,7 @@ lockmgr_xlock_hard(struct lock *lk, u_int flags, struc
 */
sleepq_lock(&lk->lock_object);
x = lk->lk_lock;
+retry_sleepq:
 
/*
 * if the lock has been released while we spun on
@@ -777,7 +785,7 @@ lockmgr_xlock_hard(struct lock *lk, u_int flags, struc
v = x & (LK_ALL_WAITERS | LK_EXCLUSIVE_SPINNERS);
if ((x & ~v) == LK_UNLOCKED) {
v &= ~LK_EXCLUSIVE_SPINNERS;
-   if (atomic_cmpset_acq_ptr(&lk->lk_lock, x,
+   if (atomic_fcmpset_acq_ptr(&lk->lk_lock, &x,
tid | v)) {
sleepq_release(&lk->lock_object);
LOCK_LOG2(lk,
@@ -785,8 +793,7 @@ lockmgr_xlock_hard(struct lock *lk, u_int flags, struc
__func__, lk);
break;
}
-   sleepq_release(&lk->lock_object);
-   continue;
+   goto retry_sleepq;
}
 
/*
@@ -794,10 +801,9 @@ lockmgr_xlock_hard(struct lock *lk, u_int flags, struc
 * fail, loop back and retry.
 */
if ((x & LK_EXCLUSIVE_WAITERS) == 0) {
-   if (!atomic_cmpset_ptr(&lk->lk_lock, x,
+   if (!atomic_fcmpset_ptr(&lk->lk_lock, &x,
x | LK_EXCLUSIVE_WAITERS)) {
-   sleepq_release(&lk->lock_object);
-   continue;
+   goto retry_sleepq;
}
LOCK_LOG2(lk, "%s: %p set excl waiters flag",
__func__, lk);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To un

svn commit: r330433 - head/sys/dev/iicbus

2018-03-04 Thread Ian Lepore
Author: ian
Date: Mon Mar  5 00:43:53 2018
New Revision: 330433
URL: https://svnweb.freebsd.org/changeset/base/330433

Log:
  Switch to the new bcd_clocktime conversion routines, and add calls to the
  new clock_dbgprint_xxx() functions.

Modified:
  head/sys/dev/iicbus/s35390a.c

Modified: head/sys/dev/iicbus/s35390a.c
==
--- head/sys/dev/iicbus/s35390a.c   Mon Mar  5 00:30:07 2018
(r330432)
+++ head/sys/dev/iicbus/s35390a.c   Mon Mar  5 00:43:53 2018
(r330433)
@@ -297,7 +297,7 @@ static int
 s390rtc_gettime(device_t dev, struct timespec *ts)
 {
uint8_t bcd[S390_RT1_NBYTES];
-   struct clocktime ct;
+   struct bcd_clocktime bct;
int error;
 
error = s390rtc_read(dev, S390_REALTIME1, bcd, S390_RT1_NBYTES);
@@ -310,37 +310,39 @@ s390rtc_gettime(device_t dev, struct timespec *ts)
/*
 * Convert the register values into something useable.
 */
-   ct.nsec = 0;
-   ct.sec = FROMBCD(bcd[S390_RT1_SECOND]);
-   ct.min = FROMBCD(bcd[S390_RT1_MINUTE]);
-   ct.hour = FROMBCD(bcd[S390_RT1_HOUR] & 0x3f);
-   ct.day = FROMBCD(bcd[S390_RT1_DAY]);
-   ct.dow = bcd[S390_RT1_WDAY] & 0x07;
-   ct.mon = FROMBCD(bcd[S390_RT1_MONTH]);
-   ct.year = FROMBCD(bcd[S390_RT1_YEAR]) + 2000;
+   bct.nsec = 0;
+   bct.sec  = bcd[S390_RT1_SECOND];
+   bct.min  = bcd[S390_RT1_MINUTE];
+   bct.hour = bcd[S390_RT1_HOUR] & 0x3f;
+   bct.day  = bcd[S390_RT1_DAY];
+   bct.dow  = bcd[S390_RT1_WDAY] & 0x07;
+   bct.mon  = bcd[S390_RT1_MONTH];
+   bct.year = bcd[S390_RT1_YEAR];
 
-   return (clock_ct_to_ts(&ct, ts));
+   clock_dbgprint_bcd(dev, CLOCK_DBG_READ, &bct); 
+   return (clock_bcd_to_ts(&bct, ts, false));
 }
 
 static int
 s390rtc_settime(device_t dev, struct timespec *ts)
 {
uint8_t bcd[S390_RT1_NBYTES];
-   struct clocktime ct;
+   struct bcd_clocktime bct;
 
-   clock_ts_to_ct(ts, &ct);
+   clock_ts_to_bcd(ts, &bct, false);
+   clock_dbgprint_bcd(dev, CLOCK_DBG_WRITE, &bct); 
 
/*
 * Convert our time representation into something the S-xx390
 * can understand.
 */
-   bcd[S390_RT1_SECOND] = TOBCD(ct.sec);
-   bcd[S390_RT1_MINUTE] = TOBCD(ct.min);
-   bcd[S390_RT1_HOUR] = TOBCD(ct.hour);
-   bcd[S390_RT1_DAY] = TOBCD(ct.day);
-   bcd[S390_RT1_WDAY] = ct.dow;
-   bcd[S390_RT1_MONTH] = TOBCD(ct.mon);
-   bcd[S390_RT1_YEAR] = TOBCD(ct.year % 100);
+   bcd[S390_RT1_SECOND] = bct.sec;
+   bcd[S390_RT1_MINUTE] = bct.min;
+   bcd[S390_RT1_HOUR]   = bct.hour;
+   bcd[S390_RT1_DAY]= bct.day;
+   bcd[S390_RT1_WDAY]   = bct.dow;
+   bcd[S390_RT1_MONTH]  = bct.mon;
+   bcd[S390_RT1_YEAR]   = bct.year & 0xff;
 
return (s390rtc_write(dev, S390_REALTIME1, bcd, S390_RT1_NBYTES));
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330434 - head/stand/lua

2018-03-04 Thread Kyle Evans
Author: kevans
Date: Mon Mar  5 00:59:55 2018
New Revision: 330434
URL: https://svnweb.freebsd.org/changeset/base/330434

Log:
  lualoader: Add note about importance of including the cli module early

Modified:
  head/stand/lua/loader.lua

Modified: head/stand/lua/loader.lua
==
--- head/stand/lua/loader.lua   Mon Mar  5 00:43:53 2018(r330433)
+++ head/stand/lua/loader.lua   Mon Mar  5 00:59:55 2018(r330434)
@@ -29,6 +29,10 @@
 -- $FreeBSD$
 --
 
+-- The cli module should be included first here. Some of the functions that it
+-- defines are necessary for the Lua-based loader to operate in general.
+-- Other modules will also need some of the functions it defines to safely
+-- execute loader commands.
 require("cli")
 local core = require("core")
 local config = require("config")
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330435 - head/stand/lua

2018-03-04 Thread Kyle Evans
Author: kevans
Date: Mon Mar  5 01:18:32 2018
New Revision: 330435
URL: https://svnweb.freebsd.org/changeset/base/330435

Log:
  lualoader: Use FILESDIR instead of BINDIR
  
  Minor nit: We're not installing binaries, we're installing scripts/files
  that are documented to be installed based on FILESDIR.

Modified:
  head/stand/lua/Makefile

Modified: head/stand/lua/Makefile
==
--- head/stand/lua/Makefile Mon Mar  5 00:59:55 2018(r330434)
+++ head/stand/lua/Makefile Mon Mar  5 01:18:32 2018(r330435)
@@ -2,7 +2,7 @@
 
 .include 
 
-BINDIR=/boot/lua
+FILESDIR=  /boot/lua
 FILES= cli.lua \
color.lua \
config.lua \
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330436 - head/bin/chflags

2018-03-04 Thread Bryan Drewery
Author: bdrewery
Date: Mon Mar  5 01:56:07 2018
New Revision: 330436
URL: https://svnweb.freebsd.org/changeset/base/330436

Log:
  chflags: Add -x option to not traverse mount points.
  
  MFC after:2 weeks

Modified:
  head/bin/chflags/chflags.1
  head/bin/chflags/chflags.c

Modified: head/bin/chflags/chflags.1
==
--- head/bin/chflags/chflags.1  Mon Mar  5 01:18:32 2018(r330435)
+++ head/bin/chflags/chflags.1  Mon Mar  5 01:56:07 2018(r330436)
@@ -32,7 +32,7 @@
 .\"@(#)chflags.1   8.4 (Berkeley) 5/2/95
 .\" $FreeBSD$
 .\"
-.Dd April 20, 2015
+.Dd March 4, 2018
 .Dt CHFLAGS 1
 .Os
 .Sh NAME
@@ -40,7 +40,7 @@
 .Nd change file flags
 .Sh SYNOPSIS
 .Nm
-.Op Fl fhv
+.Op Fl fhvx
 .Oo
 .Fl R
 .Op Fl H | Fl L | Fl P
@@ -98,6 +98,8 @@ If the
 .Fl v
 option is specified more than once, the old and new flags of the file
 will also be printed, in octal notation.
+.It Fl x
+Do not cross mount points.
 .El
 .Pp
 The flags are specified as an octal number or a comma separated list

Modified: head/bin/chflags/chflags.c
==
--- head/bin/chflags/chflags.c  Mon Mar  5 01:18:32 2018(r330435)
+++ head/bin/chflags/chflags.c  Mon Mar  5 01:56:07 2018(r330436)
@@ -65,12 +65,12 @@ main(int argc, char *argv[])
FTSENT *p;
u_long clear, newflags, set;
long val;
-   int Hflag, Lflag, Rflag, fflag, hflag, vflag;
+   int Hflag, Lflag, Rflag, fflag, hflag, vflag, xflag;
int ch, fts_options, oct, rval;
char *flags, *ep;
 
-   Hflag = Lflag = Rflag = fflag = hflag = vflag = 0;
-   while ((ch = getopt(argc, argv, "HLPRfhv")) != -1)
+   Hflag = Lflag = Rflag = fflag = hflag = vflag = xflag = 0;
+   while ((ch = getopt(argc, argv, "HLPRfhvx")) != -1)
switch (ch) {
case 'H':
Hflag = 1;
@@ -95,6 +95,9 @@ main(int argc, char *argv[])
case 'v':
vflag++;
break;
+   case 'x':
+   xflag = 1;
+   break;
case '?':
default:
usage();
@@ -123,6 +126,8 @@ main(int argc, char *argv[])
} else {
fts_options = FTS_LOGICAL;
}
+   if (xflag)
+   fts_options |= FTS_XDEV;
 
flags = *argv;
if (*flags >= '0' && *flags <= '7') {
@@ -201,6 +206,6 @@ static void
 usage(void)
 {
(void)fprintf(stderr,
-   "usage: chflags [-fhv] [-R [-H | -L | -P]] flags file ...\n");
+   "usage: chflags [-fhvx] [-R [-H | -L | -P]] flags file ...\n");
exit(1);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2018-03-04 Thread Ian Lepore
Author: ian
Date: Mon Mar  5 02:08:33 2018
New Revision: 330437
URL: https://svnweb.freebsd.org/changeset/base/330437

Log:
  Do not stop the loop that configures gpio chipselect pins on the first
  error, just ignore pins that don't configure and keep setting up the ones
  that do.  (But when bootverbose is on, whine about the errors.)

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

Modified: head/sys/arm/freescale/imx/imx_spi.c
==
--- head/sys/arm/freescale/imx/imx_spi.cMon Mar  5 01:56:07 2018
(r330436)
+++ head/sys/arm/freescale/imx/imx_spi.cMon Mar  5 02:08:33 2018
(r330437)
@@ -541,7 +541,7 @@ spi_attach(device_t dev)
 
/* Allocate gpio pins for configured chip selects. */
node = ofw_bus_get_node(sc->dev);
-   for (err = 0, idx = 0; err == 0 && idx < nitems(sc->cspins); ++idx) {
+   for (idx = 0; idx < nitems(sc->cspins); ++idx) {
err = gpio_pin_get_by_ofw_propidx(sc->dev, node, "cs-gpios",
idx, &sc->cspins[idx]);
if (err == 0) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r330436 - head/bin/chflags

2018-03-04 Thread Ian Lepore
On Mon, 2018-03-05 at 01:56 +, Bryan Drewery wrote:
> Author: bdrewery
> Date: Mon Mar  5 01:56:07 2018
> New Revision: 330436
> URL: https://svnweb.freebsd.org/changeset/base/330436
> 
> Log:
>   chflags: Add -x option to not traverse mount points.

Yay!  One day later than I needed it, but still, yay!

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


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

2018-03-04 Thread Ian Lepore
Author: ian
Date: Mon Mar  5 02:13:28 2018
New Revision: 330438
URL: https://svnweb.freebsd.org/changeset/base/330438

Log:
  Defer attaching the spibus until timers and interrupts are working.  The
  driver requires interrupts to do transfers, and the drivers for the SPI
  devices on the bus quite reasonably expect to be able to do IO while probing
  and attaching.

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

Modified: head/sys/arm/freescale/imx/imx_spi.c
==
--- head/sys/arm/freescale/imx/imx_spi.cMon Mar  5 02:08:33 2018
(r330437)
+++ head/sys/arm/freescale/imx/imx_spi.cMon Mar  5 02:13:28 2018
(r330438)
@@ -558,9 +558,16 @@ spi_attach(device_t dev)
 */
WR4(sc, ECSPI_CTLREG, CTLREG_CMODES_MASTER);
 
-   /* Attach the bus driver. */
+   /*
+* Add the spibus driver as a child, and setup a one-shot intrhook to
+* attach it after interrupts are working.  It will attach actual SPI
+* devices as its children, and those devices may need to do IO during
+* their attach. We can't do IO until timers and interrupts are working.
+*/
sc->spibus = device_add_child(dev, "spibus", -1);
-   return (bus_generic_attach(sc->dev));
+   config_intrhook_oneshot((ich_func_t)bus_generic_attach, dev);
+
+   return (0);
 }
 
 static int
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330439 - in head/sys: amd64/vmm/amd contrib/dev/acpica/include

2018-03-04 Thread Anish Gupta
Author: anish
Date: Mon Mar  5 02:28:25 2018
New Revision: 330439
URL: https://svnweb.freebsd.org/changeset/base/330439

Log:
  Move the new AMD-Vi IVHD [ACPI_IVRS_HARDWARE_NEW]definitions added in r329360 
in contrib ACPI to local files till ACPI code adds new definitions reported by 
jkim.
  Rename ACPI_IVRS_HARDWARE_NEW to ACPI_IVRS_HARDWARE_EFRSUP, since new 
definitions add Extended Feature Register support.  Use IvrsType to distinguish 
three types of IVHD - 0x10(legacy), 0x11 and 0x40(with EFR). IVHD 0x40 is also 
called mixed type since it supports HID device entries.
  Fix 2 coverity bugs reported by cem.
  
  Reported by:jkim, cem
  Approved by:grehan
  Differential Revision://reviews.freebsd.org/D14501

Modified:
  head/sys/amd64/vmm/amd/amdvi_priv.h
  head/sys/amd64/vmm/amd/ivrs_drv.c
  head/sys/contrib/dev/acpica/include/actbl2.h

Modified: head/sys/amd64/vmm/amd/amdvi_priv.h
==
--- head/sys/amd64/vmm/amd/amdvi_priv.h Mon Mar  5 02:13:28 2018
(r330438)
+++ head/sys/amd64/vmm/amd/amdvi_priv.h Mon Mar  5 02:28:25 2018
(r330439)
@@ -355,12 +355,43 @@ struct amdvi_domain {
 };
 
 /*
+ * I/O Virtualization Hardware Definition Block (IVHD) type 0x10 (legacy)
+ * uses ACPI_IVRS_HARDWARE define in contrib/dev/acpica/include/actbl2.h
+ * New IVHD types 0x11 and 0x40 as defined in AMD IOMMU spec[48882] are 
missing in
+ * ACPI code. These new types add extra field EFR(Extended Feature Register).
+ * XXX : Use definition from ACPI when it is available.
+ */
+typedef struct acpi_ivrs_hardware_efr_sup
+{
+   ACPI_IVRS_HEADER Header;
+   UINT16 CapabilityOffset;   /* Offset for IOMMU control fields */
+   UINT64 BaseAddress;/* IOMMU control registers */
+   UINT16 PciSegmentGroup;
+   UINT16 Info;   /* MSI number and unit ID */
+   UINT32 Attr;   /* IOMMU Feature */
+   UINT64 ExtFR;  /* IOMMU Extended Feature */
+   UINT64 Reserved;   /* v1 feature or v2 attribute */
+} __attribute__ ((__packed__)) ACPI_IVRS_HARDWARE_EFRSUP;
+CTASSERT(sizeof(ACPI_IVRS_HARDWARE_EFRSUP) == 40);
+
+/*
+ * Different type of IVHD.
+ * XXX: Use AcpiIvrsType once new IVHD types are available.
+*/
+enum IvrsType
+{
+   IVRS_TYPE_HARDWARE_LEGACY = 0x10, /* Legacy without EFRi support. */
+   IVRS_TYPE_HARDWARE_EFR= 0x11, /* With EFR support. */
+   IVRS_TYPE_HARDWARE_MIXED  = 0x40, /* Mixed with EFR support. */
+};
+
+/*
  * AMD IOMMU softc.
  */
 struct amdvi_softc {
struct amdvi_ctrl *ctrl;/* Control area. */
device_tdev;/* IOMMU device. */
-   enum AcpiIvrsType ivhd_type;/* IOMMU IVHD type 0x10/0x11 or 0x40 */
+   enum IvrsType   ivhd_type;  /* IOMMU IVHD type. */
booliotlb;  /* IOTLB supported by IOMMU */
struct amdvi_cmd *cmd;  /* Command descriptor area. */
int cmd_max;/* Max number of commands. */

Modified: head/sys/amd64/vmm/amd/ivrs_drv.c
==
--- head/sys/amd64/vmm/amd/ivrs_drv.c   Mon Mar  5 02:13:28 2018
(r330438)
+++ head/sys/amd64/vmm/amd/ivrs_drv.c   Mon Mar  5 02:28:25 2018
(r330439)
@@ -86,9 +86,9 @@ ivrs_hdr_iterate_tbl(ivhd_iter_t iter, void *arg)
}
 
switch (ivrs_hdr->Type) {
-   case ACPI_IVRS_TYPE_HARDWARE:   /* Legacy */
-   case 0x11:
-   case 0x40:  /* ACPI HID */
+   case IVRS_TYPE_HARDWARE_LEGACY: /* Legacy */
+   case IVRS_TYPE_HARDWARE_EFR:
+   case IVRS_TYPE_HARDWARE_MIXED:
if (!iter(ivrs_hdr, arg))
return;
break;
@@ -116,9 +116,9 @@ ivrs_is_ivhd(UINT8 type)
 {
 
switch(type) {
-   case ACPI_IVRS_TYPE_HARDWARE:
-   case ACPI_IVRS_TYPE_HARDWARE_EXT1:
-   case ACPI_IVRS_TYPE_HARDWARE_EXT2:
+   case IVRS_TYPE_HARDWARE_LEGACY:
+   case IVRS_TYPE_HARDWARE_EFR:
+   case IVRS_TYPE_HARDWARE_MIXED:
return (true);
 
default:
@@ -206,17 +206,13 @@ ivhd_dev_parse(ACPI_IVRS_HARDWARE* ivhd, struct amdvi_
softc->end_dev_rid = 0;
 
switch (ivhd->Header.Type) {
-   case ACPI_IVRS_TYPE_HARDWARE_EXT1:
-   case ACPI_IVRS_TYPE_HARDWARE_EXT2:
-   p = (uint8_t *)ivhd + sizeof(ACPI_IVRS_HARDWARE_NEW);
-   de = (ACPI_IVRS_DE_HEADER *) ((uint8_t *)ivhd +
-   sizeof(ACPI_IVRS_HARDWARE_NEW));
+   case IVRS_TYPE_HARDWARE_LEGACY:
+   p = (uint8_t *)ivhd + sizeof(ACPI_IVRS_HARDWARE);
break;
 
-   case ACPI_IVRS_TYPE_HARDWARE:
-   p = (uint8_t *)ivhd + sizeof(ACPI_IVRS_HARDWARE);

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

2018-03-04 Thread Ian Lepore
Author: ian
Date: Mon Mar  5 02:32:23 2018
New Revision: 330440
URL: https://svnweb.freebsd.org/changeset/base/330440

Log:
  Switch imx_gpio to attach at BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE.
  Pretty much any other device might need to manipulate a gpio pin during its
  probe or attach routines, so these devices must be available as early as
  possible.
  
  The gpio device is an interrupt controller, but I didn't choose the
  INTERRUPT pass for that reason (it works fine as an interrupt controller as
  long as it attaches any time before interrupts are enabled).  That just
  looked like the right place in the passes to ensure that it attaches before
  any type of device that might need gpio pin manipulations.

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

Modified: head/sys/arm/freescale/imx/imx_gpio.c
==
--- head/sys/arm/freescale/imx/imx_gpio.c   Mon Mar  5 02:28:25 2018
(r330439)
+++ head/sys/arm/freescale/imx/imx_gpio.c   Mon Mar  5 02:32:23 2018
(r330440)
@@ -868,5 +868,5 @@ static driver_t imx51_gpio_driver = {
 };
 static devclass_t imx51_gpio_devclass;
 
-DRIVER_MODULE(imx51_gpio, simplebus, imx51_gpio_driver, imx51_gpio_devclass,
-0, 0);
+EARLY_DRIVER_MODULE(imx51_gpio, simplebus, imx51_gpio_driver,
+imx51_gpio_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330441 - head/usr.sbin/rpcbind

2018-03-04 Thread Hiroki Sato
Author: hrs
Date: Mon Mar  5 03:34:01 2018
New Revision: 330441
URL: https://svnweb.freebsd.org/changeset/base/330441

Log:
  Partially back out changes in r327464.  stdlib.h is used when
  RPCBIND_DEBUG is enabled.

Modified:
  head/usr.sbin/rpcbind/rpcb_svc.c

Modified: head/usr.sbin/rpcbind/rpcb_svc.c
==
--- head/usr.sbin/rpcbind/rpcb_svc.cMon Mar  5 02:32:23 2018
(r330440)
+++ head/usr.sbin/rpcbind/rpcb_svc.cMon Mar  5 03:34:01 2018
(r330441)
@@ -48,6 +48,9 @@
 #include 
 #include 
 #include 
+#ifdef RPCBIND_DEBUG
+#include 
+#endif
 #include 
 
 #include "rpcbind.h"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r330442 - head/usr.sbin/rpcbind

2018-03-04 Thread Hiroki Sato
Author: hrs
Date: Mon Mar  5 03:38:31 2018
New Revision: 330442
URL: https://svnweb.freebsd.org/changeset/base/330442

Log:
  - Remove extra NULL check before free().
  - Fix null pointer dereference in netbuffree() and use netbuffree()
where applicable.

Modified:
  head/usr.sbin/rpcbind/rpcb_svc_com.c

Modified: head/usr.sbin/rpcbind/rpcb_svc_com.c
==
--- head/usr.sbin/rpcbind/rpcb_svc_com.cMon Mar  5 03:34:01 2018
(r330441)
+++ head/usr.sbin/rpcbind/rpcb_svc_com.cMon Mar  5 03:38:31 2018
(r330442)
@@ -183,12 +183,9 @@ map_set(RPCB *regp, char *owner)
a->r_addr = strdup(reg.r_addr);
a->r_owner = strdup(owner);
if (!a->r_addr || !a->r_netid || !a->r_owner) {
-   if (a->r_netid)
-   free(a->r_netid);
-   if (a->r_addr)
-   free(a->r_addr);
-   if (a->r_owner)
-   free(a->r_owner);
+   free(a->r_netid);
+   free(a->r_addr);
+   free(a->r_owner);
free(rbl);
return (FALSE);
}
@@ -372,11 +369,8 @@ rpcbproc_uaddr2taddr_com(void *arg, struct svc_req *rq
static struct netbuf nbuf;
static struct netbuf *taddr;
 
-   if (taddr) {
-   free(taddr->buf);
-   free(taddr);
-   taddr = NULL;
-   }
+   netbuffree(taddr);
+   taddr = NULL;
if (((nconf = rpcbind_get_conf(transp->xp_netid)) == NULL) ||
((taddr = uaddr2taddr(nconf, *uaddrp)) == NULL)) {
(void) memset((char *)&nbuf, 0, sizeof (struct netbuf));
@@ -685,8 +679,7 @@ rpcbproc_callit_com(struct svc_req *rqstp, SVCXPRT *tr
(unsigned long)a.rmt_prog, (unsigned long)a.rmt_vers,
(unsigned long)a.rmt_proc, transp->xp_netid,
uaddr ? uaddr : "unknown");
-   if (uaddr)
-   free(uaddr);
+   free(uaddr);
}
 #endif
 
@@ -730,8 +723,7 @@ rpcbproc_callit_com(struct svc_req *rqstp, SVCXPRT *tr
rbl->rpcb_map.r_addr, NULL);
if (uaddr == NULL || uaddr[0] == '\0') {
svcerr_noprog(transp);
-   if (uaddr != NULL)
-   free(uaddr);
+   free(uaddr);
goto error;
}
free(uaddr);
@@ -910,18 +902,11 @@ error:
if (call_msg.rm_xid != 0)
(void) free_slot_by_xid(call_msg.rm_xid);
 out:
-   if (local_uaddr)
-   free(local_uaddr);
-   if (buf_alloc)
-   free(buf_alloc);
-   if (outbuf_alloc)
-   free(outbuf_alloc);
-   if (na) {
-   free(na->buf);
-   free(na);
-   }
-   if (m_uaddr != NULL)
-   free(m_uaddr);
+   free(local_uaddr);
+   free(buf_alloc);
+   free(outbuf_alloc);
+   netbuffree(na);
+   free(m_uaddr);
 }
 
 /*
@@ -1058,8 +1043,7 @@ netbuf_copybuf(struct netbuf *dst, const struct netbuf
assert(src->len <= src->maxlen);
 
if (dst->maxlen < src->len || dst->buf == NULL) {
-   if (dst->buf != NULL)
-   free(dst->buf);
+   free(dst->buf);
if ((dst->buf = calloc(1, src->maxlen)) == NULL)
return (FALSE);
dst->maxlen = src->maxlen;
@@ -1088,6 +1072,9 @@ netbufdup(struct netbuf *ap)
 static void
 netbuffree(struct netbuf *ap)
 {
+
+   if (ap == NULL)
+   return;
free(ap->buf);
ap->buf = NULL;
free(ap);
@@ -1317,13 +1304,11 @@ handle_reply(int fd, SVCXPRT *xprt)
fprintf(stderr, "handle_reply:  forwarding address %s to %s\n",
a.rmt_uaddr, uaddr ? uaddr : "unknown");
}
-   if (uaddr)
-   free(uaddr);
+   free(uaddr);
 #endif
svc_sendreply(xprt, (xdrproc_t) xdr_rmtcall_result, (char *) &a);
 done:
-   if (buffer)
-   free(buffer);
+   free(buffer);
 
if (reply_msg.rm_xid == 0) {
 #ifdef SVC_RUN_DEBUG
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r330436 - head/bin/chflags

2018-03-04 Thread Bruce Evans

On Sun, 4 Mar 2018, Ian Lepore wrote:


On Mon, 2018-03-05 at 01:56 +, Bryan Drewery wrote:


Log:
\xa0 chflags: Add -x option to not traverse mount points.


Yay! \xa0One day later than I needed it, but still, yay!


I recently noticed that find(1) needs an option to not look at mount
points at all, and further options to classify mount points so that
you can prune them.

After reading the above and investigating further, I noticed that -x
is broken in most FreeBSD utilities, since POSIX requires not looking
at mount points at all for the few utilities that support -x.  E.g.,
for du in 2001 draft 7 POSIX:

12578-xWhen evaluating file sizes, evaluate only those 
files that have the same device as
12579  the file specified by the file operand.
12580Specifying more than one of the mutually-exclusive options -H 
and -L shall not be considered

Mount points are on a different device, but FreeBSD du -x is broken by
using FTS_XDEV and not filtering out the mount points.  Linux du -x
(an old version in /compat/linyx/usr/bin) works correctly.

(Elsewhere, POSIX uses the terms "mount point" and "file system" without
specifying what they mean.  E.g., for FTW_MOUNT which corresponds tp
FTS_XDEV, it says "The walk does not cross a mount point".  It is also
unclear what "cross" means here -- the names of mount points are in the
same file system although everything (?) else is in another file system.
"mount point" should be specified as "a file whose device differs from
the device of its directory", and "file system" should be specified as
"all files on the system with the same given device".  The latter allows
the trees for file system to have weird topologies but is as good as
anything.  It is better than "all files under a mount point with the
same device as the mount point".  With the latter definition, given
stat structs or even pathnames to 2 files, you would potentially have
to walk all files starting at the root directory (if there is one) to
determine if the 2 files satisfy the topological condtion of being
under the same mount point.)

FTS_XDEV is documented as doing the wrong thing for du -x by saying that
it doesn't "descend" "into directories that have a different device number
than the file from which the descent began".  Its description of
"same device" is too verbose.  It would benefit from formally specifying
mount points and file systems and "cross" too.  Its "descent" is just
good enough without a formal specification since the mount point is at
level 0 in the new file system and a descent of 0 levels is not a
descent in informal use (like for "negative", but unlike for ascent/positive
where it is unclear if 0 levels is an degenerate ascent).

The old POSIX draft uses "same.*device" just once according to a simple
grep.  This is the one quoted above for du -x.  Old POSIX find doesn't
even have -x.  It has -xdev.  This is strange, since FreeBSD's man page
has said since long before 2001 that it is -xdev that is deprecated.  It
specifies -xdev using "descending", like for FTS_XDEV but with worse verbose
wording.

find(1) seems to be missing a classification option for mount points in
both FreeBSD and POSIX.  This could be used to prune mount points, but
pruning is much harder than using a flag that works like -x should work.

Perhaps something can be done with pruning levels for any utility that
supports -x).  E.g. -xx could descend to N levels, where the
level counter is set to 0 when a mount point is _first_ reached.  Then
-xx-1 would give the correct du -x behaviour of not doing the degenerate
descent to level 0; -xx0 would give the find behaviour of doing the
degenerate descent to level 0; -xx1 would descend 1 level; other
positive descents are easy to implement; ther negative descents are
too hard to implement.

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