<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi:<BR>&nbsp;&nbsp; It is well know that is not recomended to keep a spinlock locked during operations that can be preempted. Some of these operations are copy_to_user, copy_from_user.<BR>Below is the code of the write_lock() as a sample.<BR>&nbsp;<BR>340 static inline void __write_lock(rwlock_t *lock)<BR>&nbsp;341{<BR>&nbsp;342&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; preempt_disable(); &lt;&lt;&lt;&lt;&lt;&lt; THE ISSUE IS HERE &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;<BR>&nbsp;343&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rwlock_acquire(&amp;lock-&gt;dep_map, 0, 0, _RET_IP_);<BR>&nbsp;344&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LOCK_CONTENDED(lock, _raw_write_trylock, _raw_write_lock);<BR>&nbsp;345}<BR><BR>On write_unlock() the preemtion is enable.<BR>&nbsp;<BR>My question is: Is there any know&nbsp;consequence if I enable preemption before copy_to_user/copy_from user (keeping the spinlock locked)&nbsp;and then disable preemption&nbsp;again after the copy?????<BR>i.e.:<BR>
write_lock(&amp;lock);<BR>
.......<BR>&nbsp;preempt_enable(); <BR>&nbsp;copy_to_user(.......);<BR>&nbsp; preempt_disable(); <BR>&nbsp;.......<BR>
write_unlock(&amp;lock);<BR>
<BR>Thanks in advance.<BR>PAP<BR>&nbsp;<BR>&nbsp;<BR>&nbsp;<BR>&nbsp;<BR>&nbsp;<BR><BR>                                               </div></body>
</html>