Re: [uml-devel] [PATCH] um: Switch clocksource to hrtimers

2015-10-16 Thread Anton Ivanov
I have it ported to 4.3-rc5 and the new timer API.

It is about half-way through a debian dist-upgrade which was reliably 
crashing earlier versions.

I am going to give it a spin over the weekend and if it is stable I will 
clean it up for submission.

A.


On 14/10/15 12:22, Thomas Meyer wrote:
> Am 14.10.2015 11:23 vorm. schrieb Anton Ivanov 
> :
>> On 14/10/15 09:25, Thomas Meyer wrote:
>>> Hello everyone,
>>>
>>> I would like to finish this patch, but I'm currently very busy. Sorry!
>> No worries :) I am barely keeping my head above water too :)
>>
>> Is the most up-to-date revision the one you last posted to the list?
> Yes,the post on the list was the latest version.
>
>> If
>> you have a more up-to-date one, please post it even if it does not patch
>> cleanly and needs work. I will work on it.
>>
>> A.
>>
>>> Anton: it would be great if you could finish this patch! Much appreciated!
>>>
>>> With kind regards
>>> Thomas
>>>
>>> Am 14.10.2015 8:12 vorm. schrieb Anton Ivanov 
>>> :
 Thomas, I need to know if you have the time-slices for this or I should
 take over and finish it.

 In addition to what Richard said I have the epoll based IRQ controller
 and high-performance network pipeline which depend on it in the queue.

 Brgds,

 A.

 On 13/10/15 22:45, Richard Weinberger wrote:
> On Tue, Aug 18, 2015 at 6:04 PM, Thomas Meyer  wrote:
>> Am 15.08.2015 10:15 vorm. schrieb Richard Weinberger :
>>> Am 09.08.2015 um 19:53 schrieb Thomas Meyer:
 Switch the UML clocksource from interval timers to posix interval 
 timers and
 move to a monotonic timer.

 This fixes suspend related timer issues and improves network 
 performance
 as TCP state machines are now fed with the correct time; also correct 
 QoS and
 traffic shaping.
>>> The patch is rather big. Please describe in your commit message how 
>>> exactly
>>> it works and why.
>>> It changes many internals.
>> Will do so!
> Can I get an updated version of that patch?
> I really want to merge it in the next merge window.
>
 --
 ___
 User-mode-linux-devel mailing list
 User-mode-linux-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


--
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] [PATCH] um: Switch clocksource to hrtimers

2015-10-14 Thread Anton Ivanov
Thomas, I need to know if you have the time-slices for this or I should 
take over and finish it.

In addition to what Richard said I have the epoll based IRQ controller 
and high-performance network pipeline which depend on it in the queue.

Brgds,

A.

On 13/10/15 22:45, Richard Weinberger wrote:
> On Tue, Aug 18, 2015 at 6:04 PM, Thomas Meyer  wrote:
>> Am 15.08.2015 10:15 vorm. schrieb Richard Weinberger :
>>> Am 09.08.2015 um 19:53 schrieb Thomas Meyer:
 Switch the UML clocksource from interval timers to posix interval timers 
 and
 move to a monotonic timer.

 This fixes suspend related timer issues and improves network 
 performance
 as TCP state machines are now fed with the correct time; also correct QoS 
 and
 traffic shaping.
>>> The patch is rather big. Please describe in your commit message how exactly
>>> it works and why.
>>> It changes many internals.
>> Will do so!
> Can I get an updated version of that patch?
> I really want to merge it in the next merge window.
>


--
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] [PATCH] um: Switch clocksource to hrtimers

2015-10-14 Thread Thomas Meyer
Hello everyone,

I would like to finish this patch, but I'm currently very busy. Sorry!

Anton: it would be great if you could finish this patch! Much appreciated!

With kind regards
Thomas

Am 14.10.2015 8:12 vorm. schrieb Anton Ivanov :
>
> Thomas, I need to know if you have the time-slices for this or I should 
> take over and finish it. 
>
> In addition to what Richard said I have the epoll based IRQ controller 
> and high-performance network pipeline which depend on it in the queue. 
>
> Brgds, 
>
> A. 
>
> On 13/10/15 22:45, Richard Weinberger wrote: 
> > On Tue, Aug 18, 2015 at 6:04 PM, Thomas Meyer  wrote: 
> >> Am 15.08.2015 10:15 vorm. schrieb Richard Weinberger : 
> >>> Am 09.08.2015 um 19:53 schrieb Thomas Meyer: 
>  Switch the UML clocksource from interval timers to posix interval timers 
>  and 
>  move to a monotonic timer. 
>  
>  This fixes suspend related timer issues and improves network 
>  performance 
>  as TCP state machines are now fed with the correct time; also correct 
>  QoS and 
>  traffic shaping. 
> >>> The patch is rather big. Please describe in your commit message how 
> >>> exactly 
> >>> it works and why. 
> >>> It changes many internals. 
> >> Will do so! 
> > Can I get an updated version of that patch? 
> > I really want to merge it in the next merge window. 
> > 
>
>
> --
>  
> ___ 
> User-mode-linux-devel mailing list 
> User-mode-linux-devel@lists.sourceforge.net 
> https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel 
--
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] [PATCH] um: Switch clocksource to hrtimers

2015-10-14 Thread Anton Ivanov
On 14/10/15 09:25, Thomas Meyer wrote:
> Hello everyone,
>
> I would like to finish this patch, but I'm currently very busy. Sorry!

No worries :) I am barely keeping my head above water too :)

Is the most up-to-date revision the one you last posted to the list? If 
you have a more up-to-date one, please post it even if it does not patch 
cleanly and needs work. I will work on it.

A.

>
> Anton: it would be great if you could finish this patch! Much appreciated!
>
> With kind regards
> Thomas
>
> Am 14.10.2015 8:12 vorm. schrieb Anton Ivanov 
> :
>> Thomas, I need to know if you have the time-slices for this or I should
>> take over and finish it.
>>
>> In addition to what Richard said I have the epoll based IRQ controller
>> and high-performance network pipeline which depend on it in the queue.
>>
>> Brgds,
>>
>> A.
>>
>> On 13/10/15 22:45, Richard Weinberger wrote:
>>> On Tue, Aug 18, 2015 at 6:04 PM, Thomas Meyer  wrote:
 Am 15.08.2015 10:15 vorm. schrieb Richard Weinberger :
> Am 09.08.2015 um 19:53 schrieb Thomas Meyer:
>> Switch the UML clocksource from interval timers to posix interval timers 
>> and
>> move to a monotonic timer.
>>
>> This fixes suspend related timer issues and improves network 
>> performance
>> as TCP state machines are now fed with the correct time; also correct 
>> QoS and
>> traffic shaping.
> The patch is rather big. Please describe in your commit message how 
> exactly
> it works and why.
> It changes many internals.
 Will do so!
>>> Can I get an updated version of that patch?
>>> I really want to merge it in the next merge window.
>>>
>>
>> --
>> ___
>> User-mode-linux-devel mailing list
>> User-mode-linux-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


--
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] [PATCH] um: Switch clocksource to hrtimers

2015-10-14 Thread Thomas Meyer
Am 14.10.2015 11:23 vorm. schrieb Anton Ivanov :
>
> On 14/10/15 09:25, Thomas Meyer wrote: 
> > Hello everyone, 
> > 
> > I would like to finish this patch, but I'm currently very busy. Sorry! 
>
> No worries :) I am barely keeping my head above water too :) 
>
> Is the most up-to-date revision the one you last posted to the list?

Yes,the post on the list was the latest version.

> If 
> you have a more up-to-date one, please post it even if it does not patch 
> cleanly and needs work. I will work on it. 
>
> A. 
>
> > 
> > Anton: it would be great if you could finish this patch! Much appreciated! 
> > 
> > With kind regards 
> > Thomas 
> > 
> > Am 14.10.2015 8:12 vorm. schrieb Anton Ivanov 
> > : 
> >> Thomas, I need to know if you have the time-slices for this or I should 
> >> take over and finish it. 
> >> 
> >> In addition to what Richard said I have the epoll based IRQ controller 
> >> and high-performance network pipeline which depend on it in the queue. 
> >> 
> >> Brgds, 
> >> 
> >> A. 
> >> 
> >> On 13/10/15 22:45, Richard Weinberger wrote: 
> >>> On Tue, Aug 18, 2015 at 6:04 PM, Thomas Meyer  wrote: 
>  Am 15.08.2015 10:15 vorm. schrieb Richard Weinberger : 
> > Am 09.08.2015 um 19:53 schrieb Thomas Meyer: 
> >> Switch the UML clocksource from interval timers to posix interval 
> >> timers and 
> >> move to a monotonic timer. 
> >> 
> >> This fixes suspend related timer issues and improves network 
> >> performance 
> >> as TCP state machines are now fed with the correct time; also correct 
> >> QoS and 
> >> traffic shaping. 
> > The patch is rather big. Please describe in your commit message how 
> > exactly 
> > it works and why. 
> > It changes many internals. 
>  Will do so! 
> >>> Can I get an updated version of that patch? 
> >>> I really want to merge it in the next merge window. 
> >>> 
> >> 
> >> --
> >>  
> >> ___ 
> >> User-mode-linux-devel mailing list 
> >> User-mode-linux-devel@lists.sourceforge.net 
> >> https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel 
>
--
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] [PATCH] um: Switch clocksource to hrtimers

2015-10-13 Thread Richard Weinberger
On Tue, Aug 18, 2015 at 6:04 PM, Thomas Meyer  wrote:
> Am 15.08.2015 10:15 vorm. schrieb Richard Weinberger :
>>
>> Am 09.08.2015 um 19:53 schrieb Thomas Meyer:
>> > Switch the UML clocksource from interval timers to posix interval timers 
>> > and
>> > move to a monotonic timer.
>> >
>> > This fixes suspend related timer issues and improves network 
>> > performance
>> > as TCP state machines are now fed with the correct time; also correct QoS 
>> > and
>> > traffic shaping.
>>
>> The patch is rather big. Please describe in your commit message how exactly
>> it works and why.
>> It changes many internals.
>
> Will do so!

Can I get an updated version of that patch?
I really want to merge it in the next merge window.

-- 
Thanks,
//richard

--
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] [PATCH] um: Switch clocksource to hrtimers

2015-08-18 Thread Richard Weinberger
On Sat, Aug 15, 2015 at 6:27 PM, Anton Ivanov
anton.iva...@kot-begemot.co.uk wrote:
 On 15/08/15 09:15, Richard Weinberger wrote:
 Am 09.08.2015 um 19:53 schrieb Thomas Meyer:
 Switch the UML clocksource from interval timers to posix interval timers and
 move to a monotonic timer.

 This fixes suspendresume related timer issues and improves network 
 performance
 as TCP state machines are now fed with the correct time; also correct QoS 
 and
 traffic shaping.
 The patch is rather big. Please describe in your commit message how exactly
 it works and why.
 It changes many internals.

 Tom, I will be happy to assist with the drafting, feel free to take the
 draft conversation off-list until we are ready.

BTW: I'm definitely willing to merge this patch, I you miss the merge window
I can also merge it in -rc2 or -rc3 as it fixes some nasty issues.

-- 
Thanks,
//richard

--
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] [PATCH] um: Switch clocksource to hrtimers

2015-08-18 Thread Anton Ivanov
If Thomas is busy I can pick it up ~ middle of next week and finish it.

A.

On 18/08/15 10:34, Richard Weinberger wrote:
 On Sat, Aug 15, 2015 at 6:27 PM, Anton Ivanov
 anton.iva...@kot-begemot.co.uk wrote:
 On 15/08/15 09:15, Richard Weinberger wrote:
 Am 09.08.2015 um 19:53 schrieb Thomas Meyer:
 Switch the UML clocksource from interval timers to posix interval timers 
 and
 move to a monotonic timer.

 This fixes suspendresume related timer issues and improves network 
 performance
 as TCP state machines are now fed with the correct time; also correct QoS 
 and
 traffic shaping.
 The patch is rather big. Please describe in your commit message how exactly
 it works and why.
 It changes many internals.
 Tom, I will be happy to assist with the drafting, feel free to take the
 draft conversation off-list until we are ready.
 BTW: I'm definitely willing to merge this patch, I you miss the merge window
 I can also merge it in -rc2 or -rc3 as it fixes some nasty issues.



--
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] [PATCH] um: Switch clocksource to hrtimers

2015-08-18 Thread Thomas Meyer
Am 15.08.2015 10:15 vorm. schrieb Richard Weinberger rich...@nod.at:

 Am 09.08.2015 um 19:53 schrieb Thomas Meyer: 
  Switch the UML clocksource from interval timers to posix interval timers 
  and 
  move to a monotonic timer. 
  
  This fixes suspendresume related timer issues and improves network 
  performance 
  as TCP state machines are now fed with the correct time; also correct QoS 
  and 
  traffic shaping. 

 The patch is rather big. Please describe in your commit message how exactly 
 it works and why. 
 It changes many internals. 

Will do so!


  Signed-off-by: Thomas Meyer tho...@m3y3r.de 

 Please honor also the original author of the patch. 

Sure! Give credit where credit is due!


  --- 
   arch/um/Makefile    |   2 +- 
   arch/um/include/shared/os.h |  15 +- 
   arch/um/include/shared/skas/stub-data.h |   5 +- 
   arch/um/include/shared/timer-internal.h |  13 ++ 
   arch/um/kernel/process.c    |   6 +- 
   arch/um/kernel/skas/clone.c |   5 - 
   arch/um/kernel/skas/mmu.c   |   2 + 
   arch/um/kernel/time.c   |  80 +++ 
   arch/um/os-Linux/internal.h |   1 - 
   arch/um/os-Linux/main.c |   6 +- 
   arch/um/os-Linux/process.c  |   5 + 
   arch/um/os-Linux/signal.c   |  35 +++-- 
   arch/um/os-Linux/skas/process.c |  44 ++ 
   arch/um/os-Linux/time.c | 248 
  
   14 files changed, 234 insertions(+), 233 deletions(-) 
   create mode 100644 arch/um/include/shared/timer-internal.h 
   delete mode 100644 arch/um/os-Linux/internal.h 
  
  diff --git a/arch/um/Makefile b/arch/um/Makefile 
  index 098ab33..eb79b4b 100644 
  --- a/arch/um/Makefile 
  +++ b/arch/um/Makefile 
  @@ -131,7 +131,7 @@ export LDS_ELF_FORMAT := $(ELF_FORMAT) 
   # The wrappers will select whether using malloc or the kernel allocator. 
   LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc 
   
  -LD_FLAGS_CMDLINE = $(foreach opt,$(LDFLAGS),-Wl,$(opt)) 
  +LD_FLAGS_CMDLINE = $(foreach opt,$(LDFLAGS),-Wl,$(opt)) -lrt 
   
   # Used by link-vmlinux.sh which has special support for um link 
   export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE) 
  diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h 
  index ad3fa3a..7519c98 100644 
  --- a/arch/um/include/shared/os.h 
  +++ b/arch/um/include/shared/os.h 
  @@ -183,6 +183,7 @@ extern int create_mem_file(unsigned long long len); 
   /* process.c */ 
   extern unsigned long os_process_pc(int pid); 
   extern int os_process_parent(int pid); 
  +extern void os_alarm_process(int pid); 
   extern void os_stop_process(int pid); 
   extern void os_kill_process(int pid, int reap_child); 
   extern void os_kill_ptraced_process(int pid, int reap_child); 
  @@ -217,7 +218,7 @@ extern int set_umid(char *name); 
   extern char *get_umid(void); 
   
   /* signal.c */ 
  -extern void timer_init(void); 
  +extern void timer_set_signal_handler(void); 
   extern void set_sigstack(void *sig_stack, int size); 
   extern void remove_sigstack(void); 
   extern void set_handler(int sig); 
  @@ -238,12 +239,16 @@ extern void um_early_printk(const char *s, unsigned 
  int n); 
   extern void os_fix_helper_signals(void); 
   
   /* time.c */ 
  -extern void idle_sleep(unsigned long long nsecs); 
  -extern int set_interval(void); 
  -extern int timer_one_shot(int ticks); 
  -extern long long disable_timer(void); 
  +extern void os_idle_sleep(unsigned long long nsecs); 
  +extern int os_timer_create(void* timer); 
  +extern int os_timer_set_interval(void* timer, void* its); 
  +extern int os_timer_one_shot(int ticks); 
  +extern long long os_timer_disable(void); 
  +extern long os_timer_remain(void* timer); 
   extern void uml_idle_timer(void); 
  +extern long long os_persistent_clock_emulation(void); 
   extern long long os_nsecs(void); 
  +extern long long os_vnsecs(void); 
   
   /* skas/mem.c */ 
   extern long run_syscall_stub(struct mm_id * mm_idp, 
  diff --git a/arch/um/include/shared/skas/stub-data.h 
  b/arch/um/include/shared/skas/stub-data.h 
  index f6ed92c..e09d8fd 100644 
  --- a/arch/um/include/shared/skas/stub-data.h 
  +++ b/arch/um/include/shared/skas/stub-data.h 
  @@ -6,12 +6,11 @@ 
   #ifndef __STUB_DATA_H 
   #define __STUB_DATA_H 
   
  -#include sys/time.h 
  +#include time.h 
   
   struct stub_data { 
  - long offset; 
  + unsigned long offset; 
   int fd; 
  - struct itimerval timer; 
   long err; 
   }; 
   
  diff --git a/arch/um/include/shared/timer-internal.h 
  b/arch/um/include/shared/timer-internal.h 
  new file mode 100644 
  index 000..03e6f21 
  --- /dev/null 
  +++ b/arch/um/include/shared/timer-internal.h 
  @@ -0,0 +1,13 @@ 
  +/* 
  + * Copyright (C) 2012 - 2014 Cisco Systems 
  + * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) 
  + * Licensed under the GPL 
  + */ 
  + 
  +#ifndef 

[uml-devel] [PATCH] um: Switch clocksource to hrtimers

2015-08-09 Thread Thomas Meyer
Switch the UML clocksource from interval timers to posix interval timers and
move to a monotonic timer.

This fixes suspendresume related timer issues and improves network performance
as TCP state machines are now fed with the correct time; also correct QoS and
traffic shaping.

Signed-off-by: Thomas Meyer tho...@m3y3r.de
---
 arch/um/Makefile|   2 +-
 arch/um/include/shared/os.h |  15 +-
 arch/um/include/shared/skas/stub-data.h |   5 +-
 arch/um/include/shared/timer-internal.h |  13 ++
 arch/um/kernel/process.c|   6 +-
 arch/um/kernel/skas/clone.c |   5 -
 arch/um/kernel/skas/mmu.c   |   2 +
 arch/um/kernel/time.c   |  80 +++
 arch/um/os-Linux/internal.h |   1 -
 arch/um/os-Linux/main.c |   6 +-
 arch/um/os-Linux/process.c  |   5 +
 arch/um/os-Linux/signal.c   |  35 +++--
 arch/um/os-Linux/skas/process.c |  44 ++
 arch/um/os-Linux/time.c | 248 
 14 files changed, 234 insertions(+), 233 deletions(-)
 create mode 100644 arch/um/include/shared/timer-internal.h
 delete mode 100644 arch/um/os-Linux/internal.h

diff --git a/arch/um/Makefile b/arch/um/Makefile
index 098ab33..eb79b4b 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -131,7 +131,7 @@ export LDS_ELF_FORMAT := $(ELF_FORMAT)
 # The wrappers will select whether using malloc or the kernel allocator.
 LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
 
-LD_FLAGS_CMDLINE = $(foreach opt,$(LDFLAGS),-Wl,$(opt))
+LD_FLAGS_CMDLINE = $(foreach opt,$(LDFLAGS),-Wl,$(opt)) -lrt
 
 # Used by link-vmlinux.sh which has special support for um link
 export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE)
diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h
index ad3fa3a..7519c98 100644
--- a/arch/um/include/shared/os.h
+++ b/arch/um/include/shared/os.h
@@ -183,6 +183,7 @@ extern int create_mem_file(unsigned long long len);
 /* process.c */
 extern unsigned long os_process_pc(int pid);
 extern int os_process_parent(int pid);
+extern void os_alarm_process(int pid);
 extern void os_stop_process(int pid);
 extern void os_kill_process(int pid, int reap_child);
 extern void os_kill_ptraced_process(int pid, int reap_child);
@@ -217,7 +218,7 @@ extern int set_umid(char *name);
 extern char *get_umid(void);
 
 /* signal.c */
-extern void timer_init(void);
+extern void timer_set_signal_handler(void);
 extern void set_sigstack(void *sig_stack, int size);
 extern void remove_sigstack(void);
 extern void set_handler(int sig);
@@ -238,12 +239,16 @@ extern void um_early_printk(const char *s, unsigned int 
n);
 extern void os_fix_helper_signals(void);
 
 /* time.c */
-extern void idle_sleep(unsigned long long nsecs);
-extern int set_interval(void);
-extern int timer_one_shot(int ticks);
-extern long long disable_timer(void);
+extern void os_idle_sleep(unsigned long long nsecs);
+extern int os_timer_create(void* timer);
+extern int os_timer_set_interval(void* timer, void* its);
+extern int os_timer_one_shot(int ticks);
+extern long long os_timer_disable(void);
+extern long os_timer_remain(void* timer);
 extern void uml_idle_timer(void);
+extern long long os_persistent_clock_emulation(void);
 extern long long os_nsecs(void);
+extern long long os_vnsecs(void);
 
 /* skas/mem.c */
 extern long run_syscall_stub(struct mm_id * mm_idp,
diff --git a/arch/um/include/shared/skas/stub-data.h 
b/arch/um/include/shared/skas/stub-data.h
index f6ed92c..e09d8fd 100644
--- a/arch/um/include/shared/skas/stub-data.h
+++ b/arch/um/include/shared/skas/stub-data.h
@@ -6,12 +6,11 @@
 #ifndef __STUB_DATA_H
 #define __STUB_DATA_H
 
-#include sys/time.h
+#include time.h
 
 struct stub_data {
-   long offset;
+   unsigned long offset;
int fd;
-   struct itimerval timer;
long err;
 };
 
diff --git a/arch/um/include/shared/timer-internal.h 
b/arch/um/include/shared/timer-internal.h
new file mode 100644
index 000..03e6f21
--- /dev/null
+++ b/arch/um/include/shared/timer-internal.h
@@ -0,0 +1,13 @@
+/*
+ * Copyright (C) 2012 - 2014 Cisco Systems
+ * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
+ * Licensed under the GPL
+ */
+
+#ifndef __TIMER_INTERNAL_H__
+#define __TIMER_INTERNAL_H__
+
+#define TIMER_MULTIPLIER 256
+#define TIMER_MIN_DELTA  500
+
+#endif
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index 68b9119..2ce38c1 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -27,6 +27,7 @@
 #include kern_util.h
 #include os.h
 #include skas.h
+#include timer-internal.h
 
 /*
  * This is a per-cpu array.  A processor only modifies its entry and it only
@@ -201,11 +202,8 @@ void initial_thread_cb(void (*proc)(void *), void *arg)
 
 void arch_cpu_idle(void)
 {
-   unsigned long long nsecs;
-
cpu_tasks[current_thread_info()-cpu].pid = os_getpid();
-   

Re: [uml-devel] [PATCH] um: Switch clocksource to hrtimers

2015-06-25 Thread Thomas Meyer
Am Donnerstag, den 04.06.2015, 12:04 +0200 schrieb Thomas Meyer:
 
 Hi,
 
 below patch get's rid of all userspace timers.
 When a kernel timer interrupt is received the userspace process of 
 the
 corresponding task is signaled via SIGALRM.
 The SIGALRM signal forces the userspace process to go back into
 userspace() function. There the SIGALRM signal is ignored as the
 interrupt was already processed anyway by the uml kernel.
 
 what do you think about this approach?
 
 Can you give this patch a try

Hi,

I see a hang in copy_context_skas0().
I think this is because the stub code is executing and timer interrupts
are still enabled.

The timer interrupt will signal the process (==from_mm) which is now in
the stub_clone_handler() (see also init_thread_regs()).

So any ideas how to avoid signaling userspace process currently in
stub_clone_handler()? would it be an option to disable interrupts
before copy_context_skas0()?

Richard, what do you think?

with regards
thomas

 
 with kind regards
 thomas
 
 diff --git a/arch/um/Makefile b/arch/um/Makefile
 index 17d4460..a4a434f 100644
 --- a/arch/um/Makefile
 +++ b/arch/um/Makefile
 @@ -130,7 +130,7 @@ export LDS_ELF_FORMAT := $(ELF_FORMAT)
  # The wrappers will select whether using malloc or the kernel 
 allocator.
  LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
  
 -LD_FLAGS_CMDLINE = $(foreach opt,$(LDFLAGS),-Wl,$(opt))
 +LD_FLAGS_CMDLINE = $(foreach opt,$(LDFLAGS),-Wl,$(opt)) -lrt
  
  # Used by link-vmlinux.sh which has special support for um link
  export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE)
 diff --git a/arch/um/include/shared/os.h 
 b/arch/um/include/shared/os.h
 index d824528..8f8f5d7 100644
 --- a/arch/um/include/shared/os.h
 +++ b/arch/um/include/shared/os.h
 @@ -183,6 +183,7 @@ extern int create_mem_file(unsigned long long 
 len);
  /* process.c */
  extern unsigned long os_process_pc(int pid);
  extern int os_process_parent(int pid);
 +extern void os_alarm_process(int pid);
  extern void os_stop_process(int pid);
  extern void os_kill_process(int pid, int reap_child);
  extern void os_kill_ptraced_process(int pid, int reap_child);
 @@ -217,7 +218,7 @@ extern int set_umid(char *name);
  extern char *get_umid(void);
  
  /* signal.c */
 -extern void timer_init(void);
 +extern void timer_set_signal_handler(void);
  extern void set_sigstack(void *sig_stack, int size);
  extern void remove_sigstack(void);
  extern void set_handler(int sig);
 @@ -238,12 +239,16 @@ extern void um_early_printk(const char *s, 
 unsigned int n);
  extern void os_fix_helper_signals(void);
  
  /* time.c */
 -extern void idle_sleep(unsigned long long nsecs);
 -extern int set_interval(void);
 -extern int timer_one_shot(int ticks);
 -extern long long disable_timer(void);
 +extern void os_idle_sleep(unsigned long long nsecs);
 +extern int os_timer_create(void* timer);
 +extern int os_timer_set_interval(void* timer, void* its);
 +extern int os_timer_one_shot(int ticks);
 +extern long long os_timer_disable(void);
 +extern long os_timer_remain(void* timer);
  extern void uml_idle_timer(void);
 +extern long long os_persistent_clock_emulation(void);
  extern long long os_nsecs(void);
 +extern long long os_vnsecs(void);
  
  /* skas/mem.c */
  extern long run_syscall_stub(struct mm_id * mm_idp,
 diff --git a/arch/um/include/shared/skas/stub-data.h 
 b/arch/um/include/shared/skas/stub-data.h
 index f6ed92c..e09d8fd 100644
 --- a/arch/um/include/shared/skas/stub-data.h
 +++ b/arch/um/include/shared/skas/stub-data.h
 @@ -6,12 +6,11 @@
  #ifndef __STUB_DATA_H
  #define __STUB_DATA_H
  
 -#include sys/time.h
 +#include time.h
  
  struct stub_data {
 -   long offset;
 +   unsigned long offset;
 int fd;
 -   struct itimerval timer;
 long err;
  };
  
 diff --git a/arch/um/include/shared/timer-internal.h 
 b/arch/um/include/shared/timer-internal.h
 new file mode 100644
 index 000..03e6f21
 --- /dev/null
 +++ b/arch/um/include/shared/timer-internal.h
 @@ -0,0 +1,13 @@
 +/*
 + * Copyright (C) 2012 - 2014 Cisco Systems
 + * Copyright (C) 2000 - 2007 Jeff Dike 
 (jdike@{addtoit,linux.intel}.com)
 + * Licensed under the GPL
 + */
 +
 +#ifndef __TIMER_INTERNAL_H__
 +#define __TIMER_INTERNAL_H__
 +
 +#define TIMER_MULTIPLIER 256
 +#define TIMER_MIN_DELTA  500
 +
 +#endif
 diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
 index 68b9119..2ce38c1 100644
 --- a/arch/um/kernel/process.c
 +++ b/arch/um/kernel/process.c
 @@ -27,6 +27,7 @@
  #include kern_util.h
  #include os.h
  #include skas.h
 +#include timer-internal.h
  
  /*
   * This is a per-cpu array.  A processor only modifies its entry and 
 it only
 @@ -201,11 +202,8 @@ void initial_thread_cb(void (*proc)(void *), 
 void *arg)
  
  void arch_cpu_idle(void)
  {
 -   unsigned long long nsecs;
 -
 cpu_tasks[current_thread_info()-cpu].pid = os_getpid();
 -   nsecs = disable_timer();
 -   idle_sleep(nsecs);
 +   

Re: [uml-devel] [PATCH] um: Switch clocksource to hrtimers

2015-06-04 Thread Anton Ivanov
I will give it a spin before the end of the weekend and run the full 
test suite on it.

A.

[snip]

 Cascading the kernel timer looks like the correct solution.
 Hi,

 below patch get's rid of all userspace timers.
 When a kernel timer interrupt is received the userspace process of the
 corresponding task is signaled via SIGALRM.
 The SIGALRM signal forces the userspace process to go back into
 userspace() function. There the SIGALRM signal is ignored as the
 interrupt was already processed anyway by the uml kernel.

 what do you think about this approach?

 Can you give this patch a try

 with kind regards
 thomas


[snip]


--
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] [PATCH] um: Switch clocksource to hrtimers

2015-06-04 Thread Thomas Meyer
Am Sonntag, den 31.05.2015, 20:10 +0100 schrieb Anton Ivanov:
 On 31/05/15 20:00, Thomas Meyer wrote:
  Am Sonntag, den 31.05.2015, 13:15 +0200 schrieb Richard Weinberger:
   Am 20.05.2015 um 07:26 schrieb Thomas Meyer:
Am 20.05.2015 12:12 vorm. schrieb Richard Weinberger 
richard.weinber...@gmail.com:
 On Sun, May 17, 2015 at 11:25 AM, Thomas Meyer 
 tho...@m3y3r.de 
 wrote: 
  Switch the UML clocksource from interval timers to posix 
  interval timers 
  and move to a monotonic timer. 
  
  This fixes suspendresume related timer issues and improves 
  
  network 
  performance as TCP state machines are now fed with the 
  correct 
  time; 
  also correct QoS and traffic shaping. 
  
  Signed-off-by: Thomas Meyer tho...@m3y3r.de 
 What tree is this patch against? 
 It does not clearly apply to Linus' tree. 
 
Hi,

I did tested the patch against 4.1-rc3-something; will update 
the 
patch against the latest commit!
  Hi,
  
   Ping.
   Would be nice to have this patch for the 4.2 merge window.
  I can provide you the current version of the patch, but I'm not 
  sure if
  it's ready for inclusion yet.
 
 Agree.
 
  For example:
  - With this patch I see new zombie processes of UML userspace
  processes. I'm not sure what's going on here.
 
 +1
 
  - Anton reported some hang he sees with this patch
 
 I did not have a chance to work on it last week, will try to find 
 some
 time this week. 
 
  - A person from cicso is worried about the potential idle CPU usage
  after the patch, because of the many timers started, i.e. a host 
  with
  hundreds of UMLs.
 This is less then the old CPU usage - checking time and rearming
 nanosleeps and itimers is expensive.
 
  
  Also meanwhile I think is not the correct thing to start a new 
  timer
  for each UML userspace process, because the timer will also trigger 
  the
  userspace process, even the corresponding process isn't scheduled 
  by
  the kernel currently. I think the previous behaviour with the 
  itimer
  was okay, because the virtual timer only did execute when the 
  process
  was executing which is the correct thing to do for the currently 
  active
  task in the UML kernel.
  I see two solutions for above problem: cascade the kernel timer 
  into
  the current active task; there is actually no need to start a timer 
  in
  each userspace process.
  Start/stop each timer when a userspace process becomes active resp.
  becomes inactive again.
  I hope above logic makes some sense at all! What do you think about
  this?
 
 Cascading the kernel timer looks like the correct solution.

Hi,

below patch get's rid of all userspace timers.
When a kernel timer interrupt is received the userspace process of the
corresponding task is signaled via SIGALRM.
The SIGALRM signal forces the userspace process to go back into
userspace() function. There the SIGALRM signal is ignored as the
interrupt was already processed anyway by the uml kernel.

what do you think about this approach?

Can you give this patch a try

with kind regards
thomas

diff --git a/arch/um/Makefile b/arch/um/Makefile
index 17d4460..a4a434f 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -130,7 +130,7 @@ export LDS_ELF_FORMAT := $(ELF_FORMAT)
 # The wrappers will select whether using malloc or the kernel allocator.
 LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
 
-LD_FLAGS_CMDLINE = $(foreach opt,$(LDFLAGS),-Wl,$(opt))
+LD_FLAGS_CMDLINE = $(foreach opt,$(LDFLAGS),-Wl,$(opt)) -lrt
 
 # Used by link-vmlinux.sh which has special support for um link
 export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE)
diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h
index d824528..8f8f5d7 100644
--- a/arch/um/include/shared/os.h
+++ b/arch/um/include/shared/os.h
@@ -183,6 +183,7 @@ extern int create_mem_file(unsigned long long len);
 /* process.c */
 extern unsigned long os_process_pc(int pid);
 extern int os_process_parent(int pid);
+extern void os_alarm_process(int pid);
 extern void os_stop_process(int pid);
 extern void os_kill_process(int pid, int reap_child);
 extern void os_kill_ptraced_process(int pid, int reap_child);
@@ -217,7 +218,7 @@ extern int set_umid(char *name);
 extern char *get_umid(void);
 
 /* signal.c */
-extern void timer_init(void);
+extern void timer_set_signal_handler(void);
 extern void set_sigstack(void *sig_stack, int size);
 extern void remove_sigstack(void);
 extern void set_handler(int sig);
@@ -238,12 +239,16 @@ extern void um_early_printk(const char *s, unsigned int 
n);
 extern void os_fix_helper_signals(void);
 
 /* time.c */
-extern void idle_sleep(unsigned long long nsecs);
-extern int set_interval(void);
-extern int timer_one_shot(int ticks);
-extern long long disable_timer(void);
+extern void os_idle_sleep(unsigned long long nsecs);
+extern int os_timer_create(void* timer);
+extern int os_timer_set_interval(void* 

Re: [uml-devel] [PATCH] um: Switch clocksource to hrtimers

2015-05-31 Thread Anton Ivanov
On 31/05/15 20:00, Thomas Meyer wrote:
 Am Sonntag, den 31.05.2015, 13:15 +0200 schrieb Richard Weinberger:
 Am 20.05.2015 um 07:26 schrieb Thomas Meyer:
 Am 20.05.2015 12:12 vorm. schrieb Richard Weinberger 
 richard.weinber...@gmail.com:
 On Sun, May 17, 2015 at 11:25 AM, Thomas Meyer tho...@m3y3r.de 
 wrote: 
 Switch the UML clocksource from interval timers to posix 
 interval timers 
 and move to a monotonic timer. 

 This fixes suspendresume related timer issues and improves 
 network 
 performance as TCP state machines are now fed with the correct 
 time; 
 also correct QoS and traffic shaping. 

 Signed-off-by: Thomas Meyer tho...@m3y3r.de 
 What tree is this patch against? 
 It does not clearly apply to Linus' tree. 

 Hi,

 I did tested the patch against 4.1-rc3-something; will update the 
 patch against the latest commit!
 Hi,

 Ping.
 Would be nice to have this patch for the 4.2 merge window.
 I can provide you the current version of the patch, but I'm not sure if
 it's ready for inclusion yet.

Agree.

 For example:
 - With this patch I see new zombie processes of UML userspace
 processes. I'm not sure what's going on here.

+1

 - Anton reported some hang he sees with this patch

I did not have a chance to work on it last week, will try to find some
time this week. 

 - A person from cicso is worried about the potential idle CPU usage
 after the patch, because of the many timers started, i.e. a host with
 hundreds of UMLs.
This is less then the old CPU usage - checking time and rearming
nanosleeps and itimers is expensive.


 Also meanwhile I think is not the correct thing to start a new timer
 for each UML userspace process, because the timer will also trigger the
 userspace process, even the corresponding process isn't scheduled by
 the kernel currently. I think the previous behaviour with the itimer
 was okay, because the virtual timer only did execute when the process
 was executing which is the correct thing to do for the currently active
 task in the UML kernel.
 I see two solutions for above problem: cascade the kernel timer into
 the current active task; there is actually no need to start a timer in
 each userspace process.
 Start/stop each timer when a userspace process becomes active resp.
 becomes inactive again.
 I hope above logic makes some sense at all! What do you think about
 this?

Cascading the kernel timer looks like the correct solution.

A.


 with kind regards
 thomas



 --
 ___
 User-mode-linux-devel mailing list
 User-mode-linux-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel



--
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] [PATCH] um: Switch clocksource to hrtimers

2015-05-31 Thread Thomas Meyer
Am Sonntag, den 31.05.2015, 13:15 +0200 schrieb Richard Weinberger:
 Am 20.05.2015 um 07:26 schrieb Thomas Meyer:
  
  Am 20.05.2015 12:12 vorm. schrieb Richard Weinberger 
  richard.weinber...@gmail.com:
   
   On Sun, May 17, 2015 at 11:25 AM, Thomas Meyer tho...@m3y3r.de 
   wrote: 
Switch the UML clocksource from interval timers to posix 
interval timers 
and move to a monotonic timer. 

This fixes suspendresume related timer issues and improves 
network 
performance as TCP state machines are now fed with the correct 
time; 
also correct QoS and traffic shaping. 

Signed-off-by: Thomas Meyer tho...@m3y3r.de 
   
   What tree is this patch against? 
   It does not clearly apply to Linus' tree. 
   
  
  Hi,
  
  I did tested the patch against 4.1-rc3-something; will update the 
  patch against the latest commit!
 

Hi,

 Ping.
 Would be nice to have this patch for the 4.2 merge window.

I can provide you the current version of the patch, but I'm not sure if
it's ready for inclusion yet.
For example:
- With this patch I see new zombie processes of UML userspace
processes. I'm not sure what's going on here.
- Anton reported some hang he sees with this patch
- A person from cicso is worried about the potential idle CPU usage
after the patch, because of the many timers started, i.e. a host with
hundreds of UMLs.

Also meanwhile I think is not the correct thing to start a new timer
for each UML userspace process, because the timer will also trigger the
userspace process, even the corresponding process isn't scheduled by
the kernel currently. I think the previous behaviour with the itimer
was okay, because the virtual timer only did execute when the process
was executing which is the correct thing to do for the currently active
task in the UML kernel.
I see two solutions for above problem: cascade the kernel timer into
the current active task; there is actually no need to start a timer in
each userspace process.
Start/stop each timer when a userspace process becomes active resp.
becomes inactive again.
I hope above logic makes some sense at all! What do you think about
this?

with kind regards
thomas



--
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] [PATCH] um: Switch clocksource to hrtimers

2015-05-31 Thread Richard Weinberger
Am 31.05.2015 um 21:00 schrieb Thomas Meyer:
 Ping.
 Would be nice to have this patch for the 4.2 merge window.
 
 I can provide you the current version of the patch, but I'm not sure if
 it's ready for inclusion yet.

That's fine. I'll look at it.
Just rebase it against Linus' tree or uml-next.
https://git.kernel.org/cgit/linux/kernel/git/rw/uml.git/log/?h=linux-next

 For example:
 - With this patch I see new zombie processes of UML userspace
 processes. I'm not sure what's going on here.
 - Anton reported some hang he sees with this patch
 - A person from cicso is worried about the potential idle CPU usage
 after the patch, because of the many timers started, i.e. a host with
 hundreds of UMLs.
 
 Also meanwhile I think is not the correct thing to start a new timer
 for each UML userspace process, because the timer will also trigger the
 userspace process, even the corresponding process isn't scheduled by
 the kernel currently. I think the previous behaviour with the itimer
 was okay, because the virtual timer only did execute when the process
 was executing which is the correct thing to do for the currently active
 task in the UML kernel.
 I see two solutions for above problem: cascade the kernel timer into
 the current active task; there is actually no need to start a timer in
 each userspace process.
 Start/stop each timer when a userspace process becomes active resp.
 becomes inactive again.
 I hope above logic makes some sense at all! What do you think about
 this?

Hm, we definitely don't want a new timer for each userspace proc. The timer
has to work as a regular clock source.
But I'll have to read your/Anton's code in detail first.

Thanks,
//richard

--
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] [PATCH] um: Switch clocksource to hrtimers

2015-05-31 Thread Thomas Meyer
Am Sonntag, den 31.05.2015, 23:49 +0200 schrieb Richard Weinberger:
 Am 31.05.2015 um 21:00 schrieb Thomas Meyer:
   Ping.
   Would be nice to have this patch for the 4.2 merge window.
  
  I can provide you the current version of the patch, but I'm not 
  sure if
  it's ready for inclusion yet.
 
 That's fine. I'll look at it.
 Just rebase it against Linus' tree or uml-next.
 https://git.kernel.org/cgit/linux/kernel/git/rw/uml.git/log/?h=linux
 -next
  For example:
  - With this patch I see new zombie processes of UML userspace
  processes. I'm not sure what's going on here.
  - Anton reported some hang he sees with this patch
  - A person from cicso is worried about the potential idle CPU usage
  after the patch, because of the many timers started, i.e. a host 
  with
  hundreds of UMLs.
  
  Also meanwhile I think is not the correct thing to start a new 
  timer
  for each UML userspace process, because the timer will also trigger 
  the
  userspace process, even the corresponding process isn't scheduled 
  by
  the kernel currently. I think the previous behaviour with the 
  itimer
  was okay, because the virtual timer only did execute when the 
  process
  was executing which is the correct thing to do for the currently 
  active
  task in the UML kernel.
  I see two solutions for above problem: cascade the kernel timer 
  into
  the current active task; there is actually no need to start a timer 
  in
  each userspace process.
  Start/stop each timer when a userspace process becomes active resp.
  becomes inactive again.
  I hope above logic makes some sense at all! What do you think about
  this?
 
 Hm, we definitely don't want a new timer for each userspace proc. The 
 timer
 has to work as a regular clock source.
 But I'll have to read your/Anton's code in detail first.

Hi,

rebased against current Linus' tree:
- Currently I'm not sure at all why the individual itimers are created
for each usespace process and if we need to copy these mechanism for
posix interval timers.

Please have a look at the patch, this should apply cleanly against
linus tree:

commit c091d1f11649d39dbdd1653139954bf1feff0c80
Author: Thomas Meyer tho...@m3y3r.de
Date:   Sun May 31 19:40:22 2015 +0200

um: Switch clocksource to hrtimers

Switch the UML clocksource from interval timers to posix interval timers and
move to a monotonic timer.

This fixes suspendresume related timer issues and improves network 
performance
as TCP state machines are now fed with the correct time; also correct QoS 
and
traffic shaping.

Signed-off-by: Thomas Meyer tho...@m3y3r.de

diff --git a/arch/um/Makefile b/arch/um/Makefile
index 17d4460..a4a434f 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -130,7 +130,7 @@ export LDS_ELF_FORMAT := $(ELF_FORMAT)
 # The wrappers will select whether using malloc or the kernel allocator.
 LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
 
-LD_FLAGS_CMDLINE = $(foreach opt,$(LDFLAGS),-Wl,$(opt))
+LD_FLAGS_CMDLINE = $(foreach opt,$(LDFLAGS),-Wl,$(opt)) -lrt
 
 # Used by link-vmlinux.sh which has special support for um link
 export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE)
diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h
index d824528..2e738b0 100644
--- a/arch/um/include/shared/os.h
+++ b/arch/um/include/shared/os.h
@@ -217,7 +217,7 @@ extern int set_umid(char *name);
 extern char *get_umid(void);
 
 /* signal.c */
-extern void timer_init(void);
+extern void timer_set_signal_handler(void);
 extern void set_sigstack(void *sig_stack, int size);
 extern void remove_sigstack(void);
 extern void set_handler(int sig);
@@ -238,12 +238,16 @@ extern void um_early_printk(const char *s, unsigned int 
n);
 extern void os_fix_helper_signals(void);
 
 /* time.c */
-extern void idle_sleep(unsigned long long nsecs);
-extern int set_interval(void);
-extern int timer_one_shot(int ticks);
-extern long long disable_timer(void);
+extern void os_idle_sleep(unsigned long long nsecs);
+extern int os_timer_create(void* timer);
+extern int os_timer_set_interval(void* timer, void* its);
+extern int os_timer_one_shot(int ticks);
+extern long long os_timer_disable(void);
+extern long os_timer_remain(void* timer);
 extern void uml_idle_timer(void);
+extern long long os_persistent_clock_emulation(void);
 extern long long os_nsecs(void);
+extern long long os_vnsecs(void);
 
 /* skas/mem.c */
 extern long run_syscall_stub(struct mm_id * mm_idp,
diff --git a/arch/um/include/shared/skas/stub-data.h 
b/arch/um/include/shared/skas/stub-data.h
index f6ed92c..f98b9e2 100644
--- a/arch/um/include/shared/skas/stub-data.h
+++ b/arch/um/include/shared/skas/stub-data.h
@@ -6,12 +6,12 @@
 #ifndef __STUB_DATA_H
 #define __STUB_DATA_H
 
-#include sys/time.h
+#include time.h
 
 struct stub_data {
-   long offset;
+   unsigned long offset;
int fd;
-   struct itimerval timer;
+   struct itimerspec timer;
long err;
 };
 
diff 

Re: [uml-devel] [PATCH] um: Switch clocksource to hrtimers

2015-05-19 Thread Thomas Meyer

Am 20.05.2015 12:12 vorm. schrieb Richard Weinberger 
richard.weinber...@gmail.com:

 On Sun, May 17, 2015 at 11:25 AM, Thomas Meyer tho...@m3y3r.de wrote: 
  Switch the UML clocksource from interval timers to posix interval timers 
  and move to a monotonic timer. 
  
  This fixes suspendresume related timer issues and improves network 
  performance as TCP state machines are now fed with the correct time; 
  also correct QoS and traffic shaping. 
  
  Signed-off-by: Thomas Meyer tho...@m3y3r.de 

 What tree is this patch against? 
 It does not clearly apply to Linus' tree. 


Hi,

I did tested the patch against 4.1-rc3-something; will update the patch against 
the latest commit!


 -- 
 Thanks, 
 //richard 

 --
  
 One dashboard for servers and applications across Physical-Virtual-Cloud 
 Widest out-of-the-box monitoring support with 50+ applications 
 Performance metrics, stats and reports that give you Actionable Insights 
 Deep dive visibility with transaction tracing using APM Insight. 
 http://ad.doubleclick.net/ddm/clk/290420510;117567292;y 
 ___ 
 User-mode-linux-devel mailing list 
 User-mode-linux-devel@lists.sourceforge.net 
 https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel 
--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] [PATCH] um: Switch clocksource to hrtimers

2015-05-19 Thread Richard Weinberger
On Tue, May 19, 2015 at 6:19 PM, Anton Ivanov
anton.iva...@kot-begemot.co.uk wrote:
 Same story.

 Overall works quite well, the moment I give it the dselect upgrade
 test the userspace hangs.

 Kernel continues to work - forwarding, icmp, uml_mconsole are fine.

Do you know where it hangs?
Maybe the kernel does not get any scheduler tick and does not schedule a task..,

-- 
Thanks,
//richard

--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] [PATCH] um: Switch clocksource to hrtimers

2015-05-19 Thread Anton Ivanov
On 19/05/15 17:39, Richard Weinberger wrote:
 On Tue, May 19, 2015 at 6:19 PM, Anton Ivanov
 anton.iva...@kot-begemot.co.uk wrote:
 Same story.

 Overall works quite well, the moment I give it the dselect upgrade
 test the userspace hangs.

 Kernel continues to work - forwarding, icmp, uml_mconsole are fine.
 Do you know where it hangs?
 Maybe the kernel does not get any scheduler tick and does not schedule a 
 task..,

Kernel continues to get ticks, timers increment, io also works.

If I strace the kernel I see a mix of SIGALRM (or in the oder version 
-USR2), SIGIO and SIGCHLD. Nothing out of the ordinary.

Uml mconsole works. I cannot get meaningful information because trying 
to invoke backtraces I get SIGSEGV in SIGSEGV handler for all 
processes. Memory looks OK too - 500MB+ free on a 1GB UML.

Syncronous vs asynchronous FS does not change it so it is not a variety 
of the writeout bug.

If I could get a bt for the userspace task and/or its stub we could have 
nailed it. I suspect it is spinning in skas/process.c for some reason. 
No idea why, but it takes 100% CPU.

A.




--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] [PATCH] um: Switch clocksource to hrtimers

2015-05-19 Thread Richard Weinberger
On Sun, May 17, 2015 at 11:25 AM, Thomas Meyer tho...@m3y3r.de wrote:
 Switch the UML clocksource from interval timers to posix interval timers
 and move to a monotonic timer.

 This fixes suspendresume related timer issues and improves network
 performance as TCP state machines are now fed with the correct time;
 also correct QoS and traffic shaping.

 Signed-off-by: Thomas Meyer tho...@m3y3r.de

What tree is this patch against?
It does not clearly apply to Linus' tree.

-- 
Thanks,
//richard

--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


Re: [uml-devel] [PATCH] um: Switch clocksource to hrtimers

2015-05-19 Thread Anton Ivanov
Same story.

Overall works quite well, the moment I give it the dselect upgrade 
test the userspace hangs.

Kernel continues to work - forwarding, icmp, uml_mconsole are fine.

A.

On 17/05/15 10:25, Thomas Meyer wrote:
 Switch the UML clocksource from interval timers to posix interval timers
 and move to a monotonic timer.

 This fixes suspendresume related timer issues and improves network
 performance as TCP state machines are now fed with the correct time;
 also correct QoS and traffic shaping.

 Signed-off-by: Thomas Meyer tho...@m3y3r.de
 ---

 diff --git a/arch/um/Makefile b/arch/um/Makefile
 index e4b1a96..43ef190 100644
 --- a/arch/um/Makefile
 +++ b/arch/um/Makefile
 @@ -130,7 +130,7 @@ export LDS_ELF_FORMAT := $(ELF_FORMAT)
   # The wrappers will select whether using malloc or the kernel allocator.
   LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
   
 -LD_FLAGS_CMDLINE = $(foreach opt,$(LDFLAGS),-Wl,$(opt))
 +LD_FLAGS_CMDLINE = $(foreach opt,$(LDFLAGS),-Wl,$(opt)) -lrt
   
   # Used by link-vmlinux.sh which has special support for um link
   export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE)
 diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h
 index 08eec0b..5949cae 100644
 --- a/arch/um/include/shared/os.h
 +++ b/arch/um/include/shared/os.h
 @@ -219,7 +219,7 @@ extern int set_umid(char *name);
   extern char *get_umid(void);
   
   /* signal.c */
 -extern void timer_init(void);
 +extern void timer_set_signal_handler(void);
   extern void set_sigstack(void *sig_stack, int size);
   extern void remove_sigstack(void);
   extern void set_handler(int sig);
 @@ -240,12 +240,16 @@ extern void um_early_printk(const char *s, unsigned int 
 n);
   extern void os_fix_helper_signals(void);
   
   /* time.c */
 -extern void idle_sleep(unsigned long long nsecs);
 -extern int set_interval(void);
 -extern int timer_one_shot(int ticks);
 -extern long long disable_timer(void);
 +extern void os_idle_sleep(unsigned long long nsecs);
 +extern int os_timer_create(void* timer);
 +extern int os_timer_set_interval(void* timer, void* its);
 +extern int os_timer_one_shot(int ticks);
 +extern long long os_timer_disable(void);
 +extern long os_timer_remain(void* timer);
   extern void uml_idle_timer(void);
 +extern long long os_persistent_clock_emulation(void);
   extern long long os_nsecs(void);
 +extern long long os_vnsecs(void);
   
   /* skas/mem.c */
   extern long run_syscall_stub(struct mm_id * mm_idp,
 diff --git a/arch/um/include/shared/skas/stub-data.h 
 b/arch/um/include/shared/skas/stub-data.h
 index f6ed92c..f98b9e2 100644
 --- a/arch/um/include/shared/skas/stub-data.h
 +++ b/arch/um/include/shared/skas/stub-data.h
 @@ -6,12 +6,12 @@
   #ifndef __STUB_DATA_H
   #define __STUB_DATA_H
   
 -#include sys/time.h
 +#include time.h
   
   struct stub_data {
 - long offset;
 + unsigned long offset;
   int fd;
 - struct itimerval timer;
 + struct itimerspec timer;
   long err;
   };
   
 diff --git a/arch/um/include/shared/timer-internal.h 
 b/arch/um/include/shared/timer-internal.h
 new file mode 100644
 index 000..03e6f21
 --- /dev/null
 +++ b/arch/um/include/shared/timer-internal.h
 @@ -0,0 +1,13 @@
 +/*
 + * Copyright (C) 2012 - 2014 Cisco Systems
 + * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
 + * Licensed under the GPL
 + */
 +
 +#ifndef __TIMER_INTERNAL_H__
 +#define __TIMER_INTERNAL_H__
 +
 +#define TIMER_MULTIPLIER 256
 +#define TIMER_MIN_DELTA  500
 +
 +#endif
 diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
 index f17bca8..d0bbd01 100644
 --- a/arch/um/kernel/process.c
 +++ b/arch/um/kernel/process.c
 @@ -27,6 +27,7 @@
   #include kern_util.h
   #include os.h
   #include skas.h
 +#include timer-internal.h
   
   /*
* This is a per-cpu array.  A processor only modifies its entry and it only
 @@ -201,11 +202,8 @@ void initial_thread_cb(void (*proc)(void *), void *arg)
   
   void arch_cpu_idle(void)
   {
 - unsigned long long nsecs;
 -
   cpu_tasks[current_thread_info()-cpu].pid = os_getpid();
 - nsecs = disable_timer();
 - idle_sleep(nsecs);
 + os_idle_sleep(UM_NSEC_PER_SEC / UM_HZ);
   local_irq_enable();
   }
   
 diff --git a/arch/um/kernel/skas/clone.c b/arch/um/kernel/skas/clone.c
 index 289771d..814ec8b 100644
 --- a/arch/um/kernel/skas/clone.c
 +++ b/arch/um/kernel/skas/clone.c
 @@ -24,6 +24,7 @@ void __attribute__ ((__section__ (.__syscall_stub)))
   stub_clone_handler(void)
   {
   struct stub_data *data = (struct stub_data *) STUB_DATA;
 + timer_t timerid;
   long err;
   
   err = stub_syscall2(__NR_clone, CLONE_PARENT | CLONE_FILES | SIGCHLD,
 @@ -35,8 +36,14 @@ stub_clone_handler(void)
   if (err)
   goto out;
   
 - err = stub_syscall3(__NR_setitimer, ITIMER_VIRTUAL,
 - (long) data-timer, 0);
 + /* create posix interval timer */
 + err = stub_syscall3(__NR_timer_create, 

[uml-devel] [PATCH] um: Switch clocksource to hrtimers

2015-05-17 Thread Thomas Meyer
Switch the UML clocksource from interval timers to posix interval timers
and move to a monotonic timer.

This fixes suspendresume related timer issues and improves network
performance as TCP state machines are now fed with the correct time;
also correct QoS and traffic shaping.

Signed-off-by: Thomas Meyer tho...@m3y3r.de
---

diff --git a/arch/um/Makefile b/arch/um/Makefile
index e4b1a96..43ef190 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -130,7 +130,7 @@ export LDS_ELF_FORMAT := $(ELF_FORMAT)
 # The wrappers will select whether using malloc or the kernel allocator.
 LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
 
-LD_FLAGS_CMDLINE = $(foreach opt,$(LDFLAGS),-Wl,$(opt))
+LD_FLAGS_CMDLINE = $(foreach opt,$(LDFLAGS),-Wl,$(opt)) -lrt
 
 # Used by link-vmlinux.sh which has special support for um link
 export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE)
diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h
index 08eec0b..5949cae 100644
--- a/arch/um/include/shared/os.h
+++ b/arch/um/include/shared/os.h
@@ -219,7 +219,7 @@ extern int set_umid(char *name);
 extern char *get_umid(void);
 
 /* signal.c */
-extern void timer_init(void);
+extern void timer_set_signal_handler(void);
 extern void set_sigstack(void *sig_stack, int size);
 extern void remove_sigstack(void);
 extern void set_handler(int sig);
@@ -240,12 +240,16 @@ extern void um_early_printk(const char *s, unsigned int 
n);
 extern void os_fix_helper_signals(void);
 
 /* time.c */
-extern void idle_sleep(unsigned long long nsecs);
-extern int set_interval(void);
-extern int timer_one_shot(int ticks);
-extern long long disable_timer(void);
+extern void os_idle_sleep(unsigned long long nsecs);
+extern int os_timer_create(void* timer);
+extern int os_timer_set_interval(void* timer, void* its);
+extern int os_timer_one_shot(int ticks);
+extern long long os_timer_disable(void);
+extern long os_timer_remain(void* timer);
 extern void uml_idle_timer(void);
+extern long long os_persistent_clock_emulation(void);
 extern long long os_nsecs(void);
+extern long long os_vnsecs(void);
 
 /* skas/mem.c */
 extern long run_syscall_stub(struct mm_id * mm_idp,
diff --git a/arch/um/include/shared/skas/stub-data.h 
b/arch/um/include/shared/skas/stub-data.h
index f6ed92c..f98b9e2 100644
--- a/arch/um/include/shared/skas/stub-data.h
+++ b/arch/um/include/shared/skas/stub-data.h
@@ -6,12 +6,12 @@
 #ifndef __STUB_DATA_H
 #define __STUB_DATA_H
 
-#include sys/time.h
+#include time.h
 
 struct stub_data {
-   long offset;
+   unsigned long offset;
int fd;
-   struct itimerval timer;
+   struct itimerspec timer;
long err;
 };
 
diff --git a/arch/um/include/shared/timer-internal.h 
b/arch/um/include/shared/timer-internal.h
new file mode 100644
index 000..03e6f21
--- /dev/null
+++ b/arch/um/include/shared/timer-internal.h
@@ -0,0 +1,13 @@
+/*
+ * Copyright (C) 2012 - 2014 Cisco Systems
+ * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
+ * Licensed under the GPL
+ */
+
+#ifndef __TIMER_INTERNAL_H__
+#define __TIMER_INTERNAL_H__
+
+#define TIMER_MULTIPLIER 256
+#define TIMER_MIN_DELTA  500
+
+#endif
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index f17bca8..d0bbd01 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -27,6 +27,7 @@
 #include kern_util.h
 #include os.h
 #include skas.h
+#include timer-internal.h
 
 /*
  * This is a per-cpu array.  A processor only modifies its entry and it only
@@ -201,11 +202,8 @@ void initial_thread_cb(void (*proc)(void *), void *arg)
 
 void arch_cpu_idle(void)
 {
-   unsigned long long nsecs;
-
cpu_tasks[current_thread_info()-cpu].pid = os_getpid();
-   nsecs = disable_timer();
-   idle_sleep(nsecs);
+   os_idle_sleep(UM_NSEC_PER_SEC / UM_HZ);
local_irq_enable();
 }
 
diff --git a/arch/um/kernel/skas/clone.c b/arch/um/kernel/skas/clone.c
index 289771d..814ec8b 100644
--- a/arch/um/kernel/skas/clone.c
+++ b/arch/um/kernel/skas/clone.c
@@ -24,6 +24,7 @@ void __attribute__ ((__section__ (.__syscall_stub)))
 stub_clone_handler(void)
 {
struct stub_data *data = (struct stub_data *) STUB_DATA;
+   timer_t timerid;
long err;
 
err = stub_syscall2(__NR_clone, CLONE_PARENT | CLONE_FILES | SIGCHLD,
@@ -35,8 +36,14 @@ stub_clone_handler(void)
if (err)
goto out;
 
-   err = stub_syscall3(__NR_setitimer, ITIMER_VIRTUAL,
-   (long) data-timer, 0);
+   /* create posix interval timer */
+   err = stub_syscall3(__NR_timer_create, CLOCK_MONOTONIC, 0l, (long) 
timerid);
+   if (err)
+   goto out;
+
+   /* set interval to the given value from copy_context_skas0() */
+   err = stub_syscall4(__NR_timer_settime, (long) timerid, 0l,
+   (long) data-timer, 0l);
if (err)
goto out;
 
diff --git