From: David Vrabel <david.vrabel@citrix.com>
To: David Vrabel <david.vrabel@citrix.com>
Cc: Daniel Kiper <daniel.kiper@oracle.com>,
"kexec@lists.infradead.org" <kexec@lists.infradead.org>,
Eric Biederman <ebiederm@xmission.com>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [RFC PATCH 0/3] Improve kexec support in Xen hypervisor
Date: Wed, 16 Jan 2013 16:33:42 +0000 [thread overview]
Message-ID: <50F6D666.5040906@citrix.com> (raw)
In-Reply-To: <1358353746-1899-1-git-send-email-david.vrabel@citrix.com>
[-- Attachment #1: Type: text/plain, Size: 359 bytes --]
On 16/01/13 16:29, David Vrabel wrote:
> This series of patches improves the kexec hypercall in the Xen
> hypervisor. It is an incomplete prototype but I posting it early for
> comments on the proposed ABI/API.
And here is a (very) simple test program and a trivial test image I have
used. This provides an example of how the libxc API can be used.
David
[-- Attachment #2: xen-kexec-test.c --]
[-- Type: text/x-csrc, Size: 2081 bytes --]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <xenctrl.h>
#include <xen/kexec.h>
#include "xc_kexec.h"
extern unsigned long image;
extern unsigned long image_end;
int main(void)
{
xc_interface *xch;
unsigned long start, size;
size_t image_size;
DECLARE_HYPERCALL_BUFFER(xen_kexec_segment_t, segments);
DECLARE_HYPERCALL_BUFFER(void, image_buf);
xen_kexec_load_v2_t load;
int ret;
xch = xc_interface_open(NULL, NULL, 0);
if ( !xch )
{
perror("xc_open");
exit(1);
}
ret = xc_kexec_get_range(xch, KEXEC_RANGE_MA_CRASH, 0, &start, &size);
if ( ret )
{
perror("xc_kexec_get_range");
exit(1);
}
printf("Crash region: 0x%08lx-0x%08lx\n", start, start + size);
image_size = (void *)&image_end - (void *)ℑ
printf("Image %p-%p\n", &image, (void *)&image + image_size);
image_buf = xc_hypercall_buffer_alloc(xch, image_buf, image_size);
if ( !image_buf )
{
perror("xc_hypercall_buffer_alloc");
exit(1);
}
segments = xc_hypercall_buffer_alloc(xch, segments, sizeof(*segments) * 1);
if ( !segments )
{
perror("xc_hypercall_buffer_alloc");
exit(1);
}
memcpy(image_buf, &image, image_size);
set_xen_guest_handle(segments[0].buf, image_buf);
segments[0].size = image_size;
segments[0].dest_maddr = start;
load.type = KEXEC_TYPE_DEFAULT;
load.class = KEXEC_CLASS_32;
load.nr_segments = 1;
set_xen_guest_handle(load.segments, segments);
load.entry_maddr = start;
ret = xc_kexec_load(xch, &load);
if ( ret )
{
perror("xc_kexec_load");
exit(1);
}
xc_hypercall_buffer_free(xch, image_buf);
xc_hypercall_buffer_free(xch, segments);
ret = xc_kexec(xch, KEXEC_TYPE_DEFAULT);
if ( ret )
{
perror("xc_kexec_exec");
exit(1);
}
xc_interface_close(xch);
return 0;
}
/*
* Local variables:
* mode: C
* c-file-style: "BSD"
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/
[-- Attachment #3: image.S --]
[-- Type: text/plain, Size: 280 bytes --]
.text
.code32
.globl image
image:
1: mov $0x3f8+5, %dx
inb %dx, %al
test $0x20, %al
je 1b
mov $0x3f8, %dx
mov $'I', %al
outb %al, %dx
hlt
.globl image_end
image_end:
[-- Attachment #4: Type: text/plain, Size: 143 bytes --]
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2013-01-16 16:33 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-16 16:29 [RFC PATCH 0/3] Improve kexec support in Xen hypervisor David Vrabel
2013-01-16 16:29 ` [PATCH 1/3] kexec: extend hypercall with improved load/unload ops David Vrabel
2013-01-17 12:28 ` Daniel Kiper
2013-01-17 14:50 ` David Vrabel
2013-01-17 15:17 ` Daniel Kiper
2013-01-17 17:53 ` David Vrabel
2013-01-18 9:44 ` Daniel Kiper
2013-01-18 9:50 ` [Xen-devel] " Ian Campbell
2013-01-18 19:01 ` Eric W. Biederman
2013-01-17 12:33 ` [Xen-devel] " Ian Campbell
2013-01-16 16:29 ` [PATCH 2/3] kexec: remove kexec_load and kexec_unload ops David Vrabel
2013-01-16 16:29 ` [PATCH 3/3] libxc: add API for kexec hypercall David Vrabel
2013-01-16 16:59 ` [Xen-devel] " Ian Campbell
2013-01-16 16:33 ` David Vrabel [this message]
2013-01-16 17:02 ` [Xen-devel] [RFC PATCH 0/3] Improve kexec support in Xen hypervisor Ian Campbell
2013-01-16 17:48 ` David Vrabel
2013-01-17 9:35 ` Ian Campbell
2013-01-17 10:46 ` Jan Beulich
2013-01-17 10:51 ` Jan Beulich
2013-01-17 11:27 ` Daniel Kiper
2013-01-17 11:37 ` [Xen-devel] " Andrew Cooper
2013-01-17 12:59 ` Daniel Kiper
2013-01-17 13:01 ` David Vrabel
2013-01-17 13:25 ` Eric W. Biederman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50F6D666.5040906@citrix.com \
--to=david.vrabel@citrix.com \
--cc=daniel.kiper@oracle.com \
--cc=ebiederm@xmission.com \
--cc=kexec@lists.infradead.org \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox