Re: [Intel-gfx] [PATCH] drm/i915/perf: Initialise dynamic sysfs group before creation
On 09/08/17 16:14, Lionel Landwerlin wrote: On 09/08/17 16:02, Chris Wilson wrote: Quoting Lionel Landwerlin (2017-08-09 15:57:59) Right, that's exactly what I was asking in our previous exchange. I just follow the traces, and am internally screaming at how much we are stuffing inside drm_i915_private nowadays. You need to leave the memset() I think, because we check further down It is already zeroed. that function that id == 0 to detect failure to recognize that the (Gen, GT) is supported. Unless there is a guarantee that dev_priv is fully memset()? It is allocated using kzalloc() and we depend upon that in many, many places. -Chris Cool, Fixes: f89823c21224 ("drm/i915/perf: Implement I915_PERF_ADD/REMOVE_CONFIG interface") The line above is wrong and not what I wanted to write... : Reviewed-by: Lionel Landwerlin ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH] drm/i915/perf: Initialise dynamic sysfs group before creation
On 09/08/17 16:02, Chris Wilson wrote: Quoting Lionel Landwerlin (2017-08-09 15:57:59) Right, that's exactly what I was asking in our previous exchange. I just follow the traces, and am internally screaming at how much we are stuffing inside drm_i915_private nowadays. You need to leave the memset() I think, because we check further down It is already zeroed. that function that id == 0 to detect failure to recognize that the (Gen, GT) is supported. Unless there is a guarantee that dev_priv is fully memset()? It is allocated using kzalloc() and we depend upon that in many, many places. -Chris Cool, Fixes: f89823c21224 ("drm/i915/perf: Implement I915_PERF_ADD/REMOVE_CONFIG interface") ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH] drm/i915/perf: Initialise dynamic sysfs group before creation
Quoting Lionel Landwerlin (2017-08-09 15:57:59) > Right, that's exactly what I was asking in our previous exchange. I just follow the traces, and am internally screaming at how much we are stuffing inside drm_i915_private nowadays. > You need to leave the memset() I think, because we check further down It is already zeroed. > that function that id == 0 to detect failure to recognize that the (Gen, > GT) is supported. > Unless there is a guarantee that dev_priv is fully memset()? It is allocated using kzalloc() and we depend upon that in many, many places. -Chris ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH] drm/i915/perf: Initialise dynamic sysfs group before creation
Right, that's exactly what I was asking in our previous exchange. You need to leave the memset() I think, because we check further down that function that id == 0 to detect failure to recognize that the (Gen, GT) is supported. Unless there is a guarantee that dev_priv is fully memset()? Thanks a lot, - Lionel On 09/08/17 15:47, Chris Wilson wrote: Another case where we need to call sysfs_attr_init() to setup the internal lockdep class prior to use: [9.325229] BUG: key 880168bc7bb0 not in .data! [9.325240] DEBUG_LOCKS_WARN_ON(1) [9.325250] [ cut here ] [9.325280] WARNING: CPU: 1 PID: 275 at kernel/locking/lockdep.c:3156 lockdep_init_map+0x1b2/0x1c0 [9.325301] Modules linked in: intel_powerclamp(+) coretemp crct10dif_pclmul crc32_pclmul ghash_clmulni_intel i915(+) snd_hda_intel snd_hda_codec snd_hwdep r8169 mii snd_hda_core snd_pcm prime_numbers i2c_hid pinctrl_geminilake pinctrl_intel [9.325375] CPU: 1 PID: 275 Comm: modprobe Not tainted 4.13.0-rc4-CI-Trybot_1040+ #1 [9.325395] Hardware name: Intel Corp. Geminilake/GLK RVP2 LP4SD (07), BIOS GELKRVPA.X64.0045.B51.1704281422 04/28/2017 [9.325422] task: 8801721a4ec0 task.stack: c91dc000 [9.325440] RIP: 0010:lockdep_init_map+0x1b2/0x1c0 [9.325456] RSP: 0018:c91dfa10 EFLAGS: 00010282 [9.325473] RAX: 0016 RBX: 880168d54b80 RCX: [9.325488] RDX: 8001 RSI: 0001 RDI: 810f0800 [9.325505] RBP: c91dfa30 R08: 0001 R09: [9.325521] R10: R11: R12: 880168bc7bb0 [9.325537] R13: R14: 880168bc7b98 R15: 81a263a0 [9.325554] FS: 7fb60c3fd700() GS:88017fc8() knlGS: [9.325574] CS: 0010 DS: ES: CR0: 80050033 [9.325588] CR2: 006582777d80 CR3: 00016d818000 CR4: 003406e0 [9.325604] Call Trace: [9.325618] __kernfs_create_file+0x76/0xe0 [9.325632] sysfs_add_file_mode_ns+0x8a/0x1a0 [9.325646] internal_create_group+0xea/0x2c0 [9.325660] sysfs_create_group+0x13/0x20 [9.325737] i915_perf_register+0xde/0x220 [i915] [9.325800] i915_driver_load+0xa77/0x16c0 [i915] [9.325863] i915_pci_probe+0x37/0x90 [i915] [9.325880] pci_device_probe+0xa8/0x130 [9.325894] driver_probe_device+0x29c/0x450 [9.325908] __driver_attach+0xe3/0xf0 [9.325922] ? driver_probe_device+0x450/0x450 [9.325935] bus_for_each_dev+0x62/0xa0 [9.325948] driver_attach+0x1e/0x20 [9.325960] bus_add_driver+0x173/0x270 [9.325974] driver_register+0x60/0xe0 [9.325986] __pci_register_driver+0x60/0x70 [9.326044] i915_init+0x6f/0x78 [i915] [9.326066] ? 0xa024e000 [9.326079] do_one_initcall+0x43/0x170 [9.326094] ? rcu_read_lock_sched_held+0x7a/0x90 [9.326109] ? kmem_cache_alloc_trace+0x261/0x2d0 [9.326124] do_init_module+0x5f/0x206 [9.326137] load_module+0x2561/0x2da0 [9.326150] ? show_coresize+0x30/0x30 [9.326165] ? kernel_read_file+0x105/0x190 [9.326180] SyS_finit_module+0xc1/0x100 [9.326192] ? SyS_finit_module+0xc1/0x100 [9.326210] entry_SYSCALL_64_fastpath+0x1c/0xb1 [9.326223] RIP: 0033:0x7fb60bf359f9 [9.326234] RSP: 002b:7fff92b47c48 EFLAGS: 0246 ORIG_RAX: 0139 [9.326255] RAX: ffda RBX: 814898a3 RCX: 7fb60bf359f9 [9.326271] RDX: RSI: 0028a9ceef8b RDI: [9.326287] RBP: c91dff88 R08: R09: [9.326303] R10: R11: 0246 R12: 0004 [9.326319] R13: 0028aaef2a70 R14: R15: 0028aaeee5d0 [9.326339] ? __this_cpu_preempt_check+0x13/0x20 [9.326353] Code: f1 39 00 85 c0 0f 84 38 ff ff ff 83 3d 9f 44 ce 01 00 0f 85 2b ff ff ff 48 c7 c6 b2 a2 c7 81 48 c7 c7 53 40 c5 81 e8 3f 82 01 00 <0f> ff e9 11 ff ff ff 0f 1f 80 00 00 00 00 55 31 c9 31 d2 31 f6 Fixes: 701f8231a2fe ("drm/i915/perf: prune OA configs") Signed-off-by: Chris Wilson Cc: Lionel Landwerlin Cc: Matthew Auld --- drivers/gpu/drm/i915/i915_perf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c index e3e2663117e9..1be355d14e8a 100644 --- a/drivers/gpu/drm/i915/i915_perf.c +++ b/drivers/gpu/drm/i915/i915_perf.c @@ -2908,8 +2908,7 @@ void i915_perf_register(struct drm_i915_private *dev_priv) if (!dev_priv->perf.metrics_kobj) goto exit; - memset(&dev_priv->perf.oa.test_config, 0, - sizeof(dev_priv->perf.oa.test_config)); + sysfs_attr_init(&dev_priv->perf.oa.test_config.sysfs_metric_id.attr); if (IS_HASWELL(dev_priv)) { i915_perf_load_test_config_hsw(dev_priv); ___
[Intel-gfx] [PATCH] drm/i915/perf: Initialise dynamic sysfs group before creation
Another case where we need to call sysfs_attr_init() to setup the internal lockdep class prior to use: [9.325229] BUG: key 880168bc7bb0 not in .data! [9.325240] DEBUG_LOCKS_WARN_ON(1) [9.325250] [ cut here ] [9.325280] WARNING: CPU: 1 PID: 275 at kernel/locking/lockdep.c:3156 lockdep_init_map+0x1b2/0x1c0 [9.325301] Modules linked in: intel_powerclamp(+) coretemp crct10dif_pclmul crc32_pclmul ghash_clmulni_intel i915(+) snd_hda_intel snd_hda_codec snd_hwdep r8169 mii snd_hda_core snd_pcm prime_numbers i2c_hid pinctrl_geminilake pinctrl_intel [9.325375] CPU: 1 PID: 275 Comm: modprobe Not tainted 4.13.0-rc4-CI-Trybot_1040+ #1 [9.325395] Hardware name: Intel Corp. Geminilake/GLK RVP2 LP4SD (07), BIOS GELKRVPA.X64.0045.B51.1704281422 04/28/2017 [9.325422] task: 8801721a4ec0 task.stack: c91dc000 [9.325440] RIP: 0010:lockdep_init_map+0x1b2/0x1c0 [9.325456] RSP: 0018:c91dfa10 EFLAGS: 00010282 [9.325473] RAX: 0016 RBX: 880168d54b80 RCX: [9.325488] RDX: 8001 RSI: 0001 RDI: 810f0800 [9.325505] RBP: c91dfa30 R08: 0001 R09: [9.325521] R10: R11: R12: 880168bc7bb0 [9.325537] R13: R14: 880168bc7b98 R15: 81a263a0 [9.325554] FS: 7fb60c3fd700() GS:88017fc8() knlGS: [9.325574] CS: 0010 DS: ES: CR0: 80050033 [9.325588] CR2: 006582777d80 CR3: 00016d818000 CR4: 003406e0 [9.325604] Call Trace: [9.325618] __kernfs_create_file+0x76/0xe0 [9.325632] sysfs_add_file_mode_ns+0x8a/0x1a0 [9.325646] internal_create_group+0xea/0x2c0 [9.325660] sysfs_create_group+0x13/0x20 [9.325737] i915_perf_register+0xde/0x220 [i915] [9.325800] i915_driver_load+0xa77/0x16c0 [i915] [9.325863] i915_pci_probe+0x37/0x90 [i915] [9.325880] pci_device_probe+0xa8/0x130 [9.325894] driver_probe_device+0x29c/0x450 [9.325908] __driver_attach+0xe3/0xf0 [9.325922] ? driver_probe_device+0x450/0x450 [9.325935] bus_for_each_dev+0x62/0xa0 [9.325948] driver_attach+0x1e/0x20 [9.325960] bus_add_driver+0x173/0x270 [9.325974] driver_register+0x60/0xe0 [9.325986] __pci_register_driver+0x60/0x70 [9.326044] i915_init+0x6f/0x78 [i915] [9.326066] ? 0xa024e000 [9.326079] do_one_initcall+0x43/0x170 [9.326094] ? rcu_read_lock_sched_held+0x7a/0x90 [9.326109] ? kmem_cache_alloc_trace+0x261/0x2d0 [9.326124] do_init_module+0x5f/0x206 [9.326137] load_module+0x2561/0x2da0 [9.326150] ? show_coresize+0x30/0x30 [9.326165] ? kernel_read_file+0x105/0x190 [9.326180] SyS_finit_module+0xc1/0x100 [9.326192] ? SyS_finit_module+0xc1/0x100 [9.326210] entry_SYSCALL_64_fastpath+0x1c/0xb1 [9.326223] RIP: 0033:0x7fb60bf359f9 [9.326234] RSP: 002b:7fff92b47c48 EFLAGS: 0246 ORIG_RAX: 0139 [9.326255] RAX: ffda RBX: 814898a3 RCX: 7fb60bf359f9 [9.326271] RDX: RSI: 0028a9ceef8b RDI: [9.326287] RBP: c91dff88 R08: R09: [9.326303] R10: R11: 0246 R12: 0004 [9.326319] R13: 0028aaef2a70 R14: R15: 0028aaeee5d0 [9.326339] ? __this_cpu_preempt_check+0x13/0x20 [9.326353] Code: f1 39 00 85 c0 0f 84 38 ff ff ff 83 3d 9f 44 ce 01 00 0f 85 2b ff ff ff 48 c7 c6 b2 a2 c7 81 48 c7 c7 53 40 c5 81 e8 3f 82 01 00 <0f> ff e9 11 ff ff ff 0f 1f 80 00 00 00 00 55 31 c9 31 d2 31 f6 Fixes: 701f8231a2fe ("drm/i915/perf: prune OA configs") Signed-off-by: Chris Wilson Cc: Lionel Landwerlin Cc: Matthew Auld --- drivers/gpu/drm/i915/i915_perf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c index e3e2663117e9..1be355d14e8a 100644 --- a/drivers/gpu/drm/i915/i915_perf.c +++ b/drivers/gpu/drm/i915/i915_perf.c @@ -2908,8 +2908,7 @@ void i915_perf_register(struct drm_i915_private *dev_priv) if (!dev_priv->perf.metrics_kobj) goto exit; - memset(&dev_priv->perf.oa.test_config, 0, - sizeof(dev_priv->perf.oa.test_config)); + sysfs_attr_init(&dev_priv->perf.oa.test_config.sysfs_metric_id.attr); if (IS_HASWELL(dev_priv)) { i915_perf_load_test_config_hsw(dev_priv); -- 2.13.3 ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx