Commit Graph
12994 Commits
Author SHA1 Message Date
Juergen Gross d2e41f6dc3 xenstore: handle memory allocation failures in xenstored
Check for failures when allocating new memory in xenstored.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-05 11:32:39 +00:00
Juergen Gross cc06124648 xenstore: add small default data buffer to internal struct
Instead of always allocating a data buffer for incoming or outgoing
xenstore wire data add a small buffer to the buffered_data structure
of xenstored. This has the advantage that especially sending simple
response messages like errors or "OK" will no longer need allocating
a data buffer. This requires adding a memory context where the
allocated buffer was used for that purpose.

In order to avoid allocating a new buffered_data structure for each
response reuse the structure of the original request. This in turn
will avoid any new memory allocations for sending e.g. an ENOMEM
response making it possible to send it at all. To do this the
allocation of the buffered_data structure for the incoming request
must be done when a new request is recognized instead of doing it
when accepting a new connect.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-05 11:32:39 +00:00
Juergen Gross 197e26043e xenstore: add helper functions for wire argument parsing
The xenstore wire command argument parsing of the different commands
is repeating some patterns multiple times. Add some helper functions
to avoid the duplicated code.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-05 11:32:39 +00:00
Juergen Gross c875931063 xenstore: make functions static
Move functions used in only one source to the file where they are used
and make them static.

Remove some prototypes from headers which are no longer in use.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-05 11:32:37 +00:00
Juergen Gross 46271e3ccd xenstore: let command functions return error or success
Add a return value to all wire command functions of xenstored. If such
a function returns an error send the error message in
process_message().

Only code refactoring, no change in behavior expected.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
2016-12-05 11:31:40 +00:00
Juergen Gross 5363347055 xenstore: use array for xenstore wire command handling
Instead of switch() statements for selecting wire command actions use
an array for this purpose.

While doing this add the XS_RESTRICT type for diagnostic prints and
correct the printed string for XS_IS_DOMAIN_INTRODUCED.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
2016-12-05 11:28:37 +00:00
Juergen Gross d4016288ab xenstore: support XS_DIRECTORY_PART in libxenstore
This will enable all users of libxenstore to handle xenstore nodes
with a huge amount of children.

In order to not depend completely on the XS_DIRECTORY_PART
functionality use it only in case of E2BIG returned by XS_DIRECTORY.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
2016-12-05 11:21:35 +00:00
Juergen Gross 0ca64ed8c5 xenstore: add support for reading directory with many children
As the payload size for one xenstore wire command is limited to 4096
bytes it is impossible to read the children names of a node with a
large number of children (e.g. /local/domain in case of a host with
more than about 2000 domains). This effectively limits the maximum
number of domains a host can support.

In order to support such long directory outputs add a new wire command
XS_DIRECTORY_PART which will return only some entries in each call and
can be called in a loop to get all entries.

Input data are the path of the node and the byte offset into the child
list where returned data should start.

Output is the generation count of the node (which will change each time
the node is being modified) and a list of child names starting with
the specified index. The end of the list is indicated by an empty
child name. It is the responsibility of the caller to check for data
consistency by comparing the generation counts of all returned data
sets to be the same for one node.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
2016-12-05 11:21:35 +00:00
Juergen Gross 9e49dcf67f xenstore: add per-node generation counter
In order to be able to support reading the list of a node's children in
multiple chunks (needed for list sizes > 4096 bytes) without having to
allocate a temporary buffer we need some kind of generation counter for
each node. This will help to recognize a node has changed between
reading two chunks.

As removing a node and reintroducing it must result in different
generation counts each generation value has to be globally unique. This
can be ensured only by using a global 64 bit counter.

For handling of transactions there is already such a counter available,
it just has to be expanded to 64 bits and must be stored in each
modified node.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
2016-12-05 11:21:35 +00:00
Juergen Gross 2d41c05017 xenstore: use common tdb record header in xenstore
The layout of the tdb record of xenstored is defined at multiple
places: read_node(), write_node() and in xs_tdb_dump.c

Use a common structure instead.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-05 11:21:35 +00:00
Juergen Gross b4b475c3ac xenstore: call add_change_node() directly when writing node
Instead of calling add_change_node() at places where write_node() is
called, do that inside write_node().

Note that there is one case where add_change_node() is called now when
a later failure will prohibit the changed node to be written: in case
of a write_node failing due to an error in tdb_store(). As the only
visible change of behavior is a stale event fired for the node, while
the failing tdb_store() signals a corrupted xenstore database, the
stale event will be the least problem of this case.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-05 11:21:29 +00:00
Juergen Gross 2a29eec174 xenstore: modify add_change_node() parameter types
In order to prepare adding a generation count to each node modify
add_change_node() to take the connection pointer and a node pointer
instead of the transaction pointer and node name as parameters. This
requires moving the call of add_change_node() from do_rm() to
delete_node_single().

While at it correct the comment for the prototype: there is no
longjmp() involved.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
2016-12-05 11:19:57 +00:00
Cedric Bosdonnat 6860e56964 libxl/libxl_xshelp.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:35 +00:00
Cedric Bosdonnat e1020abf89 libxl/libxl_x86.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:35 +00:00
Cedric Bosdonnat 71d2589d8f libxl/libxl_vtpm.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:35 +00:00
Cedric Bosdonnat 814d32ddc9 libxl/libxl_vnuma.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:35 +00:00
Cedric Bosdonnat e00113c5e7 libxl/libxl_stream_write.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:34 +00:00
Cedric Bosdonnat 01cd0482cc libxl/libxl_save_callout.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:34 +00:00
Cedric Bosdonnat 2657dd9c12 libxl/libxl_remus.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:34 +00:00
Cedric Bosdonnat 1e7ed2000b libxl/libxl_qmp.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:34 +00:00
Cedric Bosdonnat d3823ad68a libxl/libxl_pvusb.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:34 +00:00
Cedric Bosdonnat e106cd83c8 libxl/libxl_psr.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:34 +00:00
Cedric Bosdonnat 20b75251d9 libxl/libxl_pci.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:34 +00:00
Cedric Bosdonnat 8d98b6c88f libxl/libxl_no_colo.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:34 +00:00
Cedric Bosdonnat 7cea84dbf7 libxl/libxl_nic.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:34 +00:00
Cedric Bosdonnat 593271dfa9 libxl/libxl_netbuffer.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:34 +00:00
Cedric Bosdonnat aa65cba3a8 libxl/libxl_netbsd.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:34 +00:00
Cedric Bosdonnat 9a43eaf050 libxl/libxl_linux.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:34 +00:00
Cedric Bosdonnat afc7304e5d libxl/libxl_internal.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:34 +00:00
Cedric Bosdonnat 38e2b688fe libxl/libxl_freebsd.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:34 +00:00
Cedric Bosdonnat 3271442ed1 libxl/libxl_dom_suspend.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:34 +00:00
Cedric Bosdonnat 8197528a62 libxl/libxl_dom_save.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:34 +00:00
Cedric Bosdonnat edd9aeef47 libxl/libxl_dm.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:34 +00:00
Cedric Bosdonnat 968c8bc940 libxl/libxl_device.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:33 +00:00
Cedric Bosdonnat 359f65e178 libxl/libxl_create.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:33 +00:00
Cedric Bosdonnat 73a7e6e9d3 libxl/libxl_colo_save.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:33 +00:00
Cedric Bosdonnat b622e9f7c2 libxl/libxl_colo_restore.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:33 +00:00
Cedric Bosdonnat a9d2a28288 libxl/libxl_colo_qdisk.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:33 +00:00
Cedric Bosdonnat e712ea8873 libxl/libxl_colo_proxy.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:33 +00:00
Cedric Bosdonnat 6a7a39a6dc libxl/libxl_colo_nic.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:33 +00:00
Cedric Bosdonnat b722e46c8b libxl/libxl_colo.h: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:33 +00:00
Cedric Bosdonnat 5b5a012d25 libxl/libxl_checkpoint_device.c: used LOG*D functions
Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:33 +00:00
Cedric Bosdonnat 890dffc50a libxl/libxl_bootloader.c: used LOG*D functions
Use LOG*D functions to output the domain ID in logs as much as
possible. This will help consumer code sorting the logs by
domain.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:33 +00:00
Cedric Bosdonnat bd60ee961e libxl.c: switch to LOG*D use
Use LOG*D functions to output the domain ID in logs as much as
possible. This will help consumer code sorting the logs by
domain.

This commit includes all LOG* to LOG*D changes where the domain
ID is not just a domid variable.

We want the domain ID provided to the LOG*D functions to be the
one of the publicly known domain, not a stubdom one.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:33 +00:00
Cedric Bosdonnat a42771612f libxl.c: switch to LOG*D use (refactored messages)
Use LOG*D functions to output the domain ID in logs as much as
possible. This will help consumer code sorting the logs by
domain.

This commit, only changes LOG*() into LOG*D() and adds a domid
parameter. The message of these LOG* calls has been altered to
remove the domain id from it since it is already contained in
the output log string.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:33 +00:00
Cedric Bosdonnat 88330f3c4f libxl.c: switch to LOG*D use
Use LOG*D functions to output the domain ID in logs as much as
possible. This will help consumer code sorting the logs by
domain.

libxl.c changes have been split into 3 commits to help review
them and isolate more instances that could be problematic.

This commit, only changes LOG*() into LOG*D() and adds a domid
parameter.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:33 +00:00
Cedric Bosdonnat f985802595 libxl: add LIBXL_LOGD_* and LOG*D function families.
These functions should be used to log messages when the domain
id is known. libxl__log will now prepend the log message by
"Domain %PRIu32:" if the domain id is a valid one.

This aims at helping consumers filter logs on domain IDs.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
2016-12-03 15:57:33 +00:00
Wei Liu 24b0b42c9a flask: add gcov_op check
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
2016-12-03 15:55:35 +00:00
Wei Liu 2ea46b760c gcov: userspace tools to extract and split gcov data
Provide two tools: a small C program to extract data from hypervisor and
a python script to split data into multiple files.

The file xencov.c is salvaged and modified from the original xencov.c.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2016-12-03 15:55:34 +00:00
Wei Liu d92d9e1701 xen, tools: rip out old gcov implementation
The internal data structure and code are tied to an old gcov format.
It's easier to just redo everything from scratch.

Salvage the reusable parts: leave xen/common/gcov and an empty Makefile
there, leave gcov support in Kconfig but mark that as broken. Also
reserve the sysctl number for later use (but delete relevant sysctl
structures).

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
2016-12-03 15:55:34 +00:00