Repost, the first posting had an error in the number of parenthesis.

This patch fixes access to read only pmd registers, such as the time base
register.  Currently the routine _pfm_read_pmd() exits on an error if the
pmd has not been writen to.  Writing to a read only pmd is not valid.
This patch allows execution to continue if the pmd is read only.  After
this test is made, _pfm_read_pmd() makes a call to pfm_read_pmd()
which calls the optional architecture sread function to access the read 
only pmd register.  


Signed-off-by: Carl Love <[EMAIL PROTECTED]>

Index: linux-2.6.20/perfmon/perfmon_rw.c
===================================================================
--- linux-2.6.20.orig/perfmon/perfmon_rw.c      2007-04-27 17:09:47.000000000 
-0500
+++ linux-2.6.20/perfmon/perfmon_rw.c   2007-04-27 17:23:38.000000000 -0500
@@ -561,8 +561,14 @@
                 *        use (except when regs directly readable at user level,
                 *        e.g., IA-64 self-monitoring, I386 RDTSC).
                 *      - do not need to maintain PMC -> PMD dependencies
+                *
+                * Exception, allow reads to unrequested pmd if register
+                * is read only.  
                 */
-               if (unlikely(!test_bit(cnum, ulp(set->used_pmds)))) {
+
+               if (unlikely(!test_bit(cnum, ulp(set->used_pmds))
+                   && !(pfm_pmu_conf->pmd_desc[cnum].type
+                        & PFM_REG_V))) {
                        PFM_DBG("pmd%u cannot be read, because never "
                                "requested", cnum);
                        goto error;


_______________________________________________
perfmon mailing list
[email protected]
http://www.hpl.hp.com/hosted/linux/mail-archives/perfmon/

Reply via email to