Xorg input thread (2)

Tiago Vignatti vignatti at c3sl.ufpr.br
Tue Jul 17 18:15:48 PDT 2007

Continuing with this work...

Keith Packard escreveu:
> On Mon, 2007-07-09 at 03:38 -0300, Tiago Vignatti wrote:
>> How easily I could identify these functions? I think that I must dig
>> more this way and study these ELF tricks. Keith, could you please tell
>> more about it or point me something? Some docs would be good.
> It should be fairly easy to statically examine the code to determine
> which functions are related to mouse/cursor echoing. If you want an
> automatic mechanism, you might look at the -finstrument-functions
> compiler option. 

Okay. I'm using that asm inline code to get the start and the end of the 
section which is responsible for the mouse and then locking it with 
mlock(). But now I'm stucked trying to know what exactly functions and 
datas to lock.

It's very hard to 'automatically' examine all data and text code [1] 
that deals with the mouse movements using -finstrument-functions just 
like Keith said (just to have an idea, until arriving in the Dispatch() 
we have about 240000 function calls!). What remains is try to examine 
the code 'statically', which IMHO is hard. Hard because even if we 
minutely trace the code, we'll forget some global data and simple 
functions (like xfree, for instance). Well, my attempt to do this 
statically failed. So yesterday I spent some time trying to figure out a 
better way to deal with this issue.

I thought that a userspace tool that prints something when a page fault 
occurs is good enough. Google tells me that 'truss' with '-m fltpage' 
arg does exactly what we need [2, 3]. But the problem is that it doesn't 
  exists a port for Linux. Neither strace has the 'fltpage' similar 
truss's option. Then I dig a little more and found Ulrich Drepper's 
pagein tool [4]. My simple tests here demonstrates that this tool does 
not print a page that isn't hit a twice in memory (I already mailed him 
to obtain more infos about it).

So, you guys understand where we are? I really want to avoid the kernel 
traps which tells when a page fault occurs. Also, maybe someone here 
could point me mailing lists or someone to give tips about this kind of 
problem. And please, post your comments.

Thanks a lot!

[1] Just to be sure, We need to put only global data and functions 
(text) inside the separate ELF sections? So it's one section for 
functions and other one to data? We don't need to worry with local 
variables? And the dynamic allocated variables?

[2] http://www.scit.wlv.ac.uk/cgi-bin/mansec?1+truss

[3] http://blogs.sun.com/thejel/entry/locking_memory

[4] http://people.redhat.com/drepper/pagein.html

Tiago Vignatti
C3SL - Centro de Computação Científica e Software Livre

More information about the xorg mailing list