* need help when libxenlight.so is used
@ 2018-05-12 12:55 Kun Cheng
2018-05-14 17:11 ` Wei Liu
0 siblings, 1 reply; 3+ messages in thread
From: Kun Cheng @ 2018-05-12 12:55 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1.1: Type: text/plain, Size: 5604 bytes --]
Hello Xen devs,
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
[-- Attachment #1.2: Type: text/html, Size: 6678 bytes --]
[-- Attachment #2: Type: text/plain, Size: 157 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: need help when libxenlight.so is used
2018-05-12 12:55 need help when libxenlight.so is used Kun Cheng
@ 2018-05-14 17:11 ` Wei Liu
2018-05-15 3:20 ` Kun Cheng
0 siblings, 1 reply; 3+ messages in thread
From: Wei Liu @ 2018-05-14 17:11 UTC (permalink / raw)
To: Kun Cheng; +Cc: Wei Liu, xen-devel
On Sat, May 12, 2018 at 08:55:46PM +0800, Kun Cheng wrote:
> Hello Xen devs,
>
> 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)) {
>
One possibility: you didn't follow the convention of using libxl types,
which means you get memory corruption all over the place.
See libxl.h:L490 for more information.
But for a more likely explanation, see below.
> gic_version = LIBXL_GIC_VERSION_DEFAULT, vuart =
> LIBXL_VUART_TYPE_UNKNOWN}, altp2m = LIBXL_ALTP2M_MODE_DISABLED}
>
> (gdb) p ctx
> $5 = (libxl_ctx *) 0x0
A NULL pointer? See xl.c:xl_ctx_alloc.
Wei.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: need help when libxenlight.so is used
2018-05-14 17:11 ` Wei Liu
@ 2018-05-15 3:20 ` Kun Cheng
0 siblings, 0 replies; 3+ messages in thread
From: Kun Cheng @ 2018-05-15 3:20 UTC (permalink / raw)
To: Wei Liu; +Cc: xen-devel
[-- Attachment #1.1: Type: text/plain, Size: 2266 bytes --]
Thank you, Wei.
I have solved it. The error accured as 'ctx' was not correctly initailized.
On Tue, May 15, 2018 at 1:11 AM Wei Liu <wei.liu2@citrix.com> wrote:
> On Sat, May 12, 2018 at 08:55:46PM +0800, Kun Cheng wrote:
> > Hello Xen devs,
> >
> > 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)) {
> >
>
> One possibility: you didn't follow the convention of using libxl types,
> which means you get memory corruption all over the place.
>
> See libxl.h:L490 for more information.
>
> But for a more likely explanation, see below.
>
> > gic_version = LIBXL_GIC_VERSION_DEFAULT, vuart =
> > LIBXL_VUART_TYPE_UNKNOWN}, altp2m = LIBXL_ALTP2M_MODE_DISABLED}
> >
> > (gdb) p ctx
> > $5 = (libxl_ctx *) 0x0
>
> A NULL pointer? See xl.c:xl_ctx_alloc.
>
> Wei.
>
[-- Attachment #1.2: Type: text/html, Size: 2973 bytes --]
[-- Attachment #2: Type: text/plain, Size: 157 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-05-15 3:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-12 12:55 need help when libxenlight.so is used Kun Cheng
2018-05-14 17:11 ` Wei Liu
2018-05-15 3:20 ` Kun Cheng
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.