aboutsummaryrefslogtreecommitdiff
path: root/lib/libkvm/kvm_pcpu.c
Commit message (Collapse)AuthorAgeFilesLines
* lib: Automated cleanup of cdefs and other formattingWarner Losh2023-11-271-1/+0
| | | | | | | | | | | | | | | | 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
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* libkvm: catch up with pre-subtracated per-cpu addressesMateusz Guzik2020-10-061-0/+29
| | | | | | | | | Only concerns amd64. Reported by: imp Notes: svn path=/head/; revision=366468
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. 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. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* lib: minor spelling fixes in comments.Pedro F. Giffuni2016-05-011-1/+1
| | | | | | | No functional change. Notes: svn path=/head/; revision=298896
* Add support to libkvm for reading vmcores from other architectures.John Baldwin2015-11-271-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add a kvaddr_type to represent kernel virtual addresses instead of unsigned long. - Add a struct kvm_nlist which is a stripped down version of struct nlist that uses kvaddr_t for n_value. - Add a kvm_native() routine that returns true if an open kvm descriptor is for a native kernel and memory image. - Add a kvm_open2() function similar to kvm_openfiles(). It drops the unused 'swapfile' argument and adds a new function pointer argument for a symbol resolving function. Native kernels still use _fdnlist() from libc to resolve symbols if a resolver function is not supplied, but cross kernels require a resolver. - Add a kvm_nlist2() function similar to kvm_nlist() except that it uses struct kvm_nlist instead of struct nlist. - Add a kvm_read2() function similar to kvm_read() except that it uses kvaddr_t instead of unsigned long for the kernel virtual address. - Add a new kvm_arch switch of routines needed by a vmcore backend. Each backend is responsible for implementing kvm_read2() for a given vmcore format. - Use libelf to read headers from ELF kernels and cores (except for powerpc cores). - Add internal helper routines for the common page offset hash table used by the minidump backends. - Port all of the existing kvm backends to implement a kvm_arch switch and to be cross-friendly by using private constants instead of ones that vary by platform (e.g. PAGE_SIZE). Static assertions are present when a given backend is compiled natively to ensure the private constants match the real ones. - Enable all of the existing vmcore backends on all platforms. This means that libkvm on any platform should be able to perform KVA translation and read data from a vmcore of any platform. Tested on: amd64, i386, sparc64 (marius) Differential Revision: https://reviews.freebsd.org/D3341 Notes: svn path=/head/; revision=291406
* Remove trailing whitespace.John Baldwin2015-11-261-1/+1
| | | | Notes: svn path=/head/; revision=291372
* Add kvm_getncpus() to obtain mp_ncpus.Gleb Smirnoff2014-02-121-0/+10
| | | | | | | Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=261805
* While it isn't too late and kvm_read_zpcpu() function isn't yet usedGleb Smirnoff2014-02-121-2/+2
| | | | | | | | | | outside libkvm(3), change its order of arguments, so that it is the same as in kvm_read(). Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=261796
* Revert r256514 for libkvm. It wasn't correct actually and breaks build.Gleb Smirnoff2013-10-151-3/+1
| | | | Notes: svn path=/head/; revision=256539
* - While we are spreading the counter(9) across network stack, more userlandGleb Smirnoff2013-10-151-1/+3
| | | | | | | | | | | | tools would need to know about the counter_u64_t type. Allow to include sys/counter.h from userspace. - Utilize now defined type in kvm_counter_u64_fetch(). Sponsored by: Netflix Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=256514
* o Provide function kvm_read_zpcpu() to access UMA_ZONE_PCPU allocations.Gleb Smirnoff2013-04-101-3/+48
| | | | | | | | | o Provide function kvm_counter_u64_fetch() to fetch valut of a counter(9). Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=249344
* Completely remove now unused pc_other_cpus, pc_cpumask.Attilio Rao2011-07-041-29/+2
| | | | | | | Tested by: pluknet Notes: svn path=/projects/largeSMP/; revision=223756
* Revert r222363, as bde@ pointed out the initial solution was far moreAttilio Rao2011-05-311-1/+1
| | | | | | | correct. Notes: svn path=/projects/largeSMP/; revision=222547
* Style fix: cast to size_t rather than u_long when comparing to sizeof()Attilio Rao2011-05-271-1/+1
| | | | | | | | | rets. Requested by: kib Notes: svn path=/projects/largeSMP/; revision=222363
* In the near future cpuset_t objects in struct pcpu will be axed out, butAttilio Rao2011-05-271-2/+29
| | | | | | | | | | | as long as this does not happen, we need to fix interfaces to userland in order to not break run-time accesses to the structure. Reviwed by: kib Tested by: pluknet Notes: svn path=/projects/largeSMP/; revision=222360
* libkvm code janitoringUlrich Spörlein2011-01-231-11/+10
| | | | | | | | | | | | | | | - make WARNS=6 clean for archs w/o strict alignment requirments - add const, ANSIfy, remove unused vars, cast types for comparison - thanks to differing definitions of VM_MIN_ADDRESS across our archs, we need to trick the compiler to not complain about signedness. We could either fix VM_MIN_ADDRESS to always be a simple integer or make the check conditional on $ARCH. Closes PRs: kern/42386, kern/83364 Reviewed by: bde Notes: svn path=/head/; revision=217744
* Similar to sys/net/vnet.h, define the linker set name for sys/sys/pcpu.hDimitry Andric2010-11-141-2/+2
| | | | | | | as a macro, and use it instead of literal strings. Notes: svn path=/head/; revision=215315
* A first cut at teaching libkvm how to deal with dynamic per-CPU storageRobert Watson2010-03-011-0/+140
| | | | | | | | | | | | | | | | | | | | (DPCPU): A new API, kvm_dpcpu_setcpu(3), selects the active CPU for the purposes of DPCPU. Calls to kvm_nlist(3) will automatically translate DPCPU symbols and return a pointer to the current CPU's version of the data. Consumers needing to read the same symbol on several CPUs will invoke a series of setcpu/nlist calls, one per CPU of interest. This addition makes it possible for tools like netstat(1) to query the values of DPCPU variables during crashdump analysis, and is based on similar code handling virtualized global variables. MFC after: 1 week Sponsored by: Juniper Networks, Inc. Notes: svn path=/head/; revision=204494
* Add two new routines to libkvm for working with per-CPU data:John Baldwin2008-08-191-0/+152
kvm_getmaxcpu() and kvm_getpcpu(). MFC after: 1 week Notes: svn path=/head/; revision=181876