linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* riscv-tests-benchmarks tools not working on qemu linux
@ 2018-12-14 14:20 Pintu Agarwal
  2018-12-14 17:27 ` [sw-dev] " Jim Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: Pintu Agarwal @ 2018-12-14 14:20 UTC (permalink / raw)
  To: isa-dev, linux-riscv, sw-dev, Gurucharan Kaur Saluja

Hi,

I am interested in using : RISCV/riscv-tools/riscv-tests/benchmarks
But I am failing to execute it on QEMU environment.

This is my environment:
RISCV: rv64imafdcsu
Linux version: 4.19.0-rc8-00001-gf0a7d18 (gcc version 8.2.0 (GCC))
Tool chain: riscv64-unknown-linux-gnu-  8.2.0
rootfs: busybear
Platform: riscv-qemu
Command:
qemu-system-riscv64 -nographic -machine virt -kernel
PK/riscv-pk/build/bbl -append "root=/dev/vda ro console=ttyS0,115200"
-drive file=busybear.bin,format=raw,id=hd0 -device
virtio-blk-device,drive=hd0 -m 1024M -smp 4

Building the tests:
#/riscv-tools/riscv-tests/benchmarks$ make
Note: We changed the tool chain to:
RISCV_PREFIX ?= riscv$(XLEN)-unknown-linux-gnu-  (instead of unknown-elf)
All benchmarking programs compiled successfully and created program.riscv files.
Example: multiply.riscv

After this when we execute:
# spike multiply.riscv
We get this output:
mcycle = 24098
minstret = 24104

So, we assume this tool is working on spike.
But, when we try to execute the same on QEMU environment, it crashes
will illegal instruction:

root@(none):root# ./multiply.riscv
multiply.riscv[77]: unhandled signal 4 code 0x1 at 0x0000000080000040
in multiply.riscv[80000000+1000]
CPU: 0 PID: 77 Comm: multiply.riscv Not tainted
4.18.0-rc6-13938-g4060877-dirty #14
sepc: 0000000080000040 ra : 0000000000000000 sp : 0000000000000000
 gp : 0000000000000000 tp : 0000000000000000 t0 : 000000000001e000
 t1 : 0000000000000000 t2 : 0000000000000000 s0 : 0000000000000000
 s1 : 0000000000000000 a0 : 0000000000000000 a1 : 0000000000000000
 a2 : 0000000000000000 a3 : 0000000000000000 a4 : 0000000000000000
 a5 : 0000000000000000 a6 : 0000000000000000 a7 : 0000000000000000
 s2 : 0000000000000000 s3 : 0000000000000000 s4 : 0000000000000000
 s5 : 0000000000000000 s6 : 0000000000000000 s7 : 0000000000000000
 s8 : 0000000000000000 s9 : 0000000000000000 s10: 0000000000000000
 s11: 0000000000000000 t3 : 0000000000000000 t4 : 0000000000000000
 t5 : 0000000000000000 t6 : 0000000000000000
sstatus: 0000000000002020 sbadaddr: 000000003002a073 scause: 0000000000000002
Illegal instruction


So, we wanted to know how to make these tools works for normal Linux
in QEMU with riscv64-unknown-linux-gnu tool chain (without spike)?
Moreover, we want to make these tools works for qemu-arm linux as
well. Is it possible? What kind of modification will be required to
support it?
Or, is there separate tools for linux?

Or, is it possible to create a simple and common benchmarking tool
like: {Sorting, Multiply, Matrix Multiply, Tower of Hanoi, Factorial,
etc.} using normal C programming and system calls (if required)?
But, question is, how should I measure it?

Please help with some reference.


Thanks,
Pintu

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [sw-dev] riscv-tests-benchmarks tools not working on qemu linux
  2018-12-14 14:20 riscv-tests-benchmarks tools not working on qemu linux Pintu Agarwal
@ 2018-12-14 17:27 ` Jim Wilson
  2018-12-17 12:41   ` Pintu Agarwal
  0 siblings, 1 reply; 3+ messages in thread
From: Jim Wilson @ 2018-12-14 17:27 UTC (permalink / raw)
  To: Pintu Kumar
  Cc: Gurucharan Kaur Saluja, linux-riscv, RISC-V SW Dev, RISC-V ISA Dev

On Fri, Dec 14, 2018 at 6:20 AM Pintu Agarwal <pintu.ping@gmail.com> wrote:
> I am interested in using : RISCV/riscv-tools/riscv-tests/benchmarks
> But I am failing to execute it on QEMU environment.

riscv-tests builds bare metal programs that directly manipulate
machine mode registers, because that is necessary to get these
programs to run on bare metal.  You can't run such a binary on a linux
system, because user mode programs can't read/write machine mode
registers.

riscv-tests is primarily for testing ISA support.  It has tests to
verify that load and multiply instructions work for instance.  If you
can boot linux, then your load and multiply instructions are probably
working.  The benchmarks dir does have some simple benchmarks that can
be run once you have the ISA support working, but these are just small
demonstration programs, not a real benchmarking suite, and they are
probably all stolen from other benchmarking suites.  These are
deliberately small programs, so you can run them on a cycle accurate
hardware simulator.

Anyways, you can run the programs in the benchmarking dir on a linux
system if you compile them as linux programs.  That is, don't use the
makefile, and just compile them directly with a linux gcc.  But they
are so small, you may not get useful performance results on real
hardware.

> Or, is it possible to create a simple and common benchmarking tool
> like: {Sorting, Multiply, Matrix Multiply, Tower of Hanoi, Factorial,
> etc.} using normal C programming and system calls (if required)?
> But, question is, how should I measure it?

The world already has so many different benchmarking suites.  Do we
really need another one?  I would suggest SPEC as a good linux
benchmarking suite, and EEMBC (i.e. coremark) if you want something
smaller.

Jim

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [sw-dev] riscv-tests-benchmarks tools not working on qemu linux
  2018-12-14 17:27 ` [sw-dev] " Jim Wilson
@ 2018-12-17 12:41   ` Pintu Agarwal
  0 siblings, 0 replies; 3+ messages in thread
From: Pintu Agarwal @ 2018-12-17 12:41 UTC (permalink / raw)
  To: jimw; +Cc: Gurucharan Kaur Saluja, linux-riscv, sw-dev, isa-dev

On Fri, Dec 14, 2018 at 10:57 PM Jim Wilson <jimw@sifive.com> wrote:
>
> Anyways, you can run the programs in the benchmarking dir on a linux
> system if you compile them as linux programs.  That is, don't use the
> makefile, and just compile them directly with a linux gcc.  But they
> are so small, you may not get useful performance results on real
> hardware.
>
Thank you so much for your information.
Yes, we already did that. But all tests finally depends on "common" .c and .h
So, it did not work standalone.
Also we cannot remove those function, otherwise how can we measure the data..
If you know of any tests that can work on x86/arm/risc-v please let me know.

> > Or, is it possible to create a simple and common benchmarking tool
> > like: {Sorting, Multiply, Matrix Multiply, Tower of Hanoi, Factorial,
> > etc.} using normal C programming and system calls (if required)?
> > But, question is, how should I measure it?
>
> The world already has so many different benchmarking suites.  Do we
> really need another one?  I would suggest SPEC as a good linux
> benchmarking suite, and EEMBC (i.e. coremark) if you want something
> smaller.
>
Thank you so much for these references.
Sorry, I did not knew that there are so many already available.
I checked this one: stress-ng:
https://www.cyberciti.biz/faq/stress-test-linux-unix-server-with-stress-ng/

I think this will be helpful for us.
I am trying to see if I can build this for riscv64-unknown-linux-gnu
and run on QEMU.



> Jim

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-12-17 12:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-14 14:20 riscv-tests-benchmarks tools not working on qemu linux Pintu Agarwal
2018-12-14 17:27 ` [sw-dev] " Jim Wilson
2018-12-17 12:41   ` Pintu Agarwal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).