From: Jani Nikula <jani.nikula@intel.com>
To: Arun R Murthy <arun.r.murthy@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCHv2] drm/i915: free crtc on driver remove
Date: Thu, 30 Jun 2022 10:46:16 +0300 [thread overview]
Message-ID: <87k08ypp9z.fsf@intel.com> (raw)
In-Reply-To: <20220630070607.858766-1-arun.r.murthy@intel.com>
On Thu, 30 Jun 2022, Arun R Murthy <arun.r.murthy@intel.com> wrote:
> intel_crtc is being allocated as part of intel_modeset_init_nogem
> and not freed as part of driver remove. This will lead to memory
> leak. Hence free up the allocated crtc on driver remove as part of
> intel_modeset_driver_remove_nogem.
No, there's no leak and this is not needed.
See drm_mode_config_cleanup() calling crtc->funcs->destroy() on each
crtc.
BR,
Jani.
>
> Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_crtc.c | 2 +-
> drivers/gpu/drm/i915/display/intel_crtc.h | 1 +
> drivers/gpu/drm/i915/display/intel_display.c | 6 ++++++
> 3 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_crtc.c b/drivers/gpu/drm/i915/display/intel_crtc.c
> index 4442aa355f86..c90b2854c772 100644
> --- a/drivers/gpu/drm/i915/display/intel_crtc.c
> +++ b/drivers/gpu/drm/i915/display/intel_crtc.c
> @@ -193,7 +193,7 @@ static struct intel_crtc *intel_crtc_alloc(void)
> return crtc;
> }
>
> -static void intel_crtc_free(struct intel_crtc *crtc)
> +void intel_crtc_free(struct intel_crtc *crtc)
> {
> intel_crtc_destroy_state(&crtc->base, crtc->base.state);
> kfree(crtc);
> diff --git a/drivers/gpu/drm/i915/display/intel_crtc.h b/drivers/gpu/drm/i915/display/intel_crtc.h
> index 73077137fb99..d20200a2c33b 100644
> --- a/drivers/gpu/drm/i915/display/intel_crtc.h
> +++ b/drivers/gpu/drm/i915/display/intel_crtc.h
> @@ -35,5 +35,6 @@ struct intel_crtc *intel_crtc_for_pipe(struct drm_i915_private *i915,
> void intel_wait_for_vblank_if_active(struct drm_i915_private *i915,
> enum pipe pipe);
> void intel_crtc_wait_for_next_vblank(struct intel_crtc *crtc);
> +void intel_crtc_free(struct intel_crtc *crtc);
>
> #endif
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index a0f84cbe974f..33e29455fe56 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -9046,6 +9046,8 @@ void intel_modeset_driver_remove_noirq(struct drm_i915_private *i915)
> /* part #3: call after gem init */
> void intel_modeset_driver_remove_nogem(struct drm_i915_private *i915)
> {
> + struct intel_crtc *crtc;
> +
> intel_dmc_ucode_fini(i915);
>
> intel_power_domains_driver_remove(i915);
> @@ -9053,6 +9055,10 @@ void intel_modeset_driver_remove_nogem(struct drm_i915_private *i915)
> intel_vga_unregister(i915);
>
> intel_bios_driver_remove(i915);
> +
> + /* Free the allocated crtc */
> + for_each_intel_crtc(&i915->drm, crtc)
> + intel_crtc_free(crtc);
> }
>
> bool intel_modeset_probe_defer(struct pci_dev *pdev)
--
Jani Nikula, Intel Open Source Graphics Center
next prev parent reply other threads:[~2022-06-30 7:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-30 7:06 [Intel-gfx] [PATCHv2] drm/i915: free crtc on driver remove Arun R Murthy
2022-06-30 7:46 ` Jani Nikula [this message]
2022-06-30 9:03 ` Murthy, Arun R
2022-06-30 9:33 ` Jani Nikula
2022-06-30 9:56 ` Murthy, Arun R
2022-06-30 10:49 ` Jani Nikula
2022-06-30 11:07 ` Murthy, Arun R
2022-06-30 7:56 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: free crtc on driver remove (rev2) Patchwork
2022-06-30 18:36 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
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=87k08ypp9z.fsf@intel.com \
--to=jani.nikula@intel.com \
--cc=arun.r.murthy@intel.com \
--cc=intel-gfx@lists.freedesktop.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.