Re: [PATCH v2 2/2] Return list of all threads in given application

2016-07-04 Thread Nadav Har'El
Hi, thanks. Looks mostly good but some comments below. On Mon, Jul 4, 2016 at 7:26 PM, Justin Cinkelj wrote: > Signed-off-by: Justin Cinkelj > --- > Makefile | 1 + > core/osv_c_wrappers.cc | 39 +++ > include/osv/osv_c_wrappers.h

Re: [PATCH v2 2/2] Return list of all threads in given application

2016-07-05 Thread Nadav Har'El
- they all are supposed to have C linkage, but the the "extern C" is almost always in the header file, not the .c file. Maybe the prototype is not exactly identical? I'll take a look at your patch. > BR Justin > > On 07/04/2016 06:54 PM, Nadav Har'El wrote: > > Hi,

Re: [PATCH v3] Return list of all threads in given application

2016-07-05 Thread Nadav Har'El
On Tue, Jul 5, 2016 at 9:56 AM, Justin Cinkelj wrote: > Signed-off-by: Justin Cinkelj > --- > Makefile | 1 + > core/osv_c_wrappers.cc | 33 + > include/osv/osv_c_wrappers.h | 27 +++ > 3 files changed, 61 insert

[PATCH] libc: stub implementation of register_printf_*() functions

2016-07-17 Thread Nadav Har'El
enough for applications which want to use libquadmath (for example) for calculations but do not intend to use its printf extensions. Refs issue #765 (this issue should not be closed until we have a full implementation of these functions, or make a decision that we never will). Signed-off-by: Nadav

[PATCH 5/5] libc: pthread_setaffinity_np() on other threads

2016-07-19 Thread Nadav Har'El
Previously, pthread_setaffinity_np() only supported working on the current thread. With this patch we use the new sched::thread::pin(thread*, cpu*) to support pinning of other threads as well. Fixes #520. Signed-off-by: Nadav Har'El --- libc/pthread.cc | 7 ++- 1 file changed, 2 inser

[PATCH 4/5] sched: tests for pin(thread*, cpu*)

2016-07-19 Thread Nadav Har'El
Add tests for pin()ing this thread or a different thread. I attempted to capture some of the edge cases, such as pin() on a running, thread, a sleeping thread, or a thread which is often in migrate-disable state. Signed-off-by: Nadav Har'El --- tests/tst-pin.cc

[PATCH 1/5] sched: ignore thread in wrong wakeup queue

2016-07-19 Thread Nadav Har'El
race with a wake() of the same thread, resulting in the thread remaining on the old cpu's wakeup queues, and we better ignore it there. Signed-off-by: Nadav Har'El --- core/sched.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/sched.cc b/core/sched.cc index 7a4afeb..0507d

[PATCH 3/5] sched: add pin() variant which can pin another thread

2016-07-19 Thread Nadav Har'El
()ed before, will cause pin() to never return. In the future, we should separate the temporary migrate_disable() and permanent pinning, and only wait while the former is in effect. Signed-off-by: Nadav Har'El --- include/osv/sched.hh | 20 +++ core/sched.cc

[PATCH 2/5] sched: make export_runtime() idempotent

2016-07-19 Thread Nadav Har'El
Allow running export_runtime() twice without ill-effect. A following patch will allow migrating sleeping threads, and migrating it again before it got to run is possible. Signed-off-by: Nadav Har'El --- core/sched.cc | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a

[PATCH] Do not use enum class as constructor priority

2016-07-20 Thread Nadav Har'El
enum, which do have conversion to int. Put this enum inside a namespace so we can still use names like init_prio::sched and don't need to change any of the callers. Fixes #769 Signed-off-by: Nadav Har'El --- include/osv/prio.hh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)

[PATCH] Fix error in xen ring.h

2016-07-20 Thread Nadav Har'El
in about an illegal conversion of an integer to a pointer (!?) in a huge macro expansion resulting in a line with over 130,000 characters (!). It wasn't easy to find the needle in this haystack, but eventually I found it. Signed-off-by: Nadav Har'El --- bsd/sys/xen/interface/io/ring.h | 2 +-

[PATCH] Fix typo in ide_drive constructor

2016-07-20 Thread Nadav Har'El
ide_drive's constructor contained an obvious typo, not setting the _dev member as intended but rather copying it from itself (!). Older compilers happily accepted this error, but gcc 6 refused to accept this, and found a bug. Signed-off-by: Nadav Har'El --- drivers/ide.cc | 2 +- 1 fi

[PATCH] Add missing includes

2016-07-20 Thread Nadav Har'El
. Signed-off-by: Nadav Har'El --- core/mmu.cc | 1 + core/sched.cc | 1 + 2 files changed, 2 insertions(+) diff --git a/core/mmu.cc b/core/mmu.cc index 6a31ce7..f929412 100644 --- a/core/mmu.cc +++ b/core/mmu.cc @@ -28,6 +28,7 @@ #include "dump.hh" #include #include +#include

[PATCH] Drop unneeded include statement

2016-07-20 Thread Nadav Har'El
Signed-off-by: Nadav Har'El --- core/mempool.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/core/mempool.cc b/core/mempool.cc index 0fbd857..50c938f 100644 --- a/core/mempool.cc +++ b/core/mempool.cc @@ -11,7 +11,6 @@ #include #include #include -#include #include #in

[PATCH] Avoid unsized array in union

2016-07-20 Thread Nadav Har'El
Gcc 6 does not like an unsized array in a union. Fortunately, there was no real reason for this trickery in the first place - a traditional cast to char* works just as well. Signed-off-by: Nadav Har'El --- tools/cpiod/cpio.cc | 18 +++--- 1 file changed, 7 insertions(+

[PATCH] Use function overload, not template instantiation

2016-07-20 Thread Nadav Har'El
names with different arguments. Signed-off-by: Nadav Har'El --- include/osv/bitset-iter.hh | 29 - 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/include/osv/bitset-iter.hh b/include/osv/bitset-iter.hh index 524328d..3bcca25 100644 --- a/include/osv/b

[PATCH] pthread: change type of pthread_t

2016-07-20 Thread Nadav Har'El
ret_cast's pthread_t, whatever it is, into a pointer. Additionally, we add a static_assert to verify that these two types (the pointer and pthread_t) really have the same length, as intended. Fixes #770. Signed-off-by: Nadav Har'El --- libc/pthread.cc| 2 ++

[PATCH] Use -fno-strict-aliasing where needed

2016-07-20 Thread Nadav Har'El
generate bad code. We need to stop both, and this is what this patch does. Signed-off-by: Nadav Har'El --- Makefile | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index feb6d54..63427bf 100644 --- a/Makefile +++ b/Makefile @@ -465,7 +

[PATCH] Do not assume enum class can be implicitly convert to int

2016-07-20 Thread Nadav Har'El
An enum class can be explicitly converted to the underlying int, using a static_cast, but this conversion does not happen implicitly, and gcc 6 is even stricter about this than the previous versions of the compiler. Signed-off-by: Nadav Har'El --- arch/x64/apic.hh | 6 +++--- 1 file chang

[PATCH] Avoid a warning with -Wno-tautological-compare

2016-07-20 Thread Nadav Har'El
Needed on gcc 6 for one of the files Signed-off-by: Nadav Har'El --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 63427bf..530e9a5 100644 --- a/Makefile +++ b/Makefile @@ -502,6 +502,8 @@ $(out)/bsd/sys/netinet/in_rmx.o: COMMON+=-fno-strict-ali

Re: [PATCH] Fix error in xen ring.h

2016-07-21 Thread Nadav Har'El
we didn't. -- Nadav Har'El n...@scylladb.com On Thu, Jul 21, 2016 at 12:12 AM, Nadav Har'El wrote: > The "&" character was strangely missing in the original code in the > familiar idiom for calculating the offset of a field in a structure. > I don't kn

[PATCH] Makefile: fix gcc 6 compilation failure due to header order

2016-07-22 Thread Nadav Har'El
to figure out its default header search path, and look for those with "c++" in the name. Usually this will include /usr/include/c++/ and also /usr/include/c++//. Fixes #768 Signed-off-by: Nadav Har'El --- Makefile | 8 1 file changed, 8 insertions(+) diff --git a/Ma

Re: [PATCH] Makefile: fix gcc 6 compilation failure due to header order

2016-07-23 Thread Nadav Har'El
ted as errors > Makefile:372: recipe for target 'build/release.x64/loader.o' failed > make: *** [build/release.x64/loader.o] Error 1 > [benoit@scylla osv]$ ^C > [benoit@scylla osv]$ > > > 2016-07-22 20:32 GMT+02:00 Nadav Har'El : > >> Starting with

Re: OSv page cache

2016-07-24 Thread Nadav Har'El
On Sun, Jul 24, 2016 at 12:33 PM, Gleb Natapov wrote: > On Sun, Jul 24, 2016 at 11:27:02AM +0200, Benoît Canet wrote: > > ZFS is also used on ubuntu. > > > So what? It does not changes the fact that writing using write() system > call does not go through out write page cache on OSv. It does go th

Re: OSv page cache

2016-07-24 Thread Nadav Har'El
On Sun, Jul 24, 2016 at 1:06 PM, Gleb Natapov wrote: > > > So it appears that unless you're using mmap(), OSv does *not* have any > > writeback buffer, not even for ZFS filesystems: If you do a write() > system > > call to write 10 bytes, you will create a 10-byte disk operation; If > > understan

Re: OSv page cache

2016-07-24 Thread Nadav Har'El
On Sun, Jul 24, 2016 at 1:28 PM, Benoît Canet wrote: > > But, Benoit, is it possible that ZFS *is* trying to coalesce writes, just >> somehow misconfigured to aim at the wrong size? What I mean is, if you do >> write() operations of 10 bytes, will you see 10-byte operations, or are >> they still

[PATCH 1/6] sched: ignore thread in wrong wakeup queue

2016-07-27 Thread Nadav Har'El
race with a wake() of the same thread, resulting in the thread remaining on the old cpu's wakeup queues, and we better ignore it there. Signed-off-by: Nadav Har'El --- core/sched.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/sched.cc b/core/sched.cc index 7a4afeb..0507d

[PATCH 2/6] sched: make export_runtime() idempotent

2016-07-27 Thread Nadav Har'El
Allow running export_runtime() twice without ill-effect. A following patch will allow migrating sleeping threads, and migrating it again before it got to run is possible. Signed-off-by: Nadav Har'El --- core/sched.cc | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a

[PATCH 4/6] sched: add pin() variant which can pin another thread

2016-07-27 Thread Nadav Har'El
not be migrated, as code surrounded by migrate_disable() cannot handle being migrated in the middle. So pin() will sleep a bit, in a loop, until the thread becomes migratable again. Re-pinning of an already pin()ed thread is supported, though. Signed-off-by: Nadav Har'El --- include/osv/sch

[PATCH 6/6] libc: pthread_setaffinity_np() on other threads

2016-07-27 Thread Nadav Har'El
Previously, pthread_setaffinity_np() only supported working on the current thread. With this patch we use the new sched::thread::pin(thread*, cpu*) to support pinning of other threads as well. Fixes #520. Signed-off-by: Nadav Har'El --- libc/pthread.cc | 7 ++- 1 file changed, 2 inser

[PATCH 5/6] sched: tests for pin(thread*, cpu*)

2016-07-27 Thread Nadav Har'El
. Signed-off-by: Nadav Har'El --- tests/tst-pin.cc | 198 + modules/tests/Makefile | 2 +- 2 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 tests/tst-pin.cc diff --git a/tests/tst-pin.cc b/tests/tst-pin.cc new file

[PATCH 3/6] sched: add _pinned flag for threads

2016-07-27 Thread Nadav Har'El
"_pinned" boolean flag should be replaced by a bitmask of CPUs which this thread is allowed to be on, so that a thread can be pinned to a set of CPUs instead of just one. Signed-off-by: Nadav Har'El --- include/osv/sched.hh | 7 +++ core/sched.cc| 16 ++-- 2 fi

Re: netperf benchmark

2016-07-30 Thread Nadav Har'El
On Fri, Jul 29, 2016 at 10:58 AM, Wind Yu wrote: > Hi everyone, > I want to compare the network performance of OSV and Linux. I really want > to know how to do the performance test. I don't know if I get the meaning. > What do you mean "the meaning"? I assume that to compare the performance of

Re: OSv exits saying "vfork() stubbed"

2016-08-02 Thread Nadav Har'El
On Tue, Aug 2, 2016 at 12:51 PM, wrote: > Hi Team, > I'm trying to build an OSv application. I have successfully build the same > using capstan. But when I ran the application it prints the following logs > and exits. > > ~/bin/capstan run > Created instance: test > OSv v0.24 > eth0: 192.168.122.

Re: OSv exits saying "vfork() stubbed"

2016-08-03 Thread Nadav Har'El
On Wed, Aug 3, 2016 at 12:54 PM, wrote: > Hi Team , > I'm trying to port a Java Project to OSv. > PFB some doubts, > how can I pre create a directory structure in OSv, before starting my OSv > App, so that the App can use this directory for storing data and writing > logs. ? > Sounds like all yo

Re: [PATCH v2] sched: make sched_getaffinity accept arbitrary pid/tid

2016-08-03 Thread Nadav Har'El
On Mon, Jul 4, 2016 at 10:27 AM, Justin Cinkelj wrote: > Signed-off-by: Justin Cinkelj > --- > libc/pthread.cc | 53 - > 1 file changed, 28 insertions(+), 25 deletions(-) > > diff --git a/libc/pthread.cc b/libc/pthread.cc > index 308b220..6088

[PATCH 3/3] libc: sched_getaffinity() on other threads

2016-08-03 Thread Nadav Har'El
, though: pthread_getaffinity_np() follows pthread tradition and returns errors directly, while sched_getaffinity() follows Unix tradition and returns errors in errno. Fixes #776. Signed-off-by: Nadav Har'El --- libc/pthread.cc | 49 +++-- 1 file change

[PATCH 2/3] libc: improve pthread_getaffinity_np()

2016-08-03 Thread Nadav Har'El
migration lock - so let's start using it. Refs #776. Signed-off-by: Nadav Har'El --- include/osv/sched.hh | 1 + libc/pthread.cc | 13 + 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/include/osv/sched.hh b/include/osv/sched.hh index 2ff1d00..261bcfd 10

[PATCH 1/3] libc: sched_setaffinity() on other threads

2016-08-03 Thread Nadav Har'El
of them will call. Note how the return values differ, though: pthread_setaffinity_np() follows pthread tradition and returns errors directly, while sched_setaffinity() follows Unix tradition and returns errors in errno. Refs #776. Signed-off-by: Nadav Har'El --- libc/pthread.cc

[PATCH] libc: fix setaffinity cpusetsize handling

2016-08-03 Thread Nadav Har'El
if cpusetsize is low, our code incorrectly looked beyond the end of the array, found random bits and usually complained that more than one is set. Use the correct set size, as specified by the user. Fixes #771. Signed-off-by: Nadav Har'El --- libc/pthread.cc | 2 +- 1 file changed, 1 inse

[PATCH] sockets: fix recvmsg() function

2016-08-03 Thread Nadav Har'El
code :-) This patch also adds a test for this bug, which passes on Linux, failed on OSv before this patch, and now passes on OSv too. Fixes #775 Signed-off-by: Nadav Har'El --- bsd/sys/kern/uipc_syscalls_wrap.cc | 8 +++ tests/tst-uio.cc

Re: [PATCH] sockets: fix recvmsg() function

2016-08-03 Thread Nadav Har'El
I observed that the same bug did NOT exist in sendmsg(), and decided to go with the same fix we already had there (deeper inside the code). So please disregard this patch and I'll send a new one. -- Nadav Har'El n...@scylladb.com On Wed, Aug 3, 2016 at 8:01 PM, Nadav Har'El

[PATCHv2] sockets: fix recvmsg() function

2016-08-03 Thread Nadav Har'El
commits: by making a temporary copy of the iovec array before calling the internal code which messes it up. This patch also adds a test for sendmsg() and recvmsg(), which passes on Linux, failed on OSv before this patch, and now passes on OSv too. Fixes #775 Signed-off-by: Nadav Har'El --- bs

Re: [PATCHv2] sockets: fix recvmsg() function

2016-08-03 Thread Nadav Har'El
quot;auio" structure and puts the pointer there, and since it's temporary we don't need to restore it. > > On Wed, Aug 3, 2016 at 7:27 PM, Nadav Har'El wrote: > >> The recvmsg() function had a bug where the internal implementation >> modified >> the i

Re: Mount points in OSv

2016-08-07 Thread Nadav Har'El
On Fri, Aug 5, 2016 at 1:22 PM, Krishnaprasad A S wrote: > How can I mount a local directory in OSv ? > What do you mean "a local directory"? Do you mean mount a second virtual disk with a ZFS partition? That should be doable. You can see the code in mount_zfs_rootfs() as an example of code whi

Re: [PATCH 1/3] libc: sched_setaffinity() on other threads

2016-08-07 Thread Nadav Har'El
On Fri, Aug 5, 2016 at 11:49 AM, Justin Cinkelj wrote: > This 3 patches work OK for me. > > Only one minor complain - once thread affinity is set to a single CPU, it > cannot be reset back to "all CPUs" (cpuset=0x0F, on 4 CPU VM). As Open MPI > only reports warning, I can ignore this :). > Yes,

Re: Build failed in Jenkins: osv-build #1103

2016-08-07 Thread Nadav Har'El
FYI, these tests have been failing for a long time on Jenkins, it's just that a "scripts/build" bug hid this failure (see https://github.com/cloudius-systems/osv/issues/779) On Sun, Aug 7, 2016 at 10:46 PM, wrote: > + exec ./scripts/test.py > TEST javaOK (2.766

Re: Mount points in OSv

2016-08-07 Thread Nadav Har'El
an also mount the ZFS filesystem from the image to your host and inspect it. We need to improve the wikis in this area (or maybe there are, and I'm just not aware of them). > On Sun, Aug 7, 2016 at 7:37 PM, Nadav Har'El wrote: > >> >> On Fri, Aug 5, 2016 at 1:22 PM, K

Re: [PATCH] libc: add CPU_COUNT_S

2016-08-08 Thread Nadav Har'El
__sched_cpucount() function, which is why we need it. So shouldn't we perhaps just do the same? Make CPU_COUNT and CPU_COUNT_S macros (or inline functions) which calls this __sched_cpucount() function, instead of replicating it? -- Nadav Har'El n...@scylladb.com On Mon, Aug 8, 2016 at 6:52 AM, Just

Re: Memory access violation

2016-08-08 Thread Nadav Har'El
On Mon, Aug 8, 2016 at 6:00 PM, Waldek Kozaczuk wrote: > Given that there is a single address space and single process in OSv I > would imagine it is possible for an application thread to access (read or > write) any memory due to a bug or intentionally and corrupt kernel/system > memory structur

[PATCH] Delete libc/network/getifaddrs.c

2016-08-09 Thread Nadav Har'El
The file libc/network/getifaddrs.c was not used - the Makefile was using the one from musl/. And it's not working anyway (issue #783). Signed-off-by: Nadav Har'El --- libc/network/getifaddrs.c | 180 -- 1 file changed, 180 deletions(-) d

[PATCH] Fix SIOCGIFCONF ioctl with zero size

2016-08-09 Thread Nadav Har'El
. Musl's if_nameindex() code calls this ioctl with increasing ifc_len starting with 0, so we need this patch for it not to fail on the first iteration of its loop. Signed-off-by: Nadav Har'El --- bsd/sys/compat/linux/linux_ioctl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) di

[PATCH] Fix if_nameindex()

2016-08-09 Thread Nadav Har'El
ose to create a UNIX domain socket, which is not currently supported in OSv (see issue #355). Just changing the code to use AF_INET instead of AF_UNIX makes it work correctly. Signed-off-by: Nadav Har'El --- Makefile| 2 +- libc/network

[PATCH] net: Allow SIOCGIFBRDADDR even without IFF_BROADCAST

2016-08-09 Thread Nadav Har'El
l about it, and so should we, to be compatible with Linux. With this patch (and the previous patch to another ioctl), the getifaddrs() now works. Fixes #783. Signed-off-by: Nadav Har'El --- bsd/sys/netinet/in.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/b

[PATCH] scripts/setup.py: add support for Fedora 24

2016-08-10 Thread Nadav Har'El
Add support for setup.py installing the prerequisite packages on Fedora 24. It appears that the same list of Fedora 23 works also on Fedora 24. Signed-off-by: Nadav Har'El --- scripts/setup.py | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/setup.py b/sc

Re: [PATCH v3] libc: add CPU_COUNT_S

2016-08-20 Thread Nadav Har'El
Thanks Justin. I've been away from civilization for a week (a vacation plus a malfunctioning laptop) so hopefully I'll be able to commit your patch tomorrow. The patch looks good and correct.. -- Nadav Har'El n...@scylladb.com On Thu, Aug 18, 2016 at 3:30 PM, Justin Cinkelj wr

Re: Questions on OSv Makefile or Capstanfile

2016-08-20 Thread Nadav Har'El
On Thu, Aug 18, 2016 at 2:41 PM, Benoît Canet wrote: > > For Makefile they are a well know UNIX mess. > One of the official documentation is here: https://www.gnu.org/ > software/make/manual/make.html but it's not easy to grok. > You will probably end up doing like everyone and make progress by c

Re: [PATCH 1/2] getifaddrs: Make getifaddr return physical interface mac address

2016-08-20 Thread Nadav Har'El
Hi Benoit, On Wed, Aug 17, 2016 at 9:54 PM, Benoit Canet < benoit.canet.cont...@gmail.com> wrote: > This fix a bug in OSv musl that has been fixed in upstream musl > by using netlink. Since OSv does not implement netlink add > a function in if.cc in order to copy and interface mac address > given

Re: Build failed in Jenkins: osv-build #1108

2016-08-21 Thread Nadav Har&#x27;El
now is to modify scripts/test.py to look for the tests actually installed on the image - not any file in build/release/tests. -- Nadav Har'El n...@scylladb.com On Sun, Aug 21, 2016 at 12:29 PM, wrote: > See <http://jenkins.cloudius-systems.com:8080/job/osv-build/1108/change

Re: [PATCH 2/2] ifup: mark the interface as running

2016-08-21 Thread Nadav Har&#x27;El
On Wed, Aug 17, 2016 at 9:54 PM, Benoit Canet < benoit.canet.cont...@gmail.com> wrote: > Signed-of-by: BenoÃt Canet > --- > bsd/porting/networking.cc | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/bsd/porting/networking.cc b/bsd/porting/networking.cc > index 1af0ecc..92

Re: [PATCH 1/2] libc: add pthread_getid utility fucntion

2016-08-21 Thread Nadav Har&#x27;El
Hi Justin, On Tue, Aug 16, 2016 at 9:50 AM, Justin Cinkelj wrote: > pthread_getid is only a convience function to convert pthread_t to > corresponding thread ID. It is added here to avoid manually casting > pthread_t to osv::pthread at other places. > > Signed-off-by: Justin Cinkelj > --- > i

Re: [PATCH 2/2] app: return main thread id to the caller

2016-08-21 Thread Nadav Har&#x27;El
Hi Justin, Unless I'm misunderstanding something, I think there is a race in your code: osv_execve() spawns a new thread to run a function thread_run_app_in_namespace(), and this will eventually set the value pointed by pid_t *thread_id. But that happens some time in the future, and at the time

Re: [PATCH 2/2] app: return main thread id to the caller

2016-08-21 Thread Nadav Har&#x27;El
On Sun, Aug 21, 2016 at 5:22 PM, Nadav Har'El wrote: > Hi Justin, > > > > Unless I'm misunderstanding something, I think there is a race in your > code: osv_execve() spawns a new thread to run a function > thread_run_app_in_namespace(), and this will eventually s

[PATCH] RFC: osv::run() do not create a new thread

2016-08-22 Thread Nadav Har&#x27;El
uses this new application::run_and_join(). The osv_execve() suffered from the unnecessary thread in that the actual application code does not run in the thread id returned by it, but rather in a child thread. After this patch, it should return the right thread id. Signed-off-by: Nadav Har'E

Re: [PATCH 2/2] app: return main thread id to the caller

2016-08-22 Thread Nadav Har&#x27;El
On Mon, Aug 22, 2016 at 12:31 PM, Justin Cinkelj wrote: > > > On 08/21/2016 04:38 PM, Nadav Har'El wrote: > > > > I've been thinking about this some more, and why you had to change your > osv_execve() implementation - which already returned a thread id, but th

Re: [PATCH 2/2] app: return main thread id to the caller

2016-08-22 Thread Nadav Har&#x27;El
> Maybe with_all_app_threads gets confused, as it seems to return thread ID > of threads belonging to orted.so, not to mpi_app.so. > I will try to modify tst-execve/tst-execve-payload to show that, without > using open mpi. > > BR Justin > > On 08/22/2016 02:09 PM, Nadav Ha

[PATCH] RFC: osv_execve: fix race in setting returned thread id

2016-08-22 Thread Nadav Har&#x27;El
efore returning. Signed-off-by: Nadav Har'El --- core/osv_execve.cc | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/osv_execve.cc b/core/osv_execve.cc index 5bd1d54..a7594b3 100644 --- a/core/osv_execve.cc +++ b/core/osv_execve.cc @@ -18,7 +18,8 @@

Re: [PATCH 2/2] app: return main thread id to the caller

2016-08-22 Thread Nadav Har&#x27;El
On Tue, Aug 23, 2016 at 12:32 AM, Nadav Har'El wrote: > > On Mon, Aug 22, 2016 at 6:51 PM, Justin Cinkelj > wrote: > >> Seems that here and there, osv_execve returns with thread_id still at 0, >> instead of containing new thread id. >> So a little race. >&

[PATCH] tests: test for osv::run()

2016-08-23 Thread Nadav Har&#x27;El
-off-by: Nadav Har'El --- tests/tst-run.cc | 54 ++ modules/tests/Makefile | 2 +- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 tests/tst-run.cc diff --git a/tests/tst-run.cc b/tests/tst-run.cc new file mode 1

Re: [PATCH 2/2] app: return main thread id to the caller

2016-08-23 Thread Nadav Har&#x27;El
On Tue, Aug 23, 2016 at 1:03 AM, Nadav Har'El wrote: > > On Tue, Aug 23, 2016 at 12:32 AM, Nadav Har'El wrote: > >> >> On Mon, Aug 22, 2016 at 6:51 PM, Justin Cinkelj >> wrote: >> >>> Seems that here and there, osv_execve returns with thread

Re: [PATCH 2/2] app: return main thread id to the caller

2016-08-23 Thread Nadav Har&#x27;El
On Tue, Aug 23, 2016 at 3:28 PM, Justin Cinkelj wrote: > > @nadav > With second RFC patch, osv_execve dosn't return thread_id==0 any more. > > > (code after RFC-2 pathc) The application::start_and_join() line > sched::thread::current()->set_app_runtime(runtime()); has to finish, so > that with_al

[PATCH] RFC: osv_execve() should wait for app_runtime to be set

2016-08-25 Thread Nadav Har&#x27;El
r only know use case. Signed-off-by: Nadav Har'El --- include/osv/app.hh | 7 +-- core/app.cc| 11 --- core/osv_execve.cc | 23 --- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/include/osv/app.hh b/include/osv/app.hh index dbdf

Re: [PATCH 2/2] app: return main thread id to the caller

2016-08-25 Thread Nadav Har&#x27;El
I just sent another RFC patch which should cause osv_execve to wait until app_runtime() is the new application's. I haven't really tested it much beyond the usual "make check" - can you please try it out? Thanks, Nadav. -- Nadav Har'El n...@scylladb.com On Wed, Aug 24

Re: [PATCH 1/2] x64: 'syscall' instruction support

2016-08-25 Thread Nadav Har&#x27;El
Hi Benoit (and Pekka), thanks. Here are some comments and questions: -- Nadav Har'El n...@scylladb.com On Thu, Aug 25, 2016 at 1:07 PM, Benoit Canet < benoit.canet.cont...@gmail.com> wrote: > Enable "fast system calls" via the 'syscall' instruction on OS

Re: [PATCH 2/2] syscalls: Add most syscalls required by GO binaries

2016-08-25 Thread Nadav Har&#x27;El
On Thu, Aug 25, 2016 at 1:07 PM, Benoit Canet < benoit.canet.cont...@gmail.com> wrote: > The commented one will require manual work. > > Signed-off-by: Benoît Canet > --- > linux.cc | 56 > syscalls.h | 141 ++ >

[PATCH] apps: trivial (and non-working) fpc example application

2016-08-25 Thread Nadav Har&#x27;El
ed on http://wiki.lazarus.freepascal.org/Free_Pascal_on_OSv but I wanted to not need the special linking instructions. Signed-off-by: Nadav Har'El --- fpc-example/module.py | 3 +++ fpc-example/Makefile | 11 +++ fpc-example/README| 1 + fpc-example/fpc

Re: [PATCH 1/2] x64: 'syscall' instruction support

2016-08-28 Thread Nadav Har&#x27;El
fies errno, which it shouldn't. I think you need to save errno before calling syscall(), and restore it after the call. Some more minor comments below. -- Nadav Har'El n...@scylladb.com On Sun, Aug 28, 2016 at 10:17 AM, Benoit Canet wrote: > Enable "fast system calls"

Re: [PATCH 2/2] app: return main thread id to the caller

2016-08-28 Thread Nadav Har&#x27;El
s>}, > _wakeup_link = {_helper = 0xa2776188, _next = > 0xa56baf80}, static _s_idgen = 370, static _s_reaper = > 0x827df040, > stat_switches = {_counter = {> = {_M_i > = 571}, }}, stat_preemptions = { > ---Type to continue, or q to quit--- > _

Re: [PATCH 1/2] x64: 'syscall' instruction support

2016-08-28 Thread Nadav Har&#x27;El
Hi Benoit, sorry for all these iterations, but there are some important issues below (especialy the last one). On Sun, Aug 28, 2016 at 1:11 PM, Benoit Canet < benoit.canet.cont...@gmail.com> wrote: > Enable "fast system calls" via the 'syscall' instruction on OSv. The > instruction is used by Go

Re: [PATCH 2/2] app: return main thread id to the caller

2016-08-28 Thread Nadav Har&#x27;El
By the way, a question: When running with "-V" (--verbose), do you see a warning about a stubbed "pthread_key_delete" function? -- Nadav Har'El n...@scylladb.com On Sun, Aug 28, 2016 at 12:42 PM, Nadav Har'El wrote: > > On Fri, Aug 26, 2016 at 2:55 PM,

[PATCH] RFC: run pthread TSD destructors before resetting app runtime

2016-08-28 Thread Nadav Har&#x27;El
d too!). It's a hack, but should be good enough for use cases like osv_execve() which anyway uses a fresh thread for running the application. Signed-off-by: Nadav Har'El --- libc/pthread.hh | 4 core/app.cc | 9 + libc/pthread.cc | 38 ++--

Re: [PATCH] RFC: run pthread TSD destructors before resetting app runtime

2016-08-28 Thread Nadav Har&#x27;El
Hi Justin, I hate this patch, but can you please check if it fixes your crash-during-exit problem that you reported yesterday? -- Nadav Har'El n...@scylladb.com On Sun, Aug 28, 2016 at 3:29 PM, Nadav Har'El wrote: > The change to osv::run() (and friends) to reuse the calling

[PATCH] pthread: implement pthread_key_delete()

2016-08-28 Thread Nadav Har&#x27;El
-great side of not re-using keys is that our current implementation is limited to 128 keys so we can run out of them. But this patch doesn't make this any worse than before. Signed-off-by: Nadav Har'El --- libc/pthread.cc | 15 +-- 1 file changed, 13 insertions(+), 2 deletion

Re: [PATCH v5 1/2] x64: 'syscall' instruction support

2016-08-28 Thread Nadav Har&#x27;El
Looks good. Just some nitpicks about the stack stuff and debugging stuff below. On Sun, Aug 28, 2016 at 4:01 PM, Benoit Canet < benoit.canet.cont...@gmail.com> wrote: > Enable "fast system calls" via the 'syscall' instruction on OSv. The > instruction is used by Go programs on Linux/x86-64 for sy

Re: [PATCH v5 1/2] x64: 'syscall' instruction support

2016-08-28 Thread Nadav Har&#x27;El
On Sun, Aug 28, 2016 at 4:26 PM, Benoît Canet wrote: > > I opted for a signal frame because linux does it for the syscall > instruction handler. > Ok. It's a bit strange, but I'll commit this for now and we can fix later if we want. -- You received this message because you are subscribed to t

Re: [PATCH] syscall: Add a C syscall example

2016-08-28 Thread Nadav Har&#x27;El
o get this test to actually work :-) Nadav. -- Nadav Har'El n...@scylladb.com On Sun, Aug 28, 2016 at 5:38 PM, Benoit Canet < benoit.canet.cont...@gmail.com> wrote: > This C syscall example is just doing exit(42) > > Signed-off-by: Benoît Canet > --- > syscall/Makefil

[PATCH] Partial fix for syscall instruction

2016-08-29 Thread Nadav Har&#x27;El
compilation, on both single vcpu (run.py -c1) and many (-c4). With debug build, the patch still fails - I have other fixes to make it work. Refs #791. Signed-off-by: Nadav Har'El --- arch/x64/arch-cpu.hh | 2 ++ arch/x64/processor.hh | 2 ++ arch/x64/arch-setup.cc | 6 +++--- 3 files chang

[PATCH] syscall: save also %rbp

2016-08-29 Thread Nadav Har&#x27;El
Not saving and restoring the rbp register causes tst-syscall to crash in the debug build. Refs #791. Signed-off-by: Nadav Har'El --- arch/x64/entry.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x64/entry.S b/arch/x64/entry.S index 0526aa7..c2417b8 100644 --- a/arch/x64/en

Re: [PATCH] syscall: save also %rbp

2016-08-29 Thread Nadav Har&#x27;El
On Mon, Aug 29, 2016 at 1:47 PM, Benoît Canet wrote: > > If you look as the assembly dump of loader.elf you will see save saving > rbp and restoring it is usually the first and last thing function do. > > It marks the begining of a frame. > Yes, that is the old-style "frame pointers" way of figu

[PATCH] syscall: set syscall_entry() symbol size to non-zero

2016-08-29 Thread Nadav Har&#x27;El
nctions as well, but this one bothered me. Signed-off-by: Nadav Har'El --- arch/x64/entry.S | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x64/entry.S b/arch/x64/entry.S index 0526aa7..25f3cba 100644 --- a/arch/x64/entry.S +++ b/arch/x64/entry.S @@ -255,3 +255,4 @@ syscall_entry

[PATCH] syscall: save also %rbp and align stack

2016-08-29 Thread Nadav Har&#x27;El
this patch also code to align the stack to 16 bytes before calling the C function. We use a nice trick to do that without using up another register. Signed-off-by: Nadav Har'El --- arch/x64/entry.S | 28 1 file changed, 28 insertions(+) diff --git a/arch/x64/ent

Re: [PATCH] syscall: save also %rbp and align stack

2016-08-29 Thread Nadav Har&#x27;El
gnal, when it can resemble a norma function call? Would you have any objection that you or I clean up all these duplicate saved stuff in syscall_entry(), and *not* emulate a signal frame? All the CFI stuff in this function is broken anyway, and will need to be reworked. -- Nadav Har'El n...@s

Re: [PATCH v2 1/2] syscall: implement rt_sigaction

2016-08-29 Thread Nadav Har&#x27;El
It seems I committed the first version of this patch. I don't know how the second version differed. If it did, please send an incremental patch. -- Nadav Har'El n...@scylladb.com On Mon, Aug 29, 2016 at 4:10 PM, Benoit Canet < benoit.canet.cont...@gmail.com> wrote: > This

[PATCH] syscall: skip red zone

2016-08-29 Thread Nadav Har&#x27;El
sary. Signed-off-by: Nadav Har'El --- arch/x64/entry.S | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/x64/entry.S b/arch/x64/entry.S index 48a0a71..cdd2c61 100644 --- a/arch/x64/entry.S +++ b/arch/x64/entry.S @@ -166,6 +166,10 @@ syscall_entry: .cfi_startproc simple

Re: [PATCH] syscall: skip red zone

2016-08-29 Thread Nadav Har&#x27;El
only then try to skip the red zone - by that time we will have already overwritten the caller's precious red-zone data. > > On Mon, Aug 29, 2016 at 4:14 PM, Nadav Har'El wrote: > >> The AMD64 ABI allows a function to use 128 bytes beyond the bottom of the >> stack

Re: [PATCH] syscall: skip red zone

2016-08-29 Thread Nadav Har&#x27;El
On Mon, Aug 29, 2016 at 5:57 PM, Avi Kivity wrote: > > > On 08/29/2016 05:14 PM, Nadav Har'El wrote: > >> The AMD64 ABI allows a function to use 128 bytes beyond the bottom of the >> stack without updating the stack pointer - as an optimization known as the >>

[PATCH] syscall: fix CFI information for debugging with GDB

2016-08-29 Thread Nadav Har&#x27;El
the registers saved on the stack, so I took this opportunity to remove some of the useless things we saved or saved multiple times. Signed-off-by: Nadav Har'El --- arch/x64/entry.S | 104 +-- 1 file changed, 40 insertions(+), 64 deletions(

Re: [PATCH] syscall: fix CFI information for debugging with GDB

2016-08-29 Thread Nadav Har&#x27;El
On Mon, Aug 29, 2016 at 8:12 PM, Avi Kivity wrote: > > > On 08/29/2016 08:10 PM, Benoît Canet wrote: > > > > On Mon, Aug 29, 2016 at 7:08 PM, Avi Kivity wrote: > >> diff --git a/arch/x64/entry.S b/arch/x64/entry.S >> >>> index e265a30..e3be0bc 100644 >>> --- a/arch/x64/entry.S >>> +++ b/arch/x64

[PATCH 1/2] syscall: fix indentation mishmash in entry.S

2016-08-29 Thread Nadav Har&#x27;El
No functional changes. Signed-off-by: Nadav Har'El --- arch/x64/entry.S | 166 --- 1 file changed, 86 insertions(+), 80 deletions(-) diff --git a/arch/x64/entry.S b/arch/x64/entry.S index 48a0a71..e265a30 100644 --- a/arch/x64/entry.S

[PATCH 2/2] syscall: fix CFI information for debugging with GDB

2016-08-29 Thread Nadav Har&#x27;El
out of the registers saved on the stack, so I took this opportunity to remove some of the useless things we saved (like rax, which will be overwritten by a return value anyway) or saved multiple times (rcx, rsp). Signed-off-by: Nadav Har'El --

<    6   7   8   9   10   11   12   13   14   >