Thomas Meyer | 19 Oct 17:09 2014
Picon

[PATCH v3 2/3] um: add a kmsg_dumper


Add a kmsg_dumper, that dumps the kmsg buffer to stdout, when no
console is available.
This an enables the printing of early panic() calls triggered in
uml_postsetup().

Signed-off-by: Thomas Meyer <thomas <at> m3y3r.de>
---

diff -r ee0ba83fd81e arch/um/kernel/Makefile
--- a/arch/um/kernel/Makefile	Sat Oct 11 18:55:17 2014 +0200
+++ b/arch/um/kernel/Makefile	Sun Oct 12 14:42:48 2014 +0200
 <at>  <at>  -13,7 +13,7  <at>  <at> 
 obj-y = config.o exec.o exitcode.o irq.o ksyms.o mem.o \
 	physmem.o process.o ptrace.o reboot.o sigio.o \
 	signal.o smp.o syscall.o sysrq.o time.o tlb.o trap.o \
-	um_arch.o umid.o maccess.o skas/
+	um_arch.o umid.o maccess.o kmsg_dump.o skas/

 obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o
 obj-$(CONFIG_GPROF)	+= gprof_syms.o
diff -r ee0ba83fd81e arch/um/kernel/kmsg_dump.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arch/um/kernel/kmsg_dump.c	Sun Oct 12 14:42:48 2014 +0200
 <at>  <at>  -0,0 +1,43  <at>  <at> 
+#include <linux/kmsg_dump.h>
+#include <linux/console.h>
+#include <shared/init.h>
+#include <shared/kern.h>
+#include <os.h>
(Continue reading)

Thomas Meyer | 19 Oct 17:14 2014
Picon

[PATCH v3 3/3] um: enable trace irqflags support

Add TRACE_IRQFLAGS_SUPPORT to UML.
This enables LOCKDEP_SUPPORT and TRACING_SUPPORT.

Signed-off-by: Thomas Meyer <thomas <at> m3y3r.de>
---
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
 <at>  <at>  -28,10 +28,9  <at>  <at>  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
 <at>  <at>  -34,9 +34,9  <at>  <at>  static inline unsigned long arch_local_irq_save(void)
 	return flags;
 }

-static inline bool arch_irqs_disabled(void)
(Continue reading)

Thomas Meyer | 19 Oct 17:08 2014
Picon

[PATCH v3 1/3] um: Move uml_postsetup in the init_thread stack


atomic_notifier_chain_register() and uml_postsetup() do call kernel code
that rely on the current macro and a valid task_struct resp. thread_info struct.

Signed-off-by: Thomas Meyer <thomas <at> m3y3r.de>
---

diff --git a/arch/um/include/shared/as-layout.h b/arch/um/include/shared/as-layout.h
index 41c8c77..ca1843e 100644
--- a/arch/um/include/shared/as-layout.h
+++ b/arch/um/include/shared/as-layout.h
 <at>  <at>  -56,6 +56,7  <at>  <at>  extern unsigned long brk_start;
 extern unsigned long host_task_size;

 extern int linux_main(int argc, char **argv);
+extern void uml_finishsetup(void);

 struct siginfo;
 extern void (*sig_info[])(int, struct siginfo *si, struct uml_pt_regs *);
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 016adf0..ab72560 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
 <at>  <at>  -247,6 +247,16  <at>  <at>  static struct notifier_block panic_exit_notifier = {
 	.priority 		= 0
 };

+void uml_finishsetup(void)
+{
+	atomic_notifier_chain_register(&panic_notifier_list,
(Continue reading)

Thomas Meyer | 13 Oct 23:48 2014
Picon

kernel stalls in balance_dirty_pages_ratelimited()

#0  balance_dirty_pages_ratelimited (mapping=0x792cc618) at mm/page-writeback.c:1587
#1  0x00000000600ba54f in do_wp_page (mm=<optimized out>, vma=<optimized out>, address=<optimized
out>, page_table=<optimized out>, pmd
=<optimized out>, orig_pte=..., ptl=<optimized out>) at mm/memory.c:2178
#2  0x00000000600bc986 in handle_pte_fault (flags=<optimized out>, pmd=<optimized out>,
pte=<optimized out>, address=<optimized out>, v
ma=<optimized out>, mm=<optimized out>) at mm/memory.c:3230
#3  __handle_mm_fault (flags=<optimized out>, address=<optimized out>, vma=<optimized out>,
mm=<optimized out>) at mm/memory.c:3335
#4  handle_mm_fault (mm=<optimized out>, vma=0x78008e88, address=1462695424, flags=<optimized
out>) at mm/memory.c:3364
#5  0x0000000060028cec in handle_page_fault (address=1462695424, ip=<optimized out>,
is_write=<optimized out>, is_user=0, code_out=<opt
imized out>) at arch/um/kernel/trap.c:75
#6  0x00000000600290d7 in segv (fi=..., ip=1228924391, is_user=<optimized out>, regs=0x624f5728) at arch/um/kernel/trap.c:222
#7  0x0000000060029395 in segv_handler (sig=<optimized out>, unused_si=<optimized out>,
regs=<optimized out>) at arch/um/kernel/trap.c:
191
#8  0x0000000060039c0f in userspace (regs=0x624f5728) at arch/um/os-Linux/skas/process.c:429
#9  0x0000000060026a8c in fork_handler () at arch/um/kernel/process.c:149
#10 0x0000000000000000 in ?? ()

backing_dev_info:
p *mapping->backing_dev_info
$2 = {bdi_list = {next = 0x605901a0 <bdi_list>, prev = 0x80a42890}, ra_pages = 32, state = 8, capabilities =
4, congested_fn = 0x0, con
gested_data = 0x0, name = 0x604fb827 "block", bdi_stat = {{count = 4}, {count = 0}, {count = 318691}, {count
= 314567}}, bw_time_stamp
= 4339445229, dirtied_stamp = 318686, written_stamp = 314564, write_bandwidth = 166,
avg_write_bandwidth = 164, dirty_ratelimit = 1, ba
(Continue reading)

Thomas Meyer | 12 Oct 14:39 2014
Picon

[PATCH v2 2/2] um: add a kmsg_dumper


Add a kmsg_dumper, that dumps the kmsg buffer to stdout, when no
console is available.
This an enables the printing of early panic() calls triggered in
uml_postsetup().

Signed-off-by: Thomas Meyer <thomas <at> m3y3r.de>
---
 arch/um/drivers/ubd_kern.c  |  5 +++--
 arch/um/include/shared/os.h |  1 +
 arch/um/kernel/Makefile     |  2 +-
 arch/um/kernel/kmsg_dump.c  | 44 ++++++++++++++++++++++++++++++++++++++++++++
 arch/um/kernel/um_arch.c    |  2 ++
 arch/um/os-Linux/util.c     | 12 ++++++++++++
 6 files changed, 63 insertions(+), 3 deletions(-)
 create mode 100644 arch/um/kernel/kmsg_dump.c

diff -r ee0ba83fd81e arch/um/kernel/Makefile
--- a/arch/um/kernel/Makefile	Sat Oct 11 18:55:17 2014 +0200
+++ b/arch/um/kernel/Makefile	Sun Oct 12 14:24:54 2014 +0200
 <at>  <at>  -13,7 +13,7  <at>  <at> 
 obj-y = config.o exec.o exitcode.o irq.o ksyms.o mem.o \
 	physmem.o process.o ptrace.o reboot.o sigio.o \
 	signal.o smp.o syscall.o sysrq.o time.o tlb.o trap.o \
-	um_arch.o umid.o maccess.o skas/
+	um_arch.o umid.o maccess.o kmsg_dump.o skas/

 obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o
 obj-$(CONFIG_GPROF)	+= gprof_syms.o
diff -r ee0ba83fd81e arch/um/kernel/kmsg_dump.c
(Continue reading)

Thomas Meyer | 12 Oct 14:39 2014
Picon

[PATCH v2 1/2] um: Move uml_postsetup in the init_thread stack


atomic_notifier_chain_register() and uml_postsetup() do call kernel code
that rely on the current macro and a valid task_struct resp. thread_info struct.

Signed-off-by: Thomas Meyer <thomas <at> m3y3r.de>
---
 arch/um/include/shared/as-layout.h |  1 +
 arch/um/kernel/um_arch.c           | 15 ++++++++++-----
 arch/um/os-Linux/skas/process.c    |  2 +-
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/arch/um/include/shared/as-layout.h b/arch/um/include/shared/as-layout.h
index 41c8c77..ca1843e 100644
--- a/arch/um/include/shared/as-layout.h
+++ b/arch/um/include/shared/as-layout.h
 <at>  <at>  -56,6 +56,7  <at>  <at>  extern unsigned long brk_start;
 extern unsigned long host_task_size;

 extern int linux_main(int argc, char **argv);
+extern void uml_finishsetup(void);

 struct siginfo;
 extern void (*sig_info[])(int, struct siginfo *si, struct uml_pt_regs *);
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 016adf0..ab72560 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
 <at>  <at>  -247,6 +247,16  <at>  <at>  static struct notifier_block panic_exit_notifier = {
 	.priority 		= 0
 };
(Continue reading)

Thomas Meyer | 9 Oct 19:55 2014
Picon

[PATCH 2/2] um: add a kmsg_dumper


Add a kmsg_dumper, that dumps the kmsg buffer to stderr, when no
console is available.
This an enables the printing of early panic() calls triggered in
uml_postsetup().

Signed-off-by: Thomas Meyer <thomas <at> m3y3r.de>
---
 arch/um/drivers/ubd_kern.c  |  5 +++--
 arch/um/include/shared/os.h |  1 +
 arch/um/kernel/Makefile     |  2 +-
 arch/um/kernel/kmsg_dump.c  | 44 ++++++++++++++++++++++++++++++++++++++++++++
 arch/um/kernel/um_arch.c    |  2 ++
 arch/um/os-Linux/util.c     | 12 ++++++++++++
 6 files changed, 63 insertions(+), 3 deletions(-)
 create mode 100644 arch/um/kernel/kmsg_dump.c

diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h
index 08eec0b..36741f4 100644
--- a/arch/um/include/shared/os.h
+++ b/arch/um/include/shared/os.h
 <at>  <at>  -238,6 +238,7  <at>  <at>  extern void setup_hostinfo(char *buf, int len);
 extern void os_dump_core(void) __attribute__ ((noreturn));
 extern void um_early_printk(const char *s, unsigned int n);
 extern void os_fix_helper_signals(void);
+extern int os_printf_stderr(const char *fmt, ...);

 /* time.c */
 extern void idle_sleep(unsigned long long nsecs);
diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile
(Continue reading)

Thomas Meyer | 9 Oct 19:54 2014
Picon

[PATCH 1/2] um: Move uml_postsetup in the init_thread stack


atomic_notifier_chain_register() and uml_postsetup() do call kernel code
that rely on the current macro and a valid task_struct resp. thread_info struct.

Signed-off-by: Thomas Meyer <thomas <at> m3y3r.de>
---
 arch/um/include/shared/as-layout.h |  1 +
 arch/um/kernel/um_arch.c           | 15 ++++++++++-----
 arch/um/os-Linux/skas/process.c    |  2 +-
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/arch/um/include/shared/as-layout.h b/arch/um/include/shared/as-layout.h
index 41c8c77..ca1843e 100644
--- a/arch/um/include/shared/as-layout.h
+++ b/arch/um/include/shared/as-layout.h
 <at>  <at>  -56,6 +56,7  <at>  <at>  extern unsigned long brk_start;
 extern unsigned long host_task_size;

 extern int linux_main(int argc, char **argv);
+extern void uml_finishsetup(void);

 struct siginfo;
 extern void (*sig_info[])(int, struct siginfo *si, struct uml_pt_regs *);
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 016adf0..ab72560 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
 <at>  <at>  -247,6 +247,16  <at>  <at>  static struct notifier_block panic_exit_notifier = {
 	.priority 		= 0
 };
(Continue reading)

Thomas Meyer | 3 Oct 01:21 2014
Picon

panic() call from non-kernel stack in uml_postsetup

Hi,

When you pass an initrd to UML and the size of the initrd is too big for
the current kernel memory, a panic() call is done with the message("Out
of memory").

But this message never hits the stdout as the following stack trace
dumps because there is no current_thread_info() in the UML stack, which
is still active at this time:

(gdb) bt
#0  dump_stack_print_info (log_lvl=0x6053f583 "\001d") at kernel/printk/printk.c:2979
#1  0x000000006047126b in __dump_stack () at lib/dump_stack.c:14
#2  dump_stack () at lib/dump_stack.c:50
#3  0x000000006046bf87 in panic	(fmt=<optimized out>) at kernel/panic.c:110
#4  0x0000000060010bc7 in ___alloc_bootmem (limit=<optimized out>, goal=<optimized out>,
align=<optimized out>, size=<optimized out>) a
t mm/bootmem.c:674
#5  __alloc_bootmem (size=55792228, align=<optimized out>, goal=<optimized out>) at mm/bootmem.c:696
#6  0x0000000060004eca in read_initrd () at arch/um/kernel/initrd.c:39
#7  0x0000000060004b71 in uml_postsetup	() at arch/um/kernel/um_arch.c:228
#8  linux_main (argc=<optimized out>, argv=0x7fffffffdf98) at arch/um/kernel/um_arch.c:377
#9  0x00000000600059db in main (argc=<optimized out>, argv=0x7fffffffdf98, envp=<optimized out>) at arch/um/os-Linux/main.c:156

So current_thread_info() will return the stack of the UML program
itself, which is an invalid struct thread_info:
thread info= 0x7fffffffc000

so the access to current->pid, will segfault as "current" is a macro for
current_thread_info()->task->pid and task is NULL.
(Continue reading)

Thomas Meyer | 29 Sep 19:36 2014
Picon

Remove default root?

Hi,

I tried to install the latest Fedora 21 from the Network Install Image
DVD
(
https://fedoraproject.org/get-prerelease#server
http://download.fedoraproject.org/pub/fedora/linux/releases/test/21-Alpha/Server/x86_64/iso/Fedora-Server-netinst-x86_64-21_Alpha.iso )

I did these step to install the distribution:

1.) Extract the initrd and boot options from the DVD via a loop device
mount
2.) Boot UML with:

linux mem=800M umid=fedora21 eth0=tuntap,,,192.168.1.150
ubd0=images/Fedora21-Root.img
ubd1=images/Fedora-Server-netinst-x86_64-21_Alpha.iso plymouth.enable=0
initrd=images/initrd.img inst.stage2=hd:LABEL=Fedora-S-21_A-x86_64
ip=192.168.1.151::192.168.1.150:255.255.255.0:servername:eth0:off
nameserver=8.8.8.8

3.) I only added the option "plymouth.enable=0" because the plymouth
get's confused by the missing KMS(?!)

The problem is, that this only works when I remove the default root
option from UML, as the dracut, get's confused by the root= option.

So as many modern distributions boot via an initramfs image and
autodetect the root partition automatically, I want to know what do you
think about the removal of the default root option from UML?
(Continue reading)

anton.ivanov | 26 Sep 15:18 2014
Picon

[PATCH v2] Fix for occasional userspace process in D/Z state

From: Anton Ivanov <antivano <at> cisco.com>

Occasionally, under very heavy load inside UML, on host
or both one of the processes in UML will remain in D state
or will fail to reap a child which will sit in Z state.

This is very difficult to reproduce with stock UML because
the lseek()/read()|write()|fsync() in the ubd driver will
cause a constant "trickle" of memory synchronization regardless
of what UML is doing. It is possible though (3-4 hours of
loadavg >6 stress load with low memory can trigger it).

If lseek()/read()|write() are replaced with its equivalent
pread()|pwrite() the original bug becomes much easier to
reproduce. It now takes 5-10 minutes of heavy IO to cause it.

This fix seems to cure it. I am not sure if this is the best
place to invoke a memory barrier, this one works.

Signed-off-by: Anton Ivanov <antivano <at> cisco.com>
---

This version takes into account the fact that uml picks up the 
correct define out of arch/x86/um/barrier.h so no need to invoke it 
directly - noted by Richard Weinberger

I still do not know if this is the correct location to hit it with a
mb(). This one seems to cure it.

 arch/um/kernel/exec.c |    1 +
(Continue reading)


Gmane