xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* How can I use grant table in domainU?
@ 2011-04-04 10:15 ruozeng.w
  2011-04-04 14:25 ` Konrad Rzeszutek Wilk
       [not found] ` <201104051205497648564@gmail.com>
  0 siblings, 2 replies; 8+ messages in thread
From: ruozeng.w @ 2011-04-04 10:15 UTC (permalink / raw)
  To: xen-devel


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

Can applications runs in domainU use grant table?

I found a way in the document(/docs/misc/grant-tables.txt), using function gnttab_grant_foreign_access . But, this fucntion is defined in domainU kernel, for example, in my installation, it's in /linux-2.6.18-xen.hg/include/xen/gnttab.h. 

Then how can I call this function in my own application? 
If I wants to write a simple program(program1) runs in domainA, to map a frame to domainB, in which another simple program(program2) is running, then program2 can read the information program1 sent to domainB, what should I do?

thanks.

2011-04-04 



Wishes
Ruozeng W 

[-- Attachment #1.2: Type: text/html, Size: 1629 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] 8+ messages in thread

* Re: How can I use grant table in domainU?
  2011-04-04 10:15 How can I use grant table in domainU? ruozeng.w
@ 2011-04-04 14:25 ` Konrad Rzeszutek Wilk
       [not found] ` <201104051205497648564@gmail.com>
  1 sibling, 0 replies; 8+ messages in thread
From: Konrad Rzeszutek Wilk @ 2011-04-04 14:25 UTC (permalink / raw)
  To: ruozeng.w; +Cc: xen-devel

On Mon, Apr 04, 2011 at 06:15:22PM +0800, ruozeng.w wrote:
> Can applications runs in domainU use grant table?
> 
> I found a way in the document(/docs/misc/grant-tables.txt), using function gnttab_grant_foreign_access . But, this fucntion is defined in domainU kernel, for example, in my installation, it's in /linux-2.6.18-xen.hg/include/xen/gnttab.h. 
> 
> Then how can I call this function in my own application? 
> If I wants to write a simple program(program1) runs in domainA, to map a frame to domainB, in which another simple program(program2) is running, then program2 can read the information program1 sent to domainB, what should I do?

Get 2.6.39 and use /dev/gntdev, /dev/gntalloc to do so. Attached is a test program
written by Daniel De Graaf.


#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <sys/ioctl.h>
#include <sys/mman.h>

struct ioctl_gntdev_grant_ref {
	/* The domain ID of the grant to be mapped. */
	uint32_t domid;
	/* The grant reference of the grant to be mapped. */
	uint32_t ref;
};

/*
 * Allocates a new page and creates a new grant reference.
 */
#define IOCTL_GNTALLOC_ALLOC_GREF \
_IOC(_IOC_NONE, 'G', 5, sizeof(struct ioctl_gntalloc_alloc_gref))
struct ioctl_gntalloc_alloc_gref {
	/* IN parameters */
	/* The ID of the domain to be given access to the grants. */
	uint16_t domid;
	/* Flags for this mapping */
	uint16_t flags;
	/* Number of pages to map */
	uint32_t count;
	/* OUT parameters */
	/* The offset to be used on a subsequent call to mmap(). */
	uint64_t index;
	/* The grant references of the newly created grant, one per page */
	/* Variable size, depending on count */
	uint32_t gref_ids[1];
};

#define GNTALLOC_FLAG_WRITABLE 1

/*
 * Deallocates the grant reference, allowing the associated page to be freed if
 * no other domains are using it.
 */
#define IOCTL_GNTALLOC_DEALLOC_GREF \
_IOC(_IOC_NONE, 'G', 6, sizeof(struct ioctl_gntalloc_dealloc_gref))
struct ioctl_gntalloc_dealloc_gref {
	/* IN parameters */
	/* The offset returned in the map operation */
	uint64_t index;
	/* Number of references to unmap */
	uint32_t count;
};

#define IOCTL_GNTDEV_MAP_GRANT_REF \
_IOC(_IOC_NONE, 'G', 0, sizeof(struct ioctl_gntdev_map_grant_ref))
struct ioctl_gntdev_map_grant_ref {
    /* IN parameters */
    /* The number of grants to be mapped. */
    uint32_t count;
    uint32_t pad;
    /* OUT parameters */
    /* The offset to be used on a subsequent call to mmap(). */
    uint64_t index;
    /* Variable IN parameter. */
    /* Array of grant references, of size @count. */
    struct ioctl_gntdev_grant_ref refs[1];
};
#define GNTDEV_MAP_WRITABLE 0x1

#define IOCTL_GNTDEV_UNMAP_GRANT_REF \
_IOC(_IOC_NONE, 'G', 1, sizeof(struct ioctl_gntdev_unmap_grant_ref))       
struct ioctl_gntdev_unmap_grant_ref {
    /* IN parameters */
    /* The offset was returned by the corresponding map operation. */
    uint64_t index;
    /* The number of pages to be unmapped. */
    uint32_t count;
    uint32_t pad;
};

/*
 * Sets up an unmap notification within the page, so that the other side can do
 * cleanup if this side crashes. Required to implement cross-domain robust
 * mutexes or close notification on communication channels.
 *
 * Each mapped page only supports one notification; multiple calls referring to
 * the same page overwrite the previous notification. You must clear the
 * notification prior to the IOCTL_GNTALLOC_DEALLOC_GREF if you do not want it
 * to occur.
 */
#define IOCTL_GNTDEV_SET_UNMAP_NOTIFY \
_IOC(_IOC_NONE, 'G', 7, sizeof(struct ioctl_gntdev_unmap_notify))
struct ioctl_gntdev_unmap_notify {
	/* IN parameters */
	/* Index of a byte in the page */
	uint64_t index;
	/* Action(s) to take on unmap */
	uint32_t action;
	/* Event channel to notify */
	uint32_t event_channel_port;
};

/* Clear (set to zero) the byte specified by index */
#define UNMAP_NOTIFY_CLEAR_BYTE 0x1
/* Send an interrupt on the indicated event channel */
#define UNMAP_NOTIFY_SEND_EVENT 0x2

/*
 * Sets up an unmap notification within the page, so that the other side can do
 * cleanup if this side crashes. Required to implement cross-domain robust
 * mutexes or close notification on communication channels.
 *
 * Each mapped page only supports one notification; multiple calls referring to
 * the same page overwrite the previous notification. You must clear the
 * notification prior to the IOCTL_GNTALLOC_DEALLOC_GREF if you do not want it
 * to occur.
 */
#define IOCTL_GNTALLOC_SET_UNMAP_NOTIFY \
_IOC(_IOC_NONE, 'G', 7, sizeof(struct ioctl_gntalloc_unmap_notify))
struct ioctl_gntalloc_unmap_notify {
	/* IN parameters */
	/* Index of a byte in the page */
	uint64_t index;
	/* Action(s) to take on unmap */
	uint32_t action;
	/* Event channel to notify */
	uint32_t event_channel_port;
};

/* Clear (set to zero) the byte specified by index */
#define UNMAP_NOTIFY_CLEAR_BYTE 0x1
/* Send an interrupt on the indicated event channel */
#define UNMAP_NOTIFY_SEND_EVENT 0x2

#ifndef offsetof
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif


int a_fd;
int d_fd;

struct shr_page {
	uint64_t id;
	char buffer[64];
	uint8_t notifies[8];
};

struct data {
	struct shr_page* mem;
	int handle;
} items[128];

void sa(int id)
{
	struct ioctl_gntalloc_alloc_gref arg = {
		.domid = id,
		.flags = GNTALLOC_FLAG_WRITABLE,
		.count = 1
	};
	int rv = ioctl(a_fd, IOCTL_GNTALLOC_ALLOC_GREF, &arg);
	if (rv) {
		printf("src-add error: %s (rv=%d)\n", strerror(errno), rv);
		return;
	}
	int i=0;
	while (items[i].mem) i++;
	items[i].mem = mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, a_fd, arg.index);
	if (items[i].mem == MAP_FAILED) {
		items[i].mem = 0;
		printf("mmap failed: SHOULD NOT HAPPEN\n");
		return;
	}
	items[i].handle = arg.index;
	printf("Created shared page with domain %d, grant #%d. Mapped locally at %d=%p\n",
		id, arg.gref_ids[0], arg.index, items[i].mem);

	items[i].mem->id = rand() | ((long)(getpid()) << 32);
	items[i].mem->notifies[0] = 1;
	struct ioctl_gntalloc_unmap_notify uarg = {
		.index = arg.index + offsetof(struct shr_page, notifies[0]),
		.action = UNMAP_NOTIFY_CLEAR_BYTE
	};
	rv = ioctl(a_fd, IOCTL_GNTALLOC_SET_UNMAP_NOTIFY, &uarg);
	if (rv)
		printf("gntalloc unmap notify error: %s (rv=%d)\n", strerror(errno), rv);
}

void sd(int ref) {
	struct ioctl_gntalloc_dealloc_gref arg = {
		.index = ref,
		.count = 1
	};

	int rv = ioctl(a_fd, IOCTL_GNTALLOC_DEALLOC_GREF, &arg);
	if (rv)
		printf("src-del error: %s (rv=%d)\n", strerror(errno), rv);
	else
		printf("Stopped offering grant at offset %d\n", ref);
}

void mm(int domid, int refid) {
	struct ioctl_gntdev_map_grant_ref arg = {
		.count = 1,
		.refs[0].domid = domid,
		.refs[0].ref = refid,
	};
	int rv = ioctl(d_fd, IOCTL_GNTDEV_MAP_GRANT_REF, &arg);
	if (rv) {
		printf("Could not map grant %d.%d: %s (rv=%d)\n", domid, refid, strerror(errno), rv);
		return;
	}
	int i=0,j=1;
	while (items[i].mem) i++;
	items[i].mem = mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, d_fd, arg.index);
	if (items[i].mem == MAP_FAILED) {
		items[i].mem = 0;
		printf("Could not map grant %d.%d: %s (map failed)\n", domid, refid, strerror(errno), rv);
		return;
	}
	items[i].handle = arg.index;
	printf("Mapped grant %d.%d as %d=%p\n", domid, refid, arg.index, items[i].mem);

	while (items[i].mem->notifies[j]) j++;
	items[i].mem->notifies[j] = 1;
	struct ioctl_gntalloc_unmap_notify uarg = {
		.index = arg.index + offsetof(struct shr_page, notifies[j]),
		.action = UNMAP_NOTIFY_CLEAR_BYTE
	};
	rv = ioctl(d_fd, IOCTL_GNTDEV_SET_UNMAP_NOTIFY, &uarg);
	if (rv)
		printf("gntdev unmap notify error: %s (rv=%d)\n", strerror(errno), rv);
}

void gu(int index) {
	struct ioctl_gntdev_unmap_grant_ref arg = {
		.index = index,
		.count = 1,
	};
	int rv = ioctl(d_fd, IOCTL_GNTDEV_UNMAP_GRANT_REF, &arg);
	if (rv)
		printf("gu error: %s (rv=%d)\n", strerror(errno), rv);
	else
		printf("Unhooked mapped grant at offset %d\n", index);
}

void mu(void* addr) {
	int i = 0;
	munmap(addr, 4096);
	while (i < 128)
	{
		if (items[i].mem == addr)
			items[i].mem = 0;
		i++;
	}
	printf("Unmapped page at %p\n", addr);
}

void show(char* word) {
	int i;
	int wlen = strlen(word);
	for(i=0; i < 128; i++) {
		if (!items[i].mem)
			continue;
		memmove(items[i].mem->buffer + wlen, items[i].mem->buffer, 63 - wlen);
		memcpy(items[i].mem->buffer, word, wlen);
		printf("%02d(%ld,%d): id %16lx n=%d%d%d%d%d%d%d%d b=%s\n",
			i, items[i].mem, items[i].handle, items[i].mem->id,
			items[i].mem->notifies[0], items[i].mem->notifies[1], items[i].mem->notifies[2], items[i].mem->notifies[3], 
			items[i].mem->notifies[4], items[i].mem->notifies[5], items[i].mem->notifies[6], items[i].mem->notifies[7], 
			items[i].mem->buffer);
	}
	printf("END\n");
}

int main(int argc, char** argv) {
	a_fd = open("/dev/xen/gntalloc", O_RDWR);
	d_fd = open("/dev/xen/gntdev", O_RDWR);
	printf(
		"add <domid>           return gntref, address\n"
		"map <domid> <ref>     return index, address\n"
		"adel <gntref>         delete <add> internal\n"
		"ddel <index>          delete <map> internal\n"
		"unmap <address>       unmap memory\n"
		"show                  show all pages\n"
		"<word>                append word to all mapped pages, show\n"
		" PID %x\n", getpid()
	);
	while (1) {
		char line[80];
		char word[80];
		long a, b;
		printf("\n> ");
		fflush(stdout);
		fgets(line, 80, stdin);
		sscanf(line, "%s %ld %ld", word, &a, &b);
		if (!strcmp(word, "add")) {
			sa(a);
		} else if (!strcmp(word, "map")) {
			mm(a, b);
		} else if (!strcmp(word, "adel")) {
			sd(a);
		} else if (!strcmp(word, "ddel")) {
			gu(a);
		} else if (!strcmp(word, "unmap")) {
			mu((void*)a);
		} else if (!strcmp(word, "show")) {
			show("");
		} else {
			show(word);
		}
	}
}
> 
> thanks.
> 
> 2011-04-04 
> 
> 
> 
> Wishes
> Ruozeng W 

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

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

* Re: Re: How can I use grant table in domainU?
       [not found]             ` <BANLkTi=0fEdC8PjsWp_8rmdwybpsex1q+Q@mail.gmail.com>
@ 2011-04-13 17:43               ` Konrad Rzeszutek Wilk
  2011-04-14  2:08                 ` ruozeng wang
  0 siblings, 1 reply; 8+ messages in thread
From: Konrad Rzeszutek Wilk @ 2011-04-13 17:43 UTC (permalink / raw)
  To: ruozeng wang, xen-devel

On Wed, Apr 13, 2011 at 11:52:25PM +0800, ruozeng wang wrote:
> Hi,
> 
> I've tried to install xen-4.1.0 with 2.6.39-rc2 kernel on CentOS 5.5, Debian
> 5.07 and ubuntu 8.04, at last succeeded with  ubuntu.
> But when I tried to start xend, it failed.

Please also CC the mailing list. I did this for you.
> 
> /var/log/xend.log:
> 
> *[2011-04-13 20:35:52 6937] DEBUG (tcp:96) Listening on :8002
> [2011-04-13 20:35:52 6937] ERROR (SrvDaemon:349) Exception starting xend
> ((98, 'Address already in use'))
> Traceback (most recent call last):
>   File "usr/lib/python2.5/site-packages/xen/xend/server/SrvDaemon.py", line
> 339, in run
>     relocate.listenRelocation()
>   File "usr/lib/python2.5/site-packages/xen/xend/server/relocate.py", line
> 159, in listenRelocation
>     hosts_allow = hosts_allow)
>   File "usr/lib/python2.5/site-packages/xen/web/tcp.py", line 38, in
> __init__
>     connection.SocketListener.__init__(self, protocol_class)
>   File "usr/lib/python2.5/site-packages/xen/web/connection.py", line 89, in
> __init__
>     self.sock = self.createSocket()
>   File "usr/lib/python2.5/site-packages/xen/web/tcp.py", line 97, in
> createSocket
>     sock.bind((self.interface, self.port))
>   File "<string>", line 1, in bind
> error: (98, 'Address already in use')

Looks like someobyd is listening already on that port.
> [2011-04-13 20:35:52 6936] INFO (SrvDaemon:220) Xend exited with status 1.*
> 
> Could you tell me what may cause this? Someone might have met this before,
> but I can't find a solution.
> 
>  http://lists.xensource.com/archives/html/xen-users/2006-05/msg00397.html
> 
> netstat -ltnp does show an active connection, listening local address
> 0.0.0.0:8002, but I don't know if it is right or not

Ok, what program is using it?
> 
> 
> thanks
> 
> ruozeng.w
> regards
> 2011-4-43
> 
> 
> 
> 2011/4/6 Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> 
> > On Wed, Apr 06, 2011 at 10:57:00PM +0800, ruozeng wang wrote:
> > > Sorry, I'm a little confused……What is this 2.6.39 kernel for? When I
> > build
> > > and install xen, it downloaded a "linux-2.6.18-xen.hg" (using mercurial),
> > > should I update this kernel to 2.6.39? Or update my host OS kernel to
> > > 2.6.39? I found 2.6.39-rc2 kernel at kernel.org, but it's not for xen,
> > it's
> > > a stadard kernel, I think.
> >
> > The standard mainline kernel has Xen components in it. You need to
> > compile it with CONFIG_PVOPS and CONFIG_XEN and you will have a fully
> > working kernel that can boot up either on native, or under the Xen
> > hypervisor.
> >
> >
> > >
> > > So is this my misunderstanding?
> > >
> > > I planed to install xen 4.0.0 on CentOS 5.4 tommorow.
> > > Please tell me some more details. Thank you so much for you patience.
> >
> > Please use Google. Search for 'PVOPS Wiki'.
> >

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

* Re: Re: How can I use grant table in domainU?
  2011-04-13 17:43               ` Konrad Rzeszutek Wilk
@ 2011-04-14  2:08                 ` ruozeng wang
  2011-04-14 12:22                   ` ruozeng wang
  0 siblings, 1 reply; 8+ messages in thread
From: ruozeng wang @ 2011-04-14  2:08 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: xen-devel


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

Sorry, I forgot to CC, my fault. I'll do it from now on.

Program listening 0.0.0.0:8002 is *python*

Here is the netstat output:

*Proto    Recv-Q    Send-Q    Local Address    Foreign Address
State       PID/Program name
tcp        0               0             0.0.0.0:8002        0.0.0.0:*
LISTEN    6416/python*


2011/4/14 Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

> On Wed, Apr 13, 2011 at 11:52:25PM +0800, ruozeng wang wrote:
> > Hi,
> >
> > I've tried to install xen-4.1.0 with 2.6.39-rc2 kernel on CentOS 5.5,
> Debian
> > 5.07 and ubuntu 8.04, at last succeeded with  ubuntu.
> > But when I tried to start xend, it failed.
>
> Please also CC the mailing list. I did this for you.
> >
> > /var/log/xend.log:
> >
> > *[2011-04-13 20:35:52 6937] DEBUG (tcp:96) Listening on :8002
> > [2011-04-13 20:35:52 6937] ERROR (SrvDaemon:349) Exception starting xend
> > ((98, 'Address already in use'))
> > Traceback (most recent call last):
> >   File "usr/lib/python2.5/site-packages/xen/xend/server/SrvDaemon.py",
> line
> > 339, in run
> >     relocate.listenRelocation()
> >   File "usr/lib/python2.5/site-packages/xen/xend/server/relocate.py",
> line
> > 159, in listenRelocation
> >     hosts_allow = hosts_allow)
> >   File "usr/lib/python2.5/site-packages/xen/web/tcp.py", line 38, in
> > __init__
> >     connection.SocketListener.__init__(self, protocol_class)
> >   File "usr/lib/python2.5/site-packages/xen/web/connection.py", line 89,
> in
> > __init__
> >     self.sock = self.createSocket()
> >   File "usr/lib/python2.5/site-packages/xen/web/tcp.py", line 97, in
> > createSocket
> >     sock.bind((self.interface, self.port))
> >   File "<string>", line 1, in bind
> > error: (98, 'Address already in use')
>
> Looks like someobyd is listening already on that port.
> > [2011-04-13 20:35:52 6936] INFO (SrvDaemon:220) Xend exited with status
> 1.*
> >
> > Could you tell me what may cause this? Someone might have met this
> before,
> > but I can't find a solution.
> >
> >
> http://lists.xensource.com/archives/html/xen-users/2006-05/msg00397.html
> >
> > netstat -ltnp does show an active connection, listening local address
> > 0.0.0.0:8002, but I don't know if it is right or not
>
> Ok, what program is using it?
> >
> >
> > thanks
> >
> > ruozeng.w
> > regards
> > 2011-4-43
> >
> >
> >
> > 2011/4/6 Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> >
> > > On Wed, Apr 06, 2011 at 10:57:00PM +0800, ruozeng wang wrote:
> > > > Sorry, I'm a little confused……What is this 2.6.39 kernel for? When I
> > > build
> > > > and install xen, it downloaded a "linux-2.6.18-xen.hg" (using
> mercurial),
> > > > should I update this kernel to 2.6.39? Or update my host OS kernel to
> > > > 2.6.39? I found 2.6.39-rc2 kernel at kernel.org, but it's not for
> xen,
> > > it's
> > > > a stadard kernel, I think.
> > >
> > > The standard mainline kernel has Xen components in it. You need to
> > > compile it with CONFIG_PVOPS and CONFIG_XEN and you will have a fully
> > > working kernel that can boot up either on native, or under the Xen
> > > hypervisor.
> > >
> > >
> > > >
> > > > So is this my misunderstanding?
> > > >
> > > > I planed to install xen 4.0.0 on CentOS 5.4 tommorow.
> > > > Please tell me some more details. Thank you so much for you patience.
> > >
> > > Please use Google. Search for 'PVOPS Wiki'.
> > >
>

[-- Attachment #1.2: Type: text/html, Size: 4765 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] 8+ messages in thread

* Re: Re: How can I use grant table in domainU?
  2011-04-14  2:08                 ` ruozeng wang
@ 2011-04-14 12:22                   ` ruozeng wang
  2011-04-14 13:39                     ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 8+ messages in thread
From: ruozeng wang @ 2011-04-14 12:22 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: xen-devel


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

This is from /var/log/xen/xend-debug.log:

Xend started at Thu Apr 14 17:39:00 2011.
cat: /sys/bus/scsi/devices/host0/vendor: No such file or directory
cat: /sys/bus/scsi/devices/host0/model: No such file or directory
cat: /sys/bus/scsi/devices/host0/type: No such file or directory
cat: /sys/bus/scsi/devices/host0/rev: No such file or directory
cat: /sys/bus/scsi/devices/host0/scsi_level: No such file or directory
cat: /sys/bus/scsi/devices/host1/vendor: No such file or directory
cat: /sys/bus/scsi/devices/host1/model: No such file or directory
cat: /sys/bus/scsi/devices/host1/type: No such file or directory
cat: /sys/bus/scsi/devices/host1/rev: No such file or directory
cat: /sys/bus/scsi/devices/host1/scsi_level: No such file or directory
cat: /sys/bus/scsi/devices/host2/vendor: No such file or directory
cat: /sys/bus/scsi/devices/host2/model: No such file or directory
cat: /sys/bus/scsi/devices/host2/type: No such file or directory
cat: /sys/bus/scsi/devices/host2/rev: No such file or directory
cat: /sys/bus/scsi/devices/host2/scsi_level: No such file or directory
cat: /sys/bus/scsi/devices/host3/vendor: No such file or directory
cat: /sys/bus/scsi/devices/host3/model: No such file or directory
cat: /sys/bus/scsi/devices/host3/type: No such file or directory
cat: /sys/bus/scsi/devices/host3/rev: No such file or directory
cat: /sys/bus/scsi/devices/host3/scsi_level: No such file or directory
cat: /sys/bus/scsi/devices/host4/vendor: No such file or directory
cat: /sys/bus/scsi/devices/host4/model: No such file or directory
cat: /sys/bus/scsi/devices/host4/type: No such file or directory
cat: /sys/bus/scsi/devices/host4/rev: No such file or directory
cat: /sys/bus/scsi/devices/host4/scsi_level: No such file or directory
cat: /sys/bus/scsi/devices/host5/vendor: No such file or directory
cat: /sys/bus/scsi/devices/host5/model: No such file or directory
cat: /sys/bus/scsi/devices/host5/type: No such file or directory
cat: /sys/bus/scsi/devices/host5/rev: No such file or directory
cat: /sys/bus/scsi/devices/host5/scsi_level: No such file or directory
cat: /sys/bus/scsi/devices/target2:0:0/vendor: No such file or directory
cat: /sys/bus/scsi/devices/target2:0:0/model: No such file or directory
cat: /sys/bus/scsi/devices/target2:0:0/type: No such file or directory
cat: /sys/bus/scsi/devices/target2:0:0/rev: No such file or directory
cat: /sys/bus/scsi/devices/target2:0:0/scsi_level: No such file or directory
cat: /sys/bus/scsi/devices/target3:0:0/vendor: No such file or directory
cat: /sys/bus/scsi/devices/target3:0:0/model: No such file or directory
cat: /sys/bus/scsi/devices/target3:0:0/type: No such file or directory
cat: /sys/bus/scsi/devices/target3:0:0/rev: No such file or directory
cat: /sys/bus/scsi/devices/target3:0:0/scsi_level: No such file or directory

Is there any connections between this and the "address already in use"
problem?

thanks


ruozeng.w
2011-4-14

2011/4/14 ruozeng wang <ruozeng.w@gmail.com>

> Sorry, I forgot to CC, my fault. I'll do it from now on.
>
> Program listening 0.0.0.0:8002 is *python*
>
> Here is the netstat output:
>
> *Proto    Recv-Q    Send-Q    Local Address    Foreign Address
> State       PID/Program name
> tcp        0               0             0.0.0.0:8002        0.0.0.0:*
> LISTEN    6416/python*
>
>
>
> 2011/4/14 Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>
>> On Wed, Apr 13, 2011 at 11:52:25PM +0800, ruozeng wang wrote:
>> > Hi,
>> >
>> > I've tried to install xen-4.1.0 with 2.6.39-rc2 kernel on CentOS 5.5,
>> Debian
>> > 5.07 and ubuntu 8.04, at last succeeded with  ubuntu.
>> > But when I tried to start xend, it failed.
>>
>> Please also CC the mailing list. I did this for you.
>> >
>> > /var/log/xend.log:
>> >
>> > *[2011-04-13 20:35:52 6937] DEBUG (tcp:96) Listening on :8002
>> > [2011-04-13 20:35:52 6937] ERROR (SrvDaemon:349) Exception starting xend
>> > ((98, 'Address already in use'))
>> > Traceback (most recent call last):
>> >   File "usr/lib/python2.5/site-packages/xen/xend/server/SrvDaemon.py",
>> line
>> > 339, in run
>> >     relocate.listenRelocation()
>> >   File "usr/lib/python2.5/site-packages/xen/xend/server/relocate.py",
>> line
>> > 159, in listenRelocation
>> >     hosts_allow = hosts_allow)
>> >   File "usr/lib/python2.5/site-packages/xen/web/tcp.py", line 38, in
>> > __init__
>> >     connection.SocketListener.__init__(self, protocol_class)
>> >   File "usr/lib/python2.5/site-packages/xen/web/connection.py", line 89,
>> in
>> > __init__
>> >     self.sock = self.createSocket()
>> >   File "usr/lib/python2.5/site-packages/xen/web/tcp.py", line 97, in
>> > createSocket
>> >     sock.bind((self.interface, self.port))
>> >   File "<string>", line 1, in bind
>> > error: (98, 'Address already in use')
>>
>> Looks like someobyd is listening already on that port.
>> > [2011-04-13 20:35:52 6936] INFO (SrvDaemon:220) Xend exited with status
>> 1.*
>> >
>> > Could you tell me what may cause this? Someone might have met this
>> before,
>> > but I can't find a solution.
>> >
>> >
>> http://lists.xensource.com/archives/html/xen-users/2006-05/msg00397.html
>> >
>> > netstat -ltnp does show an active connection, listening local address
>> > 0.0.0.0:8002, but I don't know if it is right or not
>>
>> Ok, what program is using it?
>> >
>> >
>> > thanks
>> >
>> > ruozeng.w
>> > regards
>> > 2011-4-43
>> >
>> >
>> >
>> > 2011/4/6 Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>> >
>> > > On Wed, Apr 06, 2011 at 10:57:00PM +0800, ruozeng wang wrote:
>> > > > Sorry, I'm a little confused……What is this 2.6.39 kernel for? When I
>> > > build
>> > > > and install xen, it downloaded a "linux-2.6.18-xen.hg" (using
>> mercurial),
>> > > > should I update this kernel to 2.6.39? Or update my host OS kernel
>> to
>> > > > 2.6.39? I found 2.6.39-rc2 kernel at kernel.org, but it's not for
>> xen,
>> > > it's
>> > > > a stadard kernel, I think.
>> > >
>> > > The standard mainline kernel has Xen components in it. You need to
>> > > compile it with CONFIG_PVOPS and CONFIG_XEN and you will have a fully
>> > > working kernel that can boot up either on native, or under the Xen
>> > > hypervisor.
>> > >
>> > >
>> > > >
>> > > > So is this my misunderstanding?
>> > > >
>> > > > I planed to install xen 4.0.0 on CentOS 5.4 tommorow.
>> > > > Please tell me some more details. Thank you so much for you
>> patience.
>> > >
>> > > Please use Google. Search for 'PVOPS Wiki'.
>> > >
>>
>
>

[-- Attachment #1.2: Type: text/html, Size: 8243 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] 8+ messages in thread

* Re: Re: How can I use grant table in domainU?
  2011-04-14 12:22                   ` ruozeng wang
@ 2011-04-14 13:39                     ` Konrad Rzeszutek Wilk
  2011-04-14 15:58                       ` ruozeng wang
  0 siblings, 1 reply; 8+ messages in thread
From: Konrad Rzeszutek Wilk @ 2011-04-14 13:39 UTC (permalink / raw)
  To: ruozeng wang; +Cc: xen-devel

On Thu, Apr 14, 2011 at 08:22:24PM +0800, ruozeng wang wrote:
> This is from /var/log/xen/xend-debug.log:

Look also in the xend.log file, and make sure to turn on the DEBUg
options in your /etc/xen/xend-config.sxp file. And read through the
file please.

Have you tried using 'xl'?

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

* Re: Re: How can I use grant table in domainU?
  2011-04-14 13:39                     ` Konrad Rzeszutek Wilk
@ 2011-04-14 15:58                       ` ruozeng wang
  2011-04-14 16:20                         ` Re: Xend hanging Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 8+ messages in thread
From: ruozeng wang @ 2011-04-14 15:58 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: xen-devel


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

Yes, I've tried some of the xen command , but all of them return this error
:
"*Unable to connect to xend: No such file or dirctory. Is xend running?*"

Then I found the infomation in xend-debug.log, which I've send in last mail.

Here is the content of xend.log:

*[2011-04-13 20:35:52 6937] DEBUG (tcp:96) Listening on :8002
[2011-04-13 20:35:52 6937] ERROR (SrvDaemon:349) Exception starting xend
((98, 'Address already in use'))
Traceback (most recent call last):
  File "usr/lib/python2.5/site-**packages/xen/xend/server/**SrvDaemon.py",
line 339, in run
    relocate.listenRelocation()
  File "usr/lib/python2.5/site-**packages/xen/xend/server/**relocate.py",
line 159, in listenRelocation
    hosts_allow = hosts_allow)
  File "usr/lib/python2.5/site-**packages/xen/web/tcp.py", line 38, in
__init__
    connection.SocketListener.__**init__(self, protocol_class)
  File "usr/lib/python2.5/site-**packages/xen/web/connection.**py", line 89,
in __init__
    self.sock = self.createSocket()
  File "usr/lib/python2.5/site-**packages/xen/web/tcp.py", line 97, in
createSocket
    sock.bind((self.interface, self.port))
  File "<string>", line 1, in bind
error: (98, 'Address already in use')
[2011-04-13 20:35:52 6936] INFO (SrvDaemon:220) Xend exited with status 1.


*
but since I set loglevel to DEBUG in xend-config.sxp, it changed to this:

*[2011-04-14 23:40:21 6477] INFO (SrvDaemon:332) Xend Daemon started
[2011-04-14 23:40:21 6477] INFO (SrvDaemon:336) Xend changeset: unavailable.
[2011-04-14 23:40:21 6477] DEBUG (tcp:96) Listening on :8002
[2011-04-14 23:40:22 6477] DEBUG (XendNode:332) pscsi record count: 10
[2011-04-14 23:40:22 6477] DEBUG (XendCPUPool:747) recreate_active_pools*

When I enter "xend start", the output infomation is like this:
*
root@ruozeng-desktop2:~# xend start
There is already a pid file /var/run/dhclient.eth0.pid with pid 5962
killed old client process, removed PID file
Internet Systems Consortium DHCP Client V3.0.6
Copyright 2004-2007 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/

Listening on LPF/eth0/00:1d:7d:57:23:12
Sending on   LPF/eth0/00:1d:7d:57:23:12
Sending on   Socket/fallback
DHCPRELEASE on eth0 to 172.21.201.1 port 67
Nothing to flush.
There is already a pid file /var/run/dhclient.eth0.pid with pid 134519072
Internet Systems Consortium DHCP Client V3.0.6
Copyright 2004-2007 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/

Listening on LPF/eth0/00:1d:7d:57:23:12
Sending on   LPF/eth0/00:1d:7d:57:23:12
Sending on   Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3
DHCPOFFER of 172.21.6.114 from 172.21.6.254
DHCPREQUEST of 172.21.6.114 on eth0 to 255.255.255.255 port 67
DHCPACK of 172.21.6.114 from 172.21.6.254
bound to 172.21.6.114 -- renewal in 41866 seconds.
*
Then it stucked here. I have to use control-c to interrupt.

If I use ps -A, it shows that there are four "xend" process :

 *6306 pts/0    00:00:00 xend
 6376 ?        00:00:00 kworker/1:2
 6442 ?        00:00:00 dhclient3
 6474 pts/0    00:00:00 blktapctrl <defunct>
 6475 ?        00:00:00 xend <defunct>
 6476 ?        00:00:00 xend
 6477 ?        00:00:00 xend
*
And some other xen related processes, xenbus, etc.

ruozeng.w
2011-4-14

2011/4/14 Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

> On Thu, Apr 14, 2011 at 08:22:24PM +0800, ruozeng wang wrote:
> > This is from /var/log/xen/xend-debug.log:
>
> Look also in the xend.log file, and make sure to turn on the DEBUg
> options in your /etc/xen/xend-config.sxp file. And read through the
> file please.
>
> Have you tried using 'xl'?
>

[-- Attachment #1.2: Type: text/html, Size: 4559 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] 8+ messages in thread

* Re: Re: Xend hanging.
  2011-04-14 15:58                       ` ruozeng wang
@ 2011-04-14 16:20                         ` Konrad Rzeszutek Wilk
  0 siblings, 0 replies; 8+ messages in thread
From: Konrad Rzeszutek Wilk @ 2011-04-14 16:20 UTC (permalink / raw)
  To: ruozeng wang; +Cc: xen-devel

On Thu, Apr 14, 2011 at 11:58:43PM +0800, ruozeng wang wrote:
> Yes, I've tried some of the xen command , but all of them return this error
> :
> "*Unable to connect to xend: No such file or dirctory. Is xend running?*"
> 
> Then I found the infomation in xend-debug.log, which I've send in last mail.
> 
> Here is the content of xend.log:
> 
> *[2011-04-13 20:35:52 6937] DEBUG (tcp:96) Listening on :8002
> [2011-04-13 20:35:52 6937] ERROR (SrvDaemon:349) Exception starting xend
> ((98, 'Address already in use'))
> Traceback (most recent call last):
>   File "usr/lib/python2.5/site-**packages/xen/xend/server/**SrvDaemon.py",
> line 339, in run
>     relocate.listenRelocation()
>   File "usr/lib/python2.5/site-**packages/xen/xend/server/**relocate.py",
> line 159, in listenRelocation
>     hosts_allow = hosts_allow)
>   File "usr/lib/python2.5/site-**packages/xen/web/tcp.py", line 38, in
> __init__
>     connection.SocketListener.__**init__(self, protocol_class)
>   File "usr/lib/python2.5/site-**packages/xen/web/connection.**py", line 89,
> in __init__
>     self.sock = self.createSocket()
>   File "usr/lib/python2.5/site-**packages/xen/web/tcp.py", line 97, in
> createSocket
>     sock.bind((self.interface, self.port))
>   File "<string>", line 1, in bind
> error: (98, 'Address already in use')
> [2011-04-13 20:35:52 6936] INFO (SrvDaemon:220) Xend exited with status 1.
> 
> 
> *
> but since I set loglevel to DEBUG in xend-config.sxp, it changed to this:
> 
> *[2011-04-14 23:40:21 6477] INFO (SrvDaemon:332) Xend Daemon started
> [2011-04-14 23:40:21 6477] INFO (SrvDaemon:336) Xend changeset: unavailable.
> [2011-04-14 23:40:21 6477] DEBUG (tcp:96) Listening on :8002
> [2011-04-14 23:40:22 6477] DEBUG (XendNode:332) pscsi record count: 10
> [2011-04-14 23:40:22 6477] DEBUG (XendCPUPool:747) recreate_active_pools*
> 
> When I enter "xend start", the output infomation is like this:
> *
> root@ruozeng-desktop2:~# xend start
> There is already a pid file /var/run/dhclient.eth0.pid with pid 5962
> killed old client process, removed PID file
> Internet Systems Consortium DHCP Client V3.0.6
> Copyright 2004-2007 Internet Systems Consortium.
> All rights reserved.
> For info, please visit http://www.isc.org/sw/dhcp/
> 
> Listening on LPF/eth0/00:1d:7d:57:23:12
> Sending on   LPF/eth0/00:1d:7d:57:23:12
> Sending on   Socket/fallback
> DHCPRELEASE on eth0 to 172.21.201.1 port 67
> Nothing to flush.
> There is already a pid file /var/run/dhclient.eth0.pid with pid 134519072
> Internet Systems Consortium DHCP Client V3.0.6
> Copyright 2004-2007 Internet Systems Consortium.
> All rights reserved.
> For info, please visit http://www.isc.org/sw/dhcp/
> 
> Listening on LPF/eth0/00:1d:7d:57:23:12
> Sending on   LPF/eth0/00:1d:7d:57:23:12
> Sending on   Socket/fallback
> DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3
> DHCPOFFER of 172.21.6.114 from 172.21.6.254
> DHCPREQUEST of 172.21.6.114 on eth0 to 255.255.255.255 port 67
> DHCPACK of 172.21.6.114 from 172.21.6.254
> bound to 172.21.6.114 -- renewal in 41866 seconds.
> *

How did you get it to do a dhclient on eth0? Can you just
re-install the toolstack from the hg tree? I am really not sure
why it is in such a state.

> Then it stucked here. I have to use control-c to interrupt.
> 
> If I use ps -A, it shows that there are four "xend" process :
> 
>  *6306 pts/0    00:00:00 xend
>  6376 ?        00:00:00 kworker/1:2
>  6442 ?        00:00:00 dhclient3
>  6474 pts/0    00:00:00 blktapctrl <defunct>
>  6475 ?        00:00:00 xend <defunct>
>  6476 ?        00:00:00 xend
>  6477 ?        00:00:00 xend
> *
> And some other xen related processes, xenbus, etc.
> 
> ruozeng.w
> 2011-4-14
> 
> 2011/4/14 Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> 
> > On Thu, Apr 14, 2011 at 08:22:24PM +0800, ruozeng wang wrote:
> > > This is from /var/log/xen/xend-debug.log:
> >
> > Look also in the xend.log file, and make sure to turn on the DEBUg
> > options in your /etc/xen/xend-config.sxp file. And read through the
> > file please.
> >
> > Have you tried using 'xl'?
> >

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

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

end of thread, other threads:[~2011-04-14 16:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-04 10:15 How can I use grant table in domainU? ruozeng.w
2011-04-04 14:25 ` Konrad Rzeszutek Wilk
     [not found] ` <201104051205497648564@gmail.com>
     [not found]   ` <20110405134423.GA6075@dumpdata.com>
     [not found]     ` <BANLkTinkrAr9cKb17skdtWdQTJ1AT63xCA@mail.gmail.com>
     [not found]       ` <20110406121510.GA5009@dumpdata.com>
     [not found]         ` <BANLkTikHJ5TtiOZOc7mdLpMqg-s4OmMBEA@mail.gmail.com>
     [not found]           ` <20110406152554.GA8253@dumpdata.com>
     [not found]             ` <BANLkTi=0fEdC8PjsWp_8rmdwybpsex1q+Q@mail.gmail.com>
2011-04-13 17:43               ` Konrad Rzeszutek Wilk
2011-04-14  2:08                 ` ruozeng wang
2011-04-14 12:22                   ` ruozeng wang
2011-04-14 13:39                     ` Konrad Rzeszutek Wilk
2011-04-14 15:58                       ` ruozeng wang
2011-04-14 16:20                         ` Re: Xend hanging 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).