Commit Graph

17593 Commits

Author SHA1 Message Date
Matt Macy
c8d23c138f pmc: add list-events command 2018-06-01 00:45:59 +00:00
Matt Macy
fbf962e6bb libpmc: allow substring for list and add function for printing event details 2018-06-01 00:45:53 +00:00
Hans Petter Selasky
5fd1ea0810 Re-apply r190640.
- Restore local change to include <net/bpf.h> inside pcap.h.
This fixes ports build problems.
- Update local copy of dlt.h with new DLT types.
- Revert no longer needed <net/bpf.h> includes which were added
as part of r334277.

Suggested by:	antoine@, delphij@, np@
MFC after:	3 weeks
Sponsored by:	Mellanox Technologies
2018-05-31 09:11:21 +00:00
Matt Macy
2708737d38 pmc stat: fix format strings for 32-bit 2018-05-30 22:03:02 +00:00
Warner Losh
b98d2b35df devinfo_init() returns an errno, but doesn't set errno, so the error
message when it fails reflects some random thing rather than what it
returned. Set errno to the return value.
2018-05-30 15:08:59 +00:00
Matt Macy
82c78f803d pmc: don't break build with format issues 2018-05-30 00:06:17 +00:00
Matt Macy
5244f3c6ae pmc: silence scan-build warnings 2018-05-29 21:02:08 +00:00
Matt Macy
3554f22e67 pmc: Add new sub-command structured "pmc" utility
This will manage pmc functionality with a more
manageable structure of subcommands rather than the
gradually accreted spaghetti logic of overlapping flags
that exists in pmcstat.

This is intended to ultimately have all the same functionality
as pmcannotate+pmccontrol+pmcstat. Currently it just has
"stat" and "system-stat" - counters for the process itself and counters
for the system as a whole respectively (i.e. system-stat includes kernel
threads). Note that the rusage results (page faults/context switches/
user/sys) for stat-system will not account for the system as a whole -
only for the child process specified on the command line.

Implementing stat was suggested by mjg@ and the output is based on that
from Linux's "perf stat".

% pmc stat -- make -j32 buildkernel -DNO_MODULES  -ss > /dev/null
         9598393  page faults           #       0.674 M/sec
          387085  voluntary csw         #       0.027 M/sec
          106989  involuntary csw       #       0.008 M/sec
   2763965982317  cycles
   2542953049760  instructions          #       0.920 inst/cycle
    511562750157  branches
     12917006881  branch-misses         #       2.525%
     17944429878  cache-references      #       0.007 refs/inst
      2205119560  cache-misses          #       12.289%
           43.74  real                  #       2019.72% cpu
          795.09  user                  #       1817.72% cpu
           88.35  sys                   #       202.00% cpu

% make -j32 buildkernel -DNO_MODULES  -ss > /dev/null &
% sudo pmc stat-system cat
^C             103  page faults         #       0.811 M/sec
               4  voluntary csw         #       0.031 M/sec
               0  involuntary csw       #       0.000 M/sec
   2843639070514  cycles
   2606171217438  instructions          #       0.916 inst/cycle
    522450422783  branches
     13092862839  branch-misses         #       2.506%
     18592101113  cache-references      #       0.007 refs/inst
      2562878667  cache-misses          #       13.785%
           44.85  real                  #       0.00% cpu
            0.00  user                  #       0.00% cpu
            0.00  sys                   #       0.00% cpu
2018-05-29 20:28:34 +00:00
Marcelo Araujo
6dd8233d5d Simplify macros EFPRINTF and EFFLUSH. [0]
Also stdarg(3) says that each invocation of va_start() must be paired
with a corresponding invocation of va_end() in the same function. [1]

Reported by:	Coverity
CID:		1194318[0] and 1194332[1]
Discussed with:	jhb
MFC after:	4 weeks.
Sponsored by:	iXsystems Inc.
Differential Revision:	https://reviews.freebsd.org/D15548
2018-05-29 01:46:00 +00:00
Devin Teske
a03d5f8b02 sysrc(8): Test variable names for invalid characters
PR:		bin/187461
Reported by:	ebay@looksharp.net
MFC after:	4 weeks
X-MFC-to:	stable/11 (after 11.2-R)
Sponsored by:	Smule, Inc.
2018-05-28 23:34:23 +00:00
Hans Petter Selasky
609169becc Buildfix for GCC after r334277.
MFC after:	1 month
Sponsored by:	Mellanox Technologies
2018-05-28 09:41:44 +00:00
Hans Petter Selasky
b00ab7548b MFV r333789: libpcap 1.9.0 (pre-release)
MFC after:	1 month
Sponsored by:	Mellanox Technologies
2018-05-28 08:12:18 +00:00
Eric van Gyzen
8a114a66b5 bhyve: guarantee NUL termination
Use strlcpy to guarantee NUL termination of the path to a
virtio console socket.

Reported by:	Coverity
CID:		1362874
Sponsored by:	Dell EMC
2018-05-28 03:09:09 +00:00
Eric van Gyzen
054e6e1335 bhyve: fix small memory leak in virtio console
Reported by:	Coverity
CID:		1363284
Sponsored by:	Dell EMC
2018-05-28 03:05:01 +00:00
Eric van Gyzen
1de11cd4e1 tcpdrop: ensure NUL termination of a string
strncpy did not guarantee NUL termination of the "stack" string.
Use strlcpy instead.  While I'm here, avoid unnecessary memset
and strnlen calls.

Reported by:	Coverity
CID:		1381035
Sponsored by:	Dell EMC
2018-05-28 01:58:49 +00:00
Matt Macy
ae266f9f94 pmcstat: suppress uninitialized warning of event 2018-05-27 17:49:27 +00:00
Matt Macy
959826ca1b pmc(3)/hwpmc(4): update supported Intel processors to rely fully on the
vendor provided pmu-events tables and sundry cleanups.

The vendor pmu-events tables provide counter descriptions, default
sample rates, event, umask, and flag values for all the counter
configuration permutations. Using this gives us:

- much simpler kernel code for the MD component
- helpful long and short event descriptions
- simpler user code
- sample rates that won't overload the system

Update man page with newer sample types and remove unused sample type.
2018-05-26 19:29:19 +00:00
Matt Macy
5506ceb87f Revert r334242 "pmc(3)/hwpmc(4): update supported Intel processors to rely fully on the"
because of squash commit messages
2018-05-26 19:26:19 +00:00
Matt Macy
4928135658 pmc(3)/hwpmc(4): update supported Intel processors to rely fully on the
vendor provided pmu-events tables and sundry cleanups.

The vendor pmu-events tables provide counter descriptions, default
sample rates, event, umask, and flag values for all the counter
configuration permutations. Using this gives us:

- much simpler kernel code for the MD component
- helpful long and short event descriptions
- simpler user code
- sample rates that won't overload the system

Update man page with newer sample types and remove unused sample type.

Squashed commit of the following:

commit 4459d43eff815bec08ccc5533dbe5de846f03128
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Sat May 26 00:06:31 2018 -0700

    libpmc: fix pmu function signatures for non amd64

commit a2cb8bbc586c65d41f9b291430a2261ec67b59fe
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 22:38:11 2018 -0700

    pmcstat: fix indentation of usage

commit f686954b15ff56a833ac80404898977cb80a265b
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 22:19:49 2018 -0700

    pmclog(3): add callchain and pmcallocatedyn, remove pcsample

commit 73e13a0d2e9498c81c150d14d022050cee7511bb
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 22:19:00 2018 -0700

    pmclog.h: GC pcsample field

commit 3e93ffd65da641fa657539dad3c48e281f8b5798
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 22:05:57 2018 -0700

    hwpmc: make Intel core CPUs use external event tables

commit 634f5fae1e1644ac324003136c66cd9c619d1c93
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 22:00:06 2018 -0700

    pmclog: update log record types, bump PMC_MAJOR
    - explicitly make log record types a multiple of 8 bytes
    - hook in pmu event types for pmc_allocate records
    - remove references to no longer PCSAMPLE record

commit 83d84fcd2d65bdf6ddcb2e155a22f0cfa2a9c225
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 21:52:10 2018 -0700

    libpmc: add support for having vendor table driven pmc_allocate

commit 9e6ad63c40c2fce8404847ace5078ca6cb33a736
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 19:11:33 2018 -0700

    hwpmc_core: add accessors for EVSEL & UMASK, make IAP_UMASK useful to user

commit 859dceb93daa6419a48c794db99b6758e5b041c9
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 19:09:45 2018 -0700

    pmcstat: update usage and man page as well as make -L consistent with pmccontrol

commit 79c7d8597e28c2eb13f5f9113e65ec2792ca57b1
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 18:07:03 2018 -0700

    pmu_util: add support for all current intel event keywords

commit d8089c7f6a6c8527f38324252b1ffb47004694c6
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 17:45:00 2018 -0700

    add description for new arguments

commit 058336740bab53c62ec88a3a026ea848cf3878c6
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 17:38:15 2018 -0700

    libpmc: move pmu_events table and pmu_utils out of libpmcstat so that they can be used by pmc_allocate

commit 049b66b382e2f833c3f47bc8df9e750cb265709f
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 16:12:41 2018 -0700

    pmcstat: hook pmu_events counter description utility routines in

commit f5e01e7b37a691dc045e1aa16b3ebdd162515de8
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 16:11:59 2018 -0700

    pmu_events: add utility routines for listing counters and their descriptions

commit cba4d4f8907f772279f86f18f915e0d74d33ac56
Author: Matt Macy <mmacy@mattmacy.io>
Date:   Fri May 25 16:09:50 2018 -0700

    pmu-events: expand out skylake regex to simplify string matches
2018-05-26 18:12:50 +00:00
Marcelo Araujo
13ee81bed5 We don't need check if str is NULL as free(3) will handle NULL
argument.

Reported by:	kib@
2018-05-25 19:12:30 +00:00
Marcelo Araujo
635a2c892c After a long discussion about assert(3), we gonna use a HardenedBSD
approach to chek strdup(3) memory allocation.

Submitted by:	Shaw Webb <shawn.webb@hardenedbsd.org>
Reported by:	brooks
Obtained from:	HardenedBSD
2018-05-25 18:54:40 +00:00
Sean Bruno
e22ee9b247 pmcstat(8)
- Document per thread filtering.

Submitted by:	kbowling
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D15549
2018-05-25 18:11:13 +00:00
Marcelo Araujo
ea089f8c71 Fix a memory leak on topology_parse().
strdup(3) allocates memory for a copy of the string, does the copy and
returns a pointer to it. If there is no sufficient memory NULL is returned
and the global errno is set to ENOMEM.
We do a sanity check to see if it was possible to allocate enough memory.

Also as we allocate memory, we need to free this memory used. Or it will
going out of scope leaks the storage it points to.

Reviewed by:	rgrimes
MFC after:	3 weeks.
X-MFC:		r332298
Sponsored by:	iXsystems Inc.
Differential Revision:	https://reviews.freebsd.org/D15550
2018-05-25 02:07:05 +00:00
Matt Macy
0a87e3ff64 pmcstat: add usage strings for -L and -I 2018-05-24 07:18:49 +00:00
Matt Macy
4bd2a4b58e pmcstat top mode + -I - use fully qualified address 2018-05-24 06:47:04 +00:00
Matt Macy
357405d985 pmcstat: don't compare signed and unsigned 2018-05-24 04:43:40 +00:00
Matt Macy
e98bbcf9ca libpmcstat: compile in events based on json description 2018-05-24 04:30:06 +00:00
Matt Macy
95104040a3 pmc: bump PMC major version to reflect ABI breakage and make warning not require verbose 2018-05-23 19:55:47 +00:00
Matt Macy
0b5dc7f64f hwpmc: add thread id field to callchain and context switch records to allow filtering
on thread in post-processing.

To generate stacks for just ${THREADID}:

pmcstat -R ${PREFIX}.pmcstat -L ${THREADID} -z100 -G ${PREFIX}.stacks

Sponsored by:	Limelight Networks
2018-05-23 17:25:00 +00:00
Eitan Adler
c739854c38 mpsutil: correct style
Reported by:	bapt
2018-05-23 09:46:21 +00:00
Marcelo Araujo
5f4c83abf5 pthread_rwlock_unlock(3) returns 0 if successful, otherwise an error number
will be returned to indicate the error, so I'm applying an assert(3) to do
a sanity check of the return value.

Reported by:	Coverity CID: 1391235, 1193654 and 1193651
Reviewed by:	grehan
MFC after:	4 weeks.
Sponsored by:	iXsystems Inc.
Differential Revision:	https://reviews.freebsd.org/D15533
2018-05-23 09:34:51 +00:00
Eitan Adler
9059c77ef2 mpsutil: add missing braces
Obtained from:	DragonFly (c5d53f11a9510c5c79e196857a1200925fffacc8)
2018-05-23 07:38:58 +00:00
Marcelo Araujo
92046bf113 Revert: r334016
Revert for now this change, it in somehow breaks init_pci.
2018-05-22 06:02:11 +00:00
Marcelo Araujo
2d03aa5999 Include atkbdc header where there are declared the prototype functions
atkbdc_event and atkbdc_init.

MFC after:	4 weeks.
Sponsored by:	iXsystems Inc.
2018-05-22 05:21:53 +00:00
Matt Macy
821a352a77 pmcstat: add option to not decode the leaf function in top mode
-I will allow the user to see the hot instruction in question
as opposed getting the name of the function
2018-05-22 04:45:46 +00:00
Marcelo Araujo
b5e3928d6d We must free the variable str.
Spotted by:	clang's static analyzer
Submitted by:	Tom Rix <trix_juniper.net>
Reviewed by:	grehan
MFC after:	4 weeks
Sponsored by:	iXsystems Inc.
Differential Revision:	https://reviews.freebsd.org/D10009
2018-05-22 04:08:08 +00:00
Eitan Adler
d67c790d71 mtest: build with WARNS=3 2018-05-19 20:57:22 +00:00
Nathan Whitehorn
fb4f0dcae9 Use sysrc(8) in the documentation rather than echoing things to rc.conf
in order to encourage good habits.

PR:		228325
Submitted by:	Mateusz Piotrowski
MFC after:	2 weeks
2018-05-18 17:46:40 +00:00
Nathan Whitehorn
8c7de243f4 Fix math error in the computation of the free space after the last partition
on a disk. This resulted in one sector always remaining free at the end.

PR:		bin/228322
Submitted by:	Rikiya Yonemoto
MFC after:	2 weeks
2018-05-18 17:43:15 +00:00
Andrew Gallatin
b4cc08389a Teach pmcannotate about $TMPDIR and _PATH_TMP
Convert pmcannotate to using $TMPDIR and _PATH_TMP rather than hard
coding /tmp for temporary files.  Pmcannotate sometimes needs quite a
lot of space to store the output from objdump, and will fail in odd
ways if that output is truncated due to lack of space in /tmp.

Reviewed by:	jtl
Sponsored by:	Netflix
2018-05-18 14:14:04 +00:00
Rodney W. Grimes
d96ee3e017 Add missing newline to end of -c usage string .
Pointy hat:	me
Submitted by:	novel
Approved by:	bde(mentor), grehan (maintainer)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D15421
2018-05-17 12:18:41 +00:00
Ed Maste
ab6f27aac1 makefs: ANSIfy 2018-05-16 02:58:05 +00:00
Ed Maste
4fa9985611 Sort mlx5tool correctly in usr.sbin/Makefile 2018-05-16 02:51:30 +00:00
Marcelo Araujo
bc1019a238 vq_getchain() can return -1 if some descriptor(s) are invalid and prints
a diagnostic message. So we do a sanity checking on the return value
of vq_getchain().

Spotted by:	gcc49
Reviewed by:	avg
MFC after:	4 weeks
Sponsored by:	iXsystems Inc.
Differential Revision:	https://reviews.freebsd.org/D15388
2018-05-15 05:55:29 +00:00
Navdeep Parhar
36ea2fe3bf cxgbetool(8): Provide user interface for hashfilters, hardware NAT, and
other filtering related features that were recently added to the driver.

Sponsored by:	Chelsio Communications
2018-05-15 04:31:11 +00:00
Dag-Erling Smørgrav
202ec22078 If the sole non-option command line argument is "none", remove any
pre-existing forwarder configuration and set Unbound up to recurse.

PR:		222902
MFC after:	1 week
2018-05-12 18:07:53 +00:00
Dag-Erling Smørgrav
b70d78d6e8 Rename all Unbound binaries and man pages from unbound* to local-unbound*.
PR:		222902
2018-05-12 17:10:36 +00:00
Ed Maste
09e24fbe18 cpucontrol: improve Intel microcode revision check
According to the Intel SDM (Volme 3, 9.11.7) the BIOS signature MSR
should be zeroed before executing cpuid (although in practice it does
not seem to matter).

PR:		192487
Submitted by:	Dan Lukes
Reported by:	Henrique de Moraes Holschuh
MFC after:	3 days
2018-05-12 15:34:35 +00:00
Dag-Erling Smørgrav
65b390aa03 Upgrade Unbound to 1.6.2. More to follow. 2018-05-12 14:15:39 +00:00
Dag-Erling Smørgrav
d7d1dffb61 Upgrade Unbound to 1.6.1. More to follow. 2018-05-12 14:04:30 +00:00