<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> 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> <BR>340 static inline void __write_lock(rwlock_t *lock)<BR> 341{<BR> 342 preempt_disable(); <<<<<< THE ISSUE IS HERE <<<<<<<<<<<<<<<BR> 343 rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);<BR> 344 LOCK_CONTENDED(lock, _raw_write_trylock, _raw_write_lock);<BR> 345}<BR><BR>On write_unlock() the preemtion is enable.<BR> <BR>My question is: Is there any know consequence if I enable preemption before copy_to_user/copy_from user (keeping the spinlock locked) and then disable preemption again after the copy?????<BR>i.e.:<BR>
write_lock(&lock);<BR>
.......<BR> preempt_enable(); <BR> copy_to_user(.......);<BR> preempt_disable(); <BR> .......<BR>
write_unlock(&lock);<BR>
<BR>Thanks in advance.<BR>PAP<BR> <BR> <BR> <BR> <BR> <BR><BR>                                            </div></body>
</html>