xfs
[Top] [All Lists]

Re: SGI XFS on ppc

To: linux-xfs@xxxxxxxxxxx
Subject: Re: SGI XFS on ppc
From: Thomas Graichen <news-innominate.list.sgi.xfs@xxxxxxxxxxxxx>
Date: 2 Aug 2000 08:30:31 GMT
Distribution: local
Organization: innominate AG, Berlin, Germany
References: <news2mail-8m8eef$82d$1@xxxxxxxxxxxxxxxxxxxxxx> <19079.965202470@xxxxxxxxxxxx>
Reply-to: Thomas Graichen <graichen@xxxxxxxxxxxxx>
Reply-to: thomas.graichen@xxxxxxxxxxxxx
Sender: owner-linux-xfs-announce@xxxxxxxxxxx
User-agent: tin/1.4.2-20000205 ("Possession") (UNIX) (Linux/2.2.16-local (i586))
Keith Owens <kaos@xxxxxxxxxxxxxxxxx> wrote:
> On 2 Aug 2000 06:17:51 GMT, 
> Thomas Graichen <news-innominate.list.sgi.xfs@xxxxxxxxxxxxx> wrote:
>>Steve Lord <lord@xxxxxxx> wrote:
>>>                 kdb_symbol_print((unsigned int)trace->ra, NULL,
>>>                         KDB_SP_SPACEB|KDB_SP_PAREN|KDB_SP_NEWLINE);
>>ok - basicaly got the idea - what of the above info is mostly needed
>>to debug this ? (i at a first view see no way to get the
>>kdb_symbol_print thing because it looks like it uses kdb structures
>>for finding and printing the symbol) - everything else should be
>>no problem ... ok - will try to get this going

> Replace
>   kdb_symbol_print(address, NULL, flags);
> with
>   printk(" 0x%x\n", address);
> KDB_SP_SPACEB is space before number, KDB_SP_PAREN is address converted
> to symbol enclosed in () which you cannot do, KDB_SP_NEWLINE is newline
> after.

ok will try this too - here is how far i am so far (trying to get it
going on x86 first because right now i have no ppc close - will try
that this evening) - please have a short look at it - something is
wrong with the event thing (int in pb_trace_func but called as char)
- maybe i completely srewed it up - then please don't shoot me :-)

ok - here's a diff so far to get page_buf tracing without kdb and after
the diff is a sample output - any hints whats wrong here (the event
stuff is wrong)? - otherwise i'll look closer to it later ... looks
like i have mixed up the events between the kdb and the pb_trace_func
part a bit ...

Index: fs/pagebuf/page_buf.c
===================================================================
RCS file: /cvs/linux-2.4-xfs/linux/fs/pagebuf/page_buf.c,v
retrieving revision 1.16
diff -u -r1.16 page_buf.c
--- fs/pagebuf/page_buf.c       2000/07/31 16:16:28     1.16
+++ fs/pagebuf/page_buf.c       2000/08/02 08:18:32
@@ -62,6 +62,7 @@
 #include <linux/spinlock.h>
 #include <linux/avl.h>
 #include <linux/page_buf.h>
+#include <linux/page_buf_trace.h>
 #include <linux/fs.h>
 #include <linux/smp_lock.h>
 #include <linux/errno.h>
@@ -90,7 +91,7 @@
 MODULE_DESCRIPTION("page_buf file system buffer module");
 #ifdef PAGEBUF_TRACE
 #define STATIC
-int debug_pagebuf = 0;
+int debug_pagebuf = 1;
 static spinlock_t              pb_trace_lock = SPIN_LOCK_UNLOCKED;
 struct pagebuf_trace_buf       pb_trace;
 EXPORT_SYMBOL(pb_trace);
@@ -98,6 +99,7 @@
 EXPORT_SYMBOL(pb_trace_func);
 #define CIRC_INC(i)     (((i) + 1) & (PB_TRACE_BUFSIZE - 1))
 
+#ifdef CONFIG_KDB
 void   pb_trace_func(page_buf_t *pb, int event, void *misc, void *ra)
 {
        int     j;
@@ -123,6 +125,86 @@
        pb_trace.buf[j].offset = pb->pb_file_offset;
        pb_trace.buf[j].size = pb->pb_buffer_length;
 }
+#else
+#define EV_SIZE (sizeof(event_names)/sizeof(char *))
+
+static char     *map_flags(unsigned long flags, char *mapping[])
+{
+        static  char    buffer[256];
+        int     index;
+        int     offset = 12;
+
+        buffer[0] = '\0';
+
+        for (index = 0; flags && mapping[index]; flags >>= 1, index++) { 
+                if (flags & 1) {
+                        if ((offset + strlen(mapping[index]) + 1) >= 80) {
+                                strcat(buffer, "\n            ");
+                                offset = 12;
+                        } else if (offset > 12) {
+                                strcat(buffer, " ");
+                                offset++;
+                        }
+                        strcat(buffer, mapping[index]);
+                        offset += strlen(mapping[index]);
+                }
+        }
+
+        return (buffer);
+}
+
+static char     *pb_flag_vals[] = {
+        "READ", "WRITE", "MAPPED", "PARTIAL",
+        "ASYNC", "NONE", "DELWRI", "FREED", "SYNC",
+        "LONG_TERM", "FS_RESERVED_1", "FS_RESERVED_2", "RELEASE",
+        "LOCK", "TRYLOCK", "ALLOCATE", "FILE_ALLOCATE", "DONT_BLOCK",
+        "DIRECT", "LOCKABLE", "NEXT_KEY", "ENTER_PAGES",
+        "ALL_PAGES_MAPPED", "SOME_INVALID_PAGES", "ADDR_ALLOCATED",
+        "MEM_ALLOCATED", "GRIO", "FORECIO",
+        NULL };
+
+static char     *pb_flags(page_buf_flags_t pb_flag)
+{
+        return(map_flags((unsigned long) pb_flag, pb_flag_vals));
+}
+
+void   pb_trace_func(page_buf_t *pb, int event, void *misc, void *ra)
+{
+       int     j;
+       unsigned long flags;
+       char    *event_name;
+       char    value[10];
+
+       if (!debug_pagebuf) return;
+
+       if (ra == NULL) ra = (void *)__builtin_return_address(0);
+
+       spin_lock_irqsave(&pb_trace_lock, flags);
+       j = pb_trace.start;
+       pb_trace.start = CIRC_INC(j);
+       spin_unlock_irqrestore(&pb_trace_lock, flags);
+
+       if ((event < EV_SIZE) && event_names[event]) {
+               event_name = event_names[event];
+       } else if (event == 1000) {
+               event_name = (char *) misc;
+       } else {
+               event_name = value;
+               sprintf(value, "%8d", event);
+       }
+
+       printk("pb 0x%lx [%s] (hold %u lock %d) misc 0x%p\n",
+                  (unsigned long) pb, event_name,
+                  pb->pb_hold, PBP(pb)->pb_sema.count.counter,
+                  misc);
+/*     kdb_symbol_print((unsigned int) trace->ra, NULL,
+               KDB_SP_SPACEB|KDB_SP_PAREN|KDB_SP_NEWLINE); */
+       printk("    offset 0x%Lx size 0x%x task 0x%p\n",
+                  pb->pb_file_offset, pb->pb_buffer_length, (void *) current);
+       printk("    flags: %s\n",
+                  pb_flags(pb->pb_flags));
+}
+#endif
 #define ENTER(x) printk("Entering " #x "\n");
 #define EXIT(x)  printk("Exiting  " #x "\n");
 #else
Index: include/linux/page_buf.h
===================================================================
RCS file: /cvs/linux-2.4-xfs/linux/include/linux/page_buf.h,v
retrieving revision 1.54
diff -u -r1.54 page_buf.h
--- include/linux/page_buf.h    2000/07/24 21:32:09     1.54
+++ include/linux/page_buf.h    2000/08/02 08:18:33
@@ -39,13 +39,7 @@
 #ifndef _LINUX_PAGE_BUF_H
 #define _LINUX_PAGE_BUF_H
 
-/* Tracing only makes sense when you have kdb support - there is no
- * other way to read the trace.
- */
-#ifdef CONFIG_KDB
 #define PAGEBUF_TRACE 1
-#endif
-
 
 #ifdef __KERNEL__
 #include <linux/config.h>


ok and here a sample mount output:

Aug  2 10:05:50 qed kernel: page_buf module - Copyright (C) by Silicon Graphics 
Inc. 2000 
Aug  2 10:06:02 qed kernel: pb 0xc3c56ee0 [-926718357] (hold 1 lock 0) misc 
0xc15f0e20 
Aug  2 10:06:02 qed kernel:     offset 0x0 size 0x200 task 0xc19d8000 
Aug  2 10:06:02 qed kernel:     flags: NONE LOCKABLE FORECIO 
Aug  2 10:06:02 qed kernel: pb 0xc3c56ee0 [-926718400] (hold 1 lock 0) misc 
0xc4b79c00 
Aug  2 10:06:02 qed kernel:     offset 0x0 size 0x200 task 0xc19d8000 
Aug  2 10:06:02 qed kernel:     flags: MAPPED NONE LOCKABLE MEM_ALLOCATED 
FORECIO 
Aug  2 10:06:02 qed kernel: pb 0xc3c56ee0 [-926718450] (hold 1 lock 0) misc 
0x00000000 
Aug  2 10:06:02 qed kernel:     offset 0x0 size 0x200 task 0xc19d8000 
Aug  2 10:06:02 qed kernel:     flags: READ MAPPED NONE LOCKABLE MEM_ALLOCATED 
FORECIO 
Aug  2 10:06:02 qed kernel: pb 0xc3c56ee0 [-926718405] (hold 2 lock 0) misc 
0x00000000 
Aug  2 10:06:02 qed kernel:     offset 0x0 size 0x200 task 0xc19d8000 
Aug  2 10:06:02 qed kernel:     flags: READ MAPPED NONE LOCKABLE MEM_ALLOCATED 
FORECIO 
Aug  2 10:06:02 qed kernel: pb 0xc3c56ee0 [-926718410] (hold 2 lock 0) misc 
0xc8c968ac 
Aug  2 10:06:05 qed kernel:     offset 0x0 size 0x200 task 0xc19d8000 
Aug  2 10:06:06 qed kernel:     flags: READ MAPPED NONE LOCKABLE MEM_ALLOCATED 
FORECIO 
Aug  2 10:06:07 qed kernel: pb 0xc3c56ee0 [-926718457] (hold 1 lock 0) misc 
0x00000000 
Aug  2 10:06:07 qed kernel:     offset 0x0 size 0x200 task 0xc19d8000 
Aug  2 10:06:07 qed kernel:     flags: READ MAPPED NONE LOCKABLE MEM_ALLOCATED 
FORECIO 
Aug  2 10:06:08 qed kernel: pb 0xc3c56ee0 [-926718415] (hold 1 lock 0) misc 
0x00000000 
Aug  2 10:06:08 qed kernel:     offset 0x0 size 0x200 task 0xc02cc000 
Aug  2 10:06:08 qed kernel:     flags: MAPPED LOCKABLE MEM_ALLOCATED FORECIO 
Aug  2 10:06:08 qed kernel: pb 0xc3c56ee0 [-926718466] (hold 1 lock 0) misc 
0x00000000 
Aug  2 10:06:08 qed kernel:     offset 0x0 size 0x200 task 0xc19d8000 
Aug  2 10:06:08 qed kernel:     flags: MAPPED LOCKABLE MEM_ALLOCATED FORECIO 
Aug  2 10:06:08 qed kernel: pb 0xc3c56ee0 [-926718410] (hold 1 lock 0) misc 
0xc8c968ac 
Aug  2 10:06:08 qed kernel:     offset 0x0 size 0x200 task 0xc19d8000 
Aug  2 10:06:08 qed kernel:     flags: MAPPED LOCKABLE MEM_ALLOCATED FORECIO 
Aug  2 10:06:08 qed kernel: pb 0xc3c56ee0 [unlock] (hold 1 lock 1) misc 
0x00000000 
Aug  2 10:06:08 qed kernel:     offset 0x0 size 0x200 task 0xc19d8000 
Aug  2 10:06:08 qed kernel:     flags: MAPPED LOCKABLE MEM_ALLOCATED FORECIO 
Aug  2 10:06:08 qed kernel: pb 0xc3c56e40 [-926718357] (hold 1 lock 0) misc 
0xc15f0e20 
...

have to go to a meeting now - any hint aprreciated

thanks in advance

t

-- 
thomas.graichen@xxxxxxxxxxxxx
technical director                                       innominate AG
clustering & security                                networking people
tel: +49.30.308806-13 fax: -77 web: http://innominate.de pgp: /pgp/tgr

<Prev in Thread] Current Thread [Next in Thread>