This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[RFC 3/5] Slab allocation fault injection script
- From: Anup C Shan <anupcshan at gmail dot com>
- To: systemtap at sources dot redhat dot com
- Cc: kghoshnitk at gmail dot com, akinobu dot mita at gmail dot com, k-tanaka at ce dot jp dot nec dot com
- Date: Fri, 11 Jul 2008 15:38:34 +0530
- Subject: [RFC 3/5] Slab allocation fault injection script
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type; bh=m8rdORDkL+vb2fAvgktGti8d5iXpX4PeShT7p6/khcw=; b=CXSym7rFDDH4ptlrgtCiojeD97dgYiK2tgKGaxdLED+/Jg/Hot+3jdiNbehHXz45/G /mpxY+b/39I/c3J16/Vavcm0lrjabLEdKIAH/Fg3embcLhbhug4TdFcF2O/MOE1blfef 4qGwgYLi3+p3HrGuc1GOVS/3vJwJT5V2ZxeV0=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type; b=PwwQW2a95wwKdWkFODrhD4D+4gj4Y0m0V1acJVNCjKX2hAoLeg1oUji9otaZZ2y8z+ q6GMwcOz58B4TK4aCpVjmHer88nSo4c9mZVlskGgka3aercpz6nfBLqvRvAev721uLXq 9lRbDFTDkS3gygzopA0kJaZhoWu9RoiVBG2/U=
- References: <48773047.1050906@gmail.com> <487730B4.5070106@gmail.com>
The following script implements fault injection for kmem_cache_alloc()
using the fault injection framework.
#!/usr/local/bin/stap
%{
#include<linux/slab.h>
#include<linux/gfp.h>
%}
probe begin
{
fij_load_param(0,0,100,0,0,1,2000)
fij_add_gfp_wait_param()
}
/*
* Free the node if it was allocated. Effectively rolling back actions of
* kmem_cache_alloc() function.
*/
function cleanup_alloc(cacheptr:long,objptr:long)
%{
void *objp = (void *)THIS->objptr;
struct kmem_cache *cachep = (struct kmem_cache *)THIS->cacheptr;
if (objp != NULL) {
kmem_cache_free(cachep,objp);
objp = NULL;
}
%}
/*
* Check additional parameter of ignore_gfp_wait
*/
function should_fail_slab:long (flags:long)
{
if (fij_should_fail_gfp_wait(flags) == 0)
return 0
return fij_should_fail()
}
/*
* Method of fault injection:
* Free the cache page created using kmem_cache_free() and send
* fake return value NULL.
*/
probe kernel.function("kmem_cache_alloc@mm/slab.c").return
{
if (should_fail_slab($flags) == 0)
next
cleanup_alloc($cachep,$return)
$return = 0
fij_done_fail()
}