summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_cpuset.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r263710, r273377, r273378, r273423 and r273455:hselasky2014-10-271-1/+1
| | | | | | | - De-vnet hash sizes and hash masks. - Fix multiple issues related to arguments passed to SYSCTL macros. Sponsored by: Mellanox Technologies
* Several improvements to rmlock(9). Many of these are based on patchesjhb2013-06-251-10/+19
| | | | | | | | | | | | | | | | | | | | | | provided by Isilon. - Add an rm_assert() supporting various lock assertions similar to other locking primitives. Because rmlocks track readers the assertions are always fully accurate unlike rw_assert() and sx_assert(). - Flesh out the lock class methods for rmlocks to support sleeping via condvars and rm_sleep() (but only while holding write locks), rmlock details in 'show lock' in DDB, and the lc_owner method used by dtrace. - Add an internal destroyed cookie so that API functions can assert that an rmlock is not destroyed. - Make use of rm_assert() to add various assertions to the API (e.g. to assert locks are held when an unlock routine is called). - Give RM_SLEEPABLE locks their own lock class and always use the rmlock's own lock_object with WITNESS. - Use THREAD_NO_SLEEPING() / THREAD_SLEEPING_OK() to disallow sleeping while holding a read lock on an rmlock. Submitted by: andre Obtained from: EMC/Isilon
* - Add a BIT_FFS() macro and use it to replace cpusetffs_obj()jeff2013-06-131-20/+0
| | | | | Discussed with: attilio Sponsored by: EMC / Isilon Storage Division
* Do not compare the existing mask of a cpuset with a new mask when changingjhb2013-06-061-8/+11
| | | | | | | the mask of a cpuset. Also, change the cpuset's mask before updating the masks of all children. Previously changing a cpuset's mask first required setting the mask to a super-set of both the old and new masks and then changing it a second time to the new mask.
* Post r222812 KTR_CPUMASK started being initialized only as a tunableattilio2012-08-301-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | handler and not more statically. Unfortunately, it seems that this is not ideal for new platform bringup and boot low level development (which needs ktr_cpumask to be effective before tunables can be setup). Because of this, add a way to statically initialize cpusets, by passing an list of initializers, divided by commas. Also, provide a way to enforce an all-set mask, for above mentioned initializers. This imposes some differences on how KTR_CPUMASK is setup now as a kernel option, and in particular this makes the words specifications backward wrt. what is currently in -CURRENT. In order to avoid mismatches between KTR_CPUMASK definition and other way to setup the mask (tunable, sysctl) and to print it, change the ordering how cpusetobj_print() and cpusetobj_scan() acquire the words belonging to the set. Please give a look to sys/conf/NOTES in order to understand how the new format is supposed to work. Also, ktr manpages will be updated shortly by gjb which volountereed for this. This patch won't be merged because it changes a POLA (at least from the theoretical standpoint) and this is however a patch that proves to be effective only in development environments. Requested by: rpaulo Reviewed by: jeff, rpaulo
* Add a missing curly bracketkevlo2011-12-051-0/+1
|
* In order to maximize the re-usability of kernel code in user space thiskmacy2011-09-161-5/+5
| | | | | | | | | | | | | patch modifies makesyscalls.sh to prefix all of the non-compatibility calls (e.g. not linux_, freebsd32_) with sys_ and updates the kernel entry points and all places in the code that use them. It also fixes an additional name space collision between the kernel function psignal and the libc function of the same name by renaming the kernel psignal kern_psignal(). By introducing this change now we will ease future MFCs that change syscalls. Reviewed by: rwatson Approved by: re (bz)
* Fix KTR_CPUMASK in order to accept a string representing a cpuset_t.attilio2011-05-311-0/+38
| | | | | | | | | | | | This introduce all the underlying support for making this possible (via the function cpusetobj_strscan() and keeps ktr_cpumask exported. sparc64 implements its own assembly primitives for tracing events and needs to properly check it. Anyway the sparc64 logic is not implemented yet due to lack of knowledge (by me) and time (by marius), but it is just a matter of using ktr_cpumask when possible. Tested and fixed by: pluknet Reviewed by: marius
* Revert a change that crept in during MFC.attilio2011-05-311-36/+0
|
* MFCattilio2011-05-311-0/+36
|\
| * Merge r221912 from largeSMP project branch:attilio2011-05-221-1/+1
| | | | | | | | | | | | | | | | Fix a long-standing bug in cpuset_thread0() where only the first part of cs_mask is set full. Submitted by: anonymous MFC after: 1 week
* | Revert a patch that unvolountary sneaked in while I was MFCing.attilio2011-05-231-36/+0
| |
* | MFCattilio2011-05-231-0/+36
| |
* | Make cpusetobj_strprint() prepare the string in order to print theattilio2011-05-221-2/+2
| | | | | | | | | | | | least significant cpuset_t word at the outmost right part of the string (more far from the beginning of it). This follows the natural build of bits rappresentation in the words.
* | Fix a longstanding bug where only the first part of the cpumask wasattilio2011-05-141-1/+1
| | | | | | | | | | | | correctly set full. Submitted by: anonymous
* | Simplify the code here.attilio2011-05-141-4/+0
| | | | | | | | Submitted by: jhb
* | Commit the support for removing cpumask_t and replacing it directly withattilio2011-05-051-3/+45
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* When constructing a new cpuset, apply the parent cpuset's mask to the newjhb2011-03-081-4/+4
| | | | | | | | set's mask rather than the root mask. This was causing the root mask to be modified incorrectly. Reviewed by: jeff MFC after: 1 week
* Use integer for size of cpuset, as it won't be bigger than INT_MAX,davidxu2010-11-011-0/+4
| | | | | | This is requested by bge. Also move the sysctl into file kern_cpuset.c, because it should always be there, it is independent of thread scheduler.
* - Revert r214409.davidxu2010-10-271-4/+0
| | | | - Use long word to figure out sizeof kernel cpuset, hope it works.
* If input parameter cpusetsize is zero, give userland size of cpuset maskdavidxu2010-10-271-0/+4
| | | | kernel is using.
* Use function tdfind() to find a thread.davidxu2010-10-251-11/+2
|
* Another nit that both I and ispell missed.jhb2009-10-261-1/+1
| | | | Submitted by: Ben Kaduk minimarmot of gmail
* Fix some spelling nits.jhb2009-10-261-5/+5
|
* Remove unnecessary/redundant includes.jamie2009-06-231-1/+0
| | | | Approved by: bz (mentor)
* Add hierarchical jails. A jail may further virtualize its environmentjamie2009-05-271-38/+14
| | | | | | | | | | | | | | | | | | | | | | by creating a child jail, which is visible to that jail and to any parent jails. Child jails may be restricted more than their parents, but never less. Jail names reflect this hierarchy, being MIB-style dot-separated strings. Every thread now points to a jail, the default being prison0, which contains information about the physical system. Prison0's root directory is the same as rootvnode; its hostname is the same as the global hostname, and its securelevel replaces the global securelevel. Note that the variable "securelevel" has actually gone away, which should not cause any problems for code that properly uses securelevel_gt() and securelevel_ge(). Some jail-related permissions that were kept in global variables and set via sysctls are now per-jail settings. The sysctls still exist for backward compatibility, used only by the now-deprecated jail(2) system call. Approved by: bz (mentor)
* Prevent a superuser inside a jail from modifying the dedicatedbz2009-04-281-0/+9
| | | | | | | | | | | | | root cpuset of that jail. Processes inside the jail will still be able to change child sets. A superuser outside of a jail will still be able to change the jail cpuset and thus limit the number of cpus available to the jail. Problem reported by: 000.fbsd@quip.cz (Miroslav Lachman) PR: kern/134050 Reviewed by: jeff MFC after: 3 weeks X-MFC: backout r191596
* Correct a comment: the function name given had never existed in anybz2009-04-221-1/+2
| | | | | | (relevant) version of this file orany of my patches. MFC after: 1 month
* MFp4:bz2008-11-291-4/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bring in updated jail support from bz_jail branch. This enhances the current jail implementation to permit multiple addresses per jail. In addtion to IPv4, IPv6 is supported as well. Due to updated checks it is even possible to have jails without an IP address at all, which basically gives one a chroot with restricted process view, no networking,.. SCTP support was updated and supports IPv6 in jails as well. Cpuset support permits jails to be bound to specific processor sets after creation. Jails can have an unrestricted (no duplicate protection, etc.) name in addition to the hostname. The jail name cannot be changed from within a jail and is considered to be used for management purposes or as audit-token in the future. DDB 'show jails' command was added to aid debugging. Proper compat support permits 32bit jail binaries to be used on 64bit systems to manage jails. Also backward compatibility was preserved where possible: for jail v1 syscalls, as well as with user space management utilities. Both jail as well as prison version were updated for the new features. A gap was intentionally left as the intermediate versions had been used by various patches floating around the last years. Bump __FreeBSD_version for the afore mentioned and in kernel changes. Special thanks to: - Pawel Jakub Dawidek (pjd) for his multi-IPv4 patches and Olivier Houchard (cognet) for initial single-IPv6 patches. - Jeff Roberson (jeff) and Randall Stewart (rrs) for their help, ideas and review on cpuset and SCTP support. - Robert Watson (rwatson) for lots and lots of help, discussions, suggestions and review of most of the patch at various stages. - John Baldwin (jhb) for his help. - Simon L. Nielsen (simon) as early adopter testing changes on cluster machines as well as all the testers and people who provided feedback the last months on freebsd-jail and other channels. - My employer, CK Software GmbH, for the support so I could work on this. Reviewed by: (see above) MFC after: 3 months (this is just so that I get the mail) X-MFC Before: 7.2-RELEASE if possible
* Add a `show cpusets' DDB command to print numbered root andbz2008-07-071-0/+33
| | | | | | assigned CPU affinity sets. Reviewed by: brooks
* Move cpuset_refroot and cpuset_refbase functions up, grouping thebz2008-07-071-32/+32
| | | | | | cpuset_ref* functions together. Will make it easier to read and add code without forward declarations. No functional changes.
* Add a new priv 'PRIV_SCHED_CPUSET' to check if manipulating cpusets isbz2008-06-291-1/+1
| | | | | | allowed and replace the suser() call. Do not allow it in jails. Reviewed by: rwatson
* Take into account possible overflow when multiplying. The casuality iskib2008-05-261-2/+2
| | | | | | | the malloc call later, panicing kernel due to the oversized allocation. Reported by: pho Reviewed by: jeff
* - Add the interrupt vector number to intr_event_create so MI code canjeff2008-04-111-0/+16
| | | | | | | | | | | | lookup hard interrupt events by number. Ignore the irq# for soft intrs. - Add support to cpuset for binding hardware interrupts. This has the side effect of binding any ithread associated with the hard interrupt. As per restrictions imposed by MD code we can only bind interrupts to a single cpu presently. Interrupts can be 'unbound' by binding them to all cpus. Reviewed by: jhb Sponsored by: Nokia
* - Add a Nokia copyright to cpuset to reflect their generousjeff2008-04-041-0/+3
| | | | contribution to this work.
* - Consistently return EDEADLK when presented with a new set that isjeff2008-03-301-20/+27
| | | | | | | | | | | | incompatible with existing bindings. - Try to copyout the setid in cpuset() before migrating the proc to the setid in case the user has supplied a bad buffer. - Rename cpuset_root() and cpuset_base() to cpuset_ref{root,base} to be more descriptive and free cpuset_root to be used as a different type of symbol. - Make cpuset_root the cpuset_t set of all cpus in the system. This should contain the same bitmask as all_cpus presently. - Add a CPU_CMP() macro to compare two sets.
* Fixed type of the fourth argument of cpuset_{get,set}affinity(2) to be size_t.ru2008-03-251-11/+10
| | | | Prodded by: davidxu
* - Relax requirements for p_numthreads, p_threads, p_swtick, and p_nice fromjeff2008-03-191-10/+2
| | | | | | | requiring the per-process spinlock to only requiring the process lock. - Reflect these changes in the proc.h documentation and consumers throughout the kernel. This is a substantial reduction in locking cost for these fields and was made possible by recent changes to threading support.
* - Add a missing unlock to cpuset_setaffinity(CPU_LEVEL_CPUSET, CPU_WHICH_PID)jeff2008-03-061-0/+1
| | | | Found by: gallatin
* - Don't overwrite the recently allocated 'nset' in cpuset_setthread() byjeff2008-03-051-1/+1
| | | | | | | | passing it to cpuset_which(). Pass in 'set' instead. This argument is not used but for convenience cpuset_which() nulls all incoming parameters. Submitted by: davidxu
* - Verify that when a user supplies a mask that is bigger than the kerneljeff2008-03-051-26/+78
| | | | | | | | | | mask none of the upper bits are set. - Be more careful about enforcing the boundaries of masks and child sets. - Introduce a few more CPU_* macros for implementing these tests. - Change the cpusetsize argument to be bytes rather than bits to match other apis. Sponsored by: Nokia
* Add cpuset, an api for thread to cpu binding and cpu resource groupingjeff2008-03-021-0/+907
and assignment. - Add a reference to a struct cpuset in each thread that is inherited from the thread that created it. - Release the reference when the thread is destroyed. - Add prototypes for syscalls and macros for manipulating cpusets in sys/cpuset.h - Add syscalls to create, get, and set new numbered cpusets: cpuset(), cpuset_{get,set}id() - Add syscalls for getting and setting affinity masks for cpusets or individual threads: cpuid_{get,set}affinity() - Add types for the 'level' and 'which' parameters for the cpuset. This will permit expansion of the api to cover cpu masks for other objects identifiable with an id_t integer. For example, IRQs and Jails may be coming soon. - The root set 0 contains all valid cpus. All thread initially belong to cpuset 1. This permits migrating all threads off of certain cpus to reserve them for special applications. Sponsored by: Nokia Discussed with: arch, rwatson, brooks, davidxu, deischen Reviewed by: antoine
OpenPOWER on IntegriCloud