xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Kun Cheng <chengkunck@gmail.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: xen-devel@lists.xen.org
Subject: Re: need help when libxenlight.so is used
Date: Tue, 15 May 2018 11:20:25 +0800	[thread overview]
Message-ID: <CAO3v1VTcafDJERqegsdJ3giPFjeVBw7FppJaduPLfPheVr9Vdw@mail.gmail.com> (raw)
In-Reply-To: <20180514171150.slb5igos6nbwhwgy@citrix.com>


[-- 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

      reply	other threads:[~2018-05-15  3:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAO3v1VTcafDJERqegsdJ3giPFjeVBw7FppJaduPLfPheVr9Vdw@mail.gmail.com \
    --to=chengkunck@gmail.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).