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

arch: add loongarch support. #1

Open
wants to merge 3 commits into
base: la64/master
Choose a base branch
from
Open

arch: add loongarch support. #1

wants to merge 3 commits into from

Conversation

cnmushiba
Copy link
Collaborator

@cnmushiba cnmushiba commented Aug 12, 2021

This patch adds support for loongarch for fio. This is tested by building
FIO on an loongarch Debian 10 system.

@loongarch64/dev-team 请帮忙review并测试,谢谢。

如果做make fulltest,请打开内核下列选项
CONFIG_BLK_DEV_NULL_BLK=m
CONFIG_BLK_DEV_ZONED=y

NOTE:
其中sudo t/zbd/run-tests-against-nullb -s 4时,会出现"null_blk does not support conventional zones",这个问题看着和本次修改无关。

Copy link
Member

@xen0n xen0n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems this is not affected by bitness at all, could you please remove all mentions of "64"?

@cnmushiba
Copy link
Collaborator Author

Seems this is not affected by bitness at all, could you please remove all mentions of "64"?

我觉得大佬说的对

@cnmushiba cnmushiba changed the title arch: add loongarch64 support. arch: add loongarch support. Aug 13, 2021
@yetist yetist requested a review from a team August 13, 2021 06:48
Copy link
Member

@xen0n xen0n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arch: add LoongArch support

Signed-off-by 行留着

另外参考下 aarch64、ia64、x86 的头文件,看下有一堆别的定义,暴露平台更多功能,合适的建议都加上。比如叫 ffz 啥啥啥的那个函数,看样子就是 ctz 这种指令可以胜任,不加感觉亏了,移植不彻底。


#define read_barrier() __asm__ __volatile__("dbar 0": : :"memory")
#define write_barrier() __asm__ __volatile__("dbar 0": : :"memory")
#define nop __asm__ __volatile__("nop")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

看别的好多架构好像都直接写的 do {} while (0) 你觉得如何?看下代码里实际都怎么使用这边定义的宏的,尽量不要无脑移植

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我感觉不好,这得看具体应用语境,这几个宏的调用本身就很简单,并不复杂。

@cnmushiba
Copy link
Collaborator Author

arch: add LoongArch support

Signed-off-by 行留着

另外参考下 aarch64、ia64、x86 的头文件,看下有一堆别的定义,暴露平台更多功能,合适的建议都加上。比如叫 ffz 啥啥啥的那个函数,看样子就是 ctz 这种指令可以胜任,不加感觉亏了,移植不彻底。

这个是我没有仔细看指令集文档,这个可以用ctz优化一下。

@cnmushiba cnmushiba force-pushed the dev-master branch 3 times, most recently from 8968e70 to 58a910b Compare August 16, 2021 03:31
This patch adds support for loongarch for fio.  This is tested by building
FIO on an loongarch Debian 10 system.

Signed-off-by: wangguofeng <[email protected]>
#define write_barrier() __asm__ __volatile__("dbar 0": : :"memory")
#define nop __asm__ __volatile__("nop")

#if __loongarch_xlen == 64
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

确认下新工具链是看这个?手册上叫GRLEN的东西到代码里就叫xlen?最早我拿到的正式公开源码是没这个的我记得

Copy link
Collaborator Author

@cnmushiba cnmushiba Aug 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/loongson/glibc/pull/10/files ,公布出来的又给删了。。。,我有句话不知当不当讲,算了不讲了

Copy link
Member

@xen0n xen0n Aug 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我去。。。这帮人才,RV 叫 xlen 的东西,不想借鉴(降低别人学习成本)也就算了,自己手册上写了个 GRLEN,然后现在既不给用 xlen 也不给用 grlen,让人用 __WORDSIZE???

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

按道理gcc应该内置这个宏的。。。,现在是啥都没了。。。,我很难过

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/loongson/glibc/pull/10/files ,公布出来的又给删了。。。,我有句话不知当不当讲,算了不讲了

为啥要删了呢? 直接去问问 ^^

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我觉得不妨先加着,工具链那边感觉干活不讲一致性,而且朝令夕改。不能就着他们的代码行为,下游也凑合,应该基于这边的具体使用场景给他们改进做事方式的压力。

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/loongson/glibc/pull/10/files ,公布出来的又给删了。。。,我有句话不知当不当讲,算了不讲了

是我删的,C库那个文件只是用来定义WORDSIZE的。

如果要定义类似 xlen 的宏,应该在gcc中定义,具体请参考riscv:

https://github.com/loongson/glibc/blob/c8793900942229e22e54624c17fa5c9ce5bc6576/sysdeps/riscv/bits/wordsize.h#L20
https://github.com/loongson/gcc/blob/ac1026d11b3a7bc40609b0177c390b37964037af/gcc/config/riscv/riscv-c.c#L57-L59

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/loongson/glibc/pull/10/files ,公布出来的又给删了。。。,我有句话不知当不当讲,算了不讲了

为啥要删了呢? 直接去问问 ^^

那个加错地方了,应该加在gcc的内置宏里的

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yetist 新的预定义符号预期叫啥?谁来改?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议在gcc那边讨论一下

@cnmushiba
Copy link
Collaborator Author

32位功能不做保证,没有验证环境,不过从ffz的描述来看,不知道合适不?

@xen0n
Copy link
Member

xen0n commented Nov 10, 2021

Update: loongson/LoongArch-Documentation#25loongson/LoongArch-Documentation#28 等等一系列 PR 在讨论相关的预处理器符号了。

@yetist
Copy link

yetist commented Mar 1, 2022

这个有更新吗?

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

Successfully merging this pull request may close these issues.

4 participants