Stephane:
I have a fundamental design issue with requiring a write to a read only
register to allow you to then read the register. The approach does work
on Power so that is not a problem. First of all it is very counter
intuitive that you should have to write to a read only register so you
can then read from it. Secondly, the fact of the matter is you actually
don't care about the write operation at all. You really just want is
the side effect, i.e. registering the PMD. It seems like there should
be a more natural way to do that. The write function ends up adding the
read only PMD to the PMDs to be reset and accumulated. Note sure of the
value of adding the read only PMD to the list of PMDs to be reset.
The first thought is to have an explicit call to register the read only
pmd. It would not be necessary to register it as a pmd to be restored.
You may want it as an accumulated value on. For Power, it is a 64 bit
reg already so it will never overflow and need accumulating. But that
may not be the case for all architectures. Obviously, that means yet
another system call.
The second option is to register reads to read only pmds when the PMD is
read. Consider the time base register (TBR). Currently, you must write
the TBR, the write is ignored so nothing happens to the TBR. Then read
the TBR to get the initial value. Run the app and then read the TBR
again. If we were to register the TBR on the initial read, we could
eliminate the write which doesn't make sense anyway. In the end, the
user would just do the initial read and the final read and subtract them
to get the elapsed time. To me this make more sense. Additionally,
only the bit masks that are really needed would have their bits set,
i.e. used_pmds, accumulated pmds. You would not include it in the
restore pmd mask.
I will take a look at creating a patch for this approach.
Unfortunately, I did not get to do it today. I would appreciate any
thoughts you might have on this suggestion. Thanks.
Carl Love
On Mon, 2007-04-30 at 01:56 -0700, Stephane Eranian wrote:
> On Fri, Apr 27, 2007 at 04:02:09PM -0700, Carl Love wrote:
> > 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.
>
> The way it is currently setup is that writes to read-only PMD registers
> are ignored. No error is generated, yet the register is marked as used.
> See include/linux/perfmon.h:pfm_write_pmd().
>
> Do you have a problem with this approach in your setup?
> _______________________________________________
> perfmon mailing list
> [email protected]
> http://www.hpl.hp.com/hosted/linux/mail-archives/perfmon/
_______________________________________________
perfmon mailing list
[email protected]
http://www.hpl.hp.com/hosted/linux/mail-archives/perfmon/