diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2009-07-01 17:20:07 +0000 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2009-07-01 17:20:07 +0000 |
| commit | cebc7fb16cb8a09f8821822eb0773c2e81ee5d44 (patch) | |
| tree | fb5e23052e350ca2b196f1a06067d0f6cf148b56 /sys/kern | |
| parent | 6d5a61563a0e58d0ce62b1fe263abb64c7369d7a (diff) | |
Notes
Diffstat (limited to 'sys/kern')
| -rw-r--r-- | sys/kern/kern_intr.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c index 56761ba0a04b..3eb2c6ca3f88 100644 --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include <sys/lock.h> #include <sys/malloc.h> #include <sys/mutex.h> +#include <sys/priv.h> #include <sys/proc.h> #include <sys/random.h> #include <sys/resourcevar.h> @@ -304,9 +305,14 @@ intr_event_bind(struct intr_event *ie, u_char cpu) if (ie->ie_assign_cpu == NULL) return (EOPNOTSUPP); + + error = priv_check(curthread, PRIV_SCHED_CPUSET_INTR); + if (error) + return (error); + /* - * If we have any ithreads try to set their mask first since this - * can fail. + * If we have any ithreads try to set their mask first to verify + * permissions, etc. */ mtx_lock(&ie->ie_lock); if (ie->ie_thread != NULL) { @@ -323,8 +329,22 @@ intr_event_bind(struct intr_event *ie, u_char cpu) } else mtx_unlock(&ie->ie_lock); error = ie->ie_assign_cpu(ie->ie_source, cpu); - if (error) + if (error) { + mtx_lock(&ie->ie_lock); + if (ie->ie_thread != NULL) { + CPU_ZERO(&mask); + if (ie->ie_cpu == NOCPU) + CPU_COPY(cpuset_root, &mask); + else + CPU_SET(cpu, &mask); + id = ie->ie_thread->it_thread->td_tid; + mtx_unlock(&ie->ie_lock); + (void)cpuset_setthread(id, &mask); + } else + mtx_unlock(&ie->ie_lock); return (error); + } + mtx_lock(&ie->ie_lock); ie->ie_cpu = cpu; mtx_unlock(&ie->ie_lock); |
