- Add more strict in_atomic() checking to the mutex entry

function just to be extra safety and paranoid.

- Rewrite the thread shim to take full advantage of the
new kernel kthread API.  This greatly simplifies things.

- Add a new regression test for thread_exit() to ensure
it properly terminates a thread immediately without
allowing futher execution of the thread.



git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@69 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c
This commit is contained in:
behlendo
2008-04-11 17:03:57 +00:00
parent 79f92663e3
commit 115aed0dd8
3 changed files with 123 additions and 73 deletions
+17
View File
@@ -6,6 +6,7 @@ extern "C" {
#endif
#include <linux/module.h>
#include <linux/hardirq.h>
#include <sys/types.h>
/* See the "Big Theory Statement" in solaris mutex.c.
@@ -65,6 +66,14 @@ static __inline__ void
mutex_enter(kmutex_t *mp)
{
BUG_ON(mp->km_magic != KM_MAGIC);
if (unlikely(in_atomic() && !current->exit_state)) {
dump_stack();
printk("Scheduling while atomic: %s/0x%08x/%d\n",
current->comm, preempt_count(), current->pid);
BUG();
}
down(&mp->km_sem); /* Will check in_atomic() for us */
BUG_ON(mp->km_owner != NULL);
mp->km_owner = current;
@@ -78,6 +87,14 @@ mutex_tryenter(kmutex_t *mp)
int result;
BUG_ON(mp->km_magic != KM_MAGIC);
if (unlikely(in_atomic() && !current->exit_state)) {
dump_stack();
printk("Scheduling while atomic: %s/0x%08x/%d\n",
current->comm, preempt_count(), current->pid);
BUG();
}
result = down_trylock(&mp->km_sem); /* returns 0 if acquired */
if (result == 0) {
BUG_ON(mp->km_owner != NULL);