Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@xxxxxxxxx>
I'm curious though, why hasn't it been a problem before??
All of the configs we store in kernel don't seem to properly initialize
attr either, yet it hasn't yield any warning.
Did we get it wrong all along there too?
On 03/08/17 23:37, Chris Wilson wrote:
Use sysfs_attr_init() to dynamically initialise the
oa_config->sysfs_metric_id.attr as it has the important side-effect of
setting the lockdep key.
[ 4.971513] [drm] Initialized i915 1.6.0 20170731 for 0000:00:02.0 on minor 0
[ 4.973489] BUG: key ffff88026f6e7bb0 not in .data!
[ 4.973506] DEBUG_LOCKS_WARN_ON(1)
[ 4.973518] ------------[ cut here ]------------
[ 4.973547] WARNING: CPU: 1 PID: 258 at kernel/locking/lockdep.c:3156 lockdep_init_map+0x1b2/0x1c0
[ 4.973567] Modules linked in: i915(+) x86_pkg_temp_thermal intel_powerclamp coretemp crct10dif_pclmul crc32_pclmul ghash_clmulni_intel snd_hda_intel snd_hda_codec snd_hwdep snd_hda_core snd_pcm r8169 mei_me mii mei lpc_ich prime_numbers i2c_hid pinctrl_broxton pinctrl_intel
[ 4.973645] CPU: 1 PID: 258 Comm: systemd-udevd Not tainted 4.13.0-rc3-CI-CI_DRM_2915+ #1
[ 4.973664] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./J4205-ITX, BIOS P1.10 09/29/2016
[ 4.973686] task: ffff8802704c2740 task.stack: ffffc90000224000
[ 4.973700] RIP: 0010:lockdep_init_map+0x1b2/0x1c0
[ 4.973712] RSP: 0018:ffffc90000227a10 EFLAGS: 00010282
[ 4.973726] RAX: 0000000000000016 RBX: ffff880262aac010 RCX: 0000000000000000
[ 4.973741] RDX: 0000000080000001 RSI: 0000000000000001 RDI: ffffffff810ed1ab
[ 4.973757] RBP: ffffc90000227a30 R08: 0000000000000001 R09: 0000000000000000
[ 4.973774] R10: 0000000000000000 R11: 0000000000000000 R12: ffff88026f6e7bb0
[ 4.973789] R13: 0000000000000000 R14: ffff88026f6e7b98 R15: ffffffff81a24da0
[ 4.973805] FS: 00007f588d7f58c0(0000) GS:ffff88027fc80000(0000) knlGS:0000000000000000
[ 4.973823] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 4.973837] CR2: 00000082482e32a0 CR3: 0000000270531000 CR4: 00000000003406e0
[ 4.973852] Call Trace:
[ 4.973864] __kernfs_create_file+0x71/0xe0
[ 4.973876] sysfs_add_file_mode_ns+0x85/0x1a0
[ 4.973890] internal_create_group+0xe5/0x2b0
[ 4.973903] sysfs_create_group+0xe/0x10
[ 4.973985] i915_perf_register+0xd9/0x220 [i915]
[ 4.974044] i915_driver_load+0xa72/0x16b0 [i915]
[ 4.974124] i915_pci_probe+0x32/0x90 [i915]
Annoying detected by CI, but not reported due to it occurring during boot
and disabling lockdep for later runs.
Fixes: f89823c21224 ("drm/i915/perf: Implement I915_PERF_ADD/REMOVE_CONFIG interface")
Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
Cc: Matthew Auld <matthew.auld@xxxxxxxxx>
Cc: Lionel Landwerlin <lionel.g.landwerlin@xxxxxxxxx>
Cc: Andrzej Datczuk <andrzej.datczuk@xxxxxxxxx>
---
drivers/gpu/drm/i915/i915_perf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index 221a996f1985..e3e2663117e9 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -3117,6 +3117,7 @@ static ssize_t show_dynamic_id(struct device *dev,
static int create_dynamic_oa_sysfs_entry(struct drm_i915_private *dev_priv,
struct i915_oa_config *oa_config)
{
+ sysfs_attr_init(&oa_config->sysfs_metric_id.attr);
oa_config->sysfs_metric_id.attr.name = "id";
oa_config->sysfs_metric_id.attr.mode = S_IRUGO;
oa_config->sysfs_metric_id.show = show_dynamic_id;
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx