drm/mgag200: Add an option to disable Write-Combine
Subsystems (3)
Jocelyn Falempe
reviewerv2 cover drm/mgag200: Add an option to disable Write-Combine
Unfortunately, the G200 ioburst workaround doesn't work on some servers like Dell poweredge XR11, XR5610, or HPE XL260
In this case completely disabling WC is the only option to achieve low-latency.
It's probably useless to maintain two workarounds for this,
so I reverted commit bfa4437fd3938 drm/mgag200: Add a workaround for low-latency and added a new and simpler option, to just disable Write-Combine.
Jocelyn Falempe (2):
Revert "drm/mgag200: Add a workaround for low-latency" drm/mgag200: Add an option to disable Write-Combine
drivers/gpu/drm/mgag200/Kconfig | 18 ++++++++---------- drivers/gpu/drm/mgag200/mgag200_drv.c | 23 ++++++----------------- drivers/gpu/drm/mgag200/mgag200_mode.c | 8 -------- 3 files changed, 14 insertions(+), 35 deletions(-)
base-commit: 3179338750d83877bbc491493032bdf192266ad9
Signature · 1 line
2.45.0
Jocelyn Falempe
reviewerPATCH v2 1/2 Revert "drm/mgag200: Add a workaround for low-latency"
This reverts commit bfa4437fd3938ae2e186e7664b2db65bb8775670.
This workaround doesn't work reliably on all servers. I'll replace it with an option to disable Write-Combine, which has more impact on performance, but fix the latency issue on all hardware.
--- drivers/gpu/drm/mgag200/Kconfig | 12 ------------ drivers/gpu/drm/mgag200/mgag200_drv.c | 17 ----------------- drivers/gpu/drm/mgag200/mgag200_mode.c | 8 -------- 3 files changed, 37 deletions(-)
drivers/gpu/drm/mgag200/Kconfig +0 -12
@@ -11,15 +11,3 @@ config DRM_MGAG200 MGA G200 desktop chips and the server variants. It requires 0.3.0 of the modesetting userspace driver, and a version of mga driver that will fail on KMS enabled devices. - -config DRM_MGAG200_IOBURST_WORKAROUND - bool "Disable buffer caching" - depends on DRM_MGAG200 && PREEMPT_RT && X86 - help - Enable a workaround to avoid I/O bursts within the mgag200 driver at - the expense of overall display performance. - It restores the <v5.10 behavior, by mapping the framebuffer in system - RAM as Write-Combining, and flushing the cache after each write. - This is only useful on x86_64 if you want to run processes with - deterministic latency. - If unsure, say N.
drivers/gpu/drm/mgag200/mgag200_drv.c +0 -17
@@ -84,20 +84,6 @@ resource_size_t mgag200_probe_vram(void __iomem *mem, resource_size_t size)return offset -65536 ; } -#if defined(CONFIG_DRM_MGAG200_IOBURST_WORKAROUND ) -static struct drm_gem_object *mgag200_create_object (struct drm_device *dev,size_t size) -{ -struct drm_gem_shmem_object *shmem; - - shmem =kzalloc (sizeof (*shmem),GFP_KERNEL ); -if (!shmem) -return NULL ; - - shmem->map_wc = true; -return &shmem->base; -} -#endif -/* * DRM driver */
@@ -113,9 +99,6 @@ static const struct drm_driver mgag200_driver = { .major = DRIVER_MAJOR, .minor = DRIVER_MINOR, .patchlevel = DRIVER_PATCHLEVEL, -#if defined(CONFIG_DRM_MGAG200_IOBURST_WORKAROUND ) - .gem_create_object = mgag200_create_object, -#endif DRM_GEM_SHMEM_DRIVER_OPS, };
drivers/gpu/drm/mgag200/mgag200_mode.c +0 -8
@@ -13,7 +13,6 @@#include <drm/drm_atomic.h> #include <drm/drm_atomic_helper.h> -#include <drm/drm_cache.h> #include <drm/drm_damage_helper.h> #include <drm/drm_edid.h> #include <drm/drm_format_helper.h>
@@ -438,13 +437,6 @@ static void mgag200_handle_damage(struct mga_device *mdev, const struct iosys_maiosys_map_incr (&dst,drm_fb_clip_offset (fb->pitches[0 ], fb->format, clip));drm_fb_memcpy (&dst, fb->pitches, vmap, fb, clip); - -/* Flushing the cache greatly improves latency on x86_64 */ -#if defined(CONFIG_DRM_MGAG200_IOBURST_WORKAROUND ) -if (!vmap->is_iomem) -drm_clflush_virt_range (vmap->vaddr + clip->y1 * fb->pitches[0 ], -drm_rect_height (clip) * fb->pitches[0 ]); -#endif }/*
Signature · 1 line
2.45.0
Jocelyn Falempe
reviewerPATCH v2 2/2 drm/mgag200: Add an option to disable Write-Combine
In reply to Jocelyn FalempeUnfortunately, the G200 ioburst workaround doesn't work on some servers like Dell poweredge XR11, XR5610, or HPE XL260. In this case completely disabling WC is the only option to achieve low-latency. So this adds a new Kconfig option to disable WC mapping of the G200.
--- drivers/gpu/drm/mgag200/Kconfig | 10 ++++++++++ drivers/gpu/drm/mgag200/mgag200_drv.c | 6 ++++++ 2 files changed, 16 insertions(+)
drivers/gpu/drm/mgag200/Kconfig +10 -0
@@ -11,3 +11,13 @@ config DRM_MGAG200 MGA G200 desktop chips and the server variants. It requires 0.3.0 of the modesetting userspace driver, and a version of mga driver that will fail on KMS enabled devices. + +config DRM_MGAG200_DISABLE_WRITECOMBINE + bool "Disable Write Combine mapping of VRAM" + depends on DRM_MGAG200 && PREEMPT_RT + help + The VRAM of the G200 is mapped with Write-Combine to improve + performances. This can interfere with real-time tasks; even if they + are running on other CPU cores than the graphics output. + Enable this option only if you run realtime tasks on a server with a + Matrox G200.
drivers/gpu/drm/mgag200/mgag200_drv.c +6 -0
@@ -146,12 +146,18 @@ int mgag200_device_preinit(struct mga_device *mdev) } mdev->vram_res = res; +#if defined(CONFIG_DRM_MGAG200_DISABLE_WRITECOMBINE ) + mdev->vram =devm_ioremap (dev->dev, res->start,resource_size (res)); +if (!mdev->vram) +return -ENOMEM ; +#else mdev->vram =devm_ioremap_wc (dev->dev, res->start,resource_size (res));if (!mdev->vram)return -ENOMEM ;/* Don't fail on errors, but performance might be reduced. */ devm_arch_phys_wc_add (dev->dev, res->start,resource_size (res)); +#endif return 0 ; }
Signature · 1 line
2.45.0
Hi
Am 17.05.24 um 17:09 schrieb Jocelyn Falempe:
Quoted 6 lines
Unfortunately, the G200 ioburst workaround doesn't work on some servers like Dell poweredge XR11, XR5610, or HPE XL260. In this case completely disabling WC is the only option to achieve low-latency. So this adds a new
Kconfigoption to disable WC mapping of the G200.Signed-off-by Jocelyn Falempe <[email protected]>
Thanks a lot for the fix.
Best regards
Thomas
Quoted 47 lines
--- drivers/gpu/drm/mgag200/Kconfig | 10 ++++++++++ drivers/gpu/drm/mgag200/mgag200_drv.c | 6 ++++++ 2 files changed, 16 insertions(+)drivers/gpu/drm/mgag200/Kconfig +10
-0@@ -11,3 +11,13 @@ config DRM_MGAG200 MGA G200 desktop chips and the server variants. It requires 0.3.0 of the modesetting userspace driver, and a version of mga driver that will fail on KMS enabled devices. + +config DRM_MGAG200_DISABLE_WRITECOMBINE + bool "Disable Write Combine mapping of VRAM" + depends on DRM_MGAG200 && PREEMPT_RT + help + The VRAM of the G200 is mapped with Write-Combine to improve + performances. This can interfere with real-time tasks; even if they + are running on other CPU cores than the graphics output. + Enable this option only if you run realtime tasks on a server with a + Matrox G200.drivers/gpu/drm/mgag200/mgag200_drv.c +6
-0@@ -146,12 +146,18 @@ int mgag200_device_preinit(struct mga_device *mdev) } mdev->vram_res = res; +#if defined(CONFIG_DRM_MGAG200_DISABLE_WRITECOMBINE ) + mdev->vram =devm_ioremap (dev->dev, res->start,resource_size (res)); +if (!mdev->vram) +return -ENOMEM ; +#else mdev->vram =devm_ioremap_wc (dev->dev, res->start,resource_size (res));if (!mdev->vram)return -ENOMEM ;/* Don't fail on errors, but performance might be reduced. */ devm_arch_phys_wc_add (dev->dev, res->start,resource_size (res)); +#endif return 0 ; }
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Jocelyn Falempe
reviewerQuoted 8 lines · Thomas Zimmermann
Hi
Am 17.05.24 um 17:09 schrieb Jocelyn Falempe:
Quoted 5 lines
Unfortunately, the G200 ioburst workaround doesn't work on some servers like Dell poweredge XR11, XR5610, or HPE XL260. In this case completely disabling WC is the only option to achieve low-latency. So this adds a new
Kconfigoption to disable WC mapping of the G200.
Quoted 5 lines
Quoted 1 line
Signed-off-by Jocelyn Falempe <[email protected]>Reviewed-by Thomas Zimmermann <[email protected]>Thanks a lot for the fix.
Thanks for the review, I just merged it to drm-misc-next.
Quoted 51 lines
Best regards
ThomasQuoted 46 lines
---
drivers/gpu/drm/mgag200/Kconfig | 10 ++++++++++drivers/gpu/drm/mgag200/mgag200_drv.c| 6 ++++++2 files changed, 16 insertions(+)drivers/gpu/drm/mgag200/Kconfig +0
-0@@ -11,3 +11,13 @@ config DRM_MGAG200MGA G200 desktop chips and the server variants. It requires 0.3.0 of the modesetting userspace driver, and a version of mga driver that will fail on KMS enabled devices.
drivers/gpu/drm/mgag200/Kconfig +7
-0+ +config DRM_MGAG200_DISABLE_WRITECOMBINE + bool "Disable Write Combine mapping of VRAM" + depends on DRM_MGAG200 && PREEMPT_RT + help + The VRAM of the G200 is mapped with Write-Combine to improve + performances. This can interfere with real-time tasks; even ifthey
+ are running on other CPU cores than the graphics output. + Enable this option only if you run realtime tasks on a server with a
+ Matrox G200.
\ No newline at end of filedrivers/gpu/drm/mgag200/mgag200_drv.c +6
-0@@ -146,12 +146,18 @@ int mgag200_device_preinit(struct mga_device *mdev) } mdev->vram_res = res; +#if defined(CONFIG_DRM_MGAG200_DISABLE_WRITECOMBINE ) + mdev->vram = devm_ioremap(dev->dev, res->start, resource_size(res)); + if (!mdev->vram) + return -ENOMEM; +#else mdev->vram = devm_ioremap_wc(dev->dev, res->start, resource_size(res)); if (!mdev->vram) return -ENOMEM; /* Don't fail on errors, but performance might be reduced. */ devm_arch_phys_wc_add(dev->dev, res->start, resource_size(res)); +#endif return 0; }