[Intel-gfx] [PATCH v2 5/9] drm/i915/perf: Fail modprobe if i915_perf_init fails on OOM
Dixit, Ashutosh
ashutosh.dixit at intel.com
Fri Feb 17 02:04:45 UTC 2023
On Thu, 16 Feb 2023 16:58:46 -0800, Umesh Nerlige Ramappa wrote:
>
> i915_perf_init can fail due to OOM. Fail driver init if i915_perf_init
> fails.
>
> v2: (Jani)
> - Reorder patch in the series
Jani seemed ok with this: that a drm_err will get lost in the dmesg deluge
on OOM so it's better to fail the probe as long as it's only due to OOM.
> Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>
> ---
> drivers/gpu/drm/i915/i915_driver.c | 4 +++-
> drivers/gpu/drm/i915/i915_perf.c | 8 ++++++--
> drivers/gpu/drm/i915/i915_perf.h | 2 +-
> 3 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
> index 0c0ae3eabb4b..998ca41c9713 100644
> --- a/drivers/gpu/drm/i915/i915_driver.c
> +++ b/drivers/gpu/drm/i915/i915_driver.c
> @@ -477,7 +477,9 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
> if (ret)
> return ret;
>
> - i915_perf_init(dev_priv);
> + ret = i915_perf_init(dev_priv);
Maybe add a comment here like this to allay people's concerns?
/* The only non-zero ret here is -ENOMEM */
or even:
drm_WARN_ON(&dev_priv->drm, ret && ret != -ENOMEM);
Otherwise this is:
Reviewed-by: Ashutosh Dixit <ashutosh.dixit at intel.com>
> + if (ret)
> + return ret;
>
> ret = i915_ggtt_probe_hw(dev_priv);
> if (ret)
> diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
> index 37c4cc44d68c..3306653c0b85 100644
> --- a/drivers/gpu/drm/i915/i915_perf.c
> +++ b/drivers/gpu/drm/i915/i915_perf.c
> @@ -4941,7 +4941,7 @@ static void i915_perf_init_info(struct drm_i915_private *i915)
> * Note: i915-perf initialization is split into an 'init' and 'register'
> * phase with the i915_perf_register() exposing state to userspace.
> */
> -void i915_perf_init(struct drm_i915_private *i915)
> +int i915_perf_init(struct drm_i915_private *i915)
> {
> struct i915_perf *perf = &i915->perf;
>
> @@ -5057,12 +5057,16 @@ void i915_perf_init(struct drm_i915_private *i915)
> perf->i915 = i915;
>
> ret = oa_init_engine_groups(perf);
> - if (ret)
> + if (ret) {
> drm_err(&i915->drm,
> "OA initialization failed %d\n", ret);
> + return ret;
> + }
>
> oa_init_supported_formats(perf);
> }
> +
> + return 0;
> }
>
> static int destroy_config(int id, void *p, void *data)
> diff --git a/drivers/gpu/drm/i915/i915_perf.h b/drivers/gpu/drm/i915/i915_perf.h
> index f96e09a4af04..253637651d5e 100644
> --- a/drivers/gpu/drm/i915/i915_perf.h
> +++ b/drivers/gpu/drm/i915/i915_perf.h
> @@ -18,7 +18,7 @@ struct i915_oa_config;
> struct intel_context;
> struct intel_engine_cs;
>
> -void i915_perf_init(struct drm_i915_private *i915);
> +int i915_perf_init(struct drm_i915_private *i915);
> void i915_perf_fini(struct drm_i915_private *i915);
> void i915_perf_register(struct drm_i915_private *i915);
> void i915_perf_unregister(struct drm_i915_private *i915);
> --
> 2.36.1
>
More information about the Intel-gfx
mailing list