All of lore.kernel.org
 help / color / mirror / Atom feed
From: Akio Takebe <takebe_akio@jp.fujitsu.com>
To: Horms <horms@verge.net.au>, Keir Fraser <Keir.Fraser@cl.cam.ac.uk>
Cc: Ian Pratt <m+Ian.Pratt@cl.cam.ac.uk>,
	Kazuo Moriwaka <moriwaka@valinux.co.jp>,
	xen-devel@lists.xensource.com,
	Akio Takebe <takebe_akio@jp.fujitsu.com>,
	Isaku Yamahata <yamahata@valinux.co.jp>,
	Magnus Damm <magnus@valinux.co.jp>,
	Mark Williamson <mark.williamson@cl.cam.ac.uk>
Subject: Re: [PATCH] kexec: framework and i386 (Take X)
Date: Mon, 05 Jun 2006 11:53:16 +0900	[thread overview]
Message-ID: <67C6884B31A247takebe_akio@jp.fujitsu.com> (raw)
In-Reply-To: <20060525072017.GA25881@verge.net.au>

Hi, Horms

When I tried your patch, I had compile errors.
If you use xchg(), you should get return value of xchg().
The above compile error occurre at the below part.

+void crash_kexec(struct cpu_user_regs *regs)
+{
+    int locked;
+
+    locked = xchg(&kexec_crash_lock, 1);
+    if (locked)
+        return;
+    __crash_kexec(regs);
+    xchg(&kexec_crash_lock, 0); <-------------this one
+}
+
+static int get_crash_note(int vcpuid, XEN_GUEST_HANDLE(void) uarg)
+{
+    struct domain *domain = current->domain;
+    unsigned long crash_note;
+    struct vcpu *vcpu;
+    int locked;
+
+    if (vcpuid < 0 || vcpuid > MAX_VIRT_CPUS)
+	return -EINVAL;
+
+    if ( ! (vcpu = domain->vcpu[vcpuid]) )
+	return -EINVAL;
+
+    locked = xchg(&kexec_crash_lock, 1);
+    if (locked)
+    {
+       printk("do_kexec: (CMD_kexec_crash_note): dump is locked\n");
+       return -EFAULT;
+    }
+    crash_note = __pa((unsigned long)per_cpu(crash_notes, vcpu->
processor));
+    xchg(&kexec_crash_lock, 0); <-------------this one
+
+    if ( unlikely(copy_to_guest(uarg, &crash_note, 1) != 0) )
+    {
+        printk("do_kexec: (CMD_kexec_crash_note): copy_to_guest failed
\n");
+        return -EFAULT;
+    }
+    
+    return 0;
+}
+
+int do_kexec(unsigned long op, int arg1, XEN_GUEST_HANDLE(void) uarg)
+{
+    xen_kexec_image_t *image;
+    int locked;
+    int *image_set;
+    int status = -EINVAL;
+
+    if ( !IS_PRIV(current->domain) )  
+        return -EPERM;
+
+    switch (op)
+    {
+    case KEXEC_CMD_kexec_crash_note:
+        return get_crash_note(arg1, uarg);
+    case KEXEC_CMD_kexec_reserve:
+	return get_reserve(uarg);
+    }
+
+    /* For all other ops, arg1 is the type of kexec, that is
+     * KEXEC_TYPE_DEFAULT or KEXEC_TYPE_CRASH */
+    if (arg1 == KEXEC_TYPE_CRASH)
+    {
+        image = &kexec_crash_image;
+        image_set = &kexec_crash_image_set;
+        locked = xchg(&kexec_crash_lock, 1);
+        if (locked)
+        {
+           printk("do_kexec: dump is locked\n");
+           return -EFAULT;
+        }
+    }
+    else
+    {
+        image = &kexec_image;
+        image_set = &kexec_image_set;
+    }
+
+    switch(op) {
+    case KEXEC_CMD_kexec:
+        BUG_ON(!*image_set);
+	status = __do_kexec(arg1, uarg, image);
+        break;
+    case KEXEC_CMD_kexec_load:
+        BUG_ON(*image_set);
+        if ( unlikely(copy_from_guest(image, uarg, 1) != 0) )
+        {
+            printk("do_kexec (CMD_kexec_load): copy_from_guest failed\n
");
+            status = -EFAULT;
+	    break;
+        }
+        *image_set = 1;
+        status = machine_kexec_load(arg1, image);
+        break;
+    case KEXEC_CMD_kexec_unload:
+        BUG_ON(!*image_set);
+        *image_set = 0;
+        machine_kexec_unload(arg1, image);
+        status = 0;
+        break;
+    }
+
+    if (arg1 == KEXEC_TYPE_CRASH)
+        xchg(&kexec_crash_lock, 0);  <-------------this one
+    return status;
+}
+


Best Regards,

Akio Takebe

  reply	other threads:[~2006-06-05  2:53 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-07  7:42 [PATCH]: kexec: framework and i386 Horms
2006-04-07 15:00 ` Don Zickus
2006-04-10  5:09   ` Hirokazu Takahashi
2006-04-10 15:38     ` Don Zickus
2006-04-11  1:44       ` Horms
2006-04-12 15:56         ` Don Zickus
2006-04-07 15:09 ` Gerd Hoffmann
2006-04-08  4:39   ` Horms
2006-04-12  9:12 ` Horms
2006-04-17  6:06   ` Horms
2006-04-21  1:28     ` [PATCH]: kexec: framework and i386 (Take IV) Horms
2006-04-21  6:10     ` Re: [PATCH]: kexec: framework and i386 Akio Takebe
2006-04-21  6:55       ` horms-home
2006-04-21  7:53         ` Akio Takebe
2006-04-23 14:45       ` Mark Williamson
2006-04-24  1:10         ` Akio Takebe
2006-04-24  1:53           ` Hypercall number assignment convension (was Re: Re: [PATCH]: kexec: framework and i386) Isaku Yamahata
2006-04-24  7:32             ` Keir Fraser
2006-04-24 11:20               ` Muli Ben-Yehuda
2006-04-25  0:11               ` Horms
2006-04-25  9:57                 ` Keir Fraser
2006-04-26  6:08                   ` [PATCH]: kexec: framework and i386 Take V Horms
2006-05-02  8:17                     ` [PATCH]: kexec: framework and i386 (Take VI) Simon Horman [Horms]
2006-05-03  7:16                       ` Akio Takebe
2006-05-05  1:03                         ` horms
2006-05-06  8:46                           ` Akio Takebe
2006-05-07  4:46                             ` Horms
2006-05-07  9:45                               ` Akio Takebe
2006-05-08  9:02                                 ` Ian Campbell
2006-05-11 11:35                                   ` horms
2006-05-15  8:29                         ` Akio Takebe
2006-05-06  8:44                       ` Akio Takebe
2006-05-07  4:45                         ` Horms
2006-05-09  4:16                           ` [PATCH]: kexec: framework and i386 (Take VII) Horms
2006-05-09  9:18                             ` [PATCH]: kexec: framework and i386 (Take VIII) Horms
2006-05-09 13:28                               ` Akio Takebe
2006-05-16 10:43                                 ` Akio Takebe
2006-05-16 10:44                                   ` Keir Fraser
2006-05-16 11:03                                     ` Akio Takebe
2006-05-16 12:39                                       ` Keir Fraser
2006-05-17  2:44                                         ` Horms
2006-05-17  4:53                                           ` Horms
2006-05-17  9:52                                             ` Re: [PATCH]: kexec: framework and i386 (Take IX) Horms
2006-05-17 10:10                                               ` Keir Fraser
2006-05-18  3:37                                                 ` Horms
2006-05-25  7:20                                                   ` [PATCH] kexec: framework and i386 (Take X) Horms
2006-06-05  2:53                                                     ` Akio Takebe [this message]
2006-06-15  7:29                                                     ` [PATCH] kexec: framework and i386 (Take XI) Horms
2006-07-11  3:39                                                       ` [PATCH] kexec: framework and i386 (Take XII) Horms
2006-08-11  7:48                                                         ` [PATCH] kexec: framework and i386 (Take XIII) Horms
2006-08-31  7:43                                                           ` [PATCH] kexec: framework and i386 (Take XIV) Horms
2006-08-31  8:55                                                             ` Akio Takebe
2006-09-01  2:56                                                               ` Horms
2006-09-01  8:41                                                                 ` Akio Takebe
2006-09-01  8:45                                                                   ` Akio Takebe
2006-09-01 10:21                                                                     ` Horms
2006-09-04 21:45                                                                       ` Akio Takebe
2007-05-28  5:28                                                                         ` Horms
2007-05-28  6:25                                                                           ` [Xen-devel] " Akio Takebe
2007-05-29  1:05                                                                             ` Horms
2007-05-29  9:04                                                                           ` Ian Campbell
2007-05-31 10:43                                                                             ` [Xen-devel] " Akio Takebe
2007-05-31 10:49                                                                               ` Keir Fraser
2007-05-31 11:07                                                                                 ` [Xen-devel] " Akio Takebe
2007-05-31 11:17                                                                                   ` Akio Takebe
2006-09-05 11:43                                                             ` [Xen-devel] " Kazuo Moriwaka
2006-09-05 13:06                                                               ` Horms
2006-04-26  2:09               ` Hypercall number assignment convension (was Re: Re: [PATCH]: kexec: framework and i386) Isaku Yamahata

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=67C6884B31A247takebe_akio@jp.fujitsu.com \
    --to=takebe_akio@jp.fujitsu.com \
    --cc=Keir.Fraser@cl.cam.ac.uk \
    --cc=horms@verge.net.au \
    --cc=m+Ian.Pratt@cl.cam.ac.uk \
    --cc=magnus@valinux.co.jp \
    --cc=mark.williamson@cl.cam.ac.uk \
    --cc=moriwaka@valinux.co.jp \
    --cc=xen-devel@lists.xensource.com \
    --cc=yamahata@valinux.co.jp \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.