Re: Having some problems in running Cpp code on Osv

2017-12-04 Thread Tomasz Grabiec
See
https://github.com/cloudius-systems/osv/wiki/OSv-modules#automatic-module-building
:

"If module contains Makefile it will be automatically built with make module
 command if it is required in the image."

Try defining a rule named "module" in your Makefile.

On Sat, Dec 2, 2017 at 10:44 AM,  wrote:

> I try to run my c++ code on Osv but there are some problems.
>
> This is my Hello.cpp:
>
> #include 
> using namespace std;
>
> int main()
> {
> cout<<"Hello world!!!"< }
>
>
>
> This is my Makefile:
>
> Hello.o: Hello.cpp
> g++ -o Hello.o Hello.cpp
>
> clean:
> rm -rf *.o
>
>
>
> This is my module.py:
>
> from osv.modules import api
> default = api.run(cmdline="/cpp-example/Hello.o")
>
>
>
>
> This is my usr.manifest:
>
> /cpp-example/Hello.o: ${MODULE_DIR}/Hello.o
>
>
>
>
> Then I try to run my code by
>
> sudo scripts/build image=cpp-example
>
>
> But there are some mistakes:
>
> make: *** No rule to make target 'module'.  Stop.
> Traceback (most recent call last):
>   File "scripts/module.py", line 281, in 
> args.func(args)
>   File "scripts/module.py", line 234, in build
> make_modules(modules, args)
>   File "scripts/module.py", line 124, in make_modules
> raise Exception('make failed for ' + module.name)
> Exception: make failed for cpp-example
> scripts/build failed: jdkbase=$jdkbase ARCH=$arch mode=$mode OSV_BASE=$SRC
> OSV_BUILD_PATH=$OSV_BUILD_PATH scripts/module.py $j_arg build -c $modules
> $usrskel_arg $no_required_arg
>
>
>
> I read the instruction(https://github.com/cloudius-systems/osv/wiki/
> OSv-modules) carefully but I still don't know what the problem is.
>
> --
> You received this message because you are subscribed to the Google Groups
> "OSv Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to osv-dev+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Generating flame graphs on OSv

2017-06-27 Thread Tomasz Grabiec
On Tue, Jun 27, 2017 at 6:20 PM, Waldek Kozaczuk 
wrote:

> I was wondering if it should be possible to generate so called "flame
> graphs" (https://medium.com/netflix-techblog/java-in-flames-e763b3d32166)
> on OSv to visualize its performance characteristic. I have a sense that it
> might not be that difficult but I am missing some hints. I might be all
> wrong as well :-)
>
> It looks like OSv comes with its own trace tool (
> https://github.com/cloudius-systems/osv/wiki/Trace-analysis-using-trace.py)
> that operates on tracefile but I am not sure if the format is in any way
> compatible with Linux perf tool.
>

It's not compatible, but it shouldn't be hard to write a trace.py command
which generates a .stacks file out of the samples tree, which can be then
understood by the FlameGraph tools.

I've done this for seastar's heap profiler:

https://github.com/scylladb/scylla/wiki/Seastar-heap-profiler#generating-flamegraphs

Code which generates the .stacks file:

https://github.com/scylladb/scylla/blob/master/scylla-gdb.py#L397

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Trouble with /dev/urandom

2016-10-14 Thread Tomasz Grabiec
On Fri, Oct 14, 2016 at 4:14 PM, Benoît Canet <ben...@cloudius-systems.com>
wrote:

>
> QEMU on ubuntu 16.04.
>
> benoit@alfred:~/osv$ cat /proc/sys/kernel/random/entropy_avail
>
> 58
>
>
That's not a lot.  Try watching it during your test.


> Some go debugging interleaved.
>
> OSv v0.24-199-g733d26f
> 4 CPUs detected
> Firmware vendor: SeaBIOS
> bsd: initializing - done
> VFS: mounting ramfs at /
> VFS: mounting devfs at /dev
> net: initializing - done
> vga: Add VGA device instance
> eth0: ethernet address: 52:54:00:12:34:56
> virtio-blk: Add blk device instances 0 as vblk0, devsize=10737418240
> random: virtio-rng registered as a source.
> random: intel drng, rdrand registered as a source.
>
>
Looks like we have both virtio-rng and drng registered as entropy sources.

There is a thread which polls them 10 times a second. See random_kthread()
from random_harvestq.cc. It feeds entropy into the system via
random_process_event() from yarrow.cc. Maybe we're not replenishing entropy
fast enough. Check if and which live sources provide entropy. Try
increasing the rate.

random: <Software, Yarrow> initialized
> VFS: unmounting /dev
> VFS: mounting zfs at /zfs
> zfs: mounting osv/zfs from device /dev/vblk0.1
> VFS: mounting devfs at /dev
> VFS: mounting procfs at /proc
> program zpool.so returned 1
> BSD shrinker: event handler list found: 0xa1e6ca80
> BSD shrinker found: 1
> BSD shrinker: unlocked, running
> [I/42 dhcp]: Waiting for IP...
> [I/252 dhcp]: Server acknowledged IP for interface eth0
> eth0: 192.168.122.15
> [I/252 dhcp]: Configuring eth0: ip 192.168.122.15 subnet mask 255.255.255.0 
> gateway 192.168.122.1 MTU 1500
> args
> 0
> 1.5
> 4.0
> 6.0
> 6.5
> 6.0
> 6.2
> 6.1
> typ != _STT_FUNC %i
> true 0 bind != _STB_GLOBAL && bind != _STB_WEAK %i
> falsesym.st_shndx == _SHN_UNDEF %ifalse6.5
> 6.0
> 6.5
> 7
> osinit
> schedinit enter
> schedinit 1
> schedinit 2
> schedinit 3
> schedinit 4
> schedinit 5
> schedinit 6
> schedinit 7
> schedinit 8
> alginit 1
> alginit 2
> alginit 3
> getRandomData 1
> getRandomData 3
> getRandomData 4
> random: blocking on read.
> random: device unblocked.
> getRandomData 5
> getRandomData 6
> getRandomData 7
> alginit 4
> schedinit 9
> schedinit 10
> schedinit 11
> schedinit 12
> schedinit 13
> schedinit 14
> schedinit 15
> schedinit 16
> schedinit 17
> schedinit 18
> schedinit 19
> schedinit 21
> schedinit 25
> schedinit 27
> schedinit exit
> newproc enter
> newproc exit
> mstart enter
> sigaltstack() stubbed
> mstart enter
> mstart enter
> newproc enter
> blub
>
> [backtrace]
> 0x000000202525 
> 0x0032a97a <mmu::vm_fault(unsigned long, exception_frame*)+298>
> 0x00388b98 <page_fault+136>
> 0x00387a36 
> 0x1147e0d2 
> 0x1147f15b 
> 0x1147c7db 
> 0x1147c6cc 
> 0x114cf232 
> 0x2055ff3f 
>
>



>
>
> On Fri, Oct 14, 2016 at 3:57 PM, Tomasz Grabiec <tgrab...@scylladb.com>
> wrote:
>
>>
>>
>> On Fri, Oct 14, 2016 at 3:39 PM, Benoît Canet <
>> ben...@cloudius-systems.com> wrote:
>>
>>>
>>> Hello list,
>>>
>>> In the process of porting go to OSv I noticed that the Go runtime
>>> initialization stall half the time waiting in a read for /dev/urandom.
>>>
>>> The message OSv output is "random: blocking on read.".
>>>
>>> It then sometime proceeed to unblock itself a couple dozen of seconds
>>> later.
>>>
>>> Does it ring a bell ? Is it expected behavior from /dev/urandom ?
>>>
>>
>> It looks like entropy pool was depleted. Maybe no hardware entropy
>> sources were detected and we were using only slow interrupt entropy
>> harvesting.
>>
>> Another option is that you are using virtio-rng and entropy was depleted
>> on your host. Check with `cat /proc/sys/kernel/random/entropy_avail`
>>
>> Which hypervisor are you running on?
>>
>> Can you show your debug console output?
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [PATCH] Changed java-example to use java.so directly to start example Hello application

2016-09-21 Thread Tomasz Grabiec
On Wed, Sep 21, 2016 at 5:05 PM, Waldek Kozaczuk <jwkozac...@gmail.com>
wrote:

> Please see my answers below.
>
> Sent from my iPhone
>
> On Sep 21, 2016, at 03:17, Tomasz Grabiec <tgrab...@scylladb.com> wrote:
>
>
>
> On Wed, Sep 21, 2016 at 6:32 AM, Waldemar Kozaczuk <jwkozac...@gmail.com>
> wrote:
>
>> This change makes the java-example app universal so that it can be used
>> with any
>> Java runtime module like so:
>>
>> ./scripts/build image=java,java-example
>> ./scripts/build image=openjdk8-fedora,java-example
>> ./scripts/build image=openjdk8-zulu-compact1,java-example
>> ./scripts/build image=openjdk8-zulu-compact2,java-example
>> ./scripts/build image=openjdk8-zulu-compact3,java-example
>>
>> Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>
>> ---
>>  java-compact1-example/Hello.java   | 5 -
>>  java-compact1-example/Makefile | 7 ---
>>  java-compact1-example/module.py| 5 -
>>  java-compact1-example/usr.manifest | 1 -
>>  java-compact2-example/Hello.java   | 5 -
>>  java-compact2-example/Makefile | 7 ---
>>  java-compact2-example/module.py| 5 -
>>  java-compact2-example/usr.manifest | 1 -
>>  java-compact3-example/Hello.java   | 5 -
>>  java-compact3-example/Makefile | 7 ---
>>  java-compact3-example/module.py| 5 -
>>  java-compact3-example/usr.manifest | 1 -
>>  java-example/module.py | 2 +-
>>  13 files changed, 1 insertion(+), 55 deletions(-)
>>  delete mode 100644 java-compact1-example/Hello.java
>>  delete mode 100644 java-compact1-example/Makefile
>>  delete mode 100644 java-compact1-example/module.py
>>  delete mode 100644 java-compact1-example/usr.manifest
>>  delete mode 100644 java-compact2-example/Hello.java
>>  delete mode 100644 java-compact2-example/Makefile
>>  delete mode 100644 java-compact2-example/module.py
>>  delete mode 100644 java-compact2-example/usr.manifest
>>  delete mode 100644 java-compact3-example/Hello.java
>>  delete mode 100644 java-compact3-example/Makefile
>>  delete mode 100644 java-compact3-example/module.py
>>  delete mode 100644 java-compact3-example/usr.manifest
>>
>> diff --git a/java-compact1-example/Hello.java
>> b/java-compact1-example/Hello.java
>> deleted file mode 100644
>> index a605554..000
>> --- a/java-compact1-example/Hello.java
>> +++ /dev/null
>> @@ -1,5 +0,0 @@
>> -public class Hello {
>> -public static void main(String[] args) {
>> -System.out.println("Hello, World!");
>> -}
>> -}
>> diff --git a/java-compact1-example/Makefile
>> b/java-compact1-example/Makefile
>> deleted file mode 100644
>> index 8a385c9..000
>> --- a/java-compact1-example/Makefile
>> +++ /dev/null
>> @@ -1,7 +0,0 @@
>> -module: Hello.class
>> -
>> -%.class: %.java
>> -   javac -target 7 -source 7 $^
>> -
>> -clean:
>> -   rm -rf *.class
>> diff --git a/java-compact1-example/module.py
>> b/java-compact1-example/module.py
>> deleted file mode 100644
>> index 216cf35..000
>> --- a/java-compact1-example/module.py
>> +++ /dev/null
>> @@ -1,5 +0,0 @@
>> -from osv.modules import api
>> -
>> -api.require('openjdk8-zulu-compact1')
>> -
>> -default = api.run('/java.so -cp /java-example Hello')
>> diff --git a/java-compact1-example/usr.manifest b/java-compact1-example/
>> usr.manifest
>> deleted file mode 100644
>> index f62abc7..000
>> --- a/java-compact1-example/usr.manifest
>> +++ /dev/null
>> @@ -1 +0,0 @@
>> -/java-example/Hello.class: ${MODULE_DIR}/Hello.class
>> diff --git a/java-compact2-example/Hello.java
>> b/java-compact2-example/Hello.java
>> deleted file mode 100644
>> index a605554..000
>> --- a/java-compact2-example/Hello.java
>> +++ /dev/null
>> @@ -1,5 +0,0 @@
>> -public class Hello {
>> -public static void main(String[] args) {
>> -System.out.println("Hello, World!");
>> -}
>> -}
>> diff --git a/java-compact2-example/Makefile
>> b/java-compact2-example/Makefile
>> deleted file mode 100644
>> index 8a385c9..000
>> --- a/java-compact2-example/Makefile
>> +++ /dev/null
>> @@ -1,7 +0,0 @@
>> -module: Hello.class
>> -
>> -%.class: %.java
>> -   javac -target 7 -source 7 $^
>> -
>> -clean:
>> -   rm -rf *.class
>> diff --git a/java-compact2-example/module.py
>> b/java-compact2

Re: [PATCH] Changed java-example to use java.so directly to start example Hello application

2016-09-21 Thread Tomasz Grabiec
On Wed, Sep 21, 2016 at 6:32 AM, Waldemar Kozaczuk 
wrote:

> This change makes the java-example app universal so that it can be used
> with any
> Java runtime module like so:
>
> ./scripts/build image=java,java-example
> ./scripts/build image=openjdk8-fedora,java-example
> ./scripts/build image=openjdk8-zulu-compact1,java-example
> ./scripts/build image=openjdk8-zulu-compact2,java-example
> ./scripts/build image=openjdk8-zulu-compact3,java-example
>
> Signed-off-by: Waldemar Kozaczuk 
> ---
>  java-compact1-example/Hello.java   | 5 -
>  java-compact1-example/Makefile | 7 ---
>  java-compact1-example/module.py| 5 -
>  java-compact1-example/usr.manifest | 1 -
>  java-compact2-example/Hello.java   | 5 -
>  java-compact2-example/Makefile | 7 ---
>  java-compact2-example/module.py| 5 -
>  java-compact2-example/usr.manifest | 1 -
>  java-compact3-example/Hello.java   | 5 -
>  java-compact3-example/Makefile | 7 ---
>  java-compact3-example/module.py| 5 -
>  java-compact3-example/usr.manifest | 1 -
>  java-example/module.py | 2 +-
>  13 files changed, 1 insertion(+), 55 deletions(-)
>  delete mode 100644 java-compact1-example/Hello.java
>  delete mode 100644 java-compact1-example/Makefile
>  delete mode 100644 java-compact1-example/module.py
>  delete mode 100644 java-compact1-example/usr.manifest
>  delete mode 100644 java-compact2-example/Hello.java
>  delete mode 100644 java-compact2-example/Makefile
>  delete mode 100644 java-compact2-example/module.py
>  delete mode 100644 java-compact2-example/usr.manifest
>  delete mode 100644 java-compact3-example/Hello.java
>  delete mode 100644 java-compact3-example/Makefile
>  delete mode 100644 java-compact3-example/module.py
>  delete mode 100644 java-compact3-example/usr.manifest
>
> diff --git a/java-compact1-example/Hello.java
> b/java-compact1-example/Hello.java
> deleted file mode 100644
> index a605554..000
> --- a/java-compact1-example/Hello.java
> +++ /dev/null
> @@ -1,5 +0,0 @@
> -public class Hello {
> -public static void main(String[] args) {
> -System.out.println("Hello, World!");
> -}
> -}
> diff --git a/java-compact1-example/Makefile b/java-compact1-example/
> Makefile
> deleted file mode 100644
> index 8a385c9..000
> --- a/java-compact1-example/Makefile
> +++ /dev/null
> @@ -1,7 +0,0 @@
> -module: Hello.class
> -
> -%.class: %.java
> -   javac -target 7 -source 7 $^
> -
> -clean:
> -   rm -rf *.class
> diff --git a/java-compact1-example/module.py b/java-compact1-example/
> module.py
> deleted file mode 100644
> index 216cf35..000
> --- a/java-compact1-example/module.py
> +++ /dev/null
> @@ -1,5 +0,0 @@
> -from osv.modules import api
> -
> -api.require('openjdk8-zulu-compact1')
> -
> -default = api.run('/java.so -cp /java-example Hello')
> diff --git a/java-compact1-example/usr.manifest
> b/java-compact1-example/usr.manifest
> deleted file mode 100644
> index f62abc7..000
> --- a/java-compact1-example/usr.manifest
> +++ /dev/null
> @@ -1 +0,0 @@
> -/java-example/Hello.class: ${MODULE_DIR}/Hello.class
> diff --git a/java-compact2-example/Hello.java
> b/java-compact2-example/Hello.java
> deleted file mode 100644
> index a605554..000
> --- a/java-compact2-example/Hello.java
> +++ /dev/null
> @@ -1,5 +0,0 @@
> -public class Hello {
> -public static void main(String[] args) {
> -System.out.println("Hello, World!");
> -}
> -}
> diff --git a/java-compact2-example/Makefile b/java-compact2-example/
> Makefile
> deleted file mode 100644
> index 8a385c9..000
> --- a/java-compact2-example/Makefile
> +++ /dev/null
> @@ -1,7 +0,0 @@
> -module: Hello.class
> -
> -%.class: %.java
> -   javac -target 7 -source 7 $^
> -
> -clean:
> -   rm -rf *.class
> diff --git a/java-compact2-example/module.py b/java-compact2-example/
> module.py
> deleted file mode 100644
> index f17ac37..000
> --- a/java-compact2-example/module.py
> +++ /dev/null
> @@ -1,5 +0,0 @@
> -from osv.modules import api
> -
> -api.require('openjdk8-zulu-compact2')
> -
> -default = api.run('/java.so -cp /java-example Hello')
> diff --git a/java-compact2-example/usr.manifest
> b/java-compact2-example/usr.manifest
> deleted file mode 100644
> index f62abc7..000
> --- a/java-compact2-example/usr.manifest
> +++ /dev/null
> @@ -1 +0,0 @@
> -/java-example/Hello.class: ${MODULE_DIR}/Hello.class
> diff --git a/java-compact3-example/Hello.java
> b/java-compact3-example/Hello.java
> deleted file mode 100644
> index a605554..000
> --- a/java-compact3-example/Hello.java
> +++ /dev/null
> @@ -1,5 +0,0 @@
> -public class Hello {
> -public static void main(String[] args) {
> -System.out.println("Hello, World!");
> -}
> -}
> diff --git a/java-compact3-example/Makefile b/java-compact3-example/
> Makefile
> deleted file mode 100644
> index 8a385c9..000
> --- a/java-compact3-example/Makefile
> +++ /dev/null
>