svn commit: r366440 - head/tools/tools/cxgbtool

2020-10-04 Thread Navdeep Parhar
Author: np
Date: Mon Oct  5 06:53:29 2020
New Revision: 366440
URL: https://svnweb.freebsd.org/changeset/base/366440

Log:
  Get tools/tools/cxgbtool to build with the latest clang.
  
  Reported by:  olivier@

Modified:
  head/tools/tools/cxgbtool/Makefile

Modified: head/tools/tools/cxgbtool/Makefile
==
--- head/tools/tools/cxgbtool/Makefile  Mon Oct  5 06:38:56 2020
(r366439)
+++ head/tools/tools/cxgbtool/Makefile  Mon Oct  5 06:53:29 2020
(r366440)
@@ -6,5 +6,6 @@ MAN=
 CFLAGS+= -I${.CURDIR}/../../../sys/dev/cxgb -I.
 CFLAGS+= -DCONFIG_T3_REGS -DCHELSIO_INTERNAL
 BINDIR?= /usr/sbin
+WARNS?= 3
 
 .include 
___
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: r366439 - stable/12/sys/sys

2020-10-04 Thread Navdeep Parhar
Author: np
Date: Mon Oct  5 06:38:56 2020
New Revision: 366439
URL: https://svnweb.freebsd.org/changeset/base/366439

Log:
  MFC r365867:
  
  mbuf checksum flags and fields to support tunneling protocols.
  
  These are being added to support VXLAN but will work for GENEVE as well.
  ENCAP_RSVD1 will likely become ENCAP_GENEVE in the future.
  
  The size of struct mbuf does not change and that means this change can be 
MFC'd.
  If size wasn't a constraint a cleaner way may have been to add 
inner_csum_flags
  and inner_csum_data to go with csum_flags and csum_data.
  
  Reviewed by:  kib@
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D25873

Modified:
  stable/12/sys/sys/mbuf.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/sys/mbuf.h
==
--- stable/12/sys/sys/mbuf.hMon Oct  5 05:36:01 2020(r366438)
+++ stable/12/sys/sys/mbuf.hMon Oct  5 06:38:56 2020(r366439)
@@ -168,7 +168,10 @@ struct pkthdr {
uint8_t  l3hlen;/* layer 3 hdr len */
uint8_t  l4hlen;/* layer 4 hdr len */
uint8_t  l5hlen;/* layer 5 hdr len */
-   uint32_t spare;
+   uint8_t  inner_l2hlen;
+   uint8_t  inner_l3hlen;
+   uint8_t  inner_l4hlen;
+   uint8_t  inner_l5hlen;
};
};
union {
@@ -497,7 +500,13 @@ struct mbuf {
  * Outbound flags that are set by upper protocol layers requesting lower
  * layers, or ideally the hardware, to perform these offloading tasks.
  * For outbound packets this field and its flags can be directly tested
- * against ifnet if_hwassist.
+ * against ifnet if_hwassist.  Note that the outbound and the inbound flags do
+ * not collide right now but they could be allowed to (as long as the flags are
+ * scrubbed appropriately when the direction of an mbuf changes).  CSUM_BITS
+ * would also have to split into CSUM_BITS_TX and CSUM_BITS_RX.
+ *
+ * CSUM_INNER_ is the same as CSUM_ but it applies to the inner frame.
+ * The CSUM_ENCAP_ bits identify the outer encapsulation.
  */
 #defineCSUM_IP 0x0001  /* IP header checksum 
offload */
 #defineCSUM_IP_UDP 0x0002  /* UDP checksum offload 
*/
@@ -506,13 +515,28 @@ struct mbuf {
 #defineCSUM_IP_TSO 0x0010  /* TCP segmentation 
offload */
 #defineCSUM_IP_ISCSI   0x0020  /* iSCSI checksum 
offload */
 
+#defineCSUM_INNER_IP6_UDP  0x0040
+#defineCSUM_INNER_IP6_TCP  0x0080
+#defineCSUM_INNER_IP6_TSO  0x0100
 #defineCSUM_IP6_UDP0x0200  /* UDP checksum offload 
*/
 #defineCSUM_IP6_TCP0x0400  /* TCP checksum offload 
*/
 #defineCSUM_IP6_SCTP   0x0800  /* SCTP checksum 
offload */
 #defineCSUM_IP6_TSO0x1000  /* TCP segmentation 
offload */
 #defineCSUM_IP6_ISCSI  0x2000  /* iSCSI checksum 
offload */
 
+#defineCSUM_INNER_IP   0x4000
+#defineCSUM_INNER_IP_UDP   0x8000
+#defineCSUM_INNER_IP_TCP   0x0001
+#defineCSUM_INNER_IP_TSO   0x0002
+
+#defineCSUM_ENCAP_VXLAN0x0004  /* VXLAN outer 
encapsulation */
+#defineCSUM_ENCAP_RSVD10x0008
+
 /* Inbound checksum support where the checksum was verified by hardware. */
+#defineCSUM_INNER_L3_CALC  0x0010
+#defineCSUM_INNER_L3_VALID 0x0020
+#defineCSUM_INNER_L4_CALC  0x0040
+#defineCSUM_INNER_L4_VALID 0x0080
 #defineCSUM_L3_CALC0x0100  /* calculated layer 3 
csum */
 #defineCSUM_L3_VALID   0x0200  /* checksum is correct 
*/
 #defineCSUM_L4_CALC0x0400  /* calculated layer 4 
csum */
@@ -523,16 +547,31 @@ struct mbuf {
 
 #defineCSUM_SND_TAG0x8000  /* Packet header has 
send tag */
 
+#define CSUM_FLAGS_TX (CSUM_IP | CSUM_IP_UDP | CSUM_IP_TCP | CSUM_IP_SCTP | \
+CSUM_IP_TSO | CSUM_IP_ISCSI | CSUM_INNER_IP6_UDP | CSUM_INNER_IP6_TCP | \
+CSUM_INNER_IP6_TSO | CSUM_IP6_UDP | CSUM_IP6_TCP | CSUM_IP6_SCTP | \
+CSUM_IP6_TSO | CSUM_IP6_ISCSI | CSUM_INNER_IP | CSUM_INNER_IP_UDP | \
+CSUM_INNER_IP_TCP | CSUM_INNER_IP_TSO | CSUM_ENCAP_VXLAN | \
+CSUM_ENCAP_RSVD1 | CSUM_SND_TAG)
+
+#define CSUM_FLAGS_RX (CSUM_INNER_L3_CALC | CSUM_INNER_L3_VALID | \
+CSUM_INNER_L4_CALC | CSUM_INNER_L4_VALID | CSUM_L3_CALC | CSUM_L3_VALID | \
+CSUM_L4_CALC | CSUM_L4_VALID | CSUM_L5_CALC | CSUM_L5_VALID | \
+CSUM_C

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

2020-10-04 Thread Navdeep Parhar
Author: np
Date: Mon Oct  5 05:36:01 2020
New Revision: 366438
URL: https://svnweb.freebsd.org/changeset/base/366438

Log:
  MFC r366384:
  
  cxgbe(4): set up the firmware flowc for the tid before send_abort_rpl.

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

Modified: stable/12/sys/dev/cxgbe/tom/t4_listen.c
==
--- stable/12/sys/dev/cxgbe/tom/t4_listen.c Mon Oct  5 01:27:18 2020
(r366437)
+++ stable/12/sys/dev/cxgbe/tom/t4_listen.c Mon Oct  5 05:36:01 2020
(r366438)
@@ -341,48 +341,32 @@ release_lctx(struct adapter *sc, struct listen_ctx *lc
 }
 
 static void
-send_reset_synqe(struct toedev *tod, struct synq_entry *synqe)
+send_flowc_wr_synqe(struct adapter *sc, struct synq_entry *synqe)
 {
-   struct adapter *sc = tod->tod_softc;
struct mbuf *m = synqe->syn;
struct ifnet *ifp = m->m_pkthdr.rcvif;
struct vi_info *vi = ifp->if_softc;
struct port_info *pi = vi->pi;
-   struct l2t_entry *e = &sc->l2t->l2tab[synqe->params.l2t_idx];
struct wrqe *wr;
struct fw_flowc_wr *flowc;
-   struct cpl_abort_req *req;
-   int flowclen;
struct sge_wrq *ofld_txq;
struct sge_ofld_rxq *ofld_rxq;
const int nparams = 6;
+   const int flowclen = sizeof(*flowc) + nparams * sizeof(struct 
fw_flowc_mnemval);
const u_int pfvf = sc->pf << S_FW_VIID_PFN;
 
INP_WLOCK_ASSERT(synqe->lctx->inp);
+   MPASS((synqe->flags & TPF_FLOWC_WR_SENT) == 0);
 
-   CTR5(KTR_CXGBE, "%s: synqe %p (0x%x), tid %d%s",
-   __func__, synqe, synqe->flags, synqe->tid,
-   synqe->flags & TPF_ABORT_SHUTDOWN ?
-   " (abort already in progress)" : "");
-   if (synqe->flags & TPF_ABORT_SHUTDOWN)
-   return; /* abort already in progress */
-   synqe->flags |= TPF_ABORT_SHUTDOWN;
-
ofld_txq = &sc->sge.ofld_txq[synqe->params.txq_idx];
ofld_rxq = &sc->sge.ofld_rxq[synqe->params.rxq_idx];
 
-   /* The wrqe will have two WRs - a flowc followed by an abort_req */
-   flowclen = sizeof(*flowc) + nparams * sizeof(struct fw_flowc_mnemval);
-
-   wr = alloc_wrqe(roundup2(flowclen, EQ_ESIZE) + sizeof(*req), ofld_txq);
+   wr = alloc_wrqe(roundup2(flowclen, 16), ofld_txq);
if (wr == NULL) {
/* XXX */
panic("%s: allocation failure.", __func__);
}
flowc = wrtod(wr);
-   req = (void *)((caddr_t)flowc + roundup2(flowclen, EQ_ESIZE));
-
-   /* First the flowc ... */
memset(flowc, 0, wr->wr_len);
flowc->op_to_nparams = htobe32(V_FW_WR_OP(FW_FLOWC_WR) |
V_FW_FLOWC_WR_NPARAMS(nparams));
@@ -396,19 +380,47 @@ send_reset_synqe(struct toedev *tod, struct synq_entry
flowc->mnemval[2].val = htobe32(pi->tx_chan);
flowc->mnemval[3].mnemonic = FW_FLOWC_MNEM_IQID;
flowc->mnemval[3].val = htobe32(ofld_rxq->iq.abs_id);
-   flowc->mnemval[4].mnemonic = FW_FLOWC_MNEM_SNDBUF;
-   flowc->mnemval[4].val = htobe32(512);
-   flowc->mnemval[5].mnemonic = FW_FLOWC_MNEM_MSS;
-   flowc->mnemval[5].val = htobe32(512);
+   flowc->mnemval[4].mnemonic = FW_FLOWC_MNEM_SNDBUF;
+   flowc->mnemval[4].val = htobe32(512);
+   flowc->mnemval[5].mnemonic = FW_FLOWC_MNEM_MSS;
+   flowc->mnemval[5].val = htobe32(512);
+
synqe->flags |= TPF_FLOWC_WR_SENT;
+   t4_wrq_tx(sc, wr);
+}
 
-   /* ... then ABORT request */
+static void
+send_reset_synqe(struct toedev *tod, struct synq_entry *synqe)
+{
+   struct adapter *sc = tod->tod_softc;
+   struct wrqe *wr;
+   struct cpl_abort_req *req;
+
+   INP_WLOCK_ASSERT(synqe->lctx->inp);
+
+   CTR5(KTR_CXGBE, "%s: synqe %p (0x%x), tid %d%s",
+   __func__, synqe, synqe->flags, synqe->tid,
+   synqe->flags & TPF_ABORT_SHUTDOWN ?
+   " (abort already in progress)" : "");
+   if (synqe->flags & TPF_ABORT_SHUTDOWN)
+   return; /* abort already in progress */
+   synqe->flags |= TPF_ABORT_SHUTDOWN;
+
+   if (!(synqe->flags & TPF_FLOWC_WR_SENT))
+   send_flowc_wr_synqe(sc, synqe);
+
+   wr = alloc_wrqe(sizeof(*req), &sc->sge.ofld_txq[synqe->params.txq_idx]);
+   if (wr == NULL) {
+   /* XXX */
+   panic("%s: allocation failure.", __func__);
+   }
+   req = wrtod(wr);
INIT_TP_WR_MIT_CPL(req, CPL_ABORT_REQ, synqe->tid);
req->rsvd0 = 0; /* don't have a snd_nxt */
req->rsvd1 = 1; /* no data sent yet */
req->cmd = CPL_ABORT_SEND_RST;
 
-   t4_l2t_send(sc, wr, e);
+   t4_l2t_send(sc, wr, &sc->l2t->l2tab[synqe->params.l2t_idx]);
 }
 
 static int
@@ -888,6 +900,9 @@ do_abort_req_synqe(struct sge_iq *iq, const struct rss
INP_WLOCK(inp);
 
ofld_txq = &sc->sge.ofld_txq[synqe->params.txq_idx];
+
+   if (!(synqe->flags &

svn commit: r366437 - stable/11/stand/man

2020-10-04 Thread Mateusz Piotrowski
Author: 0mp (doc,ports committer)
Date: Mon Oct  5 01:27:18 2020
New Revision: 366437
URL: https://svnweb.freebsd.org/changeset/base/366437

Log:
  MFC r366364:
  
  Correct the documented size of kern.msgbufsize
  
  The correct value is 96KB after r226090.
  
  PR:   249971
  Submitted by: johan...@jo-t.de

Modified:
  stable/11/stand/man/loader.8
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/man/loader.8
==
--- stable/11/stand/man/loader.8Mon Oct  5 01:26:34 2020
(r366436)
+++ stable/11/stand/man/loader.8Mon Oct  5 01:27:18 2020
(r366437)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 20, 2019
+.Dd October 2, 2020
 .Dt LOADER 8
 .Os
 .Sh NAME
@@ -646,7 +646,7 @@ Modifies
 .Dv VM_BCACHE_SIZE_MAX .
 .It Va kern.msgbufsize
 Sets the size of the kernel message buffer.
-The default limit of 64KB is usually sufficient unless
+The default limit of 96KB is usually sufficient unless
 large amounts of trace data need to be collected
 between opportunities to examine the buffer or
 dump it to a file.
___
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: r366436 - stable/12/stand/man

2020-10-04 Thread Mateusz Piotrowski
Author: 0mp (doc,ports committer)
Date: Mon Oct  5 01:26:34 2020
New Revision: 366436
URL: https://svnweb.freebsd.org/changeset/base/366436

Log:
  MFC r366364:
  
  Correct the documented size of kern.msgbufsize
  
  The correct value is 96KB after r226090.
  
  PR:   249971
  Submitted by: johan...@jo-t.de

Modified:
  stable/12/stand/man/loader.8
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/man/loader.8
==
--- stable/12/stand/man/loader.8Sun Oct  4 22:41:43 2020
(r366435)
+++ stable/12/stand/man/loader.8Mon Oct  5 01:26:34 2020
(r366436)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 15, 2018
+.Dd October 2, 2020
 .Dt LOADER 8
 .Os
 .Sh NAME
@@ -646,7 +646,7 @@ Modifies
 .Dv VM_BCACHE_SIZE_MAX .
 .It Va kern.msgbufsize
 Sets the size of the kernel message buffer.
-The default limit of 64KB is usually sufficient unless
+The default limit of 96KB is usually sufficient unless
 large amounts of trace data need to be collected
 between opportunities to examine the buffer or
 dump it to a file.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r366429 - in head/sys: kern sys

2020-10-04 Thread Konstantin Belousov
On Sun, Oct 04, 2020 at 09:06:02PM +, Rick Macklem wrote:
> Mateusz Guzik wrote:
> >Why is the process lock always taken? It looks like both routines just
> >check a thread-local flag, so perhaps this can get away without
> >serializing this process-wide?
> I did spot this slight difference between the initial version of sig_intr() 
> and
> this one.  At least w.r.t. copy_file_range(2), the call happens infrequently
> enough that the overhead of acquiring the lock is not significant.
> 
Yes, the function should not be on any frequent path.

That said, all signal delivery to process is covered by the process lock,
so checks under process lock make the advisory answer provide less false
negatives.  If considered too importand in some cases (when ?), the following
patch can be applied.

diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 8108d4cb3a5..ed4dd52b66d 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -3212,6 +3212,9 @@ sig_intr(void)
int ret;
 
td = curthread;
+   if ((td->td_flags & (TDF_NEEDSIGCHK | TDF_NEEDSUSPCHK)) == 0)
+   return (0);
+
p = td->td_proc;
 
PROC_LOCK(p);
___
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: r366435 - in head: . stand/lua

2020-10-04 Thread Kyle Evans
Author: kevans
Date: Sun Oct  4 22:41:43 2020
New Revision: 366435
URL: https://svnweb.freebsd.org/changeset/base/366435

Log:
  lualoader: improve the design of the brand-/logo- mechanism
  
  In the previous world order, any brand/logo was forced to pull in the
  drawer and call drawer.add{Brand,Logo} with the name their brand/logo is
  taking and a table describing it.
  
  In the new world order, these files just need to return a table that maps
  out graphics types to a table of the exact same format as what was
  previously being passed back into the drawer. The appeal here is not needing
  to grab a reference back to the drawer module and having a cleaner
  data-driven looking format for these. The format has been renamed to 'gfx-*'
  prefixes and each one can provide a logo and a brand.
  
  drawer.addBrand/drawer.addLogo will remain in place until FreeBSD 13, as
  there's no overhead to them and it's not yet worth the break in
  compatibility with any pre-existing brands and logos.
  
  Reviewed by:  freqlabs
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D24966

Added:
  head/stand/lua/gfx-beastie.lua
 - copied, changed from r366434, head/stand/lua/logo-beastie.lua
  head/stand/lua/gfx-beastiebw.lua
 - copied, changed from r366434, head/stand/lua/logo-beastiebw.lua
  head/stand/lua/gfx-fbsdbw.lua
 - copied, changed from r366434, head/stand/lua/logo-fbsdbw.lua
  head/stand/lua/gfx-orb.lua
 - copied, changed from r366434, head/stand/lua/logo-orb.lua
  head/stand/lua/gfx-orbbw.lua
 - copied, changed from r366434, head/stand/lua/logo-orbbw.lua
Deleted:
  head/stand/lua/logo-beastie.lua
  head/stand/lua/logo-beastiebw.lua
  head/stand/lua/logo-fbsdbw.lua
  head/stand/lua/logo-orb.lua
  head/stand/lua/logo-orbbw.lua
Modified:
  head/ObsoleteFiles.inc
  head/stand/lua/Makefile
  head/stand/lua/drawer.lua

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Sun Oct  4 19:59:12 2020(r366434)
+++ head/ObsoleteFiles.inc  Sun Oct  4 22:41:43 2020(r366435)
@@ -36,6 +36,13 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20201004: logo files renamed to type-agnostic gfx-*.lua
+OLD_FILES+=boot/lua/logo-beastie.lua
+OLD_FILES+=boot/lua/logo-beastiebw.lua
+OLD_FILES+=boot/lua/logo-fbsdbw.lua
+OLD_FILES+=boot/lua/logo-orb.lua
+OLD_FILES+=boot/lua/logo-orbbw.lua
+
 # 20200923: memfd_test moved to /usr/tests/sys/posixshm
 OLD_FILES+=usr/tests/sys/kern/memfd_test
 

Modified: head/stand/lua/Makefile
==
--- head/stand/lua/Makefile Sun Oct  4 19:59:12 2020(r366434)
+++ head/stand/lua/Makefile Sun Oct  4 22:41:43 2020(r366435)
@@ -20,11 +20,11 @@ FILES=  cli.lua \
drawer.lua \
hook.lua \
loader.lua \
-   logo-beastie.lua \
-   logo-beastiebw.lua \
-   logo-fbsdbw.lua \
-   logo-orb.lua \
-   logo-orbbw.lua \
+   gfx-beastie.lua \
+   gfx-beastiebw.lua \
+   gfx-fbsdbw.lua \
+   gfx-orb.lua \
+   gfx-orbbw.lua \
menu.lua \
password.lua \
screen.lua

Modified: head/stand/lua/drawer.lua
==
--- head/stand/lua/drawer.lua   Sun Oct  4 19:59:12 2020(r366434)
+++ head/stand/lua/drawer.lua   Sun Oct  4 22:41:43 2020(r366435)
@@ -61,6 +61,35 @@ local function menuEntryName(drawing_menu, entry)
return entry.name
 end
 
+local function processFile(gfxname)
+   if gfxname == nil then
+   return false, "Missing filename"
+   end
+
+   local ret = try_include('gfx-' .. gfxname)
+   if ret == nil then
+   return false, "Failed to include gfx-" .. gfxname
+   end
+
+   -- Legacy format
+   if type(ret) ~= "table" then
+   return true
+   end
+
+   for gfxtype, def in pairs(ret) do
+   if gfxtype == "brand" then
+   drawer.addBrand(gfxname, def)
+   elseif gfxtype == "logo" then
+   drawer.addLogo(gfxname, def)
+   else
+   return false, "Unknown graphics type '" .. gfxtype ..
+   "'"
+   end
+   end
+
+   return true
+end
+
 local function getBranddef(brand)
if brand == nil then
return nil
@@ -70,7 +99,18 @@ local function getBranddef(brand)
 
-- Try to pull it in
if branddef == nil then
-   try_include('brand-' .. brand)
+   local res, err = processFile(brand)
+   if not res then
+   -- This fallback should go away after FreeBSD 13.
+  

Re: svn commit: r366429 - in head/sys: kern sys

2020-10-04 Thread Rick Macklem
Mateusz Guzik wrote:
>Why is the process lock always taken? It looks like both routines just
>check a thread-local flag, so perhaps this can get away without
>serializing this process-wide?
I did spot this slight difference between the initial version of sig_intr() and
this one.  At least w.r.t. copy_file_range(2), the call happens infrequently
enough that the overhead of acquiring the lock is not significant.

rick

On 10/4/20, Konstantin Belousov  wrote:
> Author: kib
> Date: Sun Oct  4 16:33:42 2020
> New Revision: 366429
> URL: https://svnweb.freebsd.org/changeset/base/366429
>
> Log:
>   Add sig_intr(9).
>
>   It gives the answer would the thread sleep according to current state
>   of signals and suspensions.  Of course the answer is racy and allows
>   for false-negatives (no sleep when signal is delivered after process
>   lock is dropped).  Also the answer might change due to signal
>   rescheduling among threads in multi-threaded process.
>
>   Still it is the best approximation I can provide, to answering the
>   question was the thread interrupted.
>
>   Reviewed by:markj
>   Tested by:  pho, rmacklem
>   Sponsored by:   The FreeBSD Foundation
>   MFC after:  2 weeks
>   Differential revision:  https://reviews.freebsd.org/D26628
>
> Modified:
>   head/sys/kern/kern_sig.c
>   head/sys/sys/signalvar.h
>
> Modified: head/sys/kern/kern_sig.c
> ==
> --- head/sys/kern/kern_sig.c  Sun Oct  4 16:30:05 2020(r366428)
> +++ head/sys/kern/kern_sig.c  Sun Oct  4 16:33:42 2020(r366429)
> @@ -3204,6 +3204,24 @@ sig_ast_needsigchk(struct thread *td)
>   return (ret);
>  }
>
> +int
> +sig_intr(void)
> +{
> + struct thread *td;
> + struct proc *p;
> + int ret;
> +
> + td = curthread;
> + p = td->td_proc;
> +
> + PROC_LOCK(p);
> + ret = sig_ast_checksusp(td);
> + if (ret == 0)
> + ret = sig_ast_needsigchk(td);
> + PROC_UNLOCK(p);
> + return (ret);
> +}
> +
>  void
>  proc_wkilled(struct proc *p)
>  {
>
> Modified: head/sys/sys/signalvar.h
> ==
> --- head/sys/sys/signalvar.h  Sun Oct  4 16:30:05 2020(r366428)
> +++ head/sys/sys/signalvar.h  Sun Oct  4 16:33:42 2020(r366429)
> @@ -408,6 +408,7 @@ int   sig_ffs(sigset_t *set);
>  void sigfastblock_clear(struct thread *td);
>  void sigfastblock_fetch(struct thread *td);
>  void sigfastblock_setpend(struct thread *td, bool resched);
> +int  sig_intr(void);
>  void siginit(struct proc *p);
>  void signotify(struct thread *td);
>  void sigqueue_delete(struct sigqueue *queue, int sig);
> ___
> 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"
>


--
Mateusz Guzik 
___
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: r366434 - stable/12/sys/arm/broadcom/bcm2835

2020-10-04 Thread Kyle Evans
Author: kevans
Date: Sun Oct  4 19:59:12 2020
New Revision: 366434
URL: https://svnweb.freebsd.org/changeset/base/366434

Log:
  MFC r362421: raspberry pi 4: cpufreq support
  
  The submitter notes that the bcm2835_cpufreq driver really just needs the
  rpi4 compat string added to it; powerd subsequently works and the dev.cpu.0
  sysctl values look sane and can be successfully manipulated.

Modified:
  stable/12/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c
==
--- stable/12/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.cSun Oct  4 
19:37:15 2020(r366433)
+++ stable/12/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.cSun Oct  4 
19:59:12 2020(r366434)
@@ -129,6 +129,7 @@ static struct ofw_compat_data compat_data[] = {
{ "brcm,bcm2835",   1 },
{ "brcm,bcm2836",   1 },
{ "brcm,bcm2837",   1 },
+   { "brcm,bcm2711",   1 },
{ NULL, 0 }
 };
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366433 - in head/sys: contrib/ipfilter/netinet x86/bios

2020-10-04 Thread Ryan Moeller
Author: freqlabs
Date: Sun Oct  4 19:37:15 2020
New Revision: 366433
URL: https://svnweb.freebsd.org/changeset/base/366433

Log:
  Explicit CTLFLAG_DYN not needed
  
  Dynamically created OIDs automatically get this flag set.
  
  Reviewed by:  jhb
  MFC after:1 week
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D26561

Modified:
  head/sys/contrib/ipfilter/netinet/mlfk_ipl.c
  head/sys/x86/bios/vpd.c

Modified: head/sys/contrib/ipfilter/netinet/mlfk_ipl.c
==
--- head/sys/contrib/ipfilter/netinet/mlfk_ipl.cSun Oct  4 17:23:39 
2020(r366432)
+++ head/sys/contrib/ipfilter/netinet/mlfk_ipl.cSun Oct  4 19:37:15 
2020(r366433)
@@ -88,19 +88,19 @@ SYSCTL_DECL(_net_inet);
 ptr, val, sysctl_ipf_int, "I", descr)
 #define SYSCTL_DYN_IPF_NAT(parent, nbr, name, access,ptr, val, descr) \
 SYSCTL_ADD_OID(&ipf_clist, SYSCTL_STATIC_CHILDREN(parent), nbr, name, \
-CTLFLAG_DYN | CTLTYPE_INT | CTLFLAG_VNET | CTLFLAG_MPSAFE |access, \
+CTLTYPE_INT | CTLFLAG_VNET | CTLFLAG_MPSAFE |access, \
 ptr, val, sysctl_ipf_int_nat, "I", descr)
 #define SYSCTL_DYN_IPF_STATE(parent, nbr, name, access,ptr, val, descr) \
 SYSCTL_ADD_OID(&ipf_clist, SYSCTL_STATIC_CHILDREN(parent), nbr, name, \
-CTLFLAG_DYN | CTLTYPE_INT | CTLFLAG_VNET | CTLFLAG_MPSAFE | access, \
+CTLTYPE_INT | CTLFLAG_VNET | CTLFLAG_MPSAFE | access, \
 ptr, val, sysctl_ipf_int_state, "I", descr)
 #define SYSCTL_DYN_IPF_FRAG(parent, nbr, name, access,ptr, val, descr) \
 SYSCTL_ADD_OID(&ipf_clist, SYSCTL_STATIC_CHILDREN(parent), nbr, name, \
-CTLFLAG_DYN | CTLTYPE_INT | CTLFLAG_VNET | CTLFLAG_MPSAFE | access, \
+CTLTYPE_INT | CTLFLAG_VNET | CTLFLAG_MPSAFE | access, \
ptr, val, sysctl_ipf_int_frag, "I", descr)
 #define SYSCTL_DYN_IPF_AUTH(parent, nbr, name, access,ptr, val, descr) \
 SYSCTL_ADD_OID(&ipf_clist, SYSCTL_STATIC_CHILDREN(parent), nbr, name, \
-CTLFLAG_DYN | CTLTYPE_INT | CTLFLAG_VNET | CTLFLAG_MPSAFE | access, \
+CTLTYPE_INT | CTLFLAG_VNET | CTLFLAG_MPSAFE | access, \
ptr, val, sysctl_ipf_int_auth, "I", descr)
 static struct sysctl_ctx_list ipf_clist;
 #defineCTLFLAG_OFF 0x0080  /* IPFilter must be disabled */

Modified: head/sys/x86/bios/vpd.c
==
--- head/sys/x86/bios/vpd.c Sun Oct  4 17:23:39 2020(r366432)
+++ head/sys/x86/bios/vpd.c Sun Oct  4 19:37:15 2020(r366433)
@@ -210,19 +210,19 @@ vpd_attach (device_t dev)
sysctl_ctx_init(&sc->ctx);
SYSCTL_ADD_STRING(&sc->ctx,
SYSCTL_STATIC_CHILDREN(_hw_vpd_machine_type), OID_AUTO,
-   unit, CTLFLAG_RD|CTLFLAG_DYN, sc->MachineType, 0, NULL);
+   unit, CTLFLAG_RD, sc->MachineType, 0, NULL);
SYSCTL_ADD_STRING(&sc->ctx,
SYSCTL_STATIC_CHILDREN(_hw_vpd_machine_model), OID_AUTO,
-   unit, CTLFLAG_RD|CTLFLAG_DYN, sc->MachineModel, 0, NULL);
+   unit, CTLFLAG_RD, sc->MachineModel, 0, NULL);
SYSCTL_ADD_STRING(&sc->ctx,
SYSCTL_STATIC_CHILDREN(_hw_vpd_build_id), OID_AUTO,
-   unit, CTLFLAG_RD|CTLFLAG_DYN, sc->BuildID, 0, NULL);
+   unit, CTLFLAG_RD, sc->BuildID, 0, NULL);
SYSCTL_ADD_STRING(&sc->ctx,
SYSCTL_STATIC_CHILDREN(_hw_vpd_serial_box), OID_AUTO,
-   unit, CTLFLAG_RD|CTLFLAG_DYN, sc->BoxSerial, 0, NULL);
+   unit, CTLFLAG_RD, sc->BoxSerial, 0, NULL);
SYSCTL_ADD_STRING(&sc->ctx,
SYSCTL_STATIC_CHILDREN(_hw_vpd_serial_planar), OID_AUTO,
-   unit, CTLFLAG_RD|CTLFLAG_DYN, sc->PlanarSerial, 0, NULL);
+   unit, CTLFLAG_RD, sc->PlanarSerial, 0, NULL);
 
device_printf(dev, "Machine Type: %.4s, Model: %.3s, Build ID: %.9s\n",
sc->MachineType, sc->MachineModel, sc->BuildID);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r366429 - in head/sys: kern sys

2020-10-04 Thread Mateusz Guzik
Why is the process lock always taken? It looks like both routines just
check a thread-local flag, so perhaps this can get away without
serializing this process-wide?

On 10/4/20, Konstantin Belousov  wrote:
> Author: kib
> Date: Sun Oct  4 16:33:42 2020
> New Revision: 366429
> URL: https://svnweb.freebsd.org/changeset/base/366429
>
> Log:
>   Add sig_intr(9).
>
>   It gives the answer would the thread sleep according to current state
>   of signals and suspensions.  Of course the answer is racy and allows
>   for false-negatives (no sleep when signal is delivered after process
>   lock is dropped).  Also the answer might change due to signal
>   rescheduling among threads in multi-threaded process.
>
>   Still it is the best approximation I can provide, to answering the
>   question was the thread interrupted.
>
>   Reviewed by:markj
>   Tested by:  pho, rmacklem
>   Sponsored by:   The FreeBSD Foundation
>   MFC after:  2 weeks
>   Differential revision:  https://reviews.freebsd.org/D26628
>
> Modified:
>   head/sys/kern/kern_sig.c
>   head/sys/sys/signalvar.h
>
> Modified: head/sys/kern/kern_sig.c
> ==
> --- head/sys/kern/kern_sig.c  Sun Oct  4 16:30:05 2020(r366428)
> +++ head/sys/kern/kern_sig.c  Sun Oct  4 16:33:42 2020(r366429)
> @@ -3204,6 +3204,24 @@ sig_ast_needsigchk(struct thread *td)
>   return (ret);
>  }
>
> +int
> +sig_intr(void)
> +{
> + struct thread *td;
> + struct proc *p;
> + int ret;
> +
> + td = curthread;
> + p = td->td_proc;
> +
> + PROC_LOCK(p);
> + ret = sig_ast_checksusp(td);
> + if (ret == 0)
> + ret = sig_ast_needsigchk(td);
> + PROC_UNLOCK(p);
> + return (ret);
> +}
> +
>  void
>  proc_wkilled(struct proc *p)
>  {
>
> Modified: head/sys/sys/signalvar.h
> ==
> --- head/sys/sys/signalvar.h  Sun Oct  4 16:30:05 2020(r366428)
> +++ head/sys/sys/signalvar.h  Sun Oct  4 16:33:42 2020(r366429)
> @@ -408,6 +408,7 @@ int   sig_ffs(sigset_t *set);
>  void sigfastblock_clear(struct thread *td);
>  void sigfastblock_fetch(struct thread *td);
>  void sigfastblock_setpend(struct thread *td, bool resched);
> +int  sig_intr(void);
>  void siginit(struct proc *p);
>  void signotify(struct thread *td);
>  void sigqueue_delete(struct sigqueue *queue, int sig);
> ___
> 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"
>


-- 
Mateusz Guzik 
___
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: r366432 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src sys

2020-10-04 Thread Hans Petter Selasky
Author: hselasky
Date: Sun Oct  4 17:23:39 2020
New Revision: 366432
URL: https://svnweb.freebsd.org/changeset/base/366432

Log:
  Populate the acquire context field of a ww_mutex in the LinuxKPI.
  Bump the FreeBSD version to force recompilation of external kernel modules.
  
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D26657
  Submitted by: greg_unrelenting.technology (Greg V)
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/compat/linuxkpi/common/include/linux/ww_mutex.h
  head/sys/compat/linuxkpi/common/src/linux_lock.c
  head/sys/sys/param.h

Modified: head/sys/compat/linuxkpi/common/include/linux/ww_mutex.h
==
--- head/sys/compat/linuxkpi/common/include/linux/ww_mutex.hSun Oct  4 
17:17:16 2020(r366431)
+++ head/sys/compat/linuxkpi/common/include/linux/ww_mutex.hSun Oct  4 
17:23:39 2020(r366432)
@@ -76,7 +76,8 @@ ww_mutex_trylock(struct ww_mutex *lock)
return (mutex_trylock(&lock->base));
 }
 
-extern int linux_ww_mutex_lock_sub(struct ww_mutex *, int catch_signal);
+extern int linux_ww_mutex_lock_sub(struct ww_mutex *,
+struct ww_acquire_ctx *, int catch_signal);
 
 static inline int
 ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
@@ -86,7 +87,7 @@ ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire
else if ((struct thread *)SX_OWNER(lock->base.sx.sx_lock) == curthread)
return (-EALREADY);
else
-   return (linux_ww_mutex_lock_sub(lock, 0));
+   return (linux_ww_mutex_lock_sub(lock, ctx, 0));
 }
 
 static inline int
@@ -97,7 +98,7 @@ ww_mutex_lock_interruptible(struct ww_mutex *lock, str
else if ((struct thread *)SX_OWNER(lock->base.sx.sx_lock) == curthread)
return (-EALREADY);
else
-   return (linux_ww_mutex_lock_sub(lock, 1));
+   return (linux_ww_mutex_lock_sub(lock, ctx, 1));
 }
 
 extern void linux_ww_mutex_unlock_sub(struct ww_mutex *);

Modified: head/sys/compat/linuxkpi/common/src/linux_lock.c
==
--- head/sys/compat/linuxkpi/common/src/linux_lock.cSun Oct  4 17:17:16 
2020(r366431)
+++ head/sys/compat/linuxkpi/common/src/linux_lock.cSun Oct  4 17:23:39 
2020(r366432)
@@ -71,7 +71,8 @@ linux_ww_unlock(void)
 
 /* lock a mutex with deadlock avoidance */
 int
-linux_ww_mutex_lock_sub(struct ww_mutex *lock, int catch_signal)
+linux_ww_mutex_lock_sub(struct ww_mutex *lock,
+struct ww_acquire_ctx *ctx, int catch_signal)
 {
struct task_struct *task;
struct ww_mutex_thread entry;
@@ -126,6 +127,9 @@ done:
if ((struct thread *)SX_OWNER(lock->base.sx.sx_lock) == NULL)
cv_signal(&lock->condvar);
}
+
+   if (retval == 0)
+   lock->ctx = ctx;
linux_ww_unlock();
return (retval);
 }
@@ -135,6 +139,7 @@ linux_ww_mutex_unlock_sub(struct ww_mutex *lock)
 {
/* protect ww_mutex ownership change */
linux_ww_lock();
+   lock->ctx = NULL;
sx_xunlock(&lock->base.sx);
/* wakeup a lock waiter, if any */
cv_signal(&lock->condvar);

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hSun Oct  4 17:17:16 2020(r366431)
+++ head/sys/sys/param.hSun Oct  4 17:23:39 2020(r366432)
@@ -60,7 +60,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1300118  /* Master, propagated to newvers */
+#define __FreeBSD_version 1300119  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
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: r366431 - head/sys/dev/usb/serial

2020-10-04 Thread Hans Petter Selasky
Author: hselasky
Date: Sun Oct  4 17:17:16 2020
New Revision: 366431
URL: https://svnweb.freebsd.org/changeset/base/366431

Log:
  Add support for Google Cr50 (GSC) Closed Case Debugging UART interfaces to
  the USB generic serial port driver, ugensa.
  
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D21863
  Submitted by: greg_unrelenting.technology (Greg V)
  Sponsored by: Mellanox Technologies // NVIDIA Networking

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

Modified: head/sys/dev/usb/serial/ugensa.c
==
--- head/sys/dev/usb/serial/ugensa.cSun Oct  4 17:07:13 2020
(r366430)
+++ head/sys/dev/usb/serial/ugensa.cSun Oct  4 17:17:16 2020
(r366431)
@@ -161,6 +161,8 @@ static const STRUCT_USB_HOST_ID ugensa_devs[] = {
{USB_VPI(USB_VENDOR_KYOCERA2, USB_PRODUCT_KYOCERA2_CDMA_MSM_K, 1)},
{USB_VPI(USB_VENDOR_HP, USB_PRODUCT_HP_49GPLUS, 1)},
{USB_VPI(USB_VENDOR_NOVATEL2, USB_PRODUCT_NOVATEL2_FLEXPACKGPS, 3)},
+   {USB_VENDOR(USB_VENDOR_GOOGLE), USB_IFACE_CLASS(UICLASS_VENDOR),
+   USB_IFACE_SUBCLASS(0x50), USB_IFACE_PROTOCOL(0x01), 
USB_DRIVER_INFO(10)},
 };
 
 DRIVER_MODULE(ugensa, uhub, ugensa_driver, ugensa_devclass, NULL, 0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366430 - head/usr.sbin/ngctl

2020-10-04 Thread Kyle Evans
Author: kevans
Date: Sun Oct  4 17:07:13 2020
New Revision: 366430
URL: https://svnweb.freebsd.org/changeset/base/366430

Log:
  ngctl: add -c (compact output) for the dot command
  
  The output of "ngctl dot" is suitable for small netgraph networks. Even
  moderate complex netgraph setups (about a dozen nodes) are hard to
  understand from the .dot output, because each node and each hook are shown
  as a full blown structure.
  
  This patch allows to generate much more compact output and graphs by
  omitting the extra structures for the individual hooks. Instead the names of
  the hooks are labels to the edges.
  
  Submitted by: Lutz Donnerhacke 
  Reviewed by:  markj
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D21965

Modified:
  head/usr.sbin/ngctl/dot.c

Modified: head/usr.sbin/ngctl/dot.c
==
--- head/usr.sbin/ngctl/dot.c   Sun Oct  4 16:33:42 2020(r366429)
+++ head/usr.sbin/ngctl/dot.c   Sun Oct  4 17:07:13 2020(r366430)
@@ -2,6 +2,7 @@
 /*
  * dot.c
  *
+ * Copyright (c) 2019 Lutz Donnerhacke
  * Copyright (c) 2004 Brian Fundakowski Feldman
  * Copyright (c) 1996-1999 Whistle Communications, Inc.
  * All rights reserved.
@@ -53,9 +54,11 @@ static int DotCmd(int ac, char **av);
 
 const struct ngcmd dot_cmd = {
DotCmd,
-   "dot [outputfile]",
+   "dot [-c] [outputfile]",
"Produce a GraphViz (.dot) of the entire netgraph.",
-   "If no outputfile is specified, stdout will be assumed.",
+   "If no outputfile is specified, stdout will be assumed."
+   " The optional -c argument generates a graph without separate"
+   " structures for edge names. Such a graph is more compact.",
{ "graphviz", "confdot" }
 };
 
@@ -66,12 +69,16 @@ DotCmd(int ac, char **av)
struct namelist *nlist;
FILE *f = stdout;
int ch;
+   int compact = 0;
u_int i;
 
/* Get options */
optind = 1;
-   while ((ch = getopt(ac, av, "")) != -1) {
+   while ((ch = getopt(ac, av, "c")) != -1) {
switch (ch) {
+   case 'c':
+   compact = 1;
+   break;
case '?':
default:
return (CMDRTN_USAGE);
@@ -109,9 +116,14 @@ DotCmd(int ac, char **av)
}
 
nlist = (struct namelist *)nlresp->data;
-   fprintf(f, "graph netgraph {\n");
-   /* TODO: implement rank = same or subgraphs at some point */
-   fprintf(f, "\tedge [ weight = 1.0 ];\n");
+   if (compact) {
+   fprintf(f, "digraph netgraph {\n");
+   fprintf(f, "\tedge [ dir = \"none\", fontsize = 10 ];\n");
+   } else {
+   fprintf(f, "graph netgraph {\n");
+   /* TODO: implement rank = same or subgraphs at some point */
+   fprintf(f, "\tedge [ weight = 1.0 ];\n");
+   }
fprintf(f, "\tnode [ shape = record, fontsize = 12 ] {\n");
for (i = 0; i < nlist->numnames; i++)
fprintf(f, "\t\t\"%jx\" [ label = \"{%s:|{%s|[%jx]:}}\" ];\n",
@@ -159,30 +171,40 @@ DotCmd(int ac, char **av)
continue;
}
 
-   fprintf(f, "\tnode [ shape = octagon, fontsize = 10 ] {\n");
-   for (j = 0; j < ninfo->hooks; j++)
-   fprintf(f, "\t\t\"%jx.%s\" [ label = \"%s\" ];\n",
-   (uintmax_t)nlist->nodeinfo[i].id,
-   hlist->link[j].ourhook, hlist->link[j].ourhook);
-   fprintf(f, "\t};\n");
+   if (!compact) {
+   fprintf(f, "\tnode [ shape = octagon, fontsize = 10 ] 
{\n");
+   for (j = 0; j < ninfo->hooks; j++)
+   fprintf(f, "\t\t\"%jx.%s\" [ label = \"%s\" 
];\n",
+   (uintmax_t)nlist->nodeinfo[i].id,
+   hlist->link[j].ourhook, 
hlist->link[j].ourhook);
+   fprintf(f, "\t};\n");
 
-   fprintf(f, "\t{\n\t\tedge [ weight = 2.0, style = bold ];\n");
-   for (j = 0; j < ninfo->hooks; j++)
-   fprintf(f, "\t\t\"%jx\" -- \"%jx.%s\";\n",
-   (uintmax_t)nlist->nodeinfo[i].id,
-   (uintmax_t)nlist->nodeinfo[i].id,
-   hlist->link[j].ourhook);
-   fprintf(f, "\t};\n");
+   fprintf(f, "\t{\n\t\tedge [ weight = 2.0, style = bold 
];\n");
+   for (j = 0; j < ninfo->hooks; j++)
+   fprintf(f, "\t\t\"%jx\" -- \"%jx.%s\";\n",
+   (uintmax_t)nlist->nodeinfo[i].id,
+   (uintmax_t)nlist->nodeinfo[i].id,
+   hlist->link[j].ourhook);
+   fprintf(f, "\t};\

svn commit: r366429 - in head/sys: kern sys

2020-10-04 Thread Konstantin Belousov
Author: kib
Date: Sun Oct  4 16:33:42 2020
New Revision: 366429
URL: https://svnweb.freebsd.org/changeset/base/366429

Log:
  Add sig_intr(9).
  
  It gives the answer would the thread sleep according to current state
  of signals and suspensions.  Of course the answer is racy and allows
  for false-negatives (no sleep when signal is delivered after process
  lock is dropped).  Also the answer might change due to signal
  rescheduling among threads in multi-threaded process.
  
  Still it is the best approximation I can provide, to answering the
  question was the thread interrupted.
  
  Reviewed by:  markj
  Tested by:pho, rmacklem
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks
  Differential revision:https://reviews.freebsd.org/D26628

Modified:
  head/sys/kern/kern_sig.c
  head/sys/sys/signalvar.h

Modified: head/sys/kern/kern_sig.c
==
--- head/sys/kern/kern_sig.cSun Oct  4 16:30:05 2020(r366428)
+++ head/sys/kern/kern_sig.cSun Oct  4 16:33:42 2020(r366429)
@@ -3204,6 +3204,24 @@ sig_ast_needsigchk(struct thread *td)
return (ret);
 }
 
+int
+sig_intr(void)
+{
+   struct thread *td;
+   struct proc *p;
+   int ret;
+
+   td = curthread;
+   p = td->td_proc;
+
+   PROC_LOCK(p);
+   ret = sig_ast_checksusp(td);
+   if (ret == 0)
+   ret = sig_ast_needsigchk(td);
+   PROC_UNLOCK(p);
+   return (ret);
+}
+
 void
 proc_wkilled(struct proc *p)
 {

Modified: head/sys/sys/signalvar.h
==
--- head/sys/sys/signalvar.hSun Oct  4 16:30:05 2020(r366428)
+++ head/sys/sys/signalvar.hSun Oct  4 16:33:42 2020(r366429)
@@ -408,6 +408,7 @@ int sig_ffs(sigset_t *set);
 void   sigfastblock_clear(struct thread *td);
 void   sigfastblock_fetch(struct thread *td);
 void   sigfastblock_setpend(struct thread *td, bool resched);
+intsig_intr(void);
 void   siginit(struct proc *p);
 void   signotify(struct thread *td);
 void   sigqueue_delete(struct sigqueue *queue, int sig);
___
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: r366428 - in head/sys: kern sys

2020-10-04 Thread Konstantin Belousov
Author: kib
Date: Sun Oct  4 16:30:05 2020
New Revision: 366428
URL: https://svnweb.freebsd.org/changeset/base/366428

Log:
  Refactor sleepq_catch_signals().
  
  - Extract suspension check into sig_ast_checksusp() helper.
  - Extract signal check and calculation of the interruption errno into
sig_ast_needsigchk() helper.
  The helpers are moved to kern_sig.c which is the proper place for
  signal-related code.
  
  Improve control flow in sleepq_catch_signals(), to handle ret == 0
  (can sleep) and ret != 0 (interrupted) only once, by separating
  checking code into sleepq_check_ast_sq_locked(), which return value is
  interpreted at single location.
  
  Reviewed by:  markj
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks
  Differential revision:https://reviews.freebsd.org/D26628

Modified:
  head/sys/kern/kern_sig.c
  head/sys/kern/subr_sleepqueue.c
  head/sys/sys/signalvar.h

Modified: head/sys/kern/kern_sig.c
==
--- head/sys/kern/kern_sig.cSun Oct  4 16:27:49 2020(r366427)
+++ head/sys/kern/kern_sig.cSun Oct  4 16:30:05 2020(r366428)
@@ -3139,6 +3139,71 @@ postsig(int sig)
return (1);
 }
 
+int
+sig_ast_checksusp(struct thread *td)
+{
+   struct proc *p;
+   int ret;
+
+   p = td->td_proc;
+   PROC_LOCK_ASSERT(p, MA_OWNED);
+
+   if ((td->td_flags & TDF_NEEDSUSPCHK) == 0)
+   return (0);
+
+   ret = thread_suspend_check(1);
+   MPASS(ret == 0 || ret == EINTR || ret == ERESTART);
+   return (ret);
+}
+
+int
+sig_ast_needsigchk(struct thread *td)
+{
+   struct proc *p;
+   struct sigacts *ps;
+   int ret, sig;
+
+   p = td->td_proc;
+   PROC_LOCK_ASSERT(p, MA_OWNED);
+
+   if ((td->td_flags & TDF_NEEDSIGCHK) == 0)
+   return (0);
+
+   ps = p->p_sigacts;
+   mtx_lock(&ps->ps_mtx);
+   sig = cursig(td);
+   if (sig == -1) {
+   mtx_unlock(&ps->ps_mtx);
+   KASSERT((td->td_flags & TDF_SBDRY) != 0, ("lost TDF_SBDRY"));
+   KASSERT(TD_SBDRY_INTR(td),
+   ("lost TDF_SERESTART of TDF_SEINTR"));
+   KASSERT((td->td_flags & (TDF_SEINTR | TDF_SERESTART)) !=
+   (TDF_SEINTR | TDF_SERESTART),
+   ("both TDF_SEINTR and TDF_SERESTART"));
+   ret = TD_SBDRY_ERRNO(td);
+   } else if (sig != 0) {
+   ret = SIGISMEMBER(ps->ps_sigintr, sig) ? EINTR : ERESTART;
+   mtx_unlock(&ps->ps_mtx);
+   } else {
+   mtx_unlock(&ps->ps_mtx);
+   ret = 0;
+   }
+
+   /*
+* Do not go into sleep if this thread was the ptrace(2)
+* attach leader.  cursig() consumed SIGSTOP from PT_ATTACH,
+* but we usually act on the signal by interrupting sleep, and
+* should do that here as well.
+*/
+   if ((td->td_dbgflags & TDB_FSTP) != 0) {
+   if (ret == 0)
+   ret = EINTR;
+   td->td_dbgflags &= ~TDB_FSTP;
+   }
+
+   return (ret);
+}
+
 void
 proc_wkilled(struct proc *p)
 {

Modified: head/sys/kern/subr_sleepqueue.c
==
--- head/sys/kern/subr_sleepqueue.c Sun Oct  4 16:27:49 2020
(r366427)
+++ head/sys/kern/subr_sleepqueue.c Sun Oct  4 16:30:05 2020
(r366428)
@@ -433,33 +433,20 @@ sleepq_sleepcnt(const void *wchan, int queue)
return (sq->sq_blockedcnt[queue]);
 }
 
-/*
- * Marks the pending sleep of the current thread as interruptible and
- * makes an initial check for pending signals before putting a thread
- * to sleep. Enters and exits with the thread lock held.  Thread lock
- * may have transitioned from the sleepq lock to a run lock.
- */
 static int
-sleepq_catch_signals(const void *wchan, int pri)
+sleepq_check_ast_sc_locked(struct thread *td, struct sleepqueue_chain *sc)
 {
-   struct sleepqueue_chain *sc;
-   struct sleepqueue *sq;
-   struct thread *td;
struct proc *p;
-   struct sigacts *ps;
-   int sig, ret;
+   int ret;
 
-   ret = 0;
-   td = curthread;
-   p = curproc;
-   sc = SC_LOOKUP(wchan);
mtx_assert(&sc->sc_lock, MA_OWNED);
-   MPASS(wchan != NULL);
+
+   ret = 0;
if ((td->td_pflags & TDP_WAKEUP) != 0) {
td->td_pflags &= ~TDP_WAKEUP;
ret = EINTR;
thread_lock(td);
-   goto out;
+   return (0);
}
 
/*
@@ -467,91 +454,89 @@ sleepq_catch_signals(const void *wchan, int pri)
 * thread.  If not, we can switch immediately.
 */
thread_lock(td);
-   if ((td->td_flags & (TDF_NEEDSIGCHK | TDF_NEEDSUSPCHK)) != 0) {
-   thread_unlock(td);
-   mtx_unlock_spin(&sc->sc_lock);
-   CTR3(KTR_PROC, "sleepq cat

svn commit: r366427 - stable/12/sys/amd64/vmm/amd

2020-10-04 Thread Mark Johnston
Author: markj
Date: Sun Oct  4 16:27:49 2020
New Revision: 366427
URL: https://svnweb.freebsd.org/changeset/base/366427

Log:
  MFC r366347:
  Remove svn:executable from a couple of vmm(4) source files.

Modified:
Directory Properties:
  stable/12/   (props changed)
  stable/12/sys/amd64/vmm/amd/amdvi_priv.h   (props changed)
  stable/12/sys/amd64/vmm/amd/ivrs_drv.c   (props changed)
___
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: r366426 - head/sys/netinet

2020-10-04 Thread Michael Tuexen
Author: tuexen
Date: Sun Oct  4 15:37:34 2020
New Revision: 366426
URL: https://svnweb.freebsd.org/changeset/base/366426

Log:
  Use __func__ instead of __FUNCTION__ for consistency.
  
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_bsd_addr.c
  head/sys/netinet/sctp_indata.c

Modified: head/sys/netinet/sctp_bsd_addr.c
==
--- head/sys/netinet/sctp_bsd_addr.cSun Oct  4 15:22:14 2020
(r366425)
+++ head/sys/netinet/sctp_bsd_addr.cSun Oct  4 15:37:34 2020
(r366426)
@@ -373,7 +373,7 @@ sctp_get_mbuf_for_msg(unsigned int space_needed, int w
m_freem(m);
return (NULL);
}
-   KASSERT(SCTP_BUF_NEXT(m) == NULL, ("%s: no chain allowed", 
__FUNCTION__));
+   KASSERT(SCTP_BUF_NEXT(m) == NULL, ("%s: no chain allowed", 
__func__));
}
 #ifdef SCTP_MBUF_LOGGING
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {

Modified: head/sys/netinet/sctp_indata.c
==
--- head/sys/netinet/sctp_indata.c  Sun Oct  4 15:22:14 2020
(r366425)
+++ head/sys/netinet/sctp_indata.c  Sun Oct  4 15:37:34 2020
(r366426)
@@ -301,7 +301,7 @@ sctp_mark_non_revokable(struct sctp_association *asoc,
SCTP_CALC_TSN_TO_GAP(gap, tsn, asoc->mapping_array_base_tsn);
in_r = SCTP_IS_TSN_PRESENT(asoc->mapping_array, gap);
in_nr = SCTP_IS_TSN_PRESENT(asoc->nr_mapping_array, gap);
-   KASSERT(in_r || in_nr, ("%s: Things are really messed up now", 
__FUNCTION__));
+   KASSERT(in_r || in_nr, ("%s: Things are really messed up now", 
__func__));
if (!in_nr) {
SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, gap);
if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) {
___
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: r366425 - head/sys/netinet

2020-10-04 Thread Michael Tuexen
Author: tuexen
Date: Sun Oct  4 15:22:14 2020
New Revision: 366425
URL: https://svnweb.freebsd.org/changeset/base/366425

Log:
  Cleanup, no functional change intended.
  
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_indata.c

Modified: head/sys/netinet/sctp_indata.c
==
--- head/sys/netinet/sctp_indata.c  Sun Oct  4 13:24:58 2020
(r366424)
+++ head/sys/netinet/sctp_indata.c  Sun Oct  4 15:22:14 2020
(r366425)
@@ -285,17 +285,15 @@ sctp_build_ctl_nchunk(struct sctp_inpcb *inp, struct s
 static void
 sctp_mark_non_revokable(struct sctp_association *asoc, uint32_t tsn)
 {
-   uint32_t gap, i, cumackp1;
-   int fnd = 0;
-   int in_r = 0, in_nr = 0;
+   uint32_t gap, i;
+   int in_r, in_nr;
 
if (SCTP_BASE_SYSCTL(sctp_do_drain) == 0) {
return;
}
-   cumackp1 = asoc->cumulative_tsn + 1;
-   if (SCTP_TSN_GT(cumackp1, tsn)) {
+   if (SCTP_TSN_GE(asoc->cumulative_tsn, tsn)) {
/*
-* this tsn is behind the cum ack and thus we don't need to
+* This tsn is behind the cum ack and thus we don't need to
 * worry about it being moved from one to the other.
 */
return;
@@ -303,33 +301,27 @@ sctp_mark_non_revokable(struct sctp_association *asoc,
SCTP_CALC_TSN_TO_GAP(gap, tsn, asoc->mapping_array_base_tsn);
in_r = SCTP_IS_TSN_PRESENT(asoc->mapping_array, gap);
in_nr = SCTP_IS_TSN_PRESENT(asoc->nr_mapping_array, gap);
-   if ((in_r == 0) && (in_nr == 0)) {
-#ifdef INVARIANTS
-   panic("Things are really messed up now");
-#else
-   SCTP_PRINTF("gap:%x tsn:%x\n", gap, tsn);
-   sctp_print_mapping_array(asoc);
-#endif
-   }
-   if (in_nr == 0)
+   KASSERT(in_r || in_nr, ("%s: Things are really messed up now", 
__FUNCTION__));
+   if (!in_nr) {
SCTP_SET_TSN_PRESENT(asoc->nr_mapping_array, gap);
-   if (in_r)
-   SCTP_UNSET_TSN_PRESENT(asoc->mapping_array, gap);
-   if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) {
-   asoc->highest_tsn_inside_nr_map = tsn;
+   if (SCTP_TSN_GT(tsn, asoc->highest_tsn_inside_nr_map)) {
+   asoc->highest_tsn_inside_nr_map = tsn;
+   }
}
-   if (tsn == asoc->highest_tsn_inside_map) {
-   /* We must back down to see what the new highest is */
-   for (i = tsn - 1; SCTP_TSN_GE(i, asoc->mapping_array_base_tsn); 
i--) {
-   SCTP_CALC_TSN_TO_GAP(gap, i, 
asoc->mapping_array_base_tsn);
-   if (SCTP_IS_TSN_PRESENT(asoc->mapping_array, gap)) {
-   asoc->highest_tsn_inside_map = i;
-   fnd = 1;
-   break;
+   if (in_r) {
+   SCTP_UNSET_TSN_PRESENT(asoc->mapping_array, gap);
+   if (tsn == asoc->highest_tsn_inside_map) {
+   /* We must back down to see what the new highest is. */
+   for (i = tsn - 1; SCTP_TSN_GE(i, 
asoc->mapping_array_base_tsn); i--) {
+   SCTP_CALC_TSN_TO_GAP(gap, i, 
asoc->mapping_array_base_tsn);
+   if (SCTP_IS_TSN_PRESENT(asoc->mapping_array, 
gap)) {
+   asoc->highest_tsn_inside_map = i;
+   break;
+   }
}
-   }
-   if (!fnd) {
-   asoc->highest_tsn_inside_map = 
asoc->mapping_array_base_tsn - 1;
+   if (!SCTP_TSN_GE(i, asoc->mapping_array_base_tsn)) {
+   asoc->highest_tsn_inside_map = 
asoc->mapping_array_base_tsn - 1;
+   }
}
}
 }
___
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: r366424 - in head: sys/net sys/net/route tests/sys/net/routing

2020-10-04 Thread Alexander V. Chernikov
Author: melifaro
Date: Sun Oct  4 13:24:58 2020
New Revision: 366424
URL: https://svnweb.freebsd.org/changeset/base/366424

Log:
  Fix route flags update during RTM_CHANGE.
  Nexthop lookup was not consireding rt_flags when doing
   structure comparison, which lead to an original nexthop
   selection when changing flags. Fix the case by adding
   rt_flags field into comparison and rearranging nhop_priv
   fields to allow for efficient matching.
  Fix `route change X/Y flags` case - recent changes
   disallowed specifying RTF_GATEWAY flag without actual gateway.
   It turns out, route(8) fills in RTF_GATEWAY by default, unless
   -interface flag is specified. Fix regression by clearing
   RTF_GATEWAY flag instead of failing.
  Fix route flag reporting in RTM_CHANGE messages by explicitly
   updating rtm_flags after operation competion.
  Add IPv4/IPv6 tests for flag-only route changes.

Modified:
  head/sys/net/route/nhop_ctl.c
  head/sys/net/route/nhop_var.h
  head/sys/net/route/route_ctl.c
  head/sys/net/rtsock.c
  head/tests/sys/net/routing/test_rtsock_l3.c

Modified: head/sys/net/route/nhop_ctl.c
==
--- head/sys/net/route/nhop_ctl.c   Sun Oct  4 06:14:51 2020
(r366423)
+++ head/sys/net/route/nhop_ctl.c   Sun Oct  4 13:24:58 2020
(r366424)
@@ -164,8 +164,7 @@ cmp_priv(const struct nhop_priv *_one, const struct nh
if (memcmp(_one->nh, _two->nh, NHOP_END_CMP) != 0)
return (0);
 
-   if ((_one->nh_type != _two->nh_type) ||
-   (_one->nh_family != _two->nh_family))
+   if (memcmp(_one, _two, NH_PRIV_END_CMP) != 0)
return (0);
 
return (1);

Modified: head/sys/net/route/nhop_var.h
==
--- head/sys/net/route/nhop_var.h   Sun Oct  4 06:14:51 2020
(r366423)
+++ head/sys/net/route/nhop_var.h   Sun Oct  4 13:24:58 2020
(r366424)
@@ -74,19 +74,24 @@ struct nh_control {
 /* Control plane-only nhop data */
 struct nhop_object;
 struct nhop_priv {
-   uint32_tnh_idx; /* nexthop index */
+   /* nhop lookup comparison start */
uint8_t nh_family;  /* address family of the lookup 
*/
+   uint8_t spare;
uint16_tnh_type;/* nexthop type */
+   uint32_trt_flags;   /* routing flags for the 
control plane */
+   /* nhop lookup comparison end */
+   uint32_tnh_idx; /* nexthop index */
void*cb_func;   /* function handling additional 
rewrite caps */
u_int   nh_refcnt;  /* number of references, 
refcount(9)  */
u_int   nh_linked;  /* refcount(9), == 2 if linked 
to the list */
-   int rt_flags;   /* routing flags for the 
control plane */
struct nhop_object  *nh;/* backreference to the 
dataplane nhop */
struct nh_control   *nh_control;/* backreference to the rnh */
struct nhop_priv*nh_next;   /* hash table membership */
struct vnet *nh_vnet;   /* vnet nhop belongs to */
struct epoch_contextnh_epoch_ctx;   /* epoch data for nhop */
 };
+
+#defineNH_PRIV_END_CMP (__offsetof(struct nhop_priv, nh_idx))
 
 #defineNH_IS_PINNED(_nh)   ((!NH_IS_NHGRP(_nh)) && \
((_nh)->nh_priv->rt_flags & RTF_PINNED))

Modified: head/sys/net/route/route_ctl.c
==
--- head/sys/net/route/route_ctl.c  Sun Oct  4 06:14:51 2020
(r366423)
+++ head/sys/net/route/route_ctl.c  Sun Oct  4 13:24:58 2020
(r366424)
@@ -733,8 +733,15 @@ rib_change_route(uint32_t fibnum, struct rt_addrinfo *
 
/* Check if updated gateway exists */
if ((info->rti_flags & RTF_GATEWAY) &&
-   (info->rti_info[RTAX_GATEWAY] == NULL))
-   return (EINVAL);
+   (info->rti_info[RTAX_GATEWAY] == NULL)) {
+
+   /*
+* route(8) adds RTF_GATEWAY flag if -interface is not set.
+* Remove RTF_GATEWAY to enforce consistency and maintain
+* compatibility..
+*/
+   info->rti_flags &= ~RTF_GATEWAY;
+   }
 
/*
 * route change is done in multiple steps, with dropping and

Modified: head/sys/net/rtsock.c
==
--- head/sys/net/rtsock.c   Sun Oct  4 06:14:51 2020(r366423)
+++ head/sys/net/rtsock.c   Sun Oct  4 13:24:58 2020(r366424)
@@ -965,6 +965,7 @@ route_output(struct mbuf *m, struct socket *so, ...)
 #endif
nh = rc.rc_nh_new;
rtm->rtm_