* [PATCH 1 of 3] Made arch_memory_op propagate (instead of ignore) errors from guest_physmap_add_page
2009-12-03 18:50 [PATCH 0 of 3] Patches to help fix issues in the field Konrad Rzeszutek Wilk
@ 2009-12-03 18:50 ` Konrad Rzeszutek Wilk
2009-12-03 18:50 ` [PATCH 2 of 3] To help debug stack overflows, debug backtrace now shows Konrad Rzeszutek Wilk
2009-12-03 18:50 ` [PATCH 3 of 3] Provided a routine to print the active grant table entries Konrad Rzeszutek Wilk
2 siblings, 0 replies; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2009-12-03 18:50 UTC (permalink / raw)
To: xen-devel; +Cc: keir.fraser
# HG changeset patch
# User konrad@phenom.dumpdata.com
# Date 1259769438 18000
# Node ID f9eeb0545e1c48cd9fc090c3be8d994b258dd636
# Parent 50aaf5df87ff75fbffffdc7cf9e6d128adef8ecb
Made arch_memory_op propagate (instead of ignore) errors from guest_physmap_add_page.
Authored-by: David Lively
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
diff -r 50aaf5df87ff -r f9eeb0545e1c xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Wed Dec 02 10:35:41 2009 -0500
+++ b/xen/arch/x86/mm.c Wed Dec 02 10:57:18 2009 -0500
@@ -4005,6 +4005,7 @@
struct xen_add_to_physmap xatp;
unsigned long prev_mfn, mfn = 0, gpfn;
struct domain *d;
+ int rc = 0;
if ( copy_from_guest(&xatp, arg, 1) )
return -EFAULT;
@@ -4089,7 +4090,7 @@
guest_physmap_remove_page(d, gpfn, mfn, 0);
/* Map at new location. */
- guest_physmap_add_page(d, xatp.gpfn, mfn, 0);
+ rc = guest_physmap_add_page(d, xatp.gpfn, mfn, 0);
domain_unlock(d);
@@ -4098,7 +4099,7 @@
rcu_unlock_domain(d);
- break;
+ return rc;
}
case XENMEM_set_memory_map:
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 2 of 3] To help debug stack overflows, debug backtrace now shows
2009-12-03 18:50 [PATCH 0 of 3] Patches to help fix issues in the field Konrad Rzeszutek Wilk
2009-12-03 18:50 ` [PATCH 1 of 3] Made arch_memory_op propagate (instead of ignore) errors from guest_physmap_add_page Konrad Rzeszutek Wilk
@ 2009-12-03 18:50 ` Konrad Rzeszutek Wilk
2009-12-03 18:50 ` [PATCH 3 of 3] Provided a routine to print the active grant table entries Konrad Rzeszutek Wilk
2 siblings, 0 replies; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2009-12-03 18:50 UTC (permalink / raw)
To: xen-devel; +Cc: keir.fraser
# HG changeset patch
# User konrad@phenom.dumpdata.com
# Date 1259769725 18000
# Node ID ea7fc895409dbaf507da807b3473431e6586a907
# Parent f9eeb0545e1c48cd9fc090c3be8d994b258dd636
To help debug stack overflows, debug backtrace now shows
stack pointer values and stack limits.
Authored-by: David Lively
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
diff -r f9eeb0545e1c -r ea7fc895409d xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c Wed Dec 02 10:57:18 2009 -0500
+++ b/xen/arch/x86/traps.c Wed Dec 02 11:02:05 2009 -0500
@@ -239,18 +239,25 @@
{
unsigned long *frame, next, addr, low, high;
- printk("Xen call trace:\n ");
-
- printk("[<%p>]", _p(regs->eip));
- print_symbol(" %s\n ", regs->eip);
+ printk("Xen call trace:\n");
/* Bounds for range of valid frame pointer. */
low = (unsigned long)(ESP_BEFORE_EXCEPTION(regs) - 2);
high = (low & ~(STACK_SIZE - 1)) +
(STACK_SIZE - sizeof(struct cpu_info) - 2*sizeof(unsigned long));
+ {
+ unsigned long bos, los;
+ bos = (low & ~(STACK_SIZE - 1)) + STACK_SIZE;
+ los = bos - PAGE_SIZE;
+ printk("Stack base:%p limit:%p\n ", _p(bos), _p(los));
+ }
+
/* The initial frame pointer. */
next = regs->ebp;
+
+ printk("%p[<%p>]", _p(next), _p(regs->eip));
+ print_symbol(" %s\n ", regs->eip);
for ( ; ; )
{
@@ -278,7 +285,7 @@
addr = frame[1];
}
- printk("[<%p>]", _p(addr));
+ printk("%p[<%p>]", _p(next), _p(addr));
print_symbol(" %s\n ", addr);
low = (unsigned long)&frame[2];
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 3 of 3] Provided a routine to print the active grant table entries
2009-12-03 18:50 [PATCH 0 of 3] Patches to help fix issues in the field Konrad Rzeszutek Wilk
2009-12-03 18:50 ` [PATCH 1 of 3] Made arch_memory_op propagate (instead of ignore) errors from guest_physmap_add_page Konrad Rzeszutek Wilk
2009-12-03 18:50 ` [PATCH 2 of 3] To help debug stack overflows, debug backtrace now shows Konrad Rzeszutek Wilk
@ 2009-12-03 18:50 ` Konrad Rzeszutek Wilk
2 siblings, 0 replies; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2009-12-03 18:50 UTC (permalink / raw)
To: xen-devel; +Cc: keir.fraser
# HG changeset patch
# User konrad@phenom.dumpdata.com
# Date 1259773614 18000
# Node ID c926e5e4728dc0383a5e80954d22be123118373c
# Parent 2e270f268c03dff2e029561a13de11129c8bbb20
Provided a routine to print the active grant table entries.
This can be called by command 'g' from the xen console.
Also, provided a command (invoked by 'G' from the xen console)
to forcibly increment the pin count of some arbitrary
grant table entry. This can be used to test the
printing feature.
Authored-By: Robert Phillips
Signed-off-By: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
diff -r 2e270f268c03 -r c926e5e4728d xen/common/grant_table.c
--- a/xen/common/grant_table.c Wed Dec 02 12:04:35 2009 -0500
+++ b/xen/common/grant_table.c Wed Dec 02 12:06:54 2009 -0500
@@ -2491,6 +2491,152 @@
d->grant_table = NULL;
}
+#define GNTTAB_USAGE_PROFILE
+#ifdef GNTTAB_USAGE_PROFILE
+
+#include <xen/keyhandler.h>
+
+void gnttab_usage_print(struct domain *rd)
+{
+ int first = 1;
+ grant_ref_t ref;
+ printk(" -------- active -------- -------- shared --------\n");
+ printk("[ref] localdom mfn pin localdom gmfn flags\n");
+
+ spin_lock(&rd->grant_table->lock);
+ for (ref = 0; ref != nr_grant_entries(rd->grant_table); ref++) {
+ struct active_grant_entry *act;
+ struct grant_entry_header *sha;
+ grant_entry_v1_t *sha1;
+ grant_entry_v2_t *sha2;
+ uint16_t status;
+ uint64_t frame;
+
+ act = &active_entry(rd->grant_table, ref);
+ sha = shared_entry_header(rd->grant_table, ref);
+ if (rd->grant_table->gt_version == 1) {
+ sha1 = &shared_entry_v1(rd->grant_table, ref);
+ sha2 = NULL;
+ status = sha->flags;
+ frame = sha1->frame;
+ } else {
+ sha2 = &shared_entry_v2(rd->grant_table, ref);
+ sha1 = NULL;
+ frame = sha2->full_page.frame;
+ status = status_entry(rd->grant_table, ref);
+ }
+ if (act->pin) {
+ if (first) {
+ printk("grant-table for remote domain:%5d (v%d)\n",
+ rd->domain_id, rd->grant_table->gt_version);
+ first = 0;
+ }
+ // [ddd] ddddd 0xXXXXXX 0xXXXXXXXX ddddd 0xXXXXXX 0xXX
+ printk("[%3d] %5d 0x%06lx 0x%08x %5d 0x%06lx 0x%02x\n",
+ ref, act->domid, act->frame, act->pin, sha->domid, frame, status);
+ }
+ }
+ spin_unlock(&rd->grant_table->lock);
+ if (first)
+ printk("grant-table for remote domain:%5d ... no active grant table entries\n", rd->domain_id);
+}
+
+static void gnttab_usage_print_all(unsigned char key)
+{
+ struct domain *d;
+ printk("%s [ key '%c' pressed\n", __FUNCTION__, key);
+ for_each_domain(d) {
+ gnttab_usage_print(d);
+ }
+ printk("%s ] done\n", __FUNCTION__);
+}
+
+static int gnttab_incr_pin_one(struct domain *rd)
+{
+ int first = 1;
+ grant_ref_t ref;
+ printk(" -------- active -------- -------- shared --------\n");
+ printk("[ref] localdom mfn pin localdom gmfn flags\n");
+
+ spin_lock(&rd->grant_table->lock);
+ for (ref = 0; ref != nr_grant_entries(rd->grant_table); ref++) {
+ struct active_grant_entry *act;
+ struct grant_entry_header *sha;
+ grant_entry_v1_t *sha1;
+ grant_entry_v2_t *sha2;
+ uint16_t *status;
+ uint64_t frame;
+
+ act = &active_entry(rd->grant_table, ref);
+ sha = shared_entry_header(rd->grant_table, ref);
+ if (rd->grant_table->gt_version == 1) {
+ sha1 = &shared_entry_v1(rd->grant_table, ref);
+ sha2 = NULL;
+ status = &sha->flags;
+ frame = sha1->frame;
+ } else {
+ sha2 = &shared_entry_v2(rd->grant_table, ref);
+ sha1 = NULL;
+ frame = sha2->full_page.frame;
+ status = &status_entry(rd->grant_table, ref);
+ }
+ if (act->pin) {
+ printk("grant-table for remote domain:%5d\n", rd->domain_id);
+ first = 0;
+ // [ddd] ddddd 0xXXXXXX 0xXXXXXXXX ddddd 0xXXXXXX 0xXX
+ printk("[%3d] %5d 0x%06lx 0x%08x %5d 0x%06lx 0x%02x <== BEFORE\n",
+ ref, act->domid, act->frame, act->pin, sha->domid, frame, *status);
+ act->pin++;
+ get_page(mfn_to_page(act->frame), rd);
+ printk("[%3d] %5d 0x%06lx 0x%08x %5d 0x%06lx 0x%02x <== AFTER\n",
+ ref, act->domid, act->frame, act->pin, sha->domid, frame, *status);
+ break;
+ }
+ }
+ spin_unlock(&rd->grant_table->lock);
+ if (first) {
+ printk("grant-table for remote domain:%5d ... no active grant table entries\n", rd->domain_id);
+ return 0;
+ }
+ return 1;
+}
+
+static void gnttab_incr_pin(unsigned char key)
+{
+ struct domain *d;
+ printk("%s [ key '%c' pressed\n", __FUNCTION__, key);
+ for_each_domain(d) {
+ if (gnttab_incr_pin_one(d))
+ break;
+ }
+ printk("%s ] done\n", __FUNCTION__);
+}
+static struct keyhandler gnttab_usage_print_all_keyhandler = {
+ .diagnostic = 1,
+ .u.fn = gnttab_usage_print_all,
+ .desc = "print grant table usage"
+};
+
+
+static struct keyhandler gnttab_incr_pin_keyhandler = {
+ .diagnostic = 1,
+ .u.fn = gnttab_incr_pin,
+ .desc = "force +1 in grant table pin entry"
+};
+
+
+static int __init gnttab_usage_init(void)
+{
+ register_keyhandler('g', &gnttab_usage_print_all_keyhandler);
+ register_keyhandler('G', &gnttab_incr_pin_keyhandler);
+ return 0;
+}
+
+__initcall(gnttab_usage_init);
+
+#endif
+
+
/*
* Local variables:
* mode: C
^ permalink raw reply [flat|nested] 4+ messages in thread