Commit Graph
173 Commits
Author SHA1 Message Date
Stefano Stabellini ba26a1e197 split LDLIBS from LDFLAGS to fix link errors in recent toolchains
Linker command lines are order-sensitive.
Move linker options -Lfoo -lfoo from LDFLAGS to LDLIBS and place this new
variable after the objects to link. This resolves build errors in xenpagin
and blktap with recent toolchains.

rename SHLIB_CFLAGS to SHLIB_LDFLAGS
rename LDFLAGS_* to LDLIBS_*
move LDFLAGS usage after CFLAGS in CC calls
remove stale comments in xenpaging Makefile

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
2010-08-11 18:02:32 +01:00
Keir Fraser ffd4db9a68 tools: assume that special Xen devices have been created by the platform
Remove all the magic surrounding the special Xen devices in Linux
specific code whereby we attempt to figure out what the correct
major:minor number is and check the the existing device has these
numbers etc. In 2010 we really should be able to trust that the
platform has created the devices correctly or provide correct
configuration settings such that they are without resorting to tearing
down the platform configured state and rebuilding it.

tools/hotplug/Linux/xen-backend.rules already contains the necessary
udev rules to create /dev/xen/evtchn and friends in the correct place.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
2010-06-02 10:54:32 +01:00
Keir Fraser 82fa47405a blktap: Fix old QCow tapdisk image handling
When I tried to use QCow image, I found that only each second boot is
successful. As I discovered, this is caused by wrong handling old qcow
tapdisk images. Extended header flag is not stored correctly so the
blktap tries to change endian fo L1 table on each startup.

From: Miroslav Rezanina <mrezanin@redhat.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-05-04 12:38:19 +01:00
Keir Fraser bc43f6118d blktap/fs-back: Build fixes for Fedora 13
1. Some files use stat, mkfifo, mkdir etc. without including
sys/stat.h

2. Some programs link against libpthread without a -lpthread compile
option. The compile used to work if this library happened to be used
by one of the other libraries that was being linked against, but
Fedora 13 has stopped allowing this.

From: M A Young <m.a.young@durham.ac.uk>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2010-03-15 17:08:29 +00:00
Keir Fraser 14d41371e2 blktap: provide a variant of __RING_SIZE() that is an integer constant expression
Without this new variant, gcc 4.5 won't compile where this is being
used to specify array sizes.  See also c/s 20975.

Signed-off-by: Charles Arnold <carnold@novell.com>
2010-03-06 13:31:03 +00:00
Keir Fraser 939629eb5b blktap: fix blktapctrl abort
On rebooting a hvm, the blktapctrl daemon has died.

gdb shows the following call trace:
(gdb) where
#0  0x00000039d1830155 in raise () from /lib64/libc.so.6
#1  0x00000039d1831bf0 in abort () from /lib64/libc.so.6
#2  0x00000039d186a38b in __libc_message () from /lib64/libc.so.6
#3  0x00000039d1871634 in _int_free () from /lib64/libc.so.6
#4  0x00000039d1874c5c in free () from /lib64/libc.so.6
#5  0x0000003320a01bdd in ueblktap_probe (h=3D0x6073b0,=20
    w=<value optimized out>, bepath_im=<value optimized out>) at
    xenbus.c:270
#6  0x0000003320a020e0 in xs_fire_next_watch (h=3D0x6073b0) at
xs_api.c:355
#7  0x0000000000401785 in main (argc=3D<value optimized out>,
    argv=<value optimized out>) at blktapctrl.c:907

There is a case that "/local/domain/0/backend/tap/<dom_id>" exists but
"/local/domain/<dom_id>/vm" is not in the xenstore.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
2010-01-22 11:00:45 +00:00
Keir Fraser 60e8e9aabc blktap: make memshr optional
Attached patch makes memshr optional for blktap/blktap2.
This fixes build for platforms where memshr isn't build on.
While there, make indentation consistent.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2010-01-12 07:01:21 +00:00
Keir Fraser ab562bd46c Generic bi-directional map, and related initialisation functions. At the moment
a single map is used to store mappings between sharing handles and disk blocks.
This is used to share pages which store data read of the same blocks on
(virtual) disk.
Note that the map is stored in a shared memory region, as it needs to be
accessed by multiple tapdisk processes. This complicates memory allocation
(malloc cannot be used), prevents poniters to be stored directly (as the shared
memory region might and is mapped at different base address) and finally pthread
locks need to be multi-process aware.

Signed-off-by: Grzegorz Milos <Grzegorz.Milos@citrix.com>
2009-12-17 06:27:56 +00:00
Keir Fraser 5dc1050805 blktap: Fix check_sharing() in blktapctrl
check_sharing() in blktapctrl does not work.
 - It accesses to xenstore by using wrong paths.
 - It compares image paths including image types.
 - It misjudges a return value of strcmp().

This patch fixes those mistakes.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-10-23 10:02:09 +01:00
Keir Fraser 4b48ffd60a blktap: fix empty QCOW images (bug 1430 part 2)
Empty QCOW images consist of only the L1 table, this results in a
file size which is not sector-aligned. Since blktap uses O_DIRECT, the
block aligned read of the L1 table will go beyond the end of file and
thus returns the actual file size and not the expected length.
This patch checks whether at least the L1 table has been read.

This should fix bug 1430.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
2009-06-03 11:11:50 +01:00
Keir Fraser 2f78e9cccf blktap: fix and use ROUNDUP macro (bug 1430 part 1)
As pointed out in Xen Bugzilla 1430 in the blktap QCOW driver the
rounding function is wrong in line 824 of block-qcow.c.
This patch replaces this (and other roundings) with the already
existing ROUNDUP macro (and fixes the usual macro pitfall).

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
2009-06-03 11:11:04 +01:00
Keir Fraser 630ec346ad blktap: Revert parts of c/s 19349.
Caused blktapctrl pipes to be created with uninitialised variable in name.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-06-01 14:02:26 +01:00
Keir Fraser cde518aa71 blktap: Move error signaling to blktapctrl
Until now the udev script for blktap devices needs to decide if to
signal success or failure to xend. As this script runs completely
independent of blktapctrl and tapdisk/ioemu which do the real work,
the udev script can't even theoretically know if tapdisk is happy.

This patch removes the udev script and replaces its checks by new
ones in libblktap.

Signed-off-by: Kevin Wolf <kwolf@suse.de>
2009-03-12 18:48:09 +00:00
Keir Fraser 3dc413c7bd blktapctrl: Fix too early close of pipes
Connections to ioemu have single_handler set, so they are closed as
soon as all images of a certain type are closed. This is wrong with
ioemu: All images that belong to the same domain are handled by the
same backend process (usually qemu-dm, but also tapdisk-ioemu for
domains without device model), regardless of the image type.

This patch checks for the same-domain condition for ioemu connections.

Signed-off-by: Kevin Wolf <kwolf@suse.de>
2009-03-12 18:46:26 +00:00
Keir Fraser 57871f919d blktap: Export disk type constants for ioemu
Currently all disk types that are supported are defined in a header
file private to blktapctrl and tapdisk. When restoring ioemu as a
backend for blktap these constants are needed by ioemu, so move them
to a more public header file.

Signed-off-by: Kevin Wolf <kwolf@suse.de>
2009-03-12 18:42:59 +00:00
Keir Fraser 8b173f5236 blktapctrl: Select backend by prefix
This patch adds support for specifying the backend (tapdisk or ioemu)
to blktapctrl. Images can be specified e.g. as tap:tapdisk:aio,
tap:ioemu:qcow2 or tap:vmdk. When omitting the backend, a default is
chosen based on the image type (currently always tapdisk because ioemu
as a backend is broken until a follow-up patch series against qemu-xen
is applied)

Signed-off-by: Kevin Wolf <kwolf@suse.de>
2009-03-12 18:42:31 +00:00
Keir Fraser 19801a52bf blktap: Fix compile warnings in block-qcow2.c
Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com>
2009-03-09 09:48:45 +00:00
Keir Fraser 86d2a1cec5 blktap: Allow creation of qcow2 files.
Signed-off-by: Yang Zhang <yang.zhang@intel.com>
2009-03-03 13:22:28 +00:00
Keir Fraser 77de1e2709 blktap: Fix check_gcrypt
Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
2009-02-11 10:44:42 +00:00
Keir Fraser bef2c17dbc Do not print `***' when compiling unless we fall over
This has finally bugged me enough to do something about it:

make prints `***' when it stops due to an error.  With make -j, and/or
with automated build systems, this error marker can be in the middle
of a large logfile.  It is useful to be able to search for it.

Therefore change occurrences of `*' to `=' for information and warning
messages.  `***' is reserved for cases where the build stops.

A corresponding change is being applied to qemu-xen-unstable.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2009-01-12 10:17:12 +00:00
Keir Fraser 9f8501582f Use -MMD -MF in tools/* rather than -Wp,-M...
If you use -MMD -MF then the correct .o filename is written to the
.*.d file as the compiler driver arranges everything.  This was done
in 19010:275abe1c5d24 for the hypervisor.

In this patch we do the same elsewhere in the xen-unstable tree,
particularly tools/.  Specifically:
 * Change tools/Rules.mk to add -MMD -MF ... to CFLAGS and set DEPS.
 * Remove -Wp,-MD... from every other Makefile
 * Remove setting of DEPS from every other Makefile
 * Ensure that every Makefile says -include $(DEPS)
 * Ensure that every Makefile's clean target removes $(DEPS)

Some Makefiles were already halfway there, but often for a different
variable name eg PROG_DEP.  The variable name is now standardised in
Rules.mk as DEPS.

I have done a test build with this change, on Debian etch.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2009-01-12 10:16:05 +00:00
Keir Fraser d0292e3adb blktap: re-enable O_DIRECT in block_qcow.c
Turns out that only two reads and writes in block-qcow.c need to be
fixed to work correctly with O_DIRECT.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2008-10-22 11:55:33 +01:00
Keir Fraser 942da08c6c blktap: Handle qcow backing files correctly.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2008-10-20 15:08:24 +01:00
Keir Fraser 4b52a38711 libblktap: Remove trailing null byte in xs_printf
xs_printf writes the terminating null byte of the passed string to
Xenstore. When reading, the null byte is returned in the following
form which confuses tools:

sector-size = "512\000"

This patch removes the null byte from the data to write.

Signed-off-by: Kevin Wolf <kwolf@suse.de>
2008-10-02 12:56:55 +01:00
Keir Fraser 66e56e754b install more documentation to /usr/share/doc/xen and /etc/xen
Also resync xmexample3 with xmexample1 and 2.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
2008-08-06 09:34:55 +01:00
Keir Fraser d4a22e75c9 blktap: Clean *.opic on 'make clean'.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-07-24 11:19:13 +01:00
Keir Fraser 121068a2ce blktap: portability cleanup
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2008-07-14 10:03:09 +01:00
Keir Fraser 962649c369 blktap: cleanup
Make functions w/o a prototype static and remove redundant
declaration of xs_fire_next_watch().

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2008-07-11 15:36:40 +01:00
Keir Fraser 1d36727c99 tapdisk: in case O_DIRECT fails, retry again with o_flags but
O_DIRECT, instead of fixed value O_RD_WR | O_LARGEFILE

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
2008-07-11 12:43:33 +01:00
Keir Fraser 5109f87cee Blktapctrl compatibility layer
I originally had just changed the NEWINTF ioctl to send over 48-bits
of information, which works on 64-bit but not on 32-bit (since the arg
is an unsigned long).  Additionally, the previous changes would break
an older userland against a new kernel.  For that reason, introduce a
new ioctl (NEWINTF_EXT) that fixes both of these problems.  This is
the dom0 userland side.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2008-07-09 10:41:49 +01:00
Keir Fraser 04465fbeb9 blktap: Fall back to libcrypto if libgcrypt is not installed.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-06-30 11:39:10 +01:00
Keir Fraser 53a29c4ca7 blktap: link against libgcrypt rather than libcrypto
tapdisk, part of blktap, links against libcrypto. tapdisk includes
GPLv2 (tapaio.c) and other licensed code (block-qcow.c). The license
of OpenSSL is considered incompatible with the GPL by many
people. This patch changes them to link against libgcrypt, which is
LGPL.

Signed-off-by: Bastian Blank <waldi@debian.org>
2008-06-30 10:00:53 +01:00
Keir Fraser 4fe815abd1 blktap: Extend userland busid to 32 bits
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2008-06-27 16:08:56 +01:00
Keir Fraser c8af9ce961 tapdisk: Fix qcow2 for images > 2 GB
Signed-off-by: Kevin Wolf <kwolf@suse.de>
2008-06-27 14:03:52 +01:00
Keir Fraser defe5e9a30 blktap: Automatically start tapdisk-ioemu on demand
When a domain wants to use a tap:ioemu disk but has no device model,
start a tapdisk-ioemu instance as provider. Also, move the creation
and removal of communication pipes to xend so that qemu-dm doesn't
need the unwanted SIGHUP handler anymore.

Signed-off-by: Kevin Wolf <kwolf@suse.de>
2008-04-23 16:57:23 +01:00
Keir Fraser 8318d7d63d Revert 17499:451ae3b8e5c8
Breaks HVM guest creation (bugzilla #1221).

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-04-23 13:30:24 +01:00
Keir Fraser 3b64ad17ca blktap: Automatically start tapdisk-ioemu on demand
When a domain wants to use a tap:ioemu disk but has no device model,
start a tapdisk-ioemu instance as provider. Also, move the creation
and removal of communication pipes to xend so that qemu-dm doesn't
need the unwanted SIGHUP handler anymore.

Signed-off-by: Kevin Wolf <kwolf@suse.de>
2008-04-22 14:39:33 +01:00
Keir Fraser bd095de691 tools: Use PATH_MAX for pathname char arrays.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-04-04 14:49:37 +01:00
Keir Fraser b4f95a5c93 tapdisk: Fix L1 table endianess of qcow images
Fix tapdisk to use big endian L1 tables as used by qemu/ioemu. Old
tapdisk images with native endianess are automagically converted to
big endian when the image file is opened for the first time.

Signed-off-by: Kevin Wolf <kwolf@suse.de>
2008-03-27 17:13:37 +00:00
Keir Fraser d4921fd504 tools/blktap: Use generic subdirs rules.
Signed-off-by: Bastian Blank <waldi@debian.org>
2008-03-25 09:50:27 +00:00
Keir Fraser 6fef410021 blktap: Fix BSD build failure.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2008-03-19 16:19:10 +00:00
Keir Fraser f9aa19ee3a tapaio build fix
With some combinations of compiler flags (no optimization, -Werror),
the compiler may complain that the function doesn't have a return
statement (even if the function actually just never returns), reported
as bug 1128. This adds a dummy return statement.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
2008-03-19 14:12:12 +00:00
Keir Fraser 45b676a245 Use ioemu block drivers through blktap.
Add support for a tap:ioemu pseudo driver. Devices using this driver
won't use tapdisk (containing the code duplication) any more, but will
connect to the qemu-dm of the domain. In this way no working
configuration should be broken right now as you can still choose to
use the tapdisk drivers.

Signed-off-by: Kevin Wolf <kwolf@suse.de>
2008-03-18 10:58:47 +00:00
Keir Fraser 2dfb6b6e90 Clean up blktap Makefiles.
Signed-off-by: Bastian Blank <waldi@debian.org>
2008-03-17 10:57:59 +00:00
Keir Fraser a226d0f1bb blktapctrl: Fix a potential device minor number leak.
Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
2008-03-03 11:08:10 +00:00
Keir Fraser 912ede3b1a blktap: Fix unused warnings in block-qcow2.c with -D_FORTIFY_SOURCE=2.
Signed-off-by: Kevin Wolf <kwolf@suse.de>
2008-02-28 13:19:38 +00:00
Keir Fraser c3d370d254 blktap: Remove some code duplication
With my qcow2 patch to blktap I contributed a bit to the mess, so here
an attempt to clean up and remove at least some of the code
duplication in the functions dealing with aio operations.

Signed-off-by: Kevin Wolf <kwolf@suse.de>
2008-02-25 09:12:20 +00:00
Keir Fraser 219c37ca95 blktap: qcow2 image format support
This patch adds support for the qcow2 image format to blktap. It
consists mostly of qemu code, adapted to the blktap interfaces.
Snapshots and compressed images are supported.

The qcow2 driver may be used by either specifying tap:qcow2 or by
using tap:qcow which will detect that you have a version 2 image and
will call the qcow2 driver.

Signed-off-by: Kevin Wolf <kwolf@suse.de>
2008-02-21 10:30:57 +00:00
Keir Fraser 67bfbd67d1 libxenctrl headers should not pollute macro namespace with
mb/rmb/wmb. Instead add a xen_ prefix. Modify Xen's public headers to
expect the prefixed names instead of bare mb/rmb/wmb, but gate this
expectation on a bump of __XEN_INTERFACE_VERSION__.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2008-02-12 11:37:45 +00:00
Keir Fraser 3faece79e4 Define CFLAGS and LDFLAGS for libxenstore.
Signed-off-by: Bastian Blank <waldi@debian.org>
2008-01-27 12:58:15 +00:00