summaryrefslogtreecommitdiff
path: root/sys/compat/linprocfs
Commit message (Collapse)AuthorAgeFilesLines
* Make MAXPHYS tunable. Bump MAXPHYS to 1M.Konstantin Belousov2020-11-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace MAXPHYS by runtime variable maxphys. It is initialized from MAXPHYS by default, but can be also adjusted with the tunable kern.maxphys. Make b_pages[] array in struct buf flexible. Size b_pages[] for buffer cache buffers exactly to atop(maxbcachebuf) (currently it is sized to atop(MAXPHYS)), and b_pages[] for pbufs is sized to atop(maxphys) + 1. The +1 for pbufs allow several pbuf consumers, among them vmapbuf(), to use unaligned buffers still sized to maxphys, esp. when such buffers come from userspace (*). Overall, we save significant amount of otherwise wasted memory in b_pages[] for buffer cache buffers, while bumping MAXPHYS to desired high value. Eliminate all direct uses of the MAXPHYS constant in kernel and driver sources, except a place which initialize maxphys. Some random (and arguably weird) uses of MAXPHYS, e.g. in linuxolator, are converted straight. Some drivers, which use MAXPHYS to size embeded structures, get private MAXPHYS-like constant; their convertion is out of scope for this work. Changes to cam/, dev/ahci, dev/ata, dev/mpr, dev/mpt, dev/mvs, dev/siis, where either submitted by, or based on changes by mav. Suggested by: mav (*) Reviewed by: imp, mav, imp, mckusick, scottl (intermediate versions) Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D27225 Notes: svn path=/head/; revision=368124
* linprocfs(5): Add rudimentary /proc/<pid>/mountinfoConrad Meyer2020-11-171-43/+163
| | | | | | | | | | This is used by some Linux programs using filehandles (r367773) to locate the mountpoint for a given fsid. Differential Revision: https://reviews.freebsd.org/D27136 Notes: svn path=/head/; revision=367775
* Add sbuf streaming mode to pseudofs(9), use in linprocfs(5)Conrad Meyer2020-11-051-5/+1
| | | | | | | | | | | | | | | | | Add a pseudofs node flag 'PFS_AUTODRAIN', which automatically emits sbuf contents to the caller when the sbuf buffer fills. This is only permissible if the corresponding PFS node fill function can sleep whenever it appends to the sbuf. linprocfs' /proc/self/maps node happens to meet this requirement. Streaming out the file as it is composed avoids truncating the output and also avoids preallocating a very large buffer. Reviewed by: markj; earlier version: emaste, kib, trasz Differential Revision: https://reviews.freebsd.org/D27047 Notes: svn path=/head/; revision=367362
* Make linprocfs(4) print a warning when there's not enough room to fillEdward Tomasz Napierala2020-10-291-0/+4
| | | | | | | | | | | | | /proc/self/maps. Submitted by: dchagin (earlier version) Reviewed by: emaste (earlier version) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20576 Notes: svn path=/head/; revision=367139
* Add /proc/sys/kernel/ngroups_max to linprocfs(4). The id(1) commandEdward Tomasz Napierala2020-10-231-0/+15
| | | | | | | | | | | seems to use it - it works fine without it, but still. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26898 Notes: svn path=/head/; revision=366966
* Fix linprocfs(4) /proc/self/mem semantics to more closely match Linux.Edward Tomasz Napierala2020-10-201-1/+22
| | | | | | | | | | | | | | Steam's Anti-Cheat might depend on it. PR: 248223 Analyzed by: Alex S <iwtcex@gmail.com> Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26816 Notes: svn path=/head/; revision=366900
* With some popular multiplayer games (such as Counter-Strike: GlobalEdward Tomasz Napierala2020-10-151-1/+1
| | | | | | | | | | | | | | Offensive) the Linux Steam client likes to occasionally scan the game process memory, presumably as part anti-cheat measures. Turns out the client also expects each inode entry to be followed by a space character, otherwise the parsing code crashes. PR: 248216 Submitted by: Alex S <iwtcex@gmail.com> MFC after: 2 weeks Notes: svn path=/head/; revision=366722
* compat: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-1/+0
| | | | Notes: svn path=/head/; revision=365080
* cache: drop the always curthread argument from reverse lookup routinesMateusz Guzik2020-08-241-4/+4
| | | | | | | | | Note VOP_VPTOCNP keeps getting it as temporary compatibility for zfs. Tested by: pho Notes: svn path=/head/; revision=364633
* linprocfs: Fix some inaccuracies in meminfo.Mark Johnston2020-08-121-23/+17
| | | | | | | | | | | | | | | | - Fill out MemFree correctly. Delete an ancient comment suggesting that we don't want to advertise the true quantity of free memory. - Populate the Buffers field by reading vfs.bufspace. - The page cache consists of all pages in page queues, not just the inactive queue. PR: 248463 Reported and tested by: danfe MFC after: 1 week Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=364168
* Add missing SysV IPC stats to linprocfs(4). Fixes 'ipcs -l',Edward Tomasz Napierala2020-07-181-0/+68
| | | | | | | | | | | and also helps Oracle. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25669 Notes: svn path=/head/; revision=363303
* Fix bogomips calculation. Previously it was off by half. This wasEdward Tomasz Napierala2020-07-181-1/+1
| | | | | | | | | | | | | verified under VMWare Fusion, comparing to what's reported under CentOS, and by comparing numbers reported by linuxulator on T420 with a googled up Linux cpuinfo (https://lkml.org/lkml/2011/11/29/116). MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20693 Notes: svn path=/head/; revision=363302
* Fix two typos in flag names in /proc/cpuinfo.Edward Tomasz Napierala2020-07-181-2/+2
| | | | | | | | | MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25695 Notes: svn path=/head/; revision=363301
* Make linprocfs(5) report correct tty number in /proc/<PID>/stat.Edward Tomasz Napierala2020-07-111-4/+29
| | | | | | | | | | | | | Fixes sudo (sudo-1.8.21p2-3ubuntu1.2); previously would fail with "sudo: no tty present and no askpass program specified". Reviewed by: kib, emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25588 Notes: svn path=/head/; revision=363094
* Add /proc/sys/kernel/tainted to linprocfs(5). Helps LTP.Edward Tomasz Napierala2020-07-041-0/+13
| | | | | | | | | MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25556 Notes: svn path=/head/; revision=362930
* Make linprocfs(5) create /proc/bus/pci/devices/, and linsysfs(5)Edward Tomasz Napierala2020-07-041-0/+5
| | | | | | | | | | | | | create /sys/class/power_supply/. This silences some warnings from biology/linux-foldingathome. Reported by: 0mp MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25557 Notes: svn path=/head/; revision=362929
* Make linprocfs(5) create the /proc/<PID>/task/ directores.Edward Tomasz Napierala2020-06-301-0/+27
| | | | | | | | | | | | | This is to silence down some Chromium assertions. PR: kern/240991 Analyzed by: Alex S <iwtcex@gmail.com> MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25256 Notes: svn path=/head/; revision=362806
* fd: move vnodes out of filedesc into a dedicated structureMateusz Guzik2020-03-011-20/+8
| | | | | | | | | | | | | | | | The new structure is copy-on-write. With the assumption that path lookups are significantly more frequent than chdirs and chrooting this is a win. This provides stable root and jail root vnodes without the need to reference them on lookup, which in turn means less work on globally shared structures. Note this also happens to fix a bug where jail vnode was never referenced, meaning subsequent access on lookup could run into use-after-free. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D23884 Notes: svn path=/head/; revision=358503
* linprocfs: Fix some bugs in the maps file implementation.Mark Johnston2020-01-081-5/+9
| | | | | | | | | | | | | | | | | | | - Export the offset into the backing object, not the object size. - Fix a bug where we would print the previous entry's "offset" when a map_entry has no object. - Try to identify shared mappings. Linux prints "s" when the mapping "may be shared". This attempt is not perfect, for example, we print "p" for anonymous memory that may be shared via minherit(INHERIT_SHARE). PR: 240992 Reviewed by: kib MFC after: 1 week MFC note: no OBJ_ANON in stable/12 Differential Revision: https://reviews.freebsd.org/D23062 Notes: svn path=/head/; revision=356494
* Make linprocfs(5) provide an empty /proc/modules. This should silenceEdward Tomasz Napierala2019-12-291-4/+2
| | | | | | | | | | some warnings. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=356175
* linprocfs: Make sure to report -1 as tty when we have no controlling tty.Olivier Houchard2019-11-111-1/+4
| | | | | | | | | | | | When reporting a process' stats, we can't just provide the tty as an unsigned long, as if we have no controlling tty, the tty would be NODEV, or -1. Instaed, just special-case NODEV. Submitted by: Juraj Lutter <otis@sk.FreeBSD.org> MFC after: 1 week Notes: svn path=/head/; revision=354602
* Define macro VM_MAP_ENTRY_FOREACH for enumerating the entries in a vm_map.Doug Moore2019-10-081-2/+1
| | | | | | | | | | | | | | | | | In case the implementation ever changes from using a chain of next pointers, then changing the macro definition will be necessary, but changing all the files that iterate over vm_map entries will not. Drop a counter in vm_object.c that would have an effect only if the vm_map entry count was wrong. Discussed with: alc Reviewed by: markj Tested by: pho (earlier version) Differential Revision: https://reviews.freebsd.org/D21882 Notes: svn path=/head/; revision=353298
* Fix /proc/mounts for autofs(5) mounts.Edward Tomasz Napierala2019-09-041-0/+9
| | | | | | | | MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=351822
* Make linprocfs(4) report Tgid, Linux ltrace(1) needs it.Edward Tomasz Napierala2019-09-031-0/+1
| | | | | | | | MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=351758
* Decode more CPU flags in cpuinfo.Edward Tomasz Napierala2019-05-031-13/+76
| | | | | | | | | | Reviewed by: dchagin MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20145 Notes: svn path=/head/; revision=347051
* Fix flags in cpuinfo.Edward Tomasz Napierala2019-05-021-6/+6
| | | | | | | | | | Reviewed by: dchagin MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20139 Notes: svn path=/head/; revision=347030
* Fix output of linprocfs stat entryChuck Tuffli2018-06-221-5/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Linux /proc/stat entry has grown over time v2.5.41 < user, nice, system, idle v2.5.41 user, nice, system, idle, iowait, irq v2.6.11 user, nice, system, idle, iowait, irq, softirq, steal v2.6.24 user, nice, system, idle, iowait, irq, softirq, steal, guest v2.6.32 > user, nice, system, idle, iowait, irq, softirq, steal, guest, guest_nice Some applications (e.g. nodejs) depend on the correct number of entries and will abort otherwise. Fix is to print the correct number of entries based on the value of osrelease set either in sysctl or the jail settings. Change is similar to approach used by illumos. Reviewed by: emaste, imp (mentor) Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D15858 Notes: svn path=/head/; revision=335516
* Add linprocfs support for min_free_kbytesChuck Tuffli2018-06-151-2/+23
| | | | | | | | | | | | | This adds linprocfs support for proc/sys/vm/min_free_kbytes which the free program requires for correct operation. The approach mirrors the approach used in illumos. Reviewed by: imp (mentor), emaste Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D15563 Notes: svn path=/head/; revision=335205
* linprocfs: add TracerPid to /proc/pid/status.Konstantin Belousov2018-06-151-2/+2
| | | | | | | | | | Also fix the value of parent pid if the process is traced. Submitted by: Yanko Yankulov <yanko.yankulov@gmail.com> MFC after: 1 week Notes: svn path=/head/; revision=335199
* Add stubbed arm64 linuxulator /proc/cpuinfo handlerEd Maste2018-06-151-1/+27
| | | | | | | Sponsored by: Turing Robotic Industries Notes: svn path=/head/; revision=335198
* UDP: further performance improvements on txMatt Macy2018-05-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cumulative throughput while running 64 netperf -H $DUT -t UDP_STREAM -- -m 1 on a 2x8x2 SKL went from 1.1Mpps to 2.5Mpps Single stream throughput increases from 910kpps to 1.18Mpps Baseline: https://people.freebsd.org/~mmacy/2018.05.11/udpsender2.svg - Protect read access to global ifnet list with epoch https://people.freebsd.org/~mmacy/2018.05.11/udpsender3.svg - Protect short lived ifaddr references with epoch https://people.freebsd.org/~mmacy/2018.05.11/udpsender4.svg - Convert if_afdata read lock path to epoch https://people.freebsd.org/~mmacy/2018.05.11/udpsender5.svg A fix for the inpcbhash contention is pending sufficient time on a canary at LLNW. Reviewed by: gallatin Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D15409 Notes: svn path=/head/; revision=334118
* Make it easier for filesystems to count themselves as jail-enabled,Jamie Gritton2018-05-041-1/+1
| | | | | | | | | | | | | | | by doing most of the work in a new function prison_add_vfs in kern_jail.c Now a jail-enabled filesystem need only mark itself with VFCF_JAIL, and the rest is taken care of. This includes adding a jail parameter like allow.mount.foofs, and a sysctl like security.jail.mount_foofs_allowed. Both of these used to be a static list of known filesystems, with predefined permission bits. Reviewed by: kib Differential Revision: D14681 Notes: svn path=/head/; revision=333263
* [procfs] Split procfs_attr into multiple functionsEitan Adler2018-04-241-1/+1
| | | | | | | | | Reviewed by: des, kib Discussed with: mmacy Differential Revision: https://reviews.freebsd.org/D15150 Notes: svn path=/head/; revision=332936
* Make v_wire_count a per-cpu counter(9) counter. This eliminates aJeff Roberson2018-02-121-1/+1
| | | | | | | | | | | | | | | significant source of cache line contention from vm_page_alloc(). Use accessors and vm_page_unwire_noq() so that the mechanism can be easily changed in the future. Reviewed by: markj Discussed with: kib, glebius Tested by: pho (earlier version) Sponsored by: Netflix, Dell/EMC Isilon Differential Revision: https://reviews.freebsd.org/D14273 Notes: svn path=/head/; revision=329187
* Use per-domain locks for vm page queue free. Move paging control fromJeff Roberson2018-02-061-2/+2
| | | | | | | | | | | | | | global to per-domain state. Protect reservations with the free lock from the domain that they belong to. Refactor to make vm domains more of a first class object. Reviewed by: markj, kib, gallatin Tested by: pho Sponsored by: Netflix, Dell/EMC Isilon Differential Revision: https://reviews.freebsd.org/D14000 Notes: svn path=/head/; revision=328954
* spdx: initial adoption of licensing ID tags.Pedro F. Giffuni2017-11-181-0/+2
| | | | | | | | | | | | | | | | | | | | 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. Initially, only tag files that use BSD 4-Clause "Original" license. RelNotes: yes Differential Revision: https://reviews.freebsd.org/D13133 Notes: svn path=/head/; revision=325966
* Fix caveat in new implementation of linprocfs_docpuinfo():Mahdi Mokhtari2017-06-231-1/+4
| | | | | | | | | | | | Prevent kernel panic in case that extended-cpuid isn't supported by CPU Reviewed by: kib, ngie, trasz Approved by: trasz MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D11294 Notes: svn path=/head/; revision=320265
* Fix linprocfs_docpuinfo() output regarding to what newer Linux apps expectMahdi Mokhtari2017-05-061-27/+71
| | | | | | | | | | Reviewed by: trasz Approved by: trasz MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D10274 Notes: svn path=/head/; revision=317884
* Remove trailing whitespace from r317061Ed Maste2017-04-171-1/+1
| | | | Notes: svn path=/head/; revision=317063
* - Remove 'struct vmmeter' from 'struct pcpu', leaving only global vmmeterGleb Smirnoff2017-04-171-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | in place. To do per-cpu stats, convert all fields that previously were maintained in the vmmeters that sit in pcpus to counter(9). - Since some vmmeter stats may be touched at very early stages of boot, before we have set up UMA and we can do counter_u64_alloc(), provide an early counter mechanism: o Leave one spare uint64_t in struct pcpu, named pc_early_dummy_counter. o Point counter(9) fields of vmmeter to pcpu[0].pc_early_dummy_counter, so that at early stages of boot, before counters are allocated we already point to a counter that can be safely written to. o For sparc64 that required a whole dummy pcpu[MAXCPU] array. Further related changes: - Don't include vmmeter.h into pcpu.h. - vm.stats.vm.v_swappgsout and vm.stats.vm.v_swappgsin changed to 64-bit, to match kernel representation. - struct vmmeter hidden under _KERNEL, and only vmstat(1) is an exclusion. This is based on benno@'s 4-year old patch: https://lists.freebsd.org/pipermail/freebsd-arch/2013-July/014471.html Reviewed by: kib, gallatin, marius, lidl Differential Revision: https://reviews.freebsd.org/D10156 Notes: svn path=/head/; revision=317061
* Add /proc/self/mounts to linprocfs; some linux binaries need it.Edward Tomasz Napierala2017-02-201-0/+2
| | | | | | | | MFC after: 2 weeks Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=313995
* Remove PG_CACHED-related fields from struct vmmeter, because they are noAlan Cox2016-11-221-1/+1
| | | | | | | | | | | | | | longer used. More precisely, they are always zero because the code that decremented and incremented them no longer exists. Bump __FreeBSD_version to mark this change. Reviewed by: kib, markj Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D8583 Notes: svn path=/head/; revision=309017
* linprocfs: garbage collect meminfo fields not present in linuxMateusz Guzik2016-09-161-18/+2
| | | | | | | | In particular memshared not only does not exist in linux, it was extremely expensive to calculate. Notes: svn path=/head/; revision=305856
* Remove 'cpu' and 'cpu_class' on amd64.John Baldwin2016-09-151-29/+2
| | | | | | | | | | | | The 'cpu' and 'cpu_class' variables were always set to the same value on amd64 and are legacy holdovers from i386. Remove them entirely on amd64. Reviewed by: imp, kib (older version) Differential Revision: https://reviews.freebsd.org/D7888 Notes: svn path=/head/; revision=305836
* Hide the boottime and bootimebin globals, provide the getboottime(9)Konstantin Belousov2016-07-271-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | and getboottimebin(9) KPI. Change consumers of boottime to use the KPI. The variables were renamed to avoid shadowing issues with local variables of the same name. Issue is that boottime* should be adjusted from tc_windup(), which requires them to be members of the timehands structure. As a preparation, this commit only introduces the interface. Some uses of boottime were found doubtful, e.g. NLM uses boottime to identify the system boot instance. Arguably the identity should not change on the leap second adjustment, but the commit is about the timekeeping code and the consumers were kept bug-to-bug compatible. Tested by: pho (as part of the bigger patch) Reviewed by: jhb (same) Discussed with: bde Sponsored by: The FreeBSD Foundation MFC after: 1 month X-Differential revision: https://reviews.freebsd.org/D7302 Notes: svn path=/head/; revision=303382
* swap_dev_info() does not require Giant, so Giant locking aroundKonstantin Belousov2016-06-121-4/+2
| | | | | | | | | | | | | the loop in linprocfs_doswaps() is useless. List of the registered filesystems is protected by vfsconf_sx, not by the Giant. Adjust linprocfs_dofilesystems() correspondingly. Approved by: re (delphij), des (linprocfs maintainer) Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=301838
* linprocfs_doproclimits: Initialize error return before useConrad Meyer2016-04-201-0/+2
| | | | | | | | | Reported by: Coverity CID: 1354623 Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=298319
* linprocfs: Don't print uninitialized valuesConrad Meyer2016-04-201-2/+3
| | | | | | | | | Reported by: Coverity CID: 1354624 Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=298318
* Cleanup unnecessary semicolons from the kernel.Pedro F. Giffuni2016-04-101-1/+1
| | | | | | | Found with devel/coccinelle. Notes: svn path=/head/; revision=297793
* More complete implementation of /proc/self/limits.Dmitry Chagin2016-04-101-42/+69
| | | | | | | | | | | Fix the way the code accesses process limits struct - pointed out by mjg@. PR: 207386 Reviewed by: no objection form des@ MFC after: 3 weeks Notes: svn path=/head/; revision=297781