Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: src/sys/arch/xen/xen



Module Name:    src
Committed By:   cegger
Date:           Tue Aug 19 15:14:43 UTC 2008

Modified Files:
        src/sys/arch/xen/xen: privcmd.c

Log Message:
When shutting down or rebooting a domu, a phantom domain was left with:

> xm list
Domain-Unnamed                               1   467     1     ---s--  46.0

The root cause is a discrepancy in the error *value* codes:
BSD uses the AT&T Unix Version 6 error codes, while Xen uses
Unix System V error codes (or actually what Linux/i386 has taken over from it).

After shutting down (or rebooting) a domU, the guest container gets destroyed.
This implies freeing resources used by the guest (RAM, internal management 
structures, etc.).

The destroy process is an asynchronous process in order to not block the Dom0 
(and other DomUs).
The destroy process works this way:

The XEN_DOMCTL_destroydomain is invoked from the xentools (python, libxc code).
XEN_DOMCTL_destroydomain hypercall calls domain_kill().
domain_kill() calls domain_relinquish_resources().
domain_relinquish_resources() calls relinquish_memory().
relinquish_memory() calls hypercall_preempt_check().

hypercall_preempt_check() makes all this asynchronous.
It fails, if there's an other hypercall pending.
In that case relinquish_memory() returns EAGAIN, which means, just retry to 
continue the destroy process.

EAGAIN is passed through the return path back into the python code
(= userspace). The python code checks for EAGAIN and *should*
retry, but it didn't.

In Unix System V / Linux, EAGAIN has the error code value 11.
In BSD, EAGAIN has the error code value 35 and EDEADLK has the error code value 
11.

This means, Xen returning EAGAIN means for the python code EDEADLK.
This lead to the confusing error message 'domain destroy failed due to Resource 
Deadlock avoided'.

We finally convert the error code from the Xen hypercall to BSD before passing 
it upstream.


To generate a diff of this commit:
cvs rdiff -r1.27 -r1.28 src/sys/arch/xen/xen/privcmd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Home | Main Index | Thread Index | Old Index