[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAE-0n53O7gb9C2uPOiHjyDuAZmxMQyUL9MtLoRa-8Lr666PENw@mail.gmail.com>
Date: Wed, 15 Jun 2022 18:48:38 -0700
From: Stephen Boyd <swboyd@...omium.org>
To: Dikshita Agarwal <quic_dikshita@...cinc.com>,
linux-kernel@...r.kernel.org, linux-media@...r.kernel.org
Cc: linux-arm-msm@...r.kernel.org, stanimir.varbanov@...aro.org,
quic_vgarodia@...cinc.com
Subject: Re: [PATCH v2] venus: Add support for SSR trigger using fault injection
Quoting Dikshita Agarwal (2022-06-15 02:30:09)
> Here we introduce a new fault injection for SSR trigger.
>
> To trigger the SSR:
> echo 100 > /sys/kernel/debug/venus/fail_ssr/probability
> echo 1 > /sys/kernel/debug/venus/fail_ssr/times
>
> signed-off-by: Dikshita Agarwal <quic_dikshita@...cinc.com>
> Signed-off-by: Stanimir Varbanov <stanimir.varbanov@...aro.org>
Why is Stan's SoB here?
> diff --git a/drivers/media/platform/qcom/venus/dbgfs.c b/drivers/media/platform/qcom/venus/dbgfs.c
> index 52de47f..ec15078 100644
> --- a/drivers/media/platform/qcom/venus/dbgfs.c
> +++ b/drivers/media/platform/qcom/venus/dbgfs.c
> @@ -4,13 +4,34 @@
> */
>
> #include <linux/debugfs.h>
> +#include <linux/fault-inject.h>
>
> #include "core.h"
>
> +#ifdef CONFIG_FAULT_INJECTION
> +static DECLARE_FAULT_ATTR(venus_ssr_attr);
> +#endif
This endif isn't needed.
> +
> +#ifdef CONFIG_FAULT_INJECTION
and this ifdef isn't either. The two can be combined.
> +bool venus_fault_inject_ssr(void)
> +{
> + return should_fail(&venus_ssr_attr, 1);
> +}
> +#else
> +bool venus_fault_inject_ssr(void)
> +{
> + return false;
> +}
Put this part in the header file and make it static inline. Then the
compiler is going to inline the false to the if condition and optimize
the entire branch away unless the config is enabled. It would also be
nice to extern the venus_ssr_attr so that the should_fail() can be
directly inlined into the interrupt handler.
> +#endif
> +
> void venus_dbgfs_init(struct venus_core *core)
> {
> core->root = debugfs_create_dir("venus", NULL);
> debugfs_create_x32("fw_level", 0644, core->root, &venus_fw_debug);
> +
> +#ifdef CONFIG_FAULT_INJECTION
> + fault_create_debugfs_attr("fail_ssr", core->root, &venus_ssr_attr);
> +#endif
> }
>
> void venus_dbgfs_deinit(struct venus_core *core)
> diff --git a/drivers/media/platform/qcom/venus/dbgfs.h b/drivers/media/platform/qcom/venus/dbgfs.h
> index b7b621a..b0d0686 100644
> --- a/drivers/media/platform/qcom/venus/dbgfs.h
> +++ b/drivers/media/platform/qcom/venus/dbgfs.h
> @@ -8,5 +8,6 @@ struct venus_core;
+#include <linux/fault-inject.h>
>
> void venus_dbgfs_init(struct venus_core *core);
> void venus_dbgfs_deinit(struct venus_core *core);
#ifdef CONFIG_FAULT_INJECTION
extern struct fault_attr venus_ssr_attr;
static inline venus_fault_inject_ssr(void)
{
return should_fail(&venus_ssr_attr, 1);
}
#else
static inline bool venus_fault_inject_ssr(void) { return false; }
#endif
Powered by blists - more mailing lists