aboutsummaryrefslogtreecommitdiff
path: root/lib/libkvm/kvm_private.c
Commit message (Collapse)AuthorAgeFilesLines
* Always use 64-bit physical addresses for dump_avail[] in minidumpsMark Johnston2020-12-031-18/+4
| | | | | | | | | | | | | | | | | | | | | | As of r365978, minidumps include a copy of dump_avail[]. This is an array of vm_paddr_t ranges. libkvm walks the array assuming that sizeof(vm_paddr_t) is equal to the platform "word size", but that's not correct on some platforms. For instance, i386 uses a 64-bit vm_paddr_t. Fix the problem by always dumping 64-bit addresses. On platforms where vm_paddr_t is 32 bits wide, namely arm and mips (sometimes), translate dump_avail[] to an array of uint64_t ranges. With this change, libkvm no longer needs to maintain a notion of the target word size, so get rid of it. This is a no-op on platforms where sizeof(vm_paddr_t) == 8. Reviewed by: alc, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27082 Notes: svn path=/head/; revision=368307
* Sparsify the vm_page_dump bitmapD Scott Phillips2020-09-211-7/+79
| | | | | | | | | | | | | | | | | | | On Ampere Altra systems, the sparse population of RAM within the physical address space causes the vm_page_dump bitmap to be much larger than necessary, increasing the size from ~8 Mib to > 2 Gib (and overflowing `int` for the size). Changing the page dump bitmap also changes the minidump file format, so changes are also necessary in libkvm. Reviewed by: jhb Approved by: scottl (implicit) MFC after: 1 week Sponsored by: Ampere Computing, Inc. Differential Revision: https://reviews.freebsd.org/D26131 Notes: svn path=/head/; revision=365978
* Partially revert VNET change and expand VNET structure.Bjoern A. Zeeb2020-02-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Revert parts of r353274 replacing vnet_state with a shutdown flag. Not having the state flag for the current SI_SUB_* makes it harder to debug kernel or module panics related to VNET bringup or teardown. Not having the state also does not allow us to check for other dependency levels between components, e.g. for moving interfaces. Expand the VNET structure with the new boolean flag indicating that we are doing a shutdown of a given vnet and update the vnet magic cookie for the change. Update libkvm to compile with a bool in the kernel struct. Bump __FreeBSD_version for (external) module builds to more easily detect the change. Reviewed by: hselasky MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D23097 Notes: svn path=/head/; revision=358020
* kvm: fix types for cross-debuggingEd Maste2019-11-081-7/+7
| | | | | | | | | | | | | | | | | As with other libkvm interfaces use maximum-sized types to support cross-debugging (e.g. a 64-bit vmcore on a 32-bit host). See https://lists.freebsd.org/pipermail/svn-src-all/2019-February/176051.html for further discussion. This is an API-breaking change, but there are few consumers of this interface today. Reviewed by: will Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21945 Notes: svn path=/head/; revision=354543
* Add powerpc support to libkvm probe functionLeandro Lupori2019-09-101-1/+2
| | | | | | | | | | PowerPC kernels are of DYN type, instead of EXEC. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D21583 Notes: svn path=/head/; revision=352175
* libkvm: fix build failuresWill Andrews2017-11-121-5/+6
| | | | Notes: svn path=/head/; revision=325732
* libkvm: fix 'index' shadowing.Will Andrews2017-11-121-13/+13
| | | | Notes: svn path=/head/; revision=325729
* libkvm: add kvm_walk_pages API.Will Andrews2017-11-111-7/+141
| | | | | | | | | | | | | | | | | | | | This API allows callers to enumerate all known pages, including any direct map & kernel map virtual addresses, physical addresses, size, offset into the core, & protection configured. For architectures that support direct map addresses, also generate pages for any direct map only addresses that are not associated with kernel map addresses. Fix page size portability issue left behind from previous kvm page table lookup interface. Reviewed by: jhb Sponsored by: Backtrace I/O Differential Revision: https://reviews.freebsd.org/D12279 Notes: svn path=/head/; revision=325728
* Renumber copyright clause 4Warner Losh2017-02-281-1/+1
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* Fix memory leak.Gleb Smirnoff2016-12-201-0/+1
| | | | | | | | CID: 1367751 Reviewed by: jhb Notes: svn path=/head/; revision=310337
* libkvm: Improve physical address lookup scaling.Will Andrews2016-07-181-50/+156
| | | | | | | | | | | | | | | | | | | | | | | | Instead of using a hash table to convert physical page addresses to offsets in the sparse page array, cache the number of bits set for each 4MB chunk of physical pages. Upon lookup, find the nearest cached population count, then add/subtract the number of bits from that point to the page's PTE bit. Then multiply by page size and add to the sparse page map's base offset. This replaces O(n) worst-case lookup with O(1) (plus a small number of bits to scan in the bitmap). Also, for a 128GB system, a typical kernel core of about 8GB will now only require ~4.5MB of RAM for this approach instead of ~48MB as with the hash table. More concretely, /usr/sbin/crashinfo against the same core improves from a max RSS of 188MB and wall time of 43.72s (33.25 user 2.94 sys) to 135MB and 9.43s (2.58 user 1.47 sys). Running "thread apply all bt" in kgdb has a similar RSS improvement, and wall time drops from 4.44s to 1.93s. Reviewed by: jhb Sponsored by: Backtrace I/O Notes: svn path=/head/; revision=302976
* libkvm: Put private kvm routines in kvm_private.c.Will Andrews2016-07-181-0/+525
Notes: svn path=/head/; revision=302974