lkml.org 
[lkml]   [2013]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] tracing: Add $cpu and $current probe-vars
(2013/11/27 2:23), Oleg Nesterov wrote:
> On 11/26, Masami Hiramatsu wrote:
>>
>> (2013/11/26 4:29), Oleg Nesterov wrote:
>>> +#define PSEUDO_REG_OFFSET 4096 /* arbitrary value > MAX_REG_OFFSET */
>>> +
>>> +static unsigned long probe_get_register(struct pt_regs *regs, unsigned long offset)
>>> +{
>>> + if (offset < PSEUDO_REG_OFFSET)
>>> + return regs_get_register(regs, offset);
>>> +
>>> + return pseudo_reg_table[offset - PSEUDO_REG_OFFSET].fetch();
>>> +}
>>
>>
>> Hmm, I don't like this, since fetch_reg is the most frequently
>> used fetch method, and it actually uses the offset in different
>> way.
>
> Sure, this overloads the usage of FETCH_MTD_reg/offset.
>
> And btw, yes, the naming is ugly (I mean pseudo_*). But why this
> is bad? This is cheap and simple.

I think it's not simple. The code looks short, but not well
self-described. It is "hidden" in the structure, and double-meaning.

> And,
>
>> Why don't you make another fetch function for vars?
>
> This is what I tried to avoid ;) I do not want to add another
> FETCH_MTD_. To me, this looks like unnecessary complication and
> bloat (but see below).

I see, perhaps, it is a time to introduce independent fetch
method implementation. Current one is not sophisticated
nor generic. We need a kind of "bytecode" implementation
for more complex expression, especially for the combination
of several registers/variables on stacks. This feature will
also be useful for some other scriptable tracers like ktap,
systemtap etc.

Thank you,

--
Masami HIRAMATSU
IT Management Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com




\
 
 \ /
  Last update: 2013-11-27 09:41    [W:0.088 / U:0.768 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site