anton.ivanov | 29 Aug 09:58 2014

[PATCHv2 10/10] High Resolution Timer subsystem for UML

From: Anton Ivanov <antivano <at>>

This patch adds an extra timer source which has correct timing
and uses an up-to-date OS API and.

Results - correct kernel behaviour on timer related tasks.

    1. Improvement in network performance (TCP state machines
are now fed correct time).
    2. Correct QoS and traffic shaping.

This improvement does not (and cannot) fix UML userspace. Its
timer/time related behaviour is heavily dependent on getting
VTALRM pacing which is instantiated on a per userspace thread
basis. This patch does not fix this!!! It sorts out only the
kernel side - forwarding, qos, tcp, etc.

Signed-off-by: Anton Ivanov <antivano <at>>

I missed timer_internal.h on the original submission. Apologies.

 arch/um/Makefile                        |    2 +-
 arch/um/include/asm/irq.h               |    3 +-
 arch/um/include/shared/kern_util.h      |    1 +
 arch/um/include/shared/os.h             |    5 +
 arch/um/include/shared/timer-internal.h |   20 ++++
 arch/um/kernel/irq.c                    |   12 +++
 arch/um/kernel/process.c                |    7 +-
 arch/um/kernel/time.c                   |   44 +++++---
(Continue reading)

anton.ivanov | 29 Aug 09:56 2014

[PATCHv2 3/10] High performance networking subsystem

From: Anton Ivanov <antivano <at>>

    Support for multi-packet vector IO - multiple packets
    read in one syscall and written in one syscall. Should work with
    legacy UML, thorough tested only for the epoll based IRQ controller

    Minimal host kernel version for RX - 2.6.32
    Minimal host kernel version for TX - 3.0

    Tested on Debian 7.0/Ubuntu 12.x LTS which have the relevant
    syscalls, but do not have the appropriate glibc routine for TX
    (this is why it is a direct syscall).

Signed-off-by: Anton Ivanov <antivano <at>>

I have missed net_extra_* on the original submission, this is a resubmit.

 arch/um/drivers/Makefile          |    2 +-
 arch/um/drivers/net_extra_kern.c  |  218 +++++++++++++++++++++++++
 arch/um/drivers/net_extra_user.c  |  319 +++++++++++++++++++++++++++++++++++++
 arch/um/drivers/net_kern.c        |   63 +++++---
 arch/um/include/asm/irq.h         |   26 +--
 arch/um/include/shared/net_kern.h |   24 +++
 arch/um/include/shared/net_user.h |   24 +++
 arch/um/kernel/irq.c              |    3 +
 8 files changed, 646 insertions(+), 33 deletions(-)
 create mode 100644 arch/um/drivers/net_extra_kern.c
 create mode 100644 arch/um/drivers/net_extra_user.c
(Continue reading)

anton.ivanov | 29 Aug 09:05 2014

[PATCH 01/10] Epoll based interrupt controller

From: Anton Ivanov <antivano <at>>

1. Minimum kernel 2.5.99
2. No "walk the list" lookups for received IRQs - immediate identification
of the correct handler to invoke
3. Full set of IRQ semantics - edge, level, read, write
    3.1. Write is now a *REAL* write - so if you (ab)use the
    write to signify NONE (as in line.c) you will hang!!!
    3.2. Read is fully backward compatible
4. Otherwise mostly compatible with original poll() based controller
5. Provides significant performance improvement (up to 10x times for
large device numbers) ands lays the groundwork for the network and
timer improvements to follow

Signed-off-by: Anton Ivanov <antivano <at>>
 arch/um/drivers/line.c            |    3 +-
 arch/um/include/shared/irq_user.h |   19 +-
 arch/um/include/shared/os.h       |   13 +-
 arch/um/kernel/irq.c              |  456 +++++++++++++++++++++++++------------
 arch/um/os-Linux/irq.c            |  145 +++++-------
 5 files changed, 392 insertions(+), 244 deletions(-)

diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index 8035145..6c4511f 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
 <at>  <at>  -1,4 +1,5  <at>  <at> 
+ * Copyright (C) 2012 - 2014 Cisco Systems
(Continue reading)

Alan | 27 Aug 17:28 2014

[PATCH] um,ethertap: use strncpy

I can't prove the case pointed out in
is correct so let us play safe.

Signed-off-by: Alan Cox <alan <at>>
 arch/um/os-Linux/drivers/ethertap_user.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/um/os-Linux/drivers/ethertap_user.c b/arch/um/os-Linux/drivers/ethertap_user.c
index b39b669..6d49182 100644
--- a/arch/um/os-Linux/drivers/ethertap_user.c
+++ b/arch/um/os-Linux/drivers/ethertap_user.c
 <at>  <at>  -105,7 +105,7  <at>  <at>  static int etap_tramp(char *dev, char *gate, int control_me,
 	sprintf(data_fd_buf, "%d", data_remote);
 	sprintf(version_buf, "%d", UML_NET_VERSION);
 	if (gate != NULL) {
-		strcpy(gate_buf, gate);
+		strncpy(gate_buf, gate, 15);
 		args = setup_args;
 	else args = nosetup_args;

Slashdot TV.  
Video for Nerds.  Stuff that matters.
Toralf Förster | 23 Aug 22:05 2014

Re: [PATCH] UML: UBD: Fix for processes stuck in D state forever in UserModeLinux

I just applied the patch in on top of latest git
tree of Linus and fuzz tested a 32bit UML - works better than before. I'd say it now hangs less often than
before - just a first impression.



Slashdot TV.  
Video for Nerds.  Stuff that matters.
Toralf Förster | 11 Aug 21:22 2014

spinlock recursion w/ 3.16.0-10473-gc8d6637

/me wonders who could/should be informed about this BUG message from a 32 bit UML guest (the "dirty" comes
from reverted commit 8c86e70a)

BUG: spinlock recursion on CPU#0, rngd/1231
 lock: 0x86f1588, .magic: dead4ead, .owner: rngd/1231, .owner_cpu: 0
CPU: 0 PID: 1231 Comm: rngd Not tainted 3.16.0-10473-gc8d6637-dirty #3
 085bfb48 085bfb48 00000003 086f0547 85f6e1c0 086f1588 00000008 85f9f990
 08500fcf 00000000 85f9f964 85f9f9bc 084fd789 085cc734 086f1588 dead4ead
 85f6e408 000004cf 00000000 8437ab40 086f1588 085ca958 85f9f9cc 084fd7ab
Call Trace:
 [<084fd7ab>] ? spin_bug+0x1b/0x1f
 [<08500fcf>] dump_stack+0x26/0x28
 [<084fd789>] spin_dump+0xa1/0xa8
 [<084fd7ab>] spin_bug+0x1b/0x1f
 [<080a0db3>] do_raw_spin_lock+0x43/0x100
 [<0809739c>] ? finish_task_switch.constprop.53+0x3c/0x90
 [<08505421>] _raw_spin_lock+0x11/0x20
 [<08060622>] sigio_lock+0x12/0x20
 [<08071261>] add_sigio_fd+0x11/0x100
 [<0805ec9a>] reactivate_fd+0x6a/0x80
 [<08060597>] sigio_interrupt+0x37/0x40
 [<080a59bf>] handle_irq_event_percpu+0x2f/0x130
 [<080a9c94>] ? rcu_bh_qs+0x44/0x50
 [<080a5af4>] handle_irq_event+0x34/0x50
 [<080a8100>] handle_edge_irq+0xf0/0x120
 [<080a53cb>] generic_handle_irq+0x2b/0x30
 [<0805eda5>] do_IRQ+0x25/0x40
 [<0805ee25>] sigio_handler+0x65/0x90
 [<08071ade>] sig_handler_common+0xae/0xd0
(Continue reading)

Toralf Förster | 10 Aug 18:22 2014

3.16.0-10436-g9138475 - first impression

Well, might be too early to try the new kernel at a 32 bit Linux, but this is what I got today (just once, next
attempt to start the kernel worked fine) :

tfoerste <at> n22 /mnt/ramdisk $ stresc Xterm.log.n22.2014.    
Locating the bottom of the address space ... 0x1000
Locating the top of the address space ... 0xc0000000
Core dump limits :
        soft - 0
        hard - NONE
Checking that ptrace can change system call numbers...OK
Checking syscall emulation patch for ptrace...OK
Checking advanced syscall emulation patch for ptrace...OK
Checking environment variables for a tempdir...none found
Checking if /dev/shm is on tmpfs...OK
Checking PROT_EXEC mmap in /dev/shm...OK
Checking for the skas3 patch in the host:
  - /proc/mm...not found: No such file or directory
  - PTRACE_FAULTINFO...not found
  - PTRACE_LDT...not found
UML running in SKAS0 mode
Adding 3354624 bytes to physical memory to account for exec-shield gap
Kernel virtual memory size shrunk to 976224256 bytes
bootconsole [earlycon0] enabled
PID hash table entries: 4096 (order: 2, 16384 bytes)
Dentry cache hash table entries: 262144 (order: 8, 1048576 bytes)
Inode-cache hash table entries: 131072 (order: 7, 524288 bytes)
Sorting __ex_table...
Memory: 2007004K/2051276K available (4824K kernel code, 304K rwdata, 1776K rodata, 118K init, 241K bss,
44272K reserved)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
(Continue reading)

Toralf Förster | 7 Aug 18:11 2014

why is the stderr of a command delayed after the stdout of the previously ran command ?

Well, probably not UML related, but I experiences this the very first time:
The following output happened in my console (hostname is n22, kernel is at 3.16) when I run a command via ssh
at the 32 bit UML guest (hostname is trinity, kernel version is 3.16):

tfoerste <at> n22 ~ $ ssh tfoerste <at> trinity "ls ~/t3/core*; ps fx -eo pid,start_time,command | grep -e trinity
-e sleep | grep -v grep"
 1283 17:46  |       \_ bash -c logger "1#-1, M="; cd ~; sudo su -c 'if [[ -d ./t3 ]]; then sudo chmod -R a+rwx ./t3; sudo
rm -rf ./t3; fi'; mkdir ./t3; cd ./t3; MALLOC_CHECK_=2  trinity -C 4 -N 100000 -x mremap -q
 1290 17:46  |           \_ trinity -C 4 -N 100000 -x mremap -q
 1291 17:46  |               \_ trinity -C 4 -N 100000 -x mremap -q
 1292 17:46  |               \_ trinity -C 4 -N 100000 -x mremap -q
 1293 17:46  |                   \_ trinity -C 4 -N 100000 -x mremap -q
 1294 17:46  |                   \_ trinity -C 4 -N 100000 -x mremap -q
 1323 17:46  |                   \_ trinity -C 4 -N 100000 -x mremap -q
 1324 17:46  |                   \_ trinity -C 4 -N 100000 -x mremap -q
ls: cannot access /home/tfoerste/t3/core*: No such file or directory

I would expect, that the error message from ls comes before the ps output, or ?



Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
Toralf Förster | 1 Aug 21:47 2014

fuzz testing a 32 bit UML guest - ssh login won't work since a hour

Fuzz testing a 32 bit x86 Gentoo UML guest (especially NFSv4 files, nfs sserver and client runs within the
UML guest) with current git kernel brought the guest into a state, where no ssh login is any longer possible.

At the host side I can see that the linux processes are still running.

I attached the gdb to the linux processes at the host (even 32 bit x86 Gentoo). I do get nearly all the time:

Thread 1 (process 4252):
#0  0xb7736aec in __kernel_vsyscall ()
#1  0x08496faf in __nanosleep_nocancel () at ../sysdeps/unix/syscall-template.S:81
#2  0x08073124 in idle_sleep (nsecs=606859328243668608) at arch/um/os-Linux/time.c:183
#3  0x08060b3f in arch_cpu_idle () at arch/um/kernel/process.c:208
#4  0x080a5405 in cpuidle_idle_call () at kernel/sched/idle.c:120
#5  cpu_idle_loop () at kernel/sched/idle.c:224
#6  cpu_startup_entry (state=CPUHP_ONLINE) at kernel/sched/idle.c:272
#7  0x084e16d2 in rest_init () at init/main.c:419
#8  0x0804892e in start_kernel () at init/main.c:679
#9  0x08049fc9 in start_kernel_proc (unused=0x0) at arch/um/kernel/skas/process.c:46
#10 0x0806064b in new_thread_handler () at arch/um/kernel/process.c:129
#11 0x00000000 in ?? ()


but at least one time I got:

0x08108de3 in __put_super (sb=0x86a60000) at fs/super.c:246
246             if (!--sb-≥s_count) {

Thread 1 (process 4252):
#0  0x08108de3 in __put_super (sb=0x86a60000) at fs/super.c:246
(Continue reading)

Toralf Förster | 24 Jun 22:52 2014

was is the max. memory for a 32 bit UML decreased ?

IIRC in former times I could assign an UML instance 2047M, but nowadays
even 2044M is too big.

FWIW my host and guest are both 32 bit Gentoo Linux, I do use kernel
3.15.1 for the host system and latest git tree kernel for the UML guest.



Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
enjoy mindful | 30 May 10:24 2014

duplicated mem_map (struct page) array?

 When I'm trace uml kernel with gdb, I found there are two mem_map
(struct page) arrays.

1) the first one created in init_maps function, and pointed by *local*
pointer struct page *map in init_maps function

264 int __init linux_main(int argc, char **argv)
350         setup_physmem(uml_physmem, uml_reserved, physmem_size, highmem);
351         if (init_maps(physmem_size, iomem_size, highmem)) {
352                 printf("Failed to allocate mem_map for %Lu bytes
of physical "
353                        "memory and %Lu bytes of highmem\n", physmem_size,
354                        highmem);
355                 exit(1);
356         }

2) the second mem_map created in
start_kernel -> setup_arch -> paging_init -> free_area_init ->
free_area_init_core -> alloc_node_mem_map

and it has been pointer by global pointer "contig_page_data->node_mem_map"

Why need struct page array (the first one) for boot memory allocate? I
tried to deleted the 351~356 lines in linux_main function and the
built/run the uml kernel. The new kernel can boot and run. But it may

(Continue reading)