Linux-2.6.12-rc2
[safe/jmp/linux-2.6] / Documentation / powerpc / ppc_htab.txt
1                  Information about /proc/ppc_htab
2 =====================================================================
3
4 This document and the related code was written by me (Cort Dougan), please
5 email me (cort@fsmlabs.com) if you have questions, comments or corrections.
6
7 Last Change: 2.16.98
8
9 This entry in the proc directory is readable by all users but only
10 writable by root.
11
12 The ppc_htab interface is a user level way of accessing the
13 performance monitoring registers as well as providing information
14 about the PTE hash table.
15
16 1. Reading
17
18   Reading this file will give you information about the memory management
19   hash table that serves as an extended tlb for page translation on the
20   powerpc.  It will also give you information about performance measurement
21   specific to the cpu that you are using.
22
23   Explanation of the 604 Performance Monitoring Fields:
24     MMCR0 - the current value of the MMCR0 register
25     PMC1
26     PMC2 - the value of the performance counters and a
27            description of what events they are counting
28            which are based on MMCR0 bit settings.
29   Explanation of the PTE Hash Table fields:
30
31     Size - hash table size in Kb.
32     Buckets -  number of buckets in the table.
33     Address - the virtual kernel address of the hash table base.
34     Entries - the number of ptes that can be stored in the hash table.
35     User/Kernel - how many pte's are in use by the kernel or user at that time.
36     Overflows - How many of the entries are in their secondary hash location.
37     Percent full - ratio of free pte entries to in use entries.
38     Reloads - Count of how many hash table misses have occurred
39               that were fixed with a reload from the linux tables.
40               Should always be 0 on 603 based machines.
41     Non-error Misses - Count of how many hash table misses have occurred
42               that were completed with the creation of a pte in the linux
43               tables with a call to do_page_fault().
44     Error Misses - Number of misses due to errors such as bad address
45               and permission violations.  This includes kernel access of
46               bad user addresses that are fixed up by the trap handler.
47
48   Note that calculation of the data displayed from /proc/ppc_htab takes
49   a long time and spends a great deal of time in the kernel.  It would
50   be quite hard on performance to read this file constantly.  In time
51   there may be a counter in the kernel that allows successive reads from
52   this file only after a given amount of time has passed to reduce the
53   possibility of a user slowing the system by reading this file.
54
55 2. Writing
56
57   Writing to the ppc_htab allows you to change the characteristics of
58   the powerpc PTE hash table and setup performance monitoring.
59
60   Resizing the PTE hash table is not enabled right now due to many
61   complications with moving the hash table, rehashing the entries
62   and many many SMP issues that would have to be dealt with.
63
64   Write options to ppc_htab:
65   
66    - To set the size of the hash table to 64Kb:
67
68       echo 'size 64' > /proc/ppc_htab
69
70      The size must be a multiple of 64 and must be greater than or equal to
71      64.
72
73    - To turn off performance monitoring:
74
75       echo 'off' > /proc/ppc_htab
76
77    - To reset the counters without changing what they're counting:
78
79       echo 'reset' > /proc/ppc_htab
80
81      Note that counting will continue after the reset if it is enabled.
82
83    - To count only events in user mode or only in kernel mode:
84
85       echo 'user' > /proc/ppc_htab
86        ...or...
87       echo 'kernel' > /proc/ppc_htab
88
89      Note that these two options are exclusive of one another and the
90      lack of either of these options counts user and kernel.
91      Using 'reset' and 'off' reset these flags.
92
93    - The 604 has 2 performance counters which can each count events from
94      a specific set of events.  These sets are disjoint so it is not
95      possible to count _any_ combination of 2 events.  One event can
96      be counted by PMC1 and one by PMC2.
97
98      To start counting a particular event use:
99
100       echo 'event' > /proc/ppc_htab
101
102      and choose from these events:
103
104      PMC1
105      ----
106       'ic miss' - instruction cache misses
107       'dtlb' - data tlb misses (not hash table misses)
108
109      PMC2
110      ----
111       'dc miss' - data cache misses
112       'itlb' - instruction tlb misses (not hash table misses)
113       'load miss time' - cycles to complete a load miss
114
115 3. Bugs
116
117   The PMC1 and PMC2 counters can overflow and give no indication of that
118   in /proc/ppc_htab.