forked from Imagelibrary/seL4
Make kernel log buffer derived from cmake config
This removes the explicit CMake configuration for the kernel log buffer and replaces it with a #define that is enabled for the required configurations. Signed-off-by: Curtis Millar <curtis@curtism.me>
This commit is contained in:
committed by
Curtis Millar
parent
2c6576c80a
commit
a00c2c16cf
@@ -372,13 +372,6 @@ config_string(
|
||||
DEPENDS "NOT KernelVerificationBuild;KernelBenchmarksTracepoints" DEFAULT_DISABLED 0
|
||||
UNQUOTE
|
||||
)
|
||||
# TODO: this config has no business being in the build system, and should
|
||||
# be moved to C headers, but for now must be emulated here for compatibility
|
||||
if(KernelBenchmarksTrackKernelEntries OR KernelBenchmarksTracepoints)
|
||||
config_set(KernelBenchmarkUseKernelLogBuffer BENCHMARK_USE_KERNEL_LOG_BUFFER ON)
|
||||
else()
|
||||
config_set(KernelBenchmarkUseKernelLogBuffer BENCHMARK_USE_KERNEL_LOG_BUFFER OFF)
|
||||
endif()
|
||||
|
||||
config_option(
|
||||
KernelIRQReporting IRQ_REPORTING
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
#define PPTR_BASE seL4_UserTop
|
||||
|
||||
/* Calculate virtual address space reserved for dynamic log buffer mapping */
|
||||
#ifdef CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER
|
||||
#ifdef CONFIG_KERNEL_LOG_BUFFER
|
||||
#define PPTR_TOP UL_CONST(0xffe00000)
|
||||
#define KS_LOG_PPTR PPTR_TOP
|
||||
#else
|
||||
|
||||
@@ -23,9 +23,9 @@ extern hw_asid_t armKSNextASID VISIBLE;
|
||||
extern pde_t armKSGlobalPD[BIT(PD_INDEX_BITS)] VISIBLE;
|
||||
extern pte_t armKSGlobalPT[BIT(PT_INDEX_BITS)] VISIBLE;
|
||||
|
||||
#ifdef CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER
|
||||
#ifdef CONFIG_KERNEL_LOG_BUFFER
|
||||
extern pte_t armKSGlobalLogPT[BIT(PT_INDEX_BITS)] VISIBLE;
|
||||
#endif /* CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER */
|
||||
#endif /* CONFIG_KERNEL_LOG_BUFFER */
|
||||
|
||||
#else
|
||||
extern pdeS1_t armHSGlobalPGD[BIT(PGD_INDEX_BITS)] VISIBLE;
|
||||
|
||||
@@ -34,7 +34,7 @@ extern asid_t armKSHWASIDTable[BIT(hwASIDBits)] VISIBLE;
|
||||
extern hw_asid_t armKSNextASID VISIBLE;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER
|
||||
#ifdef CONFIG_KERNEL_LOG_BUFFER
|
||||
pde_t *armKSGlobalLogPDE;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
extern pde_t ia32KSGlobalPD[BIT(PD_INDEX_BITS)];
|
||||
extern pte_t ia32KSGlobalPT[BIT(PT_INDEX_BITS)];
|
||||
|
||||
#ifdef CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER
|
||||
#ifdef CONFIG_KERNEL_LOG_BUFFER
|
||||
extern pte_t ia32KSGlobalLogPT[BIT(PT_INDEX_BITS)];
|
||||
#endif /* CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER */
|
||||
#endif /* CONFIG_KERNEL_LOG_BUFFER */
|
||||
|
||||
NODE_STATE_BEGIN(modeNodeState)
|
||||
/* Current active page directory. This is really just a shadow of CR3 */
|
||||
|
||||
@@ -104,3 +104,8 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Configurations requring the kernel log buffer */
|
||||
#if defined CONFIG_BENCHMARK_TRACK_KERNEL_ENTRIES || \
|
||||
defined CONFIG_BENCHMARK_TRACEPOINTS
|
||||
#define CONFIG_KERNEL_LOG_BUFFER
|
||||
#endif
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <config.h>
|
||||
#include <arch/kernel/vspace.h>
|
||||
|
||||
#ifdef CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER
|
||||
#ifdef CONFIG_KERNEL_LOG_BUFFER
|
||||
exception_t benchmark_arch_map_logBuffer(word_t frame_cptr);
|
||||
#endif /* CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER */
|
||||
#endif /* CONFIG_KERNEL_LOG_BUFFER */
|
||||
|
||||
|
||||
@@ -119,9 +119,9 @@ extern char ksIdleThreadTCB[CONFIG_MAX_NUM_NODES][BIT(seL4_TCBBits)];
|
||||
extern char ksIdleThreadSC[CONFIG_MAX_NUM_NODES][BIT(seL4_MinSchedContextBits)];
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER
|
||||
#ifdef CONFIG_KERNEL_LOG_BUFFER
|
||||
extern paddr_t ksUserLogBuffer;
|
||||
#endif /* CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER */
|
||||
#endif /* CONFIG_KERNEL_LOG_BUFFER */
|
||||
|
||||
#define SchedulerAction_ResumeCurrentThread ((tcb_t*)0)
|
||||
#define SchedulerAction_ChooseNewThread ((tcb_t*) 1)
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
#define TLBBITMAP_PD_RESERVED (TLBBITMAP_ROOT_ENTRIES * BIT(seL4_LargePageBits))
|
||||
|
||||
/* Calculate virtual address space reserved for dynamic log buffer mapping */
|
||||
#ifdef CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER
|
||||
#ifdef CONFIG_KERNEL_LOG_BUFFER
|
||||
#define LOGBUFFER_PD_RESERVED BIT(seL4_LargePageBits)
|
||||
#else
|
||||
#define LOGBUFFER_PD_RESERVED UL_CONST(0)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* SPDX-License-Identifier: GPL-2.0-only
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <types.h>
|
||||
#include <benchmark/benchmark.h>
|
||||
#include <arch/benchmark.h>
|
||||
@@ -201,7 +202,7 @@ exception_t handleUnknownSyscall(word_t w)
|
||||
#endif
|
||||
return EXCEPTION_NONE;
|
||||
} else if (w == SysBenchmarkResetLog) {
|
||||
#ifdef CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER
|
||||
#ifdef CONFIG_KERNEL_LOG_BUFFER
|
||||
if (ksUserLogBuffer == 0) {
|
||||
userError("A user-level buffer has to be set before resetting benchmark.\
|
||||
Use seL4_BenchmarkSetLogBuffer\n");
|
||||
@@ -210,7 +211,7 @@ exception_t handleUnknownSyscall(word_t w)
|
||||
}
|
||||
|
||||
ksLogIndex = 0;
|
||||
#endif /* CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER */
|
||||
#endif /* CONFIG_KERNEL_LOG_BUFFER */
|
||||
#ifdef CONFIG_BENCHMARK_TRACK_UTILISATION
|
||||
NODE_STATE(benchmark_log_utilisation_enabled) = true;
|
||||
benchmark_track_reset_utilisation(NODE_STATE(ksIdleThread));
|
||||
@@ -226,16 +227,16 @@ exception_t handleUnknownSyscall(word_t w)
|
||||
setRegister(NODE_STATE(ksCurThread), capRegister, seL4_NoError);
|
||||
return EXCEPTION_NONE;
|
||||
} else if (w == SysBenchmarkFinalizeLog) {
|
||||
#ifdef CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER
|
||||
#ifdef CONFIG_KERNEL_LOG_BUFFER
|
||||
ksLogIndexFinalized = ksLogIndex;
|
||||
setRegister(NODE_STATE(ksCurThread), capRegister, ksLogIndexFinalized);
|
||||
#endif /* CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER */
|
||||
#endif /* CONFIG_KERNEL_LOG_BUFFER */
|
||||
#ifdef CONFIG_BENCHMARK_TRACK_UTILISATION
|
||||
benchmark_utilisation_finalise();
|
||||
#endif /* CONFIG_BENCHMARK_TRACK_UTILISATION */
|
||||
return EXCEPTION_NONE;
|
||||
} else if (w == SysBenchmarkSetLogBuffer) {
|
||||
#ifdef CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER
|
||||
#ifdef CONFIG_KERNEL_LOG_BUFFER
|
||||
word_t cptr_userFrame = getRegister(NODE_STATE(ksCurThread), capRegister);
|
||||
|
||||
if (benchmark_arch_map_logBuffer(cptr_userFrame) != EXCEPTION_NONE) {
|
||||
@@ -245,7 +246,7 @@ exception_t handleUnknownSyscall(word_t w)
|
||||
|
||||
setRegister(NODE_STATE(ksCurThread), capRegister, seL4_NoError);
|
||||
return EXCEPTION_NONE;
|
||||
#endif /* CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER */
|
||||
#endif /* CONFIG_KERNEL_LOG_BUFFER */
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BENCHMARK_TRACK_UTILISATION
|
||||
|
||||
@@ -253,7 +253,7 @@ BOOT_CODE void map_kernel_window(void)
|
||||
/* crosscheck whether we have mapped correctly so far */
|
||||
assert(phys == PADDR_TOP);
|
||||
|
||||
#ifdef CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER
|
||||
#ifdef CONFIG_KERNEL_LOG_BUFFER
|
||||
/* map log buffer page table. PTEs to be filled by user later by calling seL4_BenchmarkSetLogBuffer() */
|
||||
armKSGlobalPD[idx] =
|
||||
pde_pde_coarse_new(
|
||||
@@ -266,7 +266,7 @@ BOOT_CODE void map_kernel_window(void)
|
||||
|
||||
phys += BIT(pageBitsForSize(ARMSection));
|
||||
idx++;
|
||||
#endif /* CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER */
|
||||
#endif /* CONFIG_KERNEL_LOG_BUFFER */
|
||||
|
||||
/* map page table covering last 1M of virtual address space to page directory */
|
||||
armKSGlobalPD[idx] =
|
||||
@@ -2717,7 +2717,7 @@ exception_t decodeARMMMUInvocation(word_t invLabel, word_t length, cptr_t cptr,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER
|
||||
#ifdef CONFIG_KERNEL_LOG_BUFFER
|
||||
exception_t benchmark_arch_map_logBuffer(word_t frame_cptr)
|
||||
{
|
||||
lookupCapAndSlot_ret_t lu_ret;
|
||||
@@ -2776,7 +2776,7 @@ exception_t benchmark_arch_map_logBuffer(word_t frame_cptr)
|
||||
|
||||
return EXCEPTION_NONE;
|
||||
}
|
||||
#endif /* CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER */
|
||||
#endif /* CONFIG_KERNEL_LOG_BUFFER */
|
||||
|
||||
#ifdef CONFIG_DEBUG_BUILD
|
||||
void kernelPrefetchAbort(word_t pc) VISIBLE;
|
||||
|
||||
@@ -34,9 +34,9 @@ pde_t armKSGlobalPD[BIT(PD_INDEX_BITS)] ALIGN_BSS(BIT(seL4_PageDirBits));
|
||||
/* The global, privileged, page table. */
|
||||
pte_t armKSGlobalPT[BIT(PT_INDEX_BITS)] ALIGN_BSS(BIT(seL4_PageTableBits));
|
||||
|
||||
#ifdef CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER
|
||||
#ifdef CONFIG_KERNEL_LOG_BUFFER
|
||||
pte_t armKSGlobalLogPT[BIT(PT_INDEX_BITS)] ALIGN_BSS(BIT(seL4_PageTableBits));
|
||||
#endif /* CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER */
|
||||
#endif /* CONFIG_KERNEL_LOG_BUFFER */
|
||||
|
||||
#else
|
||||
/* The global, hypervisor, level 1 page table */
|
||||
|
||||
@@ -186,7 +186,7 @@ finaliseCap_ret_t Arch_finaliseCap(cap_t cap, bool_t final)
|
||||
|
||||
case cap_frame_cap:
|
||||
if (cap_frame_cap_get_capFMappedASID(cap)) {
|
||||
#ifdef CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER
|
||||
#ifdef CONFIG_KERNEL_LOG_BUFFER
|
||||
/* If the last cap to the user-level log buffer frame is being revoked,
|
||||
* reset the ksLog so that the kernel doesn't log anymore
|
||||
*/
|
||||
|
||||
@@ -2526,7 +2526,7 @@ void Arch_userStackTrace(tcb_t *tptr)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER)
|
||||
#if defined(CONFIG_KERNEL_LOG_BUFFER)
|
||||
exception_t benchmark_arch_map_logBuffer(word_t frame_cptr)
|
||||
{
|
||||
lookupCapAndSlot_ret_t lu_ret;
|
||||
@@ -2580,5 +2580,5 @@ exception_t benchmark_arch_map_logBuffer(word_t frame_cptr)
|
||||
invalidateTranslationSingle(KS_LOG_PPTR);
|
||||
return EXCEPTION_NONE;
|
||||
}
|
||||
#endif /* CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER */
|
||||
#endif /* CONFIG_KERNEL_LOG_BUFFER */
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ pude_t armKSGlobalKernelPUD[BIT(PUD_INDEX_BITS)] ALIGN_BSS(BIT(seL4_PUDBits));
|
||||
pde_t armKSGlobalKernelPDs[BIT(PUD_INDEX_BITS)][BIT(PD_INDEX_BITS)] ALIGN_BSS(BIT(seL4_PageDirBits));
|
||||
pte_t armKSGlobalKernelPT[BIT(PT_INDEX_BITS)] ALIGN_BSS(BIT(seL4_PageTableBits));
|
||||
|
||||
#ifdef CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER
|
||||
#ifdef CONFIG_KERNEL_LOG_BUFFER
|
||||
pde_t *armKSGlobalLogPDE = &armKSGlobalKernelPDs[BIT(PUD_INDEX_BITS) - 1][BIT(PD_INDEX_BITS) - 2];
|
||||
compile_assert(log_pude_is_correct_preallocated_pude,
|
||||
GET_PUD_INDEX(KS_LOG_PPTR) == BIT(PUD_INDEX_BITS) - 1);
|
||||
|
||||
@@ -217,7 +217,7 @@ BOOT_CODE bool_t map_kernel_window(
|
||||
phys = PADDR_BASE;
|
||||
idx = PPTR_BASE >> LARGE_PAGE_BITS;
|
||||
|
||||
/* PPTR_TOP differs whether CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER
|
||||
/* PPTR_TOP differs whether CONFIG_KERNEL_LOG_BUFFER
|
||||
* is enabled or not.
|
||||
*/
|
||||
while (idx < (PPTR_TOP >> LARGE_PAGE_BITS)) {
|
||||
@@ -242,7 +242,7 @@ BOOT_CODE bool_t map_kernel_window(
|
||||
/* crosscheck whether we have mapped correctly so far */
|
||||
assert(phys == PADDR_TOP);
|
||||
|
||||
#ifdef CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER
|
||||
#ifdef CONFIG_KERNEL_LOG_BUFFER
|
||||
/* Map global page table for the log buffer */
|
||||
pde = pde_pde_pt_new(
|
||||
pptr_to_paddr(ia32KSGlobalLogPT), /* pt_base_address */
|
||||
@@ -259,7 +259,7 @@ BOOT_CODE bool_t map_kernel_window(
|
||||
phys += BIT(LARGE_PAGE_BITS);
|
||||
assert(idx == (KS_LOG_PPTR >> LARGE_PAGE_BITS));
|
||||
idx++;
|
||||
#endif /* CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER */
|
||||
#endif /* CONFIG_KERNEL_LOG_BUFFER */
|
||||
|
||||
#ifdef ENABLE_SMP_SUPPORT
|
||||
/* initialize the TLB bitmap */
|
||||
@@ -656,7 +656,7 @@ exception_t decodeX86ModeMapPage(word_t invLabel, vm_page_size_t page_size, cte_
|
||||
fail("Invalid Page type");
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER
|
||||
#ifdef CONFIG_KERNEL_LOG_BUFFER
|
||||
exception_t benchmark_arch_map_logBuffer(word_t frame_cptr)
|
||||
{
|
||||
lookupCapAndSlot_ret_t lu_ret;
|
||||
@@ -717,4 +717,4 @@ exception_t benchmark_arch_map_logBuffer(word_t frame_cptr)
|
||||
|
||||
return EXCEPTION_NONE;
|
||||
}
|
||||
#endif /* CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER */
|
||||
#endif /* CONFIG_KERNEL_LOG_BUFFER */
|
||||
|
||||
@@ -14,6 +14,6 @@ UP_STATE_DEFINE(paddr_t, ia32KSCurrentPD VISIBLE);
|
||||
pde_t ia32KSGlobalPD[BIT(PD_INDEX_BITS)] ALIGN(BIT(seL4_PageDirBits));
|
||||
pte_t ia32KSGlobalPT[BIT(PT_INDEX_BITS)] ALIGN(BIT(seL4_PageTableBits));
|
||||
|
||||
#ifdef CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER
|
||||
#ifdef CONFIG_KERNEL_LOG_BUFFER
|
||||
pte_t ia32KSGlobalLogPT[BIT(PT_INDEX_BITS)] ALIGN(BIT(seL4_PageTableBits));
|
||||
#endif /* CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER */
|
||||
#endif /* CONFIG_KERNEL_LOG_BUFFER */
|
||||
|
||||
@@ -71,7 +71,7 @@ finaliseCap_ret_t Mode_finaliseCap(cap_t cap, bool_t final)
|
||||
#endif
|
||||
case X86_MappingVSpace:
|
||||
|
||||
#ifdef CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER
|
||||
#ifdef CONFIG_KERNEL_LOG_BUFFER
|
||||
/* If the last cap to the user-level log buffer frame is being revoked,
|
||||
* reset the ksLog so that the kernel doesn't log anymore
|
||||
*/
|
||||
@@ -89,7 +89,7 @@ finaliseCap_ret_t Mode_finaliseCap(cap_t cap, bool_t final)
|
||||
userError("Log buffer frame is invalidated, kernel can't benchmark anymore\n");
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER */
|
||||
#endif /* CONFIG_KERNEL_LOG_BUFFER */
|
||||
|
||||
unmapPage(
|
||||
cap_frame_cap_get_capFSize(cap),
|
||||
|
||||
@@ -108,6 +108,6 @@ char ksIdleThreadSC[CONFIG_MAX_NUM_NODES][BIT(seL4_MinSchedContextBits)] ALIGN(B
|
||||
kernel_entry_t ksKernelEntry;
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifdef CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER
|
||||
#ifdef CONFIG_KERNEL_LOG_BUFFER
|
||||
paddr_t ksUserLogBuffer;
|
||||
#endif /* CONFIG_BENCHMARK_USE_KERNEL_LOG_BUFFER */
|
||||
#endif /* CONFIG_KERNEL_LOG_BUFFER */
|
||||
|
||||
Reference in New Issue
Block a user