summaryrefslogtreecommitdiffstats
path: root/sys/sys/cpuset.h
Commit message (Collapse)AuthorAgeFilesLines
* MFC 278474,278476,280279:jhb2015-04-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Expand the bitcount*() API and use it to implement CPU_COUNT for cpusets. 278474: Use __builtin_popcnt() to implement a BIT_COUNT() operation for bitsets and use this to implement CPU_COUNT() to count the number of CPUs in a cpuset. 278476: Use __builtin_popcountl() instead of __builtin_popcount(). 280279: Expand the bitcount* API to support 64-bit integers, plain ints and longs and create a "hidden" API that can be used in other system headers without adding namespace pollution. - If the POPCNT instruction is enabled at compile time, use __builtin_popcount*() to implement __bitcount*(), otherwise fall back to software implementations. - Use the existing bitcount16() and bitcount32() from <sys/systm.h> to implement the non-POPCNT __bitcount16() and __bitcount32() in <sys/types.h>. - For the non-POPCNT __bitcount64(), use a similar SWAR method on 64-bit systems. For 32-bit systems, use two __bitcount32() operations on the two halves. - Use __bitcount32() to provide a __bitcount() that operates on plain ints. - Use either __bitcount32() or __bitcount64() to provide a __bitcountl() that operates on longs. - Add public bitcount*() wrappers for __bitcount*() for use in the kernel in <sys/libkern.h>. - Use __bitcountl() instead of __builtin_popcountl() in BIT_COUNT().
* MFC 261321neel2014-12-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Rename the AMD MSR_PERFCTR[0-3] so the Pentium Pro MSR_PERFCTR[0-1] aren't redefined. MFC r273214 Fix build to not bogusly always rebuild vmm.ko. MFC r273338 Add support for AMD's nested page tables in pmap.c: - Provide the correct bit mask for various bit fields in a PTE (e.g. valid bit) for a pmap of type PT_RVI. - Add a function 'pmap_type_guest(pmap)' that returns TRUE if the pmap is of type PT_EPT or PT_RVI. Add CPU_SET_ATOMIC_ACQ(num, cpuset): This is used when activating a vcpu in the nested pmap. Using the 'acquire' variant guarantees that the load of the 'pm_eptgen' will happen only after the vcpu is activated in 'pm_active'. Add defines for various AMD-specific MSRs. Discussed with: kib (r261321)
* Add BIT_AND_ATOMIC() and CPU_AND_ATOMIC().kib2013-08-301-0/+1
| | | | | | Sponsored by: The FreeBSD Foundation Reviewed by: alc Tested by: pho, bf
* Several improvements to rmlock(9). Many of these are based on patchesjhb2013-06-251-0/+3
| | | | | | | | | | | | | | | | | | | | | | 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-1/+1
| | | | | Discussed with: attilio Sponsored by: EMC / Isilon Storage Division
* Generalize the bitset operations, present in cpuset and offer a KPI toattilio2013-05-091-116/+21
| | | | | | | | | | redefine such operations for different consumers. This will be used when NUMA support will be finished and numaset will need to be used. Sponsored by: EMC / Isilon storage division Obtained from: jeff Reviewed by: alc
* Tune cpuset macros to optimize cases when CPU_SETSIZE fits into singlemav2012-03-121-7/+14
| | | | | | | | | | | machine word. For example, it turns CPU_SET() into expected shift and OR, removing two extra shifts and additional index on memory access. Generated code checked for kernel (optimized) and user-level (unoptimized) cases with GCC and CLANG. Reviewed by: attilio MFC after: 2 weeks
* - Remove the now unused CPU_NAND_ATOMIC()attilio2011-07-041-7/+1
| | | | | | - Add a comment explaining that CPU_OR_ATOMIC() and CPU_COPY_STORE_REL() are special wrappers used to cater particular cases.
* Fix KTR_CPUMASK in order to accept a string representing a cpuset_t.attilio2011-05-311-0/+1
| | | | | | | | | | | | 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-1/+0
|
* MFCattilio2011-05-311-0/+1
|\
* | Remove the unnecessary _KERNEL protectionattilio2011-05-291-2/+0
| |
* | Revert a patch that unvolountary sneaked in while I was MFCing.attilio2011-05-231-1/+0
| |
* | MFCattilio2011-05-231-0/+1
| |
* | Commit the support for removing cpumask_t and replacing it directly withattilio2011-05-051-15/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Revert comment introduction. It seems I'm the only one who didn't knowattilio2011-05-041-4/+0
| | | | | | | | of the size mismatch.
* | Add a comment explaining the discrepancy in size between kernel andattilio2011-05-031-0/+4
| | | | | | | | | | | | userland of cpuset_t. Discussed with: jhb
* | Make CPU_MAXSETSIZE dependant by MAXCPU as well.attilio2011-05-031-1/+1
|/ | | | Discussed with: jhb
* - Add a new cpuset macro, CPU_FILL(), for setting the set to all 1s.jeff2009-06-231-0/+6
|
* Add hierarchical jails. A jail may further virtualize its environmentjamie2009-05-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | 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)
* MFp4:bz2008-11-291-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 the interrupt vector number to intr_event_create so MI code canjeff2008-04-111-0/+1
| | | | | | | | | | | | 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-1/+15
| | | | | | | | | | | | 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-2/+2
| | | | Prodded by: davidxu
* Add const qualifier to cpuset mask's pointer, since the cpuset mask shoulddavidxu2008-03-131-1/+1
| | | | be not changed by the system call.
* - Verify that when a user supplies a mask that is bigger than the kerneljeff2008-03-051-0/+22
| | | | | | | | | | 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/+146
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