Hi all, Here is the long overdue patch series to bring support for a Linux based stubdom which will enable to use QEMU upstream as device model in a stubdom. The first three patches will provide the necessary to build Linux and a disk image for the stubdomain itself. This is created in a separated directory "stubdom-linux". Calling `make` in this directory will build Linux and the disk. Then a `make install` will copy the two files to the same directory as the MiniOS use. The last three patches are the libxl support. There is a field called "stubdomain_version" which is automatically set to the appropriate value, depending on the QEMU version used. It call also be set from VM config file. So, to start a Linux stubdomain, just set those two variables and it shoud start: device_model_stubdomain_override = 1 device_model_version = "qemu-xen" There is few things that does not have support yet and are on my todo list: - video output - save/restore So for now, we have the network and the console and the disk of the domain. Regards, Anthony PERARD (6): linux-stubdomain: Compile QEMU linux-stubdomain: Compile Linux linux-stubdomain: Build a disk image. libxl: Add "stubdomain_version" to domain_build_info. libxl: Handle Linux stubdomain specifique QEMU option. libxl: Build the domain with a Linux based stubdomain. stubdom-linux/.gitignore | 5 + ...heck-for-xen_initial_domain-in-privcmd_io.patch | 39 + stubdom-linux/0002-fix-remap_area_mfn_pte_fn.patch | 36 + stubdom-linux/Makefile | 83 ++ stubdom-linux/extra/initscript | 40 + stubdom-linux/extra/qemu-ifup | 7 + stubdom-linux/mk-ramdisk-common | 178 +++ stubdom-linux/mk-ramdisk-ioemu | 124 ++ stubdom-linux/stubdom-linux-config-64b | 1185 ++++++++++++++++++++ tools/libxl/libxl.c | 25 +- tools/libxl/libxl_create.c | 41 +- tools/libxl/libxl_dm.c | 178 ++- tools/libxl/libxl_internal.c | 22 + tools/libxl/libxl_internal.h | 4 + tools/libxl/libxl_types.idl | 7 + tools/libxl/xl_cmdimpl.c | 14 + 16 files changed, 1944 insertions(+), 44 deletions(-) create mode 100644 stubdom-linux/.gitignore create mode 100644 stubdom-linux/0001-xen-Don-t-check-for-xen_initial_domain-in-privcmd_io.patch create mode 100644 stubdom-linux/0002-fix-remap_area_mfn_pte_fn.patch create mode 100644 stubdom-linux/Makefile create mode 100644 stubdom-linux/extra/initscript create mode 100644 stubdom-linux/extra/qemu-ifup create mode 100755 stubdom-linux/mk-ramdisk-common create mode 100755 stubdom-linux/mk-ramdisk-ioemu create mode 100644 stubdom-linux/stubdom-linux-config-64b -- Anthony PERARD
This patch add a Makefile which is able to compile QEMU for a stubdomain base on a Linux kernel. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> --- stubdom-linux/Makefile | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 stubdom-linux/Makefile diff --git a/stubdom-linux/Makefile b/stubdom-linux/Makefile new file mode 100644 index 0000000..3c02ccd --- /dev/null +++ b/stubdom-linux/Makefile @@ -0,0 +1,49 @@ +XEN_ROOT = $(CURDIR)/.. + +include $(XEN_ROOT)/Config.mk + +# Qemu tree used +QEMU_TREE=git://xenbits.xen.org/people/aperard/qemu-dm.git +QEMU_BRANCH=origin/stubdom-preview1 + +all: + +qemu-remote: + export GIT=$(GIT); \ + $(XEN_ROOT)/scripts/git-checkout.sh $(QEMU_TREE) $(QEMU_BRANCH) qemu-remote + +qemu-build/Makefile: qemu-remote + mkdir -p qemu-build + cd qemu-build && ../qemu-remote/configure \ + --target-list=i386-softmmu \ + --enable-xen \ + --extra-cflags="-I$(XEN_ROOT)/tools/include \ + -I$(XEN_ROOT)/tools/libxc \ + -I$(XEN_ROOT)/tools/xenstore \ + -I$(XEN_ROOT)/tools/xenstore/compat \ + -DDEBUG_XEN" \ + --extra-ldflags="-L$(XEN_ROOT)/tools/libxc -L$(XEN_ROOT)/tools/xenstore" \ + --disable-werror \ + --disable-sdl \ + --disable-kvm \ + --disable-fdt \ + --disable-bluez \ + --disable-slirp \ + --disable-nptl \ + --disable-pie \ + --disable-docs \ + --disable-vhost-net \ + --disable-spice \ + --disable-guest-agent \ + --audio-drv-list= \ + --audio-card-list= \ + --disable-smartcard-nss \ + --disable-opengl \ + --enable-stubdom \ + --disable-vnc \ + --enable-trace-backend=stderr \ + --disable-curses \ + --prefix+ +qemu-build/i386-softmmu/qemu-system-i386: qemu-build/Makefile + $(MAKE) -C qemu-build -- Anthony PERARD
This patch add rules to the Makefile to retrieve Linux and build a minimal kernel for the stubdomain. In order to work as a stubdomain, two patches are applied to the source of Linux. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> --- stubdom-linux/.gitignore | 3 + ...heck-for-xen_initial_domain-in-privcmd_io.patch | 39 + stubdom-linux/0002-fix-remap_area_mfn_pte_fn.patch | 36 + stubdom-linux/Makefile | 22 +- stubdom-linux/stubdom-linux-config-64b | 1185 ++++++++++++++++++++ 5 files changed, 1284 insertions(+), 1 deletion(-) create mode 100644 stubdom-linux/.gitignore create mode 100644 stubdom-linux/0001-xen-Don-t-check-for-xen_initial_domain-in-privcmd_io.patch create mode 100644 stubdom-linux/0002-fix-remap_area_mfn_pte_fn.patch create mode 100644 stubdom-linux/stubdom-linux-config-64b diff --git a/stubdom-linux/.gitignore b/stubdom-linux/.gitignore new file mode 100644 index 0000000..170e0c7 --- /dev/null +++ b/stubdom-linux/.gitignore @@ -0,0 +1,3 @@ +/linux-*.tar.xz +/linux-*/ +/vmlinuz-stubdom diff --git a/stubdom-linux/0001-xen-Don-t-check-for-xen_initial_domain-in-privcmd_io.patch b/stubdom-linux/0001-xen-Don-t-check-for-xen_initial_domain-in-privcmd_io.patch new file mode 100644 index 0000000..627b337 --- /dev/null +++ b/stubdom-linux/0001-xen-Don-t-check-for-xen_initial_domain-in-privcmd_io.patch @@ -0,0 +1,39 @@ +From 94d3502e70882a78ec3abb22379a79afc1292fb0 Mon Sep 17 00:00:00 2001 +From: Anthony PERARD <anthony.perard@citrix.com> +Date: Fri, 1 Jun 2012 15:46:39 +0100 +Subject: [PATCH 1/2] xen: Don''t check for xen_initial_domain in + privcmd_ioctl_mmap*. + +This prevent a stubdom from working. + +--- + drivers/xen/privcmd.c | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c +index ccee0f1..a8d71a3 100644 +--- a/drivers/xen/privcmd.c ++++ b/drivers/xen/privcmd.c +@@ -196,9 +196,6 @@ static long privcmd_ioctl_mmap(void __user *udata) + LIST_HEAD(pagelist); + struct mmap_mfn_state state; + +- if (!xen_initial_domain()) +- return -EPERM; +- + if (copy_from_user(&mmapcmd, udata, sizeof(mmapcmd))) + return -EFAULT; + +@@ -286,9 +283,6 @@ static long privcmd_ioctl_mmap_batch(void __user *udata) + LIST_HEAD(pagelist); + struct mmap_batch_state state; + +- if (!xen_initial_domain()) +- return -EPERM; +- + if (copy_from_user(&m, udata, sizeof(m))) + return -EFAULT; + +-- +Anthony PERARD + diff --git a/stubdom-linux/0002-fix-remap_area_mfn_pte_fn.patch b/stubdom-linux/0002-fix-remap_area_mfn_pte_fn.patch new file mode 100644 index 0000000..0d5c262 --- /dev/null +++ b/stubdom-linux/0002-fix-remap_area_mfn_pte_fn.patch @@ -0,0 +1,36 @@ +From 61cd574f29f41046f1c709cfa9da118156babf83 Mon Sep 17 00:00:00 2001 +From: Anthony PERARD <anthony.perard@citrix.com> +Date: Fri, 1 Jun 2012 15:47:01 +0100 +Subject: [PATCH 2/2] fix/remap_area_mfn_pte_fn + +--- + arch/x86/xen/mmu.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c +index 69f5857..999fc82 100644 +--- a/arch/x86/xen/mmu.c ++++ b/arch/x86/xen/mmu.c +@@ -2315,7 +2315,18 @@ static int remap_area_mfn_pte_fn(pte_t *ptep, pgtable_t token, + unsigned long addr, void *data) + { + struct remap_data *rmd = data; +- pte_t pte = pte_mkspecial(pfn_pte(rmd->mfn++, rmd->prot)); ++ ++ /* Use the native_make_pte function because we are sure we don''t ++ * have to do any pfn->mfn translations but at the same time we ++ * could in a stubdom so xen_initial_domain() would return false. */ ++ pte_t pte = pte_mkspecial(native_make_pte(((phys_addr_t)(rmd->mfn++) << PAGE_SHIFT) ++ | massage_pgprot(rmd->prot))); ++ pteval_t val = pte_val_ma(pte); ++ ++ if (pat_enabled && !WARN_ON(val & _PAGE_PAT)) { ++ if ((val & (_PAGE_PCD | _PAGE_PWT)) == _PAGE_PWT) ++ val = (val & ~(_PAGE_PCD | _PAGE_PWT)) | _PAGE_PAT; ++ } + + rmd->mmu_update->ptr = virt_to_machine(ptep).maddr; + rmd->mmu_update->val = pte_val_ma(pte); +-- +Anthony PERARD + diff --git a/stubdom-linux/Makefile b/stubdom-linux/Makefile index 3c02ccd..0844046 100644 --- a/stubdom-linux/Makefile +++ b/stubdom-linux/Makefile @@ -2,11 +2,14 @@ XEN_ROOT = $(CURDIR)/.. include $(XEN_ROOT)/Config.mk +# Linux Kernel version used +LINUX_V=linux-3.4.13 + # Qemu tree used QEMU_TREE=git://xenbits.xen.org/people/aperard/qemu-dm.git QEMU_BRANCH=origin/stubdom-preview1 -all: +all: vmlinuz-stubdom qemu-remote: export GIT=$(GIT); \ @@ -47,3 +50,20 @@ qemu-build/Makefile: qemu-remote qemu-build/i386-softmmu/qemu-system-i386: qemu-build/Makefile $(MAKE) -C qemu-build + +$(LINUX_V).tar.xz: + wget --timestamping ftp://ftp.kernel.org/pub/linux/kernel/v3.x/$(LINUX_V).tar.xz + +$(LINUX_V)/Makefile $(LINUX_V)/.config: $(LINUX_V).tar.xz + rm -rf $(LINUX_V) + tar xf $(LINUX_V).tar.xz + # Temp patches + patch -d $(LINUX_V) -p1 -i ../0001-xen-Don-t-check-for-xen_initial_domain-in-privcmd_io.patch + patch -d $(LINUX_V) -p1 -i ../0002-fix-remap_area_mfn_pte_fn.patch + cp stubdom-linux-config-64b $(LINUX_V)/.config + +$(LINUX_V)/arch/x86/boot/bzImage: $(LINUX_V)/.config + $(MAKE) -C $(LINUX_V) + +vmlinuz-stubdom: $(LINUX_V)/arch/x86/boot/bzImage + cp -f $^ $@ diff --git a/stubdom-linux/stubdom-linux-config-64b b/stubdom-linux/stubdom-linux-config-64b new file mode 100644 index 0000000..6836dda --- /dev/null +++ b/stubdom-linux/stubdom-linux-config-64b @@ -0,0 +1,1185 @@ +# +# Automatically generated file; DO NOT EDIT. +# Linux/x86_64 3.4.13 Kernel Configuration +# +CONFIG_64BIT=y +# CONFIG_X86_32 is not set +CONFIG_X86_64=y +CONFIG_X86=y +CONFIG_INSTRUCTION_DECODER=y +CONFIG_OUTPUT_FORMAT="elf64-x86-64" +CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig" +CONFIG_GENERIC_CMOS_UPDATE=y +CONFIG_CLOCKSOURCE_WATCHDOG=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_ARCH_CLOCKSOURCE_DATA=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y +CONFIG_LOCKDEP_SUPPORT=y +CONFIG_STACKTRACE_SUPPORT=y +CONFIG_HAVE_LATENCYTOP_SUPPORT=y +CONFIG_MMU=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_SG_DMA_LENGTH=y +CONFIG_GENERIC_ISA_DMA=y +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y +CONFIG_GENERIC_HWEIGHT=y +CONFIG_ARCH_MAY_HAVE_PC_FDC=y +# CONFIG_RWSEM_GENERIC_SPINLOCK is not set +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y +CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_GENERIC_TIME_VSYSCALL=y +CONFIG_ARCH_HAS_CPU_RELAX=y +CONFIG_ARCH_HAS_DEFAULT_IDLE=y +CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y +CONFIG_ARCH_HAS_CPU_AUTOPROBE=y +CONFIG_HAVE_SETUP_PER_CPU_AREA=y +CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y +CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ZONE_DMA32=y +CONFIG_AUDIT_ARCH=y +CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y +CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y +CONFIG_ARCH_HWEIGHT_CFLAGS="-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx -fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 -fcall-saved-r11" +# CONFIG_KTIME_SCALAR is not set +CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" +CONFIG_HAVE_IRQ_WORK=y +CONFIG_IRQ_WORK=y + +# +# General setup +# +# CONFIG_EXPERIMENTAL is not set +CONFIG_BROKEN_ON_SMP=y +CONFIG_INIT_ENV_ARG_LIMIT=32 +CONFIG_CROSS_COMPILE="" +CONFIG_LOCALVERSION="-XenStubdom" +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_HAVE_KERNEL_GZIP=y +CONFIG_HAVE_KERNEL_BZIP2=y +CONFIG_HAVE_KERNEL_LZMA=y +CONFIG_HAVE_KERNEL_XZ=y +CONFIG_HAVE_KERNEL_LZO=y +CONFIG_KERNEL_GZIP=y +# CONFIG_KERNEL_BZIP2 is not set +# CONFIG_KERNEL_LZMA is not set +# CONFIG_KERNEL_XZ is not set +# CONFIG_KERNEL_LZO is not set +CONFIG_DEFAULT_HOSTNAME="stubdom" +# CONFIG_SWAP is not set +# CONFIG_SYSVIPC is not set +# CONFIG_BSD_PROCESS_ACCT is not set +# CONFIG_FHANDLE is not set +# CONFIG_TASKSTATS is not set +# CONFIG_AUDIT is not set +CONFIG_HAVE_GENERIC_HARDIRQS=y + +# +# IRQ subsystem +# +CONFIG_GENERIC_HARDIRQS=y +CONFIG_GENERIC_IRQ_PROBE=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_SPARSE_IRQ=y + +# +# RCU Subsystem +# +CONFIG_TINY_RCU=y +# CONFIG_PREEMPT_RCU is not set +# CONFIG_TREE_RCU_TRACE is not set +# CONFIG_IKCONFIG is not set +CONFIG_LOG_BUF_SHIFT=17 +CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y +# CONFIG_CGROUPS is not set +# CONFIG_CHECKPOINT_RESTORE is not set +CONFIG_NAMESPACES=y +# CONFIG_UTS_NS is not set +# CONFIG_PID_NS is not set +# CONFIG_NET_NS is not set +# CONFIG_SCHED_AUTOGROUP is not set +# CONFIG_SYSFS_DEPRECATED is not set +# CONFIG_RELAY is not set +CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_RD_GZIP=y +CONFIG_RD_BZIP2=y +CONFIG_RD_LZMA=y +CONFIG_RD_XZ=y +CONFIG_RD_LZO=y +# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set +CONFIG_ANON_INODES=y +CONFIG_EXPERT=y +CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set +CONFIG_HOTPLUG=y +CONFIG_PRINTK=y +CONFIG_BUG=y +CONFIG_ELF_CORE=y +CONFIG_PCSPKR_PLATFORM=y +CONFIG_HAVE_PCSPKR_PLATFORM=y +CONFIG_BASE_FULL=y +CONFIG_FUTEX=y +CONFIG_EPOLL=y +CONFIG_SIGNALFD=y +CONFIG_TIMERFD=y +CONFIG_EVENTFD=y +CONFIG_SHMEM=y +CONFIG_AIO=y +# CONFIG_EMBEDDED is not set +CONFIG_HAVE_PERF_EVENTS=y + +# +# Kernel Performance Events And Counters +# +CONFIG_PERF_EVENTS=y +# CONFIG_PERF_COUNTERS is not set +# CONFIG_DEBUG_PERF_USE_VMALLOC is not set +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_SLUB_DEBUG=y +# CONFIG_COMPAT_BRK is not set +# CONFIG_SLAB is not set +CONFIG_SLUB=y +# CONFIG_SLOB is not set +# CONFIG_PROFILING is not set +CONFIG_HAVE_OPROFILE=y +CONFIG_OPROFILE_NMI_TIMER=y +# CONFIG_JUMP_LABEL is not set +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_HAVE_IOREMAP_PROT=y +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_OPTPROBES=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_DMA_ATTRS=y +CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_HW_BREAKPOINT=y +CONFIG_HAVE_MIXED_BREAKPOINTS_REGS=y +CONFIG_HAVE_USER_RETURN_NOTIFIER=y +CONFIG_HAVE_PERF_EVENTS_NMI=y +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y +CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y +CONFIG_HAVE_CMPXCHG_LOCAL=y +CONFIG_HAVE_CMPXCHG_DOUBLE=y + +# +# GCOV-based kernel profiling +# +# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set +CONFIG_SLABINFO=y +CONFIG_RT_MUTEXES=y +CONFIG_BASE_SMALL=0 +# CONFIG_MODULES is not set +CONFIG_BLOCK=y +# CONFIG_BLK_DEV_BSG is not set +# CONFIG_BLK_DEV_BSGLIB is not set +# CONFIG_BLK_DEV_INTEGRITY is not set + +# +# Partition Types +# +# CONFIG_PARTITION_ADVANCED is not set +CONFIG_MSDOS_PARTITION=y + +# +# IO Schedulers +# +CONFIG_IOSCHED_NOOP=y +# CONFIG_IOSCHED_DEADLINE is not set +# CONFIG_IOSCHED_CFQ is not set +CONFIG_DEFAULT_NOOP=y +CONFIG_DEFAULT_IOSCHED="noop" +# CONFIG_INLINE_SPIN_TRYLOCK is not set +# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set +# CONFIG_INLINE_SPIN_LOCK is not set +# CONFIG_INLINE_SPIN_LOCK_BH is not set +# CONFIG_INLINE_SPIN_LOCK_IRQ is not set +# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set +# CONFIG_INLINE_SPIN_UNLOCK_BH is not set +CONFIG_INLINE_SPIN_UNLOCK_IRQ=y +# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set +# CONFIG_INLINE_READ_TRYLOCK is not set +# CONFIG_INLINE_READ_LOCK is not set +# CONFIG_INLINE_READ_LOCK_BH is not set +# CONFIG_INLINE_READ_LOCK_IRQ is not set +# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set +CONFIG_INLINE_READ_UNLOCK=y +# CONFIG_INLINE_READ_UNLOCK_BH is not set +CONFIG_INLINE_READ_UNLOCK_IRQ=y +# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set +# CONFIG_INLINE_WRITE_TRYLOCK is not set +# CONFIG_INLINE_WRITE_LOCK is not set +# CONFIG_INLINE_WRITE_LOCK_BH is not set +# CONFIG_INLINE_WRITE_LOCK_IRQ is not set +# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set +CONFIG_INLINE_WRITE_UNLOCK=y +# CONFIG_INLINE_WRITE_UNLOCK_BH is not set +CONFIG_INLINE_WRITE_UNLOCK_IRQ=y +# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set +# CONFIG_MUTEX_SPIN_ON_OWNER is not set +CONFIG_FREEZER=y + +# +# Processor type and features +# +CONFIG_ZONE_DMA=y +# CONFIG_NO_HZ is not set +# CONFIG_HIGH_RES_TIMERS is not set +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y +# CONFIG_SMP is not set +CONFIG_X86_MPPARSE=y +# CONFIG_X86_EXTENDED_PLATFORM is not set +# CONFIG_SCHED_OMIT_FRAME_POINTER is not set +CONFIG_PARAVIRT_GUEST=y +# CONFIG_PARAVIRT_TIME_ACCOUNTING is not set +CONFIG_XEN=y +# CONFIG_XEN_PRIVILEGED_GUEST is not set +CONFIG_XEN_MAX_DOMAIN_MEMORY=500 +CONFIG_XEN_SAVE_RESTORE=y +# CONFIG_KVM_CLOCK is not set +# CONFIG_KVM_GUEST is not set +CONFIG_PARAVIRT=y +CONFIG_PARAVIRT_CLOCK=y +# CONFIG_PARAVIRT_DEBUG is not set +CONFIG_NO_BOOTMEM=y +# CONFIG_MEMTEST is not set +# CONFIG_MK8 is not set +# CONFIG_MPSC is not set +# CONFIG_MCORE2 is not set +# CONFIG_MATOM is not set +CONFIG_GENERIC_CPU=y +CONFIG_X86_INTERNODE_CACHE_SHIFT=6 +CONFIG_X86_CMPXCHG=y +CONFIG_X86_L1_CACHE_SHIFT=6 +CONFIG_X86_XADD=y +CONFIG_X86_WP_WORKS_OK=y +CONFIG_X86_TSC=y +CONFIG_X86_CMPXCHG64=y +CONFIG_X86_CMOV=y +CONFIG_X86_MINIMUM_CPU_FAMILY=64 +CONFIG_X86_DEBUGCTLMSR=y +# CONFIG_PROCESSOR_SELECT is not set +CONFIG_CPU_SUP_INTEL=y +CONFIG_CPU_SUP_AMD=y +CONFIG_CPU_SUP_CENTAUR=y +CONFIG_HPET_TIMER=y +CONFIG_DMI=y +CONFIG_SWIOTLB=y +CONFIG_IOMMU_HELPER=y +CONFIG_NR_CPUS=1 +# CONFIG_IRQ_TIME_ACCOUNTING is not set +CONFIG_PREEMPT_NONE=y +# CONFIG_PREEMPT_VOLUNTARY is not set +# CONFIG_PREEMPT is not set +CONFIG_X86_LOCAL_APIC=y +CONFIG_X86_IO_APIC=y +# CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS is not set +# CONFIG_X86_MCE is not set +# CONFIG_I8K is not set +# CONFIG_MICROCODE is not set +# CONFIG_X86_MSR is not set +# CONFIG_X86_CPUID is not set +CONFIG_ARCH_PHYS_ADDR_T_64BIT=y +CONFIG_ARCH_DMA_ADDR_T_64BIT=y +CONFIG_DIRECT_GBPAGES=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ARCH_SPARSEMEM_DEFAULT=y +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 +CONFIG_SELECT_MEMORY_MODEL=y +CONFIG_SPARSEMEM_MANUAL=y +CONFIG_SPARSEMEM=y +CONFIG_HAVE_MEMORY_PRESENT=y +CONFIG_SPARSEMEM_EXTREME=y +CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y +CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER=y +CONFIG_SPARSEMEM_VMEMMAP=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_HAVE_MEMBLOCK_NODE_MAP=y +CONFIG_ARCH_DISCARD_MEMBLOCK=y +# CONFIG_MEMORY_HOTPLUG is not set +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_SPLIT_PTLOCK_CPUS=4 +# CONFIG_COMPACTION is not set +CONFIG_PHYS_ADDR_T_64BIT=y +CONFIG_ZONE_DMA_FLAG=1 +CONFIG_BOUNCE=y +CONFIG_VIRT_TO_BUS=y +# CONFIG_KSM is not set +CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 +# CONFIG_TRANSPARENT_HUGEPAGE is not set +CONFIG_NEED_PER_CPU_KM=y +# CONFIG_CLEANCACHE is not set +# CONFIG_X86_CHECK_BIOS_CORRUPTION is not set +CONFIG_X86_RESERVE_LOW=32 +CONFIG_MTRR=y +# CONFIG_MTRR_SANITIZER is not set +CONFIG_X86_PAT=y +CONFIG_ARCH_USES_PG_UNCACHED=y +CONFIG_ARCH_RANDOM=y +# CONFIG_SECCOMP is not set +# CONFIG_CC_STACKPROTECTOR is not set +# CONFIG_HZ_100 is not set +CONFIG_HZ_250=y +# CONFIG_HZ_300 is not set +# CONFIG_HZ_1000 is not set +CONFIG_HZ=250 +# CONFIG_SCHED_HRTICK is not set +# CONFIG_KEXEC is not set +# CONFIG_CRASH_DUMP is not set +CONFIG_PHYSICAL_START=0x1000000 +CONFIG_RELOCATABLE=y +CONFIG_PHYSICAL_ALIGN=0x1000000 +# CONFIG_CMDLINE_BOOL is not set +CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y + +# +# Power management and ACPI options +# +# CONFIG_SUSPEND is not set +CONFIG_HIBERNATE_CALLBACKS=y +CONFIG_PM_SLEEP=y +# CONFIG_PM_RUNTIME is not set +CONFIG_PM=y +# CONFIG_PM_DEBUG is not set +# CONFIG_SFI is not set + +# +# CPU Frequency scaling +# +# CONFIG_CPU_FREQ is not set +# CONFIG_CPU_IDLE is not set + +# +# Memory power savings +# + +# +# Bus options (PCI etc.) +# +# CONFIG_PCI is not set +# CONFIG_ARCH_SUPPORTS_MSI is not set +CONFIG_PCI_LABEL=y +CONFIG_ISA_DMA_API=y +# CONFIG_PCCARD is not set + +# +# Executable file formats / Emulations +# +CONFIG_BINFMT_ELF=y +CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y +# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set +# CONFIG_HAVE_AOUT is not set +# CONFIG_BINFMT_MISC is not set +# CONFIG_IA32_EMULATION is not set +# CONFIG_COMPAT_FOR_U64_ALIGNMENT is not set +CONFIG_HAVE_TEXT_POKE_SMP=y +CONFIG_NET=y + +# +# Networking options +# +CONFIG_PACKET=y +CONFIG_UNIX=y +# CONFIG_UNIX_DIAG is not set +# CONFIG_NET_KEY is not set +CONFIG_INET=y +# CONFIG_IP_MULTICAST is not set +# CONFIG_IP_ADVANCED_ROUTER is not set +# CONFIG_IP_PNP is not set +# CONFIG_NET_IPIP is not set +# CONFIG_NET_IPGRE_DEMUX is not set +# CONFIG_ARPD is not set +# CONFIG_SYN_COOKIES is not set +# CONFIG_INET_AH is not set +# CONFIG_INET_ESP is not set +# CONFIG_INET_IPCOMP is not set +# CONFIG_INET_XFRM_TUNNEL is not set +# CONFIG_INET_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET_XFRM_MODE_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_BEET is not set +# CONFIG_INET_LRO is not set +# CONFIG_INET_DIAG is not set +# CONFIG_TCP_CONG_ADVANCED is not set +CONFIG_TCP_CONG_CUBIC=y +CONFIG_DEFAULT_TCP_CONG="cubic" +# CONFIG_IPV6 is not set +# CONFIG_NETWORK_SECMARK is not set +# CONFIG_NETFILTER is not set +# CONFIG_ATM is not set +# CONFIG_L2TP is not set +CONFIG_STP=y +CONFIG_BRIDGE=y +# CONFIG_BRIDGE_IGMP_SNOOPING is not set +# CONFIG_VLAN_8021Q is not set +# CONFIG_DECNET is not set +CONFIG_LLC=y +# CONFIG_LLC2 is not set +# CONFIG_IPX is not set +# CONFIG_ATALK is not set +# CONFIG_PHONET is not set +# CONFIG_NET_SCHED is not set +# CONFIG_DCB is not set +# CONFIG_BATMAN_ADV is not set +# CONFIG_OPENVSWITCH is not set +CONFIG_BQL=y +CONFIG_HAVE_BPF_JIT=y + +# +# Network testing +# +# CONFIG_NET_PKTGEN is not set +# CONFIG_HAMRADIO is not set +# CONFIG_CAN is not set +# CONFIG_IRDA is not set +# CONFIG_BT is not set +# CONFIG_WIRELESS is not set +# CONFIG_WIMAX is not set +# CONFIG_RFKILL is not set +# CONFIG_NET_9P is not set +# CONFIG_CAIF is not set + +# +# Device Drivers +# + +# +# Generic Driver Options +# +CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +CONFIG_STANDALONE=y +# CONFIG_PREVENT_FIRMWARE_BUILD is not set +CONFIG_FW_LOADER=y +# CONFIG_FIRMWARE_IN_KERNEL is not set +CONFIG_EXTRA_FIRMWARE="" +# CONFIG_DEBUG_DRIVER is not set +# CONFIG_DEBUG_DEVRES is not set +CONFIG_SYS_HYPERVISOR=y +# CONFIG_GENERIC_CPU_DEVICES is not set +# CONFIG_CONNECTOR is not set +# CONFIG_MTD is not set +# CONFIG_PARPORT is not set +CONFIG_BLK_DEV=y +# CONFIG_BLK_DEV_FD is not set +# CONFIG_BLK_DEV_COW_COMMON is not set +# CONFIG_BLK_DEV_LOOP is not set + +# +# DRBD disabled because PROC_FS, INET or CONNECTOR not selected +# +# CONFIG_BLK_DEV_NBD is not set +# CONFIG_BLK_DEV_RAM is not set +# CONFIG_CDROM_PKTCDVD is not set +# CONFIG_ATA_OVER_ETH is not set +CONFIG_XEN_BLKDEV_FRONTEND=y +# CONFIG_BLK_DEV_HD is not set + +# +# Misc devices +# +# CONFIG_SENSORS_LIS3LV02D is not set +# CONFIG_ENCLOSURE_SERVICES is not set +# CONFIG_VMWARE_BALLOON is not set + +# +# EEPROM support +# +# CONFIG_EEPROM_93CX6 is not set + +# +# Texas Instruments shared transport line discipline +# + +# +# Altera FPGA firmware download module +# +CONFIG_HAVE_IDE=y +# CONFIG_IDE is not set + +# +# SCSI device support +# +CONFIG_SCSI_MOD=y +# CONFIG_RAID_ATTRS is not set +# CONFIG_SCSI is not set +# CONFIG_SCSI_DMA is not set +# CONFIG_SCSI_NETLINK is not set +# CONFIG_ATA is not set +# CONFIG_MD is not set +# CONFIG_MACINTOSH_DRIVERS is not set +CONFIG_NETDEVICES=y +CONFIG_NET_CORE=y +# CONFIG_BONDING is not set +# CONFIG_DUMMY is not set +# CONFIG_EQUALIZER is not set +# CONFIG_MII is not set +# CONFIG_NETCONSOLE is not set +# CONFIG_NETPOLL is not set +# CONFIG_NET_POLL_CONTROLLER is not set +CONFIG_TUN=y +# CONFIG_VETH is not set + +# +# CAIF transport drivers +# +# CONFIG_ETHERNET is not set +# CONFIG_PHYLIB is not set +# CONFIG_PPP is not set +# CONFIG_SLIP is not set +# CONFIG_WLAN is not set + +# +# Enable WiMAX (Networking options) to see the WiMAX drivers +# +# CONFIG_WAN is not set +CONFIG_XEN_NETDEV_FRONTEND=y +# CONFIG_ISDN is not set + +# +# Input device support +# +CONFIG_INPUT=y +# CONFIG_INPUT_FF_MEMLESS is not set +# CONFIG_INPUT_POLLDEV is not set +# CONFIG_INPUT_SPARSEKMAP is not set + +# +# Userland interfaces +# +CONFIG_INPUT_MOUSEDEV=y +# CONFIG_INPUT_MOUSEDEV_PSAUX is not set +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +# CONFIG_INPUT_JOYDEV is not set +# CONFIG_INPUT_EVDEV is not set +# CONFIG_INPUT_EVBUG is not set + +# +# Input Device Drivers +# +CONFIG_INPUT_KEYBOARD=y +CONFIG_KEYBOARD_ATKBD=y +# CONFIG_KEYBOARD_LKKBD is not set +# CONFIG_KEYBOARD_NEWTON is not set +# CONFIG_KEYBOARD_OPENCORES is not set +# CONFIG_KEYBOARD_STOWAWAY is not set +# CONFIG_KEYBOARD_SUNKBD is not set +# CONFIG_KEYBOARD_OMAP4 is not set +# CONFIG_KEYBOARD_XTKBD is not set +# CONFIG_INPUT_MOUSE is not set +# CONFIG_INPUT_JOYSTICK is not set +# CONFIG_INPUT_TABLET is not set +# CONFIG_INPUT_TOUCHSCREEN is not set +CONFIG_INPUT_MISC=y +# CONFIG_INPUT_AD714X is not set +# CONFIG_INPUT_PCSPKR is not set +# CONFIG_INPUT_UINPUT is not set +# CONFIG_INPUT_ADXL34X is not set +# CONFIG_INPUT_CMA3000 is not set +CONFIG_INPUT_XEN_KBDDEV_FRONTEND=y + +# +# Hardware I/O ports +# +CONFIG_SERIO=y +CONFIG_SERIO_I8042=y +# CONFIG_SERIO_SERPORT is not set +# CONFIG_SERIO_CT82C710 is not set +CONFIG_SERIO_LIBPS2=y +# CONFIG_SERIO_RAW is not set +# CONFIG_SERIO_ALTERA_PS2 is not set +# CONFIG_SERIO_PS2MULT is not set +# CONFIG_GAMEPORT is not set + +# +# Character devices +# +CONFIG_VT=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_VT_CONSOLE=y +CONFIG_VT_CONSOLE_SLEEP=y +CONFIG_HW_CONSOLE=y +# CONFIG_VT_HW_CONSOLE_BINDING is not set +CONFIG_UNIX98_PTYS=y +# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set +# CONFIG_LEGACY_PTYS is not set +# CONFIG_SERIAL_NONSTANDARD is not set +# CONFIG_TRACE_SINK is not set +# CONFIG_DEVKMEM is not set + +# +# Serial drivers +# +# CONFIG_SERIAL_8250 is not set +CONFIG_FIX_EARLYCON_MEM=y + +# +# Non-8250 serial port support +# +# CONFIG_SERIAL_TIMBERDALE is not set +# CONFIG_SERIAL_ALTERA_JTAGUART is not set +# CONFIG_SERIAL_ALTERA_UART is not set +# CONFIG_SERIAL_XILINX_PS_UART is not set +# CONFIG_TTY_PRINTK is not set +CONFIG_HVC_DRIVER=y +CONFIG_HVC_IRQ=y +CONFIG_HVC_XEN=y +CONFIG_HVC_XEN_FRONTEND=y +# CONFIG_IPMI_HANDLER is not set +# CONFIG_HW_RANDOM is not set +# CONFIG_NVRAM is not set +# CONFIG_RTC is not set +# CONFIG_GEN_RTC is not set +# CONFIG_R3964 is not set +# CONFIG_MWAVE is not set +# CONFIG_RAW_DRIVER is not set +# CONFIG_HANGCHECK_TIMER is not set +# CONFIG_TCG_TPM is not set +# CONFIG_RAMOOPS is not set +# CONFIG_I2C is not set +# CONFIG_SPI is not set +# CONFIG_HSI is not set + +# +# PPS support +# + +# +# PPS generators support +# + +# +# PTP clock support +# + +# +# Enable Device Drivers -> PPS to see the PTP clock options. +# +CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y +# CONFIG_GPIOLIB is not set +# CONFIG_W1 is not set +# CONFIG_POWER_SUPPLY is not set +# CONFIG_HWMON is not set +# CONFIG_THERMAL is not set +# CONFIG_WATCHDOG is not set +CONFIG_SSB_POSSIBLE=y + +# +# Sonics Silicon Backplane +# +# CONFIG_SSB is not set +CONFIG_BCMA_POSSIBLE=y + +# +# Broadcom specific AMBA +# +# CONFIG_BCMA is not set + +# +# Multifunction device drivers +# +# CONFIG_MFD_CORE is not set +# CONFIG_MFD_SM501 is not set +# CONFIG_HTC_PASIC3 is not set +# CONFIG_MFD_TMIO is not set +# CONFIG_ABX500_CORE is not set +# CONFIG_REGULATOR is not set +# CONFIG_MEDIA_SUPPORT is not set + +# +# Graphics support +# +# CONFIG_DRM is not set +# CONFIG_VGASTATE is not set +# CONFIG_VIDEO_OUTPUT_CONTROL is not set +CONFIG_FB=y +# CONFIG_FIRMWARE_EDID is not set +# CONFIG_FB_DDC is not set +# CONFIG_FB_BOOT_VESA_SUPPORT is not set +# CONFIG_FB_CFB_FILLRECT is not set +# CONFIG_FB_CFB_COPYAREA is not set +# CONFIG_FB_CFB_IMAGEBLIT is not set +# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set +CONFIG_FB_SYS_FILLRECT=y +CONFIG_FB_SYS_COPYAREA=y +CONFIG_FB_SYS_IMAGEBLIT=y +# CONFIG_FB_FOREIGN_ENDIAN is not set +CONFIG_FB_SYS_FOPS=y +# CONFIG_FB_WMT_GE_ROPS is not set +CONFIG_FB_DEFERRED_IO=y +# CONFIG_FB_SVGALIB is not set +# CONFIG_FB_MACMODES is not set +# CONFIG_FB_BACKLIGHT is not set +# CONFIG_FB_MODE_HELPERS is not set +# CONFIG_FB_TILEBLITTING is not set + +# +# Frame buffer hardware drivers +# +# CONFIG_FB_ARC is not set +# CONFIG_FB_VGA16 is not set +# CONFIG_FB_VESA is not set +# CONFIG_FB_N411 is not set +# CONFIG_FB_HGA is not set +# CONFIG_FB_S1D13XXX is not set +# CONFIG_FB_VIRTUAL is not set +CONFIG_XEN_FBDEV_FRONTEND=y +# CONFIG_FB_METRONOME is not set +# CONFIG_FB_BROADSHEET is not set +# CONFIG_EXYNOS_VIDEO is not set +# CONFIG_BACKLIGHT_LCD_SUPPORT is not set + +# +# Console display driver support +# +CONFIG_VGA_CONSOLE=y +# CONFIG_VGACON_SOFT_SCROLLBACK is not set +CONFIG_DUMMY_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE=y +# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +# CONFIG_FONTS is not set +CONFIG_FONT_8x8=y +CONFIG_FONT_8x16=y +# CONFIG_LOGO is not set +# CONFIG_SOUND is not set +# CONFIG_HID_SUPPORT is not set +# CONFIG_USB_ARCH_HAS_OHCI is not set +# CONFIG_USB_ARCH_HAS_EHCI is not set +# CONFIG_USB_ARCH_HAS_XHCI is not set +# CONFIG_USB_SUPPORT is not set +# CONFIG_MMC is not set +# CONFIG_MEMSTICK is not set +# CONFIG_NEW_LEDS is not set +# CONFIG_ACCESSIBILITY is not set +# CONFIG_EDAC is not set +# CONFIG_RTC_CLASS is not set +# CONFIG_DMADEVICES is not set +# CONFIG_AUXDISPLAY is not set +# CONFIG_UIO is not set + +# +# Virtio drivers +# +# CONFIG_VIRTIO_BALLOON is not set + +# +# Microsoft Hyper-V guest support +# + +# +# Xen driver support +# +# CONFIG_XEN_BALLOON is not set +CONFIG_XEN_DEV_EVTCHN=y +CONFIG_XENFS=y +CONFIG_XEN_COMPAT_XENFS=y +CONFIG_XEN_SYS_HYPERVISOR=y +CONFIG_XEN_XENBUS_FRONTEND=y +# CONFIG_XEN_GNTDEV is not set +CONFIG_XEN_GRANT_DEV_ALLOC=y +CONFIG_XEN_PRIVCMD=y +# CONFIG_STAGING is not set +# CONFIG_X86_PLATFORM_DEVICES is not set + +# +# Hardware Spinlock drivers +# +CONFIG_CLKEVT_I8253=y +CONFIG_I8253_LOCK=y +CONFIG_CLKBLD_I8253=y +# CONFIG_IOMMU_SUPPORT is not set + +# +# Remoteproc drivers (EXPERIMENTAL) +# + +# +# Rpmsg drivers (EXPERIMENTAL) +# +# CONFIG_VIRT_DRIVERS is not set +# CONFIG_PM_DEVFREQ is not set + +# +# Firmware Drivers +# +# CONFIG_EDD is not set +CONFIG_FIRMWARE_MEMMAP=y +# CONFIG_DELL_RBU is not set +# CONFIG_DCDBAS is not set +# CONFIG_DMIID is not set +# CONFIG_DMI_SYSFS is not set +# CONFIG_ISCSI_IBFT_FIND is not set +# CONFIG_GOOGLE_FIRMWARE is not set + +# +# File systems +# +CONFIG_DCACHE_WORD_ACCESS=y +CONFIG_EXT2_FS=y +# CONFIG_EXT2_FS_XATTR is not set +# CONFIG_EXT2_FS_XIP is not set +# CONFIG_EXT3_FS is not set +# CONFIG_EXT4_FS is not set +# CONFIG_REISERFS_FS is not set +# CONFIG_JFS_FS is not set +# CONFIG_XFS_FS is not set +# CONFIG_GFS2_FS is not set +# CONFIG_FS_POSIX_ACL is not set +CONFIG_FILE_LOCKING=y +CONFIG_FSNOTIFY=y +# CONFIG_DNOTIFY is not set +CONFIG_INOTIFY_USER=y +# CONFIG_FANOTIFY is not set +# CONFIG_QUOTA is not set +# CONFIG_QUOTACTL is not set +# CONFIG_AUTOFS4_FS is not set +# CONFIG_FUSE_FS is not set + +# +# Caches +# +# CONFIG_FSCACHE is not set + +# +# CD-ROM/DVD Filesystems +# +# CONFIG_ISO9660_FS is not set +# CONFIG_UDF_FS is not set + +# +# DOS/FAT/NT Filesystems +# +# CONFIG_MSDOS_FS is not set +# CONFIG_VFAT_FS is not set +# CONFIG_NTFS_FS is not set + +# +# Pseudo filesystems +# +CONFIG_PROC_FS=y +# CONFIG_PROC_KCORE is not set +# CONFIG_PROC_SYSCTL is not set +# CONFIG_PROC_PAGE_MONITOR is not set +CONFIG_SYSFS=y +# CONFIG_TMPFS is not set +# CONFIG_HUGETLBFS is not set +# CONFIG_HUGETLB_PAGE is not set +# CONFIG_CONFIGFS_FS is not set +# CONFIG_MISC_FILESYSTEMS is not set +# CONFIG_NETWORK_FILESYSTEMS is not set +CONFIG_NLS=y +CONFIG_NLS_DEFAULT="iso8859-1" +# CONFIG_NLS_CODEPAGE_437 is not set +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1250 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_ASCII is not set +# CONFIG_NLS_ISO8859_1 is not set +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_UTF8 is not set + +# +# Kernel hacking +# +CONFIG_TRACE_IRQFLAGS_SUPPORT=y +# CONFIG_PRINTK_TIME is not set +CONFIG_DEFAULT_MESSAGE_LOGLEVEL=5 +# CONFIG_ENABLE_WARN_DEPRECATED is not set +# CONFIG_ENABLE_MUST_CHECK is not set +CONFIG_FRAME_WARN=1024 +# CONFIG_MAGIC_SYSRQ is not set +# CONFIG_STRIP_ASM_SYMS is not set +# CONFIG_UNUSED_SYMBOLS is not set +# CONFIG_DEBUG_FS is not set +# CONFIG_HEADERS_CHECK is not set +# CONFIG_DEBUG_SECTION_MISMATCH is not set +CONFIG_DEBUG_KERNEL=y +# CONFIG_DEBUG_SHIRQ is not set +# CONFIG_LOCKUP_DETECTOR is not set +# CONFIG_HARDLOCKUP_DETECTOR is not set +# CONFIG_DETECT_HUNG_TASK is not set +# CONFIG_SCHED_DEBUG is not set +# CONFIG_SCHEDSTATS is not set +# CONFIG_TIMER_STATS is not set +# CONFIG_DEBUG_OBJECTS is not set +# CONFIG_SLUB_DEBUG_ON is not set +# CONFIG_SLUB_STATS is not set +# CONFIG_DEBUG_RT_MUTEXES is not set +# CONFIG_RT_MUTEX_TESTER is not set +# CONFIG_DEBUG_SPINLOCK is not set +# CONFIG_DEBUG_MUTEXES is not set +# CONFIG_DEBUG_LOCK_ALLOC is not set +# CONFIG_PROVE_LOCKING is not set +# CONFIG_SPARSE_RCU_POINTER is not set +# CONFIG_LOCK_STAT is not set +# CONFIG_DEBUG_ATOMIC_SLEEP is not set +# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set +# CONFIG_DEBUG_STACK_USAGE is not set +# CONFIG_DEBUG_KOBJECT is not set +CONFIG_DEBUG_BUGVERBOSE=y +# CONFIG_DEBUG_INFO is not set +# CONFIG_DEBUG_VM is not set +# CONFIG_DEBUG_VIRTUAL is not set +# CONFIG_DEBUG_WRITECOUNT is not set +CONFIG_DEBUG_MEMORY_INIT=y +# CONFIG_DEBUG_LIST is not set +# CONFIG_TEST_LIST_SORT is not set +# CONFIG_DEBUG_SG is not set +# CONFIG_DEBUG_NOTIFIERS is not set +# CONFIG_DEBUG_CREDENTIALS is not set +CONFIG_ARCH_WANT_FRAME_POINTERS=y +# CONFIG_FRAME_POINTER is not set +# CONFIG_BOOT_PRINTK_DELAY is not set +# CONFIG_RCU_TORTURE_TEST is not set +# CONFIG_RCU_TRACE is not set +# CONFIG_BACKTRACE_SELF_TEST is not set +# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set +# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set +# CONFIG_FAULT_INJECTION is not set +# CONFIG_LATENCYTOP is not set +# CONFIG_DEBUG_PAGEALLOC is not set +CONFIG_USER_STACKTRACE_SUPPORT=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST=y +CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_TRACING_SUPPORT=y +# CONFIG_FTRACE is not set +# CONFIG_DMA_API_DEBUG is not set +# CONFIG_ATOMIC64_SELFTEST is not set +# CONFIG_SAMPLES is not set +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_ARCH_KMEMCHECK=y +# CONFIG_KMEMCHECK is not set +# CONFIG_TEST_KSTRTOX is not set +# CONFIG_STRICT_DEVMEM is not set +# CONFIG_X86_VERBOSE_BOOTUP is not set +CONFIG_EARLY_PRINTK=y +# CONFIG_DEBUG_STACKOVERFLOW is not set +# CONFIG_X86_PTDUMP is not set +CONFIG_DEBUG_RODATA=y +CONFIG_DEBUG_RODATA_TEST=y +# CONFIG_IOMMU_STRESS is not set +CONFIG_HAVE_MMIOTRACE_SUPPORT=y +CONFIG_IO_DELAY_TYPE_0X80=0 +CONFIG_IO_DELAY_TYPE_0XED=1 +CONFIG_IO_DELAY_TYPE_UDELAY=2 +CONFIG_IO_DELAY_TYPE_NONE=3 +CONFIG_IO_DELAY_0X80=y +# CONFIG_IO_DELAY_0XED is not set +# CONFIG_IO_DELAY_UDELAY is not set +# CONFIG_IO_DELAY_NONE is not set +CONFIG_DEFAULT_IO_DELAY_TYPE=0 +# CONFIG_CPA_DEBUG is not set +# CONFIG_OPTIMIZE_INLINING is not set +# CONFIG_DEBUG_STRICT_USER_COPY_CHECKS is not set +# CONFIG_DEBUG_NMI_SELFTEST is not set + +# +# Security options +# +# CONFIG_KEYS is not set +# CONFIG_SECURITY_DMESG_RESTRICT is not set +# CONFIG_SECURITY is not set +# CONFIG_SECURITYFS is not set +CONFIG_DEFAULT_SECURITY_DAC=y +CONFIG_DEFAULT_SECURITY="" +CONFIG_CRYPTO=y + +# +# Crypto core or helper +# +CONFIG_CRYPTO_ALGAPI=y +CONFIG_CRYPTO_ALGAPI2=y +CONFIG_CRYPTO_AEAD2=y +CONFIG_CRYPTO_BLKCIPHER=y +CONFIG_CRYPTO_BLKCIPHER2=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_PCOMP2=y +CONFIG_CRYPTO_MANAGER=y +CONFIG_CRYPTO_MANAGER2=y +# CONFIG_CRYPTO_USER is not set +# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set +# CONFIG_CRYPTO_GF128MUL is not set +# CONFIG_CRYPTO_NULL is not set +CONFIG_CRYPTO_WORKQUEUE=y +# CONFIG_CRYPTO_CRYPTD is not set +# CONFIG_CRYPTO_AUTHENC is not set + +# +# Authenticated Encryption with Associated Data +# +# CONFIG_CRYPTO_CCM is not set +# CONFIG_CRYPTO_GCM is not set +# CONFIG_CRYPTO_SEQIV is not set + +# +# Block modes +# +CONFIG_CRYPTO_CBC=y +# CONFIG_CRYPTO_CTR is not set +# CONFIG_CRYPTO_CTS is not set +# CONFIG_CRYPTO_ECB is not set +# CONFIG_CRYPTO_LRW is not set +# CONFIG_CRYPTO_PCBC is not set +# CONFIG_CRYPTO_XTS is not set + +# +# Hash modes +# +# CONFIG_CRYPTO_HMAC is not set + +# +# Digest +# +# CONFIG_CRYPTO_CRC32C is not set +# CONFIG_CRYPTO_CRC32C_INTEL is not set +# CONFIG_CRYPTO_GHASH is not set +# CONFIG_CRYPTO_MD4 is not set +# CONFIG_CRYPTO_MD5 is not set +# CONFIG_CRYPTO_MICHAEL_MIC is not set +# CONFIG_CRYPTO_RMD128 is not set +# CONFIG_CRYPTO_RMD160 is not set +# CONFIG_CRYPTO_RMD256 is not set +# CONFIG_CRYPTO_RMD320 is not set +# CONFIG_CRYPTO_SHA1 is not set +# CONFIG_CRYPTO_SHA1_SSSE3 is not set +# CONFIG_CRYPTO_SHA256 is not set +# CONFIG_CRYPTO_SHA512 is not set +# CONFIG_CRYPTO_TGR192 is not set +# CONFIG_CRYPTO_WP512 is not set +# CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL is not set + +# +# Ciphers +# +# CONFIG_CRYPTO_AES is not set +# CONFIG_CRYPTO_AES_X86_64 is not set +# CONFIG_CRYPTO_AES_NI_INTEL is not set +# CONFIG_CRYPTO_ANUBIS is not set +# CONFIG_CRYPTO_ARC4 is not set +# CONFIG_CRYPTO_BLOWFISH is not set +# CONFIG_CRYPTO_BLOWFISH_X86_64 is not set +# CONFIG_CRYPTO_CAMELLIA is not set +# CONFIG_CRYPTO_CAMELLIA_X86_64 is not set +# CONFIG_CRYPTO_CAST5 is not set +# CONFIG_CRYPTO_CAST6 is not set +# CONFIG_CRYPTO_DES is not set +# CONFIG_CRYPTO_FCRYPT is not set +# CONFIG_CRYPTO_KHAZAD is not set +# CONFIG_CRYPTO_SEED is not set +# CONFIG_CRYPTO_SERPENT is not set +# CONFIG_CRYPTO_SERPENT_SSE2_X86_64 is not set +# CONFIG_CRYPTO_TEA is not set +# CONFIG_CRYPTO_TWOFISH is not set +# CONFIG_CRYPTO_TWOFISH_X86_64 is not set +# CONFIG_CRYPTO_TWOFISH_X86_64_3WAY is not set + +# +# Compression +# +# CONFIG_CRYPTO_DEFLATE is not set +# CONFIG_CRYPTO_ZLIB is not set +# CONFIG_CRYPTO_LZO is not set + +# +# Random Number Generation +# +# CONFIG_CRYPTO_ANSI_CPRNG is not set +# CONFIG_CRYPTO_USER_API_HASH is not set +# CONFIG_CRYPTO_USER_API_SKCIPHER is not set +# CONFIG_CRYPTO_HW is not set +CONFIG_HAVE_KVM=y +# CONFIG_VIRTUALIZATION is not set +# CONFIG_BINARY_PRINTF is not set + +# +# Library routines +# +CONFIG_BITREVERSE=y +CONFIG_GENERIC_FIND_FIRST_BIT=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_IOMAP=y +CONFIG_GENERIC_IO=y +# CONFIG_CRC_CCITT is not set +# CONFIG_CRC16 is not set +# CONFIG_CRC_T10DIF is not set +# CONFIG_CRC_ITU_T is not set +CONFIG_CRC32=y +# CONFIG_CRC32_SELFTEST is not set +CONFIG_CRC32_SLICEBY8=y +# CONFIG_CRC32_SLICEBY4 is not set +# CONFIG_CRC32_SARWATE is not set +# CONFIG_CRC32_BIT is not set +# CONFIG_CRC7 is not set +# CONFIG_LIBCRC32C is not set +# CONFIG_CRC8 is not set +CONFIG_ZLIB_INFLATE=y +CONFIG_LZO_DECOMPRESS=y +CONFIG_XZ_DEC=y +CONFIG_XZ_DEC_X86=y +CONFIG_XZ_DEC_POWERPC=y +CONFIG_XZ_DEC_IA64=y +CONFIG_XZ_DEC_ARM=y +CONFIG_XZ_DEC_ARMTHUMB=y +CONFIG_XZ_DEC_SPARC=y +CONFIG_XZ_DEC_BCJ=y +# CONFIG_XZ_DEC_TEST is not set +CONFIG_DECOMPRESS_GZIP=y +CONFIG_DECOMPRESS_BZIP2=y +CONFIG_DECOMPRESS_LZMA=y +CONFIG_DECOMPRESS_XZ=y +CONFIG_DECOMPRESS_LZO=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y +CONFIG_HAS_DMA=y +CONFIG_DQL=y +CONFIG_NLATTR=y +# CONFIG_AVERAGE is not set +# CONFIG_CORDIC is not set -- Anthony PERARD
This patch build a disk image intend to be mounted as rootfs by the stub-domain. It is build using the ''debugfs'' tool and make a ext2 fs. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> --- stubdom-linux/.gitignore | 2 + stubdom-linux/Makefile | 16 +++- stubdom-linux/extra/initscript | 40 +++++++++ stubdom-linux/extra/qemu-ifup | 7 ++ stubdom-linux/mk-ramdisk-common | 178 ++++++++++++++++++++++++++++++++++++++++ stubdom-linux/mk-ramdisk-ioemu | 124 ++++++++++++++++++++++++++++ 6 files changed, 366 insertions(+), 1 deletion(-) create mode 100644 stubdom-linux/extra/initscript create mode 100644 stubdom-linux/extra/qemu-ifup create mode 100755 stubdom-linux/mk-ramdisk-common create mode 100755 stubdom-linux/mk-ramdisk-ioemu diff --git a/stubdom-linux/.gitignore b/stubdom-linux/.gitignore index 170e0c7..2cb91da 100644 --- a/stubdom-linux/.gitignore +++ b/stubdom-linux/.gitignore @@ -1,3 +1,5 @@ /linux-*.tar.xz /linux-*/ /vmlinuz-stubdom +/initramfs +/stubdom-disk.img diff --git a/stubdom-linux/Makefile b/stubdom-linux/Makefile index 0844046..93f8f48 100644 --- a/stubdom-linux/Makefile +++ b/stubdom-linux/Makefile @@ -9,7 +9,13 @@ LINUX_V=linux-3.4.13 QEMU_TREE=git://xenbits.xen.org/people/aperard/qemu-dm.git QEMU_BRANCH=origin/stubdom-preview1 -all: vmlinuz-stubdom +# Stubdom disk content +STUBDOM_DISK_FILE= \ + qemu-build/i386-softmmu/qemu-system-i386 \ + extra/initscript \ + extra/qemu-ifup + +all: stubdom-disk.img vmlinuz-stubdom qemu-remote: export GIT=$(GIT); \ @@ -67,3 +73,11 @@ $(LINUX_V)/arch/x86/boot/bzImage: $(LINUX_V)/.config vmlinuz-stubdom: $(LINUX_V)/arch/x86/boot/bzImage cp -f $^ $@ + +stubdom-disk.img: mk-ramdisk-common mk-ramdisk-ioemu $(STUBDOM_DISK_FILE) + env -u MAKELEVEL -u MAKEFLAGS -u MFLAGS ./mk-ramdisk-ioemu + chmod a-w $@ + +install: stubdom-disk.img vmlinuz-stubdom + cp -f vmlinuz-stubdom $(DESTDIR)/usr/lib/xen/boot/ + cp -f stubdom-disk.img $(DESTDIR)/usr/lib/xen/boot/ diff --git a/stubdom-linux/extra/initscript b/stubdom-linux/extra/initscript new file mode 100644 index 0000000..122892f --- /dev/null +++ b/stubdom-linux/extra/initscript @@ -0,0 +1,40 @@ +#!/bin/busybox sh + +_initscript_panic() { + sleep 10 +} + +trap _initscript_panic 0 + +set -e +set -x +mount -t sysfs /sys /sys +mount -t proc /proc /proc +mount -t xenfs -o nodev /proc/xen /proc/xen + +# TODO: Check if there is network for the vm before doing this +if test -e /sys/class/net/eth0; then + ip link set eth0 address fe:ff:ff:ff:ff:fe + ip addr flush eth0 + ip link set eth0 up + brctl addbr br0 + brctl addif br0 eth0 + ip link set br0 up +else + echo "No network interface named eth0." + ls -l /sys/class/net/ +fi + +# TODO Could probably to xenstore-read `xenstore-read vm`/image/dmargs +# because /local/domain/$domid is probably the root for relative path +domid=$(xenstore-read target) +dom_path="/local/domain/$domid" +vm_path=$(xenstore-read "$dom_path/vm") +dm_args=$(xenstore-read "$vm_path/image/dmargs") + +( sleep 30; free ) & +( sleep 60; free ) & +#( sleep 120; ip addr ) & +( sleep 120; free ) & +free +/bin/qemu $dm_args diff --git a/stubdom-linux/extra/qemu-ifup b/stubdom-linux/extra/qemu-ifup new file mode 100644 index 0000000..d71672b --- /dev/null +++ b/stubdom-linux/extra/qemu-ifup @@ -0,0 +1,7 @@ +#! /bin/busybox sh + +ip link set "$1" down +ip link set "$1" address fe:ff:ff:ff:ff:fd +ip addr flush "$1" +brctl addif br0 "$1" +ip link set "$1" up diff --git a/stubdom-linux/mk-ramdisk-common b/stubdom-linux/mk-ramdisk-common new file mode 100755 index 0000000..9a4a810 --- /dev/null +++ b/stubdom-linux/mk-ramdisk-common @@ -0,0 +1,178 @@ +#!/bin/bash +# +# This a simple implementaton of mkinitrd + + +# Set the umask. For iscsi, the initrd can contain platintext +# password (chap secret), so only allow read by owner. +umask 022 + +TMPDIR="/tmp" +PROBE="yes" +MNTIMAGE="`pwd`/initramfs/" +IMAGE="./initramfs.cpio" +verbose="" +: ${debug:=false} +case $debug in + true|false) ;; + *) + echo ''$debug need to be true or false.'' + exit 1 + ;; +esac +$debug && verbose=''-v'' + +DSO_DEPS="" +LDSO="" +get_dso_deps() { + bin="$1" ; shift + DSO_DEPS="" + + declare -a FILES + declare -a NAMES + + # this is a hack, but the only better way requires binutils or elfutils + # be installed. i.e., we need readelf to find the interpretter. + if [ -z "$LDSO" ]; then + for ldso in /lib*/ld*.so* ; do + [ -L $ldso ] && continue + [ -x $ldso ] || continue + $ldso --verify $bin >/dev/null 2>&1 || continue + LDSO="$ldso" + done + fi + + # I still hate shell. + declare -i n=0 + while read NAME I0 FILE ADDR I1 ; do + # ignore libfakeroot lib + [ "$NAME" == "libfakeroot-sysv.so" ] && continue + [ "$NAME" == "libfakeroot.so" ] && continue + [ "$NAME" == "libfakeroot-0.so" ] && continue + [ "$FILE" == "not" ] && FILE="$FILE $ADDR" + NAMES[$n]="$NAME" + FILES[$n]="$FILE" + n=$((n+1)) + done << EOF + $(LD_TRACE_PRELINKING=1 LD_WARN= LD_TRACE_LOADED_OBJECTS=1 \ + $LDSO $bin 2>/dev/null) +EOF + + [ ${#FILES[*]} -eq 0 ] && return + + # we don''t want the name of the binary in the list + if [ "${FILES[0]}" == "$bin" ]; then + FILES[0]="" + NAMES[0]="" + [ ${#FILES[*]} -eq 1 ] && return + fi + + declare -i n=0 + while [ $n -lt ${#FILES[*]} ]; do + FILE="${FILES[$n]}" + if [ "$FILE" == "not found" ]; then + cat 1>&2 <<EOF +There are missing files on your system. The dynamic object $bin +requires ${NAMES[$n]} n order to properly function. mkinitrd cannot continue. +EOF + exit 1 + fi + case "$FILE" in + /lib*) + TLIBDIR=`echo "$FILE" | sed ''s,\(/lib[^/]*\)/.*$,\1,''` + BASE=`basename "$FILE"` + # Prefer nosegneg libs over direct segment accesses on i686. + if [ -f "$TLIBDIR/i686/nosegneg/$BASE" ]; then + FILE="$TLIBDIR/i686/nosegneg/$BASE" + # Otherwise, prefer base libraries rather than their optimized + # variants. + elif [ -f "$TLIBDIR/$BASE" ]; then + FILE="$TLIBDIR/$BASE" + fi + FILES[$n]="$FILE" + ;; + esac + dynamic="yes" + n=$((n+1)) + done + + DSO_DEPS="${FILES[@]}" +} + +readlink_() { + l=$(readlink "$1") + if ! test -e "$l"; then + echo "$(dirname "$1")/$l" + else + echo "$l" + fi +} + +indent_chars="_" +inst() { + if [ "$#" != "2" -a "$#" != "3" ];then + echo "usage: inst <file> <root> [<destination file>]" + return 1 + fi + local file="$1" ; shift + local root="${1%%/}/"; shift + local dest="${1##/}"; shift || true + [ -z "$dest" ] && dest="${file##/}" + + local old_indent_chars=${indent_chars} + indent_chars="${indent_chars} " + indent=${indent_chars:2} + + mkdir -p "$root/$(dirname $dest)" + + local RET=0 + local target="" + [ -L "$file" ] && target=$(readlink_ "$file") + if [ -n "$target" -a "$dest" != "$target" ]; then + if [ -e "$root$dest" ]; then + $debug && echo "${indent}$dest already exists" + RET=0 + else + $debug && echo "l${indent:1}$file -> $dest" + ln -sf "$(readlink "$file")" "$root$dest" + + inst "$target" "$root" "/lib/$(basename $target)" + l=`echo "$x" | sed -n ''s,\(/lib[^/]*\)/.*$,\1,p''` + if [ -n "$l" ]; then + inst "$x" "$root" "$l"/`basename "$x"` + else + inst "$x" "$root" + fi + RET=$? + indent_chars=${old_indent_chars} + return $RET + fi + fi + + if [ -e "$root$dest" ]; then + # echo "${indent}$root$dest already exists" + RET=0 + else + if [ -n "$target" -a -L "$target" ]; then + inst "$target" "$root" + RET=$? + else + $debug && echo "${indent}$file -> $dest" + cp -aL "$file" "$root$dest" + + get_dso_deps "$file" + local DEPS="$DSO_DEPS" + for x in $DEPS ; do + $debug && echo "_${indent:1}$x (deb of $(basename $file)" + #TLIBDIR=`echo "${x#$XEN_LIB}" | sed -r ''s,.*(/lib[^/]*)/.*$,\1,''` + #[ "$TLIBDIR" == "$(basename "$x")" ] && + TLIBDIR="/lib" + BASE=`basename "$x"` + inst "$x" "$root" "$TLIBDIR/$BASE" + done + RET=$? + fi + fi + indent_chars=${old_indent_chars} + return $RET +} diff --git a/stubdom-linux/mk-ramdisk-ioemu b/stubdom-linux/mk-ramdisk-ioemu new file mode 100755 index 0000000..9b222d1 --- /dev/null +++ b/stubdom-linux/mk-ramdisk-ioemu @@ -0,0 +1,124 @@ +#!/bin/bash + +XEN_ROOT="`pwd`/.." + +script_qemu_ifup="extra/qemu-ifup" +script_init="extra/initscript" + +debug=false +verbose+ +set -e +export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$XEN_ROOT/tools/xenstore" +export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$XEN_ROOT/tools/libxc" + +source ./mk-ramdisk-common + +cp(){ + command cp $verbose "$@" +} + +rm -fr "$MNTIMAGE" "$IMAGE" + +mkdir -p "$MNTIMAGE"/{bin,etc,proc/xen,sys,lib,usr,dev,tmp} +ln -s ../lib "$MNTIMAGE"/usr/lib +ln -s lib "$MNTIMAGE"/lib64 + +echo "Building initrd in $MNTIMAGE" +#inst /bin/busybox "$MNTIMAGE" /bin/busybox +cp -L /bin/busybox "$MNTIMAGE/bin/busybox" +# Will use make install from qemu +make DESTDIR="$MNTIMAGE" -C qemu-build install +# this gather libs install on the system +inst "$MNTIMAGE/bin/qemu-system-i386" "$MNTIMAGE" /bin/qemu + +# this cp keep the link to ld-2.11.x.so +if test "`uname -m`" = x86_64; then + cp --no-dereference "/lib/ld-linux-x86-64.so.2" "$MNTIMAGE/lib/ld-linux-x86-64.so.2" +else + cp --no-dereference "/lib/ld-linux.so.2" "$MNTIMAGE/lib/ld-linux.so.2" +fi + +inst "$XEN_ROOT/tools/xenstore/xenstore-read" "$MNTIMAGE" "/bin/xenstore-read" + +cp "$script_qemu_ifup" "$MNTIMAGE/etc/" +chmod +x "$MNTIMAGE/etc/qemu-ifup" +cp "$script_init" "$MNTIMAGE/init" +chmod 755 "$MNTIMAGE/init" + +mkdir -p $MNTIMAGE/etc/udev +touch $MNTIMAGE/etc/udev/udev.conf + +findall() { + find "$@" +} + +ln -s busybox "$MNTIMAGE/bin/sleep" +ln -s busybox "$MNTIMAGE/bin/mount" + +try_make_disk=true +if $try_make_disk; then + stubdom_disk=stubdom-disk.img + rm -f $stubdom_disk + dd if=/dev/null of=$stubdom_disk bs=1M seek=40 + mkfs.ext2 -q -F -m0 $stubdom_disk + + cd "$MNTIMAGE" + stubdom_disk="../$stubdom_disk" + new_link(){ + image=$1 + link=$2 + target=`readlink $link` + dir=`dirname $link` + dir=${dir#./} + name_link=$(basename $link) + dir_inode=$(debugfs -R "stat /$dir" $image 2>/dev/null | + sed -nr ''s/^Inode: ([[:digit:]]+)[[:space:]].*/\1/p'') + test "$dir_inode" || echo ''no dir inode found'' + test "$dir_inode" + while true; do + free_inode=$(debugfs -R "find_free_inode $dir_inode 0777" -w $image 2>/dev/null | + sed -nr ''s/^Free inode found: ([[:digit:]]+)$/\1/p'') + undel_output="$(debugfs -R "undel <$free_inode> /$dir/$name_link" -w $image 2>&1)" + if grep -q "make_link: No free space in the directory" <<<"$undel_output"; then + debugfs -R "expand_dir /$dir" -w $image 2>/dev/null + else + break + fi + done + debugfs -f <( + echo "cd /$dir" + echo "set_inode_field $name_link mode 0120777" + echo "set_inode_field $name_link size ${#target}" + # TODO still need to write the link into blocks + if test ${#target} -lt $((12*4)); then + # write into direct block + blockn=0 + while test "$target"; do + t="${target:0:4}" + target="${target:4}" + #convert a four charactere string into hexa + val=$(printf ''0x%02x%02x%02x%02x\n'' \''${t:3:1} \''${t:2:1} \''${t:1:1} \''${t:0:1}) + echo "set_inode_field $name_link block[$blockn] $val" + blockn=$((blockn+1)) + done + else + # write into a block + echo >&2 ".... write into block not implemented" + fi + ) -w $image >/dev/null 2>/dev/null + } + # TODO Should check for "copy_file: Could not allocate block in ext2 filesystem" + debugfs -f <(find . \ + \( -type d \! -name . -printf ''cd /\nmkdir %h/%f\n'' \) \ + -o \( -type f -printf ''cd /%h\nwrite %h/%f %f\n'' \) \ + | sed -re ''s%^((mkdir|cd) )./%\1/%'' ) -w $stubdom_disk >/dev/null + find . -type l | while read line; do + new_link $stubdom_disk "$line" + done + fsck.ext2 -fy $stubdom_disk || true + cd - >/dev/null +else + (cd "$MNTIMAGE"; findall . | cpio -H newc --quiet -o) >| "$IMAGE" || exit 1 + gzip -f "$IMAGE" +fi -- Anthony PERARD
Anthony PERARD
2013-Apr-17 19:09 UTC
[RFC 4/6] libxl: Add "stubdomain_version" to domain_build_info.
This enum give the ability to select between the MiniOS based stubdomain and the Linux based stubdomain. It can be written in a VM config file via "stubdomain_version" variable, but will be automatically filled by the appropriate value depending on the device_model_version. To use the stubdomain, it''s the same config option "devive_model_stubdomain_override=1" to force the stubdomain. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> --- tools/libxl/libxl_create.c | 34 +++++++++++++++++++++++++++++----- tools/libxl/libxl_types.idl | 7 +++++++ tools/libxl/xl_cmdimpl.c | 14 ++++++++++++++ 3 files changed, 50 insertions(+), 5 deletions(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index ae72f21..8a6a254 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -166,12 +166,36 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, } if (b_info->type == LIBXL_DOMAIN_TYPE_HVM && - b_info->device_model_version !- LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL && libxl_defbool_val(b_info->device_model_stubdomain)) { - LIBXL__LOG(CTX, XTL_ERROR, - "device model stubdomains require \"qemu-xen-traditional\""); - return ERROR_INVAL; + if (!b_info->stubdomain_version) { + switch (b_info->device_model_version) { + case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL: + b_info->stubdomain_version = LIBXL_STUBDOMAIN_VERSION_MINIOS; + break; + case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN: + b_info->stubdomain_version = LIBXL_STUBDOMAIN_VERSION_LINUX; + break; + default: abort(); + } + } + + switch (b_info->device_model_version) { + case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL: + if (b_info->stubdomain_version != LIBXL_STUBDOMAIN_VERSION_MINIOS) { + LIBXL__LOG(CTX, XTL_ERROR, + "\"qemu-xen-traditional\" require \"minios\" as stubdomain"); + return ERROR_INVAL; + } + break; + case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN: + if (b_info->stubdomain_version != LIBXL_STUBDOMAIN_VERSION_LINUX) { + LIBXL__LOG(CTX, XTL_ERROR, + "\"qemu-xen\" require \"linux\" as stubdomain"); + return ERROR_INVAL; + } + break; + default: abort(); + } } if (!b_info->max_vcpus) diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index fcb1ecd..9aeb677 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -39,6 +39,12 @@ libxl_device_model_version = Enumeration("device_model_version", [ (2, "QEMU_XEN"), # Upstream based qemu-xen device model ]) +# Give the kernel running in the stub-domain +libxl_stubdomain_version = Enumeration("stubdomain_version", [ + (1, "MINIOS"), + (2, "LINUX"), + ]) + libxl_console_type = Enumeration("console_type", [ (1, "SERIAL"), (2, "PV"), @@ -278,6 +284,7 @@ libxl_domain_build_info = Struct("domain_build_info",[ ("device_model_version", libxl_device_model_version), ("device_model_stubdomain", libxl_defbool), + ("stubdomain_version", libxl_stubdomain_version), # if you set device_model you must set device_model_version too ("device_model", string), ("device_model_ssidref", uint32), diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 98ecf67..75340c7 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -1451,8 +1451,22 @@ skip_vfb: } } else if (b_info->device_model) fprintf(stderr, "WARNING: device model override given without specific DM version\n"); + xlu_cfg_get_defbool (config, "device_model_stubdomain_override", &b_info->device_model_stubdomain, 0); + if (!xlu_cfg_get_string (config, "stubdomain_version", &buf, 0)) { + if (!strcmp(buf, "minios")) { + b_info->stubdomain_version = LIBXL_STUBDOMAIN_VERSION_MINIOS; + libxl_defbool_set(&b_info->device_model_stubdomain, true); + } else if (!strcmp(buf, "linux")) { + b_info->stubdomain_version = LIBXL_STUBDOMAIN_VERSION_LINUX; + libxl_defbool_set(&b_info->device_model_stubdomain, true); + } else { + fprintf(stderr, + "Unknown stubdomain_version \"%s\" specified\n", buf); + exit(1); + } + } if (!xlu_cfg_get_string (config, "device_model_stubdomain_seclabel", &buf, 0)) { -- Anthony PERARD
Anthony PERARD
2013-Apr-17 19:09 UTC
[RFC 5/6] libxl: Handle Linux stubdomain specifique QEMU option.
There is few things that are not possible for now in the stubdomain, the QMP socket and graphique output, and few other things that are handled in an other way. This patch try to fix the command line passed to the QEMU in the Linux stubdomain. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> --- tools/libxl/libxl_dm.c | 71 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 52 insertions(+), 19 deletions(-) diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index d10a58f..6180a01 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -19,9 +19,12 @@ #include "libxl_internal.h" -static const char *libxl_tapif_script(libxl__gc *gc) +static const char *libxl_tapif_script(libxl__gc *gc, + const libxl_domain_build_info *info) { #ifdef __linux__ + if (info->stubdomain_version == LIBXL_STUBDOMAIN_VERSION_LINUX) + return libxl__sprintf(gc, "/etc/qemu-ifup"); return libxl__strdup(gc, "no"); #else return libxl__sprintf(gc, "%s/qemu-ifup", libxl__xen_script_dir_path()); @@ -257,8 +260,8 @@ static char ** libxl__build_device_model_args_old(libxl__gc *gc, "tap,vlan=%d,ifname=%s,bridge=%s," "script=%s,downscript=%s", nics[i].devid, ifname, nics[i].bridge, - libxl_tapif_script(gc), - libxl_tapif_script(gc)), + libxl_tapif_script(gc, b_info), + libxl_tapif_script(gc, b_info)), NULL); ioemu_nics++; } @@ -372,14 +375,17 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc, "-xen-domid", libxl__sprintf(gc, "%d", guest_domid), NULL); - flexarray_append(dm_args, "-chardev"); - flexarray_append(dm_args, - libxl__sprintf(gc, "socket,id=libxl-cmd," - "path=%s/qmp-libxl-%d,server,nowait", - libxl__run_dir_path(), guest_domid)); + /* There is currently no way to access the QMP socket in the stubdom */ + if (!libxl_defbool_val(b_info->device_model_stubdomain)) { + flexarray_append(dm_args, "-chardev"); + flexarray_append(dm_args, + libxl__sprintf(gc, "socket,id=libxl-cmd," + "path=%s/qmp-libxl-%d,server,nowait", + libxl__run_dir_path(), guest_domid)); - flexarray_append(dm_args, "-mon"); - flexarray_append(dm_args, "chardev=libxl-cmd,mode=control"); + flexarray_append(dm_args, "-mon"); + flexarray_append(dm_args, "chardev=libxl-cmd,mode=control"); + } if (b_info->type == LIBXL_DOMAIN_TYPE_PV) { flexarray_append(dm_args, "-xen-attach"); @@ -556,8 +562,8 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc, "type=tap,id=net%d,ifname=%s," "script=%s,downscript=%s", nics[i].devid, ifname, - libxl_tapif_script(gc), - libxl_tapif_script(gc))); + libxl_tapif_script(gc, b_info), + libxl_tapif_script(gc, b_info))); ioemu_nics++; } } @@ -622,6 +628,10 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc, drive = libxl__sprintf (gc, "if=ide,index=%d,media=cdrom,cache=writeback,id=ide-%i", disk, dev_number); + else if (b_info->stubdomain_version == LIBXL_STUBDOMAIN_VERSION_LINUX) + drive = libxl__sprintf + (gc, "file=%s,if=ide,index=%d,media=cdrom,cache=writeback,format=%s,id=ide-%i", + "/dev/xvdc", disk, "host_cdrom", dev_number); else drive = libxl__sprintf (gc, "file=%s,if=ide,index=%d,media=cdrom,format=%s,cache=writeback,id=ide-%i", @@ -650,9 +660,14 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc, (gc, "file=%s,if=scsi,bus=0,unit=%d,format=%s,cache=writeback", disks[i].pdev_path, disk, format); else if (disk < 4) - drive = libxl__sprintf - (gc, "file=%s,if=ide,index=%d,media=disk,format=%s,cache=writeback", - disks[i].pdev_path, disk, format); + if (b_info->stubdomain_version == LIBXL_STUBDOMAIN_VERSION_LINUX) + drive = libxl__sprintf + (gc, "file=%s,if=ide,index=%d,media=disk,cache=writeback,format=%s", + "/dev/xvda", disk, "host_device"); + else + drive = libxl__sprintf + (gc, "file=%s,if=ide,index=%d,media=disk,cache=writeback,format=%s", + disks[i].pdev_path, disk, format); else continue; /* Do not emulate this disk */ } @@ -733,7 +748,7 @@ static int libxl__vfb_and_vkb_from_hvm_guest_config(libxl__gc *gc, static int libxl__write_stub_dmargs(libxl__gc *gc, int dm_domid, int guest_domid, - char **args) + char **args, bool linux_stubdom) { libxl_ctx *ctx = libxl__gc_owner(gc); int i; @@ -761,10 +776,28 @@ static int libxl__write_stub_dmargs(libxl__gc *gc, i = 1; dmargs[0] = ''\0''; while (args[i] != NULL) { - if (strcmp(args[i], "-sdl") && strcmp(args[i], "-M") && strcmp(args[i], "xenfv")) { - strcat(dmargs, " "); - strcat(dmargs, args[i]); + if (!linux_stubdom) { + if (!(strcmp(args[i], "-sdl") && strcmp(args[i], "-M") && strcmp(args[i], "xenfv"))) { + i++; + continue; + } + } else { + if (!strcmp(args[i], "-sdl")) { + i++; + continue; + } + if (!strcmp(args[i], "-incoming") + || !strcmp(args[i], "-vnc") + || !strcmp(args[i], "-vga")) { + i += 2; + continue; + } + if (!strcmp(args[i], "-serial")) { + args[i+1] = "/dev/hvc1"; + } } + strcat(dmargs, " "); + strcat(dmargs, args[i]); i++; } path = libxl__sprintf(gc, "%s/image/dmargs", vm_path); -- Anthony PERARD
Anthony PERARD
2013-Apr-17 19:09 UTC
[RFC 6/6] libxl: Build the domain with a Linux based stubdomain.
This will build a stubdomain with QEMU upstream. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> --- tools/libxl/libxl.c | 25 ++++++++-- tools/libxl/libxl_create.c | 7 ++- tools/libxl/libxl_dm.c | 107 ++++++++++++++++++++++++++++++++++++------- tools/libxl/libxl_internal.c | 22 +++++++++ tools/libxl/libxl_internal.h | 4 ++ 5 files changed, 145 insertions(+), 20 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 03a9782..8090408 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -1561,8 +1561,17 @@ static int libxl__primary_console_find(libxl_ctx *ctx, uint32_t domid_vm, if (stubdomid) { *domid = stubdomid; - *cons_num = STUBDOM_CONSOLE_SERIAL; *type = LIBXL_CONSOLE_TYPE_PV; + switch (libxl__stubdomain_version_running(gc, stubdomid)) { + case LIBXL_STUBDOMAIN_VERSION_MINIOS: + *cons_num = STUBDOM_CONSOLE_SERIAL; + break; + case LIBXL_STUBDOMAIN_VERSION_LINUX: + *cons_num = 1; + break; + default: + abort(); + } } else { switch (libxl__domain_type(gc, domid_vm)) { case LIBXL_DOMAIN_TYPE_HVM: @@ -3775,8 +3784,18 @@ int libxl_domain_need_memory(libxl_ctx *ctx, libxl_domain_build_info *b_info, switch (b_info->type) { case LIBXL_DOMAIN_TYPE_HVM: *need_memkb += b_info->shadow_memkb + LIBXL_HVM_EXTRA_MEMORY; - if (libxl_defbool_val(b_info->device_model_stubdomain)) - *need_memkb += 32 * 1024; + if (libxl_defbool_val(b_info->device_model_stubdomain)) { + switch (b_info->stubdomain_version) { + case LIBXL_STUBDOMAIN_VERSION_MINIOS: + *need_memkb += 32 * 1024; + break; + case LIBXL_STUBDOMAIN_VERSION_LINUX: + *need_memkb += LIBXL_LINUX_STUBDOM_MEM * 1024; + break; + default: + abort(); + } + } break; case LIBXL_DOMAIN_TYPE_PV: *need_memkb += b_info->shadow_memkb + LIBXL_PV_EXTRA_MEMORY; diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 8a6a254..c970c95 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -1111,7 +1111,12 @@ static void domcreate_devmodel_started(libxl__egc *egc, if (dcs->dmss.dm.guest_domid) { if (d_config->b_info.device_model_version == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) { - libxl__qmp_initializations(gc, domid, d_config); + if (!libxl_defbool_val(d_config->b_info.device_model_stubdomain)) { + libxl__qmp_initializations(gc, domid, d_config); + } else { + int stubdom_domid = dcs->dmss.pvqemu.guest_domid; + libxl__qmp_initializations(gc, stubdom_domid, d_config); + } } } diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index 6180a01..fa4354a 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -814,6 +814,16 @@ retry_transaction: return 0; } +static int libxl__store_libxl_entry(libxl__gc *gc, uint32_t domid, + const char *name, const char *value) +{ + char *path = NULL; + + path = libxl__xs_libxl_path(gc, domid); + path = libxl__sprintf(gc, "%s/%s", path, name); + return libxl__xs_write(gc, XBT_NULL, path, "%s", value); +} + static void spawn_stubdom_pvqemu_cb(libxl__egc *egc, libxl__dm_spawn_state *stubdom_dmss, int rc); @@ -844,6 +854,7 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss) char **args; struct xs_permissions perm[2]; xs_transaction_t t; + libxl_device_disk disk_stub; /* convenience aliases */ libxl_domain_config *const dm_config = &sdss->dm_config; @@ -852,10 +863,15 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss) libxl__domain_build_state *const d_state = sdss->dm.build_state; libxl__domain_build_state *const stubdom_state = &sdss->dm_state; - if (guest_config->b_info.device_model_version !- LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL) { - ret = ERROR_INVAL; - goto out; + assert(libxl_defbool_val(guest_config->b_info.device_model_stubdomain)); + + if (guest_config->b_info.stubdomain_version == LIBXL_STUBDOMAIN_VERSION_LINUX) { + if (d_state->saved_state) { + LOG(ERROR, "Save/Restore not supported yet with Linux Stubdom."); + ret = -1; + goto out; + } + } sdss->pvqemu.guest_domid = 0; @@ -872,7 +888,16 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss) libxl_domain_build_info_init_type(&dm_config->b_info, LIBXL_DOMAIN_TYPE_PV); dm_config->b_info.max_vcpus = 1; - dm_config->b_info.max_memkb = 32 * 1024; + switch (guest_config->b_info.stubdomain_version) { + case LIBXL_STUBDOMAIN_VERSION_MINIOS: + dm_config->b_info.max_memkb = 32 * 1024; + break; + case LIBXL_STUBDOMAIN_VERSION_LINUX: + dm_config->b_info.max_memkb = LIBXL_LINUX_STUBDOM_MEM * 1024; + break; + default: + abort(); + } dm_config->b_info.target_memkb = dm_config->b_info.max_memkb; dm_config->b_info.u.pv.features = ""; @@ -906,10 +931,32 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss) dm_config->vkbs = vkb; dm_config->num_vkbs = 1; - stubdom_state->pv_kernel.path - = libxl__abs_path(gc, "ioemu-stubdom.gz", libxl__xenfirmwaredir_path()); - stubdom_state->pv_cmdline = libxl__sprintf(gc, " -d %d", guest_domid); - stubdom_state->pv_ramdisk.path = ""; + switch (guest_config->b_info.stubdomain_version) { + case LIBXL_STUBDOMAIN_VERSION_MINIOS: + stubdom_state->pv_kernel.path + = libxl__abs_path(gc, "ioemu-stubdom.gz", libxl__xenfirmwaredir_path()); + stubdom_state->pv_cmdline = GCSPRINTF(" -d %d", guest_domid); + stubdom_state->pv_ramdisk.path = ""; + break; + case LIBXL_STUBDOMAIN_VERSION_LINUX: + libxl_device_disk_init(&disk_stub); + disk_stub.readwrite = 0; + disk_stub.format = LIBXL_DISK_FORMAT_RAW; + disk_stub.is_cdrom = 0; + disk_stub.vdev = "xvdz"; + disk_stub.pdev_path = libxl__abs_path(gc, "stubdom-disk.img", + libxl__xenfirmwaredir_path()); + ret = libxl__device_disk_setdefault(gc, &disk_stub); + if (ret) goto out; + stubdom_state->pv_kernel.path + = libxl__abs_path(gc, "vmlinuz-stubdom", libxl__xenfirmwaredir_path()); + stubdom_state->pv_cmdline + = "debug console=hvc0 root=/dev/xvdz ro init=/init"; + stubdom_state->pv_ramdisk.path = ""; + break; + default: + abort(); + } /* fixme: this function can leak the stubdom if it fails */ ret = libxl__domain_make(gc, &dm_config->c_info, &sdss->pvqemu.guest_domid); @@ -927,7 +974,12 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss) goto out; } - libxl__write_stub_dmargs(gc, dm_domid, guest_domid, args); + libxl__store_libxl_entry(gc, guest_domid, "dm-version", + libxl_device_model_version_to_string(dm_config->b_info.device_model_version)); + libxl__store_libxl_entry(gc, dm_domid, "stubdom-version", + libxl_stubdomain_version_to_string(guest_config->b_info.stubdomain_version)); + libxl__write_stub_dmargs(gc, dm_domid, guest_domid, args, + guest_config->b_info.stubdomain_version == LIBXL_STUBDOMAIN_VERSION_LINUX); libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "%s/image/device-model-domid", libxl__xs_get_dompath(gc, guest_domid)), @@ -936,6 +988,15 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss) libxl__sprintf(gc, "%s/target", libxl__xs_get_dompath(gc, dm_domid)), "%d", guest_domid); + if (guest_config->b_info.stubdomain_version == LIBXL_STUBDOMAIN_VERSION_LINUX) { + /* qemu-xen is used as a dm in the stubdomain, so we set the bios + * accroding to this */ + libxl__xs_write(gc, XBT_NULL, + libxl__sprintf(gc, "%s/hvmloader/bios", + libxl__xs_get_dompath(gc, guest_domid)), + "%s", + libxl_bios_type_to_string(LIBXL_BIOS_TYPE_SEABIOS)); + } ret = xc_domain_set_target(ctx->xch, dm_domid, guest_domid); if (ret<0) { LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, @@ -963,6 +1024,10 @@ retry_transaction: libxl__multidev_begin(ao, &sdss->multidev); sdss->multidev.callback = spawn_stub_launch_dm; + if (guest_config->b_info.stubdomain_version == LIBXL_STUBDOMAIN_VERSION_LINUX) { + libxl__ao_device *aodev = libxl__multidev_prepare(&sdss->multidev); + libxl__device_disk_add(egc, dm_domid, &disk_stub, aodev); + } libxl__add_disks(egc, ao, dm_domid, dm_config, &sdss->multidev); libxl__multidev_prepared(egc, &sdss->multidev, 0); @@ -1011,6 +1076,10 @@ static void spawn_stub_launch_dm(libxl__egc *egc, if (ret) goto out; + if (guest_config->b_info.stubdomain_version == LIBXL_STUBDOMAIN_VERSION_LINUX) { + /* no special console for save/restore, only the logging console */ + num_console = 1; + } if (guest_config->b_info.u.hvm.serial) num_console++; @@ -1038,14 +1107,20 @@ static void spawn_stub_launch_dm(libxl__egc *egc, free(filename); break; case STUBDOM_CONSOLE_SAVE: - console[i].output = libxl__sprintf(gc, "file:%s", + if (guest_config->b_info.stubdomain_version + == LIBXL_STUBDOMAIN_VERSION_MINIOS) { + console[i].output = libxl__sprintf(gc, "file:%s", libxl__device_model_savefile(gc, guest_domid)); - break; + break; + } case STUBDOM_CONSOLE_RESTORE: - if (d_state->saved_state) - console[i].output - libxl__sprintf(gc, "pipe:%s", d_state->saved_state); - break; + if (guest_config->b_info.stubdomain_version + == LIBXL_STUBDOMAIN_VERSION_MINIOS) { + if (d_state->saved_state) + console[i].output + libxl__sprintf(gc, "pipe:%s", d_state->saved_state); + break; + } default: console[i].output = "pty"; break; diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c index 5a8cd38..4e5bc24 100644 --- a/tools/libxl/libxl_internal.c +++ b/tools/libxl/libxl_internal.c @@ -347,6 +347,28 @@ int libxl__device_model_version_running(libxl__gc *gc, uint32_t domid) return value; } +int libxl__stubdomain_version_running(libxl__gc *gc, uint32_t domid) +{ + char *path = NULL; + char *stub_version = NULL; + libxl_stubdomain_version value; + + path = libxl__xs_libxl_path(gc, domid); + path = libxl__sprintf(gc, "%s/stubdom-version", path); + stub_version = libxl__xs_read(gc, XBT_NULL, path); + if (!stub_version) { + return LIBXL_STUBDOMAIN_VERSION_MINIOS; + } + + if (libxl_stubdomain_version_from_string(stub_version, &value) < 0) { + libxl_ctx *ctx = libxl__gc_owner(gc); + LIBXL__LOG(ctx, LIBXL__LOG_ERROR, + "fatal: %s contain a wrong value (%s)", path, stub_version); + return -1; + } + return value; +} + int libxl__hotplug_settings(libxl__gc *gc, xs_transaction_t t) { int rc = 0; diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index a6a6b92..f0cee81 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -99,6 +99,7 @@ #define STUBDOM_CONSOLE_RESTORE 2 #define STUBDOM_CONSOLE_SERIAL 3 #define STUBDOM_SPECIAL_CONSOLES 3 +#define LIBXL_LINUX_STUBDOM_MEM 34 #define TAP_DEVICE_SUFFIX "-emu" #define DISABLE_UDEV_PATH "libxl/disable_udev" @@ -1564,6 +1565,9 @@ _hidden libxl__json_object *libxl__json_parse(libxl__gc *gc_opt, const char *s); _hidden int libxl__device_model_version_running(libxl__gc *gc, uint32_t domid); /* Return the system-wide default device model */ _hidden libxl_device_model_version libxl__default_device_model(libxl__gc *gc); + /* Based on /libxl/$domid/stubdom-version xenstore key + * default is minios */ +_hidden int libxl__stubdomain_version_running(libxl__gc *gc, uint32_t domid); /* Check how executes hotplug script currently */ int libxl__hotplug_settings(libxl__gc *gc, xs_transaction_t t); -- Anthony PERARD
On Wed, 2013-04-17 at 20:09 +0100, Anthony PERARD wrote:> Hi all, > > Here is the long overdue patch series to bring support for a Linux based > stubdom which will enable to use QEMU upstream as device model in a stubdom.Thanks. Do you have any performance figures? What are the overheads for the stub domain (e.g. memory)? The dependency on various non-mainline git repos and on out of tree patching are a bit concerning, how are we going to address those? The hardcoded Linux version (currently 3.4.13) is also something of a concern -- what is the intended strategy for managing the kernel used here? Are we planning to periodically update it or something? Is there any requirement to build as root? This seems to add a dependency on /bin/busybox from the host, is there a configure check to ensure this is present? Do we rely on the distro to provide this? Which distros has it been tested on? Do we know that distros in general provide a package with /bin/busybox in it? Ian.
On Wed, 2013-04-17 at 20:09 +0100, Anthony PERARD wrote:> This patch build a disk image intend to be mounted as rootfs by the > stub-domain. It is build using the ''debugfs'' tool and make a ext2 fs.You seem to have some vestigial code for building a cpio style initramfs -- what was wrong with that approach? On the face of it that would seem simpler and less "hacky" than the tricks you have to play with debugfs. [...]> diff --git a/stubdom-linux/extra/initscript b/stubdom-linux/extra/initscript > new file mode 100644 > index 0000000..122892f > --- /dev/null > +++ b/stubdom-linux/extra/initscript > @@ -0,0 +1,40 @@ > +#!/bin/busybox shThis can become the more normal /bin/sh if you put the appropriate symlink in the initrd?> + > +_initscript_panic() { > + sleep 10 > +}Erm...> +trap _initscript_panic 0 > + > +set -e > +set -x > +mount -t sysfs /sys /sys > +mount -t proc /proc /proc > +mount -t xenfs -o nodev /proc/xen /proc/xen > + > +# TODO: Check if there is network for the vm before doing this > +if test -e /sys/class/net/eth0; then > + ip link set eth0 address fe:ff:ff:ff:ff:fe > + ip addr flush eth0 > + ip link set eth0 up > + brctl addbr br0 > + brctl addif br0 eth0 > + ip link set br0 up > +else > + echo "No network interface named eth0." > + ls -l /sys/class/net/ > +fi > + > +# TODO Could probably to xenstore-read `xenstore-read vm`/image/dmargs > +# because /local/domain/$domid is probably the root for relative path > +domid=$(xenstore-read target) > +dom_path="/local/domain/$domid" > +vm_path=$(xenstore-read "$dom_path/vm") > +dm_args=$(xenstore-read "$vm_path/image/dmargs") > + > +( sleep 30; free ) & > +( sleep 60; free ) & > +#( sleep 120; ip addr ) & > +( sleep 120; free ) &Erm....> +free > +/bin/qemu $dm_args > diff --git a/stubdom-linux/extra/qemu-ifup b/stubdom-linux/extra/qemu-ifup > new file mode 100644 > index 0000000..d71672b > --- /dev/null > +++ b/stubdom-linux/extra/qemu-ifup > @@ -0,0 +1,7 @@ > +#! /bin/busybox sh > + > +ip link set "$1" down > +ip link set "$1" address fe:ff:ff:ff:ff:fd > +ip addr flush "$1" > +brctl addif br0 "$1" > +ip link set "$1" upI don''t think this will work for domains with multiple network devices. e.g. if you want vifX.0 on xenbr0 and vifX.1 on xenbr0 in the dom0 backend this will cause them both to get put on the same bridge inside the stubdom and therefore surface as a single device in dom0.> diff --git a/stubdom-linux/mk-ramdisk-common b/stubdom-linux/mk-ramdisk-common > new file mode 100755 > index 0000000..9a4a810 > --- /dev/null > +++ b/stubdom-linux/mk-ramdisk-common > @@ -0,0 +1,178 @@ > +#!/bin/bash > +# > +# This a simple implementaton of mkinitrdimplementation> + > + > +# Set the umask. For iscsi, the initrd can contain platintext > +# password (chap secret), so only allow read by owner. > +umask 022 > + > +TMPDIR="/tmp" > +PROBE="yes" > +MNTIMAGE="`pwd`/initramfs/" > +IMAGE="./initramfs.cpio" > +verbose="" > +: ${debug:=false} > +case $debug in > + true|false) ;; > + *) > + echo ''$debug need to be true or false.'' > + exit 1 > + ;; > +esac > +$debug && verbose=''-v'' > + > +DSO_DEPS="" > +LDSO="" > +get_dso_deps() { > + bin="$1" ; shift > + DSO_DEPS="" > + > + declare -a FILES > + declare -a NAMES > + > + # this is a hack, but the only better way requires binutils or elfutils > + # be installed. i.e., we need readelf to find the interpretter.binutils will surely be installed while building Xen, won''t it? "interpreter"> [...]> + case "$FILE" in > + /lib*) > + TLIBDIR=`echo "$FILE" | sed ''s,\(/lib[^/]*\)/.*$,\1,''` > + BASE=`basename "$FILE"` > + # Prefer nosegneg libs over direct segment accesses on i686. > + if [ -f "$TLIBDIR/i686/nosegneg/$BASE" ]; then > + FILE="$TLIBDIR/i686/nosegneg/$BASE" > + # Otherwise, prefer base libraries rather than their optimized > + # variants.Do we not want optimised e.g. SDL libraries if available, or other libraries related to the provision of things like VNC which are the sorts of instruction hungry stuff that I''d expect to benefit from additional clever instructions... [...]> +# this cp keep the link to ld-2.11.x.so > +if test "`uname -m`" = x86_64; then > + cp --no-dereference "/lib/ld-linux-x86-64.so.2" "$MNTIMAGE/lib/ld-linux-x86-64.so.2" > +else > + cp --no-dereference "/lib/ld-linux.so.2" "$MNTIMAGE/lib/ld-linux.so.2" > +fiDidn''t you jump through some hoops earlier to find the actual dynamic interpreter?> +try_make_disk=true > +if $try_make_disk; then > + stubdom_disk=stubdom-disk.img > + rm -f $stubdom_disk > + dd if=/dev/null of=$stubdom_disk bs=1M seek=40 > + mkfs.ext2 -q -F -m0 $stubdom_disk > + > + cd "$MNTIMAGE" > + stubdom_disk="../$stubdom_disk" > + new_link(){ > + image=$1 > + link=$2 > + target=`readlink $link` > + dir=`dirname $link` > + dir=${dir#./} > + name_link=$(basename $link) > + dir_inode=$(debugfs -R "stat /$dir" $image 2>/dev/null | > + sed -nr ''s/^Inode: ([[:digit:]]+)[[:space:]].*/\1/p'') > + test "$dir_inode" || echo ''no dir inode found'' > + test "$dir_inode" > + while true; do > + free_inode=$(debugfs -R "find_free_inode $dir_inode 0777" -w $image 2>/dev/null | > + sed -nr ''s/^Free inode found: ([[:digit:]]+)$/\1/p'') > + undel_output="$(debugfs -R "undel <$free_inode> /$dir/$name_link" -w $image 2>&1)" > + if grep -q "make_link: No free space in the directory" <<<"$undel_output"; then > + debugfs -R "expand_dir /$dir" -w $image 2>/dev/null > + else > + break > + fi > + done > + debugfs -f <( > + echo "cd /$dir" > + echo "set_inode_field $name_link mode 0120777" > + echo "set_inode_field $name_link size ${#target}" > + # TODO still need to write the link into blocks > + if test ${#target} -lt $((12*4)); then > + # write into direct block > + blockn=0 > + while test "$target"; do > + t="${target:0:4}" > + target="${target:4}" > + #convert a four charactere string into hexa > + val=$(printf ''0x%02x%02x%02x%02x\n'' \''${t:3:1} \''${t:2:1} \''${t:1:1} \''${t:0:1}) > + echo "set_inode_field $name_link block[$blockn] $val" > + blockn=$((blockn+1)) > + done > + else > + # write into a block > + echo >&2 ".... write into block not implemented" > + fi > + ) -w $image >/dev/null 2>/dev/null > + } > + # TODO Should check for "copy_file: Could not allocate block in ext2 filesystem" > + debugfs -f <(find . \ > + \( -type d \! -name . -printf ''cd /\nmkdir %h/%f\n'' \) \ > + -o \( -type f -printf ''cd /%h\nwrite %h/%f %f\n'' \) \ > + | sed -re ''s%^((mkdir|cd) )./%\1/%'' ) -w $stubdom_disk >/dev/nullThis stuff all seems pretty exciting, but isn''t it rather fragile against differences in e2fstools versions etc? I suppose you must have /usr/sbin and /sbin in your $PATH because none of debugfs, mkfs.ext2 and fsck.ext2 appear in my $PATH...> + find . -type l | while read line; do > + new_link $stubdom_disk "$line" > + done > + fsck.ext2 -fy $stubdom_disk || true > + cd - >/dev/null > +else > + (cd "$MNTIMAGE"; findall . | cpio -H newc --quiet -o) >| "$IMAGE" || exit 1 > + gzip -f "$IMAGE"This seems like it should be a much simpler option...> +fi > -- > Anthony PERARD > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel
Ian Campbell
2013-Apr-19 09:29 UTC
Re: [RFC 4/6] libxl: Add "stubdomain_version" to domain_build_info.
On Wed, 2013-04-17 at 20:09 +0100, Anthony PERARD wrote:> This enum give the ability to select between the MiniOS based stubdomain > and the Linux based stubdomain. It can be written in a VM config file via > "stubdomain_version" variable, but will be automatically filled by the > appropriate value depending on the device_model_version. To use the > stubdomain, it''s the same config option > "devive_model_stubdomain_override=1" to force the stubdomain.Given that there is no actual choice available (it''s minios for qemu-xen-trad and Linux for qemu-xen) at the moment perhaps we should just leave this option out for now and cross this bridge if/when there is a real choice to be made? If we do want to keep this then I think I''d prefer to see us extend the semantics of device_model_stubdomain_override to be more than a simple boolean, e.g. make it a libxl enum libxl_device_model_stubdomain_type: 0 = "none" => process dm in dom0 1 = "minios" => mini-os based stubdom 2 = "linux" => ... 3 = "foobsd" => ... etc
Ian Campbell
2013-Apr-19 09:31 UTC
Re: [RFC 5/6] libxl: Handle Linux stubdomain specifique QEMU option.
On Wed, 2013-04-17 at 20:09 +0100, Anthony PERARD wrote:> @@ -372,14 +375,17 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc, > "-xen-domid", > libxl__sprintf(gc, "%d", guest_domid), NULL); > > - flexarray_append(dm_args, "-chardev"); > - flexarray_append(dm_args, > - libxl__sprintf(gc, "socket,id=libxl-cmd," > - "path=%s/qmp-libxl-%d,server,nowait", > - libxl__run_dir_path(), guest_domid)); > + /* There is currently no way to access the QMP socket in the stubdom */This rules out a bunch of interesting/useful functionality doesn''t it?> + if (!libxl_defbool_val(b_info->device_model_stubdomain)) { > + flexarray_append(dm_args, "-chardev"); > + flexarray_append(dm_args, > + libxl__sprintf(gc, "socket,id=libxl-cmd," > + "path=%s/qmp-libxl-%d,server,nowait", > + libxl__run_dir_path(), guest_domid)); > > - flexarray_append(dm_args, "-mon"); > - flexarray_append(dm_args, "chardev=libxl-cmd,mode=control"); > + flexarray_append(dm_args, "-mon"); > + flexarray_append(dm_args, "chardev=libxl-cmd,mode=control"); > + } > > if (b_info->type == LIBXL_DOMAIN_TYPE_PV) { > flexarray_append(dm_args, "-xen-attach");> @@ -733,7 +748,7 @@ static int libxl__vfb_and_vkb_from_hvm_guest_config(libxl__gc *gc, > > static int libxl__write_stub_dmargs(libxl__gc *gc, > int dm_domid, int guest_domid, > - char **args) > + char **args, bool linux_stubdom) > { > libxl_ctx *ctx = libxl__gc_owner(gc); > int i; > @@ -761,10 +776,28 @@ static int libxl__write_stub_dmargs(libxl__gc *gc, > i = 1; > dmargs[0] = ''\0''; > while (args[i] != NULL) { > - if (strcmp(args[i], "-sdl") && strcmp(args[i], "-M") && strcmp(args[i], "xenfv")) { > - strcat(dmargs, " "); > - strcat(dmargs, args[i]); > + if (!linux_stubdom) { > + if (!(strcmp(args[i], "-sdl") && strcmp(args[i], "-M") && strcmp(args[i], "xenfv"))) { > + i++; > + continue; > + } > + } else { > + if (!strcmp(args[i], "-sdl")) { > + i++; > + continue; > + } > + if (!strcmp(args[i], "-incoming") > + || !strcmp(args[i], "-vnc") > + || !strcmp(args[i], "-vga")) { > + i += 2; > + continue; > + } > + if (!strcmp(args[i], "-serial")) { > + args[i+1] = "/dev/hvc1"; > + }Is this all temporary until the various features are supported? Ian.
On Wed, 17 Apr 2013, Anthony PERARD wrote:> diff --git a/stubdom-linux/0001-xen-Don-t-check-for-xen_initial_domain-in-privcmd_io.patch b/stubdom-linux/0001-xen-Don-t-check-for-xen_initial_domain-in-privcmd_io.patch > new file mode 100644 > index 0000000..627b337 > --- /dev/null > +++ b/stubdom-linux/0001-xen-Don-t-check-for-xen_initial_domain-in-privcmd_io.patch > @@ -0,0 +1,39 @@ > +From 94d3502e70882a78ec3abb22379a79afc1292fb0 Mon Sep 17 00:00:00 2001 > +From: Anthony PERARD <anthony.perard@citrix.com> > +Date: Fri, 1 Jun 2012 15:46:39 +0100 > +Subject: [PATCH 1/2] xen: Don''t check for xen_initial_domain in > + privcmd_ioctl_mmap*. > + > +This prevent a stubdom from working. > + > +--- > + drivers/xen/privcmd.c | 6 ------ > + 1 file changed, 6 deletions(-) > + > +diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c > +index ccee0f1..a8d71a3 100644 > +--- a/drivers/xen/privcmd.c > ++++ b/drivers/xen/privcmd.c > +@@ -196,9 +196,6 @@ static long privcmd_ioctl_mmap(void __user *udata) > + LIST_HEAD(pagelist); > + struct mmap_mfn_state state; > + > +- if (!xen_initial_domain()) > +- return -EPERM; > +- > + if (copy_from_user(&mmapcmd, udata, sizeof(mmapcmd))) > + return -EFAULT; > + > +@@ -286,9 +283,6 @@ static long privcmd_ioctl_mmap_batch(void __user *udata) > + LIST_HEAD(pagelist); > + struct mmap_batch_state state; > + > +- if (!xen_initial_domain()) > +- return -EPERM; > +- > + if (copy_from_user(&m, udata, sizeof(m))) > + return -EFAULT; > +I think you should submit both patches separately for inclusion in the Linux kernel.> +Anthony PERARD > + > diff --git a/stubdom-linux/0002-fix-remap_area_mfn_pte_fn.patch b/stubdom-linux/0002-fix-remap_area_mfn_pte_fn.patch > new file mode 100644 > index 0000000..0d5c262 > --- /dev/null > +++ b/stubdom-linux/0002-fix-remap_area_mfn_pte_fn.patch > @@ -0,0 +1,36 @@ > +From 61cd574f29f41046f1c709cfa9da118156babf83 Mon Sep 17 00:00:00 2001 > +From: Anthony PERARD <anthony.perard@citrix.com> > +Date: Fri, 1 Jun 2012 15:47:01 +0100 > +Subject: [PATCH 2/2] fix/remap_area_mfn_pte_fnI think we need a better commit message> +--- > + arch/x86/xen/mmu.c | 13 ++++++++++++- > + 1 file changed, 12 insertions(+), 1 deletion(-) > + > +diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c > +index 69f5857..999fc82 100644 > +--- a/arch/x86/xen/mmu.c > ++++ b/arch/x86/xen/mmu.c > +@@ -2315,7 +2315,18 @@ static int remap_area_mfn_pte_fn(pte_t *ptep, pgtable_t token, > + unsigned long addr, void *data) > + { > + struct remap_data *rmd = data; > +- pte_t pte = pte_mkspecial(pfn_pte(rmd->mfn++, rmd->prot)); > ++ > ++ /* Use the native_make_pte function because we are sure we don''t > ++ * have to do any pfn->mfn translations but at the same time we > ++ * could in a stubdom so xen_initial_domain() would return false. */ > ++ pte_t pte = pte_mkspecial(native_make_pte(((phys_addr_t)(rmd->mfn++) << PAGE_SHIFT) > ++ | massage_pgprot(rmd->prot)));This change is OK. The stubdom part of the comment is a bit confusing and would benefit from a clearer explanation. Also the indentation is wrong.> ++ pteval_t val = pte_val_ma(pte); > ++ > ++ if (pat_enabled && !WARN_ON(val & _PAGE_PAT)) { > ++ if ((val & (_PAGE_PCD | _PAGE_PWT)) == _PAGE_PWT) > ++ val = (val & ~(_PAGE_PCD | _PAGE_PWT)) | _PAGE_PAT; > ++ }Konrad disabled PAT in upstream kernels, see: commit 8eaffa67b43e99ae581622c5133e20b0f48bcef1 Author: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Date: Fri Feb 10 09:16:27 2012 -0500 xen/pat: Disable PAT support for now.
On 19/04/13 10:17, Ian Campbell wrote:> On Wed, 2013-04-17 at 20:09 +0100, Anthony PERARD wrote: >> Hi all, >> >> Here is the long overdue patch series to bring support for a Linux based >> stubdom which will enable to use QEMU upstream as device model in a stubdom. > > Thanks. > > Do you have any performance figures?Yes, I do. I''ve wrote a presentation for Xen Summit. I will dig them and post them back.> What are the overheads for the stub domain (e.g. memory)?For memory, about 34MB for the domain, plus something (a process in dom0) to read the stubdom disk image. I can''t think of something else.> The dependency on various non-mainline git repos and on out of tree > patching are a bit concerning, how are we going to address those?The patches for QEMU need to be upstreamed. Then, we could just use the same tree as the non-stubdom qemu-xen, and decide later if it''s usefull to build QEMU twice. For Linux patches, I''m not sure what to do. - One of them is about checking if a domain have right to call an hypercall. To be upstream, we would need to check if indeed the hypercall can be called from this domain, or maybe let the hypervisor do this check. - There other one fix the an address when the function is called from the stubdom. This one could works in any case.> The hardcoded Linux version (currently 3.4.13) is also something of a > concern -- what is the intended strategy for managing the kernel used > here? Are we planning to periodically update it or something?Well, I''ve start with this one, but I think that any last release could work, provided the patch are upstream or can be applied.> Is there any requirement to build as root?No. The only one would be to build a disk image, but I found a way which works on my system without running as root. But this use ''debugfs'' to write into a ext2 filesystem.> This seems to add a dependency on /bin/busybox from the host, is there a > configure check to ensure this is present? Do we rely on the distro to > provide this? Which distros has it been tested on? Do we know that > distros in general provide a package with /bin/busybox in it?Busybox should be a dependency for the build host, which is probably better than compiling it our self. The scripts does not really check for it, yet. There is another dependency, debugfs, which I''m not sure where we will find it. But I think that I check in debian when I start using it. Thanks, -- Anthony PERARD
On 19/04/13 10:26, Ian Campbell wrote:> On Wed, 2013-04-17 at 20:09 +0100, Anthony PERARD wrote: >> This patch build a disk image intend to be mounted as rootfs by the >> stub-domain. It is build using the ''debugfs'' tool and make a ext2 fs. > > You seem to have some vestigial code for building a cpio style initramfs > -- what was wrong with that approach? On the face of it that would seem > simpler and less "hacky" than the tricks you have to play with debugfs.The initramfs were taking more memory for the stub domain, I could not go under 40MB, and now, with the disk, it''s 34MB the min that the domain his willing to run with.> [...] >> diff --git a/stubdom-linux/extra/initscriptb/stubdom-linux/extra/initscript>> new file mode 100644 >> index 0000000..122892f >> --- /dev/null >> +++ b/stubdom-linux/extra/initscript >> @@ -0,0 +1,40 @@ >> +#!/bin/busybox sh > > This can become the more normal /bin/sh if you put the appropriate > symlink in the initrd?If I recall correctly, I tryed the symlink, and it was not starting. Maybe a hardlink would works.>> + >> +_initscript_panic() { >> + sleep 10 >> +} > > Erm...Yes, that debug stuff which can be removed...>> +trap _initscript_panic 0 >> + >> +set -e >> +set -x >> +mount -t sysfs /sys /sys >> +mount -t proc /proc /proc >> +mount -t xenfs -o nodev /proc/xen /proc/xen >> + >> +# TODO: Check if there is network for the vm before doing this >> +if test -e /sys/class/net/eth0; then >> + ip link set eth0 address fe:ff:ff:ff:ff:fe >> + ip addr flush eth0 >> + ip link set eth0 up >> + brctl addbr br0 >> + brctl addif br0 eth0 >> + ip link set br0 up >> +else >> + echo "No network interface named eth0." >> + ls -l /sys/class/net/ >> +fi >> + >> +# TODO Could probably to xenstore-read `xenstore-read vm`/image/dmargs >> +# because /local/domain/$domid is probably the root for relative path >> +domid=$(xenstore-read target) >> +dom_path="/local/domain/$domid" >> +vm_path=$(xenstore-read "$dom_path/vm") >> +dm_args=$(xenstore-read "$vm_path/image/dmargs") >> + >> +( sleep 30; free ) & >> +( sleep 60; free ) & >> +#( sleep 120; ip addr ) & >> +( sleep 120; free ) & > > Erm....Same.>> +free >> +/bin/qemu $dm_args >> diff --git a/stubdom-linux/extra/qemu-ifupb/stubdom-linux/extra/qemu-ifup>> new file mode 100644 >> index 0000000..d71672b >> --- /dev/null >> +++ b/stubdom-linux/extra/qemu-ifup >> @@ -0,0 +1,7 @@ >> +#! /bin/busybox sh >> + >> +ip link set "$1" down >> +ip link set "$1" address fe:ff:ff:ff:ff:fd >> +ip addr flush "$1" >> +brctl addif br0 "$1" >> +ip link set "$1" up > > I don''t think this will work for domains with multiple network devices. > e.g. if you want vifX.0 on xenbr0 and vifX.1 on xenbr0 in the dom0 > backend this will cause them both to get put on the same bridge inside > the stubdom and therefore surface as a single device in dom0.OK, I will look into that.>> diff --git a/stubdom-linux/mk-ramdisk-commonb/stubdom-linux/mk-ramdisk-common>> new file mode 100755 >> index 0000000..9a4a810 >> --- /dev/null >> +++ b/stubdom-linux/mk-ramdisk-common >> @@ -0,0 +1,178 @@ >> +#!/bin/bash >> +# >> +# This a simple implementaton of mkinitrd > > implementation > >> + >> + >> +# Set the umask. For iscsi, the initrd can contain platintext >> +# password (chap secret), so only allow read by owner. >> +umask 022 >> + >> +TMPDIR="/tmp" >> +PROBE="yes" >> +MNTIMAGE="`pwd`/initramfs/" >> +IMAGE="./initramfs.cpio" >> +verbose="" >> +: ${debug:=false} >> +case $debug in >> + true|false) ;; >> + *) >> + echo ''$debug need to be true or false.'' >> + exit 1 >> + ;; >> +esac >> +$debug && verbose=''-v'' >> + >> +DSO_DEPS="" >> +LDSO="" >> +get_dso_deps() { >> + bin="$1" ; shift >> + DSO_DEPS="" >> + >> + declare -a FILES >> + declare -a NAMES >> + >> + # this is a hack, but the only better way requires binutils orelfutils>> + # be installed. i.e., we need readelf to find the interpretter. > > binutils will surely be installed while building Xen, won''t it?Yes, I will use those for the script.> "interpreter" >> [...] > >> + case "$FILE" in >> + /lib*) >> + TLIBDIR=`echo "$FILE" | sed ''s,\(/lib[^/]*\)/.*$,\1,''` >> + BASE=`basename "$FILE"` >> + # Prefer nosegneg libs over direct segment accesseson i686.>> + if [ -f "$TLIBDIR/i686/nosegneg/$BASE" ]; then >> + FILE="$TLIBDIR/i686/nosegneg/$BASE" >> + # Otherwise, prefer base libraries rather than theiroptimized>> + # variants. > > Do we not want optimised e.g. SDL libraries if available, or other > libraries related to the provision of things like VNC which are the > sorts of instruction hungry stuff that I''d expect to benefit from > additional clever instructions... > [...] > >> +# this cp keep the link to ld-2.11.x.so >> +if test "`uname -m`" = x86_64; then >> + cp --no-dereference "/lib/ld-linux-x86-64.so.2""$MNTIMAGE/lib/ld-linux-x86-64.so.2">> +else >> + cp --no-dereference "/lib/ld-linux.so.2" "$MNTIMAGE/lib/ld-linux.so.2" >> +fi > > Didn''t you jump through some hoops earlier to find the actual dynamic > interpreter?The script was not working for this lib.>> +try_make_disk=true >> +if $try_make_disk; then >> + stubdom_disk=stubdom-disk.img >> + rm -f $stubdom_disk >> + dd if=/dev/null of=$stubdom_disk bs=1M seek=40 >> + mkfs.ext2 -q -F -m0 $stubdom_disk >> + >> + cd "$MNTIMAGE" >> + stubdom_disk="../$stubdom_disk" >> + new_link(){ >> + image=$1 >> + link=$2 >> + target=`readlink $link` >> + dir=`dirname $link` >> + dir=${dir#./} >> + name_link=$(basename $link) >> + dir_inode=$(debugfs -R "stat /$dir" $image 2>/dev/null | >> + sed -nr ''s/^Inode: ([[:digit:]]+)[[:space:]].*/\1/p'') >> + test "$dir_inode" || echo ''no dir inode found'' >> + test "$dir_inode" >> + while true; do >> + free_inode=$(debugfs -R "find_free_inode $dir_inode 0777" -w$image 2>/dev/null |>> + sed -nr ''s/^Free inode found: ([[:digit:]]+)$/\1/p'') >> + undel_output="$(debugfs -R "undel <$free_inode>/$dir/$name_link" -w $image 2>&1)">> + if grep -q "make_link: No free space in the directory"<<<"$undel_output"; then>> + debugfs -R "expand_dir /$dir" -w $image 2>/dev/null >> + else >> + break >> + fi >> + done >> + debugfs -f <( >> + echo "cd /$dir" >> + echo "set_inode_field $name_link mode 0120777" >> + echo "set_inode_field $name_link size ${#target}" >> + # TODO still need to write the link into blocks >> + if test ${#target} -lt $((12*4)); then >> + # write into direct block >> + blockn=0 >> + while test "$target"; do >> + t="${target:0:4}" >> + target="${target:4}" >> + #convert a four charactere string into hexa >> + val=$(printf ''0x%02x%02x%02x%02x\n'' \''${t:3:1}\''${t:2:1} \''${t:1:1} \''${t:0:1})>> + echo "set_inode_field $name_link block[$blockn] $val" >> + blockn=$((blockn+1)) >> + done >> + else >> + # write into a block >> + echo >&2 ".... write into block not implemented" >> + fi >> + ) -w $image >/dev/null 2>/dev/null >> + } >> + # TODO Should check for "copy_file: Could not allocate block inext2 filesystem">> + debugfs -f <(find . \ >> + \( -type d \! -name . -printf ''cd /\nmkdir %h/%f\n'' \) \ >> + -o \( -type f -printf ''cd /%h\nwrite %h/%f %f\n'' \) \ >> + | sed -re ''s%^((mkdir|cd) )./%\1/%'' ) -w $stubdom_disk >/dev/null > > This stuff all seems pretty exciting, but isn''t it rather fragile > against differences in e2fstools versions etc?Yes, that was the only good enough way to create a disk image as user (not root), with an utility present at least on debian.> I suppose you must have /usr/sbin and /sbin in your $PATH because none > of debugfs, mkfs.ext2 and fsck.ext2 appear in my $PATH...Yes, I don''t remove {,/usr}/sbin from my PATH.>> + find . -type l | while read line; do >> + new_link $stubdom_disk "$line" >> + done >> + fsck.ext2 -fy $stubdom_disk || true >> + cd - >/dev/null >> +else >> + (cd "$MNTIMAGE"; findall . | cpio -H newc --quiet -o) >| "$IMAGE"|| exit 1>> + gzip -f "$IMAGE" > > This seems like it should be a much simpler option...-- Anthony PERARD
On 17/04/13 20:09, Anthony PERARD wrote:> Hi all, > > Here is the long overdue patch series to bring support for a Linux based > stubdom which will enable to use QEMU upstream as device model in a stubdom. > > The first three patches will provide the necessary to build Linux and a disk > image for the stubdomain itself. This is created in a separated directory > "stubdom-linux". Calling `make` in this directory will build Linux and the > disk. Then a `make install` will copy the two files to the same directory as > the MiniOS use. > > The last three patches are the libxl support. There is a field called > "stubdomain_version" which is automatically set to the appropriate value, > depending on the QEMU version used. It call also be set from VM config file. > > So, to start a Linux stubdomain, just set those two variables and it shoud > start: > device_model_stubdomain_override = 1 > device_model_version = "qemu-xen" > > There is few things that does not have support yet and are on my todo list: > - video output > - save/restore > So for now, we have the network and the console and the disk of the domain. > > Regards, > > > Anthony PERARD (6): > linux-stubdomain: Compile QEMU > linux-stubdomain: Compile Linux > linux-stubdomain: Build a disk image.I think this should be done outside of the Xen build system using one of the existing (embedded) build systems. e.g., Yocto. David
On Fri, 2013-04-19 at 12:58 +0100, Anthony PERARD wrote:> On 19/04/13 10:26, Ian Campbell wrote: > > On Wed, 2013-04-17 at 20:09 +0100, Anthony PERARD wrote: > >> This patch build a disk image intend to be mounted as rootfs by the > >> stub-domain. It is build using the ''debugfs'' tool and make a ext2 fs. > > > > You seem to have some vestigial code for building a cpio style initramfs > > -- what was wrong with that approach? On the face of it that would seem > > simpler and less "hacky" than the tricks you have to play with debugfs. > > The initramfs were taking more memory for the stub domain, I could not > go under 40MB, and now, with the disk, it''s 34MB the min that the domain > his willing to run with.How Odd. Do you know why, it seems they should contain approximately the same amount of data.> > [...] > >> diff --git a/stubdom-linux/extra/initscript > b/stubdom-linux/extra/initscript > >> new file mode 100644 > >> index 0000000..122892f > >> --- /dev/null > >> +++ b/stubdom-linux/extra/initscript > >> @@ -0,0 +1,40 @@ > >> +#!/bin/busybox sh > > > > This can become the more normal /bin/sh if you put the appropriate > > symlink in the initrd? > > If I recall correctly, I tryed the symlink, and it was not starting. > Maybe a hardlink would works.The symlink not working is a bit strange, I wonder what the underlying issue is?> > This stuff all seems pretty exciting, but isn''t it rather fragile > > against differences in e2fstools versions etc? > > Yes, that was the only good enough way to create a disk image as user > (not root), with an utility present at least on debian.What is the status of genext2fs these days?> > I suppose you must have /usr/sbin and /sbin in your $PATH because none > > of debugfs, mkfs.ext2 and fsck.ext2 appear in my $PATH... > > Yes, I don''t remove {,/usr}/sbin from my PATH.These are not in $PATH for normal users on many (most?) distros (I expect you have probably added them yourself), so this script won''t work for some proportion of users. Ian.
Ian Campbell, le Fri 19 Apr 2013 13:08:21 +0100, a écrit :> > Yes, that was the only good enough way to create a disk image as user > > (not root), with an utility present at least on debian. > > What is the status of genext2fs these days?Could cpio perhaps be used instead? Samuel
Anthony PERARD
2013-Apr-22 13:31 UTC
Re: [RFC 4/6] libxl: Add "stubdomain_version" to domain_build_info.
On 19/04/13 10:29, Ian Campbell wrote:> On Wed, 2013-04-17 at 20:09 +0100, Anthony PERARD wrote: >> This enum give the ability to select between the MiniOS based stubdomain >> and the Linux based stubdomain. It can be written in a VM config file via >> "stubdomain_version" variable, but will be automatically filled by the >> appropriate value depending on the device_model_version. To use the >> stubdomain, it''s the same config option >> "devive_model_stubdomain_override=1" to force the stubdomain. > > Given that there is no actual choice available (it''s minios for > qemu-xen-trad and Linux for qemu-xen) at the moment perhaps we should > just leave this option out for now and cross this bridge if/when there > is a real choice to be made?I feel like this will be an easier thing to do for now.> If we do want to keep this then I think I''d prefer to see us extend the > semantics of device_model_stubdomain_override to be more than a simple > boolean, e.g. make it a libxl enum libxl_device_model_stubdomain_type: > 0 = "none" => process dm in dom0 > 1 = "minios" => mini-os based stubdom > 2 = "linux" => ... > 3 = "foobsd" => ...With this, I don''t see how to say: "I want a stubdom for this domain." without having to know which type will be the best (or only) choice. So I go for the no choice for the user, beside stubdom or not. -- Anthony PERARD
Anthony PERARD
2013-Apr-22 13:37 UTC
Re: [RFC 5/6] libxl: Handle Linux stubdomain specifique QEMU option.
On 19/04/13 10:31, Ian Campbell wrote:> On Wed, 2013-04-17 at 20:09 +0100, Anthony PERARD wrote: >> @@ -372,14 +375,17 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc, >> "-xen-domid", >> libxl__sprintf(gc, "%d", guest_domid), NULL); >> >> - flexarray_append(dm_args, "-chardev"); >> - flexarray_append(dm_args, >> - libxl__sprintf(gc, "socket,id=libxl-cmd," >> - "path=%s/qmp-libxl-%d,server,nowait", >> - libxl__run_dir_path(), guest_domid)); >> + /* There is currently no way to access the QMP socket in the stubdom */ > > This rules out a bunch of interesting/useful functionality doesn''t it?Yes, it does. Anything that it''s hotplug (even cd-rom). So I''ll have to find a way to the socket from dom0.>> + if (!libxl_defbool_val(b_info->device_model_stubdomain)) { >> + flexarray_append(dm_args, "-chardev"); >> + flexarray_append(dm_args, >> + libxl__sprintf(gc, "socket,id=libxl-cmd," >> + "path=%s/qmp-libxl-%d,server,nowait", >> + libxl__run_dir_path(), guest_domid)); >> >> - flexarray_append(dm_args, "-mon"); >> - flexarray_append(dm_args, "chardev=libxl-cmd,mode=control"); >> + flexarray_append(dm_args, "-mon"); >> + flexarray_append(dm_args, "chardev=libxl-cmd,mode=control"); >> + } >> >> if (b_info->type == LIBXL_DOMAIN_TYPE_PV) { >> flexarray_append(dm_args, "-xen-attach"); > >> @@ -733,7 +748,7 @@ static int libxl__vfb_and_vkb_from_hvm_guest_config(libxl__gc *gc, >> >> static int libxl__write_stub_dmargs(libxl__gc *gc, >> int dm_domid, int guest_domid, >> - char **args) >> + char **args, bool linux_stubdom) >> { >> libxl_ctx *ctx = libxl__gc_owner(gc); >> int i; >> @@ -761,10 +776,28 @@ static int libxl__write_stub_dmargs(libxl__gc *gc, >> i = 1; >> dmargs[0] = ''\0''; >> while (args[i] != NULL) { >> - if (strcmp(args[i], "-sdl") && strcmp(args[i], "-M") && strcmp(args[i], "xenfv")) { >> - strcat(dmargs, " "); >> - strcat(dmargs, args[i]); >> + if (!linux_stubdom) { >> + if (!(strcmp(args[i], "-sdl") && strcmp(args[i], "-M") && strcmp(args[i], "xenfv"))) { >> + i++; >> + continue; >> + } >> + } else { >> + if (!strcmp(args[i], "-sdl")) { >> + i++; >> + continue; >> + } >> + if (!strcmp(args[i], "-incoming") >> + || !strcmp(args[i], "-vnc") >> + || !strcmp(args[i], "-vga")) { >> + i += 2; >> + continue; >> + } >> + if (!strcmp(args[i], "-serial")) { >> + args[i+1] = "/dev/hvc1"; >> + } > > Is this all temporary until the various features are supported?Yes. Well, a better way to handle that would be to alter the domain build_config were all the options the user wants are present. -- Anthony PERARD
On 19/04/13 11:33, Stefano Stabellini wrote:> On Wed, 17 Apr 2013, Anthony PERARD wrote: >> diff --git a/stubdom-linux/0001-xen-Don-t-check-for-xen_initial_domain-in-privcmd_io.patch b/stubdom-linux/0001-xen-Don-t-check-for-xen_initial_domain-in-privcmd_io.patch >> new file mode 100644 >> index 0000000..627b337 >> --- /dev/null >> +++ b/stubdom-linux/0001-xen-Don-t-check-for-xen_initial_domain-in-privcmd_io.patch >> @@ -0,0 +1,39 @@ >> +From 94d3502e70882a78ec3abb22379a79afc1292fb0 Mon Sep 17 00:00:00 2001 >> +From: Anthony PERARD <anthony.perard@citrix.com> >> +Date: Fri, 1 Jun 2012 15:46:39 +0100 >> +Subject: [PATCH 1/2] xen: Don''t check for xen_initial_domain in >> + privcmd_ioctl_mmap*. >> + >> +This prevent a stubdom from working. >> + >> +--- >> + drivers/xen/privcmd.c | 6 ------ >> + 1 file changed, 6 deletions(-) >> + >> +diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c >> +index ccee0f1..a8d71a3 100644 >> +--- a/drivers/xen/privcmd.c >> ++++ b/drivers/xen/privcmd.c >> +@@ -196,9 +196,6 @@ static long privcmd_ioctl_mmap(void __user *udata) >> + LIST_HEAD(pagelist); >> + struct mmap_mfn_state state; >> + >> +- if (!xen_initial_domain()) >> +- return -EPERM; >> +- >> + if (copy_from_user(&mmapcmd, udata, sizeof(mmapcmd))) >> + return -EFAULT; >> + >> +@@ -286,9 +283,6 @@ static long privcmd_ioctl_mmap_batch(void __user *udata) >> + LIST_HEAD(pagelist); >> + struct mmap_batch_state state; >> + >> +- if (!xen_initial_domain()) >> +- return -EPERM; >> +- >> + if (copy_from_user(&m, udata, sizeof(m))) >> + return -EFAULT; >> + > > > I think you should submit both patches separately for inclusion in the > Linux kernel.Definitely. Should we remove the check for initial_domain all together and leave this permission to be handle by Xen? Or should we try to find out if the function is called in a stubdom/dom0 ?>> +Anthony PERARD >> + >> diff --git a/stubdom-linux/0002-fix-remap_area_mfn_pte_fn.patch b/stubdom-linux/0002-fix-remap_area_mfn_pte_fn.patch >> new file mode 100644 >> index 0000000..0d5c262 >> --- /dev/null >> +++ b/stubdom-linux/0002-fix-remap_area_mfn_pte_fn.patch >> @@ -0,0 +1,36 @@ >> +From 61cd574f29f41046f1c709cfa9da118156babf83 Mon Sep 17 00:00:00 2001 >> +From: Anthony PERARD <anthony.perard@citrix.com> >> +Date: Fri, 1 Jun 2012 15:47:01 +0100 >> +Subject: [PATCH 2/2] fix/remap_area_mfn_pte_fn > > I think we need a better commit messageYes, this is definitely not a patch title/comment.>> +--- >> + arch/x86/xen/mmu.c | 13 ++++++++++++- >> + 1 file changed, 12 insertions(+), 1 deletion(-) >> + >> +diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c >> +index 69f5857..999fc82 100644 >> +--- a/arch/x86/xen/mmu.c >> ++++ b/arch/x86/xen/mmu.c >> +@@ -2315,7 +2315,18 @@ static int remap_area_mfn_pte_fn(pte_t *ptep, pgtable_t token, >> + unsigned long addr, void *data) >> + { >> + struct remap_data *rmd = data; >> +- pte_t pte = pte_mkspecial(pfn_pte(rmd->mfn++, rmd->prot)); >> ++ >> ++ /* Use the native_make_pte function because we are sure we don''t >> ++ * have to do any pfn->mfn translations but at the same time we >> ++ * could in a stubdom so xen_initial_domain() would return false. */ >> ++ pte_t pte = pte_mkspecial(native_make_pte(((phys_addr_t)(rmd->mfn++) << PAGE_SHIFT) >> ++ | massage_pgprot(rmd->prot))); > > This change is OK. The stubdom part of the comment is a bit confusing > and would benefit from a clearer explanation.OK, I try to clean the explanation.> Also the indentation is wrong. > > >> ++ pteval_t val = pte_val_ma(pte); >> ++ >> ++ if (pat_enabled && !WARN_ON(val & _PAGE_PAT)) { >> ++ if ((val & (_PAGE_PCD | _PAGE_PWT)) == _PAGE_PWT) >> ++ val = (val & ~(_PAGE_PCD | _PAGE_PWT)) | _PAGE_PAT; >> ++ } > > Konrad disabled PAT in upstream kernels, see: > > commit 8eaffa67b43e99ae581622c5133e20b0f48bcef1 > Author: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> > Date: Fri Feb 10 09:16:27 2012 -0500 > > xen/pat: Disable PAT support for now. >-- Anthony PERARD
On 04/22/2013 09:46 AM, Anthony PERARD wrote:> On 19/04/13 11:33, Stefano Stabellini wrote: >> On Wed, 17 Apr 2013, Anthony PERARD wrote: >>> diff --git a/stubdom-linux/0001-xen-Don-t-check-for-xen_initial_domain-in-privcmd_io.patch b/stubdom-linux/0001-xen-Don-t-check-for-xen_initial_domain-in-privcmd_io.patch >>> new file mode 100644 >>> index 0000000..627b337 >>> --- /dev/null >>> +++ b/stubdom-linux/0001-xen-Don-t-check-for-xen_initial_domain-in-privcmd_io.patch >>> @@ -0,0 +1,39 @@ >>> +From 94d3502e70882a78ec3abb22379a79afc1292fb0 Mon Sep 17 00:00:00 2001 >>> +From: Anthony PERARD <anthony.perard@citrix.com> >>> +Date: Fri, 1 Jun 2012 15:46:39 +0100 >>> +Subject: [PATCH 1/2] xen: Don''t check for xen_initial_domain in >>> + privcmd_ioctl_mmap*. >>> + >>> +This prevent a stubdom from working. >>> + >>> +--- >>> + drivers/xen/privcmd.c | 6 ------ >>> + 1 file changed, 6 deletions(-) >>> + >>> +diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c >>> +index ccee0f1..a8d71a3 100644 >>> +--- a/drivers/xen/privcmd.c >>> ++++ b/drivers/xen/privcmd.c >>> +@@ -196,9 +196,6 @@ static long privcmd_ioctl_mmap(void __user *udata) >>> + LIST_HEAD(pagelist); >>> + struct mmap_mfn_state state; >>> + >>> +- if (!xen_initial_domain()) >>> +- return -EPERM; >>> +- >>> + if (copy_from_user(&mmapcmd, udata, sizeof(mmapcmd))) >>> + return -EFAULT; >>> + >>> +@@ -286,9 +283,6 @@ static long privcmd_ioctl_mmap_batch(void __user *udata) >>> + LIST_HEAD(pagelist); >>> + struct mmap_batch_state state; >>> + >>> +- if (!xen_initial_domain()) >>> +- return -EPERM; >>> +- >>> + if (copy_from_user(&m, udata, sizeof(m))) >>> + return -EFAULT; >>> + >> >> >> I think you should submit both patches separately for inclusion in the >> Linux kernel. > > Definitely. > Should we remove the check for initial_domain all together and leave > this permission to be handle by Xen? Or should we try to find out if the > function is called in a stubdom/dom0 ?This has already been fixed upstream (Linux 3.8). The check should never have been in the Linux kernel as it is the hypervisor''s responsibility to check hypercall permissions, and Xen does this correctly. -- Daniel De Graaf National Security Agency
Anthony PERARD, le Mon 22 Apr 2013 14:46:29 +0100, a écrit :> >> +@@ -286,9 +283,6 @@ static long privcmd_ioctl_mmap_batch(void __user *udata) > >> + LIST_HEAD(pagelist); > >> + struct mmap_batch_state state; > >> + > >> +- if (!xen_initial_domain()) > >> +- return -EPERM; > >> +- > >> + if (copy_from_user(&m, udata, sizeof(m))) > >> + return -EFAULT; > >> + > > > > > > I think you should submit both patches separately for inclusion in the > > Linux kernel. > > Definitely. > Should we remove the check for initial_domain all together and leave > this permission to be handle by Xen?I would tend to say so. Since it''s a matter of hypervisor security, Xen is supposed to check that already anyway, isn''t it? Samuel
Ian Campbell
2013-Apr-22 14:36 UTC
Re: [RFC 4/6] libxl: Add "stubdomain_version" to domain_build_info.
On Mon, 2013-04-22 at 14:31 +0100, Anthony PERARD wrote:> On 19/04/13 10:29, Ian Campbell wrote: > > On Wed, 2013-04-17 at 20:09 +0100, Anthony PERARD wrote: > >> This enum give the ability to select between the MiniOS based stubdomain > >> and the Linux based stubdomain. It can be written in a VM config file via > >> "stubdomain_version" variable, but will be automatically filled by the > >> appropriate value depending on the device_model_version. To use the > >> stubdomain, it''s the same config option > >> "devive_model_stubdomain_override=1" to force the stubdomain. > > > > Given that there is no actual choice available (it''s minios for > > qemu-xen-trad and Linux for qemu-xen) at the moment perhaps we should > > just leave this option out for now and cross this bridge if/when there > > is a real choice to be made? > > I feel like this will be an easier thing to do for now. > > > If we do want to keep this then I think I''d prefer to see us extend the > > semantics of device_model_stubdomain_override to be more than a simple > > boolean, e.g. make it a libxl enum libxl_device_model_stubdomain_type: > > 0 = "none" => process dm in dom0 > > 1 = "minios" => mini-os based stubdom > > 2 = "linux" => ... > > 3 = "foobsd" => ... > > With this, I don''t see how to say: "I want a stubdom for this domain."-1 = "default" ;-)> without having to know which type will be the best (or only) choice. So > I go for the no choice for the user, beside stubdom or not. >