<div dir="ltr"><div><div>It seems this task "landscape-sysin" is trying to peek into virtual memory of your processes and the process within mmap call is holding its mm->mmap_sem semaphore which grants access to its address space. landscape-sysin is trying to grab this semaphore to poke into address space of your mmap process address space. As from your description, it might be invoked everytime you are opening a new shell. Not sure why this process bother's about other process address space. Little googling shows this as relevant to your case:<br>
<br><a href="http://www.techques.com/question/2-66765/Disable-usage-of-console-kit-daemon-in-Ubuntu">http://www.techques.com/question/2-66765/Disable-usage-of-console-kit-daemon-in-Ubuntu</a><br><br></div>Your read process is innocent and not involved in this deadlock.<br>
<br></div>-Rajat<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Feb 26, 2014 at 4:13 AM, Le Tan <span dir="ltr"><<a href="mailto:tamlokveer@gmail.com" target="_blank">tamlokveer@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi, I am writing a driver module. Now I have some questions about blocked I/O.<br>
my_read() is the read function in the file_operations struct in my<br>
module. my_read() is just as simple as this:<br>
ssize_t my_read(....)<br>
{<br>
if(wait_event_interruptible(dev->queue, a == b))<br>
return -ERESTARTSYS;<br>
return count;<br>
}<br>
Then I write a simple program to open and read the device. Obviously<br>
the program will be blocked. Now I still can open a new shell window<br>
and log in ( I use xshell).<br>
<br>
However, then I implement my_mmap(), the mmap function in the<br>
file_operations struct in my module, like this:<br>
int my_mmap(....)<br>
{<br>
if(wait_event_interruptible(dev->queue, a == b))<br>
return -ERESTARTSYS;<br>
return 0;<br>
}<br>
Then I write a simple program to open and mmap() the device. Obviously<br>
the program will be blocked again. However, when I open a new shell<br>
window in xshell and try to connect to the linux, it displays like<br>
this:<br>
<br>
Connecting to 192.168.146.118:22...<br>
Connection established.<br>
To escape to local shell, press 'Ctrl+Alt+]'.<br>
<br>
And I can't log in! Then after a while, in the syslog, there is one<br>
message like this:<br>
[38306.614103] INFO: task landscape-sysin:17616 blocked for more than<br>
120 seconds.<br>
[38306.614114] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"<br>
disables this message.<br>
[38306.614120] landscape-sysin D ffffffff8180fb60 0 17616 17609 0x00000000<br>
[38306.614125] ffff88031d609c90 0000000000000082 ffff88032fffdb08<br>
0000000000000000<br>
[38306.614130] ffff8803130bdc40 ffff88031d609fd8 ffff88031d609fd8<br>
ffff88031d609fd8<br>
[38306.614133] ffff88062150c530 ffff8803130bdc40 0000004100000000<br>
ffff8803130bdc40<br>
[38306.614137] Call Trace:<br>
[38306.614147] [<ffffffff816b2c49>] schedule+0x29/0x70<br>
[38306.614151] [<ffffffff816b3acd>] rwsem_down_read_failed+0x9d/0xf0<br>
[38306.614157] [<ffffffff81341824>] call_rwsem_down_read_failed+0x14/0x30<br>
[38306.614160] [<ffffffff816b1644>] ? down_read+0x24/0x2b<br>
[38306.614166] [<ffffffff81153661>] __access_remote_vm+0x41/0x1f0<br>
[38306.614170] [<ffffffff81153ddb>] access_process_vm+0x5b/0x80<br>
[38306.614175] [<ffffffff811ea423>] proc_pid_cmdline+0x93/0x120<br>
[38306.614178] [<ffffffff811eb425>] proc_info_read+0xa5/0xf0<br>
[38306.614182] [<ffffffff81186e84>] vfs_read+0xb4/0x180<br>
[38306.614185] [<ffffffff81187102>] SyS_read+0x52/0xa0<br>
[38306.614189] [<ffffffff816bc8c2>] system_call_fastpath+0x16/0x1b<br>
<br>
If I terminate the program by force, then I can log in right now.<br>
So, are there any differences between the read and the mmap function<br>
to the wait_event_interruptible()? Why? If I want to block mmap() just<br>
like blocking read(), what should I do? Or it is impossible?<br>
Thanks!<br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</blockquote></div><br></div>