All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Jin <joe.jin@oracle.com>
To: Ian Campbell <ian.campbell@citrix.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: xen-devel <xen-devel@lists.xen.org>
Subject: [PATCH] xend: disallow multiple destroy() call
Date: Mon, 04 Feb 2013 09:54:23 +0800	[thread overview]
Message-ID: <510F14CF.6050801@oracle.com> (raw)

Current Xend allowing multiple call destroy() for same domain, this lead
multiple hard resets(FLR) for pci pass-through, and some controller might
failed.

In our test, we pass through 2 LSI HAB controllers to the PVHVM guest, after
guest brought up, call xm-destroy twice, the adapters's BIOS will hung, and
we had to reboot the server to recovery it.

Signed-off-by: Joe Jin <joe.jin@oracle.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
---
 tools/python/xen/xend/XendDomainInfo.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py
index e9d3e7e..658c3b6 100644
--- a/tools/python/xen/xend/XendDomainInfo.py
+++ b/tools/python/xen/xend/XendDomainInfo.py
@@ -367,6 +367,8 @@ class XendDomainInfo:
     @type refresh_shutdown_lock: threading.Condition
     @ivar _deviceControllers: device controller cache for this domain
     @type _deviceControllers: dict 'string' to DevControllers
+    @ivar destroying: Is this domain destroying
+    @type destroying: bool
     """
     
     def __init__(self, info, domid = None, dompath = None, augment = False,
@@ -455,6 +457,8 @@ class XendDomainInfo:
         self._checkName(self.info['name_label'])
 
         self.metrics = XendVMMetrics(uuid.createString(), self)
+
+        self.destroying = False
             
 
     #
@@ -3073,6 +3077,12 @@ class XendDomainInfo:
 
         if self.domid is None:
             return
+
+        if self.destroying == False:
+            self.destroying = True
+        else:
+            raise VmError("Domain (domid=%s) is destroying, please wait!", str(self.domid))
+
         from xen.xend import XendDomain
         log.debug("XendDomainInfo.destroy: domid=%s", str(self.domid))
 
@@ -3088,6 +3098,7 @@ class XendDomainInfo:
                     self.info[state] = 0
                 self._stateSet(DOM_STATE_HALTED)
             except:
+                self.destroying = False
                 log.exception("XendDomainInfo.destroy: domain destruction failed.")
 
             XendDomain.instance().remove_domain(self)
-- 
1.8.1

             reply	other threads:[~2013-02-04  1:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-04  1:54 Joe Jin [this message]
2013-02-04  9:52 ` [PATCH] xend: disallow multiple destroy() call Roger Pau Monné
2013-02-05  6:47   ` Joe Jin
2013-02-05  9:42     ` Ian Campbell
2013-02-16  5:38       ` Joe Jin
2013-02-18 10:33         ` Ian Campbell
2013-02-17  4:04       ` Joe Jin
2013-02-17  5:07         ` Joe Jin
2013-02-18 10:39           ` Ian Campbell
2013-03-19 17:41 ` Konrad Rzeszutek Wilk

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=510F14CF.6050801@oracle.com \
    --to=joe.jin@oracle.com \
    --cc=ian.campbell@citrix.com \
    --cc=konrad.wilk@oracle.com \
    --cc=xen-devel@lists.xen.org \
    /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.