[PATCH v3 0/4] drm/udl: Convert to SHMEM
Böszörményi Zoltán
zboszor at pr.hu
Fri Nov 8 12:06:04 UTC 2019
Hi!
2019. 11. 08. 8:36 keltezéssel, Thomas Zimmermann írta:
> Hi Böszörményi
FYI, it's Zoltan, as it's my first name. :-)
> Am 07.11.19 um 16:10 schrieb Böszörményi Zoltán:
> Have you tried to increase the buffer size? There's a command-line
> option to control this setting. [1]
Yes, I did, it didn't help. I used swiotlb=49152 (96MB) and
swiotlb=65536 (128MB) vs the default 32768 (64MB).
This parameter controls the _number of slab slots_ instead of
a single contiguous size as I read in the kernel sources.
With swiotlb=65536 I get the same error and dmesg lines:
[ 97.671898] udl 2-1.2:1.0: swiotlb buffer is full (sz: 1978368 bytes), total 65536
(slots), used 28 (slots)
[ 107.477068] udl 2-1.2:1.0: swiotlb buffer is full (sz: 524288 bytes), total 65536
(slots), used 584 (slots)
[ 108.311947] udl 2-1.2:1.0: swiotlb buffer is full (sz: 2080768 bytes), total 65536
(slots), used 0 (slots)
[ 110.330940] udl 2-1.2:1.0: swiotlb buffer is full (sz: 3031040 bytes), total 65536
(slots), used 56 (slots)
[ 111.102755] udl 2-1.2:1.0: swiotlb buffer is full (sz: 3145728 bytes), total 65536
(slots), used 1536 (slots)
It turned out, it's the combination of IO_TLB_SEGSIZE * (1<<IO_TLB_SHIFT)
that is too small. It is currently 128 * 2KB if I'm counting right in binary.
I have just tried with these settings in swiotlb.h:
#define IO_TLB_SHIFT 12
#define IO_TLB_SEGSIZE 1024
That's 4MB, used as contiguous DMA memory. The whole swiotlb aperture
is still 64MB, it's just that there is now a smaller number of larger buffers.
The warning messages were all about buffer sizes smaller than 4MB,
so I thought it worth a try and it indeed fixed the issue.
Now I can reliably reconfigure the monitor's orientation attached
to UDL in relation to the monitors attached to the Intel device.
I remember having the same "swiotlb buffer is full" issue during the late
2.6.x kernel series, around Fedora 27 or so, with the radeon driver.
I don't know if changing the swiotlb values is the proper solution, or
to add some scatter-gather interface somewhere in UDL or PRIME or whatever.
Now, where should I post this report? Kernel bugzilla? Or is this mail thread enough?
To get back to the topic of this patchset, you can add my:
Tested-by: Zoltán Böszörményi <zboszor at pr.hu>
Best regards,
Zoltán
>
> Best regards
> Thomas
>
> [1] https://wiki.gentoo.org/wiki/IOMMU_SWIOTLB
>
>
>> [ 133.320410] udl 2-1.2:1.0: overflow 0x00000001199e4000+2211840 of DMA
>> mask ffffffff bus mask 0
>> [ 133.320424] WARNING: CPU: 0 PID: 739 at kernel/dma/direct.c:35
>> report_addr+0x3e/0x70
>> [ 133.320425] Modules linked in: 8021q garp mrp stp llc intel_rapl_msr
>> intel_rapl_common x86_pkg_temp_thermal intel_powerclamp coretemp
>> kvm_intel snd_hda_codec_hdmi kvm snd_hda_codec_realt
>> ek snd_hda_codec_generic ledtrig_audio snd_hda_intel snd_hda_codec
>> iTCO_wdt elo irqbypass iTCO_vendor_support intel_cstate snd_hda_core
>> intel_uncore snd_hwdep intel_rapl_perf snd_pcm pcspkr
>> i2c_i801 snd_timer e1000e snd joydev lpc_ich soundcore ip6t_REJECT
>> nf_reject_ipv6 nf_log_ipv6 ip6table_filter ip6_tables nf_log_ipv4
>> nf_log_common xt_LOG xt_limit xt_multiport xt_conntrack
>> iptable_nat nf_nat xt_connmark nf_conntrack nf_defrag_ipv6
>> nf_defrag_ipv4 libcrc32c iptable_mangle i915 udl i2c_algo_bit
>> drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm cr
>> c32_pclmul crc32c_intel serio_raw video
>> [ 133.320463] CPU: 0 PID: 739 Comm: Xorg Not tainted 5.3.8 #1
>> [ 133.320465] Hardware name: TOSHIBA 4852E70/Intel H61 Express Chipset,
>> BIOS XBKT200 01/04/2017
>> [ 133.320467] EIP: report_addr+0x3e/0x70
>> [ 133.320470] Code: 00 89 4d f8 85 d2 74 44 8b 0a 8b 5a 04 ba fe ff ff
>> ff 39 ca ba 00 00 00 00 19 da 73 17 80 3d 9c 16 14 d0 00 0f 84 24 09 00
>> 00 <0f> 0b 8b 5d fc c9 c3 8d 76 00 8b 90 5c 01 00 00 0b 90 58 01 00 00
>> [ 133.320472] EAX: 00000000 EBX: 00000000 ECX: f5b89e00 EDX: 00000007
>> [ 133.320473] ESI: ffffffff EDI: ecf3921c EBP: ec56bcf4 ESP: ec56bce8
>> [ 133.320475] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS:
>> 00213286
>> [ 133.320476] CR0: 80050033 CR2: b7236020 CR3: 2c72a000 CR4: 000406f0
>> [ 133.320477] Call Trace:
>> [ 133.320484] dma_direct_map_page+0x158/0x180
>> [ 133.320487] dma_direct_map_sg+0x4f/0xa0
>> [ 133.320564] i915_gem_map_dma_buf+0x1b8/0x1d0 [i915]
>> [ 133.320568] dma_buf_map_attachment+0x4f/0x90
>> [ 133.320572] udl_gem_prime_import+0x43/0x12a [udl]
>> [ 133.320607] drm_gem_prime_fd_to_handle+0x97/0x180 [drm]
>> [ 133.320625] ? drm_gem_prime_export+0xa0/0xa0 [drm]
>> [ 133.320642] ? drm_gem_prime_import+0x20/0x20 [drm]
>> [ 133.320658] ? drm_prime_handle_to_fd_ioctl+0x70/0x70 [drm]
>> [ 133.320673] drm_prime_fd_to_handle_ioctl+0x2f/0x50 [drm]
>> [ 133.320689] drm_ioctl_kernel+0x8f/0xd0 [drm]
>> [ 133.320706] drm_ioctl+0x21c/0x3c0 [drm]
>> [ 133.320721] ? drm_prime_handle_to_fd_ioctl+0x70/0x70 [drm]
>> [ 133.320726] ? file_modified+0x30/0x30
>> [ 133.320728] ? file_update_time+0xfe/0x130
>> [ 133.320731] ? page_add_file_rmap+0x72/0xd0
>> [ 133.320734] ? fault_dirty_shared_page.isra.122+0x6d/0xb0
>> [ 133.320750] ? drm_version+0x80/0x80 [drm]
>> [ 133.320753] do_vfs_ioctl+0x9a/0x6c0
>> [ 133.320757] ksys_ioctl+0x56/0x80
>> [ 133.320760] sys_ioctl+0x16/0x20
>> [ 133.320763] do_fast_syscall_32+0x82/0x1c7
>> [ 133.320766] entry_SYSENTER_32+0x9f/0xf2
>> [ 133.320768] EIP: 0xb7f84a75
>> [ 133.320770] Code: e8 1c 00 00 00 89 d3 eb cf 8d 74 26 00 b8 40 42 0f
>> 00 eb b5 8b 04 24 c3 8b 1c 24 c3 8b 3c 24 c3 90 51 52 55 89 e5 0f 34 cd
>> 80 <5d> 5a 59 c3 90 90 90 90 8d 76 00 58 b8 77 00 00 00 cd 80 90 8d 76
>> [ 133.320772] EAX: ffffffda EBX: 0000000c ECX: c00c642e EDX: bff26be0
>> [ 133.320773] ESI: 0221ad20 EDI: c00c642e EBP: 0000000c ESP: bff26b88
>> [ 133.320775] DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 007b EFLAGS:
>> 00203296
>> [ 133.320777] ---[ end trace 18cd4f77716f2f5f ]---
>>
>> With your drm-next and your patch set, the call trace is obviously
>> different:
>>
>> [ 37.486584] udl 2-1.2:1.0: swiotlb buffer is full (sz: 536576 bytes),
>> total 32768 (slots), used 1536 (slots)
>> [ 37.486591] udl 2-1.2:1.0: overflow 0x000000011a47d000+536576 of DMA
>> mask ffffffff bus mask 0
>> [ 37.486598] ------------[ cut here ]------------
>> [ 37.486606] WARNING: CPU: 1 PID: 749 at kernel/dma/direct.c:35
>> report_addr+0x3e/0x70
>> [ 37.486607] Modules linked in: 8021q garp mrp stp llc intel_rapl_msr
>> intel_rapl_common x86_pkg_temp_thermal intel_powerclamp coretemp
>> kvm_intel kvm snd_hda_codec_hdmi snd_hda_codec_realt
>> ek snd_hda_codec_generic ledtrig_audio snd_hda_intel snd_intel_nhlt
>> snd_hda_codec iTCO_wdt iTCO_vendor_support elo irqbypass snd_hda_core
>> intel_cstate intel_uncore snd_hwdep snd_pcm intel_r
>> apl_perf e1000e pcspkr joydev i2c_i801 snd_timer lpc_ich snd soundcore
>> ip6t_REJECT nf_reject_ipv6 nf_log_ipv6 ip6table_filter ip6_tables
>> nf_log_ipv4 nf_log_common xt_LOG xt_limit xt_multipo
>> rt xt_conntrack iptable_nat nf_nat xt_connmark nf_conntrack
>> nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c iptable_mangle i915 udl
>> i2c_algo_bit drm_kms_helper syscopyarea sysfillrect crc32_pclmul
>> sysimgblt crc32c_intel fb_sys_fops serio_raw drm video
>> [ 37.486647] CPU: 1 PID: 749 Comm: Xorg Tainted: G W
>> 5.4.0-rc4+ #1
>> [ 37.486648] Hardware name: TOSHIBA 4852E70/Intel H61 Express Chipset,
>> BIOS XBKT200 01/04/2017
>> [ 37.486652] EIP: report_addr+0x3e/0x70
>> [ 37.486655] Code: 00 89 4d f8 85 d2 74 44 8b 0a 8b 5a 04 ba fe ff ff
>> ff 39 ca ba 00 00 00 00 19 da 73 17 80 3d b0 7d 95 d2 00 0f 84 c4 08 00
>> 00 <0f> 0b 8b 5d fc c9 c3 8d 76 00 8b 90 5c 01 00 00 0b 90 58 01 00 00
>> [ 37.486656] EAX: 00000000 EBX: 00000000 ECX: f68e3e00 EDX: 00000007
>> [ 37.486657] ESI: ed77f81c EDI: ffffffff EBP: ed1e5cfc ESP: ed1e5cf0
>> [ 37.486659] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS:
>> 00213286
>> [ 37.486661] CR0: 80050033 CR2: b7223020 CR3: 2cad8000 CR4: 000406f0
>> [ 37.486662] Call Trace:
>> [ 37.486669] dma_direct_map_page+0x158/0x180
>> [ 37.486673] dma_direct_map_sg+0x4f/0xa0
>> [ 37.486744] i915_gem_map_dma_buf+0x114/0x190 [i915]
>> [ 37.486748] dma_buf_map_attachment+0x4f/0x90
>> [ 37.486781] drm_gem_prime_import_dev+0x5d/0x100 [drm]
>> [ 37.486802] ? drm_prime_destroy_file_private+0x20/0x20 [drm]
>> [ 37.486821] drm_gem_prime_fd_to_handle+0x158/0x180 [drm]
>> [ 37.486838] ? drm_gem_prime_import+0x20/0x20 [drm]
>> [ 37.486854] ? drm_prime_destroy_file_private+0x20/0x20 [drm]
>> [ 37.486871] drm_prime_fd_to_handle_ioctl+0x21/0x30 [drm]
>> [ 37.486888] drm_ioctl_kernel+0x99/0xe0 [drm]
>> [ 37.486904] ? drm_prime_destroy_file_private+0x20/0x20 [drm]
>> [ 37.486922] drm_ioctl+0x21a/0x380 [drm]
>> [ 37.486938] ? drm_prime_destroy_file_private+0x20/0x20 [drm]
>> [ 37.486942] ? __send_signal+0x2a4/0x3e0
>> [ 37.486944] ? send_signal+0xb0/0xf0
>> [ 37.486946] ? do_send_sig_info+0x4b/0x80
>> [ 37.486963] ? drm_ioctl_kernel+0xe0/0xe0 [drm]
>> [ 37.486967] do_vfs_ioctl+0x3fa/0x6b0
>> [ 37.486969] ? kill_pid_info+0x31/0x60
>> [ 37.486973] ? ktime_get+0x4c/0x110
>> [ 37.486977] ksys_ioctl+0x5d/0x90
>> [ 37.486980] sys_ioctl+0x16/0x20
>> [ 37.486983] do_fast_syscall_32+0x82/0x1c7
>> [ 37.486988] entry_SYSENTER_32+0x9f/0xf2
>> [ 37.486989] EIP: 0xb7f75b55
>> [ 37.486992] Code: 00 00 8d 76 00 b8 40 42 0f 00 eb bb 8b 04 24 c3 8b
>> 14 24 c3 8b 1c 24 c3 8b 34 24 c3 8b 3c 24 c3 90 51 52 55 89 e5 0f 34 cd
>> 80 <5d> 5a 59 c3 90 90 90 90 8d 76 00 58 b8 77 00 00 00 cd 80 90 8d 76
>> [ 37.486994] EAX: ffffffda EBX: 0000000c ECX: c00c642e EDX: bfd13dc0
>> [ 37.486995] ESI: 01c03520 EDI: c00c642e EBP: 0000000c ESP: bfd13d68
>> [ 37.486997] DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 007b EFLAGS:
>> 00203292
>> [ 37.486999] ---[ end trace cef48717f4fbe0fa ]---
>>
>> It seems I get random successes with mostly failures of this kind:
>>
>> # DISPLAY=:0 xrandr --output DVI-I-1-1 --mode 1024x768 --below DP-1
>> xrandr: Configure crtc 2 failed
>> # DISPLAY=:0 xrandr --output DVI-I-1-1 --mode 1024x768 --right-of DP-1
>> xrandr: Configure crtc 2 failed
>>
>> These messages appear for failed attempts:
>>
>> [ 552.197202] udl 2-1.2:1.0: swiotlb buffer is full (sz: 360448 bytes),
>> total 32768 (slots), used 98 (slots)
>> [ 552.387539] udl 2-1.2:1.0: swiotlb buffer is full (sz: 819200 bytes),
>> total 32768 (slots), used 210 (slots)
>> [ 562.139080] udl 2-1.2:1.0: swiotlb buffer is full (sz: 2723840
>> bytes), total 32768 (slots), used 206 (slots)
>> [ 709.666258] udl 2-1.2:1.0: swiotlb buffer is full (sz: 2097152
>> bytes), total 32768 (slots), used 20 (slots)
>> [ 709.868665] udl 2-1.2:1.0: swiotlb buffer is full (sz: 2097152
>> bytes), total 32768 (slots), used 14 (slots)
>> [ 721.728930] udl 2-1.2:1.0: swiotlb buffer is full (sz: 3133440
>> bytes), total 32768 (slots), used 6 (slots)
>> [ 738.187591] udl 2-1.2:1.0: swiotlb buffer is full (sz: 524288 bytes),
>> total 32768 (slots), used 238 (slots)
>> [ 738.373190] udl 2-1.2:1.0: swiotlb buffer is full (sz: 950272 bytes),
>> total 32768 (slots), used 664 (slots)
>> [ 738.990204] udl 2-1.2:1.0: swiotlb buffer is full (sz: 983040 bytes),
>> total 32768 (slots), used 24 (slots)
>> [ 743.599439] udl 2-1.2:1.0: swiotlb buffer is full (sz: 2826240
>> bytes), total 32768 (slots), used 156 (slots)
>>
>> Best regards,
>> Zoltán Böszörményi
>>
>>>
>>> v3:
>>> * restore udl vmap function that enables caching
>>> v2:
>>> * remove obsolete udl code in a separate patch
>>>
>>> Thomas Zimmermann (4):
>>> drm/udl: Remove flags field from struct udl_gem_object
>>> drm/udl: Allocate GEM object via struct drm_driver.gem_create_object
>>> drm/udl: Switch to SHMEM
>>> drm/udl: Remove struct udl_gem_object and functions
>>>
>>> drivers/gpu/drm/udl/Kconfig | 1 +
>>> drivers/gpu/drm/udl/Makefile | 2 +-
>>> drivers/gpu/drm/udl/udl_dmabuf.c | 255 ------------------------------
>>> drivers/gpu/drm/udl/udl_drv.c | 30 +---
>>> drivers/gpu/drm/udl/udl_drv.h | 36 +----
>>> drivers/gpu/drm/udl/udl_fb.c | 66 ++++----
>>> drivers/gpu/drm/udl/udl_gem.c | 263 +++++++++----------------------
>>> 7 files changed, 122 insertions(+), 531 deletions(-)
>>> delete mode 100644 drivers/gpu/drm/udl/udl_dmabuf.c
>>>
>>> --
>>> 2.23.0
>>>
>>> _______________________________________________
>>> dri-devel mailing list
>>> dri-devel at lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>>>
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
More information about the dri-devel
mailing list