xenbus: Allow to build with old kernels (pre-2.6.6).
Original patch by Ben Guthro <bguthro@virtualiron.com> Signed-off-by: Keir Fraser <keir@xensource.com>
xenbus: Improvements to wait_for_devices().
1. When printing a warning about a timed-out device, print the
current state of both ends of the device connection (i.e., backend as
well as frontend).
2. A device is 'not yet connected' only when the local state is *less
than* XenbusStateConnected. If the state is Closing or Closed
(usually because of an explicit failure when trying to make the
connection) then we should not wait for the connection to occur -- it
will never happen!
xenbus: Wait for 30s for devices to connect (previously 10s).
Give a visual update to the user on the console every 5s during this
period. Signed-off-by: Keir Fraser <keir@xensource.com>
Open CONFIG_ACPI_SLEEP in xenlinux, to enable ACPI based
power management. Basically, user can trigger power event
now by "echo *** > /sys/power/state". Also gear to pm
interface defined between xenlinux and Xen.
Also sync to xen interface headers consequently
Signed-off-by Ke Yu <ke.yu@intel.com>
Signed-off-by Kevin Tian <kevin.tian@intel.com>
Implements module autoloading for the xen frontend drivers by adding a
uevent function for the frontend xenbus and some module aliases to the
individual drivers.
blktap: Fix page reference count/file rss count leak when auto-translate is enabled.
Tapdisk process rss size becomes too large with auto translation
enabled.
The example is as follows where dom0 has only several hundred
megabytes.
This patch fixes it.
> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
> 6758 root 15 0 39824 1.7t 1.7t S 0 188932.0 14:10.28
tapdisk
This is because page reference count/file rss size are incremented
when io request is accepted, but aren't decremented when the request
is done. This can be fixed by using vm_insert_page() in blktap_mmap()
instead of remap_pfn_range().
Details:
The tapdisk daemon mmaps blktap device and the blktap driver maps
page from the front end into the mmapped area and unmaps it when I/O
request is done.
When io request is accepted, dispatch_rw_block_io() is called.
With auto translated mode disabled, it directly manipulates the page
table without incrementing rss size. With auto translated mode
enabled, it calls vm_insert_page() which increments page reference
count/file rss. When io request is done, fast_flush_area() is called.
With auto translated mode disabled, it directly manipulates the page
table without decrementing rss size. With auto translated mode
enabled, it calls zap_page_range() which should decrements page
reference count/file rss. However (vma->vm_flags & VM_PFNMAP) is true,
it doesn't decrement them so that page reference count and file rss
are leaked. blktap driver allocates pages and never free them so that
page reference count leak doesn't cause an issue (probably until
overflow).
Without auto translation, it makes sense for blktap_mmap() to set
VM_PFNMAP with remap_pfn_range() because the blktap driver directly
manipulates page tables. On the other hand with auto translation the
VM_PFNMAP bit shouldn't set. This can be achieved by using
vm_insert_page() in blktap_mmap() instead of remap_pfn_range()
The changed logic allows having *-xen.[cS] files anywhere in the tree,
without a need to modify the corresponding Makefiles. The patch also
cleans up Makefiles modified for Xen as far as possible.
xebus: Do not avoid state transitions on shutdown in kernels for which
we do not provide a shutdown hook. This is because we don't drive
xenbus during shutdown in this case, and such kernels often do not
expose a 'system_state' variable, so the xenbus driver doesn't build!
Signed-off-by: David Lively <dlively@virtualiron.com> Signed-off-by: Ben Guthro <bguthro@virtualrion.com>
privcmd: Take write lock on mm semaphore when calling
*remap_pfn_range(), as these function mess with fields in the vma
structure. Signed-off-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com> Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
[XEN][LINUX][POWERPC] Add PowerPC Xen architecture support.
Most of this code was written by Jimi Xenidis <jimix@watson.ibm.com>. Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
[PPC] Add architecture-generic xencomm infrastructure.
Xencomm is the mechanism by which userspace can pass virtual addresses
to Xen on architectures that cannot perform page table walks in
software, including PowerPC and IA64. Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
[PPC] Create Xen-specific interface for xlate_dev_mem_*
PowerPC builds both drivers/char/mem.c and drivers/xen/char/mem.c at
once, so we cannot hijack the xlate_dev_mem_ptr() interface. Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Alex Williamson [Thu, 5 Jul 2007 20:36:59 +0000 (14:36 -0600)]
[IA64] Make some of xen hyperprivops transparent
Some of definitions of xen hyperprivops aren't transparent.
This patch fixes them. While this is done in assembler code
long before, But I chose the easy C version because binary
patching woule eliminate the overhead.
Alex Williamson [Thu, 5 Jul 2007 20:26:31 +0000 (14:26 -0600)]
[IA64] linux header inclusion clean up.
With this patch dma-mapping.h and processor.h become unmodified.
privops.h overrides gcc/intel intrinsics methods so it should be
included from intrinsics.h
Ian Campbell [Mon, 2 Jul 2007 16:19:24 +0000 (17:19 +0100)]
Do not call clock_was_set() from interrupt context.
Currently clock_was_set() is a nop but on newer kernels it is not and
cannot be called from interrupt context. Prepare for that by deferring
to a workqueue. Since a timer interrupt can occur before
init_workqueue() is called we need to protect against the possibility
that keventd hasn't started yet.
(drop unused variable max_ntp_tick).
Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
Ian Campbell [Wed, 27 Jun 2007 15:31:36 +0000 (16:31 +0100)]
Fix kexec compatibility with highmem.
Stop abusing xen_create_contiguous_region() to move pages below the
MFN limit. Instead introduce xen_limit_pages_to_max_mfn() which works
for both low and highmem but doesn't bother making the pages
contiguous.
Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
kfraser [Thu, 21 Jun 2007 12:39:05 +0000 (13:39 +0100)]
Fix amd64-agp aperture validation
Under Xen, pfn_valid() on a machine address makes no sense. But even
on native, under CONFIG_DISCONTIGMEM, assuming that a !pfn_valid()
implies all subsequent pfn-s are also invalid is wrong. Thus replace
this by explicitly checking against the E820 map.
Patch is in 2.6.22-rc4.
Signed-off-by: Jan Beulich <jbeulich@novell.com> Acked-by: Mark Langsdorf <mark.langsdorf@amd.com>
kfraser [Thu, 21 Jun 2007 08:45:00 +0000 (09:45 +0100)]
xen/firmware: Simplify Xen-interfacing code. The firmware-info maps
will be guaranteed to be densely populated from index 0 to max-1,
hence when we see an error it is always appropriate to bail from the
loop. Signed-off-by: Keir Fraser <keir@xensource.com>
Tim Deegan [Wed, 20 Jun 2007 18:17:36 +0000 (19:17 +0100)]
Don't clip the TSC-derived usec value to <1tick in gettimeofday.
This fixes some very odd gettimeofday() results when NTP is
adjtimex()ing the clock backwards. Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
virt_to_bus() must be called after gnttab_dma_use_page() loop.
Otherwise gnttab unmap_and_replace may happen between them, resulting
in the bus address being wrong. Thanks Isaku.
Signed-off-by: Alex Williamson <alex.williamson@hp.com>