<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
Hi, <br>
I try this :<br>
<br> local_irq_save(flags);<br>
kvm_hypercall2 ( 6, 2, 2);<br>
local_irq_restore(flags);<br>
<br>
But I still have my kernel panic with "divide error: 0000 [#1] SMP" that I don't understand!<br>
with or without lock, nothing change, the same when I change the current state.<br>
<br>
I tried to move my hypercall and I still don't understand why it works just before my test<br>
"if (piga_on == 1)" without any protections (like disable interrupts) and not after..<br>
<br>
<em><strong></strong></em> Thank you for trying to help me<br><br><br>> Date: Thu, 9 Jun 2011 09:46:12 +0800<br>> Subject: Re: Problems with hypercalls<br>> From: htmldeveloper@gmail.com<br>> To: tricheurs@hotmail.fr<br>> CC: kernelnewbies@kernelnewbies.org<br>> <br>> perhaps this example will provide u with more info:<br>> <br>> http://a380.informatik.uni-bremen.de/lxr/source/arch/x86/lguest/boot.c<br>> <br>> I think the correct step is to disable IRQ instead - before every call<br>> to kvm_hypercallX(). The reason is given in the remark:<br>> <br>> 110 /*<br>> 111 * Disable interrupts if not already disabled: we don't want an<br>> 112 * interrupt handler making a hypercall while we're already doing<br>> 113 * one!<br>> 114 */<br>> <br>> On Wed, Jun 8, 2011 at 10:54 PM, emilie lefebvre <tricheurs@hotmail.fr> wrote:<br>> ><br>> > This is my function :<br>> ><br>> > static spinlock_t xgr_learn_lock = SPIN_LOCK_UNLOCKED;<br>> > static int piga_seq_cpt = 1;<br>> ><br>> > /*<br>> > * Function called for each systemcall (Hook SELinux avc function)<br>> > */<br>> > int piga_control(u32 ssid, ...., struct av_decision * avd) {<br>> ><br>> > /*<br>> > * Here my hypercall work but block my vm with this error :<br>> > * " BUG: scheduling while atomic ... "<br>> > */<br>> ><br>> > spin_lock_bh(&xgr_learn_lock);<br>> > if ( in_atomic())<br>> > kvm_hypercall2 ( 6, (unsigned long)2 ,(unsigned<br>> > long)piga_seq_cpt);<br>> > spin_unlock_bh(&xgr_learn_lock);<br>> ><br>> > if (piga_on == 1) {<br>> > /*<br>> > * Here my hypercall make a kernel panic with this error:<br>> > * " divide error: 0000 [#1] SMP"<br>> > */<br>> > spin_lock_bh(&xgr_learn_lock);<br>> > set_current_state(TASK_UNINTERRUPTIBLE);<br>> > kvm_hypercall2 ( 6, (unsigned long)2 ,(unsigned<br>> > long)piga_seq_cpt);<br>> > set_current_state(TASK_RUNNING);<br>> > spin_lock_bh(&xgr_learn_lock);<br>> > }<br>> > }<br>> ><br>> ><br>> <br>> I think u generally set TASK_UNINTERRUPTIBLE whenever about to modify<br>> the scheduling task list (eg, wait queue manipulation) or about to<br>> call "schedule()" (ie, doing your own scheduling). The function<br>> set_current_state() literally just set the variable value only, it<br>> does not disable interrupt.<br>> <br>> -- <br>> Regards,<br>> Peter Teoh<br>> <br>> _______________________________________________<br>> Kernelnewbies mailing list<br>> Kernelnewbies@kernelnewbies.org<br>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies<br>                                            </body>
</html>