xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Eric DeVolder <eric.devolder@oracle.com>
To: xen-devel@lists.xen.org, andrew.cooper3@citrix.com
Cc: daniel.kiper@oracle.com, eric.devolder@oracle.com,
	bhavesh.davda@oracle.com, JBeulich@suse.com
Subject: [PATCH v2 0/2] kexec: Use hypercall_create_continuation to protect KEXEC ops
Date: Mon, 17 Apr 2017 14:09:04 -0500	[thread overview]
Message-ID: <1492456146-28808-1-git-send-email-eric.devolder@oracle.com> (raw)

During testing (using the script below) we found that multiple
invocations of kexec of unload/load are not safe.

This does not exist in classic Xen kernels in which the kexec-tools
did the kexec via Linux kernel syscall (which in turn made the
hypercall), as the Linux code has a mutex_trylock which would
inhibit multiple concurrent calls.

But with the kexec-tools utilizing xc_kexec_* that is no longer
the case and we need to protect against multiple concurrent
invocations.

Please see the patches and review at your convenience!

==== try-crash.pl from bhavesh.davda@oracle.com ====
#!/usr/bin/perl -w

use strict;
use warnings;
use threads;

sub threaded_task {
    threads->create(sub {
        my $thr_id = threads->self->tid;
        #print "Starting load thread $thr_id\n";
        system("/sbin/kexec  -p --command-line=\"placeholder root=/dev/mapper/nimbula-root ro rhbg console=tty0 console=hvc0 earlyprintk=xen nomodeset printk.time=1 irqpoll maxcpus=1 nr_cpus=1 reset_devices cgroup_disable=memory mce=off selinux=0 console=ttyS1,115200n8\" --initrd=/boot/initrd-4.1.12-61.1.9.el6uek.x86_64kdump.img /boot/vmlinuz-4.1.12-61.1.9.el6uek.x86_64");
        #print "Ending load thread $thr_id\n";
        threads->detach(); #End thread.
    });
    threads->create(sub {
        my $thr_id = threads->self->tid;
        #print "Starting unload thread $thr_id\n";
        system("/sbin/kexec  -p -u");
        #print "Ending unload thread $thr_id\n";
        threads->detach(); #End thread.
    });
}

for my $i (0..99)
{
    threaded_task();
}


Eric DeVolder (2):
  kexec: use hypercall_create_continuation to protect KEXEC ops
  kexec: remove spinlock now that all KEXEC hypercall ops are protected
    at the top-level

 xen/common/kexec.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

             reply	other threads:[~2017-04-17 19:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-17 19:09 Eric DeVolder [this message]
2017-04-17 19:09 ` [PATCH v2 1/2] kexec: use hypercall_create_continuation to protect KEXEC ops Eric DeVolder
2017-04-18 10:48   ` Jan Beulich
2017-04-19 11:00     ` Daniel Kiper
2017-04-19 11:48       ` Andrew Cooper
2017-04-19 12:16         ` Daniel Kiper
2017-04-19 15:48         ` Eric DeVolder
2017-04-17 19:09 ` [PATCH v2 2/2] kexec: remove spinlock now that all KEXEC hypercall ops are protected at the top-level Eric DeVolder
2017-04-18 10:49   ` Jan Beulich
2017-04-19 10:56     ` Daniel Kiper
2017-04-19 11:20       ` Jan Beulich
2017-04-19 11:52         ` Andrew Cooper
2017-04-19 12:13         ` Daniel Kiper
2017-04-19 13:37           ` Jan Beulich
2017-04-19 15:49             ` Eric DeVolder

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=1492456146-28808-1-git-send-email-eric.devolder@oracle.com \
    --to=eric.devolder@oracle.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=bhavesh.davda@oracle.com \
    --cc=daniel.kiper@oracle.com \
    --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;
as well as URLs for NNTP newsgroup(s).