History log of /freebsd-current/usr.sbin/pmccontrol/pmccontrol.c
Revision Date Author Comments
# 4d65a7c6 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

usr.sbin: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# 8bd44595 05-May-2023 Mitchell Horne <mhorne@FreeBSD.org>

pmccontrol: drop Pentium 4 special case

This is dead code; we no longer support Pentium hardware in libpmc or
hwpmc.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation


# 94dcc95f 14-Mar-2023 Elyes Haouas <ehaouas@noos.fr>

pmccontrol: Remove trailing semicolon

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/654


# 167cdaa7 31-May-2021 Mitchell Horne <mhorne@FreeBSD.org>

pmccontrol: improve -L with pmu-events

Check if the pmu utils are supported rather than carrying a
machine-dependent #ifdef.

Reviewed by: gnn, ray, emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30526


# 7362ac9c 24-Sep-2018 Matt Macy <mmacy@FreeBSD.org>

restore pmccontrol -L behavior on x86

When I updated counter definition handling for x86 I broke
'pmccontrol -L' listing counter names. This just changes
pmccontrol to call the library function on x86.

PR: 230984
Approved by: re (kib@)


# 1de7b4b8 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

various: general adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.


# a301ee66 21-Apr-2016 Marcelo Araujo <araujo@FreeBSD.org>

Use macro MAX() from sys/param.h.

MFC after: 2 weeks.


# 62debcc7 22-Feb-2015 Pedro F. Giffuni <pfg@FreeBSD.org>

pmccontrol(8): Replace malloc() + memset() with calloc()

PMCC_OP_IGNORE happens to be zero, so just use calloc() here.


# bf70bece 19-Oct-2012 Ed Schouten <ed@FreeBSD.org>

More -Wmissing-variable-declarations fixes.

In addition to adding `static' where possible:

- bin/date: Move `retval' into extern.h to make it visible to date.c.
- bin/ed: Move globally used variables into ed.h.
- sbin/camcontrol: Move `verbose' into camcontrol.h and fix shadow warnings.
- usr.bin/calendar: Remove unneeded variables.
- usr.bin/chat: Make `line' local instead of global.
- usr.bin/elfdump: Comment out unneeded function.
- usr.bin/rlogin: Use _Noreturn instead of __dead2.
- usr.bin/tset: Pull `Ospeed' into extern.h.
- usr.sbin/mfiutil: Put global variables in mfiutil.h.
- usr.sbin/pkg: Remove unused `os_corres'.
- usr.sbin/quotaon, usr.sbin/repquota: Remove unused `qfname'.


# e2d0cd59 17-Dec-2011 Dimitry Andric <dim@FreeBSD.org>

In usr.sbin/pmccontrol/pmccontrol.c, fix a few warnings about format
strings not being literals.

MFC after: 1 week


# 37d6f8a9 14-Nov-2011 David E. O'Brien <obrien@FreeBSD.org>

Improve the chances of matching an outputted string with the line of code.


# 095489db 15-Jul-2011 Attilio Rao <attilio@FreeBSD.org>

Fix logical_cpus_mask retrieving by using, correctly, cpuset_t.
This fix also a bug where pmccontrol uses a 32 static type rather than
old cpumask_t.

Reported and reviewed by: avg


# 44735e89 15-Jul-2011 Andriy Gapon <avg@FreeBSD.org>

pmcstat, pmccontrol: catch up with removal of machdep.hlt_cpus sysctl

Reported by: Pan Tsu <inyaoo@gmail.com>
Reviewed by: attilio
No objections: gnn


# 1de471df 31-May-2011 Attilio Rao <attilio@FreeBSD.org>

Revert r222363, as bde@ pointed out the initial solution was far more
correct.


# d361ed4b 27-May-2011 Attilio Rao <attilio@FreeBSD.org>

Style fix: cast to size_t rather than u_long when comparing to sizeof()
rets.

Requested by: kib


# 7cafb27f 10-May-2011 Attilio Rao <attilio@FreeBSD.org>

Avoid breaking strict-aliasing.


# 2953224e 06-May-2011 Attilio Rao <attilio@FreeBSD.org>

Fix breakage.

Reported by: sbruno


# 71a19bdc 05-May-2011 Attilio Rao <attilio@FreeBSD.org>

Commit the support for removing cpumask_t and replacing it directly with
cpuset_t objects.
That is going to offer the underlying support for a simple bump of
MAXCPU and then support for number of cpus > 32 (as it is today).

Right now, cpumask_t is an int, 32 bits on all our supported architecture.
cpumask_t on the other side is implemented as an array of longs, and
easilly extendible by definition.

The architectures touched by this commit are the following:
- amd64
- i386
- pc98
- arm
- ia64
- XEN

while the others are still missing.
Userland is believed to be fully converted with the changes contained
here.

Some technical notes:
- This commit may be considered an ABI nop for all the architectures
different from amd64 and ia64 (and sparc64 in the future)
- per-cpu members, which are now converted to cpuset_t, needs to be
accessed avoiding migration, because the size of cpuset_t should be
considered unknown
- size of cpuset_t objects is different from kernel and userland (this is
primirally done in order to leave some more space in userland to cope
with KBI extensions). If you need to access kernel cpuset_t from the
userland please refer to example in this patch on how to do that
correctly (kgdb may be a good source, for example).
- Support for other architectures is going to be added soon
- Only MAXCPU for amd64 is bumped now

The patch has been tested by sbruno and Nicholas Esborn on opteron
4 x 12 pack CPUs. More testing on big SMP is expected to came soon.
pluknet tested the patch with his 8-ways on both amd64 and i386.

Tested by: pluknet, sbruno, gianni, Nicholas Esborn
Reviewed by: jeff, jhb, sbruno


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 88660748 11-Oct-2010 George V. Neville-Neil <gnn@FreeBSD.org>

Add code to print the number and type of the CPU that is present in
the system as well has how many PMCs there are per CPU. In this code
CPU and core are equivalent.

MFC after: 1 day


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# 5d09484b 15-Nov-2008 Joseph Koshy <jkoshy@FreeBSD.org>

Ignore absent CPUs when listing the current state of PMC hardware.


# 35cf650f 09-Nov-2008 Joseph Koshy <jkoshy@FreeBSD.org>

Change the meaning of a "*" argument to option -c to mean 'all
unhalted CPUs', instead of 'all CPUs'. This change brings
pmccontrol(8) in line with pmcstat(8).


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 5943a2a3 27-Feb-2006 Joseph Koshy <jkoshy@FreeBSD.org>

Fix pmccontrol(8) on Intel Xeon's running in 64 bit mode.

PR: kern/93773


# f35f2fc8 28-Sep-2005 Joseph Koshy <jkoshy@FreeBSD.org>

The 'intr_bufferfull' driver statistic actually counts the number
of times sampling was stopped due to a space shortage; change its
description in the output of `pmcstat -s` to match reality.

MFC after: 3 days


# 9798d180 24-Jun-2005 Joseph Koshy <jkoshy@FreeBSD.org>

Sync the usage message with the code.

Approved by: re (hwpmc blanket)
Pointed out by: ru


# f263522a 09-Jun-2005 Joseph Koshy <jkoshy@FreeBSD.org>

MFP4:

- Implement sampling modes and logging support in hwpmc(4).

- Separate MI and MD parts of hwpmc(4) and allow sharing of
PMC implementations across different architectures.
Add support for P4 (EMT64) style PMCs to the amd64 code.

- New pmcstat(8) options: -E (exit time counts) -W (counts
every context switch), -R (print log file).

- pmc(3) API changes, improve our ability to keep ABI compatibility
in the future. Add more 'alias' names for commonly used events.

- bug fixes & documentation.


# c5153e19 01-May-2005 Joseph Koshy <jkoshy@FreeBSD.org>

Add convenience APIs pmc_width() and pmc_capabilities() to -lpmc.
Have pmcstat(8) and pmccontrol(8) use these APIs.

Return PMC class-related constants (PMC widths and capabilities)
with the OP GETCPUINFO call leaving OP PMCINFO to return only the
dynamic information associated with a PMC (i.e., whether enabled,
owner pid, reload count etc.).

Allow pmc_read() (i.e., OPS PMCRW) on active self-attached PMCs to
get upto-date values from hardware since we can guarantee that the
hardware is running the correct PMC at the time of the call.

Bug fixes:
- (x86 class processors) Fix a bug that prevented an RDPMC
instruction from being recognized as permitted till after the
attached process had context switched out and back in again after
a pmc_start() call.

Tighten the rules for using RDPMC class instructions: a GETMSR
OP is now allowed only after an OP ATTACH has been done by the
PMC's owner to itself. OP GETMSR is not allowed for PMCs that
track descendants, for PMCs attached to processes other than
their owner processes.

- (P4/HTT processors only) Fix a bug that caused the MI and MD
layers to get out of sync. Add a new MD operation 'get_config()'
as part of this fix.

- Allow multiple system-mode PMCs at the same row-index but on
different CPUs to be allocated.

- Reject allocation of an administratively disabled PMC.

Misc. code cleanups and refactoring. Improve a few comments.


# ebccf1e3 18-Apr-2005 Joseph Koshy <jkoshy@FreeBSD.org>

Bring a working snapshot of hwpmc(4), its associated libraries, userland utilities
and documentation into -CURRENT.

Bump FreeBSD_version.

Reviewed by: alc, jhb (kernel changes)