WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] capturing SIGKILL in DomU

To: Michal Novotny <minovotn@xxxxxxxxxx>
Subject: Re: [Xen-devel] capturing SIGKILL in DomU
From: "Srujan D. Kotikela" <ksrujandas@xxxxxxxxx>
Date: Tue, 5 Oct 2010 08:14:37 -0500
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 05 Oct 2010 06:15:17 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=83djhG1QUk7Tw49dJLAyBLoLB1mCHEchecjtpJnkAZc=; b=ll/7X3TvjXNpQrjWoJfaFOTS3gKKh9AEEQG8jLZgkl2sd9S1DjvJ+O5oML+yae4eIo RQgtWoMuqu2q5cnI5g6bVzuRGMeuB0so/CK73iKAqDPhlPAmltbFr7dNtlZ38HnFcUz4 FA7jjhH+H1AFhyvZTkT4yaQnyQU5ooxUnDjhw=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=wx7b7YoYHRhDGv4M5lX+rmstjKlaXdc834haAq+GNnkCtr+qdahf/OXx9/AqI8f4Hm 4h30BJSd3qXGMuFt8Dn/bGldOzGKX5O6u4NJ6EaBtfN6YGH+J7ABxK31wV4pxlHsRfcO MfCsKniL7t+zJXRCO+3o5g2X8eeKgsTQ3uRds=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4CAAE39C.1020708@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <AANLkTi=0bFWS0zOrD49b5iDaG3y7K_90UBCOJ+RieUvj@xxxxxxxxxxxxxx> <4CAAE39C.1020708@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
 


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


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>