
From: Konstantin Meskhidze <konstantin.meskhidze@huawei.com> hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/IC5EHB ----------------------------------------- Add xsched.h with xsched related prints. Add XSCHED_DEBUG_PRINTS configuration to switch_on/off xsched prints. Signed-off-by: Konstantin Meskhidze <konstantin.meskhidze@huawei.com> Signed-off-by: Hui Tang <tanghui20@.huawei.com> --- include/linux/xsched.h | 51 ++++++++++++++++++++++++++++++++++++++++++ kernel/xsched/Kconfig | 11 +++++++++ 2 files changed, 62 insertions(+) create mode 100644 include/linux/xsched.h diff --git a/include/linux/xsched.h b/include/linux/xsched.h new file mode 100644 index 000000000000..c2f56678dda4 --- /dev/null +++ b/include/linux/xsched.h @@ -0,0 +1,51 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LINUX_XSCHED_H__ +#define __LINUX_XSCHED_H__ + +#ifndef pr_fmt +#define pr_fmt(fmt) fmt +#endif + +#define XSCHED_ERR_PREFIX "XSched [ERROR]: " +#define XSCHED_ERR(fmt, ...) \ + pr_err(XSCHED_ERR_PREFIX fmt, ##__VA_ARGS__) + +#define XSCHED_WARN_PREFIX "XSched [WARNING]: " +#define XSCHED_WARN(fmt, ...) \ + pr_warn(XSCHED_WARN_PREFIX fmt, ##__VA_ARGS__) + +/* Debug specific prints that are enabled + * if CONFIG_XSCHED_DEBUG_PRINTS = y + */ +#ifdef CONFIG_XSCHED_DEBUG_PRINTS + +#define XSCHED_INFO_PREFIX "XSched [INFO]: " +#define XSCHED_INFO(fmt, ...) \ + pr_info(XSCHED_INFO_PREFIX fmt, ##__VA_ARGS__) + +#define XSCHED_DEBUG_PREFIX "XSched [DEBUG]: " +#define XSCHED_DEBUG(fmt, ...) \ + pr_debug(XSCHED_DEBUG_PREFIX fmt, ##__VA_ARGS__) + +#define XSCHED_CALL_STUB() \ + XSCHED_INFO("-----* %s @ %s called *-----\n", __func__, __FILE__) + +#define XSCHED_EXIT_STUB() \ + XSCHED_INFO("-----* %s @ %s exited *-----\n", __func__, __FILE__) + +#define XSCHED_TRACE_PREFIX "XSCHED [TRACE]: " + +#define __XSCHED_TRACE(fmt, ...) \ + pr_info(XSCHED_TRACE_PREFIX fmt, ##__VA_ARGS__) +#define XSCHED_TRACE(event, xcu, xse, vs, type) \ + __XSCHED_TRACE("event_type=%u %u %s %s; xcu=%u; xse=%u; vs=%u; type=%s;", \ + xse, vs, event, type, xcu, xse, vs, type) +#else +#define XSCHED_INFO(fmt, ...) +#define XSCHED_DEBUG(fmt, ...) +#define XSCHED_EXIT_STUB() +#define XSCHED_CALL_STUB() +#define __XSCHED_TRACE(fmt, ...) +#endif + +#endif /* !__LINUX_XSCHED_H__ */ diff --git a/kernel/xsched/Kconfig b/kernel/xsched/Kconfig index 9ec1011e85bf..cbe937a90d80 100644 --- a/kernel/xsched/Kconfig +++ b/kernel/xsched/Kconfig @@ -25,3 +25,14 @@ config XCU_VSTREAM Requires XCU_SCHEDULER to be enabled. May increase kernel memory usage. Recommended for high-throughput XPU workloads. If unsure, say N. + +config XSCHED_DEBUG_PRINTS + bool "Enable info and debug prints in XSched mechanism for analysis and debugging purposes" + default n + depends on XCU_SCHEDULER + help + This option enables verbose logging (info and debug levels) for the XSched + scheduling mechanism. It is primarily used for debugging performance issues, + analyzing task scheduling behavior, and tracking internal state changes. + Enabling this may impact performance due to increased log output. + If unsure, say N. -- 2.34.1