Hello community,
here is the log from the commit of package xen for openSUSE:Factory
checked in at Tue Feb 15 16:48:35 CET 2011.
--------
--- xen/xen.changes 2011-02-04 22:19:00.000000000 +0100
+++ xen/xen.changes 2011-02-14 22:34:49.000000000 +0100
@@ -1,0 +2,48 @@
+Fri Feb 11 16:25:51 MST 2011 - carnold@novell.com
+
+- Update to Xen 4.0.2 rc2, changeset 21452
+
+-------------------------------------------------------------------
+Fri Feb 11 11:50:20 MST 2011 - carnold@novell.com
+
+- Enable support for kernel decompression for gzip, bzip2, and LZMA
+ so that kernels compressed with any of these methods can be
+ launched.
+
+-------------------------------------------------------------------
+Mon Feb 7 13:25:04 CET 2011 - ohering@suse.de
+
+- update xenalyze, more 64bit fixes
+
+-------------------------------------------------------------------
+Mon Feb 7 13:17:12 CET 2011 - ohering@suse.de
+
+- allocate xentrace buffer metadata based on requested tbuf_size
+ xentrace.dynamic_sized_tbuf.patch
+
+-------------------------------------------------------------------
+Mon Feb 7 13:07:43 CET 2011 - ohering@suse.de
+
+- fate#310510 - fix xenpaging
+ xenpaging.runtime_mru_size.patch
+ - specify policy mru size at runtime
+ xenpaging.no_domain_id.patch
+ - reduce memory usage in pager
+
+-------------------------------------------------------------------
+Mon Feb 7 13:01:03 CET 2011 - ohering@suse.de
+
+- bnc#625394 - set vif mtu from bridge mtu if kernel supports it
+ vif-bridge.mtu.patch
+
+-------------------------------------------------------------------
+Sun Feb 6 15:46:43 CET 2011 - ohering@suse.de
+
+- fate#310510 - fix xenpaging
+ xenpaging.autostart_delay.patch
+ - decouple create/destroycreateXenPaging from _create/_removeDevices
+ - change xenpaging variable from int to str
+ - init xenpaging variable to 0 if xenpaging is not in config file
+ to avoid string None coming from sxp file
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
22526-ept-get-entry-no-lock.patch
xenalyze.64bit.patch
New:
----
vif-bridge.mtu.patch
xenpaging.no_domain_id.patch
xenpaging.runtime_mru_size.patch
xentrace.dynamic_sized_tbuf.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ xen.spec ++++++
--- /var/tmp/diff_new_pack.W3ld4U/_old 2011-02-15 16:46:03.000000000 +0100
+++ /var/tmp/diff_new_pack.W3ld4U/_new 2011-02-15 16:46:03.000000000 +0100
@@ -22,7 +22,7 @@
ExclusiveArch: %ix86 x86_64
%define xvers 4.0
%define xvermaj 4
-%define changeset 21443
+%define changeset 21452
%define xen_build_dir xen-4.0.2-testing
%define with_kmp 1
%define with_stubdom 1
@@ -43,6 +43,8 @@
BuildRequires: python-devel
BuildRequires: texinfo
BuildRequires: transfig
+BuildRequires: libbz2-devel
+BuildRequires: xz-devel
%if %suse_version <= 1110
BuildRequires: pmtools
%else
@@ -70,7 +72,7 @@
%if %{?with_kmp}0
BuildRequires: kernel-source kernel-syms module-init-tools xorg-x11
%endif
-Version: 4.0.2_01
+Version: 4.0.2_02
Release: 1
License: GPLv2+
Group: System/Kernel
@@ -141,21 +143,20 @@
Patch28: 22475-x2apic-cleanup.patch
Patch29: 22484-vlapic-tmcct-periodic.patch
Patch30: 22504-iommu-dom0-holes.patch
-Patch31: 22526-ept-get-entry-no-lock.patch
-Patch32: 22533-x86-32bit-apicid.patch
-Patch33: 22534-x86-max-local-apic.patch
-Patch34: 22535-x2apic-preenabled.patch
-Patch35: 22645-amd-flush-filter.patch
-Patch36: 22693-fam10-mmio-conf-base-protect.patch
-Patch37: 22694-x86_64-no-weak.patch
-Patch38: 22707-x2apic-preenabled-check.patch
-Patch39: 22708-xenctx-misc.patch
-Patch40: 22744-ept-pod-locking.patch
-Patch41: 22749-vtd-workarounds.patch
-Patch42: 22777-vtd-ats-fixes.patch
-Patch43: 22781-pod-hap-logdirty.patch
-Patch44: 22789-i386-no-x2apic.patch
-Patch45: 22790-svm-resume-migrate-pirqs.patch
+Patch31: 22533-x86-32bit-apicid.patch
+Patch32: 22534-x86-max-local-apic.patch
+Patch33: 22535-x2apic-preenabled.patch
+Patch34: 22645-amd-flush-filter.patch
+Patch35: 22693-fam10-mmio-conf-base-protect.patch
+Patch36: 22694-x86_64-no-weak.patch
+Patch37: 22707-x2apic-preenabled-check.patch
+Patch38: 22708-xenctx-misc.patch
+Patch39: 22744-ept-pod-locking.patch
+Patch40: 22749-vtd-workarounds.patch
+Patch41: 22777-vtd-ats-fixes.patch
+Patch42: 22781-pod-hap-logdirty.patch
+Patch43: 22789-i386-no-x2apic.patch
+Patch44: 22790-svm-resume-migrate-pirqs.patch
# Upstream qemu patches
Patch200: 7410-qemu-alt-gr.patch
Patch201: 7426-xenfb-depth.patch
@@ -259,6 +260,8 @@
Patch440: bdrv_default_rwflag.patch
Patch441: blktap2.patch
Patch442: xen-minimum-restart-time.patch
+Patch443: vif-bridge.mtu.patch
+Patch444: xentrace.dynamic_sized_tbuf.patch
# Jim's domain lock patch
Patch450: xend-domain-lock.patch
# Hypervisor and PV driver Patches
@@ -308,9 +311,9 @@
Patch10029: xenpaging.optimize_p2m_mem_paging_populate.patch
Patch10030: xenpaging.paging_prep_enomem.patch
Patch10031: xenpaging.print-arguments.patch
+Patch10032: xenpaging.no_domain_id.patch
+Patch10033: xenpaging.runtime_mru_size.patch
Patch10040: xenpaging.doc.patch
-# xenalyze
-Patch20000: xenalyze.64bit.patch
Url: http://www.cl.cam.ac.uk/Research/SRG/netos/xen/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#%define pysite %(python -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib()")
@@ -689,7 +692,6 @@
%patch42 -p1
%patch43 -p1
%patch44 -p1
-%patch45 -p1
%patch200 -p1
%patch201 -p1
%patch202 -p1
@@ -787,6 +789,8 @@
%patch440 -p1
%patch441 -p1
%patch442 -p1
+%patch443 -p1
+%patch444 -p1
%patch450 -p1
%patch500 -p1
%patch501 -p1
@@ -832,9 +836,9 @@
%patch10029 -p1
%patch10030 -p1
%patch10031 -p1
+%patch10032 -p1
+%patch10033 -p1
%patch10040 -p1
-#
-%patch20000 -p1
%build
XEN_EXTRAVERSION=%version-%release
++++++ 21301-svm-lmsl.patch ++++++
--- /var/tmp/diff_new_pack.W3ld4U/_old 2011-02-15 16:46:03.000000000 +0100
+++ /var/tmp/diff_new_pack.W3ld4U/_new 2011-02-15 16:46:03.000000000 +0100
@@ -56,7 +56,7 @@
#define set_segment_register(name, value) \
asm volatile ( "movw %%ax ,%%" STR(name) "" : : "a" (value) )
-@@ -871,6 +874,29 @@ static int svm_cpu_up(struct cpuinfo_x86
+@@ -864,6 +867,29 @@ static int svm_cpu_up(struct cpuinfo_x86
/* Initialize core's ASID handling. */
svm_asid_init(c);
++++++ 22790-svm-resume-migrate-pirqs.patch ++++++
--- /var/tmp/diff_new_pack.W3ld4U/_old 2011-02-15 16:46:03.000000000 +0100
+++ /var/tmp/diff_new_pack.W3ld4U/_new 2011-02-15 16:46:03.000000000 +0100
@@ -13,7 +13,7 @@
===================================================================
--- xen-4.0.2-testing.orig/xen/arch/x86/hvm/svm/svm.c
+++ xen-4.0.2-testing/xen/arch/x86/hvm/svm/svm.c
-@@ -704,7 +704,7 @@ static void svm_do_resume(struct vcpu *v
+@@ -697,7 +697,7 @@ static void svm_do_resume(struct vcpu *v
{
v->arch.hvm_svm.launch_core = smp_processor_id();
hvm_migrate_timers(v);
++++++ vif-bridge.mtu.patch ++++++
Subject: set mtu from bridge also on vif interface
References: bug#625394
Apply mtu size from bridge interface also in vif interface.
This depends on a kernel change which allows arbitrary mtu sizes until
the frontend driver has connected to the backend driver. Without this
kernel change, the vif mtu size will be limited to 1500 with this change
to the vif-bridge script.
(xen-unstable changeset: 22885:005722613063)
Signed-off-by: Olaf Hering
---
tools/hotplug/Linux/vif-bridge | 5 +++++
1 file changed, 5 insertions(+)
Index: xen-4.0.2-testing/tools/hotplug/Linux/vif-bridge
===================================================================
--- xen-4.0.2-testing.orig/tools/hotplug/Linux/vif-bridge
+++ xen-4.0.2-testing/tools/hotplug/Linux/vif-bridge
@@ -82,6 +82,11 @@ fi
case "$command" in
online)
setup_bridge_port "$vif"
+ mtu="`ip link show $bridge | awk '/mtu/ { print $5 }'`"
+ if [ -n "$mtu" ] && [ "$mtu" -gt 0 ]
+ then
+ ip link set $vif mtu $mtu || :
+ fi
add_to_bridge "$bridge" "$vif"
;;
++++++ xen-4.0.2-testing-src.tar.bz2 ++++++
xen/xen-4.0.2-testing-src.tar.bz2 xen/xen-4.0.2-testing-src.tar.bz2 differ: char 11, line 1
++++++ xen-config.diff ++++++
--- /var/tmp/diff_new_pack.W3ld4U/_old 2011-02-15 16:46:03.000000000 +0100
+++ /var/tmp/diff_new_pack.W3ld4U/_new 2011-02-15 16:46:03.000000000 +0100
@@ -9,7 +9,7 @@
-CONFIG_QEMU ?= $(QEMU_REMOTE)
+CONFIG_QEMU ?= ioemu-qemu-xen
- QEMU_TAG := xen-4.0.2-rc1
+ QEMU_TAG := xen-4.0.2-rc2
#QEMU_TAG ?= 6d5b7ee3acfe8cc10681d2583a38398f7470ec2a
@@ -181,9 +181,9 @@ CONFIG_OCAML_XENSTORED ?= n
# Optional components
@@ -27,17 +27,13 @@
===================================================================
--- xen-4.0.2-testing.orig/tools/libxc/Makefile
+++ xen-4.0.2-testing/tools/libxc/Makefile
-@@ -169,10 +169,10 @@ zlib-options = $(shell \
- fi) | grep $(1))
- endif
+@@ -174,7 +174,8 @@ xc_dom_bzimageloader.opic: CFLAGS += $(c
--xc_dom_bzimageloader.o: CFLAGS += $(call zlib-options,D)
--xc_dom_bzimageloader.opic: CFLAGS += $(call zlib-options,D)
-+#xc_dom_bzimageloader.o: CFLAGS += $(call zlib-options,D)
-+#xc_dom_bzimageloader.opic: CFLAGS += $(call zlib-options,D)
-
--libxenguest.so.$(MAJOR).$(MINOR): LDFLAGS += $(call zlib-options,l)
-+#libxenguest.so.$(MAJOR).$(MINOR): LDFLAGS += $(call zlib-options,l)
+ libxenguest.so.$(MAJOR).$(MINOR): LDFLAGS += $(call zlib-options,l)
libxenguest.so.$(MAJOR).$(MINOR): $(GUEST_PIC_OBJS) libxenctrl.so
- $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $(GUEST_PIC_OBJS) -lz -lxenctrl $(PTHREAD_LIBS)
+- $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $(GUEST_PIC_OBJS) -lz -lxenctrl $(PTHREAD_LIBS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $(GUEST_PIC_OBJS) -lz -lxenctrl $(PTHREAD_LIBS) $(call zlib-options,l)
++
+
+ -include $(DEPS)
++++++ xenalyze.hg.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xenalyze.hg/.hg_archival.txt new/xenalyze.hg/.hg_archival.txt
--- old/xenalyze.hg/.hg_archival.txt 2010-11-22 13:39:38.000000000 +0100
+++ new/xenalyze.hg/.hg_archival.txt 2011-01-17 17:46:35.000000000 +0100
@@ -1,5 +1,5 @@
repo: ff9eb9ff7fafe2781bd90357267d5e15b9898d3d
-node: 4e88187c91bae8b0f74a46e8568207ec3bc22f88
+node: 3448fc7df9669c29a1eb8427fd840bf7152973eb
branch: default
latesttag: null
-latesttagdistance: 91
+latesttagdistance: 96
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xenalyze.hg/xenalyze.c new/xenalyze.hg/xenalyze.c
--- old/xenalyze.hg/xenalyze.c 2010-11-22 13:39:38.000000000 +0100
+++ new/xenalyze.hg/xenalyze.c 2011-01-17 17:46:35.000000000 +0100
@@ -477,15 +477,22 @@
/* VMX data */
#define EXIT_REASON_EXCEPTION_NMI 0
#define EXIT_REASON_EXTERNAL_INTERRUPT 1
-
+#define EXIT_REASON_TRIPLE_FAULT 2
+#define EXIT_REASON_INIT 3
+#define EXIT_REASON_SIPI 4
+#define EXIT_REASON_IO_SMI 5
+#define EXIT_REASON_OTHER_SMI 6
#define EXIT_REASON_PENDING_INTERRUPT 7
-
+#define EXIT_REASON_PENDING_VIRT_NMI 8
#define EXIT_REASON_TASK_SWITCH 9
#define EXIT_REASON_CPUID 10
+#define EXIT_REASON_GETSEC 11
#define EXIT_REASON_HLT 12
+#define EXIT_REASON_INVD 13
#define EXIT_REASON_INVLPG 14
#define EXIT_REASON_RDPMC 15
#define EXIT_REASON_RDTSC 16
+#define EXIT_REASON_RSM 17
#define EXIT_REASON_VMCALL 18
#define EXIT_REASON_VMCLEAR 19
#define EXIT_REASON_VMLAUNCH 20
@@ -501,29 +508,48 @@
#define EXIT_REASON_IO_INSTRUCTION 30
#define EXIT_REASON_MSR_READ 31
#define EXIT_REASON_MSR_WRITE 32
+#define EXIT_REASON_INVALID_GUEST_STATE 33
+#define EXIT_REASON_MSR_LOADING 34
#define EXIT_REASON_MWAIT_INSTRUCTION 36
+#define EXIT_REASON_MONITOR_TRAP_FLAG 37
#define EXIT_REASON_MONITOR_INSTRUCTION 39
#define EXIT_REASON_PAUSE_INSTRUCTION 40
#define EXIT_REASON_MACHINE_CHECK 41
#define EXIT_REASON_TPR_BELOW_THRESHOLD 43
#define EXIT_REASON_APIC_ACCESS 44
+#define EXIT_REASON_ACCESS_GDTR_OR_IDTR 46
+#define EXIT_REASON_ACCESS_LDTR_OR_TR 47
#define EXIT_REASON_EPT_VIOLATION 48
#define EXIT_REASON_EPT_MISCONFIG 49
+#define EXIT_REASON_INVEPT 50
+#define EXIT_REASON_RDTSCP 51
+#define EXIT_REASON_VMX_PREEMPTION_TIMER_EXPIRED 52
+#define EXIT_REASON_INVVPID 53
#define EXIT_REASON_WBINVD 54
+#define EXIT_REASON_XSETBV 55
-#define HVM_VMX_EXIT_REASON_MAX (EXIT_REASON_WBINVD+1)
+#define HVM_VMX_EXIT_REASON_MAX (EXIT_REASON_XSETBV+1)
char * hvm_vmx_exit_reason_name[HVM_VMX_EXIT_REASON_MAX] = {
[0] = "NONE",
[EXIT_REASON_EXCEPTION_NMI]="EXCEPTION_NMI",
[EXIT_REASON_EXTERNAL_INTERRUPT]="EXTERNAL_INTERRUPT",
+ [EXIT_REASON_TRIPLE_FAULT]="TRIPLE_FAULT",
+ [EXIT_REASON_INIT]="INIT",
+ [EXIT_REASON_SIPI]="SIPI",
+ [EXIT_REASON_IO_SMI]="IO_SMI",
+ [EXIT_REASON_OTHER_SMI]="OTHER_SMI",
[EXIT_REASON_PENDING_INTERRUPT]="PENDING_INTERRUPT",
+ [EXIT_REASON_PENDING_VIRT_NMI]="PENDING_VIRT_NMI",
[EXIT_REASON_TASK_SWITCH]="TASK_SWITCH",
[EXIT_REASON_CPUID]="CPUID",
+ [EXIT_REASON_GETSEC]="GETSEC",
[EXIT_REASON_HLT]="HLT",
+ [EXIT_REASON_INVD]="INVD",
[EXIT_REASON_INVLPG]="INVLPG",
[EXIT_REASON_RDPMC]="RDPMC",
[EXIT_REASON_RDTSC]="RDTSC",
+ [EXIT_REASON_RSM]="RSM",
[EXIT_REASON_VMCALL]="VMCALL",
[EXIT_REASON_VMCLEAR]="VMCLEAR",
[EXIT_REASON_VMLAUNCH]="VMLAUNCH",
@@ -539,14 +565,22 @@
[EXIT_REASON_IO_INSTRUCTION]="IO_INSTRUCTION",
[EXIT_REASON_MSR_READ]="MSR_READ",
[EXIT_REASON_MSR_WRITE]="MSR_WRITE",
+ [EXIT_REASON_INVALID_GUEST_STATE]="INVALID_GUEST_STATE",
+ [EXIT_REASON_MSR_LOADING]="MSR_LOADING",
[EXIT_REASON_MWAIT_INSTRUCTION]="MWAIT_INSTRUCTION",
+ [EXIT_REASON_MONITOR_TRAP_FLAG]="MONITOR_TRAP_FLAG",
[EXIT_REASON_MONITOR_INSTRUCTION]="MONITOR_INSTRUCTION",
[EXIT_REASON_PAUSE_INSTRUCTION]="PAUSE_INSTRUCTION",
[EXIT_REASON_MACHINE_CHECK]="MACHINE_CHECK",
[EXIT_REASON_APIC_ACCESS]="APIC_ACCESS",
[EXIT_REASON_EPT_VIOLATION]="EPT_VIOLATION",
[EXIT_REASON_EPT_MISCONFIG]="EPT_MISCONFIG",
+ [EXIT_REASON_INVEPT]="INVEPT",
+ [EXIT_REASON_RDTSCP]="RDTSCP",
+ [EXIT_REASON_VMX_PREEMPTION_TIMER_EXPIRED]="VMX_PREEMPTION_TIMER_EXPIRED",
+ [EXIT_REASON_INVVPID]="INVVPID",
[EXIT_REASON_WBINVD]="WBINVD",
+ [EXIT_REASON_XSETBV]="XSETBV",
};
/* SVM data */
@@ -1520,6 +1554,21 @@
[RUNSTATE_LOST]= "lost",
};
+enum {
+ RUNNABLE_STATE_INVALID,
+ RUNNABLE_STATE_WAKE,
+ RUNNABLE_STATE_PREEMPT,
+ RUNNABLE_STATE_OTHER,
+ RUNNABLE_STATE_MAX
+};
+
+char * runnable_state_name[RUNNABLE_STATE_MAX]={
+ [RUNNABLE_STATE_INVALID]="invalid", /* Should never show up */
+ [RUNNABLE_STATE_WAKE]="wake",
+ [RUNNABLE_STATE_PREEMPT]="preempt",
+ [RUNNABLE_STATE_OTHER]="other",
+};
+
/* Memory data */
enum {
MEM_PAGE_GRANT_MAP = 1,
@@ -1596,6 +1645,7 @@
/* Schedule info */
struct {
int state;
+ int runnable_state; /* Only valid when state==RUNSTATE_RUNNABLE */
tsc_t tsc;
/* TSC skew detection/correction */
struct last_oldstate_struct {
@@ -1621,6 +1671,7 @@
/* Summary info */
struct cycle_framework f;
struct cycle_summary runstates[RUNSTATE_MAX];
+ struct cycle_summary runnable_states[RUNNABLE_STATE_MAX];
struct weighted_cpi_summary cpi;
struct cycle_summary cpu_affinity_all,
cpu_affinity_pcpu[MAX_CPUS];
@@ -3588,12 +3639,12 @@
if(mevt.x64) {
e->gpa = r->x64.gpa;
e->data = r->x64.data;
- if(ri->extra_words*(sizeof(unsigned long))==sizeof(r->x64))
+ if(ri->extra_words*(sizeof(unsigned int))==sizeof(r->x64))
e->mmio_data_valid=1;
} else {
e->gpa = r->x32.gpa;
e->data = r->x32.data;
- if(ri->extra_words*(sizeof(unsigned long))==sizeof(r->x32))
+ if(ri->extra_words*(sizeof(unsigned int))==sizeof(r->x32))
e->mmio_data_valid=1;
}
@@ -4138,7 +4189,7 @@
struct {
unsigned cr;
unsigned long long val;
- } x64;
+ } __attribute__((packed)) x64;
} *r = (typeof(r))h->d;
unsigned cr;
unsigned long long val;
@@ -4204,7 +4255,7 @@
struct {
unsigned int addr;
unsigned long long val;
- } *r = (typeof(r))h->d;
+ } __attribute__((packed)) *r = (typeof(r))h->d;
int expected_extra=(sizeof(*r)/sizeof(unsigned int));
@@ -4256,7 +4307,7 @@
struct {
unsigned int addr;
unsigned long long val;
- } *r = (typeof(r))h->d;
+ } __attribute__((packed)) *r = (typeof(r))h->d;
int expected_extra=(sizeof(*r)/sizeof(unsigned int));
@@ -4499,7 +4550,7 @@
struct {
unsigned ec;
unsigned long long cr2;
- } x64;
+ } __attribute__((packed)) x64;
} *r = (typeof(r))h->d;
unsigned int ec;
unsigned long long cr2;
@@ -4901,6 +4952,9 @@
if(v->runstate.state == RUNSTATE_RUNNING)
update_cycles(&v->d->total_time, tsc - v->runstate.tsc);
+ if(v->runstate.state == RUNSTATE_RUNNABLE)
+ update_cycles(v->runnable_states + v->runstate.runnable_state, tsc - v->runstate.tsc);
+
/* How much did dom0 run this buffer? */
if(v->d->did == 0) {
int i;
@@ -4925,6 +4979,26 @@
}
}
}
+
+ /* Detect "runnable" states */
+ if ( new_runstate == RUNSTATE_RUNNABLE )
+ {
+ switch(v->runstate.state)
+ {
+ case RUNSTATE_RUNNING:
+ v->runstate.runnable_state=RUNNABLE_STATE_PREEMPT;
+ break;
+ case RUNSTATE_BLOCKED:
+ case RUNSTATE_OFFLINE:
+ v->runstate.runnable_state=RUNNABLE_STATE_WAKE;
+ break;
+ default:
+ v->runstate.runnable_state=RUNNABLE_STATE_OTHER;
+ break;
+ }
+ } else
+ v->runstate.runnable_state=RUNNABLE_STATE_INVALID;
+
v->runstate.state = new_runstate;
v->runstate.tsc = tsc;
@@ -4945,7 +5019,7 @@
struct {
unsigned int exit_reason;
unsigned long long rip;
- } x64;
+ } __attribute__((packed)) x64;
struct {
unsigned int exit_reason;
unsigned int eip;
@@ -4980,7 +5054,7 @@
v->guest_paging_levels = 4;
}
if(!is_valid_addr64(r->x64.rip))
- fprintf(warn, "%s: invalid va %llx",
+ fprintf(warn, "%s: invalid va %llx\n",
__func__, r->x64.rip);
h->rip = r->x64.rip;
h->exit_reason = r->x64.exit_reason;
@@ -6788,7 +6862,7 @@
struct {
unsigned vcpu:16, dom:16;
unsigned long long p1, p2;
- } * r = (typeof(r))ri->d;
+ } __attribute__((packed)) * r = (typeof(r))ri->d;
union {
unsigned int event;
struct {
@@ -7257,6 +7331,16 @@
for(i=0; irunstates+i, desc);
+ if ( i==RUNSTATE_RUNNABLE )
+ {
+ int j;
+ for(j=0; jrunnable_states+j, desc);
+ }
+ }
}
print_cpi_summary(&v->cpi);
print_cpu_affinity(&v->cpu_affinity_all, " cpu affinity");
++++++ xenpaging.autostart.patch ++++++
--- /var/tmp/diff_new_pack.W3ld4U/_old 2011-02-15 16:46:03.000000000 +0100
+++ /var/tmp/diff_new_pack.W3ld4U/_new 2011-02-15 16:46:03.000000000 +0100
@@ -9,6 +9,11 @@
Signed-off-by: Olaf Hering
---
+v3:
+ decouple create/destroycreateXenPaging from _create/_removeDevices
+ init xenpaging variable to 0 if xenpaging is not in config file to
+ avoid string None coming from sxp file
+
v2:
unlink logfile instead of truncating it.
allows hardlinking for further inspection
@@ -17,11 +22,11 @@
tools/python/README.XendConfig | 1
tools/python/README.sxpcfg | 1
tools/python/xen/xend/XendConfig.py | 3 +
- tools/python/xen/xend/XendDomainInfo.py | 6 ++
- tools/python/xen/xend/image.py | 91 ++++++++++++++++++++++++++++++++
+ tools/python/xen/xend/XendDomainInfo.py | 12 ++++
+ tools/python/xen/xend/image.py | 84 ++++++++++++++++++++++++++++++++
tools/python/xen/xm/create.py | 5 +
tools/python/xen/xm/xenapi_create.py | 1
- 8 files changed, 111 insertions(+)
+ 8 files changed, 110 insertions(+)
Index: xen-4.0.2-testing/tools/examples/xmexample.hvm
===================================================================
@@ -69,7 +74,7 @@
'apic': int,
'boot': str,
'device_model': str,
-+ 'xenpaging': int,
++ 'xenpaging': str,
'loader': str,
'display' : str,
'fda': str,
@@ -78,7 +83,7 @@
if self.is_hvm():
+ if 'xenpaging' not in self['platform']:
-+ self['platform']['xenpaging'] = None
++ self['platform']['xenpaging'] = "0"
if 'timer_mode' not in self['platform']:
self['platform']['timer_mode'] = 1
if 'extid' in self['platform'] and int(self['platform']['extid']) == 1:
@@ -86,26 +91,60 @@
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-4.0.2-testing/tools/python/xen/xend/XendDomainInfo.py
-@@ -2441,6 +2441,7 @@ class XendDomainInfo:
+@@ -2293,6 +2293,8 @@ class XendDomainInfo:
+ self.info['name_label'], self.domid, self.info['uuid'],
+ new_name, new_uuid)
+ self._unwatchVm()
++ if self.image:
++ self.image.destroyXenPaging()
+ self._releaseDevices()
+ # Remove existing vm node in xenstore
+ self._removeVm()
+@@ -2954,6 +2956,9 @@ class XendDomainInfo:
+
+ self._createDevices()
+
++ if self.image:
++ self.image.createXenPaging()
++
+ self.image.cleanupTmpImages()
+ self.info['start_time'] = time.time()
+@@ -2978,6 +2983,8 @@ class XendDomainInfo:
+ self.refresh_shutdown_lock.acquire()
+ try:
+ self.unwatchShutdown()
++ if self.image:
++ self.image.destroyXenPaging()
+ self._releaseDevices()
+ bootloader_tidy(self)
+
+@@ -3062,6 +3069,7 @@ class XendDomainInfo:
+ self.image = image.create(self, self.info)
if self.image:
- self.image.createDeviceModel(resume)
+ self._createDevices(True)
+ self.image.createXenPaging()
+ self._storeDomDetails()
+ self._registerWatches()
+ self.refreshShutdown()
+@@ -3202,6 +3210,8 @@ class XendDomainInfo:
+ # could also fetch a parsed note from xenstore
+ fast = self.info.get_notes().get('SUSPEND_CANCEL') and 1 or 0
+ if not fast:
++ if self.image:
++ self.image.destroyXenPaging()
+ self._releaseDevices()
+ self.testDeviceComplete()
+ self.testvifsComplete()
+@@ -3217,6 +3227,8 @@ class XendDomainInfo:
+ self._storeDomDetails()
- #if have pass-through devs, need the virtual pci slots info from qemu
- self.pci_device_configure_boot()
-@@ -2453,6 +2454,11 @@ class XendDomainInfo:
- self.image.destroyDeviceModel()
- except Exception, e:
- log.exception("Device model destroy failed %s" % str(e))
-+ try:
-+ log.debug("stopping xenpaging")
-+ self.image.destroyXenPaging()
-+ except Exception, e:
-+ log.exception("stopping xenpaging failed %s" % str(e))
- else:
- log.debug("No device model")
+ self._createDevices()
++ if self.image:
++ self.image.createXenPaging()
+ log.debug("XendDomainInfo.resumeDomain: devices created")
+ xc.domain_resume(self.domid, fast)
Index: xen-4.0.2-testing/tools/python/xen/xend/image.py
===================================================================
--- xen-4.0.2-testing.orig/tools/python/xen/xend/image.py
@@ -125,14 +164,12 @@
rtc_timeoffset = int(vmConfig['platform'].get('rtc_timeoffset', 0))
if int(vmConfig['platform'].get('localtime', 0)):
if time.localtime(time.time())[8]:
-@@ -392,6 +394,95 @@ class ImageHandler:
+@@ -392,6 +394,88 @@ class ImageHandler:
sentinel_fifos_inuse[sentinel_path_fifo] = 1
self.sentinel_path_fifo = sentinel_path_fifo
+ def createXenPaging(self):
-+ if self.xenpaging is None:
-+ return
-+ if self.xenpaging == 0:
++ if self.xenpaging == "0":
+ return
+ if self.xenpaging_pid:
+ return
@@ -160,11 +197,6 @@
+ os.dup2(logfd, 1)
+ os.dup2(logfd, 2)
+ try:
-+ os.mkdir(xenpaging_dir)
-+ except:
-+ log.info("mkdir %s failed" % xenpaging_dir)
-+ pass
-+ try:
+ os.chdir(xenpaging_dir)
+ except:
+ log.warn("chdir %s failed" % xenpaging_dir)
@@ -186,7 +218,7 @@
+ os.close(logfd)
+
+ def destroyXenPaging(self):
-+ if self.xenpaging is None:
++ if self.xenpaging == "0":
+ return
+ if self.xenpaging_pid:
+ try:
@@ -230,7 +262,7 @@
use="Set the path of the root NFS directory.")
+gopts.var('xenpaging', val='NUM',
-+ fn=set_int, default=None,
++ fn=set_value, default='0',
+ use="Number of pages to swap.")
+
gopts.var('device_model', val='FILE',
++++++ xenpaging.autostart_delay.patch ++++++
--- /var/tmp/diff_new_pack.W3ld4U/_old 2011-02-15 16:46:03.000000000 +0100
+++ /var/tmp/diff_new_pack.W3ld4U/_new 2011-02-15 16:46:03.000000000 +0100
@@ -22,7 +22,7 @@
self.device_model = vmConfig['platform'].get('device_model')
self.xenpaging = vmConfig['platform'].get('xenpaging')
-+ if self.xenpaging:
++ if self.xenpaging is not "0":
+ self.xenpaging_delay = xstransact.Read("/local/domain/0/xenpaging/%s/xenpaging_delay" % self.vm.info['name_label'])
+ if self.xenpaging_delay == None:
+ log.warn("XXX creating /local/domain/0/xenpaging/%s" % self.vm.info['name_label'])
@@ -38,7 +38,7 @@
self.display = vmConfig['platform'].get('display')
self.xauthority = vmConfig['platform'].get('xauthority')
-@@ -401,6 +414,17 @@ class ImageHandler:
+@@ -399,6 +412,17 @@ class ImageHandler:
return
if self.xenpaging_pid:
return
@@ -56,7 +56,7 @@
xenpaging_bin = auxbin.pathTo("xenpaging")
args = [xenpaging_bin]
args = args + ([ "%d" % self.vm.getDomid()])
-@@ -434,6 +458,9 @@ class ImageHandler:
+@@ -427,6 +451,9 @@ class ImageHandler:
except:
log.warn("chdir %s failed" % xenpaging_dir)
try:
@@ -66,7 +66,7 @@
log.info("starting %s" % args)
os.execve(xenpaging_bin, args, env)
except Exception, e:
-@@ -449,10 +476,16 @@ class ImageHandler:
+@@ -442,10 +469,16 @@ class ImageHandler:
self.xenpaging_pid = xenpaging_pid
os.close(null)
os.close(logfd)
@@ -76,7 +76,7 @@
+ log.warn("waiting for xenpaging done.")
def destroyXenPaging(self):
- if self.xenpaging is None:
+ if self.xenpaging == "0":
return
+ # FIXME find correct place for guest shutdown or crash
+ #xstransact.Remove("/local/domain/0/xenpaging/%s" % self.vm.info['name_label'])
++++++ xenpaging.doc.patch ++++++
--- /var/tmp/diff_new_pack.W3ld4U/_old 2011-02-15 16:46:03.000000000 +0100
+++ /var/tmp/diff_new_pack.W3ld4U/_new 2011-02-15 16:46:03.000000000 +0100
@@ -57,7 +57,7 @@
+
+Todo:
+- implement stopping of xenpaging
-+- implement/test live migration
++- implement live migration
+
+
+# vim: tw=72
++++++ xenpaging.guest_remove_page.patch ++++++
--- /var/tmp/diff_new_pack.W3ld4U/_old 2011-02-15 16:46:03.000000000 +0100
+++ /var/tmp/diff_new_pack.W3ld4U/_new 2011-02-15 16:46:03.000000000 +0100
@@ -3,6 +3,8 @@
Simply drop paged-pages in guest_remove_page(), and notify xenpaging to
drop reference to the gfn.
+(xen-unstable changeset: 22705:c5b42971234a)
+
Signed-off-by: Olaf Hering
---
v2:
++++++ xenpaging.no_domain_id.patch ++++++
Subject: xenpaging: remove domain_id and mfn from struct xenpaging_victim
Remove unused mfn member from struct xenpaging_victim.
Remove domain_id from struct xenpaging_victim and use the one from
paging->mem_event where needed. Its not used in the policy.
This saves 4MB runtime data with a 1GB pagefile.
(xen-unstable changeset: 22699:f84ae053b7da)
Signed-off-by: Olaf Hering
---
tools/xenpaging/policy.h | 7 +++----
tools/xenpaging/policy_default.c | 10 +++-------
tools/xenpaging/xenpaging.c | 21 ++++++++++-----------
tools/xenpaging/xenpaging.h | 4 ----
4 files changed, 16 insertions(+), 26 deletions(-)
Index: xen-4.0.2-testing/tools/xenpaging/policy.h
===================================================================
--- xen-4.0.2-testing.orig/tools/xenpaging/policy.h
+++ xen-4.0.2-testing/tools/xenpaging/policy.h
@@ -29,10 +29,9 @@
int policy_init(xenpaging_t *paging);
-int policy_choose_victim(xenpaging_t *paging, domid_t domain_id,
- xenpaging_victim_t *victim);
-void policy_notify_paged_out(domid_t domain_id, unsigned long gfn);
-void policy_notify_paged_in(domid_t domain_id, unsigned long gfn);
+int policy_choose_victim(xenpaging_t *paging, xenpaging_victim_t *victim);
+void policy_notify_paged_out(unsigned long gfn);
+void policy_notify_paged_in(unsigned long gfn);
#endif // __XEN_PAGING_POLICY_H__
Index: xen-4.0.2-testing/tools/xenpaging/policy_default.c
===================================================================
--- xen-4.0.2-testing.orig/tools/xenpaging/policy_default.c
+++ xen-4.0.2-testing/tools/xenpaging/policy_default.c
@@ -68,15 +68,11 @@ int policy_init(xenpaging_t *paging)
return rc;
}
-int policy_choose_victim(xenpaging_t *paging, domid_t domain_id,
- xenpaging_victim_t *victim)
+int policy_choose_victim(xenpaging_t *paging, xenpaging_victim_t *victim)
{
unsigned long wrap = current_gfn;
ASSERT(victim != NULL);
- /* Domain to pick on */
- victim->domain_id = domain_id;
-
do
{
current_gfn++;
@@ -96,13 +92,13 @@ int policy_choose_victim(xenpaging_t *pa
return 0;
}
-void policy_notify_paged_out(domid_t domain_id, unsigned long gfn)
+void policy_notify_paged_out(unsigned long gfn)
{
set_bit(gfn, bitmap);
clear_bit(gfn, unconsumed);
}
-void policy_notify_paged_in(domid_t domain_id, unsigned long gfn)
+void policy_notify_paged_in(unsigned long gfn)
{
unsigned long old_gfn = mru[i_mru & (MRU_SIZE - 1)];
Index: xen-4.0.2-testing/tools/xenpaging/xenpaging.c
===================================================================
--- xen-4.0.2-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.0.2-testing/tools/xenpaging/xenpaging.c
@@ -344,7 +344,7 @@ int xenpaging_evict_page(xenpaging_t *pa
/* Map page */
gfn = victim->gfn;
ret = -EFAULT;
- page = xc_map_foreign_pages(paging->xc_handle, victim->domain_id,
+ page = xc_map_foreign_pages(paging->xc_handle, paging->mem_event.domain_id,
PROT_READ | PROT_WRITE, &gfn, 1);
if ( page == NULL )
{
@@ -376,7 +376,7 @@ int xenpaging_evict_page(xenpaging_t *pa
}
/* Notify policy of page being paged out */
- policy_notify_paged_out(paging->mem_event.domain_id, victim->gfn);
+ policy_notify_paged_out(victim->gfn);
out:
return ret;
@@ -393,7 +393,7 @@ static int xenpaging_resume_page(xenpagi
/* Notify policy of page being paged in */
if ( notify_policy )
- policy_notify_paged_in(paging->mem_event.domain_id, rsp->gfn);
+ policy_notify_paged_in(rsp->gfn);
/* Tell Xen page is ready */
ret = xc_mem_paging_resume(paging->xc_handle, paging->mem_event.domain_id,
@@ -459,7 +459,7 @@ static int xenpaging_populate_page(
return ret;
}
-static int evict_victim(xenpaging_t *paging, domid_t domain_id,
+static int evict_victim(xenpaging_t *paging,
xenpaging_victim_t *victim, int fd, int i)
{
int j = 0;
@@ -467,7 +467,7 @@ static int evict_victim(xenpaging_t *pag
do
{
- ret = policy_choose_victim(paging, domain_id, victim);
+ ret = policy_choose_victim(paging, victim);
if ( ret != 0 )
{
if ( ret != -ENOSPC )
@@ -487,7 +487,7 @@ static int evict_victim(xenpaging_t *pag
else
{
if ( j++ % 1000 == 0 )
- if ( xc_mem_paging_flush_ioemu_cache(domain_id) )
+ if ( xc_mem_paging_flush_ioemu_cache(paging->mem_event.domain_id) )
ERROR("Error flushing ioemu cache");
}
}
@@ -570,7 +570,7 @@ int main(int argc, char *argv[])
memset(victims, 0, sizeof(xenpaging_victim_t) * num_pages);
for ( i = 0; i < num_pages; i++ )
{
- rc = evict_victim(paging, domain_id, &victims[i], fd, i);
+ rc = evict_victim(paging, &victims[i], fd, i);
if ( rc == -ENOSPC )
break;
if ( rc == -EINTR )
@@ -611,8 +611,7 @@ int main(int argc, char *argv[])
/* Find where in the paging file to read from */
for ( i = 0; i < num_pages; i++ )
{
- if ( (victims[i].domain_id == paging->mem_event.domain_id) &&
- (victims[i].gfn == req.gfn) )
+ if ( victims[i].gfn == req.gfn )
break;
}
@@ -625,6 +624,7 @@ int main(int argc, char *argv[])
if ( req.flags & MEM_EVENT_FLAG_DROP_PAGE )
{
DPRINTF("Dropping page %"PRIx64" p2mt %x\n", req.gfn, req.p2mt);
+ policy_notify_paged_out(req.gfn);
}
else
{
@@ -651,7 +651,7 @@ int main(int argc, char *argv[])
}
/* Evict a new page to replace the one we just paged in */
- evict_victim(paging, domain_id, &victims[i], fd, i);
+ evict_victim(paging, &victims[i], fd, i);
}
else
{
Index: xen-4.0.2-testing/tools/xenpaging/xenpaging.h
===================================================================
--- xen-4.0.2-testing.orig/tools/xenpaging/xenpaging.h
+++ xen-4.0.2-testing/tools/xenpaging/xenpaging.h
@@ -49,12 +49,8 @@ typedef struct xenpaging {
typedef struct xenpaging_victim {
- /* the domain to evict a page from */
- domid_t domain_id;
/* the gfn of the page to evict */
unsigned long gfn;
- /* the mfn of evicted page */
- unsigned long mfn;
} xenpaging_victim_t;
++++++ xenpaging.runtime_mru_size.patch ++++++
Subject: xenpaging: specify policy mru_size at runtime
The environment variable XENPAGING_POLICY_MRU_SIZE will change the mru_size in
the policy at runtime.
Specifying the mru_size at runtime allows the admin to keep more pages in
memory so guests can make more progress. Its also good for development to
reduce the value to put more pressure on the paging related code paths.
(xen-unstable changeset: 22700:f87b1c194eb8)
Signed-off-by: Olaf Hering
---
tools/xenpaging/policy_default.c | 21 +++++++++++++++++----
tools/xenpaging/xenpaging.c | 8 ++++++++
tools/xenpaging/xenpaging.h | 1 +
3 files changed, 26 insertions(+), 4 deletions(-)
Index: xen-4.0.2-testing/tools/xenpaging/policy_default.c
===================================================================
--- xen-4.0.2-testing.orig/tools/xenpaging/policy_default.c
+++ xen-4.0.2-testing/tools/xenpaging/policy_default.c
@@ -29,7 +29,8 @@
#define MRU_SIZE (1024 * 16)
-static unsigned long mru[MRU_SIZE];
+static unsigned long *mru;
+static unsigned int mru_size;
static unsigned int i_mru;
static unsigned long *bitmap;
static unsigned long *unconsumed;
@@ -56,8 +57,20 @@ int policy_init(xenpaging_t *paging)
bitmap_size = paging->bitmap_size;
max_pages = paging->domain_info->max_pages;
+ if ( paging->policy_mru_size > 0 )
+ mru_size = paging->policy_mru_size;
+ else
+ mru_size = MRU_SIZE;
+
+ mru = malloc(sizeof(*mru) * mru_size);
+ if ( mru == NULL )
+ {
+ rc = -ENOMEM;
+ goto out;
+ }
+
/* Initialise MRU list of paged in pages */
- for ( i = 0; i < MRU_SIZE; i++ )
+ for ( i = 0; i < mru_size; i++ )
mru[i] = INVALID_MFN;
/* Don't page out first 16MB */
@@ -100,12 +113,12 @@ void policy_notify_paged_out(unsigned lo
void policy_notify_paged_in(unsigned long gfn)
{
- unsigned long old_gfn = mru[i_mru & (MRU_SIZE - 1)];
+ unsigned long old_gfn = mru[i_mru & (mru_size - 1)];
if ( old_gfn != INVALID_MFN )
clear_bit(old_gfn, bitmap);
- mru[i_mru & (MRU_SIZE - 1)] = gfn;
+ mru[i_mru & (mru_size - 1)] = gfn;
i_mru++;
}
Index: xen-4.0.2-testing/tools/xenpaging/xenpaging.c
===================================================================
--- xen-4.0.2-testing.orig/tools/xenpaging/xenpaging.c
+++ xen-4.0.2-testing/tools/xenpaging/xenpaging.c
@@ -80,6 +80,7 @@ static void *init_page(void)
xenpaging_t *xenpaging_init(domid_t domain_id)
{
xenpaging_t *paging;
+ char *p;
int rc;
DPRINTF("xenpaging init\n");
@@ -96,6 +97,13 @@ xenpaging_t *xenpaging_init(domid_t doma
goto err;
}
+ p = getenv("XENPAGING_POLICY_MRU_SIZE");
+ if ( p && *p )
+ {
+ paging->policy_mru_size = atoi(p);
+ DPRINTF("Setting policy mru_size to %d\n", paging->policy_mru_size);
+ }
+
/* Set domain id */
paging->mem_event.domain_id = domain_id;
Index: xen-4.0.2-testing/tools/xenpaging/xenpaging.h
===================================================================
--- xen-4.0.2-testing.orig/tools/xenpaging/xenpaging.h
+++ xen-4.0.2-testing/tools/xenpaging/xenpaging.h
@@ -37,6 +37,7 @@
typedef struct xenpaging {
int xc_handle;
+ int policy_mru_size;
xc_platform_info_t *platform_info;
xc_domaininfo_t *domain_info;
++++++ xentrace.dynamic_sized_tbuf.patch ++++++
---
xen/common/trace.c | 215 ++++++++++++++++++++---------------------------------
1 file changed, 83 insertions(+), 132 deletions(-)
Index: xen-4.0.2-testing/xen/common/trace.c
===================================================================
--- xen-4.0.2-testing.orig/xen/common/trace.c
+++ xen-4.0.2-testing/xen/common/trace.c
@@ -41,14 +41,14 @@ CHECK_t_buf;
#define compat_t_rec t_rec
#endif
-/* opt_tbuf_size: trace buffer size (in pages) */
-static unsigned int opt_tbuf_size = 0;
+/* opt_tbuf_size: trace buffer size (in pages) for each cpu */
+static unsigned int opt_tbuf_size;
integer_param("tbuf_size", opt_tbuf_size);
/* Pointers to the meta-data objects for all system trace buffers */
static struct t_info *t_info;
-#define T_INFO_PAGES 2 /* Size fixed at 2 pages for now. */
-#define T_INFO_SIZE ((T_INFO_PAGES)*(PAGE_SIZE))
+static unsigned int t_info_pages;
+
static DEFINE_PER_CPU_READ_MOSTLY(struct t_buf *, t_bufs);
static DEFINE_PER_CPU_READ_MOSTLY(unsigned char *, t_data);
static DEFINE_PER_CPU_READ_MOSTLY(spinlock_t, t_lock);
@@ -84,20 +84,30 @@ static void calc_tinfo_first_offset(void
}
/**
- * check_tbuf_size - check to make sure that the proposed size will fit
+ * calculate_tbuf_size - check to make sure that the proposed size will fit
* in the currently sized struct t_info and allows prod and cons to
* reach double the value without overflow.
*/
-static int check_tbuf_size(u32 pages)
+static int calculate_tbuf_size(unsigned int pages)
{
struct t_buf dummy;
- typeof(dummy.prod) size;
-
- size = ((typeof(dummy.prod))pages) * PAGE_SIZE;
-
- return (size / PAGE_SIZE != pages)
- || (size + size < size)
- || (num_online_cpus() * pages + t_info_first_offset > T_INFO_SIZE / sizeof(uint32_t));
+ typeof(dummy.prod) size = -1;
+
+ /* max size holds up to n pages */
+ size /= PAGE_SIZE;
+ if ( pages > size )
+ {
+ gdprintk(XENLOG_INFO, "%s: requested number of %u pages reduced to %u\n",
+ __func__, pages, (unsigned int)size);
+ pages = size;
+ }
+
+ t_info_pages = num_online_cpus() * pages + t_info_first_offset;
+ t_info_pages *= sizeof(uint32_t);
+ t_info_pages /= PAGE_SIZE;
+ if ( t_info_pages % PAGE_SIZE )
+ t_info_pages++;
+ return pages;
}
/**
@@ -110,47 +120,28 @@ static int check_tbuf_size(u32 pages)
* This function may also be called later when enabling trace buffers
* via the SET_SIZE hypercall.
*/
-static int alloc_trace_bufs(void)
+static int alloc_trace_bufs(unsigned int pages)
{
- int i, cpu, order;
- unsigned long nr_pages;
+ int i, cpu, order;
/* Start after a fixed-size array of NR_CPUS */
uint32_t *t_info_mfn_list;
int offset;
- if ( opt_tbuf_size == 0 )
- return -EINVAL;
+ if ( t_info )
+ return -EBUSY;
- if ( check_tbuf_size(opt_tbuf_size) )
- {
- printk("Xen trace buffers: tb size %d too large. "
- "Tracing disabled.\n",
- opt_tbuf_size);
+ if ( pages == 0 )
return -EINVAL;
- }
-
- /* t_info size is fixed for now. Currently this works great, so there
- * seems to be no need to make it dynamic. */
- t_info = alloc_xenheap_pages(get_order_from_pages(T_INFO_PAGES), 0);
- if ( t_info == NULL )
- {
- printk("Xen trace buffers: t_info allocation failed! "
- "Tracing disabled.\n");
- return -ENOMEM;
- }
-
- for ( i = 0; i < T_INFO_PAGES; i++ )
- share_xen_page_with_privileged_guests(
- virt_to_page(t_info) + i, XENSHARE_readonly);
- t_info_mfn_list = (uint32_t *)t_info;
- offset = t_info_first_offset;
+ /* Calculate offset in u32 of first mfn */
+ calc_tinfo_first_offset();
- t_info->tbuf_size = opt_tbuf_size;
- printk(XENLOG_INFO "tbuf_size %d\n", t_info->tbuf_size);
+ pages = calculate_tbuf_size(pages);
+ order = get_order_from_pages(pages);
- nr_pages = opt_tbuf_size;
- order = get_order_from_pages(nr_pages);
+ t_info = alloc_xenheap_pages(get_order_from_pages(t_info_pages), 0);
+ if ( t_info == NULL )
+ goto out_dealloc;
/*
* First, allocate buffers for all of the cpus. If any
@@ -158,27 +149,29 @@ static int alloc_trace_bufs(void)
*/
for_each_online_cpu(cpu)
{
- int flags;
- char *rawbuf;
+ void *rawbuf;
struct t_buf *buf;
if ( (rawbuf = alloc_xenheap_pages(
order, MEMF_bits(32 + PAGE_SHIFT))) == NULL )
{
- printk("Xen trace buffers: memory allocation failed\n");
- opt_tbuf_size = 0;
+ printk("Xen trace buffers: memory allocation failed on cpu %d\n", cpu);
goto out_dealloc;
}
- spin_lock_irqsave(&per_cpu(t_lock, cpu), flags);
-
- per_cpu(t_bufs, cpu) = buf = (struct t_buf *)rawbuf;
+ per_cpu(t_bufs, cpu) = buf = rawbuf;
buf->cons = buf->prod = 0;
per_cpu(t_data, cpu) = (unsigned char *)(buf + 1);
+ }
- spin_unlock_irqrestore(&per_cpu(t_lock, cpu), flags);
+ offset = t_info_first_offset;
+ t_info_mfn_list = (uint32_t *)t_info;
- }
+ for(i = 0; i < t_info_pages; i++)
+ share_xen_page_with_privileged_guests(
+ virt_to_page(t_info) + i, XENSHARE_readonly);
+
+ t_info->tbuf_size = pages;
/*
* Now share the pages to xentrace can map them, and write them in
@@ -187,91 +180,72 @@ static int alloc_trace_bufs(void)
for_each_online_cpu(cpu)
{
/* Share pages so that xentrace can map them. */
- char *rawbuf;
+ void *rawbuf = per_cpu(t_bufs, cpu);
+ struct page_info *p = virt_to_page(rawbuf);
+ uint32_t mfn = virt_to_mfn(rawbuf);
- if ( (rawbuf = (char *)per_cpu(t_bufs, cpu)) )
+ for ( i = 0; i < pages; i++ )
{
- struct page_info *p = virt_to_page(rawbuf);
- uint32_t mfn = virt_to_mfn(rawbuf);
+ share_xen_page_with_privileged_guests(p + i, XENSHARE_writable);
- for ( i = 0; i < nr_pages; i++ )
- {
- share_xen_page_with_privileged_guests(
- p + i, XENSHARE_writable);
-
- t_info_mfn_list[offset + i]=mfn + i;
- }
- /* Write list first, then write per-cpu offset. */
- wmb();
- t_info->mfn_offset[cpu]=offset;
- printk(XENLOG_INFO "p%d mfn %"PRIx32" offset %d\n",
- cpu, mfn, offset);
- offset+=i;
+ t_info_mfn_list[offset + i]=mfn + i;
}
+ t_info->mfn_offset[cpu]=offset;
+ printk(XENLOG_INFO "p%d mfn %"PRIx32" offset %d\n",
+ cpu, mfn, offset);
+ offset+=i;
+
+ spin_lock_init(&per_cpu(t_lock, cpu));
}
- data_size = (opt_tbuf_size * PAGE_SIZE - sizeof(struct t_buf));
+ data_size = (pages * PAGE_SIZE - sizeof(struct t_buf));
t_buf_highwater = data_size >> 1; /* 50% high water */
+ opt_tbuf_size = pages;
+
+ printk("Xen trace buffers: initialised\n");
+ wmb(); /* above must be visible before tb_init_done flag set */
+ tb_init_done = 1;
return 0;
+
out_dealloc:
for_each_online_cpu(cpu)
{
- int flags;
- char * rawbuf;
-
- spin_lock_irqsave(&per_cpu(t_lock, cpu), flags);
- if ( (rawbuf = (char *)per_cpu(t_bufs, cpu)) )
+ void *rawbuf = per_cpu(t_bufs, cpu);
+ per_cpu(t_bufs, cpu) = NULL;
+ if ( rawbuf )
{
- per_cpu(t_bufs, cpu) = NULL;
ASSERT(!(virt_to_page(rawbuf)->count_info & PGC_allocated));
free_xenheap_pages(rawbuf, order);
}
- spin_unlock_irqrestore(&per_cpu(t_lock, cpu), flags);
}
-
+ free_xenheap_pages(t_info, get_order_from_pages(t_info_pages));
+ t_info = NULL;
+ printk("Xen trace buffers: allocation failed! Tracing disabled.\n");
return -ENOMEM;
}
/**
- * tb_set_size - handle the logic involved with dynamically
- * allocating and deallocating tbufs
+ * tb_set_size - handle the logic involved with dynamically allocating tbufs
*
* This function is called when the SET_SIZE hypercall is done.
*/
-static int tb_set_size(int size)
+static int tb_set_size(unsigned int pages)
{
/*
* Setting size is a one-shot operation. It can be done either at
* boot time or via control tools, but not by both. Once buffers
* are created they cannot be destroyed.
*/
- int ret = 0;
-
-
-
- if ( opt_tbuf_size != 0 )
+ if ( opt_tbuf_size && pages != opt_tbuf_size )
{
- if ( size != opt_tbuf_size )
- gdprintk(XENLOG_INFO, "tb_set_size from %d to %d not implemented\n",
- opt_tbuf_size, size);
+ gdprintk(XENLOG_INFO, "tb_set_size from %d to %d not implemented\n",
+ opt_tbuf_size, pages);
return -EINVAL;
}
- if ( size <= 0 )
- return -EINVAL;
-
- opt_tbuf_size = size;
-
- if ( (ret = alloc_trace_bufs()) != 0 )
- {
- opt_tbuf_size = 0;
- return ret;
- }
-
- printk("Xen trace buffers: initialized\n");
- return 0;
+ return alloc_trace_bufs(pages);
}
int trace_will_trace_event(u32 event)
@@ -309,36 +283,13 @@ int trace_will_trace_event(u32 event)
*/
void __init init_trace_bufs(void)
{
- int i;
-
- /* Calculate offset in u32 of first mfn */
- calc_tinfo_first_offset();
-
- /* Per-cpu t_lock initialisation. */
- for ( i = 0; i < NR_CPUS; i++ )
- spin_lock_init(&per_cpu(t_lock, i));
-
- if ( opt_tbuf_size == 0 )
+ if ( opt_tbuf_size && alloc_trace_bufs(opt_tbuf_size) )
{
- printk("Xen trace buffers: disabled\n");
- goto fail;
- }
-
- if ( alloc_trace_bufs() != 0 )
- {
- dprintk(XENLOG_INFO, "Xen trace buffers: "
- "allocation size %d failed, disabling\n",
- opt_tbuf_size);
- goto fail;
+ gdprintk(XENLOG_INFO, "Xen trace buffers: "
+ "allocation size %d failed, disabling\n",
+ opt_tbuf_size);
+ opt_tbuf_size = 0;
}
-
- printk("Xen trace buffers: initialised\n");
- wmb(); /* above must be visible before tb_init_done flag set */
- tb_init_done = 1;
- return;
-
- fail:
- opt_tbuf_size = 0;
}
/**
@@ -357,7 +308,7 @@ int tb_control(xen_sysctl_tbuf_op_t *tbc
case XEN_SYSCTL_TBUFOP_get_info:
tbc->evt_mask = tb_event_mask;
tbc->buffer_mfn = t_info ? virt_to_mfn(t_info) : 0;
- tbc->size = T_INFO_PAGES * PAGE_SIZE;
+ 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);
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org