fix: disable mm debug log to prevent system lockup due to thingbuf issue (#808)

This commit is contained in:
LoGin 2024-05-11 18:02:13 +08:00 committed by GitHub
parent 37cef00bb4
commit 352ee04918
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 17 deletions

View File

@ -1,17 +1,10 @@
extern crate klog_types; extern crate klog_types;
use core::{ use core::sync::atomic::{compiler_fence, Ordering};
intrinsics::unlikely,
sync::atomic::{compiler_fence, Ordering},
};
use klog_types::{AllocatorLog, AllocatorLogType, LogSource, MMLogChannel}; use klog_types::{AllocatorLog, AllocatorLogType, LogSource, MMLogChannel};
use crate::{ use crate::{arch::CurrentTimeArch, process::Pid, time::TimeArch};
arch::CurrentTimeArch,
process::{Pid, ProcessManager},
time::TimeArch,
};
/// 全局的内存分配器日志通道 /// 全局的内存分配器日志通道
/// ///
@ -31,13 +24,14 @@ static __MM_DEBUG_LOG_IDA: ida::IdAllocator = ida::IdAllocator::new(1, usize::MA
/// ///
/// - `log_type`:日志类型 /// - `log_type`:日志类型
/// - `source`:日志来源 /// - `source`:日志来源
pub fn mm_debug_log(log_type: AllocatorLogType, source: LogSource) { pub fn mm_debug_log(_log_type: AllocatorLogType, _source: LogSource) {
let pid = if unlikely(!ProcessManager::initialized()) { // todo: 由于目前底层的thingbuf存在卡死的问题因此这里暂时注释掉。
Some(Pid::new(0)) // let pid = if unlikely(!ProcessManager::initialized()) {
} else { // Some(Pid::new(0))
Some(ProcessManager::current_pcb().pid()) // } else {
}; // Some(ProcessManager::current_pcb().pid())
MMDebugLogManager::log(log_type, source, pid); // };
// MMDebugLogManager::log(log_type, source, pid);
} }
#[derive(Debug)] #[derive(Debug)]
@ -54,6 +48,7 @@ impl MMDebugLogManager {
/// - `log_type`:日志类型 /// - `log_type`:日志类型
/// - `source`:日志来源 /// - `source`:日志来源
/// - `pid`日志来源的pid /// - `pid`日志来源的pid
#[allow(dead_code)]
pub fn log(log_type: AllocatorLogType, source: LogSource, pid: Option<Pid>) { pub fn log(log_type: AllocatorLogType, source: LogSource, pid: Option<Pid>) {
let id = __MM_DEBUG_LOG_IDA.alloc().unwrap(); let id = __MM_DEBUG_LOG_IDA.alloc().unwrap();
let log = AllocatorLog::new( let log = AllocatorLog::new(

View File

@ -147,6 +147,7 @@ impl ProcessManager {
} }
/// 判断进程管理器是否已经初始化完成 /// 判断进程管理器是否已经初始化完成
#[allow(dead_code)]
pub fn initialized() -> bool { pub fn initialized() -> bool {
unsafe { __PROCESS_MANAGEMENT_INIT_DONE } unsafe { __PROCESS_MANAGEMENT_INIT_DONE }
} }

View File

@ -6,7 +6,7 @@
"BuildFromSource": { "BuildFromSource": {
"Git": { "Git": {
"url" : "https://git.mirrors.dragonos.org.cn/DragonOS-Community/Held.git", "url" : "https://git.mirrors.dragonos.org.cn/DragonOS-Community/Held.git",
"revision": "76304e995f" "revision": "f192df4"
} }
} }
}, },