WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Xen

xen-devel

[Top] [All Lists]

[Xen-devel] [XEN-UNSTABLE] Provide a routine to print the active grant t

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [XEN-UNSTABLE] Provide a routine to print the active grant table entries.
From: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Date: 2009年9月14日 11:40:34 -0400
Delivery-date: 2009年9月14日 08:50:57 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.19 (2009年01月05日)
As part of hunting down a race-condition with SWIOTLB, I resurrected this
patch from Virtual Iron's patchset to help me along. It didn't help that much
(still working on the bug), but this might be useful for other situations
Here it is:
 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@xxxxxxxxxx>
diff -r 8b0f1f37e145 xen/common/grant_table.c
--- a/xen/common/grant_table.c Sun Aug 16 08:46:08 2009 +0100
+++ b/xen/common/grant_table.c Mon Sep 14 11:33:32 2009 -0400
@@ -1857,6 +1857,119 @@
 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 *sha;
+ act = &active_entry(rd->grant_table, ref);
+ sha = &shared_entry(rd->grant_table, ref);
+ if (act->pin) {
+ if (first) {
+ 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%06x 0x%02x\n",
+ ref, act->domid, act->frame, act->pin, sha->domid, 
sha->frame, sha->flags);
+ }
+ }
+ 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 *sha;
+ act = &active_entry(rd->grant_table, ref);
+ sha = &shared_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%06x 0x%02x <== 
BEFORE\n",
+ ref, act->domid, act->frame, act->pin, sha->domid, 
sha->frame, sha->flags);
+ act->pin++;
+ get_page(mfn_to_page(act->frame), rd);
+ printk("[%3d] %5d 0x%06lx 0x%08x %5d 0x%06x 0x%02x <== 
AFTER\n",
+ ref, act->domid, act->frame, act->pin, sha->domid, 
sha->frame, sha->flags);
+ 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
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [XEN-UNSTABLE] Provide a routine to print the active grant table entries., Konrad Rzeszutek Wilk <=
Previous by Date: Re: [Xen-devel] Attempt to load 2.6.31-rc8 under Xen 3.4.1 on top of Ubuntu 9.04 Server + Serial logs 4097, 4096 on F11 , Konrad Rzeszutek Wilk
Next by Date: Re: [Xen-devel] Attempt to load 2.6.31-rc8 under Xen 3.4.1 on top of Ubuntu 9.04 Server + Serial logs 4097, 4096 on F11 , Boris Derzhavets
Previous by Thread: [Xen-devel] [PATCH 2/2] Fix calling order wherein iommu_detected would be set after software IO TLB was initialized causing double IO TLB allocation. , Konrad Rzeszutek Wilk
Next by Thread: [Xen-devel] [PATCH xen-unstable] Remove PSE flag from guest CR4 , Dave McCracken
Indexes: [Date] [Thread] [Top] [All Lists]

Copyright ©, Citrix Systems Inc. All rights reserved. Legal and Privacy
Citrix This site is hosted by Citrix

AltStyle によって変換されたページ (->オリジナル) /