[PATCH v3 0/4] drm/udl: Convert to SHMEM
Thomas Zimmermann
tzimmermann at suse.de
Fri Nov 8 07:36:45 UTC 2019
Hi Böszörményi
Am 07.11.19 um 16:10 schrieb Böszörményi Zoltán:
> Hi,
>
> 2019. 11. 07. 10:43 keltezéssel, Thomas Zimmermann írta:
>> Udl's GEM implementation is mostly SHMEM and we should attempt to
>> replace it with the latter.
>>
>> Patches #1 and #2 update udl to simplify the conversion. In patch #3
>> the udl code is being replaced by SHMEM. The GEM object's mmap() and
>> free_object() functions are wrappers around their SHMEM counterparts.
>> For mmap() we fix-up the page-caching flags to distinguish between
>> write-combined and cached access. For free(), we have to unmap the
>> buffer's mapping that has been established by udl's fbdev code.
>> Patch #4 removes the obsolete udl code.
>>
>> The patchset has been tested by running the fbdev console, X11 and
>> Weston on a DisplayLink adapter.
>
> what's the trick to actually enable the UDL device?
>
> With 5.3.8, 5.3.9 or 5.4-rc6 + drm-next and this patchset, I get this:
>
> # DISPLAY=:0 xrandr --listproviders
> Providers: number : 2
> Provider 0: id: 0x76 cap: 0xf, Source Output, Sink Output, Source
> Offload, Sink Offload crtcs: 2 outputs: 3 associated providers: 0
> name:modesetting
> Provider 1: id: 0x41 cap: 0x2, Sink Output crtcs: 1 outputs: 1
> associated providers: 0 name:modesetting
>
> # DISPLAY=:0 xrandr --setprovideroutputsource 0x41 0x76
>
> # DISPLAY=:0 xrandr --listproviders
> Providers: number : 2
> Provider 0: id: 0x76 cap: 0xf, Source Output, Sink Output, Source
> Offload, Sink Offload crtcs: 2 outputs: 3 associated providers: 1
> name:modesetting
> Provider 1: id: 0x41 cap: 0x2, Sink Output crtcs: 1 outputs: 1
> associated providers: 1 name:modesetting
>
> # DISPLAY=:0 xrandr
> Screen 0: minimum 320 x 200, current 1024 x 768, maximum 8192 x 8192
> VGA-1 connected primary 1024x768+0+0 (normal left inverted right x axis
> y axis) 376mm x 301mm
> 1024x768 75.03*+ 60.00
> 1280x1024 60.02 +
> 1152x864 75.00
> 832x624 74.55
> 800x600 75.00 60.32
> 640x480 75.00 59.94
> 720x400 70.08
> HDMI-1 disconnected (normal left inverted right x axis y axis)
> DP-1 connected 1024x768+0+0 (normal left inverted right x axis y axis)
> 304mm x 228mm
> 1024x768 60.00*+
> DVI-I-1-1 connected (normal left inverted right x axis y axis)
> 1024x768 75.03 + 60.00
> 1920x1080 60.00 +
> 1680x1050 59.88
> 1280x1024 75.02 60.02
> 1440x900 74.98 59.90
> 1280x720 60.00
> 800x600 75.00 60.32
> 640x480 75.00 72.81 66.67 59.94
> 720x400 70.08
> 1024x768 (0x42) 78.750MHz +HSync +VSync
> h: width 1024 start 1040 end 1136 total 1312 skew 0 clock
> 60.02KHz
> v: height 768 start 769 end 772 total 800 clock
> 75.03Hz
> 1280x1024 (0x46) 108.000MHz +HSync +VSync
> h: width 1280 start 1328 end 1440 total 1688 skew 0 clock
> 63.98KHz
> v: height 1024 start 1025 end 1028 total 1066 clock
> 60.02Hz
> 1024x768 (0x4a) 65.000MHz -HSync -VSync
> h: width 1024 start 1048 end 1184 total 1344 skew 0 clock
> 48.36KHz
> v: height 768 start 771 end 777 total 806 clock
> 60.00Hz
> 800x600 (0x4b) 49.500MHz +HSync +VSync
> h: width 800 start 816 end 896 total 1056 skew 0 clock
> 46.88KHz
> v: height 600 start 601 end 604 total 625 clock
> 75.00Hz
> 800x600 (0x4c) 40.000MHz +HSync +VSync
> h: width 800 start 840 end 968 total 1056 skew 0 clock
> 37.88KHz
> v: height 600 start 601 end 605 total 628 clock
> 60.32Hz
> 640x480 (0x4d) 31.500MHz -HSync -VSync
> h: width 640 start 656 end 720 total 840 skew 0 clock
> 37.50KHz
> v: height 480 start 481 end 484 total 500 clock
> 75.00Hz
> 640x480 (0x50) 25.175MHz -HSync -VSync
> h: width 640 start 656 end 752 total 800 skew 0 clock
> 31.47KHz
> v: height 480 start 490 end 492 total 525 clock
> 59.94Hz
> 720x400 (0x51) 28.320MHz -HSync +VSync
> h: width 720 start 738 end 846 total 900 skew 0 clock
> 31.47KHz
> v: height 400 start 412 end 414 total 449 clock
> 70.08Hz
>
> # DISPLAY=:0 xrandr --output DVI-I-1-1 --mode 1024x768 --right-of DP-1
> xrandr: Configure crtc 2 failed
>
> Even after the last command, my monitor say "no signal" from the UDL
> (DL-195)
> device and dmesg has a kernel warning now:
>
> [ 133.320404] udl 2-1.2:1.0: swiotlb buffer is full (sz: 2211840
> bytes), total 32768 (slots), used 0 (slots)
Have you tried to increase the buffer size? There's a command-line
option to control this setting. [1]
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
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20191108/de08ebfb/attachment-0001.sig>
More information about the dri-devel
mailing list