svn commit: r349797 - stable/12/sys/dev/cxgbe/tom

2019-07-06 Thread Navdeep Parhar
Author: np
Date: Sun Jul  7 05:30:07 2019
New Revision: 349797
URL: https://svnweb.freebsd.org/changeset/base/349797

Log:
  MFC r349500:
  
  cxgbe/t4_tom: Fix regression in t_maxseg usage within t4_tom.
  
  t_maxseg was changed in r293284 to not have any adjustment for TCP
  timestamps.  t4_tom inadvertently went back to pre-r293284 semantics
  in r332506.
  
  Sponsored by: Chelsio Communications

Modified:
  stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c
  stable/12/sys/dev/cxgbe/tom/t4_tom.c
  stable/12/sys/dev/cxgbe/tom/t4_tom.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c
==
--- stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c Sun Jul  7 00:43:38 2019
(r349796)
+++ stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c Sun Jul  7 05:30:07 2019
(r349797)
@@ -327,31 +327,33 @@ send_reset(struct adapter *sc, struct toepcb *toep, ui
  * reported by HW to FreeBSD's native format.
  */
 static void
-assign_rxopt(struct tcpcb *tp, unsigned int opt)
+assign_rxopt(struct tcpcb *tp, uint16_t opt)
 {
struct toepcb *toep = tp->t_toe;
struct inpcb *inp = tp->t_inpcb;
struct adapter *sc = td_adapter(toep->td);
-   int n;
 
INP_LOCK_ASSERT(inp);
 
+   toep->tcp_opt = opt;
+   toep->mtu_idx = G_TCPOPT_MSS(opt);
+   tp->t_maxseg = sc->params.mtus[toep->mtu_idx];
if (inp->inp_inc.inc_flags & INC_ISIPV6)
-   n = sizeof(struct ip6_hdr) + sizeof(struct tcphdr);
+   tp->t_maxseg -= sizeof(struct ip6_hdr) + sizeof(struct tcphdr);
else
-   n = sizeof(struct ip) + sizeof(struct tcphdr);
-   tp->t_maxseg = sc->params.mtus[G_TCPOPT_MSS(opt)] - n;
+   tp->t_maxseg -= sizeof(struct ip) + sizeof(struct tcphdr);
 
+   toep->emss = tp->t_maxseg;
if (G_TCPOPT_TSTAMP(opt)) {
tp->t_flags |= TF_RCVD_TSTMP;   /* timestamps ok */
tp->ts_recent = 0;  /* hmmm */
tp->ts_recent_age = tcp_ts_getticks();
-   tp->t_maxseg -= TCPOLEN_TSTAMP_APPA;
+   toep->emss -= TCPOLEN_TSTAMP_APPA;
}
 
-   CTR5(KTR_CXGBE, "%s: tid %d, mtu_idx %u (%u), mss %u", __func__,
-   toep->tid, G_TCPOPT_MSS(opt), sc->params.mtus[G_TCPOPT_MSS(opt)],
-   tp->t_maxseg);
+   CTR6(KTR_CXGBE, "%s: tid %d, mtu_idx %u (%u), t_maxseg %u, emss %u",
+   __func__, toep->tid, toep->mtu_idx,
+   sc->params.mtus[G_TCPOPT_MSS(opt)], tp->t_maxseg, toep->emss);
 
if (G_TCPOPT_SACK(opt))
tp->t_flags |= TF_SACK_PERMIT;  /* should already be set */
@@ -399,7 +401,7 @@ make_established(struct toepcb *toep, uint32_t iss, ui
 
tp->irs = irs;
tcp_rcvseqinit(tp);
-   tp->rcv_wnd = toep->opt0_rcv_bufsize << 10;
+   tp->rcv_wnd = (u_int)toep->opt0_rcv_bufsize << 10;
tp->rcv_adv += tp->rcv_wnd;
tp->last_ack_sent = tp->rcv_nxt;
 
@@ -421,7 +423,7 @@ make_established(struct toepcb *toep, uint32_t iss, ui
ftxp.snd_nxt = tp->snd_nxt;
ftxp.rcv_nxt = tp->rcv_nxt;
ftxp.snd_space = bufsize;
-   ftxp.mss = tp->t_maxseg;
+   ftxp.mss = toep->emss;
send_flowc_wr(toep, );
 
soisconnected(so);
@@ -613,7 +615,7 @@ write_tx_wr(void *dst, struct toepcb *toep, unsigned i
if (txalign > 0) {
struct tcpcb *tp = intotcpcb(toep->inp);
 
-   if (plen < 2 * tp->t_maxseg)
+   if (plen < 2 * toep->emss)
txwr->lsodisable_to_flags |=
htobe32(F_FW_OFLD_TX_DATA_WR_LSODISABLE);
else

Modified: stable/12/sys/dev/cxgbe/tom/t4_tom.c
==
--- stable/12/sys/dev/cxgbe/tom/t4_tom.cSun Jul  7 00:43:38 2019
(r349796)
+++ stable/12/sys/dev/cxgbe/tom/t4_tom.cSun Jul  7 05:30:07 2019
(r349797)
@@ -852,8 +852,7 @@ remove_tid(struct adapter *sc, int tid, int ntids)
  * What mtu_idx to use, given a 4-tuple.  Note that both s->mss and tcp_mssopt
  * have the MSS that we should advertise in our SYN.  Advertised MSS doesn't
  * account for any TCP options so the effective MSS (only payload, no headers 
or
- * options) could be different.  We fill up tp->t_maxseg with the effective MSS
- * at the end of the 3-way handshake.
+ * options) could be different.
  */
 int
 find_best_mtu_idx(struct adapter *sc, struct in_conninfo *inc,

Modified: stable/12/sys/dev/cxgbe/tom/t4_tom.h
==
--- stable/12/sys/dev/cxgbe/tom/t4_tom.hSun Jul  7 00:43:38 2019
(r349796)
+++ stable/12/sys/dev/cxgbe/tom/t4_tom.hSun Jul  7 05:30:07 2019
(r349797)
@@ -181,7 +181,10 @@ struct toepcb {
u_int tx_nocompl;   /* tx WR credits since last compl 

svn commit: r349796 - stable/12/sys/dev/cxgbe/iw_cxgbe

2019-07-06 Thread Navdeep Parhar
Author: np
Date: Sun Jul  7 00:43:38 2019
New Revision: 349796
URL: https://svnweb.freebsd.org/changeset/base/349796

Log:
  MFC r349499:
  
  cxgbe/iw_cxgbe: Remove unused field from the endpoint structure.

Modified:
  stable/12/sys/dev/cxgbe/iw_cxgbe/cm.c
  stable/12/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/cxgbe/iw_cxgbe/cm.c
==
--- stable/12/sys/dev/cxgbe/iw_cxgbe/cm.c   Sun Jul  7 00:30:20 2019
(r349795)
+++ stable/12/sys/dev/cxgbe/iw_cxgbe/cm.c   Sun Jul  7 00:43:38 2019
(r349796)
@@ -528,7 +528,6 @@ set_tcpinfo(struct c4iw_ep *ep)
ep->hwtid = toep->tid;
ep->snd_seq = tp->snd_nxt;
ep->rcv_seq = tp->rcv_nxt;
-   ep->emss = max(tp->t_maxseg, 128);
 done:
INP_WUNLOCK(inp);
return (rc);

Modified: stable/12/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h
==
--- stable/12/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Sun Jul  7 00:30:20 2019
(r349795)
+++ stable/12/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Sun Jul  7 00:43:38 2019
(r349796)
@@ -862,7 +862,6 @@ struct c4iw_ep {
u32 tx_chan;
u32 mtu;
u16 mss;
-   u16 emss;
u16 plen;
u16 rss_qid;
u16 txq_idx;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349795 - stable/12/sys/dev/cxgbe/tom

2019-07-06 Thread Navdeep Parhar
Author: np
Date: Sun Jul  7 00:30:20 2019
New Revision: 349795
URL: https://svnweb.freebsd.org/changeset/base/349795

Log:
  MFC r349242, r349501, r349514, and r349517.
  
  r349242:
  cxgbe/t4_tom: DDP_DEAD is a ddp flag and not a toepcb flag.
  
  The driver was in effect setting TPF_ABORT_SHUTDOWN on the toepcb
  instead of what was intended.
  
  Sponsored by: Chelsio Communications
  
  r349501:
  cxgbe/t4_tom: Mark the socket's receive as done before calling
  handle_ddp_close.
  
  This eliminates a bad race where an aio_ddp_requeue that happened to run
  after handle_ddp_close could bump up the active count.
  
  Discussed with:   jhb@
  Sponsored by: Chelsio Communications
  
  r349514:
  cxgbe/t4_tom: the AIO tx job queue must be empty by the time the driver
  releases the offload resources associated with the tid.
  
  Reviewed by:  jhb@
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D20798
  
  r349517:
  cxgbe/t4_tom: Tweaks to some of the AIO related CTRs.
  
  Reviewed by:  jhb@
  Sponsored by: Chelsio Communications

Modified:
  stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c
  stable/12/sys/dev/cxgbe/tom/t4_ddp.c
  stable/12/sys/dev/cxgbe/tom/t4_tom.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c
==
--- stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c Sat Jul  6 20:31:37 2019
(r349794)
+++ stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c Sun Jul  7 00:30:20 2019
(r349795)
@@ -722,8 +722,8 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep
("%s: ulp_mode %u for toep %p", __func__, toep->ulp_mode, toep));
 
 #ifdef VERBOSE_TRACES
-   CTR4(KTR_CXGBE, "%s: tid %d toep flags %#x tp flags %#x drop %d",
-   __func__, toep->tid, toep->flags, tp->t_flags);
+   CTR5(KTR_CXGBE, "%s: tid %d toep flags %#x tp flags %#x drop %d",
+   __func__, toep->tid, toep->flags, tp->t_flags, drop);
 #endif
if (__predict_false(toep->flags & TPF_ABORT_SHUTDOWN))
return;
@@ -1242,8 +1242,10 @@ do_peer_close(struct sge_iq *iq, const struct rss_head
INP_WLOCK(inp);
tp = intotcpcb(inp);
 
-   CTR5(KTR_CXGBE, "%s: tid %u (%s), toep_flags 0x%x, inp %p", __func__,
-   tid, tp ? tcpstates[tp->t_state] : "no tp", toep->flags, inp);
+   CTR6(KTR_CXGBE,
+   "%s: tid %u (%s), toep_flags 0x%x, ddp_flags 0x%x, inp %p",
+   __func__, tid, tp ? tcpstates[tp->t_state] : "no tp", toep->flags,
+   toep->ddp.flags, inp);
 
if (toep->flags & TPF_ABORT_SHUTDOWN)
goto done;
@@ -1251,6 +1253,7 @@ do_peer_close(struct sge_iq *iq, const struct rss_head
tp->rcv_nxt++;  /* FIN */
 
so = inp->inp_socket;
+   socantrcvmore(so);
if (toep->ulp_mode == ULP_MODE_TCPDDP) {
DDP_LOCK(toep);
if (__predict_false(toep->ddp.flags &
@@ -1258,7 +1261,6 @@ do_peer_close(struct sge_iq *iq, const struct rss_head
handle_ddp_close(toep, tp, cpl->rcv_nxt);
DDP_UNLOCK(toep);
}
-   socantrcvmore(so);
 
if (toep->ulp_mode != ULP_MODE_RDMA) {
KASSERT(tp->rcv_nxt == be32toh(cpl->rcv_nxt),
@@ -2223,7 +2225,7 @@ t4_aiotx_queue_toep(struct toepcb *toep)
SOCKBUF_LOCK_ASSERT(>inp->inp_socket->so_snd);
 #ifdef VERBOSE_TRACES
CTR3(KTR_CXGBE, "%s: queueing aiotx task for tid %d, active = %s",
-   __func__, toep->tid, toep->aiotx_task_active ? "true" : "false");
+   __func__, toep->tid, toep->aiotx_so != NULL ? "true" : "false");
 #endif
if (toep->aiotx_task_active)
return;
@@ -2278,7 +2280,7 @@ t4_aio_queue_aiotx(struct socket *so, struct kaiocb *j
 
SOCKBUF_LOCK(>so_snd);
 #ifdef VERBOSE_TRACES
-   CTR2(KTR_CXGBE, "%s: queueing %p", __func__, job);
+   CTR3(KTR_CXGBE, "%s: queueing %p for tid %u", __func__, job, toep->tid);
 #endif
if (!aio_set_cancel_function(job, t4_aiotx_cancel))
panic("new job was cancelled");

Modified: stable/12/sys/dev/cxgbe/tom/t4_ddp.c
==
--- stable/12/sys/dev/cxgbe/tom/t4_ddp.cSat Jul  6 20:31:37 2019
(r349794)
+++ stable/12/sys/dev/cxgbe/tom/t4_ddp.cSun Jul  7 00:30:20 2019
(r349795)
@@ -220,7 +220,7 @@ release_ddp_resources(struct toepcb *toep)
int i;
 
DDP_LOCK(toep);
-   toep->flags |= DDP_DEAD;
+   toep->ddp.flags |= DDP_DEAD;
for (i = 0; i < nitems(toep->ddp.db); i++) {
free_ddp_buffer(toep->td, >ddp.db[i]);
}
@@ -263,8 +263,8 @@ complete_ddp_buffer(struct toepcb *toep, struct ddp_bu
} else
toep->ddp.active_id ^= 1;
 #ifdef VERBOSE_TRACES
-   CTR2(KTR_CXGBE, "%s: 

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

2019-07-06 Thread Konstantin Belousov
Author: kib
Date: Sat Jul  6 20:31:37 2019
New Revision: 349794
URL: https://svnweb.freebsd.org/changeset/base/349794

Log:
  Document atomicity for read(2) and write(2).
  
  Take part of the text from POSIX 2018 edition and describe the
  atomicity requirements for read and write syscalls.  See p1003.1-2018,
  Vol.2, 2.9.7 Threads interaction with Regular File Operations.
  
  Reviewed by:  asomers
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days
  Differential revision:https://reviews.freebsd.org/D20867

Modified:
  head/lib/libc/sys/read.2

Modified: head/lib/libc/sys/read.2
==
--- head/lib/libc/sys/read.2Sat Jul  6 18:02:29 2019(r349793)
+++ head/lib/libc/sys/read.2Sat Jul  6 20:31:37 2019(r349794)
@@ -28,7 +28,7 @@
 .\" @(#)read.2 8.4 (Berkeley) 2/26/94
 .\" $FreeBSD$
 .\"
-.Dd December 1, 2017
+.Dd July 6, 2019
 .Dt READ 2
 .Os
 .Sh NAME
@@ -128,6 +128,25 @@ return the number of bytes actually read and placed in
 The system guarantees to read the number of bytes requested if
 the descriptor references a normal file that has that many bytes left
 before the end-of-file, but in no other case.
+.Pp
+In accordance with
+.St -p1003.1-2004 ,
+both
+.Xr read 2
+and
+.Xr write 2
+syscalls are atomic with respect to each other in the effects on file
+content, when they operate on regular files.
+If two threads each call one of the
+.Xr read 2
+or
+.Xr write 2 ,
+syscalls, each call will see either all of the changes of the other call,
+or none of them.
+The
+.Fx
+kernel implements this guarantee by locking the file ranges affected by
+the calls.
 .Sh RETURN VALUES
 If successful, the
 number of bytes actually read is returned.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349793 - in head: contrib/libunwind/src contrib/llvm/tools/clang/lib/AST contrib/llvm/tools/clang/lib/CodeGen contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch contrib/llvm/tools/lld...

2019-07-06 Thread Dimitry Andric
Author: dim
Date: Sat Jul  6 18:02:29 2019
New Revision: 349793
URL: https://svnweb.freebsd.org/changeset/base/349793

Log:
  Upgrade our copies of clang, llvm, lld, lldb, compiler-rt, libc++,
  libunwind and openmp to the upstream release_80 branch r364487
  (effectively, 8.0.1 rc3).  The 8.0.1 release will most likely
  have no further changes.
  
  MFC after:1 week
  X-MFC-With:   r349004

Modified:
  head/contrib/libunwind/src/DwarfInstructions.hpp
  head/contrib/libunwind/src/assembly.h
  head/contrib/llvm/tools/clang/lib/AST/MicrosoftMangle.cpp
  head/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp
  head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/PPC.cpp
  head/contrib/llvm/tools/lld/ELF/Arch/PPC64.cpp
  head/contrib/openmp/runtime/src/kmp_atomic.h
  head/contrib/openmp/runtime/src/kmp_csupport.cpp
  head/contrib/openmp/runtime/src/ompt-specific.cpp
  head/lib/clang/include/clang/Basic/Version.inc
  head/lib/clang/include/lld/Common/Version.inc
  head/lib/clang/include/llvm/Support/VCSRevision.h
Directory Properties:
  head/contrib/compiler-rt/   (props changed)
  head/contrib/libc++/   (props changed)
  head/contrib/libunwind/   (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)
  head/contrib/openmp/   (props changed)

Modified: head/contrib/libunwind/src/DwarfInstructions.hpp
==
--- head/contrib/libunwind/src/DwarfInstructions.hppSat Jul  6 16:19:04 
2019(r349792)
+++ head/contrib/libunwind/src/DwarfInstructions.hppSat Jul  6 18:02:29 
2019(r349793)
@@ -234,6 +234,31 @@ int DwarfInstructions::stepWithDwarf(A 
   }
 #endif
 
+#if defined(_LIBUNWIND_TARGET_PPC64)
+#define PPC64_ELFV1_R2_LOAD_INST_ENCODING 0xe8410028u // ld r2,40(r1)
+#define PPC64_ELFV1_R2_OFFSET 40
+#define PPC64_ELFV2_R2_LOAD_INST_ENCODING 0xe8410018u // ld r2,24(r1)
+#define PPC64_ELFV2_R2_OFFSET 24
+  // If the instruction at return address is a TOC (r2) restore,
+  // then r2 was saved and needs to be restored.
+  // ELFv2 ABI specifies that the TOC Pointer must be saved at SP + 24,
+  // while in ELFv1 ABI it is saved at SP + 40.
+  if (R::getArch() == REGISTERS_PPC64 && returnAddress != 0) {
+pint_t sp = newRegisters.getRegister(UNW_REG_SP);
+pint_t r2 = 0;
+switch (addressSpace.get32(returnAddress)) {
+case PPC64_ELFV1_R2_LOAD_INST_ENCODING:
+  r2 = addressSpace.get64(sp + PPC64_ELFV1_R2_OFFSET);
+  break;
+case PPC64_ELFV2_R2_LOAD_INST_ENCODING:
+  r2 = addressSpace.get64(sp + PPC64_ELFV2_R2_OFFSET);
+  break;
+}
+if (r2)
+  newRegisters.setRegister(UNW_PPC64_R2, r2);
+  }
+#endif
+
   // Return address is address after call site instruction, so setting IP 
to
   // that does simualates a return.
   newRegisters.setIP(returnAddress);

Modified: head/contrib/libunwind/src/assembly.h
==
--- head/contrib/libunwind/src/assembly.h   Sat Jul  6 16:19:04 2019
(r349792)
+++ head/contrib/libunwind/src/assembly.h   Sat Jul  6 18:02:29 2019
(r349793)
@@ -35,6 +35,20 @@
 #define SEPARATOR ;
 #endif
 
+#if defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1)
+#define PPC64_OPD1 .section .opd,"aw",@progbits SEPARATOR
+#define PPC64_OPD2 SEPARATOR \
+  .p2align 3 SEPARATOR \
+  .quad .Lfunc_begin0 SEPARATOR \
+  .quad .TOC.@tocbase SEPARATOR \
+  .quad 0 SEPARATOR \
+  .text SEPARATOR \
+.Lfunc_begin0:
+#else
+#define PPC64_OPD1
+#define PPC64_OPD2
+#endif
+
 #define GLUE2(a, b) a ## b
 #define GLUE(a, b) GLUE2(a, b)
 #define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name)
@@ -95,7 +109,9 @@
   .globl SYMBOL_NAME(name) SEPARATOR  \
   EXPORT_SYMBOL(name) SEPARATOR   \
   SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
-  SYMBOL_NAME(name):
+  PPC64_OPD1  \
+  SYMBOL_NAME(name):  \
+  PPC64_OPD2
 
 #define DEFINE_LIBUNWIND_PRIVATE_FUNCTION(name)   \
   .globl SYMBOL_NAME(name) SEPARATOR  \

Modified: head/contrib/llvm/tools/clang/lib/AST/MicrosoftMangle.cpp
==
--- head/contrib/llvm/tools/clang/lib/AST/MicrosoftMangle.cpp   Sat Jul  6 
16:19:04 2019(r349792)
+++ head/contrib/llvm/tools/clang/lib/AST/MicrosoftMangle.cpp   Sat Jul  6 
18:02:29 2019(r349793)
@@ -1937,8 +1937,9 @@ void MicrosoftCXXNameMangler::mangleType(const Builtin
   // ::= _M # unsigned __int128
   // ::= _N # bool
   // _O # 
-  // ::= _T 

Re: svn commit: r349791 - head/sys/vm

2019-07-06 Thread Bruce Evans

On Sat, 6 Jul 2019, Doug Moore wrote:


Log:
 Fix style(9) violations involving division by PAGE_SIZE.


It is style violation to even use an explicit division by PAGE_SIZE
instead of the btoc() conversion macro (*).


Modified: head/sys/vm/swap_pager.c
==
--- head/sys/vm/swap_pager.cSat Jul  6 15:34:23 2019(r349790)
+++ head/sys/vm/swap_pager.cSat Jul  6 15:55:16 2019(r349791)
@@ -523,7 +523,7 @@ swap_pager_swap_init(void)
 * but it isn't very efficient).
 *
 * The nsw_cluster_max is constrained by the bp->b_pages[]
-* array (MAXPHYS/PAGE_SIZE) and our locally defined
+* array MAXPHYS / PAGE_SIZE and our locally defined
 * MAX_PAGEOUT_CLUSTER.   Also be aware that swap ops are
 * constrained by the swap device interleave stripe size.
 *


The macro is less readable in comments.


@@ -538,7 +538,7 @@ swap_pager_swap_init(void)
 * have one NFS swap device due to the command/ack latency over NFS.
 * So it all works out pretty well.
 */
-   nsw_cluster_max = min((MAXPHYS/PAGE_SIZE), MAX_PAGEOUT_CLUSTER);
+   nsw_cluster_max = min(MAXPHYS / PAGE_SIZE, MAX_PAGEOUT_CLUSTER);

nsw_wcount_async = 4;
nsw_wcount_async_max = nsw_wcount_async;

Modified: head/sys/vm/vnode_pager.c
==
--- head/sys/vm/vnode_pager.c   Sat Jul  6 15:34:23 2019(r349790)
+++ head/sys/vm/vnode_pager.c   Sat Jul  6 15:55:16 2019(r349791)
@@ -544,8 +544,8 @@ vnode_pager_addr(struct vnode *vp, vm_ooffset_t addres
*rtaddress += voffset / DEV_BSIZE;
...


Using explicit division by DEV_BSIZE instead of the btodb() conversion
macro is another style bug.

(*) The macros use shifts while the divisions use division.  The hard-coded
versions could use shifts too, so there is another set of style bugs from
only using shifts sometimes.  Shifts are faster if the type of the dividend
is signed.

Oops.  The macro also rounds up.  So hard-coding the division is not just
a style bug.  It is wrong unless the dividend is a multiple of the page
size.  This shouldn't be assumed for values like MAXBSIZE.

There are many more style bugs involving btoc():
- 'c' in it means 'click', which might mean a virtual page size while
  PAGE_SIZE might mean the physical page size.  Or vice versa.  dyson
  retired from BSD not long after I asked him to clean this up 20+
  years ago.
- btoc() is the only clearly MI macro for this.  The better-named macros
  amd64_ptob() and i386_ptob() are of course MD.  amd64_ptob() is never
  used in sys/amd64.  i386_ptob() is used 8 times in sys/i386 (all in
  pmap.c), and 1 of these uses is in a macro which is used 22 times.
  These uses give another set of style bugs.  They are just obfuscations
  if clicks are the same as pages, and probably incomplete otherwise.
  However, it is correct for MD code to use physical pages unless it is
  implementing virtual pages.

  These macros don't round up, so they are not equivalent to btoc() even
  if the click size is PAGE_SIZE.
- there is also the better-named macro atop().  This doesn't round up.
  I think it is supposed to be MI.  It is replicated 
  for all arches.  'a' in it means 'address', which is less general than
  'b' for 'byte, so it is a worse name than btop().
- the macro with the best name btop() doesn't exist.

In the opposite direction, there are ctob(), {amd64,i386}_ptob(),
ptoa(), and direct multiplications by PAGE_SIZE and direct shifts by
PAGE_SHIFT.  {amd64,i386}_ptob() is not used even on i386.  This direction
is trickier since the (npages << PAGE_SHIFT) overflows if npages has the
correct type (int).  The caller should convert npages to something like
vm_offset_t before using the macro and the need for this is less obvious
than for a direct expression.  This is of course undocumented except by
the source code which shows:
- ctob(), ptoa() and i386_ptob() need conversion in the caller, but
  amd64_ptob() converts to unsigned long in the macro.  Since the last
  macro is unused, the caller should convert in all used cases.  Coversion
  is most important on 64-bit arches.  On i386, overflow occurs at 2G
  starting with int npages but u_int npages works up to 4G which is
  enough for i386 addresses but not for amd64 addresses or i386-PAE
  byte counts.

I once sprinkled conversions in the macros.  btodb() still uses my old
code for this, where the code is sophisticated so as to avoid using
the long long abomination, but which became mostly nonsense when daddr_t
was expanded from 32 bits to 64.  Since this macro shifts right,
conversion is not really necessary, and conversion to daddr_t gives
much the same pessimations as conversion to the abomination.  dbtodb()
simply converts to daddr_t.  I forget if I wrote that.  btoc() converts
to vm_offset_t, but 

svn commit: r349792 - stable/12/sys/vm

2019-07-06 Thread Konstantin Belousov
Author: kib
Date: Sat Jul  6 16:19:04 2019
New Revision: 349792
URL: https://svnweb.freebsd.org/changeset/base/349792

Log:
  MFC r349608:
  Use traditional 'p' local to designate td->td_proc in kern_mmap.

Modified:
  stable/12/sys/vm/vm_mmap.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/vm/vm_mmap.c
==
--- stable/12/sys/vm/vm_mmap.c  Sat Jul  6 15:55:16 2019(r349791)
+++ stable/12/sys/vm/vm_mmap.c  Sat Jul  6 16:19:04 2019(r349792)
@@ -187,13 +187,15 @@ kern_mmap(struct thread *td, uintptr_t addr0, size_t s
 {
struct vmspace *vms;
struct file *fp;
+   struct proc *p;
vm_offset_t addr;
vm_size_t pageoff;
vm_prot_t cap_maxprot;
int align, error;
cap_rights_t rights;
 
-   vms = td->td_proc->p_vmspace;
+   p = td->td_proc;
+   vms = p->p_vmspace;
fp = NULL;
AUDIT_ARG_FD(fd);
addr = addr0;
@@ -213,7 +215,7 @@ kern_mmap(struct thread *td, uintptr_t addr0, size_t s
 * pos.
 */
if (!SV_CURPROC_FLAG(SV_AOUT)) {
-   if ((size == 0 && curproc->p_osrel >= P_OSREL_MAP_ANON) ||
+   if ((size == 0 && p->p_osrel >= P_OSREL_MAP_ANON) ||
((flags & MAP_ANON) != 0 && (fd != -1 || pos != 0)))
return (EINVAL);
} else {
@@ -356,7 +358,7 @@ kern_mmap(struct thread *td, uintptr_t addr0, size_t s
if (error != 0)
goto done;
if ((flags & (MAP_SHARED | MAP_PRIVATE)) == 0 &&
-   td->td_proc->p_osrel >= P_OSREL_MAP_FSTRICT) {
+   p->p_osrel >= P_OSREL_MAP_FSTRICT) {
error = EINVAL;
goto done;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349791 - head/sys/vm

2019-07-06 Thread Doug Moore
Author: dougm
Date: Sat Jul  6 15:55:16 2019
New Revision: 349791
URL: https://svnweb.freebsd.org/changeset/base/349791

Log:
  Fix style(9) violations involving division by PAGE_SIZE.
  
  Reviewed by: alc
  Approved by: markj (mentor)
  Differential Revision: https://reviews.freebsd.org/D20847

Modified:
  head/sys/vm/swap_pager.c
  head/sys/vm/vm_pageout.c
  head/sys/vm/vnode_pager.c

Modified: head/sys/vm/swap_pager.c
==
--- head/sys/vm/swap_pager.cSat Jul  6 15:34:23 2019(r349790)
+++ head/sys/vm/swap_pager.cSat Jul  6 15:55:16 2019(r349791)
@@ -523,7 +523,7 @@ swap_pager_swap_init(void)
 * but it isn't very efficient).
 *
 * The nsw_cluster_max is constrained by the bp->b_pages[]
-* array (MAXPHYS/PAGE_SIZE) and our locally defined
+* array MAXPHYS / PAGE_SIZE and our locally defined
 * MAX_PAGEOUT_CLUSTER.   Also be aware that swap ops are
 * constrained by the swap device interleave stripe size.
 *
@@ -538,7 +538,7 @@ swap_pager_swap_init(void)
 * have one NFS swap device due to the command/ack latency over NFS.
 * So it all works out pretty well.
 */
-   nsw_cluster_max = min((MAXPHYS/PAGE_SIZE), MAX_PAGEOUT_CLUSTER);
+   nsw_cluster_max = min(MAXPHYS / PAGE_SIZE, MAX_PAGEOUT_CLUSTER);
 
nsw_wcount_async = 4;
nsw_wcount_async_max = nsw_wcount_async;

Modified: head/sys/vm/vm_pageout.c
==
--- head/sys/vm/vm_pageout.cSat Jul  6 15:34:23 2019(r349790)
+++ head/sys/vm/vm_pageout.cSat Jul  6 15:55:16 2019(r349791)
@@ -1972,7 +1972,7 @@ vm_pageout_init_domain(int domain)
vmd->vmd_free_min = 4 + (vmd->vmd_page_count - 1024) / 200;
else
vmd->vmd_free_min = 4;
-   vmd->vmd_pageout_free_min = (2*MAXBSIZE)/PAGE_SIZE +
+   vmd->vmd_pageout_free_min = 2 * MAXBSIZE / PAGE_SIZE +
vmd->vmd_interrupt_free_min;
vmd->vmd_free_reserved = vm_pageout_page_count +
vmd->vmd_pageout_free_min + (vmd->vmd_page_count / 768);

Modified: head/sys/vm/vnode_pager.c
==
--- head/sys/vm/vnode_pager.c   Sat Jul  6 15:34:23 2019(r349790)
+++ head/sys/vm/vnode_pager.c   Sat Jul  6 15:55:16 2019(r349791)
@@ -544,8 +544,8 @@ vnode_pager_addr(struct vnode *vp, vm_ooffset_t addres
*rtaddress += voffset / DEV_BSIZE;
if (run) {
*run += 1;
-   *run *= bsize/PAGE_SIZE;
-   *run -= voffset/PAGE_SIZE;
+   *run *= bsize / PAGE_SIZE;
+   *run -= voffset / PAGE_SIZE;
}
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349787 - in vendor/lldb/dist-release_80/lit: . Driver

2019-07-06 Thread Dimitry Andric
Author: dim
Date: Sat Jul  6 15:34:15 2019
New Revision: 349787
URL: https://svnweb.freebsd.org/changeset/base/349787

Log:
  Vendor import of lldb release_80 branch r364487:
  https://llvm.org/svn/llvm-project/lldb/branches/release_80@364487

Modified:
  vendor/lldb/dist-release_80/lit/Driver/TestConvenienceVariables.test
  vendor/lldb/dist-release_80/lit/lit.cfg.py

Modified: vendor/lldb/dist-release_80/lit/Driver/TestConvenienceVariables.test
==
--- vendor/lldb/dist-release_80/lit/Driver/TestConvenienceVariables.test
Sat Jul  6 15:34:12 2019(r349786)
+++ vendor/lldb/dist-release_80/lit/Driver/TestConvenienceVariables.test
Sat Jul  6 15:34:15 2019(r349787)
@@ -1,3 +1,4 @@
+REQUIRES: python
 RUN: %build %p/Inputs/hello.cpp -o %t
 RUN: %lldb %t -s %p/Inputs/convenience.in -o quit | FileCheck %s
 
@@ -19,4 +20,4 @@ CHECK: 8
 CHECK: script lldb.frame.GetLineEntry().GetFileSpec().GetFilename()
 CHECK: hello.c
 CHECK: script lldb.frame.GetFunctionName()
-CHECK: main
\ No newline at end of file
+CHECK: main

Modified: vendor/lldb/dist-release_80/lit/lit.cfg.py
==
--- vendor/lldb/dist-release_80/lit/lit.cfg.py  Sat Jul  6 15:34:12 2019
(r349786)
+++ vendor/lldb/dist-release_80/lit/lit.cfg.py  Sat Jul  6 15:34:15 2019
(r349787)
@@ -73,3 +73,6 @@ for i in ['module-cache-clang', 'module-cache-lldb']:
 if os.path.isdir(cachedir):
 print("Deleting module cache at %s."%cachedir)
 shutil.rmtree(cachedir)
+
+if not config.lldb_disable_python:
+config.available_features.add('python')
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349784 - vendor/llvm-libunwind/libunwind-release_80-r364487

2019-07-06 Thread Dimitry Andric
Author: dim
Date: Sat Jul  6 15:34:07 2019
New Revision: 349784
URL: https://svnweb.freebsd.org/changeset/base/349784

Log:
  Tag LLVM libunwind release_80 branch r364487.

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


svn commit: r349789 - vendor/llvm-openmp/dist-release_80/runtime/src

2019-07-06 Thread Dimitry Andric
Author: dim
Date: Sat Jul  6 15:34:20 2019
New Revision: 349789
URL: https://svnweb.freebsd.org/changeset/base/349789

Log:
  Vendor import of LLVM openmp release_80 branch r364487:
  https://llvm.org/svn/llvm-project/openmp/branches/release_80@364487

Modified:
  vendor/llvm-openmp/dist-release_80/runtime/src/kmp_atomic.h
  vendor/llvm-openmp/dist-release_80/runtime/src/kmp_csupport.cpp
  vendor/llvm-openmp/dist-release_80/runtime/src/ompt-specific.cpp

Modified: vendor/llvm-openmp/dist-release_80/runtime/src/kmp_atomic.h
==
--- vendor/llvm-openmp/dist-release_80/runtime/src/kmp_atomic.h Sat Jul  6 
15:34:18 2019(r349788)
+++ vendor/llvm-openmp/dist-release_80/runtime/src/kmp_atomic.h Sat Jul  6 
15:34:20 2019(r349789)
@@ -364,7 +364,7 @@ static inline void __kmp_acquire_atomic_lock(kmp_atomi
 #if OMPT_SUPPORT && OMPT_OPTIONAL
   if (ompt_enabled.ompt_callback_mutex_acquire) {
 ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
-ompt_mutex_atomic, 0, kmp_mutex_impl_queuing, (ompt_wait_id_t)lck,
+ompt_mutex_atomic, 0, kmp_mutex_impl_queuing, 
(ompt_wait_id_t)(uintptr_t)lck,
 OMPT_GET_RETURN_ADDRESS(0));
   }
 #endif
@@ -374,7 +374,7 @@ static inline void __kmp_acquire_atomic_lock(kmp_atomi
 #if OMPT_SUPPORT && OMPT_OPTIONAL
   if (ompt_enabled.ompt_callback_mutex_acquired) {
 ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
-ompt_mutex_atomic, (ompt_wait_id_t)lck, OMPT_GET_RETURN_ADDRESS(0));
+ompt_mutex_atomic, (ompt_wait_id_t)(uintptr_t)lck, 
OMPT_GET_RETURN_ADDRESS(0));
   }
 #endif
 }
@@ -390,7 +390,7 @@ static inline void __kmp_release_atomic_lock(kmp_atomi
 #if OMPT_SUPPORT && OMPT_OPTIONAL
   if (ompt_enabled.ompt_callback_mutex_released) {
 ompt_callbacks.ompt_callback(ompt_callback_mutex_released)(
-ompt_mutex_atomic, (ompt_wait_id_t)lck, OMPT_GET_RETURN_ADDRESS(0));
+ompt_mutex_atomic, (ompt_wait_id_t)(uintptr_t)lck, 
OMPT_GET_RETURN_ADDRESS(0));
   }
 #endif
 }

Modified: vendor/llvm-openmp/dist-release_80/runtime/src/kmp_csupport.cpp
==
--- vendor/llvm-openmp/dist-release_80/runtime/src/kmp_csupport.cpp Sat Jul 
 6 15:34:18 2019(r349788)
+++ vendor/llvm-openmp/dist-release_80/runtime/src/kmp_csupport.cpp Sat Jul 
 6 15:34:20 2019(r349789)
@@ -848,7 +848,7 @@ void __kmpc_ordered(ident_t *loc, kmp_int32 gtid) {
   if (ompt_enabled.enabled) {
 OMPT_STORE_RETURN_ADDRESS(gtid);
 team = __kmp_team_from_gtid(gtid);
-lck = (ompt_wait_id_t)>t.t_ordered.dt.t_value;
+lck = (ompt_wait_id_t)(uintptr_t)>t.t_ordered.dt.t_value;
 /* OMPT state update */
 th->th.ompt_thread_info.wait_id = lck;
 th->th.ompt_thread_info.state = ompt_state_wait_ordered;
@@ -857,8 +857,8 @@ void __kmpc_ordered(ident_t *loc, kmp_int32 gtid) {
 codeptr_ra = OMPT_LOAD_RETURN_ADDRESS(gtid);
 if (ompt_enabled.ompt_callback_mutex_acquire) {
   ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
-  ompt_mutex_ordered, omp_lock_hint_none, kmp_mutex_impl_spin,
-  (ompt_wait_id_t)lck, codeptr_ra);
+  ompt_mutex_ordered, omp_lock_hint_none, kmp_mutex_impl_spin, lck,
+  codeptr_ra);
 }
   }
 #endif
@@ -877,7 +877,7 @@ void __kmpc_ordered(ident_t *loc, kmp_int32 gtid) {
 /* OMPT event callback */
 if (ompt_enabled.ompt_callback_mutex_acquired) {
   ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
-  ompt_mutex_ordered, (ompt_wait_id_t)lck, codeptr_ra);
+  ompt_mutex_ordered, (ompt_wait_id_t)(uintptr_t)lck, codeptr_ra);
 }
   }
 #endif
@@ -917,7 +917,8 @@ void __kmpc_end_ordered(ident_t *loc, kmp_int32 gtid) 
   if (ompt_enabled.ompt_callback_mutex_released) {
 ompt_callbacks.ompt_callback(ompt_callback_mutex_released)(
 ompt_mutex_ordered,
-(ompt_wait_id_t)&__kmp_team_from_gtid(gtid)->t.t_ordered.dt.t_value,
+(ompt_wait_id_t)(uintptr_t)&__kmp_team_from_gtid(gtid)
+->t.t_ordered.dt.t_value,
 OMPT_LOAD_RETURN_ADDRESS(gtid));
   }
 #endif
@@ -1188,7 +1189,7 @@ void __kmpc_critical(ident_t *loc, kmp_int32 global_ti
 ti = __kmp_threads[global_tid]->th.ompt_thread_info;
 /* OMPT state update */
 prev_state = ti.state;
-ti.wait_id = (ompt_wait_id_t)lck;
+ti.wait_id = (ompt_wait_id_t)(uintptr_t)lck;
 ti.state = ompt_state_wait_critical;
 
 /* OMPT event callback */
@@ -1196,7 +1197,7 @@ void __kmpc_critical(ident_t *loc, kmp_int32 global_ti
 if (ompt_enabled.ompt_callback_mutex_acquire) {
   ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
   ompt_mutex_critical, omp_lock_hint_none, 
__ompt_get_mutex_impl_type(),
-  (ompt_wait_id_t)crit, codeptr_ra);
+  (ompt_wait_id_t)(uintptr_t)lck, codeptr_ra);
 }
   }
 #endif
@@ -1216,7 +1217,7 @@ 

svn commit: r349790 - vendor/llvm-openmp/openmp-release_80-r364487

2019-07-06 Thread Dimitry Andric
Author: dim
Date: Sat Jul  6 15:34:23 2019
New Revision: 349790
URL: https://svnweb.freebsd.org/changeset/base/349790

Log:
  Tag LLVM openmp release_80 branch r364487.

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


svn commit: r349788 - vendor/lldb/lldb-release_80-r364487

2019-07-06 Thread Dimitry Andric
Author: dim
Date: Sat Jul  6 15:34:18 2019
New Revision: 349788
URL: https://svnweb.freebsd.org/changeset/base/349788

Log:
  Tag lldb release_80 branch r364487.

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


svn commit: r349782 - vendor/libc++/libc++-release_80-r364487

2019-07-06 Thread Dimitry Andric
Author: dim
Date: Sat Jul  6 15:34:01 2019
New Revision: 349782
URL: https://svnweb.freebsd.org/changeset/base/349782

Log:
  Tag libc++ release_80 branch r364487.

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


svn commit: r349786 - vendor/lld/lld-release_80-r364487

2019-07-06 Thread Dimitry Andric
Author: dim
Date: Sat Jul  6 15:34:12 2019
New Revision: 349786
URL: https://svnweb.freebsd.org/changeset/base/349786

Log:
  Tag lld release_80 branch r364487.

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


svn commit: r349785 - in vendor/lld/dist-release_80: ELF/Arch test/ELF

2019-07-06 Thread Dimitry Andric
Author: dim
Date: Sat Jul  6 15:34:09 2019
New Revision: 349785
URL: https://svnweb.freebsd.org/changeset/base/349785

Log:
  Vendor import of lld release_80 branch r364487:
  https://llvm.org/svn/llvm-project/lld/branches/release_80@364487

Added:
  vendor/lld/dist-release_80/test/ELF/ppc64-long-branch-localentry-offset.s
Modified:
  vendor/lld/dist-release_80/ELF/Arch/PPC64.cpp

Modified: vendor/lld/dist-release_80/ELF/Arch/PPC64.cpp
==
--- vendor/lld/dist-release_80/ELF/Arch/PPC64.cpp   Sat Jul  6 15:34:07 
2019(r349784)
+++ vendor/lld/dist-release_80/ELF/Arch/PPC64.cpp   Sat Jul  6 15:34:09 
2019(r349785)
@@ -757,7 +757,10 @@ bool PPC64::needsThunk(RelExpr Expr, RelType Type, con
 
   // If the offset exceeds the range of the branch type then it will need
   // a range-extending thunk.
-  return !inBranchRange(Type, BranchAddr, S.getVA());
+  // See the comment in getRelocTargetVA() about R_PPC64_CALL.
+  return !inBranchRange(Type, BranchAddr,
+S.getVA() +
+getPPC64GlobalEntryToLocalEntryOffset(S.StOther));
 }
 
 uint32_t PPC64::getThunkSectionSpacing() const {

Added: vendor/lld/dist-release_80/test/ELF/ppc64-long-branch-localentry-offset.s
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/lld/dist-release_80/test/ELF/ppc64-long-branch-localentry-offset.s   
Sat Jul  6 15:34:09 2019(r349785)
@@ -0,0 +1,30 @@
+# REQUIRES: ppc
+
+# RUN: llvm-mc -filetype=obj -triple=ppc64le %s -o %t.o
+# RUN: ld.lld %t.o -o %t
+# RUN: llvm-nm %t | FileCheck %s
+
+# CHECK-DAG: 1001 t __long_branch_callee
+# CHECK-DAG: 10010010 T _start
+# CHECK-DAG: 12010008 T callee
+
+# The bl instruction jumps to the local entry. The distance requires a long 
branch stub:
+# localentry(callee) - _start = 0x12010008+8 - 0x10010010 = 0x200
+
+# We used to compute globalentry(callee) - _start and caused a "R_PPC64_REL24
+# out of range" error because we didn't create the stub.
+
+.globl _start
+_start:
+  bl callee
+
+.space 0x1f4
+
+.globl callee
+callee:
+.Lgep0:
+  addis 2, 12, .TOC.-.Lgep0@ha
+  addi 2, 2, .TOC.-.Lgep0@l
+.Llep0:
+  .localentry callee, .Llep0-.Lgep0
+  blr
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349783 - vendor/llvm-libunwind/dist-release_80/src

2019-07-06 Thread Dimitry Andric
Author: dim
Date: Sat Jul  6 15:34:04 2019
New Revision: 349783
URL: https://svnweb.freebsd.org/changeset/base/349783

Log:
  Vendor import of LLVM libunwind release_80 branch r364487:
  https://llvm.org/svn/llvm-project/libunwind/branches/release_80@364487

Modified:
  vendor/llvm-libunwind/dist-release_80/src/DwarfInstructions.hpp
  vendor/llvm-libunwind/dist-release_80/src/assembly.h

Modified: vendor/llvm-libunwind/dist-release_80/src/DwarfInstructions.hpp
==
--- vendor/llvm-libunwind/dist-release_80/src/DwarfInstructions.hpp Sat Jul 
 6 15:34:01 2019(r349782)
+++ vendor/llvm-libunwind/dist-release_80/src/DwarfInstructions.hpp Sat Jul 
 6 15:34:04 2019(r349783)
@@ -234,6 +234,31 @@ int DwarfInstructions::stepWithDwarf(A 
   }
 #endif
 
+#if defined(_LIBUNWIND_TARGET_PPC64)
+#define PPC64_ELFV1_R2_LOAD_INST_ENCODING 0xe8410028u // ld r2,40(r1)
+#define PPC64_ELFV1_R2_OFFSET 40
+#define PPC64_ELFV2_R2_LOAD_INST_ENCODING 0xe8410018u // ld r2,24(r1)
+#define PPC64_ELFV2_R2_OFFSET 24
+  // If the instruction at return address is a TOC (r2) restore,
+  // then r2 was saved and needs to be restored.
+  // ELFv2 ABI specifies that the TOC Pointer must be saved at SP + 24,
+  // while in ELFv1 ABI it is saved at SP + 40.
+  if (R::getArch() == REGISTERS_PPC64 && returnAddress != 0) {
+pint_t sp = newRegisters.getRegister(UNW_REG_SP);
+pint_t r2 = 0;
+switch (addressSpace.get32(returnAddress)) {
+case PPC64_ELFV1_R2_LOAD_INST_ENCODING:
+  r2 = addressSpace.get64(sp + PPC64_ELFV1_R2_OFFSET);
+  break;
+case PPC64_ELFV2_R2_LOAD_INST_ENCODING:
+  r2 = addressSpace.get64(sp + PPC64_ELFV2_R2_OFFSET);
+  break;
+}
+if (r2)
+  newRegisters.setRegister(UNW_PPC64_R2, r2);
+  }
+#endif
+
   // Return address is address after call site instruction, so setting IP 
to
   // that does simualates a return.
   newRegisters.setIP(returnAddress);

Modified: vendor/llvm-libunwind/dist-release_80/src/assembly.h
==
--- vendor/llvm-libunwind/dist-release_80/src/assembly.hSat Jul  6 
15:34:01 2019(r349782)
+++ vendor/llvm-libunwind/dist-release_80/src/assembly.hSat Jul  6 
15:34:04 2019(r349783)
@@ -35,6 +35,20 @@
 #define SEPARATOR ;
 #endif
 
+#if defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1)
+#define PPC64_OPD1 .section .opd,"aw",@progbits SEPARATOR
+#define PPC64_OPD2 SEPARATOR \
+  .p2align 3 SEPARATOR \
+  .quad .Lfunc_begin0 SEPARATOR \
+  .quad .TOC.@tocbase SEPARATOR \
+  .quad 0 SEPARATOR \
+  .text SEPARATOR \
+.Lfunc_begin0:
+#else
+#define PPC64_OPD1
+#define PPC64_OPD2
+#endif
+
 #define GLUE2(a, b) a ## b
 #define GLUE(a, b) GLUE2(a, b)
 #define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name)
@@ -95,7 +109,9 @@
   .globl SYMBOL_NAME(name) SEPARATOR  \
   EXPORT_SYMBOL(name) SEPARATOR   \
   SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
-  SYMBOL_NAME(name):
+  PPC64_OPD1  \
+  SYMBOL_NAME(name):  \
+  PPC64_OPD2
 
 #define DEFINE_LIBUNWIND_PRIVATE_FUNCTION(name)   \
   .globl SYMBOL_NAME(name) SEPARATOR  \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349781 - vendor/compiler-rt/compiler-rt-release_80-r364487

2019-07-06 Thread Dimitry Andric
Author: dim
Date: Sat Jul  6 15:33:58 2019
New Revision: 349781
URL: https://svnweb.freebsd.org/changeset/base/349781

Log:
  Tag compiler-rt release_80 branch r364487.

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


svn commit: r349780 - vendor/clang/clang-release_80-r364487

2019-07-06 Thread Dimitry Andric
Author: dim
Date: Sat Jul  6 15:33:56 2019
New Revision: 349780
URL: https://svnweb.freebsd.org/changeset/base/349780

Log:
  Tag clang release_80 branch r364487.

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


svn commit: r349779 - in vendor/clang/dist-release_80: lib/AST lib/CodeGen lib/Driver/ToolChains/Arch test/CodeGenCXX test/Driver

2019-07-06 Thread Dimitry Andric
Author: dim
Date: Sat Jul  6 15:33:52 2019
New Revision: 349779
URL: https://svnweb.freebsd.org/changeset/base/349779

Log:
  Vendor import of clang release_80 branch r364487:
  https://llvm.org/svn/llvm-project/cfe/branches/release_80@364487

Added:
  
vendor/clang/dist-release_80/test/CodeGenCXX/debug-info-var-template-partial.cpp
Modified:
  vendor/clang/dist-release_80/lib/AST/MicrosoftMangle.cpp
  vendor/clang/dist-release_80/lib/CodeGen/CGDebugInfo.cpp
  vendor/clang/dist-release_80/lib/Driver/ToolChains/Arch/PPC.cpp
  vendor/clang/dist-release_80/test/CodeGenCXX/char8_t.cpp
  vendor/clang/dist-release_80/test/CodeGenCXX/debug-info-template-member.cpp
  vendor/clang/dist-release_80/test/Driver/netbsd.c

Modified: vendor/clang/dist-release_80/lib/AST/MicrosoftMangle.cpp
==
--- vendor/clang/dist-release_80/lib/AST/MicrosoftMangle.cppSat Jul  6 
15:33:49 2019(r349778)
+++ vendor/clang/dist-release_80/lib/AST/MicrosoftMangle.cppSat Jul  6 
15:33:52 2019(r349779)
@@ -1937,8 +1937,9 @@ void MicrosoftCXXNameMangler::mangleType(const Builtin
   // ::= _M # unsigned __int128
   // ::= _N # bool
   // _O # 
-  // ::= _T # __float80 (Intel)
+  // ::= _Q # char8_t
   // ::= _S # char16_t
+  // ::= _T # __float80 (Intel)
   // ::= _U # char32_t
   // ::= _W # wchar_t
   // ::= _Z # __float80 (Digital Mars)
@@ -1999,6 +2000,9 @@ void MicrosoftCXXNameMangler::mangleType(const Builtin
   case BuiltinType::Bool:
 Out << "_N";
 break;
+  case BuiltinType::Char8:
+Out << "_Q";
+break;
   case BuiltinType::Char16:
 Out << "_S";
 break;
@@ -2094,7 +2098,6 @@ void MicrosoftCXXNameMangler::mangleType(const Builtin
   case BuiltinType::SatUShortFract:
   case BuiltinType::SatUFract:
   case BuiltinType::SatULongFract:
-  case BuiltinType::Char8:
   case BuiltinType::Float128: {
 DiagnosticsEngine  = Context.getDiags();
 unsigned DiagID = Diags.getCustomDiagID(

Modified: vendor/clang/dist-release_80/lib/CodeGen/CGDebugInfo.cpp
==
--- vendor/clang/dist-release_80/lib/CodeGen/CGDebugInfo.cppSat Jul  6 
15:33:49 2019(r349778)
+++ vendor/clang/dist-release_80/lib/CodeGen/CGDebugInfo.cppSat Jul  6 
15:33:52 2019(r349779)
@@ -1817,32 +1817,24 @@ CGDebugInfo::CollectFunctionTemplateParams(const Funct
 }
 
 llvm::DINodeArray CGDebugInfo::CollectVarTemplateParams(const VarDecl *VL,
-llvm::DIFile *Unit) {
-  if (auto *TS = dyn_cast(VL)) {
-auto T = TS->getSpecializedTemplateOrPartial();
-auto TA = TS->getTemplateArgs().asArray();
-// Collect parameters for a partial specialization
-if (T.is()) {
-  const TemplateParameterList *TList =
-T.get()
-->getTemplateParameters();
-  return CollectTemplateParams(TList, TA, Unit);
-}
-
-// Collect parameters for an explicit specialization
-if (T.is()) {
-  const TemplateParameterList *TList = T.get()
-->getTemplateParameters();
-  return CollectTemplateParams(TList, TA, Unit);
-}
-  }
-  return llvm::DINodeArray();
+llvm::DIFile *Unit) {
+  // Always get the full list of parameters, not just the ones from the
+  // specialization. A partial specialization may have fewer parameters than
+  // there are arguments.
+  auto *TS = dyn_cast(VL);
+  if (!TS)
+return llvm::DINodeArray();
+  VarTemplateDecl *T = TS->getSpecializedTemplate();
+  const TemplateParameterList *TList = T->getTemplateParameters();
+  auto TA = TS->getTemplateArgs().asArray();
+  return CollectTemplateParams(TList, TA, Unit);
 }
 
 llvm::DINodeArray CGDebugInfo::CollectCXXTemplateParams(
 const ClassTemplateSpecializationDecl *TSpecial, llvm::DIFile *Unit) {
-  // Always get the full list of parameters, not just the ones from
-  // the specialization.
+  // Always get the full list of parameters, not just the ones from the
+  // specialization. A partial specialization may have fewer parameters than
+  // there are arguments.
   TemplateParameterList *TPList =
   TSpecial->getSpecializedTemplate()->getTemplateParameters();
   const TemplateArgumentList  = TSpecial->getTemplateArgs();

Modified: vendor/clang/dist-release_80/lib/Driver/ToolChains/Arch/PPC.cpp
==
--- vendor/clang/dist-release_80/lib/Driver/ToolChains/Arch/PPC.cpp Sat Jul 
 6 15:33:49 2019(r349778)
+++ vendor/clang/dist-release_80/lib/Driver/ToolChains/Arch/PPC.cpp Sat Jul 
 6 15:33:52 2019(r349779)
@@ -116,7 +116,7 @@ ppc::ReadGOTPtrMode ppc::getPPCReadGOTPtrMode(const Dr
   const ArgList ) 

svn commit: r349778 - vendor/llvm/llvm-release_80-r364487

2019-07-06 Thread Dimitry Andric
Author: dim
Date: Sat Jul  6 15:33:49 2019
New Revision: 349778
URL: https://svnweb.freebsd.org/changeset/base/349778

Log:
  Tag llvm release_80 branch r364487.

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


svn commit: r349777 - in head/sys: kern vm

2019-07-06 Thread Doug Moore
Author: dougm
Date: Sat Jul  6 06:15:03 2019
New Revision: 349777
URL: https://svnweb.freebsd.org/changeset/base/349777

Log:
  Change blist_next_leaf_alloc so that it can examine more than one leaf
  after the one where the possible block allocation begins, and allocate
  a larger number of blocks than the current limit. This does not affect
  the limit on minimum allocation size, which still cannot exceed
  BLIST_MAX_ALLOC.
  
  Use this change to modify swp_pager_getswapspace and its callers, so
  that they can allocate more than BLIST_MAX_ALLOC blocks if they are
  available.
  
  Tested by: pho
  Approved by: markj (mentor)
  Differential Revision: https://reviews.freebsd.org/D20579

Modified:
  head/sys/kern/subr_blist.c
  head/sys/vm/swap_pager.c

Modified: head/sys/kern/subr_blist.c
==
--- head/sys/kern/subr_blist.c  Sat Jul  6 01:00:28 2019(r349776)
+++ head/sys/kern/subr_blist.c  Sat Jul  6 06:15:03 2019(r349777)
@@ -121,6 +121,7 @@ __FBSDID("$FreeBSD$");
 #define malloc(a,b,c)  calloc(a, 1)
 #define free(a,b)  free(a)
 #define ummin(a,b) ((a) < (b) ? (a) : (b))
+#define imin(a,b)  ((a) < (b) ? (a) : (b))
 #define KASSERT(a,b)   assert(a)
 
 #include 
@@ -300,8 +301,8 @@ blist_alloc(blist_t bl, int *count, int maxcount)
 
KASSERT(*count <= maxcount,
("invalid parameters %d > %d", *count, maxcount));
-   KASSERT(maxcount <= BLIST_MAX_ALLOC,
-   ("allocation too large: %d", maxcount));
+   KASSERT(*count <= BLIST_MAX_ALLOC,
+   ("minimum allocation too large: %d", *count));
 
/*
 * This loop iterates at most twice.  An allocation failure in the
@@ -606,58 +607,79 @@ blist_stats(blist_t bl, struct sbuf *s)
  */
 
 /*
- * BLST_NEXT_LEAF_ALLOC() - allocate the first few blocks in the next leaf.
+ * BLST_NEXT_LEAF_ALLOC() - allocate the blocks starting with the next leaf.
  *
- * 'scan' is a leaf node, associated with a block containing 'blk'.
- * The next leaf node could be adjacent, or several nodes away if the
- * least common ancestor of 'scan' and its neighbor is several levels
- * up.  Use 'blk' to determine how many meta-nodes lie between the
- * leaves.  If the next leaf has enough initial bits set, clear them
- * and clear the bits in the meta nodes on the path up to the least
- * common ancestor to mark any subtrees made completely empty.
+ * 'scan' is a leaf node, and its first block is at address 'start'.  The
+ * next leaf node could be adjacent, or several nodes away if the least
+ * common ancestor of 'scan' and its neighbor is several levels up.  Use
+ * addresses to determine how many meta-nodes lie between the leaves.  If
+ * sequence of leaves starting with the next one has enough initial bits
+ * set, clear them and clear the bits in the meta nodes on the path up to
+ * the least common ancestor to mark any subtrees made completely empty.
  */
 static int
-blst_next_leaf_alloc(blmeta_t *scan, daddr_t blk, int count, int maxcount)
+blst_next_leaf_alloc(blmeta_t *scan, daddr_t start, int count, int maxcount)
 {
-   blmeta_t *next;
u_daddr_t radix;
+   daddr_t blk;
int avail, digit;
 
-   next = scan + 1;
-   blk += BLIST_BMAP_RADIX;
-   radix = BLIST_BMAP_RADIX;
-   while ((next->bm_bitmap & 1) == 1 &&
-   (digit = ((blk / radix) & BLIST_META_MASK)) == 0) {
-   next++;
-   radix *= BLIST_META_RADIX;
+   start += BLIST_BMAP_RADIX;
+   for (blk = start; blk - start < maxcount; blk += BLIST_BMAP_RADIX) {
+   /* Skip meta-nodes, as long as they promise more free blocks. */
+   radix = BLIST_BMAP_RADIX;
+   while (((++scan)->bm_bitmap & 1) == 1 &&
+   ((blk / radix) & BLIST_META_MASK) == 0)
+   radix *= BLIST_META_RADIX;
+   if (~scan->bm_bitmap != 0) {
+   /*
+* Either there is no next leaf with any free blocks,
+* or we've reached the next leaf and found that some
+* of its blocks are not free.  In the first case,
+* bitpos() returns zero here.
+*/
+   avail = blk - start + bitpos(~scan->bm_bitmap);
+   if (avail < count) {
+   /*
+* There isn't a next leaf with enough free
+* blocks at its beginning to complete the
+* spanning allocation.
+*/
+   return (avail);
+   }
+   maxcount = imin(avail, maxcount);
+   }
}
-   if ((next->bm_bitmap & 1) != 1)
-   return (0);
-   avail