gpt4 book ai didi

debugging - 是否可以调试 Intel TSX?

转载 作者:行者123 更新时间:2023-12-01 00:09:43 25 4
gpt4 key购买 nike

我想利用 Intel TSX 编写无锁代码。

xbegin
my_inst1
my_inst2
xend

但是,由于某些原因,我在 TSX 执行 TSX 中的一条指令中止。

我想知道哪条指令产生了故障并使 TSX 中止。

有没有办法知道哪条指令产生了错误?

我的第一次尝试是在 TSX 区域中执行每条指令后递增全局计数器。但是,当故障发生时,对计数器的更新也会回滚,因为它会回滚 TSX 区域中的每次写入。

调试 TSX 执行有什么技巧吗?

最佳答案

使用perf record (或访问硬件性能计数器的其他方式)对于像 rtm_retired.aborted 这样的事件对于任何中止,和/或 tx_mem.abort_conflicttx_mem.abort_capacity看看其中任何一个是否是导致流产的原因。 (您可以在一次运行中记录多个事件,然后查看 perf report 中触发的事件)

tx_exec.misc1..3 也可能是相关的。来自 perf list在我的 Skylake 桌面上。

tx_exec.misc1
[Counts the number of times a class of instructions that may cause a transactional abort was executed. Since this is the count of execution, it may not always cause a transactional abort]

tx_exec.misc2
[Counts the number of times a class of instructions (e.g., vzeroupper) that may cause a transactional abort was executed inside a transactional region]

tx_exec.misc3
[Counts the number of times an instruction execution caused the transactional nest count supported to be exceeded]



另见 https://oprofile.sourceforge.io/docs/intel-skylake-events.php

您可能需要调整一些东西以获得合理数量的样本,用于不经常触发的事件。我还没有尝试过,但希望计数应该显示在有罪指令本身上。 rtm_retired.aborted是一个精确的事件;其他人在 perf list 中没有这样说输出。

一些 RTM/TSX 事件仅适用于 HLE(硬件锁定省略,您在 lock ed 指令上放置一个额外的前缀)。

使用 perf list并在输出中搜索“abort”以查找相关事件。

关于debugging - 是否可以调试 Intel TSX?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59777566/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com