From: mulyadi.santosa@gmail.com (Mulyadi Santosa)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Problems with hypercalls
Date: Wed, 8 Jun 2011 23:46:09 +0700 [thread overview]
Message-ID: <BANLkTinb63UqqO9XDj6dW5uANiE5bMcVRg@mail.gmail.com> (raw)
In-Reply-To: <BLU124-W1837A65FCC53385AAC1076CF620@phx.gbl>
Hi...
On Wed, Jun 8, 2011 at 21:54, emilie lefebvre <tricheurs@hotmail.fr> wrote:
>
> This is my function :
>
> static spinlock_t xgr_learn_lock = SPIN_LOCK_UNLOCKED;
> static int piga_seq_cpt = 1;
>
> /*
> * Function called for each systemcall (Hook SELinux avc function)
> */
> int piga_control(u32 ssid, ...., struct av_decision * avd) {
>
> /*
> * Here my hypercall work but block my vm with this error :
> * ?????????????? " BUG: scheduling while atomic ... "
> */
>
> spin_lock_bh(&xgr_learn_lock);
> ? if ( in_atomic())
> ?????????? kvm_hypercall2 ( 6, (unsigned long)2 ,(unsigned
> long)piga_seq_cpt);
AFAIK, anything that trigger context switching, usually trigger
rescheduling too....or in other word, does blocking. Therefore,
grabbing lock must be avoided IMHO
> ? spin_unlock_bh(&xgr_learn_lock);
>
> ?if (piga_on == 1) {
> /*
> * Here my hypercall make a kernel panic with this error:
> * ??????????? " divide error: 0000 [#1] SMP"
> */
> ??????????????? spin_lock_bh(&xgr_learn_lock);
> ??????????????? set_current_state(TASK_UNINTERRUPTIBLE);
wait wait, why setting as uninterruptible?
> ??????????????? kvm_hypercall2 ( 6, (unsigned long)2 ,(unsigned
> long)piga_seq_cpt);
> ??????????????? set_current_state(TASK_RUNNING);
> ??????????????? spin_lock_bh(&xgr_learn_lock);
> }
> }
>
>
>
>
>
>> Date: Wed, 8 Jun 2011 15:52:33 +0530
>> Subject: Re: Problems with hypercalls
>> From: fs.rajat at gmail.com
>> To: mulyadi.santosa at gmail.com
>> CC: tricheurs at hotmail.fr; kernelnewbies at kernelnewbies.org
>>
>> are you doing 64bit devision on 32 bit arch? If that is the case,
>> do_div is worth considering.
>>
>> On Wed, Jun 8, 2011 at 3:25 PM, Mulyadi Santosa
>> <mulyadi.santosa@gmail.com> wrote:
>> > On Tue, Jun 7, 2011 at 15:39, emilie lefebvre <tricheurs@hotmail.fr>
>> > wrote:
>> >> "divide error: 0000 [#1] SMP
>> >> ...
>> >> ?[<ffffffff813f8cdd>] panic+0x78/0x137
>> >> ?[<ffffffff813fcb94>] oops_end+0xe4/0x100
>> >> ?[<ffffffff8101021b>] die+0x5b/0x90
>> >> ?[<ffffffff813fc444>] do_trap+0xc4/0x160
>> >> ?[<ffffffff8100df2f>] do_divide_error+0x8f/0xb0
>> >> ?[<ffffffff811f974c>] ? my_function+0xdc/0xe70 "
>> >>
>> >> Could you have any suggestions ?
>> >
>> > Could you show us your code? perhaps by pasting them somewhere?
>> >
>> > >From what I guess, sounds like your code did some math (directly or
>> > indirectly) that fiddle with floating point numbers?
>> >
>> >
>> > --
>> > regards,
>> >
>> > Mulyadi Santosa
>> > Freelance Linux trainer and consultant
>> >
>> > blog: the-hydra.blogspot.com
>> > training: mulyaditraining.blogspot.com
>> >
>> > _______________________________________________
>> > Kernelnewbies mailing list
>> > Kernelnewbies at kernelnewbies.org
>> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>> >
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
--
regards,
Mulyadi Santosa
Freelance Linux trainer and consultant
blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
next prev parent reply other threads:[~2011-06-08 16:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-07 8:39 Problems with hypercalls emilie lefebvre
2011-06-08 9:55 ` Mulyadi Santosa
2011-06-08 10:22 ` Rajat Sharma
2011-06-08 14:54 ` emilie lefebvre
2011-06-08 16:46 ` Mulyadi Santosa [this message]
2011-06-09 1:46 ` Peter Teoh
2011-06-09 8:35 ` emilie lefebvre
2011-06-09 16:46 ` Peter Teoh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BANLkTinb63UqqO9XDj6dW5uANiE5bMcVRg@mail.gmail.com \
--to=mulyadi.santosa@gmail.com \
--cc=kernelnewbies@lists.kernelnewbies.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).