From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9065 invoked by alias); 11 Jul 2008 10:10:48 -0000 Received: (qmail 9057 invoked by uid 22791); 11 Jul 2008 10:10:48 -0000 X-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_54,SPF_PASS X-Spam-Check-By: sourceware.org Received: from ti-out-0910.google.com (HELO ti-out-0910.google.com) (209.85.142.190) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 11 Jul 2008 10:10:28 +0000 Received: by ti-out-0910.google.com with SMTP id y6so1766600tia.18 for ; Fri, 11 Jul 2008 03:10:27 -0700 (PDT) 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=uRHpw7ma75wmXabXF1kssDkdBie/2gMrEyBsa+Ba1qo=; b=ipxNiie912RSGwIPpljOPs/QGH+aMnqLbu/zq8t2969AUMGh8yKvbSVaRqvD/iurwD lSiIq6/x0WsnvTxGom2IbEv8uAXlMlLM10ehch8wFxuyCR9c/7EWIinTNE/mpVXdxHSM THkhLObZVQiziG3Ms83/G+p/jb7xqTnkyXH5g= 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=KH80SmpW1cOZpgorQZ1PKmFfDvqkj583z+7MK+lnwtCauofnIOaxOaRd/ypNmznYPc YUk06tosmCmW73jqkOdlTdbQ55FXQktcXDdgESvlXyK+6pK/IxbGSldNASsekBCJheXe bi3aoHYN4eSCf3a2uXgAwGzrGoPYgSSpb6yEs= Received: by 10.110.5.18 with SMTP id 18mr5886017tie.43.1215771027130; Fri, 11 Jul 2008 03:10:27 -0700 (PDT) Received: from ?9.124.35.39? ( [59.145.136.1]) by mx.google.com with ESMTPS id 14sm761892tim.16.2008.07.11.03.10.23 (version=SSLv3 cipher=RC4-MD5); Fri, 11 Jul 2008 03:10:25 -0700 (PDT) Message-ID: <48773155.7040107@gmail.com> Date: Fri, 11 Jul 2008 10:10:00 -0000 From: Anup C Shan User-Agent: Thunderbird 2.0.0.14 (X11/20080505) MIME-Version: 1.0 To: systemtap@sources.redhat.com CC: kghoshnitk@gmail.com, akinobu.mita@gmail.com, k-tanaka@ce.jp.nec.com Subject: [RFC 4/5] Page allocation fault injection script References: <48773047.1050906@gmail.com> <487730B4.5070106@gmail.com> <48773122.3020800@gmail.com> In-Reply-To: <48773122.3020800@gmail.com> Content-Type: multipart/mixed; boundary="------------050604000301000209000500" X-Virus-Checked: Checked by ClamAV on sourceware.org Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2008-q3/txt/msg00142.txt.bz2 This is a multi-part message in MIME format. --------------050604000301000209000500 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1 --------------050604000301000209000500 Content-Type: text/plain; name="alloc_page-faultinject.stp" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="alloc_page-faultinject.stp" Content-length: 2063 #!/usr/local/bin/stap /* * This script is used to fail __alloc_pages() function in mm/page_alloc.c */ probe begin(0) { fij_load_param(20000,0,100,0,0,1,1000); fij_add_option("min_order",0,"Minimum order(base 2) of the allocation") fij_add_gfp_wait_param() fij_add_gfp_highmem_param() } global min_order probe begin(2000) { min_order = fij_params["min_order"] } function should_fail_alloc(order:long,flags:long) { if (order < min_order) { fij_logger(100,sprintf("Skipping on order %d",order)) return 0 } else fij_logger(100,sprintf("Continuing on order %d",order)) if (fij_should_fail_gfp_wait(flags) == 0) return 0 if (fij_should_fail_gfp_highmem(flags) == 0) return 0 if (fij_should_fail() == 0) return 0 return 1 } global zones_save,under_fail /* * zones_save : Temporary variable to save zone information that will be * assigned fake value to induce fault. * under_fail : Flag to denote whether system is under fault injected condition. * Both these variables are 'per-cpu' variables to prevent race conditions. */ function nullify(zptr:long,cpu:long) %{ struct zones **z = (struct zones **)(THIS->zptr); THIS->__retvalue = (long)*z; *z = NULL; %} /* * Method of fault injection : * The function __alloc_pages() is failed by using an if condition on * variable z (=zonelist->zones). * To fail, the value of *(zonelist->zones) is saved in zones_save and * set to NULL to cause the function to return NULL value. * Once the fault is injected, the value of zonelist->zones is restored. */ probe kernel.function("__alloc_pages@mm/page_alloc.c") { if (should_fail_alloc($order,$gfp_mask) == 0) next zones_save[cpu()] = nullify($zonelist->zones,cpu()) under_fail[cpu()] = 1 fij_done_fail() } function restore(zones:long,zones_save:long) %{ struct zones **z = (struct zones **)(THIS->zones); *z = (struct zones *)THIS->zones_save; %} probe kernel.function("__alloc_pages@mm/page_alloc.c").return { if (under_fail[cpu()]) { restore($zonelist->zones,zones_save[cpu()]) under_fail[cpu()] = 0 } } --------------050604000301000209000500--