From xen-changelog-bounces@lists.xensource.com Mon Oct 03 14:24:12 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 03 Oct 2011 14:24:12 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RApze-0001RD-Vp; Mon, 03 Oct 2011 14:24:11 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RApxl-00012z-Bv
	for xen-changelog@lists.xensource.com; Mon, 03 Oct 2011 14:22:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-182.messagelabs.com!1317676930!19544295!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9658 invoked from network); 3 Oct 2011 21:22:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-6.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Oct 2011 21:22:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RApxh-0008Q0-ST
	for xen-changelog@lists.xensource.com; Mon, 03 Oct 2011 22:22:09 +0100
Message-Id: <E1RApxh-0008Q0-ST@xenbits.xen.org>
Date: Mon, 03 Oct 2011 22:22:09 +0100
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] x86/vmx: don't call __vmxoff()
	blindly
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 Jan Beulich <jbeulich@suse.com>
# Date 1317655569 -3600
# Node ID 3f89d09030e166168f8f472a569c1f3904f3ac00
# Parent  487d9e6505847c195aa38b637a80a4c39523691c
x86/vmx: don't call __vmxoff() blindly

If vmx_vcpu_up() failed, __vmxon() would generally not have got
(successfully) executed, and in that case __vmxoff() will #UD.

Additionally, any panic() during early resume (namely the tboot
related one) would cause vmx_cpu_down() to get executed without
vmx_cpu_up() having run before.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
xen-unstable changeset:   23848:cf37d2eec2ef
xen-unstable date:        Sat Sep 17 16:26:37 2011 +0100
---


diff -r 487d9e650584 -r 3f89d09030e1 xen/arch/x86/hvm/vmx/vmcs.c
--- a/xen/arch/x86/hvm/vmx/vmcs.c	Tue Sep 13 10:42:07 2011 +0100
+++ b/xen/arch/x86/hvm/vmx/vmcs.c	Mon Oct 03 16:26:09 2011 +0100
@@ -70,6 +70,7 @@
 static DEFINE_PER_CPU_READ_MOSTLY(struct vmcs_struct *, host_vmcs);
 static DEFINE_PER_CPU(struct vmcs_struct *, current_vmcs);
 static DEFINE_PER_CPU(struct list_head, active_vmcs_list);
+static DEFINE_PER_CPU(bool_t, vmxon);
 
 static u32 vmcs_revision_id __read_mostly;
 
@@ -442,6 +443,7 @@
         printk("CPU%d: unexpected VMXON failure\n", cpu);
         return 0;
     case 0: /* success */
+        this_cpu(vmxon) = 1;
         break;
     default:
         BUG();
@@ -463,6 +465,9 @@
     struct list_head *active_vmcs_list = &this_cpu(active_vmcs_list);
     unsigned long flags;
 
+    if ( !this_cpu(vmxon) )
+        return;
+
     local_irq_save(flags);
 
     while ( !list_empty(active_vmcs_list) )
@@ -470,6 +475,7 @@
                                     struct vcpu, arch.hvm_vmx.active_list));
 
     BUG_ON(!(read_cr4() & X86_CR4_VMXE));
+    this_cpu(vmxon) = 0;
     __vmxoff();
 
     local_irq_restore(flags);

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 03 14:24:20 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 03 Oct 2011 14:24:20 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RApzo-0001Ub-3K; Mon, 03 Oct 2011 14:24:20 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RApxl-000130-Ic
	for xen-changelog@lists.xensource.com; Mon, 03 Oct 2011 14:22:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-182.messagelabs.com!1317676930!17949498!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20823 invoked from network); 3 Oct 2011 21:22:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Oct 2011 21:22:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RApxi-0008QF-D8
	for xen-changelog@lists.xensource.com; Mon, 03 Oct 2011 22:22:10 +0100
Message-Id: <E1RApxi-0008QF-D8@xenbits.xen.org>
Date: Mon, 03 Oct 2011 22:22:09 +0100
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] Clear IRQ_GUEST in
	irq_desc->status when setting action to NULL.
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 Igor Mammedov <imammedo@redhat.com>
# Date 1317656103 -3600
# Node ID bd27836e5a111f2f6adab21b8cfc62ac18338fcf
# Parent  3f89d09030e166168f8f472a569c1f3904f3ac00
Clear IRQ_GUEST in irq_desc->status when setting action to NULL.

Looking more closely at usage of action field with relation to
IRQ_GUEST flag. It appears that set IRQ_GUEST implies that action
is not NULL. As result it is not safe to set action to NULL and
leave IRQ_GUEST set.

Hence IRQ_GUEST should be cleared in dynamic_irq_cleanup where
action is set to NULL.

An addition remove BUGON at __pirq_guest_unbind that appears to be
bogus and not needed anymore.

Thanks Paolo Bonzini for NACKing previous patch, and pointing at the
correct solution.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>

Reinstate the BUG_ON, but after the action==NULL check. Since we then
go and start interpreting action as an irq_guest_action_t, the BUG_ON
is relevant here.

More generally, the brute-force nature of dynamic_irq_cleanup() looks
a bit worrying. Possibly there should be more integratioin with
pirq_guest_unbind() logic, for cleaning up un-acked EOIs and the like.

Signed-off-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   23852:c944e82bb092
xen-unstable date:        Sun Sep 18 00:00:26 2011 +0100
---


diff -r 3f89d09030e1 -r bd27836e5a11 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Mon Oct 03 16:26:09 2011 +0100
+++ b/xen/arch/x86/irq.c	Mon Oct 03 16:35:03 2011 +0100
@@ -154,6 +154,7 @@
 
     spin_lock_irqsave(&desc->lock, flags);
     desc->status  |= IRQ_DISABLED;
+    desc->status  &= ~IRQ_GUEST;
     desc->handler->shutdown(irq);
     action = desc->action;
     desc->action  = NULL;
@@ -1277,8 +1278,6 @@
     cpumask_t           cpu_eoi_map;
     int                 i;
 
-    BUG_ON(!(desc->status & IRQ_GUEST));
-
     action = (irq_guest_action_t *)desc->action;
     irq = desc - irq_desc;
 
@@ -1289,6 +1288,8 @@
         return NULL;
     }
 
+    BUG_ON(!(desc->status & IRQ_GUEST));
+
     for ( i = 0; (i < action->nr_guests) && (action->guest[i] != d); i++ )
         continue;
     BUG_ON(i == action->nr_guests);

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 03 14:24:26 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 03 Oct 2011 14:24:26 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RApzu-0001Xc-Q3; Mon, 03 Oct 2011 14:24:26 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RApxr-00013E-G1
	for xen-changelog@lists.xensource.com; Mon, 03 Oct 2011 14:22:21 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-182.messagelabs.com!1317676936!18914644!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12819 invoked from network); 3 Oct 2011 21:22:16 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Oct 2011 21:22:16 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RApxo-0008Qp-AA
	for xen-changelog@lists.xensource.com; Mon, 03 Oct 2011 22:22:16 +0100
Message-Id: <E1RApxo-0008Qp-AA@xenbits.xen.org>
Date: Mon, 03 Oct 2011 22:22:15 +0100
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] x86: ucode-amd: Don't warn when
	no ucode is available for a CPU
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 Jan Beulich <jbeulich@suse.com>
# Date 1317656147 -3600
# Node ID b66f7152a9cb1a1e086b78e04f9132ea57355353
# Parent  cda1ee31f07bc22b598452dfafd17c729505d4ec
x86: ucode-amd: Don't warn when no ucode is available for a CPU
revision

This patch originally comes from the Linus mainline kernel (2.6.33),
find below the patch details:

From: Andreas Herrmann <herrmann.der.user@googlemail.com>

There is no point in warning when there is no ucode available
for a specific CPU revision. Currently the container-file, which
provides the AMD ucode patches for OS load, contains only a few
ucode patches.

It's already clearly indicated by the printed patch_level
whenever new ucode was available and an update happened. So the
warning message is of no help but rather annoying on systems
with many CPUs.

Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
xen-unstable changeset:   23871:503ee256fecf
xen-unstable date:        Thu Sep 22 18:35:30 2011 +0100
---


diff -r cda1ee31f07b -r b66f7152a9cb xen/arch/x86/microcode_amd.c
--- a/xen/arch/x86/microcode_amd.c	Mon Oct 03 16:35:33 2011 +0100
+++ b/xen/arch/x86/microcode_amd.c	Mon Oct 03 16:35:47 2011 +0100
@@ -97,11 +97,7 @@
     }
 
     if ( !equiv_cpu_id )
-    {
-        printk(KERN_ERR "microcode: CPU%d cpu_id "
-               "not found in equivalent cpu table\n", cpu);
-        return -EINVAL;
-    }
+	    return 0;
 
     if ( (mc_header->processor_rev_id) != equiv_cpu_id )
     {

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 03 14:24:34 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 03 Oct 2011 14:24:34 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RAq02-0001al-GR; Mon, 03 Oct 2011 14:24:34 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RApxr-00013D-0U
	for xen-changelog@lists.xensource.com; Mon, 03 Oct 2011 14:22:21 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-182.messagelabs.com!1317676935!17934438!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23255 invoked from network); 3 Oct 2011 21:22:16 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Oct 2011 21:22:16 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RApxn-0008QU-SJ
	for xen-changelog@lists.xensource.com; Mon, 03 Oct 2011 22:22:15 +0100
Message-Id: <E1RApxn-0008QU-SJ@xenbits.xen.org>
Date: Mon, 03 Oct 2011 22:22:10 +0100
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] VT-d: fix off-by-one error in
	RMRR validation
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 Jan Beulich <jbeulich@suse.com>
# Date 1317656133 -3600
# Node ID cda1ee31f07bc22b598452dfafd17c729505d4ec
# Parent  bd27836e5a111f2f6adab21b8cfc62ac18338fcf
VT-d: fix off-by-one error in RMRR validation

(base_addr,end_addr) is an inclusive range, and hence there shouldn't
be a subtraction of 1 in the second invocation of page_is_ram_type().
For RMRRs covering a single page that actually resulted in the
immediately preceding page to get checked (which could have resulted
in a false warning).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
xen-unstable changeset:   23868:28147fd781af
xen-unstable date:        Thu Sep 22 18:32:34 2011 +0100
---


diff -r bd27836e5a11 -r cda1ee31f07b xen/drivers/passthrough/vtd/dmar.c
--- a/xen/drivers/passthrough/vtd/dmar.c	Mon Oct 03 16:35:03 2011 +0100
+++ b/xen/drivers/passthrough/vtd/dmar.c	Mon Oct 03 16:35:33 2011 +0100
@@ -515,7 +515,7 @@
      * inform the user
      */
     if ( (!page_is_ram_type(paddr_to_pfn(base_addr), RAM_TYPE_RESERVED)) ||
-         (!page_is_ram_type(paddr_to_pfn(end_addr) - 1, RAM_TYPE_RESERVED)) )
+         (!page_is_ram_type(paddr_to_pfn(end_addr), RAM_TYPE_RESERVED)) )
     {
         dprintk(XENLOG_WARNING VTDPREFIX,
                 "  RMRR address range not in reserved memory "

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 03 14:24:40 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 03 Oct 2011 14:24:40 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RAq08-0001dp-Lo; Mon, 03 Oct 2011 14:24:40 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RApxr-00013F-TJ
	for xen-changelog@lists.xensource.com; Mon, 03 Oct 2011 14:22:21 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-182.messagelabs.com!1317676936!20588503!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28796 invoked from network); 3 Oct 2011 21:22:16 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Oct 2011 21:22:16 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RApxo-0008R4-OH
	for xen-changelog@lists.xensource.com; Mon, 03 Oct 2011 22:22:16 +0100
Message-Id: <E1RApxo-0008R4-OH@xenbits.xen.org>
Date: Mon, 03 Oct 2011 22:22:16 +0100
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] build: fix grep invocation in
	cc-options
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 Ian Campbell <ian.campbell@citrix.com>
# Date 1317656169 -3600
# Node ID 7707a2bf2a9319c88f273d9d6a2827c3d6de914e
# Parent  b66f7152a9cb1a1e086b78e04f9132ea57355353
build: fix grep invocation in cc-options

Currently the build produces lots of
        Usage: grep [OPTION]... PATTERN [FILE]...
        Try `grep --help' for more information.

This is due to the "grep -- $(2)" in cc-options. It seems that the
default of reading stdin is disabled when using "--". I don't know if
this is a bug in grep or how it is supposed to be but we can work
around it by explicitly passing in "-"

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   23898:3d1664cc9e45
xen-unstable date:        Fri Sep 30 21:17:47 2011 +0100
---


diff -r b66f7152a9cb -r 7707a2bf2a93 Config.mk
--- a/Config.mk	Mon Oct 03 16:35:47 2011 +0100
+++ b/Config.mk	Mon Oct 03 16:36:09 2011 +0100
@@ -57,7 +57,7 @@
 #
 # Usage: cflags-y += $(call cc-option,$(CC),-march=winchip-c6,-march=i586)
 cc-option = $(shell if test -z "`echo 'void*p=1;' | \
-              $(1) $(2) -S -o /dev/null -xc - 2>&1 | grep -- $(2)`"; \
+              $(1) $(2) -S -o /dev/null -xc - 2>&1 | grep -- $(2) -`"; \
               then echo "$(2)"; else echo "$(3)"; fi ;)
 
 # cc-option-add: Add an option to compilation flags, but only if supported.

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 03 15:44:38 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 03 Oct 2011 15:44:38 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RArFW-0004nh-Rk; Mon, 03 Oct 2011 15:44:38 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RArFP-0004n1-QU
	for xen-changelog@lists.xensource.com; Mon, 03 Oct 2011 15:44:33 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-27.messagelabs.com!1317681843!51192618!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30595 invoked from network); 3 Oct 2011 22:44:03 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-7.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Oct 2011 22:44:03 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RArFC-00011b-K2
	for xen-changelog@lists.xensource.com; Mon, 03 Oct 2011 23:44:18 +0100
Message-Id: <E1RArFC-00011b-K2@xenbits.xen.org>
Date: Mon, 03 Oct 2011 23:44:07 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] Clear IRQ_GUEST in
	irq_desc->status when setting action to NULL.
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 Igor Mammedov <imammedo@redhat.com>
# Date 1317655792 -3600
# Node ID 2a0cd93f7ed9666ac60baa19c69bd89cad63c79e
# Parent  5c395e993fe4064f0e3e13af70af9e440dc00689
Clear IRQ_GUEST in irq_desc->status when setting action to NULL.

Looking more closely at usage of action field with relation to
IRQ_GUEST flag. It appears that set IRQ_GUEST implies that action
is not NULL. As result it is not safe to set action to NULL and
leave IRQ_GUEST set.

Hence IRQ_GUEST should be cleared in dynamic_irq_cleanup where
action is set to NULL.

An addition remove BUGON at __pirq_guest_unbind that appears to be
bogus and not needed anymore.

Thanks Paolo Bonzini for NACKing previous patch, and pointing at the
correct solution.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>

Reinstate the BUG_ON, but after the action==NULL check. Since we then
go and start interpreting action as an irq_guest_action_t, the BUG_ON
is relevant here.

More generally, the brute-force nature of dynamic_irq_cleanup() looks
a bit worrying. Possibly there should be more integratioin with
pirq_guest_unbind() logic, for cleaning up un-acked EOIs and the like.

Signed-off-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   23852:c944e82bb092
xen-unstable date:        Sun Sep 18 00:00:26 2011 +0100
---


diff -r 5c395e993fe4 -r 2a0cd93f7ed9 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Tue Sep 27 17:27:17 2011 +0100
+++ b/xen/arch/x86/irq.c	Mon Oct 03 16:29:52 2011 +0100
@@ -152,6 +152,7 @@
 
     spin_lock_irqsave(&desc->lock, flags);
     desc->status  |= IRQ_DISABLED;
+    desc->status  &= ~IRQ_GUEST;
     desc->handler->shutdown(irq);
     action = desc->action;
     desc->action  = NULL;
@@ -1288,8 +1289,6 @@
     cpumask_t           cpu_eoi_map;
     int                 i;
 
-    BUG_ON(!(desc->status & IRQ_GUEST));
-
     action = (irq_guest_action_t *)desc->action;
     irq = desc - irq_desc;
 
@@ -1300,6 +1299,8 @@
         return NULL;
     }
 
+    BUG_ON(!(desc->status & IRQ_GUEST));
+
     for ( i = 0; (i < action->nr_guests) && (action->guest[i] != d); i++ )
         continue;
     BUG_ON(i == action->nr_guests);

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 03 15:44:48 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 03 Oct 2011 15:44:48 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RArFg-0004qi-00; Mon, 03 Oct 2011 15:44:48 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RArFZ-0004ny-KU
	for xen-changelog@lists.xensource.com; Mon, 03 Oct 2011 15:44:42 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-21.messagelabs.com!1317681862!56519094!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28738 invoked from network); 3 Oct 2011 22:44:23 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Oct 2011 22:44:23 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RArFW-000127-BL
	for xen-changelog@lists.xensource.com; Mon, 03 Oct 2011 23:44:38 +0100
Message-Id: <E1RArFW-000127-BL@xenbits.xen.org>
Date: Mon, 03 Oct 2011 23:44:29 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] x86: ucode-amd: Don't warn when
	no ucode is available for a CPU
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 Jan Beulich <jbeulich@suse.com>
# Date 1317655926 -3600
# Node ID 3ea6112b3a0144f7715477293a5c48d8f8a1b703
# Parent  8e6b081e80442ab2c868f47f5dcdb6beec3df601
x86: ucode-amd: Don't warn when no ucode is available for a CPU
revision

This patch originally comes from the Linus mainline kernel (2.6.33),
find below the patch details:

From: Andreas Herrmann <herrmann.der.user@googlemail.com>

There is no point in warning when there is no ucode available
for a specific CPU revision. Currently the container-file, which
provides the AMD ucode patches for OS load, contains only a few
ucode patches.

It's already clearly indicated by the printed patch_level
whenever new ucode was available and an update happened. So the
warning message is of no help but rather annoying on systems
with many CPUs.

Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
xen-unstable changeset:   23871:503ee256fecf
xen-unstable date:        Thu Sep 22 18:35:30 2011 +0100
---


diff -r 8e6b081e8044 -r 3ea6112b3a01 xen/arch/x86/microcode_amd.c
--- a/xen/arch/x86/microcode_amd.c	Mon Oct 03 16:31:12 2011 +0100
+++ b/xen/arch/x86/microcode_amd.c	Mon Oct 03 16:32:06 2011 +0100
@@ -96,11 +96,7 @@
     }
 
     if ( !equiv_cpu_id )
-    {
-        printk(KERN_ERR "microcode: CPU%d cpu_id "
-               "not found in equivalent cpu table\n", cpu);
-        return -EINVAL;
-    }
+	    return 0;
 
     if ( (mc_header->processor_rev_id) != equiv_cpu_id )
     {

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 03 15:44:56 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 03 Oct 2011 15:44:56 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RArFo-0004tw-Gr; Mon, 03 Oct 2011 15:44:56 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RArFZ-0004nv-LS
	for xen-changelog@lists.xensource.com; Mon, 03 Oct 2011 15:44:42 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-174.messagelabs.com!1317681878!33764332!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1808 invoked from network); 3 Oct 2011 22:44:38 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Oct 2011 22:44:38 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RArFN-00011p-41
	for xen-changelog@lists.xensource.com; Mon, 03 Oct 2011 23:44:29 +0100
Message-Id: <E1RArFN-00011p-41@xenbits.xen.org>
Date: Mon, 03 Oct 2011 23:44:18 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] VT-d: fix off-by-one error in
	RMRR validation
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 Jan Beulich <jbeulich@suse.com>
# Date 1317655872 -3600
# Node ID 8e6b081e80442ab2c868f47f5dcdb6beec3df601
# Parent  2a0cd93f7ed9666ac60baa19c69bd89cad63c79e
VT-d: fix off-by-one error in RMRR validation

(base_addr,end_addr) is an inclusive range, and hence there shouldn't
be a subtraction of 1 in the second invocation of page_is_ram_type().
For RMRRs covering a single page that actually resulted in the
immediately preceding page to get checked (which could have resulted
in a false warning).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
xen-unstable changeset:   23868:28147fd781af
xen-unstable date:        Thu Sep 22 18:32:34 2011 +0100
---


diff -r 2a0cd93f7ed9 -r 8e6b081e8044 xen/drivers/passthrough/vtd/dmar.c
--- a/xen/drivers/passthrough/vtd/dmar.c	Mon Oct 03 16:29:52 2011 +0100
+++ b/xen/drivers/passthrough/vtd/dmar.c	Mon Oct 03 16:31:12 2011 +0100
@@ -519,7 +519,7 @@
      * inform the user
      */
     if ( (!page_is_ram_type(paddr_to_pfn(base_addr), RAM_TYPE_RESERVED)) ||
-         (!page_is_ram_type(paddr_to_pfn(end_addr) - 1, RAM_TYPE_RESERVED)) )
+         (!page_is_ram_type(paddr_to_pfn(end_addr), RAM_TYPE_RESERVED)) )
     {
         dprintk(XENLOG_WARNING VTDPREFIX,
                 "  RMRR address range not in reserved memory "

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 03 15:45:11 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 03 Oct 2011 15:45:11 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RArG3-0004xT-7H; Mon, 03 Oct 2011 15:45:11 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RArFZ-0004o9-UL
	for xen-changelog@lists.xensource.com; Mon, 03 Oct 2011 15:44:42 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-182.messagelabs.com!1317681878!20597641!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21173 invoked from network); 3 Oct 2011 22:44:39 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	3 Oct 2011 22:44:39 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RArFW-00012N-Q3
	for xen-changelog@lists.xensource.com; Mon, 03 Oct 2011 23:44:38 +0100
Message-Id: <E1RArFW-00012N-Q3@xenbits.xen.org>
Date: Mon, 03 Oct 2011 23:44:38 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] build: fix grep invocation in
	cc-options
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 Ian Campbell <ian.campbell@citrix.com>
# Date 1317656009 -3600
# Node ID d7e0e9f37874cf648e901b5dd5ebdfc455c9a214
# Parent  3ea6112b3a0144f7715477293a5c48d8f8a1b703
build: fix grep invocation in cc-options

Currently the build produces lots of
        Usage: grep [OPTION]... PATTERN [FILE]...
        Try `grep --help' for more information.

This is due to the "grep -- $(2)" in cc-options. It seems that the
default of reading stdin is disabled when using "--". I don't know if
this is a bug in grep or how it is supposed to be but we can work
around it by explicitly passing in "-"

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   23898:3d1664cc9e45
xen-unstable date:        Fri Sep 30 21:17:47 2011 +0100
---


diff -r 3ea6112b3a01 -r d7e0e9f37874 Config.mk
--- a/Config.mk	Mon Oct 03 16:32:06 2011 +0100
+++ b/Config.mk	Mon Oct 03 16:33:29 2011 +0100
@@ -73,7 +73,7 @@
 #
 # Usage: cflags-y += $(call cc-option,$(CC),-march=winchip-c6,-march=i586)
 cc-option = $(shell if test -z "`echo 'void*p=1;' | \
-              $(1) $(2) -S -o /dev/null -xc - 2>&1 | grep -- $(2)`"; \
+              $(1) $(2) -S -o /dev/null -xc - 2>&1 | grep -- $(2) -`"; \
               then echo "$(2)"; else echo "$(3)"; fi ;)
 
 # cc-option-add: Add an option to compilation flags, but only if supported.

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

From xen-changelog-bounces@lists.xensource.com Tue Oct 04 02:44:12 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 04 Oct 2011 02:44:12 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RB1Xo-0000fu-Bf; Tue, 04 Oct 2011 02:44:12 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RB1Xk-0000f8-H3
	for xen-changelog@lists.xensource.com; Tue, 04 Oct 2011 02:44:08 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-182.messagelabs.com!1317721445!19614012!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15724 invoked from network); 4 Oct 2011 09:44:05 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-6.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	4 Oct 2011 09:44:05 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RB1Xh-0001Ct-13
	for xen-changelog@lists.xensource.com; Tue, 04 Oct 2011 10:44:05 +0100
Message-Id: <E1RB1Xh-0001Ct-13@xenbits.xen.org>
Date: Tue, 04 Oct 2011 10:44:03 +0100
From: Xen patchbot-linux-2.6.18-xen <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [linux-2.6.18-xen] SFC: fix build wrt
	HWMON/HWMON_VID
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 Jan Beulich
# Date 1317717680 -7200
# Node ID c42e42e6047ff0264c7180d6e1c3cf7dda8e0018
# Parent  faa29a8c3c4b58143a7f0fc38965d12dc53a8a2d
SFC: fix build wrt HWMON/HWMON_VID

These must be selected, or sfc.ko will have unresolved symbol references.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r faa29a8c3c4b -r c42e42e6047f drivers/net/sfc/Kconfig
--- a/drivers/net/sfc/Kconfig	Thu Sep 22 18:58:20 2011 +0100
+++ b/drivers/net/sfc/Kconfig	Tue Oct 04 10:41:20 2011 +0200
@@ -4,6 +4,8 @@
 	select CRC32
 	select I2C
 	select I2C_ALGOBIT
+	select HWMON
+	select HWMON_VID
 	help
 	  This driver supports 10-gigabit Ethernet cards based on
 	  the Solarflare Communications Solarstorm SFC4000 and

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

From xen-changelog-bounces@lists.xensource.com Tue Oct 04 02:44:17 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 04 Oct 2011 02:44:17 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RB1Xt-0000ii-P6; Tue, 04 Oct 2011 02:44:17 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RB1Xl-0000f9-1B
	for xen-changelog@lists.xensource.com; Tue, 04 Oct 2011 02:44:09 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-182.messagelabs.com!1317721445!20661630!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17154 invoked from network); 4 Oct 2011 09:44:06 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	4 Oct 2011 09:44:06 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RB1Xh-0001Et-Tb
	for xen-changelog@lists.xensource.com; Tue, 04 Oct 2011 10:44:05 +0100
Message-Id: <E1RB1Xh-0001Et-Tb@xenbits.xen.org>
Date: Tue, 04 Oct 2011 10:44:05 +0100
From: Xen patchbot-linux-2.6.18-xen <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [linux-2.6.18-xen] drivers/pci/guestdev.c: fix a
	bogus include
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 Jan Beulich
# Date 1317720742 -7200
# Node ID e7cb8a796890cc9ec3b36dae3f41b552f81266dd
# Parent  7338608af801828219582b783d98415e0b5f7d3d
drivers/pci/guestdev.c: fix a bogus include

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 7338608af801 -r e7cb8a796890 drivers/pci/guestdev.c
--- a/drivers/pci/guestdev.c	Tue Oct 04 11:16:59 2011 +0200
+++ b/drivers/pci/guestdev.c	Tue Oct 04 11:32:22 2011 +0200
@@ -24,7 +24,7 @@
 #include <linux/module.h>
 #include <linux/string.h>
 #include <linux/acpi.h>
-#include <asm-x86_64/setup.h>
+#include <asm/setup.h>
 
 #define HID_LEN 8
 #define UID_LEN 8

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

From xen-changelog-bounces@lists.xensource.com Tue Oct 04 02:44:27 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 04 Oct 2011 02:44:27 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RB1Y3-0000mY-6O; Tue, 04 Oct 2011 02:44:27 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RB1Xl-0000fA-1D
	for xen-changelog@lists.xensource.com; Tue, 04 Oct 2011 02:44:10 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-27.messagelabs.com!1317721427!46650454!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32250 invoked from network); 4 Oct 2011 09:43:47 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	4 Oct 2011 09:43:47 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RB1Xh-0001EH-Gp
	for xen-changelog@lists.xensource.com; Tue, 04 Oct 2011 10:44:05 +0100
Message-Id: <E1RB1Xh-0001EH-Gp@xenbits.xen.org>
Date: Tue, 04 Oct 2011 10:44:05 +0100
From: Xen patchbot-linux-2.6.18-xen <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [linux-2.6.18-xen] Sync Xen public headers
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 Jan Beulich
# Date 1317719819 -7200
# Node ID 7338608af801828219582b783d98415e0b5f7d3d
# Parent  c42e42e6047ff0264c7180d6e1c3cf7dda8e0018
Sync Xen public headers

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r c42e42e6047f -r 7338608af801 include/xen/interface/arch-x86/hvm/save.h
--- a/include/xen/interface/arch-x86/hvm/save.h	Tue Oct 04 10:41:20 2011 +0200
+++ b/include/xen/interface/arch-x86/hvm/save.h	Tue Oct 04 11:16:59 2011 +0200
@@ -547,18 +547,6 @@
 DECLARE_HVM_SAVE_TYPE(MTRR, 14, struct hvm_hw_mtrr);
 
 /*
- * Viridian hypervisor context.
- */
-
-struct hvm_viridian_context {
-    uint64_t hypercall_gpa;
-    uint64_t guest_os_id;
-};
-
-DECLARE_HVM_SAVE_TYPE(VIRIDIAN, 15, struct hvm_viridian_context);
-
-
-/*
  * The save area of XSAVE/XRSTOR.
  */
 
@@ -580,9 +568,26 @@
 
 #define CPU_XSAVE_CODE  16
 
+/*
+ * Viridian hypervisor context.
+ */
+
+struct hvm_viridian_domain_context {
+    uint64_t hypercall_gpa;
+    uint64_t guest_os_id;
+};
+
+DECLARE_HVM_SAVE_TYPE(VIRIDIAN_DOMAIN, 15, struct hvm_viridian_domain_context);
+
+struct hvm_viridian_vcpu_context {
+    uint64_t apic_assist;
+};
+
+DECLARE_HVM_SAVE_TYPE(VIRIDIAN_VCPU, 17, struct hvm_viridian_vcpu_context);
+
 /* 
  * Largest type-code in use
  */
-#define HVM_SAVE_CODE_MAX 16
+#define HVM_SAVE_CODE_MAX 17
 
 #endif /* __XEN_PUBLIC_HVM_SAVE_X86_H__ */
diff -r c42e42e6047f -r 7338608af801 include/xen/interface/domctl.h
--- a/include/xen/interface/domctl.h	Tue Oct 04 10:41:20 2011 +0200
+++ b/include/xen/interface/domctl.h	Tue Oct 04 11:16:59 2011 +0200
@@ -35,7 +35,7 @@
 #include "xen.h"
 #include "grant_table.h"
 
-#define XEN_DOMCTL_INTERFACE_VERSION 0x00000007
+#define XEN_DOMCTL_INTERFACE_VERSION 0x00000008
 
 /*
  * NB. xen_domctl.domain is an IN/OUT parameter for this operation.
@@ -95,6 +95,7 @@
     uint64_aligned_t tot_pages;
     uint64_aligned_t max_pages;
     uint64_aligned_t shr_pages;
+    uint64_aligned_t paged_pages;
     uint64_aligned_t shared_info_frame; /* GMFN of shared_info struct */
     uint64_aligned_t cpu_time;
     uint32_t nr_online_vcpus;    /* Number of VCPUs currently online. */
@@ -455,15 +456,15 @@
 /* XEN_DOMCTL_test_assign_device */
 /* XEN_DOMCTL_deassign_device */
 struct xen_domctl_assign_device {
-    uint32_t  machine_bdf;   /* machine PCI ID of assigned device */
+    uint32_t  machine_sbdf;   /* machine PCI ID of assigned device */
 };
 typedef struct xen_domctl_assign_device xen_domctl_assign_device_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_assign_device_t);
 
-/* Retrieve sibling devices infomation of machine_bdf */
+/* Retrieve sibling devices infomation of machine_sbdf */
 /* XEN_DOMCTL_get_device_group */
 struct xen_domctl_get_device_group {
-    uint32_t  machine_bdf;      /* IN */
+    uint32_t  machine_sbdf;     /* IN */
     uint32_t  max_sdevs;        /* IN */
     uint32_t  num_sdevs;        /* OUT */
     XEN_GUEST_HANDLE_64(uint32)  sdev_array;   /* OUT */
@@ -708,20 +709,18 @@
 
 /* XEN_DOMCTL_mem_event_op */
 
-/* Add and remove memory handlers */
-#define XEN_DOMCTL_MEM_EVENT_OP_ENABLE     0
-#define XEN_DOMCTL_MEM_EVENT_OP_DISABLE    1
-
 /*
+* Domain memory paging
  * Page memory in and out. 
  */
 #define XEN_DOMCTL_MEM_EVENT_OP_PAGING            1
 
-/* Domain memory paging */
-#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_NOMINATE   0
-#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_EVICT      1
-#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP       2
-#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_RESUME     3
+#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_ENABLE     0
+#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_DISABLE    1
+#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_NOMINATE   2
+#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_EVICT      3
+#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP       4
+#define XEN_DOMCTL_MEM_EVENT_OP_PAGING_RESUME     5
 
 /*
  * Access permissions.
@@ -734,11 +733,14 @@
  * ACCESS_RESUME mode for the following domctl.
  */
 #define XEN_DOMCTL_MEM_EVENT_OP_ACCESS            2
-#define XEN_DOMCTL_MEM_EVENT_OP_ACCESS_RESUME     0 
+
+#define XEN_DOMCTL_MEM_EVENT_OP_ACCESS_ENABLE     0
+#define XEN_DOMCTL_MEM_EVENT_OP_ACCESS_DISABLE    1
+#define XEN_DOMCTL_MEM_EVENT_OP_ACCESS_RESUME     2
 
 struct xen_domctl_mem_event_op {
-    uint32_t       op;           /* XEN_DOMCTL_MEM_EVENT_OP_* */
-    uint32_t       mode;         /* XEN_DOMCTL_MEM_EVENT_ENABLE_* */
+    uint32_t       op;           /* XEN_DOMCTL_MEM_EVENT_OP_*_* */
+    uint32_t       mode;         /* XEN_DOMCTL_MEM_EVENT_OP_* */
 
     /* OP_ENABLE */
     uint64_aligned_t shared_addr;  /* IN:  Virtual address of shared page */
@@ -755,14 +757,16 @@
  */
 /* XEN_DOMCTL_mem_sharing_op */
 
-#define XEN_DOMCTL_MEM_SHARING_OP_CONTROL        0
-#define XEN_DOMCTL_MEM_SHARING_OP_NOMINATE_GFN   1
-#define XEN_DOMCTL_MEM_SHARING_OP_NOMINATE_GREF  2
-#define XEN_DOMCTL_MEM_SHARING_OP_SHARE          3
-#define XEN_DOMCTL_MEM_SHARING_OP_RESUME         4
-#define XEN_DOMCTL_MEM_SHARING_OP_DEBUG_GFN      5
-#define XEN_DOMCTL_MEM_SHARING_OP_DEBUG_MFN      6
-#define XEN_DOMCTL_MEM_SHARING_OP_DEBUG_GREF     7
+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING                3
+
+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_CONTROL        0
+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_NOMINATE_GFN   1
+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_NOMINATE_GREF  2
+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_SHARE          3
+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_RESUME         4
+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GFN      5
+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_MFN      6
+#define XEN_DOMCTL_MEM_EVENT_OP_SHARING_DEBUG_GREF     7
 
 #define XEN_DOMCTL_MEM_SHARING_S_HANDLE_INVALID  (-10)
 #define XEN_DOMCTL_MEM_SHARING_C_HANDLE_INVALID  (-9)
diff -r c42e42e6047f -r 7338608af801 include/xen/interface/io/xs_wire.h
--- a/include/xen/interface/io/xs_wire.h	Tue Oct 04 10:41:20 2011 +0200
+++ b/include/xen/interface/io/xs_wire.h	Tue Oct 04 11:16:59 2011 +0200
@@ -48,7 +48,8 @@
     XS_IS_DOMAIN_INTRODUCED,
     XS_RESUME,
     XS_SET_TARGET,
-    XS_RESTRICT
+    XS_RESTRICT,
+    XS_RESET_WATCHES
 };
 
 #define XS_WRITE_NONE "NONE"
diff -r c42e42e6047f -r 7338608af801 include/xen/interface/physdev.h
--- a/include/xen/interface/physdev.h	Tue Oct 04 10:41:20 2011 +0200
+++ b/include/xen/interface/physdev.h	Tue Oct 04 11:16:59 2011 +0200
@@ -142,6 +142,7 @@
 #define MAP_PIRQ_TYPE_MSI               0x0
 #define MAP_PIRQ_TYPE_GSI               0x1
 #define MAP_PIRQ_TYPE_UNKNOWN           0x2
+#define MAP_PIRQ_TYPE_MSI_SEG           0x3
 
 #define PHYSDEVOP_map_pirq               13
 struct physdev_map_pirq {
@@ -152,7 +153,7 @@
     int index;
     /* IN or OUT */
     int pirq;
-    /* IN */
+    /* IN - high 16 bits hold segment for MAP_PIRQ_TYPE_MSI_SEG */
     int bus;
     /* IN */
     int devfn;
@@ -255,6 +256,54 @@
 typedef struct physdev_get_free_pirq physdev_get_free_pirq_t;
 DEFINE_XEN_GUEST_HANDLE(physdev_get_free_pirq_t);
 
+#define XEN_PCI_MMCFG_RESERVED         0x1
+
+#define PHYSDEVOP_pci_mmcfg_reserved    24
+struct physdev_pci_mmcfg_reserved {
+    uint64_t address;
+    uint16_t segment;
+    uint8_t start_bus;
+    uint8_t end_bus;
+    uint32_t flags;
+};
+typedef struct physdev_pci_mmcfg_reserved physdev_pci_mmcfg_reserved_t;
+DEFINE_XEN_GUEST_HANDLE(physdev_pci_mmcfg_reserved_t);
+
+#define XEN_PCI_DEV_EXTFN              0x1
+#define XEN_PCI_DEV_VIRTFN             0x2
+#define XEN_PCI_DEV_PXM                0x4
+
+#define PHYSDEVOP_pci_device_add        25
+struct physdev_pci_device_add {
+    /* IN */
+    uint16_t seg;
+    uint8_t bus;
+    uint8_t devfn;
+    uint32_t flags;
+    struct {
+        uint8_t bus;
+        uint8_t devfn;
+    } physfn;
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+    uint32_t optarr[];
+#elif defined(__GNUC__)
+    uint32_t optarr[0];
+#endif
+};
+typedef struct physdev_pci_device_add physdev_pci_device_add_t;
+DEFINE_XEN_GUEST_HANDLE(physdev_pci_device_add_t);
+
+#define PHYSDEVOP_pci_device_remove     26
+#define PHYSDEVOP_restore_msi_ext       27
+struct physdev_pci_device {
+    /* IN */
+    uint16_t seg;
+    uint8_t bus;
+    uint8_t devfn;
+};
+typedef struct physdev_pci_device physdev_pci_device_t;
+DEFINE_XEN_GUEST_HANDLE(physdev_pci_device_t);
+
 /*
  * Notify that some PIRQ-bound event channels have been unmasked.
  * ** This command is obsolete since interface version 0x00030202 and is **
diff -r c42e42e6047f -r 7338608af801 include/xen/interface/platform.h
--- a/include/xen/interface/platform.h	Tue Oct 04 10:41:20 2011 +0200
+++ b/include/xen/interface/platform.h	Tue Oct 04 11:16:59 2011 +0200
@@ -123,6 +123,9 @@
 #define XEN_EFI_get_variable                  6
 #define XEN_EFI_set_variable                  7
 #define XEN_EFI_get_next_variable_name        8
+#define XEN_EFI_query_variable_info           9
+#define XEN_EFI_query_capsule_capabilities   10
+#define XEN_EFI_update_capsule               11
 struct xenpf_efi_runtime_call {
     uint32_t function;
     /*
@@ -180,6 +183,26 @@
             XEN_GUEST_HANDLE(void) name;  /* UCS-2/UTF-16 string */
             struct xenpf_efi_guid vendor_guid;
         } get_next_variable_name;
+
+        struct {
+            uint32_t attr;
+            uint64_t max_store_size;
+            uint64_t remain_store_size;
+            uint64_t max_size;
+        } query_variable_info;
+
+        struct {
+            XEN_GUEST_HANDLE(void) capsule_header_array;
+            unsigned long capsule_count;
+            uint64_t max_capsule_size;
+            unsigned int reset_type;
+        } query_capsule_capabilities;
+
+        struct {
+            XEN_GUEST_HANDLE(void) capsule_header_array;
+            unsigned long capsule_count;
+            uint64_t sg_list; /* machine address */
+        } update_capsule;
     } u;
 };
 typedef struct xenpf_efi_runtime_call xenpf_efi_runtime_call_t;
@@ -194,6 +217,7 @@
 #define  XEN_FW_EFI_CONFIG_TABLE   1
 #define  XEN_FW_EFI_VENDOR         2
 #define  XEN_FW_EFI_MEM_INFO       3
+#define  XEN_FW_EFI_RT_VERSION     4
 struct xenpf_firmware_info {
     /* IN variables. */
     uint32_t type;
@@ -304,6 +328,7 @@
 #define XEN_PM_CX   0
 #define XEN_PM_PX   1
 #define XEN_PM_TX   2
+#define XEN_PM_PDC  3
 
 /* Px sub info type */
 #define XEN_PX_PCT   1
@@ -401,6 +426,7 @@
     union {
         struct xen_processor_power          power;/* Cx: _CST/_CSD */
         struct xen_processor_performance    perf; /* Px: _PPC/_PCT/_PSS/_PSD */
+        XEN_GUEST_HANDLE(uint32)            pdc;  /* _PDC */
     } u;
 };
 typedef struct xenpf_set_processor_pminfo xenpf_set_processor_pminfo_t;
diff -r c42e42e6047f -r 7338608af801 include/xen/interface/sysctl.h
--- a/include/xen/interface/sysctl.h	Tue Oct 04 10:41:20 2011 +0200
+++ b/include/xen/interface/sysctl.h	Tue Oct 04 11:16:59 2011 +0200
@@ -399,6 +399,7 @@
 #define PG_OFFLINE_OFFLINED  (0x1UL << 1)
 #define PG_OFFLINE_PENDING   (0x1UL << 2)
 #define PG_OFFLINE_FAILED    (0x1UL << 3)
+#define PG_OFFLINE_AGAIN     (0x1UL << 4)
 
 #define PG_ONLINE_FAILED     PG_OFFLINE_FAILED
 #define PG_ONLINE_ONLINED    PG_OFFLINE_OFFLINED

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

From xen-changelog-bounces@lists.xensource.com Tue Oct 04 17:02:42 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 04 Oct 2011 17:02:42 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBEwb-0001r8-5t; Tue, 04 Oct 2011 17:02:41 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBEuI-0001o7-54
	for xen-changelog@lists.xensource.com; Tue, 04 Oct 2011 17:00:35 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-182.messagelabs.com!1317772813!20932955!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25902 invoked from network); 5 Oct 2011 00:00:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Oct 2011 00:00:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBEuC-0004o2-Gb
	for xen-changelog@lists.xensource.com; Wed, 05 Oct 2011 01:00:12 +0100
Message-Id: <E1RBEuC-0004o2-Gb@xenbits.xen.org>
Date: Wed, 05 Oct 2011 01:00:11 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] AMD-IOMMU: remove dead variable
	references
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 Jan Beulich <jbeulich@suse.com>
# Date 1317730316 -7200
# Node ID a99d75671a911f9c0d5d11e0fe88a0a65863cb44
# Parent  3d1664cc9e458809e399320204aca8536e401ee1
AMD-IOMMU: remove dead variable references

These got orphaned up by recent changes.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r 3d1664cc9e45 -r a99d75671a91 xen/drivers/passthrough/amd/pci_amd_iommu.c
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c	Fri Sep 30 21:17:47 2011 +0100
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c	Tue Oct 04 14:11:56 2011 +0200
@@ -26,9 +26,6 @@
 #include <asm/amd-iommu.h>
 #include <asm/hvm/svm/amd-iommu-proto.h>
 
-extern bool_t __read_mostly opt_irq_perdev_vector_map;
-extern bool_t __read_mostly iommu_amd_perdev_vector_map;
-
 struct amd_iommu *find_iommu_for_device(int seg, int bdf)
 {
     struct ivrs_mappings *ivrs_mappings = get_ivrs_mappings(seg);
diff -r 3d1664cc9e45 -r a99d75671a91 xen/drivers/passthrough/iommu.c
--- a/xen/drivers/passthrough/iommu.c	Fri Sep 30 21:17:47 2011 +0100
+++ b/xen/drivers/passthrough/iommu.c	Tue Oct 04 14:11:56 2011 +0200
@@ -50,7 +50,6 @@
 bool_t __read_mostly iommu_intremap = 1;
 bool_t __read_mostly iommu_hap_pt_share = 1;
 bool_t __read_mostly iommu_debug;
-bool_t __read_mostly iommu_amd_perdev_vector_map = 1;
 bool_t __read_mostly amd_iommu_perdev_intremap;
 
 static void __init parse_iommu_param(char *s)
@@ -86,8 +85,6 @@
             iommu_dom0_strict = 1;
         else if ( !strcmp(s, "sharept") )
             iommu_hap_pt_share = 1;
-        else if ( !strcmp(s, "no-perdev-vector-map") )
-            iommu_amd_perdev_vector_map = 0;
 
         s = ss + 1;
     } while ( ss );

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

From xen-changelog-bounces@lists.xensource.com Tue Oct 04 17:03:12 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 04 Oct 2011 17:03:12 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBEx4-0001ud-DH; Tue, 04 Oct 2011 17:03:10 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBEuJ-0001oA-Fi
	for xen-changelog@lists.xensource.com; Tue, 04 Oct 2011 17:00:35 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-174.messagelabs.com!1317772815!31796556!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11065 invoked from network); 5 Oct 2011 00:00:16 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-6.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Oct 2011 00:00:16 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBEuD-0004rS-4u
	for xen-changelog@lists.xensource.com; Wed, 05 Oct 2011 01:00:14 +0100
Message-Id: <E1RBEuD-0004rS-4u@xenbits.xen.org>
Date: Wed, 05 Oct 2011 01:00:12 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] introduce xzalloc() & Co
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 Jan Beulich <jbeulich@suse.com>
# Date 1317730526 -7200
# Node ID e09ebf7a31f55bb26c3cce7695a435ed20adf05b
# Parent  a99d75671a911f9c0d5d11e0fe88a0a65863cb44
introduce xzalloc() & Co

Rather than having to match a call to one of the xmalloc() flavors with
a subsequent memset(), introduce a zeroing variant of each of those
flavors.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r a99d75671a91 -r e09ebf7a31f5 xen/common/xmalloc_tlsf.c
--- a/xen/common/xmalloc_tlsf.c	Tue Oct 04 14:11:56 2011 +0200
+++ b/xen/common/xmalloc_tlsf.c	Tue Oct 04 14:15:26 2011 +0200
@@ -585,6 +585,13 @@
     return p;
 }
 
+void *_xzalloc(unsigned long size, unsigned long align)
+{
+    void *p = _xmalloc(size, align);
+
+    return p ? memset(p, 0, size) : p;
+}
+
 void xfree(void *p)
 {
     struct bhdr *b;
diff -r a99d75671a91 -r e09ebf7a31f5 xen/include/acpi/platform/aclinux.h
--- a/xen/include/acpi/platform/aclinux.h	Tue Oct 04 14:11:56 2011 +0200
+++ b/xen/include/acpi/platform/aclinux.h	Tue Oct 04 14:15:26 2011 +0200
@@ -77,10 +77,7 @@
 #define acpi_thread_id struct vcpu *
 
 #define ACPI_ALLOCATE(a)	xmalloc_bytes(a)
-#define ACPI_ALLOCATE_ZEROED(a)	({              \
-    void *p = xmalloc_bytes(a);                 \
-    if ( p ) memset(p, 0, a);                   \
-    p; })
+#define ACPI_ALLOCATE_ZEROED(a)	xzalloc_bytes(a)
 #define ACPI_FREE(a)		xfree(a)
 
 #endif				/* __ACLINUX_H__ */
diff -r a99d75671a91 -r e09ebf7a31f5 xen/include/xen/xmalloc.h
--- a/xen/include/xen/xmalloc.h	Tue Oct 04 14:11:56 2011 +0200
+++ b/xen/include/xen/xmalloc.h	Tue Oct 04 14:15:26 2011 +0200
@@ -11,19 +11,25 @@
 
 /* Allocate space for typed object. */
 #define xmalloc(_type) ((_type *)_xmalloc(sizeof(_type), __alignof__(_type)))
+#define xzalloc(_type) ((_type *)_xzalloc(sizeof(_type), __alignof__(_type)))
 
 /* Allocate space for array of typed objects. */
 #define xmalloc_array(_type, _num) \
     ((_type *)_xmalloc_array(sizeof(_type), __alignof__(_type), _num))
+#define xzalloc_array(_type, _num) \
+    ((_type *)_xzalloc_array(sizeof(_type), __alignof__(_type), _num))
 
 /* Allocate untyped storage. */
-#define xmalloc_bytes(_bytes) (_xmalloc(_bytes, SMP_CACHE_BYTES))
+#define xmalloc_bytes(_bytes) _xmalloc(_bytes, SMP_CACHE_BYTES)
+#define xzalloc_bytes(_bytes) _xzalloc(_bytes, SMP_CACHE_BYTES)
 
 /* Free any of the above. */
 extern void xfree(void *);
 
 /* Underlying functions */
 extern void *_xmalloc(unsigned long size, unsigned long align);
+extern void *_xzalloc(unsigned long size, unsigned long align);
+
 static inline void *_xmalloc_array(
     unsigned long size, unsigned long align, unsigned long num)
 {
@@ -33,6 +39,15 @@
  	return _xmalloc(size * num, align);
 }
 
+static inline void *_xzalloc_array(
+    unsigned long size, unsigned long align, unsigned long num)
+{
+    /* Check for overflow. */
+    if (size && num > UINT_MAX / size)
+        return NULL;
+    return _xzalloc(size * num, align);
+}
+
 /*
  * Pooled allocator interface.
  */

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

From xen-changelog-bounces@lists.xensource.com Tue Oct 04 17:03:35 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 04 Oct 2011 17:03:35 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBExT-0001xr-9C; Tue, 04 Oct 2011 17:03:35 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBEuK-0001oC-P2
	for xen-changelog@lists.xensource.com; Tue, 04 Oct 2011 17:00:35 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-21.messagelabs.com!1317772808!62176097!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20063 invoked from network); 5 Oct 2011 00:00:08 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Oct 2011 00:00:08 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBEuH-0006FR-Ji
	for xen-changelog@lists.xensource.com; Wed, 05 Oct 2011 01:00:17 +0100
Message-Id: <E1RBEuH-0006FR-Ji@xenbits.xen.org>
Date: Wed, 05 Oct 2011 01:00:17 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] use xzalloc in driver code
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 Jan Beulich <jbeulich@suse.com>
# Date 1317730648 -7200
# Node ID 4dc9c522abf516c3f6d4e9f7ef1222eb7fdedb06
# Parent  a42af55d50fb7267126feb84df7b7e687db60ca5
use xzalloc in driver code

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r a42af55d50fb -r 4dc9c522abf5 xen/drivers/acpi/pmstat.c
--- a/xen/drivers/acpi/pmstat.c	Tue Oct 04 14:16:32 2011 +0200
+++ b/xen/drivers/acpi/pmstat.c	Tue Oct 04 14:17:28 2011 +0200
@@ -221,9 +221,8 @@
         return -EAGAIN;
     }
 
-    if ( !(affected_cpus = xmalloc_array(uint32_t, op->u.get_para.cpu_num)) )
+    if ( !(affected_cpus = xzalloc_array(uint32_t, op->u.get_para.cpu_num)) )
         return -ENOMEM;
-    memset(affected_cpus, 0, op->u.get_para.cpu_num * sizeof(uint32_t));
     for_each_cpu_mask(cpu, policy->cpus)
         affected_cpus[j++] = cpu;
     ret = copy_to_guest(op->u.get_para.affected_cpus,
@@ -233,10 +232,8 @@
         return ret;
 
     if ( !(scaling_available_frequencies =
-        xmalloc_array(uint32_t, op->u.get_para.freq_num)) )
+           xzalloc_array(uint32_t, op->u.get_para.freq_num)) )
         return -ENOMEM;
-    memset(scaling_available_frequencies, 0,
-           op->u.get_para.freq_num * sizeof(uint32_t));
     for ( i = 0; i < op->u.get_para.freq_num; i++ )
         scaling_available_frequencies[i] =
                         pmpt->perf.states[i].core_frequency * 1000;
@@ -247,10 +244,8 @@
         return ret;
 
     if ( !(scaling_available_governors =
-        xmalloc_array(char, gov_num * CPUFREQ_NAME_LEN)) )
+           xzalloc_array(char, gov_num * CPUFREQ_NAME_LEN)) )
         return -ENOMEM;
-    memset(scaling_available_governors, 0,
-                gov_num * CPUFREQ_NAME_LEN * sizeof(char));
     if ( (ret = read_scaling_available_governors(scaling_available_governors,
                 gov_num * CPUFREQ_NAME_LEN * sizeof(char))) )
     {
diff -r a42af55d50fb -r 4dc9c522abf5 xen/drivers/cpufreq/cpufreq.c
--- a/xen/drivers/cpufreq/cpufreq.c	Tue Oct 04 14:16:32 2011 +0200
+++ b/xen/drivers/cpufreq/cpufreq.c	Tue Oct 04 14:17:28 2011 +0200
@@ -148,11 +148,10 @@
     }
 
     if (!domexist) {
-        cpufreq_dom = xmalloc(struct cpufreq_dom);
+        cpufreq_dom = xzalloc(struct cpufreq_dom);
         if (!cpufreq_dom)
             return -ENOMEM;
 
-        memset(cpufreq_dom, 0, sizeof(struct cpufreq_dom));
         cpufreq_dom->dom = dom;
         list_add(&cpufreq_dom->node, &cpufreq_dom_list_head);
     } else {
@@ -176,11 +175,10 @@
     }
 
     if (!domexist || hw_all) {
-        policy = xmalloc(struct cpufreq_policy);
+        policy = xzalloc(struct cpufreq_policy);
         if (!policy)
             ret = -ENOMEM;
 
-        memset(policy, 0, sizeof(struct cpufreq_policy));
         policy->cpu = cpu;
         per_cpu(cpufreq_cpu_policy, cpu) = policy;
 
@@ -374,13 +372,12 @@
     pmpt = processor_pminfo[cpuid];
     if ( !pmpt )
     {
-        pmpt = xmalloc(struct processor_pminfo);
+        pmpt = xzalloc(struct processor_pminfo);
         if ( !pmpt )
         {
             ret = -ENOMEM;
             goto out;
         }
-        memset(pmpt, 0, sizeof(*pmpt));
         processor_pminfo[cpuid] = pmpt;
     }
     pxpt = &pmpt->perf;
diff -r a42af55d50fb -r 4dc9c522abf5 xen/drivers/cpufreq/utility.c
--- a/xen/drivers/cpufreq/utility.c	Tue Oct 04 14:16:32 2011 +0200
+++ b/xen/drivers/cpufreq/utility.c	Tue Oct 04 14:17:28 2011 +0200
@@ -110,22 +110,21 @@
 
     count = pmpt->perf.state_count;
 
-    pxpt = xmalloc(struct pm_px);
+    pxpt = xzalloc(struct pm_px);
     if ( !pxpt ) {
         spin_unlock(cpufreq_statistic_lock);
         return -ENOMEM;
     }
-    memset(pxpt, 0, sizeof(*pxpt));
     per_cpu(cpufreq_statistic_data, cpuid) = pxpt;
 
-    pxpt->u.trans_pt = xmalloc_array(uint64_t, count * count);
+    pxpt->u.trans_pt = xzalloc_array(uint64_t, count * count);
     if (!pxpt->u.trans_pt) {
         xfree(pxpt);
         spin_unlock(cpufreq_statistic_lock);
         return -ENOMEM;
     }
 
-    pxpt->u.pt = xmalloc_array(struct pm_px_val, count);
+    pxpt->u.pt = xzalloc_array(struct pm_px_val, count);
     if (!pxpt->u.pt) {
         xfree(pxpt->u.trans_pt);
         xfree(pxpt);
@@ -133,9 +132,6 @@
         return -ENOMEM;
     }
 
-    memset(pxpt->u.trans_pt, 0, count * count * (sizeof(uint64_t)));
-    memset(pxpt->u.pt, 0, count * (sizeof(struct pm_px_val)));
-
     pxpt->u.total = pmpt->perf.state_count;
     pxpt->u.usable = pmpt->perf.state_count - pmpt->perf.platform_limit;
 
diff -r a42af55d50fb -r 4dc9c522abf5 xen/drivers/passthrough/amd/iommu_detect.c
--- a/xen/drivers/passthrough/amd/iommu_detect.c	Tue Oct 04 14:16:32 2011 +0200
+++ b/xen/drivers/passthrough/amd/iommu_detect.c	Tue Oct 04 14:17:28 2011 +0200
@@ -111,13 +111,12 @@
         return -ENODEV;
     }
 
-    iommu = (struct amd_iommu *) xmalloc(struct amd_iommu);
+    iommu = xzalloc(struct amd_iommu);
     if ( !iommu )
     {
         AMD_IOMMU_DEBUG("Error allocating amd_iommu\n");
         return -ENOMEM;
     }
-    memset(iommu, 0, sizeof(struct amd_iommu));
 
     spin_lock_init(&iommu->lock);
 
diff -r a42af55d50fb -r 4dc9c522abf5 xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c	Tue Oct 04 14:16:32 2011 +0200
+++ b/xen/drivers/passthrough/amd/iommu_init.c	Tue Oct 04 14:17:28 2011 +0200
@@ -779,13 +779,12 @@
     if ( get_ivrs_mappings(seg) )
         return 0;
 
-    ivrs_mappings = xmalloc_array(struct ivrs_mappings, ivrs_bdf_entries + 1);
+    ivrs_mappings = xzalloc_array(struct ivrs_mappings, ivrs_bdf_entries + 1);
     if ( ivrs_mappings == NULL )
     {
         AMD_IOMMU_DEBUG("Error allocating IVRS Mappings table\n");
         return -ENOMEM;
     }
-    memset(ivrs_mappings, 0, ivrs_bdf_entries * sizeof(struct ivrs_mappings));
     IVRS_MAPPINGS_SEG(ivrs_mappings) = seg;
 
     /* assign default values for device entries */
diff -r a42af55d50fb -r 4dc9c522abf5 xen/drivers/passthrough/io.c
--- a/xen/drivers/passthrough/io.c	Tue Oct 04 14:16:32 2011 +0200
+++ b/xen/drivers/passthrough/io.c	Tue Oct 04 14:17:28 2011 +0200
@@ -115,13 +115,12 @@
     hvm_irq_dpci = domain_get_irq_dpci(d);
     if ( hvm_irq_dpci == NULL )
     {
-        hvm_irq_dpci = xmalloc(struct hvm_irq_dpci);
+        hvm_irq_dpci = xzalloc(struct hvm_irq_dpci);
         if ( hvm_irq_dpci == NULL )
         {
             spin_unlock(&d->event_lock);
             return -ENOMEM;
         }
-        memset(hvm_irq_dpci, 0, sizeof(*hvm_irq_dpci));
         softirq_tasklet_init(
             &hvm_irq_dpci->dirq_tasklet,
             hvm_dirq_assist, (unsigned long)d);
diff -r a42af55d50fb -r 4dc9c522abf5 xen/drivers/passthrough/pci.c
--- a/xen/drivers/passthrough/pci.c	Tue Oct 04 14:16:32 2011 +0200
+++ b/xen/drivers/passthrough/pci.c	Tue Oct 04 14:17:28 2011 +0200
@@ -60,14 +60,13 @@
     if ( pseg )
         return pseg;
 
-    pseg = xmalloc(struct pci_seg);
+    pseg = xzalloc(struct pci_seg);
     if ( !pseg )
         return NULL;
 
     pseg->nr = seg;
     INIT_LIST_HEAD(&pseg->alldevs_list);
     spin_lock_init(&pseg->bus2bridge_lock);
-    memset(pseg->bus2bridge, 0, sizeof(pseg->bus2bridge));
 
     if ( radix_tree_insert(&pci_segments, seg, pseg) )
     {
@@ -116,10 +115,9 @@
         if ( pdev->bus == bus && pdev->devfn == devfn )
             return pdev;
 
-    pdev = xmalloc(struct pci_dev);
+    pdev = xzalloc(struct pci_dev);
     if ( !pdev )
         return NULL;
-    memset(pdev, 0, sizeof(struct pci_dev));
 
     *(u16*) &pdev->seg = pseg->nr;
     *((u8*) &pdev->bus) = bus;
diff -r a42af55d50fb -r 4dc9c522abf5 xen/drivers/passthrough/vtd/dmar.c
--- a/xen/drivers/passthrough/vtd/dmar.c	Tue Oct 04 14:16:32 2011 +0200
+++ b/xen/drivers/passthrough/vtd/dmar.c	Tue Oct 04 14:17:28 2011 +0200
@@ -291,10 +291,9 @@
     scope->devices_cnt = cnt;
     if ( cnt > 0 )
     {
-        scope->devices = xmalloc_array(u16, cnt);
+        scope->devices = xzalloc_array(u16, cnt);
         if ( !scope->devices )
             return -ENOMEM;
-        memset(scope->devices, 0, sizeof(u16) * cnt);
     }
 
     while ( start < end )
@@ -400,10 +399,9 @@
     if ( (ret = acpi_dmar_check_length(header, sizeof(*drhd))) != 0 )
         return ret;
 
-    dmaru = xmalloc(struct acpi_drhd_unit);
+    dmaru = xzalloc(struct acpi_drhd_unit);
     if ( !dmaru )
         return -ENOMEM;
-    memset(dmaru, 0, sizeof(struct acpi_drhd_unit));
 
     dmaru->address = drhd->address;
     dmaru->segment = drhd->segment;
@@ -530,10 +528,9 @@
     }
 #endif
 
-    rmrru = xmalloc(struct acpi_rmrr_unit);
+    rmrru = xzalloc(struct acpi_rmrr_unit);
     if ( !rmrru )
         return -ENOMEM;
-    memset(rmrru, 0, sizeof(struct acpi_rmrr_unit));
 
     rmrru->base_address = base_addr;
     rmrru->end_address = end_addr;
@@ -615,10 +612,9 @@
     if ( (ret = acpi_dmar_check_length(header, sizeof(*atsr))) != 0 )
         return ret;
 
-    atsru = xmalloc(struct acpi_atsr_unit);
+    atsru = xzalloc(struct acpi_atsr_unit);
     if ( !atsru )
         return -ENOMEM;
-    memset(atsru, 0, sizeof(struct acpi_atsr_unit));
 
     atsru->segment = atsr->segment;
     atsru->all_ports = atsr->flags & 1; /* BIT0: ALL_PORTS */
@@ -664,10 +660,9 @@
     if ( (ret = acpi_dmar_check_length(header, sizeof(*rhsa))) != 0 )
         return ret;
 
-    rhsau = xmalloc(struct acpi_rhsa_unit);
+    rhsau = xzalloc(struct acpi_rhsa_unit);
     if ( !rhsau )
         return -ENOMEM;
-    memset(rhsau, 0, sizeof(struct acpi_rhsa_unit));
 
     rhsau->address = rhsa->address;
     rhsau->proximity_domain = rhsa->proximity_domain;
diff -r a42af55d50fb -r 4dc9c522abf5 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Tue Oct 04 14:16:32 2011 +0200
+++ b/xen/drivers/passthrough/vtd/iommu.c	Tue Oct 04 14:17:28 2011 +0200
@@ -138,10 +138,9 @@
 {
     struct intel_iommu *intel;
 
-    intel = xmalloc(struct intel_iommu);
+    intel = xzalloc(struct intel_iommu);
     if ( intel == NULL )
         return NULL;
-    memset(intel, 0, sizeof(struct intel_iommu));
 
     spin_lock_init(&intel->qi_ctrl.qinval_lock);
     spin_lock_init(&intel->ir_ctrl.iremap_lock);
@@ -1098,10 +1097,9 @@
         return -ENOMEM;
     }
 
-    iommu = xmalloc(struct iommu);
+    iommu = xzalloc(struct iommu);
     if ( iommu == NULL )
         return -ENOMEM;
-    memset(iommu, 0, sizeof(struct iommu));
 
     iommu->irq = -1; /* No irq assigned yet. */
 
@@ -1157,10 +1155,9 @@
 
     /* allocate domain id bitmap */
     nr_dom = cap_ndoms(iommu->cap);
-    iommu->domid_bitmap = xmalloc_array(unsigned long, BITS_TO_LONGS(nr_dom));
+    iommu->domid_bitmap = xzalloc_array(unsigned long, BITS_TO_LONGS(nr_dom));
     if ( !iommu->domid_bitmap )
         return -ENOMEM ;
-    memset(iommu->domid_bitmap, 0, nr_dom / 8);
 
     /*
      * if Caching mode is set, then invalid translations are tagged with
@@ -1169,10 +1166,9 @@
     if ( cap_caching_mode(iommu->cap) )
         set_bit(0, iommu->domid_bitmap);
 
-    iommu->domid_map = xmalloc_array(u16, nr_dom);
+    iommu->domid_map = xzalloc_array(u16, nr_dom);
     if ( !iommu->domid_map )
         return -ENOMEM ;
-    memset(iommu->domid_map, 0, nr_dom * sizeof(*iommu->domid_map));
 
     spin_lock_init(&iommu->lock);
     spin_lock_init(&iommu->register_lock);
diff -r a42af55d50fb -r 4dc9c522abf5 xen/drivers/video/vesa.c
--- a/xen/drivers/video/vesa.c	Tue Oct 04 14:16:32 2011 +0200
+++ b/xen/drivers/video/vesa.c	Tue Oct 04 14:17:28 2011 +0200
@@ -93,11 +93,11 @@
     if ( !lbuf )
         goto fail;
 
-    text_buf = xmalloc_bytes(text_columns * text_rows);
+    text_buf = xzalloc_bytes(text_columns * text_rows);
     if ( !text_buf )
         goto fail;
 
-    line_len = xmalloc_array(unsigned int, text_columns);
+    line_len = xzalloc_array(unsigned int, text_columns);
     if ( !line_len )
         goto fail;
 
@@ -108,8 +108,6 @@
         goto fail;
 
     lfb = memset((void *)IOREMAP_VIRT_START, 0, vram_remap);
-    memset(text_buf, 0, text_columns * text_rows);
-    memset(line_len, 0, text_columns * sizeof(*line_len));
 
     vga_puts = vesa_redraw_puts;
 

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

From xen-changelog-bounces@lists.xensource.com Tue Oct 04 17:03:58 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 04 Oct 2011 17:03:59 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBExp-00020p-VR; Tue, 04 Oct 2011 17:03:58 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBEuM-0001oD-QY
	for xen-changelog@lists.xensource.com; Tue, 04 Oct 2011 17:00:35 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1317772819!27884446!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18708 invoked from network); 5 Oct 2011 00:00:19 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Oct 2011 00:00:19 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBEuI-0006Hc-8U
	for xen-changelog@lists.xensource.com; Wed, 05 Oct 2011 01:00:18 +0100
Message-Id: <E1RBEuI-0006Hc-8U@xenbits.xen.org>
Date: Wed, 05 Oct 2011 01:00:17 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] use xzalloc in x86 code
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 Jan Beulich <jbeulich@suse.com>
# Date 1317730710 -7200
# Node ID 0b66e6450ffe6823d8b323ef4248b38fe7372d54
# Parent  4dc9c522abf516c3f6d4e9f7ef1222eb7fdedb06
use xzalloc in x86 code

This includes the removal of a redundant memset() from microcode_amd.c.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r 4dc9c522abf5 -r 0b66e6450ffe xen/arch/x86/acpi/cpu_idle.c
--- a/xen/arch/x86/acpi/cpu_idle.c	Tue Oct 04 14:17:28 2011 +0200
+++ b/xen/arch/x86/acpi/cpu_idle.c	Tue Oct 04 14:18:30 2011 +0200
@@ -602,10 +602,9 @@
     if ( !acpi_power )
     {
         int i;
-        acpi_power = xmalloc(struct acpi_processor_power);
+        acpi_power = xzalloc(struct acpi_processor_power);
         if ( !acpi_power )
             return -ENOMEM;
-        memset(acpi_power, 0, sizeof(*acpi_power));
 
         for ( i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++ )
             acpi_power->states[i].idx = i;
diff -r 4dc9c522abf5 -r 0b66e6450ffe xen/arch/x86/acpi/cpufreq/cpufreq.c
--- a/xen/arch/x86/acpi/cpufreq/cpufreq.c	Tue Oct 04 14:17:28 2011 +0200
+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c	Tue Oct 04 14:18:30 2011 +0200
@@ -552,10 +552,9 @@
     struct cpuinfo_x86 *c = &cpu_data[policy->cpu];
     struct processor_performance *perf;
 
-    data = xmalloc(struct acpi_cpufreq_data);
+    data = xzalloc(struct acpi_cpufreq_data);
     if (!data)
         return -ENOMEM;
-    memset(data, 0, sizeof(struct acpi_cpufreq_data));
 
     cpufreq_drv_data[cpu] = data;
 
diff -r 4dc9c522abf5 -r 0b66e6450ffe xen/arch/x86/acpi/cpufreq/powernow.c
--- a/xen/arch/x86/acpi/cpufreq/powernow.c	Tue Oct 04 14:17:28 2011 +0200
+++ b/xen/arch/x86/acpi/cpufreq/powernow.c	Tue Oct 04 14:18:30 2011 +0200
@@ -189,10 +189,9 @@
     uint64_t msr_content;
     struct cpuinfo_x86 *c = &cpu_data[policy->cpu];
 
-    data = xmalloc(struct acpi_cpufreq_data);
+    data = xzalloc(struct acpi_cpufreq_data);
     if (!data)
         return -ENOMEM;
-    memset(data, 0, sizeof(struct acpi_cpufreq_data));
 
     cpufreq_drv_data[cpu] = data;
 
diff -r 4dc9c522abf5 -r 0b66e6450ffe xen/arch/x86/cpu/mcheck/mce.c
--- a/xen/arch/x86/cpu/mcheck/mce.c	Tue Oct 04 14:17:28 2011 +0200
+++ b/xen/arch/x86/cpu/mcheck/mce.c	Tue Oct 04 14:18:30 2011 +0200
@@ -113,7 +113,7 @@
     if (!mb)
         return NULL;
 
-    mb->bank_map = xmalloc_array(unsigned long,
+    mb->bank_map = xzalloc_array(unsigned long,
                                  BITS_TO_LONGS(nr_mce_banks));
     if (!mb->bank_map)
     {
@@ -122,7 +122,6 @@
     }
 
     mb->num = nr_mce_banks;
-    memset(mb->bank_map, 0, sizeof(long) * BITS_TO_LONGS(nr_mce_banks));
 
     return mb;
 }
diff -r 4dc9c522abf5 -r 0b66e6450ffe xen/arch/x86/cpu/mcheck/vmce.c
--- a/xen/arch/x86/cpu/mcheck/vmce.c	Tue Oct 04 14:17:28 2011 +0200
+++ b/xen/arch/x86/cpu/mcheck/vmce.c	Tue Oct 04 14:18:30 2011 +0200
@@ -362,14 +362,13 @@
 {
     struct bank_entry *entry;
 
-    entry = xmalloc(struct bank_entry);
+    entry = xzalloc(struct bank_entry);
     if ( entry == NULL )
     {
         printk(KERN_ERR "MCE: malloc bank_entry failed\n");
         return NULL;
     }
 
-    memset(entry, 0x0, sizeof(entry));
     INIT_LIST_HEAD(&entry->list);
     return entry;
 }
diff -r 4dc9c522abf5 -r 0b66e6450ffe xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c	Tue Oct 04 14:17:28 2011 +0200
+++ b/xen/arch/x86/domain.c	Tue Oct 04 14:18:30 2011 +0200
@@ -563,11 +563,10 @@
 
     if ( !is_idle_domain(d) )
     {
-        d->arch.cpuids = xmalloc_array(cpuid_input_t, MAX_CPUID_INPUT);
+        d->arch.cpuids = xzalloc_array(cpuid_input_t, MAX_CPUID_INPUT);
         rc = -ENOMEM;
         if ( d->arch.cpuids == NULL )
             goto fail;
-        memset(d->arch.cpuids, 0, MAX_CPUID_INPUT * sizeof(*d->arch.cpuids));
         for ( i = 0; i < MAX_CPUID_INPUT; i++ )
         {
             d->arch.cpuids[i].input[0] = XEN_CPUID_INPUT_UNUSED;
diff -r 4dc9c522abf5 -r 0b66e6450ffe xen/arch/x86/domain_build.c
--- a/xen/arch/x86/domain_build.c	Tue Oct 04 14:17:28 2011 +0200
+++ b/xen/arch/x86/domain_build.c	Tue Oct 04 14:18:30 2011 +0200
@@ -92,10 +92,9 @@
     if ( opt_dom0_max_vcpus > MAX_VIRT_CPUS )
         opt_dom0_max_vcpus = MAX_VIRT_CPUS;
 
-    dom0->vcpu = xmalloc_array(struct vcpu *, opt_dom0_max_vcpus);
+    dom0->vcpu = xzalloc_array(struct vcpu *, opt_dom0_max_vcpus);
     if ( !dom0->vcpu )
         return NULL;
-    memset(dom0->vcpu, 0, opt_dom0_max_vcpus * sizeof(*dom0->vcpu));
     dom0->max_vcpus = opt_dom0_max_vcpus;
 
     return alloc_vcpu(dom0, 0, 0);
diff -r 4dc9c522abf5 -r 0b66e6450ffe xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c	Tue Oct 04 14:17:28 2011 +0200
+++ b/xen/arch/x86/hpet.c	Tue Oct 04 14:18:30 2011 +0200
@@ -365,10 +365,9 @@
     num_chs = ((id & HPET_ID_NUMBER) >> HPET_ID_NUMBER_SHIFT);
     num_chs++; /* Value read out starts from 0 */
 
-    hpet_events = xmalloc_array(struct hpet_event_channel, num_chs);
+    hpet_events = xzalloc_array(struct hpet_event_channel, num_chs);
     if ( !hpet_events )
         return;
-    memset(hpet_events, 0, num_chs * sizeof(*hpet_events));
 
     for ( i = 0; i < num_chs; i++ )
     {
@@ -504,10 +503,9 @@
             return;
 
         if ( !hpet_events )
-            hpet_events = xmalloc(struct hpet_event_channel);
+            hpet_events = xzalloc(struct hpet_event_channel);
         if ( !hpet_events )
             return;
-        memset(hpet_events, 0, sizeof(*hpet_events));
         hpet_events->irq = -1;
 
         /* Start HPET legacy interrupts */
diff -r 4dc9c522abf5 -r 0b66e6450ffe xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c	Tue Oct 04 14:17:28 2011 +0200
+++ b/xen/arch/x86/hvm/hvm.c	Tue Oct 04 14:18:30 2011 +0200
@@ -444,17 +444,13 @@
     INIT_LIST_HEAD(&d->arch.hvm_domain.msixtbl_list);
     spin_lock_init(&d->arch.hvm_domain.msixtbl_list_lock);
 
-    d->arch.hvm_domain.pbuf = xmalloc_array(char, HVM_PBUF_SIZE);
-    d->arch.hvm_domain.params = xmalloc_array(uint64_t, HVM_NR_PARAMS);
+    d->arch.hvm_domain.pbuf = xzalloc_array(char, HVM_PBUF_SIZE);
+    d->arch.hvm_domain.params = xzalloc_array(uint64_t, HVM_NR_PARAMS);
     d->arch.hvm_domain.io_handler = xmalloc(struct hvm_io_handler);
     rc = -ENOMEM;
     if ( !d->arch.hvm_domain.pbuf || !d->arch.hvm_domain.params ||
          !d->arch.hvm_domain.io_handler )
         goto fail0;
-    memset(d->arch.hvm_domain.pbuf, 0,
-           HVM_PBUF_SIZE * sizeof(*d->arch.hvm_domain.pbuf));
-    memset(d->arch.hvm_domain.params, 0,
-           HVM_NR_PARAMS * sizeof(*d->arch.hvm_domain.params));
     d->arch.hvm_domain.io_handler->num_slot = 0;
 
     hvm_init_guest_time(d);
diff -r 4dc9c522abf5 -r 0b66e6450ffe xen/arch/x86/hvm/mtrr.c
--- a/xen/arch/x86/hvm/mtrr.c	Tue Oct 04 14:17:28 2011 +0200
+++ b/xen/arch/x86/hvm/mtrr.c	Tue Oct 04 14:18:30 2011 +0200
@@ -202,10 +202,9 @@
 
     memset(m, 0, sizeof(*m));
 
-    m->var_ranges = xmalloc_array(struct mtrr_var_range, MTRR_VCNT);
+    m->var_ranges = xzalloc_array(struct mtrr_var_range, MTRR_VCNT);
     if ( m->var_ranges == NULL )
         return -ENOMEM;
-    memset(m->var_ranges, 0, MTRR_VCNT * sizeof(struct mtrr_var_range));
 
     m->mtrr_cap = (1u << 10) | (1u << 8) | MTRR_VCNT;
 
@@ -608,12 +607,10 @@
          !is_hvm_domain(d) )
         return -EINVAL;
 
-    range = xmalloc(struct hvm_mem_pinned_cacheattr_range);
+    range = xzalloc(struct hvm_mem_pinned_cacheattr_range);
     if ( range == NULL )
         return -ENOMEM;
 
-    memset(range, 0, sizeof(*range));
-
     range->start = gfn_start;
     range->end = gfn_end;
     range->type = type;
diff -r 4dc9c522abf5 -r 0b66e6450ffe xen/arch/x86/hvm/svm/vpmu.c
--- a/xen/arch/x86/hvm/svm/vpmu.c	Tue Oct 04 14:17:28 2011 +0200
+++ b/xen/arch/x86/hvm/svm/vpmu.c	Tue Oct 04 14:18:30 2011 +0200
@@ -323,8 +323,7 @@
 	 }
     }
 
-    ctxt = xmalloc_bytes(sizeof(struct amd_vpmu_context));
-
+    ctxt = xzalloc_bytes(sizeof(struct amd_vpmu_context));
     if ( !ctxt )
     {
         gdprintk(XENLOG_WARNING, "Insufficient memory for PMU, "
@@ -333,7 +332,6 @@
         return;
     }
 
-    memset(ctxt, 0, sizeof(struct amd_vpmu_context));
     vpmu->context = (void *)ctxt;
     vpmu->flags |= VPMU_CONTEXT_ALLOCATED;
 }
diff -r 4dc9c522abf5 -r 0b66e6450ffe xen/arch/x86/hvm/vmx/vpmu_core2.c
--- a/xen/arch/x86/hvm/vmx/vpmu_core2.c	Tue Oct 04 14:17:28 2011 +0200
+++ b/xen/arch/x86/hvm/vmx/vpmu_core2.c	Tue Oct 04 14:18:30 2011 +0200
@@ -328,19 +328,15 @@
     vmx_write_guest_msr(MSR_CORE_PERF_GLOBAL_CTRL,
                  core2_calc_intial_glb_ctrl_msr());
 
-    pmu_enable = xmalloc_bytes(sizeof(struct core2_pmu_enable) +
-                 (core2_get_pmc_count()-1)*sizeof(char));
+    pmu_enable = xzalloc_bytes(sizeof(struct core2_pmu_enable) +
+                               core2_get_pmc_count() - 1);
     if ( !pmu_enable )
         goto out1;
-    memset(pmu_enable, 0, sizeof(struct core2_pmu_enable) +
-                 (core2_get_pmc_count()-1)*sizeof(char));
 
-    core2_vpmu_cxt = xmalloc_bytes(sizeof(struct core2_vpmu_context) +
+    core2_vpmu_cxt = xzalloc_bytes(sizeof(struct core2_vpmu_context) +
                     (core2_get_pmc_count()-1)*sizeof(struct arch_msr_pair));
     if ( !core2_vpmu_cxt )
         goto out2;
-    memset(core2_vpmu_cxt, 0, sizeof(struct core2_vpmu_context) +
-                    (core2_get_pmc_count()-1)*sizeof(struct arch_msr_pair));
     core2_vpmu_cxt->pmu_enable = pmu_enable;
     vpmu->context = (void *)core2_vpmu_cxt;
 
diff -r 4dc9c522abf5 -r 0b66e6450ffe xen/arch/x86/i387.c
--- a/xen/arch/x86/i387.c	Tue Oct 04 14:17:28 2011 +0200
+++ b/xen/arch/x86/i387.c	Tue Oct 04 14:18:30 2011 +0200
@@ -245,13 +245,12 @@
         v->arch.fpu_ctxt = &v->arch.xsave_area->fpu_sse;
     else
     {
-        v->arch.fpu_ctxt = _xmalloc(sizeof(v->arch.xsave_area->fpu_sse), 16);
+        v->arch.fpu_ctxt = _xzalloc(sizeof(v->arch.xsave_area->fpu_sse), 16);
         if ( !v->arch.fpu_ctxt )
         {
             rc = -ENOMEM;
             goto done;
         }
-        memset(v->arch.fpu_ctxt, 0, sizeof(v->arch.xsave_area->fpu_sse));
     }
 
 done:
diff -r 4dc9c522abf5 -r 0b66e6450ffe xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Tue Oct 04 14:17:28 2011 +0200
+++ b/xen/arch/x86/io_apic.c	Tue Oct 04 14:18:30 2011 +0200
@@ -1365,8 +1365,7 @@
     int i, apic;
 
     /* Initialise dynamic irq_2_pin free list. */
-    irq_2_pin = xmalloc_array(struct irq_pin_list, PIN_MAP_SIZE);
-    memset(irq_2_pin, 0, PIN_MAP_SIZE * sizeof(*irq_2_pin));
+    irq_2_pin = xzalloc_array(struct irq_pin_list, PIN_MAP_SIZE);
         
     for (i = 0; i < PIN_MAP_SIZE; i++)
         irq_2_pin[i].pin = -1;
diff -r 4dc9c522abf5 -r 0b66e6450ffe xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Tue Oct 04 14:17:28 2011 +0200
+++ b/xen/arch/x86/irq.c	Tue Oct 04 14:18:30 2011 +0200
@@ -328,17 +328,13 @@
     for (vector = 0; vector < NR_VECTORS; ++vector)
         this_cpu(vector_irq)[vector] = -1;
 
-    irq_desc = xmalloc_array(struct irq_desc, nr_irqs);
-    irq_cfg = xmalloc_array(struct irq_cfg, nr_irqs);
-    irq_vector = xmalloc_array(u8, nr_irqs_gsi);
+    irq_desc = xzalloc_array(struct irq_desc, nr_irqs);
+    irq_cfg = xzalloc_array(struct irq_cfg, nr_irqs);
+    irq_vector = xzalloc_array(u8, nr_irqs_gsi);
     
     if ( !irq_desc || !irq_cfg ||! irq_vector )
         return -ENOMEM;
 
-    memset(irq_desc, 0,  nr_irqs * sizeof(*irq_desc));
-    memset(irq_cfg, 0,  nr_irqs * sizeof(*irq_cfg));
-    memset(irq_vector, 0, nr_irqs_gsi * sizeof(*irq_vector));
-    
     for (irq = 0; irq < nr_irqs; irq++) {
         desc = irq_to_desc(irq);
         cfg = irq_cfg(irq);
@@ -1112,11 +1108,10 @@
 {
     size_t sz = is_hvm_domain(d) ? sizeof(struct pirq) :
                                    offsetof(struct pirq, arch.hvm);
-    struct pirq *pirq = xmalloc_bytes(sz);
+    struct pirq *pirq = xzalloc_bytes(sz);
 
     if ( pirq )
     {
-        memset(pirq, 0, sz);
         if ( is_hvm_domain(d) )
         {
             pirq->arch.hvm.emuirq = IRQ_UNBOUND;
diff -r 4dc9c522abf5 -r 0b66e6450ffe xen/arch/x86/microcode_amd.c
--- a/xen/arch/x86/microcode_amd.c	Tue Oct 04 14:17:28 2011 +0200
+++ b/xen/arch/x86/microcode_amd.c	Tue Oct 04 14:18:30 2011 +0200
@@ -231,7 +231,6 @@
         return -ENOMEM;
     }
 
-    memset(equiv_cpu_table, 0, size);
     memcpy(equiv_cpu_table, (const void *)&buf_pos[3], size);
 
     *offset = size + 12;	/* add header length */
diff -r 4dc9c522abf5 -r 0b66e6450ffe xen/arch/x86/mm/shadow/common.c
--- a/xen/arch/x86/mm/shadow/common.c	Tue Oct 04 14:17:28 2011 +0200
+++ b/xen/arch/x86/mm/shadow/common.c	Tue Oct 04 14:18:30 2011 +0200
@@ -1922,10 +1922,8 @@
     ASSERT(paging_locked_by_me(d));
     ASSERT(!d->arch.paging.shadow.hash_table);
 
-    table = xmalloc_array(struct page_info *, SHADOW_HASH_BUCKETS);
+    table = xzalloc_array(struct page_info *, SHADOW_HASH_BUCKETS);
     if ( !table ) return 1;
-    memset(table, 0, 
-           SHADOW_HASH_BUCKETS * sizeof (struct page_info *));
     d->arch.paging.shadow.hash_table = table;
     return 0;
 }
@@ -2816,7 +2814,7 @@
     /* Make sure this vcpu has a virtual TLB array allocated */
     if ( unlikely(!v->arch.paging.vtlb) )
     {
-        v->arch.paging.vtlb = xmalloc_array(struct shadow_vtlb, VTLB_ENTRIES);
+        v->arch.paging.vtlb = xzalloc_array(struct shadow_vtlb, VTLB_ENTRIES);
         if ( unlikely(!v->arch.paging.vtlb) )
         {
             SHADOW_ERROR("Could not allocate vTLB space for dom %u vcpu %u\n",
@@ -2824,8 +2822,6 @@
             domain_crash(v->domain);
             return;
         }
-        memset(v->arch.paging.vtlb, 0, 
-               VTLB_ENTRIES * sizeof (struct shadow_vtlb));
         spin_lock_init(&v->arch.paging.vtlb_lock);
     }
 #endif /* (SHADOW_OPTIMIZATIONS & SHOPT_VIRTUAL_TLB) */
@@ -3656,9 +3652,8 @@
             goto out_dirty_vram;
         memset(dirty_vram->sl1ma, ~0, sizeof(paddr_t) * nr);
 
-        if ( (dirty_vram->dirty_bitmap = xmalloc_array(uint8_t, dirty_size)) == NULL )
+        if ( (dirty_vram->dirty_bitmap = xzalloc_array(uint8_t, dirty_size)) == NULL )
             goto out_sl1ma;
-        memset(dirty_vram->dirty_bitmap, 0, dirty_size);
 
         dirty_vram->last_dirty = NOW();
 
diff -r 4dc9c522abf5 -r 0b66e6450ffe xen/arch/x86/oprofile/op_model_ppro.c
--- a/xen/arch/x86/oprofile/op_model_ppro.c	Tue Oct 04 14:17:28 2011 +0200
+++ b/xen/arch/x86/oprofile/op_model_ppro.c	Tue Oct 04 14:18:30 2011 +0200
@@ -226,10 +226,9 @@
 	struct vpmu_struct *vpmu = vcpu_vpmu(v);
 	struct arch_msr_pair *msr_content;
 
-	msr_content = xmalloc_bytes( sizeof(struct arch_msr_pair) * num_counters );
+	msr_content = xzalloc_array(struct arch_msr_pair, num_counters);
 	if ( !msr_content )
 		goto out;
-	memset(msr_content, 0, sizeof(struct arch_msr_pair) * num_counters);
 	vpmu->context = (void *)msr_content;
 	vpmu->flags = 0;
 	vpmu->flags |= PASSIVE_DOMAIN_ALLOCATED;
diff -r 4dc9c522abf5 -r 0b66e6450ffe xen/arch/x86/x86_64/mmconfig-shared.c
--- a/xen/arch/x86/x86_64/mmconfig-shared.c	Tue Oct 04 14:17:28 2011 +0200
+++ b/xen/arch/x86/x86_64/mmconfig-shared.c	Tue Oct 04 14:18:30 2011 +0200
@@ -57,10 +57,9 @@
         pci_mmcfg_config_num = 0;
     else {
         pci_mmcfg_config_num = 1;
-        pci_mmcfg_config = xmalloc(struct acpi_mcfg_allocation);
+        pci_mmcfg_config = xzalloc(struct acpi_mcfg_allocation);
         if (!pci_mmcfg_config)
             return NULL;
-        memset(pci_mmcfg_config, 0, sizeof(pci_mmcfg_config[0]));
         pci_mmcfg_config[0].address = win << 16;
         pci_mmcfg_config[0].pci_segment = 0;
         pci_mmcfg_config[0].start_bus_number = 0;
@@ -111,10 +110,9 @@
         pci_mmcfg_config_num = 0;
 
     if (pci_mmcfg_config_num) {
-        pci_mmcfg_config = xmalloc(struct acpi_mcfg_allocation);
+        pci_mmcfg_config = xzalloc(struct acpi_mcfg_allocation);
         if (!pci_mmcfg_config)
             return NULL;
-        memset(pci_mmcfg_config, 0, sizeof(pci_mmcfg_config[0]));
         pci_mmcfg_config[0].address = pciexbar & mask;
         pci_mmcfg_config[0].pci_segment = 0;
         pci_mmcfg_config[0].start_bus_number = 0;
diff -r 4dc9c522abf5 -r 0b66e6450ffe xen/arch/x86/x86_64/mmconfig_64.c
--- a/xen/arch/x86/x86_64/mmconfig_64.c	Tue Oct 04 14:17:28 2011 +0200
+++ b/xen/arch/x86/x86_64/mmconfig_64.c	Tue Oct 04 14:18:30 2011 +0200
@@ -171,13 +171,12 @@
     if (pci_mmcfg_virt)
         return 0;
 
-    pci_mmcfg_virt = xmalloc_array(struct mmcfg_virt, pci_mmcfg_config_num);
+    pci_mmcfg_virt = xzalloc_array(struct mmcfg_virt, pci_mmcfg_config_num);
     if (pci_mmcfg_virt == NULL) {
         printk(KERN_ERR "PCI: Can not allocate memory for mmconfig structures\n");
         pci_mmcfg_config_num = 0;
         return 0;
     }
-    memset(pci_mmcfg_virt, 0, sizeof(*pci_mmcfg_virt) * pci_mmcfg_config_num);
 
     for (i = 0; i < pci_mmcfg_config_num; ++i) {
         pci_mmcfg_virt[i].cfg = &pci_mmcfg_config[i];
diff -r 4dc9c522abf5 -r 0b66e6450ffe xen/arch/x86/xstate.c
--- a/xen/arch/x86/xstate.c	Tue Oct 04 14:17:28 2011 +0200
+++ b/xen/arch/x86/xstate.c	Tue Oct 04 14:18:30 2011 +0200
@@ -105,11 +105,10 @@
     BUG_ON(xsave_cntxt_size < XSTATE_AREA_MIN_SIZE);
 
     /* XSAVE/XRSTOR requires the save area be 64-byte-boundary aligned. */
-    save_area = _xmalloc(xsave_cntxt_size, 64);
+    save_area = _xzalloc(xsave_cntxt_size, 64);
     if ( save_area == NULL )
         return -ENOMEM;
 
-    memset(save_area, 0, xsave_cntxt_size);
     ((u32 *)save_area)[6] = 0x1f80;  /* MXCSR */
     *(uint64_t *)(save_area + 512) = XSTATE_FP_SSE;  /* XSETBV */
 

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

From xen-changelog-bounces@lists.xensource.com Tue Oct 04 17:08:08 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 04 Oct 2011 17:08:08 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBF1o-0002Tw-QE; Tue, 04 Oct 2011 17:08:05 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBEuN-0001oE-J9
	for xen-changelog@lists.xensource.com; Tue, 04 Oct 2011 17:00:35 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-174.messagelabs.com!1317772820!27588590!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18765 invoked from network); 5 Oct 2011 00:00:20 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Oct 2011 00:00:20 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBEuG-0005xg-Vo
	for xen-changelog@lists.xensource.com; Wed, 05 Oct 2011 01:00:16 +0100
Message-Id: <E1RBEuG-0005xg-Vo@xenbits.xen.org>
Date: Wed, 05 Oct 2011 01:00:15 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] use xzalloc in common code
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 Jan Beulich <jbeulich@suse.com>
# Date 1317730592 -7200
# Node ID a42af55d50fb7267126feb84df7b7e687db60ca5
# Parent  e09ebf7a31f55bb26c3cce7695a435ed20adf05b
use xzalloc in common code

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r e09ebf7a31f5 -r a42af55d50fb xen/common/cpupool.c
--- a/xen/common/cpupool.c	Tue Oct 04 14:15:26 2011 +0200
+++ b/xen/common/cpupool.c	Tue Oct 04 14:16:32 2011 +0200
@@ -39,7 +39,7 @@
 
 static struct cpupool *alloc_cpupool_struct(void)
 {
-    return xmalloc(struct cpupool);
+    return xzalloc(struct cpupool);
 }
 
 static void free_cpupool_struct(struct cpupool *c)
@@ -118,7 +118,6 @@
     *perr = -ENOMEM;
     if ( (c = alloc_cpupool_struct()) == NULL )
         return NULL;
-    memset(c, 0, sizeof(*c));
 
     /* One reference for caller, one reference for cpupool_destroy(). */
     atomic_set(&c->refcnt, 2);
diff -r e09ebf7a31f5 -r a42af55d50fb xen/common/domctl.c
--- a/xen/common/domctl.c	Tue Oct 04 14:15:26 2011 +0200
+++ b/xen/common/domctl.c	Tue Oct 04 14:16:32 2011 +0200
@@ -155,11 +155,9 @@
 
     /* Do an initial CPU placement. Pick the least-populated CPU. */
     nr_cpus = last_cpu(cpu_online_map) + 1;
-    cnt = xmalloc_array(unsigned int, nr_cpus);
+    cnt = xzalloc_array(unsigned int, nr_cpus);
     if ( cnt )
     {
-        memset(cnt, 0, nr_cpus * sizeof(*cnt));
-
         rcu_read_lock(&domlist_read_lock);
         for_each_domain ( d )
             for_each_vcpu ( d, v )
@@ -511,9 +509,8 @@
             BUG_ON(d->vcpu != NULL);
             BUG_ON(d->max_vcpus != 0);
 
-            if ( (vcpus = xmalloc_array(struct vcpu *, max)) == NULL )
+            if ( (vcpus = xzalloc_array(struct vcpu *, max)) == NULL )
                 goto maxvcpu_out;
-            memset(vcpus, 0, max * sizeof(*vcpus));
 
             /* Install vcpu array /then/ update max_vcpus. */
             d->vcpu = vcpus;
diff -r e09ebf7a31f5 -r a42af55d50fb xen/common/event_channel.c
--- a/xen/common/event_channel.c	Tue Oct 04 14:15:26 2011 +0200
+++ b/xen/common/event_channel.c	Tue Oct 04 14:16:32 2011 +0200
@@ -100,10 +100,9 @@
     if ( port == MAX_EVTCHNS(d) )
         return -ENOSPC;
 
-    chn = xmalloc_array(struct evtchn, EVTCHNS_PER_BUCKET);
+    chn = xzalloc_array(struct evtchn, EVTCHNS_PER_BUCKET);
     if ( unlikely(chn == NULL) )
         return -ENOMEM;
-    memset(chn, 0, EVTCHNS_PER_BUCKET * sizeof(*chn));
     bucket_from_port(d, port) = chn;
 
     for ( i = 0; i < EVTCHNS_PER_BUCKET; i++ )
diff -r e09ebf7a31f5 -r a42af55d50fb xen/common/grant_table.c
--- a/xen/common/grant_table.c	Tue Oct 04 14:15:26 2011 +0200
+++ b/xen/common/grant_table.c	Tue Oct 04 14:16:32 2011 +0200
@@ -2400,19 +2400,17 @@
     struct grant_table *t;
     int                 i;
 
-    if ( (t = xmalloc(struct grant_table)) == NULL )
+    if ( (t = xzalloc(struct grant_table)) == NULL )
         goto no_mem_0;
 
     /* Simple stuff. */
-    memset(t, 0, sizeof(*t));
     spin_lock_init(&t->lock);
     t->nr_grant_frames = INITIAL_NR_GRANT_FRAMES;
 
     /* Active grant table. */
-    if ( (t->active = xmalloc_array(struct active_grant_entry *,
+    if ( (t->active = xzalloc_array(struct active_grant_entry *,
                                     max_nr_active_grant_frames())) == NULL )
         goto no_mem_1;
-    memset(t->active, 0, max_nr_active_grant_frames() * sizeof(t->active[0]));
     for ( i = 0;
           i < num_act_frames_from_sha_frames(INITIAL_NR_GRANT_FRAMES); i++ )
     {
@@ -2422,10 +2420,9 @@
     }
 
     /* Tracking of mapped foreign frames table */
-    if ( (t->maptrack = xmalloc_array(struct grant_mapping *,
+    if ( (t->maptrack = xzalloc_array(struct grant_mapping *,
                                       max_nr_maptrack_frames())) == NULL )
         goto no_mem_2;
-    memset(t->maptrack, 0, max_nr_maptrack_frames() * sizeof(t->maptrack[0]));
     if ( (t->maptrack[0] = alloc_xenheap_page()) == NULL )
         goto no_mem_3;
     clear_page(t->maptrack[0]);
@@ -2434,9 +2431,8 @@
         t->maptrack[0][i].ref = i+1;
 
     /* Shared grant table. */
-    if ( (t->shared_raw = xmalloc_array(void *, max_nr_grant_frames)) == NULL )
+    if ( (t->shared_raw = xzalloc_array(void *, max_nr_grant_frames)) == NULL )
         goto no_mem_3;
-    memset(t->shared_raw, 0, max_nr_grant_frames * sizeof(t->shared_raw[0]));
     for ( i = 0; i < INITIAL_NR_GRANT_FRAMES; i++ )
     {
         if ( (t->shared_raw[i] = alloc_xenheap_page()) == NULL )
@@ -2448,12 +2444,10 @@
         gnttab_create_shared_page(d, t, i);
 
     /* Status pages for grant table - for version 2 */
-    t->status = xmalloc_array(grant_status_t *,
+    t->status = xzalloc_array(grant_status_t *,
                               grant_to_status_frames(max_nr_grant_frames));
     if ( t->status == NULL )
         goto no_mem_4;
-    memset(t->status, 0,
-           grant_to_status_frames(max_nr_grant_frames) * sizeof(t->status[0]));
     t->nr_status_frames = 0;
 
     /* Okay, install the structure. */
diff -r e09ebf7a31f5 -r a42af55d50fb xen/common/sched_arinc653.c
--- a/xen/common/sched_arinc653.c	Tue Oct 04 14:15:26 2011 +0200
+++ b/xen/common/sched_arinc653.c	Tue Oct 04 14:16:32 2011 +0200
@@ -341,11 +341,10 @@
 {
     a653sched_priv_t *prv;
 
-    prv = xmalloc(a653sched_priv_t);
+    prv = xzalloc(a653sched_priv_t);
     if ( prv == NULL )
         return -ENOMEM;
 
-    memset(prv, 0, sizeof(*prv));
     ops->sched_data = prv;
 
     prv->schedule[0].dom_handle[0] = '\0';
diff -r e09ebf7a31f5 -r a42af55d50fb xen/common/sched_credit.c
--- a/xen/common/sched_credit.c	Tue Oct 04 14:15:26 2011 +0200
+++ b/xen/common/sched_credit.c	Tue Oct 04 14:16:32 2011 +0200
@@ -351,10 +351,9 @@
     unsigned long flags;
 
     /* Allocate per-PCPU info */
-    spc = xmalloc(struct csched_pcpu);
+    spc = xzalloc(struct csched_pcpu);
     if ( spc == NULL )
         return NULL;
-    memset(spc, 0, sizeof(*spc));
 
     spin_lock_irqsave(&prv->lock, flags);
 
@@ -649,10 +648,9 @@
     struct csched_vcpu *svc;
 
     /* Allocate per-VCPU info */
-    svc = xmalloc(struct csched_vcpu);
+    svc = xzalloc(struct csched_vcpu);
     if ( svc == NULL )
         return NULL;
-    memset(svc, 0, sizeof(*svc));
 
     INIT_LIST_HEAD(&svc->runq_elem);
     INIT_LIST_HEAD(&svc->active_vcpu_elem);
@@ -837,10 +835,9 @@
 {
     struct csched_dom *sdom;
 
-    sdom = xmalloc(struct csched_dom);
+    sdom = xzalloc(struct csched_dom);
     if ( sdom == NULL )
         return NULL;
-    memset(sdom, 0, sizeof(*sdom));
 
     /* Initialize credit and weight */
     INIT_LIST_HEAD(&sdom->active_vcpu);
@@ -1513,11 +1510,10 @@
 {
     struct csched_private *prv;
 
-    prv = xmalloc(struct csched_private);
+    prv = xzalloc(struct csched_private);
     if ( prv == NULL )
         return -ENOMEM;
 
-    memset(prv, 0, sizeof(*prv));
     ops->sched_data = prv;
     spin_lock_init(&prv->lock);
     INIT_LIST_HEAD(&prv->active_sdom);
diff -r e09ebf7a31f5 -r a42af55d50fb xen/common/sched_credit2.c
--- a/xen/common/sched_credit2.c	Tue Oct 04 14:15:26 2011 +0200
+++ b/xen/common/sched_credit2.c	Tue Oct 04 14:16:32 2011 +0200
@@ -732,10 +732,9 @@
     struct csched_vcpu *svc;
 
     /* Allocate per-VCPU info */
-    svc = xmalloc(struct csched_vcpu);
+    svc = xzalloc(struct csched_vcpu);
     if ( svc == NULL )
         return NULL;
-    memset(svc, 0, sizeof(*svc));
 
     INIT_LIST_HEAD(&svc->rqd_elem);
     INIT_LIST_HEAD(&svc->sdom_elem);
@@ -1437,10 +1436,9 @@
     struct csched_dom *sdom;
     int flags;
 
-    sdom = xmalloc(struct csched_dom);
+    sdom = xzalloc(struct csched_dom);
     if ( sdom == NULL )
         return NULL;
-    memset(sdom, 0, sizeof(*sdom));
 
     /* Initialize credit and weight */
     INIT_LIST_HEAD(&sdom->vcpu);
@@ -2065,10 +2063,9 @@
      * set up basic structures, and a callback when the CPU info is
      * available. */
 
-    prv = xmalloc(struct csched_private);
+    prv = xzalloc(struct csched_private);
     if ( prv == NULL )
         return -ENOMEM;
-    memset(prv, 0, sizeof(*prv));
     ops->sched_data = prv;
     spin_lock_init(&prv->lock);
     INIT_LIST_HEAD(&prv->sdom);
diff -r e09ebf7a31f5 -r a42af55d50fb xen/common/sched_sedf.c
--- a/xen/common/sched_sedf.c	Tue Oct 04 14:15:26 2011 +0200
+++ b/xen/common/sched_sedf.c	Tue Oct 04 14:16:32 2011 +0200
@@ -348,11 +348,10 @@
 {
     struct sedf_vcpu_info *inf;
 
-    inf = xmalloc(struct sedf_vcpu_info);
+    inf = xzalloc(struct sedf_vcpu_info);
     if ( inf == NULL )
         return NULL;
 
-    memset(inf, 0, sizeof(struct sedf_vcpu_info));
     inf->vcpu = v;
 
     /* Every VCPU gets an equal share of extratime by default. */
@@ -387,9 +386,8 @@
 {
     struct sedf_cpu_info *spc;
 
-    spc = xmalloc(struct sedf_cpu_info);
+    spc = xzalloc(struct sedf_cpu_info);
     BUG_ON(spc == NULL);
-    memset(spc, 0, sizeof(*spc));
     INIT_LIST_HEAD(&spc->waitq);
     INIT_LIST_HEAD(&spc->runnableq);
     INIT_LIST_HEAD(&spc->extraq[EXTRA_PEN_Q]);
@@ -415,15 +413,7 @@
 static void *
 sedf_alloc_domdata(const struct scheduler *ops, struct domain *d)
 {
-    void *mem;
-
-    mem = xmalloc(struct sedf_dom_info);
-    if ( mem == NULL )
-        return NULL;
-
-    memset(mem, 0, sizeof(struct sedf_dom_info));
-
-    return mem;
+    return xzalloc(struct sedf_dom_info);
 }
 
 static int sedf_init_domain(const struct scheduler *ops, struct domain *d)
@@ -1333,8 +1323,8 @@
     struct vcpu *p;
     struct domain      *d;
     unsigned int        cpu, nr_cpus = last_cpu(cpu_online_map) + 1;
-    int                *sumw = xmalloc_array(int, nr_cpus);
-    s_time_t           *sumt = xmalloc_array(s_time_t, nr_cpus);
+    int                *sumw = xzalloc_array(int, nr_cpus);
+    s_time_t           *sumt = xzalloc_array(s_time_t, nr_cpus);
 
     if ( !sumw || !sumt )
     {
@@ -1342,8 +1332,6 @@
         xfree(sumw);
         return -ENOMEM;
     }
-    memset(sumw, 0, nr_cpus * sizeof(*sumw));
-    memset(sumt, 0, nr_cpus * sizeof(*sumt));
 
     /* Sum across all weights. */
     rcu_read_lock(&domlist_read_lock);
diff -r e09ebf7a31f5 -r a42af55d50fb xen/common/schedule.c
--- a/xen/common/schedule.c	Tue Oct 04 14:15:26 2011 +0200
+++ b/xen/common/schedule.c	Tue Oct 04 14:16:32 2011 +0200
@@ -233,14 +233,13 @@
     if ( domdata == NULL )
         return -ENOMEM;
 
-    vcpu_priv = xmalloc_array(void *, d->max_vcpus);
+    vcpu_priv = xzalloc_array(void *, d->max_vcpus);
     if ( vcpu_priv == NULL )
     {
         SCHED_OP(c->sched, free_domdata, domdata);
         return -ENOMEM;
     }
 
-    memset(vcpu_priv, 0, d->max_vcpus * sizeof(void *));
     for_each_vcpu ( d, v )
     {
         vcpu_priv[v->vcpu_id] = SCHED_OP(c->sched, alloc_vdata, v, domdata);
diff -r e09ebf7a31f5 -r a42af55d50fb xen/common/wait.c
--- a/xen/common/wait.c	Tue Oct 04 14:15:26 2011 +0200
+++ b/xen/common/wait.c	Tue Oct 04 14:16:32 2011 +0200
@@ -41,11 +41,10 @@
 {
     struct waitqueue_vcpu *wqv;
 
-    wqv = xmalloc(struct waitqueue_vcpu);
+    wqv = xzalloc(struct waitqueue_vcpu);
     if ( wqv == NULL )
         return -ENOMEM;
 
-    memset(wqv, 0, sizeof(*wqv));
     INIT_LIST_HEAD(&wqv->list);
     wqv->vcpu = v;
 
diff -r e09ebf7a31f5 -r a42af55d50fb xen/common/xenoprof.c
--- a/xen/common/xenoprof.c	Tue Oct 04 14:15:26 2011 +0200
+++ b/xen/common/xenoprof.c	Tue Oct 04 14:16:32 2011 +0200
@@ -193,17 +193,14 @@
     unsigned max_max_samples;
     int i;
 
-    d->xenoprof = xmalloc(struct xenoprof);
-
+    d->xenoprof = xzalloc(struct xenoprof);
     if ( d->xenoprof == NULL )
     {
         printk("alloc_xenoprof_struct(): memory allocation failed\n");
         return -ENOMEM;
     }
 
-    memset(d->xenoprof, 0, sizeof(*d->xenoprof));
-
-    d->xenoprof->vcpu = xmalloc_array(struct xenoprof_vcpu, d->max_vcpus);
+    d->xenoprof->vcpu = xzalloc_array(struct xenoprof_vcpu, d->max_vcpus);
     if ( d->xenoprof->vcpu == NULL )
     {
         xfree(d->xenoprof);
@@ -212,8 +209,6 @@
         return -ENOMEM;
     }
 
-    memset(d->xenoprof->vcpu, 0, d->max_vcpus * sizeof(*d->xenoprof->vcpu));
-
     nvcpu = 0;
     for_each_vcpu ( d, v )
         nvcpu++;

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

From xen-changelog-bounces@lists.xensource.com Wed Oct 05 05:55:10 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 05 Oct 2011 05:55:10 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBR0A-0001q9-B3; Wed, 05 Oct 2011 05:55:10 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBR07-0001pR-Ld
	for xen-changelog@lists.xensource.com; Wed, 05 Oct 2011 05:55:08 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-182.messagelabs.com!1317819304!16017253!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10461 invoked from network); 5 Oct 2011 12:55:04 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-7.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Oct 2011 12:55:04 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBR04-0005Ba-B7
	for xen-changelog@lists.xensource.com; Wed, 05 Oct 2011 13:55:04 +0100
Message-Id: <E1RBR04-0005Ba-B7@xenbits.xen.org>
Date: Wed, 05 Oct 2011 13:55:04 +0100
From: Xen patchbot-linux-2.6.18-xen <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [linux-2.6.18-xen] x86-64: streamline syscall code
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 Jan Beulich <jbeulich@suse.com>
# Date 1317818689 -7200
# Node ID 5bda145fc6dcda60cd125699d7ece4bbade0660f
# Parent  4dd3a1d5b26796c1c10c5c2a0026832675aa615d
x86-64: streamline syscall code

System calls using the sysret exit path (or its VGCF_in_syscall IRET
equivalent on Xen) always go into user mode, hence the conditionals
in HYPERVISOR_IRET can be omitted entirely.

Further, there's no need to spill %rcx to the stack upon syscall entry
(neither does native code): No argument gets passed there, and due to
the use of the syscall instruction the register's contents don't need
to be preserved either.

Finally, rather than restoring %rcx and %r11 (not preserved by syscall/
sysret anyway) from the stack frame, we can as well simply clear them
out (to avoid leaking kernel data), thus reducing the necessary memory
(cache) bandwidth.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 4dd3a1d5b267 -r 5bda145fc6dc arch/x86_64/kernel/entry-xen.S
--- a/arch/x86_64/kernel/entry-xen.S	Wed Oct 05 14:42:56 2011 +0200
+++ b/arch/x86_64/kernel/entry-xen.S	Wed Oct 05 14:44:49 2011 +0200
@@ -153,6 +153,7 @@
          * with rax, r11, and rcx being taken care of in the hypercall stub.
          */
 	.macro HYPERVISOR_IRET flag
+	.if \flag == 0	# return from syscall always uses the hypercall
 	testb $3,1*8(%rsp)
 	jnz   2f
 	testl $NMI_MASK,2*8(%rsp)
@@ -165,6 +166,7 @@
 	orl   $3,1*8(%rsp)
 	orl   $3,4*8(%rsp)
 1:	iretq
+	.endif
 
 2:	/* Slow iret via hypervisor. */
 	andl  $~NMI_MASK, 2*8(%rsp)
@@ -248,7 +250,7 @@
 
 ENTRY(system_call)
 	_frame (RIP-0x10)
-	SAVE_ARGS -8,0
+	SAVE_ARGS -8,1
 	movq  %rax,ORIG_RAX-ARGOFFSET(%rsp) 
 	GET_THREAD_INFO(%rcx)
 	testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%rcx)
@@ -279,8 +281,9 @@
 	 * sysretq will re-enable interrupts:
 	 */
 	TRACE_IRQS_ON
-        XEN_UNBLOCK_EVENTS(%rsi)                
-	RESTORE_ARGS 0,8,0
+	RESTORE_ARGS 0,8,1,1
+	xor %ecx,%ecx
+	xor %r11,%r11
         HYPERVISOR_IRET VGCF_IN_SYSCALL
 
 	/* Handle reschedules */

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

From xen-changelog-bounces@lists.xensource.com Wed Oct 05 05:55:19 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 05 Oct 2011 05:55:19 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBR0J-0001t5-Ne; Wed, 05 Oct 2011 05:55:19 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBR07-0001pQ-Fp
	for xen-changelog@lists.xensource.com; Wed, 05 Oct 2011 05:55:08 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-174.messagelabs.com!1317819304!34022521!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2000 invoked from network); 5 Oct 2011 12:55:04 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Oct 2011 12:55:04 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBR03-0005BL-W8
	for xen-changelog@lists.xensource.com; Wed, 05 Oct 2011 13:55:03 +0100
Message-Id: <E1RBR03-0005BL-W8@xenbits.xen.org>
Date: Wed, 05 Oct 2011 13:55:03 +0100
From: Xen patchbot-linux-2.6.18-xen <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [linux-2.6.18-xen] x86-64: extend numeric user mode
	selector checks
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 Jan Beulich <jbeulich@suse.com>
# Date 1317818576 -7200
# Node ID 4dd3a1d5b26796c1c10c5c2a0026832675aa615d
# Parent  ed78d9bac40d465100d5dfb9998df6b633a53057
x86-64: extend numeric user mode selector checks

... to also cover Xen provided ones

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r ed78d9bac40d -r 4dd3a1d5b267 arch/x86_64/mm/fault-xen.c
--- a/arch/x86_64/mm/fault-xen.c	Wed Oct 05 14:39:04 2011 +0200
+++ b/arch/x86_64/mm/fault-xen.c	Wed Oct 05 14:42:56 2011 +0200
@@ -146,7 +146,8 @@
 			/* Could check the LDT for lm, but for now it's good
 			   enough to assume that long mode only uses well known
 			   segments or kernel. */
-			scan_more = (!user_mode(regs)) || (regs->cs == __USER_CS);
+			scan_more = (!user_mode(regs)) || (regs->cs == __USER_CS)
+				    || (regs->cs == FLAT_USER_CS64);
 			break;
 			
 		case 0x60:
@@ -575,8 +576,8 @@
 		   these addresses are not reachable. Just detect this
 		   case and return.  Any code segment in LDT is
 		   compatibility mode. */
-		if ((regs->cs == __USER32_CS || (regs->cs & (1<<2))) &&
-		    (address >> 32))
+		if ((regs->cs == __USER32_CS || regs->cs == FLAT_USER_CS32 ||
+		     (regs->cs & (1<<2))) && (address >> 32))
 			return;
 
 		if (exception_trace && unhandled_signal(tsk, SIGSEGV)) {

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

From xen-changelog-bounces@lists.xensource.com Wed Oct 05 05:55:33 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 05 Oct 2011 05:55:33 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBR0X-0001wV-BJ; Wed, 05 Oct 2011 05:55:33 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBR07-0001pP-7K
	for xen-changelog@lists.xensource.com; Wed, 05 Oct 2011 05:55:08 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-27.messagelabs.com!1317819191!38984492!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14959 invoked from network); 5 Oct 2011 12:53:11 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	5 Oct 2011 12:53:11 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBR03-0005B6-JM
	for xen-changelog@lists.xensource.com; Wed, 05 Oct 2011 13:55:03 +0100
Message-Id: <E1RBR03-0005B6-JM@xenbits.xen.org>
Date: Wed, 05 Oct 2011 13:55:02 +0100
From: Xen patchbot-linux-2.6.18-xen <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [linux-2.6.18-xen] PCI-MSI: pass segment
	information to Xen
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 Jan Beulich <jbeulich@suse.com>
# Date 1317818344 -7200
# Node ID ed78d9bac40d465100d5dfb9998df6b633a53057
# Parent  e7cb8a796890cc9ec3b36dae3f41b552f81266dd
PCI-MSI: pass segment information to Xen

Also don't pass PCI devices with non-zero segment to the old-style
PCI device registration hypercall (converting that code to the new
call is relatively pointless, as one would at once need to change the
mechanism, since where the call currently happens doesn't guarantee
the hypervisor to get notified of all devices, and that's out of scope
for the legacy tree here).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r e7cb8a796890 -r ed78d9bac40d drivers/pci/msi-xen.c
--- a/drivers/pci/msi-xen.c	Tue Oct 04 11:32:22 2011 +0200
+++ b/drivers/pci/msi-xen.c	Wed Oct 05 14:39:04 2011 +0200
@@ -25,6 +25,11 @@
 #include "msi.h"
 
 static int pci_msi_enable = 1;
+#if CONFIG_XEN_COMPAT < 0x040200
+static int pci_seg_supported = 1;
+#else
+#define pci_seg_supported 1
+#endif
 
 static struct msi_ops *msi_ops;
 
@@ -210,21 +215,34 @@
 				  int entry_nr, u64 table_base)
 {
 	struct physdev_map_pirq map_irq;
-	int rc;
+	int rc = -EINVAL;
 	domid_t domid = DOMID_SELF;
 
 	domid = msi_get_dev_owner(dev);
 
 	map_irq.domid = domid;
-	map_irq.type = MAP_PIRQ_TYPE_MSI;
+	map_irq.type = MAP_PIRQ_TYPE_MSI_SEG;
 	map_irq.index = -1;
 	map_irq.pirq = pirq < 0 ? -1 : evtchn_get_xen_pirq(pirq);
-	map_irq.bus = dev->bus->number;
+	map_irq.bus = dev->bus->number | (pci_domain_nr(dev->bus) << 16);
 	map_irq.devfn = dev->devfn;
 	map_irq.entry_nr = entry_nr;
 	map_irq.table_base = table_base;
 
-	if ((rc = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, &map_irq)))
+	if (pci_seg_supported)
+		rc = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, &map_irq);
+#if CONFIG_XEN_COMPAT < 0x040200
+	if (rc == -EINVAL && !pci_domain_nr(dev->bus)) {
+		map_irq.type = MAP_PIRQ_TYPE_MSI;
+		map_irq.index = -1;
+		map_irq.pirq = -1;
+		map_irq.bus = dev->bus->number;
+		rc = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, &map_irq);
+		if (rc != -EINVAL)
+			pci_seg_supported = 0;
+	}
+#endif
+	if (rc)
 		printk(KERN_WARNING "map irq failed\n");
 
 	if (rc < 0)
diff -r e7cb8a796890 -r ed78d9bac40d drivers/xen/core/pci.c
--- a/drivers/xen/core/pci.c	Tue Oct 04 11:32:22 2011 +0200
+++ b/drivers/xen/core/pci.c	Wed Oct 05 14:39:04 2011 +0200
@@ -18,8 +18,10 @@
 	struct physdev_manage_pci manage_pci;
 	struct physdev_manage_pci_ext manage_pci_ext;
 
+	if (pci_domain_nr(pci_dev->bus))
+		r = -ENOSYS;
 #ifdef CONFIG_PCI_IOV
-	if (pci_dev->is_virtfn) {
+	else if (pci_dev->is_virtfn) {
 		memset(&manage_pci_ext, 0, sizeof(manage_pci_ext));
 		manage_pci_ext.bus = pci_dev->bus->number;
 		manage_pci_ext.devfn = pci_dev->devfn;
@@ -28,9 +30,9 @@
 		manage_pci_ext.physfn.devfn = pci_dev->physfn->devfn;
 		r = HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_add_ext,
 					  &manage_pci_ext);
-	} else
+	}
 #endif
-	if (pci_ari_enabled(pci_dev->bus) && PCI_SLOT(pci_dev->devfn)) {
+	else if (pci_ari_enabled(pci_dev->bus) && PCI_SLOT(pci_dev->devfn)) {
 		memset(&manage_pci_ext, 0, sizeof(manage_pci_ext));
 		manage_pci_ext.bus = pci_dev->bus->number;
 		manage_pci_ext.devfn = pci_dev->devfn;
@@ -54,12 +56,15 @@
 {
 	int r;
 	struct pci_dev *pci_dev = to_pci_dev(dev);
+	int seg = pci_domain_nr(pci_dev->bus);
 	struct physdev_manage_pci manage_pci;
 	manage_pci.bus = pci_dev->bus->number;
 	manage_pci.devfn = pci_dev->devfn;
 
 	r = pci_bus_remove(dev);
 	/* dev and pci_dev are no longer valid!! */
+	if (seg)
+		return r;
 
 	WARN_ON(HYPERVISOR_physdev_op(PHYSDEVOP_manage_pci_remove,
 		&manage_pci));

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 00:55:15 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 00:55:15 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBinS-0007KS-Tc; Thu, 06 Oct 2011 00:55:14 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBinO-0007Ji-Ot
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 00:55:11 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-27.messagelabs.com!1317887684!38710384!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5934 invoked from network); 6 Oct 2011 07:54:44 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Oct 2011 07:54:44 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBinL-0007jl-1s
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 08:55:07 +0100
Message-Id: <E1RBinL-0007jl-1s@xenbits.xen.org>
Date: Thu, 06 Oct 2011 08:55:06 +0100
From: Xen patchbot-linux-2.6.18-xen <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [linux-2.6.18-xen] pv-on-hvm/kexec: add
	xs_reset_watches to shutdown watches from old 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 Olaf Hering <olaf@aepfle.de>
# Date 1317886181 -7200
# Node ID fd01f089048e4d9ea35fdb417b4f54d28a9bf16c
# Parent  5bda145fc6dcda60cd125699d7ece4bbade0660f
pv-on-hvm/kexec: add xs_reset_watches to shutdown watches from old kernel

commit ddacf5ef684a655abe2bb50c4b2a5b72ae0d5e05

Add new xs_reset_watches function to shutdown watches from old kernel after
kexec boot.  The old kernel does not unregister all watches in the
shutdown path.  They are still active, the double registration can not
be detected by the new kernel.  When the watches fire, unexpected events
will arrive and the xenwatch thread will crash (jumps to NULL).  An
orderly reboot of a hvm guest will destroy the entire guest with all its
resources (including the watches) before it is rebuilt from scratch, so
the missing unregister is not an issue in that case.

With this change the xenstored is instructed to wipe all active watches
for the guest.  However, a patch for xenstored is required so that it
accepts the XS_RESET_WATCHES request from a client (see changeset
23839:42a45baf037d in xen-unstable.hg). Without the patch for xenstored
the registration of watches will fail and some features of a PVonHVM
guest are not available. The guest is still able to boot, but repeated
kexec boots will fail.

v5:
  - use xs_single instead of passing a dummy string to xs_talkv

v4:
  - ignore -EEXIST in xs_reset_watches

v3:
  - use XS_RESET_WATCHES instead of XS_INTRODUCE

v2:
  - move all code which deals with XS_INTRODUCE into xs_introduce()
    (based on feedback from Ian Campbell)
  - remove casts from kvec assignment

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 5bda145fc6dc -r fd01f089048e drivers/xen/xenbus/xenbus_xs.c
--- a/drivers/xen/xenbus/xenbus_xs.c	Wed Oct 05 14:44:49 2011 +0200
+++ b/drivers/xen/xenbus/xenbus_xs.c	Thu Oct 06 09:29:41 2011 +0200
@@ -627,6 +627,17 @@
 	return NULL;
 }
 
+static void xs_reset_watches(void)
+{
+#ifndef CONFIG_XEN
+	int err;
+
+	err = xs_error(xs_single(XBT_NIL, XS_RESET_WATCHES, "", NULL));
+	if (err && err != -EEXIST)
+		printk(KERN_WARNING "xs_reset_watches failed: %d\n", err);
+#endif
+}
+
 /* Register callback to watch this node. */
 int register_xenbus_watch(struct xenbus_watch *watch)
 {
@@ -928,5 +939,8 @@
 	if (IS_ERR(task))
 		return PTR_ERR(task);
 
+	/* shutdown watches for kexec boot */
+	xs_reset_watches();
+
 	return 0;
 }

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 00:55:24 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 00:55:24 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBinc-0007NC-AF; Thu, 06 Oct 2011 00:55:24 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBinO-0007Jj-VN
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 00:55:11 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-21.messagelabs.com!1317887675!57649162!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9335 invoked from network); 6 Oct 2011 07:54:35 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-7.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Oct 2011 07:54:35 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBinL-0007ko-HD
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 08:55:07 +0100
Message-Id: <E1RBinL-0007ko-HD@xenbits.xen.org>
Date: Thu, 06 Oct 2011 08:55:07 +0100
From: Xen patchbot-linux-2.6.18-xen <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [linux-2.6.18-xen] pv-on-hvm/kexec+kdump: reset PV
	devices in kexec or crash 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 Olaf Hering <olaf@aepfle.de>
# Date 1317887277 -7200
# Node ID 92c7972042d2b20a975acfeae9a469284523caac
# Parent  fd01f089048e4d9ea35fdb417b4f54d28a9bf16c
pv-on-hvm/kexec+kdump: reset PV devices in kexec or crash kernel

commit 116df6f004af81925dcaa90d4a3b76da6b009427

After triggering a crash dump in a HVM guest, the PV backend drivers
will remain in Connected state. When the kdump kernel starts the PV
drivers will skip such devices. As a result, no root device is found and
the vmcore cant be saved.

A similar situation happens after a kexec boot, here the devices will be
in the Closed state.

With this change all frontend devices with state XenbusStateConnected or
XenbusStateClosed will be reset by changing the state file to Closing ->
Closed -> Initializing.  This will trigger a disconnect in the backend
drivers. Now the frontend drivers will find the backend drivers in state
Initwait and can connect.

v2:
  - add timeout when waiting for backend state change
  (based on feedback from Ian Campell)
  - extent printk message to include backend string
  - add comment to fall-through case in xenbus_reset_frontend

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r fd01f089048e -r 92c7972042d2 drivers/xen/xenbus/xenbus_probe.c
--- a/drivers/xen/xenbus/xenbus_probe.c	Thu Oct 06 09:29:41 2011 +0200
+++ b/drivers/xen/xenbus/xenbus_probe.c	Thu Oct 06 09:47:57 2011 +0200
@@ -859,72 +859,100 @@
 EXPORT_SYMBOL_GPL(unregister_xenstore_notifier);
 #endif
 
-#ifdef CONFIG_CRASH_DUMP
-static DECLARE_WAIT_QUEUE_HEAD(be_state_wq);
-static int be_state;
+#ifndef CONFIG_XEN
+static DECLARE_WAIT_QUEUE_HEAD(backend_state_wq);
+static int backend_state;
 
-static void xenbus_reset_state_changed(struct xenbus_watch *w, const char **v, unsigned int l)
+static void xenbus_reset_backend_state_changed(struct xenbus_watch *w,
+					const char **v, unsigned int l)
 {
-	if (xenbus_scanf(XBT_NIL, v[XS_WATCH_PATH], "", "%i", &be_state) != 1)
-		be_state = XenbusStateUnknown;
-	printk(KERN_INFO "XENBUS: %s %s\n", v[XS_WATCH_PATH], xenbus_strstate(be_state));
-	wake_up(&be_state_wq);
+	if (xenbus_scanf(XBT_NIL, v[XS_WATCH_PATH], "", "%i", &backend_state) != 1)
+		backend_state = XenbusStateUnknown;
+	printk(KERN_DEBUG "XENBUS: backend %s %s\n",
+			v[XS_WATCH_PATH], xenbus_strstate(backend_state));
+	wake_up(&backend_state_wq);
 }
 
-static int xenbus_reset_check_final(int *st)
+static void xenbus_reset_wait_for_backend(char *be, int expected)
 {
-	return *st == XenbusStateInitialising || *st == XenbusStateInitWait;
+	long timeout;
+	timeout = wait_event_interruptible_timeout(backend_state_wq,
+			backend_state == expected, 5 * HZ);
+	if (timeout <= 0)
+		printk(KERN_INFO "XENBUS: backend %s timed out.\n", be);
 }
 
-static void xenbus_reset_frontend_state(char *backend, char *frontend)
+/*
+ * Reset frontend if it is in Connected or Closed state.
+ * Wait for backend to catch up.
+ * State Connected happens during kdump, Closed after kexec.
+ */
+static void xenbus_reset_frontend(char *fe, char *be, int be_state)
 {
-	struct xenbus_watch watch;
+	struct xenbus_watch be_watch;
 
-	memset(&watch, 0, sizeof(watch));
-	watch.node = kasprintf(GFP_NOIO | __GFP_HIGH, "%s/state", backend);
-	if (!watch.node)
+	printk(KERN_DEBUG "XENBUS: backend %s %s\n",
+			be, xenbus_strstate(be_state));
+
+	memset(&be_watch, 0, sizeof(be_watch));
+	be_watch.node = kasprintf(GFP_NOIO | __GFP_HIGH, "%s/state", be);
+	if (!be_watch.node)
 		return;
 
-	watch.callback = xenbus_reset_state_changed;
-	be_state = XenbusStateUnknown;
+	be_watch.callback = xenbus_reset_backend_state_changed;
+	backend_state = XenbusStateUnknown;
 
-	printk(KERN_INFO "XENBUS: triggering reconnect on %s\n", backend);
-	register_xenbus_watch(&watch);
+	printk(KERN_INFO "XENBUS: triggering reconnect on %s\n", be);
+	register_xenbus_watch(&be_watch);
 
-	xenbus_printf(XBT_NIL, frontend, "state", "%d", XenbusStateClosing);
-	wait_event_interruptible(be_state_wq, be_state == XenbusStateClosing);
+	/* fall through to forward backend to state XenbusStateInitialising */
+	switch (be_state) {
+	case XenbusStateConnected:
+		xenbus_printf(XBT_NIL, fe, "state", "%d", XenbusStateClosing);
+		xenbus_reset_wait_for_backend(be, XenbusStateClosing);
 
-	xenbus_printf(XBT_NIL, frontend, "state", "%d", XenbusStateClosed);
-	wait_event_interruptible(be_state_wq, be_state == XenbusStateClosed);
+	case XenbusStateClosing:
+		xenbus_printf(XBT_NIL, fe, "state", "%d", XenbusStateClosed);
+		xenbus_reset_wait_for_backend(be, XenbusStateClosed);
 
-	xenbus_printf(XBT_NIL, frontend, "state", "%d", XenbusStateInitialising);
-	wait_event_interruptible(be_state_wq, xenbus_reset_check_final(&be_state));
+	case XenbusStateClosed:
+		xenbus_printf(XBT_NIL, fe, "state", "%d", XenbusStateInitialising);
+		xenbus_reset_wait_for_backend(be, XenbusStateInitWait);
+	}
 
-	unregister_xenbus_watch(&watch);
-	printk(KERN_INFO "XENBUS: reconnect done on %s\n", backend);
-	kfree(watch.node);
+	unregister_xenbus_watch(&be_watch);
+	printk(KERN_INFO "XENBUS: reconnect done on %s\n", be);
+	kfree(be_watch.node);
 }
 
-static void xenbus_reset_check_state(char *class, char *dev)
+static void xenbus_check_frontend(char *class, char *dev)
 {
-	int state, err;
+	int be_state, fe_state, err;
 	char *backend, *frontend;
 
 	frontend = kasprintf(GFP_NOIO | __GFP_HIGH, "device/%s/%s", class, dev);
 	if (!frontend)
 		return;
 
-	err = xenbus_scanf(XBT_NIL, frontend, "state", "%i", &state);
-	/* frontend connected? */
-	if (err == 1 && state == XenbusStateConnected) {
+	err = xenbus_scanf(XBT_NIL, frontend, "state", "%i", &fe_state);
+	if (err != 1)
+		goto out;
+
+	switch (fe_state) {
+	case XenbusStateConnected:
+	case XenbusStateClosed:
+		printk(KERN_DEBUG "XENBUS: frontend %s %s\n",
+				frontend, xenbus_strstate(fe_state));
 		backend = xenbus_read(XBT_NIL, frontend, "backend", NULL);
 		if (!backend || IS_ERR(backend))
 			goto out;
-		err = xenbus_scanf(XBT_NIL, backend, "state", "%i", &state);
-		/* backend connected? */
-		if (err == 1 && state == XenbusStateConnected)
-			xenbus_reset_frontend_state(backend, frontend);
+		err = xenbus_scanf(XBT_NIL, backend, "state", "%i", &be_state);
+		if (err == 1)
+			xenbus_reset_frontend(frontend, backend, be_state);
 		kfree(backend);
+		break;
+	default:
+		break;
 	}
 out:
 	kfree(frontend);
@@ -945,7 +973,7 @@
 		if (IS_ERR(dev))
 			continue;
 		for (j = 0; j < dev_n; j++)
-			xenbus_reset_check_state(devclass[i], dev[j]);
+			xenbus_check_frontend(devclass[i], dev[j]);
 		kfree(dev);
 	}
 	kfree(devclass);
@@ -956,11 +984,11 @@
 {
 	BUG_ON(!is_xenstored_ready());
 
-#ifdef CONFIG_CRASH_DUMP
-	/* reset devices in XenbusStateConnected state */
-	if (!is_initial_xendomain() && reset_devices)
-		xenbus_reset_state();
+#ifndef CONFIG_XEN
+	/* reset devices in Connected or Closed state */
+	xenbus_reset_state();
 #endif
+
 	/* Enumerate devices in xenstore and watch for changes. */
 	xenbus_probe_devices(&xenbus_frontend);
 	register_xenbus_watch(&fe_watch);

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 02:33:17 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 02:33:17 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBkKK-0003fi-UA; Thu, 06 Oct 2011 02:33:16 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBkKF-0003ce-Qe
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 02:33:12 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-182.messagelabs.com!1317893588!16149572!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6519 invoked from network); 6 Oct 2011 09:33:08 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-7.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Oct 2011 09:33:08 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBkKC-0001ac-1Q
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 10:33:08 +0100
Message-Id: <E1RBkKC-0001ac-1Q@xenbits.xen.org>
Date: Thu, 06 Oct 2011 10:33:07 +0100
From: Xen patchbot-linux-2.6.18-xen <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [linux-2.6.18-xen] pv-on-hvm/kexec: prevent crash
	in xenwatch_thread() when stale watch events arrive
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 Olaf Hering <olaf@aepfle.de>
# Date 1317893088 -7200
# Node ID 40e33b2fce948cbdcc0ec27404b58b1acc9b7fc8
# Parent  92c7972042d2b20a975acfeae9a469284523caac
pv-on-hvm/kexec: prevent crash in xenwatch_thread() when stale watch events arrive

commit c4c303c7c5679b4b368e12f41124aee29c325b76

During repeated kexec boots xenwatch_thread() can crash because
xenbus_watch->callback is cleared by xenbus_watch_path() if a node/token
combo for a new watch happens to match an already registered watch from
an old kernel.  In this case xs_watch returns -EEXISTS, then
register_xenbus_watch() does not remove the to-be-registered watch from
the list of active watches but returns the -EEXISTS to the caller
anyway.

Because the watch is still active in xenstored it will cause an event
which will arrive in the new kernel. process_msg() will find the
encapsulated struct xenbus_watch in its list of registered watches and
puts the "empty" watch handle in the queue for xenwatch_thread().
xenwatch_thread() then calls ->callback which was cleared earlier by
xenbus_watch_path().

To prevent that crash in a guest running on an old xen toolstack remove
the special -EEXIST handling.

v2:
 - remove the EEXIST handing in register_xenbus_watch() instead of
   checking for ->callback in process_msg()

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 92c7972042d2 -r 40e33b2fce94 drivers/xen/xenbus/xenbus_xs.c
--- a/drivers/xen/xenbus/xenbus_xs.c	Thu Oct 06 09:47:57 2011 +0200
+++ b/drivers/xen/xenbus/xenbus_xs.c	Thu Oct 06 11:24:48 2011 +0200
@@ -656,8 +656,7 @@
 
 	err = xs_watch(watch->node, token);
 
-	/* Ignore errors due to multiple registration. */
-	if ((err != 0) && (err != -EEXIST)) {
+	if (err) {
 		spin_lock(&watches_lock);
 		list_del(&watch->list);
 		spin_unlock(&watches_lock);

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 10:55:16 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 10:55:16 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBsA8-0003Ue-MJ; Thu, 06 Oct 2011 10:55:16 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBsA1-0003PX-4c
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 10:55:09 -0700
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-11.tower-21.messagelabs.com!1317923687!45507561!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30235 invoked from network); 6 Oct 2011 17:54:47 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-11.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Oct 2011 17:54:47 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1RBs9x-0001Fi-PB
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 18:55:05 +0100
Date: Thu, 06 Oct 2011 18:55:05 +0100
Message-Id: <E1RBs9x-0001Fi-PB@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-unstable] remove blktap when building for
	NetBSD
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

commit 25378e0a76b282127e9ab8933a4defbc91db3862
Author: Roger Pau Monne <roger.pau@entel.upc.edu>
Date:   Thu Oct 6 18:38:08 2011 +0100

    remove blktap when building for NetBSD
    
    NetBSD has no blktap support, so remove the use of the blktap if the
    OS is NetBSD.
    
    Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
---
 hw/xen_machine_pv.c |    2 +-
 xen-config-host.h   |    2 +-
 xen-hooks.mak       |    2 ++
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/xen_machine_pv.c b/hw/xen_machine_pv.c
index 0004904..c09adbb 100644
--- a/hw/xen_machine_pv.c
+++ b/hw/xen_machine_pv.c
@@ -47,7 +47,7 @@ static void xen_init_pv(ram_addr_t ram_size, int vga_ram_size,
     CPUState *env;
     uint32_t domid_target;
 
-#ifndef CONFIG_STUBDOM
+#if !defined(CONFIG_STUBDOM) && !defined(__NetBSD__)
     /* Initialize tapdisk client */
     init_blktap();
 #endif
diff --git a/xen-config-host.h b/xen-config-host.h
index f50c3aa..818f25d 100644
--- a/xen-config-host.h
+++ b/xen-config-host.h
@@ -18,7 +18,7 @@ extern int domid, domid_backend;
 
 #include "xenctrl.h"
 #include "xs.h"
-#ifndef CONFIG_STUBDOM
+#if !defined(CONFIG_STUBDOM) && !defined(__NetBSD__)
 #include "blktaplib.h"
 #endif
 
diff --git a/xen-hooks.mak b/xen-hooks.mak
index 253915d..b55f45b 100644
--- a/xen-hooks.mak
+++ b/xen-hooks.mak
@@ -46,11 +46,13 @@ CONFIG_SDL=
 CONFIG_AUDIO=
 OBJS += xenfbfront.o
 else
+ifndef CONFIG_NetBSD
 CPPFLAGS+= -I$(XEN_ROOT)/tools/blktap/lib
 LIBS += -L$(XEN_ROOT)/tools/blktap/lib -lblktap
 OBJS += xen_blktap.o
 OBJS += tpm_tis.o
 endif
+endif
 
 ifdef CONFIG_STUBDOM
 CONFIG_PASSTHROUGH=1
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 16:22:32 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 16:22:32 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBxGn-0000uX-4T; Thu, 06 Oct 2011 16:22:32 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBxGa-0000su-S8
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 16:22:17 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-216.messagelabs.com!1317943333!46752!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29595 invoked from network); 6 Oct 2011 23:22:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Oct 2011 23:22:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBxGX-0007HC-BZ
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 00:22:13 +0100
Message-Id: <E1RBxGX-0007HC-BZ@xenbits.xen.org>
Date: Fri, 07 Oct 2011 00:22:12 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: fix locking in
	p2m_mem_paging functions
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 Olaf Hering <olaf@aepfle.de>
# Date 1317900797 -3600
# Node ID 50ee6be5646054059b766edfef7ad2b186ec95f8
# Parent  ecab267b85ef0f6721a760ca1b1966d8cef1c7c6
xenpaging: fix locking in p2m_mem_paging functions

As suggested by <hongkaixing@huawei.com>, query and adjust the p2mt
under the p2m_lock to prevent races with PoD.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r ecab267b85ef -r 50ee6be56460 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Thu Oct 06 12:33:17 2011 +0100
+++ b/xen/arch/x86/mm/p2m.c	Thu Oct 06 12:33:17 2011 +0100
@@ -675,6 +675,8 @@
     mfn_t mfn;
     int ret;
 
+    p2m_lock(p2m);
+
     mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query, NULL);
 
     /* Check if mfn is valid */
@@ -701,14 +703,12 @@
         goto out;
 
     /* Fix p2m entry */
-    p2m_lock(p2m);
     set_p2m_entry(p2m, gfn, mfn, 0, p2m_ram_paging_out, a);
     audit_p2m(p2m, 1);
-    p2m_unlock(p2m);
-
     ret = 0;
 
  out:
+    p2m_unlock(p2m);
     return ret;
 }
 
@@ -719,30 +719,31 @@
     p2m_access_t a;
     mfn_t mfn;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
+    int ret = -EINVAL;
+
+    p2m_lock(p2m);
 
     /* Get mfn */
     mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query, NULL);
     if ( unlikely(!mfn_valid(mfn)) )
-        return -EINVAL;
+        goto out;
 
     if ( (p2mt == p2m_ram_paged) || (p2mt == p2m_ram_paging_in) ||
          (p2mt == p2m_ram_paging_in_start) )
-        return -EINVAL;
+        goto out;
 
     /* Get the page so it doesn't get modified under Xen's feet */
     page = mfn_to_page(mfn);
     if ( unlikely(!get_page(page, d)) )
-        return -EINVAL;
+        goto out;
 
     /* Decrement guest domain's ref count of the page */
     if ( test_and_clear_bit(_PGC_allocated, &page->count_info) )
         put_page(page);
 
     /* Remove mapping from p2m table */
-    p2m_lock(p2m);
     set_p2m_entry(p2m, gfn, _mfn(INVALID_MFN), 0, p2m_ram_paged, a);
     audit_p2m(p2m, 1);
-    p2m_unlock(p2m);
 
     /* Put the page back so it gets freed */
     put_page(page);
@@ -750,7 +751,11 @@
     /* Track number of paged gfns */
     atomic_inc(&d->paged_pages);
 
-    return 0;
+    ret = 0;
+
+ out:
+    p2m_unlock(p2m);
+    return ret;
 }
 
 void p2m_mem_paging_drop_page(struct domain *d, unsigned long gfn)
@@ -789,15 +794,15 @@
     /* Fix p2m mapping */
     /* XXX: It seems inefficient to have this here, as it's only needed
      *      in one case (ept guest accessing paging out page) */
+    p2m_lock(p2m);
     p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query, NULL);
     if ( p2mt == p2m_ram_paged )
     {
-        p2m_lock(p2m);
         set_p2m_entry(p2m, gfn, _mfn(INVALID_MFN), 0, 
                       p2m_ram_paging_in_start, a);
         audit_p2m(p2m, 1);
-        p2m_unlock(p2m);
     }
+    p2m_unlock(p2m);
 
     /* Pause domain */
     if ( v->domain->domain_id == d->domain_id )
@@ -826,22 +831,28 @@
     p2m_type_t p2mt;
     p2m_access_t a;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
+    int ret = -ENOMEM;
+
+    p2m_lock(p2m);
 
     p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query, NULL);
+
     /* Get a free page */
     page = alloc_domheap_page(p2m->domain, 0);
     if ( unlikely(page == NULL) )
-        return -ENOMEM;
+        goto out;
 
     /* Fix p2m mapping */
-    p2m_lock(p2m);
     set_p2m_entry(p2m, gfn, page_to_mfn(page), 0, p2m_ram_paging_in, a);
     audit_p2m(p2m, 1);
-    p2m_unlock(p2m);
 
     atomic_dec(&d->paged_pages);
 
-    return 0;
+    ret = 0;
+
+ out:
+    p2m_unlock(p2m);
+    return ret;
 }
 
 void p2m_mem_paging_resume(struct domain *d)
@@ -858,8 +869,8 @@
     /* Fix p2m entry if the page was not dropped */
     if ( !(rsp.flags & MEM_EVENT_FLAG_DROP_PAGE) )
     {
+        p2m_lock(p2m);
         mfn = p2m->get_entry(p2m, rsp.gfn, &p2mt, &a, p2m_query, NULL);
-        p2m_lock(p2m);
         set_p2m_entry(p2m, rsp.gfn, mfn, 0, p2m_ram_rw, a);
         set_gpfn_from_mfn(mfn_x(mfn), rsp.gfn);
         audit_p2m(p2m, 1);

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 16:22:59 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 16:22:59 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBxHH-0000ym-CS; Thu, 06 Oct 2011 16:22:59 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBxGb-0000sv-5J
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 16:22:17 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-182.messagelabs.com!1317943333!21272993!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13442 invoked from network); 6 Oct 2011 23:22:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Oct 2011 23:22:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBxGW-0007GQ-JK
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 00:22:12 +0100
Message-Id: <E1RBxGW-0007GQ-JK@xenbits.xen.org>
Date: Fri, 07 Oct 2011 00:22:11 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: use p2m->get_entry() in
	p2m_mem_paging functions
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 Olaf Hering <olaf@aepfle.de>
# Date 1317900797 -3600
# Node ID ecab267b85ef0f6721a760ca1b1966d8cef1c7c6
# Parent  0b66e6450ffe6823d8b323ef4248b38fe7372d54
xenpaging: use p2m->get_entry() in p2m_mem_paging functions

Use p2m->get_entry() in the p2m_mem_paging functions. This preserves the
p2m_access type when gfn is updated with set_p2m_entry().
Its also a preparation for locking fixes in a subsequent patch.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 0b66e6450ffe -r ecab267b85ef xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Tue Oct 04 14:18:30 2011 +0200
+++ b/xen/arch/x86/mm/p2m.c	Thu Oct 06 12:33:17 2011 +0100
@@ -671,10 +671,11 @@
     struct page_info *page;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     p2m_type_t p2mt;
+    p2m_access_t a;
     mfn_t mfn;
     int ret;
 
-    mfn = gfn_to_mfn(p2m->domain, gfn, &p2mt);
+    mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query, NULL);
 
     /* Check if mfn is valid */
     ret = -EINVAL;
@@ -701,7 +702,7 @@
 
     /* Fix p2m entry */
     p2m_lock(p2m);
-    set_p2m_entry(p2m, gfn, mfn, 0, p2m_ram_paging_out, p2m->default_access);
+    set_p2m_entry(p2m, gfn, mfn, 0, p2m_ram_paging_out, a);
     audit_p2m(p2m, 1);
     p2m_unlock(p2m);
 
@@ -715,11 +716,12 @@
 {
     struct page_info *page;
     p2m_type_t p2mt;
+    p2m_access_t a;
     mfn_t mfn;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
 
     /* Get mfn */
-    mfn = gfn_to_mfn(d, gfn, &p2mt);
+    mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query, NULL);
     if ( unlikely(!mfn_valid(mfn)) )
         return -EINVAL;
 
@@ -738,8 +740,7 @@
 
     /* Remove mapping from p2m table */
     p2m_lock(p2m);
-    set_p2m_entry(p2m, gfn, _mfn(INVALID_MFN), 0, 
-                  p2m_ram_paged, p2m->default_access);
+    set_p2m_entry(p2m, gfn, _mfn(INVALID_MFN), 0, p2m_ram_paged, a);
     audit_p2m(p2m, 1);
     p2m_unlock(p2m);
 
@@ -775,6 +776,7 @@
     struct vcpu *v = current;
     mem_event_request_t req;
     p2m_type_t p2mt;
+    p2m_access_t a;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
 
     /* Check that there's space on the ring for this request */
@@ -787,12 +789,12 @@
     /* Fix p2m mapping */
     /* XXX: It seems inefficient to have this here, as it's only needed
      *      in one case (ept guest accessing paging out page) */
-    gfn_to_mfn(d, gfn, &p2mt);
+    p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query, NULL);
     if ( p2mt == p2m_ram_paged )
     {
         p2m_lock(p2m);
         set_p2m_entry(p2m, gfn, _mfn(INVALID_MFN), 0, 
-                      p2m_ram_paging_in_start, p2m->default_access);
+                      p2m_ram_paging_in_start, a);
         audit_p2m(p2m, 1);
         p2m_unlock(p2m);
     }
@@ -821,8 +823,11 @@
 int p2m_mem_paging_prep(struct domain *d, unsigned long gfn)
 {
     struct page_info *page;
+    p2m_type_t p2mt;
+    p2m_access_t a;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
 
+    p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query, NULL);
     /* Get a free page */
     page = alloc_domheap_page(p2m->domain, 0);
     if ( unlikely(page == NULL) )
@@ -830,7 +835,7 @@
 
     /* Fix p2m mapping */
     p2m_lock(p2m);
-    set_p2m_entry(p2m, gfn, page_to_mfn(page), 0, p2m_ram_paging_in, p2m->default_access);
+    set_p2m_entry(p2m, gfn, page_to_mfn(page), 0, p2m_ram_paging_in, a);
     audit_p2m(p2m, 1);
     p2m_unlock(p2m);
 
@@ -844,6 +849,7 @@
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     mem_event_response_t rsp;
     p2m_type_t p2mt;
+    p2m_access_t a;
     mfn_t mfn;
 
     /* Pull the response off the ring */
@@ -852,9 +858,9 @@
     /* Fix p2m entry if the page was not dropped */
     if ( !(rsp.flags & MEM_EVENT_FLAG_DROP_PAGE) )
     {
-        mfn = gfn_to_mfn(d, rsp.gfn, &p2mt);
+        mfn = p2m->get_entry(p2m, rsp.gfn, &p2mt, &a, p2m_query, NULL);
         p2m_lock(p2m);
-        set_p2m_entry(p2m, rsp.gfn, mfn, 0, p2m_ram_rw, p2m->default_access);
+        set_p2m_entry(p2m, rsp.gfn, mfn, 0, p2m_ram_rw, a);
         set_gpfn_from_mfn(mfn_x(mfn), rsp.gfn);
         audit_p2m(p2m, 1);
         p2m_unlock(p2m);

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 16:23:08 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 16:23:08 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBxHQ-000129-Gz; Thu, 06 Oct 2011 16:23:08 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBxGb-0000sw-3L
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 16:22:17 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-27.messagelabs.com!1317943315!47157251!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31775 invoked from network); 6 Oct 2011 23:21:55 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Oct 2011 23:21:55 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBxGX-0007Hc-TP
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 00:22:13 +0100
Message-Id: <E1RBxGX-0007Hc-TP@xenbits.xen.org>
Date: Fri, 07 Oct 2011 00:22:13 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: remove confusing comment
	from p2m_mem_paging_populate
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 Olaf Hering <olaf@aepfle.de>
# Date 1317900797 -3600
# Node ID 7bf85c3fd9f0364b1bfdaa2493510950b3e91802
# Parent  50ee6be5646054059b766edfef7ad2b186ec95f8
xenpaging: remove confusing comment from p2m_mem_paging_populate

Currently there is no way to avoid the double check of the p2mt
because p2m_mem_paging_populate() is called from many places without
the p2m_lock held. Upcoming changes will move the function into
gfn_to_mfn(), so its interface could be changed and the extra
p2m_lock/get_entry can be removed.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 50ee6be56460 -r 7bf85c3fd9f0 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Thu Oct 06 12:33:17 2011 +0100
+++ b/xen/arch/x86/mm/p2m.c	Thu Oct 06 12:33:17 2011 +0100
@@ -792,8 +792,6 @@
     req.type = MEM_EVENT_TYPE_PAGING;
 
     /* Fix p2m mapping */
-    /* XXX: It seems inefficient to have this here, as it's only needed
-     *      in one case (ept guest accessing paging out page) */
     p2m_lock(p2m);
     p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query, NULL);
     if ( p2mt == p2m_ram_paged )

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 16:23:17 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 16:23:17 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBxHZ-000159-Mn; Thu, 06 Oct 2011 16:23:17 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBxGb-0000sx-RP
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 16:22:18 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1317943334!46164!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17744 invoked from network); 6 Oct 2011 23:22:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Oct 2011 23:22:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBxGY-0007I6-Fd
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 00:22:14 +0100
Message-Id: <E1RBxGY-0007I6-Fd@xenbits.xen.org>
Date: Fri, 07 Oct 2011 00:22:13 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] p2m: use correct p2m_type_t in
	clear_mmio_p2m_entry
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 Olaf Hering <olaf@aepfle.de>
# Date 1317901938 -3600
# Node ID 71844f889e3e490d49e55a9e4c7a5559c890e175
# Parent  7bf85c3fd9f0364b1bfdaa2493510950b3e91802
p2m: use correct p2m_type_t in clear_mmio_p2m_entry

clear_mmio_p2m_entry() should mark the gfn as invalid.
Use proper name instead of numerical value. The currently used value of
zero means p2m_ram_rw.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 7bf85c3fd9f0 -r 71844f889e3e xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Thu Oct 06 12:33:17 2011 +0100
+++ b/xen/arch/x86/mm/p2m.c	Thu Oct 06 12:52:18 2011 +0100
@@ -628,7 +628,7 @@
         return 0;
     }
     p2m_lock(p2m);
-    rc = set_p2m_entry(p2m, gfn, _mfn(INVALID_MFN), 0, 0, p2m->default_access);
+    rc = set_p2m_entry(p2m, gfn, _mfn(INVALID_MFN), 0, p2m_invalid, p2m->default_access);
     audit_p2m(p2m, 1);
     p2m_unlock(p2m);
 

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 16:23:30 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 16:23:30 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBxHl-00018G-UX; Thu, 06 Oct 2011 16:23:30 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBxGc-0000sz-9b
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 16:22:18 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-27.messagelabs.com!1317943308!40816305!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28849 invoked from network); 6 Oct 2011 23:21:49 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Oct 2011 23:21:49 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBxGZ-0007Ia-0H
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 00:22:15 +0100
Message-Id: <E1RBxGZ-0007Ia-0H@xenbits.xen.org>
Date: Fri, 07 Oct 2011 00:22:14 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] p2m: query/modify p2mt with p2m_lock
	held
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 Olaf Hering <olaf@aepfle.de>
# Date 1317906943 -3600
# Node ID 88b6e08b8aa89f876d74ed197f4229eb6cd7abb7
# Parent  71844f889e3e490d49e55a9e4c7a5559c890e175
p2m: query/modify p2mt with p2m_lock held

Query and update the p2mt in set_mmio_p2m_entry, clear_mmio_p2m_entry
and set_shared_p2m_entry with the p2m_lock held.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 71844f889e3e -r 88b6e08b8aa8 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Thu Oct 06 12:52:18 2011 +0100
+++ b/xen/arch/x86/mm/p2m.c	Thu Oct 06 14:15:43 2011 +0100
@@ -583,9 +583,11 @@
     if ( !paging_mode_translate(d) )
         return 0;
 
+    p2m_lock(p2m);
     omfn = gfn_to_mfn_query(d, gfn, &ot);
     if ( p2m_is_grant(ot) )
     {
+        p2m_unlock(p2m);
         domain_crash(d);
         return 0;
     }
@@ -596,7 +598,6 @@
     }
 
     P2M_DEBUG("set mmio %lx %lx\n", gfn, mfn_x(mfn));
-    p2m_lock(p2m);
     rc = set_p2m_entry(p2m, gfn, mfn, 0, p2m_mmio_direct, p2m->default_access);
     audit_p2m(p2m, 1);
     p2m_unlock(p2m);
@@ -618,18 +619,20 @@
     if ( !paging_mode_translate(d) )
         return 0;
 
-    mfn = gfn_to_mfn(d, gfn, &t);
+    p2m_lock(p2m);
+    mfn = gfn_to_mfn_query(d, gfn, &t);
 
     /* Do not use mfn_valid() here as it will usually fail for MMIO pages. */
     if ( (INVALID_MFN == mfn_x(mfn)) || (t != p2m_mmio_direct) )
     {
         gdprintk(XENLOG_ERR,
             "clear_mmio_p2m_entry: gfn_to_mfn failed! gfn=%08lx\n", gfn);
-        return 0;
+        goto out;
     }
-    p2m_lock(p2m);
     rc = set_p2m_entry(p2m, gfn, _mfn(INVALID_MFN), 0, p2m_invalid, p2m->default_access);
     audit_p2m(p2m, 1);
+
+out:
     p2m_unlock(p2m);
 
     return rc;
@@ -646,6 +649,7 @@
     if ( !paging_mode_translate(p2m->domain) )
         return 0;
 
+    p2m_lock(p2m);
     omfn = gfn_to_mfn_query(p2m->domain, gfn, &ot);
     /* At the moment we only allow p2m change if gfn has already been made
      * sharable first */
@@ -655,7 +659,6 @@
     set_gpfn_from_mfn(mfn_x(omfn), INVALID_M2P_ENTRY);
 
     P2M_DEBUG("set shared %lx %lx\n", gfn, mfn_x(mfn));
-    p2m_lock(p2m);
     rc = set_p2m_entry(p2m, gfn, mfn, 0, p2m_ram_shared, p2m->default_access);
     p2m_unlock(p2m);
     if ( 0 == rc )

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 16:23:36 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 16:23:36 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBxHs-0001Au-Rw; Thu, 06 Oct 2011 16:23:36 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBxGc-0000t1-RT
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 16:22:19 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-182.messagelabs.com!1317943335!18482114!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19936 invoked from network); 6 Oct 2011 23:22:15 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Oct 2011 23:22:15 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBxGZ-0007J5-I6
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 00:22:15 +0100
Message-Id: <E1RBxGZ-0007J5-I6@xenbits.xen.org>
Date: Fri, 07 Oct 2011 00:22:15 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: add comments describing the
	internal memory allocation helpers
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 Ian Campbell <ian.campbell@citrix.com>
# Date 1317911074 -3600
# Node ID 6a57e1227973bcdb1312044020c3ee6ec9873af3
# Parent  88b6e08b8aa89f876d74ed197f4229eb6cd7abb7
libxl: add comments describing the internal memory allocation helpers

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 88b6e08b8aa8 -r 6a57e1227973 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Thu Oct 06 14:15:43 2011 +0100
+++ b/tools/libxl/libxl_internal.h	Thu Oct 06 15:24:34 2011 +0100
@@ -140,15 +140,40 @@
     return gc->owner;
 }
 
-/* memory allocation tracking/helpers */
+/*
+ * Memory allocation tracking/helpers
+ *
+ * See comment "libxl memory management" in libxl.h for a description
+ * of the framework which these calls belong to.
+ *
+ * These functions deal with memory allocations of type (a) and (d) in
+ * that description.
+ *
+ * All pointers returned by these functions are registered for garbage
+ * collection on exit from the outermost libxl callframe.
+ */
+/* register @ptr in @gc for free on exit from outermost libxl callframe. */
 _hidden int libxl__ptr_add(libxl__gc *gc, void *ptr);
+/* if this is the outermost libxl callframe then free all pointers in @gc */
 _hidden void libxl__free_all(libxl__gc *gc);
+/* allocate and zero @bytes. (similar to a gc'd malloc(3)+memzero()) */
 _hidden void *libxl__zalloc(libxl__gc *gc, int bytes);
+/* allocate and zero memory for an array of @nmemb members of @size each.
+ * (similar to a gc'd calloc(3)). */
 _hidden void *libxl__calloc(libxl__gc *gc, size_t nmemb, size_t size);
+/* change the size of the memory block pointed to by @ptr to @new_size bytes.
+ * unlike other allocation functions here any additional space between the
+ * oldsize and @new_size is not initialised (similar to a gc'd realloc(3)). */
 _hidden void *libxl__realloc(libxl__gc *gc, void *ptr, size_t new_size);
+/* print @fmt into an allocated string large enoughto contain the result.
+ * (similar to gc'd asprintf(3)). */
 _hidden char *libxl__sprintf(libxl__gc *gc, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 3);
+/* duplicate the string @c (similar to a gc'd strdup(3)). */
 _hidden char *libxl__strdup(libxl__gc *gc, const char *c);
+/* duplicate at most @n bytes of string @c (similar to a gc'd strndup(3)). */
 _hidden char *libxl__strndup(libxl__gc *gc, const char *c, size_t n);
+/* strip the last path component from @s and return as a newly allocated
+ * string. (similar to a gc'd dirname(3)). */
 _hidden char *libxl__dirname(libxl__gc *gc, const char *s);
 
 _hidden char **libxl__xs_kvs_of_flexarray(libxl__gc *gc, flexarray_t *array, int length);

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 16:23:47 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 16:23:47 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBxI3-0001E1-GW; Thu, 06 Oct 2011 16:23:47 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBxGd-0000t2-6X
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 16:22:20 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-27.messagelabs.com!1317943316!47655416!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6560 invoked from network); 6 Oct 2011 23:21:56 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Oct 2011 23:21:56 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBxGa-0007JZ-4P
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 00:22:16 +0100
Message-Id: <E1RBxGa-0007JZ-4P@xenbits.xen.org>
Date: Fri, 07 Oct 2011 00:22:15 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: undo 23728:548b2826293e
	whitespace cleanup to autogenerated file
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 Ian Campbell <ian.campbell@citrix.com>
# Date 1317914133 -3600
# Node ID af624488efe23e2f7b880b5333909113652989b4
# Parent  6a57e1227973bcdb1312044020c3ee6ec9873af3
libxl: undo 23728:548b2826293e whitespace cleanup to autogenerated file

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 6a57e1227973 -r af624488efe2 tools/libxl/libxlu_disk_l.c
--- a/tools/libxl/libxlu_disk_l.c	Thu Oct 06 15:24:34 2011 +0100
+++ b/tools/libxl/libxlu_disk_l.c	Thu Oct 06 16:15:33 2011 +0100
@@ -34,7 +34,7 @@
 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 
 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
- * if you want the limit (max/min) macros for int types.
+ * if you want the limit (max/min) macros for int types. 
  */
 #ifndef __STDC_LIMIT_MACROS
 #define __STDC_LIMIT_MACROS 1
@@ -51,7 +51,7 @@
 typedef signed char flex_int8_t;
 typedef short int flex_int16_t;
 typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t;
+typedef unsigned char flex_uint8_t; 
 typedef unsigned short int flex_uint16_t;
 typedef unsigned int flex_uint32_t;
 
@@ -184,7 +184,7 @@
 #define EOB_ACT_LAST_MATCH 2
 
     #define YY_LESS_LINENO(n)
-
+    
 /* Return all but the first "n" matched characters back to the input stream. */
 #define yyless(n) \
 	do \
@@ -246,7 +246,7 @@
 
     int yy_bs_lineno; /**< The line count. */
     int yy_bs_column; /**< The column count. */
-
+    
 	/* Whether to try to fill the input buffer when we reach the
 	 * end of it.
 	 */
@@ -1869,7 +1869,7 @@
     YY_BUFFER_STATE xlu__disk_yy_create_buffer  (FILE * file, int  size , yyscan_t yyscanner)
 {
 	YY_BUFFER_STATE b;
-
+    
 	b = (YY_BUFFER_STATE) xlu__disk_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
 	if ( ! b )
 		YY_FATAL_ERROR( "out of dynamic memory in xlu__disk_yy_create_buffer()" );
@@ -1913,7 +1913,7 @@
 #ifndef __cplusplus
 extern int isatty (int );
 #endif /* __cplusplus */
-
+    
 /* Initializes or reinitializes a buffer.
  * This function is sometimes called more than once on the same buffer,
  * such as during a xlu__disk_yyrestart() or at EOF.
@@ -1939,7 +1939,7 @@
     }
 
         b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
-
+    
 	errno = oerrno;
 }
 
@@ -2045,9 +2045,9 @@
 								, yyscanner);
 		if ( ! yyg->yy_buffer_stack )
 			YY_FATAL_ERROR( "out of dynamic memory in xlu__disk_yyensure_buffer_stack()" );
-
+								  
 		memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-
+				
 		yyg->yy_buffer_stack_max = num_to_alloc;
 		yyg->yy_buffer_stack_top = 0;
 		return;
@@ -2076,12 +2076,12 @@
  * @param base the character buffer
  * @param size the size in bytes of the character buffer
  * @param yyscanner The scanner object.
- * @return the newly allocated buffer state object.
+ * @return the newly allocated buffer state object. 
  */
 YY_BUFFER_STATE xlu__disk_yy_scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)
 {
 	YY_BUFFER_STATE b;
-
+    
 	if ( size < 2 ||
 	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
 	     base[size-1] != YY_END_OF_BUFFER_CHAR )
@@ -2117,7 +2117,7 @@
  */
 YY_BUFFER_STATE xlu__disk_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
 {
-
+    
 	return xlu__disk_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
 }
 
@@ -2134,7 +2134,7 @@
 	char *buf;
 	yy_size_t n;
 	int i;
-
+    
 	/* Get memory for full buffer, including space for trailing EOB's. */
 	n = _yybytes_len + 2;
 	buf = (char *) xlu__disk_yyalloc(n ,yyscanner );
@@ -2202,10 +2202,10 @@
 int xlu__disk_yyget_lineno  (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
+    
         if (! YY_CURRENT_BUFFER)
             return 0;
-
+    
     return yylineno;
 }
 
@@ -2215,10 +2215,10 @@
 int xlu__disk_yyget_column  (yyscan_t yyscanner)
 {
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
+    
         if (! YY_CURRENT_BUFFER)
             return 0;
-
+    
     return yycolumn;
 }
 
@@ -2279,8 +2279,8 @@
 
         /* lineno is only valid if an input buffer exists. */
         if (! YY_CURRENT_BUFFER )
-           yy_fatal_error( "xlu__disk_yyset_lineno called with no buffer" , yyscanner);
-
+           yy_fatal_error( "xlu__disk_yyset_lineno called with no buffer" , yyscanner); 
+    
     yylineno = line_number;
 }
 
@@ -2294,8 +2294,8 @@
 
         /* column is only valid if an input buffer exists. */
         if (! YY_CURRENT_BUFFER )
-           yy_fatal_error( "xlu__disk_yyset_column called with no buffer" , yyscanner);
-
+           yy_fatal_error( "xlu__disk_yyset_column called with no buffer" , yyscanner); 
+    
     yycolumn = column_no;
 }
 
@@ -2378,20 +2378,20 @@
         errno = EINVAL;
         return 1;
     }
-
+	
     *ptr_yy_globals = (yyscan_t) xlu__disk_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
-
+	
     if (*ptr_yy_globals == NULL){
         errno = ENOMEM;
         return 1;
     }
-
+    
     /* By setting to 0xAA, we expose bugs in
     yy_init_globals. Leave at 0x00 for releases. */
     memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
-
+    
     xlu__disk_yyset_extra (yy_user_defined, *ptr_yy_globals);
-
+    
     return yy_init_globals ( *ptr_yy_globals );
 }
 
diff -r 6a57e1227973 -r af624488efe2 tools/libxl/libxlu_disk_l.h
--- a/tools/libxl/libxlu_disk_l.h	Thu Oct 06 15:24:34 2011 +0100
+++ b/tools/libxl/libxlu_disk_l.h	Thu Oct 06 16:15:33 2011 +0100
@@ -38,7 +38,7 @@
 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 
 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
- * if you want the limit (max/min) macros for int types.
+ * if you want the limit (max/min) macros for int types. 
  */
 #ifndef __STDC_LIMIT_MACROS
 #define __STDC_LIMIT_MACROS 1
@@ -55,7 +55,7 @@
 typedef signed char flex_int8_t;
 typedef short int flex_int16_t;
 typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t;
+typedef unsigned char flex_uint8_t; 
 typedef unsigned short int flex_uint16_t;
 typedef unsigned int flex_uint32_t;
 
@@ -193,7 +193,7 @@
 
     int yy_bs_lineno; /**< The line count. */
     int yy_bs_column; /**< The column count. */
-
+    
 	/* Whether to try to fill the input buffer when we reach the
 	 * end of it.
 	 */

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 16:23:58 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 16:23:58 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBxIE-0001Hb-2m; Thu, 06 Oct 2011 16:23:58 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBxGj-0000uO-T6
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 16:22:29 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-174.messagelabs.com!1317943342!20600890!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17953 invoked from network); 6 Oct 2011 23:22:22 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Oct 2011 23:22:22 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBxGg-0007NQ-Bq
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 00:22:22 +0100
Message-Id: <E1RBxGg-0007NQ-Bq@xenbits.xen.org>
Date: Fri, 07 Oct 2011 00:22:21 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: probe disk backend type in
	libxl_device_disk_add
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 Ian Campbell <ian.campbell@citrix.com>
# Date 1317914386 -3600
# Node ID abd34aba46a3784b176db26af2721ed7277c9c49
# Parent  3be536f7001f1521ad11d54a84338db45bad8d8f
libxl: probe disk backend type in libxl_device_disk_add

Without this "xl block-attach" does not work. On create do_domain_create already
catches this.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 3be536f7001f -r abd34aba46a3 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Thu Oct 06 16:19:03 2011 +0100
+++ b/tools/libxl/libxl.c	Thu Oct 06 16:19:46 2011 +0100
@@ -926,6 +926,9 @@
     libxl__device device;
     int major, minor, rc;
 
+    rc = libxl__device_disk_set_backend(&gc, disk);
+    if (rc) goto out;
+
     front = flexarray_make(16, 1);
     if (!front) {
         rc = ERROR_NOMEM;

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 16:24:05 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 16:24:05 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBxIL-0001L3-8w; Thu, 06 Oct 2011 16:24:05 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBxGk-0000uZ-PE
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 16:22:31 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-21.messagelabs.com!1317943354!54492010!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7877 invoked from network); 6 Oct 2011 23:22:34 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Oct 2011 23:22:34 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBxGh-0007OS-GQ
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 00:22:23 +0100
Message-Id: <E1RBxGh-0007OS-GQ@xenbits.xen.org>
Date: Fri, 07 Oct 2011 00:22:23 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenbackendd: fix incorrect usage of
	pidfile
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 Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1317918276 -3600
# Node ID c76f267d987ecba039000354aab32354d2409ba1
# Parent  1344d4476c5263652a403d1f851eb6f314145df1
xenbackendd: fix incorrect usage of pidfile

Fix xenbackendd ignoring the pidfile passed through the command line.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
Acked-by: Christoph Egger <Christoph.Egger@amd.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 1344d4476c52 -r c76f267d987e tools/xenbackendd/xenbackendd.c
--- a/tools/xenbackendd/xenbackendd.c	Thu Oct 06 17:18:38 2011 +0100
+++ b/tools/xenbackendd/xenbackendd.c	Thu Oct 06 17:24:36 2011 +0100
@@ -169,7 +169,7 @@
 			log_file = optarg;
 			break;
 		case 'p':
-			pidfile = pidfile;
+			pidfile = optarg;
 		case 's':
 			vbd_script = optarg;
 			break;

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 16:24:12 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 16:24:12 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBxIR-0001O4-Su; Thu, 06 Oct 2011 16:24:11 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBxGk-0000uP-0z
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 16:22:31 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1317943314!58107092!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1010 invoked from network); 6 Oct 2011 23:21:54 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Oct 2011 23:21:54 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBxGg-0007Nx-VI
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 00:22:22 +0100
Message-Id: <E1RBxGg-0007Nx-VI@xenbits.xen.org>
Date: Fri, 07 Oct 2011 00:22:22 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: wrap help output if command name
	is too long
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 Ian Campbell <ian.campbell@citrix.com>
# Date 1317917918 -3600
# Node ID 1344d4476c5263652a403d1f851eb6f314145df1
# Parent  abd34aba46a3784b176db26af2721ed7277c9c49
xl: wrap help output if command name is too long

Without this in the "xl help" line for pci-list-assignable-devices the command
name merges with the first word of the help. Since the bash completion support
parses "xl help" this leads to "pci-list-assignable-devicesList" being
presented as an option instead of the correct command name.

We also need to filter out lines which start with more than one space in the
bash completion support to stop "List" appearing as a possible command name
after the change to wrap it.

Doesn't address the fact that some help text overflows 80 columns.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r abd34aba46a3 -r 1344d4476c52 tools/libxl/bash-completion
--- a/tools/libxl/bash-completion	Thu Oct 06 16:19:46 2011 +0100
+++ b/tools/libxl/bash-completion	Thu Oct 06 17:18:38 2011 +0100
@@ -11,7 +11,7 @@
 	xl=xl
 
 	if [[ $COMP_CWORD == 1 ]] ; then
-		opts=`${xl} help 2>/dev/null | sed '1,4d' | awk '{print $1}' | sed 's/$/ ,/g'` && COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+		opts=`${xl} help 2>/dev/null | sed '1,4d' | awk '/^ [^ ]/ {print $1}' | sed 's/$/ ,/g'` && COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
 		return 0
 	fi
 
diff -r abd34aba46a3 -r 1344d4476c52 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Thu Oct 06 16:19:46 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Thu Oct 06 17:18:38 2011 +0100
@@ -1728,9 +1728,12 @@
     if (!command || !strcmp(command, "help")) {
         printf("Usage xl [-vN] <subcommand> [args]\n\n");
         printf("xl full list of subcommands:\n\n");
-        for (i = 0; i < cmdtable_len; i++)
-            printf(" %-20s%s\n",
-                   cmd_table[i].cmd_name, cmd_table[i].cmd_desc);
+        for (i = 0; i < cmdtable_len; i++) {
+            printf(" %-19s ", cmd_table[i].cmd_name);
+            if (strlen(cmd_table[i].cmd_name) > 19)
+                printf("\n %-19s ", "");
+            printf("%s\n", cmd_table[i].cmd_desc);
+        }
     } else {
         cmd = cmdtable_lookup(command);
         if (cmd) {

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 16:24:19 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 16:24:19 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBxIY-0001Qz-Uc; Thu, 06 Oct 2011 16:24:19 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBxGi-0000uD-Tb
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 16:22:31 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-27.messagelabs.com!1317943321!43411409!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21912 invoked from network); 6 Oct 2011 23:22:01 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Oct 2011 23:22:01 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBxGf-0007K5-Qm
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 00:22:21 +0100
Message-Id: <E1RBxGf-0007K5-Qm@xenbits.xen.org>
Date: Fri, 07 Oct 2011 00:22:16 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxlu: correctly parse disk
	"backendtype" field
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 Ian Campbell <ian.campbell@citrix.com>
# Date 1317914343 -3600
# Node ID 3be536f7001f1521ad11d54a84338db45bad8d8f
# Parent  af624488efe23e2f7b880b5333909113652989b4
libxlu: correctly parse disk "backendtype" field

Currently it tries to parse the value from the full "backendtype=FOO" string
but really it needs to parse from the equals.

Before:
# xl -N block-attach d32-1 backendtype=phy,vdev=xvdb,access=w,target=/dev/VG/debian-x86_32-1b
command line: config parsing error in disk specification: unknown value for backendtype: near `backendtype=phy' in `backendtype=phy,vdev=xvdb,access=w,target=/dev/VG/debian-x86_32-1b'

After [in new syntax, not yet in this tree -iwj]:
# xl -N block-attach d32-1 backendtype=phy,vdev=xvdb,access=w,target=/dev/VG/debian-x86_32-1b
disk: {
    "backend_domid": 0,
    "pdev_path": "/dev/VG/debian-x86_32-1b",
    "vdev": "xvdb",
    "backend": "phy",
    "format": "raw",
    "script": null,
    "removable": 0,
    "readwrite": 1,
    "is_cdrom": 0
}

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r af624488efe2 -r 3be536f7001f tools/libxl/libxlu_disk_l.c
--- a/tools/libxl/libxlu_disk_l.c	Thu Oct 06 16:15:33 2011 +0100
+++ b/tools/libxl/libxlu_disk_l.c	Thu Oct 06 16:19:03 2011 +0100
@@ -1261,7 +1261,7 @@
 /* rule 8 can match eol */
 YY_RULE_SETUP
 #line 142 "libxlu_disk_l.l"
-{ STRIP(','); setbackendtype(DPC,yytext); }
+{ STRIP(','); setbackendtype(DPC,FROMEQUALS); }
 	YY_BREAK
 case 9:
 /* rule 9 can match eol */
diff -r af624488efe2 -r 3be536f7001f tools/libxl/libxlu_disk_l.l
--- a/tools/libxl/libxlu_disk_l.l	Thu Oct 06 16:15:33 2011 +0100
+++ b/tools/libxl/libxlu_disk_l.l	Thu Oct 06 16:19:03 2011 +0100
@@ -139,7 +139,7 @@
 devtype=[^,]*,?	{ xlu__disk_err(DPC,yytext,"unknown value for type"); }
 
 access=[^,]*,?	{ STRIP(','); setaccess(DPC, FROMEQUALS); }
-backendtype=[^,]*? { STRIP(','); setbackendtype(DPC,yytext); }
+backendtype=[^,]*? { STRIP(','); setbackendtype(DPC,FROMEQUALS); }
 
 vdev=[^,]*,?	{ STRIP(','); SAVESTRING("vdev", vdev, FROMEQUALS); }
 script=[^,]*,?	{ STRIP(','); SAVESTRING("script", script, FROMEQUALS); }

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 16:24:26 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 16:24:26 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBxIf-0001U2-Tt; Thu, 06 Oct 2011 16:24:26 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBxGm-0000uh-DW
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 16:22:32 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-216.messagelabs.com!1317943345!46742!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15708 invoked from network); 6 Oct 2011 23:22:25 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-7.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Oct 2011 23:22:25 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBxGj-0007Px-3D
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 00:22:25 +0100
Message-Id: <E1RBxGj-0007Px-3D@xenbits.xen.org>
Date: Fri, 07 Oct 2011 00:22:24 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: ocaml: Change GET_C_STRUCT to
	Intf_val to follow common naming scheme
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 Zheng Li <dev@zheng.li>
# Date 1317919625 -3600
# Node ID f0c0aa7d57e67a64a339eba24bef59b817a2c96d
# Parent  4d4edbc963560a25547eb91ffaec1ec273b09b38
tools: ocaml: Change GET_C_STRUCT to Intf_val to follow common naming scheme

Change GET_C_STRUCT to Intf_val to follow the common naming scheme of
OCaml macros, and for better readability.

Signed-off-by: Zheng Li <dev@zheng.li>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 4d4edbc96356 -r f0c0aa7d57e6 tools/ocaml/libs/mmap/mmap_stubs.c
--- a/tools/ocaml/libs/mmap/mmap_stubs.c	Thu Oct 06 17:45:43 2011 +0100
+++ b/tools/ocaml/libs/mmap/mmap_stubs.c	Thu Oct 06 17:47:05 2011 +0100
@@ -28,7 +28,7 @@
 #include <caml/fail.h>
 #include <caml/callback.h>
 
-#define GET_C_STRUCT(a) ((struct mmap_interface *) a)
+#define Intf_val(a) ((struct mmap_interface *) a)
 
 static int mmap_interface_init(struct mmap_interface *intf,
                                int fd, int pflag, int mflag,
@@ -61,27 +61,27 @@
 
 	result = caml_alloc(sizeof(struct mmap_interface), Abstract_tag);
 
-	if (mmap_interface_init(GET_C_STRUCT(result), Int_val(fd),
+	if (mmap_interface_init(Intf_val(result), Int_val(fd),
 	                        c_pflag, c_mflag,
 	                        Int_val(len), Int_val(offset)))
 		caml_failwith("mmap");
 	CAMLreturn(result);
 }
 
-CAMLprim value stub_mmap_final(value interface)
+CAMLprim value stub_mmap_final(value intf)
 {
-	CAMLparam1(interface);
+	CAMLparam1(intf);
 
-	if (GET_C_STRUCT(interface)->addr != MAP_FAILED)
-		munmap(GET_C_STRUCT(interface)->addr, GET_C_STRUCT(interface)->len);
-	GET_C_STRUCT(interface)->addr = MAP_FAILED;
+	if (Intf_val(intf)->addr != MAP_FAILED)
+		munmap(Intf_val(intf)->addr, Intf_val(intf)->len);
+	Intf_val(intf)->addr = MAP_FAILED;
 
 	CAMLreturn(Val_unit);
 }
 
-CAMLprim value stub_mmap_read(value interface, value start, value len)
+CAMLprim value stub_mmap_read(value intf, value start, value len)
 {
-	CAMLparam3(interface, start, len);
+	CAMLparam3(intf, start, len);
 	CAMLlocal1(data);
 	int c_start;
 	int c_len;
@@ -89,33 +89,33 @@
 	c_start = Int_val(start);
 	c_len = Int_val(len);
 
-	if (c_start > GET_C_STRUCT(interface)->len)
+	if (c_start > Intf_val(intf)->len)
 		caml_invalid_argument("start invalid");
-	if (c_start + c_len > GET_C_STRUCT(interface)->len)
+	if (c_start + c_len > Intf_val(intf)->len)
 		caml_invalid_argument("len invalid");
 
 	data = caml_alloc_string(c_len);
-	memcpy((char *) data, GET_C_STRUCT(interface)->addr + c_start, c_len);
+	memcpy((char *) data, Intf_val(intf)->addr + c_start, c_len);
 
 	CAMLreturn(data);
 }
 
-CAMLprim value stub_mmap_write(value interface, value data,
+CAMLprim value stub_mmap_write(value intf, value data,
                                value start, value len)
 {
-	CAMLparam4(interface, data, start, len);
+	CAMLparam4(intf, data, start, len);
 	int c_start;
 	int c_len;
 
 	c_start = Int_val(start);
 	c_len = Int_val(len);
 
-	if (c_start > GET_C_STRUCT(interface)->len)
+	if (c_start > Intf_val(intf)->len)
 		caml_invalid_argument("start invalid");
-	if (c_start + c_len > GET_C_STRUCT(interface)->len)
+	if (c_start + c_len > Intf_val(intf)->len)
 		caml_invalid_argument("len invalid");
 
-	memcpy(GET_C_STRUCT(interface)->addr + c_start, (char *) data, c_len);
+	memcpy(Intf_val(intf)->addr + c_start, (char *) data, c_len);
 
 	CAMLreturn(Val_unit);
 }

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 16:24:32 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 16:24:32 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBxIm-0001X0-KD; Thu, 06 Oct 2011 16:24:32 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBxGl-0000ub-3P
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 16:22:32 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-27.messagelabs.com!1317943325!47157259!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31899 invoked from network); 6 Oct 2011 23:22:05 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Oct 2011 23:22:05 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBxGi-0007Ov-17
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 00:22:24 +0100
Message-Id: <E1RBxGi-0007Ov-17@xenbits.xen.org>
Date: Fri, 07 Oct 2011 00:22:23 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: create pci backend only when
	there are pci devices.
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 Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1317918378 -3600
# Node ID 4c4b72c94bac8d14b5046b80ed5569c8397d0de1
# Parent  c76f267d987ecba039000354aab32354d2409ba1
libxl: create pci backend only when there are pci devices.

Creating empty pci entries made Linux DomUs under NetBSD Dom0 wait a very long time for devices to initialize during kernel boot.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r c76f267d987e -r 4c4b72c94bac tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Thu Oct 06 17:24:36 2011 +0100
+++ b/tools/libxl/libxl_create.c	Thu Oct 06 17:26:18 2011 +0100
@@ -588,12 +588,14 @@
     for (i = 0; i < d_config->num_pcidevs; i++)
         libxl__device_pci_add(gc, domid, &d_config->pcidevs[i], 1);
 
-    ret = libxl__create_pci_backend(gc, domid, d_config->pcidevs,
-                                    d_config->num_pcidevs);
-    if (ret < 0) {
-        LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
-                   "libxl_create_pci_backend failed: %d", ret);
-        goto error_out;
+    if (d_config->num_pcidevs > 0) {
+        ret = libxl__create_pci_backend(gc, domid, d_config->pcidevs,
+            d_config->num_pcidevs);
+        if (ret < 0) {
+            LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+                "libxl_create_pci_backend failed: %d", ret);
+            goto error_out;
+        }
     }
 
     if (d_config->c_info.type == LIBXL_DOMAIN_TYPE_PV &&

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 16:24:39 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 16:24:39 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBxIs-0001aC-Sv; Thu, 06 Oct 2011 16:24:38 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBxGl-0000ug-TQ
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 16:22:32 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1317943344!34276689!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25345 invoked from network); 6 Oct 2011 23:22:24 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Oct 2011 23:22:24 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBxGi-0007PP-IP
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 00:22:24 +0100
Message-Id: <E1RBxGi-0007PP-IP@xenbits.xen.org>
Date: Fri, 07 Oct 2011 00:22:24 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: ocaml: Fix invalid memory
	access in OCaml mmap library
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 Zheng Li <dev@zheng.li>
# Date 1317919543 -3600
# Node ID 4d4edbc963560a25547eb91ffaec1ec273b09b38
# Parent  4c4b72c94bac8d14b5046b80ed5569c8397d0de1
tools: ocaml: Fix invalid memory access in OCaml mmap library

Fix invalid memory access in OCaml mmap library (to play nicely with the GC)

This was a bug reported by Roberto Di Cosmo. When he tried to reuse
the mmap library for his own project, Mmap.read occasionally got
different result when reading from the same map. This turned out to be
a bug in the binding, where a C pointer was created pointing to a
OCaml value, and the OCaml value was subsequently moved around by the
GC after memory allocation and hence invalidated the C pointer. This
patch removes the indirection of C pointer and uses OCaml macro to
access values directly.

Only Mmap.read function had this problem. The other functions, despite
having the same code style, didn't have memory allocation involved
hence wouldn't intrigue such an error. I've changed all of them to the
safer style for future proof. Directly casting OCaml value's *data
block* (rather than the value itself) as a C pointer is not a common
practice either, but I'll leave it as it is.

The bug hadn't occured on XenServer because XenServer didn't make use
of the Mmap.read function (except in one place for debugging). In
XenServer, most mmap operations were going through another pair of
separately implemented functions (Xs_ring.read/write).

Signed-off-by: Zheng Li <dev@zheng.li>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 4c4b72c94bac -r 4d4edbc96356 tools/ocaml/libs/mmap/mmap_stubs.c
--- a/tools/ocaml/libs/mmap/mmap_stubs.c	Thu Oct 06 17:26:18 2011 +0100
+++ b/tools/ocaml/libs/mmap/mmap_stubs.c	Thu Oct 06 17:45:43 2011 +0100
@@ -71,12 +71,10 @@
 CAMLprim value stub_mmap_final(value interface)
 {
 	CAMLparam1(interface);
-	struct mmap_interface *intf;
 
-	intf = GET_C_STRUCT(interface);
-	if (intf->addr != MAP_FAILED)
-		munmap(intf->addr, intf->len);
-	intf->addr = MAP_FAILED;
+	if (GET_C_STRUCT(interface)->addr != MAP_FAILED)
+		munmap(GET_C_STRUCT(interface)->addr, GET_C_STRUCT(interface)->len);
+	GET_C_STRUCT(interface)->addr = MAP_FAILED;
 
 	CAMLreturn(Val_unit);
 }
@@ -85,21 +83,19 @@
 {
 	CAMLparam3(interface, start, len);
 	CAMLlocal1(data);
-	struct mmap_interface *intf;
 	int c_start;
 	int c_len;
 
 	c_start = Int_val(start);
 	c_len = Int_val(len);
-	intf = GET_C_STRUCT(interface);
 
-	if (c_start > intf->len)
+	if (c_start > GET_C_STRUCT(interface)->len)
 		caml_invalid_argument("start invalid");
-	if (c_start + c_len > intf->len)
+	if (c_start + c_len > GET_C_STRUCT(interface)->len)
 		caml_invalid_argument("len invalid");
 
 	data = caml_alloc_string(c_len);
-	memcpy((char *) data, intf->addr + c_start, c_len);
+	memcpy((char *) data, GET_C_STRUCT(interface)->addr + c_start, c_len);
 
 	CAMLreturn(data);
 }
@@ -108,20 +104,18 @@
                                value start, value len)
 {
 	CAMLparam4(interface, data, start, len);
-	struct mmap_interface *intf;
 	int c_start;
 	int c_len;
 
 	c_start = Int_val(start);
 	c_len = Int_val(len);
-	intf = GET_C_STRUCT(interface);
 
-	if (c_start > intf->len)
+	if (c_start > GET_C_STRUCT(interface)->len)
 		caml_invalid_argument("start invalid");
-	if (c_start + c_len > intf->len)
+	if (c_start + c_len > GET_C_STRUCT(interface)->len)
 		caml_invalid_argument("len invalid");
 
-	memcpy(intf->addr + c_start, (char *) data, c_len);
+	memcpy(GET_C_STRUCT(interface)->addr + c_start, (char *) data, c_len);
 
 	CAMLreturn(Val_unit);
 }

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 16:24:46 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 16:24:46 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBxJ0-0001d9-69; Thu, 06 Oct 2011 16:24:46 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBxGn-0000un-Dm
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 16:22:34 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-174.messagelabs.com!1317943345!34287579!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24752 invoked from network); 6 Oct 2011 23:22:26 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Oct 2011 23:22:26 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBxGj-0007QT-K3
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 00:22:25 +0100
Message-Id: <E1RBxGj-0007QT-K3@xenbits.xen.org>
Date: Fri, 07 Oct 2011 00:22:25 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] QEMU_TAG update
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 Ian Jackson <Ian.Jackson@eu.citrix.com>
# Date 1317922983 -3600
# Node ID 3bf246beb950a6f400952480b50628953fbbf2f5
# Parent  f0c0aa7d57e67a64a339eba24bef59b817a2c96d
QEMU_TAG update
---


diff -r f0c0aa7d57e6 -r 3bf246beb950 Config.mk
--- a/Config.mk	Thu Oct 06 17:47:05 2011 +0100
+++ b/Config.mk	Thu Oct 06 18:43:03 2011 +0100
@@ -197,9 +197,9 @@
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG ?= cd776ee9408ff127f934a707c1a339ee600bc127
-# Tue Jun 28 13:50:53 2011 +0100
-# qemu-char.c: fix incorrect CONFIG_STUBDOM handling
+QEMU_TAG ?= 25378e0a76b282127e9ab8933a4defbc91db3862
+# Thu Oct 6 18:38:08 2011 +0100
+# remove blktap when building for NetBSD
 
 # Short answer -- do not enable this unless you know what you are
 # doing and are prepared for some pain.

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 16:24:55 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 16:24:55 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBxJ8-0001gG-Vs; Thu, 06 Oct 2011 16:24:55 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBxGo-0000us-5k
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 16:22:34 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-174.messagelabs.com!1317943346!30587836!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 635 invoked from network); 6 Oct 2011 23:22:27 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Oct 2011 23:22:27 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBxGk-0007RT-P5
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 00:22:26 +0100
Message-Id: <E1RBxGk-0007RT-P5@xenbits.xen.org>
Date: Fri, 07 Oct 2011 00:22:26 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: fix libxl_mac_to_device_nic
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 Ian Campbell <ian.campbell@citrix.com>
# Date 1317923422 -3600
# Node ID 61e6a43e5abcaadb22685155ea9d4afd5c66d37e
# Parent  98e8b894927b59f5ad4046f591d63f77f556b692
libxl: fix libxl_mac_to_device_nic

I think I broke this back in 22041:4c9ef5ec9146, using i as both the inner and
outer loop iterator.

I've added libxl__compare_macs which helps keep things clean.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 98e8b894927b -r 61e6a43e5abc tools/libxl/libxl_internal.c
--- a/tools/libxl/libxl_internal.c	Thu Oct 06 18:49:41 2011 +0100
+++ b/tools/libxl/libxl_internal.c	Thu Oct 06 18:50:22 2011 +0100
@@ -294,6 +294,18 @@
     return 0;
 }
 
+_hidden int libxl__compare_macs(libxl_mac *a, libxl_mac *b)
+{
+    int i;
+
+    for (i = 0; i<6; i++) {
+        if ((*a)[i] != (*b)[i])
+            return (*a)[i] - (*b)[i];
+    }
+
+    return 0;
+}
+
 int libxl__fd_set_cloexec(int fd)
 {
     int flags = 0;
diff -r 98e8b894927b -r 61e6a43e5abc tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Thu Oct 06 18:49:41 2011 +0100
+++ b/tools/libxl/libxl_internal.h	Thu Oct 06 18:50:22 2011 +0100
@@ -416,7 +416,10 @@
 
 _hidden int libxl__e820_alloc(libxl_ctx *ctx, uint32_t domid, libxl_domain_config *d_config);
 
+/* parse the string @s as a sequence of 6 colon separated bytes in to @mac */
 _hidden int libxl__parse_mac(const char *s, libxl_mac mac);
+/* compare mac address @a and @b. 0 if the same, -ve if a<b and +ve if a>b */
+_hidden int libxl__compare_macs(libxl_mac *a, libxl_mac *b);
 
 #define STRINGIFY(x) #x
 #define TOSTRING(x) STRINGIFY(x)
diff -r 98e8b894927b -r 61e6a43e5abc tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c	Thu Oct 06 18:49:41 2011 +0100
+++ b/tools/libxl/libxl_utils.c	Thu Oct 06 18:50:22 2011 +0100
@@ -453,9 +453,7 @@
 {
     libxl_nicinfo *nics;
     unsigned int nb, rc, i;
-    int found;
     libxl_mac mac_n;
-    uint8_t *a, *b;
 
     rc = libxl__parse_mac(mac, mac_n);
     if (rc)
@@ -466,17 +464,15 @@
         return ERROR_FAIL;
 
     memset(nic, 0, sizeof (libxl_device_nic));
-    found = 0;
+
+    rc = ERROR_INVAL;
     for (i = 0; i < nb; ++i) {
-        for (i = 0, a = nics[i].mac, b = mac_n;
-             (b < mac_n + 6) && (*a == *b); ++a, ++b)
-            ;
-        if ((b >= mac_n + 6) && (*a == *b)) {
+        if (!libxl__compare_macs(&mac_n, &nics[i].mac)) {
             nic->backend_domid = nics[i].backend_id;
             nic->devid = nics[i].devid;
             memcpy(nic->mac, nics[i].mac, sizeof (nic->mac));
             nic->script = strdup(nics[i].script);
-            found = 1;
+            rc = 0;
             break;
         }
     }
@@ -484,7 +480,7 @@
     for (i=0; i<nb; i++)
         libxl_nicinfo_destroy(&nics[i]);
     free(nics);
-    return found;
+    return rc;
 }
 
 int libxl_devid_to_device_nic(libxl_ctx *ctx, uint32_t domid,

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 16:25:01 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 16:25:01 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBxJF-0001j9-6E; Thu, 06 Oct 2011 16:25:01 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBxGn-0000um-Ai
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 16:22:34 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-27.messagelabs.com!1317943326!47655426!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6856 invoked from network); 6 Oct 2011 23:22:06 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Oct 2011 23:22:06 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBxGk-0007Qz-6E
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 00:22:26 +0100
Message-Id: <E1RBxGk-0007Qz-6E@xenbits.xen.org>
Date: Fri, 07 Oct 2011 00:22:25 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: add and use parse_mac helper
	function
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 Ian Campbell <ian.campbell@citrix.com>
# Date 1317923381 -3600
# Node ID 98e8b894927b59f5ad4046f591d63f77f556b692
# Parent  3bf246beb950a6f400952480b50628953fbbf2f5
libxl: add and use parse_mac helper function

rather than open coding a bunch it a bunch of times.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 3bf246beb950 -r 98e8b894927b tools/libxl/libxl_internal.c
--- a/tools/libxl/libxl_internal.c	Thu Oct 06 18:43:03 2011 +0100
+++ b/tools/libxl/libxl_internal.c	Thu Oct 06 18:49:41 2011 +0100
@@ -277,6 +277,23 @@
 	return ERROR_FAIL;
 }
 
+_hidden int libxl__parse_mac(const char *s, libxl_mac mac)
+{
+    const char *tok;
+    char *endptr;
+    int i;
+
+    for (i = 0, tok = s; *tok && (i < 6); ++i, tok += 3) {
+        mac[i] = strtol(tok, &endptr, 16);
+        if (endptr != (tok + 2) || (*endptr != '\0' && *endptr != ':') )
+            return ERROR_INVAL;
+    }
+    if ( i != 6 )
+        return ERROR_INVAL;
+
+    return 0;
+}
+
 int libxl__fd_set_cloexec(int fd)
 {
     int flags = 0;
diff -r 3bf246beb950 -r 98e8b894927b tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Thu Oct 06 18:43:03 2011 +0100
+++ b/tools/libxl/libxl_internal.h	Thu Oct 06 18:49:41 2011 +0100
@@ -416,6 +416,8 @@
 
 _hidden int libxl__e820_alloc(libxl_ctx *ctx, uint32_t domid, libxl_domain_config *d_config);
 
+_hidden int libxl__parse_mac(const char *s, libxl_mac mac);
+
 #define STRINGIFY(x) #x
 #define TOSTRING(x) STRINGIFY(x)
 
diff -r 3bf246beb950 -r 98e8b894927b tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c	Thu Oct 06 18:43:03 2011 +0100
+++ b/tools/libxl/libxl_utils.c	Thu Oct 06 18:49:41 2011 +0100
@@ -452,22 +452,19 @@
                             const char *mac, libxl_device_nic *nic)
 {
     libxl_nicinfo *nics;
-    unsigned int nb, i;
+    unsigned int nb, rc, i;
     int found;
-    uint8_t mac_n[6];
+    libxl_mac mac_n;
     uint8_t *a, *b;
-    const char *tok;
-    char *endptr;
+
+    rc = libxl__parse_mac(mac, mac_n);
+    if (rc)
+	    return rc;
 
     nics = libxl_list_nics(ctx, domid, &nb);
     if (!nics)
         return ERROR_FAIL;
 
-    for (i = 0, tok = mac; *tok && (i < 6); ++i, tok += 3) {
-        mac_n[i] = strtol(tok, &endptr, 16);
-        if (endptr != (tok + 2))
-            return ERROR_INVAL;
-    }
     memset(nic, 0, sizeof (libxl_device_nic));
     found = 0;
     for (i = 0; i < nb; ++i) {
@@ -494,9 +491,8 @@
                               const char *devid, libxl_device_nic *nic)
 {
     libxl__gc gc = LIBXL_INIT_GC(ctx);
-    char *tok, *val;
+    char *val;
     char *dompath, *nic_path_fe, *nic_path_be;
-    unsigned int i;
     int rc = ERROR_FAIL;
 
     memset(nic, 0, sizeof (libxl_device_nic));
@@ -515,10 +511,10 @@
     nic->devid = strtoul(devid, NULL, 10);
 
     val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/mac", nic_path_fe));
-    for (i = 0, tok = strtok(val, ":"); tok && (i < 6);
-         ++i, tok = strtok(NULL, ":")) {
-        nic->mac[i] = strtoul(tok, NULL, 16);
-    }
+    rc = libxl__parse_mac(val, nic->mac);
+    if (rc)
+	    goto out;
+
     nic->script = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "%s/script", nic_path_be), NULL);
     rc = 0;
 out:

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 16:25:10 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 16:25:10 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBxJO-0001mn-7v; Thu, 06 Oct 2011 16:25:10 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBxGp-0000ux-5A
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 16:22:34 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-182.messagelabs.com!1317943347!21273003!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13558 invoked from network); 6 Oct 2011 23:22:28 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Oct 2011 23:22:28 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBxGl-0007SS-Rz
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 00:22:27 +0100
Message-Id: <E1RBxGl-0007SS-Rz@xenbits.xen.org>
Date: Fri, 07 Oct 2011 00:22:27 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxc: add
	xc_gnttab_map_grant_ref_notify
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 Daniel De Graaf <dgdegra@tycho.nsa.gov>
# Date 1317925733 -3600
# Node ID aea2b06769f3c7659ee1ee3601bb9bc01781665e
# Parent  19d2922bcfb9f5337b794213ac3a6d4c08472dae
libxc: add xc_gnttab_map_grant_ref_notify

Normally, when a userspace process mapping a grant crashes, the domain
providing the reference receives no indication that its peer has
crashed, possibly leading to unexpected freezes or timeouts. This
function provides a notification of the unmap by signalling an event
channel and/or clearing a specific byte in the page.

This also unifies the 3 very similar grant-mapping osdep interfaces into
a single function instead of introducing yet another minor variation.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 19d2922bcfb9 -r aea2b06769f3 tools/include/xen-sys/Linux/gntdev.h
--- a/tools/include/xen-sys/Linux/gntdev.h	Thu Oct 06 19:11:51 2011 +0100
+++ b/tools/include/xen-sys/Linux/gntdev.h	Thu Oct 06 19:28:53 2011 +0100
@@ -66,7 +66,7 @@
  * before this ioctl is called, or an error will result.
  */
 #define IOCTL_GNTDEV_UNMAP_GRANT_REF \
-_IOC(_IOC_NONE, 'G', 1, sizeof(struct ioctl_gntdev_unmap_grant_ref))       
+_IOC(_IOC_NONE, 'G', 1, sizeof(struct ioctl_gntdev_unmap_grant_ref))
 struct ioctl_gntdev_unmap_grant_ref {
 	/* IN parameters */
 	/* The offset was returned by the corresponding map operation. */
@@ -116,4 +116,35 @@
 	uint32_t count;
 };
 
+/*
+ * Sets up an unmap notification within the page, so that the other side can do
+ * cleanup if this side crashes. Required to implement cross-domain robust
+ * mutexes or close notification on communication channels.
+ *
+ * Each mapped page only supports one notification; multiple calls referring to
+ * the same page overwrite the previous notification. You must clear the
+ * notification prior to the IOCTL_GNTALLOC_DEALLOC_GREF if you do not want it
+ * to occur.
+ */
+#define IOCTL_GNTDEV_SET_UNMAP_NOTIFY \
+_IOC(_IOC_NONE, 'G', 7, sizeof(struct ioctl_gntdev_unmap_notify))
+struct ioctl_gntdev_unmap_notify {
+	/* IN parameters */
+	/* Offset in the file descriptor for a byte within the page. This offset
+	 * is the result of the IOCTL_GNTDEV_MAP_GRANT_REF and is the same as
+	 * is used with mmap(). If using UNMAP_NOTIFY_CLEAR_BYTE, this is the byte
+	 * within the page to be cleared.
+	 */
+	uint64_t index;
+	/* Action(s) to take on unmap */
+	uint32_t action;
+	/* Event channel to notify */
+	uint32_t event_channel_port;
+};
+
+/* Clear (set to zero) the byte specified by index */
+#define UNMAP_NOTIFY_CLEAR_BYTE 0x1
+/* Send an interrupt on the indicated event channel */
+#define UNMAP_NOTIFY_SEND_EVENT 0x2
+
 #endif /* __LINUX_PUBLIC_GNTDEV_H__ */
diff -r 19d2922bcfb9 -r aea2b06769f3 tools/libxc/xc_gnttab.c
--- a/tools/libxc/xc_gnttab.c	Thu Oct 06 19:11:51 2011 +0100
+++ b/tools/libxc/xc_gnttab.c	Thu Oct 06 19:28:53 2011 +0100
@@ -18,6 +18,7 @@
  */
 
 #include "xc_private.h"
+#include <errno.h>
 
 int xc_gnttab_op(xc_interface *xch, int cmd, void * op, int op_size, int count)
 {
@@ -150,8 +151,8 @@
                               uint32_t ref,
                               int prot)
 {
-	return xcg->ops->u.gnttab.map_grant_ref(xcg, xcg->ops_handle,
-						domid, ref, prot);
+	return xcg->ops->u.gnttab.grant_map(xcg, xcg->ops_handle, 1, 0, prot,
+	                                    &domid, &ref, -1, -1);
 }
 
 void *xc_gnttab_map_grant_refs(xc_gnttab *xcg,
@@ -160,8 +161,8 @@
                                uint32_t *refs,
                                int prot)
 {
-	return xcg->ops->u.gnttab.map_grant_refs(xcg, xcg->ops_handle,
-						 count, domids, refs, prot);
+	return xcg->ops->u.gnttab.grant_map(xcg, xcg->ops_handle, count, 0,
+	                                    prot, domids, refs, -1, -1);
 }
 
 void *xc_gnttab_map_domain_grant_refs(xc_gnttab *xcg,
@@ -170,10 +171,23 @@
                                       uint32_t *refs,
                                       int prot)
 {
-	return xcg->ops->u.gnttab.map_domain_grant_refs(xcg, xcg->ops_handle,
-							count, domid, refs, prot);
+	return xcg->ops->u.gnttab.grant_map(xcg, xcg->ops_handle, count,
+	                                    XC_GRANT_MAP_SINGLE_DOMAIN,
+	                                    prot, &domid, refs, -1, -1);
 }
 
+void *xc_gnttab_map_grant_ref_notify(xc_gnttab *xcg,
+                                     uint32_t domid,
+                                     uint32_t ref,
+                                     int prot,
+                                     uint32_t notify_offset,
+                                     evtchn_port_t notify_port)
+{
+	return xcg->ops->u.gnttab.grant_map(xcg, xcg->ops_handle, 1, 0, prot,
+	                              &domid, &ref, notify_offset, notify_port);
+}
+
+
 int xc_gnttab_munmap(xc_gnttab *xcg,
                      void *start_address,
                      uint32_t count)
diff -r 19d2922bcfb9 -r aea2b06769f3 tools/libxc/xc_linux_osdep.c
--- a/tools/libxc/xc_linux_osdep.c	Thu Oct 06 19:11:51 2011 +0100
+++ b/tools/libxc/xc_linux_osdep.c	Thu Oct 06 19:28:53 2011 +0100
@@ -509,56 +509,21 @@
     return close(fd);
 }
 
-static void *linux_gnttab_map_grant_ref(xc_gnttab *xch, xc_osdep_handle h,
-                                        uint32_t domid, uint32_t ref, int prot)
-{
-    int fd = (int)h;
-    struct ioctl_gntdev_map_grant_ref map;
-    void *addr;
-
-    map.count = 1;
-    map.refs[0].domid = domid;
-    map.refs[0].ref = ref;
-
-    if ( ioctl(fd, IOCTL_GNTDEV_MAP_GRANT_REF, &map) ) {
-        PERROR("xc_gnttab_map_grant_ref: ioctl MAP_GRANT_REF failed");
-        return NULL;
-    }
-
-mmap_again:    
-    addr = mmap(NULL, XC_PAGE_SIZE, prot, MAP_SHARED, fd, map.index);
-    if ( addr == MAP_FAILED )
-    {
-        int saved_errno = errno;
-        struct ioctl_gntdev_unmap_grant_ref unmap_grant;
-
-        if(saved_errno == EAGAIN)
-        {
-            usleep(1000);
-            goto mmap_again;
-        }
-         /* Unmap the driver slots used to store the grant information. */
-        PERROR("xc_gnttab_map_grant_ref: mmap failed");
-        unmap_grant.index = map.index;
-        unmap_grant.count = 1;
-        ioctl(fd, IOCTL_GNTDEV_UNMAP_GRANT_REF, &unmap_grant);
-        errno = saved_errno;
-        return NULL;
-    }
-
-    return addr;
-}
-
-static void *do_gnttab_map_grant_refs(xc_gnttab *xch, xc_osdep_handle h,
-                                      uint32_t count,
-                                      uint32_t *domids, int domids_stride,
-                                      uint32_t *refs, int prot)
+static void *linux_gnttab_grant_map(xc_gnttab *xch, xc_osdep_handle h,
+                                    uint32_t count, int flags, int prot,
+                                    uint32_t *domids, uint32_t *refs,
+                                    uint32_t notify_offset,
+                                    evtchn_port_t notify_port)
 {
     int fd = (int)h;
     struct ioctl_gntdev_map_grant_ref *map;
     void *addr = NULL;
+    int domids_stride = 1;
     int i;
 
+    if (flags & XC_GRANT_MAP_SINGLE_DOMAIN)
+        domids_stride = 0;
+
     map = malloc(sizeof(*map) +
                  (count - 1) * sizeof(struct ioctl_gntdev_map_grant_ref));
     if ( map == NULL )
@@ -573,13 +538,52 @@
     map->count = count;
 
     if ( ioctl(fd, IOCTL_GNTDEV_MAP_GRANT_REF, map) ) {
-        PERROR("xc_gnttab_map_grant_refs: ioctl MAP_GRANT_REF failed");
+        PERROR("linux_gnttab_grant_map: ioctl MAP_GRANT_REF failed");
         goto out;
     }
 
+ retry:
     addr = mmap(NULL, XC_PAGE_SIZE * count, prot, MAP_SHARED, fd,
                 map->index);
-    if ( addr == MAP_FAILED )
+
+    if (addr == MAP_FAILED && errno == EAGAIN)
+    {
+        /*
+         * The grant hypercall can return EAGAIN if the granted page is
+         * swapped out. Since the paging daemon may be in the same domain, the
+         * hypercall cannot block without causing a deadlock.
+         *
+         * Because there are no notificaitons when the page is swapped in, wait
+         * a bit before retrying, and hope that the page will arrive eventually.
+         */
+        usleep(1000);
+        goto retry;
+    }
+
+    if (addr != MAP_FAILED)
+    {
+        int rv = 0;
+        struct ioctl_gntdev_unmap_notify notify;
+        notify.index = map->index;
+        notify.action = 0;
+        if (notify_offset >= 0 && notify_offset < XC_PAGE_SIZE * count) {
+            notify.index += notify_offset;
+            notify.action |= UNMAP_NOTIFY_CLEAR_BYTE;
+        }
+        if (notify_port != -1) {
+            notify.event_channel_port = notify_port;
+            notify.action |= UNMAP_NOTIFY_SEND_EVENT;
+        }
+        if (notify.action)
+            rv = ioctl(fd, IOCTL_GNTDEV_SET_UNMAP_NOTIFY, &notify);
+        if (rv) {
+            PERROR("linux_gnttab_grant_map: ioctl SET_UNMAP_NOTIFY failed");
+            munmap(addr, count * XC_PAGE_SIZE);
+            addr = MAP_FAILED;
+        }
+    }
+
+    if (addr == MAP_FAILED)
     {
         int saved_errno = errno;
         struct ioctl_gntdev_unmap_grant_ref unmap_grant;
@@ -599,19 +603,7 @@
     return addr;
 }
 
-static void *linux_gnttab_map_grant_refs(xc_gnttab *xcg, xc_osdep_handle h,
-                                         uint32_t count, uint32_t *domids,
-                                         uint32_t *refs, int prot)
-{
-    return do_gnttab_map_grant_refs(xcg, h, count, domids, 1, refs, prot);
-}
 
-static void *linux_gnttab_map_domain_grant_refs(xc_gnttab *xcg, xc_osdep_handle h,
-                                                uint32_t count,
-                                                uint32_t domid, uint32_t *refs, int prot)
-{
-    return do_gnttab_map_grant_refs(xcg, h, count, &domid, 0, refs, prot);
-}
 
 static int linux_gnttab_munmap(xc_gnttab *xcg, xc_osdep_handle h,
                                void *start_address, uint32_t count)
@@ -659,9 +651,7 @@
     .close = &linux_gnttab_close,
 
     .u.gnttab = {
-        .map_grant_ref = &linux_gnttab_map_grant_ref,
-        .map_grant_refs = &linux_gnttab_map_grant_refs,
-        .map_domain_grant_refs = &linux_gnttab_map_domain_grant_refs,
+        .grant_map = &linux_gnttab_grant_map,
         .munmap = &linux_gnttab_munmap,
     },
 };
diff -r 19d2922bcfb9 -r aea2b06769f3 tools/libxc/xc_minios.c
--- a/tools/libxc/xc_minios.c	Thu Oct 06 19:11:51 2011 +0100
+++ b/tools/libxc/xc_minios.c	Thu Oct 06 19:28:53 2011 +0100
@@ -458,45 +458,23 @@
     files[fd].type = FTYPE_NONE;
 }
 
-static void *minios_gnttab_map_grant_ref(xc_gnttab *xcg, xc_osdep_handle h,
-                                         uint32_t domid,
-                                         uint32_t ref,
-                                         int prot)
+static void *minios_gnttab_grant_map(xc_gnttab *xcg, xc_osdep_handle h,
+                                     uint32_t count, int flags, int prot,
+                                     uint32_t *domids, uint32_t *refs,
+                                     uint32_t notify_offset,
+                                     evtchn_port_t notify_port)
 {
     int fd = (int)h;
+    int stride = 1;
+    if (flags & XC_GRANT_MAP_SINGLE_DOMAIN)
+        stride = 0;
+    if (notify_offset != -1 || notify_port != -1) {
+        errno = ENOSYS;
+        return NULL;
+    }
     return gntmap_map_grant_refs(&files[fd].gntmap,
-                                 1,
-                                 &domid, 0,
-                                 &ref,
-                                 prot & PROT_WRITE);
-}
-
-static void *minios_gnttab_map_grant_refs(xc_gnttab *xcg, xc_osdep_handle h,
-                                          uint32_t count,
-                                          uint32_t *domids,
-                                          uint32_t *refs,
-                                          int prot)
-{
-    int fd = (int)h;
-    return gntmap_map_grant_refs(&files[fd].gntmap,
-                                 count,
-                                 domids, 1,
-                                 refs,
-                                 prot & PROT_WRITE);
-}
-
-static void *minios_gnttab_map_domain_grant_refs(xc_gnttab *xcg, xc_osdep_handle h,
-                                                 uint32_t count,
-                                                 uint32_t domid,
-                                                 uint32_t *refs,
-                                                 int prot)
-{
-    int fd = (int)h;
-    return gntmap_map_grant_refs(&files[fd].gntmap,
-                                 count,
-                                 &domid, 0,
-                                 refs,
-                                 prot & PROT_WRITE);
+                                 count, domids, stride,
+                                 refs, prot & PROT_WRITE);
 }
 
 static int minios_gnttab_munmap(xc_gnttab *xcg, xc_osdep_handle h,
@@ -534,9 +512,7 @@
     .close = &minios_gnttab_close,
 
     .u.gnttab = {
-        .map_grant_ref = &minios_gnttab_map_grant_ref,
-        .map_grant_refs = &minios_gnttab_map_grant_refs,
-        .map_domain_grant_refs = &minios_gnttab_map_domain_grant_refs,
+        .grant_map = &minios_gnttab_grant_map,
         .munmap = &minios_gnttab_munmap,
         .set_max_grants = &minios_gnttab_set_max_grants,
     },
diff -r 19d2922bcfb9 -r aea2b06769f3 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h	Thu Oct 06 19:11:51 2011 +0100
+++ b/tools/libxc/xenctrl.h	Thu Oct 06 19:28:53 2011 +0100
@@ -1349,6 +1349,29 @@
                                       uint32_t *refs,
                                       int prot);
 
+/**
+ * Memory maps a grant reference from one domain to a local address range.
+ * Mappings should be unmapped with xc_gnttab_munmap. If notify_offset or
+ * notify_port are not -1, this version will attempt to set up an unmap
+ * notification at the given offset and event channel. When the page is
+ * unmapped, the byte at the given offset will be zeroed and a wakeup will be
+ * sent to the given event channel.  Logs errors.
+ *
+ * @parm xcg a handle on an open grant table interface
+ * @parm domid the domain to map memory from
+ * @parm ref the grant reference ID to map
+ * @parm prot same flag as in mmap()
+ * @parm notify_offset The byte offset in the page to use for unmap
+ *                     notification; -1 for none.
+ * @parm notify_port The event channel port to use for unmap notify, or -1
+ */
+void *xc_gnttab_map_grant_ref_notify(xc_gnttab *xcg,
+                                     uint32_t domid,
+                                     uint32_t ref,
+                                     int prot,
+                                     uint32_t notify_offset,
+                                     evtchn_port_t notify_port);
+
 /*
  * Unmaps the @count pages starting at @start_address, which were mapped by a
  * call to xc_gnttab_map_grant_ref or xc_gnttab_map_grant_refs. Never logs.
diff -r 19d2922bcfb9 -r aea2b06769f3 tools/libxc/xenctrlosdep.h
--- a/tools/libxc/xenctrlosdep.h	Thu Oct 06 19:11:51 2011 +0100
+++ b/tools/libxc/xenctrlosdep.h	Thu Oct 06 19:28:53 2011 +0100
@@ -105,20 +105,12 @@
             int (*unmask)(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_t port);
         } evtchn;
         struct {
-            void *(*map_grant_ref)(xc_gnttab *xcg, xc_osdep_handle h,
-                                   uint32_t domid,
-                                   uint32_t ref,
-                                   int prot);
-            void *(*map_grant_refs)(xc_gnttab *xcg, xc_osdep_handle h,
-                                    uint32_t count,
-                                    uint32_t *domids,
-                                    uint32_t *refs,
-                                    int prot);
-            void *(*map_domain_grant_refs)(xc_gnttab *xcg, xc_osdep_handle h,
-                                           uint32_t count,
-                                           uint32_t domid,
-                                           uint32_t *refs,
-                                           int prot);
+#define XC_GRANT_MAP_SINGLE_DOMAIN 0x1
+            void *(*grant_map)(xc_gnttab *xcg, xc_osdep_handle h,
+                               uint32_t count, int flags, int prot,
+                               uint32_t *domids, uint32_t *refs,
+                               uint32_t notify_offset,
+                               evtchn_port_t notify_port);
             int (*munmap)(xc_gnttab *xcg, xc_osdep_handle h,
                           void *start_address,
                           uint32_t count);

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 16:25:17 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 16:25:17 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBxJV-0001pf-8A; Thu, 06 Oct 2011 16:25:17 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBxGp-0000v3-P8
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 16:22:34 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-216.messagelabs.com!1317943348!45965!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25578 invoked from network); 6 Oct 2011 23:22:28 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Oct 2011 23:22:28 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBxGm-0007Sx-EZ
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 00:22:28 +0100
Message-Id: <E1RBxGm-0007Sx-EZ@xenbits.xen.org>
Date: Fri, 07 Oct 2011 00:22:27 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxc: add xc_gntshr_* functions
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 Daniel De Graaf <dgdegra@tycho.nsa.gov>
# Date 1317926281 -3600
# Node ID 95e0564f493be2815c80c2371c158de62fbdaf2a
# Parent  aea2b06769f3c7659ee1ee3601bb9bc01781665e
libxc: add xc_gntshr_* functions

These functions and the xc_gntshr device (/dev/xen/gntalloc on linux)
allow applications to create pages shared with other domains.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r aea2b06769f3 -r 95e0564f493b tools/include/xen-sys/Linux/gntalloc.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/include/xen-sys/Linux/gntalloc.h	Thu Oct 06 19:38:01 2011 +0100
@@ -0,0 +1,82 @@
+/******************************************************************************
+ * gntalloc.h
+ *
+ * Interface to /dev/xen/gntalloc.
+ *
+ * Author: Daniel De Graaf <dgdegra@tycho.nsa.gov>
+ *
+ * This file is in the public domain.
+ */
+
+#ifndef __LINUX_PUBLIC_GNTALLOC_H__
+#define __LINUX_PUBLIC_GNTALLOC_H__
+
+/*
+ * Allocates a new page and creates a new grant reference.
+ */
+#define IOCTL_GNTALLOC_ALLOC_GREF \
+_IOC(_IOC_NONE, 'G', 5, sizeof(struct ioctl_gntalloc_alloc_gref))
+struct ioctl_gntalloc_alloc_gref {
+	/* IN parameters */
+	/* The ID of the domain to be given access to the grants. */
+	uint16_t domid;
+	/* Flags for this mapping */
+	uint16_t flags;
+	/* Number of pages to map */
+	uint32_t count;
+	/* OUT parameters */
+	/* The offset to be used on a subsequent call to mmap(). */
+	uint64_t index;
+	/* The grant references of the newly created grant, one per page */
+	/* Variable size, depending on count */
+	uint32_t gref_ids[1];
+};
+
+#define GNTALLOC_FLAG_WRITABLE 1
+
+/*
+ * Deallocates the grant reference, allowing the associated page to be freed if
+ * no other domains are using it.
+ */
+#define IOCTL_GNTALLOC_DEALLOC_GREF \
+_IOC(_IOC_NONE, 'G', 6, sizeof(struct ioctl_gntalloc_dealloc_gref))
+struct ioctl_gntalloc_dealloc_gref {
+	/* IN parameters */
+	/* The offset returned in the map operation */
+	uint64_t index;
+	/* Number of references to unmap */
+	uint32_t count;
+};
+
+/*
+ * Sets up an unmap notification within the page, so that the other side can do
+ * cleanup if this side crashes. Required to implement cross-domain robust
+ * mutexes or close notification on communication channels.
+ *
+ * Each mapped page only supports one notification; multiple calls referring to
+ * the same page overwrite the previous notification. You must clear the
+ * notification prior to the IOCTL_GNTALLOC_DEALLOC_GREF if you do not want it
+ * to occur.
+ */
+#define IOCTL_GNTALLOC_SET_UNMAP_NOTIFY \
+_IOC(_IOC_NONE, 'G', 7, sizeof(struct ioctl_gntalloc_unmap_notify))
+struct ioctl_gntalloc_unmap_notify {
+	/* IN parameters */
+	/* Offset in the file descriptor for a byte within the page (same as
+	 * used in mmap). If using UNMAP_NOTIFY_CLEAR_BYTE, this is the byte to
+	 * be cleared. Otherwise, it can be any byte in the page whose
+	 * notification we are adjusting.
+	 */
+	uint64_t index;
+	/* Action(s) to take on unmap */
+	uint32_t action;
+	/* Event channel to notify */
+	uint32_t event_channel_port;
+};
+
+/* Clear (set to zero) the byte specified by index */
+#define UNMAP_NOTIFY_CLEAR_BYTE 0x1
+/* Send an interrupt on the indicated event channel */
+#define UNMAP_NOTIFY_SEND_EVENT 0x2
+
+#endif /* __LINUX_PUBLIC_GNTALLOC_H__ */
diff -r aea2b06769f3 -r 95e0564f493b tools/libxc/xc_gnttab.c
--- a/tools/libxc/xc_gnttab.c	Thu Oct 06 19:28:53 2011 +0100
+++ b/tools/libxc/xc_gnttab.c	Thu Oct 06 19:38:01 2011 +0100
@@ -203,6 +203,33 @@
 	return xcg->ops->u.gnttab.set_max_grants(xcg, xcg->ops_handle, count);
 }
 
+void *xc_gntshr_share_pages(xc_gntshr *xcg, uint32_t domid,
+                            int count, uint32_t *refs, int writable)
+{
+	return xcg->ops->u.gntshr.share_pages(xcg, xcg->ops_handle, domid,
+	                                      count, refs, writable, -1, -1);
+}
+
+void *xc_gntshr_share_page_notify(xc_gntshr *xcg, uint32_t domid,
+                                  uint32_t *ref, int writable,
+                                  uint32_t notify_offset,
+                                  evtchn_port_t notify_port)
+{
+	return xcg->ops->u.gntshr.share_pages(xcg, xcg->ops_handle,
+			domid, 1, ref, writable, notify_offset, notify_port);
+}
+
+/*
+ * Unmaps the @count pages starting at @start_address, which were mapped by a
+ * call to xc_gntshr_share_*. Never logs.
+ */
+int xc_gntshr_munmap(xc_gntshr *xcg, void *start_address, uint32_t count)
+{
+	return xcg->ops->u.gntshr.munmap(xcg, xcg->ops_handle,
+					 start_address, count);
+}
+
+
 /*
  * Local variables:
  * mode: C
diff -r aea2b06769f3 -r 95e0564f493b tools/libxc/xc_linux_osdep.c
--- a/tools/libxc/xc_linux_osdep.c	Thu Oct 06 19:28:53 2011 +0100
+++ b/tools/libxc/xc_linux_osdep.c	Thu Oct 06 19:38:01 2011 +0100
@@ -34,6 +34,7 @@
 #include <xen/memory.h>
 #include <xen/sys/evtchn.h>
 #include <xen/sys/gntdev.h>
+#include <xen/sys/gntalloc.h>
 
 #include "xenctrl.h"
 #include "xenctrlosdep.h"
@@ -656,6 +657,105 @@
     },
 };
 
+static xc_osdep_handle linux_gntshr_open(xc_gntshr *xcg)
+{
+    int fd = open(DEVXEN "gntalloc", O_RDWR);
+
+    if ( fd == -1 )
+        return XC_OSDEP_OPEN_ERROR;
+
+    return (xc_osdep_handle)fd;
+}
+
+static int linux_gntshr_close(xc_gntshr *xcg, xc_osdep_handle h)
+{
+    int fd = (int)h;
+    return close(fd);
+}
+
+static void *linux_gntshr_share_pages(xc_gntshr *xch, xc_osdep_handle h,
+                                      uint32_t domid, int count,
+                                      uint32_t *refs, int writable,
+                                      uint32_t notify_offset,
+                                      evtchn_port_t notify_port)
+{
+    struct ioctl_gntalloc_alloc_gref *gref_info = NULL;
+    struct ioctl_gntalloc_unmap_notify notify;
+    struct ioctl_gntalloc_dealloc_gref gref_drop;
+    int fd = (int)h;
+    int err;
+    void *area = NULL;
+    gref_info = malloc(sizeof(*gref_info) + count * sizeof(uint32_t));
+    if (!gref_info)
+        return NULL;
+    gref_info->domid = domid;
+    gref_info->flags = writable ? GNTALLOC_FLAG_WRITABLE : 0;
+    gref_info->count = count;
+
+    err = ioctl(fd, IOCTL_GNTALLOC_ALLOC_GREF, gref_info);
+    if (err) {
+        PERROR("linux_gntshr_share_pages: ioctl failed");
+        goto out;
+    }
+
+    area = mmap(NULL, count * XC_PAGE_SIZE, PROT_READ | PROT_WRITE,
+        MAP_SHARED, fd, gref_info->index);
+
+    if (area == MAP_FAILED) {
+        area = NULL;
+        PERROR("linux_gntshr_share_pages: mmap failed");
+        goto out_remove_fdmap;
+    }
+
+    notify.index = gref_info->index;
+    notify.action = 0;
+    if (notify_offset >= 0) {
+        notify.index += notify_offset;
+        notify.action |= UNMAP_NOTIFY_CLEAR_BYTE;
+    }
+    if (notify_port >= 0) {
+        notify.event_channel_port = notify_port;
+        notify.action |= UNMAP_NOTIFY_SEND_EVENT;
+    }
+    if (notify.action)
+        err = ioctl(fd, IOCTL_GNTALLOC_SET_UNMAP_NOTIFY, &notify);
+    if (err) {
+        PERROR("linux_gntshr_share_page_notify: ioctl SET_UNMAP_NOTIFY failed");
+		munmap(area, count * XC_PAGE_SIZE);
+		area = NULL;
+	}
+
+    memcpy(refs, gref_info->gref_ids, count * sizeof(uint32_t));
+
+ out_remove_fdmap:
+    /* Removing the mapping from the file descriptor does not cause the pages to
+     * be deallocated until the mapping is removed.
+     */
+    gref_drop.index = gref_info->index;
+    gref_drop.count = count;
+    ioctl(fd, IOCTL_GNTALLOC_DEALLOC_GREF, &gref_drop);
+ out:
+    free(gref_info);
+    return area;
+}
+
+static int linux_gntshr_munmap(xc_gntshr *xcg, xc_osdep_handle h,
+                               void *start_address, uint32_t count)
+{
+    return munmap(start_address, count);
+}
+
+static struct xc_osdep_ops linux_gntshr_ops = {
+    .open = &linux_gntshr_open,
+    .close = &linux_gntshr_close,
+
+    .u.gntshr = {
+        .share_pages = &linux_gntshr_share_pages,
+        .munmap = &linux_gntshr_munmap,
+    },
+};
+
+
 static struct xc_osdep_ops *linux_osdep_init(xc_interface *xch, enum xc_osdep_type type)
 {
     switch ( type )
@@ -666,6 +766,8 @@
         return &linux_evtchn_ops;
     case XC_OSDEP_GNTTAB:
         return &linux_gnttab_ops;
+    case XC_OSDEP_GNTSHR:
+        return &linux_gntshr_ops;
     default:
         return NULL;
     }
diff -r aea2b06769f3 -r 95e0564f493b tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c	Thu Oct 06 19:28:53 2011 +0100
+++ b/tools/libxc/xc_private.c	Thu Oct 06 19:38:01 2011 +0100
@@ -258,6 +258,19 @@
     return xc_interface_close_common(xcg);
 }
 
+xc_gntshr *xc_gntshr_open(xentoollog_logger *logger,
+                             unsigned open_flags)
+{
+    return xc_interface_open_common(logger, NULL, open_flags,
+                                    XC_OSDEP_GNTSHR);
+}
+
+int xc_gntshr_close(xc_gntshr *xcg)
+{
+    return xc_interface_close_common(xcg);
+}
+
+
 static pthread_key_t errbuf_pkey;
 static pthread_once_t errbuf_pkey_once = PTHREAD_ONCE_INIT;
 
diff -r aea2b06769f3 -r 95e0564f493b tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h	Thu Oct 06 19:28:53 2011 +0100
+++ b/tools/libxc/xenctrl.h	Thu Oct 06 19:38:01 2011 +0100
@@ -115,6 +115,7 @@
 typedef struct xc_interface_core xc_interface;
 typedef struct xc_interface_core xc_evtchn;
 typedef struct xc_interface_core xc_gnttab;
+typedef struct xc_interface_core xc_gntshr;
 typedef enum xc_error_code xc_error_code;
 
 
@@ -1403,6 +1404,53 @@
 grant_entry_v2_t *xc_gnttab_map_table_v2(xc_interface *xch, int domid, int *gnt_num);
 /* Sometimes these don't set errno [fixme], and sometimes they don't log. */
 
+/*
+ * Return an fd onto the grant sharing driver.  Logs errors.
+ */
+xc_gntshr *xc_gntshr_open(xentoollog_logger *logger,
+			  unsigned open_flags);
+
+/*
+ * Close a handle previously allocated with xc_gntshr_open().
+ * Never logs errors.
+ */
+int xc_gntshr_close(xc_gntshr *xcg);
+
+/*
+ * Creates and shares pages with another domain.
+ * 
+ * @parm xcg a handle to an open grant sharing instance
+ * @parm domid the domain to share memory with
+ * @parm count the number of pages to share
+ * @parm refs the grant references of the pages (output)
+ * @parm writable true if the other domain can write to the pages
+ * @return local mapping of the pages
+ */
+void *xc_gntshr_share_pages(xc_gntshr *xcg, uint32_t domid,
+                            int count, uint32_t *refs, int writable);
+
+/*
+ * Creates and shares a page with another domain, with unmap notification.
+ * 
+ * @parm xcg a handle to an open grant sharing instance
+ * @parm domid the domain to share memory with
+ * @parm refs the grant reference of the pages (output)
+ * @parm writable true if the other domain can write to the page
+ * @parm notify_offset The byte offset in the page to use for unmap
+ *                     notification; -1 for none.
+ * @parm notify_port The event channel port to use for unmap notify, or -1
+ * @return local mapping of the page
+ */
+void *xc_gntshr_share_page_notify(xc_gntshr *xcg, uint32_t domid,
+                                  uint32_t *ref, int writable,
+                                  uint32_t notify_offset,
+                                  evtchn_port_t notify_port);
+/*
+ * Unmaps the @count pages starting at @start_address, which were mapped by a
+ * call to xc_gntshr_share_*. Never logs.
+ */
+int xc_gntshr_munmap(xc_gntshr *xcg, void *start_address, uint32_t count);
+
 int xc_physdev_map_pirq(xc_interface *xch,
                         int domid,
                         int index,
diff -r aea2b06769f3 -r 95e0564f493b tools/libxc/xenctrlosdep.h
--- a/tools/libxc/xenctrlosdep.h	Thu Oct 06 19:28:53 2011 +0100
+++ b/tools/libxc/xenctrlosdep.h	Thu Oct 06 19:38:01 2011 +0100
@@ -54,6 +54,7 @@
     XC_OSDEP_PRIVCMD,
     XC_OSDEP_EVTCHN,
     XC_OSDEP_GNTTAB,
+    XC_OSDEP_GNTSHR,
 };
 
 /* Opaque handle internal to the backend */
@@ -116,6 +117,15 @@
                           uint32_t count);
             int (*set_max_grants)(xc_gnttab *xcg, xc_osdep_handle h, uint32_t count);
         } gnttab;
+        struct {
+            void *(*share_pages)(xc_gntshr *xcg, xc_osdep_handle h,
+                                 uint32_t domid, int count,
+                                 uint32_t *refs, int writable,
+                                 uint32_t notify_offset,
+                                 evtchn_port_t notify_port);
+            int (*munmap)(xc_gntshr *xcg, xc_osdep_handle h,
+                          void *start_address, uint32_t count);
+        } gntshr;
     } u;
 };
 typedef struct xc_osdep_ops xc_osdep_ops;

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 16:25:26 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 16:25:26 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBxJe-0001se-20; Thu, 06 Oct 2011 16:25:26 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBxGp-0000uy-LR
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 16:22:34 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-174.messagelabs.com!1317943347!34266988!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25480 invoked from network); 6 Oct 2011 23:22:28 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-11.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Oct 2011 23:22:28 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBxGl-0007Rx-AR
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 00:22:27 +0100
Message-Id: <E1RBxGl-0007Rx-AR@xenbits.xen.org>
Date: Fri, 07 Oct 2011 00:22:26 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools build: link to specific
	library version (libxs, libxl, xenstore, xenstat)
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 Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1317924711 -3600
# Node ID 19d2922bcfb9f5337b794213ac3a6d4c08472dae
# Parent  61e6a43e5abcaadb22685155ea9d4afd5c66d37e
tools build: link to specific library version (libxs, libxl, xenstore, xenstat)

To avoid linking to unexpected copies (eg wrong versions) of xen
libraries, explicitly pass the linker the library file to link to.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 61e6a43e5abc -r 19d2922bcfb9 tools/Rules.mk
--- a/tools/Rules.mk	Thu Oct 06 18:50:22 2011 +0100
+++ b/tools/Rules.mk	Thu Oct 06 19:11:51 2011 +0100
@@ -18,19 +18,19 @@
 CFLAGS_xeninclude = -I$(XEN_INCLUDE)
 
 CFLAGS_libxenctrl = -I$(XEN_LIBXC) $(CFLAGS_xeninclude)
-LDLIBS_libxenctrl = -L$(XEN_LIBXC) -lxenctrl
+LDLIBS_libxenctrl = $(XEN_LIBXC)/libxenctrl.so
 SHLIB_libxenctrl  = -Wl,-rpath-link=$(XEN_LIBXC)
 
 CFLAGS_libxenguest = -I$(XEN_LIBXC) $(CFLAGS_xeninclude)
-LDLIBS_libxenguest = -L$(XEN_LIBXC) -lxenguest
+LDLIBS_libxenguest = $(XEN_LIBXC)/libxenguest.so
 SHLIB_libxenguest  = -Wl,-rpath-link=L$(XEN_LIBXC)
 
 CFLAGS_libxenstore = -I$(XEN_XENSTORE) $(CFLAGS_xeninclude)
-LDLIBS_libxenstore = -L$(XEN_XENSTORE) -lxenstore
+LDLIBS_libxenstore = $(XEN_XENSTORE)/libxenstore.so
 SHLIB_libxenstore  = -Wl,-rpath-link=$(XEN_XENSTORE)
 
 CFLAGS_libxenstat  = -I$(XEN_LIBXENSTAT)
-LDLIBS_libxenstat  = $(SHLIB_libxenctrl) $(SHLIB_libxenstore) -L$(XEN_LIBXENSTAT) -lxenstat
+LDLIBS_libxenstat  = $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(XEN_LIBXENSTAT)/libxenstat.so
 SHLIB_libxenstat  = -Wl,-rpath-link=$(XEN_LIBXENSTAT)
 
 ifeq ($(CONFIG_Linux),y)
@@ -50,7 +50,7 @@
 endif
 
 CFLAGS_libxenlight = -I$(XEN_XENLIGHT) $(CFLAGS_libxenctrl) $(CFLAGS_xeninclude)
-LDLIBS_libxenlight = -L$(XEN_XENLIGHT) $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(SHLIB_libblktapctl) -lxenlight
+LDLIBS_libxenlight = $(XEN_XENLIGHT)/libxenlight.so $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(SHLIB_libblktapctl)
 SHLIB_libxenlight  = -Wl,-rpath-link=$(XEN_XENLIGHT)
 
 CFLAGS += -D__XEN_TOOLS__

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 16:25:35 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 16:25:35 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RBxJn-0001vx-3H; Thu, 06 Oct 2011 16:25:35 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RBxGq-0000vA-OE
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 16:22:35 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-174.messagelabs.com!1317943349!28245020!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15963 invoked from network); 6 Oct 2011 23:22:29 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	6 Oct 2011 23:22:29 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RBxGm-0007TU-Vx
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 00:22:28 +0100
Message-Id: <E1RBxGm-0007TU-Vx@xenbits.xen.org>
Date: Fri, 07 Oct 2011 00:22:28 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libvchan: interdomain communications
	library
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 Daniel De Graaf <dgdegra@tycho.nsa.gov>
# Date 1317926680 -3600
# Node ID 159be83e5fe9111bb30d8b1f83127f5724d44424
# Parent  95e0564f493be2815c80c2371c158de62fbdaf2a
libvchan: interdomain communications library

This library implements a bidirectional communication interface between
applications in different domains, similar to unix sockets. Data can be
sent using the byte-oriented libvchan_read/libvchan_write or the
packet-oriented libvchan_recv/libvchan_send.

Channel setup is done using a client-server model; domain IDs and a port
number must be negotiated prior to initialization. The server allocates
memory for the shared pages and determines the sizes of the
communication rings (which may span multiple pages, although the default
places rings and control within a single page).

With properly sized rings, testing has shown that this interface
provides speed comparable to pipes within a single Linux domain; it is
significantly faster than network-based communication.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 95e0564f493b -r 159be83e5fe9 tools/Makefile
--- a/tools/Makefile	Thu Oct 06 19:38:01 2011 +0100
+++ b/tools/Makefile	Thu Oct 06 19:44:40 2011 +0100
@@ -27,6 +27,7 @@
 SUBDIRS-$(CONFIG_NetBSD) += xenbackendd
 SUBDIRS-y += libfsimage
 SUBDIRS-$(LIBXENAPI_BINDINGS) += libxen
+SUBDIRS-y += libvchan
 
 # do not recurse in to a dir we are about to delete
 ifneq "$(MAKECMDGOALS)" "distclean"
diff -r 95e0564f493b -r 159be83e5fe9 tools/Rules.mk
--- a/tools/Rules.mk	Thu Oct 06 19:38:01 2011 +0100
+++ b/tools/Rules.mk	Thu Oct 06 19:44:40 2011 +0100
@@ -14,6 +14,7 @@
 XEN_XENSTORE       = $(XEN_ROOT)/tools/xenstore
 XEN_LIBXENSTAT     = $(XEN_ROOT)/tools/xenstat/libxenstat/src
 XEN_BLKTAP2        = $(XEN_ROOT)/tools/blktap2
+XEN_LIBVCHAN       = $(XEN_ROOT)/tools/libvchan
 
 CFLAGS_xeninclude = -I$(XEN_INCLUDE)
 
@@ -33,6 +34,10 @@
 LDLIBS_libxenstat  = $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(XEN_LIBXENSTAT)/libxenstat.so
 SHLIB_libxenstat  = -Wl,-rpath-link=$(XEN_LIBXENSTAT)
 
+CFLAGS_libxenvchan = -I$(XEN_LIBVCHAN)
+LDLIBS_libxenvchan = $(SHLIB_libxenctrl) $(SHLIB_libxenstore) -L$(XEN_LIBVCHAN) -lxenvchan
+SHLIB_libxenvchan  = -Wl,-rpath-link=$(XEN_LIBVCHAN)
+
 ifeq ($(CONFIG_Linux),y)
 LIBXL_BLKTAP = y
 else
diff -r 95e0564f493b -r 159be83e5fe9 tools/libvchan/Makefile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libvchan/Makefile	Thu Oct 06 19:44:40 2011 +0100
@@ -0,0 +1,59 @@
+#
+# tools/libvchan/Makefile
+#
+
+XEN_ROOT = $(CURDIR)/../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+LIBVCHAN_OBJS = init.o io.o
+NODE_OBJS = node.o
+NODE2_OBJS = node-select.o
+
+LIBVCHAN_PIC_OBJS = $(patsubst %.o,%.opic,$(LIBVCHAN_OBJS))
+LIBVCHAN_LIBS = $(LDLIBS_libxenstore) $(LDLIBS_libxenctrl)
+$(LIBVCHAN_OBJS) $(LIBVCHAN_PIC_OBJS): CFLAGS += $(CFLAGS_libxenstore) $(CFLAGS_libxenctrl)
+$(NODE_OBJS) $(NODE2_OBJS): CFLAGS += $(CFLAGS_libxenctrl)
+
+MAJOR = 1.0
+MINOR = 0
+
+CFLAGS += -I../include -I.
+
+.PHONY: all
+all: libxenvchan.so vchan-node1 vchan-node2 libxenvchan.a
+
+libxenvchan.so: libxenvchan.so.$(MAJOR)
+	ln -sf $< $@
+
+libxenvchan.so.$(MAJOR): libxenvchan.so.$(MAJOR).$(MINOR)
+	ln -sf $< $@
+
+libxenvchan.so.$(MAJOR).$(MINOR): $(LIBVCHAN_PIC_OBJS)
+	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenvchan.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LIBVCHAN_LIBS)
+
+libxenvchan.a: $(LIBVCHAN_OBJS)
+	$(AR) rcs libxenvchan.a $^
+
+vchan-node1: $(NODE_OBJS) libxenvchan.so
+	$(CC) $(LDFLAGS) -o $@ $(NODE_OBJS) $(LDLIBS_libxenvchan)
+
+vchan-node2: $(NODE2_OBJS) libxenvchan.so
+	$(CC) $(LDFLAGS) -o $@ $(NODE2_OBJS) $(LDLIBS_libxenvchan)
+
+.PHONY: install
+install: all
+	$(INSTALL_DIR) $(DESTDIR)$(LIBDIR)
+	$(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)
+	$(INSTALL_PROG) libxenvchan.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)
+	ln -sf libxenvchan.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libxenvchan.so.$(MAJOR)
+	ln -sf libxenvchan.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libxenvchan.so
+	$(INSTALL_DATA) libxenvchan.h $(DESTDIR)$(INCLUDEDIR)
+	$(INSTALL_DATA) libxenvchan.a $(DESTDIR)$(LIBDIR)
+
+.PHONY: clean
+clean:
+	$(RM) -f *.o *.so* *.a vchan-node1 vchan-node2 $(DEPS)
+
+distclean: clean
+
+-include $(DEPS)
diff -r 95e0564f493b -r 159be83e5fe9 tools/libvchan/init.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libvchan/init.c	Thu Oct 06 19:44:40 2011 +0100
@@ -0,0 +1,409 @@
+/**
+ * @file
+ * @section AUTHORS
+ *
+ * Copyright (C) 2010  Rafal Wojtczuk  <rafal@invisiblethingslab.com>
+ *
+ *  Authors:
+ *       Rafal Wojtczuk  <rafal@invisiblethingslab.com>
+ *       Daniel De Graaf <dgdegra@tycho.nsa.gov>
+ *
+ * @section LICENSE
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+ *
+ * @section DESCRIPTION
+ *
+ *  This file contains the setup code used to establish the ring buffer.
+ */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <sys/ioctl.h>
+#include <sys/user.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include <xs.h>
+#include <xen/sys/evtchn.h>
+#include <xen/sys/gntalloc.h>
+#include <xen/sys/gntdev.h>
+#include <libxenvchan.h>
+
+#ifndef PAGE_SHIFT
+#define PAGE_SHIFT 12
+#endif
+
+#ifndef PAGE_SIZE
+#define PAGE_SIZE 4096
+#endif
+
+#define SMALL_RING_SHIFT 10
+#define LARGE_RING_SHIFT 11
+
+#define MAX_SMALL_RING (1 << SMALL_RING_SHIFT)
+#define SMALL_RING_OFFSET 1024
+#define MAX_LARGE_RING (1 << LARGE_RING_SHIFT)
+#define LARGE_RING_OFFSET 2048
+
+// if you go over this size, you'll have too many grants to fit in the shared page.
+#define MAX_RING_SHIFT 20
+#define MAX_RING_SIZE (1 << MAX_RING_SHIFT)
+
+#ifndef offsetof
+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#endif
+
+#define max(a,b) ((a > b) ? a : b)
+
+static int init_gnt_srv(struct libxenvchan *ctrl, int domain)
+{
+	int pages_left = ctrl->read.order >= PAGE_SHIFT ? 1 << (ctrl->read.order - PAGE_SHIFT) : 0;
+	int pages_right = ctrl->write.order >= PAGE_SHIFT ? 1 << (ctrl->write.order - PAGE_SHIFT) : 0;
+	uint32_t ring_ref = -1;
+	void *ring;
+
+	ring = xc_gntshr_share_page_notify(ctrl->gntshr, domain,
+			&ring_ref, 1, offsetof(struct vchan_interface, srv_live),
+			ctrl->event_port);
+
+	if (!ring)
+		goto out;
+
+	memset(ring, 0, PAGE_SIZE);
+
+	ctrl->ring = ring;
+	ctrl->read.shr = &ctrl->ring->left;
+	ctrl->write.shr = &ctrl->ring->right;
+	ctrl->ring->left_order = ctrl->read.order;
+	ctrl->ring->right_order = ctrl->write.order;
+	ctrl->ring->cli_live = 2;
+	ctrl->ring->srv_live = 1;
+	ctrl->ring->cli_notify = VCHAN_NOTIFY_WRITE;
+
+	switch (ctrl->read.order) {
+	case SMALL_RING_SHIFT:
+		ctrl->read.buffer = ((void*)ctrl->ring) + SMALL_RING_OFFSET;
+		break;
+	case LARGE_RING_SHIFT:
+		ctrl->read.buffer = ((void*)ctrl->ring) + LARGE_RING_OFFSET;
+		break;
+	default:
+		ctrl->read.buffer = xc_gntshr_share_pages(ctrl->gntshr, domain,
+			pages_left, ctrl->ring->grants, 1);
+		if (!ctrl->read.buffer)
+			goto out_ring;
+	}
+
+	switch (ctrl->write.order) {
+	case SMALL_RING_SHIFT:
+		ctrl->write.buffer = ((void*)ctrl->ring) + SMALL_RING_OFFSET;
+		break;
+	case LARGE_RING_SHIFT:
+		ctrl->write.buffer = ((void*)ctrl->ring) + LARGE_RING_OFFSET;
+		break;
+	default:
+		ctrl->write.buffer = xc_gntshr_share_pages(ctrl->gntshr, domain,
+			pages_right, ctrl->ring->grants + pages_left, 1);
+		if (!ctrl->write.buffer)
+			goto out_unmap_left;
+	}
+
+out:
+	return ring_ref;
+out_unmap_left:
+	if (pages_left)
+		xc_gntshr_munmap(ctrl->gntshr, ctrl->read.buffer, pages_left * PAGE_SIZE);
+out_ring:
+	xc_gntshr_munmap(ctrl->gntshr, ring, PAGE_SIZE);
+	ring_ref = -1;
+	ctrl->ring = NULL;
+	ctrl->write.order = ctrl->read.order = 0;
+	goto out;
+}
+
+static int init_gnt_cli(struct libxenvchan *ctrl, int domain, uint32_t ring_ref)
+{
+	int rv = -1;
+	uint32_t *grants;
+
+	ctrl->ring = xc_gnttab_map_grant_ref_notify(ctrl->gnttab,
+		domain, ring_ref, PROT_READ|PROT_WRITE,
+		offsetof(struct vchan_interface, cli_live), ctrl->event_port);
+
+	if (!ctrl->ring)
+		goto out;
+
+	ctrl->write.order = ctrl->ring->left_order;
+	ctrl->read.order = ctrl->ring->right_order;
+	ctrl->write.shr = &ctrl->ring->left;
+	ctrl->read.shr = &ctrl->ring->right;
+	if (ctrl->write.order < SMALL_RING_SHIFT || ctrl->write.order > MAX_RING_SHIFT)
+		goto out_unmap_ring;
+	if (ctrl->read.order < SMALL_RING_SHIFT || ctrl->read.order > MAX_RING_SHIFT)
+		goto out_unmap_ring;
+	if (ctrl->read.order == ctrl->write.order && ctrl->read.order < PAGE_SHIFT)
+		goto out_unmap_ring;
+
+	grants = ctrl->ring->grants;
+
+	switch (ctrl->write.order) {
+	case SMALL_RING_SHIFT:
+		ctrl->write.buffer = ((void*)ctrl->ring) + SMALL_RING_OFFSET;
+		break;
+	case LARGE_RING_SHIFT:
+		ctrl->write.buffer = ((void*)ctrl->ring) + LARGE_RING_OFFSET;
+		break;
+	default:
+		{
+			int pages_left = 1 << (ctrl->write.order - PAGE_SHIFT);
+			ctrl->write.buffer = xc_gnttab_map_domain_grant_refs(ctrl->gnttab,
+				pages_left, domain, grants, PROT_READ|PROT_WRITE);
+			if (!ctrl->write.buffer)
+				goto out_unmap_ring;
+			grants += pages_left;
+		}
+	}
+
+	switch (ctrl->read.order) {
+	case SMALL_RING_SHIFT:
+		ctrl->read.buffer = ((void*)ctrl->ring) + SMALL_RING_OFFSET;
+		break;
+	case LARGE_RING_SHIFT:
+		ctrl->read.buffer = ((void*)ctrl->ring) + LARGE_RING_OFFSET;
+		break;
+	default:
+		{
+			int pages_right = 1 << (ctrl->read.order - PAGE_SHIFT);
+			ctrl->read.buffer = xc_gnttab_map_domain_grant_refs(ctrl->gnttab,
+				pages_right, domain, grants, PROT_READ);
+			if (!ctrl->read.buffer)
+				goto out_unmap_left;
+		}
+	}
+
+	rv = 0;
+ out:
+	return rv;
+ out_unmap_left:
+	if (ctrl->write.order >= PAGE_SHIFT)
+		xc_gnttab_munmap(ctrl->gnttab, ctrl->write.buffer,
+		                 1 << ctrl->write.order);
+ out_unmap_ring:
+	xc_gnttab_munmap(ctrl->gnttab, ctrl->ring, PAGE_SIZE);
+	ctrl->ring = 0;
+	ctrl->write.order = ctrl->read.order = 0;
+	rv = -1;
+	goto out;
+}
+
+static int init_evt_srv(struct libxenvchan *ctrl, int domain, xentoollog_logger *logger)
+{
+	ctrl->event = xc_evtchn_open(logger, 0);
+	if (!ctrl->event)
+		return -1;
+	ctrl->event_port = xc_evtchn_bind_unbound_port(ctrl->event, domain);
+	if (ctrl->event_port < 0)
+		return -1;
+	if (xc_evtchn_unmask(ctrl->event, ctrl->event_port))
+		return -1;
+	return 0;
+}
+
+static int init_xs_srv(struct libxenvchan *ctrl, int domain, const char* xs_base, int ring_ref)
+{
+	int ret = -1;
+	struct xs_handle *xs;
+	struct xs_permissions perms[2];
+	char buf[64];
+	char ref[16];
+	char* domid_str = NULL;
+	xs = xs_domain_open();
+	if (!xs)
+		goto fail;
+	domid_str = xs_read(xs, 0, "domid", NULL);
+	if (!domid_str)
+		goto fail_xs_open;
+
+	// owner domain is us
+	perms[0].id = atoi(domid_str);
+	// permissions for domains not listed = none
+	perms[0].perms = XS_PERM_NONE;
+	// other domains
+	perms[1].id = domain;
+	perms[1].perms = XS_PERM_READ;
+
+	snprintf(ref, sizeof ref, "%d", ring_ref);
+	snprintf(buf, sizeof buf, "%s/ring-ref", xs_base);
+	if (!xs_write(xs, 0, buf, ref, strlen(ref)))
+		goto fail_xs_open;
+	if (!xs_set_permissions(xs, 0, buf, perms, 2))
+		goto fail_xs_open;
+
+	snprintf(ref, sizeof ref, "%d", ctrl->event_port);
+	snprintf(buf, sizeof buf, "%s/event-channel", xs_base);
+	if (!xs_write(xs, 0, buf, ref, strlen(ref)))
+		goto fail_xs_open;
+	if (!xs_set_permissions(xs, 0, buf, perms, 2))
+		goto fail_xs_open;
+
+	ret = 0;
+ fail_xs_open:
+	free(domid_str);
+	xs_daemon_close(xs);
+ fail:
+	return ret;
+}
+
+static int min_order(size_t siz)
+{
+	int rv = PAGE_SHIFT;
+	while (siz > (1 << rv))
+		rv++;
+	return rv;
+}
+
+struct libxenvchan *libxenvchan_server_init(xentoollog_logger *logger, int domain, const char* xs_path, size_t left_min, size_t right_min)
+{
+	struct libxenvchan *ctrl;
+	int ring_ref;
+	if (left_min > MAX_RING_SIZE || right_min > MAX_RING_SIZE)
+		return 0;
+
+	ctrl = malloc(sizeof(*ctrl));
+	if (!ctrl)
+		return 0;
+
+	ctrl->ring = NULL;
+	ctrl->event = NULL;
+	ctrl->is_server = 1;
+	ctrl->server_persist = 0;
+
+	ctrl->read.order = min_order(left_min);
+	ctrl->write.order = min_order(right_min);
+
+	// if we can avoid allocating extra pages by using in-page rings, do so
+	if (left_min <= MAX_SMALL_RING && right_min <= MAX_LARGE_RING) {
+		ctrl->read.order = SMALL_RING_SHIFT;
+		ctrl->write.order = LARGE_RING_SHIFT;
+	} else if (left_min <= MAX_LARGE_RING && right_min <= MAX_SMALL_RING) {
+		ctrl->read.order = LARGE_RING_SHIFT;
+		ctrl->write.order = SMALL_RING_SHIFT;
+	} else if (left_min <= MAX_LARGE_RING) {
+		ctrl->read.order = LARGE_RING_SHIFT;
+	} else if (right_min <= MAX_LARGE_RING) {
+		ctrl->write.order = LARGE_RING_SHIFT;
+	}
+
+	ctrl->gntshr = xc_gntshr_open(logger, 0);
+	if (!ctrl->gntshr)
+		goto out;
+
+	if (init_evt_srv(ctrl, domain, logger))
+		goto out;
+	ring_ref = init_gnt_srv(ctrl, domain);
+	if (ring_ref < 0)
+		goto out;
+	if (init_xs_srv(ctrl, domain, xs_path, ring_ref))
+		goto out;
+	return ctrl;
+out:
+	libxenvchan_close(ctrl);
+	return 0;
+}
+
+static int init_evt_cli(struct libxenvchan *ctrl, int domain, xentoollog_logger *logger)
+{
+	ctrl->event = xc_evtchn_open(logger, 0);
+	if (!ctrl->event)
+		return -1;
+	ctrl->event_port = xc_evtchn_bind_interdomain(ctrl->event,
+		domain, ctrl->event_port);
+	if (ctrl->event_port < 0)
+		return -1;
+	xc_evtchn_unmask(ctrl->event, ctrl->event_port);
+	return 0;
+}
+
+
+struct libxenvchan *libxenvchan_client_init(xentoollog_logger *logger, int domain, const char* xs_path)
+{
+	struct libxenvchan *ctrl = malloc(sizeof(struct libxenvchan));
+	struct xs_handle *xs = NULL;
+	char buf[64];
+	char *ref;
+	int ring_ref;
+	unsigned int len;
+
+	if (!ctrl)
+		return 0;
+	ctrl->ring = NULL;
+	ctrl->event = NULL;
+	ctrl->gnttab = NULL;
+	ctrl->write.order = ctrl->read.order = 0;
+	ctrl->is_server = 0;
+
+	xs = xs_daemon_open();
+	if (!xs)
+		xs = xs_domain_open();
+	if (!xs)
+		goto fail;
+
+// find xenstore entry
+	snprintf(buf, sizeof buf, "%s/ring-ref", xs_path);
+	ref = xs_read(xs, 0, buf, &len);
+	if (!ref)
+		goto fail;
+	ring_ref = atoi(ref);
+	free(ref);
+	if (!ring_ref)
+		goto fail;
+	snprintf(buf, sizeof buf, "%s/event-channel", xs_path);
+	ref = xs_read(xs, 0, buf, &len);
+	if (!ref)
+		goto fail;
+	ctrl->event_port = atoi(ref);
+	free(ref);
+	if (!ctrl->event_port)
+		goto fail;
+
+	ctrl->gnttab = xc_gnttab_open(logger, 0);
+	if (!ctrl->gnttab)
+		goto out;
+
+// set up event channel
+	if (init_evt_cli(ctrl, domain, logger))
+		goto fail;
+
+// set up shared page(s)
+	if (init_gnt_cli(ctrl, domain, ring_ref))
+		goto fail;
+
+	ctrl->ring->cli_live = 1;
+	ctrl->ring->srv_notify = VCHAN_NOTIFY_WRITE;
+
+ out:
+	if (xs)
+		xs_daemon_close(xs);
+	return ctrl;
+ fail:
+	libxenvchan_close(ctrl);
+	ctrl = NULL;
+	goto out;
+}
diff -r 95e0564f493b -r 159be83e5fe9 tools/libvchan/io.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libvchan/io.c	Thu Oct 06 19:44:40 2011 +0100
@@ -0,0 +1,375 @@
+/**
+ * @file
+ * @section AUTHORS
+ *
+ * Copyright (C) 2010  Rafal Wojtczuk  <rafal@invisiblethingslab.com>
+ *
+ *  Authors:
+ *       Rafal Wojtczuk  <rafal@invisiblethingslab.com>
+ *       Daniel De Graaf <dgdegra@tycho.nsa.gov>
+ *
+ * @section LICENSE
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+ *
+ * @section DESCRIPTION
+ *
+ *  This file contains the communications interface built on the ring buffer.
+ */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <sys/ioctl.h>
+#include <sys/uio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <xenctrl.h>
+#include <libxenvchan.h>
+
+#ifndef PAGE_SHIFT
+#define PAGE_SHIFT 12
+#endif
+
+#ifndef PAGE_SIZE
+#define PAGE_SIZE 4096
+#endif
+
+// allow vchan data to be easily observed in strace by doing a
+// writev() to FD -1 with the data being read/written.
+#ifndef VCHAN_DEBUG
+#define VCHAN_DEBUG 0
+#endif
+
+#define barrier() asm volatile("" ::: "memory")
+
+
+static inline uint32_t rd_prod(struct libxenvchan *ctrl)
+{
+	return ctrl->read.shr->prod;
+}
+
+static inline uint32_t* _rd_cons(struct libxenvchan *ctrl)
+{
+	return &ctrl->read.shr->cons;
+}
+#define rd_cons(x) (*_rd_cons(x))
+
+static inline uint32_t* _wr_prod(struct libxenvchan *ctrl)
+{
+	return &ctrl->write.shr->prod;
+}
+#define wr_prod(x) (*_wr_prod(x))
+
+static inline uint32_t wr_cons(struct libxenvchan *ctrl)
+{
+	return ctrl->write.shr->cons;
+}
+
+static inline const void* rd_ring(struct libxenvchan *ctrl)
+{
+	return ctrl->read.buffer;
+}
+
+static inline void* wr_ring(struct libxenvchan *ctrl)
+{
+	return ctrl->write.buffer;
+}
+
+static inline uint32_t wr_ring_size(struct libxenvchan *ctrl)
+{
+	return (1 << ctrl->write.order);
+}
+
+static inline uint32_t rd_ring_size(struct libxenvchan *ctrl)
+{
+	return (1 << ctrl->read.order);
+}
+
+static inline void request_notify(struct libxenvchan *ctrl, uint8_t bit)
+{
+	uint8_t *notify = ctrl->is_server ? &ctrl->ring->cli_notify : &ctrl->ring->srv_notify;
+	__sync_or_and_fetch(notify, bit);
+}
+
+static inline int send_notify(struct libxenvchan *ctrl, uint8_t bit)
+{
+	uint8_t *notify = ctrl->is_server ? &ctrl->ring->srv_notify : &ctrl->ring->cli_notify;
+	uint8_t prev = __sync_fetch_and_and(notify, ~bit);
+	if (prev & bit)
+		return xc_evtchn_notify(ctrl->event, ctrl->event_port);
+	else
+		return 0;
+}
+
+/**
+ * Get the amount of buffer space available and enable notifications if needed.
+ */
+static inline int fast_get_data_ready(struct libxenvchan *ctrl, size_t request)
+{
+	int ready = rd_prod(ctrl) - rd_cons(ctrl);
+	if (ready >= request)
+		return ready;
+	/* We plan to consume all data; please tell us if you send more */
+	request_notify(ctrl, VCHAN_NOTIFY_WRITE);
+	/*
+	 * If the writer moved rd_prod after our read but before request, we
+	 * will not get notified even though the actual amount of data ready is
+	 * above request. Reread rd_prod to cover this case.
+	 */
+	return rd_prod(ctrl) - rd_cons(ctrl);
+}
+
+int libxenvchan_data_ready(struct libxenvchan *ctrl)
+{
+	/* Since this value is being used outside libxenvchan, request notification
+	 * when it changes
+	 */
+	request_notify(ctrl, VCHAN_NOTIFY_WRITE);
+	return rd_prod(ctrl) - rd_cons(ctrl);
+}
+
+/**
+ * Get the amount of buffer space available and enable notifications if needed.
+ */
+static inline int fast_get_buffer_space(struct libxenvchan *ctrl, size_t request)
+{
+	int ready = wr_ring_size(ctrl) - (wr_prod(ctrl) - wr_cons(ctrl));
+	if (ready >= request)
+		return ready;
+	/* We plan to fill the buffer; please tell us when you've read it */
+	request_notify(ctrl, VCHAN_NOTIFY_READ);
+	/*
+	 * If the reader moved wr_cons after our read but before request, we
+	 * will not get notified even though the actual amount of buffer space
+	 * is above request. Reread wr_cons to cover this case.
+	 */
+	return wr_ring_size(ctrl) - (wr_prod(ctrl) - wr_cons(ctrl));
+}
+
+int libxenvchan_buffer_space(struct libxenvchan *ctrl)
+{
+	/* Since this value is being used outside libxenvchan, request notification
+	 * when it changes
+	 */
+	request_notify(ctrl, VCHAN_NOTIFY_READ);
+	return wr_ring_size(ctrl) - (wr_prod(ctrl) - wr_cons(ctrl));
+}
+
+int libxenvchan_wait(struct libxenvchan *ctrl)
+{
+	int ret = xc_evtchn_pending(ctrl->event);
+	if (ret < 0)
+		return -1;
+	xc_evtchn_unmask(ctrl->event, ret);
+	return 0;
+}
+
+/**
+ * returns -1 on error, or size on success
+ */
+static int do_send(struct libxenvchan *ctrl, const void *data, size_t size)
+{
+	int real_idx = wr_prod(ctrl) & (wr_ring_size(ctrl) - 1);
+	int avail_contig = wr_ring_size(ctrl) - real_idx;
+	if (VCHAN_DEBUG) {
+		char metainfo[32];
+		struct iovec iov[2];
+		iov[0].iov_base = metainfo;
+		iov[0].iov_len = snprintf(metainfo, 32, "vchan@%p wr", ctrl);
+		iov[1].iov_base = (void *)data;
+		iov[1].iov_len = size;
+		writev(-1, iov, 2);
+	}
+	if (avail_contig > size)
+		avail_contig = size;
+	memcpy(wr_ring(ctrl) + real_idx, data, avail_contig);
+	if (avail_contig < size)
+	{
+		// we rolled across the end of the ring
+		memcpy(wr_ring(ctrl), data + avail_contig, size - avail_contig);
+	}
+	barrier(); // data must be in the ring prior to increment
+	wr_prod(ctrl) += size;
+	barrier(); // increment must happen prior to notify
+	if (send_notify(ctrl, VCHAN_NOTIFY_WRITE))
+		return -1;
+	return size;
+}
+
+/**
+ * returns 0 if no buffer space is available, -1 on error, or size on success
+ */
+int libxenvchan_send(struct libxenvchan *ctrl, const void *data, size_t size)
+{
+	int avail;
+	while (1) {
+		if (!libxenvchan_is_open(ctrl))
+			return -1;
+		avail = fast_get_buffer_space(ctrl, size);
+		if (size <= avail)
+			return do_send(ctrl, data, size);
+		if (!ctrl->blocking)
+			return 0;
+		if (size > wr_ring_size(ctrl))
+			return -1;
+		if (libxenvchan_wait(ctrl))
+			return -1;
+	}
+}
+
+int libxenvchan_write(struct libxenvchan *ctrl, const void *data, size_t size)
+{
+	int avail;
+	if (!libxenvchan_is_open(ctrl))
+		return -1;
+	if (ctrl->blocking) {
+		size_t pos = 0;
+		while (1) {
+			avail = fast_get_buffer_space(ctrl, size - pos);
+			if (pos + avail > size)
+				avail = size - pos;
+			if (avail)
+				pos += do_send(ctrl, data + pos, avail);
+			if (pos == size)
+				return pos;
+			if (libxenvchan_wait(ctrl))
+				return -1;
+			if (!libxenvchan_is_open(ctrl))
+				return -1;
+		}
+	} else {
+		avail = fast_get_buffer_space(ctrl, size);
+		if (size > avail)
+			size = avail;
+		if (size == 0)
+			return 0;
+		return do_send(ctrl, data, size);
+	}
+}
+
+static int do_recv(struct libxenvchan *ctrl, void *data, size_t size)
+{
+	int real_idx = rd_cons(ctrl) & (rd_ring_size(ctrl) - 1);
+	int avail_contig = rd_ring_size(ctrl) - real_idx;
+	if (avail_contig > size)
+		avail_contig = size;
+	barrier(); // data read must happen after rd_cons read
+	memcpy(data, rd_ring(ctrl) + real_idx, avail_contig);
+	if (avail_contig < size)
+	{
+		// we rolled across the end of the ring
+		memcpy(data + avail_contig, rd_ring(ctrl), size - avail_contig);
+	}
+	rd_cons(ctrl) += size;
+	if (VCHAN_DEBUG) {
+		char metainfo[32];
+		struct iovec iov[2];
+		iov[0].iov_base = metainfo;
+		iov[0].iov_len = snprintf(metainfo, 32, "vchan@%p rd", ctrl);
+		iov[1].iov_base = data;
+		iov[1].iov_len = size;
+		writev(-1, iov, 2);
+	}
+	barrier(); // consumption must happen prior to notify of newly freed space
+	if (send_notify(ctrl, VCHAN_NOTIFY_READ))
+		return -1;
+	return size;
+}
+
+/**
+ * reads exactly size bytes from the vchan.
+ * returns 0 if insufficient data is available, -1 on error, or size on success
+ */
+int libxenvchan_recv(struct libxenvchan *ctrl, void *data, size_t size)
+{
+	while (1) {
+		int avail = fast_get_data_ready(ctrl, size);
+		if (size <= avail)
+			return do_recv(ctrl, data, size);
+		if (!libxenvchan_is_open(ctrl))
+			return -1;
+		if (!ctrl->blocking)
+			return 0;
+		if (size > rd_ring_size(ctrl))
+			return -1;
+		if (libxenvchan_wait(ctrl))
+			return -1;
+	}
+}
+
+int libxenvchan_read(struct libxenvchan *ctrl, void *data, size_t size)
+{
+	while (1) {
+		int avail = fast_get_data_ready(ctrl, size);
+		if (avail && size > avail)
+			size = avail;
+		if (avail)
+			return do_recv(ctrl, data, size);
+		if (!libxenvchan_is_open(ctrl))
+			return -1;
+		if (!ctrl->blocking)
+			return 0;
+		if (libxenvchan_wait(ctrl))
+			return -1;
+	}
+}
+
+int libxenvchan_is_open(struct libxenvchan* ctrl)
+{
+	if (ctrl->is_server)
+		return ctrl->server_persist ? 1 : ctrl->ring->cli_live;
+	else
+		return ctrl->ring->srv_live;
+}
+
+int libxenvchan_fd_for_select(struct libxenvchan *ctrl)
+{
+	return xc_evtchn_fd(ctrl->event);
+}
+
+void libxenvchan_close(struct libxenvchan *ctrl)
+{
+	if (!ctrl)
+		return;
+	if (ctrl->read.order >= PAGE_SHIFT)
+		munmap(ctrl->read.buffer, 1 << ctrl->read.order);
+	if (ctrl->write.order >= PAGE_SHIFT)
+		munmap(ctrl->write.buffer, 1 << ctrl->write.order);
+	if (ctrl->ring) {
+		if (ctrl->is_server) {
+			ctrl->ring->srv_live = 0;
+			xc_gntshr_munmap(ctrl->gntshr, ctrl->ring, PAGE_SIZE);
+		} else {
+			ctrl->ring->cli_live = 0;
+			xc_gnttab_munmap(ctrl->gnttab, ctrl->ring, PAGE_SIZE);
+		}
+	}
+	if (ctrl->event) {
+		if (ctrl->event_port >= 0 && ctrl->ring)
+			xc_evtchn_notify(ctrl->event, ctrl->event_port);
+		xc_evtchn_close(ctrl->event);
+	}
+	if (ctrl->is_server) {
+		if (ctrl->gntshr)
+			xc_gntshr_close(ctrl->gntshr);
+	} else {
+		if (ctrl->gnttab)
+			xc_gnttab_close(ctrl->gnttab);
+	}
+	free(ctrl);
+}
diff -r 95e0564f493b -r 159be83e5fe9 tools/libvchan/libxenvchan.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libvchan/libxenvchan.h	Thu Oct 06 19:44:40 2011 +0100
@@ -0,0 +1,169 @@
+/**
+ * @file
+ * @section AUTHORS
+ *
+ * Copyright (C) 2010  Rafal Wojtczuk  <rafal@invisiblethingslab.com>
+ *
+ *  Authors:
+ *       Rafal Wojtczuk  <rafal@invisiblethingslab.com>
+ *       Daniel De Graaf <dgdegra@tycho.nsa.gov>
+ *
+ * @section LICENSE
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+ *
+ * @section DESCRIPTION
+ *
+ *  Originally borrowed from the Qubes OS Project, http://www.qubes-os.org,
+ *  this code has been substantially rewritten to use the gntdev and gntalloc
+ *  devices instead of raw MFNs and map_foreign_range.
+ *
+ *  This is a library for inter-domain communication.  A standard Xen ring
+ *  buffer is used, with a datagram-based interface built on top.  The grant
+ *  reference and event channels are shared in XenStore under the path
+ *  /local/domain/<srv-id>/data/vchan/<cli-id>/<port>/{ring-ref,event-channel}
+ *
+ *  The ring.h macros define an asymmetric interface to a shared data structure
+ *  that assumes all rings reside in a single contiguous memory space. This is
+ *  not suitable for vchan because the interface to the ring is symmetric except
+ *  for the setup. Unlike the producer-consumer rings defined in ring.h, the
+ *  size of the rings used in vchan are determined at execution time instead of
+ *  compile time, so the macros in ring.h cannot be used to access the rings.
+ */
+
+#include <xen/io/libxenvchan.h>
+#include <xen/sys/evtchn.h>
+#include <xenctrl.h>
+
+struct libxenvchan_ring {
+	/* Pointer into the shared page. Offsets into buffer. */
+	struct ring_shared* shr;
+	/* ring data; may be its own shared page(s) depending on order */
+	void* buffer;
+	/**
+	 * The size of the ring is (1 << order); offsets wrap around when they
+	 * exceed this. This copy is required because we can't trust the order
+	 * in the shared page to remain constant.
+	 */
+	int order;
+};
+
+/**
+ * struct libxenvchan: control structure passed to all library calls
+ */
+struct libxenvchan {
+	/* Mapping handle for shared ring page */
+	union {
+		xc_gntshr *gntshr; /* for server */
+		xc_gnttab *gnttab; /* for client */
+	};
+	/* Pointer to shared ring page */
+	struct vchan_interface *ring;
+	/* event channel interface */
+	xc_evtchn *event;
+	uint32_t event_port;
+	/* informative flags: are we acting as server? */
+	int is_server:1;
+	/* true if server remains active when client closes (allows reconnection) */
+	int server_persist:1;
+	/* true if operations should block instead of returning 0 */
+	int blocking:1;
+	/* communication rings */
+	struct libxenvchan_ring read, write;
+};
+
+/**
+ * Set up a vchan, including granting pages
+ * @param logger Logger for libxc errors
+ * @param domain The peer domain that will be connecting
+ * @param xs_path Base xenstore path for storing ring/event data
+ * @param send_min The minimum size (in bytes) of the send ring (left)
+ * @param recv_min The minimum size (in bytes) of the receive ring (right)
+ * @return The structure, or NULL in case of an error
+ */
+struct libxenvchan *libxenvchan_server_init(xentoollog_logger *logger, int domain, const char* xs_path, size_t read_min, size_t write_min);
+/**
+ * Connect to an existing vchan. Note: you can reconnect to an existing vchan
+ * safely, however no locking is performed, so you must prevent multiple clients
+ * from connecting to a single server.
+ *
+ * @param logger Logger for libxc errors
+ * @param domain The peer domain to connect to
+ * @param xs_path Base xenstore path for storing ring/event data
+ * @return The structure, or NULL in case of an error
+ */
+struct libxenvchan *libxenvchan_client_init(xentoollog_logger *logger, int domain, const char* xs_path);
+/**
+ * Close a vchan. This deallocates the vchan and attempts to free its
+ * resources. The other side is notified of the close, but can still read any
+ * data pending prior to the close.
+ */
+void libxenvchan_close(struct libxenvchan *ctrl);
+
+/**
+ * Packet-based receive: always reads exactly $size bytes.
+ * @param ctrl The vchan control structure
+ * @param data Buffer for data that was read
+ * @param size Size of the buffer and amount of data to read
+ * @return -1 on error, 0 if nonblocking and insufficient data is available, or $size
+ */
+int libxenvchan_recv(struct libxenvchan *ctrl, void *data, size_t size);
+/**
+ * Stream-based receive: reads as much data as possible.
+ * @param ctrl The vchan control structure
+ * @param data Buffer for data that was read
+ * @param size Size of the buffer
+ * @return -1 on error, otherwise the amount of data read (which may be zero if
+ *         the vchan is nonblocking)
+ */
+int libxenvchan_read(struct libxenvchan *ctrl, void *data, size_t size);
+/**
+ * Packet-based send: send entire buffer if possible
+ * @param ctrl The vchan control structure
+ * @param data Buffer for data to send
+ * @param size Size of the buffer and amount of data to send
+ * @return -1 on error, 0 if nonblocking and insufficient space is available, or $size
+ */
+int libxenvchan_send(struct libxenvchan *ctrl, const void *data, size_t size);
+/**
+ * Stream-based send: send as much data as possible.
+ * @param ctrl The vchan control structure
+ * @param data Buffer for data to send
+ * @param size Size of the buffer
+ * @return -1 on error, otherwise the amount of data sent (which may be zero if
+ *         the vchan is nonblocking)
+ */
+int libxenvchan_write(struct libxenvchan *ctrl, const void *data, size_t size);
+/**
+ * Waits for reads or writes to unblock, or for a close
+ */
+int libxenvchan_wait(struct libxenvchan *ctrl);
+/**
+ * Returns the event file descriptor for this vchan. When this FD is readable,
+ * libxenvchan_wait() will not block, and the state of the vchan has changed since
+ * the last invocation of libxenvchan_wait().
+ */
+int libxenvchan_fd_for_select(struct libxenvchan *ctrl);
+/**
+ * Query the state of the vchan shared page:
+ *  return 0 when one side has called libxenvchan_close() or crashed
+ *  return 1 when both sides are open
+ *  return 2 [server only] when no client has yet connected
+ */
+int libxenvchan_is_open(struct libxenvchan* ctrl);
+/** Amount of data ready to read, in bytes */
+int libxenvchan_data_ready(struct libxenvchan *ctrl);
+/** Amount of data it is possible to send without blocking */
+int libxenvchan_buffer_space(struct libxenvchan *ctrl);
diff -r 95e0564f493b -r 159be83e5fe9 tools/libvchan/node-select.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libvchan/node-select.c	Thu Oct 06 19:44:40 2011 +0100
@@ -0,0 +1,162 @@
+/**
+ * @file
+ * @section AUTHORS
+ *
+ * Copyright (C) 2010  Rafal Wojtczuk  <rafal@invisiblethingslab.com>
+ *
+ *  Authors:
+ *       Rafal Wojtczuk  <rafal@invisiblethingslab.com>
+ *       Daniel De Graaf <dgdegra@tycho.nsa.gov>
+ *
+ * @section LICENSE
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+ *
+ * @section DESCRIPTION
+ *
+ * This is a test program for libxenvchan.  Communications are bidirectional,
+ * with either server (grant offeror) or client able to read and write.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+
+#include <libxenvchan.h>
+
+void usage(char** argv)
+{
+	fprintf(stderr, "usage:\n"
+		"\t%s [client|server] domainid nodepath [rbufsiz wbufsiz]\n",
+		argv[0]);
+	exit(1);
+}
+
+#define BUFSIZE 5000
+char inbuf[BUFSIZE];
+char outbuf[BUFSIZE];
+int insiz = 0;
+int outsiz = 0;
+struct libxenvchan *ctrl = 0;
+
+void vchan_wr() {
+	if (!insiz)
+		return;
+	int ret = libxenvchan_write(ctrl, inbuf, insiz);
+	if (ret < 0) {
+		fprintf(stderr, "vchan write failed\n");
+		exit(1);
+	}
+	if (ret > 0) {
+		insiz -= ret;
+		memmove(inbuf, inbuf + ret, insiz);
+	}
+}
+
+void stdout_wr() {
+	if (!outsiz)
+		return;
+	int ret = write(1, outbuf, outsiz);
+	if (ret < 0 && errno != EAGAIN)
+		exit(1);
+	if (ret > 0) {
+		outsiz -= ret;
+		memmove(outbuf, outbuf + ret, outsiz);
+	}
+}
+
+/**
+    Simple libxenvchan application, both client and server.
+	Both sides may write and read, both from the libxenvchan and from 
+	stdin/stdout (just like netcat).
+*/
+
+int main(int argc, char **argv)
+{
+	int ret;
+	int libxenvchan_fd;
+	if (argc < 4 || argv[3][0] != '/')
+		usage(argv);
+	if (!strcmp(argv[1], "server")) {
+		int rsiz = argc > 4 ? atoi(argv[4]) : 0;
+		int wsiz = argc > 5 ? atoi(argv[5]) : 0;
+		ctrl = libxenvchan_server_init(NULL, atoi(argv[2]), argv[3], rsiz, wsiz);
+	} else if (!strcmp(argv[1], "client"))
+		ctrl = libxenvchan_client_init(NULL, atoi(argv[2]), argv[3]);
+	else
+		usage(argv);
+	if (!ctrl) {
+		perror("libxenvchan_*_init");
+		exit(1);
+	}
+
+	fcntl(0, F_SETFL, O_NONBLOCK);
+	fcntl(1, F_SETFL, O_NONBLOCK);
+
+	libxenvchan_fd = libxenvchan_fd_for_select(ctrl);
+	for (;;) {
+		fd_set rfds;
+		fd_set wfds;
+		FD_ZERO(&rfds);
+		FD_ZERO(&wfds);
+		if (insiz != BUFSIZE)
+			FD_SET(0, &rfds);
+		if (outsiz)
+			FD_SET(1, &wfds);
+		FD_SET(libxenvchan_fd, &rfds);
+		ret = select(libxenvchan_fd + 1, &rfds, &wfds, NULL, NULL);
+		if (ret < 0) {
+			perror("select");
+			exit(1);
+		}
+		if (FD_ISSET(0, &rfds)) {
+			ret = read(0, inbuf + insiz, BUFSIZE - insiz);
+			if (ret < 0 && errno != EAGAIN)
+				exit(1);
+			if (ret == 0) {
+				while (insiz) {
+					vchan_wr();
+					libxenvchan_wait(ctrl);
+				}
+				return 0;
+			}
+			if (ret)
+				insiz += ret;
+			vchan_wr();
+		}
+		if (FD_ISSET(libxenvchan_fd, &rfds)) {
+			libxenvchan_wait(ctrl);
+			vchan_wr();
+		}
+		if (FD_ISSET(1, &wfds))
+			stdout_wr();
+		while (libxenvchan_data_ready(ctrl) && outsiz < BUFSIZE) {
+			ret = libxenvchan_read(ctrl, outbuf + outsiz, BUFSIZE - outsiz);
+			if (ret < 0)
+				exit(1);
+			outsiz += ret;
+			stdout_wr();
+		}
+		if (!libxenvchan_is_open(ctrl)) {
+			fcntl(1, F_SETFL, 0);
+			while (outsiz)
+				stdout_wr();
+			return 0;
+		}
+	}
+}
diff -r 95e0564f493b -r 159be83e5fe9 tools/libvchan/node.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libvchan/node.c	Thu Oct 06 19:44:40 2011 +0100
@@ -0,0 +1,169 @@
+/**
+ * @file
+ * @section AUTHORS
+ *
+ * Copyright (C) 2010  Rafal Wojtczuk  <rafal@invisiblethingslab.com>
+ *
+ *  Authors:
+ *       Rafal Wojtczuk  <rafal@invisiblethingslab.com>
+ *       Daniel De Graaf <dgdegra@tycho.nsa.gov>
+ *
+ * @section LICENSE
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+ *
+ * @section DESCRIPTION
+ *
+ * This is a test program for libxenvchan.  Communications are in one direction,
+ * either server (grant offeror) to client or vice versa.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <time.h>
+
+#include <libxenvchan.h>
+
+int libxenvchan_write_all(struct libxenvchan *ctrl, char *buf, int size)
+{
+	int written = 0;
+	int ret;
+	while (written < size) {
+		ret = libxenvchan_write(ctrl, buf + written, size - written);
+		if (ret <= 0) {
+			perror("write");
+			exit(1);
+		}
+		written += ret;
+	}
+	return size;
+}
+
+int write_all(int fd, char *buf, int size)
+{
+	int written = 0;
+	int ret;
+	while (written < size) {
+		ret = write(fd, buf + written, size - written);
+		if (ret <= 0) {
+			perror("write");
+			exit(1);
+		}
+		written += ret;
+	}
+	return size;
+}
+
+void usage(char** argv)
+{
+	fprintf(stderr, "usage:\n"
+		"%s [client|server] [read|write] domid nodepath\n", argv[0]);
+	exit(1);
+}
+
+#define BUFSIZE 5000
+char buf[BUFSIZE];
+void reader(struct libxenvchan *ctrl)
+{
+	int size;
+	for (;;) {
+		size = rand() % (BUFSIZE - 1) + 1;
+		size = libxenvchan_read(ctrl, buf, size);
+		fprintf(stderr, "#");
+		if (size < 0) {
+			perror("read vchan");
+			libxenvchan_close(ctrl);
+			exit(1);
+		}
+		size = write_all(1, buf, size);
+		if (size < 0) {
+			perror("stdout write");
+			exit(1);
+		}
+		if (size == 0) {
+			perror("write size=0?\n");
+			exit(1);
+		}
+	}
+}
+
+void writer(struct libxenvchan *ctrl)
+{
+	int size;
+	for (;;) {
+		size = rand() % (BUFSIZE - 1) + 1;
+		size = read(0, buf, size);
+		if (size < 0) {
+			perror("read stdin");
+			libxenvchan_close(ctrl);
+			exit(1);
+		}
+		if (size == 0)
+			break;
+		size = libxenvchan_write_all(ctrl, buf, size);
+		fprintf(stderr, "#");
+		if (size < 0) {
+			perror("vchan write");
+			exit(1);
+		}
+		if (size == 0) {
+			perror("write size=0?\n");
+			exit(1);
+		}
+	}
+}
+
+
+/**
+	Simple libxenvchan application, both client and server.
+	One side does writing, the other side does reading; both from
+	standard input/output fds.
+*/
+int main(int argc, char **argv)
+{
+	int seed = time(0);
+	struct libxenvchan *ctrl = 0;
+	int wr = 0;
+	if (argc < 4)
+		usage(argv);
+	if (!strcmp(argv[2], "read"))
+		wr = 0;
+	else if (!strcmp(argv[2], "write"))
+		wr = 1;
+	else
+		usage(argv);
+	if (!strcmp(argv[1], "server"))
+		ctrl = libxenvchan_server_init(NULL, atoi(argv[3]), argv[4], 0, 0);
+	else if (!strcmp(argv[1], "client"))
+		ctrl = libxenvchan_client_init(NULL, atoi(argv[3]), argv[4]);
+	else
+		usage(argv);
+	if (!ctrl) {
+		perror("libxenvchan_*_init");
+		exit(1);
+	}
+	ctrl->blocking = 1;
+
+	srand(seed);
+	fprintf(stderr, "seed=%d\n", seed);
+	if (wr)
+		writer(ctrl);
+	else
+		reader(ctrl);
+	libxenvchan_close(ctrl);
+	return 0;
+}
diff -r 95e0564f493b -r 159be83e5fe9 tools/libvchan/vchan-node1
Binary file tools/libvchan/vchan-node1 has changed
diff -r 95e0564f493b -r 159be83e5fe9 tools/libvchan/vchan-node2
Binary file tools/libvchan/vchan-node2 has changed
diff -r 95e0564f493b -r 159be83e5fe9 xen/include/public/io/libxenvchan.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/public/io/libxenvchan.h	Thu Oct 06 19:44:40 2011 +0100
@@ -0,0 +1,97 @@
+/**
+ * @file
+ * @section AUTHORS
+ *
+ * Copyright (C) 2010  Rafal Wojtczuk  <rafal@invisiblethingslab.com>
+ *
+ *  Authors:
+ *       Rafal Wojtczuk  <rafal@invisiblethingslab.com>
+ *       Daniel De Graaf <dgdegra@tycho.nsa.gov>
+ *
+ * @section LICENSE
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+ *
+ * @section DESCRIPTION
+ *
+ *  Originally borrowed from the Qubes OS Project, http://www.qubes-os.org,
+ *  this code has been substantially rewritten to use the gntdev and gntalloc
+ *  devices instead of raw MFNs and map_foreign_range.
+ *
+ *  This is a library for inter-domain communication.  A standard Xen ring
+ *  buffer is used, with a datagram-based interface built on top.  The grant
+ *  reference and event channels are shared in XenStore under a user-specified
+ *  path.
+ *
+ *  The ring.h macros define an asymmetric interface to a shared data structure
+ *  that assumes all rings reside in a single contiguous memory space. This is
+ *  not suitable for vchan because the interface to the ring is symmetric except
+ *  for the setup. Unlike the producer-consumer rings defined in ring.h, the
+ *  size of the rings used in vchan are determined at execution time instead of
+ *  compile time, so the macros in ring.h cannot be used to access the rings.
+ */
+
+#include <stdint.h>
+#include <sys/types.h>
+
+struct ring_shared {
+	uint32_t cons, prod;
+};
+
+#define VCHAN_NOTIFY_WRITE 0x1
+#define VCHAN_NOTIFY_READ 0x2
+
+/**
+ * vchan_interface: primary shared data structure
+ */
+struct vchan_interface {
+	/**
+	 * Standard consumer/producer interface, one pair per buffer
+	 * left is client write, server read
+	 * right is client read, server write
+	 */
+	struct ring_shared left, right;
+	/**
+	 * size of the rings, which determines their location
+	 * 10   - at offset 1024 in ring's page
+	 * 11   - at offset 2048 in ring's page
+	 * 12+  - uses 2^(N-12) grants to describe the multi-page ring
+	 * These should remain constant once the page is shared.
+	 * Only one of the two orders can be 10 (or 11).
+	 */
+	uint16_t left_order, right_order;
+	/**
+	 * Shutdown detection:
+	 *  0: client (or server) has exited
+	 *  1: client (or server) is connected
+	 *  2: client has not yet connected
+	 */
+	uint8_t cli_live, srv_live;
+	/**
+	 * Notification bits:
+	 *  VCHAN_NOTIFY_WRITE: send notify when data is written
+	 *  VCHAN_NOTIFY_READ: send notify when data is read (consumed)
+	 * cli_notify is used for the client to inform the server of its action
+	 */
+	uint8_t cli_notify, srv_notify;
+	/**
+	 * Grant list: ordering is left, right. Must not extend into actual ring
+	 * or grow beyond the end of the initial shared page.
+	 * These should remain constant once the page is shared, to allow
+	 * for possible remapping by a client that restarts.
+	 */
+	uint32_t grants[0];
+};
+

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 23:33:42 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 23:33:42 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RC404-00059X-O7; Thu, 06 Oct 2011 23:33:40 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RC3zz-00058s-Sy
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 23:33:36 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1317969194!45596715!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16394 invoked from network); 7 Oct 2011 06:33:15 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Oct 2011 06:33:15 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RC3zu-0004K2-HK
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 07:33:31 +0100
Message-Id: <E1RC3zu-0004K2-HK@xenbits.xen.org>
Date: Fri, 07 Oct 2011 07:33:27 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] p2m: use correct p2m_type_t in
	clear_mmio_p2m_entry
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 Olaf Hering <olaf@aepfle.de>
# Date 1317901938 -3600
# Node ID 1f95ac601974dae3a1b81d907b03a3ee90ec9e01
# Parent  d7e0e9f37874cf648e901b5dd5ebdfc455c9a214
p2m: use correct p2m_type_t in clear_mmio_p2m_entry

clear_mmio_p2m_entry() should mark the gfn as invalid.
Use proper name instead of numerical value. The currently used value of
zero means p2m_ram_rw.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
xen-unstable changeset:   23898:3d1664cc9e45
xen-unstable date:        Thu Oct 06 12:52:18 2011 +0100
---


diff -r d7e0e9f37874 -r 1f95ac601974 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Mon Oct 03 16:33:29 2011 +0100
+++ b/xen/arch/x86/mm/p2m.c	Thu Oct 06 12:52:18 2011 +0100
@@ -2795,7 +2795,7 @@
         return 0;
     }
     p2m_lock(p2m);
-    rc = set_p2m_entry(p2m, gfn, _mfn(INVALID_MFN), 0, 0, p2m->default_access);
+    rc = set_p2m_entry(p2m, gfn, _mfn(INVALID_MFN), 0, p2m_invalid, p2m->default_access);
     audit_p2m(p2m, 1);
     p2m_unlock(p2m);
 

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 23:33:58 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 23:33:58 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RC40L-0005Cr-O7; Thu, 06 Oct 2011 23:33:58 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RC401-00058w-Bs
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 23:33:37 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-174.messagelabs.com!1317969213!34296525!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22312 invoked from network); 7 Oct 2011 06:33:34 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Oct 2011 06:33:34 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RC3zw-0004KH-KW
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 07:33:32 +0100
Message-Id: <E1RC3zw-0004KH-KW@xenbits.xen.org>
Date: Fri, 07 Oct 2011 07:33:32 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] libxl: Fix segfault in
	get_all_assigned_devices
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 Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1317924380 -3600
# Node ID 71712ce9190a66a5a0e112310d678bf1288d1d20
# Parent  1f95ac601974dae3a1b81d907b03a3ee90ec9e01
libxl: Fix segfault in get_all_assigned_devices

pcidevs is an array of ndev elements (ndev is the number of pci devices
assigend to a specific domain), but we access pcidevs + *num
where *num is the global number of pci devices assigned so far to all
domains in the system.

Fix the issue removing pcidevs and just realloc'ing *list every time we
want to add a new pci device to the array.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

xen-unstable changeset: 23685:5239811f92e1
Backport-requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 1f95ac601974 -r 71712ce9190a tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c	Thu Oct 06 12:52:18 2011 +0100
+++ b/tools/libxl/libxl_pci.c	Thu Oct 06 19:06:20 2011 +0100
@@ -434,7 +434,6 @@
 
 static int get_all_assigned_devices(libxl__gc *gc, libxl_device_pci **list, int *num)
 {
-    libxl_device_pci *pcidevs = NULL;
     char **domlist;
     unsigned int nd = 0, i;
 
@@ -451,8 +450,7 @@
             int ndev = atoi(num_devs), j;
             char *devpath, *bdf;
 
-            pcidevs = libxl__calloc(gc, sizeof(*pcidevs), ndev);
-            for(j = (pcidevs) ? 0 : ndev; j < ndev; j++) {
+            for(j = 0; j < ndev; j++) {
                 devpath = libxl__sprintf(gc, "/local/domain/0/backend/pci/%s/0/dev-%u",
                                         domlist[i], j);
                 bdf = libxl__xs_read(gc, XBT_NULL, devpath);
@@ -461,18 +459,17 @@
                     if ( sscanf(bdf, PCI_BDF, &dom, &bus, &dev, &func) != 4 )
                         continue;
 
-                    pcidev_init(pcidevs + *num, dom, bus, dev, func, 0);
+                    *list = realloc(*list, sizeof(libxl_device_pci) * ((*num) + 1));
+                    if (*list == NULL)
+                        return ERROR_NOMEM;
+                    pcidev_init(*list + *num, dom, bus, dev, func, 0);
                     (*num)++;
                 }
             }
         }
     }
 
-    if ( 0 == *num ) {
-        pcidevs = NULL;
-    }else{
-        *list = pcidevs;
-    }
+    libxl__ptr_add(gc, *list);
 
     return 0;
 }

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 23:34:12 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 23:34:12 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RC40Z-0005GL-6h; Thu, 06 Oct 2011 23:34:11 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RC40H-0005BY-Al
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 23:33:55 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-182.messagelabs.com!1317969230!16295795!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31667 invoked from network); 7 Oct 2011 06:33:50 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-7.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Oct 2011 06:33:50 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RC406-0004KX-Ca
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 07:33:43 +0100
Message-Id: <E1RC406-0004KX-Ca@xenbits.xen.org>
Date: Fri, 07 Oct 2011 07:33:33 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] build: Make XEN_ROOT an absolute
	path.
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@xen.org>
# Date 1317926834 -3600
# Node ID 2e840539a705b41590bd15ab415eb091ead9e5b1
# Parent  71712ce9190a66a5a0e112310d678bf1288d1d20
build: Make XEN_ROOT an absolute path.

Otherwise make can search the path relative to certain standard paths
such as /usr/include (e.g., the line '-include $(XEN_ROOT)/.config' in
Config.mk suffers from this).

Signed-off-by: Keir Fraser <keir@xen.org>

xen-unstable changeset: 23049:ff3b7749008b
Backport-requested-by: Allen M Kay <allen.m.kay@intel.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 71712ce9190a -r 2e840539a705 Config.mk
--- a/Config.mk	Thu Oct 06 19:06:20 2011 +0100
+++ b/Config.mk	Thu Oct 06 19:47:14 2011 +0100
@@ -103,27 +103,10 @@
     endif
 endef
 
-define absolutify_xen_root
-    case "$(XEN_ROOT)" in                                          \
-    /*) XEN_ROOT=$(XEN_ROOT) ;;                                    \
-    *)  xen_root_lhs=`pwd`;                                        \
-        xen_root_rhs=$(XEN_ROOT)/;                                 \
-        while [ "x$${xen_root_rhs#../}" != "x$$xen_root_rhs" ]; do \
-            xen_root_rhs="$${xen_root_rhs#../}";                   \
-            xen_root_rhs="$${xen_root_rhs#/}";                     \
-            xen_root_rhs="$${xen_root_rhs#/}";                     \
-            xen_root_lhs="$${xen_root_lhs%/*}";                    \
-        done;                                                      \
-        XEN_ROOT="$$xen_root_lhs/$$xen_root_rhs" ;;                \
-    esac;                                                          \
-    export XEN_ROOT
-endef
-
 define buildmakevars2shellvars
-    PREFIX="$(PREFIX)";                                            \
-    XEN_SCRIPT_DIR="$(XEN_SCRIPT_DIR)";                            \
-    export PREFIX;                                                 \
-    export XEN_SCRIPT_DIR
+    export PREFIX="$(PREFIX)";                                            \
+    export XEN_SCRIPT_DIR="$(XEN_SCRIPT_DIR)";                            \
+    export XEN_ROOT="$(XEN_ROOT)"
 endef
 
 buildmakevars2file = $(eval $(call buildmakevars2file-closure,$(1)))
diff -r 71712ce9190a -r 2e840539a705 docs/Makefile
--- a/docs/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/docs/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,6 +1,6 @@
 #!/usr/bin/make -f
 
-XEN_ROOT=..
+XEN_ROOT=$(CURDIR)/..
 include $(XEN_ROOT)/Config.mk
 include $(XEN_ROOT)/docs/Docs.mk
 
diff -r 71712ce9190a -r 2e840539a705 docs/xen-api/Makefile
--- a/docs/xen-api/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/docs/xen-api/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,6 +1,6 @@
 #!/usr/bin/make -f
 
-XEN_ROOT=../..
+XEN_ROOT=$(CURDIR)/../..
 include $(XEN_ROOT)/Config.mk
 include $(XEN_ROOT)/docs/Docs.mk
 
diff -r 71712ce9190a -r 2e840539a705 extras/mini-os/Config.mk
--- a/extras/mini-os/Config.mk	Thu Oct 06 19:06:20 2011 +0100
+++ b/extras/mini-os/Config.mk	Thu Oct 06 19:47:14 2011 +0100
@@ -38,15 +38,15 @@
 # This must be before include minios.mk!
 include $(MINI-OS_ROOT)/$(TARGET_ARCH_DIR)/arch.mk
 
-extra_incl := $(foreach dir,$(EXTRA_INC),-isystem $(CURDIR)/$(MINI-OS_ROOT)/include/$(dir))
+extra_incl := $(foreach dir,$(EXTRA_INC),-isystem $(MINI-OS_ROOT)/include/$(dir))
 
-DEF_CPPFLAGS += -isystem $(CURDIR)/$(MINI-OS_ROOT)/include
+DEF_CPPFLAGS += -isystem $(MINI-OS_ROOT)/include
 DEF_CPPFLAGS += -D__MINIOS__
 
 ifeq ($(libc),y)
 DEF_CPPFLAGS += -DHAVE_LIBC
-DEF_CPPFLAGS += -isystem $(CURDIR)/$(MINI-OS_ROOT)/include/posix
-DEF_CPPFLAGS += -isystem $(CURDIR)/$(XEN_ROOT)/tools/xenstore
+DEF_CPPFLAGS += -isystem $(MINI-OS_ROOT)/include/posix
+DEF_CPPFLAGS += -isystem $(XEN_ROOT)/tools/xenstore
 endif
 
 ifneq ($(LWIPDIR),)
diff -r 71712ce9190a -r 2e840539a705 extras/mini-os/Makefile
--- a/extras/mini-os/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/extras/mini-os/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -4,7 +4,7 @@
 # Makefile and a arch.mk.
 #
 
-export XEN_ROOT = ../..
+export XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/Config.mk
 OBJ_DIR ?= $(CURDIR)
 
diff -r 71712ce9190a -r 2e840539a705 extras/mini-os/arch/ia64/Makefile
--- a/extras/mini-os/arch/ia64/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/extras/mini-os/arch/ia64/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -2,7 +2,7 @@
 # Special makefile for ia64.
 #
 
-XEN_ROOT = ../../../..
+XEN_ROOT = $(CURDIR)/../../../..
 include $(XEN_ROOT)/Config.mk
 
 include ../../Config.mk
diff -r 71712ce9190a -r 2e840539a705 extras/mini-os/arch/x86/Makefile
--- a/extras/mini-os/arch/x86/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/extras/mini-os/arch/x86/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -3,7 +3,7 @@
 # It's is used for x86_32, x86_32y and x86_64
 #
 
-XEN_ROOT = ../../../..
+XEN_ROOT = $(CURDIR)/../../../..
 include $(XEN_ROOT)/Config.mk
 include ../../Config.mk
 
diff -r 71712ce9190a -r 2e840539a705 stubdom/Makefile
--- a/stubdom/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/stubdom/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ..
+XEN_ROOT = $(CURDIR)/..
 MINI_OS = $(XEN_ROOT)/extras/mini-os
 
 export XEN_OS=MiniOS
@@ -64,7 +64,7 @@
 GCC_INSTALL = $(shell LANG=C gcc -print-search-dirs | sed -n -e 's/install: \(.*\)/\1/p')
 TARGET_CPPFLAGS += -U __linux__ -U __FreeBSD__ -U __sun__
 TARGET_CPPFLAGS += -nostdinc
-TARGET_CPPFLAGS += -isystem $(CURDIR)/$(MINI_OS)/include/posix
+TARGET_CPPFLAGS += -isystem $(MINI_OS)/include/posix
 TARGET_CPPFLAGS += -isystem $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include
 TARGET_CPPFLAGS += -isystem $(GCC_INSTALL)include
 TARGET_CPPFLAGS += -isystem $(CURDIR)/lwip-$(XEN_TARGET_ARCH)/src/include
@@ -224,7 +224,7 @@
 ioemu/linkfarm.stamp: $(XEN_ROOT)/tools/ioemu-dir
 	mkdir -p ioemu
 	set -e;									\
-	$(absolutify_xen_root);							\
+	$(buildmakevars2shellvars);						\
 	cd ioemu;								\
 	src="$$XEN_ROOT/tools/ioemu-dir"; export src;				\
 	(cd $$src && find * -type d -print) | xargs mkdir -p;			\
@@ -244,24 +244,24 @@
 
 mk-headers-$(XEN_TARGET_ARCH): ioemu/linkfarm.stamp
 	mkdir -p include/xen && \
-          ln -sf $(addprefix ../../,$(wildcard $(XEN_ROOT)/xen/include/public/*.h)) include/xen && \
-          ln -sf $(addprefix ../../$(XEN_ROOT)/xen/include/public/,arch-ia64 arch-x86 hvm io xsm) include/xen && \
-          ( [ -h include/xen/sys ] || ln -sf ../../$(XEN_ROOT)/tools/include/xen-sys/MiniOS include/xen/sys ) && \
-          ( [ -h include/xen/libelf ] || ln -sf ../../$(XEN_ROOT)/tools/include/xen/libelf include/xen/libelf ) && \
+          ln -sf $(wildcard $(XEN_ROOT)/xen/include/public/*.h) include/xen && \
+          ln -sf $(addprefix $(XEN_ROOT)/xen/include/public/,arch-ia64 arch-x86 hvm io xsm) include/xen && \
+          ( [ -h include/xen/sys ] || ln -sf $(XEN_ROOT)/tools/include/xen-sys/MiniOS include/xen/sys ) && \
+          ( [ -h include/xen/libelf ] || ln -sf $(XEN_ROOT)/tools/include/xen/libelf include/xen/libelf ) && \
 	  mkdir -p include/xen-foreign && \
-	  ln -sf $(addprefix ../../,$(wildcard $(XEN_ROOT)/tools/include/xen-foreign/*)) include/xen-foreign/ && \
+	  ln -sf $(wildcard $(XEN_ROOT)/tools/include/xen-foreign/*) include/xen-foreign/ && \
 	  $(CROSS_MAKE) -C include/xen-foreign/ && \
 	  ( [ -h include/xen/foreign ] || ln -sf ../xen-foreign include/xen/foreign )
 	mkdir -p libxc-$(XEN_TARGET_ARCH)
 	[ -h libxc-$(XEN_TARGET_ARCH)/Makefile ] || ( cd libxc-$(XEN_TARGET_ARCH) && \
-	  ln -sf ../$(XEN_ROOT)/tools/libxc/*.h . && \
-	  ln -sf ../$(XEN_ROOT)/tools/libxc/*.c . && \
-	  ln -sf ../$(XEN_ROOT)/tools/libxc/Makefile . )
+	  ln -sf $(XEN_ROOT)/tools/libxc/*.h . && \
+	  ln -sf $(XEN_ROOT)/tools/libxc/*.c . && \
+	  ln -sf $(XEN_ROOT)/tools/libxc/Makefile . )
 	mkdir -p libxc-$(XEN_TARGET_ARCH)/$(XEN_TARGET_ARCH)
 	[ -h libxc-$(XEN_TARGET_ARCH)/$(XEN_TARGET_ARCH) ] || ( cd libxc-$(XEN_TARGET_ARCH)/$(XEN_TARGET_ARCH) && \
-	  ln -sf ../$(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/*.c . && \
-	  ln -sf ../$(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/*.h . && \
-	  ln -sf ../$(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/Makefile . )
+	  ln -sf $(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/*.c . && \
+	  ln -sf $(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/*.h . && \
+	  ln -sf $(XEN_ROOT)/tools/libxc/$(XEN_TARGET_ARCH)/Makefile . )
 	$(CROSS_MAKE) -C $(MINI_OS) links
 	touch mk-headers-$(XEN_TARGET_ARCH)
 
@@ -290,8 +290,7 @@
 .PHONY: ioemu
 ioemu: cross-zlib cross-libpci libxc
 	[ -f ioemu/config-host.mak ] || \
-	  ( $(absolutify_xen_root); \
-	    $(buildmakevars2shellvars); \
+	  ( $(buildmakevars2shellvars); \
 	    cd ioemu ; \
 	    LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) \
 	    TARGET_CPPFLAGS="$(TARGET_CPPFLAGS)" \
diff -r 71712ce9190a -r 2e840539a705 stubdom/c/Makefile
--- a/stubdom/c/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/stubdom/c/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../..
+XEN_ROOT = $(CURDIR)/../..
 
 include $(XEN_ROOT)/Config.mk
 
diff -r 71712ce9190a -r 2e840539a705 stubdom/caml/Makefile
--- a/stubdom/caml/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/stubdom/caml/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../..
+XEN_ROOT = $(CURDIR)/../..
 
 include $(XEN_ROOT)/Config.mk
 
diff -r 71712ce9190a -r 2e840539a705 stubdom/grub/Makefile
--- a/stubdom/grub/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/stubdom/grub/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../..
+XEN_ROOT = $(CURDIR)/../..
 
 include $(XEN_ROOT)/Config.mk
 vpath %.c ../grub-upstream
diff -r 71712ce9190a -r 2e840539a705 stubdom/pciutils.patch
--- a/stubdom/pciutils.patch	Thu Oct 06 19:06:20 2011 +0100
+++ b/stubdom/pciutils.patch	Thu Oct 06 19:47:14 2011 +0100
@@ -38,7 +38,7 @@
  endif
  
 +ifdef PCI_OS_MINIOS
-+XEN_ROOT=../../..
++XEN_ROOT=$(CURDIR)/../../..
 +include $(XEN_ROOT)/Config.mk
 +OBJS += minios.o
 +endif
diff -r 71712ce9190a -r 2e840539a705 tools/Makefile
--- a/tools/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ..
+XEN_ROOT = $(CURDIR)/..
 include $(XEN_ROOT)/tools/Rules.mk
 
 SUBDIRS-y :=
@@ -105,7 +105,6 @@
 		ln -sf ioemu-remote ioemu-dir; \
 	fi
 	set -e; \
-		$(absolutify_xen_root); \
 		$(buildmakevars2shellvars); \
 		cd ioemu-dir; \
 		$(QEMU_ROOT)/xen-setup $(IOEMU_CONFIGURE_CROSS)
@@ -123,7 +122,6 @@
 
 subdir-clean-ioemu-dir:
 	set -e; if test -d ioemu-dir/.; then \
-		$(absolutify_xen_root); \
 		$(buildmakevars2shellvars); \
 		$(MAKE) -C ioemu-dir clean; \
 	fi
diff -r 71712ce9190a -r 2e840539a705 tools/blktap/Makefile
--- a/tools/blktap/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/blktap/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../..
+XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 SUBDIRS-y :=
diff -r 71712ce9190a -r 2e840539a705 tools/blktap/drivers/Makefile
--- a/tools/blktap/drivers/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/blktap/drivers/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 IBIN         = blktapctrl tapdisk
diff -r 71712ce9190a -r 2e840539a705 tools/blktap/lib/Makefile
--- a/tools/blktap/lib/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/blktap/lib/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 3.0
diff -r 71712ce9190a -r 2e840539a705 tools/blktap2/Makefile
--- a/tools/blktap2/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/blktap2/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../..
+XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS  += $(CFLAGS_libxenctrl)
diff -r 71712ce9190a -r 2e840539a705 tools/blktap2/control/Makefile
--- a/tools/blktap2/control/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/blktap2/control/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT := ../../../
+XEN_ROOT := $(CURDIR)/../../../
 include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR              = 1.0
diff -r 71712ce9190a -r 2e840539a705 tools/blktap2/drivers/Makefile
--- a/tools/blktap2/drivers/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/blktap2/drivers/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT=../../..
+XEN_ROOT=$(CURDIR)/../../..
 BLKTAP_ROOT= ..
 include $(XEN_ROOT)/tools/Rules.mk
 
diff -r 71712ce9190a -r 2e840539a705 tools/blktap2/include/Makefile
--- a/tools/blktap2/include/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/blktap2/include/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT := ../../..
+XEN_ROOT := $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 .PHONY: all
diff -r 71712ce9190a -r 2e840539a705 tools/blktap2/lvm/Makefile
--- a/tools/blktap2/lvm/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/blktap2/lvm/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 BLKTAP_ROOT := ..
 include $(XEN_ROOT)/tools/Rules.mk
 
diff -r 71712ce9190a -r 2e840539a705 tools/blktap2/vhd/Makefile
--- a/tools/blktap2/vhd/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/blktap2/vhd/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT=../../..
+XEN_ROOT=$(CURDIR)/../../..
 BLKTAP_ROOT := ..
 include $(XEN_ROOT)/tools/Rules.mk
 
diff -r 71712ce9190a -r 2e840539a705 tools/blktap2/vhd/lib/Makefile
--- a/tools/blktap2/vhd/lib/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/blktap2/vhd/lib/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT=../../../..
+XEN_ROOT=$(CURDIR)/../../../..
 BLKTAP_ROOT := ../..
 include $(XEN_ROOT)/tools/Rules.mk
 
diff -r 71712ce9190a -r 2e840539a705 tools/check/Makefile
--- a/tools/check/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/check/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../..
+XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 .PHONY: all install
diff -r 71712ce9190a -r 2e840539a705 tools/console/Makefile
--- a/tools/console/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/console/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,5 +1,5 @@
 
-XEN_ROOT=../..
+XEN_ROOT=$(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS  += -Werror
diff -r 71712ce9190a -r 2e840539a705 tools/console/testsuite/Makefile
--- a/tools/console/testsuite/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/console/testsuite/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 LDFLAGS=-static
diff -r 71712ce9190a -r 2e840539a705 tools/debugger/gdbsx/Makefile
--- a/tools/debugger/gdbsx/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/debugger/gdbsx/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 include ./Rules.mk
 
 .PHONY: all
diff -r 71712ce9190a -r 2e840539a705 tools/debugger/gdbsx/gx/Makefile
--- a/tools/debugger/gdbsx/gx/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/debugger/gdbsx/gx/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../../..
+XEN_ROOT = $(CURDIR)/../../../..
 include ../Rules.mk
 
 GX_OBJS := gx_comm.o gx_main.o gx_utils.o gx_local.o
diff -r 71712ce9190a -r 2e840539a705 tools/debugger/gdbsx/xg/Makefile
--- a/tools/debugger/gdbsx/xg/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/debugger/gdbsx/xg/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../../..
+XEN_ROOT = $(CURDIR)/../../../..
 include ../Rules.mk
 
 XG_HDRS := xg_public.h 
diff -r 71712ce9190a -r 2e840539a705 tools/debugger/kdd/Makefile
--- a/tools/debugger/kdd/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/debugger/kdd/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS  += $(CFLAGS_libxenctrl)
diff -r 71712ce9190a -r 2e840539a705 tools/debugger/xenitp/Makefile
--- a/tools/debugger/xenitp/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/debugger/xenitp/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT=../../..
+XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 #CFLAGS  += -Werror -g -O0
diff -r 71712ce9190a -r 2e840539a705 tools/examples/Makefile
--- a/tools/examples/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/examples/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../..
+XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 # Init scripts.
diff -r 71712ce9190a -r 2e840539a705 tools/firmware/Makefile
--- a/tools/firmware/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/firmware/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../..
+XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 # hvmloader is a 32-bit protected mode binary.
diff -r 71712ce9190a -r 2e840539a705 tools/firmware/etherboot/Makefile
--- a/tools/firmware/etherboot/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/firmware/etherboot/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,6 +1,6 @@
 
 override XEN_TARGET_ARCH = x86_32
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 include Config
 
diff -r 71712ce9190a -r 2e840539a705 tools/firmware/hvmloader/Makefile
--- a/tools/firmware/hvmloader/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/firmware/hvmloader/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -18,7 +18,7 @@
 # Place - Suite 330, Boston, MA 02111-1307 USA.
 #
 
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/firmware/Rules.mk
 
 SUBDIRS := acpi
diff -r 71712ce9190a -r 2e840539a705 tools/firmware/hvmloader/acpi/Makefile
--- a/tools/firmware/hvmloader/acpi/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/firmware/hvmloader/acpi/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -15,7 +15,7 @@
 # Place - Suite 330, Boston, MA 02111-1307 USA.
 #
 
-XEN_ROOT = ../../../..
+XEN_ROOT = $(CURDIR)/../../../..
 include $(XEN_ROOT)/tools/firmware/Rules.mk
 
 C_SRC = build.c dsdt_anycpu.c dsdt_15cpu.c static_tables.c
diff -r 71712ce9190a -r 2e840539a705 tools/firmware/rombios/32bit/Makefile
--- a/tools/firmware/rombios/32bit/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/firmware/rombios/32bit/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../../..
+XEN_ROOT = $(CURDIR)/../../../..
 include $(XEN_ROOT)/tools/firmware/Rules.mk
 
 TARGET = 32bitbios_flat.h
diff -r 71712ce9190a -r 2e840539a705 tools/firmware/rombios/32bit/tcgbios/Makefile
--- a/tools/firmware/rombios/32bit/tcgbios/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/firmware/rombios/32bit/tcgbios/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../../../..
+XEN_ROOT = $(CURDIR)/../../../../..
 include $(XEN_ROOT)/tools/firmware/Rules.mk
 
 TARGET  = tcgbiosext.o
diff -r 71712ce9190a -r 2e840539a705 tools/firmware/rombios/Makefile
--- a/tools/firmware/rombios/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/firmware/rombios/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 SUBDIRS := 32bit
diff -r 71712ce9190a -r 2e840539a705 tools/flask/Makefile
--- a/tools/flask/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/flask/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../..
+XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 SUBDIRS :=
diff -r 71712ce9190a -r 2e840539a705 tools/flask/libflask/Makefile
--- a/tools/flask/libflask/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/flask/libflask/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,7 +1,7 @@
 MAJOR    = 1.0
 MINOR    = 0
 
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 XEN_LIBXC = $(XEN_ROOT)/tools/libxc
diff -r 71712ce9190a -r 2e840539a705 tools/flask/utils/Makefile
--- a/tools/flask/utils/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/flask/utils/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT=../../..
+XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 XEN_LIBXC          = $(XEN_ROOT)/tools/libxc
 
diff -r 71712ce9190a -r 2e840539a705 tools/hotplug/Linux/Makefile
--- a/tools/hotplug/Linux/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/hotplug/Linux/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 # Init scripts.
diff -r 71712ce9190a -r 2e840539a705 tools/hotplug/Makefile
--- a/tools/hotplug/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/hotplug/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../..
+XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 SUBDIRS-y := common
diff -r 71712ce9190a -r 2e840539a705 tools/hotplug/NetBSD/Makefile
--- a/tools/hotplug/NetBSD/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/hotplug/NetBSD/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 # Xen script dir and scripts to go there.
diff -r 71712ce9190a -r 2e840539a705 tools/hotplug/common/Makefile
--- a/tools/hotplug/common/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/hotplug/common/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 HOTPLUGPATH="hotplugpath.sh"
diff -r 71712ce9190a -r 2e840539a705 tools/include/Makefile
--- a/tools/include/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/include/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../..
+XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 .PHONY: all
@@ -11,11 +11,11 @@
 xen/.dir:
 	@rm -rf xen
 	mkdir -p xen/libelf
-	ln -sf ../$(XEN_ROOT)/xen/include/public/COPYING xen
-	ln -sf $(addprefix ../,$(wildcard $(XEN_ROOT)/xen/include/public/*.h)) xen
-	ln -sf $(addprefix ../$(XEN_ROOT)/xen/include/public/,arch-ia64 arch-x86 hvm io xsm) xen
+	ln -sf $(XEN_ROOT)/xen/include/public/COPYING xen
+	ln -sf $(wildcard $(XEN_ROOT)/xen/include/public/*.h) xen
+	ln -sf $(addprefix $(XEN_ROOT)/xen/include/public/,arch-ia64 arch-x86 hvm io xsm) xen
 	ln -sf ../xen-sys/$(XEN_OS) xen/sys
-	ln -sf $(addprefix ../../$(XEN_ROOT)/xen/include/xen/,libelf.h elfstructs.h) xen/libelf/
+	ln -sf $(addprefix $(XEN_ROOT)/xen/include/xen/,libelf.h elfstructs.h) xen/libelf/
 	ln -s ../xen-foreign xen/foreign
 	touch $@
 
diff -r 71712ce9190a -r 2e840539a705 tools/include/xen-foreign/Makefile
--- a/tools/include/xen-foreign/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/include/xen-foreign/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT=../../..
+XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 ROOT = $(XEN_ROOT)/xen/include/public
diff -r 71712ce9190a -r 2e840539a705 tools/libaio/src/Makefile
--- a/tools/libaio/src/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/libaio/src/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 prefix=$(PREFIX)
diff -r 71712ce9190a -r 2e840539a705 tools/libfsimage/Makefile
--- a/tools/libfsimage/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/libfsimage/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../..
+XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 SUBDIRS-y = common ufs reiserfs iso9660 fat zfs
diff -r 71712ce9190a -r 2e840539a705 tools/libfsimage/common/Makefile
--- a/tools/libfsimage/common/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/libfsimage/common/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR = 1.0
diff -r 71712ce9190a -r 2e840539a705 tools/libfsimage/ext2fs-lib/Makefile
--- a/tools/libfsimage/ext2fs-lib/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/libfsimage/ext2fs-lib/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 
 LIB_SRCS-y = ext2fs-lib.c
 
diff -r 71712ce9190a -r 2e840539a705 tools/libfsimage/ext2fs/Makefile
--- a/tools/libfsimage/ext2fs/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/libfsimage/ext2fs/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 
 LIB_SRCS-y = fsys_ext2fs.c
 
diff -r 71712ce9190a -r 2e840539a705 tools/libfsimage/fat/Makefile
--- a/tools/libfsimage/fat/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/libfsimage/fat/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 
 LIB_SRCS-y = fsys_fat.c
 
diff -r 71712ce9190a -r 2e840539a705 tools/libfsimage/iso9660/Makefile
--- a/tools/libfsimage/iso9660/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/libfsimage/iso9660/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 
 LIB_SRCS-y = fsys_iso9660.c
 
diff -r 71712ce9190a -r 2e840539a705 tools/libfsimage/reiserfs/Makefile
--- a/tools/libfsimage/reiserfs/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/libfsimage/reiserfs/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 
 LIB_SRCS-y = fsys_reiserfs.c
 
diff -r 71712ce9190a -r 2e840539a705 tools/libfsimage/ufs/Makefile
--- a/tools/libfsimage/ufs/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/libfsimage/ufs/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 
 LIB_SRCS-y = fsys_ufs.c
 
diff -r 71712ce9190a -r 2e840539a705 tools/libfsimage/zfs/Makefile
--- a/tools/libfsimage/zfs/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/libfsimage/zfs/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -22,7 +22,7 @@
 #  Use is subject to license terms.
 #
 
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 
 CFLAGS += -DFSYS_ZFS -DFSIMAGE -I$(XEN_ROOT)/tools/libfsimage/zfs
 LIB_SRCS-y = zfs_lzjb.c zfs_sha256.c zfs_fletcher.c fsi_zfs.c fsys_zfs.c
diff -r 71712ce9190a -r 2e840539a705 tools/libxc/Makefile
--- a/tools/libxc/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/libxc/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../..
+XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 4.0
diff -r 71712ce9190a -r 2e840539a705 tools/libxc/ia64/Makefile
--- a/tools/libxc/ia64/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/libxc/ia64/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -14,7 +14,7 @@
 endif
 DOMFW_SRCS := $(addprefix ia64/, $(DOMFW_SRCS_BASE))
 $(DOMFW_SRCS):
-	ln -sf ../$(XEN_ROOT)/xen/arch/ia64/xen/$(@F) $@
+	ln -sf $(XEN_ROOT)/xen/arch/ia64/xen/$(@F) $@
 
 # XXX kludge: libxc/Makefile doesn't understand .S.
 GUEST_SRCS-y += $(patsubst %.S, %.c, $(DOMFW_SRCS))
@@ -29,7 +29,7 @@
 DOMFW_ASM_HDRS_BASE := bundle.h dom_fw.h dom_fw_common.h dom_fw_domu.h
 DOMFW_ASM_HDRS := $(addprefix ia64/asm/, $(DOMFW_ASM_HDRS_BASE))
 $(DOMFW_ASM_HDRS): ia64/asm
-	ln -sf ../../$(XEN_ROOT)/xen/include/asm-ia64/$(@F) $@
+	ln -sf $(XEN_ROOT)/xen/include/asm-ia64/$(@F) $@
 build: $(DOMFW_ASM_HDR)
 
 .PHONY: mk-symlinks-acpi mk-symlinks-misc ia64-clean
@@ -43,12 +43,12 @@
 	echo "/* automatically created dummy empty header file. */" > $@
 
 mk-symlinks-acpi: $(IA64_HDR_DIRS) $(IA64_EMPTY_FILES) $(DOMFW_ASM_HDRS)
-	( cd ia64/acpi && ln -sf ../../$(XEN_ROOT)/xen/include/acpi/*.h .)
-	( cd ia64/acpi/platform && ln -sf ../../../$(XEN_ROOT)/xen/include/acpi/platform/*.h .)
-	( cd ia64/xen && ln -sf ../../$(XEN_ROOT)/xen/include/xen/acpi.h .)
+	( cd ia64/acpi && ln -sf $(XEN_ROOT)/xen/include/acpi/*.h .)
+	( cd ia64/acpi/platform && ln -sf $(XEN_ROOT)/xen/include/acpi/platform/*.h .)
+	( cd ia64/xen && ln -sf $(XEN_ROOT)/xen/include/xen/acpi.h .)
 mk-symlinks-misc: $(IA64_HDR_DIRS)
-	( cd ia64/asm && ln -sf ../../$(XEN_ROOT)/xen/include/asm-ia64/linux-xen/asm/kregs.h .)
-	( cd ia64/asm && ln -sf ../../$(XEN_ROOT)/xen/include/asm-ia64/linux/asm/fpswa.h .)
+	( cd ia64/asm && ln -sf $(XEN_ROOT)/xen/include/asm-ia64/linux-xen/asm/kregs.h .)
+	( cd ia64/asm && ln -sf $(XEN_ROOT)/xen/include/asm-ia64/linux/asm/fpswa.h .)
 build: mk-symlinks-acpi mk-symlinks-misc
 
 clean: ia64-clean
diff -r 71712ce9190a -r 2e840539a705 tools/libxen/Makefile
--- a/tools/libxen/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/libxen/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -15,7 +15,7 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 #
-XEN_ROOT=../..
+XEN_ROOT=$(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR = 1.0
diff -r 71712ce9190a -r 2e840539a705 tools/libxl/Makefile
--- a/tools/libxl/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/libxl/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -2,7 +2,7 @@
 # tools/libxl/Makefile
 #
 
-XEN_ROOT = ../..
+XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR = 1.0
diff -r 71712ce9190a -r 2e840539a705 tools/memshr/Makefile
--- a/tools/memshr/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/memshr/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../..
+XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 LIBMEMSHR-BUILD := libmemshr.a
diff -r 71712ce9190a -r 2e840539a705 tools/misc/Makefile
--- a/tools/misc/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/misc/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT=../..
+XEN_ROOT=$(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS   += -Werror
diff -r 71712ce9190a -r 2e840539a705 tools/misc/lomount/Makefile
--- a/tools/misc/lomount/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/misc/lomount/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT=../../..
+XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS  += -Werror
diff -r 71712ce9190a -r 2e840539a705 tools/misc/miniterm/Makefile
--- a/tools/misc/miniterm/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/misc/miniterm/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT:=../../..
+XEN_ROOT:=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 TARGET = miniterm
diff -r 71712ce9190a -r 2e840539a705 tools/misc/nsplitd/Makefile
--- a/tools/misc/nsplitd/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/misc/nsplitd/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT := ../../..
+XEN_ROOT := $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 CFILES = $(wildcard *.c)
diff -r 71712ce9190a -r 2e840539a705 tools/ocaml/Makefile
--- a/tools/ocaml/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/ocaml/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../..
+XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 SUBDIRS_PROGRAMS = xenstored
diff -r 71712ce9190a -r 2e840539a705 tools/ocaml/libs/Makefile
--- a/tools/ocaml/libs/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/ocaml/libs/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 SUBDIRS= \
diff -r 71712ce9190a -r 2e840539a705 tools/ocaml/libs/eventchn/Makefile
--- a/tools/ocaml/libs/eventchn/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/ocaml/libs/eventchn/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-TOPLEVEL=../..
+TOPLEVEL=$(CURDIR)/../..
 XEN_ROOT=$(TOPLEVEL)/../..
 include $(TOPLEVEL)/common.make
 
diff -r 71712ce9190a -r 2e840539a705 tools/ocaml/libs/log/Makefile
--- a/tools/ocaml/libs/log/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/ocaml/libs/log/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-TOPLEVEL=../..
+TOPLEVEL=$(CURDIR)/../..
 XEN_ROOT=$(TOPLEVEL)/../..
 include $(TOPLEVEL)/common.make
 
diff -r 71712ce9190a -r 2e840539a705 tools/ocaml/libs/mmap/Makefile
--- a/tools/ocaml/libs/mmap/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/ocaml/libs/mmap/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-TOPLEVEL=../..
+TOPLEVEL=$(CURDIR)/../..
 XEN_ROOT=$(TOPLEVEL)/../..
 include $(TOPLEVEL)/common.make
 
diff -r 71712ce9190a -r 2e840539a705 tools/ocaml/libs/uuid/Makefile
--- a/tools/ocaml/libs/uuid/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/ocaml/libs/uuid/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-TOPLEVEL=../..
+TOPLEVEL=$(CURDIR)/../..
 XEN_ROOT=$(TOPLEVEL)/../..
 include $(TOPLEVEL)/common.make
 
diff -r 71712ce9190a -r 2e840539a705 tools/ocaml/libs/xb/Makefile
--- a/tools/ocaml/libs/xb/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/ocaml/libs/xb/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-TOPLEVEL=../..
+TOPLEVEL=$(CURDIR)/../..
 XEN_ROOT=$(TOPLEVEL)/../..
 include $(TOPLEVEL)/common.make
 
diff -r 71712ce9190a -r 2e840539a705 tools/ocaml/libs/xc/Makefile
--- a/tools/ocaml/libs/xc/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/ocaml/libs/xc/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-TOPLEVEL=../..
+TOPLEVEL=$(CURDIR)/../..
 XEN_ROOT=$(TOPLEVEL)/../..
 include $(TOPLEVEL)/common.make
 
diff -r 71712ce9190a -r 2e840539a705 tools/ocaml/libs/xl/Makefile
--- a/tools/ocaml/libs/xl/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/ocaml/libs/xl/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-TOPLEVEL=../..
+TOPLEVEL=$(CURDIR)/../..
 XEN_ROOT=$(TOPLEVEL)/../..
 include $(TOPLEVEL)/common.make
 
diff -r 71712ce9190a -r 2e840539a705 tools/ocaml/libs/xs/Makefile
--- a/tools/ocaml/libs/xs/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/ocaml/libs/xs/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-TOPLEVEL=../..
+TOPLEVEL=$(CURDIR)/../..
 XEN_ROOT=$(TOPLEVEL)/../..
 include $(TOPLEVEL)/common.make
 
diff -r 71712ce9190a -r 2e840539a705 tools/ocaml/xenstored/Makefile
--- a/tools/ocaml/xenstored/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/ocaml/xenstored/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,5 +1,5 @@
-XEN_ROOT = ../../..
-OCAML_TOPLEVEL = ..
+XEN_ROOT = $(CURDIR)/../../..
+OCAML_TOPLEVEL = $(CURDIR)/..
 include $(OCAML_TOPLEVEL)/common.make
 
 OCAMLINCLUDE += \
diff -r 71712ce9190a -r 2e840539a705 tools/pygrub/Makefile
--- a/tools/pygrub/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/pygrub/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,5 +1,5 @@
 
-XEN_ROOT = ../..
+XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 .PHONY: all
diff -r 71712ce9190a -r 2e840539a705 tools/python/Makefile
--- a/tools/python/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/python/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../..
+XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 .PHONY: all
diff -r 71712ce9190a -r 2e840539a705 tools/remus/Makefile
--- a/tools/remus/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/remus/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT=../..
+XEN_ROOT=$(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 SCRIPTS = remus
diff -r 71712ce9190a -r 2e840539a705 tools/security/Makefile
--- a/tools/security/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/security/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../..
+XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS   += -Werror
diff -r 71712ce9190a -r 2e840539a705 tools/tests/mce-test/tools/Makefile
--- a/tools/tests/mce-test/tools/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/tests/mce-test/tools/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT=../../../..
+XEN_ROOT=$(CURDIR)/../../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS   += -Werror
diff -r 71712ce9190a -r 2e840539a705 tools/tests/x86_emulator/Makefile
--- a/tools/tests/x86_emulator/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/tests/x86_emulator/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,5 +1,5 @@
 
-XEN_ROOT=../../..
+XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 TARGET := test_x86_emulator
diff -r 71712ce9190a -r 2e840539a705 tools/tests/x86_emulator/blowfish.mk
--- a/tools/tests/x86_emulator/blowfish.mk	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/tests/x86_emulator/blowfish.mk	Thu Oct 06 19:47:14 2011 +0100
@@ -1,5 +1,5 @@
 
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 CFLAGS =
 include $(XEN_ROOT)/tools/Rules.mk
 
diff -r 71712ce9190a -r 2e840539a705 tools/tests/xen-access/Makefile
--- a/tools/tests/xen-access/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/tests/xen-access/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT=../../..
+XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS   += -Werror
diff -r 71712ce9190a -r 2e840539a705 tools/vnet/doc/Makefile
--- a/tools/vnet/doc/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/vnet/doc/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,6 +1,6 @@
 #!/usr/bin/make -f
 # -*- mode: Makefile; -*-
-XEN_ROOT        = ../../..
+XEN_ROOT        = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 VERSION = 1.0
diff -r 71712ce9190a -r 2e840539a705 tools/vnet/examples/Makefile
--- a/tools/vnet/examples/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/vnet/examples/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,6 +1,6 @@
 # -*- mode: Makefile; -*-
 #============================================================================
-XEN_ROOT        = ../../..
+XEN_ROOT        = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 .PHONY: all
diff -r 71712ce9190a -r 2e840539a705 tools/vnet/scripts/Makefile
--- a/tools/vnet/scripts/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/vnet/scripts/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,6 +1,6 @@
 # -*- mode: Makefile; -*-
 #============================================================================
-XEN_ROOT        = ../../..
+XEN_ROOT        = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 .PHONY: all
diff -r 71712ce9190a -r 2e840539a705 tools/vtpm/Makefile
--- a/tools/vtpm/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/vtpm/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../..
+XEN_ROOT = $(CURDIR)/../..
 
 # Base definitions and rules
 include $(XEN_ROOT)/tools/vtpm/Rules.mk
diff -r 71712ce9190a -r 2e840539a705 tools/vtpm_manager/Makefile
--- a/tools/vtpm_manager/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/vtpm_manager/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../..
+XEN_ROOT = $(CURDIR)/../..
 
 # Base definitions and rules
 include $(XEN_ROOT)/tools/vtpm_manager/Rules.mk
diff -r 71712ce9190a -r 2e840539a705 tools/vtpm_manager/crypto/Makefile
--- a/tools/vtpm_manager/crypto/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/vtpm_manager/crypto/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/vtpm_manager/Rules.mk
 
 BIN		= libtcpaCrypto.a
diff -r 71712ce9190a -r 2e840539a705 tools/vtpm_manager/manager/Makefile
--- a/tools/vtpm_manager/manager/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/vtpm_manager/manager/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/vtpm_manager/Rules.mk
 
 BIN		= vtpm_managerd
diff -r 71712ce9190a -r 2e840539a705 tools/vtpm_manager/migration/Makefile
--- a/tools/vtpm_manager/migration/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/vtpm_manager/migration/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/vtpm_manager/Rules.mk
 
 VPATH = ../manager
diff -r 71712ce9190a -r 2e840539a705 tools/vtpm_manager/tcs/Makefile
--- a/tools/vtpm_manager/tcs/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/vtpm_manager/tcs/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/vtpm_manager/Rules.mk
 
 BIN		= libTCS.a
diff -r 71712ce9190a -r 2e840539a705 tools/vtpm_manager/util/Makefile
--- a/tools/vtpm_manager/util/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/vtpm_manager/util/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/vtpm_manager/Rules.mk
 
 BIN		= libTCGUtils.a
diff -r 71712ce9190a -r 2e840539a705 tools/xcutils/Makefile
--- a/tools/xcutils/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/xcutils/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -8,7 +8,7 @@
 # Copyright (C) 2005 by Christian Limpach
 #
 
-XEN_ROOT	= ../..
+XEN_ROOT	= $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS += -Werror
diff -r 71712ce9190a -r 2e840539a705 tools/xenbackendd/Makefile
--- a/tools/xenbackendd/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/xenbackendd/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -9,7 +9,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-XEN_ROOT=../..
+XEN_ROOT=$(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS  += -Werror
diff -r 71712ce9190a -r 2e840539a705 tools/xenmon/Makefile
--- a/tools/xenmon/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/xenmon/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -10,7 +10,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-XEN_ROOT=../..
+XEN_ROOT=$(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS  += -Werror
diff -r 71712ce9190a -r 2e840539a705 tools/xenpaging/Makefile
--- a/tools/xenpaging/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/xenpaging/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT=../..
+XEN_ROOT=$(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS   += -I $(XEN_XC)
diff -r 71712ce9190a -r 2e840539a705 tools/xenpmd/Makefile
--- a/tools/xenpmd/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/xenpmd/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT=../..
+XEN_ROOT=$(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS  += -Werror
diff -r 71712ce9190a -r 2e840539a705 tools/xenstat/Makefile
--- a/tools/xenstat/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/xenstat/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../..
+XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 SUBDIRS :=
diff -r 71712ce9190a -r 2e840539a705 tools/xenstat/libxenstat/Makefile
--- a/tools/xenstat/libxenstat/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/xenstat/libxenstat/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -12,7 +12,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 # Lesser General Public License for more details.
 
-XEN_ROOT=../../..
+XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 prefix=$(PREFIX)
diff -r 71712ce9190a -r 2e840539a705 tools/xenstat/xentop/Makefile
--- a/tools/xenstat/xentop/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/xenstat/xentop/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -10,7 +10,7 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-XEN_ROOT=../../..
+XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 ifneq ($(XENSTAT_XENTOP),y)
diff -r 71712ce9190a -r 2e840539a705 tools/xenstore/Makefile
--- a/tools/xenstore/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/xenstore/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT=../..
+XEN_ROOT=$(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR = 3.0
diff -r 71712ce9190a -r 2e840539a705 tools/xentrace/Makefile
--- a/tools/xentrace/Makefile	Thu Oct 06 19:06:20 2011 +0100
+++ b/tools/xentrace/Makefile	Thu Oct 06 19:47:14 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT=../..
+XEN_ROOT=$(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS  += -Werror

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 06 23:34:21 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 06 Oct 2011 23:34:21 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RC40j-0005JI-5U; Thu, 06 Oct 2011 23:34:21 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RC40J-0005C6-7g
	for xen-changelog@lists.xensource.com; Thu, 06 Oct 2011 23:33:55 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-216.messagelabs.com!1317969232!68966!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19477 invoked from network); 7 Oct 2011 06:33:52 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Oct 2011 06:33:52 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RC40F-0004Kp-1y
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 07:33:51 +0100
Message-Id: <E1RC40F-0004Kp-1y@xenbits.xen.org>
Date: Fri, 07 Oct 2011 07:33:49 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] Do not re-define XEN_ROOT in
	hypervisor sub-Makefiles.
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@xen.org>
# Date 1317927836 -3600
# Node ID 460b613596fa27cf2026ce1de9ff42560853061a
# Parent  2e840539a705b41590bd15ab415eb091ead9e5b1
Do not re-define XEN_ROOT in hypervisor sub-Makefiles.

We can globally export it from xen/Makefile instead, as all hypervisor
builds have this Makefile at their root.

Signed-off-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   23048:5069eaaa9f79
xen-unstable date:        Thu Mar 17 08:04:10 2011 +0000
---


diff -r 2e840539a705 -r 460b613596fa xen/Makefile
--- a/xen/Makefile	Thu Oct 06 19:47:14 2011 +0100
+++ b/xen/Makefile	Thu Oct 06 20:03:56 2011 +0100
@@ -10,6 +10,7 @@
 export XEN_DOMAIN	?= $(shell ([ -x /bin/dnsdomainname ] && /bin/dnsdomainname) || ([ -x /bin/domainname ] && /bin/domainname || echo [unknown]))
 
 export BASEDIR := $(CURDIR)
+export XEN_ROOT := $(BASEDIR)/..
 
 .PHONY: default
 default: build
diff -r 2e840539a705 -r 460b613596fa xen/Rules.mk
--- a/xen/Rules.mk	Thu Oct 06 19:47:14 2011 +0100
+++ b/xen/Rules.mk	Thu Oct 06 20:03:56 2011 +0100
@@ -10,7 +10,6 @@
 crash_debug   ?= n
 frame_pointer ?= n
 
-XEN_ROOT=$(BASEDIR)/..
 include $(XEN_ROOT)/Config.mk
 
 # Hardcoded configuration implications and dependencies.
diff -r 2e840539a705 -r 460b613596fa xen/arch/x86/boot/build32.mk
--- a/xen/arch/x86/boot/build32.mk	Thu Oct 06 19:47:14 2011 +0100
+++ b/xen/arch/x86/boot/build32.mk	Thu Oct 06 20:03:56 2011 +0100
@@ -1,4 +1,3 @@
-XEN_ROOT=../../../..
 override XEN_TARGET_ARCH=x86_32
 CFLAGS =
 include $(XEN_ROOT)/Config.mk
diff -r 2e840539a705 -r 460b613596fa xen/include/Makefile
--- a/xen/include/Makefile	Thu Oct 06 19:47:14 2011 +0100
+++ b/xen/include/Makefile	Thu Oct 06 20:03:56 2011 +0100
@@ -1,4 +1,3 @@
-XEN_ROOT:=$(BASEDIR)/..
 include $(XEN_ROOT)/Config.mk
 
 ifneq ($(CONFIG_COMPAT),)
diff -r 2e840539a705 -r 460b613596fa xen/tools/Makefile
--- a/xen/tools/Makefile	Thu Oct 06 19:47:14 2011 +0100
+++ b/xen/tools/Makefile	Thu Oct 06 20:03:56 2011 +0100
@@ -1,5 +1,4 @@
 
-XEN_ROOT = $(BASEDIR)/..
 include $(XEN_ROOT)/Config.mk
 
 .PHONY: default
diff -r 2e840539a705 -r 460b613596fa xen/tools/figlet/Makefile
--- a/xen/tools/figlet/Makefile	Thu Oct 06 19:47:14 2011 +0100
+++ b/xen/tools/figlet/Makefile	Thu Oct 06 20:03:56 2011 +0100
@@ -1,5 +1,4 @@
 
-XEN_ROOT = $(BASEDIR)/..
 include $(XEN_ROOT)/Config.mk
 
 figlet: figlet.c

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 07 07:15:00 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 07 Oct 2011 07:15:00 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RCBCV-0006EC-0X; Fri, 07 Oct 2011 07:14:59 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RCB8q-0004tH-3c
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 07:11:12 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-27.messagelabs.com!1317996646!48119866!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27464 invoked from network); 7 Oct 2011 14:10:46 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Oct 2011 14:10:46 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RCB8m-0005n5-Vt
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 15:11:08 +0100
Message-Id: <E1RCB8m-0005n5-Vt@xenbits.xen.org>
Date: Fri, 07 Oct 2011 15:11:08 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/AMD: Do not enable ARAT feature
	on AMD processors below family 0x12
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 Boris Ostrovsky <boris.ostrovsky@amd.com>
# Date 1317976335 -7200
# Node ID 08d6ba4e447d6c13c6dfac5c23e84b73961cb109
# Parent  159be83e5fe9111bb30d8b1f83127f5724d44424
x86/AMD: Do not enable ARAT feature on AMD processors below family 0x12

Determining whether an AMD processor is affected by erratum 400 may
have some corner cases and handling these cases is somewhat complicated.
In the interest of simplicity we won't claim ARAT support on processor
families below 0x12.

Mirrors Linux commit e9cdd343a5e42c43bcda01e609fa23089e026470

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@amd.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 159be83e5fe9 -r 08d6ba4e447d xen/arch/x86/cpu/amd.c
--- a/xen/arch/x86/cpu/amd.c	Thu Oct 06 19:44:40 2011 +0100
+++ b/xen/arch/x86/cpu/amd.c	Fri Oct 07 10:32:15 2011 +0200
@@ -495,8 +495,11 @@
 	}
 #endif
 
-	/* As a rule processors have APIC timer running in deep C states */
-	if (c->x86 > 0xf && !cpu_has_amd_erratum(c, AMD_ERRATUM_400))
+	/*
+	 * Family 0x12 and above processors have APIC timer
+	 * running in deep C states.
+	 */
+	if (c->x86 > 0x11)
 		set_bit(X86_FEATURE_ARAT, c->x86_capability);
 
 	if (cpuid_edx(0x80000007) & (1 << 10)) {

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 07 07:15:17 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 07 Oct 2011 07:15:17 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RCBCn-0006IX-Px; Fri, 07 Oct 2011 07:15:17 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RCB8q-0004tP-RH
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 07:11:13 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-216.messagelabs.com!1317996669!136639!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23913 invoked from network); 7 Oct 2011 14:11:09 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Oct 2011 14:11:09 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RCB8n-0005nK-Ey
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 15:11:09 +0100
Message-Id: <E1RCB8n-0005nK-Ey@xenbits.xen.org>
Date: Fri, 07 Oct 2011 15:11:09 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/libfsimage: Avoid relative
	XEN_ROOT specification
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 Juergen Gross <juergen.gross@ts.fujitsu.com>
# Date 1317976512 -3600
# Node ID 86d54c2950879ff7faa0f476bac40a12b87153e6
# Parent  08d6ba4e447d6c13c6dfac5c23e84b73961cb109
tools/libfsimage: Avoid relative XEN_ROOT specification

XEN_ROOT must be set to an absolute path to avoid out of the tree
references

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 08d6ba4e447d -r 86d54c295087 tools/libfsimage/xfs/Makefile
--- a/tools/libfsimage/xfs/Makefile	Fri Oct 07 10:32:15 2011 +0200
+++ b/tools/libfsimage/xfs/Makefile	Fri Oct 07 09:35:12 2011 +0100
@@ -1,4 +1,4 @@
-XEN_ROOT = ../../..
+XEN_ROOT = $(CURDIR)/../../..
 
 LIB_SRCS-y = fsys_xfs.c
 

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 07 07:15:31 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 07 Oct 2011 07:15:31 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RCBD1-0006LJ-4V; Fri, 07 Oct 2011 07:15:31 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RCB8r-0004tW-0J
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 07:11:13 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-21.messagelabs.com!1317996631!63256805!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32388 invoked from network); 7 Oct 2011 14:10:31 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Oct 2011 14:10:31 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RCB8n-0005nZ-Ua
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 15:11:09 +0100
Message-Id: <E1RCB8n-0005nZ-Ua@xenbits.xen.org>
Date: Fri, 07 Oct 2011 15:11:09 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Config.mk: error out on non-absolute
	$(XEN_ROOT)
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 Ian Campbell <ian.campbell@citrix.com>
# Date 1317976531 -3600
# Node ID 5b5394a55813dfa778a8c944bc0e6a0956629f64
# Parent  86d54c2950879ff7faa0f476bac40a12b87153e6
Config.mk: error out on non-absolute $(XEN_ROOT)

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 86d54c295087 -r 5b5394a55813 Config.mk
--- a/Config.mk	Fri Oct 07 09:35:12 2011 +0100
+++ b/Config.mk	Fri Oct 07 09:35:31 2011 +0100
@@ -1,5 +1,9 @@
 # -*- mode: Makefile; -*-
 
+ifeq ($(filter /%,$(XEN_ROOT)),)
+$(error XEN_ROOT must be absolute)
+endif
+
 -include $(XEN_ROOT)/.config
 
 # A debug build of Xen and tools?

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 07 07:15:46 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 07 Oct 2011 07:15:46 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RCBDG-0006OW-Gv; Fri, 07 Oct 2011 07:15:46 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RCB8r-0004th-Rt
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 07:11:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-182.messagelabs.com!1317996670!18592015!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30805 invoked from network); 7 Oct 2011 14:11:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	7 Oct 2011 14:11:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RCB8o-0005no-GR
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 15:11:10 +0100
Message-Id: <E1RCB8o-0005no-GR@xenbits.xen.org>
Date: Fri, 07 Oct 2011 15:11:09 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libvchan: remove
	erroneously-committed libvchan-node[12]; add them to .hgignore
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 Ian Jackson <Ian.Jackson@eu.citrix.com>
# Date 1317980824 -3600
# Node ID eb8637351535e9c76779d6dd78a1d5b4a434c082
# Parent  5b5394a55813dfa778a8c944bc0e6a0956629f64
libvchan: remove erroneously-committed libvchan-node[12]; add them to .hgignore

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 5b5394a55813 -r eb8637351535 .hgignore
--- a/.hgignore	Fri Oct 07 09:35:31 2011 +0100
+++ b/.hgignore	Fri Oct 07 10:47:04 2011 +0100
@@ -189,6 +189,7 @@
 ^tools/libxl/xl$
 ^tools/libxl/testidl$
 ^tools/libxl/testidl\.c$
+^tools/libvchan/vchan-node[12]$
 ^tools/libaio/src/.*\.ol$
 ^tools/libaio/src/.*\.os$
 ^tools/misc/cpuperf/cpuperf-perfcntr$
diff -r 5b5394a55813 -r eb8637351535 tools/libvchan/vchan-node1
Binary file tools/libvchan/vchan-node1 has changed
diff -r 5b5394a55813 -r eb8637351535 tools/libvchan/vchan-node2
Binary file tools/libvchan/vchan-node2 has changed

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 07 22:11:42 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 07 Oct 2011 22:11:42 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RCPCI-0000gx-9u; Fri, 07 Oct 2011 22:11:42 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RCPBp-0000U6-DA
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 22:11:13 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-216.messagelabs.com!1318050670!54640!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22136 invoked from network); 8 Oct 2011 05:11:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Oct 2011 05:11:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RCPBm-000476-3y
	for xen-changelog@lists.xensource.com; Sat, 08 Oct 2011 06:11:10 +0100
Message-Id: <E1RCPBm-000476-3y@xenbits.xen.org>
Date: Sat, 08 Oct 2011 06:11:09 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] Update Xen version to 4.1.2-rc3
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@xen.org>
# Date 1317998785 -3600
# Node ID 24041ed83728ac6c26d3c32d29d7d08eb8433149
# Parent  460b613596fa27cf2026ce1de9ff42560853061a
Update Xen version to 4.1.2-rc3
---


diff -r 460b613596fa -r 24041ed83728 Config.mk
--- a/Config.mk	Thu Oct 06 20:03:56 2011 +0100
+++ b/Config.mk	Fri Oct 07 15:46:25 2011 +0100
@@ -179,7 +179,7 @@
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG := xen-4.1.2-rc1
+QEMU_TAG := xen-4.1.2-rc3
 #QEMU_TAG ?= e073e69457b4d99b6da0b6536296e3498f7f6599
 # Fri Feb 11 17:54:51 2011 +0000
 # qemu-xen: fix segfault with empty cdroms
diff -r 460b613596fa -r 24041ed83728 xen/Makefile
--- a/xen/Makefile	Thu Oct 06 20:03:56 2011 +0100
+++ b/xen/Makefile	Fri Oct 07 15:46:25 2011 +0100
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 1
-export XEN_EXTRAVERSION ?= .2-rc3-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .2-rc3$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 07 22:11:48 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 07 Oct 2011 22:11:48 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RCPCN-0000js-QM; Fri, 07 Oct 2011 22:11:47 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RCPBp-0000UH-Ps
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 22:11:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-21.messagelabs.com!1318050638!57941649!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11937 invoked from network); 8 Oct 2011 05:10:38 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-7.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Oct 2011 05:10:38 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RCPBm-00047L-Io
	for xen-changelog@lists.xensource.com; Sat, 08 Oct 2011 06:11:10 +0100
Message-Id: <E1RCPBm-00047L-Io@xenbits.xen.org>
Date: Sat, 08 Oct 2011 06:11:10 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] Added tag 4.1.2-rc3 for changeset
	24041ed83728
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@xen.org>
# Date 1317998804 -3600
# Node ID f721aba2dc96ea218adeb5ee71a54f17339dc10c
# Parent  24041ed83728ac6c26d3c32d29d7d08eb8433149
Added tag 4.1.2-rc3 for changeset 24041ed83728
---


diff -r 24041ed83728 -r f721aba2dc96 .hgtags
--- a/.hgtags	Fri Oct 07 15:46:25 2011 +0100
+++ b/.hgtags	Fri Oct 07 15:46:44 2011 +0100
@@ -60,3 +60,4 @@
 ab0e3dac2c63434cd88466bdd4e89ad0075fdec4 RELEASE-4.1.1
 1f21da33dea4acb2dbfb988bcd1b7898e019316c 4.1.2-rc1
 3e6a3bf83935cc2460707b94ef2801bb6f19d581 4.1.2-rc2
+24041ed83728ac6c26d3c32d29d7d08eb8433149 4.1.2-rc3

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 07 22:16:21 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 07 Oct 2011 22:16:21 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RCPGn-0000rN-Gg; Fri, 07 Oct 2011 22:16:21 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with smtp (Exim 4.43) id 1RCPGj-0000qh-LS
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 22:16:18 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-174.messagelabs.com!1318050974!34423826!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31710 invoked from network); 8 Oct 2011 05:16:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-174.messagelabs.com with SMTP;
	8 Oct 2011 05:16:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RCPBn-00047a-1P
	for xen-changelog@lists.xensource.com; Sat, 08 Oct 2011 06:11:11 +0100
Message-Id: <E1RCPBn-00047a-1P@xenbits.xen.org>
Date: Sat, 08 Oct 2011 06:11:10 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] Added signature for changeset
	24041ed83728
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@xen.org>
# Date 1317998828 -3600
# Node ID 3f8fb62436e67018b4221a8ab8fa88780c55d4a3
# Parent  f721aba2dc96ea218adeb5ee71a54f17339dc10c
Added signature for changeset 24041ed83728
---


diff -r f721aba2dc96 -r 3f8fb62436e6 .hgsigs
--- a/.hgsigs	Fri Oct 07 15:46:44 2011 +0100
+++ b/.hgsigs	Fri Oct 07 15:47:08 2011 +0100
@@ -13,3 +13,4 @@
 ab0e3dac2c63434cd88466bdd4e89ad0075fdec4 0 iQEcBAABAgAGBQJN91v3AAoJEIP+FMlX6CvZqDkIAK34QbQOOWaOVNI0xnDW2tj3Uu7sJZ5NqSfwg7FiFnL+lb7N/jJnjL4AIn22UIJnpf5GxjmFII4Aw2xc1dHRlznxaXFPNrh6ZTL7GhRuZvQi7/kR/bgc2Io9B+Gcu9gZaRzakU5kOYt5Sv5JmVz4eJcIxblNrh6+mdzkGLjUERuC9/Ovd2fGvXYtCkOsSkyXAUyJGGui+kDAqowFMzZuxRukislO94x4P9dkVpIaX/5n67/sCo5P9DeyDrkHtAShX8DOIFhujilgRDjcB54NESRixoLntFYrqce1OWKlEG4ssE5s6wtrrPgADx92PIkqMfWrUIXx6YVd0GWjzj1Q4TU=
 1f21da33dea4acb2dbfb988bcd1b7898e019316c 0 iQEcBAABAgAGBQJOViYyAAoJEIP+FMlX6CvZew0IAKJ/gjTWVmD9cBEN6XJYYW+z831Hsm4Msk9QBskJiV2cVFcaF9/SzexnC6waU1BpxMCLWNusaPl18Uc2knF0kYyXAjeWDZNcRZtcZIS/kDzPBIAGkq4wI+DA4nfFCnYNsFk9dy5aqkvVOVpvn7E6fUcOtWQC+IfuOrMo6mRjew4dPlv3xhwYgf2oQf9I1YLoJ6UVh0o1g0jHeXhYZu8Fqm/a4O0kdbvUDHuViVT0qHhGIi6dLkD0w/ih+o7S3FAMXLpLVBdt23bVBti4jwFMnMEgy2wkP4lbfM++1Io//Bn7tg4CZcNHYt6a7ENmhL+lmTbh0GyteZ9sgbfricSFkGc=
 3e6a3bf83935cc2460707b94ef2801bb6f19d581 0 iQEcBAABAgAGBQJOZzwsAAoJEIP+FMlX6CvZXBIIAJFb+nUaqTCQRT5cE1mn4n5lEdtBY7L/ar4/rzWAiavQYkaoP93HyOdo0sf2SdwcpTNCXw0TDUmZU3xMqBiwWwp2MX3AFM/0dnPv2CoIH/k3vXr26eBJo15w2dFu2dF8OZ/Tn0NTdXdPd+qa7ugqVqT0PYgyQ8+euQJfcdYAY6YCjGD4v5cX529oB2aqoFKBBsHMnW6uD3OYf3sdvj85wgVpip7nw+5OZWrYP2lK/RXzlo42B/l+fNPJjsM8uU928ETNevJGPK28EJDaNwrEktTJQJYNa6K1oal/kpNP6FM1pOOdel69NSGbMw4Obv0eZ/kZahBLONfCLw4kYVggmWg=
+24041ed83728ac6c26d3c32d29d7d08eb8433149 0 iQEcBAABAgAGBQJOjxDqAAoJEIP+FMlX6CvZohIH/2krgh6rTz6hjsv6HOFWQkekqHjZyyQBgdl3tfgSN/vSd3rJPN6mvaYjh8ZltmBbcHcRCmriTr7KK9e6kOChU7hyTCBDmtGxNN5TgMoAf27pSMrFN1HvK0ohQzGXvqKLAepTXW2ew+Abno3OgKRwUMpQJVlq+ZUCuqKODYI9nRE10XV6ORAejgE5mDYNn3BbvcI07Cjmqgm7bJzi5Hv0wzscPuJxQjz4vrJ+5ne65TYOzFPNkIFKeRETP+Shd9Gkw2/w9sbzQ2hzTH/02sUrsxolXD2wexfxgVz07rTe7qgbqKruCBOPtbcnGMAbs3e5NB7V6H3HnkTRtHQ4BosUMnE=

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 07 23:55:41 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 07 Oct 2011 23:55:41 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RCQov-0003ll-6n; Fri, 07 Oct 2011 23:55:41 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RCQoT-0003ZC-Bf
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 23:55:13 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1318056887!52298208!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9858 invoked from network); 8 Oct 2011 06:54:47 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-6.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Oct 2011 06:54:47 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RCQoQ-0005Un-2O
	for xen-changelog@lists.xensource.com; Sat, 08 Oct 2011 07:55:10 +0100
Message-Id: <E1RCQoQ-0005Un-2O@xenbits.xen.org>
Date: Sat, 08 Oct 2011 07:55:08 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/check: update python version
	check
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 Olaf Hering <olaf@aepfle.de>
# Date 1317994356 -3600
# Node ID b45b400d11d3f845adb94af3b59e33ee1770b317
# Parent  eb8637351535e9c76779d6dd78a1d5b4a434c082
tools/check: update python version check

Python 2.3 is the minimal version according to the README.
Adjust check script.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r eb8637351535 -r b45b400d11d3 tools/check/check_python
--- a/tools/check/check_python	Fri Oct 07 10:47:04 2011 +0100
+++ b/tools/check/check_python	Fri Oct 07 14:32:36 2011 +0100
@@ -9,5 +9,5 @@
 
 ${PYTHON} -c '
 import sys
-sys.exit(sys.version_info[0] < 2 or sys.version_info[1] < 2)
-' || fail "need python version >= 2.2"
+sys.exit(sys.version_info[0] < 2 or sys.version_info[1] < 3)
+' || fail "need python version >= 2.3"

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 07 23:55:47 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 07 Oct 2011 23:55:47 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RCQp1-0003oU-D0; Fri, 07 Oct 2011 23:55:47 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RCQoT-0003ZL-QM
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 23:55:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-21.messagelabs.com!1318056878!57946282!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9781 invoked from network); 8 Oct 2011 06:54:38 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-7.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Oct 2011 06:54:38 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RCQoQ-0005V2-KC
	for xen-changelog@lists.xensource.com; Sat, 08 Oct 2011 07:55:10 +0100
Message-Id: <E1RCQoQ-0005V2-KC@xenbits.xen.org>
Date: Sat, 08 Oct 2011 07:55:10 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/check: remove check_logging
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 Olaf Hering <olaf@aepfle.de>
# Date 1317994395 -3600
# Node ID eec5d0b44f76ebe748a6279f5c847d719bdc72e6
# Parent  b45b400d11d3f845adb94af3b59e33ee1770b317
tools/check: remove check_logging

Remove tools/check/check_logging.  Python 2.3 is the minimal required
python version so the checked function is available anyway.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r b45b400d11d3 -r eec5d0b44f76 tools/check/check_logging
--- a/tools/check/check_logging	Fri Oct 07 14:32:36 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-#!/usr/bin/env python
-#  -*- mode: python; -*-
-
-import os
-import sys
-
-def hline():
-    print >>sys.stderr, "*" * 70
-
-def msg(message):
-    print >>sys.stderr, "*" * 3, message
-
-def check_logging():
-    """Check python logging is installed and raise an error if not.
-    Logging is standard from Python 2.3 on.
-    """
-    try:
-        import logging
-    except ImportError:
-        hline()
-        msg("")
-        msg("  *** Python logging is not installed.")
-        msg("  *** Use 'make install-logging' at the xen root to install.")
-        msg("  *** ")
-        msg("  *** Alternatively download and install from")
-        msg("  *** http://www.red-dove.com/python_logging.html")
-        hline()
-        sys.exit(1)
-
-if __name__ == '__main__':
-    check_logging()

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 07 23:55:54 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 07 Oct 2011 23:55:54 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RCQp7-0003rZ-S9; Fri, 07 Oct 2011 23:55:53 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RCQoU-0003ZW-65
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 23:55:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-21.messagelabs.com!1318056902!62675980!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1861 invoked from network); 8 Oct 2011 06:55:02 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Oct 2011 06:55:02 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RCQoR-0005VH-3l
	for xen-changelog@lists.xensource.com; Sat, 08 Oct 2011 07:55:11 +0100
Message-Id: <E1RCQoR-0005VH-3l@xenbits.xen.org>
Date: Sat, 08 Oct 2011 07:55:10 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] VT-d: don't reject possibly valid
	DRHD or RMRR
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 Jan Beulich <jbeulich@suse.com>
# Date 1318002650 -7200
# Node ID 6a9466e1753df115a91d32214af124f04a99cfdd
# Parent  eec5d0b44f76ebe748a6279f5c847d719bdc72e6
VT-d: don't reject possibly valid DRHD or RMRR

If a non-zero PCI segment isn't accessible during Xen boot (because
firmware decided to not enter the necessary MMIO space into the E820
table), devices referred to on those segments through DRHD or RMRR
structures should not be rejected just because the devices can't be
found.

This is in line with what is being done in at least one other case
already: Systems with more than one PCI segment (usually high end
ones) are assumed to have valid firmware provided data, while systems
with just segment 0 continue to have their firmware tables validated.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: "Kay, Allen M" <allen.m.kay@intel.com>
---


diff -r eec5d0b44f76 -r 6a9466e1753d xen/drivers/passthrough/pci.c
--- a/xen/drivers/passthrough/pci.c	Fri Oct 07 14:33:15 2011 +0100
+++ b/xen/drivers/passthrough/pci.c	Fri Oct 07 17:50:50 2011 +0200
@@ -53,6 +53,11 @@
     return radix_tree_lookup(&pci_segments, seg);
 }
 
+bool_t pci_known_segment(u16 seg)
+{
+    return get_pseg(seg) != NULL;
+}
+
 static struct pci_seg *alloc_pseg(u16 seg)
 {
     struct pci_seg *pseg = get_pseg(seg);
diff -r eec5d0b44f76 -r 6a9466e1753d xen/drivers/passthrough/vtd/dmar.c
--- a/xen/drivers/passthrough/vtd/dmar.c	Fri Oct 07 14:33:15 2011 +0100
+++ b/xen/drivers/passthrough/vtd/dmar.c	Fri Oct 07 17:50:50 2011 +0200
@@ -442,10 +442,14 @@
     else
     {
         u8 b, d, f;
-        int i, invalid_cnt = 0;
+        unsigned int i = 0, invalid_cnt = 0;
         void *p;
 
-        for ( i = 0, p = dev_scope_start; i < dmaru->scope.devices_cnt;
+        /* Skip checking if segment is not accessible yet. */
+        if ( !pci_known_segment(drhd->segment) )
+            i = UINT_MAX;
+
+        for ( p = dev_scope_start; i < dmaru->scope.devices_cnt;
               i++, p += ((struct acpi_dev_scope *)p)->length )
         {
             if ( ((struct acpi_dev_scope *)p)->dev_type == ACPI_DEV_IOAPIC ||
@@ -546,7 +550,12 @@
     else
     {
         u8 b, d, f;
-        int i, ignore = 0;
+        bool_t ignore = 0;
+        unsigned int i = 0;
+
+        /* Skip checking if segment is not accessible yet. */
+        if ( !pci_known_segment(rmrr->segment) )
+            i = UINT_MAX;
 
         for ( i = 0; i < rmrru->scope.devices_cnt; i++ )
         {
diff -r eec5d0b44f76 -r 6a9466e1753d xen/include/xen/pci.h
--- a/xen/include/xen/pci.h	Fri Oct 07 14:33:15 2011 +0100
+++ b/xen/include/xen/pci.h	Fri Oct 07 17:50:50 2011 +0200
@@ -82,6 +82,7 @@
     DEV_TYPE_PCI,
 };
 
+bool_t pci_known_segment(u16 seg);
 int pci_device_detect(u16 seg, u8 bus, u8 dev, u8 func);
 int scan_pci_devices(void);
 int pdev_type(u16 seg, u8 bus, u8 devfn);

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 07 23:56:00 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 07 Oct 2011 23:56:00 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RCQpE-0003un-FW; Fri, 07 Oct 2011 23:56:00 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RCQok-0003ge-Gu
	for xen-changelog@lists.xensource.com; Fri, 07 Oct 2011 23:55:31 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-174.messagelabs.com!1318056911!34423218!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20440 invoked from network); 8 Oct 2011 06:55:27 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Oct 2011 06:55:27 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RCQoR-0005VW-JX
	for xen-changelog@lists.xensource.com; Sat, 08 Oct 2011 07:55:11 +0100
Message-Id: <E1RCQoR-0005VW-JX@xenbits.xen.org>
Date: Sat, 08 Oct 2011 07:55:11 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Adjust 23931:6a9466e1753d.
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 Jan Beulich <jbeulich@suse.com>
# Date 1318003027 -7200
# Node ID 0c2bfd1f9c6822fbd23af0043f83d93be976323c
# Parent  6a9466e1753df115a91d32214af124f04a99cfdd
Adjust 23931:6a9466e1753d.

Committed a stale patch - this was missing from what was actually acked.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 6a9466e1753d -r 0c2bfd1f9c68 xen/drivers/passthrough/vtd/dmar.c
--- a/xen/drivers/passthrough/vtd/dmar.c	Fri Oct 07 17:50:50 2011 +0200
+++ b/xen/drivers/passthrough/vtd/dmar.c	Fri Oct 07 17:57:07 2011 +0200
@@ -557,7 +557,7 @@
         if ( !pci_known_segment(rmrr->segment) )
             i = UINT_MAX;
 
-        for ( i = 0; i < rmrru->scope.devices_cnt; i++ )
+        for ( ; i < rmrru->scope.devices_cnt; i++ )
         {
             b = PCI_BUS(rmrru->scope.devices[i]);
             d = PCI_SLOT(rmrru->scope.devices[i]);

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

From xen-changelog-bounces@lists.xensource.com Sat Oct 08 03:22:52 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Sat, 08 Oct 2011 03:22:52 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RCU3Q-0001uN-Kl; Sat, 08 Oct 2011 03:22:52 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RCU2o-0001kt-VI
	for xen-changelog@lists.xensource.com; Sat, 08 Oct 2011 03:22:16 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-174.messagelabs.com!1318069331!28101119!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10202 invoked from network); 8 Oct 2011 10:22:11 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Oct 2011 10:22:11 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RCU2l-0004Tk-FZ
	for xen-changelog@lists.xensource.com; Sat, 08 Oct 2011 11:22:11 +0100
Message-Id: <E1RCU2l-0004Tk-FZ@xenbits.xen.org>
Date: Sat, 08 Oct 2011 11:22:10 +0100
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] Added tag 4.0.3-rc3 for changeset
	fd7c4d4e52d9
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@xen.org>
# Date 1317998808 -3600
# Node ID b5d76f548ed1749aa2a8de56f636cfd2ca75ddb5
# Parent  fd7c4d4e52d9aa4ad228d73d068fa7db79a0c904
Added tag 4.0.3-rc3 for changeset fd7c4d4e52d9
---


diff -r fd7c4d4e52d9 -r b5d76f548ed1 .hgtags
--- a/.hgtags	Fri Oct 07 15:46:32 2011 +0100
+++ b/.hgtags	Fri Oct 07 15:46:48 2011 +0100
@@ -62,3 +62,4 @@
 e7ec1f3ebed8ddc28ec5e80ac520c8b9abdae132 RELEASE-4.0.2
 47f9c9648fe7b531e41575a2bf0b0234037985b4 4.0.3-rc1
 8d012bc20d3063d76b851d9909da6f9fa8ef469c 4.0.3-rc2
+fd7c4d4e52d9aa4ad228d73d068fa7db79a0c904 4.0.3-rc3

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

From xen-changelog-bounces@lists.xensource.com Sat Oct 08 03:23:07 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Sat, 08 Oct 2011 03:23:07 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RCU3e-0001yM-SZ; Sat, 08 Oct 2011 03:23:06 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RCU2o-0001kn-JH
	for xen-changelog@lists.xensource.com; Sat, 08 Oct 2011 03:22:16 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1318069313!45757933!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24916 invoked from network); 8 Oct 2011 10:21:53 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	8 Oct 2011 10:21:53 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RCU2k-0004SE-PU
	for xen-changelog@lists.xensource.com; Sat, 08 Oct 2011 11:22:10 +0100
Message-Id: <E1RCU2k-0004SE-PU@xenbits.xen.org>
Date: Sat, 08 Oct 2011 11:22:09 +0100
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] Update Xen version to 4.0.3-rc3
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@xen.org>
# Date 1317998792 -3600
# Node ID fd7c4d4e52d9aa4ad228d73d068fa7db79a0c904
# Parent  7707a2bf2a9319c88f273d9d6a2827c3d6de914e
Update Xen version to 4.0.3-rc3
---


diff -r 7707a2bf2a93 -r fd7c4d4e52d9 Config.mk
--- a/Config.mk	Mon Oct 03 16:36:09 2011 +0100
+++ b/Config.mk	Fri Oct 07 15:46:32 2011 +0100
@@ -178,7 +178,7 @@
 # CONFIG_QEMU ?= ../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG := xen-4.0.3-rc1
+QEMU_TAG := xen-4.0.3-rc3
 #QEMU_TAG ?= 6d5b7ee3acfe8cc10681d2583a38398f7470ec2a
 # Wed Jan 5 23:42:03 2011 +0000
 # Change tap device mac address to prevent change of bridge's mac
diff -r 7707a2bf2a93 -r fd7c4d4e52d9 xen/Makefile
--- a/xen/Makefile	Mon Oct 03 16:36:09 2011 +0100
+++ b/xen/Makefile	Fri Oct 07 15:46:32 2011 +0100
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 0
-export XEN_EXTRAVERSION ?= .3-rc3-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .3-rc3$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 

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

From xen-changelog-bounces@lists.xensource.com Sat Oct 08 03:27:26 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Sat, 08 Oct 2011 03:27:26 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RCU7o-00025n-VY; Sat, 08 Oct 2011 03:27:24 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with smtp (Exim 4.43) id 1RCU7i-000254-Lj
	for xen-changelog@lists.xensource.com; Sat, 08 Oct 2011 03:27:20 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-174.messagelabs.com!1318069635!30754154!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3997 invoked from network); 8 Oct 2011 10:27:15 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-174.messagelabs.com with SMTP;
	8 Oct 2011 10:27:15 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RCU2m-0004Uf-5W
	for xen-changelog@lists.xensource.com; Sat, 08 Oct 2011 11:22:12 +0100
Message-Id: <E1RCU2m-0004Uf-5W@xenbits.xen.org>
Date: Sat, 08 Oct 2011 11:22:11 +0100
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] Added signature for changeset
	fd7c4d4e52d9
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@xen.org>
# Date 1317998817 -3600
# Node ID f051e9973b792ba26e3ba83a025e29d1982eeaf7
# Parent  b5d76f548ed1749aa2a8de56f636cfd2ca75ddb5
Added signature for changeset fd7c4d4e52d9
---


diff -r b5d76f548ed1 -r f051e9973b79 .hgsigs
--- a/.hgsigs	Fri Oct 07 15:46:48 2011 +0100
+++ b/.hgsigs	Fri Oct 07 15:46:57 2011 +0100
@@ -15,3 +15,4 @@
 e7ec1f3ebed8ddc28ec5e80ac520c8b9abdae132 0 iQEcBAABAgAGBQJN91w/AAoJEIP+FMlX6CvZygEH/R2nEvUKTT1c9TAWZsw8H3twG8o3Ka7w6M9QP3kGLQllIxkpPh5mWZoQaBVWx5JO5KlxRO55PlGKLukSks21M6gi8qCMwUaO/EZjpP2ciYIRxoovyfxp0rNID31mxWJBela4aVNy9LZ+klFKyV16wycBLQTNxfp29ZGtE2/ex7XMv4LWihAOqUqRXo35SKZuolbCYY0qmBXcvjD8iwgkucFLFPVDOq2YmW47flQREF2IOKzeHBwfDoB4nNVJW8MA5snJ7Wg+IJlvnRFF4Ks/Y784Nhkbw0mfYVNij0eovbI9Tfs1FXcz/YlZXFdsadV9N+c1ABJsBBX3ZNbvEKl4bJ8=
 47f9c9648fe7b531e41575a2bf0b0234037985b4 0 iQEcBAABAgAGBQJOViZ/AAoJEIP+FMlX6CvZovAH/2C6X/PU9h9Q8Way8NTGmZsJroS0OlPpiYoBQ/BAgha0NxO6pKiuCcuGwApcvMnDTly3UyJzrh5uf5E2Qfl5N3Zwg0fRNvpzArN8JjTZQI3yr0iDc1FioVRpllPQCKVrFkB5UUuAkXRlOJLkPc78PNaWdYvEl9lPQdyXwg1GwGsSjomH4HI4UmB1uWsx0TgNaywN1l7FZ77Ny1u7VVOczSSBFlhI1shXqCXgbMRW2pxMCNkiV6kozYuHKFzwK/ZAFSrw1d9bgVjTsSrjkAuaMTnSIFoVSpOsv0zJZnIlhKe0ChpbU90OcM2Pol3CoJIdvHZOL2Gi2T04Js+iKW25nV8=
 8d012bc20d3063d76b851d9909da6f9fa8ef469c 0 iQEcBAABAgAGBQJOZzxcAAoJEIP+FMlX6CvZtR4H+wS6lQUaNK71V/mXuiPz4Y30pKv3w419IfW9ICA6unfxm+IkCbR4QEtO/6aZkU7Q1ZYSDfIyzA60E/rHcU5ZJ27lCvaedrYa4A8W9Ry7+e31MYvG+fvZAO2ZIPRks+HAg79joU10xUKQirTQi436viBL5NrN1R12Y5B75ue6YHhkuhI0XUv9l5MbO4utsTki3YqKTmsZbPCvzymZr0dXG8t7U7AWxbXTfzyKxsoCg7HdYzEPufhIe903xEhQaiSXSSUz78wUCN4KxXGubejEu2/09L4SRzoxV6Mw1K39EqtrisZVazsuy+aEobK5B9U/JGzjGK/CNlw+LobkW2qvMrE=
+fd7c4d4e52d9aa4ad228d73d068fa7db79a0c904 0 iQEcBAABAgAGBQJOjxDgAAoJEIP+FMlX6CvZbugIAJhthGHfoc7ln0WHj6ZAA2UVPo77l/VdceYohgCnWqgj16SyxkMgSUoieBhO1Fb/+9QzyXbV+ZAkJFCbp0lZ3bg62ZRpRjO38443D1aczabFno1GI22rUiwOkT1v6nvEQbHyc2L6lpzhDvv2h9Mv73tmti/XfM7uzfQD9Ea40BOGZ7PPOLifMnOo2FKepDyRNlo0thrz7kMpri0V9wm7Bx0Rx0SovMA3z9gtCeTYj8HgJ3niBibTe57AjCMwQCODRpAAhKdzGJ7GBxJ93q7WeJoNNxmQzYqFbUI3P3Jo/fF4APsxtnO6dC0Qt0IWVu0w6NCmfasnS9Vc/yifq7fDvLg=

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 10 05:56:24 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 10 Oct 2011 05:56:24 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RDFP5-0008OJ-QP; Mon, 10 Oct 2011 05:56:23 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RDFNr-00084h-5B
	for xen-changelog@lists.xensource.com; Mon, 10 Oct 2011 05:55:07 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-21.messagelabs.com!1318251267!51447901!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19416 invoked from network); 10 Oct 2011 12:54:27 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	10 Oct 2011 12:54:27 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RDFNn-0006Iz-Kx
	for xen-changelog@lists.xensource.com; Mon, 10 Oct 2011 13:55:03 +0100
Message-Id: <E1RDFNn-0006Iz-Kx@xenbits.xen.org>
Date: Mon, 10 Oct 2011 13:55:02 +0100
From: Xen patchbot-linux-2.6.18-xen <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [linux-2.6.18-xen] MSI-X: Avoid unconditional BUG()
	in DomU
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 Jan Beulich <jbeulich@suse.com>
# Date 1318250600 -7200
# Node ID 28740a325058c0c196ef22f59506710dc4ff4c55
# Parent  40e33b2fce948cbdcc0ec27404b58b1acc9b7fc8
MSI-X: Avoid unconditional BUG() in DomU

msi_remove_pci_irq_vectors() unconditionally (i.e. even in a DomU)
calling msi_unmap_pirq() is guaranteed to BUG() in msi_get_dev_owner().
Adjust the function to call evtchn_map_pirq() instead in a DomU (just
like pci_disable_msix() is doing).

While looking into this I also realized that the
CONFIG_XEN_PCIDEV_FRONTEND conditionals are misplaced - since on x86-64
it is possible to build with this disabled, execution would flow into
Dom0 code even on a DomU in this case. Hence adjust their placement at
once.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 40e33b2fce94 -r 28740a325058 drivers/pci/msi-xen.c
--- a/drivers/pci/msi-xen.c	Thu Oct 06 11:24:48 2011 +0200
+++ b/drivers/pci/msi-xen.c	Mon Oct 10 14:43:20 2011 +0200
@@ -625,9 +625,8 @@
 	if (status < 0)
 		return status;
 
+	if (!is_initial_xendomain()) {
 #ifdef CONFIG_XEN_PCIDEV_FRONTEND
-	if (!is_initial_xendomain())
-	{
 		int ret;
 
 		temp = dev->irq;
@@ -640,8 +639,10 @@
 		msi_dev_entry->default_irq = temp;
 
 		return ret;
+#else
+		return -EOPNOTSUPP;
+#endif
 	}
-#endif
 
 	temp = dev->irq;
 
@@ -679,8 +680,8 @@
 	if (!dev)
 		return;
 
+	if (!is_initial_xendomain()) {
 #ifdef CONFIG_XEN_PCIDEV_FRONTEND
-	if (!is_initial_xendomain()) {
 		if (!(dev->msi_enabled)) {
 			printk(KERN_INFO "PCI: %s: Device did not enabled MSI.\n",
 			       pci_name(dev));
@@ -690,9 +691,9 @@
 		pci_frontend_disable_msi(dev);
 		dev->irq = msi_dev_entry->default_irq;
 		dev->msi_enabled = 0;
+#endif
 		return;
 	}
-#endif
 
 	pos = pci_find_capability(dev, PCI_CAP_ID_MSI);
 	if (!pos)
@@ -748,8 +749,8 @@
 		if (bus->bus_flags & PCI_BUS_FLAGS_NO_MSI)
 			return -EINVAL;
 
+	if (!is_initial_xendomain()) {
 #ifdef CONFIG_XEN_PCIDEV_FRONTEND
-	if (!is_initial_xendomain()) {
 		struct msi_pirq_entry *pirq_entry;
 		int ret, irq;
 
@@ -780,9 +781,11 @@
 			attach_pirq_entry(irq, entries[i].entry, msi_dev_entry);
 			entries[i].vector = irq;
 		}
-        return 0;
+		return 0;
+#else
+		return -EOPNOTSUPP;
+#endif
 	}
-#endif
 
 	status = msi_init();
 	if (status < 0)
@@ -843,8 +846,8 @@
 		return;
 	}
 
+	if (!is_initial_xendomain()) {
 #ifdef CONFIG_XEN_PCIDEV_FRONTEND
-	if (!is_initial_xendomain()) {
 		struct msi_dev_list *msi_dev_entry;
 		struct msi_pirq_entry *pirq_entry, *tmp;
 
@@ -860,9 +863,9 @@
 
 		dev->irq = msi_dev_entry->default_irq;
 		dev->msix_enabled = 0;
+#endif
 		return;
 	}
-#endif
 
 	pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
 	if (!pos)
@@ -902,7 +905,10 @@
 	if (!list_empty(&msi_dev_entry->pirq_list_head))
 		list_for_each_entry_safe(pirq_entry, tmp,
 		                         &msi_dev_entry->pirq_list_head, list) {
-			msi_unmap_pirq(dev, pirq_entry->pirq);
+			if (is_initial_xendomain())
+				msi_unmap_pirq(dev, pirq_entry->pirq);
+			else
+				evtchn_map_pirq(pirq_entry->pirq, 0);
 			list_del(&pirq_entry->list);
 			kfree(pirq_entry);
 		}

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 10 07:11:21 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 10 Oct 2011 07:11:21 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RDGZd-00087b-8M; Mon, 10 Oct 2011 07:11:21 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RDGZV-00086b-V3
	for xen-changelog@lists.xensource.com; Mon, 10 Oct 2011 07:11:15 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-27.messagelabs.com!1318255856!43610360!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24489 invoked from network); 10 Oct 2011 14:10:56 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	10 Oct 2011 14:10:56 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RDGZS-0007d0-Qj
	for xen-changelog@lists.xensource.com; Mon, 10 Oct 2011 15:11:10 +0100
Message-Id: <E1RDGZS-0007d0-Qj@xenbits.xen.org>
Date: Mon, 10 Oct 2011 15:11:10 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/AMD: Remove AMD_ERRATUM_400
	definition
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 Boris Ostrovsky <boris.ostrovsky@amd.com>
# Date 1318234157 -7200
# Node ID 1d6fab0446bf3ae29bb6fb188f9083edf706b2bb
# Parent  0b81515b8e982e8012c28e5f8d9e965c63b6503d
x86/AMD: Remove AMD_ERRATUM_400 definition

AMD_ERRATUM_400 was used to determine whether the processor supports
Always Running APIC Counter (ARAT) feature in init_amd(). Now that
ARAT support is based solely on family number this macro is no longer
needed.

Keep it in comments section as an example in case we ever need to use
it for somethnig else.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@amd.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 0b81515b8e98 -r 1d6fab0446bf xen/include/asm-x86/amd.h
--- a/xen/include/asm-x86/amd.h	Mon Oct 10 09:21:32 2011 +0200
+++ b/xen/include/asm-x86/amd.h	Mon Oct 10 10:09:17 2011 +0200
@@ -134,10 +134,6 @@
     AMD_OSVW_ERRATUM(3, AMD_MODEL_RANGE(0x10, 0x2, 0x1, 0xff, 0xf),	\
 		        AMD_MODEL_RANGE(0x12, 0x0, 0x0, 0x1, 0x0))
 
-#define AMD_ERRATUM_400                                                 \
-    AMD_OSVW_ERRATUM(1, AMD_MODEL_RANGE(0xf, 0x41, 0x2, 0xff, 0xf),     \
-                        AMD_MODEL_RANGE(0x10, 0x2, 0x1, 0xff, 0xf))
-
 struct cpuinfo_x86;
 int cpu_has_amd_erratum(const struct cpuinfo_x86 *, int, ...);
 

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 10 07:11:33 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 10 Oct 2011 07:11:33 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RDGZp-0008AT-F8; Mon, 10 Oct 2011 07:11:33 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RDGZW-00086a-01
	for xen-changelog@lists.xensource.com; Mon, 10 Oct 2011 07:11:16 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1318255870!34686069!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1880 invoked from network); 10 Oct 2011 14:11:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	10 Oct 2011 14:11:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RDGZS-0007cl-9V
	for xen-changelog@lists.xensource.com; Mon, 10 Oct 2011 15:11:10 +0100
Message-Id: <E1RDGZS-0007cl-9V@xenbits.xen.org>
Date: Mon, 10 Oct 2011 15:11:09 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] passthrough: update bus2bridge
	mapping as PCI devices get added/removed
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 Jan Beulich <jbeulich@suse.com>
# Date 1318231292 -7200
# Node ID 0b81515b8e982e8012c28e5f8d9e965c63b6503d
# Parent  0c2bfd1f9c6822fbd23af0043f83d93be976323c
passthrough: update bus2bridge mapping as PCI devices get added/removed

This deals with two limitations at once: On device removal, the
mapping did not get updated so far at all, and hotplugged devices as
well as such not discoverable by Xen's initial bus scan (including the
case where a non-zero PCI segment wasn't accessible during Xen boot,
but became accessible after Dom0 validated access information against
ACPI data) wouldn't cause updates to the mapping either.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: "Kay, Allen M" <allen.m.kay@intel.com>
---


diff -r 0c2bfd1f9c68 -r 0b81515b8e98 xen/drivers/passthrough/pci.c
--- a/xen/drivers/passthrough/pci.c	Fri Oct 07 17:57:07 2011 +0200
+++ b/xen/drivers/passthrough/pci.c	Mon Oct 10 09:21:32 2011 +0200
@@ -132,11 +132,67 @@
     list_add(&pdev->alldevs_list, &pseg->alldevs_list);
     spin_lock_init(&pdev->msix_table_lock);
 
+    /* update bus2bridge */
+    switch ( pdev_type(pseg->nr, bus, devfn) )
+    {
+        u8 sec_bus, sub_bus;
+
+        case DEV_TYPE_PCIe_BRIDGE:
+            break;
+
+        case DEV_TYPE_PCIe2PCI_BRIDGE:
+        case DEV_TYPE_LEGACY_PCI_BRIDGE:
+            sec_bus = pci_conf_read8(pseg->nr, bus, PCI_SLOT(devfn),
+                                     PCI_FUNC(devfn), PCI_SECONDARY_BUS);
+            sub_bus = pci_conf_read8(pseg->nr, bus, PCI_SLOT(devfn),
+                                     PCI_FUNC(devfn), PCI_SUBORDINATE_BUS);
+
+            spin_lock(&pseg->bus2bridge_lock);
+            for ( ; sec_bus <= sub_bus; sec_bus++ )
+            {
+                pseg->bus2bridge[sec_bus].map = 1;
+                pseg->bus2bridge[sec_bus].bus = bus;
+                pseg->bus2bridge[sec_bus].devfn = devfn;
+            }
+            spin_unlock(&pseg->bus2bridge_lock);
+            break;
+
+        case DEV_TYPE_PCIe_ENDPOINT:
+        case DEV_TYPE_PCI:
+            break;
+
+        default:
+            printk(XENLOG_WARNING "%s: unknown type: %04x:%02x:%02x.%u\n",
+                   __func__, pseg->nr, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+            break;
+    }
+
     return pdev;
 }
 
-static void free_pdev(struct pci_dev *pdev)
+static void free_pdev(struct pci_seg *pseg, struct pci_dev *pdev)
 {
+    /* update bus2bridge */
+    switch ( pdev_type(pseg->nr, pdev->bus, pdev->devfn) )
+    {
+        u8 dev, func, sec_bus, sub_bus;
+
+        case DEV_TYPE_PCIe2PCI_BRIDGE:
+        case DEV_TYPE_LEGACY_PCI_BRIDGE:
+            dev = PCI_SLOT(pdev->devfn);
+            func = PCI_FUNC(pdev->devfn);
+            sec_bus = pci_conf_read8(pseg->nr, pdev->bus, dev, func,
+                                     PCI_SECONDARY_BUS);
+            sub_bus = pci_conf_read8(pseg->nr, pdev->bus, dev, func,
+                                     PCI_SUBORDINATE_BUS);
+
+            spin_lock(&pseg->bus2bridge_lock);
+            for ( ; sec_bus <= sub_bus; sec_bus++ )
+                pseg->bus2bridge[sec_bus] = pseg->bus2bridge[pdev->bus];
+            spin_unlock(&pseg->bus2bridge_lock);
+            break;
+    }
+
     list_del(&pdev->alldevs_list);
     xfree(pdev);
 }
@@ -380,7 +436,7 @@
             if ( pdev->domain )
                 list_del(&pdev->domain_list);
             pci_cleanup_msi(pdev);
-            free_pdev(pdev);
+            free_pdev(pseg, pdev);
             printk(XENLOG_DEBUG "PCI remove device %04x:%02x:%02x.%u\n",
                    seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
             break;
@@ -548,8 +604,6 @@
 {
     struct pci_dev *pdev;
     int bus, dev, func;
-    u8 sec_bus, sub_bus;
-    int type;
 
     for ( bus = 0; bus < 256; bus++ )
     {
@@ -567,41 +621,6 @@
                     return -ENOMEM;
                 }
 
-                /* build bus2bridge */
-                type = pdev_type(pseg->nr, bus, PCI_DEVFN(dev, func));
-                switch ( type )
-                {
-                    case DEV_TYPE_PCIe_BRIDGE:
-                        break;
-
-                    case DEV_TYPE_PCIe2PCI_BRIDGE:
-                    case DEV_TYPE_LEGACY_PCI_BRIDGE:
-                        sec_bus = pci_conf_read8(pseg->nr, bus, dev, func,
-                                                 PCI_SECONDARY_BUS);
-                        sub_bus = pci_conf_read8(pseg->nr, bus, dev, func,
-                                                 PCI_SUBORDINATE_BUS);
-
-                        spin_lock(&pseg->bus2bridge_lock);
-                        for ( sub_bus &= 0xff; sec_bus <= sub_bus; sec_bus++ )
-                        {
-                            pseg->bus2bridge[sec_bus].map = 1;
-                            pseg->bus2bridge[sec_bus].bus = bus;
-                            pseg->bus2bridge[sec_bus].devfn =
-                                PCI_DEVFN(dev, func);
-                        }
-                        spin_unlock(&pseg->bus2bridge_lock);
-                        break;
-
-                    case DEV_TYPE_PCIe_ENDPOINT:
-                    case DEV_TYPE_PCI:
-                        break;
-
-                    default:
-                        printk("%s: unknown type: %04x:%02x:%02x.%u\n",
-                               __func__, pseg->nr, bus, dev, func);
-                        return -EINVAL;
-                }
-
                 if ( !func && !(pci_conf_read8(pseg->nr, bus, dev, func,
                                                PCI_HEADER_TYPE) & 0x80) )
                     break;

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 10 07:11:41 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 10 Oct 2011 07:11:41 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RDGZx-0008DX-HK; Mon, 10 Oct 2011 07:11:41 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RDGZW-00086d-O1
	for xen-changelog@lists.xensource.com; Mon, 10 Oct 2011 07:11:16 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-174.messagelabs.com!1318255871!30972008!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26308 invoked from network); 10 Oct 2011 14:11:11 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	10 Oct 2011 14:11:11 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RDGZT-0007dF-Au
	for xen-changelog@lists.xensource.com; Mon, 10 Oct 2011 15:11:11 +0100
Message-Id: <E1RDGZT-0007dF-Au@xenbits.xen.org>
Date: Mon, 10 Oct 2011 15:11:10 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: correctly parse disk
	"backendtype" field
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 Daniel De Graaf <dgdegra@tycho.nsa.gov>
# Date 1318242111 -3600
# Node ID 72f339bc600d7a9629d3f9eb8a279fbf8be25b12
# Parent  1d6fab0446bf3ae29bb6fb188f9083edf706b2bb
libxl: correctly parse disk "backendtype" field

The expression for backendtype was missing a comma.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 1d6fab0446bf -r 72f339bc600d tools/libxl/libxlu_disk_l.c
--- a/tools/libxl/libxlu_disk_l.c	Mon Oct 10 10:09:17 2011 +0200
+++ b/tools/libxl/libxlu_disk_l.c	Mon Oct 10 11:21:51 2011 +0100
@@ -366,7 +366,7 @@
 	flex_int32_t yy_verify;
 	flex_int32_t yy_nxt;
 	};
-static yyconst flex_int16_t yy_acclist[453] =
+static yyconst flex_int16_t yy_acclist[456] =
     {   0,
        24,   24,   26,   22,   23,   25, 8193,   22,   23,   25,
     16385, 8193,   22,   25,16385,   22,   23,   25,   23,   25,
@@ -416,11 +416,11 @@
        15, 8213,   22,   15,   22,   15, 8213,   11,   12,   22,
         6,    6,   12,    6,    6,   15, 8213,   22,   15, 8213,
        22,   15, 8213,   15,   22,   15,   22,    6,    6,    8,
-        6,    5,    6,    8,   12,    4,    6,    5,    6,    8,
-        4,    6
+        6,    5,    6,    8,   12,    8,    4,    6,    5,    6,
+        8,    8,   12,    4,    6
     } ;
 
-static yyconst flex_int16_t yy_accept[255] =
+static yyconst flex_int16_t yy_accept[257] =
     {   0,
         1,    1,    1,    2,    3,    4,    7,   12,   16,   19,
        21,   24,   27,   30,   33,   36,   39,   42,   45,   48,
@@ -448,8 +448,8 @@
       380,  381,  385,  387,  388,  389,  391,  392,  394,  395,
       397,  399,  400,  402,  405,  406,  408,  411,  414,  416,
       418,  420,  421,  422,  424,  425,  426,  429,  432,  434,
-      436,  437,  438,  439,  440,  441,  442,  444,  446,  448,
-      450,  451,  453,  453
+      436,  437,  438,  439,  440,  441,  442,  444,  446,  447,
+      449,  451,  452,  454,  456,  456
     } ;
 
 static yyconst flex_int32_t yy_ec[256] =
@@ -492,80 +492,82 @@
         1,    1,    1
     } ;
 
-static yyconst flex_int16_t yy_base[311] =
+static yyconst flex_int16_t yy_base[313] =
     {   0,
-        0,    0,  560,  556,  555,  539,   32,   35,  662,  662,
-       44,   62,   30,   40,   32,   50,  525,   49,   47,   59,
-       68,  517,   69,  509,   72,    0,  662,  507,  662,   83,
-       91,    0,    0,  100,  489,  109,    0,   78,   51,   86,
+        0,    0,  572,  560,  559,  551,   32,   35,  662,  662,
+       44,   62,   30,   40,   32,   50,  533,   49,   47,   59,
+       68,  525,   69,  517,   72,    0,  662,  515,  662,   83,
+       91,    0,    0,  100,  501,  109,    0,   78,   51,   86,
        89,   74,   96,  105,  109,  110,  111,  112,  117,   73,
       119,  118,  121,  120,  122,    0,  134,    0,    0,  138,
-        0,    0,  471,  130,  144,  129,  143,  145,  146,  147,
+        0,    0,  495,  130,  144,  129,  143,  145,  146,  147,
       148,  149,  153,  154,  155,  158,  161,  165,  166,  170,
       180,    0,    0,  662,  171,  201,  176,  175,  178,  183,
-      458,  182,  190,  446,  212,  188,  221,  208,  224,  234,
+      465,  182,  190,  455,  212,  188,  221,  208,  224,  234,
 
       209,  230,  236,  221,  244,    0,  247,    0,  184,  248,
       244,  269,  231,  247,  251,  258,  272,    0,  279,    0,
       283,    0,  286,    0,  255,  290,    0,  293,    0,  270,
-      281,  447,  254,  297,    0,    0,    0,    0,  294,  662,
+      281,  455,  254,  297,    0,    0,    0,    0,  294,  662,
       295,  308,    0,  310,    0,  257,  319,  328,  304,  331,
         0,    0,    0,    0,  335,    0,    0,    0,    0,  316,
-      338,    0,    0,    0,    0,  333,  336,  429,  662,  428,
-      338,  340,  348,    0,    0,    0,    0,  427,  351,    0,
-      355,    0,  359,    0,  362,    0,  357,  426,  308,  369,
-      425,  662,  423,  662,  346,  365,  421,  662,  371,    0,
+      338,    0,    0,    0,    0,  333,  336,  447,  662,  429,
+      338,  340,  348,    0,    0,    0,    0,  428,  351,    0,
+      355,    0,  359,    0,  362,    0,  357,  427,  308,  369,
+      426,  662,  425,  662,  346,  365,  423,  662,  371,    0,
 
-        0,    0,    0,  378,    0,    0,    0,    0,  380,  420,
-      662,  388,  419,    0,  418,  662,  373,  417,  662,  372,
-      382,  416,  662,  398,  415,  662,  400,    0,  402,    0,
-        0,  385,  264,  662,  390,  275,  409,    0,    0,    0,
-        0,  405,  404,  406,    0,  412,  224,  129,   87,  662,
-       47,  662,  662,  434,  438,  441,  445,  449,  453,  457,
-      461,  465,  469,  473,  477,  481,  485,  489,  493,  497,
-      501,  505,  509,  513,  517,  521,  525,  529,  533,  537,
-      541,  545,  549,  553,  557,  561,  565,  569,  573,  577,
-      581,  585,  589,  593,  597,  601,  605,  609,  613,  617,
+        0,    0,    0,  378,    0,    0,    0,    0,  380,  421,
+      662,  388,  420,    0,  419,  662,  373,  418,  662,  372,
+      382,  417,  662,  398,  416,  662,  400,    0,  402,    0,
+        0,  385,  415,  662,  390,  275,  409,    0,    0,    0,
+        0,  405,  404,  406,  264,  412,  224,  129,  662,   87,
+      662,   47,  662,  662,  662,  434,  438,  441,  445,  449,
+      453,  457,  461,  465,  469,  473,  477,  481,  485,  489,
+      493,  497,  501,  505,  509,  513,  517,  521,  525,  529,
+      533,  537,  541,  545,  549,  553,  557,  561,  565,  569,
+      573,  577,  581,  585,  589,  593,  597,  601,  605,  609,
 
-      621,  625,  629,  633,  637,  641,  645,  649,  653,  657
+      613,  617,  621,  625,  629,  633,  637,  641,  645,  649,
+      653,  657
     } ;
 
-static yyconst flex_int16_t yy_def[311] =
+static yyconst flex_int16_t yy_def[313] =
     {   0,
-      253,    1,  254,  254,  253,  255,  256,  256,  253,  253,
-      257,  257,   12,   12,   12,   12,   12,   12,   12,   12,
-       12,   12,   12,   12,   12,  258,  253,  255,  253,  259,
-      256,  260,  260,  261,   12,  255,  262,   12,   12,   12,
+      255,    1,  256,  256,  255,  257,  258,  258,  255,  255,
+      259,  259,   12,   12,   12,   12,   12,   12,   12,   12,
+       12,   12,   12,   12,   12,  260,  255,  257,  255,  261,
+      258,  262,  262,  263,   12,  257,  264,   12,   12,   12,
        12,   12,   12,   12,   12,   12,   12,   12,   12,   12,
-       12,   12,   12,   12,   12,  258,  259,  260,  260,  263,
-      264,  264,  253,   12,   12,   12,   12,   12,   12,   12,
+       12,   12,   12,   12,   12,  260,  261,  262,  262,  265,
+      266,  266,  255,   12,   12,   12,   12,   12,   12,   12,
        12,   12,   12,   12,   12,   12,   12,   12,   12,   12,
-      263,  264,  264,  253,   12,  265,   12,   12,   12,   12,
-       12,   12,   12,   36,  266,   12,  267,   12,   12,  268,
+      265,  266,  266,  255,   12,  267,   12,   12,   12,   12,
+       12,   12,   12,   36,  268,   12,  269,   12,   12,  270,
 
-       12,   12,   12,   12,  269,  270,  265,  270,   12,   12,
-       12,  271,   12,   12,   12,  255,  272,  273,  266,  273,
-      274,  275,  267,  275,   12,  276,  277,  268,  277,   12,
-       12,  278,   12,  269,  270,  270,  279,  279,   12,  253,
-       12,  280,  281,  271,  281,   12,  282,  283,  255,  272,
-      273,  273,  284,  284,  274,  275,  275,  285,  285,   12,
-      276,  277,  277,  286,  286,   12,   12,  287,  253,  288,
-       12,   12,  280,  281,  281,  289,  289,  290,  291,  292,
-      282,  292,  293,  294,  283,  294,  255,  295,   12,  296,
-      287,  253,  297,  253,   12,  298,  299,  253,  291,  292,
+       12,   12,   12,   12,  271,  272,  267,  272,   12,   12,
+       12,  273,   12,   12,   12,  257,  274,  275,  268,  275,
+      276,  277,  269,  277,   12,  278,  279,  270,  279,   12,
+       12,  280,   12,  271,  272,  272,  281,  281,   12,  255,
+       12,  282,  283,  273,  283,   12,  284,  285,  257,  274,
+      275,  275,  286,  286,  276,  277,  277,  287,  287,   12,
+      278,  279,  279,  288,  288,   12,   12,  289,  255,  290,
+       12,   12,  282,  283,  283,  291,  291,  292,  293,  294,
+      284,  294,  295,  296,  285,  296,  257,  297,   12,  298,
+      289,  255,  299,  255,   12,  300,  301,  255,  293,  294,
 
-      292,  300,  300,  293,  294,  294,  301,  301,  255,  302,
-      253,  303,  304,  304,  297,  253,   12,  305,  253,  305,
-      305,  299,  253,  283,  302,  253,  306,  307,  303,  307,
-      304,   12,  305,  253,  305,  305,  306,  307,  307,  308,
-      308,   12,  305,  305,  309,  305,  305,  310,  305,  253,
-      310,  253,    0,  253,  253,  253,  253,  253,  253,  253,
-      253,  253,  253,  253,  253,  253,  253,  253,  253,  253,
-      253,  253,  253,  253,  253,  253,  253,  253,  253,  253,
-      253,  253,  253,  253,  253,  253,  253,  253,  253,  253,
-      253,  253,  253,  253,  253,  253,  253,  253,  253,  253,
+      294,  302,  302,  295,  296,  296,  303,  303,  257,  304,
+      255,  305,  306,  306,  299,  255,   12,  307,  255,  307,
+      307,  301,  255,  285,  304,  255,  308,  309,  305,  309,
+      306,   12,  307,  255,  307,  307,  308,  309,  309,  310,
+      310,   12,  307,  307,  311,  307,  307,  312,  255,  307,
+      255,  312,  255,  255,    0,  255,  255,  255,  255,  255,
+      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,
+      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,
+      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,
+      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,
 
-      253,  253,  253,  253,  253,  253,  253,  253,  253,  253
+      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,
+      255,  255
     } ;
 
 static yyconst flex_int16_t yy_nxt[696] =
@@ -575,16 +577,16 @@
        17,   17,   19,   17,   20,   21,   22,   23,   24,   17,
        25,   17,   17,   31,   31,   32,   31,   31,   32,   35,
        33,   35,   41,   33,   28,   28,   28,   29,   34,   35,
-      253,   36,   37,   42,   43,   38,   35,   48,   35,   35,
+      249,   36,   37,   42,   43,   38,   35,   48,   35,   35,
        35,   39,   28,   28,   28,   29,   34,   44,   35,   36,
        37,   40,   46,   45,   65,   49,   47,   35,   35,   50,
        52,   35,   35,   35,   54,   28,   58,   35,   55,   64,
-      252,   59,   31,   31,   32,   35,   75,   66,   35,   33,
+      254,   59,   31,   31,   32,   35,   75,   66,   35,   33,
 
        28,   28,   28,   29,   68,   35,   48,   28,   37,   60,
        60,   60,   61,   60,   35,   67,   60,   62,   35,   35,
        35,   35,   72,   71,   73,   69,   35,   35,   35,   35,
-       35,   35,   84,   80,   76,   70,   28,   58,   35,   35,
+       35,   35,  253,   80,   76,   70,   28,   58,   35,   35,
        28,   82,   59,   85,   77,   78,   83,   79,   87,   74,
        76,   86,   35,   35,   35,   35,   35,   35,   35,   90,
        94,   95,   35,   35,   35,   97,   88,   35,   91,   92,
@@ -594,11 +596,11 @@
 
       103,  105,  105,   60,  106,  105,  139,  115,  105,  108,
       111,  114,  117,  117,   60,  118,  117,   35,   35,  117,
-      120,  121,  121,   60,  122,  121,  130,  250,  121,  124,
+      120,  121,  121,   60,  122,  121,  130,  251,  121,  124,
        35,  100,  125,   35,  126,  126,   60,  127,  126,   35,
        35,  126,  129,  131,  132,   35,   28,  135,  133,   28,
       137,  140,  136,   35,  147,  138,   35,   35,  148,  146,
-       35,   29,  170,   35,   35,  178,   35,  219,  141,  142,
+       35,   29,  170,   35,   35,  178,   35,  249,  141,  142,
       142,   60,  143,  142,   28,  151,  142,  145,  219,   35,
       152,   28,  153,  160,  149,   28,  156,  154,   28,  158,
        35,  157,   28,  162,  159,   28,  164,  166,  163,   28,
@@ -615,37 +617,37 @@
        60,  228,  227,  219,   35,  227,  230,  232,  242,  236,
 
        28,  207,   28,  238,   28,  240,  208,  219,  239,  219,
-      241,   28,  238,  245,   35,  219,  243,  239,  211,  198,
-      234,  194,  231,  226,  223,  247,  216,  246,  169,  211,
-      198,  194,  192,  249,   26,   26,   26,   26,   28,   28,
+      241,   28,  238,  245,   35,  219,  243,  239,  219,  211,
+      198,  234,  194,  231,  226,  247,  223,  246,  216,  169,
+      211,  198,  194,  250,   26,   26,   26,   26,   28,   28,
        28,   30,   30,   30,   30,   35,   35,   35,   35,   56,
-      169,   56,   56,   57,   57,   57,   57,   59,  116,   59,
-       59,   34,   34,   34,   34,   63,   63,  113,   63,   81,
-       81,   81,   81,   83,   84,   83,   83,  107,  107,  107,
+      192,   56,   56,   57,   57,   57,   57,   59,  169,   59,
+       59,   34,   34,   34,   34,   63,   63,  116,   63,   81,
+       81,   81,   81,   83,  113,   83,   83,  107,  107,  107,
       107,  119,  119,  119,  119,  123,  123,  123,  123,  128,
-      128,  128,  128,  134,  134,  134,  134,  136,   35,  136,
+      128,  128,  128,  134,  134,  134,  134,  136,   84,  136,
 
       136,  144,  144,  144,  144,  150,  150,  150,  150,  152,
-       29,  152,  152,  155,  155,  155,  155,  157,   53,  157,
-      157,  161,  161,  161,  161,  163,   51,  163,  163,  168,
-      168,  168,  168,  138,   35,  138,  138,  173,  173,  173,
-      173,  175,   29,  175,  175,  181,  181,  181,  181,  185,
-      185,  185,  185,  154,  253,  154,  154,  159,   27,  159,
+       35,  152,  152,  155,  155,  155,  155,  157,   29,  157,
+      157,  161,  161,  161,  161,  163,   53,  163,  163,  168,
+      168,  168,  168,  138,   51,  138,  138,  173,  173,  173,
+      173,  175,   35,  175,  175,  181,  181,  181,  181,  185,
+      185,  185,  185,  154,   29,  154,  154,  159,  255,  159,
       159,  165,   27,  165,  165,  191,  191,  191,  191,  193,
-      193,  193,  193,  177,  253,  177,  177,  197,  197,  197,
-      197,  199,  199,  199,  199,  201,  253,  201,  201,  204,
-      204,  204,  204,  206,  253,  206,  206,  210,  210,  210,
+      193,  193,  193,  177,   27,  177,  177,  197,  197,  197,
+      197,  199,  199,  199,  199,  201,  255,  201,  201,  204,
+      204,  204,  204,  206,  255,  206,  206,  210,  210,  210,
 
       210,  213,  213,  213,  213,  215,  215,  215,  215,  218,
-      218,  218,  218,  222,  222,  222,  222,  203,  253,  203,
-      203,  208,  253,  208,  208,  225,  225,  225,  225,  229,
-      229,  229,  229,  214,  253,  214,  214,  233,  233,  233,
-      233,  237,  237,  237,  237,  239,  253,  239,  239,  241,
-      253,  241,  241,  248,  248,  253,  248,  251,  251,  251,
-      251,    5,  253,  253,  253,  253,  253,  253,  253,  253,
-      253,  253,  253,  253,  253,  253,  253,  253,  253,  253,
-      253,  253,  253,  253,  253,  253,  253,  253,  253,  253,
-      253,  253,  253,  253,  253
+      218,  218,  218,  222,  222,  222,  222,  203,  255,  203,
+      203,  208,  255,  208,  208,  225,  225,  225,  225,  229,
+      229,  229,  229,  214,  255,  214,  214,  233,  233,  233,
+      233,  237,  237,  237,  237,  239,  255,  239,  239,  241,
+      255,  241,  241,  248,  248,  248,  248,  252,  252,  252,
+      252,    5,  255,  255,  255,  255,  255,  255,  255,  255,
+      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,
+      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,
+      255,  255,  255,  255,  255
 
     } ;
 
@@ -656,11 +658,11 @@
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    7,    7,    7,    8,    8,    8,   13,
         7,   15,   13,    8,   11,   11,   11,   11,   11,   14,
-      251,   11,   11,   14,   15,   11,   19,   19,   18,   16,
+      252,   11,   11,   14,   15,   11,   19,   19,   18,   16,
        39,   11,   12,   12,   12,   12,   12,   16,   20,   12,
        12,   12,   18,   16,   39,   20,   18,   21,   23,   21,
        23,   25,   50,   42,   25,   30,   30,   38,   25,   38,
-      249,   30,   31,   31,   31,   40,   50,   40,   41,   31,
+      250,   30,   31,   31,   31,   40,   50,   40,   41,   31,
 
        34,   34,   34,   34,   42,   43,   43,   34,   34,   36,
        36,   36,   36,   36,   44,   41,   36,   36,   45,   46,
@@ -679,7 +681,7 @@
       104,   99,   98,   99,  100,  100,  100,  100,  100,  102,
       113,  100,  100,  102,  103,  103,  105,  105,  104,  107,
       107,  110,  105,  111,  114,  107,  114,  110,  115,  113,
-      115,  116,  133,  133,  125,  146,  146,  233,  111,  112,
+      115,  116,  133,  133,  125,  146,  146,  245,  111,  112,
       112,  112,  112,  112,  117,  117,  112,  112,  236,  130,
       117,  119,  119,  125,  116,  121,  121,  119,  123,  123,
       131,  121,  126,  126,  123,  128,  128,  130,  126,  134,
@@ -696,37 +698,37 @@
       212,  212,  212,  235,  232,  212,  212,  217,  232,  221,
 
       224,  224,  227,  227,  229,  229,  224,  243,  227,  244,
-      229,  237,  237,  242,  242,  246,  235,  237,  225,  222,
-      218,  215,  213,  210,  197,  244,  193,  243,  191,  188,
-      178,  170,  168,  246,  254,  254,  254,  254,  255,  255,
-      255,  256,  256,  256,  256,  257,  257,  257,  257,  258,
-      132,  258,  258,  259,  259,  259,  259,  260,   94,  260,
-      260,  261,  261,  261,  261,  262,  262,   91,  262,  263,
-      263,  263,  263,  264,   63,  264,  264,  265,  265,  265,
-      265,  266,  266,  266,  266,  267,  267,  267,  267,  268,
-      268,  268,  268,  269,  269,  269,  269,  270,   35,  270,
+      229,  237,  237,  242,  242,  246,  235,  237,  233,  225,
+      222,  218,  215,  213,  210,  244,  197,  243,  193,  191,
+      188,  178,  170,  246,  256,  256,  256,  256,  257,  257,
+      257,  258,  258,  258,  258,  259,  259,  259,  259,  260,
+      168,  260,  260,  261,  261,  261,  261,  262,  132,  262,
+      262,  263,  263,  263,  263,  264,  264,   94,  264,  265,
+      265,  265,  265,  266,   91,  266,  266,  267,  267,  267,
+      267,  268,  268,  268,  268,  269,  269,  269,  269,  270,
+      270,  270,  270,  271,  271,  271,  271,  272,   63,  272,
 
-      270,  271,  271,  271,  271,  272,  272,  272,  272,  273,
-       28,  273,  273,  274,  274,  274,  274,  275,   24,  275,
-      275,  276,  276,  276,  276,  277,   22,  277,  277,  278,
-      278,  278,  278,  279,   17,  279,  279,  280,  280,  280,
-      280,  281,    6,  281,  281,  282,  282,  282,  282,  283,
-      283,  283,  283,  284,    5,  284,  284,  285,    4,  285,
-      285,  286,    3,  286,  286,  287,  287,  287,  287,  288,
-      288,  288,  288,  289,    0,  289,  289,  290,  290,  290,
-      290,  291,  291,  291,  291,  292,    0,  292,  292,  293,
-      293,  293,  293,  294,    0,  294,  294,  295,  295,  295,
+      272,  273,  273,  273,  273,  274,  274,  274,  274,  275,
+       35,  275,  275,  276,  276,  276,  276,  277,   28,  277,
+      277,  278,  278,  278,  278,  279,   24,  279,  279,  280,
+      280,  280,  280,  281,   22,  281,  281,  282,  282,  282,
+      282,  283,   17,  283,  283,  284,  284,  284,  284,  285,
+      285,  285,  285,  286,    6,  286,  286,  287,    5,  287,
+      287,  288,    4,  288,  288,  289,  289,  289,  289,  290,
+      290,  290,  290,  291,    3,  291,  291,  292,  292,  292,
+      292,  293,  293,  293,  293,  294,    0,  294,  294,  295,
+      295,  295,  295,  296,    0,  296,  296,  297,  297,  297,
 
-      295,  296,  296,  296,  296,  297,  297,  297,  297,  298,
-      298,  298,  298,  299,  299,  299,  299,  300,    0,  300,
-      300,  301,    0,  301,  301,  302,  302,  302,  302,  303,
-      303,  303,  303,  304,    0,  304,  304,  305,  305,  305,
-      305,  306,  306,  306,  306,  307,    0,  307,  307,  308,
-        0,  308,  308,  309,  309,    0,  309,  310,  310,  310,
-      310,  253,  253,  253,  253,  253,  253,  253,  253,  253,
-      253,  253,  253,  253,  253,  253,  253,  253,  253,  253,
-      253,  253,  253,  253,  253,  253,  253,  253,  253,  253,
-      253,  253,  253,  253,  253
+      297,  298,  298,  298,  298,  299,  299,  299,  299,  300,
+      300,  300,  300,  301,  301,  301,  301,  302,    0,  302,
+      302,  303,    0,  303,  303,  304,  304,  304,  304,  305,
+      305,  305,  305,  306,    0,  306,  306,  307,  307,  307,
+      307,  308,  308,  308,  308,  309,    0,  309,  309,  310,
+        0,  310,  310,  311,  311,  311,  311,  312,  312,  312,
+      312,  255,  255,  255,  255,  255,  255,  255,  255,  255,
+      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,
+      255,  255,  255,  255,  255,  255,  255,  255,  255,  255,
+      255,  255,  255,  255,  255
 
     } ;
 
@@ -858,7 +860,7 @@
 #define DEPRECATE(usewhatinstead) /* not currently reported */
 
 
-#line 862 "libxlu_disk_l.c"
+#line 864 "libxlu_disk_l.c"
 
 #define INITIAL 0
 #define LEXERR 1
@@ -1099,7 +1101,7 @@
 
  /*----- the scanner rules which do the parsing -----*/
 
-#line 1103 "libxlu_disk_l.c"
+#line 1105 "libxlu_disk_l.c"
 
 	if ( !yyg->yy_init )
 		{
@@ -1163,14 +1165,14 @@
 			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 				{
 				yy_current_state = (int) yy_def[yy_current_state];
-				if ( yy_current_state >= 254 )
+				if ( yy_current_state >= 256 )
 					yy_c = yy_meta[(unsigned int) yy_c];
 				}
 			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 			*yyg->yy_state_ptr++ = yy_current_state;
 			++yy_cp;
 			}
-		while ( yy_current_state != 253 );
+		while ( yy_current_state != 255 );
 
 yy_find_action:
 		yy_current_state = *--yyg->yy_state_ptr;
@@ -1422,7 +1424,7 @@
 #line 227 "libxlu_disk_l.l"
 YY_FATAL_ERROR( "flex scanner jammed" );
 	YY_BREAK
-#line 1426 "libxlu_disk_l.c"
+#line 1428 "libxlu_disk_l.c"
 			case YY_STATE_EOF(INITIAL):
 			case YY_STATE_EOF(LEXERR):
 				yyterminate();
@@ -1686,7 +1688,7 @@
 		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 			{
 			yy_current_state = (int) yy_def[yy_current_state];
-			if ( yy_current_state >= 254 )
+			if ( yy_current_state >= 256 )
 				yy_c = yy_meta[(unsigned int) yy_c];
 			}
 		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1710,11 +1712,11 @@
 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 		{
 		yy_current_state = (int) yy_def[yy_current_state];
-		if ( yy_current_state >= 254 )
+		if ( yy_current_state >= 256 )
 			yy_c = yy_meta[(unsigned int) yy_c];
 		}
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-	yy_is_jam = (yy_current_state == 253);
+	yy_is_jam = (yy_current_state == 255);
 	if ( ! yy_is_jam )
 		*yyg->yy_state_ptr++ = yy_current_state;
 
diff -r 1d6fab0446bf -r 72f339bc600d tools/libxl/libxlu_disk_l.l
--- a/tools/libxl/libxlu_disk_l.l	Mon Oct 10 10:09:17 2011 +0200
+++ b/tools/libxl/libxlu_disk_l.l	Mon Oct 10 11:21:51 2011 +0100
@@ -139,7 +139,7 @@
 devtype=[^,]*,?	{ xlu__disk_err(DPC,yytext,"unknown value for type"); }
 
 access=[^,]*,?	{ STRIP(','); setaccess(DPC, FROMEQUALS); }
-backendtype=[^,]*? { STRIP(','); setbackendtype(DPC,FROMEQUALS); }
+backendtype=[^,]*,? { STRIP(','); setbackendtype(DPC,FROMEQUALS); }
 
 vdev=[^,]*,?	{ STRIP(','); SAVESTRING("vdev", vdev, FROMEQUALS); }
 script=[^,]*,?	{ STRIP(','); SAVESTRING("script", script, FROMEQUALS); }

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 10 16:44:28 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 10 Oct 2011 16:44:28 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RDPWF-0008Sz-CR; Mon, 10 Oct 2011 16:44:27 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RDPW3-0008QV-3T
	for xen-changelog@lists.xensource.com; Mon, 10 Oct 2011 16:44:15 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-27.messagelabs.com!1318290231!48139133!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5226 invoked from network); 10 Oct 2011 23:43:51 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	10 Oct 2011 23:43:51 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RDPVz-0003cd-2O
	for xen-changelog@lists.xensource.com; Tue, 11 Oct 2011 00:44:11 +0100
Message-Id: <E1RDPVz-0003cd-2O@xenbits.xen.org>
Date: Tue, 11 Oct 2011 00:44:10 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/ocaml: Add a missing
	dependency to the xenctrl ocaml package
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 Jon Ludlam <jonathan.ludlam@eu.citrix.com>
# Date 1318261088 -3600
# Node ID 5173834e8476074afceb5c0124126e74a3954e97
# Parent  cdb34816a40a2dd3aaf324f7dcba83a122cf9146
tools/ocaml: Add a missing dependency to the xenctrl ocaml package

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r cdb34816a40a -r 5173834e8476 tools/ocaml/libs/xc/META.in
--- a/tools/ocaml/libs/xc/META.in	Mon Oct 10 16:37:07 2011 +0100
+++ b/tools/ocaml/libs/xc/META.in	Mon Oct 10 16:38:08 2011 +0100
@@ -1,5 +1,5 @@
 version = "@VERSION@"
 description = "Xen Control Interface"
-requires = "xenmmap,uuid"
+requires = "unix,xenmmap,uuid"
 archive(byte) = "xenctrl.cma"
 archive(native) = "xenctrl.cmxa"

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 10 16:44:40 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 10 Oct 2011 16:44:40 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RDPWR-0008Vz-Eu; Mon, 10 Oct 2011 16:44:39 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RDPW4-0008Qv-Gk
	for xen-changelog@lists.xensource.com; Mon, 10 Oct 2011 16:44:19 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-216.messagelabs.com!1318290253!332173!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4259 invoked from network); 10 Oct 2011 23:44:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	10 Oct 2011 23:44:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RDPW1-0003fd-8z
	for xen-changelog@lists.xensource.com; Tue, 11 Oct 2011 00:44:13 +0100
Message-Id: <E1RDPW1-0003fd-8z@xenbits.xen.org>
Date: Tue, 11 Oct 2011 00:44:12 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/ocaml: Small improvement to
	the ocaml xenctrl library
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 Jon Ludlam <jonathan.ludlam@eu.citrix.com>
# Date 1318261277 -3600
# Node ID 9ad40e16c68fb140d31b138b80771673e7453ecb
# Parent  187d59e32a586d65697ed46bef106b52e3fb5ab9
tools/ocaml: Small improvement to the ocaml xenctrl library

Add a new field 'max_nr_cpus' to the physinfo type in the ocaml xc bindings

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 187d59e32a58 -r 9ad40e16c68f tools/ocaml/libs/xc/xenctrl.ml
--- a/tools/ocaml/libs/xc/xenctrl.ml	Mon Oct 10 16:41:16 2011 +0100
+++ b/tools/ocaml/libs/xc/xenctrl.ml	Mon Oct 10 16:41:17 2011 +0100
@@ -70,6 +70,7 @@
 	scrub_pages      : nativeint;
 	(* XXX hw_cap *)
 	capabilities     : physinfo_cap_flag list;
+	max_nr_cpus      : int;
 }
 
 type version =
diff -r 187d59e32a58 -r 9ad40e16c68f tools/ocaml/libs/xc/xenctrl.mli
--- a/tools/ocaml/libs/xc/xenctrl.mli	Mon Oct 10 16:41:16 2011 +0100
+++ b/tools/ocaml/libs/xc/xenctrl.mli	Mon Oct 10 16:41:17 2011 +0100
@@ -52,6 +52,7 @@
   free_pages       : nativeint;
   scrub_pages      : nativeint;
   capabilities     : physinfo_cap_flag list;
+  max_nr_cpus      : int; (** compile-time max possible number of nr_cpus *)
 }
 type version = { major : int; minor : int; extra : string; }
 type compile_info = {
diff -r 187d59e32a58 -r 9ad40e16c68f tools/ocaml/libs/xc/xenctrl_stubs.c
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c	Mon Oct 10 16:41:16 2011 +0100
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c	Mon Oct 10 16:41:17 2011 +0100
@@ -534,6 +534,7 @@
 
 	if (retval)
 		failwith_xc(_H(xch));
+
 	ring[size] = '\0';
 	CAMLreturn(caml_copy_string(ring));
 }
@@ -573,7 +574,7 @@
 		}
 	}
 
-	physinfo = caml_alloc_tuple(9);
+	physinfo = caml_alloc_tuple(10);
 	Store_field(physinfo, 0, Val_int(c_physinfo.threads_per_core));
 	Store_field(physinfo, 1, Val_int(c_physinfo.cores_per_socket));
 	Store_field(physinfo, 2, Val_int(c_physinfo.nr_cpus));
@@ -583,6 +584,7 @@
 	Store_field(physinfo, 6, caml_copy_nativeint(c_physinfo.free_pages));
 	Store_field(physinfo, 7, caml_copy_nativeint(c_physinfo.scrub_pages));
 	Store_field(physinfo, 8, cap_list);
+	Store_field(physinfo, 9, Val_int(c_physinfo.max_cpu_id + 1));
 
 	CAMLreturn(physinfo);
 }

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 10 16:44:53 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 10 Oct 2011 16:44:53 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RDPWf-00007R-8u; Mon, 10 Oct 2011 16:44:53 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RDPW3-0008QU-2n
	for xen-changelog@lists.xensource.com; Mon, 10 Oct 2011 16:44:19 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1318290204!51802669!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11395 invoked from network); 10 Oct 2011 23:43:24 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	10 Oct 2011 23:43:24 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RDPVz-0003dT-MB
	for xen-changelog@lists.xensource.com; Tue, 11 Oct 2011 00:44:11 +0100
Message-Id: <E1RDPVz-0003dT-MB@xenbits.xen.org>
Date: Tue, 11 Oct 2011 00:44:11 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/ocaml: Remove the uuid library
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 Jon Ludlam <jonathan.ludlam@eu.citrix.com>
# Date 1318261276 -3600
# Node ID fa04fbd56521412483f1bd55d0800df42f254f58
# Parent  5173834e8476074afceb5c0124126e74a3954e97
tools/ocaml: Remove the uuid library

The library was only minimally used, and was really rather redundant.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
---


diff -r 5173834e8476 -r fa04fbd56521 tools/ocaml/libs/Makefile
--- a/tools/ocaml/libs/Makefile	Mon Oct 10 16:38:08 2011 +0100
+++ b/tools/ocaml/libs/Makefile	Mon Oct 10 16:41:16 2011 +0100
@@ -2,7 +2,7 @@
 include $(XEN_ROOT)/tools/Rules.mk
 
 SUBDIRS= \
-	uuid mmap \
+	mmap \
 	log xc eventchn \
 	xb xs xl
 
diff -r 5173834e8476 -r fa04fbd56521 tools/ocaml/libs/uuid/META.in
--- a/tools/ocaml/libs/uuid/META.in	Mon Oct 10 16:38:08 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-version = "@VERSION@"
-description = "Uuid - universal identifer"
-archive(byte) = "uuid.cma"
-archive(native) = "uuid.cmxa"
diff -r 5173834e8476 -r fa04fbd56521 tools/ocaml/libs/uuid/Makefile
--- a/tools/ocaml/libs/uuid/Makefile	Mon Oct 10 16:38:08 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-TOPLEVEL=$(CURDIR)/../..
-XEN_ROOT=$(TOPLEVEL)/../..
-include $(TOPLEVEL)/common.make
-
-OBJS = uuid
-INTF = $(foreach obj, $(OBJS),$(obj).cmi)
-LIBS = uuid.cma uuid.cmxa
-
-all: $(INTF) $(LIBS) $(PROGRAMS)
-
-bins: $(PROGRAMS)
-
-libs: $(LIBS)
-
-uuid_OBJS = $(OBJS)
-OCAML_NOC_LIBRARY = uuid
-
-.PHONY: install
-install: $(LIBS) META
-	mkdir -p $(OCAMLDESTDIR)
-	ocamlfind remove -destdir $(OCAMLDESTDIR) uuid
-	ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore uuid META $(INTF) $(LIBS) *.a *.cmx
-
-.PHONY: uninstall
-uninstall:
-	ocamlfind remove -destdir $(OCAMLDESTDIR) uuid
-
-include $(TOPLEVEL)/Makefile.rules
-
diff -r 5173834e8476 -r fa04fbd56521 tools/ocaml/libs/uuid/uuid.ml
--- a/tools/ocaml/libs/uuid/uuid.ml	Mon Oct 10 16:38:08 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-(*
- * Copyright (C) 2006-2010 Citrix Systems Inc.
- * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *)
-
-(* Internally, a UUID is simply a string. *)
-type 'a t = string
-
-type cookie = string
-
-let of_string s = s
-let to_string s = s
-
-let null = ""
-
-(* deprecated: we don't need to duplicate the uuid prefix/suffix *)
-let uuid_of_string = of_string
-let string_of_uuid = to_string
-
-let string_of_cookie s = s
-
-let cookie_of_string s = s
-
-let dev_random = "/dev/random"
-let dev_urandom = "/dev/urandom"
-
-let rnd_array n =
-	let fstbyte i = 0xff land i in
-	let sndbyte i = fstbyte (i lsr 8) in
-	let thdbyte i = sndbyte (i lsr 8) in
-	let rec rnd_list n acc = match n with
-		| 0 -> acc
-		| 1 ->
-			let b = fstbyte (Random.bits ()) in
-			b :: acc
-		| 2 ->
-			let r = Random.bits () in
-			let b1 = fstbyte r in
-			let b2 = sndbyte r in
-			b1 :: b2 :: acc
-		| n -> 
-			let r = Random.bits () in
-			let b1 = fstbyte r in
-			let b2 = sndbyte r in
-			let b3 = thdbyte r in
-			rnd_list (n - 3) (b1 :: b2 :: b3 :: acc)
-	in
-	Array.of_list (rnd_list n [])
-
-let read_array dev n = 
-  let ic = open_in_bin dev in
-  try
-    let result = Array.init n (fun _ -> input_byte ic) in
-    close_in ic;
-    result
-  with e ->
-    close_in ic;
-    raise e
-
-let uuid_of_int_array uuid =
-  Printf.sprintf "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x"
-    uuid.(0) uuid.(1) uuid.(2) uuid.(3) uuid.(4) uuid.(5)
-    uuid.(6) uuid.(7) uuid.(8) uuid.(9) uuid.(10) uuid.(11)
-    uuid.(12) uuid.(13) uuid.(14) uuid.(15)
-
-let make_uuid_prng () = uuid_of_int_array (rnd_array 16)
-let make_uuid_urnd () = uuid_of_int_array (read_array dev_urandom 16)
-let make_uuid_rnd () = uuid_of_int_array (read_array dev_random 16)
-let make_uuid = make_uuid_urnd
-
-let make_cookie() =
-  let bytes = Array.to_list (read_array dev_urandom 64) in
-  String.concat "" (List.map (Printf.sprintf "%1x") bytes)
-
-let int_array_of_uuid s =
-  try
-    let l = ref [] in
-    Scanf.sscanf s "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x"
-      (fun a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 ->
-      l := [ a0; a1; a2; a3; a4; a5; a6; a7; a8; a9;
-             a10; a11; a12; a13; a14; a15; ]);
-    Array.of_list !l
-  with _ -> invalid_arg "Uuid.int_array_of_uuid"
-
-let is_uuid str =
-	try
-		Scanf.sscanf str
-			"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x"
-			(fun _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ -> true)
-	with _ -> false
diff -r 5173834e8476 -r fa04fbd56521 tools/ocaml/libs/uuid/uuid.mli
--- a/tools/ocaml/libs/uuid/uuid.mli	Mon Oct 10 16:38:08 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-(*
- * Copyright (C) 2006-2010 Citrix Systems Inc.
- * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *)
-(** Type-safe UUIDs.
-    Probably need to refactor this; UUIDs are used in two places:
-    + to uniquely name things across the cluster
-    + as secure session IDs
-
-    There is the additional constraint that current Xen tools use 
-    a particular format of UUID (the 16 byte variety generated by fresh ())
-
-	Also, cookies aren't UUIDs and should be put somewhere else.
-*)
-
-(** A 128-bit UUID.  Using phantom types ('a) to achieve the requires type-safety. *)
-type 'a t
-
-(** Create a fresh UUID *)
-val make_uuid : unit -> 'a t
-val make_uuid_prng : unit -> 'a t
-val make_uuid_urnd : unit -> 'a t
-val make_uuid_rnd : unit -> 'a t
-
-(** Create a UUID from a string. *)
-val of_string : string -> 'a t
-
-(** Marshal a UUID to a string. *)
-val to_string : 'a t -> string
-
-(** A null UUID, as if such a thing actually existed.  It turns out to be
- * useful though. *)
-val null : 'a t
-
-(** Deprecated alias for {! Uuid.of_string} *)
-val uuid_of_string : string -> 'a t
-
-(** Deprecated alias for {! Uuid.to_string} *)
-val string_of_uuid : 'a t -> string
-
-(** Convert an array to a UUID. *)
-val uuid_of_int_array : int array -> 'a t
-
-(** Convert a UUID to an array. *)
-val int_array_of_uuid : 'a t -> int array
-
-(** Check whether a string is a UUID. *)
-val is_uuid : string -> bool
-
-(** A 512-bit cookie. *)
-type cookie
-
-val make_cookie : unit -> cookie
-
-val cookie_of_string : string -> cookie
-
-val string_of_cookie : cookie -> string
diff -r 5173834e8476 -r fa04fbd56521 tools/ocaml/libs/xc/META.in
--- a/tools/ocaml/libs/xc/META.in	Mon Oct 10 16:38:08 2011 +0100
+++ b/tools/ocaml/libs/xc/META.in	Mon Oct 10 16:41:16 2011 +0100
@@ -1,5 +1,5 @@
 version = "@VERSION@"
 description = "Xen Control Interface"
-requires = "unix,xenmmap,uuid"
+requires = "unix,xenmmap"
 archive(byte) = "xenctrl.cma"
 archive(native) = "xenctrl.cmxa"
diff -r 5173834e8476 -r fa04fbd56521 tools/ocaml/libs/xc/Makefile
--- a/tools/ocaml/libs/xc/Makefile	Mon Oct 10 16:38:08 2011 +0100
+++ b/tools/ocaml/libs/xc/Makefile	Mon Oct 10 16:41:16 2011 +0100
@@ -3,7 +3,7 @@
 include $(TOPLEVEL)/common.make
 
 CFLAGS += -I../mmap $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest)
-OCAMLINCLUDE += -I ../mmap -I ../uuid
+OCAMLINCLUDE += -I ../mmap
 
 OBJS = xenctrl
 INTF = xenctrl.cmi
diff -r 5173834e8476 -r fa04fbd56521 tools/ocaml/libs/xc/xenctrl.ml
--- a/tools/ocaml/libs/xc/xenctrl.ml	Mon Oct 10 16:38:08 2011 +0100
+++ b/tools/ocaml/libs/xc/xenctrl.ml	Mon Oct 10 16:41:16 2011 +0100
@@ -118,14 +118,23 @@
 external _domain_create: handle -> int32 -> domain_create_flag list -> int array -> domid
        = "stub_xc_domain_create"
 
+let int_array_of_uuid_string s =
+	try
+		Scanf.sscanf s
+			"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x"
+			(fun a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 ->
+				[| a0; a1; a2; a3; a4; a5; a6; a7;
+				   a8; a9; a10; a11; a12; a13; a14; a15 |])
+	with _ -> invalid_arg ("Xc.int_array_of_uuid_string: " ^ s)
+
 let domain_create handle n flags uuid =
-	_domain_create handle n flags (Uuid.int_array_of_uuid uuid)
+	_domain_create handle n flags (int_array_of_uuid_string uuid)
 
 external _domain_sethandle: handle -> domid -> int array -> unit
                           = "stub_xc_domain_sethandle"
 
 let domain_sethandle handle n uuid =
-	_domain_sethandle handle n (Uuid.int_array_of_uuid uuid)
+	_domain_sethandle handle n (int_array_of_uuid_string uuid)
 
 external domain_max_vcpus: handle -> domid -> int -> unit
        = "stub_xc_domain_max_vcpus"
diff -r 5173834e8476 -r fa04fbd56521 tools/ocaml/libs/xc/xenctrl.mli
--- a/tools/ocaml/libs/xc/xenctrl.mli	Mon Oct 10 16:38:08 2011 +0100
+++ b/tools/ocaml/libs/xc/xenctrl.mli	Mon Oct 10 16:41:16 2011 +0100
@@ -74,12 +74,8 @@
 external is_fake : unit -> bool = "stub_xc_interface_is_fake"
 external interface_close : handle -> unit = "stub_xc_interface_close"
 val with_intf : (handle -> 'a) -> 'a
-external _domain_create : handle -> int32 -> domain_create_flag list -> int array -> domid
-  = "stub_xc_domain_create"
-val domain_create : handle -> int32 -> domain_create_flag list -> 'a Uuid.t -> domid
-external _domain_sethandle : handle -> domid -> int array -> unit
-  = "stub_xc_domain_sethandle"
-val domain_sethandle : handle -> domid -> 'a Uuid.t -> unit
+val domain_create : handle -> int32 -> domain_create_flag list -> string -> domid
+val domain_sethandle : handle -> domid -> string -> unit
 external domain_max_vcpus : handle -> domid -> int -> unit
   = "stub_xc_domain_max_vcpus"
 external domain_pause : handle -> domid -> unit = "stub_xc_domain_pause"
diff -r 5173834e8476 -r fa04fbd56521 tools/ocaml/xenstored/Makefile
--- a/tools/ocaml/xenstored/Makefile	Mon Oct 10 16:38:08 2011 +0100
+++ b/tools/ocaml/xenstored/Makefile	Mon Oct 10 16:41:16 2011 +0100
@@ -5,7 +5,6 @@
 OCAMLINCLUDE += \
 	-I $(OCAML_TOPLEVEL)/libs/log \
 	-I $(OCAML_TOPLEVEL)/libs/xb \
-	-I $(OCAML_TOPLEVEL)/libs/uuid \
 	-I $(OCAML_TOPLEVEL)/libs/mmap \
 	-I $(OCAML_TOPLEVEL)/libs/xc \
 	-I $(OCAML_TOPLEVEL)/libs/eventchn
@@ -34,7 +33,6 @@
 INTF = symbol.cmi trie.cmi
 XENSTOREDLIBS = \
 	unix.cmxa \
-	$(OCAML_TOPLEVEL)/libs/uuid/uuid.cmxa \
 	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/mmap $(OCAML_TOPLEVEL)/libs/mmap/xenmmap.cmxa \
 	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/log $(OCAML_TOPLEVEL)/libs/log/log.cmxa \
 	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/eventchn $(OCAML_TOPLEVEL)/libs/eventchn/xeneventchn.cmxa \

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 10 16:44:59 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 10 Oct 2011 16:44:59 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RDPWl-0000AQ-OG; Mon, 10 Oct 2011 16:44:59 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RDPW3-0008Qd-OF
	for xen-changelog@lists.xensource.com; Mon, 10 Oct 2011 16:44:19 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1318290229!52614851!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4116 invoked from network); 10 Oct 2011 23:43:49 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-6.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	10 Oct 2011 23:43:49 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RDPW0-0003ev-Om
	for xen-changelog@lists.xensource.com; Tue, 11 Oct 2011 00:44:12 +0100
Message-Id: <E1RDPW0-0003ev-Om@xenbits.xen.org>
Date: Tue, 11 Oct 2011 00:44:12 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/ocaml: Fix 2 bit-twiddling
	bugs and an off-by-one
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 Jon Ludlam <jonathan.ludlam@eu.citrix.com>
# Date 1318261276 -3600
# Node ID 187d59e32a586d65697ed46bef106b52e3fb5ab9
# Parent  51288f69523fcbbefa12cea5a761a6e957410151
tools/ocaml: Fix 2 bit-twiddling bugs and an off-by-one

The bit bugs are in ocaml vcpu affinity calls, and the off-by-one
error is in the ocaml console ring code

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
---


diff -r 51288f69523f -r 187d59e32a58 tools/ocaml/libs/xc/xenctrl_stubs.c
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c	Mon Oct 10 16:41:16 2011 +0100
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c	Mon Oct 10 16:41:16 2011 +0100
@@ -430,7 +430,7 @@
 
 	for (i=0; i<len; i++) {
 		if (Bool_val(Field(cpumap, i)))
-			c_cpumap[i/8] |= i << (i&7);
+			c_cpumap[i/8] |= 1 << (i&7);
 	}
 	retval = xc_vcpu_setaffinity(_H(xch), _D(domid),
 	                             Int_val(vcpu), c_cpumap);
@@ -466,7 +466,7 @@
 	ret = caml_alloc(len, 0);
 
 	for (i=0; i<len; i++) {
-		if (c_cpumap[i%8] & 1 << (i&7))
+		if (c_cpumap[i/8] & 1 << (i&7))
 			Store_field(ret, i, Val_true);
 		else
 			Store_field(ret, i, Val_false);
@@ -523,7 +523,7 @@
 
 CAMLprim value stub_xc_readconsolering(value xch)
 {
-	unsigned int size = RING_SIZE;
+	unsigned int size = RING_SIZE - 1;
 	char *ring_ptr = ring;
 
 	CAMLparam1(xch);

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 10 16:45:09 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 10 Oct 2011 16:45:09 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RDPWu-0000EH-NV; Mon, 10 Oct 2011 16:45:08 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RDPW5-0008R3-CK
	for xen-changelog@lists.xensource.com; Mon, 10 Oct 2011 16:44:19 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-216.messagelabs.com!1318290253!463440!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5256 invoked from network); 10 Oct 2011 23:44:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-11.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	10 Oct 2011 23:44:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RDPW1-0003gK-PH
	for xen-changelog@lists.xensource.com; Tue, 11 Oct 2011 00:44:13 +0100
Message-Id: <E1RDPW1-0003gK-PH@xenbits.xen.org>
Date: Tue, 11 Oct 2011 00:44:13 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/check: check for yajl (needed
	by libxl)
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 Ian Campbell <ian.campbell@citrix.com>
# Date 1318261788 -3600
# Node ID b8b413d8b2df61b3b3184003ae660a18d01bbae3
# Parent  9ad40e16c68fb140d31b138b80771673e7453ecb
tools/check: check for yajl (needed by libxl)

We need precisely version 1 so check for .so.1. In the future we should handle
yajl v2 as well.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 9ad40e16c68f -r b8b413d8b2df tools/check/check_yajl_devel
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/check/check_yajl_devel	Mon Oct 10 16:49:48 2011 +0100
@@ -0,0 +1,8 @@
+#!/bin/sh
+# CHECK-BUILD
+
+. ./funcs.sh
+
+has_header yajl/yajl_parse.h || fail "can't find yajl/yajl_parse.h"
+has_header yajl/yajl_gen.h || fail "can't find yajl/yajl_gen.h"
+has_lib libyajl.so || fail "can't find libyajl.so"
diff -r 9ad40e16c68f -r b8b413d8b2df tools/check/check_yajl_lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/check/check_yajl_lib	Mon Oct 10 16:49:48 2011 +0100
@@ -0,0 +1,6 @@
+#!/bin/sh
+# CHECK-BUILD CHECK-INSTALL
+
+. ./funcs.sh
+
+has_lib libyajl.so.1 || fail "can't find libyajl.so.1 version 1"

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 10 16:45:17 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 10 Oct 2011 16:45:17 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RDPX3-0000HE-Dp; Mon, 10 Oct 2011 16:45:17 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RDPW3-0008QW-9G
	for xen-changelog@lists.xensource.com; Mon, 10 Oct 2011 16:44:21 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1318290233!46059281!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31649 invoked from network); 10 Oct 2011 23:43:54 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	10 Oct 2011 23:43:54 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RDPW0-0003eD-7d
	for xen-changelog@lists.xensource.com; Tue, 11 Oct 2011 00:44:12 +0100
Message-Id: <E1RDPW0-0003eD-7d@xenbits.xen.org>
Date: Tue, 11 Oct 2011 00:44:11 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/ocaml: Remove log library from
	tools/ocaml/libs
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 Jon Ludlam <jonathan.ludlam@eu.citrix.com>
# Date 1318261276 -3600
# Node ID 51288f69523fcbbefa12cea5a761a6e957410151
# Parent  fa04fbd56521412483f1bd55d0800df42f254f58
tools/ocaml: Remove log library from tools/ocaml/libs

The only user was oxenstored, which has had the relevant bits
merged in.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
---


diff -r fa04fbd56521 -r 51288f69523f tools/ocaml/libs/Makefile
--- a/tools/ocaml/libs/Makefile	Mon Oct 10 16:41:16 2011 +0100
+++ b/tools/ocaml/libs/Makefile	Mon Oct 10 16:41:16 2011 +0100
@@ -3,7 +3,7 @@
 
 SUBDIRS= \
 	mmap \
-	log xc eventchn \
+	xc eventchn \
 	xb xs xl
 
 .PHONY: all
diff -r fa04fbd56521 -r 51288f69523f tools/ocaml/libs/log/META.in
--- a/tools/ocaml/libs/log/META.in	Mon Oct 10 16:41:16 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-version = "@VERSION@"
-description = "Log - logging library"
-requires = "unix"
-archive(byte) = "log.cma"
-archive(native) = "log.cmxa"
diff -r fa04fbd56521 -r 51288f69523f tools/ocaml/libs/log/Makefile
--- a/tools/ocaml/libs/log/Makefile	Mon Oct 10 16:41:16 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-TOPLEVEL=$(CURDIR)/../..
-XEN_ROOT=$(TOPLEVEL)/../..
-include $(TOPLEVEL)/common.make
-
-OBJS = syslog log logs
-INTF = log.cmi logs.cmi syslog.cmi
-LIBS = log.cma log.cmxa
-
-all: $(INTF) $(LIBS) $(PROGRAMS)
-
-bins: $(PROGRAMS)
-
-libs: $(LIBS)
-
-log.cmxa: libsyslog_stubs.a $(foreach obj,$(OBJS),$(obj).cmx)
-	$(call mk-caml-lib-native, $@, -cclib -lsyslog_stubs, $(foreach obj,$(OBJS),$(obj).cmx))
-
-log.cma: $(foreach obj,$(OBJS),$(obj).cmo)
-	$(call mk-caml-lib-bytecode, $@, -dllib dllsyslog_stubs.so -cclib -lsyslog_stubs, $(foreach obj,$(OBJS),$(obj).cmo))
-
-syslog_stubs.a: syslog_stubs.o
-	$(call mk-caml-stubs, $@, $+)
-
-libsyslog_stubs.a: syslog_stubs.o
-	$(call mk-caml-lib-stubs, $@, $+)
-
-logs.mli : logs.ml
-	$(OCAMLC) -i $(OCAMLCFLAGS) $< > $@
-
-syslog.mli : syslog.ml
-	$(OCAMLC) -i $< > $@
-
-.PHONY: install
-install: $(LIBS) META
-	mkdir -p $(OCAMLDESTDIR)
-	ocamlfind remove -destdir $(OCAMLDESTDIR) log
-	ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore log META $(INTF) $(LIBS) *.a *.so *.cmx
-
-.PHONY: uninstall
-uninstall:
-	ocamlfind remove -destdir $(OCAMLDESTDIR) log
-
-include $(TOPLEVEL)/Makefile.rules
-
diff -r fa04fbd56521 -r 51288f69523f tools/ocaml/libs/log/log.ml
--- a/tools/ocaml/libs/log/log.ml	Mon Oct 10 16:41:16 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,258 +0,0 @@
-(*
- * Copyright (C) 2006-2007 XenSource Ltd.
- * Copyright (C) 2008      Citrix Ltd.
- * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *)
-
-open Printf
-
-exception Unknown_level of string
-
-type stream_type = Stderr | Stdout | File of string
-
-type stream_log = {
-  ty : stream_type;
-  channel : out_channel option ref;
-}
-
-type level = Debug | Info | Warn | Error
-
-type output =
-	| Stream of stream_log
-	| String of string list ref
-	| Syslog of string
-	| Nil
-
-let int_of_level l =
-	match l with Debug -> 0 | Info -> 1 | Warn -> 2 | Error -> 3
-
-let string_of_level l =
-	match l with Debug -> "debug" | Info -> "info"
-	           | Warn -> "warn" | Error -> "error"
-
-let level_of_string s =
-	match s with
-	| "debug" -> Debug
-	| "info"  -> Info
-	| "warn"  -> Warn
-	| "error" -> Error
-	| _       -> raise (Unknown_level s)
-
-let mkdir_safe dir perm =
-        try Unix.mkdir dir perm with _ -> ()
-
-let mkdir_rec dir perm =
-	let rec p_mkdir dir =
-		let p_name = Filename.dirname dir in
-		if p_name = "/" || p_name = "." then
-			()
-		else (
-			p_mkdir p_name;
-			mkdir_safe dir perm
-		) in
-	p_mkdir dir
-
-type t = { output: output; mutable level: level; }
-
-let make output level = { output = output; level = level; }
-
-let make_stream ty channel = 
-        Stream {ty=ty; channel=ref channel; }
-
-(** open a syslog logger *)
-let opensyslog k level =
-	make (Syslog k) level
-
-(** open a stderr logger *)
-let openerr level =
-	if (Unix.stat "/dev/stderr").Unix.st_kind <> Unix.S_CHR then
-		failwith "/dev/stderr is not a valid character device";
-	make (make_stream Stderr (Some (open_out "/dev/stderr"))) level
-	
-let openout level =
-	if (Unix.stat "/dev/stdout").Unix.st_kind <> Unix.S_CHR then
-		failwith "/dev/stdout is not a valid character device";
-        make (make_stream Stdout (Some (open_out "/dev/stdout"))) level
-
-
-(** open a stream logger - returning the channel. *)
-(* This needs to be separated from 'openfile' so we can reopen later *)
-let doopenfile filename =
-        if Filename.is_relative filename then
-	        None
-	else (
-                try
-		  mkdir_rec (Filename.dirname filename) 0o700;
-	          Some (open_out_gen [ Open_append; Open_creat ] 0o600 filename)
-                with _ -> None
-	)
-
-(** open a stream logger - returning the output type *)
-let openfile filename level =
-        make (make_stream (File filename) (doopenfile filename)) level
-
-(** open a nil logger *)
-let opennil () =
-	make Nil Error
-
-(** open a string logger *)
-let openstring level =
-        make (String (ref [""])) level
-
-(** try to reopen a logger *)
-let reopen t =
-	match t.output with
-	| Nil              -> t
-	| Syslog k         -> Syslog.close (); opensyslog k t.level
-	| Stream s         -> (
-	      match (s.ty,!(s.channel)) with 
-		| (File filename, Some c) -> close_out c; s.channel := (try doopenfile filename with _ -> None); t 
-		| _ -> t)
-	| String _         -> t
-
-(** close a logger *)
-let close t =
-	match t.output with
-	| Nil           -> ()
-	| Syslog k      -> Syslog.close ();
-	| Stream s      -> (
-	      match !(s.channel) with 
-		| Some c -> close_out c; s.channel := None
-		| None -> ())
-	| String _      -> ()
-
-(** create a string representating the parameters of the logger *)
-let string_of_logger t =
-	match t.output with
-	| Nil           -> "nil"
-	| Syslog k      -> sprintf "syslog:%s" k
-	| String _      -> "string"
-	| Stream s      -> 
-	    begin
-	      match s.ty with 
-		| File f -> sprintf "file:%s" f
-		| Stderr -> "stderr"
-		| Stdout -> "stdout"
-	    end
-
-(** parse a string to a logger *)
-let logger_of_string s : t =
-	match s with
-	| "nil"    -> opennil ()
-	| "stderr" -> openerr Debug
-	| "stdout" -> openout Debug
-	| "string" -> openstring Debug
-	| _        ->
-		let split_in_2 s =
-			try
-				let i = String.index s ':' in
-				String.sub s 0 (i),
-				String.sub s (i + 1) (String.length s - i - 1)
-			with _ ->
-				failwith "logger format error: expecting string:string"
-			in
-		let k, s = split_in_2 s in
-		match k with
-		| "syslog" -> opensyslog s Debug
-		| "file"   -> openfile s Debug
-		| _        -> failwith "unknown logger type"
-
-let validate s =
-	match s with
-	| "nil"    -> ()
-	| "stderr" -> ()
-	| "stdout" -> ()
-	| "string" -> ()
-	| _        ->
-		let split_in_2 s =
-			try
-				let i = String.index s ':' in
-				String.sub s 0 (i),
-				String.sub s (i + 1) (String.length s - i - 1)
-			with _ ->
-				failwith "logger format error: expecting string:string"
-			in
-		let k, s = split_in_2 s in
-		match k with
-		| "syslog" -> ()
-		| "file"   -> (
-			try
-				let st = Unix.stat s in
-				if st.Unix.st_kind <> Unix.S_REG then
-					failwith "logger file is a directory";
-				()
-			with Unix.Unix_error (Unix.ENOENT, _, _) -> ()
-			)
-		| _        -> failwith "unknown logger"
-
-(** change a logger level to level *)
-let set t level = t.level <- level
-
-let gettimestring () =
-	let time = Unix.gettimeofday () in
-	let tm = Unix.localtime time in
-        let msec = time -. (floor time) in
-	sprintf "%d%.2d%.2d %.2d:%.2d:%.2d.%.3d|" (1900 + tm.Unix.tm_year)
-	        (tm.Unix.tm_mon + 1) tm.Unix.tm_mday
-	        tm.Unix.tm_hour tm.Unix.tm_min tm.Unix.tm_sec
-	        (int_of_float (1000.0 *. msec))
-
-(*let extra_hook = ref (fun x -> x)*)
-
-let output t ?(key="") ?(extra="") priority (message: string) =
-  let construct_string withtime =
-		(*let key = if key = "" then [] else [ key ] in
-		let extra = if extra = "" then [] else [ extra ] in
-		let items = 
-      (if withtime then [ gettimestring () ] else [])
-		  @ [ sprintf "%5s" (string_of_level priority) ] @ extra @ key @ [ message ] in
-(*		let items = !extra_hook items in*)
-		String.concat " " items*)
-    Printf.sprintf "[%s%s|%s] %s" 
-      (if withtime then gettimestring () else "") (string_of_level priority) extra message
-	in
-	(* Keep track of how much we write out to streams, so that we can *)
-	(* log-rotate at appropriate times *)
-	let write_to_stream stream =
-	  let string = (construct_string true) in
-	  try
-	    fprintf stream "%s\n%!" string
-	  with _ -> () (* Trap exception when we fail to write log *)
-        in
-
-	if String.length message > 0 then
-	match t.output with
-	| Syslog k      ->
-		let sys_prio = match priority with
-		| Debug -> Syslog.Debug
-		| Info  -> Syslog.Info
-		| Warn  -> Syslog.Warning
-		| Error -> Syslog.Err in
-		Syslog.log Syslog.Daemon sys_prio ((construct_string false) ^ "\n")
-	| Stream s -> (
-	      match !(s.channel) with
-		| Some c -> write_to_stream c
-		| None -> ())
-	| Nil           -> ()
-	| String s      -> (s := (construct_string true)::!s)
-
-let log t level (fmt: ('a, unit, string, unit) format4): 'a =
-	let b = (int_of_level t.level) <= (int_of_level level) in
-	(* ksprintf is the preferred name for kprintf, but the former
-	 * is not available in OCaml 3.08.3 *)
-	Printf.kprintf (if b then output t level else (fun _ -> ())) fmt
-	    
-let debug t (fmt: ('a , unit, string, unit) format4) = log t Debug fmt
-let info t (fmt: ('a , unit, string, unit) format4) = log t Info fmt
-let warn t (fmt: ('a , unit, string, unit) format4) = log t Warn fmt
-let error t (fmt: ('a , unit, string, unit) format4) = log t Error fmt
diff -r fa04fbd56521 -r 51288f69523f tools/ocaml/libs/log/log.mli
--- a/tools/ocaml/libs/log/log.mli	Mon Oct 10 16:41:16 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-(*
- * Copyright (C) 2006-2007 XenSource Ltd.
- * Copyright (C) 2008      Citrix Ltd.
- * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *)
-
-exception Unknown_level of string
-type level = Debug | Info | Warn | Error
-
-type stream_type = Stderr | Stdout | File of string
-type stream_log = {
-  ty : stream_type;
-  channel : out_channel option ref;
-}
-type output =
-    Stream of stream_log
-  | String of string list ref
-  | Syslog of string
-  | Nil
-val int_of_level : level -> int
-val string_of_level : level -> string
-val level_of_string : string -> level
-val mkdir_safe : string -> Unix.file_perm -> unit
-val mkdir_rec : string -> Unix.file_perm -> unit
-type t = { output : output; mutable level : level; }
-val make : output -> level -> t
-val opensyslog : string -> level -> t
-val openerr : level -> t
-val openout : level -> t
-val openfile : string -> level -> t
-val opennil : unit -> t
-val openstring : level -> t
-val reopen : t -> t
-val close : t -> unit
-val string_of_logger : t -> string
-val logger_of_string : string -> t
-val validate : string -> unit
-val set : t -> level -> unit
-val gettimestring : unit -> string
-val output : t -> ?key:string -> ?extra:string -> level -> string -> unit
-val log : t -> level -> ('a, unit, string, unit) format4 -> 'a
-val debug : t -> ('a, unit, string, unit) format4 -> 'a
-val info : t -> ('a, unit, string, unit) format4 -> 'a
-val warn : t -> ('a, unit, string, unit) format4 -> 'a
-val error : t -> ('a, unit, string, unit) format4 -> 'a
diff -r fa04fbd56521 -r 51288f69523f tools/ocaml/libs/log/logs.ml
--- a/tools/ocaml/libs/log/logs.ml	Mon Oct 10 16:41:16 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,197 +0,0 @@
-(*
- * Copyright (C) 2006-2007 XenSource Ltd.
- * Copyright (C) 2008      Citrix Ltd.
- * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *)
-
-type keylogger =
-{
-	mutable debug: string list;
-	mutable info: string list;
-	mutable warn: string list;
-	mutable error: string list;
-	no_default: bool;
-}
-
-(* map all logger strings into a logger *)
-let __all_loggers = Hashtbl.create 10
-
-(* default logger that everything that doesn't have a key in __lop_mapping get send *)
-let __default_logger = { debug = []; info = []; warn = []; error = []; no_default = false }
-
-(*
- * This describe the mapping between a name to a keylogger.
- * a keylogger contains a list of logger string per level of debugging.
- * Example:   "xenops", debug -> [ "stderr"; "/var/log/xensource.log" ]
- *            "xapi", error ->   []
- *            "xapi", debug ->   [ "/var/log/xensource.log" ]
- *            "xenops", info ->  [ "syslog" ]
- *)
-let __log_mapping = Hashtbl.create 32
-
-let get_or_open logstring =
-	if Hashtbl.mem __all_loggers logstring then
-		Hashtbl.find __all_loggers logstring
-	else
-		let t = Log.logger_of_string logstring in
-		Hashtbl.add __all_loggers logstring t;
-		t
-
-(** create a mapping entry for the key "name".
- * all log level of key "name" default to "logger" logger.
- * a sensible default is put "nil" as a logger and reopen a specific level to
- * the logger you want to.
- *)
-let add key logger =
-	let kl = {
-		debug = logger;
-		info = logger;
-		warn = logger;
-		error = logger;
-		no_default = false;
-	} in
-	Hashtbl.add __log_mapping key kl
-
-let get_by_level keylog level =
-	match level with
-	| Log.Debug -> keylog.debug
-	| Log.Info  -> keylog.info
-	| Log.Warn  -> keylog.warn
-	| Log.Error -> keylog.error
-
-let set_by_level keylog level logger =
-	match level with
-	| Log.Debug -> keylog.debug <- logger
-	| Log.Info  -> keylog.info <- logger
-	| Log.Warn  -> keylog.warn <- logger
-	| Log.Error -> keylog.error <- logger
-
-(** set a specific key|level to the logger "logger" *)
-let set key level logger =
-	if not (Hashtbl.mem __log_mapping key) then
-		add key [];
-
-	let keylog = Hashtbl.find __log_mapping key in
-	set_by_level keylog level logger
-
-(** set default logger *)
-let set_default level logger =
-	set_by_level __default_logger level logger
-
-(** append a logger to the list *)
-let append key level logger =
-	if not (Hashtbl.mem __log_mapping key) then
-		add key [];
-	let keylog = Hashtbl.find __log_mapping key in
-	let loggers = get_by_level keylog level in
-	set_by_level keylog level (loggers @ [ logger ])
-
-(** append a logger to the default list *)
-let append_default level logger =
-	let loggers = get_by_level __default_logger level in
-	set_by_level __default_logger level (loggers @ [ logger ])
-
-(** reopen all logger open *)
-let reopen () =
-	Hashtbl.iter (fun k v ->
-		Hashtbl.replace __all_loggers k (Log.reopen v)) __all_loggers
-
-(** reclaim close all logger open that are not use by any other keys *)
-let reclaim () =
-	let list_sort_uniq l =
-		let oldprev = ref "" and prev = ref "" in
-		List.fold_left (fun a k ->
-			oldprev := !prev;
-			prev := k;
-			if k = !oldprev then a else k :: a) []
-			(List.sort compare l)
-		in
-	let flatten_keylogger v =
-		list_sort_uniq (v.debug @ v.info @ v.warn @ v.error) in
-	let oldkeys = Hashtbl.fold (fun k v a -> k :: a) __all_loggers [] in
-	let usedkeys = Hashtbl.fold (fun k v a ->
-		(flatten_keylogger v) @ a)
-		__log_mapping (flatten_keylogger __default_logger) in
-	let usedkeys = list_sort_uniq usedkeys in
-
-	List.iter (fun k ->
-		if not (List.mem k usedkeys) then (
-			begin try
-				Log.close (Hashtbl.find __all_loggers k)
-			with
-				Not_found -> ()
-			end;
-			Hashtbl.remove __all_loggers k
-		)) oldkeys
-
-(** clear a specific key|level *)
-let clear key level =
-	try
-		let keylog = Hashtbl.find __log_mapping key in
-		set_by_level keylog level [];
-		reclaim ()
-	with Not_found ->
-		()
-
-(** clear a specific default level *)
-let clear_default level =
-	set_default level [];
-	reclaim ()
-
-(** reset all the loggers to the specified logger *)
-let reset_all logger =
-	Hashtbl.clear __log_mapping;
-	set_default Log.Debug logger;
-	set_default Log.Warn logger;
-	set_default Log.Error logger;
-	set_default Log.Info logger;
-	reclaim ()
-
-(** log a fmt message to the key|level logger specified in the log mapping.
- * if the logger doesn't exist, assume nil logger.
- *)
-let log key level ?(extra="") (fmt: ('a, unit, string, unit) format4): 'a =
-	let keylog =
-		if Hashtbl.mem __log_mapping key then
-			let keylog = Hashtbl.find __log_mapping key in
-			if keylog.no_default = false &&
-			   get_by_level keylog level = [] then
-				__default_logger
-			else
-				keylog
-		else
-			__default_logger in
-	let loggers = get_by_level keylog level in
-	match loggers with
-	| [] -> Printf.kprintf ignore fmt
-	| _  ->
-		let l = List.fold_left (fun acc logger ->	
-			try get_or_open logger :: acc
-			with _ -> acc
-		) [] loggers in
-		let l = List.rev l in
-
-		(* ksprintf is the preferred name for kprintf, but the former
-		 * is not available in OCaml 3.08.3 *)
-		Printf.kprintf (fun s ->
-			List.iter (fun t -> Log.output t ~key ~extra level s) l) fmt
-
-(* define some convenience functions *)
-let debug t ?extra (fmt: ('a , unit, string, unit) format4) =
-	log t Log.Debug ?extra fmt
-let info t ?extra (fmt: ('a , unit, string, unit) format4) =
-	log t Log.Info ?extra fmt
-let warn t ?extra (fmt: ('a , unit, string, unit) format4) =
-	log t Log.Warn ?extra fmt
-let error t ?extra (fmt: ('a , unit, string, unit) format4) =
-	log t Log.Error ?extra fmt
diff -r fa04fbd56521 -r 51288f69523f tools/ocaml/libs/log/logs.mli
--- a/tools/ocaml/libs/log/logs.mli	Mon Oct 10 16:41:16 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-(*
- * Copyright (C) 2006-2007 XenSource Ltd.
- * Copyright (C) 2008      Citrix Ltd.
- * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *)
-
-type keylogger = {
-  mutable debug : string list;
-  mutable info : string list;
-  mutable warn : string list;
-  mutable error : string list;
-  no_default : bool;
-}
-val __all_loggers : (string, Log.t) Hashtbl.t
-val __default_logger : keylogger
-val __log_mapping : (string, keylogger) Hashtbl.t
-val get_or_open : string -> Log.t
-val add : string -> string list -> unit
-val get_by_level : keylogger -> Log.level -> string list
-val set_by_level : keylogger -> Log.level -> string list -> unit
-val set : string -> Log.level -> string list -> unit
-val set_default : Log.level -> string list -> unit
-val append : string -> Log.level -> string -> unit
-val append_default : Log.level -> string -> unit
-val reopen : unit -> unit
-val reclaim : unit -> unit
-val clear : string -> Log.level -> unit
-val clear_default : Log.level -> unit
-val reset_all : string list -> unit
-val log :
-  string ->
-  Log.level -> ?extra:string -> ('a, unit, string, unit) format4 -> 'a
-val debug : string -> ?extra:string -> ('a, unit, string, unit) format4 -> 'a
-val info : string -> ?extra:string -> ('a, unit, string, unit) format4 -> 'a
-val warn : string -> ?extra:string -> ('a, unit, string, unit) format4 -> 'a
-val error : string -> ?extra:string -> ('a, unit, string, unit) format4 -> 'a
diff -r fa04fbd56521 -r 51288f69523f tools/ocaml/libs/log/syslog.ml
--- a/tools/ocaml/libs/log/syslog.ml	Mon Oct 10 16:41:16 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-(*
- * Copyright (C) 2006-2007 XenSource Ltd.
- * Copyright (C) 2008      Citrix Ltd.
- * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *)
-
-type level = Emerg | Alert | Crit | Err | Warning | Notice | Info | Debug
-type options = Cons | Ndelay | Nowait | Odelay | Perror | Pid
-type facility = Auth | Authpriv | Cron | Daemon | Ftp | Kern
-              | Local0 | Local1 | Local2 | Local3
-	      | Local4 | Local5 | Local6 | Local7
-	      | Lpr | Mail | News | Syslog | User | Uucp
-
-(* external init : string -> options list -> facility -> unit = "stub_openlog" *)
-external log : facility -> level -> string -> unit = "stub_syslog"
-external close : unit -> unit = "stub_closelog"
diff -r fa04fbd56521 -r 51288f69523f tools/ocaml/libs/log/syslog.mli
--- a/tools/ocaml/libs/log/syslog.mli	Mon Oct 10 16:41:16 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-(*
- * Copyright (C) 2006-2007 XenSource Ltd.
- * Copyright (C) 2008      Citrix Ltd.
- * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *)
-
-type level = Emerg | Alert | Crit | Err | Warning | Notice | Info | Debug
-type options = Cons | Ndelay | Nowait | Odelay | Perror | Pid
-type facility =
-    Auth
-  | Authpriv
-  | Cron
-  | Daemon
-  | Ftp
-  | Kern
-  | Local0
-  | Local1
-  | Local2
-  | Local3
-  | Local4
-  | Local5
-  | Local6
-  | Local7
-  | Lpr
-  | Mail
-  | News
-  | Syslog
-  | User
-  | Uucp
-external log : facility -> level -> string -> unit = "stub_syslog"
-external close : unit -> unit = "stub_closelog"
diff -r fa04fbd56521 -r 51288f69523f tools/ocaml/libs/log/syslog_stubs.c
--- a/tools/ocaml/libs/log/syslog_stubs.c	Mon Oct 10 16:41:16 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2006-2007 XenSource Ltd.
- * Copyright (C) 2008      Citrix Ltd.
- * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- */
-
-#include <syslog.h>
-#include <caml/mlvalues.h>
-#include <caml/memory.h>
-#include <caml/alloc.h>
-#include <caml/custom.h>
-
-static int __syslog_level_table[] = {
-	LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING,
-	LOG_NOTICE, LOG_INFO, LOG_DEBUG
-};
-
-/*
-static int __syslog_options_table[] = {
-	LOG_CONS, LOG_NDELAY, LOG_NOWAIT, LOG_ODELAY, LOG_PERROR, LOG_PID
-};
-*/
-
-static int __syslog_facility_table[] = {
-	LOG_AUTH, LOG_AUTHPRIV, LOG_CRON, LOG_DAEMON, LOG_FTP, LOG_KERN,
-	LOG_LOCAL0, LOG_LOCAL1, LOG_LOCAL2, LOG_LOCAL3,
-	LOG_LOCAL4, LOG_LOCAL5, LOG_LOCAL6, LOG_LOCAL7,
-	LOG_LPR | LOG_MAIL | LOG_NEWS | LOG_SYSLOG | LOG_USER | LOG_UUCP
-};
-
-/* According to the openlog manpage the 'openlog' call may take a reference
-   to the 'ident' string and keep it long-term. This means we cannot just pass in
-   an ocaml string which is under the control of the GC. Since we aren't actually
-   calling this function we can just comment it out for the time-being. */
-/*
-value stub_openlog(value ident, value option, value facility)
-{
-	CAMLparam3(ident, option, facility);
-	int c_option;
-	int c_facility;
-
-	c_option = caml_convert_flag_list(option, __syslog_options_table);
-	c_facility = __syslog_facility_table[Int_val(facility)];
-	openlog(String_val(ident), c_option, c_facility);
-	CAMLreturn(Val_unit);
-}
-*/
-
-value stub_syslog(value facility, value level, value msg)
-{
-	CAMLparam3(facility, level, msg);
-	int c_facility;
-
-	c_facility = __syslog_facility_table[Int_val(facility)]
-	           | __syslog_level_table[Int_val(level)];
-	syslog(c_facility, "%s", String_val(msg));
-	CAMLreturn(Val_unit);
-}
-
-value stub_closelog(value unit)
-{
-	CAMLparam1(unit);
-	closelog();
-	CAMLreturn(Val_unit);
-}
diff -r fa04fbd56521 -r 51288f69523f tools/ocaml/xenstored/Makefile
--- a/tools/ocaml/xenstored/Makefile	Mon Oct 10 16:41:16 2011 +0100
+++ b/tools/ocaml/xenstored/Makefile	Mon Oct 10 16:41:16 2011 +0100
@@ -3,7 +3,6 @@
 include $(OCAML_TOPLEVEL)/common.make
 
 OCAMLINCLUDE += \
-	-I $(OCAML_TOPLEVEL)/libs/log \
 	-I $(OCAML_TOPLEVEL)/libs/xb \
 	-I $(OCAML_TOPLEVEL)/libs/mmap \
 	-I $(OCAML_TOPLEVEL)/libs/xc \
@@ -34,7 +33,6 @@
 XENSTOREDLIBS = \
 	unix.cmxa \
 	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/mmap $(OCAML_TOPLEVEL)/libs/mmap/xenmmap.cmxa \
-	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/log $(OCAML_TOPLEVEL)/libs/log/log.cmxa \
 	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/eventchn $(OCAML_TOPLEVEL)/libs/eventchn/xeneventchn.cmxa \
 	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/xc $(OCAML_TOPLEVEL)/libs/xc/xenctrl.cmxa \
 	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/xb $(OCAML_TOPLEVEL)/libs/xb/xenbus.cmxa \
diff -r fa04fbd56521 -r 51288f69523f tools/ocaml/xenstored/connection.ml
--- a/tools/ocaml/xenstored/connection.ml	Mon Oct 10 16:41:16 2011 +0100
+++ b/tools/ocaml/xenstored/connection.ml	Mon Oct 10 16:41:16 2011 +0100
@@ -232,3 +232,8 @@
 			Printf.fprintf chan "watch,%d,%s,%s\n" domid (Utils.hexify path) (Utils.hexify token)
 			) (list_watches con);
 	| None -> ()
+
+let debug con =
+	let domid = get_domstr con in
+	let watches = List.map (fun (path, token) -> Printf.sprintf "watch %s: %s %s\n" domid path token) (list_watches con) in
+	String.concat "" watches
diff -r fa04fbd56521 -r 51288f69523f tools/ocaml/xenstored/connections.ml
--- a/tools/ocaml/xenstored/connections.ml	Mon Oct 10 16:41:16 2011 +0100
+++ b/tools/ocaml/xenstored/connections.ml	Mon Oct 10 16:41:16 2011 +0100
@@ -15,7 +15,7 @@
  * GNU Lesser General Public License for more details.
  *)
 
-let debug fmt = Logs.debug "general" fmt
+let debug fmt = Logging.debug "connections" fmt
 
 type t = {
 	mutable anonymous: Connection.t list;
@@ -165,3 +165,8 @@
 	);
 	(List.length cons.anonymous, !nb_ops_anon, !nb_watchs_anon,
 	 Hashtbl.length cons.domains, !nb_ops_dom, !nb_watchs_dom)
+
+let debug cons =
+	let anonymous = List.map Connection.debug cons.anonymous in
+	let domains = Hashtbl.fold (fun _ con accu -> Connection.debug con :: accu) cons.domains [] in
+	String.concat "" (domains @ anonymous)
diff -r fa04fbd56521 -r 51288f69523f tools/ocaml/xenstored/disk.ml
--- a/tools/ocaml/xenstored/disk.ml	Mon Oct 10 16:41:16 2011 +0100
+++ b/tools/ocaml/xenstored/disk.ml	Mon Oct 10 16:41:16 2011 +0100
@@ -17,7 +17,7 @@
 let enable = ref false
 let xs_daemon_database = "/var/run/xenstored/db"
 
-let error = Logs.error "general"
+let error fmt = Logging.error "disk" fmt
 
 (* unescape utils *)
 exception Bad_escape
diff -r fa04fbd56521 -r 51288f69523f tools/ocaml/xenstored/domain.ml
--- a/tools/ocaml/xenstored/domain.ml	Mon Oct 10 16:41:16 2011 +0100
+++ b/tools/ocaml/xenstored/domain.ml	Mon Oct 10 16:41:16 2011 +0100
@@ -16,7 +16,7 @@
 
 open Printf
 
-let debug fmt = Logs.debug "general" fmt
+let debug fmt = Logging.debug "domain" fmt
 
 type t =
 {
diff -r fa04fbd56521 -r 51288f69523f tools/ocaml/xenstored/domains.ml
--- a/tools/ocaml/xenstored/domains.ml	Mon Oct 10 16:41:16 2011 +0100
+++ b/tools/ocaml/xenstored/domains.ml	Mon Oct 10 16:41:16 2011 +0100
@@ -14,6 +14,8 @@
  * GNU Lesser General Public License for more details.
  *)
 
+let debug fmt = Logging.debug "domains" fmt
+
 type domains = {
 	eventchn: Event.t;
 	table: (Xenctrl.domid, Domain.t) Hashtbl.t;
@@ -35,7 +37,7 @@
 		try
 			let info = Xenctrl.domain_getinfo xc id in
 			if info.Xenctrl.shutdown || info.Xenctrl.dying then (
-				Logs.debug "general" "Domain %u died (dying=%b, shutdown %b -- code %d)"
+				debug "Domain %u died (dying=%b, shutdown %b -- code %d)"
 				                    id info.Xenctrl.dying info.Xenctrl.shutdown info.Xenctrl.shutdown_code;
 				if info.Xenctrl.dying then
 					dead_dom := id :: !dead_dom
@@ -43,7 +45,7 @@
 					notify := true;
 			)
 		with Xenctrl.Error _ ->
-			Logs.debug "general" "Domain %u died -- no domain info" id;
+			debug "Domain %u died -- no domain info" id;
 			dead_dom := id :: !dead_dom;
 		) doms.table;
 	List.iter (fun id ->
diff -r fa04fbd56521 -r 51288f69523f tools/ocaml/xenstored/logging.ml
--- a/tools/ocaml/xenstored/logging.ml	Mon Oct 10 16:41:16 2011 +0100
+++ b/tools/ocaml/xenstored/logging.ml	Mon Oct 10 16:41:16 2011 +0100
@@ -17,21 +17,122 @@
 open Stdext
 open Printf
 
-let error fmt = Logs.error "general" fmt
-let info fmt = Logs.info "general" fmt
-let debug fmt = Logs.debug "general" fmt
 
-let access_log_file = ref "/var/log/xenstored-access.log"
-let access_log_nb_files = ref 20
-let access_log_nb_lines = ref 13215
-let activate_access_log = ref true
+(* Logger common *)
 
-(* maximal size of the lines in xenstore-acces.log file *)
-let line_size = 180
+type logger =
+		{ stop: unit -> unit;
+		  restart: unit -> unit;
+		  rotate: unit -> unit;
+		  write: 'a. ('a, unit, string, unit) format4 -> 'a }
 
-let log_read_ops = ref false
-let log_transaction_ops = ref false
-let log_special_ops = ref false
+let truncate_line nb_chars line = 
+	if String.length line > nb_chars - 1 then
+		let len = max (nb_chars - 1) 2 in
+		let dst_line = String.create len in
+		String.blit line 0 dst_line 0 (len - 2);
+		dst_line.[len-2] <- '.'; 
+		dst_line.[len-1] <- '.';
+		dst_line
+	else line
+
+let log_rotate ref_ch log_file log_nb_files =
+	let file n = sprintf "%s.%i" log_file n in
+	let log_files =
+		let rec aux accu n =
+			if n >= log_nb_files then accu
+			else
+				if n = 1 && Sys.file_exists log_file
+				then aux [log_file,1] 2
+				else
+					let file = file (n-1) in
+					if Sys.file_exists file then
+						aux ((file, n) :: accu) (n+1)
+					else accu in
+		aux [] 1 in
+	List.iter (fun (f, n) -> Unix.rename f (file n)) log_files;
+	close_out !ref_ch;
+	ref_ch := open_out log_file
+
+let make_logger log_file log_nb_files log_nb_lines log_nb_chars post_rotate =
+	let channel = ref (open_out_gen [Open_append; Open_creat] 0o644 log_file) in
+	let counter = ref 0 in
+	let stop() =
+		try flush !channel; close_out !channel
+		with _ -> () in
+	let restart() =
+		stop();
+		channel := open_out_gen [Open_append; Open_creat] 0o644 log_file in
+	let rotate() =
+		log_rotate channel log_file log_nb_files;
+		(post_rotate (): unit);
+		counter := 0 in
+	let output s =
+		let s = if log_nb_chars > 0 then truncate_line log_nb_chars s else s in
+		let s = s ^ "\n" in
+		output_string !channel s;
+		flush !channel;
+		incr counter;
+		if !counter > log_nb_lines then rotate() in
+	{ stop=stop; restart=restart; rotate=rotate; write = fun fmt -> Printf.ksprintf output fmt }
+
+
+(* Xenstored logger *) 
+
+exception Unknown_level of string
+
+type level = Debug | Info | Warn | Error | Null
+
+let int_of_level = function
+	| Debug -> 0 | Info -> 1 | Warn -> 2
+	| Error -> 3 | Null -> max_int
+
+let string_of_level = function
+	| Debug -> "debug" | Info -> "info" | Warn -> "warn"
+	| Error -> "error" | Null -> "null"
+
+let level_of_string = function
+	| "debug" -> Debug | "info"  -> Info | "warn"  -> Warn
+	| "error" -> Error | "null"  -> Null | s  -> raise (Unknown_level s)
+
+let string_of_date () =
+	let time = Unix.gettimeofday () in
+	let tm = Unix.gmtime time in
+	let msec = time -. (floor time) in
+	sprintf "%d%.2d%.2dT%.2d:%.2d:%.2d.%.3dZ"
+		(1900 + tm.Unix.tm_year) (tm.Unix.tm_mon + 1) tm.Unix.tm_mday
+		tm.Unix.tm_hour tm.Unix.tm_min tm.Unix.tm_sec
+		(int_of_float (1000.0 *. msec))
+
+let xenstored_log_file = ref "/var/log/xenstored.log"
+let xenstored_log_level = ref Null
+let xenstored_log_nb_files = ref 10
+let xenstored_log_nb_lines = ref 13215
+let xenstored_log_nb_chars = ref (-1)
+let xenstored_logger = ref (None: logger option)
+
+let init_xenstored_log () =
+	if !xenstored_log_level <> Null && !xenstored_log_nb_files > 0 then
+		let logger =
+			make_logger 
+				!xenstored_log_file !xenstored_log_nb_files !xenstored_log_nb_lines
+				!xenstored_log_nb_chars ignore in
+		xenstored_logger := Some logger
+
+let xenstored_logging level key (fmt: (_,_,_,_) format4) =
+	match !xenstored_logger with
+	| Some logger when int_of_level level >= int_of_level !xenstored_log_level ->
+			let date = string_of_date() in
+			let level = string_of_level level in
+			logger.write ("[%s|%5s|%s] " ^^ fmt) date level key
+	| _ -> Printf.ksprintf ignore fmt
+
+let debug key = xenstored_logging Debug key
+let info key = xenstored_logging Info key
+let warn key = xenstored_logging Warn key
+let error key = xenstored_logging Error key
+
+(* Access logger *)
 
 type access_type =
 	| Coalesce
@@ -41,38 +142,10 @@
 	| Endconn
 	| XbOp of Xenbus.Xb.Op.operation
 
-type access =
-	{
-		fd: out_channel ref;
-		counter: int ref;
-		write: tid:int -> con:string -> ?data:string -> access_type -> unit;
-	}
-
-let string_of_date () =
-	let time = Unix.gettimeofday () in
-	let tm = Unix.localtime time in
-	let msec = time -. (floor time) in
-	sprintf "%d%.2d%.2d %.2d:%.2d:%.2d.%.3d" (1900 + tm.Unix.tm_year)
-		(tm.Unix.tm_mon + 1)
-		tm.Unix.tm_mday
-		tm.Unix.tm_hour
-		tm.Unix.tm_min
-		tm.Unix.tm_sec
-		(int_of_float (1000.0 *. msec))
-
-let fill_with_space n s =
-	if String.length s < n
-	then 
-		let r = String.make n ' ' in
-		String.blit s 0  r 0 (String.length s);
-		r
-	else 
-		s
-
 let string_of_tid ~con tid =
 	if tid = 0
-	then fill_with_space 12 (sprintf "%s" con)
-	else fill_with_space 12 (sprintf "%s.%i" con tid)
+	then sprintf "%-12s" con
+	else sprintf "%-12s" (sprintf "%s.%i" con tid)
 
 let string_of_access_type = function
 	| Coalesce                -> "coalesce "
@@ -109,41 +182,9 @@
 
 	| Xenbus.Xb.Op.Error             -> "error    "
 	| Xenbus.Xb.Op.Watchevent        -> "w event  "
-
+	(*
 	| x                       -> Xenbus.Xb.Op.to_string x
-
-let file_exists file =
-	try
-		Unix.close (Unix.openfile file [Unix.O_RDONLY] 0o644);
-		true
-	with _ ->
-		false
-
-let log_rotate fd =
-	let file n = sprintf "%s.%i" !access_log_file n in
-	let log_files =
-		let rec aux accu n =
-			if n >= !access_log_nb_files
-			then accu
-			else if n = 1 && file_exists !access_log_file
-			then aux [!access_log_file,1] 2
-			else
-				let file = file (n-1) in
-				if file_exists file
-				then aux ((file,n) :: accu) (n+1)
-				else accu
-		in
-		aux [] 1
-	in
-	let rec rename = function
-		| (f,n) :: t when n < !access_log_nb_files -> 
-			Unix.rename f (file n);
-			rename t
-		| _ -> ()
-	in
-	rename log_files;
-	close_out !fd;
-	fd := open_out !access_log_file
+	*)
 
 let sanitize_data data =
 	let data = String.copy data in
@@ -154,86 +195,68 @@
 	done;
 	String.escaped data
 
-let make save_to_disk =
-	let fd = ref (open_out_gen [Open_append; Open_creat] 0o644 !access_log_file) in
-	let counter = ref 0 in
-	{
-		fd = fd;
-		counter = counter;
-		write = 
-			if not !activate_access_log || !access_log_nb_files = 0
-			then begin fun ~tid ~con ?data _ -> () end
-			else fun ~tid ~con ?(data="") access_type ->
-				let s = Printf.sprintf "[%s] %s %s %s\n" (string_of_date()) (string_of_tid ~con tid) 
-					(string_of_access_type access_type) (sanitize_data data) in
-				let s =
-					if String.length s > line_size
-					then begin
-						let s = String.sub s 0 line_size in
-						s.[line_size-3] <- '.'; 
-						s.[line_size-2] <- '.';
-						s.[line_size-1] <- '\n';
-						s
-					end else
-						s
-				in
-				incr counter;
-				output_string !fd s;
-				flush !fd;
-				if !counter > !access_log_nb_lines 
-				then begin 
-					log_rotate fd;
-					save_to_disk ();
-					counter := 0;
-				end
-	}
+let activate_access_log = ref true
+let access_log_file = ref "/var/log/xenstored-access.log"
+let access_log_nb_files = ref 20
+let access_log_nb_lines = ref 13215
+let access_log_nb_chars = ref 180
+let access_log_read_ops = ref false
+let access_log_transaction_ops = ref false
+let access_log_special_ops = ref false
+let access_logger = ref None
 
-let access : (access option) ref = ref None
-let init aal save_to_disk =
-	activate_access_log := aal;
-	access := Some (make save_to_disk)
-
-let write_access_log ~con ~tid ?data access_type = 
+let init_access_log post_rotate =
+	if !access_log_nb_files > 0 then
+		let logger =
+			make_logger
+				!access_log_file !access_log_nb_files !access_log_nb_lines
+				!access_log_nb_chars post_rotate in
+		access_logger := Some logger
+ 
+let access_logging ~con ~tid ?(data="") access_type =
         try
-	  maybe (fun a -> a.write access_type ~con ~tid ?data) !access
+		maybe
+			(fun logger ->
+				let date = string_of_date() in
+				let tid = string_of_tid ~con tid in
+				let access_type = string_of_access_type access_type in
+				let data = sanitize_data data in
+				logger.write "[%s] %s %s %s" date tid access_type data)
+			!access_logger
 	with _ -> ()
 
-let new_connection = write_access_log Newconn
-let end_connection = write_access_log Endconn
+let new_connection = access_logging Newconn
+let end_connection = access_logging Endconn
 let read_coalesce ~tid ~con data =
-	if !log_read_ops
-	then write_access_log Coalesce ~tid ~con ~data:("read "^data)
-let write_coalesce data = write_access_log Coalesce ~data:("write "^data)
-let conflict = write_access_log Conflict
-let commit = write_access_log Commit
+	if !access_log_read_ops
+	then access_logging Coalesce ~tid ~con ~data:("read "^data)
+let write_coalesce data = access_logging Coalesce ~data:("write "^data)
+let conflict = access_logging Conflict
+let commit = access_logging Commit
 
 let xb_op ~tid ~con ~ty data =
-	let print =
-	match ty with
-		| Xenbus.Xb.Op.Read | Xenbus.Xb.Op.Directory | Xenbus.Xb.Op.Getperms -> !log_read_ops
+	let print = match ty with
+		| Xenbus.Xb.Op.Read | Xenbus.Xb.Op.Directory | Xenbus.Xb.Op.Getperms -> !access_log_read_ops
 		| Xenbus.Xb.Op.Transaction_start | Xenbus.Xb.Op.Transaction_end ->
 			false (* transactions are managed below *)
 		| Xenbus.Xb.Op.Introduce | Xenbus.Xb.Op.Release | Xenbus.Xb.Op.Getdomainpath | Xenbus.Xb.Op.Isintroduced | Xenbus.Xb.Op.Resume ->
-			!log_special_ops
-		| _ -> true
-	in
-		if print 
-		then write_access_log ~tid ~con ~data (XbOp ty)
+			!access_log_special_ops
+		| _ -> true in
+	if print then access_logging ~tid ~con ~data (XbOp ty)
 
 let start_transaction ~tid ~con = 
-	if !log_transaction_ops && tid <> 0
-	then write_access_log ~tid ~con (XbOp Xenbus.Xb.Op.Transaction_start)
+	if !access_log_transaction_ops && tid <> 0
+	then access_logging ~tid ~con (XbOp Xenbus.Xb.Op.Transaction_start)
 
 let end_transaction ~tid ~con = 
-	if !log_transaction_ops && tid <> 0
-	then write_access_log ~tid ~con (XbOp Xenbus.Xb.Op.Transaction_end)
+	if !access_log_transaction_ops && tid <> 0
+	then access_logging ~tid ~con (XbOp Xenbus.Xb.Op.Transaction_end)
 
 let xb_answer ~tid ~con ~ty data =
 	let print = match ty with
-		| Xenbus.Xb.Op.Error when data="ENOENT " -> !log_read_ops
-		| Xenbus.Xb.Op.Error -> !log_special_ops
+		| Xenbus.Xb.Op.Error when String.startswith "ENOENT " data -> !access_log_read_ops
+		| Xenbus.Xb.Op.Error -> true
 		| Xenbus.Xb.Op.Watchevent -> true
 		| _ -> false
 	in
-		if print
-		then write_access_log ~tid ~con ~data (XbOp ty)
+	if print then access_logging ~tid ~con ~data (XbOp ty)
diff -r fa04fbd56521 -r 51288f69523f tools/ocaml/xenstored/perms.ml
--- a/tools/ocaml/xenstored/perms.ml	Mon Oct 10 16:41:16 2011 +0100
+++ b/tools/ocaml/xenstored/perms.ml	Mon Oct 10 16:41:16 2011 +0100
@@ -15,6 +15,8 @@
  * GNU Lesser General Public License for more details.
  *)
 
+let info fmt = Logging.info "perms" fmt
+
 open Stdext
 
 let activate = ref true
@@ -145,16 +147,16 @@
 		in
 		match perm, request with
 		| NONE, _ ->
-			Logs.info "io" "Permission denied: Domain %d has no permission" domainid;
+			info "Permission denied: Domain %d has no permission" domainid;
 			false
 		| RDWR, _ -> true
 		| READ, READ -> true
 		| WRITE, WRITE -> true
 		| READ, _ ->
-			Logs.info "io" "Permission denied: Domain %d has read only access" domainid;
+			info "Permission denied: Domain %d has read only access" domainid;
 			false
 		| WRITE, _ ->
-			Logs.info "io" "Permission denied: Domain %d has write only access" domainid;
+			info "Permission denied: Domain %d has write only access" domainid;
 			false
 	in
 	if !activate
diff -r fa04fbd56521 -r 51288f69523f tools/ocaml/xenstored/process.ml
--- a/tools/ocaml/xenstored/process.ml	Mon Oct 10 16:41:16 2011 +0100
+++ b/tools/ocaml/xenstored/process.ml	Mon Oct 10 16:41:16 2011 +0100
@@ -14,6 +14,9 @@
  * GNU Lesser General Public License for more details.
  *)
 
+let error fmt = Logging.error "process" fmt
+let info fmt = Logging.info "process" fmt
+
 open Printf
 open Stdext
 
@@ -79,7 +82,7 @@
 
 (* packets *)
 let do_debug con t domains cons data =
-	if not !allow_debug
+	if not (Connection.is_dom0 con) && not !allow_debug
 	then None
 	else try match split None '\000' data with
 	| "print" :: msg :: _ ->
@@ -89,6 +92,9 @@
 		let domid = int_of_string domid in
 		let quota = (Store.get_quota t.Transaction.store) in
 		Some (Quota.to_string quota domid ^ "\000")
+	| "watches" :: _ ->
+		let watches = Connections.debug cons in
+		Some (watches ^ "\000")
 	| "mfn" :: domid :: _ ->
 		let domid = int_of_string domid in
 		let con = Connections.find_domain cons domid in
@@ -357,8 +363,7 @@
 			in
 		input_handle_error ~cons ~doms ~fct ~ty ~con ~t ~rid ~data;
 	with exn ->
-		Logs.error "general" "process packet: %s"
-		          (Printexc.to_string exn);
+		error "process packet: %s" (Printexc.to_string exn);
 		Connection.send_error con tid rid "EIO"
 
 let write_access_log ~ty ~tid ~con ~data =
@@ -372,7 +377,7 @@
 		let packet = Connection.pop_in con in
 		let tid, rid, ty, data = Xenbus.Xb.Packet.unpack packet in
 		(* As we don't log IO, do not call an unnecessary sanitize_data 
-		   Logs.info "io" "[%s] -> [%d] %s \"%s\""
+		   info "[%s] -> [%d] %s \"%s\""
 		         (Connection.get_domstr con) tid
 		         (Xenbus.Xb.Op.to_string ty) (sanitize_data data); *)
 		process_packet ~store ~cons ~doms ~con ~tid ~rid ~ty ~data;
@@ -386,7 +391,7 @@
 			let packet = Connection.peek_output con in
 			let tid, rid, ty, data = Xenbus.Xb.Packet.unpack packet in
 			(* As we don't log IO, do not call an unnecessary sanitize_data 
-			   Logs.info "io" "[%s] <- %s \"%s\""
+			   info "[%s] <- %s \"%s\""
 			         (Connection.get_domstr con)
 			         (Xenbus.Xb.Op.to_string ty) (sanitize_data data);*)
 			write_answer_log ~ty ~tid ~con ~data;
diff -r fa04fbd56521 -r 51288f69523f tools/ocaml/xenstored/quota.ml
--- a/tools/ocaml/xenstored/quota.ml	Mon Oct 10 16:41:16 2011 +0100
+++ b/tools/ocaml/xenstored/quota.ml	Mon Oct 10 16:41:16 2011 +0100
@@ -18,7 +18,7 @@
 exception Data_too_big
 exception Transaction_opened
 
-let warn fmt = Logs.warn "general" fmt
+let warn fmt = Logging.warn "quota" fmt
 let activate = ref true
 let maxent = ref (10000)
 let maxsize = ref (4096)
diff -r fa04fbd56521 -r 51288f69523f tools/ocaml/xenstored/store.ml
--- a/tools/ocaml/xenstored/store.ml	Mon Oct 10 16:41:16 2011 +0100
+++ b/tools/ocaml/xenstored/store.ml	Mon Oct 10 16:41:16 2011 +0100
@@ -83,7 +83,7 @@
 let check_owner node connection =
 	if not (Perms.check_owner connection node.perms)
 	then begin
-		Logs.info "io" "Permission denied: Domain %d not owner" (get_owner node);
+		Logging.info "store|node" "Permission denied: Domain %d not owner" (get_owner node);
 		raise Define.Permission_denied;
 	end
 
diff -r fa04fbd56521 -r 51288f69523f tools/ocaml/xenstored/xenstored.conf
--- a/tools/ocaml/xenstored/xenstored.conf	Mon Oct 10 16:41:16 2011 +0100
+++ b/tools/ocaml/xenstored/xenstored.conf	Mon Oct 10 16:41:16 2011 +0100
@@ -22,9 +22,14 @@
 # Activate filed base backend
 persistant = false
 
-# Logs
-log = error;general;file:/var/log/xenstored.log
-log = warn;general;file:/var/log/xenstored.log
-log = info;general;file:/var/log/xenstored.log
+# Xenstored logs
+# xenstored-log-file = /var/log/xenstored.log
+# xenstored-log-level = null
+# xenstored-log-nb-files = 10
 
-# log = debug;io;file:/var/log/xenstored-io.log
+# Xenstored access logs
+# access-log-file = /var/log/xenstored-access.log
+# access-log-nb-lines = 13215
+# acesss-log-nb-chars = 180
+# access-log-special-ops = false
+
diff -r fa04fbd56521 -r 51288f69523f tools/ocaml/xenstored/xenstored.ml
--- a/tools/ocaml/xenstored/xenstored.ml	Mon Oct 10 16:41:16 2011 +0100
+++ b/tools/ocaml/xenstored/xenstored.ml	Mon Oct 10 16:41:16 2011 +0100
@@ -18,7 +18,10 @@
 open Printf
 open Parse_arg
 open Stdext
-open Logging
+
+let error fmt = Logging.error "xenstored" fmt
+let debug fmt = Logging.debug "xenstored" fmt
+let info fmt = Logging.info "xenstored" fmt
 
 (*------------ event klass processors --------------*)
 let process_connection_fds store cons domains rset wset =
@@ -64,7 +67,8 @@
 		()
 
 let sighup_handler _ =
-	try Logs.reopen (); info "Log re-opened" with _ -> ()
+	maybe (fun logger -> logger.Logging.restart()) !Logging.xenstored_logger;
+	maybe (fun logger -> logger.Logging.restart()) !Logging.access_logger
 
 let config_filename cf =
 	match cf.config_file with
@@ -75,26 +79,6 @@
 
 let parse_config filename =
 	let pidfile = ref default_pidfile in
-	let set_log s =
-		let ls = String.split ~limit:3 ';' s in
-		let level, key, logger = match ls with
-		| [ level; key; logger ] -> level, key, logger
-		| _ -> failwith "format mismatch: expecting 3 arguments" in
-
-		let loglevel = match level with
-		| "debug" -> Log.Debug
-		| "info"  -> Log.Info
-		| "warn"  -> Log.Warn
-		| "error" -> Log.Error
-		| s       -> failwith (sprintf "Unknown log level: %s" s) in
-
-		(* if key is empty, append to the default logger *)
-		let append =
-			if key = "" then
-				Logs.append_default
-			else
-				Logs.append key in
-		append loglevel logger in
 	let options = [
 		("merge-activate", Config.Set_bool Transaction.do_coalesce);
 		("perms-activate", Config.Set_bool Perms.activate);
@@ -104,14 +88,20 @@
 		("quota-maxentity", Config.Set_int Quota.maxent);
 		("quota-maxsize", Config.Set_int Quota.maxsize);
 		("test-eagain", Config.Set_bool Transaction.test_eagain);
-		("log", Config.String set_log);
 		("persistant", Config.Set_bool Disk.enable);
+		("xenstored-log-file", Config.Set_string Logging.xenstored_log_file);
+		("xenstored-log-level", Config.String
+			(fun s -> Logging.xenstored_log_level := Logging.level_of_string s));
+		("xenstored-log-nb-files", Config.Set_int Logging.xenstored_log_nb_files);
+		("xenstored-log-nb-lines", Config.Set_int Logging.xenstored_log_nb_lines);
+		("xenstored-log-nb-chars", Config.Set_int Logging.xenstored_log_nb_chars);
 		("access-log-file", Config.Set_string Logging.access_log_file);
 		("access-log-nb-files", Config.Set_int Logging.access_log_nb_files);
 		("access-log-nb-lines", Config.Set_int Logging.access_log_nb_lines);
-		("access-log-read-ops", Config.Set_bool Logging.log_read_ops);
-		("access-log-transactions-ops", Config.Set_bool Logging.log_transaction_ops);
-		("access-log-special-ops", Config.Set_bool Logging.log_special_ops);
+		("access-log-nb-chars", Config.Set_int Logging.access_log_nb_chars);
+		("access-log-read-ops", Config.Set_bool Logging.access_log_read_ops);
+		("access-log-transactions-ops", Config.Set_bool Logging.access_log_transaction_ops);
+		("access-log-special-ops", Config.Set_bool Logging.access_log_special_ops);
 		("allow-debug", Config.Set_bool Process.allow_debug);
 		("pid-file", Config.Set_string pidfile); ] in
 	begin try Config.read filename options (fun _ _ -> raise Not_found)
@@ -223,9 +213,6 @@
 end
 
 let _ =
-	printf "Xen Storage Daemon, version %d.%d\n%!"
-	       Define.xenstored_major Define.xenstored_minor;
-
 	let cf = do_argv in
 	let pidfile =
 		if Sys.file_exists (config_filename cf) then
@@ -249,13 +236,13 @@
 		in
 	
 	if cf.daemonize then
-		Unixext.daemonize ();
+		Unixext.daemonize ()
+	else
+		printf "Xen Storage Daemon, version %d.%d\n%!" 
+			Define.xenstored_major Define.xenstored_minor;
 
 	(try Unixext.pidfile_write pidfile with _ -> ());
 
-	info "Xen Storage Daemon, version %d.%d"
-	     Define.xenstored_major Define.xenstored_minor;
-
 	(* for compatilibity with old xenstored *)
 	begin match cf.pidfile with
 	| Some pidfile -> Unixext.pidfile_write pidfile
@@ -293,7 +280,14 @@
 	Sys.set_signal Sys.sigusr1 (Sys.Signal_handle (fun i -> sigusr1_handler store));
 	Sys.set_signal Sys.sigpipe Sys.Signal_ignore;
 
-	Logging.init cf.activate_access_log (fun () -> DB.to_file store cons "/var/run/xenstored/db");
+	Logging.init_xenstored_log();
+	if cf.activate_access_log then begin
+		let post_rotate () = DB.to_file store cons "/var/run/xenstored/db" in
+		Logging.init_access_log post_rotate
+	end;
+
+	info "Xen Storage Daemon, version %d.%d"
+	     Define.xenstored_major Define.xenstored_minor;
 
 	let spec_fds =
 		(match rw_sock with None -> [] | Some x -> [ x ]) @

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 10 16:45:29 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 10 Oct 2011 16:45:29 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RDPXE-0000KQ-Rb; Mon, 10 Oct 2011 16:45:29 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RDPW2-0008QF-IX
	for xen-changelog@lists.xensource.com; Mon, 10 Oct 2011 16:44:22 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-174.messagelabs.com!1318290250!34713966!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31328 invoked from network); 10 Oct 2011 23:44:11 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	10 Oct 2011 23:44:11 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RDPVy-0003bK-Eg
	for xen-changelog@lists.xensource.com; Tue, 11 Oct 2011 00:44:10 +0100
Message-Id: <E1RDPVy-0003bK-Eg@xenbits.xen.org>
Date: Tue, 11 Oct 2011 00:44:09 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/ocaml: Rename the ocaml
	libraries
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 Jon Ludlam <jonathan.ludlam@eu.citrix.com>
# Date 1318261027 -3600
# Node ID cdb34816a40a2dd3aaf324f7dcba83a122cf9146
# Parent  72f339bc600d7a9629d3f9eb8a279fbf8be25b12
tools/ocaml: Rename the ocaml libraries

ocamlfind does not support namespaces, so to avoid
name clashes the module names have become longer.
Additionally, the xenstore and xenbus subdirs, which
contain several modules each, have been packed into
toplevel Xenstore and Xenbus modules.

xb becomes xenbus, xc becomes xenctrl, xl becomes xenlight,
xs becomes xenstore, eventchn becomes xeneventchn and
mmap becomes xenmmap.

[ Patch modified from that submitted, to update the .hgignore, and to
  cope with intervening changes to mmap_stubs.c -iwj ]

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 72f339bc600d -r cdb34816a40a .hgignore
--- a/.hgignore	Mon Oct 10 11:21:51 2011 +0100
+++ b/.hgignore	Mon Oct 10 16:37:07 2011 +0100
@@ -301,8 +301,8 @@
 ^tools/ocaml/libs/xl/_libxl_types\.ml\.in$
 ^tools/ocaml/libs/xl/_libxl_types\.mli\.in$
 ^tools/ocaml/libs/xl/_libxl_types\.inc$
-^tools/ocaml/libs/xl/xl\.ml$
-^tools/ocaml/libs/xl/xl\.mli$
+^tools/ocaml/libs/xl/xenlight\.ml$
+^tools/ocaml/libs/xl/xenlight\.mli$
 ^tools/ocaml/xenstored/oxenstored$
 ^xen/\.banner.*$
 ^xen/BLOG$
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/eventchn/META.in
--- a/tools/ocaml/libs/eventchn/META.in	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/libs/eventchn/META.in	Mon Oct 10 16:37:07 2011 +0100
@@ -1,5 +1,5 @@
 version = "@VERSION@"
 description = "Eventchn interface extension"
 requires = "unix"
-archive(byte) = "eventchn.cma"
-archive(native) = "eventchn.cmxa"
+archive(byte) = "xeneventchn.cma"
+archive(native) = "xeneventchn.cmxa"
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/eventchn/Makefile
--- a/tools/ocaml/libs/eventchn/Makefile	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/libs/eventchn/Makefile	Mon Oct 10 16:37:07 2011 +0100
@@ -4,11 +4,11 @@
 
 CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_xeninclude)
 
-OBJS = eventchn
+OBJS = xeneventchn
 INTF = $(foreach obj, $(OBJS),$(obj).cmi)
-LIBS = eventchn.cma eventchn.cmxa
+LIBS = xeneventchn.cma xeneventchn.cmxa
 
-LIBS_evtchn = $(LDLIBS_libxenctrl)
+LIBS_xeneventchn = $(LDLIBS_libxenctrl)
 
 all: $(INTF) $(LIBS) $(PROGRAMS)
 
@@ -16,20 +16,20 @@
 
 libs: $(LIBS)
 
-eventchn_OBJS = $(OBJS)
-eventchn_C_OBJS = eventchn_stubs
+xeneventchn_OBJS = $(OBJS)
+xeneventchn_C_OBJS = xeneventchn_stubs
 
-OCAML_LIBRARY = eventchn
+OCAML_LIBRARY = xeneventchn
 
 .PHONY: install
 install: $(LIBS) META
 	mkdir -p $(OCAMLDESTDIR)
-	ocamlfind remove -destdir $(OCAMLDESTDIR) eventchn
-	ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore eventchn META $(INTF) $(LIBS) *.a *.so *.cmx
+	ocamlfind remove -destdir $(OCAMLDESTDIR) xeneventchn
+	ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xeneventchn META $(INTF) $(LIBS) *.a *.so *.cmx
 
 .PHONY: uninstall
 uninstall:
-	ocamlfind remove -destdir $(OCAMLDESTDIR) eventchn
+	ocamlfind remove -destdir $(OCAMLDESTDIR) xeneventchn
 
 include $(TOPLEVEL)/Makefile.rules
 
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/eventchn/eventchn.ml
--- a/tools/ocaml/libs/eventchn/eventchn.ml	Mon Oct 10 11:21:51 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-(*
- * Copyright (C) 2006-2007 XenSource Ltd.
- * Copyright (C) 2008      Citrix Ltd.
- * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *)
-
-exception Error of string
-
-type handle
-
-external init: unit -> handle = "stub_eventchn_init"
-external fd: handle -> Unix.file_descr = "stub_eventchn_fd"
-external notify: handle -> int -> unit = "stub_eventchn_notify"
-external bind_interdomain: handle -> int -> int -> int = "stub_eventchn_bind_interdomain"
-external bind_dom_exc_virq: handle -> int = "stub_eventchn_bind_dom_exc_virq"
-external unbind: handle -> int -> unit = "stub_eventchn_unbind"
-external pending: handle -> int = "stub_eventchn_pending"
-external unmask: handle -> int -> unit = "stub_eventchn_unmask"
-
-let _ = Callback.register_exception "eventchn.error" (Error "register_callback")
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/eventchn/eventchn.mli
--- a/tools/ocaml/libs/eventchn/eventchn.mli	Mon Oct 10 11:21:51 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-(*
- * Copyright (C) 2006-2007 XenSource Ltd.
- * Copyright (C) 2008      Citrix Ltd.
- * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *)
-
-exception Error of string
-
-type handle
-
-external init : unit -> handle = "stub_eventchn_init"
-external fd: handle -> Unix.file_descr = "stub_eventchn_fd"
-
-external notify : handle -> int -> unit = "stub_eventchn_notify"
-external bind_interdomain : handle -> int -> int -> int
-  = "stub_eventchn_bind_interdomain"
-external bind_dom_exc_virq : handle -> int = "stub_eventchn_bind_dom_exc_virq"
-external unbind : handle -> int -> unit = "stub_eventchn_unbind"
-external pending : handle -> int = "stub_eventchn_pending"
-external unmask : handle -> int -> unit
-  = "stub_eventchn_unmask"
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/eventchn/eventchn_stubs.c
--- a/tools/ocaml/libs/eventchn/eventchn_stubs.c	Mon Oct 10 11:21:51 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-/*
- * Copyright (C) 2006-2007 XenSource Ltd.
- * Copyright (C) 2008      Citrix Ltd.
- * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include <stdint.h>
-#include <sys/ioctl.h>
-#include <xen/sysctl.h>
-#include <xen/xen.h>
-#include <xen/sys/evtchn.h>
-#include <xenctrl.h>
-
-#define CAML_NAME_SPACE
-#include <caml/mlvalues.h>
-#include <caml/memory.h>
-#include <caml/alloc.h>
-#include <caml/custom.h>
-#include <caml/callback.h>
-#include <caml/fail.h>
-
-#define _H(__h) ((xc_interface *)(__h))
-
-CAMLprim value stub_eventchn_init(void)
-{
-	CAMLparam0();
-	CAMLlocal1(result);
-
-	xc_interface *xce = xc_evtchn_open(NULL, XC_OPENFLAG_NON_REENTRANT);
-	if (xce == NULL)
-		caml_failwith("open failed");
-
-	result = (value)xce;
-	CAMLreturn(result);
-}
-
-CAMLprim value stub_eventchn_fd(value xce)
-{
-	CAMLparam1(xce);
-	CAMLlocal1(result);
-	int fd;
-
-	fd = xc_evtchn_fd(_H(xce));
-	if (fd == -1)
-		caml_failwith("evtchn fd failed");
-
-	result = Val_int(fd);
-
-	CAMLreturn(result);
-}
-
-CAMLprim value stub_eventchn_notify(value xce, value port)
-{
-	CAMLparam2(xce, port);
-	int rc;
-
-	rc = xc_evtchn_notify(_H(xce), Int_val(port));
-	if (rc == -1)
-		caml_failwith("evtchn notify failed");
-
-	CAMLreturn(Val_unit);
-}
-
-CAMLprim value stub_eventchn_bind_interdomain(value xce, value domid,
-                                              value remote_port)
-{
-	CAMLparam3(xce, domid, remote_port);
-	CAMLlocal1(port);
-	evtchn_port_or_error_t rc;
-
-	rc = xc_evtchn_bind_interdomain(_H(xce), Int_val(domid), Int_val(remote_port));
-	if (rc == -1)
-		caml_failwith("evtchn bind_interdomain failed");
-	port = Val_int(rc);
-
-	CAMLreturn(port);
-}
-
-CAMLprim value stub_eventchn_bind_dom_exc_virq(value xce)
-{
-	CAMLparam1(xce);
-	CAMLlocal1(port);
-	evtchn_port_or_error_t rc;
-
-	rc = xc_evtchn_bind_virq(_H(xce), VIRQ_DOM_EXC);
-	if (rc == -1)
-		caml_failwith("evtchn bind_dom_exc_virq failed");
-	port = Val_int(rc);
-
-	CAMLreturn(port);
-}
-
-CAMLprim value stub_eventchn_unbind(value xce, value port)
-{
-	CAMLparam2(xce, port);
-	int rc;
-
-	rc = xc_evtchn_unbind(_H(xce), Int_val(port));
-	if (rc == -1)
-		caml_failwith("evtchn unbind failed");
-
-	CAMLreturn(Val_unit);
-}
-
-CAMLprim value stub_eventchn_pending(value xce)
-{
-	CAMLparam1(xce);
-	CAMLlocal1(result);
-	evtchn_port_or_error_t port;
-
-	port = xc_evtchn_pending(_H(xce));
-	if (port == -1)
-		caml_failwith("evtchn pending failed");
-	result = Val_int(port);
-
-	CAMLreturn(result);
-}
-
-CAMLprim value stub_eventchn_unmask(value xce, value _port)
-{
-	CAMLparam2(xce, _port);
-	evtchn_port_t port;
-
-	port = Int_val(_port);
-	if (xc_evtchn_unmask(_H(xce), port))
-		caml_failwith("evtchn unmask failed");
-	CAMLreturn(Val_unit);
-}
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/eventchn/xeneventchn.ml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/ocaml/libs/eventchn/xeneventchn.ml	Mon Oct 10 16:37:07 2011 +0100
@@ -0,0 +1,30 @@
+(*
+ * Copyright (C) 2006-2007 XenSource Ltd.
+ * Copyright (C) 2008      Citrix Ltd.
+ * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *)
+
+exception Error of string
+
+type handle
+
+external init: unit -> handle = "stub_eventchn_init"
+external fd: handle -> Unix.file_descr = "stub_eventchn_fd"
+external notify: handle -> int -> unit = "stub_eventchn_notify"
+external bind_interdomain: handle -> int -> int -> int = "stub_eventchn_bind_interdomain"
+external bind_dom_exc_virq: handle -> int = "stub_eventchn_bind_dom_exc_virq"
+external unbind: handle -> int -> unit = "stub_eventchn_unbind"
+external pending: handle -> int = "stub_eventchn_pending"
+external unmask: handle -> int -> unit = "stub_eventchn_unmask"
+
+let _ = Callback.register_exception "eventchn.error" (Error "register_callback")
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/eventchn/xeneventchn.mli
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/ocaml/libs/eventchn/xeneventchn.mli	Mon Oct 10 16:37:07 2011 +0100
@@ -0,0 +1,31 @@
+(*
+ * Copyright (C) 2006-2007 XenSource Ltd.
+ * Copyright (C) 2008      Citrix Ltd.
+ * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *)
+
+exception Error of string
+
+type handle
+
+external init : unit -> handle = "stub_eventchn_init"
+external fd: handle -> Unix.file_descr = "stub_eventchn_fd"
+
+external notify : handle -> int -> unit = "stub_eventchn_notify"
+external bind_interdomain : handle -> int -> int -> int
+  = "stub_eventchn_bind_interdomain"
+external bind_dom_exc_virq : handle -> int = "stub_eventchn_bind_dom_exc_virq"
+external unbind : handle -> int -> unit = "stub_eventchn_unbind"
+external pending : handle -> int = "stub_eventchn_pending"
+external unmask : handle -> int -> unit
+  = "stub_eventchn_unmask"
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/eventchn/xeneventchn_stubs.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c	Mon Oct 10 16:37:07 2011 +0100
@@ -0,0 +1,143 @@
+/*
+ * Copyright (C) 2006-2007 XenSource Ltd.
+ * Copyright (C) 2008      Citrix Ltd.
+ * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+#include <stdint.h>
+#include <sys/ioctl.h>
+#include <xen/sysctl.h>
+#include <xen/xen.h>
+#include <xen/sys/evtchn.h>
+#include <xenctrl.h>
+
+#define CAML_NAME_SPACE
+#include <caml/mlvalues.h>
+#include <caml/memory.h>
+#include <caml/alloc.h>
+#include <caml/custom.h>
+#include <caml/callback.h>
+#include <caml/fail.h>
+
+#define _H(__h) ((xc_interface *)(__h))
+
+CAMLprim value stub_eventchn_init(void)
+{
+	CAMLparam0();
+	CAMLlocal1(result);
+
+	xc_interface *xce = xc_evtchn_open(NULL, XC_OPENFLAG_NON_REENTRANT);
+	if (xce == NULL)
+		caml_failwith("open failed");
+
+	result = (value)xce;
+	CAMLreturn(result);
+}
+
+CAMLprim value stub_eventchn_fd(value xce)
+{
+	CAMLparam1(xce);
+	CAMLlocal1(result);
+	int fd;
+
+	fd = xc_evtchn_fd(_H(xce));
+	if (fd == -1)
+		caml_failwith("evtchn fd failed");
+
+	result = Val_int(fd);
+
+	CAMLreturn(result);
+}
+
+CAMLprim value stub_eventchn_notify(value xce, value port)
+{
+	CAMLparam2(xce, port);
+	int rc;
+
+	rc = xc_evtchn_notify(_H(xce), Int_val(port));
+	if (rc == -1)
+		caml_failwith("evtchn notify failed");
+
+	CAMLreturn(Val_unit);
+}
+
+CAMLprim value stub_eventchn_bind_interdomain(value xce, value domid,
+                                              value remote_port)
+{
+	CAMLparam3(xce, domid, remote_port);
+	CAMLlocal1(port);
+	evtchn_port_or_error_t rc;
+
+	rc = xc_evtchn_bind_interdomain(_H(xce), Int_val(domid), Int_val(remote_port));
+	if (rc == -1)
+		caml_failwith("evtchn bind_interdomain failed");
+	port = Val_int(rc);
+
+	CAMLreturn(port);
+}
+
+CAMLprim value stub_eventchn_bind_dom_exc_virq(value xce)
+{
+	CAMLparam1(xce);
+	CAMLlocal1(port);
+	evtchn_port_or_error_t rc;
+
+	rc = xc_evtchn_bind_virq(_H(xce), VIRQ_DOM_EXC);
+	if (rc == -1)
+		caml_failwith("evtchn bind_dom_exc_virq failed");
+	port = Val_int(rc);
+
+	CAMLreturn(port);
+}
+
+CAMLprim value stub_eventchn_unbind(value xce, value port)
+{
+	CAMLparam2(xce, port);
+	int rc;
+
+	rc = xc_evtchn_unbind(_H(xce), Int_val(port));
+	if (rc == -1)
+		caml_failwith("evtchn unbind failed");
+
+	CAMLreturn(Val_unit);
+}
+
+CAMLprim value stub_eventchn_pending(value xce)
+{
+	CAMLparam1(xce);
+	CAMLlocal1(result);
+	evtchn_port_or_error_t port;
+
+	port = xc_evtchn_pending(_H(xce));
+	if (port == -1)
+		caml_failwith("evtchn pending failed");
+	result = Val_int(port);
+
+	CAMLreturn(result);
+}
+
+CAMLprim value stub_eventchn_unmask(value xce, value _port)
+{
+	CAMLparam2(xce, _port);
+	evtchn_port_t port;
+
+	port = Int_val(_port);
+	if (xc_evtchn_unmask(_H(xce), port))
+		caml_failwith("evtchn unmask failed");
+	CAMLreturn(Val_unit);
+}
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/mmap/META.in
--- a/tools/ocaml/libs/mmap/META.in	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/libs/mmap/META.in	Mon Oct 10 16:37:07 2011 +0100
@@ -1,4 +1,4 @@
 version = "@VERSION@"
 description = "Mmap interface extension"
-archive(byte) = "mmap.cma"
-archive(native) = "mmap.cmxa"
+archive(byte) = "xenmmap.cma"
+archive(native) = "xenmmap.cmxa"
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/mmap/Makefile
--- a/tools/ocaml/libs/mmap/Makefile	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/libs/mmap/Makefile	Mon Oct 10 16:37:07 2011 +0100
@@ -2,9 +2,9 @@
 XEN_ROOT=$(TOPLEVEL)/../..
 include $(TOPLEVEL)/common.make
 
-OBJS = mmap
+OBJS = xenmmap
 INTF = $(foreach obj, $(OBJS),$(obj).cmi)
-LIBS = mmap.cma mmap.cmxa
+LIBS = xenmmap.cma xenmmap.cmxa
 
 all: $(INTF) $(LIBS) $(PROGRAMS)
 
@@ -12,19 +12,19 @@
 
 libs: $(LIBS)
 
-mmap_OBJS = $(OBJS)
-mmap_C_OBJS = mmap_stubs
-OCAML_LIBRARY = mmap
+xenmmap_OBJS = $(OBJS)
+xenmmap_C_OBJS = xenmmap_stubs
+OCAML_LIBRARY = xenmmap
 
 .PHONY: install
 install: $(LIBS) META
 	mkdir -p $(OCAMLDESTDIR)
-	ocamlfind remove -destdir $(OCAMLDESTDIR) mmap
-	ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore mmap META $(INTF) $(LIBS) *.a *.so *.cmx
+	ocamlfind remove -destdir $(OCAMLDESTDIR) xenmmap
+	ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xenmmap META $(INTF) $(LIBS) *.a *.so *.cmx
 
 .PHONY: uninstall
 uninstall:
-	ocamlfind remove -destdir $(OCAMLDESTDIR) mmap
+	ocamlfind remove -destdir $(OCAMLDESTDIR) xenmmap
 
 include $(TOPLEVEL)/Makefile.rules
 
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/mmap/mmap.ml
--- a/tools/ocaml/libs/mmap/mmap.ml	Mon Oct 10 11:21:51 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-(*
- * Copyright (C) 2006-2007 XenSource Ltd.
- * Copyright (C) 2008      Citrix Ltd.
- * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *)
-
-type mmap_interface
-
-type mmap_prot_flag = RDONLY | WRONLY | RDWR
-type mmap_map_flag = SHARED | PRIVATE
-
-(* mmap: fd -> prot_flag -> map_flag -> length -> offset -> interface *)
-external mmap: Unix.file_descr -> mmap_prot_flag -> mmap_map_flag
-		-> int -> int -> mmap_interface = "stub_mmap_init"
-external unmap: mmap_interface -> unit = "stub_mmap_final"
-(* read: interface -> start -> length -> data *)
-external read: mmap_interface -> int -> int -> string = "stub_mmap_read"
-(* write: interface -> data -> start -> length -> unit *)
-external write: mmap_interface -> string -> int -> int -> unit = "stub_mmap_write"
-(* getpagesize: unit -> size of page *)
-external getpagesize: unit -> int = "stub_mmap_getpagesize"
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/mmap/mmap.mli
--- a/tools/ocaml/libs/mmap/mmap.mli	Mon Oct 10 11:21:51 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-(*
- * Copyright (C) 2006-2007 XenSource Ltd.
- * Copyright (C) 2008      Citrix Ltd.
- * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *)
-
-type mmap_interface
-type mmap_prot_flag = RDONLY | WRONLY | RDWR
-type mmap_map_flag = SHARED | PRIVATE
-
-external mmap : Unix.file_descr -> mmap_prot_flag -> mmap_map_flag -> int -> int
-             -> mmap_interface = "stub_mmap_init"
-external unmap : mmap_interface -> unit = "stub_mmap_final"
-external read : mmap_interface -> int -> int -> string = "stub_mmap_read"
-external write : mmap_interface -> string -> int -> int -> unit
-               = "stub_mmap_write"
-
-external getpagesize : unit -> int = "stub_mmap_getpagesize"
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/mmap/mmap_stubs.c
--- a/tools/ocaml/libs/mmap/mmap_stubs.c	Mon Oct 10 11:21:51 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-/*
- * Copyright (C) 2006-2007 XenSource Ltd.
- * Copyright (C) 2008      Citrix Ltd.
- * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- */
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/mman.h>
-#include <string.h>
-#include <errno.h>
-#include "mmap_stubs.h"
-
-#include <caml/mlvalues.h>
-#include <caml/memory.h>
-#include <caml/alloc.h>
-#include <caml/custom.h>
-#include <caml/fail.h>
-#include <caml/callback.h>
-
-#define Intf_val(a) ((struct mmap_interface *) a)
-
-static int mmap_interface_init(struct mmap_interface *intf,
-                               int fd, int pflag, int mflag,
-                               int len, int offset)
-{
-	intf->len = len;
-	intf->addr = mmap(NULL, len, pflag, mflag, fd, offset);
-	return (intf->addr == MAP_FAILED) ? errno : 0;
-}
-
-CAMLprim value stub_mmap_init(value fd, value pflag, value mflag,
-                              value len, value offset)
-{
-	CAMLparam5(fd, pflag, mflag, len, offset);
-	CAMLlocal1(result);
-	int c_pflag, c_mflag;
-
-	switch (Int_val(pflag)) {
-	case 0: c_pflag = PROT_READ; break;
-	case 1: c_pflag = PROT_WRITE; break;
-	case 2: c_pflag = PROT_READ|PROT_WRITE; break;
-	default: caml_invalid_argument("protectiontype");
-	}
-
-	switch (Int_val(mflag)) {
-	case 0: c_mflag = MAP_SHARED; break;
-	case 1: c_mflag = MAP_PRIVATE; break;
-	default: caml_invalid_argument("maptype");
-	}
-
-	result = caml_alloc(sizeof(struct mmap_interface), Abstract_tag);
-
-	if (mmap_interface_init(Intf_val(result), Int_val(fd),
-	                        c_pflag, c_mflag,
-	                        Int_val(len), Int_val(offset)))
-		caml_failwith("mmap");
-	CAMLreturn(result);
-}
-
-CAMLprim value stub_mmap_final(value intf)
-{
-	CAMLparam1(intf);
-
-	if (Intf_val(intf)->addr != MAP_FAILED)
-		munmap(Intf_val(intf)->addr, Intf_val(intf)->len);
-	Intf_val(intf)->addr = MAP_FAILED;
-
-	CAMLreturn(Val_unit);
-}
-
-CAMLprim value stub_mmap_read(value intf, value start, value len)
-{
-	CAMLparam3(intf, start, len);
-	CAMLlocal1(data);
-	int c_start;
-	int c_len;
-
-	c_start = Int_val(start);
-	c_len = Int_val(len);
-
-	if (c_start > Intf_val(intf)->len)
-		caml_invalid_argument("start invalid");
-	if (c_start + c_len > Intf_val(intf)->len)
-		caml_invalid_argument("len invalid");
-
-	data = caml_alloc_string(c_len);
-	memcpy((char *) data, Intf_val(intf)->addr + c_start, c_len);
-
-	CAMLreturn(data);
-}
-
-CAMLprim value stub_mmap_write(value intf, value data,
-                               value start, value len)
-{
-	CAMLparam4(intf, data, start, len);
-	int c_start;
-	int c_len;
-
-	c_start = Int_val(start);
-	c_len = Int_val(len);
-
-	if (c_start > Intf_val(intf)->len)
-		caml_invalid_argument("start invalid");
-	if (c_start + c_len > Intf_val(intf)->len)
-		caml_invalid_argument("len invalid");
-
-	memcpy(Intf_val(intf)->addr + c_start, (char *) data, c_len);
-
-	CAMLreturn(Val_unit);
-}
-
-CAMLprim value stub_mmap_getpagesize(value unit)
-{
-	CAMLparam1(unit);
-	CAMLlocal1(data);
-
-	data = Val_int(getpagesize());
-	CAMLreturn(data);
-}
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/mmap/xenmmap.ml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/ocaml/libs/mmap/xenmmap.ml	Mon Oct 10 16:37:07 2011 +0100
@@ -0,0 +1,31 @@
+(*
+ * Copyright (C) 2006-2007 XenSource Ltd.
+ * Copyright (C) 2008      Citrix Ltd.
+ * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *)
+
+type mmap_interface
+
+type mmap_prot_flag = RDONLY | WRONLY | RDWR
+type mmap_map_flag = SHARED | PRIVATE
+
+(* mmap: fd -> prot_flag -> map_flag -> length -> offset -> interface *)
+external mmap: Unix.file_descr -> mmap_prot_flag -> mmap_map_flag
+		-> int -> int -> mmap_interface = "stub_mmap_init"
+external unmap: mmap_interface -> unit = "stub_mmap_final"
+(* read: interface -> start -> length -> data *)
+external read: mmap_interface -> int -> int -> string = "stub_mmap_read"
+(* write: interface -> data -> start -> length -> unit *)
+external write: mmap_interface -> string -> int -> int -> unit = "stub_mmap_write"
+(* getpagesize: unit -> size of page *)
+external getpagesize: unit -> int = "stub_mmap_getpagesize"
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/mmap/xenmmap.mli
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/ocaml/libs/mmap/xenmmap.mli	Mon Oct 10 16:37:07 2011 +0100
@@ -0,0 +1,28 @@
+(*
+ * Copyright (C) 2006-2007 XenSource Ltd.
+ * Copyright (C) 2008      Citrix Ltd.
+ * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *)
+
+type mmap_interface
+type mmap_prot_flag = RDONLY | WRONLY | RDWR
+type mmap_map_flag = SHARED | PRIVATE
+
+external mmap : Unix.file_descr -> mmap_prot_flag -> mmap_map_flag -> int -> int
+             -> mmap_interface = "stub_mmap_init"
+external unmap : mmap_interface -> unit = "stub_mmap_final"
+external read : mmap_interface -> int -> int -> string = "stub_mmap_read"
+external write : mmap_interface -> string -> int -> int -> unit
+               = "stub_mmap_write"
+
+external getpagesize : unit -> int = "stub_mmap_getpagesize"
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/mmap/xenmmap_stubs.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/ocaml/libs/mmap/xenmmap_stubs.c	Mon Oct 10 16:37:07 2011 +0100
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) 2006-2007 XenSource Ltd.
+ * Copyright (C) 2008      Citrix Ltd.
+ * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ */
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/mman.h>
+#include <string.h>
+#include <errno.h>
+#include "mmap_stubs.h"
+
+#include <caml/mlvalues.h>
+#include <caml/memory.h>
+#include <caml/alloc.h>
+#include <caml/custom.h>
+#include <caml/fail.h>
+#include <caml/callback.h>
+
+#define Intf_val(a) ((struct mmap_interface *) a)
+
+static int mmap_interface_init(struct mmap_interface *intf,
+                               int fd, int pflag, int mflag,
+                               int len, int offset)
+{
+	intf->len = len;
+	intf->addr = mmap(NULL, len, pflag, mflag, fd, offset);
+	return (intf->addr == MAP_FAILED) ? errno : 0;
+}
+
+CAMLprim value stub_mmap_init(value fd, value pflag, value mflag,
+                              value len, value offset)
+{
+	CAMLparam5(fd, pflag, mflag, len, offset);
+	CAMLlocal1(result);
+	int c_pflag, c_mflag;
+
+	switch (Int_val(pflag)) {
+	case 0: c_pflag = PROT_READ; break;
+	case 1: c_pflag = PROT_WRITE; break;
+	case 2: c_pflag = PROT_READ|PROT_WRITE; break;
+	default: caml_invalid_argument("protectiontype");
+	}
+
+	switch (Int_val(mflag)) {
+	case 0: c_mflag = MAP_SHARED; break;
+	case 1: c_mflag = MAP_PRIVATE; break;
+	default: caml_invalid_argument("maptype");
+	}
+
+	result = caml_alloc(sizeof(struct mmap_interface), Abstract_tag);
+
+	if (mmap_interface_init(Intf_val(result), Int_val(fd),
+	                        c_pflag, c_mflag,
+	                        Int_val(len), Int_val(offset)))
+		caml_failwith("mmap");
+	CAMLreturn(result);
+}
+
+CAMLprim value stub_mmap_final(value intf)
+{
+	CAMLparam1(intf);
+
+	if (Intf_val(intf)->addr != MAP_FAILED)
+		munmap(Intf_val(intf)->addr, Intf_val(intf)->len);
+	Intf_val(intf)->addr = MAP_FAILED;
+
+	CAMLreturn(Val_unit);
+}
+
+CAMLprim value stub_mmap_read(value intf, value start, value len)
+{
+	CAMLparam3(intf, start, len);
+	CAMLlocal1(data);
+	int c_start;
+	int c_len;
+
+	c_start = Int_val(start);
+	c_len = Int_val(len);
+
+	if (c_start > Intf_val(intf)->len)
+		caml_invalid_argument("start invalid");
+	if (c_start + c_len > Intf_val(intf)->len)
+		caml_invalid_argument("len invalid");
+
+	data = caml_alloc_string(c_len);
+	memcpy((char *) data, Intf_val(intf)->addr + c_start, c_len);
+
+	CAMLreturn(data);
+}
+
+CAMLprim value stub_mmap_write(value intf, value data,
+                               value start, value len)
+{
+	CAMLparam4(intf, data, start, len);
+	int c_start;
+	int c_len;
+
+	c_start = Int_val(start);
+	c_len = Int_val(len);
+
+	if (c_start > Intf_val(intf)->len)
+		caml_invalid_argument("start invalid");
+	if (c_start + c_len > Intf_val(intf)->len)
+		caml_invalid_argument("len invalid");
+
+	memcpy(Intf_val(intf)->addr + c_start, (char *) data, c_len);
+
+	CAMLreturn(Val_unit);
+}
+
+CAMLprim value stub_mmap_getpagesize(value unit)
+{
+	CAMLparam1(unit);
+	CAMLlocal1(data);
+
+	data = Val_int(getpagesize());
+	CAMLreturn(data);
+}
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xb/META.in
--- a/tools/ocaml/libs/xb/META.in	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/libs/xb/META.in	Mon Oct 10 16:37:07 2011 +0100
@@ -1,5 +1,5 @@
 version = "@VERSION@"
 description = "XenBus Interface"
-requires = "unix,mmap"
-archive(byte) = "xb.cma"
-archive(native) = "xb.cmxa"
+requires = "unix,xenmmap"
+archive(byte) = "xenbus.cma"
+archive(native) = "xenbus.cmxa"
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xb/Makefile
--- a/tools/ocaml/libs/xb/Makefile	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/libs/xb/Makefile	Mon Oct 10 16:37:07 2011 +0100
@@ -6,6 +6,7 @@
 CFLAGS += $(CFLAGS_libxenctrl) # For xen_mb()
 CFLAGS += $(CFLAGS_xeninclude)
 OCAMLINCLUDE += -I ../mmap
+OCAMLOPTFLAGS += -for-pack Xenbus
 
 .NOTPARALLEL:
 # Ocaml is such a PITA!
@@ -15,7 +16,7 @@
 PRELIBS = $(foreach obj, $(PREOBJS),$(obj).cmo) $(foreach obj,$(PREOJBS),$(obj).cmx)
 OBJS = op partial packet xs_ring xb
 INTF = op.cmi packet.cmi xb.cmi
-LIBS = xb.cma xb.cmxa
+LIBS = xenbus.cma xenbus.cmxa
 
 ALL_OCAML_OBJS = $(OBJS) $(PREOJBS)
 
@@ -25,22 +26,30 @@
 
 libs: $(LIBS)
 
-xb_OBJS = $(OBJS)
-xb_C_OBJS = xs_ring_stubs xb_stubs
-OCAML_LIBRARY = xb
+xenbus_OBJS = xenbus
+xenbus_C_OBJS = xs_ring_stubs xenbus_stubs
+OCAML_LIBRARY = xenbus
+
+xenbus.cmx : $(foreach obj, $(OBJS), $(obj).cmx)
+	$(E) " CMX       $@"
+	$(OCAMLOPT) -pack -o $@ $^
+
+xenbus.cmo : $(foreach obj, $(OBJS), $(obj).cmo)
+	$(E) " CMO       $@"
+	$(OCAMLC) -pack -o $@ $^
 
 %.mli: %.ml
 	$(E) " MLI       $@"
-	$(Q)$(OCAMLC) -i $< $o
+	$(Q)$(OCAMLC) $(OCAMLINCLUDE) -i $< $o
 
 .PHONY: install
 install: $(LIBS) META
 	mkdir -p $(OCAMLDESTDIR)
-	ocamlfind remove -destdir $(OCAMLDESTDIR) xb
-	ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xb META $(INTF) $(LIBS) *.a *.so *.cmx
+	ocamlfind remove -destdir $(OCAMLDESTDIR) xenbus
+	ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xenbus META $(LIBS) xenbus.cmo xenbus.cmi xenbus.cmx *.a *.so 
 
 .PHONY: uninstall
 uninstall:
-	ocamlfind remove -destdir $(OCAMLDESTDIR) xb
+	ocamlfind remove -destdir $(OCAMLDESTDIR) xenbus
 
 include $(TOPLEVEL)/Makefile.rules
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xb/xb.ml
--- a/tools/ocaml/libs/xb/xb.ml	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/libs/xb/xb.ml	Mon Oct 10 16:37:07 2011 +0100
@@ -24,7 +24,7 @@
 
 type backend_mmap =
 {
-	mmap: Mmap.mmap_interface;     (* mmaped interface = xs_ring *)
+	mmap: Xenmmap.mmap_interface;     (* mmaped interface = xs_ring *)
 	eventchn_notify: unit -> unit; (* function to notify through eventchn *)
 	mutable work_again: bool;
 }
@@ -34,7 +34,7 @@
 	fd: Unix.file_descr;
 }
 
-type backend = Fd of backend_fd | Mmap of backend_mmap
+type backend = Fd of backend_fd | Xenmmap of backend_mmap
 
 type partial_buf = HaveHdr of Partial.pkt | NoHdr of int * string
 
@@ -68,7 +68,7 @@
 let read con s len =
 	match con.backend with
 	| Fd backfd     -> read_fd backfd con s len
-	| Mmap backmmap -> read_mmap backmmap con s len
+	| Xenmmap backmmap -> read_mmap backmmap con s len
 
 let write_fd back con s len =
 	Unix.write back.fd s 0 len
@@ -82,7 +82,7 @@
 let write con s len =
 	match con.backend with
 	| Fd backfd     -> write_fd backfd con s len
-	| Mmap backmmap -> write_mmap backmmap con s len
+	| Xenmmap backmmap -> write_mmap backmmap con s len
 
 let output con =
 	(* get the output string from a string_of(packet) or partial_out *)
@@ -145,7 +145,7 @@
 let open_fd fd = newcon (Fd { fd = fd; })
 
 let open_mmap mmap notifyfct =
-	newcon (Mmap {
+	newcon (Xenmmap {
 		mmap = mmap;
 		eventchn_notify = notifyfct;
 		work_again = false; })
@@ -153,12 +153,12 @@
 let close con =
 	match con.backend with
 	| Fd backend   -> Unix.close backend.fd
-	| Mmap backend -> Mmap.unmap backend.mmap
+	| Xenmmap backend -> Xenmmap.unmap backend.mmap
 
 let is_fd con =
 	match con.backend with
 	| Fd _   -> true
-	| Mmap _ -> false
+	| Xenmmap _ -> false
 
 let is_mmap con = not (is_fd con)
 
@@ -176,14 +176,14 @@
 let has_more_input con =
 	match con.backend with
 	| Fd _         -> false
-	| Mmap backend -> backend.work_again
+	| Xenmmap backend -> backend.work_again
 
 let is_selectable con =
 	match con.backend with
 	| Fd _   -> true
-	| Mmap _ -> false
+	| Xenmmap _ -> false
 
 let get_fd con =
 	match con.backend with
 	| Fd backend -> backend.fd
-	| Mmap _     -> raise (Failure "get_fd")
+	| Xenmmap _     -> raise (Failure "get_fd")
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xb/xb.mli
--- a/tools/ocaml/libs/xb/xb.mli	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/libs/xb/xb.mli	Mon Oct 10 16:37:07 2011 +0100
@@ -1,83 +1,103 @@
-module Op:
-sig
-	type operation = Op.operation =
-		| Debug
-		| Directory
-		| Read
-		| Getperms
-		| Watch
-		| Unwatch
-		| Transaction_start
-		| Transaction_end
-		| Introduce
-		| Release
-		| Getdomainpath
-		| Write
-		| Mkdir
-		| Rm
-		| Setperms
-		| Watchevent
-		| Error
-		| Isintroduced
-		| Resume
-		| Set_target
-		| Restrict
-	val to_string : operation -> string
-end
-
-module Packet:
-sig
-	type t
-
-	exception Error of string
-	exception DataError of string
-
-	val create : int -> int -> Op.operation -> string -> t
-	val unpack : t -> int * int * Op.operation * string
-
-	val get_tid : t -> int
-	val get_ty : t -> Op.operation
-	val get_data : t -> string
-	val get_rid: t -> int
-end
-
+module Op :
+  sig
+    type operation =
+      Op.operation =
+        Debug
+      | Directory
+      | Read
+      | Getperms
+      | Watch
+      | Unwatch
+      | Transaction_start
+      | Transaction_end
+      | Introduce
+      | Release
+      | Getdomainpath
+      | Write
+      | Mkdir
+      | Rm
+      | Setperms
+      | Watchevent
+      | Error
+      | Isintroduced
+      | Resume
+      | Set_target
+      | Restrict
+    val operation_c_mapping : operation array
+    val size : int
+    val offset_pq : int
+    val operation_c_mapping_pq : 'a array
+    val size_pq : int
+    val array_search : 'a -> 'a array -> int
+    val of_cval : int -> operation
+    val to_cval : operation -> int
+    val to_string : operation -> string
+  end
+module Packet :
+  sig
+    type t =
+      Packet.t = {
+      tid : int;
+      rid : int;
+      ty : Op.operation;
+      data : string;
+    }
+    exception Error of string
+    exception DataError of string
+    external string_of_header : int -> int -> int -> int -> string
+      = "stub_string_of_header"
+    val create : int -> int -> Op.operation -> string -> t
+    val of_partialpkt : Partial.pkt -> t
+    val to_string : t -> string
+    val unpack : t -> int * int * Op.operation * string
+    val get_tid : t -> int
+    val get_ty : t -> Op.operation
+    val get_data : t -> string
+    val get_rid : t -> int
+  end
 exception End_of_file
 exception Eagain
 exception Noent
 exception Invalid
-
-type t
-
-(** queue a packet into the output queue for later sending *)
+type backend_mmap = {
+  mmap : Xenmmap.mmap_interface;
+  eventchn_notify : unit -> unit;
+  mutable work_again : bool;
+}
+type backend_fd = { fd : Unix.file_descr; }
+type backend = Fd of backend_fd | Xenmmap of backend_mmap
+type partial_buf = HaveHdr of Partial.pkt | NoHdr of int * string
+type t = {
+  backend : backend;
+  pkt_in : Packet.t Queue.t;
+  pkt_out : Packet.t Queue.t;
+  mutable partial_in : partial_buf;
+  mutable partial_out : string;
+}
+val init_partial_in : unit -> partial_buf
 val queue : t -> Packet.t -> unit
-
-(** process the output queue, return if a packet has been totally sent *)
+val read_fd : backend_fd -> 'a -> string -> int -> int
+val read_mmap : backend_mmap -> 'a -> string -> int -> int
+val read : t -> string -> int -> int
+val write_fd : backend_fd -> 'a -> string -> int -> int
+val write_mmap : backend_mmap -> 'a -> string -> int -> int
+val write : t -> string -> int -> int
 val output : t -> bool
-
-(** process the input queue, return if a packet has been totally received *)
 val input : t -> bool
-
-(** create new connection using a fd interface *)
+val newcon : backend -> t
 val open_fd : Unix.file_descr -> t
-(** create new connection using a mmap intf and a function to notify eventchn *)
-val open_mmap : Mmap.mmap_interface -> (unit -> unit) -> t
-
-(* close a connection *)
+val open_mmap : Xenmmap.mmap_interface -> (unit -> unit) -> t
 val close : t -> unit
-
 val is_fd : t -> bool
 val is_mmap : t -> bool
-
 val output_len : t -> int
 val has_new_output : t -> bool
 val has_old_output : t -> bool
 val has_output : t -> bool
 val peek_output : t -> Packet.t
-
 val input_len : t -> int
 val has_in_packet : t -> bool
 val get_in_packet : t -> Packet.t
 val has_more_input : t -> bool
-
 val is_selectable : t -> bool
 val get_fd : t -> Unix.file_descr
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xb/xb_stubs.c
--- a/tools/ocaml/libs/xb/xb_stubs.c	Mon Oct 10 11:21:51 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2006-2007 XenSource Ltd.
- * Copyright (C) 2008      Citrix Ltd.
- * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- */
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/mman.h>
-#include <string.h>
-#include <errno.h>
-
-#include <caml/mlvalues.h>
-#include <caml/memory.h>
-#include <caml/alloc.h>
-#include <caml/custom.h>
-#include <caml/fail.h>
-#include <caml/callback.h>
-
-#include <xenctrl.h>
-#include <xen/io/xs_wire.h>
-
-CAMLprim value stub_header_size(void)
-{
-	CAMLparam0();
-	CAMLreturn(Val_int(sizeof(struct xsd_sockmsg)));
-}
-
-CAMLprim value stub_header_of_string(value s)
-{
-	CAMLparam1(s);
-	CAMLlocal1(ret);
-	struct xsd_sockmsg *hdr;
-
-	if (caml_string_length(s) != sizeof(struct xsd_sockmsg))
-		caml_failwith("xb header incomplete");
-	ret = caml_alloc_tuple(4);
-	hdr = (struct xsd_sockmsg *) String_val(s);
-	Store_field(ret, 0, Val_int(hdr->tx_id));
-	Store_field(ret, 1, Val_int(hdr->req_id));
-	Store_field(ret, 2, Val_int(hdr->type));
-	Store_field(ret, 3, Val_int(hdr->len));
-	CAMLreturn(ret);
-}
-
-CAMLprim value stub_string_of_header(value tid, value rid, value ty, value len)
-{
-	CAMLparam4(tid, rid, ty, len);
-	CAMLlocal1(ret);
-	struct xsd_sockmsg xsd = {
-		.type = Int_val(ty),
-		.tx_id = Int_val(tid),
-		.req_id = Int_val(rid),
-		.len = Int_val(len),
-	};
-
-	ret = caml_alloc_string(sizeof(struct xsd_sockmsg));
-	memcpy(String_val(ret), &xsd, sizeof(struct xsd_sockmsg));
-
-	CAMLreturn(ret);
-}
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xb/xenbus_stubs.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/ocaml/libs/xb/xenbus_stubs.c	Mon Oct 10 16:37:07 2011 +0100
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2006-2007 XenSource Ltd.
+ * Copyright (C) 2008      Citrix Ltd.
+ * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ */
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/mman.h>
+#include <string.h>
+#include <errno.h>
+
+#include <caml/mlvalues.h>
+#include <caml/memory.h>
+#include <caml/alloc.h>
+#include <caml/custom.h>
+#include <caml/fail.h>
+#include <caml/callback.h>
+
+#include <xenctrl.h>
+#include <xen/io/xs_wire.h>
+
+CAMLprim value stub_header_size(void)
+{
+	CAMLparam0();
+	CAMLreturn(Val_int(sizeof(struct xsd_sockmsg)));
+}
+
+CAMLprim value stub_header_of_string(value s)
+{
+	CAMLparam1(s);
+	CAMLlocal1(ret);
+	struct xsd_sockmsg *hdr;
+
+	if (caml_string_length(s) != sizeof(struct xsd_sockmsg))
+		caml_failwith("xb header incomplete");
+	ret = caml_alloc_tuple(4);
+	hdr = (struct xsd_sockmsg *) String_val(s);
+	Store_field(ret, 0, Val_int(hdr->tx_id));
+	Store_field(ret, 1, Val_int(hdr->req_id));
+	Store_field(ret, 2, Val_int(hdr->type));
+	Store_field(ret, 3, Val_int(hdr->len));
+	CAMLreturn(ret);
+}
+
+CAMLprim value stub_string_of_header(value tid, value rid, value ty, value len)
+{
+	CAMLparam4(tid, rid, ty, len);
+	CAMLlocal1(ret);
+	struct xsd_sockmsg xsd = {
+		.type = Int_val(ty),
+		.tx_id = Int_val(tid),
+		.req_id = Int_val(rid),
+		.len = Int_val(len),
+	};
+
+	ret = caml_alloc_string(sizeof(struct xsd_sockmsg));
+	memcpy(String_val(ret), &xsd, sizeof(struct xsd_sockmsg));
+
+	CAMLreturn(ret);
+}
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xb/xs_ring.ml
--- a/tools/ocaml/libs/xb/xs_ring.ml	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/libs/xb/xs_ring.ml	Mon Oct 10 16:37:07 2011 +0100
@@ -14,5 +14,5 @@
  * GNU Lesser General Public License for more details.
  *)
 
-external read: Mmap.mmap_interface -> string -> int -> int = "ml_interface_read"
-external write: Mmap.mmap_interface -> string -> int -> int = "ml_interface_write"
+external read: Xenmmap.mmap_interface -> string -> int -> int = "ml_interface_read"
+external write: Xenmmap.mmap_interface -> string -> int -> int = "ml_interface_write"
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xc/META.in
--- a/tools/ocaml/libs/xc/META.in	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/libs/xc/META.in	Mon Oct 10 16:37:07 2011 +0100
@@ -1,5 +1,5 @@
 version = "@VERSION@"
 description = "Xen Control Interface"
-requires = "mmap,uuid"
-archive(byte) = "xc.cma"
-archive(native) = "xc.cmxa"
+requires = "xenmmap,uuid"
+archive(byte) = "xenctrl.cma"
+archive(native) = "xenctrl.cmxa"
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xc/Makefile
--- a/tools/ocaml/libs/xc/Makefile	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/libs/xc/Makefile	Mon Oct 10 16:37:07 2011 +0100
@@ -5,16 +5,16 @@
 CFLAGS += -I../mmap $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest)
 OCAMLINCLUDE += -I ../mmap -I ../uuid
 
-OBJS = xc
-INTF = xc.cmi
-LIBS = xc.cma xc.cmxa
+OBJS = xenctrl
+INTF = xenctrl.cmi
+LIBS = xenctrl.cma xenctrl.cmxa
 
-LIBS_xc = $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest)
+LIBS_xenctrl = $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest)
 
-xc_OBJS = $(OBJS)
-xc_C_OBJS = xc_stubs
+xenctrl_OBJS = $(OBJS)
+xenctrl_C_OBJS = xenctrl_stubs
 
-OCAML_LIBRARY = xc
+OCAML_LIBRARY = xenctrl
 
 all: $(INTF) $(LIBS)
 
@@ -23,11 +23,11 @@
 .PHONY: install
 install: $(LIBS) META
 	mkdir -p $(OCAMLDESTDIR)
-	ocamlfind remove -destdir $(OCAMLDESTDIR) xc
-	ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xc META $(INTF) $(LIBS) *.a *.so *.cmx
+	ocamlfind remove -destdir $(OCAMLDESTDIR) xenctrl
+	ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xenctrl META $(INTF) $(LIBS) *.a *.so *.cmx
 
 .PHONY: uninstall
 uninstall:
-	ocamlfind remove -destdir $(OCAMLDESTDIR) xc
+	ocamlfind remove -destdir $(OCAMLDESTDIR) xenctrl
 
 include $(TOPLEVEL)/Makefile.rules
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xc/xc.ml
--- a/tools/ocaml/libs/xc/xc.ml	Mon Oct 10 11:21:51 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,326 +0,0 @@
-(*
- * Copyright (C) 2006-2007 XenSource Ltd.
- * Copyright (C) 2008      Citrix Ltd.
- * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *)
-
-(** *)
-type domid = int
-
-(* ** xenctrl.h ** *)
-
-type vcpuinfo =
-{
-	online: bool;
-	blocked: bool;
-	running: bool;
-	cputime: int64;
-	cpumap: int32;
-}
-
-type domaininfo =
-{
-	domid             : domid;
-	dying             : bool;
-	shutdown          : bool;
-	paused            : bool;
-	blocked           : bool;
-	running           : bool;
-	hvm_guest         : bool;
-	shutdown_code     : int;
-	total_memory_pages: nativeint;
-	max_memory_pages  : nativeint;
-	shared_info_frame : int64;
-	cpu_time          : int64;
-	nr_online_vcpus   : int;
-	max_vcpu_id       : int;
-	ssidref           : int32;
-	handle            : int array;
-}
-
-type sched_control =
-{
-	weight : int;
-	cap    : int;
-}
-
-type physinfo_cap_flag =
-	| CAP_HVM
-	| CAP_DirectIO
-
-type physinfo =
-{
-	threads_per_core : int;
-	cores_per_socket : int;
-	nr_cpus          : int;
-	max_node_id      : int;
-	cpu_khz          : int;
-	total_pages      : nativeint;
-	free_pages       : nativeint;
-	scrub_pages      : nativeint;
-	(* XXX hw_cap *)
-	capabilities     : physinfo_cap_flag list;
-}
-
-type version =
-{
-	major : int;
-	minor : int;
-	extra : string;
-}
-
-
-type compile_info =
-{
-	compiler : string;
-	compile_by : string;
-	compile_domain : string;
-	compile_date : string;
-}
-
-type shutdown_reason = Poweroff | Reboot | Suspend | Crash | Halt
-
-type domain_create_flag = CDF_HVM | CDF_HAP
-
-exception Error of string
-
-type handle
-
-(* this is only use by coredumping *)
-external sizeof_core_header: unit -> int
-       = "stub_sizeof_core_header"
-external sizeof_vcpu_guest_context: unit -> int
-       = "stub_sizeof_vcpu_guest_context"
-external sizeof_xen_pfn: unit -> int = "stub_sizeof_xen_pfn"
-(* end of use *)
-
-external interface_open: unit -> handle = "stub_xc_interface_open"
-external interface_close: handle -> unit = "stub_xc_interface_close"
-
-external is_fake: unit -> bool = "stub_xc_interface_is_fake"
-
-let with_intf f =
-	let xc = interface_open () in
-	let r = try f xc with exn -> interface_close xc; raise exn in
-	interface_close xc;
-	r
-
-external _domain_create: handle -> int32 -> domain_create_flag list -> int array -> domid
-       = "stub_xc_domain_create"
-
-let domain_create handle n flags uuid =
-	_domain_create handle n flags (Uuid.int_array_of_uuid uuid)
-
-external _domain_sethandle: handle -> domid -> int array -> unit
-                          = "stub_xc_domain_sethandle"
-
-let domain_sethandle handle n uuid =
-	_domain_sethandle handle n (Uuid.int_array_of_uuid uuid)
-
-external domain_max_vcpus: handle -> domid -> int -> unit
-       = "stub_xc_domain_max_vcpus"
-
-external domain_pause: handle -> domid -> unit = "stub_xc_domain_pause"
-external domain_unpause: handle -> domid -> unit = "stub_xc_domain_unpause"
-external domain_resume_fast: handle -> domid -> unit = "stub_xc_domain_resume_fast"
-external domain_destroy: handle -> domid -> unit = "stub_xc_domain_destroy"
-
-external domain_shutdown: handle -> domid -> shutdown_reason -> unit
-       = "stub_xc_domain_shutdown"
-
-external _domain_getinfolist: handle -> domid -> int -> domaininfo list
-       = "stub_xc_domain_getinfolist"
-
-let domain_getinfolist handle first_domain =
-	let nb = 2 in
-	let last_domid l = (List.hd l).domid + 1 in
-	let rec __getlist from =
-		let l = _domain_getinfolist handle from nb in
-		(if List.length l = nb then __getlist (last_domid l) else []) @ l
-		in
-	List.rev (__getlist first_domain)
-
-external domain_getinfo: handle -> domid -> domaininfo= "stub_xc_domain_getinfo"
-
-external domain_get_vcpuinfo: handle -> int -> int -> vcpuinfo
-       = "stub_xc_vcpu_getinfo"
-
-external domain_ioport_permission: handle -> domid -> int -> int -> bool -> unit
-       = "stub_xc_domain_ioport_permission"
-external domain_iomem_permission: handle -> domid -> nativeint -> nativeint -> bool -> unit
-       = "stub_xc_domain_iomem_permission"
-external domain_irq_permission: handle -> domid -> int -> bool -> unit
-       = "stub_xc_domain_irq_permission"
-
-external vcpu_affinity_set: handle -> domid -> int -> bool array -> unit
-       = "stub_xc_vcpu_setaffinity"
-external vcpu_affinity_get: handle -> domid -> int -> bool array
-       = "stub_xc_vcpu_getaffinity"
-
-external vcpu_context_get: handle -> domid -> int -> string
-       = "stub_xc_vcpu_context_get"
-
-external sched_id: handle -> int = "stub_xc_sched_id"
-
-external sched_credit_domain_set: handle -> domid -> sched_control -> unit
-       = "stub_sched_credit_domain_set"
-external sched_credit_domain_get: handle -> domid -> sched_control
-       = "stub_sched_credit_domain_get"
-
-external shadow_allocation_set: handle -> domid -> int -> unit
-       = "stub_shadow_allocation_set"
-external shadow_allocation_get: handle -> domid -> int
-       = "stub_shadow_allocation_get"
-
-external evtchn_alloc_unbound: handle -> domid -> domid -> int
-       = "stub_xc_evtchn_alloc_unbound"
-external evtchn_reset: handle -> domid -> unit = "stub_xc_evtchn_reset"
-
-external readconsolering: handle -> string = "stub_xc_readconsolering"
-
-external send_debug_keys: handle -> string -> unit = "stub_xc_send_debug_keys"
-external physinfo: handle -> physinfo = "stub_xc_physinfo"
-external pcpu_info: handle -> int -> int64 array = "stub_xc_pcpu_info"
-
-external domain_setmaxmem: handle -> domid -> int64 -> unit
-       = "stub_xc_domain_setmaxmem"
-external domain_set_memmap_limit: handle -> domid -> int64 -> unit
-       = "stub_xc_domain_set_memmap_limit"
-external domain_memory_increase_reservation: handle -> domid -> int64 -> unit
-       = "stub_xc_domain_memory_increase_reservation"
-
-external domain_set_machine_address_size: handle -> domid -> int -> unit
-       = "stub_xc_domain_set_machine_address_size"
-external domain_get_machine_address_size: handle -> domid -> int
-       = "stub_xc_domain_get_machine_address_size"
-
-external domain_cpuid_set: handle -> domid -> (int64 * (int64 option))
-                        -> string option array
-                        -> string option array
-       = "stub_xc_domain_cpuid_set"
-external domain_cpuid_apply_policy: handle -> domid -> unit
-       = "stub_xc_domain_cpuid_apply_policy"
-external cpuid_check: handle -> (int64 * (int64 option)) -> string option array -> (bool * string option array)
-       = "stub_xc_cpuid_check"
-
-external map_foreign_range: handle -> domid -> int
-                         -> nativeint -> Mmap.mmap_interface
-       = "stub_map_foreign_range"
-
-external domain_get_pfn_list: handle -> domid -> nativeint -> nativeint array
-       = "stub_xc_domain_get_pfn_list"
-
-external domain_assign_device: handle -> domid -> (int * int * int * int) -> unit
-       = "stub_xc_domain_assign_device"
-external domain_deassign_device: handle -> domid -> (int * int * int * int) -> unit
-       = "stub_xc_domain_deassign_device"
-external domain_test_assign_device: handle -> domid -> (int * int * int * int) -> bool
-       = "stub_xc_domain_test_assign_device"
-
-external version: handle -> version = "stub_xc_version_version"
-external version_compile_info: handle -> compile_info
-       = "stub_xc_version_compile_info"
-external version_changeset: handle -> string = "stub_xc_version_changeset"
-external version_capabilities: handle -> string =
-  "stub_xc_version_capabilities"
-
-external watchdog : handle -> int -> int32 -> int
-  = "stub_xc_watchdog"
-
-(* core dump structure *)
-type core_magic = Magic_hvm | Magic_pv
-
-type core_header = {
-	xch_magic: core_magic;
-	xch_nr_vcpus: int;
-	xch_nr_pages: nativeint;
-	xch_index_offset: int64;
-	xch_ctxt_offset: int64;
-	xch_pages_offset: int64;
-}
-
-external marshall_core_header: core_header -> string = "stub_marshall_core_header"
-
-(* coredump *)
-let coredump xch domid fd =
-	let dump s =
-		let wd = Unix.write fd s 0 (String.length s) in
-		if wd <> String.length s then
-			failwith "error while writing";
-		in
-
-	let info = domain_getinfo xch domid in
-
-	let nrpages = info.total_memory_pages in
-	let ctxt = Array.make info.max_vcpu_id None in
-	let nr_vcpus = ref 0 in
-	for i = 0 to info.max_vcpu_id - 1
-	do
-		ctxt.(i) <- try
-			let v = vcpu_context_get xch domid i in
-			incr nr_vcpus;
-			Some v
-			with _ -> None
-	done;
-
-	(* FIXME page offset if not rounded to sup *)
-	let page_offset =
-		Int64.add
-			(Int64.of_int (sizeof_core_header () +
-			 (sizeof_vcpu_guest_context () * !nr_vcpus)))
-			(Int64.of_nativeint (
-				Nativeint.mul
-					(Nativeint.of_int (sizeof_xen_pfn ()))
-					nrpages)
-				)
-		in
-
-	let header = {
-		xch_magic = if info.hvm_guest then Magic_hvm else Magic_pv;
-		xch_nr_vcpus = !nr_vcpus;
-		xch_nr_pages = nrpages;
-		xch_ctxt_offset = Int64.of_int (sizeof_core_header ());
-		xch_index_offset = Int64.of_int (sizeof_core_header ()
-					+ sizeof_vcpu_guest_context ());
-		xch_pages_offset = page_offset;
-	} in
-
-	dump (marshall_core_header header);
-	for i = 0 to info.max_vcpu_id - 1
-	do
-		match ctxt.(i) with
-		| None -> ()
-		| Some ctxt_i -> dump ctxt_i
-	done;
-	let pfns = domain_get_pfn_list xch domid nrpages in
-	if Array.length pfns <> Nativeint.to_int nrpages then
-		failwith "could not get the page frame list";
-
-	let page_size = Mmap.getpagesize () in
-	for i = 0 to Nativeint.to_int nrpages - 1
-	do
-		let page = map_foreign_range xch domid page_size pfns.(i) in
-		let data = Mmap.read page 0 page_size in
-		Mmap.unmap page;
-		dump data
-	done
-
-(* ** Misc ** *)
-
-(**
-   Convert the given number of pages to an amount in KiB, rounded up.
- *)
-external pages_to_kib : int64 -> int64 = "stub_pages_to_kib"
-let pages_to_mib pages = Int64.div (pages_to_kib pages) 1024L
-
-let _ = Callback.register_exception "xc.error" (Error "register_callback")
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xc/xc.mli
--- a/tools/ocaml/libs/xc/xc.mli	Mon Oct 10 11:21:51 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,184 +0,0 @@
-(*
- * Copyright (C) 2006-2007 XenSource Ltd.
- * Copyright (C) 2008      Citrix Ltd.
- * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *)
-
-type domid = int
-type vcpuinfo = {
-  online : bool;
-  blocked : bool;
-  running : bool;
-  cputime : int64;
-  cpumap : int32;
-}
-type domaininfo = {
-  domid : domid;
-  dying : bool;
-  shutdown : bool;
-  paused : bool;
-  blocked : bool;
-  running : bool;
-  hvm_guest : bool;
-  shutdown_code : int;
-  total_memory_pages : nativeint;
-  max_memory_pages : nativeint;
-  shared_info_frame : int64;
-  cpu_time : int64;
-  nr_online_vcpus : int;
-  max_vcpu_id : int;
-  ssidref : int32;
-  handle : int array;
-}
-type sched_control = { weight : int; cap : int; }
-type physinfo_cap_flag = CAP_HVM | CAP_DirectIO
-type physinfo = {
-  threads_per_core : int;
-  cores_per_socket : int;
-  nr_cpus          : int;
-  max_node_id      : int;
-  cpu_khz          : int;
-  total_pages      : nativeint;
-  free_pages       : nativeint;
-  scrub_pages      : nativeint;
-  capabilities     : physinfo_cap_flag list;
-}
-type version = { major : int; minor : int; extra : string; }
-type compile_info = {
-  compiler : string;
-  compile_by : string;
-  compile_domain : string;
-  compile_date : string;
-}
-type shutdown_reason = Poweroff | Reboot | Suspend | Crash | Halt
-
-type domain_create_flag = CDF_HVM | CDF_HAP
-
-exception Error of string
-type handle
-external sizeof_core_header : unit -> int = "stub_sizeof_core_header"
-external sizeof_vcpu_guest_context : unit -> int
-  = "stub_sizeof_vcpu_guest_context"
-external sizeof_xen_pfn : unit -> int = "stub_sizeof_xen_pfn"
-external interface_open : unit -> handle = "stub_xc_interface_open"
-external is_fake : unit -> bool = "stub_xc_interface_is_fake"
-external interface_close : handle -> unit = "stub_xc_interface_close"
-val with_intf : (handle -> 'a) -> 'a
-external _domain_create : handle -> int32 -> domain_create_flag list -> int array -> domid
-  = "stub_xc_domain_create"
-val domain_create : handle -> int32 -> domain_create_flag list -> 'a Uuid.t -> domid
-external _domain_sethandle : handle -> domid -> int array -> unit
-  = "stub_xc_domain_sethandle"
-val domain_sethandle : handle -> domid -> 'a Uuid.t -> unit
-external domain_max_vcpus : handle -> domid -> int -> unit
-  = "stub_xc_domain_max_vcpus"
-external domain_pause : handle -> domid -> unit = "stub_xc_domain_pause"
-external domain_unpause : handle -> domid -> unit = "stub_xc_domain_unpause"
-external domain_resume_fast : handle -> domid -> unit
-  = "stub_xc_domain_resume_fast"
-external domain_destroy : handle -> domid -> unit = "stub_xc_domain_destroy"
-external domain_shutdown : handle -> domid -> shutdown_reason -> unit
-  = "stub_xc_domain_shutdown"
-external _domain_getinfolist : handle -> domid -> int -> domaininfo list
-  = "stub_xc_domain_getinfolist"
-val domain_getinfolist : handle -> domid -> domaininfo list
-external domain_getinfo : handle -> domid -> domaininfo
-  = "stub_xc_domain_getinfo"
-external domain_get_vcpuinfo : handle -> int -> int -> vcpuinfo
-  = "stub_xc_vcpu_getinfo"
-external domain_ioport_permission: handle -> domid -> int -> int -> bool -> unit
-       = "stub_xc_domain_ioport_permission"
-external domain_iomem_permission: handle -> domid -> nativeint -> nativeint -> bool -> unit
-       = "stub_xc_domain_iomem_permission"
-external domain_irq_permission: handle -> domid -> int -> bool -> unit
-       = "stub_xc_domain_irq_permission"
-external vcpu_affinity_set : handle -> domid -> int -> bool array -> unit
-  = "stub_xc_vcpu_setaffinity"
-external vcpu_affinity_get : handle -> domid -> int -> bool array
-  = "stub_xc_vcpu_getaffinity"
-external vcpu_context_get : handle -> domid -> int -> string
-  = "stub_xc_vcpu_context_get"
-external sched_id : handle -> int = "stub_xc_sched_id"
-external sched_credit_domain_set : handle -> domid -> sched_control -> unit
-  = "stub_sched_credit_domain_set"
-external sched_credit_domain_get : handle -> domid -> sched_control
-  = "stub_sched_credit_domain_get"
-external shadow_allocation_set : handle -> domid -> int -> unit
-  = "stub_shadow_allocation_set"
-external shadow_allocation_get : handle -> domid -> int
-  = "stub_shadow_allocation_get"
-external evtchn_alloc_unbound : handle -> domid -> domid -> int
-  = "stub_xc_evtchn_alloc_unbound"
-external evtchn_reset : handle -> domid -> unit = "stub_xc_evtchn_reset"
-external readconsolering : handle -> string = "stub_xc_readconsolering"
-external send_debug_keys : handle -> string -> unit = "stub_xc_send_debug_keys"
-external physinfo : handle -> physinfo = "stub_xc_physinfo"
-external pcpu_info: handle -> int -> int64 array = "stub_xc_pcpu_info"
-external domain_setmaxmem : handle -> domid -> int64 -> unit
-  = "stub_xc_domain_setmaxmem"
-external domain_set_memmap_limit : handle -> domid -> int64 -> unit
-  = "stub_xc_domain_set_memmap_limit"
-external domain_memory_increase_reservation :
-  handle -> domid -> int64 -> unit
-  = "stub_xc_domain_memory_increase_reservation"
-external map_foreign_range :
-  handle -> domid -> int -> nativeint -> Mmap.mmap_interface
-  = "stub_map_foreign_range"
-external domain_get_pfn_list :
-  handle -> domid -> nativeint -> nativeint array
-  = "stub_xc_domain_get_pfn_list"
-
-external domain_assign_device: handle -> domid -> (int * int * int * int) -> unit
-       = "stub_xc_domain_assign_device"
-external domain_deassign_device: handle -> domid -> (int * int * int * int) -> unit
-       = "stub_xc_domain_deassign_device"
-external domain_test_assign_device: handle -> domid -> (int * int * int * int) -> bool
-       = "stub_xc_domain_test_assign_device"
-
-external version : handle -> version = "stub_xc_version_version"
-external version_compile_info : handle -> compile_info
-  = "stub_xc_version_compile_info"
-external version_changeset : handle -> string = "stub_xc_version_changeset"
-external version_capabilities : handle -> string
-  = "stub_xc_version_capabilities"
-type core_magic = Magic_hvm | Magic_pv
-type core_header = {
-  xch_magic : core_magic;
-  xch_nr_vcpus : int;
-  xch_nr_pages : nativeint;
-  xch_index_offset : int64;
-  xch_ctxt_offset : int64;
-  xch_pages_offset : int64;
-}
-external marshall_core_header : core_header -> string
-  = "stub_marshall_core_header"
-val coredump : handle -> domid -> Unix.file_descr -> unit
-external pages_to_kib : int64 -> int64 = "stub_pages_to_kib"
-val pages_to_mib : int64 -> int64
-external watchdog : handle -> int -> int32 -> int
-  = "stub_xc_watchdog"
-
-external domain_set_machine_address_size: handle -> domid -> int -> unit
-  = "stub_xc_domain_set_machine_address_size"
-external domain_get_machine_address_size: handle -> domid -> int
-       = "stub_xc_domain_get_machine_address_size"
-
-external domain_cpuid_set: handle -> domid -> (int64 * (int64 option))
-                        -> string option array
-                        -> string option array
-       = "stub_xc_domain_cpuid_set"
-external domain_cpuid_apply_policy: handle -> domid -> unit
-       = "stub_xc_domain_cpuid_apply_policy"
-external cpuid_check: handle -> (int64 * (int64 option)) -> string option array -> (bool * string option array)
-       = "stub_xc_cpuid_check"
-
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xc/xc_stubs.c
--- a/tools/ocaml/libs/xc/xc_stubs.c	Mon Oct 10 11:21:51 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1161 +0,0 @@
-/*
- * Copyright (C) 2006-2007 XenSource Ltd.
- * Copyright (C) 2008      Citrix Ltd.
- * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- */
-
-#define _XOPEN_SOURCE 600
-#include <stdlib.h>
-#include <errno.h>
-
-#define CAML_NAME_SPACE
-#include <caml/alloc.h>
-#include <caml/memory.h>
-#include <caml/signals.h>
-#include <caml/fail.h>
-#include <caml/callback.h>
-
-#include <sys/mman.h>
-#include <stdint.h>
-#include <string.h>
-
-#include <xenctrl.h>
-
-#include "mmap_stubs.h"
-
-#define PAGE_SHIFT		12
-#define PAGE_SIZE               (1UL << PAGE_SHIFT)
-#define PAGE_MASK               (~(PAGE_SIZE-1))
-
-#define _H(__h) ((xc_interface *)(__h))
-#define _D(__d) ((uint32_t)Int_val(__d))
-
-#define Val_none (Val_int(0))
-
-#define string_of_option_array(array, index) \
-	((Field(array, index) == Val_none) ? NULL : String_val(Field(Field(array, index), 0)))
-
-/* maybe here we should check the range of the input instead of blindly
- * casting it to uint32 */
-#define cpuid_input_of_val(i1, i2, input) \
-	i1 = (uint32_t) Int64_val(Field(input, 0)); \
-	i2 = ((Field(input, 1) == Val_none) ? 0xffffffff : (uint32_t) Int64_val(Field(Field(input, 1), 0)));
-
-#define ERROR_STRLEN 1024
-void failwith_xc(xc_interface *xch)
-{
-	static char error_str[ERROR_STRLEN];
-	if (xch) {
-		const xc_error *error = xc_get_last_error(xch);
-		if (error->code == XC_ERROR_NONE)
-                	snprintf(error_str, ERROR_STRLEN, "%d: %s", errno, strerror(errno));
-		else
-			snprintf(error_str, ERROR_STRLEN, "%d: %s: %s",
-				 error->code,
-				 xc_error_code_to_desc(error->code),
-				 error->message);
-	} else {
-		snprintf(error_str, ERROR_STRLEN, "Unable to open XC interface");
-	}
-	caml_raise_with_string(*caml_named_value("xc.error"), error_str);
-}
-
-CAMLprim value stub_sizeof_core_header(value unit)
-{
-	CAMLparam1(unit);
-	CAMLreturn(Val_int(sizeof(struct xc_core_header)));
-}
-
-CAMLprim value stub_sizeof_vcpu_guest_context(value unit)
-{
-	CAMLparam1(unit);
-	CAMLreturn(Val_int(sizeof(struct vcpu_guest_context)));
-}
-
-CAMLprim value stub_sizeof_xen_pfn(value unit)
-{
-	CAMLparam1(unit);
-	CAMLreturn(Val_int(sizeof(xen_pfn_t)));
-}
-
-#define XC_CORE_MAGIC     0xF00FEBED
-#define XC_CORE_MAGIC_HVM 0xF00FEBEE
-
-CAMLprim value stub_marshall_core_header(value header)
-{
-	CAMLparam1(header);
-	CAMLlocal1(s);
-	struct xc_core_header c_header;
-
-	c_header.xch_magic = (Field(header, 0))
-		? XC_CORE_MAGIC
-		: XC_CORE_MAGIC_HVM;
-	c_header.xch_nr_vcpus = Int_val(Field(header, 1));
-	c_header.xch_nr_pages = Nativeint_val(Field(header, 2));
-	c_header.xch_ctxt_offset = Int64_val(Field(header, 3));
-	c_header.xch_index_offset = Int64_val(Field(header, 4));
-	c_header.xch_pages_offset = Int64_val(Field(header, 5));
-
-	s = caml_alloc_string(sizeof(c_header));
-	memcpy(String_val(s), (char *) &c_header, sizeof(c_header));
-	CAMLreturn(s);
-}
-
-CAMLprim value stub_xc_interface_open(void)
-{
-	CAMLparam0();
-        xc_interface *xch;
-        xch = xc_interface_open(NULL, NULL, XC_OPENFLAG_NON_REENTRANT);
-        if (xch == NULL)
-		failwith_xc(NULL);
-        CAMLreturn((value)xch);
-}
-
-
-CAMLprim value stub_xc_interface_is_fake(void)
-{
-	CAMLparam0();
-	int is_fake = xc_interface_is_fake();
-	CAMLreturn(Val_int(is_fake));
-}
-
-CAMLprim value stub_xc_interface_close(value xch)
-{
-	CAMLparam1(xch);
-
-	// caml_enter_blocking_section();
-	xc_interface_close(_H(xch));
-	// caml_leave_blocking_section();
-
-	CAMLreturn(Val_unit);
-}
-
-static int domain_create_flag_table[] = {
-	XEN_DOMCTL_CDF_hvm_guest,
-	XEN_DOMCTL_CDF_hap,
-};
-
-CAMLprim value stub_xc_domain_create(value xch, value ssidref,
-                                     value flags, value handle)
-{
-	CAMLparam4(xch, ssidref, flags, handle);
-
-	uint32_t domid = 0;
-	xen_domain_handle_t h = { 0 };
-	int result;
-	int i;
-	uint32_t c_ssidref = Int32_val(ssidref);
-	unsigned int c_flags = 0;
-	value l;
-
-        if (Wosize_val(handle) != 16)
-		caml_invalid_argument("Handle not a 16-integer array");
-
-	for (i = 0; i < sizeof(h); i++) {
-		h[i] = Int_val(Field(handle, i)) & 0xff;
-	}
-
-	for (l = flags; l != Val_none; l = Field(l, 1)) {
-		int v = Int_val(Field(l, 0));
-		c_flags |= domain_create_flag_table[v];
-	}
-
-	// caml_enter_blocking_section();
-	result = xc_domain_create(_H(xch), c_ssidref, h, c_flags, &domid);
-	// caml_leave_blocking_section();
-
-	if (result < 0)
-		failwith_xc(_H(xch));
-
-	CAMLreturn(Val_int(domid));
-}
-
-CAMLprim value stub_xc_domain_max_vcpus(value xch, value domid,
-                                        value max_vcpus)
-{
-	CAMLparam3(xch, domid, max_vcpus);
-	int r;
-
-	r = xc_domain_max_vcpus(_H(xch), _D(domid), Int_val(max_vcpus));
-	if (r)
-		failwith_xc(_H(xch));
-
-	CAMLreturn(Val_unit);
-}
-
-
-value stub_xc_domain_sethandle(value xch, value domid, value handle)
-{
-	CAMLparam3(xch, domid, handle);
-	xen_domain_handle_t h = { 0 };
-	int i;
-
-        if (Wosize_val(handle) != 16)
-		caml_invalid_argument("Handle not a 16-integer array");
-
-	for (i = 0; i < sizeof(h); i++) {
-		h[i] = Int_val(Field(handle, i)) & 0xff;
-	}
-
-	i = xc_domain_sethandle(_H(xch), _D(domid), h);
-	if (i)
-		failwith_xc(_H(xch));
-
-	CAMLreturn(Val_unit);
-}
-
-static value dom_op(value xch, value domid, int (*fn)(xc_interface *, uint32_t))
-{
-	CAMLparam2(xch, domid);
-
-	uint32_t c_domid = _D(domid);
-
-	// caml_enter_blocking_section();
-	int result = fn(_H(xch), c_domid);
-	// caml_leave_blocking_section();
-        if (result)
-		failwith_xc(_H(xch));
-	CAMLreturn(Val_unit);
-}
-
-CAMLprim value stub_xc_domain_pause(value xch, value domid)
-{
-	return dom_op(xch, domid, xc_domain_pause);
-}
-
-
-CAMLprim value stub_xc_domain_unpause(value xch, value domid)
-{
-	return dom_op(xch, domid, xc_domain_unpause);
-}
-
-CAMLprim value stub_xc_domain_destroy(value xch, value domid)
-{
-	return dom_op(xch, domid, xc_domain_destroy);
-}
-
-CAMLprim value stub_xc_domain_resume_fast(value xch, value domid)
-{
-	CAMLparam2(xch, domid);
-
-	uint32_t c_domid = _D(domid);
-
-	// caml_enter_blocking_section();
-	int result = xc_domain_resume(_H(xch), c_domid, 1);
-	// caml_leave_blocking_section();
-        if (result)
-		failwith_xc(_H(xch));
-	CAMLreturn(Val_unit);
-}
-
-CAMLprim value stub_xc_domain_shutdown(value xch, value domid, value reason)
-{
-	CAMLparam3(xch, domid, reason);
-	int ret;
-
-	ret = xc_domain_shutdown(_H(xch), _D(domid), Int_val(reason));
-	if (ret < 0)
-		failwith_xc(_H(xch));
-
-	CAMLreturn(Val_unit);
-}
-
-static value alloc_domaininfo(xc_domaininfo_t * info)
-{
-	CAMLparam0();
-	CAMLlocal2(result, tmp);
-	int i;
-
-	result = caml_alloc_tuple(16);
-
-	Store_field(result,  0, Val_int(info->domain));
-	Store_field(result,  1, Val_bool(info->flags & XEN_DOMINF_dying));
-	Store_field(result,  2, Val_bool(info->flags & XEN_DOMINF_shutdown));
-	Store_field(result,  3, Val_bool(info->flags & XEN_DOMINF_paused));
-	Store_field(result,  4, Val_bool(info->flags & XEN_DOMINF_blocked));
-	Store_field(result,  5, Val_bool(info->flags & XEN_DOMINF_running));
-	Store_field(result,  6, Val_bool(info->flags & XEN_DOMINF_hvm_guest));
-	Store_field(result,  7, Val_int((info->flags >> XEN_DOMINF_shutdownshift)
-	                                 & XEN_DOMINF_shutdownmask));
-	Store_field(result,  8, caml_copy_nativeint(info->tot_pages));
-	Store_field(result,  9, caml_copy_nativeint(info->max_pages));
-	Store_field(result, 10, caml_copy_int64(info->shared_info_frame));
-	Store_field(result, 11, caml_copy_int64(info->cpu_time));
-	Store_field(result, 12, Val_int(info->nr_online_vcpus));
-	Store_field(result, 13, Val_int(info->max_vcpu_id));
-	Store_field(result, 14, caml_copy_int32(info->ssidref));
-
-        tmp = caml_alloc_small(16, 0);
-	for (i = 0; i < 16; i++) {
-		Field(tmp, i) = Val_int(info->handle[i]);
-	}
-
-	Store_field(result, 15, tmp);
-
-	CAMLreturn(result);
-}
-
-CAMLprim value stub_xc_domain_getinfolist(value xch, value first_domain, value nb)
-{
-	CAMLparam3(xch, first_domain, nb);
-	CAMLlocal2(result, temp);
-	xc_domaininfo_t * info;
-	int i, ret, toalloc, retval;
-	unsigned int c_max_domains;
-	uint32_t c_first_domain;
-
-	/* get the minimum number of allocate byte we need and bump it up to page boundary */
-	toalloc = (sizeof(xc_domaininfo_t) * Int_val(nb)) | 0xfff;
-	ret = posix_memalign((void **) ((void *) &info), 4096, toalloc);
-	if (ret)
-		caml_raise_out_of_memory();
-
-	result = temp = Val_emptylist;
-
-	c_first_domain = _D(first_domain);
-	c_max_domains = Int_val(nb);
-	// caml_enter_blocking_section();
-	retval = xc_domain_getinfolist(_H(xch), c_first_domain,
-				       c_max_domains, info);
-	// caml_leave_blocking_section();
-
-	if (retval < 0) {
-		free(info);
-		failwith_xc(_H(xch));
-	}
-	for (i = 0; i < retval; i++) {
-		result = caml_alloc_small(2, Tag_cons);
-		Field(result, 0) = Val_int(0);
-		Field(result, 1) = temp;
-		temp = result;
-
-		Store_field(result, 0, alloc_domaininfo(info + i));
-	}
-
-	free(info);
-	CAMLreturn(result);
-}
-
-CAMLprim value stub_xc_domain_getinfo(value xch, value domid)
-{
-	CAMLparam2(xch, domid);
-	CAMLlocal1(result);
-	xc_domaininfo_t info;
-	int ret;
-
-	ret = xc_domain_getinfolist(_H(xch), _D(domid), 1, &info);
-	if (ret != 1)
-		failwith_xc(_H(xch));
-	if (info.domain != _D(domid))
-		failwith_xc(_H(xch));
-
-	result = alloc_domaininfo(&info);
-	CAMLreturn(result);
-}
-
-CAMLprim value stub_xc_vcpu_getinfo(value xch, value domid, value vcpu)
-{
-	CAMLparam3(xch, domid, vcpu);
-	CAMLlocal1(result);
-	xc_vcpuinfo_t info;
-	int retval;
-
-	uint32_t c_domid = _D(domid);
-	uint32_t c_vcpu = Int_val(vcpu);
-	// caml_enter_blocking_section();
-	retval = xc_vcpu_getinfo(_H(xch), c_domid,
-	                         c_vcpu, &info);
-	// caml_leave_blocking_section();
-	if (retval < 0)
-		failwith_xc(_H(xch));
-
-	result = caml_alloc_tuple(5);
-	Store_field(result, 0, Val_bool(info.online));
-	Store_field(result, 1, Val_bool(info.blocked));
-	Store_field(result, 2, Val_bool(info.running));
-	Store_field(result, 3, caml_copy_int64(info.cpu_time));
-	Store_field(result, 4, caml_copy_int32(info.cpu));
-
-	CAMLreturn(result);
-}
-
-CAMLprim value stub_xc_vcpu_context_get(value xch, value domid,
-                                        value cpu)
-{
-	CAMLparam3(xch, domid, cpu);
-	CAMLlocal1(context);
-	int ret;
-	vcpu_guest_context_any_t ctxt;
-
-	ret = xc_vcpu_getcontext(_H(xch), _D(domid), Int_val(cpu), &ctxt);
-
-	context = caml_alloc_string(sizeof(ctxt));
-	memcpy(String_val(context), (char *) &ctxt.c, sizeof(ctxt.c));
-
-	CAMLreturn(context);
-}
-
-static int get_cpumap_len(value xch, value cpumap)
-{
-	int ml_len = Wosize_val(cpumap);
-	int xc_len = xc_get_max_cpus(_H(xch));
-
-	if (ml_len < xc_len)
-		return ml_len;
-	else
-		return xc_len;
-}
-
-CAMLprim value stub_xc_vcpu_setaffinity(value xch, value domid,
-                                        value vcpu, value cpumap)
-{
-	CAMLparam4(xch, domid, vcpu, cpumap);
-	int i, len = get_cpumap_len(xch, cpumap);
-	xc_cpumap_t c_cpumap;
-	int retval;
-
-	c_cpumap = xc_cpumap_alloc(_H(xch));
-	if (c_cpumap == NULL)
-		failwith_xc(_H(xch));
-
-	for (i=0; i<len; i++) {
-		if (Bool_val(Field(cpumap, i)))
-			c_cpumap[i/8] |= i << (i&7);
-	}
-	retval = xc_vcpu_setaffinity(_H(xch), _D(domid),
-	                             Int_val(vcpu), c_cpumap);
-	free(c_cpumap);
-
-	if (retval < 0)
-		failwith_xc(_H(xch));
-	CAMLreturn(Val_unit);
-}
-
-CAMLprim value stub_xc_vcpu_getaffinity(value xch, value domid,
-                                        value vcpu)
-{
-	CAMLparam3(xch, domid, vcpu);
-	CAMLlocal1(ret);
-	xc_cpumap_t c_cpumap;
-	int i, len = xc_get_max_cpus(_H(xch));
-	int retval;
-
-	c_cpumap = xc_cpumap_alloc(_H(xch));
-	if (c_cpumap == NULL)
-		failwith_xc(_H(xch));
-
-	retval = xc_vcpu_getaffinity(_H(xch), _D(domid),
-	                             Int_val(vcpu), c_cpumap);
-	free(c_cpumap);
-
-	if (retval < 0) {
-		free(c_cpumap);
-		failwith_xc(_H(xch));
-	}
-
-	ret = caml_alloc(len, 0);
-
-	for (i=0; i<len; i++) {
-		if (c_cpumap[i%8] & 1 << (i&7))
-			Store_field(ret, i, Val_true);
-		else
-			Store_field(ret, i, Val_false);
-	}
-
-	free(c_cpumap);
-
-	CAMLreturn(ret);
-}
-
-CAMLprim value stub_xc_sched_id(value xch)
-{
-	CAMLparam1(xch);
-	int sched_id;
-
-	if (xc_sched_id(_H(xch), &sched_id))
-		failwith_xc(_H(xch));
-	CAMLreturn(Val_int(sched_id));
-}
-
-CAMLprim value stub_xc_evtchn_alloc_unbound(value xch,
-                                            value local_domid,
-                                            value remote_domid)
-{
-	CAMLparam3(xch, local_domid, remote_domid);
-
-	uint32_t c_local_domid = _D(local_domid);
-	uint32_t c_remote_domid = _D(remote_domid);
-
-	// caml_enter_blocking_section();
-	int result = xc_evtchn_alloc_unbound(_H(xch), c_local_domid,
-	                                     c_remote_domid);
-	// caml_leave_blocking_section();
-
-	if (result < 0)
-		failwith_xc(_H(xch));
-	CAMLreturn(Val_int(result));
-}
-
-CAMLprim value stub_xc_evtchn_reset(value xch, value domid)
-{
-	CAMLparam2(xch, domid);
-	int r;
-
-	r = xc_evtchn_reset(_H(xch), _D(domid));
-	if (r < 0)
-		failwith_xc(_H(xch));
-	CAMLreturn(Val_unit);
-}
-
-
-#define RING_SIZE 32768
-static char ring[RING_SIZE];
-
-CAMLprim value stub_xc_readconsolering(value xch)
-{
-	unsigned int size = RING_SIZE;
-	char *ring_ptr = ring;
-
-	CAMLparam1(xch);
-
-	// caml_enter_blocking_section();
-	int retval = xc_readconsolering(_H(xch), ring_ptr, &size, 0, 0, NULL);
-	// caml_leave_blocking_section();
-
-	if (retval)
-		failwith_xc(_H(xch));
-	ring[size] = '\0';
-	CAMLreturn(caml_copy_string(ring));
-}
-
-CAMLprim value stub_xc_send_debug_keys(value xch, value keys)
-{
-	CAMLparam2(xch, keys);
-	int r;
-
-	r = xc_send_debug_keys(_H(xch), String_val(keys));
-	if (r)
-		failwith_xc(_H(xch));
-	CAMLreturn(Val_unit);
-}
-
-CAMLprim value stub_xc_physinfo(value xch)
-{
-	CAMLparam1(xch);
-	CAMLlocal3(physinfo, cap_list, tmp);
-	xc_physinfo_t c_physinfo;
-	int r;
-
-	// caml_enter_blocking_section();
-	r = xc_physinfo(_H(xch), &c_physinfo);
-	// caml_leave_blocking_section();
-
-	if (r)
-		failwith_xc(_H(xch));
-
-	tmp = cap_list = Val_emptylist;
-	for (r = 0; r < 2; r++) {
-		if ((c_physinfo.capabilities >> r) & 1) {
-			tmp = caml_alloc_small(2, Tag_cons);
-			Field(tmp, 0) = Val_int(r);
-			Field(tmp, 1) = cap_list;
-			cap_list = tmp;
-		}
-	}
-
-	physinfo = caml_alloc_tuple(9);
-	Store_field(physinfo, 0, Val_int(c_physinfo.threads_per_core));
-	Store_field(physinfo, 1, Val_int(c_physinfo.cores_per_socket));
-	Store_field(physinfo, 2, Val_int(c_physinfo.nr_cpus));
-	Store_field(physinfo, 3, Val_int(c_physinfo.max_node_id));
-	Store_field(physinfo, 4, Val_int(c_physinfo.cpu_khz));
-	Store_field(physinfo, 5, caml_copy_nativeint(c_physinfo.total_pages));
-	Store_field(physinfo, 6, caml_copy_nativeint(c_physinfo.free_pages));
-	Store_field(physinfo, 7, caml_copy_nativeint(c_physinfo.scrub_pages));
-	Store_field(physinfo, 8, cap_list);
-
-	CAMLreturn(physinfo);
-}
-
-CAMLprim value stub_xc_pcpu_info(value xch, value nr_cpus)
-{
-	CAMLparam2(xch, nr_cpus);
-	CAMLlocal2(pcpus, v);
-	xc_cpuinfo_t *info;
-	int r, size;
-
-	if (Int_val(nr_cpus) < 1)
-		caml_invalid_argument("nr_cpus");
-	
-	info = calloc(Int_val(nr_cpus) + 1, sizeof(*info));
-	if (!info)
-		caml_raise_out_of_memory();
-
-	// caml_enter_blocking_section();
-	r = xc_getcpuinfo(_H(xch), Int_val(nr_cpus), info, &size);
-	// caml_leave_blocking_section();
-
-	if (r) {
-		free(info);
-		failwith_xc(_H(xch));
-	}
-
-	if (size > 0) {
-		int i;
-		pcpus = caml_alloc(size, 0);
-		for (i = 0; i < size; i++) {
-			v = caml_copy_int64(info[i].idletime);
-			caml_modify(&Field(pcpus, i), v);
-		}
-	} else
-		pcpus = Atom(0);
-	free(info);
-	CAMLreturn(pcpus);
-}
-
-CAMLprim value stub_xc_domain_setmaxmem(value xch, value domid,
-                                        value max_memkb)
-{
-	CAMLparam3(xch, domid, max_memkb);
-
-	uint32_t c_domid = _D(domid);
-	unsigned int c_max_memkb = Int64_val(max_memkb);
-	// caml_enter_blocking_section();
-	int retval = xc_domain_setmaxmem(_H(xch), c_domid,
-	                                 c_max_memkb);
-	// caml_leave_blocking_section();
-	if (retval)
-		failwith_xc(_H(xch));
-	CAMLreturn(Val_unit);
-}
-
-CAMLprim value stub_xc_domain_set_memmap_limit(value xch, value domid,
-                                               value map_limitkb)
-{
-	CAMLparam3(xch, domid, map_limitkb);
-	unsigned long v;
-	int retval;
-
-	v = Int64_val(map_limitkb);
-	retval = xc_domain_set_memmap_limit(_H(xch), _D(domid), v);
-	if (retval)
-		failwith_xc(_H(xch));
-
-	CAMLreturn(Val_unit);
-}
-
-CAMLprim value stub_xc_domain_memory_increase_reservation(value xch,
-                                                          value domid,
-                                                          value mem_kb)
-{
-	CAMLparam3(xch, domid, mem_kb);
-
-	unsigned long nr_extents = ((unsigned long)(Int64_val(mem_kb))) >> (PAGE_SHIFT - 10);
-
-	uint32_t c_domid = _D(domid);
-	// caml_enter_blocking_section();
-	int retval = xc_domain_increase_reservation_exact(_H(xch), c_domid,
-							  nr_extents, 0, 0, NULL);
-	// caml_leave_blocking_section();
-
-	if (retval)
-		failwith_xc(_H(xch));
-	CAMLreturn(Val_unit);
-}
-
-CAMLprim value stub_xc_domain_set_machine_address_size(value xch,
-						       value domid,
-						       value width)
-{
-	CAMLparam3(xch, domid, width);
-	uint32_t c_domid = _D(domid);
-	int c_width = Int_val(width);
-
-	int retval = xc_domain_set_machine_address_size(_H(xch), c_domid, c_width);
-	if (retval)
-		failwith_xc(_H(xch));
-	CAMLreturn(Val_unit);
-}
-
-CAMLprim value stub_xc_domain_get_machine_address_size(value xch,
-                                                       value domid)
-{
-	CAMLparam2(xch, domid);
-	int retval;
-
-	retval = xc_domain_get_machine_address_size(_H(xch), _D(domid));
-	if (retval < 0)
-		failwith_xc(_H(xch));
-	CAMLreturn(Val_int(retval));
-}
-
-CAMLprim value stub_xc_domain_cpuid_set(value xch, value domid,
-                                        value input,
-                                        value config)
-{
-	CAMLparam4(xch, domid, input, config);
-	CAMLlocal2(array, tmp);
-	int r;
-	unsigned int c_input[2];
-	char *c_config[4], *out_config[4];
-
-	c_config[0] = string_of_option_array(config, 0);
-	c_config[1] = string_of_option_array(config, 1);
-	c_config[2] = string_of_option_array(config, 2);
-	c_config[3] = string_of_option_array(config, 3);
-
-	cpuid_input_of_val(c_input[0], c_input[1], input);
-
-	array = caml_alloc(4, 0);
-	for (r = 0; r < 4; r++) {
-		tmp = Val_none;
-		if (c_config[r]) {
-			tmp = caml_alloc_small(1, 0);
-			Field(tmp, 0) = caml_alloc_string(32);
-		}
-		Store_field(array, r, tmp);
-	}
-
-	for (r = 0; r < 4; r++)
-		out_config[r] = (c_config[r]) ? String_val(Field(Field(array, r), 0)) : NULL;
-
-	r = xc_cpuid_set(_H(xch), _D(domid),
-			 c_input, (const char **)c_config, out_config);
-	if (r < 0)
-		failwith_xc(_H(xch));
-	CAMLreturn(array);
-}
-
-CAMLprim value stub_xc_domain_cpuid_apply_policy(value xch, value domid)
-{
-	CAMLparam2(xch, domid);
-	int r;
-
-	r = xc_cpuid_apply_policy(_H(xch), _D(domid));
-	if (r < 0)
-		failwith_xc(_H(xch));
-	CAMLreturn(Val_unit);
-}
-
-CAMLprim value stub_xc_cpuid_check(value xch, value input, value config)
-{
-	CAMLparam3(xch, input, config);
-	CAMLlocal3(ret, array, tmp);
-	int r;
-	unsigned int c_input[2];
-	char *c_config[4], *out_config[4];
-
-	c_config[0] = string_of_option_array(config, 0);
-	c_config[1] = string_of_option_array(config, 1);
-	c_config[2] = string_of_option_array(config, 2);
-	c_config[3] = string_of_option_array(config, 3);
-
-	cpuid_input_of_val(c_input[0], c_input[1], input);
-
-	array = caml_alloc(4, 0);
-	for (r = 0; r < 4; r++) {
-		tmp = Val_none;
-		if (c_config[r]) {
-			tmp = caml_alloc_small(1, 0);
-			Field(tmp, 0) = caml_alloc_string(32);
-		}
-		Store_field(array, r, tmp);
-	}
-
-	for (r = 0; r < 4; r++)
-		out_config[r] = (c_config[r]) ? String_val(Field(Field(array, r), 0)) : NULL;
-
-	r = xc_cpuid_check(_H(xch), c_input, (const char **)c_config, out_config);
-	if (r < 0)
-		failwith_xc(_H(xch));
-
-	ret = caml_alloc_tuple(2);
-	Store_field(ret, 0, Val_bool(r));
-	Store_field(ret, 1, array);
-
-	CAMLreturn(ret);
-}
-
-CAMLprim value stub_xc_version_version(value xch)
-{
-	CAMLparam1(xch);
-	CAMLlocal1(result);
-	xen_extraversion_t extra;
-	long packed;
-	int retval;
-
-	// caml_enter_blocking_section();
-	packed = xc_version(_H(xch), XENVER_version, NULL);
-	retval = xc_version(_H(xch), XENVER_extraversion, &extra);
-	// caml_leave_blocking_section();
-
-	if (retval)
-		failwith_xc(_H(xch));
-
-	result = caml_alloc_tuple(3);
-
-	Store_field(result, 0, Val_int(packed >> 16));
-	Store_field(result, 1, Val_int(packed & 0xffff));
-	Store_field(result, 2, caml_copy_string(extra));
-
-	CAMLreturn(result);
-}
-
-
-CAMLprim value stub_xc_version_compile_info(value xch)
-{
-	CAMLparam1(xch);
-	CAMLlocal1(result);
-	xen_compile_info_t ci;
-	int retval;
-
-	// caml_enter_blocking_section();
-	retval = xc_version(_H(xch), XENVER_compile_info, &ci);
-	// caml_leave_blocking_section();
-
-	if (retval)
-		failwith_xc(_H(xch));
-
-	result = caml_alloc_tuple(4);
-
-	Store_field(result, 0, caml_copy_string(ci.compiler));
-	Store_field(result, 1, caml_copy_string(ci.compile_by));
-	Store_field(result, 2, caml_copy_string(ci.compile_domain));
-	Store_field(result, 3, caml_copy_string(ci.compile_date));
-
-	CAMLreturn(result);
-}
-
-
-static value xc_version_single_string(value xch, int code, void *info)
-{
-	CAMLparam1(xch);
-	int retval;
-
-	// caml_enter_blocking_section();
-	retval = xc_version(_H(xch), code, info);
-	// caml_leave_blocking_section();
-
-	if (retval)
-		failwith_xc(_H(xch));
-
-	CAMLreturn(caml_copy_string((char *)info));
-}
-
-
-CAMLprim value stub_xc_version_changeset(value xch)
-{
-	xen_changeset_info_t ci;
-
-	return xc_version_single_string(xch, XENVER_changeset, &ci);
-}
-
-
-CAMLprim value stub_xc_version_capabilities(value xch)
-{
-	xen_capabilities_info_t ci;
-
-	return xc_version_single_string(xch, XENVER_capabilities, &ci);
-}
-
-
-CAMLprim value stub_pages_to_kib(value pages)
-{
-	CAMLparam1(pages);
-
-	CAMLreturn(caml_copy_int64(Int64_val(pages) << (PAGE_SHIFT - 10)));
-}
-
-
-CAMLprim value stub_map_foreign_range(value xch, value dom,
-                                      value size, value mfn)
-{
-	CAMLparam4(xch, dom, size, mfn);
-	CAMLlocal1(result);
-	struct mmap_interface *intf;
-	uint32_t c_dom;
-	unsigned long c_mfn;
-
-	result = caml_alloc(sizeof(struct mmap_interface), Abstract_tag);
-	intf = (struct mmap_interface *) result;
-
-	intf->len = Int_val(size);
-
-	c_dom = _D(dom);
-	c_mfn = Nativeint_val(mfn);
-	// caml_enter_blocking_section();
-	intf->addr = xc_map_foreign_range(_H(xch), c_dom,
-	                                  intf->len, PROT_READ|PROT_WRITE,
-	                                  c_mfn);
-	// caml_leave_blocking_section();
-	if (!intf->addr)
-		caml_failwith("xc_map_foreign_range error");
-	CAMLreturn(result);
-}
-
-CAMLprim value stub_sched_credit_domain_get(value xch, value domid)
-{
-	CAMLparam2(xch, domid);
-	CAMLlocal1(sdom);
-	struct xen_domctl_sched_credit c_sdom;
-	int ret;
-
-	// caml_enter_blocking_section();
-	ret = xc_sched_credit_domain_get(_H(xch), _D(domid), &c_sdom);
-	// caml_leave_blocking_section();
-	if (ret != 0)
-		failwith_xc(_H(xch));
-
-	sdom = caml_alloc_tuple(2);
-	Store_field(sdom, 0, Val_int(c_sdom.weight));
-	Store_field(sdom, 1, Val_int(c_sdom.cap));
-
-	CAMLreturn(sdom);
-}
-
-CAMLprim value stub_sched_credit_domain_set(value xch, value domid,
-                                            value sdom)
-{
-	CAMLparam3(xch, domid, sdom);
-	struct xen_domctl_sched_credit c_sdom;
-	int ret;
-
-	c_sdom.weight = Int_val(Field(sdom, 0));
-	c_sdom.cap = Int_val(Field(sdom, 1));
-	// caml_enter_blocking_section();
-	ret = xc_sched_credit_domain_set(_H(xch), _D(domid), &c_sdom);
-	// caml_leave_blocking_section();
-	if (ret != 0)
-		failwith_xc(_H(xch));
-
-	CAMLreturn(Val_unit);
-}
-
-CAMLprim value stub_shadow_allocation_get(value xch, value domid)
-{
-	CAMLparam2(xch, domid);
-	CAMLlocal1(mb);
-	unsigned long c_mb;
-	int ret;
-
-	// caml_enter_blocking_section();
-	ret = xc_shadow_control(_H(xch), _D(domid),
-				XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION,
-				NULL, 0, &c_mb, 0, NULL);
-	// caml_leave_blocking_section();
-	if (ret != 0)
-		failwith_xc(_H(xch));
-
-	mb = Val_int(c_mb);
-	CAMLreturn(mb);
-}
-
-CAMLprim value stub_shadow_allocation_set(value xch, value domid,
-					  value mb)
-{
-	CAMLparam3(xch, domid, mb);
-	unsigned long c_mb;
-	int ret;
-
-	c_mb = Int_val(mb);
-	// caml_enter_blocking_section();
-	ret = xc_shadow_control(_H(xch), _D(domid),
-				XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION,
-				NULL, 0, &c_mb, 0, NULL);
-	// caml_leave_blocking_section();
-	if (ret != 0)
-		failwith_xc(_H(xch));
-
-	CAMLreturn(Val_unit);
-}
-
-CAMLprim value stub_xc_domain_get_pfn_list(value xch, value domid,
-                                           value nr_pfns)
-{
-	CAMLparam3(xch, domid, nr_pfns);
-	CAMLlocal2(array, v);
-	unsigned long c_nr_pfns;
-	long ret, i;
-	uint64_t *c_array;
-
-	c_nr_pfns = Nativeint_val(nr_pfns);
-
-	c_array = malloc(sizeof(uint64_t) * c_nr_pfns);
-	if (!c_array)
-		caml_raise_out_of_memory();
-
-	ret = xc_get_pfn_list(_H(xch), _D(domid),
-			      c_array, c_nr_pfns);
-	if (ret < 0) {
-		free(c_array);
-		failwith_xc(_H(xch));
-	}
-
-	array = caml_alloc(ret, 0);
-	for (i = 0; i < ret; i++) {
-		v = caml_copy_nativeint(c_array[i]);
-		Store_field(array, i, v);
-	}
-	free(c_array);
-
-	CAMLreturn(array);
-}
-
-CAMLprim value stub_xc_domain_ioport_permission(value xch, value domid,
-					       value start_port, value nr_ports,
-					       value allow)
-{
-	CAMLparam5(xch, domid, start_port, nr_ports, allow);
-	uint32_t c_start_port, c_nr_ports;
-	uint8_t c_allow;
-	int ret;
-
-	c_start_port = Int_val(start_port);
-	c_nr_ports = Int_val(nr_ports);
-	c_allow = Bool_val(allow);
-
-	ret = xc_domain_ioport_permission(_H(xch), _D(domid),
-					 c_start_port, c_nr_ports, c_allow);
-	if (ret < 0)
-		failwith_xc(_H(xch));
-
-	CAMLreturn(Val_unit);
-}
-
-CAMLprim value stub_xc_domain_iomem_permission(value xch, value domid,
-					       value start_pfn, value nr_pfns,
-					       value allow)
-{
-	CAMLparam5(xch, domid, start_pfn, nr_pfns, allow);
-	unsigned long c_start_pfn, c_nr_pfns;
-	uint8_t c_allow;
-	int ret;
-
-	c_start_pfn = Nativeint_val(start_pfn);
-	c_nr_pfns = Nativeint_val(nr_pfns);
-	c_allow = Bool_val(allow);
-
-	ret = xc_domain_iomem_permission(_H(xch), _D(domid),
-					 c_start_pfn, c_nr_pfns, c_allow);
-	if (ret < 0)
-		failwith_xc(_H(xch));
-
-	CAMLreturn(Val_unit);
-}
-
-CAMLprim value stub_xc_domain_irq_permission(value xch, value domid,
-					     value pirq, value allow)
-{
-	CAMLparam4(xch, domid, pirq, allow);
-	uint8_t c_pirq;
-	uint8_t c_allow;
-	int ret;
-
-	c_pirq = Int_val(pirq);
-	c_allow = Bool_val(allow);
-
-	ret = xc_domain_irq_permission(_H(xch), _D(domid),
-				       c_pirq, c_allow);
-	if (ret < 0)
-		failwith_xc(_H(xch));
-
-	CAMLreturn(Val_unit);
-}
-
-static uint32_t pci_dev_to_bdf(int domain, int bus, int slot, int func)
-{
-	uint32_t bdf = 0;
-	bdf |= (bus & 0xff) << 16;
-	bdf |= (slot & 0x1f) << 11;
-	bdf |= (func & 0x7) << 8;
-	return bdf;
-}
-
-CAMLprim value stub_xc_domain_test_assign_device(value xch, value domid, value desc)
-{
-	CAMLparam3(xch, domid, desc);
-	int ret;
-	int domain, bus, slot, func;
-	uint32_t bdf;
-
-	domain = Int_val(Field(desc, 0));
-	bus = Int_val(Field(desc, 1));
-	slot = Int_val(Field(desc, 2));
-	func = Int_val(Field(desc, 3));
-	bdf = pci_dev_to_bdf(domain, bus, slot, func);
-
-	ret = xc_test_assign_device(_H(xch), _D(domid), bdf);
-
-	CAMLreturn(Val_bool(ret == 0));
-}
-
-CAMLprim value stub_xc_domain_assign_device(value xch, value domid, value desc)
-{
-	CAMLparam3(xch, domid, desc);
-	int ret;
-	int domain, bus, slot, func;
-	uint32_t bdf;
-
-	domain = Int_val(Field(desc, 0));
-	bus = Int_val(Field(desc, 1));
-	slot = Int_val(Field(desc, 2));
-	func = Int_val(Field(desc, 3));
-	bdf = pci_dev_to_bdf(domain, bus, slot, func);
-
-	ret = xc_assign_device(_H(xch), _D(domid), bdf);
-
-	if (ret < 0)
-		failwith_xc(_H(xch));
-	CAMLreturn(Val_unit);
-}
-
-CAMLprim value stub_xc_domain_deassign_device(value xch, value domid, value desc)
-{
-	CAMLparam3(xch, domid, desc);
-	int ret;
-	int domain, bus, slot, func;
-	uint32_t bdf;
-
-	domain = Int_val(Field(desc, 0));
-	bus = Int_val(Field(desc, 1));
-	slot = Int_val(Field(desc, 2));
-	func = Int_val(Field(desc, 3));
-	bdf = pci_dev_to_bdf(domain, bus, slot, func);
-
-	ret = xc_deassign_device(_H(xch), _D(domid), bdf);
-
-	if (ret < 0)
-		failwith_xc(_H(xch));
-	CAMLreturn(Val_unit);
-}
-
-CAMLprim value stub_xc_watchdog(value xch, value domid, value timeout)
-{
-	CAMLparam3(xch, domid, timeout);
-	int ret;
-	unsigned int c_timeout = Int32_val(timeout);
-
-	ret = xc_watchdog(_H(xch), _D(domid), c_timeout);
-	if (ret < 0)
-		failwith_xc(_H(xch));
-
-	CAMLreturn(Val_int(ret));
-}
-
-/*
- * Local variables:
- *  indent-tabs-mode: t
- *  c-basic-offset: 8
- *  tab-width: 8
- * End:
- */
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xc/xenctrl.ml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/ocaml/libs/xc/xenctrl.ml	Mon Oct 10 16:37:07 2011 +0100
@@ -0,0 +1,326 @@
+(*
+ * Copyright (C) 2006-2007 XenSource Ltd.
+ * Copyright (C) 2008      Citrix Ltd.
+ * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *)
+
+(** *)
+type domid = int
+
+(* ** xenctrl.h ** *)
+
+type vcpuinfo =
+{
+	online: bool;
+	blocked: bool;
+	running: bool;
+	cputime: int64;
+	cpumap: int32;
+}
+
+type domaininfo =
+{
+	domid             : domid;
+	dying             : bool;
+	shutdown          : bool;
+	paused            : bool;
+	blocked           : bool;
+	running           : bool;
+	hvm_guest         : bool;
+	shutdown_code     : int;
+	total_memory_pages: nativeint;
+	max_memory_pages  : nativeint;
+	shared_info_frame : int64;
+	cpu_time          : int64;
+	nr_online_vcpus   : int;
+	max_vcpu_id       : int;
+	ssidref           : int32;
+	handle            : int array;
+}
+
+type sched_control =
+{
+	weight : int;
+	cap    : int;
+}
+
+type physinfo_cap_flag =
+	| CAP_HVM
+	| CAP_DirectIO
+
+type physinfo =
+{
+	threads_per_core : int;
+	cores_per_socket : int;
+	nr_cpus          : int;
+	max_node_id      : int;
+	cpu_khz          : int;
+	total_pages      : nativeint;
+	free_pages       : nativeint;
+	scrub_pages      : nativeint;
+	(* XXX hw_cap *)
+	capabilities     : physinfo_cap_flag list;
+}
+
+type version =
+{
+	major : int;
+	minor : int;
+	extra : string;
+}
+
+
+type compile_info =
+{
+	compiler : string;
+	compile_by : string;
+	compile_domain : string;
+	compile_date : string;
+}
+
+type shutdown_reason = Poweroff | Reboot | Suspend | Crash | Halt
+
+type domain_create_flag = CDF_HVM | CDF_HAP
+
+exception Error of string
+
+type handle
+
+(* this is only use by coredumping *)
+external sizeof_core_header: unit -> int
+       = "stub_sizeof_core_header"
+external sizeof_vcpu_guest_context: unit -> int
+       = "stub_sizeof_vcpu_guest_context"
+external sizeof_xen_pfn: unit -> int = "stub_sizeof_xen_pfn"
+(* end of use *)
+
+external interface_open: unit -> handle = "stub_xc_interface_open"
+external interface_close: handle -> unit = "stub_xc_interface_close"
+
+external is_fake: unit -> bool = "stub_xc_interface_is_fake"
+
+let with_intf f =
+	let xc = interface_open () in
+	let r = try f xc with exn -> interface_close xc; raise exn in
+	interface_close xc;
+	r
+
+external _domain_create: handle -> int32 -> domain_create_flag list -> int array -> domid
+       = "stub_xc_domain_create"
+
+let domain_create handle n flags uuid =
+	_domain_create handle n flags (Uuid.int_array_of_uuid uuid)
+
+external _domain_sethandle: handle -> domid -> int array -> unit
+                          = "stub_xc_domain_sethandle"
+
+let domain_sethandle handle n uuid =
+	_domain_sethandle handle n (Uuid.int_array_of_uuid uuid)
+
+external domain_max_vcpus: handle -> domid -> int -> unit
+       = "stub_xc_domain_max_vcpus"
+
+external domain_pause: handle -> domid -> unit = "stub_xc_domain_pause"
+external domain_unpause: handle -> domid -> unit = "stub_xc_domain_unpause"
+external domain_resume_fast: handle -> domid -> unit = "stub_xc_domain_resume_fast"
+external domain_destroy: handle -> domid -> unit = "stub_xc_domain_destroy"
+
+external domain_shutdown: handle -> domid -> shutdown_reason -> unit
+       = "stub_xc_domain_shutdown"
+
+external _domain_getinfolist: handle -> domid -> int -> domaininfo list
+       = "stub_xc_domain_getinfolist"
+
+let domain_getinfolist handle first_domain =
+	let nb = 2 in
+	let last_domid l = (List.hd l).domid + 1 in
+	let rec __getlist from =
+		let l = _domain_getinfolist handle from nb in
+		(if List.length l = nb then __getlist (last_domid l) else []) @ l
+		in
+	List.rev (__getlist first_domain)
+
+external domain_getinfo: handle -> domid -> domaininfo= "stub_xc_domain_getinfo"
+
+external domain_get_vcpuinfo: handle -> int -> int -> vcpuinfo
+       = "stub_xc_vcpu_getinfo"
+
+external domain_ioport_permission: handle -> domid -> int -> int -> bool -> unit
+       = "stub_xc_domain_ioport_permission"
+external domain_iomem_permission: handle -> domid -> nativeint -> nativeint -> bool -> unit
+       = "stub_xc_domain_iomem_permission"
+external domain_irq_permission: handle -> domid -> int -> bool -> unit
+       = "stub_xc_domain_irq_permission"
+
+external vcpu_affinity_set: handle -> domid -> int -> bool array -> unit
+       = "stub_xc_vcpu_setaffinity"
+external vcpu_affinity_get: handle -> domid -> int -> bool array
+       = "stub_xc_vcpu_getaffinity"
+
+external vcpu_context_get: handle -> domid -> int -> string
+       = "stub_xc_vcpu_context_get"
+
+external sched_id: handle -> int = "stub_xc_sched_id"
+
+external sched_credit_domain_set: handle -> domid -> sched_control -> unit
+       = "stub_sched_credit_domain_set"
+external sched_credit_domain_get: handle -> domid -> sched_control
+       = "stub_sched_credit_domain_get"
+
+external shadow_allocation_set: handle -> domid -> int -> unit
+       = "stub_shadow_allocation_set"
+external shadow_allocation_get: handle -> domid -> int
+       = "stub_shadow_allocation_get"
+
+external evtchn_alloc_unbound: handle -> domid -> domid -> int
+       = "stub_xc_evtchn_alloc_unbound"
+external evtchn_reset: handle -> domid -> unit = "stub_xc_evtchn_reset"
+
+external readconsolering: handle -> string = "stub_xc_readconsolering"
+
+external send_debug_keys: handle -> string -> unit = "stub_xc_send_debug_keys"
+external physinfo: handle -> physinfo = "stub_xc_physinfo"
+external pcpu_info: handle -> int -> int64 array = "stub_xc_pcpu_info"
+
+external domain_setmaxmem: handle -> domid -> int64 -> unit
+       = "stub_xc_domain_setmaxmem"
+external domain_set_memmap_limit: handle -> domid -> int64 -> unit
+       = "stub_xc_domain_set_memmap_limit"
+external domain_memory_increase_reservation: handle -> domid -> int64 -> unit
+       = "stub_xc_domain_memory_increase_reservation"
+
+external domain_set_machine_address_size: handle -> domid -> int -> unit
+       = "stub_xc_domain_set_machine_address_size"
+external domain_get_machine_address_size: handle -> domid -> int
+       = "stub_xc_domain_get_machine_address_size"
+
+external domain_cpuid_set: handle -> domid -> (int64 * (int64 option))
+                        -> string option array
+                        -> string option array
+       = "stub_xc_domain_cpuid_set"
+external domain_cpuid_apply_policy: handle -> domid -> unit
+       = "stub_xc_domain_cpuid_apply_policy"
+external cpuid_check: handle -> (int64 * (int64 option)) -> string option array -> (bool * string option array)
+       = "stub_xc_cpuid_check"
+
+external map_foreign_range: handle -> domid -> int
+                         -> nativeint -> Xenmmap.mmap_interface
+       = "stub_map_foreign_range"
+
+external domain_get_pfn_list: handle -> domid -> nativeint -> nativeint array
+       = "stub_xc_domain_get_pfn_list"
+
+external domain_assign_device: handle -> domid -> (int * int * int * int) -> unit
+       = "stub_xc_domain_assign_device"
+external domain_deassign_device: handle -> domid -> (int * int * int * int) -> unit
+       = "stub_xc_domain_deassign_device"
+external domain_test_assign_device: handle -> domid -> (int * int * int * int) -> bool
+       = "stub_xc_domain_test_assign_device"
+
+external version: handle -> version = "stub_xc_version_version"
+external version_compile_info: handle -> compile_info
+       = "stub_xc_version_compile_info"
+external version_changeset: handle -> string = "stub_xc_version_changeset"
+external version_capabilities: handle -> string =
+  "stub_xc_version_capabilities"
+
+external watchdog : handle -> int -> int32 -> int
+  = "stub_xc_watchdog"
+
+(* core dump structure *)
+type core_magic = Magic_hvm | Magic_pv
+
+type core_header = {
+	xch_magic: core_magic;
+	xch_nr_vcpus: int;
+	xch_nr_pages: nativeint;
+	xch_index_offset: int64;
+	xch_ctxt_offset: int64;
+	xch_pages_offset: int64;
+}
+
+external marshall_core_header: core_header -> string = "stub_marshall_core_header"
+
+(* coredump *)
+let coredump xch domid fd =
+	let dump s =
+		let wd = Unix.write fd s 0 (String.length s) in
+		if wd <> String.length s then
+			failwith "error while writing";
+		in
+
+	let info = domain_getinfo xch domid in
+
+	let nrpages = info.total_memory_pages in
+	let ctxt = Array.make info.max_vcpu_id None in
+	let nr_vcpus = ref 0 in
+	for i = 0 to info.max_vcpu_id - 1
+	do
+		ctxt.(i) <- try
+			let v = vcpu_context_get xch domid i in
+			incr nr_vcpus;
+			Some v
+			with _ -> None
+	done;
+
+	(* FIXME page offset if not rounded to sup *)
+	let page_offset =
+		Int64.add
+			(Int64.of_int (sizeof_core_header () +
+			 (sizeof_vcpu_guest_context () * !nr_vcpus)))
+			(Int64.of_nativeint (
+				Nativeint.mul
+					(Nativeint.of_int (sizeof_xen_pfn ()))
+					nrpages)
+				)
+		in
+
+	let header = {
+		xch_magic = if info.hvm_guest then Magic_hvm else Magic_pv;
+		xch_nr_vcpus = !nr_vcpus;
+		xch_nr_pages = nrpages;
+		xch_ctxt_offset = Int64.of_int (sizeof_core_header ());
+		xch_index_offset = Int64.of_int (sizeof_core_header ()
+					+ sizeof_vcpu_guest_context ());
+		xch_pages_offset = page_offset;
+	} in
+
+	dump (marshall_core_header header);
+	for i = 0 to info.max_vcpu_id - 1
+	do
+		match ctxt.(i) with
+		| None -> ()
+		| Some ctxt_i -> dump ctxt_i
+	done;
+	let pfns = domain_get_pfn_list xch domid nrpages in
+	if Array.length pfns <> Nativeint.to_int nrpages then
+		failwith "could not get the page frame list";
+
+	let page_size = Xenmmap.getpagesize () in
+	for i = 0 to Nativeint.to_int nrpages - 1
+	do
+		let page = map_foreign_range xch domid page_size pfns.(i) in
+		let data = Xenmmap.read page 0 page_size in
+		Xenmmap.unmap page;
+		dump data
+	done
+
+(* ** Misc ** *)
+
+(**
+   Convert the given number of pages to an amount in KiB, rounded up.
+ *)
+external pages_to_kib : int64 -> int64 = "stub_pages_to_kib"
+let pages_to_mib pages = Int64.div (pages_to_kib pages) 1024L
+
+let _ = Callback.register_exception "xc.error" (Error "register_callback")
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xc/xenctrl.mli
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/ocaml/libs/xc/xenctrl.mli	Mon Oct 10 16:37:07 2011 +0100
@@ -0,0 +1,184 @@
+(*
+ * Copyright (C) 2006-2007 XenSource Ltd.
+ * Copyright (C) 2008      Citrix Ltd.
+ * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *)
+
+type domid = int
+type vcpuinfo = {
+  online : bool;
+  blocked : bool;
+  running : bool;
+  cputime : int64;
+  cpumap : int32;
+}
+type domaininfo = {
+  domid : domid;
+  dying : bool;
+  shutdown : bool;
+  paused : bool;
+  blocked : bool;
+  running : bool;
+  hvm_guest : bool;
+  shutdown_code : int;
+  total_memory_pages : nativeint;
+  max_memory_pages : nativeint;
+  shared_info_frame : int64;
+  cpu_time : int64;
+  nr_online_vcpus : int;
+  max_vcpu_id : int;
+  ssidref : int32;
+  handle : int array;
+}
+type sched_control = { weight : int; cap : int; }
+type physinfo_cap_flag = CAP_HVM | CAP_DirectIO
+type physinfo = {
+  threads_per_core : int;
+  cores_per_socket : int;
+  nr_cpus          : int;
+  max_node_id      : int;
+  cpu_khz          : int;
+  total_pages      : nativeint;
+  free_pages       : nativeint;
+  scrub_pages      : nativeint;
+  capabilities     : physinfo_cap_flag list;
+}
+type version = { major : int; minor : int; extra : string; }
+type compile_info = {
+  compiler : string;
+  compile_by : string;
+  compile_domain : string;
+  compile_date : string;
+}
+type shutdown_reason = Poweroff | Reboot | Suspend | Crash | Halt
+
+type domain_create_flag = CDF_HVM | CDF_HAP
+
+exception Error of string
+type handle
+external sizeof_core_header : unit -> int = "stub_sizeof_core_header"
+external sizeof_vcpu_guest_context : unit -> int
+  = "stub_sizeof_vcpu_guest_context"
+external sizeof_xen_pfn : unit -> int = "stub_sizeof_xen_pfn"
+external interface_open : unit -> handle = "stub_xc_interface_open"
+external is_fake : unit -> bool = "stub_xc_interface_is_fake"
+external interface_close : handle -> unit = "stub_xc_interface_close"
+val with_intf : (handle -> 'a) -> 'a
+external _domain_create : handle -> int32 -> domain_create_flag list -> int array -> domid
+  = "stub_xc_domain_create"
+val domain_create : handle -> int32 -> domain_create_flag list -> 'a Uuid.t -> domid
+external _domain_sethandle : handle -> domid -> int array -> unit
+  = "stub_xc_domain_sethandle"
+val domain_sethandle : handle -> domid -> 'a Uuid.t -> unit
+external domain_max_vcpus : handle -> domid -> int -> unit
+  = "stub_xc_domain_max_vcpus"
+external domain_pause : handle -> domid -> unit = "stub_xc_domain_pause"
+external domain_unpause : handle -> domid -> unit = "stub_xc_domain_unpause"
+external domain_resume_fast : handle -> domid -> unit
+  = "stub_xc_domain_resume_fast"
+external domain_destroy : handle -> domid -> unit = "stub_xc_domain_destroy"
+external domain_shutdown : handle -> domid -> shutdown_reason -> unit
+  = "stub_xc_domain_shutdown"
+external _domain_getinfolist : handle -> domid -> int -> domaininfo list
+  = "stub_xc_domain_getinfolist"
+val domain_getinfolist : handle -> domid -> domaininfo list
+external domain_getinfo : handle -> domid -> domaininfo
+  = "stub_xc_domain_getinfo"
+external domain_get_vcpuinfo : handle -> int -> int -> vcpuinfo
+  = "stub_xc_vcpu_getinfo"
+external domain_ioport_permission: handle -> domid -> int -> int -> bool -> unit
+       = "stub_xc_domain_ioport_permission"
+external domain_iomem_permission: handle -> domid -> nativeint -> nativeint -> bool -> unit
+       = "stub_xc_domain_iomem_permission"
+external domain_irq_permission: handle -> domid -> int -> bool -> unit
+       = "stub_xc_domain_irq_permission"
+external vcpu_affinity_set : handle -> domid -> int -> bool array -> unit
+  = "stub_xc_vcpu_setaffinity"
+external vcpu_affinity_get : handle -> domid -> int -> bool array
+  = "stub_xc_vcpu_getaffinity"
+external vcpu_context_get : handle -> domid -> int -> string
+  = "stub_xc_vcpu_context_get"
+external sched_id : handle -> int = "stub_xc_sched_id"
+external sched_credit_domain_set : handle -> domid -> sched_control -> unit
+  = "stub_sched_credit_domain_set"
+external sched_credit_domain_get : handle -> domid -> sched_control
+  = "stub_sched_credit_domain_get"
+external shadow_allocation_set : handle -> domid -> int -> unit
+  = "stub_shadow_allocation_set"
+external shadow_allocation_get : handle -> domid -> int
+  = "stub_shadow_allocation_get"
+external evtchn_alloc_unbound : handle -> domid -> domid -> int
+  = "stub_xc_evtchn_alloc_unbound"
+external evtchn_reset : handle -> domid -> unit = "stub_xc_evtchn_reset"
+external readconsolering : handle -> string = "stub_xc_readconsolering"
+external send_debug_keys : handle -> string -> unit = "stub_xc_send_debug_keys"
+external physinfo : handle -> physinfo = "stub_xc_physinfo"
+external pcpu_info: handle -> int -> int64 array = "stub_xc_pcpu_info"
+external domain_setmaxmem : handle -> domid -> int64 -> unit
+  = "stub_xc_domain_setmaxmem"
+external domain_set_memmap_limit : handle -> domid -> int64 -> unit
+  = "stub_xc_domain_set_memmap_limit"
+external domain_memory_increase_reservation :
+  handle -> domid -> int64 -> unit
+  = "stub_xc_domain_memory_increase_reservation"
+external map_foreign_range :
+  handle -> domid -> int -> nativeint -> Xenmmap.mmap_interface
+  = "stub_map_foreign_range"
+external domain_get_pfn_list :
+  handle -> domid -> nativeint -> nativeint array
+  = "stub_xc_domain_get_pfn_list"
+
+external domain_assign_device: handle -> domid -> (int * int * int * int) -> unit
+       = "stub_xc_domain_assign_device"
+external domain_deassign_device: handle -> domid -> (int * int * int * int) -> unit
+       = "stub_xc_domain_deassign_device"
+external domain_test_assign_device: handle -> domid -> (int * int * int * int) -> bool
+       = "stub_xc_domain_test_assign_device"
+
+external version : handle -> version = "stub_xc_version_version"
+external version_compile_info : handle -> compile_info
+  = "stub_xc_version_compile_info"
+external version_changeset : handle -> string = "stub_xc_version_changeset"
+external version_capabilities : handle -> string
+  = "stub_xc_version_capabilities"
+type core_magic = Magic_hvm | Magic_pv
+type core_header = {
+  xch_magic : core_magic;
+  xch_nr_vcpus : int;
+  xch_nr_pages : nativeint;
+  xch_index_offset : int64;
+  xch_ctxt_offset : int64;
+  xch_pages_offset : int64;
+}
+external marshall_core_header : core_header -> string
+  = "stub_marshall_core_header"
+val coredump : handle -> domid -> Unix.file_descr -> unit
+external pages_to_kib : int64 -> int64 = "stub_pages_to_kib"
+val pages_to_mib : int64 -> int64
+external watchdog : handle -> int -> int32 -> int
+  = "stub_xc_watchdog"
+
+external domain_set_machine_address_size: handle -> domid -> int -> unit
+  = "stub_xc_domain_set_machine_address_size"
+external domain_get_machine_address_size: handle -> domid -> int
+       = "stub_xc_domain_get_machine_address_size"
+
+external domain_cpuid_set: handle -> domid -> (int64 * (int64 option))
+                        -> string option array
+                        -> string option array
+       = "stub_xc_domain_cpuid_set"
+external domain_cpuid_apply_policy: handle -> domid -> unit
+       = "stub_xc_domain_cpuid_apply_policy"
+external cpuid_check: handle -> (int64 * (int64 option)) -> string option array -> (bool * string option array)
+       = "stub_xc_cpuid_check"
+
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xc/xenctrl_stubs.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c	Mon Oct 10 16:37:07 2011 +0100
@@ -0,0 +1,1161 @@
+/*
+ * Copyright (C) 2006-2007 XenSource Ltd.
+ * Copyright (C) 2008      Citrix Ltd.
+ * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ */
+
+#define _XOPEN_SOURCE 600
+#include <stdlib.h>
+#include <errno.h>
+
+#define CAML_NAME_SPACE
+#include <caml/alloc.h>
+#include <caml/memory.h>
+#include <caml/signals.h>
+#include <caml/fail.h>
+#include <caml/callback.h>
+
+#include <sys/mman.h>
+#include <stdint.h>
+#include <string.h>
+
+#include <xenctrl.h>
+
+#include "mmap_stubs.h"
+
+#define PAGE_SHIFT		12
+#define PAGE_SIZE               (1UL << PAGE_SHIFT)
+#define PAGE_MASK               (~(PAGE_SIZE-1))
+
+#define _H(__h) ((xc_interface *)(__h))
+#define _D(__d) ((uint32_t)Int_val(__d))
+
+#define Val_none (Val_int(0))
+
+#define string_of_option_array(array, index) \
+	((Field(array, index) == Val_none) ? NULL : String_val(Field(Field(array, index), 0)))
+
+/* maybe here we should check the range of the input instead of blindly
+ * casting it to uint32 */
+#define cpuid_input_of_val(i1, i2, input) \
+	i1 = (uint32_t) Int64_val(Field(input, 0)); \
+	i2 = ((Field(input, 1) == Val_none) ? 0xffffffff : (uint32_t) Int64_val(Field(Field(input, 1), 0)));
+
+#define ERROR_STRLEN 1024
+void failwith_xc(xc_interface *xch)
+{
+	static char error_str[ERROR_STRLEN];
+	if (xch) {
+		const xc_error *error = xc_get_last_error(xch);
+		if (error->code == XC_ERROR_NONE)
+                	snprintf(error_str, ERROR_STRLEN, "%d: %s", errno, strerror(errno));
+		else
+			snprintf(error_str, ERROR_STRLEN, "%d: %s: %s",
+				 error->code,
+				 xc_error_code_to_desc(error->code),
+				 error->message);
+	} else {
+		snprintf(error_str, ERROR_STRLEN, "Unable to open XC interface");
+	}
+	caml_raise_with_string(*caml_named_value("xc.error"), error_str);
+}
+
+CAMLprim value stub_sizeof_core_header(value unit)
+{
+	CAMLparam1(unit);
+	CAMLreturn(Val_int(sizeof(struct xc_core_header)));
+}
+
+CAMLprim value stub_sizeof_vcpu_guest_context(value unit)
+{
+	CAMLparam1(unit);
+	CAMLreturn(Val_int(sizeof(struct vcpu_guest_context)));
+}
+
+CAMLprim value stub_sizeof_xen_pfn(value unit)
+{
+	CAMLparam1(unit);
+	CAMLreturn(Val_int(sizeof(xen_pfn_t)));
+}
+
+#define XC_CORE_MAGIC     0xF00FEBED
+#define XC_CORE_MAGIC_HVM 0xF00FEBEE
+
+CAMLprim value stub_marshall_core_header(value header)
+{
+	CAMLparam1(header);
+	CAMLlocal1(s);
+	struct xc_core_header c_header;
+
+	c_header.xch_magic = (Field(header, 0))
+		? XC_CORE_MAGIC
+		: XC_CORE_MAGIC_HVM;
+	c_header.xch_nr_vcpus = Int_val(Field(header, 1));
+	c_header.xch_nr_pages = Nativeint_val(Field(header, 2));
+	c_header.xch_ctxt_offset = Int64_val(Field(header, 3));
+	c_header.xch_index_offset = Int64_val(Field(header, 4));
+	c_header.xch_pages_offset = Int64_val(Field(header, 5));
+
+	s = caml_alloc_string(sizeof(c_header));
+	memcpy(String_val(s), (char *) &c_header, sizeof(c_header));
+	CAMLreturn(s);
+}
+
+CAMLprim value stub_xc_interface_open(void)
+{
+	CAMLparam0();
+        xc_interface *xch;
+        xch = xc_interface_open(NULL, NULL, XC_OPENFLAG_NON_REENTRANT);
+        if (xch == NULL)
+		failwith_xc(NULL);
+        CAMLreturn((value)xch);
+}
+
+
+CAMLprim value stub_xc_interface_is_fake(void)
+{
+	CAMLparam0();
+	int is_fake = xc_interface_is_fake();
+	CAMLreturn(Val_int(is_fake));
+}
+
+CAMLprim value stub_xc_interface_close(value xch)
+{
+	CAMLparam1(xch);
+
+	// caml_enter_blocking_section();
+	xc_interface_close(_H(xch));
+	// caml_leave_blocking_section();
+
+	CAMLreturn(Val_unit);
+}
+
+static int domain_create_flag_table[] = {
+	XEN_DOMCTL_CDF_hvm_guest,
+	XEN_DOMCTL_CDF_hap,
+};
+
+CAMLprim value stub_xc_domain_create(value xch, value ssidref,
+                                     value flags, value handle)
+{
+	CAMLparam4(xch, ssidref, flags, handle);
+
+	uint32_t domid = 0;
+	xen_domain_handle_t h = { 0 };
+	int result;
+	int i;
+	uint32_t c_ssidref = Int32_val(ssidref);
+	unsigned int c_flags = 0;
+	value l;
+
+        if (Wosize_val(handle) != 16)
+		caml_invalid_argument("Handle not a 16-integer array");
+
+	for (i = 0; i < sizeof(h); i++) {
+		h[i] = Int_val(Field(handle, i)) & 0xff;
+	}
+
+	for (l = flags; l != Val_none; l = Field(l, 1)) {
+		int v = Int_val(Field(l, 0));
+		c_flags |= domain_create_flag_table[v];
+	}
+
+	// caml_enter_blocking_section();
+	result = xc_domain_create(_H(xch), c_ssidref, h, c_flags, &domid);
+	// caml_leave_blocking_section();
+
+	if (result < 0)
+		failwith_xc(_H(xch));
+
+	CAMLreturn(Val_int(domid));
+}
+
+CAMLprim value stub_xc_domain_max_vcpus(value xch, value domid,
+                                        value max_vcpus)
+{
+	CAMLparam3(xch, domid, max_vcpus);
+	int r;
+
+	r = xc_domain_max_vcpus(_H(xch), _D(domid), Int_val(max_vcpus));
+	if (r)
+		failwith_xc(_H(xch));
+
+	CAMLreturn(Val_unit);
+}
+
+
+value stub_xc_domain_sethandle(value xch, value domid, value handle)
+{
+	CAMLparam3(xch, domid, handle);
+	xen_domain_handle_t h = { 0 };
+	int i;
+
+        if (Wosize_val(handle) != 16)
+		caml_invalid_argument("Handle not a 16-integer array");
+
+	for (i = 0; i < sizeof(h); i++) {
+		h[i] = Int_val(Field(handle, i)) & 0xff;
+	}
+
+	i = xc_domain_sethandle(_H(xch), _D(domid), h);
+	if (i)
+		failwith_xc(_H(xch));
+
+	CAMLreturn(Val_unit);
+}
+
+static value dom_op(value xch, value domid, int (*fn)(xc_interface *, uint32_t))
+{
+	CAMLparam2(xch, domid);
+
+	uint32_t c_domid = _D(domid);
+
+	// caml_enter_blocking_section();
+	int result = fn(_H(xch), c_domid);
+	// caml_leave_blocking_section();
+        if (result)
+		failwith_xc(_H(xch));
+	CAMLreturn(Val_unit);
+}
+
+CAMLprim value stub_xc_domain_pause(value xch, value domid)
+{
+	return dom_op(xch, domid, xc_domain_pause);
+}
+
+
+CAMLprim value stub_xc_domain_unpause(value xch, value domid)
+{
+	return dom_op(xch, domid, xc_domain_unpause);
+}
+
+CAMLprim value stub_xc_domain_destroy(value xch, value domid)
+{
+	return dom_op(xch, domid, xc_domain_destroy);
+}
+
+CAMLprim value stub_xc_domain_resume_fast(value xch, value domid)
+{
+	CAMLparam2(xch, domid);
+
+	uint32_t c_domid = _D(domid);
+
+	// caml_enter_blocking_section();
+	int result = xc_domain_resume(_H(xch), c_domid, 1);
+	// caml_leave_blocking_section();
+        if (result)
+		failwith_xc(_H(xch));
+	CAMLreturn(Val_unit);
+}
+
+CAMLprim value stub_xc_domain_shutdown(value xch, value domid, value reason)
+{
+	CAMLparam3(xch, domid, reason);
+	int ret;
+
+	ret = xc_domain_shutdown(_H(xch), _D(domid), Int_val(reason));
+	if (ret < 0)
+		failwith_xc(_H(xch));
+
+	CAMLreturn(Val_unit);
+}
+
+static value alloc_domaininfo(xc_domaininfo_t * info)
+{
+	CAMLparam0();
+	CAMLlocal2(result, tmp);
+	int i;
+
+	result = caml_alloc_tuple(16);
+
+	Store_field(result,  0, Val_int(info->domain));
+	Store_field(result,  1, Val_bool(info->flags & XEN_DOMINF_dying));
+	Store_field(result,  2, Val_bool(info->flags & XEN_DOMINF_shutdown));
+	Store_field(result,  3, Val_bool(info->flags & XEN_DOMINF_paused));
+	Store_field(result,  4, Val_bool(info->flags & XEN_DOMINF_blocked));
+	Store_field(result,  5, Val_bool(info->flags & XEN_DOMINF_running));
+	Store_field(result,  6, Val_bool(info->flags & XEN_DOMINF_hvm_guest));
+	Store_field(result,  7, Val_int((info->flags >> XEN_DOMINF_shutdownshift)
+	                                 & XEN_DOMINF_shutdownmask));
+	Store_field(result,  8, caml_copy_nativeint(info->tot_pages));
+	Store_field(result,  9, caml_copy_nativeint(info->max_pages));
+	Store_field(result, 10, caml_copy_int64(info->shared_info_frame));
+	Store_field(result, 11, caml_copy_int64(info->cpu_time));
+	Store_field(result, 12, Val_int(info->nr_online_vcpus));
+	Store_field(result, 13, Val_int(info->max_vcpu_id));
+	Store_field(result, 14, caml_copy_int32(info->ssidref));
+
+        tmp = caml_alloc_small(16, 0);
+	for (i = 0; i < 16; i++) {
+		Field(tmp, i) = Val_int(info->handle[i]);
+	}
+
+	Store_field(result, 15, tmp);
+
+	CAMLreturn(result);
+}
+
+CAMLprim value stub_xc_domain_getinfolist(value xch, value first_domain, value nb)
+{
+	CAMLparam3(xch, first_domain, nb);
+	CAMLlocal2(result, temp);
+	xc_domaininfo_t * info;
+	int i, ret, toalloc, retval;
+	unsigned int c_max_domains;
+	uint32_t c_first_domain;
+
+	/* get the minimum number of allocate byte we need and bump it up to page boundary */
+	toalloc = (sizeof(xc_domaininfo_t) * Int_val(nb)) | 0xfff;
+	ret = posix_memalign((void **) ((void *) &info), 4096, toalloc);
+	if (ret)
+		caml_raise_out_of_memory();
+
+	result = temp = Val_emptylist;
+
+	c_first_domain = _D(first_domain);
+	c_max_domains = Int_val(nb);
+	// caml_enter_blocking_section();
+	retval = xc_domain_getinfolist(_H(xch), c_first_domain,
+				       c_max_domains, info);
+	// caml_leave_blocking_section();
+
+	if (retval < 0) {
+		free(info);
+		failwith_xc(_H(xch));
+	}
+	for (i = 0; i < retval; i++) {
+		result = caml_alloc_small(2, Tag_cons);
+		Field(result, 0) = Val_int(0);
+		Field(result, 1) = temp;
+		temp = result;
+
+		Store_field(result, 0, alloc_domaininfo(info + i));
+	}
+
+	free(info);
+	CAMLreturn(result);
+}
+
+CAMLprim value stub_xc_domain_getinfo(value xch, value domid)
+{
+	CAMLparam2(xch, domid);
+	CAMLlocal1(result);
+	xc_domaininfo_t info;
+	int ret;
+
+	ret = xc_domain_getinfolist(_H(xch), _D(domid), 1, &info);
+	if (ret != 1)
+		failwith_xc(_H(xch));
+	if (info.domain != _D(domid))
+		failwith_xc(_H(xch));
+
+	result = alloc_domaininfo(&info);
+	CAMLreturn(result);
+}
+
+CAMLprim value stub_xc_vcpu_getinfo(value xch, value domid, value vcpu)
+{
+	CAMLparam3(xch, domid, vcpu);
+	CAMLlocal1(result);
+	xc_vcpuinfo_t info;
+	int retval;
+
+	uint32_t c_domid = _D(domid);
+	uint32_t c_vcpu = Int_val(vcpu);
+	// caml_enter_blocking_section();
+	retval = xc_vcpu_getinfo(_H(xch), c_domid,
+	                         c_vcpu, &info);
+	// caml_leave_blocking_section();
+	if (retval < 0)
+		failwith_xc(_H(xch));
+
+	result = caml_alloc_tuple(5);
+	Store_field(result, 0, Val_bool(info.online));
+	Store_field(result, 1, Val_bool(info.blocked));
+	Store_field(result, 2, Val_bool(info.running));
+	Store_field(result, 3, caml_copy_int64(info.cpu_time));
+	Store_field(result, 4, caml_copy_int32(info.cpu));
+
+	CAMLreturn(result);
+}
+
+CAMLprim value stub_xc_vcpu_context_get(value xch, value domid,
+                                        value cpu)
+{
+	CAMLparam3(xch, domid, cpu);
+	CAMLlocal1(context);
+	int ret;
+	vcpu_guest_context_any_t ctxt;
+
+	ret = xc_vcpu_getcontext(_H(xch), _D(domid), Int_val(cpu), &ctxt);
+
+	context = caml_alloc_string(sizeof(ctxt));
+	memcpy(String_val(context), (char *) &ctxt.c, sizeof(ctxt.c));
+
+	CAMLreturn(context);
+}
+
+static int get_cpumap_len(value xch, value cpumap)
+{
+	int ml_len = Wosize_val(cpumap);
+	int xc_len = xc_get_max_cpus(_H(xch));
+
+	if (ml_len < xc_len)
+		return ml_len;
+	else
+		return xc_len;
+}
+
+CAMLprim value stub_xc_vcpu_setaffinity(value xch, value domid,
+                                        value vcpu, value cpumap)
+{
+	CAMLparam4(xch, domid, vcpu, cpumap);
+	int i, len = get_cpumap_len(xch, cpumap);
+	xc_cpumap_t c_cpumap;
+	int retval;
+
+	c_cpumap = xc_cpumap_alloc(_H(xch));
+	if (c_cpumap == NULL)
+		failwith_xc(_H(xch));
+
+	for (i=0; i<len; i++) {
+		if (Bool_val(Field(cpumap, i)))
+			c_cpumap[i/8] |= i << (i&7);
+	}
+	retval = xc_vcpu_setaffinity(_H(xch), _D(domid),
+	                             Int_val(vcpu), c_cpumap);
+	free(c_cpumap);
+
+	if (retval < 0)
+		failwith_xc(_H(xch));
+	CAMLreturn(Val_unit);
+}
+
+CAMLprim value stub_xc_vcpu_getaffinity(value xch, value domid,
+                                        value vcpu)
+{
+	CAMLparam3(xch, domid, vcpu);
+	CAMLlocal1(ret);
+	xc_cpumap_t c_cpumap;
+	int i, len = xc_get_max_cpus(_H(xch));
+	int retval;
+
+	c_cpumap = xc_cpumap_alloc(_H(xch));
+	if (c_cpumap == NULL)
+		failwith_xc(_H(xch));
+
+	retval = xc_vcpu_getaffinity(_H(xch), _D(domid),
+	                             Int_val(vcpu), c_cpumap);
+	free(c_cpumap);
+
+	if (retval < 0) {
+		free(c_cpumap);
+		failwith_xc(_H(xch));
+	}
+
+	ret = caml_alloc(len, 0);
+
+	for (i=0; i<len; i++) {
+		if (c_cpumap[i%8] & 1 << (i&7))
+			Store_field(ret, i, Val_true);
+		else
+			Store_field(ret, i, Val_false);
+	}
+
+	free(c_cpumap);
+
+	CAMLreturn(ret);
+}
+
+CAMLprim value stub_xc_sched_id(value xch)
+{
+	CAMLparam1(xch);
+	int sched_id;
+
+	if (xc_sched_id(_H(xch), &sched_id))
+		failwith_xc(_H(xch));
+	CAMLreturn(Val_int(sched_id));
+}
+
+CAMLprim value stub_xc_evtchn_alloc_unbound(value xch,
+                                            value local_domid,
+                                            value remote_domid)
+{
+	CAMLparam3(xch, local_domid, remote_domid);
+
+	uint32_t c_local_domid = _D(local_domid);
+	uint32_t c_remote_domid = _D(remote_domid);
+
+	// caml_enter_blocking_section();
+	int result = xc_evtchn_alloc_unbound(_H(xch), c_local_domid,
+	                                     c_remote_domid);
+	// caml_leave_blocking_section();
+
+	if (result < 0)
+		failwith_xc(_H(xch));
+	CAMLreturn(Val_int(result));
+}
+
+CAMLprim value stub_xc_evtchn_reset(value xch, value domid)
+{
+	CAMLparam2(xch, domid);
+	int r;
+
+	r = xc_evtchn_reset(_H(xch), _D(domid));
+	if (r < 0)
+		failwith_xc(_H(xch));
+	CAMLreturn(Val_unit);
+}
+
+
+#define RING_SIZE 32768
+static char ring[RING_SIZE];
+
+CAMLprim value stub_xc_readconsolering(value xch)
+{
+	unsigned int size = RING_SIZE;
+	char *ring_ptr = ring;
+
+	CAMLparam1(xch);
+
+	// caml_enter_blocking_section();
+	int retval = xc_readconsolering(_H(xch), ring_ptr, &size, 0, 0, NULL);
+	// caml_leave_blocking_section();
+
+	if (retval)
+		failwith_xc(_H(xch));
+	ring[size] = '\0';
+	CAMLreturn(caml_copy_string(ring));
+}
+
+CAMLprim value stub_xc_send_debug_keys(value xch, value keys)
+{
+	CAMLparam2(xch, keys);
+	int r;
+
+	r = xc_send_debug_keys(_H(xch), String_val(keys));
+	if (r)
+		failwith_xc(_H(xch));
+	CAMLreturn(Val_unit);
+}
+
+CAMLprim value stub_xc_physinfo(value xch)
+{
+	CAMLparam1(xch);
+	CAMLlocal3(physinfo, cap_list, tmp);
+	xc_physinfo_t c_physinfo;
+	int r;
+
+	// caml_enter_blocking_section();
+	r = xc_physinfo(_H(xch), &c_physinfo);
+	// caml_leave_blocking_section();
+
+	if (r)
+		failwith_xc(_H(xch));
+
+	tmp = cap_list = Val_emptylist;
+	for (r = 0; r < 2; r++) {
+		if ((c_physinfo.capabilities >> r) & 1) {
+			tmp = caml_alloc_small(2, Tag_cons);
+			Field(tmp, 0) = Val_int(r);
+			Field(tmp, 1) = cap_list;
+			cap_list = tmp;
+		}
+	}
+
+	physinfo = caml_alloc_tuple(9);
+	Store_field(physinfo, 0, Val_int(c_physinfo.threads_per_core));
+	Store_field(physinfo, 1, Val_int(c_physinfo.cores_per_socket));
+	Store_field(physinfo, 2, Val_int(c_physinfo.nr_cpus));
+	Store_field(physinfo, 3, Val_int(c_physinfo.max_node_id));
+	Store_field(physinfo, 4, Val_int(c_physinfo.cpu_khz));
+	Store_field(physinfo, 5, caml_copy_nativeint(c_physinfo.total_pages));
+	Store_field(physinfo, 6, caml_copy_nativeint(c_physinfo.free_pages));
+	Store_field(physinfo, 7, caml_copy_nativeint(c_physinfo.scrub_pages));
+	Store_field(physinfo, 8, cap_list);
+
+	CAMLreturn(physinfo);
+}
+
+CAMLprim value stub_xc_pcpu_info(value xch, value nr_cpus)
+{
+	CAMLparam2(xch, nr_cpus);
+	CAMLlocal2(pcpus, v);
+	xc_cpuinfo_t *info;
+	int r, size;
+
+	if (Int_val(nr_cpus) < 1)
+		caml_invalid_argument("nr_cpus");
+	
+	info = calloc(Int_val(nr_cpus) + 1, sizeof(*info));
+	if (!info)
+		caml_raise_out_of_memory();
+
+	// caml_enter_blocking_section();
+	r = xc_getcpuinfo(_H(xch), Int_val(nr_cpus), info, &size);
+	// caml_leave_blocking_section();
+
+	if (r) {
+		free(info);
+		failwith_xc(_H(xch));
+	}
+
+	if (size > 0) {
+		int i;
+		pcpus = caml_alloc(size, 0);
+		for (i = 0; i < size; i++) {
+			v = caml_copy_int64(info[i].idletime);
+			caml_modify(&Field(pcpus, i), v);
+		}
+	} else
+		pcpus = Atom(0);
+	free(info);
+	CAMLreturn(pcpus);
+}
+
+CAMLprim value stub_xc_domain_setmaxmem(value xch, value domid,
+                                        value max_memkb)
+{
+	CAMLparam3(xch, domid, max_memkb);
+
+	uint32_t c_domid = _D(domid);
+	unsigned int c_max_memkb = Int64_val(max_memkb);
+	// caml_enter_blocking_section();
+	int retval = xc_domain_setmaxmem(_H(xch), c_domid,
+	                                 c_max_memkb);
+	// caml_leave_blocking_section();
+	if (retval)
+		failwith_xc(_H(xch));
+	CAMLreturn(Val_unit);
+}
+
+CAMLprim value stub_xc_domain_set_memmap_limit(value xch, value domid,
+                                               value map_limitkb)
+{
+	CAMLparam3(xch, domid, map_limitkb);
+	unsigned long v;
+	int retval;
+
+	v = Int64_val(map_limitkb);
+	retval = xc_domain_set_memmap_limit(_H(xch), _D(domid), v);
+	if (retval)
+		failwith_xc(_H(xch));
+
+	CAMLreturn(Val_unit);
+}
+
+CAMLprim value stub_xc_domain_memory_increase_reservation(value xch,
+                                                          value domid,
+                                                          value mem_kb)
+{
+	CAMLparam3(xch, domid, mem_kb);
+
+	unsigned long nr_extents = ((unsigned long)(Int64_val(mem_kb))) >> (PAGE_SHIFT - 10);
+
+	uint32_t c_domid = _D(domid);
+	// caml_enter_blocking_section();
+	int retval = xc_domain_increase_reservation_exact(_H(xch), c_domid,
+							  nr_extents, 0, 0, NULL);
+	// caml_leave_blocking_section();
+
+	if (retval)
+		failwith_xc(_H(xch));
+	CAMLreturn(Val_unit);
+}
+
+CAMLprim value stub_xc_domain_set_machine_address_size(value xch,
+						       value domid,
+						       value width)
+{
+	CAMLparam3(xch, domid, width);
+	uint32_t c_domid = _D(domid);
+	int c_width = Int_val(width);
+
+	int retval = xc_domain_set_machine_address_size(_H(xch), c_domid, c_width);
+	if (retval)
+		failwith_xc(_H(xch));
+	CAMLreturn(Val_unit);
+}
+
+CAMLprim value stub_xc_domain_get_machine_address_size(value xch,
+                                                       value domid)
+{
+	CAMLparam2(xch, domid);
+	int retval;
+
+	retval = xc_domain_get_machine_address_size(_H(xch), _D(domid));
+	if (retval < 0)
+		failwith_xc(_H(xch));
+	CAMLreturn(Val_int(retval));
+}
+
+CAMLprim value stub_xc_domain_cpuid_set(value xch, value domid,
+                                        value input,
+                                        value config)
+{
+	CAMLparam4(xch, domid, input, config);
+	CAMLlocal2(array, tmp);
+	int r;
+	unsigned int c_input[2];
+	char *c_config[4], *out_config[4];
+
+	c_config[0] = string_of_option_array(config, 0);
+	c_config[1] = string_of_option_array(config, 1);
+	c_config[2] = string_of_option_array(config, 2);
+	c_config[3] = string_of_option_array(config, 3);
+
+	cpuid_input_of_val(c_input[0], c_input[1], input);
+
+	array = caml_alloc(4, 0);
+	for (r = 0; r < 4; r++) {
+		tmp = Val_none;
+		if (c_config[r]) {
+			tmp = caml_alloc_small(1, 0);
+			Field(tmp, 0) = caml_alloc_string(32);
+		}
+		Store_field(array, r, tmp);
+	}
+
+	for (r = 0; r < 4; r++)
+		out_config[r] = (c_config[r]) ? String_val(Field(Field(array, r), 0)) : NULL;
+
+	r = xc_cpuid_set(_H(xch), _D(domid),
+			 c_input, (const char **)c_config, out_config);
+	if (r < 0)
+		failwith_xc(_H(xch));
+	CAMLreturn(array);
+}
+
+CAMLprim value stub_xc_domain_cpuid_apply_policy(value xch, value domid)
+{
+	CAMLparam2(xch, domid);
+	int r;
+
+	r = xc_cpuid_apply_policy(_H(xch), _D(domid));
+	if (r < 0)
+		failwith_xc(_H(xch));
+	CAMLreturn(Val_unit);
+}
+
+CAMLprim value stub_xc_cpuid_check(value xch, value input, value config)
+{
+	CAMLparam3(xch, input, config);
+	CAMLlocal3(ret, array, tmp);
+	int r;
+	unsigned int c_input[2];
+	char *c_config[4], *out_config[4];
+
+	c_config[0] = string_of_option_array(config, 0);
+	c_config[1] = string_of_option_array(config, 1);
+	c_config[2] = string_of_option_array(config, 2);
+	c_config[3] = string_of_option_array(config, 3);
+
+	cpuid_input_of_val(c_input[0], c_input[1], input);
+
+	array = caml_alloc(4, 0);
+	for (r = 0; r < 4; r++) {
+		tmp = Val_none;
+		if (c_config[r]) {
+			tmp = caml_alloc_small(1, 0);
+			Field(tmp, 0) = caml_alloc_string(32);
+		}
+		Store_field(array, r, tmp);
+	}
+
+	for (r = 0; r < 4; r++)
+		out_config[r] = (c_config[r]) ? String_val(Field(Field(array, r), 0)) : NULL;
+
+	r = xc_cpuid_check(_H(xch), c_input, (const char **)c_config, out_config);
+	if (r < 0)
+		failwith_xc(_H(xch));
+
+	ret = caml_alloc_tuple(2);
+	Store_field(ret, 0, Val_bool(r));
+	Store_field(ret, 1, array);
+
+	CAMLreturn(ret);
+}
+
+CAMLprim value stub_xc_version_version(value xch)
+{
+	CAMLparam1(xch);
+	CAMLlocal1(result);
+	xen_extraversion_t extra;
+	long packed;
+	int retval;
+
+	// caml_enter_blocking_section();
+	packed = xc_version(_H(xch), XENVER_version, NULL);
+	retval = xc_version(_H(xch), XENVER_extraversion, &extra);
+	// caml_leave_blocking_section();
+
+	if (retval)
+		failwith_xc(_H(xch));
+
+	result = caml_alloc_tuple(3);
+
+	Store_field(result, 0, Val_int(packed >> 16));
+	Store_field(result, 1, Val_int(packed & 0xffff));
+	Store_field(result, 2, caml_copy_string(extra));
+
+	CAMLreturn(result);
+}
+
+
+CAMLprim value stub_xc_version_compile_info(value xch)
+{
+	CAMLparam1(xch);
+	CAMLlocal1(result);
+	xen_compile_info_t ci;
+	int retval;
+
+	// caml_enter_blocking_section();
+	retval = xc_version(_H(xch), XENVER_compile_info, &ci);
+	// caml_leave_blocking_section();
+
+	if (retval)
+		failwith_xc(_H(xch));
+
+	result = caml_alloc_tuple(4);
+
+	Store_field(result, 0, caml_copy_string(ci.compiler));
+	Store_field(result, 1, caml_copy_string(ci.compile_by));
+	Store_field(result, 2, caml_copy_string(ci.compile_domain));
+	Store_field(result, 3, caml_copy_string(ci.compile_date));
+
+	CAMLreturn(result);
+}
+
+
+static value xc_version_single_string(value xch, int code, void *info)
+{
+	CAMLparam1(xch);
+	int retval;
+
+	// caml_enter_blocking_section();
+	retval = xc_version(_H(xch), code, info);
+	// caml_leave_blocking_section();
+
+	if (retval)
+		failwith_xc(_H(xch));
+
+	CAMLreturn(caml_copy_string((char *)info));
+}
+
+
+CAMLprim value stub_xc_version_changeset(value xch)
+{
+	xen_changeset_info_t ci;
+
+	return xc_version_single_string(xch, XENVER_changeset, &ci);
+}
+
+
+CAMLprim value stub_xc_version_capabilities(value xch)
+{
+	xen_capabilities_info_t ci;
+
+	return xc_version_single_string(xch, XENVER_capabilities, &ci);
+}
+
+
+CAMLprim value stub_pages_to_kib(value pages)
+{
+	CAMLparam1(pages);
+
+	CAMLreturn(caml_copy_int64(Int64_val(pages) << (PAGE_SHIFT - 10)));
+}
+
+
+CAMLprim value stub_map_foreign_range(value xch, value dom,
+                                      value size, value mfn)
+{
+	CAMLparam4(xch, dom, size, mfn);
+	CAMLlocal1(result);
+	struct mmap_interface *intf;
+	uint32_t c_dom;
+	unsigned long c_mfn;
+
+	result = caml_alloc(sizeof(struct mmap_interface), Abstract_tag);
+	intf = (struct mmap_interface *) result;
+
+	intf->len = Int_val(size);
+
+	c_dom = _D(dom);
+	c_mfn = Nativeint_val(mfn);
+	// caml_enter_blocking_section();
+	intf->addr = xc_map_foreign_range(_H(xch), c_dom,
+	                                  intf->len, PROT_READ|PROT_WRITE,
+	                                  c_mfn);
+	// caml_leave_blocking_section();
+	if (!intf->addr)
+		caml_failwith("xc_map_foreign_range error");
+	CAMLreturn(result);
+}
+
+CAMLprim value stub_sched_credit_domain_get(value xch, value domid)
+{
+	CAMLparam2(xch, domid);
+	CAMLlocal1(sdom);
+	struct xen_domctl_sched_credit c_sdom;
+	int ret;
+
+	// caml_enter_blocking_section();
+	ret = xc_sched_credit_domain_get(_H(xch), _D(domid), &c_sdom);
+	// caml_leave_blocking_section();
+	if (ret != 0)
+		failwith_xc(_H(xch));
+
+	sdom = caml_alloc_tuple(2);
+	Store_field(sdom, 0, Val_int(c_sdom.weight));
+	Store_field(sdom, 1, Val_int(c_sdom.cap));
+
+	CAMLreturn(sdom);
+}
+
+CAMLprim value stub_sched_credit_domain_set(value xch, value domid,
+                                            value sdom)
+{
+	CAMLparam3(xch, domid, sdom);
+	struct xen_domctl_sched_credit c_sdom;
+	int ret;
+
+	c_sdom.weight = Int_val(Field(sdom, 0));
+	c_sdom.cap = Int_val(Field(sdom, 1));
+	// caml_enter_blocking_section();
+	ret = xc_sched_credit_domain_set(_H(xch), _D(domid), &c_sdom);
+	// caml_leave_blocking_section();
+	if (ret != 0)
+		failwith_xc(_H(xch));
+
+	CAMLreturn(Val_unit);
+}
+
+CAMLprim value stub_shadow_allocation_get(value xch, value domid)
+{
+	CAMLparam2(xch, domid);
+	CAMLlocal1(mb);
+	unsigned long c_mb;
+	int ret;
+
+	// caml_enter_blocking_section();
+	ret = xc_shadow_control(_H(xch), _D(domid),
+				XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION,
+				NULL, 0, &c_mb, 0, NULL);
+	// caml_leave_blocking_section();
+	if (ret != 0)
+		failwith_xc(_H(xch));
+
+	mb = Val_int(c_mb);
+	CAMLreturn(mb);
+}
+
+CAMLprim value stub_shadow_allocation_set(value xch, value domid,
+					  value mb)
+{
+	CAMLparam3(xch, domid, mb);
+	unsigned long c_mb;
+	int ret;
+
+	c_mb = Int_val(mb);
+	// caml_enter_blocking_section();
+	ret = xc_shadow_control(_H(xch), _D(domid),
+				XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION,
+				NULL, 0, &c_mb, 0, NULL);
+	// caml_leave_blocking_section();
+	if (ret != 0)
+		failwith_xc(_H(xch));
+
+	CAMLreturn(Val_unit);
+}
+
+CAMLprim value stub_xc_domain_get_pfn_list(value xch, value domid,
+                                           value nr_pfns)
+{
+	CAMLparam3(xch, domid, nr_pfns);
+	CAMLlocal2(array, v);
+	unsigned long c_nr_pfns;
+	long ret, i;
+	uint64_t *c_array;
+
+	c_nr_pfns = Nativeint_val(nr_pfns);
+
+	c_array = malloc(sizeof(uint64_t) * c_nr_pfns);
+	if (!c_array)
+		caml_raise_out_of_memory();
+
+	ret = xc_get_pfn_list(_H(xch), _D(domid),
+			      c_array, c_nr_pfns);
+	if (ret < 0) {
+		free(c_array);
+		failwith_xc(_H(xch));
+	}
+
+	array = caml_alloc(ret, 0);
+	for (i = 0; i < ret; i++) {
+		v = caml_copy_nativeint(c_array[i]);
+		Store_field(array, i, v);
+	}
+	free(c_array);
+
+	CAMLreturn(array);
+}
+
+CAMLprim value stub_xc_domain_ioport_permission(value xch, value domid,
+					       value start_port, value nr_ports,
+					       value allow)
+{
+	CAMLparam5(xch, domid, start_port, nr_ports, allow);
+	uint32_t c_start_port, c_nr_ports;
+	uint8_t c_allow;
+	int ret;
+
+	c_start_port = Int_val(start_port);
+	c_nr_ports = Int_val(nr_ports);
+	c_allow = Bool_val(allow);
+
+	ret = xc_domain_ioport_permission(_H(xch), _D(domid),
+					 c_start_port, c_nr_ports, c_allow);
+	if (ret < 0)
+		failwith_xc(_H(xch));
+
+	CAMLreturn(Val_unit);
+}
+
+CAMLprim value stub_xc_domain_iomem_permission(value xch, value domid,
+					       value start_pfn, value nr_pfns,
+					       value allow)
+{
+	CAMLparam5(xch, domid, start_pfn, nr_pfns, allow);
+	unsigned long c_start_pfn, c_nr_pfns;
+	uint8_t c_allow;
+	int ret;
+
+	c_start_pfn = Nativeint_val(start_pfn);
+	c_nr_pfns = Nativeint_val(nr_pfns);
+	c_allow = Bool_val(allow);
+
+	ret = xc_domain_iomem_permission(_H(xch), _D(domid),
+					 c_start_pfn, c_nr_pfns, c_allow);
+	if (ret < 0)
+		failwith_xc(_H(xch));
+
+	CAMLreturn(Val_unit);
+}
+
+CAMLprim value stub_xc_domain_irq_permission(value xch, value domid,
+					     value pirq, value allow)
+{
+	CAMLparam4(xch, domid, pirq, allow);
+	uint8_t c_pirq;
+	uint8_t c_allow;
+	int ret;
+
+	c_pirq = Int_val(pirq);
+	c_allow = Bool_val(allow);
+
+	ret = xc_domain_irq_permission(_H(xch), _D(domid),
+				       c_pirq, c_allow);
+	if (ret < 0)
+		failwith_xc(_H(xch));
+
+	CAMLreturn(Val_unit);
+}
+
+static uint32_t pci_dev_to_bdf(int domain, int bus, int slot, int func)
+{
+	uint32_t bdf = 0;
+	bdf |= (bus & 0xff) << 16;
+	bdf |= (slot & 0x1f) << 11;
+	bdf |= (func & 0x7) << 8;
+	return bdf;
+}
+
+CAMLprim value stub_xc_domain_test_assign_device(value xch, value domid, value desc)
+{
+	CAMLparam3(xch, domid, desc);
+	int ret;
+	int domain, bus, slot, func;
+	uint32_t bdf;
+
+	domain = Int_val(Field(desc, 0));
+	bus = Int_val(Field(desc, 1));
+	slot = Int_val(Field(desc, 2));
+	func = Int_val(Field(desc, 3));
+	bdf = pci_dev_to_bdf(domain, bus, slot, func);
+
+	ret = xc_test_assign_device(_H(xch), _D(domid), bdf);
+
+	CAMLreturn(Val_bool(ret == 0));
+}
+
+CAMLprim value stub_xc_domain_assign_device(value xch, value domid, value desc)
+{
+	CAMLparam3(xch, domid, desc);
+	int ret;
+	int domain, bus, slot, func;
+	uint32_t bdf;
+
+	domain = Int_val(Field(desc, 0));
+	bus = Int_val(Field(desc, 1));
+	slot = Int_val(Field(desc, 2));
+	func = Int_val(Field(desc, 3));
+	bdf = pci_dev_to_bdf(domain, bus, slot, func);
+
+	ret = xc_assign_device(_H(xch), _D(domid), bdf);
+
+	if (ret < 0)
+		failwith_xc(_H(xch));
+	CAMLreturn(Val_unit);
+}
+
+CAMLprim value stub_xc_domain_deassign_device(value xch, value domid, value desc)
+{
+	CAMLparam3(xch, domid, desc);
+	int ret;
+	int domain, bus, slot, func;
+	uint32_t bdf;
+
+	domain = Int_val(Field(desc, 0));
+	bus = Int_val(Field(desc, 1));
+	slot = Int_val(Field(desc, 2));
+	func = Int_val(Field(desc, 3));
+	bdf = pci_dev_to_bdf(domain, bus, slot, func);
+
+	ret = xc_deassign_device(_H(xch), _D(domid), bdf);
+
+	if (ret < 0)
+		failwith_xc(_H(xch));
+	CAMLreturn(Val_unit);
+}
+
+CAMLprim value stub_xc_watchdog(value xch, value domid, value timeout)
+{
+	CAMLparam3(xch, domid, timeout);
+	int ret;
+	unsigned int c_timeout = Int32_val(timeout);
+
+	ret = xc_watchdog(_H(xch), _D(domid), c_timeout);
+	if (ret < 0)
+		failwith_xc(_H(xch));
+
+	CAMLreturn(Val_int(ret));
+}
+
+/*
+ * Local variables:
+ *  indent-tabs-mode: t
+ *  c-basic-offset: 8
+ *  tab-width: 8
+ * End:
+ */
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xl/Makefile
--- a/tools/ocaml/libs/xl/Makefile	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/libs/xl/Makefile	Mon Oct 10 16:37:07 2011 +0100
@@ -6,44 +6,44 @@
 CFLAGS += -Wno-unused
 CFLAGS += $(CFLAGS_libxenlight)
 
-OBJS = xl
-INTF = xl.cmi
-LIBS = xl.cma xl.cmxa
+OBJS = xenlight
+INTF = xenlight.cmi
+LIBS = xenlight.cma xenlight.cmxa
 
-LIBS_xl = $(LDLIBS_libxenlight)
+LIBS_xenlight = $(LDLIBS_libxenlight)
 
-xl_OBJS = $(OBJS)
-xl_C_OBJS = xl_stubs
+xenlight_OBJS = $(OBJS)
+xenlight_C_OBJS = xenlight_stubs
 
-OCAML_LIBRARY = xl
+OCAML_LIBRARY = xenlight
 
-GENERATED_FILES += xl.ml xl.ml.tmp xl.mli xl.mli.tmp
+GENERATED_FILES += xenlight.ml xenlight.ml.tmp xenlight.mli xenlight.mli.tmp
 GENERATED_FILES += _libxl_types.ml.in _libxl_types.mli.in
 GENERATED_FILES += _libxl_types.inc
 
 all: $(INTF) $(LIBS)
 
-xl.ml: xl.ml.in _libxl_types.ml.in
+xenlight.ml: xenlight.ml.in _libxl_types.ml.in
 	$(Q)sed -e '1i\
 (*\
  * AUTO-GENERATED FILE DO NOT EDIT\
- * Generated from xl.ml.in and _libxl_types.ml.in\
+ * Generated from xenlight.ml.in and _libxl_types.ml.in\
  *)\
 ' \
 	    -e '/^(\* @@LIBXL_TYPES@@ \*)$$/r_libxl_types.ml.in' \
-	  < xl.ml.in > xl.ml.tmp
-	$(Q)mv xl.ml.tmp xl.ml
+	  < xenlight.ml.in > xenlight.ml.tmp
+	$(Q)mv xenlight.ml.tmp xenlight.ml
 
-xl.mli: xl.mli.in _libxl_types.mli.in
+xenlight.mli: xenlight.mli.in _libxl_types.mli.in
 	$(Q)sed -e '1i\
 (*\
  * AUTO-GENERATED FILE DO NOT EDIT\
- * Generated from xl.mli.in and _libxl_types.mli.in\
+ * Generated from xenlight.mli.in and _libxl_types.mli.in\
  *)\
 ' \
 	    -e '/^(\* @@LIBXL_TYPES@@ \*)$$/r_libxl_types.mli.in' \
-	  < xl.mli.in > xl.mli.tmp
-	$(Q)mv xl.mli.tmp xl.mli
+	  < xenlight.mli.in > xenlight.mli.tmp
+	$(Q)mv xenlight.mli.tmp xenlight.mli
 
 _libxl_types.ml.in _libxl_types.mli.in _libxl_types.inc: genwrap.py $(XEN_ROOT)/tools/libxl/libxl_types.idl \
                 $(XEN_ROOT)/tools/libxl/libxltypes.py
@@ -56,11 +56,11 @@
 .PHONY: install
 install: $(LIBS) META
 	mkdir -p $(OCAMLDESTDIR)
-	ocamlfind remove -destdir $(OCAMLDESTDIR) xl
-	ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xl META $(INTF) $(LIBS) *.a *.so *.cmx
+	ocamlfind remove -destdir $(OCAMLDESTDIR) xenlight
+	ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xenlight META $(INTF) $(LIBS) *.a *.so *.cmx
 
 .PHONY: uninstall
 uninstall:
-	ocamlfind remove -destdir $(OCAMLDESTDIR) xl
+	ocamlfind remove -destdir $(OCAMLDESTDIR) xenlight
 
 include $(TOPLEVEL)/Makefile.rules
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xl/xenlight.ml.in
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/ocaml/libs/xl/xenlight.ml.in	Mon Oct 10 16:37:07 2011 +0100
@@ -0,0 +1,39 @@
+(*
+ * Copyright (C) 2009-2011 Citrix Ltd.
+ * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *)
+
+exception Error of string
+
+type domid = int
+
+(* @@LIBXL_TYPES@@ *)
+
+module Topologyinfo = struct
+	type t =
+	{
+		core : int;
+		socket : int;
+		node : int;
+	}
+	external get : unit -> t = "stub_xl_topologyinfo"
+end
+
+external button_press : domid -> button -> unit = "stub_xl_button_press"
+
+
+external send_trigger : domid -> string -> int -> unit = "stub_xl_send_trigger"
+external send_sysrq : domid -> char -> unit = "stub_xl_send_sysrq"
+external send_debug_keys : domid -> string -> unit = "stub_xl_send_debug_keys"
+
+let _ = Callback.register_exception "xl.error" (Error "register_callback")
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xl/xenlight.mli.in
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/ocaml/libs/xl/xenlight.mli.in	Mon Oct 10 16:37:07 2011 +0100
@@ -0,0 +1,36 @@
+(*
+ * Copyright (C) 2009-2011 Citrix Ltd.
+ * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *)
+
+exception Error of string
+
+type domid = int
+
+(* @@LIBXL_TYPES@@ *)
+
+module Topologyinfo : sig
+	type t =
+	{
+		core : int;
+		socket : int;
+		node : int;
+	}
+	external get : unit -> t = "stub_xl_topologyinfo"
+end
+
+external button_press : domid -> button -> unit = "stub_xl_button_press"
+
+external send_trigger : domid -> string -> int -> unit = "stub_xl_send_trigger"
+external send_sysrq : domid -> char -> unit = "stub_xl_send_sysrq"
+external send_debug_keys : domid -> string -> unit = "stub_xl_send_debug_keys"
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xl/xenlight_stubs.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c	Mon Oct 10 16:37:07 2011 +0100
@@ -0,0 +1,596 @@
+/*
+ * Copyright (C) 2009-2011 Citrix Ltd.
+ * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ */
+
+#include <stdlib.h>
+
+#define CAML_NAME_SPACE
+#include <caml/alloc.h>
+#include <caml/memory.h>
+#include <caml/signals.h>
+#include <caml/fail.h>
+#include <caml/callback.h>
+
+#include <sys/mman.h>
+#include <stdint.h>
+#include <string.h>
+
+#include <libxl.h>
+
+struct caml_logger {
+	struct xentoollog_logger logger;
+	int log_offset;
+	char log_buf[2048];
+};
+
+typedef struct caml_gc {
+	int offset;
+	void *ptrs[64];
+} caml_gc;
+
+static void log_vmessage(struct xentoollog_logger *logger, xentoollog_level level,
+                  int errnoval, const char *context, const char *format, va_list al)
+{
+	struct caml_logger *ologger = (struct caml_logger *) logger;
+
+	ologger->log_offset += vsnprintf(ologger->log_buf + ologger->log_offset,
+	                                 2048 - ologger->log_offset, format, al);
+}
+
+static void log_destroy(struct xentoollog_logger *logger)
+{
+}
+
+#define INIT_STRUCT() libxl_ctx *ctx; struct caml_logger lg; struct caml_gc gc; gc.offset = 0;
+
+#define INIT_CTX()  \
+	lg.logger.vmessage = log_vmessage; \
+	lg.logger.destroy = log_destroy; \
+	lg.logger.progress = NULL; \
+	caml_enter_blocking_section(); \
+	ret = libxl_ctx_alloc(&ctx, LIBXL_VERSION, (struct xentoollog_logger *) &lg); \
+	if (ret != 0) \
+		failwith_xl("cannot init context", &lg);
+
+#define FREE_CTX()  \
+	gc_free(&gc); \
+	caml_leave_blocking_section(); \
+	libxl_ctx_free(ctx)
+
+static char * dup_String_val(caml_gc *gc, value s)
+{
+	int len;
+	char *c;
+	len = caml_string_length(s);
+	c = calloc(len + 1, sizeof(char));
+	if (!c)
+		caml_raise_out_of_memory();
+	gc->ptrs[gc->offset++] = c;
+	memcpy(c, String_val(s), len);
+	return c;
+}
+
+static void gc_free(caml_gc *gc)
+{
+	int i;
+	for (i = 0; i < gc->offset; i++) {
+		free(gc->ptrs[i]);
+	}
+}
+
+static void failwith_xl(char *fname, struct caml_logger *lg)
+{
+	char *s;
+	s = (lg) ? lg->log_buf : fname;
+	caml_raise_with_string(*caml_named_value("xl.error"), s);
+}
+
+#if 0 /* TODO: wrap libxl_domain_create(), these functions will be needed then */
+static void * gc_calloc(caml_gc *gc, size_t nmemb, size_t size)
+{
+	void *ptr;
+	ptr = calloc(nmemb, size);
+	if (!ptr)
+		caml_raise_out_of_memory();
+	gc->ptrs[gc->offset++] = ptr;
+	return ptr;
+}
+
+static int string_string_tuple_array_val (caml_gc *gc, char ***c_val, value v)
+{
+	CAMLparam1(v);
+	CAMLlocal1(a);
+	int i;
+	char **array;
+
+	for (i = 0, a = Field(v, 5); a != Val_emptylist; a = Field(a, 1)) { i++; }
+
+	array = gc_calloc(gc, (i + 1) * 2, sizeof(char *));
+	if (!array)
+		return 1;
+	for (i = 0, a = Field(v, 5); a != Val_emptylist; a = Field(a, 1), i++) {
+		value b = Field(a, 0);
+		array[i * 2] = dup_String_val(gc, Field(b, 0));
+		array[i * 2 + 1] = dup_String_val(gc, Field(b, 1));
+	}
+	*c_val = array;
+	CAMLreturn(0);
+}
+
+#endif
+
+static value Val_mac (libxl_mac *c_val)
+{
+	CAMLparam0();
+	CAMLlocal1(v);
+	int i;
+
+	v = caml_alloc_tuple(6);
+
+	for(i=0; i<6; i++)
+		Store_field(v, i, Val_int((*c_val)[i]));
+
+	CAMLreturn(v);
+}
+
+static int Mac_val(caml_gc *gc, struct caml_logger *lg, libxl_mac *c_val, value v)
+{
+	CAMLparam1(v);
+	int i;
+
+	for(i=0; i<6; i++)
+		(*c_val)[i] = Int_val(Field(v, i));
+
+	CAMLreturn(0);
+}
+
+static value Val_uuid (libxl_uuid *c_val)
+{
+	CAMLparam0();
+	CAMLlocal1(v);
+	uint8_t *uuid = libxl_uuid_bytearray(c_val);
+	int i;
+
+	v = caml_alloc_tuple(16);
+
+	for(i=0; i<16; i++)
+		Store_field(v, i, Val_int(uuid[i]));
+
+	CAMLreturn(v);
+}
+
+static int Uuid_val(caml_gc *gc, struct caml_logger *lg, libxl_uuid *c_val, value v)
+{
+	CAMLparam1(v);
+	int i;
+	uint8_t *uuid = libxl_uuid_bytearray(c_val);
+
+	for(i=0; i<16; i++)
+		uuid[i] = Int_val(Field(v, i));
+
+	CAMLreturn(0);
+}
+
+static value Val_hwcap(libxl_hwcap *c_val)
+{
+	CAMLparam0();
+	CAMLlocal1(hwcap);
+	int i;
+
+	hwcap = caml_alloc_tuple(8);
+	for (i = 0; i < 8; i++)
+		Store_field(hwcap, i, caml_copy_int32((*c_val)[i]));
+
+	CAMLreturn(hwcap);
+}
+
+#include "_libxl_types.inc"
+
+static value Val_topologyinfo(libxl_topologyinfo *c_val)
+{
+	CAMLparam0();
+	CAMLlocal3(v, topology, topologyinfo);
+	int i;
+
+	topologyinfo = caml_alloc_tuple(c_val->coremap.entries);
+	for (i = 0; i < c_val->coremap.entries; i++) {
+		v = Val_int(0); /* None */
+		if (c_val->coremap.array[i] != LIBXL_CPUARRAY_INVALID_ENTRY) {
+			topology = caml_alloc_tuple(3);
+			Store_field(topology, 0, Val_int(c_val->coremap.array[i]));
+			Store_field(topology, 1, Val_int(c_val->socketmap.array[i]));
+			Store_field(topology, 2, Val_int(c_val->nodemap.array[i]));
+			v = caml_alloc(1, 0); /* Some */
+			Store_field(v, 0, topology);
+		}
+		Store_field(topologyinfo, i, v);
+	}
+
+	CAMLreturn(topologyinfo);
+}
+
+value stub_xl_device_disk_add(value info, value domid)
+{
+	CAMLparam2(info, domid);
+	libxl_device_disk c_info;
+	int ret;
+	INIT_STRUCT();
+
+	device_disk_val(&gc, &lg, &c_info, info);
+
+	INIT_CTX();
+	ret = libxl_device_disk_add(ctx, Int_val(domid), &c_info);
+	if (ret != 0)
+		failwith_xl("disk_add", &lg);
+	FREE_CTX();
+	CAMLreturn(Val_unit);
+}
+
+value stub_xl_device_disk_del(value info, value domid)
+{
+	CAMLparam2(info, domid);
+	libxl_device_disk c_info;
+	int ret;
+	INIT_STRUCT();
+
+	device_disk_val(&gc, &lg, &c_info, info);
+
+	INIT_CTX();
+	ret = libxl_device_disk_del(ctx, Int_val(domid), &c_info, 0);
+	if (ret != 0)
+		failwith_xl("disk_del", &lg);
+	FREE_CTX();
+	CAMLreturn(Val_unit);
+}
+
+value stub_xl_device_nic_add(value info, value domid)
+{
+	CAMLparam2(info, domid);
+	libxl_device_nic c_info;
+	int ret;
+	INIT_STRUCT();
+
+	device_nic_val(&gc, &lg, &c_info, info);
+
+	INIT_CTX();
+	ret = libxl_device_nic_add(ctx, Int_val(domid), &c_info);
+	if (ret != 0)
+		failwith_xl("nic_add", &lg);
+	FREE_CTX();
+	CAMLreturn(Val_unit);
+}
+
+value stub_xl_device_nic_del(value info, value domid)
+{
+	CAMLparam2(info, domid);
+	libxl_device_nic c_info;
+	int ret;
+	INIT_STRUCT();
+
+	device_nic_val(&gc, &lg, &c_info, info);
+
+	INIT_CTX();
+	ret = libxl_device_nic_del(ctx, Int_val(domid), &c_info, 0);
+	if (ret != 0)
+		failwith_xl("nic_del", &lg);
+	FREE_CTX();
+	CAMLreturn(Val_unit);
+}
+
+value stub_xl_device_console_add(value info, value domid)
+{
+	CAMLparam2(info, domid);
+	libxl_device_console c_info;
+	int ret;
+	INIT_STRUCT();
+
+	device_console_val(&gc, &lg, &c_info, info);
+
+	INIT_CTX();
+	ret = libxl_device_console_add(ctx, Int_val(domid), &c_info);
+	if (ret != 0)
+		failwith_xl("console_add", &lg);
+	FREE_CTX();
+	CAMLreturn(Val_unit);
+}
+
+value stub_xl_device_vkb_add(value info, value domid)
+{
+	CAMLparam2(info, domid);
+	libxl_device_vkb c_info;
+	int ret;
+	INIT_STRUCT();
+
+	device_vkb_val(&gc, &lg, &c_info, info);
+
+	INIT_CTX();
+	ret = libxl_device_vkb_add(ctx, Int_val(domid), &c_info);
+	if (ret != 0)
+		failwith_xl("vkb_add", &lg);
+	FREE_CTX();
+
+	CAMLreturn(Val_unit);
+}
+
+value stub_xl_device_vkb_clean_shutdown(value domid)
+{
+	CAMLparam1(domid);
+	int ret;
+	INIT_STRUCT();
+
+	INIT_CTX();
+	ret = libxl_device_vkb_clean_shutdown(ctx, Int_val(domid));
+	if (ret != 0)
+		failwith_xl("vkb_clean_shutdown", &lg);
+	FREE_CTX();
+
+	CAMLreturn(Val_unit);
+}
+
+value stub_xl_device_vkb_hard_shutdown(value domid)
+{
+	CAMLparam1(domid);
+	int ret;
+	INIT_STRUCT();
+
+	INIT_CTX();
+	ret = libxl_device_vkb_hard_shutdown(ctx, Int_val(domid));
+	if (ret != 0)
+		failwith_xl("vkb_hard_shutdown", &lg);
+	FREE_CTX();
+
+	CAMLreturn(Val_unit);
+}
+
+value stub_xl_device_vfb_add(value info, value domid)
+{
+	CAMLparam2(info, domid);
+	libxl_device_vfb c_info;
+	int ret;
+	INIT_STRUCT();
+
+	device_vfb_val(&gc, &lg, &c_info, info);
+
+	INIT_CTX();
+	ret = libxl_device_vfb_add(ctx, Int_val(domid), &c_info);
+	if (ret != 0)
+		failwith_xl("vfb_add", &lg);
+	FREE_CTX();
+
+	CAMLreturn(Val_unit);
+}
+
+value stub_xl_device_vfb_clean_shutdown(value domid)
+{
+	CAMLparam1(domid);
+	int ret;
+	INIT_STRUCT();
+
+	INIT_CTX();
+	ret = libxl_device_vfb_clean_shutdown(ctx, Int_val(domid));
+	if (ret != 0)
+		failwith_xl("vfb_clean_shutdown", &lg);
+	FREE_CTX();
+
+	CAMLreturn(Val_unit);
+}
+
+value stub_xl_device_vfb_hard_shutdown(value domid)
+{
+	CAMLparam1(domid);
+	int ret;
+	INIT_STRUCT();
+
+	INIT_CTX();
+	ret = libxl_device_vfb_hard_shutdown(ctx, Int_val(domid));
+	if (ret != 0)
+		failwith_xl("vfb_hard_shutdown", &lg);
+	FREE_CTX();
+
+	CAMLreturn(Val_unit);
+}
+
+value stub_xl_device_pci_add(value info, value domid)
+{
+	CAMLparam2(info, domid);
+	libxl_device_pci c_info;
+	int ret;
+	INIT_STRUCT();
+
+	device_pci_val(&gc, &lg, &c_info, info);
+
+	INIT_CTX();
+	ret = libxl_device_pci_add(ctx, Int_val(domid), &c_info);
+	if (ret != 0)
+		failwith_xl("pci_add", &lg);
+	FREE_CTX();
+
+	CAMLreturn(Val_unit);
+}
+
+value stub_xl_device_pci_remove(value info, value domid)
+{
+	CAMLparam2(info, domid);
+	libxl_device_pci c_info;
+	int ret;
+	INIT_STRUCT();
+
+	device_pci_val(&gc, &lg, &c_info, info);
+
+	INIT_CTX();
+	ret = libxl_device_pci_remove(ctx, Int_val(domid), &c_info, 0);
+	if (ret != 0)
+		failwith_xl("pci_remove", &lg);
+	FREE_CTX();
+
+	CAMLreturn(Val_unit);
+}
+
+value stub_xl_device_pci_shutdown(value domid)
+{
+	CAMLparam1(domid);
+	int ret;
+	INIT_STRUCT();
+
+	INIT_CTX();
+	ret = libxl_device_pci_shutdown(ctx, Int_val(domid));
+	if (ret != 0)
+		failwith_xl("pci_shutdown", &lg);
+	FREE_CTX();
+
+	CAMLreturn(Val_unit);
+}
+
+value stub_xl_button_press(value domid, value button)
+{
+	CAMLparam2(domid, button);
+	int ret;
+	INIT_STRUCT();
+
+	INIT_CTX();
+	ret = libxl_button_press(ctx, Int_val(domid), Int_val(button) + LIBXL_BUTTON_POWER);
+	if (ret != 0)
+		failwith_xl("button_press", &lg);
+	FREE_CTX();
+
+	CAMLreturn(Val_unit);
+}
+
+value stub_xl_physinfo_get(value unit)
+{
+	CAMLparam1(unit);
+	CAMLlocal1(physinfo);
+	libxl_physinfo c_physinfo;
+	int ret;
+	INIT_STRUCT();
+
+	INIT_CTX();
+	ret = libxl_get_physinfo(ctx, &c_physinfo);
+	if (ret != 0)
+		failwith_xl("physinfo", &lg);
+	FREE_CTX();
+
+	physinfo = Val_physinfo(&gc, &lg, &c_physinfo);
+	CAMLreturn(physinfo);
+}
+
+value stub_xl_topologyinfo(value unit)
+{
+	CAMLparam1(unit);
+	CAMLlocal1(topologyinfo);
+	libxl_topologyinfo c_topologyinfo;
+	int ret;
+	INIT_STRUCT();
+
+	INIT_CTX();
+	ret = libxl_get_topologyinfo(ctx, &c_topologyinfo);
+	if (ret != 0)
+		failwith_xl("topologyinfo", &lg);
+	FREE_CTX();
+
+	topologyinfo = Val_topologyinfo(&c_topologyinfo);
+	CAMLreturn(topologyinfo);
+}
+
+value stub_xl_sched_credit_domain_get(value domid)
+{
+	CAMLparam1(domid);
+	CAMLlocal1(scinfo);
+	libxl_sched_credit c_scinfo;
+	int ret;
+	INIT_STRUCT();
+
+	INIT_CTX();
+	ret = libxl_sched_credit_domain_get(ctx, Int_val(domid), &c_scinfo);
+	if (ret != 0)
+		failwith_xl("sched_credit_domain_get", &lg);
+	FREE_CTX();
+
+	scinfo = Val_sched_credit(&gc, &lg, &c_scinfo);
+	CAMLreturn(scinfo);
+}
+
+value stub_xl_sched_credit_domain_set(value domid, value scinfo)
+{
+	CAMLparam2(domid, scinfo);
+	libxl_sched_credit c_scinfo;
+	int ret;
+	INIT_STRUCT();
+
+	sched_credit_val(&gc, &lg, &c_scinfo, scinfo);
+
+	INIT_CTX();
+	ret = libxl_sched_credit_domain_set(ctx, Int_val(domid), &c_scinfo);
+	if (ret != 0)
+		failwith_xl("sched_credit_domain_set", &lg);
+	FREE_CTX();
+
+	CAMLreturn(Val_unit);
+}
+
+value stub_xl_send_trigger(value domid, value trigger, value vcpuid)
+{
+	CAMLparam3(domid, trigger, vcpuid);
+	int ret;
+	char *c_trigger;
+	INIT_STRUCT();
+
+	c_trigger = dup_String_val(&gc, trigger);
+
+	INIT_CTX();
+	ret = libxl_send_trigger(ctx, Int_val(domid), c_trigger, Int_val(vcpuid));
+	if (ret != 0)
+		failwith_xl("send_trigger", &lg);
+	FREE_CTX();
+	CAMLreturn(Val_unit);
+}
+
+value stub_xl_send_sysrq(value domid, value sysrq)
+{
+	CAMLparam2(domid, sysrq);
+	int ret;
+	INIT_STRUCT();
+
+	INIT_CTX();
+	ret = libxl_send_sysrq(ctx, Int_val(domid), Int_val(sysrq));
+	if (ret != 0)
+		failwith_xl("send_sysrq", &lg);
+	FREE_CTX();
+	CAMLreturn(Val_unit);
+}
+
+value stub_xl_send_debug_keys(value keys)
+{
+	CAMLparam1(keys);
+	int ret;
+	char *c_keys;
+	INIT_STRUCT();
+
+	c_keys = dup_String_val(&gc, keys);
+
+	INIT_CTX();
+	ret = libxl_send_debug_keys(ctx, c_keys);
+	if (ret != 0)
+		failwith_xl("send_debug_keys", &lg);
+	FREE_CTX();
+	CAMLreturn(Val_unit);
+}
+
+/*
+ * Local variables:
+ *  indent-tabs-mode: t
+ *  c-basic-offset: 8
+ *  tab-width: 8
+ * End:
+ */
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xl/xl.ml.in
--- a/tools/ocaml/libs/xl/xl.ml.in	Mon Oct 10 11:21:51 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-(*
- * Copyright (C) 2009-2011 Citrix Ltd.
- * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *)
-
-exception Error of string
-
-type domid = int
-
-(* @@LIBXL_TYPES@@ *)
-
-module Topologyinfo = struct
-	type t =
-	{
-		core : int;
-		socket : int;
-		node : int;
-	}
-	external get : unit -> t = "stub_xl_topologyinfo"
-end
-
-external button_press : domid -> button -> unit = "stub_xl_button_press"
-
-
-external send_trigger : domid -> string -> int -> unit = "stub_xl_send_trigger"
-external send_sysrq : domid -> char -> unit = "stub_xl_send_sysrq"
-external send_debug_keys : domid -> string -> unit = "stub_xl_send_debug_keys"
-
-let _ = Callback.register_exception "xl.error" (Error "register_callback")
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xl/xl.mli.in
--- a/tools/ocaml/libs/xl/xl.mli.in	Mon Oct 10 11:21:51 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-(*
- * Copyright (C) 2009-2011 Citrix Ltd.
- * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *)
-
-exception Error of string
-
-type domid = int
-
-(* @@LIBXL_TYPES@@ *)
-
-module Topologyinfo : sig
-	type t =
-	{
-		core : int;
-		socket : int;
-		node : int;
-	}
-	external get : unit -> t = "stub_xl_topologyinfo"
-end
-
-external button_press : domid -> button -> unit = "stub_xl_button_press"
-
-external send_trigger : domid -> string -> int -> unit = "stub_xl_send_trigger"
-external send_sysrq : domid -> char -> unit = "stub_xl_send_sysrq"
-external send_debug_keys : domid -> string -> unit = "stub_xl_send_debug_keys"
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xl/xl_stubs.c
--- a/tools/ocaml/libs/xl/xl_stubs.c	Mon Oct 10 11:21:51 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,596 +0,0 @@
-/*
- * Copyright (C) 2009-2011 Citrix Ltd.
- * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- */
-
-#include <stdlib.h>
-
-#define CAML_NAME_SPACE
-#include <caml/alloc.h>
-#include <caml/memory.h>
-#include <caml/signals.h>
-#include <caml/fail.h>
-#include <caml/callback.h>
-
-#include <sys/mman.h>
-#include <stdint.h>
-#include <string.h>
-
-#include <libxl.h>
-
-struct caml_logger {
-	struct xentoollog_logger logger;
-	int log_offset;
-	char log_buf[2048];
-};
-
-typedef struct caml_gc {
-	int offset;
-	void *ptrs[64];
-} caml_gc;
-
-static void log_vmessage(struct xentoollog_logger *logger, xentoollog_level level,
-                  int errnoval, const char *context, const char *format, va_list al)
-{
-	struct caml_logger *ologger = (struct caml_logger *) logger;
-
-	ologger->log_offset += vsnprintf(ologger->log_buf + ologger->log_offset,
-	                                 2048 - ologger->log_offset, format, al);
-}
-
-static void log_destroy(struct xentoollog_logger *logger)
-{
-}
-
-#define INIT_STRUCT() libxl_ctx *ctx; struct caml_logger lg; struct caml_gc gc; gc.offset = 0;
-
-#define INIT_CTX()  \
-	lg.logger.vmessage = log_vmessage; \
-	lg.logger.destroy = log_destroy; \
-	lg.logger.progress = NULL; \
-	caml_enter_blocking_section(); \
-	ret = libxl_ctx_alloc(&ctx, LIBXL_VERSION, (struct xentoollog_logger *) &lg); \
-	if (ret != 0) \
-		failwith_xl("cannot init context", &lg);
-
-#define FREE_CTX()  \
-	gc_free(&gc); \
-	caml_leave_blocking_section(); \
-	libxl_ctx_free(ctx)
-
-static char * dup_String_val(caml_gc *gc, value s)
-{
-	int len;
-	char *c;
-	len = caml_string_length(s);
-	c = calloc(len + 1, sizeof(char));
-	if (!c)
-		caml_raise_out_of_memory();
-	gc->ptrs[gc->offset++] = c;
-	memcpy(c, String_val(s), len);
-	return c;
-}
-
-static void gc_free(caml_gc *gc)
-{
-	int i;
-	for (i = 0; i < gc->offset; i++) {
-		free(gc->ptrs[i]);
-	}
-}
-
-static void failwith_xl(char *fname, struct caml_logger *lg)
-{
-	char *s;
-	s = (lg) ? lg->log_buf : fname;
-	caml_raise_with_string(*caml_named_value("xl.error"), s);
-}
-
-#if 0 /* TODO: wrap libxl_domain_create(), these functions will be needed then */
-static void * gc_calloc(caml_gc *gc, size_t nmemb, size_t size)
-{
-	void *ptr;
-	ptr = calloc(nmemb, size);
-	if (!ptr)
-		caml_raise_out_of_memory();
-	gc->ptrs[gc->offset++] = ptr;
-	return ptr;
-}
-
-static int string_string_tuple_array_val (caml_gc *gc, char ***c_val, value v)
-{
-	CAMLparam1(v);
-	CAMLlocal1(a);
-	int i;
-	char **array;
-
-	for (i = 0, a = Field(v, 5); a != Val_emptylist; a = Field(a, 1)) { i++; }
-
-	array = gc_calloc(gc, (i + 1) * 2, sizeof(char *));
-	if (!array)
-		return 1;
-	for (i = 0, a = Field(v, 5); a != Val_emptylist; a = Field(a, 1), i++) {
-		value b = Field(a, 0);
-		array[i * 2] = dup_String_val(gc, Field(b, 0));
-		array[i * 2 + 1] = dup_String_val(gc, Field(b, 1));
-	}
-	*c_val = array;
-	CAMLreturn(0);
-}
-
-#endif
-
-static value Val_mac (libxl_mac *c_val)
-{
-	CAMLparam0();
-	CAMLlocal1(v);
-	int i;
-
-	v = caml_alloc_tuple(6);
-
-	for(i=0; i<6; i++)
-		Store_field(v, i, Val_int((*c_val)[i]));
-
-	CAMLreturn(v);
-}
-
-static int Mac_val(caml_gc *gc, struct caml_logger *lg, libxl_mac *c_val, value v)
-{
-	CAMLparam1(v);
-	int i;
-
-	for(i=0; i<6; i++)
-		(*c_val)[i] = Int_val(Field(v, i));
-
-	CAMLreturn(0);
-}
-
-static value Val_uuid (libxl_uuid *c_val)
-{
-	CAMLparam0();
-	CAMLlocal1(v);
-	uint8_t *uuid = libxl_uuid_bytearray(c_val);
-	int i;
-
-	v = caml_alloc_tuple(16);
-
-	for(i=0; i<16; i++)
-		Store_field(v, i, Val_int(uuid[i]));
-
-	CAMLreturn(v);
-}
-
-static int Uuid_val(caml_gc *gc, struct caml_logger *lg, libxl_uuid *c_val, value v)
-{
-	CAMLparam1(v);
-	int i;
-	uint8_t *uuid = libxl_uuid_bytearray(c_val);
-
-	for(i=0; i<16; i++)
-		uuid[i] = Int_val(Field(v, i));
-
-	CAMLreturn(0);
-}
-
-static value Val_hwcap(libxl_hwcap *c_val)
-{
-	CAMLparam0();
-	CAMLlocal1(hwcap);
-	int i;
-
-	hwcap = caml_alloc_tuple(8);
-	for (i = 0; i < 8; i++)
-		Store_field(hwcap, i, caml_copy_int32((*c_val)[i]));
-
-	CAMLreturn(hwcap);
-}
-
-#include "_libxl_types.inc"
-
-static value Val_topologyinfo(libxl_topologyinfo *c_val)
-{
-	CAMLparam0();
-	CAMLlocal3(v, topology, topologyinfo);
-	int i;
-
-	topologyinfo = caml_alloc_tuple(c_val->coremap.entries);
-	for (i = 0; i < c_val->coremap.entries; i++) {
-		v = Val_int(0); /* None */
-		if (c_val->coremap.array[i] != LIBXL_CPUARRAY_INVALID_ENTRY) {
-			topology = caml_alloc_tuple(3);
-			Store_field(topology, 0, Val_int(c_val->coremap.array[i]));
-			Store_field(topology, 1, Val_int(c_val->socketmap.array[i]));
-			Store_field(topology, 2, Val_int(c_val->nodemap.array[i]));
-			v = caml_alloc(1, 0); /* Some */
-			Store_field(v, 0, topology);
-		}
-		Store_field(topologyinfo, i, v);
-	}
-
-	CAMLreturn(topologyinfo);
-}
-
-value stub_xl_device_disk_add(value info, value domid)
-{
-	CAMLparam2(info, domid);
-	libxl_device_disk c_info;
-	int ret;
-	INIT_STRUCT();
-
-	device_disk_val(&gc, &lg, &c_info, info);
-
-	INIT_CTX();
-	ret = libxl_device_disk_add(ctx, Int_val(domid), &c_info);
-	if (ret != 0)
-		failwith_xl("disk_add", &lg);
-	FREE_CTX();
-	CAMLreturn(Val_unit);
-}
-
-value stub_xl_device_disk_del(value info, value domid)
-{
-	CAMLparam2(info, domid);
-	libxl_device_disk c_info;
-	int ret;
-	INIT_STRUCT();
-
-	device_disk_val(&gc, &lg, &c_info, info);
-
-	INIT_CTX();
-	ret = libxl_device_disk_del(ctx, Int_val(domid), &c_info, 0);
-	if (ret != 0)
-		failwith_xl("disk_del", &lg);
-	FREE_CTX();
-	CAMLreturn(Val_unit);
-}
-
-value stub_xl_device_nic_add(value info, value domid)
-{
-	CAMLparam2(info, domid);
-	libxl_device_nic c_info;
-	int ret;
-	INIT_STRUCT();
-
-	device_nic_val(&gc, &lg, &c_info, info);
-
-	INIT_CTX();
-	ret = libxl_device_nic_add(ctx, Int_val(domid), &c_info);
-	if (ret != 0)
-		failwith_xl("nic_add", &lg);
-	FREE_CTX();
-	CAMLreturn(Val_unit);
-}
-
-value stub_xl_device_nic_del(value info, value domid)
-{
-	CAMLparam2(info, domid);
-	libxl_device_nic c_info;
-	int ret;
-	INIT_STRUCT();
-
-	device_nic_val(&gc, &lg, &c_info, info);
-
-	INIT_CTX();
-	ret = libxl_device_nic_del(ctx, Int_val(domid), &c_info, 0);
-	if (ret != 0)
-		failwith_xl("nic_del", &lg);
-	FREE_CTX();
-	CAMLreturn(Val_unit);
-}
-
-value stub_xl_device_console_add(value info, value domid)
-{
-	CAMLparam2(info, domid);
-	libxl_device_console c_info;
-	int ret;
-	INIT_STRUCT();
-
-	device_console_val(&gc, &lg, &c_info, info);
-
-	INIT_CTX();
-	ret = libxl_device_console_add(ctx, Int_val(domid), &c_info);
-	if (ret != 0)
-		failwith_xl("console_add", &lg);
-	FREE_CTX();
-	CAMLreturn(Val_unit);
-}
-
-value stub_xl_device_vkb_add(value info, value domid)
-{
-	CAMLparam2(info, domid);
-	libxl_device_vkb c_info;
-	int ret;
-	INIT_STRUCT();
-
-	device_vkb_val(&gc, &lg, &c_info, info);
-
-	INIT_CTX();
-	ret = libxl_device_vkb_add(ctx, Int_val(domid), &c_info);
-	if (ret != 0)
-		failwith_xl("vkb_add", &lg);
-	FREE_CTX();
-
-	CAMLreturn(Val_unit);
-}
-
-value stub_xl_device_vkb_clean_shutdown(value domid)
-{
-	CAMLparam1(domid);
-	int ret;
-	INIT_STRUCT();
-
-	INIT_CTX();
-	ret = libxl_device_vkb_clean_shutdown(ctx, Int_val(domid));
-	if (ret != 0)
-		failwith_xl("vkb_clean_shutdown", &lg);
-	FREE_CTX();
-
-	CAMLreturn(Val_unit);
-}
-
-value stub_xl_device_vkb_hard_shutdown(value domid)
-{
-	CAMLparam1(domid);
-	int ret;
-	INIT_STRUCT();
-
-	INIT_CTX();
-	ret = libxl_device_vkb_hard_shutdown(ctx, Int_val(domid));
-	if (ret != 0)
-		failwith_xl("vkb_hard_shutdown", &lg);
-	FREE_CTX();
-
-	CAMLreturn(Val_unit);
-}
-
-value stub_xl_device_vfb_add(value info, value domid)
-{
-	CAMLparam2(info, domid);
-	libxl_device_vfb c_info;
-	int ret;
-	INIT_STRUCT();
-
-	device_vfb_val(&gc, &lg, &c_info, info);
-
-	INIT_CTX();
-	ret = libxl_device_vfb_add(ctx, Int_val(domid), &c_info);
-	if (ret != 0)
-		failwith_xl("vfb_add", &lg);
-	FREE_CTX();
-
-	CAMLreturn(Val_unit);
-}
-
-value stub_xl_device_vfb_clean_shutdown(value domid)
-{
-	CAMLparam1(domid);
-	int ret;
-	INIT_STRUCT();
-
-	INIT_CTX();
-	ret = libxl_device_vfb_clean_shutdown(ctx, Int_val(domid));
-	if (ret != 0)
-		failwith_xl("vfb_clean_shutdown", &lg);
-	FREE_CTX();
-
-	CAMLreturn(Val_unit);
-}
-
-value stub_xl_device_vfb_hard_shutdown(value domid)
-{
-	CAMLparam1(domid);
-	int ret;
-	INIT_STRUCT();
-
-	INIT_CTX();
-	ret = libxl_device_vfb_hard_shutdown(ctx, Int_val(domid));
-	if (ret != 0)
-		failwith_xl("vfb_hard_shutdown", &lg);
-	FREE_CTX();
-
-	CAMLreturn(Val_unit);
-}
-
-value stub_xl_device_pci_add(value info, value domid)
-{
-	CAMLparam2(info, domid);
-	libxl_device_pci c_info;
-	int ret;
-	INIT_STRUCT();
-
-	device_pci_val(&gc, &lg, &c_info, info);
-
-	INIT_CTX();
-	ret = libxl_device_pci_add(ctx, Int_val(domid), &c_info);
-	if (ret != 0)
-		failwith_xl("pci_add", &lg);
-	FREE_CTX();
-
-	CAMLreturn(Val_unit);
-}
-
-value stub_xl_device_pci_remove(value info, value domid)
-{
-	CAMLparam2(info, domid);
-	libxl_device_pci c_info;
-	int ret;
-	INIT_STRUCT();
-
-	device_pci_val(&gc, &lg, &c_info, info);
-
-	INIT_CTX();
-	ret = libxl_device_pci_remove(ctx, Int_val(domid), &c_info, 0);
-	if (ret != 0)
-		failwith_xl("pci_remove", &lg);
-	FREE_CTX();
-
-	CAMLreturn(Val_unit);
-}
-
-value stub_xl_device_pci_shutdown(value domid)
-{
-	CAMLparam1(domid);
-	int ret;
-	INIT_STRUCT();
-
-	INIT_CTX();
-	ret = libxl_device_pci_shutdown(ctx, Int_val(domid));
-	if (ret != 0)
-		failwith_xl("pci_shutdown", &lg);
-	FREE_CTX();
-
-	CAMLreturn(Val_unit);
-}
-
-value stub_xl_button_press(value domid, value button)
-{
-	CAMLparam2(domid, button);
-	int ret;
-	INIT_STRUCT();
-
-	INIT_CTX();
-	ret = libxl_button_press(ctx, Int_val(domid), Int_val(button) + LIBXL_BUTTON_POWER);
-	if (ret != 0)
-		failwith_xl("button_press", &lg);
-	FREE_CTX();
-
-	CAMLreturn(Val_unit);
-}
-
-value stub_xl_physinfo_get(value unit)
-{
-	CAMLparam1(unit);
-	CAMLlocal1(physinfo);
-	libxl_physinfo c_physinfo;
-	int ret;
-	INIT_STRUCT();
-
-	INIT_CTX();
-	ret = libxl_get_physinfo(ctx, &c_physinfo);
-	if (ret != 0)
-		failwith_xl("physinfo", &lg);
-	FREE_CTX();
-
-	physinfo = Val_physinfo(&gc, &lg, &c_physinfo);
-	CAMLreturn(physinfo);
-}
-
-value stub_xl_topologyinfo(value unit)
-{
-	CAMLparam1(unit);
-	CAMLlocal1(topologyinfo);
-	libxl_topologyinfo c_topologyinfo;
-	int ret;
-	INIT_STRUCT();
-
-	INIT_CTX();
-	ret = libxl_get_topologyinfo(ctx, &c_topologyinfo);
-	if (ret != 0)
-		failwith_xl("topologyinfo", &lg);
-	FREE_CTX();
-
-	topologyinfo = Val_topologyinfo(&c_topologyinfo);
-	CAMLreturn(topologyinfo);
-}
-
-value stub_xl_sched_credit_domain_get(value domid)
-{
-	CAMLparam1(domid);
-	CAMLlocal1(scinfo);
-	libxl_sched_credit c_scinfo;
-	int ret;
-	INIT_STRUCT();
-
-	INIT_CTX();
-	ret = libxl_sched_credit_domain_get(ctx, Int_val(domid), &c_scinfo);
-	if (ret != 0)
-		failwith_xl("sched_credit_domain_get", &lg);
-	FREE_CTX();
-
-	scinfo = Val_sched_credit(&gc, &lg, &c_scinfo);
-	CAMLreturn(scinfo);
-}
-
-value stub_xl_sched_credit_domain_set(value domid, value scinfo)
-{
-	CAMLparam2(domid, scinfo);
-	libxl_sched_credit c_scinfo;
-	int ret;
-	INIT_STRUCT();
-
-	sched_credit_val(&gc, &lg, &c_scinfo, scinfo);
-
-	INIT_CTX();
-	ret = libxl_sched_credit_domain_set(ctx, Int_val(domid), &c_scinfo);
-	if (ret != 0)
-		failwith_xl("sched_credit_domain_set", &lg);
-	FREE_CTX();
-
-	CAMLreturn(Val_unit);
-}
-
-value stub_xl_send_trigger(value domid, value trigger, value vcpuid)
-{
-	CAMLparam3(domid, trigger, vcpuid);
-	int ret;
-	char *c_trigger;
-	INIT_STRUCT();
-
-	c_trigger = dup_String_val(&gc, trigger);
-
-	INIT_CTX();
-	ret = libxl_send_trigger(ctx, Int_val(domid), c_trigger, Int_val(vcpuid));
-	if (ret != 0)
-		failwith_xl("send_trigger", &lg);
-	FREE_CTX();
-	CAMLreturn(Val_unit);
-}
-
-value stub_xl_send_sysrq(value domid, value sysrq)
-{
-	CAMLparam2(domid, sysrq);
-	int ret;
-	INIT_STRUCT();
-
-	INIT_CTX();
-	ret = libxl_send_sysrq(ctx, Int_val(domid), Int_val(sysrq));
-	if (ret != 0)
-		failwith_xl("send_sysrq", &lg);
-	FREE_CTX();
-	CAMLreturn(Val_unit);
-}
-
-value stub_xl_send_debug_keys(value keys)
-{
-	CAMLparam1(keys);
-	int ret;
-	char *c_keys;
-	INIT_STRUCT();
-
-	c_keys = dup_String_val(&gc, keys);
-
-	INIT_CTX();
-	ret = libxl_send_debug_keys(ctx, c_keys);
-	if (ret != 0)
-		failwith_xl("send_debug_keys", &lg);
-	FREE_CTX();
-	CAMLreturn(Val_unit);
-}
-
-/*
- * Local variables:
- *  indent-tabs-mode: t
- *  c-basic-offset: 8
- *  tab-width: 8
- * End:
- */
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xs/META.in
--- a/tools/ocaml/libs/xs/META.in	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/libs/xs/META.in	Mon Oct 10 16:37:07 2011 +0100
@@ -1,5 +1,5 @@
 version = "@VERSION@"
 description = "XenStore Interface"
-requires = "unix,xb"
-archive(byte) = "xs.cma"
-archive(native) = "xs.cmxa"
+requires = "unix,xenbus"
+archive(byte) = "xenstore.cma"
+archive(native) = "xenstore.cmxa"
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xs/Makefile
--- a/tools/ocaml/libs/xs/Makefile	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/libs/xs/Makefile	Mon Oct 10 16:37:07 2011 +0100
@@ -3,6 +3,7 @@
 include $(TOPLEVEL)/common.make
 
 OCAMLINCLUDE += -I ../xb/
+OCAMLOPTFLAGS += -for-pack Xenstore
 
 .NOTPARALLEL:
 # Ocaml is such a PITA!
@@ -12,7 +13,7 @@
 PRELIBS = $(foreach obj, $(PREOBJS),$(obj).cmo) $(foreach obj,$(PREOJBS),$(obj).cmx)
 OBJS = queueop xsraw xst xs
 INTF = xsraw.cmi xst.cmi xs.cmi
-LIBS = xs.cma xs.cmxa
+LIBS = xenstore.cma xenstore.cmxa
 
 all: $(PREINTF) $(PRELIBS) $(INTF) $(LIBS) $(PROGRAMS)
 
@@ -20,18 +21,27 @@
 
 libs: $(LIBS)
 
-xs_OBJS = $(OBJS)
-OCAML_NOC_LIBRARY = xs
+xenstore_OBJS = xenstore
+OCAML_NOC_LIBRARY = xenstore
+
+xenstore.cmx : $(foreach obj, $(OBJS), $(obj).cmx)
+	$(E) " CMX      $@"
+	$(Q)$(OCAMLOPT) -pack -o $@ $^
+
+xenstore.cmo : $(foreach obj, $(OBJS), $(obj).cmo)
+	$(E) " CMO      $@"
+	$(Q)$(OCAMLC) -pack -o $@ $^
+
 
 .PHONY: install
 install: $(LIBS) META
 	mkdir -p $(OCAMLDESTDIR)
-	ocamlfind remove -destdir $(OCAMLDESTDIR) xs
-	ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xs META $(INTF) xs.mli xst.mli xsraw.mli $(LIBS) *.a *.cmx
+	ocamlfind remove -destdir $(OCAMLDESTDIR) xenstore
+	ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xenstore META $(LIBS) xenstore.cmo xenstore.cmi xenstore.cmx *.a 
 
 .PHONY: uninstall
 uninstall:
-	ocamlfind remove -destdir $(OCAMLDESTDIR) xs
+	ocamlfind remove -destdir $(OCAMLDESTDIR) xenstore
 
 include $(TOPLEVEL)/Makefile.rules
 
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xs/queueop.ml
--- a/tools/ocaml/libs/xs/queueop.ml	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/libs/xs/queueop.ml	Mon Oct 10 16:37:07 2011 +0100
@@ -13,6 +13,7 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU Lesser General Public License for more details.
  *)
+open Xenbus
 
 let data_concat ls = (String.concat "\000" ls) ^ "\000"
 let queue_path ty (tid: int) (path: string) con =
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xs/xs.ml
--- a/tools/ocaml/libs/xs/xs.ml	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/libs/xs/xs.ml	Mon Oct 10 16:37:07 2011 +0100
@@ -69,7 +69,7 @@
 let read_watchevent xsh = Xsraw.read_watchevent xsh.con
 
 let make fd = get_operations (Xsraw.open_fd fd)
-let get_fd xsh = Xb.get_fd xsh.con.Xsraw.xb
+let get_fd xsh = Xenbus.Xb.get_fd xsh.con.Xsraw.xb
 
 exception Timeout
 
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xs/xsraw.ml
--- a/tools/ocaml/libs/xs/xsraw.ml	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/libs/xs/xsraw.ml	Mon Oct 10 16:37:07 2011 +0100
@@ -14,6 +14,8 @@
  * GNU Lesser General Public License for more details.
  *)
 
+open Xenbus
+
 exception Partial_not_empty
 exception Unexpected_packet of string
 
@@ -27,7 +29,7 @@
 	raise (Unexpected_packet s)
 
 type con = {
-	xb: Xb.t;
+	xb: Xenbus.Xb.t;
 	watchevents: (string * string) Queue.t;
 }
 
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/libs/xs/xsraw.mli
--- a/tools/ocaml/libs/xs/xsraw.mli	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/libs/xs/xsraw.mli	Mon Oct 10 16:37:07 2011 +0100
@@ -16,8 +16,8 @@
 exception Partial_not_empty
 exception Unexpected_packet of string
 exception Invalid_path of string
-val unexpected_packet : Xb.Op.operation -> Xb.Op.operation -> 'a
-type con = { xb : Xb.t; watchevents : (string * string) Queue.t; }
+val unexpected_packet : Xenbus.Xb.Op.operation -> Xenbus.Xb.Op.operation -> 'a
+type con = { xb : Xenbus.Xb.t; watchevents : (string * string) Queue.t; }
 val close : con -> unit
 val open_fd : Unix.file_descr -> con
 val split_string : ?limit:int -> char -> string -> string list
@@ -26,14 +26,14 @@
 val string_of_perms : int * perm * (int * perm) list -> string
 val perms_of_string : string -> int * perm * (int * perm) list
 val pkt_send : con -> unit
-val pkt_recv : con -> Xb.Packet.t
-val pkt_recv_timeout : con -> float -> bool * Xb.Packet.t option
+val pkt_recv : con -> Xenbus.Xb.Packet.t
+val pkt_recv_timeout : con -> float -> bool * Xenbus.Xb.Packet.t option
 val queue_watchevent : con -> string -> unit
 val has_watchevents : con -> bool
 val get_watchevent : con -> string * string
 val read_watchevent : con -> string * string
-val sync_recv : Xb.Op.operation -> con -> string
-val sync : (Xb.t -> 'a) -> con -> string
+val sync_recv : Xenbus.Xb.Op.operation -> con -> string
+val sync : (Xenbus.Xb.t -> 'a) -> con -> string
 val ack : string -> unit
 val validate_path : string -> unit
 val validate_watch_path : string -> unit
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/xenstored/Makefile
--- a/tools/ocaml/xenstored/Makefile	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/xenstored/Makefile	Mon Oct 10 16:37:07 2011 +0100
@@ -35,11 +35,11 @@
 XENSTOREDLIBS = \
 	unix.cmxa \
 	$(OCAML_TOPLEVEL)/libs/uuid/uuid.cmxa \
-	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/mmap $(OCAML_TOPLEVEL)/libs/mmap/mmap.cmxa \
+	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/mmap $(OCAML_TOPLEVEL)/libs/mmap/xenmmap.cmxa \
 	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/log $(OCAML_TOPLEVEL)/libs/log/log.cmxa \
-	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/eventchn $(OCAML_TOPLEVEL)/libs/eventchn/eventchn.cmxa \
-	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/xc $(OCAML_TOPLEVEL)/libs/xc/xc.cmxa \
-	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/xb $(OCAML_TOPLEVEL)/libs/xb/xb.cmxa \
+	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/eventchn $(OCAML_TOPLEVEL)/libs/eventchn/xeneventchn.cmxa \
+	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/xc $(OCAML_TOPLEVEL)/libs/xc/xenctrl.cmxa \
+	-ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/xb $(OCAML_TOPLEVEL)/libs/xb/xenbus.cmxa \
 	-ccopt -L -ccopt $(XEN_ROOT)/tools/libxc
 
 PROGRAMS = oxenstored
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/xenstored/connection.ml
--- a/tools/ocaml/xenstored/connection.ml	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/xenstored/connection.ml	Mon Oct 10 16:37:07 2011 +0100
@@ -27,7 +27,7 @@
 }
 
 and t = {
-	xb: Xb.t;
+	xb: Xenbus.Xb.t;
 	dom: Domain.t option;
 	transactions: (int, Transaction.t) Hashtbl.t;
 	mutable next_tid: int;
@@ -93,10 +93,10 @@
 	Logging.new_connection ~tid:Transaction.none ~con:(get_domstr con);
 	con
 
-let get_fd con = Xb.get_fd con.xb
+let get_fd con = Xenbus.Xb.get_fd con.xb
 let close con =
 	Logging.end_connection ~tid:Transaction.none ~con:(get_domstr con);
-	Xb.close con.xb
+	Xenbus.Xb.close con.xb
 
 let get_perm con =
 	con.perm
@@ -108,9 +108,9 @@
 	con.perm <- Perms.Connection.set_target (get_perm con) ~perms:[Perms.READ; Perms.WRITE] target_domid
 
 let send_reply con tid rid ty data =
-	Xb.queue con.xb (Xb.Packet.create tid rid ty data)
+	Xenbus.Xb.queue con.xb (Xenbus.Xb.Packet.create tid rid ty data)
 
-let send_error con tid rid err = send_reply con tid rid Xb.Op.Error (err ^ "\000")
+let send_error con tid rid err = send_reply con tid rid Xenbus.Xb.Op.Error (err ^ "\000")
 let send_ack con tid rid ty = send_reply con tid rid ty "OK\000"
 
 let get_watch_path con path =
@@ -166,7 +166,7 @@
 
 let fire_single_watch watch =
 	let data = Utils.join_by_null [watch.path; watch.token; ""] in
-	send_reply watch.con Transaction.none 0 Xb.Op.Watchevent data
+	send_reply watch.con Transaction.none 0 Xenbus.Xb.Op.Watchevent data
 
 let fire_watch watch path =
 	let new_path =
@@ -179,7 +179,7 @@
 			path
 	in
 	let data = Utils.join_by_null [ new_path; watch.token; "" ] in
-	send_reply watch.con Transaction.none 0 Xb.Op.Watchevent data
+	send_reply watch.con Transaction.none 0 Xenbus.Xb.Op.Watchevent data
 
 let find_next_tid con =
 	let ret = con.next_tid in con.next_tid <- con.next_tid + 1; ret
@@ -203,15 +203,15 @@
 let get_transaction con tid =
 	Hashtbl.find con.transactions tid
 
-let do_input con = Xb.input con.xb
-let has_input con = Xb.has_in_packet con.xb
-let pop_in con = Xb.get_in_packet con.xb
-let has_more_input con = Xb.has_more_input con.xb
+let do_input con = Xenbus.Xb.input con.xb
+let has_input con = Xenbus.Xb.has_in_packet con.xb
+let pop_in con = Xenbus.Xb.get_in_packet con.xb
+let has_more_input con = Xenbus.Xb.has_more_input con.xb
 
-let has_output con = Xb.has_output con.xb
-let has_new_output con = Xb.has_new_output con.xb
-let peek_output con = Xb.peek_output con.xb
-let do_output con = Xb.output con.xb
+let has_output con = Xenbus.Xb.has_output con.xb
+let has_new_output con = Xenbus.Xb.has_new_output con.xb
+let peek_output con = Xenbus.Xb.peek_output con.xb
+let do_output con = Xenbus.Xb.output con.xb
 
 let incr_ops con = con.stat_nb_ops <- con.stat_nb_ops + 1
 
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/xenstored/connections.ml
--- a/tools/ocaml/xenstored/connections.ml	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/xenstored/connections.ml	Mon Oct 10 16:37:07 2011 +0100
@@ -26,12 +26,12 @@
 let create () = { anonymous = []; domains = Hashtbl.create 8; watches = Trie.create () }
 
 let add_anonymous cons fd can_write =
-	let xbcon = Xb.open_fd fd in
+	let xbcon = Xenbus.Xb.open_fd fd in
 	let con = Connection.create xbcon None in
 	cons.anonymous <- con :: cons.anonymous
 
 let add_domain cons dom =
-	let xbcon = Xb.open_mmap (Domain.get_interface dom) (fun () -> Domain.notify dom) in
+	let xbcon = Xenbus.Xb.open_mmap (Domain.get_interface dom) (fun () -> Domain.notify dom) in
 	let con = Connection.create xbcon (Some dom) in
 	Hashtbl.add cons.domains (Domain.get_id dom) con
 
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/xenstored/domain.ml
--- a/tools/ocaml/xenstored/domain.ml	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/xenstored/domain.ml	Mon Oct 10 16:37:07 2011 +0100
@@ -20,10 +20,10 @@
 
 type t =
 {
-	id: Xc.domid;
+	id: Xenctrl.domid;
 	mfn: nativeint;
 	remote_port: int;
-	interface: Mmap.mmap_interface;
+	interface: Xenmmap.mmap_interface;
 	eventchn: Event.t;
 	mutable port: int;
 }
@@ -47,7 +47,7 @@
 let close dom =
 	debug "domain %d unbound port %d" dom.id dom.port;
 	Event.unbind dom.eventchn dom.port;
-	Mmap.unmap dom.interface;
+	Xenmmap.unmap dom.interface;
 	()
 
 let make id mfn remote_port interface eventchn = {
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/xenstored/domains.ml
--- a/tools/ocaml/xenstored/domains.ml	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/xenstored/domains.ml	Mon Oct 10 16:37:07 2011 +0100
@@ -16,7 +16,7 @@
 
 type domains = {
 	eventchn: Event.t;
-	table: (Xc.domid, Domain.t) Hashtbl.t;
+	table: (Xenctrl.domid, Domain.t) Hashtbl.t;
 }
 
 let init eventchn =
@@ -33,16 +33,16 @@
 
 	Hashtbl.iter (fun id _ -> if id <> 0 then
 		try
-			let info = Xc.domain_getinfo xc id in
-			if info.Xc.shutdown || info.Xc.dying then (
+			let info = Xenctrl.domain_getinfo xc id in
+			if info.Xenctrl.shutdown || info.Xenctrl.dying then (
 				Logs.debug "general" "Domain %u died (dying=%b, shutdown %b -- code %d)"
-				                    id info.Xc.dying info.Xc.shutdown info.Xc.shutdown_code;
-				if info.Xc.dying then
+				                    id info.Xenctrl.dying info.Xenctrl.shutdown info.Xenctrl.shutdown_code;
+				if info.Xenctrl.dying then
 					dead_dom := id :: !dead_dom
 				else
 					notify := true;
 			)
-		with Xc.Error _ ->
+		with Xenctrl.Error _ ->
 			Logs.debug "general" "Domain %u died -- no domain info" id;
 			dead_dom := id :: !dead_dom;
 		) doms.table;
@@ -57,7 +57,7 @@
 	()
 
 let create xc doms domid mfn port =
-	let interface = Xc.map_foreign_range xc domid (Mmap.getpagesize()) mfn in
+	let interface = Xenctrl.map_foreign_range xc domid (Xenmmap.getpagesize()) mfn in
 	let dom = Domain.make domid mfn port interface doms.eventchn in
 	Hashtbl.add doms.table domid dom;
 	Domain.bind_interdomain dom;
@@ -66,13 +66,13 @@
 let create0 fake doms =
 	let port, interface =
 		if fake then (
-			0, Xc.with_intf (fun xc -> Xc.map_foreign_range xc 0 (Mmap.getpagesize()) 0n)
+			0, Xenctrl.with_intf (fun xc -> Xenctrl.map_foreign_range xc 0 (Xenmmap.getpagesize()) 0n)
 		) else (
 			let port = Utils.read_file_single_integer Define.xenstored_proc_port
 			and fd = Unix.openfile Define.xenstored_proc_kva
 					       [ Unix.O_RDWR ] 0o600 in
-			let interface = Mmap.mmap fd Mmap.RDWR Mmap.SHARED
-						  (Mmap.getpagesize()) 0 in
+			let interface = Xenmmap.mmap fd Xenmmap.RDWR Xenmmap.SHARED
+						  (Xenmmap.getpagesize()) 0 in
 			Unix.close fd;
 			port, interface
 		)
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/xenstored/event.ml
--- a/tools/ocaml/xenstored/event.ml	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/xenstored/event.ml	Mon Oct 10 16:37:07 2011 +0100
@@ -16,15 +16,15 @@
 
 (**************** high level binding ****************)
 type t = {
-	handle: Eventchn.handle;
+	handle: Xeneventchn.handle;
 	mutable virq_port: int;
 }
 
-let init () = { handle = Eventchn.init (); virq_port = -1; }
-let fd eventchn = Eventchn.fd eventchn.handle
-let bind_dom_exc_virq eventchn = eventchn.virq_port <- Eventchn.bind_dom_exc_virq eventchn.handle
-let bind_interdomain eventchn domid port = Eventchn.bind_interdomain eventchn.handle domid port
-let unbind eventchn port = Eventchn.unbind eventchn.handle port
-let notify eventchn port = Eventchn.notify eventchn.handle port
-let pending eventchn = Eventchn.pending eventchn.handle
-let unmask eventchn port = Eventchn.unmask eventchn.handle port
+let init () = { handle = Xeneventchn.init (); virq_port = -1; }
+let fd eventchn = Xeneventchn.fd eventchn.handle
+let bind_dom_exc_virq eventchn = eventchn.virq_port <- Xeneventchn.bind_dom_exc_virq eventchn.handle
+let bind_interdomain eventchn domid port = Xeneventchn.bind_interdomain eventchn.handle domid port
+let unbind eventchn port = Xeneventchn.unbind eventchn.handle port
+let notify eventchn port = Xeneventchn.notify eventchn.handle port
+let pending eventchn = Xeneventchn.pending eventchn.handle
+let unmask eventchn port = Xeneventchn.unmask eventchn.handle port
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/xenstored/logging.ml
--- a/tools/ocaml/xenstored/logging.ml	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/xenstored/logging.ml	Mon Oct 10 16:37:07 2011 +0100
@@ -39,7 +39,7 @@
 	| Commit
 	| Newconn
 	| Endconn
-	| XbOp of Xb.Op.operation
+	| XbOp of Xenbus.Xb.Op.operation
 
 type access =
 	{
@@ -82,35 +82,35 @@
 	| Endconn                 -> "endconn  "
 
 	| XbOp op -> match op with
-	| Xb.Op.Debug             -> "debug    "
+	| Xenbus.Xb.Op.Debug             -> "debug    "
 
-	| Xb.Op.Directory         -> "directory"
-	| Xb.Op.Read              -> "read     "
-	| Xb.Op.Getperms          -> "getperms "
+	| Xenbus.Xb.Op.Directory         -> "directory"
+	| Xenbus.Xb.Op.Read              -> "read     "
+	| Xenbus.Xb.Op.Getperms          -> "getperms "
 
-	| Xb.Op.Watch             -> "watch    "
-	| Xb.Op.Unwatch           -> "unwatch  "
+	| Xenbus.Xb.Op.Watch             -> "watch    "
+	| Xenbus.Xb.Op.Unwatch           -> "unwatch  "
 
-	| Xb.Op.Transaction_start -> "t start  "
-	| Xb.Op.Transaction_end   -> "t end    "
+	| Xenbus.Xb.Op.Transaction_start -> "t start  "
+	| Xenbus.Xb.Op.Transaction_end   -> "t end    "
 
-	| Xb.Op.Introduce         -> "introduce"
-	| Xb.Op.Release           -> "release  "
-	| Xb.Op.Getdomainpath     -> "getdomain"
-	| Xb.Op.Isintroduced      -> "is introduced"
-	| Xb.Op.Resume            -> "resume   "
+	| Xenbus.Xb.Op.Introduce         -> "introduce"
+	| Xenbus.Xb.Op.Release           -> "release  "
+	| Xenbus.Xb.Op.Getdomainpath     -> "getdomain"
+	| Xenbus.Xb.Op.Isintroduced      -> "is introduced"
+	| Xenbus.Xb.Op.Resume            -> "resume   "
  
-	| Xb.Op.Write             -> "write    "
-	| Xb.Op.Mkdir             -> "mkdir    "
-	| Xb.Op.Rm                -> "rm       "
-	| Xb.Op.Setperms          -> "setperms "
-	| Xb.Op.Restrict          -> "restrict "
-	| Xb.Op.Set_target        -> "settarget"
+	| Xenbus.Xb.Op.Write             -> "write    "
+	| Xenbus.Xb.Op.Mkdir             -> "mkdir    "
+	| Xenbus.Xb.Op.Rm                -> "rm       "
+	| Xenbus.Xb.Op.Setperms          -> "setperms "
+	| Xenbus.Xb.Op.Restrict          -> "restrict "
+	| Xenbus.Xb.Op.Set_target        -> "settarget"
 
-	| Xb.Op.Error             -> "error    "
-	| Xb.Op.Watchevent        -> "w event  "
+	| Xenbus.Xb.Op.Error             -> "error    "
+	| Xenbus.Xb.Op.Watchevent        -> "w event  "
 
-	| x                       -> Xb.Op.to_string x
+	| x                       -> Xenbus.Xb.Op.to_string x
 
 let file_exists file =
 	try
@@ -210,10 +210,10 @@
 let xb_op ~tid ~con ~ty data =
 	let print =
 	match ty with
-		| Xb.Op.Read | Xb.Op.Directory | Xb.Op.Getperms -> !log_read_ops
-		| Xb.Op.Transaction_start | Xb.Op.Transaction_end ->
+		| Xenbus.Xb.Op.Read | Xenbus.Xb.Op.Directory | Xenbus.Xb.Op.Getperms -> !log_read_ops
+		| Xenbus.Xb.Op.Transaction_start | Xenbus.Xb.Op.Transaction_end ->
 			false (* transactions are managed below *)
-		| Xb.Op.Introduce | Xb.Op.Release | Xb.Op.Getdomainpath | Xb.Op.Isintroduced | Xb.Op.Resume ->
+		| Xenbus.Xb.Op.Introduce | Xenbus.Xb.Op.Release | Xenbus.Xb.Op.Getdomainpath | Xenbus.Xb.Op.Isintroduced | Xenbus.Xb.Op.Resume ->
 			!log_special_ops
 		| _ -> true
 	in
@@ -222,17 +222,17 @@
 
 let start_transaction ~tid ~con = 
 	if !log_transaction_ops && tid <> 0
-	then write_access_log ~tid ~con (XbOp Xb.Op.Transaction_start)
+	then write_access_log ~tid ~con (XbOp Xenbus.Xb.Op.Transaction_start)
 
 let end_transaction ~tid ~con = 
 	if !log_transaction_ops && tid <> 0
-	then write_access_log ~tid ~con (XbOp Xb.Op.Transaction_end)
+	then write_access_log ~tid ~con (XbOp Xenbus.Xb.Op.Transaction_end)
 
 let xb_answer ~tid ~con ~ty data =
 	let print = match ty with
-		| Xb.Op.Error when data="ENOENT " -> !log_read_ops
-		| Xb.Op.Error -> !log_special_ops
-		| Xb.Op.Watchevent -> true
+		| Xenbus.Xb.Op.Error when data="ENOENT " -> !log_read_ops
+		| Xenbus.Xb.Op.Error -> !log_special_ops
+		| Xenbus.Xb.Op.Watchevent -> true
 		| _ -> false
 	in
 		if print
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/xenstored/perms.ml
--- a/tools/ocaml/xenstored/perms.ml	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/xenstored/perms.ml	Mon Oct 10 16:37:07 2011 +0100
@@ -43,9 +43,9 @@
 
 type t =
 {
-	owner: Xc.domid;
+	owner: Xenctrl.domid;
 	other: permty;
-	acl: (Xc.domid * permty) list;
+	acl: (Xenctrl.domid * permty) list;
 }
 
 let create owner other acl =
@@ -88,7 +88,7 @@
 module Connection =
 struct
 
-type elt = Xc.domid * (permty list)
+type elt = Xenctrl.domid * (permty list)
 type t =
 	{ main: elt;
 	  target: elt option; }
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/xenstored/process.ml
--- a/tools/ocaml/xenstored/process.ml	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/xenstored/process.ml	Mon Oct 10 16:37:07 2011 +0100
@@ -54,10 +54,10 @@
 let process_watch ops cons =
 	let do_op_watch op cons =
 		let recurse = match (fst op) with
-		| Xb.Op.Write    -> false
-		| Xb.Op.Mkdir    -> false
-		| Xb.Op.Rm       -> true
-		| Xb.Op.Setperms -> false
+		| Xenbus.Xb.Op.Write    -> false
+		| Xenbus.Xb.Op.Mkdir    -> false
+		| Xenbus.Xb.Op.Rm       -> true
+		| Xenbus.Xb.Op.Setperms -> false
 		| _              -> raise (Failure "huh ?") in
 		Connections.fire_watches cons (snd op) recurse in
 	List.iter (fun op -> do_op_watch op cons) ops
@@ -83,7 +83,7 @@
 	then None
 	else try match split None '\000' data with
 	| "print" :: msg :: _ ->
-		Logging.xb_op ~tid:0 ~ty:Xb.Op.Debug ~con:"=======>" msg;
+		Logging.xb_op ~tid:0 ~ty:Xenbus.Xb.Op.Debug ~con:"=======>" msg;
 		None
 	| "quota" :: domid :: _ ->
 		let domid = int_of_string domid in
@@ -120,7 +120,7 @@
 		| _                   -> raise Invalid_Cmd_Args
 		in
 	let watch = Connections.add_watch cons con node token in
-	Connection.send_ack con (Transaction.get_id t) rid Xb.Op.Watch;
+	Connection.send_ack con (Transaction.get_id t) rid Xenbus.Xb.Op.Watch;
 	Connection.fire_single_watch watch
 
 let do_unwatch con t domains cons data =
@@ -165,7 +165,7 @@
 		if Domains.exist domains domid then
 			Domains.find domains domid
 		else try
-			let ndom = Xc.with_intf (fun xc ->
+			let ndom = Xenctrl.with_intf (fun xc ->
 				Domains.create xc domains domid mfn port) in
 			Connections.add_domain cons ndom;
 			Connections.fire_spec_watches cons "@introduceDomain";
@@ -299,25 +299,25 @@
 
 let function_of_type ty =
 	match ty with
-	| Xb.Op.Debug             -> reply_data_or_ack do_debug
-	| Xb.Op.Directory         -> reply_data do_directory
-	| Xb.Op.Read              -> reply_data do_read
-	| Xb.Op.Getperms          -> reply_data do_getperms
-	| Xb.Op.Watch             -> reply_none do_watch
-	| Xb.Op.Unwatch           -> reply_ack do_unwatch
-	| Xb.Op.Transaction_start -> reply_data do_transaction_start
-	| Xb.Op.Transaction_end   -> reply_ack do_transaction_end
-	| Xb.Op.Introduce         -> reply_ack do_introduce
-	| Xb.Op.Release           -> reply_ack do_release
-	| Xb.Op.Getdomainpath     -> reply_data do_getdomainpath
-	| Xb.Op.Write             -> reply_ack do_write
-	| Xb.Op.Mkdir             -> reply_ack do_mkdir
-	| Xb.Op.Rm                -> reply_ack do_rm
-	| Xb.Op.Setperms          -> reply_ack do_setperms
-	| Xb.Op.Isintroduced      -> reply_data do_isintroduced
-	| Xb.Op.Resume            -> reply_ack do_resume
-	| Xb.Op.Set_target        -> reply_ack do_set_target
-	| Xb.Op.Restrict          -> reply_ack do_restrict
+	| Xenbus.Xb.Op.Debug             -> reply_data_or_ack do_debug
+	| Xenbus.Xb.Op.Directory         -> reply_data do_directory
+	| Xenbus.Xb.Op.Read              -> reply_data do_read
+	| Xenbus.Xb.Op.Getperms          -> reply_data do_getperms
+	| Xenbus.Xb.Op.Watch             -> reply_none do_watch
+	| Xenbus.Xb.Op.Unwatch           -> reply_ack do_unwatch
+	| Xenbus.Xb.Op.Transaction_start -> reply_data do_transaction_start
+	| Xenbus.Xb.Op.Transaction_end   -> reply_ack do_transaction_end
+	| Xenbus.Xb.Op.Introduce         -> reply_ack do_introduce
+	| Xenbus.Xb.Op.Release           -> reply_ack do_release
+	| Xenbus.Xb.Op.Getdomainpath     -> reply_data do_getdomainpath
+	| Xenbus.Xb.Op.Write             -> reply_ack do_write
+	| Xenbus.Xb.Op.Mkdir             -> reply_ack do_mkdir
+	| Xenbus.Xb.Op.Rm                -> reply_ack do_rm
+	| Xenbus.Xb.Op.Setperms          -> reply_ack do_setperms
+	| Xenbus.Xb.Op.Isintroduced      -> reply_data do_isintroduced
+	| Xenbus.Xb.Op.Resume            -> reply_ack do_resume
+	| Xenbus.Xb.Op.Set_target        -> reply_ack do_set_target
+	| Xenbus.Xb.Op.Restrict          -> reply_ack do_restrict
 	| _                       -> reply_ack do_error
 
 let input_handle_error ~cons ~doms ~fct ~ty ~con ~t ~rid ~data =
@@ -370,11 +370,11 @@
 let do_input store cons doms con =
 	if Connection.do_input con then (
 		let packet = Connection.pop_in con in
-		let tid, rid, ty, data = Xb.Packet.unpack packet in
+		let tid, rid, ty, data = Xenbus.Xb.Packet.unpack packet in
 		(* As we don't log IO, do not call an unnecessary sanitize_data 
 		   Logs.info "io" "[%s] -> [%d] %s \"%s\""
 		         (Connection.get_domstr con) tid
-		         (Xb.Op.to_string ty) (sanitize_data data); *)
+		         (Xenbus.Xb.Op.to_string ty) (sanitize_data data); *)
 		process_packet ~store ~cons ~doms ~con ~tid ~rid ~ty ~data;
 		write_access_log ~ty ~tid ~con ~data;
 		Connection.incr_ops con;
@@ -384,11 +384,11 @@
 	if Connection.has_output con then (
 		if Connection.has_new_output con then (
 			let packet = Connection.peek_output con in
-			let tid, rid, ty, data = Xb.Packet.unpack packet in
+			let tid, rid, ty, data = Xenbus.Xb.Packet.unpack packet in
 			(* As we don't log IO, do not call an unnecessary sanitize_data 
 			   Logs.info "io" "[%s] <- %s \"%s\""
 			         (Connection.get_domstr con)
-			         (Xb.Op.to_string ty) (sanitize_data data);*)
+			         (Xenbus.Xb.Op.to_string ty) (sanitize_data data);*)
 			write_answer_log ~ty ~tid ~con ~data;
 		);
 		ignore (Connection.do_output con)
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/xenstored/quota.ml
--- a/tools/ocaml/xenstored/quota.ml	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/xenstored/quota.ml	Mon Oct 10 16:37:07 2011 +0100
@@ -26,7 +26,7 @@
 type t = {
 	maxent: int;               (* max entities per domU *)
 	maxsize: int;              (* max size of data store in one node *)
-	cur: (Xc.domid, int) Hashtbl.t; (* current domains quota *)
+	cur: (Xenctrl.domid, int) Hashtbl.t; (* current domains quota *)
 }
 
 let to_string quota domid =
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/xenstored/transaction.ml
--- a/tools/ocaml/xenstored/transaction.ml	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/xenstored/transaction.ml	Mon Oct 10 16:37:07 2011 +0100
@@ -74,7 +74,7 @@
 type t = {
 	ty: ty;
 	store: Store.t;
-	mutable ops: (Xb.Op.operation * Store.Path.t) list;
+	mutable ops: (Xenbus.Xb.Op.operation * Store.Path.t) list;
 	mutable read_lowpath: Store.Path.t option;
 	mutable write_lowpath: Store.Path.t option;
 }
@@ -105,23 +105,23 @@
 	if path_exists
 	then set_write_lowpath t path
 	else set_write_lowpath t (Store.Path.get_parent path);
-	add_wop t Xb.Op.Write path
+	add_wop t Xenbus.Xb.Op.Write path
 
 let mkdir ?(with_watch=true) t perm path =
 	Store.mkdir t.store perm path;
 	set_write_lowpath t path;
 	if with_watch then
-		add_wop t Xb.Op.Mkdir path
+		add_wop t Xenbus.Xb.Op.Mkdir path
 
 let setperms t perm path perms =
 	Store.setperms t.store perm path perms;
 	set_write_lowpath t path;
-	add_wop t Xb.Op.Setperms path
+	add_wop t Xenbus.Xb.Op.Setperms path
 
 let rm t perm path =
 	Store.rm t.store perm path;
 	set_write_lowpath t (Store.Path.get_parent path);
-	add_wop t Xb.Op.Rm path
+	add_wop t Xenbus.Xb.Op.Rm path
 
 let ls t perm path =	
 	let r = Store.ls t.store perm path in
diff -r 72f339bc600d -r cdb34816a40a tools/ocaml/xenstored/xenstored.ml
--- a/tools/ocaml/xenstored/xenstored.ml	Mon Oct 10 11:21:51 2011 +0100
+++ b/tools/ocaml/xenstored/xenstored.ml	Mon Oct 10 16:37:07 2011 +0100
@@ -35,7 +35,7 @@
 			if err <> Unix.ECONNRESET then
 			error "closing socket connection: read error: %s"
 			      (Unix.error_message err)
-		| Xb.End_of_file ->
+		| Xenbus.Xb.End_of_file ->
 			Connections.del_anonymous cons c;
 			debug "closing socket connection"
 		in
@@ -170,7 +170,7 @@
 let from_channel store cons doms chan =
 	(* don't let the permission get on our way, full perm ! *)
 	let op = Store.get_ops store Perms.Connection.full_rights in
-	let xc = Xc.interface_open () in
+	let xc = Xenctrl.interface_open () in
 
 	let domain_f domid mfn port =
 		let ndom =
@@ -190,7 +190,7 @@
 		op.Store.setperms path perms
 		in
 	finally (fun () -> from_channel_f chan domain_f watch_f store_f)
-	        (fun () -> Xc.interface_close xc)
+	        (fun () -> Xenctrl.interface_close xc)
 
 let from_file store cons doms file =
 	let channel = open_in file in
@@ -282,7 +282,7 @@
 			Store.mkdir store (Perms.Connection.create 0) localpath;
 
 		if cf.domain_init then (
-			let usingxiu = Xc.is_fake () in
+			let usingxiu = Xenctrl.is_fake () in
 			Connections.add_domain cons (Domains.create0 usingxiu domains);
 			Event.bind_dom_exc_virq eventchn
 		);
@@ -301,7 +301,7 @@
 		(if cf.domain_init then [ Event.fd eventchn ] else [])
 		in
 
-	let xc = Xc.interface_open () in
+	let xc = Xenctrl.interface_open () in
 
 	let process_special_fds rset =
 		let accept_connection can_write fd =

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

From xen-changelog-bounces@lists.xensource.com Tue Oct 11 06:23:17 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 11 Oct 2011 06:23:17 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RDcIf-0004yO-9z; Tue, 11 Oct 2011 06:23:17 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RDcHu-0004fl-7k
	for xen-changelog@lists.xensource.com; Tue, 11 Oct 2011 06:22:31 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-174.messagelabs.com!1318339346!34803674!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3789 invoked from network); 11 Oct 2011 13:22:27 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Oct 2011 13:22:27 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RDcHg-0001Dw-3u
	for xen-changelog@lists.xensource.com; Tue, 11 Oct 2011 14:22:16 +0100
Message-Id: <E1RDcHg-0001Dw-3u@xenbits.xen.org>
Date: Tue, 11 Oct 2011 14:22:05 +0100
From: Xen patchbot-linux-2.6.18-xen <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [linux-2.6.18-xen] blkback: Don't let in-flight
	requests defer pending ones
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 Daniel Stodden <daniel.stodden@citrix.com>
# Date 1318338490 -7200
# Node ID c7c14595c18b4ddc1a16e7b64352ba8ac21fbecf
# Parent  28740a325058c0c196ef22f59506710dc4ff4c55
blkback: Don't let in-flight requests defer pending ones

Running RING_FINAL_CHECK_FOR_REQUESTS from make_response is a bad
idea. It means that in-flight I/O is essentially blocking continued
batches. This essentially kills throughput on frontends which unplug
(or even just notify) early and rightfully assume additional requests
will be picked up on time, not synchronously.

Saw cache writeback going up from 45MB/s top 65MB/s for xen-blkfront
on ISCSI.

Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 28740a325058 -r c7c14595c18b drivers/xen/blkback/blkback.c
--- a/drivers/xen/blkback/blkback.c	Mon Oct 10 14:43:20 2011 +0200
+++ b/drivers/xen/blkback/blkback.c	Tue Oct 11 15:08:10 2011 +0200
@@ -309,7 +309,7 @@
  * DOWNWARD CALLS -- These interface with the block-device layer proper.
  */
 
-static int do_block_io_op(blkif_t *blkif)
+static int _do_block_io_op(blkif_t *blkif)
 {
 	blkif_back_rings_t *blk_rings = &blkif->blk_rings;
 	blkif_request_t req;
@@ -387,6 +387,23 @@
 	return more_to_do;
 }
 
+static int
+do_block_io_op(blkif_t *blkif)
+{
+	blkif_back_rings_t *blk_rings = &blkif->blk_rings;
+	int more_to_do;
+
+	do {
+		more_to_do = _do_block_io_op(blkif);
+		if (more_to_do)
+			break;
+
+		RING_FINAL_CHECK_FOR_REQUESTS(&blk_rings->common, more_to_do);
+	} while (more_to_do);
+
+	return more_to_do;
+}
+
 static void dispatch_rw_block_io(blkif_t *blkif,
 				 blkif_request_t *req,
 				 pending_req_t *pending_req)
@@ -577,7 +594,6 @@
 	blkif_response_t  resp;
 	unsigned long     flags;
 	blkif_back_rings_t *blk_rings = &blkif->blk_rings;
-	int more_to_do = 0;
 	int notify;
 
 	resp.id        = id;
@@ -604,22 +620,8 @@
 	}
 	blk_rings->common.rsp_prod_pvt++;
 	RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&blk_rings->common, notify);
-	if (blk_rings->common.rsp_prod_pvt == blk_rings->common.req_cons) {
-		/*
-		 * Tail check for pending requests. Allows frontend to avoid
-		 * notifications if requests are already in flight (lower
-		 * overheads and promotes batching).
-		 */
-		RING_FINAL_CHECK_FOR_REQUESTS(&blk_rings->common, more_to_do);
-
-	} else if (RING_HAS_UNCONSUMED_REQUESTS(&blk_rings->common)) {
-		more_to_do = 1;
-	}
-
 	spin_unlock_irqrestore(&blkif->blk_ring_lock, flags);
 
-	if (more_to_do)
-		blkif_notify_work(blkif);
 	if (notify)
 		notify_remote_via_irq(blkif->irq);
 }

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

From xen-changelog-bounces@lists.xensource.com Tue Oct 11 07:12:33 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 11 Oct 2011 07:12:33 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RDd4L-0000yG-Do; Tue, 11 Oct 2011 07:12:33 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RDd33-0000V8-1k
	for xen-changelog@lists.xensource.com; Tue, 11 Oct 2011 07:11:13 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-216.messagelabs.com!1318342270!558691!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13640 invoked from network); 11 Oct 2011 14:11:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Oct 2011 14:11:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RDd2z-0001qd-WA
	for xen-changelog@lists.xensource.com; Tue, 11 Oct 2011 15:11:09 +0100
Message-Id: <E1RDd2z-0001qd-WA@xenbits.xen.org>
Date: Tue, 11 Oct 2011 15:11:09 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: clear page content after
	evict
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 Olaf Hering <olaf@aepfle.de>
# Date 1318326388 -3600
# Node ID 1185ae04b5aad429fd68d1872f404791df627965
# Parent  b8b413d8b2df61b3b3184003ae660a18d01bbae3
xenpaging: clear page content after evict

If the guest happens to read from the gfn while xenpaging is in the process of
evicting the page, the guest may read zeros instead of actual data.
Also if eviction fails the page content will be corrupted and xenpaging wont
attempt to restore the page.

Remove page scrubbing from pager and do it after successful eviction.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r b8b413d8b2df -r 1185ae04b5aa tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Mon Oct 10 16:49:48 2011 +0100
+++ b/tools/xenpaging/xenpaging.c	Tue Oct 11 10:46:28 2011 +0100
@@ -455,9 +455,6 @@
         goto out;
     }
 
-    /* Clear page */
-    memset(page, 0, PAGE_SIZE);
-
     munmap(page, PAGE_SIZE);
 
     /* Tell Xen to evict page */
diff -r b8b413d8b2df -r 1185ae04b5aa xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Mon Oct 10 16:49:48 2011 +0100
+++ b/xen/arch/x86/mm/p2m.c	Tue Oct 11 10:46:28 2011 +0100
@@ -748,6 +748,9 @@
     set_p2m_entry(p2m, gfn, _mfn(INVALID_MFN), 0, p2m_ram_paged, a);
     audit_p2m(p2m, 1);
 
+    /* Clear content before returning the page to Xen */
+    scrub_one_page(page);
+
     /* Put the page back so it gets freed */
     put_page(page);
 

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

From xen-changelog-bounces@lists.xensource.com Tue Oct 11 16:46:04 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 11 Oct 2011 16:46:04 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RDm1M-0002TK-6U; Tue, 11 Oct 2011 16:46:04 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RDlza-0001wF-8u
	for xen-changelog@lists.xensource.com; Tue, 11 Oct 2011 16:44:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-27.messagelabs.com!1318376640!50590213!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20057 invoked from network); 11 Oct 2011 23:44:00 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Oct 2011 23:44:00 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RDlzW-0004DY-MY
	for xen-changelog@lists.xensource.com; Wed, 12 Oct 2011 00:44:10 +0100
Message-Id: <E1RDlzW-0004DY-MY@xenbits.xen.org>
Date: Wed, 12 Oct 2011 00:44:09 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] pygrub: add debug flag
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 Guido Gunther <agx@sigxcpu.org>
# Date 1318330978 -3600
# Node ID 4b0907c6a08c348962bd976c2976257b412408be
# Parent  1185ae04b5aad429fd68d1872f404791df627965
pygrub: add debug flag

Debugging config file errors is tedious so help a bit by not silently
dropping parsing exceptions when --debug is given. Also intialize the
logging API at debug level in this case.

Signed-off-by: Guido Gunther <agx@sigxcpu.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 1185ae04b5aa -r 4b0907c6a08c tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub	Tue Oct 11 10:46:28 2011 +0100
+++ b/tools/pygrub/src/pygrub	Tue Oct 11 12:02:58 2011 +0100
@@ -13,7 +13,7 @@
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #
 
-import os, sys, string, struct, tempfile, re
+import os, sys, string, struct, tempfile, re, traceback
 import copy
 import logging
 import platform
@@ -665,7 +665,7 @@
                                    ["quiet", "interactive", "not-really", "help", 
                                     "output=", "output-format=", "output-directory=",
                                     "entry=", "kernel=", 
-                                    "ramdisk=", "args=", "isconfig"])
+                                    "ramdisk=", "args=", "isconfig", "debug"])
     except getopt.GetoptError:
         usage()
         sys.exit(1)
@@ -679,6 +679,7 @@
     entry = None
     interactive = True
     isconfig = False
+    debug = False
     not_really = False
     output_format = "sxp"
     output_directory = "/var/run/xend/boot"
@@ -714,6 +715,8 @@
             interactive = False
         elif o in ("--isconfig",):
             isconfig = True
+        elif o in ("--debug",):
+            debug = True
         elif o in ("--output-format",):
             if a not in ["sxp", "simple", "simple0"]:
                 print "unkonwn output format %s" % a
@@ -723,6 +726,9 @@
         elif o in ("--output-directory",):
             output_directory = a
 
+    if debug:
+	logging.basicConfig(level=logging.DEBUG)
+
     if output is None or output == "-":
         fd = sys.stdout.fileno()
     else:
@@ -769,6 +775,8 @@
         except:
             # IOErrors raised by fsimage.open
             # RuntimeErrors raised by run_grub if no menu.lst present
+            if debug:
+		traceback.print_exc()
             fs = None
             continue
 

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 13 00:44:11 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 13 Oct 2011 00:44:11 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1REFxb-0000rA-Sd; Thu, 13 Oct 2011 00:44:11 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1REFxY-0000q7-JU
	for xen-changelog@lists.xensource.com; Thu, 13 Oct 2011 00:44:08 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1318491826!46439055!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5803 invoked from network); 13 Oct 2011 07:43:47 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Oct 2011 07:43:47 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1REFxV-0002gC-Dn
	for xen-changelog@lists.xensource.com; Thu, 13 Oct 2011 08:44:05 +0100
Message-Id: <E1REFxV-0002gC-Dn@xenbits.xen.org>
Date: Thu, 13 Oct 2011 08:44:05 +0100
From: Xen patchbot-linux-2.6.18-xen <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [linux-2.6.18-xen] streamline clearing of memory in
	a few places
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 Jan Beulich <jbeulich@suse.com>
# Date 1318491236 -7200
# Node ID e8e3b1247124e6e9ae603a7f8ed845ebb2b28171
# Parent  f4a4962d40e425e13af4401e0f44141f82828064
streamline clearing of memory in a few places

- use kzalloc() in favor of kmalloc()+memset() in one more spot
- use clear_page() in favor of memset(, 0, PAGE_SIZE) (also use
  copy_page() in favor of memcpy(, , PAGE_SIZE))
- don't redundantly clear memory

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r f4a4962d40e4 -r e8e3b1247124 arch/i386/mm/init-xen.c
--- a/arch/i386/mm/init-xen.c	Thu Oct 13 09:30:50 2011 +0200
+++ b/arch/i386/mm/init-xen.c	Thu Oct 13 09:33:56 2011 +0200
@@ -558,7 +558,7 @@
 	 * dummy page. */
 	set_fixmap(FIX_SHARED_INFO, xen_start_info->shared_info);
 	HYPERVISOR_shared_info = (shared_info_t *)fix_to_virt(FIX_SHARED_INFO);
-	memset(empty_zero_page, 0, sizeof(empty_zero_page));
+	clear_page(empty_zero_page);
 
 	/* Setup mapping of lower 1st MB */
 	for (i = 0; i < NR_FIX_ISAMAPS; i++)
diff -r f4a4962d40e4 -r e8e3b1247124 arch/x86_64/mm/init-xen.c
--- a/arch/x86_64/mm/init-xen.c	Thu Oct 13 09:30:50 2011 +0200
+++ b/arch/x86_64/mm/init-xen.c	Thu Oct 13 09:33:56 2011 +0200
@@ -218,7 +218,7 @@
 	else if (start_pfn < table_end) {
 		ptr = __va(start_pfn << PAGE_SHIFT);
 		start_pfn++;
-		memset(ptr, 0, PAGE_SIZE);
+		clear_page(ptr);
 	} else
 		ptr = alloc_bootmem_pages(PAGE_SIZE);
 	if (!ptr || ((unsigned long)ptr & ~PAGE_MASK))
@@ -376,7 +376,7 @@
 
 	*phys = start_pfn << PAGE_SHIFT;
 	start_pfn++;
-	memset((void *)va, 0, PAGE_SIZE);
+	clear_page((void *)va);
 	return (void *)va;
 } 
 
@@ -728,7 +728,7 @@
 	/* Switch to the real shared_info page, and clear the dummy page. */
 	set_fixmap(FIX_SHARED_INFO, xen_start_info->shared_info);
 	HYPERVISOR_shared_info = (shared_info_t *)fix_to_virt(FIX_SHARED_INFO);
-	memset(empty_zero_page, 0, sizeof(empty_zero_page));
+	clear_page(empty_zero_page);
 
 	/* Set up mapping of lowest 1MB of physical memory. */
 	for (i = 0; i < NR_FIX_ISAMAPS; i++)
diff -r f4a4962d40e4 -r e8e3b1247124 drivers/xen/core/gnttab.c
--- a/drivers/xen/core/gnttab.c	Thu Oct 13 09:30:50 2011 +0200
+++ b/drivers/xen/core/gnttab.c	Thu Oct 13 09:33:56 2011 +0200
@@ -543,7 +543,7 @@
 
 	new_addr = page_address(new_page);
 	addr = page_address(page);
-	memcpy(new_addr, addr, PAGE_SIZE);
+	copy_page(new_addr, addr);
 
 	pfn = page_to_pfn(page);
 	mfn = pfn_to_mfn(pfn);
diff -r f4a4962d40e4 -r e8e3b1247124 drivers/xen/core/machine_reboot.c
--- a/drivers/xen/core/machine_reboot.c	Thu Oct 13 09:30:50 2011 +0200
+++ b/drivers/xen/core/machine_reboot.c	Thu Oct 13 09:33:56 2011 +0200
@@ -89,7 +89,7 @@
 		BUG();
 	HYPERVISOR_shared_info = (shared_info_t *)fix_to_virt(FIX_SHARED_INFO);
 
-	memset(empty_zero_page, 0, PAGE_SIZE);
+	clear_page(empty_zero_page);
 
 	fpp = PAGE_SIZE/sizeof(unsigned long);
 	for (i = 0, j = 0, k = -1; i < max_pfn; i += fpp, j++) {
diff -r f4a4962d40e4 -r e8e3b1247124 drivers/xen/core/smpboot.c
--- a/drivers/xen/core/smpboot.c	Thu Oct 13 09:30:50 2011 +0200
+++ b/drivers/xen/core/smpboot.c	Thu Oct 13 09:33:56 2011 +0200
@@ -198,17 +198,12 @@
 	ctxt.flags = VGCF_IN_KERNEL;
 	ctxt.user_regs.ds = __USER_DS;
 	ctxt.user_regs.es = __USER_DS;
-	ctxt.user_regs.fs = 0;
-	ctxt.user_regs.gs = 0;
 	ctxt.user_regs.ss = __KERNEL_DS;
 	ctxt.user_regs.eip = (unsigned long)cpu_bringup_and_idle;
 	ctxt.user_regs.eflags = X86_EFLAGS_IF | 0x1000; /* IOPL_RING1 */
 
-	memset(&ctxt.fpu_ctxt, 0, sizeof(ctxt.fpu_ctxt));
-
 	smp_trap_init(ctxt.trap_ctxt);
 
-	ctxt.ldt_ents = 0;
 
 	ctxt.gdt_frames[0] = virt_to_mfn(gdt_descr->address);
 	ctxt.gdt_ents      = gdt_descr->size / 8;
diff -r f4a4962d40e4 -r e8e3b1247124 drivers/xen/netback/interface.c
--- a/drivers/xen/netback/interface.c	Thu Oct 13 09:30:50 2011 +0200
+++ b/drivers/xen/netback/interface.c	Thu Oct 13 09:33:56 2011 +0200
@@ -236,7 +236,6 @@
 	SET_NETDEV_DEV(dev, parent);
 
 	netif = netdev_priv(dev);
-	memset(netif, 0, sizeof(*netif));
 	netif->domid  = domid;
 	netif->handle = handle;
 	netif->can_sg = 1;
diff -r f4a4962d40e4 -r e8e3b1247124 drivers/xen/sfc_netutil/accel_cuckoo_hash.c
--- a/drivers/xen/sfc_netutil/accel_cuckoo_hash.c	Thu Oct 13 09:30:50 2011 +0200
+++ b/drivers/xen/sfc_netutil/accel_cuckoo_hash.c	Thu Oct 13 09:33:56 2011 +0200
@@ -76,7 +76,7 @@
 	BUG_ON(length_bits >= sizeof(unsigned) * 8);
 	BUG_ON(key_length > sizeof(cuckoo_hash_key));
 
-	table_mem = kmalloc(sizeof(cuckoo_hash_entry) * 2 * length, GFP_KERNEL);
+	table_mem = kzalloc(sizeof(cuckoo_hash_entry) * 2 * length, GFP_KERNEL);
 
 	if (table_mem == NULL)
 		return -ENOMEM;
@@ -92,9 +92,6 @@
 
 	set_hash_parameters(hashtab);
 
-	/* Zero the table */
-	memset(hashtab->table0, 0, length * 2 * sizeof(cuckoo_hash_entry));
-
 	return 0;
 }
 EXPORT_SYMBOL_GPL(cuckoo_hash_init);
diff -r f4a4962d40e4 -r e8e3b1247124 drivers/xen/tpmback/interface.c
--- a/drivers/xen/tpmback/interface.c	Thu Oct 13 09:30:50 2011 +0200
+++ b/drivers/xen/tpmback/interface.c	Thu Oct 13 09:33:56 2011 +0200
@@ -93,7 +93,7 @@
 	tpmif->tx_area = area;
 
 	tpmif->tx = (tpmif_tx_interface_t *)area->addr;
-	memset(tpmif->tx, 0, PAGE_SIZE);
+	clear_page(tpmif->tx);
 
 	err = bind_interdomain_evtchn_to_irqhandler(
 		tpmif->domid, evtchn, tpmif_be_int, 0, tpmif->devname, tpmif);

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 13 00:44:17 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 13 Oct 2011 00:44:17 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1REFxh-0000u1-5j; Thu, 13 Oct 2011 00:44:17 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1REFxY-0000qA-Tp
	for xen-changelog@lists.xensource.com; Thu, 13 Oct 2011 00:44:09 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-174.messagelabs.com!1318491845!28719312!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21156 invoked from network); 13 Oct 2011 07:44:05 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Oct 2011 07:44:05 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1REFxU-0002fH-V9
	for xen-changelog@lists.xensource.com; Thu, 13 Oct 2011 08:44:05 +0100
Message-Id: <E1REFxU-0002fH-V9@xenbits.xen.org>
Date: Thu, 13 Oct 2011 08:44:04 +0100
From: Xen patchbot-linux-2.6.18-xen <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [linux-2.6.18-xen] improve floppy behavior
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 Jan Beulich <jbeulich@suse.com>
# Date 1318491050 -7200
# Node ID f4a4962d40e425e13af4401e0f44141f82828064
# Parent  c7c14595c18b4ddc1a16e7b64352ba8ac21fbecf
improve floppy behavior

Timing is significantly different from native both because Xen traps
I/O port accesses and since DMA use is not possible (without intrusive
changes). Due to the overhead of trapped port accesses, I/O is already
slow enough (and Xen doesn't run on very old hardware anyway), so the
situation can easily be improved by not enforcing REALLY_SLOW_IO.

This doesn't completely address the issue - Xen just cannot guarantee
scheduling of a particular vCPU with a maximum latency of about 80us
(needed for the default FIFO threshold value of 10). The only complete
solution would require making ISA DMA usable on Xen.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r c7c14595c18b -r f4a4962d40e4 drivers/block/floppy.c
--- a/drivers/block/floppy.c	Tue Oct 11 15:08:10 2011 +0200
+++ b/drivers/block/floppy.c	Thu Oct 13 09:30:50 2011 +0200
@@ -146,7 +146,9 @@
 #define FLOPPY_SANITY_CHECK
 #undef  FLOPPY_SILENT_DCL_CLEAR
 
+#ifndef CONFIG_XEN
 #define REALLY_SLOW_IO
+#endif
 
 #define DEBUGT 2
 #define DCL_DEBUG		/* debug disk change line */

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 13 00:44:23 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 13 Oct 2011 00:44:23 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1REFxn-0000xC-Iw; Thu, 13 Oct 2011 00:44:23 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1REFxY-0000qD-W8
	for xen-changelog@lists.xensource.com; Thu, 13 Oct 2011 00:44:09 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-216.messagelabs.com!1318491845!813506!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24550 invoked from network); 13 Oct 2011 07:44:05 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Oct 2011 07:44:05 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1REFxV-0002gg-Q3
	for xen-changelog@lists.xensource.com; Thu, 13 Oct 2011 08:44:05 +0100
Message-Id: <E1REFxV-0002gg-Q3@xenbits.xen.org>
Date: Thu, 13 Oct 2011 08:44:05 +0100
From: Xen patchbot-linux-2.6.18-xen <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [linux-2.6.18-xen] don't build firmware bits for
	non-privileged 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 Jan Beulich <jbeulich@suse.com>
# Date 1318491350 -7200
# Node ID a2c506341809d358a65fee1486f76b6152325e8d
# Parent  e8e3b1247124e6e9ae603a7f8ed845ebb2b28171
don't build firmware bits for non-privileged kernel

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r e8e3b1247124 -r a2c506341809 arch/i386/Kconfig
--- a/arch/i386/Kconfig	Thu Oct 13 09:33:56 2011 +0200
+++ b/arch/i386/Kconfig	Thu Oct 13 09:35:50 2011 +0200
@@ -452,7 +452,9 @@
 	bool
 	default n
 
+if !XEN_UNPRIVILEGED_GUEST
 source "drivers/firmware/Kconfig"
+endif
 
 choice
 	prompt "High Memory Support"
diff -r e8e3b1247124 -r a2c506341809 arch/x86_64/Kconfig
--- a/arch/x86_64/Kconfig	Thu Oct 13 09:33:56 2011 +0200
+++ b/arch/x86_64/Kconfig	Thu Oct 13 09:35:50 2011 +0200
@@ -682,7 +682,9 @@
 
 source drivers/Kconfig
 
+if !XEN_UNPRIVILEGED_GUEST
 source "drivers/firmware/Kconfig"
+endif
 
 source fs/Kconfig
 
diff -r e8e3b1247124 -r a2c506341809 drivers/xen/core/Makefile
--- a/drivers/xen/core/Makefile	Thu Oct 13 09:33:56 2011 +0200
+++ b/drivers/xen/core/Makefile	Thu Oct 13 09:35:50 2011 +0200
@@ -2,9 +2,10 @@
 # Makefile for the linux kernel.
 #
 
-obj-y := evtchn.o gnttab.o features.o reboot.o machine_reboot.o firmware.o
+obj-y := evtchn.o gnttab.o features.o reboot.o machine_reboot.o
 
 obj-$(CONFIG_PCI)		+= pci.o
+obj-$(CONFIG_XEN_PRIVILEGED_GUEST) += firmware.o
 obj-$(CONFIG_PROC_FS)		+= xen_proc.o
 obj-$(CONFIG_SYS_HYPERVISOR)	+= hypervisor_sysfs.o
 obj-$(CONFIG_HOTPLUG_CPU)	+= cpu_hotplug.o
diff -r e8e3b1247124 -r a2c506341809 include/xen/firmware.h
--- a/include/xen/firmware.h	Thu Oct 13 09:33:56 2011 +0200
+++ b/include/xen/firmware.h	Thu Oct 13 09:35:50 2011 +0200
@@ -5,6 +5,10 @@
 void copy_edd(void);
 #endif
 
+#ifdef CONFIG_XEN_PRIVILEGED_GUEST
 void copy_edid(void);
+#else
+static inline void copy_edid(void) {}
+#endif
 
 #endif /* __XEN_FIRMWARE_H__ */

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 13 00:44:32 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 13 Oct 2011 00:44:32 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1REFxw-00010U-CV; Thu, 13 Oct 2011 00:44:32 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1REFxZ-0000qG-EH
	for xen-changelog@lists.xensource.com; Thu, 13 Oct 2011 00:44:09 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-174.messagelabs.com!1318491846!35055544!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15578 invoked from network); 13 Oct 2011 07:44:06 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-11.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Oct 2011 07:44:06 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1REFxW-0002hB-5v
	for xen-changelog@lists.xensource.com; Thu, 13 Oct 2011 08:44:06 +0100
Message-Id: <E1REFxW-0002hB-5v@xenbits.xen.org>
Date: Thu, 13 Oct 2011 08:44:05 +0100
From: Xen patchbot-linux-2.6.18-xen <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [linux-2.6.18-xen] x86-64/MCE: eliminate redundant
	setting of interface version
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 Jan Beulich <jbeulich@suse.com>
# Date 1318491470 -7200
# Node ID 54973d463417845c3272dc875f45a0ac6ab3594c
# Parent  a2c506341809d358a65fee1486f76b6152325e8d
x86-64/MCE: eliminate redundant setting of interface version

This already gets done in HYPERVISOR_mca().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r a2c506341809 -r 54973d463417 arch/x86_64/kernel/mce_dom0.c
--- a/arch/x86_64/kernel/mce_dom0.c	Thu Oct 13 09:35:50 2011 +0200
+++ b/arch/x86_64/kernel/mce_dom0.c	Thu Oct 13 09:37:50 2011 +0200
@@ -61,7 +61,6 @@
 
 	printk(KERN_DEBUG "MCE_DOM0_LOG: enter dom0 mce vIRQ handler\n");
 	mc_op.cmd = XEN_MC_fetch;
-	mc_op.interface_version = XEN_MCA_INTERFACE_VERSION;
 	set_xen_guest_handle(mc_op.u.mc_fetch.data, g_mi);
 urgent:
 	mc_op.u.mc_fetch.flags = XEN_MC_URGENT;

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 14 10:02:21 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 14 Oct 2011 10:02:21 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1REl9H-0003XC-8r; Fri, 14 Oct 2011 10:02:19 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1REl7I-0003Sq-9J
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 10:00:28 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-21.messagelabs.com!1318611611!173935!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21197 invoked from network); 14 Oct 2011 17:00:11 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Oct 2011 17:00:11 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1REl7C-0007Ec-Su
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 18:00:10 +0100
Message-Id: <E1REl7C-0007Ec-Su@xenbits.xen.org>
Date: Fri, 14 Oct 2011 18:00:10 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: fixup incorrect indentation
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 Ian Campbell <ian.campbell@citrix.com>
# Date 1318340047 -3600
# Node ID e65977f3fa8667d31f4885318abdf9c6ffed4eec
# Parent  c5f8c3597cae4e3122ba067a33da28735630c9bb
libxl: fixup incorrect indentation

Several places which were previsously indented using hard tabs are now
incorrectly indented. Fix them up.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r c5f8c3597cae -r e65977f3fa86 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Oct 11 14:26:00 2011 +0100
+++ b/tools/libxl/libxl.c	Tue Oct 11 14:34:07 2011 +0100
@@ -696,13 +696,13 @@
     sscanf(backend,
             "/local/domain/%d/backend/%" TOSTRING(BACKEND_STRING_SIZE) "[a-z]/%*d/%*d",
             &disk->backend_domid, backend_type);
-        if (!strcmp(backend_type, "tap") || !strcmp(backend_type, "vbd")) {
-                disk->backend = LIBXL_DISK_BACKEND_TAP;
-        } else if (!strcmp(backend_type, "qdisk")) {
-                disk->backend = LIBXL_DISK_BACKEND_QDISK;
-        } else {
-                disk->backend = LIBXL_DISK_BACKEND_UNKNOWN;
-        }
+    if (!strcmp(backend_type, "tap") || !strcmp(backend_type, "vbd")) {
+        disk->backend = LIBXL_DISK_BACKEND_TAP;
+    } else if (!strcmp(backend_type, "qdisk")) {
+        disk->backend = LIBXL_DISK_BACKEND_QDISK;
+    } else {
+        disk->backend = LIBXL_DISK_BACKEND_UNKNOWN;
+    }
 
     disk->pdev_path = strdup("");
     disk->format = LIBXL_DISK_FORMAT_EMPTY;
diff -r c5f8c3597cae -r e65977f3fa86 tools/libxl/libxl_bootloader.c
--- a/tools/libxl/libxl_bootloader.c	Tue Oct 11 14:26:00 2011 +0100
+++ b/tools/libxl/libxl_bootloader.c	Tue Oct 11 14:34:07 2011 +0100
@@ -81,14 +81,14 @@
 
     ret = openpty(master, slave, NULL, NULL, NULL);
     if (ret < 0)
-            return -1;
+        return -1;
 
     ret = ttyname_r(*slave, slave_path, slave_path_len);
     if (ret == -1) {
-            close(*master);
-            close(*slave);
-            *master = *slave = -1;
-            return -1;
+        close(*master);
+        close(*slave);
+        *master = *slave = -1;
+        return -1;
     }
 
     /*
diff -r c5f8c3597cae -r e65977f3fa86 tools/libxl/libxl_internal.c
--- a/tools/libxl/libxl_internal.c	Tue Oct 11 14:26:00 2011 +0100
+++ b/tools/libxl/libxl_internal.c	Tue Oct 11 14:34:07 2011 +0100
@@ -228,53 +228,53 @@
 
 int libxl__file_reference_map(libxl_file_reference *f)
 {
-        struct stat st_buf;
-        int ret, fd;
-        void *data;
+    struct stat st_buf;
+    int ret, fd;
+    void *data;
 
-        if (f->mapped)
-                return 0;
+    if (f->mapped)
+        return 0;
 
-        fd = open(f->path, O_RDONLY);
-        if (f < 0)
-                return ERROR_FAIL;
+    fd = open(f->path, O_RDONLY);
+    if (f < 0)
+        return ERROR_FAIL;
 
-        ret = fstat(fd, &st_buf);
-        if (ret < 0)
-                goto out;
+    ret = fstat(fd, &st_buf);
+    if (ret < 0)
+        goto out;
 
-        ret = -1;
-        data = mmap(NULL, st_buf.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
-        if (data == NULL)
-                goto out;
+    ret = -1;
+    data = mmap(NULL, st_buf.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
+    if (data == NULL)
+        goto out;
 
-        f->mapped = 1;
-        f->data = data;
-        f->size = st_buf.st_size;
+    f->mapped = 1;
+    f->data = data;
+    f->size = st_buf.st_size;
 
-        ret = 0;
+    ret = 0;
 out:
-        close(fd);
+    close(fd);
 
-        return ret == 0 ? 0 : ERROR_FAIL;
+    return ret == 0 ? 0 : ERROR_FAIL;
 }
 
 int libxl__file_reference_unmap(libxl_file_reference *f)
 {
-        int ret;
+    int ret;
 
-        if (!f->mapped)
-                return 0;
+    if (!f->mapped)
+        return 0;
 
-        ret = munmap(f->data, f->size);
-        if (ret == 0) {
-                f->mapped = 0;
-                f->data = NULL;
-                f->size = 0;
-                return 0;
-        }
+    ret = munmap(f->data, f->size);
+    if (ret == 0) {
+        f->mapped = 0;
+        f->data = NULL;
+        f->size = 0;
+        return 0;
+    }
 
-        return ERROR_FAIL;
+    return ERROR_FAIL;
 }
 
 _hidden int libxl__parse_mac(const char *s, libxl_mac mac)
diff -r c5f8c3597cae -r e65977f3fa86 tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c	Tue Oct 11 14:26:00 2011 +0100
+++ b/tools/libxl/libxl_pci.c	Tue Oct 11 14:34:07 2011 +0100
@@ -1113,7 +1113,7 @@
         if ((src[i].type == E820_RAM) ||
             (src[i].type == E820_UNUSABLE) ||
             (src[i].type == 0))
-                continue;
+            continue;
 
         start = src[i].addr < start ? src[i].addr : start;
         last = src[i].addr + src[i].size > last ?
diff -r c5f8c3597cae -r e65977f3fa86 tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c	Tue Oct 11 14:26:00 2011 +0100
+++ b/tools/libxl/libxl_utils.c	Tue Oct 11 14:34:07 2011 +0100
@@ -457,7 +457,7 @@
 
     rc = libxl__parse_mac(mac, mac_n);
     if (rc)
-            return rc;
+        return rc;
 
     nics = libxl_list_nics(ctx, domid, &nb);
     if (!nics)
@@ -509,7 +509,7 @@
     val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/mac", nic_path_fe));
     rc = libxl__parse_mac(val, nic->mac);
     if (rc)
-            goto out;
+        goto out;
 
     nic->script = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "%s/script", nic_path_be), NULL);
     rc = 0;

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 14 10:02:51 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 14 Oct 2011 10:02:51 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1REl9m-0003aL-0W; Fri, 14 Oct 2011 10:02:50 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1REl7M-0003T8-Me
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 10:00:28 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1318611617!35304887!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7206 invoked from network); 14 Oct 2011 17:00:17 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Oct 2011 17:00:17 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1REl7J-0007LQ-Eh
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 18:00:17 +0100
Message-Id: <E1REl7J-0007LQ-Eh@xenbits.xen.org>
Date: Fri, 14 Oct 2011 18:00:16 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] cpufreq: error path fixes
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 Jan Beulich <jbeulich@suse.com>
# Date 1318580154 -7200
# Node ID de316831471a8e0f11f615e7bf336dee2ba811e7
# Parent  a65693f9fb1250ff4819774a70284693705db9e7
cpufreq: error path fixes

This fixes an actual bug (failure to exit from a function after an
allocation failure), an inconsistency (not removing the cpufreq_dom
list member upon failure), and a latent bug (not clearing the current
governor upon governor initialization failure when there was no old
one; latent because the only current code path leading to this
situation frees the policy upon failure and hence the governor not
getting cleared is benign).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r a65693f9fb12 -r de316831471a xen/drivers/cpufreq/cpufreq.c
--- a/xen/drivers/cpufreq/cpufreq.c	Thu Oct 13 15:59:22 2011 +0100
+++ b/xen/drivers/cpufreq/cpufreq.c	Fri Oct 14 10:15:54 2011 +0200
@@ -176,8 +176,10 @@
 
     if (!domexist || hw_all) {
         policy = xzalloc(struct cpufreq_policy);
-        if (!policy)
+        if (!policy) {
             ret = -ENOMEM;
+            goto err0;
+        }
 
         policy->cpu = cpu;
         per_cpu(cpufreq_cpu_policy, cpu) = policy;
@@ -186,7 +188,7 @@
         if (ret) {
             xfree(policy);
             per_cpu(cpufreq_cpu_policy, cpu) = NULL;
-            return ret;
+            goto err0;
         }
         if (cpufreq_verbose)
             printk("CPU %u initialization completed\n", cpu);
@@ -243,7 +245,7 @@
         cpufreq_driver->exit(policy);
         xfree(policy);
     }
-
+err0:
     if (cpus_empty(cpufreq_dom->map)) {
         list_del(&cpufreq_dom->node);
         xfree(cpufreq_dom);
diff -r a65693f9fb12 -r de316831471a xen/drivers/cpufreq/utility.c
--- a/xen/drivers/cpufreq/utility.c	Thu Oct 13 15:59:22 2011 +0100
+++ b/xen/drivers/cpufreq/utility.c	Fri Oct 14 10:15:54 2011 +0200
@@ -458,8 +458,8 @@
                                  data->governor->name);
 
             /* new governor failed, so re-start old one */
+            data->governor = old_gov;
             if (old_gov) {
-                data->governor = old_gov;
                 __cpufreq_governor(data, CPUFREQ_GOV_START);
                 printk(KERN_WARNING "Still stay at %s governor\n",
                                      data->governor->name);

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 14 10:03:16 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 14 Oct 2011 10:03:16 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RElAA-0003eB-Qk; Fri, 14 Oct 2011 10:03:15 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1REl7L-0003T3-NM
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 10:00:28 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-174.messagelabs.com!1318611616!28971530!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3091 invoked from network); 14 Oct 2011 17:00:16 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Oct 2011 17:00:16 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1REl7I-0007K5-Df
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 18:00:16 +0100
Message-Id: <E1REl7I-0007K5-Df@xenbits.xen.org>
Date: Fri, 14 Oct 2011 18:00:15 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: Further fixes for xsave leaf in
	pv_cpuid().
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 Shan Haitao <haitao.shan@intel.com>
# Date 1318517935 -3600
# Node ID bbde1453cbd95d6d36febe9c552f9cfa26b5c49e
# Parent  c1bd53fac3d5e5868352894d62dbacd6de0b0e7a
x86: Further fixes for xsave leaf in pv_cpuid().

Signed-off-by: Shan Haitao <haitao.shan@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r c1bd53fac3d5 -r bbde1453cbd9 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c	Thu Oct 13 12:21:10 2011 +0100
+++ b/xen/arch/x86/traps.c	Thu Oct 13 15:58:55 2011 +0100
@@ -768,16 +768,18 @@
 
     if ( current->domain->domain_id != 0 )
     {
+        unsigned int cpuid_leaf = a, sub_leaf = c;
+
         if ( !cpuid_hypervisor_leaves(a, c, &a, &b, &c, &d) )
             domain_cpuid(current->domain, a, c, &a, &b, &c, &d);
 
-        switch ( a )
+        switch ( cpuid_leaf )
         {
         case 0xd:
         {
-            unsigned int sub_leaf, _eax, _ebx, _ecx, _edx;
+            unsigned int _eax, _ebx, _ecx, _edx;
             /* EBX value of main leaf 0 depends on enabled xsave features */
-            if ( c == 0 && current->arch.xcr0 )
+            if ( sub_leaf == 0 && current->arch.xcr0 )
             {
                 /* reset EBX to default value first */
                 b = XSTATE_AREA_MIN_SIZE;
@@ -785,8 +787,8 @@
                 {
                     if ( !(current->arch.xcr0 & (1ULL << sub_leaf)) )
                         continue;
-                    domain_cpuid(current->domain, a, c, &_eax, &_ebx, &_ecx,
-                                 &_edx);
+                    domain_cpuid(current->domain, cpuid_leaf, sub_leaf,
+                                 &_eax, &_ebx, &_ecx, &_edx);
                     if ( (_eax + _ebx) > b )
                         b = _eax + _ebx;
                 }

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 14 10:03:42 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 14 Oct 2011 10:03:42 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RElAa-0003hO-DQ; Fri, 14 Oct 2011 10:03:40 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1REl7J-0003Su-Gp
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 10:00:28 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-21.messagelabs.com!1318611614!146269!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13166 invoked from network); 14 Oct 2011 17:00:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Oct 2011 17:00:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1REl7G-0007HL-8D
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 18:00:14 +0100
Message-Id: <E1REl7G-0007HL-8D@xenbits.xen.org>
Date: Fri, 14 Oct 2011 18:00:13 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xmalloc: return unused full pages on
	multi-page allocations
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 Jan Beulich <jbeulich@suse.com>
# Date 1318493023 -7200
# Node ID 8c1e7830112f5bc57c3539c3c1e7eb3ca3539f1f
# Parent  46ca8ea42d4c674e0792e792300710afec3f6e24
xmalloc: return unused full pages on multi-page allocations

Certain (boot time) allocations are relatively large (particularly when
building with high NR_CPUS), but can also happen to be pretty far away
from a power-of-two size. Utilize the page allocator's (other than
Linux'es) capability of allowing to return space from higher-order
allocations in smaller pieces to return the unused parts immediately.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r 46ca8ea42d4c -r 8c1e7830112f xen/common/xmalloc_tlsf.c
--- a/xen/common/xmalloc_tlsf.c	Thu Oct 13 10:02:34 2011 +0200
+++ b/xen/common/xmalloc_tlsf.c	Thu Oct 13 10:03:43 2011 +0200
@@ -527,13 +527,21 @@
 static void *xmalloc_whole_pages(unsigned long size)
 {
     struct bhdr *b;
-    unsigned int pageorder = get_order_from_bytes(size + BHDR_OVERHEAD);
+    unsigned int i, pageorder = get_order_from_bytes(size + BHDR_OVERHEAD);
+    char *p;
 
     b = alloc_xenheap_pages(pageorder, 0);
     if ( b == NULL )
         return NULL;
 
-    b->size = (1 << (pageorder + PAGE_SHIFT));
+    b->size = PAGE_ALIGN(size + BHDR_OVERHEAD);
+    for ( p = (char *)b + b->size, i = 0; i < pageorder; ++i )
+        if ( (unsigned long)p & (PAGE_SIZE << i) )
+        {
+            free_xenheap_pages(p, i);
+            p += PAGE_SIZE << i;
+        }
+
     return (void *)b->ptr.buffer;
 }
 
@@ -611,7 +619,20 @@
     }
 
     if ( b->size >= PAGE_SIZE )
-        free_xenheap_pages((void *)b, get_order_from_bytes(b->size));
+    {
+        unsigned int i, order = get_order_from_bytes(b->size);
+
+        BUG_ON((unsigned long)b & ((PAGE_SIZE << order) - 1));
+        for ( i = 0; ; ++i )
+        {
+            if ( !(b->size & (PAGE_SIZE << i)) )
+                continue;
+            b->size -= PAGE_SIZE << i;
+            free_xenheap_pages((void *)b + b->size, i);
+            if ( i + 1 >= order )
+                break;
+        }
+    }
     else
         xmem_pool_free(p, xenpool);
 }

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 14 10:04:09 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 14 Oct 2011 10:04:09 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RElB2-0003ky-Id; Fri, 14 Oct 2011 10:04:08 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1REl7F-0003So-L6
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 10:00:28 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-174.messagelabs.com!1318611610!35319633!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31635 invoked from network); 14 Oct 2011 17:00:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Oct 2011 17:00:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1REl7C-0007EA-3h
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 18:00:10 +0100
Message-Id: <E1REl7C-0007EA-3h@xenbits.xen.org>
Date: Fri, 14 Oct 2011 18:00:09 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: expand hard tab stops
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 Ian Campbell <ian.campbell@citrix.com>
# Date 1318339560 -3600
# Node ID c5f8c3597cae4e3122ba067a33da28735630c9bb
# Parent  4b0907c6a08c348962bd976c2976257b412408be
libxl: expand hard tab stops

I ran the following and committed the result. ^I is an actual hard tab

for i in $(grep -l --exclude=*_[ly].\[ch\] '^I' tools/libxl/*.[ch]) ; do
     cat $i | expand | sponge $i
done

There are some actually wrong indentations too, I'll fix those up
manually.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 4b0907c6a08c -r c5f8c3597cae tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Oct 11 12:02:58 2011 +0100
+++ b/tools/libxl/libxl.c	Tue Oct 11 14:26:00 2011 +0100
@@ -696,13 +696,13 @@
     sscanf(backend,
             "/local/domain/%d/backend/%" TOSTRING(BACKEND_STRING_SIZE) "[a-z]/%*d/%*d",
             &disk->backend_domid, backend_type);
-	if (!strcmp(backend_type, "tap") || !strcmp(backend_type, "vbd")) {
-		disk->backend = LIBXL_DISK_BACKEND_TAP;
-	} else if (!strcmp(backend_type, "qdisk")) {
-		disk->backend = LIBXL_DISK_BACKEND_QDISK;
-	} else {
-		disk->backend = LIBXL_DISK_BACKEND_UNKNOWN;
-	}
+        if (!strcmp(backend_type, "tap") || !strcmp(backend_type, "vbd")) {
+                disk->backend = LIBXL_DISK_BACKEND_TAP;
+        } else if (!strcmp(backend_type, "qdisk")) {
+                disk->backend = LIBXL_DISK_BACKEND_QDISK;
+        } else {
+                disk->backend = LIBXL_DISK_BACKEND_UNKNOWN;
+        }
 
     disk->pdev_path = strdup("");
     disk->format = LIBXL_DISK_FORMAT_EMPTY;
diff -r 4b0907c6a08c -r c5f8c3597cae tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Oct 11 12:02:58 2011 +0100
+++ b/tools/libxl/libxl.h	Tue Oct 11 14:26:00 2011 +0100
@@ -420,7 +420,7 @@
                                   const char* str);
 void libxl_cpuid_apply_policy(libxl_ctx *ctx, uint32_t domid);
 void libxl_cpuid_set(libxl_ctx *ctx, uint32_t domid,
-		     libxl_cpuid_policy_list cpuid);
+                     libxl_cpuid_policy_list cpuid);
 
 /*
  * Functions for allowing users of libxl to store private data
diff -r 4b0907c6a08c -r c5f8c3597cae tools/libxl/libxl_bootloader.c
--- a/tools/libxl/libxl_bootloader.c	Tue Oct 11 12:02:58 2011 +0100
+++ b/tools/libxl/libxl_bootloader.c	Tue Oct 11 14:26:00 2011 +0100
@@ -81,14 +81,14 @@
 
     ret = openpty(master, slave, NULL, NULL, NULL);
     if (ret < 0)
-	    return -1;
+            return -1;
 
     ret = ttyname_r(*slave, slave_path, slave_path_len);
     if (ret == -1) {
-	    close(*master);
-	    close(*slave);
-	    *master = *slave = -1;
-	    return -1;
+            close(*master);
+            close(*slave);
+            *master = *slave = -1;
+            return -1;
     }
 
     /*
diff -r 4b0907c6a08c -r c5f8c3597cae tools/libxl/libxl_cpuid.c
--- a/tools/libxl/libxl_cpuid.c	Tue Oct 11 12:02:58 2011 +0100
+++ b/tools/libxl/libxl_cpuid.c	Tue Oct 11 14:26:00 2011 +0100
@@ -317,7 +317,7 @@
 }
 
 void libxl_cpuid_set(libxl_ctx *ctx, uint32_t domid,
-		     libxl_cpuid_policy_list cpuid)
+                     libxl_cpuid_policy_list cpuid)
 {
     int i;
     char *cpuid_res[4];
diff -r 4b0907c6a08c -r c5f8c3597cae tools/libxl/libxl_internal.c
--- a/tools/libxl/libxl_internal.c	Tue Oct 11 12:02:58 2011 +0100
+++ b/tools/libxl/libxl_internal.c	Tue Oct 11 14:26:00 2011 +0100
@@ -228,53 +228,53 @@
 
 int libxl__file_reference_map(libxl_file_reference *f)
 {
-	struct stat st_buf;
-	int ret, fd;
-	void *data;
+        struct stat st_buf;
+        int ret, fd;
+        void *data;
 
-	if (f->mapped)
-		return 0;
+        if (f->mapped)
+                return 0;
 
-	fd = open(f->path, O_RDONLY);
-	if (f < 0)
-		return ERROR_FAIL;
+        fd = open(f->path, O_RDONLY);
+        if (f < 0)
+                return ERROR_FAIL;
 
-	ret = fstat(fd, &st_buf);
-	if (ret < 0)
-		goto out;
+        ret = fstat(fd, &st_buf);
+        if (ret < 0)
+                goto out;
 
-	ret = -1;
-	data = mmap(NULL, st_buf.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
-	if (data == NULL)
-		goto out;
+        ret = -1;
+        data = mmap(NULL, st_buf.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
+        if (data == NULL)
+                goto out;
 
-	f->mapped = 1;
-	f->data = data;
-	f->size = st_buf.st_size;
+        f->mapped = 1;
+        f->data = data;
+        f->size = st_buf.st_size;
 
-	ret = 0;
+        ret = 0;
 out:
-	close(fd);
+        close(fd);
 
-	return ret == 0 ? 0 : ERROR_FAIL;
+        return ret == 0 ? 0 : ERROR_FAIL;
 }
 
 int libxl__file_reference_unmap(libxl_file_reference *f)
 {
-	int ret;
+        int ret;
 
-	if (!f->mapped)
-		return 0;
+        if (!f->mapped)
+                return 0;
 
-	ret = munmap(f->data, f->size);
-	if (ret == 0) {
-		f->mapped = 0;
-		f->data = NULL;
-		f->size = 0;
-		return 0;
-	}
+        ret = munmap(f->data, f->size);
+        if (ret == 0) {
+                f->mapped = 0;
+                f->data = NULL;
+                f->size = 0;
+                return 0;
+        }
 
-	return ERROR_FAIL;
+        return ERROR_FAIL;
 }
 
 _hidden int libxl__parse_mac(const char *s, libxl_mac mac)
diff -r 4b0907c6a08c -r c5f8c3597cae tools/libxl/libxl_nocpuid.c
--- a/tools/libxl/libxl_nocpuid.c	Tue Oct 11 12:02:58 2011 +0100
+++ b/tools/libxl/libxl_nocpuid.c	Tue Oct 11 14:26:00 2011 +0100
@@ -32,6 +32,6 @@
 }
 
 void libxl_cpuid_set(libxl_ctx *ctx, uint32_t domid,
-		     libxl_cpuid_policy_list cpuid)
+                     libxl_cpuid_policy_list cpuid)
 {
 }
diff -r 4b0907c6a08c -r c5f8c3597cae tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c	Tue Oct 11 12:02:58 2011 +0100
+++ b/tools/libxl/libxl_pci.c	Tue Oct 11 14:26:00 2011 +0100
@@ -1113,7 +1113,7 @@
         if ((src[i].type == E820_RAM) ||
             (src[i].type == E820_UNUSABLE) ||
             (src[i].type == 0))
-		continue;
+                continue;
 
         start = src[i].addr < start ? src[i].addr : start;
         last = src[i].addr + src[i].size > last ?
@@ -1158,14 +1158,14 @@
      * to E820_UNUSED. We also need to move some of the E820_RAM regions if
      * the overlap with ram_end. */
     for (i = 0; i < nr; i++) {
-	uint64_t end = src[i].addr + src[i].size;
+        uint64_t end = src[i].addr + src[i].size;
 
-	/* We don't care about E820_UNUSABLE, but we need to
+        /* We don't care about E820_UNUSABLE, but we need to
          * change the type to zero b/c the loop after this
          * sticks E820_UNUSABLE on the guest's E820 but ignores
          * the ones with type zero. */
         if ((src[i].type == E820_UNUSABLE) ||
-	    /* Any region that is within the "RAM region" can
+            /* Any region that is within the "RAM region" can
              * be safely ditched. */
             (end < ram_end)) {
                 src[i].type = 0;
@@ -1173,15 +1173,15 @@
         }
 
         /* Look only at RAM regions. */
-	if (src[i].type != E820_RAM)
+        if (src[i].type != E820_RAM)
             continue;
 
         /* We only care about RAM regions below 4GB. */
         if (src[i].addr >= (1ULL<<32))
             continue;
 
-	/* E820_RAM overlaps with our RAM region. Move it */
-	if (src[i].addr < ram_end) {
+        /* E820_RAM overlaps with our RAM region. Move it */
+        if (src[i].addr < ram_end) {
             uint64_t delta;
 
             src[i].type = E820_UNUSABLE;
@@ -1235,8 +1235,8 @@
     /* Almost done: copy them over, ignoring the undesireable ones */
     for (i = 0; i < nr; i++) {
         if ((src[i].type == E820_RAM) ||
-	    (src[i].type == 0))
-	    continue;
+            (src[i].type == 0))
+            continue;
 
         e820[idx].type = src[i].type;
         e820[idx].addr = src[i].addr;
diff -r 4b0907c6a08c -r c5f8c3597cae tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c	Tue Oct 11 12:02:58 2011 +0100
+++ b/tools/libxl/libxl_utils.c	Tue Oct 11 14:26:00 2011 +0100
@@ -457,7 +457,7 @@
 
     rc = libxl__parse_mac(mac, mac_n);
     if (rc)
-	    return rc;
+            return rc;
 
     nics = libxl_list_nics(ctx, domid, &nb);
     if (!nics)
@@ -509,7 +509,7 @@
     val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/mac", nic_path_fe));
     rc = libxl__parse_mac(val, nic->mac);
     if (rc)
-	    goto out;
+            goto out;
 
     nic->script = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "%s/script", nic_path_be), NULL);
     rc = 0;
diff -r 4b0907c6a08c -r c5f8c3597cae tools/libxl/libxlutil.h
--- a/tools/libxl/libxlutil.h	Tue Oct 11 12:02:58 2011 +0100
+++ b/tools/libxl/libxlutil.h	Tue Oct 11 14:26:00 2011 +0100
@@ -64,7 +64,7 @@
  */
 
 int xlu_disk_parse(XLU_Config *cfg, int nspecs, const char *const *specs,
-		   libxl_device_disk *disk);
+                   libxl_device_disk *disk);
   /* disk must have been initialised.
    *
    * On error, returns errno value.  Bad strings cause EINVAL and
diff -r 4b0907c6a08c -r c5f8c3597cae tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Oct 11 12:02:58 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Tue Oct 11 14:26:00 2011 +0100
@@ -497,15 +497,15 @@
     memset(disk, 0, sizeof(*disk));
 
     if (!*config) {
-	*config = xlu_cfg_init(stderr, "command line");
-	if (!*config) { perror("xlu_cfg_init"); exit(-1); }
+        *config = xlu_cfg_init(stderr, "command line");
+        if (!*config) { perror("xlu_cfg_init"); exit(-1); }
     }
 
     e = xlu_disk_parse(*config, nspecs, specs, disk);
     if (e == EINVAL) exit(-1);
     if (e) {
-	fprintf(stderr,"xlu_disk_parse failed: %s\n",strerror(errno));
-	exit(-1);
+        fprintf(stderr,"xlu_disk_parse failed: %s\n",strerror(errno));
+        exit(-1);
     }
 }
 

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 14 10:04:26 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 14 Oct 2011 10:04:26 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RElBK-0003oD-2L; Fri, 14 Oct 2011 10:04:26 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1REl7I-0003Sr-9D
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 10:00:28 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1318611582!59229830!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28968 invoked from network); 14 Oct 2011 16:59:42 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Oct 2011 16:59:42 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1REl7E-0007Fb-E5
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 18:00:12 +0100
Message-Id: <E1REl7E-0007Fb-E5@xenbits.xen.org>
Date: Fri, 14 Oct 2011 18:00:11 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Revert part of 23811:f1349a968a5a
	"ns16550: Simplify UART..."
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@xen.org>
# Date 1318435888 -3600
# Node ID dcb2bd283dcaa9a72859cf6b454ad4a8a2129bf2
# Parent  48aa733d0767cf24f6c346c3fc0e573bccf4aa47
Revert part of 23811:f1349a968a5a "ns16550: Simplify UART..."

The change to poll LSR.THRE in a loop from __ns16550_poll is a bug.
We can loop indefinitely if there are no chars to transmit.

Thanks to Jan for spotting it.

Signed-off-by: Keir Fraser <keir@xen.org>
---


diff -r 48aa733d0767 -r dcb2bd283dca xen/drivers/char/ns16550.c
--- a/xen/drivers/char/ns16550.c	Wed Oct 12 16:21:32 2011 +0100
+++ b/xen/drivers/char/ns16550.c	Wed Oct 12 17:11:28 2011 +0100
@@ -157,18 +157,15 @@
 {
     struct serial_port *port = this_cpu(poll_port);
     struct ns16550 *uart = port->uart;
-    char lsr;
 
     if ( uart->intr_works )
         return; /* Interrupts work - no more polling */
 
-    while ( (lsr = ns_read_reg(uart, LSR)) & (LSR_DR|LSR_THRE) )
-    {
-        if ( lsr & LSR_THRE )
-            serial_tx_interrupt(port, regs);
-        if ( lsr & LSR_DR )
-            serial_rx_interrupt(port, regs);
-    }
+    while ( ns_read_reg(uart, LSR) & LSR_DR )
+        serial_rx_interrupt(port, regs);
+
+    if ( ns_read_reg(uart, LSR) & LSR_THRE )
+        serial_tx_interrupt(port, regs);
 
     set_timer(&uart->timer, NOW() + MILLISECS(uart->timeout_ms));
 }

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 14 10:04:58 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 14 Oct 2011 10:04:58 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RElBo-0003ra-Tw; Fri, 14 Oct 2011 10:04:57 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1REl7K-0003T0-SU
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 10:00:28 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-27.messagelabs.com!1318611587!52859286!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26990 invoked from network); 14 Oct 2011 16:59:47 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-7.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Oct 2011 16:59:47 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1REl7H-0007JN-Sf
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 18:00:15 +0100
Message-Id: <E1REl7H-0007JN-Sf@xenbits.xen.org>
Date: Fri, 14 Oct 2011 18:00:15 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] nestedsvm: fix checks of guest
	writes to HSAVE_PA MSR
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 Christoph Egger <Christoph.Egger@amd.com>
# Date 1318504870 -3600
# Node ID c1bd53fac3d5e5868352894d62dbacd6de0b0e7a
# Parent  eda18b27de6ed873ceb0e2f633d04236c5479f6d
nestedsvm: fix checks of guest writes to HSAVE_PA MSR

Accessing HSAVE_PA MSR does not require SVM to be enabled nor any
special guest paging mode.
But accessing HSAVE_PA MSR requires the address to be 4k aligned.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r eda18b27de6e -r c1bd53fac3d5 xen/arch/x86/hvm/svm/nestedsvm.c
--- a/xen/arch/x86/hvm/svm/nestedsvm.c	Thu Oct 13 12:21:10 2011 +0100
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c	Thu Oct 13 12:21:10 2011 +0100
@@ -51,7 +51,8 @@
 static int
 nestedsvm_vmcb_isvalid(struct vcpu *v, uint64_t vmcxaddr)
 {
-    if ( !hvm_svm_enabled(v) || hvm_guest_x86_mode(v) < 2 )
+    /* Address must be 4k aligned */
+    if ( (vmcxaddr & ~PAGE_MASK) != 0 )
         return 0;
 
     /* Maximum valid physical address.

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 14 10:05:54 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 14 Oct 2011 10:05:54 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RElCi-0003xX-6D; Fri, 14 Oct 2011 10:05:52 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1REl7K-0003Sv-0p
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 10:00:29 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1318611615!171815!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27478 invoked from network); 14 Oct 2011 17:00:15 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Oct 2011 17:00:15 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1REl7G-0007I3-Pm
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 18:00:14 +0100
Message-Id: <E1REl7G-0007I3-Pm@xenbits.xen.org>
Date: Fri, 14 Oct 2011 18:00:14 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] VMX: extend last branch MSR info to
	cover newer CPU models
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 Jan Beulich <jbeulich@suse.com>
# Date 1318493368 -7200
# Node ID 1515484353c602c41760ff5e110f7490174537f4
# Parent  8c1e7830112f5bc57c3539c3c1e7eb3ca3539f1f
VMX: extend last branch MSR info to cover newer CPU models

There are still a couple of family 6 models missing here: 37, 44, 46,
and 47 (according to SDM doc changes May 2011); presumably they would
all go into the Nehalem/Sandy Bridge group. Intel?

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Haitao Shan <maillists.shan@gmail.com>
---


diff -r 8c1e7830112f -r 1515484353c6 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c	Thu Oct 13 10:03:43 2011 +0200
+++ b/xen/arch/x86/hvm/vmx/vmx.c	Thu Oct 13 10:09:28 2011 +0200
@@ -1693,6 +1693,20 @@
     { MSR_C2_LASTBRANCH_0_FROM_IP,  NUM_MSR_C2_LASTBRANCH_FROM_TO },
     { MSR_C2_LASTBRANCH_0_TO_IP,    NUM_MSR_C2_LASTBRANCH_FROM_TO },
     { 0, 0 }
+}, nh_lbr[] = {
+    { MSR_IA32_LASTINTFROMIP,       1 },
+    { MSR_IA32_LASTINTTOIP,         1 },
+    { MSR_C2_LASTBRANCH_TOS,        1 },
+    { MSR_P4_LASTBRANCH_0_FROM_LIP, NUM_MSR_P4_LASTBRANCH_FROM_TO },
+    { MSR_P4_LASTBRANCH_0_TO_LIP,   NUM_MSR_P4_LASTBRANCH_FROM_TO },
+    { 0, 0 }
+}, at_lbr[] = {
+    { MSR_IA32_LASTINTFROMIP,       1 },
+    { MSR_IA32_LASTINTTOIP,         1 },
+    { MSR_C2_LASTBRANCH_TOS,        1 },
+    { MSR_C2_LASTBRANCH_0_FROM_IP,  NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
+    { MSR_C2_LASTBRANCH_0_TO_IP,    NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
+    { 0, 0 }
 #ifdef __i386__
 }, pm_lbr[] = {
     { MSR_IA32_LASTINTFROMIP,       1 },
@@ -1720,8 +1734,20 @@
 #endif
         /* Core2 Duo */
         case 15:
+        /* Enhanced Core */
+        case 23:
             return c2_lbr;
             break;
+        /* Nehalem */
+        case 26: case 30: case 31: case 46:
+        /* Sandy Bridge */
+        case 42: case 45:
+            return nh_lbr;
+            break;
+        /* Atom */
+        case 28:
+            return at_lbr;
+            break;
         }
         break;
 
diff -r 8c1e7830112f -r 1515484353c6 xen/include/asm-x86/msr-index.h
--- a/xen/include/asm-x86/msr-index.h	Thu Oct 13 10:03:43 2011 +0200
+++ b/xen/include/asm-x86/msr-index.h	Thu Oct 13 10:09:28 2011 +0200
@@ -472,11 +472,12 @@
 #define MSR_PM_LASTBRANCH_0		0x00000040
 #define NUM_MSR_PM_LASTBRANCH		8
 
-/* Core 2 last-branch recording */
+/* Core 2 and Atom last-branch recording */
 #define MSR_C2_LASTBRANCH_TOS		0x000001c9
 #define MSR_C2_LASTBRANCH_0_FROM_IP	0x00000040
 #define MSR_C2_LASTBRANCH_0_TO_IP	0x00000060
 #define NUM_MSR_C2_LASTBRANCH_FROM_TO	4
+#define NUM_MSR_ATOM_LASTBRANCH_FROM_TO	8
 
 /* Intel Core-based CPU performance counters */
 #define MSR_CORE_PERF_FIXED_CTR0	0x00000309

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 14 10:07:03 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 14 Oct 2011 10:07:03 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RElDo-00043V-Un; Fri, 14 Oct 2011 10:07:01 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1REl7P-0003TK-4Q
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 10:00:29 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-27.messagelabs.com!1318611600!48287546!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27856 invoked from network); 14 Oct 2011 17:00:00 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Oct 2011 17:00:00 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1REl7M-0007OO-4b
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 18:00:20 +0100
Message-Id: <E1REl7M-0007OO-4b@xenbits.xen.org>
Date: Fri, 14 Oct 2011 18:00:19 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/MSI: drop local cpumask_t
	variable from msi_compose_msg()
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 Jan Beulich <jbeulich@suse.com>
# Date 1318595655 -7200
# Node ID f63528cc50601b730a3283059fbb7e7896f97674
# Parent  c3c0ebfad1024b80a846f5fa20b130aba39348bb
x86/MSI: drop local cpumask_t variable from msi_compose_msg()

The function gets called only during initialization/resume (when no
other CPUs are running) or with the IRQ descriptor lock held, so
there's no way for the CPU mask to change under its feet.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r c3c0ebfad102 -r f63528cc5060 xen/arch/x86/msi.c
--- a/xen/arch/x86/msi.c	Fri Oct 14 12:27:15 2011 +0200
+++ b/xen/arch/x86/msi.c	Fri Oct 14 14:34:15 2011 +0200
@@ -123,18 +123,16 @@
 void msi_compose_msg(struct irq_desc *desc, struct msi_msg *msg)
 {
     unsigned dest;
-    cpumask_t domain;
     struct irq_cfg *cfg = desc->chip_data;
     int vector = cfg->vector;
-    domain = cfg->cpu_mask;
 
-    if ( cpus_empty( domain ) ) {
+    if ( cpus_empty(cfg->cpu_mask) ) {
         dprintk(XENLOG_ERR,"%s, compose msi message error!!\n", __func__);
-	    return;
+        return;
     }
 
     if ( vector ) {
-        dest = cpu_mask_to_apicid(&domain);
+        dest = cpu_mask_to_apicid(&cfg->cpu_mask);
 
         msg->address_hi = MSI_ADDR_BASE_HI;
         msg->address_lo =

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 14 10:07:43 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 14 Oct 2011 10:07:43 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RElEU-000483-SC; Fri, 14 Oct 2011 10:07:42 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1REl7M-0003T7-8G
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 10:00:29 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-21.messagelabs.com!1318611617!144811!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6187 invoked from network); 14 Oct 2011 17:00:17 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Oct 2011 17:00:17 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1REl7D-0007FE-S9
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 18:00:11 +0100
Message-Id: <E1REl7D-0007FE-S9@xenbits.xen.org>
Date: Fri, 14 Oct 2011 18:00:10 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: fixup incorrect indentation
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 Ian Campbell <ian.campbell@citrix.com>
# Date 1318432892 -3600
# Node ID 48aa733d0767cf24f6c346c3fc0e573bccf4aa47
# Parent  e65977f3fa8667d31f4885318abdf9c6ffed4eec
libxl: fixup incorrect indentation

Several places which were previsously indented using hard tabs are now
incorrectly indented. Fix them up.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/flexarray.c
--- a/tools/libxl/flexarray.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/flexarray.c	Wed Oct 12 16:21:32 2011 +0100
@@ -107,3 +107,11 @@
     free(array);
     return data;
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/flexarray.h
--- a/tools/libxl/flexarray.h	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/flexarray.h	Wed Oct 12 16:21:32 2011 +0100
@@ -35,3 +35,11 @@
 _hidden void **flexarray_contents(flexarray_t *array);
 
 #endif
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxl.c	Wed Oct 12 16:21:32 2011 +0100
@@ -3041,3 +3041,11 @@
     libxl__free_all(&gc);
     return 0;
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxl.h	Wed Oct 12 16:21:32 2011 +0100
@@ -541,3 +541,10 @@
 
 #endif /* LIBXL_H */
 
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxl_blktap2.c
--- a/tools/libxl/libxl_blktap2.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxl_blktap2.c	Wed Oct 12 16:21:32 2011 +0100
@@ -77,3 +77,11 @@
 
     tap_ctl_destroy(tap.id, tap.minor);
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxl_bootloader.c
--- a/tools/libxl/libxl_bootloader.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxl_bootloader.c	Wed Oct 12 16:21:32 2011 +0100
@@ -450,3 +450,10 @@
     return rc;
 }
 
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxl_cpuid.c
--- a/tools/libxl/libxl_cpuid.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxl_cpuid.c	Wed Oct 12 16:21:32 2011 +0100
@@ -326,3 +326,11 @@
         xc_cpuid_set(ctx->xch, domid, cpuid[i].input,
                      (const char**)(cpuid[i].policy), cpuid_res);
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxl_create.c	Wed Oct 12 16:21:32 2011 +0100
@@ -643,3 +643,11 @@
     libxl__free_all(&gc);
     return rc;
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxl_device.c	Wed Oct 12 16:21:32 2011 +0100
@@ -654,3 +654,10 @@
     return rc;
 }
 
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxl_dm.c	Wed Oct 12 16:21:32 2011 +0100
@@ -1047,3 +1047,11 @@
     libxl__create_device_model(gc, info, NULL, 0, NULL, 0, starting_r);
     return 0;
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxl_dom.c	Wed Oct 12 16:21:32 2011 +0100
@@ -813,3 +813,11 @@
     libxl__free_all(&gc);
     return rc;
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxl_exec.c
--- a/tools/libxl/libxl_exec.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxl_exec.c	Wed Oct 12 16:21:32 2011 +0100
@@ -308,3 +308,11 @@
     for_spawn->intermediate = 0;
     return ERROR_FAIL;
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxl_flask.c
--- a/tools/libxl/libxl_flask.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxl_flask.c	Wed Oct 12 16:21:32 2011 +0100
@@ -69,3 +69,11 @@
 
     return rc;
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxl_internal.c
--- a/tools/libxl/libxl_internal.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxl_internal.c	Wed Oct 12 16:21:32 2011 +0100
@@ -318,3 +318,11 @@
     }
     return fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxl_internal.h	Wed Oct 12 16:21:32 2011 +0100
@@ -544,3 +544,11 @@
 _hidden libxl__json_object *libxl__json_parse(libxl__gc *gc, const char *s);
 
 #endif
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxl_json.c
--- a/tools/libxl/libxl_json.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxl_json.c	Wed Oct 12 16:21:32 2011 +0100
@@ -558,3 +558,11 @@
         return NULL;
     }
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxl_noblktap2.c
--- a/tools/libxl/libxl_noblktap2.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxl_noblktap2.c	Wed Oct 12 16:21:32 2011 +0100
@@ -31,3 +31,11 @@
 void libxl__device_destroy_tapdisk(libxl__gc *gc, char *be_path)
 {
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxl_nocpuid.c
--- a/tools/libxl/libxl_nocpuid.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxl_nocpuid.c	Wed Oct 12 16:21:32 2011 +0100
@@ -35,3 +35,11 @@
                      libxl_cpuid_policy_list cpuid)
 {
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxl_osdeps.h
--- a/tools/libxl/libxl_osdeps.h	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxl_osdeps.h	Wed Oct 12 16:21:32 2011 +0100
@@ -39,3 +39,11 @@
 #endif /*NEED_OWN_ASPRINTF*/
 
 #endif
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxl_paths.c
--- a/tools/libxl/libxl_paths.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxl_paths.c	Wed Oct 12 16:21:32 2011 +0100
@@ -69,3 +69,11 @@
 {
     return XEN_RUN_DIR;
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxl_pci.c	Wed Oct 12 16:21:32 2011 +0100
@@ -1303,3 +1303,11 @@
     }
     return 0;
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxl_qmp.c	Wed Oct 12 16:21:32 2011 +0100
@@ -594,3 +594,11 @@
     libxl__qmp_close(qmp);
     return ret;
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxl_utils.c	Wed Oct 12 16:21:32 2011 +0100
@@ -647,3 +647,11 @@
     }
     return ERROR_FAIL;
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxl_utils.h
--- a/tools/libxl/libxl_utils.h	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxl_utils.h	Wed Oct 12 16:21:32 2011 +0100
@@ -80,3 +80,10 @@
 
 #endif
 
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxl_uuid.c
--- a/tools/libxl/libxl_uuid.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxl_uuid.c	Wed Oct 12 16:21:32 2011 +0100
@@ -103,3 +103,11 @@
 #error "Please update libxl_uuid.c for your OS"
 
 #endif
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxl_uuid.h
--- a/tools/libxl/libxl_uuid.h	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxl_uuid.h	Wed Oct 12 16:21:32 2011 +0100
@@ -62,3 +62,11 @@
 uint8_t *libxl_uuid_bytearray(libxl_uuid *uuid);
 
 #endif /* __LIBXL_UUID_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxl_xshelp.c
--- a/tools/libxl/libxl_xshelp.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxl_xshelp.c	Wed Oct 12 16:21:32 2011 +0100
@@ -121,3 +121,11 @@
     libxl__ptr_add(gc, ret);
     return ret;
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxlu_cfg.c
--- a/tools/libxl/libxlu_cfg.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxlu_cfg.c	Wed Oct 12 16:21:32 2011 +0100
@@ -433,3 +433,11 @@
             msg);
     if (!ctx->err) ctx->err= EINVAL;
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxlu_cfg_i.h
--- a/tools/libxl/libxlu_cfg_i.h	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxlu_cfg_i.h	Wed Oct 12 16:21:32 2011 +0100
@@ -42,3 +42,11 @@
 
 
 #endif /*LIBXLU_CFG_I_H*/
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxlu_cfg_l.c
--- a/tools/libxl/libxlu_cfg_l.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxlu_cfg_l.c	Wed Oct 12 16:21:32 2011 +0100
@@ -2122,3 +2122,11 @@
 #define YYTABLES_NAME "yytables"
 
 #line 104 "libxlu_cfg_l.l"
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxlu_cfg_l.h
--- a/tools/libxl/libxlu_cfg_l.h	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxlu_cfg_l.h	Wed Oct 12 16:21:32 2011 +0100
@@ -355,3 +355,11 @@
 #line 356 "libxlu_cfg_l.h"
 #undef xlu__cfg_yyIN_HEADER
 #endif /* xlu__cfg_yyHEADER_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxlu_cfg_y.c
--- a/tools/libxl/libxlu_cfg_y.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxlu_cfg_y.c	Wed Oct 12 16:21:32 2011 +0100
@@ -1689,3 +1689,11 @@
 
 
 
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxlu_cfg_y.h
--- a/tools/libxl/libxlu_cfg_y.h	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxlu_cfg_y.h	Wed Oct 12 16:21:32 2011 +0100
@@ -85,3 +85,11 @@
 #endif
 
 
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxlu_disk.c
--- a/tools/libxl/libxlu_disk.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxlu_disk.c	Wed Oct 12 16:21:32 2011 +0100
@@ -91,3 +91,10 @@
     return dpc.err;
 }
 
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxlu_disk_i.h
--- a/tools/libxl/libxlu_disk_i.h	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxlu_disk_i.h	Wed Oct 12 16:21:32 2011 +0100
@@ -19,3 +19,11 @@
 
 
 #endif /*LIBXLU_DISK_I_H*/
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxlu_disk_l.c
--- a/tools/libxl/libxlu_disk_l.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxlu_disk_l.c	Wed Oct 12 16:21:32 2011 +0100
@@ -2517,3 +2517,11 @@
 #define YYTABLES_NAME "yytables"
 
 #line 227 "libxlu_disk_l.l"
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxlu_disk_l.h
--- a/tools/libxl/libxlu_disk_l.h	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxlu_disk_l.h	Wed Oct 12 16:21:32 2011 +0100
@@ -345,3 +345,11 @@
 #line 346 "libxlu_disk_l.h"
 #undef xlu__disk_yyIN_HEADER
 #endif /* xlu__disk_yyHEADER_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxlu_internal.h
--- a/tools/libxl/libxlu_internal.h	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxlu_internal.h	Wed Oct 12 16:21:32 2011 +0100
@@ -50,3 +50,11 @@
 #define TOSTRING(x) STRINGIFY(x)
 
 #endif /*LIBXLU_INTERNAL_H*/
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/libxlutil.h
--- a/tools/libxl/libxlutil.h	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/libxlutil.h	Wed Oct 12 16:21:32 2011 +0100
@@ -82,3 +82,11 @@
 
 
 #endif /* LIBXLUTIL_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/osdeps.c
--- a/tools/libxl/osdeps.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/osdeps.c	Wed Oct 12 16:21:32 2011 +0100
@@ -66,3 +66,11 @@
 }
 
 #endif
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/xl.c
--- a/tools/libxl/xl.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/xl.c	Wed Oct 12 16:21:32 2011 +0100
@@ -162,3 +162,11 @@
     xtl_logger_destroy((xentoollog_logger*)logger);
     return ret;
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/xl.h
--- a/tools/libxl/xl.h	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/xl.h	Wed Oct 12 16:21:32 2011 +0100
@@ -109,3 +109,11 @@
 extern char *default_vifscript;
 
 #endif /* XL_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Wed Oct 12 16:21:32 2011 +0100
@@ -5361,3 +5361,11 @@
 
     return ret;
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r e65977f3fa86 -r 48aa733d0767 tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c	Tue Oct 11 14:34:07 2011 +0100
+++ b/tools/libxl/xl_cmdtable.c	Wed Oct 12 16:21:32 2011 +0100
@@ -407,3 +407,11 @@
     }
     return (count == 1) ? cmd : NULL;
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 14 10:08:19 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 14 Oct 2011 10:08:19 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RElF5-0004Bm-8X; Fri, 14 Oct 2011 10:08:19 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1REl7I-0003St-O7
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 10:00:29 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-27.messagelabs.com!1318611599!44305551!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29743 invoked from network); 14 Oct 2011 16:59:59 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Oct 2011 16:59:59 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1REl7F-0007Ge-Nj
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 18:00:13 +0100
Message-Id: <E1REl7F-0007Ge-Nj@xenbits.xen.org>
Date: Fri, 14 Oct 2011 18:00:13 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86-64: don't use xmalloc_array()
	for allocation of the (per-CPU) IDTs
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 Jan Beulich <jbeulich@suse.com>
# Date 1318492954 -7200
# Node ID 46ca8ea42d4c674e0792e792300710afec3f6e24
# Parent  39df1692395884e4bf0fc45f720c12e37072a47b
x86-64: don't use xmalloc_array() for allocation of the (per-CPU) IDTs

The IDTs being exactly a page in size, using xmalloc() here is rather
inefficient, as this requires double the amount to be allocated (with
almost an entire page wasted). For hot plugged CPUs, this at once
eliminates one more non-order-zero runtime allocation.

For x86-32, however, the IDT is exactly half a page, so allocating a
full page seems wasteful here, so it continues to use xmalloc() as
before.

With most of the affected functions' bodies now being inside #ifdef-s,
it might be reasonable to split those parts out into subarch-specific
code...

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r 39df16923958 -r 46ca8ea42d4c xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c	Thu Oct 13 10:00:13 2011 +0200
+++ b/xen/arch/x86/smpboot.c	Thu Oct 13 10:02:34 2011 +0200
@@ -639,9 +639,6 @@
 {
     unsigned int order;
 
-    xfree(idt_tables[cpu]);
-    idt_tables[cpu] = NULL;
-
     order = get_order_from_pages(NR_RESERVED_GDT_PAGES);
 #ifdef __x86_64__
     if ( per_cpu(compat_gdt_table, cpu) )
@@ -650,10 +647,15 @@
         free_domheap_pages(virt_to_page(per_cpu(compat_gdt_table, cpu)),
                            order);
     per_cpu(compat_gdt_table, cpu) = NULL;
+    order = get_order_from_bytes(IDT_ENTRIES * sizeof(**idt_tables));
+    if ( idt_tables[cpu] )
+        free_domheap_pages(virt_to_page(idt_tables[cpu]), order);
 #else
     free_xenheap_pages(per_cpu(gdt_table, cpu), order);
+    xfree(idt_tables[cpu]);
 #endif
     per_cpu(gdt_table, cpu) = NULL;
+    idt_tables[cpu] = NULL;
 
     if ( stack_base[cpu] != NULL )
     {
@@ -691,19 +693,25 @@
     if ( !page )
         goto oom;
     per_cpu(gdt_table, cpu) = gdt = page_to_virt(page);
+    order = get_order_from_bytes(IDT_ENTRIES * sizeof(**idt_tables));
+    page = alloc_domheap_pages(NULL, order,
+                               MEMF_node(cpu_to_node(cpu)));
+    if ( !page )
+        goto oom;
+    idt_tables[cpu] = page_to_virt(page);
 #else
     per_cpu(gdt_table, cpu) = gdt = alloc_xenheap_pages(order, 0);
     if ( !gdt )
         goto oom;
+    idt_tables[cpu] = xmalloc_array(idt_entry_t, IDT_ENTRIES);
+    if ( idt_tables[cpu] == NULL )
+        goto oom;
 #endif
     memcpy(gdt, boot_cpu_gdt_table,
            NR_RESERVED_GDT_PAGES * PAGE_SIZE);
     BUILD_BUG_ON(NR_CPUS > 0x10000);
     gdt[PER_CPU_GDT_ENTRY - FIRST_RESERVED_GDT_ENTRY].a = cpu;
 
-    idt_tables[cpu] = xmalloc_array(idt_entry_t, IDT_ENTRIES);
-    if ( idt_tables[cpu] == NULL )
-        goto oom;
     memcpy(idt_tables[cpu], idt_table,
            IDT_ENTRIES*sizeof(idt_entry_t));
 

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 14 10:08:47 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 14 Oct 2011 10:08:47 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RElFX-0004Ev-Cj; Fri, 14 Oct 2011 10:08:47 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1REl7N-0003TB-Ho
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 10:00:29 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-27.messagelabs.com!1318611590!41958799!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25982 invoked from network); 14 Oct 2011 16:59:50 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Oct 2011 16:59:50 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1REl7K-0007MU-HX
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 18:00:18 +0100
Message-Id: <E1REl7K-0007MU-HX@xenbits.xen.org>
Date: Fri, 14 Oct 2011 18:00:18 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: remove dead member from struct
	_cpuid4_info
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 Jan Beulich <jbeulich@suse.com>
# Date 1318580242 -7200
# Node ID 121af976b2988de389db139231103ceedd11bb8a
# Parent  e2f6af2820f117bd40ac8e9cfc90f060dabad76e
x86: remove dead member from struct _cpuid4_info

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r e2f6af2820f1 -r 121af976b298 xen/arch/x86/cpu/intel_cacheinfo.c
--- a/xen/arch/x86/cpu/intel_cacheinfo.c	Fri Oct 14 10:16:39 2011 +0200
+++ b/xen/arch/x86/cpu/intel_cacheinfo.c	Fri Oct 14 10:17:22 2011 +0200
@@ -124,7 +124,6 @@
 	union _cpuid4_leaf_ebx ebx;
 	union _cpuid4_leaf_ecx ecx;
 	unsigned long size;
-	cpumask_t shared_cpu_map;
 };
 
 unsigned short			num_cache_leaves;

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 14 10:09:12 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 14 Oct 2011 10:09:12 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RElFu-0004IU-7t; Fri, 14 Oct 2011 10:09:12 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1REl7I-0003Ss-9t
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 10:00:29 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-21.messagelabs.com!1318611613!173798!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31652 invoked from network); 14 Oct 2011 17:00:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Oct 2011 17:00:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1REl7F-0007G8-1a
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 18:00:13 +0100
Message-Id: <E1REl7F-0007G8-1a@xenbits.xen.org>
Date: Fri, 14 Oct 2011 18:00:12 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] constify vcpu_set_affinity()'s
	second parameter
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 Jan Beulich <jbeulich@suse.com>
# Date 1318492813 -7200
# Node ID 39df1692395884e4bf0fc45f720c12e37072a47b
# Parent  dcb2bd283dcaa9a72859cf6b454ad4a8a2129bf2
constify vcpu_set_affinity()'s second parameter

None of the callers actually make use of the function's returning of
the old affinity through its second parameter, and eliminating this
capability allows some callers to no longer use a local variable here,
reducing their stack footprint significantly when building with large
NR_CPUS.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r dcb2bd283dca -r 39df16923958 xen/arch/x86/cpu/mcheck/vmce.c
--- a/xen/arch/x86/cpu/mcheck/vmce.c	Wed Oct 12 17:11:28 2011 +0100
+++ b/xen/arch/x86/cpu/mcheck/vmce.c	Thu Oct 13 10:00:13 2011 +0200
@@ -304,7 +304,6 @@
 int inject_vmce(struct domain *d)
 {
     int cpu = smp_processor_id();
-    cpumask_t affinity;
 
     /* PV guest and HVM guest have different vMCE# injection methods. */
     if ( !test_and_set_bool(d->vcpu[0]->mce_pending) )
@@ -323,11 +322,9 @@
             {
                 cpumask_copy(d->vcpu[0]->cpu_affinity_tmp,
                              d->vcpu[0]->cpu_affinity);
-                cpus_clear(affinity);
-                cpu_set(cpu, affinity);
                 mce_printk(MCE_VERBOSE, "MCE: CPU%d set affinity, old %d\n",
                            cpu, d->vcpu[0]->processor);
-                vcpu_set_affinity(d->vcpu[0], &affinity);
+                vcpu_set_affinity(d->vcpu[0], cpumask_of(cpu));
                 vcpu_kick(d->vcpu[0]);
             }
             else
diff -r dcb2bd283dca -r 39df16923958 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c	Wed Oct 12 17:11:28 2011 +0100
+++ b/xen/arch/x86/traps.c	Thu Oct 13 10:00:13 2011 +0200
@@ -3113,7 +3113,6 @@
 {
     int cpu = smp_processor_id();
     struct softirq_trap *st = &per_cpu(softirq_trap, cpu);
-    cpumask_t affinity;
 
     BUG_ON(st == NULL);
     BUG_ON(st->vcpu == NULL);
@@ -3129,9 +3128,7 @@
          * Make sure to wakeup the vcpu on the
          * specified processor.
          */
-        cpus_clear(affinity);
-        cpu_set(st->processor, affinity);
-        vcpu_set_affinity(st->vcpu, &affinity);
+        vcpu_set_affinity(st->vcpu, cpumask_of(st->processor));
 
         /* Affinity is restored in the iret hypercall. */
     }
@@ -3201,14 +3198,11 @@
                  !test_and_set_bool(curr->mce_pending) )
             {
                 int cpu = smp_processor_id();
-                cpumask_t affinity;
 
                 cpumask_copy(curr->cpu_affinity_tmp, curr->cpu_affinity);
-                cpus_clear(affinity);
-                cpu_set(cpu, affinity);
                 printk(XENLOG_DEBUG "MCE: CPU%d set affinity, old %d\n",
                        cpu, curr->processor);
-                vcpu_set_affinity(curr, &affinity);
+                vcpu_set_affinity(curr, cpumask_of(cpu));
             }
         }
     }
diff -r dcb2bd283dca -r 39df16923958 xen/common/schedule.c
--- a/xen/common/schedule.c	Wed Oct 12 17:11:28 2011 +0100
+++ b/xen/common/schedule.c	Thu Oct 13 10:00:13 2011 +0200
@@ -587,9 +587,9 @@
     return ret;
 }
 
-int vcpu_set_affinity(struct vcpu *v, cpumask_t *affinity)
+int vcpu_set_affinity(struct vcpu *v, const cpumask_t *affinity)
 {
-    cpumask_t online_affinity, old_affinity;
+    cpumask_t online_affinity;
     cpumask_t *online;
 
     if ( v->domain->is_pinned )
@@ -601,9 +601,7 @@
 
     vcpu_schedule_lock_irq(v);
 
-    cpumask_copy(&old_affinity, v->cpu_affinity);
     cpumask_copy(v->cpu_affinity, affinity);
-    cpumask_copy(affinity, &old_affinity);
     if ( !cpumask_test_cpu(v->processor, v->cpu_affinity) )
         set_bit(_VPF_migrating, &v->pause_flags);
 
diff -r dcb2bd283dca -r 39df16923958 xen/include/xen/sched.h
--- a/xen/include/xen/sched.h	Wed Oct 12 17:11:28 2011 +0100
+++ b/xen/include/xen/sched.h	Thu Oct 13 10:00:13 2011 +0200
@@ -617,7 +617,7 @@
 int schedule_cpu_switch(unsigned int cpu, struct cpupool *c);
 void vcpu_force_reschedule(struct vcpu *v);
 int cpu_disable_scheduler(unsigned int cpu);
-int vcpu_set_affinity(struct vcpu *v, cpumask_t *affinity);
+int vcpu_set_affinity(struct vcpu *v, const cpumask_t *affinity);
 
 void vcpu_runstate_get(struct vcpu *v, struct vcpu_runstate_info *runstate);
 uint64_t get_cpu_idle_time(unsigned int cpu);

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 14 10:09:28 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 14 Oct 2011 10:09:28 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RElGA-0004LU-W5; Fri, 14 Oct 2011 10:09:27 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1REl7P-0003TL-5c
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 10:00:29 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-216.messagelabs.com!1318611619!1079085!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23279 invoked from network); 14 Oct 2011 17:00:20 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Oct 2011 17:00:20 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1REl7L-0007Nh-KL
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 18:00:19 +0100
Message-Id: <E1REl7L-0007Nh-KL@xenbits.xen.org>
Date: Fri, 14 Oct 2011 18:00:19 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] p2m: use xzalloc() for struct
	p2m_domain allocation
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 Jan Beulich <jbeulich@suse.com>
# Date 1318588035 -7200
# Node ID c3c0ebfad1024b80a846f5fa20b130aba39348bb
# Parent  e4608c0a48a15a9a66533239cd8822da4260be52
p2m: use xzalloc() for struct p2m_domain allocation

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tim Deegan <tim@xen.org>
---


diff -r e4608c0a48a1 -r c3c0ebfad102 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Fri Oct 14 12:26:20 2011 +0200
+++ b/xen/arch/x86/mm/p2m.c	Fri Oct 14 12:27:15 2011 +0200
@@ -71,7 +71,6 @@
 /* Init the datastructures for later use by the p2m code */
 static void p2m_initialise(struct domain *d, struct p2m_domain *p2m)
 {
-    memset(p2m, 0, sizeof(*p2m));
     mm_lock_init(&p2m->lock);
     INIT_LIST_HEAD(&p2m->np2m_list);
     INIT_PAGE_LIST_HEAD(&p2m->pages);
@@ -100,7 +99,7 @@
 
     mm_lock_init(&d->arch.nested_p2m_lock);
     for (i = 0; i < MAX_NESTEDP2M; i++) {
-        d->arch.nested_p2m[i] = p2m = xmalloc(struct p2m_domain);
+        d->arch.nested_p2m[i] = p2m = xzalloc(struct p2m_domain);
         if (p2m == NULL)
             return -ENOMEM;
         p2m_initialise(d, p2m);
@@ -115,7 +114,7 @@
 {
     struct p2m_domain *p2m;
 
-    p2m_get_hostp2m(d) = p2m = xmalloc(struct p2m_domain);
+    p2m_get_hostp2m(d) = p2m = xzalloc(struct p2m_domain);
     if ( p2m == NULL )
         return -ENOMEM;
     p2m_initialise(d, p2m);

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 14 10:09:42 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 14 Oct 2011 10:09:42 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RElGO-0004Or-V8; Fri, 14 Oct 2011 10:09:41 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1REl7M-0003T6-7C
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 10:00:29 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-174.messagelabs.com!1318611617!35346914!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7686 invoked from network); 14 Oct 2011 17:00:17 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Oct 2011 17:00:17 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1REl7I-0007Kj-UW
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 18:00:16 +0100
Message-Id: <E1REl7I-0007Kj-UW@xenbits.xen.org>
Date: Fri, 14 Oct 2011 18:00:16 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: Simplify smpboot_alloc by
	merging x86-{32, 64} code as far as
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@xen.org>
# Date 1318517962 -3600
# Node ID a65693f9fb1250ff4819774a70284693705db9e7
# Parent  bbde1453cbd95d6d36febe9c552f9cfa26b5c49e
x86: Simplify smpboot_alloc by merging x86-{32,64} code as far as
possible.

We still need one ifdef, as x86-32 does not have a compat_gdt_table.

On x86-32 there is 1/2-page wastage due to allocating a whole page for
the per-CPU IDT, however we expect very few users of the x86-32
hypervisor. Those that cannot move to the 64-bit hypervisor are likely
using old single-processor systems or new single-procesor netbooks. On
UP and small MP systems, the wastage is insignificant.

Signed-off-by: Keir Fraser <keir@xen.org>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r bbde1453cbd9 -r a65693f9fb12 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c	Thu Oct 13 15:58:55 2011 +0100
+++ b/xen/arch/x86/smpboot.c	Thu Oct 13 15:59:22 2011 +0100
@@ -640,21 +640,16 @@
     unsigned int order;
 
     order = get_order_from_pages(NR_RESERVED_GDT_PAGES);
+    free_xenheap_pages(per_cpu(gdt_table, cpu), order);
+    per_cpu(gdt_table, cpu) = NULL;
+
 #ifdef __x86_64__
-    if ( per_cpu(compat_gdt_table, cpu) )
-        free_domheap_pages(virt_to_page(per_cpu(gdt_table, cpu)), order);
-    if ( per_cpu(gdt_table, cpu) )
-        free_domheap_pages(virt_to_page(per_cpu(compat_gdt_table, cpu)),
-                           order);
+    free_xenheap_pages(per_cpu(compat_gdt_table, cpu), order);
     per_cpu(compat_gdt_table, cpu) = NULL;
-    order = get_order_from_bytes(IDT_ENTRIES * sizeof(**idt_tables));
-    if ( idt_tables[cpu] )
-        free_domheap_pages(virt_to_page(idt_tables[cpu]), order);
-#else
-    free_xenheap_pages(per_cpu(gdt_table, cpu), order);
-    xfree(idt_tables[cpu]);
 #endif
-    per_cpu(gdt_table, cpu) = NULL;
+
+    order = get_order_from_bytes(IDT_ENTRIES * sizeof(idt_entry_t));
+    free_xenheap_pages(idt_tables[cpu], order);
     idt_tables[cpu] = NULL;
 
     if ( stack_base[cpu] != NULL )
@@ -669,9 +664,6 @@
 {
     unsigned int order;
     struct desc_struct *gdt;
-#ifdef __x86_64__
-    struct page_info *page;
-#endif
 
     stack_base[cpu] = alloc_xenheap_pages(STACK_ORDER, 0);
     if ( stack_base[cpu] == NULL )
@@ -679,41 +671,28 @@
     memguard_guard_stack(stack_base[cpu]);
 
     order = get_order_from_pages(NR_RESERVED_GDT_PAGES);
-#ifdef __x86_64__
-    page = alloc_domheap_pages(NULL, order,
-                               MEMF_node(cpu_to_node(cpu)));
-    if ( !page )
+    per_cpu(gdt_table, cpu) = gdt =
+        alloc_xenheap_pages(order, MEMF_node(cpu_to_node(cpu)));
+    if ( gdt == NULL )
         goto oom;
-    per_cpu(compat_gdt_table, cpu) = gdt = page_to_virt(page);
-    memcpy(gdt, boot_cpu_compat_gdt_table,
-           NR_RESERVED_GDT_PAGES * PAGE_SIZE);
-    gdt[PER_CPU_GDT_ENTRY - FIRST_RESERVED_GDT_ENTRY].a = cpu;
-    page = alloc_domheap_pages(NULL, order,
-                               MEMF_node(cpu_to_node(cpu)));
-    if ( !page )
-        goto oom;
-    per_cpu(gdt_table, cpu) = gdt = page_to_virt(page);
-    order = get_order_from_bytes(IDT_ENTRIES * sizeof(**idt_tables));
-    page = alloc_domheap_pages(NULL, order,
-                               MEMF_node(cpu_to_node(cpu)));
-    if ( !page )
-        goto oom;
-    idt_tables[cpu] = page_to_virt(page);
-#else
-    per_cpu(gdt_table, cpu) = gdt = alloc_xenheap_pages(order, 0);
-    if ( !gdt )
-        goto oom;
-    idt_tables[cpu] = xmalloc_array(idt_entry_t, IDT_ENTRIES);
-    if ( idt_tables[cpu] == NULL )
-        goto oom;
-#endif
-    memcpy(gdt, boot_cpu_gdt_table,
-           NR_RESERVED_GDT_PAGES * PAGE_SIZE);
+    memcpy(gdt, boot_cpu_gdt_table, NR_RESERVED_GDT_PAGES * PAGE_SIZE);
     BUILD_BUG_ON(NR_CPUS > 0x10000);
     gdt[PER_CPU_GDT_ENTRY - FIRST_RESERVED_GDT_ENTRY].a = cpu;
 
-    memcpy(idt_tables[cpu], idt_table,
-           IDT_ENTRIES*sizeof(idt_entry_t));
+#ifdef __x86_64__
+    per_cpu(compat_gdt_table, cpu) = gdt =
+        alloc_xenheap_pages(order, MEMF_node(cpu_to_node(cpu)));
+    if ( gdt == NULL )
+        goto oom;
+    memcpy(gdt, boot_cpu_compat_gdt_table, NR_RESERVED_GDT_PAGES * PAGE_SIZE);
+    gdt[PER_CPU_GDT_ENTRY - FIRST_RESERVED_GDT_ENTRY].a = cpu;
+#endif
+
+    order = get_order_from_bytes(IDT_ENTRIES * sizeof(idt_entry_t));
+    idt_tables[cpu] = alloc_xenheap_pages(order, MEMF_node(cpu_to_node(cpu)));
+    if ( idt_tables[cpu] == NULL )
+        goto oom;
+    memcpy(idt_tables[cpu], idt_table, IDT_ENTRIES * sizeof(idt_entry_t));
 
     return 0;
 

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 14 10:09:52 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 14 Oct 2011 10:09:52 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RElGa-0004Ri-FR; Fri, 14 Oct 2011 10:09:52 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1REl7N-0003TA-EU
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 10:00:29 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-174.messagelabs.com!1318611618!35315992!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26497 invoked from network); 14 Oct 2011 17:00:18 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Oct 2011 17:00:18 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1REl7K-0007Lv-0W
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 18:00:18 +0100
Message-Id: <E1REl7K-0007Lv-0W@xenbits.xen.org>
Date: Fri, 14 Oct 2011 18:00:17 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] rcu: move private declarations and
	definitions from header to implementation
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 Jan Beulich <jbeulich@suse.com>
# Date 1318580199 -7200
# Node ID e2f6af2820f117bd40ac8e9cfc90f060dabad76e
# Parent  de316831471a8e0f11f615e7bf336dee2ba811e7
rcu: move private declarations and definitions from header to implementation

No consumer of RCU should need to see these, and there's also no need
to clutter the global name space with them.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r de316831471a -r e2f6af2820f1 xen/common/rcupdate.c
--- a/xen/common/rcupdate.c	Fri Oct 14 10:15:54 2011 +0200
+++ b/xen/common/rcupdate.c	Fri Oct 14 10:16:39 2011 +0200
@@ -46,15 +46,50 @@
 #include <xen/cpu.h>
 #include <xen/stop_machine.h>
 
-/* Definition for rcupdate control block. */
-struct rcu_ctrlblk rcu_ctrlblk = {
+/* Global control variables for rcupdate callback mechanism. */
+static struct rcu_ctrlblk {
+    long cur;           /* Current batch number.                      */
+    long completed;     /* Number of the last completed batch         */
+    int  next_pending;  /* Is the next batch already waiting?         */
+
+    spinlock_t  lock __cacheline_aligned;
+    cpumask_t   cpumask; /* CPUs that need to switch in order    */
+    /* for current batch to proceed.        */
+} __cacheline_aligned rcu_ctrlblk = {
     .cur = -300,
     .completed = -300,
     .lock = SPIN_LOCK_UNLOCKED,
     .cpumask = CPU_MASK_NONE,
 };
 
-DEFINE_PER_CPU(struct rcu_data, rcu_data);
+/*
+ * Per-CPU data for Read-Copy Update.
+ * nxtlist - new callbacks are added here
+ * curlist - current batch for which quiescent cycle started if any
+ */
+struct rcu_data {
+    /* 1) quiescent state handling : */
+    long quiescbatch;    /* Batch # for grace period */
+    int  qs_pending;     /* core waits for quiesc state */
+
+    /* 2) batch handling */
+    long            batch;            /* Batch # for current RCU batch */
+    struct rcu_head *nxtlist;
+    struct rcu_head **nxttail;
+    long            qlen;             /* # of queued callbacks */
+    struct rcu_head *curlist;
+    struct rcu_head **curtail;
+    struct rcu_head *donelist;
+    struct rcu_head **donetail;
+    long            blimit;           /* Upper limit on a processed batch */
+    int cpu;
+    struct rcu_head barrier;
+#ifdef CONFIG_SMP
+    long            last_rs_qlen;     /* qlen during the last resched */
+#endif
+};
+
+static DEFINE_PER_CPU(struct rcu_data, rcu_data);
 
 static int blimit = 10;
 static int qhimark = 10000;
@@ -104,6 +139,18 @@
     return stop_machine_run(rcu_barrier_action, &cpu_count, NR_CPUS);
 }
 
+/* Is batch a before batch b ? */
+static inline int rcu_batch_before(long a, long b)
+{
+    return (a - b) < 0;
+}
+
+/* Is batch a after batch b ? */
+static inline int rcu_batch_after(long a, long b)
+{
+    return (a - b) > 0;
+}
+
 static void force_quiescent_state(struct rcu_data *rdp,
                                   struct rcu_ctrlblk *rcp)
 {
diff -r de316831471a -r e2f6af2820f1 xen/include/xen/rcupdate.h
--- a/xen/include/xen/rcupdate.h	Fri Oct 14 10:15:54 2011 +0200
+++ b/xen/include/xen/rcupdate.h	Fri Oct 14 10:16:39 2011 +0200
@@ -57,60 +57,6 @@
 } while (0)
 
 
-
-/* Global control variables for rcupdate callback mechanism. */
-struct rcu_ctrlblk {
-    long cur;           /* Current batch number.                      */
-    long completed;     /* Number of the last completed batch         */
-    int  next_pending;  /* Is the next batch already waiting?         */
-
-    spinlock_t  lock __cacheline_aligned;
-    cpumask_t   cpumask; /* CPUs that need to switch in order    */
-    /* for current batch to proceed.        */
-} __cacheline_aligned;
-
-/* Is batch a before batch b ? */
-static inline int rcu_batch_before(long a, long b)
-{
-    return (a - b) < 0;
-}
-
-/* Is batch a after batch b ? */
-static inline int rcu_batch_after(long a, long b)
-{
-    return (a - b) > 0;
-}
-
-/*
- * Per-CPU data for Read-Copy Update.
- * nxtlist - new callbacks are added here
- * curlist - current batch for which quiescent cycle started if any
- */
-struct rcu_data {
-    /* 1) quiescent state handling : */
-    long quiescbatch;    /* Batch # for grace period */
-    int  qs_pending;     /* core waits for quiesc state */
-
-    /* 2) batch handling */
-    long            batch;            /* Batch # for current RCU batch */
-    struct rcu_head *nxtlist;
-    struct rcu_head **nxttail;
-    long            qlen;             /* # of queued callbacks */
-    struct rcu_head *curlist;
-    struct rcu_head **curtail;
-    struct rcu_head *donelist;
-    struct rcu_head **donetail;
-    long            blimit;           /* Upper limit on a processed batch */
-    int cpu;
-    struct rcu_head barrier;
-#ifdef CONFIG_SMP
-    long            last_rs_qlen;     /* qlen during the last resched */
-#endif
-};
-
-DECLARE_PER_CPU(struct rcu_data, rcu_data);
-extern struct rcu_ctrlblk rcu_ctrlblk;
-
 int rcu_pending(int cpu);
 int rcu_needs_cpu(int cpu);
 

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 14 10:10:11 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 14 Oct 2011 10:10:11 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RElGs-0004VN-Rt; Fri, 14 Oct 2011 10:10:10 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1REl7T-0003TT-Ee
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 10:00:29 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-21.messagelabs.com!1318611624!173820!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32224 invoked from network); 14 Oct 2011 17:00:24 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Oct 2011 17:00:24 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1REl7L-0007NE-3l
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 18:00:19 +0100
Message-Id: <E1REl7L-0007NE-3l@xenbits.xen.org>
Date: Fri, 14 Oct 2011 18:00:18 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: clean up physid_mask_t handling
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 Jan Beulich <jbeulich@suse.com>
# Date 1318587980 -7200
# Node ID e4608c0a48a15a9a66533239cd8822da4260be52
# Parent  121af976b2988de389db139231103ceedd11bb8a
x86: clean up physid_mask_t handling

This eliminates passing and returning by value of this type (making it
unnecessary for the compiler to create temporary variables for doing so
on the stack), thus dramatically reducing the stack frame sizes of a
couple of functions (was in one case over 12k for a 4095-CPU build).

In one case a local variable gets converted to a static one, possible
because the function gets called at most once (during early boot).

Some accessors get eliminated altogether as being unused or as being
equally well open coded at the place of use.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r 121af976b298 -r e4608c0a48a1 xen/arch/x86/apic.c
--- a/xen/arch/x86/apic.c	Fri Oct 14 10:17:22 2011 +0200
+++ b/xen/arch/x86/apic.c	Fri Oct 14 12:26:20 2011 +0200
@@ -1464,7 +1464,8 @@
 #ifdef CONFIG_CRASH_DUMP
     boot_cpu_physical_apicid = get_apic_id();
 #endif
-    phys_cpu_present_map = physid_mask_of_physid(boot_cpu_physical_apicid);
+    physids_clear(phys_cpu_present_map);
+    physid_set(boot_cpu_physical_apicid, phys_cpu_present_map);
 
     setup_local_APIC();
 
diff -r 121af976b298 -r e4608c0a48a1 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Fri Oct 14 10:17:22 2011 +0200
+++ b/xen/arch/x86/io_apic.c	Fri Oct 14 12:26:20 2011 +0200
@@ -1463,7 +1463,7 @@
 static void __init setup_ioapic_ids_from_mpc(void)
 {
     union IO_APIC_reg_00 reg_00;
-    physid_mask_t phys_id_present_map;
+    static physid_mask_t __initdata phys_id_present_map;
     int apic;
     int i;
     unsigned char old_id;
@@ -1481,7 +1481,7 @@
      * This is broken; anything with a real cpu count has to
      * circumvent this idiocy regardless.
      */
-    phys_id_present_map = ioapic_phys_id_map(phys_cpu_present_map);
+    ioapic_phys_id_map(&phys_id_present_map);
 
     /*
      * Set the IOAPIC ID to the value stored in the MPC table.
@@ -1508,7 +1508,7 @@
          * system must have a unique ID or we get lots of nice
          * 'stuck on smp_invalidate_needed IPI wait' messages.
          */
-        if (check_apicid_used(phys_id_present_map,
+        if (check_apicid_used(&phys_id_present_map,
                               mp_ioapics[apic].mpc_apicid)) {
             printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n",
                    apic, mp_ioapics[apic].mpc_apicid);
@@ -1519,17 +1519,13 @@
                 panic("Max APIC ID exceeded!\n");
             printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
                    i);
-            physid_set(i, phys_id_present_map);
             mp_ioapics[apic].mpc_apicid = i;
         } else {
-            physid_mask_t tmp;
-            tmp = apicid_to_cpu_present(mp_ioapics[apic].mpc_apicid);
             apic_printk(APIC_VERBOSE, "Setting %d in the "
                         "phys_id_present_map\n",
                         mp_ioapics[apic].mpc_apicid);
-            physids_or(phys_id_present_map, phys_id_present_map, tmp);
         }
-
+        set_apicid(mp_ioapics[apic].mpc_apicid, &phys_id_present_map);
 
         /*
          * We need to adjust the IRQ routing table
@@ -2195,7 +2191,6 @@
 {
     union IO_APIC_reg_00 reg_00;
     static physid_mask_t __initdata apic_id_map = PHYSID_MASK_NONE;
-    physid_mask_t tmp;
     unsigned long flags;
     int i = 0;
 
@@ -2209,7 +2204,7 @@
      */
 
     if (physids_empty(apic_id_map))
-        apic_id_map = ioapic_phys_id_map(phys_cpu_present_map);
+        ioapic_phys_id_map(&apic_id_map);
 
     spin_lock_irqsave(&ioapic_lock, flags);
     reg_00.raw = io_apic_read(ioapic, 0);
@@ -2225,10 +2220,10 @@
      * Every APIC in a system must have a unique ID or we get lots of nice 
      * 'stuck on smp_invalidate_needed IPI wait' messages.
      */
-    if (check_apicid_used(apic_id_map, apic_id)) {
+    if (check_apicid_used(&apic_id_map, apic_id)) {
 
         for (i = 0; i < get_physical_broadcast(); i++) {
-            if (!check_apicid_used(apic_id_map, i))
+            if (!check_apicid_used(&apic_id_map, i))
                 break;
         }
 
@@ -2241,8 +2236,7 @@
         apic_id = i;
     } 
 
-    tmp = apicid_to_cpu_present(apic_id);
-    physids_or(apic_id_map, apic_id_map, tmp);
+    set_apicid(apic_id, &apic_id_map);
 
     if (reg_00.bits.ID != apic_id) {
         reg_00.bits.ID = apic_id;
diff -r 121af976b298 -r e4608c0a48a1 xen/arch/x86/mpparse.c
--- a/xen/arch/x86/mpparse.c	Fri Oct 14 10:17:22 2011 +0200
+++ b/xen/arch/x86/mpparse.c	Fri Oct 14 12:26:20 2011 +0200
@@ -89,7 +89,6 @@
 					 u32 apicidx, bool_t hotplug)
 {
  	int ver, apicid, cpu = 0;
-	physid_mask_t phys_cpu;
  	
 	if (!(m->mpc_cpuflag & CPU_ENABLED))
 		return -EINVAL;
@@ -114,8 +113,7 @@
 	}
 	apic_version[apicid] = ver;
 
-	phys_cpu = apicid_to_cpu_present(apicid);
-	physids_or(phys_cpu_present_map, phys_cpu_present_map, phys_cpu);
+	set_apicid(apicid, &phys_cpu_present_map);
 
 	if (num_processors >= NR_CPUS) {
 		printk(KERN_WARNING "WARNING: NR_CPUS limit of %i reached."
diff -r 121af976b298 -r e4608c0a48a1 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c	Fri Oct 14 10:17:22 2011 +0200
+++ b/xen/arch/x86/smpboot.c	Fri Oct 14 12:26:20 2011 +0200
@@ -752,7 +752,8 @@
     {
         printk(KERN_NOTICE "SMP motherboard not detected.\n");
     init_uniprocessor:
-        phys_cpu_present_map = physid_mask_of_physid(0);
+        physids_clear(phys_cpu_present_map);
+        physid_set(0, phys_cpu_present_map);
         if (APIC_init_uniprocessor())
             printk(KERN_NOTICE "Local APIC not detected."
                    " Using dummy APIC emulation.\n");
@@ -767,7 +768,7 @@
      * CPU too, but we do it for the sake of robustness anyway.
      * Makes no sense to do this check in clustered apic mode, so skip it
      */
-    if ( !check_phys_apicid_present(boot_cpu_physical_apicid) )
+    if ( !check_apicid_present(boot_cpu_physical_apicid) )
     {
         printk("weird, boot CPU (#%d) not listed by the BIOS.\n",
                boot_cpu_physical_apicid);
diff -r 121af976b298 -r e4608c0a48a1 xen/include/asm-x86/mach-generic/mach_apic.h
--- a/xen/include/asm-x86/mach-generic/mach_apic.h	Fri Oct 14 10:17:22 2011 +0200
+++ b/xen/include/asm-x86/mach-generic/mach_apic.h	Fri Oct 14 12:26:20 2011 +0200
@@ -58,29 +58,24 @@
 			    phys_cpu_present_map);
 }
 
-static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map)
+static inline void ioapic_phys_id_map(physid_mask_t *map)
 {
-	return phys_map;
+	*map = phys_cpu_present_map;
 }
 
-static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
+static inline int check_apicid_used(const physid_mask_t *map, int apicid)
 {
-	return physid_isset(apicid, bitmap);
+	return physid_isset(apicid, *map);
 }
 
-static inline unsigned long check_apicid_present(int apicid)
+static inline int check_apicid_present(int apicid)
 {
 	return physid_isset(apicid, phys_cpu_present_map);
 }
 
-static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
+static inline void set_apicid(int phys_apicid, physid_mask_t *map)
 {
-	return physid_isset(boot_cpu_physical_apicid, phys_cpu_present_map);
-}
-
-static inline physid_mask_t apicid_to_cpu_present(int phys_apicid)
-{
-	return physid_mask_of_physid(phys_apicid);
+	physid_set(phys_apicid, *map);
 }
 
 #endif /* __ASM_MACH_APIC_H */
diff -r 121af976b298 -r e4608c0a48a1 xen/include/asm-x86/mpspec.h
--- a/xen/include/asm-x86/mpspec.h	Fri Oct 14 10:17:22 2011 +0200
+++ b/xen/include/asm-x86/mpspec.h	Fri Oct 14 12:26:20 2011 +0200
@@ -50,23 +50,6 @@
 #define physids_empty(map)			bitmap_empty((map).mask, MAX_APICS)
 #define physids_equal(map1, map2)		bitmap_equal((map1).mask, (map2).mask, MAX_APICS)
 #define physids_weight(map)			bitmap_weight((map).mask, MAX_APICS)
-#define physids_shift_right(d, s, n)		bitmap_shift_right((d).mask, (s).mask, n, MAX_APICS)
-#define physids_shift_left(d, s, n)		bitmap_shift_left((d).mask, (s).mask, n, MAX_APICS)
-#define physids_coerce(map)			((map).mask[0])
-
-#define physids_promote(physids)						\
-	({									\
-		physid_mask_t __physid_mask = PHYSID_MASK_NONE;			\
-		__physid_mask.mask[0] = physids;				\
-		__physid_mask;							\
-	})
-
-#define physid_mask_of_physid(physid)						\
-	({									\
-		physid_mask_t __physid_mask = PHYSID_MASK_NONE;			\
-		physid_set(physid, __physid_mask);				\
-		__physid_mask;							\
-	})
 
 #define PHYSID_MASK_ALL		{ {[0 ... PHYSID_ARRAY_SIZE-1] = ~0UL} }
 #define PHYSID_MASK_NONE	{ {[0 ... PHYSID_ARRAY_SIZE-1] = 0UL} }

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 14 10:10:30 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 14 Oct 2011 10:10:30 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RElHB-0004Ys-TX; Fri, 14 Oct 2011 10:10:30 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1REl7K-0003Sz-I5
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 10:00:29 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-182.messagelabs.com!1318611615!22213640!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29084 invoked from network); 14 Oct 2011 17:00:15 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Oct 2011 17:00:15 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1REl7H-0007Iq-Bz
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 18:00:15 +0100
Message-Id: <E1REl7H-0007Iq-Bz@xenbits.xen.org>
Date: Fri, 14 Oct 2011 18:00:14 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: handle evict failures
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 Olaf Hering <olaf@aepfle.de>
# Date 1318504870 -3600
# Node ID eda18b27de6ed873ceb0e2f633d04236c5479f6d
# Parent  1515484353c602c41760ff5e110f7490174537f4
xenpaging: handle evict failures

Evict of a nominated gfn must fail if some other process mapped the
page without checking the p2mt of that gfn first.
Add a check to cancel eviction if the page usage count is not 1.

Handle the possible eviction failure in the page-in paths.
After nominate and before evict, something may check the p2mt and call
populate. Handle this case and let the gfn enter the page-in path. The
gfn may still be connected to a mfn, so there is no need to allocate a
new page in prep.

Adjust do_mmu_update to return -ENOENT only if the gfn has entered the
page-in path and if it is not yet connected to a mfn. Otherwise
linux_privcmd_map_foreign_bulk() may loop forever.

Add MEM_EVENT_FLAG_EVICT_FAIL to inform pager that a page-in request for
a possible not-evicted page was sent. xenpaging does currently not need
that flag because failure to evict a gfn will be caught.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 1515484353c6 -r eda18b27de6e tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Thu Oct 13 10:09:28 2011 +0200
+++ b/tools/xenpaging/xenpaging.c	Thu Oct 13 12:21:10 2011 +0100
@@ -734,10 +734,12 @@
             }
             else
             {
-                DPRINTF("page already populated (domain = %d; vcpu = %d;"
-                        " gfn = %"PRIx64"; paused = %d)\n",
-                        paging->mem_event.domain_id, req.vcpu_id,
-                        req.gfn, req.flags & MEM_EVENT_FLAG_VCPU_PAUSED);
+                DPRINTF("page %s populated (domain = %d; vcpu = %d;"
+                        " gfn = %"PRIx64"; paused = %d; evict_fail = %d)\n",
+                        req.flags & MEM_EVENT_FLAG_EVICT_FAIL ? "not" : "already",
+                        paging->mem_event.domain_id, req.vcpu_id, req.gfn,
+                        !!(req.flags & MEM_EVENT_FLAG_VCPU_PAUSED) ,
+                        !!(req.flags & MEM_EVENT_FLAG_EVICT_FAIL) );
 
                 /* Tell Xen to resume the vcpu */
                 /* XXX: Maybe just check if the vcpu was paused? */
diff -r 1515484353c6 -r eda18b27de6e xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c	Thu Oct 13 10:09:28 2011 +0200
+++ b/xen/arch/x86/mm.c	Thu Oct 13 12:21:10 2011 +0100
@@ -3532,7 +3532,7 @@
                         rc = -ENOENT;
                         break;
                     }
-                    else if ( p2m_ram_paging_in_start == l1e_p2mt )
+                    else if ( p2m_ram_paging_in_start == l1e_p2mt && !mfn_valid(mfn) )
                     {
                         rc = -ENOENT;
                         break;
@@ -3572,7 +3572,7 @@
                         rc = -ENOENT;
                         break;
                     }
-                    else if ( p2m_ram_paging_in_start == l2e_p2mt )
+                    else if ( p2m_ram_paging_in_start == l2e_p2mt && !mfn_valid(mfn) )
                     {
                         rc = -ENOENT;
                         break;
@@ -3600,7 +3600,7 @@
                         rc = -ENOENT;
                         break;
                     }
-                    else if ( p2m_ram_paging_in_start == l3e_p2mt )
+                    else if ( p2m_ram_paging_in_start == l3e_p2mt && !mfn_valid(mfn) )
                     {
                         rc = -ENOENT;
                         break;
@@ -3628,7 +3628,7 @@
                         rc = -ENOENT;
                         break;
                     }
-                    else if ( p2m_ram_paging_in_start == l4e_p2mt )
+                    else if ( p2m_ram_paging_in_start == l4e_p2mt && !mfn_valid(mfn) )
                     {
                         rc = -ENOENT;
                         break;
diff -r 1515484353c6 -r eda18b27de6e xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Thu Oct 13 10:09:28 2011 +0200
+++ b/xen/arch/x86/mm/p2m.c	Thu Oct 13 12:21:10 2011 +0100
@@ -731,15 +731,24 @@
     if ( unlikely(!mfn_valid(mfn)) )
         goto out;
 
-    if ( (p2mt == p2m_ram_paged) || (p2mt == p2m_ram_paging_in) ||
-         (p2mt == p2m_ram_paging_in_start) )
+    /* Allow only nominated pages */
+    if ( p2mt != p2m_ram_paging_out )
         goto out;
 
+    ret = -EBUSY;
     /* Get the page so it doesn't get modified under Xen's feet */
     page = mfn_to_page(mfn);
     if ( unlikely(!get_page(page, d)) )
         goto out;
 
+    /* Check page count and type once more */
+    if ( (page->count_info & (PGC_count_mask | PGC_allocated)) !=
+         (2 | PGC_allocated) )
+        goto out_put;
+
+    if ( (page->u.inuse.type_info & PGT_type_mask) != PGT_none )
+        goto out_put;
+
     /* Decrement guest domain's ref count of the page */
     if ( test_and_clear_bit(_PGC_allocated, &page->count_info) )
         put_page(page);
@@ -751,14 +760,15 @@
     /* Clear content before returning the page to Xen */
     scrub_one_page(page);
 
-    /* Put the page back so it gets freed */
-    put_page(page);
-
     /* Track number of paged gfns */
     atomic_inc(&d->paged_pages);
 
     ret = 0;
 
+ out_put:
+    /* Put the page back so it gets freed */
+    put_page(page);
+
  out:
     p2m_unlock(p2m);
     return ret;
@@ -788,6 +798,7 @@
     mem_event_request_t req;
     p2m_type_t p2mt;
     p2m_access_t a;
+    mfn_t mfn;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
 
     /* Check that there's space on the ring for this request */
@@ -799,21 +810,26 @@
 
     /* Fix p2m mapping */
     p2m_lock(p2m);
-    p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query, NULL);
-    if ( p2mt == p2m_ram_paged )
+    mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query, NULL);
+    /* Allow only nominated or evicted pages to enter page-in path */
+    if ( p2mt == p2m_ram_paging_out || p2mt == p2m_ram_paged )
     {
-        set_p2m_entry(p2m, gfn, _mfn(INVALID_MFN), 0, 
-                      p2m_ram_paging_in_start, a);
+        /* Evict will fail now, tag this request for pager */
+        if ( p2mt == p2m_ram_paging_out )
+            req.flags |= MEM_EVENT_FLAG_EVICT_FAIL;
+
+        set_p2m_entry(p2m, gfn, mfn, 0, p2m_ram_paging_in_start, a);
         audit_p2m(p2m, 1);
     }
     p2m_unlock(p2m);
 
-    /* Pause domain */
-    if ( v->domain->domain_id == d->domain_id )
+    /* Pause domain if request came from guest and gfn has paging type */
+    if (  p2m_is_paging(p2mt) && v->domain->domain_id == d->domain_id )
     {
         vcpu_pause_nosync(v);
         req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED;
     }
+    /* No need to inform pager if the gfn is not in the page-out path */
     else if ( p2mt != p2m_ram_paging_out && p2mt != p2m_ram_paged )
     {
         /* gfn is already on its way back and vcpu is not paused */
@@ -834,20 +850,26 @@
     struct page_info *page;
     p2m_type_t p2mt;
     p2m_access_t a;
+    mfn_t mfn;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     int ret = -ENOMEM;
 
     p2m_lock(p2m);
 
-    p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query, NULL);
+    mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query, NULL);
 
-    /* Get a free page */
-    page = alloc_domheap_page(p2m->domain, 0);
-    if ( unlikely(page == NULL) )
-        goto out;
+    /* Allocate a page if the gfn does not have one yet */
+    if ( !mfn_valid(mfn) )
+    {
+        /* Get a free page */
+        page = alloc_domheap_page(p2m->domain, 0);
+        if ( unlikely(page == NULL) )
+            goto out;
+        mfn = page_to_mfn(page);
+    }
 
     /* Fix p2m mapping */
-    set_p2m_entry(p2m, gfn, page_to_mfn(page), 0, p2m_ram_paging_in, a);
+    set_p2m_entry(p2m, gfn, mfn, 0, p2m_ram_paging_in, a);
     audit_p2m(p2m, 1);
 
     atomic_dec(&d->paged_pages);
diff -r 1515484353c6 -r eda18b27de6e xen/include/public/mem_event.h
--- a/xen/include/public/mem_event.h	Thu Oct 13 10:09:28 2011 +0200
+++ b/xen/include/public/mem_event.h	Thu Oct 13 12:21:10 2011 +0100
@@ -38,6 +38,7 @@
 /* Memory event flags */
 #define MEM_EVENT_FLAG_VCPU_PAUSED  (1 << 0)
 #define MEM_EVENT_FLAG_DROP_PAGE    (1 << 1)
+#define MEM_EVENT_FLAG_EVICT_FAIL   (1 << 2)
 
 /* Reasons for the memory event request */
 #define MEM_EVENT_REASON_UNKNOWN     0    /* typical reason */

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 14 15:22:18 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 14 Oct 2011 15:22:18 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1REq8w-0000pn-5Q; Fri, 14 Oct 2011 15:22:18 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1REq8q-0000or-MQ
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 15:22:13 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-182.messagelabs.com!1318630929!22214492!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8501 invoked from network); 14 Oct 2011 22:22:09 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Oct 2011 22:22:09 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1REq8n-0006wS-59
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 23:22:09 +0100
Message-Id: <E1REq8n-0006wS-59@xenbits.xen.org>
Date: Fri, 14 Oct 2011 23:22:08 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Return -EINVAL when trying to
	kick/kill a nonexistent domain watchdog
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@xen.org>
# Date 1318612084 -3600
# Node ID 7cfd5bb3b9f9399e0ec026cf23371169c1c85606
# Parent  f63528cc50601b730a3283059fbb7e7896f97674
Return -EINVAL when trying to kick/kill a nonexistent domain watchdog

... to be more in-line with the NR_DOMAIN_WATCHDOG_TIMERS check at the
top of domain_watchdog(), and also to follow the
timer_(delete|settime)
POSIX API's EINVAL return value.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>

Also, replace EEXIST with ENOSPC when failing to allocate a new
domain watchdog.

Signed-off-by: Keir Fraser <keir@xen.org>

Committed-by: Keir Fraser <keir@xen.org>
---


diff -r f63528cc5060 -r 7cfd5bb3b9f9 xen/common/schedule.c
--- a/xen/common/schedule.c	Fri Oct 14 14:34:15 2011 +0200
+++ b/xen/common/schedule.c	Fri Oct 14 18:08:04 2011 +0100
@@ -754,14 +754,14 @@
             break;
         }
         spin_unlock(&d->watchdog_lock);
-        return id == NR_DOMAIN_WATCHDOG_TIMERS ? -EEXIST : id + 1;
+        return id == NR_DOMAIN_WATCHDOG_TIMERS ? -ENOSPC : id + 1;
     }
 
     id -= 1;
     if ( !test_bit(id, &d->watchdog_inuse_map) )
     {
         spin_unlock(&d->watchdog_lock);
-        return -EEXIST;
+        return -EINVAL;
     }
 
     if ( timeout == 0 )

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 14 15:22:29 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 14 Oct 2011 15:22:29 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1REq96-0000sv-V6; Fri, 14 Oct 2011 15:22:29 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1REq8r-0000os-6N
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 15:22:13 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-21.messagelabs.com!1318630930!195971!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 365 invoked from network); 14 Oct 2011 22:22:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Oct 2011 22:22:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1REq8n-0006wh-Mo
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 23:22:09 +0100
Message-Id: <E1REq8n-0006wh-Mo@xenbits.xen.org>
Date: Fri, 14 Oct 2011 23:22:09 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] hvmloader: Don't set
	hpet->header.length twice
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 Andrew Cooper <andrew.cooper3@citrix.com>
# Date 1318612246 -3600
# Node ID 99c7bd17846bb46fb1b3e1292d62bf4ff5e055d8
# Parent  7cfd5bb3b9f9399e0ec026cf23371169c1c85606
hvmloader: Don't set hpet->header.length twice

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 7cfd5bb3b9f9 -r 99c7bd17846b tools/firmware/hvmloader/acpi/build.c
--- a/tools/firmware/hvmloader/acpi/build.c	Fri Oct 14 18:08:04 2011 +0100
+++ b/tools/firmware/hvmloader/acpi/build.c	Fri Oct 14 18:10:46 2011 +0100
@@ -186,8 +186,7 @@
     hpet->addr.address        = ACPI_HPET_ADDRESS;
 
     hpet->header.length = sizeof(*hpet);
-    set_checksum(hpet, offsetof(struct acpi_header, checksum),
-                 hpet->header.length = sizeof(*hpet));
+    set_checksum(hpet, offsetof(struct acpi_header, checksum), sizeof(*hpet));
     return hpet;
 }
 

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 14 15:22:44 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 14 Oct 2011 15:22:44 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1REq9M-0000wL-4T; Fri, 14 Oct 2011 15:22:44 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1REq8r-0000ot-Bp
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 15:22:13 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-182.messagelabs.com!1318630930!20548296!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23687 invoked from network); 14 Oct 2011 22:22:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Oct 2011 22:22:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1REq8o-0006ww-6F
	for xen-changelog@lists.xensource.com; Fri, 14 Oct 2011 23:22:10 +0100
Message-Id: <E1REq8o-0006ww-6F@xenbits.xen.org>
Date: Fri, 14 Oct 2011 23:22:09 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] hvmloader: Add the WAET since
	Microsoft are demanding it for Windows 8
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 Andrew Cooper <andrew.cooper3@citrix.com>
# Date 1318612285 -3600
# Node ID 6880bfc48504db31e2680de01bfadf4db3b0b7a0
# Parent  99c7bd17846bb46fb1b3e1292d62bf4ff5e055d8
hvmloader: Add the WAET since Microsoft are demanding it for Windows 8

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 99c7bd17846b -r 6880bfc48504 tools/firmware/hvmloader/acpi/acpi2_0.h
--- a/tools/firmware/hvmloader/acpi/acpi2_0.h	Fri Oct 14 18:10:46 2011 +0100
+++ b/tools/firmware/hvmloader/acpi/acpi2_0.h	Fri Oct 14 18:11:25 2011 +0100
@@ -297,6 +297,14 @@
 #define ACPI_HPET_ADDRESS 0xFED00000UL
 
 /*
+ * WAET Description Table
+ */
+struct acpi_20_waet {
+    struct acpi_header header;
+    uint32_t           flags;
+};
+
+/*
  * Multiple APIC Flags.
  */
 #define ACPI_PCAT_COMPAT (1 << 0)
@@ -366,6 +374,7 @@
 #define ACPI_2_0_XSDT_SIGNATURE ASCII32('X','S','D','T')
 #define ACPI_2_0_TCPA_SIGNATURE ASCII32('T','C','P','A')
 #define ACPI_2_0_HPET_SIGNATURE ASCII32('H','P','E','T')
+#define ACPI_2_0_WAET_SIGNATURE ASCII32('W','A','E','T')
 
 /*
  * Table revision numbers.
@@ -377,6 +386,7 @@
 #define ACPI_2_0_XSDT_REVISION 0x01
 #define ACPI_2_0_TCPA_REVISION 0x02
 #define ACPI_2_0_HPET_REVISION 0x01
+#define ACPI_2_0_WAET_REVISION 0x01
 #define ACPI_1_0_FADT_REVISION 0x01
 
 #pragma pack ()
diff -r 99c7bd17846b -r 6880bfc48504 tools/firmware/hvmloader/acpi/build.c
--- a/tools/firmware/hvmloader/acpi/build.c	Fri Oct 14 18:10:46 2011 +0100
+++ b/tools/firmware/hvmloader/acpi/build.c	Fri Oct 14 18:11:25 2011 +0100
@@ -30,6 +30,7 @@
 extern struct acpi_20_xsdt Xsdt;
 extern struct acpi_20_fadt Fadt;
 extern struct acpi_20_facs Facs;
+extern struct acpi_20_waet Waet;
 
 /*
  * Located at ACPI_INFO_PHYSICAL_ADDRESS.
@@ -190,12 +191,28 @@
     return hpet;
 }
 
+static struct acpi_20_waet *construct_waet(void)
+{
+    struct acpi_20_waet *waet;
+
+    waet = mem_alloc(sizeof(*waet), 16);
+    if (!waet) return NULL;
+
+    memcpy(waet, &Waet, sizeof(*waet));
+
+    waet->header.length = sizeof(*waet);
+    set_checksum(waet, offsetof(struct acpi_header, checksum), sizeof(*waet));
+
+    return waet;
+}
+
 static int construct_secondary_tables(unsigned long *table_ptrs,
                                       struct acpi_info *info)
 {
     int nr_tables = 0;
     struct acpi_20_madt *madt;
     struct acpi_20_hpet *hpet;
+    struct acpi_20_waet *waet;
     struct acpi_20_tcpa *tcpa;
     unsigned char *ssdt;
     static const uint16_t tis_signature[] = {0x0001, 0x0001, 0x0001};
@@ -216,6 +233,11 @@
     if (!hpet) return -1;
     table_ptrs[nr_tables++] = (unsigned long)hpet;
 
+    /* WAET. */
+    waet = construct_waet();
+    if (!waet) return -1;
+    table_ptrs[nr_tables++] = (unsigned long)waet;
+
     if ( battery_port_exists() )
     {
         ssdt = mem_alloc(sizeof(ssdt_pm), 16);
diff -r 99c7bd17846b -r 6880bfc48504 tools/firmware/hvmloader/acpi/static_tables.c
--- a/tools/firmware/hvmloader/acpi/static_tables.c	Fri Oct 14 18:10:46 2011 +0100
+++ b/tools/firmware/hvmloader/acpi/static_tables.c	Fri Oct 14 18:11:25 2011 +0100
@@ -136,6 +136,26 @@
     .length    = sizeof(struct acpi_20_rsdp)
 };
 
+#define ACPI_WAET_RTC_GOOD      0x00000001
+#define ACPI_WAET_PM_TIMER_GOOD 0x00000002
+
+#define ACPI_WAET_FLAGS (ACPI_WAET_RTC_GOOD | \
+                         ACPI_WAET_PM_TIMER_GOOD)
+
+struct acpi_20_waet Waet = {
+    .header = {
+        .signature    = ACPI_2_0_WAET_SIGNATURE,
+        .length       = sizeof(struct acpi_20_waet),
+        .revision     = ACPI_2_0_WAET_REVISION,
+        .oem_id       = ACPI_OEM_ID, 
+        .oem_table_id = ACPI_OEM_TABLE_ID,
+        .oem_revision = ACPI_OEM_REVISION,
+        .creator_id   = ACPI_CREATOR_ID,
+        .creator_revision = ACPI_CREATOR_REVISION
+    },
+    .flags = ACPI_WAET_FLAGS
+};
+
 /*
  * Local variables:
  * mode: C

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 17 01:22:45 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 17 Oct 2011 01:22:45 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RFiT7-0001uI-Fd; Mon, 17 Oct 2011 01:22:45 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RFiSu-0001qZ-3e
	for xen-changelog@lists.xensource.com; Mon, 17 Oct 2011 01:22:33 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-174.messagelabs.com!1318839748!35545604!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25922 invoked from network); 17 Oct 2011 08:22:29 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Oct 2011 08:22:29 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RFiSg-0002mw-6I
	for xen-changelog@lists.xensource.com; Mon, 17 Oct 2011 09:22:18 +0100
Message-Id: <E1RFiSg-0002mw-6I@xenbits.xen.org>
Date: Mon, 17 Oct 2011 09:22:04 +0100
From: Xen patchbot-linux-2.6.18-xen <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [linux-2.6.18-xen] netback: disable features not
	supported by netfront
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 Paolo Bonzini <pbonzini@redhat.com>
# Date 1318839288 -7200
# Node ID 2d7a321286c99098a59b6e12f0e448f0cb0d6cdd
# Parent  54973d463417845c3272dc875f45a0ac6ab3594c
netback: disable features not supported by netfront

Netback works by first setting all possible features, and then
resetting some after connection, if the front-end didn't negotiate
them. Except that in the old 2.6.18 tree the "resetting" part was
missing. In the pvops tree, this should work correctly through the
fix_features mechanism.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 54973d463417 -r 2d7a321286c9 drivers/xen/netback/interface.c
--- a/drivers/xen/netback/interface.c	Thu Oct 13 09:37:50 2011 +0200
+++ b/drivers/xen/netback/interface.c	Mon Oct 17 10:14:48 2011 +0200
@@ -98,8 +98,9 @@
 void netif_set_features(netif_t *netif)
 {
 	struct net_device *dev = netif->dev;
-	int features = dev->features;
+	int features;
 
+	features = dev->features & ~(NETIF_F_SG|NETIF_F_TSO|NETIF_F_IP_CSUM);
 	if (netif->can_sg)
 		features |= NETIF_F_SG;
 	if (netif->gso)

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 17 12:44:24 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 17 Oct 2011 12:44:24 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RFt6k-0000DD-Q6; Mon, 17 Oct 2011 12:44:22 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RFt6e-0000C5-IB
	for xen-changelog@lists.xensource.com; Mon, 17 Oct 2011 12:44:16 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-182.messagelabs.com!1318880653!22504967!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14662 invoked from network); 17 Oct 2011 19:44:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Oct 2011 19:44:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RFt6a-0004PT-Gm
	for xen-changelog@lists.xensource.com; Mon, 17 Oct 2011 20:44:12 +0100
Message-Id: <E1RFt6a-0004PT-Gm@xenbits.xen.org>
Date: Mon, 17 Oct 2011 20:44:12 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: add a test case for correct
	parsing of disk "backendtype" field
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 Ian Campbell <ian.campbell@citrix.com>
# Date 1317983222 -3600
# Node ID adfde25db7a193196b411870ba7b7af02d007f1a
# Parent  dafd08abcc8d0fcf10f05f9f1715229a0898e03f
libxl: add a test case for correct parsing of disk "backendtype" field

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r dafd08abcc8d -r adfde25db7a1 tools/libxl/check-xl-disk-parse
--- a/tools/libxl/check-xl-disk-parse	Fri Oct 07 11:06:41 2011 +0100
+++ b/tools/libxl/check-xl-disk-parse	Fri Oct 07 11:27:02 2011 +0100
@@ -91,4 +91,20 @@
 one 0  format=raw  vdev=hdc  access=ro  devtype=cdrom  target=/root/image.iso
 one 0 raw:/root/image.iso,hdc:cdrom,ro
 
+expected <<EOF
+disk: {
+    "backend_domid": 0,
+    "pdev_path": "/dev/vg/guest-volume",
+    "vdev": "xvdb",
+    "backend": "phy",
+    "format": "raw",
+    "script": null,
+    "removable": 0,
+    "readwrite": 1,
+    "is_cdrom": 0
+}
+
+EOF
+one 0 backendtype=phy,vdev=xvdb,access=w,target=/dev/vg/guest-volume
+
 complete

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 17 12:44:34 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 17 Oct 2011 12:44:34 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RFt6w-0000GK-PM; Mon, 17 Oct 2011 12:44:34 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RFt6e-0000C7-Mz
	for xen-changelog@lists.xensource.com; Mon, 17 Oct 2011 12:44:17 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-216.messagelabs.com!1318880653!1442654!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17396 invoked from network); 17 Oct 2011 19:44:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-7.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Oct 2011 19:44:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RFt6Z-0004O5-Ew
	for xen-changelog@lists.xensource.com; Mon, 17 Oct 2011 20:44:11 +0100
Message-Id: <E1RFt6Z-0004O5-Ew@xenbits.xen.org>
Date: Mon, 17 Oct 2011 20:44:10 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: allow check-xl-disk-parse to run
	against installed xl as well as build dir
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 Ian Campbell <ian.campbell@citrix.com>
# Date 1317981947 -3600
# Node ID 3581fff36a3d0efa60347e5104f8b8565258719f
# Parent  1d21a34e0e296b2f3ebdd557d6515348b192cecd
xl: allow check-xl-disk-parse to run against installed xl as well as build dir

I can't run from the current directory since my build box isn't running Xen so
if ./xl doesn't exist use the installed version on the assumption that I've
copied the script to a test host.

I think running from the build dir needs the blktap2 libraries, so update
LD_LIBRARY_PATH as appropriate.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 1d21a34e0e29 -r 3581fff36a3d tools/libxl/check-xl-disk-parse
--- a/tools/libxl/check-xl-disk-parse	Fri Oct 07 11:05:45 2011 +0100
+++ b/tools/libxl/check-xl-disk-parse	Fri Oct 07 11:05:47 2011 +0100
@@ -2,6 +2,13 @@
 
 set -e
 
+if [ -x ./xl ] ; then
+    export LD_LIBRARY_PATH=.:../libxc:../xenstore:../blktap2/control
+    XL=./xl
+else
+    XL=xl
+fi
+
 fprefix=tmp.check-xl-disk-parse
 
 expected () {
@@ -14,8 +21,7 @@
     expected_rc=$1; shift
     printf "test case %s...\n" "$*"
     set +e
-    LD_LIBRARY_PATH=.:../libxc:../xenstore \
-        ./xl -N block-attach 0 "$@" </dev/null >$fprefix.actual 2>/dev/null
+    ${XL} -N block-attach 0 "$@" </dev/null >$fprefix.actual 2>/dev/null
     actual_rc=$?
     diff -u $fprefix.expected $fprefix.actual
     diff_rc=$?

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 17 12:44:57 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 17 Oct 2011 12:44:57 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RFt7J-0000Jo-JW; Mon, 17 Oct 2011 12:44:57 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RFt6e-0000C6-N2
	for xen-changelog@lists.xensource.com; Mon, 17 Oct 2011 12:44:17 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-216.messagelabs.com!1318880653!1445422!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31797 invoked from network); 17 Oct 2011 19:44:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Oct 2011 19:44:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RFt6b-0004QC-1n
	for xen-changelog@lists.xensource.com; Mon, 17 Oct 2011 20:44:13 +0100
Message-Id: <E1RFt6b-0004QC-1n@xenbits.xen.org>
Date: Mon, 17 Oct 2011 20:44:12 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: probe disk backend type in
	libxl_device_disk_add
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 Ian Campbell <ian.campbell@citrix.com>
# Date 1318498260 -3600
# Node ID 7418ade6ebe0750d00d5e26d8593a6d75f072d3b
# Parent  adfde25db7a193196b411870ba7b7af02d007f1a
libxl: probe disk backend type in libxl_device_disk_add

Without this "xl block-attach" does not work. On create do_domain_create already
catches this.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r adfde25db7a1 -r 7418ade6ebe0 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri Oct 07 11:27:02 2011 +0100
+++ b/tools/libxl/libxl.c	Thu Oct 13 10:31:00 2011 +0100
@@ -929,6 +929,9 @@
     rc = libxl__device_disk_set_backend(&gc, disk);
     if (rc) goto out;
 
+    rc = libxl__device_disk_set_backend(&gc, disk);
+    if (rc) goto out;
+
     front = flexarray_make(16, 1);
     if (!front) {
         rc = ERROR_NOMEM;

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 17 12:45:03 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 17 Oct 2011 12:45:03 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RFt7P-0000No-6y; Mon, 17 Oct 2011 12:45:03 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RFt6e-0000C8-N9
	for xen-changelog@lists.xensource.com; Mon, 17 Oct 2011 12:44:17 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-216.messagelabs.com!1318880653!1451137!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12208 invoked from network); 17 Oct 2011 19:44:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Oct 2011 19:44:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RFt6b-0004Qw-IQ
	for xen-changelog@lists.xensource.com; Mon, 17 Oct 2011 20:44:13 +0100
Message-Id: <E1RFt6b-0004Qw-IQ@xenbits.xen.org>
Date: Mon, 17 Oct 2011 20:44:13 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] ocaml: align build output
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 Ian Campbell <ian.campbell@citrix.com>
# Date 1318867530 -3600
# Node ID d5c6cbe6184b879a22ea5f87844622a548807fb0
# Parent  7418ade6ebe0750d00d5e26d8593a6d75f072d3b
ocaml: align build output

Fix:
 MLI       op.mli
 MLI      op.cmi
 MLI       partial.mli
 MLI      partial.cmi
 MLI       packet.mli

Signed-off-by: Ian Cmpabell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 7418ade6ebe0 -r d5c6cbe6184b tools/ocaml/libs/xb/Makefile
--- a/tools/ocaml/libs/xb/Makefile	Thu Oct 13 10:31:00 2011 +0100
+++ b/tools/ocaml/libs/xb/Makefile	Mon Oct 17 17:05:30 2011 +0100
@@ -31,15 +31,15 @@
 OCAML_LIBRARY = xenbus
 
 xenbus.cmx : $(foreach obj, $(OBJS), $(obj).cmx)
-	$(E) " CMX       $@"
+	$(E) " CMX      $@"
 	$(OCAMLOPT) -pack -o $@ $^
 
 xenbus.cmo : $(foreach obj, $(OBJS), $(obj).cmo)
-	$(E) " CMO       $@"
+	$(E) " CMO      $@"
 	$(OCAMLC) -pack -o $@ $^
 
 %.mli: %.ml
-	$(E) " MLI       $@"
+	$(E) " MLI      $@"
 	$(Q)$(OCAMLC) $(OCAMLINCLUDE) -i $< $o
 
 .PHONY: install

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 17 12:45:09 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 17 Oct 2011 12:45:09 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RFt7V-0000Qt-9d; Mon, 17 Oct 2011 12:45:09 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RFt6e-0000CA-Vw
	for xen-changelog@lists.xensource.com; Mon, 17 Oct 2011 12:44:17 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-21.messagelabs.com!1318880653!528236!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12766 invoked from network); 17 Oct 2011 19:44:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Oct 2011 19:44:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RFt6a-0004Om-0E
	for xen-changelog@lists.xensource.com; Mon, 17 Oct 2011 20:44:12 +0100
Message-Id: <E1RFt6a-0004Om-0E@xenbits.xen.org>
Date: Mon, 17 Oct 2011 20:44:11 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: use libxl_device_disk_to_json to
	pretty print disk configuration
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 Ian Campbell <ian.campbell@citrix.com>
# Date 1317982001 -3600
# Node ID dafd08abcc8d0fcf10f05f9f1715229a0898e03f
# Parent  3581fff36a3d0efa60347e5104f8b8565258719f
xl: use libxl_device_disk_to_json to pretty print disk configuration

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 3581fff36a3d -r dafd08abcc8d tools/libxl/check-xl-disk-parse
--- a/tools/libxl/check-xl-disk-parse	Fri Oct 07 11:05:47 2011 +0100
+++ b/tools/libxl/check-xl-disk-parse	Fri Oct 07 11:06:41 2011 +0100
@@ -51,15 +51,18 @@
 one $e foo
 
 expected <<END
-disk.backend_domid = 0
-disk.pdev_path =     /dev/vg/guest-volume
-disk.vdev =          hda
-disk.backend =       0
-disk.format =        4
-disk.script =        (null)
-disk.removable =     0
-disk.readwrite =     1
-disk.is_cdrom =      0
+disk: {
+    "backend_domid": 0,
+    "pdev_path": "/dev/vg/guest-volume",
+    "vdev": "hda",
+    "backend": "unknown",
+    "format": "raw",
+    "script": null,
+    "removable": 0,
+    "readwrite": 1,
+    "is_cdrom": 0
+}
+
 END
 one 0 /dev/vg/guest-volume,,hda
 one 0 /dev/vg/guest-volume,raw,hda,rw
@@ -68,15 +71,18 @@
 one 0 raw:/dev/vg/guest-volume,hda,w
 
 expected <<END
-disk.backend_domid = 0
-disk.pdev_path =     /root/image.iso
-disk.vdev =          hdc
-disk.backend =       0
-disk.format =        4
-disk.script =        (null)
-disk.removable =     1
-disk.readwrite =     0
-disk.is_cdrom =      1
+disk: {
+    "backend_domid": 0,
+    "pdev_path": "/root/image.iso",
+    "vdev": "hdc",
+    "backend": "unknown",
+    "format": "raw",
+    "script": null,
+    "removable": 1,
+    "readwrite": 0,
+    "is_cdrom": 1
+}
+
 END
 one 0 /root/image.iso,,hdc,cdrom
 one 0 /root/image.iso,,hdc,,cdrom
diff -r 3581fff36a3d -r dafd08abcc8d tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Fri Oct 07 11:05:47 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Fri Oct 07 11:06:41 2011 +0100
@@ -4112,17 +4112,9 @@
     disk.backend_domid = be_domid;
 
     if (dryrun_only) {
-        /* fixme: this should be generated from the idl */
-        /* fixme: enums (backend, format) should be converted to strings */
-        printf("disk.backend_domid = %"PRIx32"\n", disk.backend_domid);
-        printf("disk.pdev_path =     %s\n",        disk.pdev_path);
-        printf("disk.vdev =          %s\n",        disk.vdev);
-        printf("disk.backend =       %d\n",        disk.backend);
-        printf("disk.format =        %d\n",        disk.format);
-        printf("disk.script =        %s\n",        disk.script);
-        printf("disk.removable =     %d\n",        disk.removable);
-        printf("disk.readwrite =     %d\n",        disk.readwrite);
-        printf("disk.is_cdrom =      %d\n",        disk.is_cdrom);
+        char *json = libxl_device_disk_to_json(ctx, &disk);
+        printf("disk: %s\n", json);
+        free(json);
         if (ferror(stdout) || fflush(stdout)) { perror("stdout"); exit(-1); }
         return 0;
     }

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 17 12:45:19 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 17 Oct 2011 12:45:19 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RFt7e-0000UA-BV; Mon, 17 Oct 2011 12:45:18 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RFt6f-0000CB-9a
	for xen-changelog@lists.xensource.com; Mon, 17 Oct 2011 12:44:17 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-182.messagelabs.com!1318880654!19854969!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19264 invoked from network); 17 Oct 2011 19:44:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Oct 2011 19:44:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RFt6c-0004Re-4X
	for xen-changelog@lists.xensource.com; Mon, 17 Oct 2011 20:44:14 +0100
Message-Id: <E1RFt6c-0004Re-4X@xenbits.xen.org>
Date: Mon, 17 Oct 2011 20:44:13 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: correctly propagate errors
	from libxl_domain_resume
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 Ian Campbell <ian.campbell@citrix.com>
# Date 1318495026 -3600
# Node ID 12060584f58a797cad7b71947d8ce65e93700f4f
# Parent  d5c6cbe6184b879a22ea5f87844622a548807fb0
libxl: correctly propagate errors from libxl_domain_resume

currently it return success no matter what.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r d5c6cbe6184b -r 12060584f58a tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Mon Oct 17 17:05:30 2011 +0100
+++ b/tools/libxl/libxl.c	Thu Oct 13 09:37:06 2011 +0100
@@ -261,7 +261,7 @@
     }
 out:
     libxl__free_all(&gc);
-    return 0;
+    return rc;
 }
 
 /*

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 17 12:45:27 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 17 Oct 2011 12:45:27 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RFt7m-0000XA-G9; Mon, 17 Oct 2011 12:45:26 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RFt6e-0000C9-TX
	for xen-changelog@lists.xensource.com; Mon, 17 Oct 2011 12:44:18 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1318880653!35603008!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29050 invoked from network); 17 Oct 2011 19:44:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Oct 2011 19:44:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RFt6Y-0004Mm-RB
	for xen-changelog@lists.xensource.com; Mon, 17 Oct 2011 20:44:10 +0100
Message-Id: <E1RFt6Y-0004Mm-RB@xenbits.xen.org>
Date: Mon, 17 Oct 2011 20:44:09 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: IDL: autogenerate functions
	to produce JSON from libxl data structures.
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 Ian Campbell <ian.campbell@citrix.com>
# Date 1317981945 -3600
# Node ID 1d21a34e0e296b2f3ebdd557d6515348b192cecd
# Parent  6880bfc48504db31e2680de01bfadf4db3b0b7a0
libxl: IDL: autogenerate functions to produce JSON from libxl data structures.

Two functions are provided. TYPE_gen_json exposes an interface which is
compatible with the YAGL generator infrastructure. TYPE_to_string uses this to
produce a pretty printed string.

The TYPE_gen_json functions are defined in a new header libxl_json.h which is
not exposed via libxl.h due to the use of YAGL datatypes to avoid poluting the
namespace us libxl users which don't use the library themselves.  If a libxl
user is interested in integrating at the YAGL level then it should #include
this file itself.

Also update testidl to generate a random version of each IDL datastructure and
convert it to JSON. Unfortunately this requires a libxl_ctx and therefore the
test must be run on a Xen system now.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 6880bfc48504 -r 1d21a34e0e29 tools/libxl/Makefile
--- a/tools/libxl/Makefile	Fri Oct 14 18:11:25 2011 +0100
+++ b/tools/libxl/Makefile	Fri Oct 07 11:05:45 2011 +0100
@@ -84,14 +84,17 @@
 libxl_paths.c: _libxl_paths.h
 
 libxl.h: _libxl_types.h
+libxl_json.h: _libxl_types_json.h
 libxl_internal.h: _libxl_types_internal.h
+libxl_internal_json.h: _libxl_types_internal_json.h
 
 $(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS): libxl.h
 $(LIBXL_OBJS): libxl_internal.h
 
-_libxl_type%.h _libxl_type%.c: libxl_type%.idl gentypes.py libxltypes.py
-	$(PYTHON) gentypes.py libxl_type$*.idl __libxl_type$*.h __libxl_type$*.c
+_libxl_type%.h _libxl_type%_json.h _libxl_type%.c: libxl_type%.idl gentypes.py libxltypes.py
+	$(PYTHON) gentypes.py libxl_type$*.idl __libxl_type$*.h __libxl_type$*_json.h __libxl_type$*.c
 	$(call move-if-changed,__libxl_type$*.h,_libxl_type$*.h)
+	$(call move-if-changed,__libxl_type$*_json.h,_libxl_type$*_json.h)
 	$(call move-if-changed,__libxl_type$*.c,_libxl_type$*.c)
 
 libxenlight.so: libxenlight.so.$(MAJOR)
@@ -140,7 +143,7 @@
 	ln -sf libxlutil.so.$(XLUMAJOR).$(XLUMINOR) $(DESTDIR)$(LIBDIR)/libxlutil.so.$(XLUMAJOR)
 	ln -sf libxlutil.so.$(XLUMAJOR) $(DESTDIR)$(LIBDIR)/libxlutil.so
 	$(INSTALL_DATA) libxlutil.a $(DESTDIR)$(LIBDIR)
-	$(INSTALL_DATA) libxl.h _libxl_types.h libxl_utils.h libxl_uuid.h $(DESTDIR)$(INCLUDEDIR)
+	$(INSTALL_DATA) libxl.h libxl_json.h _libxl_types.h _libxl_types_json.h libxl_utils.h libxl_uuid.h $(DESTDIR)$(INCLUDEDIR)
 	$(INSTALL_DATA) bash-completion $(DESTDIR)$(BASH_COMPLETION_DIR)/xl.sh
 
 .PHONY: clean
diff -r 6880bfc48504 -r 1d21a34e0e29 tools/libxl/gentest.py
--- a/tools/libxl/gentest.py	Fri Oct 14 18:11:25 2011 +0100
+++ b/tools/libxl/gentest.py	Fri Oct 07 11:05:45 2011 +0100
@@ -5,6 +5,7 @@
 import random
 
 import libxltypes
+
 def randomize_char(c):
     if random.random() < 0.5:
         return str.lower(c)
@@ -15,6 +16,55 @@
     r = [randomize_char(c) for c in s]
     return "".join(r)
 
+def randomize_enum(e):
+    return random.choice([v.name for v in e.values])
+
+handcoded = ["libxl_cpumap", "libxl_key_value_list",
+             "libxl_cpuid_policy_list", "libxl_file_reference",
+             "libxl_string_list", "libxl_cpuarray"]
+
+def gen_rand_init(ty, v, indent = "    ", parent = None):
+    s = ""
+    if isinstance(ty, libxltypes.Enumeration):
+        s += "%s = %s;\n" % (ty.pass_arg(v, parent is None), randomize_enum(ty))
+    elif isinstance(ty, libxltypes.KeyedUnion):
+        if parent is None:
+            raise Exception("KeyedUnion type must have a parent")
+        s += "switch (%s) {\n" % (parent + ty.keyvar_name)
+        for f in ty.fields:
+            (nparent,fexpr) = ty.member(v, f, parent is None)
+            s += "case %s:\n" % f.enumname
+            s += gen_rand_init(f.type, fexpr, indent + "    ", nparent)
+            s += "    break;\n"
+        s += "}\n"
+    elif isinstance(ty, libxltypes.Struct) \
+     and (parent is None or ty.json_fn is None):
+        for f in [f for f in ty.fields if not f.const]:
+            (nparent,fexpr) = ty.member(v, f, parent is None)
+            s += gen_rand_init(f.type, fexpr, "", nparent)
+    elif hasattr(ty, "rand_init") and ty.rand_init is not None:
+        s += "%s(%s);\n" % (ty.rand_init,
+                            ty.pass_arg(v, isref=parent is None,
+                                        passby=libxltypes.PASS_BY_REFERENCE))
+    elif ty.typename in ["libxl_uuid", "libxl_mac", "libxl_hwcap"]:
+        s += "rand_bytes((uint8_t *)%s, sizeof(*%s));\n" % (v,v)
+    elif ty.typename in ["libxl_domid"] or isinstance(ty, libxltypes.Number):
+        s += "%s = rand() %% (sizeof(%s)*8);\n" % \
+             (ty.pass_arg(v, parent is None),
+              ty.pass_arg(v, parent is None))
+    elif ty.typename in ["bool"]:
+        s += "%s = rand() %% 2;\n" % v
+    elif ty.typename in ["char *"]:
+        s += "%s = rand_str();\n" % v
+    elif ty.typename in handcoded:
+        raise Exception("Gen for handcoded %s" % ty.typename)
+    else:
+        raise Exception("Cannot randomly init %s" % ty.typename)
+
+    if s != "":
+        s = indent + s
+    return s.replace("\n", "\n%s" % indent).rstrip(indent)
+
 if __name__ == '__main__':
     if len(sys.argv) < 3:
         print >>sys.stderr, "Usage: gentest.py <idl> <implementation>"
@@ -23,27 +73,208 @@
     random.seed()
 
     idl = sys.argv[1]
-    (_,types) = libxltypes.parse(idl)
+    (builtins,types) = libxltypes.parse(idl)
 
     impl = sys.argv[2]
     f = open(impl, "w")
     f.write("""
 #include <stdio.h>
-#include \"libxl.h\"
+#include <stdlib.h>
+#include <string.h>
 
+#include "libxl.h"
+#include "libxl_utils.h"
+
+static char *rand_str(void)
+{
+    int i, sz = rand() % 32;
+    char *s = malloc(sz+1);
+    for (i=0; i<sz; i++)
+        s[i] = 'a' + (rand() % 26);
+    s[i] = '\\0';
+    return s;
+}
+
+static void rand_bytes(uint8_t *p, size_t sz)
+{
+    int i;
+    for (i=0; i<sz; i++)
+        p[i] = rand() % 256;
+}
+
+static void libxl_cpumap_rand_init(libxl_cpumap *cpumap)
+{
+    int i;
+    cpumap->size = rand() % 16;
+    cpumap->map = calloc(cpumap->size, sizeof(*cpumap->map));
+    libxl_for_each_cpu(i, *cpumap) {
+        if (rand() % 2)
+            libxl_cpumap_set(cpumap, i);
+        else
+            libxl_cpumap_reset(cpumap, i);
+    }
+}
+
+static void libxl_key_value_list_rand_init(libxl_key_value_list *pkvl)
+{
+    int i, nr_kvp = rand() % 16;
+    libxl_key_value_list kvl = calloc(nr_kvp+1, 2*sizeof(char *));
+
+    for (i = 0; i<2*nr_kvp; i += 2) {
+        kvl[i] = rand_str();
+        if (rand() % 8)
+            kvl[i+1] = rand_str();
+        else
+            kvl[i+1] = NULL;
+    }
+    kvl[i] = NULL;
+    kvl[i+1] = NULL;
+    *pkvl = kvl;
+}
+
+static void libxl_cpuid_policy_list_rand_init(libxl_cpuid_policy_list *pp)
+{
+    int i, nr_policies = rand() % 16;
+    struct {
+        const char *n;
+        int w;
+    } options[] = {
+      /* A random selection from libxl_cpuid_parse_config */
+        {"maxleaf",     32},
+        {"family",       8},
+        {"model",        8},
+        {"stepping",     4},
+        {"localapicid",  8},
+        {"proccount",    8},
+        {"clflush",      8},
+        {"brandid",      8},
+        {"f16c",         1},
+        {"avx",          1},
+        {"osxsave",      1},
+        {"xsave",        1},
+        {"aes",          1},
+        {"popcnt",       1},
+        {"movbe",        1},
+        {"x2apic",       1},
+        {"sse4.2",       1},
+        {"sse4.1",       1},
+        {"dca",          1},
+        {"pdcm",         1},
+        {"procpkg",      6},
+    };
+    const int nr_options = sizeof(options)/sizeof(options[0]);
+    char buf[64];
+    libxl_cpuid_policy_list p = NULL;
+
+    for (i = 0; i < nr_policies; i++) {
+        int opt = rand() % nr_options;
+        int val = rand() % (1<<options[opt].w);
+        snprintf(buf, 64, \"%s=%#x\", options[opt].n, val);
+        libxl_cpuid_parse_config(&p, buf);
+    }
+    *pp = p;
+}
+
+static void libxl_file_reference_rand_init(libxl_file_reference *p)
+{
+    memset(p, 0, sizeof(*p));
+    if (rand() % 8)
+        p->path = rand_str();
+}
+
+static void libxl_string_list_rand_init(libxl_string_list *p)
+{
+    int i, nr = rand() % 16;
+    libxl_string_list l = calloc(nr+1, sizeof(char *));
+
+    for (i = 0; i<nr; i++) {
+        l[i] = rand_str();
+    }
+    l[i] = NULL;
+    *p = l;
+}
+
+static void libxl_cpuarray_rand_init(libxl_cpuarray *p)
+{
+    int i;
+    /* Up to 16 VCPUs on 32 PCPUS */
+    p->entries = rand() % 16;
+    p->array = calloc(p->entries, sizeof(*p->array));
+    for (i = 0; i < p->entries; i++) {
+        int r = rand() % 32*1.5; /* 2:1 valid:invalid */
+        if (r >= 32)
+            p->array[i] = LIBXL_CPUARRAY_INVALID_ENTRY;
+        else
+            p->array[i] = r;
+    }
+}
+""")
+    for ty in builtins + types:
+        if ty.typename not in handcoded:
+            f.write("static void %s_rand_init(%s);\n" % \
+                    (ty.typename,
+                     ty.make_arg("p", passby=libxltypes.PASS_BY_REFERENCE)))
+            f.write("static void %s_rand_init(%s)\n" % \
+                    (ty.typename,
+                     ty.make_arg("p", passby=libxltypes.PASS_BY_REFERENCE)))
+            f.write("{\n")
+            f.write(gen_rand_init(ty, "p"))
+            f.write("}\n")
+            f.write("\n")
+        ty.rand_init = "%s_rand_init" % ty.typename
+
+    f.write("""
 int main(int argc, char **argv)
 {
 """)
 
-    for ty in [t for t in types if isinstance(t,libxltypes.Enumeration)]:
+    for ty in types:
         f.write("    %s %s_val;\n" % (ty.typename, ty.typename))
-    f.write("    int rc;\n")
-    f.write("\n")
+    f.write("""
+    int rc;
+    char *s;
+    xentoollog_logger_stdiostream *logger;
+    libxl_ctx *ctx;
 
+    logger = xtl_createlogger_stdiostream(stderr, XTL_DETAIL, 0);
+    if (!logger) exit(1);
+
+    if (libxl_ctx_alloc(&ctx, LIBXL_VERSION, (xentoollog_logger*)logger)) {
+        fprintf(stderr, "cannot init xl context\\n");
+        exit(1);
+    }
+""")
+    f.write("    printf(\"Testing TYPE_to_json()\\n\");\n")
+    f.write("    printf(\"----------------------\\n\");\n")
+    f.write("    printf(\"\\n\");\n")
+    for ty in [t for t in types if t.json_fn is not None]:
+        arg = ty.typename + "_val"
+        f.write("    %s_rand_init(%s);\n" % (ty.typename, \
+            ty.pass_arg(arg, isref=False, passby=libxltypes.PASS_BY_REFERENCE)))
+        f.write("    s = %s_to_json(ctx, %s);\n" % \
+                (ty.typename, ty.pass_arg(arg, isref=False)))
+        f.write("    printf(\"%%s: %%s\\n\", \"%s\", s);\n" % ty.typename)
+        f.write("    if (s == NULL) abort();\n")
+        f.write("    free(s);\n")
+        if ty.destructor_fn is not None:
+            f.write("    %s(&%s_val);\n" % (ty.destructor_fn, ty.typename))
+        f.write("\n")
+
+    f.write("    printf(\"Testing Enumerations\\n\");\n")
+    f.write("    printf(\"--------------------\\n\");\n")
+    f.write("    printf(\"\\n\");\n")
     for ty in [t for t in types if isinstance(t,libxltypes.Enumeration)]:
         f.write("    printf(\"%s -- to string:\\n\");\n" % (ty.typename))
         for v in ty.values:
-            f.write("    printf(\"\\t%s = %%d = \\\"%%s\\\"\\n\", %s, %s_to_string(%s));\n" %\
+            f.write("    printf(\"\\t%s = %%d = \\\"%%s\\\"\\n\", " \
+                    "%s, %s_to_string(%s));\n" % \
+                    (v.valuename, v.name, ty.typename, v.name))
+        f.write("\n")
+
+        f.write("    printf(\"%s -- to JSON:\\n\");\n" % (ty.typename))
+        for v in ty.values:
+            f.write("    printf(\"\\t%s = %%d = %%s\", " \
+                    "%s, %s_to_json(ctx, %s));\n" %\
                     (v.valuename, v.name, ty.typename, v.name))
         f.write("\n")
 
@@ -54,10 +285,16 @@
             f.write("    rc = %s_from_string(\"%s\", &%s_val);\n" %\
                     (ty.typename, n, ty.typename))
 
-            f.write("    printf(\"\\t%s = \\\"%%s\\\" = %%d (rc %%d)\\n\", \"%s\", %s_val, rc);\n" %\
+            f.write("    printf(\"\\t%s = \\\"%%s\\\" = %%d (rc %%d)\\n\", " \
+                    "\"%s\", %s_val, rc);\n" %\
                     (v, n, ty.typename))
         f.write("\n")
 
-    f.write("""return 0;
+    f.write("""
+
+    libxl_ctx_free(ctx);
+    xtl_logger_destroy((xentoollog_logger*)logger);
+
+    return 0;
 }
 """)
diff -r 6880bfc48504 -r 1d21a34e0e29 tools/libxl/gentypes.py
--- a/tools/libxl/gentypes.py	Fri Oct 14 18:11:25 2011 +0100
+++ b/tools/libxl/gentypes.py	Fri Oct 07 11:05:45 2011 +0100
@@ -29,7 +29,6 @@
 
 def libxl_C_type_define(ty, indent = ""):
     s = ""
-
     if isinstance(ty, libxltypes.Enumeration):
         if ty.comment is not None:
             s += format_comment(0, ty.comment)
@@ -76,7 +75,6 @@
     return s.replace("\n", "\n%s" % indent)
 
 def libxl_C_type_destroy(ty, v, indent = "    ", parent = None):
-
     s = ""
     if isinstance(ty, libxltypes.KeyedUnion):
         if parent is None:
@@ -100,6 +98,60 @@
         s = indent + s
     return s.replace("\n", "\n%s" % indent).rstrip(indent)
 
+def libxl_C_type_gen_json(ty, v, indent = "    ", parent = None):
+    s = ""
+    if parent is None:
+        s += "yajl_gen_status s;\n"
+    if isinstance(ty, libxltypes.Enumeration):
+        s += "s = libxl__yajl_gen_enum(hand, %s_to_string(%s));\n" % (ty.typename, ty.pass_arg(v, parent is None))
+        s += "if (s != yajl_gen_status_ok)\n"
+        s += "    goto out;\n"
+    elif isinstance(ty, libxltypes.KeyedUnion):
+        if parent is None:
+            raise Exception("KeyedUnion type must have a parent")
+        s += "switch (%s) {\n" % (parent + ty.keyvar_name)
+        for f in ty.fields:
+            (nparent,fexpr) = ty.member(v, f, parent is None)
+            s += "case %s:\n" % f.enumname
+            s += libxl_C_type_gen_json(f.type, fexpr, indent + "    ", nparent)
+            s += "    break;\n"
+        s += "}\n"
+    elif isinstance(ty, libxltypes.Struct) and (parent is None or ty.json_fn is None):
+        s += "s = yajl_gen_map_open(hand);\n"
+        s += "if (s != yajl_gen_status_ok)\n"
+        s += "    goto out;\n"
+        for f in [f for f in ty.fields if not f.const]:
+            (nparent,fexpr) = ty.member(v, f, parent is None)
+            s += "s = yajl_gen_string(hand, (const unsigned char *)\"%s\", sizeof(\"%s\")-1);\n" % (f.name, f.name)
+            s += "if (s != yajl_gen_status_ok)\n"
+            s += "    goto out;\n"
+            s += libxl_C_type_gen_json(f.type, fexpr, "", nparent)
+        s += "s = yajl_gen_map_close(hand);\n"
+        s += "if (s != yajl_gen_status_ok)\n"
+        s += "    goto out;\n"
+    else:
+        if ty.json_fn is not None:
+            s += "s = %s(hand, %s);\n" % (ty.json_fn, ty.pass_arg(v, parent is None))
+            s += "if (s != yajl_gen_status_ok)\n"
+            s += "    goto out;\n"
+
+    if parent is None:
+        s += "out:\n"
+        s += "return s;\n"
+
+    if s != "":
+        s = indent + s
+    return s.replace("\n", "\n%s" % indent).rstrip(indent)
+
+def libxl_C_type_to_json(ty, v, indent = "    "):
+    s = ""
+    gen = "(libxl__gen_json_callback)&%s_gen_json" % ty.typename
+    s += "return libxl__object_to_json(ctx, \"%s\", %s, (void *)%s);\n" % (ty.typename, gen, ty.pass_arg(v, passby=libxltypes.PASS_BY_REFERENCE))
+
+    if s != "":
+        s = indent + s
+    return s.replace("\n", "\n%s" % indent).rstrip(indent)
+
 def libxl_C_enum_to_string(ty, e, indent = "    "):
     s = ""
     s += "switch(%s) {\n" % e
@@ -138,13 +190,13 @@
 
 
 if __name__ == '__main__':
-    if len(sys.argv) != 4:
-        print >>sys.stderr, "Usage: gentypes.py <idl> <header> <implementation>"
+    if len(sys.argv) != 5:
+        print >>sys.stderr, "Usage: gentypes.py <idl> <header> <header-json> <implementation>"
         sys.exit(1)
 
-    (_, idl, header, impl) = sys.argv
+    (_, idl, header, header_json, impl) = sys.argv
 
-    (_,types) = libxltypes.parse(idl)
+    (builtins,types) = libxltypes.parse(idl)
 
     print "outputting libxl type definitions to %s" % header
 
@@ -167,6 +219,8 @@
         f.write(libxl_C_type_define(ty) + ";\n")
         if ty.destructor_fn is not None:
             f.write("void %s(%s);\n" % (ty.destructor_fn, ty.make_arg("p")))
+        if ty.json_fn is not None:
+            f.write("char *%s_to_json(libxl_ctx *ctx, %s);\n" % (ty.typename, ty.make_arg("p")))
         if isinstance(ty, libxltypes.Enumeration):
             f.write("const char *%s_to_string(%s);\n" % (ty.typename, ty.make_arg("p")))
             f.write("int %s_from_string(const char *s, %s);\n" % (ty.typename, ty.make_arg("e", passby=libxltypes.PASS_BY_REFERENCE)))
@@ -176,6 +230,30 @@
     f.write("""#endif /* %s */\n""" % (header_define))
     f.close()
 
+    print "outputting libxl JSON definitions to %s" % header_json
+
+    f = open(header_json, "w")
+
+    header_json_define = header_json.upper().replace('.','_')
+    f.write("""#ifndef %s
+#define %s
+
+/*
+ * DO NOT EDIT.
+ *
+ * This file is autogenerated by
+ * "%s"
+ */
+
+""" % (header_json_define, header_json_define, " ".join(sys.argv)))
+
+    for ty in [ty for ty in types+builtins if ty.json_fn is not None]:
+        f.write("yajl_gen_status %s_gen_json(yajl_gen hand, %s);\n" % (ty.typename, ty.make_arg("p", passby=libxltypes.PASS_BY_REFERENCE)))
+
+    f.write("\n")
+    f.write("""#endif /* %s */\n""" % header_json_define)
+    f.close()
+
     print "outputting libxl type implementations to %s" % impl
 
     f = open(impl, "w")
@@ -222,5 +300,17 @@
         f.write("}\n")
         f.write("\n")
 
+    for ty in [t for t in types if t.json_fn is not None]:
+        f.write("yajl_gen_status %s_gen_json(yajl_gen hand, %s)\n" % (ty.typename, ty.make_arg("p", passby=libxltypes.PASS_BY_REFERENCE)))
+        f.write("{\n")
+        f.write(libxl_C_type_gen_json(ty, "p"))
+        f.write("}\n")
+        f.write("\n")
+
+        f.write("char *%s_to_json(libxl_ctx *ctx, %s)\n" % (ty.typename, ty.make_arg("p")))
+        f.write("{\n")
+        f.write(libxl_C_type_to_json(ty, "p"))
+        f.write("}\n")
+        f.write("\n")
 
     f.close()
diff -r 6880bfc48504 -r 1d21a34e0e29 tools/libxl/idl.txt
--- a/tools/libxl/idl.txt	Fri Oct 14 18:11:25 2011 +0100
+++ b/tools/libxl/idl.txt	Fri Oct 07 11:05:45 2011 +0100
@@ -49,6 +49,15 @@
  Indicates if the above named Type.destructor_fn should be
  autogenerated.
 
+Type.json_fn: (default: typename + "_gen_json" or None if type == None)
+
+ The name of the C function which will generate a YAJL data structure
+ representing this type.
+
+Type.autogenerate_json: (default: True)
+
+ Indicates if the above named Type.json_fn should be autogenerated.
+
 Other simple type-Classes
 -------------------------
 
diff -r 6880bfc48504 -r 1d21a34e0e29 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Fri Oct 14 18:11:25 2011 +0100
+++ b/tools/libxl/libxl.h	Fri Oct 07 11:05:45 2011 +0100
@@ -199,10 +199,10 @@
     int v;
 } libxl_enum_string_table;
 
+typedef struct libxl__ctx libxl_ctx;
+
 #include "_libxl_types.h"
 
-typedef struct libxl__ctx libxl_ctx;
-
 const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx);
 
 typedef struct {
diff -r 6880bfc48504 -r 1d21a34e0e29 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Fri Oct 14 18:11:25 2011 +0100
+++ b/tools/libxl/libxl_internal.h	Fri Oct 07 11:05:45 2011 +0100
@@ -35,7 +35,9 @@
 
 #include "flexarray.h"
 #include "libxl_utils.h"
+
 #include "_libxl_types_internal.h"
+#include "libxl_json.h"
 
 #define LIBXL_DESTROY_TIMEOUT 10
 #define LIBXL_DEVICE_MODEL_START_TIMEOUT 10
@@ -362,6 +364,14 @@
 _hidden int libxl__enum_from_string(const libxl_enum_string_table *t,
                                     const char *s, int *e);
 
+_hidden yajl_gen_status libxl__yajl_gen_asciiz(yajl_gen hand, const char *str);
+
+_hidden yajl_gen_status libxl__string_gen_json(yajl_gen hand, const char *p);
+
+typedef yajl_gen_status (*libxl__gen_json_callback)(yajl_gen hand, void *);
+_hidden char *libxl__object_to_json(libxl_ctx *ctx, const char *type,
+                                    libxl__gen_json_callback gen, void *p);
+
   /* holds the CPUID response for a single CPUID leaf
    * input contains the value of the EAX and ECX register,
    * and each policy string contains a filter to apply to
@@ -447,6 +457,7 @@
 #include <yajl/yajl_gen.h>
 
 _hidden yajl_gen_status libxl__yajl_gen_asciiz(yajl_gen hand, const char *str);
+_hidden yajl_gen_status libxl__yajl_gen_enum(yajl_gen hand, const char *str);
 
 typedef enum {
     JSON_ERROR,
diff -r 6880bfc48504 -r 1d21a34e0e29 tools/libxl/libxl_json.c
--- a/tools/libxl/libxl_json.c	Fri Oct 14 18:11:25 2011 +0100
+++ b/tools/libxl/libxl_json.c	Fri Oct 07 11:05:45 2011 +0100
@@ -18,6 +18,7 @@
 #include <yajl/yajl_parse.h>
 #include <yajl/yajl_gen.h>
 
+#include <libxl.h>
 #include "libxl_internal.h"
 
 /* #define DEBUG_ANSWER */
@@ -71,6 +72,216 @@
     return yajl_gen_string(hand, (const unsigned char *)str, strlen(str));
 }
 
+yajl_gen_status libxl__yajl_gen_enum(yajl_gen hand, const char *str)
+{
+    if (str)
+        return libxl__yajl_gen_asciiz(hand, str);
+    else
+        return yajl_gen_null(hand);
+}
+
+/*
+ * YAJL generators for builtin libxl types.
+ */
+yajl_gen_status libxl_uuid_gen_json(yajl_gen hand,
+                                    libxl_uuid *uuid)
+{
+    char buf[LIBXL_UUID_FMTLEN+1];
+    snprintf(buf, sizeof(buf), LIBXL_UUID_FMT, LIBXL_UUID_BYTES((*uuid)));
+    return yajl_gen_string(hand, (const unsigned char *)buf, LIBXL_UUID_FMTLEN);
+}
+
+yajl_gen_status libxl_cpumap_gen_json(yajl_gen hand,
+                                      libxl_cpumap *cpumap)
+{
+    yajl_gen_status s;
+    int i;
+
+    s = yajl_gen_array_open(hand);
+    if (s != yajl_gen_status_ok) goto out;
+
+    libxl_for_each_cpu(i, *cpumap) {
+        if (libxl_cpumap_test(cpumap, i)) {
+            s = yajl_gen_integer(hand, i);
+            if (s != yajl_gen_status_ok) goto out;
+        }
+    }
+    s = yajl_gen_array_close(hand);
+out:
+    return s;
+}
+
+yajl_gen_status libxl_key_value_list_gen_json(yajl_gen hand,
+                                              libxl_key_value_list *pkvl)
+{
+    libxl_key_value_list kvl = *pkvl;
+    yajl_gen_status s;
+    int i;
+
+    s = yajl_gen_map_open(hand);
+    if (s != yajl_gen_status_ok) goto out;
+
+    if (!kvl) goto empty;
+
+    for (i = 0; kvl[i] != NULL; i += 2) {
+        s = libxl__yajl_gen_asciiz(hand, kvl[i]);
+        if (s != yajl_gen_status_ok) goto out;
+        if (kvl[i + 1])
+            s = libxl__yajl_gen_asciiz(hand, kvl[i+1]);
+        else
+            s = yajl_gen_null(hand);
+        if (s != yajl_gen_status_ok) goto out;
+    }
+empty:
+    s = yajl_gen_map_close(hand);
+out:
+    return s;
+}
+
+yajl_gen_status libxl_cpuid_policy_list_gen_json(yajl_gen hand,
+                                libxl_cpuid_policy_list *pcpuid)
+{
+    libxl_cpuid_policy_list cpuid = *pcpuid;
+    yajl_gen_status s;
+    const char *input_names[2] = { "leaf", "subleaf" };
+    const char *policy_names[4] = { "eax", "ebx", "ecx", "edx" };
+    int i, j;
+
+    /*
+     * Aiming for:
+     * [
+     *     { 'leaf':    'val-eax',
+     *       'subleaf': 'val-ecx',
+     *       'eax':     'filter',
+     *       'ebx':     'filter',
+     *       'ecx':     'filter',
+     *       'edx':     'filter' },
+     *     { 'leaf':    'val-eax', ..., 'eax': 'filter', ... },
+     *     ... etc ...
+     * ]
+     */
+
+    s = yajl_gen_array_open(hand);
+    if (s != yajl_gen_status_ok) goto out;
+
+    if (cpuid == NULL) goto empty;
+
+    for (i = 0; cpuid[i].input[0] != XEN_CPUID_INPUT_UNUSED; i++) {
+        s = yajl_gen_map_open(hand);
+        if (s != yajl_gen_status_ok) goto out;
+
+        for (j = 0; j < 2; j++) {
+            if (cpuid[i].input[j] != XEN_CPUID_INPUT_UNUSED) {
+                s = libxl__yajl_gen_asciiz(hand, input_names[j]);
+                if (s != yajl_gen_status_ok) goto out;
+                s = yajl_gen_integer(hand, cpuid[i].input[j]);
+                if (s != yajl_gen_status_ok) goto out;
+            }
+        }
+
+        for (j = 0; j < 4; j++) {
+            if (cpuid[i].policy[j] != NULL) {
+                s = libxl__yajl_gen_asciiz(hand, policy_names[j]);
+                if (s != yajl_gen_status_ok) goto out;
+                s = yajl_gen_string(hand,
+                               (const unsigned char *)cpuid[i].policy[j], 32);
+                if (s != yajl_gen_status_ok) goto out;
+            }
+        }
+        s = yajl_gen_map_close(hand);
+        if (s != yajl_gen_status_ok) goto out;
+    }
+
+empty:
+    s = yajl_gen_array_close(hand);
+out:
+    return s;
+}
+
+yajl_gen_status libxl_string_list_gen_json(yajl_gen hand, libxl_string_list *pl)
+{
+    libxl_string_list l = *pl;
+    yajl_gen_status s;
+    int i;
+
+    s = yajl_gen_array_open(hand);
+    if (s != yajl_gen_status_ok) goto out;
+
+    if (!l) goto empty;
+
+    for (i = 0; l[i] != NULL; i++) {
+        s = libxl__yajl_gen_asciiz(hand, l[i]);
+        if (s != yajl_gen_status_ok) goto out;
+    }
+empty:
+    s = yajl_gen_array_close(hand);
+out:
+    return s;
+}
+
+yajl_gen_status libxl_mac_gen_json(yajl_gen hand, libxl_mac *mac)
+{
+    char buf[LIBXL_MAC_FMTLEN+1];
+    snprintf(buf, sizeof(buf), LIBXL_MAC_FMT, LIBXL_MAC_BYTES((*mac)));
+    return yajl_gen_string(hand, (const unsigned char *)buf, LIBXL_MAC_FMTLEN);
+}
+
+yajl_gen_status libxl_hwcap_gen_json(yajl_gen hand,
+                                     libxl_hwcap *p)
+{
+    yajl_gen_status s;
+    int i;
+
+    s = yajl_gen_array_open(hand);
+    if (s != yajl_gen_status_ok) goto out;
+
+    for(i=0; i<4; i++) {
+        s = yajl_gen_integer(hand, (*p)[i]);
+        if (s != yajl_gen_status_ok) goto out;
+    }
+    s = yajl_gen_array_close(hand);
+out:
+    return s;
+}
+
+yajl_gen_status libxl_cpuarray_gen_json(yajl_gen hand,
+                                        libxl_cpuarray *cpuarray)
+{
+    yajl_gen_status s;
+    int i;
+
+    s = yajl_gen_array_open(hand);
+    if (s != yajl_gen_status_ok) goto out;
+
+    for(i=0; i<cpuarray->entries; i++) {
+        if (cpuarray->array[i] == LIBXL_CPUARRAY_INVALID_ENTRY)
+            s = yajl_gen_null(hand);
+        else
+            s = yajl_gen_integer(hand, cpuarray->array[i]);
+        if (s != yajl_gen_status_ok) goto out;
+    }
+    s = yajl_gen_array_close(hand);
+out:
+    return s;
+}
+
+yajl_gen_status libxl_file_reference_gen_json(yajl_gen hand,
+                                              libxl_file_reference *p)
+{
+    if (p->path)
+        return libxl__yajl_gen_asciiz(hand, p->path);
+    else
+        return yajl_gen_null(hand);
+}
+
+yajl_gen_status libxl__string_gen_json(yajl_gen hand,
+                                       const char *p)
+{
+    if (p)
+        return libxl__yajl_gen_asciiz(hand, p);
+    else
+        return yajl_gen_null(hand);
+}
 
 /*
  * libxl__json_object helper functions
@@ -559,6 +770,71 @@
     }
 }
 
+static const char *yajl_gen_status_to_string(yajl_gen_status s)
+{
+        switch (s) {
+        case yajl_gen_status_ok: abort();
+        case yajl_gen_keys_must_be_strings:
+            return "keys must be strings";
+        case yajl_max_depth_exceeded:
+            return "max depth exceeded";
+        case yajl_gen_in_error_state:
+            return "in error state";
+        case yajl_gen_generation_complete:
+            return "generation complete";
+        case yajl_gen_invalid_number:
+            return "invalid number";
+        case yajl_gen_no_buf:
+            return "no buffer";
+#if 0 /* This is in the docs but not implemented in the version I am running. */
+        case yajl_gen_invalid_string:
+            return "invalid string";
+#endif
+        default:
+            return "unknown error";
+        }
+}
+
+char *libxl__object_to_json(libxl_ctx *ctx, const char *type,
+                            libxl__gen_json_callback gen, void *p)
+{
+    yajl_gen_config conf = { 1, "    " };
+    const unsigned char *buf;
+    char *ret = NULL;
+    unsigned int len = 0;
+    yajl_gen_status s;
+    yajl_gen hand;
+
+    hand = yajl_gen_alloc(&conf, NULL);
+    if (!hand)
+        return NULL;
+
+    s = gen(hand, p);
+    if (s != yajl_gen_status_ok)
+        goto out;
+
+    s = yajl_gen_get_buf(hand, &buf, &len);
+    if (s != yajl_gen_status_ok)
+        goto out;
+    ret = strdup((const char *)buf);
+
+out:
+    yajl_gen_free(hand);
+
+    if (s != yajl_gen_status_ok) {
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+                   "unable to convert %s to JSON representation. "
+                   "YAJL error code %d: %s", type,
+                   s, yajl_gen_status_to_string(s));
+    } else if (!ret) {
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+                   "unable to allocate space for to JSON representation of %s",
+                   type);
+    }
+
+    return ret;
+}
+
 /*
  * Local variables:
  * mode: C
diff -r 6880bfc48504 -r 1d21a34e0e29 tools/libxl/libxl_json.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxl/libxl_json.h	Fri Oct 07 11:05:45 2011 +0100
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2011      Citrix Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ */
+
+#ifndef LIBXL_JSON_H
+#define LIBXL_JSON_H
+
+#include <yajl/yajl_gen.h>
+
+#include <_libxl_types_json.h>
+#include <_libxl_types_internal_json.h>
+
+#endif /* LIBXL_JSON_H */
diff -r 6880bfc48504 -r 1d21a34e0e29 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Fri Oct 14 18:11:25 2011 +0100
+++ b/tools/libxl/libxl_types.idl	Fri Oct 07 11:05:45 2011 +0100
@@ -5,7 +5,7 @@
 
 namespace("libxl_")
 
-libxl_domid = Builtin("domid")
+libxl_domid = Builtin("domid", json_fn = "yajl_gen_integer", autogenerate_json = False)
 libxl_uuid = Builtin("uuid", passby=PASS_BY_REFERENCE)
 libxl_mac = Builtin("mac", passby=PASS_BY_REFERENCE)
 libxl_cpumap = Builtin("cpumap", destructor_fn="libxl_cpumap_destroy", passby=PASS_BY_REFERENCE)
@@ -16,7 +16,7 @@
 libxl_key_value_list = Builtin("key_value_list", destructor_fn="libxl_key_value_list_destroy", passby=PASS_BY_REFERENCE)
 libxl_file_reference = Builtin("file_reference", destructor_fn="libxl_file_reference_destroy", passby=PASS_BY_REFERENCE)
 
-libxl_hwcap = Builtin("hwcap")
+libxl_hwcap = Builtin("hwcap", passby=PASS_BY_REFERENCE)
 
 #
 # Constants / Enumerations
diff -r 6880bfc48504 -r 1d21a34e0e29 tools/libxl/libxltypes.py
--- a/tools/libxl/libxltypes.py	Fri Oct 14 18:11:25 2011 +0100
+++ b/tools/libxl/libxltypes.py	Fri Oct 07 11:05:45 2011 +0100
@@ -50,6 +50,13 @@
 
         self.autogenerate_destructor = kwargs.setdefault('autogenerate_destructor', True)
 
+        if self.typename is not None:
+            self.json_fn = kwargs.setdefault('json_fn', self.typename + "_gen_json")
+        else:
+            self.json_fn = kwargs.setdefault('json_fn', None)
+
+        self.autogenerate_json = kwargs.setdefault('autogenerate_json', True)
+
     def marshal_in(self):
         return self.dir in [DIR_IN, DIR_BOTH]
     def marshal_out(self):
@@ -83,6 +90,7 @@
     def __init__(self, typename, **kwargs):
         kwargs.setdefault('destructor_fn', None)
         kwargs.setdefault('autogenerate_destructor', False)
+        kwargs.setdefault('autogenerate_json', False)
         Type.__init__(self, typename, **kwargs)
 
 class Number(Builtin):
@@ -90,6 +98,7 @@
         kwargs.setdefault('namespace', None)
         kwargs.setdefault('destructor_fn', None)
         kwargs.setdefault('signed', False)
+        kwargs.setdefault('json_fn', "yajl_gen_integer")
         self.signed = kwargs['signed']
         Builtin.__init__(self, ctype, **kwargs)
 
@@ -163,6 +172,8 @@
                 comment = None
             else:
                 n,t,const,comment = f
+            if n is None:
+                raise ValueError
             self.fields.append(Field(t,n,const=const,comment=comment))
 
     # Returns a tuple (stem, field-expr)
@@ -220,7 +231,10 @@
 #
 
 void = Builtin("void *", namespace = None)
-bool = Builtin("bool", namespace = None)
+bool = Builtin("bool", namespace = None,
+               json_fn = "yajl_gen_bool",
+               autogenerate_json = False)
+
 size_t = Number("size_t", namespace = None)
 
 integer = Number("int", namespace = None, signed = True)
@@ -230,7 +244,9 @@
 uint32 = UInt(32)
 uint64 = UInt(64)
 
-string = Builtin("char *", namespace = None, destructor_fn = "free")
+string = Builtin("char *", namespace = None, destructor_fn = "free",
+                 json_fn = "libxl__string_gen_json",
+                 autogenerate_json = False)
 
 class OrderedDict(dict):
     """A dictionary which remembers insertion order.

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 17 12:45:36 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 17 Oct 2011 12:45:36 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RFt7w-0000aD-13; Mon, 17 Oct 2011 12:45:36 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RFt6f-0000CD-Nt
	for xen-changelog@lists.xensource.com; Mon, 17 Oct 2011 12:44:18 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-216.messagelabs.com!1318880654!1446626!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3155 invoked from network); 17 Oct 2011 19:44:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Oct 2011 19:44:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RFt6c-0004SI-LH
	for xen-changelog@lists.xensource.com; Mon, 17 Oct 2011 20:44:14 +0100
Message-Id: <E1RFt6c-0004SI-LH@xenbits.xen.org>
Date: Mon, 17 Oct 2011 20:44:14 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: libxl__e820_alloc must take a
	libxl__gc.
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 Ian Campbell <ian.campbell@citrix.com>
# Date 1318498329 -3600
# Node ID 4e33ab60179aa0b6e447f44e7aa6c397e1de808b
# Parent  12060584f58a797cad7b71947d8ce65e93700f4f
libxl: libxl__e820_alloc must take a libxl__gc.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 12060584f58a -r 4e33ab60179a tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Thu Oct 13 09:37:06 2011 +0100
+++ b/tools/libxl/libxl_create.c	Thu Oct 13 10:32:09 2011 +0100
@@ -601,7 +601,7 @@
     if (d_config->c_info.type == LIBXL_DOMAIN_TYPE_PV &&
         d_config->b_info.u.pv.e820_host) {
         int rc;
-        rc = libxl__e820_alloc(ctx, domid, d_config);
+        rc = libxl__e820_alloc(gc, domid, d_config);
         if (rc)
             LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
                       "Failed while collecting E820 with: %d (errno:%d)\n",
diff -r 12060584f58a -r 4e33ab60179a tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Thu Oct 13 09:37:06 2011 +0100
+++ b/tools/libxl/libxl_internal.h	Thu Oct 13 10:32:09 2011 +0100
@@ -424,7 +424,7 @@
 _hidden int libxl__file_reference_unmap(libxl_file_reference *f);
 _hidden int libxl__fd_set_cloexec(int fd);
 
-_hidden int libxl__e820_alloc(libxl_ctx *ctx, uint32_t domid, libxl_domain_config *d_config);
+_hidden int libxl__e820_alloc(libxl__gc *gc, uint32_t domid, libxl_domain_config *d_config);
 
 /* parse the string @s as a sequence of 6 colon separated bytes in to @mac */
 _hidden int libxl__parse_mac(const char *s, libxl_mac mac);
diff -r 12060584f58a -r 4e33ab60179a tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c	Thu Oct 13 09:37:06 2011 +0100
+++ b/tools/libxl/libxl_pci.c	Thu Oct 13 10:32:09 2011 +0100
@@ -1269,8 +1269,9 @@
     return 0;
 }
 
-int libxl__e820_alloc(libxl_ctx *ctx, uint32_t domid, libxl_domain_config *d_config)
+int libxl__e820_alloc(libxl__gc *gc, uint32_t domid, libxl_domain_config *d_config)
 {
+    libxl_ctx *ctx = libxl__gc_owner(gc);
     int rc;
     uint32_t nr;
     struct e820entry map[E820MAX];

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 17 12:45:43 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 17 Oct 2011 12:45:43 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RFt83-0000dA-B3; Mon, 17 Oct 2011 12:45:43 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RFt6g-0000CE-TB
	for xen-changelog@lists.xensource.com; Mon, 17 Oct 2011 12:44:19 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-27.messagelabs.com!1318880634!49104100!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30664 invoked from network); 17 Oct 2011 19:43:54 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Oct 2011 19:43:54 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RFt6d-0004Tg-NR
	for xen-changelog@lists.xensource.com; Mon, 17 Oct 2011 20:44:15 +0100
Message-Id: <E1RFt6d-0004Tg-NR@xenbits.xen.org>
Date: Mon, 17 Oct 2011 20:44:15 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: remove QMP warning when no
	pty style serial device is configured
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 Ian Campbell <ian.campbell@citrix.com>
# Date 1318499067 -3600
# Node ID a33af75083c7baddd3c9c6016657a83d239c6454
# Parent  8a817e804d6857ac96cdb71893953ce8e18ca84a
libxl: remove QMP warning when no pty style serial device is configured

If the serial device is not "pty" then there is nothing to do but this is not
an error. Removes a spurious warning if e.g. serial="file:/tmp/serial.log" is used:

libxl: error: libxl_qmp.c:137:register_serials_chardev_callback: Failed to store serial port information in xenstore: No such file or directory

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 8a817e804d68 -r a33af75083c7 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c	Thu Oct 13 10:32:09 2011 +0100
+++ b/tools/libxl/libxl_qmp.c	Thu Oct 13 10:44:27 2011 +0100
@@ -87,7 +87,7 @@
     int ret = 0;
 
     if (!(chardev && strncmp("pty:", chardev, 4) == 0)) {
-        return -1;
+        return 0;
     }
 
     path = libxl__xs_get_dompath(&gc, qmp->domid);

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 17 12:45:53 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 17 Oct 2011 12:45:53 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RFt8D-0000h5-9E; Mon, 17 Oct 2011 12:45:53 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RFt6l-0000Cz-8a
	for xen-changelog@lists.xensource.com; Mon, 17 Oct 2011 12:44:24 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-216.messagelabs.com!1318880660!1451279!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7043 invoked from network); 17 Oct 2011 19:44:20 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Oct 2011 19:44:20 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RFt6d-0004Sz-6o
	for xen-changelog@lists.xensource.com; Mon, 17 Oct 2011 20:44:15 +0100
Message-Id: <E1RFt6d-0004Sz-6o@xenbits.xen.org>
Date: Mon, 17 Oct 2011 20:44:14 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxc: osdep: report missing
	backends in common code
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 Ian Campbell <ian.campbell@citrix.com>
# Date 1318498329 -3600
# Node ID 8a817e804d6857ac96cdb71893953ce8e18ca84a
# Parent  4e33ab60179aa0b6e447f44e7aa6c397e1de808b
libxc: osdep: report missing backends in common code

Backends were inconsistent about reporting and it's a pain to edit them all
when adding a new class of osdep.

Signed-off-by: Ian Campbell <Ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 4e33ab60179a -r 8a817e804d68 tools/libxc/xc_netbsd.c
--- a/tools/libxc/xc_netbsd.c	Thu Oct 13 10:32:09 2011 +0100
+++ b/tools/libxc/xc_netbsd.c	Thu Oct 13 10:32:09 2011 +0100
@@ -386,9 +386,6 @@
         return &netbsd_privcmd_ops;
     case XC_OSDEP_EVTCHN:
         return &netbsd_evtchn_ops;
-    case XC_OSDEP_GNTTAB:
-        ERROR("GNTTAB interface not supported on this platform");
-        return NULL;
     default:
         return NULL;
     }
diff -r 4e33ab60179a -r 8a817e804d68 tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c	Thu Oct 13 10:32:09 2011 +0100
+++ b/tools/libxc/xc_private.c	Thu Oct 13 10:32:09 2011 +0100
@@ -111,6 +111,18 @@
 #endif
 }
 
+static const char *xc_osdep_type_name(enum xc_osdep_type type)
+{
+    switch ( type )
+    {
+    case XC_OSDEP_PRIVCMD: return "privcmd";
+    case XC_OSDEP_EVTCHN:  return "evtchn";
+    case XC_OSDEP_GNTTAB:  return "gnttab";
+    case XC_OSDEP_GNTSHR:  return "gntshr";
+    }
+    return "unknown";
+}
+
 static struct xc_interface_core *xc_interface_open_common(xentoollog_logger *logger,
                                                           xentoollog_logger *dombuild_logger,
                                                           unsigned open_flags,
@@ -161,7 +173,11 @@
 
         xch->ops = xch->osdep.init(xch, type);
         if ( xch->ops == NULL )
+        {
+            ERROR("OSDEP: interface %d (%s) not supported on this platform",
+                  type, xc_osdep_type_name(type));
             goto err_put_iface;
+        }
 
         xch->ops_handle = xch->ops->open(xch);
         if (xch->ops_handle == XC_OSDEP_OPEN_ERROR)
diff -r 4e33ab60179a -r 8a817e804d68 tools/libxc/xc_solaris.c
--- a/tools/libxc/xc_solaris.c	Thu Oct 13 10:32:09 2011 +0100
+++ b/tools/libxc/xc_solaris.c	Thu Oct 13 10:32:09 2011 +0100
@@ -322,9 +322,6 @@
         return &solaris_privcmd_ops;
     case XC_OSDEP_EVTCHN:
         return &solaris_evtchn_ops;
-    case XC_OSDEP_GNTTAB:
-        ERROR("GNTTAB interface not supported on this platform");
-        return NULL;
     default:
         return NULL;
     }

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

From xen-changelog-bounces@lists.xensource.com Wed Oct 19 07:24:17 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 19 Oct 2011 07:24:17 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RGX45-0006Do-Sb; Wed, 19 Oct 2011 07:24:17 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RGWgn-0001Tg-MT
	for xen-changelog@lists.xensource.com; Wed, 19 Oct 2011 07:00:24 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-174.messagelabs.com!1319032810!35911914!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9310 invoked from network); 19 Oct 2011 14:00:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-11.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	19 Oct 2011 14:00:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RGWgj-0003UQ-US
	for xen-changelog@lists.xensource.com; Wed, 19 Oct 2011 15:00:09 +0100
Message-Id: <E1RGWgj-0003UQ-US@xenbits.xen.org>
Date: Wed, 19 Oct 2011 15:00:09 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: move generic IRQ code out of
	io_apic.c
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 Jan Beulich <jbeulich@suse.com>
# Date 1319021502 -7200
# Node ID 14b369de76adeb8b247608253f7dd650e27c31fa
# Parent  07a80c52d7c1a0cead6dc6654f9bfe4f56740043
x86: move generic IRQ code out of io_apic.c

While doing so, eliminate the use of struct irq_cfg and convert the
CPU mask accessors to the new style ones as far as possible.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---


diff -r 07a80c52d7c1 -r 14b369de76ad xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Wed Oct 19 12:50:54 2011 +0200
+++ b/xen/arch/x86/io_apic.c	Wed Oct 19 12:51:42 2011 +0200
@@ -528,133 +528,6 @@
 }
 
 #ifdef CONFIG_SMP
-fastcall void smp_irq_move_cleanup_interrupt(struct cpu_user_regs *regs)
-{
-    unsigned vector, me;
-    struct cpu_user_regs *old_regs = set_irq_regs(regs);
-
-    ack_APIC_irq();
-    this_cpu(irq_count)++;
-    irq_enter();
-
-    me = smp_processor_id();
-    for (vector = FIRST_DYNAMIC_VECTOR; vector < NR_VECTORS; vector++) {
-        unsigned int irq;
-        unsigned int irr;
-        struct irq_desc *desc;
-        struct irq_cfg *cfg;
-        irq = __get_cpu_var(vector_irq)[vector];
-
-        if (irq == -1)
-            continue;
-
-        desc = irq_to_desc(irq);
-        if (!desc)
-            continue;
-
-        cfg = &desc->arch;
-        spin_lock(&desc->lock);
-        if (!cfg->move_cleanup_count)
-            goto unlock;
-
-        if (vector == cfg->vector && cpu_isset(me, cfg->cpu_mask))
-            goto unlock;
-
-        irr = apic_read(APIC_IRR + (vector / 32 * 0x10));
-        /*
-         * Check if the vector that needs to be cleanedup is
-         * registered at the cpu's IRR. If so, then this is not
-         * the best time to clean it up. Lets clean it up in the
-         * next attempt by sending another IRQ_MOVE_CLEANUP_VECTOR
-         * to myself.
-         */
-        if (irr  & (1 << (vector % 32))) {
-            genapic->send_IPI_self(IRQ_MOVE_CLEANUP_VECTOR);
-            TRACE_3D(TRC_HW_IRQ_MOVE_CLEANUP_DELAY,
-                     irq, vector, smp_processor_id());
-            goto unlock;
-        }
-
-        TRACE_3D(TRC_HW_IRQ_MOVE_CLEANUP,
-                 irq, vector, smp_processor_id());
-
-        __get_cpu_var(vector_irq)[vector] = -1;
-        cfg->move_cleanup_count--;
-
-        if ( cfg->move_cleanup_count == 0 )
-        {
-            cfg->old_vector = IRQ_VECTOR_UNASSIGNED;
-            cpus_clear(cfg->old_cpu_mask);
-
-            if ( cfg->used_vectors )
-            {
-                ASSERT(test_bit(vector, cfg->used_vectors));
-                clear_bit(vector, cfg->used_vectors);
-            }
-        }
-unlock:
-        spin_unlock(&desc->lock);
-    }
-
-    irq_exit();
-    set_irq_regs(old_regs);
-}
-
-static void send_cleanup_vector(struct irq_cfg *cfg)
-{
-    cpumask_t cleanup_mask;
-
-    cpus_and(cleanup_mask, cfg->old_cpu_mask, cpu_online_map);
-    cfg->move_cleanup_count = cpus_weight(cleanup_mask);
-    genapic->send_IPI_mask(&cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR);
-
-    cfg->move_in_progress = 0;
-}
-
-void irq_complete_move(struct irq_desc *desc)
-{
-    struct irq_cfg *cfg = &desc->arch;
-    unsigned vector, me;
-
-    if (likely(!cfg->move_in_progress))
-        return;
-
-    vector = get_irq_regs()->entry_vector;
-    me = smp_processor_id();
-
-    if (vector == cfg->vector && cpu_isset(me, cfg->cpu_mask))
-        send_cleanup_vector(cfg);
-}
-
-unsigned int set_desc_affinity(struct irq_desc *desc, const cpumask_t *mask)
-{
-    struct irq_cfg *cfg;
-    unsigned int irq;
-    int ret;
-    unsigned long flags;
-    cpumask_t dest_mask;
-
-    if (!cpus_intersects(*mask, cpu_online_map))
-        return BAD_APICID;
-
-    irq = desc->irq;
-    cfg = &desc->arch;
-
-    local_irq_save(flags);
-    lock_vector_lock();
-    ret = __assign_irq_vector(irq, cfg, mask);
-    unlock_vector_lock();
-    local_irq_restore(flags);
-
-    if (ret < 0)
-        return BAD_APICID;
-
-    cpus_copy(desc->affinity, *mask);
-    cpus_and(dest_mask, *mask, cfg->cpu_mask);
-
-    return cpu_mask_to_apicid(&dest_mask);
-}
-
 static void
 set_ioapic_affinity_irq(struct irq_desc *desc, const cpumask_t *mask)
 {
diff -r 07a80c52d7c1 -r 14b369de76ad xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Wed Oct 19 12:50:54 2011 +0200
+++ b/xen/arch/x86/irq.c	Wed Oct 19 12:51:42 2011 +0200
@@ -598,6 +598,128 @@
     desc->handler->enable(desc);
 }
 
+fastcall void smp_irq_move_cleanup_interrupt(struct cpu_user_regs *regs)
+{
+    unsigned vector, me;
+    struct cpu_user_regs *old_regs = set_irq_regs(regs);
+
+    ack_APIC_irq();
+    this_cpu(irq_count)++;
+    irq_enter();
+
+    me = smp_processor_id();
+    for (vector = FIRST_DYNAMIC_VECTOR; vector < NR_VECTORS; vector++) {
+        unsigned int irq;
+        unsigned int irr;
+        struct irq_desc *desc;
+        irq = __get_cpu_var(vector_irq)[vector];
+
+        if (irq == -1)
+            continue;
+
+        desc = irq_to_desc(irq);
+        if (!desc)
+            continue;
+
+        spin_lock(&desc->lock);
+        if (!desc->arch.move_cleanup_count)
+            goto unlock;
+
+        if (vector == desc->arch.vector && cpumask_test_cpu(me, &desc->arch.cpu_mask))
+            goto unlock;
+
+        irr = apic_read(APIC_IRR + (vector / 32 * 0x10));
+        /*
+         * Check if the vector that needs to be cleanedup is
+         * registered at the cpu's IRR. If so, then this is not
+         * the best time to clean it up. Lets clean it up in the
+         * next attempt by sending another IRQ_MOVE_CLEANUP_VECTOR
+         * to myself.
+         */
+        if (irr  & (1 << (vector % 32))) {
+            genapic->send_IPI_self(IRQ_MOVE_CLEANUP_VECTOR);
+            TRACE_3D(TRC_HW_IRQ_MOVE_CLEANUP_DELAY,
+                     irq, vector, smp_processor_id());
+            goto unlock;
+        }
+
+        TRACE_3D(TRC_HW_IRQ_MOVE_CLEANUP,
+                 irq, vector, smp_processor_id());
+
+        __get_cpu_var(vector_irq)[vector] = -1;
+        desc->arch.move_cleanup_count--;
+
+        if ( desc->arch.move_cleanup_count == 0 )
+        {
+            desc->arch.old_vector = IRQ_VECTOR_UNASSIGNED;
+            cpumask_clear(&desc->arch.old_cpu_mask);
+
+            if ( desc->arch.used_vectors )
+            {
+                ASSERT(test_bit(vector, desc->arch.used_vectors));
+                clear_bit(vector, desc->arch.used_vectors);
+            }
+        }
+unlock:
+        spin_unlock(&desc->lock);
+    }
+
+    irq_exit();
+    set_irq_regs(old_regs);
+}
+
+static void send_cleanup_vector(struct irq_desc *desc)
+{
+    cpumask_t cleanup_mask;
+
+    cpumask_and(&cleanup_mask, &desc->arch.old_cpu_mask, &cpu_online_map);
+    desc->arch.move_cleanup_count = cpumask_weight(&cleanup_mask);
+    genapic->send_IPI_mask(&cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR);
+
+    desc->arch.move_in_progress = 0;
+}
+
+void irq_complete_move(struct irq_desc *desc)
+{
+    unsigned vector, me;
+
+    if (likely(!desc->arch.move_in_progress))
+        return;
+
+    vector = get_irq_regs()->entry_vector;
+    me = smp_processor_id();
+
+    if (vector == desc->arch.vector && cpumask_test_cpu(me, &desc->arch.cpu_mask))
+        send_cleanup_vector(desc);
+}
+
+unsigned int set_desc_affinity(struct irq_desc *desc, const cpumask_t *mask)
+{
+    unsigned int irq;
+    int ret;
+    unsigned long flags;
+    cpumask_t dest_mask;
+
+    if (!cpus_intersects(*mask, cpu_online_map))
+        return BAD_APICID;
+
+    irq = desc->irq;
+
+    local_irq_save(flags);
+    lock_vector_lock();
+    ret = __assign_irq_vector(irq, &desc->arch, mask);
+    unlock_vector_lock();
+    local_irq_restore(flags);
+
+    if (ret < 0)
+        return BAD_APICID;
+
+    cpumask_copy(&desc->affinity, mask);
+    cpumask_and(&dest_mask, mask, &desc->arch.cpu_mask);
+
+    return cpu_mask_to_apicid(&dest_mask);
+}
+
 /* For re-setting irq interrupt affinity for specific irq */
 void irq_set_affinity(struct irq_desc *desc, const cpumask_t *mask)
 {

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

From xen-changelog-bounces@lists.xensource.com Wed Oct 19 07:25:23 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 19 Oct 2011 07:25:23 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RGX59-0006dw-AC; Wed, 19 Oct 2011 07:25:23 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RGWgo-0001Tq-Ew
	for xen-changelog@lists.xensource.com; Wed, 19 Oct 2011 07:00:27 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-21.messagelabs.com!1319032809!847403!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22775 invoked from network); 19 Oct 2011 14:00:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	19 Oct 2011 14:00:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RGWgj-0003U5-CU
	for xen-changelog@lists.xensource.com; Wed, 19 Oct 2011 15:00:09 +0100
Message-Id: <E1RGWgj-0003U5-CU@xenbits.xen.org>
Date: Wed, 19 Oct 2011 15:00:08 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] fold struct irq_cfg into struct
	irq_desc
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 Jan Beulich <jbeulich@suse.com>
# Date 1319021454 -7200
# Node ID 07a80c52d7c1a0cead6dc6654f9bfe4f56740043
# Parent  a33af75083c7baddd3c9c6016657a83d239c6454
fold struct irq_cfg into struct irq_desc

struct irq_cfg really has become an architecture extension to struct
irq_desc, and hence it should be treated as such (rather than as IRQ
chip specific data, which it was meant to be originally).

For a first step, only convert a subset of the uses; subsequent
patches (partly to be sent later) will aim at fully eliminating the
use of the old structure type.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---


diff -r a33af75083c7 -r 07a80c52d7c1 xen/arch/ia64/xen/irq.c
--- a/xen/arch/ia64/xen/irq.c	Thu Oct 13 10:44:27 2011 +0100
+++ b/xen/arch/ia64/xen/irq.c	Wed Oct 19 12:50:54 2011 +0200
@@ -79,16 +79,13 @@
 		.status = IRQ_DISABLED,
 		.handler = &no_irq_type,
 		.lock = SPIN_LOCK_UNLOCKED
+		.arch = {
+		        .vector = -1,
+		        .cpu_mask = CPU_MASK_ALL,
+		}
 	}
 };
 
-struct irq_cfg irq_cfg[NR_IRQS] = {
-    [0 ... NR_IRQS-1] ={
-        .vector = -1,
-        .cpu_mask = CPU_MASK_ALL,
-}
-};
-
 void __do_IRQ_guest(int irq);
 
 /*
@@ -238,7 +235,6 @@
 	unsigned long flags;
 	struct irqaction *old, **p;
 	irq_desc_t *desc = irq_descp(vector);
-    struct irq_cfg *cfg = irq_cfg(vector);
 
 	/*
 	 * The following block of code has to be executed atomically
@@ -256,8 +252,7 @@
 	desc->status &= ~(IRQ_DISABLED | IRQ_INPROGRESS | IRQ_GUEST);
 	desc->handler->startup(vector);
 	desc->handler->enable(vector);
-    desc->chip_data = cfg;
-    cfg->vector = vector;
+	desc->arch.vector = vector;
 	spin_unlock_irqrestore(&desc->lock,flags);
 
 	return 0;
@@ -283,13 +278,11 @@
 {
 	unsigned long flags;
 	irq_desc_t *desc;
-    struct irq_cfg *cfg;
 
 	if ( vec == IA64_INVALID_VECTOR )
 		return;
 
 	desc = irq_descp(vec);
-    cfg = irq_cfg(vec);
 
 	spin_lock_irqsave(&desc->lock, flags);
 	clear_bit(vec, ia64_xen_vector);
@@ -297,8 +290,7 @@
 	desc->depth = 1;
 	desc->status |= IRQ_DISABLED;
 	desc->handler->shutdown(vec);
-    desc->chip_data = NULL;
-    cfg->vector = -1;
+	desc->arch.vector = -1;
 	spin_unlock_irqrestore(&desc->lock, flags);
 
 	while (desc->status & IRQ_INPROGRESS)
diff -r a33af75083c7 -r 07a80c52d7c1 xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c	Thu Oct 13 10:44:27 2011 +0100
+++ b/xen/arch/x86/hpet.c	Wed Oct 19 12:50:54 2011 +0200
@@ -281,7 +281,6 @@
 {
     struct msi_msg msg;
     unsigned int dest;
-    struct irq_cfg *cfg= desc->chip_data;
 
     dest = set_desc_affinity(desc, mask);
     if (dest == BAD_APICID)
@@ -289,7 +288,7 @@
 
     hpet_msi_read(desc->action->dev_id, &msg);
     msg.data &= ~MSI_DATA_VECTOR_MASK;
-    msg.data |= MSI_DATA_VECTOR(cfg->vector);
+    msg.data |= MSI_DATA_VECTOR(desc->arch.vector);
     msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK;
     msg.address_lo |= MSI_ADDR_DEST_ID(dest);
     hpet_msi_write(desc->action->dev_id, &msg);
diff -r a33af75083c7 -r 07a80c52d7c1 xen/arch/x86/i8259.c
--- a/xen/arch/x86/i8259.c	Thu Oct 13 10:44:27 2011 +0100
+++ b/xen/arch/x86/i8259.c	Wed Oct 19 12:50:54 2011 +0200
@@ -395,12 +395,11 @@
 
     for (irq = 0; platform_legacy_irq(irq); irq++) {
         struct irq_desc *desc = irq_to_desc(irq);
-        struct irq_cfg *cfg = desc->chip_data;
         
         desc->handler = &i8259A_irq_type;
         per_cpu(vector_irq, cpu)[FIRST_LEGACY_VECTOR + irq] = irq;
-        cfg->cpu_mask= cpumask_of_cpu(cpu);
-        cfg->vector = FIRST_LEGACY_VECTOR + irq;
+        cpumask_copy(&desc->arch.cpu_mask, cpumask_of(cpu));
+        desc->arch.vector = FIRST_LEGACY_VECTOR + irq;
     }
     
     per_cpu(vector_irq, cpu)[FIRST_HIPRIORITY_VECTOR] = 0;
diff -r a33af75083c7 -r 07a80c52d7c1 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Thu Oct 13 10:44:27 2011 +0100
+++ b/xen/arch/x86/io_apic.c	Wed Oct 19 12:50:54 2011 +0200
@@ -552,7 +552,7 @@
         if (!desc)
             continue;
 
-        cfg = desc->chip_data;
+        cfg = &desc->arch;
         spin_lock(&desc->lock);
         if (!cfg->move_cleanup_count)
             goto unlock;
@@ -613,7 +613,7 @@
 
 void irq_complete_move(struct irq_desc *desc)
 {
-    struct irq_cfg *cfg = desc->chip_data;
+    struct irq_cfg *cfg = &desc->arch;
     unsigned vector, me;
 
     if (likely(!cfg->move_in_progress))
@@ -638,7 +638,7 @@
         return BAD_APICID;
 
     irq = desc->irq;
-    cfg = desc->chip_data;
+    cfg = &desc->arch;
 
     local_irq_save(flags);
     lock_vector_lock();
@@ -661,11 +661,9 @@
     unsigned long flags;
     unsigned int dest;
     int pin, irq;
-    struct irq_cfg *cfg;
     struct irq_pin_list *entry;
 
     irq = desc->irq;
-    cfg = desc->chip_data;
 
     spin_lock_irqsave(&ioapic_lock, flags);
     dest = set_desc_affinity(desc, mask);
@@ -682,7 +680,7 @@
             io_apic_write(entry->apic, 0x10 + 1 + pin*2, dest);
             data = io_apic_read(entry->apic, 0x10 + pin*2);
             data &= ~IO_APIC_REDIR_VECTOR_MASK;
-            data |= cfg->vector & 0xFF;
+            data |= desc->arch.vector & 0xFF;
             io_apic_modify(entry->apic, 0x10 + pin*2, data);
 
             if (!entry->next)
@@ -2448,7 +2446,7 @@
         return irq;
 
     desc = irq_to_desc(irq);
-    cfg = desc->chip_data;
+    cfg = &desc->arch;
 
     /*
      * Since PHYSDEVOP_alloc_irq_vector is dummy, rte.vector is the pirq
diff -r a33af75083c7 -r 07a80c52d7c1 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Thu Oct 13 10:44:27 2011 +0100
+++ b/xen/arch/x86/irq.c	Wed Oct 19 12:50:54 2011 +0200
@@ -45,8 +45,6 @@
 
 static DECLARE_BITMAP(used_vectors, NR_VECTORS);
 
-struct irq_cfg __read_mostly *irq_cfg = NULL;
-
 static DEFINE_SPINLOCK(vector_lock);
 
 DEFINE_PER_CPU(vector_irq_t, vector_irq);
@@ -156,7 +154,7 @@
     int irq;
 
     for (irq = nr_irqs_gsi; irq < nr_irqs; irq++)
-        if (irq_cfg[irq].used == IRQ_UNUSED)
+        if (irq_to_desc(irq)->arch.used == IRQ_UNUSED)
             return irq;
     return -ENOSPC;
 }
@@ -198,7 +196,7 @@
     desc->action  = NULL;
     desc->msi_desc = NULL;
     desc->handler = &no_irq_type;
-    desc->chip_data->used_vectors=NULL;
+    desc->arch.used_vectors = NULL;
     cpus_setall(desc->affinity);
     spin_unlock_irqrestore(&desc->lock, flags);
 
@@ -322,26 +320,22 @@
 int __init init_irq_data(void)
 {
     struct irq_desc *desc;
-    struct irq_cfg *cfg;
     int irq, vector;
 
     for (vector = 0; vector < NR_VECTORS; ++vector)
         this_cpu(vector_irq)[vector] = -1;
 
     irq_desc = xzalloc_array(struct irq_desc, nr_irqs);
-    irq_cfg = xzalloc_array(struct irq_cfg, nr_irqs);
     irq_vector = xzalloc_array(u8, nr_irqs_gsi);
     
-    if ( !irq_desc || !irq_cfg ||! irq_vector )
+    if ( !irq_desc || !irq_vector )
         return -ENOMEM;
 
     for (irq = 0; irq < nr_irqs; irq++) {
         desc = irq_to_desc(irq);
-        cfg = irq_cfg(irq);
         desc->irq = irq;
-        desc->chip_data = cfg;
         init_one_irq_desc(desc);
-        init_one_irq_cfg(cfg);
+        init_one_irq_cfg(&desc->arch);
     }
 
     /* Never allocate the hypercall vector or Linux/BSD fast-trap vector. */
@@ -384,7 +378,7 @@
 
         ret = &global_used_vector_map;
 
-        if ( desc->chip_data->used_vectors )
+        if ( desc->arch.used_vectors )
         {
             printk(XENLOG_INFO "%s: Strange, unassigned irq %d already has used_vectors!\n",
                    __func__, irq);
@@ -526,7 +520,7 @@
 {
     int ret;
     unsigned long flags;
-    struct irq_cfg *cfg = &irq_cfg[irq];
+    struct irq_cfg *cfg = irq_cfg(irq);
     struct irq_desc *desc = irq_to_desc(irq);
     
     BUG_ON(irq >= nr_irqs || irq <0);
@@ -1736,15 +1730,15 @@
         setup_msi_handler(desc, msi_desc);
 
         if ( opt_irq_vector_map == OPT_IRQ_VECTOR_MAP_PERDEV
-             && !desc->chip_data->used_vectors )
+             && !desc->arch.used_vectors )
         {
-            desc->chip_data->used_vectors = &pdev->info.used_vectors;
-            if ( desc->chip_data->vector != IRQ_VECTOR_UNASSIGNED )
+            desc->arch.used_vectors = &pdev->info.used_vectors;
+            if ( desc->arch.vector != IRQ_VECTOR_UNASSIGNED )
             {
-                int vector = desc->chip_data->vector;
-                ASSERT(!test_bit(vector, desc->chip_data->used_vectors));
+                int vector = desc->arch.vector;
+                ASSERT(!test_bit(vector, desc->arch.used_vectors));
 
-                set_bit(vector, desc->chip_data->used_vectors);
+                set_bit(vector, desc->arch.used_vectors);
             }
         }
 
@@ -1858,7 +1852,6 @@
 {
     int i, irq, pirq;
     struct irq_desc *desc;
-    struct irq_cfg *cfg;
     irq_guest_action_t *action;
     struct domain *d;
     const struct pirq *info;
@@ -1870,7 +1863,6 @@
     {
 
         desc = irq_to_desc(irq);
-        cfg = desc->chip_data;
 
         if ( !desc->handler || desc->handler == &no_irq_type )
             continue;
@@ -1881,7 +1873,7 @@
                           desc->affinity);
         printk("   IRQ:%4d affinity:%s vec:%02x type=%-15s"
                " status=%08x ",
-               irq, keyhandler_scratch, cfg->vector,
+               irq, keyhandler_scratch, desc->arch.vector,
                desc->handler->typename, desc->status);
 
         if ( !(desc->status & IRQ_GUEST) )
diff -r a33af75083c7 -r 07a80c52d7c1 xen/arch/x86/msi.c
--- a/xen/arch/x86/msi.c	Thu Oct 13 10:44:27 2011 +0100
+++ b/xen/arch/x86/msi.c	Wed Oct 19 12:50:54 2011 +0200
@@ -123,16 +123,15 @@
 void msi_compose_msg(struct irq_desc *desc, struct msi_msg *msg)
 {
     unsigned dest;
-    struct irq_cfg *cfg = desc->chip_data;
-    int vector = cfg->vector;
+    int vector = desc->arch.vector;
 
-    if ( cpus_empty(cfg->cpu_mask) ) {
+    if ( cpumask_empty(&desc->arch.cpu_mask) ) {
         dprintk(XENLOG_ERR,"%s, compose msi message error!!\n", __func__);
         return;
     }
 
     if ( vector ) {
-        dest = cpu_mask_to_apicid(&cfg->cpu_mask);
+        dest = cpu_mask_to_apicid(&desc->arch.cpu_mask);
 
         msg->address_hi = MSI_ADDR_BASE_HI;
         msg->address_lo =
@@ -259,7 +258,6 @@
     struct msi_msg msg;
     unsigned int dest;
     struct msi_desc *msi_desc = desc->msi_desc;
-    struct irq_cfg *cfg = desc->chip_data;
 
     dest = set_desc_affinity(desc, mask);
     if (dest == BAD_APICID || !msi_desc)
@@ -271,7 +269,7 @@
     read_msi_msg(msi_desc, &msg);
 
     msg.data &= ~MSI_DATA_VECTOR_MASK;
-    msg.data |= MSI_DATA_VECTOR(cfg->vector);
+    msg.data |= MSI_DATA_VECTOR(desc->arch.vector);
     msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK;
     msg.address_lo |= MSI_ADDR_DEST_ID(dest);
     msg.dest32 = dest;
diff -r a33af75083c7 -r 07a80c52d7c1 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c	Thu Oct 13 10:44:27 2011 +0100
+++ b/xen/arch/x86/smpboot.c	Wed Oct 19 12:50:54 2011 +0200
@@ -1010,8 +1010,8 @@
             continue;
         irq_vector[irq] = FIRST_HIPRIORITY_VECTOR + seridx + 1;
         per_cpu(vector_irq, cpu)[FIRST_HIPRIORITY_VECTOR + seridx + 1] = irq;
-        irq_cfg[irq].vector = FIRST_HIPRIORITY_VECTOR + seridx + 1;
-        irq_cfg[irq].cpu_mask = cpu_online_map;
+        irq_to_desc(irq)->arch.vector = FIRST_HIPRIORITY_VECTOR + seridx + 1;
+        cpumask_copy(&irq_to_desc(irq)->arch.cpu_mask, &cpu_online_map);
     }
 
     /* IPI for cleanuping vectors after irq move */
diff -r a33af75083c7 -r 07a80c52d7c1 xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c	Thu Oct 13 10:44:27 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_init.c	Wed Oct 19 12:50:54 2011 +0200
@@ -348,7 +348,6 @@
     struct msi_msg msg;
     unsigned int dest;
     struct amd_iommu *iommu = desc->action->dev_id;
-    struct irq_cfg *cfg = desc->chip_data;
     u16 seg = iommu->seg;
     u8 bus = (iommu->bdf >> 8) & 0xff;
     u8 dev = PCI_SLOT(iommu->bdf & 0xff);
@@ -363,7 +362,7 @@
     }
 
     memset(&msg, 0, sizeof(msg)); 
-    msg.data = MSI_DATA_VECTOR(cfg->vector) & 0xff;
+    msg.data = MSI_DATA_VECTOR(desc->arch.vector) & 0xff;
     msg.data |= 1 << 14;
     msg.data |= (INT_DELIVERY_MODE != dest_LowestPrio) ?
         MSI_DATA_DELIVERY_FIXED:
diff -r a33af75083c7 -r 07a80c52d7c1 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Thu Oct 13 10:44:27 2011 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c	Wed Oct 19 12:50:54 2011 +0200
@@ -1001,7 +1001,6 @@
     unsigned int dest;
     unsigned long flags;
     struct iommu *iommu = desc->action->dev_id;
-    struct irq_cfg *cfg = desc->chip_data;
 
 #ifdef CONFIG_X86
     dest = set_desc_affinity(desc, mask);
@@ -1011,7 +1010,7 @@
     }
 
     memset(&msg, 0, sizeof(msg)); 
-    msg.data = MSI_DATA_VECTOR(cfg->vector) & 0xff;
+    msg.data = MSI_DATA_VECTOR(desc->arch.vector) & 0xff;
     msg.data |= 1 << 14;
     msg.data |= (INT_DELIVERY_MODE != dest_LowestPrio) ?
         MSI_DATA_DELIVERY_FIXED:
@@ -1029,7 +1028,7 @@
     msg.address_lo |= MSI_ADDR_DEST_ID(dest & 0xff);
 #else
     memset(&msg, 0, sizeof(msg));
-    msg.data = cfg->vector & 0xff;
+    msg.data = desc->arch.vector & 0xff;
     msg.data |= 1 << 14;
     msg.address_lo = (MSI_ADDRESS_HEADER << (MSI_ADDRESS_HEADER_SHIFT + 8));
     msg.address_lo |= MSI_PHYSICAL_MODE << 2;
diff -r a33af75083c7 -r 07a80c52d7c1 xen/include/asm-ia64/linux-xen/asm/README.origin
--- a/xen/include/asm-ia64/linux-xen/asm/README.origin	Thu Oct 13 10:44:27 2011 +0100
+++ b/xen/include/asm-ia64/linux-xen/asm/README.origin	Wed Oct 19 12:50:54 2011 +0200
@@ -10,6 +10,7 @@
 gcc_intrin.h		-> linux/include/asm-ia64/gcc_intrin.h
 ia64regs.h		-> linux/include/asm-ia64/ia64regs.h
 io.h			-> linux/include/asm-ia64/io.h
+irq.h			-> linux/include/asm-ia64/irq.h
 hw_irq.h		-> linux/include/asm-ia64/hw_irq.h
 kregs.h			-> linux/include/asm-ia64/kregs.h
 mca_asm.h		-> linux/include/asm-ia64/mca_asm.h
diff -r a33af75083c7 -r 07a80c52d7c1 xen/include/asm-ia64/linux-xen/asm/irq.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/asm-ia64/linux-xen/asm/irq.h	Wed Oct 19 12:50:54 2011 +0200
@@ -0,0 +1,73 @@
+#ifndef _ASM_IA64_IRQ_H
+#define _ASM_IA64_IRQ_H
+
+/*
+ * Copyright (C) 1999-2000, 2002 Hewlett-Packard Co
+ *	David Mosberger-Tang <davidm@hpl.hp.com>
+ *	Stephane Eranian <eranian@hpl.hp.com>
+ *
+ * 11/24/98	S.Eranian 	updated TIMER_IRQ and irq_canonicalize
+ * 01/20/99	S.Eranian	added keyboard interrupt
+ * 02/29/00     D.Mosberger	moved most things into hw_irq.h
+ */
+
+#define NR_VECTORS	256
+#define NR_IRQS		256
+
+#ifdef XEN
+struct irq_cfg {
+#define arch_irq_desc irq_cfg
+        int  vector;
+        cpumask_t cpu_mask;
+};
+#endif
+
+static __inline__ int
+irq_canonicalize (int irq)
+{
+	/*
+	 * We do the legacy thing here of pretending that irqs < 16
+	 * are 8259 irqs.  This really shouldn't be necessary at all,
+	 * but we keep it here as serial.c still uses it...
+	 */
+	return ((irq == 2) ? 9 : irq);
+}
+
+extern void disable_irq (unsigned int);
+extern void disable_irq_nosync (unsigned int);
+extern void enable_irq (unsigned int);
+extern void set_irq_affinity_info (unsigned int irq, int dest, int redir);
+
+#ifdef CONFIG_SMP
+extern void move_irq(int irq);
+#else
+#define move_irq(irq)
+#endif
+
+struct irqaction;
+struct pt_regs;
+int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
+
+extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs);
+
+#ifdef XEN
+static inline unsigned int irq_to_vector(int);
+extern int setup_irq_vector(unsigned int, struct irqaction *);
+extern void release_irq_vector(unsigned int);
+extern int request_irq_vector(unsigned int vector,
+               void (*handler)(int, void *, struct cpu_user_regs *),
+               unsigned long irqflags, const char * devname, void *dev_id);
+
+#define create_irq(x) assign_irq_vector(AUTO_ASSIGN_IRQ)
+#define destroy_irq(x) free_irq_vector(x)
+
+#define irq_cfg(x)        (&irq_desc[x].arch)
+#define irq_to_desc(x)    (&irq_desc[x]
+
+#define irq_complete_move(x) do {} \
+    while(!x)
+
+#define domain_pirq_to_irq(d, irq) domain_irq_to_vector(d, irq)
+#endif
+
+#endif /* _ASM_IA64_IRQ_H */
diff -r a33af75083c7 -r 07a80c52d7c1 xen/include/asm-ia64/linux/asm/README.origin
--- a/xen/include/asm-ia64/linux/asm/README.origin	Thu Oct 13 10:44:27 2011 +0100
+++ b/xen/include/asm-ia64/linux/asm/README.origin	Wed Oct 19 12:50:54 2011 +0200
@@ -19,7 +19,6 @@
 hdreg.h			-> linux/include/asm-ia64/hdreg.h
 intrinsics.h		-> linux/include/asm-ia64/intrinsics.h
 ioctl.h			-> linux/include/asm-ia64/ioctl.h
-irq.h			-> linux/include/asm-ia64/irq.h
 linkage.h		-> linux/include/asm-ia64/linkage.h
 machvec_hpsim.h		-> linux/include/asm-ia64/machvec_hpsim.h
 mca.h			-> linux/include/asm-ia64/mca.h
diff -r a33af75083c7 -r 07a80c52d7c1 xen/include/asm-ia64/linux/asm/irq.h
--- a/xen/include/asm-ia64/linux/asm/irq.h	Thu Oct 13 10:44:27 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-#ifndef _ASM_IA64_IRQ_H
-#define _ASM_IA64_IRQ_H
-
-/*
- * Copyright (C) 1999-2000, 2002 Hewlett-Packard Co
- *	David Mosberger-Tang <davidm@hpl.hp.com>
- *	Stephane Eranian <eranian@hpl.hp.com>
- *
- * 11/24/98	S.Eranian 	updated TIMER_IRQ and irq_canonicalize
- * 01/20/99	S.Eranian	added keyboard interrupt
- * 02/29/00     D.Mosberger	moved most things into hw_irq.h
- */
-
-#define NR_VECTORS	256
-#define NR_IRQS		256
-
-static __inline__ int
-irq_canonicalize (int irq)
-{
-	/*
-	 * We do the legacy thing here of pretending that irqs < 16
-	 * are 8259 irqs.  This really shouldn't be necessary at all,
-	 * but we keep it here as serial.c still uses it...
-	 */
-	return ((irq == 2) ? 9 : irq);
-}
-
-extern void disable_irq (unsigned int);
-extern void disable_irq_nosync (unsigned int);
-extern void enable_irq (unsigned int);
-extern void set_irq_affinity_info (unsigned int irq, int dest, int redir);
-
-#ifdef CONFIG_SMP
-extern void move_irq(int irq);
-#else
-#define move_irq(irq)
-#endif
-
-struct irqaction;
-struct pt_regs;
-int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
-
-extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs);
-
-#endif /* _ASM_IA64_IRQ_H */
diff -r a33af75083c7 -r 07a80c52d7c1 xen/include/asm-x86/irq.h
--- a/xen/include/asm-x86/irq.h	Thu Oct 13 10:44:27 2011 +0100
+++ b/xen/include/asm-x86/irq.h	Wed Oct 19 12:50:54 2011 +0200
@@ -21,7 +21,7 @@
 #define LEGACY_VECTOR(irq)          ((irq) + FIRST_LEGACY_VECTOR)
 
 #define irq_to_desc(irq)    (&irq_desc[irq])
-#define irq_cfg(irq)        (&irq_cfg[irq])
+#define irq_cfg(irq)        (&irq_desc[irq].arch)
 
 typedef struct {
     DECLARE_BITMAP(_bits,NR_VECTORS);
@@ -30,6 +30,7 @@
 struct irq_desc;
 
 struct irq_cfg {
+#define arch_irq_desc irq_cfg
         s16 vector;                  /* vector itself is only 8 bits, */
         s16 old_vector;              /* but we use -1 for unassigned  */
         cpumask_t cpu_mask;
@@ -46,8 +47,6 @@
 
 #define IRQ_VECTOR_UNASSIGNED (-1)
 
-extern struct irq_cfg *irq_cfg;
-
 typedef int vector_irq_t[NR_VECTORS];
 DECLARE_PER_CPU(vector_irq_t, vector_irq);
 
diff -r a33af75083c7 -r 07a80c52d7c1 xen/include/xen/irq.h
--- a/xen/include/xen/irq.h	Thu Oct 13 10:44:27 2011 +0100
+++ b/xen/include/xen/irq.h	Wed Oct 19 12:50:54 2011 +0200
@@ -63,7 +63,6 @@
 #endif
 
 struct msi_desc;
-struct irq_cfg;
 /*
  * This is the "IRQ descriptor", which contains various information
  * about the irq, including what kind of hardware handling it has,
@@ -74,9 +73,9 @@
     hw_irq_controller *handler;
     struct msi_desc   *msi_desc;
     struct irqaction *action;	/* IRQ action list */
-    struct irq_cfg *chip_data;
     int irq;
     spinlock_t lock;
+    struct arch_irq_desc arch;
     cpumask_t affinity;
     cpumask_t pending_mask;  /* IRQ migration pending mask */
 
@@ -97,32 +96,6 @@
 
 #define request_irq(irq, handler, irqflags, devname, devid) \
     request_irq_vector(irq_to_vector(irq), handler, irqflags, devname, devid)
-
-static inline unsigned int irq_to_vector(int);
-extern int setup_irq_vector(unsigned int, struct irqaction *);
-extern void release_irq_vector(unsigned int);
-extern int request_irq_vector(unsigned int vector,
-               void (*handler)(int, void *, struct cpu_user_regs *),
-               unsigned long irqflags, const char * devname, void *dev_id);
-
-#define create_irq(x) assign_irq_vector(AUTO_ASSIGN_IRQ)
-#define destroy_irq(x) free_irq_vector(x)
-
-#define irq_cfg(x)        &irq_cfg[(x)]
-#define irq_to_desc(x)    &irq_desc[(x)]
-
-#define irq_complete_move(x) do {} \
-    while(!x)
-
-#define domain_pirq_to_irq(d, irq) domain_irq_to_vector(d, irq)
-
-struct irq_cfg {
-        int  vector;
-        cpumask_t cpu_mask;
-};
-
-extern struct irq_cfg irq_cfg[];
-
 #else
 extern int setup_irq(unsigned int irq, struct irqaction *);
 extern void release_irq(unsigned int irq);

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 20 10:22:29 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 20 Oct 2011 10:22:29 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RGwK5-0007hU-L7; Thu, 20 Oct 2011 10:22:29 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RGwJy-0007gZ-Ra
	for xen-changelog@lists.xensource.com; Thu, 20 Oct 2011 10:22:23 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-182.messagelabs.com!1319131336!184062!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5145 invoked from network); 20 Oct 2011 17:22:17 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Oct 2011 17:22:17 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RGwJr-0001nx-OM
	for xen-changelog@lists.xensource.com; Thu, 20 Oct 2011 18:22:15 +0100
Message-Id: <E1RGwJr-0001nx-OM@xenbits.xen.org>
Date: Thu, 20 Oct 2011 18:22:14 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: check p2mt in
	p2m_mem_paging functions
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 Olaf Hering <olaf@aepfle.de>
# Date 1319106355 -3600
# Node ID fd3fa0a850207f64017f9312d5fe235aa53957e3
# Parent  14b369de76adeb8b247608253f7dd650e27c31fa
xenpaging: check p2mt in p2m_mem_paging functions

Add checks to forward the p2m_ram_paging* state properly during page-in.

Resume can be called several times if several vcpus called populate for
the gfn. Finish resume only once.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 14b369de76ad -r fd3fa0a85020 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Wed Oct 19 12:51:42 2011 +0200
+++ b/xen/arch/x86/mm/p2m.c	Thu Oct 20 11:25:55 2011 +0100
@@ -851,16 +851,22 @@
     p2m_access_t a;
     mfn_t mfn;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
-    int ret = -ENOMEM;
+    int ret;
 
     p2m_lock(p2m);
 
     mfn = p2m->get_entry(p2m, gfn, &p2mt, &a, p2m_query, NULL);
 
+    ret = -ENOENT;
+    /* Allow only missing pages */
+    if ( p2mt != p2m_ram_paging_in_start )
+        goto out;
+
     /* Allocate a page if the gfn does not have one yet */
     if ( !mfn_valid(mfn) )
     {
         /* Get a free page */
+        ret = -ENOMEM;
         page = alloc_domheap_page(p2m->domain, 0);
         if ( unlikely(page == NULL) )
             goto out;
@@ -896,9 +902,15 @@
     {
         p2m_lock(p2m);
         mfn = p2m->get_entry(p2m, rsp.gfn, &p2mt, &a, p2m_query, NULL);
-        set_p2m_entry(p2m, rsp.gfn, mfn, 0, p2m_ram_rw, a);
-        set_gpfn_from_mfn(mfn_x(mfn), rsp.gfn);
-        audit_p2m(p2m, 1);
+        /* Allow only pages which were prepared properly, or pages which
+         * were nominated but not evicted */
+        if ( mfn_valid(mfn) && 
+             (p2mt == p2m_ram_paging_in || p2mt == p2m_ram_paging_in_start) )
+        {
+            set_p2m_entry(p2m, rsp.gfn, mfn, 0, p2m_ram_rw, a);
+            set_gpfn_from_mfn(mfn_x(mfn), rsp.gfn);
+            audit_p2m(p2m, 1);
+        }
         p2m_unlock(p2m);
     }
 

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 20 10:22:45 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 20 Oct 2011 10:22:45 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RGwKK-0007k9-H2; Thu, 20 Oct 2011 10:22:45 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RGwK2-0007gf-AV
	for xen-changelog@lists.xensource.com; Thu, 20 Oct 2011 10:22:26 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-21.messagelabs.com!1319131343!1032443!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12070 invoked from network); 20 Oct 2011 17:22:23 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Oct 2011 17:22:23 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RGwJz-0001r8-3N
	for xen-changelog@lists.xensource.com; Thu, 20 Oct 2011 18:22:23 +0100
Message-Id: <E1RGwJz-0001r8-3N@xenbits.xen.org>
Date: Thu, 20 Oct 2011 18:22:22 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: disallow paging in a PoD
	guest
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 Olaf Hering <olaf@aepfle.de>
# Date 1319106358 -3600
# Node ID a06609840ff1335f1c36129881cfda4aaee7679b
# Parent  18306b05479933d675a9f4c714e52c7f93f92ce9
xenpaging: disallow paging in a PoD guest

Disallow xenpaging in a PoD guest until coexistance between the two features
is properly implemented.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 18306b054799 -r a06609840ff1 tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c	Thu Oct 20 11:25:58 2011 +0100
+++ b/tools/xenpaging/xenpaging.c	Thu Oct 20 11:25:58 2011 +0100
@@ -246,6 +246,9 @@
             case ENODEV:
                 ERROR("EPT not supported for this guest");
                 break;
+            case EXDEV:
+                ERROR("xenpaging not supported in a PoD guest");
+                break;
             default:
                 ERROR("Error initialising shared page: %s", strerror(errno));
                 break;
diff -r 18306b054799 -r a06609840ff1 xen/arch/x86/mm/mem_event.c
--- a/xen/arch/x86/mm/mem_event.c	Thu Oct 20 11:25:58 2011 +0100
+++ b/xen/arch/x86/mm/mem_event.c	Thu Oct 20 11:25:58 2011 +0100
@@ -253,6 +253,7 @@
     case XEN_DOMCTL_MEM_EVENT_OP_PAGING:
     {
         struct mem_event_domain *med = &d->mem_paging;
+        struct p2m_domain *p2m = p2m_get_hostp2m(d);
         rc = -ENODEV;
         /* Only HAP is supported */
         if ( !hap_enabled(d) )
@@ -262,6 +263,11 @@
         if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
             break;
 
+        rc = -EXDEV;
+        /* Disallow paging in a PoD guest */
+        if ( p2m->pod.entry_count )
+            break;
+
         switch( mec->op )
         {
         case XEN_DOMCTL_MEM_EVENT_OP_PAGING_ENABLE:

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 20 10:22:53 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 20 Oct 2011 10:22:53 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RGwKT-0007nG-2H; Thu, 20 Oct 2011 10:22:53 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RGwK2-0007gb-34
	for xen-changelog@lists.xensource.com; Thu, 20 Oct 2011 10:22:26 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-21.messagelabs.com!1319131342!1032441!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12046 invoked from network); 20 Oct 2011 17:22:22 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	20 Oct 2011 17:22:22 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RGwJs-0001pH-IW
	for xen-changelog@lists.xensource.com; Thu, 20 Oct 2011 18:22:20 +0100
Message-Id: <E1RGwJs-0001pH-IW@xenbits.xen.org>
Date: Thu, 20 Oct 2011 18:22:15 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: document p2m_mem_paging
	functions
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 Olaf Hering <olaf@aepfle.de>
# Date 1319106358 -3600
# Node ID 18306b05479933d675a9f4c714e52c7f93f92ce9
# Parent  fd3fa0a850207f64017f9312d5fe235aa53957e3
xenpaging: document p2m_mem_paging functions

Add some documentation for each of the p2m_mem_paging functions to describe
what they ought to do.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r fd3fa0a85020 -r 18306b054799 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Thu Oct 20 11:25:55 2011 +0100
+++ b/xen/arch/x86/mm/p2m.c	Thu Oct 20 11:25:58 2011 +0100
@@ -668,6 +668,24 @@
 }
 
 #ifdef __x86_64__
+/**
+ * p2m_mem_paging_nominate - Mark a guest page as to-be-paged-out
+ * @d: guest domain
+ * @gfn: guest page to nominate
+ *
+ * Returns 0 for success or negative errno values if gfn is not pageable.
+ *
+ * p2m_mem_paging_nominate() is called by the pager and checks if a guest page
+ * can be paged out. If the following conditions are met the p2mt will be
+ * changed:
+ * - the gfn is backed by a mfn
+ * - the p2mt of the gfn is pageable
+ * - the mfn is not used for IO
+ * - the mfn has exactly one user and has no special meaning
+ *
+ * Once the p2mt is changed the page is readonly for the guest.  On success the
+ * pager can write the page contents to disk and later evict the page.
+ */
 int p2m_mem_paging_nominate(struct domain *d, unsigned long gfn)
 {
     struct page_info *page;
@@ -714,6 +732,25 @@
     return ret;
 }
 
+/**
+ * p2m_mem_paging_evict - Mark a guest page as paged-out
+ * @d: guest domain
+ * @gfn: guest page to evict
+ *
+ * Returns 0 for success or negative errno values if eviction is not possible.
+ *
+ * p2m_mem_paging_evict() is called by the pager and will free a guest page and
+ * release it back to Xen. If the following conditions are met the page can be
+ * freed:
+ * - the gfn is backed by a mfn
+ * - the gfn was nominated
+ * - the mfn has still exactly one user and has no special meaning
+ *
+ * After successful nomination some other process could have mapped the page. In
+ * this case eviction can not be done. If the gfn was populated before the pager
+ * could evict it, eviction can not be done either. In this case the gfn is
+ * still backed by a mfn.
+ */
 int p2m_mem_paging_evict(struct domain *d, unsigned long gfn)
 {
     struct page_info *page;
@@ -773,6 +810,15 @@
     return ret;
 }
 
+/**
+ * p2m_mem_paging_drop_page - Tell pager to drop its reference to a paged page
+ * @d: guest domain
+ * @gfn: guest page to drop
+ *
+ * p2m_mem_paging_drop_page() will notify the pager that a paged-out gfn was
+ * released by the guest. The pager is supposed to drop its reference of the
+ * gfn.
+ */
 void p2m_mem_paging_drop_page(struct domain *d, unsigned long gfn)
 {
     struct vcpu *v = current;
@@ -791,6 +837,27 @@
     }
 }
 
+/**
+ * p2m_mem_paging_populate - Tell pager to populete a paged page
+ * @d: guest domain
+ * @gfn: guest page in paging state
+ *
+ * p2m_mem_paging_populate() will notify the pager that a page in any of the
+ * paging states needs to be written back into the guest.
+ * This function needs to be called whenever gfn_to_mfn() returns any of the p2m
+ * paging types because the gfn may not be backed by a mfn.
+ *
+ * The gfn can be in any of the paging states, but the pager needs only be
+ * notified when the gfn is in the paging-out path (paging_out or paged).  This
+ * function may be called more than once from several vcpus. If the vcpu belongs
+ * to the guest, the vcpu must be stopped and the pager notified that the vcpu
+ * was stopped. The pager needs to handle several requests for the same gfn.
+ *
+ * If the gfn is not in the paging-out path and the vcpu does not belong to the
+ * guest, nothing needs to be done and the function assumes that a request was
+ * already sent to the pager. In this case the caller has to try again until the
+ * gfn is fully paged in again.
+ */
 void p2m_mem_paging_populate(struct domain *d, unsigned long gfn)
 {
     struct vcpu *v = current;
@@ -844,6 +911,17 @@
     mem_event_put_request(d, &d->mem_paging, &req);
 }
 
+/**
+ * p2m_mem_paging_prep - Allocate a new page for the guest
+ * @d: guest domain
+ * @gfn: guest page in paging state
+ *
+ * p2m_mem_paging_prep() will allocate a new page for the guest if the gfn is
+ * not backed by a mfn. It is called by the pager.
+ * It is required that the gfn was already populated. The gfn may already have a
+ * mfn if populate was called for  gfn which was nominated but not evicted. In
+ * this case only the p2mt needs to be forwarded.
+ */
 int p2m_mem_paging_prep(struct domain *d, unsigned long gfn)
 {
     struct page_info *page;
@@ -886,6 +964,21 @@
     return ret;
 }
 
+/**
+ * p2m_mem_paging_resume - Resume guest gfn and vcpus
+ * @d: guest domain
+ * @gfn: guest page in paging state
+ *
+ * p2m_mem_paging_resume() will forward the p2mt of a gfn to ram_rw and all
+ * waiting vcpus will be unpaused again. It is called by the pager.
+ * 
+ * The gfn was previously either evicted and populated, or nominated and
+ * populated. If the page was evicted the p2mt will be p2m_ram_paging_in. If
+ * the page was just nominated the p2mt will be p2m_ram_paging_in_start because
+ * the pager did not call p2m_mem_paging_prep().
+ *
+ * If the gfn was dropped the vcpu needs to be unpaused.
+ */
 void p2m_mem_paging_resume(struct domain *d)
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 20 17:33:45 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 20 Oct 2011 17:33:45 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RH33R-0001nM-Cq; Thu, 20 Oct 2011 17:33:45 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RH32w-0001b4-F3
	for xen-changelog@lists.xensource.com; Thu, 20 Oct 2011 17:33:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-216.messagelabs.com!1319157190!460808!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5942 invoked from network); 21 Oct 2011 00:33:11 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Oct 2011 00:33:11 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RH32s-000471-Ac
	for xen-changelog@lists.xensource.com; Fri, 21 Oct 2011 01:33:10 +0100
Message-Id: <E1RH32s-000471-Ac@xenbits.xen.org>
Date: Fri, 21 Oct 2011 01:33:09 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm/p2m: don't leak state if
	nested-p2m init fails.
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 Tim Deegan <tim@xen.org>
# Date 1319121361 -3600
# Node ID 6c583d35d76dda2236c81d9437ff9d57ab02c006
# Parent  a06609840ff1335f1c36129881cfda4aaee7679b
x86/mm/p2m: don't leak state if nested-p2m init fails.

Signed-off-by: Tim Deegan <tim@xen.org>
---


diff -r a06609840ff1 -r 6c583d35d76d xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Thu Oct 20 11:25:58 2011 +0100
+++ b/xen/arch/x86/mm/p2m.c	Thu Oct 20 15:36:01 2011 +0100
@@ -113,6 +113,7 @@
 int p2m_init(struct domain *d)
 {
     struct p2m_domain *p2m;
+    int rc;
 
     p2m_get_hostp2m(d) = p2m = xzalloc(struct p2m_domain);
     if ( p2m == NULL )
@@ -121,9 +122,11 @@
 
     /* Must initialise nestedp2m unconditionally
      * since nestedhvm_enabled(d) returns false here.
-     * (p2m_init runs too early for HVM_PARAM_* options)
-     */
-    return p2m_init_nestedp2m(d);
+     * (p2m_init runs too early for HVM_PARAM_* options) */
+    rc = p2m_init_nestedp2m(d);
+    if ( rc ) 
+        p2m_final_teardown(d);
+    return rc;
 }
 
 void p2m_change_entry_type_global(struct domain *d,

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 20 19:44:41 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 20 Oct 2011 19:44:41 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RH569-0006ho-4e; Thu, 20 Oct 2011 19:44:41 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RH566-0006h7-LA
	for xen-changelog@lists.xensource.com; Thu, 20 Oct 2011 19:44:38 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-27.messagelabs.com!1319165063!42570148!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32337 invoked from network); 21 Oct 2011 02:44:24 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-11.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Oct 2011 02:44:24 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RH560-0006vr-UZ
	for xen-changelog@lists.xensource.com; Fri, 21 Oct 2011 03:44:33 +0100
Message-Id: <E1RH560-0006vr-UZ@xenbits.xen.org>
Date: Fri, 21 Oct 2011 03:44:28 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] Update Xen version to 4.1.2
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@xen.org>
# Date 1319128524 -3600
# Node ID 3eca5bf65e6cca881d599c68f2305f865e0f9fd0
# Parent  3f8fb62436e67018b4221a8ab8fa88780c55d4a3
Update Xen version to 4.1.2
---


diff -r 3f8fb62436e6 -r 3eca5bf65e6c Config.mk
--- a/Config.mk	Fri Oct 07 15:47:08 2011 +0100
+++ b/Config.mk	Thu Oct 20 17:35:24 2011 +0100
@@ -179,7 +179,7 @@
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG := xen-4.1.2-rc3
+QEMU_TAG := xen-4.1.2
 #QEMU_TAG ?= e073e69457b4d99b6da0b6536296e3498f7f6599
 # Fri Feb 11 17:54:51 2011 +0000
 # qemu-xen: fix segfault with empty cdroms
diff -r 3f8fb62436e6 -r 3eca5bf65e6c xen/Makefile
--- a/xen/Makefile	Fri Oct 07 15:47:08 2011 +0100
+++ b/xen/Makefile	Thu Oct 20 17:35:24 2011 +0100
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 1
-export XEN_EXTRAVERSION ?= .2-rc3$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .2$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 20 19:44:50 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 20 Oct 2011 19:44:50 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RH56H-0006kn-R3; Thu, 20 Oct 2011 19:44:49 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RH567-0006h8-QF
	for xen-changelog@lists.xensource.com; Thu, 20 Oct 2011 19:44:40 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-174.messagelabs.com!1319165076!36124794!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26212 invoked from network); 21 Oct 2011 02:44:36 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Oct 2011 02:44:36 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RH563-0006xJ-Ac
	for xen-changelog@lists.xensource.com; Fri, 21 Oct 2011 03:44:35 +0100
Message-Id: <E1RH563-0006xJ-Ac@xenbits.xen.org>
Date: Fri, 21 Oct 2011 03:44:34 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] Added tag RELEASE-4.1.2 for
	changeset 3eca5bf65e6c
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@xen.org>
# Date 1319128533 -3600
# Node ID d5bb65d3ec249f217227422d8ba2c08f498f4a0c
# Parent  3eca5bf65e6cca881d599c68f2305f865e0f9fd0
Added tag RELEASE-4.1.2 for changeset 3eca5bf65e6c
---


diff -r 3eca5bf65e6c -r d5bb65d3ec24 .hgtags
--- a/.hgtags	Thu Oct 20 17:35:24 2011 +0100
+++ b/.hgtags	Thu Oct 20 17:35:33 2011 +0100
@@ -61,3 +61,4 @@
 1f21da33dea4acb2dbfb988bcd1b7898e019316c 4.1.2-rc1
 3e6a3bf83935cc2460707b94ef2801bb6f19d581 4.1.2-rc2
 24041ed83728ac6c26d3c32d29d7d08eb8433149 4.1.2-rc3
+3eca5bf65e6cca881d599c68f2305f865e0f9fd0 RELEASE-4.1.2

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 20 19:45:03 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 20 Oct 2011 19:45:03 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RH56U-0006nt-Si; Thu, 20 Oct 2011 19:45:03 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RH569-0006hA-5q
	for xen-changelog@lists.xensource.com; Thu, 20 Oct 2011 19:44:41 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-182.messagelabs.com!1319165077!212862!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9530 invoked from network); 21 Oct 2011 02:44:38 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-16.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	21 Oct 2011 02:44:38 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RH565-0006xz-73
	for xen-changelog@lists.xensource.com; Fri, 21 Oct 2011 03:44:37 +0100
Message-Id: <E1RH565-0006xz-73@xenbits.xen.org>
Date: Fri, 21 Oct 2011 03:44:36 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] Added signature for changeset
	3eca5bf65e6c
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@xen.org>
# Date 1319128563 -3600
# Node ID d4253bc5418b64a4b3a0e04b7d514ac15f5fe124
# Parent  d5bb65d3ec249f217227422d8ba2c08f498f4a0c
Added signature for changeset 3eca5bf65e6c
---


diff -r d5bb65d3ec24 -r d4253bc5418b .hgsigs
--- a/.hgsigs	Thu Oct 20 17:35:33 2011 +0100
+++ b/.hgsigs	Thu Oct 20 17:36:03 2011 +0100
@@ -14,3 +14,4 @@
 1f21da33dea4acb2dbfb988bcd1b7898e019316c 0 iQEcBAABAgAGBQJOViYyAAoJEIP+FMlX6CvZew0IAKJ/gjTWVmD9cBEN6XJYYW+z831Hsm4Msk9QBskJiV2cVFcaF9/SzexnC6waU1BpxMCLWNusaPl18Uc2knF0kYyXAjeWDZNcRZtcZIS/kDzPBIAGkq4wI+DA4nfFCnYNsFk9dy5aqkvVOVpvn7E6fUcOtWQC+IfuOrMo6mRjew4dPlv3xhwYgf2oQf9I1YLoJ6UVh0o1g0jHeXhYZu8Fqm/a4O0kdbvUDHuViVT0qHhGIi6dLkD0w/ih+o7S3FAMXLpLVBdt23bVBti4jwFMnMEgy2wkP4lbfM++1Io//Bn7tg4CZcNHYt6a7ENmhL+lmTbh0GyteZ9sgbfricSFkGc=
 3e6a3bf83935cc2460707b94ef2801bb6f19d581 0 iQEcBAABAgAGBQJOZzwsAAoJEIP+FMlX6CvZXBIIAJFb+nUaqTCQRT5cE1mn4n5lEdtBY7L/ar4/rzWAiavQYkaoP93HyOdo0sf2SdwcpTNCXw0TDUmZU3xMqBiwWwp2MX3AFM/0dnPv2CoIH/k3vXr26eBJo15w2dFu2dF8OZ/Tn0NTdXdPd+qa7ugqVqT0PYgyQ8+euQJfcdYAY6YCjGD4v5cX529oB2aqoFKBBsHMnW6uD3OYf3sdvj85wgVpip7nw+5OZWrYP2lK/RXzlo42B/l+fNPJjsM8uU928ETNevJGPK28EJDaNwrEktTJQJYNa6K1oal/kpNP6FM1pOOdel69NSGbMw4Obv0eZ/kZahBLONfCLw4kYVggmWg=
 24041ed83728ac6c26d3c32d29d7d08eb8433149 0 iQEcBAABAgAGBQJOjxDqAAoJEIP+FMlX6CvZohIH/2krgh6rTz6hjsv6HOFWQkekqHjZyyQBgdl3tfgSN/vSd3rJPN6mvaYjh8ZltmBbcHcRCmriTr7KK9e6kOChU7hyTCBDmtGxNN5TgMoAf27pSMrFN1HvK0ohQzGXvqKLAepTXW2ew+Abno3OgKRwUMpQJVlq+ZUCuqKODYI9nRE10XV6ORAejgE5mDYNn3BbvcI07Cjmqgm7bJzi5Hv0wzscPuJxQjz4vrJ+5ne65TYOzFPNkIFKeRETP+Shd9Gkw2/w9sbzQ2hzTH/02sUrsxolXD2wexfxgVz07rTe7qgbqKruCBOPtbcnGMAbs3e5NB7V6H3HnkTRtHQ4BosUMnE=
+3eca5bf65e6cca881d599c68f2305f865e0f9fd0 0 iQEcBAABAgAGBQJOoE3xAAoJEIP+FMlX6CvZ0P4IALamOXJi4s9OzfutsjD//V5QYU972Y+NxBo2j7VNKnRaFwZ57RbxLE8dzsAufvxx/886ScyvdehAfWkpqhU+brLfKNftG54Bm3DFd+mDCdcTvHOGkKw768YUPBNjOhQZ8voVSnalrQaOlbibluRTYGK1Y4lcWXwP8SSCCR7bpm8VLrSKQoatiaPtc/OxBO+9UOlHFUR2tWt5YY4a5NczaXJ2xGERMnOssE83GjxSD/07+y9aDLNjnQiYqQfSkF46Gv4s94hPv8KeHEiGDMoZF/YqHr+4YxDCt8y39TXiQfT67O3o9xx6VfynTIHRo9CZ0qGrEqz7o8GK1vWhlfq3T5M=

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 24 11:11:16 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 24 Oct 2011 11:11:16 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RIOzU-0003RQ-Sq; Mon, 24 Oct 2011 11:11:16 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RIOzR-0003Qg-JR
	for xen-changelog@lists.xensource.com; Mon, 24 Oct 2011 11:11:13 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-216.messagelabs.com!1319479870!886781!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26199 invoked from network); 24 Oct 2011 18:11:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	24 Oct 2011 18:11:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RIOzO-0002wh-9a
	for xen-changelog@lists.xensource.com; Mon, 24 Oct 2011 19:11:10 +0100
Message-Id: <E1RIOzO-0002wh-9a@xenbits.xen.org>
Date: Mon, 24 Oct 2011 19:11:09 +0100
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] Added tag RELEASE-4.0.3 for
	changeset 00b5807c08f2
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@xen.org>
# Date 1319128543 -3600
# Node ID ee265743eb93a61e1823ab7d45207955b16dfc51
# Parent  00b5807c08f266b11fe54de808bafc4f74dde972
Added tag RELEASE-4.0.3 for changeset 00b5807c08f2
---


diff -r 00b5807c08f2 -r ee265743eb93 .hgtags
--- a/.hgtags	Thu Oct 20 17:35:18 2011 +0100
+++ b/.hgtags	Thu Oct 20 17:35:43 2011 +0100
@@ -63,3 +63,4 @@
 47f9c9648fe7b531e41575a2bf0b0234037985b4 4.0.3-rc1
 8d012bc20d3063d76b851d9909da6f9fa8ef469c 4.0.3-rc2
 fd7c4d4e52d9aa4ad228d73d068fa7db79a0c904 4.0.3-rc3
+00b5807c08f266b11fe54de808bafc4f74dde972 RELEASE-4.0.3

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 24 11:11:29 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 24 Oct 2011 11:11:29 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RIOzh-0003Un-86; Mon, 24 Oct 2011 11:11:29 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RIOzS-0003Qh-AL
	for xen-changelog@lists.xensource.com; Mon, 24 Oct 2011 11:11:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-182.messagelabs.com!1319479870!601758!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18463 invoked from network); 24 Oct 2011 18:11:11 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	24 Oct 2011 18:11:11 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RIOzO-0002xN-Pm
	for xen-changelog@lists.xensource.com; Mon, 24 Oct 2011 19:11:10 +0100
Message-Id: <E1RIOzO-0002xN-Pm@xenbits.xen.org>
Date: Mon, 24 Oct 2011 19:11:10 +0100
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] Added signature for changeset
	00b5807c08f2
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@xen.org>
# Date 1319128552 -3600
# Node ID 8aded64130a6cb22291041895c44c55b52d06c38
# Parent  ee265743eb93a61e1823ab7d45207955b16dfc51
Added signature for changeset 00b5807c08f2
---


diff -r ee265743eb93 -r 8aded64130a6 .hgsigs
--- a/.hgsigs	Thu Oct 20 17:35:43 2011 +0100
+++ b/.hgsigs	Thu Oct 20 17:35:52 2011 +0100
@@ -16,3 +16,4 @@
 47f9c9648fe7b531e41575a2bf0b0234037985b4 0 iQEcBAABAgAGBQJOViZ/AAoJEIP+FMlX6CvZovAH/2C6X/PU9h9Q8Way8NTGmZsJroS0OlPpiYoBQ/BAgha0NxO6pKiuCcuGwApcvMnDTly3UyJzrh5uf5E2Qfl5N3Zwg0fRNvpzArN8JjTZQI3yr0iDc1FioVRpllPQCKVrFkB5UUuAkXRlOJLkPc78PNaWdYvEl9lPQdyXwg1GwGsSjomH4HI4UmB1uWsx0TgNaywN1l7FZ77Ny1u7VVOczSSBFlhI1shXqCXgbMRW2pxMCNkiV6kozYuHKFzwK/ZAFSrw1d9bgVjTsSrjkAuaMTnSIFoVSpOsv0zJZnIlhKe0ChpbU90OcM2Pol3CoJIdvHZOL2Gi2T04Js+iKW25nV8=
 8d012bc20d3063d76b851d9909da6f9fa8ef469c 0 iQEcBAABAgAGBQJOZzxcAAoJEIP+FMlX6CvZtR4H+wS6lQUaNK71V/mXuiPz4Y30pKv3w419IfW9ICA6unfxm+IkCbR4QEtO/6aZkU7Q1ZYSDfIyzA60E/rHcU5ZJ27lCvaedrYa4A8W9Ry7+e31MYvG+fvZAO2ZIPRks+HAg79joU10xUKQirTQi436viBL5NrN1R12Y5B75ue6YHhkuhI0XUv9l5MbO4utsTki3YqKTmsZbPCvzymZr0dXG8t7U7AWxbXTfzyKxsoCg7HdYzEPufhIe903xEhQaiSXSSUz78wUCN4KxXGubejEu2/09L4SRzoxV6Mw1K39EqtrisZVazsuy+aEobK5B9U/JGzjGK/CNlw+LobkW2qvMrE=
 fd7c4d4e52d9aa4ad228d73d068fa7db79a0c904 0 iQEcBAABAgAGBQJOjxDgAAoJEIP+FMlX6CvZbugIAJhthGHfoc7ln0WHj6ZAA2UVPo77l/VdceYohgCnWqgj16SyxkMgSUoieBhO1Fb/+9QzyXbV+ZAkJFCbp0lZ3bg62ZRpRjO38443D1aczabFno1GI22rUiwOkT1v6nvEQbHyc2L6lpzhDvv2h9Mv73tmti/XfM7uzfQD9Ea40BOGZ7PPOLifMnOo2FKepDyRNlo0thrz7kMpri0V9wm7Bx0Rx0SovMA3z9gtCeTYj8HgJ3niBibTe57AjCMwQCODRpAAhKdzGJ7GBxJ93q7WeJoNNxmQzYqFbUI3P3Jo/fF4APsxtnO6dC0Qt0IWVu0w6NCmfasnS9Vc/yifq7fDvLg=
+00b5807c08f266b11fe54de808bafc4f74dde972 0 iQEcBAABAgAGBQJOoE3nAAoJEIP+FMlX6CvZg6UH/1WLvfz7MiyLJ2igox5gOQdcfrMe8ohnyd/CGwG/vex+Ohc7mKXVRoIcrR02a247eA3FmJKDqj/NDAbLTjnCzFjlxWKBQo2HO1bGZSGBD8b+hbR1laBSinXB5WscQG5VO7S2uj4j0GZbZ9ATdF11qhzWTviiBxei0l/INtoOb5NhsWpkIubQWVJLBEw9X6COMvwCabcoCDa/xZUxQfOHhRfdp1ouk4V9Zf7amW3ne4p0tMHjN9e0Ic+waBDX4Fyfns4GqDKfBgTOq2AgMO8BSmUuBQtIcYw03Z5GYco1Tfz3Lk3tTq4E+TyWXKKSQ5NOFI+9AxJn813NyR+r+AwatrI=

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 24 11:11:39 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 24 Oct 2011 11:11:39 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RIOzr-0003Xq-NZ; Mon, 24 Oct 2011 11:11:39 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RIOzW-0003Qs-8y
	for xen-changelog@lists.xensource.com; Mon, 24 Oct 2011 11:11:19 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-216.messagelabs.com!1319479875!877898!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2962 invoked from network); 24 Oct 2011 18:11:15 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	24 Oct 2011 18:11:15 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RIOzN-0002va-Nt
	for xen-changelog@lists.xensource.com; Mon, 24 Oct 2011 19:11:09 +0100
Message-Id: <E1RIOzN-0002va-Nt@xenbits.xen.org>
Date: Mon, 24 Oct 2011 19:11:08 +0100
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] Update Xen version to 4.0.3
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@xen.org>
# Date 1319128518 -3600
# Node ID 00b5807c08f266b11fe54de808bafc4f74dde972
# Parent  f051e9973b792ba26e3ba83a025e29d1982eeaf7
Update Xen version to 4.0.3
---


diff -r f051e9973b79 -r 00b5807c08f2 Config.mk
--- a/Config.mk	Fri Oct 07 15:46:57 2011 +0100
+++ b/Config.mk	Thu Oct 20 17:35:18 2011 +0100
@@ -178,7 +178,7 @@
 # CONFIG_QEMU ?= ../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG := xen-4.0.3-rc3
+QEMU_TAG := xen-4.0.3
 #QEMU_TAG ?= 6d5b7ee3acfe8cc10681d2583a38398f7470ec2a
 # Wed Jan 5 23:42:03 2011 +0000
 # Change tap device mac address to prevent change of bridge's mac
diff -r f051e9973b79 -r 00b5807c08f2 xen/Makefile
--- a/xen/Makefile	Fri Oct 07 15:46:57 2011 +0100
+++ b/xen/Makefile	Thu Oct 20 17:35:18 2011 +0100
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 0
-export XEN_EXTRAVERSION ?= .3-rc3$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .3$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 24 15:33:16 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 24 Oct 2011 15:33:16 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RIT52-0004JQ-AY; Mon, 24 Oct 2011 15:33:16 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RIT4y-0004IB-WE
	for xen-changelog@lists.xensource.com; Mon, 24 Oct 2011 15:33:13 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-216.messagelabs.com!1319495589!906355!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20742 invoked from network); 24 Oct 2011 22:33:09 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-6.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	24 Oct 2011 22:33:09 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RIT4v-0003KQ-30
	for xen-changelog@lists.xensource.com; Mon, 24 Oct 2011 23:33:09 +0100
Message-Id: <E1RIT4v-0003KQ-30@xenbits.xen.org>
Date: Mon, 24 Oct 2011 23:33:08 +0100
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] Update Xen version to
	4.0.4-rc1-pre
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@xen.org>
# Date 1319475871 -3600
# Node ID c26edccc83b42e4fff04619acd4c50e877397aa5
# Parent  8aded64130a6cb22291041895c44c55b52d06c38
Update Xen version to 4.0.4-rc1-pre
---


diff -r 8aded64130a6 -r c26edccc83b4 xen/Makefile
--- a/xen/Makefile	Thu Oct 20 17:35:52 2011 +0100
+++ b/xen/Makefile	Mon Oct 24 18:04:31 2011 +0100
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 0
-export XEN_EXTRAVERSION ?= .3$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .4-rc1-pre$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 24 15:33:25 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 24 Oct 2011 15:33:25 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RIT5B-0004MT-KY; Mon, 24 Oct 2011 15:33:25 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RIT54-0004JN-Nr
	for xen-changelog@lists.xensource.com; Mon, 24 Oct 2011 15:33:19 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-182.messagelabs.com!1319495595!612794!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14799 invoked from network); 24 Oct 2011 22:33:15 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	24 Oct 2011 22:33:15 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RIT4v-0003Kf-JE
	for xen-changelog@lists.xensource.com; Mon, 24 Oct 2011 23:33:09 +0100
Message-Id: <E1RIT4v-0003Kf-JE@xenbits.xen.org>
Date: Mon, 24 Oct 2011 23:33:09 +0100
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] Revert
	xen-unstable:23871:503ee256fecf
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@xen.org>
# Date 1319475882 -3600
# Node ID da9f945b3db87567bcc7b7c031a4a9c1975e0dcd
# Parent  c26edccc83b42e4fff04619acd4c50e877397aa5
Revert xen-unstable:23871:503ee256fecf

Signed-off-by: Keir Fraser <keir@xen.org>
---


diff -r c26edccc83b4 -r da9f945b3db8 xen/arch/x86/microcode_amd.c
--- a/xen/arch/x86/microcode_amd.c	Mon Oct 24 18:04:31 2011 +0100
+++ b/xen/arch/x86/microcode_amd.c	Mon Oct 24 18:04:42 2011 +0100
@@ -97,7 +97,11 @@
     }
 
     if ( !equiv_cpu_id )
-	    return 0;
+    {
+        printk(KERN_ERR "microcode: CPU%d cpu_id "
+               "not found in equivalent cpu table\n", cpu);
+        return -EINVAL;
+    }
 
     if ( (mc_header->processor_rev_id) != equiv_cpu_id )
     {

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 24 17:55:28 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 24 Oct 2011 17:55:28 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RIVId-0008MG-Ae; Mon, 24 Oct 2011 17:55:27 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RIVIQ-0008KB-8z
	for xen-changelog@lists.xensource.com; Mon, 24 Oct 2011 17:55:19 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1319504085!54550741!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21180 invoked from network); 25 Oct 2011 00:54:45 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-6.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	25 Oct 2011 00:54:45 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RIVIM-00061Y-Nu
	for xen-changelog@lists.xensource.com; Tue, 25 Oct 2011 01:55:10 +0100
Message-Id: <E1RIVIM-00061Y-Nu@xenbits.xen.org>
Date: Tue, 25 Oct 2011 01:55:09 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] introduce and use nr_cpu_ids and
	nr_cpumask_bits
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 Jan Beulich <jbeulich@suse.com>
# Date 1319181462 -7200
# Node ID 511d5e65a30231fab56b47ffe7b2f1483b023700
# Parent  6c583d35d76dda2236c81d9437ff9d57ab02c006
introduce and use nr_cpu_ids and nr_cpumask_bits

The former is the runtime equivalent of NR_CPUS (and users of NR_CPUS,
where necessary, get adjusted accordingly), while the latter is for the
sole use of determining the allocation size when dynamically allocating
CPU masks (done later in this series).

Adjust accessors to use either of the two to bound their bitmap
operations - which one gets used depends on whether accessing the bits
in the gap between nr_cpu_ids and nr_cpumask_bits is benign but more
efficient.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r 6c583d35d76d -r 511d5e65a302 xen/arch/x86/acpi/cpu_idle.c
--- a/xen/arch/x86/acpi/cpu_idle.c	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/arch/x86/acpi/cpu_idle.c	Fri Oct 21 09:17:42 2011 +0200
@@ -900,7 +900,7 @@
     if ( apic_id == BAD_APICID )
         return -1;
 
-    for ( i = 0; i < NR_CPUS; i++ )
+    for ( i = 0; i < nr_cpu_ids; i++ )
     {
         if ( apic_id == x86_cpu_to_apicid[i] )
             return i;
diff -r 6c583d35d76d -r 511d5e65a302 xen/arch/x86/acpi/cpufreq/cpufreq.c
--- a/xen/arch/x86/acpi/cpufreq/cpufreq.c	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c	Fri Oct 21 09:17:42 2011 +0200
@@ -209,7 +209,7 @@
 
     if (!cpumask_test_cpu(cpu, mask))
         cpu = cpumask_first(mask);
-    if (cpu >= NR_CPUS || !cpu_online(cpu))
+    if (cpu >= nr_cpu_ids || !cpu_online(cpu))
         return 0;
 
     policy = per_cpu(cpufreq_cpu_policy, cpu);
diff -r 6c583d35d76d -r 511d5e65a302 xen/arch/x86/acpi/lib.c
--- a/xen/arch/x86/acpi/lib.c	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/arch/x86/acpi/lib.c	Fri Oct 21 09:17:42 2011 +0200
@@ -95,7 +95,7 @@
 
 	if (!(acpi_id + 1))
 		c = &boot_cpu_data;
-	else if (cpu >= NR_CPUS || !cpu_online(cpu))
+	else if (cpu >= nr_cpu_ids || !cpu_online(cpu))
 		return -EINVAL;
 	else
 		c = cpu_data + cpu;
diff -r 6c583d35d76d -r 511d5e65a302 xen/arch/x86/cpu/common.c
--- a/xen/arch/x86/cpu/common.c	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/arch/x86/cpu/common.c	Fri Oct 21 09:17:42 2011 +0200
@@ -532,7 +532,7 @@
 		printk(KERN_INFO  "CPU: Hyper-Threading is disabled\n");
 	} else if (c->x86_num_siblings > 1 ) {
 
-		if (c->x86_num_siblings > NR_CPUS) {
+		if (c->x86_num_siblings > nr_cpu_ids) {
 			printk(KERN_WARNING "CPU: Unsupported number of the siblings %d", c->x86_num_siblings);
 			c->x86_num_siblings = 1;
 			return;
diff -r 6c583d35d76d -r 511d5e65a302 xen/arch/x86/cpu/mcheck/mce.c
--- a/xen/arch/x86/cpu/mcheck/mce.c	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/arch/x86/cpu/mcheck/mce.c	Fri Oct 21 09:17:42 2011 +0200
@@ -1487,7 +1487,7 @@
         mc_msrinject = &op->u.mc_msrinject;
         target = mc_msrinject->mcinj_cpunr;
 
-        if (target >= NR_CPUS)
+        if (target >= nr_cpu_ids)
             return x86_mcerr("do_mca inject: bad target", -EINVAL);
 
         if (!cpu_online(target))
@@ -1514,7 +1514,7 @@
         mc_mceinject = &op->u.mc_mceinject;
         target = mc_mceinject->mceinj_cpunr;
 
-        if (target >= NR_CPUS)
+        if (target >= nr_cpu_ids)
             return x86_mcerr("do_mca #MC: bad target", -EINVAL);
 
         if (!cpu_online(target))
diff -r 6c583d35d76d -r 511d5e65a302 xen/arch/x86/microcode.c
--- a/xen/arch/x86/microcode.c	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/arch/x86/microcode.c	Fri Oct 21 09:17:42 2011 +0200
@@ -126,7 +126,7 @@
         info->error = error;
 
     info->cpu = next_cpu(info->cpu, cpu_online_map);
-    if ( info->cpu < NR_CPUS )
+    if ( info->cpu < nr_cpu_ids )
         return continue_hypercall_on_cpu(info->cpu, do_microcode_update, info);
 
     error = info->error;
diff -r 6c583d35d76d -r 511d5e65a302 xen/arch/x86/mpparse.c
--- a/xen/arch/x86/mpparse.c	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/arch/x86/mpparse.c	Fri Oct 21 09:17:42 2011 +0200
@@ -28,6 +28,7 @@
 #include <asm/mtrr.h>
 #include <asm/mpspec.h>
 #include <asm/io_apic.h>
+#include <asm/setup.h>
 
 #include <mach_apic.h>
 #include <mach_mpparse.h>
@@ -61,10 +62,31 @@
 
 /* Internal processor count */
 static unsigned int __devinitdata num_processors;
+static unsigned int __initdata disabled_cpus;
 
 /* Bitmask of physically existing CPUs */
 physid_mask_t phys_cpu_present_map;
 
+void __init set_nr_cpu_ids(unsigned int max_cpus)
+{
+	if (!max_cpus)
+		max_cpus = num_processors + disabled_cpus;
+	if (max_cpus > NR_CPUS)
+		max_cpus = NR_CPUS;
+	else if (!max_cpus)
+		max_cpus = 1;
+	printk(XENLOG_INFO "SMP: Allowing %u CPUs (%d hotplug CPUs)\n",
+	       max_cpus, max_t(int, max_cpus - num_processors, 0));
+	nr_cpu_ids = max_cpus;
+
+#ifndef nr_cpumask_bits
+	nr_cpumask_bits = (max_cpus + (BITS_PER_LONG - 1)) &
+			  ~(BITS_PER_LONG - 1);
+	printk(XENLOG_DEBUG "NR_CPUS:%u nr_cpumask_bits:%u\n",
+	       NR_CPUS, nr_cpumask_bits);
+#endif
+}
+
 /*
  * Intel MP BIOS table parsing routines:
  */
@@ -90,8 +112,11 @@
 {
  	int ver, apicid, cpu = 0;
  	
-	if (!(m->mpc_cpuflag & CPU_ENABLED))
+	if (!(m->mpc_cpuflag & CPU_ENABLED)) {
+		if (!hotplug)
+			++disabled_cpus;
 		return -EINVAL;
+	}
 
 	apicid = mpc_apic_id(m, apicidx);
 
@@ -115,9 +140,9 @@
 
 	set_apicid(apicid, &phys_cpu_present_map);
 
-	if (num_processors >= NR_CPUS) {
-		printk(KERN_WARNING "WARNING: NR_CPUS limit of %i reached."
-			"  Processor ignored.\n", NR_CPUS);
+	if (num_processors >= nr_cpu_ids) {
+		printk(KERN_WARNING "WARNING: NR_CPUS limit of %u reached."
+			"  Processor ignored.\n", nr_cpu_ids);
 		return -ENOSPC;
 	}
 
diff -r 6c583d35d76d -r 511d5e65a302 xen/arch/x86/numa.c
--- a/xen/arch/x86/numa.c	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/arch/x86/numa.c	Fri Oct 21 09:17:42 2011 +0200
@@ -198,7 +198,7 @@
 	   CPUs, as the number of CPUs is not known yet. 
 	   We round robin the existing nodes. */
 	rr = first_node(node_online_map);
-	for (i = 0; i < NR_CPUS; i++) {
+	for (i = 0; i < nr_cpu_ids; i++) {
 		if (cpu_to_node[i] != NUMA_NO_NODE)
 			continue;
  		numa_set_node(i, rr);
@@ -280,7 +280,7 @@
 	memnodemap = _memnodemap;
 	nodes_clear(node_online_map);
 	node_set_online(0);
-	for (i = 0; i < NR_CPUS; i++)
+	for (i = 0; i < nr_cpu_ids; i++)
 		numa_set_node(i, 0);
 	node_to_cpumask[0] = cpumask_of_cpu(0);
 	setup_node_bootmem(0, (u64)start_pfn << PAGE_SHIFT, (u64)end_pfn << PAGE_SHIFT);
@@ -335,7 +335,7 @@
 void __init init_cpu_to_node(void)
 {
 	int i, node;
- 	for (i = 0; i < NR_CPUS; i++) {
+ 	for (i = 0; i < nr_cpu_ids; i++) {
 		u32 apicid = x86_cpu_to_apicid[i];
 		if (apicid == BAD_APICID)
 			continue;
diff -r 6c583d35d76d -r 511d5e65a302 xen/arch/x86/oprofile/nmi_int.c
--- a/xen/arch/x86/oprofile/nmi_int.c	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/arch/x86/oprofile/nmi_int.c	Fri Oct 21 09:17:42 2011 +0200
@@ -127,7 +127,7 @@
 static void free_msrs(void)
 {
 	int i;
-	for (i = 0; i < NR_CPUS; ++i) {
+	for (i = 0; i < nr_cpu_ids; ++i) {
 		xfree(cpu_msrs[i].counters);
 		cpu_msrs[i].counters = NULL;
 		xfree(cpu_msrs[i].controls);
diff -r 6c583d35d76d -r 511d5e65a302 xen/arch/x86/platform_hypercall.c
--- a/xen/arch/x86/platform_hypercall.c	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/arch/x86/platform_hypercall.c	Fri Oct 21 09:17:42 2011 +0200
@@ -442,7 +442,7 @@
             break;
         }
 
-        if ( (g_info->xen_cpuid >= NR_CPUS) ||
+        if ( (g_info->xen_cpuid >= nr_cpu_ids) ||
              !cpu_present(g_info->xen_cpuid) )
         {
             g_info->flags |= XEN_PCPU_FLAGS_INVALID;
diff -r 6c583d35d76d -r 511d5e65a302 xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/arch/x86/setup.c	Fri Oct 21 09:17:42 2011 +0200
@@ -51,7 +51,7 @@
 boolean_param("nosmp", opt_nosmp);
 
 /* maxcpus: maximum number of CPUs to activate. */
-static unsigned int __initdata max_cpus = NR_CPUS;
+static unsigned int __initdata max_cpus;
 integer_param("maxcpus", max_cpus);
 
 /* opt_watchdog: If true, run a watchdog NMI on each processor. */
@@ -230,7 +230,7 @@
          * Among identical longest-prefix matches, pick the smallest APIC ID.
          */
         for ( j = next_cpu(i, cpu_present_map);
-              j < NR_CPUS;
+              j < nr_cpu_ids;
               j = next_cpu(j, cpu_present_map) )
         {
             diff = x86_cpu_to_apicid[j] ^ apicid;
@@ -246,9 +246,9 @@
         }
 
         /* If no match then there must be no CPUs remaining to consider. */
-        if ( min_cpu >= NR_CPUS )
+        if ( min_cpu >= nr_cpu_ids )
         {
-            BUG_ON(next_cpu(i, cpu_present_map) < NR_CPUS);
+            BUG_ON(next_cpu(i, cpu_present_map) < nr_cpu_ids);
             break;
         }
 
@@ -1203,6 +1203,17 @@
     if ( smp_found_config )
         get_smp_config();
 
+    if ( opt_nosmp )
+    {
+        max_cpus = 0;
+        set_nr_cpu_ids(1);
+    }
+    else
+    {
+        set_nr_cpu_ids(max_cpus);
+        max_cpus = nr_cpu_ids;
+    }
+
 #ifdef CONFIG_X86_64
     /* Low mappings were only needed for some BIOS table parsing. */
     zap_low_mappings();
@@ -1254,9 +1265,6 @@
     acpi_mmcfg_init();
 #endif
 
-    if ( opt_nosmp )
-        max_cpus = 0;
-
     iommu_setup();    /* setup iommu if available */
 
     smp_prepare_cpus(max_cpus);
diff -r 6c583d35d76d -r 511d5e65a302 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/arch/x86/smpboot.c	Fri Oct 21 09:17:42 2011 +0200
@@ -535,7 +535,7 @@
     int cpu;
     cpus_complement(tmp_map, cpu_present_map);
     cpu = first_cpu(tmp_map);
-    return (cpu < NR_CPUS) ? cpu : -ENODEV;
+    return (cpu < nr_cpu_ids) ? cpu : -ENODEV;
 }
 
 static int do_boot_cpu(int apicid, int cpu)
diff -r 6c583d35d76d -r 511d5e65a302 xen/arch/x86/srat.c
--- a/xen/arch/x86/srat.c	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/arch/x86/srat.c	Fri Oct 21 09:17:42 2011 +0200
@@ -447,7 +447,7 @@
 			continue;
 		setup_node_bootmem(i, nodes[i].start, nodes[i].end);
 	}
-	for (i = 0; i < NR_CPUS; i++) { 
+	for (i = 0; i < nr_cpu_ids; i++) {
 		if (cpu_to_node[i] == NUMA_NO_NODE)
 			continue;
 		if (!node_isset(cpu_to_node[i], nodes_parsed))
diff -r 6c583d35d76d -r 511d5e65a302 xen/arch/x86/sysctl.c
--- a/xen/arch/x86/sysctl.c	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/arch/x86/sysctl.c	Fri Oct 21 09:17:42 2011 +0200
@@ -82,7 +82,7 @@
         pi->nr_cpus = num_online_cpus();
         pi->nr_nodes = num_online_nodes();
         pi->max_node_id = MAX_NUMNODES-1;
-        pi->max_cpu_id = NR_CPUS-1;
+        pi->max_cpu_id = nr_cpu_ids - 1;
         pi->total_pages = total_pages;
         pi->free_pages = avail_domheap_pages();
         pi->scrub_pages = 0;
diff -r 6c583d35d76d -r 511d5e65a302 xen/arch/x86/tboot.c
--- a/xen/arch/x86/tboot.c	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/arch/x86/tboot.c	Fri Oct 21 09:17:42 2011 +0200
@@ -248,7 +248,7 @@
     void *p;
     int i;
 
-    for ( i = 0; i < NR_CPUS; i++ )
+    for ( i = 0; i < nr_cpu_ids; i++ )
     {
         if ( !stack_base[i] )
             continue;
diff -r 6c583d35d76d -r 511d5e65a302 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/arch/x86/traps.c	Fri Oct 21 09:17:42 2011 +0200
@@ -3412,7 +3412,7 @@
 {
     int i;
     /* Keep secondary tables in sync with IRQ updates. */
-    for ( i = 1; i < NR_CPUS; i++ )
+    for ( i = 1; i < nr_cpu_ids; i++ )
         if ( idt_tables[i] != NULL )
             _set_gate(&idt_tables[i][n], 14, dpl, addr);
     _set_gate(&idt_table[n], 14, dpl, addr);
diff -r 6c583d35d76d -r 511d5e65a302 xen/common/cpu.c
--- a/xen/common/cpu.c	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/common/cpu.c	Fri Oct 21 09:17:42 2011 +0200
@@ -6,6 +6,12 @@
 #include <xen/sched.h>
 #include <xen/stop_machine.h>
 
+unsigned int __read_mostly nr_cpu_ids = NR_CPUS;
+#ifndef nr_cpumask_bits
+unsigned int __read_mostly nr_cpumask_bits
+    = BITS_TO_LONGS(NR_CPUS) * BITS_PER_LONG;
+#endif
+
 /*
  * cpu_bit_bitmap[] is a special, "compressed" data structure that
  * represents all NR_CPUS bits binary values of 1<<nr.
@@ -80,7 +86,7 @@
     if ( !cpu_hotplug_begin() )
         return -EBUSY;
 
-    if ( (cpu >= NR_CPUS) || (cpu == 0) || !cpu_online(cpu) )
+    if ( (cpu >= nr_cpu_ids) || (cpu == 0) || !cpu_online(cpu) )
     {
         cpu_hotplug_done();
         return -EINVAL;
@@ -122,7 +128,7 @@
     if ( !cpu_hotplug_begin() )
         return -EBUSY;
 
-    if ( (cpu >= NR_CPUS) || cpu_online(cpu) || !cpu_present(cpu) )
+    if ( (cpu >= nr_cpu_ids) || cpu_online(cpu) || !cpu_present(cpu) )
     {
         cpu_hotplug_done();
         return -EINVAL;
diff -r 6c583d35d76d -r 511d5e65a302 xen/common/cpupool.c
--- a/xen/common/cpupool.c	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/common/cpupool.c	Fri Oct 21 09:17:42 2011 +0200
@@ -489,7 +489,7 @@
         if ( cpu == XEN_SYSCTL_CPUPOOL_PAR_ANY )
             cpu = first_cpu(cpupool_free_cpus);
         ret = -EINVAL;
-        if ( cpu >= NR_CPUS )
+        if ( cpu >= nr_cpu_ids )
             goto addcpu_out;
         ret = -EBUSY;
         if ( !cpu_isset(cpu, cpupool_free_cpus) )
@@ -517,7 +517,7 @@
         cpu = op->cpu;
         if ( cpu == XEN_SYSCTL_CPUPOOL_PAR_ANY )
             cpu = last_cpu(c->cpu_valid);
-        ret = (cpu < NR_CPUS) ? cpupool_unassign_cpu(c, cpu) : -EINVAL;
+        ret = (cpu < nr_cpu_ids) ? cpupool_unassign_cpu(c, cpu) : -EINVAL;
         cpupool_put(c);
     }
     break;
diff -r 6c583d35d76d -r 511d5e65a302 xen/common/domain.c
--- a/xen/common/domain.c	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/common/domain.c	Fri Oct 21 09:17:42 2011 +0200
@@ -1023,7 +1023,7 @@
 {
     struct migrate_info *info;
 
-    if ( (cpu >= NR_CPUS) || !cpu_online(cpu) )
+    if ( (cpu >= nr_cpu_ids) || !cpu_online(cpu) )
         return -EINVAL;
 
     info = this_cpu(continue_info);
diff -r 6c583d35d76d -r 511d5e65a302 xen/common/kexec.c
--- a/xen/common/kexec.c	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/common/kexec.c	Fri Oct 21 09:17:42 2011 +0200
@@ -296,7 +296,7 @@
     int nr = range->nr;
     int nr_bytes = 0;
 
-    if ( nr < 0 || nr >= NR_CPUS || !cpu_online(nr) )
+    if ( nr < 0 || nr >= nr_cpu_ids || !cpu_online(nr) )
         return -EINVAL;
 
     nr_bytes += sizeof_note("CORE", sizeof(ELF_Prstatus));
diff -r 6c583d35d76d -r 511d5e65a302 xen/common/keyhandler.c
--- a/xen/common/keyhandler.c	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/common/keyhandler.c	Fri Oct 21 09:17:42 2011 +0200
@@ -98,7 +98,7 @@
         return;
 
     cpu = cycle_cpu(cpu, dump_execstate_mask);
-    if ( cpu < NR_CPUS )
+    if ( cpu < nr_cpu_ids )
     {
         smp_send_state_dump(cpu);
         return;
diff -r 6c583d35d76d -r 511d5e65a302 xen/common/sched_credit.c
--- a/xen/common/sched_credit.c	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/common/sched_credit.c	Fri Oct 21 09:17:42 2011 +0200
@@ -374,7 +374,7 @@
 
     INIT_LIST_HEAD(&spc->runq);
     spc->runq_sort_last = prv->runq_sort;
-    spc->idle_bias = NR_CPUS - 1;
+    spc->idle_bias = nr_cpu_ids - 1;
     if ( per_cpu(schedule_data, cpu).sched_priv == NULL )
         per_cpu(schedule_data, cpu).sched_priv = spc;
 
diff -r 6c583d35d76d -r 511d5e65a302 xen/common/sched_credit2.c
--- a/xen/common/sched_credit2.c	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/common/sched_credit2.c	Fri Oct 21 09:17:42 2011 +0200
@@ -2071,7 +2071,7 @@
     INIT_LIST_HEAD(&prv->sdom);
 
     /* But un-initialize all runqueues */
-    for ( i=0; i<NR_CPUS; i++)
+    for ( i = 0; i < nr_cpu_ids; i++ )
     {
         prv->runq_map[i] = -1;
         prv->rqd[i].id = -1;
diff -r 6c583d35d76d -r 511d5e65a302 xen/common/sched_sedf.c
--- a/xen/common/sched_sedf.c	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/common/sched_sedf.c	Fri Oct 21 09:17:42 2011 +0200
@@ -1201,7 +1201,7 @@
       routine. Try to avoid unnecessary runs but:
       Save approximation: Always switch to scheduler!*/
     ASSERT(d->processor >= 0);
-    ASSERT(d->processor < NR_CPUS);
+    ASSERT(d->processor < nr_cpu_ids);
     ASSERT(per_cpu(schedule_data, d->processor).curr);
 
     if ( should_switch(per_cpu(schedule_data, d->processor).curr, d, now) )
diff -r 6c583d35d76d -r 511d5e65a302 xen/common/schedule.c
--- a/xen/common/schedule.c	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/common/schedule.c	Fri Oct 21 09:17:42 2011 +0200
@@ -1353,7 +1353,7 @@
     idle_domain = domain_create(DOMID_IDLE, 0, 0);
     BUG_ON(idle_domain == NULL);
     idle_domain->vcpu = idle_vcpu;
-    idle_domain->max_vcpus = NR_CPUS;
+    idle_domain->max_vcpus = nr_cpu_ids;
     if ( alloc_vcpu(idle_domain, 0, 0) == NULL )
         BUG();
     if ( ops.alloc_pdata &&
diff -r 6c583d35d76d -r 511d5e65a302 xen/common/sysctl.c
--- a/xen/common/sysctl.c	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/common/sysctl.c	Fri Oct 21 09:17:42 2011 +0200
@@ -183,7 +183,7 @@
         uint32_t i, nr_cpus;
         struct xen_sysctl_cpuinfo cpuinfo;
 
-        nr_cpus = min_t(uint32_t, op->u.getcpuinfo.max_cpus, NR_CPUS);
+        nr_cpus = min(op->u.getcpuinfo.max_cpus, nr_cpu_ids);
 
         ret = xsm_getcpuinfo();
         if ( ret )
diff -r 6c583d35d76d -r 511d5e65a302 xen/drivers/acpi/pmstat.c
--- a/xen/drivers/acpi/pmstat.c	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/drivers/acpi/pmstat.c	Fri Oct 21 09:17:42 2011 +0200
@@ -53,7 +53,7 @@
     int ret = 0;
     const struct processor_pminfo *pmpt;
 
-    if ( !op || (op->cpuid >= NR_CPUS) || !cpu_online(op->cpuid) )
+    if ( !op || (op->cpuid >= nr_cpu_ids) || !cpu_online(op->cpuid) )
         return -EINVAL;
     pmpt = processor_pminfo[op->cpuid];
 
diff -r 6c583d35d76d -r 511d5e65a302 xen/include/asm-x86/setup.h
--- a/xen/include/asm-x86/setup.h	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/include/asm-x86/setup.h	Fri Oct 21 09:17:42 2011 +0200
@@ -20,6 +20,8 @@
 int centaur_init_cpu(void);
 int transmeta_init_cpu(void);
 
+void set_nr_cpu_ids(unsigned int max_cpus);
+
 void numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn);
 void arch_init_memory(void);
 void subarch_init_memory(void);
diff -r 6c583d35d76d -r 511d5e65a302 xen/include/xen/cpumask.h
--- a/xen/include/xen/cpumask.h	Thu Oct 20 15:36:01 2011 +0100
+++ b/xen/include/xen/cpumask.h	Fri Oct 21 09:17:42 2011 +0200
@@ -81,26 +81,43 @@
 
 typedef struct cpumask{ DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;
 
+extern unsigned int nr_cpu_ids;
+
+#if NR_CPUS > 4 * BITS_PER_LONG && !defined(__ia64__)
+/* Assuming NR_CPUS is huge, a runtime limit is more efficient.  Also,
+ * not all bits may be allocated. */
+extern unsigned int nr_cpumask_bits;
+#else
+# define nr_cpumask_bits (BITS_TO_LONGS(NR_CPUS) * BITS_PER_LONG)
+#endif
+
+/* verify cpu argument to cpumask_* operators */
+static inline unsigned int cpumask_check(unsigned int cpu)
+{
+	ASSERT(cpu < nr_cpu_ids);
+	return cpu;
+}
+
 #define cpu_set(cpu, dst) cpumask_set_cpu(cpu, &(dst))
 static inline void cpumask_set_cpu(int cpu, volatile cpumask_t *dstp)
 {
-	set_bit(cpu, dstp->bits);
+	set_bit(cpumask_check(cpu), dstp->bits);
 }
 
 #define cpu_clear(cpu, dst) cpumask_clear_cpu(cpu, &(dst))
 static inline void cpumask_clear_cpu(int cpu, volatile cpumask_t *dstp)
 {
-	clear_bit(cpu, dstp->bits);
+	clear_bit(cpumask_check(cpu), dstp->bits);
 }
 
-#define cpumask_setall(dst) __cpus_setall(dst, NR_CPUS)
+#define cpumask_setall(dst) __cpus_setall(dst, nr_cpumask_bits)
 #define cpus_setall(dst) __cpus_setall(&(dst), NR_CPUS)
 static inline void __cpus_setall(cpumask_t *dstp, int nbits)
 {
 	bitmap_fill(dstp->bits, nbits);
 }
 
-#define cpumask_clear(dst) __cpus_clear(dst, NR_CPUS)
+#define cpumask_clear(dst) __cpus_clear(dst, nr_cpumask_bits)
 #define cpus_clear(dst) __cpus_clear(&(dst), NR_CPUS)
 static inline void __cpus_clear(cpumask_t *dstp, int nbits)
 {
@@ -108,24 +125,26 @@
 }
 
 /* No static inline type checking - see Subtlety (1) above. */
-#define cpumask_test_cpu(cpu, cpumask) test_bit(cpu, (cpumask)->bits)
+#define cpumask_test_cpu(cpu, cpumask) \
+	test_bit(cpumask_check(cpu), (cpumask)->bits)
 #define cpu_isset(cpu, cpumask) test_bit((cpu), (cpumask).bits)
 
 #define cpu_test_and_set(cpu, cpumask) \
 	cpumask_test_and_set_cpu(cpu, &(cpumask))
 static inline int cpumask_test_and_set_cpu(int cpu, cpumask_t *addr)
 {
-	return test_and_set_bit(cpu, addr->bits);
+	return test_and_set_bit(cpumask_check(cpu), addr->bits);
 }
 
 #define cpu_test_and_clear(cpu, cpumask) \
 	cpumask_test_and_clear_cpu(cpu, &(cpumask))
 static inline int cpumask_test_and_clear_cpu(int cpu, cpumask_t *addr)
 {
-	return test_and_clear_bit(cpu, addr->bits);
+	return test_and_clear_bit(cpumask_check(cpu), addr->bits);
 }
 
-#define cpumask_and(dst, src1, src2) __cpus_and(dst, src1, src2, NR_CPUS)
+#define cpumask_and(dst, src1, src2) \
+	__cpus_and(dst, src1, src2, nr_cpumask_bits)
 #define cpus_and(dst, src1, src2) __cpus_and(&(dst), &(src1), &(src2), NR_CPUS)
 static inline void __cpus_and(cpumask_t *dstp, const cpumask_t *src1p,
 					const cpumask_t *src2p, int nbits)
@@ -133,7 +152,8 @@
 	bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits);
 }
 
-#define cpumask_or(dst, src1, src2) __cpus_or(dst, src1, src2, NR_CPUS)
+#define cpumask_or(dst, src1, src2) \
+	__cpus_or(dst, src1, src2, nr_cpumask_bits)
 #define cpus_or(dst, src1, src2) __cpus_or(&(dst), &(src1), &(src2), NR_CPUS)
 static inline void __cpus_or(cpumask_t *dstp, const cpumask_t *src1p,
 					const cpumask_t *src2p, int nbits)
@@ -141,7 +161,8 @@
 	bitmap_or(dstp->bits, src1p->bits, src2p->bits, nbits);
 }
 
-#define cpumask_xor(dst, src1, src2) __cpus_xor(dst, src1, src2, NR_CPUS)
+#define cpumask_xor(dst, src1, src2) \
+	__cpus_xor(dst, src1, src2, nr_cpumask_bits)
 #define cpus_xor(dst, src1, src2) __cpus_xor(&(dst), &(src1), &(src2), NR_CPUS)
 static inline void __cpus_xor(cpumask_t *dstp, const cpumask_t *src1p,
 					const cpumask_t *src2p, int nbits)
@@ -149,7 +170,8 @@
 	bitmap_xor(dstp->bits, src1p->bits, src2p->bits, nbits);
 }
 
-#define cpumask_andnot(dst, src1, src2) __cpus_andnot(dst, src1, src2, NR_CPUS)
+#define cpumask_andnot(dst, src1, src2) \
+	__cpus_andnot(dst, src1, src2, nr_cpumask_bits)
 #define cpus_andnot(dst, src1, src2) \
 				__cpus_andnot(&(dst), &(src1), &(src2), NR_CPUS)
 static inline void __cpus_andnot(cpumask_t *dstp, const cpumask_t *src1p,
@@ -158,7 +180,8 @@
 	bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits);
 }
 
-#define cpumask_complement(dst, src) __cpus_complement(dst, src, NR_CPUS)
+#define cpumask_complement(dst, src) \
+	__cpus_complement(dst, src, nr_cpumask_bits)
 #define cpus_complement(dst, src) __cpus_complement(&(dst), &(src), NR_CPUS)
 static inline void __cpus_complement(cpumask_t *dstp,
 					const cpumask_t *srcp, int nbits)
@@ -166,55 +189,62 @@
 	bitmap_complement(dstp->bits, srcp->bits, nbits);
 }
 
-#define cpumask_equal(src1, src2) __cpus_equal(src1, src2, NR_CPUS)
-#define cpus_equal(src1, src2) __cpus_equal(&(src1), &(src2), NR_CPUS)
+#define cpumask_equal(src1, src2) __cpus_equal(src1, src2, nr_cpu_ids)
+#define cpus_equal(src1, src2) __cpus_equal(&(src1), &(src2), nr_cpu_ids)
 static inline int __cpus_equal(const cpumask_t *src1p,
 					const cpumask_t *src2p, int nbits)
 {
 	return bitmap_equal(src1p->bits, src2p->bits, nbits);
 }
 
-#define cpus_intersects(src1, src2) __cpus_intersects(&(src1), &(src2), NR_CPUS)
+#define cpumask_intersects(src1, src2) \
+	__cpus_intersects(src1, src2, nr_cpu_ids)
+#define cpus_intersects(src1, src2) \
+	__cpus_intersects(&(src1), &(src2), nr_cpu_ids)
 static inline int __cpus_intersects(const cpumask_t *src1p,
 					const cpumask_t *src2p, int nbits)
 {
 	return bitmap_intersects(src1p->bits, src2p->bits, nbits);
 }
 
-#define cpus_subset(src1, src2) __cpus_subset(&(src1), &(src2), NR_CPUS)
+#define cpumask_subset(src1, src2) __cpus_subset(src1, src2, nr_cpu_ids)
+#define cpus_subset(src1, src2) __cpus_subset(&(src1), &(src2), nr_cpu_ids)
 static inline int __cpus_subset(const cpumask_t *src1p,
 					const cpumask_t *src2p, int nbits)
 {
 	return bitmap_subset(src1p->bits, src2p->bits, nbits);
 }
 
-#define cpumask_empty(src) __cpus_empty(src, NR_CPUS)
-#define cpus_empty(src) __cpus_empty(&(src), NR_CPUS)
+#define cpumask_empty(src) __cpus_empty(src, nr_cpu_ids)
+#define cpus_empty(src) __cpus_empty(&(src), nr_cpu_ids)
 static inline int __cpus_empty(const cpumask_t *srcp, int nbits)
 {
 	return bitmap_empty(srcp->bits, nbits);
 }
 
-#define cpumask_full(cpumask) __cpus_full(cpumask, NR_CPUS)
-#define cpus_full(cpumask) __cpus_full(&(cpumask), NR_CPUS)
+#define cpumask_full(cpumask) __cpus_full(cpumask, nr_cpu_ids)
+#define cpus_full(cpumask) __cpus_full(&(cpumask), nr_cpu_ids)
 static inline int __cpus_full(const cpumask_t *srcp, int nbits)
 {
 	return bitmap_full(srcp->bits, nbits);
 }
 
-#define cpumask_weight(cpumask) __cpus_weight(cpumask, NR_CPUS)
-#define cpus_weight(cpumask) __cpus_weight(&(cpumask), NR_CPUS)
+#define cpumask_weight(cpumask) __cpus_weight(cpumask, nr_cpu_ids)
+#define cpus_weight(cpumask) __cpus_weight(&(cpumask), nr_cpu_ids)
 static inline int __cpus_weight(const cpumask_t *srcp, int nbits)
 {
 	return bitmap_weight(srcp->bits, nbits);
 }
 
-#define cpus_copy(dest, src) cpumask_copy(&(dest), &(src))
-static inline void cpumask_copy(cpumask_t *dstp, const cpumask_t *srcp)
+#define cpumask_copy(dest, src) __cpus_copy(dest, src, nr_cpumask_bits)
+#define cpus_copy(dest, src) __cpus_copy(&(dest), &(src), NR_CPUS)
+static inline void __cpus_copy(cpumask_t *dstp, const cpumask_t *srcp, int nbits)
 {
-	bitmap_copy(dstp->bits, srcp->bits, NR_CPUS);
+	bitmap_copy(dstp->bits, srcp->bits, nbits);
 }
 
+#define cpumask_shift_right(dst, src, n) \
+	__cpus_shift_right(dst, src, n, nr_cpumask_bits)
 #define cpus_shift_right(dst, src, n) \
 			__cpus_shift_right(&(dst), &(src), (n), NR_CPUS)
 static inline void __cpus_shift_right(cpumask_t *dstp,
@@ -223,6 +253,8 @@
 	bitmap_shift_right(dstp->bits, srcp->bits, n, nbits);
 }
 
+#define cpumask_shift_left(dst, src, n) \
+	__cpus_shift_left(dst, src, n, nr_cpumask_bits)
 #define cpus_shift_left(dst, src, n) \
 			__cpus_shift_left(&(dst), &(src), (n), NR_CPUS)
 static inline void __cpus_shift_left(cpumask_t *dstp,
@@ -231,22 +263,22 @@
 	bitmap_shift_left(dstp->bits, srcp->bits, n, nbits);
 }
 
-#define cpumask_first(src) __first_cpu(src, NR_CPUS)
-#define first_cpu(src) __first_cpu(&(src), NR_CPUS)
+#define cpumask_first(src) __first_cpu(src, nr_cpu_ids)
+#define first_cpu(src) __first_cpu(&(src), nr_cpu_ids)
 static inline int __first_cpu(const cpumask_t *srcp, int nbits)
 {
 	return min_t(int, nbits, find_first_bit(srcp->bits, nbits));
 }
 
-#define cpumask_next(n, src) __next_cpu(n, src, NR_CPUS)
-#define next_cpu(n, src) __next_cpu((n), &(src), NR_CPUS)
+#define cpumask_next(n, src) __next_cpu(n, src, nr_cpu_ids)
+#define next_cpu(n, src) __next_cpu((n), &(src), nr_cpu_ids)
 static inline int __next_cpu(int n, const cpumask_t *srcp, int nbits)
 {
 	return min_t(int, nbits, find_next_bit(srcp->bits, nbits, n+1));
 }
 
-#define cpumask_last(src) __last_cpu(src, NR_CPUS)
-#define last_cpu(src) __last_cpu(&(src), NR_CPUS)
+#define cpumask_last(src) __last_cpu(src, nr_cpu_ids)
+#define last_cpu(src) __last_cpu(&(src), nr_cpu_ids)
 static inline int __last_cpu(const cpumask_t *srcp, int nbits)
 {
 	int cpu, pcpu = nbits;
@@ -257,8 +289,8 @@
 	return pcpu;
 }
 
-#define cpumask_cycle(n, src) __cycle_cpu(n, src, NR_CPUS)
-#define cycle_cpu(n, src) __cycle_cpu((n), &(src), NR_CPUS)
+#define cpumask_cycle(n, src) __cycle_cpu(n, src, nr_cpu_ids)
+#define cycle_cpu(n, src) __cycle_cpu((n), &(src), nr_cpu_ids)
 static inline int __cycle_cpu(int n, const cpumask_t *srcp, int nbits)
 {
     int nxt = __next_cpu(n, srcp, nbits);
@@ -317,7 +349,7 @@
 #define cpus_addr(src) ((src).bits)
 
 #define cpumask_scnprintf(buf, len, src) \
-			__cpumask_scnprintf((buf), (len), &(src), NR_CPUS)
+	__cpumask_scnprintf((buf), (len), &(src), nr_cpu_ids)
 static inline int __cpumask_scnprintf(char *buf, int len,
 					const cpumask_t *srcp, int nbits)
 {
@@ -325,7 +357,7 @@
 }
 
 #define cpulist_scnprintf(buf, len, src) \
-			__cpulist_scnprintf((buf), (len), &(src), NR_CPUS)
+	__cpulist_scnprintf((buf), (len), &(src), nr_cpu_ids)
 static inline int __cpulist_scnprintf(char *buf, int len,
 					const cpumask_t *srcp, int nbits)
 {
@@ -355,6 +387,11 @@
 
 static inline bool_t alloc_cpumask_var(cpumask_var_t *mask)
 {
+	/*
+	 * Once all direct cpumask assignments and all cpus_*() accessors
+	 * still referencing NR_CPUS are gone, we could use nr_cpumask_bits
+	 * to determine the allocation size here.
+	 */
 	return (*mask = xmalloc(cpumask_t)) != NULL;
 }
 
@@ -386,7 +423,7 @@
 #if NR_CPUS > 1
 #define for_each_cpu_mask(cpu, mask)		\
 	for ((cpu) = first_cpu(mask);		\
-		(cpu) < NR_CPUS;		\
+		(cpu) < nr_cpu_ids;		\
 		(cpu) = next_cpu((cpu), (mask)))
 #else /* NR_CPUS == 1 */
 #define for_each_cpu_mask(cpu, mask) for ((cpu) = 0; (cpu) < 1; (cpu)++)

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 24 17:55:42 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 24 Oct 2011 17:55:42 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RIVIr-0008P3-6O; Mon, 24 Oct 2011 17:55:41 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RIVIR-0008KE-J0
	for xen-changelog@lists.xensource.com; Mon, 24 Oct 2011 17:55:19 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-216.messagelabs.com!1319504112!913620!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18305 invoked from network); 25 Oct 2011 00:55:12 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	25 Oct 2011 00:55:12 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RIVIO-00063P-58
	for xen-changelog@lists.xensource.com; Tue, 25 Oct 2011 01:55:12 +0100
Message-Id: <E1RIVIO-00063P-58@xenbits.xen.org>
Date: Tue, 25 Oct 2011 01:55:11 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] eliminate direct assignments of CPU
	masks
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 Jan Beulich <jbeulich@suse.com>
# Date 1319181669 -7200
# Node ID 07d303ff27576d803bb1ca92f31314426133da54
# Parent  1a4223c62ee7868e52be7640543af88483d1f5f3
eliminate direct assignments of CPU masks

Use cpumask_copy() instead of direct variable assignments for copying
CPU masks. While direct assignments are not a problem when both sides
are variables actually defined as cpumask_t (except for possibly
copying *much* more than would actually need to be copied), they must
not happen when the original variable is of type cpumask_var_t (which
may have lass space allocated to it than a full cpumask_t). Eliminate
as many of such assignments as possible (in several cases it's even
possible to collapse two operations [copy then clear one bit] into one
[cpumask_andnot()]), and thus set the way for reducing the allocation
size in alloc_cpumask_var().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r 1a4223c62ee7 -r 07d303ff2757 xen/arch/x86/acpi/cpufreq/powernow.c
--- a/xen/arch/x86/acpi/cpufreq/powernow.c	Fri Oct 21 09:19:44 2011 +0200
+++ b/xen/arch/x86/acpi/cpufreq/powernow.c	Fri Oct 21 09:21:09 2011 +0200
@@ -107,7 +107,7 @@
     if (unlikely(result))
         return -ENODEV;
 
-    online_policy_cpus = policy->cpus;
+    cpumask_and(&online_policy_cpus, &policy->cpus, &cpu_online_map);
 
     next_perf_state = data->freq_table[next_state].index;
     if (perf->state == next_perf_state) {
diff -r 1a4223c62ee7 -r 07d303ff2757 xen/arch/x86/cpu/mtrr/main.c
--- a/xen/arch/x86/cpu/mtrr/main.c	Fri Oct 21 09:19:44 2011 +0200
+++ b/xen/arch/x86/cpu/mtrr/main.c	Fri Oct 21 09:21:09 2011 +0200
@@ -231,9 +231,9 @@
 	struct set_mtrr_data data;
 	unsigned long flags;
 
-	allbutself = cpu_online_map;
-	cpu_clear(smp_processor_id(), allbutself);
-	nr_cpus = cpus_weight(allbutself);
+	cpumask_andnot(&allbutself, &cpu_online_map,
+                      cpumask_of(smp_processor_id()));
+	nr_cpus = cpumask_weight(&allbutself);
 
 	data.smp_reg = reg;
 	data.smp_base = base;
diff -r 1a4223c62ee7 -r 07d303ff2757 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Fri Oct 21 09:19:44 2011 +0200
+++ b/xen/arch/x86/irq.c	Fri Oct 21 09:21:09 2011 +0200
@@ -1040,7 +1040,7 @@
             desc->handler->end(desc, 0);
         break;
     case ACKTYPE_EOI:
-        cpu_eoi_map = action->cpu_eoi_map;
+        cpumask_copy(&cpu_eoi_map, &action->cpu_eoi_map);
         spin_unlock_irq(&desc->lock);
         on_selected_cpus(&cpu_eoi_map, set_eoi_ready, desc, 0);
         spin_lock_irq(&desc->lock);
@@ -1366,9 +1366,9 @@
 
     ASSERT(action->ack_type == ACKTYPE_EOI);
         
-    cpu_eoi_map = action->cpu_eoi_map;
+    cpumask_copy(&cpu_eoi_map, &action->cpu_eoi_map);
 
-    if ( cpu_test_and_clear(smp_processor_id(), cpu_eoi_map) )
+    if ( cpumask_test_and_clear_cpu(smp_processor_id(), &cpu_eoi_map) )
     {
         __set_eoi_ready(desc);
         spin_unlock(&desc->lock);
@@ -1380,7 +1380,7 @@
         spin_unlock_irq(&desc->lock);
     }
 
-    if ( !cpus_empty(cpu_eoi_map) )
+    if ( !cpumask_empty(&cpu_eoi_map) )
         on_selected_cpus(&cpu_eoi_map, set_eoi_ready, desc, 0);
 }
 
@@ -1619,7 +1619,7 @@
              (--action->in_flight == 0) &&
              (action->nr_guests != 0) )
         {
-            cpu_eoi_map = action->cpu_eoi_map;
+            cpumask_copy(&cpu_eoi_map, &action->cpu_eoi_map);
             spin_unlock_irq(&desc->lock);
             on_selected_cpus(&cpu_eoi_map, set_eoi_ready, desc, 0);
             spin_lock_irq(&desc->lock);
@@ -1649,8 +1649,8 @@
      * would need to flush all ready EOIs before returning as otherwise the
      * desc->handler could change and we would call the wrong 'end' hook.
      */
-    cpu_eoi_map = action->cpu_eoi_map;
-    if ( !cpus_empty(cpu_eoi_map) )
+    cpumask_copy(&cpu_eoi_map, &action->cpu_eoi_map);
+    if ( !cpumask_empty(&cpu_eoi_map) )
     {
         BUG_ON(action->ack_type != ACKTYPE_EOI);
         spin_unlock_irq(&desc->lock);
diff -r 1a4223c62ee7 -r 07d303ff2757 xen/arch/x86/numa.c
--- a/xen/arch/x86/numa.c	Fri Oct 21 09:19:44 2011 +0200
+++ b/xen/arch/x86/numa.c	Fri Oct 21 09:21:09 2011 +0200
@@ -282,7 +282,7 @@
 	node_set_online(0);
 	for (i = 0; i < nr_cpu_ids; i++)
 		numa_set_node(i, 0);
-	node_to_cpumask[0] = cpumask_of_cpu(0);
+	cpumask_copy(&node_to_cpumask[0], cpumask_of(0));
 	setup_node_bootmem(0, (u64)start_pfn << PAGE_SHIFT, (u64)end_pfn << PAGE_SHIFT);
 }
 
diff -r 1a4223c62ee7 -r 07d303ff2757 xen/arch/x86/smp.c
--- a/xen/arch/x86/smp.c	Fri Oct 21 09:19:44 2011 +0200
+++ b/xen/arch/x86/smp.c	Fri Oct 21 09:21:09 2011 +0200
@@ -257,8 +257,8 @@
     cpumask_t allbutself;
 
     /* Flush everyone else. We definitely flushed just before entry. */
-    allbutself = cpu_online_map;
-    cpu_clear(smp_processor_id(), allbutself);
+    cpumask_andnot(&allbutself, &cpu_online_map,
+                   cpumask_of(smp_processor_id()));
     flush_mask(&allbutself, FLUSH_TLB);
 
     /* No need for atomicity: we are the only possible updater. */
@@ -289,8 +289,10 @@
     void *info,
     int wait)
 {
-    cpumask_t allbutself = cpu_online_map;
-    cpu_clear(smp_processor_id(), allbutself);
+    cpumask_t allbutself;
+
+    cpumask_andnot(&allbutself, &cpu_online_map,
+                   cpumask_of(smp_processor_id()));
     on_selected_cpus(&allbutself, func, info, wait);
 }
 
@@ -306,9 +308,9 @@
 
     spin_lock(&call_lock);
 
-    call_data.selected = *selected;
+    cpumask_copy(&call_data.selected, selected);
 
-    nr_cpus = cpus_weight(call_data.selected);
+    nr_cpus = cpumask_weight(&call_data.selected);
     if ( nr_cpus == 0 )
         goto out;
 
@@ -318,14 +320,14 @@
 
     send_IPI_mask(&call_data.selected, CALL_FUNCTION_VECTOR);
 
-    if ( cpu_isset(smp_processor_id(), call_data.selected) )
+    if ( cpumask_test_cpu(smp_processor_id(), &call_data.selected) )
     {
         local_irq_disable();
         __smp_call_function_interrupt();
         local_irq_enable();
     }
 
-    while ( !cpus_empty(call_data.selected) )
+    while ( !cpumask_empty(&call_data.selected) )
         cpu_relax();
 
  out:
@@ -396,7 +398,7 @@
     void *info = call_data.info;
     unsigned int cpu = smp_processor_id();
 
-    if ( !cpu_isset(cpu, call_data.selected) )
+    if ( !cpumask_test_cpu(cpu, &call_data.selected) )
         return;
 
     irq_enter();
@@ -405,12 +407,12 @@
     {
         (*func)(info);
         mb();
-        cpu_clear(cpu, call_data.selected);
+        cpumask_clear_cpu(cpu, &call_data.selected);
     }
     else
     {
         mb();
-        cpu_clear(cpu, call_data.selected);
+        cpumask_clear_cpu(cpu, &call_data.selected);
         (*func)(info);
     }
 
diff -r 1a4223c62ee7 -r 07d303ff2757 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c	Fri Oct 21 09:19:44 2011 +0200
+++ b/xen/arch/x86/smpboot.c	Fri Oct 21 09:21:09 2011 +0200
@@ -267,7 +267,8 @@
 
     if ( c[cpu].x86_max_cores == 1 )
     {
-        per_cpu(cpu_core_map, cpu) = per_cpu(cpu_sibling_map, cpu);
+        cpumask_copy(&per_cpu(cpu_core_map, cpu),
+                     &per_cpu(cpu_sibling_map, cpu));
         c[cpu].booted_cores = 1;
         return;
     }
diff -r 1a4223c62ee7 -r 07d303ff2757 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c	Fri Oct 21 09:19:44 2011 +0200
+++ b/xen/arch/x86/time.c	Fri Oct 21 09:21:09 2011 +0200
@@ -1232,10 +1232,10 @@
 {
     unsigned int cpu = smp_processor_id();
     local_irq_disable();
-    while ( !cpu_isset(cpu, tsc_check_cpumask) )
+    while ( !cpumask_test_cpu(cpu, &tsc_check_cpumask) )
         mb();
     check_tsc_warp(cpu_khz, &tsc_max_warp);
-    cpu_clear(cpu, tsc_check_cpumask);
+    cpumask_clear_cpu(cpu, &tsc_check_cpumask);
     local_irq_enable();
 }
 
@@ -1248,12 +1248,11 @@
 
     tsc_check_count++;
     smp_call_function(tsc_check_slave, NULL, 0);
-    tsc_check_cpumask = cpu_online_map;
+    cpumask_andnot(&tsc_check_cpumask, &cpu_online_map, cpumask_of(cpu));
     local_irq_disable();
     check_tsc_warp(cpu_khz, &tsc_max_warp);
-    cpu_clear(cpu, tsc_check_cpumask);
     local_irq_enable();
-    while ( !cpus_empty(tsc_check_cpumask) )
+    while ( !cpumask_empty(&tsc_check_cpumask) )
         cpu_relax();
 
     spin_unlock(&lock);
@@ -1280,7 +1279,7 @@
     int i;
     struct cpu_calibration *c = &this_cpu(cpu_calibration);
     struct calibration_rendezvous *r = _r;
-    unsigned int total_cpus = cpus_weight(r->cpu_calibration_map);
+    unsigned int total_cpus = cpumask_weight(&r->cpu_calibration_map);
 
     /* Loop to get rid of cache effects on TSC skew. */
     for ( i = 4; i >= 0; i-- )
@@ -1331,7 +1330,7 @@
 {
     struct cpu_calibration *c = &this_cpu(cpu_calibration);
     struct calibration_rendezvous *r = _r;
-    unsigned int total_cpus = cpus_weight(r->cpu_calibration_map);
+    unsigned int total_cpus = cpumask_weight(&r->cpu_calibration_map);
 
     if ( smp_processor_id() == 0 )
     {
@@ -1362,10 +1361,11 @@
 static void time_calibration(void *unused)
 {
     struct calibration_rendezvous r = {
-        .cpu_calibration_map = cpu_online_map,
         .semaphore = ATOMIC_INIT(0)
     };
 
+    cpumask_copy(&r.cpu_calibration_map, &cpu_online_map);
+
     /* @wait=1 because we must wait for all cpus before freeing @r. */
     on_selected_cpus(&r.cpu_calibration_map,
                      time_calibration_rendezvous_fn,
diff -r 1a4223c62ee7 -r 07d303ff2757 xen/common/keyhandler.c
--- a/xen/common/keyhandler.c	Fri Oct 21 09:19:44 2011 +0200
+++ b/xen/common/keyhandler.c	Fri Oct 21 09:21:09 2011 +0200
@@ -93,11 +93,11 @@
         printk("\n");
     }
 
-    cpu_clear(cpu, dump_execstate_mask);
+    cpumask_clear_cpu(cpu, &dump_execstate_mask);
     if ( !alt_key_handling )
         return;
 
-    cpu = cycle_cpu(cpu, dump_execstate_mask);
+    cpu = cpumask_cycle(cpu, &dump_execstate_mask);
     if ( cpu < nr_cpu_ids )
     {
         smp_send_state_dump(cpu);
@@ -118,7 +118,7 @@
 
     printk("'%c' pressed -> dumping registers\n\n", key);
 
-    dump_execstate_mask = cpu_online_map;
+    cpumask_copy(&dump_execstate_mask, &cpu_online_map);
 
     /* Get local execution state out immediately, in case we get stuck. */
     dump_execstate(regs);
@@ -131,7 +131,7 @@
     for_each_cpu_mask ( cpu, dump_execstate_mask )
     {
         smp_send_state_dump(cpu);
-        while ( cpu_isset(cpu, dump_execstate_mask) )
+        while ( cpumask_test_cpu(cpu, &dump_execstate_mask) )
             cpu_relax();
     }
 
@@ -324,11 +324,11 @@
 {
     unsigned int cpu = smp_processor_id();
     local_irq_disable();
-    while ( !cpu_isset(cpu, read_clocks_cpumask) )
+    while ( !cpumask_test_cpu(cpu, &read_clocks_cpumask) )
         cpu_relax();
     per_cpu(read_clocks_time, cpu) = NOW();
     per_cpu(read_cycles_time, cpu) = get_cycles();
-    cpu_clear(cpu, read_clocks_cpumask);
+    cpumask_clear_cpu(cpu, &read_clocks_cpumask);
     local_irq_enable();
 }
 
@@ -348,13 +348,12 @@
     smp_call_function(read_clocks_slave, NULL, 0);
 
     local_irq_disable();
-    read_clocks_cpumask = cpu_online_map;
+    cpumask_andnot(&read_clocks_cpumask, &cpu_online_map, cpumask_of(cpu));
     per_cpu(read_clocks_time, cpu) = NOW();
     per_cpu(read_cycles_time, cpu) = get_cycles();
-    cpu_clear(cpu, read_clocks_cpumask);
     local_irq_enable();
 
-    while ( !cpus_empty(read_clocks_cpumask) )
+    while ( !cpumask_empty(&read_clocks_cpumask) )
         cpu_relax();
 
     min_stime_cpu = max_stime_cpu = min_cycles_cpu = max_cycles_cpu = cpu;
diff -r 1a4223c62ee7 -r 07d303ff2757 xen/common/rcupdate.c
--- a/xen/common/rcupdate.c	Fri Oct 21 09:19:44 2011 +0200
+++ b/xen/common/rcupdate.c	Fri Oct 21 09:21:09 2011 +0200
@@ -161,8 +161,7 @@
          * Don't send IPI to itself. With irqs disabled,
          * rdp->cpu is the current cpu.
          */
-        cpumask = rcp->cpumask;
-        cpu_clear(rdp->cpu, cpumask);
+        cpumask_andnot(&cpumask, &rcp->cpumask, cpumask_of(rdp->cpu));
         cpumask_raise_softirq(&cpumask, SCHEDULE_SOFTIRQ);
     }
 }
@@ -258,7 +257,7 @@
         smp_wmb();
         rcp->cur++;
 
-        rcp->cpumask = cpu_online_map;
+        cpumask_copy(&rcp->cpumask, &cpu_online_map);
     }
 }
 
@@ -269,8 +268,8 @@
  */
 static void cpu_quiet(int cpu, struct rcu_ctrlblk *rcp)
 {
-    cpu_clear(cpu, rcp->cpumask);
-    if (cpus_empty(rcp->cpumask)) {
+    cpumask_clear_cpu(cpu, &rcp->cpumask);
+    if (cpumask_empty(&rcp->cpumask)) {
         /* batch completed ! */
         rcp->completed = rcp->cur;
         rcu_start_batch(rcp);
diff -r 1a4223c62ee7 -r 07d303ff2757 xen/common/stop_machine.c
--- a/xen/common/stop_machine.c	Fri Oct 21 09:19:44 2011 +0200
+++ b/xen/common/stop_machine.c	Fri Oct 21 09:21:09 2011 +0200
@@ -81,9 +81,9 @@
     if ( !get_cpu_maps() )
         return -EBUSY;
 
-    allbutself = cpu_online_map;
-    cpu_clear(smp_processor_id(), allbutself);
-    nr_cpus = cpus_weight(allbutself);
+    cpumask_andnot(&allbutself, &cpu_online_map,
+                   cpumask_of(smp_processor_id()));
+    nr_cpus = cpumask_weight(&allbutself);
 
     /* Must not spin here as the holder will expect us to be descheduled. */
     if ( !spin_trylock(&stopmachine_lock) )
diff -r 1a4223c62ee7 -r 07d303ff2757 xen/include/xen/cpumask.h
--- a/xen/include/xen/cpumask.h	Fri Oct 21 09:19:44 2011 +0200
+++ b/xen/include/xen/cpumask.h	Fri Oct 21 09:21:09 2011 +0200
@@ -359,11 +359,14 @@
 
 static inline bool_t alloc_cpumask_var(cpumask_var_t *mask)
 {
-	/*
-	 * Once all direct cpumask assignments are gone, we could use
-	 * nr_cpumask_bits to determine the allocation size here.
-	 */
-	return (*mask = xmalloc(cpumask_t)) != NULL;
+	*(void **)mask = _xmalloc(nr_cpumask_bits / 8, sizeof(long));
+	return *mask != NULL;
+}
+
+static inline bool_t zalloc_cpumask_var(cpumask_var_t *mask)
+{
+	*(void **)mask = _xzalloc(nr_cpumask_bits / 8, sizeof(long));
+	return *mask != NULL;
 }
 
 static inline void free_cpumask_var(cpumask_var_t mask)
@@ -378,19 +381,17 @@
 	return 1;
 }
 
+static inline bool_t zalloc_cpumask_var(cpumask_var_t *mask)
+{
+	cpumask_clear(*mask);
+	return 1;
+}
+
 static inline void free_cpumask_var(cpumask_var_t mask)
 {
 }
 #endif
 
-static inline bool_t zalloc_cpumask_var(cpumask_var_t *mask)
-{
-	if (!alloc_cpumask_var(mask))
-		return 0;
-	cpumask_clear(*mask);
-	return 1;
-}
-
 #if NR_CPUS > 1
 #define for_each_cpu_mask(cpu, mask)		\
 	for ((cpu) = first_cpu(mask);		\
diff -r 1a4223c62ee7 -r 07d303ff2757 xen/include/xen/irq.h
--- a/xen/include/xen/irq.h	Fri Oct 21 09:19:44 2011 +0200
+++ b/xen/include/xen/irq.h	Fri Oct 21 09:21:09 2011 +0200
@@ -153,7 +153,7 @@
 
 static inline void set_native_irq_info(unsigned int irq, const cpumask_t *mask)
 {
-    irq_desc[irq].affinity = *mask;
+    cpumask_copy(&irq_desc[irq].affinity, mask);
 }
 
 unsigned int set_desc_affinity(struct irq_desc *, const cpumask_t *);

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 24 17:55:59 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 24 Oct 2011 17:55:59 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RIVJ8-0008SW-SO; Mon, 24 Oct 2011 17:55:58 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RIVIV-0008KV-20
	for xen-changelog@lists.xensource.com; Mon, 24 Oct 2011 17:55:20 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-182.messagelabs.com!1319504115!620561!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15575 invoked from network); 25 Oct 2011 00:55:16 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	25 Oct 2011 00:55:16 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RIVIR-00067N-Fv
	for xen-changelog@lists.xensource.com; Tue, 25 Oct 2011 01:55:15 +0100
Message-Id: <E1RIVIR-00067N-Fv@xenbits.xen.org>
Date: Tue, 25 Oct 2011 01:55:15 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/hpet: allocate CPU masks
	dynamically
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 Jan Beulich <jbeulich@suse.com>
# Date 1319183087 -7200
# Node ID 1c8789852eafea3a40664283ef19096e09a4cc43
# Parent  8269826353d8b9e5bb6248f22e85f6d4280ad9c9
x86/hpet: allocate CPU masks dynamically

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r 8269826353d8 -r 1c8789852eaf xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c	Fri Oct 21 09:44:03 2011 +0200
+++ b/xen/arch/x86/hpet.c	Fri Oct 21 09:44:47 2011 +0200
@@ -33,7 +33,7 @@
     unsigned long mult;
     int           shift;
     s_time_t      next_event;
-    cpumask_t     cpumask;
+    cpumask_var_t cpumask;
     spinlock_t    lock;
     void          (*event_handler)(struct hpet_event_channel *);
 
@@ -182,14 +182,14 @@
     now = NOW();
 
     /* find all expired events */
-    for_each_cpu_mask(cpu, ch->cpumask)
+    for_each_cpu_mask(cpu, *ch->cpumask)
     {
         s_time_t deadline;
 
         rmb();
         deadline = per_cpu(timer_deadline, cpu);
         rmb();
-        if ( !cpumask_test_cpu(cpu, &ch->cpumask) )
+        if ( !cpumask_test_cpu(cpu, ch->cpumask) )
             continue;
 
         if ( deadline <= now )
@@ -377,6 +377,16 @@
         if ( !(cfg & HPET_TN_FSB_CAP) )
             continue;
 
+        if ( !zalloc_cpumask_var(&ch->cpumask) )
+        {
+            if ( !num_hpets_used )
+            {
+                xfree(hpet_events);
+                hpet_events = NULL;
+            }
+            break;
+        }
+
         ch->flags = 0;
         ch->idx = i;
 
@@ -449,14 +459,14 @@
     if ( cpu != ch->cpu )
         return;
 
-    if ( cpus_empty(ch->cpumask) )
+    if ( cpumask_empty(ch->cpumask) )
     {
         ch->cpu = -1;
         clear_bit(HPET_EVT_USED_BIT, &ch->flags);
         return;
     }
 
-    ch->cpu = first_cpu(ch->cpumask);
+    ch->cpu = cpumask_first(ch->cpumask);
     hpet_msi_set_affinity(irq_to_desc(ch->irq), cpumask_of(ch->cpu));
 }
 
@@ -502,7 +512,14 @@
             return;
 
         if ( !hpet_events )
+        {
             hpet_events = xzalloc(struct hpet_event_channel);
+            if ( hpet_events && !zalloc_cpumask_var(&hpet_events->cpumask) )
+            {
+                xfree(hpet_events);
+                hpet_events = NULL;
+            }
+        }
         if ( !hpet_events )
             return;
         hpet_events->irq = -1;
@@ -635,7 +652,7 @@
 
     /* Disable LAPIC timer interrupts. */
     disable_APIC_timer();
-    cpu_set(cpu, ch->cpumask);
+    cpumask_set_cpu(cpu, ch->cpumask);
 
     spin_lock(&ch->lock);
     /* reprogram if current cpu expire time is nearer */
@@ -660,7 +677,7 @@
     if ( !reprogram_timer(per_cpu(timer_deadline, cpu)) )
         raise_softirq(TIMER_SOFTIRQ);
 
-    cpu_clear(cpu, ch->cpumask);
+    cpumask_clear_cpu(cpu, ch->cpumask);
 
     if ( !(ch->flags & HPET_EVT_LEGACY) )
     {

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 24 17:56:09 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 24 Oct 2011 17:56:09 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RIVJI-0008Vo-9g; Mon, 24 Oct 2011 17:56:08 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RIVIV-0008Ka-Sx
	for xen-changelog@lists.xensource.com; Mon, 24 Oct 2011 17:55:20 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-174.messagelabs.com!1319504116!36529382!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13664 invoked from network); 25 Oct 2011 00:55:16 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	25 Oct 2011 00:55:16 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RIVIS-00068g-Jb
	for xen-changelog@lists.xensource.com; Tue, 25 Oct 2011 01:55:16 +0100
Message-Id: <E1RIVIS-00068g-Jb@xenbits.xen.org>
Date: Tue, 25 Oct 2011 01:55:16 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] nestedhvm: handle l2 guest MMIO
	access
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 Tim Deegan <tim@xen.org>
# Date 1319452148 -3600
# Node ID ffe861c1d5dfa8f4485052e5600e06124105033f
# Parent  a7ccbc79fc17862c21e34c2f145a5a053711f917
nestedhvm: handle l2 guest MMIO access

Hyper-V starts a root domain which effectively an l2 guest.
Hyper-V passes its devices through to the root domain and
let it do the MMIO accesses. The emulation is done by
Xen (host) and Hyper-V forwards the interrupts to the l2 guest.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by:  Tim Deegan <tim@xen.org>
---


diff -r a7ccbc79fc17 -r ffe861c1d5df xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c	Fri Oct 21 09:45:24 2011 +0200
+++ b/xen/arch/x86/hvm/hvm.c	Mon Oct 24 11:29:08 2011 +0100
@@ -1208,6 +1208,10 @@
             return 0;
         case NESTEDHVM_PAGEFAULT_INJECT:
             return -1;
+        case NESTEDHVM_PAGEFAULT_MMIO:
+            if ( !handle_mmio() )
+                hvm_inject_exception(TRAP_gp_fault, 0, 0);
+            return 1;
         }
     }
 
diff -r a7ccbc79fc17 -r ffe861c1d5df xen/arch/x86/hvm/svm/nestedsvm.c
--- a/xen/arch/x86/hvm/svm/nestedsvm.c	Fri Oct 21 09:45:24 2011 +0200
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c	Mon Oct 24 11:29:08 2011 +0100
@@ -1161,6 +1161,15 @@
         if ( svm->ns_hostflags.fields.vintrmask )
             if ( !svm->ns_hostflags.fields.rflagsif )
                 return hvm_intblk_rflags_ie;
+
+        /* when l1 guest passes its devices through to the l2 guest
+         * and l2 guest does an MMIO access then we may want to
+         * inject an VMEXIT(#INTR) exitcode into the l1 guest.
+         * Delay the injection because this would result in delivering
+         * an interrupt *within* the execution of an instruction.
+         */
+        if ( v->arch.hvm_vcpu.io_state != HVMIO_none )
+            return hvm_intblk_shadow;
     }
 
     if ( nv->nv_vmexit_pending ) {
diff -r a7ccbc79fc17 -r ffe861c1d5df xen/arch/x86/mm/hap/nested_hap.c
--- a/xen/arch/x86/mm/hap/nested_hap.c	Fri Oct 21 09:45:24 2011 +0200
+++ b/xen/arch/x86/mm/hap/nested_hap.c	Mon Oct 24 11:29:08 2011 +0100
@@ -151,6 +151,9 @@
     mfn = gfn_to_mfn_type_p2m(p2m, L1_gpa >> PAGE_SHIFT, &p2mt, &p2ma, 
                               p2m_query, page_order);
 
+    if ( p2m_is_mmio(p2mt) )
+        return NESTEDHVM_PAGEFAULT_MMIO;
+
     if ( p2m_is_paging(p2mt) || p2m_is_shared(p2mt) || !p2m_is_ram(p2mt) )
         return NESTEDHVM_PAGEFAULT_ERROR;
 
@@ -228,6 +231,8 @@
         return rv;
     case NESTEDHVM_PAGEFAULT_DONE:
         break;
+    case NESTEDHVM_PAGEFAULT_MMIO:
+        return rv;
     default:
         BUG();
         break;
diff -r a7ccbc79fc17 -r ffe861c1d5df xen/include/asm-x86/hvm/nestedhvm.h
--- a/xen/include/asm-x86/hvm/nestedhvm.h	Fri Oct 21 09:45:24 2011 +0200
+++ b/xen/include/asm-x86/hvm/nestedhvm.h	Mon Oct 24 11:29:08 2011 +0100
@@ -50,6 +50,7 @@
 #define NESTEDHVM_PAGEFAULT_DONE   0
 #define NESTEDHVM_PAGEFAULT_INJECT 1
 #define NESTEDHVM_PAGEFAULT_ERROR  2
+#define NESTEDHVM_PAGEFAULT_MMIO   3
 int nestedhvm_hap_nested_page_fault(struct vcpu *v, paddr_t L2_gpa);
 
 /* IO permission map */

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 24 17:56:15 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 24 Oct 2011 17:56:15 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RIVJP-00007C-DE; Mon, 24 Oct 2011 17:56:15 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RIVIS-0008KG-HH
	for xen-changelog@lists.xensource.com; Mon, 24 Oct 2011 17:55:20 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-182.messagelabs.com!1319504113!615023!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2205 invoked from network); 25 Oct 2011 00:55:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-6.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	25 Oct 2011 00:55:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RIVIO-000643-Mn
	for xen-changelog@lists.xensource.com; Tue, 25 Oct 2011 01:55:12 +0100
Message-Id: <E1RIVIO-000643-Mn@xenbits.xen.org>
Date: Tue, 25 Oct 2011 01:55:12 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: allocate IRQ actions'
	cpu_eoi_map dynamically
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 Jan Beulich <jbeulich@suse.com>
# Date 1319181722 -7200
# Node ID eef4641d6726982d4d93ec12d407c3ce2180e290
# Parent  07d303ff27576d803bb1ca92f31314426133da54
x86: allocate IRQ actions' cpu_eoi_map dynamically

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r 07d303ff2757 -r eef4641d6726 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Fri Oct 21 09:21:09 2011 +0200
+++ b/xen/arch/x86/irq.c	Fri Oct 21 09:22:02 2011 +0200
@@ -966,7 +966,7 @@
 #define ACKTYPE_NONE   0     /* No final acknowledgement is required */
 #define ACKTYPE_UNMASK 1     /* Unmask PIC hardware (from any CPU)   */
 #define ACKTYPE_EOI    2     /* EOI on the CPU that was interrupted  */
-    cpumask_t cpu_eoi_map;   /* CPUs that need to EOI this interrupt */
+    cpumask_var_t cpu_eoi_map; /* CPUs that need to EOI this interrupt */
     struct timer eoi_timer;
     struct domain *guest[IRQ_MAX_GUESTS];
 } irq_guest_action_t;
@@ -1040,7 +1040,7 @@
             desc->handler->end(desc, 0);
         break;
     case ACKTYPE_EOI:
-        cpumask_copy(&cpu_eoi_map, &action->cpu_eoi_map);
+        cpumask_copy(&cpu_eoi_map, action->cpu_eoi_map);
         spin_unlock_irq(&desc->lock);
         on_selected_cpus(&cpu_eoi_map, set_eoi_ready, desc, 0);
         spin_lock_irq(&desc->lock);
@@ -1079,7 +1079,7 @@
         peoi[sp].vector = vector;
         peoi[sp].ready = 0;
         pending_eoi_sp(peoi) = sp+1;
-        cpu_set(smp_processor_id(), action->cpu_eoi_map);
+        cpumask_set_cpu(smp_processor_id(), action->cpu_eoi_map);
     }
 
     for ( i = 0; i < action->nr_guests; i++ )
@@ -1297,7 +1297,8 @@
 
     if ( !(desc->status & IRQ_GUEST) ||
          (action->in_flight != 0) ||
-         !cpu_test_and_clear(smp_processor_id(), action->cpu_eoi_map) )
+         !cpumask_test_and_clear_cpu(smp_processor_id(),
+                                     action->cpu_eoi_map) )
         return;
 
     sp = pending_eoi_sp(peoi);
@@ -1357,7 +1358,7 @@
 
     if ( action->ack_type == ACKTYPE_UNMASK )
     {
-        ASSERT(cpus_empty(action->cpu_eoi_map));
+        ASSERT(cpumask_empty(action->cpu_eoi_map));
         if ( desc->handler->end )
             desc->handler->end(desc, 0);
         spin_unlock_irq(&desc->lock);
@@ -1366,7 +1367,7 @@
 
     ASSERT(action->ack_type == ACKTYPE_EOI);
         
-    cpumask_copy(&cpu_eoi_map, &action->cpu_eoi_map);
+    cpumask_copy(&cpu_eoi_map, action->cpu_eoi_map);
 
     if ( cpumask_test_and_clear_cpu(smp_processor_id(), &cpu_eoi_map) )
     {
@@ -1504,8 +1505,10 @@
         if ( newaction == NULL )
         {
             spin_unlock_irq(&desc->lock);
-            if ( (newaction = xmalloc(irq_guest_action_t)) != NULL )
+            if ( (newaction = xmalloc(irq_guest_action_t)) != NULL &&
+                 zalloc_cpumask_var(&newaction->cpu_eoi_map) )
                 goto retry;
+            xfree(newaction);
             gdprintk(XENLOG_INFO,
                      "Cannot bind IRQ %d to guest. Out of memory.\n",
                      pirq->pirq);
@@ -1521,7 +1524,6 @@
         action->in_flight   = 0;
         action->shareable   = will_share;
         action->ack_type    = pirq_acktype(v->domain, pirq->pirq);
-        cpumask_clear(&action->cpu_eoi_map);
         init_timer(&action->eoi_timer, irq_guest_eoi_timer_fn, desc, 0);
 
         desc->status |= IRQ_GUEST;
@@ -1574,7 +1576,10 @@
     spin_unlock_irq(&desc->lock);
  out:
     if ( newaction != NULL )
+    {
+        free_cpumask_var(newaction->cpu_eoi_map);
         xfree(newaction);
+    }
     return rc;
 }
 
@@ -1619,7 +1624,7 @@
              (--action->in_flight == 0) &&
              (action->nr_guests != 0) )
         {
-            cpumask_copy(&cpu_eoi_map, &action->cpu_eoi_map);
+            cpumask_copy(&cpu_eoi_map, action->cpu_eoi_map);
             spin_unlock_irq(&desc->lock);
             on_selected_cpus(&cpu_eoi_map, set_eoi_ready, desc, 0);
             spin_lock_irq(&desc->lock);
@@ -1649,7 +1654,7 @@
      * would need to flush all ready EOIs before returning as otherwise the
      * desc->handler could change and we would call the wrong 'end' hook.
      */
-    cpumask_copy(&cpu_eoi_map, &action->cpu_eoi_map);
+    cpumask_copy(&cpu_eoi_map, action->cpu_eoi_map);
     if ( !cpumask_empty(&cpu_eoi_map) )
     {
         BUG_ON(action->ack_type != ACKTYPE_EOI);
@@ -1658,7 +1663,7 @@
         spin_lock_irq(&desc->lock);
     }
 
-    BUG_ON(!cpus_empty(action->cpu_eoi_map));
+    BUG_ON(!cpumask_empty(action->cpu_eoi_map));
 
     desc->action = NULL;
     desc->status &= ~(IRQ_GUEST|IRQ_INPROGRESS);
@@ -1697,6 +1702,7 @@
     if ( oldaction != NULL )
     {
         kill_timer(&oldaction->eoi_timer);
+        free_cpumask_var(oldaction->cpu_eoi_map);
         xfree(oldaction);
     }
     else if ( irq > 0 )
@@ -1740,6 +1746,7 @@
     if ( oldaction != NULL )
     {
         kill_timer(&oldaction->eoi_timer);
+        free_cpumask_var(oldaction->cpu_eoi_map);
         xfree(oldaction);
     }
 
@@ -2114,7 +2121,7 @@
         if ( !(desc->status & IRQ_GUEST) )
             continue;
         action = (irq_guest_action_t *)desc->action;
-        cpu_clear(smp_processor_id(), action->cpu_eoi_map);
+        cpumask_clear_cpu(smp_processor_id(), action->cpu_eoi_map);
     }
 
     /* Flush the interrupt EOI stack. */

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 24 17:56:24 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 24 Oct 2011 17:56:24 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RIVJY-0000Ad-2Z; Mon, 24 Oct 2011 17:56:24 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RIVIV-0008Kb-RU
	for xen-changelog@lists.xensource.com; Mon, 24 Oct 2011 17:55:20 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-216.messagelabs.com!1319504116!909483!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3167 invoked from network); 25 Oct 2011 00:55:16 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-16.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	25 Oct 2011 00:55:16 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RIVIS-00067z-1z
	for xen-changelog@lists.xensource.com; Tue, 25 Oct 2011 01:55:16 +0100
Message-Id: <E1RIVIS-00067z-1z@xenbits.xen.org>
Date: Tue, 25 Oct 2011 01:55:15 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] cpumask <=> xenctl_cpumap: allocate
	CPU masks and byte maps dynamically
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 Jan Beulich <jbeulich@suse.com>
# Date 1319183124 -7200
# Node ID a7ccbc79fc17862c21e34c2f145a5a053711f917
# Parent  1c8789852eafea3a40664283ef19096e09a4cc43
cpumask <=> xenctl_cpumap: allocate CPU masks and byte maps dynamically

Generally there was a NR_CPUS-bits wide array in these functions and
another (through a cpumask_t) on their callers' stacks, which may get
a little large for big NR_CPUS. As the functions can fail anyway, do
the allocation in there.

For the x86/MCA case this require a little code restructuring: By using
different CPU mask accessors it was possible to avoid allocating a mask
in the broadcast case. Also, this was the only user that failed to
check the return value of the conversion function (which could have led
to undefined behvior).

Also constify the input parameters of the two functions.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r 1c8789852eaf -r a7ccbc79fc17 xen/arch/x86/cpu/mcheck/mce.c
--- a/xen/arch/x86/cpu/mcheck/mce.c	Fri Oct 21 09:44:47 2011 +0200
+++ b/xen/arch/x86/cpu/mcheck/mce.c	Fri Oct 21 09:45:24 2011 +0200
@@ -1531,25 +1531,28 @@
 
     case XEN_MC_inject_v2:
     {
-        cpumask_t cpumap;
+        const cpumask_t *cpumap;
+        cpumask_var_t cmv;
 
         if (nr_mce_banks == 0)
             return x86_mcerr("do_mca #MC", -ENODEV);
 
         if ( op->u.mc_inject_v2.flags & XEN_MC_INJECT_CPU_BROADCAST )
-            cpumask_copy(&cpumap, &cpu_online_map);
+            cpumap = &cpu_online_map;
         else
         {
-            int gcw;
-
-            xenctl_cpumap_to_cpumask(&cpumap,
-                                     &op->u.mc_inject_v2.cpumap);
-            gcw = cpumask_weight(&cpumap);
-            cpumask_and(&cpumap, &cpu_online_map, &cpumap);
-
-            if ( cpumask_empty(&cpumap) )
-                return x86_mcerr("No online CPU passed\n", -EINVAL);
-            else if ( gcw != cpumask_weight(&cpumap) )
+            ret = xenctl_cpumap_to_cpumask(&cmv,
+                                           &op->u.mc_inject_v2.cpumap);
+            if ( ret )
+                break;
+            cpumap = cmv;
+            if ( !cpumask_intersects(cpumap, &cpu_online_map) )
+            {
+                free_cpumask_var(cmv);
+                ret = x86_mcerr("No online CPU passed\n", -EINVAL);
+                break;
+            }
+            if ( !cpumask_subset(cpumap, &cpu_online_map) )
                 dprintk(XENLOG_INFO,
                         "Not all required CPUs are online\n");
         }
@@ -1558,19 +1561,25 @@
         {
         case XEN_MC_INJECT_TYPE_MCE:
             if ( mce_broadcast &&
-                 !cpumask_equal(&cpumap, &cpu_online_map) )
+                 !cpumask_equal(cpumap, &cpu_online_map) )
                 printk("Not trigger MCE on all CPUs, may HANG!\n");
-            on_selected_cpus(&cpumap, x86_mc_mceinject, NULL, 1);
+            on_selected_cpus(cpumap, x86_mc_mceinject, NULL, 1);
             break;
         case XEN_MC_INJECT_TYPE_CMCI:
             if ( !cmci_support )
-                return x86_mcerr(
+                ret = x86_mcerr(
                     "No CMCI supported in platform\n", -EINVAL);
-            on_selected_cpus(&cpumap, x86_cmci_inject, NULL, 1);
+            else
+                on_selected_cpus(cpumap, x86_cmci_inject, NULL, 1);
             break;
         default:
-            return x86_mcerr("Wrong mca type\n", -EINVAL);
+            ret = x86_mcerr("Wrong mca type\n", -EINVAL);
+            break;
         }
+
+        if (cpumap != &cpu_online_map)
+            free_cpumask_var(cmv);
+
         break;
     }
 
diff -r 1c8789852eaf -r a7ccbc79fc17 xen/arch/x86/platform_hypercall.c
--- a/xen/arch/x86/platform_hypercall.c	Fri Oct 21 09:44:47 2011 +0200
+++ b/xen/arch/x86/platform_hypercall.c	Fri Oct 21 09:45:24 2011 +0200
@@ -346,7 +346,7 @@
         uint32_t cpu;
         uint64_t idletime, now = NOW();
         struct xenctl_cpumap ctlmap;
-        cpumask_t cpumap;
+        cpumask_var_t cpumap;
         XEN_GUEST_HANDLE(uint8) cpumap_bitmap;
         XEN_GUEST_HANDLE(uint64) idletimes;
 
@@ -366,22 +366,26 @@
             goto out;
         guest_from_compat_handle(idletimes, op->u.getidletime.idletime);
 
-        for_each_cpu_mask ( cpu, cpumap )
+        for_each_cpu_mask ( cpu, *cpumap )
         {
             if ( idle_vcpu[cpu] == NULL )
-                cpu_clear(cpu, cpumap);
+                cpumask_clear_cpu(cpu, cpumap);
             idletime = get_cpu_idle_time(cpu);
 
-            ret = -EFAULT;
             if ( copy_to_guest_offset(idletimes, cpu, &idletime, 1) )
-                goto out;
+            {
+                ret = -EFAULT;
+                break;
+            }
         }
 
         op->u.getidletime.now = now;
-        if ( (ret = cpumask_to_xenctl_cpumap(&ctlmap, &cpumap)) != 0 )
-            goto out;
+        if ( ret == 0 )
+            ret = cpumask_to_xenctl_cpumap(&ctlmap, cpumap);
+        free_cpumask_var(cpumap);
 
-        ret = copy_to_guest(u_xenpf_op, op, 1) ? -EFAULT : 0;
+        if ( ret == 0 && copy_to_guest(u_xenpf_op, op, 1) )
+            ret = -EFAULT;
     }
     break;
 
diff -r 1c8789852eaf -r a7ccbc79fc17 xen/common/domctl.c
--- a/xen/common/domctl.c	Fri Oct 21 09:44:47 2011 +0200
+++ b/xen/common/domctl.c	Fri Oct 21 09:45:24 2011 +0200
@@ -30,11 +30,15 @@
 static DEFINE_SPINLOCK(domctl_lock);
 
 int cpumask_to_xenctl_cpumap(
-    struct xenctl_cpumap *xenctl_cpumap, cpumask_t *cpumask)
+    struct xenctl_cpumap *xenctl_cpumap, const cpumask_t *cpumask)
 {
     unsigned int guest_bytes, copy_bytes, i;
     uint8_t zero = 0;
-    uint8_t bytemap[(NR_CPUS + 7) / 8];
+    int err = 0;
+    uint8_t *bytemap = xmalloc_array(uint8_t, (nr_cpu_ids + 7) / 8);
+
+    if ( !bytemap )
+        return -ENOMEM;
 
     guest_bytes = (xenctl_cpumap->nr_cpus + 7) / 8;
     copy_bytes  = min_t(unsigned int, guest_bytes, (nr_cpu_ids + 7) / 8);
@@ -43,37 +47,48 @@
 
     if ( copy_bytes != 0 )
         if ( copy_to_guest(xenctl_cpumap->bitmap, bytemap, copy_bytes) )
-            return -EFAULT;
+            err = -EFAULT;
 
-    for ( i = copy_bytes; i < guest_bytes; i++ )
+    for ( i = copy_bytes; !err && i < guest_bytes; i++ )
         if ( copy_to_guest_offset(xenctl_cpumap->bitmap, i, &zero, 1) )
-            return -EFAULT;
+            err = -EFAULT;
 
-    return 0;
+    xfree(bytemap);
+
+    return err;
 }
 
 int xenctl_cpumap_to_cpumask(
-    cpumask_t *cpumask, struct xenctl_cpumap *xenctl_cpumap)
+    cpumask_var_t *cpumask, const struct xenctl_cpumap *xenctl_cpumap)
 {
     unsigned int guest_bytes, copy_bytes;
-    uint8_t bytemap[(NR_CPUS + 7) / 8];
+    int err = 0;
+    uint8_t *bytemap = xzalloc_array(uint8_t, (nr_cpu_ids + 7) / 8);
+
+    if ( !bytemap )
+        return -ENOMEM;
 
     guest_bytes = (xenctl_cpumap->nr_cpus + 7) / 8;
     copy_bytes  = min_t(unsigned int, guest_bytes, (nr_cpu_ids + 7) / 8);
 
-    memset(bytemap, 0, sizeof(bytemap));
-
     if ( copy_bytes != 0 )
     {
         if ( copy_from_guest(bytemap, xenctl_cpumap->bitmap, copy_bytes) )
-            return -EFAULT;
+            err = -EFAULT;
         if ( (xenctl_cpumap->nr_cpus & 7) && (guest_bytes <= sizeof(bytemap)) )
             bytemap[guest_bytes-1] &= ~(0xff << (xenctl_cpumap->nr_cpus & 7));
     }
 
-    bitmap_byte_to_long(cpumask_bits(cpumask), bytemap, nr_cpu_ids);
+    if ( err )
+        /* nothing */;
+    else if ( alloc_cpumask_var(cpumask) )
+        bitmap_byte_to_long(cpumask_bits(*cpumask), bytemap, nr_cpu_ids);
+    else
+        err = -ENOMEM;
 
-    return 0;
+    xfree(bytemap);
+
+    return err;
 }
 
 static inline int is_free_domid(domid_t dom)
@@ -558,7 +573,6 @@
         domid_t dom = op->domain;
         struct domain *d = rcu_lock_domain_by_id(dom);
         struct vcpu *v;
-        cpumask_t new_affinity;
 
         ret = -ESRCH;
         if ( d == NULL )
@@ -578,10 +592,15 @@
 
         if ( op->cmd == XEN_DOMCTL_setvcpuaffinity )
         {
+            cpumask_var_t new_affinity;
+
             ret = xenctl_cpumap_to_cpumask(
                 &new_affinity, &op->u.vcpuaffinity.cpumap);
             if ( !ret )
-                ret = vcpu_set_affinity(v, &new_affinity);
+            {
+                ret = vcpu_set_affinity(v, new_affinity);
+                free_cpumask_var(new_affinity);
+            }
         }
         else
         {
diff -r 1c8789852eaf -r a7ccbc79fc17 xen/common/trace.c
--- a/xen/common/trace.c	Fri Oct 21 09:44:47 2011 +0200
+++ b/xen/common/trace.c	Fri Oct 21 09:45:24 2011 +0200
@@ -378,7 +378,16 @@
         tbc->size = t_info_pages * PAGE_SIZE;
         break;
     case XEN_SYSCTL_TBUFOP_set_cpu_mask:
-        rc = xenctl_cpumap_to_cpumask(&tb_cpu_mask, &tbc->cpu_mask);
+    {
+        cpumask_var_t mask;
+
+        rc = xenctl_cpumap_to_cpumask(&mask, &tbc->cpu_mask);
+        if ( !rc )
+        {
+            cpumask_copy(&tb_cpu_mask, mask);
+            free_cpumask_var(mask);
+        }
+    }
         break;
     case XEN_SYSCTL_TBUFOP_set_evt_mask:
         tb_event_mask = tbc->evt_mask;
diff -r 1c8789852eaf -r a7ccbc79fc17 xen/include/xen/cpumask.h
--- a/xen/include/xen/cpumask.h	Fri Oct 21 09:44:47 2011 +0200
+++ b/xen/include/xen/cpumask.h	Fri Oct 21 09:45:24 2011 +0200
@@ -488,9 +488,7 @@
 
 /* Copy to/from cpumap provided by control tools. */
 struct xenctl_cpumap;
-int cpumask_to_xenctl_cpumap(
-    struct xenctl_cpumap *enctl_cpumap, cpumask_t *cpumask);
-int xenctl_cpumap_to_cpumask(
-    cpumask_t *cpumask, struct xenctl_cpumap *enctl_cpumap);
+int cpumask_to_xenctl_cpumap(struct xenctl_cpumap *, const cpumask_t *);
+int xenctl_cpumap_to_cpumask(cpumask_var_t *, const struct xenctl_cpumap *);
 
 #endif /* __XEN_CPUMASK_H */

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 24 17:56:31 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 24 Oct 2011 17:56:31 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RIVJf-0000Dc-7b; Mon, 24 Oct 2011 17:56:31 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RIVIQ-0008KD-TR
	for xen-changelog@lists.xensource.com; Mon, 24 Oct 2011 17:55:20 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-21.messagelabs.com!1319504111!1535091!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22385 invoked from network); 25 Oct 2011 00:55:11 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-7.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	25 Oct 2011 00:55:11 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RIVIN-00062h-Ik
	for xen-changelog@lists.xensource.com; Tue, 25 Oct 2011 01:55:11 +0100
Message-Id: <E1RIVIN-00062h-Ik@xenbits.xen.org>
Date: Tue, 25 Oct 2011 01:55:10 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] eliminate cpumask accessors
	referencing NR_CPUS
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 Jan Beulich <jbeulich@suse.com>
# Date 1319181584 -7200
# Node ID 1a4223c62ee7868e52be7640543af88483d1f5f3
# Parent  511d5e65a30231fab56b47ffe7b2f1483b023700
eliminate cpumask accessors referencing NR_CPUS

... in favor of using the new, nr_cpumask_bits-based ones.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r 511d5e65a302 -r 1a4223c62ee7 xen/arch/ia64/linux-xen/acpi.c
--- a/xen/arch/ia64/linux-xen/acpi.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/arch/ia64/linux-xen/acpi.c	Fri Oct 21 09:19:44 2011 +0200
@@ -957,14 +957,14 @@
 	buffer.length = ACPI_ALLOCATE_BUFFER;
 	buffer.pointer = NULL;
 
-	cpus_complement(tmp_map, cpu_present_map);
-	cpu = first_cpu(tmp_map);
-	if (cpu >= NR_CPUS)
+	cpumask_complement(&tmp_map, &cpu_present_map);
+	cpu = cpumask_first(&tmp_map);
+	if (cpu >= nr_cpu_ids)
 		return -EINVAL;
 
 	acpi_map_cpu2node(handle, cpu, physid);
 
-	cpu_set(cpu, cpu_present_map);
+	cpumask_set_cpu(cpu, &cpu_present_map);
 	ia64_cpu_to_sapicid[cpu] = physid;
 
 	*pcpu = cpu;
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/arch/ia64/linux-xen/numa.c
--- a/xen/arch/ia64/linux-xen/numa.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/arch/ia64/linux-xen/numa.c	Fri Oct 21 09:19:44 2011 +0200
@@ -51,7 +51,7 @@
 	int cpu, i, node;
 
 	for(node=0; node < MAX_NUMNODES; node++)
-		cpus_clear(node_to_cpu_mask[node]);
+		cpumask_clear(&node_to_cpu_mask[node]);
 
 	for(cpu = 0; cpu < NR_CPUS; ++cpu) {
 		node = -1;
@@ -62,6 +62,6 @@
 			}
 		cpu_to_node_map[cpu] = (node >= 0) ? node : 0;
 		if (node >= 0)
-			cpu_set(cpu, node_to_cpu_mask[node]);
+			cpumask_set_cpu(cpu, &node_to_cpu_mask[node]);
 	}
 }
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/arch/ia64/linux-xen/smpboot.c
--- a/xen/arch/ia64/linux-xen/smpboot.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/arch/ia64/linux-xen/smpboot.c	Fri Oct 21 09:19:44 2011 +0200
@@ -594,15 +594,15 @@
 	}
 
 	ia64_cpu_to_sapicid[0] = boot_cpu_id;
-	cpus_clear(cpu_present_map);
-	cpu_set(0, cpu_present_map);
-	cpu_set(0, cpu_possible_map);
+	cpumask_clear(&cpu_present_map);
+	cpumask_set_cpu(0, &cpu_present_map);
+	cpumask_set_cpu(0, &cpu_possible_map);
 	for (cpu = 1, i = 0; i < smp_boot_data.cpu_count; i++) {
 		sapicid = smp_boot_data.cpu_phys_id[i];
 		if (sapicid == boot_cpu_id)
 			continue;
-		cpu_set(cpu, cpu_present_map);
-		cpu_set(cpu, cpu_possible_map);
+		cpumask_set_cpu(cpu, &cpu_present_map);
+		cpumask_set_cpu(cpu, &cpu_possible_map);
 		ia64_cpu_to_sapicid[cpu] = sapicid;
 		cpu++;
 	}
@@ -640,12 +640,12 @@
 	 */
 	if (!max_cpus) {
 		printk(KERN_INFO "SMP mode deactivated.\n");
-		cpus_clear(cpu_online_map);
-		cpus_clear(cpu_present_map);
-		cpus_clear(cpu_possible_map);
-		cpu_set(0, cpu_online_map);
-		cpu_set(0, cpu_present_map);
-		cpu_set(0, cpu_possible_map);
+		cpumask_clear(&cpu_online_map);
+		cpumask_clear(&cpu_present_map);
+		cpumask_clear(&cpu_possible_map);
+		cpumask_set_cpu(0, &cpu_online_map);
+		cpumask_set_cpu(0, &cpu_present_map);
+		cpumask_set_cpu(0, &cpu_possible_map);
 		return;
 	}
 }
@@ -688,12 +688,12 @@
 	int i;
 
 	for_each_cpu_mask(i, per_cpu(cpu_sibling_map, cpu))
-		cpu_clear(cpu, per_cpu(cpu_sibling_map, i));
+		cpumask_clear_cpu(cpu, &per_cpu(cpu_sibling_map, i));
 	for_each_cpu_mask(i, per_cpu(cpu_core_map, cpu))
-		cpu_clear(cpu, per_cpu(cpu_core_map, i));
+		cpumask_clear_cpu(cpu, &per_cpu(cpu_core_map, i));
 
-	cpus_clear(per_cpu(cpu_sibling_map, cpu));
-	cpus_clear(per_cpu(cpu_core_map, cpu));
+	cpumask_clear(&per_cpu(cpu_sibling_map, cpu));
+	cpumask_clear(&per_cpu(cpu_core_map, cpu));
 }
 
 static void
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/arch/ia64/linux-xen/sn/kernel/sn2_smp.c
--- a/xen/arch/ia64/linux-xen/sn/kernel/sn2_smp.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/arch/ia64/linux-xen/sn/kernel/sn2_smp.c	Fri Oct 21 09:19:44 2011 +0200
@@ -206,7 +206,7 @@
 	static DEFINE_SPINLOCK(sn2_ptcg_lock2);
 
 	nodes_clear(nodes_flushed);
-	cpus_clear(selected_cpus);
+	cpumask_clear(&selected_cpus);
 
 	spin_lock(&sn2_ptcg_lock2);
 	node_set(cpu_to_node(smp_processor_id()), nodes_flushed);
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/arch/ia64/xen/fw_emul.c
--- a/xen/arch/ia64/xen/fw_emul.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/arch/ia64/xen/fw_emul.c	Fri Oct 21 09:19:44 2011 +0200
@@ -866,10 +866,10 @@
 			             "status %lx", status);
 
 		if (in1 == PAL_CACHE_TYPE_COHERENT) {
-			cpus_setall(current->arch.cache_coherent_map);
-			cpu_clear(processor, current->arch.cache_coherent_map);
-			cpus_setall(cpu_cache_coherent_map);
-			cpu_clear(processor, cpu_cache_coherent_map);
+			cpumask_complement(&current->arch.cache_coherent_map,
+					   cpumask_of(processor));
+			cpumask_complement(&cpu_cache_coherent_map,
+					   cpumask_of(processor));
 		}
 		break;
 	    case PAL_PERF_MON_INFO:
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/arch/ia64/xen/tlb_track.c
--- a/xen/arch/ia64/xen/tlb_track.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/arch/ia64/xen/tlb_track.c	Fri Oct 21 09:19:44 2011 +0200
@@ -374,7 +374,7 @@
         entry->pte_val = old_pte;
         entry->vaddr = vaddr;
         entry->rid = rid;
-        cpus_clear(entry->pcpu_dirty_mask);
+        cpumask_clear(&entry->pcpu_dirty_mask);
         vcpus_clear(entry->vcpu_dirty_mask);
         list_add(&entry->list, head);
 
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/arch/ia64/xen/xensetup.c
--- a/xen/arch/ia64/xen/xensetup.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/arch/ia64/xen/xensetup.c	Fri Oct 21 09:19:44 2011 +0200
@@ -592,7 +592,7 @@
     smp_prepare_cpus(max_cpus);
 
     /* We aren't hotplug-capable yet. */
-    cpus_or(cpu_present_map, cpu_present_map, cpu_possible_map);
+    cpumask_or(&cpu_present_map, &cpu_present_map, &cpu_possible_map);
 
     /*  Enable IRQ to receive IPI (needed for ITC sync).  */
     local_irq_enable();
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/arch/x86/acpi/cpu_idle.c
--- a/xen/arch/x86/acpi/cpu_idle.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/arch/x86/acpi/cpu_idle.c	Fri Oct 21 09:19:44 2011 +0200
@@ -233,13 +233,13 @@
     cpumask_t target;
     unsigned int cpu;
 
-    cpus_and(target, *mask, cpuidle_mwait_flags);
+    cpumask_and(&target, mask, &cpuidle_mwait_flags);
 
     /* CPU is MWAITing on the cpuidle_mwait_wakeup flag. */
     for_each_cpu_mask(cpu, target)
         mwait_wakeup(cpu) = 0;
 
-    cpus_andnot(*mask, *mask, target);
+    cpumask_andnot(mask, mask, &target);
 }
 
 static void mwait_idle_with_hints(unsigned long eax, unsigned long ecx)
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/arch/x86/acpi/cpufreq/cpufreq.c
--- a/xen/arch/x86/acpi/cpufreq/cpufreq.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c	Fri Oct 21 09:19:44 2011 +0200
@@ -446,7 +446,7 @@
     if (unlikely(result))
         return -ENODEV;
 
-    cpus_and(online_policy_cpus, cpu_online_map, policy->cpus);
+    cpumask_and(&online_policy_cpus, &cpu_online_map, &policy->cpus);
 
     next_perf_state = data->freq_table[next_state].index;
     if (perf->state == next_perf_state) {
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/arch/x86/cpu/mcheck/mce.c
--- a/xen/arch/x86/cpu/mcheck/mce.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/arch/x86/cpu/mcheck/mce.c	Fri Oct 21 09:19:44 2011 +0200
@@ -1537,20 +1537,19 @@
             return x86_mcerr("do_mca #MC", -ENODEV);
 
         if ( op->u.mc_inject_v2.flags & XEN_MC_INJECT_CPU_BROADCAST )
-            cpus_copy(cpumap, cpu_online_map);
+            cpumask_copy(&cpumap, &cpu_online_map);
         else
         {
             int gcw;
 
-            cpus_clear(cpumap);
             xenctl_cpumap_to_cpumask(&cpumap,
                                      &op->u.mc_inject_v2.cpumap);
-            gcw = cpus_weight(cpumap);
-            cpus_and(cpumap, cpu_online_map, cpumap);
+            gcw = cpumask_weight(&cpumap);
+            cpumask_and(&cpumap, &cpu_online_map, &cpumap);
 
-            if ( cpus_empty(cpumap) )
+            if ( cpumask_empty(&cpumap) )
                 return x86_mcerr("No online CPU passed\n", -EINVAL);
-            else if ( gcw != cpus_weight(cpumap) )
+            else if ( gcw != cpumask_weight(&cpumap) )
                 dprintk(XENLOG_INFO,
                         "Not all required CPUs are online\n");
         }
@@ -1559,7 +1558,7 @@
         {
         case XEN_MC_INJECT_TYPE_MCE:
             if ( mce_broadcast &&
-                 !cpus_equal(cpumap, cpu_online_map) )
+                 !cpumask_equal(&cpumap, &cpu_online_map) )
                 printk("Not trigger MCE on all CPUs, may HANG!\n");
             on_selected_cpus(&cpumap, x86_mc_mceinject, NULL, 1);
             break;
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/arch/x86/hpet.c	Fri Oct 21 09:19:44 2011 +0200
@@ -178,7 +178,7 @@
     spin_unlock_irq(&ch->lock);
 
     next_event = STIME_MAX;
-    mask = (cpumask_t)CPU_MASK_NONE;
+    cpumask_clear(&mask);
     now = NOW();
 
     /* find all expired events */
@@ -189,11 +189,11 @@
         rmb();
         deadline = per_cpu(timer_deadline, cpu);
         rmb();
-        if ( !cpu_isset(cpu, ch->cpumask) )
+        if ( !cpumask_test_cpu(cpu, &ch->cpumask) )
             continue;
 
         if ( deadline <= now )
-            cpu_set(cpu, mask);
+            cpumask_set_cpu(cpu, &mask);
         else if ( deadline < next_event )
             next_event = deadline;
     }
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/arch/x86/hvm/nestedhvm.c
--- a/xen/arch/x86/hvm/nestedhvm.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/arch/x86/hvm/nestedhvm.c	Fri Oct 21 09:19:44 2011 +0200
@@ -116,7 +116,7 @@
 {
     on_selected_cpus(&p2m->p2m_dirty_cpumask, nestedhvm_flushtlb_ipi,
         p2m->domain, 1);
-    cpus_clear(p2m->p2m_dirty_cpumask);
+    cpumask_clear(&p2m->p2m_dirty_cpumask);
 }
 
 bool_t
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/arch/x86/io_apic.c	Fri Oct 21 09:19:44 2011 +0200
@@ -1850,7 +1850,7 @@
     int apic1, pin1, apic2, pin2;
     int vector, ret;
     unsigned long flags;
-    cpumask_t mask_all = CPU_MASK_ALL;
+    cpumask_t mask_all;
 
     local_irq_save(flags);
 
@@ -1861,6 +1861,7 @@
     vector = FIRST_HIPRIORITY_VECTOR;
     clear_irq_vector(0);
 
+    cpumask_setall(&mask_all);
     if ((ret = bind_irq_vector(0, vector, &mask_all)))
         printk(KERN_ERR"..IRQ0 is not set correctly with ioapic!!!, err:%d\n", ret);
     
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/arch/x86/irq.c	Fri Oct 21 09:19:44 2011 +0200
@@ -115,10 +115,10 @@
     BUG_ON((unsigned)irq >= nr_irqs);
     BUG_ON((unsigned)vector >= NR_VECTORS);
 
-    cpus_and(online_mask, *cpu_mask, cpu_online_map);
-    if (cpus_empty(online_mask))
+    cpumask_and(&online_mask, cpu_mask, &cpu_online_map);
+    if (cpumask_empty(&online_mask))
         return -EINVAL;
-    if ((cfg->vector == vector) && cpus_equal(cfg->cpu_mask, online_mask))
+    if ((cfg->vector == vector) && cpumask_equal(&cfg->cpu_mask, &online_mask))
         return 0;
     if (cfg->vector != IRQ_VECTOR_UNASSIGNED) 
         return -EBUSY;
@@ -126,7 +126,7 @@
     for_each_cpu_mask(cpu, online_mask)
         per_cpu(vector_irq, cpu)[vector] = irq;
     cfg->vector = vector;
-    cfg->cpu_mask = online_mask;
+    cpumask_copy(&cfg->cpu_mask, &online_mask);
     if ( cfg->used_vectors )
     {
         ASSERT(!test_bit(vector, cfg->used_vectors));
@@ -197,7 +197,7 @@
     desc->msi_desc = NULL;
     desc->handler = &no_irq_type;
     desc->arch.used_vectors = NULL;
-    cpus_setall(desc->affinity);
+    cpumask_setall(&desc->affinity);
     spin_unlock_irqrestore(&desc->lock, flags);
 
     /* Wait to make sure it's not being used on another CPU */
@@ -217,7 +217,7 @@
 
     /* Always clear cfg->vector */
     vector = cfg->vector;
-    cpus_and(tmp_mask, cfg->cpu_mask, cpu_online_map);
+    cpumask_and(&tmp_mask, &cfg->cpu_mask, &cpu_online_map);
 
     for_each_cpu_mask(cpu, tmp_mask) {
         ASSERT( per_cpu(vector_irq, cpu)[vector] == irq );
@@ -225,7 +225,7 @@
     }
 
     cfg->vector = IRQ_VECTOR_UNASSIGNED;
-    cpus_clear(cfg->cpu_mask);
+    cpumask_clear(&cfg->cpu_mask);
 
     if ( cfg->used_vectors )
     {
@@ -242,7 +242,7 @@
 
     /* If we were in motion, also clear cfg->old_vector */
     old_vector = cfg->old_vector;
-    cpus_and(tmp_mask, cfg->old_cpu_mask, cpu_online_map);
+    cpumask_and(&tmp_mask, &cfg->old_cpu_mask, &cpu_online_map);
 
     for_each_cpu_mask(cpu, tmp_mask) {
         ASSERT( per_cpu(vector_irq, cpu)[old_vector] == irq );
@@ -251,7 +251,7 @@
      }
 
     cfg->old_vector = IRQ_VECTOR_UNASSIGNED;
-    cpus_clear(cfg->old_cpu_mask);
+    cpumask_clear(&cfg->old_cpu_mask);
 
     if ( cfg->used_vectors )
     {
@@ -303,7 +303,7 @@
     desc->action  = NULL;
     desc->msi_desc = NULL;
     spin_lock_init(&desc->lock);
-    cpus_setall(desc->affinity);
+    cpumask_setall(&desc->affinity);
     INIT_LIST_HEAD(&desc->rl_link);
 }
 
@@ -311,8 +311,8 @@
 {
     cfg->vector = IRQ_VECTOR_UNASSIGNED;
     cfg->old_vector = IRQ_VECTOR_UNASSIGNED;
-    cpus_clear(cfg->cpu_mask);
-    cpus_clear(cfg->old_cpu_mask);
+    cpumask_clear(&cfg->cpu_mask);
+    cpumask_clear(&cfg->old_cpu_mask);
     cfg->used_vectors = NULL;
     cfg->used = IRQ_UNUSED;
 }
@@ -425,8 +425,8 @@
 
     old_vector = irq_to_vector(irq);
     if (old_vector) {
-        cpus_and(tmp_mask, *mask, cpu_online_map);
-        if (cpus_intersects(tmp_mask, cfg->cpu_mask)) {
+        cpumask_and(&tmp_mask, mask, &cpu_online_map);
+        if (cpumask_intersects(&tmp_mask, &cfg->cpu_mask)) {
             cfg->vector = old_vector;
             return 0;
         }
@@ -455,7 +455,8 @@
         if (!cpu_online(cpu))
             continue;
 
-        cpus_and(tmp_mask, *vector_allocation_cpumask(cpu), cpu_online_map);
+        cpumask_and(&tmp_mask, vector_allocation_cpumask(cpu),
+                    &cpu_online_map);
 
         vector = current_vector;
         offset = current_offset;
@@ -485,14 +486,14 @@
         local_irq_save(flags);
         if (old_vector) {
             cfg->move_in_progress = 1;
-            cpus_copy(cfg->old_cpu_mask, cfg->cpu_mask);
+            cpumask_copy(&cfg->old_cpu_mask, &cfg->cpu_mask);
             cfg->old_vector = cfg->vector;
         }
         trace_irq_mask(TRC_HW_IRQ_ASSIGN_VECTOR, irq, vector, &tmp_mask);
         for_each_cpu_mask(new_cpu, tmp_mask)
             per_cpu(vector_irq, new_cpu)[vector] = irq;
         cfg->vector = vector;
-        cpus_copy(cfg->cpu_mask, tmp_mask);
+        cpumask_copy(&cfg->cpu_mask, &tmp_mask);
 
         cfg->used = IRQ_USED;
         ASSERT((cfg->used_vectors == NULL)
@@ -529,7 +530,7 @@
     ret = __assign_irq_vector(irq, cfg, TARGET_CPUS);
     if (!ret) {
         ret = cfg->vector;
-        cpus_copy(desc->affinity, cfg->cpu_mask);
+        cpumask_copy(&desc->affinity, &cfg->cpu_mask);
     }
     spin_unlock_irqrestore(&vector_lock, flags);
     return ret;
@@ -582,7 +583,7 @@
     if (likely(cpus_intersects(desc->pending_mask, cpu_online_map)))
         desc->handler->set_affinity(desc, &desc->pending_mask);
 
-    cpus_clear(desc->pending_mask);
+    cpumask_clear(&desc->pending_mask);
 }
 
 void move_native_irq(struct irq_desc *desc)
@@ -729,7 +730,7 @@
     ASSERT(spin_is_locked(&desc->lock));
     desc->status &= ~IRQ_MOVE_PENDING;
     wmb();
-    cpus_copy(desc->pending_mask, *mask);
+    cpumask_copy(&desc->pending_mask, mask);
     wmb();
     desc->status |= IRQ_MOVE_PENDING;
 }
@@ -1474,7 +1475,6 @@
     struct irq_desc         *desc;
     irq_guest_action_t *action, *newaction = NULL;
     int                 rc = 0;
-    cpumask_t           cpumask = CPU_MASK_NONE;
 
     WARN_ON(!spin_is_locked(&v->domain->event_lock));
     BUG_ON(!local_irq_is_enabled());
@@ -1521,7 +1521,7 @@
         action->in_flight   = 0;
         action->shareable   = will_share;
         action->ack_type    = pirq_acktype(v->domain, pirq->pirq);
-        cpus_clear(action->cpu_eoi_map);
+        cpumask_clear(&action->cpu_eoi_map);
         init_timer(&action->eoi_timer, irq_guest_eoi_timer_fn, desc, 0);
 
         desc->status |= IRQ_GUEST;
@@ -1529,9 +1529,8 @@
         desc->handler->startup(desc);
 
         /* Attempt to bind the interrupt target to the correct CPU. */
-        cpu_set(v->processor, cpumask);
         if ( !opt_noirqbalance && (desc->handler->set_affinity != NULL) )
-            desc->handler->set_affinity(desc, &cpumask);
+            desc->handler->set_affinity(desc, cpumask_of(v->processor));
     }
     else if ( !will_share || !action->shareable )
     {
@@ -2070,18 +2069,18 @@
 
         spin_lock(&desc->lock);
 
-        affinity = desc->affinity;
-        if ( !desc->action || cpus_subset(affinity, cpu_online_map) )
+        cpumask_copy(&affinity, &desc->affinity);
+        if ( !desc->action || cpumask_subset(&affinity, &cpu_online_map) )
         {
             spin_unlock(&desc->lock);
             continue;
         }
 
-        cpus_and(affinity, affinity, cpu_online_map);
-        if ( cpus_empty(affinity) )
+        cpumask_and(&affinity, &affinity, &cpu_online_map);
+        if ( cpumask_empty(&affinity) )
         {
             break_affinity = 1;
-            affinity = cpu_online_map;
+            cpumask_copy(&affinity, &cpu_online_map);
         }
 
         if ( desc->handler->disable )
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/arch/x86/mm.c	Fri Oct 21 09:19:44 2011 +0200
@@ -1339,8 +1339,10 @@
 
     if ( unlikely(shadow_mode_enabled(d)) )
     {
-        cpumask_t m = CPU_MASK_NONE;
+        cpumask_t m;
+
         /* Re-shadow this l3 table on any vcpus that are using it */
+        cpumask_clear(&m);
         for_each_vcpu ( d, v )
             if ( pagetable_get_pfn(v->arch.guest_table) == mfn )
             {
@@ -2887,7 +2889,7 @@
     struct vcpu *v;
     bool_t is_native = !is_pv_32on64_domain(d);
 
-    cpus_clear(*pmask);
+    cpumask_clear(pmask);
     for ( vmask = 0, offs = 0; ; ++offs)
     {
         vcpu_bias = offs * (is_native ? BITS_PER_LONG : 32);
@@ -2899,7 +2901,7 @@
                       copy_from_guest_offset((unsigned int *)&vmask, bmap,
                                              offs, 1)) )
         {
-            cpus_clear(*pmask);
+            cpumask_clear(pmask);
             return -EFAULT;
         }
 
@@ -3194,12 +3196,13 @@
             else if ( likely(cache_flush_permitted(d)) )
             {
                 unsigned int cpu;
-                cpumask_t mask = CPU_MASK_NONE;
-
+                cpumask_t mask;
+
+                cpumask_clear(&mask);
                 for_each_online_cpu(cpu)
-                    if ( !cpus_intersects(mask,
-                                          per_cpu(cpu_sibling_map, cpu)) )
-                        cpu_set(cpu, mask);
+                    if ( !cpumask_intersects(&mask,
+                                             &per_cpu(cpu_sibling_map, cpu)) )
+                        cpumask_set_cpu(cpu, &mask);
                 flush_mask(&mask, FLUSH_CACHE);
             }
             else
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/arch/x86/mm/p2m.c	Fri Oct 21 09:19:44 2011 +0200
@@ -81,7 +81,7 @@
     p2m->default_access = p2m_access_rwx;
 
     p2m->cr3 = CR3_EADDR;
-    cpus_clear(p2m->p2m_dirty_cpumask);
+    cpumask_clear(&p2m->p2m_dirty_cpumask);
 
     if ( hap_enabled(d) && (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) )
         ept_p2m_init(p2m);
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/arch/x86/mm/shadow/common.c
--- a/xen/arch/x86/mm/shadow/common.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/arch/x86/mm/shadow/common.c	Fri Oct 21 09:19:44 2011 +0200
@@ -3459,7 +3459,7 @@
         p2m_type_t p2mt = p2m_flags_to_type(l1e_get_flags(*p));
         if ( p2m_is_valid(p2mt) && mfn_valid(omfn) )
         {
-            cpus_clear(flushmask);
+            cpumask_clear(&flushmask);
 
             /* If we're replacing a superpage with a normal L1 page, map it */
             if ( (l1e_get_flags(new) & _PAGE_PRESENT)
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/arch/x86/smp.c
--- a/xen/arch/x86/smp.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/arch/x86/smp.c	Fri Oct 21 09:19:44 2011 +0200
@@ -240,12 +240,12 @@
     if ( !cpus_subset(*mask, *cpumask_of(smp_processor_id())) )
     {
         spin_lock(&flush_lock);
-        cpus_and(flush_cpumask, *mask, cpu_online_map);
-        cpu_clear(smp_processor_id(), flush_cpumask);
+        cpumask_and(&flush_cpumask, mask, &cpu_online_map);
+        cpumask_clear_cpu(smp_processor_id(), &flush_cpumask);
         flush_va      = va;
         flush_flags   = flags;
         send_IPI_mask(&flush_cpumask, INVALIDATE_TLB_VECTOR);
-        while ( !cpus_empty(flush_cpumask) )
+        while ( !cpumask_empty(&flush_cpumask) )
             cpu_relax();
         spin_unlock(&flush_lock);
     }
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/arch/x86/smpboot.c	Fri Oct 21 09:19:44 2011 +0200
@@ -533,8 +533,9 @@
 {
     cpumask_t tmp_map;
     int cpu;
-    cpus_complement(tmp_map, cpu_present_map);
-    cpu = first_cpu(tmp_map);
+
+    cpumask_complement(&tmp_map, &cpu_present_map);
+    cpu = cpumask_first(&tmp_map);
     return (cpu < nr_cpu_ids) ? cpu : -ENODEV;
 }
 
@@ -818,18 +819,18 @@
     {
         cpu_clear(cpu, per_cpu(cpu_core_map, sibling));
         /* Last thread sibling in this cpu core going down. */
-        if ( cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1 )
+        if ( cpumask_weight(&per_cpu(cpu_sibling_map, cpu)) == 1 )
             c[sibling].booted_cores--;
     }
    
     for_each_cpu_mask(sibling, per_cpu(cpu_sibling_map, cpu))
-        cpu_clear(cpu, per_cpu(cpu_sibling_map, sibling));
-    cpus_clear(per_cpu(cpu_sibling_map, cpu));
-    cpus_clear(per_cpu(cpu_core_map, cpu));
+        cpumask_clear_cpu(cpu, &per_cpu(cpu_sibling_map, sibling));
+    cpumask_clear(&per_cpu(cpu_sibling_map, cpu));
+    cpumask_clear(&per_cpu(cpu_core_map, cpu));
     c[cpu].phys_proc_id = BAD_APICID;
     c[cpu].cpu_core_id = BAD_APICID;
     c[cpu].compute_unit_id = BAD_APICID;
-    cpu_clear(cpu, cpu_sibling_setup_map);
+    cpumask_clear_cpu(cpu, &cpu_sibling_setup_map);
 }
 
 void __cpu_disable(void)
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/arch/x86/time.c	Fri Oct 21 09:19:44 2011 +0200
@@ -185,15 +185,15 @@
     int cpu = smp_processor_id();
     cpumask_t mask;
 
-    cpus_and(mask, cpu_online_map, pit_broadcast_mask);
+    cpumask_and(&mask, &cpu_online_map, &pit_broadcast_mask);
 
-    if ( cpu_isset(cpu, mask) )
+    if ( cpumask_test_cpu(cpu, &mask) )
     {
-        cpu_clear(cpu, mask);
+        cpumask_clear_cpu(cpu, &mask);
         raise_softirq(TIMER_SOFTIRQ);
     }
 
-    if ( !cpus_empty(mask) )
+    if ( !cpumask_empty(&mask) )
     {
         cpumask_raise_softirq(&mask, TIMER_SOFTIRQ);
     }
@@ -1226,7 +1226,7 @@
 }
 
 static unsigned long tsc_max_warp, tsc_check_count;
-static cpumask_t tsc_check_cpumask = CPU_MASK_NONE;
+static cpumask_t tsc_check_cpumask;
 
 static void tsc_check_slave(void *unused)
 {
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/common/cpu.c
--- a/xen/common/cpu.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/common/cpu.c	Fri Oct 21 09:19:44 2011 +0200
@@ -176,7 +176,7 @@
 
     BUG_ON(smp_processor_id() != 0);
 
-    cpus_clear(frozen_cpus);
+    cpumask_clear(&frozen_cpus);
 
     printk("Disabling non-boot CPUs ...\n");
 
@@ -192,7 +192,7 @@
             break;
         }
 
-        cpu_set(cpu, frozen_cpus);
+        cpumask_set_cpu(cpu, &frozen_cpus);
     }
 
     BUG_ON(!error && (num_online_cpus() != 1));
@@ -214,5 +214,5 @@
         }
     }
 
-    cpus_clear(frozen_cpus);
+    cpumask_clear(&frozen_cpus);
 }
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/common/cpupool.c
--- a/xen/common/cpupool.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/common/cpupool.c	Fri Oct 21 09:19:44 2011 +0200
@@ -29,7 +29,7 @@
 
 static int cpupool_moving_cpu = -1;
 static struct cpupool *cpupool_cpu_moving = NULL;
-static cpumask_t cpupool_locked_cpus = CPU_MASK_NONE;
+static cpumask_t cpupool_locked_cpus;
 
 static DEFINE_SPINLOCK(cpupool_lock);
 
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/common/domain.c
--- a/xen/common/domain.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/common/domain.c	Fri Oct 21 09:19:44 2011 +0200
@@ -359,11 +359,12 @@
 
 void domain_update_node_affinity(struct domain *d)
 {
-    cpumask_t cpumask = CPU_MASK_NONE;
+    cpumask_t cpumask;
     nodemask_t nodemask = NODE_MASK_NONE;
     struct vcpu *v;
     unsigned int node;
 
+    cpumask_clear(&cpumask);
     spin_lock(&d->node_affinity_lock);
 
     for_each_vcpu ( d, v )
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/common/domctl.c
--- a/xen/common/domctl.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/common/domctl.c	Fri Oct 21 09:19:44 2011 +0200
@@ -37,9 +37,9 @@
     uint8_t bytemap[(NR_CPUS + 7) / 8];
 
     guest_bytes = (xenctl_cpumap->nr_cpus + 7) / 8;
-    copy_bytes  = min_t(unsigned int, guest_bytes, sizeof(bytemap));
+    copy_bytes  = min_t(unsigned int, guest_bytes, (nr_cpu_ids + 7) / 8);
 
-    bitmap_long_to_byte(bytemap, cpus_addr(*cpumask), NR_CPUS);
+    bitmap_long_to_byte(bytemap, cpumask_bits(cpumask), nr_cpu_ids);
 
     if ( copy_bytes != 0 )
         if ( copy_to_guest(xenctl_cpumap->bitmap, bytemap, copy_bytes) )
@@ -59,7 +59,7 @@
     uint8_t bytemap[(NR_CPUS + 7) / 8];
 
     guest_bytes = (xenctl_cpumap->nr_cpus + 7) / 8;
-    copy_bytes  = min_t(unsigned int, guest_bytes, sizeof(bytemap));
+    copy_bytes  = min_t(unsigned int, guest_bytes, (nr_cpu_ids + 7) / 8);
 
     memset(bytemap, 0, sizeof(bytemap));
 
@@ -71,7 +71,7 @@
             bytemap[guest_bytes-1] &= ~(0xff << (xenctl_cpumap->nr_cpus & 7));
     }
 
-    bitmap_byte_to_long(cpus_addr(*cpumask), bytemap, NR_CPUS);
+    bitmap_byte_to_long(cpumask_bits(cpumask), bytemap, nr_cpu_ids);
 
     return 0;
 }
@@ -154,7 +154,7 @@
     cpumask_t      cpu_exclude_map;
 
     /* Do an initial CPU placement. Pick the least-populated CPU. */
-    nr_cpus = last_cpu(cpu_online_map) + 1;
+    nr_cpus = cpumask_last(&cpu_online_map) + 1;
     cnt = xzalloc_array(unsigned int, nr_cpus);
     if ( cnt )
     {
@@ -171,18 +171,19 @@
      * If we're on a HT system, we only auto-allocate to a non-primary HT. We 
      * favour high numbered CPUs in the event of a tie.
      */
-    cpu = first_cpu(per_cpu(cpu_sibling_map, 0));
-    if ( cpus_weight(per_cpu(cpu_sibling_map, 0)) > 1 )
-        cpu = next_cpu(cpu, per_cpu(cpu_sibling_map, 0));
-    cpu_exclude_map = per_cpu(cpu_sibling_map, 0);
+    cpumask_copy(&cpu_exclude_map, &per_cpu(cpu_sibling_map, 0));
+    cpu = cpumask_first(&cpu_exclude_map);
+    if ( cpumask_weight(&cpu_exclude_map) > 1 )
+        cpu = cpumask_next(cpu, &cpu_exclude_map);
     for_each_cpu_mask(i, *online)
     {
-        if ( cpu_isset(i, cpu_exclude_map) )
+        if ( cpumask_test_cpu(i, &cpu_exclude_map) )
             continue;
-        if ( (i == first_cpu(per_cpu(cpu_sibling_map, i))) &&
-             (cpus_weight(per_cpu(cpu_sibling_map, i)) > 1) )
+        if ( (i == cpumask_first(&per_cpu(cpu_sibling_map, i))) &&
+             (cpumask_weight(&per_cpu(cpu_sibling_map, i)) > 1) )
             continue;
-        cpus_or(cpu_exclude_map, cpu_exclude_map, per_cpu(cpu_sibling_map, i));
+        cpumask_or(&cpu_exclude_map, &cpu_exclude_map,
+                   &per_cpu(cpu_sibling_map, i));
         if ( !cnt || cnt[i] <= cnt[cpu] )
             cpu = i;
     }
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/common/keyhandler.c
--- a/xen/common/keyhandler.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/common/keyhandler.c	Fri Oct 21 09:19:44 2011 +0200
@@ -316,7 +316,7 @@
     .desc = "dump domain (and guest debug) info"
 };
 
-static cpumask_t read_clocks_cpumask = CPU_MASK_NONE;
+static cpumask_t read_clocks_cpumask;
 static DEFINE_PER_CPU(s_time_t, read_clocks_time);
 static DEFINE_PER_CPU(u64, read_cycles_time);
 
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/common/page_alloc.c
--- a/xen/common/page_alloc.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/common/page_alloc.c	Fri Oct 21 09:19:44 2011 +0200
@@ -304,7 +304,7 @@
     unsigned int first_node, i, j, zone = 0, nodemask_retry = 0;
     unsigned int node = (uint8_t)((memflags >> _MEMF_node) - 1);
     unsigned long request = 1UL << order;
-    cpumask_t extra_cpus_mask, mask;
+    cpumask_t mask;
     struct page_info *pg;
     nodemask_t nodemask = (d != NULL ) ? d->node_affinity : node_online_map;
 
@@ -418,7 +418,7 @@
     if ( d != NULL )
         d->last_alloc_node = node;
 
-    cpus_clear(mask);
+    cpumask_clear(&mask);
 
     for ( i = 0; i < (1 << order); i++ )
     {
@@ -429,9 +429,11 @@
         if ( pg[i].u.free.need_tlbflush )
         {
             /* Add in extra CPUs that need flushing because of this page. */
-            cpus_andnot(extra_cpus_mask, cpu_online_map, mask);
+            static cpumask_t extra_cpus_mask;
+
+            cpumask_andnot(&extra_cpus_mask, &cpu_online_map, &mask);
             tlbflush_filter(extra_cpus_mask, pg[i].tlbflush_timestamp);
-            cpus_or(mask, mask, extra_cpus_mask);
+            cpumask_or(&mask, &mask, &extra_cpus_mask);
         }
 
         /* Initialise fields which have other uses for free pages. */
@@ -441,7 +443,7 @@
 
     spin_unlock(&heap_lock);
 
-    if ( unlikely(!cpus_empty(mask)) )
+    if ( unlikely(!cpumask_empty(&mask)) )
     {
         perfc_incr(need_flush_tlb_flush);
         flush_tlb_mask(&mask);
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/common/rcupdate.c
--- a/xen/common/rcupdate.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/common/rcupdate.c	Fri Oct 21 09:19:44 2011 +0200
@@ -59,7 +59,6 @@
     .cur = -300,
     .completed = -300,
     .lock = SPIN_LOCK_UNLOCKED,
-    .cpumask = CPU_MASK_NONE,
 };
 
 /*
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/common/sched_credit.c
--- a/xen/common/sched_credit.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/common/sched_credit.c	Fri Oct 21 09:19:44 2011 +0200
@@ -260,7 +260,7 @@
     cpumask_t mask;
 
     ASSERT(cur);
-    cpus_clear(mask);
+    cpumask_clear(&mask);
 
     /* If strictly higher priority than current VCPU, signal the CPU */
     if ( new->pri > cur->pri )
@@ -274,7 +274,7 @@
         else
             CSCHED_STAT_CRANK(tickle_local_other);
 
-        cpu_set(cpu, mask);
+        cpumask_set_cpu(cpu, &mask);
     }
 
     /*
@@ -283,7 +283,7 @@
      */
     if ( cur->pri > CSCHED_PRI_IDLE )
     {
-        if ( cpus_empty(prv->idlers) )
+        if ( cpumask_empty(&prv->idlers) )
         {
             CSCHED_STAT_CRANK(tickle_idlers_none);
         }
@@ -292,24 +292,24 @@
             cpumask_t idle_mask;
 
             cpumask_and(&idle_mask, &prv->idlers, new->vcpu->cpu_affinity);
-            if ( !cpus_empty(idle_mask) )
+            if ( !cpumask_empty(&idle_mask) )
             {
                 CSCHED_STAT_CRANK(tickle_idlers_some);
                 if ( opt_tickle_one_idle )
                 {
                     this_cpu(last_tickle_cpu) = 
-                        cycle_cpu(this_cpu(last_tickle_cpu), idle_mask);
-                    cpu_set(this_cpu(last_tickle_cpu), mask);
+                        cpumask_cycle(this_cpu(last_tickle_cpu), &idle_mask);
+                    cpumask_set_cpu(this_cpu(last_tickle_cpu), &mask);
                 }
                 else
-                    cpus_or(mask, mask, idle_mask);
+                    cpumask_or(&mask, &mask, &idle_mask);
             }
             cpumask_and(&mask, &mask, new->vcpu->cpu_affinity);
         }
     }
 
     /* Send scheduler interrupts to designated CPUs */
-    if ( !cpus_empty(mask) )
+    if ( !cpumask_empty(&mask) )
         cpumask_raise_softirq(&mask, SCHEDULE_SOFTIRQ);
 }
 
@@ -471,10 +471,10 @@
      */
     online = CSCHED_CPUONLINE(vc->domain->cpupool);
     cpumask_and(&cpus, online, vc->cpu_affinity);
-    cpu = cpu_isset(vc->processor, cpus)
+    cpu = cpumask_test_cpu(vc->processor, &cpus)
             ? vc->processor
-            : cycle_cpu(vc->processor, cpus);
-    ASSERT( !cpus_empty(cpus) && cpu_isset(cpu, cpus) );
+            : cpumask_cycle(vc->processor, &cpus);
+    ASSERT( !cpumask_empty(&cpus) && cpumask_test_cpu(cpu, &cpus) );
 
     /*
      * Try to find an idle processor within the above constraints.
@@ -488,54 +488,54 @@
      * like run two VCPUs on co-hyperthreads while there are idle cores
      * or sockets.
      */
-    cpus_and(idlers, cpu_online_map, CSCHED_PRIV(ops)->idlers);
-    cpu_set(cpu, idlers);
-    cpus_and(cpus, cpus, idlers);
-    cpu_clear(cpu, cpus);
+    cpumask_and(&idlers, &cpu_online_map, &CSCHED_PRIV(ops)->idlers);
+    cpumask_set_cpu(cpu, &idlers);
+    cpumask_and(&cpus, &cpus, &idlers);
+    cpumask_clear_cpu(cpu, &cpus);
 
-    while ( !cpus_empty(cpus) )
+    while ( !cpumask_empty(&cpus) )
     {
         cpumask_t cpu_idlers;
         cpumask_t nxt_idlers;
         int nxt, weight_cpu, weight_nxt;
         int migrate_factor;
 
-        nxt = cycle_cpu(cpu, cpus);
+        nxt = cpumask_cycle(cpu, &cpus);
 
-        if ( cpu_isset(cpu, per_cpu(cpu_core_map, nxt)) )
+        if ( cpumask_test_cpu(cpu, &per_cpu(cpu_core_map, nxt)) )
         {
             /* We're on the same socket, so check the busy-ness of threads.
              * Migrate if # of idlers is less at all */
-            ASSERT( cpu_isset(nxt, per_cpu(cpu_core_map, cpu)) );
+            ASSERT( cpumask_test_cpu(nxt, &per_cpu(cpu_core_map, cpu)) );
             migrate_factor = 1;
-            cpus_and(cpu_idlers, idlers, per_cpu(cpu_sibling_map, cpu));
-            cpus_and(nxt_idlers, idlers, per_cpu(cpu_sibling_map, nxt));
+            cpumask_and(&cpu_idlers, &idlers, &per_cpu(cpu_sibling_map, cpu));
+            cpumask_and(&nxt_idlers, &idlers, &per_cpu(cpu_sibling_map, nxt));
         }
         else
         {
             /* We're on different sockets, so check the busy-ness of cores.
              * Migrate only if the other core is twice as idle */
-            ASSERT( !cpu_isset(nxt, per_cpu(cpu_core_map, cpu)) );
+            ASSERT( !cpumask_test_cpu(nxt, &per_cpu(cpu_core_map, cpu)) );
             migrate_factor = 2;
-            cpus_and(cpu_idlers, idlers, per_cpu(cpu_core_map, cpu));
-            cpus_and(nxt_idlers, idlers, per_cpu(cpu_core_map, nxt));
+            cpumask_and(&cpu_idlers, &idlers, &per_cpu(cpu_core_map, cpu));
+            cpumask_and(&nxt_idlers, &idlers, &per_cpu(cpu_core_map, nxt));
         }
 
-        weight_cpu = cpus_weight(cpu_idlers);
-        weight_nxt = cpus_weight(nxt_idlers);
+        weight_cpu = cpumask_weight(&cpu_idlers);
+        weight_nxt = cpumask_weight(&nxt_idlers);
         /* smt_power_savings: consolidate work rather than spreading it */
         if ( sched_smt_power_savings ?
              weight_cpu > weight_nxt :
              weight_cpu * migrate_factor < weight_nxt )
         {
-            cpus_and(nxt_idlers, cpus, nxt_idlers);
+            cpumask_and(&nxt_idlers, &cpus, &nxt_idlers);
             spc = CSCHED_PCPU(nxt);
-            cpu = cycle_cpu(spc->idle_bias, nxt_idlers);
-            cpus_andnot(cpus, cpus, per_cpu(cpu_sibling_map, cpu));
+            cpu = cpumask_cycle(spc->idle_bias, &nxt_idlers);
+            cpumask_andnot(&cpus, &cpus, &per_cpu(cpu_sibling_map, cpu));
         }
         else
         {
-            cpus_andnot(cpus, cpus, nxt_idlers);
+            cpumask_andnot(&cpus, &cpus, &nxt_idlers);
         }
     }
 
@@ -1228,7 +1228,7 @@
     online = CSCHED_CPUONLINE(per_cpu(cpupool, cpu));
 
     /* If this CPU is going offline we shouldn't steal work. */
-    if ( unlikely(!cpu_isset(cpu, *online)) )
+    if ( unlikely(!cpumask_test_cpu(cpu, online)) )
         goto out;
 
     if ( snext->pri == CSCHED_PRI_IDLE )
@@ -1242,14 +1242,14 @@
      * Peek at non-idling CPUs in the system, starting with our
      * immediate neighbour.
      */
-    cpus_andnot(workers, *online, prv->idlers);
-    cpu_clear(cpu, workers);
+    cpumask_andnot(&workers, online, &prv->idlers);
+    cpumask_clear_cpu(cpu, &workers);
     peer_cpu = cpu;
 
     while ( !cpus_empty(workers) )
     {
-        peer_cpu = cycle_cpu(peer_cpu, workers);
-        cpu_clear(peer_cpu, workers);
+        peer_cpu = cpumask_cycle(peer_cpu, &workers);
+        cpumask_clear_cpu(peer_cpu, &workers);
 
         /*
          * Get ahold of the scheduler lock for this peer CPU.
@@ -1267,7 +1267,7 @@
         /*
          * Any work over there to steal?
          */
-        speer = cpu_isset(peer_cpu, *online) ?
+        speer = cpumask_test_cpu(peer_cpu, online) ?
             csched_runq_steal(peer_cpu, cpu, snext->pri) : NULL;
         pcpu_schedule_unlock(peer_cpu);
         if ( speer != NULL )
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/common/sched_credit2.c
--- a/xen/common/sched_credit2.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/common/sched_credit2.c	Fri Oct 21 09:19:44 2011 +0200
@@ -507,19 +507,19 @@
     }
     
     /* Get a mask of idle, but not tickled */
-    cpus_andnot(mask, rqd->idle, rqd->tickled);
+    cpumask_andnot(&mask, &rqd->idle, &rqd->tickled);
     
     /* If it's not empty, choose one */
-    if ( !cpus_empty(mask) )
+    if ( !cpumask_empty(&mask) )
     {
-        ipid=first_cpu(mask);
+        ipid = cpumask_first(&mask);
         goto tickle;
     }
 
     /* Otherwise, look for the non-idle cpu with the lowest credit,
      * skipping cpus which have been tickled but not scheduled yet */
-    cpus_andnot(mask, rqd->active, rqd->idle);
-    cpus_andnot(mask, mask, rqd->tickled);
+    cpumask_andnot(&mask, &rqd->active, &rqd->idle);
+    cpumask_andnot(&mask, &mask, &rqd->tickled);
 
     for_each_cpu_mask(i, mask)
     {
@@ -573,7 +573,7 @@
                   sizeof(d),
                   (unsigned char *)&d);
     }
-    cpu_set(ipid, rqd->tickled);
+    cpumask_set_cpu(ipid, &rqd->tickled);
     cpu_raise_softirq(ipid, SCHEDULE_SOFTIRQ);
 
 no_tickle:
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/common/schedule.c
--- a/xen/common/schedule.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/common/schedule.c	Fri Oct 21 09:19:44 2011 +0200
@@ -595,8 +595,8 @@
     if ( v->domain->is_pinned )
         return -EINVAL;
     online = VCPU2ONLINE(v);
-    cpus_and(online_affinity, *affinity, *online);
-    if ( cpus_empty(online_affinity) )
+    cpumask_and(&online_affinity, affinity, online);
+    if ( cpumask_empty(&online_affinity) )
         return -EINVAL;
 
     vcpu_schedule_lock_irq(v);
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/common/softirq.c
--- a/xen/common/softirq.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/common/softirq.c	Fri Oct 21 09:19:44 2011 +0200
@@ -71,11 +71,12 @@
 void cpumask_raise_softirq(const cpumask_t *mask, unsigned int nr)
 {
     int cpu;
-    cpumask_t send_mask = CPU_MASK_NONE;
+    cpumask_t send_mask;
 
+    cpumask_clear(&send_mask);
     for_each_cpu_mask(cpu, *mask)
         if ( !test_and_set_bit(nr, &softirq_pending(cpu)) )
-            cpu_set(cpu, send_mask);
+            cpumask_set_cpu(cpu, &send_mask);
 
     smp_send_event_check_mask(&send_mask);
 }
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/common/trace.c
--- a/xen/common/trace.c	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/common/trace.c	Fri Oct 21 09:19:44 2011 +0200
@@ -70,7 +70,7 @@
 int tb_init_done __read_mostly;
 
 /* which CPUs tracing is enabled on */
-static cpumask_t tb_cpu_mask = CPU_MASK_ALL;
+static cpumask_t tb_cpu_mask;
 
 /* which tracing events are enabled */
 static u32 tb_event_mask = TRC_ALL;
@@ -338,6 +338,7 @@
  */
 void __init init_trace_bufs(void)
 {
+    cpumask_setall(&tb_cpu_mask);
     register_cpu_notifier(&cpu_nfb);
 
     if ( opt_tbuf_size )
diff -r 511d5e65a302 -r 1a4223c62ee7 xen/include/xen/cpumask.h
--- a/xen/include/xen/cpumask.h	Fri Oct 21 09:17:42 2011 +0200
+++ b/xen/include/xen/cpumask.h	Fri Oct 21 09:19:44 2011 +0200
@@ -13,18 +13,18 @@
  *
  * The available cpumask operations are:
  *
- * void cpu_set(cpu, mask)		turn on bit 'cpu' in mask
- * void cpu_clear(cpu, mask)		turn off bit 'cpu' in mask
- * void cpus_setall(mask)		set all bits
- * void cpus_clear(mask)		clear all bits
- * int cpu_isset(cpu, mask)		true iff bit 'cpu' set in mask
- * int cpu_test_and_set(cpu, mask)	test and set bit 'cpu' in mask
+ * void cpumask_set_cpu(cpu, mask)	turn on bit 'cpu' in mask
+ * void cpumask_clear_cpu(cpu, mask)	turn off bit 'cpu' in mask
+ * void cpumask_setall(mask)		set all bits
+ * void cpumask_clear(mask)		clear all bits
+ * int cpumask_test_cpu(cpu, mask)	true iff bit 'cpu' set in mask
+ * int cpumask_test_and_set_cpu(cpu, mask) test and set bit 'cpu' in mask
  *
- * void cpus_and(dst, src1, src2)	dst = src1 & src2  [intersection]
- * void cpus_or(dst, src1, src2)	dst = src1 | src2  [union]
- * void cpus_xor(dst, src1, src2)	dst = src1 ^ src2
- * void cpus_andnot(dst, src1, src2)	dst = src1 & ~src2
- * void cpus_complement(dst, src)	dst = ~src
+ * void cpumask_and(dst, src1, src2)	dst = src1 & src2  [intersection]
+ * void cpumask_or(dst, src1, src2)	dst = src1 | src2  [union]
+ * void cpumask_xor(dst, src1, src2)	dst = src1 ^ src2
+ * void cpumask_andnot(dst, src1, src2)	dst = src1 & ~src2
+ * void cpumask_complement(dst, src)	dst = ~src
  *
  * int cpus_equal(mask1, mask2)		Does mask1 == mask2?
  * int cpus_intersects(mask1, mask2)	Do mask1 and mask2 intersect?
@@ -33,8 +33,8 @@
  * int cpus_full(mask)			Is mask full (all bits sets)?
  * int cpus_weight(mask)		Hamming weigh - number of set bits
  *
- * void cpus_shift_right(dst, src, n)	Shift right
- * void cpus_shift_left(dst, src, n)	Shift left
+ * void cpumask_shift_right(dst, src, n) Shift right
+ * void cpumask_shift_left(dst, src, n)	Shift left
  *
  * int first_cpu(mask)			Number lowest set bit, or NR_CPUS
  * int next_cpu(cpu, mask)		Next cpu past 'cpu', or NR_CPUS
@@ -110,18 +110,14 @@
 	clear_bit(cpumask_check(cpu), dstp->bits);
 }
 
-#define cpumask_setall(dst) __cpus_setall(dst, nr_cpumask_bits)
-#define cpus_setall(dst) __cpus_setall(&(dst), NR_CPUS)
-static inline void __cpus_setall(cpumask_t *dstp, int nbits)
+static inline void cpumask_setall(cpumask_t *dstp)
 {
-	bitmap_fill(dstp->bits, nbits);
+	bitmap_fill(dstp->bits, nr_cpumask_bits);
 }
 
-#define cpumask_clear(dst) __cpus_clear(dst, nr_cpumask_bits)
-#define cpus_clear(dst) __cpus_clear(&(dst), NR_CPUS)
-static inline void __cpus_clear(cpumask_t *dstp, int nbits)
+static inline void cpumask_clear(cpumask_t *dstp)
 {
-	bitmap_zero(dstp->bits, nbits);
+	bitmap_zero(dstp->bits, nr_cpumask_bits);
 }
 
 /* No static inline type checking - see Subtlety (1) above. */
@@ -143,50 +139,33 @@
 	return test_and_clear_bit(cpumask_check(cpu), addr->bits);
 }
 
-#define cpumask_and(dst, src1, src2) \
-	__cpus_and(dst, src1, src2, nr_cpumask_bits)
-#define cpus_and(dst, src1, src2) __cpus_and(&(dst), &(src1), &(src2), NR_CPUS)
-static inline void __cpus_and(cpumask_t *dstp, const cpumask_t *src1p,
-					const cpumask_t *src2p, int nbits)
+static inline void cpumask_and(cpumask_t *dstp, const cpumask_t *src1p,
+			       const cpumask_t *src2p)
 {
-	bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits);
+	bitmap_and(dstp->bits, src1p->bits, src2p->bits, nr_cpumask_bits);
 }
 
-#define cpumask_or(dst, src1, src2) \
-	__cpus_or(dst, src1, src2, nr_cpumask_bits)
-#define cpus_or(dst, src1, src2) __cpus_or(&(dst), &(src1), &(src2), NR_CPUS)
-static inline void __cpus_or(cpumask_t *dstp, const cpumask_t *src1p,
-					const cpumask_t *src2p, int nbits)
+static inline void cpumask_or(cpumask_t *dstp, const cpumask_t *src1p,
+			      const cpumask_t *src2p)
 {
-	bitmap_or(dstp->bits, src1p->bits, src2p->bits, nbits);
+	bitmap_or(dstp->bits, src1p->bits, src2p->bits, nr_cpumask_bits);
 }
 
-#define cpumask_xor(dst, src1, src2) \
-	__cpus_xor(dst, src1, src2, nr_cpumask_bits)
-#define cpus_xor(dst, src1, src2) __cpus_xor(&(dst), &(src1), &(src2), NR_CPUS)
-static inline void __cpus_xor(cpumask_t *dstp, const cpumask_t *src1p,
-					const cpumask_t *src2p, int nbits)
+static inline void cpumask_xor(cpumask_t *dstp, const cpumask_t *src1p,
+			       const cpumask_t *src2p)
 {
-	bitmap_xor(dstp->bits, src1p->bits, src2p->bits, nbits);
+	bitmap_xor(dstp->bits, src1p->bits, src2p->bits, nr_cpumask_bits);
 }
 
-#define cpumask_andnot(dst, src1, src2) \
-	__cpus_andnot(dst, src1, src2, nr_cpumask_bits)
-#define cpus_andnot(dst, src1, src2) \
-				__cpus_andnot(&(dst), &(src1), &(src2), NR_CPUS)
-static inline void __cpus_andnot(cpumask_t *dstp, const cpumask_t *src1p,
-					const cpumask_t *src2p, int nbits)
+static inline void cpumask_andnot(cpumask_t *dstp, const cpumask_t *src1p,
+				  const cpumask_t *src2p)
 {
-	bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits);
+	bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nr_cpumask_bits);
 }
 
-#define cpumask_complement(dst, src) \
-	__cpus_complement(dst, src, nr_cpumask_bits)
-#define cpus_complement(dst, src) __cpus_complement(&(dst), &(src), NR_CPUS)
-static inline void __cpus_complement(cpumask_t *dstp,
-					const cpumask_t *srcp, int nbits)
+static inline void cpumask_complement(cpumask_t *dstp, const cpumask_t *srcp)
 {
-	bitmap_complement(dstp->bits, srcp->bits, nbits);
+	bitmap_complement(dstp->bits, srcp->bits, nr_cpumask_bits);
 }
 
 #define cpumask_equal(src1, src2) __cpus_equal(src1, src2, nr_cpu_ids)
@@ -236,31 +215,21 @@
 	return bitmap_weight(srcp->bits, nbits);
 }
 
-#define cpumask_copy(dest, src) __cpus_copy(dest, src, nr_cpumask_bits)
-#define cpus_copy(dest, src) __cpus_copy(&(dest), &(src), NR_CPUS)
-static inline void __cpus_copy(cpumask_t *dstp, const cpumask_t *srcp, int nbits)
+static inline void cpumask_copy(cpumask_t *dstp, const cpumask_t *srcp)
 {
-	bitmap_copy(dstp->bits, srcp->bits, nbits);
+	bitmap_copy(dstp->bits, srcp->bits, nr_cpumask_bits);
 }
 
-#define cpumask_shift_right(dst, src, n) \
-	__cpus_shift_right(dst, src, n, nr_cpumask_bits)
-#define cpus_shift_right(dst, src, n) \
-			__cpus_shift_right(&(dst), &(src), (n), NR_CPUS)
-static inline void __cpus_shift_right(cpumask_t *dstp,
-					const cpumask_t *srcp, int n, int nbits)
+static inline void cpumask_shift_right(cpumask_t *dstp,
+				       const cpumask_t *srcp, int n)
 {
-	bitmap_shift_right(dstp->bits, srcp->bits, n, nbits);
+	bitmap_shift_right(dstp->bits, srcp->bits, n, nr_cpumask_bits);
 }
 
-#define cpumask_shift_left(dst, src, n) \
-	__cpus_shift_left(dst, src, n, nr_cpumask_bits)
-#define cpus_shift_left(dst, src, n) \
-			__cpus_shift_left(&(dst), &(src), (n), NR_CPUS)
-static inline void __cpus_shift_left(cpumask_t *dstp,
-					const cpumask_t *srcp, int n, int nbits)
+static inline void cpumask_shift_left(cpumask_t *dstp,
+				      const cpumask_t *srcp, int n)
 {
-	bitmap_shift_left(dstp->bits, srcp->bits, n, nbits);
+	bitmap_shift_left(dstp->bits, srcp->bits, n, nr_cpumask_bits);
 }
 
 #define cpumask_first(src) __first_cpu(src, nr_cpu_ids)
@@ -317,6 +286,7 @@
 
 #define cpumask_of_cpu(cpu) (*cpumask_of(cpu))
 
+#if defined(__ia64__) /* XXX needs cleanup */
 #define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS)
 
 #if NR_CPUS <= BITS_PER_LONG
@@ -345,8 +315,10 @@
 /*(cpumask_t)*/ { {							\
 	[0] =  1UL							\
 } }
+#endif /* __ia64__ */
 
 #define cpus_addr(src) ((src).bits)
+#define cpumask_bits(maskp) ((maskp)->bits)
 
 #define cpumask_scnprintf(buf, len, src) \
 	__cpumask_scnprintf((buf), (len), &(src), nr_cpu_ids)
@@ -388,9 +360,8 @@
 static inline bool_t alloc_cpumask_var(cpumask_var_t *mask)
 {
 	/*
-	 * Once all direct cpumask assignments and all cpus_*() accessors
-	 * still referencing NR_CPUS are gone, we could use nr_cpumask_bits
-	 * to determine the allocation size here.
+	 * Once all direct cpumask assignments are gone, we could use
+	 * nr_cpumask_bits to determine the allocation size here.
 	 */
 	return (*mask = xmalloc(cpumask_t)) != NULL;
 }

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 24 17:56:41 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 24 Oct 2011 17:56:41 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RIVJp-0000Gr-1d; Mon, 24 Oct 2011 17:56:41 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RIVIU-0008KU-QB
	for xen-changelog@lists.xensource.com; Mon, 24 Oct 2011 17:55:20 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-182.messagelabs.com!1319504115!623670!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10952 invoked from network); 25 Oct 2011 00:55:15 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-16.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	25 Oct 2011 00:55:15 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RIVIQ-00066h-VV
	for xen-changelog@lists.xensource.com; Tue, 25 Oct 2011 01:55:14 +0100
Message-Id: <E1RIVIQ-00066h-VV@xenbits.xen.org>
Date: Tue, 25 Oct 2011 01:55:14 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] credit: allocate CPU masks
	dynamically
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 Jan Beulich <jbeulich@suse.com>
# Date 1319183043 -7200
# Node ID 8269826353d8b9e5bb6248f22e85f6d4280ad9c9
# Parent  53528bab2eb423c352d6d43963b9bb7ee16abf18
credit: allocate CPU masks dynamically

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r 53528bab2eb4 -r 8269826353d8 xen/common/sched_credit.c
--- a/xen/common/sched_credit.c	Fri Oct 21 09:43:35 2011 +0200
+++ b/xen/common/sched_credit.c	Fri Oct 21 09:44:03 2011 +0200
@@ -166,8 +166,8 @@
     uint32_t ncpus;
     struct timer  master_ticker;
     unsigned int master;
-    cpumask_t idlers;
-    cpumask_t cpus;
+    cpumask_var_t idlers;
+    cpumask_var_t cpus;
     uint32_t weight;
     uint32_t credit;
     int credit_balance;
@@ -283,7 +283,7 @@
      */
     if ( cur->pri > CSCHED_PRI_IDLE )
     {
-        if ( cpumask_empty(&prv->idlers) )
+        if ( cpumask_empty(prv->idlers) )
         {
             CSCHED_STAT_CRANK(tickle_idlers_none);
         }
@@ -291,7 +291,7 @@
         {
             cpumask_t idle_mask;
 
-            cpumask_and(&idle_mask, &prv->idlers, new->vcpu->cpu_affinity);
+            cpumask_and(&idle_mask, prv->idlers, new->vcpu->cpu_affinity);
             if ( !cpumask_empty(&idle_mask) )
             {
                 CSCHED_STAT_CRANK(tickle_idlers_some);
@@ -327,11 +327,11 @@
 
     prv->credit -= prv->credits_per_tslice;
     prv->ncpus--;
-    cpu_clear(cpu, prv->idlers);
-    cpu_clear(cpu, prv->cpus);
+    cpumask_clear_cpu(cpu, prv->idlers);
+    cpumask_clear_cpu(cpu, prv->cpus);
     if ( (prv->master == cpu) && (prv->ncpus > 0) )
     {
-        prv->master = first_cpu(prv->cpus);
+        prv->master = cpumask_first(prv->cpus);
         migrate_timer(&prv->master_ticker, prv->master);
     }
     kill_timer(&spc->ticker);
@@ -360,7 +360,7 @@
     /* Initialize/update system-wide config */
     prv->credit += prv->credits_per_tslice;
     prv->ncpus++;
-    cpu_set(cpu, prv->cpus);
+    cpumask_set_cpu(cpu, prv->cpus);
     if ( prv->ncpus == 1 )
     {
         prv->master = cpu;
@@ -380,7 +380,7 @@
 
     /* Start off idling... */
     BUG_ON(!is_idle_vcpu(per_cpu(schedule_data, cpu).curr));
-    cpu_set(cpu, prv->idlers);
+    cpumask_set_cpu(cpu, prv->idlers);
 
     spin_unlock_irqrestore(&prv->lock, flags);
 
@@ -488,7 +488,7 @@
      * like run two VCPUs on co-hyperthreads while there are idle cores
      * or sockets.
      */
-    cpumask_and(&idlers, &cpu_online_map, &CSCHED_PRIV(ops)->idlers);
+    cpumask_and(&idlers, &cpu_online_map, CSCHED_PRIV(ops)->idlers);
     cpumask_set_cpu(cpu, &idlers);
     cpumask_and(&cpus, &cpus, &idlers);
     cpumask_clear_cpu(cpu, &cpus);
@@ -1242,7 +1242,7 @@
      * Peek at non-idling CPUs in the system, starting with our
      * immediate neighbour.
      */
-    cpumask_andnot(&workers, online, &prv->idlers);
+    cpumask_andnot(&workers, online, prv->idlers);
     cpumask_clear_cpu(cpu, &workers);
     peer_cpu = cpu;
 
@@ -1356,12 +1356,12 @@
      */
     if ( snext->pri == CSCHED_PRI_IDLE )
     {
-        if ( !cpu_isset(cpu, prv->idlers) )
-            cpu_set(cpu, prv->idlers);
+        if ( !cpumask_test_cpu(cpu, prv->idlers) )
+            cpumask_set_cpu(cpu, prv->idlers);
     }
-    else if ( cpu_isset(cpu, prv->idlers) )
+    else if ( cpumask_test_cpu(cpu, prv->idlers) )
     {
-        cpu_clear(cpu, prv->idlers);
+        cpumask_clear_cpu(cpu, prv->idlers);
     }
 
     if ( !is_idle_vcpu(snext->vcpu) )
@@ -1481,7 +1481,7 @@
            prv->ticks_per_tslice,
            vcpu_migration_delay);
 
-    cpumask_scnprintf(idlers_buf, sizeof(idlers_buf), &prv->idlers);
+    cpumask_scnprintf(idlers_buf, sizeof(idlers_buf), prv->idlers);
     printk("idlers: %s\n", idlers_buf);
 
     printk("active vcpus:\n");
@@ -1513,6 +1513,13 @@
     prv = xzalloc(struct csched_private);
     if ( prv == NULL )
         return -ENOMEM;
+    if ( !zalloc_cpumask_var(&prv->cpus) ||
+         !zalloc_cpumask_var(&prv->idlers) )
+    {
+        free_cpumask_var(prv->cpus);
+        xfree(prv);
+        return -ENOMEM;
+    }
 
     ops->sched_data = prv;
     spin_lock_init(&prv->lock);
@@ -1536,7 +1543,11 @@
 
     prv = CSCHED_PRIV(ops);
     if ( prv != NULL )
+    {
+        free_cpumask_var(prv->cpus);
+        free_cpumask_var(prv->idlers);
         xfree(prv);
+    }
 }
 
 static void csched_tick_suspend(const struct scheduler *ops, unsigned int cpu)

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 24 17:56:50 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 24 Oct 2011 17:56:50 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RIVJy-0000Ju-Ce; Mon, 24 Oct 2011 17:56:50 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RIVIT-0008KH-80
	for xen-changelog@lists.xensource.com; Mon, 24 Oct 2011 17:55:20 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-174.messagelabs.com!1319504113!36520464!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2970 invoked from network); 25 Oct 2011 00:55:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	25 Oct 2011 00:55:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RIVIP-00065O-S2
	for xen-changelog@lists.xensource.com; Tue, 25 Oct 2011 01:55:13 +0100
Message-Id: <E1RIVIP-00065O-S2@xenbits.xen.org>
Date: Tue, 25 Oct 2011 01:55:13 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/p2m: allocate CPU masks
	dynamically
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 Jan Beulich <jbeulich@suse.com>
# Date 1319182967 -7200
# Node ID 2682094bc243f96d1187271595ecefee333ec11d
# Parent  253073b522f8fcde6de44db9955c89257cde84d8
x86/p2m: allocate CPU masks dynamically

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tim Deegan <tim@xen.org>
Acked-by: Keir Fraser <keir@xen.org>
---


--- 2011-10-18.orig/xen/arch/x86/hvm/nestedhvm.c	2011-10-11 17:24:46.000000000 +0200
+++ 2011-10-18/xen/arch/x86/hvm/nestedhvm.c	2011-10-18 16:45:02.000000000 +0200
@@ -114,9 +114,9 @@ nestedhvm_flushtlb_ipi(void *info)
 void
 nestedhvm_vmcx_flushtlb(struct p2m_domain *p2m)
 {
-    on_selected_cpus(&p2m->p2m_dirty_cpumask, nestedhvm_flushtlb_ipi,
+    on_selected_cpus(p2m->dirty_cpumask, nestedhvm_flushtlb_ipi,
         p2m->domain, 1);
-    cpumask_clear(&p2m->p2m_dirty_cpumask);
+    cpumask_clear(p2m->dirty_cpumask);
 }

 bool_t
--- 2011-10-18.orig/xen/arch/x86/mm/hap/nested_hap.c	2011-10-21 09:24:51.000000000 +0200
+++ 2011-10-18/xen/arch/x86/mm/hap/nested_hap.c	2011-10-18 16:44:35.000000000 +0200
@@ -88,7 +88,7 @@ nestedp2m_write_p2m_entry(struct p2m_dom
     safe_write_pte(p, new);

     if (old_flags & _PAGE_PRESENT)
-        flush_tlb_mask(&p2m->p2m_dirty_cpumask);
+        flush_tlb_mask(p2m->dirty_cpumask);

     paging_unlock(d);
 }
--- 2011-10-18.orig/xen/arch/x86/mm/p2m.c	2011-10-14 09:47:46.000000000 +0200
+++ 2011-10-18/xen/arch/x86/mm/p2m.c	2011-10-21 09:28:33.000000000 +0200
@@ -81,7 +81,6 @@ static void p2m_initialise(struct domain
     p2m->default_access = p2m_access_rwx;

     p2m->cr3 = CR3_EADDR;
-    cpumask_clear(&p2m->p2m_dirty_cpumask);

     if ( hap_enabled(d) && (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) )
         ept_p2m_init(p2m);
@@ -102,6 +101,8 @@ p2m_init_nestedp2m(struct domain *d)
         d->arch.nested_p2m[i] = p2m = xzalloc(struct p2m_domain);
         if (p2m == NULL)
             return -ENOMEM;
+        if ( !zalloc_cpumask_var(&p2m->dirty_cpumask) )
+            return -ENOMEM;
         p2m_initialise(d, p2m);
         p2m->write_p2m_entry = nestedp2m_write_p2m_entry;
         list_add(&p2m->np2m_list, &p2m_get_hostp2m(d)->np2m_list);
@@ -118,6 +119,11 @@ int p2m_init(struct domain *d)
     p2m_get_hostp2m(d) = p2m = xzalloc(struct p2m_domain);
     if ( p2m == NULL )
         return -ENOMEM;
+    if ( !zalloc_cpumask_var(&p2m->dirty_cpumask) )
+    {
+        xfree(p2m);
+        return -ENOMEM;
+    }
     p2m_initialise(d, p2m);

     /* Must initialise nestedp2m unconditionally
@@ -333,6 +339,9 @@ static void p2m_teardown_nestedp2m(struc
     uint8_t i;

     for (i = 0; i < MAX_NESTEDP2M; i++) {
+        if ( !d->arch.nested_p2m[i] )
+            continue;
+        free_cpumask_var(d->arch.nested_p2m[i]->dirty_cpumask);
         xfree(d->arch.nested_p2m[i]);
         d->arch.nested_p2m[i] = NULL;
     }
@@ -341,8 +350,12 @@ static void p2m_teardown_nestedp2m(struc
 void p2m_final_teardown(struct domain *d)
 {
     /* Iterate over all p2m tables per domain */
-    xfree(d->arch.p2m);
-    d->arch.p2m = NULL;
+    if ( d->arch.p2m )
+    {
+        free_cpumask_var(d->arch.p2m->dirty_cpumask);
+        xfree(d->arch.p2m);
+        d->arch.p2m = NULL;
+    }

     /* We must teardown unconditionally because
      * we initialise them unconditionally.
@@ -1200,7 +1213,7 @@ p2m_get_nestedp2m(struct vcpu *v, uint64
             if (p2m->cr3 == CR3_EADDR)
                 hvm_asid_flush_vcpu(v);
             p2m->cr3 = cr3;
-            cpu_set(v->processor, p2m->p2m_dirty_cpumask);
+            cpumask_set_cpu(v->processor, p2m->dirty_cpumask);
             p2m_unlock(p2m);
             nestedp2m_unlock(d);
             return p2m;
@@ -1217,7 +1230,7 @@ p2m_get_nestedp2m(struct vcpu *v, uint64
     p2m->cr3 = cr3;
     nv->nv_flushp2m = 0;
     hvm_asid_flush_vcpu(v);
-    cpu_set(v->processor, p2m->p2m_dirty_cpumask);
+    cpumask_set_cpu(v->processor, p2m->dirty_cpumask);
     p2m_unlock(p2m);
     nestedp2m_unlock(d);

--- 2011-10-18.orig/xen/include/asm-x86/p2m.h	2011-10-21 09:24:51.000000000 +0200
+++ 2011-10-18/xen/include/asm-x86/p2m.h	2011-10-18 16:39:34.000000000 +0200
@@ -198,7 +198,7 @@ struct p2m_domain {
      * this p2m and those physical cpus whose vcpu's are in
      * guestmode.
      */
-    cpumask_t          p2m_dirty_cpumask;
+    cpumask_var_t      dirty_cpumask;

     struct domain     *domain;   /* back pointer to domain */

diff -r 253073b522f8 -r 2682094bc243 xen/arch/x86/hvm/nestedhvm.c
--- a/xen/arch/x86/hvm/nestedhvm.c	Fri Oct 21 09:23:05 2011 +0200
+++ b/xen/arch/x86/hvm/nestedhvm.c	Fri Oct 21 09:42:47 2011 +0200
@@ -114,9 +114,9 @@
 void
 nestedhvm_vmcx_flushtlb(struct p2m_domain *p2m)
 {
-    on_selected_cpus(&p2m->p2m_dirty_cpumask, nestedhvm_flushtlb_ipi,
+    on_selected_cpus(p2m->dirty_cpumask, nestedhvm_flushtlb_ipi,
         p2m->domain, 1);
-    cpumask_clear(&p2m->p2m_dirty_cpumask);
+    cpumask_clear(p2m->dirty_cpumask);
 }
 
 bool_t
diff -r 253073b522f8 -r 2682094bc243 xen/arch/x86/mm/hap/nested_hap.c
--- a/xen/arch/x86/mm/hap/nested_hap.c	Fri Oct 21 09:23:05 2011 +0200
+++ b/xen/arch/x86/mm/hap/nested_hap.c	Fri Oct 21 09:42:47 2011 +0200
@@ -88,7 +88,7 @@
     safe_write_pte(p, new);
 
     if (old_flags & _PAGE_PRESENT)
-        flush_tlb_mask(&p2m->p2m_dirty_cpumask);
+        flush_tlb_mask(p2m->dirty_cpumask);
     
     paging_unlock(d);
 }
diff -r 253073b522f8 -r 2682094bc243 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Fri Oct 21 09:23:05 2011 +0200
+++ b/xen/arch/x86/mm/p2m.c	Fri Oct 21 09:42:47 2011 +0200
@@ -81,7 +81,6 @@
     p2m->default_access = p2m_access_rwx;
 
     p2m->cr3 = CR3_EADDR;
-    cpumask_clear(&p2m->p2m_dirty_cpumask);
 
     if ( hap_enabled(d) && (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) )
         ept_p2m_init(p2m);
@@ -102,6 +101,8 @@
         d->arch.nested_p2m[i] = p2m = xzalloc(struct p2m_domain);
         if (p2m == NULL)
             return -ENOMEM;
+        if ( !zalloc_cpumask_var(&p2m->dirty_cpumask) )
+            return -ENOMEM;
         p2m_initialise(d, p2m);
         p2m->write_p2m_entry = nestedp2m_write_p2m_entry;
         list_add(&p2m->np2m_list, &p2m_get_hostp2m(d)->np2m_list);
@@ -118,6 +119,11 @@
     p2m_get_hostp2m(d) = p2m = xzalloc(struct p2m_domain);
     if ( p2m == NULL )
         return -ENOMEM;
+    if ( !zalloc_cpumask_var(&p2m->dirty_cpumask) )
+    {
+        xfree(p2m);
+        return -ENOMEM;
+    }
     p2m_initialise(d, p2m);
 
     /* Must initialise nestedp2m unconditionally
@@ -333,6 +339,9 @@
     uint8_t i;
 
     for (i = 0; i < MAX_NESTEDP2M; i++) {
+        if ( !d->arch.nested_p2m[i] )
+            continue;
+        free_cpumask_var(d->arch.nested_p2m[i]->dirty_cpumask);
         xfree(d->arch.nested_p2m[i]);
         d->arch.nested_p2m[i] = NULL;
     }
@@ -341,8 +350,12 @@
 void p2m_final_teardown(struct domain *d)
 {
     /* Iterate over all p2m tables per domain */
-    xfree(d->arch.p2m);
-    d->arch.p2m = NULL;
+    if ( d->arch.p2m )
+    {
+        free_cpumask_var(d->arch.p2m->dirty_cpumask);
+        xfree(d->arch.p2m);
+        d->arch.p2m = NULL;
+    }
 
     /* We must teardown unconditionally because
      * we initialise them unconditionally.
@@ -1305,7 +1318,7 @@
             if (p2m->cr3 == CR3_EADDR)
                 hvm_asid_flush_vcpu(v);
             p2m->cr3 = cr3;
-            cpu_set(v->processor, p2m->p2m_dirty_cpumask);
+            cpumask_set_cpu(v->processor, p2m->dirty_cpumask);
             p2m_unlock(p2m);
             nestedp2m_unlock(d);
             return p2m;
@@ -1322,7 +1335,7 @@
     p2m->cr3 = cr3;
     nv->nv_flushp2m = 0;
     hvm_asid_flush_vcpu(v);
-    cpu_set(v->processor, p2m->p2m_dirty_cpumask);
+    cpumask_set_cpu(v->processor, p2m->dirty_cpumask);
     p2m_unlock(p2m);
     nestedp2m_unlock(d);
 
diff -r 253073b522f8 -r 2682094bc243 xen/include/asm-x86/p2m.h
--- a/xen/include/asm-x86/p2m.h	Fri Oct 21 09:23:05 2011 +0200
+++ b/xen/include/asm-x86/p2m.h	Fri Oct 21 09:42:47 2011 +0200
@@ -198,7 +198,7 @@
      * this p2m and those physical cpus whose vcpu's are in
      * guestmode.
      */
-    cpumask_t          p2m_dirty_cpumask;
+    cpumask_var_t      dirty_cpumask;
 
     struct domain     *domain;   /* back pointer to domain */
 

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 24 17:57:05 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 24 Oct 2011 17:57:05 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RIVKC-0000Ql-VZ; Mon, 24 Oct 2011 17:57:05 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RIVIT-0008KR-QP
	for xen-changelog@lists.xensource.com; Mon, 24 Oct 2011 17:55:20 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-174.messagelabs.com!1319504114!30177458!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29160 invoked from network); 25 Oct 2011 00:55:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	25 Oct 2011 00:55:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RIVIQ-000663-EY
	for xen-changelog@lists.xensource.com; Tue, 25 Oct 2011 01:55:14 +0100
Message-Id: <E1RIVIQ-000663-EY@xenbits.xen.org>
Date: Tue, 25 Oct 2011 01:55:13 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] cpupools: allocate CPU masks
	dynamically
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 Jan Beulich <jbeulich@suse.com>
# Date 1319183015 -7200
# Node ID 53528bab2eb423c352d6d43963b9bb7ee16abf18
# Parent  2682094bc243f96d1187271595ecefee333ec11d
cpupools: allocate CPU masks dynamically

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r 2682094bc243 -r 53528bab2eb4 xen/arch/x86/domain_build.c
--- a/xen/arch/x86/domain_build.c	Fri Oct 21 09:42:47 2011 +0200
+++ b/xen/arch/x86/domain_build.c	Fri Oct 21 09:43:35 2011 +0200
@@ -885,10 +885,10 @@
 
     printk("Dom0 has maximum %u VCPUs\n", opt_dom0_max_vcpus);
 
-    cpu = first_cpu(cpupool0->cpu_valid);
+    cpu = cpumask_first(cpupool0->cpu_valid);
     for ( i = 1; i < opt_dom0_max_vcpus; i++ )
     {
-        cpu = cycle_cpu(cpu, cpupool0->cpu_valid);
+        cpu = cpumask_cycle(cpu, cpupool0->cpu_valid);
         (void)alloc_vcpu(d, i, cpu);
     }
 
diff -r 2682094bc243 -r 53528bab2eb4 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c	Fri Oct 21 09:42:47 2011 +0200
+++ b/xen/arch/x86/smpboot.c	Fri Oct 21 09:43:35 2011 +0200
@@ -850,8 +850,8 @@
     remove_siblinginfo(cpu);
 
     /* It's now safe to remove this processor from the online map */
-    cpu_clear(cpu, cpupool0->cpu_valid);
-    cpu_clear(cpu, cpu_online_map);
+    cpumask_clear_cpu(cpu, cpupool0->cpu_valid);
+    cpumask_clear_cpu(cpu, &cpu_online_map);
     fixup_irqs();
 
     if ( cpu_disable_scheduler(cpu) )
diff -r 2682094bc243 -r 53528bab2eb4 xen/common/cpupool.c
--- a/xen/common/cpupool.c	Fri Oct 21 09:42:47 2011 +0200
+++ b/xen/common/cpupool.c	Fri Oct 21 09:43:35 2011 +0200
@@ -39,11 +39,18 @@
 
 static struct cpupool *alloc_cpupool_struct(void)
 {
-    return xzalloc(struct cpupool);
+    struct cpupool *c = xzalloc(struct cpupool);
+
+    if ( c && zalloc_cpumask_var(&c->cpu_valid) )
+        return c;
+    xfree(c);
+    return NULL;
 }
 
 static void free_cpupool_struct(struct cpupool *c)
 {
+    if ( c )
+        free_cpumask_var(c->cpu_valid);
     xfree(c);
 }
 
@@ -191,7 +198,7 @@
         spin_unlock(&cpupool_lock);
         return -ENOENT;
     }
-    if ( (c->n_dom != 0) || cpus_weight(c->cpu_valid) )
+    if ( (c->n_dom != 0) || cpumask_weight(c->cpu_valid) )
     {
         spin_unlock(&cpupool_lock);
         return -EBUSY;
@@ -232,7 +239,7 @@
         cpupool_put(cpupool_cpu_moving);
         cpupool_cpu_moving = NULL;
     }
-    cpu_set(cpu, c->cpu_valid);
+    cpumask_set_cpu(cpu, c->cpu_valid);
     return 0;
 }
 
@@ -296,10 +303,10 @@
         goto out;
 
     ret = 0;
-    if ( !cpu_isset(cpu, c->cpu_valid) && (cpu != cpupool_moving_cpu) )
+    if ( !cpumask_test_cpu(cpu, c->cpu_valid) && (cpu != cpupool_moving_cpu) )
         goto out;
 
-    if ( (c->n_dom > 0) && (cpus_weight(c->cpu_valid) == 1) &&
+    if ( (c->n_dom > 0) && (cpumask_weight(c->cpu_valid) == 1) &&
          (cpu != cpupool_moving_cpu) )
     {
         for_each_domain(d)
@@ -326,15 +333,15 @@
     cpupool_moving_cpu = cpu;
     atomic_inc(&c->refcnt);
     cpupool_cpu_moving = c;
-    cpu_clear(cpu, c->cpu_valid);
+    cpumask_clear_cpu(cpu, c->cpu_valid);
     spin_unlock(&cpupool_lock);
 
     work_cpu = smp_processor_id();
     if ( work_cpu == cpu )
     {
-        work_cpu = first_cpu(cpupool0->cpu_valid);
+        work_cpu = cpumask_first(cpupool0->cpu_valid);
         if ( work_cpu == cpu )
-            work_cpu = next_cpu(cpu, cpupool0->cpu_valid);
+            work_cpu = cpumask_next(cpu, cpupool0->cpu_valid);
     }
     return continue_hypercall_on_cpu(work_cpu, cpupool_unassign_cpu_helper, c);
 
@@ -361,7 +368,7 @@
         return 0;
     spin_lock(&cpupool_lock);
     c = cpupool_find_by_id(poolid);
-    if ( (c != NULL) && cpus_weight(c->cpu_valid) )
+    if ( (c != NULL) && cpumask_weight(c->cpu_valid) )
     {
         c->n_dom++;
         n_dom = c->n_dom;
@@ -418,7 +425,7 @@
     int ret = 0;
 	
     spin_lock(&cpupool_lock);
-    if ( !cpu_isset(cpu, cpupool0->cpu_valid))
+    if ( !cpumask_test_cpu(cpu, cpupool0->cpu_valid))
         ret = -EBUSY;
     else
         cpu_set(cpu, cpupool_locked_cpus);
@@ -473,7 +480,7 @@
         op->cpupool_id = c->cpupool_id;
         op->sched_id = c->sched->sched_id;
         op->n_dom = c->n_dom;
-        ret = cpumask_to_xenctl_cpumap(&op->cpumap, &c->cpu_valid);
+        ret = cpumask_to_xenctl_cpumap(&op->cpumap, c->cpu_valid);
         cpupool_put(c);
     }
     break;
@@ -516,7 +523,7 @@
             break;
         cpu = op->cpu;
         if ( cpu == XEN_SYSCTL_CPUPOOL_PAR_ANY )
-            cpu = last_cpu(c->cpu_valid);
+            cpu = cpumask_last(c->cpu_valid);
         ret = (cpu < nr_cpu_ids) ? cpupool_unassign_cpu(c, cpu) : -EINVAL;
         cpupool_put(c);
     }
@@ -550,7 +557,7 @@
         ret = -ENOENT;
         spin_lock(&cpupool_lock);
         c = cpupool_find_by_id(op->cpupool_id);
-        if ( (c != NULL) && cpus_weight(c->cpu_valid) )
+        if ( (c != NULL) && cpumask_weight(c->cpu_valid) )
         {
             d->cpupool->n_dom--;
             ret = sched_move_domain(d, c);
diff -r 2682094bc243 -r 53528bab2eb4 xen/common/domctl.c
--- a/xen/common/domctl.c	Fri Oct 21 09:42:47 2011 +0200
+++ b/xen/common/domctl.c	Fri Oct 21 09:43:35 2011 +0200
@@ -502,7 +502,7 @@
             goto maxvcpu_out;
 
         ret = -ENOMEM;
-        online = (d->cpupool == NULL) ? &cpu_online_map : &d->cpupool->cpu_valid;
+        online = (d->cpupool == NULL) ? &cpu_online_map : d->cpupool->cpu_valid;
         if ( max > d->max_vcpus )
         {
             struct vcpu **vcpus;
diff -r 2682094bc243 -r 53528bab2eb4 xen/common/sched_credit.c
--- a/xen/common/sched_credit.c	Fri Oct 21 09:42:47 2011 +0200
+++ b/xen/common/sched_credit.c	Fri Oct 21 09:43:35 2011 +0200
@@ -73,7 +73,7 @@
 #define CSCHED_DOM(_dom)    ((struct csched_dom *) (_dom)->sched_priv)
 #define RUNQ(_cpu)          (&(CSCHED_PCPU(_cpu)->runq))
 #define CSCHED_CPUONLINE(_pool)    \
-    (((_pool) == NULL) ? &cpupool_free_cpus : &(_pool)->cpu_valid)
+    (((_pool) == NULL) ? &cpupool_free_cpus : (_pool)->cpu_valid)
 
 
 /*
diff -r 2682094bc243 -r 53528bab2eb4 xen/common/sched_credit2.c
--- a/xen/common/sched_credit2.c	Fri Oct 21 09:42:47 2011 +0200
+++ b/xen/common/sched_credit2.c	Fri Oct 21 09:43:35 2011 +0200
@@ -176,7 +176,7 @@
 #define CSCHED_VCPU(_vcpu)  ((struct csched_vcpu *) (_vcpu)->sched_priv)
 #define CSCHED_DOM(_dom)    ((struct csched_dom *) (_dom)->sched_priv)
 #define CSCHED_CPUONLINE(_pool)    \
-    (((_pool) == NULL) ? &cpupool_free_cpus : &(_pool)->cpu_valid)
+    (((_pool) == NULL) ? &cpupool_free_cpus : (_pool)->cpu_valid)
 /* CPU to runq_id macro */
 #define c2r(_ops, _cpu)     (CSCHED_PRIV(_ops)->runq_map[(_cpu)])
 /* CPU to runqueue struct macro */
diff -r 2682094bc243 -r 53528bab2eb4 xen/common/sched_sedf.c
--- a/xen/common/sched_sedf.c	Fri Oct 21 09:42:47 2011 +0200
+++ b/xen/common/sched_sedf.c	Fri Oct 21 09:43:35 2011 +0200
@@ -22,7 +22,7 @@
     } while ( 0 )
 
 #define SEDF_CPUONLINE(_pool)                                             \
-    (((_pool) == NULL) ? &cpupool_free_cpus : &(_pool)->cpu_valid)
+    (((_pool) == NULL) ? &cpupool_free_cpus : (_pool)->cpu_valid)
 
 #ifndef NDEBUG
 #define SEDF_STATS
diff -r 2682094bc243 -r 53528bab2eb4 xen/common/schedule.c
--- a/xen/common/schedule.c	Fri Oct 21 09:42:47 2011 +0200
+++ b/xen/common/schedule.c	Fri Oct 21 09:43:35 2011 +0200
@@ -74,7 +74,7 @@
 #define VCPU2OP(_v)   (DOM2OP((_v)->domain))
 #define VCPU2ONLINE(_v)                                                    \
          (((_v)->domain->cpupool == NULL) ? &cpu_online_map                \
-         : &(_v)->domain->cpupool->cpu_valid)
+         : (_v)->domain->cpupool->cpu_valid)
 
 static inline void trace_runstate_change(struct vcpu *v, int new_state)
 {
@@ -258,7 +258,7 @@
 
     domain_pause(d);
 
-    new_p = first_cpu(c->cpu_valid);
+    new_p = cpumask_first(c->cpu_valid);
     for_each_vcpu ( d, v )
     {
         migrate_timer(&v->periodic_timer, new_p);
@@ -273,7 +273,7 @@
         v->sched_priv = vcpu_priv[v->vcpu_id];
         evtchn_move_pirqs(v);
 
-        new_p = cycle_cpu(new_p, c->cpu_valid);
+        new_p = cpumask_cycle(new_p, c->cpu_valid);
 
         SCHED_OP(VCPU2OP(v), insert_vcpu, v);
     }
@@ -431,13 +431,13 @@
             if ( pick_called &&
                  (new_lock == per_cpu(schedule_data, new_cpu).schedule_lock) &&
                  cpumask_test_cpu(new_cpu, v->cpu_affinity) &&
-                 cpu_isset(new_cpu, v->domain->cpupool->cpu_valid) )
+                 cpumask_test_cpu(new_cpu, v->domain->cpupool->cpu_valid) )
                 break;
 
             /* Select a new CPU. */
             new_cpu = SCHED_OP(VCPU2OP(v), pick_cpu, v);
             if ( (new_lock == per_cpu(schedule_data, new_cpu).schedule_lock) &&
-                 cpu_isset(new_cpu, v->domain->cpupool->cpu_valid) )
+                 cpumask_test_cpu(new_cpu, v->domain->cpupool->cpu_valid) )
                 break;
             pick_called = 1;
         }
@@ -549,7 +549,7 @@
         {
             vcpu_schedule_lock_irq(v);
 
-            cpumask_and(&online_affinity, v->cpu_affinity, &c->cpu_valid);
+            cpumask_and(&online_affinity, v->cpu_affinity, c->cpu_valid);
             if ( cpus_empty(online_affinity) &&
                  cpumask_test_cpu(cpu, v->cpu_affinity) )
             {
@@ -1446,7 +1446,7 @@
     cpumask_t        *cpus;
 
     sched = (c == NULL) ? &ops : c->sched;
-    cpus = (c == NULL) ? &cpupool_free_cpus : &c->cpu_valid;
+    cpus = (c == NULL) ? &cpupool_free_cpus : c->cpu_valid;
     printk("Scheduler: %s (%s)\n", sched->name, sched->opt_name);
     SCHED_OP(sched, dump_settings);
 
diff -r 2682094bc243 -r 53528bab2eb4 xen/include/xen/sched-if.h
--- a/xen/include/xen/sched-if.h	Fri Oct 21 09:42:47 2011 +0200
+++ b/xen/include/xen/sched-if.h	Fri Oct 21 09:43:35 2011 +0200
@@ -192,7 +192,7 @@
 struct cpupool
 {
     int              cpupool_id;
-    cpumask_t        cpu_valid;      /* all cpus assigned to pool */
+    cpumask_var_t    cpu_valid;      /* all cpus assigned to pool */
     struct cpupool   *next;
     unsigned int     n_dom;
     struct scheduler *sched;
diff -r 2682094bc243 -r 53528bab2eb4 xen/include/xen/sched.h
--- a/xen/include/xen/sched.h	Fri Oct 21 09:42:47 2011 +0200
+++ b/xen/include/xen/sched.h	Fri Oct 21 09:43:35 2011 +0200
@@ -664,7 +664,7 @@
 void schedule_dump(struct cpupool *c);
 extern void dump_runq(unsigned char key);
 
-#define num_cpupool_cpus(c) (cpus_weight((c)->cpu_valid))
+#define num_cpupool_cpus(c) cpumask_weight((c)->cpu_valid)
 
 #endif /* __SCHED_H__ */
 

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 24 17:57:18 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 24 Oct 2011 17:57:18 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RIVKP-0000VU-PV; Mon, 24 Oct 2011 17:57:18 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RIVIS-0008KF-Ds
	for xen-changelog@lists.xensource.com; Mon, 24 Oct 2011 17:55:20 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-27.messagelabs.com!1319504092!49582477!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31834 invoked from network); 25 Oct 2011 00:54:52 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	25 Oct 2011 00:54:52 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RIVIP-00064k-AT
	for xen-changelog@lists.xensource.com; Tue, 25 Oct 2011 01:55:13 +0100
Message-Id: <E1RIVIP-00064k-AT@xenbits.xen.org>
Date: Tue, 25 Oct 2011 01:55:12 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] allocate CPU sibling and core maps
	dynamically
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 Jan Beulich <jbeulich@suse.com>
# Date 1319181785 -7200
# Node ID 253073b522f8fcde6de44db9955c89257cde84d8
# Parent  eef4641d6726982d4d93ec12d407c3ce2180e290
allocate CPU sibling and core maps dynamically

... thus reducing the per-CPU data area size back to one page even when
building for large NR_CPUS.

At once eliminate the old __cpu{mask,list}_scnprintf() helpers.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r eef4641d6726 -r 253073b522f8 xen/arch/ia64/linux-xen/setup.c
--- a/xen/arch/ia64/linux-xen/setup.c	Fri Oct 21 09:22:02 2011 +0200
+++ b/xen/arch/ia64/linux-xen/setup.c	Fri Oct 21 09:23:05 2011 +0200
@@ -577,8 +577,12 @@
 
 	cpu_physical_id(0) = hard_smp_processor_id();
 
-	cpu_set(0, per_cpu(cpu_sibling_map, 0));
-	cpu_set(0, per_cpu(cpu_core_map, 0));
+	if (!zalloc_cpumask_var(&per_cpu(cpu_sibling_mask, 0)) ||
+            !zalloc_cpumask_var(&per_cpu(cpu_core_mask, 0)))
+		panic("No memory for boot CPU sibling/core maps\n");
+
+	cpumask_set_cpu(0, per_cpu(cpu_sibling_mask, 0));
+	cpumask_set_cpu(0, per_cpu(cpu_core_mask, 0));
 
 	check_for_logical_procs();
 	if (smp_num_cpucores > 1)
diff -r eef4641d6726 -r 253073b522f8 xen/arch/ia64/linux-xen/smpboot.c
--- a/xen/arch/ia64/linux-xen/smpboot.c	Fri Oct 21 09:22:02 2011 +0200
+++ b/xen/arch/ia64/linux-xen/smpboot.c	Fri Oct 21 09:23:05 2011 +0200
@@ -144,8 +144,8 @@
 cpumask_t cpu_possible_map;
 EXPORT_SYMBOL(cpu_possible_map);
 
-DEFINE_PER_CPU_READ_MOSTLY(cpumask_t, cpu_core_map);
-DEFINE_PER_CPU_READ_MOSTLY(cpumask_t, cpu_sibling_map);
+DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_core_mask);
+DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_sibling_mask);
 int smp_num_siblings = 1;
 int smp_num_cpucores = 1;
 
@@ -687,13 +687,13 @@
 {
 	int i;
 
-	for_each_cpu_mask(i, per_cpu(cpu_sibling_map, cpu))
-		cpumask_clear_cpu(cpu, &per_cpu(cpu_sibling_map, i));
-	for_each_cpu_mask(i, per_cpu(cpu_core_map, cpu))
-		cpumask_clear_cpu(cpu, &per_cpu(cpu_core_map, i));
+	for_each_cpu_mask(i, *per_cpu(cpu_sibling_mask, cpu))
+		cpumask_clear_cpu(cpu, per_cpu(cpu_sibling_mask, i));
+	for_each_cpu_mask(i, *per_cpu(cpu_core_mask, cpu))
+		cpumask_clear_cpu(cpu, per_cpu(cpu_core_mask, i));
 
-	cpumask_clear(&per_cpu(cpu_sibling_map, cpu));
-	cpumask_clear(&per_cpu(cpu_core_map, cpu));
+	cpumask_clear(per_cpu(cpu_sibling_mask, cpu));
+	cpumask_clear(per_cpu(cpu_core_mask, cpu));
 }
 
 static void
@@ -703,12 +703,12 @@
 
 	if (cpu_data(cpu)->threads_per_core == 1 &&
 	    cpu_data(cpu)->cores_per_socket == 1) {
-		cpu_clear(cpu, per_cpu(cpu_core_map, cpu));
-		cpu_clear(cpu, per_cpu(cpu_sibling_map, cpu));
+		cpumask_clear_cpu(cpu, per_cpu(cpu_core_mask, cpu));
+		cpumask_clear_cpu(cpu, per_cpu(cpu_sibling_mask, cpu));
 		return;
 	}
 
-	last = (cpus_weight(per_cpu(cpu_core_map, cpu)) == 1);
+	last = (cpumask_weight(per_cpu(cpu_core_mask, cpu)) == 1);
 
 	/* remove it from all sibling map's */
 	clear_cpu_sibling_map(cpu);
@@ -794,11 +794,11 @@
 
 	for_each_online_cpu(i) {
 		if ((cpu_data(cpu)->socket_id == cpu_data(i)->socket_id)) {
-			cpu_set(i, per_cpu(cpu_core_map, cpu));
-			cpu_set(cpu, per_cpu(cpu_core_map, i));
+			cpumask_set_cpu(i, per_cpu(cpu_core_mask, cpu));
+			cpumask_set_cpu(cpu, per_cpu(cpu_core_mask, i));
 			if (cpu_data(cpu)->core_id == cpu_data(i)->core_id) {
-				cpu_set(i, per_cpu(cpu_sibling_map, cpu));
-				cpu_set(cpu, per_cpu(cpu_sibling_map, i));
+				cpumask_set_cpu(i, per_cpu(cpu_sibling_mask, cpu));
+				cpumask_set_cpu(cpu, per_cpu(cpu_sibling_mask, i));
 			}
 		}
 	}
@@ -821,6 +821,14 @@
 	if (cpu_isset(cpu, cpu_callin_map))
 		return -EINVAL;
 
+	if (!per_cpu(cpu_sibling_mask, cpu) &&
+            !zalloc_cpumask_var(&per_cpu(cpu_sibling_mask, cpu)))
+		return -ENOMEM;
+
+	if (!per_cpu(cpu_core_mask, cpu) &&
+            !zalloc_cpumask_var(&per_cpu(cpu_core_mask, cpu)))
+		return -ENOMEM;
+
 	per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
 	/* Processor goes to start_secondary(), sets online flag */
 	ret = do_boot_cpu(sapicid, cpu);
@@ -829,8 +837,8 @@
 
 	if (cpu_data(cpu)->threads_per_core == 1 &&
 	    cpu_data(cpu)->cores_per_socket == 1) {
-		cpu_set(cpu, per_cpu(cpu_sibling_map, cpu));
-		cpu_set(cpu, per_cpu(cpu_core_map, cpu));
+		cpumask_set_cpu(cpu, per_cpu(cpu_sibling_mask, cpu));
+		cpumask_set_cpu(cpu, per_cpu(cpu_core_mask, cpu));
 		return 0;
 	}
 
diff -r eef4641d6726 -r 253073b522f8 xen/arch/ia64/xen/dom0_ops.c
--- a/xen/arch/ia64/xen/dom0_ops.c	Fri Oct 21 09:22:02 2011 +0200
+++ b/xen/arch/ia64/xen/dom0_ops.c	Fri Oct 21 09:23:05 2011 +0200
@@ -594,9 +594,9 @@
         xen_sysctl_physinfo_t *pi = &op->u.physinfo;
 
         memset(pi, 0, sizeof(*pi));
-        pi->threads_per_core = cpus_weight(per_cpu(cpu_sibling_map, 0));
+        pi->threads_per_core = cpumask_weight(per_cpu(cpu_sibling_mask, 0));
         pi->cores_per_socket =
-            cpus_weight(per_cpu(cpu_core_map, 0)) / pi->threads_per_core;
+            cpumask_weight(per_cpu(cpu_core_mask, 0)) / pi->threads_per_core;
         pi->nr_nodes         = (u32)num_online_nodes();
         pi->nr_cpus          = (u32)num_online_cpus();
         pi->total_pages      = total_pages; 
diff -r eef4641d6726 -r 253073b522f8 xen/arch/ia64/xen/tlb_track.c
--- a/xen/arch/ia64/xen/tlb_track.c	Fri Oct 21 09:22:02 2011 +0200
+++ b/xen/arch/ia64/xen/tlb_track.c	Fri Oct 21 09:23:05 2011 +0200
@@ -504,7 +504,7 @@
     char pcpumask_buf[NR_CPUS + 1];
     char vcpumask_buf[MAX_VIRT_CPUS + 1];
     cpumask_scnprintf(pcpumask_buf, sizeof(pcpumask_buf),
-                      entry->pcpu_dirty_mask);
+                      &entry->pcpu_dirty_mask);
     vcpumask_scnprintf(vcpumask_buf, sizeof(vcpumask_buf),
                        entry->vcpu_dirty_mask);
     printk("%s:%d\n"
diff -r eef4641d6726 -r 253073b522f8 xen/arch/x86/cpu/mcheck/mce_intel.c
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c	Fri Oct 21 09:22:02 2011 +0200
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c	Fri Oct 21 09:23:05 2011 +0200
@@ -867,7 +867,7 @@
         {
             char *ebufp, ebuf[96] = "MCE: Fatal error happened on CPUs ";
             ebufp = ebuf + strlen(ebuf);
-            cpumask_scnprintf(ebufp, 95 - strlen(ebuf), mce_fatal_cpus);
+            cpumask_scnprintf(ebufp, 95 - strlen(ebuf), &mce_fatal_cpus);
             mc_panic(ebuf);
         }
         atomic_set(&found_error, 0);
diff -r eef4641d6726 -r 253073b522f8 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Fri Oct 21 09:22:02 2011 +0200
+++ b/xen/arch/x86/irq.c	Fri Oct 21 09:23:05 2011 +0200
@@ -1998,7 +1998,7 @@
         spin_lock_irqsave(&desc->lock, flags);
 
         cpumask_scnprintf(keyhandler_scratch, sizeof(keyhandler_scratch),
-                          desc->affinity);
+                          &desc->affinity);
         printk("   IRQ:%4d affinity:%s vec:%02x type=%-15s"
                " status=%08x ",
                irq, keyhandler_scratch, desc->arch.vector,
diff -r eef4641d6726 -r 253073b522f8 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c	Fri Oct 21 09:22:02 2011 +0200
+++ b/xen/arch/x86/mm.c	Fri Oct 21 09:23:05 2011 +0200
@@ -3201,7 +3201,7 @@
                 cpumask_clear(&mask);
                 for_each_online_cpu(cpu)
                     if ( !cpumask_intersects(&mask,
-                                             &per_cpu(cpu_sibling_map, cpu)) )
+                                             per_cpu(cpu_sibling_mask, cpu)) )
                         cpumask_set_cpu(cpu, &mask);
                 flush_mask(&mask, FLUSH_CACHE);
             }
diff -r eef4641d6726 -r 253073b522f8 xen/arch/x86/oprofile/op_model_p4.c
--- a/xen/arch/x86/oprofile/op_model_p4.c	Fri Oct 21 09:22:02 2011 +0200
+++ b/xen/arch/x86/oprofile/op_model_p4.c	Fri Oct 21 09:23:05 2011 +0200
@@ -385,7 +385,7 @@
 {
 #ifdef CONFIG_SMP
 	int cpu = smp_processor_id();
-	return (cpu != first_cpu(per_cpu(cpu_sibling_map, cpu)));
+	return (cpu != cpumask_first(per_cpu(cpu_sibling_mask, cpu)));
 #endif	
 	return 0;
 }
diff -r eef4641d6726 -r 253073b522f8 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c	Fri Oct 21 09:22:02 2011 +0200
+++ b/xen/arch/x86/smpboot.c	Fri Oct 21 09:23:05 2011 +0200
@@ -51,9 +51,9 @@
 unsigned long __read_mostly trampoline_phys;
 
 /* representing HT siblings of each logical CPU */
-DEFINE_PER_CPU_READ_MOSTLY(cpumask_t, cpu_sibling_map);
+DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_sibling_mask);
 /* representing HT and core siblings of each logical CPU */
-DEFINE_PER_CPU_READ_MOSTLY(cpumask_t, cpu_core_map);
+DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_core_mask);
 
 cpumask_t cpu_online_map __read_mostly;
 EXPORT_SYMBOL(cpu_online_map);
@@ -233,10 +233,10 @@
 
 static void link_thread_siblings(int cpu1, int cpu2)
 {
-    cpu_set(cpu1, per_cpu(cpu_sibling_map, cpu2));
-    cpu_set(cpu2, per_cpu(cpu_sibling_map, cpu1));
-    cpu_set(cpu1, per_cpu(cpu_core_map, cpu2));
-    cpu_set(cpu2, per_cpu(cpu_core_map, cpu1));
+    cpumask_set_cpu(cpu1, per_cpu(cpu_sibling_mask, cpu2));
+    cpumask_set_cpu(cpu2, per_cpu(cpu_sibling_mask, cpu1));
+    cpumask_set_cpu(cpu1, per_cpu(cpu_core_mask, cpu2));
+    cpumask_set_cpu(cpu2, per_cpu(cpu_core_mask, cpu1));
 }
 
 static void set_cpu_sibling_map(int cpu)
@@ -262,13 +262,13 @@
     }
     else
     {
-        cpu_set(cpu, per_cpu(cpu_sibling_map, cpu));
+        cpumask_set_cpu(cpu, per_cpu(cpu_sibling_mask, cpu));
     }
 
     if ( c[cpu].x86_max_cores == 1 )
     {
-        cpumask_copy(&per_cpu(cpu_core_map, cpu),
-                     &per_cpu(cpu_sibling_map, cpu));
+        cpumask_copy(per_cpu(cpu_core_mask, cpu),
+                     per_cpu(cpu_sibling_mask, cpu));
         c[cpu].booted_cores = 1;
         return;
     }
@@ -277,18 +277,18 @@
     {
         if ( c[cpu].phys_proc_id == c[i].phys_proc_id )
         {
-            cpu_set(i, per_cpu(cpu_core_map, cpu));
-            cpu_set(cpu, per_cpu(cpu_core_map, i));
+            cpumask_set_cpu(i, per_cpu(cpu_core_mask, cpu));
+            cpumask_set_cpu(cpu, per_cpu(cpu_core_mask, i));
             /*
              *  Does this new cpu bringup a new core?
              */
-            if ( cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1 )
+            if ( cpumask_weight(per_cpu(cpu_sibling_mask, cpu)) == 1 )
             {
                 /*
                  * for each core in package, increment
                  * the booted_cores for this new cpu
                  */
-                if ( first_cpu(per_cpu(cpu_sibling_map, i)) == i )
+                if ( cpumask_first(per_cpu(cpu_sibling_mask, i)) == i )
                     c[cpu].booted_cores++;
                 /*
                  * increment the core count for all
@@ -641,13 +641,14 @@
 {
     unsigned int order;
 
+    free_cpumask_var(per_cpu(cpu_sibling_mask, cpu));
+    free_cpumask_var(per_cpu(cpu_core_mask, cpu));
+
     order = get_order_from_pages(NR_RESERVED_GDT_PAGES);
     free_xenheap_pages(per_cpu(gdt_table, cpu), order);
-    per_cpu(gdt_table, cpu) = NULL;
 
 #ifdef __x86_64__
     free_xenheap_pages(per_cpu(compat_gdt_table, cpu), order);
-    per_cpu(compat_gdt_table, cpu) = NULL;
 #endif
 
     order = get_order_from_bytes(IDT_ENTRIES * sizeof(idt_entry_t));
@@ -696,7 +697,9 @@
         goto oom;
     memcpy(idt_tables[cpu], idt_table, IDT_ENTRIES * sizeof(idt_entry_t));
 
-    return 0;
+    if ( zalloc_cpumask_var(&per_cpu(cpu_sibling_mask, cpu)) &&
+         zalloc_cpumask_var(&per_cpu(cpu_core_mask, cpu)) )
+        return 0;
 
  oom:
     cpu_smpboot_free(cpu);
@@ -744,6 +747,10 @@
 
     stack_base[0] = stack_start.esp;
 
+    if ( !zalloc_cpumask_var(&per_cpu(cpu_sibling_mask, 0)) ||
+         !zalloc_cpumask_var(&per_cpu(cpu_core_mask, 0)) )
+        panic("No memory for boot CPU sibling/core maps\n");
+
     set_cpu_sibling_map(0);
 
     /*
@@ -760,8 +767,6 @@
             printk(KERN_NOTICE "Local APIC not detected."
                    " Using dummy APIC emulation.\n");
         map_cpu_to_logical_apicid();
-        cpu_set(0, per_cpu(cpu_sibling_map, 0));
-        cpu_set(0, per_cpu(cpu_core_map, 0));
         return;
     }
 
@@ -792,13 +797,6 @@
     setup_local_APIC();
     map_cpu_to_logical_apicid();
 
-    /*
-     * construct cpu_sibling_map, so that we can tell sibling CPUs
-     * efficiently.
-     */
-    cpu_set(0, per_cpu(cpu_sibling_map, 0));
-    cpu_set(0, per_cpu(cpu_core_map, 0));
-
     smpboot_setup_io_apic();
 
     setup_boot_APIC_clock();
@@ -816,18 +814,18 @@
     int sibling;
     struct cpuinfo_x86 *c = cpu_data;
 
-    for_each_cpu_mask ( sibling, per_cpu(cpu_core_map, cpu) )
+    for_each_cpu_mask ( sibling, *per_cpu(cpu_core_mask, cpu) )
     {
-        cpu_clear(cpu, per_cpu(cpu_core_map, sibling));
+        cpumask_clear_cpu(cpu, per_cpu(cpu_core_mask, sibling));
         /* Last thread sibling in this cpu core going down. */
-        if ( cpumask_weight(&per_cpu(cpu_sibling_map, cpu)) == 1 )
+        if ( cpumask_weight(per_cpu(cpu_sibling_mask, cpu)) == 1 )
             c[sibling].booted_cores--;
     }
    
-    for_each_cpu_mask(sibling, per_cpu(cpu_sibling_map, cpu))
-        cpumask_clear_cpu(cpu, &per_cpu(cpu_sibling_map, sibling));
-    cpumask_clear(&per_cpu(cpu_sibling_map, cpu));
-    cpumask_clear(&per_cpu(cpu_core_map, cpu));
+    for_each_cpu_mask(sibling, *per_cpu(cpu_sibling_mask, cpu))
+        cpumask_clear_cpu(cpu, per_cpu(cpu_sibling_mask, sibling));
+    cpumask_clear(per_cpu(cpu_sibling_mask, cpu));
+    cpumask_clear(per_cpu(cpu_core_mask, cpu));
     c[cpu].phys_proc_id = BAD_APICID;
     c[cpu].cpu_core_id = BAD_APICID;
     c[cpu].compute_unit_id = BAD_APICID;
diff -r eef4641d6726 -r 253073b522f8 xen/arch/x86/sysctl.c
--- a/xen/arch/x86/sysctl.c	Fri Oct 21 09:22:02 2011 +0200
+++ b/xen/arch/x86/sysctl.c	Fri Oct 21 09:23:05 2011 +0200
@@ -76,9 +76,9 @@
 
         memset(pi, 0, sizeof(*pi));
         pi->threads_per_core =
-            cpus_weight(per_cpu(cpu_sibling_map, 0));
+            cpumask_weight(per_cpu(cpu_sibling_mask, 0));
         pi->cores_per_socket =
-            cpus_weight(per_cpu(cpu_core_map, 0)) / pi->threads_per_core;
+            cpumask_weight(per_cpu(cpu_core_mask, 0)) / pi->threads_per_core;
         pi->nr_cpus = num_online_cpus();
         pi->nr_nodes = num_online_nodes();
         pi->max_node_id = MAX_NUMNODES-1;
diff -r eef4641d6726 -r 253073b522f8 xen/common/domctl.c
--- a/xen/common/domctl.c	Fri Oct 21 09:22:02 2011 +0200
+++ b/xen/common/domctl.c	Fri Oct 21 09:23:05 2011 +0200
@@ -171,7 +171,7 @@
      * If we're on a HT system, we only auto-allocate to a non-primary HT. We 
      * favour high numbered CPUs in the event of a tie.
      */
-    cpumask_copy(&cpu_exclude_map, &per_cpu(cpu_sibling_map, 0));
+    cpumask_copy(&cpu_exclude_map, per_cpu(cpu_sibling_mask, 0));
     cpu = cpumask_first(&cpu_exclude_map);
     if ( cpumask_weight(&cpu_exclude_map) > 1 )
         cpu = cpumask_next(cpu, &cpu_exclude_map);
@@ -179,11 +179,11 @@
     {
         if ( cpumask_test_cpu(i, &cpu_exclude_map) )
             continue;
-        if ( (i == cpumask_first(&per_cpu(cpu_sibling_map, i))) &&
-             (cpumask_weight(&per_cpu(cpu_sibling_map, i)) > 1) )
+        if ( (i == cpumask_first(per_cpu(cpu_sibling_mask, i))) &&
+             (cpumask_weight(per_cpu(cpu_sibling_mask, i)) > 1) )
             continue;
         cpumask_or(&cpu_exclude_map, &cpu_exclude_map,
-                   &per_cpu(cpu_sibling_map, i));
+                   per_cpu(cpu_sibling_mask, i));
         if ( !cnt || cnt[i] <= cnt[cpu] )
             cpu = i;
     }
diff -r eef4641d6726 -r 253073b522f8 xen/common/keyhandler.c
--- a/xen/common/keyhandler.c	Fri Oct 21 09:22:02 2011 +0200
+++ b/xen/common/keyhandler.c	Fri Oct 21 09:23:05 2011 +0200
@@ -210,7 +210,7 @@
 static void cpuset_print(char *set, int size, const cpumask_t *mask)
 {
     *set++ = '{';
-    set += cpulist_scnprintf(set, size-2, *mask);
+    set += cpulist_scnprintf(set, size-2, mask);
     *set++ = '}';
     *set++ = '\0';
 }
diff -r eef4641d6726 -r 253073b522f8 xen/common/sched_credit.c
--- a/xen/common/sched_credit.c	Fri Oct 21 09:22:02 2011 +0200
+++ b/xen/common/sched_credit.c	Fri Oct 21 09:23:05 2011 +0200
@@ -502,23 +502,23 @@
 
         nxt = cpumask_cycle(cpu, &cpus);
 
-        if ( cpumask_test_cpu(cpu, &per_cpu(cpu_core_map, nxt)) )
+        if ( cpumask_test_cpu(cpu, per_cpu(cpu_core_mask, nxt)) )
         {
             /* We're on the same socket, so check the busy-ness of threads.
              * Migrate if # of idlers is less at all */
-            ASSERT( cpumask_test_cpu(nxt, &per_cpu(cpu_core_map, cpu)) );
+            ASSERT( cpumask_test_cpu(nxt, per_cpu(cpu_core_mask, cpu)) );
             migrate_factor = 1;
-            cpumask_and(&cpu_idlers, &idlers, &per_cpu(cpu_sibling_map, cpu));
-            cpumask_and(&nxt_idlers, &idlers, &per_cpu(cpu_sibling_map, nxt));
+            cpumask_and(&cpu_idlers, &idlers, per_cpu(cpu_sibling_mask, cpu));
+            cpumask_and(&nxt_idlers, &idlers, per_cpu(cpu_sibling_mask, nxt));
         }
         else
         {
             /* We're on different sockets, so check the busy-ness of cores.
              * Migrate only if the other core is twice as idle */
-            ASSERT( !cpumask_test_cpu(nxt, &per_cpu(cpu_core_map, cpu)) );
+            ASSERT( !cpumask_test_cpu(nxt, per_cpu(cpu_core_mask, cpu)) );
             migrate_factor = 2;
-            cpumask_and(&cpu_idlers, &idlers, &per_cpu(cpu_core_map, cpu));
-            cpumask_and(&nxt_idlers, &idlers, &per_cpu(cpu_core_map, nxt));
+            cpumask_and(&cpu_idlers, &idlers, per_cpu(cpu_core_mask, cpu));
+            cpumask_and(&nxt_idlers, &idlers, per_cpu(cpu_core_mask, nxt));
         }
 
         weight_cpu = cpumask_weight(&cpu_idlers);
@@ -531,7 +531,7 @@
             cpumask_and(&nxt_idlers, &cpus, &nxt_idlers);
             spc = CSCHED_PCPU(nxt);
             cpu = cpumask_cycle(spc->idle_bias, &nxt_idlers);
-            cpumask_andnot(&cpus, &cpus, &per_cpu(cpu_sibling_map, cpu));
+            cpumask_andnot(&cpus, &cpus, per_cpu(cpu_sibling_mask, cpu));
         }
         else
         {
@@ -1419,9 +1419,9 @@
     spc = CSCHED_PCPU(cpu);
     runq = &spc->runq;
 
-    cpumask_scnprintf(cpustr, sizeof(cpustr), per_cpu(cpu_sibling_map, cpu));
+    cpumask_scnprintf(cpustr, sizeof(cpustr), per_cpu(cpu_sibling_mask, cpu));
     printk(" sort=%d, sibling=%s, ", spc->runq_sort_last, cpustr);
-    cpumask_scnprintf(cpustr, sizeof(cpustr), per_cpu(cpu_core_map, cpu));
+    cpumask_scnprintf(cpustr, sizeof(cpustr), per_cpu(cpu_core_mask, cpu));
     printk("core=%s\n", cpustr);
 
     /* current VCPU */
@@ -1481,7 +1481,7 @@
            prv->ticks_per_tslice,
            vcpu_migration_delay);
 
-    cpumask_scnprintf(idlers_buf, sizeof(idlers_buf), prv->idlers);
+    cpumask_scnprintf(idlers_buf, sizeof(idlers_buf), &prv->idlers);
     printk("idlers: %s\n", idlers_buf);
 
     printk("active vcpus:\n");
diff -r eef4641d6726 -r 253073b522f8 xen/common/sched_credit2.c
--- a/xen/common/sched_credit2.c	Fri Oct 21 09:22:02 2011 +0200
+++ b/xen/common/sched_credit2.c	Fri Oct 21 09:23:05 2011 +0200
@@ -1767,9 +1767,9 @@
 
     runq = &RQD(ops, cpu)->runq;
 
-    cpumask_scnprintf(cpustr, sizeof(cpustr), per_cpu(cpu_sibling_map,cpu));
+    cpumask_scnprintf(cpustr, sizeof(cpustr), per_cpu(cpu_sibling_mask, cpu));
     printk(" sibling=%s, ", cpustr);
-    cpumask_scnprintf(cpustr, sizeof(cpustr), per_cpu(cpu_core_map,cpu));
+    cpumask_scnprintf(cpustr, sizeof(cpustr), per_cpu(cpu_core_mask, cpu));
     printk("core=%s\n", cpustr);
 
     /* current VCPU */
diff -r eef4641d6726 -r 253073b522f8 xen/include/asm-ia64/linux-xen/asm/smp.h
--- a/xen/include/asm-ia64/linux-xen/asm/smp.h	Fri Oct 21 09:22:02 2011 +0200
+++ b/xen/include/asm-ia64/linux-xen/asm/smp.h	Fri Oct 21 09:23:05 2011 +0200
@@ -62,8 +62,8 @@
 extern cpumask_t cpu_online_map;
 #define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
 
-DECLARE_PER_CPU(cpumask_t, cpu_core_map);
-DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
+DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask);
+DECLARE_PER_CPU(cpumask_var_t, cpu_sibling_mask);
 extern int smp_num_siblings;
 extern int smp_num_cpucores;
 extern void __iomem *ipi_base_addr;
diff -r eef4641d6726 -r 253073b522f8 xen/include/asm-x86/smp.h
--- a/xen/include/asm-x86/smp.h	Fri Oct 21 09:22:02 2011 +0200
+++ b/xen/include/asm-x86/smp.h	Fri Oct 21 09:23:05 2011 +0200
@@ -25,8 +25,8 @@
  */
  
 extern void smp_alloc_memory(void);
-DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
-DECLARE_PER_CPU(cpumask_t, cpu_core_map);
+DECLARE_PER_CPU(cpumask_var_t, cpu_sibling_mask);
+DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask);
 
 void smp_send_nmi_allbutself(void);
 
diff -r eef4641d6726 -r 253073b522f8 xen/include/xen/cpumask.h
--- a/xen/include/xen/cpumask.h	Fri Oct 21 09:22:02 2011 +0200
+++ b/xen/include/xen/cpumask.h	Fri Oct 21 09:23:05 2011 +0200
@@ -320,20 +320,16 @@
 #define cpus_addr(src) ((src).bits)
 #define cpumask_bits(maskp) ((maskp)->bits)
 
-#define cpumask_scnprintf(buf, len, src) \
-	__cpumask_scnprintf((buf), (len), &(src), nr_cpu_ids)
-static inline int __cpumask_scnprintf(char *buf, int len,
-					const cpumask_t *srcp, int nbits)
+static inline int cpumask_scnprintf(char *buf, int len,
+				    const cpumask_t *srcp)
 {
-	return bitmap_scnprintf(buf, len, srcp->bits, nbits);
+	return bitmap_scnprintf(buf, len, srcp->bits, nr_cpu_ids);
 }
 
-#define cpulist_scnprintf(buf, len, src) \
-	__cpulist_scnprintf((buf), (len), &(src), nr_cpu_ids)
-static inline int __cpulist_scnprintf(char *buf, int len,
-					const cpumask_t *srcp, int nbits)
+static inline int cpulist_scnprintf(char *buf, int len,
+				    const cpumask_t *srcp)
 {
-	return bitmap_scnlistprintf(buf, len, srcp->bits, nbits);
+	return bitmap_scnlistprintf(buf, len, srcp->bits, nr_cpu_ids);
 }
 
 /*

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 24 17:57:34 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 24 Oct 2011 17:57:34 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RIVKg-0000Z1-50; Mon, 24 Oct 2011 17:57:34 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RIVIW-0008Kg-SV
	for xen-changelog@lists.xensource.com; Mon, 24 Oct 2011 17:55:21 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-216.messagelabs.com!1319504117!916326!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25943 invoked from network); 25 Oct 2011 00:55:17 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	25 Oct 2011 00:55:17 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RIVIT-0006A0-L2
	for xen-changelog@lists.xensource.com; Tue, 25 Oct 2011 01:55:17 +0100
Message-Id: <E1RIVIT-0006A0-L2@xenbits.xen.org>
Date: Tue, 25 Oct 2011 01:55:17 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/hpet: fix cpumask allocation
	after 23990:1c8789852eaf
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 Jan Beulich <jbeulich@novell.com>
# Date 1319475667 -3600
# Node ID 662dbf6ee71c3bd14db0d32cc69b85f8513527e3
# Parent  e458dfc35b8d3be04a9b72c30ff97163e27a7314
x86/hpet: fix cpumask allocation after 23990:1c8789852eaf

hpet_fsb_cap_lookup(), if it doesn't find any FSB capable timer,
leaves hpet_events allocated, while hpet_events->cpumask may not have
been, As we're pretty generous with these one-time allocations already
(in that hpet_events doesn't get freed when no usable counters were
found, even if in that case only the first array entry [or none at
all] may get used), simply make the cpumask allocation in the legacy
case independent of whether hpet_events was NULL before.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Christoph Egger <Christoph.Egger@amd.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r e458dfc35b8d -r 662dbf6ee71c xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c	Mon Oct 24 18:00:20 2011 +0100
+++ b/xen/arch/x86/hpet.c	Mon Oct 24 18:01:07 2011 +0100
@@ -512,15 +512,8 @@
             return;
 
         if ( !hpet_events )
-        {
             hpet_events = xzalloc(struct hpet_event_channel);
-            if ( hpet_events && !zalloc_cpumask_var(&hpet_events->cpumask) )
-            {
-                xfree(hpet_events);
-                hpet_events = NULL;
-            }
-        }
-        if ( !hpet_events )
+        if ( !hpet_events || !zalloc_cpumask_var(&hpet_events->cpumask) )
             return;
         hpet_events->irq = -1;
 

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

From xen-changelog-bounces@lists.xensource.com Mon Oct 24 17:57:44 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 24 Oct 2011 17:57:44 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RIVKq-0000c9-Gm; Mon, 24 Oct 2011 17:57:44 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RIVIW-0008Kf-ML
	for xen-changelog@lists.xensource.com; Mon, 24 Oct 2011 17:55:21 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-182.messagelabs.com!1319504117!618234!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14839 invoked from network); 25 Oct 2011 00:55:17 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	25 Oct 2011 00:55:17 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RIVIT-00069L-42
	for xen-changelog@lists.xensource.com; Tue, 25 Oct 2011 01:55:17 +0100
Message-Id: <E1RIVIT-00069L-42@xenbits.xen.org>
Date: Tue, 25 Oct 2011 01:55:16 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/ucode-amd: fix regression from
	c/s 23871:503ee256fecf
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 Jan Beulich <jbeulich@novell.com>
# Date 1319475620 -3600
# Node ID e458dfc35b8d3be04a9b72c30ff97163e27a7314
# Parent  ffe861c1d5dfa8f4485052e5600e06124105033f
x86/ucode-amd: fix regression from c/s 23871:503ee256fecf

microcode_fits() must return distinct values for the success and
no-fit-but-no-error cases, so the caller can react accordingly. Make
it return 1 in the success case, and adjust its single caller.

Also remove an impossible code path - install_equiv_cpu_table(), which
gets called prior to microcode_fits(), never leaves equiv_cpu_table
being NULL without also returning an error.

Note that this is still awaiting testing on a system where the
regression was actually observed (which also requires a new enough
microcode_ctl package). Note also that this will need to be
backported to 4.0 and 4.1 (or the broken c/s that got backported
there reverted).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r ffe861c1d5df -r e458dfc35b8d xen/arch/x86/microcode_amd.c
--- a/xen/arch/x86/microcode_amd.c	Mon Oct 24 11:29:08 2011 +0100
+++ b/xen/arch/x86/microcode_amd.c	Mon Oct 24 18:00:20 2011 +0100
@@ -76,14 +76,6 @@
     /* We should bind the task to the CPU */
     BUG_ON(cpu != raw_smp_processor_id());
 
-    if ( equiv_cpu_table == NULL )
-    {
-        printk(KERN_INFO "microcode: CPU%d microcode update with "
-               "version 0x%x (current=0x%x)\n",
-               cpu, mc_header->patch_id, uci->cpu_sig.rev);
-        goto out;
-    }
-
     current_cpu_id = cpuid_eax(0x00000001);
 
     for ( i = 0; equiv_cpu_table[i].installed_cpu != 0; i++ )
@@ -96,7 +88,7 @@
     }
 
     if ( !equiv_cpu_id )
-	    return 0;
+        return 0;
 
     if ( (mc_header->processor_rev_id) != equiv_cpu_id )
     {
@@ -113,8 +105,7 @@
            "update with version 0x%x (current=0x%x)\n",
            cpu, mc_header->patch_id, uci->cpu_sig.rev);
 
-out:
-    return 0;
+    return 1;
 }
 
 static int apply_microcode(int cpu)
@@ -285,7 +276,7 @@
     while ( (ret = get_next_ucode_from_buffer_amd(mc, buf, size, &offset)) == 0)
     {
         error = microcode_fits(mc, cpu);
-        if (error != 0)
+        if (error <= 0)
             continue;
 
         error = apply_microcode(cpu);

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

From xen-changelog-bounces@lists.xensource.com Tue Oct 25 06:44:47 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 25 Oct 2011 06:44:47 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RIhJ9-0004nO-AW; Tue, 25 Oct 2011 06:44:47 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RIhIb-0004aS-D5
	for xen-changelog@lists.xensource.com; Tue, 25 Oct 2011 06:44:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-182.messagelabs.com!1319550250!701477!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1272 invoked from network); 25 Oct 2011 13:44:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	25 Oct 2011 13:44:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RIhIY-0005nT-1T
	for xen-changelog@lists.xensource.com; Tue, 25 Oct 2011 14:44:10 +0100
Message-Id: <E1RIhIY-0005nT-1T@xenbits.xen.org>
Date: Tue, 25 Oct 2011 14:44:09 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] Revert
	xen-unstable:23871:503ee256fecf
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@xen.org>
# Date 1319475815 -3600
# Node ID 81e39a4978ea14e0180ce4692b889083c279773f
# Parent  247fadffacabb1a5ffa7e9f4b61e251e94008c9c
Revert xen-unstable:23871:503ee256fecf

Signed-off-by: Keir Fraser <keir@xen.org>
---


diff -r 247fadffacab -r 81e39a4978ea xen/arch/x86/microcode_amd.c
--- a/xen/arch/x86/microcode_amd.c	Mon Oct 24 18:02:42 2011 +0100
+++ b/xen/arch/x86/microcode_amd.c	Mon Oct 24 18:03:35 2011 +0100
@@ -96,7 +96,11 @@
     }
 
     if ( !equiv_cpu_id )
-	    return 0;
+    {
+        printk(KERN_ERR "microcode: CPU%d cpu_id "
+               "not found in equivalent cpu table\n", cpu);
+        return -EINVAL;
+    }
 
     if ( (mc_header->processor_rev_id) != equiv_cpu_id )
     {

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

From xen-changelog-bounces@lists.xensource.com Tue Oct 25 06:44:57 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 25 Oct 2011 06:44:57 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RIhJI-0004r8-LB; Tue, 25 Oct 2011 06:44:56 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RIhIb-0004aR-Ar
	for xen-changelog@lists.xensource.com; Tue, 25 Oct 2011 06:44:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-174.messagelabs.com!1319550249!36599234!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18527 invoked from network); 25 Oct 2011 13:44:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	25 Oct 2011 13:44:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RIhIX-0005nE-EO
	for xen-changelog@lists.xensource.com; Tue, 25 Oct 2011 14:44:09 +0100
Message-Id: <E1RIhIX-0005nE-EO@xenbits.xen.org>
Date: Tue, 25 Oct 2011 14:44:08 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] Update Xen version to
	4.1.3-rc1-pre
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@xen.org>
# Date 1319475762 -3600
# Node ID 247fadffacabb1a5ffa7e9f4b61e251e94008c9c
# Parent  d4253bc5418b64a4b3a0e04b7d514ac15f5fe124
Update Xen version to 4.1.3-rc1-pre
---


diff -r d4253bc5418b -r 247fadffacab xen/Makefile
--- a/xen/Makefile	Thu Oct 20 17:36:03 2011 +0100
+++ b/xen/Makefile	Mon Oct 24 18:02:42 2011 +0100
@@ -2,7 +2,7 @@
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
 export XEN_SUBVERSION    = 1
-export XEN_EXTRAVERSION ?= .2$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .3-rc1-pre$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 

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

From xen-changelog-bounces@lists.xensource.com Tue Oct 25 17:03:47 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 25 Oct 2011 17:03:47 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RIqyA-0001S3-J4; Tue, 25 Oct 2011 17:03:46 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RIquk-00011S-7u
	for xen-changelog@lists.xensource.com; Tue, 25 Oct 2011 17:00:20 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-21.messagelabs.com!1319587210!1671946!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30469 invoked from network); 26 Oct 2011 00:00:11 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	26 Oct 2011 00:00:11 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RIqug-0007dY-CQ
	for xen-changelog@lists.xensource.com; Wed, 26 Oct 2011 01:00:10 +0100
Message-Id: <E1RIqug-0007dY-CQ@xenbits.xen.org>
Date: Wed, 26 Oct 2011 01:00:09 +0100
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] amd xsave: Move xsave
	initialization code to a common place
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 Wei Huang <wei.huang2@amd.com>
# Date 1319557480 -3600
# Node ID a5cc3b953ed99f61a2cfbef72a9f8befdfa49a24
# Parent  da9f945b3db87567bcc7b7c031a4a9c1975e0dcd
amd xsave: Move xsave initialization code to a common place

This patch moves xsave/xrstor code to CPU common file. First of all,
it prepares xsave/xrstor support for AMD CPUs. Secondly, Xen would
crash on __context_switch() without this patch on xsave-capable AMD
CPUs. The crash was due to cpu_has_xsave reports true in domain.c
while xsave space wasn't initialized.

Signed-off-by: Wei Huang <wei.huang2@amd.com>
xen-unstable changeset:   22462:98eb4a334b77
xen-unstable date:        Tue Dec 07 18:26:38 2010 +0000
---


diff -r da9f945b3db8 -r a5cc3b953ed9 xen/arch/x86/cpu/common.c
--- a/xen/arch/x86/cpu/common.c	Mon Oct 24 18:04:42 2011 +0100
+++ b/xen/arch/x86/cpu/common.c	Tue Oct 25 16:44:40 2011 +0100
@@ -22,6 +22,9 @@
 static int disable_x86_fxsr __cpuinitdata;
 static int disable_x86_serial_nr __cpuinitdata;
 
+static int use_xsave;
+boolean_param("xsave", use_xsave);
+
 struct cpu_dev * cpu_devs[X86_VENDOR_NUM] = {};
 
 /*
@@ -391,6 +394,13 @@
 	if (this_cpu->c_init)
 		this_cpu->c_init(c);
 
+        /* Initialize xsave/xrstor features */
+	if ( !use_xsave )
+		clear_bit(X86_FEATURE_XSAVE, boot_cpu_data.x86_capability);
+
+	if ( cpu_has_xsave )
+		xsave_init();
+
 	/* Disable the PN if appropriate */
 	squash_the_stupid_serial_number(c);
 
diff -r da9f945b3db8 -r a5cc3b953ed9 xen/arch/x86/cpu/intel.c
--- a/xen/arch/x86/cpu/intel.c	Mon Oct 24 18:04:42 2011 +0100
+++ b/xen/arch/x86/cpu/intel.c	Tue Oct 25 16:44:40 2011 +0100
@@ -30,9 +30,6 @@
 integer_param("cpuid_mask_ecx", opt_cpuid_mask_ecx);
 integer_param("cpuid_mask_edx", opt_cpuid_mask_edx);
 
-static int use_xsave;
-boolean_param("xsave", use_xsave);
-
 #ifdef CONFIG_X86_INTEL_USERCOPY
 /*
  * Alignment at which movsl is preferred for bulk memory copies.
@@ -219,12 +216,6 @@
 		set_bit(X86_FEATURE_ARAT, c->x86_capability);
 
 	start_vmx();
-
-	if ( !use_xsave )
-		clear_bit(X86_FEATURE_XSAVE, boot_cpu_data.x86_capability);
-
-	if ( cpu_has_xsave )
-		xsave_init();
 }
 
 

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

From xen-changelog-bounces@lists.xensource.com Wed Oct 26 12:55:18 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 26 Oct 2011 12:55:18 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RJ9ZG-0004bW-CL; Wed, 26 Oct 2011 12:55:18 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RJ9ZC-0004ad-SY
	for xen-changelog@lists.xensource.com; Wed, 26 Oct 2011 12:55:15 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-174.messagelabs.com!1319658911!36779584!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7285 invoked from network); 26 Oct 2011 19:55:11 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-11.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	26 Oct 2011 19:55:11 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RJ9Z8-0001jr-RY
	for xen-changelog@lists.xensource.com; Wed, 26 Oct 2011 20:55:10 +0100
Message-Id: <E1RJ9Z8-0001jr-RY@xenbits.xen.org>
Date: Wed, 26 Oct 2011 20:55:09 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86 pm: provide CC7/PC2 residency
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 Yang Zhang <yang.z.zhang@intel.com>
# Date 1319557607 -3600
# Node ID 8943a9696358eb4f879cb64053a5f296de4ff173
# Parent  662dbf6ee71c3bd14db0d32cc69b85f8513527e3
x86 pm: provide CC7/PC2 residency

Sandy bridge introduces new MSR to get cc7/pc2 residency (core C-state
7/package C-state 2). Print the cc7/pc2 residency when on sandy bridge
platform.

Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 662dbf6ee71c -r 8943a9696358 tools/libxc/xc_pm.c
--- a/tools/libxc/xc_pm.c	Mon Oct 24 18:01:07 2011 +0100
+++ b/tools/libxc/xc_pm.c	Tue Oct 25 16:46:47 2011 +0100
@@ -155,11 +155,13 @@
     cxpt->nr = sysctl.u.get_pmstat.u.getcx.nr;
     cxpt->last = sysctl.u.get_pmstat.u.getcx.last;
     cxpt->idle_time = sysctl.u.get_pmstat.u.getcx.idle_time;
+    cxpt->pc2 = sysctl.u.get_pmstat.u.getcx.pc2;
     cxpt->pc3 = sysctl.u.get_pmstat.u.getcx.pc3;
     cxpt->pc6 = sysctl.u.get_pmstat.u.getcx.pc6;
     cxpt->pc7 = sysctl.u.get_pmstat.u.getcx.pc7;
     cxpt->cc3 = sysctl.u.get_pmstat.u.getcx.cc3;
     cxpt->cc6 = sysctl.u.get_pmstat.u.getcx.cc6;
+    cxpt->cc7 = sysctl.u.get_pmstat.u.getcx.cc7;
 
 unlock_2:
     xc_hypercall_bounce_post(xch, residencies);
diff -r 662dbf6ee71c -r 8943a9696358 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h	Mon Oct 24 18:01:07 2011 +0100
+++ b/tools/libxc/xenctrl.h	Tue Oct 25 16:46:47 2011 +0100
@@ -1733,11 +1733,13 @@
     uint64_t idle_time;    /* idle time from boot */
     uint64_t *triggers;    /* Cx trigger counts */
     uint64_t *residencies; /* Cx residencies */
+    uint64_t pc2;
     uint64_t pc3;
     uint64_t pc6;
     uint64_t pc7;
     uint64_t cc3;
     uint64_t cc6;
+    uint64_t cc7;
 };
 typedef struct xc_cx_stat xc_cx_stat_t;
 
diff -r 662dbf6ee71c -r 8943a9696358 tools/misc/xenpm.c
--- a/tools/misc/xenpm.c	Mon Oct 24 18:01:07 2011 +0100
+++ b/tools/misc/xenpm.c	Tue Oct 25 16:46:47 2011 +0100
@@ -92,13 +92,17 @@
         printf("                       residency  [%020"PRIu64" ms]\n",
                cxstat->residencies[i]/1000000UL);
     }
-    printf("pc3                  : [%020"PRIu64" ms]\n"
+    printf("pc2                  : [%020"PRIu64" ms]\n"
+           "pc3                  : [%020"PRIu64" ms]\n"
            "pc6                  : [%020"PRIu64" ms]\n"
            "pc7                  : [%020"PRIu64" ms]\n",
-           cxstat->pc3/1000000UL, cxstat->pc6/1000000UL, cxstat->pc7/1000000UL);
+            cxstat->pc2/1000000UL, cxstat->pc3/1000000UL,
+            cxstat->pc6/1000000UL, cxstat->pc7/1000000UL);
     printf("cc3                  : [%020"PRIu64" ms]\n"
-           "cc6                  : [%020"PRIu64" ms]\n",
-           cxstat->cc3/1000000UL, cxstat->cc6/1000000UL);
+           "cc6                  : [%020"PRIu64" ms]\n"
+           "cc7                  : [%020"PRIu64" ms]\n",
+            cxstat->cc3/1000000UL, cxstat->cc6/1000000UL,
+            cxstat->cc7/1000000UL);
     printf("\n");
 }
 
@@ -458,6 +462,9 @@
                         break;
                 }
                 printf("Socket %d\n", socket_ids[i]);
+                res = cxstat_end[j].pc2 - cxstat_start[j].pc2;
+                printf("\tPC2\t%"PRIu64" ms\t%.2f%%\n",  res / 1000000UL,
+                       100UL * res / (double)sum_cx[j]);
                 res = cxstat_end[j].pc3 - cxstat_start[j].pc3;
                 printf("\tPC3\t%"PRIu64" ms\t%.2f%%\n",  res / 1000000UL, 
                        100UL * res / (double)sum_cx[j]);
@@ -482,6 +489,9 @@
                     res = cxstat_end[j].cc6 - cxstat_start[j].cc6;
                     printf("\t\tCC6\t%"PRIu64" ms\t%.2f%%\n",  res / 1000000UL, 
                            100UL * res / (double)sum_cx[j]);
+                    res = cxstat_end[j].cc7 - cxstat_start[j].cc7;
+                    printf("\t\tCC7\t%"PRIu64" ms\t%.2f%%\n",  res / 1000000UL,
+                           100UL * res / (double)sum_cx[j]);
                     printf("\n");
 
                 }
diff -r 662dbf6ee71c -r 8943a9696358 xen/arch/x86/acpi/cpu_idle.c
--- a/xen/arch/x86/acpi/cpu_idle.c	Mon Oct 24 18:01:07 2011 +0100
+++ b/xen/arch/x86/acpi/cpu_idle.c	Tue Oct 25 16:46:47 2011 +0100
@@ -60,11 +60,13 @@
 
 #define GET_HW_RES_IN_NS(msr, val) \
     do { rdmsrl(msr, val); val = tsc_ticks2ns(val); } while( 0 )
+#define GET_PC2_RES(val)  GET_HW_RES_IN_NS(0x60D, val) /* SNB only */
 #define GET_PC3_RES(val)  GET_HW_RES_IN_NS(0x3F8, val)
 #define GET_PC6_RES(val)  GET_HW_RES_IN_NS(0x3F9, val)
 #define GET_PC7_RES(val)  GET_HW_RES_IN_NS(0x3FA, val)
 #define GET_CC3_RES(val)  GET_HW_RES_IN_NS(0x3FC, val)
 #define GET_CC6_RES(val)  GET_HW_RES_IN_NS(0x3FD, val)
+#define GET_CC7_RES(val)  GET_HW_RES_IN_NS(0x3FE, val) /* SNB only */
 
 static void lapic_timer_nop(void) { }
 static void (*lapic_timer_off)(void);
@@ -85,11 +87,13 @@
 
 struct hw_residencies
 {
+    uint64_t pc2;
     uint64_t pc3;
     uint64_t pc6;
     uint64_t pc7;
     uint64_t cc3;
     uint64_t cc6;
+    uint64_t cc7;
 };
 
 static void do_get_hw_residencies(void *arg)
@@ -116,6 +120,17 @@
         GET_CC3_RES(hw_res->cc3);
         GET_CC6_RES(hw_res->cc6);
         break;
+    /* Sandy bridge */
+    case 0x2A:
+    case 0x2D:
+        GET_PC2_RES(hw_res->pc2);
+        GET_PC3_RES(hw_res->pc3);
+        GET_PC6_RES(hw_res->pc6);
+        GET_PC7_RES(hw_res->pc7);
+        GET_CC3_RES(hw_res->cc3);
+        GET_CC6_RES(hw_res->cc6);
+        GET_CC7_RES(hw_res->cc7);
+        break;
     }
 }
 
@@ -134,10 +149,10 @@
 
     get_hw_residencies(cpu, &hw_res);
 
-    printk("PC3[%"PRId64"] PC6[%"PRId64"] PC7[%"PRId64"]\n",
-           hw_res.pc3, hw_res.pc6, hw_res.pc7);
-    printk("CC3[%"PRId64"] CC6[%"PRId64"]\n",
-           hw_res.cc3, hw_res.cc6);
+    printk("PC2[%"PRId64"] PC3[%"PRId64"] PC6[%"PRId64"] PC7[%"PRId64"]\n",
+           hw_res.pc2, hw_res.pc3, hw_res.pc6, hw_res.pc7);
+    printk("CC3[%"PRId64"] CC6[%"PRId64"] CC7[%"PRId64"]\n",
+           hw_res.cc3, hw_res.cc6,hw_res.cc7);
 }
 
 static char* acpi_cstate_method_name[] =
@@ -1057,11 +1072,13 @@
              copy_to_guest_offset(stat->residencies, 0, &res, 1) )
             return -EFAULT;
 
+        stat->pc2 = 0;
         stat->pc3 = 0;
         stat->pc6 = 0;
         stat->pc7 = 0;
         stat->cc3 = 0;
         stat->cc6 = 0;
+        stat->cc7 = 0;
         return 0;
     }
 
@@ -1086,11 +1103,13 @@
 
     get_hw_residencies(cpuid, &hw_res);
 
+    stat->pc2 = hw_res.pc2;
     stat->pc3 = hw_res.pc3;
     stat->pc6 = hw_res.pc6;
     stat->pc7 = hw_res.pc7;
     stat->cc3 = hw_res.cc3;
     stat->cc6 = hw_res.cc6;
+    stat->cc7 = hw_res.cc7;
 
     return 0;
 }
diff -r 662dbf6ee71c -r 8943a9696358 xen/include/public/sysctl.h
--- a/xen/include/public/sysctl.h	Mon Oct 24 18:01:07 2011 +0100
+++ b/xen/include/public/sysctl.h	Tue Oct 25 16:46:47 2011 +0100
@@ -225,11 +225,13 @@
     uint64_aligned_t idle_time;                 /* idle time from boot */
     XEN_GUEST_HANDLE_64(uint64) triggers;    /* Cx trigger counts */
     XEN_GUEST_HANDLE_64(uint64) residencies; /* Cx residencies */
+    uint64_aligned_t pc2;
     uint64_aligned_t pc3;
     uint64_aligned_t pc6;
     uint64_aligned_t pc7;
     uint64_aligned_t cc3;
     uint64_aligned_t cc6;
+    uint64_aligned_t cc7;
 };
 
 struct xen_sysctl_get_pmstat {

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

From xen-changelog-bounces@lists.xensource.com Wed Oct 26 12:55:28 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 26 Oct 2011 12:55:28 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RJ9ZP-0004el-SF; Wed, 26 Oct 2011 12:55:27 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RJ9ZC-0004ae-VS
	for xen-changelog@lists.xensource.com; Wed, 26 Oct 2011 12:55:15 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1319658911!36827445!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11846 invoked from network); 26 Oct 2011 19:55:11 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	26 Oct 2011 19:55:11 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RJ9Z9-0001lC-FZ
	for xen-changelog@lists.xensource.com; Wed, 26 Oct 2011 20:55:11 +0100
Message-Id: <E1RJ9Z9-0001lC-FZ@xenbits.xen.org>
Date: Wed, 26 Oct 2011 20:55:10 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] hvm: Clean up I/O 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 Christoph Egger <Christoph.Egger@amd.com>
# Date 1319557697 -3600
# Node ID 51a0c81a40302ac8fd0ce8066ba16d2e3fdd7664
# Parent  8943a9696358eb4f879cb64053a5f296de4ff173
hvm: Clean up I/O emulation

Move HVM io fields into a structure.
On MMIO instruction failure print out some more bytes.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 8943a9696358 -r 51a0c81a4030 xen/arch/x86/hvm/emulate.c
--- a/xen/arch/x86/hvm/emulate.c	Tue Oct 25 16:46:47 2011 +0100
+++ b/xen/arch/x86/hvm/emulate.c	Tue Oct 25 16:48:17 2011 +0100
@@ -55,6 +55,7 @@
     paddr_t value = ram_gpa;
     int value_is_ptr = (p_data == NULL);
     struct vcpu *curr = current;
+    struct hvm_vcpu_io *vio;
     ioreq_t *p = get_ioreq(curr);
     unsigned long ram_gfn = paddr_to_pfn(ram_gpa);
     p2m_type_t p2mt;
@@ -90,43 +91,45 @@
         p_data = NULL;
     }
 
+    vio = &curr->arch.hvm_vcpu.hvm_io;
+
     if ( is_mmio && !value_is_ptr )
     {
         /* Part of a multi-cycle read or write? */
         if ( dir == IOREQ_WRITE )
         {
-            paddr_t pa = curr->arch.hvm_vcpu.mmio_large_write_pa;
-            unsigned int bytes = curr->arch.hvm_vcpu.mmio_large_write_bytes;
+            paddr_t pa = vio->mmio_large_write_pa;
+            unsigned int bytes = vio->mmio_large_write_bytes;
             if ( (addr >= pa) && ((addr + size) <= (pa + bytes)) )
                 return X86EMUL_OKAY;
         }
         else
         {
-            paddr_t pa = curr->arch.hvm_vcpu.mmio_large_read_pa;
-            unsigned int bytes = curr->arch.hvm_vcpu.mmio_large_read_bytes;
+            paddr_t pa = vio->mmio_large_read_pa;
+            unsigned int bytes = vio->mmio_large_read_bytes;
             if ( (addr >= pa) && ((addr + size) <= (pa + bytes)) )
             {
-                memcpy(p_data, &curr->arch.hvm_vcpu.mmio_large_read[addr - pa],
+                memcpy(p_data, &vio->mmio_large_read[addr - pa],
                        size);
                 return X86EMUL_OKAY;
             }
         }
     }
 
-    switch ( curr->arch.hvm_vcpu.io_state )
+    switch ( vio->io_state )
     {
     case HVMIO_none:
         break;
     case HVMIO_completed:
-        curr->arch.hvm_vcpu.io_state = HVMIO_none;
+        vio->io_state = HVMIO_none;
         if ( p_data == NULL )
             return X86EMUL_UNHANDLEABLE;
         goto finish_access;
     case HVMIO_dispatched:
         /* May have to wait for previous cycle of a multi-write to complete. */
         if ( is_mmio && !value_is_ptr && (dir == IOREQ_WRITE) &&
-             (addr == (curr->arch.hvm_vcpu.mmio_large_write_pa +
-                       curr->arch.hvm_vcpu.mmio_large_write_bytes)) )
+             (addr == (vio->mmio_large_write_pa +
+                       vio->mmio_large_write_bytes)) )
             return X86EMUL_RETRY;
     default:
         return X86EMUL_UNHANDLEABLE;
@@ -139,9 +142,9 @@
         return X86EMUL_UNHANDLEABLE;
     }
 
-    curr->arch.hvm_vcpu.io_state =
+    vio->io_state =
         (p_data == NULL) ? HVMIO_dispatched : HVMIO_awaiting_completion;
-    curr->arch.hvm_vcpu.io_size = size;
+    vio->io_size = size;
 
     p->dir = dir;
     p->data_is_ptr = value_is_ptr;
@@ -172,12 +175,12 @@
         *reps = p->count;
         p->state = STATE_IORESP_READY;
         hvm_io_assist();
-        curr->arch.hvm_vcpu.io_state = HVMIO_none;
+        vio->io_state = HVMIO_none;
         break;
     case X86EMUL_UNHANDLEABLE:
         rc = X86EMUL_RETRY;
         if ( !hvm_send_assist_req(curr) )
-            curr->arch.hvm_vcpu.io_state = HVMIO_none;
+            vio->io_state = HVMIO_none;
         else if ( p_data == NULL )
             rc = X86EMUL_OKAY;
         break;
@@ -190,33 +193,32 @@
 
  finish_access:
     if ( p_data != NULL )
-        memcpy(p_data, &curr->arch.hvm_vcpu.io_data, size);
+        memcpy(p_data, &vio->io_data, size);
 
     if ( is_mmio && !value_is_ptr )
     {
         /* Part of a multi-cycle read or write? */
         if ( dir == IOREQ_WRITE )
         {
-            paddr_t pa = curr->arch.hvm_vcpu.mmio_large_write_pa;
-            unsigned int bytes = curr->arch.hvm_vcpu.mmio_large_write_bytes;
+            paddr_t pa = vio->mmio_large_write_pa;
+            unsigned int bytes = vio->mmio_large_write_bytes;
             if ( bytes == 0 )
-                pa = curr->arch.hvm_vcpu.mmio_large_write_pa = addr;
+                pa = vio->mmio_large_write_pa = addr;
             if ( addr == (pa + bytes) )
-                curr->arch.hvm_vcpu.mmio_large_write_bytes += size;
+                vio->mmio_large_write_bytes += size;
         }
         else
         {
-            paddr_t pa = curr->arch.hvm_vcpu.mmio_large_read_pa;
-            unsigned int bytes = curr->arch.hvm_vcpu.mmio_large_read_bytes;
+            paddr_t pa = vio->mmio_large_read_pa;
+            unsigned int bytes = vio->mmio_large_read_bytes;
             if ( bytes == 0 )
-                pa = curr->arch.hvm_vcpu.mmio_large_read_pa = addr;
+                pa = vio->mmio_large_read_pa = addr;
             if ( (addr == (pa + bytes)) &&
                  ((bytes + size) <
-                  sizeof(curr->arch.hvm_vcpu.mmio_large_read)) )
+                  sizeof(vio->mmio_large_read)) )
             {
-                memcpy(&curr->arch.hvm_vcpu.mmio_large_read[addr - pa],
-                       p_data, size);
-                curr->arch.hvm_vcpu.mmio_large_read_bytes += size;
+                memcpy(&vio->mmio_large_read[addr - pa], p_data, size);
+                vio->mmio_large_read_bytes += size;
             }
         }
     }
@@ -400,6 +402,7 @@
     struct vcpu *curr = current;
     unsigned long addr, reps = 1;
     uint32_t pfec = PFEC_page_present;
+    struct hvm_vcpu_io *vio = &curr->arch.hvm_vcpu.hvm_io;
     paddr_t gpa;
     int rc;
 
@@ -408,13 +411,12 @@
     if ( rc != X86EMUL_OKAY )
         return rc;
 
-    if ( unlikely(curr->arch.hvm_vcpu.mmio_gva == (addr & PAGE_MASK)) &&
-         curr->arch.hvm_vcpu.mmio_gva )
+    if ( unlikely(vio->mmio_gva == (addr & PAGE_MASK)) && vio->mmio_gva )
     {
         unsigned int off = addr & (PAGE_SIZE - 1);
         if ( access_type == hvm_access_insn_fetch )
             return X86EMUL_UNHANDLEABLE;
-        gpa = (((paddr_t)curr->arch.hvm_vcpu.mmio_gpfn << PAGE_SHIFT) | off);
+        gpa = (((paddr_t)vio->mmio_gpfn << PAGE_SHIFT) | off);
         if ( (off + bytes) <= PAGE_SIZE )
             return hvmemul_do_mmio(gpa, &reps, bytes, 0,
                                    IOREQ_READ, 0, p_data);
@@ -499,6 +501,7 @@
     struct vcpu *curr = current;
     unsigned long addr, reps = 1;
     uint32_t pfec = PFEC_page_present | PFEC_write_access;
+    struct hvm_vcpu_io *vio = &curr->arch.hvm_vcpu.hvm_io;
     paddr_t gpa;
     int rc;
 
@@ -507,11 +510,10 @@
     if ( rc != X86EMUL_OKAY )
         return rc;
 
-    if ( unlikely(curr->arch.hvm_vcpu.mmio_gva == (addr & PAGE_MASK)) &&
-         curr->arch.hvm_vcpu.mmio_gva )
+    if ( unlikely(vio->mmio_gva == (addr & PAGE_MASK)) && vio->mmio_gva )
     {
         unsigned int off = addr & (PAGE_SIZE - 1);
-        gpa = (((paddr_t)curr->arch.hvm_vcpu.mmio_gpfn << PAGE_SHIFT) | off);
+        gpa = (((paddr_t)vio->mmio_gpfn << PAGE_SHIFT) | off);
         if ( (off + bytes) <= PAGE_SIZE )
             return hvmemul_do_mmio(gpa, &reps, bytes, 0,
                                    IOREQ_WRITE, 0, p_data);
@@ -529,7 +531,7 @@
         return X86EMUL_EXCEPTION;
     case HVMCOPY_unhandleable:
         return X86EMUL_UNHANDLEABLE;
-    case  HVMCOPY_bad_gfn_to_mfn:
+    case HVMCOPY_bad_gfn_to_mfn:
         rc = hvmemul_linear_to_phys(
             addr, &gpa, bytes, &reps, pfec, hvmemul_ctxt);
         if ( rc != X86EMUL_OKAY )
@@ -973,6 +975,7 @@
     struct cpu_user_regs *regs = hvmemul_ctxt->ctxt.regs;
     struct vcpu *curr = current;
     uint32_t new_intr_shadow, pfec = PFEC_page_present;
+    struct hvm_vcpu_io *vio = &curr->arch.hvm_vcpu.hvm_io;
     unsigned long addr;
     int rc;
 
@@ -1010,8 +1013,7 @@
     rc = x86_emulate(&hvmemul_ctxt->ctxt, &hvm_emulate_ops);
 
     if ( rc != X86EMUL_RETRY )
-        curr->arch.hvm_vcpu.mmio_large_read_bytes =
-            curr->arch.hvm_vcpu.mmio_large_write_bytes = 0;
+        vio->mmio_large_read_bytes = vio->mmio_large_write_bytes = 0;
 
     if ( rc != X86EMUL_OKAY )
         return rc;
diff -r 8943a9696358 -r 51a0c81a4030 xen/arch/x86/hvm/io.c
--- a/xen/arch/x86/hvm/io.c	Tue Oct 25 16:46:47 2011 +0100
+++ b/xen/arch/x86/hvm/io.c	Tue Oct 25 16:48:17 2011 +0100
@@ -170,28 +170,31 @@
 {
     struct hvm_emulate_ctxt ctxt;
     struct vcpu *curr = current;
+    struct hvm_vcpu_io *vio = &curr->arch.hvm_vcpu.hvm_io;
     int rc;
 
     hvm_emulate_prepare(&ctxt, guest_cpu_user_regs());
 
     rc = hvm_emulate_one(&ctxt);
 
-    if ( curr->arch.hvm_vcpu.io_state == HVMIO_awaiting_completion )
-        curr->arch.hvm_vcpu.io_state = HVMIO_handle_mmio_awaiting_completion;
+    if ( vio->io_state == HVMIO_awaiting_completion )
+        vio->io_state = HVMIO_handle_mmio_awaiting_completion;
     else
-        curr->arch.hvm_vcpu.mmio_gva = 0;
+        vio->mmio_gva = 0;
 
     switch ( rc )
     {
     case X86EMUL_UNHANDLEABLE:
         gdprintk(XENLOG_WARNING,
                  "MMIO emulation failed @ %04x:%lx: "
-                 "%02x %02x %02x %02x %02x %02x\n",
+                 "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
                  hvmemul_get_seg_reg(x86_seg_cs, &ctxt)->sel,
                  ctxt.insn_buf_eip,
                  ctxt.insn_buf[0], ctxt.insn_buf[1],
                  ctxt.insn_buf[2], ctxt.insn_buf[3],
-                 ctxt.insn_buf[4], ctxt.insn_buf[5]);
+                 ctxt.insn_buf[4], ctxt.insn_buf[5],
+                 ctxt.insn_buf[6], ctxt.insn_buf[7],
+                 ctxt.insn_buf[8], ctxt.insn_buf[9]);
         return 0;
     case X86EMUL_EXCEPTION:
         if ( ctxt.exn_pending )
@@ -208,14 +211,16 @@
 
 int handle_mmio_with_translation(unsigned long gva, unsigned long gpfn)
 {
-    current->arch.hvm_vcpu.mmio_gva = gva & PAGE_MASK;
-    current->arch.hvm_vcpu.mmio_gpfn = gpfn;
+    struct hvm_vcpu_io *vio = &current->arch.hvm_vcpu.hvm_io;
+    vio->mmio_gva = gva & PAGE_MASK;
+    vio->mmio_gpfn = gpfn;
     return handle_mmio();
 }
 
 int handle_pio(uint16_t port, int size, int dir)
 {
     struct vcpu *curr = current;
+    struct hvm_vcpu_io *vio = &curr->arch.hvm_vcpu.hvm_io;
     unsigned long data, reps = 1;
     int rc;
 
@@ -228,15 +233,14 @@
     {
     case X86EMUL_OKAY:
         if ( dir == IOREQ_READ )
-            memcpy(&guest_cpu_user_regs()->eax,
-                   &data, curr->arch.hvm_vcpu.io_size);
+            memcpy(&guest_cpu_user_regs()->eax, &data, vio->io_size);
         break;
     case X86EMUL_RETRY:
-        if ( curr->arch.hvm_vcpu.io_state != HVMIO_awaiting_completion )
+        if ( vio->io_state != HVMIO_awaiting_completion )
             return 0;
         /* Completion in hvm_io_assist() with no re-emulation required. */
         ASSERT(dir == IOREQ_READ);
-        curr->arch.hvm_vcpu.io_state = HVMIO_handle_pio_awaiting_completion;
+        vio->io_state = HVMIO_handle_pio_awaiting_completion;
         break;
     default:
         gdprintk(XENLOG_ERR, "Weird HVM ioemulation status %d.\n", rc);
@@ -250,6 +254,7 @@
 void hvm_io_assist(void)
 {
     struct vcpu *curr = current;
+    struct hvm_vcpu_io *vio = &curr->arch.hvm_vcpu.hvm_io;
     ioreq_t *p = get_ioreq(curr);
     enum hvm_io_state io_state;
 
@@ -257,23 +262,23 @@
 
     p->state = STATE_IOREQ_NONE;
 
-    io_state = curr->arch.hvm_vcpu.io_state;
-    curr->arch.hvm_vcpu.io_state = HVMIO_none;
+    io_state = vio->io_state;
+    vio->io_state = HVMIO_none;
 
     switch ( io_state )
     {
     case HVMIO_awaiting_completion:
-        curr->arch.hvm_vcpu.io_state = HVMIO_completed;
-        curr->arch.hvm_vcpu.io_data = p->data;
+        vio->io_state = HVMIO_completed;
+        vio->io_data = p->data;
         break;
     case HVMIO_handle_mmio_awaiting_completion:
-        curr->arch.hvm_vcpu.io_state = HVMIO_completed;
-        curr->arch.hvm_vcpu.io_data = p->data;
+        vio->io_state = HVMIO_completed;
+        vio->io_data = p->data;
         (void)handle_mmio();
         break;
     case HVMIO_handle_pio_awaiting_completion:
         memcpy(&guest_cpu_user_regs()->eax,
-               &p->data, curr->arch.hvm_vcpu.io_size);
+               &p->data, vio->io_size);
         break;
     default:
         break;
diff -r 8943a9696358 -r 51a0c81a4030 xen/arch/x86/hvm/svm/nestedsvm.c
--- a/xen/arch/x86/hvm/svm/nestedsvm.c	Tue Oct 25 16:46:47 2011 +0100
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c	Tue Oct 25 16:48:17 2011 +0100
@@ -1168,7 +1168,7 @@
          * Delay the injection because this would result in delivering
          * an interrupt *within* the execution of an instruction.
          */
-        if ( v->arch.hvm_vcpu.io_state != HVMIO_none )
+        if ( v->arch.hvm_vcpu.hvm_io.io_state != HVMIO_none )
             return hvm_intblk_shadow;
     }
 
diff -r 8943a9696358 -r 51a0c81a4030 xen/arch/x86/hvm/vmx/realmode.c
--- a/xen/arch/x86/hvm/vmx/realmode.c	Tue Oct 25 16:46:47 2011 +0100
+++ b/xen/arch/x86/hvm/vmx/realmode.c	Tue Oct 25 16:48:17 2011 +0100
@@ -172,6 +172,7 @@
     struct vcpu *curr = current;
     struct hvm_emulate_ctxt hvmemul_ctxt;
     struct segment_register *sreg;
+    struct hvm_vcpu_io *vio = &curr->arch.hvm_vcpu.hvm_io;
     unsigned long intr_info;
     unsigned int emulations = 0;
 
@@ -182,7 +183,7 @@
 
     hvm_emulate_prepare(&hvmemul_ctxt, regs);
 
-    if ( curr->arch.hvm_vcpu.io_state == HVMIO_completed )
+    if ( vio->io_state == HVMIO_completed )
         realmode_emulate_one(&hvmemul_ctxt);
 
     /* Only deliver interrupts into emulated real mode. */
@@ -196,7 +197,7 @@
     curr->arch.hvm_vmx.vmx_emulate = 1;
     while ( curr->arch.hvm_vmx.vmx_emulate &&
             !softirq_pending(smp_processor_id()) &&
-            (curr->arch.hvm_vcpu.io_state == HVMIO_none) )
+            (vio->io_state == HVMIO_none) )
     {
         /*
          * Check for pending interrupts only every 16 instructions, because
@@ -221,7 +222,7 @@
     }
 
     /* Need to emulate next time if we've started an IO operation */
-    if ( curr->arch.hvm_vcpu.io_state != HVMIO_none )
+    if ( vio->io_state != HVMIO_none )
         curr->arch.hvm_vmx.vmx_emulate = 1;
 
     if ( !curr->arch.hvm_vmx.vmx_emulate && !curr->arch.hvm_vmx.vmx_realmode )
diff -r 8943a9696358 -r 51a0c81a4030 xen/include/asm-x86/hvm/vcpu.h
--- a/xen/include/asm-x86/hvm/vcpu.h	Tue Oct 25 16:46:47 2011 +0100
+++ b/xen/include/asm-x86/hvm/vcpu.h	Tue Oct 25 16:48:17 2011 +0100
@@ -44,6 +44,30 @@
     uint32_t asid;
 };
 
+struct hvm_vcpu_io {
+    /* I/O request in flight to device model. */
+    enum hvm_io_state   io_state;
+    unsigned long       io_data;
+    int                 io_size;
+
+    /*
+     * HVM emulation:
+     *  Virtual address @mmio_gva maps to MMIO physical frame @mmio_gpfn.
+     *  The latter is known to be an MMIO frame (not RAM).
+     *  This translation is only valid if @mmio_gva is non-zero.
+     */
+    unsigned long       mmio_gva;
+    unsigned long       mmio_gpfn;
+
+    /* We may read up to m128 as a number of device-model transactions. */
+    paddr_t mmio_large_read_pa;
+    uint8_t mmio_large_read[16];
+    unsigned int mmio_large_read_bytes;
+    /* We may write up to m128 as a number of device-model transactions. */
+    paddr_t mmio_large_write_pa;
+    unsigned int mmio_large_write_bytes;
+};
+
 #define VMCX_EADDR    (~0ULL)
 
 struct nestedvcpu {
@@ -135,31 +159,11 @@
     /* Which cache mode is this VCPU in (CR0:CD/NW)? */
     u8                  cache_mode;
 
-    /* I/O request in flight to device model. */
-    enum hvm_io_state   io_state;
-    unsigned long       io_data;
-    int                 io_size;
-
-    /*
-     * HVM emulation:
-     *  Virtual address @mmio_gva maps to MMIO physical frame @mmio_gpfn.
-     *  The latter is known to be an MMIO frame (not RAM).
-     *  This translation is only valid if @mmio_gva is non-zero.
-     */
-    unsigned long       mmio_gva;
-    unsigned long       mmio_gpfn;
+    struct hvm_vcpu_io  hvm_io;
 
     /* Callback into x86_emulate when emulating FPU/MMX/XMM instructions. */
     void (*fpu_exception_callback)(void *, struct cpu_user_regs *);
     void *fpu_exception_callback_arg;
-    /* We may read up to m128 as a number of device-model transactions. */
-    paddr_t mmio_large_read_pa;
-    uint8_t mmio_large_read[16];
-    unsigned int mmio_large_read_bytes;
-    /* We may write up to m128 as a number of device-model transactions. */
-    paddr_t mmio_large_write_pa;
-    unsigned int mmio_large_write_bytes;
-
     /* Pending hw/sw interrupt */
     int           inject_trap;       /* -1 for nothing to inject */
     int           inject_error_code;

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

From xen-changelog-bounces@lists.xensource.com Wed Oct 26 12:55:39 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 26 Oct 2011 12:55:39 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RJ9Zb-0004hy-5a; Wed, 26 Oct 2011 12:55:39 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RJ9ZD-0004af-Ql
	for xen-changelog@lists.xensource.com; Wed, 26 Oct 2011 12:55:16 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-182.messagelabs.com!1319658912!857901!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24465 invoked from network); 26 Oct 2011 19:55:12 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	26 Oct 2011 19:55:12 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RJ9ZA-0001lz-2f
	for xen-changelog@lists.xensource.com; Wed, 26 Oct 2011 20:55:12 +0100
Message-Id: <E1RJ9ZA-0001lz-2f@xenbits.xen.org>
Date: Wed, 26 Oct 2011 20:55:11 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: add missing "break;
	" to do_pci_remove
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 Ian Campbell <ian.campbell@citrix.com>
# Date 1319558681 -3600
# Node ID f273bce1fc265b9f71879705639a0b14da03f6e1
# Parent  51a0c81a40302ac8fd0ce8066ba16d2e3fdd7664
libxl: add missing "break;" to do_pci_remove

Otherwise we erroneously fall through the LIBXL_DOMAIN_TYPE_PV case into the
"default: abort()".

(I'm sure we fixed this once already...)

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Tested-by: Dario Faggioli <dario.faggioli@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 51a0c81a4030 -r f273bce1fc26 tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c	Tue Oct 25 16:48:17 2011 +0100
+++ b/tools/libxl/libxl_pci.c	Tue Oct 25 17:04:41 2011 +0100
@@ -930,6 +930,7 @@
             }
         }
         fclose(f);
+        break;
     }
     default:
         abort();

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

From xen-changelog-bounces@lists.xensource.com Wed Oct 26 12:55:46 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 26 Oct 2011 12:55:46 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RJ9Zi-0004l6-CB; Wed, 26 Oct 2011 12:55:46 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RJ9ZE-0004ah-SZ
	for xen-changelog@lists.xensource.com; Wed, 26 Oct 2011 12:55:17 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-216.messagelabs.com!1319658913!1184539!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14753 invoked from network); 26 Oct 2011 19:55:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	26 Oct 2011 19:55:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RJ9ZA-0001mm-Jb
	for xen-changelog@lists.xensource.com; Wed, 26 Oct 2011 20:55:12 +0100
Message-Id: <E1RJ9ZA-0001mm-Jb@xenbits.xen.org>
Date: Wed, 26 Oct 2011 20:55:12 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] pygrub: check all GPT partitions
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 Michael Young <m.a.young@durham.ac.uk>
# Date 1319566554 -3600
# Node ID 85d7b207fabcd1cbda8f93e3937c5990f42a2cf9
# Parent  f273bce1fc265b9f71879705639a0b14da03f6e1
pygrub: check all GPT partitions

On Fedora 16 the first GPT partition is a boot partition for grub2 with
the grub2 configuration in the second partition.
Check all GPT partitions for grub configuration, not just the first.

[ Also remove now-inaccurate comment. -iwj ]

Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
Tested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r f273bce1fc26 -r 85d7b207fabc tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub	Tue Oct 25 17:04:41 2011 +0100
+++ b/tools/pygrub/src/pygrub	Tue Oct 25 19:15:54 2011 +0100
@@ -77,10 +77,17 @@
 
 def get_fs_offset_gpt(file):
     fd = os.open(file, os.O_RDONLY)
-    # assume the first partition is an EFI system partition.
-    os.lseek(fd, SECTOR_SIZE * 2, 0)
+    os.lseek(fd, SECTOR_SIZE, 0)
     buf = os.read(fd, 512)
-    return struct.unpack("<Q", buf[32:40])[0] * SECTOR_SIZE
+    partcount = struct.unpack("<L", buf[80:84])[0]
+    partsize = struct.unpack("<L", buf[84:88])[0]
+    i = partcount
+    offsets = []
+    while i>0:
+        buf = os.read(fd, partsize)
+        offsets.append(struct.unpack("<Q", buf[32:40])[0] * SECTOR_SIZE)
+        i -= 1
+    return offsets
 
 FDISK_PART_SOLARIS=0xbf
 FDISK_PART_SOLARIS_OLD=0x82
@@ -114,7 +121,9 @@
                 continue # no solaris magic at that offset, ignore partition
 
         if type == FDISK_PART_GPT:
-            offset = get_fs_offset_gpt(file)
+            for offset in get_fs_offset_gpt(file):
+                part_offs.append(offset)
+            break
 
         # Active partition has 0x80 as the first byte.
         # If active, prepend to front of list, otherwise append to back.

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

From xen-changelog-bounces@lists.xensource.com Wed Oct 26 12:55:55 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 26 Oct 2011 12:55:55 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RJ9Zr-0004o6-3E; Wed, 26 Oct 2011 12:55:55 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RJ9ZF-0004ai-5p
	for xen-changelog@lists.xensource.com; Wed, 26 Oct 2011 12:55:17 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-174.messagelabs.com!1319658913!34661127!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22087 invoked from network); 26 Oct 2011 19:55:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-6.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	26 Oct 2011 19:55:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RJ9ZB-0001oH-Nr
	for xen-changelog@lists.xensource.com; Wed, 26 Oct 2011 20:55:13 +0100
Message-Id: <E1RJ9ZB-0001oH-Nr@xenbits.xen.org>
Date: Wed, 26 Oct 2011 20:55:13 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] pygrub: Allow GPT partition
	references
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 Michael Young <m.a.young@durham.ac.uk>
# Date 1319566759 -3600
# Node ID 65679fee01778aec2dbe9988959da6b57c52d6c9
# Parent  138f707fa598340749a70a79748b01dff850b8f2
pygrub: Allow GPT partition references

The grub2 configuration file in Fedora 16 can have GPT partition
references like (hd0,gpt2) so remove the "gpt" string where necessary

Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 138f707fa598 -r 65679fee0177 tools/pygrub/src/GrubConf.py
--- a/tools/pygrub/src/GrubConf.py	Tue Oct 25 19:18:49 2011 +0100
+++ b/tools/pygrub/src/GrubConf.py	Tue Oct 25 19:19:19 2011 +0100
@@ -79,6 +79,8 @@
         val = val.replace("(", "").replace(")", "")
         if val[:5] == "msdos":
             val = val[5:]
+        if val[:3] == "gpt":
+            val = val[3:]
         self._part = int(val)
     part = property(get_part, set_part)
 

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

From xen-changelog-bounces@lists.xensource.com Wed Oct 26 12:56:04 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 26 Oct 2011 12:56:04 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RJ9a0-0004sL-OB; Wed, 26 Oct 2011 12:56:04 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RJ9ZG-0004ao-5N
	for xen-changelog@lists.xensource.com; Wed, 26 Oct 2011 12:55:18 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-174.messagelabs.com!1319658914!34661128!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22105 invoked from network); 26 Oct 2011 19:55:15 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-6.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	26 Oct 2011 19:55:15 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RJ9ZC-0001pj-RP
	for xen-changelog@lists.xensource.com; Wed, 26 Oct 2011 20:55:14 +0100
Message-Id: <E1RJ9ZC-0001pj-RP@xenbits.xen.org>
Date: Wed, 26 Oct 2011 20:55:14 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] pyrgrub: cope with configurations
	with set default="${saved_entry}" line
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 Michael Young <m.a.young@durham.ac.uk>
# Date 1319566865 -3600
# Node ID 979bc34d0ad0369e42c70f66a39952e4b6b9b613
# Parent  152049468175f29a3792b3b60e09a841f9cd2c21
pyrgrub: cope with configurations with set default="${saved_entry}" line

Fedora 16 grub2 configuration file can have lines like
    set default="${saved_entry}"
and a string containing an integer is expected

Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 152049468175 -r 979bc34d0ad0 tools/pygrub/src/GrubConf.py
--- a/tools/pygrub/src/GrubConf.py	Tue Oct 25 19:20:06 2011 +0100
+++ b/tools/pygrub/src/GrubConf.py	Tue Oct 25 19:21:05 2011 +0100
@@ -425,6 +425,8 @@
                 
             if self.commands.has_key(com):
                 if self.commands[com] is not None:
+                    if arg.strip() == "${saved_entry}":
+                        arg = "0"
                     setattr(self, self.commands[com], arg.strip())
                 else:
                     logging.info("Ignored directive %s" %(com,))

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

From xen-changelog-bounces@lists.xensource.com Wed Oct 26 12:56:15 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 26 Oct 2011 12:56:15 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RJ9aB-0004vW-Ja; Wed, 26 Oct 2011 12:56:15 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RJ9ZF-0004aj-OT
	for xen-changelog@lists.xensource.com; Wed, 26 Oct 2011 12:55:18 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-21.messagelabs.com!1319658914!1775430!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17783 invoked from network); 26 Oct 2011 19:55:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	26 Oct 2011 19:55:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RJ9ZB-0001nX-6C
	for xen-changelog@lists.xensource.com; Wed, 26 Oct 2011 20:55:13 +0100
Message-Id: <E1RJ9ZB-0001nX-6C@xenbits.xen.org>
Date: Wed, 26 Oct 2011 20:55:12 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] pygrub: look in /boot/grub2 (for eg
	Fedora 16)
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 Michael Young <m.a.young@durham.ac.uk>
# Date 1319566729 -3600
# Node ID 138f707fa598340749a70a79748b01dff850b8f2
# Parent  85d7b207fabcd1cbda8f93e3937c5990f42a2cf9
pygrub: look in /boot/grub2 (for eg Fedora 16)

Fedora 16 puts grub configuration files in /boot/grub2/grub.cfg so
pygrub should look there as well

Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 85d7b207fabc -r 138f707fa598 tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub	Tue Oct 25 19:15:54 2011 +0100
+++ b/tools/pygrub/src/pygrub	Tue Oct 25 19:18:49 2011 +0100
@@ -395,7 +395,8 @@
                            ["/efi/boot/elilo.conf", "/elilo.conf",])
         else:
             cfg_list = map(lambda x: (x,grub.GrubConf.Grub2ConfigFile),
-                           ["/boot/grub/grub.cfg", "/grub/grub.cfg"]) + \
+                           ["/boot/grub/grub.cfg", "/grub/grub.cfg",
+                            "/boot/grub2/grub.cfg", "/grub2/grub.cfg"]) + \
                        map(lambda x: (x,grub.ExtLinuxConf.ExtLinuxConfigFile),
                            ["/boot/isolinux/isolinux.cfg",
                             "/boot/extlinux.conf"]) + \

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

From xen-changelog-bounces@lists.xensource.com Wed Oct 26 12:56:21 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 26 Oct 2011 12:56:21 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RJ9aH-0004yP-GT; Wed, 26 Oct 2011 12:56:21 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RJ9ZG-0004ap-GB
	for xen-changelog@lists.xensource.com; Wed, 26 Oct 2011 12:55:19 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1319658914!1684764!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11692 invoked from network); 26 Oct 2011 19:55:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	26 Oct 2011 19:55:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RJ9ZC-0001ox-8M
	for xen-changelog@lists.xensource.com; Wed, 26 Oct 2011 20:55:14 +0100
Message-Id: <E1RJ9ZC-0001ox-8M@xenbits.xen.org>
Date: Wed, 26 Oct 2011 20:55:13 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] pygrub: cope with configurations
	with submenus
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 Michael Young <m.a.young@durham.ac.uk>
# Date 1319566806 -3600
# Node ID 152049468175f29a3792b3b60e09a841f9cd2c21
# Parent  65679fee01778aec2dbe9988959da6b57c52d6c9
pygrub: cope with configurations with submenus

The grub2 configuration file in Fedora 16 can have one or more
menuentrys in a submenu, with configuration of the form
    submenu "Xen 4.1" {
    menuentry ... {
    ...
    }
    }
(this example occurs when the xen hypervisor is installed on the
guest)

Ignore the submenu line and the corresponding }

Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 65679fee0177 -r 152049468175 tools/pygrub/src/GrubConf.py
--- a/tools/pygrub/src/GrubConf.py	Tue Oct 25 19:19:19 2011 +0100
+++ b/tools/pygrub/src/GrubConf.py	Tue Oct 25 19:20:06 2011 +0100
@@ -370,6 +370,7 @@
         in_function = False
         img = None
         title = ""
+        menu_level=0
         for l in lines:
             l = l.strip()
             # skip blank lines
@@ -396,10 +397,18 @@
                 img = []
                 title = title_match.group(1)
                 continue
-            
+
+            if l.startswith("submenu"):
+                menu_level += 1
+                continue
+
             if l.startswith("}"):
                 if img is None:
-                    raise RuntimeError, "syntax error: closing brace without menuentry"
+                    if menu_level > 0:
+                        menu_level -= 1
+                        continue
+                    else:
+                        raise RuntimeError, "syntax error: closing brace without menuentry"
 
                 self.add_image(Grub2Image(title, img))
                 img = None

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

From xen-changelog-bounces@lists.xensource.com Wed Oct 26 12:56:27 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 26 Oct 2011 12:56:27 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RJ9aN-00051Z-Ff; Wed, 26 Oct 2011 12:56:27 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RJ9ZG-0004au-PS
	for xen-changelog@lists.xensource.com; Wed, 26 Oct 2011 12:55:19 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-174.messagelabs.com!1319658915!23112294!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25102 invoked from network); 26 Oct 2011 19:55:15 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	26 Oct 2011 19:55:15 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RJ9ZD-0001qP-Bw
	for xen-changelog@lists.xensource.com; Wed, 26 Oct 2011 20:55:15 +0100
Message-Id: <E1RJ9ZD-0001qP-Bw@xenbits.xen.org>
Date: Wed, 26 Oct 2011 20:55:14 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] pygrub: example grub2 configuration
	file (fedora-16-with-xen.grub2)
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 Michael Young <m.a.young@durham.ac.uk>
# Date 1319566929 -3600
# Node ID c681dd5aecf3da3c6fd0e4d8a760a9cd18617033
# Parent  979bc34d0ad0369e42c70f66a39952e4b6b9b613
pygrub: example grub2 configuration file (fedora-16-with-xen.grub2)

Sample grub2 configuration file (some duplication removed) from Fedora 16
with a xen hypervisor installed

Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 979bc34d0ad0 -r c681dd5aecf3 tools/pygrub/examples/fedora-16-with-xen.grub2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/pygrub/examples/fedora-16-with-xen.grub2	Tue Oct 25 19:22:09 2011 +0100
@@ -0,0 +1,112 @@
+#
+# DO NOT EDIT THIS FILE
+#
+# It is automatically generated by grub2-mkconfig using templates
+# from /etc/grub.d and settings from /etc/default/grub
+#
+
+### BEGIN /etc/grub.d/00_header ###
+if [ -s $prefix/grubenv ]; then
+  load_env
+fi
+set default="${saved_entry}"
+if [ "${prev_saved_entry}" ]; then
+  set saved_entry="${prev_saved_entry}"
+  save_env saved_entry
+  set prev_saved_entry=
+  save_env prev_saved_entry
+  set boot_once=true
+fi
+
+function savedefault {
+  if [ -z "${boot_once}" ]; then
+    saved_entry="${chosen}"
+    save_env saved_entry
+  fi
+}
+
+function load_video {
+  insmod vbe
+  insmod vga
+  insmod video_bochs
+  insmod video_cirrus
+}
+
+set timeout=5
+### END /etc/grub.d/00_header ###
+
+### BEGIN /etc/grub.d/10_linux ###
+menuentry 'Fedora Linux, with Linux 3.1.0-0.rc9.git0.0.fc16.x86_64' --class fedora --class gnu-linux --class gnu --class os {
+	load_video
+	set gfxpayload=keep
+	insmod gzio
+	insmod part_gpt
+	insmod ext2
+	set root='(hd0,gpt2)'
+	search --no-floppy --fs-uuid --set=root f14ea58a-c2b3-4348-8091-3ab733a2f49e
+	echo	'Loading Linux 3.1.0-0.rc9.git0.0.fc16.x86_64 ...'
+	linux	/vmlinuz-3.1.0-0.rc9.git0.0.fc16.x86_64 root=/dev/mapper/VolGroup-lv_root ro rd.md=0 rd.dm=0 rd.lvm.lv=VolGroup/lv_swap quiet SYSFONT=latarcyrheb-sun16 rhgb rd.lvm.lv=VolGroup/lv_root rd.luks=0  KEYTABLE=uk LANG=en_US.UTF-8 
+	echo	'Loading initial ramdisk ...'
+	initrd	/initramfs-3.1.0-0.rc9.git0.0.fc16.x86_64.img
+}
+menuentry 'Fedora Linux, with Linux 3.1.0-0.rc9.git0.0.fc16.x86_64 (recovery mode)' --class fedora --class gnu-linux --class gnu --class os {
+	load_video
+	set gfxpayload=keep
+	insmod gzio
+	insmod part_gpt
+	insmod ext2
+	set root='(hd0,gpt2)'
+	search --no-floppy --fs-uuid --set=root f14ea58a-c2b3-4348-8091-3ab733a2f49e
+	echo	'Loading Linux 3.1.0-0.rc9.git0.0.fc16.x86_64 ...'
+	linux	/vmlinuz-3.1.0-0.rc9.git0.0.fc16.x86_64 root=/dev/mapper/VolGroup-lv_root ro single rd.md=0 rd.dm=0 rd.lvm.lv=VolGroup/lv_swap quiet SYSFONT=latarcyrheb-sun16 rhgb rd.lvm.lv=VolGroup/lv_root rd.luks=0  KEYTABLE=uk LANG=en_US.UTF-8
+	echo	'Loading initial ramdisk ...'
+	initrd	/initramfs-3.1.0-0.rc9.git0.0.fc16.x86_64.img
+}
+### END /etc/grub.d/10_linux ###
+
+### BEGIN /etc/grub.d/20_linux_xen ###
+submenu "Xen 4.1" {
+menuentry 'Fedora Linux, with Xen 4.1 and Linux 3.1.0-0.rc9.git0.0.fc16.x86_64' --class fedora --class gnu-linux --class gnu --class os --class xen {
+	insmod part_gpt
+	insmod ext2
+	set root='(hd0,gpt2)'
+	search --no-floppy --fs-uuid --set=root f14ea58a-c2b3-4348-8091-3ab733a2f49e
+	echo	'Loading Xen 4.1 ...'
+	multiboot	/xen-4.1.gz placeholder  
+	echo	'Loading Linux 3.1.0-0.rc9.git0.0.fc16.x86_64 ...'
+	module	/vmlinuz-3.1.0-0.rc9.git0.0.fc16.x86_64 placeholder root=/dev/mapper/VolGroup-lv_root ro rd.md=0 rd.dm=0 rd.lvm.lv=VolGroup/lv_swap quiet SYSFONT=latarcyrheb-sun16 rhgb rd.lvm.lv=VolGroup/lv_root rd.luks=0  KEYTABLE=uk LANG=en_US.UTF-8 
+	echo	'Loading initial ramdisk ...'
+	module	/initramfs-3.1.0-0.rc9.git0.0.fc16.x86_64.img
+}
+menuentry 'Fedora Linux, with Xen 4.1 and Linux 3.1.0-0.rc9.git0.0.fc16.x86_64 (recovery mode)' --class fedora --class gnu-linux --class gnu --class os --class xen {
+	insmod part_gpt
+	insmod ext2
+	set root='(hd0,gpt2)'
+	search --no-floppy --fs-uuid --set=root f14ea58a-c2b3-4348-8091-3ab733a2f49e
+	echo	'Loading Xen 4.1 ...'
+	multiboot	/xen-4.1.gz placeholder 
+	echo	'Loading Linux 3.1.0-0.rc9.git0.0.fc16.x86_64 ...'
+	module	/vmlinuz-3.1.0-0.rc9.git0.0.fc16.x86_64 placeholder root=/dev/mapper/VolGroup-lv_root ro single rd.md=0 rd.dm=0 rd.lvm.lv=VolGroup/lv_swap quiet SYSFONT=latarcyrheb-sun16 rhgb rd.lvm.lv=VolGroup/lv_root rd.luks=0  KEYTABLE=uk LANG=en_US.UTF-8
+	echo	'Loading initial ramdisk ...'
+	module	/initramfs-3.1.0-0.rc9.git0.0.fc16.x86_64.img
+}
+}
+### END /etc/grub.d/20_linux_xen ###
+
+### BEGIN /etc/grub.d/30_os-prober ###
+### END /etc/grub.d/30_os-prober ###
+
+### BEGIN /etc/grub.d/40_custom ###
+# This file provides an easy way to add custom menu entries.  Simply type the
+# menu entries you want to add after this comment.  Be careful not to change
+# the 'exec tail' line above.
+### END /etc/grub.d/40_custom ###
+
+### BEGIN /etc/grub.d/41_custom ###
+if [ -f  $prefix/custom.cfg ]; then
+  source $prefix/custom.cfg;
+fi
+### END /etc/grub.d/41_custom ###
+
+### BEGIN /etc/grub.d/90_persistent ###
+### END /etc/grub.d/90_persistent ###

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 27 14:33:23 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 27 Oct 2011 14:33:23 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RJXZj-0000TD-Q1; Thu, 27 Oct 2011 14:33:23 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RJXZf-0000SJ-Pk
	for xen-changelog@lists.xensource.com; Thu, 27 Oct 2011 14:33:20 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-216.messagelabs.com!1319751196!1337763!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1476 invoked from network); 27 Oct 2011 21:33:16 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	27 Oct 2011 21:33:16 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RJXZb-0006xB-Pf
	for xen-changelog@lists.xensource.com; Thu, 27 Oct 2011 22:33:15 +0100
Message-Id: <E1RJXZb-0006xB-Pf@xenbits.xen.org>
Date: Thu, 27 Oct 2011 22:33:14 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] interface: rename of trim to discard
	in blkif.h
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 Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
# Date 1319727831 -3600
# Node ID be1a190becae07485081d170fd41215203a2886b
# Parent  c681dd5aecf3da3c6fd0e4d8a760a9cd18617033
interface: rename of trim to discard in blkif.h

Just a simple sed s/trim/discard/. We are ignoring the comments
which are incorrect.

The reason for the name change is that TRIM is specific to ATA
while the operation can be done on top of SCSI interfaces too.
Hence the rename to something more generic.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r c681dd5aecf3 -r be1a190becae xen/include/public/io/blkif.h
--- a/xen/include/public/io/blkif.h	Tue Oct 25 19:22:09 2011 +0100
+++ b/xen/include/public/io/blkif.h	Thu Oct 27 16:03:51 2011 +0100
@@ -82,25 +82,25 @@
  */
 #define BLKIF_OP_RESERVED_1        4
 /*
- * Recognised only if "feature-trim" is present in backend xenbus info.
- * The "feature-trim" node contains a boolean indicating whether trim
- * requests are likely to succeed or fail. Either way, a trim request
+ * Recognised only if "feature-discard" is present in backend xenbus info.
+ * The "feature-discard" node contains a boolean indicating whether discard
+ * requests are likely to succeed or fail. Either way, a discard request
  * may fail at any time with BLKIF_RSP_EOPNOTSUPP if it is unsupported by
  * the underlying block-device hardware. The boolean simply indicates whether
- * or not it is worthwhile for the frontend to attempt trim requests.
- * If a backend does not recognise BLKIF_OP_TRIM, it should *not*
- * create the "feature-trim" node!
+ * or not it is worthwhile for the frontend to attempt discard requests.
+ * If a backend does not recognise BLKIF_OP_DISCARD, it should *not*
+ * create the "feature-discard" node!
  * 
- * Trim operation is a request for the underlying block device to mark
- * extents to be erased. Trim operations are passed with sector_number as the
- * sector index to begin trim operations at and nr_sectors as the number of
- * sectors to be trimmed. The specified sectors should be trimmed if the
- * underlying block device supports trim operations, or a BLKIF_RSP_EOPNOTSUPP
- * should be returned. More information about trim operations at:
+ * Discard operation is a request for the underlying block device to mark
+ * extents to be erased. Discard operations are passed with sector_number as the
+ * sector index to begin discard operations at and nr_sectors as the number of
+ * sectors to be discarded. The specified sectors should be discarded if the
+ * underlying block device supports discard operations, or a BLKIF_RSP_EOPNOTSUPP
+ * should be returned. More information about discard operations at:
  * http://t13.org/Documents/UploadedDocuments/docs2008/
  *     e07154r6-Data_Set_Management_Proposal_for_ATA-ACS2.doc
  */
-#define BLKIF_OP_TRIM              5
+#define BLKIF_OP_DISCARD           5
 
 /*
  * Maximum scatter/gather segments per request.
@@ -135,17 +135,17 @@
 
 /*
  * Cast to this structure when blkif_request.operation == BLKIF_OP_TRIM
- * sizeof(struct blkif_request_trim) <= sizeof(struct blkif_request)
+ * sizeof(struct blkif_request_discard) <= sizeof(struct blkif_request)
  */
-struct blkif_request_trim {
-    uint8_t        operation;    /* BLKIF_OP_TRIM                        */
+struct blkif_request_discard {
+    uint8_t        operation;    /* BLKIF_OP_DISCARD                     */
     uint8_t        reserved;     /*                                      */
     blkif_vdev_t   handle;       /* same as for read/write requests      */
     uint64_t       id;           /* private guest value, echoed in resp  */
     blkif_sector_t sector_number;/* start sector idx on disk             */
-    uint64_t       nr_sectors;   /* number of contiguous sectors to trim */
+    uint64_t       nr_sectors;   /* number of contiguous sectors to discard*/
 };
-typedef struct blkif_request_trim blkif_request_trim_t;
+typedef struct blkif_request_discard blkif_request_discard_t;
 
 struct blkif_response {
     uint64_t        id;              /* copied from request */

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 27 14:33:38 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 27 Oct 2011 14:33:38 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RJXZy-0000W0-Et; Thu, 27 Oct 2011 14:33:38 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RJXZf-0000SK-Ra
	for xen-changelog@lists.xensource.com; Thu, 27 Oct 2011 14:33:20 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-182.messagelabs.com!1319751196!1018239!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 948 invoked from network); 27 Oct 2011 21:33:16 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-7.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	27 Oct 2011 21:33:16 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RJXZc-0006yD-Dx
	for xen-changelog@lists.xensource.com; Thu, 27 Oct 2011 22:33:16 +0100
Message-Id: <E1RJXZc-0006yD-Dx@xenbits.xen.org>
Date: Thu, 27 Oct 2011 22:33:15 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] interface: Flesh out the
	BLKIF_OP_DISCARD description.
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 Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
# Date 1319727857 -3600
# Node ID 083797fda372341278757b5e23db6de0862c4242
# Parent  be1a190becae07485081d170fd41215203a2886b
interface: Flesh out the BLKIF_OP_DISCARD description.

We flesh out details on what is expected of 'feature-flush' and
what are some of the extra parameters that the frontend can read
from the backend. Those extra parameters are: : discard-aligment,
and discard-granularity.

Acked-by: Jan Beulich <JBeulich@suse.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r be1a190becae -r 083797fda372 xen/include/public/io/blkif.h
--- a/xen/include/public/io/blkif.h	Thu Oct 27 16:03:51 2011 +0100
+++ b/xen/include/public/io/blkif.h	Thu Oct 27 16:04:17 2011 +0100
@@ -83,22 +83,43 @@
 #define BLKIF_OP_RESERVED_1        4
 /*
  * Recognised only if "feature-discard" is present in backend xenbus info.
- * The "feature-discard" node contains a boolean indicating whether discard
- * requests are likely to succeed or fail. Either way, a discard request
+ * The "feature-discard" node contains a boolean indicating whether trim
+ * (ATA) or unmap (SCSI) - conviently called discard requests are likely
+ * to succeed or fail. Either way, a discard request
  * may fail at any time with BLKIF_RSP_EOPNOTSUPP if it is unsupported by
  * the underlying block-device hardware. The boolean simply indicates whether
  * or not it is worthwhile for the frontend to attempt discard requests.
  * If a backend does not recognise BLKIF_OP_DISCARD, it should *not*
  * create the "feature-discard" node!
- * 
+ *
  * Discard operation is a request for the underlying block device to mark
- * extents to be erased. Discard operations are passed with sector_number as the
+ * extents to be erased. However, discard does not guarantee that the blocks
+ * will be erased from the device - it is just a hint to the device
+ * controller that these blocks are no longer in use. What the device
+ * controller does with that information is left to the controller.
+ * Discard operations are passed with sector_number as the
  * sector index to begin discard operations at and nr_sectors as the number of
  * sectors to be discarded. The specified sectors should be discarded if the
- * underlying block device supports discard operations, or a BLKIF_RSP_EOPNOTSUPP
- * should be returned. More information about discard operations at:
+ * underlying block device supports trim (ATA) or unmap (SCSI) operations,
+ * or a BLKIF_RSP_EOPNOTSUPP  should be returned.
+ * More information about trim/unmap operations at:
  * http://t13.org/Documents/UploadedDocuments/docs2008/
  *     e07154r6-Data_Set_Management_Proposal_for_ATA-ACS2.doc
+ * http://www.seagate.com/staticfiles/support/disc/manuals/
+ *     Interface%20manuals/100293068c.pdf
+ * The backend can optionally provide these extra XenBus attributes to
+ * further optimize the discard functionality:
+ * 'discard-aligment' - Devices that support discard functionality may
+ * internally allocate space in units that are bigger than the exported
+ * logical block size. The discard-alignment parameter indicates how many bytes
+ * the beginning of the partition is offset from the internal allocation unit's
+ * natural alignment. Do not confuse this with natural disk alignment offset.
+ * 'discard-granularity'  - Devices that support discard functionality may
+ * internally allocate space using units that are bigger than the logical block
+ * size. The discard-granularity parameter indicates the size of the internal
+ * allocation unit in bytes if reported by the device. Otherwise the
+ * discard-granularity will be set to match the device's physical block size.
+ * It is the minimum size you can discard.
  */
 #define BLKIF_OP_DISCARD           5
 

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 27 14:33:47 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 27 Oct 2011 14:33:47 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RJXa7-0000Z8-45; Thu, 27 Oct 2011 14:33:47 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RJXZg-0000SL-D9
	for xen-changelog@lists.xensource.com; Thu, 27 Oct 2011 14:33:20 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-216.messagelabs.com!1319751197!1338948!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5040 invoked from network); 27 Oct 2011 21:33:17 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	27 Oct 2011 21:33:17 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RJXZc-0006yv-Vv
	for xen-changelog@lists.xensource.com; Thu, 27 Oct 2011 22:33:16 +0100
Message-Id: <E1RJXZc-0006yv-Vv@xenbits.xen.org>
Date: Thu, 27 Oct 2011 22:33:16 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] interface: add 'discard-secure' and
	BLKIF_DISCARD_SECURE
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 Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
# Date 1319727888 -3600
# Node ID 7536987fbad83785d8168ce120d3039a69c4a1f9
# Parent  083797fda372341278757b5e23db6de0862c4242
interface: add 'discard-secure' and BLKIF_DISCARD_SECURE

Alter the 'reserved' uint8_t to be used a 'flag'. We use only for one
flag: BLKIF_DISCARD_SECURE.

That flag can only be set if the backend has set 'discard-secure' to
one.  If backend has not set 'discard-secure' to one, that flag will
have no effect.

Acked-by: Jan Beulich <JBeulich@suse.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 083797fda372 -r 7536987fbad8 xen/include/public/io/blkif.h
--- a/xen/include/public/io/blkif.h	Thu Oct 27 16:04:17 2011 +0100
+++ b/xen/include/public/io/blkif.h	Thu Oct 27 16:04:48 2011 +0100
@@ -120,6 +120,9 @@
  * allocation unit in bytes if reported by the device. Otherwise the
  * discard-granularity will be set to match the device's physical block size.
  * It is the minimum size you can discard.
+ * 'discard-secure' - All copies of the discarded sectors (potentially created
+ * by garbage collection) must also be erased.  To use this feature, the flag
+ * BLKIF_DISCARD_SECURE must be set in the blkif_request_discard.
  */
 #define BLKIF_OP_DISCARD           5
 
@@ -160,7 +163,8 @@
  */
 struct blkif_request_discard {
     uint8_t        operation;    /* BLKIF_OP_DISCARD                     */
-    uint8_t        reserved;     /*                                      */
+    uint8_t        flag;         /* BLKIF_DISCARD_SECURE or zero         */
+#define BLKIF_DISCARD_SECURE (1<<0)  /* ignored if discard-secure=0      */
     blkif_vdev_t   handle;       /* same as for read/write requests      */
     uint64_t       id;           /* private guest value, echoed in resp  */
     blkif_sector_t sector_number;/* start sector idx on disk             */

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 27 14:34:00 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 27 Oct 2011 14:34:00 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RJXaJ-0000cU-HK; Thu, 27 Oct 2011 14:33:59 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RJXZh-0000SM-0P
	for xen-changelog@lists.xensource.com; Thu, 27 Oct 2011 14:33:21 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1319751197!36969936!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9991 invoked from network); 27 Oct 2011 21:33:17 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	27 Oct 2011 21:33:17 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RJXZd-0006zd-Ho
	for xen-changelog@lists.xensource.com; Thu, 27 Oct 2011 22:33:17 +0100
Message-Id: <E1RJXZd-0006zd-Ho@xenbits.xen.org>
Date: Thu, 27 Oct 2011 22:33:17 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: re-inject emulated level pirqs
	in PV on HVM guests if still
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 Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1319728038 -3600
# Node ID 0526644ad2a620fbe7ac867d22be5936bec20367
# Parent  7536987fbad83785d8168ce120d3039a69c4a1f9
x86: re-inject emulated level pirqs in PV on HVM guests if still
asserted

PV on HVM guests can loose level interrupts coming from emulated
devices if they have been remapped onto event channels.  The reason is
that we are missing the code to inject a pirq again in the guest when
the guest EOIs it, if it corresponds to an emulated level interrupt
and the interrupt is still asserted.

Fix this issue and also return error when the guest tries to get the
irq_status of a non-existing pirq.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 7536987fbad8 -r 0526644ad2a6 xen/arch/x86/physdev.c
--- a/xen/arch/x86/physdev.c	Thu Oct 27 16:04:48 2011 +0100
+++ b/xen/arch/x86/physdev.c	Thu Oct 27 16:07:18 2011 +0100
@@ -11,6 +11,7 @@
 #include <asm/current.h>
 #include <asm/io_apic.h>
 #include <asm/msi.h>
+#include <asm/hvm/irq.h>
 #include <asm/hypercall.h>
 #include <public/xen.h>
 #include <public/physdev.h>
@@ -270,6 +271,18 @@
         if ( !is_hvm_domain(v->domain) ||
              domain_pirq_to_irq(v->domain, eoi.irq) > 0 )
             pirq_guest_eoi(pirq);
+        if ( is_hvm_domain(v->domain) &&
+                domain_pirq_to_emuirq(v->domain, eoi.irq) > 0 )
+        {
+            struct hvm_irq *hvm_irq = &v->domain->arch.hvm_domain.irq;
+            int gsi = domain_pirq_to_emuirq(v->domain, eoi.irq);
+
+            /* if this is a level irq and count > 0, send another
+             * notification */ 
+            if ( gsi >= NR_ISAIRQS /* ISA irqs are edge triggered */
+                    && hvm_irq->gsi_assert_count[gsi] )
+                send_guest_pirq(v->domain, pirq);
+        }
         spin_unlock(&v->domain->event_lock);
         ret = 0;
         break;
@@ -328,9 +341,10 @@
             break;
         irq_status_query.flags = 0;
         if ( is_hvm_domain(v->domain) &&
-             domain_pirq_to_irq(v->domain, irq) <= 0 )
+             domain_pirq_to_irq(v->domain, irq) <= 0 &&
+             domain_pirq_to_emuirq(v->domain, irq) == IRQ_UNBOUND )
         {
-            ret = copy_to_guest(arg, &irq_status_query, 1) ? -EFAULT : 0;
+            ret = -EINVAL;
             break;
         }
 

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 27 16:01:16 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 27 Oct 2011 16:01:16 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RJYwl-0008Pd-CL; Thu, 27 Oct 2011 16:01:15 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RJYvr-0008Fr-T1
	for xen-changelog@lists.xensource.com; Thu, 27 Oct 2011 16:00:24 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-27.messagelabs.com!1319756389!41709041!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9999 invoked from network); 27 Oct 2011 22:59:49 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	27 Oct 2011 22:59:49 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RJYvo-0006Wd-L4
	for xen-changelog@lists.xensource.com; Fri, 28 Oct 2011 00:00:16 +0100
Message-Id: <E1RJYvo-0006Wd-L4@xenbits.xen.org>
Date: Fri, 28 Oct 2011 00:00:16 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] Return -EINVAL when trying to
	kick/kill a nonexistent domain watchdog
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@xen.org>
# Date 1319729041 -3600
# Node ID c33e15835e33a6ba4fde0c1d853cd2a7e3c0664e
# Parent  849bf4ab5fe0b9006d59965edc2de630d2976118
Return -EINVAL when trying to kick/kill a nonexistent domain watchdog

... to be more in-line with the NR_DOMAIN_WATCHDOG_TIMERS check at the
top of domain_watchdog(), and also to follow the
timer_(delete|settime)
POSIX API's EINVAL return value.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>

Also, replace EEXIST with ENOSPC when failing to allocate a new
domain watchdog.

Signed-off-by: Keir Fraser <keir@xen.org>

Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   23963:7cfd5bb3b9f9
xen-unstable date:        Fri Oct 14 18:08:04 2011 +0100
---


diff -r 849bf4ab5fe0 -r c33e15835e33 xen/common/schedule.c
--- a/xen/common/schedule.c	Thu Oct 27 16:22:53 2011 +0100
+++ b/xen/common/schedule.c	Thu Oct 27 16:24:01 2011 +0100
@@ -762,14 +762,14 @@
             break;
         }
         spin_unlock(&d->watchdog_lock);
-        return id == NR_DOMAIN_WATCHDOG_TIMERS ? -EEXIST : id + 1;
+        return id == NR_DOMAIN_WATCHDOG_TIMERS ? -ENOSPC : id + 1;
     }
 
     id -= 1;
     if ( !test_bit(id, &d->watchdog_inuse_map) )
     {
         spin_unlock(&d->watchdog_lock);
-        return -EEXIST;
+        return -EINVAL;
     }
 
     if ( timeout == 0 )

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 27 16:01:28 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 27 Oct 2011 16:01:28 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RJYwx-0008Sb-5n; Thu, 27 Oct 2011 16:01:27 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RJYvr-0008Fq-OJ
	for xen-changelog@lists.xensource.com; Thu, 27 Oct 2011 16:00:24 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-182.messagelabs.com!1319756416!1004036!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7721 invoked from network); 27 Oct 2011 23:00:16 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	27 Oct 2011 23:00:16 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RJYvn-0006WO-Jm
	for xen-changelog@lists.xensource.com; Fri, 28 Oct 2011 00:00:15 +0100
Message-Id: <E1RJYvn-0006WO-Jm@xenbits.xen.org>
Date: Fri, 28 Oct 2011 00:00:14 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] x86/AMD: Do not enable ARAT
	feature on AMD processors below family 0x12
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 Boris Ostrovsky <boris.ostrovsky@amd.com>
# Date 1319728973 -3600
# Node ID 849bf4ab5fe0b9006d59965edc2de630d2976118
# Parent  9a38e30e54599b958382ad19a70a48567a38f816
x86/AMD: Do not enable ARAT feature on AMD processors below family 0x12

Determining whether an AMD processor is affected by erratum 400 may
have some corner cases and handling these cases is somewhat
complicated.
In the interest of simplicity we won't claim ARAT support on processor
families below 0x12.

Mirrors Linux commit e9cdd343a5e42c43bcda01e609fa23089e026470

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@amd.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
xen-unstable changeset:   23925:08d6ba4e447d
xen-unstable date:        Fri Oct 07 10:32:15 2011 +0200
---


diff -r 9a38e30e5459 -r 849bf4ab5fe0 xen/arch/x86/cpu/amd.c
--- a/xen/arch/x86/cpu/amd.c	Thu Oct 27 16:14:36 2011 +0100
+++ b/xen/arch/x86/cpu/amd.c	Thu Oct 27 16:22:53 2011 +0100
@@ -608,8 +608,11 @@
 	}
 #endif
 
-	/* As a rule processors have APIC timer running in deep C states */
-	if (c->x86 > 0xf && !cpu_has_amd_erratum(c, AMD_ERRATUM_400))
+	/*
+	 * Family 0x12 and above processors have APIC timer
+	 * running in deep C states.
+	 */
+	if (c->x86 > 0x11)
 		set_bit(X86_FEATURE_ARAT, c->x86_capability);
 
 	/* Prevent TSC drift in non single-processor, single-core platforms. */

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

From xen-changelog-bounces@lists.xensource.com Thu Oct 27 16:01:43 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 27 Oct 2011 16:01:43 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RJYxD-0008WL-Gv; Thu, 27 Oct 2011 16:01:43 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RJYvr-0008Fm-4r
	for xen-changelog@lists.xensource.com; Thu, 27 Oct 2011 16:00:28 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-174.messagelabs.com!1319756415!33255690!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30227 invoked from network); 27 Oct 2011 23:00:15 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	27 Oct 2011 23:00:15 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RJYvm-0006W5-I3
	for xen-changelog@lists.xensource.com; Fri, 28 Oct 2011 00:00:14 +0100
Message-Id: <E1RJYvm-0006W5-I3@xenbits.xen.org>
Date: Fri, 28 Oct 2011 00:00:13 +0100
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] Backport per-device vector map
	patches to xen 4.1.3
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 Wei Wang2 <wei.wang2@amd.com>
# Date 1319728476 -3600
# Node ID 9a38e30e54599b958382ad19a70a48567a38f816
# Parent  81e39a4978ea14e0180ce4692b889083c279773f
Backport per-device vector map patches to xen 4.1.3

Recently we found an issue in xen 4.1. Under heavy I/O stress such as
running bonnie++, Dom0 would lost its hard disk with lots of I/O
errors. We found that some PCI-E devices was using the same vector as
SMBus on AMD platforms and George' patch set that enables per-device
vector map can fix this problem.

23752 xen: Infrastructure to allow irqs to share vector maps
23753 xen: Option to allow per-device vector maps for MSI IRQs
23754 xen: AMD IOMMU: Automatically enable per-device vector maps
23786 x86: Fix up irq vector map logic
23812 xen: Add global irq_vector_map option
23899 AMD-IOMMU: remove dead variable references

From: Wei Wang2 <wei.wang2@amd.com>
Committed-by: Keir Fraser <keir@xen.org>

AMD-IOMMU: remove dead variable references

These got orphaned up by recent changes.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   23899:a99d75671a91
xen-unstable date:        Tue Oct 04 14:11:56 2011 +0200

docs: Fix 'make docs'

Signed-off-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   23819:5fe770c8a8a3
xen-unstable date:        Tue Sep 06 15:49:40 2011 +0100

xen: Add global irq_vector_map option, set if using AMD global intremap tables

As mentioned in previous changesets, AMD IOMMU interrupt
remapping tables only look at the vector, not the destination
id of an interrupt.  This means that all IRQs going through
the same interrupt remapping table need to *not* share vectors.

The irq "vector map" functionality was originally introduced
after a patch which disabled global AMD IOMMUs entirely.  That
patch has since been reverted, meaning that AMD intremap tables
can either be per-device or global.

This patch therefore introduces a global irq vector map option,
and enables it if we're using an AMD IOMMU with a global
interrupt remapping table.

This patch removes the "irq-perdev-vector-map" boolean
command-line optino and replaces it with "irq_vector_map",
which can have one of three values: none, global, or per-device.

Setting the irq_vector_map to any value will override the
default that the AMD code sets.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
xen-unstable changeset:   23812:32814ad7458d
xen-unstable date:        Mon Sep 05 15:00:15 2011 +0100

x86: Fix up irq vector map logic

We need to make sure that cfg->used_vector is only cleared once;
otherwise there may be a race condition that allows the same vector to
be assigned twice, defeating the whole purpose of the map.

This makes two changes:
* __clear_irq_vector() only clears the vector if the irq is not being
moved
* smp_iqr_move_cleanup_interrupt() only clears used_vector if this
is the last place it's being used (move_cleanup_count==0 after
decrement).

Also make use of asserts more consistent, to catch this kind of logic
bug in the future.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
xen-unstable changeset:   23786:3a05da2dc7c0
xen-unstable date:        Mon Aug 22 16:15:33 2011 +0100

xen: AMD IOMMU: Automatically enable per-device vector maps

Automatically enable per-device vector maps when using IOMMU,
unless disabled specifically by an IOMMU parameter.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
xen-unstable changeset:   23754:fa4e2ca9ecff
xen-unstable date:        Tue Jul 26 18:37:32 2011 +0100

xen: Option to allow per-device vector maps for MSI IRQs

Add a vector-map to pci_dev, and add an option to point MSI-related
IRQs to the vector-map of the device.

This prevents irqs from the same device from being assigned
the same vector on different pcpus.  This is required for systems
using an AMD IOMMU, since the intremap tables on AMD only look at
vector, and not destination ID.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
xen-unstable changeset:   23753:2e0cf9428554
xen-unstable date:        Tue Jul 26 18:37:16 2011 +0100

xen: Infrastructure to allow irqs to share vector maps

Laying the groundwork for per-device vector maps.  This generic
code allows any irq to point to a vector map; all irqs sharing the
same vector map will avoid sharing vectors.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
xen-unstable changeset:   23752:ef9ed3d2aa87
xen-unstable date:        Tue Jul 26 18:36:58 2011 +0100
---


diff -r 81e39a4978ea -r 9a38e30e5459 docs/src/user.tex
--- a/docs/src/user.tex	Mon Oct 24 18:03:35 2011 +0100
+++ b/docs/src/user.tex	Thu Oct 27 16:14:36 2011 +0100
@@ -4197,6 +4197,10 @@
 \item [ vcpu\_migration\_delay=$<$minimum\_time$>$] Set minimum time of 
   vcpu migration in microseconds (default 0). This parameter avoids agressive
   vcpu migration. For example, the linux kernel uses 0.5ms by default.
+\item [ irq\_vector\_map=xxx ] Enable irq vector non-sharing maps.  Setting 'global' 
+  will ensure that no  IRQs will share vectors.  Setting 'per-device' will ensure 
+  that no IRQs from the same device will share vectors.  Setting to 'none' will
+  disable it entirely, overriding any defaults the IOMMU code may set.
 \end{description}
 
 In addition, the following options may be specified on the Xen command
diff -r 81e39a4978ea -r 9a38e30e5459 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Mon Oct 24 18:03:35 2011 +0100
+++ b/xen/arch/x86/io_apic.c	Thu Oct 27 16:14:36 2011 +0100
@@ -548,6 +548,13 @@
         }
         __get_cpu_var(vector_irq)[vector] = -1;
         cfg->move_cleanup_count--;
+
+        if ( cfg->move_cleanup_count == 0 
+             &&  cfg->used_vectors )
+        {
+            ASSERT(test_bit(vector, cfg->used_vectors));
+            clear_bit(vector, cfg->used_vectors);
+        }
 unlock:
         spin_unlock(&desc->lock);
     }
diff -r 81e39a4978ea -r 9a38e30e5459 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Mon Oct 24 18:03:35 2011 +0100
+++ b/xen/arch/x86/irq.c	Thu Oct 27 16:14:36 2011 +0100
@@ -24,6 +24,8 @@
 #include <asm/mach-generic/mach_apic.h>
 #include <public/physdev.h>
 
+static void parse_irq_vector_map_param(char *s);
+
 /* opt_noirqbalance: If true, software IRQ balancing/affinity is disabled. */
 bool_t __read_mostly opt_noirqbalance = 0;
 boolean_param("noirqbalance", opt_noirqbalance);
@@ -32,6 +34,12 @@
 unsigned int __read_mostly nr_irqs;
 integer_param("nr_irqs", nr_irqs);
 
+/* This default may be changed by the AMD IOMMU code */
+int __read_mostly opt_irq_vector_map = OPT_IRQ_VECTOR_MAP_DEFAULT;
+custom_param("irq_vector_map", parse_irq_vector_map_param);
+
+vmask_t global_used_vector_map;
+
 u8 __read_mostly *irq_vector;
 struct irq_desc __read_mostly *irq_desc = NULL;
 
@@ -60,6 +68,26 @@
 static unsigned int __read_mostly irq_ratelimit_threshold = 10000;
 integer_param("irq_ratelimit", irq_ratelimit_threshold);
 
+static void __init parse_irq_vector_map_param(char *s)
+{
+    char *ss;
+
+    do {
+        ss = strchr(s, ',');
+        if ( ss )
+            *ss = '\0';
+
+        if ( !strcmp(s, "none"))
+            opt_irq_vector_map=OPT_IRQ_VECTOR_MAP_NONE;
+        else if ( !strcmp(s, "global"))
+            opt_irq_vector_map=OPT_IRQ_VECTOR_MAP_GLOBAL;
+        else if ( !strcmp(s, "per-device"))
+            opt_irq_vector_map=OPT_IRQ_VECTOR_MAP_PERDEV;
+
+        s = ss + 1;
+    } while ( ss );
+}
+
 /* Must be called when irq disabled */
 void lock_vector_lock(void)
 {
@@ -94,6 +122,11 @@
         per_cpu(vector_irq, cpu)[vector] = irq;
     cfg->vector = vector;
     cfg->cpu_mask = online_mask;
+    if ( cfg->used_vectors )
+    {
+        ASSERT(!test_bit(vector, cfg->used_vectors));
+        set_bit(vector, cfg->used_vectors);
+    }
     irq_status[irq] = IRQ_USED;
     if (IO_APIC_IRQ(irq))
         irq_vector[irq] = vector;
@@ -159,6 +192,7 @@
     desc->depth   = 1;
     desc->msi_desc = NULL;
     desc->handler = &no_irq_type;
+    desc->chip_data->used_vectors=NULL;
     cpus_setall(desc->affinity);
     spin_unlock_irqrestore(&desc->lock, flags);
 
@@ -191,6 +225,7 @@
 
     if (likely(!cfg->move_in_progress))
         return;
+
     cpus_and(tmp_mask, cfg->old_cpu_mask, cpu_online_map);
     for_each_cpu_mask(cpu, tmp_mask) {
         for (vector = FIRST_DYNAMIC_VECTOR; vector <= LAST_DYNAMIC_VECTOR;
@@ -202,6 +237,12 @@
         }
      }
 
+    if ( cfg->used_vectors )
+    {
+        ASSERT(test_bit(vector, cfg->used_vectors));
+        clear_bit(vector, cfg->used_vectors);
+    }
+
     cfg->move_in_progress = 0;
 }
 
@@ -261,6 +302,7 @@
     cfg->vector = IRQ_VECTOR_UNASSIGNED;
     cpus_clear(cfg->cpu_mask);
     cpus_clear(cfg->old_cpu_mask);
+    cfg->used_vectors = NULL;
 }
 
 int init_irq_data(void)
@@ -330,6 +372,41 @@
     end_none
 };
 
+static vmask_t *irq_get_used_vector_mask(int irq)
+{
+    vmask_t *ret = NULL;
+
+    if ( opt_irq_vector_map == OPT_IRQ_VECTOR_MAP_GLOBAL )
+    {
+        struct irq_desc *desc = irq_to_desc(irq);
+
+        ret = &global_used_vector_map;
+
+        if ( desc->chip_data->used_vectors )
+        {
+            printk(XENLOG_INFO "%s: Strange, unassigned irq %d already has used_vectors!\n",
+                   __func__, irq);
+        }
+        else
+        {
+            int vector;
+            
+            vector = irq_to_vector(irq);
+            if ( vector > 0 )
+            {
+                printk(XENLOG_INFO "%s: Strange, irq %d already assigned vector %d!\n",
+                       __func__, irq, vector);
+                
+                ASSERT(!test_bit(vector, ret));
+
+                set_bit(vector, ret);
+            }
+        }
+    }
+
+    return ret;
+}
+
 int __assign_irq_vector(int irq, struct irq_cfg *cfg, const cpumask_t *mask)
 {
     /*
@@ -348,6 +425,7 @@
     int cpu, err;
     unsigned long flags;
     cpumask_t tmp_mask;
+    vmask_t *irq_used_vectors = NULL;
 
     old_vector = irq_to_vector(irq);
     if (old_vector) {
@@ -362,6 +440,17 @@
         return -EAGAIN;
 
     err = -ENOSPC;
+
+    /* This is the only place normal IRQs are ever marked
+     * as "in use".  If they're not in use yet, check to see
+     * if we need to assign a global vector mask. */
+    if ( irq_status[irq] == IRQ_USED )
+    {
+        irq_used_vectors = cfg->used_vectors;
+    }
+    else
+        irq_used_vectors = irq_get_used_vector_mask(irq);
+
     for_each_cpu_mask(cpu, *mask) {
         int new_cpu;
         int vector, offset;
@@ -387,6 +476,10 @@
         if (test_bit(vector, used_vectors))
             goto next;
 
+        if (irq_used_vectors
+            && test_bit(vector, irq_used_vectors) )
+            goto next;
+
         for_each_cpu_mask(new_cpu, tmp_mask)
             if (per_cpu(vector_irq, new_cpu)[vector] != -1)
                 goto next;
@@ -404,8 +497,20 @@
         cpus_copy(cfg->cpu_mask, tmp_mask);
 
         irq_status[irq] = IRQ_USED;
-            if (IO_APIC_IRQ(irq))
-                    irq_vector[irq] = vector;
+        ASSERT((cfg->used_vectors == NULL)
+               || (cfg->used_vectors == irq_used_vectors));
+        cfg->used_vectors = irq_used_vectors;
+
+        if (IO_APIC_IRQ(irq))
+            irq_vector[irq] = vector;
+
+        if ( cfg->used_vectors )
+        {
+            ASSERT(!test_bit(vector, cfg->used_vectors));
+
+            set_bit(vector, cfg->used_vectors);
+        }
+
         err = 0;
         local_irq_restore(flags);
         break;
@@ -1494,7 +1599,7 @@
 
     if ( !IS_PRIV(current->domain) &&
          !(IS_PRIV_FOR(current->domain, d) &&
-          irq_access_permitted(current->domain, pirq)))
+           irq_access_permitted(current->domain, pirq)))
         return -EPERM;
 
     if ( pirq < 0 || pirq >= d->nr_pirqs || irq < 0 || irq >= nr_irqs )
@@ -1542,8 +1647,21 @@
 
         if ( desc->handler != &no_irq_type )
             dprintk(XENLOG_G_ERR, "dom%d: irq %d in use\n",
-              d->domain_id, irq);
+                    d->domain_id, irq);
         desc->handler = &pci_msi_type;
+        if ( opt_irq_vector_map == OPT_IRQ_VECTOR_MAP_PERDEV
+             && !desc->chip_data->used_vectors )
+        {
+            desc->chip_data->used_vectors = &pdev->info.used_vectors;
+            if ( desc->chip_data->vector != IRQ_VECTOR_UNASSIGNED )
+            {
+                int vector = desc->chip_data->vector;
+                ASSERT(!test_bit(vector, desc->chip_data->used_vectors));
+
+                set_bit(vector, desc->chip_data->used_vectors);
+            }
+        }
+
         d->arch.pirq_irq[pirq] = irq;
         d->arch.irq_pirq[irq] = pirq;
         setup_msi_irq(pdev, msi_desc, irq);
@@ -1554,9 +1672,12 @@
         d->arch.pirq_irq[pirq] = irq;
         d->arch.irq_pirq[irq] = pirq;
         spin_unlock_irqrestore(&desc->lock, flags);
+
+        if ( opt_irq_vector_map == OPT_IRQ_VECTOR_MAP_PERDEV )
+            printk(XENLOG_INFO "Per-device vector maps for GSIs not implemented yet.\n");
     }
 
- done:
+done:
     return ret;
 }
 
diff -r 81e39a4978ea -r 9a38e30e5459 xen/drivers/passthrough/amd/pci_amd_iommu.c
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c	Mon Oct 24 18:03:35 2011 +0100
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c	Thu Oct 27 16:14:36 2011 +0100
@@ -166,6 +166,35 @@
         return -ENODEV;
     }
 
+    /*
+     * AMD IOMMUs don't distinguish between vectors destined for
+     * different cpus when doing interrupt remapping.  This means
+     * that interrupts going through the same intremap table
+     * can't share the same vector.
+     *
+     * If irq_vector_map isn't specified, choose a sensible default:
+     * - If we're using per-device interemap tables, per-device
+     *   vector non-sharing maps
+     * - If we're using a global interemap table, global vector
+     *   non-sharing map
+     */
+    if ( opt_irq_vector_map == OPT_IRQ_VECTOR_MAP_DEFAULT )
+    {
+        if ( amd_iommu_perdev_intremap )
+        {
+            printk("AMD-Vi: Enabling per-device vector maps\n");
+            opt_irq_vector_map = OPT_IRQ_VECTOR_MAP_PERDEV;
+        }
+        else
+        {
+            printk("AMD-Vi: Enabling global vector map\n");
+            opt_irq_vector_map = OPT_IRQ_VECTOR_MAP_GLOBAL;
+        }
+    }
+    else
+    {
+        printk("AMD-Vi: Not overriding irq_vector_map setting\n");
+    }
     return scan_pci_devices();
 }
 
diff -r 81e39a4978ea -r 9a38e30e5459 xen/include/asm-x86/irq.h
--- a/xen/include/asm-x86/irq.h	Mon Oct 24 18:03:35 2011 +0100
+++ b/xen/include/asm-x86/irq.h	Thu Oct 27 16:14:36 2011 +0100
@@ -23,11 +23,16 @@
 #define irq_to_desc(irq)    (&irq_desc[irq])
 #define irq_cfg(irq)        (&irq_cfg[irq])
 
+typedef struct {
+    DECLARE_BITMAP(_bits,NR_VECTORS);
+} vmask_t;
+
 struct irq_cfg {
         int  vector;
         cpumask_t cpu_mask;
         cpumask_t old_cpu_mask;
         unsigned move_cleanup_count;
+        vmask_t *used_vectors;
         u8 move_in_progress : 1;
 };
 
@@ -40,6 +45,13 @@
 
 extern bool_t opt_noirqbalance;
 
+#define OPT_IRQ_VECTOR_MAP_DEFAULT 0 /* Do the default thing  */
+#define OPT_IRQ_VECTOR_MAP_NONE    1 /* None */ 
+#define OPT_IRQ_VECTOR_MAP_GLOBAL  2 /* One global vector map (no vector sharing) */ 
+#define OPT_IRQ_VECTOR_MAP_PERDEV  3 /* Per-device vetor map (no vector sharing w/in a device) */
+
+extern int opt_irq_vector_map;
+
 /*
  * Per-cpu current frame pointer - the location of the last exception frame on
  * the stack
diff -r 81e39a4978ea -r 9a38e30e5459 xen/include/xen/pci.h
--- a/xen/include/xen/pci.h	Mon Oct 24 18:03:35 2011 +0100
+++ b/xen/include/xen/pci.h	Thu Oct 27 16:14:36 2011 +0100
@@ -11,6 +11,7 @@
 #include <xen/types.h>
 #include <xen/list.h>
 #include <xen/spinlock.h>
+#include <xen/irq.h>
 
 /*
  * The PCI interface treats multi-function devices as independent
@@ -38,6 +39,7 @@
         u8 bus;
         u8 devfn;
     } physfn;
+   vmask_t used_vectors; 
 };
 
 struct pci_dev {

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 28 12:56:00 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 28 Oct 2011 12:56:00 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RJsX1-0000MF-LX; Fri, 28 Oct 2011 12:55:59 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RJsWr-0000L2-SF
	for xen-changelog@lists.xensource.com; Fri, 28 Oct 2011 12:55:50 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-182.messagelabs.com!1319831746!601496!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28640 invoked from network); 28 Oct 2011 19:55:46 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Oct 2011 19:55:46 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RJsWn-000593-Tz
	for xen-changelog@lists.xensource.com; Fri, 28 Oct 2011 20:55:46 +0100
Message-Id: <E1RJsWn-000593-Tz@xenbits.xen.org>
Date: Fri, 28 Oct 2011 20:55:30 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] hvmloader/acpi/dsdt: Move IO port
	range reservation
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 Anthony PERARD <anthony.perard@citrix.com>
# Date 1319818475 -3600
# Node ID b1e1e1c2ceac33f282bd75bafe104750f971c484
# Parent  9a2aad56b392596829c241e981507cabb5ba7b52
hvmloader/acpi/dsdt: Move IO port range reservation

This patch move the IO port range reservation from the dsdt.asl to
mk_dsdt.  This IO port range need to be generated by mk_dsdt, because
qemu-xen use different port. The IO port for qemu-xen will be added in
a later patch.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 9a2aad56b392 -r b1e1e1c2ceac tools/firmware/hvmloader/acpi/dsdt.asl
--- a/tools/firmware/hvmloader/acpi/dsdt.asl	Fri Oct 28 17:12:21 2011 +0100
+++ b/tools/firmware/hvmloader/acpi/dsdt.asl	Fri Oct 28 17:14:35 2011 +0100
@@ -100,20 +100,6 @@
            Name (_ADR, 0x00)
            Name (_BBN, 0x00)
 
-           /*
-            * Reserve the IO port ranges [0x10c0, 0x1101] and [0xb044, 0xb047].
-            * Or else, for a hotplugged-in device, the port IO BAR assigned
-            * by guest OS may conflict with the ranges here.
-            */
-           Device(HP0)
-           {
-               Name(_HID, EISAID("PNP0C02"))
-               Name(_CRS, ResourceTemplate() {
-                   IO (Decode16, 0x10c0, 0x10c0, 0x00, 0x82)
-                   IO (Decode16, 0xb044, 0xb044, 0x00, 0x04)
-               })
-           }
-
            /* Make cirrues VGA S3 suspend/resume work in Windows XP/2003 */
            Device (VGA)
            {
diff -r 9a2aad56b392 -r b1e1e1c2ceac tools/firmware/hvmloader/acpi/mk_dsdt.c
--- a/tools/firmware/hvmloader/acpi/mk_dsdt.c	Fri Oct 28 17:12:21 2011 +0100
+++ b/tools/firmware/hvmloader/acpi/mk_dsdt.c	Fri Oct 28 17:14:35 2011 +0100
@@ -215,6 +215,19 @@
     /**** PCI0 start ****/
     push_block("Scope", "\\_SB.PCI0");
 
+    /*
+     * Reserve the IO port ranges [0x10c0, 0x1101] and [0xb044, 0xb047].
+     * Or else, for a hotplugged-in device, the port IO BAR assigned
+     * by guest OS may conflict with the ranges here.
+     */
+    push_block("Device", "HP0"); {
+        stmt("Name", "_HID, EISAID(\"PNP0C02\")");
+        stmt("Name", "_CRS, ResourceTemplate() {"
+             "  IO (Decode16, 0x10c0, 0x10c0, 0x00, 0x82)"
+             "  IO (Decode16, 0xb044, 0xb044, 0x00, 0x04)"
+             "}");
+    } pop_block();
+
     /*** PCI-ISA link definitions ***/
     /* BUFA: List of ISA IRQs available for linking to PCI INTx. */
     stmt("Name", "BUFA, ResourceTemplate() { "

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 28 12:56:17 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 28 Oct 2011 12:56:17 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RJsXI-0000QK-QV; Fri, 28 Oct 2011 12:56:17 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RJsWr-0000L0-ET
	for xen-changelog@lists.xensource.com; Fri, 28 Oct 2011 12:55:50 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-27.messagelabs.com!1319831734!43564282!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32147 invoked from network); 28 Oct 2011 19:55:34 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-11.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Oct 2011 19:55:34 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RJsWY-0004pQ-SA
	for xen-changelog@lists.xensource.com; Fri, 28 Oct 2011 20:55:30 +0100
Message-Id: <E1RJsWY-0004pQ-SA@xenbits.xen.org>
Date: Fri, 28 Oct 2011 20:55:09 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] hvmloader/acpi: Introduce --maxcpu
	option to mk_dsdt
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 Anthony PERARD <anthony.perard@citrix.com>
# Date 1319818341 -3600
# Node ID 9a2aad56b392596829c241e981507cabb5ba7b52
# Parent  0526644ad2a620fbe7ac867d22be5936bec20367
hvmloader/acpi: Introduce --maxcpu option to mk_dsdt

With this new option, there is no need to compile mk_dsdt for each
DSDT table that we want.  The Makefile is a bit reorganize to handle
this new option and to prepare more change in a coming patch.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---


diff -r 0526644ad2a6 -r 9a2aad56b392 .hgignore
--- a/.hgignore	Thu Oct 27 16:07:18 2011 +0100
+++ b/.hgignore	Fri Oct 28 17:12:21 2011 +0100
@@ -140,7 +140,9 @@
 ^tools/firmware/etherboot/ipxe\.git/.*$
 ^tools/firmware/extboot/extboot.img$
 ^tools/firmware/extboot/signrom$
+^tools/firmware/hvmloader/acpi/mk_dsdt$
 ^tools/firmware/hvmloader/acpi/dsdt.*\.c$
+^tools/firmware/hvmloader/acpi/dsdt_.*\.asl$
 ^tools/firmware/hvmloader/acpi/ssdt_.*\.h$
 ^tools/firmware/hvmloader/hvmloader$
 ^tools/firmware/hvmloader/roms\.inc$
diff -r 0526644ad2a6 -r 9a2aad56b392 tools/firmware/hvmloader/acpi/Makefile
--- a/tools/firmware/hvmloader/acpi/Makefile	Thu Oct 27 16:07:18 2011 +0100
+++ b/tools/firmware/hvmloader/acpi/Makefile	Fri Oct 28 17:12:21 2011 +0100
@@ -31,15 +31,19 @@
 	sed -e 's/AmlCode/$*/g' $*.hex >$@
 	rm -f $*.hex $*.aml
 
+mk_dsdt: mk_dsdt.c
+	$(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -o $@ mk_dsdt.c
+
 # NB. awk invocation is a portable alternative to 'head -n -1'
-dsdt_15cpu.c dsdt_anycpu.c: %.c: dsdt.asl mk_dsdt.c iasl
-	$(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -o mk_$* mk_dsdt.c
-	awk 'NR > 1 {print s} {s=$$0}' $< >$*.asl
-	./mk_$* >>$*.asl
+dsdt_%cpu.asl: dsdt.asl mk_dsdt
+	awk 'NR > 1 {print s} {s=$$0}' $< > $@
+	./mk_dsdt --maxcpu $*  >> $@
+
+$(filter dsdt_%.c,$(C_SRC)): %.c: iasl %.asl
 	iasl -vs -p $* -tc $*.asl
 	sed -e 's/AmlCode/$*/g' $*.hex >$@
 	echo "int $*_len=sizeof($*);" >>$@
-	rm -f $*.hex $*.aml $*.asl mk_$*
+	rm -f $*.aml $*.hex
 
 iasl:
 	@echo
@@ -56,7 +60,7 @@
 
 clean:
 	rm -rf *.a *.o $(IASL_VER) $(IASL_VER).tar.gz $(DEPS)
-	rm -rf ssdt_*.h dsdt*.c *~ *.aml *.hex mk_dsdt mk_dsdt15 dsdt_*cpu.asl
+	rm -rf ssdt_*.h dsdt*.c *~ *.aml *.hex mk_dsdt dsdt_*.asl
 
 install: all
 
diff -r 0526644ad2a6 -r 9a2aad56b392 tools/firmware/hvmloader/acpi/mk_dsdt.c
--- a/tools/firmware/hvmloader/acpi/mk_dsdt.c	Thu Oct 27 16:07:18 2011 +0100
+++ b/tools/firmware/hvmloader/acpi/mk_dsdt.c	Fri Oct 28 17:12:21 2011 +0100
@@ -1,6 +1,9 @@
 #include <stdio.h>
 #include <stdarg.h>
 #include <stdint.h>
+#include <string.h>
+#include <getopt.h>
+#include <stdlib.h>
 #include <xen/hvm/hvm_info_table.h>
 
 static unsigned int indent_level;
@@ -71,12 +74,44 @@
     pop_block();
 }
 
+static struct option options[] = {
+    { "maxcpu", 1, 0, 'c' },
+    { 0, 0, 0, 0 }
+};
+
 int main(int argc, char **argv)
 {
     unsigned int slot, dev, intx, link, cpu, max_cpus = HVM_MAX_VCPUS;
 
-    /* Extract optional maximum-cpu specification from invocation name. */
-    sscanf(argv[0], "%*[^0-9]%u", &max_cpus); /* e.g., ./mk_dsdt15 */
+    for ( ; ; )
+    {
+        int opt = getopt_long(argc, argv, "", options, NULL);
+        if ( opt == -1 )
+            break;
+
+        switch ( opt )
+        {
+        case 'c': {
+            long i = 0;
+            char *endptr;
+
+            i = strtol(optarg, &endptr, 10);
+            if ( (*optarg != '\0') && (*endptr == '\0') && (i >= 0) )
+            {
+                max_cpus = i;
+            }
+            else if ( !(strcmp(optarg, "any") == 0) )
+            {
+                fprintf(stderr, "`%s' is not a number or is < 0.\n", optarg);
+                return -1;
+            }
+            break;
+        }
+        default:
+            fprintf(stderr, "options not supported.\n");
+            return -1;
+        }
+    }
 
     /**** DSDT DefinitionBlock start ****/
     /* (we append to existing DSDT definition block) */

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 28 12:56:43 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 28 Oct 2011 12:56:43 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RJsXj-0000TN-Mi; Fri, 28 Oct 2011 12:56:43 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RJsWs-0000L4-Ay
	for xen-changelog@lists.xensource.com; Fri, 28 Oct 2011 12:55:50 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-27.messagelabs.com!1319831720!51003074!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17102 invoked from network); 28 Oct 2011 19:55:20 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Oct 2011 19:55:20 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RJsWp-0005Nq-5i
	for xen-changelog@lists.xensource.com; Fri, 28 Oct 2011 20:55:47 +0100
Message-Id: <E1RJsWp-0005Nq-5i@xenbits.xen.org>
Date: Fri, 28 Oct 2011 20:55:46 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] hvmloader/acpi/dsdt: Fix PCI hotplug
	with the new qemu-xen.
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 Anthony PERARD <anthony.perard@citrix.com>
# Date 1319818611 -3600
# Node ID 1a912ce93b506a185b54fd97986214e6eff8a0bc
# Parent  6bc03e22f921aadfa7e5cebe92100cb01377947d
hvmloader/acpi/dsdt: Fix PCI hotplug with the new qemu-xen.

The ACPI PIIX4 device in QEMU upstream as not the same behavior to
handle PCI hotplug. This patch introduce the necessary change to the
DSDT ACPI table to behave as expceted by the new QEMU.

To switch to this new DSDT table version, there is a new option
--dm-version to mk_dsdt.

Change are inspired by SeaBIOS DSDT source code.

There is few things missing with the new QEMU:
  - QEMU provide the plugged/unplugged status only per slot (and not
    per func like qemu-xen-traditionnal.
  - I did not include the _STA ACPI method that give the status of a
    device (present, functionning properly) because qemu-xen does not
    handle it.
  - I did not include the _RMV method that say if the device can be
    removed,
    because the IO port of QEMU that give this status always return
    true. In
    SeaBIOS table, they have a specific _RMV method for VGA, ISA that
    return
    false. But I'm not sure that we can do the same in Xen.

So, the only way to remove a device is from outside of the guest (like
with xl pci-detatch), and can not be initiated from inside.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 6bc03e22f921 -r 1a912ce93b50 tools/firmware/hvmloader/acpi/Makefile
--- a/tools/firmware/hvmloader/acpi/Makefile	Fri Oct 28 17:15:32 2011 +0100
+++ b/tools/firmware/hvmloader/acpi/Makefile	Fri Oct 28 17:16:51 2011 +0100
@@ -18,7 +18,7 @@
 XEN_ROOT = $(CURDIR)/../../../..
 include $(XEN_ROOT)/tools/firmware/Rules.mk
 
-C_SRC = build.c dsdt_anycpu.c dsdt_15cpu.c static_tables.c
+C_SRC = build.c dsdt_anycpu.c dsdt_15cpu.c static_tables.c dsdt_anycpu_qemu_xen.c
 OBJS  = $(patsubst %.c,%.o,$(C_SRC))
 
 CFLAGS += $(CFLAGS_xeninclude)
@@ -34,6 +34,10 @@
 mk_dsdt: mk_dsdt.c
 	$(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -o $@ mk_dsdt.c
 
+dsdt_anycpu_qemu_xen.asl: dsdt.asl mk_dsdt
+	awk 'NR > 1 {print s} {s=$$0}' $< > $@
+	./mk_dsdt --dm-version qemu-xen >> $@
+
 # NB. awk invocation is a portable alternative to 'head -n -1'
 dsdt_%cpu.asl: dsdt.asl mk_dsdt
 	awk 'NR > 1 {print s} {s=$$0}' $< > $@
diff -r 6bc03e22f921 -r 1a912ce93b50 tools/firmware/hvmloader/acpi/mk_dsdt.c
--- a/tools/firmware/hvmloader/acpi/mk_dsdt.c	Fri Oct 28 17:15:32 2011 +0100
+++ b/tools/firmware/hvmloader/acpi/mk_dsdt.c	Fri Oct 28 17:16:51 2011 +0100
@@ -8,6 +8,11 @@
 
 static unsigned int indent_level;
 
+typedef enum dm_version {
+    QEMU_XEN_TRADITIONAL,
+    QEMU_XEN,
+} dm_version;
+
 static void indent(void)
 {
     unsigned int i;
@@ -77,12 +82,14 @@
 
 static struct option options[] = {
     { "maxcpu", 1, 0, 'c' },
+    { "dm-version", 1, 0, 'q' },
     { 0, 0, 0, 0 }
 };
 
 int main(int argc, char **argv)
 {
     unsigned int slot, dev, intx, link, cpu, max_cpus = HVM_MAX_VCPUS;
+    dm_version dm_version = QEMU_XEN_TRADITIONAL;
 
     for ( ; ; )
     {
@@ -108,8 +115,17 @@
             }
             break;
         }
+        case 'q':
+            if (strcmp(optarg, "qemu-xen") == 0) {
+                dm_version = QEMU_XEN;
+            } else if (strcmp(optarg, "qemu-xen-traditional") == 0) {
+                dm_version = QEMU_XEN_TRADITIONAL;
+            } else {
+                fprintf(stderr, "Unknown device model version `%s'.\n", optarg);
+                return -1;
+            }
+            break;
         default:
-            fprintf(stderr, "options not supported.\n");
             return -1;
         }
     }
@@ -223,10 +239,17 @@
      */
     push_block("Device", "HP0"); {
         stmt("Name", "_HID, EISAID(\"PNP0C02\")");
-        stmt("Name", "_CRS, ResourceTemplate() {"
-             "  IO (Decode16, 0x10c0, 0x10c0, 0x00, 0x82)"
-             "  IO (Decode16, 0xb044, 0xb044, 0x00, 0x04)"
-             "}");
+        if (dm_version == QEMU_XEN_TRADITIONAL) {
+            stmt("Name", "_CRS, ResourceTemplate() {"
+                 "  IO (Decode16, 0x10c0, 0x10c0, 0x00, 0x82)"
+                 "  IO (Decode16, 0xb044, 0xb044, 0x00, 0x04)"
+                 "}");
+        } else {
+            stmt("Name", "_CRS, ResourceTemplate() {"
+                 "  IO (Decode16, 0xae00, 0xae00, 0x00, 0x10)"
+                 "  IO (Decode16, 0xb044, 0xb044, 0x00, 0x04)"
+                 "}");
+        }
     } pop_block();
 
     /*** PCI-ISA link definitions ***/
@@ -313,37 +336,56 @@
      * QEMU provides a simple hotplug controller with some I/O to handle
      * the hotplug action and status, which is beyond the ACPI scope.
      */
-    for ( slot = 0; slot < 0x100; slot++ )
-    {
-        push_block("Device", "S%02X", slot);
-        /* _ADR == dev:fn (16:16) */
-        stmt("Name", "_ADR, 0x%08x", ((slot & ~7) << 13) | (slot & 7));
-        /* _SUN == dev */
-        stmt("Name", "_SUN, 0x%08x", slot >> 3);
-        push_block("Method", "_PS0, 0");
-        stmt("Store", "0x%02x, \\_GPE.DPT1", slot);
-        stmt("Store", "0x80, \\_GPE.DPT2");
+    if (dm_version == QEMU_XEN_TRADITIONAL) {
+        for ( slot = 0; slot < 0x100; slot++ )
+        {
+            push_block("Device", "S%02X", slot);
+            /* _ADR == dev:fn (16:16) */
+            stmt("Name", "_ADR, 0x%08x", ((slot & ~7) << 13) | (slot & 7));
+            /* _SUN == dev */
+            stmt("Name", "_SUN, 0x%08x", slot >> 3);
+            push_block("Method", "_PS0, 0");
+            stmt("Store", "0x%02x, \\_GPE.DPT1", slot);
+            stmt("Store", "0x80, \\_GPE.DPT2");
+            pop_block();
+            push_block("Method", "_PS3, 0");
+            stmt("Store", "0x%02x, \\_GPE.DPT1", slot);
+            stmt("Store", "0x83, \\_GPE.DPT2");
+            pop_block();
+            push_block("Method", "_EJ0, 1");
+            stmt("Store", "0x%02x, \\_GPE.DPT1", slot);
+            stmt("Store", "0x88, \\_GPE.DPT2");
+            stmt("Store", "0x%02x, \\_GPE.PH%02X", /* eject */
+                 (slot & 1) ? 0x10 : 0x01, slot & ~1);
+            pop_block();
+            push_block("Method", "_STA, 0");
+            stmt("Store", "0x%02x, \\_GPE.DPT1", slot);
+            stmt("Store", "0x89, \\_GPE.DPT2");
+            if ( slot & 1 )
+                stmt("ShiftRight", "0x4, \\_GPE.PH%02X, Local1", slot & ~1);
+            else
+                stmt("And", "\\_GPE.PH%02X, 0x0f, Local1", slot & ~1);
+            stmt("Return", "Local1"); /* IN status as the _STA */
+            pop_block();
+            pop_block();
+        }
+    } else {
+        stmt("OperationRegion", "SEJ, SystemIO, 0xae08, 0x04");
+        push_block("Field", "SEJ, DWordAcc, NoLock, WriteAsZeros");
+        indent(); printf("B0EJ, 32,\n");
         pop_block();
-        push_block("Method", "_PS3, 0");
-        stmt("Store", "0x%02x, \\_GPE.DPT1", slot);
-        stmt("Store", "0x83, \\_GPE.DPT2");
-        pop_block();
-        push_block("Method", "_EJ0, 1");
-        stmt("Store", "0x%02x, \\_GPE.DPT1", slot);
-        stmt("Store", "0x88, \\_GPE.DPT2");
-        stmt("Store", "0x%02x, \\_GPE.PH%02X", /* eject */
-             (slot & 1) ? 0x10 : 0x01, slot & ~1);
-        pop_block();
-        push_block("Method", "_STA, 0");
-        stmt("Store", "0x%02x, \\_GPE.DPT1", slot);
-        stmt("Store", "0x89, \\_GPE.DPT2");
-        if ( slot & 1 )
-            stmt("ShiftRight", "0x4, \\_GPE.PH%02X, Local1", slot & ~1);
-        else
-            stmt("And", "\\_GPE.PH%02X, 0x0f, Local1", slot & ~1);
-        stmt("Return", "Local1"); /* IN status as the _STA */
-        pop_block();
-        pop_block();
+
+        /* hotplug_slot */
+        for (slot = 1; slot <= 31; slot++) {
+            push_block("Device", "S%i", slot); {
+                stmt("Name", "_ADR, %#06x0000", slot);
+                push_block("Method", "_EJ0,1"); {
+                    stmt("Store", "ShiftLeft(1, %#06x), B0EJ", slot);
+                    stmt("Return", "0x0");
+                } pop_block();
+                stmt("Name", "_SUN, %i", slot);
+            } pop_block();
+        }
     }
 
     pop_block();
@@ -353,18 +395,26 @@
     /**** GPE start ****/
     push_block("Scope", "\\_GPE");
 
-    stmt("OperationRegion", "PHP, SystemIO, 0x10c0, 0x82");
+    if (dm_version == QEMU_XEN_TRADITIONAL) {
+        stmt("OperationRegion", "PHP, SystemIO, 0x10c0, 0x82");
 
-    push_block("Field", "PHP, ByteAcc, NoLock, Preserve");
-    indent(); printf("PSTA, 8,\n"); /* hotplug controller event reg */
-    indent(); printf("PSTB, 8,\n"); /* hotplug controller slot reg */
-    for ( slot = 0; slot < 0x100; slot += 2 )
-    {
-        indent();
-        /* Each hotplug control register manages a pair of pci functions. */
-        printf("PH%02X, 8,\n", slot);
+        push_block("Field", "PHP, ByteAcc, NoLock, Preserve");
+        indent(); printf("PSTA, 8,\n"); /* hotplug controller event reg */
+        indent(); printf("PSTB, 8,\n"); /* hotplug controller slot reg */
+        for ( slot = 0; slot < 0x100; slot += 2 )
+        {
+            indent();
+            /* Each hotplug control register manages a pair of pci functions. */
+            printf("PH%02X, 8,\n", slot);
+        }
+        pop_block();
+    } else {
+        stmt("OperationRegion", "PCST, SystemIO, 0xae00, 0x08");
+        push_block("Field", "PCST, DWordAcc, NoLock, WriteAsZeros");
+        indent(); printf("PCIU, 32,\n");
+        indent(); printf("PCID, 32,\n");
+        pop_block();
     }
-    pop_block();
 
     stmt("OperationRegion", "DG1, SystemIO, 0xb044, 0x04");
 
@@ -372,20 +422,33 @@
     indent(); printf("DPT1, 8, DPT2, 8\n");
     pop_block();
 
-    push_block("Method", "_L03, 0, Serialized");
-    /* Detect slot and event (remove/add). */
-    stmt("Name", "SLT, 0x0");
-    stmt("Name", "EVT, 0x0");
-    stmt("Store", "PSTA, Local1");
-    stmt("And", "Local1, 0xf, EVT");
-    stmt("Store", "PSTB, Local1"); /* XXX: Store (PSTB, SLT) ? */
-    stmt("And", "Local1, 0xff, SLT");
-    /* Debug */
-    stmt("Store", "SLT, DPT1");
-    stmt("Store", "EVT, DPT2");
-    /* Decision tree */
-    decision_tree(0x00, 0x100, "SLT", pci_hotplug_notify);
-    pop_block();
+    if (dm_version == QEMU_XEN_TRADITIONAL) {
+        push_block("Method", "_L03, 0, Serialized");
+        /* Detect slot and event (remove/add). */
+        stmt("Name", "SLT, 0x0");
+        stmt("Name", "EVT, 0x0");
+        stmt("Store", "PSTA, Local1");
+        stmt("And", "Local1, 0xf, EVT");
+        stmt("Store", "PSTB, Local1"); /* XXX: Store (PSTB, SLT) ? */
+        stmt("And", "Local1, 0xff, SLT");
+        /* Debug */
+        stmt("Store", "SLT, DPT1");
+        stmt("Store", "EVT, DPT2");
+        /* Decision tree */
+        decision_tree(0x00, 0x100, "SLT", pci_hotplug_notify);
+        pop_block();
+    } else {
+        push_block("Method", "_L01");
+        for (slot = 1; slot <= 31; slot++) {
+            push_block("If", "And(PCIU, ShiftLeft(1, %i))", slot);
+            stmt("Notify", "\\_SB.PCI0.S%i, 1", slot);
+            pop_block();
+            push_block("If", "And(PCID, ShiftLeft(1, %i))", slot);
+            stmt("Notify", "\\_SB.PCI0.S%i, 3", slot);
+            pop_block();
+        }
+        pop_block();
+    }
 
     pop_block();
     /**** GPE end ****/

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 28 12:56:59 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 28 Oct 2011 12:56:59 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RJsXy-0000WB-Sp; Fri, 28 Oct 2011 12:56:58 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RJsWu-0000L8-AJ
	for xen-changelog@lists.xensource.com; Fri, 28 Oct 2011 12:55:52 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-182.messagelabs.com!1319831749!1146636!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25382 invoked from network); 28 Oct 2011 19:55:49 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Oct 2011 19:55:49 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RJsWq-0005Py-TN
	for xen-changelog@lists.xensource.com; Fri, 28 Oct 2011 20:55:48 +0100
Message-Id: <E1RJsWq-0005Py-TN@xenbits.xen.org>
Date: Fri, 28 Oct 2011 20:55:48 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] nestedsvm: fix lazy fpu switching
	causing a triple fault
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 Christoph Egger <Christoph.Egger@amd.com>
# Date 1319819031 -3600
# Node ID 0fea1ad50ce32173a5c9e7ebf5a6adbc4c351ee4
# Parent  c4ed56a102dc3a66dc4dda6ed1584cb6531074a2
nestedsvm: fix lazy fpu switching causing a triple fault

Fix FPU switching uncovered with Hyper-V: Do FPU switching always on
the n1 vmcb rather doing it on the current active vmcb.  The FPU state
between n1 and n2 vmcb is already synced in the vmrun and vmexit
emulation.

This fixes the situation where the n2 vmcb had the #NM intercept bit
set but the virtual vmcb did not.  That means it was believed the l1
guest can handle an #NM intercept but was actually wrong.

The result were three #GP's with error code 0x11 in the l1 guest.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r c4ed56a102dc -r 0fea1ad50ce3 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c	Fri Oct 28 17:20:21 2011 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c	Fri Oct 28 17:23:51 2011 +0100
@@ -349,16 +349,17 @@
 
 static void svm_fpu_enter(struct vcpu *v)
 {
-    struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+    struct vmcb_struct *n1vmcb = vcpu_nestedhvm(v).nv_n1vmcx;
 
     vcpu_restore_fpu_lazy(v);
     vmcb_set_exception_intercepts(
-        vmcb, vmcb_get_exception_intercepts(vmcb) & ~(1U << TRAP_no_device));
+        n1vmcb,
+        vmcb_get_exception_intercepts(n1vmcb) & ~(1U << TRAP_no_device));
 }
 
 static void svm_fpu_leave(struct vcpu *v)
 {
-    struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+    struct vmcb_struct *n1vmcb = vcpu_nestedhvm(v).nv_n1vmcx;
 
     ASSERT(!v->fpu_dirtied);
     ASSERT(read_cr0() & X86_CR0_TS);
@@ -372,9 +373,9 @@
     if ( !(v->arch.hvm_vcpu.guest_cr[0] & X86_CR0_TS) )
     {
         vmcb_set_exception_intercepts(
-            vmcb,
-            vmcb_get_exception_intercepts(vmcb) | (1U << TRAP_no_device));
-        vmcb_set_cr0(vmcb, vmcb_get_cr0(vmcb) | X86_CR0_TS);
+            n1vmcb,
+            vmcb_get_exception_intercepts(n1vmcb) | (1U << TRAP_no_device));
+        vmcb_set_cr0(n1vmcb, vmcb_get_cr0(n1vmcb) | X86_CR0_TS);
     }
 }
 
@@ -1191,15 +1192,17 @@
 {
     struct vcpu *v = current;
     struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+    struct vmcb_struct *n1vmcb = vcpu_nestedhvm(v).nv_n1vmcx;
 
     svm_fpu_enter(v);
 
-    if ( nestedhvm_enabled(v->domain) && nestedhvm_vcpu_in_guestmode(v) ) {
-       /* Check if guest must make FPU ready for the nested guest */
+    if ( vmcb != n1vmcb )
+    {
+       /* Check if l1 guest must make FPU ready for the l2 guest */
        if ( v->arch.hvm_vcpu.guest_cr[0] & X86_CR0_TS )
            hvm_inject_exception(TRAP_no_device, HVM_DELIVER_NO_ERROR_CODE, 0);
        else
-           vmcb_set_cr0(vmcb, vmcb_get_cr0(vmcb) & ~X86_CR0_TS);
+           vmcb_set_cr0(n1vmcb, vmcb_get_cr0(n1vmcb) & ~X86_CR0_TS);
        return;
     }
 

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 28 12:57:11 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 28 Oct 2011 12:57:11 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RJsYB-0000aW-Ds; Fri, 28 Oct 2011 12:57:11 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RJsWu-0000L7-7o
	for xen-changelog@lists.xensource.com; Fri, 28 Oct 2011 12:55:53 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1319831748!1467298!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1878 invoked from network); 28 Oct 2011 19:55:48 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Oct 2011 19:55:48 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RJsWp-0005OZ-Om
	for xen-changelog@lists.xensource.com; Fri, 28 Oct 2011 20:55:47 +0100
Message-Id: <E1RJsWp-0005OZ-Om@xenbits.xen.org>
Date: Fri, 28 Oct 2011 20:55:47 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] hvmloader: Load DSDT table from
	parameter
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 Anthony PERARD <anthony.perard@citrix.com>
# Date 1319818667 -3600
# Node ID 2e16d8e6a965be8f62c99c6e456988cfa72b7e1d
# Parent  1a912ce93b506a185b54fd97986214e6eff8a0bc
hvmloader: Load DSDT table from parameter

In order to have two different DSDT tables for rombios and SeaBIOS,
this patch introduce a new parameter to acpi_build_tables() which
contain the DSDT table to load.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 1a912ce93b50 -r 2e16d8e6a965 tools/firmware/hvmloader/acpi/acpi2_0.h
--- a/tools/firmware/hvmloader/acpi/acpi2_0.h	Fri Oct 28 17:16:51 2011 +0100
+++ b/tools/firmware/hvmloader/acpi/acpi2_0.h	Fri Oct 28 17:17:47 2011 +0100
@@ -391,7 +391,14 @@
 
 #pragma pack ()
 
-void acpi_build_tables(unsigned int physical);
+struct acpi_config {
+    unsigned char *dsdt_anycpu;
+    int dsdt_anycpu_len;
+    unsigned char *dsdt_15cpu;
+    int dsdt_15cpu_len;
+};
+
+void acpi_build_tables(struct acpi_config *config, unsigned int physical);
 
 #endif /* _ACPI_2_0_H_ */
 
diff -r 1a912ce93b50 -r 2e16d8e6a965 tools/firmware/hvmloader/acpi/build.c
--- a/tools/firmware/hvmloader/acpi/build.c	Fri Oct 28 17:16:51 2011 +0100
+++ b/tools/firmware/hvmloader/acpi/build.c	Fri Oct 28 17:17:47 2011 +0100
@@ -47,17 +47,6 @@
     uint32_t madt_lapic0_addr;  /* 16   - Address of first MADT LAPIC struct */
 };
 
-/*
- * Alternative DSDTs we get linked against. A cover-all DSDT for up to the
- * implementation-defined maximum number of VCPUs, and an alternative for use
- * when a guest can only have up to 15 VCPUs.
- * 
- * The latter is required for Windows 2000, which experiences a BSOD of
- * KMODE_EXCEPTION_NOT_HANDLED if it sees more than 15 processor objects.
- */
-extern unsigned char dsdt_anycpu[], dsdt_15cpu;
-extern int dsdt_anycpu_len, dsdt_15cpu_len;
-
 /* Number of processor objects in the chosen DSDT. */
 static unsigned int nr_processor_objects;
 
@@ -285,7 +274,7 @@
     return nr_tables;
 }
 
-void acpi_build_tables(unsigned int physical)
+void acpi_build_tables(struct acpi_config *config, unsigned int physical)
 {
     struct acpi_info *acpi_info = (struct acpi_info *)ACPI_INFO_PHYSICAL_ADDRESS;
     struct acpi_20_rsdp *rsdp;
@@ -308,18 +297,26 @@
     if (!facs) goto oom;
     memcpy(facs, &Facs, sizeof(struct acpi_20_facs));
 
-    if ( hvm_info->nr_vcpus <= 15 )
+    /*
+     * Alternative DSDTs we get linked against. A cover-all DSDT for up to the
+     * implementation-defined maximum number of VCPUs, and an alternative for use
+     * when a guest can only have up to 15 VCPUs.
+     *
+     * The latter is required for Windows 2000, which experiences a BSOD of
+     * KMODE_EXCEPTION_NOT_HANDLED if it sees more than 15 processor objects.
+     */
+    if ( hvm_info->nr_vcpus <= 15 && config->dsdt_15cpu)
     {
-        dsdt = mem_alloc(dsdt_15cpu_len, 16);
+        dsdt = mem_alloc(config->dsdt_15cpu_len, 16);
         if (!dsdt) goto oom;
-        memcpy(dsdt, &dsdt_15cpu, dsdt_15cpu_len);
+        memcpy(dsdt, config->dsdt_15cpu, config->dsdt_15cpu_len);
         nr_processor_objects = 15;
     }
     else
     {
-        dsdt = mem_alloc(dsdt_anycpu_len, 16);
+        dsdt = mem_alloc(config->dsdt_anycpu_len, 16);
         if (!dsdt) goto oom;
-        memcpy(dsdt, &dsdt_anycpu, dsdt_anycpu_len);
+        memcpy(dsdt, config->dsdt_anycpu, config->dsdt_anycpu_len);
         nr_processor_objects = HVM_MAX_VCPUS;
     }
 
diff -r 1a912ce93b50 -r 2e16d8e6a965 tools/firmware/hvmloader/rombios.c
--- a/tools/firmware/hvmloader/rombios.c	Fri Oct 28 17:16:51 2011 +0100
+++ b/tools/firmware/hvmloader/rombios.c	Fri Oct 28 17:17:47 2011 +0100
@@ -40,6 +40,9 @@
 #define ROMBIOS_MAXOFFSET      0x0000FFFF
 #define ROMBIOS_END            (ROMBIOS_BEGIN + ROMBIOS_SIZE)
 
+extern unsigned char dsdt_anycpu[], dsdt_15cpu[];
+extern int dsdt_anycpu_len, dsdt_15cpu_len;
+
 static void rombios_setup_e820(void)
 {
     /*
@@ -112,7 +115,14 @@
 
 static void rombios_acpi_build_tables(void)
 {
-    acpi_build_tables(ACPI_PHYSICAL_ADDRESS);
+    struct acpi_config config = {
+        .dsdt_anycpu = dsdt_anycpu,
+        .dsdt_anycpu_len = dsdt_anycpu_len,
+        .dsdt_15cpu = dsdt_15cpu,
+        .dsdt_15cpu_len = dsdt_15cpu_len,
+    };
+
+    acpi_build_tables(&config, ACPI_PHYSICAL_ADDRESS);
 }
 
 static void rombios_create_mp_tables(void)
diff -r 1a912ce93b50 -r 2e16d8e6a965 tools/firmware/hvmloader/seabios.c
--- a/tools/firmware/hvmloader/seabios.c	Fri Oct 28 17:16:51 2011 +0100
+++ b/tools/firmware/hvmloader/seabios.c	Fri Oct 28 17:17:47 2011 +0100
@@ -31,6 +31,9 @@
 #define ROM_INCLUDE_SEABIOS
 #include "roms.inc"
 
+extern unsigned char dsdt_anycpu_qemu_xen[];
+extern int dsdt_anycpu_qemu_xen_len;
+
 struct seabios_info {
     char signature[14]; /* XenHVMSeaBIOS\0 */
     uint8_t length;     /* Length of this struct */
@@ -91,7 +94,14 @@
 static void seabios_acpi_build_tables(void)
 {
     uint32_t rsdp = (uint32_t)scratch_alloc(sizeof(struct acpi_20_rsdp), 0);
-    acpi_build_tables(rsdp);
+    struct acpi_config config = {
+        .dsdt_anycpu = dsdt_anycpu_qemu_xen,
+        .dsdt_anycpu_len = dsdt_anycpu_qemu_xen_len,
+        .dsdt_15cpu = NULL,
+        .dsdt_15cpu_len = 0,
+    };
+
+    acpi_build_tables(&config, rsdp);
     add_table(rsdp);
 }
 

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 28 12:57:26 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 28 Oct 2011 12:57:26 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RJsYQ-0000eg-9B; Fri, 28 Oct 2011 12:57:26 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RJsWy-0000LO-3M
	for xen-changelog@lists.xensource.com; Fri, 28 Oct 2011 12:55:56 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-21.messagelabs.com!1319831752!2088688!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15235 invoked from network); 28 Oct 2011 19:55:52 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Oct 2011 19:55:52 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RJsWo-0005NC-LB
	for xen-changelog@lists.xensource.com; Fri, 28 Oct 2011 20:55:46 +0100
Message-Id: <E1RJsWo-0005NC-LB@xenbits.xen.org>
Date: Fri, 28 Oct 2011 20:55:46 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] hvmloader: In mk_dsdt,
	Use __attribute__ format.
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 Anthony PERARD <anthony.perard@citrix.com>
# Date 1319818532 -3600
# Node ID 6bc03e22f921aadfa7e5cebe92100cb01377947d
# Parent  b1e1e1c2ceac33f282bd75bafe104750f971c484
hvmloader: In mk_dsdt, Use __attribute__ format.

Use __attribute__((format(printf,..))) for the function _stmt to
prevent any mistake.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r b1e1e1c2ceac -r 6bc03e22f921 tools/firmware/hvmloader/acpi/mk_dsdt.c
--- a/tools/firmware/hvmloader/acpi/mk_dsdt.c	Fri Oct 28 17:14:35 2011 +0100
+++ b/tools/firmware/hvmloader/acpi/mk_dsdt.c	Fri Oct 28 17:15:32 2011 +0100
@@ -15,7 +15,8 @@
         printf("    ");
 }
 
-static void _stmt(const char *name, const char *fmt, ...)
+static __attribute__((format(printf, 2, 3)))
+void _stmt(const char *name, const char *fmt, ...)
 {
     va_list args;
 

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

From xen-changelog-bounces@lists.xensource.com Fri Oct 28 12:57:41 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 28 Oct 2011 12:57:41 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RJsYf-0000hz-Oe; Fri, 28 Oct 2011 12:57:41 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RJsWy-0000Le-LJ
	for xen-changelog@lists.xensource.com; Fri, 28 Oct 2011 12:55:57 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-216.messagelabs.com!1319831753!1462523!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11351 invoked from network); 28 Oct 2011 19:55:53 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	28 Oct 2011 19:55:53 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RJsWq-0005PJ-Ax
	for xen-changelog@lists.xensource.com; Fri, 28 Oct 2011 20:55:48 +0100
Message-Id: <E1RJsWq-0005PJ-Ax@xenbits.xen.org>
Date: Fri, 28 Oct 2011 20:55:47 +0100
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86,
	hvm: enable VCPUOP_register_vcpu_info op in hvm hypercall
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 Zhenzhong Duan <zhenzhong.duan@oracle.com>
# Date 1319818821 -3600
# Node ID c4ed56a102dc3a66dc4dda6ed1584cb6531074a2
# Parent  2e16d8e6a965be8f62c99c6e456988cfa72b7e1d
x86,hvm: enable VCPUOP_register_vcpu_info op in hvm hypercall

pvhvm running with more than 32 vcpus and pv_irq/pv_time enabled
need vcpu placement to work, or else it will softlockup.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 2e16d8e6a965 -r c4ed56a102dc xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c	Fri Oct 28 17:17:47 2011 +0100
+++ b/xen/arch/x86/hvm/hvm.c	Fri Oct 28 17:20:21 2011 +0100
@@ -2794,6 +2794,7 @@
     case VCPUOP_stop_periodic_timer:
     case VCPUOP_set_singleshot_timer:
     case VCPUOP_stop_singleshot_timer:
+    case VCPUOP_register_vcpu_info:
         rc = do_vcpu_op(cmd, vcpuid, arg);
         break;
     default:
@@ -2869,6 +2870,7 @@
     case VCPUOP_stop_periodic_timer:
     case VCPUOP_set_singleshot_timer:
     case VCPUOP_stop_singleshot_timer:
+    case VCPUOP_register_vcpu_info:
         rc = compat_vcpu_op(cmd, vcpuid, arg);
         break;
     default:

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

