如何在龍芯派上給1c編譯

回复

cyberhero 回复了问题 • 1 人关注 • 1 个回复 • 86 次浏览 • 2019-01-15 07:31 • 来自相关话题

龙芯 Linux 内核 VDSO 现状测试

xen0n 发表了文章 • 0 个评论 • 69 次浏览 • 2019-01-13 11:13 • 来自相关话题

好久之前记得龙芯上 VDSO 支持很有问题,前一阵终于获得少量空闲时间,又测了一下,发现还是不行,跑这么一个脚本发现大量 clock_gettime 系统调用。(amd64 上除了用于实现 sleep 的 select 之外没有任何 gettimeofday ...查看全部
好久之前记得龙芯上 VDSO 支持很有问题,前一阵终于获得少量空闲时间,又测了一下,发现还是不行,跑这么一个脚本发现大量 clock_gettime 系统调用。(amd64 上除了用于实现 sleep 的 select 之外没有任何 gettimeofday 或者 clock_gettime 的调用。)
#!/usr/bin/env python3

import time

for i in range(100):
time.sleep(0.01)
_ = time.time()

翻 glibc 源码时候 git log 看到一个叫 vdsotest 的工具,于是弄下来跑了一遍。
 
测试环境:
  
clock-gettime-monotonic: syscall: 409 nsec/callclock-gettime-monotonic:    libc: 476 nsec/callclock-gettime-monotonic:    vdso: 462 nsec/callNote: vDSO version of clock_getres not foundclock-getres-monotonic: syscall: 323 nsec/callclock-getres-monotonic:    libc: 346 nsec/callclock-getres-monotonic:    vdso: not testedNote: vDSO version of clock_getres not foundNote: vDSO version of clock_getres not foundclock-gettime-monotonic-coarse: syscall: 374 nsec/callclock-gettime-monotonic-coarse:    libc: 115 nsec/callclock-gettime-monotonic-coarse:    vdso: 98 nsec/callpassing UINTPTR_MAX to clock_gettime (VDSO): terminated by unexpected signal 10clock-gettime-monotonic-coarse/abi: 1 failures/inconsistencies encounteredNote: vDSO version of clock_getres not foundclock-getres-monotonic-coarse: syscall: 357 nsec/callclock-getres-monotonic-coarse:    libc: 379 nsec/callclock-getres-monotonic-coarse:    vdso: not testedNote: vDSO version of clock_getres not foundNote: vDSO version of clock_getres not foundclock-gettime-monotonic-raw: syscall: 406 nsec/callclock-gettime-monotonic-raw:    libc: 455 nsec/callclock-gettime-monotonic-raw:    vdso: 425 nsec/callNote: vDSO version of clock_getres not foundclock-getres-monotonic-raw: syscall: 323 nsec/callclock-getres-monotonic-raw:    libc: 346 nsec/callclock-getres-monotonic-raw:    vdso: not testedNote: vDSO version of clock_getres not foundNote: vDSO version of clock_getres not foundclock-gettime-tai: syscall: 422 nsec/callclock-gettime-tai:    libc: 472 nsec/callclock-gettime-tai:    vdso: 449 nsec/callNote: vDSO version of clock_getres not foundclock-getres-tai: syscall: 323 nsec/callclock-getres-tai:    libc: 345 nsec/callclock-getres-tai:    vdso: not testedNote: vDSO version of clock_getres not foundNote: vDSO version of clock_getres not foundclock-gettime-boottime: syscall: 421 nsec/callclock-gettime-boottime:    libc: 471 nsec/callclock-gettime-boottime:    vdso: 450 nsec/callNote: vDSO version of clock_getres not foundclock-getres-boottime: syscall: 324 nsec/callclock-getres-boottime:    libc: 346 nsec/callclock-getres-boottime:    vdso: not testedNote: vDSO version of clock_getres not foundNote: vDSO version of clock_getres not foundclock-gettime-realtime: syscall: 405 nsec/callclock-gettime-realtime:    libc: 474 nsec/callclock-gettime-realtime:    vdso: 457 nsec/callNote: vDSO version of clock_getres not foundclock-getres-realtime: syscall: 323 nsec/callclock-getres-realtime:    libc: 348 nsec/callclock-getres-realtime:    vdso: not testedNote: vDSO version of clock_getres not foundNote: vDSO version of clock_getres not foundclock-gettime-realtime-coarse: syscall: 367 nsec/callclock-gettime-realtime-coarse:    libc: 114 nsec/callclock-gettime-realtime-coarse:    vdso: 97 nsec/callpassing UINTPTR_MAX to clock_gettime (VDSO): terminated by unexpected signal 10clock-gettime-realtime-coarse/abi: 1 failures/inconsistencies encounteredNote: vDSO version of clock_getres not foundclock-getres-realtime-coarse: syscall: 357 nsec/callclock-getres-realtime-coarse:    libc: 379 nsec/callclock-getres-realtime-coarse:    vdso: not testedNote: vDSO version of clock_getres not foundNote: vDSO version of clock_getres not foundNote: vDSO version of getcpu not foundgetcpu: syscall: 274 nsec/callgetcpu:    libc: 287 nsec/callgetcpu:    vdso: not testedNote: vDSO version of getcpu not foundNote: vDSO version of getcpu not foundgettimeofday: syscall: 406 nsec/callgettimeofday:    libc: 455 nsec/callgettimeofday:    vdso: 440 nsec/callgettimeofday(valid, UINTPTR_MAX) (VDSO): unexpected return value -14, expected -1gettimeofday(valid, UINTPTR_MAX) (VDSO): exited with status 1, expected 0gettimeofday(valid, page (PROT_NONE)) (VDSO): unexpected return value -14, expected -1gettimeofday(valid, page (PROT_NONE)) (VDSO): exited with status 1, expected 0gettimeofday(valid, page (PROT_READ)) (VDSO): unexpected return value -14, expected -1gettimeofday(valid, page (PROT_READ)) (VDSO): exited with status 1, expected 0gettimeofday(NULL, UINTPTR_MAX) (VDSO): unexpected return value -14, expected -1gettimeofday(NULL, UINTPTR_MAX) (VDSO): exited with status 1, expected 0gettimeofday(NULL, page (PROT_NONE)) (VDSO): unexpected return value -14, expected -1gettimeofday(NULL, page (PROT_NONE)) (VDSO): exited with status 1, expected 0gettimeofday(NULL, page (PROT_READ)) (VDSO): unexpected return value -14, expected -1gettimeofday(NULL, page (PROT_READ)) (VDSO): exited with status 1, expected 0gettimeofday(UINTPTR_MAX, valid) (VDSO): unexpected return value -14, expected -1gettimeofday(UINTPTR_MAX, valid) (VDSO): exited with status 1, expected 0gettimeofday(UINTPTR_MAX, NULL) (VDSO): unexpected return value -14, expected -1gettimeofday(UINTPTR_MAX, NULL) (VDSO): exited with status 1, expected 0gettimeofday(UINTPTR_MAX, UINTPTR_MAX) (VDSO): unexpected return value -14, expected -1gettimeofday(UINTPTR_MAX, UINTPTR_MAX) (VDSO): exited with status 1, expected 0gettimeofday(UINTPTR_MAX, page (PROT_NONE)) (VDSO): unexpected return value -14, expected -1gettimeofday(UINTPTR_MAX, page (PROT_NONE)) (VDSO): exited with status 1, expected 0Failure threshold (10) reached; stopping test.gettimeofday(UINTPTR_MAX, page (PROT_READ)) (VDSO): unexpected return value -14, expected -1gettimeofday(UINTPTR_MAX, page (PROT_READ)) (VDSO): exited with status 1, expected 0Failure threshold (10) reached; stopping test.gettimeofday(page (PROT_NONE), valid) (VDSO): unexpected return value -14, expected -1gettimeofday(page (PROT_NONE), valid) (VDSO): exited with status 1, expected 0Failure threshold (10) reached; stopping test.gettimeofday(page (PROT_NONE), NULL) (VDSO): unexpected return value -14, expected -1gettimeofday(page (PROT_NONE), NULL) (VDSO): exited with status 1, expected 0Failure threshold (10) reached; stopping test.gettimeofday(page (PROT_NONE), UINTPTR_MAX) (VDSO): unexpected return value -14, expected -1gettimeofday(page (PROT_NONE), UINTPTR_MAX) (VDSO): exited with status 1, expected 0Failure threshold (10) reached; stopping test.gettimeofday(page (PROT_NONE), page (PROT_NONE)) (VDSO): unexpected return value -14, expected -1gettimeofday(page (PROT_NONE), page (PROT_NONE)) (VDSO): exited with status 1, expected 0Failure threshold (10) reached; stopping test.gettimeofday(page (PROT_NONE), page (PROT_READ)) (VDSO): unexpected return value -14, expected -1gettimeofday(page (PROT_NONE), page (PROT_READ)) (VDSO): exited with status 1, expected 0Failure threshold (10) reached; stopping test.gettimeofday(page (PROT_READ), valid) (VDSO): unexpected return value -14, expected -1gettimeofday(page (PROT_READ), valid) (VDSO): exited with status 1, expected 0Failure threshold (10) reached; stopping test.gettimeofday(page (PROT_READ), NULL) (VDSO): unexpected return value -14, expected -1gettimeofday(page (PROT_READ), NULL) (VDSO): exited with status 1, expected 0Failure threshold (10) reached; stopping test.gettimeofday(page (PROT_READ), UINTPTR_MAX) (VDSO): unexpected return value -14, expected -1gettimeofday(page (PROT_READ), UINTPTR_MAX) (VDSO): exited with status 1, expected 0Failure threshold (10) reached; stopping test.gettimeofday(page (PROT_READ), page (PROT_NONE)) (VDSO): unexpected return value -14, expected -1gettimeofday(page (PROT_READ), page (PROT_NONE)) (VDSO): exited with status 1, expected 0Failure threshold (10) reached; stopping test.gettimeofday(page (PROT_READ), page (PROT_READ)) (VDSO): unexpected return value -14, expected -1gettimeofday(page (PROT_READ), page (PROT_READ)) (VDSO): exited with status 1, expected 0Failure threshold (10) reached; stopping test.gettimeofday/abi: 21 failures/inconsistencies encountered
  这个结果显然有改进空间,主要是 clock_gettime 系统调用在各种程序里用得还是不少的,要求实时性的应用,如音视频应用,使用更多。让获取时间操作开销尽量减少,对系统交互体验一定有所帮助。  2019.01.15 编辑:新增我 MBP 上 Docker for Mac(Linux 虚拟机)以及我一台服务器上的测量结果。  实验表明 amd64 架构的裸金属上,以下这几项的 VDSO 调用是有优化的:
  • clock-gettime-monotonic (约 30ns)
  • clock-gettime-monotonic-coarse (<10ns)
  • clock-gettime-realtime (约 30ns)
  • clock-gettime-realtime-coarse (<10ns)
  • getcpu (约 10ns)
  • gettimeofday (约 30ns)

 
这台机器的 CPU 是 Xeon X3323,标称频率 2.5GHz,可供参考。个人感觉龙芯优化上来了应该完全没问题。
 
MBP Docker for Mac 容器(随便用了个 golang:latest,Debian Stretch):
clock-gettime-monotonic: syscall: 3222 nsec/call
clock-gettime-monotonic: libc: 3234 nsec/call
clock-gettime-monotonic: vdso: 3246 nsec/call
Note: vDSO version of clock_getres not found
clock-getres-monotonic: syscall: 282 nsec/call
clock-getres-monotonic: libc: 286 nsec/call
clock-getres-monotonic: vdso: not tested
Note: vDSO version of clock_getres not found
Note: vDSO version of clock_getres not found
clock-gettime-monotonic-coarse: syscall: 288 nsec/call
clock-gettime-monotonic-coarse: libc: 4 nsec/call
clock-gettime-monotonic-coarse: vdso: 3 nsec/call
Note: vDSO version of clock_getres not found
clock-getres-monotonic-coarse: syscall: 293 nsec/call
clock-getres-monotonic-coarse: libc: 293 nsec/call
clock-getres-monotonic-coarse: vdso: not tested
Note: vDSO version of clock_getres not found
Note: vDSO version of clock_getres not found
clock-gettime-monotonic-raw: syscall: 3229 nsec/call
clock-gettime-monotonic-raw: libc: 3263 nsec/call
clock-gettime-monotonic-raw: vdso: 3203 nsec/call
Note: vDSO version of clock_getres not found
clock-getres-monotonic-raw: syscall: 282 nsec/call
clock-getres-monotonic-raw: libc: 282 nsec/call
clock-getres-monotonic-raw: vdso: not tested
Note: vDSO version of clock_getres not found
Note: vDSO version of clock_getres not found
clock-gettime-tai: syscall: 3209 nsec/call
clock-gettime-tai: libc: 3246 nsec/call
clock-gettime-tai: vdso: 3233 nsec/call
Note: vDSO version of clock_getres not found
clock-getres-tai: syscall: 278 nsec/call
clock-getres-tai: libc: 279 nsec/call
clock-getres-tai: vdso: not tested
Note: vDSO version of clock_getres not found
Note: vDSO version of clock_getres not found
clock-gettime-boottime: syscall: 3245 nsec/call
clock-gettime-boottime: libc: 3219 nsec/call
clock-gettime-boottime: vdso: 3275 nsec/call
Note: vDSO version of clock_getres not found
clock-getres-boottime: syscall: 276 nsec/call
clock-getres-boottime: libc: 281 nsec/call
clock-getres-boottime: vdso: not tested
Note: vDSO version of clock_getres not found
Note: vDSO version of clock_getres not found
clock-gettime-realtime: syscall: 3222 nsec/call
clock-gettime-realtime: libc: 3250 nsec/call
clock-gettime-realtime: vdso: 3216 nsec/call
Note: vDSO version of clock_getres not found
clock-getres-realtime: syscall: 282 nsec/call
clock-getres-realtime: libc: 283 nsec/call
clock-getres-realtime: vdso: not tested
Note: vDSO version of clock_getres not found
Note: vDSO version of clock_getres not found
clock-gettime-realtime-coarse: syscall: 288 nsec/call
clock-gettime-realtime-coarse: libc: 4 nsec/call
clock-gettime-realtime-coarse: vdso: 3 nsec/call
Note: vDSO version of clock_getres not found
clock-getres-realtime-coarse: syscall: 290 nsec/call
clock-getres-realtime-coarse: libc: 291 nsec/call
clock-getres-realtime-coarse: vdso: not tested
Note: vDSO version of clock_getres not found
Note: vDSO version of clock_getres not found
getcpu: syscall: 277 nsec/call
getcpu: libc: 11 nsec/call
getcpu: vdso: 9 nsec/call
gettimeofday: syscall: 3184 nsec/call
gettimeofday: libc: 3217 nsec/call
gettimeofday: vdso: 3222 nsec/call
gettimeofday(valid, UINTPTR_MAX) (VDSO): unexpected return value -14, expected -1
gettimeofday(valid, UINTPTR_MAX) (VDSO): exited with status 1, expected 0
gettimeofday(valid, page (PROT_NONE)) (VDSO): unexpected return value -14, expected -1
gettimeofday(valid, page (PROT_NONE)) (VDSO): exited with status 1, expected 0
gettimeofday(valid, page (PROT_READ)) (VDSO): unexpected return value -14, expected -1
gettimeofday(valid, page (PROT_READ)) (VDSO): exited with status 1, expected 0
gettimeofday/abi: 3 failures/inconsistencies encountered


# uname -a
Linux 3054d8c1d709 4.9.125-linuxkit #1 SMP Fri Sep 7 08:20:28 UTC 2018 x86_64 GNU/Linux




我的一台服务器:
clock-gettime-monotonic: syscall: 574 nsec/call
clock-gettime-monotonic: libc: 34 nsec/call
clock-gettime-monotonic: vdso: 32 nsec/call
Note: vDSO version of clock_getres not found
clock-getres-monotonic: syscall: 524 nsec/call
clock-getres-monotonic: libc: 523 nsec/call
clock-getres-monotonic: vdso: not tested
Note: vDSO version of clock_getres not found
Note: vDSO version of clock_getres not found
clock-gettime-monotonic-coarse: syscall: 541 nsec/call
clock-gettime-monotonic-coarse: libc: 9 nsec/call
clock-gettime-monotonic-coarse: vdso: 7 nsec/call
Note: vDSO version of clock_getres not found
clock-getres-monotonic-coarse: syscall: 529 nsec/call
clock-getres-monotonic-coarse: libc: 527 nsec/call
clock-getres-monotonic-coarse: vdso: not tested
Note: vDSO version of clock_getres not found
Note: vDSO version of clock_getres not found
clock-gettime-monotonic-raw: syscall: 570 nsec/call
clock-gettime-monotonic-raw: libc: 579 nsec/call
clock-gettime-monotonic-raw: vdso: 564 nsec/call
Note: vDSO version of clock_getres not found
clock-getres-monotonic-raw: syscall: 520 nsec/call
clock-getres-monotonic-raw: libc: 519 nsec/call
clock-getres-monotonic-raw: vdso: not tested
Note: vDSO version of clock_getres not found
Note: vDSO version of clock_getres not found
clock-gettime-tai: syscall: 592 nsec/call
clock-gettime-tai: libc: 602 nsec/call
clock-gettime-tai: vdso: 587 nsec/call
Note: vDSO version of clock_getres not found
clock-getres-tai: syscall: 521 nsec/call
clock-getres-tai: libc: 519 nsec/call
clock-getres-tai: vdso: not tested
Note: vDSO version of clock_getres not found
Note: vDSO version of clock_getres not found
clock-gettime-boottime: syscall: 582 nsec/call
clock-gettime-boottime: libc: 588 nsec/call
clock-gettime-boottime: vdso: 585 nsec/call
Note: vDSO version of clock_getres not found
clock-getres-boottime: syscall: 520 nsec/call
clock-getres-boottime: libc: 518 nsec/call
clock-getres-boottime: vdso: not tested
Note: vDSO version of clock_getres not found
Note: vDSO version of clock_getres not found
clock-gettime-realtime: syscall: 584 nsec/call
clock-gettime-realtime: libc: 34 nsec/call
clock-gettime-realtime: vdso: 33 nsec/call
Note: vDSO version of clock_getres not found
clock-getres-realtime: syscall: 525 nsec/call
clock-getres-realtime: libc: 525 nsec/call
clock-getres-realtime: vdso: not tested
Note: vDSO version of clock_getres not found
Note: vDSO version of clock_getres not found
clock-gettime-realtime-coarse: syscall: 532 nsec/call
clock-gettime-realtime-coarse: libc: 9 nsec/call
clock-gettime-realtime-coarse: vdso: 7 nsec/call
Note: vDSO version of clock_getres not found
clock-getres-realtime-coarse: syscall: 531 nsec/call
clock-getres-realtime-coarse: libc: 528 nsec/call
clock-getres-realtime-coarse: vdso: not tested
Note: vDSO version of clock_getres not found
Note: vDSO version of clock_getres not found
getcpu: syscall: 455 nsec/call
getcpu: libc: 17 nsec/call
getcpu: vdso: 14 nsec/call
gettimeofday: syscall: 563 nsec/call
gettimeofday: libc: 34 nsec/call
gettimeofday: vdso: 34 nsec/call

$ uname -srvmpio
Linux 4.15.0-39-generic #42~16.04.1-Ubuntu SMP Wed Oct 24 17:09:54 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

龙芯cpu 主频2.2G 以上,有图有真相

water 发表了文章 • 1 个评论 • 242 次浏览 • 2019-01-02 09:51 • 来自相关话题

   

TIM图片20190102094822.png

 
TIM图片20190102094813.jpg

 

为什么在3a3000+7a1000平台上运行loongnix系统时,有时显示会卡顿一下?

cyberhero 回复了问题 • 2 人关注 • 1 个回复 • 177 次浏览 • 2018-12-30 20:30 • 来自相关话题

3a3000+7a1000进入到系统之后可以把cpu的uart1设为打印吗?

回复

yinzhi 发起了问题 • 1 人关注 • 0 个回复 • 107 次浏览 • 2018-12-29 16:05 • 来自相关话题

希望龙芯也能跑android安卓app,比如《王者荣耀》

回复

gugudu 发起了问题 • 1 人关注 • 0 个回复 • 152 次浏览 • 2018-12-26 11:17 • 来自相关话题

龙芯派显示的光标跳动,听说要关掉触摸屏,如何关?

iapcmloongson 回复了问题 • 2 人关注 • 1 个回复 • 134 次浏览 • 2018-12-25 21:53 • 来自相关话题

龙芯应用公社无法注册

wenjie198881 回复了问题 • 3 人关注 • 2 个回复 • 133 次浏览 • 2018-12-25 19:45 • 来自相关话题

龙芯派2K装好Centos6.4后,使用yum不能运行,库的地址修改之后能运行了。

dawoo 发表了文章 • 2 个评论 • 108 次浏览 • 2018-12-25 00:30 • 来自相关话题

文件位置:/etc/yum.repos.d/centos6.4-yum.repo [CentOS6.4-Released-mips64el] name= Community ENTerprise Operat ...查看全部
文件位置:/etc/yum.repos.d/centos6.4-yum.repo


[CentOS6.4-Released-mips64el]
name= Community ENTerprise Operating System 6.4 for Loongson(Released)
enabled=1
gpgcheck=0
baseurl=http://ftp.loongnix.org/os/CentOS6.4/RPMS/Released
          http://ftp.loongnix.org/os/CentOS6.4/RPMS/Released
[CentOS6.4-Updates-mips64el]
name= Community ENTerprise Operating System 6.4 for Loongson(Updates)
enabled=1
gpgcheck=0
baseurl=http://ftp.loongnix.org/os/CentOS6.4/RPMS/Updates
          http://ftp.loongnix.org/os/CentOS6.4/RPMS/Updates
[CentOS6.4-Loongson-mips64el]
name= Community ENTerprise Operating System 6.4 for Loongson(loongson)
enabled=1
gpgcheck=0
baseurl=http://ftp.loongnix.org/os/CentOS6.4/RPMS/Released
          http://ftp.loongnix.org/os/CentOS6.4/RPMS/Released


请问高手,有没有更多的配置方式?

龙芯既然出了《龙芯应用开发标准教程》何不再出一本类似《intel 微控制器》的书?

flygoatfree 回复了问题 • 3 人关注 • 2 个回复 • 270 次浏览 • 2018-12-24 20:50 • 来自相关话题