All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Novotny <minovotn@redhat.com>
To: "Srujan D. Kotikela" <ksrujandas@gmail.com>
Cc: xen-devel@lists.xensource.com
Subject: Re: capturing SIGKILL in DomU
Date: Tue, 05 Oct 2010 15:22:50 +0200	[thread overview]
Message-ID: <4CAB26AA.6040300@redhat.com> (raw)
In-Reply-To: <AANLkTin7wzK4qnUageGQFw5P3jwd6YRjok1Pgm-rjZz-@mail.gmail.com>

Hi Srujan,

I'm not that familiar with event channels themselves however I was 
thinking about using xenstore. You can modify the device model (qemu-dm) 
to be watching some entry in the xenstore and the communication could be 
both way since if you establish a xenstore watch in both Dom0 and DomU 
you could intercept the changes on both sides.

If you would like to use interrupts instead you may have to modify the 
HVMLoader source codes at tools/firmware/hvmloader of the user-space 
stack but I think using the xenstore could do the job since this is how 
it's working with PV drivers AFAIK since PV drivers themselves implement 
xenbus to connect to host's xenstore facility.

Hope this helps!

Cheers,
Michal

On 10/05/2010 03:14 PM, Srujan D. Kotikela wrote:
> Hi Michal,
>
> I have no special interest in SIGKILL. All I want to do is notify Dom0 
> about an event in DomU (I don't need to pass any data). I am trying to 
> indicate events by signals or interrupts. It means, if a "particular" 
> interrupt has occurred in DomU, the Dom0 should be notified. Is there 
> any other way of doing the same other than using event channels?
>
> I am successful in establishing the event channel. But I am not quite 
> sure how to send a notification that an event occurred in DomU to 
> Dom0. Any pointers for the same would be appreciated.
>
> --
> Srujan D. Kotikela
>
>
> On Tue, Oct 5, 2010 at 3:36 AM, Michal Novotny <minovotn@redhat.com 
> <mailto:minovotn@redhat.com>> wrote:
>
>     Hi Srujan,
>     what about adding a signal handler to qemu-dm in the
>     tools/ioemu-dir of the user-space tools? Using the signal() API?
>     Nevertheless why would you like to catch SIGKILL? This one (as can
>     be seen using included program source and killing it using kill -9
>     pid or kill -SIGKILL pid) is not being caught at all nevertheless
>     most of the other signals can be caught.
>
>     This is the source of the example mentioned:
>     #include <stdio.h>
>     #include <signal.h>
>     #include <stdlib.h>
>
>     void sig_handler(int sig) {
>        fprintf(stderr, "Signal %d caught.\n", sig);
>        exit(sig);
>     }
>
>     int main()
>     {
>        signal(SIGINT, sig_handler);
>        signal(SIGKILL, sig_handler);
>
>        sleep(10000);
>        return 0;
>     }
>
>     When I did try SIGINT (Ctrl + C or kill -2 pid) it caught the
>     signal well but when I did try kill -9 pid (or kill -SIGKILL pid
>     respectively) it was not working at all since it killed the
>     process instead of going to the signal handler. When you need to
>     catch signals like interruption signal (Ctrl + C one) this will
>     work fine.
>
>     Michal
>
>
>     On 10/04/2010 09:03 PM, Srujan D. Kotikela wrote:
>
>         Hi,
>
>         I am trying to capture SIGKILL through event channel.
>
>         On my Dom0, the following process is running (remaining code
>         in attachment).
>
>
>            int main(void){
>
>                int ret, dom, remote_dom;
>
>                //initialize domains
>                dom=0;
>                remote_dom=2;
>
>                //create the event channel
>                ret = create_channel(dom, remote_dom);
>
>
>                if (0 == ret) {
>                    printf("\n Event Channel established successfully \n");
>                } else {
>                    return -1;    //EVENT_CHANNEL_CREATION_FAILED
>                }
>
>                //wait 20 seconds for an event to occur in DomU
>                wait_for_event(20);
>
>                //close the opened interfaces
>                close_channel();
>
>                return 0;
>
>            }
>
>
>         While this process is running; I killed a process in DomU
>         using `*kill SIGKILL pid*`
>
>         How can I capture this event (occured in DomU) at the Dom0. I
>         watched /dev/xen/evtchn, but no notification.
>
>
>         --
>         Srujan D. Kotikela
>
>
>         _______________________________________________
>         Xen-devel mailing list
>         Xen-devel@lists.xensource.com
>         <mailto:Xen-devel@lists.xensource.com>
>         http://lists.xensource.com/xen-devel
>
>
>
>     -- 
>     Michal Novotny<minovotn@redhat.com <mailto:minovotn@redhat.com>>, RHCE
>     Virtualization Team (xen userspace), Red Hat
>
>


-- 
Michal Novotny<minovotn@redhat.com>, RHCE
Virtualization Team (xen userspace), Red Hat

  reply	other threads:[~2010-10-05 13:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-04 19:03 capturing SIGKILL in DomU Srujan D. Kotikela
2010-10-05  8:36 ` Michal Novotny
2010-10-05 13:14   ` Srujan D. Kotikela
2010-10-05 13:22     ` Michal Novotny [this message]
2010-10-05 13:36       ` Srujan D. Kotikela
2010-10-05 13:49         ` Michal Novotny
2010-10-05 14:21           ` Srujan D. Kotikela
2010-10-05 15:33             ` Michal Novotny
2010-10-05 23:09               ` Srujan D. Kotikela

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=4CAB26AA.6040300@redhat.com \
    --to=minovotn@redhat.com \
    --cc=ksrujandas@gmail.com \
    --cc=xen-devel@lists.xensource.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.