我的站点

一个系统软件工程师的随手涂鸦

Tag: Xen

SLES12版本上Xen的一些变化

今天在网上找到一篇文档,描述了SLES12版本上Xen的一些变化:

(1)grub2
SLES12上使用grub2配置Xen参数。以配置dom0_max_vcpus为例:
a)SLES11使用/boot/grub/menu.lst(参考这里);
b)SLES12使用/etc/default/grub(参考这里)。

(2)xm/xend已经废弃了,要使用xl/libxl。下图做了一个简单对比:

Capture

(3)SLES12 Xen Stack

• Xen 4.4.1  
• kernel 3.12.x  
• libvirt 1.2.5  
• virt-install 1.1.x, vm-install 1.x.x  
• virt-manager 1.1.x  

 

 

Crash工具笔记 (3)—— 在Xen环境使用crash

这两周一直在crash邮件列表里讨论如何在SuSE Xen上使用crash调试Dom0 kernel。邮件来来回回讨论很多(参见这里),最后还发现了一个bug。细节不说了,把最后的结果总结一下:

(1)由于SuSE kerenl默认编译打开CONFIG_STRICT_DEVMEM编译开关,所以crash工具无法完全访问/dev/mem,可以使用/proc/kcore作为代替;

(2)SuSE带有crash.ko驱动(位于:“/lib/modules/uname -r/updates/crash.ko”),但默认没有安装,可以自己手动安装(使用insmod命令),然后就可以使用了:

# crash

crash 7.1.3
Copyright (C) 2002-2014  Red Hat, Inc.
Copyright (C) 2004, 2005, 2006, 2010  IBM Corporation
Copyright (C) 1999-2006  Hewlett-Packard Co
Copyright (C) 2005, 2006, 2011, 2012  Fujitsu Limited
Copyright (C) 2006, 2007  VA Linux Systems Japan K.K.
Copyright (C) 2005, 2011  NEC Corporation
Copyright (C) 1999, 2002, 2007  Silicon Graphics, Inc.
Copyright (C) 1999, 2000, 2001, 2002  Mission Critical Linux, Inc.
This program is free software, covered by the GNU General Public License,
and you are welcome to change it and/or distribute copies of it under
certain conditions.  Enter "help copying" to see the conditions.
This program has absolutely no warranty.  Enter "help warranty" for details.

crash: /boot/xen-4.5.gz: original filename unknown
       Use "-f /boot/xen-4.5.gz" on command line to prevent this message.

WARNING: machine type mismatch:
         crash utility: X86_64
         /var/tmp/xen-4.5.gz_ud3IRy: X86

crash: /boot/symtypes-3.12.49-6-default.gz: original filename unknown
       Use "-f /boot/symtypes-3.12.49-6-default.gz" on command line to
prevent this message.

crash: /boot/symvers-3.12.49-6-default.gz: original filename unknown
       Use "-f /boot/symvers-3.12.49-6-default.gz" on command line to
prevent this message.

GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu"...

      KERNEL: /boot/vmlinux-3.12.49-6-xen.gz
   DEBUGINFO: /usr/lib/debug/boot/vmlinux-3.12.49-6-xen.debug
    DUMPFILE: /dev/crash
        CPUS: 128
        DATE: Fri Nov 20 06:55:06 2015
      UPTIME: 18:51:36
LOAD AVERAGE: 1.76, 1.48, 1.21
       TASKS: 1230
    NODENAME: dl980-5
     RELEASE: 3.12.49-6-xen
     VERSION: #1 SMP Mon Oct 26 16:05:37 UTC 2015 (11560c3)
     MACHINE: x86_64  (1995 Mhz)
      MEMORY: 125.9 GB
         PID: 6618
     COMMAND: "crash"
        TASK: ffff881ea93b2140  [THREAD_INFO: ffff881e869f2000]
         CPU: 112
       STATE: TASK_RUNNING (ACTIVE)

 

Xen 笔记 (2)——”xen”,”xen-syms” and “xen-*-dbg”文件

以下摘自Xen邮件列表

Hi all,

Since I am a newbie of Xen, this may be a dumb question. On my SuSE Xen, I find the following 4 “Xen” files:

-rw-r–r– 1 root rootÂÂÂ881967 Oct 27 05:46 xen-4.5.110-1.gz
-rw-r–r– 1 root root 16673080 Oct 27 05:46 xen-syms-4.5.1
10-1
-rw-r–r– 1 root rootÂÂÂ893428 Oct 27 05:45 xen-dbg-4.5.110-1.gz
-rw-r–r– 1 root root 16124144 Oct 27 05:45 xen-syms-dbg-4.5.1
10-1

Could anyone give a detailed explanation of the functions and differences about the 4 files?

TL;DR: Use xen-04.5.1_1-1.gz unless someone asks you to do otherwise or you are tracking down a bug.

xen.gz is the main/regular/normal release build of the Xen binary (e.g. the thing which you can boot). This is the thing you would boot on a regular production Xen system.

xen-syms.gz is the unstripped version of xen.gz, i.e. with all the ELF debug information present. You can e.g. run gdb on it to disassemble things if you are tracking down a bug. This image is not bootable.

The -dbg variants are not something which upstream produces, but I would assume that they are build with the debug=y, which means they will contain extra ASSERT statements and other things which aid debugging possibly at the expense of performance. Release builds (xen.gz et al) are build with debug=n. Like the release builds the xen-*-dbg ones come in the bootable (xen-dbg.gz) and xen-syms-dbg.gz variants, with the same distinction (the former is bootable, the latter is for running gdb on)

概括一下,xen文件是可以bootable的,也是用来启动xen系统的可执行文件。xen-symxen的保留所有调试信息的的版本,不可以bootable,仅用于调试功能。xen-*-dbg则是xenxen-sym对应的加了很多调试代码的版本。

 

Xen 笔记 (1)——为什么xen是32位的可执行程序?

今天编译了一下Xen,发现编出来的xen32位的可执行程序,而xen-syms却是64位的:

Linux:~/Downloads/xen-4.6.0/xen # file xen
xen: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, stripped
Linux:~/Downloads/xen-4.6.0/xen # file xen-syms
xen-syms: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped

Roger在邮件里给了答案:

The Xen entry point is in 32bits (because that’s what the multiboot specification requires). Xen then jumps into long mode (64bits) by itself, so there’s only a very small amount of 32bit code that’s used as a trampoline.

原来是为了支持multibootxen实际运行以后还是64位程序。

参考资料:
[Xen-users] Why the built xen file is 32-bit on 64-bit OS?

 

Xen结构简介

Xen的虚拟化环境结构如下图所示:

Capture

Xen hypervisor:直接运行在硬件上,它负责CPU调度和为虚拟机划分内存。 Xen hypervisor不光为运行之上的虚拟机抽象出硬件,还会控制虚拟机的运行。

Domain 0Xen hypervisor启动的第一个,拥有特权的虚拟机:比如可以直接访问硬件,启动其它虚拟机等。

Domain U:其它无特权的虚拟机,可以为PVHM Guest

以支持XenSuse为例,/boot/grub/menu.lst文件如下:

title Xen -- SUSE Linux Enterprise Server 11 SP4 - 3.0.101-63
    root (hd0,1)
    kernel /boot/xen.gz vga=mode-0x314
    module /boot/vmlinuz-3.0.101-63-xen root=/dev/disk/by-id/ata-VBOX_HARDDISK_VBe358a50a-9595120d-part2 resume=/dev/disk/by-id/ata-VBOX_HARDDISK_VBe358a50a-9595120d-part1 splash=silent showopts vga=0x314
    module /boot/initrd-3.0.101-63-xen

可以看到,实际运行的kernel/boot/xen.gz,修改过的kernel(有-xen后缀)和initial ramdisk都是/boot/xen.gz的模块。

参考资料:
How does Xen work?

What is Dom0 and how can one use it?

Powered by WordPress & Theme by Anders Norén