kern_intr.c (194987) | kern_intr.c (195249) |
---|---|
1/*- 2 * Copyright (c) 1997, Stefan Esser <se@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1997, Stefan Esser <se@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/kern/kern_intr.c 194987 2009-06-25 18:35:19Z jhb $"); | 28__FBSDID("$FreeBSD: head/sys/kern/kern_intr.c 195249 2009-07-01 17:20:07Z jhb $"); |
29 30#include "opt_ddb.h" 31 32#include <sys/param.h> 33#include <sys/bus.h> 34#include <sys/conf.h> 35#include <sys/cpuset.h> 36#include <sys/rtprio.h> 37#include <sys/systm.h> 38#include <sys/interrupt.h> 39#include <sys/kernel.h> 40#include <sys/kthread.h> 41#include <sys/ktr.h> 42#include <sys/limits.h> 43#include <sys/lock.h> 44#include <sys/malloc.h> 45#include <sys/mutex.h> | 29 30#include "opt_ddb.h" 31 32#include <sys/param.h> 33#include <sys/bus.h> 34#include <sys/conf.h> 35#include <sys/cpuset.h> 36#include <sys/rtprio.h> 37#include <sys/systm.h> 38#include <sys/interrupt.h> 39#include <sys/kernel.h> 40#include <sys/kthread.h> 41#include <sys/ktr.h> 42#include <sys/limits.h> 43#include <sys/lock.h> 44#include <sys/malloc.h> 45#include <sys/mutex.h> |
46#include <sys/priv.h> |
|
46#include <sys/proc.h> 47#include <sys/random.h> 48#include <sys/resourcevar.h> 49#include <sys/sched.h> 50#include <sys/smp.h> 51#include <sys/sysctl.h> 52#include <sys/syslog.h> 53#include <sys/unistd.h> --- 245 unchanged lines hidden (view full) --- 299 int error; 300 301 /* Need a CPU to bind to. */ 302 if (cpu != NOCPU && CPU_ABSENT(cpu)) 303 return (EINVAL); 304 305 if (ie->ie_assign_cpu == NULL) 306 return (EOPNOTSUPP); | 47#include <sys/proc.h> 48#include <sys/random.h> 49#include <sys/resourcevar.h> 50#include <sys/sched.h> 51#include <sys/smp.h> 52#include <sys/sysctl.h> 53#include <sys/syslog.h> 54#include <sys/unistd.h> --- 245 unchanged lines hidden (view full) --- 300 int error; 301 302 /* Need a CPU to bind to. */ 303 if (cpu != NOCPU && CPU_ABSENT(cpu)) 304 return (EINVAL); 305 306 if (ie->ie_assign_cpu == NULL) 307 return (EOPNOTSUPP); |
308 309 error = priv_check(curthread, PRIV_SCHED_CPUSET_INTR); 310 if (error) 311 return (error); 312 |
|
307 /* | 313 /* |
308 * If we have any ithreads try to set their mask first since this 309 * can fail. | 314 * If we have any ithreads try to set their mask first to verify 315 * permissions, etc. |
310 */ 311 mtx_lock(&ie->ie_lock); 312 if (ie->ie_thread != NULL) { 313 CPU_ZERO(&mask); 314 if (cpu == NOCPU) 315 CPU_COPY(cpuset_root, &mask); 316 else 317 CPU_SET(cpu, &mask); 318 id = ie->ie_thread->it_thread->td_tid; 319 mtx_unlock(&ie->ie_lock); 320 error = cpuset_setthread(id, &mask); 321 if (error) 322 return (error); 323 } else 324 mtx_unlock(&ie->ie_lock); 325 error = ie->ie_assign_cpu(ie->ie_source, cpu); | 316 */ 317 mtx_lock(&ie->ie_lock); 318 if (ie->ie_thread != NULL) { 319 CPU_ZERO(&mask); 320 if (cpu == NOCPU) 321 CPU_COPY(cpuset_root, &mask); 322 else 323 CPU_SET(cpu, &mask); 324 id = ie->ie_thread->it_thread->td_tid; 325 mtx_unlock(&ie->ie_lock); 326 error = cpuset_setthread(id, &mask); 327 if (error) 328 return (error); 329 } else 330 mtx_unlock(&ie->ie_lock); 331 error = ie->ie_assign_cpu(ie->ie_source, cpu); |
326 if (error) | 332 if (error) { 333 mtx_lock(&ie->ie_lock); 334 if (ie->ie_thread != NULL) { 335 CPU_ZERO(&mask); 336 if (ie->ie_cpu == NOCPU) 337 CPU_COPY(cpuset_root, &mask); 338 else 339 CPU_SET(cpu, &mask); 340 id = ie->ie_thread->it_thread->td_tid; 341 mtx_unlock(&ie->ie_lock); 342 (void)cpuset_setthread(id, &mask); 343 } else 344 mtx_unlock(&ie->ie_lock); |
327 return (error); | 345 return (error); |
346 } 347 |
|
328 mtx_lock(&ie->ie_lock); 329 ie->ie_cpu = cpu; 330 mtx_unlock(&ie->ie_lock); 331 332 return (error); 333} 334 335static struct intr_event * --- 1427 unchanged lines hidden --- | 348 mtx_lock(&ie->ie_lock); 349 ie->ie_cpu = cpu; 350 mtx_unlock(&ie->ie_lock); 351 352 return (error); 353} 354 355static struct intr_event * --- 1427 unchanged lines hidden --- |