summaryrefslogtreecommitdiff
path: root/sys/src/9/mtx
AgeCommit message (Collapse)Author
2022-08-17kernel: allocate notes in heapcinap_lenrek
de-bloat the proc structure by allocating notes with on the heap instead of embedding them in the proc structure. This saves around 640 bytes per process.
2022-08-17kernel: simplify notify() adding common popnote() functioncinap_lenrek
Handlin notes is common for all architectures except how the note has to be pushed on the user stack. This change adds a popnote() function that returns only the note string or nil if the process should not be notified (no notes or user notes hold off). Popnote() also handles common errors like notify during note handling or missing note handler and will suicide the process in that case.
2025-05-14kernel: get rid of Proc.kstackglenda
The kernel stack is now above the Proc structure, so the explicit kstack pointer can be eliminated.
2022-08-129: compute available kernel pages using sizeof(Proc*)Ori Bernstein
procs come from the dynamic pools, so we don't need to remove the memory used by possible procs from the total available.
2022-08-109/port: allow kiloprocs -- allocate procs lazilyOri Bernstein
Treallocate the small data structures around procs eagerly, but use malloc to allocate the large proc data structures when we need them, which allows us to scale to many more procs. There are still many scalability bottlenecks, so we only crank up the nproc limit by a little bit this time around, and crank it up more as we optimize more.
2022-01-16kernel: make Page.txtflush into an arraycinap_lenrek
To avoid a MAXMACH limit of 32 and make txtflush into an array for the bitmap. Provide portable macros for testing and clearing the bits: needtxtflush(), donetxtflush(). On pc/pc64, define inittxtflush()/settxtflush() as no-op macros, avoiding the storage overhead of the txtflush array alltogether.
2021-12-13devssl, cpu, import, oexportfs: deleteOri Bernstein
SSL is implemented by devssl. It's extremely obsolete by now, and is not used anywhere but cpu, import, and oexportfs. This change strips out the devssl bits, but does not (yet) remove the code from libsec.
2021-10-11kernel: move waserror() macro to port/portfns.hcinap_lenrek
2021-04-25kernel: clean up Mach structurecinap_lenrek
Remove unused fields and factor common fields into a new PMach struct in port/portdat.h. The fields machno, splpc and proc are not moved to PMach as they are part of the known offsets from assembly (l.s).
2021-03-01devpccard, pci: fix pccard support and handle pci expansion romscinap_lenrek
let pci.c deal with the special cardbus controller bar0 and expansion roms. handle apic interrupt routing for devices behind a cardbus slot. do not free the pcidev on card removal, as the drivers most certanly are not prepared to handle this yet. instead, we provide a pcidevfree() function that just unlinks the device from pcilist and the parent bridge.
2020-12-20kernel: handle tos and per process pcycle counters in port/cinap_lenrek
we might as well handle the per process cycle counter in the portable part instead of duplicating the code in every arch and have inconsistent implementations. we now have a portable kenter() and kexit() function, that is ment to be used in trap/syscall from user, which updates the counters. some kernels missed initializing Mach.cyclefreq.
2020-11-03pc, pc64: allocate i/o port space for unassigned pci bars, move ioalloc() to ↵cinap_lenrek
port/iomap.c With some newer UEFI firmware, not all pci bars get programmed and we have to assign them ourselfs. This was already done for memory bars. This change adds the same for i/o port space, by providing a ioreservewin() function which can be used to allocate port space within the parent pci-pci bridge window. Also, the pci code now allocates the pci config space i/o ports 0xCF8/0xCFC so userspace needs to use devpnp to access pci config space now. (see latest realemu change). Also, this moves the ioalloc()/iofree() code out of devarch into port/iomap.c as it can be shared with the ppc mtx kernel.
2020-11-02mtx: fix pci access routines (see changeset 8012:78891f472fbf)cinap_lenrek
2020-09-13kernel: massive pci code rewritecinap_lenrek
The new pci code is moved to port/pci.[hc] and shared by all ports. Each port has its own PCI controller implementation, providing the pcicfgrw*() functions for low level pci config space access. The locking for pcicfgrw*() is now done by the caller (only port/pci.c). Device drivers now need to include "../port/pci.h" in addition to "io.h". The new code now checks bridge windows and membars, while enumerating the bus, giving the pc driver a chance to re-assign them. This is needed because some UEFI implementations fail to assign the bars for some devices, so we need to do it outselfs. (See pcireservemem()). While working on this, it was discovered that the pci code assimed the smallest I/O bar size is 16 (pcibarsize()), which is wrong. I/O bars can be as small as 4 bytes. Bit 1 in an I/O bar is also reserved and should be masked off, making the port mask: port = bar & ~3;
2020-04-04mtx, ppc: use proctab() to index into process tablecinap_lenrek
2020-02-02kernel: cleanup makefile for $CONF.$O targetcinap_lenrek
2020-01-26kernel: implement portable userinit() and simplify process creationcinap_lenrek
replace machine specific userinit() by a portable implemntation that uses kproc() to create the first process. the initcode text is mapped using kmap(), so there is no need for machine specific tmpmap() functions. initcode stack preparation should be done in init0() where the stack is mapped and can be accessed directly. replacing the machine specific userinit() allows some big simplifications as sysrfork() and kproc() are now the only callers of newproc() and we can avoid initializing fields that we know are being initialized by these callers. rename autogenerated init.h and reboot.h headers. the initcode[] and rebootcode[] blobs are now in *.i files and hex generation was moved to portmkfile. the machine specific mkfile only needs to specify how to build rebootcode.out and initcode.out.
2019-08-27kernel: catch execution read fault on SG_NOEXEC segmentcinap_lenrek
fault() now has an additional pc argument that is used to detect fault on a non-executable segment. that is, we check on read fault if the segment has the SG_NOEXEC attribute and the program counter is within faulting page.
2019-08-26kernel: expose no execute bit to portable mmu code as SG_NOEXEC / PTENOEXEC, ↵cinap_lenrek
add PTECACHED bits a portable SG_NOEXEC segment attribute was added to allow non-executable (physical) segments. which will set the PTENOEXEC bits for putmmu(). in the future, this can be used to make non-executable stack / bss segments. the SG_DEVICE attribute was added to distinguish between mmio regions and uncached memory. only matterns on arm64. on arm, theres the issue that PTEUNCACHED would have no bits set when using the hardware bit definitions. this is the reason bcm, kw, teg2 and omap kernels use arteficial PTE constants. on zynq, the XN bit was used as a hack to give PTEUNCACHED a non-zero value and when the bit is clear then cache attributes where added to the pte. to fix this, PTECACHED constant was added. the portable mmu code in fault.c will now explicitely set PTECACHED bits for cached memory and PTEUNCACHED for uncached memory. that way the hardware bit definitions can be used everywhere.
2019-05-01kernel: get rid of checkpagerefs() debuggingcinap_lenrek
was only implemented by the pc kernel. does not account pages used by the mount cache.
2019-02-27kernel: remove ptclbsum dependencies from configscinap_lenrek
2018-09-18mtx, ppc: remove cistrcmp() and cistrncmp() redefinitioncinap_lenrek
2018-02-18devether: mux bridges, portable netconsolecinap_lenrek
2018-02-11kernel: move devether and wifi to port/cinap_lenrek
the only architecture dependence of devether was enabling interrupts, which is now done at the end of the driver's reset() function now. the wifi stack and dummy ethersink also go to port/. do the IRQ2->IRQ9 hack for pc kernels in intrenabale(), so not every caller of intrenable() has to be aware of it.
2017-12-18devether: dont forward loopback packets on bridgescinap_lenrek
2017-12-15ether: allow spoofing of source mac address for bridges; used by vmxcinap_lenrek
to implement layer 2 bridges in userspace, we disable to auto filling of the source mac address when bridge mode is enabled on the connection.
2017-12-09devether: remove duplicated parseether() implementation (pull from libip)cinap_lenrek
2017-11-19kernel: make isaconfig() consistent, not inplace tokenizing the conf stringcinap_lenrek
2017-11-04kernel: introduce per process FPU struct (PFPU) for more flexible machine ↵cinap_lenrek
specific fpu handling introducing the PFPU structue which allows the machine specific code some flexibility on how to handle the FPU process state. for example, in the pc and pc64 kernel, the FPsave structure is arround 512 bytes. with avx512, it could grow up to 2K. instead of embedding that into the Proc strucutre, it is more effective to allocate it on first use of the fpu, as most processes do not use simd or floating point in the first place. also, the FPsave structure has special 16 byte alignment constraint, which further favours dynamic allocation. this gets rid of the memmoves in pc/pc64 kernels for the aligment. there is also devproc, which is now checking if the fpsave area is actually valid before reading it, avoiding debuggers to see garbage data. the Notsave structure is gone now, as it was not used on any machine.
2017-10-29kernel: introduce devswap #¶ to serve /dev/swap and handle swapfile encryptioncinap_lenrek
2017-06-12kernel: add support for hardware watchpointsaiju
2017-03-11kernel: get rid of active.Lock and active.thunderbirdsargocinap_lenrek
2016-01-05kernel: change active.machs from bitmap to char array to support up to 64 ↵cinap_lenrek
cpus on pc64
2015-11-30kernel: cleanup exit()/shutdown()/reboot() codecinap_lenrek
introduce cpushutdown() function that does the common operation of initiating shutdown, returning once all cpu's got the message and are about to shutdown. this avoids duplicated code which isnt really machine specific. automatic reboot on panic only when *debug= is not set and the machine is a cpu server or has no display, otherwise just hang.
2015-07-07all kernels: declare _tas() to prevent pulling in libc version (for libmemdraw)cinap_lenrek
2015-06-13qc, 9/ppc, 9/mtx: fix wrong if statementsftrvxmtrx
2015-05-30io.h: fis comment PciSID (alphapc, kw, mtx, teg2) (thanks qeed!)cinap_lenrek
2015-02-07kernel: reduce Page structure size by changing Page.cachectl[]cinap_lenrek
there are no kernels currently that do page coloring, so the only use of cachectl[] is flushing the icache (on arm and ppc). on pc64, cachectl consumes 32 bytes in each page resulting in over 200 megabytes of overhead for 32gb of ram with 4K pages. this change removes cachectl[] and adds txtflush ulong that is set to ~0 by pio() to instruct putmmu() to flush the icache.
2014-12-16kernel: remove obsolete comment regarding Mntcache size in */main.ccinap_lenrek
2014-12-14kernel: get rid of /boot/boot parametrizationcinap_lenrek
there is no use for "bootdisk" variable parametrization of /boot/boot and no point for the boot section with its boot methods in the kernel configuration anymore. so mkboot and boot$CONF.out are gone. move the rules for bootfs.paq creation in 9/boot/bootmkfile. location of bootfs.proto is now in 9/boot/bootfs.proto. our /boot/boot target is now just "boot".
2014-11-09kernel: remove implicit Proc* argument from procctl()cinap_lenrek
procctl() is always called with up and it would not work correctly if passed a different process, so remove the Proc* argument and use up directly.
2014-06-08kernel: remove _xinc()/_xdec()cinap_lenrek
as with the Block refcount changes, _xinc() and _xdec() arent used anymore, so remove them. architecure can still define ainc()/adec() when it needs them.
2014-01-20kernel: convert putmmu() to uintptr for va and pacinap_lenrek
2014-01-20kernel: various cleanupscinap_lenrek
2014-01-20kernel: apply uintptr for ulong when a pointer is storedcinap_lenrek
this change is in preparation for amd64. the systab calling convention was also changed to return uintptr (as segattach returns a pointer) and the arguments are now passed as va_list which handles amd64 arguments properly (all arguments are passed in 64bit quantities on the stack, tho the upper part will not be initialized when the element is smaller than 8 bytes). this is partial. xalloc needs to be converted in the future.
2013-12-29kernel: dont call pprint() while holding up->debug qlockcinap_lenrek
pprint() might block or even (maliciously) call into devproc write which will corrupt the qlock chain on attempt to qlock up->debug again.
2013-12-16devether: remove qfull prints and fix loopback packet handling of etheroq()cinap_lenrek
dont spam the console with qfull warnings. this makes things worse. handle loopback packets as stated in the comment. we call etheriq() with fromwire=1 for loopback packets so etheriq() can pass the packet on (without copying) or free it. dont inhibit interrupts while calling etheriq(). etheriq() can safely be called from process and interrupt context. it is unclear what this was supposed to fix and testing didnt seem to have any odd effects.
2013-11-22kernel: more kproc pexit() and sleep error handlingcinap_lenrek
2013-03-16sysexec: fix possible segment overlap with temporary stackcinap_lenrek
the kernel uses fixed area (TSTKTOP, TSTKSIZ) of the address space to temporarily map the new stack segment for exec. for 386 and arm, this area was right below the stack segment which has the problem that the program can map arbitrary segments there (even readonly). alpha and ppc dont have this problem as they map the temporary exec stack *above* the user reachable stack segement and segattach prevents one from mapping anything above or overlaping the stack. lots of arch code assumes USTKTOP being the end of userspace address space and changing this to TSTKTOP would work, but results in lots of hard to test changes. instead, we'r going to map the temporary stack programmatically finding a hole in the address space where to map it. we also lift the size limitation for arguments and allow arguments to fill the whole new stack segement. the TSTKTOP and TSTKSIZ are not used anymore so they where removed. references: http://9fans.net/archive/2013/03/203 http://9fans.net/archive/2013/03/202 http://9fans.net/archive/2013/03/197 http://9fans.net/archive/2013/03/195 http://9fans.net/archive/2013/03/181
2012-05-03kernel: move duplicated random.c to portcinap_lenrek