From: Matt Roper <matthew.d.roper@intel.com> To: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com> Cc: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>, David Airlie <airlied@linux.ie>, Stuart Summers <stuart.summers@intel.com>, dri-devel@lists.freedesktop.org, Rodrigo Vivi <rodrigo.vivi@intel.com>, intel-gfx@lists.freedesktop.org Subject: Re: [Intel-gfx][PATCH] drm/i915/display: cleanup intel_bw_state on i915 module removal Date: Thu, 12 Dec 2019 09:49:10 -0800 [thread overview] Message-ID: <20191212174910.GH85422@mdroper-desk1.amr.corp.intel.com> (raw) In-Reply-To: <20191209143921.9240-1-pankaj.laxminarayan.bharadiya@intel.com> On Mon, Dec 09, 2019 at 08:09:02PM +0530, Pankaj Bharadiya wrote: > intel_bw_state allocated memory is not getting freed even after > module removal. > > kmemleak reported backtrace: > > [<0000000079019739>] kmemdup+0x17/0x40 > [<00000000d58c1b9d>] intel_bw_duplicate_state+0x1b/0x40 [i915] > [<000000007423ed0c>] drm_atomic_get_private_obj_state+0xca/0x140 > [<00000000100e3533>] intel_bw_atomic_check+0x133/0x350 [i915] > [<00000000126d0e0c>] intel_atomic_check+0x1ab7/0x20d0 [i915] > [<00000000d5dfc004>] drm_atomic_check_only+0x563/0x810 > [<00000000c9379611>] drm_atomic_commit+0xe/0x50 > [<00000000ec82b765>] drm_atomic_helper_disable_all+0x133/0x160 > [<000000003c44760c>] drm_atomic_helper_shutdown+0x65/0xc0 > [<00000000414e3e5c>] i915_driver_remove+0xcb/0x130 [i915] > [<00000000f8544c2a>] i915_pci_remove+0x19/0x40 [i915] > [<000000002dcbd148>] pci_device_remove+0x36/0xb0 > [<000000003c8c6b0a>] device_release_driver_internal+0xe0/0x1c0 > [<00000000580e9566>] unbind_store+0xc3/0x120 > [<00000000869d0df5>] kernfs_fop_write+0x104/0x190 > [<000000004dc1a355>] vfs_write+0xb9/0x1d0 > > Call the drm_atomic_private_obj_fini(), which inturn calls the > intel_bw_destroy_state() to make sure the intel_bw_state memory is > freed properly. > > Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com> It looks like we'd also leak this object if intel_modeset_init() bails out early due to failure to init a crtc. I.e., we call drm_mode_config_cleanup() which cleans up any regular state objects that may have been initialized by this point, but never destroy the bw_state which was allocated earlier in the function. Matt > --- > drivers/gpu/drm/i915/display/intel_bw.c | 5 +++++ > drivers/gpu/drm/i915/display/intel_bw.h | 1 + > drivers/gpu/drm/i915/display/intel_display.c | 2 ++ > 3 files changed, 8 insertions(+) > > diff --git a/drivers/gpu/drm/i915/display/intel_bw.c b/drivers/gpu/drm/i915/display/intel_bw.c > index dcb66a33be9b..b228671d5a5d 100644 > --- a/drivers/gpu/drm/i915/display/intel_bw.c > +++ b/drivers/gpu/drm/i915/display/intel_bw.c > @@ -486,3 +486,8 @@ int intel_bw_init(struct drm_i915_private *dev_priv) > > return 0; > } > + > +void intel_bw_cleanup(struct drm_i915_private *dev_priv) > +{ > + drm_atomic_private_obj_fini(&dev_priv->bw_obj); > +} > diff --git a/drivers/gpu/drm/i915/display/intel_bw.h b/drivers/gpu/drm/i915/display/intel_bw.h > index 9db10af012f4..20b9ad241802 100644 > --- a/drivers/gpu/drm/i915/display/intel_bw.h > +++ b/drivers/gpu/drm/i915/display/intel_bw.h > @@ -25,6 +25,7 @@ struct intel_bw_state { > > void intel_bw_init_hw(struct drm_i915_private *dev_priv); > int intel_bw_init(struct drm_i915_private *dev_priv); > +void intel_bw_cleanup(struct drm_i915_private *dev_priv); > int intel_bw_atomic_check(struct intel_atomic_state *state); > void intel_bw_crtc_update(struct intel_bw_state *bw_state, > const struct intel_crtc_state *crtc_state); > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c > index 3190aa27ffdc..756eb90b1bb1 100644 > --- a/drivers/gpu/drm/i915/display/intel_display.c > +++ b/drivers/gpu/drm/i915/display/intel_display.c > @@ -17912,6 +17912,8 @@ void intel_modeset_driver_remove(struct drm_i915_private *i915) > > intel_gmbus_teardown(i915); > > + intel_bw_cleanup(i915); > + > destroy_workqueue(i915->flip_wq); > destroy_workqueue(i915->modeset_wq); > > -- > 2.23.0 > -- Matt Roper Graphics Software Engineer VTT-OSGC Platform Enablement Intel Corporation (916) 356-2795 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: Matt Roper <matthew.d.roper@intel.com> To: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com> Cc: David Airlie <airlied@linux.ie>, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Subject: Re: [Intel-gfx] [PATCH] drm/i915/display: cleanup intel_bw_state on i915 module removal Date: Thu, 12 Dec 2019 09:49:10 -0800 [thread overview] Message-ID: <20191212174910.GH85422@mdroper-desk1.amr.corp.intel.com> (raw) In-Reply-To: <20191209143921.9240-1-pankaj.laxminarayan.bharadiya@intel.com> On Mon, Dec 09, 2019 at 08:09:02PM +0530, Pankaj Bharadiya wrote: > intel_bw_state allocated memory is not getting freed even after > module removal. > > kmemleak reported backtrace: > > [<0000000079019739>] kmemdup+0x17/0x40 > [<00000000d58c1b9d>] intel_bw_duplicate_state+0x1b/0x40 [i915] > [<000000007423ed0c>] drm_atomic_get_private_obj_state+0xca/0x140 > [<00000000100e3533>] intel_bw_atomic_check+0x133/0x350 [i915] > [<00000000126d0e0c>] intel_atomic_check+0x1ab7/0x20d0 [i915] > [<00000000d5dfc004>] drm_atomic_check_only+0x563/0x810 > [<00000000c9379611>] drm_atomic_commit+0xe/0x50 > [<00000000ec82b765>] drm_atomic_helper_disable_all+0x133/0x160 > [<000000003c44760c>] drm_atomic_helper_shutdown+0x65/0xc0 > [<00000000414e3e5c>] i915_driver_remove+0xcb/0x130 [i915] > [<00000000f8544c2a>] i915_pci_remove+0x19/0x40 [i915] > [<000000002dcbd148>] pci_device_remove+0x36/0xb0 > [<000000003c8c6b0a>] device_release_driver_internal+0xe0/0x1c0 > [<00000000580e9566>] unbind_store+0xc3/0x120 > [<00000000869d0df5>] kernfs_fop_write+0x104/0x190 > [<000000004dc1a355>] vfs_write+0xb9/0x1d0 > > Call the drm_atomic_private_obj_fini(), which inturn calls the > intel_bw_destroy_state() to make sure the intel_bw_state memory is > freed properly. > > Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com> It looks like we'd also leak this object if intel_modeset_init() bails out early due to failure to init a crtc. I.e., we call drm_mode_config_cleanup() which cleans up any regular state objects that may have been initialized by this point, but never destroy the bw_state which was allocated earlier in the function. Matt > --- > drivers/gpu/drm/i915/display/intel_bw.c | 5 +++++ > drivers/gpu/drm/i915/display/intel_bw.h | 1 + > drivers/gpu/drm/i915/display/intel_display.c | 2 ++ > 3 files changed, 8 insertions(+) > > diff --git a/drivers/gpu/drm/i915/display/intel_bw.c b/drivers/gpu/drm/i915/display/intel_bw.c > index dcb66a33be9b..b228671d5a5d 100644 > --- a/drivers/gpu/drm/i915/display/intel_bw.c > +++ b/drivers/gpu/drm/i915/display/intel_bw.c > @@ -486,3 +486,8 @@ int intel_bw_init(struct drm_i915_private *dev_priv) > > return 0; > } > + > +void intel_bw_cleanup(struct drm_i915_private *dev_priv) > +{ > + drm_atomic_private_obj_fini(&dev_priv->bw_obj); > +} > diff --git a/drivers/gpu/drm/i915/display/intel_bw.h b/drivers/gpu/drm/i915/display/intel_bw.h > index 9db10af012f4..20b9ad241802 100644 > --- a/drivers/gpu/drm/i915/display/intel_bw.h > +++ b/drivers/gpu/drm/i915/display/intel_bw.h > @@ -25,6 +25,7 @@ struct intel_bw_state { > > void intel_bw_init_hw(struct drm_i915_private *dev_priv); > int intel_bw_init(struct drm_i915_private *dev_priv); > +void intel_bw_cleanup(struct drm_i915_private *dev_priv); > int intel_bw_atomic_check(struct intel_atomic_state *state); > void intel_bw_crtc_update(struct intel_bw_state *bw_state, > const struct intel_crtc_state *crtc_state); > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c > index 3190aa27ffdc..756eb90b1bb1 100644 > --- a/drivers/gpu/drm/i915/display/intel_display.c > +++ b/drivers/gpu/drm/i915/display/intel_display.c > @@ -17912,6 +17912,8 @@ void intel_modeset_driver_remove(struct drm_i915_private *i915) > > intel_gmbus_teardown(i915); > > + intel_bw_cleanup(i915); > + > destroy_workqueue(i915->flip_wq); > destroy_workqueue(i915->modeset_wq); > > -- > 2.23.0 > -- Matt Roper Graphics Software Engineer VTT-OSGC Platform Enablement Intel Corporation (916) 356-2795 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-12-12 17:49 UTC|newest] Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-12-09 14:39 [Intel-gfx][PATCH] drm/i915/display: cleanup intel_bw_state on i915 module removal Pankaj Bharadiya 2019-12-09 14:39 ` [Intel-gfx] [PATCH] " Pankaj Bharadiya 2019-12-09 20:24 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for " Patchwork 2019-12-11 5:57 ` [Intel-gfx] [PATCH] " Lucas De Marchi 2019-12-11 5:57 ` Lucas De Marchi 2019-12-11 6:40 ` Bharadiya,Pankaj 2019-12-11 6:40 ` Bharadiya,Pankaj 2019-12-12 0:22 ` Lucas De Marchi 2019-12-12 0:22 ` Lucas De Marchi 2019-12-12 10:28 ` Bharadiya,Pankaj 2019-12-12 10:28 ` Bharadiya,Pankaj 2019-12-12 17:37 ` Matt Roper 2019-12-12 17:37 ` Matt Roper 2019-12-12 20:34 ` Lucas De Marchi 2019-12-12 20:34 ` Lucas De Marchi 2019-12-17 19:39 ` Lucas De Marchi 2019-12-17 19:39 ` Lucas De Marchi 2019-12-24 12:12 ` Shankar, Uma 2019-12-24 12:12 ` Shankar, Uma 2019-12-12 17:49 ` Matt Roper [this message] 2019-12-12 17:49 ` Matt Roper 2019-12-12 18:01 ` [Intel-gfx][PATCH] " Ville Syrjälä 2019-12-12 18:01 ` [Intel-gfx] [PATCH] " Ville Syrjälä 2019-12-23 10:24 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork 2019-12-23 17:32 ` [Intel-gfx] ✓ Fi.CI.IGT: " 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=20191212174910.GH85422@mdroper-desk1.amr.corp.intel.com \ --to=matthew.d.roper@intel.com \ --cc=airlied@linux.ie \ --cc=dri-devel@lists.freedesktop.org \ --cc=intel-gfx@lists.freedesktop.org \ --cc=pankaj.laxminarayan.bharadiya@intel.com \ --cc=rodrigo.vivi@intel.com \ --cc=stanislav.lisovskiy@intel.com \ --cc=stuart.summers@intel.com \ /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: linkBe 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.