xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* event notification
@ 2010-03-07  3:12 ravi kerur
  2010-03-08 16:47 ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 6+ messages in thread
From: ravi kerur @ 2010-03-07  3:12 UTC (permalink / raw)
  To: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 347 bytes --]

Hi,

Is there a mechanism available in Xen such that a kernel module in dom0 can
register to it and when a VM(domU) is installed or deleted or suspend or
resumed kernel module in domU can send notification to its counterpart in
dom0. I have looked into xenbus mechanism used by PV drivers and it won't
work for us. Inputs appreciated.

Thanks
-RK

[-- Attachment #1.2: Type: text/html, Size: 373 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: event notification
  2010-03-07  3:12 event notification ravi kerur
@ 2010-03-08 16:47 ` Konrad Rzeszutek Wilk
  2010-03-10 16:09   ` Ian Campbell
  0 siblings, 1 reply; 6+ messages in thread
From: Konrad Rzeszutek Wilk @ 2010-03-08 16:47 UTC (permalink / raw)
  To: ravi kerur; +Cc: xen-devel

[-- Attachment #1: Type: text/plain, Size: 810 bytes --]

On Sat, Mar 06, 2010 at 07:12:02PM -0800, ravi kerur wrote:
> Hi,
> 
> Is there a mechanism available in Xen such that a kernel module in dom0 can
> register to it and when a VM(domU) is installed or deleted or suspend or
> resumed kernel module in domU can send notification to its counterpart in
> dom0. I have looked into xenbus mechanism used by PV drivers and it won't
> work for us. Inputs appreciated.

You can listen on udev events and see when a vif device has been added.
Also you can add pieces to the dom0 kernel to send uevents when a device
is suspended and do something.

Attached is a simple program to listen to all uevents..

> 
> Thanks
> -RK

> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel


[-- Attachment #2: listen.c --]
[-- Type: text/plain, Size: 1061 bytes --]

#include <sys/socket.h>
#include <linux/netlink.h>
#include <stdio.h>
#include <string.h>
#define MAX_PAYLOAD 1024        /* maximum payload size */
struct sockaddr_nl src_addr;
int sock_fd;
static char buff[MAX_PAYLOAD];
ssize_t buflen;

int
main ()
{
  sock_fd = socket (PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT);

  memset (&src_addr, 0, sizeof (src_addr));
  src_addr.nl_family = AF_NETLINK;
  src_addr.nl_pid = getpid ();  /* self pid */
  src_addr.nl_groups = 0xffffffff;

  printf ("Listen..\n");
  bind (sock_fd, (struct sockaddr *) &src_addr, sizeof (src_addr));
  printf ("Receiving..\n");
  while (1)
    {
      buflen = recv (sock_fd, &buff, sizeof (buff), 0);
      printf ("Got data: %d\n", buflen);
      int i, bufpos;
      char *key;
      for (i = 0, bufpos = 0; (bufpos < buflen) && i < MAX_PAYLOAD; i++)
        {
          key = &buff[bufpos];
          printf ("[%s]\n", key);
          bufpos += strlen (key) + 1;
        }
      memset (&buff, 0, MAX_PAYLOAD);
    }
  /* Close Netlink Socket */
  close (sock_fd);
  return 0;
}

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: event notification
  2010-03-08 16:47 ` Konrad Rzeszutek Wilk
@ 2010-03-10 16:09   ` Ian Campbell
  2010-03-10 23:20     ` ravi kerur
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Campbell @ 2010-03-10 16:09 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: ravi kerur, xen-devel@lists.xensource.com

On Mon, 2010-03-08 at 16:47 +0000, Konrad Rzeszutek Wilk wrote:
> On Sat, Mar 06, 2010 at 07:12:02PM -0800, ravi kerur wrote:
> > Hi,
> > 
> > Is there a mechanism available in Xen such that a kernel module in dom0 can
> > register to it and when a VM(domU) is installed or deleted or suspend or
> > resumed kernel module in domU can send notification to its counterpart in
> > dom0. I have looked into xenbus mechanism used by PV drivers and it won't
> > work for us. Inputs appreciated.
> 
> You can listen on udev events and see when a vif device has been added.
> Also you can add pieces to the dom0 kernel to send uevents when a device
> is suspended and do something.
> 
> Attached is a simple program to listen to all uevents..

Also if you are specifically interested in domain create/destruction
(from the hypervisors PoV) then I think you can add a xenstore watch on
"@releaseDomain" and "@introduceDomain".

As far as the hypervisor is concerned things like migration or
suspend/resume are just domain creation or destruction, the "illusion"
of anything more is provided by the tools.

If you are interested in the creation/suspension/migration/etc of
domains at the toolstack level then it depends which toolstack you are
targeting.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: event notification
  2010-03-10 16:09   ` Ian Campbell
@ 2010-03-10 23:20     ` ravi kerur
  2010-03-11  7:43       ` Ian Campbell
  0 siblings, 1 reply; 6+ messages in thread
From: ravi kerur @ 2010-03-10 23:20 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel@lists.xensource.com, Konrad Rzeszutek Wilk


[-- Attachment #1.1: Type: text/plain, Size: 1569 bytes --]

Thanks Ian and Konrad. I thought monitoring udev events or xen store watch
can be done from user-level apps. I am wondering can they be used from
kernel modules as well?

Thanks
-RK

On Wed, Mar 10, 2010 at 8:09 AM, Ian Campbell <Ian.Campbell@citrix.com>wrote:

> On Mon, 2010-03-08 at 16:47 +0000, Konrad Rzeszutek Wilk wrote:
> > On Sat, Mar 06, 2010 at 07:12:02PM -0800, ravi kerur wrote:
> > > Hi,
> > >
> > > Is there a mechanism available in Xen such that a kernel module in dom0
> can
> > > register to it and when a VM(domU) is installed or deleted or suspend
> or
> > > resumed kernel module in domU can send notification to its counterpart
> in
> > > dom0. I have looked into xenbus mechanism used by PV drivers and it
> won't
> > > work for us. Inputs appreciated.
> >
> > You can listen on udev events and see when a vif device has been added.
> > Also you can add pieces to the dom0 kernel to send uevents when a device
> > is suspended and do something.
> >
> > Attached is a simple program to listen to all uevents..
>
> Also if you are specifically interested in domain create/destruction
> (from the hypervisors PoV) then I think you can add a xenstore watch on
> "@releaseDomain" and "@introduceDomain".
>
> As far as the hypervisor is concerned things like migration or
> suspend/resume are just domain creation or destruction, the "illusion"
> of anything more is provided by the tools.
>
> If you are interested in the creation/suspension/migration/etc of
> domains at the toolstack level then it depends which toolstack you are
> targeting.
>
>
>

[-- Attachment #1.2: Type: text/html, Size: 2045 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: event notification
  2010-03-10 23:20     ` ravi kerur
@ 2010-03-11  7:43       ` Ian Campbell
  2010-03-15 23:25         ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Campbell @ 2010-03-11  7:43 UTC (permalink / raw)
  To: ravi kerur; +Cc: xen-devel@lists.xensource.com, Konrad Rzeszutek Wilk

On Wed, 2010-03-10 at 23:20 +0000, ravi kerur wrote:
> Thanks Ian and Konrad. I thought monitoring udev events or xen store
> watch can be done from user-level apps. I am wondering can they be
> used from kernel modules as well?

xenstore can. I don't think udev can.

Ian.

> 
> Thanks
> -RK
> 
> On Wed, Mar 10, 2010 at 8:09 AM, Ian Campbell
> <Ian.Campbell@citrix.com> wrote:
>         On Mon, 2010-03-08 at 16:47 +0000, Konrad Rzeszutek Wilk
>         wrote:
>         > On Sat, Mar 06, 2010 at 07:12:02PM -0800, ravi kerur wrote:
>         > > Hi,
>         > >
>         > > Is there a mechanism available in Xen such that a kernel
>         module in dom0 can
>         > > register to it and when a VM(domU) is installed or deleted
>         or suspend or
>         > > resumed kernel module in domU can send notification to its
>         counterpart in
>         > > dom0. I have looked into xenbus mechanism used by PV
>         drivers and it won't
>         > > work for us. Inputs appreciated.
>         >
>         > You can listen on udev events and see when a vif device has
>         been added.
>         > Also you can add pieces to the dom0 kernel to send uevents
>         when a device
>         > is suspended and do something.
>         >
>         > Attached is a simple program to listen to all uevents..
>         
>         
>         Also if you are specifically interested in domain
>         create/destruction
>         (from the hypervisors PoV) then I think you can add a xenstore
>         watch on
>         "@releaseDomain" and "@introduceDomain".
>         
>         As far as the hypervisor is concerned things like migration or
>         suspend/resume are just domain creation or destruction, the
>         "illusion"
>         of anything more is provided by the tools.
>         
>         If you are interested in the creation/suspension/migration/etc
>         of
>         domains at the toolstack level then it depends which toolstack
>         you are
>         targeting.
>         
>         
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: event notification
  2010-03-11  7:43       ` Ian Campbell
@ 2010-03-15 23:25         ` Konrad Rzeszutek Wilk
  0 siblings, 0 replies; 6+ messages in thread
From: Konrad Rzeszutek Wilk @ 2010-03-15 23:25 UTC (permalink / raw)
  To: Ian Campbell; +Cc: ravi kerur, xen-devel@lists.xensource.com

On Thu, Mar 11, 2010 at 07:43:00AM +0000, Ian Campbell wrote:
> On Wed, 2010-03-10 at 23:20 +0000, ravi kerur wrote:
> > Thanks Ian and Konrad. I thought monitoring udev events or xen store
> > watch can be done from user-level apps. I am wondering can they be
> > used from kernel modules as well?
> 
> xenstore can. I don't think udev can.

<nods>

Of interest might be git commit dfecff0a8934996f381cb5a80c7220ad87830ae9
"commit dfecff0a8934996f381cb5a80c7220ad87830ae9
Author: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Date:   Thu Nov 5 15:25:40 2009 -0500

    xenbus_walk - walk XenStore keys, calling callback.
    
    This is quite similar to 'pci_walk_bus.' We walk the
    XenStore keys, starting at the initial path, calling the
    callback with each key that has a value. If the callback
    returns a negative value we stop, clean up, and return the
    value back.
    
    Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
"
which you could use to get more details of your XenStore values.

(this commit is in Jeremy's Xen tree
git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen.git)
> 
> Ian.
> 
> > 
> > Thanks
> > -RK
> > 
> > On Wed, Mar 10, 2010 at 8:09 AM, Ian Campbell
> > <Ian.Campbell@citrix.com> wrote:
> >         On Mon, 2010-03-08 at 16:47 +0000, Konrad Rzeszutek Wilk
> >         wrote:
> >         > On Sat, Mar 06, 2010 at 07:12:02PM -0800, ravi kerur wrote:
> >         > > Hi,
> >         > >
> >         > > Is there a mechanism available in Xen such that a kernel
> >         module in dom0 can
> >         > > register to it and when a VM(domU) is installed or deleted
> >         or suspend or
> >         > > resumed kernel module in domU can send notification to its
> >         counterpart in
> >         > > dom0. I have looked into xenbus mechanism used by PV
> >         drivers and it won't
> >         > > work for us. Inputs appreciated.
> >         >
> >         > You can listen on udev events and see when a vif device has
> >         been added.
> >         > Also you can add pieces to the dom0 kernel to send uevents
> >         when a device
> >         > is suspended and do something.
> >         >
> >         > Attached is a simple program to listen to all uevents..
> >         
> >         
> >         Also if you are specifically interested in domain
> >         create/destruction
> >         (from the hypervisors PoV) then I think you can add a xenstore
> >         watch on
> >         "@releaseDomain" and "@introduceDomain".
> >         
> >         As far as the hypervisor is concerned things like migration or
> >         suspend/resume are just domain creation or destruction, the
> >         "illusion"
> >         of anything more is provided by the tools.
> >         
> >         If you are interested in the creation/suspension/migration/etc
> >         of
> >         domains at the toolstack level then it depends which toolstack
> >         you are
> >         targeting.
> >         
> >         
> > 
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-03-15 23:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-07  3:12 event notification ravi kerur
2010-03-08 16:47 ` Konrad Rzeszutek Wilk
2010-03-10 16:09   ` Ian Campbell
2010-03-10 23:20     ` ravi kerur
2010-03-11  7:43       ` Ian Campbell
2010-03-15 23:25         ` Konrad Rzeszutek Wilk

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).