svn commit: r327462 - in head/sys/mips: adm5120 alchemy idt rt305x

2017-12-31 Thread Warner Losh
Author: imp
Date: Mon Jan  1 05:18:28 2018
New Revision: 327462
URL: https://svnweb.freebsd.org/changeset/base/327462

Log:
  Remove empty directories... silly git svn w/o --rmdir.

Deleted:
  head/sys/mips/adm5120/
  head/sys/mips/alchemy/
  head/sys/mips/idt/
  head/sys/mips/rt305x/
___
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: r327461 - in head/sys/mips: conf rmi

2017-12-31 Thread Warner Losh
Author: imp
Date: Mon Jan  1 05:13:03 2018
New Revision: 327461
URL: https://svnweb.freebsd.org/changeset/base/327461

Log:
  Remove sys/mips/rmi. It's been unmaintained since 2011. This hardware
  is now unobtanium. It's only had API changes in the last 7 years, and
  is responsible for a very large number of them. In addition, there's a
  lot of code that reimplements base FreeBSD functionality, diminishing
  the chances it still works. Without hardware to teset it on, or
  prospects of obtaining such hardware and without vendor support, it's
  time to move on.
  
  Suggested by: kan@ in mips@ retirement discussion

Deleted:
  head/sys/mips/conf/XLR
  head/sys/mips/conf/XLR64
  head/sys/mips/conf/XLRN32
  head/sys/mips/rmi/
___
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: r327460 - in head/sys/mips: conf idt

2017-12-31 Thread Warner Losh
Author: imp
Date: Mon Jan  1 04:10:36 2018
New Revision: 327460
URL: https://svnweb.freebsd.org/changeset/base/327460

Log:
  Remove support for IDT. Only the RouterBoard RB533 used this chip, and
  it's at least 5 years out of production. I couldn't find a used one on
  ebay and other secondary markets just now, nor when I tried 4 years
  ago. It dates from the initial project/mips2 merge 8 years ago, and
  hasn't been updated since.
  
  Discussed on: mips@ (with some dissent)

Deleted:
  head/sys/mips/conf/IDT
  head/sys/mips/idt/files.idt
  head/sys/mips/idt/idt_machdep.c
  head/sys/mips/idt/idtpci.c
  head/sys/mips/idt/idtreg.h
  head/sys/mips/idt/if_kr.c
  head/sys/mips/idt/if_krreg.h
  head/sys/mips/idt/obio.c
  head/sys/mips/idt/obiovar.h
  head/sys/mips/idt/std.idt
  head/sys/mips/idt/uart_bus_rc32434.c
  head/sys/mips/idt/uart_cpu_rc32434.c
___
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: r327459 - in head/sys/mips: adm5120 conf

2017-12-31 Thread Warner Losh
Author: imp
Date: Mon Jan  1 04:10:31 2018
New Revision: 327459
URL: https://svnweb.freebsd.org/changeset/base/327459

Log:
  Retire old ADM 5120 port. It never grew much beyond the original port.
  It came into the tree with the project/mips merge 8 years ago. At the
  time, it was hard to find a board with enough RAM to run. Now FreeBSD
  requires at least 2x the RAM it did then. No changes have happened to
  this port apart from API churn and license tagging since then. It ran
  OK at the time it was committed, but no sightings in the wild have
  happened since shortly after it was committed.
  
  https://www.linux-mips.org/wiki/Adm5120_devices lists a bunch of
  boards that were available 5 years ago (but are no longer
  available). The beefiest one had only 64MB of RAM which is too
  small. The Mirktik RB1xx never had more than 32MB.
  
  Also remove confusing QEMU config file that never ever worked in QEMU
  for mips. MALTA is used for that. Another of my past mistakes, false
  starts that never amounted to anything.
  
  Discussed on: mips@ (with some dissent)

Deleted:
  head/sys/mips/adm5120/adm5120_machdep.c
  head/sys/mips/adm5120/adm5120reg.h
  head/sys/mips/adm5120/admpci.c
  head/sys/mips/adm5120/console.c
  head/sys/mips/adm5120/files.adm5120
  head/sys/mips/adm5120/if_admsw.c
  head/sys/mips/adm5120/if_admswreg.h
  head/sys/mips/adm5120/if_admswvar.h
  head/sys/mips/adm5120/obio.c
  head/sys/mips/adm5120/obiovar.h
  head/sys/mips/adm5120/std.adm5120
  head/sys/mips/adm5120/uart_bus_adm5120.c
  head/sys/mips/adm5120/uart_cpu_adm5120.c
  head/sys/mips/adm5120/uart_dev_adm5120.c
  head/sys/mips/adm5120/uart_dev_adm5120.h
  head/sys/mips/conf/ADM5120
  head/sys/mips/conf/QEMU
___
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: r327458 - in head/sys/mips: alchemy conf

2017-12-31 Thread Warner Losh
Author: imp
Date: Mon Jan  1 04:10:25 2018
New Revision: 327458
URL: https://svnweb.freebsd.org/changeset/base/327458

Log:
  Remove sys/mips/alchemy. It was still-born when I committed it and it
  never got better. It never worked on real hardware and is still mostly
  stubs after 8 years when I added it. It has had no real update in that
  time apart from API churn. It was added just so it didn't get lost in
  the project/mips merge, but maybe it should have been lost as nothing
  has come of it. It is time to give up the ghost on this one.
  
  Approved by: me, shooting my own dog
  Discussed on: mips@

Deleted:
  head/sys/mips/alchemy/alchemy_machdep.c
  head/sys/mips/alchemy/aureg.h
  head/sys/mips/alchemy/files.alchemy
  head/sys/mips/alchemy/obio.c
  head/sys/mips/alchemy/std.alchemy
  head/sys/mips/alchemy/uart_bus_alchemy.c
  head/sys/mips/alchemy/uart_cpu_alchemy.c
  head/sys/mips/conf/ALCHEMY
___
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: r327457 - in head/sys/mips: conf rt305x

2017-12-31 Thread Warner Losh
Author: imp
Date: Mon Jan  1 04:06:24 2018
New Revision: 327457
URL: https://svnweb.freebsd.org/changeset/base/327457

Log:
  Remove sys/mips/rt305x. It's been replaced by sys/mips/mediatek.
  
  OK'd by: Stanislav Galabov (who did both)
  Discussed on: mips@

Deleted:
  head/sys/mips/conf/MT7620
  head/sys/mips/conf/RT305X
  head/sys/mips/conf/RT5350
  head/sys/mips/rt305x/files.rt305x
  head/sys/mips/rt305x/obio.c
  head/sys/mips/rt305x/obiovar.h
  head/sys/mips/rt305x/rt305x_dotg.c
  head/sys/mips/rt305x/rt305x_ehci.c
  head/sys/mips/rt305x/rt305x_gpio.c
  head/sys/mips/rt305x/rt305x_gpio.h
  head/sys/mips/rt305x/rt305x_gpiovar.h
  head/sys/mips/rt305x/rt305x_ic.c
  head/sys/mips/rt305x/rt305x_icvar.h
  head/sys/mips/rt305x/rt305x_machdep.c
  head/sys/mips/rt305x/rt305x_ohci.c
  head/sys/mips/rt305x/rt305x_pci.c
  head/sys/mips/rt305x/rt305x_pcireg.h
  head/sys/mips/rt305x/rt305x_spi.c
  head/sys/mips/rt305x/rt305x_sysctl.c
  head/sys/mips/rt305x/rt305x_sysctlvar.h
  head/sys/mips/rt305x/rt305xreg.h
  head/sys/mips/rt305x/rt_swreg.h
  head/sys/mips/rt305x/std.rt305x
  head/sys/mips/rt305x/uart_bus_rt305x.c
  head/sys/mips/rt305x/uart_cpu_rt305x.c
  head/sys/mips/rt305x/uart_dev_rt305x.c
  head/sys/mips/rt305x/uart_dev_rt305x.h
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327456 - head/release/powerpc

2017-12-31 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Mon Jan  1 03:33:01 2018
New Revision: 327456
URL: https://svnweb.freebsd.org/changeset/base/327456

Log:
  After removal of loader.ps3, change petitboot configuration in release media
  to directly kexec the kernel. Unlike the old loader.ps3 code, this also works
  on PowerNV systems, which also use petitboot.
  
  MFC after:1 month

Modified:
  head/release/powerpc/mkisoimages.sh

Modified: head/release/powerpc/mkisoimages.sh
==
--- head/release/powerpc/mkisoimages.sh Mon Jan  1 00:20:35 2018
(r327455)
+++ head/release/powerpc/mkisoimages.sh Mon Jan  1 03:33:01 2018
(r327456)
@@ -23,20 +23,38 @@
 # extra-bits-dir, if provided, contains additional files to be merged
 # into base-bits-dir as part of making the image.
 
+
 if [ "$1" = "-b" ]; then
+   bootable=1
+   shift
+else
+   bootable=""
+fi
+
+if [ $# -lt 3 ]; then
+   echo "Usage: $0 [-b] image-label image-name base-bits-dir 
[extra-bits-dir]"
+   exit 1
+fi
+
+LABEL=`echo "$1" | tr '[:lower:]' '[:upper:]'`; shift
+NAME="$1"; shift
+
+if [ -n "$bootable" ]; then
+   echo "Building bootable disc"
+
# Apple boot code
uudecode -o /tmp/hfs-boot-block.bz2 "`dirname "$0"`/hfs-boot.bz2.uu"
bzip2 -d /tmp/hfs-boot-block.bz2
OFFSET=$(hd /tmp/hfs-boot-block | grep 'Loader START' | cut -f 1 -d ' ')
OFFSET=0x$(echo 0x$OFFSET | awk '{printf("%x\n",$1/512);}')
-   dd if="$4/boot/loader" of=/tmp/hfs-boot-block seek=$OFFSET conv=notrunc
+   dd if="$1/boot/loader" of=/tmp/hfs-boot-block seek=$OFFSET conv=notrunc
 
bootable="-o bootimage=macppc;/tmp/hfs-boot-block -o no-emul-boot"
 
# pSeries/PAPR boot code
-   mkdir -p "$4/ppc/chrp"
-   cp "$4/boot/loader" "$4/ppc/chrp"
-   cat > "$4/ppc/bootinfo.txt" << EOF
+   mkdir -p "$1/ppc/chrp"
+   cp "$1/boot/loader" "$1/ppc/chrp"
+   cat > "$1/ppc/bootinfo.txt" << EOF
 
 FreeBSD Install
 FreeBSD
@@ -45,21 +63,9 @@ if [ "$1" = "-b" ]; then
 EOF
bootable="$bootable -o chrp-boot"
 
-   # Playstation 3 boot code
-   echo "FreeBSD Install='/boot/loader.ps3'" > "$4/etc/kboot.conf"
-
-   shift
-else
-   bootable=""
+   # Petitboot config for PS3/PowerNV
+   echo FreeBSD Install=\'/boot/kernel/kernel 
vfs.root.mountfrom=cd9660:/dev/iso9660/$LABEL\' > "$1/etc/kboot.conf"
 fi
-
-if [ $# -lt 3 ]; then
-   echo "Usage: $0 [-b] image-label image-name base-bits-dir 
[extra-bits-dir]"
-   exit 1
-fi
-
-LABEL=`echo "$1" | tr '[:lower:]' '[:upper:]'`; shift
-NAME="$1"; shift
 
 publisher="The FreeBSD Project.  https://www.FreeBSD.org/;
 echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$1/etc/fstab"
___
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: r327455 - head/share/man/man9

2017-12-31 Thread Eitan Adler
Author: eadler
Date: Mon Jan  1 00:20:35 2018
New Revision: 327455
URL: https://svnweb.freebsd.org/changeset/base/327455

Log:
  ieee80211(9): update man page
  
  This copies changes from NetBSD into FreeBSD's man page.  I compared the
  proposed changes against FreeBSD headers and modified them to match.
  
  PR:   214602
  Submitted by: fehmi noyan isi 

Modified:
  head/share/man/man9/ieee80211.9

Modified: head/share/man/man9/ieee80211.9
==
--- head/share/man/man9/ieee80211.9 Sun Dec 31 23:40:06 2017
(r327454)
+++ head/share/man/man9/ieee80211.9 Mon Jan  1 00:20:35 2018
(r327455)
@@ -1,4 +1,6 @@
 .\"
+.\" Copyright (c) 2004 Bruce M. Simpson 
+.\" Copyright (c) 2004 Darron Broad 
 .\" Copyright (c) 2009 Sam Leffler, Errno Consulting
 .\" All rights reserved.
 .\"
@@ -25,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 28, 2010
+.Dd December 31, 2017
 .Dt IEEE80211 9
 .Os
 .Sh NAME
@@ -34,9 +36,31 @@
 .Sh SYNOPSIS
 .In net80211/ieee80211_var.h
 .Ft void
-.Fn ieee80211_ifattach "struct ieee80211com *ic" "const uint8_t 
macaddr[IEEE80211_ADDR_LEN]"
+.Fn ieee80211_ifattach "struct ieee80211com *ic"
 .Ft void
 .Fn ieee80211_ifdetach "struct ieee80211com *ic"
+.Ft int
+.Fn ieee80211_mhz2ieee "u_int freq" "u_int flags"
+.Ft int
+.Fn ieee80211_chan2ieee "struct ieee80211com *ic" "const struct 
ieee80211_channel *c"
+.Ft u_int
+.Fn ieee80211_ieee2mhz "u_int chan" "u_int flags"
+.Ft int
+.Fn ieee80211_media_change "struct ifnet *ifp"
+.Ft void
+.Fn ieee80211_media_status "struct ifnet *ifp" "struct ifmediareq *imr"
+.Ft int
+.Fn ieee80211_setmode "struct ieee80211com *ic" "enum ieee80211_phymode mode"
+.Ft enum ieee80211_phymode
+.Fo ieee80211_chan2mode
+.Fa "const struct ieee80211_channel *chan"
+.Fc
+.Ft int
+.Fo ieee80211_rate2media
+.Fa "struct ieee80211com *ic" "int rate" "enum ieee80211_phymode mode"
+.Fc
+.Ft int
+.Fn ieee80211_media2rate "int mword"
 .Sh DESCRIPTION
 IEEE 802.11 device drivers are written to use the infrastructure provided
 by the
@@ -89,6 +113,112 @@ The virtual radio interface defined by the
 layer means that drivers must be structured to follow specific rules.
 Drivers that support only a single interface at any time must still
 follow these rules.
+.Pp
+Most of these functions require that attachment to the stack is performed
+before calling.
+.Pp
+.\"
+The
+.Fn ieee80211_ifattach
+function attaches the wireless network interface
+.Fa ic
+to the 802.11 network stack layer.
+This function must be called before using any of the
+.Nm
+functions which need to store driver state across invocations.
+.Pp
+.\"
+The
+.Fn ieee80211_ifdetach
+function frees any
+.Nm
+structures associated with the driver, and performs Ethernet and BPF
+detachment on behalf of the caller.
+.Pp
+.\"
+The
+.Fn ieee80211_mhz2ieee
+utility function converts the frequency
+.Fa freq
+(specified in MHz) to an IEEE 802.11 channel number.
+The
+.Fa flags
+argument is a hint which specifies whether the frequency is in
+the 2GHz ISM band
+.Pq Vt IEEE80211_CHAN_2GHZ
+or the 5GHz band
+.Pq Vt IEEE80211_CHAN_5GHZ ;
+appropriate clipping of the result is then performed.
+.Pp
+.\"
+The
+.Fn ieee80211_chan2ieee
+function converts the channel specified in
+.Fa *c
+to an IEEE channel number for the driver
+.Fa ic .
+If the conversion would be invalid, an error message is printed to the
+system console.
+This function REQUIRES that the driver is hooked up to the
+.Nm
+subsystem.
+.Pp
+.\"
+The
+.Fn ieee80211_ieee2mhz
+utility function converts the IEEE channel number
+.Ft chan
+to a frequency (in MHz).
+The
+.Fa flags
+argument is a hint which specifies whether the frequency is in
+the 2GHz ISM band
+.Pq Vt IEEE80211_CHAN_2GHZ
+or the 5GHz band
+.Pq Vt IEEE80211_CHAN_5GHZ ;
+appropriate clipping of the result is then performed.
+.Pp
+.\"
+The
+.Fn ieee80211_media_status
+and
+.Fn ieee80211_media_change
+functions are device-independent handlers for
+.Vt ifmedia
+commands and are not intended to be called directly.
+.Pp
+.\"
+The
+.Fn ieee80211_setmode
+function is called from within the 802.11 stack to change the mode
+of the driver's PHY; it is not intended to be called directly.
+.Pp
+.\"
+The
+.Fn ieee80211_chan2mode
+function returns the PHY mode required for use with the channel
+.Fa chan .
+This is typically used when selecting a rate set, to be advertised in
+beacons, for example.
+.Pp
+.\"
+The
+.Fn ieee80211_rate2media
+function converts the bit rate
+.Fa rate
+(measured in units of 0.5Mbps) to an
+.Vt ifmedia
+sub-type, for the device
+.Fa ic
+running in PHY mode
+.Fa mode .
+The
+.Fn ieee80211_media2rate
+performs the reverse of this conversion, returning the bit rate (in 0.5Mbps
+units) corresponding to an
+.Vt ifmedia
+sub-type.
+.
 .Sh DATA STRUCTURES
 The virtual radio architecture splits state between a single per-device
 .Vt ieee80211com
@@ -566,3 +696,23 @@ 

svn commit: r327454 - head/sys/dev/vt/colors

2017-12-31 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sun Dec 31 23:40:06 2017
New Revision: 327454
URL: https://svnweb.freebsd.org/changeset/base/327454

Log:
  Fix GCC build broken by r32744
  
  Indicate in function declaration that vt_palette_init does not take any 
arguments

Modified:
  head/sys/dev/vt/colors/vt_termcolors.c

Modified: head/sys/dev/vt/colors/vt_termcolors.c
==
--- head/sys/dev/vt/colors/vt_termcolors.c  Sun Dec 31 22:43:24 2017
(r327453)
+++ head/sys/dev/vt/colors/vt_termcolors.c  Sun Dec 31 23:40:06 2017
(r327454)
@@ -144,7 +144,7 @@ vt_parse_rgb_triplet(const char *rgb, unsigned char *r
 }
 
 static void
-vt_palette_init()
+vt_palette_init(void)
 {
int i;
char rgb[32];
___
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: r327453 - in head: stand/libsa sys/sys

2017-12-31 Thread Ian Lepore
Author: ian
Date: Sun Dec 31 22:43:24 2017
New Revision: 327453
URL: https://svnweb.freebsd.org/changeset/base/327453

Log:
  Add a validbcd() routine that uses the bcd2bin_data[] array and returns a
  bool indicating whether the input value represents a valid BCD byte.
  
  The existing bcd2bin() routine will KASSERT if asked to convert a bad value,
  but sometimes the kernel has to handle BCD data from untrusted sources, so
  this will provide a mechanism to validate data before attempting conversion.
  
  This would be have easier/cleaner if the bcd2bin_data[] array contained an
  out-of-range value (such as 0xff) in the infill locations that aren't valid,
  but it's a global symbol that might be referenced by out-of-tree code
  relying on the current scheme, so I'm leaving that alone.

Modified:
  head/stand/libsa/stand.h
  head/sys/sys/libkern.h

Modified: head/stand/libsa/stand.h
==
--- head/stand/libsa/stand.hSun Dec 31 22:35:32 2017(r327452)
+++ head/stand/libsa/stand.hSun Dec 31 22:43:24 2017(r327453)
@@ -354,6 +354,7 @@ extern char const   hex2ascii_data[];
 #definebcd2bin(bcd)(bcd2bin_data[bcd])
 #definebin2bcd(bin)(bin2bcd_data[bin])
 #definehex2ascii(hex)  (hex2ascii_data[hex])
+#definevalidbcd(bcd)   (bcd == 0 || (bcd > 0 && bcd <= 0x99 && 
bcd2bin_data[bcd] != 0))
 
 /* min/max (undocumented) */
 static __inline int imax(int a, int b) { return (a > b ? a : b); }

Modified: head/sys/sys/libkern.h
==
--- head/sys/sys/libkern.h  Sun Dec 31 22:35:32 2017(r327452)
+++ head/sys/sys/libkern.h  Sun Dec 31 22:43:24 2017(r327453)
@@ -82,6 +82,13 @@ hex2ascii(int hex)
return (hex2ascii_data[hex]);
 }
 
+static inline bool
+validbcd(int bcd)
+{
+
+   return (bcd == 0 || (bcd > 0 && bcd <= 0x99 && bcd2bin_data[bcd] != 0));
+}
+
 static __inline int imax(int a, int b) { return (a > b ? a : b); }
 static __inline int imin(int a, int b) { return (a < b ? a : b); }
 static __inline long lmax(long a, long b) { return (a > b ? a : b); }
___
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: r327452 - head/sys/arm/allwinner

2017-12-31 Thread Kyle Evans
Author: kevans
Date: Sun Dec 31 22:35:32 2017
New Revision: 327452
URL: https://svnweb.freebsd.org/changeset/base/327452

Log:
  aw_sid: Add support for a64
  
  Newer Allwinner SoCs have nearly identical SID controllers with efuse space
  starting at 0x200 into their register space and thermal data available at
  0x234, making all of these fairly trivial additions.
  
  The h3 will be added at a later time after some testing, due to a silicon
  bug that causes the rootkey (at least) to be read incorrectly unless first
  read via the control register.

Modified:
  head/sys/arm/allwinner/aw_sid.c

Modified: head/sys/arm/allwinner/aw_sid.c
==
--- head/sys/arm/allwinner/aw_sid.c Sun Dec 31 22:01:36 2017
(r327451)
+++ head/sys/arm/allwinner/aw_sid.c Sun Dec 31 22:35:32 2017
(r327452)
@@ -67,6 +67,11 @@ static const struct aw_sid_conf a20_conf = {
.rootkey_offset = 0,
 };
 
+static const struct aw_sid_conf a64_conf = {
+   .rootkey_offset = SID_SRAM,
+   .has_thermal = true,
+};
+
 static const struct aw_sid_conf a83t_conf = {
.rootkey_offset = SID_SRAM,
.has_thermal = true,
@@ -75,6 +80,7 @@ static const struct aw_sid_conf a83t_conf = {
 static struct ofw_compat_data compat_data[] = {
{ "allwinner,sun4i-a10-sid",(uintptr_t)_conf},
{ "allwinner,sun7i-a20-sid",(uintptr_t)_conf},
+   { "allwinner,sun50i-a64-sid",   (uintptr_t)_conf},
{ "allwinner,sun8i-a83t-sid",   (uintptr_t)_conf},
{ NULL, 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: r327451 - head/usr.sbin/newsyslog

2017-12-31 Thread Eitan Adler
Author: eadler
Date: Sun Dec 31 22:01:36 2017
New Revision: 327451
URL: https://svnweb.freebsd.org/changeset/base/327451

Log:
  newsyslog: implement 'p' flag
  
  Implement the 'p' flag for newsyslog from NetBSD. This flag results in
  the first log file for a given file to not be compressed.
  
  While here, don't change file attributes during a no-op run
  
  PR:   162798
  Submitted by: h...@shrubbery.net
  MFC After:1 month

Modified:
  head/usr.sbin/newsyslog/newsyslog.c
  head/usr.sbin/newsyslog/newsyslog.conf.5

Modified: head/usr.sbin/newsyslog/newsyslog.c
==
--- head/usr.sbin/newsyslog/newsyslog.c Sun Dec 31 21:36:42 2017
(r327450)
+++ head/usr.sbin/newsyslog/newsyslog.c Sun Dec 31 22:01:36 2017
(r327451)
@@ -132,6 +132,7 @@ __FBSDID("$FreeBSD$");
 #defineCE_CREATE   0x0100  /* Create the log file if it does not 
exist. */
 #defineCE_NODUMP   0x0200  /* Set 'nodump' on newly created log 
file. */
 #defineCE_PID2CMD  0x0400  /* Replace PID file with a shell 
command.*/
+#defineCE_PLAIN0   0x0800  /* Do not compress zero'th history file 
*/
 
 #defineCE_RFC5424  0x0800  /* Use RFC5424 format rotation message 
*/
 
@@ -1316,6 +1317,9 @@ no_trimat:
case 'n':
working->flags |= CE_NOSIGNAL;
break;
+   case 'p':
+   working->flags |= CE_PLAIN0;
+   break;
case 'r':
working->flags |= CE_PID2CMD;
break;
@@ -1341,7 +1345,6 @@ no_trimat:
break;
case 'f':   /* Used by OpenBSD for "CE_FOLLOW" */
case 'm':   /* Used by OpenBSD for "CE_MONITOR" */
-   case 'p':   /* Used by NetBSD  for "CE_PLAIN0" */
default:
errx(1, "illegal flag in config file -- %c",
*q);
@@ -1846,8 +1849,18 @@ do_rotate(const struct conf_entry *ent)
else {
/* XXX - Ought to be checking for failure! */
(void)rename(zfile1, zfile2);
+   change_attrs(zfile2, ent);
+   if (ent->compress && !strlen(logfile_suffix)) {
+   /* compress old rotation */
+   struct zipwork_entry zwork;
+
+   memset(, 0, sizeof(zwork));
+   zwork.zw_conf = ent;
+   zwork.zw_fsize = sizefile(zfile2);
+   strcpy(zwork.zw_fname, zfile2);
+   do_zipwork();
+   }
}
-   change_attrs(zfile2, ent);
}
 
if (ent->numlogs > 0) {
@@ -1896,12 +1909,15 @@ do_rotate(const struct conf_entry *ent)
if (ent->pid_cmd_file != NULL)
swork = save_sigwork(ent);
if (ent->numlogs > 0 && ent->compress > COMPRESS_NONE) {
-   /*
-* The zipwork_entry will include a pointer to this
-* conf_entry, so the conf_entry should not be freed.
-*/
-   free_or_keep = KEEP_ENT;
-   save_zipwork(ent, swork, ent->fsize, file1);
+   if (!(ent->flags & CE_PLAIN0) ||
+   strcmp([strlen(file1) - 2], ".0") != 0) {
+   /*
+* The zipwork_entry will include a pointer to this
+* conf_entry, so the conf_entry should not be freed.
+*/
+   free_or_keep = KEEP_ENT;
+   save_zipwork(ent, swork, ent->fsize, file1);
+   }
}
 
return (free_or_keep);

Modified: head/usr.sbin/newsyslog/newsyslog.conf.5
==
--- head/usr.sbin/newsyslog/newsyslog.conf.5Sun Dec 31 21:36:42 2017
(r327450)
+++ head/usr.sbin/newsyslog/newsyslog.conf.5Sun Dec 31 22:01:36 2017
(r327451)
@@ -21,7 +21,7 @@
 .\" the suitability of this software for any purpose.  It is
 .\" provided "as is" without express or implied warranty.
 .\"
-.Dd May 19, 2017
+.Dd Dec 31, 2017
 .Dt NEWSYSLOG.CONF 5
 .Os
 .Sh NAME
@@ -312,6 +312,8 @@ log file using
 .It Cm N
 indicates that there is no process which needs to be signaled
 when this log file is rotated.
+.It Cm p
+indicates that the zero-th rotated file should not be compressed.
 .It Cm R
 if this flag is set the
 .Xr newsyslog 8
___
svn-src-head@freebsd.org mailing list

svn commit: r327450 - head/sys/vm

2017-12-31 Thread Alan Cox
Author: alc
Date: Sun Dec 31 21:36:42 2017
New Revision: 327450
URL: https://svnweb.freebsd.org/changeset/base/327450

Log:
  The variable "minslptime" is pointless and always has been, ever since its
  introduction in r83366.  (At that time, this code appeared in vm/vm_glue.c,
  because vm/vm_swapout.c did not exist.)  When the FOREACH_THREAD loop
  completes, we know that the sleep time for every thread is above whichever
  threshold is being applied.
  
  Reviewed by:  kib
  X-MFC with:   r327354

Modified:
  head/sys/vm/vm_swapout.c

Modified: head/sys/vm/vm_swapout.c
==
--- head/sys/vm/vm_swapout.cSun Dec 31 21:29:20 2017(r327449)
+++ head/sys/vm/vm_swapout.cSun Dec 31 21:36:42 2017(r327450)
@@ -729,10 +729,9 @@ swapout_procs(int action)
 {
struct proc *p;
struct thread *td;
-   int minslptime, slptime;
+   int slptime;
bool didswap;
 
-   minslptime = 10;
didswap = false;
 retry:
sx_slock(_lock);
@@ -831,8 +830,6 @@ retry:
goto nextproc;
}
 
-   if (minslptime > slptime)
-   minslptime = slptime;
thread_unlock(td);
}
 
@@ -841,15 +838,11 @@ retry:
 * or if this process is idle and the system is
 * configured to swap proactively, swap it out.
 */
-   if ((action & VM_SWAP_NORMAL) != 0 ||
-   ((action & VM_SWAP_IDLE) != 0 &&
-   minslptime > swap_idle_threshold2)) {
-   _PRELE(p);
-   if (swapout(p) == 0)
-   didswap = true;
-   PROC_UNLOCK(p);
-   goto retry;
-   }
+   _PRELE(p);
+   if (swapout(p) == 0)
+   didswap = true;
+   PROC_UNLOCK(p);
+   goto retry;
}
 nextproc:
PROC_UNLOCK(p);
___
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: r327449 - head/sys/dev/vt/colors

2017-12-31 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sun Dec 31 21:29:20 2017
New Revision: 327449
URL: https://svnweb.freebsd.org/changeset/base/327449

Log:
  Unbreak build broken by r327444
  
  During review iterations function signature has changed in definition
  but not in actual call. Fix call to match the definition.
  
  Reported by:  Herbert J. Skuhra
  Pointyhat to: gonzo
  MFC after:2 weeks

Modified:
  head/sys/dev/vt/colors/vt_termcolors.c

Modified: head/sys/dev/vt/colors/vt_termcolors.c
==
--- head/sys/dev/vt/colors/vt_termcolors.c  Sun Dec 31 21:23:14 2017
(r327448)
+++ head/sys/dev/vt/colors/vt_termcolors.c  Sun Dec 31 21:29:20 2017
(r327449)
@@ -155,7 +155,7 @@ vt_palette_init()
snprintf(tunable, sizeof(tunable),
"kern.vt.color.%d.rgb", i);
if (TUNABLE_STR_FETCH(tunable, rgb, sizeof(rgb))) {
-   if (vt_parse_rgb_triplet(rgb, strlen(rgb), , , ) 
== 0) {
+   if (vt_parse_rgb_triplet(rgb, , , ) == 0) {
/* convert to percentages */
color_def[i].r = r*100/255;
color_def[i].g = g*100/255;
___
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: r327448 - head/share/man/man4

2017-12-31 Thread Bryan Venteicher
Author: bryanv
Date: Sun Dec 31 21:23:14 2017
New Revision: 327448
URL: https://svnweb.freebsd.org/changeset/base/327448

Log:
  Add rc.conf vxlan example
  
  PR:   206288
  Submitted by: ja...@lodge.me.uk
  MFC after:2 weeks

Modified:
  head/share/man/man4/vxlan.4

Modified: head/share/man/man4/vxlan.4
==
--- head/share/man/man4/vxlan.4 Sun Dec 31 21:00:21 2017(r327447)
+++ head/share/man/man4/vxlan.4 Sun Dec 31 21:23:14 2017(r327448)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 16, 2014
+.Dd December 31, 2017
 .Dt VXLAN 4
 .Os
 .Sh NAME
@@ -214,10 +214,21 @@ Once created, the
 .Nm
 interface can be configured with
 .Xr ifconfig 8 .
+.Ed
+.Pp
+The following when placed in the file
+.Pa /etc/rc.conf
+will cause a vxlan interface called
+.Dq Li vxlan0
+to be created, and will configure the interface in unicast mode.
+.Bd -literal -offset indent
+cloned_interfaces="vxlan0"
+create_args_vxlan0="vxlanid 108 vxlanlocal 192.168.100.1 vxlanremote 
192.168.100.2"
 .Sh SEE ALSO
 .Xr inet 4 ,
 .Xr inet6 4 ,
 .Xr vlan 4 ,
+.Xr rc.conf 5 ,
 .Xr ifconfig 8 ,
 .Xr sysctl 8
 .Rs
___
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: r327447 - head/sys/sys

2017-12-31 Thread Colin Percival
Author: cperciva
Date: Sun Dec 31 21:00:21 2017
New Revision: 327447
URL: https://svnweb.freebsd.org/changeset/base/327447

Log:
  Wrap includes in sys/tslog.h with #ifdef TSLOG.
  
  This is necessary because some non-kernel code #defines _KERNEL and then
  includes kernel headers; as a result, it was getting conflicting versions
  of curthread and curproc.  Non-kernel code should probably refrain from
  defining _KERNEL, but for now hiding these indirect inclusions fixes the
  build.
  
  Reported by:  Michael Butler, Herbert J. Skuhra

Modified:
  head/sys/sys/tslog.h

Modified: head/sys/sys/tslog.h
==
--- head/sys/sys/tslog.hSun Dec 31 20:30:51 2017(r327446)
+++ head/sys/sys/tslog.hSun Dec 31 21:00:21 2017(r327447)
@@ -29,8 +29,10 @@
 #ifndef _TSLOG_H_
 #define_TSLOG_H_
 
+#ifdef TSLOG
 #include 
 #include 
+#endif
 
 #define TS_ENTER   0
 #define TS_EXIT1
___
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: r327446 - head/sys/sparc64/sparc64

2017-12-31 Thread Ian Lepore
Author: ian
Date: Sun Dec 31 20:30:51 2017
New Revision: 327446
URL: https://svnweb.freebsd.org/changeset/base/327446

Log:
  Chase r327432... sparc64 clock.c now needs to include sys/tslog.h
  
  Discussed with:cperciva

Modified:
  head/sys/sparc64/sparc64/clock.c

Modified: head/sys/sparc64/sparc64/clock.c
==
--- head/sys/sparc64/sparc64/clock.cSun Dec 31 20:23:39 2017
(r327445)
+++ head/sys/sparc64/sparc64/clock.cSun Dec 31 20:30:51 2017
(r327446)
@@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327445 - in head/sys/powerpc: include powerpc

2017-12-31 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Sun Dec 31 20:23:39 2017
New Revision: 327445
URL: https://svnweb.freebsd.org/changeset/base/327445

Log:
  Remove PIR from PCPU data. It has an implementation-defined meaning that
  is of limited utility outside of platform-specific code and can vary
  at runtime when running as a hypervisor guest, so does not even have the
  virtue of being a static identifier.
  
  Reviewed by:  jhibbits

Modified:
  head/sys/powerpc/include/pcpu.h
  head/sys/powerpc/powerpc/db_interface.c
  head/sys/powerpc/powerpc/machdep.c
  head/sys/powerpc/powerpc/mp_machdep.c

Modified: head/sys/powerpc/include/pcpu.h
==
--- head/sys/powerpc/include/pcpu.h Sun Dec 31 20:21:05 2017
(r327444)
+++ head/sys/powerpc/include/pcpu.h Sun Dec 31 20:23:39 2017
(r327445)
@@ -46,7 +46,6 @@ struct pvo_entry;
struct thread   *pc_fputhread;  /* current fpu user */  \
struct thread   *pc_vecthread;  /* current vec user */  \
uintptr_t   pc_hwref;   \
-   uint32_tpc_pir; \
int pc_bsp; \
volatile intpc_awake;   \
uint32_tpc_ipimask; \

Modified: head/sys/powerpc/powerpc/db_interface.c
==
--- head/sys/powerpc/powerpc/db_interface.c Sun Dec 31 20:21:05 2017
(r327444)
+++ head/sys/powerpc/powerpc/db_interface.c Sun Dec 31 20:23:39 2017
(r327445)
@@ -91,5 +91,4 @@ db_show_mdpcpu(struct pcpu *pc)
 
db_printf("PPC: hwref   = %#zx\n", pc->pc_hwref);
db_printf("PPC: ipimask = %#x\n", pc->pc_ipimask);
-   db_printf("PPC: pir = %#x\n", pc->pc_pir);
 }

Modified: head/sys/powerpc/powerpc/machdep.c
==
--- head/sys/powerpc/powerpc/machdep.c  Sun Dec 31 20:21:05 2017
(r327444)
+++ head/sys/powerpc/powerpc/machdep.c  Sun Dec 31 20:23:39 2017
(r327445)
@@ -368,7 +368,6 @@ powerpc_init(vm_offset_t fdt, vm_offset_t toc, vm_offs
thread0.td_oncpu = bsp.cr_cpuid;
pc->pc_cpuid = bsp.cr_cpuid;
pc->pc_hwref = bsp.cr_hwref;
-   pc->pc_pir = mfspr(SPR_PIR);
__asm __volatile("mtsprg 0, %0" :: "r"(pc));
 
/*

Modified: head/sys/powerpc/powerpc/mp_machdep.c
==
--- head/sys/powerpc/powerpc/mp_machdep.c   Sun Dec 31 20:21:05 2017
(r327444)
+++ head/sys/powerpc/powerpc/mp_machdep.c   Sun Dec 31 20:23:39 2017
(r327445)
@@ -74,8 +74,6 @@ void
 machdep_ap_bootstrap(void)
 {
 
-   /* Set PIR */
-   PCPU_SET(pir, mfspr(SPR_PIR));
PCPU_SET(awake, 1);
__asm __volatile("msync; isync");
 
@@ -224,13 +222,13 @@ cpu_mp_unleash(void *dummy)
DELAY(1000);
 
} else {
-   PCPU_SET(pir, mfspr(SPR_PIR));
pc->pc_awake = 1;
}
if (pc->pc_awake) {
if (bootverbose)
-   printf("Adding CPU %d, pir=%x, awake=%x\n",
-   pc->pc_cpuid, pc->pc_pir, pc->pc_awake);
+   printf("Adding CPU %d, hwref=%jx, awake=%x\n",
+   pc->pc_cpuid, (uintmax_t)pc->pc_hwref,
+   pc->pc_awake);
smp_cpus++;
} else
CPU_SET(pc->pc_cpuid, _cpus);
___
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: r327444 - in head: share/man/man4 sys/dev/vt/colors

2017-12-31 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Sun Dec 31 20:21:05 2017
New Revision: 327444
URL: https://svnweb.freebsd.org/changeset/base/327444

Log:
  vt(4): add support for configurable console palette
  
  Introduce new set of loader tunables kern.vt.color.N.rgb, where N is a
  number from 0 to 15. The value is either comma-separated list decimal
  numbers ranging from 0 to 255 that represent values of red, green, and
  blue components respectively (i.e. "128,128,128") or 6-digit hex triplet
  commonly used to represent colors in HTML or xterm settings (i.e. #808080)
  
  Each tunable overrides one of the 16 hardcoded palette codes and can be set
  in loader.conf(5)
  
  Reviewed by:  bcr(docs), jilles, manu, ray
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D13645

Modified:
  head/share/man/man4/vt.4
  head/sys/dev/vt/colors/vt_termcolors.c

Modified: head/share/man/man4/vt.4
==
--- head/share/man/man4/vt.4Sun Dec 31 20:20:55 2017(r327443)
+++ head/share/man/man4/vt.4Sun Dec 31 20:21:05 2017(r327444)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 19, 2016
+.Dd December 28, 2017
 .Dt "VT" 4
 .Os
 .Sh NAME
@@ -45,6 +45,7 @@ In
 .Xr loader.conf 5 :
 .Cd hw.vga.textmode=1
 .Cd kern.vty=vt
+.Cd kern.vt.color..rgb=""
 .Cd kern.vt.fb.default_mode="x"
 .Cd kern.vt.fb.modes.="x"
 .Pp
@@ -206,6 +207,16 @@ The
 kernel uses
 .Nm
 when this value is not set.
+.It Va kern.vt.color. Ns Ar colornum Ns Va .rgb
+Set this value to override default palette entry for color
+.Pa colornum
+which should be in a range from 0 to 15 inclusive.
+The value should be either a comma-separated triplet of
+red, green, and blue values in a range from 0 to 255 or
+HTML-like hex triplet.
+See
+.Sx EXAMPLES
+below.
 .It Va kern.vt.fb.default_mode
 Set this value to a graphic mode to override the default mode picked by the
 .Nm
@@ -310,6 +321,11 @@ The connector name was found in
 .Dl info: [drm] Connector LVDS-1: get mode from tunables:
 .Dl info: [drm]   - kern.vt.fb.modes.LVDS-1
 .Dl info: [drm]   - kern.vt.fb.default_mode
+.Pp
+To set black and white colors of console palette
+.Pp
+.Dl kern.vt.color.0.rgb="10,10,10"
+.Dl kern.vt.color.15.rgb="#f0f0f0"
 .Sh SEE ALSO
 .Xr kbdcontrol 1 ,
 .Xr login 1 ,

Modified: head/sys/dev/vt/colors/vt_termcolors.c
==
--- head/sys/dev/vt/colors/vt_termcolors.c  Sun Dec 31 20:20:55 2017
(r327443)
+++ head/sys/dev/vt/colors/vt_termcolors.c  Sun Dec 31 20:21:05 2017
(r327444)
@@ -33,14 +33,18 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
+#include 
 
 #include 
 
-static const struct {
+#define NCOLORS16
+
+static struct {
unsigned char r;/* Red percentage value. */
unsigned char g;/* Green percentage value. */
unsigned char b;/* Blue percentage value. */
-} color_def[16] = {
+} color_def[NCOLORS] = {
{0, 0,  0}, /* black */
{50,0,  0}, /* dark red */
{0, 50, 0}, /* dark green */
@@ -65,19 +69,112 @@ static const struct {
  *   - blue and red are swapped (1 <-> 4)
  *   - yellow ad cyan are swapped (3 <-> 6)
  */
-static const int cons_to_vga_colors[16] = {
+static const int cons_to_vga_colors[NCOLORS] = {
0, 4, 2, 6, 1, 5, 3, 7,
0, 4, 2, 6, 1, 5, 3, 7
 };
 
+static int
+vt_parse_rgb_triplet(const char *rgb, unsigned char *r,
+unsigned char *g, unsigned char *b)
+{
+   unsigned long v;
+   const char *ptr;
+   char *endptr;
+
+   ptr = rgb;
+
+   /* Handle #rrggbb case */
+   if (*ptr == '#') {
+   if (strlen(ptr) != 7)
+   return (-1);
+   v = strtoul(ptr + 1, , 16);
+   if (*endptr != '\0')
+   return (-1);
+
+   *r = (v >> 16) & 0xff;
+   *g = (v >>  8) & 0xff;
+   *b = v & 0xff;
+
+   return (0);
+   }
+
+   /* "r, g, b" case */
+   v = strtoul(ptr, , 10);
+   if (ptr == endptr)
+   return (-1);
+   if (v > 255)
+   return (-1);
+   *r = v & 0xff;
+   ptr = endptr;
+
+   /* skip separator */
+   while (*ptr == ',' || *ptr == ' ')
+   ptr++;
+
+   v = strtoul(ptr, , 10);
+   if (ptr == endptr)
+   return (-1);
+   if (v > 255)
+   return (-1);
+   *g = v & 0xff;
+   ptr = endptr;
+
+   /* skip separator */
+   while (*ptr == ',' || *ptr == ' ')
+   ptr++;
+
+   v = strtoul(ptr, , 10);
+   if (ptr == endptr)
+   return (-1);
+   if (v > 255)
+   return (-1);
+   *b = v & 0xff;
+   ptr = endptr;
+
+   /* skip trailing spaces */
+   while (*ptr == ' ')
+   ptr++;
+
+   /* unexpected characters at the end 

svn commit: r327443 - head/sys/powerpc/powerpc

2017-12-31 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Sun Dec 31 20:20:55 2017
New Revision: 327443
URL: https://svnweb.freebsd.org/changeset/base/327443

Log:
  Fix 32-bit build.

Modified:
  head/sys/powerpc/powerpc/trap.c

Modified: head/sys/powerpc/powerpc/trap.c
==
--- head/sys/powerpc/powerpc/trap.c Sun Dec 31 20:10:08 2017
(r327442)
+++ head/sys/powerpc/powerpc/trap.c Sun Dec 31 20:20:55 2017
(r327443)
@@ -488,10 +488,10 @@ printtrap(u_int vector, struct trapframe *frame, int i
(int)frame->cpu.booke.esr, ESR_BITMASK);
 #endif
printf("   srr0= 0x%" PRIxPTR " (0x%" PRIxPTR ")\n",
-   frame->srr0, frame->srr0 - (__startkernel - KERNBASE));
+   frame->srr0, frame->srr0 - (register_t)(__startkernel - KERNBASE));
printf("   srr1= 0x%lx\n", (u_long)frame->srr1);
printf("   lr  = 0x%" PRIxPTR " (0x%" PRIxPTR ")\n",
-   frame->lr, frame->lr - (__startkernel - KERNBASE));
+   frame->lr, frame->lr - (register_t)(__startkernel - KERNBASE));
printf("   curthread   = %p\n", curthread);
if (curthread != NULL)
printf("  pid = %d, comm = %s\n",
___
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: r327442 - head/sys/powerpc/powerpc

2017-12-31 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Sun Dec 31 20:10:08 2017
New Revision: 327442
URL: https://svnweb.freebsd.org/changeset/base/327442

Log:
  Make newer binutils happy by using a bl-type branch instead of b, which
  displeases it for some reason. LR is not relevant in this code, so just
  do what it wants.

Modified:
  head/sys/powerpc/powerpc/swtch64.S

Modified: head/sys/powerpc/powerpc/swtch64.S
==
--- head/sys/powerpc/powerpc/swtch64.S  Sun Dec 31 20:08:16 2017
(r327441)
+++ head/sys/powerpc/powerpc/swtch64.S  Sun Dec 31 20:10:08 2017
(r327442)
@@ -280,5 +280,5 @@ ENTRY_NOPROF(fork_trampoline)
   trapframe to simulate FRAME_SETUP
   does when allocating space for
   a frame pointer/saved LR */
-   b   trapexit
+   bl  trapexit
nop
___
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: r327441 - head/sys/powerpc/powerpc

2017-12-31 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Sun Dec 31 20:08:16 2017
New Revision: 327441
URL: https://svnweb.freebsd.org/changeset/base/327441

Log:
  Provide relative, as well as absolute, addresses in trap panic panics. This
  makes it easier to cross-correlate them with instruction listings without
  worrying about where the kernel was relocated to.
  
  MFC after:1 week

Modified:
  head/sys/powerpc/powerpc/trap.c

Modified: head/sys/powerpc/powerpc/trap.c
==
--- head/sys/powerpc/powerpc/trap.c Sun Dec 31 19:24:13 2017
(r327440)
+++ head/sys/powerpc/powerpc/trap.c Sun Dec 31 20:08:16 2017
(r327441)
@@ -97,6 +97,8 @@ static inthandle_user_slb_spill(pmap_t pm, vm_offset_
 extern int n_slbs;
 #endif
 
+extern vm_offset_t __startkernel;
+
 #ifdef KDB
 int db_trap_glue(struct trapframe *);  /* Called from trap_subr.S */
 #endif
@@ -123,6 +125,7 @@ static struct powerpc_exception powerpc_exceptions[] =
{ EXC_EXI,  "external interrupt" },
{ EXC_ALI,  "alignment" },
{ EXC_PGM,  "program" },
+   { EXC_HEA,  "hypervisor emulation assistance" },
{ EXC_FPU,  "floating-point unavailable" },
{ EXC_APU,  "auxiliary proc unavailable" },
{ EXC_DECR, "decrementer" },
@@ -484,9 +487,11 @@ printtrap(u_int vector, struct trapframe *frame, int i
printf("   esr = 0x%b\n",
(int)frame->cpu.booke.esr, ESR_BITMASK);
 #endif
-   printf("   srr0= 0x%" PRIxPTR "\n", frame->srr0);
+   printf("   srr0= 0x%" PRIxPTR " (0x%" PRIxPTR ")\n",
+   frame->srr0, frame->srr0 - (__startkernel - KERNBASE));
printf("   srr1= 0x%lx\n", (u_long)frame->srr1);
-   printf("   lr  = 0x%" PRIxPTR "\n", frame->lr);
+   printf("   lr  = 0x%" PRIxPTR " (0x%" PRIxPTR ")\n",
+   frame->lr, frame->lr - (__startkernel - KERNBASE));
printf("   curthread   = %p\n", curthread);
if (curthread != NULL)
printf("  pid = %d, comm = %s\n",
___
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: r327440 - in head: etc/mtree usr.bin/find

2017-12-31 Thread Jilles Tjoelker
Author: jilles
Date: Sun Dec 31 19:24:13 2017
New Revision: 327440
URL: https://svnweb.freebsd.org/changeset/base/327440

Log:
  find: Link tests to the build

Modified:
  head/etc/mtree/BSD.tests.dist
  head/usr.bin/find/Makefile

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Sun Dec 31 18:53:13 2017
(r327439)
+++ head/etc/mtree/BSD.tests.dist   Sun Dec 31 19:24:13 2017
(r327440)
@@ -664,6 +664,8 @@
 ..
 file2c
 ..
+find
+..
 fold
 ..
 getconf

Modified: head/usr.bin/find/Makefile
==
--- head/usr.bin/find/Makefile  Sun Dec 31 18:53:13 2017(r327439)
+++ head/usr.bin/find/Makefile  Sun Dec 31 19:24:13 2017(r327440)
@@ -1,6 +1,8 @@
 #  @(#)Makefile8.1 (Berkeley) 6/6/93
 # $FreeBSD$
 
+.include 
+
 PROG=  find
 SRCS=  find.c function.c ls.c main.c misc.c operator.c option.c \
getdate.y
@@ -8,7 +10,7 @@ YFLAGS=
 
 NO_WMISSING_VARIABLE_DECLARATIONS=
 
-#HAS_TESTS=
-#SUBDIR.${MK_TESTS}+= tests
+HAS_TESTS=
+SUBDIR.${MK_TESTS}+= tests
 
 .include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r327439 - in head: . share/man/man7

2017-12-31 Thread Ian Lepore
Author: ian
Date: Sun Dec 31 18:53:13 2017
New Revision: 327439
URL: https://svnweb.freebsd.org/changeset/base/327439

Log:
  Allow use of .WAIT in the LOCAL_DIRS and LOCAL_LIB_DIRS lists.
  
  A comment in Makefile.inc1 has long stated that LOCAL_DIRS are built last,
  after the base system.  Incremental improvements in parallel building over
  the years have led to LOCAL_DIRS being built in parallel with base system
  directories.  This change allows the .WAIT directive to appear in LOCAL_DIRS
  and LOCAL_LIB_DIRS lists to give the user some control over parallel
  building of local additions.
  
  Differential Revision:https://reviews.freebsd.org/D13622

Modified:
  head/Makefile.inc1
  head/share/man/man7/build.7

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Sun Dec 31 17:11:12 2017(r327438)
+++ head/Makefile.inc1  Sun Dec 31 18:53:13 2017(r327439)
@@ -262,10 +262,11 @@ SUBDIR+=  tests
 SUBDIR+=contrib/ofed
 .endif
 
-# Local directories are last, since it is nice to at least get the base
-# system rebuilt before you do them.
+# Local directories are built in parallel with the base system directories.
+# Users may insert a .WAIT directive at the beginning or elsewhere within
+# the LOCAL_DIRS and LOCAL_LIB_DIRS lists as needed.
 .for _DIR in ${LOCAL_DIRS}
-.if exists(${.CURDIR}/${_DIR}/Makefile)
+.if ${_DIR} == ".WAIT" || exists(${.CURDIR}/${_DIR}/Makefile)
 SUBDIR+=   ${_DIR}
 .endif
 .endfor
@@ -276,7 +277,7 @@ SUBDIR+=${_DIR}
 _REDUNDANT_LIB_DIRS+=${LOCAL_LIB_DIRS:M${_DIR}*}
 .endfor
 .for _DIR in ${LOCAL_LIB_DIRS}
-.if empty(_REDUNDANT_LIB_DIRS:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile)
+.if ${_DIR} == ".WAIT" || (empty(_REDUNDANT_LIB_DIRS:M${_DIR}) && 
exists(${.CURDIR}/${_DIR}/Makefile))
 SUBDIR+=   ${_DIR}
 .endif
 .endfor
@@ -2445,7 +2446,7 @@ _generic_libs=${_cddl_lib} gnu/lib ${_kerberos5_lib} 
 _generic_libs+=sbin/ipf/libipf
 .endif
 .for _DIR in ${LOCAL_LIB_DIRS}
-.if exists(${.CURDIR}/${_DIR}/Makefile) && empty(_generic_libs:M${_DIR})
+.if ${_DIR} == ".WAIT"  || (empty(_generic_libs:M${_DIR}) && 
exists(${.CURDIR}/${_DIR}/Makefile))
 _generic_libs+= ${_DIR}
 .endif
 .endfor

Modified: head/share/man/man7/build.7
==
--- head/share/man/man7/build.7 Sun Dec 31 17:11:12 2017(r327438)
+++ head/share/man/man7/build.7 Sun Dec 31 18:53:13 2017(r327439)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 3, 2017
+.Dd December 24, 2017
 .Dt BUILD 7
 .Os
 .Sh NAME
@@ -509,6 +509,15 @@ If set, this variable supplies a list of additional di
 the root of the source tree to build as part of the
 .Cm everything
 target.
+The directories are built in parallel with each other,
+and with the base system directories.
+Insert a
+.Va .WAIT
+directive at the beginning of the
+.Va LOCAL_DIRS
+list to ensure all base system directories are built first.
+.Va .WAIT
+may also be used as needed elsewhere within the list.
 .It Va LOCAL_ITOOLS
 If set, this variable supplies a list of additional tools that are used by the
 .Cm installworld
@@ -520,6 +529,15 @@ If set, this variable supplies a list of additional di
 the root of the source tree to build as part of the
 .Cm libraries
 target.
+The directories are built in parallel with each other,
+and with the base system libraries.
+Insert a
+.Va .WAIT
+directive at the beginning of the
+.Va LOCAL_DIRS
+list to ensure all base system libraries are built first.
+.Va .WAIT
+may also be used as needed elsewhere within the list.
 .It Va LOCAL_MTREE
 If set, this variable supplies a list of additional mtrees relative to the
 root of the source tree to use as part of the
___
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: r327438 - head/etc

2017-12-31 Thread Bryan Venteicher
Author: bryanv
Date: Sun Dec 31 17:11:12 2017
New Revision: 327438
URL: https://svnweb.freebsd.org/changeset/base/327438

Log:
  Add VXLAN (RFC 7348) port
  
  PR:   202316
  Submitted by: olgeni@
  MFC after:2 weeks

Modified:
  head/etc/services

Modified: head/etc/services
==
--- head/etc/services   Sun Dec 31 17:07:59 2017(r327437)
+++ head/etc/services   Sun Dec 31 17:11:12 2017(r327438)
@@ -2291,6 +2291,7 @@ ipfix 4739/udp   #IP Flow Info Export
 ipfixs 4740/sctp  #ipfix protocol over DTLS
 ipfixs 4740/tcp   #ipfix protocol over TLS
 ipfixs 4740/udp   #ipfix protocol over DTLS
+vxlan  4789/udp   #Virtual eXtensible Local Area Network (VXLAN)
 commplex-main  5000/tcp
 commplex-main  5000/udp
 commplex-link  5001/tcp
___
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: r327437 - head/sys/amd64/amd64

2017-12-31 Thread Konstantin Belousov
Author: kib
Date: Sun Dec 31 17:07:59 2017
New Revision: 327437
URL: https://svnweb.freebsd.org/changeset/base/327437

Log:
  Remove MP SAFE marks and stray register name in comments.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days

Modified:
  head/sys/amd64/amd64/support.S

Modified: head/sys/amd64/amd64/support.S
==
--- head/sys/amd64/amd64/support.S  Sun Dec 31 16:52:29 2017
(r327436)
+++ head/sys/amd64/amd64/support.S  Sun Dec 31 17:07:59 2017
(r327437)
@@ -238,7 +238,7 @@ END(fillw)
  */
 
 /*
- * copyout(from_kernel, to_user, len)  - MP SAFE
+ * copyout(from_kernel, to_user, len)
  * %rdi,%rsi,%rdx
  */
 ENTRY(copyout)
@@ -301,7 +301,7 @@ copyout_fault:
 END(copyout)
 
 /*
- * copyin(from_user, to_kernel, len) - MP SAFE
+ * copyin(from_user, to_kernel, len)
  *%rdi,  %rsi,  %rdx
  */
 ENTRY(copyin)
@@ -518,7 +518,7 @@ fusufault:
 
 /*
  * Store a 64-bit word, a 32-bit word, a 16-bit word, or an 8-bit byte to
- * user memory.  All these functions are MPSAFE.
+ * user memory.
  * addr = %rdi, value = %rsi
  */
 ALTENTRY(suword64)
@@ -593,7 +593,7 @@ ENTRY(subyte)
 END(subyte)
 
 /*
- * copyinstr(from, to, maxlen, int *lencopied) - MP SAFE
+ * copyinstr(from, to, maxlen, int *lencopied)
  *   %rdi, %rsi, %rdx, %rcx
  *
  * copy a string from 'from' to 'to', stop when a 0 character is reached.
@@ -664,7 +664,7 @@ cpystrflt_x:
 END(copyinstr)
 
 /*
- * copystr(from, to, maxlen, int *lencopied) - MP SAFE
+ * copystr(from, to, maxlen, int *lencopied)
  * %rdi, %rsi, %rdx, %rcx
  */
 ENTRY(copystr)
@@ -704,7 +704,6 @@ END(copystr)
 
 /*
  * Handling of special amd64 registers and descriptor tables etc
- * %rdi
  */
 /* void lgdt(struct region_descriptor *rdp); */
 ENTRY(lgdt)
___
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: r327435 - in head: . sys/sys

2017-12-31 Thread Bjoern A. Zeeb
Author: bz
Date: Sun Dec 31 16:48:04 2017
New Revision: 327435
URL: https://svnweb.freebsd.org/changeset/base/327435

Log:
  Happy New Year 2018 my friends!

Modified:
  head/COPYRIGHT
  head/sys/sys/copyright.h

Modified: head/COPYRIGHT
==
--- head/COPYRIGHT  Sun Dec 31 16:18:13 2017(r327434)
+++ head/COPYRIGHT  Sun Dec 31 16:48:04 2017(r327435)
@@ -4,7 +4,7 @@
 The compilation of software known as FreeBSD is distributed under the
 following terms:
 
-Copyright (c) 1992-2017 The FreeBSD Project. All rights reserved.
+Copyright (c) 1992-2018 The FreeBSD Project. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions

Modified: head/sys/sys/copyright.h
==
--- head/sys/sys/copyright.hSun Dec 31 16:18:13 2017(r327434)
+++ head/sys/sys/copyright.hSun Dec 31 16:48:04 2017(r327435)
@@ -1,7 +1,7 @@
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
- * Copyright (C) 1992-2017 The FreeBSD Project. All rights reserved.
+ * Copyright (C) 1992-2018 The FreeBSD Project. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -36,7 +36,7 @@
 
 /* FreeBSD */
 #define COPYRIGHT_FreeBSD \
-   "Copyright (c) 1992-2017 The FreeBSD Project.\n"
+   "Copyright (c) 1992-2018 The FreeBSD Project.\n"
 
 /* Foundation */
 #defineTRADEMARK_Foundation \
___
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: r327434 - head/sys/netpfil/pf

2017-12-31 Thread Kristof Provost
Author: kp
Date: Sun Dec 31 16:18:13 2017
New Revision: 327434
URL: https://svnweb.freebsd.org/changeset/base/327434

Log:
  pf: Allow the module to be unloaded
  
  pf can now be safely unloaded. Most of this code is exercised on vnet
  jail shutdown.
  
  Don't block unloading.

Modified:
  head/sys/netpfil/pf/pf_ioctl.c

Modified: head/sys/netpfil/pf/pf_ioctl.c
==
--- head/sys/netpfil/pf/pf_ioctl.c  Sun Dec 31 10:01:31 2017
(r327433)
+++ head/sys/netpfil/pf/pf_ioctl.c  Sun Dec 31 16:18:13 2017
(r327434)
@@ -3833,12 +3833,6 @@ pf_modevent(module_t mod, int type, void *data)
case MOD_LOAD:
error = pf_load();
break;
-   case MOD_QUIESCE:
-   /*
-* Module should not be unloaded due to race conditions.
-*/
-   error = EBUSY;
-   break;
case MOD_UNLOAD:
/* Handled in SYSUNINIT(pf_unload) to ensure it's done after
 * the vnet_pf_uninit()s */
___
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: r327422 - head

2017-12-31 Thread Rodney W. Grimes
[ Charset UTF-8 unsupported, converting... ]
> Author: eadler
> Date: Sun Dec 31 07:26:24 2017
> New Revision: 327422
> URL: https://svnweb.freebsd.org/changeset/base/327422
> 
> Log:
>   s/=/+=

Edit commands are poor commit messages, would of been
better to say something like:
Correct addition of /etc/skel to OLD_DIRS by not
overwritting variable with assignment (= vs +=)


> 
> Modified:
>   head/ObsoleteFiles.inc
> 
> Modified: head/ObsoleteFiles.inc
> ==
> --- head/ObsoleteFiles.incSun Dec 31 07:25:55 2017(r327421)
> +++ head/ObsoleteFiles.incSun Dec 31 07:26:24 2017(r327422)
> @@ -39,7 +39,7 @@
>  # done
>  
>  # 20171230: Remove /etc/skel from mtree
> -OLD_DIRS=/etc/skel
> +OLD_DIRS+=/etc/skel
>  # 20171208: Remove basename_r(3)
>  OLD_FILES+=usr/share/man/man3/basename_r.3.gz
>  # 20171204: Move fdformat man page from volume 1 to volume 8.
> 
> 

-- 
Rod Grimes rgri...@freebsd.org
___
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: r327270 - head/sbin/pfctl

2017-12-31 Thread Kristof Provost
On 28 Dec 2017, at 5:33, Warner Losh wrote:
> Author: imp
> Date: Thu Dec 28 05:33:54 2017
> New Revision: 327270
> URL: https://svnweb.freebsd.org/changeset/base/327270
>
> Log:
>   Free path before returnig.
>
>   CID: 977827
>
Thanks!

Kristof
___
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: r327433 - in head/sys: net netpfil/pf

2017-12-31 Thread Kristof Provost
Author: kp
Date: Sun Dec 31 10:01:31 2017
New Revision: 327433
URL: https://svnweb.freebsd.org/changeset/base/327433

Log:
  pf: Clean all fragments on shutdown
  
  When pf is unloaded, or a vnet jail using pf is stopped we need to
  ensure we clean up all fragments, not just the expired ones.

Modified:
  head/sys/net/pfvar.h
  head/sys/netpfil/pf/pf.c
  head/sys/netpfil/pf/pf_norm.c

Modified: head/sys/net/pfvar.h
==
--- head/sys/net/pfvar.hSun Dec 31 09:24:41 2017(r327432)
+++ head/sys/net/pfvar.hSun Dec 31 10:01:31 2017(r327433)
@@ -1619,6 +1619,7 @@ int   pf_normalize_tcp_stateful(struct mbuf *, int, 
stru
 u_int32_t
pf_state_expires(const struct pf_state *);
 void   pf_purge_expired_fragments(void);
+void   pf_purge_fragments(uint32_t);
 intpf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *,
int);
 intpf_socket_lookup(int, struct pf_pdesc *, struct mbuf *);

Modified: head/sys/netpfil/pf/pf.c
==
--- head/sys/netpfil/pf/pf.cSun Dec 31 09:24:41 2017(r327432)
+++ head/sys/netpfil/pf/pf.cSun Dec 31 10:01:31 2017(r327433)
@@ -1498,7 +1498,7 @@ pf_unload_vnet_purge(void)
 * Now purge everything.
 */
pf_purge_expired_states(0, pf_hashmask);
-   pf_purge_expired_fragments();
+   pf_purge_fragments(UINT_MAX);
pf_purge_expired_src_nodes();
 
/*

Modified: head/sys/netpfil/pf/pf_norm.c
==
--- head/sys/netpfil/pf/pf_norm.c   Sun Dec 31 09:24:41 2017
(r327432)
+++ head/sys/netpfil/pf/pf_norm.c   Sun Dec 31 10:01:31 2017
(r327433)
@@ -219,9 +219,16 @@ pf_frag_compare(struct pf_fragment *a, struct pf_fragm
 void
 pf_purge_expired_fragments(void)
 {
+   u_int32_t   expire = time_uptime -
+   V_pf_default_rule.timeout[PFTM_FRAG];
+
+   pf_purge_fragments(expire);
+}
+
+void
+pf_purge_fragments(uint32_t expire)
+{
struct pf_fragment  *frag;
-   u_int32_texpire = time_uptime -
-   V_pf_default_rule.timeout[PFTM_FRAG];
 
PF_FRAG_LOCK();
while ((frag = TAILQ_LAST(_pf_fragqueue, pf_fragqueue)) != 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: r327432 - in head/sys: arm/amlogic/aml8726 arm/arm arm/at91 arm/cavium/cns11xx arm/lpc arm/mv arm/ralink arm/xscale/i8134x arm/xscale/ixp425 arm/xscale/pxa kern mips/ingenic mips/mips m...

2017-12-31 Thread Colin Percival
Author: cperciva
Date: Sun Dec 31 09:24:41 2017
New Revision: 327432
URL: https://svnweb.freebsd.org/changeset/base/327432

Log:
  Use the TSLOG framework to record entry/exit timestamps for DELAY and
  _vprintf; these functions are called in many places and can contribute
  meaningfully to the total time spent booting.

Modified:
  head/sys/arm/amlogic/aml8726/aml8726_timer.c
  head/sys/arm/arm/generic_timer.c
  head/sys/arm/arm/machdep.c
  head/sys/arm/arm/mpcore_timer.c
  head/sys/arm/at91/at91_machdep.c
  head/sys/arm/cavium/cns11xx/timer.c
  head/sys/arm/lpc/lpc_timer.c
  head/sys/arm/mv/timer.c
  head/sys/arm/ralink/rt1310_timer.c
  head/sys/arm/xscale/i8134x/i80321_timer.c
  head/sys/arm/xscale/ixp425/ixp425_timer.c
  head/sys/arm/xscale/pxa/pxa_timer.c
  head/sys/kern/subr_prf.c
  head/sys/mips/ingenic/jz4780_timer.c
  head/sys/mips/mips/tick.c
  head/sys/mips/nlm/tick.c
  head/sys/mips/rmi/tick.c
  head/sys/powerpc/powerpc/clock.c
  head/sys/riscv/riscv/timer.c
  head/sys/sparc64/sparc64/clock.c
  head/sys/x86/x86/delay.c

Modified: head/sys/arm/amlogic/aml8726/aml8726_timer.c
==
--- head/sys/arm/amlogic/aml8726/aml8726_timer.cSun Dec 31 09:24:11 
2017(r327431)
+++ head/sys/arm/amlogic/aml8726/aml8726_timer.cSun Dec 31 09:24:41 
2017(r327432)
@@ -347,6 +347,7 @@ DELAY(int usec)
}
return;
}
+   TSENTER();
 
/*
 * Some of the other timers in the source tree do this calculation as:
@@ -391,4 +392,5 @@ DELAY(int usec)
previous = now;
remaining -= delta;
}
+   TSEXIT();
 }

Modified: head/sys/arm/arm/generic_timer.c
==
--- head/sys/arm/arm/generic_timer.cSun Dec 31 09:24:11 2017
(r327431)
+++ head/sys/arm/arm/generic_timer.cSun Dec 31 09:24:41 2017
(r327432)
@@ -526,6 +526,7 @@ DELAY(int usec)
 {
int32_t counts;
 
+   TSENTER();
/*
 * Check the timers are setup, if not just
 * use a for loop for the meantime
@@ -540,6 +541,7 @@ DELAY(int usec)
cpufunc_nullop();
} else
arm_tmr_do_delay(usec, arm_tmr_sc);
+   TSEXIT();
 }
 #endif
 

Modified: head/sys/arm/arm/machdep.c
==
--- head/sys/arm/arm/machdep.c  Sun Dec 31 09:24:11 2017(r327431)
+++ head/sys/arm/arm/machdep.c  Sun Dec 31 09:24:41 2017(r327432)
@@ -347,7 +347,9 @@ void
 DELAY(int usec)
 {
 
+   TSENTER();
delay_impl(usec, delay_arg);
+   TSEXIT();
 }
 #endif
 

Modified: head/sys/arm/arm/mpcore_timer.c
==
--- head/sys/arm/arm/mpcore_timer.c Sun Dec 31 09:24:11 2017
(r327431)
+++ head/sys/arm/arm/mpcore_timer.c Sun Dec 31 09:24:41 2017
(r327432)
@@ -547,6 +547,7 @@ DELAY(int usec)
struct arm_tmr_softc *sc;
int32_t counts;
 
+   TSENTER();
/* Check the timers are setup, if not just use a for loop for the 
meantime */
if (arm_tmr_tc == NULL || arm_tmr_timecount.tc_frequency == 0) {
for (; usec > 0; usec--)
@@ -558,5 +559,6 @@ DELAY(int usec)
sc = arm_tmr_tc->tc_priv;
arm_tmr_delay(usec, sc);
}
+   TSEXIT();
 }
 #endif

Modified: head/sys/arm/at91/at91_machdep.c
==
--- head/sys/arm/at91/at91_machdep.cSun Dec 31 09:24:11 2017
(r327431)
+++ head/sys/arm/at91/at91_machdep.cSun Dec 31 09:24:41 2017
(r327432)
@@ -672,8 +672,10 @@ void
 DELAY(int n)
 {
 
+   TSENTER();
if (soc_info.soc_data)
soc_info.soc_data->soc_delay(n);
+   TSEXIT();
 }
 
 void

Modified: head/sys/arm/cavium/cns11xx/timer.c
==
--- head/sys/arm/cavium/cns11xx/timer.c Sun Dec 31 09:24:11 2017
(r327431)
+++ head/sys/arm/cavium/cns11xx/timer.c Sun Dec 31 09:24:41 2017
(r327432)
@@ -122,6 +122,7 @@ DELAY(int usec)
;
return;
}
+   TSENTER();
 
val = read_timer_counter_noint();
nticks = (((APB_clock / 1000) * usec) / 1000) + 100;
@@ -135,7 +136,7 @@ DELAY(int usec)
 
val = val_temp;
}
-
+   TSEXIT();
 }
 
 /*

Modified: head/sys/arm/lpc/lpc_timer.c
==
--- head/sys/arm/lpc/lpc_timer.cSun Dec 31 09:24:11 2017
(r327431)
+++ head/sys/arm/lpc/lpc_timer.cSun Dec 31 09:24:41 2017
(r327432)
@@ -292,6 +292,7 @@ DELAY(int usec)
;

svn commit: r327431 - head/sys/kern

2017-12-31 Thread Colin Percival
Author: cperciva
Date: Sun Dec 31 09:24:11 2017
New Revision: 327431
URL: https://svnweb.freebsd.org/changeset/base/327431

Log:
  Instrument thread creations for the the benefit of the TSLOG framework.
  This assists in tracking time spent while the boot is being "held" waiting
  for something to happen.

Modified:
  head/sys/kern/kern_kthread.c

Modified: head/sys/kern/kern_kthread.c
==
--- head/sys/kern/kern_kthread.cSun Dec 31 09:23:52 2017
(r327430)
+++ head/sys/kern/kern_kthread.cSun Dec 31 09:24:11 2017
(r327431)
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -124,6 +125,7 @@ kproc_create(void (*func)(void *), void *arg,
 #ifdef KTR
sched_clear_tdname(td);
 #endif
+   TSTHREAD(td, td->td_name);
 
/* call the processes' main()... */
cpu_fork_kthread_handler(td, func, arg);
@@ -282,6 +284,8 @@ kthread_add(void (*func)(void *), void *arg, struct pr
va_start(ap, fmt);
vsnprintf(newtd->td_name, sizeof(newtd->td_name), fmt, ap);
va_end(ap);
+
+   TSTHREAD(newtd, newtd->td_name);
 
newtd->td_proc = p;  /* needed for cpu_copy_thread */
/* might be further optimized for kthread */
___
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: r327430 - in head/sys: geom kern

2017-12-31 Thread Colin Percival
Author: cperciva
Date: Sun Dec 31 09:23:52 2017
New Revision: 327430
URL: https://svnweb.freebsd.org/changeset/base/327430

Log:
  Instrument "boot holds" for the benefit of the TSLOG framework.  These
  are places where the "main thread" of the booting kernel (either the
  thread which later becomes swapper or the thread which later becomes
  init) has to stop and wait for action to take place in another thread
  before continuing.
  
  There are currently three such holds:
  1. The intr_config_hooks SYSINIT waits for hooks registered via the
  config_intrhook_establish function; this allows (typically) devices
  which need interrupts enabled to complete their initialization to do
  so before root is mounted.
  
  2. The g_waitidle function waits for the GEOM event queue to be empty;
  this ensures that all of the disks which have been attached have been
  tasted before we attempt to mount root.
  
  3. The vfs_mountroot_wait function (in addition to calling g_waitidle)
  waits for holds registered via root_mount_hold; among other things, this
  is used by the USB subsystem to ensure that we don't fail to mount root
  if it's located on a USB disk which takes a while to probe.

Modified:
  head/sys/geom/geom_event.c
  head/sys/kern/subr_autoconf.c
  head/sys/kern/vfs_mountroot.c

Modified: head/sys/geom/geom_event.c
==
--- head/sys/geom/geom_event.c  Sun Dec 31 09:23:35 2017(r327429)
+++ head/sys/geom/geom_event.c  Sun Dec 31 09:23:52 2017(r327430)
@@ -87,9 +87,11 @@ g_waitidle(void)
g_topology_assert_not();
 
mtx_lock(_eventlock);
+   TSWAIT("GEOM events");
while (!TAILQ_EMPTY(_events))
msleep(_pending_events, _eventlock, PPAUSE,
"g_waitidle", hz/5);
+   TSUNWAIT("GEOM events");
mtx_unlock(_eventlock);
curthread->td_pflags &= ~TDP_GEOM;
 }
@@ -266,6 +268,7 @@ one_event(void)
ep->func(ep->arg, 0);
g_topology_assert();
mtx_lock(_eventlock);
+   TSRELEASE("GEOM events");
TAILQ_REMOVE(_events, ep, events);
ep->flag &= ~EV_INPROGRESS;
if (ep->flag & EV_WAKEUP) {
@@ -324,6 +327,7 @@ g_cancel_event(void *ref)
break;
if (ep->ref[n] != ref)
continue;
+   TSRELEASE("GEOM events");
TAILQ_REMOVE(_events, ep, events);
ep->func(ep->arg, EV_CANCEL);
mtx_assert(_eventlock, MA_OWNED);
@@ -367,6 +371,7 @@ g_post_event_x(g_event_t *func, void *arg, int flag, i
ep->func = func;
ep->arg = arg;
mtx_lock(_eventlock);
+   TSHOLD("GEOM events");
TAILQ_INSERT_TAIL(_events, ep, events);
mtx_unlock(_eventlock);
wakeup(_wait_event);

Modified: head/sys/kern/subr_autoconf.c
==
--- head/sys/kern/subr_autoconf.c   Sun Dec 31 09:23:35 2017
(r327429)
+++ head/sys/kern/subr_autoconf.c   Sun Dec 31 09:23:52 2017
(r327430)
@@ -155,6 +155,7 @@ boot_run_interrupt_driven_config_hooks(void *dummy)
run_interrupt_driven_config_hooks();
 
/* Block boot processing until all hooks are disestablished. */
+   TSWAIT("config hooks");
mtx_lock(_config_hook_lock);
warned = 0;
while (!TAILQ_EMPTY(_config_hook_list)) {
@@ -168,6 +169,7 @@ boot_run_interrupt_driven_config_hooks(void *dummy)
}
}
mtx_unlock(_config_hook_lock);
+   TSUNWAIT("config hooks");
 }
 
 SYSINIT(intr_config_hooks, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_FIRST,
@@ -183,6 +185,7 @@ config_intrhook_establish(struct intr_config_hook *hoo
 {
struct intr_config_hook *hook_entry;
 
+   TSHOLD("config hooks");
mtx_lock(_config_hook_lock);
TAILQ_FOREACH(hook_entry, _config_hook_list, ich_links)
if (hook_entry == hook)
@@ -239,6 +242,7 @@ config_intrhook_disestablish(struct intr_config_hook *
if (next_to_notify == hook)
next_to_notify = TAILQ_NEXT(hook, ich_links);
TAILQ_REMOVE(_config_hook_list, hook, ich_links);
+   TSRELEASE("config hooks");
 
/* Wakeup anyone watching the list */
wakeup(_config_hook_list);

Modified: head/sys/kern/vfs_mountroot.c
==
--- head/sys/kern/vfs_mountroot.c   Sun Dec 31 09:23:35 2017
(r327429)
+++ head/sys/kern/vfs_mountroot.c   Sun Dec 31 09:23:52 2017
(r327430)
@@ -176,6 +176,7 @@ root_mount_hold(const char *identifier)
h = malloc(sizeof *h, M_DEVBUF, M_ZERO | M_WAITOK);
h->who = identifier;
mtx_lock(_holds_mtx);
+   TSHOLD("root mount");
LIST_INSERT_HEAD(_holds, h, list);
mtx_unlock(_holds_mtx);

svn commit: r327429 - head/sys/sys

2017-12-31 Thread Colin Percival
Author: cperciva
Date: Sun Dec 31 09:23:35 2017
New Revision: 327429
URL: https://svnweb.freebsd.org/changeset/base/327429

Log:
  Use the TSLOG framework to record entry/exit timestamps for VFS_MOUNT calls.

Modified:
  head/sys/sys/mount.h

Modified: head/sys/sys/mount.h
==
--- head/sys/sys/mount.hSun Dec 31 09:23:19 2017(r327428)
+++ head/sys/sys/mount.hSun Dec 31 09:23:35 2017(r327429)
@@ -40,6 +40,7 @@
 #ifdef _KERNEL
 #include 
 #include 
+#include 
 #include 
 #include 
 #endif
@@ -708,9 +709,11 @@ vfs_statfs_t   __vfs_statfs;
 #defineVFS_MOUNT(MP) ({
\
int _rc;\
\
+   TSRAW(curthread, TS_ENTER, "VFS_MOUNT", (MP)->mnt_vfc->vfc_name);\
VFS_PROLOGUE(MP);   \
_rc = (*(MP)->mnt_op->vfs_mount)(MP);   \
VFS_EPILOGUE(MP);   \
+   TSRAW(curthread, TS_EXIT, "VFS_MOUNT", (MP)->mnt_vfc->vfc_name);\
_rc; })
 
 #defineVFS_UNMOUNT(MP, FORCE) ({   
\
___
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: r327428 - in head/sys: kern tools

2017-12-31 Thread Colin Percival
Author: cperciva
Date: Sun Dec 31 09:23:19 2017
New Revision: 327428
URL: https://svnweb.freebsd.org/changeset/base/327428

Log:
  Teach makeobjops.awk to accept PROLOG and EPILOG blocks before
  METHOD and STATICMETHOD declarations; that code will be inserted
  into the dispatch function before and after the method call.
  
  Use this functionality and the TSLOG framework to record DEVICE_ATTACH
  and DEVICE_PROBE entry/exit timestamps.

Modified:
  head/sys/kern/device_if.m
  head/sys/tools/makeobjops.awk

Modified: head/sys/kern/device_if.m
==
--- head/sys/kern/device_if.m   Sun Dec 31 09:23:02 2017(r327427)
+++ head/sys/kern/device_if.m   Sun Dec 31 09:23:19 2017(r327428)
@@ -39,6 +39,11 @@
  */
 INTERFACE device;
 
+# Needed for timestamping device probe/attach calls
+HEADER {
+   #include 
+}
+
 #
 # Default implementations of some methods.
 #
@@ -142,6 +147,12 @@ CODE {
  * be returned to indicate the type of error
  * @see DEVICE_ATTACH(), pci_get_vendor(), pci_get_device()
  */
+PROLOG {
+   TSENTER2(device_get_name(dev));
+}
+EPILOG {
+   TSEXIT2(device_get_name(dev));
+}
 METHOD int probe {
device_t dev;
 };
@@ -199,6 +210,12 @@ STATICMETHOD void identify {
  * be returned to indicate the type of error
  * @see DEVICE_PROBE()
  */
+PROLOG {
+   TSENTER2(device_get_name(dev));
+}
+EPILOG {
+   TSEXIT2(device_get_name(dev));
+}
 METHOD int attach {
device_t dev;
 };

Modified: head/sys/tools/makeobjops.awk
==
--- head/sys/tools/makeobjops.awk   Sun Dec 31 09:23:02 2017
(r327427)
+++ head/sys/tools/makeobjops.awk   Sun Dec 31 09:23:19 2017
(r327428)
@@ -326,11 +326,19 @@ function handle_method (static, doc)
}
printh("{");
printh("\tkobjop_t _m;");
+   if (ret != "void")
+   printh("\t" ret " rc;");
if (!static)
firstvar = "((kobj_t)" firstvar ")";
+   if (prolog != "")
+   printh(prolog);
printh("\tKOBJOPLOOKUP(" firstvar "->ops," mname ");");
-   retrn =  (ret != "void") ? "return " : "";
-   printh("\t" retrn "((" mname "_t *) _m)(" varname_list ");");
+   rceq = (ret != "void") ? "rc = " : "";
+   printh("\t" rceq "((" mname "_t *) _m)(" varname_list ");");
+   if (epilog != "")
+   printh(epilog);
+   if (ret != "void")
+   printh("\treturn (rc);");
printh("}\n");
 }
 
@@ -440,6 +448,8 @@ for (file_i = 0; file_i < num_files; file_i++) {
lineno = 0;
error = 0;  # to signal clean up and gerror setting
lastdoc = "";
+   prolog = "";
+   epilog = "";
 
while (!error && (getline < src) > 0) {
lineno++;
@@ -473,10 +483,18 @@ for (file_i = 0; file_i < num_files; file_i++) {
else if (/^METHOD/) {
handle_method(0, lastdoc);
lastdoc = "";
+   prolog = "";
+   epilog = "";
} else if (/^STATICMETHOD/) {
handle_method(1, lastdoc);
lastdoc = "";
-   } else {
+   prolog = "";
+   epilog = "";
+   } else if (/^PROLOG[]*{$/)
+   prolog = handle_code();
+   else if (/^EPILOG[  ]*{$/)
+   epilog = handle_code();
+   else {
debug($0);
warnsrc("Invalid line encountered");
error = 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: r327427 - head/sys/sys

2017-12-31 Thread Colin Percival
Author: cperciva
Date: Sun Dec 31 09:23:02 2017
New Revision: 327427
URL: https://svnweb.freebsd.org/changeset/base/327427

Log:
  Use the TSLOG framework to record SYSINIT entry/exit timestamps.

Modified:
  head/sys/sys/kernel.h

Modified: head/sys/sys/kernel.h
==
--- head/sys/sys/kernel.h   Sun Dec 31 09:22:31 2017(r327426)
+++ head/sys/sys/kernel.h   Sun Dec 31 09:23:02 2017(r327427)
@@ -54,6 +54,9 @@
 /* for intrhook below */
 #include 
 
+/* for timestamping SYSINITs; other files may assume this is included here */
+#include 
+
 /* Global variables for the kernel. */
 
 /* 1.1 */
@@ -229,14 +232,44 @@ struct sysinit {
  * correct warnings when -Wcast-qual is used.
  *
  */
+#ifdef TSLOG
+struct sysinit_tslog {
+   sysinit_cfunc_t func;
+   const void * data;
+   const char * name;
+};
+static inline void
+sysinit_tslog_shim(const void * data)
+{
+   const struct sysinit_tslog * x = data;
+
+   TSRAW(curthread, TS_ENTER, "SYSINIT", x->name);
+   (x->func)(x->data);
+   TSRAW(curthread, TS_EXIT, "SYSINIT", x->name);
+}
 #defineC_SYSINIT(uniquifier, subsystem, order, func, ident)\
+   static struct sysinit_tslog uniquifier ## _sys_init_tslog = {   \
+   func,   \
+   (ident),\
+   #uniquifier \
+   };  \
static struct sysinit uniquifier ## _sys_init = {   \
subsystem,  \
order,  \
+   sysinit_tslog_shim, \
+## _sys_init_tslog  \
+   };  \
+   DATA_SET(sysinit_set,uniquifier ## _sys_init)
+#else
+#defineC_SYSINIT(uniquifier, subsystem, order, func, ident)\
+   static struct sysinit uniquifier ## _sys_init = {   \
+   subsystem,  \
+   order,  \
func,   \
(ident) \
};  \
DATA_SET(sysinit_set,uniquifier ## _sys_init)
+#endif
 
 #defineSYSINIT(uniquifier, subsystem, order, func, ident)  \
C_SYSINIT(uniquifier, subsystem, order, \
___
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: r327426 - head/sys/kern

2017-12-31 Thread Colin Percival
Author: cperciva
Date: Sun Dec 31 09:22:31 2017
New Revision: 327426
URL: https://svnweb.freebsd.org/changeset/base/327426

Log:
  Use the TSLOG framework to record entry/exit timestamps for machine
  independent functions with important roles in the early boot process:
  mi_startup (with the "exit" recorded when it becomes swapper),
  start_init (with the "exit" recorded when the thread is about to
  "return" into the newly created init process), vfs_mountroot, and
  vfs_mountroot_wait.

Modified:
  head/sys/kern/init_main.c
  head/sys/kern/vfs_mountroot.c

Modified: head/sys/kern/init_main.c
==
--- head/sys/kern/init_main.c   Sun Dec 31 09:22:07 2017(r327425)
+++ head/sys/kern/init_main.c   Sun Dec 31 09:22:31 2017(r327426)
@@ -220,6 +220,8 @@ mi_startup(void)
int verbose;
 #endif
 
+   TSENTER();
+
if (boothowto & RB_VERBOSE)
bootverbose++;
 
@@ -313,6 +315,8 @@ restart:
}
}
 
+   TSEXIT();   /* Here so we don't overlap with start_init. */
+
mtx_assert(, MA_OWNED | MA_NOTRECURSED);
mtx_unlock();
 
@@ -706,6 +710,8 @@ start_init(void *dummy)
 
GIANT_REQUIRED;
 
+   TSENTER();  /* Here so we don't overlap with mi_startup. */
+
td = curthread;
p = td->td_proc;
 
@@ -799,6 +805,7 @@ start_init(void *dummy)
 */
if ((error = sys_execve(td, )) == EJUSTRETURN) {
mtx_unlock();
+   TSEXIT();
return;
}
if (error != ENOENT)

Modified: head/sys/kern/vfs_mountroot.c
==
--- head/sys/kern/vfs_mountroot.c   Sun Dec 31 09:22:07 2017
(r327425)
+++ head/sys/kern/vfs_mountroot.c   Sun Dec 31 09:22:31 2017
(r327426)
@@ -938,6 +938,8 @@ vfs_mountroot_wait(void)
struct timeval lastfail;
int curfail;
 
+   TSENTER();
+
curfail = 0;
while (1) {
DROP_GIANT();
@@ -957,6 +959,8 @@ vfs_mountroot_wait(void)
msleep(_holds, _holds_mtx, PZERO | PDROP, "roothold",
hz);
}
+
+   TSEXIT();
 }
 
 static int
@@ -1013,6 +1017,8 @@ vfs_mountroot(void)
struct thread *td;
time_t timebase;
int error;
+   
+   TSENTER();
 
td = curthread;
 
@@ -1062,6 +1068,8 @@ vfs_mountroot(void)
mtx_unlock(_holds_mtx);
 
EVENTHANDLER_INVOKE(mountroot);
+
+   TSEXIT();
 }
 
 static struct mntarg *
___
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: r327425 - head/sys/amd64/amd64

2017-12-31 Thread Colin Percival
Author: cperciva
Date: Sun Dec 31 09:22:07 2017
New Revision: 327425
URL: https://svnweb.freebsd.org/changeset/base/327425

Log:
  Use the TSLOG framework to record entry/exit timestamps for hammer_time.
  The entry must be logged "manually" using TSRAW rather than TSENTER
  since PCPU data structures have not yet been initialized and thus
  curthread cannot be accessed;  is what will become curthread
  later in hammer_time.
  
  Other MD initialization code should be similarly instrumented in order
  to gain visibility into the time spent before entering mi_startup; this
  will require some care and testing from people with access to such
  hardware.

Modified:
  head/sys/amd64/amd64/machdep.c

Modified: head/sys/amd64/amd64/machdep.c
==
--- head/sys/amd64/amd64/machdep.c  Sun Dec 31 09:21:34 2017
(r327424)
+++ head/sys/amd64/amd64/machdep.c  Sun Dec 31 09:22:07 2017
(r327425)
@@ -1525,6 +1525,8 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
size_t kstack0_sz;
int late_console;
 
+   TSRAW(, TS_ENTER, __func__, NULL);
+
/*
 * This may be done better later if it gets more high level
 * components in it. If so just link td->td_proc here.
@@ -1773,6 +1775,8 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
x86_init_fdt();
 #endif
thread0.td_critnest = 0;
+
+   TSEXIT();
 
/* Location of kernel stack for locore */
return ((u_int64_t)thread0.td_pcb);
___
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: r327423 - in head/sys: kern sys

2017-12-31 Thread Colin Percival
Author: cperciva
Date: Sun Dec 31 09:21:01 2017
New Revision: 327423
URL: https://svnweb.freebsd.org/changeset/base/327423

Log:
  Code for recording timestamps of events, especially function entries/exits.
  This is a very primitive system, intended for use in measuring performance
  during the early system boot, before more sophisticated tools like DTrace
  or infrastructure like kernel memory allocation and mutexes are available.
  
  Because this code records pointers to strings rather than copying strings
  (in order to keep the memory usage more manageable), if a kernel module is
  unloaded after logging an event, Bad Things can happen.  Users are advised
  to not do that.
  
  Since cycle counts from the early kernel boot are used as an initial entropy
  source, publishing this information to userland could result in inadequate
  entropy being kept private to the kernel RNG.  Users are advised to not
  enable this on systems with untrusted users.
  
  Discussed on: freebsd-current

Added:
  head/sys/kern/kern_tslog.c   (contents, props changed)
  head/sys/sys/tslog.h   (contents, props changed)

Added: head/sys/kern/kern_tslog.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/kern/kern_tslog.c  Sun Dec 31 09:21:01 2017(r327423)
@@ -0,0 +1,118 @@
+/*-
+ * Copyright (c) 2017 Colin Percival
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#ifndef TSLOGSIZE
+#define TSLOGSIZE 262144
+#endif
+
+static volatile long nrecs = 0;
+static struct timestamp {
+   void * td;
+   int type;
+   const char * f;
+   const char * s;
+   uint64_t tsc;
+} timestamps[TSLOGSIZE];
+
+void
+tslog(void * td, int type, const char * f, const char * s)
+{
+   uint64_t tsc = get_cyclecount();
+   long pos;
+
+   /* Grab a slot. */
+   pos = atomic_fetchadd_long(, 1);
+
+   /* Store record. */
+   if (pos < nitems(timestamps)) {
+   timestamps[pos].td = td;
+   timestamps[pos].type = type;
+   timestamps[pos].f = f;
+   timestamps[pos].s = s;
+   timestamps[pos].tsc = tsc;
+   }
+}
+
+static int
+sysctl_debug_tslog(SYSCTL_HANDLER_ARGS)
+{
+   int error;
+   struct sbuf *sb;
+   size_t i, limit;
+
+   /*
+* This code can race against the code in tslog() which stores
+* records: Theoretically we could end up reading a record after
+* its slots have been reserved but before it has been written.
+* Since this code takes orders of magnitude longer to run than
+* tslog() takes to write a record, it is highly unlikely that
+* anyone will ever experience this race.
+*/
+   sb = sbuf_new_for_sysctl(NULL, NULL, 1024, req);
+   limit = MIN(nrecs, nitems(timestamps));
+   for (i = 0; i < limit; i++) {
+   sbuf_printf(sb, "%p", timestamps[i].td);
+   sbuf_printf(sb, " %llu",
+   (unsigned long long)timestamps[i].tsc);
+   switch (timestamps[i].type) {
+   case TS_ENTER:
+   sbuf_printf(sb, " ENTER");
+   break;
+   case TS_EXIT:
+   sbuf_printf(sb, " EXIT");
+   break;
+   case TS_THREAD:
+   sbuf_printf(sb, " THREAD");
+   break;
+   case TS_EVENT:
+   sbuf_printf(sb, " EVENT");
+   break;
+ 

svn commit: r327424 - head/sys/conf

2017-12-31 Thread Colin Percival
Author: cperciva
Date: Sun Dec 31 09:21:34 2017
New Revision: 327424
URL: https://svnweb.freebsd.org/changeset/base/327424

Log:
  Connect kern_tslog.c to the build and add TSLOG / TSLOGSIZE kernel options.
  These are intended for debugging purposes and should not be added to
  "generic" kernel configurations since they result in a nontrivial amount
  of memory being set aside for this purpose, can break if kernel modules are
  unloaded, and can potentially leak a dangerous amount of information about
  timestamps used as a source of kernel entropy.

Modified:
  head/sys/conf/NOTES
  head/sys/conf/files
  head/sys/conf/options

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Sun Dec 31 09:21:01 2017(r327423)
+++ head/sys/conf/NOTES Sun Dec 31 09:21:34 2017(r327424)
@@ -590,6 +590,20 @@ optionsSTACK
 #
 optionsNUM_CORE_FILES=5
 
+#
+# The TSLOG option enables timestamped logging of events, especially
+# function entries/exits, in order to track the time spent by the kernel.
+# In particular, this is useful when investigating the early boot process,
+# before it is possible to use more sophisticated tools like DTrace.
+# The TSLOGSIZE option controls the size of the (preallocated, fixed
+# length) buffer used for storing these events (default: 262144 records).
+#
+# For security reasons the TSLOG option should not be enabled on systems
+# used in production.
+#
+optionsTSLOG
+optionsTSLOGSIZE=262144
+
 
 #
 # PERFORMANCE MONITORING OPTIONS

Modified: head/sys/conf/files
==
--- head/sys/conf/files Sun Dec 31 09:21:01 2017(r327423)
+++ head/sys/conf/files Sun Dec 31 09:21:34 2017(r327424)
@@ -3802,6 +3802,7 @@ kern/kern_thr.c   standard
 kern/kern_thread.c standard
 kern/kern_time.c   standard
 kern/kern_timeout.cstandard
+kern/kern_tslog.c  optional tslog
 kern/kern_umtx.c   standard
 kern/kern_uuid.c   standard
 kern/kern_xxx.cstandard

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Sun Dec 31 09:21:01 2017(r327423)
+++ head/sys/conf/options   Sun Dec 31 09:21:34 2017(r327424)
@@ -67,6 +67,8 @@ EARLY_PRINTF  opt_global.h
 TEXTDUMP_PREFERRED opt_ddb.h
 TEXTDUMP_VERBOSE   opt_ddb.h
 NUM_CORE_FILES opt_global.h
+TSLOG  opt_global.h
+TSLOGSIZE  opt_global.h
 
 # Miscellaneous options.
 ALQ
___
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"