bitkeeper revision 1.1400 (4284b9fcQX9z9IzwMeHwdHYRkEIjFA)

Merge
This commit is contained in:
xenbk@gandalf.hpl.hp.com committed 2005-05-13 14:30:20 +00:00
commit 5149cc539b
85 files changed
+2850 -763

No files matched your search

+1
View File
@@ -469,6 +469,7 @@
413aa1d0oNP8HXLvfPuMe6cSroUfSA patches/linux-2.6.11/agpgart.patch
427261074Iy1MkbbqIV6zdZDWWx_Jg patches/linux-2.6.11/i386-cpu-hotplug-updated-for-mm.patch
42372652KCUP-IOH9RN19YQmGhs4aA patches/linux-2.6.11/iomap.patch
428359d4b3fDYtazwXi4UUmSWaOUew patches/linux-2.6.11/linux-2.6.11.8.patch
424f001e_M1Tnxc52rDrmCLelnDWMQ patches/linux-2.6.11/x86_64-linux.patch
3f776bd1Hy9rn69ntXBhPReUFw9IEA tools/Makefile
40e1b09db5mN69Ijj0X_Eol-S7dXiw tools/Rules.mk
+2 -1
View File
@@ -62,6 +62,7 @@ patches/ebtables-brnf-5_vs_2.4.25.diff
patches/ebtables.diff
patches/tmp/*
pristine-*
ref-*
tools/*/build/lib*/*.py
tools/Makefile.smh
tools/balloon/balloon
@@ -89,8 +90,8 @@ tools/blktap/xen/*
tools/check/.*
tools/cmdline/*
tools/cmdline/xen/*
tools/gdb/gdb-6.2.1/*
tools/gdb/gdb-6.2.1-linux-i386-xen/*
tools/gdb/gdb-6.2.1/*
tools/ioemu/iodev/device-model
tools/libxc/xen/*
tools/misc/cpuperf/cpuperf-perfcntr
+1
View File
@@ -80,6 +80,7 @@ rn@wyvis.camb.intel-research.net
rn@wyvis.research.intel-research.net
rneugeba@wyvis.research
rneugeba@wyvis.research.intel-research.net
rusty@rustcorp.com.au
ryanh@us.ibm.com
sd386@font.cl.cam.ac.uk
shand@spidean.research.intel-research.net
+17 -3
View File
@@ -43,6 +43,12 @@ netbsd-%-xen-kernel-$(NETBSD_CVSSNAP).tar.bz2:
netbsd-%.tar.bz2: netbsd-%-xen-kernel-$(NETBSD_CVSSNAP).tar.bz2
ln -fs $< $@
ifeq ($(OS),linux)
OS_VER = $(LINUX_VER)
else
OS_VER = $(NETBSD_VER)
endif
pristine-%: %.tar.bz2
rm -rf tmp-$(@F) $@
mkdir -p tmp-$(@F)
@@ -51,9 +57,17 @@ pristine-%: %.tar.bz2
touch $@ # update timestamp to avoid rebuild
touch $@/.bk_skip
@rm -rf tmp-$(@F)
OS_PATCHES = $(shell echo patches/$(OS)-$(OS_VER)/*.patch)
ref-%: pristine-% $(OS_PATCHES)
rm -rf $@
cp -al $< tmp-$(@F)
[ -d patches/$* ] && \
for i in patches/$*/*.patch ; do ( cd $@ ; patch -p1 <../$$i ) ; done || \
for i in patches/$*/*.patch ; do ( cd tmp-$(@F) ; patch -p1 <../$$i ) ; done || \
true
mv tmp-$(@F) $@
touch $@ # update timestamp to avoid rebuild
%-build:
$(MAKE) -f buildconfigs/mk.$* build
@@ -67,7 +81,7 @@ pristine-%: %.tar.bz2
%-config:
$(MAKE) -f buildconfigs/mk.$* config
%-xen.patch: pristine-%
%-xen.patch: ref-%
rm -rf tmp-$@
cp -al $< tmp-$@
( cd $*-xen-sparse && ./mkbuildtree ../tmp-$@ )
@@ -75,7 +89,7 @@ pristine-%: %.tar.bz2
rm -rf tmp-$@
%-mrproper: %-mrproper-extra
rm -rf pristine-$* $*.tar.bz2
rm -rf pristine-$* ref-$* $*.tar.bz2
rm -rf $*-xen.patch
netbsd-%-mrproper-extra:
+5 -3
View File
@@ -1,11 +1,13 @@
OS = linux
LINUX_SERIES = 2.4
EXTRAVERSION = xen0
FULLVERSION = $(LINUX_VER)-$(EXTRAVERSION)
LINUX_DIR = linux-$(FULLVERSION)
LINUX_DIR = $(OS)-$(FULLVERSION)
include buildconfigs/Rules.mk
@@ -24,7 +26,7 @@ patches/tmp/ebtables.diff:
wget http://www.cl.cam.ac.uk/netos/xen/downloads/ebtables-brnf-5_vs_2.4.27.diff.gz -O- | gunzip -c > $@
$(LINUX_DIR)/include/linux/autoconf.h: patches/tmp/ebtables.diff
$(LINUX_DIR)/include/linux/autoconf.h: pristine-linux-$(LINUX_VER)
$(LINUX_DIR)/include/linux/autoconf.h: ref-$(OS)-$(LINUX_VER)
rm -rf $(LINUX_DIR)
cp -al $< $(LINUX_DIR)
# Apply arch-xen patches
@@ -53,4 +55,4 @@ clean:
$(MAKE) -C $(LINUX_DIR) ARCH=xen clean
delete:
rm -rf tmp-linux-$(LINUX_VER) $(LINUX_DIR)
rm -rf tmp-$(OS)-$(LINUX_VER) $(LINUX_DIR)
+5 -3
View File
@@ -1,11 +1,13 @@
OS = linux
LINUX_SERIES = 2.4
EXTRAVERSION = xenU
FULLVERSION = $(LINUX_VER)-$(EXTRAVERSION)
LINUX_DIR = linux-$(FULLVERSION)
LINUX_DIR = $(OS)-$(FULLVERSION)
include buildconfigs/Rules.mk
@@ -19,7 +21,7 @@ build: $(LINUX_DIR)/include/linux/autoconf.h
fi
$(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_PATH=$(DESTDIR) install
$(LINUX_DIR)/include/linux/autoconf.h: pristine-linux-$(LINUX_VER)
$(LINUX_DIR)/include/linux/autoconf.h: ref-linux-$(LINUX_VER)
rm -rf $(LINUX_DIR)
cp -al $< $(LINUX_DIR)
# Apply arch-xen patches
@@ -46,4 +48,4 @@ clean:
$(MAKE) -C $(LINUX_DIR) ARCH=xen clean
delete:
rm -rf tmp-linux-$(LINUX_VER) $(LINUX_DIR)
rm -rf tmp-$(OS)-$(LINUX_VER) $(LINUX_DIR)
+5 -3
View File
@@ -1,11 +1,13 @@
OS = linux
LINUX_SERIES = 2.6
EXTRAVERSION = xen0
FULLVERSION = $(LINUX_VER)-$(EXTRAVERSION)
LINUX_DIR = linux-$(FULLVERSION)
LINUX_DIR = $(OS)-$(FULLVERSION)
include buildconfigs/Rules.mk
@@ -19,7 +21,7 @@ build: $(LINUX_DIR)/include/linux/autoconf.h
fi
$(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_PATH=$(DESTDIR) install
$(LINUX_DIR)/include/linux/autoconf.h: pristine-linux-$(LINUX_VER)
$(LINUX_DIR)/include/linux/autoconf.h: ref-$(OS)-$(LINUX_VER)
rm -rf $(LINUX_DIR)
cp -al $< $(LINUX_DIR)
# Apply arch-xen patches
@@ -44,4 +46,4 @@ clean:
$(MAKE) -C $(LINUX_DIR) ARCH=xen clean
delete:
rm -rf tmp-linux-$(LINUX_VER) $(LINUX_DIR)
rm -rf tmp-$(OS)-$(LINUX_VER) $(LINUX_DIR)
+5 -3
View File
@@ -1,11 +1,13 @@
OS = linux
LINUX_SERIES = 2.6
EXTRAVERSION = xenU
FULLVERSION = $(LINUX_VER)-$(EXTRAVERSION)
LINUX_DIR = linux-$(FULLVERSION)
LINUX_DIR = $(OS)-$(FULLVERSION)
include buildconfigs/Rules.mk
@@ -19,7 +21,7 @@ build: $(LINUX_DIR)/include/linux/autoconf.h
fi
$(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_PATH=$(DESTDIR) install
$(LINUX_DIR)/include/linux/autoconf.h: pristine-linux-$(LINUX_VER)
$(LINUX_DIR)/include/linux/autoconf.h: ref-$(OS)-$(LINUX_VER)
rm -rf $(LINUX_DIR)
cp -al $< $(LINUX_DIR)
# Apply arch-xen patches
@@ -44,4 +46,4 @@ clean:
$(MAKE) -C $(LINUX_DIR) ARCH=xen clean
delete:
rm -rf tmp-linux-$(LINUX_VER) $(LINUX_DIR)
rm -rf tmp-$(OS)-$(LINUX_VER) $(LINUX_DIR)
+6 -4
View File
@@ -1,4 +1,6 @@
OS = netbsd
NETBSD_RELEASE ?= 2.0
NETBSD_CVSSNAP ?= 20050309
@@ -6,13 +8,13 @@ EXTRAVERSION = xenU
FULLVERSION = $(NETBSD_VER)-$(EXTRAVERSION)
NETBSD_DIR = netbsd-$(FULLVERSION)
NETBSD_DIR = $(OS)-$(FULLVERSION)
.PHONY: build clean mrproper mkpatch
include buildconfigs/Rules.mk
build: netbsd-$(EXTRAVERSION)
build: $(OS)-$(EXTRAVERSION)
netbsd-%-tools.tar.bz2:
@echo "Cannot find netbsd-$(NETBSD_VER)-tools.tar.gz in path $(NETBSD_SRC_PATH)"
@@ -22,7 +24,7 @@ netbsd-%-tools: netbsd-%-tools.tar.bz2
tar -jxf $<
touch $@ # update timestamp to avoid rebuild
$(NETBSD_DIR)/.valid: pristine-netbsd-$(NETBSD_VER)
$(NETBSD_DIR)/.valid: ref-$(OS)-$(NETBSD_VER)
$(RM) -rf $(NETBSD_DIR)
cp -al $< $(NETBSD_DIR)
# Apply arch-xen patches
@@ -40,4 +42,4 @@ clean:
$(MAKE) -C netbsd-$(FULLVERSION) clean
delete:
rm -rf tmp-netbsd-$(NETBSD_VER) $(NETBSD_DIR)
rm -rf tmp-$(OS)-$(NETBSD_VER) $(NETBSD_DIR)
+35 -22
View File
@@ -484,7 +484,7 @@ distribution. The entry should look something like the following:
{\small
\begin{verbatim}
title Xen 2.0 / XenLinux 2.6.9
kernel /boot/xen.gz dom0_mem=131072
kernel /boot/xen.gz dom0_mem=128M
module /boot/vmlinuz-2.6.9-xen0 root=/dev/sda4 ro console=tty0
\end{verbatim}
}
@@ -524,7 +524,7 @@ have problems.
\subsection{Serial Console (optional)}
%% kernel /boot/xen.gz dom0_mem=131072 com1=115200,8n1
%% kernel /boot/xen.gz dom0_mem=128M com1=115200,8n1
%% module /boot/vmlinuz-2.6.9-xen0 root=/dev/sda4 ro
@@ -534,9 +534,9 @@ with:
\begin{quote}
{\small
\begin{verbatim}
kernel /boot/xen.gz dom0_mem=131072 com1=115200,8n1
kernel /boot/xen.gz dom0_mem=128M com1=115200,8n1
\end{verbatim}}
\end{quote}
\end{quote}
This configures Xen to output on COM1 at 115,200 baud, 8 data bits,
1 stop bit and no parity. Modify these parameters for your set up.
@@ -1680,12 +1680,6 @@ should be appended to Xen's command line, either manually or by
editing \path{grub.conf}.
\begin{description}
\item [ignorebiostables ]
Disable parsing of BIOS-supplied tables. This may help with some
chipsets that aren't fully supported by Xen. If you specify this
option then ACPI tables are also ignored, and SMP support is
disabled.
\item [noreboot ]
Don't reboot the machine automatically on errors. This is
useful to catch debug output if you aren't catching console messages
@@ -1695,10 +1689,6 @@ editing \path{grub.conf}.
Disable SMP support.
This option is implied by `ignorebiostables'.
\item [noacpi ]
Disable ACPI tables, which confuse Xen on some chipsets.
This option is implied by `ignorebiostables'.
\item [watchdog ]
Enable NMI watchdog which can report certain failures.
@@ -1756,8 +1746,18 @@ editing \path{grub.conf}.
`nmi=dom0': Inform DOM0 of the NMI. \\
`nmi=ignore': Ignore the NMI.
\item [mem=xxx ]
Set the physical RAM address limit. Any RAM appearing beyond this
physical address in the memory map will be ignored. This parameter
may be specified with a B, K, M or G suffix, representing bytes,
kilobytes, megabytes and gigabytes respectively. The
default unit, if no suffix is specified, is bytes.
\item [dom0\_mem=xxx ]
Set the amount of memory (in kB) to be allocated to domain0.
Set the amount of memory to be allocated to domain0. This parameter
may be specified with a B, K, M or G suffix, representing bytes,
kilobytes, megabytes and gigabytes respectively. The
default unit, if no suffix is specified, is kilobytes.
\item [tbuf\_size=xxx ]
Set the size of the per-cpu trace buffers, in pages
@@ -1769,16 +1769,29 @@ editing \path{grub.conf}.
Select the CPU scheduler Xen should use. The current
possibilities are `bvt' (default), `atropos' and `rrobin'.
For more information see Section~\ref{s:sched}.
\item [physdev\_dom0\_hide=(xx:xx.x)(yy:yy.y)\ldots ]
Hide selected PCI devices from domain 0 (for instance, to stop it
taking ownership of them so that they can be driven by another
domain). Device IDs should be given in hex format. Bridge devices do
not need to be hidden --- they are hidden implicitly, since guest OSes
do not need to configure them.
\end{description}
In addition, the following platform-specific options may be specified
on the Xen command line. Since domain 0 shares responsibility for
booting the platform, Xen will automatically propagate these options
to its command line.
These options are taken from Linux's command-line syntax with
unchanged semantics.
\begin{description}
\item [acpi=off,force,strict,ht,noirq,\ldots ]
Modify how Xen (and domain 0) parses the BIOS ACPI tables.
\item [acpi\_skip\_timer\_override ]
Instruct Xen (and domain 0) to ignore timer-interrupt override
instructions specified by the BIOS ACPI tables.
\item [noapic ]
Instruct Xen (and domain 0) to ignore any IOAPICs that are present in
the system, and instead continue to use the legacy PIC.
\end{description}
\section{XenLinux Boot Options}
@@ -289,6 +289,10 @@ static void __init probe_roms(void)
unsigned char *rom;
int i;
/* Nothing to do if not running in dom0. */
if (!(xen_start_info.flags & SIF_INITDOMAIN))
return;
/* video rom */
upper = adapter_rom_resources[0].start;
for (start = video_rom_resource.start; start < upper; start += 2048) {
@@ -1213,8 +1217,9 @@ static void __init register_memory(void)
else
legacy_init_iomem_resources(&code_resource, &data_resource);
/* EFI systems may still have VGA */
request_resource(&iomem_resource, &video_ram_resource);
if (xen_start_info.flags & SIF_INITDOMAIN)
/* EFI systems may still have VGA */
request_resource(&iomem_resource, &video_ram_resource);
/* request I/O space for devices used on all i[345]86 PCs */
for (i = 0; i < STANDARD_IO_RESOURCES; i++)
@@ -1571,6 +1576,14 @@ void __init setup_arch(char **cmdline_p)
op.u.set_iopl.iopl = current->thread.io_pl = 1;
HYPERVISOR_physdev_op(&op);
#ifdef CONFIG_ACPI_BOOT
if (!(xen_start_info.flags & SIF_INITDOMAIN)) {
printk(KERN_INFO "ACPI in unprivileged domain disabled\n");
acpi_disabled = 1;
acpi_ht = 0;
}
#endif
/*
* Parse the ACPI tables for possible boot-time SMP configuration.
*/
@@ -54,7 +54,9 @@
#include <asm/desc.h>
#include <asm/arch_hooks.h>
#include <mach_apic.h>
#ifndef CONFIG_X86_IO_APIC
#define Dprintk(args...)
#endif
#include <mach_wakecpu.h>
#include <smpboot_hooks.h>
@@ -1096,6 +1098,7 @@ static void __init smp_boot_cpus(unsigned int max_cpus)
cpus_clear(cpu_sibling_map[0]);
cpu_set(0, cpu_sibling_map[0]);
#ifdef CONFIG_X86_IO_APIC
/*
* If we couldn't find an SMP configuration at boot time,
* get out of here now!
@@ -1106,12 +1109,15 @@ static void __init smp_boot_cpus(unsigned int max_cpus)
#if 0
phys_cpu_present_map = physid_mask_of_physid(0);
#endif
#ifdef CONFIG_X86_LOCAL_APIC
if (APIC_init_uniprocessor())
printk(KERN_NOTICE "Local APIC not detected."
" Using dummy APIC emulation.\n");
#endif
map_cpu_to_logical_apicid();
return;
}
#endif
#if 0
/*
@@ -486,12 +486,11 @@ static void dispatch_rw_block_io(blkif_t *blkif, blkif_request_t *req)
preq.nr_sects += seg[i].nsec;
aop[i].u.map_grant_ref.host_virt_addr = MMAP_VADDR(pending_idx, i);
aop[i].u.map_grant_ref.dom = blkif->domid;
aop[i].u.map_grant_ref.ref = blkif_gref_from_fas(fas);
aop[i].u.map_grant_ref.flags = ( GNTMAP_host_map |
( ( operation == READ ) ?
0 : GNTMAP_readonly ) );
aop[i].u.map_grant_ref.flags = GNTMAP_host_map;
if ( operation == WRITE )
aop[i].u.map_grant_ref.flags |= GNTMAP_readonly;
}
if ( unlikely(HYPERVISOR_grant_table_op(
@@ -824,7 +824,7 @@ static int blkif_queue_request(unsigned long id,
buffer_ma >> PAGE_SHIFT,
( operation == BLKIF_OP_WRITE ? 1 : 0 ) );
blk_shadow[id].frame[req->nr_segments] =
blk_shadow[req->id].frame[req->nr_segments] =
buffer_ma >> PAGE_SHIFT;
req->frame_and_sects[req->nr_segments] =
@@ -13,7 +13,12 @@ static char * __init machine_specific_memory_setup(void)
who = "Xen";
start_pfn = 0;
/* In dom0, we have to start the fake e820 map above the first
* 1MB, in other domains, it can start at 0. */
if (xen_start_info.flags & SIF_INITDOMAIN)
start_pfn = 0x100;
else
start_pfn = 0;
max_pfn = xen_start_info.nr_pages;
e820.nr_map = 0;
@@ -3,7 +3,9 @@
static inline void smpboot_clear_io_apic_irqs(void)
{
#ifdef CONFIG_X86_IO_APIC
io_apic_irqs = 0;
#endif
}
static inline void smpboot_setup_warm_reset_vector(unsigned long start_eip)
@@ -39,12 +41,14 @@ static inline void smpboot_restore_warm_reset_vector(void)
static inline void smpboot_setup_io_apic(void)
{
#ifdef CONFIG_X86_IO_APIC
/*
* Here we can be sure that there is an IO-APIC in the system. Let's
* go and set it up:
*/
if (!skip_ioapic_setup && nr_ioapics)
setup_IO_APIC();
#endif
}
@@ -3,7 +3,9 @@
static inline void smpboot_clear_io_apic_irqs(void)
{
#ifdef CONFIG_X86_IO_APIC
io_apic_irqs = 0;
#endif
}
static inline void smpboot_setup_warm_reset_vector(unsigned long start_eip)
@@ -39,12 +41,14 @@ static inline void smpboot_restore_warm_reset_vector(void)
static inline void smpboot_setup_io_apic(void)
{
#ifdef CONFIG_X86_IO_APIC
/*
* Here we can be sure that there is an IO-APIC in the system. Let's
* go and set it up:
*/
if (!skip_ioapic_setup && nr_ioapics)
setup_IO_APIC();
#endif
}
File diff suppressed because it is too large. Load diff
+26 -23
View File
@@ -87,22 +87,22 @@ typedef struct xc_core_header {
long xc_ptrace(enum __ptrace_request request,
u32 domid,
long addr,
long data);
u32 domid,
long addr,
long data);
long xc_ptrace_core(enum __ptrace_request request,
u32 domid,
long addr,
long data);
u32 domid,
long addr,
long data);
int xc_waitdomain(int domain,
int *status,
int options);
int *status,
int options);
int xc_waitdomain_core(int domain,
int *status,
int options);
int *status,
int options);
/*
* DOMAIN MANAGEMENT FUNCTIONS
@@ -110,7 +110,6 @@ int xc_waitdomain_core(int domain,
typedef struct {
u32 domid;
unsigned int cpu;
unsigned int dying:1, crashed:1, shutdown:1,
paused:1, blocked:1, running:1;
unsigned int shutdown_reason; /* only meaningful if shutdown==1 */
@@ -118,6 +117,9 @@ typedef struct {
unsigned long shared_info_frame;
u64 cpu_time;
unsigned long max_memkb;
unsigned int vcpus;
s32 vcpu_to_cpu[MAX_VIRT_CPUS];
cpumap_t cpumap[MAX_VIRT_CPUS];
} xc_dominfo_t;
typedef dom0_getdomaininfo_t xc_domaininfo_t;
@@ -129,8 +131,8 @@ int xc_domain_create(int xc_handle,
int xc_domain_dumpcore(int xc_handle,
u32 domid,
const char *corename);
u32 domid,
const char *corename);
/**
@@ -167,7 +169,8 @@ int xc_domain_destroy(int xc_handle,
u32 domid);
int xc_domain_pincpu(int xc_handle,
u32 domid,
int cpu);
int vcpu,
cpumap_t *cpumap);
/**
* This function will return information about one or more domains.
*
@@ -195,11 +198,11 @@ int xc_domain_getinfo(int xc_handle,
* domain
* @return 0 on success, -1 on failure
*/
int xc_domain_getfullinfo(int xc_handle,
u32 domid,
u32 vcpu,
xc_domaininfo_t *info,
vcpu_guest_context_t *ctxt);
int xc_domain_get_vcpu_context(int xc_handle,
u32 domid,
u32 vcpu,
vcpu_guest_context_t *ctxt);
int xc_domain_setcpuweight(int xc_handle,
u32 domid,
float weight);
@@ -260,8 +263,8 @@ xc_plan9_build (int xc_handle,
u32 domid,
const char *image_name,
const char *cmdline,
unsigned int control_evtchn,
unsigned long flags);
unsigned int control_evtchn,
unsigned long flags);
struct mem_map;
int xc_vmx_build(int xc_handle,
@@ -418,7 +421,7 @@ int xc_msr_write(int xc_handle, int cpu_mask, int msr, unsigned int low,
/**
* Memory maps a range within one domain to a local address range. Mappings
* should be unmapped with munmap and should follow the same rules as mmap
* regarding page alignment.
* regarding page alignment. Returns NULL on failure.
*
* In Linux, the ring queue for the control channel is accessible by mapping
* the shared_info_frame (from xc_domain_getinfo()) + 2048. The structure
@@ -438,7 +441,7 @@ void *xc_map_foreign_batch(int xc_handle, u32 dom, int prot,
unsigned long *arr, int num );
int xc_get_pfn_list(int xc_handle, u32 domid, unsigned long *pfn_buf,
unsigned long max_pfns);
unsigned long max_pfns);
/*\
* GRANT TABLE FUNCTIONS
+20 -7
View File
@@ -7,6 +7,7 @@
/* number of pages to write at a time */
#define DUMP_INCREMENT 4 * 1024
#define round_pgup(_p) (((_p)+(PAGE_SIZE-1))&PAGE_MASK)
static int
copy_from_domain_page(int xc_handle,
u32 domid,
@@ -28,13 +29,14 @@ xc_domain_dumpcore(int xc_handle,
u32 domid,
const char *corename)
{
vcpu_guest_context_t st_ctxt, *ctxt = &st_ctxt;
unsigned long nr_pages;
unsigned long *page_array;
xc_domaininfo_t st_info, *info = &st_info;
xc_dominfo_t info;
int i, dump_fd;
char *dump_mem, *dump_mem_start = NULL;
struct xc_core_header header;
vcpu_guest_context_t ctxt[MAX_VIRT_CPUS];
if ((dump_fd = open(corename, O_CREAT|O_RDWR, S_IWUSR|S_IRUSR)) < 0) {
PERROR("Could not open corefile %s: %s", corename, strerror(errno));
@@ -46,14 +48,25 @@ xc_domain_dumpcore(int xc_handle,
goto error_out;
}
if (xc_domain_getfullinfo(xc_handle, domid, 0/* XXX hardcode */, info, ctxt)) {
PERROR("Could not get full info for domain");
if (xc_domain_getinfo(xc_handle, domid, 1, &info)) {
PERROR("Could not get info for domain");
goto error_out;
}
for (i = 0; i < sizeof(info.vcpu_to_cpu) / sizeof(info.vcpu_to_cpu[0]);
i++) {
if (info.vcpu_to_cpu[i] == -1)
continue;
if (xc_domain_get_vcpu_context(xc_handle, domid, i, &ctxt[i])) {
PERROR("Could not get all vcpu contexts for domain");
goto error_out;
}
}
nr_pages = info.nr_pages;
nr_pages = info->tot_pages;
header.xch_magic = 0xF00FEBED;
header.xch_nr_vcpus = 1; /* no interface to query at the moment */
header.xch_nr_vcpus = info.vcpus;
header.xch_nr_pages = nr_pages;
header.xch_ctxt_offset = sizeof(struct xc_core_header);
header.xch_index_offset = sizeof(struct xc_core_header) +
@@ -62,7 +75,7 @@ xc_domain_dumpcore(int xc_handle,
sizeof(vcpu_guest_context_t) + nr_pages * sizeof(unsigned long));
write(dump_fd, &header, sizeof(struct xc_core_header));
write(dump_fd, ctxt, sizeof(st_ctxt));
write(dump_fd, &ctxt, sizeof(ctxt[0]) * info.vcpus);
if ((page_array = malloc(nr_pages * sizeof(unsigned long))) == NULL) {
printf("Could not allocate memory\n");
+24 -25
View File
@@ -16,6 +16,8 @@ int xc_domain_create(int xc_handle,
{
int err, errno_saved;
dom0_op_t op;
u32 vcpu = 0; /* FIXME, hard coded initial pin to vcpu 0 */
cpumap_t cpumap = 1 << cpu;
op.cmd = DOM0_CREATEDOMAIN;
op.u.createdomain.domain = (domid_t)*pdomid;
@@ -25,7 +27,7 @@ int xc_domain_create(int xc_handle,
*pdomid = (u16)op.u.createdomain.domain;
if ( (cpu != -1) &&
((err = xc_domain_pincpu(xc_handle, *pdomid, cpu)) != 0) )
((err = xc_domain_pincpu(xc_handle, *pdomid, vcpu, &cpumap)) != 0) )
goto fail;
if ( (err = xc_domain_setcpuweight(xc_handle, *pdomid, cpu_weight)) != 0 )
@@ -84,13 +86,14 @@ int xc_domain_destroy(int xc_handle,
int xc_domain_pincpu(int xc_handle,
u32 domid,
int cpu)
int vcpu,
cpumap_t *cpumap)
{
dom0_op_t op;
op.cmd = DOM0_PINCPUDOMAIN;
op.u.pincpudomain.domain = (domid_t)domid;
op.u.pincpudomain.exec_domain = 0;
op.u.pincpudomain.cpu = cpu;
op.u.pincpudomain.domain = (domid_t)domid;
op.u.pincpudomain.vcpu = vcpu;
op.u.pincpudomain.cpumap = cpumap;
return do_dom0_op(xc_handle, &op);
}
@@ -109,14 +112,9 @@ int xc_domain_getinfo(int xc_handle,
{
op.cmd = DOM0_GETDOMAININFO;
op.u.getdomaininfo.domain = (domid_t)next_domid;
op.u.getdomaininfo.exec_domain = 0; // FIX ME?!?
op.u.getdomaininfo.ctxt = NULL; /* no exec context info, thanks. */
if ( (rc = do_dom0_op(xc_handle, &op)) < 0 )
break;
info->domid = (u16)op.u.getdomaininfo.domain;
info->cpu =
(op.u.getdomaininfo.flags>>DOMFLAGS_CPUSHIFT) & DOMFLAGS_CPUMASK;
info->domid = (u16)op.u.getdomaininfo.domain;
info->dying = !!(op.u.getdomaininfo.flags & DOMFLAGS_DYING);
info->crashed = !!(op.u.getdomaininfo.flags & DOMFLAGS_CRASHED);
@@ -133,29 +131,33 @@ int xc_domain_getinfo(int xc_handle,
info->max_memkb = op.u.getdomaininfo.max_pages<<(PAGE_SHIFT);
info->shared_info_frame = op.u.getdomaininfo.shared_info_frame;
info->cpu_time = op.u.getdomaininfo.cpu_time;
info->vcpus = op.u.getdomaininfo.n_vcpu;
memcpy(&info->vcpu_to_cpu, &op.u.getdomaininfo.vcpu_to_cpu,
sizeof(info->vcpu_to_cpu));
memcpy(&info->cpumap, &op.u.getdomaininfo.cpumap,
sizeof(info->cpumap));
next_domid = (u16)op.u.getdomaininfo.domain + 1;
info++;
}
if(!nr_doms) return rc;
if( !nr_doms ) return rc;
return nr_doms;
}
int xc_domain_getfullinfo(int xc_handle,
u32 domid,
u32 vcpu,
xc_domaininfo_t *info,
vcpu_guest_context_t *ctxt)
int xc_domain_get_vcpu_context(int xc_handle,
u32 domid,
u32 vcpu,
vcpu_guest_context_t *ctxt)
{
int rc, errno_saved;
dom0_op_t op;
op.cmd = DOM0_GETDOMAININFO;
op.u.getdomaininfo.domain = (domid_t)domid;
op.u.getdomaininfo.exec_domain = (u16)vcpu;
op.u.getdomaininfo.ctxt = ctxt;
op.cmd = DOM0_GETVCPUCONTEXT;
op.u.getvcpucontext.domain = (domid_t)domid;
op.u.getvcpucontext.vcpu = (u16)vcpu;
op.u.getvcpucontext.ctxt = ctxt;
if ( (ctxt != NULL) &&
((rc = mlock(ctxt, sizeof(*ctxt))) != 0) )
@@ -170,10 +172,7 @@ int xc_domain_getfullinfo(int xc_handle,
errno = errno_saved;
}
if ( info != NULL )
memcpy(info, &op.u.getdomaininfo, sizeof(*info));
if ( ((u16)op.u.getdomaininfo.domain != domid) && (rc > 0) )
if ( rc > 0 )
return -ESRCH;
else
return rc;
+11 -6
View File
@@ -356,14 +356,19 @@ int xc_linux_build(int xc_handle,
op.cmd = DOM0_GETDOMAININFO;
op.u.getdomaininfo.domain = (domid_t)domid;
op.u.getdomaininfo.exec_domain = 0;
op.u.getdomaininfo.ctxt = ctxt;
if ( (do_dom0_op(xc_handle, &op) < 0) ||
((u16)op.u.getdomaininfo.domain != domid) )
{
PERROR("Could not get info on domain");
goto error_out;
}
if ( xc_domain_get_vcpu_context(xc_handle, domid, 0, ctxt) )
{
PERROR("Could not get vcpu context");
goto error_out;
}
if ( !(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED) ||
(ctxt->pt_base != 0) )
{
@@ -409,7 +414,7 @@ int xc_linux_build(int xc_handle,
ctxt->user_regs.eip = vkern_entry;
ctxt->user_regs.esp = vstartinfo_start + 2*PAGE_SIZE;
ctxt->user_regs.esi = vstartinfo_start;
ctxt->user_regs.eflags = (1<<9) | (1<<2);
ctxt->user_regs.eflags = 1 << 9; /* Interrupt Enable */
/* FPU is set up to default initial state. */
memset(&ctxt->fpu_ctxt, 0, sizeof(ctxt->fpu_ctxt));
@@ -452,9 +457,9 @@ int xc_linux_build(int xc_handle,
memset( &launch_op, 0, sizeof(launch_op) );
launch_op.u.setdomaininfo.domain = (domid_t)domid;
launch_op.u.setdomaininfo.exec_domain = 0;
launch_op.u.setdomaininfo.ctxt = ctxt;
launch_op.u.setdomaininfo.domain = (domid_t)domid;
launch_op.u.setdomaininfo.vcpu = 0;
launch_op.u.setdomaininfo.ctxt = ctxt;
launch_op.cmd = DOM0_SETDOMAININFO;
rc = do_dom0_op(xc_handle, &launch_op);
+3 -5
View File
@@ -181,8 +181,6 @@ int xc_linux_restore(int xc_handle, XcIOContext *ioctxt)
/* Get the domain's shared-info frame. */
op.cmd = DOM0_GETDOMAININFO;
op.u.getdomaininfo.domain = (domid_t)dom;
op.u.getdomaininfo.exec_domain = 0;
op.u.getdomaininfo.ctxt = NULL;
if ( do_dom0_op(xc_handle, &op) < 0 )
{
xcio_error(ioctxt, "Could not get information on new domain");
@@ -636,9 +634,9 @@ int xc_linux_restore(int xc_handle, XcIOContext *ioctxt)
xcio_info(ioctxt, "Domain ready to be built.\n");
op.cmd = DOM0_SETDOMAININFO;
op.u.setdomaininfo.domain = (domid_t)dom;
op.u.setdomaininfo.exec_domain = 0;
op.u.setdomaininfo.ctxt = &ctxt;
op.u.setdomaininfo.domain = (domid_t)dom;
op.u.setdomaininfo.vcpu = 0;
op.u.setdomaininfo.ctxt = &ctxt;
rc = do_dom0_op(xc_handle, &op);
if ( rc != 0 )
+26 -22
View File
@@ -324,7 +324,7 @@ static int analysis_phase( int xc_handle, u32 domid,
int suspend_and_state(int xc_handle, XcIOContext *ioctxt,
xc_domaininfo_t *info,
xc_dominfo_t *info,
vcpu_guest_context_t *ctxt)
{
int i=0;
@@ -333,27 +333,29 @@ int suspend_and_state(int xc_handle, XcIOContext *ioctxt,
retry:
if ( xc_domain_getfullinfo(xc_handle, ioctxt->domain, /* FIXME */ 0,
info, ctxt) )
if ( xc_domain_getinfo(xc_handle, ioctxt->domain, 1, info) )
{
xcio_error(ioctxt, "Could not get full domain info");
return -1;
}
if ( (info->flags &
(DOMFLAGS_SHUTDOWN | (SHUTDOWN_suspend<<DOMFLAGS_SHUTDOWNSHIFT))) ==
(DOMFLAGS_SHUTDOWN | (SHUTDOWN_suspend<<DOMFLAGS_SHUTDOWNSHIFT)) )
if ( xc_domain_get_vcpu_context(xc_handle, ioctxt->domain, 0 /* XXX */,
ctxt) )
{
xcio_error(ioctxt, "Could not get vcpu context");
}
if ( info->shutdown && info->shutdown_reason == SHUTDOWN_suspend )
{
return 0; // success
}
if ( info->flags & DOMFLAGS_PAUSED )
if ( info->paused )
{
// try unpausing domain, wait, and retest
xc_domain_unpause( xc_handle, ioctxt->domain );
xcio_error(ioctxt, "Domain was paused. Wait and re-test. (%u)",
info->flags);
xcio_error(ioctxt, "Domain was paused. Wait and re-test.");
usleep(10000); // 10ms
goto retry;
@@ -362,19 +364,19 @@ retry:
if( ++i < 100 )
{
xcio_error(ioctxt, "Retry suspend domain (%u)", info->flags);
xcio_error(ioctxt, "Retry suspend domain.");
usleep(10000); // 10ms
goto retry;
}
xcio_error(ioctxt, "Unable to suspend domain. (%u)", info->flags);
xcio_error(ioctxt, "Unable to suspend domain.");
return -1;
}
int xc_linux_save(int xc_handle, XcIOContext *ioctxt)
{
xc_domaininfo_t info;
xc_dominfo_t info;
int rc = 1, i, j, k, last_iter, iter = 0;
unsigned long mfn;
@@ -444,13 +446,18 @@ int xc_linux_save(int xc_handle, XcIOContext *ioctxt)
xcio_perror(ioctxt, "Unable to mlock ctxt");
return 1;
}
if ( xc_domain_getfullinfo( xc_handle, domid, /* FIXME */ 0,
&info, &ctxt) )
if ( xc_domain_getinfo(xc_handle, domid, 1, &info) )
{
xcio_error(ioctxt, "Could not get full domain info");
goto out;
}
if ( xc_domain_get_vcpu_context( xc_handle, domid, /* FIXME */ 0,
&ctxt) )
{
xcio_error(ioctxt, "Could not get vcpu context");
goto out;
}
shared_info_frame = info.shared_info_frame;
/* A cheesy test to see whether the domain contains valid state. */
@@ -459,7 +466,7 @@ int xc_linux_save(int xc_handle, XcIOContext *ioctxt)
goto out;
}
nr_pfns = info.max_pages;
nr_pfns = info.max_memkb >> PAGE_SHIFT;
/* cheesy sanity check */
if ( nr_pfns > 1024*1024 ){
@@ -546,8 +553,7 @@ int xc_linux_save(int xc_handle, XcIOContext *ioctxt)
if ( suspend_and_state( xc_handle, ioctxt, &info, &ctxt) )
{
xcio_error(ioctxt, "Domain appears not to have suspended: %u",
info.flags);
xcio_error(ioctxt, "Domain appears not to have suspended");
goto out;
}
@@ -913,14 +919,12 @@ int xc_linux_save(int xc_handle, XcIOContext *ioctxt)
if ( suspend_and_state( xc_handle, ioctxt, &info, &ctxt) )
{
xcio_error(ioctxt,
"Domain appears not to have suspended: %u",
info.flags);
"Domain appears not to have suspended");
goto out;
}
xcio_info(ioctxt,
"SUSPEND flags %08u shinfo %08lx eip %08u "
"esi %08u\n",info.flags,
"SUSPEND shinfo %08lx eip %08u esi %08u\n",
info.shared_info_frame,
ctxt.user_regs.eip, ctxt.user_regs.esi );
}
+9 -5
View File
@@ -440,17 +440,21 @@ xc_plan9_build(int xc_handle,
op.cmd = DOM0_GETDOMAININFO;
op.u.getdomaininfo.domain = (domid_t) domid;
op.u.getdomaininfo.exec_domain = 0;
op.u.getdomaininfo.ctxt = ctxt;
if ((do_dom0_op(xc_handle, &op) < 0) ||
((u32) op.u.getdomaininfo.domain != domid)) {
PERROR("Could not get info on domain");
goto error_out;
}
DPRINTF(("xc_get_tot_pages returns %ld pages\n", tot_pages));
if ( xc_domain_get_vcpu_context(xc_handle, domid, 0, ctxt) )
{
PERROR("Could not get vcpu context");
goto error_out;
}
if (!(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED)
|| (op.u.getdomaininfo.ctxt->pt_base != 0)) {
|| (ctxt->pt_base != 0)) {
ERROR("Domain is already constructed");
goto error_out;
}
@@ -495,7 +499,7 @@ xc_plan9_build(int xc_handle,
/* why is this set? */
ctxt->user_regs.esi = ctxt->user_regs.esp;
ctxt->user_regs.eflags = (1 << 9) | (1 << 2);
ctxt->user_regs.eflags = 1 << 9; /* Interrupt Enable */
/* FPU is set up to default initial state. */
memset(&ctxt->fpu_ctxt, 0, sizeof(ctxt->fpu_ctxt));
@@ -539,7 +543,7 @@ xc_plan9_build(int xc_handle,
memset(&launch_op, 0, sizeof (launch_op));
launch_op.u.setdomaininfo.domain = (domid_t) domid;
launch_op.u.setdomaininfo.exec_domain = 0;
launch_op.u.setdomaininfo.vcpu = 0;
// launch_op.u.setdomaininfo.num_vifs = 1;
launch_op.u.setdomaininfo.ctxt = ctxt;
launch_op.cmd = DOM0_SETDOMAININFO;
+29 -32
View File
@@ -13,18 +13,18 @@ void *xc_map_foreign_batch(int xc_handle, u32 dom, int prot,
privcmd_mmapbatch_t ioctlx;
void *addr;
addr = mmap(NULL, num*PAGE_SIZE, prot, MAP_SHARED, xc_handle, 0);
if ( addr != NULL )
if ( addr == MAP_FAILED )
return NULL;
ioctlx.num=num;
ioctlx.dom=dom;
ioctlx.addr=(unsigned long)addr;
ioctlx.arr=arr;
if ( ioctl( xc_handle, IOCTL_PRIVCMD_MMAPBATCH, &ioctlx ) < 0 )
{
ioctlx.num=num;
ioctlx.dom=dom;
ioctlx.addr=(unsigned long)addr;
ioctlx.arr=arr;
if ( ioctl( xc_handle, IOCTL_PRIVCMD_MMAPBATCH, &ioctlx ) < 0 )
{
perror("XXXXXXXX");
munmap(addr, num*PAGE_SIZE);
return 0;
}
perror("XXXXXXXX");
munmap(addr, num*PAGE_SIZE);
return NULL;
}
return addr;
@@ -40,19 +40,19 @@ void *xc_map_foreign_range(int xc_handle, u32 dom,
privcmd_mmap_entry_t entry;
void *addr;
addr = mmap(NULL, size, prot, MAP_SHARED, xc_handle, 0);
if ( addr != NULL )
if ( addr == MAP_FAILED )
return NULL;
ioctlx.num=1;
ioctlx.dom=dom;
ioctlx.entry=&entry;
entry.va=(unsigned long) addr;
entry.mfn=mfn;
entry.npages=(size+PAGE_SIZE-1)>>PAGE_SHIFT;
if ( ioctl( xc_handle, IOCTL_PRIVCMD_MMAP, &ioctlx ) < 0 )
{
ioctlx.num=1;
ioctlx.dom=dom;
ioctlx.entry=&entry;
entry.va=(unsigned long) addr;
entry.mfn=mfn;
entry.npages=(size+PAGE_SIZE-1)>>PAGE_SHIFT;
if ( ioctl( xc_handle, IOCTL_PRIVCMD_MMAP, &ioctlx ) < 0 )
{
munmap(addr, size);
return 0;
}
munmap(addr, size);
return NULL;
}
return addr;
}
@@ -173,17 +173,16 @@ long long xc_domain_get_cpu_usage( int xc_handle, domid_t domid, int vcpu )
{
dom0_op_t op;
op.cmd = DOM0_GETDOMAININFO;
op.u.getdomaininfo.domain = (domid_t)domid;
op.u.getdomaininfo.exec_domain = (u16)vcpu;
op.u.getdomaininfo.ctxt = NULL;
if ( (do_dom0_op(xc_handle, &op) < 0) ||
((u16)op.u.getdomaininfo.domain != domid) )
op.cmd = DOM0_GETVCPUCONTEXT;
op.u.getvcpucontext.domain = (domid_t)domid;
op.u.getvcpucontext.vcpu = (u16)vcpu;
op.u.getvcpucontext.ctxt = NULL;
if ( (do_dom0_op(xc_handle, &op) < 0) )
{
PERROR("Could not get info on domain");
return -1;
}
return op.u.getdomaininfo.cpu_time;
return op.u.getvcpucontext.cpu_time;
}
@@ -258,8 +257,6 @@ long xc_get_tot_pages(int xc_handle, u32 domid)
dom0_op_t op;
op.cmd = DOM0_GETDOMAININFO;
op.u.getdomaininfo.domain = (domid_t)domid;
op.u.getdomaininfo.exec_domain = 0;
op.u.getdomaininfo.ctxt = NULL;
return (do_dom0_op(xc_handle, &op) < 0) ?
-1 : op.u.getdomaininfo.tot_pages;
}
+7 -12
View File
@@ -71,7 +71,7 @@ struct gdb_regs {
#define FETCH_REGS(cpu) \
if (!regs_valid[cpu]) \
{ \
int retval = xc_domain_getfullinfo(xc_handle, domid, cpu, NULL, &ctxt[cpu]); \
int retval = xc_domain_get_vcpu_context(xc_handle, domid, cpu, &ctxt[cpu]); \
if (retval) \
goto error_out; \
cr3[cpu] = ctxt[cpu].pt_base; /* physical address */ \
@@ -221,7 +221,6 @@ xc_waitdomain(int domain, int *status, int options)
{
dom0_op_t op;
int retval;
vcpu_guest_context_t ctxt;
struct timespec ts;
ts.tv_sec = 0;
ts.tv_nsec = 10*1000*1000;
@@ -234,12 +233,10 @@ xc_waitdomain(int domain, int *status, int options)
}
op.cmd = DOM0_GETDOMAININFO;
op.u.getdomaininfo.domain = domain;
op.u.getdomaininfo.exec_domain = 0;
op.u.getdomaininfo.ctxt = &ctxt;
retry:
retval = do_dom0_op(xc_handle, &op);
if (retval) {
if (retval || op.u.getdomaininfo.domain != domain) {
printf("getdomaininfo failed\n");
goto done;
}
@@ -314,8 +311,8 @@ xc_ptrace(enum __ptrace_request request, u32 domid, long eaddr, long edata)
op.cmd = DOM0_SETDOMAININFO;
SET_XC_REGS(((struct gdb_regs *)data), ctxt[VCPU].user_regs);
op.u.setdomaininfo.domain = domid;
/* XXX need to understand multiple exec_domains */
op.u.setdomaininfo.exec_domain = cpu;
/* XXX need to understand multiple vcpus */
op.u.setdomaininfo.vcpu = cpu;
op.u.setdomaininfo.ctxt = &ctxt[cpu];
retval = do_dom0_op(xc_handle, &op);
if (retval)
@@ -325,10 +322,8 @@ xc_ptrace(enum __ptrace_request request, u32 domid, long eaddr, long edata)
case PTRACE_ATTACH:
op.cmd = DOM0_GETDOMAININFO;
op.u.getdomaininfo.domain = domid;
op.u.getdomaininfo.exec_domain = 0;
op.u.getdomaininfo.ctxt = NULL;
retval = do_dom0_op(xc_handle, &op);
if (retval) {
if (retval || op.u.getdomaininfo.domain != domid) {
perror("dom0 op failed");
goto error_out;
}
@@ -345,7 +340,7 @@ xc_ptrace(enum __ptrace_request request, u32 domid, long eaddr, long edata)
ctxt[VCPU].user_regs.eflags |= PSL_T;
op.cmd = DOM0_SETDOMAININFO;
op.u.setdomaininfo.domain = domid;
op.u.setdomaininfo.exec_domain = 0;
op.u.setdomaininfo.vcpu = 0;
op.u.setdomaininfo.ctxt = &ctxt[cpu];
retval = do_dom0_op(xc_handle, &op);
if (retval) {
@@ -362,7 +357,7 @@ xc_ptrace(enum __ptrace_request request, u32 domid, long eaddr, long edata)
ctxt[cpu].user_regs.eflags &= ~PSL_T;
op.cmd = DOM0_SETDOMAININFO;
op.u.setdomaininfo.domain = domid;
op.u.setdomaininfo.exec_domain = cpu;
op.u.setdomaininfo.vcpu = cpu;
op.u.setdomaininfo.ctxt = &ctxt[cpu];
retval = do_dom0_op(xc_handle, &op);
if (retval) {
+16 -7
View File
@@ -107,6 +107,7 @@ map_domain_va(unsigned long domfd, int cpu, void * guest_va)
{
unsigned long pde, page;
unsigned long va = (unsigned long)guest_va;
void *v;
static unsigned long cr3_phys[MAX_VIRT_CPUS];
static unsigned long *cr3_virt[MAX_VIRT_CPUS];
@@ -120,13 +121,15 @@ map_domain_va(unsigned long domfd, int cpu, void * guest_va)
cr3_phys[cpu] = cr3[cpu];
if (cr3_virt[cpu])
munmap(cr3_virt[cpu], PAGE_SIZE);
if ((cr3_virt[cpu] = mmap(NULL, PAGE_SIZE, PROT_READ,
MAP_PRIVATE, domfd, map_mtop_offset(cr3_phys[cpu]))) ==
(unsigned long*)0xffffffff)
v = mmap(
NULL, PAGE_SIZE, PROT_READ, MAP_PRIVATE, domfd,
map_mtop_offset(cr3_phys[cpu]));
if (v == MAP_FAILED)
{
perror("mmap failed");
goto error_out;
}
cr3_virt[cpu] = v;
}
if ((pde = cr3_virt[cpu][vtopdi(va)]) == 0) /* logical address */
goto error_out;
@@ -137,9 +140,12 @@ map_domain_va(unsigned long domfd, int cpu, void * guest_va)
pde_phys[cpu] = pde;
if (pde_virt[cpu])
munmap(pde_virt[cpu], PAGE_SIZE);
if ((pde_virt[cpu] = mmap(NULL, PAGE_SIZE, PROT_READ,
MAP_PRIVATE, domfd, map_mtop_offset(pde_phys[cpu]))) == NULL)
v = mmap(
NULL, PAGE_SIZE, PROT_READ, MAP_PRIVATE, domfd,
map_mtop_offset(pde_phys[cpu]));
if (v == MAP_FAILED)
goto error_out;
pde_virt[cpu] = v;
}
if ((page = pde_virt[cpu][vtopti(va)]) == 0) /* logical address */
goto error_out;
@@ -150,12 +156,15 @@ map_domain_va(unsigned long domfd, int cpu, void * guest_va)
page_phys[cpu] = page;
if (page_virt[cpu])
munmap(page_virt[cpu], PAGE_SIZE);
if ((page_virt[cpu] = mmap(NULL, PAGE_SIZE, PROT_READ,
MAP_PRIVATE, domfd, map_mtop_offset(page_phys[cpu]))) == NULL) {
v = mmap(
NULL, PAGE_SIZE, PROT_READ, MAP_PRIVATE, domfd,
map_mtop_offset(page_phys[cpu]));
if (v == MAP_FAILED) {
printf("cr3 %lx pde %lx page %lx pti %lx\n", cr3[cpu], pde, page, vtopti(va));
page_phys[cpu] = 0;
goto error_out;
}
page_virt[cpu] = v;
}
return (void *)(((unsigned long)page_virt[cpu]) | (va & BSD_PAGE_MASK));
+11 -6
View File
@@ -447,7 +447,7 @@ static int setup_guest(int xc_handle,
ctxt->user_regs.esi = vboot_params_start;
ctxt->user_regs.edi = vboot_params_start + 0x2d0;
ctxt->user_regs.eflags = (1<<2);
ctxt->user_regs.eflags = 0;
return 0;
@@ -543,14 +543,19 @@ int xc_vmx_build(int xc_handle,
op.cmd = DOM0_GETDOMAININFO;
op.u.getdomaininfo.domain = (domid_t)domid;
op.u.getdomaininfo.exec_domain = 0;
op.u.getdomaininfo.ctxt = ctxt;
if ( (do_dom0_op(xc_handle, &op) < 0) ||
((u16)op.u.getdomaininfo.domain != domid) )
{
PERROR("Could not get info on domain");
goto error_out;
}
if ( xc_domain_get_vcpu_context(xc_handle, domid, 0, ctxt) )
{
PERROR("Could not get vcpu context");
goto error_out;
}
if ( !(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED) ||
(ctxt->pt_base != 0) )
{
@@ -618,9 +623,9 @@ int xc_vmx_build(int xc_handle,
memset( &launch_op, 0, sizeof(launch_op) );
launch_op.u.setdomaininfo.domain = (domid_t)domid;
launch_op.u.setdomaininfo.exec_domain = 0;
launch_op.u.setdomaininfo.ctxt = ctxt;
launch_op.u.setdomaininfo.domain = (domid_t)domid;
launch_op.u.setdomaininfo.vcpu = 0;
launch_op.u.setdomaininfo.ctxt = ctxt;
launch_op.cmd = DOM0_SETDOMAININFO;
rc = do_dom0_op(xc_handle, &launch_op);
+42 -28
View File
@@ -155,15 +155,16 @@ static PyObject *pyxc_domain_pincpu(PyObject *self,
XcObject *xc = (XcObject *)self;
u32 dom;
int cpu = -1;
int vcpu = 0;
cpumap_t cpumap = 0xFFFFFFFF;
static char *kwd_list[] = { "dom", "cpu", NULL };
static char *kwd_list[] = { "dom", "vcpu", "cpumap", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list,
&dom, &cpu) )
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|ii", kwd_list,
&dom, &vcpu, &cpumap) )
return NULL;
if ( xc_domain_pincpu(xc->xc_handle, dom, cpu) != 0 )
if ( xc_domain_pincpu(xc->xc_handle, dom, vcpu, &cpumap) != 0 )
return PyErr_SetFromErrno(xc_error);
Py_INCREF(zero);
@@ -175,10 +176,10 @@ static PyObject *pyxc_domain_getinfo(PyObject *self,
PyObject *kwds)
{
XcObject *xc = (XcObject *)self;
PyObject *list;
PyObject *list, *vcpu_list, *cpumap_list, *info_dict;
u32 first_dom = 0;
int max_doms = 1024, nr_doms, i;
int max_doms = 1024, nr_doms, i, j;
xc_dominfo_t *info;
static char *kwd_list[] = { "first_dom", "max_doms", NULL };
@@ -195,23 +196,33 @@ static PyObject *pyxc_domain_getinfo(PyObject *self,
list = PyList_New(nr_doms);
for ( i = 0 ; i < nr_doms; i++ )
{
PyList_SetItem(
list, i,
Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i"
",s:l,s:L,s:l,s:i}",
"dom", info[i].domid,
"cpu", info[i].cpu,
"dying", info[i].dying,
"crashed", info[i].crashed,
"shutdown", info[i].shutdown,
"paused", info[i].paused,
"blocked", info[i].blocked,
"running", info[i].running,
"mem_kb", info[i].nr_pages*4,
"cpu_time", info[i].cpu_time,
"maxmem_kb", info[i].max_memkb,
"shutdown_reason", info[i].shutdown_reason
));
vcpu_list = PyList_New(MAX_VIRT_CPUS);
cpumap_list = PyList_New(MAX_VIRT_CPUS);
for ( j = 0; j < MAX_VIRT_CPUS; j++ ) {
PyList_SetItem( vcpu_list, j,
Py_BuildValue("i", info[i].vcpu_to_cpu[j]));
PyList_SetItem( cpumap_list, j,
Py_BuildValue("i", info[i].cpumap[j]));
}
info_dict = Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i"
",s:l,s:L,s:l,s:i}",
"dom", info[i].domid,
"vcpus", info[i].vcpus,
"dying", info[i].dying,
"crashed", info[i].crashed,
"shutdown", info[i].shutdown,
"paused", info[i].paused,
"blocked", info[i].blocked,
"running", info[i].running,
"mem_kb", info[i].nr_pages*4,
"cpu_time", info[i].cpu_time,
"maxmem_kb", info[i].max_memkb,
"shutdown_reason", info[i].shutdown_reason);
PyDict_SetItemString( info_dict, "vcpu_to_cpu", vcpu_list );
PyDict_SetItemString( info_dict, "cpumap", cpumap_list );
PyList_SetItem( list, i, info_dict);
}
free(info);
@@ -959,9 +970,10 @@ static PyMethodDef pyxc_methods[] = {
{ "domain_pincpu",
(PyCFunction)pyxc_domain_pincpu,
METH_VARARGS | METH_KEYWORDS, "\n"
"Pin a domain to a specified CPU.\n"
" dom [int]: Identifier of domain to be pinned.\n"
" cpu [int, -1]: CPU to pin to, or -1 to unpin\n\n"
"Pin a VCPU to a specified set CPUs.\n"
" dom [int]: Identifier of domain to which VCPU belongs.\n"
" vcpu [int, 0]: VCPU being pinned.\n"
" cpumap [int, -1]: Bitmap of usable CPUs.\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "domain_getinfo",
@@ -976,6 +988,7 @@ static PyMethodDef pyxc_methods[] = {
" domain-id space was reached.\n"
" dom [int]: Identifier of domain to which this info pertains\n"
" cpu [int]: CPU to which this domain is bound\n"
" vcpus [int]: Number of Virtual CPUS in this domain\n"
" dying [int]: Bool - is the domain dying?\n"
" crashed [int]: Bool - has the domain crashed?\n"
" shutdown [int]: Bool - has the domain shut itself down?\n"
@@ -986,7 +999,8 @@ static PyMethodDef pyxc_methods[] = {
" maxmem_kb [int]: Maximum memory limit, in kilobytes\n"
" cpu_time [long]: CPU time consumed, in nanoseconds\n"
" shutdown_reason [int]: Numeric code from guest OS, explaining "
"reason why it shut itself down.\n" },
"reason why it shut itself down.\n"
" vcpu_to_cpu [[int]]: List that maps VCPUS to CPUS\n" },
{ "linux_save",
(PyCFunction)pyxc_linux_save,
+3 -2
View File
@@ -236,10 +236,11 @@ class Xend:
'live' : live,
'resource' : resource })
def xend_domain_pincpu(self, id, cpu):
def xend_domain_pincpu(self, id, vcpu, cpumap):
return self.xendPost(self.domainurl(id),
{'op' : 'pincpu',
'cpu' : cpu })
'vcpu' : vcpu,
'cpumap' : cpumap })
def xend_domain_cpu_bvt_set(self, id, mcuadv, warpback, warpvalue, warpl, warpu):
return self.xendPost(self.domainurl(id),
+6 -5
View File
@@ -675,15 +675,16 @@ class XendDomain:
xmigrate = XendMigrate.instance()
return xmigrate.save_begin(dominfo, dst)
def domain_pincpu(self, id, cpu):
"""Pin a domain to a cpu.
def domain_pincpu(self, id, vcpu, cpumap):
"""Set which cpus vcpu can use
@param id: domain
@param cpu: cpu number
@param id: domain
@param vcpu: vcpu number
@param cpumap: bitmap of usbale cpus
"""
dominfo = self.domain_lookup(id)
try:
return xc.domain_pincpu(int(dominfo.id), cpu)
return xc.domain_pincpu(int(dominfo.id), vcpu, cpumap)
except Exception, ex:
raise XendError(str(ex))
+7 -2
View File
@@ -419,8 +419,12 @@ class XendDomainInfo:
if self.info['shutdown']:
reason = shutdown_reason(self.info['shutdown_reason'])
sxpr.append(['shutdown_reason', reason])
sxpr.append(['cpu', self.info['cpu']])
sxpr.append(['cpu', self.info['vcpu_to_cpu'][0]])
sxpr.append(['cpu_time', self.info['cpu_time']/1e9])
sxpr.append(['vcpus', self.info['vcpus']])
sxpr.append(['cpumap', self.info['cpumap']])
sxpr.append(['vcpu_to_cpu', ''.join(map(lambda x: str(x),
self.info['vcpu_to_cpu'][0:self.info['vcpus']]))])
if self.start_time:
up_time = time.time() - self.start_time
@@ -529,7 +533,8 @@ class XendDomainInfo:
raise VmError('missing memory size')
cpu = sxp.child_value(config, 'cpu')
if self.recreate and self.dom and cpu is not None:
xc.domain_pincpu(self.dom, int(cpu))
#xc.domain_pincpu(self.dom, int(cpu))
xc.domain_pincpu(self.dom, 0, 1<<int(cpu))
try:
image = sxp.child_value(self.config, 'image')
vcpus = sxp.child_value(image, 'vcpus')
+2 -1
View File
@@ -88,7 +88,8 @@ class SrvDomain(SrvDir):
def op_pincpu(self, op, req):
fn = FormFn(self.xd.domain_pincpu,
[['dom', 'str'],
['cpu', 'int']])
['vcpu', 'int'],
['cpumap', 'int']])
val = fn(req.args, {'dom': self.dom.id})
return val
+56 -11
View File
@@ -6,6 +6,8 @@ import os.path
import sys
from getopt import getopt
import socket
import warnings
warnings.filterwarnings('ignore', category=FutureWarning)
from xen.xend import PrettyPrint
from xen.xend import sxp
@@ -340,8 +342,8 @@ class ProgList(Prog):
name = "list"
info = """List information about domains."""
short_options = 'l'
long_options = ['long']
short_options = 'lv'
long_options = ['long','vcpus']
def help(self, args):
if help:
@@ -350,11 +352,13 @@ class ProgList(Prog):
Either all domains or the domains given.
-l, --long Get more detailed information.
-v, --vcpus Show VCPU to CPU mapping.
"""
return
def main(self, args):
use_long = 0
show_vcpus = 0
(options, params) = getopt(args[1:],
self.short_options,
self.long_options)
@@ -362,6 +366,8 @@ class ProgList(Prog):
for (k, v) in options:
if k in ['-l', '--long']:
use_long = 1
if k in ['-v', '--vcpus']:
show_vcpus = 1
if n == 0:
doms = server.xend_domains()
@@ -371,11 +377,13 @@ class ProgList(Prog):
if use_long:
self.long_list(doms)
elif show_vcpus:
self.show_vcpus(doms)
else:
self.brief_list(doms)
def brief_list(self, doms):
print 'Name Id Mem(MB) CPU State Time(s) Console'
print 'Name Id Mem(MB) CPU VCPU(s) State Time(s) Console'
for dom in doms:
info = server.xend_domain(dom)
d = {}
@@ -383,6 +391,7 @@ class ProgList(Prog):
d['name'] = sxp.child_value(info, 'name', '??')
d['mem'] = int(sxp.child_value(info, 'memory', '0'))
d['cpu'] = int(sxp.child_value(info, 'cpu', '0'))
d['vcpus'] = int(sxp.child_value(info, 'vcpus', '0'))
d['state'] = sxp.child_value(info, 'state', '??')
d['cpu_time'] = float(sxp.child_value(info, 'cpu_time', '0'))
console = sxp.child(info, 'console')
@@ -390,9 +399,27 @@ class ProgList(Prog):
d['port'] = sxp.child_value(console, 'console_port')
else:
d['port'] = ''
print ("%(name)-16s %(dom)3d %(mem)7d %(cpu)3d %(state)5s %(cpu_time)7.1f %(port)4s"
print ("%(name)-16s %(dom)3d %(mem)7d %(cpu)3d %(vcpus)5d %(state)5s %(cpu_time)7.1f %(port)4s"
% d)
def show_vcpus(self, doms):
print 'Name Id VCPU CPU CPUMAP'
for dom in doms:
info = server.xend_domain(dom)
vcpu_to_cpu = sxp.child_value(info, 'vcpu_to_cpu', '?').replace('-','')
cpumap = sxp.child_value(info, 'cpumap', [])
mask = ((int(sxp.child_value(info, 'vcpus', '0')))**2) - 1
count = 0
for cpu in vcpu_to_cpu:
d = {}
d['name'] = sxp.child_value(info, 'name', '??')
d['dom'] = int(sxp.child_value(info, 'id', '-1'))
d['vcpu'] = int(count)
d['cpu'] = int(cpu)
d['cpumap'] = int(cpumap[count])&mask
count = count + 1
print ("%(name)-16s %(dom)3d %(vcpu)4d %(cpu)3d 0x%(cpumap)x" % d)
def long_list(self, doms):
for dom in doms:
info = server.xend_domain(dom)
@@ -474,17 +501,35 @@ xm.prog(ProgUnpause)
class ProgPincpu(Prog):
group = 'domain'
name = "pincpu"
info = """Pin a domain to a cpu. """
info = """Set which cpus a VCPU can use. """
def help(self, args):
print args[0],'DOM CPU'
print '\nPin domain DOM to cpu CPU.'
print args[0],'DOM VCPU CPUS'
print '\nSet which cpus VCPU in domain DOM can use.'
# convert list of cpus to bitmap integer value
def make_map(self, cpulist):
cpus = []
cpumap = 0
for c in cpulist.split(','):
if len(c) > 1:
(x,y) = c.split('-')
for i in range(int(x),int(y)+1):
cpus.append(int(i))
else:
cpus.append(int(c))
cpus.sort()
for c in cpus:
cpumap = cpumap | 1<<c
return cpumap
def main(self, args):
if len(args) != 3: self.err("%s: Invalid argument(s)" % args[0])
dom = args[1]
cpu = int(args[2])
server.xend_domain_pincpu(dom, cpu)
if len(args) != 4: self.err("%s: Invalid argument(s)" % args[0])
dom = args[1]
vcpu = int(args[2])
cpumap = self.make_map(args[3]);
server.xend_domain_pincpu(dom, vcpu, cpumap)
xm.prog(ProgPincpu)
+9 -9
View File
@@ -626,7 +626,7 @@ int construct_dom0(struct domain *d,
#ifndef CLONE_DOMAIN0
if ( d != dom0 )
BUG();
if ( test_bit(DF_CONSTRUCTED, &d->flags) )
if ( test_bit(_DOMF_constructed, &d->domain_flags) )
BUG();
#endif
@@ -753,7 +753,7 @@ int construct_dom0(struct domain *d,
#endif
console_endboot(strstr(cmdline, "tty0") != NULL);
set_bit(DF_CONSTRUCTED, &d->flags);
set_bit(_DOMF_constructed, &d->domain_flags);
new_thread(ed, pkern_entry, 0, 0);
// FIXME: Hack for keyboard input
@@ -783,10 +783,10 @@ int construct_domU(struct domain *d,
unsigned long pkern_entry;
#ifndef DOMU_AUTO_RESTART
if ( test_bit(DF_CONSTRUCTED, &d->flags) ) BUG();
if ( test_bit(_DOMF_constructed, &d->domain_flags) ) BUG();
#endif
printk("*** LOADING DOMAIN %d ***\n",d->id);
printk("*** LOADING DOMAIN %d ***\n",d->domain_id);
d->max_pages = dom0_size/PAGE_SIZE; // FIXME: use dom0 size
// FIXME: use domain0 command line
@@ -796,13 +796,13 @@ int construct_domU(struct domain *d,
d->arch.mm = xmalloc(struct mm_struct);
if (unlikely(!d->arch.mm)) {
printk("Can't allocate mm_struct for domain %d\n",d->id);
printk("Can't allocate mm_struct for domain %d\n",d->domain_id);
return -ENOMEM;
}
memset(d->arch.mm, 0, sizeof(*d->arch.mm));
d->arch.mm->pgd = pgd_alloc(d->arch.mm);
if (unlikely(!d->arch.mm->pgd)) {
printk("Can't allocate pgd for domain %d\n",d->id);
printk("Can't allocate pgd for domain %d\n",d->domain_id);
return -ENOMEM;
}
@@ -816,7 +816,7 @@ int construct_domU(struct domain *d,
loaddomainelfimage(d,image_start);
printk("loaddomainelfimage returns\n");
set_bit(DF_CONSTRUCTED, &d->flags);
set_bit(_DOMF_constructed, &d->domain_flags);
printk("calling new_thread, entry=%p\n",pkern_entry);
#ifdef DOMU_AUTO_RESTART
@@ -836,7 +836,7 @@ void reconstruct_domU(struct exec_domain *ed)
{
/* re-copy the OS image to reset data values to original */
printk("reconstruct_domU: restarting domain %d...\n",
ed->domain->id);
ed->domain->domain_id);
loaddomainelfimage(ed->domain,ed->domain->arch.image_start);
new_thread(ed, ed->domain->arch.entry, 0, 0);
}
@@ -859,7 +859,7 @@ int launch_domainU(unsigned long size)
else next++;
if (construct_domU(d, (unsigned long)domU_staging_area, size,0,0,0)) {
printf("launch_domainU: couldn't construct(id=%d,%lx,%lx)\n",
d->id,domU_staging_area,size);
d->domain_id,domU_staging_area,size);
return 2;
}
domain_unpause_by_systemcontroller(d);
+2 -2
View File
@@ -21,8 +21,8 @@
#define IDLE0_DOMAIN(_t) \
{ \
id: IDLE_DOMAIN_ID, \
flags: 1<<DF_IDLETASK, \
domain_id: IDLE_DOMAIN_ID, \
domain_flags:DOMF_idle_domain, \
refcnt: ATOMIC_INIT(1) \
}
+2 -2
View File
@@ -35,8 +35,8 @@
+#define INIT_TASK(tsk) \
+{ \
+ /*processor: 0,*/ \
+ /*id: IDLE_DOMAIN_ID,*/ \
+ /*flags: 1<<DF_IDLETASK,*/ \
+ /*domain_id: IDLE_DOMAIN_ID,*/ \
+ /*domain_flags: DOMF_idle_domain,*/ \
+ refcnt: ATOMIC_INIT(1) \
+}
+#else
+1 -1
View File
@@ -214,7 +214,7 @@ void deliver_pending_interrupt(struct pt_regs *regs)
if (vcpu_deliverable_interrupts(ed)) {
unsigned long isr = regs->cr_ipsr & IA64_PSR_RI;
if (vcpu_timer_pending_early(ed))
printf("*#*#*#* about to deliver early timer to domain %d!!!\n",ed->domain->id);
printf("*#*#*#* about to deliver early timer to domain %d!!!\n",ed->domain->domain_id);
reflect_interruption(0,isr,0,regs,IA64_EXTINT_VECTOR);
}
}
+9 -9
View File
@@ -234,21 +234,21 @@ void context_switch(struct exec_domain *prev, struct exec_domain *next)
{
//printk("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
//printk("@@@@@@ context switch from domain %d (%x) to domain %d (%x)\n",
//prev->domain->id,(long)prev&0xffffff,next->domain->id,(long)next&0xffffff);
//if (prev->domain->id == 1 && next->domain->id == 0) cs10foo();
//if (prev->domain->id == 0 && next->domain->id == 1) cs01foo();
//printk("@@sw %d->%d\n",prev->domain->id,next->domain->id);
//prev->domain->domain_id,(long)prev&0xffffff,next->domain->domain_id,(long)next&0xffffff);
//if (prev->domain->domain_id == 1 && next->domain->domain_id == 0) cs10foo();
//if (prev->domain->domain_id == 0 && next->domain->domain_id == 1) cs01foo();
//printk("@@sw %d->%d\n",prev->domain->domain_id,next->domain->domain_id);
switch_to(prev,next,prev);
// leave this debug for now: it acts as a heartbeat when more than
// one domain is active
{
static long cnt[16] = { 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50};
static int i = 100;
int id = ((struct exec_domain *)current)->domain->id & 0xf;
int id = ((struct exec_domain *)current)->domain->domain_id & 0xf;
if (!cnt[id]--) { printk("%x",id); cnt[id] = 50; }
if (!i--) { printk("+",id); cnt[id] = 100; }
}
clear_bit(EDF_RUNNING, &prev->flags);
clear_bit(_VCPUF_running, &prev->vcpu_flags);
//if (!is_idle_task(next->domain) )
//send_guest_virq(next, VIRQ_TIMER);
load_region_regs(current);
@@ -271,15 +271,15 @@ void panic_domain(struct pt_regs *regs, const char *fmt, ...)
loop:
printf("$$$$$ PANIC in domain %d (k6=%p): ",
ed->domain->id, ia64_get_kr(IA64_KR_CURRENT));
ed->domain->domain_id, ia64_get_kr(IA64_KR_CURRENT));
va_start(args, fmt);
(void)vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
printf(buf);
if (regs) show_registers(regs);
domain_pause_by_systemcontroller(current->domain);
set_bit(DF_CRASHED, ed->domain->flags);
if (ed->domain->id == 0) {
set_bit(_DOMF_crashed, ed->domain->domain_flags);
if (ed->domain->domain_id == 0) {
int i = 1000000000L;
// if domain0 crashes, just periodically print out panic
// message to make post-mortem easier
+1 -6
View File
@@ -52,15 +52,10 @@ unsigned char opt_com1[30] = "", opt_com2[30] = "";
unsigned int opt_dom0_mem = 16000;
/* opt_noht: If true, Hyperthreading is ignored. */
int opt_noht=0;
/* opt_noacpi: If true, ACPI tables are not parsed. */
int opt_noacpi=0;
/* opt_nosmp: If true, secondary processors are ignored. */
int opt_nosmp=0;
/* opt_noreboot: If true, machine will need manual reset on error. */
int opt_noreboot=0;
/* opt_ignorebiostables: If true, ACPI and MP tables are ignored. */
/* NB. This flag implies 'nosmp' and 'noacpi'. */
int opt_ignorebiostables=0;
/* opt_watchdog: If true, run a watchdog NMI on each processor. */
int opt_watchdog=0;
/* opt_pdb: Name of serial port for Xen pervasive debugger (and enable pdb) */
@@ -267,7 +262,7 @@ printk("About to call init_idle_task()\n");
if ( dom0 == NULL )
panic("Error creating domain 0\n");
set_bit(DF_PRIVILEGED, &dom0->flags);
set_bit(_DOMF_privileged, &dom0->domain_flags);
/*
* We're going to setup domain0 using the module(s) that we stashed safely
+2 -15
View File
@@ -36,26 +36,13 @@
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/mpspec.h>
#include <mach_apic.h>
#include <mach_mpparse.h>
int sbf_port;
#define end_pfn_map max_page
#define CONFIG_ACPI_PCI
#ifdef CONFIG_X86_64
static inline void acpi_madt_oem_check(char *oem_id, char *oem_table_id) { }
extern void __init clustered_apic_check(void);
static inline int ioapic_setup_disabled(void) { return 0; }
#else /* X86 */
#ifdef CONFIG_X86_LOCAL_APIC
#include <mach_apic.h>
#include <mach_mpparse.h>
#endif /* CONFIG_X86_LOCAL_APIC */
#endif /* X86 */
#define BAD_MADT_ENTRY(entry, end) ( \
(!entry) || (unsigned long)entry + sizeof(*entry) > end || \
((acpi_table_entry_header *)entry)->length != sizeof(*entry))
+29 -29
View File
@@ -74,7 +74,7 @@ int audit_adjust_pgtables(struct domain *d, int dir, int noisy)
{
APRINTK("Audit %d: type count went below zero "
"mfn=%lx t=%x ot=%x",
d->id, page_to_pfn(page),
d->domain_id, page_to_pfn(page),
page->u.inuse.type_info,
page->tlbflush_timestamp);
errors++;
@@ -83,7 +83,7 @@ int audit_adjust_pgtables(struct domain *d, int dir, int noisy)
{
APRINTK("Audit %d: type count overflowed "
"mfn=%lx t=%x ot=%x",
d->id, page_to_pfn(page),
d->domain_id, page_to_pfn(page),
page->u.inuse.type_info,
page->tlbflush_timestamp);
errors++;
@@ -102,7 +102,7 @@ int audit_adjust_pgtables(struct domain *d, int dir, int noisy)
{
APRINTK("Audit %d: general count went below zero "
"mfn=%lx t=%x ot=%x",
d->id, page_to_pfn(page),
d->domain_id, page_to_pfn(page),
page->u.inuse.type_info,
page->tlbflush_timestamp);
errors++;
@@ -111,7 +111,7 @@ int audit_adjust_pgtables(struct domain *d, int dir, int noisy)
{
APRINTK("Audit %d: general count overflowed "
"mfn=%lx t=%x ot=%x",
d->id, page_to_pfn(page),
d->domain_id, page_to_pfn(page),
page->u.inuse.type_info,
page->tlbflush_timestamp);
errors++;
@@ -142,7 +142,7 @@ int audit_adjust_pgtables(struct domain *d, int dir, int noisy)
"belonging to a domain %p (id=%d)\n",
l1mfn,
page_get_owner(l1page),
page_get_owner(l1page)->id);
page_get_owner(l1page)->domain_id);
errors++;
continue;
}
@@ -153,7 +153,7 @@ int audit_adjust_pgtables(struct domain *d, int dir, int noisy)
{
printk("Audit %d: [Shadow L2 mfn=%lx i=%x] "
"Expected Shadow L1 t=%x mfn=%lx\n",
d->id, mfn, i,
d->domain_id, mfn, i,
l1page->u.inuse.type_info, l1mfn);
errors++;
}
@@ -167,7 +167,7 @@ int audit_adjust_pgtables(struct domain *d, int dir, int noisy)
l1mfn,
page_get_owner(l1page),
(page_get_owner(l1page)
? page_get_owner(l1page)->id
? page_get_owner(l1page)->domain_id
: -1));
errors++;
continue;
@@ -179,14 +179,14 @@ int audit_adjust_pgtables(struct domain *d, int dir, int noisy)
{
printk("Audit %d: [%x] Found %s Linear PT "
"t=%x mfn=%lx\n",
d->id, i, (l1mfn==mfn) ? "Self" : "Other",
d->domain_id, i, (l1mfn==mfn) ? "Self" : "Other",
l1page->u.inuse.type_info, l1mfn);
}
else if ( page_type != PGT_l1_page_table )
{
printk("Audit %d: [L2 mfn=%lx i=%x] "
"Expected L1 t=%x mfn=%lx\n",
d->id, mfn, i,
d->domain_id, mfn, i,
l1page->u.inuse.type_info, l1mfn);
errors++;
}
@@ -238,9 +238,9 @@ int audit_adjust_pgtables(struct domain *d, int dir, int noisy)
{
printk("Audit %d: [hl2mfn=%lx,i=%x] Skip foreign page "
"dom=%p (id=%d) mfn=%lx c=%08x t=%08x\n",
d->id, hl2mfn, i,
d->domain_id, hl2mfn, i,
page_get_owner(gpage),
page_get_owner(gpage)->id,
page_get_owner(gpage)->domain_id,
gmfn,
gpage->count_info,
gpage->u.inuse.type_info);
@@ -289,7 +289,7 @@ int audit_adjust_pgtables(struct domain *d, int dir, int noisy)
{
printk("Audit %d: [l1mfn=%lx, i=%x] Illegal RW "
"t=%x mfn=%lx\n",
d->id, l1mfn, i,
d->domain_id, l1mfn, i,
gpage->u.inuse.type_info, gmfn);
errors++;
}
@@ -300,7 +300,7 @@ int audit_adjust_pgtables(struct domain *d, int dir, int noisy)
{
printk("Audit %d: [l1mfn=%lx, i=%x] Illegal RW of "
"page table gmfn=%lx\n",
d->id, l1mfn, i, gmfn);
d->domain_id, l1mfn, i, gmfn);
errors++;
}
}
@@ -309,9 +309,9 @@ int audit_adjust_pgtables(struct domain *d, int dir, int noisy)
{
printk("Audit %d: [l1mfn=%lx,i=%x] Skip foreign page "
"dom=%p (id=%d) mfn=%lx c=%08x t=%08x\n",
d->id, l1mfn, i,
d->domain_id, l1mfn, i,
page_get_owner(gpage),
page_get_owner(gpage)->id,
page_get_owner(gpage)->domain_id,
gmfn,
gpage->count_info,
gpage->u.inuse.type_info);
@@ -455,7 +455,7 @@ int audit_adjust_pgtables(struct domain *d, int dir, int noisy)
{
printk("Audit %d: found an L2 guest page "
"mfn=%lx t=%08x c=%08x while in shadow mode\n",
d->id, mfn, page->u.inuse.type_info,
d->domain_id, mfn, page->u.inuse.type_info,
page->count_info);
errors++;
}
@@ -466,14 +466,14 @@ int audit_adjust_pgtables(struct domain *d, int dir, int noisy)
PGT_validated )
{
printk("Audit %d: L2 mfn=%lx not validated %08x\n",
d->id, mfn, page->u.inuse.type_info);
d->domain_id, mfn, page->u.inuse.type_info);
errors++;
}
if ( (page->u.inuse.type_info & PGT_pinned) != PGT_pinned )
{
printk("Audit %d: L2 mfn=%lx not pinned t=%08x\n",
d->id, mfn, page->u.inuse.type_info);
d->domain_id, mfn, page->u.inuse.type_info);
errors++;
}
}
@@ -506,7 +506,7 @@ int audit_adjust_pgtables(struct domain *d, int dir, int noisy)
PGT_validated )
{
printk("Audit %d: L1 not validated mfn=%lx t=%08x\n",
d->id, mfn, page->u.inuse.type_info);
d->domain_id, mfn, page->u.inuse.type_info);
errors++;
}
@@ -515,7 +515,7 @@ int audit_adjust_pgtables(struct domain *d, int dir, int noisy)
if ( !VM_ASSIST(d, VMASST_TYPE_writable_pagetables) )
{
printk("Audit %d: L1 mfn=%lx not pinned t=%08x\n",
d->id, mfn, page->u.inuse.type_info);
d->domain_id, mfn, page->u.inuse.type_info);
}
}
}
@@ -601,7 +601,7 @@ void audit_pagelist(struct domain *d)
if ( xenpages != d->xenheap_pages ||
totpages != d->tot_pages )
{
printk("ARGH! dom %d: xen=%d %d, pages=%d %d\n", d->id,
printk("ARGH! dom %d: xen=%d %d, pages=%d %d\n", d->domain_id,
xenpages, d->xenheap_pages,
totpages, d->tot_pages );
}
@@ -623,7 +623,7 @@ void _audit_domain(struct domain *d, int flags)
if ( (pt[i] & _PAGE_PRESENT) && ((pt[i] >> PAGE_SHIFT) == xmfn) )
printk(" found dom=%d mfn=%lx t=%08x c=%08x "
"pt[i=%x]=%lx\n",
d->id, mfn, page->u.inuse.type_info,
d->domain_id, mfn, page->u.inuse.type_info,
page->count_info, i, pt[i]);
}
@@ -721,7 +721,7 @@ void _audit_domain(struct domain *d, int flags)
{
printk("skipping audit domain of translated domain %d "
"from other context\n",
d->id);
d->domain_id);
return;
}
@@ -832,7 +832,7 @@ void _audit_domain(struct domain *d, int flags)
if ( !(flags & AUDIT_QUIET) &&
((io_mappings > 0) || (lowmem_mappings > 0)) )
printk("Audit %d: Found %d lowmem mappings and %d io mappings\n",
d->id, lowmem_mappings, io_mappings);
d->domain_id, lowmem_mappings, io_mappings);
/* PHASE 2 */
@@ -849,7 +849,7 @@ void _audit_domain(struct domain *d, int flags)
if ( (page->u.inuse.type_info & PGT_count_mask) != 0 )
{
printk("Audit %d: type count!=0 t=%x ot=%x c=%x mfn=%lx\n",
d->id, page->u.inuse.type_info,
d->domain_id, page->u.inuse.type_info,
page->tlbflush_timestamp,
page->count_info, mfn);
errors++;
@@ -863,7 +863,7 @@ void _audit_domain(struct domain *d, int flags)
if ( (page->u.inuse.type_info & PGT_count_mask) != 0 )
{
printk("Audit %d: type count!=0 t=%x ot=%x c=%x mfn=%lx\n",
d->id, page->u.inuse.type_info,
d->domain_id, page->u.inuse.type_info,
page->tlbflush_timestamp,
page->count_info, mfn);
//errors++;
@@ -876,7 +876,7 @@ void _audit_domain(struct domain *d, int flags)
if ( (page->count_info & PGC_count_mask) != 1 )
{
printk("Audit %d: gen count!=1 (c=%x) t=%x ot=%x mfn=%lx\n",
d->id,
d->domain_id,
page->count_info,
page->u.inuse.type_info,
page->tlbflush_timestamp, mfn );
@@ -912,7 +912,7 @@ void _audit_domain(struct domain *d, int flags)
{
printk("Audit %d: shadow page counts wrong "
"mfn=%lx t=%08x c=%08x\n",
d->id, page_to_pfn(page),
d->domain_id, page_to_pfn(page),
page->u.inuse.type_info,
page->count_info);
printk("a->gpfn_and_flags=%p\n",
@@ -950,7 +950,7 @@ void _audit_domain(struct domain *d, int flags)
if ( !(flags & AUDIT_QUIET) )
printk("Audit dom%d Done. "
"pages=%d oos=%d l1=%d l2=%d ctot=%d ttot=%d\n",
d->id, page_count, oos_count, l1, l2, ctot, ttot);
d->domain_id, page_count, oos_count, l1, l2, ctot, ttot);
if ( !(flags & AUDIT_SHADOW_ALREADY_LOCKED) )
shadow_unlock(d);
+3 -1
View File
@@ -12,7 +12,9 @@
#include <asm/irq.h>
#include <xen/spinlock.h>
#include <asm/debugger.h>
#include <asm/init.h>
#include <xen/init.h>
#include <xen/smp.h>
#include <asm/apic.h>
/* Printk isn't particularly safe just after we've trapped to the
debugger. so avoid it. */
+1 -1
View File
@@ -397,7 +397,7 @@ void arch_getdomaininfo_ctxt(
#endif
c->flags = 0;
if ( test_bit(EDF_DONEFPUINIT, &ed->flags) )
if ( test_bit(_VCPUF_fpu_initialised, &ed->vcpu_flags) )
c->flags |= VGCF_I387_VALID;
if ( KERNEL_MODE(ed, &ed->arch.guest_context.user_regs) )
c->flags |= VGCF_IN_KERNEL;
+19 -16
View File
@@ -100,7 +100,7 @@ void startup_cpu_idle_loop(void)
struct exec_domain *ed = current;
/* Just some sanity to ensure that the scheduler is set up okay. */
ASSERT(ed->domain->id == IDLE_DOMAIN_ID);
ASSERT(ed->domain->domain_id == IDLE_DOMAIN_ID);
percpu_ctxt[smp_processor_id()].curr_ed = ed;
set_bit(smp_processor_id(), &ed->domain->cpuset);
domain_unpause_by_systemcontroller(ed->domain);
@@ -246,13 +246,14 @@ void arch_do_createdomain(struct exec_domain *ed)
ed->arch.flags = TF_kernel_mode;
if ( d->id != IDLE_DOMAIN_ID )
if ( d->domain_id != IDLE_DOMAIN_ID )
{
ed->arch.schedule_tail = continue_nonidle_task;
d->shared_info = (void *)alloc_xenheap_page();
memset(d->shared_info, 0, PAGE_SIZE);
ed->vcpu_info = &d->shared_info->vcpu_data[ed->id];
ed->vcpu_info = &d->shared_info->vcpu_data[ed->vcpu_id];
ed->cpumap = CPUMAP_RUNANYWHERE;
SHARE_PFN_WITH_DOMAIN(virt_to_page(d->shared_info), d);
machine_to_phys_mapping[virt_to_phys(d->shared_info) >>
PAGE_SHIFT] = INVALID_M2P_ENTRY;
@@ -294,7 +295,7 @@ void arch_do_boot_vcpu(struct exec_domain *ed)
struct domain *d = ed->domain;
ed->arch.schedule_tail = d->exec_domain[0]->arch.schedule_tail;
ed->arch.perdomain_ptes =
d->arch.mm_perdomain_pt + (ed->id << PDPT_VCPU_SHIFT);
d->arch.mm_perdomain_pt + (ed->vcpu_id << PDPT_VCPU_SHIFT);
ed->arch.flags = TF_kernel_mode;
}
@@ -398,9 +399,9 @@ int arch_set_info_guest(
return -EINVAL;
}
clear_bit(EDF_DONEFPUINIT, &ed->flags);
clear_bit(_VCPUF_fpu_initialised, &ed->vcpu_flags);
if ( c->flags & VGCF_I387_VALID )
set_bit(EDF_DONEFPUINIT, &ed->flags);
set_bit(_VCPUF_fpu_initialised, &ed->vcpu_flags);
ed->arch.flags &= ~TF_kernel_mode;
if ( c->flags & VGCF_IN_KERNEL )
@@ -408,15 +409,17 @@ int arch_set_info_guest(
memcpy(&ed->arch.guest_context, c, sizeof(*c));
/* IOPL privileges are virtualised. */
ed->arch.iopl = (ed->arch.guest_context.user_regs.eflags >> 12) & 3;
ed->arch.guest_context.user_regs.eflags &= ~EF_IOPL;
if ( !(c->flags & VGCF_VMX_GUEST) )
{
/* IOPL privileges are virtualised. */
ed->arch.iopl = (ed->arch.guest_context.user_regs.eflags >> 12) & 3;
ed->arch.guest_context.user_regs.eflags &= ~EF_IOPL;
/* Clear IOPL for unprivileged domains. */
if ( !IS_PRIV(d) )
ed->arch.guest_context.user_regs.eflags &= 0xffffcfff;
/* Ensure real hardware interrupts are enabled. */
ed->arch.guest_context.user_regs.eflags |= EF_IE;
}
if ( test_bit(EDF_DONEINIT, &ed->flags) )
if ( test_bit(_VCPUF_initialised, &ed->vcpu_flags) )
return 0;
if ( (rc = (int)set_fast_trap(ed, c->fast_trap_idx)) != 0 )
@@ -427,7 +430,7 @@ int arch_set_info_guest(
for ( i = 0; i < 8; i++ )
(void)set_debugreg(ed, i, c->debugreg[i]);
if ( ed->id == 0 )
if ( ed->vcpu_id == 0 )
d->vm_assist = c->vm_assist;
phys_basetab = c->pt_base;
@@ -479,7 +482,7 @@ int arch_set_info_guest(
update_pagetables(ed);
/* Don't redo final setup */
set_bit(EDF_DONEINIT, &ed->flags);
set_bit(_VCPUF_initialised, &ed->vcpu_flags);
return 0;
}
@@ -797,7 +800,7 @@ void context_switch(struct exec_domain *prev, struct exec_domain *next)
* 'prev' (after this point, a dying domain's info structure may be freed
* without warning).
*/
clear_bit(EDF_RUNNING, &prev->flags);
clear_bit(_VCPUF_running, &prev->vcpu_flags);
schedule_tail(next);
BUG();
+16 -6
View File
@@ -7,6 +7,7 @@
#include <xen/config.h>
#include <xen/init.h>
#include <xen/lib.h>
#include <xen/ctype.h>
#include <xen/sched.h>
#include <xen/smp.h>
#include <xen/delay.h>
@@ -21,9 +22,18 @@
#include <asm/i387.h>
#include <asm/shadow.h>
/* opt_dom0_mem: Kilobytes of memory allocated to domain 0. */
static unsigned int opt_dom0_mem = 0;
integer_unit_param("dom0_mem", opt_dom0_mem);
/* opt_dom0_mem: memory allocated to domain 0. */
static unsigned int opt_dom0_mem;
static void parse_dom0_mem(char *s)
{
unsigned long long bytes = memparse(s);
/* If no unit is specified we default to kB units, not bytes. */
if ( isdigit(s[strlen(s)-1]) )
opt_dom0_mem = (unsigned int)bytes;
else
opt_dom0_mem = (unsigned int)(bytes >> 10);
}
custom_param("dom0_mem", parse_dom0_mem);
static unsigned int opt_dom0_shadow = 0;
boolean_param("dom0_shadow", opt_dom0_shadow);
@@ -112,9 +122,9 @@ int construct_dom0(struct domain *d,
extern void translate_l2pgtable(struct domain *d, l1_pgentry_t *p2m, unsigned long l2mfn);
/* Sanity! */
if ( d->id != 0 )
if ( d->domain_id != 0 )
BUG();
if ( test_bit(DF_CONSTRUCTED, &d->flags) )
if ( test_bit(_DOMF_constructed, &d->domain_flags) )
BUG();
memset(&dsi, 0, sizeof(struct domain_setup_info));
@@ -540,7 +550,7 @@ int construct_dom0(struct domain *d,
/* DOM0 gets access to everything. */
physdev_init_dom0(d);
set_bit(DF_CONSTRUCTED, &d->flags);
set_bit(_DOMF_constructed, &d->domain_flags);
new_thread(ed, dsi.v_kernentry, vstack_end, vstartinfo_start);
+31
View File
@@ -3,6 +3,11 @@
#include <xen/lib.h>
#include <asm/e820.h>
/* opt_mem: Limit of physical RAM. Any RAM beyond this point is ignored. */
unsigned long long opt_mem;
static void parse_mem(char *s) { opt_mem = memparse(s); }
custom_param("mem", parse_mem);
struct e820map e820;
static void __init add_memory_region(unsigned long long start,
@@ -341,6 +346,31 @@ static void __init clip_4gb(void)
#define clip_4gb() ((void)0)
#endif
static void __init clip_mem(void)
{
int i;
if ( !opt_mem )
return;
for ( i = 0; i < e820.nr_map; i++ )
{
if ( (e820.map[i].addr + e820.map[i].size) <= opt_mem )
continue;
printk("Truncating memory map to %lukB\n",
(unsigned long)(opt_mem >> 10));
if ( e820.map[i].addr >= opt_mem )
{
e820.nr_map = i;
}
else
{
e820.map[i].size = opt_mem - e820.map[i].addr;
e820.nr_map = i + 1;
}
}
}
static void __init machine_specific_memory_setup(
struct e820entry *raw, int raw_nr)
{
@@ -348,6 +378,7 @@ static void __init machine_specific_memory_setup(
sanitize_e820_map(raw, &nr);
(void)copy_e820_map(raw, nr);
clip_4gb();
clip_mem();
}
unsigned long __init init_e820(struct e820entry *raw, int raw_nr)
+3 -3
View File
@@ -18,7 +18,7 @@ void init_fpu(void)
__asm__ __volatile__ ( "fninit" );
if ( cpu_has_xmm )
load_mxcsr(0x1f80);
set_bit(EDF_DONEFPUINIT, &current->flags);
set_bit(_VCPUF_fpu_initialised, &current->vcpu_flags);
}
void save_init_fpu(struct exec_domain *tsk)
@@ -28,7 +28,7 @@ void save_init_fpu(struct exec_domain *tsk)
* This causes us to set the real flag, so we'll need
* to temporarily clear it while saving f-p state.
*/
if ( test_bit(EDF_GUEST_STTS, &tsk->flags) )
if ( test_bit(_VCPUF_guest_stts, &tsk->vcpu_flags) )
clts();
if ( cpu_has_fxsr )
@@ -40,7 +40,7 @@ void save_init_fpu(struct exec_domain *tsk)
"fnsave %0 ; fwait"
: "=m" (tsk->arch.guest_context.fpu_ctxt) );
clear_bit(EDF_USEDFPU, &tsk->flags);
clear_bit(_VCPUF_fpu_dirtied, &tsk->vcpu_flags);
stts();
}
+2 -2
View File
@@ -4,8 +4,8 @@
#include <asm/desc.h>
struct domain idle0_domain = {
id: IDLE_DOMAIN_ID,
flags: 1<<DF_IDLETASK,
domain_id: IDLE_DOMAIN_ID,
domain_flags:DOMF_idle_domain,
refcnt: ATOMIC_INIT(1)
};
+14 -14
View File
@@ -106,7 +106,7 @@
#ifdef VERBOSE
#define MEM_LOG(_f, _a...) \
printk("DOM%u: (file=mm.c, line=%d) " _f "\n", \
current->domain->id , __LINE__ , ## _a )
current->domain->domain_id , __LINE__ , ## _a )
#else
#define MEM_LOG(_f, _a...) ((void)0)
#endif
@@ -183,7 +183,7 @@ void arch_init_memory(void)
*/
dom_xen = alloc_domain_struct();
atomic_set(&dom_xen->refcnt, 1);
dom_xen->id = DOMID_XEN;
dom_xen->domain_id = DOMID_XEN;
/*
* Initialise our DOMID_IO domain.
@@ -192,7 +192,7 @@ void arch_init_memory(void)
*/
dom_io = alloc_domain_struct();
atomic_set(&dom_io->refcnt, 1);
dom_io->id = DOMID_IO;
dom_io->domain_id = DOMID_IO;
/* First 1MB of RAM is historically marked as I/O. */
for ( i = 0; i < 0x100; i++ )
@@ -1162,7 +1162,7 @@ void put_page_type(struct pfn_info *page)
* See domain.c:relinquish_list().
*/
ASSERT((x & PGT_validated) ||
test_bit(DF_DYING, &page_get_owner(page)->flags));
test_bit(_DOMF_dying, &page_get_owner(page)->domain_flags));
if ( unlikely((nx & PGT_count_mask) == 0) )
{
@@ -1392,7 +1392,7 @@ static int set_foreigndom(unsigned int cpu, domid_t domid)
percpu_info[cpu].foreign = dom_io;
break;
default:
MEM_LOG("Dom %u cannot set foreign dom\n", d->id);
MEM_LOG("Dom %u cannot set foreign dom\n", d->domain_id);
okay = 0;
break;
}
@@ -1645,7 +1645,7 @@ int do_mmuext_op(
if ( shadow_mode_external(d) )
{
MEM_LOG("ignoring SET_LDT hypercall from external "
"domain %u\n", d->id);
"domain %u\n", d->domain_id);
okay = 0;
break;
}
@@ -1676,7 +1676,7 @@ int do_mmuext_op(
case MMUEXT_REASSIGN_PAGE:
if ( unlikely(!IS_PRIV(d)) )
{
MEM_LOG("Dom %u has no reassignment priv", d->id);
MEM_LOG("Dom %u has no reassignment priv", d->domain_id);
okay = 0;
break;
}
@@ -1711,13 +1711,13 @@ int do_mmuext_op(
* it is dying.
*/
ASSERT(e->tot_pages <= e->max_pages);
if ( unlikely(test_bit(DF_DYING, &e->flags)) ||
if ( unlikely(test_bit(_DOMF_dying, &e->domain_flags)) ||
unlikely(e->tot_pages == e->max_pages) ||
unlikely(IS_XEN_HEAP_FRAME(page)) )
{
MEM_LOG("Transferee has no reservation headroom (%d,%d), or "
"page is in Xen heap (%lx), or dom is dying (%ld).\n",
e->tot_pages, e->max_pages, op.mfn, e->flags);
e->tot_pages, e->max_pages, op.mfn, e->domain_flags);
okay = 0;
goto reassign_fail;
}
@@ -1738,7 +1738,7 @@ int do_mmuext_op(
{
MEM_LOG("Bad page values %lx: ed=%p(%u), sd=%p,"
" caf=%08x, taf=%08x\n", page_to_pfn(page),
d, d->id, unpickle_domptr(_nd), x,
d, d->domain_id, unpickle_domptr(_nd), x,
page->u.inuse.type_info);
okay = 0;
goto reassign_fail;
@@ -1990,7 +1990,7 @@ int do_mmu_update(
{
shadow_lock(FOREIGNDOM);
printk("privileged guest dom%d requests pfn=%lx to map mfn=%lx for dom%d\n",
d->id, gpfn, mfn, FOREIGNDOM->id);
d->domain_id, gpfn, mfn, FOREIGNDOM->domain_id);
set_machinetophys(mfn, gpfn);
set_p2m_entry(FOREIGNDOM, gpfn, mfn, &sh_mapcache, &mapcache);
okay = 1;
@@ -2452,7 +2452,7 @@ int revalidate_l1(struct domain *d, l1_pgentry_t *l1page, l1_pgentry_t *snapshot
int modified = 0, i;
#if 0
if ( d->id )
if ( d->domain_id )
printk("%s: l1page mfn=%lx snapshot mfn=%lx\n", __func__,
l1e_get_pfn(linear_pg_table[l1_linear_offset((unsigned long)l1page)]),
l1e_get_pfn(linear_pg_table[l1_linear_offset((unsigned long)snapshot)]));
@@ -2909,7 +2909,7 @@ void ptwr_destroy(struct domain *d)
{
MEM_LOG("Bad page values %p: ed=%p(%u), sd=%p,"
" caf=%08x, taf=%08x\n", page_to_pfn(page),
d, d->id, unpickle_domptr(_nd), x,
d, d->domain_id, unpickle_domptr(_nd), x,
page->u.inuse.type_info);
spin_unlock(&d->page_alloc_lock);
put_domain(e);
@@ -2939,7 +2939,7 @@ void ptwr_destroy(struct domain *d)
* Also, a domain mustn't have PGC_allocated pages when it is dying.
*/
ASSERT(e->tot_pages <= e->max_pages);
if ( unlikely(test_bit(DF_DYING, &e->flags)) ||
if ( unlikely(test_bit(_DOMF_dying, &e->domain_flags)) ||
unlikely(e->tot_pages == e->max_pages) ||
unlikely(!gnttab_prepare_for_transfer(e, d, gntref)) )
{
+1 -1
View File
@@ -128,7 +128,7 @@ void physdev_init_dom0(struct domain *d)
BUG_ON(d->arch.iobmp_mask == NULL);
memset(d->arch.iobmp_mask, 0, IOBMP_BYTES);
set_bit(DF_PHYSDEV, &d->flags);
set_bit(_DOMF_physdev_access, &d->domain_flags);
}
+95 -59
View File
@@ -33,23 +33,29 @@ integer_param("xenheap_megabytes", opt_xenheap_megabytes);
int opt_noht = 0;
boolean_param("noht", opt_noht);
/* opt_noacpi: If true, ACPI tables are not parsed. */
static int opt_noacpi = 0;
boolean_param("noacpi", opt_noacpi);
/* opt_nosmp: If true, secondary processors are ignored. */
static int opt_nosmp = 0;
boolean_param("nosmp", opt_nosmp);
/* opt_ignorebiostables: If true, ACPI and MP tables are ignored. */
/* NB. This flag implies 'nosmp' and 'noacpi'. */
static int opt_ignorebiostables = 0;
boolean_param("ignorebiostables", opt_ignorebiostables);
/* opt_watchdog: If true, run a watchdog NMI on each processor. */
static int opt_watchdog = 0;
boolean_param("watchdog", opt_watchdog);
/* **** Linux config option: propagated to domain0. */
/* "acpi=off": Sisables both ACPI table parsing and interpreter. */
/* "acpi=force": Override the disable blacklist. */
/* "acpi=strict": Disables out-of-spec workarounds. */
/* "acpi=ht": Limit ACPI just to boot-time to enable HT. */
/* "acpi=noirq": Disables ACPI interrupt routing. */
static void parse_acpi_param(char *s);
custom_param("acpi", parse_acpi_param);
/* **** Linux config option: propagated to domain0. */
/* acpi_skip_timer_override: Skip IRQ0 overrides. */
extern int acpi_skip_timer_override;
boolean_param("acpi_skip_timer_override", acpi_skip_timer_override);
/* **** Linux config option: propagated to domain0. */
/* noapic: Disable IOAPIC setup. */
extern int skip_ioapic_setup;
boolean_param("noapic", skip_ioapic_setup);
int early_boot = 1;
unsigned long xenheap_phys_end;
@@ -62,7 +68,6 @@ extern void ac_timer_init(void);
extern void initialize_keytable();
extern int do_timer_lists_from_pit;
char ignore_irq13; /* set if exception 16 works */
struct cpuinfo_x86 boot_cpu_data = { 0, 0, 0, 0, -1 };
#if defined(__x86_64__)
@@ -328,6 +333,41 @@ void __init cpu_init(void)
init_idle_task();
}
int acpi_force;
char acpi_param[10] = "";
static void parse_acpi_param(char *s)
{
/* Save the parameter so it can be propagated to domain0. */
strncpy(acpi_param, s, sizeof(acpi_param));
acpi_param[sizeof(acpi_param)-1] = '\0';
/* Interpret the parameter for use within Xen. */
if ( !strcmp(s, "off") )
{
disable_acpi();
}
else if ( !strcmp(s, "force") )
{
acpi_force = 1;
acpi_ht = 1;
acpi_disabled = 0;
}
else if ( !strcmp(s, "strict") )
{
acpi_strict = 1;
}
else if ( !strcmp(s, "ht") )
{
if ( !acpi_force )
disable_acpi();
acpi_ht = 1;
}
else if ( !strcmp(s, "noirq") )
{
acpi_noirq_set();
}
}
static void __init do_initcalls(void)
{
initcall_t *call;
@@ -355,54 +395,36 @@ static void __init start_of_day(void)
identify_cpu(&boot_cpu_data); /* get CPU type info */
if ( cpu_has_fxsr ) set_in_cr4(X86_CR4_OSFXSR);
if ( cpu_has_xmm ) set_in_cr4(X86_CR4_OSXMMEXCPT);
#ifdef CONFIG_SMP
if ( opt_ignorebiostables )
{
opt_nosmp = 1; /* No SMP without configuration */
opt_noacpi = 1; /* ACPI will just confuse matters also */
}
else
{
find_smp_config();
smp_alloc_memory(); /* trampoline which other CPUs jump at */
}
#endif
paging_init(); /* not much here now, but sets up fixmap */
if ( !opt_noacpi )
{
acpi_boot_table_init();
acpi_boot_init();
}
#ifdef CONFIG_SMP
find_smp_config();
smp_alloc_memory();
paging_init();
acpi_boot_table_init();
acpi_boot_init();
if ( smp_found_config )
get_smp_config();
#endif
init_apic_mappings(); /* make APICs addressable in our pagetables. */
init_apic_mappings();
scheduler_init();
init_IRQ(); /* installs simple interrupt wrappers. Starts HZ clock. */
init_IRQ();
trap_init();
time_init(); /* installs software handler for HZ clock. */
time_init();
arch_init_memory();
#ifndef CONFIG_SMP
APIC_init_uniprocessor();
#else
if ( opt_nosmp )
APIC_init_uniprocessor();
else
smp_boot_cpus();
/*
* Does loads of stuff, including kicking the local
* APIC, and the IO APIC after other CPUs are booted.
* Each IRQ is preferably handled by IO-APIC, but
* fall thru to 8259A if we have to (but slower).
*/
#endif
smp_boot_cpus();
__sti();
initialize_keytable(); /* call back handling for key codes */
initialize_keytable();
serial_init_stage2();
@@ -419,19 +441,14 @@ static void __init start_of_day(void)
check_nmi_watchdog();
#ifdef CONFIG_PCI
pci_init();
#endif
do_initcalls();
#ifdef CONFIG_SMP
wait_init_idle = cpu_online_map;
clear_bit(smp_processor_id(), &wait_init_idle);
smp_threads_ready = 1;
smp_commence(); /* Tell other CPUs that state of the world is stable. */
while ( wait_init_idle != 0 )
cpu_relax();
#endif
watchdog_on = 1;
#ifdef __x86_64__ /* x86_32 uses low mappings when building DOM0. */
@@ -570,15 +587,34 @@ void __init __start_xen(multiboot_info_t *mbi)
if ( dom0 == NULL )
panic("Error creating domain 0\n");
set_bit(DF_PRIVILEGED, &dom0->flags);
set_bit(_DOMF_privileged, &dom0->domain_flags);
/* Grab the DOM0 command line. Skip past the image name. */
/* Grab the DOM0 command line. */
cmdline = (char *)(mod[0].string ? __va(mod[0].string) : NULL);
if ( cmdline != NULL )
{
static char dom0_cmdline[256];
/* Skip past the image name. */
while ( *cmdline == ' ' ) cmdline++;
if ( (cmdline = strchr(cmdline, ' ')) != NULL )
while ( *cmdline == ' ' ) cmdline++;
/* Copy the command line to a local buffer. */
strcpy(dom0_cmdline, cmdline);
cmdline = dom0_cmdline;
/* Append any extra parameters. */
if ( skip_ioapic_setup && !strstr(cmdline, "noapic") )
strcat(cmdline, " noapic");
if ( acpi_skip_timer_override &&
!strstr(cmdline, "acpi_skip_timer_override") )
strcat(cmdline, " acpi_skip_timer_override");
if ( (strlen(acpi_param) != 0) && !strstr(cmdline, "acpi=") )
{
strcat(cmdline, " acpi=");
strcat(cmdline, acpi_param);
}
}
/*
+18 -17
View File
@@ -117,7 +117,7 @@ shadow_promote(struct domain *d, unsigned long gpfn, unsigned long gmfn,
{
printk("shadow_promote: get_page_type failed "
"dom%d gpfn=%lx gmfn=%lx t=%08lx\n",
d->id, gpfn, gmfn, new_type);
d->domain_id, gpfn, gmfn, new_type);
okay = 0;
}
@@ -233,7 +233,7 @@ alloc_shadow_page(struct domain *d,
if ( unlikely(page == NULL) )
{
printk("Couldn't alloc shadow page! dom%d count=%d\n",
d->id, d->arch.shadow_page_count);
d->domain_id, d->arch.shadow_page_count);
printk("Shadow table counts: l1=%d l2=%d hl2=%d snapshot=%d\n",
perfc_value(shadow_l1_pages),
perfc_value(shadow_l2_pages),
@@ -1179,7 +1179,8 @@ void __shadow_mode_disable(struct domain *d)
* Currently this does not fix up page ref counts, so it is valid to call
* only when a domain is being destroyed.
*/
BUG_ON(!test_bit(DF_DYING, &d->flags) && shadow_mode_refcounts(d));
BUG_ON(!test_bit(_DOMF_dying, &d->domain_flags) &&
shadow_mode_refcounts(d));
d->arch.shadow_tainted_refcnts = shadow_mode_refcounts(d);
free_shadow_pages(d);
@@ -1217,7 +1218,7 @@ static int shadow_mode_table_op(
int i, rc = 0;
struct exec_domain *ed;
ASSERT(spin_is_locked(&d->arch.shadow_lock));
ASSERT(shadow_lock_is_acquired(d));
SH_VLOG("shadow mode table op %lx %lx count %d",
pagetable_val(d->exec_domain[0]->arch.guest_table), /* XXX SMP */
@@ -1409,7 +1410,7 @@ gpfn_to_mfn_foreign(struct domain *d, unsigned long gpfn)
if ( !(l2e_get_flags(l2e) & _PAGE_PRESENT) )
{
printk("gpfn_to_mfn_foreign(d->id=%d, gpfn=%lx) => 0 l2e=%lx\n",
d->id, gpfn, l2e_get_value(l2e));
d->domain_id, gpfn, l2e_get_value(l2e));
return INVALID_MFN;
}
unsigned long l1tab = l2e_get_phys(l2e);
@@ -1419,13 +1420,13 @@ gpfn_to_mfn_foreign(struct domain *d, unsigned long gpfn)
#if 0
printk("gpfn_to_mfn_foreign(d->id=%d, gpfn=%lx) => %lx phystab=%lx l2e=%lx l1tab=%lx, l1e=%lx\n",
d->id, gpfn, l1_pgentry_val(l1e) >> PAGE_SHIFT, phystab, l2e, l1tab, l1e);
d->domain_id, gpfn, l1_pgentry_val(l1e) >> PAGE_SHIFT, phystab, l2e, l1tab, l1e);
#endif
if ( !(l1e_get_flags(l1e) & _PAGE_PRESENT) )
{
printk("gpfn_to_mfn_foreign(d->id=%d, gpfn=%lx) => 0 l1e=%lx\n",
d->id, gpfn, l1e_get_value(l1e));
d->domain_id, gpfn, l1e_get_value(l1e));
return INVALID_MFN;
}
@@ -1754,7 +1755,7 @@ shadow_make_snapshot(
{
printk("Couldn't alloc fullshadow snapshot for pfn=%lx mfn=%lx!\n"
"Dom%d snapshot_count_count=%d\n",
gpfn, gmfn, d->id, d->arch.snapshot_page_count);
gpfn, gmfn, d->domain_id, d->arch.snapshot_page_count);
BUG(); /* XXX FIXME: try a shadow flush to free up some memory. */
}
@@ -1813,7 +1814,7 @@ shadow_mark_mfn_out_of_sync(struct exec_domain *ed, unsigned long gpfn,
struct pfn_info *page = &frame_table[mfn];
struct out_of_sync_entry *entry = shadow_alloc_oos_entry(d);
ASSERT(spin_is_locked(&d->arch.shadow_lock));
ASSERT(shadow_lock_is_acquired(d));
ASSERT(pfn_valid(mfn));
#ifndef NDEBUG
@@ -1943,7 +1944,7 @@ int __shadow_out_of_sync(struct exec_domain *ed, unsigned long va)
l2_pgentry_t l2e;
unsigned long l1pfn, l1mfn;
ASSERT(spin_is_locked(&d->arch.shadow_lock));
ASSERT(shadow_lock_is_acquired(d));
ASSERT(VALID_M2P(l2pfn));
perfc_incrc(shadow_out_of_sync_calls);
@@ -2127,7 +2128,7 @@ int shadow_remove_all_write_access(
u32 found = 0, fixups, write_refs;
unsigned long prediction, predicted_gpfn, predicted_smfn;
ASSERT(spin_is_locked(&d->arch.shadow_lock));
ASSERT(shadow_lock_is_acquired(d));
ASSERT(VALID_MFN(readonly_gmfn));
perfc_incrc(remove_write_access);
@@ -2245,7 +2246,7 @@ u32 shadow_remove_all_access(struct domain *d, unsigned long forbidden_gmfn)
if ( unlikely(!shadow_mode_enabled(d)) )
return 0;
ASSERT(spin_is_locked(&d->arch.shadow_lock));
ASSERT(shadow_lock_is_acquired(d));
perfc_incrc(remove_all_access);
for (i = 0; i < shadow_ht_buckets; i++)
@@ -2287,7 +2288,7 @@ static int resync_all(struct domain *d, u32 stype)
int unshadow;
int changed;
ASSERT(spin_is_locked(&d->arch.shadow_lock));
ASSERT(shadow_lock_is_acquired(d));
for ( entry = d->arch.out_of_sync; entry; entry = entry->next)
{
@@ -2485,7 +2486,7 @@ void __shadow_sync_all(struct domain *d)
perfc_incrc(shadow_sync_all);
ASSERT(spin_is_locked(&d->arch.shadow_lock));
ASSERT(shadow_lock_is_acquired(d));
// First, remove all write permissions to the page tables
//
@@ -2645,7 +2646,7 @@ int shadow_fault(unsigned long va, struct cpu_user_regs *regs)
{
printk("%s() failed, crashing domain %d "
"due to a read-only L2 page table (gpde=%lx), va=%lx\n",
__func__, d->id, l2e_get_value(gpde), va);
__func__, d->domain_id, l2e_get_value(gpde), va);
domain_crash_synchronous();
}
@@ -3146,7 +3147,7 @@ int check_l2_table(
FAILPT("bogus owner for snapshot page");
if ( page_get_owner(pfn_to_page(smfn)) != NULL )
FAILPT("shadow page mfn=0x%lx is owned by someone, domid=%d",
smfn, page_get_owner(pfn_to_page(smfn))->id);
smfn, page_get_owner(pfn_to_page(smfn))->domain_id);
#if 0
if ( memcmp(&spl2e[DOMAIN_ENTRIES_PER_L2_PAGETABLE],
@@ -3307,7 +3308,7 @@ int _check_all_pagetables(struct exec_domain *ed, char *s)
shadow_status_noswap = 1;
sh_check_name = s;
SH_VVLOG("%s-PT Audit domid=%d", s, d->id);
SH_VVLOG("%s-PT Audit domid=%d", s, d->domain_id);
sh_l2_present = sh_l1_present = 0;
perfc_incrc(check_all_pagetables);
+7 -5
View File
@@ -51,8 +51,11 @@
#include <mach_apic.h>
#include <mach_wakecpu.h>
/* Cconfigured maximum number of CPUs to activate. We name the parameter
"maxcpus" rather than max_cpus to be compatible with Linux */
/* opt_nosmp: If true, secondary processors are ignored. */
static int opt_nosmp = 0;
boolean_param("nosmp", opt_nosmp);
/* maxcpus: maximum number of CPUs to activate. */
static int max_cpus = -1;
integer_param("maxcpus", max_cpus);
@@ -658,7 +661,7 @@ static void __init do_boot_cpu (int apicid)
ed = idle->exec_domain[0];
set_bit(DF_IDLETASK, &idle->flags);
set_bit(_DOMF_idle_domain, &idle->domain_flags);
ed->arch.monitor_table = mk_pagetable(__pa(idle_pg_table));
@@ -797,8 +800,7 @@ void __init smp_boot_cpus(void)
* If we couldnt find an SMP configuration at boot time,
* get out of here now!
*/
if (!smp_found_config) {
printk("SMP motherboard not detected.\n");
if (!smp_found_config || opt_nosmp) {
io_apic_irqs = 0;
phys_cpu_present_map = physid_mask_of_physid(0);
cpu_online_map = 1;
+25 -30
View File
@@ -152,7 +152,7 @@ static inline int do_trap(int trapnr, char *str,
#ifndef NDEBUG
if ( (ed->arch.guest_context.trap_ctxt[trapnr].address == 0) &&
(ed->domain->id == 0) )
(ed->domain->domain_id == 0) )
goto xen_fault;
#endif
@@ -326,7 +326,7 @@ asmlinkage int do_page_fault(struct cpu_user_regs *regs)
#ifndef NDEBUG
if ( (ed->arch.guest_context.trap_ctxt[TRAP_page_fault].address == 0) &&
(d->id == 0) )
(d->domain_id == 0) )
goto xen_fault;
#endif
@@ -361,13 +361,13 @@ long do_fpu_taskswitch(int set)
if ( set )
{
set_bit(EDF_GUEST_STTS, &ed->flags);
set_bit(_VCPUF_guest_stts, &ed->vcpu_flags);
stts();
}
else
{
clear_bit(EDF_GUEST_STTS, &ed->flags);
if ( test_bit(EDF_USEDFPU, &ed->flags) )
clear_bit(_VCPUF_guest_stts, &ed->vcpu_flags);
if ( test_bit(_VCPUF_fpu_dirtied, &ed->vcpu_flags) )
clts();
}
@@ -433,10 +433,19 @@ static inline int admin_io_okay(
#define outl_user(_v, _p, _d, _r) \
(admin_io_okay(_p, 4, _d, _r) ? outl(_v, _p) : ((void)0))
/* Propagate a fault back to the guest kernel. */
#define USER_READ_FAULT 4 /* user mode, read fault */
#define USER_WRITE_FAULT 6 /* user mode, write fault */
#define PAGE_FAULT(_faultaddr, _errcode) \
({ propagate_page_fault(_faultaddr, _errcode); \
return EXCRET_fault_fixed; \
})
/* Isntruction fetch with error handling. */
#define insn_fetch(_type, _size, _ptr) \
({ unsigned long _x; \
if ( get_user(_x, (_type *)eip) ) \
goto read_fault; \
PAGE_FAULT(eip, USER_READ_FAULT); \
eip += _size; (_type)_x; })
static int emulate_privileged_op(struct cpu_user_regs *regs)
@@ -502,17 +511,17 @@ static int emulate_privileged_op(struct cpu_user_regs *regs)
case 1:
data = (u8)inb_user((u16)regs->edx, ed, regs);
if ( put_user((u8)data, (u8 *)regs->edi) )
goto write_fault;
PAGE_FAULT(regs->edi, USER_WRITE_FAULT);
break;
case 2:
data = (u16)inw_user((u16)regs->edx, ed, regs);
if ( put_user((u16)data, (u16 *)regs->edi) )
goto write_fault;
PAGE_FAULT(regs->edi, USER_WRITE_FAULT);
break;
case 4:
data = (u32)inl_user((u16)regs->edx, ed, regs);
if ( put_user((u32)data, (u32 *)regs->edi) )
goto write_fault;
PAGE_FAULT(regs->edi, USER_WRITE_FAULT);
break;
}
regs->edi += (regs->eflags & EF_DF) ? -op_bytes : op_bytes;
@@ -527,17 +536,17 @@ static int emulate_privileged_op(struct cpu_user_regs *regs)
{
case 1:
if ( get_user(data, (u8 *)regs->esi) )
goto read_fault;
PAGE_FAULT(regs->esi, USER_READ_FAULT);
outb_user((u8)data, (u16)regs->edx, ed, regs);
break;
case 2:
if ( get_user(data, (u16 *)regs->esi) )
goto read_fault;
PAGE_FAULT(regs->esi, USER_READ_FAULT);
outw_user((u16)data, (u16)regs->edx, ed, regs);
break;
case 4:
if ( get_user(data, (u32 *)regs->esi) )
goto read_fault;
PAGE_FAULT(regs->esi, USER_READ_FAULT);
outl_user((u32)data, (u16)regs->edx, ed, regs);
break;
}
@@ -665,7 +674,7 @@ static int emulate_privileged_op(struct cpu_user_regs *regs)
case 0: /* Read CR0 */
*reg =
(read_cr0() & ~X86_CR0_TS) |
(test_bit(EDF_GUEST_STTS, &ed->flags) ? X86_CR0_TS : 0);
(test_bit(_VCPUF_guest_stts, &ed->vcpu_flags) ? X86_CR0_TS:0);
break;
case 2: /* Read CR2 */
@@ -736,14 +745,6 @@ static int emulate_privileged_op(struct cpu_user_regs *regs)
fail:
return 0;
read_fault:
propagate_page_fault(eip, 4); /* user mode, read fault */
return EXCRET_fault_fixed;
write_fault:
propagate_page_fault(eip, 6); /* user mode, write fault */
return EXCRET_fault_fixed;
}
asmlinkage int do_general_protection(struct cpu_user_regs *regs)
@@ -807,7 +808,7 @@ asmlinkage int do_general_protection(struct cpu_user_regs *regs)
#ifndef NDEBUG
if ( (ed->arch.guest_context.trap_ctxt[TRAP_gp_fault].address == 0) &&
(ed->domain->id == 0) )
(ed->domain->domain_id == 0) )
goto gp_in_kernel;
#endif
@@ -919,15 +920,9 @@ asmlinkage int math_state_restore(struct cpu_user_regs *regs)
/* Prevent recursion. */
clts();
if ( !test_and_set_bit(EDF_USEDFPU, &current->flags) )
{
if ( test_bit(EDF_DONEFPUINIT, &current->flags) )
restore_fpu(current);
else
init_fpu();
}
setup_fpu(current);
if ( test_and_clear_bit(EDF_GUEST_STTS, &current->flags) )
if ( test_and_clear_bit(_VCPUF_guest_stts, &current->vcpu_flags) )
{
struct trap_bounce *tb = &current->arch.trap_bounce;
tb->flags = TBF_EXCEPTION;
+27 -4
View File
@@ -154,6 +154,21 @@ static int vmx_do_page_fault(unsigned long va, struct cpu_user_regs *regs)
return result;
}
static void vmx_do_no_device_fault()
{
unsigned long cr0;
clts();
setup_fpu(current);
__vmread(CR0_READ_SHADOW, &cr0);
if (!(cr0 & X86_CR0_TS)) {
__vmread(GUEST_CR0, &cr0);
cr0 &= ~X86_CR0_TS;
__vmwrite(GUEST_CR0, cr0);
}
__vmwrite(EXCEPTION_BITMAP, MONITOR_DEFAULT_EXCEPTION_BITMAP);
}
static void vmx_do_general_protection_fault(struct cpu_user_regs *regs)
{
unsigned long eip, error_code;
@@ -894,6 +909,9 @@ static int vmx_cr_access(unsigned long exit_qualification, struct cpu_user_regs
mov_from_cr(cr, gp, regs);
break;
case TYPE_CLTS:
clts();
setup_fpu(current);
__vmread(GUEST_CR0, &value);
value &= ~X86_CR0_TS; /* clear TS */
__vmwrite(GUEST_CR0, value);
@@ -966,7 +984,7 @@ static void vmx_print_line(const char c, struct exec_domain *d)
print_buf[index++] = c;
}
print_buf[index] = '\0';
printk("(GUEST: %u) %s\n", d->domain->id, (char *) &print_buf);
printk("(GUEST: %u) %s\n", d->domain->domain_id, (char *) &print_buf);
index = 0;
}
else
@@ -1054,7 +1072,7 @@ asmlinkage void vmx_vmexit_handler(struct cpu_user_regs regs)
}
__vmread(GUEST_EIP, &eip);
TRACE_3D(TRC_VMX_VMEXIT, ed->domain->id, eip, exit_reason);
TRACE_3D(TRC_VMX_VMEXIT, ed->domain->domain_id, eip, exit_reason);
switch (exit_reason) {
case EXIT_REASON_EXCEPTION_NMI:
@@ -1075,7 +1093,7 @@ asmlinkage void vmx_vmexit_handler(struct cpu_user_regs regs)
perfc_incra(cause_vector, vector);
TRACE_3D(TRC_VMX_VECTOR, ed->domain->id, eip, vector);
TRACE_3D(TRC_VMX_VECTOR, ed->domain->domain_id, eip, vector);
switch (vector) {
#ifdef XEN_DEBUGGER
case TRAP_debug:
@@ -1093,6 +1111,11 @@ asmlinkage void vmx_vmexit_handler(struct cpu_user_regs regs)
break;
}
#endif
case TRAP_no_device:
{
vmx_do_no_device_fault();
break;
}
case TRAP_gp_fault:
{
vmx_do_general_protection_fault(&regs);
@@ -1122,7 +1145,7 @@ asmlinkage void vmx_vmexit_handler(struct cpu_user_regs regs)
__vmwrite(VM_ENTRY_INTR_INFO_FIELD, intr_fields);
__vmwrite(VM_ENTRY_EXCEPTION_ERROR_CODE, regs.error_code);
ed->arch.arch_vmx.cpu_cr2 = va;
TRACE_3D(TRC_VMX_INT, ed->domain->id, TRAP_page_fault, va);
TRACE_3D(TRC_VMX_INT, ed->domain->domain_id, TRAP_page_fault, va);
}
break;
}
+1
View File
@@ -429,6 +429,7 @@ void vmx_intr_assist(struct exec_domain *d)
void vmx_do_resume(struct exec_domain *d)
{
vmx_stts();
if ( test_bit(VMX_CPU_STATE_PG_ENABLED, &d->arch.arch_vmx.cpu_state) )
__vmwrite(GUEST_CR3, pagetable_val(d->arch.shadow_table));
else
+3
View File
@@ -164,6 +164,9 @@ void vmx_do_launch(struct exec_domain *ed)
struct pfn_info *page;
struct cpu_user_regs *regs = get_cpu_user_regs();
vmx_stts();
set_bit(_VCPUF_guest_stts, &ed->vcpu_flags);
cpu = smp_processor_id();
page = (struct pfn_info *) alloc_domheap_page(NULL);
+104 -33
View File
@@ -139,7 +139,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
{
ret = -EINVAL;
if ( (d != current->domain) &&
test_bit(DF_CONSTRUCTED, &d->flags) )
test_bit(_DOMF_constructed, &d->domain_flags) )
{
domain_unpause_by_systemcontroller(d);
ret = 0;
@@ -194,7 +194,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
ret = 0;
op->u.createdomain.domain = d->id;
op->u.createdomain.domain = d->domain_id;
copy_to_user(u_dom0_op, op, sizeof(*op));
}
break;
@@ -221,7 +221,8 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
domid_t dom = op->u.pincpudomain.domain;
struct domain *d = find_domain_by_id(dom);
struct exec_domain *ed;
int cpu = op->u.pincpudomain.cpu;
cpumap_t cpumap;
if ( d == NULL )
{
@@ -229,6 +230,14 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
break;
}
if ( (op->u.pincpudomain.exec_domain >= MAX_VIRT_CPUS) ||
!d->exec_domain[op->u.pincpudomain.exec_domain] )
{
ret = -EINVAL;
put_domain(d);
break;
}
ed = d->exec_domain[op->u.pincpudomain.exec_domain];
if ( ed == NULL )
{
@@ -244,17 +253,29 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
break;
}
if ( cpu == -1 )
if ( copy_from_user(&cpumap, op->u.pincpudomain.cpumap,
sizeof(cpumap)) )
{
clear_bit(EDF_CPUPINNED, &ed->flags);
ret = -EFAULT;
put_domain(d);
break;
}
/* update cpumap for this ed */
ed->cpumap = cpumap;
if ( cpumap == CPUMAP_RUNANYWHERE )
clear_bit(_VCPUF_cpu_pinned, &ed->vcpu_flags);
else
{
/* pick a new cpu from the usable map */
int new_cpu = (int)find_first_set_bit(cpumap) % smp_num_cpus;
exec_domain_pause(ed);
if ( ed->processor != (cpu % smp_num_cpus) )
set_bit(EDF_MIGRATED, &ed->flags);
set_bit(EDF_CPUPINNED, &ed->flags);
ed->processor = cpu % smp_num_cpus;
if ( ed->processor != new_cpu )
set_bit(_VCPUF_cpu_migrated, &ed->vcpu_flags);
set_bit(_VCPUF_cpu_pinned, &ed->vcpu_flags);
ed->processor = new_cpu;
exec_domain_unpause(ed);
}
@@ -278,15 +299,17 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
case DOM0_GETDOMAININFO:
{
struct vcpu_guest_context *c;
struct domain *d;
struct exec_domain *ed;
struct domain *d;
struct exec_domain *ed;
u64 cpu_time = 0;
int vcpu_count = 0;
int flags = DOMFLAGS_PAUSED | DOMFLAGS_BLOCKED;
read_lock(&domlist_lock);
for_each_domain ( d )
{
if ( d->id >= op->u.getdomaininfo.domain )
if ( d->domain_id >= op->u.getdomaininfo.domain )
break;
}
@@ -299,36 +322,84 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
read_unlock(&domlist_lock);
op->u.getdomaininfo.domain = d->id;
op->u.getdomaininfo.domain = d->domain_id;
if ( (op->u.getdomaininfo.exec_domain >= MAX_VIRT_CPUS) ||
!d->exec_domain[op->u.getdomaininfo.exec_domain] )
{
ret = -EINVAL;
break;
memset(&op->u.getdomaininfo.vcpu_to_cpu, -1,
sizeof(op->u.getdomaininfo.vcpu_to_cpu));
memset(&op->u.getdomaininfo.cpumap, 0,
sizeof(op->u.getdomaininfo.cpumap));
/*
* - domain is marked as paused or blocked only if all its vcpus
* are paused or blocked
* - domain is marked as running if any of its vcpus is running
*/
for_each_exec_domain ( d, ed ) {
op->u.getdomaininfo.vcpu_to_cpu[ed->vcpu_id] = ed->processor;
op->u.getdomaininfo.cpumap[ed->vcpu_id] = ed->cpumap;
if ( !(ed->vcpu_flags & VCPUF_ctrl_pause) )
flags &= ~DOMFLAGS_PAUSED;
if ( !(ed->vcpu_flags & VCPUF_blocked) )
flags &= ~DOMFLAGS_BLOCKED;
if ( ed->vcpu_flags & VCPUF_running )
flags |= DOMFLAGS_RUNNING;
if ( ed->cpu_time > cpu_time )
cpu_time += ed->cpu_time;
vcpu_count++;
}
ed = d->exec_domain[op->u.getdomaininfo.exec_domain];
op->u.getdomaininfo.flags =
(test_bit( DF_DYING, &d->flags) ? DOMFLAGS_DYING : 0) |
(test_bit( DF_CRASHED, &d->flags) ? DOMFLAGS_CRASHED : 0) |
(test_bit( DF_SHUTDOWN, &d->flags) ? DOMFLAGS_SHUTDOWN : 0) |
(test_bit(EDF_CTRLPAUSE, &ed->flags) ? DOMFLAGS_PAUSED : 0) |
(test_bit(EDF_BLOCKED, &ed->flags) ? DOMFLAGS_BLOCKED : 0) |
(test_bit(EDF_RUNNING, &ed->flags) ? DOMFLAGS_RUNNING : 0);
op->u.getdomaininfo.cpu_time = cpu_time;
op->u.getdomaininfo.n_vcpu = vcpu_count;
op->u.getdomaininfo.flags |= ed->processor << DOMFLAGS_CPUSHIFT;
op->u.getdomaininfo.flags |=
op->u.getdomaininfo.flags = flags |
((d->domain_flags & DOMF_dying) ? DOMFLAGS_DYING : 0) |
((d->domain_flags & DOMF_crashed) ? DOMFLAGS_CRASHED : 0) |
((d->domain_flags & DOMF_shutdown) ? DOMFLAGS_SHUTDOWN : 0) |
d->shutdown_code << DOMFLAGS_SHUTDOWNSHIFT;
op->u.getdomaininfo.tot_pages = d->tot_pages;
op->u.getdomaininfo.max_pages = d->max_pages;
op->u.getdomaininfo.cpu_time = ed->cpu_time;
op->u.getdomaininfo.shared_info_frame =
__pa(d->shared_info) >> PAGE_SHIFT;
if ( op->u.getdomaininfo.ctxt != NULL )
if ( copy_to_user(u_dom0_op, op, sizeof(*op)) )
ret = -EINVAL;
put_domain(d);
}
break;
case DOM0_GETVCPUCONTEXT:
{
struct vcpu_guest_context *c;
struct domain *d;
struct exec_domain *ed;
d = find_domain_by_id(op->u.getvcpucontext.domain);
if ( d == NULL )
{
ret = -ESRCH;
break;
}
if ( op->u.getvcpucontext.exec_domain >= MAX_VIRT_CPUS )
{
ret = -EINVAL;
put_domain(d);
break;
}
ed = d->exec_domain[op->u.getvcpucontext.exec_domain];
if ( ed == NULL )
{
ret = -ESRCH;
put_domain(d);
break;
}
op->u.getvcpucontext.cpu_time = ed->cpu_time;
if ( op->u.getvcpucontext.ctxt != NULL )
{
if ( (c = xmalloc(struct vcpu_guest_context)) == NULL )
{
@@ -345,7 +416,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
if ( ed != current )
exec_domain_unpause(ed);
if ( copy_to_user(op->u.getdomaininfo.ctxt, c, sizeof(*c)) )
if ( copy_to_user(op->u.getvcpucontext.ctxt, c, sizeof(*c)) )
ret = -EINVAL;
xfree(c);
+3 -3
View File
@@ -29,7 +29,7 @@
__HYPERVISOR_dom_mem_op, \
(_op) | (i << START_EXTENT_SHIFT), \
extent_list, nr_extents, extent_order, \
(d == current->domain) ? DOMID_SELF : d->id);
(d == current->domain) ? DOMID_SELF : d->domain_id);
static long
alloc_dom_mem(struct domain *d,
@@ -95,14 +95,14 @@ free_dom_mem(struct domain *d,
if ( unlikely((mpfn + j) >= max_page) )
{
DPRINTK("Domain %u page number out of range (%lx >= %lx)\n",
d->id, mpfn + j, max_page);
d->domain_id, mpfn + j, max_page);
return i;
}
page = &frame_table[mpfn + j];
if ( unlikely(!get_page(page, d)) )
{
DPRINTK("Bad page free for domain %u\n", d->id);
DPRINTK("Bad page free for domain %u\n", d->domain_id);
return i;
}
+20 -19
View File
@@ -39,7 +39,7 @@ struct domain *do_createdomain(domid_t dom_id, unsigned int cpu)
atomic_set(&d->refcnt, 1);
atomic_set(&ed->pausecnt, 0);
d->id = dom_id;
d->domain_id = dom_id;
ed->processor = cpu;
spin_lock_init(&d->time_lock);
@@ -50,7 +50,7 @@ struct domain *do_createdomain(domid_t dom_id, unsigned int cpu)
INIT_LIST_HEAD(&d->page_list);
INIT_LIST_HEAD(&d->xenpage_list);
if ( (d->id != IDLE_DOMAIN_ID) &&
if ( (d->domain_id != IDLE_DOMAIN_ID) &&
((init_event_channels(d) != 0) || (grant_table_create(d) != 0)) )
{
destroy_event_channels(d);
@@ -62,12 +62,12 @@ struct domain *do_createdomain(domid_t dom_id, unsigned int cpu)
sched_add_domain(ed);
if ( d->id != IDLE_DOMAIN_ID )
if ( d->domain_id != IDLE_DOMAIN_ID )
{
write_lock(&domlist_lock);
pd = &domain_list; /* NB. domain_list maintained in order of dom_id. */
for ( pd = &domain_list; *pd != NULL; pd = &(*pd)->next_in_list )
if ( (*pd)->id > d->id )
if ( (*pd)->domain_id > d->domain_id )
break;
d->next_in_list = *pd;
*pd = d;
@@ -88,7 +88,7 @@ struct domain *find_domain_by_id(domid_t dom)
d = domain_hash[DOMAIN_HASH(dom)];
while ( d != NULL )
{
if ( d->id == dom )
if ( d->domain_id == dom )
{
if ( unlikely(!get_domain(d)) )
d = NULL;
@@ -107,7 +107,7 @@ void domain_kill(struct domain *d)
struct exec_domain *ed;
domain_pause(d);
if ( !test_and_set_bit(DF_DYING, &d->flags) )
if ( !test_and_set_bit(_DOMF_dying, &d->domain_flags) )
{
for_each_exec_domain(d, ed)
sched_rem_domain(ed);
@@ -121,10 +121,10 @@ void domain_crash(void)
{
struct domain *d = current->domain;
if ( d->id == 0 )
if ( d->domain_id == 0 )
BUG();
set_bit(DF_CRASHED, &d->flags);
set_bit(_DOMF_crashed, &d->domain_flags);
send_guest_virq(dom0->exec_domain[0], VIRQ_DOM_EXC);
@@ -144,7 +144,7 @@ void domain_shutdown(u8 reason)
{
struct domain *d = current->domain;
if ( d->id == 0 )
if ( d->domain_id == 0 )
{
extern void machine_restart(char *);
extern void machine_halt(void);
@@ -164,9 +164,9 @@ void domain_shutdown(u8 reason)
}
if ( (d->shutdown_code = reason) == SHUTDOWN_crash )
set_bit(DF_CRASHED, &d->flags);
set_bit(_DOMF_crashed, &d->domain_flags);
else
set_bit(DF_SHUTDOWN, &d->flags);
set_bit(_DOMF_shutdown, &d->domain_flags);
send_guest_virq(dom0->exec_domain[0], VIRQ_DOM_EXC);
@@ -180,7 +180,7 @@ void domain_destruct(struct domain *d)
struct domain **pd;
atomic_t old, new;
if ( !test_bit(DF_DYING, &d->flags) )
if ( !test_bit(_DOMF_dying, &d->domain_flags) )
BUG();
/* May be already destructed, or get_domain() can race us. */
@@ -196,7 +196,7 @@ void domain_destruct(struct domain *d)
while ( *pd != d )
pd = &(*pd)->next_in_list;
*pd = d->next_in_list;
pd = &domain_hash[DOMAIN_HASH(d->id)];
pd = &domain_hash[DOMAIN_HASH(d->domain_id)];
while ( *pd != d )
pd = &(*pd)->next_in_hashbucket;
*pd = d->next_in_hashbucket;
@@ -217,18 +217,18 @@ void domain_destruct(struct domain *d)
* of domains other than domain 0. ie. the domains that are being built by
* the userspace dom0 domain builder.
*/
int set_info_guest(struct domain *p, dom0_setdomaininfo_t *setdomaininfo)
int set_info_guest(struct domain *d, dom0_setdomaininfo_t *setdomaininfo)
{
int rc = 0;
struct vcpu_guest_context *c = NULL;
unsigned long vcpu = setdomaininfo->exec_domain;
struct exec_domain *ed;
if ( (vcpu >= MAX_VIRT_CPUS) || ((ed = p->exec_domain[vcpu]) == NULL) )
if ( (vcpu >= MAX_VIRT_CPUS) || ((ed = d->exec_domain[vcpu]) == NULL) )
return -EINVAL;
if (test_bit(DF_CONSTRUCTED, &p->flags) &&
!test_bit(EDF_CTRLPAUSE, &ed->flags))
if (test_bit(_DOMF_constructed, &d->domain_flags) &&
!test_bit(_VCPUF_ctrl_pause, &ed->vcpu_flags))
return -EINVAL;
if ( (c = xmalloc(struct vcpu_guest_context)) == NULL )
@@ -243,7 +243,7 @@ int set_info_guest(struct domain *p, dom0_setdomaininfo_t *setdomaininfo)
if ( (rc = arch_set_info_guest(ed, c)) != 0 )
goto out;
set_bit(DF_CONSTRUCTED, &p->flags);
set_bit(_DOMF_constructed, &d->domain_flags);
out:
xfree(c);
@@ -283,6 +283,7 @@ long do_boot_vcpu(unsigned long vcpu, struct vcpu_guest_context *ctxt)
ed = d->exec_domain[vcpu];
atomic_set(&ed->pausecnt, 0);
ed->cpumap = CPUMAP_RUNANYWHERE;
memcpy(&ed->arch, &idle0_exec_domain.arch, sizeof(ed->arch));
@@ -294,7 +295,7 @@ long do_boot_vcpu(unsigned long vcpu, struct vcpu_guest_context *ctxt)
sched_add_domain(ed);
/* domain_unpause_by_systemcontroller */
if ( test_and_clear_bit(EDF_CTRLPAUSE, &ed->flags) )
if ( test_and_clear_bit(_VCPUF_ctrl_pause, &ed->vcpu_flags) )
domain_wake(ed);
xfree(c);
+7 -7
View File
@@ -40,7 +40,7 @@ static int get_free_port(struct exec_domain *ed)
max = d->max_event_channel;
chn = d->event_channel;
for ( port = ed->id * EVENT_CHANNELS_SPREAD; port < max; port++ )
for ( port = ed->vcpu_id * EVENT_CHANNELS_SPREAD; port < max; port++ )
if ( chn[port].state == ECS_FREE )
break;
@@ -114,9 +114,9 @@ static long evtchn_bind_interdomain(evtchn_bind_interdomain_t *bind)
return -EINVAL;
if ( dom1 == DOMID_SELF )
dom1 = current->domain->id;
dom1 = current->domain->domain_id;
if ( dom2 == DOMID_SELF )
dom2 = current->domain->id;
dom2 = current->domain->domain_id;
if ( ((d1 = find_domain_by_id(dom1)) == NULL) ||
((d2 = find_domain_by_id(dom2)) == NULL) )
@@ -429,7 +429,7 @@ static long __evtchn_close(struct domain *d1, int port1)
BUG();
chn2[port2].state = ECS_UNBOUND;
chn2[port2].u.unbound.remote_domid = d1->id;
chn2[port2].u.unbound.remote_domid = d1->domain_id;
break;
default:
@@ -459,7 +459,7 @@ static long evtchn_close(evtchn_close_t *close)
domid_t dom = close->dom;
if ( dom == DOMID_SELF )
dom = current->domain->id;
dom = current->domain->domain_id;
else if ( !IS_PRIV(current->domain) )
return -EPERM;
@@ -522,7 +522,7 @@ static long evtchn_status(evtchn_status_t *status)
long rc = 0;
if ( dom == DOMID_SELF )
dom = current->domain->id;
dom = current->domain->domain_id;
else if ( !IS_PRIV(current->domain) )
return -EPERM;
@@ -552,7 +552,7 @@ static long evtchn_status(evtchn_status_t *status)
case ECS_INTERDOMAIN:
status->status = EVTCHNSTAT_interdomain;
status->u.interdomain.dom =
chn[port].u.interdomain.remote_dom->domain->id;
chn[port].u.interdomain.remote_dom->domain->domain_id;
status->u.interdomain.port = chn[port].u.interdomain.remote_port;
break;
case ECS_PIRQ:
+16 -14
View File
@@ -118,10 +118,10 @@ __gnttab_activate_grant_ref(
u32 scombo, prev_scombo, new_scombo;
if ( unlikely((sflags & GTF_type_mask) != GTF_permit_access) ||
unlikely(sdom != mapping_d->id) )
unlikely(sdom != mapping_d->domain_id) )
PIN_FAIL(unlock_out, GNTST_general_error,
"Bad flags (%x) or dom (%d). (NB. expected dom %d)\n",
sflags, sdom, mapping_d->id);
sflags, sdom, mapping_d->domain_id);
/* Merge two 16-bit values into a 32-bit combined update. */
/* NB. Endianness! */
@@ -674,7 +674,7 @@ gnttab_setup_table(
if ( op.dom == DOMID_SELF )
{
op.dom = current->domain->id;
op.dom = current->domain->domain_id;
}
else if ( unlikely(!IS_PRIV(current->domain)) )
{
@@ -725,7 +725,7 @@ gnttab_dump_table(gnttab_dump_table_t *uop)
if ( op.dom == DOMID_SELF )
{
op.dom = current->domain->id;
op.dom = current->domain->domain_id;
}
if ( unlikely((d = find_domain_by_id(op.dom)) == NULL) )
@@ -866,10 +866,10 @@ gnttab_check_unmap(
lgt = ld->grant_table;
#if GRANT_DEBUG_VERBOSE
if ( ld->id != 0 )
if ( ld->domain_id != 0 )
{
DPRINTK("Foreign unref rd(%d) ld(%d) frm(%x) flgs(%x).\n",
rd->id, ld->id, frame, readonly);
rd->domain_id, ld->domain_id, frame, readonly);
}
#endif
@@ -879,7 +879,8 @@ gnttab_check_unmap(
if ( get_domain(rd) == 0 )
{
DPRINTK("gnttab_check_unmap: couldn't get_domain rd(%d)\n", rd->id);
DPRINTK("gnttab_check_unmap: couldn't get_domain rd(%d)\n",
rd->domain_id);
return 0;
}
@@ -913,7 +914,7 @@ gnttab_check_unmap(
/* gotcha */
DPRINTK("Grant unref rd(%d) ld(%d) frm(%lx) flgs(%x).\n",
rd->id, ld->id, frame, readonly);
rd->domain_id, ld->domain_id, frame, readonly);
if ( readonly )
act->pin -= GNTPIN_hstr_inc;
@@ -963,12 +964,13 @@ gnttab_prepare_for_transfer(
unsigned long target_pfn;
DPRINTK("gnttab_prepare_for_transfer rd(%hu) ld(%hu) ref(%hu).\n",
rd->id, ld->id, ref);
rd->domain_id, ld->domain_id, ref);
if ( unlikely((rgt = rd->grant_table) == NULL) ||
unlikely(ref >= NR_GRANT_ENTRIES) )
{
DPRINTK("Dom %d has no g.t., or ref is bad (%d).\n", rd->id, ref);
DPRINTK("Dom %d has no g.t., or ref is bad (%d).\n",
rd->domain_id, ref);
return 0;
}
@@ -990,10 +992,10 @@ gnttab_prepare_for_transfer(
}
if ( unlikely(sflags != GTF_accept_transfer) ||
unlikely(sdom != ld->id) )
unlikely(sdom != ld->domain_id) )
{
DPRINTK("Bad flags (%x) or dom (%d). (NB. expected dom %d)\n",
sflags, sdom, ld->id);
sflags, sdom, ld->domain_id);
goto fail;
}
@@ -1041,7 +1043,7 @@ gnttab_notify_transfer(
unsigned long pfn;
DPRINTK("gnttab_notify_transfer rd(%hu) ld(%hu) ref(%hu).\n",
rd->id, ld->id, ref);
rd->domain_id, ld->domain_id, ref);
sha = &rd->grant_table->shared[ref];
@@ -1062,7 +1064,7 @@ gnttab_notify_transfer(
__phys_to_machine_mapping[pfn] = frame;
}
sha->frame = __mfn_to_gpfn(rd, frame);
sha->domid = rd->id;
sha->domid = rd->domain_id;
wmb();
sha->flags = ( GTF_accept_transfer | GTF_transfer_completed );
+4 -18
View File
@@ -55,27 +55,13 @@ void cmdline_parse(char *cmdline)
*(unsigned int *)param->var =
simple_strtol(opt, (char **)&opt, 0);
break;
case OPT_UINT_UNIT:
if ( opt != NULL )
{
int base = 1;
unsigned int value;
value = simple_strtoul(opt, (char **)&opt, 0);
if (*opt == 'G' || *opt == 'g') {
base = 1024 * 1024;
opt++;
} if (*opt == 'M' || *opt == 'm') {
base = 1024;
opt++;
} else if (*opt == 'K' || *opt == 'k')
opt++;
*(unsigned int *) param->var = value * base;
}
break;
case OPT_BOOL:
*(int *)param->var = 1;
break;
case OPT_CUSTOM:
if ( opt != NULL )
((void (*)(char *))param->var)(opt);
break;
}
}
cmdline = opt_end;
+4 -4
View File
@@ -109,7 +109,7 @@ static void do_task_queues(unsigned char key)
for_each_domain ( d )
{
printk("Xen: DOM %u, flags=%lx refcnt=%d nr_pages=%d "
"xenheap_pages=%d\n", d->id, d->flags,
"xenheap_pages=%d\n", d->domain_id, d->domain_flags,
atomic_read(&d->refcnt), d->tot_pages, d->xenheap_pages);
dump_pageframe_info(d);
@@ -118,11 +118,11 @@ static void do_task_queues(unsigned char key)
printk("Guest: %p CPU %d [has=%c] flags=%lx "
"upcall_pend = %02x, upcall_mask = %02x\n", ed,
ed->processor,
test_bit(EDF_RUNNING, &ed->flags) ? 'T':'F',
ed->flags,
test_bit(_VCPUF_running, &ed->vcpu_flags) ? 'T':'F',
ed->vcpu_flags,
ed->vcpu_info->evtchn_upcall_pending,
ed->vcpu_info->evtchn_upcall_mask);
printk("Notifying guest... %d/%d\n", d->id, ed->id);
printk("Notifying guest... %d/%d\n", d->domain_id, ed->vcpu_id);
printk("port %d/%d stat %d %d %d\n",
VIRQ_DEBUG, ed->virq_to_evtchn[VIRQ_DEBUG],
test_bit(ed->virq_to_evtchn[VIRQ_DEBUG],
+16
View File
@@ -441,6 +441,22 @@ s64 __moddi3(s64 a, s64 b)
#endif /* BITS_PER_LONG == 32 */
unsigned long long memparse(char *s)
{
unsigned long long ret = simple_strtoull(s, &s, 0);
switch (*s) {
case 'G': case 'g':
ret <<= 10;
case 'M': case 'm':
ret <<= 10;
case 'K': case 'k':
ret <<= 10;
}
return ret;
}
/*
* Local variables:
* mode: C
+4 -4
View File
@@ -504,13 +504,13 @@ struct pfn_info *alloc_domheap_pages(struct domain *d, unsigned int order)
spin_lock(&d->page_alloc_lock);
if ( unlikely(test_bit(DF_DYING, &d->flags)) ||
if ( unlikely(test_bit(_DOMF_dying, &d->domain_flags)) ||
unlikely((d->tot_pages + (1 << order)) > d->max_pages) )
{
DPRINTK("Over-allocation for domain %u: %u > %u\n",
d->id, d->tot_pages + (1 << order), d->max_pages);
d->domain_id, d->tot_pages + (1 << order), d->max_pages);
DPRINTK("...or the domain is dying (%d)\n",
!!test_bit(DF_DYING, &d->flags));
!!test_bit(_DOMF_dying, &d->domain_flags));
spin_unlock(&d->page_alloc_lock);
free_heap_pages(MEMZONE_DOM, pg, order);
return NULL;
@@ -575,7 +575,7 @@ void free_domheap_pages(struct pfn_info *pg, unsigned int order)
spin_unlock_recursive(&d->page_alloc_lock);
if ( likely(!test_bit(DF_DYING, &d->flags)) )
if ( likely(!test_bit(_DOMF_dying, &d->domain_flags)) )
{
free_heap_pages(MEMZONE_DOM, pg, order);
}
+11 -10
View File
@@ -174,9 +174,9 @@ static int bvt_alloc_task(struct exec_domain *ed)
return -1;
memset(d->sched_priv, 0, sizeof(struct bvt_dom_info));
}
ed->sched_priv = &BVT_INFO(d)->ed_inf[ed->id];
BVT_INFO(d)->ed_inf[ed->id].inf = BVT_INFO(d);
BVT_INFO(d)->ed_inf[ed->id].exec_domain = ed;
ed->sched_priv = &BVT_INFO(d)->ed_inf[ed->vcpu_id];
BVT_INFO(d)->ed_inf[ed->vcpu_id].inf = BVT_INFO(d);
BVT_INFO(d)->ed_inf[ed->vcpu_id].exec_domain = ed;
return 0;
}
@@ -190,7 +190,8 @@ static void bvt_add_task(struct exec_domain *d)
ASSERT(inf != NULL);
ASSERT(d != NULL);
if (d->id == 0) {
if ( d->vcpu_id == 0 )
{
inf->mcu_advance = MCU_ADVANCE;
inf->domain = d->domain;
inf->warpback = 0;
@@ -212,7 +213,7 @@ static void bvt_add_task(struct exec_domain *d)
einf->exec_domain = d;
if ( d->domain->id == IDLE_DOMAIN_ID )
if ( d->domain->domain_id == IDLE_DOMAIN_ID )
{
einf->avt = einf->evt = ~0U;
}
@@ -231,7 +232,7 @@ static int bvt_init_idle_task(struct exec_domain *ed)
bvt_add_task(ed);
set_bit(EDF_RUNNING, &ed->flags);
set_bit(_VCPUF_running, &ed->vcpu_flags);
if ( !__task_on_runqueue(ed) )
__add_to_runqueue_head(ed);
@@ -256,7 +257,7 @@ static void bvt_wake(struct exec_domain *ed)
/* Set the BVT parameters. AVT should always be updated
if CPU migration ocurred.*/
if ( einf->avt < CPU_SVT(cpu) ||
unlikely(test_bit(EDF_MIGRATED, &ed->flags)) )
unlikely(test_bit(_VCPUF_cpu_migrated, &ed->vcpu_flags)) )
einf->avt = CPU_SVT(cpu);
/* Deal with warping here. */
@@ -279,7 +280,7 @@ static void bvt_wake(struct exec_domain *ed)
static void bvt_sleep(struct exec_domain *ed)
{
if ( test_bit(EDF_RUNNING, &ed->flags) )
if ( test_bit(_VCPUF_running, &ed->vcpu_flags) )
cpu_raise_softirq(ed->processor, SCHEDULE_SOFTIRQ);
else if ( __task_on_runqueue(ed) )
__del_from_runqueue(ed);
@@ -538,8 +539,8 @@ static void bvt_dump_cpu_state(int i)
list_for_each_entry ( ed_inf, queue, run_list )
{
ed = ed_inf->exec_domain;
printk("%3d: %u has=%c ", loop++, ed->domain->id,
test_bit(EDF_RUNNING, &ed->flags) ? 'T':'F');
printk("%3d: %u has=%c ", loop++, ed->domain->domain_id,
test_bit(_VCPUF_running, &ed->vcpu_flags) ? 'T':'F');
bvt_dump_runq_el(ed);
printk("c=0x%X%08X\n", (u32)(ed->cpu_time>>32), (u32)ed->cpu_time);
printk(" l: %p n: %p p: %p\n",
+42 -42
View File
@@ -162,8 +162,8 @@ static inline void extraq_del(struct exec_domain *d, int i)
{
struct list_head *list = EXTRALIST(d,i);
ASSERT(extraq_on(d,i));
PRINT(3, "Removing domain %i.%i from L%i extraq\n", d->domain->id,
d->id, i);
PRINT(3, "Removing domain %i.%i from L%i extraq\n", d->domain->domain_id,
d->vcpu_id, i);
list_del(list);
list->next = NULL;
ASSERT(!extraq_on(d, i));
@@ -182,7 +182,7 @@ static inline void extraq_add_sort_update(struct exec_domain *d, int i, int sub)
ASSERT(!extraq_on(d,i));
PRINT(3, "Adding domain %i.%i (score= %i, short_pen= %"PRIi64")"
" to L%i extraq\n",
d->domain->id, d->id, EDOM_INFO(d)->score[i],
d->domain->domain_id, d->vcpu_id, EDOM_INFO(d)->score[i],
EDOM_INFO(d)->short_block_lost_tot, i);
/*iterate through all elements to find our "hole" and on our way
update all the other scores*/
@@ -193,8 +193,8 @@ static inline void extraq_add_sort_update(struct exec_domain *d, int i, int sub)
break;
else
PRINT(4,"\tbehind domain %i.%i (score= %i)\n",
curinf->exec_domain->domain->id,
curinf->exec_domain->id, curinf->score[i]);
curinf->exec_domain->domain->domain_id,
curinf->exec_domain->vcpu_id, curinf->score[i]);
}
/*cur now contains the element, before which we'll enqueue*/
PRINT(3, "\tlist_add to %p\n", cur->prev);
@@ -208,23 +208,23 @@ static inline void extraq_add_sort_update(struct exec_domain *d, int i, int sub)
extralist[i]);
curinf->score[i] -= sub;
PRINT(4, "\tupdating domain %i.%i (score= %u)\n",
curinf->exec_domain->domain->id,
curinf->exec_domain->id, curinf->score[i]);
curinf->exec_domain->domain->domain_id,
curinf->exec_domain->vcpu_id, curinf->score[i]);
}
ASSERT(extraq_on(d,i));
}
static inline void extraq_check(struct exec_domain *d) {
if (extraq_on(d, EXTRA_UTIL_Q)) {
PRINT(2,"Dom %i.%i is on L1 extraQ\n",d->domain->id, d->id);
PRINT(2,"Dom %i.%i is on L1 extraQ\n",d->domain->domain_id, d->vcpu_id);
if (!(EDOM_INFO(d)->status & EXTRA_AWARE) &&
!extra_runs(EDOM_INFO(d))) {
extraq_del(d, EXTRA_UTIL_Q);
PRINT(2,"Removed dom %i.%i from L1 extraQ\n",
d->domain->id, d->id);
d->domain->domain_id, d->vcpu_id);
}
} else {
PRINT(2,"Dom %i.%i is NOT on L1 extraQ\n",d->domain->id,
d->id);
PRINT(2,"Dom %i.%i is NOT on L1 extraQ\n",d->domain->domain_id,
d->vcpu_id);
if ((EDOM_INFO(d)->status & EXTRA_AWARE) && sedf_runnable(d))
{
#if (EXTRA == EXTRA_ROUNDR)
@@ -235,8 +235,8 @@ static inline void extraq_check(struct exec_domain *d) {
#elif
;
#endif
PRINT(2,"Added dom %i.%i to L1 extraQ\n",d->domain->id,
d->id);
PRINT(2,"Added dom %i.%i to L1 extraQ\n",d->domain->domain_id,
d->vcpu_id);
}
}
}
@@ -268,7 +268,7 @@ static inline void __del_from_queue(struct exec_domain *d)
struct list_head *list = LIST(d);
ASSERT(__task_on_queue(d));
PRINT(3,"Removing domain %i.%i (bop= %"PRIu64") from runq/waitq\n",
d->domain->id, d->id, PERIOD_BEGIN(EDOM_INFO(d)));
d->domain->domain_id, d->vcpu_id, PERIOD_BEGIN(EDOM_INFO(d)));
list_del(list);
list->next = NULL;
ASSERT(!__task_on_queue(d));
@@ -309,7 +309,7 @@ DOMAIN_COMPARER(waitq, list, PERIOD_BEGIN(d1), PERIOD_BEGIN(d2))
static inline void __add_to_waitqueue_sort(struct exec_domain *d) {
ASSERT(!__task_on_queue(d));
PRINT(3,"Adding domain %i.%i (bop= %"PRIu64") to waitq\n",
d->domain->id, d->id, PERIOD_BEGIN(EDOM_INFO(d)));
d->domain->domain_id, d->vcpu_id, PERIOD_BEGIN(EDOM_INFO(d)));
list_insert_sort(WAITQ(d->processor), LIST(d), waitq_comp);
ASSERT(__task_on_queue(d));
}
@@ -322,7 +322,7 @@ static inline void __add_to_waitqueue_sort(struct exec_domain *d) {
DOMAIN_COMPARER(runq, list, d1->deadl_abs, d2->deadl_abs)
static inline void __add_to_runqueue_sort(struct exec_domain *d) {
PRINT(3,"Adding domain %i.%i (deadl= %"PRIu64") to runq\n",
d->domain->id, d->id, EDOM_INFO(d)->deadl_abs);
d->domain->domain_id, d->vcpu_id, EDOM_INFO(d)->deadl_abs);
list_insert_sort(RUNQ(d->processor), LIST(d), runq_comp);
}
@@ -346,8 +346,8 @@ static int sedf_init_scheduler() {
/* Allocates memory for per domain private scheduling data*/
static int sedf_alloc_task(struct exec_domain *d) {
PRINT(2,"sedf_alloc_task was called, domain-id %i.%i\n",d->domain->id,
d->id);
PRINT(2,"sedf_alloc_task was called, domain-id %i.%i\n",d->domain->domain_id,
d->vcpu_id);
if (d->domain->sched_priv == NULL) {
if ((d->domain->sched_priv =
xmalloc(struct sedf_dom_info)) == NULL )
@@ -366,10 +366,10 @@ static void sedf_add_task(struct exec_domain *d)
struct sedf_edom_info *inf = EDOM_INFO(d);
inf->exec_domain = d;
PRINT(2,"sedf_add_task was called, domain-id %i.%i\n",d->domain->id,
d->id);
PRINT(2,"sedf_add_task was called, domain-id %i.%i\n",d->domain->domain_id,
d->vcpu_id);
if (d->domain->id==0) {
if (d->domain->domain_id==0) {
/*set dom0 to something useful to boot the machine*/
inf->period = MILLISECS(20);
inf->slice = MILLISECS(15);
@@ -391,7 +391,7 @@ static void sedf_add_task(struct exec_domain *d)
INIT_LIST_HEAD(&(inf->extralist[EXTRA_PEN_Q]));
INIT_LIST_HEAD(&(inf->extralist[EXTRA_UTIL_Q]));
if (d->domain->id != IDLE_DOMAIN_ID) {
if (d->domain->domain_id != IDLE_DOMAIN_ID) {
extraq_check(d);
}
}
@@ -400,7 +400,7 @@ static void sedf_add_task(struct exec_domain *d)
static void sedf_free_task(struct domain *d)
{
int i;
PRINT(2,"sedf_free_task was called, domain-id %i\n",d->id);
PRINT(2,"sedf_free_task was called, domain-id %i\n",d->domain_id);
ASSERT(d->sched_priv != NULL);
xfree(d->sched_priv);
@@ -414,14 +414,14 @@ static void sedf_free_task(struct domain *d)
/* Initialises idle task */
static int sedf_init_idle_task(struct exec_domain *d) {
PRINT(2,"sedf_init_idle_task was called, domain-id %i.%i\n",
d->domain->id, d->id);
d->domain->domain_id, d->vcpu_id);
if ( sedf_alloc_task(d) < 0 )
return -1;
sedf_add_task(d);
EDOM_INFO(d)->deadl_abs = 0;
EDOM_INFO(d)->status &= ~SEDF_ASLEEP;
set_bit(EDF_RUNNING, &d->flags);
set_bit(_VCPUF_running, &d->vcpu_flags);
/*the idle task doesn't have to turn up on any list...*/
return 0;
}
@@ -497,7 +497,7 @@ struct list_head* waitq) {
list_for_each_safe(cur, tmp, waitq) {
curinf = list_entry(cur, struct sedf_edom_info, list);
PRINT(4,"\tLooking @ dom %i.%i\n",
curinf->exec_domain->domain->id, curinf->exec_domain->id);
curinf->exec_domain->domain->domain_id, curinf->exec_domain->vcpu_id);
if (PERIOD_BEGIN(curinf) <= now) {
__del_from_queue(curinf->exec_domain);
__add_to_runqueue_sort(curinf->exec_domain);
@@ -512,12 +512,12 @@ struct list_head* waitq) {
list_for_each_safe(cur, tmp, runq) {
curinf = list_entry(cur,struct sedf_edom_info,list);
PRINT(4,"\tLooking @ dom %i.%i\n",
curinf->exec_domain->domain->id, curinf->exec_domain->id);
curinf->exec_domain->domain->domain_id, curinf->exec_domain->vcpu_id);
if (unlikely(curinf->slice == 0)) {
/*ignore domains with empty slice*/
PRINT(4,"\tUpdating zero-slice domain %i.%i\n",
curinf->exec_domain->domain->id,
curinf->exec_domain->id);
curinf->exec_domain->domain->domain_id,
curinf->exec_domain->vcpu_id);
__del_from_queue(curinf->exec_domain);
/*move them to their next period*/
@@ -534,8 +534,8 @@ struct list_head* waitq) {
PRINT(4,"\tDomain %i.%i exceeded it's deadline/"
"slice (%"PRIu64" / %"PRIu64") now: %"PRIu64
" cputime: %"PRIu64"\n",
curinf->exec_domain->domain->id,
curinf->exec_domain->id,
curinf->exec_domain->domain->domain_id,
curinf->exec_domain->vcpu_id,
curinf->deadl_abs, curinf->slice, now,
curinf->cputime);
__del_from_queue(curinf->exec_domain);
@@ -601,11 +601,11 @@ static inline void desched_extra_dom(s_time_t now, struct exec_domain* d) {
/*inf->short_block_lost_tot -= EXTRA_QUANTUM;*/
inf->short_block_lost_tot -= now - inf->sched_start_abs;
PRINT(3,"Domain %i.%i: Short_block_loss: %"PRIi64"\n",
inf->exec_domain->domain->id, inf->exec_domain->id,
inf->exec_domain->domain->domain_id, inf->exec_domain->vcpu_id,
inf->short_block_lost_tot);
if (inf->short_block_lost_tot <= 0) {
PRINT(4,"Domain %i.%i compensated short block loss!\n",
inf->exec_domain->domain->id, inf->exec_domain->id);
inf->exec_domain->domain->domain_id, inf->exec_domain->vcpu_id);
/*we have (over-)compensated our block penalty*/
inf->short_block_lost_tot = 0;
/*we don't want a place on the penalty queue anymore!*/
@@ -808,14 +808,14 @@ sched_done:
}
static void sedf_sleep(struct exec_domain *d) {
PRINT(2,"sedf_sleep was called, domain-id %i.%i\n",d->domain->id, d->id);
PRINT(2,"sedf_sleep was called, domain-id %i.%i\n",d->domain->domain_id, d->vcpu_id);
if (is_idle_task(d->domain))
return;
EDOM_INFO(d)->status |= SEDF_ASLEEP;
if ( test_bit(EDF_RUNNING, &d->flags) ) {
if ( test_bit(_VCPUF_running, &d->vcpu_flags) ) {
#ifdef ADV_SCHED_HISTO
adv_sched_hist_start(d->processor);
#endif
@@ -1140,14 +1140,14 @@ void sedf_wake(struct exec_domain *d) {
s_time_t now = NOW();
struct sedf_edom_info* inf = EDOM_INFO(d);
PRINT(3, "sedf_wake was called, domain-id %i.%i\n",d->domain->id, d->id);
PRINT(3, "sedf_wake was called, domain-id %i.%i\n",d->domain->domain_id, d->vcpu_id);
if (unlikely(is_idle_task(d->domain)))
return;
if ( unlikely(__task_on_queue(d)) ) {
PRINT(3,"\tdomain %i.%i is already in some queue\n",
d->domain->id, d->id);
d->domain->domain_id, d->vcpu_id);
return;
}
ASSERT(!sedf_runnable(d));
@@ -1160,7 +1160,7 @@ void sedf_wake(struct exec_domain *d) {
inf->deadl_abs = now + inf->slice;
PRINT(3,"waking up domain %i.%i (deadl= %"PRIu64" period= %"PRIu64" "\
"now= %"PRIu64")\n", d->domain->id, d->id, inf->deadl_abs,
"now= %"PRIu64")\n", d->domain->domain_id, d->vcpu_id, inf->deadl_abs,
inf->period, now);
#ifdef SEDF_STATS
inf->block_tot++;
@@ -1222,7 +1222,7 @@ void sedf_wake(struct exec_domain *d) {
}
}
PRINT(3,"woke up domain %i.%i (deadl= %"PRIu64" period= %"PRIu64" "\
"now= %"PRIu64")\n", d->domain->id, d->id, inf->deadl_abs,
"now= %"PRIu64")\n", d->domain->domain_id, d->vcpu_id, inf->deadl_abs,
inf->period, now);
if (PERIOD_BEGIN(inf) > now) {
__add_to_waitqueue_sort(d);
@@ -1257,8 +1257,8 @@ void sedf_wake(struct exec_domain *d) {
/*Print a lot of use-{full, less} information about a domains in the system*/
static void sedf_dump_domain(struct exec_domain *d) {
printk("%i.%i has=%c ", d->domain->id, d->id,
test_bit(EDF_RUNNING, &d->flags) ? 'T':'F');
printk("%i.%i has=%c ", d->domain->domain_id, d->vcpu_id,
test_bit(_VCPUF_running, &d->vcpu_flags) ? 'T':'F');
printk("p=%"PRIu64" sl=%"PRIu64" ddl=%"PRIu64" w=%hu c=%"PRIu64" sc=%i xtr(%s)=%"PRIu64" ew=%hu",
EDOM_INFO(d)->period, EDOM_INFO(d)->slice, EDOM_INFO(d)->deadl_abs,
EDOM_INFO(d)->weight, d->cpu_time, EDOM_INFO(d)->score[EXTRA_UTIL_Q],
@@ -1399,7 +1399,7 @@ static int sedf_adjdom(struct domain *p, struct sched_adjdom_cmd *cmd) {
PRINT(2,"sedf_adjdom was called, domain-id %i new period %"PRIu64" "\
"new slice %"PRIu64"\nlatency %"PRIu64" extra:%s\n",
p->id, cmd->u.sedf.period, cmd->u.sedf.slice,
p->domain_id, cmd->u.sedf.period, cmd->u.sedf.slice,
cmd->u.sedf.latency, (cmd->u.sedf.extratime)?"yes":"no");
if ( cmd->direction == SCHED_INFO_PUT )
{
+22 -22
View File
@@ -107,27 +107,27 @@ struct exec_domain *alloc_exec_domain_struct(struct domain *d,
d->exec_domain[vcpu] = ed;
ed->domain = d;
ed->id = vcpu;
ed->vcpu_id = vcpu;
if ( SCHED_OP(alloc_task, ed) < 0 )
goto out;
if ( vcpu != 0 )
{
ed->vcpu_info = &d->shared_info->vcpu_data[ed->id];
ed->vcpu_info = &d->shared_info->vcpu_data[ed->vcpu_id];
for_each_exec_domain( d, edc )
{
if ( (edc->next_in_list == NULL) ||
(edc->next_in_list->id > vcpu) )
(edc->next_in_list->vcpu_id > vcpu) )
break;
}
ed->next_in_list = edc->next_in_list;
edc->next_in_list = ed;
if (test_bit(EDF_CPUPINNED, &edc->flags)) {
if (test_bit(_VCPUF_cpu_pinned, &edc->vcpu_flags)) {
ed->processor = (edc->processor + 1) % smp_num_cpus;
set_bit(EDF_CPUPINNED, &ed->flags);
set_bit(_VCPUF_cpu_pinned, &ed->vcpu_flags);
} else {
ed->processor = (edc->processor + 1) % smp_num_cpus; /* XXX */
}
@@ -169,9 +169,9 @@ void sched_add_domain(struct exec_domain *ed)
struct domain *d = ed->domain;
/* Must be unpaused by control software to start execution. */
set_bit(EDF_CTRLPAUSE, &ed->flags);
set_bit(_VCPUF_ctrl_pause, &ed->vcpu_flags);
if ( d->id != IDLE_DOMAIN_ID )
if ( d->domain_id != IDLE_DOMAIN_ID )
{
/* Initialise the per-domain timer. */
init_ac_timer(&ed->timer);
@@ -185,14 +185,14 @@ void sched_add_domain(struct exec_domain *ed)
}
SCHED_OP(add_task, ed);
TRACE_2D(TRC_SCHED_DOM_ADD, d->id, ed->id);
TRACE_2D(TRC_SCHED_DOM_ADD, d->domain_id, ed->vcpu_id);
}
void sched_rem_domain(struct exec_domain *ed)
{
rem_ac_timer(&ed->timer);
SCHED_OP(rem_task, ed);
TRACE_2D(TRC_SCHED_DOM_REM, ed->domain->id, ed->id);
TRACE_2D(TRC_SCHED_DOM_REM, ed->domain->domain_id, ed->vcpu_id);
}
void init_idle_task(void)
@@ -210,10 +210,10 @@ void domain_sleep(struct exec_domain *ed)
SCHED_OP(sleep, ed);
spin_unlock_irqrestore(&schedule_data[ed->processor].schedule_lock, flags);
TRACE_2D(TRC_SCHED_SLEEP, ed->domain->id, ed->id);
TRACE_2D(TRC_SCHED_SLEEP, ed->domain->domain_id, ed->vcpu_id);
/* Synchronous. */
while ( test_bit(EDF_RUNNING, &ed->flags) && !domain_runnable(ed) )
while ( test_bit(_VCPUF_running, &ed->vcpu_flags) && !domain_runnable(ed) )
cpu_relax();
}
@@ -229,10 +229,10 @@ void domain_wake(struct exec_domain *ed)
ed->wokenup = NOW();
#endif
}
clear_bit(EDF_MIGRATED, &ed->flags);
clear_bit(_VCPUF_cpu_migrated, &ed->vcpu_flags);
spin_unlock_irqrestore(&schedule_data[ed->processor].schedule_lock, flags);
TRACE_2D(TRC_SCHED_WAKE, ed->domain->id, ed->id);
TRACE_2D(TRC_SCHED_WAKE, ed->domain->domain_id, ed->vcpu_id);
}
/* Block the currently-executing domain until a pertinent event occurs. */
@@ -245,16 +245,16 @@ long do_block(void)
#endif
ed->vcpu_info->evtchn_upcall_mask = 0;
set_bit(EDF_BLOCKED, &ed->flags);
set_bit(_VCPUF_blocked, &ed->vcpu_flags);
/* Check for events /after/ blocking: avoids wakeup waiting race. */
if ( event_pending(ed) )
{
clear_bit(EDF_BLOCKED, &ed->flags);
clear_bit(_VCPUF_blocked, &ed->vcpu_flags);
}
else
{
TRACE_2D(TRC_SCHED_BLOCK, ed->domain->id, ed->id);
TRACE_2D(TRC_SCHED_BLOCK, ed->domain->domain_id, ed->vcpu_id);
__enter_scheduler();
}
@@ -268,7 +268,7 @@ static long do_yield(void)
adv_sched_hist_start(current->processor);
#endif
TRACE_2D(TRC_SCHED_YIELD, current->domain->id, current->id);
TRACE_2D(TRC_SCHED_YIELD, current->domain->domain_id, current->vcpu_id);
__enter_scheduler();
return 0;
}
@@ -297,7 +297,7 @@ long do_sched_op(unsigned long op)
case SCHEDOP_shutdown:
{
TRACE_3D(TRC_SCHED_SHUTDOWN, current->domain->id, current->id,
TRACE_3D(TRC_SCHED_SHUTDOWN, current->domain->domain_id, current->vcpu_id,
(op >> SCHEDOP_reasonshift));
domain_shutdown((u8)(op >> SCHEDOP_reasonshift));
break;
@@ -400,7 +400,7 @@ long sched_adjdom(struct sched_adjdom_cmd *cmd)
spin_unlock(&schedule_data[cpu].schedule_lock);
__clear_cpu_bits(have_lock);
TRACE_1D(TRC_SCHED_ADJDOM, d->id);
TRACE_1D(TRC_SCHED_ADJDOM, d->domain_id);
put_domain(d);
return 0;
}
@@ -451,7 +451,7 @@ static void __enter_scheduler(void)
add_ac_timer(&schedule_data[cpu].s_timer);
/* Must be protected by the schedule_lock! */
set_bit(EDF_RUNNING, &next->flags);
set_bit(_VCPUF_running, &next->vcpu_flags);
spin_unlock_irq(&schedule_data[cpu].schedule_lock);
@@ -492,8 +492,8 @@ static void __enter_scheduler(void)
}
TRACE_4D(TRC_SCHED_SWITCH,
prev->domain->id, prev->id,
next->domain->id, next->id);
prev->domain->domain_id, prev->vcpu_id,
next->domain->domain_id, next->vcpu_id);
#ifdef ADV_SCHED_HISTO
adv_sched_hist_to_stop(cpu);
+1 -1
View File
@@ -303,7 +303,7 @@ long do_console_io(int cmd, int count, char *buffer)
#ifndef VERBOSE
/* Only domain-0 may access the emergency console. */
if ( current->domain->id != 0 )
if ( current->domain->domain_id != 0 )
return -EPERM;
#endif
+46 -35
View File
@@ -27,7 +27,7 @@
#define _ASM_ACPI_H
#include <xen/config.h>
#include <asm/system.h>
#include <asm/system.h> /* defines cmpxchg */
#define COMPILER_DEPENDENT_INT64 long long
#define COMPILER_DEPENDENT_UINT64 unsigned long long
@@ -49,8 +49,8 @@
#define ACPI_ASM_MACROS
#define BREAKPOINT3
#define ACPI_DISABLE_IRQS() __cli()
#define ACPI_ENABLE_IRQS() __sti()
#define ACPI_DISABLE_IRQS() local_irq_disable()
#define ACPI_ENABLE_IRQS() local_irq_enable()
#define ACPI_FLUSH_CPU_CACHE() wbinvd()
@@ -100,6 +100,11 @@ __acpi_release_global_lock (unsigned int *lock)
:"=r"(n_hi), "=r"(n_lo) \
:"0"(n_hi), "1"(n_lo))
/*
* Refer Intel ACPI _PDC support document for bit definitions
*/
#define ACPI_PDC_EST_CAPABILITY_SMP 0xa
#define ACPI_PDC_EST_CAPABILITY_MSR 0x1
#ifdef CONFIG_ACPI_BOOT
extern int acpi_lapic;
@@ -108,47 +113,53 @@ extern int acpi_noirq;
extern int acpi_strict;
extern int acpi_disabled;
extern int acpi_ht;
static inline void disable_acpi(void) { acpi_disabled = 1; acpi_ht = 0; }
extern int acpi_pci_disabled;
static inline void disable_acpi(void)
{
acpi_disabled = 1;
acpi_ht = 0;
acpi_pci_disabled = 1;
acpi_noirq = 1;
}
/* Fixmap pages to reserve for ACPI boot-time tables (see fixmap.h) */
#define FIX_ACPI_PAGES 4
#else /* !CONFIG_ACPI_BOOT */
extern int acpi_gsi_to_irq(u32 gsi, unsigned int *irq);
#ifdef CONFIG_X86_IO_APIC
extern int skip_ioapic_setup;
extern int acpi_skip_timer_override;
extern void check_acpi_pci(void);
static inline void disable_ioapic_setup(void)
{
skip_ioapic_setup = 1;
}
static inline int ioapic_setup_disabled(void)
{
return skip_ioapic_setup;
}
#else
static inline void disable_ioapic_setup(void) { }
static inline void check_acpi_pci(void) { }
#endif
#else /* CONFIG_ACPI_BOOT */
# define acpi_lapic 0
# define acpi_ioapic 0
#endif /* !CONFIG_ACPI_BOOT */
#ifdef CONFIG_ACPI_PCI
static inline void acpi_noirq_set(void) { acpi_noirq = 1; }
extern int acpi_irq_balance_set(char *str);
#else
static inline void acpi_noirq_set(void) { }
static inline int acpi_irq_balance_set(char *str) { return 0; }
#endif
static inline void acpi_noirq_set(void) { acpi_noirq = 1; }
static inline int acpi_irq_balance_set(char *str) { return 0; }
#ifdef CONFIG_ACPI_SLEEP
extern unsigned long saved_eip;
extern unsigned long saved_esp;
extern unsigned long saved_ebp;
extern unsigned long saved_ebx;
extern unsigned long saved_esi;
extern unsigned long saved_edi;
static inline void acpi_save_register_state(unsigned long return_point)
{
saved_eip = return_point;
asm volatile ("movl %%esp,(%0)" : "=m" (saved_esp));
asm volatile ("movl %%ebp,(%0)" : "=m" (saved_ebp));
asm volatile ("movl %%ebx,(%0)" : "=m" (saved_ebx));
asm volatile ("movl %%edi,(%0)" : "=m" (saved_edi));
asm volatile ("movl %%esi,(%0)" : "=m" (saved_esi));
}
#define acpi_restore_register_state() do {} while (0)
/* routines for saving/restoring kernel state */
extern int acpi_save_state_mem(void);
extern int acpi_save_state_disk(void);
@@ -156,11 +167,11 @@ extern void acpi_restore_state_mem(void);
extern unsigned long acpi_wakeup_address;
extern void do_suspend_lowlevel_s4bios(int resume);
/* early initialization routine */
extern void acpi_reserve_bootmem(void);
#endif /*CONFIG_ACPI_SLEEP*/
extern u8 x86_acpiid_to_apicid[];
#endif /*_ASM_ACPI_H*/
+2 -2
View File
@@ -275,9 +275,9 @@ extern unsigned long _end; /* standard ELF symbol */
extern unsigned long xenheap_phys_end; /* user-configurable */
#endif
#define GDT_VIRT_START(ed) (PERDOMAIN_VIRT_START + ((ed)->id << PDPT_VCPU_VA_SHIFT))
#define GDT_VIRT_START(ed) (PERDOMAIN_VIRT_START + ((ed)->vcpu_id << PDPT_VCPU_VA_SHIFT))
#define GDT_VIRT_END(ed) (GDT_VIRT_START(ed) + (64*1024))
#define LDT_VIRT_START(ed) (PERDOMAIN_VIRT_START + (64*1024) + ((ed)->id << PDPT_VCPU_VA_SHIFT))
#define LDT_VIRT_START(ed) (PERDOMAIN_VIRT_START + (64*1024) + ((ed)->vcpu_id << PDPT_VCPU_VA_SHIFT))
#define LDT_VIRT_END(ed) (LDT_VIRT_START(ed) + (64*1024))
#define PDPT_VCPU_SHIFT 5
+2 -2
View File
@@ -62,14 +62,14 @@ static inline int debugger_trap_entry(
{
struct exec_domain *ed = current;
if ( !KERNEL_MODE(ed, regs) || (ed->domain->id == 0) )
if ( !KERNEL_MODE(ed, regs) || (ed->domain->domain_id == 0) )
return 0;
switch ( vector )
{
case TRAP_int3:
case TRAP_debug:
set_bit(EDF_CTRLPAUSE, &ed->flags);
set_bit(_VCPUF_ctrl_pause, &ed->vcpu_flags);
raise_softirq(SCHEDULE_SOFTIRQ);
return 1;
}
+1 -1
View File
@@ -30,7 +30,7 @@ struct arch_domain
/* Shadow mode status and controls. */
unsigned int shadow_mode; /* flags to control shadow table operation */
spinlock_t shadow_lock;
unsigned int shadow_nest; /* Recursive depth of shadow_lock() nesting */
/* Shadow mode has tainted page reference counts? */
unsigned int shadow_tainted_refcnts;
+13 -1
View File
@@ -19,7 +19,7 @@ extern void save_init_fpu(struct exec_domain *tsk);
extern void restore_fpu(struct exec_domain *tsk);
#define unlazy_fpu(_tsk) do { \
if ( test_bit(EDF_USEDFPU, &(_tsk)->flags) ) \
if ( test_bit(_VCPUF_fpu_dirtied, &(_tsk)->vcpu_flags) ) \
save_init_fpu(_tsk); \
} while ( 0 )
@@ -28,4 +28,16 @@ extern void restore_fpu(struct exec_domain *tsk);
__asm__ __volatile__ ( "ldmxcsr %0" : : "m" (__mxcsr) ); \
} while ( 0 )
/* Make domain the FPU owner */
static inline void setup_fpu(struct exec_domain *ed)
{
if ( !test_and_set_bit(_VCPUF_fpu_dirtied, &ed->vcpu_flags) )
{
if ( test_bit(_VCPUF_fpu_initialised, &ed->vcpu_flags) )
restore_fpu(ed);
else
init_fpu();
}
}
#endif /* __ASM_I386_I387_H */
+52 -15
View File
@@ -60,9 +60,45 @@
#define __linear_hl2_table ((l1_pgentry_t *)(LINEAR_PT_VIRT_START + \
(PERDOMAIN_VIRT_START >> (L2_PAGETABLE_SHIFT - L1_PAGETABLE_SHIFT))))
#define shadow_lock_init(_d) spin_lock_init(&(_d)->arch.shadow_lock)
#define shadow_lock(_d) do { ASSERT(!spin_is_locked(&(_d)->arch.shadow_lock)); spin_lock(&(_d)->arch.shadow_lock); } while (0)
#define shadow_unlock(_d) spin_unlock(&(_d)->arch.shadow_lock)
/*
* For now we use the per-domain BIGLOCK rather than a shadow-specific lock.
* We usually have the BIGLOCK already acquired anyway, so this is unlikely
* to cause much unnecessary extra serialisation. Also it's a recursive
* lock, and there are some code paths containing nested shadow_lock().
* The #if0'ed code below is therefore broken until such nesting is removed.
*/
#if 0
#define shadow_lock_init(_d) \
spin_lock_init(&(_d)->arch.shadow_lock)
#define shadow_lock_is_acquired(_d) \
spin_is_locked(&(_d)->arch.shadow_lock)
#define shadow_lock(_d) \
do { \
ASSERT(!shadow_lock_is_acquired(_d)); \
spin_lock(&(_d)->arch.shadow_lock); \
} while (0)
#define shadow_unlock(_d) \
do { \
ASSERT(!shadow_lock_is_acquired(_d)); \
spin_unlock(&(_d)->arch.shadow_lock); \
} while (0)
#else
#define shadow_lock_init(_d) \
((_d)->arch.shadow_nest = 0)
#define shadow_lock_is_acquired(_d) \
(spin_is_locked(&(_d)->big_lock) && ((_d)->arch.shadow_nest != 0))
#define shadow_lock(_d) \
do { \
LOCK_BIGLOCK(_d); \
(_d)->arch.shadow_nest++; \
} while (0)
#define shadow_unlock(_d) \
do { \
ASSERT(shadow_lock_is_acquired(_d)); \
(_d)->arch.shadow_nest--; \
UNLOCK_BIGLOCK(_d); \
} while (0)
#endif
#define SHADOW_ENCODE_MIN_MAX(_min, _max) ((((L1_PAGETABLE_ENTRIES - 1) - (_max)) << 16) | (_min))
#define SHADOW_MIN(_encoded) ((_encoded) & ((1u<<16) - 1))
@@ -281,7 +317,7 @@ extern int shadow_status_noswap;
#ifdef VERBOSE
#define SH_LOG(_f, _a...) \
printk("DOM%uP%u: SH_LOG(%d): " _f "\n", \
current->domain->id , current->processor, __LINE__ , ## _a )
current->domain->domain_id , current->processor, __LINE__ , ## _a )
#else
#define SH_LOG(_f, _a...) ((void)0)
#endif
@@ -289,7 +325,7 @@ extern int shadow_status_noswap;
#if SHADOW_VERBOSE_DEBUG
#define SH_VLOG(_f, _a...) \
printk("DOM%uP%u: SH_VLOG(%d): " _f "\n", \
current->domain->id, current->processor, __LINE__ , ## _a )
current->domain->domain_id, current->processor, __LINE__ , ## _a )
#else
#define SH_VLOG(_f, _a...) ((void)0)
#endif
@@ -297,7 +333,7 @@ extern int shadow_status_noswap;
#if SHADOW_VVERBOSE_DEBUG
#define SH_VVLOG(_f, _a...) \
printk("DOM%uP%u: SH_VVLOG(%d): " _f "\n", \
current->domain->id, current->processor, __LINE__ , ## _a )
current->domain->domain_id, current->processor, __LINE__ , ## _a )
#else
#define SH_VVLOG(_f, _a...) ((void)0)
#endif
@@ -305,7 +341,7 @@ extern int shadow_status_noswap;
#if SHADOW_VVVERBOSE_DEBUG
#define SH_VVVLOG(_f, _a...) \
printk("DOM%uP%u: SH_VVVLOG(%d): " _f "\n", \
current->domain->id, current->processor, __LINE__ , ## _a )
current->domain->domain_id, current->processor, __LINE__ , ## _a )
#else
#define SH_VVVLOG(_f, _a...) ((void)0)
#endif
@@ -313,7 +349,7 @@ extern int shadow_status_noswap;
#if FULLSHADOW_DEBUG
#define FSH_LOG(_f, _a...) \
printk("DOM%uP%u: FSH_LOG(%d): " _f "\n", \
current->domain->id, current->processor, __LINE__ , ## _a )
current->domain->domain_id, current->processor, __LINE__ , ## _a )
#else
#define FSH_LOG(_f, _a...) ((void)0)
#endif
@@ -348,7 +384,8 @@ shadow_get_page_from_l1e(l1_pgentry_t l1e, struct domain *d)
res = get_page_from_l1e(nl1e, owner);
printk("tried to map mfn %lx from domain %d into shadow page tables "
"of domain %d; %s\n",
mfn, owner->id, d->id, res ? "success" : "failed");
mfn, owner->domain_id, d->domain_id,
res ? "success" : "failed");
}
if ( unlikely(!res) )
@@ -403,7 +440,7 @@ static inline int __mark_dirty(struct domain *d, unsigned int mfn)
unsigned long pfn;
int rc = 0;
ASSERT(spin_is_locked(&d->arch.shadow_lock));
ASSERT(shadow_lock_is_acquired(d));
ASSERT(d->arch.shadow_dirty_bitmap != NULL);
if ( !VALID_MFN(mfn) )
@@ -1137,7 +1174,7 @@ static inline unsigned long __shadow_status(
? __gpfn_to_mfn(d, gpfn)
: INVALID_MFN);
ASSERT(spin_is_locked(&d->arch.shadow_lock));
ASSERT(shadow_lock_is_acquired(d));
ASSERT(gpfn == (gpfn & PGT_mfn_mask));
ASSERT(stype && !(stype & ~PGT_type_mask));
@@ -1153,7 +1190,7 @@ static inline unsigned long __shadow_status(
{
printk("d->id=%d gpfn=%lx gmfn=%lx stype=%lx c=%x t=%x "
"mfn_out_of_sync(gmfn)=%d mfn_is_page_table(gmfn)=%d\n",
d->id, gpfn, gmfn, stype,
d->domain_id, gpfn, gmfn, stype,
frame_table[gmfn].count_info,
frame_table[gmfn].u.inuse.type_info,
mfn_out_of_sync(gmfn), mfn_is_page_table(gmfn));
@@ -1186,7 +1223,7 @@ shadow_max_pgtable_type(struct domain *d, unsigned long gpfn,
struct shadow_status *x;
u32 pttype = PGT_none, type;
ASSERT(spin_is_locked(&d->arch.shadow_lock));
ASSERT(shadow_lock_is_acquired(d));
ASSERT(gpfn == (gpfn & PGT_mfn_mask));
perfc_incrc(shadow_max_type);
@@ -1280,7 +1317,7 @@ static inline void delete_shadow_status(
struct shadow_status *p, *x, *n, *head;
unsigned long key = gpfn | stype;
ASSERT(spin_is_locked(&d->arch.shadow_lock));
ASSERT(shadow_lock_is_acquired(d));
ASSERT(!(gpfn & ~PGT_mfn_mask));
ASSERT(stype && !(stype & ~PGT_type_mask));
@@ -1362,7 +1399,7 @@ static inline void set_shadow_status(
SH_VVLOG("set gpfn=%lx gmfn=%lx smfn=%lx t=%lx", gpfn, gmfn, smfn, stype);
ASSERT(spin_is_locked(&d->arch.shadow_lock));
ASSERT(shadow_lock_is_acquired(d));
ASSERT(shadow_mode_translate(d) || gpfn);
ASSERT(!(gpfn & ~PGT_mfn_mask));
+16
View File
@@ -24,6 +24,7 @@
#include <asm/regs.h>
#include <asm/processor.h>
#include <asm/vmx_vmcs.h>
#include <asm/i387.h>
extern void vmx_asm_vmexit_handler(struct cpu_user_regs);
extern void vmx_asm_do_resume(void);
@@ -251,4 +252,19 @@ static inline int __vmxon (u64 addr)
return 0;
}
/* Make sure that xen intercepts any FP accesses from current */
static inline void vmx_stts()
{
unsigned long cr0;
__vmread(GUEST_CR0, &cr0);
if (!(cr0 & X86_CR0_TS))
__vmwrite(GUEST_CR0, cr0 | X86_CR0_TS);
__vmread(CR0_READ_SHADOW, &cr0);
if (!(cr0 & X86_CR0_TS))
__vmwrite(EXCEPTION_BITMAP, MONITOR_DEFAULT_EXCEPTION_BITMAP |
EXCEPTION_BITMAP_NM);
}
#endif /* __ASM_X86_VMX_H__ */
+17 -7
View File
@@ -19,7 +19,7 @@
* This makes sure that old versions of dom0 tools will stop working in a
* well-defined way (rather than crashing the machine, for instance).
*/
#define DOM0_INTERFACE_VERSION 0xAAAA1004
#define DOM0_INTERFACE_VERSION 0xAAAA1005
/************************************************************************/
@@ -70,7 +70,6 @@ typedef struct {
typedef struct {
/* IN variables. */
domid_t domain; /* NB. IN/OUT variable. */
u16 exec_domain;
/* OUT variables. */
#define DOMFLAGS_DYING (1<<0) /* Domain is scheduled to die. */
#define DOMFLAGS_CRASHED (1<<1) /* Crashed domain; frozen for postmortem. */
@@ -83,18 +82,20 @@ typedef struct {
#define DOMFLAGS_SHUTDOWNMASK 255 /* DOMFLAGS_SHUTDOWN guest-supplied code. */
#define DOMFLAGS_SHUTDOWNSHIFT 16
u32 flags;
vcpu_guest_context_t *ctxt; /* NB. IN/OUT variable. */
memory_t tot_pages;
memory_t max_pages;
memory_t shared_info_frame; /* MFN of shared_info struct */
u64 cpu_time;
u32 n_vcpu;
s32 vcpu_to_cpu[MAX_VIRT_CPUS]; /* current mapping */
cpumap_t cpumap[MAX_VIRT_CPUS]; /* allowable mapping */
} dom0_getdomaininfo_t;
#define DOM0_SETDOMAININFO 13
typedef struct {
/* IN variables. */
domid_t domain;
u16 exec_domain;
u16 vcpu;
/* IN/OUT parameters */
vcpu_guest_context_t *ctxt;
} dom0_setdomaininfo_t;
@@ -170,14 +171,14 @@ typedef struct {
} dom0_readconsole_t;
/*
* Pin Domain to a particular CPU (use -1 to unpin)
* Set which physical cpus a vcpu can execute on.
*/
#define DOM0_PINCPUDOMAIN 20
typedef struct {
/* IN variables. */
domid_t domain;
u16 exec_domain;
s32 cpu; /* -1 implies unpin */
u16 vcpu;
cpumap_t *cpumap;
} dom0_pincpudomain_t;
/* Get trace buffers machine base address */
@@ -342,6 +343,14 @@ typedef struct {
u16 allow_access; /* allow or deny access to range? */
} dom0_ioport_permission_t;
#define DOM0_GETVCPUCONTEXT 37
typedef struct {
domid_t domain; /* domain to be affected */
u16 vcpu; /* vcpu # */
vcpu_guest_context_t *ctxt; /* NB. IN/OUT variable. */
u64 cpu_time;
} dom0_getvcpucontext_t;
typedef struct {
u32 cmd;
u32 interface_version; /* DOM0_INTERFACE_VERSION */
@@ -373,6 +382,7 @@ typedef struct {
dom0_perfccontrol_t perfccontrol;
dom0_microcode_t microcode;
dom0_ioport_permission_t ioport_permission;
dom0_getvcpucontext_t getvcpucontext;
} u;
} dom0_op_t;
+2
View File
@@ -473,6 +473,8 @@ typedef struct {
/* For use in guest OSes. */
extern shared_info_t *HYPERVISOR_shared_info;
typedef u64 cpumap_t;
#endif /* !__ASSEMBLY__ */
#endif /* __XEN_PUBLIC_XEN_H__ */
+3 -3
View File
@@ -35,15 +35,15 @@ static inline void evtchn_set_pending(struct exec_domain *ed, int port)
set_bit(0, &ed->vcpu_info->evtchn_upcall_pending);
/*
* NB1. 'flags' and 'processor' must be checked /after/ update of
* NB1. 'vcpu_flags' and 'processor' must be checked /after/ update of
* pending flag. These values may fluctuate (after all, we hold no
* locks) but the key insight is that each change will cause
* evtchn_upcall_pending to be polled.
*
* NB2. We save DF_RUNNING across the unblock to avoid a needless
* NB2. We save VCPUF_running across the unblock to avoid a needless
* IPI for domains that we IPI'd to unblock.
*/
running = test_bit(EDF_RUNNING, &ed->flags);
running = test_bit(_VCPUF_running, &ed->vcpu_flags);
exec_domain_unblock(ed);
if ( running )
smp_send_event_check_cpu(ed->processor);
+5 -5
View File
@@ -59,13 +59,17 @@ extern initcall_t __initcall_start, __initcall_end;
*/
struct kernel_param {
const char *name;
enum { OPT_STR, OPT_UINT, OPT_UINT_UNIT, OPT_BOOL } type;
enum { OPT_STR, OPT_UINT, OPT_BOOL, OPT_CUSTOM } type;
void *var;
unsigned int len;
};
extern struct kernel_param __setup_start, __setup_end;
#define custom_param(_name, _var) \
static char __setup_str_##_var[] __initdata = _name; \
static struct kernel_param __setup_##_var __attribute_used__ \
__initsetup = { __setup_str_##_var, OPT_CUSTOM, &_var, 0 }
#define boolean_param(_name, _var) \
static char __setup_str_##_var[] __initdata = _name; \
static struct kernel_param __setup_##_var __attribute_used__ \
@@ -74,10 +78,6 @@ extern struct kernel_param __setup_start, __setup_end;
static char __setup_str_##_var[] __initdata = _name; \
static struct kernel_param __setup_##_var __attribute_used__ \
__initsetup = { __setup_str_##_var, OPT_UINT, &_var, sizeof(_var) }
#define integer_unit_param(_name, _var) \
static char __setup_str_##_var[] __initdata = _name; \
static struct kernel_param __setup_##_var __attribute_used__ \
__initsetup = { __setup_str_##_var, OPT_UINT_UNIT, &_var, sizeof(_var) }
#define string_param(_name, _var) \
static char __setup_str_##_var[] __initdata = _name; \
static struct kernel_param __setup_##_var __attribute_used__ \
+10 -3
View File
@@ -57,8 +57,15 @@ extern int snprintf(char * buf, size_t size, const char * fmt, ...)
__attribute__ ((format (printf, 3, 4)));
extern int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
long simple_strtol(const char *cp,char **endp,unsigned int base);
unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base);
long long simple_strtoll(const char *cp,char **endp,unsigned int base);
long simple_strtol(
const char *cp,char **endp, unsigned int base);
unsigned long simple_strtoul(
const char *cp,char **endp, unsigned int base);
long long simple_strtoll(
const char *cp,char **endp, unsigned int base);
unsigned long long simple_strtoull(
const char *cp,char **endp, unsigned int base);
unsigned long long memparse(char *s);
#endif /* __LIB_H__ */
+73 -30
View File
@@ -58,9 +58,11 @@ int init_event_channels(struct domain *d);
void destroy_event_channels(struct domain *d);
int init_exec_domain_event_channels(struct exec_domain *ed);
#define CPUMAP_RUNANYWHERE 0xFFFFFFFF
struct exec_domain
{
int id;
int vcpu_id;
int processor;
@@ -78,12 +80,14 @@ struct exec_domain
s_time_t wokenup; /* time domain got woken up */
void *sched_priv; /* scheduler-specific data */
unsigned long flags;
unsigned long vcpu_flags;
u16 virq_to_evtchn[NR_VIRQS];
atomic_t pausecnt;
cpumap_t cpumap; /* which cpus this domain can run on */
struct arch_exec_domain arch;
};
@@ -93,7 +97,7 @@ struct exec_domain
struct domain
{
domid_t id;
domid_t domain_id;
shared_info_t *shared_info; /* shared data area */
spinlock_t time_lock;
@@ -109,7 +113,7 @@ struct domain
unsigned int xenheap_pages; /* # pages allocated from Xen heap */
/* Scheduling. */
int shutdown_code; /* code value from OS (if DF_SHUTDOWN). */
int shutdown_code; /* code value from OS (if DOMF_shutdown) */
void *sched_priv; /* scheduler-specific data */
struct domain *next_in_list;
@@ -131,7 +135,7 @@ struct domain
u16 pirq_to_evtchn[NR_PIRQS];
u32 pirq_mask[NR_PIRQS/32];
unsigned long flags;
unsigned long domain_flags;
unsigned long vm_assist;
atomic_t refcnt;
@@ -168,7 +172,7 @@ extern struct exec_domain idle0_exec_domain;
extern struct exec_domain *idle_task[NR_CPUS];
#define IDLE_DOMAIN_ID (0x7FFFU)
#define is_idle_task(_p) (test_bit(DF_IDLETASK, &(_p)->flags))
#define is_idle_task(_d) (test_bit(_DOMF_idle_domain, &(_d)->domain_flags))
struct exec_domain *alloc_exec_domain_struct(struct domain *d,
unsigned long vcpu);
@@ -324,29 +328,67 @@ extern struct domain *domain_list;
(_ed) != NULL; \
(_ed) = (_ed)->next_in_list )
#define EDF_DONEFPUINIT 0 /* Has the FPU been initialised for this task? */
#define EDF_USEDFPU 1 /* Has this task used the FPU since last save? */
#define EDF_GUEST_STTS 2 /* Has the guest OS requested 'stts'? */
#define EDF_BLOCKED 3 /* Domain is blocked waiting for an event. */
#define EDF_CTRLPAUSE 4 /* Domain is paused by controller software. */
#define EDF_RUNNING 5 /* Currently running on a CPU. */
#define EDF_CPUPINNED 6 /* Disables auto-migration. */
#define EDF_MIGRATED 7 /* Domain migrated between CPUs. */
#define EDF_DONEINIT 8 /* Initialization completed . */
/*
* Per-VCPU flags (vcpu_flags).
*/
/* Has the FPU been initialised? */
#define _VCPUF_fpu_initialised 0
#define VCPUF_fpu_initialised (1UL<<_VCPUF_fpu_initialised)
/* Has the FPU been used since it was last saved? */
#define _VCPUF_fpu_dirtied 1
#define VCPUF_fpu_dirtied (1UL<<_VCPUF_fpu_dirtied)
/* Has the guest OS requested 'stts'? */
#define _VCPUF_guest_stts 2
#define VCPUF_guest_stts (1UL<<_VCPUF_guest_stts)
/* Domain is blocked waiting for an event. */
#define _VCPUF_blocked 3
#define VCPUF_blocked (1UL<<_VCPUF_blocked)
/* Domain is paused by controller software. */
#define _VCPUF_ctrl_pause 4
#define VCPUF_ctrl_pause (1UL<<_VCPUF_ctrl_pause)
/* Currently running on a CPU? */
#define _VCPUF_running 5
#define VCPUF_running (1UL<<_VCPUF_running)
/* Disables auto-migration between CPUs. */
#define _VCPUF_cpu_pinned 6
#define VCPUF_cpu_pinned (1UL<<_VCPUF_cpu_pinned)
/* Domain migrated between CPUs. */
#define _VCPUF_cpu_migrated 7
#define VCPUF_cpu_migrated (1UL<<_VCPUF_cpu_migrated)
/* Initialization completed. */
#define _VCPUF_initialised 8
#define VCPUF_initialised (1UL<<_VCPUF_initialised)
#define DF_CONSTRUCTED 0 /* Has the guest OS been fully built yet? */
#define DF_IDLETASK 1 /* Is this one of the per-CPU idle domains? */
#define DF_PRIVILEGED 2 /* Is this domain privileged? */
#define DF_PHYSDEV 3 /* May this domain do IO to physical devices? */
#define DF_SHUTDOWN 4 /* Guest shut itself down for some reason. */
#define DF_CRASHED 5 /* Domain crashed inside Xen, cannot continue. */
#define DF_DYING 6 /* Death rattle. */
/*
* Per-domain flags (domain_flags).
*/
/* Has the guest OS been fully built yet? */
#define _DOMF_constructed 0
#define DOMF_constructed (1UL<<_DOMF_constructed)
/* Is this one of the per-CPU idle domains? */
#define _DOMF_idle_domain 1
#define DOMF_idle_domain (1UL<<_DOMF_idle_domain)
/* Is this domain privileged? */
#define _DOMF_privileged 2
#define DOMF_privileged (1UL<<_DOMF_privileged)
/* May this domain do IO to physical devices? */
#define _DOMF_physdev_access 3
#define DOMF_physdev_access (1UL<<_DOMF_physdev_access)
/* Guest shut itself down for some reason. */
#define _DOMF_shutdown 4
#define DOMF_shutdown (1UL<<_DOMF_shutdown)
/* Domain has crashed and cannot continue to execute. */
#define _DOMF_crashed 5
#define DOMF_crashed (1UL<<_DOMF_crashed)
/* Death rattle. */
#define _DOMF_dying 6
#define DOMF_dying (1UL<<_DOMF_dying)
static inline int domain_runnable(struct exec_domain *ed)
{
return ( (atomic_read(&ed->pausecnt) == 0) &&
!(ed->flags & ((1<<EDF_BLOCKED)|(1<<EDF_CTRLPAUSE))) &&
!(ed->domain->flags & ((1<<DF_SHUTDOWN)|(1<<DF_CRASHED))) );
!(ed->vcpu_flags & (VCPUF_blocked|VCPUF_ctrl_pause)) &&
!(ed->domain->domain_flags & (DOMF_shutdown|DOMF_crashed)) );
}
static inline void exec_domain_pause(struct exec_domain *ed)
@@ -388,7 +430,7 @@ static inline void domain_unpause(struct domain *d)
static inline void exec_domain_unblock(struct exec_domain *ed)
{
if ( test_and_clear_bit(EDF_BLOCKED, &ed->flags) )
if ( test_and_clear_bit(_VCPUF_blocked, &ed->vcpu_flags) )
domain_wake(ed);
}
@@ -399,7 +441,7 @@ static inline void domain_pause_by_systemcontroller(struct domain *d)
for_each_exec_domain ( d, ed )
{
ASSERT(ed != current);
if ( !test_and_set_bit(EDF_CTRLPAUSE, &ed->flags) )
if ( !test_and_set_bit(_VCPUF_ctrl_pause, &ed->vcpu_flags) )
domain_sleep(ed);
}
@@ -412,14 +454,15 @@ static inline void domain_unpause_by_systemcontroller(struct domain *d)
for_each_exec_domain ( d, ed )
{
if ( test_and_clear_bit(EDF_CTRLPAUSE, &ed->flags) )
if ( test_and_clear_bit(_VCPUF_ctrl_pause, &ed->vcpu_flags) )
domain_wake(ed);
}
}
#define IS_PRIV(_d) (test_bit(DF_PRIVILEGED, &(_d)->flags))
#define IS_CAPABLE_PHYSDEV(_d) (test_bit(DF_PHYSDEV, &(_d)->flags))
#define IS_PRIV(_d) \
(test_bit(_DOMF_privileged, &(_d)->domain_flags))
#define IS_CAPABLE_PHYSDEV(_d) \
(test_bit(_DOMF_physdev_access, &(_d)->domain_flags))
#define VM_ASSIST(_d,_t) (test_bit((_t), &(_d)->vm_assist))
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.