Re: [uml-devel] [PATCH v3 3/3] um: enable trace irqflags support

2014-10-20 Thread Geert Uytterhoeven
On Sun, Oct 19, 2014 at 5:14 PM, Thomas Meyer  wrote:
> --- a/arch/um/kernel/um_arch.c
> +++ b/arch/um/kernel/um_arch.c
> @@ -251,6 +251,9 @@ static struct notifier_block panic_exit_notifier = {
>
>  void uml_finishsetup(void)
>  {
> +#ifdef CONFIG_LOCKDEP
> +   lockdep_init();
> +#endif

The #ifdef is not needed. include/linux/lockdep.h provides a dummy
definition if !CONFIG_LOCKDEP.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
___
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] [UM] Long loop in __getnsdayoftime() after resume from ram

2014-10-20 Thread Richard Weinberger
On Sun, Oct 19, 2014 at 2:39 PM, Thomas Meyer  wrote:
> Hello,
>
> in UML kernel I get a long cpu using loop in __getnstimeofday()
> (kernel/time/timekeeping.c:315) in the call of timespec_add_ns(),
> when I left the host kernel suspended to ram for a few hours and resume
> again.
> this is because it seems like the tk->xtime_sec wasn't updated yet, but
> the nsecs were. nsecs can be as high as 8111000111000111000l
>
> the function timespec_add_ns() (include/linux/time.h:266) will call
> __iter_div_u64_rem() which has an optimized loop for the case
> that the dividend is not much bigger as the divisior.
> but this isn't the case for resume from ram on the host kernel.
>
> any ideas how to fix this? is it possible to intercept the resume from
> ram and update the timekeeper->xtime_sec somehow?
> or can the um arch somehow overwrite timespec_add_ns() to always use
> div_u64_rem() instead?

Hmm, does this always happen?
At least on my notebook it did not happen. I've started an UML yesterday
suspended it and after more than 12h it worked fine today.

BTW: Do you see the issue also then freezing UML using the freezer cgroup?
Would be easier to debug. :)

-- 
Thanks,
//richard

--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
___
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 v3 3/3] um: enable trace irqflags support

2014-10-20 Thread Daniel Walter
- Original Message -
> From: "Thomas Meyer" 
> To: "user-mode-linux-devel" 
> Sent: Sunday, October 19, 2014 4:14:13 PM
> Subject: [uml-devel] [PATCH v3 3/3] um: enable trace irqflags support
> 
> Add TRACE_IRQFLAGS_SUPPORT to UML.
> This enables LOCKDEP_SUPPORT and TRACING_SUPPORT.


FYI: I'm currently working on porting ftrace() support to
uml. It will take another week or two since I don't have enough
time to debug, and it isn't stable yet (read as is panic()ing randomly)


> 
> Signed-off-by: Thomas Meyer 
> ---
> diff --git a/arch/um/Kconfig.common b/arch/um/Kconfig.common
> index 87bc868..6a33c3a 100644
> --- a/arch/um/Kconfig.common
> +++ b/arch/um/Kconfig.common
> @@ -28,10 +28,9 @@ config PCI
>  config PCMCIA
>   bool
>  
> -# Yet to do!
>  config TRACE_IRQFLAGS_SUPPORT
>   bool
> - default n
> + default y
>  
>  config LOCKDEP_SUPPORT
>   bool
> diff --git a/arch/um/include/asm/irqflags.h
> b/arch/um/include/asm/irqflags.h
> index c780d8a..c5b636e 100644
> --- a/arch/um/include/asm/irqflags.h
> +++ b/arch/um/include/asm/irqflags.h
> @@ -34,9 +34,9 @@ static inline unsigned long
> arch_local_irq_save(void)
>   return flags;
>  }
>  
> -static inline bool arch_irqs_disabled(void)
> +static inline int arch_irqs_disabled_flags(unsigned long flags)
>  {
> - return arch_local_save_flags() == 0;
> + return flags == 0;
>  }
>  
>  #endif

I'm not sure if this is correct. I'd rather would have another function
implemented instead of removing the check for disabled irqs.


cheers,

daniel

--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
___
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] [UM] Long loop in __getnsdayoftime() after resume from ram

2014-10-20 Thread Thomas Meyer
Am 20.10.2014 10:27 schrieb Richard Weinberger :
>
> On Sun, Oct 19, 2014 at 2:39 PM, Thomas Meyer  wrote: 
> > Hello, 
> > 
> > in UML kernel I get a long cpu using loop in __getnstimeofday() 
> > (kernel/time/timekeeping.c:315) in the call of timespec_add_ns(), 
> > when I left the host kernel suspended to ram for a few hours and resume 
> > again. 
> > this is because it seems like the tk->xtime_sec wasn't updated yet, but 
> > the nsecs were. nsecs can be as high as 8111000111000111000l 
> > 
> > the function timespec_add_ns() (include/linux/time.h:266) will call 
> > __iter_div_u64_rem() which has an optimized loop for the case 
> > that the dividend is not much bigger as the divisior. 
> > but this isn't the case for resume from ram on the host kernel. 
> > 
> > any ideas how to fix this? is it possible to intercept the resume from 
> > ram and update the timekeeper->xtime_sec somehow? 
> > or can the um arch somehow overwrite timespec_add_ns() to always use 
> > div_u64_rem() instead? 
>
> Hmm, does this always happen?

Yes, my single core system seems to trigger this every time after resume from 
ram.

> At least on my notebook it did not happen. I've started an UML yesterday 
> suspended it and after more than 12h it worked fine today. 
>
> BTW: Do you see the issue also then freezing UML using the freezer cgroup?

I'm not sure what do you mean by this. Do I need to enable some special configs 
for this in the host or uml kernel?

> Would be easier to debug. :) 
>
> -- 
> Thanks, 
> //richard 
--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
___
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] [UM] Long loop in __getnsdayoftime() after resume from ram

2014-10-20 Thread Richard Weinberger
Am 20.10.2014 um 11:51 schrieb Thomas Meyer:
>> Hmm, does this always happen?
> 
> Yes, my single core system seems to trigger this every time after resume from 
> ram.

What is your host kernel?

>> At least on my notebook it did not happen. I've started an UML yesterday 
>> suspended it and after more than 12h it worked fine today. 
>>
>> BTW: Do you see the issue also then freezing UML using the freezer cgroup?
> 
> I'm not sure what do you mean by this. Do I need to enable some special 
> configs for this in the host or uml kernel?

Create on the host side a new freezer cgroup, put UML into it and freeze/thaw 
it.
i.e. mkdir /sys/fs/cgroup/freezer/uml ; echo  >  
/sys/fs/cgroup/freezer/uml/tasks.
In the said shell run UML and then freeze it using echo FROZEN > 
/sys/fs/cgroup/freezer/uml/freezer.state.
Later thaw it: echo THAWED > /sys/fs/cgroup/freezer/uml/freezer.state

Thanks,
//richard

--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
___
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 v3 3/3] um: enable trace irqflags support

2014-10-20 Thread Thomas Meyer
Am 20.10.2014 11:28 schrieb Daniel Walter :
>
> - Original Message - 
> > From: "Thomas Meyer"  
> > To: "user-mode-linux-devel"  
> > Sent: Sunday, October 19, 2014 4:14:13 PM 
> > Subject: [uml-devel] [PATCH v3 3/3] um: enable trace irqflags support 
> > 
> > Add TRACE_IRQFLAGS_SUPPORT to UML. 
> > This enables LOCKDEP_SUPPORT and TRACING_SUPPORT. 
>
>
> FYI: I'm currently working on porting ftrace() support to 
> uml. It will take another week or two since I don't have enough 
> time to debug, and it isn't stable yet (read as is panic()ing randomly)

Good to know :-)

Thanks for you stack trace support work!

BTW. When triggering a sysrq t with the uml console the stack trace is not 
displayed, it says that the stack trace failed because a sigsegv happens in the 
stack trace or something like that. Bug or feature?

>
> > 
> > Signed-off-by: Thomas Meyer  
> > --- 
> > diff --git a/arch/um/Kconfig.common b/arch/um/Kconfig.common 
> > index 87bc868..6a33c3a 100644 
> > --- a/arch/um/Kconfig.common 
> > +++ b/arch/um/Kconfig.common 
> > @@ -28,10 +28,9 @@ config PCI 
> >  config PCMCIA 
> >  bool 
> >  
> > -# Yet to do! 
> >  config TRACE_IRQFLAGS_SUPPORT 
> >  bool 
> > - default n 
> > + default y 
> >  
> >  config LOCKDEP_SUPPORT 
> >  bool 
> > diff --git a/arch/um/include/asm/irqflags.h 
> > b/arch/um/include/asm/irqflags.h 
> > index c780d8a..c5b636e 100644 
> > --- a/arch/um/include/asm/irqflags.h 
> > +++ b/arch/um/include/asm/irqflags.h 
> > @@ -34,9 +34,9 @@ static inline unsigned long 
> > arch_local_irq_save(void) 
> >  return flags; 
> >  } 
> >  
> > -static inline bool arch_irqs_disabled(void) 
> > +static inline int arch_irqs_disabled_flags(unsigned long flags) 
> >  { 
> > - return arch_local_save_flags() == 0; 
> > + return flags == 0; 
> >  } 
> >  
> >  #endif 
>
> I'm not sure if this is correct. I'd rather would have another function 
> implemented instead of removing the check for disabled irqs.

There is a default coding for arch_irqs_disabled which calls 
arch_irqs_disabled_flags.

The logic after above change should be the same as before.

>
>
> cheers, 
>
> daniel 
--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
___
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 v3 3/3] um: enable trace irqflags support

2014-10-20 Thread Richard Weinberger
On Mon, Oct 20, 2014 at 1:18 PM, Thomas Meyer  wrote:
> Am 20.10.2014 11:28 schrieb Daniel Walter :
>>
>> - Original Message -
>> > From: "Thomas Meyer" 
>> > To: "user-mode-linux-devel" 
>> > Sent: Sunday, October 19, 2014 4:14:13 PM
>> > Subject: [uml-devel] [PATCH v3 3/3] um: enable trace irqflags support
>> >
>> > Add TRACE_IRQFLAGS_SUPPORT to UML.
>> > This enables LOCKDEP_SUPPORT and TRACING_SUPPORT.
>>
>>
>> FYI: I'm currently working on porting ftrace() support to
>> uml. It will take another week or two since I don't have enough
>> time to debug, and it isn't stable yet (read as is panic()ing randomly)
>
> Good to know :-)
>
> Thanks for you stack trace support work!
>
> BTW. When triggering a sysrq t with the uml console the stack trace is not 
> displayed, it says that the stack trace failed because a sigsegv happens in 
> the stack trace or something like that. Bug or feature?

Huh? More details please. uml_mconsole's sysrq t works fine here with
both x86 and x86_86 uml.

-- 
Thanks,
//richard

--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
___
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 v3 3/3] um: enable trace irqflags support

2014-10-20 Thread Thomas Meyer

Am 20.10.2014 um 14:13 schrieb Richard Weinberger:

> On Mon, Oct 20, 2014 at 1:18 PM, Thomas Meyer  wrote:
>> Am 20.10.2014 11:28 schrieb Daniel Walter :
>>> 
>>> - Original Message -
 From: "Thomas Meyer" 
 To: "user-mode-linux-devel" 
 Sent: Sunday, October 19, 2014 4:14:13 PM
 Subject: [uml-devel] [PATCH v3 3/3] um: enable trace irqflags support
 
 Add TRACE_IRQFLAGS_SUPPORT to UML.
 This enables LOCKDEP_SUPPORT and TRACING_SUPPORT.
>>> 
>>> 
>>> FYI: I'm currently working on porting ftrace() support to
>>> uml. It will take another week or two since I don't have enough
>>> time to debug, and it isn't stable yet (read as is panic()ing randomly)
>> 
>> Good to know :-)
>> 
>> Thanks for you stack trace support work!
>> 
>> BTW. When triggering a sysrq t with the uml console the stack trace is not 
>> displayed, it says that the stack trace failed because a sigsegv happens in 
>> the stack trace or something like that. Bug or feature?
> 
> Huh? More details please. uml_mconsole's sysrq t works fine here with
> both x86 and x86_86 uml.
Hi,

sorry about the fuss. everything seems to work correctly.

Maybe I did see this while doing some testing with some fixes.

sorry.

> 
> -- 
> Thanks,
> //richard


--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
___
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] [UM] Long loop in __getnsdayoftime() after resume from ram

2014-10-20 Thread Thomas Meyer
Am Montag, den 20.10.2014, 11:56 +0200 schrieb Richard Weinberger:
> Am 20.10.2014 um 11:51 schrieb Thomas Meyer:
> >> Hmm, does this always happen?
> > 
> > Yes, my single core system seems to trigger this every time after resume 
> > from ram.
> 
> What is your host kernel?

The standard Fedora kernel: 3.16.4-200.fc20.x86_64

> 
> >> At least on my notebook it did not happen. I've started an UML yesterday 
> >> suspended it and after more than 12h it worked fine today. 
> >>
> >> BTW: Do you see the issue also then freezing UML using the freezer cgroup?
> > 
> > I'm not sure what do you mean by this. Do I need to enable some special 
> > configs for this in the host or uml kernel?
> 
> Create on the host side a new freezer cgroup, put UML into it and freeze/thaw 
> it.
> i.e. mkdir /sys/fs/cgroup/freezer/uml ; echo  >  
> /sys/fs/cgroup/freezer/uml/tasks.
> In the said shell run UML and then freeze it using echo FROZEN > 
> /sys/fs/cgroup/freezer/uml/freezer.state.
> Later thaw it: echo THAWED > /sys/fs/cgroup/freezer/uml/freezer.state
> 

I'll try this.
Thanks for this tip.

with kind regards
thomas



--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
___
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] kernel stalls in balance_dirty_pages_ratelimited()

2014-10-20 Thread Thomas Meyer
Am Sonntag, den 19.10.2014, 21:35 +0200 schrieb Thomas Meyer:
> Am Sonntag, den 19.10.2014, 17:02 +0100 schrieb Anton Ivanov:
> > On 19/10/14 15:59, Thomas Meyer wrote:
> > > Am Dienstag, den 14.10.2014, 08:31 +0100 schrieb Anton Ivanov:
> > >> I see a very similar stall on writeout to ubd with my patches (easy) and 
> > >> without (difficult - takes running an IO soak for a few days).
> > >>
> > >> It stalls (usually) when trying to flush the journal file of ext4.
> > > any ideas?
> > 
> > I had some suspicion of a race somewhere in the UML VM subsystem. I
> > sprinked barrier() all over it, nope not the case.
> > 

I added this patch to the uml kernel:

diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 82e7db7..7f35fa4 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -241,6 +241,10 @@ static inline void __inc_zone_state(struct zone *zone, 
enum zone_stat_item item)
 static inline void __dec_zone_state(struct zone *zone, enum zone_stat_item 
item)
 {
atomic_long_dec(&zone->vm_stat[item]);
+   if (&vm_stat[item] == &vm_stat[NR_FILE_DIRTY] &&
+   atomic_long_read(&vm_stat[item]) < 0) {
+   asm("int3");
+   }
atomic_long_dec(&vm_stat[item]);
 }


And this is the backtrace leading to the negative nr_dirty value:

Program received signal SIGTRAP, Trace/breakpoint trap.
__dec_zone_state (item=, zone=) at 
include/linux/vmstat.h:248
(gdb) bt
#0  __dec_zone_state (item=, zone=) at 
include/linux/vmstat.h:248
#1  __dec_zone_page_state (item=, page=) at 
include/linux/vmstat.h:260
#2  clear_page_dirty_for_io (page=0x628b7308) at mm/page-writeback.c:2333
#3  0x60188c36 in mpage_submit_page (mpd=0x808ebb90, page=) at fs/ext4/inode.c:1785
#4  0x6018917e in mpage_map_and_submit_buffers (mpd=0x808ebb90) at 
fs/ext4/inode.c:1981
#5  0x6018d64a in mpage_map_and_submit_extent 
(give_up_on_write=, mpd=, handle=) 
at fs/ext4/inode.c:2123
#6  ext4_writepages (mapping=, wbc=) at 
fs/ext4/inode.c:2428
#7  0x600f0838 in do_writepages (mapping=, 
wbc=) at mm/page-writeback.c:2043
#8  0x60143d29 in __writeback_single_inode (inode=0x75e191a8, 
wbc=0x808ebcb8) at fs/fs-writeback.c:461
#9  0x60144c00 in writeback_sb_inodes (sb=, 
wb=0x80a92330, work=0x808ebe00) at fs/fs-writeback.c:688
#10 0x60144e0e in __writeback_inodes_wb (wb=0x808eb990, 
work=0x628b7308) at fs/fs-writeback.c:733
#11 0x60144f8d in wb_writeback (wb=0x80a92330, work=0x808ebe00) at 
fs/fs-writeback.c:864
#12 0x60145375 in wb_check_old_data_flush (wb=) at 
fs/fs-writeback.c:979
#13 wb_do_writeback (wb=) at fs/fs-writeback.c:1014
#14 bdi_writeback_workfn (work=0x808eb990) at fs/fs-writeback.c:1044
#15 0x600690a2 in process_one_work (worker=0x808c3700, work=0x80a92340) 
at kernel/workqueue.c:2023
#16 0x60069b5e in worker_thread (__worker=0x808eb990) at 
kernel/workqueue.c:2155
#17 0x6006dd9f in kthread (_create=0x80822040) at kernel/kthread.c:207
#18 0x6003ab59 in new_thread_handler () at arch/um/kernel/process.c:129
#19 0x in ?? ()




--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel