All of lore.kernel.org
 help / color / mirror / Atom feed
From: NISHIGUCHI Naoki <nisiguti@jp.fujitsu.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] xenbaked: Fix access to trace buffer after xentrace changes
Date: Thu, 24 Apr 2008 13:38:10 +0900	[thread overview]
Message-ID: <48100EB2.3030606@jp.fujitsu.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 262 bytes --]

Hi,

Xenmon does not work correctlly after xentrace changes in cs 17000.

Attached patch fixes this problem.
This patch modifies access to trace buffer same as tools/xentrace.

Signed-off-by: Naoki Nishiguchi <nisiguti@jp.fujitsu.com>

Regards,
Naoki Nishiguchi

[-- Attachment #2: xenbaked.patch --]
[-- Type: text/plain, Size: 1666 bytes --]

diff -r 77dec8732cde tools/xenmon/xenbaked.c
--- a/tools/xenmon/xenbaked.c	Wed Apr 23 16:58:44 2008 +0100
+++ b/tools/xenmon/xenbaked.c	Thu Apr 24 11:19:41 2008 +0900
@@ -509,14 +509,36 @@ int monitor_tbufs(void)
     {
         for ( i = 0; (i < num) && !interrupted; i++ )
         {
-            while ( meta[i]->cons != meta[i]->prod )
+            unsigned long start_offset, end_offset, cons, prod;
+
+            cons = meta[i]->cons;
+            prod = meta[i]->prod;
+            xen_rmb(); /* read prod, then read item. */
+
+            if ( cons == prod )
+                continue;
+
+            start_offset = cons % data_size;
+            end_offset = prod % data_size;
+
+            if ( start_offset >= end_offset )
             {
-                xen_rmb(); /* read prod, then read item. */
+                while ( start_offset != data_size )
+                {
+                    rec_size = process_record(
+                        i, (struct t_rec *)(data[i] + start_offset));
+                    start_offset += rec_size;
+                }
+                start_offset = 0;
+            }
+            while ( start_offset != end_offset )
+            {
                 rec_size = process_record(
-                    i, (struct t_rec *)(data[i] + meta[i]->cons % data_size));
-                xen_mb(); /* read item, then update cons. */
-                meta[i]->cons += rec_size;
+                    i, (struct t_rec *)(data[i] + start_offset));
+                start_offset += rec_size;
             }
+            xen_mb(); /* read item, then update cons. */
+            meta[i]->cons = prod;
         }
 
 	wait_for_event();

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

                 reply	other threads:[~2008-04-24  4:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=48100EB2.3030606@jp.fujitsu.com \
    --to=nisiguti@jp.fujitsu.com \
    --cc=xen-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.