As Andrew mentioned, DEBUG() is NOT safe for MP. Generally, kernel modules are not suggested to use DEBUG() in AP code becasue they are not the decision maker on the final DebuLib instance. If you could make sure the DebugLib instance platform selected only based on I/O or MMIO operations, you could use DEBUG() in AP for debuging or testing purpose. To avoid mess output message due to multiple APs, you may use spinlock to protect DEBUG() invoking. For runtime (for example SMM AP code), the upper method may not work becaseu OS may take control on Serial Port. fanjianfeng@byosoft.com.cn 发件人: Yoshinoya 发送时间: 2024-06-03 16:24 收件人: devel; fanjianfeng 主题: Re:回复: [edk2-devel] Is DEBUG output function safe for MP case? Hi, Jeff: If AP code use base-typed debuglib, then it's mp safe? Thanks At 2024-05-31 14:33:40, "Jeff Fan via groups.io" wrote: AP cannot run any UEFI Service. Please make sure AP code use base-typed DebugLib instance (Such as BaseDebugLibSerialport.inf from MdePkg) fanjianfeng@byosoft.com.cn 发件人: Yoshinoya 发送时间: 2024-05-31 14:22 收件人: devel@edk2.groups.io 主题: [edk2-devel] Is DEBUG output function safe for MP case? Hello I ask for help for debug output in multi-core case. Is the current DEBUG marco safe for AP Cores to output message? If the output message is too long, it takes too much time, will it cause some abnormal exception? Thanks -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#119441): https://edk2.groups.io/g/devel/message/119441 Mute This Topic: https://groups.io/mt/106475080/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-