|
From: Martin H. <hi...@gm...> - 2005-11-10 16:01:30
|
I'm trying to run a JIT that uses CLFLUSH after code patching to invalidate the cache line, so the I-cache will reload the new version before it gets executed again. When running on valgrind, I get the error message "vex x86->IR: unhandled instruction bytes: 0xF 0xAE 0xB8 0x0", which is the encoding for CLFLUSH. I found the commented-out code in guest-x86/toIR.c that corresponds to CLFLUSH. Being commented out, I was not surprised that that code is out-of-date. Can someone tell me how to change toIR.c so it just treats CLFLUSH as a NOO= P? Or better yet, how to actually do it right? (I assume I would need to emit a client request for invalidating the code in valgrind's code cache; how would I do this?) Thanks, Martin |
|
From: Julian S. <js...@ac...> - 2005-11-15 11:18:47
|
> I'm trying to run a JIT that uses CLFLUSH after code patching to I just implemented it. svn up (you should get vex r1460, valgrind r5132), make distclean and rebuild everything from scratch (there have been several other changes too). Let us know if it works / does not work. J |
|
From: Martin H. <hi...@gm...> - 2005-12-30 16:20:10
|
On 11/15/05, Julian Seward <js...@ac...> wrote: > > > I'm trying to run a JIT that uses CLFLUSH after code patching to > > I just implemented it. svn up (you should get vex r1460, valgrind r5132)= , > make distclean and rebuild everything from scratch (there have been sever= al > other changes too). Let us know if it works / does not work. > > J Thank you so much for implementing this! Sorry it took me so long to get around to trying it. It looks like it hangs: I am running a hello world program on top of my JIT, which in turn runs on top of nulgrind. Usually, this terminates in around 1 second, but with nulgrind, it is still running after 10m. When I kill it (SIGINT), valgrind tells me it was currently in the JIT function with the CLFLUSH. Do you think your implementation of CLFLUSH in valgrind can hang for any reason? I am at a loss for what else could cause this behavior. Greetings, Martin |
|
From: Martin H. <hi...@gm...> - 2005-12-30 21:05:17
|
I tried it with --smc-check=3Dall, now it works (doesn't crash or hang and produces reasonable-looking output). Not sure why it previously hung in the function with clflush, of all things, but as long as it works now, I'm happy. Thank you, Martin On 12/30/05, Martin Hirzel <hi...@gm...> wrote: > I didn't try with --smc-check=3Dall yet; I will do that. > > Thanks for re-looking at the clflush implementation. > > Thanks a lot for offering to look at this problem for me! > Unfortunately, I can't give you the JIT code or an ssh. Therefore, I > will try if I can isolate the problem. I'll try > --trace-flags=3D10000000; maybe, that sheds some more light. > > Martin > > On 12/30/05, Julian Seward <js...@ac...> wrote: > > > > Did you try with --smc-check=3Dall? That should take care of all > > self-modifying-code problems, even if the clflush implementation > > is broken. > > > > I just re-looked at the clflush implementation and there isn't > > anything _obviously_ wrong with it. (That doesn't mean it's right :-) > > > > I'm happy to look at it (I want clflush to work properly) but that > > means I need to be able to reproduce it. At this stage you probably ha= ve > > two options: either package up the sources of your jit so I can build > > it and reproduce the problem, or make an account on your system that > > I can ssh to, set up a test framework, and I'll have a look. This > > second option is something I've done many times before. > > > > As a zeroth option, first do this: run your system with --tool=3Dnone > > --trace-flags=3D10000000. This will generate an unbelievable amount > > of output. Capture it in a file. Find the BB in the file containing > > the 'clflush' instruction and send it to me (or, if the .bz2 of it is > > less than say 500k, just compress and send the whole thing). Since > > the system hangs when running on V, you'll need to control-C, but > > that shouldn't be a problem. > > > > J > > > > > > On Friday 30 December 2005 16:19, you wrote: > > > On 11/15/05, Julian Seward <js...@ac...> wrote: > > > > > I'm trying to run a JIT that uses CLFLUSH after code patching to > > > > > > > > I just implemented it. svn up (you should get vex r1460, valgrind > > > > r5132), make distclean and rebuild everything from scratch (there h= ave > > > > been several other changes too). Let us know if it works / does no= t > > > > work. > > > > > > > > J > > > > > > Thank you so much for implementing this! Sorry it took me so long to > > > get around to trying it. It looks like it hangs: I am running a hello > > > world program on top of my JIT, which in turn runs on top of nulgrind= . > > > Usually, this terminates in around 1 second, but with nulgrind, it is > > > still running after 10m. When I kill it (SIGINT), valgrind tells me i= t > > > was currently in the JIT function with the CLFLUSH. > > > > > > Do you think your implementation of CLFLUSH in valgrind can hang for > > > any reason? I am at a loss for what else could cause this behavior. > > > > > > Greetings, > > > Martin > > > |