[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] Problem with IOMEM and domain reboot
On Wed, Feb 7, 2018 at 2:14 PM, Oleksandr Andrushchenko <andr2000@xxxxxxxxx> wrote:
Hi Wei, The root cause of this problem is that auto generated code doesn't handle default value when json is parsed. It is related not only IOMEM but potentially some other structure as well. Field "gfn" of libxl_iomem_range structure has default value LIBXL_INVALID_GFN which is not 0. libxl_iomem_range = Struct("iomem_range", [ ... ("gfn", uint64, {'init_val': "LIBXL_INVALID_GFN"}), ]) The default value is handled correctly when json is generated: yajl_gen_status libxl_iomem_range_gen_json(yajl_gen hand, libxl_iomem_range *p) { ... if (p->gfn != LIBXL_INVALID_GFN) { s = yajl_gen_string(hand, (const unsigned char *)"gfn", sizeof("gfn")-1); if (s != yajl_gen_status_ok) goto out; s = libxl__uint64_gen_json(hand, p->gfn); if (s != yajl_gen_status_ok) goto out; } ... } But when json is parsed, this "gfn" field is parsed as any other uint64 value. As result we have 0 instead of LIBXL_INVALID_GFN. int libxl__iomem_range_parse_json(libxl__gc *gc, const libxl__json_object *o, libxl_iomem_range *p) { ... { const libxl__json_object *saved_gfn = x; x = libxl__json_map_get("gfn", o, JSON_INTEGER); if (x) { rc = libxl__uint64_parse_json(gc, x, &p->gfn); if (rc) goto out; } x = saved_gfn; } } Is it done by design or there is an issue with parse_json? If it is done by design then the solution proposed by you (update_config hook) will solve this problem. But handling default value in parse json looks more correct. -- Best Regards,
Oleksandr Grytsov. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |