kernel/slab: Fix build with SLAB_ALLOCATION_TRACING enabled.

Unfortunately it does not work, I get this when invoking
allocations_per_caller at the kdebug prompt:

     92513     9162096  0x0000000000000000  <NULL> + 0x0 (commpage) (nearest)
     12602     2108408  0xffffffff80132a50  _Z23add_alloc_tracing_entryP11ObjectCachejPv + 0x70 (kernel_x86_64)

The stack tracing system must be broken, or maybe it has never been
properly adjusted for x86_64.
This commit is contained in:
Augustin Cavalier 2021-08-30 20:28:03 -04:00
parent 084c6fa130
commit 6c0b410650

View File

@ -88,7 +88,7 @@ static const addr_t kSlabCodeAddressRanges[] = {
};
static const uint32 kSlabCodeAddressRangeCount
= sizeof(kSlabCodeAddressRanges) / sizeof(kSlabCodeAddressRanges[0]) / 2;
= B_COUNT_OF(kSlabCodeAddressRanges) / 2;
#endif // SLAB_ALLOCATION_TRACKING_AVAILABLE
@ -135,10 +135,11 @@ class Create : public ObjectCacheTraceEntry {
virtual void AddDump(TraceOutput& out)
{
out.Print("object cache create: name: \"%s\", object size: %lu, "
"alignment: %lu, max usage: %lu, flags: 0x%lx, cookie: %p "
"-> cache: %p", fName, fObjectSize, fAlignment, fMaxByteUsage,
fFlags, fCookie, fCache);
out.Print("object cache create: name: \"%s\", object size: "
"%" B_PRIuSIZE ", alignment: %" B_PRIuSIZE ", max usage: "
"%" B_PRIuSIZE ", flags: 0x%" B_PRIx32 ", cookie: %p -> cache: %p",
fName, fObjectSize, fAlignment, fMaxByteUsage, fFlags,
fCookie, fCache);
}
private:
@ -180,8 +181,8 @@ class Alloc : public ObjectCacheTraceEntry {
virtual void AddDump(TraceOutput& out)
{
out.Print("object cache alloc: cache: %p, flags: 0x%lx -> "
"object: %p", fCache, fFlags, fObject);
out.Print("object cache alloc: cache: %p, flags: 0x%" B_PRIx32
" -> object: %p", fCache, fFlags, fObject);
}
private:
@ -224,8 +225,8 @@ class Reserve : public ObjectCacheTraceEntry {
virtual void AddDump(TraceOutput& out)
{
out.Print("object cache reserve: cache: %p, count: %lu, "
"flags: 0x%lx", fCache, fCount, fFlags);
out.Print("object cache reserve: cache: %p, count: %" B_PRIu32 ", "
"flags: 0x%" B_PRIx32, fCache, fCount, fFlags);
}
private:
@ -783,8 +784,8 @@ dump_allocations_per_caller(int argc, char **argv)
qsort(sCallerInfoTable, sCallerInfoCount, sizeof(caller_info),
sortBySize ? &caller_info_compare_size : &caller_info_compare_count);
kprintf("%ld different callers, sorted by %s...\n\n", sCallerInfoCount,
sortBySize ? "size" : "count");
kprintf("%" B_PRId32 " different callers, sorted by %s...\n\n",
sCallerInfoCount, sortBySize ? "size" : "count");
size_t totalAllocationSize = 0;
size_t totalAllocationCount = 0;