Re: [uml-devel] [PATCH] delete unnecessary bootmem struct page array

2014-06-01 Thread Richard Weinberger
Am 01.06.2014 15:08, schrieb Real Name:
 From: Honggang Li enjoymind...@gmail.com
 
 1) uml kernel bootmem managed through bootmem_data-node_bootmem_map,
 not the struct page array, so the array is unnecessary.
 
 2) the bootmem struct page array has been pointed by a *local* pointer,
 struct page *map, in init_maps function. The array can be accessed only
 in init_maps's scope. As a result, uml kernel wastes about 1% of total
 memory.

I reread your patch again.
You missed one important point. init_maps() setups max_mapnr which is used by
virt_addr_valid().

We have to be extremely careful here to not introduce a subtle fuckup.

Thanks,
//richard

--
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
___
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] duplicated mem_map (struct page) array?

2014-05-31 Thread Richard Weinberger
On Fri, May 30, 2014 at 11:17 AM, Richard Weinberger
richard.weinber...@gmail.com wrote:
 On Fri, May 30, 2014 at 10:24 AM, enjoy mindful enjoymind...@gmail.com 
 wrote:
 Hi,
  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

 arch/um/kernel/um_arch.c
 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 
 353memory and %Lu bytes of highmem\n, physmem_size,
 354highmem);
 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
 panic.

 Linux has only one mem_map array, defined in mm/memory.
 I also fail to see how the kernel can work if you delete the call to
 init_maps().

 *confused* :)

So, I gave it a try and it really works. Wut?
Feel free to send a cleanup patch which explains in details why it works.
Looks like you found old code. :D

-- 
Thanks,
//richard

--
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
___
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] duplicated mem_map (struct page) array?

2014-05-30 Thread Richard Weinberger
On Fri, May 30, 2014 at 10:24 AM, enjoy mindful enjoymind...@gmail.com wrote:
 Hi,
  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

 arch/um/kernel/um_arch.c
 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 
 353memory and %Lu bytes of highmem\n, physmem_size,
 354highmem);
 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
 panic.

Linux has only one mem_map array, defined in mm/memory.
I also fail to see how the kernel can work if you delete the call to
init_maps().

*confused* :)

-- 
Thanks,
//richard

--
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 1/2] um: Detect NULL dereferences earlier

2014-05-29 Thread Richard Weinberger
There is no need to go through handle_page_fault().
If we try to access the zero page in kernel mode just panic().

Signed-off-by: Richard Weinberger rich...@nod.at
---
 arch/um/kernel/trap.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c
index 974b874..b0a3017 100644
--- a/arch/um/kernel/trap.c
+++ b/arch/um/kernel/trap.c
@@ -218,10 +218,15 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, 
int is_user,
panic(Segfault with no mm);
}
 
-   if (SEGV_IS_FIXABLE(fi) || SEGV_MAYBE_FIXABLE(fi))
+   if (SEGV_IS_FIXABLE(fi) || SEGV_MAYBE_FIXABLE(fi)) {
+   if (!is_user  address  PAGE_SIZE) {
+   show_regs(container_of(regs, struct pt_regs, regs));
+   panic(NULL pointer dereference at ip:0x%lx 
address:0x%lx, ip, address);
+   }
+
err = handle_page_fault(address, ip, is_write, is_user,
si.si_code);
-   else {
+   } else {
err = -EFAULT;
/*
 * A thread accessed NULL, we get a fault, but CR2 is invalid.
-- 
1.8.4.2


--
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 2/2] um: Detect kernel userspace access

2014-05-29 Thread Richard Weinberger
From time to time users report that UML hangs and consumes 100% CPU
on the host side.
Analyzing such an issue uncovered a bug in UML's page fault
handler. If the kernel tries to access userspace memory without
copy_from/to_user() UML receives a SIGSEGV and tries to handle
it. As the page fault handler is not designed to fix such faults the
SIGSEGV stays and UML consumes all CPU handling SIGSEGV.
The only sane thing we can do here is calling panic().

This patch helps to detect bad memory access from the kernel side.

Signed-off-by: Richard Weinberger rich...@nod.at
---
 arch/um/kernel/trap.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c
index b0a3017..04a6de4 100644
--- a/arch/um/kernel/trap.c
+++ b/arch/um/kernel/trap.c
@@ -222,6 +222,9 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, 
int is_user,
if (!is_user  address  PAGE_SIZE) {
show_regs(container_of(regs, struct pt_regs, regs));
panic(NULL pointer dereference at ip:0x%lx 
address:0x%lx, ip, address);
+   } else if (!is_user  address  task_size) {
+   show_regs(container_of(regs, struct pt_regs, regs));
+   panic(Kernel tried to access userspace at ip:0x%lx 
address:0x%lx, ip, address);
}
 
err = handle_page_fault(address, ip, is_write, is_user,
-- 
1.8.4.2


--
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
___
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 0/4] UserModeLinux: Message logging neatening

2014-05-14 Thread Richard Weinberger
Am 10.05.2014 01:43, schrieb Joe Perches:
 Joe Perches (4):
   UserModeLinux: Convert UM_KERN_LEVEL to KERN_LEVEL
   UserModeLinux: Remove unused #defines of UM_KERN_LEVEL
   UserModeLinux: Use a more current logging style
   UserModeLinux: Convert printks to pr_level
 
  arch/um/drivers/chan_kern.c  |  27 +++
  arch/um/drivers/chan_user.c  |  47 ++--
  arch/um/drivers/daemon_kern.c|   8 +-
  arch/um/drivers/daemon_user.c|  28 +++
  arch/um/drivers/fd.c |   9 +--
  arch/um/drivers/harddog_kern.c   |   4 +-
  arch/um/drivers/harddog_user.c   |  14 ++--
  arch/um/drivers/hostaudio_kern.c |  13 ++--
  arch/um/drivers/line.c   |  24 +++---
  arch/um/drivers/mconsole_kern.c  |  29 +++
  arch/um/drivers/mconsole_user.c  |   7 +-
  arch/um/drivers/mmapper_kern.c   |   7 +-
  arch/um/drivers/net_kern.c   |  53 +
  arch/um/drivers/net_user.c   |  20 ++---
  arch/um/drivers/pcap_kern.c  |   9 +--
  arch/um/drivers/pcap_user.c  |  19 +++--
  arch/um/drivers/port_kern.c  |  23 +++---
  arch/um/drivers/port_user.c  |   6 +-
  arch/um/drivers/pty.c|   4 +-
  arch/um/drivers/random.c |   3 +-
  arch/um/drivers/slip_kern.c  |   2 +-
  arch/um/drivers/slip_user.c  |  29 +++
  arch/um/drivers/slirp_kern.c |   9 +--
  arch/um/drivers/slirp_user.c |   9 +--
  arch/um/drivers/ssl.c|  10 +--
  arch/um/drivers/stdio_console.c  |   9 +--
  arch/um/drivers/tty.c|   3 +-
  arch/um/drivers/ubd_kern.c   | 117 +
  arch/um/drivers/ubd_user.c   |   6 +-
  arch/um/drivers/umcast_kern.c|  38 +-
  arch/um/drivers/umcast_user.c|  35 -
  arch/um/drivers/vde_kern.c   |  23 +++---
  arch/um/drivers/vde_user.c   |  17 ++---
  arch/um/drivers/xterm.c  |  26 +++
  arch/um/drivers/xterm_kern.c |   6 +-
  arch/um/include/asm/pgtable-2level.h |  12 +--
  arch/um/include/asm/pgtable-3level.h |  18 ++---
  arch/um/include/shared/user.h|  12 +--
  arch/um/kernel/exec.c|   4 +-
  arch/um/kernel/exitcode.c|   3 +-
  arch/um/kernel/initrd.c  |  10 +--
  arch/um/kernel/irq.c |  14 ++--
  arch/um/kernel/physmem.c |  16 ++--
  arch/um/kernel/process.c |   2 +-
  arch/um/kernel/sigio.c   |   4 +-
  arch/um/kernel/skas/mmu.c|   9 +--
  arch/um/kernel/smp.c |  18 ++---
  arch/um/kernel/sysrq.c   |  21 +++---
  arch/um/kernel/time.c|   6 +-
  arch/um/kernel/tlb.c |   8 +-
  arch/um/kernel/trap.c|   9 +--
  arch/um/os-Linux/aio.c   |  45 +--
  arch/um/os-Linux/drivers/ethertap_kern.c |   8 +-
  arch/um/os-Linux/drivers/ethertap_user.c |  32 
  arch/um/os-Linux/drivers/tuntap_kern.c   |   6 +-
  arch/um/os-Linux/drivers/tuntap_user.c   |  24 +++---
  arch/um/os-Linux/file.c  |  37 -
  arch/um/os-Linux/helper.c|  33 
  arch/um/os-Linux/irq.c   |   8 +-
  arch/um/os-Linux/process.c   |  31 
  arch/um/os-Linux/sigio.c |  83 +---
  arch/um/os-Linux/skas/mem.c  |  23 +++---
  arch/um/os-Linux/skas/process.c  | 125 
 ++-
  arch/um/os-Linux/time.c  |   3 +-
  arch/um/os-Linux/tty.c   |  10 +--
  arch/um/os-Linux/umid.c  |  48 ++--
  arch/x86/um/bugs_32.c|  14 ++--
  arch/x86/um/os-Linux/registers.c |   2 +-
  68 files changed, 605 insertions(+), 786 deletions(-)
 

Thank you Joe!
I'll queue your patches for 3.16.

Thanks,
//richard

--
Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free.
http://p.sf.net/sfu/SauceLabs
___
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 0/4] UserModeLinux: Message logging neatening

2014-05-14 Thread Richard Weinberger
Am 14.05.2014 22:07, schrieb Joe Perches:
 On Wed, 2014-05-14 at 21:52 +0200, Richard Weinberger wrote:
 Am 10.05.2014 01:43, schrieb Joe Perches:
 Joe Perches (4):
   UserModeLinux: Convert UM_KERN_LEVEL to KERN_LEVEL
   UserModeLinux: Remove unused #defines of UM_KERN_LEVEL
   UserModeLinux: Use a more current logging style
   UserModeLinux: Convert printks to pr_level
 
 Thank you Joe!
 I'll queue your patches for 3.16.
 
 (adding Geert to cc's)
 
 Hi Richard.
 
 Please queue only patches 1 and 2.
 
 Patches 3 and 4 are currently defective.
 These need a bit of rework to compile appropriately.

Oh, I thought you have tested your patches. :-(

Thanks,
//richard

--
Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free.
http://p.sf.net/sfu/SauceLabs
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 2/2] um: Ensure that nobody remaps the stub vma

2014-05-03 Thread Richard Weinberger
This fixes a long standing problem that UML crashes
or locks up if a task messes with it' stub vma.

Reported-by: toralf.foers...@gmx.de
Signed-off-by: Richard Weinberger rich...@nod.at
---
 arch/um/kernel/tlb.c | 18 +++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/arch/um/kernel/tlb.c b/arch/um/kernel/tlb.c
index 9472079..b33d1d1 100644
--- a/arch/um/kernel/tlb.c
+++ b/arch/um/kernel/tlb.c
@@ -12,6 +12,7 @@
 #include mem_user.h
 #include os.h
 #include skas.h
+#include kern_util.h
 
 struct host_vm_change {
struct host_vm_op {
@@ -90,6 +91,9 @@ static int add_mmap(unsigned long virt, unsigned long phys, 
unsigned long len,
struct host_vm_op *last;
int fd, ret = 0;
 
+   if ((virt = STUB_START)  (virt  STUB_END))
+   return -EINVAL;
+
fd = phys_mapping(phys, offset);
if (hvc-index != 0) {
last = hvc-ops[hvc-index - 1];
@@ -124,6 +128,9 @@ static int add_munmap(unsigned long addr, unsigned long len,
struct host_vm_op *last;
int ret = 0;
 
+   if ((addr = STUB_START)  (addr  STUB_END))
+   return -EINVAL;
+
if (hvc-index != 0) {
last = hvc-ops[hvc-index - 1];
if ((last-type == MUNMAP) 
@@ -283,8 +290,10 @@ void fix_range_common(struct mm_struct *mm, unsigned long 
start_addr,
/* This is not an else because ret is modified above */
if (ret) {
printk(KERN_ERR fix_range_common: failed, killing current 
-  process\n);
-   force_sig(SIGKILL, current);
+  process: %d\n, task_tgid_vnr(current));
+   /* We are under mmap_sem, release it such that current can 
terminate */
+   up_write(current-mm-mmap_sem);
+   fatal_sigsegv();
}
 }
 
@@ -409,6 +418,9 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned 
long address)
w = 0;
}
 
+   if ((address = STUB_START)  (address  STUB_END))
+   goto kill;
+
mm_id = mm-context.id;
prot = ((r ? UM_PROT_READ : 0) | (w ? UM_PROT_WRITE : 0) |
(x ? UM_PROT_EXEC : 0));
@@ -435,7 +447,7 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned 
long address)
 
 kill:
printk(KERN_ERR Failed to flush page for address 0x%lx\n, address);
-   force_sig(SIGKILL, current);
+   fatal_sigsegv();
 }
 
 pgd_t *pgd_offset_proc(struct mm_struct *mm, unsigned long address)
-- 
1.8.1.4


--
Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free.
http://p.sf.net/sfu/SauceLabs
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 1/2] Revert um: Fix wait_stub_done() error handling

2014-05-03 Thread Richard Weinberger
This reverts commit 0974a9cadc7886f7baaa458bb0c89f5c5f9d458e.
It was a bad idea and was only papering over the real issue.

Signed-off-by: Richard Weinberger rich...@nod.at
---
 arch/um/os-Linux/skas/process.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index d531879..908579f 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -54,7 +54,7 @@ static int ptrace_dump_regs(int pid)
 
 void wait_stub_done(int pid)
 {
-   int n, status, err, bad_stop = 0;
+   int n, status, err;
 
while (1) {
CATCH_EINTR(n = waitpid(pid, status, WUNTRACED | __WALL));
@@ -74,8 +74,6 @@ void wait_stub_done(int pid)
 
if (((1  WSTOPSIG(status))  STUB_DONE_MASK) != 0)
return;
-   else
-   bad_stop = 1;
 
 bad_wait:
err = ptrace_dump_regs(pid);
@@ -85,10 +83,7 @@ bad_wait:
printk(UM_KERN_ERR wait_stub_done : failed to wait for SIGTRAP, 
   pid = %d, n = %d, errno = %d, status = 0x%x\n, pid, n, errno,
   status);
-   if (bad_stop)
-   kill(pid, SIGKILL);
-   else
-   fatal_sigsegv();
+   fatal_sigsegv();
 }
 
 extern unsigned long current_stub_stack(void);
-- 
1.8.1.4


--
Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free.
http://p.sf.net/sfu/SauceLabs
___
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 BUG: while fuzzying a 32 bit Linux user mode guest with trinity

2014-05-03 Thread Richard Weinberger
On Sat, May 3, 2014 at 6:04 PM, Toralf Förster toralf.foers...@gmx.de wrote:
 I could force a crash using latest kernel tree (v3.15-rc3-159-g6c6ca9c with 
 applied fix3.patch for the mremap syscall) and latest trinity tree 
 (1.1-1349-g18ebf71).

 The backtrace of the core dump gives :

 tfoerste@n22 ~/tmp $ gdb /home/tfoerste/devel/linux/linux 
 --core=/mnt/ramdisk/core -batch -ex 'thread apply all bt'
 [New LWP 23912]

 warning: Could not load shared library symbols for linux-gate.so.1.
 Do you need set solib-search-path or set sysroot?
 Core was generated by `/home/tfoerste/devel/linux/linux earlyprintk 
 ubda=/home/tfoerste/virtual/uml/tr'.
 Program terminated with signal 6, Aborted.
 #0  0xb7741424 in __kernel_vsyscall ()

 Thread 1 (LWP 23912):
 #0  0xb7741424 in __kernel_vsyscall ()
 #1  0x0848ac75 in kill ()
 #2  0x08072a5d in uml_abort () at arch/um/os-Linux/util.c:93
 #3  0x08072d95 in os_dump_core () at arch/um/os-Linux/util.c:148
 #4  0x0806257d in panic_exit (self=0x86c9618 panic_exit_notifier, 
 unused1=0, unused2=0x8700960 buf.17019) at arch/um/kernel/um_arch.c:240
 #5  0x0809a266 in notifier_call_chain (nl=0x0, val=0, v=0x8700960 
 buf.17019, nr_to_call=-2, nr_calls=0x0) at kernel/notifier.c:93
 #6  0x0809a381 in __atomic_notifier_call_chain (nh=0x8700944 
 panic_notifier_list, val=0, v=0x8700960 buf.17019, nr_to_call=0, 
 nr_calls=0x0) at kernel/notifier.c:182
 #7  0x0809a3bf in atomic_notifier_call_chain (nh=0x0, val=0, v=0x0) at 
 kernel/notifier.c:191
 #8  0x084e742c in panic (fmt=0x0) at kernel/panic.c:130
 #9  0x080cc265 in __delete_from_page_cache (page=0xa303520, shadow=0x0) at 
 mm/filemap.c:202
 #10 0x080cc32b in delete_from_page_cache (page=0xa303520) at mm/filemap.c:234
 #11 0x080d7af7 in truncate_complete_page (page=optimized out, 
 mapping=optimized out) at mm/truncate.c:145
 #12 truncate_inode_page (mapping=0x4592c974, page=0xa303520) at 
 mm/truncate.c:180
 #13 0x080de69d in shmem_undo_range (inode=0x4592c8bc, lstart=26525858516, 
 lend=3247232753107730432, unfalloc=false) at mm/shmem.c:429
 #14 0x080df591 in shmem_truncate_range (inode=0x4592c8bc, lstart=0, 
 lend=3247230382285783040) at mm/shmem.c:526
 #15 0x080df6a8 in shmem_fallocate (file=0x0, mode=3, offset=0, len=1048576) 
 at mm/shmem.c:1741
 #16 0x081045da in do_fallocate (file=0x458bf300, mode=3, offset=0, 
 len=1048576) at fs/open.c:298
 #17 0x080e6b91 in madvise_remove (end=optimized out, start=optimized out, 
 prev=optimized out, vma=optimized out) at mm/madvise.c:332
 #18 madvise_vma (behavior=optimized out, end=optimized out, 
 start=optimized out, prev=optimized out, vma=optimized out) at 
 mm/madvise.c:384
 #19 SYSC_madvise (behavior=optimized out, len_in=optimized out, 
 start=optimized out) at mm/madvise.c:534
 #20 SyS_madvise (start=1076387840, len_in=1048576, behavior=9) at 
 mm/madvise.c:465
 #21 0x08062b34 in handle_syscall (r=0x2d38e3e0) at 
 arch/um/kernel/skas/syscall.c:35
 #22 0x08074875 in handle_trap (local_using_sysemu=optimized out, 
 regs=optimized out, pid=optimized out) at 
 arch/um/os-Linux/skas/process.c:193
 #23 userspace (regs=0x2d38e3e0) at arch/um/os-Linux/skas/process.c:426
 #24 0x0805f770 in fork_handler () at arch/um/kernel/process.c:149
 #25 0x in ?? ()



 The output of the UML guest is :


 Kernel panic - not syncing: BUG!
 CPU: 0 PID: 1988 Comm: trinity-c2 Not tainted 3.15.0-rc3-00159-g6c6ca9c-dirty 
 #8
 Stack:
  085a4f54 085a4f54 2d107bbc 0004 086c8547 0a303520 003f 4592c974
  2d107bcc 084eafa5   2d107bf4 084e7410 085b08ec 08700960
  085a1ca5 2d107c00  0a303520 003f 4592c974 2d107c2c 080cc265
 Call Trace:
  [080cc265] ? __delete_from_page_cache+0x215/0x270
  [084eafa5] dump_stack+0x26/0x28
  [084e7410] panic+0x7a/0x194
  [080cc265] __delete_from_page_cache+0x215/0x270
  [080cc32b] delete_from_page_cache+0x6b/0x90
  [080d7af7] truncate_inode_page+0x97/0xb0
  [080de69d] shmem_undo_range+0x1bd/0x620
  [080df591] shmem_truncate_range+0x31/0x60
  [080df6a8] shmem_fallocate+0xe8/0x360
  [0849a605] ? __gettimeofday+0x15/0x30
  [08071dfe] ? set_signals+0x1e/0x40
  [081045da] do_fallocate+0x14a/0x1d0
  [080e6b91] SyS_madvise+0x1d1/0x720
  [080aef0d] ? __getnstimeofday+0x3d/0x100
  [0807fa68] ? SyS_gettimeofday+0x38/0x80
  [08062b34] handle_syscall+0x64/0x80
  [0849d621] ? ptrace+0x31/0x80
  [08079802] ? get_fp_registers+0x22/0x40
  [08074875] userspace+0x475/0x5f0
  [0849d621] ? ptrace+0x31/0x80
  [08079d66] ? os_set_thread_area+0x26/0x40
  [08078d30] ? do_set_thread_area+0x20/0x50
  [08078ea8] ? arch_switch_tls+0xb8/0x100
  [0805f770] fork_handler+0x60/0x70
 /home/tfoerste/workspace/bin/start_uml.sh: line 110: 23912 Aborted
  (core dumped) $LINUX earlyprintk ubda=$ROOTFS ubdb=$SWAP eth0=$NET 
 mem=$MEM $TTY umid=uml_$NAME rootfstype=ext4 $ARGS
 [3g




 There's no trinity log available, I lost it, sry.

 FWIW the host system is a stable 32 bit Gentoo Linux with kernel 3.14.2.

As written two days ago, this seems to be a 

Re: [uml-devel] trinity commit 23dc478aba breaks syscall mremap at a 32 bit user mode linux

2014-05-02 Thread Richard Weinberger
Am 01.05.2014 23:34, schrieb Toralf Förster:
 On 05/01/2014 10:57 PM, Richard Weinberger wrote:
 Toralf,

 Yeah, this is because trinity destroys the UML stub code.
 Please test the attached patch, it should fix the root cause of the problem.

 Thanks,
 //richard

 
 If I do just apply fix2.patch onto latest git tree  v3.15-rc3-113-gba6728f 
 then I do get after a while :
 
  * Starting sshd ...  
 [ ok ]
  * Starting local
 net.core.warnings = 0 
 [ ok ]
 Kernel panic - not syncing: do_syscall_stub : PTRACE_SETREGS failed, errno = 3
 
 CPU: 0 PID: 1728 Comm: trinity-c0 Not tainted 3.15.0-rc3-00113-gba6728f-dirty 
 #5
 Stack:
 BUG: soft lockup - CPU#0 stuck for 22s! [trinity-c0:1728]
 
 EIP: c500:[47c6cf00] CPU: 0 Not tainted EFLAGS: 476af700
 Not tainted
 EAX: 47cfc500 EBX: 0a024d00 ECX: 086c75fc EDX: 080fff88
 ESI: 0839f4bc EDI: 47cfc500 EBP: 0839f4bc DS: c500 ES: cd62
 EXT4-fs (ubda): error count: 1
 EXT4-fs (ubda): initial error at 1398962134: ext4_mb_generate_buddy:756
 EXT4-fs (ubda): last error at 1398962134: ext4_mb_generate_buddy:756

Hmm, there is another bug hidden.
/me looks.

 
 which is a big improvement because before it crashes immediately after few 
 seconds.
 
 After applying both fixes the test case runs w/o a crash till now.

It should work without removing the panics().
Otherwise an attacker could do nasty things.

Thanks,
//richard

--
Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free.
http://p.sf.net/sfu/SauceLabs
___
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] trinity commit 23dc478aba breaks syscall mremap at a 32 bit user mode linux

2014-05-02 Thread Richard Weinberger
Am 01.05.2014 23:34, schrieb Toralf Förster:
 On 05/01/2014 10:57 PM, Richard Weinberger wrote:
 Toralf,

 Yeah, this is because trinity destroys the UML stub code.
 Please test the attached patch, it should fix the root cause of the problem.

 Thanks,
 //richard

 
 If I do just apply fix2.patch onto latest git tree  v3.15-rc3-113-gba6728f 
 then I do get after a while :
 
  * Starting sshd ...  
 [ ok ]
  * Starting local
 net.core.warnings = 0 
 [ ok ]
 Kernel panic - not syncing: do_syscall_stub : PTRACE_SETREGS failed, errno = 3
 
 CPU: 0 PID: 1728 Comm: trinity-c0 Not tainted 3.15.0-rc3-00113-gba6728f-dirty 
 #5
 Stack:
 BUG: soft lockup - CPU#0 stuck for 22s! [trinity-c0:1728]
 
 EIP: c500:[47c6cf00] CPU: 0 Not tainted EFLAGS: 476af700
 Not tainted
 EAX: 47cfc500 EBX: 0a024d00 ECX: 086c75fc EDX: 080fff88
 ESI: 0839f4bc EDI: 47cfc500 EBP: 0839f4bc DS: c500 ES: cd62
 EXT4-fs (ubda): error count: 1
 EXT4-fs (ubda): initial error at 1398962134: ext4_mb_generate_buddy:756
 EXT4-fs (ubda): last error at 1398962134: ext4_mb_generate_buddy:756
 
 
 which is a big improvement because before it crashes immediately after few 
 seconds.
 
 After applying both fixes the test case runs w/o a crash till now.

Can you please also try fix3 (without fix1/2)?
I think I've found the other hidden issue.
So far trinity did not crash my kernel...

Thanks,
//richard
diff --git a/arch/um/kernel/tlb.c b/arch/um/kernel/tlb.c
index 9472079..f1b3eb1 100644
--- a/arch/um/kernel/tlb.c
+++ b/arch/um/kernel/tlb.c
@@ -12,6 +12,7 @@
 #include mem_user.h
 #include os.h
 #include skas.h
+#include kern_util.h
 
 struct host_vm_change {
 	struct host_vm_op {
@@ -124,6 +125,9 @@ static int add_munmap(unsigned long addr, unsigned long len,
 	struct host_vm_op *last;
 	int ret = 0;
 
+	if ((addr = STUB_START)  (addr  STUB_END))
+		return -EINVAL;
+
 	if (hvc-index != 0) {
 		last = hvc-ops[hvc-index - 1];
 		if ((last-type == MUNMAP) 
@@ -283,8 +287,11 @@ void fix_range_common(struct mm_struct *mm, unsigned long start_addr,
 	/* This is not an else because ret is modified above */
 	if (ret) {
 		printk(KERN_ERR fix_range_common: failed, killing current 
-		   process\n);
+		   process: %d\n, task_tgid_vnr(current));
+		/* We are under mmap_sem, release it such that current can terminate */
+		up_write(current-mm-mmap_sem);
 		force_sig(SIGKILL, current);
+		do_signal();
 	}
 }
 
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index d531879..908579f 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -54,7 +54,7 @@ static int ptrace_dump_regs(int pid)
 
 void wait_stub_done(int pid)
 {
-	int n, status, err, bad_stop = 0;
+	int n, status, err;
 
 	while (1) {
 		CATCH_EINTR(n = waitpid(pid, status, WUNTRACED | __WALL));
@@ -74,8 +74,6 @@ void wait_stub_done(int pid)
 
 	if (((1  WSTOPSIG(status))  STUB_DONE_MASK) != 0)
 		return;
-	else
-		bad_stop = 1;
 
 bad_wait:
 	err = ptrace_dump_regs(pid);
@@ -85,10 +83,7 @@ bad_wait:
 	printk(UM_KERN_ERR wait_stub_done : failed to wait for SIGTRAP, 
 	   pid = %d, n = %d, errno = %d, status = 0x%x\n, pid, n, errno,
 	   status);
-	if (bad_stop)
-		kill(pid, SIGKILL);
-	else
-		fatal_sigsegv();
+	fatal_sigsegv();
 }
 
 extern unsigned long current_stub_stack(void);
--
Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free.
http://p.sf.net/sfu/SauceLabs___
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] trinity commit 23dc478aba breaks syscall mremap at a 32 bit user mode linux

2014-05-02 Thread Richard Weinberger
On Fri, May 2, 2014 at 8:43 AM,  st...@nixia.no wrote:
 Yeah, this is because trinity destroys the UML stub code.
 Please test the attached patch, it should fix the root cause of the
 problem.

 @@ -124,6 +125,9 @@ static int add_munmap(unsigned long addr, unsigned
 long len,
 struct host_vm_op *last;
 int ret = 0;

 +   if ((addr = STUB_START)  (addr  STUB_END))
 +   return -EINVAL;
 +
 if (hvc-index != 0) {
 last = hvc-ops[hvc-index - 1];
 if ((last-type == MUNMAP) 

 I do not know how add_munmap is called, so this is more of a question.
 What happens in the use cases where the mmap spans multiple pages, and
 the stub is in the middle and other variations?

add_munmap() is only called on existing mappings.
UML ensures that we have always a mapping at STUB_START.
Doing a mremap() or munmap() i.e. on STUB_START - 4096 won't trigger
the add_munmap().

It is also not possible to create an overlapping map over the STUB.
update_pte_range() makes this impossible.

If you find a way to bypass this, please drop me a mail.
The UML TLB code is not trivial and also not written by me.
Maybe I've overlooked something. :-)

-- 
Thanks,
//richard

--
Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free.
http://p.sf.net/sfu/SauceLabs
___
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] trinity commit 23dc478aba breaks syscall mremap at a 32 bit user mode linux

2014-05-02 Thread Richard Weinberger
Am 02.05.2014 16:07, schrieb Toralf Förster:
 On 05/02/2014 09:46 AM, Richard Weinberger wrote:
 Am 01.05.2014 23:34, schrieb Toralf Förster:
 On 05/01/2014 10:57 PM, Richard Weinberger wrote:
 Toralf,

 Yeah, this is because trinity destroys the UML stub code.
 Please test the attached patch, it should fix the root cause of the 
 problem.

 Thanks,
 //richard


 If I do just apply fix2.patch onto latest git tree  v3.15-rc3-113-gba6728f 
 then I do get after a while :

  * Starting sshd ...
   [ ok ]
  * Starting local
 net.core.warnings = 0   
   [ ok ]
 Kernel panic - not syncing: do_syscall_stub : PTRACE_SETREGS failed, errno 
 = 3

 CPU: 0 PID: 1728 Comm: trinity-c0 Not tainted 
 3.15.0-rc3-00113-gba6728f-dirty #5
 Stack:
 BUG: soft lockup - CPU#0 stuck for 22s! [trinity-c0:1728]

 EIP: c500:[47c6cf00] CPU: 0 Not tainted EFLAGS: 476af700
 Not tainted
 EAX: 47cfc500 EBX: 0a024d00 ECX: 086c75fc EDX: 080fff88
 ESI: 0839f4bc EDI: 47cfc500 EBP: 0839f4bc DS: c500 ES: cd62
 EXT4-fs (ubda): error count: 1
 EXT4-fs (ubda): initial error at 1398962134: ext4_mb_generate_buddy:756
 EXT4-fs (ubda): last error at 1398962134: ext4_mb_generate_buddy:756


 which is a big improvement because before it crashes immediately after few 
 seconds.

 After applying both fixes the test case runs w/o a crash till now.

 Can you please also try fix3 (without fix1/2)?
 I think I've found the other hidden issue.
 So far trinity did not crash my kernel...

 Thanks,
 //richard

 
 fix3 made it - till now it runs fine.
 Of course the syslog of the UML guest is flooded with messages like :
 
 May  2 15:45:59 trinity kernel: BUG: Bad rss-counter state mm:47d4d8c0 idx:0 
 val:2
 May  2 15:46:00 trinity kernel: fix_range_common: failed, killing current 
 process: 2983
 May  2 15:46:00 trinity kernel: fix_range_common: failed, killing current 
 process: 2984
 May  2 15:46:30 trinity kernel: fix_range_common: failed, killing current 
 process: 2986
 May  2 15:46:30 trinity kernel: fix_range_common: failed, killing current 
 process: 2989
 May  2 15:46:30 trinity kernel: fix_range_common: failed, killing current 
 process: 2991
 May  2 15:46:32 trinity kernel: Stub registers -
 May  2 15:46:32 trinity kernel: 0 - 10
 May  2 15:46:32 trinity kernel: 1 - 1000
 May  2 15:46:32 trinity kernel: 2 - 7
 May  2 15:46:32 trinity kernel: 3 - 11
 May  2 15:46:32 trinity kernel: 4 - 3
 May  2 15:46:32 trinity kernel: 5 - 3cbae
 May  2 15:46:32 trinity kernel: 6 - 10
 May  2 15:46:32 trinity kernel: 7 - 7b
 May  2 15:46:32 trinity kernel: 8 - 7b
 May  2 15:46:32 trinity kernel: 9 - 0
 May  2 15:46:32 trinity kernel: 10 - 33
 May  2 15:46:32 trinity kernel: 11 - 
 May  2 15:46:32 trinity kernel: 12 - 100fff
 May  2 15:46:32 trinity kernel: 13 - 73
 May  2 15:46:32 trinity kernel: 14 - 10206
 May  2 15:46:32 trinity kernel: 15 - 101028
 May  2 15:46:32 trinity kernel: 16 - 7b
 May  2 15:46:32 trinity kernel: wait_stub_done : failed to wait for SIGTRAP, 
 pid = 483, n = 483, errno = 0, status = 0xb7f
 May  2 15:46:32 trinity kernel: BUG: Bad rss-counter state mm:47d4d8c0 idx:0 
 val:1
 May  2 15:46:32 trinity kernel: fix_range_common: failed, killing current 
 process: 3000
 May  2 15:46:33 trinity kernel: fix_range_common: failed, killing current 
 process: 3002
 May  2 15:46:33 trinity kernel: fix_range_common: failed, killing current 
 process: 3004
 May  2 15:46:33 trinity kernel: fix_range_common: failed, killing current 
 process: 3006
 May  2 15:46:34 trinity kernel: fix_range_common: failed, killing current 
 process: 3009
 May  2 15:46:34 trinity kernel: fix_range_common: failed, killing current 
 process: 3010
 May  2 15:46:34 trinity kernel: fix_range_common: failed, killing current 
 process: 3012
 May  2 15:46:35 trinity kernel: BUG: Bad rss-counter state mm:47d4d8c0 idx:0 
 val:2
 May  2 15:46:35 trinity kernel: fix_range_common: failed, killing current 
 process: 3015
 
 
 
 which is expected (right ?) b/c I hammered the UML with the syscall mremap 
 by 2 trinity childs for a while.

Yeah. Maybe I find a way to prevent BUG: Bad rss-counter state mm:47d4d8c0 
idx:0 val:1 too.

Thanks for testing!
//richard

--
Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free.
http://p.sf.net/sfu/SauceLabs
___
User-mode-linux-devel mailing list
User-mode-linux-devel

Re: [uml-devel] trinity commit 23dc478aba breaks syscall mremap at a 32 bit user mode linux

2014-05-01 Thread Richard Weinberger
On Wed, Apr 30, 2014 at 8:19 PM, Toralf Förster toralf.foers...@gmx.de wrote:
 -or- it uncovers a bug in kernel v3.15-rc3 for UML:

UML most not panic. :)

Do you have the trinity logs?
I'd like to know the syscalls parameters.

It looks like trinity managed it to crash a thread on the host side.
This is why ptrace() failed with ESRCH.



 commit 23dc478aba4134db51584d19e4783ec87ce87b88
 Author: Dave Jones da...@redhat.com
 Date:   Tue Apr 29 16:42:45 2014 -0400

 non-biarch arches aren't necessarily 32-bit.

 diff --git a/children/random-syscalls.c b/children/random-syscalls.c
 index 82e49f5..1d7e7ce 100644
 --- a/children/random-syscalls.c
 +++ b/children/random-syscalls.c
 @@ -32,7 +32,6 @@ static bool choose_syscall_table(void)

 if (biarch == FALSE) {
 active_syscalls = shm-active_syscalls;
 -   do32 = TRUE;
 } else {

 /* First, check that we have syscalls enabled in either 
 table. */




 I do get :


 Kernel panic - not syncing: do_syscall_stub : PTRACE_SETREGS failed, errno = 3

 CPU: 0 PID: 1303 Comm: trinity-c0 Not tainted 3.15.0-rc3 #1
 Stack:
  085a4f54 085a4f54 4841fc48 0004 086c8547 2b58 0003 0011
  4841fc58 084eae75   4841fc80 084e72e0 085b08e8 08700960
  085ad7b4 4841fc90  2b58 0003 0011 4841fcb4 080734c5
 Call Trace:
  [080734c5] ? run_syscall_stub+0x125/0x2c0
  [084eae75] dump_stack+0x26/0x28
  [084e72e0] panic+0x7a/0x194
  [080734c5] run_syscall_stub+0x125/0x2c0
  [08073b15] unmap+0xf5/0x110
  [08061047] do_ops+0xb7/0x160
  [080615f8] fix_range_common+0x448/0x480
  [080e50f4] ? vma_interval_tree_insert+0x74/0x80
  [0806193e] flush_tlb_range+0x3e/0x40
  [080f045e] move_page_tables+0x24e/0x280
  [080f0577] move_vma+0xe7/0x230
  [080eda20] ? get_unmapped_area+0xa0/0xc0
  [080f08b8] SyS_mremap+0x1f8/0x4c0
  [08062ab4] handle_syscall+0x64/0x80
  [0849d4f1] ? ptrace+0x31/0x80
  [080797a2] ? get_fp_registers+0x22/0x40
  [08074815] userspace+0x475/0x5f0
  [0849d4f1] ? ptrace+0x31/0x80
  [08079d06] ? os_set_thread_area+0x26/0x40
  [08078cd0] ? do_set_thread_area+0x20/0x50
  [08078e48] ? arch_switch_tls+0xb8/0x100
  [0805f770] fork_handler+0x60/0x70

 /home/tfoerste/workspace/bin/start_uml.sh: line 110:  9558 Aborted
  (core dumped) $LINUX earlyprintk ubda=$ROOTFS ubdb=$SWAP eth0=$NET 
 mem=$MEM $TTY umid=uml_$NAME rootfstype=ext4 $ARGS


 --
 Toralf


 --
 Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
 Instantly run your Selenium tests across 300+ browser/OS combos.  Get
 unparalleled scalability from the best Selenium testing platform available.
 Simple to use. Nothing to install. Get started now for free.
 http://p.sf.net/sfu/SauceLabs
 ___
 User-mode-linux-devel mailing list
 User-mode-linux-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel



-- 
Thanks,
//richard

--
Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free.
http://p.sf.net/sfu/SauceLabs
___
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] trinity commit 23dc478aba breaks syscall mremap at a 32 bit user mode linux

2014-05-01 Thread Richard Weinberger
Am 01.05.2014 12:29, schrieb Toralf Förster:
 On 05/01/2014 11:22 AM, Richard Weinberger wrote:
 On Wed, Apr 30, 2014 at 8:19 PM, Toralf Förster toralf.foers...@gmx.de 
 wrote:
 -or- it uncovers a bug in kernel v3.15-rc3 for UML:

 UML most not panic. :)

 Do you have the trinity logs?
 I'd like to know the syscalls parameters.
 I run trinity with -C 2 -c mremap within the guest, the logs are attached

Can you please try the attached pre-patch?
It looks like the panic() in that code is an overreaction.
I'm currently looking deeper in the issue.

BTW: If you hit BUG: failure at mm/filemap.c:202/__delete_from_page_cache()!,
this is a known issue https://lkml.org/lkml/2014/4/15/577

Thanks,
//richard
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c
index 689b18d..2ce5d49 100644
--- a/arch/um/os-Linux/skas/mem.c
+++ b/arch/um/os-Linux/skas/mem.c
@@ -65,14 +65,17 @@ static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr)
 		printk(UM_KERN_ERR Registers - \n);
 		for (i = 0; i  MAX_REG_NR; i++)
 			printk(UM_KERN_ERR \t%d\t0x%lx\n, i, syscall_regs[i]);
-		panic(do_syscall_stub : PTRACE_SETREGS failed, errno = %d\n,
-		  -n);
+		printk(KERN_ERR do_syscall_stub : PTRACE_SETREGS failed, pid = %d, errno = %d\n,
+		  pid, -n);
+		return -EFAULT;
 	}
 
 	err = ptrace(PTRACE_CONT, pid, 0, 0);
-	if (err)
-		panic(Failed to continue stub, pid = %d, errno = %d\n, pid,
+	if (err) {
+		printk(KERN_ERR Failed to continue stub, pid = %d, errno = %d\n, pid,
 		  errno);
+		return -EFAULT;
+	}
 
 	wait_stub_done(pid);
 
--
Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free.
http://p.sf.net/sfu/SauceLabs___
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] trinity commit 23dc478aba breaks syscall mremap at a 32 bit user mode linux

2014-05-01 Thread Richard Weinberger
Toralf,

Am 01.05.2014 17:15, schrieb Toralf Förster:
 On 05/01/2014 02:33 PM, Richard Weinberger wrote:
 Am 01.05.2014 12:29, schrieb Toralf Förster:
 On 05/01/2014 11:22 AM, Richard Weinberger wrote:
 On Wed, Apr 30, 2014 at 8:19 PM, Toralf Förster toralf.foers...@gmx.de 
 wrote:
 -or- it uncovers a bug in kernel v3.15-rc3 for UML:

 UML most not panic. :)

 Do you have the trinity logs?
 I'd like to know the syscalls parameters.
 I run trinity with -C 2 -c mremap within the guest, the logs are attached

 Can you please try the attached pre-patch?
 It looks like the panic() in that code is an overreaction.
 I'm currently looking deeper in the issue.

 BTW: If you hit BUG: failure at 
 mm/filemap.c:202/__delete_from_page_cache()!,
 this is a known issue https://lkml.org/lkml/2014/4/15/577

 Thanks,
 //richard

 
 That patch helps a lot, in the syslog I do now get :
 
 May  1 17:13:48 trinity kernel: Stub registers -
 May  1 17:13:48 trinity kernel: 0 - 10
 May  1 17:13:48 trinity kernel: 1 - 2000
 May  1 17:13:48 trinity kernel: 2 - 0
 May  1 17:13:48 trinity kernel: 3 - 0
 May  1 17:13:48 trinity kernel: 4 - 0
 May  1 17:13:48 trinity kernel: 5 - 0
 May  1 17:13:48 trinity kernel: 6 - 0
 May  1 17:13:48 trinity kernel: 7 - 7b
 May  1 17:13:48 trinity kernel: 8 - 7b
 May  1 17:13:48 trinity kernel: 9 - 0
 May  1 17:13:48 trinity kernel: 10 - 33
 May  1 17:13:48 trinity kernel: 11 - 
 May  1 17:13:48 trinity kernel: 12 - 1000c3
 May  1 17:13:48 trinity kernel: 13 - 73
 May  1 17:13:48 trinity kernel: 14 - 10206
 May  1 17:13:48 trinity kernel: 15 - 101028
 May  1 17:13:48 trinity kernel: 16 - 7b
 May  1 17:13:48 trinity kernel: wait_stub_done : failed to wait for SIGTRAP, 
 pid = 14757, n = 14757, errno = 0, status = 0xb7f
 May  1 17:13:48 trinity kernel: do_syscall_stub : ret = 0, offset = 1052680, 
 data = 47788008
 May  1 17:13:48 trinity kernel: do_syscall_stub: syscall 91 failed, return 
 value = 0x0, expected return value = 0x0
 May  1 17:13:48 trinity kernel: syscall parameters: 0x10 0x2000 0x0 0x0 
 0x0 0x0
 May  1 17:13:48 trinity kernel: Registers - 
 May  1 17:13:48 trinity kernel: 0   0x2c92
 May  1 17:13:48 trinity kernel: 1   0x13
 May  1 17:13:48 trinity kernel: 2   0x2c92
 May  1 17:13:48 trinity kernel: 3   0x2c8e
 May  1 17:13:48 trinity kernel: 4   0xbfa39508
 May  1 17:13:48 trinity kernel: 5   0xbfa394ec
 May  1 17:13:48 trinity kernel: 6   0x0
 May  1 17:13:48 trinity kernel: 7   0x7b
 May  1 17:13:48 trinity kernel: 8   0x7b
 May  1 17:13:48 trinity kernel: 9   0x0
 May  1 17:13:48 trinity kernel: 10  0x33
 May  1 17:13:48 trinity kernel: 11  0x25
 May  1 17:13:48 trinity kernel: 12  0x1000a0
 May  1 17:13:48 trinity kernel: 13  0x73
 May  1 17:13:48 trinity kernel: 14  0x246
 May  1 17:13:48 trinity kernel: 15  0xbfa394b8
 May  1 17:13:48 trinity kernel: 16  0x7b
 May  1 17:13:48 trinity kernel: do_syscall_stub : PTRACE_SETREGS failed, pid 
 = 14757, errno = 3
 May  1 17:13:48 trinity kernel: fix_range_common: failed, killing current 
 process
 May  1 17:13:48 trinity kernel: BUG: Bad rss-counter state mm:475aab40 idx:0 
 val:1
 May  1 17:13:48 trinity kernel: Stub registers -
 May  1 17:13:48 trinity kernel: 0 - 10
 May  1 17:13:48 trinity kernel: 1 - 2000
 May  1 17:13:48 trinity kernel: 2 - 0
 May  1 17:13:48 trinity kernel: 3 - 0
 May  1 17:13:48 trinity kernel: 4 - 0
 May  1 17:13:48 trinity kernel: 5 - 0
 May  1 17:13:48 trinity kernel: 6 - 0
 May  1 17:13:48 trinity kernel: 7 - 7b
 May  1 17:13:48 trinity kernel: 8 - 7b
 May  1 17:13:48 trinity kernel: 9 - 0
 May  1 17:13:48 trinity kernel: 10 - 33
 May  1 17:13:48 trinity kernel: 11 - 
 May  1 17:13:48 trinity kernel: 12 - 1000c3
 May  1 17:13:48 trinity kernel: 13 - 73
 May  1 17:13:48 trinity kernel: 14 - 10206
 May  1 17:13:48 trinity kernel: 15 - 101028
 May  1 17:13:48 trinity kernel: 16 - 7b
 May  1 17:13:48 trinity kernel: wait_stub_done : failed to wait for SIGTRAP, 
 pid = 14758, n = 14758, errno = 0, status = 0xb7f
 May  1 17:13:48 trinity kernel: do_syscall_stub : ret = 0, offset = 1052680, 
 data = 477a9008
 May  1 17:13:48 trinity kernel: do_syscall_stub: syscall 91 failed, return 
 value = 0x0, expected return value = 0x0
 May  1 17:13:48 trinity kernel: syscall parameters: 0x10 0x2000 0x0 0x0 
 0x0 0x0

Yeah, this is because trinity destroys the UML stub code.
Please test the attached patch, it should fix the root cause of the problem.

Thanks,
//richard
diff --git a/arch/um/kernel/tlb.c b/arch/um/kernel/tlb.c

[uml-devel] [GIT PULL] UML fixes

2014-04-20 Thread Richard Weinberger
Linus,

The following changes since commit a798c10faf62a505d24e5f6213fbaf904a39623f:

  Linux 3.15-rc2 (2014-04-20 11:08:50 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml.git for-linus

for you to fetch changes up to a8c60be4f1bb3a4eead20e3fa19ce645f818014a:

  um: Memory corruption on startup (2014-04-20 23:13:36 +0200)


Assorted fixes for UML.

Anton Ivanov (2):
  um: Missing pipe handling
  um: Memory corruption on startup

Tristan Schmelcher (1):
  uml: Simplify tempdir logic.

 arch/um/include/shared/os.h |   1 +
 arch/um/kernel/physmem.c|   1 +
 arch/um/os-Linux/file.c |   6 +
 arch/um/os-Linux/main.c |   1 +
 arch/um/os-Linux/mem.c  | 372 +---
 5 files changed, 84 insertions(+), 297 deletions(-)

Thanks,
//richard

--
Learn Graph Databases - Download FREE O'Reilly Book
Graph Databases is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
___
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 3/3] BUG: Inapprorpiate choice of IPC

2014-04-20 Thread Richard Weinberger
Am 07.03.2014 19:37, schrieb anton.iva...@kot-begemot.co.uk:
 From: Anton Ivanov antiv...@cisco.com
 
 PIPE is the wrong IPC for this type of inter-thread communication.
 
 For more details see:
 
 http://stackoverflow.com/questions/4624071/pipe-buffer-size-is-4k-or-64k
 
 The observations on that thread have been confirmed by us for UML's
 UBD driver. If you load UML with network IO and do disk IO at the same
 time the UBD IO helper thread fails to process requests fast enough.
 
 In most cases this will lead to a slowdown in disk IO as well as
 inability to execute new processes until the network load goes away.
 In some cases however it will not recover. Example - with our new high
 performance 1G+ network drivers a wget of 1G file from the network
 is a nearly guaranteed crash if it writes out to UBD.
 
 The crashes and the slowdowns are not observed with this patch -
 it switches the IPC to socket which does not have the pipe granularity
 and queue size problems.
 
 This signifies a problem with overall UBD error handling which this
 patch fails to fix. The workaround should be good enough for most
 cases.
 
 Signed-off-by: Anton Ivanov antiv...@cisco.com
 ---
  arch/um/drivers/ubd_kern.c |2 +-
  arch/um/drivers/ubd_user.c |2 +-
  arch/um/os-Linux/file.c|2 +-
  3 files changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
 index 944453a..c9a5717 100644
 --- a/arch/um/drivers/ubd_kern.c
 +++ b/arch/um/drivers/ubd_kern.c
 @@ -1291,7 +1291,7 @@ static void do_ubd_request(struct request_queue *q)
   n = os_write_file(thread_fd, io_req,
 sizeof(struct io_thread_req *));
   if(n != sizeof(struct io_thread_req *)){
 - if(n != -EAGAIN)
 + if(!((n == -EAGAIN) || (n == -ENOBUFS)))
   printk(write to io thread failed, 
  errno = %d\n, -n);
   else if(list_empty(dev-restart))
 diff --git a/arch/um/drivers/ubd_user.c b/arch/um/drivers/ubd_user.c
 index 007b94d..f1f84a4 100644
 --- a/arch/um/drivers/ubd_user.c
 +++ b/arch/um/drivers/ubd_user.c
 @@ -32,7 +32,7 @@ int start_io_thread(unsigned long sp, int *fd_out)
  {
   int pid, fds[2], err;
  
 - err = os_pipe(fds, 1, 1);
 + err = socketpair(AF_UNIX, SOCK_STREAM, 0, (int *) fds);
   if(err  0){
   printk(start_io_thread - os_pipe failed, err = %d\n, -err);
   goto out;
 diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c
 index c879b12..a4f0e65 100644
 --- a/arch/um/os-Linux/file.c
 +++ b/arch/um/os-Linux/file.c
 @@ -240,7 +240,7 @@ void os_close_file(int fd)
  int os_fsync_file(int fd)
  {
   if (fsync(fd)  0) 
 - return -errno
 + return -errno;
   return 0;
  }

FYI, I did not send this patch to Linus because it does not apply.
Please fix this. :-)

Thanks,
//richard

--
Learn Graph Databases - Download FREE O'Reilly Book
Graph Databases is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
___
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 3/3] BUG: Inapprorpiate choice of IPC

2014-03-08 Thread Richard Weinberger


Am 07.03.2014 19:37, schrieb anton.iva...@kot-begemot.co.uk:
 From: Anton Ivanov antiv...@cisco.com
 
 PIPE is the wrong IPC for this type of inter-thread communication.
 
 For more details see:
 
 http://stackoverflow.com/questions/4624071/pipe-buffer-size-is-4k-or-64k
 
 The observations on that thread have been confirmed by us for UML's
 UBD driver. If you load UML with network IO and do disk IO at the same
 time the UBD IO helper thread fails to process requests fast enough.
 
 In most cases this will lead to a slowdown in disk IO as well as
 inability to execute new processes until the network load goes away.
 In some cases however it will not recover. Example - with our new high
 performance 1G+ network drivers a wget of 1G file from the network
 is a nearly guaranteed crash if it writes out to UBD.
 
 The crashes and the slowdowns are not observed with this patch -
 it switches the IPC to socket which does not have the pipe granularity
 and queue size problems.
 
 This signifies a problem with overall UBD error handling which this
 patch fails to fix. The workaround should be good enough for most
 cases.
 
 Signed-off-by: Anton Ivanov antiv...@cisco.com
 ---
  arch/um/drivers/ubd_kern.c |2 +-
  arch/um/drivers/ubd_user.c |2 +-
  arch/um/os-Linux/file.c|2 +-
  3 files changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
 index 944453a..c9a5717 100644
 --- a/arch/um/drivers/ubd_kern.c
 +++ b/arch/um/drivers/ubd_kern.c
 @@ -1291,7 +1291,7 @@ static void do_ubd_request(struct request_queue *q)
   n = os_write_file(thread_fd, io_req,
 sizeof(struct io_thread_req *));
   if(n != sizeof(struct io_thread_req *)){
 - if(n != -EAGAIN)
 + if(!((n == -EAGAIN) || (n == -ENOBUFS)))
   printk(write to io thread failed, 
  errno = %d\n, -n);
   else if(list_empty(dev-restart))
 diff --git a/arch/um/drivers/ubd_user.c b/arch/um/drivers/ubd_user.c
 index 007b94d..f1f84a4 100644
 --- a/arch/um/drivers/ubd_user.c
 +++ b/arch/um/drivers/ubd_user.c
 @@ -32,7 +32,7 @@ int start_io_thread(unsigned long sp, int *fd_out)
  {
   int pid, fds[2], err;
  
 - err = os_pipe(fds, 1, 1);
 + err = socketpair(AF_UNIX, SOCK_STREAM, 0, (int *) fds);
   if(err  0){
   printk(start_io_thread - os_pipe failed, err = %d\n, -err);
   goto out;
 diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c
 index c879b12..a4f0e65 100644
 --- a/arch/um/os-Linux/file.c
 +++ b/arch/um/os-Linux/file.c
 @@ -240,7 +240,7 @@ void os_close_file(int fd)
  int os_fsync_file(int fd)
  {
   if (fsync(fd)  0) 
 - return -errno
 + return -errno;

Huh?
I think this does not belong to the patch.

The other drivers look good. Thanks a lot for pushing this work upstream!
We are already at -rc5. I'll send the patches to Linus within the next merge 
window
and mark them for stable.

Thanks,
//richard

--
Subversion Kills Productivity. Get off Subversion  Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951iu=/4140/ostg.clktrk
___
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] [info] syscall mremap can't be tested at a UML w/ fuzzy tool trinity

2014-03-01 Thread Richard Weinberger
On Sat, Mar 1, 2014 at 10:28 AM, Toralf Förster toralf.foers...@gmx.de wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256

 Today I tested if I can activate that syscall again here (munmap works fine 
 since few days).
 Testing a 32 bit user mode linux image with $trinity -q -N 10 -C 8 
 gave in the syslog of the UML guest:

 Mar  1 10:09:18 trinity kernel: Stub registers -
 Mar  1 10:09:18 trinity kernel: 0 - 10

Looks like the stub page. You cannot remap it.
If you do so the calling process will die.

 Mar  1 10:09:18 trinity kernel: 1 - 2000
 Mar  1 10:09:18 trinity kernel: 2 - 0
 Mar  1 10:09:18 trinity kernel: 3 - 0
 Mar  1 10:09:18 trinity kernel: 4 - 0
 Mar  1 10:09:18 trinity kernel: 5 - 0
 Mar  1 10:09:18 trinity kernel: 6 - 0
 Mar  1 10:09:18 trinity kernel: 7 - 7b
 Mar  1 10:09:18 trinity kernel: 8 - 7b
 Mar  1 10:09:18 trinity kernel: 9 - 0
 Mar  1 10:09:18 trinity kernel: 10 - 33
 Mar  1 10:09:18 trinity kernel: 11 - 
 Mar  1 10:09:18 trinity kernel: 12 - 1000c3
 Mar  1 10:09:18 trinity kernel: 13 - 73
 Mar  1 10:09:18 trinity kernel: 14 - 10206
 Mar  1 10:09:18 trinity kernel: 15 - 101028
 Mar  1 10:09:18 trinity kernel: 16 - 7b
 Mar  1 10:09:18 trinity kernel: wait_stub_done : failed to wait for SIGTRAP, 
 pid = 6662, n = 6662, errno = 0, status = 0xb7f
 Mar  1 10:09:18 trinity kernel: do_syscall_stub : ret = 0, offset = 1052680, 
 data = 477be008
 Mar  1 10:09:18 trinity kernel: do_syscall_stub: syscall 91 failed, return 
 value = 0x0, expected return value = 0x0
 Mar  1 10:09:18 trinity kernel: syscall parameters: 0x10 0x2000 0x0 0x0 
 0x0 0x0


 and a back trace of the core file of the crashed UML guest process tells:


 $ gdb --core=/mnt/ramdisk/core /home/tfoerste/devel/linux/linux -n -batch -ex 
 'bt'
 [New LWP 4841]

 warning: Could not load shared library symbols for linux-gate.so.1.
 Do you need set solib-search-path or set sysroot?
 Core was generated by `/home/tfoerste/devel/linux/linux earlyprintk 
 ubda=/home/tfoerste/virtual/uml/tr'.
 Program terminated with signal 6, Aborted.
 #0  0xb77c5424 in __kernel_vsyscall ()
 #0  0xb77c5424 in __kernel_vsyscall ()
 #1  0x08481b55 in kill ()
 #2  0x08072acd in uml_abort () at arch/um/os-Linux/util.c:93
 #3  0x08072e05 in os_dump_core () at arch/um/os-Linux/util.c:148
 #4  0x080624fd in panic_exit (self=0x86c1598 panic_exit_notifier, 
 unused1=0, unused2=0x86f89a0 buf.16970) at arch/um/kernel/um_arch.c:240
 #5  0x0809a2e6 in notifier_call_chain (nl=0x0, val=0, v=0x86f89a0 
 buf.16970, nr_to_call=-2, nr_calls=0x0) at kernel/notifier.c:93
 #6  0x0809a401 in __atomic_notifier_call_chain (nh=0x86f8984 
 panic_notifier_list, val=0, v=0x86f89a0 buf.16970, nr_to_call=0, 
 nr_calls=0x0) at kernel/notifier.c:182
 #7  0x0809a43f in atomic_notifier_call_chain (nh=0x0, val=0, v=0x0) at 
 kernel/notifier.c:191
 #8  0x084de7fc in panic (fmt=0x0) at kernel/panic.c:130
 #9  0x080735b5 in do_syscall_stub (addr=optimized out, mm_idp=optimized 
 out) at arch/um/os-Linux/skas/mem.c:68
 #10 run_syscall_stub (mm_idp=0x4755d364, syscall=6, args=0x4490fb60, 
 expected=1150352224, addr=0x4490fda4, done=1) at 
 arch/um/os-Linux/skas/mem.c:142
 #11 0x08073c05 in unmap (mm_idp=0x0, addr=1079300096, len=4096, 
 done=1150352224, data=0x4490fb60) at arch/um/os-Linux/skas/mem.c:244
 #12 0x08061047 in do_ops (hvc=0x4490fd80, end=1, finished=1) at 
 arch/um/kernel/tlb.c:67
 #13 0x080615f8 in fix_range_common (mm=0x0, start_addr=1150352224, 
 end_addr=1079840768, force=0) at arch/um/kernel/tlb.c:281
 #14 0x0806193e in fix_range (force=optimized out, end_addr=optimized out, 
 start_addr=optimized out, mm=optimized out) at arch/um/kernel/tlb.c:493
 #15 flush_tlb_range (vma=0x0, start=1078792192, end=1079840768) at 
 arch/um/kernel/tlb.c:501
 #16 0x080ef1ae in move_page_tables (vma=0x47839d48, old_addr=1078792192, 
 new_vma=0x44856cc0, new_addr=2097152, len=1048576, need_rmap_locks=false) at 
 mm/mremap.c:222
 #17 0x080ef2c7 in move_vma (vma=0x47839d48, old_addr=1150352224, old_len=6, 
 new_len=1048576, new_addr=1048576, locked=0x0) at mm/mremap.c:269
 #18 0x080ef608 in mremap_to (locked=optimized out, new_len=optimized out, 
 new_addr=optimized out, old_len=optimized out, addr=optimized out) at 
 mm/mremap.c:438
 #19 SYSC_mremap (new_addr=optimized out, flags=optimized out, 
 new_len=optimized out, old_len=optimized out, addr=optimized out) at 
 mm/mremap.c:501
 #20 SyS_mremap (addr=1078792192, old_len=1048576, new_len=1048576, flags=3, 
 new_addr=1048576) at mm/mremap.c:470
 #21 0x08062ab4 in handle_syscall (r=0x477df0c8) at 
 arch/um/kernel/skas/syscall.c:35
 #22 0x08074905 in handle_trap (local_using_sysemu=optimized out, 
 regs=optimized out, pid=optimized out) at 
 arch/um/os-Linux/skas/process.c:198
 #23 userspace (regs=0x477df0c8) at arch/um/os-Linux/skas/process.c:431
 #24 0x0805f770 in fork_handler () at 

Re: [uml-devel] Contribution - Bug fixes and contributions to UML

2014-02-28 Thread Richard Weinberger
Am 28.02.2014 09:27, schrieb Anton Ivanov (antivano):
 Hi Richard, Hi Jeff, hi list,
 
 On behalf of Cisco systems, I am authorized to make a offer a set bug
 fixes as well as contribute several additional features and performance
 improvements to UML. All of these have been used internally for a couple
 of years and will ship as parts of product(s) in the near future. Some
 of these improve performance by up to 8 times on use cases which are of
 interest to us and are likely to be of interest to the community.
 
 As the full patchset is now in the 100k+ zone, so I am going to do only
 the announcement now and submit the patches one by one after that over
 the next 1-2 weeks.
 
 We will submit separately bug fixes for:
 
 1. Critical memory corruption on startup observed on heavily loaded
 machines (especially when multiple UMLs run simultaneously).
 2. Fix(es) for incorrect handling of error conditions when UML is run
 under expect and conX=fd: is used to communicate with another process.
 The same error may be observed on internal UML IPCs too leading to
 immediate crash.
 
 I will also file bugs for both vs Debian UML package so that patches for
 both can go in ASAP.
 
 In addition to the bug fixes, the new features include:
 
 1. Several transports. All can do up to multi-gigabit throughput on some
 scenarios. We are contributing their counterparts to qemu/kvm as well.
 
 1.1. Direct connection of UML to overlay networks/L2 VPNs using L2TPv3.
 
 This has a number of advantages compared to the existing UML multicast
 and qemu socket transports.
 
 * Standard compliant - RFC 3931 updated recently by RFC 5641
 * Supported on most network equipment
 * Allowing to move virtual switching off-host to an NPU or high
 performance physical switch
 * Allowing to mix virtual and physical switching (well supported on
 modern Linuxes and other OSes)
 * Well researched security profile as well as established
 interactions with IPSEC allowing to extend virtual networks outside the
 datacenter to remote physical devices and/or VMs.
 
 1.2. Raw transport which allows both bi-directional communication with
 any network device which looks like Ethernet as well as in-span
 listening at speeds in the multi-gigabit range.
 
 1.3. We intend to contribute other key overlay transports like GRE, etc
 as well. The ones we are contributing at this point are the ones which
 we have used most extensively and have had the most testing (~ 1.5-2 years).
 
 2. New high res timer subsystem
 
 Adding these new network transports to UML revealed a key issue - it
 cannot meter or shape any traffic correctly as its internal timer system
 is way off. Personally, I consider it a bug, however there is no easy
 fix here. The only way to fix it is a new timer driver. Unfortunately,
 it does not fix uml userspace - timers there remain off. It does fix all
 kernel timer functionality - traffic shaping (both qdisc and iptables
 traffic limits).
 
 As a side effect, this provides performance improvements for tcp and
 other protocols which rely on kernel high res timers for their state
 machines.
 
 We have further scalability contributions lined up which improve network
 and IO performance between 1.5 and 8 times (depending on use case),
 allow hundreds of virtual interfaces per UML without performance
 penalties, allow to run several hundreds (if not thousands) of UMLs per
 machine, etc. All in all, it can no go where no virtualization and no
 virtual networking has gone before.
 
 However, I would prefer to take it one step at a time and get through
 these first (even these are quite a lot for one sitting).

Sounds awesome!

Please send the patches as soon as possible.
I'm eager to test and merge them.

Thanks,
//richard

--
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis  security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071iu=/4140/ostg.clktrk
___
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] sysreq t back traces stopped working please help

2014-02-27 Thread Richard Weinberger


Am 27.02.2014 20:05, schrieb Boaz Harrosh:
 Hi Richard, uml hackers
 
 Since some time my echo t  /proc/sysrq-trigger stopped producing the 
 proper global back-traces for all Kernel threads.
 All I get is:

I have an idea, do you see this regression starting with v3.12?

Thanks,
//richard

--
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis  security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071iu=/4140/ostg.clktrk
___
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] uml: Simplify tempdir logic.

2014-01-26 Thread Richard Weinberger
On Sun, Nov 17, 2013 at 1:57 PM, Richard Weinberger rich...@nod.at wrote:
 Am 11.11.2013 19:03, schrieb Tristan Schmelcher:
 From: Tristan Schmelcher tschmelc...@google.com

 Inferring the mount hierarchy correctly from /proc/mounts is hard when 
 MS_MOVE
 may have been used, and the previous code did it wrongly. This change 
 simplifies
 the logic to only require that /dev/shm be _on_ tmpfs (which can be checked
 trivially with statfs) rather than that it be a _mountpoint_ of tmpfs, since
 there isn't a compelling reason to be that strict. We also now check for 
 tmpfs
 on whatever directory we ultimately use so that the user is better informed.

 This change also moves the more standard TMPDIR environment variable check 
 ahead
 of the others.

 Applies to 3.12.

 Signed-off-by: Tristan Schmelcher tschmelc...@google.com

 I like what I see but so far I didn't had to time to review your changes 
 carefully.
 Stay tuned. :)

Shame on me, I've completely forgotten this patch.
I'll put it into -next such that we can merge it with v3.15.

Sorry for the delay.

 Thanks,
 //richard

 ---
  arch/um/os-Linux/mem.c | 372 
 ++---
  1 file changed, 75 insertions(+), 297 deletions(-)

 diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c
 index 3c4af77..897e9ad 100644
 --- a/arch/um/os-Linux/mem.c
 +++ b/arch/um/os-Linux/mem.c
 @@ -12,337 +12,117 @@
  #include string.h
  #include sys/stat.h
  #include sys/mman.h
 -#include sys/param.h
 +#include sys/vfs.h
 +#include linux/magic.h
  #include init.h
  #include os.h

 -/* Modified by which_tmpdir, which is called during early boot */
 -static char *default_tmpdir = /tmp;
 -
 -/*
 - *  Modified when creating the physical memory file and when checking
 - * the tmp filesystem for usability, both happening during early boot.
 - */
 +/* Set by make_tempfile() during early boot. */
  static char *tempdir = NULL;

 -static void __init find_tempdir(void)
 +/* Check if dir is on tmpfs. Return 0 if yes, -1 if no or error. */
 +static int __init check_tmpfs(const char *dir)
  {
 - const char *dirs[] = { TMP, TEMP, TMPDIR, NULL };
 - int i;
 - char *dir = NULL;
 -
 - if (tempdir != NULL)
 - /* We've already been called */
 - return;
 - for (i = 0; dirs[i]; i++) {
 - dir = getenv(dirs[i]);
 - if ((dir != NULL)  (*dir != '\0'))
 - break;
 - }
 - if ((dir == NULL) || (*dir == '\0'))
 - dir = default_tmpdir;
 + struct statfs st;

 - tempdir = malloc(strlen(dir) + 2);
 - if (tempdir == NULL) {
 - fprintf(stderr, Failed to malloc tempdir, 
 - errno = %d\n, errno);
 - return;
 - }
 - strcpy(tempdir, dir);
 - strcat(tempdir, /);
 -}
 -
 -/*
 - * Remove bytes from the front of the buffer and refill it so that if 
 there's a
 - * partial string that we care about, it will be completed, and we can 
 recognize
 - * it.
 - */
 -static int pop(int fd, char *buf, size_t size, size_t npop)
 -{
 - ssize_t n;
 - size_t len = strlen(buf[npop]);
 -
 - memmove(buf, buf[npop], len + 1);
 - n = read(fd, buf[len], size - len - 1);
 - if (n  0)
 - return -errno;
 -
 - buf[len + n] = '\0';
 - return 1;
 -}
 -
 -/*
 - * This will return 1, with the first character in buf being the
 - * character following the next instance of c in the file.  This will
 - * read the file as needed.  If there's an error, -errno is returned;
 - * if the end of the file is reached, 0 is returned.
 - */
 -static int next(int fd, char *buf, size_t size, char c)
 -{
 - ssize_t n;
 - char *ptr;
 -
 - while ((ptr = strchr(buf, c)) == NULL) {
 - n = read(fd, buf, size - 1);
 - if (n == 0)
 - return 0;
 - else if (n  0)
 - return -errno;
 -
 - buf[n] = '\0';
 + printf(Checking if %s is on tmpfs..., dir);
 + if (statfs(dir, st)  0) {
 + printf(%s\n, strerror(errno));
 + } else if (st.f_type != TMPFS_MAGIC) {
 + printf(no\n);
 + } else {
 + printf(OK\n);
 + return 0;
   }
 -
 - return pop(fd, buf, size, ptr - buf + 1);
 + return -1;
  }

  /*
 - * Decode an octal-escaped and space-terminated path of the form used by
 - * /proc/mounts. May be used to decode a path in-place. out must be at 
 least
 - * as large as the input. The output is always null-terminated. len gets 
 the
 - * length of the output, excluding the trailing null. Returns 0 if a full 
 path
 - * was successfully decoded, otherwise an error.
 + * Choose the tempdir to use. We want something on tmpfs so that our memory 
 is
 + * not subject to the host's vm.dirty_ratio. If a tempdir is specified in 
 the
 + * environment, we use that even if it's not on tmpfs, but we warn the user.
 + * Otherwise, we try common tmpfs locations

[uml-devel] [GIT PULL] UML changes for 3.14-rc1

2014-01-26 Thread Richard Weinberger
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Linus,

The following changes since commit d8ec26d7f8287f5788a494f56e8814210f0e64be:

  Linux 3.13 (2014-01-19 18:40:07 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml.git for-linus

for you to fetch changes up to 9e443bc369e04b8db3266d7253ce7c1eee2ec979:

  um: hostfs: make functions static (2014-01-26 11:51:09 +0100)

- 
This time only various cleanups and housekeeping patches.

- 
James Hogan (1):
  um: hostfs: make functions static

Richard Weinberger (2):
  um: Removed unused attributes from thread_struct
  um: Include generic barrier.h

 arch/um/include/asm/Kbuild  |  1 +
 arch/um/include/asm/processor-generic.h |  3 --
 fs/hostfs/hostfs_kern.c | 53 +
 3 files changed, 29 insertions(+), 28 deletions(-)

Thanks,
//richard
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJS5OsZAAoJEPmeIjfg4UaaOn0QAKl+fV9JoqGeR0pijA6N5HVX
lHSGDT5hW24VA3SnnE4QYEvRi6s6k8v3UPYeCQ7tfP3F/qQRXcOgvNl18BNN7kGy
Ta5OfiE0UTDAwJOv1pm8Trje8rm3+Ta+wR3JUHe6yHNOxUjU61rkmNpghvKJa+Ml
Q/ETNys+LLTaVK4ptyzjnYvYOw3H0Db1nKEIOAFO+e3zJj48OdkLBaH7wov9jG8f
lQbUTdQcOwH8XFiiRqTzavj4yjG3ckY0WlcUqL2uXmO8GF+d4+COneEVvJRh3aUt
lEbEokBeuwpB4Tl6dcnOYz2QPto1OSJqkfL3T5cRr6SumRARE8lBDEEK8fB3YqJ3
o/h3gIusS/v27I2Pc+DZ+e9T0akoToITHrK3yhCyiR6DgtgkTreu+PKMw72uEwLO
oAhklcIAD9Pg+u2TfnBPpoQUONhP/OjTvA+ZCWlHWe7Dgb9yuOX8rf2Fi7L0FngE
eJpM1Hts9VApIoFzs4dih+HGLylGCUZzk5aDI6EckfspW4OhvlAEeuvUe5rqHzUH
iTEzU9i62O36EGB+cYpW3A869t2O/hkVbUKnuXmNBj1PecITnIcwtyyi7EVzJUVt
CJcDlPpLG1SlJUiOR/TeLElAU71nIYL/Q149hYZ3TLa5koXGmY01kxFxCGnc4L1V
QClTbuQx5/bmtqknhAgw
=DJ98
-END PGP SIGNATURE-

--
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments  Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431iu=/4140/ostg.clktrk
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH] um: Include generic barrier.h

2014-01-15 Thread Richard Weinberger
...to get smp_store_release().

Reported-by: Randy Dunlap rdun...@infradead.org
Signed-off-by: Richard Weinberger rich...@nod.at
---
 arch/um/include/asm/Kbuild | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild
index fdde187..fb3a6cc 100644
--- a/arch/um/include/asm/Kbuild
+++ b/arch/um/include/asm/Kbuild
@@ -4,3 +4,4 @@ generic-y += ftrace.h pci.h io.h param.h delay.h mutex.h 
current.h exec.h
 generic-y += switch_to.h clkdev.h
 generic-y += trace_clock.h
 generic-y += preempt.h
+generic-y += barrier.h
-- 
1.8.4.2


--
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments  Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431iu=/4140/ostg.clktrk
___
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, x86: Fix vDSO build

2014-01-12 Thread Richard Weinberger
Am Sonntag, 12. Januar 2014, 09:02:06 schrieb H. Peter Anvin:
 On 01/12/2014 06:52 AM, Richard Weinberger wrote:
  Commit x86: Delete non-required instances of include linux/init.h
  broke the UML build.
  
  arch/x86/um/vdso/vdso.S: Assembler messages:
  arch/x86/um/vdso/vdso.S:2: Error: no such instruction: `__initdata'
  arch/x86/um/vdso/vdso.S:9: Error: no such instruction: `__finit'
  
  UML's vDSO needs linux/init.h.
  
  Signed-off-by: Richard Weinberger rich...@nod.at
  ---
  
   arch/x86/um/vdso/vdso.S | 1 +
   1 file changed, 1 insertion(+)
  
  diff --git a/arch/x86/um/vdso/vdso.S b/arch/x86/um/vdso/vdso.S
  index 4b4bd4c..1cb468a 100644
  --- a/arch/x86/um/vdso/vdso.S
  +++ b/arch/x86/um/vdso/vdso.S
  @@ -1,3 +1,4 @@
  +#include linux/init.h
  
   __INITDATA
 
 So more bits that got cleaned up but never actually tested.  Sigh.
 
 Fengguang, could we get UM builds added to the test robot?

Would be great!

Fengguang, please make sure that you build both UML/i386 and UML/x86_64.
i.e. make defconfig ARCH=um SUBARCH=i386  make linux ARCH=um
and make defconfig ARCH=um SUBARCH=x86  make linux ARCH=um

Thanks,
//richard

--
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments  Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431iu=/4140/ostg.clktrk
___
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, x86: Fix vDSO build

2014-01-12 Thread Richard Weinberger
Am Sonntag, 12. Januar 2014, 19:58:06 schrieb Geert Uytterhoeven:
 On Sun, Jan 12, 2014 at 6:17 PM, Richard Weinberger rich...@nod.at wrote:
  Fengguang, please make sure that you build both UML/i386 and UML/x86_64.
  i.e. make defconfig ARCH=um SUBARCH=i386  make linux ARCH=um
  and make defconfig ARCH=um SUBARCH=x86  make linux ARCH=um
 
 x86 or x86_64?

Both x86 and x86_64 will create a CONFIG_64BIT=y .config.

Thanks,
//richard

--
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments  Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431iu=/4140/ostg.clktrk
___
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] negative pid -516 possible ?

2014-01-12 Thread Richard Weinberger
On Sat, Jan 11, 2014 at 11:47 AM, Toralf Förster toralf.foers...@gmx.de wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256

 I do fuzz testing with trinity (latest git version) a stable 32 bit Gentoo 
 Linux user mode linux image.
 The host is a stable 32 bit vanilla 3.12.7 kernel, the guest runs latest git 
 tree + 2 patches (attached).

 The trinity call in the UML guest is :
 $ trinity -q -l off -N 1 -C 2 -x move_pages -x mremap -v /mnt/ramdisk

 After a while there's no progress on the command line seen at the host system 
 - the trinity process seems to just hangs/idling. When this does occur I 
 cannot longer ssh into the system. The system however runs furthermore. In 
 another terminal I still see the output of this command:

Does it consume 100% CPU?

 $ ssh root@trinity tail -f /var/log/messages

 That's why I do know that the system does not hang completely. The output of 
 top at the host system gives me the pid of the linux exe. A gdb call gives 
 for that pid :

 $ date; sudo gdb /home/tfoerste/devel/linux/linux 25224 -n -batch -ex 'bt 
 full'
 Sat Jan 11 11:36:47 CET 2014

 warning: Could not load shared library symbols for linux-gate.so.1.
 Do you need set solib-search-path or set sysroot?
 0xb7800424 in __kernel_vsyscall ()
 #0  0xb7800424 in __kernel_vsyscall ()
 No symbol table info available.
 #1  0x083d63ff in __nanosleep_nocancel ()
 No symbol table info available.
 #2  0x0807266c in idle_sleep (nsecs=602496380195307520) at 
 arch/um/os-Linux/time.c:183
 ts = {tv_sec = 0, tv_nsec = 8436602}
 #3  0x0805fc0f in arch_cpu_idle () at arch/um/kernel/process.c:208
 No locals.
 #4  0x080a8971 in cpu_idle_loop () at kernel/cpu/idle.c:98
 No locals.
 #5  cpu_startup_entry (state=CPUHP_ONLINE) at kernel/cpu/idle.c:140
 No locals.
 #6  0x084215e9 in rest_init () at init/main.c:402
 pid = -516
 __func__ = rest_init
 #7  0x080487e1 in start_kernel () at init/main.c:656
 command_line = 0x85b8400 command_line earlyprintk 
 ubda=/home/tfoerste/virtual/uml/trinity ubdb=/mnt/ramdisk/trinity_swap 
 eth0=tuntap,tap0,72:ef:3d:9f:c3:5a mem=1025M con0=fd:0,fd:1 con=pts 
 rootfstype=ext4  root=98:0
 #8  0x08049e42 in start_kernel_proc (unused=0x0) at 
 arch/um/kernel/skas/process.c:48
 pid = -516
 __func__ = start_kernel_proc
 #9  0x0805f7cb in new_thread_handler () at arch/um/kernel/process.c:129
 fn = 0x0
 #10 0x in ?? ()
 No symbol table info available.



 Please note that BUG_ON was not triggered. For completeness here are the gdb 
 traces from all linux processes currently running at the host:

So let's forget the 516 issue for now.
What we no for now is that you manage to trigger a lockup within UML.



 $ pgrep linux | xargs -n1 -I {} sudo gdb /home/tfoerste/devel/linux/linux {} 
 -n -batch -ex 'bt'
 warning: process 1613 is already traced by process 25224
 ptrace: Operation not permitted.
 /home/tfoerste/1613: No such file or directory.
 No stack.
 warning: process 21849 is already traced by process 25224
 ptrace: Operation not permitted.
 /home/tfoerste/21849: No such file or directory.
 No stack.

 warning: Could not load shared library symbols for linux-gate.so.1.
 Do you need set solib-search-path or set sysroot?
 0xb7800424 in __kernel_vsyscall ()
 #0  0xb7800424 in __kernel_vsyscall ()
 #1  0x083d63ff in __nanosleep_nocancel ()
 #2  0x0807266c in idle_sleep (nsecs=602496380205307520) at 
 arch/um/os-Linux/time.c:183
 #3  0x0805fc0f in arch_cpu_idle () at arch/um/kernel/process.c:208
 #4  0x080a8971 in cpu_idle_loop () at kernel/cpu/idle.c:98
 #5  cpu_startup_entry (state=CPUHP_ONLINE) at kernel/cpu/idle.c:140
 #6  0x084215e9 in rest_init () at init/main.c:402
 #7  0x080487e1 in start_kernel () at init/main.c:656
 #8  0x08049e42 in start_kernel_proc (unused=0x0) at 
 arch/um/kernel/skas/process.c:48
 #9  0x0805f7cb in new_thread_handler () at arch/um/kernel/process.c:129
 #10 0x in ?? ()

 warning: process 25231 is a cloned process

 warning: Could not load shared library symbols for linux-gate.so.1.
 Do you need set solib-search-path or set sysroot?
 0xb7800424 in __kernel_vsyscall ()
 #0  0xb7800424 in __kernel_vsyscall ()
 #1  0x083da446 in syscall ()
 #2  0x0806e861 in io_getevents (events=optimized out, ctx_id=optimized 
 out, min_nr=optimized out, nr=optimized out, timeout=optimized out) at 
 arch/um/os-Linux/aio.c:49
 #3  aio_thread (arg=0x0) at arch/um/os-Linux/aio.c:109
 #4  0x083db56e in clone ()

 warning: process 25232 is a cloned process

 warning: Could not load shared library symbols for linux-gate.so.1.
 Do you need set solib-search-path or set sysroot?
 0xb7800424 in __kernel_vsyscall ()
 #0  0xb7800424 in __kernel_vsyscall ()
 #1  0x083d82c2 in __read_nocancel ()
 #2  0x0806f3ff in read (__nbytes=optimized out, __buf=optimized out, 
 __fd=optimized out) at /usr/include/bits/unistd.h:44
 #3  os_read_file (fd=-512, buf=0xfe00, len=-512) at 
 arch/um/os-Linux/file.c:253
 #4  0x0806bafc in 

Re: [uml-devel] negative pid -516 possible ?

2014-01-02 Thread Richard Weinberger
On Sun, Dec 29, 2013 at 2:14 PM,  st...@nixia.no wrote:
 #6  0x08421d02 in rest_init () at init/main.c:401
 pid = -516
 #7  0x080487e1 in start_kernel () at init/main.c:655
 command_line = 0x85b6400 command_line earlyprintk
 ubda=/home/tfoerste/virtual/uml/trinity ubdb=/mnt/ramdisk/trinity_swap
 eth0=tuntap,tap0,72:ef:3d:9f:c3:5a mem=1025M con0=fd:0,fd:1 con=pts
 rootfstype=ext4  root=98:0
 #8  0x08049e09 in start_kernel_proc (unused=0x0) at
 arch/um/kernel/skas/process.c:46
 pid = -516
 #9  0x0805f7cb in new_thread_handler () at
 arch/um/kernel/process.c:129
 fn = 0x0
 #10 0x in ?? ()
 No symbol table info available.


 Is this a valid number ?
 I'm asking b/c there's no process group id 516, and -516 always
 happens in the back traces.
 And furthermore after a while the UML system does no longer serve any
 ssh login attempts.

 516 ==  -ERESTART_RESTARTBLOCK  ??

Yeah, maybe.

Toralf, where exactly comes this back trace from? gives for a guest
is not a good error description.
Did it crash and you took it from the core dump?
Did it panic() and you attached to it?
Did it hang...?
IOW don't throw random back traces to us without much details. ;-)

The number -516 is a bit odd because you see it in
arch/um/kernel/skas/process.c.
In that function it comes from os_getpid() which indicates that the
host kernel reports that number.
...very strange.

init/main.c makes a bit more sense. Maybe a kthread creation within
UML returned that internal error.

Can you try the attached debug patch?
If the BUG_ON() trigger, please show us panic from UML, not just the
gdb back trace.

-- 
Thanks,
//richard
diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c
index 4da11b3..71a5828 100644
--- a/arch/um/kernel/skas/process.c
+++ b/arch/um/kernel/skas/process.c
@@ -38,6 +38,8 @@ static int __init start_kernel_proc(void *unused)
block_signals();
pid = os_getpid();
 
+   BUG_ON(pid == -516);
+
cpu_tasks[0].pid = pid;
cpu_tasks[0].task = current;
 #ifdef CONFIG_SMP
diff --git a/init/main.c b/init/main.c
index febc511..9ad68ab 100644
--- a/init/main.c
+++ b/init/main.c
@@ -386,6 +386,7 @@ static noinline void __init_refok rest_init(void)
kernel_thread(kernel_init, NULL, CLONE_FS | CLONE_SIGHAND);
numa_default_policy();
pid = kernel_thread(kthreadd, NULL, CLONE_FS | CLONE_FILES);
+   BUG_ON(pid == -516);
rcu_read_lock();
kthreadd_task = find_task_by_pid_ns(pid, init_pid_ns);
rcu_read_unlock();
--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET,  PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk___
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] why does index in truncate_inode_pages_range() grows so much ?

2013-12-13 Thread Richard Weinberger
On Fri, Dec 13, 2013 at 10:52 AM, Toralf Förster toralf.foers...@gmx.de wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256

 On 12/11/2013 09:26 PM, Jan Kara wrote:
 Thanks! So this works more or less as expected - trinity issued a
 read at absurdly high offset so we created pagecache page a that
 offset and tried to read data into it. That failed. We left the
 page in the pagecache where it was for reclaim to reclaim it when
 free pages are needed. Everything works as designed except we could
 possibly argue that it's not the most efficient way to use
 pages...

 Patch 'vfs: fix a bug when we do some dio reads with append dio
 writes' (http://www.spinics.net/lists/linux-fsdevel/msg70899.html)
 should actually change the situation and we won't unnecessarily
 cache these pages.

 confirmed - applied to latest git tree of Linus I helps.

Good to know! :-)

-- 
Thanks,
//richard

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET,  PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] Please add: um: add missing declaration of 'getrlimit()' and friends

2013-12-08 Thread Richard Weinberger
Hi Greg,

please add commit fdfa4c952844fce881df8c76de9c7180cbe913ab (um: add missing 
declaration of 'getrlimit()' and friends) to -stable.
The change was introduced in 3.9 and needs backporting to all stable trees.

Thanks,
//richard

--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631iu=/4140/ostg.clktrk
___
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] does 3.12.2 breaks UML with con=xterm ?

2013-12-02 Thread Richard Weinberger
Am Sonntag, 1. Dezember 2013, 20:05:55 schrieb Toralf Förster:
 On 12/01/2013 11:20 AM, Richard Weinberger wrote:
  I meant xterm for all consoles but con0...
  Such that you can trigger the crash but are still able to see the output.
 
 Not sure if the 2 attached files contains useful info, but here they are:
 
 The back trace of a hanging linux process :
 $sudo gdb /home/tfoerste/devel/linux/linux 27162 -n -batch -ex 'bt full' 
 bt
 
 and stdout, error and bt of the core file from round #18 of this command :
 
 $ I=0; while [[ : ]]; do ((I=I+1)); echo; echo; echo $I; date; for i in
 trinity.sh xterm linux port-helper start_uml.sh ; do pkill $i; done; rm -f
 /mnt/ramdisk/core; start_uml.sh -r ~/virtual/uml/trinity -l
 /home/tfoerste/devel/linux/linux -y 'con0=fd:0,fd:1 con=xterm'
 1/mnt/ramdisk/$I.out 2/mnt/ramdisk/$I.err; [[ -f /mnt/ramdisk/core ]] 
 gdb --core=/mnt/ramdisk/core /home/tfoerste/devel/linux/linux -n -batch -ex
 'bt full'  /mnt/ramdisk/$I.bt; sleep 10; done

What I can see is that UML panic()ed because PTRACE_SETREGS is failing with 
ESRCH. This means one of the UML SKAS0 helper threads got killed and is gone.
This is very strange and makes me worry, because in this stage the helper is 
in stopped state and cannot really die by an UML error. Looks like it got 
killed from outside.
Is your host setup 100% sane? :)

Thanks,
//richard

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET,  PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351iu=/4140/ostg.clktrk
___
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] does 3.12.2 breaks UML with con=xterm ?

2013-12-02 Thread Richard Weinberger
Am Montag, 2. Dezember 2013, 22:32:11 schrieb Toralf Förster:
 On 12/02/2013 10:21 PM, Richard Weinberger wrote:
  Am Sonntag, 1. Dezember 2013, 20:05:55 schrieb Toralf Förster:
  On 12/01/2013 11:20 AM, Richard Weinberger wrote:
  I meant xterm for all consoles but con0...
  Such that you can trigger the crash but are still able to see the
  output.
  
  Not sure if the 2 attached files contains useful info, but here they are:
  
  The back trace of a hanging linux process :
  $sudo gdb /home/tfoerste/devel/linux/linux 27162 -n -batch -ex 'bt full'
  
  bt
  
  and stdout, error and bt of the core file from round #18 of this command
  :
  
  $ I=0; while [[ : ]]; do ((I=I+1)); echo; echo; echo $I; date; for i in
  trinity.sh xterm linux port-helper start_uml.sh ; do pkill $i; done; rm
  -f
  /mnt/ramdisk/core; start_uml.sh -r ~/virtual/uml/trinity -l
  /home/tfoerste/devel/linux/linux -y 'con0=fd:0,fd:1 con=xterm'
  1/mnt/ramdisk/$I.out 2/mnt/ramdisk/$I.err; [[ -f /mnt/ramdisk/core ]]
  
  gdb --core=/mnt/ramdisk/core /home/tfoerste/devel/linux/linux -n -batch
  -ex
  'bt full'  /mnt/ramdisk/$I.bt; sleep 10; done
  
  What I can see is that UML panic()ed because PTRACE_SETREGS is failing
  with
  ESRCH. This means one of the UML SKAS0 helper threads got killed and is
  gone. This is very strange and makes me worry, because in this stage the
  helper is in stopped state and cannot really die by an UML error. Looks
  like it got killed from outside.
  Is your host setup 100% sane? :)
 
 Hhm - I've had 1 script running, which start an UML - and another
 script, which every 3 minutes ssh into the started UML and run halt;
 exit. Before that I manually did both steps.
 
 I let run the script solution for a while and did different things - but
 of course I cannot swear that I did not by accident recalled a command
 from a bash history command which killed processes (which I do have
 regularly to do if I test the UML with trinity).
 
 So likely my fault here - yes.

No big deal.
Please try to reproduce with a minimal test setup.
No magic scripts and stuff. :)

Thanks,
//richard

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET,  PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351iu=/4140/ostg.clktrk
___
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] does 3.12.2 breaks UML with con=xterm ?

2013-12-01 Thread Richard Weinberger
Am Sonntag, 1. Dezember 2013, 11:17:31 schrieb Toralf Förster:
 On 12/01/2013 12:19 AM, Richard Weinberger wrote:
   after another minute now all xterms are away 
  
  So, it does not crash immediately.
 
 Right, to be precise, just 1 sub-process crashes immediately
 
  Please do not use xterm for con0. Such that we can see the kernel output
  after a crash.
  Maybe there are some error message before...
 
 Without xterm I do not see any errors except the winch_thread ... - line.

I meant xterm for all consoles but con0...
Such that you can trigger the crash but are still able to see the output.

 
 BTW wrt the radix-tree-issue seems that fedora has now a similar bug
 open : https://bugzilla.redhat.com/show_bug.cgi?id=1015028

Thanks for the info!

Thanks,
//richard

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET,  PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351iu=/4140/ostg.clktrk
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [GIT PULL] UML fixes for 3.13-rc3

2013-12-01 Thread Richard Weinberger
Linus,

The following changes since commit af91706d5ddecb4a9858cca9e90d463037cfd498:

  ima: store address of template_fmt_copy in a pointer before calling strsep 
(2013-11-30 13:09:53 +1100)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml.git for-linus

for you to fetch changes up to fff6540cbcb56a6ae92d4fd4b0864c8d13a8f932:

  um: Build always with -mcmodel=large on 64bit (2013-12-01 13:06:51 +0100)


Fixes two regressions which got introduced while the merge window.


Richard Weinberger (2):
  um: Rename print_stack_trace to do_stack_trace
  um: Build always with -mcmodel=large on 64bit

 arch/um/Makefile   | 9 -
 arch/um/kernel/sysrq.c | 4 ++--
 2 files changed, 6 insertions(+), 7 deletions(-)


signature.asc
Description: This is a digitally signed message part.
--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET,  PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351iu=/4140/ostg.clktrk___
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] does 3.12.2 breaks UML with con=xterm ?

2013-11-30 Thread Richard Weinberger
On Sat, Nov 30, 2013 at 3:43 PM, Toralf Förster toralf.foers...@gmx.de wrote:
 On 11/30/2013 03:37 PM, Toralf Förster wrote:

 Today I realized that a UML cores if I use the xterm for the in/out.

 I do usually use con0=fd:0,fd:1 con=pts to start a 32bit UML but because 
 the xterm way was fine during the past few weeks (yes, I know, it was broken 
 for a longer time before) and the only change yesterday was to upgrade from 
 vanilla kernel 3.12.1 to 3.12.2 I'm wondering if there's a suspicous 
 commit in that stable kernel which could be the reason ?


 FWIW :
 tfoerste@n22 ~ $ gdb --core=/mnt/ramdisk/core 
 /home/tfoerste/devel/linux/linux -n -batch -ex bt
 [New LWP 29559]
 Core was generated by `/home/tfoerste/devel/linux/linux earlyprintk 
 ubda=/home/tfoerste/virtual/uml/tr'.
 Program terminated with signal 11, Segmentation fault.
 #0  finish_task_switch (prev=0x9d2f, rq=optimized out) at 
 kernel/sched/core.c:1993
 1993prev_state = prev-state;
 #0  finish_task_switch (prev=0x9d2f, rq=optimized out) at 
 kernel/sched/core.c:1993
 #1  0x08427418 in context_switch (next=optimized out, prev=0x46d9eecc, 
 rq=optimized out) at kernel/sched/core.c:2130
 #2  __schedule () at kernel/sched/core.c:2568
 #3  0x08427505 in schedule () at kernel/sched/core.c:2604
 #4  0x0808b912 in sigsuspend (set=0x46d9eecc) at kernel/signal.c:3559
 #5  0x080646d8 in winch_thread (arg=0x46d9eecc) at 
 arch/um/drivers/chan_user.c:210
 #6  0x083da38e in clone ()



 Pff - glibc was upgrade from 2.15-r3 to 2.16 too - /me hope, that it is
 not glibc.

Please more details.
Does Linus' tree work?
Does it crash immediately?
...

Just booted an UML with xterm. Works fine...

-- 
Thanks,
//richard

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET,  PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351iu=/4140/ostg.clktrk
___
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] does 3.12.2 breaks UML with con=xterm ?

2013-11-30 Thread Richard Weinberger
Am Samstag, 30. November 2013, 17:28:55 schrieb Toralf Förster:
 On 11/30/2013 03:51 PM, Richard Weinberger wrote:
  Please more details.
  Does Linus' tree work?
  Does it crash immediately?
 
 Does this helps ? :

Please try Linus's tree and run it without GDB.
UML now has a complete new stack unwinder, let's give it a try.

Thanks,
//richard

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET,  PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351iu=/4140/ostg.clktrk
___
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] does 3.12.2 breaks UML with con=xterm ?

2013-11-30 Thread Richard Weinberger
Am Samstag, 30. November 2013, 18:26:45 schrieb Toralf Förster:
 On 11/30/2013 05:36 PM, Richard Weinberger wrote:
  Am Samstag, 30. November 2013, 17:28:55 schrieb Toralf Förster:
  On 11/30/2013 03:51 PM, Richard Weinberger wrote:
  Please more details.
  Does Linus' tree work?
  Does it crash immediately?
  
  Does this helps ? :
  Please try Linus's tree and run it without GDB.
  UML now has a complete new stack unwinder, let's give it a try.
 
 I tried it again now with host kernel 3.13-rc2 - (and guest kernel 3.11,
 3.12 and 3.13-rc2) - same picture.
 
 (FWIW I tried the UML guest already with a lot of versions inclusive
 latest Linus git tree, but for the host I'd like to run latest stable
 from Greg KH)

Please show me the backtrace from Linus' tree.

Thanks,
//richard

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET,  PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351iu=/4140/ostg.clktrk
___
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] does 3.12.2 breaks UML with con=xterm ?

2013-11-30 Thread Richard Weinberger
Am Samstag, 30. November 2013, 19:19:59 schrieb Toralf Förster:
 On 11/30/2013 06:35 PM, Richard Weinberger wrote:
  Am Samstag, 30. November 2013, 18:26:45 schrieb Toralf Förster:
  On 11/30/2013 05:36 PM, Richard Weinberger wrote:
  Am Samstag, 30. November 2013, 17:28:55 schrieb Toralf Förster:
  On 11/30/2013 03:51 PM, Richard Weinberger wrote:
  Please more details.
  Does Linus' tree work?
  Does it crash immediately?
  
  Does this helps ? :
  Please try Linus's tree and run it without GDB.
  UML now has a complete new stack unwinder, let's give it a try.
  
  I tried it again now with host kernel 3.13-rc2 - (and guest kernel 3.11,
  3.12 and 3.13-rc2) - same picture.
  
  (FWIW I tried the UML guest already with a lot of versions inclusive
  latest Linus git tree, but for the host I'd like to run latest stable
  from Greg KH)
  
  Please show me the backtrace from Linus' tree.
  
  Thanks,
  //richard
 
 3 subsequent runs gave these 3 back traces :

Sorry for being imprecise, I meant the raw output from UML, not GDB.
Currently it looks like yet another cluster fuck within the winch-Thread.

Thanks,
//richard

 
 tfoerste@n22 /mnt/ramdisk $ cat bt-g
 [New LWP 5297]
 Core was generated by `/home/tfoerste/devel/linux/linux earlyprintk
 ubda=/home/tfoerste/virtual/uml/tr'. Program terminated with signal 11,
 Segmentation fault.
 #0  constant_test_bit (addr=optimized out, nr=optimized out) at
 /home/tfoerste/devel/linux/arch/x86/include/asm/bitops.h:313 313   
  (addr[nr  _BITOPS_LONG_SHIFT])) != 0;
 #0  constant_test_bit (addr=optimized out, nr=optimized out) at
 /home/tfoerste/devel/linux/arch/x86/include/asm/bitops.h:313 No locals.
 #1  test_ti_thread_flag (ti=optimized out, flag=optimized out) at
 include/linux/thread_info.h:93 No locals.
 #2  test_tsk_thread_flag (flag=optimized out, tsk=optimized out) at
 include/linux/sched.h:2422 No locals.
 #3  signal_pending (p=optimized out) at include/linux/sched.h:2448
 No locals.
 #4  __set_task_blocked (tsk=0x34747865, newset=0x49b41f4c) at
 kernel/signal.c:2530 No locals.
 #5  0x0808a390 in __set_current_blocked (newset=0x49b41f4c) at
 kernel/signal.c:2558 tsk = 0x34747865
 #6  0x0808a3b7 in set_current_blocked (newset=0x0) at kernel/signal.c:2550
 No locals.
 #7  0x0808b8fd in sigsuspend (set=0x0) at kernel/signal.c:3556
 No locals.
 #8  0x080646d8 in winch_thread (arg=0x0) at arch/um/drivers/chan_user.c:210
 sigs = incomplete type
 pty_fd = 172431400
 pipe_fd = 15
 c = 1 '\001'
 #9  0x083da38e in clone ()
 No symbol table info available.
 
 
 tfoerste@n22 /mnt/ramdisk $ cat bt-g
 [New LWP 5557]
 Core was generated by `/home/tfoerste/devel/linux/linux earlyprintk
 ubda=/home/tfoerste/virtual/uml/tr'. Program terminated with signal 11,
 Segmentation fault.
 #0  0x0808b8da in sigsuspend (set=0x0) at kernel/signal.c:3555
 3555current-saved_sigmask = current-blocked;
 #0  0x0808b8da in sigsuspend (set=0x0) at kernel/signal.c:3555
 No locals.
 #1  0x080646d8 in winch_thread (arg=0x0) at arch/um/drivers/chan_user.c:210
 sigs = incomplete type
 pty_fd = 145942568
 pipe_fd = 15
 c = 1 '\001'
 #2  0x083da38e in clone ()
 No symbol table info available.
 
 
 tfoerste@n22 /mnt/ramdisk $ cat bt-g
 [New LWP 5809]
 Core was generated by `/home/tfoerste/devel/linux/linux earlyprintk
 ubda=/home/tfoerste/virtual/uml/tr'. Program terminated with signal 11,
 Segmentation fault.
 #0  constant_test_bit (addr=optimized out, nr=optimized out) at
 /home/tfoerste/devel/linux/arch/x86/include/asm/bitops.h:313 313   
  (addr[nr  _BITOPS_LONG_SHIFT])) != 0;
 #0  constant_test_bit (addr=optimized out, nr=optimized out) at
 /home/tfoerste/devel/linux/arch/x86/include/asm/bitops.h:313 No locals.
 #1  test_ti_thread_flag (ti=optimized out, flag=optimized out) at
 include/linux/thread_info.h:93 No locals.
 #2  test_tsk_thread_flag (flag=optimized out, tsk=optimized out) at
 include/linux/sched.h:2422 No locals.
 #3  signal_pending (p=optimized out) at include/linux/sched.h:2448
 No locals.
 #4  __set_task_blocked (tsk=0x34747865, newset=0x48b41f4c) at
 kernel/signal.c:2530 No locals.
 #5  0x0808a390 in __set_current_blocked (newset=0x48b41f4c) at
 kernel/signal.c:2558 tsk = 0x34747865
 #6  0x0808a3b7 in set_current_blocked (newset=0x0) at kernel/signal.c:2550
 No locals.
 #7  0x0808b8fd in sigsuspend (set=0x0) at kernel/signal.c:3556
 No locals.
 #8  0x080646d8 in winch_thread (arg=0x0) at arch/um/drivers/chan_user.c:210
 sigs = incomplete type
 pty_fd = 152619048
 pipe_fd = 15
 c = 1 '\001'
 #9  0x083da38e in clone ()
 No symbol table info available.


--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility

Re: [uml-devel] does 3.12.2 breaks UML with con=xterm ?

2013-11-30 Thread Richard Weinberger
Am Samstag, 30. November 2013, 19:43:47 schrieb Toralf Förster:
 On 11/30/2013 07:23 PM, Richard Weinberger wrote:
  Sorry for being imprecise, I meant the raw output from UML, not GDB.
  Currently it looks like yet another cluster fuck within the winch-Thread.
  
  Thanks,
  //richard
 
 ah - ok.
 
 This is from the KOnsole starting the UML (FWIW the UML often starts,
 but failed to get an IP address via DHCP and then suddenly all xterms
 vanishe w/o any further core dump)
 
 
 tfoerste@n22 /mnt/ramdisk $ start_uml.sh -r ~/virtual/uml/trinity -y
 con=xterm -l /home/tfoerste/devel/linux/linux +
 /home/tfoerste/devel/linux/linux earlyprintk
 ubda=/home/tfoerste/virtual/uml/trinity ubdb=/mnt/ramdisk/trinity_swap
 eth0=tuntap,tap0,72:ef:3d:9f:c3:5a mem=1025M con=xterm umid=uml_trinity
 rootfstype=ext4 '' Locating the bottom of the address space ... 0x1000
 Locating the top of the address space ... 0xc000
 Core dump limits :
 soft - NONE
 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 for tmpfs mount on /dev/shm.../dev/shm...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 23449600 bytes to physical memory to account for exec-shield gap
 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: 1025168K/1072500K available (3932K kernel code, 283K rwdata, 1516K
 rodata, 114K init, 180K bss, 47332K reserved) SLUB: HWalign=64, Order=0-3,
 MinObjects=0, CPUs=1, Nodes=1
 NR_IRQS:15
 Calibrating delay loop... 2832.79 BogoMIPS (lpj=14163968)
 pid_max: default: 32768 minimum: 301
 Mount-cache hash table entries: 512
 Checking for host processor cmov support...Yes
 Checking that host ptys support output SIGIO...Yes
 Checking that host ptys support SIGIO on close...No, enabling workaround
 devtmpfs: initialized
 Using 2.6 host AIO
 NET: Registered protocol family 16
 bio: create slab bio-0 at 0
 Switched to clocksource itimer
 NET: Registered protocol family 2
 TCP established hash table entries: 16384 (order: 4, 65536 bytes)
 TCP bind hash table entries: 16384 (order: 4, 65536 bytes)
 TCP: Hash tables configured (established 16384 bind 16384)
 TCP: reno registered
 UDP hash table entries: 1024 (order: 2, 16384 bytes)
 UDP-Lite hash table entries: 1024 (order: 2, 16384 bytes)
 NET: Registered protocol family 1
 RPC: Registered named UNIX socket transport module.
 RPC: Registered udp transport module.
 RPC: Registered tcp transport module.
 RPC: Registered tcp NFSv4.1 backchannel transport module.
 console [stderr0] disabled
 mconsole (version 2) initialized on /home/tfoerste/.uml/uml_trinity/mconsole
 Checking host MADV_REMOVE support...OK
 UML Audio Relay (host dsp = /dev/sound/dsp, host mixer = /dev/sound/mixer)
 Host TLS support detected
 Detected host type: i386 (GDT indexes 6 to 9)
 audit: initializing netlink socket (disabled)
 type=2000 audit(1385836514.952:1): initialized
 zbud: loaded
 NFS: Registering the id_resolver key type
 Key type id_resolver registered
 Key type id_legacy registered
 nfs4filelayout_init: NFSv4 File Layout Driver Registering...
 Installing knfsd (copyright (C) 1996 o...@monad.swb.de).
 msgmni has been set to 2002
 alg: No test for stdrng (krng)
 Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
 io scheduler noop registered (default)
 loop: module loaded
 device-mapper: uevent: version 1.0.3
 device-mapper: ioctl: 4.27.0-ioctl (2013-10-30) initialised:
 dm-de...@redhat.com TCP: cubic registered
 NET: Registered protocol family 10
 sit: IPv6 over IPv4 tunneling driver
 NET: Registered protocol family 17
 Key type dns_resolver registered
 Initialized stdio console driver
 Console initialized on /dev/tty0
 console [tty0] enabled
 bootconsole [earlycon0] disabled
 
 
 
 and it continues then with Gentoo's message in the xterm :
 
 
 
 console [tty0] enabled
 bootconsole [earlycon0] disabled
 Initializing software serial port version 1
 console [mc-1] enabled
  ubda: unknown partition table
  ubdb: unknown partition table
 Netdevice 0 (72:ef:3d:9f:c3:5a) :
 TUN/TAP backend -
 EXT4-fs (ubda): INFO: recovery required on readonly filesystem
 EXT4-fs (ubda): write access will be enabled during recovery
 EXT4-fs (ubda): recovery complete
 EXT4-fs (ubda): mounted filesystem with ordered data mode. Opts: (null)
 VFS: Mounted root (ext4 filesystem) readonly on device 98:0.
 devtmpfs: mounted
 INIT: version 2.88 booting
 
OpenRC 0.12.4 is starting up Gentoo Linux (i686) [UML]
 
  * Mounting /proc

[uml-devel] [PATCH] um: Build always with -mcmodel=large on 64bit

2013-11-29 Thread Richard Weinberger
On UML SUBARCH can be x86, x86_64 and i386 and if it is x86
we use uname -m to select a defconfig.
Therefore we can no longer use -mcmodel=large only if SUBARCH
is x86_64.

Reported-by: Boaz Harrosh bharr...@panasas.com
Signed-off-by: Richard Weinberger rich...@nod.at
---
 arch/um/Makefile | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/um/Makefile b/arch/um/Makefile
index 48d92bb..36e658a 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -33,12 +33,11 @@ MODE_INCLUDE+= 
-I$(srctree)/$(ARCH_DIR)/include/shared/skas
 
 HEADER_ARCH:= $(SUBARCH)
 
-# Additional ARCH settings for x86
-ifeq ($(SUBARCH),i386)
-HEADER_ARCH := x86
+ifneq ($(filter $(SUBARCH),x86 x86_64 i386),)
+   HEADER_ARCH := x86
 endif
-ifeq ($(SUBARCH),x86_64)
-HEADER_ARCH := x86
+
+ifdef CONFIG_64BIT
KBUILD_CFLAGS += -mcmodel=large
 endif
 
-- 
1.8.1.4


--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET,  PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351iu=/4140/ostg.clktrk
___
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] x86_64 when mem 384M loadable modules do not work

2013-11-28 Thread Richard Weinberger
Am Donnerstag, 28. November 2013, 16:40:48 schrieb Boaz Harrosh:
 Hi um hackers
 
 I'm using an x86_64 deployment both host and um-guest.
 (Fedora 18)
 
 When I load with mem=384M all is well but anything bigger will
 eventually give me problems because loadable modules will no
 longer load. The bigger mem= is, the earlier it will start.
 
 When the Kernel tries to load the .ko driver I get these messages:
 
 subarch: overflow in relocation type 11 val 805b1e40
 subarch: `nfsv4' likely not compiled with -mcmodel=kernel
 subarch: overflow in relocation type 11 val 806e4ca0
 subarch: `nfsv3' likely not compiled with -mcmodel=kernel
...
 
 (The first print is always around that same number
  805b1e40 independent of the mem= ( 384M)
 )
 
 Do you guys see the same problem? I'm using loadable modules
 because it is kind of mandatory for the kind of development I
 do.
 
 Please help because 384M is not enough for me anymore, even
 when I define a swap device for the uml to use.

/me has a deja vu.
I've fixed that issue some time ago.

Let's see why it happens again. :)

Thanks,
//richard

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET,  PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351iu=/4140/ostg.clktrk
___
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] mmotm 2013-11-20-16-13 uploaded (arch/um/kernel/sysrq.c)

2013-11-21 Thread Richard Weinberger
Am Mittwoch, 20. November 2013, 16:52:05 schrieb Randy Dunlap:
 On 11/20/13 16:14, a...@linux-foundation.org wrote:
  The mm-of-the-moment snapshot 2013-11-20-16-13 has been uploaded to
  
 http://www.ozlabs.org/~akpm/mmotm/
  
  mmotm-readme.txt says
  
  README for mm-of-the-moment:
  
  http://www.ozlabs.org/~akpm/mmotm/
  
  This is a snapshot of my -mm patch queue.  Uploaded at random hopefully
  more than once a week.
 
 on i386:
 (with um i386 defconfig)
 
 arch/um/kernel/sysrq.c:22:13: error: expected identifier or '(' before 'do'
 um/kernel/sysrq.c:22:13: error: expected identifier or '(' before 'while'
 
 
 so sysrq.c is picking up linux/stacktrace.h somehow and not liking it.

um/kernel/sysrq.c has
static void print_stack_trace(unsigned long *sp, unsigned long bp)
and linux/stracktrace.h has
# define print_stack_trace(trace, spaces)   do { } while (0)

So um's print_stack_trace needs to be renamed.
Thanks a lot for reporting!

Thanks,
//richard


--
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311iu=/4140/ostg.clktrk
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH] um: Rename print_stack_trace to do_stack_trace

2013-11-21 Thread Richard Weinberger
We cannot use print_stack_trace because the name conflicts
with linux/stacktrace.h.

Reported-by: Randy Dunlap rdun...@infradead.org
Signed-off-by: Richard Weinberger rich...@nod.at
---
 arch/um/kernel/sysrq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/um/kernel/sysrq.c b/arch/um/kernel/sysrq.c
index 4d6fdf6..799d7e4 100644
--- a/arch/um/kernel/sysrq.c
+++ b/arch/um/kernel/sysrq.c
@@ -19,7 +19,7 @@ struct stack_frame {
unsigned long return_address;
 };
 
-static void print_stack_trace(unsigned long *sp, unsigned long bp)
+static void do_stack_trace(unsigned long *sp, unsigned long bp)
 {
int reliable;
unsigned long addr;
@@ -94,5 +94,5 @@ void show_stack(struct task_struct *task, unsigned long 
*stack)
}
printk(KERN_CONT \n);
 
-   print_stack_trace(sp, bp);
+   do_stack_trace(sp, bp);
 }
-- 
1.8.4.2


--
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311iu=/4140/ostg.clktrk
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [GIT PULL] UML changes for 3.13-rc1

2013-11-17 Thread Richard Weinberger
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Linus,

The following changes since commit 5e01dc7b26d9f24f39abace5da98ccbd6a5ceb52:

  Linux 3.12 (2013-11-03 15:41:51 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml.git for-linus

for you to fetch changes up to 33a7d42999b1857d4494f6ad6367e3aef0ae8137:

  um: Remove unused declarations from as-layout.h (2013-11-17 11:39:22 +0100)

- 
This pile contains a nice defconfig cleanup,
a rewritten stack unwinder and various cleanups.

- 
Geert Uytterhoeven (1):
  um: Remove unused declarations from as-layout.h

Michael Opdenacker (1):
  um: remove used STDIO_CONSOLE Kconfig param

Ramkumar Ramachandra (2):
  arch/um: make it work with defconfig and x86_64
  um/vdso: add .gitignore for a couple of targets

Richard Weinberger (4):
  um: Rewrite show_stack()
  um: Make stack trace reliable against kernel mode faults
  um: Get rid of thread_struct-saved_task
  um: Make kstack_depth_to_print conform to arch/x86

 arch/um/Kconfig.char|   4 -
 arch/um/Kconfig.common  |   5 -
 arch/um/Makefile|  11 +
 arch/um/configs/i386_defconfig  |  76 +++
 arch/um/configs/x86_64_defconfig|  75 +++
 arch/um/defconfig   | 899 
 arch/um/drivers/mconsole_kern.c |   6 +-
 arch/um/include/asm/processor-generic.h |   2 +-
 arch/um/include/shared/as-layout.h  |   3 -
 arch/um/include/shared/os.h |   1 +
 arch/um/kernel/process.c|  15 +-
 arch/um/kernel/sysrq.c  | 102 ++--
 arch/um/kernel/trap.c   |  14 +-
 arch/um/kernel/um_arch.c|   2 +-
 arch/um/os-Linux/signal.c   |   8 +
 arch/x86/um/Kconfig |   5 +
 arch/x86/um/asm/processor_32.h  |   5 +
 arch/x86/um/asm/processor_64.h  |   5 +
 arch/x86/um/sysrq_32.c  |  66 ---
 arch/x86/um/sysrq_64.c  |   8 +-
 arch/x86/um/vdso/.gitignore |   2 +
 21 files changed, 273 insertions(+), 1041 deletions(-)
 create mode 100644 arch/um/configs/i386_defconfig
 create mode 100644 arch/um/configs/x86_64_defconfig
 delete mode 100644 arch/um/defconfig
 create mode 100644 arch/x86/um/vdso/.gitignore

Thanks,
//richard
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJSiLvCAAoJEN9758yqZn9eSnwH/3/0e+3VcWl5+yxUhD+j/xJi
dmcO2LLONpHye1KIWn75AlNt91fkc2dauphhg/SRBqi6mVB0NWUUCtFRvWr4Wzht
5F1aYlPzBmZvChN/1S2QYnldg/EJw7okQEjnFFbWgs1Bh47m3zXU98arbI34JYQA
WisaUsApY1hejTUPtZM5ixF2+cJtXe0vkXDfdrn188pMxcqfD0hRuWBjmsIHFZC3
h65exYi3NQUG9kwRNKYYhPMc8ACQ0OEePt5CBDeJytH4LVodhpGd0i55ljWQhhHo
JQnBnU3eekUcAetLixUTAsRKsCX1xY+xrqFk/MKK/EXzOAfw4F1/90bLtal7OkA=
=Q9AM
-END PGP SIGNATURE-

--
DreamFactory - Open Source REST  JSON Services for HTML5  Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471iu=/4140/ostg.clktrk
___
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] uml: Simplify tempdir logic.

2013-11-17 Thread Richard Weinberger
Am 11.11.2013 19:03, schrieb Tristan Schmelcher:
 From: Tristan Schmelcher tschmelc...@google.com
 
 Inferring the mount hierarchy correctly from /proc/mounts is hard when MS_MOVE
 may have been used, and the previous code did it wrongly. This change 
 simplifies
 the logic to only require that /dev/shm be _on_ tmpfs (which can be checked
 trivially with statfs) rather than that it be a _mountpoint_ of tmpfs, since
 there isn't a compelling reason to be that strict. We also now check for tmpfs
 on whatever directory we ultimately use so that the user is better informed.
 
 This change also moves the more standard TMPDIR environment variable check 
 ahead
 of the others.
 
 Applies to 3.12.
 
 Signed-off-by: Tristan Schmelcher tschmelc...@google.com

I like what I see but so far I didn't had to time to review your changes 
carefully.
Stay tuned. :)

Thanks,
//richard

 ---
  arch/um/os-Linux/mem.c | 372 
 ++---
  1 file changed, 75 insertions(+), 297 deletions(-)
 
 diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c
 index 3c4af77..897e9ad 100644
 --- a/arch/um/os-Linux/mem.c
 +++ b/arch/um/os-Linux/mem.c
 @@ -12,337 +12,117 @@
  #include string.h
  #include sys/stat.h
  #include sys/mman.h
 -#include sys/param.h
 +#include sys/vfs.h
 +#include linux/magic.h
  #include init.h
  #include os.h
  
 -/* Modified by which_tmpdir, which is called during early boot */
 -static char *default_tmpdir = /tmp;
 -
 -/*
 - *  Modified when creating the physical memory file and when checking
 - * the tmp filesystem for usability, both happening during early boot.
 - */
 +/* Set by make_tempfile() during early boot. */
  static char *tempdir = NULL;
  
 -static void __init find_tempdir(void)
 +/* Check if dir is on tmpfs. Return 0 if yes, -1 if no or error. */
 +static int __init check_tmpfs(const char *dir)
  {
 - const char *dirs[] = { TMP, TEMP, TMPDIR, NULL };
 - int i;
 - char *dir = NULL;
 -
 - if (tempdir != NULL)
 - /* We've already been called */
 - return;
 - for (i = 0; dirs[i]; i++) {
 - dir = getenv(dirs[i]);
 - if ((dir != NULL)  (*dir != '\0'))
 - break;
 - }
 - if ((dir == NULL) || (*dir == '\0'))
 - dir = default_tmpdir;
 + struct statfs st;
  
 - tempdir = malloc(strlen(dir) + 2);
 - if (tempdir == NULL) {
 - fprintf(stderr, Failed to malloc tempdir, 
 - errno = %d\n, errno);
 - return;
 - }
 - strcpy(tempdir, dir);
 - strcat(tempdir, /);
 -}
 -
 -/*
 - * Remove bytes from the front of the buffer and refill it so that if 
 there's a
 - * partial string that we care about, it will be completed, and we can 
 recognize
 - * it.
 - */
 -static int pop(int fd, char *buf, size_t size, size_t npop)
 -{
 - ssize_t n;
 - size_t len = strlen(buf[npop]);
 -
 - memmove(buf, buf[npop], len + 1);
 - n = read(fd, buf[len], size - len - 1);
 - if (n  0)
 - return -errno;
 -
 - buf[len + n] = '\0';
 - return 1;
 -}
 -
 -/*
 - * This will return 1, with the first character in buf being the
 - * character following the next instance of c in the file.  This will
 - * read the file as needed.  If there's an error, -errno is returned;
 - * if the end of the file is reached, 0 is returned.
 - */
 -static int next(int fd, char *buf, size_t size, char c)
 -{
 - ssize_t n;
 - char *ptr;
 -
 - while ((ptr = strchr(buf, c)) == NULL) {
 - n = read(fd, buf, size - 1);
 - if (n == 0)
 - return 0;
 - else if (n  0)
 - return -errno;
 -
 - buf[n] = '\0';
 + printf(Checking if %s is on tmpfs..., dir);
 + if (statfs(dir, st)  0) {
 + printf(%s\n, strerror(errno));
 + } else if (st.f_type != TMPFS_MAGIC) {
 + printf(no\n);
 + } else {
 + printf(OK\n);
 + return 0;
   }
 -
 - return pop(fd, buf, size, ptr - buf + 1);
 + return -1;
  }
  
  /*
 - * Decode an octal-escaped and space-terminated path of the form used by
 - * /proc/mounts. May be used to decode a path in-place. out must be at 
 least
 - * as large as the input. The output is always null-terminated. len gets 
 the
 - * length of the output, excluding the trailing null. Returns 0 if a full 
 path
 - * was successfully decoded, otherwise an error.
 + * Choose the tempdir to use. We want something on tmpfs so that our memory 
 is
 + * not subject to the host's vm.dirty_ratio. If a tempdir is specified in the
 + * environment, we use that even if it's not on tmpfs, but we warn the user.
 + * Otherwise, we try common tmpfs locations, and if no tmpfs directory is 
 found
 + * then we fall back to /tmp.
   */
 -static int decode_path(const char *in, char *out, size_t *len)
 +static char * __init choose_tempdir(void)
  {
 - char *first = out;
 -  

Re: [uml-devel] [PATCH] arch: um: kernel: skas: mmu: remove pmd_free() and pud_free() for failure processing in init_stub_pte()

2013-11-13 Thread Richard Weinberger
Am 13.11.2013 06:06, schrieb Chen Gang:
 Unfortunately, p?d_alloc() and p?d_free() are not pair!! If p?d_alloc()
 succeed, they may be used, so in the next failure, we have to skip them
 to let exit_mmap() or do_munmap() to process it.
 
 According to Documentation/vm/locking, 'mm-page_table_lock' is for
 using vma list, so not need it when its related vmas are detached or
 unmapped from using vma list.
 
 The related work flow:
 
   exit_mmap() -
 unmap_vmas(); /* so not need mm-page_table_lock */
 free_pgtables();
 
   do_munmap()-
 detach_vmas_to_be_unmapped(); /* so not need mm-page_table_lock */
 unmap_region() -
   free_pgtables();
 
   free_pgtables() -
 free_pgd_range() -
   free_pud_range() -
 free_pmd_range() -
   free_pte_range() -
 pmd_clear();
 pte_free_tlb();
   pud_clear();
   pmd_free_tlb();
 pgd_clear(); 
 pud_free_tlb();
 
 
 Signed-off-by: Chen Gang gang.c...@asianux.com

Sounds reasonable to me.
*But* there are patches you from out there that tried to fix similar issues and 
got reverted later.
Now I'm a bit nervous and want a ACK from mm folks to have this verified.
It's not that I don't trust you, but I really don't trust you. ;-)

Thanks,
//richard

--
DreamFactory - Open Source REST  JSON Services for HTML5  Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471iu=/4140/ostg.clktrk
___
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] arch: um: kernel: skas: mmu: remove pmd_free() and pud_free() for failure processing in init_stub_pte()

2013-11-13 Thread Richard Weinberger
Am 14.11.2013 08:33, schrieb Chen Gang:
 On 11/14/2013 02:48 PM, Chen Gang wrote:
 From the look of it, if an error did occur in init_stub_pte(),
 then the special mapping of STUB_CODE and STUB_DATA would not
 be installed, so this area would be invisible to munmap and exit,
 and with your patch then the pages allocated likely to be leaked.

 It sounds reasonable to me: although 'pgd' related with 'mm', but they
 are not installed. But just like you said originally: better get ACK
 from some mm guys.


 Hmm... is it another issue: after STUB_CODE succeeds, but STUB_DATA
 fails, the STUB_CODE will be leaked.


 Which is not to say that the existing code is actually correct:
 you're probably right that it's technically wrong.  But it would
 be very hard to get init_stub_pte() to fail, and has anyone
 reported a problem with it?  My guess is not, and my own
 inclination to dabble here is zero.

 Yeah.

 
 If we can not get ACK from any mm guys, and we have no enough time
 resource to read related source code, for me, I still recommend to
 remove p?d_free() in failure processing.

It's rather easy, does your commit fix a real problem you are facing?
If the answer is yes we can talk.

Chen, If you really want to help us, please investigate into existing/real 
problems.
Toralf does a very good job in finding strange issues using trinity.
You could help him resolving the issue described in that thread:
[uml-devel] fuzz tested 32 bit user mode linux image hangs in 
radix_tree_next_chunk()

Thanks,
//richard

--
DreamFactory - Open Source REST  JSON Services for HTML5  Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471iu=/4140/ostg.clktrk
___
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 11/11] um: use generic fixmap.h

2013-11-12 Thread Richard Weinberger
Am 12.11.2013 14:22, schrieb Mark Salter:
 Signed-off-by: Mark Salter msal...@redhat.com
 CC: Jeff Dike jd...@addtoit.com
 CC: Richard Weinberger rich...@nod.at
 CC: user-mode-linux-devel@lists.sourceforge.net
 ---
  arch/um/include/asm/fixmap.h | 40 +---
  1 file changed, 1 insertion(+), 39 deletions(-)

Acked-by: Richard Weinberger rich...@nod.at

Thanks,
//richard

--
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231iu=/4140/ostg.clktrk
___
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 17/17] um: Remove unused declarations from as-layout.h

2013-11-12 Thread Richard Weinberger
Am 12.11.2013 20:42, schrieb Geert Uytterhoeven:
 _end is used, but it's already provided by asm/sections.h, so use that.
 
 Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
 Cc: Richard Weinberger rich...@nod.at
 Cc: user-mode-linux-devel@lists.sourceforge.net

Geert, do you want me to pickup this patch or takes Andrew the whole series?

Acked-by: Richard Weinberger rich...@nod.at

Thanks,
//richard

 ---
  arch/um/include/shared/as-layout.h |3 ---
  arch/um/kernel/um_arch.c   |1 +
  2 files changed, 1 insertion(+), 3 deletions(-)
 
 diff --git a/arch/um/include/shared/as-layout.h 
 b/arch/um/include/shared/as-layout.h
 index 694c792bab4e..41c8c774ec10 100644
 --- a/arch/um/include/shared/as-layout.h
 +++ b/arch/um/include/shared/as-layout.h
 @@ -44,7 +44,6 @@ struct cpu_task {
  
  extern struct cpu_task cpu_tasks[];
  
 -extern unsigned long low_physmem;
  extern unsigned long high_physmem;
  extern unsigned long uml_physmem;
  extern unsigned long uml_reserved;
 @@ -52,8 +51,6 @@ extern unsigned long end_vm;
  extern unsigned long start_vm;
  extern unsigned long long highmem;
  
 -extern unsigned long _stext, _etext, _sdata, _edata, __bss_start, _end;
 -extern unsigned long _unprotected_end;
  extern unsigned long brk_start;
  
  extern unsigned long host_task_size;
 diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
 index 9fce866b0416..c44139833212 100644
 --- a/arch/um/kernel/um_arch.c
 +++ b/arch/um/kernel/um_arch.c
 @@ -17,6 +17,7 @@
  #include asm/byteorder.h
  #include asm/pgtable.h
  #include asm/processor.h
 +#include asm/sections.h
  #include asm/setup.h
  #include as-layout.h
  #include arch.h
 


--
DreamFactory - Open Source REST  JSON Services for HTML5  Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471iu=/4140/ostg.clktrk
___
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] fuzz tested 32 bit user mode linux image hangs in radix_tree_next_chunk()

2013-11-10 Thread Richard Weinberger
Am 10.11.2013 16:14, schrieb Toralf Förster:
 On 11/06/2013 10:31 PM, Richard Weinberger wrote:
 Am 06.11.2013 22:18, schrieb Toralf Förster:
 On 11/06/2013 05:06 PM, Konstantin Khlebnikov wrote:
 In this case it must stop after scanning whole tree in line:
 /* Overflow after ~0UL */
 if (!index)
   return NULL;


 A fresh current example with latest git tree shows that lines 769 and 770 
 do alternate :

 Can you please ask gdb for the value of offset?

 Thanks,
 //richard

 
 With this change 
 
 diff --git a/lib/radix-tree.c b/lib/radix-tree.c
 index 7811ed3..b2e9db5 100644
 --- a/lib/radix-tree.c
 +++ b/lib/radix-tree.c
 @@ -767,6 +767,7 @@ restart:
 offset + 1);
 else
 while (++offset  RADIX_TREE_MAP_SIZE) {
 +   printk (node-slots[offset] %p 
 offeset %lu\n, node-slots[offset], offset);
 if (node-slots[offset])
 break;
 }

Make sure that you print only in case of a enless loop. i.e. add a loop counter
and start printing only if the loop was taken *very* often.

Thanks,
//richard

--
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231iu=/4140/ostg.clktrk
___
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] fuzz tested 32 bit user mode linux image hangs in radix_tree_next_chunk()

2013-11-09 Thread Richard Weinberger
Am 09.11.2013 20:07, schrieb Toralf Förster:
 On 11/06/2013 10:31 PM, Richard Weinberger wrote:
 Am 06.11.2013 22:18, schrieb Toralf Förster:
 On 11/06/2013 05:06 PM, Konstantin Khlebnikov wrote:
 In this case it must stop after scanning whole tree in line:
 /* Overflow after ~0UL */
 if (!index)
   return NULL;


 A fresh current example with latest git tree shows that lines 769 and 770 
 do alternate :

 Can you please ask gdb for the value of offset?

 Thanks,
 //richard

 
 Still trying to get those values. One attempt to do that was to replace -O2 
 with -O0 in the Makefile,
 but that resulted into this error :
 
   LD  kernel/built-in.o
   CC  mm/memory.o
 In function ‘zap_pmd_range’,
 inlined from ‘zap_pud_range’ at mm/memory.c:1265:8,
 inlined from ‘unmap_page_range’ at mm/memory.c:1290:8:
 mm/memory.c:1220:23: error: call to ‘__compiletime_assert_1220’ declared with 
 attribute error: BUILD_BUG failed
 mm/memory.c: In function ‘follow_page_mask’:
 mm/memory.c:1530:18: error: call to ‘__compiletime_assert_1530’ declared with 
 attribute error: BUILD_BUG failed
 make[1]: *** [mm/memory.o] Error 1
 make: *** [mm] Error 2
 
 
 With -O1 it compiled at least.

You cannot build Linux with -O1/O0.
Try printing the value using printk...

Thanks,
//richard

--
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231iu=/4140/ostg.clktrk
___
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] ARM Status

2013-11-06 Thread Richard Weinberger
On Wed, Nov 6, 2013 at 3:12 PM, Michael Wolf anath...@yahoo.com wrote:
 It has been a while so I thought I would re-up the question.   Are there any 
 efforts anywhere to port this to ARM?  If not, are there specific technical 
 blocking issues?

Not really.
If someone *really* wants a arm UML he has to a) invest some money or
b) do it on it's own.

In theory UML on arm should be doable. It may need some thinking
because of VIVT caches.
We'd also need PTRACE_SYSEMU and other ptrace() related stuff.

IIRC Al Viro had some thought regarding an arm port.
Al, can you please enlighten us?


 Thanks,
 mwolf

 --
 November Webinars for C, C++, Fortran Developers
 Accelerate application performance with scalable programming models. Explore
 techniques for threading, error checking, porting, and tuning. Get the most
 from the latest Intel processors and coprocessors. See abstracts and register
 http://pubads.g.doubleclick.net/gampad/clk?id=60136231iu=/4140/ostg.clktrk
 ___
 User-mode-linux-devel mailing list
 User-mode-linux-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel



-- 
Thanks,
//richard

--
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231iu=/4140/ostg.clktrk
___
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] fuzz tested 32 bit user mode linux image hangs in radix_tree_next_chunk()

2013-11-06 Thread Richard Weinberger
Am 06.11.2013 22:18, schrieb Toralf Förster:
 On 11/06/2013 05:06 PM, Konstantin Khlebnikov wrote:
 In this case it must stop after scanning whole tree in line:
 /* Overflow after ~0UL */
 if (!index)
   return NULL;

 
 A fresh current example with latest git tree shows that lines 769 and 770 do 
 alternate :

Can you please ask gdb for the value of offset?

Thanks,
//richard

 
 tfoerste@n22 ~/devel/linux $ sudo gdb /usr/local/bin/linux-v3.12-48-gbe408cd 
 16619 -n -batch -ex bt
 0x08296a8c in radix_tree_next_chunk (root=0x25, iter=0x462e7c64, flags=12) at 
 lib/radix-tree.c:770
 770 if (node-slots[offset])
 #0  0x08296a8c in radix_tree_next_chunk (root=0x25, iter=0x462e7c64, 
 flags=12) at lib/radix-tree.c:770
 #1  0x080cc1fe in find_get_pages (mapping=0x462ad470, start=0, nr_pages=14, 
 pages=0xc) at mm/filemap.c:844
 #2  0x080d5d6a in pagevec_lookup (pvec=0x462e7cc8, mapping=0x25, start=37, 
 nr_pages=37) at mm/swap.c:914
 #3  0x080d615a in truncate_inode_pages_range (mapping=0x462ad470, lstart=0, 
 lend=-1) at mm/truncate.c:241
 #4  0x080d64ff in truncate_inode_pages (mapping=0x25, lstart=51539607589) at 
 mm/truncate.c:358
 
 
 
 
 tfoerste@n22 ~/devel/linux $ sudo gdb /usr/local/bin/linux-v3.12-48-gbe408cd 
 16619 -n -batch -ex bt
 radix_tree_next_chunk (root=0x28, iter=0x462e7c64, flags=18) at 
 lib/radix-tree.c:769
 769 while (++offset  
 RADIX_TREE_MAP_SIZE) {
 #0  radix_tree_next_chunk (root=0x28, iter=0x462e7c64, flags=18) at 
 lib/radix-tree.c:769
 #1  0x080cc1fe in find_get_pages (mapping=0x462ad470, start=0, nr_pages=14, 
 pages=0x12) at mm/filemap.c:844
 #2  0x080d5d6a in pagevec_lookup (pvec=0x462e7cc8, mapping=0x28, start=40, 
 nr_pages=40) at mm/swap.c:914
 #3  0x080d615a in truncate_inode_pages_range (mapping=0x462ad470, lstart=0, 
 lend=-1) at mm/truncate.c:241
 #4  0x080d64ff in truncate_inode_pages (mapping=0x28, lstart=77309411368) at 
 mm/truncate.c:358
 #5  0x0825e388 in hostfs_evict_inode (inode=0x462ad3b8) at 
 fs/hostfs/hostfs_kern.c:242
 #6  0x0811a8df in evict (inode=0x462ad3b8) at fs/inode.c:549
 
 


--
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231iu=/4140/ostg.clktrk
___
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] uml: check length in exitcode_proc_write()

2013-11-01 Thread Richard Weinberger
Am 29.10.2013 20:06, schrieb Dan Carpenter:
 We don't cap the size of buffer from the user so we could write past
 the end of the array here.  Only root can write to this file.
 
 Reported-by: Nico Golde n...@ngolde.de
 Reported-by: Fabian Yamaguchi f...@goesec.de
 Signed-off-by: Dan Carpenter dan.carpen...@oracle.com

Thanks everyone!
Patch applied and an it's way to Linus' tree.

Thanks,
//richard

 diff --git a/arch/um/kernel/exitcode.c b/arch/um/kernel/exitcode.c
 index 829df49..41ebbfe 100644
 --- a/arch/um/kernel/exitcode.c
 +++ b/arch/um/kernel/exitcode.c
 @@ -40,9 +40,11 @@ static ssize_t exitcode_proc_write(struct file *file,
   const char __user *buffer, size_t count, loff_t *pos)
  {
   char *end, buf[sizeof(n\0)];
 + size_t size;
   int tmp;
  
 - if (copy_from_user(buf, buffer, count))
 + size = min(count, sizeof(buf));
 + if (copy_from_user(buf, buffer, size))
   return -EFAULT;
  
   tmp = simple_strtol(buf, end, 0);
 


--
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951iu=/4140/ostg.clktrk
___
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] fuzz tested 32 bit user mode linux image hangs at in histfs

2013-10-22 Thread Richard Weinberger
On Tue, Oct 22, 2013 at 5:16 PM, Toralf Förster toralf.foers...@gmx.de wrote:

 When I fuzz testing a 32 bit UML at a 32 bit host (guest 3.12.-rc6-x, host 
 3.11.6) with trinity
 and use hostfs for the victom files for trinity. then trintiy often hangs 
 while trying to finish.

 At the host I do have 1 process eating 100% CPU power of 1 core. A back trace 
 of thet linux process at the hosts gives :

 tfoerste@n22 ~ $ sudo gdb /usr/local/bin/linux-v3.12-rc6-57-g69c88dc 16749 -n 
 -batch -ex bt
 radix_tree_next_chunk (root=0x21, iter=0x47647c60, flags=12) at 
 lib/radix-tree.c:769
 769 while (++offset  
 RADIX_TREE_MAP_SIZE) {
 #0  radix_tree_next_chunk (root=0x21, iter=0x47647c60, flags=12) at 
 lib/radix-tree.c:769
 #1  0x080cc13e in find_get_pages (mapping=0x483ed240, start=0, nr_pages=14, 
 pages=0xc) at mm/filemap.c:844
 #2  0x080d5caa in pagevec_lookup (pvec=0x47647cc4, mapping=0x21, start=33, 
 nr_pages=33) at mm/swap.c:914
 #3  0x080d609a in truncate_inode_pages_range (mapping=0x483ed240, lstart=0, 
 lend=-1) at mm/truncate.c:241
 #4  0x080d643f in truncate_inode_pages (mapping=0x21, lstart=51539607585) at 
 mm/truncate.c:358
 #5  0x08260838 in hostfs_evict_inode (inode=0x483ed188) at 
 fs/hostfs/hostfs_kern.c:242
 #6  0x0811a8cf in evict (inode=0x483ed188) at fs/inode.c:549
 #7  0x0811b2ad in iput_final (inode=optimized out) at fs/inode.c:1391
 #8  iput (inode=0x483ed188) at fs/inode.c:1409
 #9  0x08117648 in dentry_iput (dentry=optimized out) at fs/dcache.c:331
 #10 d_kill (dentry=0x47d6d580, parent=0x47d95d10) at fs/dcache.c:477
 #11 0x08118068 in dentry_kill (dentry=optimized out, 
 unlock_on_failure=optimized out) at fs/dcache.c:586
 #12 dput (dentry=0x47d6d580) at fs/dcache.c:641
 #13 0x08104903 in __fput (file=0x47471840) at fs/file_table.c:264
 #14 0x0810496b in fput (work=0x47471840) at fs/file_table.c:282
 #15 0x08094496 in task_work_run () at kernel/task_work.c:123
 #16 0x0807efd2 in exit_task_work (task=optimized out) at 
 include/linux/task_work.h:21
 #17 do_exit (code=1196535808) at kernel/exit.c:787
 #18 0x0807f5dd in do_group_exit (exit_code=0) at kernel/exit.c:920
 #19 0x0807f649 in SYSC_exit_group (error_code=optimized out) at 
 kernel/exit.c:931
 #20 SyS_exit_group (error_code=0) at kernel/exit.c:929
 #21 0x08062984 in handle_syscall (r=0x4763b1d4) at 
 arch/um/kernel/skas/syscall.c:35
 #22 0x08074fb5 in handle_trap (local_using_sysemu=optimized out, 
 regs=optimized out, pid=optimized out) at 
 arch/um/os-Linux/skas/process.c:198
 #23 userspace (regs=0x4763b1d4) at arch/um/os-Linux/skas/process.c:431
 #24 0x0805f750 in fork_handler () at arch/um/kernel/process.c:160
 #25 0x in ?? ()


That trace is identical to the one you reported yesterday.
But this time no nfs is in the game, right?

 Last message of trinity's watchdog are :

 ...
 [watchdog] exit_reason=2, but 2 children still running.
 Bailing main loop. Exit reason: Reached maximum syscall count.
 [watchdog] Reached limit 10001. Telling children to exit.
 [watchdog] [1516] Watchdog exiting


 I'm unsure if this is only UML specific, interesting for the fs people or mm 
 or ... ?


 --
 MfG/Sincerely
 Toralf Förster
 pgp finger print: 7B1A 07F4 EC82 0F90 D4C2 8936 872A E508 7DB6 9DA3

 --
 October Webinars: Code for Performance
 Free Intel webinars can help you accelerate application performance.
 Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
 the latest Intel processors and coprocessors. See abstracts and register 
 http://pubads.g.doubleclick.net/gampad/clk?id=60135991iu=/4140/ostg.clktrk
 ___
 User-mode-linux-devel mailing list
 User-mode-linux-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel



-- 
Thanks,
//richard

--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60135991iu=/4140/ostg.clktrk
___
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] fuzz tested 32 bit user mode linux image hangs at in histfs

2013-10-22 Thread Richard Weinberger
Am 22.10.2013 18:23, schrieb Toralf Förster:
 On 10/22/2013 06:12 PM, Richard Weinberger wrote:
 On Tue, Oct 22, 2013 at 5:16 PM, Toralf Förster toralf.foers...@gmx.de 
 wrote:

 When I fuzz testing a 32 bit UML at a 32 bit host (guest 3.12.-rc6-x, host 
 3.11.6) with trinity
 and use hostfs for the victom files for trinity. then trintiy often hangs 
 while trying to finish.

 At the host I do have 1 process eating 100% CPU power of 1 core. A back 
 trace of thet linux process at the hosts gives :

 tfoerste@n22 ~ $ sudo gdb /usr/local/bin/linux-v3.12-rc6-57-g69c88dc 16749 
 -n -batch -ex bt
 radix_tree_next_chunk (root=0x21, iter=0x47647c60, flags=12) at 
 lib/radix-tree.c:769
 769 while (++offset  
 RADIX_TREE_MAP_SIZE) {
 #0  radix_tree_next_chunk (root=0x21, iter=0x47647c60, flags=12) at 
 lib/radix-tree.c:769
 #1  0x080cc13e in find_get_pages (mapping=0x483ed240, start=0, nr_pages=14, 
 pages=0xc) at mm/filemap.c:844
 #2  0x080d5caa in pagevec_lookup (pvec=0x47647cc4, mapping=0x21, start=33, 
 nr_pages=33) at mm/swap.c:914
 #3  0x080d609a in truncate_inode_pages_range (mapping=0x483ed240, lstart=0, 
 lend=-1) at mm/truncate.c:241
 #4  0x080d643f in truncate_inode_pages (mapping=0x21, lstart=51539607585) 
 at mm/truncate.c:358
 #5  0x08260838 in hostfs_evict_inode (inode=0x483ed188) at 
 fs/hostfs/hostfs_kern.c:242
 #6  0x0811a8cf in evict (inode=0x483ed188) at fs/inode.c:549
 #7  0x0811b2ad in iput_final (inode=optimized out) at fs/inode.c:1391
 #8  iput (inode=0x483ed188) at fs/inode.c:1409
 #9  0x08117648 in dentry_iput (dentry=optimized out) at fs/dcache.c:331
 #10 d_kill (dentry=0x47d6d580, parent=0x47d95d10) at fs/dcache.c:477
 #11 0x08118068 in dentry_kill (dentry=optimized out, 
 unlock_on_failure=optimized out) at fs/dcache.c:586
 #12 dput (dentry=0x47d6d580) at fs/dcache.c:641
 #13 0x08104903 in __fput (file=0x47471840) at fs/file_table.c:264
 #14 0x0810496b in fput (work=0x47471840) at fs/file_table.c:282
 #15 0x08094496 in task_work_run () at kernel/task_work.c:123
 #16 0x0807efd2 in exit_task_work (task=optimized out) at 
 include/linux/task_work.h:21
 #17 do_exit (code=1196535808) at kernel/exit.c:787
 #18 0x0807f5dd in do_group_exit (exit_code=0) at kernel/exit.c:920
 #19 0x0807f649 in SYSC_exit_group (error_code=optimized out) at 
 kernel/exit.c:931
 #20 SyS_exit_group (error_code=0) at kernel/exit.c:929
 #21 0x08062984 in handle_syscall (r=0x4763b1d4) at 
 arch/um/kernel/skas/syscall.c:35
 #22 0x08074fb5 in handle_trap (local_using_sysemu=optimized out, 
 regs=optimized out, pid=optimized out) at 
 arch/um/os-Linux/skas/process.c:198
 #23 userspace (regs=0x4763b1d4) at arch/um/os-Linux/skas/process.c:431
 #24 0x0805f750 in fork_handler () at arch/um/kernel/process.c:160
 #25 0x in ?? ()


 That trace is identical to the one you reported yesterday.
 But this time no nfs is in the game, right?

 
 Right - I could narrow down it in the meanwhile to hostfs only. First I
 argued if NFS sometimes might force the issue to happen later but in the
 mean while I don't think so.

It looks like we never find a way out of the while(1) in
radix_tree_next_chunk().

Thanks,
//richard

--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60135991iu=/4140/ostg.clktrk
___
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 1/8] um: Create defconfigs for i386 and x86_64

2013-09-27 Thread Richard Weinberger
Am 27.09.2013 11:22, schrieb Toralf Förster:
 On 09/26/2013 12:35 PM, Richard Weinberger wrote:
 Am 26.09.2013 12:20, schrieb Ramkumar Ramachandra:
 Richard Weinberger wrote:
 This patch is based on: https://lkml.org/lkml/2013/7/4/396

 Cc: Ramkumar Ramachandra artag...@gmail.com
 Signed-off-by: Richard Weinberger rich...@nod.at
 ---
  arch/um/configs/i386_defconfig   | 954 
 +++
  arch/um/configs/x86_64_defconfig | 943 
 ++
  2 files changed, 1897 insertions(+)
  create mode 100644 arch/um/configs/i386_defconfig
  create mode 100644 arch/um/configs/x86_64_defconfig

 First, I'm pissed that the upstream tree doesn't build and run out of
 the box months after I submitted a fix in July (and it's September
 now). Fact that you dropped my sane patches aside and decided to write
 a much larger series aside, user-mode Linux in upstream is broken.
 This means that any user who does:

 $ ARCH=um make defconfig
 $ ARCH=um make

 will end up with a *broken* Linux _today_. Unless the user is living
 in the Stone Age with a 32-bit computer, this is what she will see
 when she attempts to boot up Linux:
 
 :-{
 
 Grmpf
 
 There are a lot of 32 bit user land linux installation (beside my own,
 look at the x86 Gentoo world) in the wild - even running on modern 64bit
 CPUs. The simple reason is that those installations run fine and the
 performance boost of 64bit often isn't worth a new reinstallation.

You *can* of course run 32bit userland on UML. Just create a 32bit UML on 
x86_64.

make defconfig ARCH=um SUBARCH=i386
make linux ARCH=um SUBARCH=i386

This will work on x86_64 and x86 hosts.

Thanks,
//richard

--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60133471iu=/4140/ostg.clktrk
___
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 1/8] um: Create defconfigs for i386 and x86_64

2013-09-26 Thread Richard Weinberger
Am 26.09.2013 12:20, schrieb Ramkumar Ramachandra:
 Richard Weinberger wrote:
 This patch is based on: https://lkml.org/lkml/2013/7/4/396

 Cc: Ramkumar Ramachandra artag...@gmail.com
 Signed-off-by: Richard Weinberger rich...@nod.at
 ---
  arch/um/configs/i386_defconfig   | 954 
 +++
  arch/um/configs/x86_64_defconfig | 943 
 ++
  2 files changed, 1897 insertions(+)
  create mode 100644 arch/um/configs/i386_defconfig
  create mode 100644 arch/um/configs/x86_64_defconfig
 
 First, I'm pissed that the upstream tree doesn't build and run out of
 the box months after I submitted a fix in July (and it's September
 now). Fact that you dropped my sane patches aside and decided to write
 a much larger series aside, user-mode Linux in upstream is broken.
 This means that any user who does:
 
 $ ARCH=um make defconfig
 $ ARCH=um make
 
 will end up with a *broken* Linux _today_. Unless the user is living
 in the Stone Age with a 32-bit computer, this is what she will see
 when she attempts to boot up Linux:

Not here.

 $ file linux
 linux: ELF 32-bit LSB  executable, Intel 80386, version 1 (SYSV),
 dynamically linked (uses shared libs), for GNU/Linux 2.6.32, not
 stripped
 $ ./linux ubd0=busybox-rootfs
 [...]
 Kernel panic - not syncing: No init found.  Try passing init= option
 to kernel. See Linux Documentation/init.txt for guidance.

I don't know that rootfs but it looks like there is no init.

 CPU: 0 PID: 1 Comm: swapper Not tainted 3.12.0-rc2-00083-g4b97280 #1
 0b869fbc 08272f87 0b869fdc 0820c5cd 0001   
0b869fe8 0820c126 08252593 0b869ff8 08059317  0001 
 0b869f94:  [0805a11c] show_stack+0x54/0x8c
 0b869fb4:  [0820e3c8] dump_stack+0x16/0x1b
 0b869fc8:  [0820c5cd] panic+0x67/0x149
 0b869fe0:  [0820c126] kernel_init+0xab/0xaf
 0b869fec:  [08059317] new_thread_handler+0x63/0x7c
 0b869ffc:  [] 0x0
 
 
 EIP: 0023:[f7717430] CPU: 0 Not tainted ESP: 002b:ffc386dc EFLAGS: 0296
 Not tainted
 EAX:  EBX: 63ba ECX: 0013 EDX: 63ba
 ESI: 63b6 EDI: 0002 EBP: ffc38708 DS: 002b ES: 002b
 0b869f44:  [0806aff4] show_regs+0xb4/0xbc
 0b869f70:  [0805b23b] panic_exit+0x20/0x36
 0b869f84:  [0808521b] notifier_call_chain+0x28/0x4b
 0b869fac:  [0808526c] atomic_notifier_call_chain+0x15/0x17
 0b869fbc:  [0820c5de] panic+0x78/0x149
 0b869fe0:  [0820c126] kernel_init+0xab/0xaf
 0b869fec:  [08059317] new_thread_handler+0x63/0x7c
 0b869ffc:  [] 0x0
 
 [1]25526 abort (core dumped)  linux ubd0=busybox-rootfs
%
 
 Rubbish.

UML core dumps at panic() by design.

 When I rebase my original patches (exactly 2 small independent
 patches) onto the new upstream, stuff works as usual. If you're not
 convinced, try the um-build branch from
 https://github.com/artagnon/linux for yourself.

 Are you against accepting good patches and stalling work? What is your
 plan exactly?

Sure, my great plan is to destroy Linux. I work for Microsoft. ;-)

Seriously, my plan is to get rid of SUBARCH, that's why I did not push your 
patches
upstream and I've send the rid of SUBARCH patch series.
It turned out that other archs depend on SUBARCH too therefore some more 
thinking is needed.
Time passed, merge window closed, $dayjob needed some attention...

That said, your arch/um: make it work with defconfig and x86_64 patch is also 
not perfect.
make defconfig ARCH=um SUBARCH=x86 will create x86_64 defconfig, which is 
wrong and breaks existing
setups.
Secondly, what stops you from running make defconfig ARCH=um SUBARCH=x86_64 
to run your x86_64 bit
userspace?

Thanks,
//richard

--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60133471iu=/4140/ostg.clktrk
___
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 1/8] um: Create defconfigs for i386 and x86_64

2013-09-26 Thread Richard Weinberger
Am 26.09.2013 13:57, schrieb Ramkumar Ramachandra:
 Richard Weinberger wrote:
 $ file linux
 linux: ELF 32-bit LSB  executable, Intel 80386, version 1 (SYSV),
 dynamically linked (uses shared libs), for GNU/Linux 2.6.32, not
 stripped
 $ ./linux ubd0=busybox-rootfs
 [...]
 Kernel panic - not syncing: No init found.  Try passing init= option
 to kernel. See Linux Documentation/init.txt for guidance.

 I don't know that rootfs but it looks like there is no init.
 
 Ofcourse there's an init on the busybox-rootfs, and I'm able to boot
 it with an x86_64 Linux. The reason for panic is incorrect: I think
 (although not sure) a 32-bit rootfs userland will work.

A 32Bit UML kernel can run 32Bit users, a 64Bit UML kernel can only
run 64Bit userland. We have no 32Bit compat layer on x86_64.
Patches are welcome.

 [1]25526 abort (core dumped)  linux ubd0=busybox-rootfs
%

 Rubbish.

 UML core dumps at panic() by design.
 
 On a related note, why does it screw up my terminal? I have to `reset`
 to get a nice working terminal.

I really don't know. That is not by design.

 Seriously, my plan is to get rid of SUBARCH, that's why I did not push your 
 patches
 upstream and I've send the rid of SUBARCH patch series.
 It turned out that other archs depend on SUBARCH too therefore some more 
 thinking is needed.
 Time passed, merge window closed, $dayjob needed some attention...
 
 Don't let some grand plan stall reasonable patches that fix immediate 
 problems.
 
 That said, your arch/um: make it work with defconfig and x86_64 patch is 
 also not perfect.
 make defconfig ARCH=um SUBARCH=x86 will create x86_64 defconfig, which is 
 wrong and breaks existing
 setups.
 
 Wrong.
 
   $ make defconfig ARCH=um SUBARCH=i386
   *** Default configuration is based on 'i386_defconfig'
   #
   # configuration written to .config
   #

I wrote SUBARCH=x86 *not* SUBARCH=i386.

Again, if SUBARCH=x86 works too I'll happily merge it.
But as of now it breaks existing setups.

Thanks,
//richard

--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60133471iu=/4140/ostg.clktrk
___
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 2/8] um: Do not use SUBARCH

2013-09-26 Thread Richard Weinberger
Am 26.09.2013 13:43, schrieb Ramkumar Ramachandra:
 Richard Weinberger wrote:
 Auto-detection of SUBARCH, which can be done with a simple call to
 uname -m (the 90% case). The second patch I submitted prevented
 spawning xterms unnecessarily, which we discussed was a good move.

 Covering only 90% of all cases is not enough.
 We must not break existing setups.
 That's also why my Get rid of SUBARCH series is not upstream.
 
 Mine covers 100% of the cases. My series is about auto-detection of
 SUBARCH, not its removal: you can still set a SUBARCH from the
 command-line; existing setups don't break.

I told you already that make defconfig ARCH=um SUBARCH=x86 will spuriously
create a x86_64 config on x86_64.
This breaks existing setups.

 Your second patch changed CONFIG_CON_CHAN to pts, which is ok but not
 a major issue.
 
 Major or minor is purely your classification: don't impose your
 value judgement on reasonable patches. I am the user, and I demand a
 pleasant build process and ui. Moreover, how do you expect more
 contributions to come in until existing patches make it to upstream?
 
 The xterms are also not spawning unnecessarily they spawn upon a tty device 
 is opened.
 With your patch UML create another pts. Thus, the spawning is hidden...
 
 It connects to an existing host pts device instead of spawning a new
 xterm and connecting to the console io on that. Why is that not
 desirable?
 
 I did not push it upstream because it depended on your first one and as I 
 said, it's not critical.
 This does not mean that I moved it to /dev/null.
 
 ... and you still haven't told me what's wrong with my first patch.
 
 Again, the plan is to get rid of SUBARCH at all.
 
 You've been harping about this plan for the last N months, and nothing
 has happened so far. It's time to stop planning, and accept good work.

I sent the series on Aug 21st.
Do the maths, it's not N months...

 make defconfig ARCH=um SUBARCH=x86 (or SUBARCH=i386) will create a 
 defconfig for 32bit.
 make defconfig ARCH=um SUBARCH=x86_64 one for 64bit.

 Yes, that's how I prepared the patch in the first place.

 So, nothing is broken.
 
 So the user is Ugly and Stupid for expecting:
 
   $ 
   $ make -j 8 ARCH=um
 
 to work? Stop denying problems, no matter how major or minor they are.

make defconfig ARCH=um creates a defconfig for x86 as it always did.
If you want to run a x86_64 bit user space, create a x86_64 defconfig.

 If you want make defconfig ARCH=um creating a defconfig for the correct 
 arch you need
 more than your first patch.
 
 No, you don't. Try it for yourself and see. Set a SUBARCH if you like,
 and it'll still work fine.
 
 Again, Get rid of SUBARCH series has the same goal.
 
 For the last time, getting rid of SUBARCH is Wrong and Undesirable.

That's your opinion.

 -- 8 --
 Here's a transcript spoonfeeding you the impact of my first patch:
 
   $ make defconfig ARCH=um SUBARCH=i386
   *** Default configuration is based on 'i386_defconfig'
   #
   # configuration written to .config
   #
   $ make defconfig ARCH=um SUBARCH=x86_64
   *** Default configuration is based on 'x86_64_defconfig'
   #
   # configuration written to .config
   #
   $ make defconfig ARCH=um
   *** Default configuration is based on 'x86_64_defconfig'
   #
   # configuration written to .config
   #
 
 In the last case, notice how defconfig automatically picks up
 x86_64_defconfig correctly: if I were on an i386 machine, it would
 have picked up i386_defconfig like in the first case. Without my
 patch, the last case would have incorrectly picked up an i386
 defconfig, which is Stupid and Wrong.

You missed SUBARCH=x86.

That said, if you cover all cases I'll happily merge that.
And honestly, your patches are minor stuff, they don't even touch C source 
files.
Acting up like you do just because of some default values is crazy.
We have more serious problems so solve.

Thanks,
//richard

--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60133471iu=/4140/ostg.clktrk
___
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 2/8] um: Do not use SUBARCH

2013-09-26 Thread Richard Weinberger
Am 26.09.2013 12:53, schrieb Ramkumar Ramachandra:
 Richard Weinberger wrote:
 So, what exactly is broken in upstream?
 make defconfig works as it always did.
 
 Auto-detection of SUBARCH, which can be done with a simple call to
 uname -m (the 90% case). The second patch I submitted prevented
 spawning xterms unnecessarily, which we discussed was a good move.

Covering only 90% of all cases is not enough.
We must not break existing setups.
That's also why my Get rid of SUBARCH series is not upstream.

Your second patch changed CONFIG_CON_CHAN to pts, which is ok but not
a major issue.
The xterms are also not spawning unnecessarily they spawn upon a tty device is 
opened.
With your patch UML create another pts. Thus, the spawning is hidden...
I did not push it upstream because it depended on your first one and as I said, 
it's not critical.
This does not mean that I moved it to /dev/null.
Again, the plan is to get rid of SUBARCH at all.

 make defconfig ARCH=um SUBARCH=x86 (or SUBARCH=i386) will create a defconfig 
 for 32bit.
 make defconfig ARCH=um SUBARCH=x86_64 one for 64bit.
 
 Yes, that's how I prepared the patch in the first place.

So, nothing is broken.

If you want make defconfig ARCH=um creating a defconfig for the correct arch 
you need
more than your first patch. Again, Get rid of SUBARCH series has the same 
goal.

Thanks,
//richard

--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register 
http://pubads.g.doubleclick.net/gampad/clk?id=60133471iu=/4140/ostg.clktrk
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 2/4] um: Make stack trace reliable against kernel mode faults

2013-09-23 Thread Richard Weinberger
As UML uses an alternative signal stack we cannot use
the current stack pointer for stack dumping if UML itself
dies by SIGSEGV. To bypass this issue we save regs taken
from mcontext in our segv handler into thread_struct and
use these regs to obtain the stack pointer in show_stack().

Signed-off-by: Richard Weinberger rich...@nod.at
---
 arch/um/include/asm/processor-generic.h |  1 +
 arch/um/include/shared/os.h |  1 +
 arch/um/kernel/sysrq.c  | 32 +++-
 arch/um/kernel/trap.c   | 14 +++---
 arch/um/os-Linux/signal.c   |  8 
 5 files changed, 44 insertions(+), 12 deletions(-)

diff --git a/arch/um/include/asm/processor-generic.h 
b/arch/um/include/asm/processor-generic.h
index c03cd5a..9046903 100644
--- a/arch/um/include/asm/processor-generic.h
+++ b/arch/um/include/asm/processor-generic.h
@@ -21,6 +21,7 @@ struct mm_struct;
 struct thread_struct {
struct task_struct *saved_task;
struct pt_regs regs;
+   struct pt_regs *segv_regs;
int singlestep_syscall;
void *fault_addr;
jmp_buf *fault_catcher;
diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h
index 021104d..75298d3 100644
--- a/arch/um/include/shared/os.h
+++ b/arch/um/include/shared/os.h
@@ -227,6 +227,7 @@ extern void block_signals(void);
 extern void unblock_signals(void);
 extern int get_signals(void);
 extern int set_signals(int enable);
+extern int os_is_signal_stack(void);
 
 /* util.c */
 extern void stack_protections(unsigned long address);
diff --git a/arch/um/kernel/sysrq.c b/arch/um/kernel/sysrq.c
index 33cc72e..7122bf9 100644
--- a/arch/um/kernel/sysrq.c
+++ b/arch/um/kernel/sysrq.c
@@ -12,6 +12,7 @@
 #include linux/module.h
 #include linux/sched.h
 #include asm/sysrq.h
+#include os.h
 
 struct stack_frame {
struct stack_frame *next_frame;
@@ -48,29 +49,42 @@ static void print_stack_trace(unsigned long *sp, unsigned 
long bp)
 /*Stolen from arch/i386/kernel/traps.c */
 static const int kstack_depth_to_print = 24;
 
-static unsigned long get_frame_pointer(struct task_struct *task)
+static unsigned long get_frame_pointer(struct task_struct *task,
+  struct pt_regs *segv_regs)
 {
if (!task || task == current)
-   return current_bp();
+   return segv_regs ? PT_REGS_BP(segv_regs) : current_bp();
else
return KSTK_EBP(task);
 }
 
+static unsigned long *get_stack_pointer(struct task_struct *task,
+   struct pt_regs *segv_regs)
+{
+   if (!task || task == current)
+   return segv_regs ? (unsigned long *)PT_REGS_SP(segv_regs) : 
current_sp();
+   else
+   return (unsigned long *)KSTK_ESP(task);
+}
+
 void show_stack(struct task_struct *task, unsigned long *stack)
 {
unsigned long *sp = stack, bp = 0;
+   struct pt_regs *segv_regs = current-thread.segv_regs;
int i;
 
+   if (!segv_regs  os_is_signal_stack()) {
+   printk(KERN_ERR Received SIGSEGV in SIGSEGV handler,
+aborting stack trace!\n);
+   return;
+   }
+
 #ifdef CONFIG_FRAME_POINTER
-   bp = get_frame_pointer(task);
+   bp = get_frame_pointer(task, segv_regs);
 #endif
 
-   if (!stack) {
-   if (!task || task == current)
-   sp = current_sp();
-   else
-   sp = (unsigned long *)KSTK_ESP(task);
-   }
+   if (!stack)
+   sp = get_stack_pointer(task, segv_regs);
 
printk(KERN_INFO Stack:\n);
stack = sp;
diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c
index 5c3aef7..974b874 100644
--- a/arch/um/kernel/trap.c
+++ b/arch/um/kernel/trap.c
@@ -206,9 +206,12 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, 
int is_user,
int is_write = FAULT_WRITE(fi);
unsigned long address = FAULT_ADDRESS(fi);
 
+   if (regs)
+   current-thread.segv_regs = container_of(regs, struct pt_regs, 
regs);
+
if (!is_user  (address = start_vm)  (address  end_vm)) {
flush_tlb_kernel_vm();
-   return 0;
+   goto out;
}
else if (current-mm == NULL) {
show_regs(container_of(regs, struct pt_regs, regs));
@@ -230,7 +233,7 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, 
int is_user,
 
catcher = current-thread.fault_catcher;
if (!err)
-   return 0;
+   goto out;
else if (catcher != NULL) {
current-thread.fault_addr = (void *) address;
UML_LONGJMP(catcher, 1);
@@ -238,7 +241,7 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, 
int is_user,
else if (current-thread.fault_addr != NULL)
panic(fault_addr set but no fault catcher);
else if (!is_user

[uml-devel] [PATCH 3/4] um: Get rid of thread_struct-saved_task

2013-09-23 Thread Richard Weinberger
As we have a sane show_stack() now, we can drop
the -saved_task hack.

Signed-off-by: Richard Weinberger rich...@nod.at
---
 arch/um/drivers/mconsole_kern.c |  6 ++
 arch/um/include/asm/processor-generic.h |  1 -
 arch/um/kernel/process.c| 15 ++-
 3 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index 3df3bd5..29880c9 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -645,11 +645,9 @@ void mconsole_sysrq(struct mc_request *req)
 
 static void stack_proc(void *arg)
 {
-   struct task_struct *from = current, *to = arg;
+   struct task_struct *task = arg;
 
-   to-thread.saved_task = from;
-   rcu_user_hooks_switch(from, to);
-   switch_to(from, to, from);
+   show_stack(task, NULL);
 }
 
 /*
diff --git a/arch/um/include/asm/processor-generic.h 
b/arch/um/include/asm/processor-generic.h
index 9046903..d89b02b 100644
--- a/arch/um/include/asm/processor-generic.h
+++ b/arch/um/include/asm/processor-generic.h
@@ -19,7 +19,6 @@ struct task_struct;
 struct mm_struct;
 
 struct thread_struct {
-   struct task_struct *saved_task;
struct pt_regs regs;
struct pt_regs *segv_regs;
int singlestep_syscall;
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index bbcef52..eecc414 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -82,19 +82,8 @@ void *__switch_to(struct task_struct *from, struct 
task_struct *to)
to-thread.prev_sched = from;
set_current(to);
 
-   do {
-   current-thread.saved_task = NULL;
-
-   switch_threads(from-thread.switch_buf,
-  to-thread.switch_buf);
-
-   arch_switch_to(current);
-
-   if (current-thread.saved_task)
-   show_regs((current-thread.regs));
-   to = current-thread.saved_task;
-   from = current;
-   } while (current-thread.saved_task);
+   switch_threads(from-thread.switch_buf, to-thread.switch_buf);
+   arch_switch_to(current);
 
return current-thread.prev_sched;
 }
-- 
1.8.3.1


--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151iu=/4140/ostg.clktrk
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 4/4] um: Make kstack_depth_to_print conform to arch/x86

2013-09-23 Thread Richard Weinberger
Signed-off-by: Richard Weinberger rich...@nod.at
---
 arch/um/kernel/sysrq.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/um/kernel/sysrq.c b/arch/um/kernel/sysrq.c
index 7122bf9..4d6fdf6 100644
--- a/arch/um/kernel/sysrq.c
+++ b/arch/um/kernel/sysrq.c
@@ -46,9 +46,6 @@ static void print_stack_trace(unsigned long *sp, unsigned 
long bp)
printk(KERN_INFO \n);
 }
 
-/*Stolen from arch/i386/kernel/traps.c */
-static const int kstack_depth_to_print = 24;
-
 static unsigned long get_frame_pointer(struct task_struct *task,
   struct pt_regs *segv_regs)
 {
@@ -88,7 +85,7 @@ void show_stack(struct task_struct *task, unsigned long 
*stack)
 
printk(KERN_INFO Stack:\n);
stack = sp;
-   for (i = 0; i  kstack_depth_to_print; i++) {
+   for (i = 0; i  3 * STACKSLOTS_PER_LINE; i++) {
if (kstack_end(stack))
break;
if (i  ((i % STACKSLOTS_PER_LINE) == 0))
-- 
1.8.3.1


--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151iu=/4140/ostg.clktrk
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 1/4] um: Rewrite show_stack()

2013-09-23 Thread Richard Weinberger
Currently on UML stack traces are not very reliable and both
x86 and x86_64 have their on implementations.
This patch unifies both and adds support to outline unreliable
functions calls.

Signed-off-by: Richard Weinberger rich...@nod.at
---
 arch/um/kernel/sysrq.c | 85 ++
 arch/um/kernel/um_arch.c   |  1 -
 arch/x86/um/asm/processor_32.h |  5 +++
 arch/x86/um/asm/processor_64.h |  5 +++
 arch/x86/um/sysrq_32.c | 66 
 arch/x86/um/sysrq_64.c |  8 +---
 6 files changed, 64 insertions(+), 106 deletions(-)

diff --git a/arch/um/kernel/sysrq.c b/arch/um/kernel/sysrq.c
index 0dc4d1c..33cc72e 100644
--- a/arch/um/kernel/sysrq.c
+++ b/arch/um/kernel/sysrq.c
@@ -1,6 +1,10 @@
 /*
  * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
- * Licensed under the GPL
+ * Copyright (C) 2013 Richard Weinberger ric...@nod.at
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
  */
 
 #include linux/kallsyms.h
@@ -9,58 +13,75 @@
 #include linux/sched.h
 #include asm/sysrq.h
 
-/* Catch non-i386 SUBARCH's. */
-#if !defined(CONFIG_UML_X86) || defined(CONFIG_64BIT)
-void show_trace(struct task_struct *task, unsigned long * stack)
+struct stack_frame {
+   struct stack_frame *next_frame;
+   unsigned long return_address;
+};
+
+static void print_stack_trace(unsigned long *sp, unsigned long bp)
 {
+   int reliable;
unsigned long addr;
+   struct stack_frame *frame = (struct stack_frame *)bp;
 
-   if (!stack) {
-   stack = (unsigned long*) stack;
-   WARN_ON(1);
-   }
-
-   printk(KERN_INFO Call Trace: \n);
-   while (((long) stack  (THREAD_SIZE-1)) != 0) {
-   addr = *stack;
+   printk(KERN_INFO Call Trace:\n);
+   while (((long) sp  (THREAD_SIZE-1)) != 0) {
+   addr = *sp;
if (__kernel_text_address(addr)) {
-   printk(KERN_INFO %08lx:  [%08lx],
-  (unsigned long) stack, addr);
-   print_symbol(KERN_CONT  %s, addr);
+   reliable = 0;
+   if ((unsigned long) sp == bp + sizeof(long)) {
+   frame = frame ? frame-next_frame : NULL;
+   bp = (unsigned long)frame;
+   reliable = 1;
+   }
+
+   printk(KERN_INFO  [%08lx], addr);
+   printk(KERN_CONT  %s, reliable ?  : ? );
+   print_symbol(KERN_CONT %s, addr);
printk(KERN_CONT \n);
}
-   stack++;
+   sp++;
}
printk(KERN_INFO \n);
 }
-#endif
 
 /*Stolen from arch/i386/kernel/traps.c */
 static const int kstack_depth_to_print = 24;
 
-/* This recently started being used in arch-independent code too, as in
- * kernel/sched/core.c.*/
-void show_stack(struct task_struct *task, unsigned long *esp)
+static unsigned long get_frame_pointer(struct task_struct *task)
+{
+   if (!task || task == current)
+   return current_bp();
+   else
+   return KSTK_EBP(task);
+}
+
+void show_stack(struct task_struct *task, unsigned long *stack)
 {
-   unsigned long *stack;
+   unsigned long *sp = stack, bp = 0;
int i;
 
-   if (esp == NULL) {
-   if (task != current  task != NULL) {
-   esp = (unsigned long *) KSTK_ESP(task);
-   } else {
-   esp = (unsigned long *) esp;
-   }
+#ifdef CONFIG_FRAME_POINTER
+   bp = get_frame_pointer(task);
+#endif
+
+   if (!stack) {
+   if (!task || task == current)
+   sp = current_sp();
+   else
+   sp = (unsigned long *)KSTK_ESP(task);
}
 
-   stack = esp;
+   printk(KERN_INFO Stack:\n);
+   stack = sp;
for (i = 0; i  kstack_depth_to_print; i++) {
if (kstack_end(stack))
break;
-   if (i  ((i % 8) == 0))
-   printk(KERN_INFO);
-   printk(KERN_CONT %08lx , *stack++);
+   if (i  ((i % STACKSLOTS_PER_LINE) == 0))
+   printk(KERN_CONT \n);
+   printk(KERN_CONT  %08lx, *stack++);
}
+   printk(KERN_CONT \n);
 
-   show_trace(task, esp);
+   print_stack_trace(sp, bp);
 }
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 87df5e3..b9dd13e 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -234,7 +234,6 @@ static int panic_exit(struct notifier_block *self, unsigned 
long unused1,
  void *unused2)
 {
bust_spinlocks(1

Re: [uml-devel] difference of a shell script versus command line WRT winch_thread : TIOCSCTTY failed on fd 1 err = 1

2013-09-22 Thread Richard Weinberger
Am 22.09.2013 11:20, schrieb Toralf Förster:
 On 09/22/2013 10:27 AM, Toralf Förster wrote:
 On 09/22/2013 08:52 AM, richard -rw- weinberger wrote:
 On Mon, Sep 16, 2013 at 10:04 PM, Toralf Förster toralf.foers...@gmx.de 
 wrote:
 If I run the following script

 $ cat l.sh
 #!/bin/sh
 #

 /usr/local/bin/linux-v3.11-8718-g0fb5ca1 earlyprintk 
 ubda=/home/tfoerste/virtual/uml/n22unst4 ubdb=/mnt/ramdisk/n22unst4_swap 
 eth0=tuntap,tap2,72:ef:3d:5d:d3:db mem=1025M con0=fd:0,fd:1 con=pts 
 umid=uml_n22unst4 rootfstype=ext4


 then during start of the UML I get

 ...
 Netdevice 0 (72:ef:3d:5d:d3:db) :
 TUN/TAP backend -
 winch_thread : TIOCSCTTY failed on fd 1 err = 1

 Hmm, that's a regression introduced by:
 commit 250127216dd6635f5730752d7444bdec992aecb0
 Author: Richard Weinberger rich...@nod.at
 Date:   Sun Aug 18 13:30:09 2013 +0200

 um: Run UML in it's own session.

 If UML is not run by a shell it can happen that UML
 will kill unrelated proceses upon a fatal exit because
 it issues a kill(0, ...).
 To prevent such oddities we create a new session in main().

 Reported-and-tested-by: Richard W.M. Jones rjo...@redhat.com
 Signed-off-by: Richard Weinberger rich...@nod.at


 The winch-thread also has it's own session, this seems to be to an issue.


 sure - I can reproduce it with linux-v3.11-8718-g0fb5ca1 , which doesn't 
 contain that commit, or ?

 I'd like to bisect iit,k but as soon as I run something like
 $ ./l.sh | tee logfile
 then the issue vanishes - so I can see it on the command line.
 Furthermore I know, that it is not in 3.10.0-08763-g7d3107d, but in
 v3.12-rc1-42-gf42bcf1 - but without automation bisecting is not funny.

Why bisect? Commit 2501272 is the evildoer.
Now I have to find a sane way to fix the kill(0,...) issue without breaking the 
winch-thread.

Thanks,
//richard

--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/22/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=64545871iu=/4140/ostg.clktrk
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PULL] UML updates for 3.12

2013-09-07 Thread Richard Weinberger
Linus,

please pull form:

  git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml.git for-linus

to receive UML updates for the 3.12 merge window.

This pile contains mostly fixes and improvements for issues identified
by Richard W. M. Jones while adding UML as backend to libguestfs.

Thanks,
//richard


Richard Weinberger (8):
  um: hostfs: Fix writeback
  um: Implement probe_kernel_read()
  um: ubd: Add REQ_FLUSH suppport
  um: ubd: Introduce submit_request()
  um: Cleanup SIGTERM handling
  um: Run UML in it's own session.
  um: prctl: Do not include linux/ptrace.h
  um: Add irq chip um/mask handlers

 arch/um/drivers/ubd.h|  1 -
 arch/um/drivers/ubd_kern.c   | 72 
 arch/um/drivers/ubd_user.c   |  5 ---
 arch/um/include/shared/os.h  |  3 ++
 arch/um/kernel/Makefile  |  2 +-
 arch/um/kernel/irq.c |  4 +++
 arch/um/kernel/maccess.c | 24 +++
 arch/um/os-Linux/aio.c   |  5 ++-
 arch/um/os-Linux/file.c  |  9 ++
 arch/um/os-Linux/main.c  |  2 ++
 arch/um/os-Linux/process.c   | 53 +++-
 arch/um/os-Linux/sigio.c |  2 +-
 arch/um/os-Linux/util.c  | 10 ++
 arch/x86/um/os-Linux/prctl.c |  2 +-
 fs/hostfs/hostfs_kern.c  |  9 +-
 15 files changed, 176 insertions(+), 27 deletions(-)
 create mode 100644 arch/um/kernel/maccess.c

--
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391iu=/4140/ostg.clktrk
___
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 4/4] um: Run UML in it's own session.

2013-09-07 Thread Richard Weinberger
Am 07.09.2013 14:14, schrieb Richard W.M. Jones:
 On Mon, Aug 19, 2013 at 10:30:49AM +0100, Richard W.M. Jones wrote:
 On Sun, Aug 18, 2013 at 01:30:09PM +0200, Richard Weinberger wrote:
 If UML is not run by a shell it can happen that UML
 will kill unrelated proceses upon a fatal exit because
 it issues a kill(0, ...).
 To prevent such oddities we create a new session in main().

 Cc: rjo...@redhat.com
 Reported-by: Richard W.M. Jones rjo...@redhat.com
 Signed-off-by: Richard Weinberger rich...@nod.at

 I tested this using the debug segv test script that I previously
 posted on the user-mode-linux mailing list, and this problem is now
 fixed.  Therefore:

 Tested-by: Richard W.M. Jones rjo...@redhat.com

 Thanks for these great fixes!
 
 I've been using these 4 patches rebased on top of successive Linux
 HEAD's for nearly a month, and they work great.
 
 But they don't seem to be going upstream, and they are necessary for
 people who want to use the UML backend with libguestfs (which has
 garnered some interest).  Anything I can do to help this happen?

Sure they are.
https://lkml.org/lkml/2013/9/7/52

Thanks,
//richard


--
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391iu=/4140/ostg.clktrk
___
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] Issues with a rather unusual configured NFS server

2013-09-02 Thread Richard Weinberger
Am 02.09.2013 18:53, schrieb Toralf Förster:
 On 09/01/2013 11:15 PM, Richard Weinberger wrote:
 Am 01.09.2013 18:09, schrieb Toralf Förster:
 On 08/30/2013 04:36 PM, Richard Weinberger wrote:
 Am 30.08.2013 16:10, schrieb Toralf Förster:
 On 08/29/2013 03:30 PM, J. Bruce Fields wrote:
 On Thu, Aug 29, 2013 at 11:57:45AM +0200, richard -rw- weinberger wrote:
 On Wed, Aug 28, 2013 at 7:21 PM, Toralf Förster 
 toralf.foers...@gmx.de wrote:
 On 08/27/2013 08:06 PM, J. Bruce Fields wrote:
 On Tue, Aug 13, 2013 at 05:53:14PM -0400, bfields wrote:
 On Mon, Aug 12, 2013 at 04:36:40PM +0200, Jan Kara wrote:
 On Sun 11-08-13 11:48:49, Toralf Förster wrote:
 so that the server either crashes (if it is a user mode linux 
 image) or at least its reboot functionality got broken
 - if the NFS server is hammered with scary NFS calls using a fuzzy 
 tool running at a remote NFS client under a non-privileged user id.

 It can re reproduced, if
- the NFS share is an EXT3 or EXT4 directory
- and it is created at file located at tempfs and mounted via 
 loop device
- and the NFS server is forced to umount the NFS share
- and the server forced to restart the NSF service afterwards
- and trinity is used

 I could find a scenario for an automated bisect. 2 times it 
 brought this commit
 commit 68a3396178e6688ad7367202cdf0af8ed03c8727
 Author: J. Bruce Fields bfie...@redhat.com
 Date:   Thu Mar 21 11:21:50 2013 -0400

 nfsd4: shut down more of delegation earlier

 Thanks for the report.  I think I see the problem--after this commit
 nfs4_set_delegation() failures result in nfs4_put_delegation being
 called, but nfs4_put_delegation doesn't free the nfs4_file that has
 already been set by alloc_init_deleg().

 Let me think about how to fix that

 Sorry for the slow response--can you check whether this fixes the
 problem?

 Yes.

 With the attached patch the problem can't be reproduced any longer with
 the prepared test case and current git kernels.

 BTW: Is nobody else fuzz testing NFS?

 I don't know.  Toralf's reports are the only ones I recall off the top
 of my head, but I may have forgotten others.


 well, 7255e71 and 3c50ba8 I'd say.

 Or are these bugs just more likely to hit on UML?

 This definitely not. I observed at a real system EXT4 corruptions/
 issues but reported them to the EXT4 mailing list.
 It just took me a longer time to figure out a reliable configuration
 with 2 UML machiens to automatic bisect it.


 That's also possible.

 This is not the first NFS issue found by Toralf using UML and Trinity.

 Yep.  The testing is definitely appreciated.

 Thx - in the mean while although my UML bisect scripts are working fine
 and trinity is stable enough even in UML environments to be trust worth.

 That's good to know.
 Thanks you and trinity we got rid of some nasty UML bugs.

 yeah, but there's (among others) one of them still in the wild:
 If I start an UML and resize the terminal (KDE Konsole) during the boot
 phase then it just crashes sometimes.

 Does the attached patch fix the problem?

 oh yes
 And I do have the feeling that the UML start phase till the Gentoo
 openrc line is seen is speed up too :-)

Thanks for testing!
Now I'm sure what the problem is, patch is on the way. :)

Thanks,
//richard



--
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911iu=/4140/ostg.clktrk
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH] um: Add irq chip um/mask handlers

2013-09-02 Thread Richard Weinberger
These handlers are not optional and need in our case
dummy implementions to avoid NULL pointer bugs within
the irq core code.

Reported-and-tested-by: Toralf Foester toralf.foers...@gmx.de
Signed-off-by: Richard Weinberger rich...@nod.at
---
 arch/um/kernel/irq.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c
index 36e12f0..1d8505b 100644
--- a/arch/um/kernel/irq.c
+++ b/arch/um/kernel/irq.c
@@ -337,6 +337,8 @@ static struct irq_chip normal_irq_type = {
.irq_disable = dummy,
.irq_enable = dummy,
.irq_ack = dummy,
+   .irq_mask = dummy,
+   .irq_unmask = dummy,
 };
 
 static struct irq_chip SIGVTALRM_irq_type = {
@@ -344,6 +346,8 @@ static struct irq_chip SIGVTALRM_irq_type = {
.irq_disable = dummy,
.irq_enable = dummy,
.irq_ack = dummy,
+   .irq_mask = dummy,
+   .irq_unmask = dummy,
 };
 
 void __init init_IRQ(void)
-- 
1.8.3.1


--
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911iu=/4140/ostg.clktrk
___
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] Issues with a rather unusual configured NFS server

2013-09-01 Thread Richard Weinberger
Am 01.09.2013 18:09, schrieb Toralf Förster:
 On 08/30/2013 04:36 PM, Richard Weinberger wrote:
 Am 30.08.2013 16:10, schrieb Toralf Förster:
 On 08/29/2013 03:30 PM, J. Bruce Fields wrote:
 On Thu, Aug 29, 2013 at 11:57:45AM +0200, richard -rw- weinberger wrote:
 On Wed, Aug 28, 2013 at 7:21 PM, Toralf Förster toralf.foers...@gmx.de 
 wrote:
 On 08/27/2013 08:06 PM, J. Bruce Fields wrote:
 On Tue, Aug 13, 2013 at 05:53:14PM -0400, bfields wrote:
 On Mon, Aug 12, 2013 at 04:36:40PM +0200, Jan Kara wrote:
 On Sun 11-08-13 11:48:49, Toralf Förster wrote:
 so that the server either crashes (if it is a user mode linux image) 
 or at least its reboot functionality got broken
 - if the NFS server is hammered with scary NFS calls using a fuzzy 
 tool running at a remote NFS client under a non-privileged user id.

 It can re reproduced, if
- the NFS share is an EXT3 or EXT4 directory
- and it is created at file located at tempfs and mounted via 
 loop device
- and the NFS server is forced to umount the NFS share
- and the server forced to restart the NSF service afterwards
- and trinity is used

 I could find a scenario for an automated bisect. 2 times it brought 
 this commit
 commit 68a3396178e6688ad7367202cdf0af8ed03c8727
 Author: J. Bruce Fields bfie...@redhat.com
 Date:   Thu Mar 21 11:21:50 2013 -0400

 nfsd4: shut down more of delegation earlier

 Thanks for the report.  I think I see the problem--after this commit
 nfs4_set_delegation() failures result in nfs4_put_delegation being
 called, but nfs4_put_delegation doesn't free the nfs4_file that has
 already been set by alloc_init_deleg().

 Let me think about how to fix that

 Sorry for the slow response--can you check whether this fixes the
 problem?

 Yes.

 With the attached patch the problem can't be reproduced any longer with
 the prepared test case and current git kernels.

 BTW: Is nobody else fuzz testing NFS?

 I don't know.  Toralf's reports are the only ones I recall off the top
 of my head, but I may have forgotten others.


 well, 7255e71 and 3c50ba8 I'd say.

 Or are these bugs just more likely to hit on UML?

 This definitely not. I observed at a real system EXT4 corruptions/
 issues but reported them to the EXT4 mailing list.
 It just took me a longer time to figure out a reliable configuration
 with 2 UML machiens to automatic bisect it.


 That's also possible.

 This is not the first NFS issue found by Toralf using UML and Trinity.

 Yep.  The testing is definitely appreciated.

 Thx - in the mean while although my UML bisect scripts are working fine
 and trinity is stable enough even in UML environments to be trust worth.

 That's good to know.
 Thanks you and trinity we got rid of some nasty UML bugs.
 
 yeah, but there's (among others) one of them still in the wild:
 If I start an UML and resize the terminal (KDE Konsole) during the boot
 phase then it just crashes sometimes.

Does the attached patch fix the problem?

Thanks,
//richard

diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c
index 36e12f0..e7d1983 100644
--- a/arch/um/kernel/irq.c
+++ b/arch/um/kernel/irq.c
@@ -337,6 +337,7 @@ static struct irq_chip normal_irq_type = {
 	.irq_disable = dummy,
 	.irq_enable = dummy,
 	.irq_ack = dummy,
+	.irq_mask = dummy,
 };
 
 static struct irq_chip SIGVTALRM_irq_type = {
--
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911iu=/4140/ostg.clktrk___
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] Issues with a rather unusual configured NFS server

2013-08-30 Thread Richard Weinberger
Am 30.08.2013 16:10, schrieb Toralf Förster:
 On 08/29/2013 03:30 PM, J. Bruce Fields wrote:
 On Thu, Aug 29, 2013 at 11:57:45AM +0200, richard -rw- weinberger wrote:
 On Wed, Aug 28, 2013 at 7:21 PM, Toralf Förster toralf.foers...@gmx.de 
 wrote:
 On 08/27/2013 08:06 PM, J. Bruce Fields wrote:
 On Tue, Aug 13, 2013 at 05:53:14PM -0400, bfields wrote:
 On Mon, Aug 12, 2013 at 04:36:40PM +0200, Jan Kara wrote:
 On Sun 11-08-13 11:48:49, Toralf Förster wrote:
 so that the server either crashes (if it is a user mode linux image) 
 or at least its reboot functionality got broken
 - if the NFS server is hammered with scary NFS calls using a fuzzy 
 tool running at a remote NFS client under a non-privileged user id.

 It can re reproduced, if
- the NFS share is an EXT3 or EXT4 directory
- and it is created at file located at tempfs and mounted via loop 
 device
- and the NFS server is forced to umount the NFS share
- and the server forced to restart the NSF service afterwards
- and trinity is used

 I could find a scenario for an automated bisect. 2 times it brought 
 this commit
 commit 68a3396178e6688ad7367202cdf0af8ed03c8727
 Author: J. Bruce Fields bfie...@redhat.com
 Date:   Thu Mar 21 11:21:50 2013 -0400

 nfsd4: shut down more of delegation earlier

 Thanks for the report.  I think I see the problem--after this commit
 nfs4_set_delegation() failures result in nfs4_put_delegation being
 called, but nfs4_put_delegation doesn't free the nfs4_file that has
 already been set by alloc_init_deleg().

 Let me think about how to fix that

 Sorry for the slow response--can you check whether this fixes the
 problem?

 Yes.

 With the attached patch the problem can't be reproduced any longer with
 the prepared test case and current git kernels.

 BTW: Is nobody else fuzz testing NFS?

 I don't know.  Toralf's reports are the only ones I recall off the top
 of my head, but I may have forgotten others.

 
 well, 7255e71 and 3c50ba8 I'd say.
 
 Or are these bugs just more likely to hit on UML?
 
 This definitely not. I observed at a real system EXT4 corruptions/
 issues but reported them to the EXT4 mailing list.
 It just took me a longer time to figure out a reliable configuration
 with 2 UML machiens to automatic bisect it.
 
 
 That's also possible.

 This is not the first NFS issue found by Toralf using UML and Trinity.

 Yep.  The testing is definitely appreciated.
 
 Thx - in the mean while although my UML bisect scripts are working fine
 and trinity is stable enough even in UML environments to be trust worth.

That's good to know.
Thanks you and trinity we got rid of some nasty UML bugs.

Thanks,
//richard


--
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911iu=/4140/ostg.clktrk
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH] um: prctl: Do not include linux/ptrace.h

2013-08-23 Thread Richard Weinberger
On recent toolchains we hit:
In file included from arch/x86/um/os-Linux/prctl.c:7:0:
/usr/include/linux/ptrace.h:58:8: error: redefinition of ‘struct
ptrace_peeksiginfo_args’ struct ptrace_peeksiginfo_args {
^
In file included from arch/x86/um/os-Linux/prctl.c:6:0:
/usr/include/sys/ptrace.h:191:8: note: originally defined here
 struct ptrace_peeksiginfo_args
^
make[2]: *** [arch/x86/um/os-Linux/prctl.o] Error 1
make[1]: *** [arch/x86/um/os-Linux] Error 2
make: *** [arch/x86/um] Error 2

The solution is not to include linux/ptrace.h and obtain
the arch specific ptrace command from asm/ptrace.h.

Reported-by: David Oberhollenzer david.oberhollen...@tele2.at
Signed-off-by: Richard Weinberger rich...@nod.at
---
 arch/x86/um/os-Linux/prctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/um/os-Linux/prctl.c b/arch/x86/um/os-Linux/prctl.c
index 9d34edd..96eb2bd 100644
--- a/arch/x86/um/os-Linux/prctl.c
+++ b/arch/x86/um/os-Linux/prctl.c
@@ -4,7 +4,7 @@
  */
 
 #include sys/ptrace.h
-#include linux/ptrace.h
+#include asm/ptrace.h
 
 int os_arch_prctl(int pid, int code, unsigned long *addr)
 {
-- 
1.8.1.4


--
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511iu=/4140/ostg.clktrk
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 7/8] unicore32: Do not use SUBARCH

2013-08-21 Thread Richard Weinberger
Forces the user to specify CROSS_COMPILE at compile time instead
of automatically selecting more or less randomly a cross compiler

Signed-off-by: Richard Weinberger rich...@nod.at
---
 arch/unicore32/Makefile | 5 -
 1 file changed, 5 deletions(-)

diff --git a/arch/unicore32/Makefile b/arch/unicore32/Makefile
index b6f5c4c..fae00c8 100644
--- a/arch/unicore32/Makefile
+++ b/arch/unicore32/Makefile
@@ -10,11 +10,6 @@
 #
 # Copyright (C) 2002~2010 by Guan Xue-tao
 #
-ifneq ($(SUBARCH),$(ARCH))
-   ifeq ($(CROSS_COMPILE),)
-   CROSS_COMPILE := $(call cc-cross-prefix, unicore32-linux-)
-   endif
-endif
 
 LDFLAGS_vmlinux:= -p --no-undefined -X
 
-- 
1.8.1.4


--
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511iu=/4140/ostg.clktrk
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 3/8] um: Remove old defconfig

2013-08-21 Thread Richard Weinberger
The old unified defconfig is no longer needed.

Signed-off-by: Richard Weinberger rich...@nod.at
---
 arch/um/defconfig | 901 --
 1 file changed, 901 deletions(-)
 delete mode 100644 arch/um/defconfig

diff --git a/arch/um/defconfig b/arch/um/defconfig
deleted file mode 100644
index 08107a7..000
--- a/arch/um/defconfig
+++ /dev/null
@@ -1,901 +0,0 @@
-#
-# Automatically generated file; DO NOT EDIT.
-# User Mode Linux/i386 3.3.0 Kernel Configuration
-#
-CONFIG_DEFCONFIG_LIST=arch/$ARCH/defconfig
-CONFIG_UML=y
-CONFIG_MMU=y
-CONFIG_NO_IOMEM=y
-# CONFIG_TRACE_IRQFLAGS_SUPPORT is not set
-CONFIG_LOCKDEP_SUPPORT=y
-# CONFIG_STACKTRACE_SUPPORT is not set
-CONFIG_GENERIC_CALIBRATE_DELAY=y
-CONFIG_GENERIC_BUG=y
-CONFIG_GENERIC_CLOCKEVENTS=y
-CONFIG_HZ=100
-
-#
-# UML-specific options
-#
-
-#
-# Host processor type and features
-#
-# CONFIG_M486 is not set
-# CONFIG_M586 is not set
-# CONFIG_M586TSC is not set
-# CONFIG_M586MMX is not set
-CONFIG_M686=y
-# CONFIG_MPENTIUMII is not set
-# CONFIG_MPENTIUMIII is not set
-# CONFIG_MPENTIUMM is not set
-# CONFIG_MPENTIUM4 is not set
-# CONFIG_MK6 is not set
-# CONFIG_MK7 is not set
-# CONFIG_MK8 is not set
-# CONFIG_MCRUSOE is not set
-# CONFIG_MEFFICEON is not set
-# CONFIG_MWINCHIPC6 is not set
-# CONFIG_MWINCHIP3D is not set
-# CONFIG_MELAN is not set
-# CONFIG_MGEODEGX1 is not set
-# CONFIG_MGEODE_LX is not set
-# CONFIG_MCYRIXIII is not set
-# CONFIG_MVIAC3_2 is not set
-# CONFIG_MVIAC7 is not set
-# CONFIG_MCORE2 is not set
-# CONFIG_MATOM is not set
-# CONFIG_X86_GENERIC is not set
-CONFIG_X86_INTERNODE_CACHE_SHIFT=5
-CONFIG_X86_CMPXCHG=y
-CONFIG_X86_L1_CACHE_SHIFT=5
-CONFIG_X86_XADD=y
-CONFIG_X86_PPRO_FENCE=y
-CONFIG_X86_WP_WORKS_OK=y
-CONFIG_X86_INVLPG=y
-CONFIG_X86_BSWAP=y
-CONFIG_X86_POPAD_OK=y
-CONFIG_X86_USE_PPRO_CHECKSUM=y
-CONFIG_X86_TSC=y
-CONFIG_X86_CMPXCHG64=y
-CONFIG_X86_CMOV=y
-CONFIG_X86_MINIMUM_CPU_FAMILY=5
-CONFIG_CPU_SUP_INTEL=y
-CONFIG_CPU_SUP_CYRIX_32=y
-CONFIG_CPU_SUP_AMD=y
-CONFIG_CPU_SUP_CENTAUR=y
-CONFIG_CPU_SUP_TRANSMETA_32=y
-CONFIG_CPU_SUP_UMC_32=y
-CONFIG_UML_X86=y
-# CONFIG_64BIT is not set
-CONFIG_X86_32=y
-# CONFIG_X86_64 is not set
-# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
-CONFIG_RWSEM_GENERIC_SPINLOCK=y
-# CONFIG_3_LEVEL_PGTABLES is not set
-CONFIG_ARCH_HAS_SC_SIGNALS=y
-CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA=y
-CONFIG_GENERIC_HWEIGHT=y
-# CONFIG_STATIC_LINK is not set
-CONFIG_SELECT_MEMORY_MODEL=y
-CONFIG_FLATMEM_MANUAL=y
-CONFIG_FLATMEM=y
-CONFIG_FLAT_NODE_MEM_MAP=y
-CONFIG_PAGEFLAGS_EXTENDED=y
-CONFIG_SPLIT_PTLOCK_CPUS=4
-# CONFIG_COMPACTION is not set
-# CONFIG_PHYS_ADDR_T_64BIT is not set
-CONFIG_ZONE_DMA_FLAG=0
-CONFIG_VIRT_TO_BUS=y
-# CONFIG_KSM is not set
-CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
-CONFIG_NEED_PER_CPU_KM=y
-# CONFIG_CLEANCACHE is not set
-CONFIG_TICK_ONESHOT=y
-CONFIG_NO_HZ=y
-CONFIG_HIGH_RES_TIMERS=y
-CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
-CONFIG_LD_SCRIPT_DYN=y
-CONFIG_BINFMT_ELF=y
-CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
-CONFIG_HAVE_AOUT=y
-# CONFIG_BINFMT_AOUT is not set
-CONFIG_BINFMT_MISC=m
-CONFIG_HOSTFS=y
-# CONFIG_HPPFS is not set
-CONFIG_MCONSOLE=y
-CONFIG_MAGIC_SYSRQ=y
-CONFIG_KERNEL_STACK_ORDER=0
-# CONFIG_MMAPPER is not set
-CONFIG_NO_DMA=y
-
-#
-# General setup
-#
-CONFIG_EXPERIMENTAL=y
-CONFIG_BROKEN_ON_SMP=y
-CONFIG_INIT_ENV_ARG_LIMIT=128
-CONFIG_CROSS_COMPILE=
-CONFIG_LOCALVERSION=
-CONFIG_LOCALVERSION_AUTO=y
-CONFIG_DEFAULT_HOSTNAME=(none)
-CONFIG_SWAP=y
-CONFIG_SYSVIPC=y
-CONFIG_SYSVIPC_SYSCTL=y
-CONFIG_POSIX_MQUEUE=y
-CONFIG_POSIX_MQUEUE_SYSCTL=y
-CONFIG_BSD_PROCESS_ACCT=y
-# CONFIG_BSD_PROCESS_ACCT_V3 is not set
-# CONFIG_FHANDLE is not set
-# CONFIG_TASKSTATS is not set
-# CONFIG_AUDIT is not set
-CONFIG_HAVE_GENERIC_HARDIRQS=y
-
-#
-# IRQ subsystem
-#
-CONFIG_GENERIC_HARDIRQS=y
-CONFIG_GENERIC_IRQ_SHOW=y
-
-#
-# RCU Subsystem
-#
-CONFIG_TINY_RCU=y
-# CONFIG_PREEMPT_RCU is not set
-# CONFIG_RCU_TRACE is not set
-# CONFIG_TREE_RCU_TRACE is not set
-CONFIG_IKCONFIG=y
-CONFIG_IKCONFIG_PROC=y
-CONFIG_LOG_BUF_SHIFT=14
-CONFIG_CGROUPS=y
-# CONFIG_CGROUP_DEBUG is not set
-CONFIG_CGROUP_FREEZER=y
-CONFIG_CGROUP_DEVICE=y
-CONFIG_CPUSETS=y
-CONFIG_PROC_PID_CPUSET=y
-CONFIG_CGROUP_CPUACCT=y
-CONFIG_RESOURCE_COUNTERS=y
-CONFIG_CGROUP_MEMCG=y
-CONFIG_CGROUP_MEMCG_SWAP=y
-# CONFIG_CGROUP_MEMCG_SWAP_ENABLED is not set
-# CONFIG_CGROUP_MEMCG_KMEM is not set
-CONFIG_CGROUP_SCHED=y
-CONFIG_FAIR_GROUP_SCHED=y
-# CONFIG_CFS_BANDWIDTH is not set
-# CONFIG_RT_GROUP_SCHED is not set
-CONFIG_BLK_CGROUP=y
-# CONFIG_DEBUG_BLK_CGROUP is not set
-# CONFIG_CHECKPOINT_RESTORE is not set
-CONFIG_NAMESPACES=y
-CONFIG_UTS_NS=y
-CONFIG_IPC_NS=y
-# CONFIG_USER_NS is not set
-# CONFIG_PID_NS is not set
-CONFIG_NET_NS=y
-# CONFIG_SCHED_AUTOGROUP is not set
-CONFIG_MM_OWNER=y
-CONFIG_SYSFS_DEPRECATED=y
-# CONFIG_SYSFS_DEPRECATED_V2 is not set
-# CONFIG_RELAY is not set
-# CONFIG_BLK_DEV_INITRD is not set
-CONFIG_CC_OPTIMIZE_FOR_SIZE=y
-CONFIG_SYSCTL=y
-CONFIG_ANON_INODES=y

[uml-devel] [PATCH 2/8] um: Do not use SUBARCH

2013-08-21 Thread Richard Weinberger
From now on UML does no longer depend on SUBARCH and will
never silently change CONFIG_64BIT.

make defconfig ARCH=um produces now a .config with is suitable
for your host arch.

make i386_defconfig ARCH=um replaces make defconfig ARCH=um SUBARCH=i386
and make x86_64_defconfig ARCH=um replaces make defconfig ARCH=um 
SUBARCH=x86_64

Finally a make ARCH=um will produce an UML as described in your .config and 
you
don't have to worry about setting the correct SUBARCH.

This patch is based on: https://lkml.org/lkml/2013/7/4/396

Cc: Ramkumar Ramachandra artag...@gmail.com
Signed-off-by: Richard Weinberger rich...@nod.at
---
 arch/um/Kconfig.common |  4 
 arch/um/Makefile   | 21 +++--
 arch/x86/Makefile.um   |  2 +-
 arch/x86/um/Kconfig|  6 +++---
 4 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/arch/um/Kconfig.common b/arch/um/Kconfig.common
index bceee66..a7ef0b4 100644
--- a/arch/um/Kconfig.common
+++ b/arch/um/Kconfig.common
@@ -58,7 +58,3 @@ config GENERIC_BUG
 config HZ
int
default 100
-
-config SUBARCH
-   string
-   option env=SUBARCH
diff --git a/arch/um/Makefile b/arch/um/Makefile
index 133f7de..5bc7892 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -8,6 +8,8 @@
 
 ARCH_DIR := arch/um
 OS := $(shell uname -s)
+OS_ARCH := $(shell uname -m)
+
 # We require bash because the vmlinux link and loader script cpp use bash
 # features.
 SHELL := /bin/bash
@@ -20,15 +22,14 @@ core-y  += $(ARCH_DIR)/kernel/  
\
 
 MODE_INCLUDE   += -I$(srctree)/$(ARCH_DIR)/include/shared/skas
 
-HEADER_ARCH:= $(SUBARCH)
-
-# Additional ARCH settings for x86
-ifeq ($(SUBARCH),i386)
-HEADER_ARCH := x86
-endif
-ifeq ($(SUBARCH),x86_64)
-HEADER_ARCH := x86
-   KBUILD_CFLAGS += -mcmodel=large
+# Currently we support only i386 and x86_64, if you port UML to another arch
+# add another if branch...
+ifeq ($(OS_ARCH),x86_64)
+   HEADER_ARCH := x86
+   KBUILD_DEFCONFIG := x86_64_defconfig
+else
+   HEADER_ARCH := x86
+   KBUILD_DEFCONFIG := i386_defconfig
 endif
 
 HOST_DIR := arch/$(HEADER_ARCH)
@@ -155,4 +156,4 @@ endef
 include/generated/user_constants.h: $(HOST_DIR)/um/user-offsets.s
$(call filechk,gen-asm-offsets)
 
-export SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS DEV_NULL_PATH
+export USER_CFLAGS CFLAGS_NO_HARDENING OS DEV_NULL_PATH
diff --git a/arch/x86/Makefile.um b/arch/x86/Makefile.um
index 36b62bc..91d088c 100644
--- a/arch/x86/Makefile.um
+++ b/arch/x86/Makefile.um
@@ -40,7 +40,7 @@ else
 
 START := 0x6000
 
-KBUILD_CFLAGS += -fno-builtin -m64 
+KBUILD_CFLAGS += -fno-builtin -m64 -mcmodel=large
 
 CHECKFLAGS  += -m64 -D__x86_64__
 KBUILD_AFLAGS += -m64
diff --git a/arch/x86/um/Kconfig b/arch/x86/um/Kconfig
index 14ef8d1..bb6df67 100644
--- a/arch/x86/um/Kconfig
+++ b/arch/x86/um/Kconfig
@@ -1,4 +1,4 @@
-mainmenu User Mode Linux/$SUBARCH $KERNELVERSION Kernel Configuration
+mainmenu User Mode Linux $KERNELVERSION Kernel Configuration
 
 source arch/um/Kconfig.common
 
@@ -15,8 +15,8 @@ config UML_X86
select GENERIC_FIND_FIRST_BIT
 
 config 64BIT
-   bool 64-bit kernel if SUBARCH = x86
-   default SUBARCH != i386
+   bool 64-bit kernel
+   default n
 
 config X86_32
def_bool !64BIT
-- 
1.8.1.4


--
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511iu=/4140/ostg.clktrk
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [RFC] Get rid of SUBARCH

2013-08-21 Thread Richard Weinberger
This series is an attempt to remove the SUBARCH make parameter.
It as introduced at the times of Linux 2.5 for UML to tell the UML
build system what the real architecture is.

But we actually don't need SUBARCH, we can store this information
in the .config file.
i386_defconfig will produce a kernel for x86, and x86_64_defconfig
for x86_64. There is no need to specify SUBARCH.
With this patchset applied you can build UML always with make linux ARCH=um
and it will produce the an image for the architecture specified in your .config.
Currenlty make linux ARCH=um will alter your .config to match the detected 
SUBARCH
whith sucks and causes problems on automated build systems.

The series touches also m68k, sh, mips and unicore32.
These architectures magically select a cross compiler if ARCH != SUBARCH.
Do really need that behavior?

[PATCH 1/8] um: Create defconfigs for i386 and x86_64
[PATCH 2/8] um: Do not use SUBARCH
[PATCH 3/8] um: Remove old defconfig
[PATCH 4/8] m68k: Do not use SUBARCH
[PATCH 5/8] sh: Do not use SUBARCH
[PATCH 6/8] mips: Do not use SUBARCH
[PATCH 7/8] unicore32: Do not use SUBARCH
[PATCH 8/8] Makefile: Remove SUBARCH

Thanks,
//richard

--
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511iu=/4140/ostg.clktrk
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 4/8] m68k: Do not use SUBARCH

2013-08-21 Thread Richard Weinberger
Forces the user to specify CROSS_COMPILE at compile time instead
of automatically selecting more or less randomly a cross compiler.

Signed-off-by: Richard Weinberger rich...@nod.at
---
 arch/m68k/Makefile | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
index 7f7830f..3bd6355 100644
--- a/arch/m68k/Makefile
+++ b/arch/m68k/Makefile
@@ -16,13 +16,6 @@
 
 KBUILD_DEFCONFIG := multi_defconfig
 
-ifneq ($(SUBARCH),$(ARCH))
-   ifeq ($(CROSS_COMPILE),)
-   CROSS_COMPILE := $(call cc-cross-prefix, \
-   m68k-linux-gnu- m68k-linux- m68k-unknown-linux-gnu-)
-   endif
-endif
-
 #
 #  Enable processor type. Ordering of these is important - we want to
 #  use the minimum processor type of the range we support. The logic
-- 
1.8.1.4


--
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511iu=/4140/ostg.clktrk
___
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] [RFC] Get rid of SUBARCH

2013-08-21 Thread Richard Weinberger
Am 21.08.2013 14:07, schrieb Geert Uytterhoeven:
 On Wed, Aug 21, 2013 at 10:19 AM, Richard Weinberger rich...@nod.at wrote:
 This series is an attempt to remove the SUBARCH make parameter.
 It as introduced at the times of Linux 2.5 for UML to tell the UML
 build system what the real architecture is.

 But we actually don't need SUBARCH, we can store this information
 in the .config file.
 
 Haha, now you have OS_ARCH (shouldn't that be called HOST_ARCH?) instead,
 which is available only for UM?

We have already OS (which is always Linux), so OS_ARCH is IMHO a good choice.
UML always needs to know what the underlying arch is.

OS_ARCH is not only visible to arch/um/ because of that code in the global 
Makefile:

# UML needs a little special treatment here.  It wants to use the host
# toolchain, so needs $(SUBARCH) passed to checkstack.pl.  Everyone
# else wants $(ARCH), including people doing cross-builds, which means
# that $(SUBARCH) doesn't work here.
ifeq ($(ARCH), um)
CHECKSTACK_ARCH := $(SUBARCH)
else
CHECKSTACK_ARCH := $(ARCH)
endif

scripts/tags.sh also needs some work. V2 will contain a patch for that.

 The series touches also m68k, sh, mips and unicore32.
 These architectures magically select a cross compiler if ARCH != SUBARCH.
 Do really need that behavior?
 
 This does remove functionality.
 It allows to build a kernel using e.g. make ARCH=m68k.

If this functionality is expected and has users I'll happily keep that.

 Perhaps this can be moved to generic code? Most (not all!) cross-toolchains
 are called $ARCH-{unknown-,}linux{,-gnu}.
 Exceptions are e.g. am33_2.0-linux and bfin-uclinux.

Sounds good.

 [PATCH 1/8] um: Create defconfigs for i386 and x86_64
 [PATCH 3/8] um: Remove old defconfig
 
 Why not merge these two, so git copy/rename detection will show only the real
 changes?

Will do.

Thanks,
//richard

--
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511iu=/4140/ostg.clktrk
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 1/8] um: Create defconfigs for i386 and x86_64

2013-08-21 Thread Richard Weinberger
Instead of having one defconfig for both i386 and x86_64
we have now two.
This is the first step to get rid of SUBARCH.

This patch is based on: https://lkml.org/lkml/2013/7/4/396

Cc: Ramkumar Ramachandra artag...@gmail.com
Signed-off-by: Richard Weinberger rich...@nod.at
---
 arch/um/configs/i386_defconfig   | 954 +++
 arch/um/configs/x86_64_defconfig | 943 ++
 2 files changed, 1897 insertions(+)
 create mode 100644 arch/um/configs/i386_defconfig
 create mode 100644 arch/um/configs/x86_64_defconfig

diff --git a/arch/um/configs/i386_defconfig b/arch/um/configs/i386_defconfig
new file mode 100644
index 000..488ac2a
--- /dev/null
+++ b/arch/um/configs/i386_defconfig
@@ -0,0 +1,954 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# User Mode Linux 3.9.0-rc6 Kernel Configuration
+#
+CONFIG_DEFCONFIG_LIST=arch/$ARCH/defconfig
+CONFIG_UML=y
+CONFIG_MMU=y
+CONFIG_NO_IOMEM=y
+# CONFIG_TRACE_IRQFLAGS_SUPPORT is not set
+CONFIG_LOCKDEP_SUPPORT=y
+# CONFIG_STACKTRACE_SUPPORT is not set
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_BUG=y
+CONFIG_HZ=100
+
+#
+# UML-specific options
+#
+
+#
+# Host processor type and features
+#
+# CONFIG_M486 is not set
+# CONFIG_M586 is not set
+# CONFIG_M586TSC is not set
+# CONFIG_M586MMX is not set
+CONFIG_M686=y
+# CONFIG_MPENTIUMII is not set
+# CONFIG_MPENTIUMIII is not set
+# CONFIG_MPENTIUMM is not set
+# CONFIG_MPENTIUM4 is not set
+# CONFIG_MK6 is not set
+# CONFIG_MK7 is not set
+# CONFIG_MK8 is not set
+# CONFIG_MCRUSOE is not set
+# CONFIG_MEFFICEON is not set
+# CONFIG_MWINCHIPC6 is not set
+# CONFIG_MWINCHIP3D is not set
+# CONFIG_MELAN is not set
+# CONFIG_MGEODEGX1 is not set
+# CONFIG_MGEODE_LX is not set
+# CONFIG_MCYRIXIII is not set
+# CONFIG_MVIAC3_2 is not set
+# CONFIG_MVIAC7 is not set
+# CONFIG_MPSC is not set
+# CONFIG_MCORE2 is not set
+# CONFIG_MATOM is not set
+# CONFIG_GENERIC_CPU is not set
+# CONFIG_X86_GENERIC is not set
+CONFIG_X86_INTERNODE_CACHE_SHIFT=5
+CONFIG_X86_L1_CACHE_SHIFT=5
+# CONFIG_X86_PPRO_FENCE is not set
+CONFIG_X86_USE_PPRO_CHECKSUM=y
+CONFIG_X86_TSC=y
+CONFIG_X86_CMPXCHG64=y
+CONFIG_X86_CMOV=y
+CONFIG_X86_MINIMUM_CPU_FAMILY=5
+CONFIG_CPU_SUP_INTEL=y
+CONFIG_CPU_SUP_AMD=y
+CONFIG_CPU_SUP_CENTAUR=y
+CONFIG_CPU_SUP_TRANSMETA_32=y
+CONFIG_UML_X86=y
+# CONFIG_64BIT is not set
+CONFIG_X86_32=y
+# CONFIG_X86_64 is not set
+# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+# CONFIG_3_LEVEL_PGTABLES is not set
+CONFIG_ARCH_HAS_SC_SIGNALS=y
+CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA=y
+CONFIG_GENERIC_HWEIGHT=y
+# CONFIG_STATIC_LINK is not set
+CONFIG_FLATMEM=y
+CONFIG_FLAT_NODE_MEM_MAP=y
+# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
+CONFIG_PAGEFLAGS_EXTENDED=y
+CONFIG_SPLIT_PTLOCK_CPUS=4
+# CONFIG_COMPACTION is not set
+# CONFIG_PHYS_ADDR_T_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=0
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_CROSS_MEMORY_ATTACH=y
+CONFIG_NEED_PER_CPU_KM=y
+# CONFIG_CLEANCACHE is not set
+# CONFIG_FRONTSWAP is not set
+CONFIG_LD_SCRIPT_DYN=y
+CONFIG_BINFMT_ELF=y
+CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
+CONFIG_HAVE_AOUT=y
+# CONFIG_BINFMT_AOUT is not set
+CONFIG_BINFMT_MISC=m
+CONFIG_COREDUMP=y
+CONFIG_HOSTFS=y
+# CONFIG_HPPFS is not set
+CONFIG_MCONSOLE=y
+CONFIG_MAGIC_SYSRQ=y
+CONFIG_KERNEL_STACK_ORDER=1
+# CONFIG_MMAPPER is not set
+CONFIG_NO_DMA=y
+CONFIG_IRQ_WORK=y
+
+#
+# General setup
+#
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_INIT_ENV_ARG_LIMIT=128
+CONFIG_CROSS_COMPILE=
+CONFIG_LOCALVERSION=
+CONFIG_LOCALVERSION_AUTO=y
+CONFIG_DEFAULT_HOSTNAME=(none)
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+CONFIG_POSIX_MQUEUE=y
+CONFIG_POSIX_MQUEUE_SYSCTL=y
+# CONFIG_FHANDLE is not set
+# CONFIG_AUDIT is not set
+CONFIG_HAVE_GENERIC_HARDIRQS=y
+
+#
+# IRQ subsystem
+#
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_SHOW=y
+# CONFIG_ALWAYS_USE_PERSISTENT_CLOCK is not set
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+
+#
+# Timers subsystem
+#
+CONFIG_TICK_ONESHOT=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+
+#
+# CPU/Task time and stats accounting
+#
+CONFIG_TICK_CPU_ACCOUNTING=y
+CONFIG_BSD_PROCESS_ACCT=y
+# CONFIG_BSD_PROCESS_ACCT_V3 is not set
+# CONFIG_TASKSTATS is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_TINY_RCU=y
+# CONFIG_PREEMPT_RCU is not set
+# CONFIG_RCU_STALL_COMMON is not set
+# CONFIG_TREE_RCU_TRACE is not set
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_LOG_BUF_SHIFT=14
+CONFIG_CGROUPS=y
+# CONFIG_CGROUP_DEBUG is not set
+CONFIG_CGROUP_FREEZER=y
+CONFIG_CGROUP_DEVICE=y
+CONFIG_CPUSETS=y
+CONFIG_PROC_PID_CPUSET=y
+CONFIG_CGROUP_CPUACCT=y
+CONFIG_RESOURCE_COUNTERS=y
+# CONFIG_MEMCG is not set
+CONFIG_CGROUP_SCHED=y
+CONFIG_FAIR_GROUP_SCHED=y
+# CONFIG_CFS_BANDWIDTH is not set
+# CONFIG_RT_GROUP_SCHED is not set
+CONFIG_BLK_CGROUP=y
+# CONFIG_DEBUG_BLK_CGROUP is not set
+# CONFIG_CHECKPOINT_RESTORE is not set
+CONFIG_NAMESPACES=y
+CONFIG_UTS_NS=y

[uml-devel] [PATCH 6/8] mips: Do not use SUBARCH

2013-08-21 Thread Richard Weinberger
Forces the user to specify CROSS_COMPILE at compile time instead
of automatically selecting more or less randomly a cross compiler.

Signed-off-by: Richard Weinberger rich...@nod.at
---
 arch/mips/Makefile | 6 --
 1 file changed, 6 deletions(-)

diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 37f9ef3..514fea6 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -42,12 +42,6 @@ tool-archpref= $(64bit-tool-archpref)
 UTS_MACHINE:= mips64
 endif
 
-ifneq ($(SUBARCH),$(ARCH))
-  ifeq ($(CROSS_COMPILE),)
-CROSS_COMPILE := $(call cc-cross-prefix, $(tool-archpref)-linux-  
$(tool-archpref)-linux-gnu-  $(tool-archpref)-unknown-linux-gnu-)
-  endif
-endif
-
 ifdef CONFIG_FUNCTION_GRAPH_TRACER
   ifndef KBUILD_MCOUNT_RA_ADDRESS
 ifeq ($(call cc-option-yn,-mmcount-ra-address), y)
-- 
1.8.1.4


--
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511iu=/4140/ostg.clktrk
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 5/8] sh: Do not use SUBARCH

2013-08-21 Thread Richard Weinberger
Forces the user to specify CROSS_COMPILE at compile time instead
of automatically selecting more or less randomly a cross compiler.

Signed-off-by: Richard Weinberger rich...@nod.at
---
 arch/sh/Makefile | 5 -
 1 file changed, 5 deletions(-)

diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index aed701c..8772d11 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -9,11 +9,6 @@
 # License.  See the file COPYING in the main directory of this archive
 # for more details.
 #
-ifneq ($(SUBARCH),$(ARCH))
-  ifeq ($(CROSS_COMPILE),)
-CROSS_COMPILE := $(call cc-cross-prefix, $(UTS_MACHINE)-linux-  
$(UTS_MACHINE)-linux-gnu-  $(UTS_MACHINE)-unknown-linux-gnu-)
-  endif
-endif
 
 isa-y  := any
 isa-$(CONFIG_SH_DSP)   := sh
-- 
1.8.1.4


--
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511iu=/4140/ostg.clktrk
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 8/8] Makefile: Remove SUBARCH

2013-08-21 Thread Richard Weinberger
As all users of SUBARCH have been removed we can finally get
rid of it.

Signed-off-by: Richard Weinberger rich...@nod.at
---
 Makefile | 15 +++
 arch/um/Makefile |  2 +-
 2 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/Makefile b/Makefile
index a5a55f4..48bd8fe 100644
--- a/Makefile
+++ b/Makefile
@@ -159,13 +159,7 @@ VPATH  := $(srctree)$(if 
$(KBUILD_EXTMOD),:$(KBUILD_EXTMOD))
 export srctree objtree VPATH
 
 
-# SUBARCH tells the usermode build what the underlying arch is.  That is set
-# first, and if a usermode build is happening, the ARCH=um on the command
-# line overrides the setting of ARCH below.  If a native build is happening,
-# then ARCH is assigned, getting whatever value it gets normally, and 
-# SUBARCH is subsequently ignored.
-
-SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
+ARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
  -e s/sun4u/sparc64/ \
  -e s/arm.*/arm/ -e s/sa110/arm/ \
  -e s/s390x/s390/ -e s/parisc64/parisc/ \
@@ -192,7 +186,6 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e 
s/x86_64/x86/ \
 # make in the configured kernel build directory always uses that.
 # Default value for CROSS_COMPILE is not to prefix executables
 # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
-ARCH   ?= $(SUBARCH)
 CROSS_COMPILE  ?= $(CONFIG_CROSS_COMPILE:%=%)
 
 # Architecture as present in compile.h
@@ -1314,11 +1307,9 @@ endif #ifeq ($(mixed-targets),1)
 PHONY += checkstack kernelrelease kernelversion image_name
 
 # UML needs a little special treatment here.  It wants to use the host
-# toolchain, so needs $(SUBARCH) passed to checkstack.pl.  Everyone
-# else wants $(ARCH), including people doing cross-builds, which means
-# that $(SUBARCH) doesn't work here.
+# toolchain, so needs $(OS_ARCH) passed to checkstack.pl.
 ifeq ($(ARCH), um)
-CHECKSTACK_ARCH := $(SUBARCH)
+CHECKSTACK_ARCH := $(OS_ARCH)
 else
 CHECKSTACK_ARCH := $(ARCH)
 endif
diff --git a/arch/um/Makefile b/arch/um/Makefile
index 5bc7892..c1b6a9b 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -156,4 +156,4 @@ endef
 include/generated/user_constants.h: $(HOST_DIR)/um/user-offsets.s
$(call filechk,gen-asm-offsets)
 
-export USER_CFLAGS CFLAGS_NO_HARDENING OS DEV_NULL_PATH
+export USER_CFLAGS CFLAGS_NO_HARDENING OS OS_ARCH DEV_NULL_PATH
-- 
1.8.1.4


--
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511iu=/4140/ostg.clktrk
___
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 4/4] um: Run UML in it's own session.

2013-08-19 Thread Richard Weinberger
Am 19.08.2013 11:30, schrieb Richard W.M. Jones:
 On Sun, Aug 18, 2013 at 01:30:09PM +0200, Richard Weinberger wrote:
 If UML is not run by a shell it can happen that UML
 will kill unrelated proceses upon a fatal exit because
 it issues a kill(0, ...).
 To prevent such oddities we create a new session in main().

 Cc: rjo...@redhat.com
 Reported-by: Richard W.M. Jones rjo...@redhat.com
 Signed-off-by: Richard Weinberger rich...@nod.at
 
 I tested this using the debug segv test script that I previously
 posted on the user-mode-linux mailing list, and this problem is now
 fixed.  Therefore:
 
 Tested-by: Richard W.M. Jones rjo...@redhat.com
 
 Thanks for these great fixes!

Thanks for testing. :-)
I'll add all patches to uml-next.git in a few days (maybe someone finds a bug).
Expect them in v3.12.

Thanks,
//richard


--
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511iu=/4140/ostg.clktrk
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 4/4] um: Run UML in it's own session.

2013-08-18 Thread Richard Weinberger
If UML is not run by a shell it can happen that UML
will kill unrelated proceses upon a fatal exit because
it issues a kill(0, ...).
To prevent such oddities we create a new session in main().

Cc: rjo...@redhat.com
Reported-by: Richard W.M. Jones rjo...@redhat.com
Signed-off-by: Richard Weinberger rich...@nod.at
---
 arch/um/os-Linux/main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c
index 749c96d..e1704ff 100644
--- a/arch/um/os-Linux/main.c
+++ b/arch/um/os-Linux/main.c
@@ -123,6 +123,8 @@ int __init main(int argc, char **argv, char **envp)
 
setup_env_path();
 
+   setsid();
+
new_argv = malloc((argc + 1) * sizeof(char *));
if (new_argv == NULL) {
perror(Mallocing argv);
-- 
1.8.3.1


--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with 2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031iu=/4140/ostg.clktrk
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 2/4] um: ubd: Introduce submit_request()

2013-08-18 Thread Richard Weinberger
Just a clean-up patch to remove the open coded
variants and to ensure that all requests are submitted the
same way.

Signed-off-by: Richard Weinberger rich...@nod.at
---
 arch/um/drivers/ubd_kern.c | 32 +++-
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index d27c703..1812bc8 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -1252,12 +1252,28 @@ static void prepare_flush_request(struct request *req,
io_req-op = UBD_FLUSH;
 }
 
+static bool submit_request(struct io_thread_req *io_req, struct ubd *dev)
+{
+   int n = os_write_file(thread_fd, io_req,
+sizeof(io_req));
+   if (n != sizeof(io_req)) {
+   if (n != -EAGAIN)
+   printk(write to io thread failed, 
+  errno = %d\n, -n);
+   else if (list_empty(dev-restart))
+   list_add(dev-restart, restart);
+
+   kfree(io_req);
+   return false;
+   }
+   return true;
+}
+
 /* Called with dev-lock held */
 static void do_ubd_request(struct request_queue *q)
 {
struct io_thread_req *io_req;
struct request *req;
-   int n;
 
while(1){
struct ubd *dev = q-queuedata;
@@ -1283,8 +1299,7 @@ static void do_ubd_request(struct request_queue *q)
return;
}
prepare_flush_request(req, io_req);
-   os_write_file(thread_fd, io_req,
- sizeof(struct io_thread_req *));
+   submit_request(io_req, dev);
}
 
while(dev-start_sg  dev-end_sg){
@@ -1301,17 +1316,8 @@ static void do_ubd_request(struct request_queue *q)
(unsigned long long)dev-rq_pos  9,
sg-offset, sg-length, sg_page(sg));
 
-   n = os_write_file(thread_fd, io_req,
- sizeof(struct io_thread_req *));
-   if(n != sizeof(struct io_thread_req *)){
-   if(n != -EAGAIN)
-   printk(write to io thread failed, 
-  errno = %d\n, -n);
-   else if(list_empty(dev-restart))
-   list_add(dev-restart, restart);
-   kfree(io_req);
+   if (submit_request(io_req, dev) == false)
return;
-   }
 
dev-rq_pos += sg-length  9;
dev-start_sg++;
-- 
1.8.3.1


--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with 2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031iu=/4140/ostg.clktrk
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PATCH 3/4] um: Cleanup SIGTERM handling

2013-08-18 Thread Richard Weinberger
Richard reported that some UML processes survive if the UML
main process receives a SIGTERM.
This issue was caused by a wrongly placed signal(SIGTERM, SIG_DFL)
in init_new_thread_signals().
It disabled the UML exit handler accidently for some processes.
The correct solution is to disable the fatal handler for all
UML helper threads/processes.
Such that last_ditch_exit() does not get called multiple times
and all processes can exit due to SIGTERM.

Cc: rjo...@redhat.com
Reported-by: Richard W.M. Jones rjo...@redhat.com
Signed-off-by: Richard Weinberger rich...@nod.at
---
 arch/um/drivers/ubd.h   |  1 -
 arch/um/drivers/ubd_kern.c  |  3 ++-
 arch/um/drivers/ubd_user.c  |  5 -
 arch/um/include/shared/os.h |  1 +
 arch/um/os-Linux/aio.c  |  5 ++---
 arch/um/os-Linux/process.c  |  1 -
 arch/um/os-Linux/sigio.c|  2 +-
 arch/um/os-Linux/util.c | 10 ++
 8 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/arch/um/drivers/ubd.h b/arch/um/drivers/ubd.h
index 3845051..3b48cd2 100644
--- a/arch/um/drivers/ubd.h
+++ b/arch/um/drivers/ubd.h
@@ -7,7 +7,6 @@
 #ifndef __UM_UBD_USER_H
 #define __UM_UBD_USER_H
 
-extern void ignore_sigwinch_sig(void);
 extern int start_io_thread(unsigned long sp, int *fds_out);
 extern int io_thread(void *arg);
 extern int kernel_fd;
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 1812bc8..3716e69 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -1476,7 +1476,8 @@ int io_thread(void *arg)
struct io_thread_req *req;
int n;
 
-   ignore_sigwinch_sig();
+   os_fix_helper_signals();
+
while(1){
n = os_read_file(kernel_fd, req,
 sizeof(struct io_thread_req *));
diff --git a/arch/um/drivers/ubd_user.c b/arch/um/drivers/ubd_user.c
index a703e45..e376f9b 100644
--- a/arch/um/drivers/ubd_user.c
+++ b/arch/um/drivers/ubd_user.c
@@ -21,11 +21,6 @@
 #include ubd.h
 #include os.h
 
-void ignore_sigwinch_sig(void)
-{
-   signal(SIGWINCH, SIG_IGN);
-}
-
 int start_io_thread(unsigned long sp, int *fd_out)
 {
int pid, fds[2], err;
diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h
index 04859b7..24d8077 100644
--- a/arch/um/include/shared/os.h
+++ b/arch/um/include/shared/os.h
@@ -234,6 +234,7 @@ extern void setup_machinename(char *machine_out);
 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);
 
 /* time.c */
 extern void idle_sleep(unsigned long long nsecs);
diff --git a/arch/um/os-Linux/aio.c b/arch/um/os-Linux/aio.c
index 3a6bc2a..014eb35 100644
--- a/arch/um/os-Linux/aio.c
+++ b/arch/um/os-Linux/aio.c
@@ -104,8 +104,7 @@ static int aio_thread(void *arg)
struct io_event event;
int err, n, reply_fd;
 
-   signal(SIGWINCH, SIG_IGN);
-
+   os_fix_helper_signals();
while (1) {
n = io_getevents(ctx, 1, 1, event, NULL);
if (n  0) {
@@ -173,7 +172,7 @@ static int not_aio_thread(void *arg)
struct aio_thread_reply reply;
int err;
 
-   signal(SIGWINCH, SIG_IGN);
+   os_fix_helper_signals();
while (1) {
err = read(aio_req_fd_r, req, sizeof(req));
if (err != sizeof(req)) {
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index b8f34c9..7cd61ea 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -242,5 +242,4 @@ void init_new_thread_signals(void)
signal(SIGHUP, SIG_IGN);
set_handler(SIGIO);
signal(SIGWINCH, SIG_IGN);
-   signal(SIGTERM, SIG_DFL);
 }
diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c
index 8b61cc0..46e762f 100644
--- a/arch/um/os-Linux/sigio.c
+++ b/arch/um/os-Linux/sigio.c
@@ -55,7 +55,7 @@ static int write_sigio_thread(void *unused)
int i, n, respond_fd;
char c;
 
-   signal(SIGWINCH, SIG_IGN);
+   os_fix_helper_signals();
fds = current_poll;
while (1) {
n = poll(fds-poll, fds-used, -1);
diff --git a/arch/um/os-Linux/util.c b/arch/um/os-Linux/util.c
index 492ef5e..faee55e 100644
--- a/arch/um/os-Linux/util.c
+++ b/arch/um/os-Linux/util.c
@@ -94,6 +94,16 @@ static inline void __attribute__ ((noreturn)) uml_abort(void)
exit(127);
 }
 
+/*
+ * UML helper threads must not handle SIGWINCH/INT/TERM
+ */
+void os_fix_helper_signals(void)
+{
+   signal(SIGWINCH, SIG_IGN);
+   signal(SIGINT, SIG_DFL);
+   signal(SIGTERM, SIG_DFL);
+}
+
 void os_dump_core(void)
 {
int pid;
-- 
1.8.3.1


--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with 2

[uml-devel] [PATCH] um: ubd: Add REQ_FLUSH suppport

2013-08-17 Thread Richard Weinberger
UML's block device driver does not support write barriers,
to support this this patch adds REQ_FLUSH suppport.
Every time the block layer sends a REQ_FLUSH we fsync() now
our backing file to guarantee data consistency.

Cc: rjo...@redhat.com
Signed-off-by: Richard Weinberger rich...@nod.at
---
 arch/um/drivers/ubd_kern.c  | 41 -
 arch/um/include/shared/os.h |  1 +
 arch/um/os-Linux/file.c |  9 +
 3 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 879990c..d27c703 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -41,7 +41,7 @@
 #include os.h
 #include cow.h
 
-enum ubd_req { UBD_READ, UBD_WRITE };
+enum ubd_req { UBD_READ, UBD_WRITE, UBD_FLUSH };
 
 struct io_thread_req {
struct request *req;
@@ -866,6 +866,7 @@ static int ubd_add(int n, char **error_out)
goto out;
}
ubd_dev-queue-queuedata = ubd_dev;
+   blk_queue_flush(ubd_dev-queue, REQ_FLUSH);
 
blk_queue_max_segments(ubd_dev-queue, MAX_SG);
err = ubd_disk_register(UBD_MAJOR, ubd_dev-size, n, ubd_gendisk[n]);
@@ -1239,6 +1240,19 @@ static void prepare_request(struct request *req, struct 
io_thread_req *io_req,
 }
 
 /* Called with dev-lock held */
+static void prepare_flush_request(struct request *req,
+ struct io_thread_req *io_req)
+{
+   struct gendisk *disk = req-rq_disk;
+   struct ubd *ubd_dev = disk-private_data;
+
+   io_req-req = req;
+   io_req-fds[0] = (ubd_dev-cow.file != NULL) ? ubd_dev-cow.fd :
+   ubd_dev-fd;
+   io_req-op = UBD_FLUSH;
+}
+
+/* Called with dev-lock held */
 static void do_ubd_request(struct request_queue *q)
 {
struct io_thread_req *io_req;
@@ -1259,6 +1273,20 @@ static void do_ubd_request(struct request_queue *q)
}
 
req = dev-request;
+
+   if (req-cmd_flags  REQ_FLUSH) {
+   io_req = kmalloc(sizeof(struct io_thread_req),
+GFP_ATOMIC);
+   if (io_req == NULL) {
+   if (list_empty(dev-restart))
+   list_add(dev-restart, restart);
+   return;
+   }
+   prepare_flush_request(req, io_req);
+   os_write_file(thread_fd, io_req,
+ sizeof(struct io_thread_req *));
+   }
+
while(dev-start_sg  dev-end_sg){
struct scatterlist *sg = dev-sg[dev-start_sg];
 
@@ -1367,6 +1395,17 @@ static void do_io(struct io_thread_req *req)
int err;
__u64 off;
 
+   if (req-op == UBD_FLUSH) {
+   /* fds[0] is always either the rw image or our cow file */
+   n = os_sync_file(req-fds[0]);
+   if (n != 0) {
+   printk(do_io - sync failed err = %d 
+  fd = %d\n, -n, req-fds[0]);
+   req-error = 1;
+   }
+   return;
+   }
+
nsectors = req-length / req-sectorsize;
start = 0;
do {
diff --git a/arch/um/include/shared/os.h b/arch/um/include/shared/os.h
index 95feaa4..04859b7 100644
--- a/arch/um/include/shared/os.h
+++ b/arch/um/include/shared/os.h
@@ -141,6 +141,7 @@ extern int os_seek_file(int fd, unsigned long long offset);
 extern int os_open_file(const char *file, struct openflags flags, int mode);
 extern int os_read_file(int fd, void *buf, int len);
 extern int os_write_file(int fd, const void *buf, int count);
+extern int os_sync_file(int fd);
 extern int os_file_size(const char *file, unsigned long long *size_out);
 extern int os_file_modtime(const char *file, unsigned long *modtime);
 extern int os_pipe(int *fd, int stream, int close_on_exec);
diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c
index c17bd6f..07a7501 100644
--- a/arch/um/os-Linux/file.c
+++ b/arch/um/os-Linux/file.c
@@ -266,6 +266,15 @@ int os_write_file(int fd, const void *buf, int len)
return n;
 }
 
+int os_sync_file(int fd)
+{
+   int n = fsync(fd);
+
+   if (n  0)
+   return -errno;
+   return n;
+}
+
 int os_file_size(const char *file, unsigned long long *size_out)
 {
struct uml_stat buf;
-- 
1.8.3.1


--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with 2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031iu=/4140/ostg.clktrk
___
User-mode-linux-devel mailing list
User-mode-linux-devel

Re: [uml-devel] How to reliably kill all vmlinux processes for a single VM?

2013-08-13 Thread Richard Weinberger
Am 13.08.2013 12:36, schrieb Richard W.M. Jones:
 On Mon, Aug 12, 2013 at 09:53:00AM +0100, Richard W.M. Jones wrote:
 On Mon, Aug 12, 2013 at 10:15:24AM +0200, richard -rw- weinberger wrote:
 Found the root cause, patch is on the way.

 I can test patches if you CC me on them.
 
 I'm still available to test patches :-)  Didn't see anything on
 this list nor on LKML.

I'm currently on the road...

 In particular I'm having a problem where it looks as if vmlinux is
 sending a signal to its parent process on shutdown.


Really?
If so, why does it not kill my shell if I run it directly?

Thanks,
//richard

 I can reliably reproduce this, although not with anything very
 minimal.  But if you run the libguestfs test suite like this you'll
 see it:
 
   make -C tests/regressions check TESTS=rhbz914931
 
 The parent process (a C program which for unrelated reasons is called
 'rhbz914931') receives a SIGTERM.  I checked the siginfo struct for
 this signal, and it appears to come from the vmlinux main process,
 which should not be happening.
 
 So .. possibly there's something awry with how vmlinux delivers
 signals to its child processes on shutdown which is causing it both to
 miss out some children, and to kill other unrelated processes.  Or
 maybe this is just a coincidence.
 
 Rich.
 


--
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with 2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031iu=/4140/ostg.clktrk
___
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: Accept /dev/fd/* uml block devices

2013-07-28 Thread Richard Weinberger
Am 27.07.2013 17:23, schrieb Gabriel de Perthuis:
 Useful for
 * limiting privileges
 * opening block devices O_EXCL

So, the goal of this patch is to allow passing a file descriptor
number as block device instead of a file?

I assume you have already a wrapper around UML which exec()'s it such that
it can reuse a fd?

 Use dup to work around the fact /proc/self/fd
 can't be opened after dropping privileges.
 This proc behaviour doesn't match TLPI and might be a bug.
 
 Qemu has a slightly more complex fdset approach
 that provides fds with different access permissions.

I really don't like that you patch os_open_file(), this is a
generic function.

What about this one?
Allow ubda= (and all other UML block device kernel parameters) to
accept arguments like file:/foo/bar and fd:N.
Where N is a number and file: is default such that we do not break
old kernels.

Thanks,
//richard

 Signed-off-by: Gabriel de Perthuis g2p.c...@gmail.com
 ---
  arch/um/os-Linux/file.c | 10 +++---
  1 file changed, 7 insertions(+), 3 deletions(-)
 
 diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c
 index c17bd6f..cee65ba 100644
 --- a/arch/um/os-Linux/file.c
 +++ b/arch/um/os-Linux/file.c
 @@ -169,11 +169,11 @@ int os_file_mode(const char *file, struct openflags 
 *mode_out)
   return err;
  }
  
  int os_open_file(const char *file, struct openflags flags, int mode)
  {
 - int fd, err, f = 0;
 + int fd, fd0, err, f = 0;
  
   if (flags.r  flags.w)
   f = O_RDWR;
   else if (flags.r)
   f = O_RDONLY;
 @@ -190,11 +190,15 @@ int os_open_file(const char *file, struct openflags 
 flags, int mode)
   if (flags.e)
   f |= O_EXCL;
   if (flags.a)
   f |= O_APPEND;
  
 - fd = open64(file, f, mode);
 + if (!strncmp(file, /dev/fd/, 8)
 +  sscanf(file, /dev/fd/%d, fd0) == 1)
 + fd = dup(fd0);
 + else
 + fd = open64(file, f, mode);
   if (fd  0)
   return -errno;
  
   if (flags.cl  fcntl(fd, F_SETFD, 1)) {
   err = -errno;
 @@ -280,11 +284,11 @@ int os_file_size(const char *file, unsigned long long 
 *size_out)
  
   if (S_ISBLK(buf.ust_mode)) {
   int fd;
   long blocks;
  
 - fd = open(file, O_RDONLY, 0);
 + fd = os_open_file(file, of_read(OPENFLAGS()), 0);
   if (fd  0) {
   err = -errno;
   printk(UM_KERN_ERR Couldn't open \%s\, 
  errno = %d\n, file, errno);
   return err;
 


--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831iu=/4140/ostg.clktrk
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


[uml-devel] [PULL] UML fixes for 3.11-rc2

2013-07-19 Thread Richard Weinberger
Linus,

please pull from:

  git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml.git for-linus

Special thanks goes to Toralf Föster for continuously testing UML and reporting 
issues!

Thanks,
//richard


Richard Weinberger (5):
  um: Fix return value of strnlen_user()
  um: Mark stub pages mapping with VM_PFNMAP
  um: Fix wait_stub_done() error handling
  um: siginfo cleanup
  um: remove dead code

Tristan Schmelcher (1):
  uml: Fix which_tmpdir failure when /dev/shm is a symlink, and in other 
edge cases

 arch/um/include/shared/frame_kern.h |   8 +-
 arch/um/kernel/signal.c |   4 +-
 arch/um/kernel/skas/mmu.c   |   2 +-
 arch/um/kernel/skas/uaccess.c   |   2 +-
 arch/um/os-Linux/mem.c  | 230 +---
 arch/um/os-Linux/signal.c   |   8 +-
 arch/um/os-Linux/skas/process.c |  19 +--
 arch/x86/um/signal.c|   1 -
 8 files changed, 213 insertions(+), 61 deletions(-)

--
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831iu=/4140/ostg.clktrk
___
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] [PATCHv3] uml: Fix which_tmpdir failure when /dev/shm is a symlink, and in other edge cases

2013-07-08 Thread Richard Weinberger
Am 08.07.2013 22:19, schrieb Tristan Schmelcher:
 From: Tristan Schmelcher tschmelc...@google.com
 
 which_tmpdir did the wrong thing if /dev/shm was a symlink (e.g., to 
 /run/shm),
 if there were multiple mounts on top of each other, if the mount(s) were
 obscured by a later mount, or if /dev/shm was a prefix of another mount point.
 This fixes these cases. Applies to 3.9.6.
 
 Signed-off-by: Tristan Schmelcher tschmelc...@google.com

Is this just a resend or did your alter the patch you sent me already?
I'm about to send my UML patches to Linus tomorrow.

Thanks,
//richard

--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
___
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] include/asm-generic/io.h: add 'UML' case just like 'no-MMU'

2013-06-26 Thread Richard Weinberger
Am 26.06.2013 11:33, schrieb Chen Gang:
 On 06/26/2013 05:03 PM, Richard Weinberger wrote:
 Am 26.06.2013 10:58, schrieb Chen Gang:
 On 06/26/2013 04:39 PM, Richard Weinberger wrote:
 The drivers internal code has already check the related 
 return value,
 so it is the architecture's duty to 'tell' the driver 
 whether support
 io memory (e.g. define ioremap, but return NULL).
 It does so already by setting CONFIG_HAS_IOMEM=n

 Excuse me, I use grep -rn ioremap * under include/ and arch/um/
 directory, but can not find the related definition for 'ioremap'.

 Is there another declaration or definition way which I don't know ?
 (maybe it is).
 Both UML and s390 (in the !CONFIG_PCI) do not define ioremap() because
 without io memory you cannot have a ioremap().


 I assume if ioremap() return NULL, it means without io memory, is it
 correct ?

 If it is correct, define a dummy ioremap(), and return NULL is just
 the meaning that you mentioned above.

 If so, for UML, it is not requirement, but recommend to define a dummy
 ioremap() which return NULL, so can be generic enough to mach all cases.
 No.
 Not setting CONFIG_HAS_IOMEM=y means This arch has no io memory and 
 therefore no
 functions to mess with it.

 
 Since the API itself already contents the meaning: return NULL means
 the arch has no related io memory,
 
 Why not define a generic dummy one in include/asm-generic/io.h instead
 of HAS_IOMEM (which has already spread many various places, and also,
 most of new drivers have to know about it).
 
 e.g: in include/asm-generic/io.h, if CONFIG_HAS_IOMEM=n, define a
 dummy ioremap() which return NULL ... (also need consider more details).

Because we don't even want to build these drivers and not make them fail while
executing io memory related functions.

 
 All together, I think: it is the duty of asm-generic/io.h to process
 this issue, not the duty of many drivers and some architectures.
 
 
 Let's get back to the real problem,
 drivers/ptp/ptp_pch.c does not build on UML (and I'm very sure also not on 
 S390).
 Fix the issue by making it depend on HAS_IOMEM.

 
 At least now, it seems it is the only suitable way to fix this issue.  :-(
 
 
 Btw: Did you actually look at this driver? There is *zero* reason to have it 
 on UML.
 ..like 99.9% of all other drivers which use io memory.
 
 Excuse me, I did not look at the details of this driver. Maybe it just
 like you said above.

It is.

Thanks,
//richard


--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
___
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] include/asm-generic/io.h: add 'UML' case just like 'no-MMU'

2013-06-26 Thread Richard Weinberger
Am 26.06.2013 10:34, schrieb Chen Gang:
 On 06/26/2013 04:05 PM, Richard Weinberger wrote:
 diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
 index d5afe96..e80331d 100644
 --- a/include/asm-generic/io.h
 +++ b/include/asm-generic/io.h
 @@ -303,10 +303,10 @@ static inline void *phys_to_virt(unsigned long 
 address)
  /*
   * Change struct page to physical address.
   *
 - * This implementation is for the no-MMU case only... if you have an 
 MMU
 + * This implementation is for the no-MMU or UML case only... if you 
 have an MMU
   * you'll need to provide your own definitions.
   */
 -#ifndef CONFIG_MMU
 +#if !CONFIG_MMU || CONFIG_UML
  static inline void __iomem *ioremap(phys_addr_t offset, unsigned long 
 size)
  {
return (void __iomem*) (unsigned long)offset;
 @@ -325,7 +325,7 @@ static inline void __iomem *ioremap(phys_addr_t 
 offset, unsigned long size)
  static inline void iounmap(void __iomem *addr)
  {
  }
 -#endif /* CONFIG_MMU */
 +#endif /* !CONFIG_MMU || CONFIG_UML */
  
  #ifdef CONFIG_HAS_IOPORT
  #ifndef CONFIG_GENERIC_IOMAP


 UML has no io memory but a MMU, so I'd argue that you better fix 
 drivers/ptp/ptp_pch.c dependencies.
 _If_ ptp_pch.c really works without real io memory, you can look what I 
 did in my GENERIC_IO series[1]
 to make nandsim work on UML. Maybe this helps.


 But no io memory is not the excuse to not define the related dummy
 function.
 UML has no io memory, period.
 Same applies for s390, it also includes asm-generic/io.h in the !CONFIG_PCI
 case.
 UML and s390 are very special here.

 
 Oh, yes, really the same.
 
 The drivers internal code has already check the related return value,
 so it is the architecture's duty to 'tell' the driver whether support
 io memory (e.g. define ioremap, but return NULL).
 It does so already by setting CONFIG_HAS_IOMEM=n
 
 Excuse me, I use grep -rn ioremap * under include/ and arch/um/
 directory, but can not find the related definition for 'ioremap'.
 
 Is there another declaration or definition way which I don't know ?
 (maybe it is).

Both UML and s390 (in the !CONFIG_PCI) do not define ioremap() because
without io memory you cannot have a ioremap().

 For our case, the .config file does not define 'CONFIG_HAS_IOMEM', can
 I assume it means CONFIG_HAS_IOMEM=n ?

If I'm not mistaken it works the other way around.
All archs except UML and s390 set CONFIG_HAS_IOMEM=y.

Thanks,
//richard

--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
___
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] include/asm-generic/io.h: add 'UML' case just like 'no-MMU'

2013-06-26 Thread Richard Weinberger
Am 26.06.2013 12:01, schrieb Chen Gang:
 On 06/26/2013 05:48 PM, Geert Uytterhoeven wrote:
 On Wed, Jun 26, 2013 at 11:38 AM, Richard Weinberger rich...@nod.at wrote:
 Since the API itself already contents the meaning: return NULL means
 the arch has no related io memory,
 No, NULL means it could not map the I/O memory.

 
 it could not map the I/O memory includes has no related io memory.
 So it is enough for our case.
 
 Why not define a generic dummy one in include/asm-generic/io.h instead
 of HAS_IOMEM (which has already spread many various places, and also,
 most of new drivers have to know about it).

 e.g: in include/asm-generic/io.h, if CONFIG_HAS_IOMEM=n, define a
 dummy ioremap() which return NULL ... (also need consider more details).

 Because we don't even want to build these drivers and not make them fail 
 while
 executing io memory related functions.
 Indeed, it doesn't make sense to build drivers that cannot work.
 And they may fail in a very bad way.
 
 That is our 'platform' guys feeling, not the 'module' guys, as
 'platform' guys, it is better to provide the choice to 'module' guys,
 and let them decide by themselves, not forced by us.

FYI, this is my last reply to this thread.

As Geert and I said, drivers which need io memory have to depend on HAS_IOMEM=y.
If an arch does not have io memory these drivers cannot work and therefore we 
don't
want them built.

Over and out,
//richard

--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
___
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] include/asm-generic/io.h: add 'UML' case just like 'no-MMU'

2013-06-26 Thread Richard Weinberger
Am 26.06.2013 10:58, schrieb Chen Gang:
 On 06/26/2013 04:39 PM, Richard Weinberger wrote:
 The drivers internal code has already check the related return value,
 so it is the architecture's duty to 'tell' the driver whether support
 io memory (e.g. define ioremap, but return NULL).
 It does so already by setting CONFIG_HAS_IOMEM=n

 Excuse me, I use grep -rn ioremap * under include/ and arch/um/
 directory, but can not find the related definition for 'ioremap'.

 Is there another declaration or definition way which I don't know ?
 (maybe it is).
 Both UML and s390 (in the !CONFIG_PCI) do not define ioremap() because
 without io memory you cannot have a ioremap().

 
 I assume if ioremap() return NULL, it means without io memory, is it
 correct ?
 
 If it is correct, define a dummy ioremap(), and return NULL is just
 the meaning that you mentioned above.
 
 If so, for UML, it is not requirement, but recommend to define a dummy
 ioremap() which return NULL, so can be generic enough to mach all cases.

No.
Not setting CONFIG_HAS_IOMEM=y means This arch has no io memory and therefore 
no
functions to mess with it.

Let's get back to the real problem,
drivers/ptp/ptp_pch.c does not build on UML (and I'm very sure also not on 
S390).
Fix the issue by making it depend on HAS_IOMEM.

Btw: Did you actually look at this driver? There is *zero* reason to have it on 
UML.
...like 99.9% of all other drivers which use io memory.

Thanks,
//richard

--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
___
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] include/asm-generic/io.h: add 'UML' case just like 'no-MMU'

2013-06-26 Thread Richard Weinberger
Hi!

Am 26.06.2013 08:31, schrieb Chen Gang:
 For User Mode Linux, it may enable 'MMU', but not need implement
 ioremap and iounmap, so include/asm-generic/io.h need notice this
 case to keep itself 'generic'.
 
 The related error (with allmodconfig, without pcap):
 
 CC [M]  drivers/ptp/ptp_pch.o
   drivers/ptp/ptp_pch.c: In function ‘pch_remove’:
   drivers/ptp/ptp_pch.c:571:3: error: implicit declaration of function 
 ‘iounmap’ [-Werror=implicit-function-declaration]
   drivers/ptp/ptp_pch.c: In function ‘pch_probe’:
   drivers/ptp/ptp_pch.c:621:2: error: implicit declaration of function 
 ‘ioremap’ [-Werror=implicit-function-declaration]
   drivers/ptp/ptp_pch.c:621:13: warning: assignment makes pointer from 
 integer without a cast [enabled by default]
   cc1: some warnings being treated as errors
 
 
 Signed-off-by: Chen Gang gang.c...@asianux.com
 ---
  arch/um/include/asm/Kbuild |1 +
  include/asm-generic/io.h   |6 +++---
  2 files changed, 4 insertions(+), 3 deletions(-)
 
 diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild
 index b30f34a..a34ea5d 100644
 --- a/arch/um/include/asm/Kbuild
 +++ b/arch/um/include/asm/Kbuild
 @@ -3,3 +3,4 @@ generic-y += hw_irq.h irq_regs.h kdebug.h percpu.h sections.h 
 topology.h xor.h
  generic-y += ftrace.h pci.h io.h param.h delay.h mutex.h current.h exec.h
  generic-y += switch_to.h clkdev.h
  generic-y += trace_clock.h
 +generic-y += io.h

We include that file already. See three lines above.

 diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
 index d5afe96..e80331d 100644
 --- a/include/asm-generic/io.h
 +++ b/include/asm-generic/io.h
 @@ -303,10 +303,10 @@ static inline void *phys_to_virt(unsigned long address)
  /*
   * Change struct page to physical address.
   *
 - * This implementation is for the no-MMU case only... if you have an MMU
 + * This implementation is for the no-MMU or UML case only... if you have an 
 MMU
   * you'll need to provide your own definitions.
   */
 -#ifndef CONFIG_MMU
 +#if !CONFIG_MMU || CONFIG_UML
  static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
  {
   return (void __iomem*) (unsigned long)offset;
 @@ -325,7 +325,7 @@ static inline void __iomem *ioremap(phys_addr_t offset, 
 unsigned long size)
  static inline void iounmap(void __iomem *addr)
  {
  }
 -#endif /* CONFIG_MMU */
 +#endif /* !CONFIG_MMU || CONFIG_UML */
  
  #ifdef CONFIG_HAS_IOPORT
  #ifndef CONFIG_GENERIC_IOMAP
 

UML has no io memory but a MMU, so I'd argue that you better fix 
drivers/ptp/ptp_pch.c dependencies.
_If_ ptp_pch.c really works without real io memory, you can look what I did in 
my GENERIC_IO series[1]
to make nandsim work on UML. Maybe this helps.

Thanks,
//richard

[1] http://lists.infradead.org/pipermail/linux-mtd/2012-February/039701.html


--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
___
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] include/asm-generic/io.h: add 'UML' case just like 'no-MMU'

2013-06-26 Thread Richard Weinberger
Hi!

Am 26.06.2013 09:56, schrieb Chen Gang:
 On 06/26/2013 02:54 PM, Richard Weinberger wrote:
 Hi!

 Am 26.06.2013 08:31, schrieb Chen Gang:
 For User Mode Linux, it may enable 'MMU', but not need implement
 ioremap and iounmap, so include/asm-generic/io.h need notice this
 case to keep itself 'generic'.

 The related error (with allmodconfig, without pcap):

 CC [M]  drivers/ptp/ptp_pch.o
   drivers/ptp/ptp_pch.c: In function �pch_remove�:
   drivers/ptp/ptp_pch.c:571:3: error: implicit declaration of function 
 �iounmap� [-Werror=implicit-function-declaration]
   drivers/ptp/ptp_pch.c: In function �pch_probe�:
   drivers/ptp/ptp_pch.c:621:2: error: implicit declaration of function 
 �ioremap� [-Werror=implicit-function-declaration]
   drivers/ptp/ptp_pch.c:621:13: warning: assignment makes pointer from 
 integer without a cast [enabled by default]
   cc1: some warnings being treated as errors


 Signed-off-by: Chen Gang gang.c...@asianux.com
 ---
  arch/um/include/asm/Kbuild |1 +
  include/asm-generic/io.h   |6 +++---
  2 files changed, 4 insertions(+), 3 deletions(-)

 diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild
 index b30f34a..a34ea5d 100644
 --- a/arch/um/include/asm/Kbuild
 +++ b/arch/um/include/asm/Kbuild
 @@ -3,3 +3,4 @@ generic-y += hw_irq.h irq_regs.h kdebug.h percpu.h 
 sections.h topology.h xor.h
  generic-y += ftrace.h pci.h io.h param.h delay.h mutex.h current.h exec.h
  generic-y += switch_to.h clkdev.h
  generic-y += trace_clock.h
 +generic-y += io.h

 We include that file already. See three lines above.

 
 Oh, really it is, thanks.
 
 diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
 index d5afe96..e80331d 100644
 --- a/include/asm-generic/io.h
 +++ b/include/asm-generic/io.h
 @@ -303,10 +303,10 @@ static inline void *phys_to_virt(unsigned long 
 address)
  /*
   * Change struct page to physical address.
   *
 - * This implementation is for the no-MMU case only... if you have an MMU
 + * This implementation is for the no-MMU or UML case only... if you have 
 an MMU
   * you'll need to provide your own definitions.
   */
 -#ifndef CONFIG_MMU
 +#if !CONFIG_MMU || CONFIG_UML
  static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
  {
 return (void __iomem*) (unsigned long)offset;
 @@ -325,7 +325,7 @@ static inline void __iomem *ioremap(phys_addr_t offset, 
 unsigned long size)
  static inline void iounmap(void __iomem *addr)
  {
  }
 -#endif /* CONFIG_MMU */
 +#endif /* !CONFIG_MMU || CONFIG_UML */
  
  #ifdef CONFIG_HAS_IOPORT
  #ifndef CONFIG_GENERIC_IOMAP


 UML has no io memory but a MMU, so I'd argue that you better fix 
 drivers/ptp/ptp_pch.c dependencies.
 _If_ ptp_pch.c really works without real io memory, you can look what I did 
 in my GENERIC_IO series[1]
 to make nandsim work on UML. Maybe this helps.

 
 But no io memory is not the excuse to not define the related dummy
 function.

UML has no io memory, period.
Same applies for s390, it also includes asm-generic/io.h in the !CONFIG_PCI
case.
UML and s390 are very special here.


 The drivers internal code has already check the related return value,
 so it is the architecture's duty to 'tell' the driver whether support
 io memory (e.g. define ioremap, but return NULL).

It does so already by setting CONFIG_HAS_IOMEM=n

Thanks,
//richard

--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
___
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


<    1   2   3   4   5   6   7   8   >