[PATCH 1/5] swiotlb: suppress warning when __GFP_NOWARN is set.

Michel Dänzer michel at daenzer.net
Wed Dec 20 14:56:52 UTC 2017


On 2017-12-20 03:49 PM, Christian König wrote:
> Am 20.12.2017 um 15:41 schrieb Michel Dänzer:
>> On 2017-12-20 02:21 PM, Christian König wrote:
>>> TTM tries to allocate coherent memory in chunks of 2MB first to improve
>>> TLB efficiency and falls back to allocating 4K pages if that fails.
>>>
>>> Suppress the warning when the 2MB allocations fails since there is a
>>> valid fall back path.
>>>
>>> Signed-off-by: Christian König <christian.koenig at amd.com>
>>> ---
>>>   lib/swiotlb.c | 8 +++++---
>>>   1 file changed, 5 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/lib/swiotlb.c b/lib/swiotlb.c
>>> index cea19aaf303c..63a44fb29ce6 100644
>>> --- a/lib/swiotlb.c
>>> +++ b/lib/swiotlb.c
>>> @@ -769,9 +769,11 @@ swiotlb_alloc_coherent(struct device *hwdev,
>>> size_t size,
>>>       return ret;
>>>     err_warn:
>>> -    pr_warn("swiotlb: coherent allocation failed for device %s
>>> size=%zu\n",
>>> -        dev_name(hwdev), size);
>>> -    dump_stack();
>>> +    if (!(flags & __GFP_NOWARN)) {
>>> +        pr_warn("swiotlb: coherent allocation failed for device %s
>>> size=%zu\n",
>>> +            dev_name(hwdev), size);
>>> +        dump_stack();
>>> +    }
>>>         return NULL;
>>>   }
>>>
>> This isn't the only swiotlb message I'm hitting, also this from
>> swiotlb_tbl_map_single:
>>
>>   radeon 0000:00:01.0: swiotlb buffer is full (sz: 2097152 bytes)
> 
> Do you have a full dmesg with that? Cause that is a bit more disturbing.

Sure, e.g.

[  117.850069] swiotlb_tbl_map_single: 16 callbacks suppressed
[  117.850132] radeon 0000:00:01.0: swiotlb buffer is full (sz: 2097152 bytes)
[  117.850398] swiotlb: coherent allocation failed for device 0000:00:01.0 size=2097152
[  117.850409] CPU: 3 PID: 3167 Comm: Compositor Not tainted 4.14.3+ #296
[  117.850414] Hardware name: Hewlett-Packard HP EliteBook 725 G2/221D, BIOS M84 Ver. 01.44 09/26/2016
[  117.850419] Call Trace:
[  117.850436]  dump_stack+0x85/0xc5
[  117.850450]  swiotlb_alloc_coherent+0xd7/0x150
[  117.850482]  ttm_dma_pool_get_pages+0x211/0x600 [ttm]
[  117.850522]  ttm_dma_populate+0x24d/0x340 [ttm]
[  117.850549]  ttm_tt_bind+0x23/0x50 [ttm]
[  117.850569]  ttm_bo_handle_move_mem+0x5ea/0x620 [ttm]
[  117.850606]  ttm_bo_move_buffer+0x113/0x130 [ttm]
[  117.850630]  ? __lock_is_held+0x55/0x90
[  117.850658]  ttm_bo_validate+0x9e/0xe0 [ttm]
[  117.850682]  ttm_bo_init_reserved+0x46b/0x510 [ttm]
[  117.850711]  ttm_bo_init+0x2f/0xa0 [ttm]
[  117.850785]  ? radeon_update_memory_usage.isra.3+0x50/0x50 [radeon]
[  117.850835]  radeon_bo_create+0x189/0x2e0 [radeon]
[  117.850887]  ? radeon_update_memory_usage.isra.3+0x50/0x50 [radeon]
[  117.850950]  radeon_gem_object_create+0xa7/0x1d0 [radeon]
[  117.851012]  ? radeon_gem_pwrite_ioctl+0x30/0x30 [radeon]
[  117.851061]  radeon_gem_create_ioctl+0x66/0x100 [radeon]
[  117.851076]  ? __might_fault+0x3e/0x90
[  117.851132]  ? radeon_gem_pwrite_ioctl+0x30/0x30 [radeon]
[  117.851175]  drm_ioctl_kernel+0x59/0xb0 [drm]
[  117.851214]  drm_ioctl+0x2cb/0x380 [drm]
[  117.851270]  ? radeon_gem_pwrite_ioctl+0x30/0x30 [radeon]
[  117.851286]  ? __pm_runtime_resume+0x54/0x90
[  117.851303]  ? trace_hardirqs_on_caller+0xed/0x180
[  117.851352]  radeon_drm_ioctl+0x49/0x80 [radeon]
[  117.851369]  do_vfs_ioctl+0xa2/0x6c0
[  117.851386]  ? __fget+0x10e/0x200
[  117.851406]  SyS_ioctl+0x74/0x80
[  117.851424]  entry_SYSCALL_64_fastpath+0x23/0xc2
[  117.851433] RIP: 0033:0x7f851f0245d7
[  117.851438] RSP: 002b:00007f84e8ea54c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[  117.851449] RAX: ffffffffffffffda RBX: 00007f838d7dd000 RCX: 00007f851f0245d7
[  117.851454] RDX: 00007f84e8ea5540 RSI: 00000000c020645d RDI: 0000000000000025
[  117.851459] RBP: 00007f84e8ea61d8 R08: 0000000000000002 R09: 0000000000000000
[  117.851464] R10: 00007f84e8ea5510 R11: 0000000000000246 R12: 000000000000812f
[  117.851469] R13: 0000000000000000 R14: 00007f84e8ea60e8 R15: 0000000000000000


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the amd-gfx mailing list