kernel: Introduce THREAD_BLOCK_TYPE_OTHER_OBJECT.

THREAD_BLOCK_TYPE_OTHER implies the "object" pointer in the
wait information is a string. But sometimes we want to pass
through objects which are not strings, for inspection in KDL.
This commit is contained in:
Augustin Cavalier
2023-04-26 15:33:53 -04:00
parent f5e531e92e
commit 557f0446b3
9 changed files with 20 additions and 0 deletions
+1
View File
@@ -30,6 +30,7 @@ enum {
THREAD_BLOCK_TYPE_RW_LOCK = 5,
THREAD_BLOCK_TYPE_USER = 6,
THREAD_BLOCK_TYPE_OTHER_OBJECT = 9998,
THREAD_BLOCK_TYPE_OTHER = 9999,
};
@@ -1492,6 +1492,7 @@ printf("failed to read event!\n");
case THREAD_BLOCK_TYPE_MUTEX:
case THREAD_BLOCK_TYPE_RW_LOCK:
case THREAD_BLOCK_TYPE_OTHER:
case THREAD_BLOCK_TYPE_OTHER_OBJECT:
default:
break;
}
+1
View File
@@ -49,6 +49,7 @@ wait_object_type_name(uint32 type)
case THREAD_BLOCK_TYPE_USER:
return "user";
case THREAD_BLOCK_TYPE_OTHER:
case THREAD_BLOCK_TYPE_OTHER_OBJECT:
return "other";
case THREAD_BLOCK_TYPE_SNOOZE:
return "snooze";
@@ -1004,6 +1004,7 @@ ModelLoader::_HandleThreadScheduled(uint32 cpu,
case THREAD_BLOCK_TYPE_MUTEX:
case THREAD_BLOCK_TYPE_RW_LOCK:
case THREAD_BLOCK_TYPE_OTHER:
case THREAD_BLOCK_TYPE_OTHER_OBJECT:
default:
break;
}
@@ -115,6 +115,9 @@ wait_object_to_string(scheduling_analysis_wait_object* waitObject, char* buffer,
case THREAD_BLOCK_TYPE_OTHER:
sprintf(buffer, "other %p (%s)", object, waitObject->name);
break;
case THREAD_BLOCK_TYPE_OTHER_OBJECT:
sprintf(buffer, "other object %p", object);
break;
default:
sprintf(buffer, "unknown %p", object);
break;
@@ -1276,6 +1276,7 @@ SystemProfiler::_WaitObjectUsed(addr_t object, uint32 type)
break;
}
case THREAD_BLOCK_TYPE_OTHER_OBJECT:
case THREAD_BLOCK_TYPE_SNOOZE:
case THREAD_BLOCK_TYPE_SIGNAL:
default:
@@ -87,6 +87,9 @@ ScheduleThread::AddDump(TraceOutput& out)
// We could print the string, but it might come from a
// kernel module that has already been unloaded.
break;
case THREAD_BLOCK_TYPE_OTHER_OBJECT:
out.Print("other object (%p)", fPreviousWaitObject);
break;
default:
out.Print("unknown (%p)", fPreviousWaitObject);
break;
@@ -533,6 +533,7 @@ private:
strlcpy(waitObject->name, name, sizeof(waitObject->name));
}
case THREAD_BLOCK_TYPE_OTHER_OBJECT:
case THREAD_BLOCK_TYPE_SNOOZE:
case THREAD_BLOCK_TYPE_SIGNAL:
default:
+8
View File
@@ -1728,6 +1728,10 @@ _dump_thread_info(Thread *thread, bool shortInfo)
kprintf("other%*s", B_PRINTF_POINTER_WIDTH + 10, "");
break;
case THREAD_BLOCK_TYPE_OTHER_OBJECT:
kprintf("other %p ", thread->wait.object);
break;
default:
kprintf("??? %p ", thread->wait.object);
break;
@@ -1815,6 +1819,10 @@ _dump_thread_info(Thread *thread, bool shortInfo)
kprintf("other (%s)\n", (char*)thread->wait.object);
break;
case THREAD_BLOCK_TYPE_OTHER_OBJECT:
kprintf("other (%p)\n", thread->wait.object);
break;
default:
kprintf("unknown (%p)\n", thread->wait.object);
break;