Removing clean call

51 views
Skip to first unread message

Burak ŞAHİN

unread,
Jun 23, 2021, 9:08:20 AM6/23/21
to DynamoRIO Users
Hello,

I am using dr_insert_clean_call to collect bb trace. However, for certain apps it causes too much slow down due to some loops. Even I skipp logging for BB having too much iterations, it is still slow (probably context switching overhead). I want to remove some of the clean calls inserted for BBs having too much loop data. Is there a way to cancel/remove some of the clean calls from the clean call itself? Or, is there any way to cancel/remove some clean calls?

Thanks.

John Galea

unread,
Jun 23, 2021, 10:07:36 AM6/23/21
to dynamor...@googlegroups.com
There are a couple of things you can do to remove clean calls:

First, try to code the function of the clean call as simple as possible. This means that the function is short, and contains no conditional statements or sub-function calls. By having the function simple, DynamoRIO would be in a better place to do inlining, effectively removing the clean call automatically. You can inspect DR debug logs to check whether inlining is successful.

Another option is to manually code and inline your function by inserting raw meta instructions. This option requires you to do more work/research but you get more control in exchange.

Fortunately, DynamoRIO’s sample programs includes an inline tracer that mitigates the use of clean calls. Check out https://github.com/DynamoRIO/dynamorio/blob/master/api/samples/memtrace_x86.c

Cheers,
John  

--
You received this message because you are subscribed to the Google Groups "DynamoRIO Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dynamorio-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dynamorio-users/ded6831a-12c5-4743-9fb4-f6698f1d48b2n%40googlegroups.com.

Burak ŞAHİN

unread,
Jun 23, 2021, 12:35:53 PM6/23/21
to DynamoRIO Users
Unfortunately, the clean calls are not that simple.
I am aware of inlining, but as you said it requires more time and development.

Instead, I want to do the following steps:
* Currently, I am inserting clean call before each basic block. 
* However, after some statistics of execution, I want to disable/remove clean calls for some of the basic blocks.

Is it even possible to do in DynamoRIO? 





23 Haziran 2021 Çarşamba tarihinde saat 17:07:36 UTC+3 itibarıyla John Galea şunları yazdı:

John Galea

unread,
Jun 23, 2021, 6:00:54 PM6/23/21
to dynamor...@googlegroups.com
DynamoRIO offers a basic block flushing interface to enable adaptive optimisation. Check out the cbr sample (https://github.com/DynamoRIO/dynamorio/blob/master/api/samples/cbr.c) as an example.

Cheers,
John

Derek Bruening

unread,
Jun 23, 2021, 8:01:08 PM6/23/21
to dynamor...@googlegroups.com
There are other ways to vary instrumentation as well: you could emit both versions and swap between them with a flag.  The drbbdup library provides support to make this easier.

Burak ŞAHİN

unread,
Jun 26, 2021, 4:56:02 PM6/26/21
to DynamoRIO Users
thanks for the help. 

24 Haziran 2021 Perşembe tarihinde saat 03:01:08 UTC+3 itibarıyla Derek Bruening şunları yazdı:
Reply all
Reply to author
Forward
0 new messages