From xen-changelog-bounces@lists.xensource.com Tue Jul 01 05:49:57 2008
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Jul 2008 05:49:57 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1KDfIz-0005DE-4R; Tue, 01 Jul 2008 05:49:57 -0700
Received: from spam.xensource.com ([70.42.241.90])
	by lists.xensource.com with esmtp (Exim 4.43) id 1KDfIw-0005CE-Ek
	for xen-changelog@lists.xensource.com; Tue, 01 Jul 2008 05:49:54 -0700
X-ASG-Debug-ID: 1214916591-429f00000001-DBsQO9
X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi
Received: from SMTP.CITRIX.COM (localhost [127.0.0.1])
	by spam.xensource.com (Spam Firewall) with ESMTP id A7B305303A
	for <xen-changelog@lists.xensource.com>;
	Tue,  1 Jul 2008 05:49:52 -0700 (PDT)
Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by
	spam.xensource.com with ESMTP id DWhz10U2LSvPkviH for
	<xen-changelog@lists.xensource.com>;
	Tue, 01 Jul 2008 05:49:52 -0700 (PDT)
X-SBRS: None
X-MesageID: 782227
X-Ironport-Server: ftlpip01.citrite.net
X-Remote-IP: 70.42.241.98
X-Policy: $Relay
X-IronPort-AV: E=Sophos;i="4.27,731,1204520400"; 
   d="scan'208";a="782227"
Received: from relay.colo.xensource.com ([70.42.241.98])
	by SMTP.CITRIX.COM with ESMTP; 01 Jul 2008 08:49:51 -0400
Received: from xenbits.xensource.com (xenbits.colo.xensource.com
	[70.42.241.107])
	by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id
	m61CnpKj021923
	for <xen-changelog@lists.xensource.com>; Tue, 1 Jul 2008 05:49:51 -0700
Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1])
	by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m61CoBiF025799
	for <xen-changelog@lists.xensource.com>; Tue, 1 Jul 2008 05:50:11 -0700
Received: (from xen@localhost)
	by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m61CoBDK025798
	for xen-changelog@lists.xensource.com; Tue, 1 Jul 2008 05:50:11 -0700
Message-Id: <200807011250.m61CoBDK025798@xenbits.xensource.com>
Date: Tue, 01 Jul 2008 05:50:10 -0700
From: Xen patchbot-unstable <patchbot-unstable@lists.xensource.com>
To: xen-changelog@lists.xensource.com
X-ASG-Orig-Subj: [xen-unstable] xend: open qemu-dm logfile in append mode if
	log rotation is disabled by config.
X-Barracuda-Connect: smtp.citrix.com[66.165.176.89]
X-Barracuda-Start-Time: 1214916592
X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com
X-Barracuda-Spam-Score: 1.25
X-Barracuda-Spam-Status: No, SCORE=1.25 using per-user scores of TAG_LEVEL=3.5
	QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M,
	BSF_RULE_7580C
X-Barracuda-Spam-Report: Code version 3.1, rules version 3.1.54860
	Rule breakdown below
	pts rule name              description
	---- ----------------------
	--------------------------------------------------
	0.75 BSF_RULE_7580C         BODY: Custom Rule 7580C
	0.50 BSF_RULE7568M          Custom Rule 7568M
Subject: [Xen-changelog] [xen-unstable] xend: open qemu-dm logfile in append
	mode if log rotation is disabled by config.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1214906349 -3600
# Node ID 763c32fdbd13111cfc0f5eca0d858ff3d5732207
# Parent  20966aa897390b622fd0d4286dc812a09450eb8c
xend: open qemu-dm logfile in append mode if log rotation is disabled by config.

Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com>
---
 tools/python/xen/xend/image.py |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)

diff -r 20966aa89739 -r 763c32fdbd13 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py	Tue Jul 01 10:58:43 2008 +0100
+++ b/tools/python/xen/xend/image.py	Tue Jul 01 10:59:09 2008 +0100
@@ -380,8 +380,10 @@ class ImageHandler:
         self.logfile = "/var/log/xen/qemu-dm-%s.log" %  str(self.vm.info['name_label'])
 
         # rotate log
+        logfile_mode = os.O_WRONLY|os.O_CREAT|os.O_APPEND
         logrotate_count = XendOptions.instance().get_qemu_dm_logrotate_count()
         if logrotate_count > 0:
+            logfile_mode |= os.O_TRUNC
             if os.path.exists("%s.%d" % (self.logfile, logrotate_count)):
                 os.unlink("%s.%d" % (self.logfile, logrotate_count))
             for n in range(logrotate_count - 1, 0, -1):
@@ -392,7 +394,7 @@ class ImageHandler:
                 os.rename(self.logfile, self.logfile + ".1")
 
         null = os.open("/dev/null", os.O_RDONLY)
-        logfd = os.open(self.logfile, os.O_WRONLY|os.O_CREAT|os.O_TRUNC|os.O_APPEND)
+        logfd = os.open(self.logfile, logfile_mode)
         
         sys.stderr.flush()
         pid = os.fork()

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

From xen-changelog-bounces@lists.xensource.com Tue Jul 01 05:50:02 2008
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Jul 2008 05:50:02 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1KDfJ4-0005Gb-BP; Tue, 01 Jul 2008 05:50:02 -0700
Received: from spam.xensource.com ([70.42.241.90])
	by lists.xensource.com with esmtp (Exim 4.43) id 1KDfIw-0005CJ-PX
	for xen-changelog@lists.xensource.com; Tue, 01 Jul 2008 05:49:54 -0700
X-ASG-Debug-ID: 1214916591-429f00000000-DBsQO9
X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi
Received: from SMTP.CITRIX.COM (localhost [127.0.0.1])
	by spam.xensource.com (Spam Firewall) with ESMTP id 4FB8553038
	for <xen-changelog@lists.xensource.com>;
	Tue,  1 Jul 2008 05:49:52 -0700 (PDT)
Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by
	spam.xensource.com with ESMTP id 5y2HYudToIdA63it for
	<xen-changelog@lists.xensource.com>;
	Tue, 01 Jul 2008 05:49:52 -0700 (PDT)
X-SBRS: None
X-MesageID: 782226
X-Ironport-Server: ftlpip01.citrite.net
X-Remote-IP: 70.42.241.98
X-Policy: $Relay
X-IronPort-AV: E=Sophos;i="4.27,731,1204520400"; 
   d="scan'208";a="782226"
Received: from relay.colo.xensource.com ([70.42.241.98])
	by SMTP.CITRIX.COM with ESMTP; 01 Jul 2008 08:49:51 -0400
Received: from xenbits.xensource.com (xenbits.colo.xensource.com
	[70.42.241.107])
	by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id
	m61CnoRQ021920
	for <xen-changelog@lists.xensource.com>; Tue, 1 Jul 2008 05:49:50 -0700
Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1])
	by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m61CoAo2025782
	for <xen-changelog@lists.xensource.com>; Tue, 1 Jul 2008 05:50:10 -0700
Received: (from xen@localhost)
	by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m61CoA6e025781
	for xen-changelog@lists.xensource.com; Tue, 1 Jul 2008 05:50:10 -0700
Message-Id: <200807011250.m61CoA6e025781@xenbits.xensource.com>
Date: Tue, 01 Jul 2008 05:50:09 -0700
From: Xen patchbot-unstable <patchbot-unstable@lists.xensource.com>
To: xen-changelog@lists.xensource.com
X-ASG-Orig-Subj: [xen-unstable] xend: improve the rotation of qemu-dm logfiles.
X-Barracuda-Connect: smtp.citrix.com[66.165.176.89]
X-Barracuda-Start-Time: 1214916592
X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com
X-Barracuda-Spam-Score: 1.25
X-Barracuda-Spam-Status: No, SCORE=1.25 using per-user scores of TAG_LEVEL=3.5
	QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M,
	BSF_RULE_7580C
X-Barracuda-Spam-Report: Code version 3.1, rules version 3.1.54860
	Rule breakdown below
	pts rule name              description
	---- ----------------------
	--------------------------------------------------
	0.75 BSF_RULE_7580C         BODY: Custom Rule 7580C
	0.50 BSF_RULE7568M          Custom Rule 7568M
Subject: [Xen-changelog] [xen-unstable] xend: improve the rotation of
	qemu-dm logfiles.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1214906323 -3600
# Node ID 20966aa897390b622fd0d4286dc812a09450eb8c
# Parent  c33a40b4c22bfdd1cdc808bda2bd4d19f48ee4dc
xend: improve the rotation of qemu-dm logfiles.

Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com>
---
 tools/examples/xend-config.sxp       |    3 +++
 tools/python/xen/xend/XendOptions.py |    7 +++++++
 tools/python/xen/xend/image.py       |   16 ++++++++++++----
 3 files changed, 22 insertions(+), 4 deletions(-)

diff -r c33a40b4c22b -r 20966aa89739 tools/examples/xend-config.sxp
--- a/tools/examples/xend-config.sxp	Mon Jun 30 14:19:09 2008 +0100
+++ b/tools/examples/xend-config.sxp	Tue Jul 01 10:58:43 2008 +0100
@@ -242,3 +242,6 @@
 
 # Script to run when the label of a resource has changed.
 #(resource-label-change-script '')
+
+# Rotation count of qemu-dm log file.
+#(qemu-dm-logrotate-count 10)
diff -r c33a40b4c22b -r 20966aa89739 tools/python/xen/xend/XendOptions.py
--- a/tools/python/xen/xend/XendOptions.py	Mon Jun 30 14:19:09 2008 +0100
+++ b/tools/python/xen/xend/XendOptions.py	Tue Jul 01 10:58:43 2008 +0100
@@ -132,6 +132,9 @@ class XendOptions:
     """Default script to configure a backend network interface"""
     vif_script = osdep.vif_script
 
+    """Default rotation count of qemu-dm log file."""
+    qemu_dm_logrotate_count = 10
+
     def __init__(self):
         self.configure()
 
@@ -350,6 +353,10 @@ class XendOptions:
 
     def get_vnc_x509_verify(self):
         return self.get_config_string('vnc-x509-verify', self.xend_vnc_x509_verify)
+
+    def get_qemu_dm_logrotate_count(self):
+        return self.get_config_int("qemu-dm-logrotate-count",
+                                   self.qemu_dm_logrotate_count)
 
 
 class XendOptionsFile(XendOptions):
diff -r c33a40b4c22b -r 20966aa89739 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py	Mon Jun 30 14:19:09 2008 +0100
+++ b/tools/python/xen/xend/image.py	Tue Jul 01 10:58:43 2008 +0100
@@ -378,10 +378,18 @@ class ImageHandler:
         # keep track of pid and spawned options to kill it later
 
         self.logfile = "/var/log/xen/qemu-dm-%s.log" %  str(self.vm.info['name_label'])
-        if os.path.exists(self.logfile):
-            if os.path.exists(self.logfile + ".1"):
-                os.unlink(self.logfile + ".1")
-            os.rename(self.logfile, self.logfile + ".1")
+
+        # rotate log
+        logrotate_count = XendOptions.instance().get_qemu_dm_logrotate_count()
+        if logrotate_count > 0:
+            if os.path.exists("%s.%d" % (self.logfile, logrotate_count)):
+                os.unlink("%s.%d" % (self.logfile, logrotate_count))
+            for n in range(logrotate_count - 1, 0, -1):
+                if os.path.exists("%s.%d" % (self.logfile, n)):
+                    os.rename("%s.%d" % (self.logfile, n),
+                              "%s.%d" % (self.logfile, (n + 1)))
+            if os.path.exists(self.logfile):
+                os.rename(self.logfile, self.logfile + ".1")
 
         null = os.open("/dev/null", os.O_RDONLY)
         logfd = os.open(self.logfile, os.O_WRONLY|os.O_CREAT|os.O_TRUNC|os.O_APPEND)

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

From xen-changelog-bounces@lists.xensource.com Tue Jul 01 08:49:55 2008
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Jul 2008 08:49:55 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1KDi78-00067L-Ux; Tue, 01 Jul 2008 08:49:54 -0700
Received: from spam.xensource.com ([70.42.241.90])
	by lists.xensource.com with esmtp (Exim 4.43) id 1KDi77-00066u-3m
	for xen-changelog@lists.xensource.com; Tue, 01 Jul 2008 08:49:53 -0700
X-ASG-Debug-ID: 1214927392-3c2100050000-DBsQO9
X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi
Received: from SMTP.CITRIX.COM (localhost [127.0.0.1])
	by spam.xensource.com (Spam Firewall) with ESMTP id 6F1D95334C
	for <xen-changelog@lists.xensource.com>;
	Tue,  1 Jul 2008 08:49:52 -0700 (PDT)
Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by
	spam.xensource.com with ESMTP id OcfZDyJqocH4m57v for
	<xen-changelog@lists.xensource.com>;
	Tue, 01 Jul 2008 08:49:52 -0700 (PDT)
X-SBRS: None
X-MesageID: 785712
X-Ironport-Server: ftlpip01.citrite.net
X-Remote-IP: 70.42.241.98
X-Policy: $Relay
X-IronPort-AV: E=Sophos;i="4.27,732,1204520400"; 
   d="scan'208";a="785712"
Received: from relay.colo.xensource.com ([70.42.241.98])
	by SMTP.CITRIX.COM with ESMTP; 01 Jul 2008 11:49:51 -0400
Received: from xenbits.xensource.com (xenbits.colo.xensource.com
	[70.42.241.107])
	by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id
	m61FnpRY022094
	for <xen-changelog@lists.xensource.com>; Tue, 1 Jul 2008 08:49:51 -0700
Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1])
	by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m61FoAYc003375
	for <xen-changelog@lists.xensource.com>; Tue, 1 Jul 2008 08:50:10 -0700
Received: (from xen@localhost)
	by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m61FoAkE003374
	for xen-changelog@lists.xensource.com; Tue, 1 Jul 2008 08:50:10 -0700
Message-Id: <200807011550.m61FoAkE003374@xenbits.xensource.com>
Date: Tue, 01 Jul 2008 08:50:09 -0700
From: Xen patchbot-unstable <patchbot-unstable@lists.xensource.com>
To: xen-changelog@lists.xensource.com
X-ASG-Orig-Subj: [xen-unstable] ioemu: limit xen-console buffering
X-Barracuda-Connect: smtp.citrix.com[66.165.176.89]
X-Barracuda-Start-Time: 1214927392
X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com
X-Barracuda-Spam-Score: 0.50
X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5
	QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M
X-Barracuda-Spam-Report: Code version 3.1, rules version 3.1.54872
	Rule breakdown below
	pts rule name              description
	---- ----------------------
	--------------------------------------------------
	0.50 BSF_RULE7568M          Custom Rule 7568M
Subject: [Xen-changelog] [xen-unstable] ioemu: limit xen-console buffering
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1214908731 -3600
# Node ID 73a4fbdfe0c4f3a840fbf322993750fe4e2c8704
# Parent  763c32fdbd13111cfc0f5eca0d858ff3d5732207
ioemu: limit xen-console buffering
Set dom->buffer.max_capacity to xend configured limit.

Signed-off-by: Pat Campbell <plc@novell.com>
---
 tools/ioemu/hw/xen_console.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff -r 763c32fdbd13 -r 73a4fbdfe0c4 tools/ioemu/hw/xen_console.c
--- a/tools/ioemu/hw/xen_console.c	Tue Jul 01 10:59:09 2008 +0100
+++ b/tools/ioemu/hw/xen_console.c	Tue Jul 01 11:38:51 2008 +0100
@@ -160,16 +160,18 @@ int xs_gather(struct xs_handle *xs, cons
 
 static int domain_create_ring(struct domain *dom)
 {
-	int err, remote_port, ring_ref, rc;
+	int err, remote_port, ring_ref, limit, rc;
 
 	err = xs_gather(dom->xsh, dom->serialpath,
 			"ring-ref", "%u", &ring_ref,
 			"port", "%i", &remote_port,
+			"limit", "%i", &limit,
 			NULL);
 	if (err) {
 		err = xs_gather(dom->xsh, dom->conspath,
 				"ring-ref", "%u", &ring_ref,
 				"port", "%i", &remote_port,
+				"limit", "%i", &limit,
 				NULL);
 		if (err) {
 			fprintf(stderr, "Console: failed to find ring-ref/port yet\n");
@@ -178,7 +180,9 @@ static int domain_create_ring(struct dom
 		dom->use_consolepath = 1;
 	} else
 		dom->use_consolepath = 0;
-	fprintf(stderr, "Console: got ring-ref %d port %d\n", ring_ref, remote_port);
+	dom->buffer.max_capacity = limit;
+	fprintf(stderr, "Console: got ring-ref %d port %d limit %d\n", 
+		ring_ref, remote_port, limit);
 
 	if ((ring_ref == dom->ring_ref) && (remote_port == dom->remote_port))
 		goto out;

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

From xen-changelog-bounces@lists.xensource.com Tue Jul 01 08:50:00 2008
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Jul 2008 08:50:00 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1KDi7E-0006B0-GR; Tue, 01 Jul 2008 08:50:00 -0700
Received: from spam.xensource.com ([70.42.241.90])
	by lists.xensource.com with esmtp (Exim 4.43) id 1KDi79-00067l-5d
	for xen-changelog@lists.xensource.com; Tue, 01 Jul 2008 08:49:55 -0700
X-ASG-Debug-ID: 1214927392-3c2100050002-DBsQO9
X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi
Received: from SMTP.CITRIX.COM (localhost [127.0.0.1])
	by spam.xensource.com (Spam Firewall) with ESMTP id 256D253358
	for <xen-changelog@lists.xensource.com>;
	Tue,  1 Jul 2008 08:49:53 -0700 (PDT)
Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by
	spam.xensource.com with ESMTP id v5KkE6FBjELStkIK for
	<xen-changelog@lists.xensource.com>;
	Tue, 01 Jul 2008 08:49:53 -0700 (PDT)
X-SBRS: None
X-MesageID: 785714
X-Ironport-Server: ftlpip01.citrite.net
X-Remote-IP: 70.42.241.98
X-Policy: $Relay
X-IronPort-AV: E=Sophos;i="4.27,732,1204520400"; 
   d="scan'208";a="785714"
Received: from relay.colo.xensource.com ([70.42.241.98])
	by SMTP.CITRIX.COM with ESMTP; 01 Jul 2008 11:49:53 -0400
Received: from xenbits.xensource.com (xenbits.colo.xensource.com
	[70.42.241.107])
	by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id
	m61Fnrji022100
	for <xen-changelog@lists.xensource.com>; Tue, 1 Jul 2008 08:49:53 -0700
Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1])
	by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m61FoCZf003409
	for <xen-changelog@lists.xensource.com>; Tue, 1 Jul 2008 08:50:12 -0700
Received: (from xen@localhost)
	by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m61FoCYY003408
	for xen-changelog@lists.xensource.com; Tue, 1 Jul 2008 08:50:12 -0700
Message-Id: <200807011550.m61FoCYY003408@xenbits.xensource.com>
Date: Tue, 01 Jul 2008 08:50:12 -0700
From: Xen patchbot-unstable <patchbot-unstable@lists.xensource.com>
To: xen-changelog@lists.xensource.com
X-ASG-Orig-Subj: [xen-unstable] VT-d: Do CLFLUSH after updating IRTE entries
X-Barracuda-Connect: smtp.citrix.com[66.165.176.89]
X-Barracuda-Start-Time: 1214927394
X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com
X-Barracuda-Spam-Score: 0.00
X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5
	QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=
X-Barracuda-Spam-Report: Code version 3.1, rules version 3.1.54872
	Rule breakdown below
	pts rule name              description
	---- ----------------------
	--------------------------------------------------
Subject: [Xen-changelog] [xen-unstable] VT-d: Do CLFLUSH after updating IRTE
	entries
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1214908855 -3600
# Node ID 0b7f7c564c83fafeecc5a08aeeda2d69dcfd73ae
# Parent  0c5183e764d8dfc3d916b4f216b3b6c484caccc9
VT-d: Do CLFLUSH after updating IRTE entries

Like root, context and DMA remap page table, interrupt remap table
also needs CLFLUSH after any update.

Signed-off-by: Weidong Han <weidong.han@intel.com>
---
 xen/drivers/passthrough/vtd/intremap.c |    2 ++
 1 files changed, 2 insertions(+)

diff -r 0c5183e764d8 -r 0b7f7c564c83 xen/drivers/passthrough/vtd/intremap.c
--- a/xen/drivers/passthrough/vtd/intremap.c	Tue Jul 01 11:40:07 2008 +0100
+++ b/xen/drivers/passthrough/vtd/intremap.c	Tue Jul 01 11:40:55 2008 +0100
@@ -153,6 +153,7 @@ static void ioapic_rte_to_remap_entry(st
     }
 
     memcpy(iremap_entry, &new_ire, sizeof(struct iremap_entry));
+    iommu_flush_cache_entry(iremap_entry);
     iommu_flush_iec_index(iommu, 0, index);
     invalidate_sync(iommu);
 
@@ -378,6 +379,7 @@ static void msi_msg_to_remap_entry(
     remap_rte->data = 0;
 
     memcpy(iremap_entry, &new_ire, sizeof(struct iremap_entry));
+    iommu_flush_cache_entry(iremap_entry);
     iommu_flush_iec_index(iommu, 0, index);
     invalidate_sync(iommu);
 

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

From xen-changelog-bounces@lists.xensource.com Tue Jul 01 08:50:06 2008
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Jul 2008 08:50:06 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1KDi7K-0006FY-IV; Tue, 01 Jul 2008 08:50:06 -0700
Received: from spam.xensource.com ([70.42.241.90])
	by lists.xensource.com with esmtp (Exim 4.43) id 1KDi7A-00068Y-9t
	for xen-changelog@lists.xensource.com; Tue, 01 Jul 2008 08:49:56 -0700
X-ASG-Debug-ID: 1214927392-3c2100050003-DBsQO9
X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi
Received: from SMTP.CITRIX.COM (localhost [127.0.0.1])
	by spam.xensource.com (Spam Firewall) with ESMTP id 14C0B53393
	for <xen-changelog@lists.xensource.com>;
	Tue,  1 Jul 2008 08:49:54 -0700 (PDT)
Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by
	spam.xensource.com with ESMTP id OqqNWD6covCLRadZ for
	<xen-changelog@lists.xensource.com>;
	Tue, 01 Jul 2008 08:49:54 -0700 (PDT)
X-SBRS: None
X-MesageID: 785715
X-Ironport-Server: ftlpip01.citrite.net
X-Remote-IP: 70.42.241.98
X-Policy: $Relay
X-IronPort-AV: E=Sophos;i="4.27,732,1204520400"; 
   d="scan'208";a="785715"
Received: from relay.colo.xensource.com ([70.42.241.98])
	by SMTP.CITRIX.COM with ESMTP; 01 Jul 2008 11:49:54 -0400
Received: from xenbits.xensource.com (xenbits.colo.xensource.com
	[70.42.241.107])
	by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id
	m61Fnsxc022103
	for <xen-changelog@lists.xensource.com>; Tue, 1 Jul 2008 08:49:54 -0700
Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1])
	by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m61FoD9r003427
	for <xen-changelog@lists.xensource.com>; Tue, 1 Jul 2008 08:50:13 -0700
Received: (from xen@localhost)
	by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m61FoDsN003426
	for xen-changelog@lists.xensource.com; Tue, 1 Jul 2008 08:50:13 -0700
Message-Id: <200807011550.m61FoDsN003426@xenbits.xensource.com>
Date: Tue, 01 Jul 2008 08:50:13 -0700
From: Xen patchbot-unstable <patchbot-unstable@lists.xensource.com>
To: xen-changelog@lists.xensource.com
X-ASG-Orig-Subj: [xen-unstable] VT-d: Fix queue invalidation
X-Barracuda-Connect: smtp.citrix.com[66.165.176.89]
X-Barracuda-Start-Time: 1214927395
X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com
X-Barracuda-Spam-Score: 0.00
X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5
	QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=
X-Barracuda-Spam-Report: Code version 3.1, rules version 3.1.54872
	Rule breakdown below
	pts rule name              description
	---- ----------------------
	--------------------------------------------------
Subject: [Xen-changelog] [xen-unstable] VT-d: Fix queue invalidation
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1214908903 -3600
# Node ID d4cf12d128eda92fc461571f2454e00ef7090e45
# Parent  0b7f7c564c83fafeecc5a08aeeda2d69dcfd73ae
VT-d: Fix queue invalidation

Correct invalidate_sync(), and clean up qinval_setup().

Signed-off-by: Weidong Han <weidong.han@intel.com>
---
 xen/drivers/passthrough/vtd/qinval.c |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diff -r 0b7f7c564c83 -r d4cf12d128ed xen/drivers/passthrough/vtd/qinval.c
--- a/xen/drivers/passthrough/vtd/qinval.c	Tue Jul 01 11:40:55 2008 +0100
+++ b/xen/drivers/passthrough/vtd/qinval.c	Tue Jul 01 11:41:43 2008 +0100
@@ -222,7 +222,7 @@ int invalidate_sync(struct iommu *iommu)
     int ret = -1;
     struct qi_ctrl *qi_ctrl = iommu_qi_ctrl(iommu);
 
-    if ( qi_ctrl->qinval_maddr == 0 )
+    if ( qi_ctrl->qinval_maddr != 0 )
     {
         ret = queue_invalidate_wait(iommu,
             0, 1, 1, 1, &qi_ctrl->qinval_poll_status);
@@ -416,7 +416,6 @@ int qinval_setup(struct iommu *iommu)
 int qinval_setup(struct iommu *iommu)
 {
     s_time_t start_time;
-    u32 status = 0;
     struct qi_ctrl *qi_ctrl;
     struct iommu_flush *flush;
 
@@ -450,15 +449,12 @@ int qinval_setup(struct iommu *iommu)
 
     /* Make sure hardware complete it */
     start_time = NOW();
-    for ( ; ; )
-    {
-        status = dmar_readl(iommu->reg, DMAR_GSTS_REG);
-        if ( status & DMA_GSTS_QIES )
-            break;
+    while ( !(dmar_readl(iommu->reg, DMAR_GSTS_REG) & DMA_GSTS_QIES) )
+    {
         if ( NOW() > (start_time + DMAR_OPERATION_TIMEOUT) )
             panic("Cannot set QIE field for queue invalidation\n");
         cpu_relax();
     }
-    status = 0;
-    return status;
-}
+
+    return 0;
+}

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

From xen-changelog-bounces@lists.xensource.com Tue Jul 01 08:50:12 2008
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Jul 2008 08:50:12 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1KDi7Q-0006JO-75; Tue, 01 Jul 2008 08:50:12 -0700
Received: from spam.xensource.com ([70.42.241.90])
	by lists.xensource.com with esmtp (Exim 4.43) id 1KDi7A-00068b-DJ
	for xen-changelog@lists.xensource.com; Tue, 01 Jul 2008 08:49:56 -0700
X-ASG-Debug-ID: 1214927392-3c2100050001-DBsQO9
X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi
Received: from SMTP.CITRIX.COM (localhost [127.0.0.1])
	by spam.xensource.com (Spam Firewall) with ESMTP id 7FD9753352
	for <xen-changelog@lists.xensource.com>;
	Tue,  1 Jul 2008 08:49:52 -0700 (PDT)
Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by
	spam.xensource.com with ESMTP id StBg9sbomyTsloWd for
	<xen-changelog@lists.xensource.com>;
	Tue, 01 Jul 2008 08:49:52 -0700 (PDT)
X-SBRS: None
X-MesageID: 785713
X-Ironport-Server: ftlpip01.citrite.net
X-Remote-IP: 70.42.241.98
X-Policy: $Relay
X-IronPort-AV: E=Sophos;i="4.27,732,1204520400"; 
   d="scan'208";a="785713"
Received: from relay.colo.xensource.com ([70.42.241.98])
	by SMTP.CITRIX.COM with ESMTP; 01 Jul 2008 11:49:52 -0400
Received: from xenbits.xensource.com (xenbits.colo.xensource.com
	[70.42.241.107])
	by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id
	m61Fnp5t022097
	for <xen-changelog@lists.xensource.com>; Tue, 1 Jul 2008 08:49:51 -0700
Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1])
	by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m61FoBvL003392
	for <xen-changelog@lists.xensource.com>; Tue, 1 Jul 2008 08:50:11 -0700
Received: (from xen@localhost)
	by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m61FoB8u003391
	for xen-changelog@lists.xensource.com; Tue, 1 Jul 2008 08:50:11 -0700
Message-Id: <200807011550.m61FoB8u003391@xenbits.xensource.com>
Date: Tue, 01 Jul 2008 08:50:11 -0700
From: Xen patchbot-unstable <patchbot-unstable@lists.xensource.com>
To: xen-changelog@lists.xensource.com
X-ASG-Orig-Subj: [xen-unstable] xenballoond (memory overcommit) scripts
X-Barracuda-Connect: smtp.citrix.com[66.165.176.89]
X-Barracuda-Start-Time: 1214927393
X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com
X-Barracuda-Spam-Score: 0.75
X-Barracuda-Spam-Status: No, SCORE=0.75 using per-user scores of TAG_LEVEL=3.5
	QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE_7580G
X-Barracuda-Spam-Report: Code version 3.1, rules version 3.1.54872
	Rule breakdown below
	pts rule name              description
	---- ----------------------
	--------------------------------------------------
	0.75 BSF_RULE_7580G         BODY: Custom Rule 7580G
Subject: [Xen-changelog] [xen-unstable] xenballoond (memory overcommit)
	scripts
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1214908807 -3600
# Node ID 0c5183e764d8dfc3d916b4f216b3b6c484caccc9
# Parent  73a4fbdfe0c4f3a840fbf322993750fe4e2c8704
xenballoond (memory overcommit) scripts

See the README and conf files for more info.

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
---
 tools/xenballoon/xenballoon-monitor |   43 +++++++
 tools/xenballoon/xenballoon.conf    |   91 +++++++++++++++
 tools/xenballoon/xenballoond        |  205 ++++++++++++++++++++++++++++++++++++
 tools/xenballoon/xenballoond.README |   82 ++++++++++++++
 tools/xenballoon/xenballoond.init   |   91 +++++++++++++++
 5 files changed, 512 insertions(+)

diff -r 73a4fbdfe0c4 -r 0c5183e764d8 tools/xenballoon/xenballoon-monitor
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/xenballoon/xenballoon-monitor	Tue Jul 01 11:40:07 2008 +0100
@@ -0,0 +1,43 @@
+#!/bin/bash
+#
+# xenballoon-monitor - monitor certain stats from xenballoond
+#   (run in dom0 with "watch -d xenballoon-monitor" for xentop-like output)
+#
+# Copyright (C) 2009 Oracle Corporation and/or its affiliates.
+# All rights reserved
+# Written by: Dan Magenheimer <dan.magenheimer@oracle.com>
+#
+# Hint: Use "xm sched-credit -d 0 -w 2000" to watch on heavily loaded machines
+#
+echo "id   mem-kb  tgt-kb  commit   swapin  swapout      pgin     pgout active(sec)"
+for i in `xenstore-list /local/domain`; do
+ if [ "$i" -ne 0 ]; then
+ tot=0; tgt=0; sin=0; sout=0; pgin=0; pgout=0; cmt=0; up=0; idle=0; act=0;
+ if xenstore-exists /local/domain/$i/memory/meminfo; then
+  tot=`xenstore-read /local/domain/$i/memory/meminfo | grep MemTotal \
+   | sed 's/[^1-9]*\([1-9][0-9]*\).*/\1/'`
+  cmt=`xenstore-read /local/domain/$i/memory/meminfo | grep Committed_AS \
+   | sed 's/[^1-9]*\([1-9][0-9]*\).*/\1/'`
+ fi
+ if xenstore-exists /local/domain/$i/memory/selftarget; then
+  tgt=`xenstore-read /local/domain/$i/memory/selftarget`
+ fi
+ if xenstore-exists /local/domain/$i/memory/vmstat; then
+  sin=`xenstore-read /local/domain/$i/memory/vmstat | grep pswpin \
+ 	| cut -d" " -f2`
+  sout=`xenstore-read /local/domain/$i/memory/vmstat | grep pswpout \
+ 	| cut -d" " -f2`
+  pgin=`xenstore-read /local/domain/$i/memory/vmstat | grep pgpgin \
+ 	| cut -d" " -f2`
+  pgout=`xenstore-read /local/domain/$i/memory/vmstat | grep pgout \
+  	| cut -d" " -f2`
+ fi
+ if xenstore-exists /local/domain/$i/memory/uptime; then
+  up=`xenstore-read /local/domain/$i/memory/uptime | cut -d" " -f1`
+  idle=`xenstore-read /local/domain/$i/memory/uptime | cut -d" " -f2`
+  act=`echo $up - $idle | bc -iq`
+ fi
+ printf "%2d %8d%8d%8d%9d%9d%10d%10d%10.2f\n" $i $tot $tgt $cmt $sin $sout $pgin $pgout $act
+ fi
+done
+echo Free memory: `xm info | grep free | sed 's/[^1-9]*\([1-9][0-9]*\).*/\1/'` MB
diff -r 73a4fbdfe0c4 -r 0c5183e764d8 tools/xenballoon/xenballoon.conf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/xenballoon/xenballoon.conf	Tue Jul 01 11:40:07 2008 +0100
@@ -0,0 +1,91 @@
+## Path: System/xen
+## Description: xen domain start/stop on boot
+## Type: string
+## Default: 
+
+# NOTE: "xenbus is enabled" means not only that /proc/xen/xenbus exists
+# but also that /usr/bin/xenstore-* tools are installed.
+
+## Type: boolean
+## Default: false
+#
+# If XENBALLOON_SELF is true, selfballooning will occur, meaning the
+# balloon driver will grow and shrink according to available memory.
+# If xenbus is enabled, may be overridden by {memory/selfballoon}==0
+# If false but xenballoond is able to communicate with domain0 via
+# xenbus, balloon targets will be set by domain0
+# 
+XENBALLOON_SELF=false
+
+## Type: integer (must be > 0)
+## Default: 1
+#
+# If self-ballooning, number of seconds between checks/adjustments.
+# If xenbus is enabled, may be overridden by {memory/interval}
+XENBALLOON_SELF_INTERVAL=1
+
+## Type: integer (must be > 0)
+## Default: 1
+#
+# If NOT self-ballooning but xenbus is enabled, number of seconds between
+# checks/adjustments. May be overridden by {memory/interval}
+XENBALLOON_INTERVAL=1
+
+## Type: integer (must be > 0)
+## Default: 10
+#
+# When current > target, reduces rate at which target memory is ballooned
+# out.  For a value of n, 1/n of the difference will be ballooned.
+# This value applies both to selfballooning and directed ballooning.
+# May be overridden by {memory/downhysteresis}
+XENBALLOON_AUTO_DOWNHYSTERESIS=10
+
+## Type: integer (must be > 0)
+## Default: 1
+#
+# When current < target, reduces rate at which target memory is reclaimed
+# (if available).  For a value of n, 1/n of the difference will be ballooned.
+# This value applies both to selfballooning and directed ballooning.
+# May be overridden by {memory/uphysteresis}
+XENBALLOON_AUTO_UPHYSTERESIS=1
+
+## Type: integer (must be >= 0)
+## Default: 0
+#
+# In order to avoid ballooning so much memory that a guest experiences
+# out-of-memory errors (OOMs), memory will not be ballooned out below
+# a minimum target, in MB.  If this value is 0 (default), an heuristic
+# based on the maximum amount of memory will be used.  (The heuristic
+# provides the same minimum as recent versions of the balloon driver but
+# early versions of the balloon driver did not enforce a minimum.)
+XENBALLOON_MINMEM=0
+
+## Type: string
+## Default: "/var/run/xenballoon-maxmem"
+#
+# Location where memory high-water mark is stored; if a guest supports
+# hot-add memory, maxmem might increase across time and the minimum
+# target heuristic is based on max memory. NOTE: Reboot after changing
+# this variable, else overballooning may occur.
+XENBALLOON_MAXMEMFILE=/var/run/xenballoon-maxmem
+
+## Type: integer (0 or 1)
+## Default: 1
+#
+# If xenbus is enabled, whether selfballooning or directed ballooning,
+# place the result of 'cat /proc/meminfo" on xenbus at memory/meminfo
+XENBALLOON_SEND_MEMINFO=1
+
+## Type: integer (0 or 1)
+## Default: 1
+#
+# If xenbus is enabled, whether selfballooning or directed ballooning,
+# place the result of 'cat /proc/vmstat" on xenbus at memory/vmstat
+XENBALLOON_SEND_VMSTAT=1
+
+## Type: integer (0 or 1)
+## Default: 1
+#
+# If xenbus is enabled, whether selfballooning or directed ballooning,
+# place the result of 'cat /proc/uptime" on xenbus at memory/uptime
+XENBALLOON_SEND_UPTIME=1
diff -r 73a4fbdfe0c4 -r 0c5183e764d8 tools/xenballoon/xenballoond
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/xenballoon/xenballoond	Tue Jul 01 11:40:07 2008 +0100
@@ -0,0 +1,205 @@
+#!/bin/bash
+#
+# Copyright (C) 2008 Oracle Corporation and/or its affiliates.
+# All rights reserved.
+# Written by: Dan Magenheimer <dan.magenheimer@oracle.com>
+#
+# xenballoond - In-guest engine for Xen memory ballooning
+# Version: 080630
+#
+# Two "policies" are implemented:
+# - Selfballooning: Adjust memory periodically, with no (or little) input
+#     from domain0.  Target memory is determined solely by the
+#     Committed_AS line in /proc/meminfo, but parameters may adjust
+#     the rate at which the target is achieved.
+# - Directed ballooning: Adjust memory solely as directed by domain0
+#
+# Under some circumstances, "output" may also be generated; the contents
+# of /proc/meminfo and /proc/vmstat may be periodically placed on xenbus.
+#
+# If xenbus is running and the /usr/bin/xenstore-* tools are installed,
+# "xenbus is enabled".
+#
+# Parameters are documented in /etc/sysconfig/xenballoon.conf. Although 
+# some are not used with directed ballooning, all must be set properly.
+# If xenbus is enabled, some of these parameters may be overridden by values
+# set by domain0 via xenbus.
+
+minmb() {
+	RETVAL=$XENBALLOON_MINMEM
+	if [ $RETVAL -ne 0 ]; then
+		return $RETVAL
+	fi
+	kb=`cat $XENBALLOON_MAXMEMFILE`
+	let "mb=$kb/1024"
+	let "pages=$kb/4"
+	# this algorithm from drivers/xen/balloon/balloon.c:minimum_target()
+	# which was added to balloon.c in 2008 to avoid ballooning too small
+	# it is unnecessary here except to accomodate pre-2008 balloon drivers
+	# note that ranges are adjusted because a VM with "memory=1024"
+	# gets somewhat less than 1024MB
+	if [ $mb -lt 125 ]; then
+		let RETVAL="$(( 8 + ($pages >> 9) ))"
+	elif [ $mb -lt 500 ]; then
+		let RETVAL="$(( 40 + ($pages >> 10) ))"
+	elif [ $mb -lt 2000 ]; then
+		let RETVAL="$(( 104 + ($pages >> 11) ))"
+	else
+		let RETVAL="$(( 296 + ($pages >> 13) ))"
+	fi
+	return	# value returned in RETVAL in mB
+}
+
+curkb() {
+	kb=`grep MemTotal /proc/meminfo | sed 's/  */ /' | \
+		cut -f2 -d' '`
+	RETVAL=$kb
+	return  # value returned in RETVAL in kB
+}
+
+downhysteresis() {
+	RETVAL=$XENBALLOON_AUTO_DOWNHYSTERESIS
+	if [ $xenstore_enabled = "true" ]; then
+		if xenstore-exists memory/downhysteresis ; then
+			RETVAL=`xenstore-read memory/downhysteresis`
+		fi
+	fi
+	return
+}
+
+uphysteresis() {
+	RETVAL=$XENBALLOON_AUTO_UPHYSTERESIS
+	if [ $xenstore_enabled = "true" ]; then
+		if xenstore-exists memory/uphysteresis ; then
+			RETVAL=`xenstore-read memory/uphysteresis`
+		fi
+	fi
+	return
+}
+
+selfballoon_eval() {
+	if [ $xenstore_enabled = "true" ]; then
+		if xenstore-exists memory/selfballoon; then
+			RETVAL=`xenstore-read memory/selfballoon`
+			if [ $RETVAL -eq 1 ]; then
+				selfballoon_enabled=true
+				return
+			fi
+		fi
+	fi
+	selfballoon_enabled=$XENBALLOON_SELF
+	return
+}
+
+selftarget() {
+	tgtkb=`grep Committed_AS /proc/meminfo | sed 's/  */ /' | cut -f2 -d' '`
+	minmb
+	let "minbytes=$RETVAL*1024*1024"
+	let "tgtbytes=$tgtkb*1024"
+	if [ $tgtbytes -lt $minbytes ]; then
+		let "tgtbytes=$minbytes"
+	fi
+	RETVAL=$tgtbytes  # value returned in RETVAL in bytes
+	return
+}
+
+# $1 == 1 means use selftarget, else target in kB
+balloon_to_target() {
+	if [ "$1" -eq 1 ]; then
+		selftarget
+		tgtbytes=$RETVAL
+	else
+		let "tgtbytes=$(( $1 * 1024 ))"
+	fi
+	curkb
+	let "curbytes=$RETVAL*1024"
+	if [ $curbytes -gt $tgtbytes ]; then
+		downhysteresis
+		downhys=$RETVAL
+		if [ $downhys -ne 0 ]; then
+			let "tgtbytes=$(( $curbytes - \
+				( ( $curbytes - $tgtbytes ) / $downhys ) ))"
+		fi
+	else if [ $curbytes -lt $tgtbytes ]; then
+		uphysteresis
+		uphys=$RETVAL
+		let "tgtbytes=$(( $curbytes + \
+				( ( $tgtbytes - $curbytes ) / $uphys ) ))"
+		fi
+	fi
+	echo $tgtbytes > /proc/xen/balloon
+	if [ $xenstore_enabled = "true" ]; then
+		let "tgtkb=$(( $tgtbytes/1024 ))"
+		xenstore-write memory/selftarget $tgtkb
+	fi
+}
+
+send_memory_stats() {
+	if [ ! $xenstore_enabled = "true" ]; then
+		return
+	fi
+	if [ $XENBALLOON_SEND_MEMINFO ]; then
+		xenstore-write memory/meminfo "`cat /proc/meminfo`"
+	fi
+	if [ $XENBALLOON_SEND_VMSTAT ]; then
+		xenstore-write memory/vmstat "`cat /proc/vmstat`"
+	fi
+	if [ $XENBALLOON_SEND_UPTIME ]; then
+		xenstore-write memory/uptime "`cat /proc/uptime`"
+	fi
+}
+
+if [ ! -f /proc/xen/balloon ]; then
+	echo "$0: no balloon driver installed"
+	exit 0
+fi
+if [ ! -f /proc/meminfo ]; then
+	echo "$0: can't read /proc/meminfo"
+	exit 0
+fi
+xenstore_enabled=true
+if [ -f /usr/bin/xenstore-exists -a -f /usr/bin/xenstore-read -a \
+     -f /usr/bin/xenstore-write ]; then
+	xenstore_enabled=true
+else
+	echo "$0: missing /usr/bin/xenstore-* tools, disabling directed ballooning"
+	xenstore_enabled=false
+fi
+
+. /etc/sysconfig/xenballoon.conf
+
+while true;
+do
+	# handle special case for PV domains with hot-add memory
+	if [ ! -f $XENBALLOON_MAXMEMFILE ]; then
+		maxkb=0
+	else
+		maxkb=`cat $XENBALLOON_MAXMEMFILE`
+	fi
+	curkb=`grep MemTotal /proc/meminfo | sed 's/  */ /' | cut -f2 -d' '`
+	if [ $curkb -gt $maxkb ]; then
+		echo $curkb > $XENBALLOON_MAXMEMFILE
+	fi
+	interval=$XENBALLOON_INTERVAL
+	# do self-ballooning
+	selfballoon_eval
+	if [ $selfballoon_enabled = "true" ]; then
+		balloon_to_target 1
+		interval=$XENBALLOON_SELF_INTERVAL
+	# or do directed ballooning
+	elif [ $xenstore_enabled = "true" ]; then
+		if xenstore-exists memory/target ; then
+			tgtkb=`xenstore-read memory/target`
+			balloon_to_target $tgtkb
+		fi
+		interval=$XENBALLOON_INTERVAL
+	fi
+	send_memory_stats
+	if [ $xenstore_enabled = "true" ]; then
+		if xenstore-exists memory/interval ; then
+			interval=`xenstore-read memory/interval`
+		fi
+	fi
+	sleep $interval
+done &
+
diff -r 73a4fbdfe0c4 -r 0c5183e764d8 tools/xenballoon/xenballoond.README
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/xenballoon/xenballoond.README	Tue Jul 01 11:40:07 2008 +0100
@@ -0,0 +1,82 @@
+Xenballoond.README
+Preliminary version 0.1, 2008/06/30
+
+Copyright (C) 2008 Oracle Corporation and/or its affiliates.
+All rights reserved.
+Written by Dan Magenheimer <dan.magenheimer@oracle.com>
+
+INTRODUCTION
+
+Xenballoond runs in guest domains and both implements selfballooning and
+provides metrics to dom0 for (future) directed ballooning.  Both capabilities
+provide a foundation for basic "memory overcommit" functionality.
+
+With selfballooning enabled, xenballoond uses the Committed_AS value found
+in /proc/meminfo as a first approximation of how much memory is required
+by the guest and feeds this statistic back to the balloon driver to inflate
+or deflate the balloon as required to achieve the target guest memory size.
+Hysteresis parameters may be adjusted to rate-limit balloon inflation
+and deflation.
+
+If configured, certain selfballooning parameters -- including notably
+enabling/disabling of self-ballooning -- can be controlled from domain0.
+(These are fully documented in xenballoon.conf.)
+
+If configured, the following guest statistics are sent back to domain0:
+- /proc/meminfo
+- /proc/vmstat
+- /proc/uptime
+In a future release, some of these values will be used by a policy module
+in domain0 to control guest balloon size and provide memory balancing
+across all guests on a given system.
+
+Note that no page sharing (content-based or otherwise) is implemented
+and no VMM-based swapping is necessary.
+
+For more information, see:
+http://www.xen.org/files/xensummitboston08/MemoryOvercommit-XenSummit2008.pdf
+http://wiki.xensource.com/xenwiki/Open_Topics_For_Discussion?action=AttachFile&do=get&target=Memory+Overcommit.pdf
+
+INSTALLATION AND DEPLOYMENT
+
+In this preliminary release:
+- directed ballooning is not implemented, though a monitor is provided
+- only Redhat-based guests are supported
+
+Guest prerequisites to use xenballoond:
+- each guest must be configured with adequate[1] swap space
+- each guest must have the balloon driver installed (/proc/xen/balloon exists) 
+- if directed ballooning (or monitoring) is desired, xenstore tools must be
+  installed in each guest in /usr/bin [2]
+
+[1] for best results, for a guest that is configured with maxmem=N and
+    requires Z MB of swap space without xenballoond, available swap should
+    be increased to N+Z MB when xenballoond is running
+[2] specifically xenstore-read, xenstore-exists, and xenstore-write must
+    be installed.  Binaries can be obtained, for example, by building
+    xen-vvv.gz/tools in a guest-binary-compatible development tree
+
+Instructions to install/deploy xenballoond (in Redhat-based system):
+- in each guest:
+  - ensure pre-requisites are met (see above)
+  - place xenballoon.conf in /etc/sysconfig
+  - place xenballoond in /usr/sbin
+  - copy xenballoond.init to /etc/rc.d/init.d/xenballoond (note file rename)
+  - edit /etc/sysconfig/xenballoond.conf as desired (especially note that
+    selfballooning defaults as off)
+  - start xenballoond with "service xenballoond start", and/or configure
+    xenballoond to start at init (e.g. "chkconfig xenballoond on")
+- in domain0:
+  - if monitoring is desired, xenballoon-monitor may be installed in /usr/sbin
+- note that certain xenballoond.conf variables may be overridden by domain0
+  if xenstore is running in the guest; these are fully documented in
+  xenballoond.conf
+
+TODO:
+080630 modifications to support SUSE-based and debian-based guests
+080630 domain0 ballooning policy module
+080630 experiment with more aggressive (optionally) memory minimum targets
+080630 BUG: xenballoond doesn't properly record the fact that it's running;
+       e.g. flipping between run levels 5 and 3 launches additional daemons
+080630 BUG: reports of possible incompatibilites between ballooning and
+       save/restore/migrate have not been duplicated
diff -r 73a4fbdfe0c4 -r 0c5183e764d8 tools/xenballoon/xenballoond.init
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/xenballoon/xenballoond.init	Tue Jul 01 11:40:07 2008 +0100
@@ -0,0 +1,91 @@
+#!/bin/bash
+#
+# xenballoond	Script to start and stop Xen ballooning daemon.
+#
+# Copyright (C) 2008 Oracle Corporation and/or its affiliates.
+# All rights reserved.
+# Written by: Dan Magenheimer <dan.magenheimer@oracle.com>
+#
+# chkconfig: 2345 98 01
+# description: Starts and stops the Xen control daemon.
+### BEGIN INIT INFO
+# Provides:          xenballoond
+# Required-Start:    $syslog $remote_fs
+# Should-Start:
+# Required-Stop:     $syslog $remote_fs
+# Should-Stop:
+# Default-Start:     3 4 5
+# Default-Stop:      0 1 2 6
+# Default-Enabled:   yes
+# Short-Description: Start/stop xend
+# Description:       Starts and stops the Xen ballooning daemon.
+### END INIT INFO
+
+# Source function library
+. /etc/init.d/functions
+
+#don't use in domain0
+[ -f /proc/xen/capabilities ] && \
+	grep -q "control_d" /proc/xen/capabilities && exit 0
+
+if [ -f /etc/sysconfig/xenballoon.conf ]; then
+	. /etc/sysconfig/xenballoon.conf
+fi
+
+# Check that balloon driver is present
+[ ! -f /proc/xen/balloon ] && exit 0
+
+# Record original memory (in kB)
+[ -z "$XENBALLOON_MAXMEMFILE" ] && exit 0
+let maxmem=`grep MemTotal /proc/meminfo | sed 's/  */ /' | cut -f2 -d' '`
+if [ -f "$XENBALLOON_MAXMEMFILE" ]; then
+	let oldmax=`cat $XENBALLOON_MAXMEMFILE`
+	if [ $oldmax -gt $maxmem ]; then
+		let maxmem=oldmax
+	fi
+fi
+echo $maxmem > $XENBALLOON_MAXMEMFILE
+
+RETVAL=0
+prog="xenballoond"
+
+start() {
+        # Start daemons.
+        echo -n $"Starting $prog: "
+        daemon xenballoond $OPTIONS
+	RETVAL=$?
+        echo
+	return $RETVAL
+}
+
+stop() {
+        echo -n $"Shutting down $prog: "
+	killproc xenballoond
+	RETVAL=$?
+        echo
+	return $RETVAL
+}
+
+# See how we were called.
+case "$1" in
+  start)
+	start
+        ;;
+  stop)
+	stop
+        ;;
+  status)
+	status xenballoond
+	RETVAL=$?
+	;;
+  restart|reload)
+	stop
+	start
+	RETVAL=$?
+	;;
+  *)
+        echo $"Usage: $0 {start|stop|restart|status}"
+        exit 1
+esac
+
+exit $RETVAL

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

From xen-changelog-bounces@lists.xensource.com Tue Jul 01 08:50:18 2008
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Jul 2008 08:50:18 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1KDi7W-0006Nj-8b; Tue, 01 Jul 2008 08:50:18 -0700
Received: from spam.xensource.com ([70.42.241.90])
	by lists.xensource.com with esmtp (Exim 4.43) id 1KDi7C-0006AA-Rx
	for xen-changelog@lists.xensource.com; Tue, 01 Jul 2008 08:49:58 -0700
X-ASG-Debug-ID: 1214927392-3c2100050004-DBsQO9
X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi
Received: from SMTP.CITRIX.COM (localhost [127.0.0.1])
	by spam.xensource.com (Spam Firewall) with ESMTP id BDE7653393
	for <xen-changelog@lists.xensource.com>;
	Tue,  1 Jul 2008 08:49:56 -0700 (PDT)
Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by
	spam.xensource.com with ESMTP id Nc7pVmDHVpg7ZY46 for
	<xen-changelog@lists.xensource.com>;
	Tue, 01 Jul 2008 08:49:56 -0700 (PDT)
X-SBRS: None
X-MesageID: 785716
X-Ironport-Server: ftlpip01.citrite.net
X-Remote-IP: 70.42.241.98
X-Policy: $Relay
X-IronPort-AV: E=Sophos;i="4.27,732,1204520400"; 
   d="scan'208";a="785716"
Received: from relay.colo.xensource.com ([70.42.241.98])
	by SMTP.CITRIX.COM with ESMTP; 01 Jul 2008 11:49:55 -0400
Received: from xenbits.xensource.com (xenbits.colo.xensource.com
	[70.42.241.107])
	by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id
	m61FntAs022106
	for <xen-changelog@lists.xensource.com>; Tue, 1 Jul 2008 08:49:55 -0700
Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1])
	by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m61FoEPE003444
	for <xen-changelog@lists.xensource.com>; Tue, 1 Jul 2008 08:50:14 -0700
Received: (from xen@localhost)
	by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m61FoEJY003443
	for xen-changelog@lists.xensource.com; Tue, 1 Jul 2008 08:50:14 -0700
Message-Id: <200807011550.m61FoEJY003443@xenbits.xensource.com>
Date: Tue, 01 Jul 2008 08:50:14 -0700
From: Xen patchbot-unstable <patchbot-unstable@lists.xensource.com>
To: xen-changelog@lists.xensource.com
X-ASG-Orig-Subj: [xen-unstable] x86_emulate: (Almost) complete FPU emulation.
X-Barracuda-Connect: smtp.citrix.com[66.165.176.89]
X-Barracuda-Start-Time: 1214927396
X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com
X-Barracuda-Spam-Score: 1.55
X-Barracuda-Spam-Status: No, SCORE=1.55 using per-user scores of TAG_LEVEL=3.5
	QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M,
	BSF_RULE_7582B
X-Barracuda-Spam-Report: Code version 3.1, rules version 3.1.54872
	Rule breakdown below
	pts rule name              description
	---- ----------------------
	--------------------------------------------------
	0.50 BSF_RULE7568M          Custom Rule 7568M
	1.05 BSF_RULE_7582B         Custom Rule 7582B
Subject: [Xen-changelog] [xen-unstable] x86_emulate: (Almost) complete FPU
	emulation.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1214915261 -3600
# Node ID 6685c412698f43592c0f9fcc941ecb0b3a5e2012
# Parent  d4cf12d128eda92fc461571f2454e00ef7090e45
x86_emulate: (Almost) complete FPU emulation.

Provide emulation for all FPU instructions except fsave/frstore &
fnstenv/fldenv.

While the main purpose of the patch is to avoid current and future
"gotchas" on FPU intructions used by various OS boot-loaders, it is
complete enough to run DOS realmode FPU applications and benchmarks,
but don't expect to set any speed records.

Signed-off-by: Trolle Selander <trolle.selander@eu.citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c |  494 ++++++++++++++++++++++++++++++---
 1 files changed, 458 insertions(+), 36 deletions(-)

diff -r d4cf12d128ed -r 6685c412698f xen/arch/x86/x86_emulate/x86_emulate.c
--- a/xen/arch/x86/x86_emulate/x86_emulate.c	Tue Jul 01 11:41:43 2008 +0100
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c	Tue Jul 01 13:27:41 2008 +0100
@@ -142,12 +142,14 @@ static uint8_t opcode_table[256] = {
     ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
     ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
     /* 0xD0 - 0xD7 */
-    ByteOp|DstMem|SrcImplicit|ModRM, DstMem|SrcImplicit|ModRM, 
-    ByteOp|DstMem|SrcImplicit|ModRM, DstMem|SrcImplicit|ModRM, 
+    ByteOp|DstMem|SrcImplicit|ModRM, DstMem|SrcImplicit|ModRM,
+    ByteOp|DstMem|SrcImplicit|ModRM, DstMem|SrcImplicit|ModRM,
     ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
     /* 0xD8 - 0xDF */
-    0, ImplicitOps|ModRM|Mov, 0, ImplicitOps|ModRM|Mov,
-    0, ImplicitOps|ModRM|Mov, ImplicitOps|ModRM|Mov, ImplicitOps|ModRM|Mov,
+    ImplicitOps|ModRM|Mov, ImplicitOps|ModRM|Mov,
+    ImplicitOps|ModRM|Mov, ImplicitOps|ModRM|Mov,
+    ImplicitOps|ModRM|Mov, ImplicitOps|ModRM|Mov,
+    ImplicitOps|ModRM|Mov, ImplicitOps|ModRM|Mov,
     /* 0xE0 - 0xE7 */
     ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
     ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
@@ -216,7 +218,7 @@ static uint8_t twobyte_table[256] = {
     ByteOp|DstMem|SrcNone|ModRM|Mov, ByteOp|DstMem|SrcNone|ModRM|Mov,
     /* 0xA0 - 0xA7 */
     ImplicitOps, ImplicitOps, ImplicitOps, DstBitBase|SrcReg|ModRM,
-    DstMem|SrcReg|ModRM, DstMem|SrcReg|ModRM, 0, 0, 
+    DstMem|SrcReg|ModRM, DstMem|SrcReg|ModRM, 0, 0,
     /* 0xA8 - 0xAF */
     ImplicitOps, ImplicitOps, 0, DstBitBase|SrcReg|ModRM,
     DstMem|SrcReg|ModRM, DstMem|SrcReg|ModRM, 0, DstReg|SrcMem|ModRM,
@@ -246,8 +248,20 @@ static uint8_t twobyte_table[256] = {
 /* Type, address-of, and value of an instruction's operand. */
 struct operand {
     enum { OP_REG, OP_MEM, OP_IMM, OP_NONE } type;
-    unsigned int  bytes;
-    unsigned long val, orig_val;
+    unsigned int bytes;
+
+    /* Up to 128-byte operand value, addressable as ulong or uint32_t[]. */
+    union {
+        unsigned long val;
+        uint32_t bigval[4];
+    };
+
+    /* Up to 128-byte operand value, addressable as ulong or uint32_t[]. */
+    union {
+        unsigned long orig_val;
+        uint32_t orig_bigval[4];
+    };
+
     union {
         /* OP_REG: Pointer to register field. */
         unsigned long *reg;
@@ -594,6 +608,18 @@ do{ struct fpu_insn_ctxt fic;           
     put_fpu(&fic);                                      \
 } while (0)
 
+#define emulate_fpu_insn_memsrc(_op, _arg)              \
+do{ struct fpu_insn_ctxt fic;                           \
+    get_fpu(X86EMUL_FPU_fpu, &fic);                     \
+    asm volatile (                                      \
+        "movb $2f-1f,%0 \n"                             \
+        "1: " _op " %1  \n"                             \
+        "2:             \n"                             \
+        : "=m" (fic.insn_bytes)                         \
+        : "m" (_arg) : "memory" );                      \
+    put_fpu(&fic);                                      \
+} while (0)
+
 #define emulate_fpu_insn_stub(_bytes...)                                \
 do{ uint8_t stub[] = { _bytes, 0xc3 };                                  \
     struct fpu_insn_ctxt fic = { .insn_bytes = sizeof(stub)-1 };        \
@@ -1007,14 +1033,15 @@ protmode_load_seg(
             if ( (desc.b & (5u<<9)) == (4u<<9) )
                 goto raise_exn;
             /* Non-conforming segment: check DPL against RPL and CPL. */
-            if ( ((desc.b & (6u<<9)) != (6u<<9)) && ((dpl < cpl) || (dpl < rpl)) )
+            if ( ((desc.b & (6u<<9)) != (6u<<9)) &&
+                 ((dpl < cpl) || (dpl < rpl)) )
                 goto raise_exn;
             break;
         }
 
         /* Ensure Accessed flag is set. */
         new_desc_b = desc.b | 0x100;
-        rc = ((desc.b & 0x100) ? X86EMUL_OKAY : 
+        rc = ((desc.b & 0x100) ? X86EMUL_OKAY :
               ops->cmpxchg(
                   x86_seg_none, desctab.base + (sel & 0xfff8) + 4,
                   &desc.b, &new_desc_b, 4, ctxt));
@@ -1076,16 +1103,16 @@ decode_register(
     case  2: p = &regs->edx; break;
     case  3: p = &regs->ebx; break;
     case  4: p = (highbyte_regs ?
-                  ((unsigned char *)&regs->eax + 1) : 
+                  ((unsigned char *)&regs->eax + 1) :
                   (unsigned char *)&regs->esp); break;
     case  5: p = (highbyte_regs ?
-                  ((unsigned char *)&regs->ecx + 1) : 
+                  ((unsigned char *)&regs->ecx + 1) :
                   (unsigned char *)&regs->ebp); break;
     case  6: p = (highbyte_regs ?
-                  ((unsigned char *)&regs->edx + 1) : 
+                  ((unsigned char *)&regs->edx + 1) :
                   (unsigned char *)&regs->esi); break;
     case  7: p = (highbyte_regs ?
-                  ((unsigned char *)&regs->ebx + 1) : 
+                  ((unsigned char *)&regs->ebx + 1) :
                   (unsigned char *)&regs->edi); break;
 #if defined(__x86_64__)
     case  8: p = &regs->r8;  break;
@@ -2708,7 +2735,7 @@ x86_emulate(
         int offset = (b == 0xca) ? insn_fetch_type(uint16_t) : 0;
         op_bytes = mode_64bit() ? 8 : op_bytes;
         if ( (rc = read_ulong(x86_seg_ss, sp_post_inc(op_bytes),
-                              &dst.val, op_bytes, ctxt, ops)) || 
+                              &dst.val, op_bytes, ctxt, ops)) ||
              (rc = read_ulong(x86_seg_ss, sp_post_inc(op_bytes + offset),
                               &src.val, op_bytes, ctxt, ops)) ||
              (rc = load_seg(x86_seg_cs, (uint16_t)src.val, ctxt, ops)) )
@@ -2800,6 +2827,58 @@ x86_emulate(
         *(uint8_t *)&_regs.eax = al;
         break;
     }
+
+    case 0xd8: /* FPU 0xd8 */
+        switch ( modrm )
+        {
+        case 0xc0 ... 0xc7: /* fadd %stN,%stN */
+        case 0xc8 ... 0xcf: /* fmul %stN,%stN */
+        case 0xd0 ... 0xd7: /* fcom %stN,%stN */
+        case 0xd8 ... 0xdf: /* fcomp %stN,%stN */
+        case 0xe0 ... 0xe7: /* fsub %stN,%stN */
+        case 0xe8 ... 0xef: /* fsubr %stN,%stN */
+        case 0xf0 ... 0xf7: /* fdiv %stN,%stN */
+        case 0xf8 ... 0xff: /* fdivr %stN,%stN */
+            emulate_fpu_insn_stub(0xd8, modrm);
+            break;
+        default:
+            fail_if(modrm >= 0xc0);
+            ea.bytes = 4;
+            src = ea;
+            if ( (rc = ops->read(src.mem.seg, src.mem.off, &src.val,
+                                 src.bytes, ctxt)) != 0 )
+                goto done;
+            switch ( modrm_reg & 7 )
+            {
+            case 0: /* fadd */
+                emulate_fpu_insn_memsrc("fadds", src.val);
+                break;
+            case 1: /* fmul */
+                emulate_fpu_insn_memsrc("fmuls", src.val);
+                break;
+            case 2: /* fcom */
+                emulate_fpu_insn_memsrc("fcoms", src.val);
+                break;
+            case 3: /* fcomp */
+                emulate_fpu_insn_memsrc("fcomps", src.val);
+                break;
+            case 4: /* fsub */
+                emulate_fpu_insn_memsrc("fsubs", src.val);
+                break;
+            case 5: /* fsubr */
+                emulate_fpu_insn_memsrc("fsubrs", src.val);
+                break;
+            case 6: /* fdiv */
+                emulate_fpu_insn_memsrc("fdivs", src.val);
+                break;
+            case 7: /* fdivr */
+                emulate_fpu_insn_memsrc("fdivrs", src.val);
+                break;
+            default:
+                goto cannot_emulate;
+            }
+        }
+        break;
 
     case 0xd9: /* FPU 0xd9 */
         switch ( modrm )
@@ -2837,28 +2916,269 @@ x86_emulate(
             emulate_fpu_insn_stub(0xd9, modrm);
             break;
         default:
-            fail_if((modrm_reg & 7) != 7);
             fail_if(modrm >= 0xc0);
-            /* fnstcw m2byte */
-            ea.bytes = 2;
-            dst = ea;
-            emulate_fpu_insn_memdst("fnstcw", dst.val);
+            switch ( modrm_reg & 7 )
+            {
+            case 0: /* fld m32fp */
+                ea.bytes = 4;
+                src = ea;
+                if ( (rc = ops->read(ea.mem.seg, ea.mem.off, &src.val,
+                                     src.bytes, ctxt)) != 0 )
+                    goto done;
+                emulate_fpu_insn_memsrc("flds", src.val);
+                break;
+            case 2: /* fstp m32fp */
+                ea.bytes = 4;
+                dst = ea;
+                dst.type = OP_MEM;
+                emulate_fpu_insn_memdst("fsts", dst.val);
+                break;
+            case 3: /* fstp m32fp */
+                ea.bytes = 4;
+                dst = ea;
+                dst.type = OP_MEM;
+                emulate_fpu_insn_memdst("fstps", dst.val);
+                break;
+                /* case 4: fldenv - TODO */
+            case 5: /* fldcw m2byte */
+                ea.bytes = 2;
+                src = ea;
+                if ( (rc = ops->read(src.mem.seg, src.mem.off, &src.val,
+                                     src.bytes, ctxt)) != 0 )
+                    goto done;
+                emulate_fpu_insn_memsrc("fldcw", src.val);
+                break;
+                /* case 6: fstenv - TODO */
+            case 7: /* fnstcw m2byte */
+                ea.bytes = 2;
+                dst = ea;
+                dst.type = OP_MEM;
+                emulate_fpu_insn_memdst("fnstcw", dst.val);
+                break;
+            default:
+                goto cannot_emulate;
+            }
+        }
+        break;
+
+    case 0xda: /* FPU 0xda */
+        switch ( modrm )
+        {
+        case 0xc0 ... 0xc7: /* fcmovb %stN */
+        case 0xc8 ... 0xcf: /* fcmove %stN */
+        case 0xd0 ... 0xd7: /* fcmovbe %stN */
+        case 0xd8 ... 0xdf: /* fcmovu %stN */
+        case 0xe9:          /* fucompp */
+            emulate_fpu_insn_stub(0xda, modrm);
+            break;
+        default:
+            fail_if(modrm >= 0xc0);
+            ea.bytes = 8;
+            src = ea;
+            if ( (rc = ops->read(src.mem.seg, src.mem.off, &src.val,
+                                 src.bytes, ctxt)) != 0 )
+                goto done;
+            switch ( modrm_reg & 7 )
+            {
+            case 0: /* fiadd m64i */
+                emulate_fpu_insn_memsrc("fiaddl", src.val);
+                break;
+            case 1: /* fimul m64i */
+                emulate_fpu_insn_memsrc("fimul", src.val);
+                break;
+            case 2: /* ficom m64i */
+                emulate_fpu_insn_memsrc("ficoml", src.val);
+                break;
+            case 3: /* ficomp m64i */
+                emulate_fpu_insn_memsrc("ficompl", src.val);
+                break;
+            case 4: /* fisub m64i */
+                emulate_fpu_insn_memsrc("fisubl", src.val);
+                break;
+            case 5: /* fisubr m64i */
+                emulate_fpu_insn_memsrc("fisubrl", src.val);
+                break;
+            case 6: /* fidiv m64i */
+                emulate_fpu_insn_memsrc("fidivl", src.val);
+                break;
+            case 7: /* fidivr m64i */
+                emulate_fpu_insn_memsrc("fidivrl", src.val);
+                break;
+            default:
+                goto cannot_emulate;
+            }
         }
         break;
 
     case 0xdb: /* FPU 0xdb */
-        fail_if(modrm != 0xe3);
-        /* fninit */
-        emulate_fpu_insn("fninit");
+        switch ( modrm )
+        {
+        case 0xc0 ... 0xc7: /* fcmovnb %stN */
+        case 0xc8 ... 0xcf: /* fcmovne %stN */
+        case 0xd0 ... 0xd7: /* fcmovnbe %stN */
+        case 0xd8 ... 0xdf: /* fcmovnu %stN */
+            emulate_fpu_insn_stub(0xdb, modrm);
+            break;
+        case 0xe2: /* fnclex */
+            emulate_fpu_insn("fnclex");
+            break;
+        case 0xe3: /* fninit */
+            emulate_fpu_insn("fninit");
+            break;
+        case 0xe4: /* fsetpm - 287 only, ignored by 387 */
+            break;
+        case 0xe8 ... 0xef: /* fucomi %stN */
+        case 0xf0 ... 0xf7: /* fcomi %stN */
+            emulate_fpu_insn_stub(0xdb, modrm);
+            break;
+        default:
+            fail_if(modrm >= 0xc0);
+            switch ( modrm_reg & 7 )
+            {
+            case 0: /* fild m32i */
+                ea.bytes = 4;
+                src = ea;
+                if ( (rc = ops->read(src.mem.seg, src.mem.off, &src.val,
+                                     src.bytes, ctxt)) != 0 )
+                    goto done;
+                emulate_fpu_insn_memsrc("fildl", src.val);
+                break;
+            case 1: /* fisttp m32i */
+                ea.bytes = 4;
+                dst = ea;
+                dst.type = OP_MEM;
+                emulate_fpu_insn_memdst("fisttpl", dst.val);
+                break;
+            case 2: /* fist m32i */
+                ea.bytes = 4;
+                dst = ea;
+                dst.type = OP_MEM;
+                emulate_fpu_insn_memdst("fistl", dst.val);
+                break;
+            case 3: /* fistp m32i */
+                ea.bytes = 4;
+                dst = ea;
+                dst.type = OP_MEM;
+                emulate_fpu_insn_memdst("fistpl", dst.val);
+                break;
+            case 5: /* fld m80fp */
+                ea.bytes = 10;
+                src = ea;
+                if ( (rc = ops->read(src.mem.seg, src.mem.off,
+                                     &src.val, src.bytes, ctxt)) != 0 )
+                    goto done;
+                emulate_fpu_insn_memdst("fldt", src.val);
+                break;
+            case 7: /* fstp m80fp */
+                ea.bytes = 10;
+                dst.type = OP_MEM;
+                dst = ea;
+                emulate_fpu_insn_memdst("fstpt", dst.val);
+                break;
+            default:
+                goto cannot_emulate;
+            }
+        }
+        break;
+
+    case 0xdc: /* FPU 0xdc */
+        switch ( modrm )
+        {
+        case 0xc0 ... 0xc7: /* fadd %stN */
+        case 0xc8 ... 0xcf: /* fmul %stN */
+        case 0xe0 ... 0xe7: /* fsubr %stN */
+        case 0xe8 ... 0xef: /* fsub %stN */
+        case 0xf0 ... 0xf7: /* fdivr %stN */
+        case 0xf8 ... 0xff: /* fdiv %stN */
+            emulate_fpu_insn_stub(0xdc, modrm);
+            break;
+        default:
+            fail_if(modrm >= 0xc0);
+            ea.bytes = 8;
+            src = ea;
+            if ( (rc = ops->read(src.mem.seg, src.mem.off, &src.val,
+                                 src.bytes, ctxt)) != 0 )
+                goto done;
+            switch ( modrm_reg & 7 )
+            {
+            case 0: /* fadd m64fp */
+                emulate_fpu_insn_memsrc("faddl", src.val);
+                break;
+            case 1: /* fmul m64fp */
+                emulate_fpu_insn_memsrc("fmull", src.val);
+                break;
+            case 2: /* fcom m64fp */
+                emulate_fpu_insn_memsrc("fcoml", src.val);
+                break;
+            case 3: /* fcomp m64fp */
+                emulate_fpu_insn_memsrc("fcompl", src.val);
+                break;
+            case 4: /* fsub m64fp */
+                emulate_fpu_insn_memsrc("fsubl", src.val);
+                break;
+            case 5: /* fsubr m64fp */
+                emulate_fpu_insn_memsrc("fsubrl", src.val);
+                break;
+            case 6: /* fdiv m64fp */
+                emulate_fpu_insn_memsrc("fdivl", src.val);
+                break;
+            case 7: /* fdivr m64fp */
+                emulate_fpu_insn_memsrc("fdivrl", src.val);
+                break;
+            }
+        }
         break;
 
     case 0xdd: /* FPU 0xdd */
-        fail_if((modrm_reg & 7) != 7);
-        fail_if(modrm >= 0xc0);
-        /* fnstsw m2byte */
-        ea.bytes = 2;
-        dst = ea;
-        emulate_fpu_insn_memdst("fnstsw", dst.val);
+        switch ( modrm )
+        {
+        case 0xc0 ... 0xc7: /* ffree %stN */
+        case 0xd0 ... 0xd7: /* fst %stN */
+        case 0xd8 ... 0xdf: /* fstp %stN */
+        case 0xe0 ... 0xe7: /* fucom %stN */
+        case 0xe8 ... 0xef: /* fucomp %stN */
+            emulate_fpu_insn_stub(0xdd, modrm);
+            break;
+        default:
+            fail_if(modrm >= 0xc0);
+            switch ( modrm_reg & 7 )
+            {
+            case 0: /* fld m64fp */;
+                ea.bytes = 8;
+                src = ea;
+                if ( (rc = ops->read(src.mem.seg, src.mem.off, &src.val,
+                                     src.bytes, ctxt)) != 0 )
+                    goto done;
+                emulate_fpu_insn_memsrc("fldl", src.val);
+                break;
+            case 1: /* fisttp m64i */
+                ea.bytes = 8;
+                dst = ea;
+                dst.type = OP_MEM;
+                emulate_fpu_insn_memdst("fisttpll", dst.val);
+                break;
+            case 2: /* fst m64fp */
+                ea.bytes = 8;
+                dst = ea;
+                dst.type = OP_MEM;
+                emulate_fpu_insn_memsrc("fstl", dst.val);
+                break;
+            case 3: /* fstp m64fp */
+                ea.bytes = 8;
+                dst = ea;
+                dst.type = OP_MEM;
+                emulate_fpu_insn_memdst("fstpl", dst.val);
+                break;
+            case 7: /* fnstsw m2byte */
+                ea.bytes = 2;
+                dst = ea;
+                dst.type = OP_MEM;
+                emulate_fpu_insn_memdst("fnstsw", dst.val);
+                break;
+            default:
+                goto cannot_emulate;
+            }
+        }
         break;
 
     case 0xde: /* FPU 0xde */
@@ -2874,17 +3194,120 @@ x86_emulate(
             emulate_fpu_insn_stub(0xde, modrm);
             break;
         default:
-            goto cannot_emulate;
+            fail_if(modrm >= 0xc0);
+            ea.bytes = 2;
+            src = ea;
+            if ( (rc = ops->read(src.mem.seg, src.mem.off, &src.val,
+                                 src.bytes, ctxt)) != 0 )
+                goto done;
+            switch ( modrm_reg & 7 )
+            {
+            case 0: /* fiadd m16i */
+                emulate_fpu_insn_memsrc("fiadd", src.val);
+                break;
+            case 1: /* fimul m16i */
+                emulate_fpu_insn_memsrc("fimul", src.val);
+                break;
+            case 2: /* ficom m16i */
+                emulate_fpu_insn_memsrc("ficom", src.val);
+                break;
+            case 3: /* ficomp m16i */
+                emulate_fpu_insn_memsrc("ficomp", src.val);
+                break;
+            case 4: /* fisub m16i */
+                emulate_fpu_insn_memsrc("fisub", src.val);
+                break;
+            case 5: /* fisubr m16i */
+                emulate_fpu_insn_memsrc("fisubr", src.val);
+                break;
+            case 6: /* fidiv m16i */
+                emulate_fpu_insn_memsrc("fidiv", src.val);
+                break;
+            case 7: /* fidivr m16i */
+                emulate_fpu_insn_memsrc("fidivr", src.val);
+                break;
+            default:
+                goto cannot_emulate;
+            }
         }
         break;
 
     case 0xdf: /* FPU 0xdf */
-        fail_if(modrm != 0xe0);
-        /* fnstsw %ax */
-        dst.bytes = 2;
-        dst.type = OP_REG;
-        dst.reg = (unsigned long *)&_regs.eax;
-        emulate_fpu_insn_memdst("fnstsw", dst.val);
+        switch ( modrm )
+        {
+        case 0xe0:
+            /* fnstsw %ax */
+            dst.bytes = 2;
+            dst.type = OP_REG;
+            dst.reg = (unsigned long *)&_regs.eax;
+            emulate_fpu_insn_memdst("fnstsw", dst.val);
+            break;
+        case 0xf0 ... 0xf7: /* fcomip %stN */
+        case 0xf8 ... 0xff: /* fucomip %stN */
+            emulate_fpu_insn_stub(0xdf, modrm);
+            break;
+        default:
+            fail_if(modrm >= 0xc0);
+            switch ( modrm_reg & 7 )
+            {
+            case 0: /* fild m16i */
+                ea.bytes = 2;
+                src = ea;
+                if ( (rc = ops->read(src.mem.seg, src.mem.off, &src.val,
+                                     src.bytes, ctxt)) != 0 )
+                    goto done;
+                emulate_fpu_insn_memsrc("fild", src.val);
+                break;
+            case 1: /* fisttp m16i */
+                ea.bytes = 2;
+                dst = ea;
+                dst.type = OP_MEM;
+                emulate_fpu_insn_memdst("fisttp", dst.val);
+                break;
+            case 2: /* fist m16i */
+                ea.bytes = 2;
+                dst = ea;
+                dst.type = OP_MEM;
+                emulate_fpu_insn_memdst("fist", dst.val);
+                break;
+            case 3: /* fistp m16i */
+                ea.bytes = 2;
+                dst = ea;
+                dst.type = OP_MEM;
+                emulate_fpu_insn_memdst("fistp", dst.val);
+                break;
+            case 4: /* fbld m80dec */
+                ea.bytes = 10;
+                dst = ea;
+                if ( (rc = ops->read(src.mem.seg, src.mem.off,
+                                     &src.val, src.bytes, ctxt)) != 0 )
+                    goto done;
+                emulate_fpu_insn_memdst("fbld", src.val);
+                break;
+            case 5: /* fild m64i */
+                ea.bytes = 8;
+                src = ea;
+                if ( (rc = ops->read(src.mem.seg, src.mem.off, &src.val,
+                                     src.bytes, ctxt)) != 0 )
+                    goto done;
+                emulate_fpu_insn_memsrc("fildll", src.val);
+                break;
+            case 6: /* fbstp packed bcd */
+                ea.bytes = 10;
+                dst = ea;
+                dst.type = OP_MEM;
+                emulate_fpu_insn_memdst("fbstp", dst.val);
+                break;
+            case 7: /* fistp m64i */
+                ea.bytes = 8;
+                dst = ea;
+                dst.type = OP_MEM;
+                emulate_fpu_insn_memdst("fistpll", dst.val);
+                break;
+            default:
+                goto cannot_emulate;
+            }
+        }
         break;
 
     case 0xe0 ... 0xe2: /* loop{,z,nz} */ {
@@ -2939,7 +3362,6 @@ x86_emulate(
             /* out */
             fail_if(ops->write_io == NULL);
             rc = ops->write_io(port, op_bytes, _regs.eax, ctxt);
-            
         }
         else
         {

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

From xen-changelog-bounces@lists.xensource.com Tue Jul 01 13:00:05 2008
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Jul 2008 13:00:05 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1KDm1F-0006iY-PL; Tue, 01 Jul 2008 13:00:05 -0700
Received: from spam.xensource.com ([70.42.241.90])
	by lists.xensource.com with esmtp (Exim 4.43) id 1KDm1D-0006i5-31
	for xen-changelog@lists.xensource.com; Tue, 01 Jul 2008 13:00:03 -0700
X-ASG-Debug-ID: 1214942399-5dd000010000-DBsQO9
X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi
Received: from SMTP.CITRIX.COM (localhost [127.0.0.1])
	by spam.xensource.com (Spam Firewall) with ESMTP id 16A8D535BE
	for <xen-changelog@lists.xensource.com>;
	Tue,  1 Jul 2008 12:59:59 -0700 (PDT)
Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by
	spam.xensource.com with ESMTP id AjpCvLJkDxNDcHVV for
	<xen-changelog@lists.xensource.com>;
	Tue, 01 Jul 2008 12:59:59 -0700 (PDT)
X-SBRS: None
X-MesageID: 789300
X-Ironport-Server: ftlpip01.citrite.net
X-Remote-IP: 70.42.241.98
X-Policy: $Relay
X-IronPort-AV: E=Sophos;i="4.27,732,1204520400"; 
   d="scan'208";a="789300"
Received: from relay.colo.xensource.com ([70.42.241.98])
	by SMTP.CITRIX.COM with ESMTP; 01 Jul 2008 15:59:58 -0400
Received: from xenbits.xensource.com (xenbits.colo.xensource.com
	[70.42.241.107])
	by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id
	m61JxwaQ022806
	for <xen-changelog@lists.xensource.com>; Tue, 1 Jul 2008 12:59:58 -0700
Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1])
	by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m61K0HbZ016946
	for <xen-changelog@lists.xensource.com>; Tue, 1 Jul 2008 13:00:17 -0700
Received: (from xen@localhost)
	by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m61K0Hl7016945
	for xen-changelog@lists.xensource.com; Tue, 1 Jul 2008 13:00:17 -0700
Message-Id: <200807012000.m61K0Hl7016945@xenbits.xensource.com>
Date: Tue, 01 Jul 2008 13:00:15 -0700
From: Xen patchbot-unstable <patchbot-unstable@lists.xensource.com>
To: xen-changelog@lists.xensource.com
X-ASG-Orig-Subj: [xen-unstable] minios: proper frees are now handled,
	so drop the FIXME comment
X-Barracuda-Connect: smtp.citrix.com[66.165.176.89]
X-Barracuda-Start-Time: 1214942400
X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com
X-Barracuda-Spam-Score: 0.50
X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5
	QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M
X-Barracuda-Spam-Report: Code version 3.1, rules version 3.1.54887
	Rule breakdown below
	pts rule name              description
	---- ----------------------
	--------------------------------------------------
	0.50 BSF_RULE7568M          Custom Rule 7568M
Subject: [Xen-changelog] 
	[xen-unstable] minios: proper frees are now handled,
	so drop the FIXME comment
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1214920235 -3600
# Node ID 19970181d6a46aee1199857b6d3c6bedc7507121
# Parent  6685c412698f43592c0f9fcc941ecb0b3a5e2012
minios: proper frees are now handled, so drop the FIXME comment

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
---
 extras/mini-os/blkfront.c |    1 -
 extras/mini-os/fbfront.c  |    2 --
 2 files changed, 3 deletions(-)

diff -r 6685c412698f -r 19970181d6a4 extras/mini-os/blkfront.c
--- a/extras/mini-os/blkfront.c	Tue Jul 01 13:27:41 2008 +0100
+++ b/extras/mini-os/blkfront.c	Tue Jul 01 14:50:35 2008 +0100
@@ -125,7 +125,6 @@ struct blkfront_dev *init_blkfront(char 
 
     dev->events = NULL;
 
-    // FIXME: proper frees on failures
 again:
     err = xenbus_transaction_start(&xbt);
     if (err) {
diff -r 6685c412698f -r 19970181d6a4 extras/mini-os/fbfront.c
--- a/extras/mini-os/fbfront.c	Tue Jul 01 13:27:41 2008 +0100
+++ b/extras/mini-os/fbfront.c	Tue Jul 01 14:50:35 2008 +0100
@@ -100,7 +100,6 @@ struct kbdfront_dev *init_kbdfront(char 
     s->in_cons = s->in_prod = 0;
     s->out_cons = s->out_prod = 0;
 
-    // FIXME: proper frees on failures
 again:
     err = xenbus_transaction_start(&xbt);
     if (err) {
@@ -408,7 +407,6 @@ struct fbfront_dev *init_fbfront(char *n
         s->pd[i] = 0;
 
 
-    // FIXME: proper frees on failures
 again:
     err = xenbus_transaction_start(&xbt);
     if (err) {

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

From xen-changelog-bounces@lists.xensource.com Wed Jul 02 05:39:55 2008
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 02 Jul 2008 05:39:55 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1KE1cp-00019h-Er; Wed, 02 Jul 2008 05:39:55 -0700
Received: from spam.xensource.com ([70.42.241.90])
	by lists.xensource.com with esmtp (Exim 4.43) id 1KE1cm-000193-So
	for xen-changelog@lists.xensource.com; Wed, 02 Jul 2008 05:39:52 -0700
X-ASG-Debug-ID: 1215002391-5bc800100000-DBsQO9
X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi
Received: from SMTP.CITRIX.COM (localhost [127.0.0.1])
	by spam.xensource.com (Spam Firewall) with ESMTP id 48F4354596
	for <xen-changelog@lists.xensource.com>;
	Wed,  2 Jul 2008 05:39:52 -0700 (PDT)
Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by
	spam.xensource.com with ESMTP id mGFwWnBSV9ryVxoR for
	<xen-changelog@lists.xensource.com>;
	Wed, 02 Jul 2008 05:39:52 -0700 (PDT)
X-SBRS: None
X-MesageID: 801458
X-Ironport-Server: ftlpip01.citrite.net
X-Remote-IP: 70.42.241.98
X-Policy: $Relay
X-IronPort-AV: E=Sophos;i="4.27,737,1204520400"; 
   d="scan'208";a="801458"
Received: from relay.colo.xensource.com ([70.42.241.98])
	by SMTP.CITRIX.COM with ESMTP; 02 Jul 2008 08:39:51 -0400
Received: from xenbits.xensource.com (xenbits.colo.xensource.com
	[70.42.241.107])
	by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id
	m62CdoSx024752
	for <xen-changelog@lists.xensource.com>; Wed, 2 Jul 2008 05:39:50 -0700
Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1])
	by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m62CeAaV007874
	for <xen-changelog@lists.xensource.com>; Wed, 2 Jul 2008 05:40:10 -0700
Received: (from xen@localhost)
	by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m62CeAVL007873
	for xen-changelog@lists.xensource.com; Wed, 2 Jul 2008 05:40:10 -0700
Message-Id: <200807021240.m62CeAVL007873@xenbits.xensource.com>
Date: Wed, 02 Jul 2008 05:40:09 -0700
From: Xen patchbot-unstable <patchbot-unstable@lists.xensource.com>
To: xen-changelog@lists.xensource.com
X-ASG-Orig-Subj: [xen-unstable] minios/ia64: fix
	EFI_RUNTIME_SERVICES_SIGNATURE value
X-Barracuda-Connect: smtp.citrix.com[66.165.176.89]
X-Barracuda-Start-Time: 1215002392
X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com
X-Barracuda-Spam-Score: 0.50
X-Barracuda-Spam-Status: No, SCORE=0.50 using per-user scores of TAG_LEVEL=3.5
	QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=BSF_RULE7568M
X-Barracuda-Spam-Report: Code version 3.1, rules version 3.1.54951
	Rule breakdown below
	pts rule name              description
	---- ----------------------
	--------------------------------------------------
	0.50 BSF_RULE7568M          Custom Rule 7568M
Subject: [Xen-changelog] [xen-unstable] minios/ia64: fix
	EFI_RUNTIME_SERVICES_SIGNATURE value
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Isaku Yamahata <yamahata@valinux.co.jp>
# Date 1213077507 -32400
# Node ID 8f2979e64af5ff3a333db678fa4fe4393b21273e
# Parent  f1508348ffabedf2eab0b666a5b8e2c9515e52d7
minios/ia64: fix EFI_RUNTIME_SERVICES_SIGNATURE value

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
---
 extras/mini-os/include/ia64/efi.h |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -r f1508348ffab -r 8f2979e64af5 extras/mini-os/include/ia64/efi.h
--- a/extras/mini-os/include/ia64/efi.h	Mon Jun 02 11:35:39 2008 +0900
+++ b/extras/mini-os/include/ia64/efi.h	Tue Jun 10 14:58:27 2008 +0900
@@ -323,7 +323,7 @@ typedef efi_status_t (*efi_get_next_high
  * EFI Runtime Serivces Table
  */
 
-#define EFI_RUNTIME_SERVICES_SIGNATURE  0x56524553544e5552
+#define EFI_RUNTIME_SERVICES_SIGNATURE  0x5652453544e5552ULL
 #define EFI_RUNTIME_SERVICES_REVISION ((EFI_SPECIFICATION_MAJOR_REVISION<<16) \
 					| (EFI_SPECIFICATION_MINOR_REVISION))
 

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

From xen-changelog-bounces@lists.xensource.com Wed Jul 02 05:40:00 2008
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 02 Jul 2008 05:40:00 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1KE1cu-0001DG-No; Wed, 02 Jul 2008 05:40:00 -0700
Received: from spam.xensource.com ([70.42.241.90])
	by lists.xensource.com with esmtp (Exim 4.43) id 1KE1cn-00019A-Ee
	for xen-changelog@lists.xensource.com; Wed, 02 Jul 2008 05:39:53 -0700
X-ASG-Debug-ID: 1215002391-5bc800100001-DBsQO9
X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi
Received: from SMTP.CITRIX.COM (localhost [127.0.0.1])
	by spam.xensource.com (Spam Firewall) with ESMTP id CA83F545B2
	for <xen-changelog@lists.xensource.com>;
	Wed,  2 Jul 2008 05:39:52 -0700 (PDT)
Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by
	spam.xensource.com with ESMTP id rEDJVnJsR1ACtp4B for
	<xen-changelog@lists.xensource.com>;
	Wed, 02 Jul 2008 05:39:52 -0700 (PDT)
X-SBRS: None
X-MesageID: 801459
X-Ironport-Server: ftlpip01.citrite.net
X-Remote-IP: 70.42.241.98
X-Policy: $Relay
X-IronPort-AV: E=Sophos;i="4.27,737,1204520400"; 
   d="scan'208";a="801459"
Received: from relay.colo.xensource.com ([70.42.241.98])
	by SMTP.CITRIX.COM with ESMTP; 02 Jul 2008 08:39:52 -0400
Received: from xenbits.xensource.com (xenbits.colo.xensource.com
	[70.42.241.107])
	by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id
	m62Cdpau024755
	for <xen-changelog@lists.xensource.com>; Wed, 2 Jul 2008 05:39:51 -0700
Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1])
	by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m62CeBtb007891
	for <xen-changelog@lists.xensource.com>; Wed, 2 Jul 2008 05:40:11 -0700
Received: (from xen@localhost)
	by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m62CeBDX007890
	for xen-changelog@lists.xensource.com; Wed, 2 Jul 2008 05:40:11 -0700
Message-Id: <200807021240.m62CeBDX007890@xenbits.xensource.com>
Date: Wed, 02 Jul 2008 05:40:10 -0700
From: Xen patchbot-unstable <patchbot-unstable@lists.xensource.com>
To: xen-changelog@lists.xensource.com
X-ASG-Orig-Subj: [xen-unstable] [IA64] fix ia64_leave_kernel.
X-Barracuda-Connect: smtp.citrix.com[66.165.176.89]
X-Barracuda-Start-Time: 1215002392
X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com
X-Barracuda-Spam-Score: 0.00
X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5
	QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=
X-Barracuda-Spam-Report: Code version 3.1, rules version 3.1.54951
	Rule breakdown below
	pts rule name              description
	---- ----------------------
	--------------------------------------------------
Subject: [Xen-changelog] [xen-unstable] [IA64] fix ia64_leave_kernel.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Isaku Yamahata <yamahata@valinux.co.jp>
# Date 1213077631 -32400
# Node ID b844f87db11debd27bf464bf6aff7cc42456d486
# Parent  8f2979e64af5ff3a333db678fa4fe4393b21273e
[IA64] fix ia64_leave_kernel.

This patch is for safe leaving hypervisor.
After calling do_softirq in ia64_leave_kernel, interrupts must be masked.

Signed-off-by: Akio Takebe <takebe_akio@jp.fujitsu.com>
---
 xen/arch/ia64/linux-xen/entry.S |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -r 8f2979e64af5 -r b844f87db11d xen/arch/ia64/linux-xen/entry.S
--- a/xen/arch/ia64/linux-xen/entry.S	Tue Jun 10 14:58:27 2008 +0900
+++ b/xen/arch/ia64/linux-xen/entry.S	Tue Jun 10 15:00:31 2008 +0900
@@ -933,7 +933,7 @@ GLOBAL_ENTRY(ia64_leave_kernel)
 	;;
 (pUStk)	ssm psr.i
 (pUStk)	br.call.sptk.many b0=do_softirq
-(pUStk)	ssm psr.i
+(pUStk)	rsm psr.i
 	;;
 (pUStk)	br.call.sptk.many b0=reflect_event
 	;;

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

From xen-changelog-bounces@lists.xensource.com Wed Jul 02 05:40:06 2008
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 02 Jul 2008 05:40:06 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1KE1cz-0001HM-UB; Wed, 02 Jul 2008 05:40:06 -0700
Received: from spam.xensource.com ([70.42.241.90])
	by lists.xensource.com with esmtp (Exim 4.43) id 1KE1co-00019L-AU
	for xen-changelog@lists.xensource.com; Wed, 02 Jul 2008 05:39:54 -0700
X-ASG-Debug-ID: 1215002391-5bc800100002-DBsQO9
X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi
Received: from SMTP.CITRIX.COM (localhost [127.0.0.1])
	by spam.xensource.com (Spam Firewall) with ESMTP id B7D08545ED
	for <xen-changelog@lists.xensource.com>;
	Wed,  2 Jul 2008 05:39:53 -0700 (PDT)
Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by
	spam.xensource.com with ESMTP id kyFoSMTjWK6QNk9D for
	<xen-changelog@lists.xensource.com>;
	Wed, 02 Jul 2008 05:39:53 -0700 (PDT)
X-SBRS: None
X-MesageID: 801460
X-Ironport-Server: ftlpip01.citrite.net
X-Remote-IP: 70.42.241.98
X-Policy: $Relay
X-IronPort-AV: E=Sophos;i="4.27,737,1204520400"; 
   d="scan'208";a="801460"
Received: from relay.colo.xensource.com ([70.42.241.98])
	by SMTP.CITRIX.COM with ESMTP; 02 Jul 2008 08:39:52 -0400
Received: from xenbits.xensource.com (xenbits.colo.xensource.com
	[70.42.241.107])
	by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id
	m62CdqsF024758
	for <xen-changelog@lists.xensource.com>; Wed, 2 Jul 2008 05:39:52 -0700
Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1])
	by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m62CeCRn007908
	for <xen-changelog@lists.xensource.com>; Wed, 2 Jul 2008 05:40:12 -0700
Received: (from xen@localhost)
	by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m62CeCPJ007907
	for xen-changelog@lists.xensource.com; Wed, 2 Jul 2008 05:40:12 -0700
Message-Id: <200807021240.m62CeCPJ007907@xenbits.xensource.com>
Date: Wed, 02 Jul 2008 05:40:11 -0700
From: Xen patchbot-unstable <patchbot-unstable@lists.xensource.com>
To: xen-changelog@lists.xensource.com
X-ASG-Orig-Subj: [xen-unstable] [IA64] hypervisor needs to turn off psr.i
	after PAL_HALT_LIGHT
X-Barracuda-Connect: smtp.citrix.com[66.165.176.89]
X-Barracuda-Start-Time: 1215002393
X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com
X-Barracuda-Spam-Score: 0.00
X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5
	QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=
X-Barracuda-Spam-Report: Code version 3.1, rules version 3.1.54951
	Rule breakdown below
	pts rule name              description
	---- ----------------------
	--------------------------------------------------
Subject: [Xen-changelog] [xen-unstable] [IA64] hypervisor needs to turn off
	psr.i after PAL_HALT_LIGHT
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Isaku Yamahata <yamahata@valinux.co.jp>
# Date 1213078086 -32400
# Node ID 1feb98eb64eff4c97bf185047790f80e67501b3d
# Parent  b844f87db11debd27bf464bf6aff7cc42456d486
[IA64] hypervisor needs to turn off psr.i after PAL_HALT_LIGHT

psr.i must be set to 0 on PAL entry and must be unchanged on PAL exit.
But do_block() turns on psr.i.
So we need to set it off at exit of PAL_HALT_LIGHT.

Signed-off-by: Akio Takebe <takebe_akio@jp.fujitsu.com>
---
 xen/arch/ia64/xen/hypercall.c |    8 ++++++++
 1 files changed, 8 insertions(+)

diff -r b844f87db11d -r 1feb98eb64ef xen/arch/ia64/xen/hypercall.c
--- a/xen/arch/ia64/xen/hypercall.c	Tue Jun 10 15:00:31 2008 +0900
+++ b/xen/arch/ia64/xen/hypercall.c	Tue Jun 10 15:08:06 2008 +0900
@@ -173,6 +173,14 @@ ia64_hypercall(struct pt_regs *regs)
 				/* do_block only pends a softirq */
 				do_softirq();
 				stop_timer(&v->arch.hlt_timer);
+				/* do_block() calls
+				 * local_event_delivery_enable(),
+				 * but PALL CALL must be called with
+				 * psr.i = 0 and psr.i is unchanged.
+				 * SDM vol.2 Part I 11.10.2
+				 * PAL Calling Conventions.
+				 */
+				local_event_delivery_disable();
 			}
 			regs->r8 = 0;
 			regs->r9 = 0;

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

From xen-changelog-bounces@lists.xensource.com Wed Jul 02 05:40:11 2008
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 02 Jul 2008 05:40:11 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1KE1d5-0001L1-AV; Wed, 02 Jul 2008 05:40:11 -0700
Received: from spam.xensource.com ([70.42.241.90])
	by lists.xensource.com with esmtp (Exim 4.43) id 1KE1cp-00019y-CA
	for xen-changelog@lists.xensource.com; Wed, 02 Jul 2008 05:39:55 -0700
X-ASG-Debug-ID: 1215002391-5bc800100003-DBsQO9
X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi
Received: from SMTP.CITRIX.COM (localhost [127.0.0.1])
	by spam.xensource.com (Spam Firewall) with ESMTP id A4744545F6
	for <xen-changelog@lists.xensource.com>;
	Wed,  2 Jul 2008 05:39:54 -0700 (PDT)
Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by
	spam.xensource.com with ESMTP id 3wKB0SawiDphHFIo for
	<xen-changelog@lists.xensource.com>;
	Wed, 02 Jul 2008 05:39:54 -0700 (PDT)
X-SBRS: None
X-MesageID: 801461
X-Ironport-Server: ftlpip01.citrite.net
X-Remote-IP: 70.42.241.98
X-Policy: $Relay
X-IronPort-AV: E=Sophos;i="4.27,737,1204520400"; 
   d="scan'208";a="801461"
Received: from relay.colo.xensource.com ([70.42.241.98])
	by SMTP.CITRIX.COM with ESMTP; 02 Jul 2008 08:39:53 -0400
Received: from xenbits.xensource.com (xenbits.colo.xensource.com
	[70.42.241.107])
	by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id
	m62Cdrmr024761
	for <xen-changelog@lists.xensource.com>; Wed, 2 Jul 2008 05:39:53 -0700
Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1])
	by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m62CeDxi007925
	for <xen-changelog@lists.xensource.com>; Wed, 2 Jul 2008 05:40:13 -0700
Received: (from xen@localhost)
	by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m62CeDOC007924
	for xen-changelog@lists.xensource.com; Wed, 2 Jul 2008 05:40:13 -0700
Message-Id: <200807021240.m62CeDOC007924@xenbits.xensource.com>
Date: Wed, 02 Jul 2008 05:40:12 -0700
From: Xen patchbot-unstable <patchbot-unstable@lists.xensource.com>
To: xen-changelog@lists.xensource.com
X-ASG-Orig-Subj: [xen-unstable] [IA64] add VGCF_online flag for
	XEN_DOMCTL_setvcpucontext to make vcpu online.
X-Barracuda-Connect: smtp.citrix.com[66.165.176.89]
X-Barracuda-Start-Time: 1215002394
X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com
X-Barracuda-Spam-Score: 0.00
X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5
	QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=
X-Barracuda-Spam-Report: Code version 3.1, rules version 3.1.54951
	Rule breakdown below
	pts rule name              description
	---- ----------------------
	--------------------------------------------------
Subject: [Xen-changelog] [xen-unstable] [IA64] add VGCF_online flag for
	XEN_DOMCTL_setvcpucontext to make vcpu online.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Isaku Yamahata <yamahata@valinux.co.jp>
# Date 1213080887 -32400
# Node ID 4af5059f4e0d8072a1dfd6740496af8d055d4443
# Parent  1feb98eb64eff4c97bf185047790f80e67501b3d
[IA64] add VGCF_online flag for XEN_DOMCTL_setvcpucontext to make vcpu online.

Extend the XEN_DOMCTL_setvcpucontext hypercall with VGCF_online
to make vcpu online.
This extension is necessary for save/restore support of pv_ops linux guest.
Currently Linux kernel makes vcpus offline except a boot processor
(vcpu = 0) when saving so that only vcpu = 0 is made online by the tools
stack when restoring. Then Linux kernel itself makes other vcpus up.
On the other hand, pv_ops linux guest doesn't make vcpus offline.
It uses stop_machine_run() keeping all vcpus online.
Thus all of vcpus context must be saved/restored and all vcpus needs to be
made online by the tools stack. So there needs a way to make vcpu online.
Add VGCF_online flag to the XEN_DOMCTL_setvcpucontext hypercall
following the x86 way.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 xen/arch/ia64/xen/domain.c     |    3 ++-
 xen/include/public/arch-ia64.h |    1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff -r 1feb98eb64ef -r 4af5059f4e0d xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c	Tue Jun 10 15:08:06 2008 +0900
+++ b/xen/arch/ia64/xen/domain.c	Tue Jun 10 15:54:47 2008 +0900
@@ -1200,7 +1200,8 @@ int arch_set_info_guest(struct vcpu *v, 
 
 		v->is_initialised = 1;
 		/* Auto-online VCPU0 when it is initialised. */
-		if (v->vcpu_id == 0)
+		if (v->vcpu_id == 0 || (c.nat != NULL && 
+					c.nat->flags & VGCF_online))
 			clear_bit(_VPF_down, &v->pause_flags);
 	}
 
diff -r 1feb98eb64ef -r 4af5059f4e0d xen/include/public/arch-ia64.h
--- a/xen/include/public/arch-ia64.h	Tue Jun 10 15:08:06 2008 +0900
+++ b/xen/include/public/arch-ia64.h	Tue Jun 10 15:54:47 2008 +0900
@@ -391,6 +391,7 @@ struct vcpu_guest_context {
 struct vcpu_guest_context {
 #define VGCF_EXTRA_REGS (1UL << 1)	/* Set extra regs.  */
 #define VGCF_SET_CR_IRR (1UL << 2)	/* Set cr_irr[0:3]. */
+#define VGCF_online     (1UL << 3)  /* make this vcpu online */
     unsigned long flags;       /* VGCF_* flags */
 
     struct vcpu_guest_context_regs regs;

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

From xen-changelog-bounces@lists.xensource.com Wed Jul 02 05:40:16 2008
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 02 Jul 2008 05:40:16 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1KE1d9-0001Oe-UX; Wed, 02 Jul 2008 05:40:16 -0700
Received: from spam.xensource.com ([70.42.241.90])
	by lists.xensource.com with esmtp (Exim 4.43) id 1KE1cr-0001BI-Fc
	for xen-changelog@lists.xensource.com; Wed, 02 Jul 2008 05:39:57 -0700
X-ASG-Debug-ID: 1215002391-5bc800100004-DBsQO9
X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi
Received: from SMTP.CITRIX.COM (localhost [127.0.0.1])
	by spam.xensource.com (Spam Firewall) with ESMTP id EDB85545FE
	for <xen-changelog@lists.xensource.com>;
	Wed,  2 Jul 2008 05:39:55 -0700 (PDT)
Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by
	spam.xensource.com with ESMTP id hfWeW2FiQVmqoT6Q for
	<xen-changelog@lists.xensource.com>;
	Wed, 02 Jul 2008 05:39:55 -0700 (PDT)
X-SBRS: None
X-MesageID: 801462
X-Ironport-Server: ftlpip01.citrite.net
X-Remote-IP: 70.42.241.98
X-Policy: $Relay
X-IronPort-AV: E=Sophos;i="4.27,737,1204520400"; 
   d="scan'208";a="801462"
Received: from relay.colo.xensource.com ([70.42.241.98])
	by SMTP.CITRIX.COM with ESMTP; 02 Jul 2008 08:39:54 -0400
Received: from xenbits.xensource.com (xenbits.colo.xensource.com
	[70.42.241.107])
	by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id
	m62CdscU024764
	for <xen-changelog@lists.xensource.com>; Wed, 2 Jul 2008 05:39:54 -0700
Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1])
	by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m62CeElw007942
	for <xen-changelog@lists.xensource.com>; Wed, 2 Jul 2008 05:40:14 -0700
Received: (from xen@localhost)
	by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m62CeEcW007941
	for xen-changelog@lists.xensource.com; Wed, 2 Jul 2008 05:40:14 -0700
Message-Id: <200807021240.m62CeEcW007941@xenbits.xensource.com>
Date: Wed, 02 Jul 2008 05:40:13 -0700
From: Xen patchbot-unstable <patchbot-unstable@lists.xensource.com>
To: xen-changelog@lists.xensource.com
X-ASG-Orig-Subj: [xen-unstable] [IA64] ia64 save/restore new formart. restore
	part.
X-Barracuda-Connect: smtp.citrix.com[66.165.176.89]
X-Barracuda-Start-Time: 1215002395
X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com
X-Barracuda-Spam-Score: 0.00
X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5
	QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=
X-Barracuda-Spam-Report: Code version 3.1, rules version 3.1.54951
	Rule breakdown below
	pts rule name              description
	---- ----------------------
	--------------------------------------------------
Subject: [Xen-changelog] [xen-unstable] [IA64] ia64 save/restore new
	formart. restore part.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Isaku Yamahata <yamahata@valinux.co.jp>
# Date 1213081089 -32400
# Node ID fc89fb719214218c6245f632720f5105261539bd
# Parent  4af5059f4e0d8072a1dfd6740496af8d055d4443
[IA64] ia64 save/restore new formart. restore part.

Introduce ia64 save/restore new formart. restore part.
The formart twist is necessary for pv_ops linux support saving/restoring
all of the online vcpu context.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 tools/libxc/ia64/xc_ia64_linux_restore.c |  226 ++++++++++++++++++++++++-------
 tools/libxc/ia64/xc_ia64_save_restore.h  |    4 
 2 files changed, 182 insertions(+), 48 deletions(-)

diff -r 4af5059f4e0d -r fc89fb719214 tools/libxc/ia64/xc_ia64_linux_restore.c
--- a/tools/libxc/ia64/xc_ia64_linux_restore.c	Tue Jun 10 15:54:47 2008 +0900
+++ b/tools/libxc/ia64/xc_ia64_linux_restore.c	Tue Jun 10 15:58:09 2008 +0900
@@ -127,7 +127,7 @@ xc_ia64_recv_vcpu_context(int xc_handle,
     fprintf(stderr, "ip=%016lx, b0=%016lx\n", ctxt->regs.ip, ctxt->regs.b[0]);
 
     /* Initialize and set registers.  */
-    ctxt->flags = VGCF_EXTRA_REGS | VGCF_SET_CR_IRR;
+    ctxt->flags = VGCF_EXTRA_REGS | VGCF_SET_CR_IRR | VGCF_online;
     if (xc_vcpu_setcontext(xc_handle, dom, vcpu, ctxt) != 0) {
         ERROR("Couldn't set vcpu context");
         return -1;
@@ -184,29 +184,57 @@ xc_ia64_recv_shared_info(int xc_handle, 
 }
 
 static int
-xc_ia64_pv_recv_context(int xc_handle, int io_fd, uint32_t dom,
-                        unsigned long shared_info_frame,
-                        struct xen_ia64_p2m_table *p2m_table,
-                        unsigned int store_evtchn, unsigned long *store_mfn,
-                        unsigned int console_evtchn,
-                        unsigned long *console_mfn)
+xc_ia64_recv_vcpumap(const xc_dominfo_t *info, int io_fd, uint64_t **vcpumapp)
+{
+    uint64_t max_virt_cpus;
+    unsigned long vcpumap_size;
+    uint64_t *vcpumap = NULL;
+
+    *vcpumapp = NULL;
+    
+    if (read_exact(io_fd, &max_virt_cpus, sizeof(max_virt_cpus))) {
+        ERROR("error reading max_virt_cpus");
+        return -1;
+    }
+    if (max_virt_cpus < info->max_vcpu_id) {
+        ERROR("too large max_virt_cpus %i < %i\n",
+              max_virt_cpus, info->max_vcpu_id);
+        return -1;
+    }
+    vcpumap_size = (max_virt_cpus + 1 + sizeof(vcpumap[0]) - 1) /
+        sizeof(vcpumap[0]);
+    vcpumap = malloc(vcpumap_size);
+    if (vcpumap == NULL) {
+        ERROR("memory alloc for vcpumap");
+        return -1;
+    }
+    memset(vcpumap, 0, vcpumap_size);
+    if (read_exact(io_fd, vcpumap, vcpumap_size)) {
+        ERROR("read vcpumap");
+        free(vcpumap);
+        return -1;
+    }
+
+    *vcpumapp = vcpumap;
+    return 0;
+}
+
+static int
+xc_ia64_pv_recv_vcpu_context(int xc_handle, int io_fd, int32_t dom,
+                             uint32_t vcpu)
 {
     int rc = -1;
-    unsigned long gmfn;
 
     /* A copy of the CPU context of the guest. */
     vcpu_guest_context_t ctxt;
-
-    /* A temporary mapping of the guest's start_info page. */
-    start_info_t *start_info;
-
+    
     if (lock_pages(&ctxt, sizeof(ctxt))) {
         /* needed for build domctl, but might as well do early */
         ERROR("Unable to lock_pages ctxt");
         return -1;
     }
 
-    if (xc_ia64_recv_vcpu_context(xc_handle, io_fd, dom, 0, &ctxt))
+    if (xc_ia64_recv_vcpu_context(xc_handle, io_fd, dom, vcpu, &ctxt))
         goto out;
 
     /* Then get privreg page.  */
@@ -215,21 +243,42 @@ xc_ia64_pv_recv_context(int xc_handle, i
         goto out;
     }
 
+    rc = 0;
+
+ out:
+    unlock_pages(&ctxt, sizeof(ctxt));
+    return rc;
+}
+
+static int
+xc_ia64_pv_recv_shared_info(int xc_handle, int io_fd, int32_t dom, 
+                            unsigned long shared_info_frame,
+                            struct xen_ia64_p2m_table *p2m_table,
+                            unsigned int store_evtchn,
+                            unsigned long *store_mfn,
+                            unsigned int console_evtchn,
+                            unsigned long *console_mfn)
+{
+    unsigned long gmfn;
+
+    /* A temporary mapping of the guest's start_info page. */
+    start_info_t *start_info;
+    
     /* Read shared info.  */
     if (xc_ia64_recv_shared_info(xc_handle, io_fd, dom,
                                  shared_info_frame, &gmfn))
-        goto out;
+        return -1;
 
     /* Uncanonicalise the suspend-record frame number and poke resume rec. */
     if (populate_page_if_necessary(xc_handle, dom, gmfn, p2m_table)) {
         ERROR("cannot populate page 0x%lx", gmfn);
-        goto out;
+        return -1;
     }
     start_info = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
                                       PROT_READ | PROT_WRITE, gmfn);
     if (start_info == NULL) {
         ERROR("cannot map start_info page");
-        goto out;
+        return -1;
     }
     start_info->nr_pages = p2m_size;
     start_info->shared_info = shared_info_frame << PAGE_SHIFT;
@@ -240,10 +289,109 @@ xc_ia64_pv_recv_context(int xc_handle, i
     start_info->console.domU.evtchn = console_evtchn;
     munmap(start_info, PAGE_SIZE);
 
-    rc = 0;
-
+    return 0;
+}
+
+static int
+xc_ia64_pv_recv_context_ver_one_or_two(int xc_handle, int io_fd, uint32_t dom,
+                                       unsigned long shared_info_frame,
+                                       struct xen_ia64_p2m_table *p2m_table,
+                                       unsigned int store_evtchn,
+                                       unsigned long *store_mfn,
+                                       unsigned int console_evtchn,
+                                       unsigned long *console_mfn)
+{
+    int rc;
+
+    /* vcpu 0 context */
+    rc = xc_ia64_pv_recv_vcpu_context(xc_handle, io_fd, dom, 0);
+    if (rc)
+        return rc;
+
+
+    /* shared_info */
+    rc = xc_ia64_pv_recv_shared_info(xc_handle, io_fd, dom, shared_info_frame,
+                                     p2m_table, store_evtchn, store_mfn,
+                                     console_evtchn, console_mfn);
+    return rc;
+}
+
+static int
+xc_ia64_pv_recv_context_ver_three(int xc_handle, int io_fd, uint32_t dom,
+                                  unsigned long shared_info_frame,
+                                  struct xen_ia64_p2m_table *p2m_table,
+                                  unsigned int store_evtchn,
+                                  unsigned long *store_mfn,
+                                  unsigned int console_evtchn,
+                                  unsigned long *console_mfn)
+{
+    int rc = -1;
+    xc_dominfo_t info;
+    unsigned int i;
+    
+    /* vcpu map */
+    uint64_t *vcpumap = NULL;
+    
+    if (xc_domain_getinfo(xc_handle, dom, 1, &info) != 1) {
+        ERROR("Could not get domain info");
+        return -1;
+    }
+    rc = xc_ia64_recv_vcpumap(&info, io_fd, &vcpumap);
+    if (rc != 0)
+        goto out;
+
+    /* vcpu context */
+    for (i = 0; i <= info.max_vcpu_id; i++) {
+        if (!__test_bit(i, vcpumap))
+            continue;
+
+        rc = xc_ia64_pv_recv_vcpu_context(xc_handle, io_fd, dom, i);
+        if (rc != 0)
+            goto out;
+    }    
+
+    /* shared_info */
+    rc = xc_ia64_pv_recv_shared_info(xc_handle, io_fd, dom, shared_info_frame,
+                                     p2m_table, store_evtchn, store_mfn,
+                                     console_evtchn, console_mfn);
  out:
-    unlock_pages(&ctxt, sizeof(ctxt));
+    if (vcpumap != NULL)
+        free(vcpumap);
+    return rc;
+}
+
+static int
+xc_ia64_pv_recv_context(unsigned long format_version,
+                        int xc_handle, int io_fd, uint32_t dom,
+                        unsigned long shared_info_frame,
+                        struct xen_ia64_p2m_table *p2m_table,
+                        unsigned int store_evtchn,
+                        unsigned long *store_mfn,
+                        unsigned int console_evtchn,
+                        unsigned long *console_mfn)
+{
+    int rc;
+    switch (format_version) {
+    case XC_IA64_SR_FORMAT_VER_ONE:
+    case XC_IA64_SR_FORMAT_VER_TWO:
+        rc = xc_ia64_pv_recv_context_ver_one_or_two(xc_handle, io_fd, dom,
+                                                    shared_info_frame,
+                                                    p2m_table, store_evtchn,
+                                                    store_mfn, console_evtchn,
+                                                    console_mfn);
+        break;
+    case XC_IA64_SR_FORMAT_VER_THREE:
+        rc = xc_ia64_pv_recv_context_ver_three(xc_handle, io_fd, dom,
+                                               shared_info_frame,
+                                               p2m_table, store_evtchn,
+                                               store_mfn, console_evtchn,
+                                               console_mfn);
+        break;
+    default:
+        ERROR("Unsupported format version");
+        rc = -1;
+        break;
+    }
     return rc;
 }
 
@@ -259,9 +407,7 @@ xc_ia64_hvm_recv_context(int xc_handle, 
     xc_dominfo_t info;
     unsigned int i;
     
-    /* cpu */
-    uint64_t max_virt_cpus;
-    unsigned long vcpumap_size;
+    /* cpumap */
     uint64_t *vcpumap = NULL;
 
     /* HVM: magic frames for ioreqs and xenstore comms */
@@ -289,27 +435,8 @@ xc_ia64_hvm_recv_context(int xc_handle, 
         ERROR("Could not get domain info");
         goto out;
     }
-    if (read_exact(io_fd, &max_virt_cpus, sizeof(max_virt_cpus))) {
-        ERROR("error reading max_virt_cpus");
-        goto out;
-    }
-    if (max_virt_cpus < info.max_vcpu_id) {
-        ERROR("too large max_virt_cpus %i < %i\n",
-              max_virt_cpus, info.max_vcpu_id);
-        goto out;
-    }
-    vcpumap_size = (max_virt_cpus + 1 + sizeof(vcpumap[0]) - 1) /
-        sizeof(vcpumap[0]);
-    vcpumap = malloc(vcpumap_size);
-    if (vcpumap == NULL) {
-        ERROR("memory alloc for vcpumap");
-        goto out;
-    }
-    memset(vcpumap, 0, vcpumap_size);
-    if (read_exact(io_fd, vcpumap, vcpumap_size)) {
-        ERROR("read vcpumap");
-        goto out;
-    }
+    if (xc_ia64_recv_vcpumap(&info, io_fd, &vcpumap))
+        goto out;
     
     /* vcpu context */
     for (i = 0; i <= info.max_vcpu_id; i++) {
@@ -322,7 +449,7 @@ xc_ia64_hvm_recv_context(int xc_handle, 
         if (xc_ia64_recv_vcpu_context(xc_handle, io_fd, dom, i, &ctxt))
             goto out;
 
-        // system context of vcpu is recieved as hvm context.
+        /* system context of vcpu is recieved as hvm context. */
     }    
 
     /* Set HVM-specific parameters */
@@ -350,6 +477,7 @@ xc_ia64_hvm_recv_context(int xc_handle, 
         ERROR("error setting HVM params: %i", rc);
         goto out;
     }
+    rc = -1;
     *store_mfn = magic_pfns[0];
 
     /* Read HVM context */
@@ -437,7 +565,9 @@ xc_domain_restore(int xc_handle, int io_
         ERROR("Error when reading version");
         goto out;
     }
-    if (ver != XC_IA64_SR_FORMAT_VER_ONE && ver != XC_IA64_SR_FORMAT_VER_TWO) {
+    if (ver != XC_IA64_SR_FORMAT_VER_ONE &&
+        ver != XC_IA64_SR_FORMAT_VER_TWO &&
+        ver != XC_IA64_SR_FORMAT_VER_THREE) {
         ERROR("version of save doesn't match");
         goto out;
     }
@@ -468,7 +598,8 @@ xc_domain_restore(int xc_handle, int io_
     }
     shared_info_frame = domctl.u.getdomaininfo.shared_info_frame;
 
-    if (ver == XC_IA64_SR_FORMAT_VER_TWO) {
+    if (ver == XC_IA64_SR_FORMAT_VER_THREE ||
+        ver == XC_IA64_SR_FORMAT_VER_TWO) {
         unsigned int memmap_info_num_pages;
         unsigned long memmap_size;
         xen_ia64_memmap_info_t *memmap_info;
@@ -548,7 +679,8 @@ xc_domain_restore(int xc_handle, int io_
         goto out;
 
     if (!hvm)
-        rc = xc_ia64_pv_recv_context(xc_handle, io_fd, dom, shared_info_frame,
+        rc = xc_ia64_pv_recv_context(ver, 
+                                     xc_handle, io_fd, dom, shared_info_frame,
                                      &p2m_table, store_evtchn, store_mfn,
                                      console_evtchn, console_mfn);
     else
diff -r 4af5059f4e0d -r fc89fb719214 tools/libxc/ia64/xc_ia64_save_restore.h
--- a/tools/libxc/ia64/xc_ia64_save_restore.h	Tue Jun 10 15:54:47 2008 +0900
+++ b/tools/libxc/ia64/xc_ia64_save_restore.h	Tue Jun 10 15:58:09 2008 +0900
@@ -27,7 +27,9 @@
 #define XC_IA64_SR_FORMAT_VER_ONE       1UL
         /* using foreign p2m exposure version */
 #define XC_IA64_SR_FORMAT_VER_TWO       2UL
-#define XC_IA64_SR_FORMAT_VER_MAX       2UL
+        /* only pv change: send vcpumap and all vcpu context */
+#define XC_IA64_SR_FORMAT_VER_THREE     3UL
+#define XC_IA64_SR_FORMAT_VER_MAX       3UL
 
 #define XC_IA64_SR_FORMAT_VER_CURRENT   XC_IA64_SR_FORMAT_VER_TWO
 

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

From xen-changelog-bounces@lists.xensource.com Wed Jul 02 05:40:22 2008
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 02 Jul 2008 05:40:22 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1KE1dG-0001T4-ON; Wed, 02 Jul 2008 05:40:22 -0700
Received: from spam.xensource.com ([70.42.241.90])
	by lists.xensource.com with esmtp (Exim 4.43) id 1KE1cs-0001Bk-1E
	for xen-changelog@lists.xensource.com; Wed, 02 Jul 2008 05:39:58 -0700
X-ASG-Debug-ID: 1215002391-5bc800100005-DBsQO9
X-Barracuda-URL: http://spam.xensource.com:8000/cgi-bin/mark.cgi
Received: from SMTP.CITRIX.COM (localhost [127.0.0.1])
	by spam.xensource.com (Spam Firewall) with ESMTP id CDE2F54600
	for <xen-changelog@lists.xensource.com>;
	Wed,  2 Jul 2008 05:39:56 -0700 (PDT)
Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) by
	spam.xensource.com with ESMTP id lDSHD37i4pJQPPi9 for
	<xen-changelog@lists.xensource.com>;
	Wed, 02 Jul 2008 05:39:56 -0700 (PDT)
X-SBRS: None
X-MesageID: 801463
X-Ironport-Server: ftlpip01.citrite.net
X-Remote-IP: 70.42.241.98
X-Policy: $Relay
X-IronPort-AV: E=Sophos;i="4.27,737,1204520400"; 
   d="scan'208";a="801463"
Received: from relay.colo.xensource.com ([70.42.241.98])
	by SMTP.CITRIX.COM with ESMTP; 02 Jul 2008 08:39:55 -0400
Received: from xenbits.xensource.com (xenbits.colo.xensource.com
	[70.42.241.107])
	by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id
	m62CdtWc024767
	for <xen-changelog@lists.xensource.com>; Wed, 2 Jul 2008 05:39:55 -0700
Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1])
	by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m62CeFeZ007959
	for <xen-changelog@lists.xensource.com>; Wed, 2 Jul 2008 05:40:15 -0700
Received: (from xen@localhost)
	by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m62CeFq1007958
	for xen-changelog@lists.xensource.com; Wed, 2 Jul 2008 05:40:15 -0700
Message-Id: <200807021240.m62CeFq1007958@xenbits.xensource.com>
Date: Wed, 02 Jul 2008 05:40:14 -0700
From: Xen patchbot-unstable <patchbot-unstable@lists.xensource.com>
To: xen-changelog@lists.xensource.com
X-ASG-Orig-Subj: [xen-unstable] [IA64] ia64 save/restore new formart. save
	part.
X-Barracuda-Connect: smtp.citrix.com[66.165.176.89]
X-Barracuda-Start-Time: 1215002396
X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at xensource.com
X-Barracuda-Spam-Score: 0.00
X-Barracuda-Spam-Status: No, SCORE=0.00 using per-user scores of TAG_LEVEL=3.5
	QUARANTINE_LEVEL=6.0 KILL_LEVEL=1000.0 tests=
X-Barracuda-Spam-Report: Code version 3.1, rules version 3.1.54951
	Rule breakdown below
	pts rule name              description
	---- ----------------------
	--------------------------------------------------
Subject: [Xen-changelog] [xen-unstable] [IA64] ia64 save/restore new
	formart. save part.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Isaku Yamahata <yamahata@valinux.co.jp>
# Date 1213081233 -32400
# Node ID 1201c765783217371166062621e8926cb7643cfd
# Parent  fc89fb719214218c6245f632720f5105261539bd
[IA64] ia64 save/restore new formart. save part.

Introduce ia64 save/restore new formart. save part.
The formart twist is necessary for pv_ops linux support saving/restoring
all of the online vcpu context.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 tools/libxc/ia64/xc_ia64_linux_save.c   |  149 ++++++++++++++++++++------------
 tools/libxc/ia64/xc_ia64_save_restore.h |    2 
 2 files changed, 96 insertions(+), 55 deletions(-)

diff -r fc89fb719214 -r 1201c7657832 tools/libxc/ia64/xc_ia64_linux_save.c
--- a/tools/libxc/ia64/xc_ia64_linux_save.c	Tue Jun 10 15:58:09 2008 +0900
+++ b/tools/libxc/ia64/xc_ia64_linux_save.c	Tue Jun 10 16:00:33 2008 +0900
@@ -207,33 +207,97 @@ xc_ia64_send_shared_info(int xc_handle, 
 }
 
 static int
+xc_ia64_send_vcpumap(int xc_handle, int io_fd, uint32_t dom,
+                     const xc_dominfo_t *info, uint64_t max_virt_cpus,
+                     uint64_t **vcpumapp)
+{
+    int rc = -1;
+    unsigned int i;
+    unsigned long vcpumap_size;
+    uint64_t *vcpumap = NULL;
+
+    vcpumap_size = (max_virt_cpus + 1 + sizeof(vcpumap[0]) - 1) /
+        sizeof(vcpumap[0]);
+    vcpumap = malloc(vcpumap_size);
+    if (vcpumap == NULL) {
+        ERROR("memory alloc for vcpumap");
+        goto out;
+    }
+    memset(vcpumap, 0, vcpumap_size);
+
+    for (i = 0; i <= info->max_vcpu_id; i++) {
+        xc_vcpuinfo_t vinfo;
+        if ((xc_vcpu_getinfo(xc_handle, dom, i, &vinfo) == 0) && vinfo.online)
+            __set_bit(i, vcpumap);
+    }
+
+    if (write_exact(io_fd, &max_virt_cpus, sizeof(max_virt_cpus))) {
+        ERROR("write max_virt_cpus");
+        goto out;
+    }
+
+    if (write_exact(io_fd, vcpumap, vcpumap_size)) {
+        ERROR("write vcpumap");
+        goto out;
+    }
+
+    rc = 0;
+
+ out:
+    if (rc != 0 && vcpumap != NULL) {
+        free(vcpumap);
+        vcpumap = NULL;
+    }
+    *vcpumapp = vcpumap;
+    return rc;
+}
+
+
+static int
 xc_ia64_pv_send_context(int xc_handle, int io_fd, uint32_t dom,
-                        shared_info_t *live_shinfo)
-{
-    /* A copy of the CPU context of the guest. */
-    vcpu_guest_context_t ctxt;
-    char *mem;
-
-    if (xc_ia64_send_vcpu_context(xc_handle, io_fd, dom, 0, &ctxt))
-        return -1;
-
-    mem = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
-                               PROT_READ|PROT_WRITE, ctxt.privregs_pfn);
-    if (mem == NULL) {
-        ERROR("cannot map privreg page");
-        return -1;
-    }
-    if (write_exact(io_fd, mem, PAGE_SIZE)) {
-        ERROR("Error when writing privreg to state file (5)");
+                        const xc_dominfo_t *info, shared_info_t *live_shinfo)
+{
+    int rc = -1;
+    unsigned int i;
+
+    /* vcpu map */
+    uint64_t *vcpumap = NULL;
+    if (xc_ia64_send_vcpumap(xc_handle, io_fd, dom, info, MAX_VIRT_CPUS,
+                             &vcpumap))
+        goto out;
+
+    /* vcpu context */
+    for (i = 0; i <= info->max_vcpu_id; i++) {
+        /* A copy of the CPU context of the guest. */
+        vcpu_guest_context_t ctxt;
+        char *mem;
+
+        if (!__test_bit(i, vcpumap))
+            continue;
+
+        if (xc_ia64_send_vcpu_context(xc_handle, io_fd, dom, i, &ctxt))
+            goto out;
+
+        mem = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
+                                   PROT_READ|PROT_WRITE, ctxt.privregs_pfn);
+        if (mem == NULL) {
+            ERROR("cannot map privreg page");
+            goto out;
+        }
+        if (write_exact(io_fd, mem, PAGE_SIZE)) {
+            ERROR("Error when writing privreg to state file (5)");
+            munmap(mem, PAGE_SIZE);
+            goto out;
+        }
         munmap(mem, PAGE_SIZE);
-        return -1;
-    }
-    munmap(mem, PAGE_SIZE);
-
-    if (xc_ia64_send_shared_info(xc_handle, io_fd, live_shinfo))
-        return -1;
-
-    return 0;
+    }    
+
+    rc = xc_ia64_send_shared_info(xc_handle, io_fd, live_shinfo);
+
+ out:
+    if (vcpumap != NULL)
+        free(vcpumap);
+    return rc;
 }
 
 static int
@@ -244,8 +308,6 @@ xc_ia64_hvm_send_context(int xc_handle, 
     unsigned int i;
 
     /* vcpu map */
-    uint64_t max_virt_cpus;
-    unsigned long vcpumap_size;
     uint64_t *vcpumap = NULL;
 
     /* HVM: magic frames for ioreqs and xenstore comms */
@@ -268,31 +330,9 @@ xc_ia64_hvm_send_context(int xc_handle, 
         return -1;
 
     /* vcpu map */
-    max_virt_cpus = MAX_VIRT_CPUS;
-    vcpumap_size = (max_virt_cpus + 1 + sizeof(vcpumap[0]) - 1) /
-        sizeof(vcpumap[0]);
-    vcpumap = malloc(vcpumap_size);
-    if (vcpumap == NULL) {
-        ERROR("memory alloc for vcpumap");
-        goto out;
-    }
-    memset(vcpumap, 0, vcpumap_size);
-
-    for (i = 0; i <= info->max_vcpu_id; i++) {
-        xc_vcpuinfo_t vinfo;
-        if ((xc_vcpu_getinfo(xc_handle, dom, i, &vinfo) == 0) && vinfo.online)
-            __set_bit(i, vcpumap);
-    }
-
-    if (write_exact(io_fd, &max_virt_cpus, sizeof(max_virt_cpus))) {
-        ERROR("write max_virt_cpus");
-        goto out;
-    }
-
-    if (write_exact(io_fd, vcpumap, vcpumap_size)) {
-        ERROR("write vcpumap");
-        goto out;
-    }
+    if (xc_ia64_send_vcpumap(xc_handle, io_fd, dom, info, MAX_VIRT_CPUS,
+                             &vcpumap))
+        goto out;
 
     /* vcpu context */
     for (i = 0; i <= info->max_vcpu_id; i++) {
@@ -305,7 +345,7 @@ xc_ia64_hvm_send_context(int xc_handle, 
         if (xc_ia64_send_vcpu_context(xc_handle, io_fd, dom, i, &ctxt))
             goto out;
 
-        // system context of vcpu is sent as hvm context.
+        /* system context of vcpu is sent as hvm context. */
     }    
 
     /* Save magic-page locations. */
@@ -733,7 +773,8 @@ xc_domain_save(int xc_handle, int io_fd,
         goto out;
 
     if (!hvm)
-        rc = xc_ia64_pv_send_context(xc_handle, io_fd, dom, live_shinfo);
+        rc = xc_ia64_pv_send_context(xc_handle, io_fd,
+                                     dom, &info, live_shinfo);
     else
  