From: Lucas De Marchi <lucas.demarchi@intel.com>
To: intel-gfx@lists.freedesktop.org, linux-perf-users@vger.kernel.org
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
dri-devel@lists.freedesktop.org,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
linux-kernel@vger.kernel.org,
Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH 7/7] drm/i915/pmu: Do not set event_init to NULL
Date: Mon, 22 Jul 2024 14:06:48 -0700 [thread overview]
Message-ID: <20240722210648.80892-8-lucas.demarchi@intel.com> (raw)
In-Reply-To: <20240722210648.80892-1-lucas.demarchi@intel.com>
event_init is not an optional function pointer from perf events. Now
that pmu unregister happens only when freeing i915, setting it to NULL
only protects other functions in i915. Replace that by checking
pmu->closed.
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
drivers/gpu/drm/i915/i915_pmu.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
index df53a8fe53ec..c5738035bc2f 100644
--- a/drivers/gpu/drm/i915/i915_pmu.c
+++ b/drivers/gpu/drm/i915/i915_pmu.c
@@ -303,7 +303,7 @@ void i915_pmu_gt_parked(struct intel_gt *gt)
{
struct i915_pmu *pmu = >->i915->pmu;
- if (!pmu->base.event_init)
+ if (pmu->closed)
return;
spin_lock_irq(&pmu->lock);
@@ -325,7 +325,7 @@ void i915_pmu_gt_unparked(struct intel_gt *gt)
{
struct i915_pmu *pmu = >->i915->pmu;
- if (!pmu->base.event_init)
+ if (pmu->closed)
return;
spin_lock_irq(&pmu->lock);
@@ -1325,12 +1325,12 @@ void i915_pmu_register(struct drm_i915_private *i915)
err_groups:
kfree(pmu->base.attr_groups);
err_attr:
- pmu->base.event_init = NULL;
free_event_attributes(pmu);
err_name:
if (IS_DGFX(i915))
kfree(pmu->name);
err:
+ pmu->closed = true;
drm_notice(&i915->drm, "Failed to register PMU!\n");
}
@@ -1346,6 +1346,4 @@ void i915_pmu_unregister(struct drm_i915_private *i915)
hrtimer_cancel(&pmu->timer);
i915_pmu_unregister_cpuhp_state(pmu);
-
- pmu->base.event_init = NULL;
}
--
2.43.0
next prev parent reply other threads:[~2024-07-22 21:07 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-22 21:06 [PATCH 0/7] Fix i915 pmu on bind/unbind Lucas De Marchi
2024-07-22 21:06 ` [PATCH 1/7] perf/core: Add pmu get/put Lucas De Marchi
2024-07-23 23:07 ` Ian Rogers
2024-07-22 21:06 ` [PATCH 2/7] drm/i915/pmu: Fix crash due to use-after-free Lucas De Marchi
2024-07-22 21:06 ` [PATCH 3/7] drm/i915/pmu: Use event_to_pmu() Lucas De Marchi
2024-07-23 4:35 ` Dixit, Ashutosh
2024-07-22 21:06 ` [PATCH 4/7] drm/i915/pmu: Drop is_igp() Lucas De Marchi
2024-07-22 23:25 ` Dixit, Ashutosh
2024-07-23 7:52 ` Tvrtko Ursulin
2024-07-22 21:06 ` [PATCH 5/7] drm/i915/pmu: Let resource survive unbind Lucas De Marchi
2024-07-23 7:58 ` Tvrtko Ursulin
2024-07-22 21:06 ` [PATCH 6/7] drm/i915/pmu: Lazy unregister Lucas De Marchi
2024-07-23 8:03 ` Tvrtko Ursulin
2024-07-23 15:30 ` Lucas De Marchi
2024-07-24 7:48 ` Tvrtko Ursulin
2024-07-24 12:41 ` Peter Zijlstra
2024-07-24 15:39 ` Lucas De Marchi
2024-09-09 21:03 ` Lucas De Marchi
2024-07-22 21:06 ` Lucas De Marchi [this message]
2024-08-05 6:55 ` [PATCH 7/7] drm/i915/pmu: Do not set event_init to NULL kernel test robot
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=20240722210648.80892-8-lucas.demarchi@intel.com \
--to=lucas.demarchi@intel.com \
--cc=acme@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tvrtko.ursulin@linux.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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®