From: Akio Takebe <takebe_akio@jp.fujitsu.com>
To: Akio Takebe <takebe_akio@jp.fujitsu.com>,
xen-ia64-devel <xen-ia64-devel@lists.xensource.com>,
xen-devel <xen-devel@lists.xensource.com>
Subject: [Patch][2/2]implement dump_execution_state() on ia64
Date: Thu, 27 Mar 2008 22:10:47 +0900 [thread overview]
Message-ID: <7EC8900BF92D97takebe_akio@jp.fujitsu.com> (raw)
In-Reply-To: <7CC8900B4B0550takebe_akio@jp.fujitsu.com>
[-- Attachment #1: Mail message body --]
[-- Type: text/plain, Size: 114 bytes --]
Hi,
This patch is ia64 side.
Signed-off-by: Akio Takebe <takebe_akio@jp.fujitsu.com>
Best Regards,
Akio Takebe
[-- Attachment #2: implement_dump_execution_state.ia64.patch --]
[-- Type: application/octet-stream, Size: 4930 bytes --]
diff -r edfb58ca4d96 xen/arch/ia64/linux-xen/smp.c
--- a/xen/arch/ia64/linux-xen/smp.c Tue Mar 25 12:37:17 2008 -0600
+++ b/xen/arch/ia64/linux-xen/smp.c Fri Mar 28 06:58:55 2008 +0900
@@ -91,10 +91,20 @@ struct call_data_struct {
atomic_t finished;
};
+struct call_data_regs_struct {
+ void (*func) (void *info, struct cpu_user_regs *);
+ void *info;
+ long wait;
+ atomic_t started;
+ atomic_t finished;
+};
+
static volatile struct call_data_struct *call_data;
+static volatile struct call_data_regs_struct *call_data_regs;
#define IPI_CALL_FUNC 0
#define IPI_CPU_STOP 1
+#define IPI_CALL_FUNC_REGS 2
/* This needs to be cacheline aligned because it is written to by *other* CPUs. */
static DEFINE_PER_CPU(u64, ipi_operation) ____cacheline_aligned;
@@ -183,7 +193,35 @@ handle_IPI (int irq, void *dev_id, struc
atomic_inc(&data->finished);
}
break;
-
+#ifdef XEN
+ case IPI_CALL_FUNC_REGS:
+ {
+ struct call_data_regs_struct *data;
+ void (*func)(void *info, struct cpu_user_regs *);
+ void *info;
+ int wait;
+
+ /* release the 'pointer lock' */
+ data = (struct call_data_regs_struct *) call_data_regs;
+ func = data->func;
+ info = data->info;
+ wait = data->wait;
+
+ mb();
+ atomic_inc(&data->started);
+ /*
+ * At this point the structure may be gone unless
+ * wait is true.
+ */
+ (*func)(info, regs);
+
+ /* Notify the sending CPU that the task is done. */
+ mb();
+ if (wait)
+ atomic_inc(&data->finished);
+ }
+ break;
+#endif
case IPI_CPU_STOP:
stop_this_cpu();
break;
@@ -455,6 +493,41 @@ on_selected_cpus(cpumask_t selected, voi
return 0;
}
+
+int
+on_selected_cpus_regs(cpumask_t selected,
+ void (*func) (void *info, struct cpu_user_regs *), void *info,
+ int retry, int wait)
+{
+ struct call_data_regs_struct data;
+ unsigned int cpu, nr_cpus = cpus_weight(selected);
+
+ ASSERT(local_irq_is_enabled());
+
+ if (!nr_cpus)
+ return 0;
+
+ data.func = func;
+ data.info = info;
+ data.wait = wait;
+ atomic_set(&data.started, 0);
+ atomic_set(&data.finished, 0);
+
+ spin_lock(&call_lock);
+
+ call_data_regs = &data;
+ wmb();
+
+ for_each_cpu_mask(cpu, selected)
+ send_IPI_single(cpu, IPI_CALL_FUNC_REGS);
+
+ while (atomic_read(wait ? &data.finished : &data.started) != nr_cpus)
+ cpu_relax();
+
+ spin_unlock(&call_lock);
+
+ return 0;
+}
#endif
/*
diff -r edfb58ca4d96 xen/arch/ia64/xen/xenmisc.c
--- a/xen/arch/ia64/xen/xenmisc.c Tue Mar 25 12:37:17 2008 -0600
+++ b/xen/arch/ia64/xen/xenmisc.c Fri Mar 28 06:58:55 2008 +0900
@@ -123,6 +123,50 @@ void audit_domains_key(unsigned char key
{
}
+inline void dump_execution_state(struct cpu_user_regs *regs)
+{
+ struct unw_frame_info info;
+ struct switch_stack *sw;
+ struct pt_regs *pt_regs = (struct pt_regs *)regs;
+
+ if (pt_regs == NULL){
+ pt_regs = guest_cpu_user_regs();
+ show_registers(pt_regs);
+ } else {
+ sw = (struct switch_stack *)(current->arch._thread.ksp + 16);
+ unw_init_from_interruption(&info, current, pt_regs, sw);
+ show_registers(pt_regs);
+ ia64_do_show_stack(&info, NULL);
+ }
+}
+
+void __dump_execstate(void *unused, struct cpu_user_regs *regs)
+{
+ dump_execution_state(NULL);
+ printk("*** Dumping CPU%d guest state: ***\n", smp_processor_id());
+ if ( is_idle_vcpu(current) )
+ printk("No guest context (CPU is idle).\n");
+ else
+ dump_execution_state(regs); // dump_execution_state(guest_cpu_user_regs()); ??? //
+}
+
+void _dump_registers(struct cpu_user_regs *regs)
+{
+ unsigned int cpu;
+
+ /* Get local execution state out immediately, in case we get stuck. */
+ printk("\n*** Dumping CPU%d host state: ***\n", smp_processor_id());
+ __dump_execstate(NULL, regs);
+
+ for_each_online_cpu ( cpu )
+ {
+ if ( cpu == smp_processor_id() )
+ continue;
+ printk("\n*** Dumping CPU%d host state: ***\n", cpu);
+ on_selected_cpus_regs(cpumask_of_cpu(cpu), __dump_execstate, NULL, 1, 1);
+ }
+}
+
void panic_domain(struct pt_regs *regs, const char *fmt, ...)
{
va_list args;
diff -r edfb58ca4d96 xen/include/asm-ia64/xenprocessor.h
--- a/xen/include/asm-ia64/xenprocessor.h Tue Mar 25 12:37:17 2008 -0600
+++ b/xen/include/asm-ia64/xenprocessor.h Fri Mar 28 06:58:55 2008 +0900
@@ -250,6 +250,8 @@ typedef union {
};
} ia64_pkr_t;
-#define dump_execution_state() printk("FIXME: implement ia64 dump_execution_state()\n");
+extern inline void dump_execution_state(struct cpu_user_regs *);
+extern inline void __dump_execstate(void *, struct cpu_user_regs *);
+extern inline void _dump_registers(struct cpu_user_regs *);
#endif // _ASM_IA64_XENPROCESSOR_H
[-- Attachment #3: Type: text/plain, Size: 152 bytes --]
_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@lists.xensource.com
http://lists.xensource.com/xen-ia64-devel
next prev parent reply other threads:[~2008-03-27 13:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-27 13:05 [Patch][0/2]implement dump_execution_state() on ia64 Akio Takebe
2008-03-27 13:09 ` [Patch][1/2]implement " Akio Takebe
2008-03-27 13:10 ` Akio Takebe [this message]
2008-03-27 14:47 ` [Patch][0/2]implement " Keir Fraser
2008-03-27 16:56 ` [Xen-devel] " Akio Takebe
2008-03-27 17:04 ` Keir Fraser
2008-03-27 17:22 ` [Xen-devel] " Akio Takebe
2008-03-27 19:22 ` Keir Fraser
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=7EC8900BF92D97takebe_akio@jp.fujitsu.com \
--to=takebe_akio@jp.fujitsu.com \
--cc=xen-devel@lists.xensource.com \
--cc=xen-ia64-devel@lists.xensource.com \
/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.