write to GRBM_GFX_INDEX without lock

Deucher, Alexander Alexander.Deucher at amd.com
Tue Sep 12 16:09:47 UTC 2017


> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-bounces at lists.freedesktop.org] On Behalf
> Of Tom St Denis
> Sent: Tuesday, September 12, 2017 10:18 AM
> To: amd-gfx mailing list
> Subject: write to GRBM_GFX_INDEX without lock
> 
> In the file smu7_powertune.c we have
> 
> int smu7_enable_didt_config(struct pp_hwmgr *hwmgr)
> {
> 	int result;
> 	uint32_t num_se = 0;
> 	uint32_t count, value, value2;
> 	struct cgs_system_info sys_info = {0};
> 
> 	sys_info.size = sizeof(struct cgs_system_info);
> 	sys_info.info_id = CGS_SYSTEM_INFO_GFX_SE_INFO;
> 	result = cgs_query_system_info(hwmgr->device, &sys_info);
> 
> 	if (result == 0)
> 		num_se = sys_info.value;
> 
> 	if (PP_CAP(PHM_PlatformCaps_SQRamping) ||
> 	    PP_CAP(PHM_PlatformCaps_DBRamping) ||
> 	    PP_CAP(PHM_PlatformCaps_TDRamping) ||
> 	    PP_CAP(PHM_PlatformCaps_TCPRamping)) {
> 
> 		cgs_enter_safe_mode(hwmgr->device, true);
> 		value = 0;
> 		value2 = cgs_read_register(hwmgr->device,
> mmGRBM_GFX_INDEX);
> 		for (count = 0; count < num_se; count++) {
> 			value =
> SYS_GRBM_GFX_INDEX_DATA__INSTANCE_BROADCAST_WRITES_MASK
> 				|
> SYS_GRBM_GFX_INDEX_DATA__SH_BROADCAST_WRITES_MASK
> 				| (count <<
> SYS_GRBM_GFX_INDEX_DATA__SE_INDEX__SHIFT);
> 			cgs_write_register(hwmgr->device,
> mmGRBM_GFX_INDEX, value);
> 
> 
> The call to "enter safe mode" doesn't hold the lock which means that
> this could in theory occur while other things are going on.  Granted
> this function is likely called during init it should have a lock no?

Yes, it should.  I think there is a cgs function to handle the locking.

Alex

> 
> Cheers,
> Tom
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list