On Mon, Jun 2, 2014 at 7:55 PM, Nalli, Sanketh <sanketh.na...@hp.com> wrote:
> Thanks a lot.
>
> Do you know why my /proc is empty in the guest

Did you mount procfs?

> And why does the /proc/PID/exe NOT point to anything in
>
> The host ? (PID is the pid of a dummy program running in UML)

Host PID != Guest PID

>
>
> From: enjoy mindful [mailto:enjoymind...@gmail.com]
> Sent: Friday, May 30, 2014 12:06 AM
> To: Nalli, Sanketh
> Cc: user-mode-linux-user@lists.sourceforge.net
> Subject: Re: [uml-user] invalid /proc/PID/exe in UML processes
>
>
>
> let me answer your second question.
>
> I did this analysis with kernel linux-3.12.6:
>
> 1) make ARCH=um cscope
> 2) search functions which called 'clone'
>   File       Function        Line
> 0 ubd_user.c start_io_thread   43 pid = clone(io_thread, (void *) sp,
> CLONE_FILES |
>                                   CLONE_VM, NULL);
> 1 helper.c   start_io_thread   74 pid = clone(helper_child, (void *) sp,
> CLONE_VM, &data);
> 2 helper.c   start_io_thread  124 pid = clone(proc, (void *) sp, flags,
> arg);
> 3 process.c  start_userspace  300 pid = clone(userspace_tramp, (void *) sp,
> flags, (void *)
>                                   stub_stack);
> 4 lguest.c   create_thread   1048 vq->thread = clone(do_thread, stack +
> 32768, CLONE_VM |
>                                   SIGCHLD, vq);
>
> 3) insert some printk statement in those function
> 4) build and run, then watch the booting process output
> [root@localhost ~]# dmesg | grep 6436
> [    0.190000] run_helper_thread : clone success, pid = 6436
> [root@localhost ~]# dmesg | grep 6437
> [    0.190000] start_io_thread - clone success : pid = 6437
> [root@localhost ~]# dmesg | grep 6438
> [    0.190000] run_helper_thread : clone success, pid = 6438
>
> [real@real runuml]$ ps -ef | grep patch
> real     6423  1553  6 16:17 pts/0    00:00:02 ./linux_patched
> ubda=./Fedora20-x86-root_fs mem=256m
> real     6436  6423  0 16:17 pts/0    00:00:00 ./linux_patched
> ubda=./Fedora20-x86-root_fs mem=256m
> real     6437  6423  0 16:17 pts/0    00:00:00 ./linux_patched
> ubda=./Fedora20-x86-root_fs mem=256m
> real     6438  6423  0 16:17 pts/0    00:00:00 ./linux_patched
> ubda=./Fedora20-x86-root_fs mem=256m
> real     6439  6423  0 16:17 pts/0    00:00:00 [linux_patched]
> real     6459  6423  0 16:17 pts/0    00:00:00 [linux_patched]
> real     6479  6423  0 16:17 pts/0    00:00:00 [linux_patched]
> real     6492  6423  0 16:17 pts/0    00:00:00 [linux_patched]
> real     6565  6423  0 16:17 pts/0    00:00:00 [linux_patched]
> real     6567  6423  0 16:17 pts/0    00:00:00 [linux_patched]
> real     6572  6423  0 16:17 pts/0    00:00:00 [linux_patched]
> real     6573  6423  0 16:17 pts/0    00:00:00 [linux_patched]
> real     6576  6423  0 16:17 pts/0    00:00:00 [linux_patched]
> real     6605  6423  0 16:17 pts/0    00:00:00 [linux_patched]
> real     6619  6423  0 16:17 pts/0    00:00:00 [linux_patched]
> real     6621  6423  0 16:17 pts/0    00:00:00 [linux_patched]
> real     6707  6423  0 16:17 pts/0    00:00:00 [linux_patched]
> real     6715  6423  0 16:17 pts/0    00:00:00 [linux_patched]
> real     6765  6423  0 16:18 pts/0    00:00:00 [linux_patched]
>
> [root@localhost ~]# dmesg | grep proc
> [    0.090000] run_helper_thread : clone success, pid = 8387, proc=0806471d
> [    0.100000] run_helper_thread : clone success, pid = 8389, proc=080663a3
>
> [real@real linux-3.12.6]$ grep 0806471d System.map
> 0806471d t aio_thread
> [real@real linux-3.12.6]$ grep 080663a3 System.map
> 080663a3 t write_sigio_thread
>
> so, the four processes are:
> 1) uml kernel main thread
> 2) aio_thread
> 3) io_thread
> 4) write_sigio_thread
>
>
>
> On Fri, May 30, 2014 at 9:22 AM, Nalli, Sanketh <sanketh.na...@hp.com>
> wrote:
>
> Hi,
>
> So I start UML with the cmdline
>
> ./linux rootfstype=hostfs rw mem=1G init=/bin/bash
>
>
>
> When the bash shell comes up, I run my prog : ./my_prog
>
>
>
> 6173 pts/8    00:00:00 linux
>
> 6180 pts/8    00:00:00 linux
>
> 6181 pts/8    00:00:00 linux
>
> 6182 pts/8    00:00:00 linux
>
> 6183 pts/8    00:00:00 linux
>
> 6188 pts/8    00:00:13 linux
>
>
>
>
>
> The last item in the list with PID is 6188 is my program.
>
> I can tell because my_prog increments a counter in an infinite loop
>
> And consumes CPU cycles. It shows up on “top” as the dominant process.
>
>
>
> My question:
>
> 1.       /proc/6188/exe is invalid. Why ??
>
> I mean, it doesn’t point to anything.
>
> Shouldn’t it point to my_prog or something ?
>
>
>
> 2.       What do the 4 UML processes 6173, 6180, 6181, 6182 do ? (6183 is
> /bin/bash whos “exe” symlink is also doesn’t point to anything !!)
>
> 3.       When a UML process, say my_prog (PID 6188) makes a system call,
> where is the system call executed – is it within the addr space of 6173 (the
> UML kernel process) or 6188 (my_prog running in UML ??)
>
>
>
> -Sanketh
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> 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-user mailing list
> User-mode-linux-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user
>
>
>
>
> ------------------------------------------------------------------------------
> 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-user mailing list
> User-mode-linux-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user
>



-- 
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-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user

Reply via email to