Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is a Store Operation permitted between lr and sc? #2069

Open
kl123s opened this issue May 5, 2023 · 2 comments
Open

Is a Store Operation permitted between lr and sc? #2069

kl123s opened this issue May 5, 2023 · 2 comments
Assignees

Comments

@kl123s
Copy link

kl123s commented May 5, 2023

Is your feature request related to a problem? Please describe.
香山南湖dcache对应地址块在接受到lr指令后,对该地址进行store操作,再进行sc指令操作会匹配成功,不会返回错误。
疑问:1 单核的lr指令过后,store指令只在storebuffer上操作 ,无法立即写入 dcache,此原子操作功能是否有问题?
2 即使store指令能在lr锁定时间进入dcache,但目前没有看到内部代码对这进入的store指令检测的功能?
3 对于双核的原子指令操作:两个内核之间没有对这原子操作进行通信的功能,这样双核的原子操作功能需要怎样进行实现?

[TRANSLATION]
Dcache of Nanhu will not throw an error when executing [lr - store - sc] operations on the same address.

Questions:

  1. After a single-core lr instruction, store instruction only operates on store buffer and cannot immediately write to dcache. Is there an issue with the atomic operation functionality?
  2. Even if the store instruction can enter the dcache during the lr lock time, there is currently no code for detecting this entering store instruction.
  3. Regarding atomic instruction operations for dual cores: There is no communication between the two cores for these atomic operations. How should the atomic operation functionality for dual cores be implemented?
@AugustusWillisWang
Copy link
Member

AugustusWillisWang commented May 8, 2023

1.2. RISC-V 手册没有规定同一 hart 内 program order 在 LR 之后的 store 对 SC 指令执行结果的影响。
3. 目前香山的原子操作靠某个核的数据缓存独占缓存行来实现。uncache 原子操作在南湖中尚不被支持。

[TRANSLATION]
1.2. The RISC-V manual does not specify the impact of [program-ordered stores after an LR instruction] on the execution result of an SC instruction within the same hart.
3. Currently, atomic operations in Xiangshan rely on a core's data cache exclusivity. Uncached atomic operations are not yet supported in Nanhu.

@kl123s
Copy link
Author

kl123s commented May 8, 2023

1.2. RISC-V 手册没有规定同一 hart 内 program order 在 LR 之后的 store 对 SC 指令执行结果的影响。 3. 目前香山的原子操作靠某个核的数据缓存独占缓存行来实现。uncache 原子操作在南湖中尚不被支持。
好的谢谢。
针对第三个问题,cache地址空间的原子操作是在dcache内部进行实现,那如果多核的原子操作,核1对该地址块进行原子操作,该原子操作信息通过什么方式进行共享至其他核,来实现其多核的原子操作?
还是说,在核1进行原子操作的时候,其他核不会执行原子操作?

@Ivyfeather Ivyfeather changed the title 请教一下 lr sc之间进行store是否合理? Is a Store Operation permitted between lr and sc? Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants