Fwd: need help when libxenlight.so is used

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Fwd: need help when libxenlight.so is used

Kun Cheng
Hello all,

I'm learning code in xen-4.10.0/tools/xl to find out how to program with libxl.  
 
I've trying to use libxenlight.so (compiled and installed from xen 4.10.0 source code) to control my vms from my own code until I met this issue. 
Now my test code follows xl_vmmcontrol.c and tries to create a VM from its config file (file can be used to successfully create a vm with 'xl create').

My Xen make is successful and I can use 'xl' to manage all vms.

When I test my own code, I got such an error in dmesg"

test[16678]: segfault at 18 ip 00007f69fa6526ad sp 00007ffe1eadedf0 error 4 in libxenlight.so.4.10.0[7f69fa61a000+bc000] in dmesg

and also segmentation fault in my terminal.

I dumped my debugging info, hoping could give everyone some clue.

FYI, my program was compiled with:

gcc -m64 -pthread -std=gnu99  -g xl_executor.c xl_parse.c  xl_utils.c xl_nic.c -lxenlight -lxlutil -lxentoollog  -lyajl  -o test

where xl_executor.c is my code of creating a vm, all other c file are copied from tools/xl/ 

GDB bebugging info:

Breakpoint 3, parse_config_data (config_source=0x7fffffffe360 "/data/chengkun/vms/vm4/vm4.cfg",
    config_data=0x6155f0 "# ", '=' <repeats 69 times>, "\n# Example HVM guest configuration\n# ", '=' <repeats 69 times>, "\n#\n# This is a fairly m"..., config_len=1543,
    d_config=0x7fffffffdde0) at xl_parse.c:993

993         if (libxl_cpu_bitmap_alloc(ctx, &b_info->avail_vcpus, l)) {

(gdb) p *c_info
$3 = {type = LIBXL_DOMAIN_TYPE_HVM, hap = {val = 0}, oos = {val = 0}, ssidref = 0, ssid_label = 0x0, name = 0x6154f0 "test_vm", uuid = {
    uuid = "O\374\032\231+\330A\265\213rVސ\375\020\270"}, xsdata = 0x0, platformdata = 0x0, poolid = 0, pool_name = 0x0, run_hotplug_scripts = {val = 1}, driver_domain = {
    val = 0}}

(gdb) p *b_info
$4 = {max_vcpus = 0, avail_vcpus = {size = 0, map = 0x0}, cpumap = {size = 0, map = 0x0}, nodemap = {size = 0, map = 0x0}, num_vcpu_hard_affinity = 0,
  vcpu_hard_affinity = 0x0, num_vcpu_soft_affinity = 0, vcpu_soft_affinity = 0x0, numa_placement = {val = 0}, tsc_mode = LIBXL_TSC_MODE_DEFAULT, max_memkb = 4194304,
  target_memkb = 2097152, video_memkb = 18446744073709551615, shadow_memkb = 18446744073709551615, rtc_timeoffset = 0, exec_ssidref = 0, exec_ssid_label = 0x0,
  localtime = {val = 0}, disable_migrate = {val = 0}, cpuid = 0x0, blkdev_start = 0x0, num_vnuma_nodes = 0, vnuma_nodes = 0x0, max_grant_frames = 32,
  max_maptrack_frames = 1024, device_model_version = LIBXL_DEVICE_MODEL_VERSION_UNKNOWN, device_model_stubdomain = {val = 0}, device_model = 0x0, device_model_ssidref = 0,
  device_model_ssid_label = 0x0, device_model_user = 0x0, extra = 0x0, extra_pv = 0x0, extra_hvm = 0x0, sched_params = {sched = LIBXL_SCHEDULER_UNKNOWN, weight = -1,
    cap = -1, period = -1, budget = -1, extratime = -1, slice = -1, latency = -1}, num_ioports = 0, ioports = 0x0, num_irqs = 0, irqs = 0x0, num_iomem = 0, iomem = 0x0,
  claim_mode = {val = 0}, event_channels = 0, kernel = 0x0, cmdline = 0x0, ramdisk = 0x0, device_tree = 0x0, acpi = {val = 0}, bootloader = 0x0, bootloader_args = 0x0,
  timer_mode = LIBXL_TIMER_MODE_UNKNOWN, nested_hvm = {val = 0}, apic = {val = 0}, dm_restrict = {val = 0}, type = LIBXL_DOMAIN_TYPE_HVM, u = {hvm = {firmware = 0x0,
      bios = LIBXL_BIOS_TYPE_UNKNOWN, pae = {val = 0}, apic = {val = 0}, acpi = {val = 0}, acpi_s3 = {val = 0}, acpi_s4 = {val = 0}, acpi_laptop_slate = {val = 0}, nx = {
        val = 0}, viridian = {val = 0}, viridian_enable = {size = 0, map = 0x0}, viridian_disable = {size = 0, map = 0x0}, timeoffset = 0x0, hpet = {val = 0}, vpt_align = {
        val = 0}, mmio_hole_memkb = 18446744073709551615, timer_mode = LIBXL_TIMER_MODE_UNKNOWN, nested_hvm = {val = 0}, altp2m = {val = 0}, system_firmware = 0x0,
      smbios_firmware = 0x0, acpi_firmware = 0x0, hdtype = LIBXL_HDTYPE_IDE, nographic = {val = 0}, vga = {kind = LIBXL_VGA_INTERFACE_TYPE_UNKNOWN}, vnc = {enable = {
          val = 0}, listen = 0x0, passwd = 0x0, display = 0, findunused = {val = 0}}, keymap = 0x0, sdl = {enable = {val = 0}, opengl = {val = 0}, display = 0x0,
        xauthority = 0x0}, spice = {enable = {val = 0}, port = 0, tls_port = 0, host = 0x0, disable_ticketing = {val = 0}, passwd = 0x0, agent_mouse = {val = 0},
        vdagent = {val = 0}, clipboard_sharing = {val = 0}, usbredirection = 0, image_compression = 0x0, streaming_video = 0x0}, gfx_passthru = {val = 0},
      gfx_passthru_kind = LIBXL_GFX_PASSTHRU_KIND_DEFAULT, serial = 0x0, boot = 0x0, usb = {val = 0}, usbversion = 0, usbdevice = 0x0, soundhw = 0x0, xen_platform_pci = {
        val = 0}, usbdevice_list = 0x0, vendor_device = LIBXL_VENDOR_DEVICE_NONE, ms_vm_genid = {bytes = '\000' <repeats 15 times>}, serial_list = 0x0, rdm = {
        strategy = LIBXL_RDM_RESERVE_STRATEGY_IGNORE, policy = LIBXL_RDM_RESERVE_POLICY_INVALID}, rdm_mem_boundary_memkb = 18446744073709551615, mca_caps = 0}, pv = {
      kernel = 0x0, slack_memkb = 0, bootloader = 0x0, bootloader_args = 0x0, cmdline = 0x0, ramdisk = 0x0, features = 0x0, e820_host = {val = 0}}}, arch_arm = {
    gic_version = LIBXL_GIC_VERSION_DEFAULT, vuart = LIBXL_VUART_TYPE_UNKNOWN}, altp2m = LIBXL_ALTP2M_MODE_DISABLED}

(gdb) p ctx
$5 = (libxl_ctx *) 0x0

(gdb) p *ctx
$6 = <incomplete type>

(gdb) s

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7b476ad in libxl.ptr_add () from /usr/local/lib/libxenlight.so.4.10


Is that related to my compiling cmd? 
Any help is appreciated.

Thanks,
K

_______________________________________________
Xen-users mailing list
[hidden email]
https://lists.xenproject.org/mailman/listinfo/xen-users