mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Akinobu Mita <akinobu.mita@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org
Subject: Re: [POC] recoverable fault injection
Date: Thu, 22 Nov 2012 14:41:08 +0100	[thread overview]
Message-ID: <1353591668.9806.42.camel@jlt4.sipsolutions.net> (raw)
In-Reply-To: <CAC5umyj07UmPtoFowqquoOBERaVa4KngJ=cOa8_AgkcJ_EksSw@mail.gmail.com> (sfid-20121122_142945_571324_3A28FF80)

On Thu, 2012-11-22 at 22:29 +0900, Akinobu Mita wrote:

> > As you can see in my macro, it's also possible for an allocation to fail
> > but the function to succeed, so the function that is called must have a
> > return value indicating success or failure. I ran into this with debug
> > objects, their allocation failed all the time but obviously the function
> > succeeded as debug objects fail gracefully if they can't allocate
> > memory.
> 
> Oh, I completely missed retrying part in your macro.
> 
> I looked into FAULT_INJECT_CALL_RECOVERABLE_FUNCTION again,
> then I realized that it is not necessary to be variadic macro.
> 
> You can define macro like wait_event() family and use it like below:
> 
>         return FAULT_INJECT_CALL_RECOVERABLE_FUNCTION(
>                 BIT(FAULT_ATTR_SLAB) | BIT(FAULT_ATTR_PAGE_ALLOC),
>                 _nl80211_remain_on_channel(skb, info));

Oh, right, good point. Maybe even pass the entire line, and the
evaluation of whether the function failed. Then we don't have to have
the assumption of it returning an int with the 0/-ERR behaviour:

int ret;

FAULT_INJECT_CALL_RECOVERABLE_FUNCTION(
	BIT(FAULT_ATTR_SLAB) | BIT(FAULT_ATTR_PAGE_ALLOC),
	ret = _nl80211_remain_on_channel(skb, info),
	ret != 0);

return ret;


Ok that's kinda ugly too ... hmm.

johannes


      reply	other threads:[~2012-11-22 20:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-21 23:44 Johannes Berg
2012-11-22 11:40 ` Akinobu Mita
2012-11-22 11:52   ` Johannes Berg
2012-11-22 13:29     ` Akinobu Mita
2012-11-22 13:41       ` Johannes Berg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1353591668.9806.42.camel@jlt4.sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=akinobu.mita@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®