It has to check first if the memory to free is so big as to be freed
directly by free_pages. mini-os domains crash without this patch if
vfb is misconfigured.
Keir Fraser [Wed, 26 Mar 2008 13:15:00 +0000 (13:15 +0000)]
minios: blkfront_aio_poll may reenter
if the callback calls blkfront_sync for instance.
In such a case, we would see responses and hence release grants
several times. We need to be more synchronous and stop when we detect
that we have re-entered.
This fixes HVM restore with stubdomains.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Keir Fraser [Wed, 26 Mar 2008 13:13:50 +0000 (13:13 +0000)]
minios: more assertions
- assert that we never allocate or free the same grant twice
- assert that network packets do not exceed a page
- assert that incoming network event IDs make sense
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Keir Fraser [Tue, 18 Mar 2008 11:29:18 +0000 (11:29 +0000)]
minios: Fix lost events
evtchn_bind_interdomain used to clear any already pending event before
binding a handler, because else the handler may be called before it is
ready. That however leads to missed events, which I had to workaround
for the HVM case.
This changes the semantics of bind_evtchn, and thus of all the
event channel binding functions (bind_virq, evtchn_alloc_unbound,
evtchn_bind_interdomain) into not unmasking the event itself, hence
letting the caller initialize properly before unmasking the port (e.g.
record the port number in an appropriate place).
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Keir Fraser [Tue, 12 Feb 2008 14:35:39 +0000 (14:35 +0000)]
Add stubdomain support. See stubdom/README for usage details.
- Move PAGE_SIZE and STACK_SIZE into __PAGE_SIZE and __STACK_SIZE in
arch_limits.h so as to permit getting them from there without
pulling all the internal Mini-OS defines.
- Setup a xen-elf cross-compilation environment in stubdom/cross-root
- Add a POSIX layer on top of Mini-OS by linking against the newlib C
library and lwIP, and implementing the Unixish part in mini-os/lib/sys.c
- Cross-compile zlib and libpci too.
- Add an xs.h-compatible layer on top of Mini-OS' xenbus.
- Cross-compile libxc with an additional xc_minios.c and a few things
disabled.
- Cross-compile ioemu with an additional block-vbd, but without sound,
tpm and other details. A few hacks are needed:
- Align ide and scsi buffers at least on sector size to permit
direct transmission to the block backend. While we are at it, just
page-align it to possibly save a segment. Also, limit the scsi
buffer size because of limitations of the block paravirtualization
protocol.
- Allocate big tables dynamically rather that letting them go to
bss: when Mini-OS gets installed in memory, bss is not lazily
allocated, and doing so during Mini-OS is unnecessarily trick while
we can simply use malloc.
- Had to change the Mini-OS compilation somehow, so as to export
Mini-OS compilation flags to the Makefiles of libxc and ioemu.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Keir Fraser [Tue, 29 Jan 2008 15:18:27 +0000 (15:18 +0000)]
minios: Fix bug when blkfront reading into zero-mapped buffer
by just poking the page.
No need to use virtual_to_mfn() for the ring since that is a real page.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Keir Fraser [Fri, 18 Jan 2008 15:22:42 +0000 (15:22 +0000)]
minios: extend map_frames into being able to map a series of
contiguous frames, or the same frame several times, aligned, from
another domain, with specific protection, and with potential
failures.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Keir Fraser [Fri, 28 Dec 2007 15:23:28 +0000 (15:23 +0000)]
In C99 (7.19.6.2.10), the behavior of scanf("stuff... %n", ..., &n) is
said to be undefined if the value to be put is n can't fit. I guess
we can safely consider that the same applies to printf.
Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
Keir Fraser [Sat, 24 Nov 2007 13:31:39 +0000 (13:31 +0000)]
[Mini-OS] Fix domain blocking race
A callback which wakes a thread may happen between the moment
schedule() gives hand to the idle thread and the latter blocks the
domain. Idle hence needs to atomically check that no thread is
running and block, else awoken threads may have to wait up to 10
seconds.
Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
Keir Fraser [Fri, 23 Nov 2007 16:23:28 +0000 (16:23 +0000)]
[Mini-OS] Fix x86 arch_switch_thread
Fix x86 arch_switch_thread by making it pure assembly.
There were missing general register clobbers for x86_64, and BP should
theorically be clobbered too, but gcc does not believe that, so the
only simple safe solution is to use pure assembly.
Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
Keir Fraser [Fri, 23 Nov 2007 16:22:36 +0000 (16:22 +0000)]
[Mini-OS] Fix stack closures
So as to make backtracing tools happy, correctly close x86 stacks for
new threads as well as on callback in the x86_32 case since there is
no unwind marker.
Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
Keir Fraser [Fri, 23 Nov 2007 16:22:13 +0000 (16:22 +0000)]
[Mini-OS] Fix x86 initial stack alignment
This fixes the initial stack alignment for x86, which is required for
current to return a fine NULL instead of a random value or possibly
crash during initialization.
Signed-off-by: Grzegorz Milos <gm281@cam.ac.uk> Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
Alex Williamson [Tue, 31 Jul 2007 00:14:29 +0000 (18:14 -0600)]
[IA64][MINIOS] PKR support
- adds optimization feature for region 7 identity mapping
- adds protection keys to region 5 and region 7 addresses,
may be used for testing the hypervisor protection key support
minios: Fix an extern declaration and add an extra 'const' to
definition of a constant set of constant error strings.
Issues identified by Armand Puccetti. Signed-off-by: Keir Fraser <keir@xensource.com>