Re: [PATCH] RAS/CEC: Add debugfs switch to disable at run time

Borislav Petkov
2019-04-20T19:51:08Z

On Thu, Apr 18, 2019 at 03:02:29PM -0700, Tony Luck wrote:
> Useful when running error injection tests that want to
> see all of the MCi_(STATUS|ADDR|MISC) data via /dev/mcelog.
>
> Signed-off-by: Tony Luck <tony.luck@intel.com>
> ---
> drivers/ras/cec.c | 20 +++++++++++++++++++-
> 1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c
> index 2d9ec378a8bc..a2ceedcd8516 100644
> --- a/drivers/ras/cec.c
> +++ b/drivers/ras/cec.c
> @@ -123,6 +123,9 @@ static u64 dfs_pfn;
> /* Amount of errors after which we offline */
> static unsigned int count_threshold = COUNT_MASK;
>
> +/* debugfs switch to enable/disable CEC */
> +static u64 cec_enabled = 1;
> +
> /*
> * The timer "decays" element count each timer_interval which is 24hrs by
> * default.
> @@ -400,6 +403,14 @@ static int count_threshold_set(void *data, u64 val)
> }
> DEFINE_DEBUGFS_ATTRIBUTE(count_threshold_ops, u64_get, count_threshold_set, "%lld\n");
>
> +static int enable_set(void *data, u64 val)
> +{
> + ce_arr.disabled = !val;

Btw, regardless of what we end up doing wrt hiding this switch under
RAS_CEC_DEBUG or exposing it, that ce_arr.disabled flag is not
needed anymore and you can remove it along with the flags union in
ce_array with the next version of this. Because one of the cec_enabled
or ce_arr.disabled is now redundant and I think you want to have
cec_enabled. :)

Thx.

--
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.