Re: [POC] recoverable fault injection

From: Akinobu Mita
Date: Thu Nov 22 2012 - 13:27:13 EST


2012/11/22 Johannes Berg <johannes@xxxxxxxxxxxxxxxx>:
> This idea has been floating around in my head for a long time now ...
>
> I was thinking: what if we could do fault injection during regular
> testing, at least on those code paths that are not supposed to have side
> effects when they fail? Now obviously this isn't all code paths, and
> many probably erroneously *do* have side effects even if they're not
> supposed to, but it does apply to a number of code paths.

It sounds interesting. I have never thought of this idea.

> So I decided to play with this, and the result it the patch below. It
> adds a new knob "recoverable-only" to the slab and page_alloc fault
> attributes. If enabled, then a single fault can be injected if the task
> executing it is in a "recoverable section", this is implemented by some
> new fields in struct task_struct and the (very ugly!) macro
> FAULT_INJECT_CALL_RECOVERABLE_FUNCTION.

I suggest introducing a pair of function like:

void fault_recoverable_enable(unsigned long fault_ids);
void fault_recoverable_disable();

fault_recoverable_enable() sets current task's recoverable state to the
value specified with the argument. fault_recoverable_disable() resets
the recoverable state.

I think this can be more readable than FAULT_INJECT_CALL_RECOVERABLE_FUNCTION
macro. In case of nl80211_remain_on_channel(), you can just put
them in exit and entrance:

fault_recoverable_enable(FAULT_ATTR_SLAB | FAULT_ATTR_PAGE_ALLOC);
...
fault_recoverable_disable();

return err;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/