svn commit: r367863 - in head: contrib/bmake contrib/bmake/filemon contrib/bmake/missing contrib/bmake/mk contrib/bmake/unit-tests usr.bin/bmake usr.bin/bmake/unit-tests

2020-11-19 Thread Simon J. Gerraty
Author: sjg
Date: Fri Nov 20 06:02:31 2020
New Revision: 367863
URL: https://svnweb.freebsd.org/changeset/base/367863

Log:
  Merge bmake-20201117
  
  o allow env var MAKE_OBJDIR_CHECK_WRITABLE=no to skip writable
checks in InitObjdir.  Explicit .OBJDIR target always allows
read-only directory.
  
  o More code cleanup and refactoring.
  
  o More unit tests
  
  MFC after:1 week

Added:
  head/contrib/bmake/missing/
 - copied from r367861, vendor/NetBSD/bmake/dist/missing/
  head/contrib/bmake/unit-tests/cmd-errors-lint.exp
 - copied unchanged from r367861, 
vendor/NetBSD/bmake/dist/unit-tests/cmd-errors-lint.exp
  head/contrib/bmake/unit-tests/cmd-errors-lint.mk
 - copied unchanged from r367861, 
vendor/NetBSD/bmake/dist/unit-tests/cmd-errors-lint.mk
  head/contrib/bmake/unit-tests/cmd-errors.exp
 - copied unchanged from r367861, 
vendor/NetBSD/bmake/dist/unit-tests/cmd-errors.exp
  head/contrib/bmake/unit-tests/cmd-errors.mk
 - copied unchanged from r367861, 
vendor/NetBSD/bmake/dist/unit-tests/cmd-errors.mk
  head/contrib/bmake/unit-tests/cmdline-undefined.exp
 - copied unchanged from r367861, 
vendor/NetBSD/bmake/dist/unit-tests/cmdline-undefined.exp
  head/contrib/bmake/unit-tests/cmdline-undefined.mk
 - copied unchanged from r367861, 
vendor/NetBSD/bmake/dist/unit-tests/cmdline-undefined.mk
  head/contrib/bmake/unit-tests/cond-op-and-lint.exp
 - copied unchanged from r367861, 
vendor/NetBSD/bmake/dist/unit-tests/cond-op-and-lint.exp
  head/contrib/bmake/unit-tests/cond-op-and-lint.mk
 - copied unchanged from r367861, 
vendor/NetBSD/bmake/dist/unit-tests/cond-op-and-lint.mk
  head/contrib/bmake/unit-tests/cond-op-or-lint.exp
 - copied unchanged from r367861, 
vendor/NetBSD/bmake/dist/unit-tests/cond-op-or-lint.exp
  head/contrib/bmake/unit-tests/cond-op-or-lint.mk
 - copied unchanged from r367861, 
vendor/NetBSD/bmake/dist/unit-tests/cond-op-or-lint.mk
  head/contrib/bmake/unit-tests/directive-if-nested.exp
 - copied unchanged from r367861, 
vendor/NetBSD/bmake/dist/unit-tests/directive-if-nested.exp
  head/contrib/bmake/unit-tests/directive-if-nested.mk
 - copied unchanged from r367861, 
vendor/NetBSD/bmake/dist/unit-tests/directive-if-nested.mk
  head/contrib/bmake/unit-tests/gnode-submake.exp
 - copied unchanged from r367861, 
vendor/NetBSD/bmake/dist/unit-tests/gnode-submake.exp
  head/contrib/bmake/unit-tests/gnode-submake.mk
 - copied unchanged from r367861, 
vendor/NetBSD/bmake/dist/unit-tests/gnode-submake.mk
  head/contrib/bmake/unit-tests/job-flags.exp
 - copied unchanged from r367861, 
vendor/NetBSD/bmake/dist/unit-tests/job-flags.exp
  head/contrib/bmake/unit-tests/job-flags.mk
 - copied unchanged from r367861, 
vendor/NetBSD/bmake/dist/unit-tests/job-flags.mk
  head/contrib/bmake/unit-tests/objdir-writable.exp
 - copied unchanged from r367861, 
vendor/NetBSD/bmake/dist/unit-tests/objdir-writable.exp
  head/contrib/bmake/unit-tests/objdir-writable.mk
 - copied unchanged from r367861, 
vendor/NetBSD/bmake/dist/unit-tests/objdir-writable.mk
  head/contrib/bmake/unit-tests/opt-touch-jobs.exp
 - copied unchanged from r367861, 
vendor/NetBSD/bmake/dist/unit-tests/opt-touch-jobs.exp
  head/contrib/bmake/unit-tests/opt-touch-jobs.mk
 - copied unchanged from r367861, 
vendor/NetBSD/bmake/dist/unit-tests/opt-touch-jobs.mk
  head/contrib/bmake/unit-tests/suff-self.exp
 - copied unchanged from r367861, 
vendor/NetBSD/bmake/dist/unit-tests/suff-self.exp
  head/contrib/bmake/unit-tests/suff-self.mk
 - copied unchanged from r367861, 
vendor/NetBSD/bmake/dist/unit-tests/suff-self.mk
  head/contrib/bmake/unit-tests/varparse-errors.exp
 - copied unchanged from r367861, 
vendor/NetBSD/bmake/dist/unit-tests/varparse-errors.exp
  head/contrib/bmake/unit-tests/varparse-errors.mk
 - copied unchanged from r367861, 
vendor/NetBSD/bmake/dist/unit-tests/varparse-errors.mk
Deleted:
  head/contrib/bmake/unit-tests/directives.exp
  head/contrib/bmake/unit-tests/directives.mk
  head/contrib/bmake/unit-tests/varshell.exp
  head/contrib/bmake/unit-tests/varshell.mk
Modified:
  head/contrib/bmake/ChangeLog
  head/contrib/bmake/FILES
  head/contrib/bmake/Makefile
  head/contrib/bmake/Makefile.config.in
  head/contrib/bmake/VERSION
  head/contrib/bmake/arch.c
  head/contrib/bmake/bmake.1
  head/contrib/bmake/bmake.cat1
  head/contrib/bmake/boot-strap
  head/contrib/bmake/buf.c
  head/contrib/bmake/buf.h
  head/contrib/bmake/compat.c
  head/contrib/bmake/cond.c
  head/contrib/bmake/configure
  head/contrib/bmake/configure.in
  head/contrib/bmake/dir.c
  head/contrib/bmake/dir.h
  head/contrib/bmake/filemon/filemon_dev.c
  head/contrib/bmake/filemon/filemon_ktrace.c
  head/contrib/bmake/for.c
  head/contrib/bmake/hash.c
  head/contrib/bmake/hash.h
  head/contrib/bmake/job.c
  head/contrib/bmake/job.h
  head/contrib/bmake/lst.c
  head/contrib/bmake/lst.h
  head/contrib/bmake/main.c
  

svn commit: r367862 - head/sys/cam

2020-11-19 Thread Alexander Motin
Author: mav
Date: Fri Nov 20 05:46:27 2020
New Revision: 367862
URL: https://svnweb.freebsd.org/changeset/base/367862

Log:
  Microoptimize cam_num_doneqs math in xpt_done().
  
  MFC after:1 week

Modified:
  head/sys/cam/cam_xpt.c

Modified: head/sys/cam/cam_xpt.c
==
--- head/sys/cam/cam_xpt.c  Fri Nov 20 03:54:46 2020(r367861)
+++ head/sys/cam/cam_xpt.c  Fri Nov 20 05:46:27 2020(r367862)
@@ -178,7 +178,7 @@ struct cam_doneq {
 };
 
 static struct cam_doneq cam_doneqs[MAXCPU];
-static int cam_num_doneqs;
+static u_int __read_mostly cam_num_doneqs;
 static struct proc *cam_proc;
 
 SYSCTL_INT(_kern_cam, OID_AUTO, num_doneqs, CTLFLAG_RDTUN,
@@ -4620,7 +4620,7 @@ xpt_done(union ccb *done_ccb)
 
/* Store the time the ccb was in the sim */
done_ccb->ccb_h.qos.periph_data = 
cam_iosched_delta_t(done_ccb->ccb_h.qos.periph_data);
-   hash = (done_ccb->ccb_h.path_id + done_ccb->ccb_h.target_id +
+   hash = (u_int)(done_ccb->ccb_h.path_id + done_ccb->ccb_h.target_id +
done_ccb->ccb_h.target_lun) % cam_num_doneqs;
queue = _doneqs[hash];
mtx_lock(>cam_doneq_mtx);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367858 - head/sys/dev/isp

2020-11-19 Thread Alexander Motin
Author: mav
Date: Fri Nov 20 02:03:58 2020
New Revision: 367858
URL: https://svnweb.freebsd.org/changeset/base/367858

Log:
  Fix r367857 build without ISP_TARGET_MODE.

Modified:
  head/sys/dev/isp/isp_pci.c

Modified: head/sys/dev/isp/isp_pci.c
==
--- head/sys/dev/isp/isp_pci.c  Fri Nov 20 01:15:48 2020(r367857)
+++ head/sys/dev/isp/isp_pci.c  Fri Nov 20 02:03:58 2020(r367858)
@@ -893,7 +893,9 @@ isp_pci_mbxdma(ispsoftc_t *isp)
int i, error, cmap = 0;
bus_size_t slim;/* segment size */
struct imush im;
+#ifdef ISP_TARGET_MODE
isp_ecmd_t *ecmd;
+#endif
 
/* Already been here? If so, leave... */
if (isp->isp_xflist != NULL)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367857 - in head: share/man/man4 sys/dev/isp sys/dev/ispfw sys/modules/ispfw sys/modules/ispfw/isp_1000 sys/modules/ispfw/isp_1040 sys/modules/ispfw/isp_1080 sys/modules/ispfw/isp_1216...

2020-11-19 Thread Alexander Motin
Author: mav
Date: Fri Nov 20 01:15:48 2020
New Revision: 367857
URL: https://svnweb.freebsd.org/changeset/base/367857

Log:
  Remove parallel SCSI and 1/2Gb FC support from isp(4).
  
  This removes 288KB (36%) of the driver code and zillions of hacks and
  workarounds, making single driver uniformly support several different
  generations of hardware interfaces, not counting minor card variations.
  After years of the hopeless fight, I don't think it worth to continue
  support for hardware obsolete for 15-20 years.  Instead much cleaner
  now code should allow to move forward toward better locking, multiple
  queues and other cool features.
  
  All the remaining Qlogic cards starting from 4Gb 24xx to 32Gb 27xx use
  the same hardware/firmware interface with minor incremental improvements,
  so it seems to be a good new starting point.  Except one PCI-X model all
  all of them are PCIe and so still usable in modern systems.
  
  Discussed with:   ken, scottl, jpaetzel, imp
  Relnotes: yes

Deleted:
  head/sys/dev/ispfw/asm_1040.h
  head/sys/dev/ispfw/asm_1080.h
  head/sys/dev/ispfw/asm_12160.h
  head/sys/dev/ispfw/asm_2100.h
  head/sys/dev/ispfw/asm_2200.h
  head/sys/dev/ispfw/asm_2300.h
  head/sys/dev/ispfw/asm_2322.h
  head/sys/modules/ispfw/isp_1000/
  head/sys/modules/ispfw/isp_1040/
  head/sys/modules/ispfw/isp_1080/
  head/sys/modules/ispfw/isp_12160/
  head/sys/modules/ispfw/isp_2100/
  head/sys/modules/ispfw/isp_2200/
  head/sys/modules/ispfw/isp_2300/
  head/sys/modules/ispfw/isp_2322/
Modified:
  head/share/man/man4/isp.4
  head/share/man/man4/ispfw.4
  head/sys/dev/isp/isp.c
  head/sys/dev/isp/isp_freebsd.c
  head/sys/dev/isp/isp_freebsd.h
  head/sys/dev/isp/isp_library.c
  head/sys/dev/isp/isp_library.h
  head/sys/dev/isp/isp_pci.c
  head/sys/dev/isp/isp_target.c
  head/sys/dev/isp/ispmbox.h
  head/sys/dev/isp/ispreg.h
  head/sys/dev/isp/ispvar.h
  head/sys/dev/ispfw/ispfw.c
  head/sys/modules/ispfw/Makefile

Modified: head/share/man/man4/isp.4
==
--- head/share/man/man4/isp.4   Fri Nov 20 00:30:58 2020(r367856)
+++ head/share/man/man4/isp.4   Fri Nov 20 01:15:48 2020(r367857)
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2009-2018 Alexander Motin 
+.\" Copyright (c) 2009-2020 Alexander Motin 
 .\" Copyright (c) 2006 Marcus Alves Grando
 .\" Copyright (c) 1998-2001 Matthew Jacob, for NASA/Ames Research Center
 .\"
@@ -26,12 +26,12 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 28, 2019
+.Dd November 19, 2020
 .Dt ISP 4
 .Os
 .Sh NAME
 .Nm isp
-.Nd Qlogic based SPI and FibreChannel SCSI Host Adapters
+.Nd Qlogic FibreChannel SCSI Host Adapters driver
 .Sh SYNOPSIS
 To compile this driver into the kernel,
 place the following lines in your
@@ -51,23 +51,16 @@ ispfw_load="YES"
 .Ed
 .Sh DESCRIPTION
 This driver provides access to
-.Tn SPI
-or
 .Tn FibreChannel
 SCSI devices.
 .Pp
-SPI supports initiator mode for Ultra SCSI and wide mode transactions for
-.Tn SCSI ,
-Ultra2 LVD (1080, 1280), and Ultra3 LVD (10160, 12160).
-.Pp
-Fibre Channel supports initiator and target modes of FCP SCSI profile,
-utilizing Class 3 and Class 2 (2200 and later) connections.
+It supports initiator and target modes of FCP SCSI profile,
+utilizing Class 3 and Class 2 connections.
 Support is available for Public and Private loops, Point-to-Point
 and Fabric connections.
 .Pp
-FC-Tape is supported on 4Gb (2400) and newer controllers.
-FC-Tape is highly recommended for connections to tape drives that support
-it.
+Supported FC-Tape functionality is highly recommended for connections
+to tape drives that support it.
 It encompasses four elements from the T-10 FCP-4 specification:
 .Bl -bullet -offset indent
 .It
@@ -100,39 +93,8 @@ Cards supported by the
 .Nm
 driver include:
 .Bl -tag -width xx -offset indent
-.It Qlogic 1000
-Fast Wide, Ultra Fast Wide cards, Single Ended or Differential SBus cards.
-.It Qlogic 1020
-Fast Wide and Differential Fast Wide SCSI PCI cards.
-.It Qlogic 1040
-Ultra Wide and Differential Ultra Wide SCSI PCI cards.
-Also known as the DEC KZPBA-CA (single ended) and KZPBA-CB (HVD differential).
-.It Qlogic 1080
-LVD Ultra2 Wide SCSI PCI cards.
-.It Qlogic 10160
-LVD Ultra3 Wide SCSI PCI cards.
-.It Qlogic 1240
-Dual Bus Ultra Wide and Differential Ultra Wide SCSI PCI cards.
-.It Qlogic 1280
-Dual Bus LVD Ultra2 Wide SCSI PCI cards.
-.It Qlogic 12160
-Dual Bus LVD Ultra3 Wide SCSI PCI cards.
-.It Qlogic 210X
-Copper and Optical Fibre Channel Arbitrated Loop PCI cards (single, dual).
-.It Qlogic 220X
-Copper and Optical Fibre Channel Arbitrated Loop PCI cards (single, dual, 
quad).
-.It Qlogic 2300
-Optical 2Gb Fibre Channel PCI cards.
-.It Qlogic 2312
-Optical 2Gb Fibre Channel PCI cards.
-.It Qlogic 234X
-Optical 2Gb Fibre Channel PCI cards (2312 chipset, single and dual attach).
-.It Qlogic 2322
-Optical 2Gb Fibre Channel PCIe cards.
-.It Qlogic 200
-Dell branded version of the QLogic 2312.
 .It Qlogic 

svn commit: r367854 - head/sys/dev/atkbdc

2020-11-19 Thread Vladimir Kondratyev
Author: wulf
Date: Fri Nov 20 00:13:30 2020
New Revision: 367854
URL: https://svnweb.freebsd.org/changeset/base/367854

Log:
  psm(4): Disable AUX multiplexer probing on all Lenovo laptops.
  
  Rudimentary AUX multiplexing support was added to kernel to make possible
  touchpad initialization on some HP EliteBook laptops with trackpoint.
  
  Disable multiplexer probing on all Lenovo laptops now as they use touchpad
  pass-through port rather than AUX multiplexer to connect trackpoint and
  at least two model (X120e and X121e) is known for getting PS/2 AUX port
  dysfunctional after switching back to hidden multiplexing mode.
  
  AUX MUX probing can be reenabled with setting of hw.psm.mux_disabled loader
  tunable to 0.
  
  PR:   249987
  Reported by:  jwb
  MFC after:2 weeks

Modified:
  head/sys/dev/atkbdc/atkbdc.c
  head/sys/dev/atkbdc/atkbdcreg.h
  head/sys/dev/atkbdc/psm.c

Modified: head/sys/dev/atkbdc/atkbdc.c
==
--- head/sys/dev/atkbdc/atkbdc.cThu Nov 19 21:10:36 2020
(r367853)
+++ head/sys/dev/atkbdc/atkbdc.cFri Nov 20 00:13:30 2020
(r367854)
@@ -117,6 +117,8 @@ static struct atkbdc_quirks quirks[] = {
 {"coreboot", NULL, NULL,
KBDC_QUIRK_KEEP_ACTIVATED | KBDC_QUIRK_IGNORE_PROBE_RESULT |
KBDC_QUIRK_RESET_AFTER_PROBE | KBDC_QUIRK_SETLEDS_ON_INIT},
+/* KBDC hangs on Lenovo X120e and X121e after disabling AUX MUX */
+{NULL, "LENOVO", NULL, KBDC_QUIRK_DISABLE_MUX_PROBE},
 {NULL, NULL, NULL, 0}
 };
 

Modified: head/sys/dev/atkbdc/atkbdcreg.h
==
--- head/sys/dev/atkbdc/atkbdcreg.h Thu Nov 19 21:10:36 2020
(r367853)
+++ head/sys/dev/atkbdc/atkbdcreg.h Fri Nov 20 00:13:30 2020
(r367854)
@@ -211,6 +211,7 @@ typedef struct atkbdc_softc {
 #define KBDC_QUIRK_IGNORE_PROBE_RESULT (1 << 1)
 #define KBDC_QUIRK_RESET_AFTER_PROBE   (1 << 2)
 #define KBDC_QUIRK_SETLEDS_ON_INIT (1 << 3)
+#define KBDC_QUIRK_DISABLE_MUX_PROBE   (1 << 4)
 int aux_mux_enabled;   /* active PS/2 multiplexing is enabled */
 int aux_mux_port;  /* current aux mux port */
 } atkbdc_softc_t; 

Modified: head/sys/dev/atkbdc/psm.c
==
--- head/sys/dev/atkbdc/psm.c   Thu Nov 19 21:10:36 2020(r367853)
+++ head/sys/dev/atkbdc/psm.c   Fri Nov 20 00:13:30 2020(r367854)
@@ -517,7 +517,7 @@ static int verbose = PSM_DEBUG;
 static int synaptics_support = 1;
 static int trackpoint_support = 1;
 static int elantech_support = 1;
-static int mux_disabled = 0;
+static int mux_disabled = -1;
 
 /* for backward compatibility */
 #defineOLD_MOUSE_GETHWINFO _IOR('M', 1, old_mousehw_t)
@@ -6292,7 +6292,8 @@ enable_synaptics_mux(struct psm_softc *sc, enum probea
int active_ports_count = 0;
int active_ports_mask = 0;
 
-   if (mux_disabled != 0)
+   if (mux_disabled == 1 || (mux_disabled == -1 &&
+   (kbdc->quirks & KBDC_QUIRK_DISABLE_MUX_PROBE) != 0))
return (FALSE);
 
version = enable_aux_mux(kbdc);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r367530 - in head/sys/netinet: . tcp_stacks

2020-11-19 Thread Michael Tuexen



> On 20. Nov 2020, at 00:13, John Baldwin  wrote:
> 
> On 11/19/20 2:55 PM, John Baldwin wrote:
>> On 11/9/20 1:49 PM, Michael Tuexen wrote:
>>> Author: tuexen
>>> Date: Mon Nov  9 21:49:40 2020
>>> New Revision: 367530
>>> URL: https://svnweb.freebsd.org/changeset/base/367530
>>> 
>>> Log:
>>>  RFC 7323 specifies that:
>>>  * TCP segments without timestamps should be dropped when support for
>>>the timestamp option has been negotiated.
>>>  * TCP segments with timestamps should be processed normally if support
>>>for the timestamp option has not been negotiated.
>>>  This patch enforces the above.
>>> 
>>>  PR:250499
>>>  Reviewed by:   gnn, rrs
>>>  MFC after: 1 week
>>>  Sponsored by:  Netflix, Inc
>>>  Differential Revision: https://reviews.freebsd.org/D27148
>>> 
>>> Modified:
>>>  head/sys/netinet/tcp_input.c
>>>  head/sys/netinet/tcp_stacks/bbr.c
>>>  head/sys/netinet/tcp_stacks/rack.c
>>>  head/sys/netinet/tcp_syncache.c
>>>  head/sys/netinet/tcp_timewait.c
>>> 
>>> Modified: head/sys/netinet/tcp_timewait.c
>>> ==
>>> --- head/sys/netinet/tcp_timewait.c Mon Nov  9 21:19:17 2020
>>> (r367529)
>>> +++ head/sys/netinet/tcp_timewait.c Mon Nov  9 21:49:40 2020
>>> (r367530)
>>> @@ -376,7 +376,7 @@ tcp_twstart(struct tcpcb *tp)
>>>  * looking for a pcb in the listen state.  Returns 0 otherwise.
>>>  */
>>> int
>>> -tcp_twcheck(struct inpcb *inp, struct tcpopt *to __unused, struct tcphdr 
>>> *th,
>>> +tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct tcphdr *th,
>>> struct mbuf *m, int tlen)
>>> {
>>> struct tcptw *tw;
>>> @@ -410,6 +410,16 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to __unu
>>>  */
>>> if (thflags & TH_RST)
>>> goto drop;
>>> +
>>> +   /*
>>> +* If timestamps were negotiated during SYN/ACK and a
>>> +* segment without a timestamp is received, silently drop
>>> +* the segment.
>>> +* See section 3.2 of RFC 7323.
>>> +*/
>>> +   if (((to->to_flags & TOF_TS) == 0) && (tw->t_recent != 0)) {
>>> +   goto drop;
>>> +   }
>> 
>> This causes an insta-panic with TOE because toe_4tuple_check() passes in a 
>> NULL
>> pointer for 'to'.  I'm working on a fix for that, but perhaps wait to MFC 
>> until
>> the fix is ready so they can be merged together?
>> 
>> That said, TOE only calls this in the case that it has gotten a new SYN, so I
>> wonder if it makes sense to apply this check on a new SYN.  For a new SYN,
>> shouldn't we not care if the new connection is using a different timestamp
>> option from the old connection?  The language in RFC 7323 3.2 is all about
>> segments on an existing connection, not segments from a new connection I 
>> think?
>> 
>> That is, I think we should perhaps move this check after the TH_SYN check so
>> that a mismatch doesn't prevent recycling?
> 
> Actually, we move the check below requiring TH_ACK, I think this would fix 
> the TOE
> case and also DTRT for plain SYNs for non-TOE:
Let me have a look tomorrow morning...

Best regards
Michael
> 
> diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c
> index c52eab956303..85f1ccbe40f9 100644
> --- a/sys/netinet/tcp_timewait.c
> +++ b/sys/netinet/tcp_timewait.c
> @@ -411,16 +411,6 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct 
> tcphdr *th,
>   if (thflags & TH_RST)
>   goto drop;
> 
> - /*
> -  * If timestamps were negotiated during SYN/ACK and a
> -  * segment without a timestamp is received, silently drop
> -  * the segment.
> -  * See section 3.2 of RFC 7323.
> -  */
> - if (((to->to_flags & TOF_TS) == 0) && (tw->t_recent != 0)) {
> - goto drop;
> - }
> -
> #if 0
> /* PAWS not needed at the moment */
>   /*
> @@ -455,6 +445,16 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct 
> tcphdr *th,
>   if ((thflags & TH_ACK) == 0)
>   goto drop;
> 
> + /*
> +  * If timestamps were negotiated during SYN/ACK and a
> +  * segment without a timestamp is received, silently drop
> +  * the segment.
> +  * See section 3.2 of RFC 7323.
> +  */
> + if (((to->to_flags & TOF_TS) == 0) && (tw->t_recent != 0)) {
> + goto drop;
> + }
> +
>   /*
>* Reset the 2MSL timer if this is a duplicate FIN.
>*/
> 
> The commented out PAWS bits would also seem to not be relevant for SYN-only
> packets?  However, I'm less sure of if that bit should be moved later as
> well. (Or perhaps it should just be removed.  It has been #if 0'd since the
> timewait structure was first added back in 2003 by jlemon@)
> 
> -- 
> John Baldwin

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


Re: svn commit: r367530 - in head/sys/netinet: . tcp_stacks

2020-11-19 Thread John Baldwin
On 11/19/20 2:55 PM, John Baldwin wrote:
> On 11/9/20 1:49 PM, Michael Tuexen wrote:
>> Author: tuexen
>> Date: Mon Nov  9 21:49:40 2020
>> New Revision: 367530
>> URL: https://svnweb.freebsd.org/changeset/base/367530
>>
>> Log:
>>   RFC 7323 specifies that:
>>   * TCP segments without timestamps should be dropped when support for
>> the timestamp option has been negotiated.
>>   * TCP segments with timestamps should be processed normally if support
>> for the timestamp option has not been negotiated.
>>   This patch enforces the above.
>>   
>>   PR:250499
>>   Reviewed by:   gnn, rrs
>>   MFC after: 1 week
>>   Sponsored by:  Netflix, Inc
>>   Differential Revision: https://reviews.freebsd.org/D27148
>>
>> Modified:
>>   head/sys/netinet/tcp_input.c
>>   head/sys/netinet/tcp_stacks/bbr.c
>>   head/sys/netinet/tcp_stacks/rack.c
>>   head/sys/netinet/tcp_syncache.c
>>   head/sys/netinet/tcp_timewait.c
>>
>> Modified: head/sys/netinet/tcp_timewait.c
>> ==
>> --- head/sys/netinet/tcp_timewait.c  Mon Nov  9 21:19:17 2020
>> (r367529)
>> +++ head/sys/netinet/tcp_timewait.c  Mon Nov  9 21:49:40 2020
>> (r367530)
>> @@ -376,7 +376,7 @@ tcp_twstart(struct tcpcb *tp)
>>   * looking for a pcb in the listen state.  Returns 0 otherwise.
>>   */
>>  int
>> -tcp_twcheck(struct inpcb *inp, struct tcpopt *to __unused, struct tcphdr 
>> *th,
>> +tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct tcphdr *th,
>>  struct mbuf *m, int tlen)
>>  {
>>  struct tcptw *tw;
>> @@ -410,6 +410,16 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to __unu
>>   */
>>  if (thflags & TH_RST)
>>  goto drop;
>> +
>> +/*
>> + * If timestamps were negotiated during SYN/ACK and a
>> + * segment without a timestamp is received, silently drop
>> + * the segment.
>> + * See section 3.2 of RFC 7323.
>> + */
>> +if (((to->to_flags & TOF_TS) == 0) && (tw->t_recent != 0)) {
>> +goto drop;
>> +}
> 
> This causes an insta-panic with TOE because toe_4tuple_check() passes in a 
> NULL
> pointer for 'to'.  I'm working on a fix for that, but perhaps wait to MFC 
> until
> the fix is ready so they can be merged together?
> 
> That said, TOE only calls this in the case that it has gotten a new SYN, so I
> wonder if it makes sense to apply this check on a new SYN.  For a new SYN,
> shouldn't we not care if the new connection is using a different timestamp
> option from the old connection?  The language in RFC 7323 3.2 is all about
> segments on an existing connection, not segments from a new connection I 
> think?
> 
> That is, I think we should perhaps move this check after the TH_SYN check so
> that a mismatch doesn't prevent recycling?

Actually, we move the check below requiring TH_ACK, I think this would fix the 
TOE
case and also DTRT for plain SYNs for non-TOE:

diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c
index c52eab956303..85f1ccbe40f9 100644
--- a/sys/netinet/tcp_timewait.c
+++ b/sys/netinet/tcp_timewait.c
@@ -411,16 +411,6 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct 
tcphdr *th,
if (thflags & TH_RST)
goto drop;
 
-   /*
-* If timestamps were negotiated during SYN/ACK and a
-* segment without a timestamp is received, silently drop
-* the segment.
-* See section 3.2 of RFC 7323.
-*/
-   if (((to->to_flags & TOF_TS) == 0) && (tw->t_recent != 0)) {
-   goto drop;
-   }
-
 #if 0
 /* PAWS not needed at the moment */
/*
@@ -455,6 +445,16 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct 
tcphdr *th,
if ((thflags & TH_ACK) == 0)
goto drop;
 
+   /*
+* If timestamps were negotiated during SYN/ACK and a
+* segment without a timestamp is received, silently drop
+* the segment.
+* See section 3.2 of RFC 7323.
+*/
+   if (((to->to_flags & TOF_TS) == 0) && (tw->t_recent != 0)) {
+   goto drop;
+   }
+
/*
 * Reset the 2MSL timer if this is a duplicate FIN.
 */

The commented out PAWS bits would also seem to not be relevant for SYN-only
packets?  However, I'm less sure of if that bit should be moved later as
well. (Or perhaps it should just be removed.  It has been #if 0'd since the
timewait structure was first added back in 2003 by jlemon@)

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


Re: svn commit: r367530 - in head/sys/netinet: . tcp_stacks

2020-11-19 Thread John Baldwin
On 11/9/20 1:49 PM, Michael Tuexen wrote:
> Author: tuexen
> Date: Mon Nov  9 21:49:40 2020
> New Revision: 367530
> URL: https://svnweb.freebsd.org/changeset/base/367530
> 
> Log:
>   RFC 7323 specifies that:
>   * TCP segments without timestamps should be dropped when support for
> the timestamp option has been negotiated.
>   * TCP segments with timestamps should be processed normally if support
> for the timestamp option has not been negotiated.
>   This patch enforces the above.
>   
>   PR: 250499
>   Reviewed by:gnn, rrs
>   MFC after:  1 week
>   Sponsored by:   Netflix, Inc
>   Differential Revision:  https://reviews.freebsd.org/D27148
> 
> Modified:
>   head/sys/netinet/tcp_input.c
>   head/sys/netinet/tcp_stacks/bbr.c
>   head/sys/netinet/tcp_stacks/rack.c
>   head/sys/netinet/tcp_syncache.c
>   head/sys/netinet/tcp_timewait.c
> 
> Modified: head/sys/netinet/tcp_timewait.c
> ==
> --- head/sys/netinet/tcp_timewait.c   Mon Nov  9 21:19:17 2020
> (r367529)
> +++ head/sys/netinet/tcp_timewait.c   Mon Nov  9 21:49:40 2020
> (r367530)
> @@ -376,7 +376,7 @@ tcp_twstart(struct tcpcb *tp)
>   * looking for a pcb in the listen state.  Returns 0 otherwise.
>   */
>  int
> -tcp_twcheck(struct inpcb *inp, struct tcpopt *to __unused, struct tcphdr *th,
> +tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct tcphdr *th,
>  struct mbuf *m, int tlen)
>  {
>   struct tcptw *tw;
> @@ -410,6 +410,16 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to __unu
>*/
>   if (thflags & TH_RST)
>   goto drop;
> +
> + /*
> +  * If timestamps were negotiated during SYN/ACK and a
> +  * segment without a timestamp is received, silently drop
> +  * the segment.
> +  * See section 3.2 of RFC 7323.
> +  */
> + if (((to->to_flags & TOF_TS) == 0) && (tw->t_recent != 0)) {
> + goto drop;
> + }

This causes an insta-panic with TOE because toe_4tuple_check() passes in a NULL
pointer for 'to'.  I'm working on a fix for that, but perhaps wait to MFC until
the fix is ready so they can be merged together?

That said, TOE only calls this in the case that it has gotten a new SYN, so I
wonder if it makes sense to apply this check on a new SYN.  For a new SYN,
shouldn't we not care if the new connection is using a different timestamp
option from the old connection?  The language in RFC 7323 3.2 is all about
segments on an existing connection, not segments from a new connection I think?

That is, I think we should perhaps move this check after the TH_SYN check so
that a mismatch doesn't prevent recycling?

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


svn commit: r367853 - head/contrib/elftoolchain/addr2line

2020-11-19 Thread Ed Maste
Author: emaste
Date: Thu Nov 19 21:10:36 2020
New Revision: 367853
URL: https://svnweb.freebsd.org/changeset/base/367853

Log:
  addr2line: swap if conditions for diff reduction in upcoming change
  
  No functional change intended.

Modified:
  head/contrib/elftoolchain/addr2line/addr2line.c

Modified: head/contrib/elftoolchain/addr2line/addr2line.c
==
--- head/contrib/elftoolchain/addr2line/addr2line.c Thu Nov 19 19:25:47 
2020(r367852)
+++ head/contrib/elftoolchain/addr2line/addr2line.c Thu Nov 19 21:10:36 
2020(r367853)
@@ -436,30 +436,7 @@ check_range(Dwarf_Debug dbg, Dwarf_Die die, Dwarf_Unsi
in_range = false;
 
ret = dwarf_attrval_unsigned(die, DW_AT_ranges, _off, );
-   if (ret == DW_DLV_NO_ENTRY) {
-   if (dwarf_attrval_unsigned(die, DW_AT_low_pc, , ) ==
-   DW_DLV_OK) {
-   if (lopc == curlopc)
-   return (DW_DLV_ERROR);
-   if (dwarf_attrval_unsigned(die, DW_AT_high_pc, ,
-   ) == DW_DLV_OK) {
-   /*
-* Check if the address falls into the PC
-* range of this CU.
-*/
-   if (handle_high_pc(die, lopc, ) !=
-   DW_DLV_OK)
-   return (DW_DLV_ERROR);
-   } else {
-   /* Assume ~0ULL if DW_AT_high_pc not present */
-   hipc = ~0ULL;
-   }
-
-   if (addr >= lopc && addr < hipc) {
-   in_range = true;
-   }
-   }
-   } else if (ret == DW_DLV_OK) {
+   if (ret == DW_DLV_OK) {
ret = dwarf_get_ranges(dbg, ranges_off, ,
_cnt, NULL, );
if (ret != DW_DLV_OK)
@@ -488,6 +465,29 @@ check_range(Dwarf_Debug dbg, Dwarf_Die die, Dwarf_Unsi
if (addr >= lopc && addr < hipc){
in_range = true;
break;
+   }
+   }
+   } else if (ret == DW_DLV_NO_ENTRY) {
+   if (dwarf_attrval_unsigned(die, DW_AT_low_pc, , ) ==
+   DW_DLV_OK) {
+   if (lopc == curlopc)
+   return (DW_DLV_ERROR);
+   if (dwarf_attrval_unsigned(die, DW_AT_high_pc, ,
+   ) == DW_DLV_OK) {
+   /*
+* Check if the address falls into the PC
+* range of this CU.
+*/
+   if (handle_high_pc(die, lopc, ) !=
+   DW_DLV_OK)
+   return (DW_DLV_ERROR);
+   } else {
+   /* Assume ~0ULL if DW_AT_high_pc not present */
+   hipc = ~0ULL;
+   }
+
+   if (addr >= lopc && addr < hipc) {
+   in_range = true;
}
}
} else {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2020-11-19 Thread Li-Wen Hsu
On Fri, Nov 20, 2020 at 3:00 AM John Baldwin  wrote:
> On 11/18/20 8:52 PM, Mark Johnston wrote:
> > There are some technical issues around Phabricator that would need to be
> > ironed out before this is really doable.  For me, the main one is that
> > email notifications are all-or-nothing: I would very much like to be
> > able to get email for each new review without automatically being
> > subscribed.
>
> That would indeed be interesting.  In all of the Projects I've worked
> with using GH or e-mail, it does seem to be all-or-nothing if you are
> on the notify list.
>
> Hmm, looks like you can create a Herald rule to do this btw.  Let's
> see if this works:
>
> https://reviews.freebsd.org/H138

Hmm, this reminds me there is an item on my TODO list: complete the
setup of dev-reviews@ list:

https://lists.freebsd.org/mailman/listinfo/dev-reviews

The purpose of it is exactly to let people (only) subscribe to the
newly created review.

And thanks for your rule and I just realized there is a "mailing list"
type of Phabricator user,

Let's see if this works: https://reviews.freebsd.org/H139


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


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

2020-11-19 Thread Mateusz Guzik
Author: mjg
Date: Thu Nov 19 19:25:47 2020
New Revision: 367852
URL: https://svnweb.freebsd.org/changeset/base/367852

Log:
  pipe: thundering herd problem in pipelock
  
  All reads and writes are serialized with a hand-rolled lock, but unlocking it
  always wakes up all waiters. Existing flag fields get resized to make room for
  introduction of waiter counter without growing the struct.
  
  Reviewed by:  kib
  Differential Revision:https://reviews.freebsd.org/D27273

Modified:
  head/sys/kern/sys_pipe.c
  head/sys/sys/pipe.h

Modified: head/sys/kern/sys_pipe.c
==
--- head/sys/kern/sys_pipe.cThu Nov 19 19:05:16 2020(r367851)
+++ head/sys/kern/sys_pipe.cThu Nov 19 19:25:47 2020(r367852)
@@ -622,9 +622,13 @@ pipelock(struct pipe *cpipe, int catch)
if (catch)
prio |= PCATCH;
while (cpipe->pipe_state & PIPE_LOCKFL) {
-   cpipe->pipe_state |= PIPE_LWANT;
+   KASSERT(cpipe->pipe_waiters >= 0,
+   ("%s: bad waiter count %d", __func__,
+   cpipe->pipe_waiters));
+   cpipe->pipe_waiters++;
error = msleep(cpipe, PIPE_MTX(cpipe),
prio, "pipelk", 0);
+   cpipe->pipe_waiters--;
if (error != 0)
return (error);
}
@@ -642,10 +646,12 @@ pipeunlock(struct pipe *cpipe)
PIPE_LOCK_ASSERT(cpipe, MA_OWNED);
KASSERT(cpipe->pipe_state & PIPE_LOCKFL,
("Unlocked pipe passed to pipeunlock"));
+   KASSERT(cpipe->pipe_waiters >= 0,
+   ("%s: bad waiter count %d", __func__,
+   cpipe->pipe_waiters));
cpipe->pipe_state &= ~PIPE_LOCKFL;
-   if (cpipe->pipe_state & PIPE_LWANT) {
-   cpipe->pipe_state &= ~PIPE_LWANT;
-   wakeup(cpipe);
+   if (cpipe->pipe_waiters > 0) {
+   wakeup_one(cpipe);
}
 }
 

Modified: head/sys/sys/pipe.h
==
--- head/sys/sys/pipe.h Thu Nov 19 19:05:16 2020(r367851)
+++ head/sys/sys/pipe.h Thu Nov 19 19:25:47 2020(r367852)
@@ -116,9 +116,10 @@ struct pipe {
struct  pipe *pipe_peer;/* link with other direction */
struct  pipepair *pipe_pair;/* container structure pointer */
u_short pipe_state; /* pipe status info */
-   u_short pipe_type;  /* pipe type info */
+   u_char  pipe_type;  /* pipe type info */
+   u_char  pipe_present;   /* still present? */
+   int pipe_waiters;   /* pipelock waiters */
int pipe_busy;  /* busy flag, mostly to handle rundown 
sanely */
-   int pipe_present;   /* still present? */
int pipe_wgen;  /* writer generation for named pipe */
ino_t   pipe_ino;   /* fake inode for stat(2) */
 };
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367851 - head/usr.bin/fstat

2020-11-19 Thread Fernando ApesteguĂ­a
Author: fernape (ports committer)
Date: Thu Nov 19 19:05:16 2020
New Revision: 367851
URL: https://svnweb.freebsd.org/changeset/base/367851

Log:
  fstat(1): Add EXAMPLES section
  
  * Add examples covering -f, -m and -p flags.
  
  While here, extend the initial description paragraph to note that fstat(1)
  will report on all opened files, belonging to processes the user has access 
to.
  The current paragraph may lead to understand that you can get information on
  opened files from processes belonging to other users.
  
  Reviewed by:  bjk@, danfe@, gbe@
  Approved by:  manpages (gbe@)
  Differential Revision:https://reviews.freebsd.org/D26949

Modified:
  head/usr.bin/fstat/fstat.1

Modified: head/usr.bin/fstat/fstat.1
==
--- head/usr.bin/fstat/fstat.1  Thu Nov 19 18:58:15 2020(r367850)
+++ head/usr.bin/fstat/fstat.1  Thu Nov 19 19:05:16 2020(r367851)
@@ -28,7 +28,7 @@
 .\" @(#)fstat.18.3 (Berkeley) 2/25/94
 .\" $FreeBSD$
 .\"
-.Dd June 17, 2020
+.Dd November 19, 2020
 .Dt FSTAT 1
 .Os
 .Sh NAME
@@ -51,7 +51,7 @@ is the working directory, root directory, jail root di
 active executable text, or kernel trace file for that process.
 If no options are specified,
 .Nm
-reports on all open files in the system.
+reports on all open files in the system for processes the user has access to.
 .Pp
 The following options are available:
 .Bl -tag -width "-N system"
@@ -118,7 +118,7 @@ The process id.
 The file number in the per-process open file table or one of the following
 special names:
 .Pp
-.Bl -tag -offset indent -compact
+.Bl -tag -width jail -offset indent -compact
 .It Sy jail
 jail root directory
 .It Sy mmap
@@ -235,6 +235,93 @@ a double arrow
 .Pq Ql <-> .
 For UNIX/local sockets either the local or remote address is shown, depending
 on which one is available.
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+Show all open files except those opened by
+.Nm
+itself:
+.Bd -literal -offset indent
+$ fstat | awk '$2 != "fstat"'
+USER CMD  PID   FD MOUNT  INUM MODE SZ|DV R/W
+alice  bash 469 text /usr/local 143355 -rwxr-xr-x  1166448  r
+alice  bash 469 ctty /dev346 crw--w  pts/81 rw
+\&...
+.Ed
+.Pp
+Report all files opened by the current shell in the same file system as
+.Pa /usr/local
+including memory-mapped files:
+.Bd -literal -offset indent
+$ fstat -m -p $$ -f /usr/local
+USER CMD  PID   FD MOUNT  INUM MODE SZ|DV R/W
+bob  bash 469 text /usr/local 143355 -rwxr-xr-x  1166448  r
+bob  bash 469 mmap /usr/local 143355 -rwxr-xr-x  1166448  r
+\&...
+.Ed
+.Pp
+Requesting information about a file that is not opened results in just a
+header line instead of an error:
+.Bd -literal -offset indent
+$ fstat /etc/rc.conf
+USER CMD  PID   FD MOUNT  INUM MODE SZ|DV R/W NAME
+.Ed
+.Pp
+All parameters after
+.Fl f
+will be interpreted as files, so the following will not work as expected:
+.Bd -literal -offset indent
+$ fstat -f /usr/local -m -p $$
+fstat: -m: No such file or directory
+fstat: -p: No such file or directory
+fstat: 469: No such file or directory
+\&...
+.Ed
+.Pp
+Show number of pipes opened by firefox processes:
+.Bd -literal -offset indent
+$ fstat | awk '$2=="firefox" && $5=="pipe"' | wc -l
+.Ed
+.Pp
+Show processes belonging to user
+.Dq bob
+whose standard error descriptor is opened in ttyv0:
+.Bd -literal -offset indent
+$ fstat -u bob | awk '$4 == 2 && $8 == "ttyv0"'
+bob  firefox778422 /dev103 crw---   ttyv0 rw
+bob  xinit   11942 /dev103 crw---   ttyv0 rw
+\&...
+.Ed
+.Pp
+Show opened TCP sockets.
+This output resembles the one produced by
+.Ql netstat -A -p tcp
+:
+.Bd -literal -offset indent
+$ fstat | awk '$7 == "tcp"'
+alice  firefox77991   32* internet stream tcp f800b7f147a0
+alice  firefox77991  137* internet stream tcp f800b7f12b70
+\&...
+.Ed
+.Pp
+Show a list of processes with files opened in the current directory
+mimicking the output of
+.Xr fuser 1
+:
+.Bd -literal -offset indent
+$ fstat . | awk 'NR > 1 {printf "%d%s(%s) ", $3, $4, $1;}'
+2133wd(alice) 2132wd(alice) 1991wd(alice)
+.Ed
+.Pp
+Create a list of processes sorted by number of opened files in desdencing 
order:
+.Bd -literal -offset indent
+$ fstat | awk 'NR > 1 {print $2;}' | sort | uniq -c | sort -r
+ 728 firefox
+  23 bash
+  14 sort
+   8 fstat
+   7 awk
+.Ed
 .Sh SEE ALSO
 .Xr fuser 1 ,
 .Xr netstat 1 ,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2020-11-19 Thread John Baldwin
On 11/18/20 8:52 PM, Mark Johnston wrote:
> On Wed, Nov 18, 2020 at 03:37:36PM -0800, John Baldwin wrote:
>> On 11/18/20 2:16 PM, Mateusz Guzik wrote:
>>> On 11/17/20, John Baldwin  wrote:
 On 11/14/20 11:22 AM, Mateusz Guzik wrote:
>>> Interested parties can check the consumer (also seen in the diff) to
>>> see this is for consistency. I don't think any comments are warranted
>>> in the header.
>>
>> I did read the consumer, and there didn't seem tremendous value in the
>> extra line there.
>>
 These changes would benefit from review.

>>>
>>> I don't think it's feasible to ask for review for everything lest it
>>> degardes to rubber stamping and I don't think this change warranted
>>> it, regardless of the cosmetic issues which can always show up.
>>
>> That is not consistent with the direction the project is moving.  If you
>> check the commit logs of other high-volume committers such as markj@,
>> kib@, or myself, you will find that a substantial number of those commits
>> are reviewed (typically in phabricator) without preventing us from
>> making useful progress.  Also, while the previous core did not mandate
>> reviews, we moved closer to it when the Pre-Commit Review chapter was
>> added to the Committer's Guide:
>>
>> https://www.freebsd.org/doc/en_US.ISO8859-1/articles/committers-guide/pre-commit-review.html
>>
>> In the related thread on developers@ we indicated that while weren't yet
>> making pre-commit review mandatory, we collectively want to move in that
>> direction.
> 
> With regard to the future direction of src development, I would propose
> a middle ground.  Most, if not all, changes should get a Phabricator
> review.  There should be some minimum period between creation of that
> review and a commit.  The developer should make some effort to cc active
> committers to the code.  Some areas of the tree will have stricter
> rules, but in general absence of feedback means that it's ok to commit.
> Exceptions might apply to build fixes, etc..  This still imposes some
> friction on the development process, but I have trouble seeing why
> someone's contibution might be gated on their ability to commit at a
> moment's notice.

Mmm, I think I agree fully with this, and that perhaps the terminology
is not clear as different folks have different perceptions of what
"mandatory reviews" means perhaps.  I know that some projects I work with
have a fully "mandatory" requirement (OpenSSL seems to), and others have
some exceptions (the "obvious" rule in FSF projects like GDB which the
note in the committers guide does include a variant of).  It is true
though that in practice sometimes changes just time out due to lack of
review (the OCF refactor is one of those in which I was able to get some
partial review of some pieces or some of the concepts, but not the
change as a whole).  I do think we want to be in a place where we do
at least seek review for most changes with an understanding that a change
can "timeout" on review and be merged without always having review
approval.
 
> There are some technical issues around Phabricator that would need to be
> ironed out before this is really doable.  For me, the main one is that
> email notifications are all-or-nothing: I would very much like to be
> able to get email for each new review without automatically being
> subscribed.

That would indeed be interesting.  In all of the Projects I've worked
with using GH or e-mail, it does seem to be all-or-nothing if you are
on the notify list.

Hmm, looks like you can create a Herald rule to do this btw.  Let's
see if this works:

https://reviews.freebsd.org/H138


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


svn commit: r367850 - head/usr.bin/grep

2020-11-19 Thread Fernando ApesteguĂ­a
Author: fernape (ports committer)
Date: Thu Nov 19 18:58:15 2020
New Revision: 367850
URL: https://svnweb.freebsd.org/changeset/base/367850

Log:
  grep(1): Add more EXAMPLES
  
  * Add more EXAMPLES covering flags: -A, -B, -c, -f, -i, -H, -l, -q, -R, -w
  * While here, change existing wording to use the imperative (remove "To
find")
  * Reword first example to be consistent with how grep(1) understand
words (-w)
  
  Approved by:  manpages (bcr@)
  Differential Revision:https://reviews.freebsd.org/D27264

Modified:
  head/usr.bin/grep/grep.1

Modified: head/usr.bin/grep/grep.1
==
--- head/usr.bin/grep/grep.1Thu Nov 19 18:37:28 2020(r367849)
+++ head/usr.bin/grep/grep.1Thu Nov 19 18:58:15 2020(r367850)
@@ -30,7 +30,7 @@
 .\"
 .\"@(#)grep.1  8.3 (Berkeley) 4/18/94
 .\"
-.Dd August 7, 2020
+.Dd November 19, 2020
 .Dt GREP 1
 .Os
 .Sh NAME
@@ -456,13 +456,27 @@ An error occurred.
 .Sh EXAMPLES
 .Bl -dash
 .It
-To find all occurrences of the word
+Find all occurrences of the pattern
 .Sq patricia
 in a file:
 .Pp
 .Dl $ grep 'patricia' myfile
 .It
-To find all occurrences of the pattern
+Same as above but looking only for complete words:
+.Pp
+.Dl $ grep -w 'patricia' myfile
+.It
+Count occurrences of the exact pattern
+.Sq FOO
+:
+.Pp
+.Dl $ grep -c FOO myfile
+.It
+Same as above but ignoring case:
+.Pp
+.Dl $ grep -c -i FOO myfile
+.It
+Find all occurrences of the pattern
 .Ql .Pp
 at the beginning of a line:
 .Pp
@@ -480,20 +494,55 @@ escapes the
 .Ql \&. ,
 which would otherwise match any character.
 .It
-To find all lines in a file which do not contain the words
+Find all lines in a file which do not contain the words
 .Sq foo
 or
 .Sq bar :
 .Pp
 .Dl $ grep -v -e 'foo' -e 'bar' myfile
 .It
-A simple example of an extended regular expression:
+Peruse the file
+.Sq calendar
+looking for either 19, 20, or 25 using extended regular expressions:
 .Pp
 .Dl $ egrep '19|20|25' calendar
+.It
+Show matching lines and the name of the
+.Sq *.h
+files which contain the pattern
+.Sq FIXME .
+Do the search recursively from the
+.Pa /usr/src/sys/arm
+directory
 .Pp
-Peruses the file
-.Sq calendar
-looking for either 19, 20, or 25.
+.Dl $ grep -H -R FIXME --include=*.h /usr/src/sys/arm/
+.It
+Same as above but show only the name of the matching file:
+.Pp
+.Dl $ grep -l -R FIXME --include=*.h /usr/src/sys/arm/
+.It
+Show lines containing the text
+.Sq foo .
+The matching part of the output is colored and every line is prefixed with
+the line number and the offset in the file for those lines that matched.
+.Pp
+.Dl $ grep -b --colour -n foo myfile
+.It
+Show lines that match the extended regular expression patterns read from the
+standard input:
+.Pp
+.Dl $ echo -e 'Free\enBSD\enAll.*reserved' | grep -E -f - myfile
+.It
+Show lines from the output of the
+.Xr pciconf 8
+command matching the specified extended regular expression along with
+three lines of leading context and one line of trailing context:
+.Pp
+.Dl $ pciconf -lv | grep -B3 -A1 -E 'class.*=.*storage'
+.It
+Suppress any output and use the exit status to show an appropriate message:
+.Pp
+.Dl $ grep -q foo myfile && echo File matches
 .El
 .Sh SEE ALSO
 .Xr ed 1 ,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367849 - head/sys/kern

2020-11-19 Thread Mark Johnston
Author: markj
Date: Thu Nov 19 18:37:28 2020
New Revision: 367849
URL: https://svnweb.freebsd.org/changeset/base/367849

Log:
  callout(9): Fix a race between CPU migration and callout_drain()
  
  Suppose a running callout re-arms itself, and before the callout
  finishes running another CPU calls callout_drain() and goes to sleep.
  softclock_call_cc() will wake up the draining thread, which may not run
  immediately if there is a lot of CPU load.  Furthermore, the callout is
  still in the callout wheel so it can continue to run and re-arm itself.
  Then, suppose that the callout migrates to another CPU before the
  draining thread gets a chance to run.  The draining thread is in this
  loop in _callout_stop_safe():
  
while (cc_exec_curr(cc) == c) {
CC_UNLOCK(cc);
sleep();
CC_LOCK(cc);
}
  
  but after the migration, cc points to the wrong CPU's callout state.
  Then the draining thread goes off and removes the callout from the
  wheel, but does so using the wrong lock and per-CPU callout state.
  
  Fix the problem by doing a re-lookup of the callout CPU after sleeping.
  
  Reported by:  syzbot+79569cd4d76636b2c...@syzkaller.appspotmail.com
  Reported by:  syzbot+1b27e0237aa22d8ad...@syzkaller.appspotmail.com
  Reported by:  syzbot+e21aa5b85a9aff90e...@syzkaller.appspotmail.com
  Reviewed by:  emaste, hselasky
  Tested by:pho
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D27266

Modified:
  head/sys/kern/kern_timeout.c

Modified: head/sys/kern/kern_timeout.c
==
--- head/sys/kern/kern_timeout.cThu Nov 19 18:03:40 2020
(r367848)
+++ head/sys/kern/kern_timeout.cThu Nov 19 18:37:28 2020
(r367849)
@@ -1145,7 +1145,7 @@ again:
 * just wait for the current invocation to
 * finish.
 */
-   while (cc_exec_curr(cc, direct) == c) {
+   if (cc_exec_curr(cc, direct) == c) {
/*
 * Use direct calls to sleepqueue interface
 * instead of cv/msleep in order to avoid
@@ -1193,7 +1193,7 @@ again:
 
/* Reacquire locks previously released. */
PICKUP_GIANT();
-   CC_LOCK(cc);
+   goto again;
}
c->c_flags &= ~CALLOUT_ACTIVE;
} else if (use_lock &&
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2020-11-19 Thread luporl
This causes a panic on PowerPC64:

panic: mtx_lock() by idle thread 0xc00806437100 on sleep mutex
kernelpmap @ /usr/home/luporl/git/master/sys/powerpc/aim/mmu_oea64.c:2237
cpuid = 31
time = 1605806644
KDB: stack backtrace:
0xc008014d91e0: at kdb_backtrace+0x60
0xc008014d92f0: at vpanic+0x1e0
0xc008014d93a0: at panic+0x40
0xc008014d93d0: at __mtx_lock_flags+0x23c
0xc008014d9480: at moea64_kextract+0x68
0xc008014d9560: at thread_stash+0x48
0xc008014d95a0: at mi_switch+0x1fc
0xc008014d9620: at critical_exit_preempt+0x88
0xc008014d9650: at cpu_idle+0xd4
0xc008014d96c0: at sched_idletd+0x440
0xc008014d9820: at fork_exit+0xc4
0xc008014d98c0: at fork_trampoline+0x18
0xc008014d98f0: at cpu_reset_handler+0x64

It seems the problem is the vtophys() call in thread_zombie(), as PPC64's
pmap_kextract() will try to acquire a pmap lock for addresses out of DMAP
range.

On Thu, Nov 19, 2020 at 7:01 AM Mateusz Guzik  wrote:

> Author: mjg
> Date: Thu Nov 19 10:00:48 2020
> New Revision: 367842
> URL: https://svnweb.freebsd.org/changeset/base/367842
>
> Log:
>   thread: numa-aware zombie reaping
>
>   The current global list is a significant problem, in particular induces
> a lot
>   of cross-domain thread frees. When running poudriere on a 2 domain box
> about
>   half of all frees were of that nature.
>
>   Patch below introduces per-domain thread data containing zombie lists and
>   domain-aware reaping. By default it only reaps from the current domain,
> only
>   reaping from others if there is free TID shortage.
>
>   A dedicated callout is introduced to reap lingering threads if there
> happens
>   to be no activity.
>
>   Reviewed by:  kib, markj
>   Differential Revision:https://reviews.freebsd.org/D27185
>
> Modified:
>   head/sys/kern/kern_thread.c
>
> Modified: head/sys/kern/kern_thread.c
>
> ==
> --- head/sys/kern/kern_thread.c Thu Nov 19 09:26:51 2020(r367841)
> +++ head/sys/kern/kern_thread.c Thu Nov 19 10:00:48 2020(r367842)
> @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -64,9 +65,11 @@ __FBSDID("$FreeBSD$");
>
>  #include 
>
> +#include 
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>
>  /*
> @@ -128,9 +131,20 @@ SDT_PROBE_DEFINE(proc, , , lwp__exit);
>   */
>  static uma_zone_t thread_zone;
>
> -static __exclusive_cache_line struct thread *thread_zombies;
> +struct thread_domain_data {
> +   struct thread   *tdd_zombies;
> +   int tdd_reapticks;
> +} __aligned(CACHE_LINE_SIZE);
>
> +static struct thread_domain_data thread_domain_data[MAXMEMDOM];
> +
> +static struct task thread_reap_task;
> +static struct callout  thread_reap_callout;
> +
>  static void thread_zombie(struct thread *);
> +static void thread_reap_all(void);
> +static void thread_reap_task_cb(void *, int);
> +static void thread_reap_callout_cb(void *);
>  static int thread_unsuspend_one(struct thread *td, struct proc *p,
>  bool boundary);
>  static void thread_free_batched(struct thread *td);
> @@ -159,30 +173,45 @@ EVENTHANDLER_LIST_DEFINE(thread_init);
>  EVENTHANDLER_LIST_DEFINE(thread_fini);
>
>  static bool
> -thread_count_inc(void)
> +thread_count_inc_try(void)
>  {
> -   static struct timeval lastfail;
> -   static int curfail;
> int nthreads_new;
>
> -   thread_reap();
> -
> nthreads_new = atomic_fetchadd_int(, 1) + 1;
> if (nthreads_new >= maxthread - 100) {
> if (priv_check_cred(curthread->td_ucred, PRIV_MAXPROC) !=
> 0 ||
> nthreads_new >= maxthread) {
> atomic_subtract_int(, 1);
> -   if (ppsratecheck(, , 1)) {
> -   printf("maxthread limit exceeded by uid %u
> "
> -   "(pid %d); consider increasing
> kern.maxthread\n",
> -   curthread->td_ucred->cr_ruid,
> curproc->p_pid);
> -   }
> return (false);
> }
> }
> return (true);
>  }
>
> +static bool
> +thread_count_inc(void)
> +{
> +   static struct timeval lastfail;
> +   static int curfail;
> +
> +   thread_reap();
> +   if (thread_count_inc_try()) {
> +   return (true);
> +   }
> +
> +   thread_reap_all();
> +   if (thread_count_inc_try()) {
> +   return (true);
> +   }
> +
> +   if (ppsratecheck(, , 1)) {
> +   printf("maxthread limit exceeded by uid %u "
> +   "(pid %d); consider increasing kern.maxthread\n",
> +   curthread->td_ucred->cr_ruid, curproc->p_pid);
> +   }
> +   return (false);
> +}
> +
>  static void
>  thread_count_sub(int n)
>  {
> @@ -500,6 +529,10 @@ threadinit(void)
> 

svn commit: r367848 - in head: share/man/man4 sys/kern

2020-11-19 Thread Mitchell Horne
Author: mhorne
Date: Thu Nov 19 18:03:40 2020
New Revision: 367848
URL: https://svnweb.freebsd.org/changeset/base/367848

Log:
  Add an option for entering KDB on recursive panics
  
  There are many cases where one would choose avoid entering the debugger
  on a normal panic, opting instead to reboot and possibly save a kernel
  dump. However, recursive kernel panics are an unusual case that might
  warrant attention from a human, so provide a secondary tunable,
  debug.debugger_on_recursive_panic, to allow entering the debugger only
  when this occurs.
  
  For for simplicity in maintaining existing behaviour, the tunable
  defaults to zero.
  
  Reviewed by:  cem, markj
  Sponsored by: NetApp, Inc.
  Sponsored by: Klara, Inc.
  Differential Revision:https://reviews.freebsd.org/D27271

Modified:
  head/share/man/man4/ddb.4
  head/sys/kern/kern_shutdown.c

Modified: head/share/man/man4/ddb.4
==
--- head/share/man/man4/ddb.4   Thu Nov 19 17:54:41 2020(r367847)
+++ head/share/man/man4/ddb.4   Thu Nov 19 18:03:40 2020(r367848)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 17, 2019
+.Dd November 19, 2020
 .Dt DDB 4
 .Os
 .Sh NAME
@@ -87,6 +87,16 @@ which is the default
 unless the
 .Dv KDB_UNATTENDED
 option is specified.
+Similarly, if the
+.Va debug.debugger_on_recursive_panic
+variable is set to
+.Dv 1 ,
+then the debugger will be invoked on a recursive kernel panic.
+This variable has a default value of
+.Dv 0 ,
+and has no effect if
+.Va debug.debugger_on_panic
+is already set non-zero.
 .Pp
 The current location is called
 .Va dot .

Modified: head/sys/kern/kern_shutdown.c
==
--- head/sys/kern/kern_shutdown.c   Thu Nov 19 17:54:41 2020
(r367847)
+++ head/sys/kern/kern_shutdown.c   Thu Nov 19 18:03:40 2020
(r367848)
@@ -127,6 +127,11 @@ SYSCTL_INT(_debug, OID_AUTO, debugger_on_panic,
 CTLFLAG_RWTUN | CTLFLAG_SECURE,
 _on_panic, 0, "Run debugger on kernel panic");
 
+static bool debugger_on_recursive_panic = false;
+SYSCTL_BOOL(_debug, OID_AUTO, debugger_on_recursive_panic,
+CTLFLAG_RWTUN | CTLFLAG_SECURE,
+_on_recursive_panic, 0, "Run debugger on recursive kernel panic");
+
 int debugger_on_trap = 0;
 SYSCTL_INT(_debug, OID_AUTO, debugger_on_trap,
 CTLFLAG_RWTUN | CTLFLAG_SECURE,
@@ -899,6 +904,8 @@ vpanic(const char *fmt, va_list ap)
kdb_backtrace();
if (debugger_on_panic)
kdb_enter(KDB_WHY_PANIC, "panic");
+   else if (!newpanic && debugger_on_recursive_panic)
+   kdb_enter(KDB_WHY_PANIC, "re-panic");
 #endif
/*thread_lock(td); */
td->td_flags |= TDF_INPANIC;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2020-11-19 Thread Warner Losh
Author: imp
Date: Thu Nov 19 17:54:41 2020
New Revision: 367847
URL: https://svnweb.freebsd.org/changeset/base/367847

Log:
  Document disk ioctl
  
  First stab at documenting the different disk ioctl commands defined in
  sys/disk.h.
  
  Reviewed by: phk (prior version)
  Differential Revision: https://reviews.freebsd.org/D26994

Added:
  head/share/man/man4/disk.4   (contents, props changed)
Modified:
  head/share/man/man4/Makefile

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileThu Nov 19 16:57:45 2020
(r367846)
+++ head/share/man/man4/MakefileThu Nov 19 17:54:41 2020
(r367847)
@@ -130,6 +130,7 @@ MAN=aac.4 \
ddb.4 \
devctl.4 \
disc.4 \
+   disk.4 \
divert.4 \
${_dpms.4} \
ds1307.4 \

Added: head/share/man/man4/disk.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/disk.4  Thu Nov 19 17:54:41 2020(r367847)
@@ -0,0 +1,210 @@
+.\" Copyright (c) 2020 M. Warner Losh 
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\"
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd November 20, 2020
+.Dt disk 4
+.Os
+.Sh NAME
+.Nm disk
+.Nd common disk interfaces
+.Sh SYNOPSIS
+.Cd device cd
+.Sh DESCRIPTION
+Common block device IOCTLs
+.Pp
+All the block devices in the system should support these disk
+.Xr ioctl 2
+commands defined here.
+Much of this information is also available via the
+.Xr geom 2
+attributes.
+.Sh IOCTLS
+The following
+.Xr ioctl 2
+calls apply to disk drives, and are defined
+in the
+.In sys/disk.h
+header file.
+.Bl -tag -width DIOCGPROVIDERNAME
+.It Dv DIOCGSECTORSIZE
+.Pq Li "u_int"
+Get the sector or block size of the device in bytes.
+The sector size is the smallest unit of data which can be transferred
+from this device.
+This is usually a power of 2 but it might not be (e.g. CDROM audio).
+Operations to block devices such as
+.Xr lseek 2 ,
+.Xr read 2 ,
+and
+.Xr write
+may only be performed at file offsets that are integral multiple of
+this size.
+.It Dv DIOCGMEDIASIZE
+.Pq Li "off_t"
+Get the size of the entire device in bytes.
+This should be a multiple of the sector size.
+.It Dv DIOCGFWSECTORS
+.Pq Li "u_int"
+Return the firmware's notion of number of sectors per track.
+This value is mostly used for compatibility with various ill designed
+disk label formats.
+Use this value only when absolutely required.
+Its interpretation and use is largely obsolete.
+.It Dv DIOCGFWHEADS
+.Pq Li "u_int"
+Return the firmware's notion of number of heads per cylinder.
+This value is mostly used for compatibility with various ill designed
+disk label formats.
+Use this value only when absolutely required.
+Its interpretation and use is largely obsolete.
+.It Dv DIOCGFLUSH
+Flush write cache of the device.
+.It Dv DIOCGDELETE
+.Pq Li "off_t[2]"
+Mark data on the device as unused.
+The first element is the offset to start deleting.
+The second element is the length to delete.
+Providers may use this information to free storage or instruct storage
+devices the contents can be discarded.
+.It Dv DIOCGIDENT
+.Pq Li "char[DISK_IDENT_SIZE]"
+Get the ident for this provider.
+Ident is a unique and fixed identifier for this provider.
+Ident's properties are as follow:
+.Bl -bullet
+.It
+preserved between reboots,
+.It
+preserved across a provider being detached/attached,
+.It
+provider's name can change - ident can't,
+.It
+ident value should not be based on on-disk metadata; in other
+words, copying whole data from one disk to another should not

svn commit: r367846 - head/share/man/man7

2020-11-19 Thread Daniel Ebdrup Jensen
Author: debdrup (doc committer)
Date: Thu Nov 19 16:57:45 2020
New Revision: 367846
URL: https://svnweb.freebsd.org/changeset/base/367846

Log:
  intro.7: Add missing manual page
  
  Section 7 of the manual pages contain lots of very useful information, but
  finding the pages is not always obvious - to assist people in finding the
  information, add missing cross-references.
  
  Reviewed by:  0mp (mentor), mhorne, yuripv
  Approved by:  0mp (mentor
  Differential Revision:https://reviews.freebsd.org/D27284

Modified:
  head/share/man/man7/intro.7

Modified: head/share/man/man7/intro.7
==
--- head/share/man/man7/intro.7 Thu Nov 19 15:41:42 2020(r367845)
+++ head/share/man/man7/intro.7 Thu Nov 19 16:57:45 2020(r367846)
@@ -28,7 +28,7 @@
 .\" @(#)intro.78.1 (Berkeley) 6/5/93
 .\" $FreeBSD$
 .\"
-.Dd May 3, 2020
+.Dd November 19, 2020
 .Dt INTRO 7
 .Os
 .Sh NAME
@@ -37,12 +37,29 @@
 .Sh DESCRIPTION
 This section contains miscellaneous documentation.
 .Bl -tag -width "mdoc.samples(7)" -offset indent
+.It Xr arch 7
+supported CPU architectures and platforms
 .It Xr ascii 7
 map of ASCII character set
+.It Xr build 7
+build instructions for
+.Fx
 .It Xr c 7
 the C programming language
+.It Xr clocks 7
+system timekeeping clocks available in
+.Fx
+.It Xr crypto 7
+cryptographic algorithms provided by OpenCrypto in
+.Fx
+.It Xr development 7
+development introduction to
+.Fx
 .It Xr environ 7
 user environment
+.It Xr ffs 7
+commonly used filesystem in
+.Fx
 .It Xr firewall 7
 simple firewalls under
 .Fx
@@ -61,6 +78,13 @@ introduction to the ports infrastructure of
 .It Xr security 7
 security features available in
 .Fx
+.It Xr stats 7
+statistics utilities available in
+.Fx
+.It Xr tests 7
+introduction to the
+.Fx
+Test Suite
 .It Xr tuning 7
 general advice on tuning
 .Fx
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367845 - head/sys/vm

2020-11-19 Thread Mark Johnston
Author: markj
Date: Thu Nov 19 15:41:42 2020
New Revision: 367845
URL: https://svnweb.freebsd.org/changeset/base/367845

Log:
  Wrap a long line in vm_pqbatch_process_page()

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Thu Nov 19 15:40:58 2020(r367844)
+++ head/sys/vm/vm_page.c   Thu Nov 19 15:41:42 2020(r367845)
@@ -3545,7 +3545,8 @@ vm_pqbatch_process_page(struct vm_pagequeue *pq, vm_pa
counter_u64_add(queue_nops, 1);
break;
}
-   KASSERT(old.queue != PQ_NONE || (old.flags & 
PGA_QUEUE_STATE_MASK) == 0,
+   KASSERT(old.queue != PQ_NONE ||
+   (old.flags & PGA_QUEUE_STATE_MASK) == 0,
("%s: page %p has unexpected queue state", __func__, m));
 
new = old;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367844 - head/sys/vm

2020-11-19 Thread Mark Johnston
Author: markj
Date: Thu Nov 19 15:40:58 2020
New Revision: 367844
URL: https://svnweb.freebsd.org/changeset/base/367844

Log:
  Micro-optimize vm_page_pqbatch_submit()
  
  Avoid calling vm_page_domain() twice.
  
  Discussed with:   alc (in D27207)

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Thu Nov 19 14:27:01 2020(r367843)
+++ head/sys/vm/vm_page.c   Thu Nov 19 15:40:58 2020(r367844)
@@ -3598,8 +3598,6 @@ vm_page_pqbatch_submit(vm_page_t m, uint8_t queue)
KASSERT(queue < PQ_COUNT, ("invalid queue %d", queue));
 
domain = vm_page_domain(m);
-   pq = _pagequeue_domain(m)->vmd_pagequeues[queue];
-
critical_enter();
bq = DPCPU_PTR(pqbatch[domain][queue]);
if (vm_batchqueue_insert(bq, m)) {
@@ -3607,6 +3605,8 @@ vm_page_pqbatch_submit(vm_page_t m, uint8_t queue)
return;
}
critical_exit();
+
+   pq = _DOMAIN(domain)->vmd_pagequeues[queue];
vm_pagequeue_lock(pq);
critical_enter();
bq = DPCPU_PTR(pqbatch[domain][queue]);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367843 - head/release/arm64

2020-11-19 Thread Emmanuel Vadot
Author: manu
Date: Thu Nov 19 14:27:01 2020
New Revision: 367843
URL: https://svnweb.freebsd.org/changeset/base/367843

Log:
  release: Switch the Allwinner board to GPT
  
  Allwinner bootrom have an alternate location for u-boot at 128k.
  Work was made recently in u-boot to relocate correctly if loaded from
  there.
  The advantage of this offset is that we can now use a GPT scheme.

Modified:
  head/release/arm64/PINE64-LTS.conf
  head/release/arm64/PINE64.conf
  head/release/arm64/PINEBOOK.conf

Modified: head/release/arm64/PINE64-LTS.conf
==
--- head/release/arm64/PINE64-LTS.conf  Thu Nov 19 10:00:48 2020
(r367842)
+++ head/release/arm64/PINE64-LTS.conf  Thu Nov 19 14:27:01 2020
(r367843)
@@ -13,7 +13,7 @@ IMAGE_SIZE="3072M"
 KERNEL="GENERIC"
 MD_ARGS="-x 63 -y 255"
 NODOC=1
-PART_SCHEME="MBR"
+PART_SCHEME="GPT"
 FDT_OVERLAYS="sun50i-a64-timer,sun50i-a64-opp"
 export BOARDNAME="PINE64-LTS"
 
@@ -21,7 +21,7 @@ arm_install_uboot() {
UBOOT_DIR="/usr/local/share/u-boot/u-boot-pine64-lts"
UBOOT_FILES="u-boot-sunxi-with-spl.bin"
chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \
-   of=/dev/${mddev} bs=1k seek=8 conv=sync
+   of=/dev/${mddev} bs=128k seek=1 conv=sync

return 0
 }

Modified: head/release/arm64/PINE64.conf
==
--- head/release/arm64/PINE64.conf  Thu Nov 19 10:00:48 2020
(r367842)
+++ head/release/arm64/PINE64.conf  Thu Nov 19 14:27:01 2020
(r367843)
@@ -13,7 +13,7 @@ IMAGE_SIZE="3072M"
 KERNEL="GENERIC"
 MD_ARGS="-x 63 -y 255"
 NODOC=1
-PART_SCHEME="MBR"
+PART_SCHEME="GPT"
 FDT_OVERLAYS="sun50i-a64-timer,sun50i-a64-opp"
 export BOARDNAME="PINE64"
 
@@ -21,7 +21,7 @@ arm_install_uboot() {
UBOOT_DIR="/usr/local/share/u-boot/u-boot-pine64"
UBOOT_FILES="u-boot-sunxi-with-spl.bin"
chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \
-   of=/dev/${mddev} bs=1k seek=8 conv=sync
+   of=/dev/${mddev} bs=128k seek=1 conv=sync

return 0
 }

Modified: head/release/arm64/PINEBOOK.conf
==
--- head/release/arm64/PINEBOOK.confThu Nov 19 10:00:48 2020
(r367842)
+++ head/release/arm64/PINEBOOK.confThu Nov 19 14:27:01 2020
(r367843)
@@ -13,7 +13,7 @@ IMAGE_SIZE="3072M"
 KERNEL="GENERIC"
 MD_ARGS="-x 63 -y 255"
 NODOC=1
-PART_SCHEME="MBR"
+PART_SCHEME="GPT"
 FDT_OVERLAYS="sun50i-a64-timer,sun50i-a64-opp"
 export BOARDNAME="PINEBOOK"
 
@@ -21,7 +21,7 @@ arm_install_uboot() {
UBOOT_DIR="/usr/local/share/u-boot/u-boot-pinebook"
UBOOT_FILES="u-boot-sunxi-with-spl.bin"
chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \
-   of=/dev/${mddev} bs=1k seek=8 conv=sync
+   of=/dev/${mddev} bs=128k seek=1 conv=sync
 
return 0
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367842 - head/sys/kern

2020-11-19 Thread Mateusz Guzik
Author: mjg
Date: Thu Nov 19 10:00:48 2020
New Revision: 367842
URL: https://svnweb.freebsd.org/changeset/base/367842

Log:
  thread: numa-aware zombie reaping
  
  The current global list is a significant problem, in particular induces a lot
  of cross-domain thread frees. When running poudriere on a 2 domain box about
  half of all frees were of that nature.
  
  Patch below introduces per-domain thread data containing zombie lists and
  domain-aware reaping. By default it only reaps from the current domain, only
  reaping from others if there is free TID shortage.
  
  A dedicated callout is introduced to reap lingering threads if there happens
  to be no activity.
  
  Reviewed by:  kib, markj
  Differential Revision:https://reviews.freebsd.org/D27185

Modified:
  head/sys/kern/kern_thread.c

Modified: head/sys/kern/kern_thread.c
==
--- head/sys/kern/kern_thread.c Thu Nov 19 09:26:51 2020(r367841)
+++ head/sys/kern/kern_thread.c Thu Nov 19 10:00:48 2020(r367842)
@@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -64,9 +65,11 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 
 /*
@@ -128,9 +131,20 @@ SDT_PROBE_DEFINE(proc, , , lwp__exit);
  */
 static uma_zone_t thread_zone;
 
-static __exclusive_cache_line struct thread *thread_zombies;
+struct thread_domain_data {
+   struct thread   *tdd_zombies;
+   int tdd_reapticks;
+} __aligned(CACHE_LINE_SIZE);
 
+static struct thread_domain_data thread_domain_data[MAXMEMDOM];
+
+static struct task thread_reap_task;
+static struct callout  thread_reap_callout;
+
 static void thread_zombie(struct thread *);
+static void thread_reap_all(void);
+static void thread_reap_task_cb(void *, int);
+static void thread_reap_callout_cb(void *);
 static int thread_unsuspend_one(struct thread *td, struct proc *p,
 bool boundary);
 static void thread_free_batched(struct thread *td);
@@ -159,30 +173,45 @@ EVENTHANDLER_LIST_DEFINE(thread_init);
 EVENTHANDLER_LIST_DEFINE(thread_fini);
 
 static bool
-thread_count_inc(void)
+thread_count_inc_try(void)
 {
-   static struct timeval lastfail;
-   static int curfail;
int nthreads_new;
 
-   thread_reap();
-
nthreads_new = atomic_fetchadd_int(, 1) + 1;
if (nthreads_new >= maxthread - 100) {
if (priv_check_cred(curthread->td_ucred, PRIV_MAXPROC) != 0 ||
nthreads_new >= maxthread) {
atomic_subtract_int(, 1);
-   if (ppsratecheck(, , 1)) {
-   printf("maxthread limit exceeded by uid %u "
-   "(pid %d); consider increasing 
kern.maxthread\n",
-   curthread->td_ucred->cr_ruid, curproc->p_pid);
-   }
return (false);
}
}
return (true);
 }
 
+static bool
+thread_count_inc(void)
+{
+   static struct timeval lastfail;
+   static int curfail;
+
+   thread_reap();
+   if (thread_count_inc_try()) {
+   return (true);
+   }
+
+   thread_reap_all();
+   if (thread_count_inc_try()) {
+   return (true);
+   }
+
+   if (ppsratecheck(, , 1)) {
+   printf("maxthread limit exceeded by uid %u "
+   "(pid %d); consider increasing kern.maxthread\n",
+   curthread->td_ucred->cr_ruid, curproc->p_pid);
+   }
+   return (false);
+}
+
 static void
 thread_count_sub(int n)
 {
@@ -500,6 +529,10 @@ threadinit(void)
M_TIDHASH, M_WAITOK | M_ZERO);
for (i = 0; i < tidhashlock + 1; i++)
rw_init(_lock[i], "tidhash");
+
+   TASK_INIT(_reap_task, 0, thread_reap_task_cb, NULL);
+   callout_init(_reap_callout, 1);
+   callout_reset(_reap_callout, 5 * hz, thread_reap_callout_cb, 
NULL);
 }
 
 /*
@@ -508,12 +541,14 @@ threadinit(void)
 void
 thread_zombie(struct thread *td)
 {
+   struct thread_domain_data *tdd;
struct thread *ztd;
 
-   ztd = atomic_load_ptr(_zombies);
+   tdd = _domain_data[vm_phys_domain(vtophys(td))];
+   ztd = atomic_load_ptr(>tdd_zombies);
for (;;) {
td->td_zombie = ztd;
-   if (atomic_fcmpset_rel_ptr((uintptr_t *)_zombies,
+   if (atomic_fcmpset_rel_ptr((uintptr_t *)>tdd_zombies,
(uintptr_t *), (uintptr_t)td))
break;
continue;
@@ -531,10 +566,10 @@ thread_stash(struct thread *td)
 }
 
 /*
- * Reap zombie threads.
+ * Reap zombies from passed domain.
  */
-void
-thread_reap(void)
+static void
+thread_reap_domain(struct thread_domain_data *tdd)
 {
struct thread *itd, *ntd;
struct tidbatch tidbatch;
@@ -547,19 +582,26 @@ 

svn commit: r367841 - head/sys/arm64/arm64

2020-11-19 Thread Andrew Turner
Author: andrew
Date: Thu Nov 19 09:26:51 2020
New Revision: 367841
URL: https://svnweb.freebsd.org/changeset/base/367841

Log:
  Fall back to use the GICR address from the generic interrupt struct
  
  When there is no ACPI redistributor sub-table in the MADT we need to
  fall back to use the GICR base address from the GIC CPU interface
  structure.
  
  Handle this fallback when adding memory to the device and when counting
  the number of redistributors.
  
  PR:   251171
  Reported by:  Andrey Fesenko 
  Sponsored by: Innovate UK
  Differential Revision:https://reviews.freebsd.org/D27247

Modified:
  head/sys/arm64/arm64/gic_v3_acpi.c

Modified: head/sys/arm64/arm64/gic_v3_acpi.c
==
--- head/sys/arm64/arm64/gic_v3_acpi.c  Thu Nov 19 09:17:41 2020
(r367840)
+++ head/sys/arm64/arm64/gic_v3_acpi.c  Thu Nov 19 09:26:51 2020
(r367841)
@@ -88,6 +88,7 @@ struct madt_table_data {
device_t dev;
ACPI_MADT_GENERIC_DISTRIBUTOR *dist;
int count;
+   bool rdist_use_gicc;
 };
 
 static void
@@ -120,12 +121,16 @@ static void
 rdist_map(ACPI_SUBTABLE_HEADER *entry, void *arg)
 {
ACPI_MADT_GENERIC_REDISTRIBUTOR *redist;
+   ACPI_MADT_GENERIC_INTERRUPT *intr;
struct madt_table_data *madt_data;
+   rman_res_t count;
 
madt_data = (struct madt_table_data *)arg;
 
switch(entry->Type) {
case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR:
+   if (madt_data->rdist_use_gicc)
+   break;
redist = (ACPI_MADT_GENERIC_REDISTRIBUTOR *)entry;
 
madt_data->count++;
@@ -134,6 +139,23 @@ rdist_map(ACPI_SUBTABLE_HEADER *entry, void *arg)
redist->Length);
break;
 
+   case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
+   if (!madt_data->rdist_use_gicc)
+   break;
+
+   intr = (ACPI_MADT_GENERIC_INTERRUPT *)entry;
+
+   madt_data->count++;
+   /*
+* Map the two 64k redistributor frames.
+*/
+   count = GICR_RD_BASE_SIZE + GICR_SGI_BASE_SIZE;
+   if (madt_data->dist->Version == ACPI_MADT_GIC_VERSION_V4)
+   count += GICR_VLPI_BASE_SIZE + GICR_RESERVED_SIZE;
+   BUS_SET_RESOURCE(madt_data->parent, madt_data->dev,
+   SYS_RES_MEMORY, madt_data->count, intr->GicrBaseAddress,
+   count);
+
default:
break;
}
@@ -190,8 +212,18 @@ gic_v3_acpi_identify(driver_t *driver, device_t parent
madt_data.dist->BaseAddress, 128 * 1024);
 
madt_data.dev = dev;
+   madt_data.rdist_use_gicc = false;
acpi_walk_subtables(madt + 1, (char *)madt + madt->Header.Length,
rdist_map, _data);
+   if (madt_data.count == 0) {
+   /*
+* No redistributors found, fall back to use the GICR
+* address from the GICC sub-table.
+*/
+   madt_data.rdist_use_gicc = true;
+   acpi_walk_subtables(madt + 1, (char *)madt + 
madt->Header.Length,
+   rdist_map, _data);
+   }
 
acpi_set_private(dev, (void *)(uintptr_t)madt_data.dist->Version);
 
@@ -224,6 +256,15 @@ madt_count_redistrib(ACPI_SUBTABLE_HEADER *entry, void
sc->gic_redists.nregions++;
 }
 
+static void
+madt_count_gicc_redistrib(ACPI_SUBTABLE_HEADER *entry, void *arg)
+{
+   struct gic_v3_softc *sc = arg;
+
+   if (entry->Type == ACPI_MADT_TYPE_GENERIC_INTERRUPT)
+   sc->gic_redists.nregions++;
+}
+
 static int
 gic_v3_acpi_count_regions(device_t dev)
 {
@@ -245,6 +286,12 @@ gic_v3_acpi_count_regions(device_t dev)
 
acpi_walk_subtables(madt + 1, (char *)madt + madt->Header.Length,
madt_count_redistrib, sc);
+   /* Fall back to use the distributor GICR base address */
+   if (sc->gic_redists.nregions == 0) {
+   acpi_walk_subtables(madt + 1,
+   (char *)madt + madt->Header.Length,
+   madt_count_gicc_redistrib, sc);
+   }
acpi_unmap_table(madt);
 
return (sc->gic_redists.nregions > 0 ? 0 : ENXIO);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367835 - head/sys/kern

2020-11-19 Thread Mateusz Guzik
Author: mjg
Date: Thu Nov 19 08:16:45 2020
New Revision: 367835
URL: https://svnweb.freebsd.org/changeset/base/367835

Log:
  pipe: tidy up pipelock

Modified:
  head/sys/kern/sys_pipe.c

Modified: head/sys/kern/sys_pipe.c
==
--- head/sys/kern/sys_pipe.cThu Nov 19 07:23:39 2020(r367834)
+++ head/sys/kern/sys_pipe.cThu Nov 19 08:16:45 2020(r367835)
@@ -614,14 +614,17 @@ pipespace(struct pipe *cpipe, int size)
 static __inline int
 pipelock(struct pipe *cpipe, int catch)
 {
-   int error;
+   int error, prio;
 
PIPE_LOCK_ASSERT(cpipe, MA_OWNED);
+
+   prio = PRIBIO;
+   if (catch)
+   prio |= PCATCH;
while (cpipe->pipe_state & PIPE_LOCKFL) {
cpipe->pipe_state |= PIPE_LWANT;
error = msleep(cpipe, PIPE_MTX(cpipe),
-   catch ? (PRIBIO | PCATCH) : PRIBIO,
-   "pipelk", 0);
+   prio, "pipelk", 0);
if (error != 0)
return (error);
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"