huge gtt pages
Subsystems (2)
cover huge gtt pages
Not too different from the last posting, except we now request thp through our own tmpfs mount and try to support mixed gtt page sizes for a given object.
Matthew Auld (15):
drm/i915: really simple gemfs
drm/i915: enable THP for gemfs
drm/i915: introduce page_size_mask to dev_info drm/i915: introduce gem object page_sizes drm/i915: align the vma start to the largest gtt page size drm/i915: align 64K objects to 2M
drm/i915: pass mm.gtt_page_sizes to ppgtt insert_entries drm/i915: enable IPS bit for 64K pages
drm/i915: disable GTT cache for 2M/1G pages drm/i915: support huge gtt pages for the 48b PPGTT drm/i915: accurate page size tracking for the ppgtt drm/i915/debugfs: include some gtt page size metrics drm/i915: enable platform support for 64K pages drm/i915: enable platform support for 2M pages drm/i915: enable platform support for 1G pages
drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/i915_debugfs.c | 40 ++++++- drivers/gpu/drm/i915/i915_drv.h | 16 +++ drivers/gpu/drm/i915/i915_gem.c | 79 +++++++++++++- drivers/gpu/drm/i915/i915_gem_gtt.c | 113 +++++++++++++++++--- drivers/gpu/drm/i915/i915_gem_gtt.h | 16 ++- drivers/gpu/drm/i915/i915_gem_object.h | 7 ++ drivers/gpu/drm/i915/i915_gemfs.c | 128 +++++++++++++++++++++++ drivers/gpu/drm/i915/i915_pci.c | 29 +++++ drivers/gpu/drm/i915/i915_reg.h | 3 + drivers/gpu/drm/i915/i915_vma.c | 30 ++++++ drivers/gpu/drm/i915/intel_pm.c | 12 +-- drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 4 +- drivers/gpu/drm/i915/selftests/mock_gem_device.c | 18 +++- drivers/gpu/drm/i915/selftests/mock_gtt.c | 1 + 15 files changed, 470 insertions(+), 27 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_gemfs.c
Signature · 6 lines
2.9.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/15 drm/i915: really simple gemfs
Not a fully blown gemfs, just our very own tmpfs kernel mount. Doing so moves us away from the shmemfs shm_mnt, and gives us the much needed flexibility to do things like set our own mount options, namely huge= which should allow us to enable the use of transparent-huge-pages for our shmem backed objects.
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/i915_drv.h | 13 +++ drivers/gpu/drm/i915/i915_gem.c | 30 ++++++- drivers/gpu/drm/i915/i915_gemfs.c | 105 +++++++++++++++++++++++ drivers/gpu/drm/i915/selftests/mock_gem_device.c | 12 ++- 5 files changed, 159 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_gemfs.c
drivers/gpu/drm/i915/Makefile +1 -0
@@ -46,6 +46,7 @@ i915-y += i915_cmd_parser.o \ i915_gem_tiling.o \ i915_gem_timeline.o \ i915_gem_userptr.o \ + i915_gemfs.o \ i915_trace_points.o \ i915_vma.o \ intel_breadcrumbs.o \
drivers/gpu/drm/i915/i915_drv.h +13 -0
@@ -2227,6 +2227,9 @@ struct drm_i915_private {DECLARE_HASHTABLE (mm_structs,7 );struct mutex mm_lock; +/* Our tmpfs instance used for shmem backed objects */ +struct vfsmount *gemfs_mnt; +/* The hw wants to have a stable context identifier for the lifetime * of the context (for OA, PASID, faults, etc). This is limited * in execlists to 21 bits.
@@ -4169,4 +4172,14 @@ static inline bool i915_gem_object_is_coherent(struct drm_i915_gem_object *obj) HAS_LLC(to_i915(obj->base.dev))); } +/* i915_gemfs.c */ +struct vfsmount *i915_gemfs_create (void ); + +void i915_gemfs_destroy (struct vfsmount *gemfs_mnt); + +struct file *i915_gemfs_file_setup (struct vfsmount *gemfs_mnt, +const char *name,size_t size); + +int i915_gemfs_unlink (struct file *filp); +#endif
drivers/gpu/drm/i915/i915_gem.c +29 -1
@@ -4245,6 +4245,24 @@ static const struct drm_i915_gem_object_ops i915_gem_object_ops = { .pwrite = i915_gem_object_pwrite_gtt, }; +static int i915_drm_gem_object_init (struct drm_device *dev, +struct drm_gem_object *obj, +size_t size) +{ +struct drm_i915_private *i915 =to_i915 (dev); +struct file *filp; + +drm_gem_private_object_init (dev, obj, size); + + filp =i915_gemfs_file_setup (i915->gemfs_mnt,"i915 mm object" , size); +if (IS_ERR (filp)) +return PTR_ERR (filp); + + obj->filp = filp; + +return 0 ; +} +struct drm_i915_gem_object *i915_gem_object_create (struct drm_i915_private *dev_priv,u64 size) {
@@ -4268,7 +4286,7 @@ i915_gem_object_create(struct drm_i915_private *dev_priv, u64 size)if (obj ==NULL )return ERR_PTR (-ENOMEM ); - ret =drm_gem_object_init (&dev_priv->drm, &obj->base, size); + ret =i915_drm_gem_object_init (&dev_priv->drm, &obj->base, size);if (ret) goto fail;
@@ -4383,6 +4401,9 @@ static void __i915_gem_free_objects(struct drm_i915_private *i915,drm_prime_gem_destroy (&obj->base,NULL );reservation_object_fini (&obj->__builtin_resv); + +if (obj->base.filp) +i915_gemfs_unlink (obj->base.filp);drm_gem_object_release (&obj->base);i915_gem_info_remove_obj (i915, obj->base.size);
@@ -4843,6 +4864,10 @@ i915_gem_load_init(struct drm_i915_private *dev_priv) {int err = -ENOMEM ; + dev_priv->gemfs_mnt =i915_gemfs_create (); +if (IS_ERR (dev_priv->gemfs_mnt)) +return PTR_ERR (dev_priv->gemfs_mnt); + dev_priv->objects =KMEM_CACHE (drm_i915_gem_object,SLAB_HWCACHE_ALIGN );if (!dev_priv->objects) goto err_out;
@@ -4908,6 +4933,7 @@ i915_gem_load_init(struct drm_i915_private *dev_priv) err_objects:kmem_cache_destroy (dev_priv->objects); err_out: +i915_gemfs_destroy (dev_priv->gemfs_mnt);return err; }
@@ -4930,6 +4956,8 @@ void i915_gem_load_cleanup(struct drm_i915_private *dev_priv)/* And ensure that our DESTROY_BY_RCU slabs are truly destroyed */ rcu_barrier (); + +i915_gemfs_destroy (dev_priv->gemfs_mnt); }int i915_gem_freeze (struct drm_i915_private *dev_priv)
drivers/gpu/drm/i915/i915_gemfs.c new file +105 -0
105 lines not on this page · raw message
drivers/gpu/drm/i915/selftests/mock_gem_device.c +11 -1
@@ -80,6 +80,8 @@ static void mock_device_release(struct drm_device *dev)kmem_cache_destroy (i915->vmas);kmem_cache_destroy (i915->objects); +i915_gemfs_destroy (i915->gemfs_mnt); +drm_dev_fini (&i915->drm);put_device (&i915->drm.pdev->dev); }
@@ -167,9 +169,15 @@ struct drm_i915_private *mock_gem_device(void) i915->gt.awake = true; + i915->gemfs_mnt =i915_gemfs_create (); +if (IS_ERR (i915->gemfs_mnt)) { + err =PTR_ERR (i915->gemfs_mnt); + goto err_wq; + } + i915->objects =KMEM_CACHE (mock_object,SLAB_HWCACHE_ALIGN );if (!i915->objects) - goto err_wq; + goto err_gemfs; i915->vmas =KMEM_CACHE (i915_vma,SLAB_HWCACHE_ALIGN );if (!i915->vmas)
@@ -227,6 +235,8 @@ struct drm_i915_private *mock_gem_device(void)kmem_cache_destroy (i915->vmas); err_objects:kmem_cache_destroy (i915->objects); +err_gemfs: +i915_gemfs_destroy (i915->gemfs_mnt); err_wq:destroy_workqueue (i915->wq); put_device:
Signature · 6 lines
2.9.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 01/15] drm/i915: really simple gemfs
Quoted 5 lines · Matthew Auld
Not a fully blown gemfs, just our very own tmpfs kernel mount. Doing so moves us away from the shmemfs
shm_mnt, and gives us the much needed flexibility to do things like set our own mount options, namely huge= which should allow us to enable the use of transparent-huge-pages for our shmem backed objects.
After we get the kinks worked out, this should be in drm_gem.c With a default mountpoint, it should present the same interface to the existing users. But we will not be the only ones who will custom mount options. Even for ttm who may only use shmemfs for swap, with the advent of fast swapping for huge pages that will be win (if any improvement to swap hell can be a win!).
Just food for thought, not the actual review.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Joonas Lahtinen
maintainerRe: [PATCH 01/15] drm/i915: really simple gemfs
In reply to Matthew AuldQuoted 9 lines · Matthew Auld
Not a fully blown gemfs, just our very own tmpfs kernel mount. Doing so moves us away from the shmemfs
shm_mnt, and gives us the much needed flexibility to do things like set our own mount options, namely huge= which should allow us to enable the use of transparent-huge-pages for our shmem backed objects.Signed-off-by Matthew Auld <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Chris Wilson <[email protected]>
<SNIP>
drivers/gpu/drm/i915/i915_drv.h struct drm_i915_private { · line 2231
Quoted 7 lines
+++
b/drivers/gpu/drm/i915/i915_drv.hdrivers/gpu/drm/i915/i915_drv.h +0
-0@@ -2227,6 +2227,9 @@ struct drm_i915_private { DECLARE_HASHTABLE(mm_structs, 7); struct mutex mm_lock;drivers/gpu/drm/i915/i915_drv.h +2
-0+/* Our tmpfs instance used for shmem backed objects */ +struct vfsmount *gemfs_mnt;
"gemfs" might be good enough, should not cause any confusion?
Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.h +0
-0@@ -4169,4 +4172,14 @@ static inline bool i915_gem_object_is_coherent(struct drm_i915_gem_object *obj) HAS_LLC(to_i915(obj->base.dev))); }
+/*i915_gemfs.c*/
i915_gemfs.h please. Lets not bloat i915_drv.h more when effort is in place to strip it down.
Quoted 1 line
+struct vfsmount
*i915_gemfs_create(void);
Not "int gemfs_init(struct drm_i915_privat *i915)" and _fini?
I doubt we should be creating more of these.
Quoted 8 lines
drivers/gpu/drm/i915/i915_gem.c +0
-0@@ -4268,7 +4286,7 @@ i915_gem_object_create(struct drm_i915_private *dev_priv, u64 size) if (obj == NULL) return ERR_PTR(-ENOMEM);drivers/gpu/drm/i915/i915_gem.c +1
-1- ret =drm_gem_object_init (&dev_priv->drm, &obj->base, size); + ret =i915_drm_gem_object_init (&dev_priv->drm, &obj->base, size);if (ret)
goto fail;
As Chris mentioned, smells bit like we could be targeting DRM scope in the future.
Quoted 5 lines
drivers/gpu/drm/i915/i915_gem.c +0
-0@@ -4383,6 +4401,9 @@ static void __i915_gem_free_objects(struct drm_i915_private *i915, drm_prime_gem_destroy(&obj->base, NULL);
reservation_object_fini(&obj->__builtin_resv); +
For code below, do drop a note here that we want to do part of drm_gem_object_release's work in advance. Or rather than commenting, make it explicitly clear by having i915_gem_object_release() with this hunk of code.
drivers/gpu/drm/i915/i915_gem.c i915_gem_load_init(struct drm_i915_private *dev_priv) · line 4869
Quoted 12 lines
drivers/gpu/drm/i915/i915_gem.c +2
-0+if (obj->base.filp) +i915_gemfs_unlink (obj->base.filp);
drm_gem_object_release(&obj->base);i915_gem_info_remove_obj(i915, obj->base.size);drivers/gpu/drm/i915/i915_gem.c +0
-0@@ -4843,6 +4864,10 @@ i915_gem_load_init(struct drm_i915_private *dev_priv) { int err = -ENOMEM;drivers/gpu/drm/i915/i915_gem.c +3
-0+ dev_priv->gemfs_mnt =i915_gemfs_create (); +if (IS_ERR (dev_priv->gemfs_mnt)) +return PTR_ERR (dev_priv->gemfs_mnt);
err = i915_gemfs_init(dev_priv); if (err) return err;
Quoted 3 lines
+
dev_priv->objects=KMEM_CACHE(drm_i915_gem_object, SLAB_HWCACHE_ALIGN); if (!dev_priv->objects)
err = -ENOMEM; goto err_gemfs;
drivers/gpu/drm/i915/i915_gem.c void i915_gem_load_cleanup(struct drm_i915_private *dev_priv) · line 4960
Quoted 6 lines
(quoted diff) +0
-0@@ -4930,6 +4956,8 @@ void i915_gem_load_cleanup(struct drm_i915_private *dev_priv)
/* And ensure that ourDESTROY_BY_RCUslabs are truly destroyed */rcu_barrier();drivers/gpu/drm/i915/i915_gem.c +2
-0+ +i915_gemfs_destroy (dev_priv->gemfs_mnt);
i915_gemfs_fini();
Quoted 3 lines
drivers/gpu/drm/i915/i915_gemfs.c new file +3
-0+struct file *i915_gemfs_file_setup (struct vfsmount *gemfs_mnt, + const char *name, size_t size) +{
<SNIP>
drivers/gpu/drm/i915/i915_gemfs.c line 87
Quoted 5 lines
drivers/gpu/drm/i915/i915_gemfs.c new file +5
-0+ + inode =d_inode (path.dentry); + inode->i_size = size; + + res =alloc_file (&path,FMODE_WRITE |FMODE_READ , inode->i_fop);
shmem is passing their own fops, we don't need to? shmem_mmap seems to have some transparent huge page code at least which would be missed, no?
drivers/gpu/drm/i915/i915_gemfs.c line 96
Quoted 9 lines
drivers/gpu/drm/i915/i915_gemfs.c new file +9
-0+if (IS_ERR (res)) + goto unlink; + +return res; + +unlink: + dir->i_op->unlink (dir, path.dentry); +put_path: +path_put (&path);
Might throw newline here.
Regards, Joonas
Signature · 7 lines
Joonas Lahtinen Open Source Technology Center Intel Corporation _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 01/15] drm/i915: really simple gemfs
Quoted 100 lines · Joonas Lahtinen
Quoted 9 lines · Matthew Auld
Not a fully blown gemfs, just our very own tmpfs kernel mount. Doing so moves us away from the shmemfs
shm_mnt, and gives us the much needed flexibility to do things like set our own mount options, namely huge= which should allow us to enable the use of transparent-huge-pages for our shmem backed objects.Signed-off-by Matthew Auld <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Chris Wilson <[email protected]><SNIP>
drivers/gpu/drm/i915/i915_drv.h struct drm_i915_private { · line 2231
Quoted 7 lines
+++
b/drivers/gpu/drm/i915/i915_drv.hdrivers/gpu/drm/i915/i915_drv.h +2
-0@@ -2227,6 +2227,9 @@ struct drm_i915_private {DECLARE_HASHTABLE (mm_structs,7 );struct mutex mm_lock; +/* Our tmpfs instance used for shmem backed objects */ +struct vfsmount *gemfs_mnt;"gemfs" might be good enough, should not cause any confusion?
drivers/gpu/drm/i915/i915_drv.h static inline bool i915_gem_object_is_coherent(struct drm_i915_gem_object *obj) · line 4175
Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.h +1
-0@@ -4169,4 +4172,14 @@ static inline bool i915_gem_object_is_coherent(struct drm_i915_gem_object *obj) HAS_LLC(to_i915(obj->base.dev))); } +/* i915_gemfs.c */
i915_gemfs.hplease. Lets not bloati915_drv.hmore when effort is in place to strip it down.drivers/gpu/drm/i915/i915_drv.h static inline bool i915_gem_object_is_coherent(struct drm_i915_gem_object *obj) · line 4176
Quoted 1 line
drivers/gpu/drm/i915/i915_drv.h +1
-0+struct vfsmount *i915_gemfs_create (void );Not "int
gemfs_init(struct drm_i915_privat *i915)" and_fini?I doubt we should be creating more of these.
drivers/gpu/drm/i915/i915_gem.c i915_gem_object_create(struct drm_i915_private *dev_priv, u64 size) · line 4291
Quoted 8 lines
drivers/gpu/drm/i915/i915_gem.c +1
-1@@ -4268,7 +4286,7 @@ i915_gem_object_create(struct drm_i915_private *dev_priv, u64 size)if (obj ==NULL )return ERR_PTR (-ENOMEM ); - ret =drm_gem_object_init (&dev_priv->drm, &obj->base, size); + ret =i915_drm_gem_object_init (&dev_priv->drm, &obj->base, size);if (ret) goto fail;As Chris mentioned, smells bit like we could be targeting DRM scope in the future.
drivers/gpu/drm/i915/i915_gem.c static void __i915_gem_free_objects(struct drm_i915_private *i915, · line 4404
Quoted 5 lines
drivers/gpu/drm/i915/i915_gem.c +1
-0@@ -4383,6 +4401,9 @@ static void __i915_gem_free_objects(struct drm_i915_private *i915,drm_prime_gem_destroy (&obj->base,NULL );reservation_object_fini (&obj->__builtin_resv); +For code below, do drop a note here that we want to do part of drm_gem_object_release's work in advance. Or rather than commenting, make it explicitly clear by having
i915_gem_object_release()with this hunk of code.drivers/gpu/drm/i915/i915_gem.c i915_gem_load_init(struct drm_i915_private *dev_priv) · line 4869
Quoted 12 lines
drivers/gpu/drm/i915/i915_gem.c +5
-0+if (obj->base.filp) +i915_gemfs_unlink (obj->base.filp);drm_gem_object_release (&obj->base);i915_gem_info_remove_obj (i915, obj->base.size);@@ -4843,6 +4864,10 @@ i915_gem_load_init(struct drm_i915_private *dev_priv) {int err = -ENOMEM ; + dev_priv->gemfs_mnt =i915_gemfs_create (); +if (IS_ERR (dev_priv->gemfs_mnt)) +return PTR_ERR (dev_priv->gemfs_mnt);err = i915_gemfs_init(dev_priv); if (err) return err;drivers/gpu/drm/i915/i915_gem.c i915_gem_load_init(struct drm_i915_private *dev_priv) · line 4872
Quoted 3 lines
drivers/gpu/drm/i915/i915_gem.c +1
-0+ dev_priv->objects =KMEM_CACHE (drm_i915_gem_object,SLAB_HWCACHE_ALIGN );if (!dev_priv->objects)err = -ENOMEM; goto err_gemfs;drivers/gpu/drm/i915/i915_gem.c void i915_gem_load_cleanup(struct drm_i915_private *dev_priv) · line 4960
Quoted 6 lines
drivers/gpu/drm/i915/i915_gem.c +2
-0@@ -4930,6 +4956,8 @@ void i915_gem_load_cleanup(struct drm_i915_private *dev_priv)/* And ensure that our DESTROY_BY_RCU slabs are truly destroyed */ rcu_barrier (); + +i915_gemfs_destroy (dev_priv->gemfs_mnt);i915_gemfs_fini();Quoted 3 lines
drivers/gpu/drm/i915/i915_gemfs.c new file +3
-0+struct file *i915_gemfs_file_setup (struct vfsmount *gemfs_mnt, +const char *name,size_t size) +{<SNIP>
Quoted 9 lines
drivers/gpu/drm/i915/i915_gemfs.c line 87
Quoted 5 lines
drivers/gpu/drm/i915/i915_gemfs.c new file +5
-0+ + inode =d_inode (path.dentry); + inode->i_size = size; + + res =alloc_file (&path,FMODE_WRITE |FMODE_READ , inode->i_fop);shmem is passing their own fops, we don't need to?
shmem_mmapseems to have some transparent huge page code at least which would be missed, no?
We pass the same fops, since shmem_file_operations == inode->i_fop. See shmem_get_inode.
I'll try to address the other comments, thanks.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/15 drm/i915: enable THP for gemfs
In reply to Matthew AuldEnable transparent-huge-pages through gemfs by mounting with huge=within_size.
--- drivers/gpu/drm/i915/i915_gemfs.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/gpu/drm/i915/i915_gemfs.c +23 -0
@@ -25,6 +25,7 @@#include <linux/fs.h> #include <linux/file.h> #include <linux/mount.h> +#include <linux/pagemap.h> static const struct dentry_operations anon_ops = { .d_dname = simple_dname
@@ -41,6 +42,28 @@ struct vfsmount *i915_gemfs_create(void) gemfs_mnt =kern_mount (type); +#if defined(CONFIG_TRANSPARENT_HUGE_PAGECACHE ) +if (!IS_ERR (gemfs_mnt) &&has_transparent_hugepage ()) { +struct super_block *sb = gemfs_mnt->mnt_sb; +char options[] ="huge=within_size" ; +int flags =0 ; +int ret; + +/* Idealy we would just pass the mount options when mounting, +* but for some reason shmem chooses not to parse the options +* for MS_KERNMOUNT, probably because shm_mnt is the only tmpfs +* kernel mount other than this, where the mount options aren't +* used. To workaround this we do a remount, which is fairly +* inexpensive, where we know the options are never igonored. +*/ + ret = sb->s_op->remount_fs (sb, &flags, options); +if (ret) { +kern_unmount (gemfs_mnt); +return ERR_PTR (ret); + } + } +#endif +return gemfs_mnt; }
Signature · 6 lines
2.9.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Joonas Lahtinen
maintainerRe: [PATCH 02/15] drm/i915: enable THP for gemfs
Quoted 6 lines · Matthew Auld
Enable transparent-huge-pages through gemfs by mounting with huge=within_size.
Signed-off-by Matthew Auld <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Chris Wilson <[email protected]>
<SNIP>
Quoted 9 lines
(quoted diff) +0
-0@@ -41,6 +42,28 @@ struct vfsmount *i915_gemfs_create(void)
gemfs_mnt=kern_mount(type);drivers/gpu/drm/i915/i915_gemfs.c +5
-0+#if defined(CONFIG_TRANSPARENT_HUGE_PAGECACHE ) +if (!IS_ERR (gemfs_mnt) &&has_transparent_hugepage ()) { +struct super_block *sb = gemfs_mnt->mnt_sb; +char options[] ="huge=within_size" ; +int flags =0 ;
drivers/gpu/drm/i915/i915_gemfs.c struct vfsmount *i915_gemfs_create(void) · line 59
Quoted 10 lines
drivers/gpu/drm/i915/i915_gemfs.c +10
-0+int ret; + +/* Idealy we would just pass the mount options when mounting, +* but for some reason shmem chooses not to parse the options +* for MS_KERNMOUNT, probably because shm_mnt is the only tmpfs +* kernel mount other than this, where the mount options aren't +* used. To workaround this we do a remount, which is fairly +* inexpensive, where we know the options are never igonored. +*/ + ret = sb->s_op->remount_fs (sb, &flags, options);
This sounds like a bugfix to be sent.
Regards, Joonas
Signature · 7 lines
Joonas Lahtinen Open Source Technology Center Intel Corporation _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/15 drm/i915: introduce page_size_mask to dev_info
In reply to Matthew AuldIn preparation for huge gtt pages expose a page_size_mask as part of the device info, to indicate the page sizes supported by the HW. Currently only 4K is supported.
--- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_gem_gtt.h | 8 +++++++- drivers/gpu/drm/i915/i915_pci.c | 21 +++++++++++++++++++++ drivers/gpu/drm/i915/selftests/mock_gem_device.c | 3 +++ 4 files changed, 32 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -840,6 +840,7 @@ struct intel_device_info {enum intel_platform platform;u8 ring_mask;/* Rings supported by the HW */ u8 num_rings; +unsigned int page_size_mask;/* page sizes supported by the HW */ #define DEFINE_FLAG (name) u8 name:1DEV_INFO_FOR_EACH_FLAG (DEFINE_FLAG );#undef DEFINE_FLAG
drivers/gpu/drm/i915/i915_gem_gtt.h +7 -1
@@ -42,7 +42,13 @@#include "i915_gem_request.h" #include "i915_selftest.h" -#define I915_GTT_PAGE_SIZE 4096UL +#define I915_GTT_PAGE_SIZE_4K BIT(12) +#define I915_GTT_PAGE_SIZE_64K BIT(16) +#define I915_GTT_PAGE_SIZE_2M BIT(21) +#define I915_GTT_PAGE_SIZE_1G BIT(30) + +#define I915_GTT_PAGE_SIZE I915_GTT_PAGE_SIZE_4K +#define I915_GTT_MIN_ALIGNMENT I915_GTT_PAGE_SIZE#define I915_FENCE_REG_NONE -1
drivers/gpu/drm/i915/i915_pci.c +21 -0
@@ -56,6 +56,10 @@ .color = { .degamma_lut_size = 65, .gamma_lut_size = 257 }/* Keep in gen based order, and chronological order within a gen */ + +#define GEN_DEFAULT_PAGE_SIZES \ + .page_size_mask = I915_GTT_PAGE_SIZE_4K +#define GEN2_FEATURES \ .gen = 2, .num_pipes = 1, \ .has_overlay = 1, .overlay_needs_physical = 1, \
@@ -64,6 +68,7 @@ .unfenced_needs_alignment = 1, \ .ring_mask = RENDER_RING, \ GEN_DEFAULT_PIPEOFFSETS, \ + GEN_DEFAULT_PAGE_SIZES, \ CURSOR_OFFSETS static const struct intel_device_info intel_i830_info = {
@@ -96,6 +101,7 @@ static const struct intel_device_info intel_i865g_info = { .has_gmch_display = 1, \ .ring_mask = RENDER_RING, \ GEN_DEFAULT_PIPEOFFSETS, \ + GEN_DEFAULT_PAGE_SIZES, \ CURSOR_OFFSETS static const struct intel_device_info intel_i915g_info = {
@@ -158,6 +164,7 @@ static const struct intel_device_info intel_pineview_info = { .has_gmch_display = 1, \ .ring_mask = RENDER_RING, \ GEN_DEFAULT_PIPEOFFSETS, \ + GEN_DEFAULT_PAGE_SIZES, \ CURSOR_OFFSETS static const struct intel_device_info intel_i965g_info = {
@@ -198,6 +205,7 @@ static const struct intel_device_info intel_gm45_info = { .has_gmbus_irq = 1, \ .ring_mask = RENDER_RING | BSD_RING, \ GEN_DEFAULT_PIPEOFFSETS, \ + GEN_DEFAULT_PAGE_SIZES, \ CURSOR_OFFSETS static const struct intel_device_info intel_ironlake_d_info = {
@@ -222,6 +230,7 @@ static const struct intel_device_info intel_ironlake_m_info = { .has_gmbus_irq = 1, \ .has_aliasing_ppgtt = 1, \ GEN_DEFAULT_PIPEOFFSETS, \ + GEN_DEFAULT_PAGE_SIZES, \ CURSOR_OFFSETS static const struct intel_device_info intel_sandybridge_d_info = {
@@ -247,6 +256,7 @@ static const struct intel_device_info intel_sandybridge_m_info = { .has_aliasing_ppgtt = 1, \ .has_full_ppgtt = 1, \ GEN_DEFAULT_PIPEOFFSETS, \ + GEN_DEFAULT_PAGE_SIZES, \ IVB_CURSOR_OFFSETS static const struct intel_device_info intel_ivybridge_d_info = {
@@ -284,6 +294,7 @@ static const struct intel_device_info intel_valleyview_info = { .has_full_ppgtt = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING, .display_mmio_offset =VLV_DISPLAY_BASE , +GEN_DEFAULT_PAGE_SIZES ,GEN_DEFAULT_PIPEOFFSETS , CURSOR_OFFSETS };
@@ -308,6 +319,7 @@ static const struct intel_device_info intel_haswell_info = {#define BDW_FEATURES \ HSW_FEATURES, \ BDW_COLORS, \ + GEN_DEFAULT_PAGE_SIZES, \ .has_logical_ring_contexts = 1, \ .has_full_48bit_ppgtt = 1, \ .has_64bit_reloc = 1
@@ -342,13 +354,18 @@ static const struct intel_device_info intel_cherryview_info = { .has_aliasing_ppgtt = 1, .has_full_ppgtt = 1, .display_mmio_offset =VLV_DISPLAY_BASE , +GEN_DEFAULT_PAGE_SIZES ,GEN_CHV_PIPEOFFSETS ,CURSOR_OFFSETS , CHV_COLORS, }; +#define GEN9_DEFAULT_PAGE_SIZES \ + .page_size_mask = I915_GTT_PAGE_SIZE_4K +static const struct intel_device_info intel_skylake_info = {BDW_FEATURES , +GEN_DEFAULT_PAGE_SIZES , .platform =INTEL_SKYLAKE , .gen =9 , .has_csr = 1,
@@ -358,6 +375,7 @@ static const struct intel_device_info intel_skylake_info = {static const struct intel_device_info intel_skylake_gt3_info = {BDW_FEATURES , +GEN9_DEFAULT_PAGE_SIZES , .platform =INTEL_SKYLAKE , .gen =9 , .has_csr =1 ,
@@ -389,6 +407,7 @@ static const struct intel_device_info intel_skylake_gt3_info = { .has_aliasing_ppgtt = 1, \ .has_full_ppgtt = 1, \ .has_full_48bit_ppgtt =1 , \ +GEN9_DEFAULT_PAGE_SIZES , \GEN_DEFAULT_PIPEOFFSETS , \IVB_CURSOR_OFFSETS , \BDW_COLORS
@@ -409,6 +428,7 @@ static const struct intel_device_info intel_geminilake_info = {static const struct intel_device_info intel_kabylake_info = {BDW_FEATURES , +GEN9_DEFAULT_PAGE_SIZES , .platform =INTEL_KABYLAKE , .gen =9 , .has_csr =1 ,
@@ -418,6 +438,7 @@ static const struct intel_device_info intel_kabylake_info = {static const struct intel_device_info intel_kabylake_gt3_info = {BDW_FEATURES , +GEN9_DEFAULT_PAGE_SIZES , .platform =INTEL_KABYLAKE , .gen =9 , .has_csr =1 ,
drivers/gpu/drm/i915/selftests/mock_gem_device.c +3 -0
@@ -147,6 +147,9 @@ struct drm_i915_private *mock_gem_device(void)mkwrite_device_info (i915)->gen =-1 ; +mkwrite_device_info (i915)->page_size_mask = +I915_GTT_PAGE_SIZE_4K ; +spin_lock_init (&i915->mm.object_stat_lock);mock_uncore_init (i915);
Signature · 6 lines
2.9.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 03/15] drm/i915: introduce page_size_mask to dev_info
drivers/gpu/drm/i915/selftests/mock_gem_device.c struct drm_i915_private *mock_gem_device(void) · line 152
Quoted 11 lines · Matthew Auld
drivers/gpu/drm/i915/selftests/mock_gem_device.c +3
-0@@ -147,6 +147,9 @@ struct drm_i915_private *mock_gem_device(void)mkwrite_device_info (i915)->gen =-1 ; +mkwrite_device_info (i915)->page_size_mask = +I915_GTT_PAGE_SIZE_4K ; +
The next person to add mock device_info details will be moving these to a function. You have been warned.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 03/15] drm/i915: introduce page_size_mask to dev_info
In reply to Matthew AuldQuoted 8 lines · Matthew Auld
In preparation for huge gtt pages expose a
page_size_maskas part of the device info, to indicate the page sizes supported by the HW. Currently only 4K is supported.Signed-off-by Matthew Auld <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Mika Kuoppala <[email protected]>Cc Chris Wilson <[email protected]>
<SNIP>
I don't quite get why there can't be more inheritance when declaring these (Jani CC'd), but not related to this patch.
Quoted 29 lines
/* Keep in gen based order, and chronological order within a gen */
drivers/gpu/drm/i915/i915_pci.c +4
-0+ +#define GEN_DEFAULT_PAGE_SIZES \ + .page_size_mask = I915_GTT_PAGE_SIZE_4K +#define
GEN2_FEATURES\
.gen = 2, .num_pipes = 1, \
.has_overlay = 1, .overlay_needs_physical = 1, \drivers/gpu/drm/i915/i915_pci.c +1
-0@@ -64,6 +68,7 @@ .unfenced_needs_alignment = 1, \ .ring_mask = RENDER_RING, \ GEN_DEFAULT_PIPEOFFSETS, \ + GEN_DEFAULT_PAGE_SIZES, \
CURSOR_OFFSETS
static const structintel_device_infointel_i830_info= {drivers/gpu/drm/i915/i915_pci.c +1
-0@@ -96,6 +101,7 @@ static const struct intel_device_info intel_i865g_info = { .has_gmch_display = 1, \ .ring_mask = RENDER_RING, \ GEN_DEFAULT_PIPEOFFSETS, \ + GEN_DEFAULT_PAGE_SIZES, \
CURSOR_OFFSETS
static const structintel_device_infointel_i915g_info= {drivers/gpu/drm/i915/i915_pci.c +1
-0@@ -158,6 +164,7 @@ static const struct intel_device_info intel_pineview_info = { .has_gmch_display = 1, \ .ring_mask = RENDER_RING, \ GEN_DEFAULT_PIPEOFFSETS, \ + GEN_DEFAULT_PAGE_SIZES, \
Quoted 1 line
CURSOR_OFFSETS
And goes on... Seems repetitive.
Regards, Joonas
Signature · 7 lines
Joonas Lahtinen Open Source Technology Center Intel Corporation _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 03/15] drm/i915: introduce page_size_mask to dev_info
Quoted 10 lines · Joonas Lahtinen
Quoted 8 lines · Matthew Auld
In preparation for huge gtt pages expose a
page_size_maskas part of the device info, to indicate the page sizes supported by the HW. Currently only 4K is supported.Signed-off-by Matthew Auld <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Mika Kuoppala <[email protected]>Cc Chris Wilson <[email protected]>
Quoted 4 lines
<SNIP>
I don't quite get why there can't be more inheritance when declaring these (Jani CC'd), but not related to this patch.
Yeah, could use more inheritance, but can also be follow-up. *shrug*
BR,
Jani.
Quoted 37 lines
Quoted 29 lines
/* Keep in gen based order, and chronological order within a gen */
drivers/gpu/drm/i915/i915_pci.c +4
-0+ +#define GEN_DEFAULT_PAGE_SIZES \ + .page_size_mask = I915_GTT_PAGE_SIZE_4K +#define
GEN2_FEATURES\
.gen = 2, .num_pipes = 1, \
.has_overlay = 1, .overlay_needs_physical = 1, \drivers/gpu/drm/i915/i915_pci.c +1
-0@@ -64,6 +68,7 @@ .unfenced_needs_alignment = 1, \ .ring_mask = RENDER_RING, \ GEN_DEFAULT_PIPEOFFSETS, \ + GEN_DEFAULT_PAGE_SIZES, \
CURSOR_OFFSETS
static const structintel_device_infointel_i830_info= {drivers/gpu/drm/i915/i915_pci.c +1
-0@@ -96,6 +101,7 @@ static const struct intel_device_info intel_i865g_info = { .has_gmch_display = 1, \ .ring_mask = RENDER_RING, \ GEN_DEFAULT_PIPEOFFSETS, \ + GEN_DEFAULT_PAGE_SIZES, \
CURSOR_OFFSETS
static const structintel_device_infointel_i915g_info= {drivers/gpu/drm/i915/i915_pci.c +1
-0@@ -158,6 +164,7 @@ static const struct intel_device_info intel_pineview_info = { .has_gmch_display = 1, \ .ring_mask = RENDER_RING, \ GEN_DEFAULT_PIPEOFFSETS, \ + GEN_DEFAULT_PAGE_SIZES, \Quoted 1 line
CURSOR_OFFSETSAnd goes on... Seems repetitive.
Reviewed-by Joonas Lahtinen <[email protected]>Regards, Joonas
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/15 drm/i915: introduce gem object page_sizes
In reply to Matthew AuldWe need to track the possible page sizes given the layout of the sg table, in preparation for supporting huge gtt pages. Note that this does in any way represent the real gtt page size usage.
--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/i915_gem.c | 38 +++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/i915_gem_object.h | 5 +++++ 3 files changed, 44 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -2896,6 +2896,8 @@ intel_info(const struct drm_i915_private *dev_priv)#define USES_PPGTT (dev_priv) (i915.enable_ppgtt)#define USES_FULL_PPGTT (dev_priv) (i915.enable_ppgtt >= 2)#define USES_FULL_48BIT_PPGTT (dev_priv) (i915.enable_ppgtt == 3) +#define HAS_PAGE_SIZE (dev_priv, page_size) \ + ((dev_priv)->info.page_size_mask & (page_size))#define HAS_OVERLAY (dev_priv) ((dev_priv)->info.has_overlay)#define OVERLAY_NEEDS_PHYSICAL (dev_priv) \
drivers/gpu/drm/i915/i915_gem.c +37 -1
@@ -2294,6 +2294,8 @@ void __i915_gem_object_put_pages(struct drm_i915_gem_object *obj,if (!IS_ERR (pages)) obj->ops->put_pages (obj, pages); + obj->mm.page_sizes.phys = obj->mm.page_sizes.sg =0 ; + unlock:mutex_unlock (&obj->mm.lock); }
@@ -2473,6 +2475,7 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj)void __i915_gem_object_set_pages (struct drm_i915_gem_object *obj,struct sg_table *pages) { +lockdep_assert_held (&obj->mm.lock); obj->mm.get_page.sg_pos = pages->sgl;
@@ -2516,6 +2519,13 @@ static int ____i915_gem_object_get_pages(struct drm_i915_gem_object *obj)*/ int __i915_gem_object_get_pages (struct drm_i915_gem_object *obj) { +struct drm_i915_private *i915 =to_i915 (obj->base.dev); +unsigned long supported_page_sizes =INTEL_INFO (i915)->page_size_mask; +struct scatterlist *sg; +unsigned int sg_mask =0 ; +unsigned int i; +unsigned int bit; +unsigned int max_page_size;int err; err =mutex_lock_interruptible (&obj->mm.lock);
@@ -2533,7 +2543,33 @@ int __i915_gem_object_get_pages(struct drm_i915_gem_object *obj) unlock:mutex_unlock (&obj->mm.lock); -return err; + +if (err) +return err; + +for_each_sg (obj->mm.pages->sgl, sg, obj->mm.pages->nents, i) + sg_mask |= sg->length; + +GEM_BUG_ON (!sg_mask); + + obj->mm.page_sizes.phys = sg_mask; + + obj->mm.page_sizes.sg =0 ; + +for_each_set_bit (bit, &supported_page_sizes,BITS_PER_LONG ) { +if (obj->mm.page_sizes.phys & ~0u << bit) + obj->mm.page_sizes.sg |=BIT (bit); + } + + max_page_size =BIT (fls64 (obj->mm.page_sizes.sg)-1 ); + +/* If were are actually dealing with a single page-size, mark it so */ +if (IS_ALIGNED (obj->mm.page_sizes.phys, max_page_size)) + obj->mm.page_sizes.sg = max_page_size; + +GEM_BUG_ON (!HAS_PAGE_SIZE (i915, obj->mm.page_sizes.sg)); + +return 0 ; }/* The 'mapping' part of i915_gem_object_pin_map() below */
drivers/gpu/drm/i915/i915_gem_object.h +5 -0
@@ -129,6 +129,11 @@ struct drm_i915_gem_object {struct sg_table *pages;void *mapping; +struct i915_page_sizes { +unsigned int phys; +unsigned int sg; + } page_sizes; +struct i915_gem_object_page_iter {struct scatterlist *sg_pos;unsigned int sg_idx;/* in pages, but 32bit eek! */
Signature · 6 lines
2.9.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 04/15] drm/i915: introduce gem object page_sizes
drivers/gpu/drm/i915/i915_gem.c int __i915_gem_object_get_pages(struct drm_i915_gem_object *obj) · line 2551
Quoted 12 lines · Matthew Auld
drivers/gpu/drm/i915/i915_gem.c +6
-1err =mutex_lock_interruptible (&obj->mm.lock);@@ -2533,7 +2543,33 @@ int __i915_gem_object_get_pages(struct drm_i915_gem_object *obj) unlock:mutex_unlock (&obj->mm.lock); -return err; + +if (err) +return err; + +for_each_sg (obj->mm.pages->sgl, sg, obj->mm.pages->nents, i) + sg_mask |= sg->length;
This is the worst place to put a loop over sg. Not only is this synchronous, but pages may not have been allocated yet. Using set_pages was at least correct in that regard! The interface I will keep nagging for is for each task to compute sg_mask as they populate the scatterlist, and then they pass sg_mask to __i915_gem_object_set_pages() alongside the pages.
Since this didn't fail BAT, that only means we do not have any userptr tests there...
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 04/15] drm/i915: introduce gem object page_sizes
In reply to Matthew Aulddrivers/gpu/drm/i915/i915_gem.c int __i915_gem_object_get_pages(struct drm_i915_gem_object *obj) · line 2568
Quoted 5 lines · Matthew Auld
drivers/gpu/drm/i915/i915_gem.c +5
-0+ max_page_size =BIT (fls64 (obj->mm.page_sizes.sg)-1 ); + +/* If were are actually dealing with a single page-size, mark it so */ +if (IS_ALIGNED (obj->mm.page_sizes.phys, max_page_size)) + obj->mm.page_sizes.sg = max_page_size;
Pardon?
If the physical page sizes is a multiple of the max sg->length (rounded to GTT page sizes), only use the max?
page_sizes.sg will already express the smallest unit that can be used to for the whole object (as well as the largest one that may be used opportunistically).
The current kselftests that mix sg chunk sizes are ignorant of the large pages sizes, it would be useful to add some that did mix huge pages. -Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/15 drm/i915: align the vma start to the largest gtt page size
In reply to Matthew AuldWhen inserting into a 48bit PPGTT we should the align the vma start address to the required page size boundary, to guarantee we use said page size in the gtt. If we are dealing with multiple page-sizes, we can't guarantee anything and just align to the largest. For soft pinning we don't force any alignment.
--- drivers/gpu/drm/i915/i915_vma.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/gpu/drm/i915/i915_vma.c +12 -0
@@ -485,6 +485,18 @@ i915_vma_insert(struct i915_vma *vma, u64 size, u64 alignment, u64 flags)if (ret) goto err_unpin; }else { +if (i915_vm_is_48bit (vma->vm) && + obj->mm.page_sizes.sg >I915_GTT_PAGE_SIZE ) { +unsigned int page_alignment = obj->mm.page_sizes.sg; + +/* Align to the largest and hope for the best */ +if (!is_power_of_2 (page_alignment)) + page_alignment =BIT (fls64 (page_alignment)-1 ); + + alignment =max_t (typeof (alignment), alignment, + page_alignment); + } + ret =i915_gem_gtt_insert (vma->vm, &vma->node, size, alignment, obj->cache_level, start, end, flags);
Signature · 6 lines
2.9.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 05/15] drm/i915: align the vma start to the largest gtt page size
Quoted 18 lines · Matthew Auld
When inserting into a 48bit PPGTT we should the align the vma start address to the required page size boundary, to guarantee we use said page size in the gtt. If we are dealing with multiple page-sizes, we can't guarantee anything and just align to the largest. For soft pinning we don't force any alignment.
Signed-off-by Matthew Auld <[email protected]>Cc Joonas Lahtinen <[email protected]>Cc Chris Wilson <[email protected]>--- drivers/gpu/drm/i915/i915_vma.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/gpu/drm/i915/i915_vma.c +0
-0
drivers/gpu/drm/i915/i915_vma.c i915_vma_insert(struct i915_vma *vma, u64 size, u64 alignment, u64 flags) · line 488
Quoted 4 lines
drivers/gpu/drm/i915/i915_vma.c +1
-0@@ -485,6 +485,18 @@ i915_vma_insert(struct i915_vma *vma, u64 size, u64 alignment, u64 flags)if (ret) goto err_unpin; }else { + if (i915_vm_is_48bit(vma->vm) &&
I would use end > 4G here. As that encapsulates the i915_vm_is_48bit() test and avoids us applying the extra padding to objects that must be tightly packed into the low 32bits.
drivers/gpu/drm/i915/i915_vma.c i915_vma_insert(struct i915_vma *vma, u64 size, u64 alignment, u64 flags) · line 494
Quoted 6 lines
drivers/gpu/drm/i915/i915_vma.c +6
-0+ obj->mm.page_sizes.sg > I915_GTT_PAGE_SIZE) { +unsigned int page_alignment = obj->mm.page_sizes.sg; + +/* Align to the largest and hope for the best */ +if (!is_power_of_2 (page_alignment)) + page_alignment =BIT (fls64 (page_alignment)-1 );
fls64() - 1 == ilog2()
BIT(ilog2()) == roundup_pow_of_two()
linux/log2.h is your friend.
drivers/gpu/drm/i915/i915_vma.c i915_vma_insert(struct i915_vma *vma, u64 size, u64 alignment, u64 flags) · line 497
Quoted 3 lines
drivers/gpu/drm/i915/i915_vma.c +3
-0+ + alignment =max_t (typeof (alignment), alignment, + page_alignment);
Make page_alignment be u64 and be happy.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/15 drm/i915: align 64K objects to 2M
In reply to Matthew AuldWe can't mix 64K and 4K pte's in the same page-table, so for now we align 64K objects to 2M to avoid any potential mixing. This is potentially wasteful but in reality shouldn't be too bad since this only applies to the virtual address space of a 48b PPGTT.
--- drivers/gpu/drm/i915/i915_vma.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/gpu/drm/i915/i915_vma.c +18 -0
@@ -479,6 +479,15 @@ i915_vma_insert(struct i915_vma *vma, u64 size, u64 alignment, u64 flags) goto err_unpin; } +/* A current limitation in our implementation is that 64K +* objects must be aligned to 2M, and given that we can't +* enforce this for soft pinning, we need to fallback to normal +* pages if don't meet this restriction. +*/ +if (obj->mm.page_sizes.sg ==I915_GTT_PAGE_SIZE_64K && + !IS_ALIGNED (offset | size,I915_GTT_PAGE_SIZE_2M )) + obj->mm.page_sizes.sg =I915_GTT_PAGE_SIZE ; + ret =i915_gem_gtt_reserve (vma->vm, &vma->node, size, offset, obj->cache_level, flags);
@@ -493,6 +502,15 @@ i915_vma_insert(struct i915_vma *vma, u64 size, u64 alignment, u64 flags)if (!is_power_of_2 (page_alignment)) page_alignment =BIT (fls64 (page_alignment)-1 ); +/* We can't mix 64K and 4K pte's in the same page-table (2M +* block), and so to avoid the ugliness and complexity of +* coloring we opt for just aligning 64K objects to 2M. +*/ +if (obj->mm.page_sizes.sg ==I915_GTT_PAGE_SIZE_64K ) { + page_alignment =I915_GTT_PAGE_SIZE_2M ; + size =roundup (size, page_alignment); + } + alignment =max_t (typeof (alignment), alignment, page_alignment); }
Signature · 6 lines
2.9.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 06/15] drm/i915: align 64K objects to 2M
Quoted 17 lines · Matthew Auld
We can't mix 64K and 4K pte's in the same page-table, so for now we align 64K objects to 2M to avoid any potential mixing. This is potentially wasteful but in reality shouldn't be too bad since this only applies to the virtual address space of a 48b PPGTT.
Suggested-by Chris Wilson <[email protected]>Signed-off-by Matthew Auld <[email protected]>Cc Joonas Lahtinen <[email protected]>--- drivers/gpu/drm/i915/i915_vma.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)drivers/gpu/drm/i915/i915_vma.c +0
-0
drivers/gpu/drm/i915/i915_vma.c i915_vma_insert(struct i915_vma *vma, u64 size, u64 alignment, u64 flags) · line 487
Quoted 9 lines
drivers/gpu/drm/i915/i915_vma.c +6
-0@@ -479,6 +479,15 @@ i915_vma_insert(struct i915_vma *vma, u64 size, u64 alignment, u64 flags) goto err_unpin; } +/* A current limitation in our implementation is that 64K +* objects must be aligned to 2M, and given that we can't +* enforce this for soft pinning, we need to fallback to normal +* pages if don't meet this restriction. +*/ + if (obj->mm.page_sizes.sg == I915_GTT_PAGE_SIZE_64K &&
page_sizes.sg > I915_GTT_PAGE_SIZE_4K.
drivers/gpu/drm/i915/i915_vma.c i915_vma_insert(struct i915_vma *vma, u64 size, u64 alignment, u64 flags) · line 488
Quoted 1 line
drivers/gpu/drm/i915/i915_vma.c +1
-0+ !IS_ALIGNED(offset | size, I915_GTT_PAGE_SIZE_2M))
Abusing the semantics of PAGE_SIZE_2M. It just happens to be the value you want, but it doesn't mean what you say.
Quoted 6 lines
drivers/gpu/drm/i915/i915_vma.c +2
-0+ obj->mm.page_sizes.sg =I915_GTT_PAGE_SIZE ; + ret =i915_gem_gtt_reserve (vma->vm, &vma->node, size, offset, obj->cache_level, flags);
drivers/gpu/drm/i915/i915_vma.c i915_vma_insert(struct i915_vma *vma, u64 size, u64 alignment, u64 flags) · line 509
Quoted 8 lines
drivers/gpu/drm/i915/i915_vma.c +5
-0@@ -493,6 +502,15 @@ i915_vma_insert(struct i915_vma *vma, u64 size, u64 alignment, u64 flags)if (!is_power_of_2 (page_alignment)) page_alignment =BIT (fls64 (page_alignment)-1 ); +/* We can't mix 64K and 4K pte's in the same page-table (2M +* block), and so to avoid the ugliness and complexity of +* coloring we opt for just aligning 64K objects to 2M. +*/ +if (obj->mm.page_sizes.sg ==I915_GTT_PAGE_SIZE_64K ) {
page_sizes.sg & SIZE_64K or page_sizes.sg > SIZE_4K
Also refer to earlier discussion that this should be vma->page_sizes here not obj.
drivers/gpu/drm/i915/i915_vma.c i915_vma_insert(struct i915_vma *vma, u64 size, u64 alignment, u64 flags) · line 511
Quoted 2 lines
drivers/gpu/drm/i915/i915_vma.c +2
-0+ page_alignment =I915_GTT_PAGE_SIZE_2M ; + size =roundup (size, page_alignment);
round_up.
Quoted 12 lines
drivers/gpu/drm/i915/i915_vma.c +2
-0+ } + alignment =max_t (typeof (alignment), alignment, page_alignment); }Signature · 6 lines
2.9.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 7/15 drm/i915: pass mm.gtt_page_sizes to ppgtt insert_entries
In reply to Matthew AuldIn preparation for supporting huge-pages for the ppgtt, we need to know the details of mm.page_sizes at insertion time, such that we can we can easily determine the page sizes we are allowed to use. This is especially true for 64K where we can't just arbitrarily use it, since we require aligning/padding the vm space to 2M, which sometimes we can't enforce.
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 24 ++++++++++++++++-------- drivers/gpu/drm/i915/i915_gem_gtt.h | 3 +++ drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 3 ++- drivers/gpu/drm/i915/selftests/mock_gtt.c | 1 + 4 files changed, 22 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +16 -8
@@ -208,7 +208,8 @@ static int ppgtt_bind_vma(struct i915_vma *vma, pte_flags |=PTE_READ_ONLY ; vma->vm->insert_entries (vma->vm, vma->pages, vma->node.start, - cache_level, pte_flags); + &vma->obj->mm.page_sizes, cache_level, + pte_flags);return 0 ; }
@@ -909,6 +910,7 @@ gen8_ppgtt_insert_pte_entries(struct i915_hw_ppgtt *ppgtt,static void gen8_ppgtt_insert_3lvl (struct i915_address_space *vm,struct sg_table *pages,u64 start, +struct i915_page_sizes *page_sizes,enum i915_cache_level cache_level,u32 unused) {
@@ -927,6 +929,7 @@ static void gen8_ppgtt_insert_3lvl(struct i915_address_space *vm,static void gen8_ppgtt_insert_4lvl (struct i915_address_space *vm,struct sg_table *pages,u64 start, +struct i915_page_sizes *page_sizes,enum i915_cache_level cache_level,u32 unused) {
@@ -1623,6 +1626,7 @@ static void gen6_ppgtt_clear_range(struct i915_address_space *vm,static void gen6_ppgtt_insert_entries (struct i915_address_space *vm,struct sg_table *pages,u64 start, +struct i915_page_sizes *page_sizes,enum i915_cache_level cache_level,u32 flags) {
@@ -2092,6 +2096,7 @@ static void gen8_ggtt_insert_page(struct i915_address_space *vm,static void gen8_ggtt_insert_entries (struct i915_address_space *vm,struct sg_table *st,u64 start, +struct i915_page_sizes *page_sizes,enum i915_cache_level level,u32 unused) {
@@ -2139,6 +2144,7 @@ static void gen6_ggtt_insert_page(struct i915_address_space *vm,static void gen6_ggtt_insert_entries (struct i915_address_space *vm,struct sg_table *st,u64 start, +struct i915_page_sizes *page_sizes,enum i915_cache_level level,u32 flags) {
@@ -2238,7 +2244,7 @@ static int bxt_vtd_ggtt_insert_entries__cb(void *_arg) {struct insert_entries *arg = _arg; -gen8_ggtt_insert_entries (arg->vm, arg->st, arg->start, arg->level,0 ); +gen8_ggtt_insert_entries (arg->vm, arg->st, arg->start,0 , arg->level,0 );bxt_vtd_ggtt_wa (arg->vm);return 0 ;
@@ -2247,6 +2253,7 @@ static int bxt_vtd_ggtt_insert_entries__cb(void *_arg)static void bxt_vtd_ggtt_insert_entries__BKL (struct i915_address_space *vm,struct sg_table *st,u64 start, +struct i915_page_sizes *page_sizes,enum i915_cache_level level,u32 unused) {
@@ -2318,6 +2325,7 @@ static void i915_ggtt_insert_page(struct i915_address_space *vm,static void i915_ggtt_insert_entries (struct i915_address_space *vm,struct sg_table *pages,u64 start, +struct i915_page_sizes *page_sizes,enum i915_cache_level cache_level,u32 unused) {
@@ -2353,7 +2361,7 @@ static int ggtt_bind_vma(struct i915_vma *vma, pte_flags |=PTE_READ_ONLY ;intel_runtime_pm_get (i915); - vma->vm->insert_entries (vma->vm, vma->pages, vma->node.start, + vma->vm->insert_entries (vma->vm, vma->pages, vma->node.start,0 , cache_level, pte_flags);intel_runtime_pm_put (i915);
@@ -2407,16 +2415,16 @@ static int aliasing_gtt_bind_vma(struct i915_vma *vma, goto err_pages; } - appgtt->base.insert_entries (&appgtt->base, - vma->pages, vma->node.start, + appgtt->base.insert_entries (&appgtt->base, vma->pages, + vma->node.start, + &vma->obj->mm.page_sizes, cache_level, pte_flags); }if (flags &I915_VMA_GLOBAL_BIND ) {intel_runtime_pm_get (i915); - vma->vm->insert_entries (vma->vm, - vma->pages, vma->node.start, - cache_level, pte_flags); + vma->vm->insert_entries (vma->vm, vma->pages, vma->node.start, +0 , cache_level, pte_flags);intel_runtime_pm_put (i915); }
drivers/gpu/drm/i915/i915_gem_gtt.h +3 -0
@@ -206,6 +206,8 @@ enum i915_cache_level;struct i915_vma ; +struct i915_page_sizes ; +struct i915_page_dma {struct page *page;union {
@@ -320,6 +322,7 @@ struct i915_address_space {void (*insert_entries)(struct i915_address_space *vm,struct sg_table *st,u64 start, +struct i915_page_sizes *page_sizes,enum i915_cache_level cache_level,u32 flags);void (*cleanup)(struct i915_address_space *vm);
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c +2 -1
@@ -256,7 +256,8 @@ static int lowlevel_hole(struct drm_i915_private *i915,break ; vm->insert_entries (vm, obj->mm.pages, addr, -I915_CACHE_NONE ,0 ); + &obj->mm.page_sizes,I915_CACHE_NONE , +0 ); } count = n;
drivers/gpu/drm/i915/selftests/mock_gtt.c +1 -0
@@ -35,6 +35,7 @@ static void mock_insert_page(struct i915_address_space *vm,static void mock_insert_entries (struct i915_address_space *vm,struct sg_table *st,u64 start, +struct i915_page_sizes *page_sizes,enum i915_cache_level level,u32 flags) { }
Signature · 6 lines
2.9.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 07/15] drm/i915: pass mm.gtt_page_sizes to ppgtt insert_entries
Quoted 6 lines · Matthew Auld
In preparation for supporting huge-pages for the ppgtt, we need to know the details of mm.page_sizes at insertion time, such that we can we can easily determine the page sizes we are allowed to use. This is especially true for 64K where we can't just arbitrarily use it, since we require aligning/padding the vm space to 2M, which sometimes we can't enforce.
I haven't considered the implications yet, but this information should be available on the vma. In principle, the intent here is to more or less do vma->vm->insert_entries(vma, flags); Just wondering how practical it will be to get the relevant bits into the vma. Looks doable at first glance, and it prevent the issue of having multiple vma cloberring the obj->mm.page_sizes.gtt.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 8/15 drm/i915: enable IPS bit for 64K pages
In reply to Matthew AuldBefore we can enable 64K pages through the IPS bit, we must first enable it through MMIO, otherwise the page-walker will simply ignore it.
--- drivers/gpu/drm/i915/i915_gem.c | 11 +++++++++++ drivers/gpu/drm/i915/i915_reg.h | 3 +++ 2 files changed, 14 insertions(+)
drivers/gpu/drm/i915/i915_gem.c +11 -0
@@ -4738,6 +4738,17 @@ int i915_gem_init_hw(struct drm_i915_private *dev_priv) } } +/* To support 64K PTE's we need to first enable the use of the +* Intermediate-Page-Size(IPS) bit of the PDE field via some magical +* mmio, otherwise the page-walker will simply ignore the IPS bit. This +* shouldn't be needed after GEN10. +*/ +if (HAS_PAGE_SIZE (dev_priv,I915_GTT_PAGE_SIZE_64K ) && +INTEL_GEN (dev_priv) <=10 ) +I915_WRITE (GEN8_GAMW_ECO_DEV_RW_IA , +I915_READ (GEN8_GAMW_ECO_DEV_RW_IA ) | +GAMW_ECO_ENABLE_64K_IPS_FIELD ); +i915_gem_init_swizzling (dev_priv);/*
drivers/gpu/drm/i915/i915_reg.h +3 -0
@@ -1993,6 +1993,9 @@ enum skl_disp_power_wells {#define GEN9_GAMT_ECO_REG_RW_IA _MMIO(0x4ab0)#define GAMT_ECO_ENABLE_IN_PLACE_DECOMPRESS (1<<18) +#define GEN8_GAMW_ECO_DEV_RW_IA _MMIO(0x4080) +#define GAMW_ECO_ENABLE_64K_IPS_FIELD 0xF +#define GAMT_CHKN_BIT_REG _MMIO(0x4ab8)#define GAMT_CHKN_DISABLE_DYNAMIC_CREDIT_SHARING (1<<28)
Signature · 6 lines
2.9.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 9/15 drm/i915: disable GTT cache for 2M/1G pages
In reply to Matthew AuldWhen SW enables the use of 2M/1G pages, it must disable the GTT cache.
--- drivers/gpu/drm/i915/intel_pm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +6 -6
@@ -8195,10 +8195,10 @@ static void broadwell_init_clock_gating(struct drm_i915_private *dev_priv)/* * WaGttCachingOffByDefault:bdw -* GTT cache may not work with big pages, so if those -* are ever enabled GTT cache may need to be disabled. +* The GTT cache must be disabled if the system is planning to use +* 2M/1G pages. */ -I915_WRITE (HSW_GTT_CACHE_EN ,GTT_CACHE_EN_ALL ); +I915_WRITE (HSW_GTT_CACHE_EN ,0 );/* WaKVMNotificationOnConfigChange:bdw */ I915_WRITE(CHICKEN_PAR2_1, I915_READ(CHICKEN_PAR2_1)
@@ -8474,10 +8474,10 @@ static void cherryview_init_clock_gating(struct drm_i915_private *dev_priv)gen8_set_l3sqc_credits (dev_priv,38 ,2 );/* -* GTT cache may not work with big pages, so if those -* are ever enabled GTT cache may need to be disabled. +* The GTT cache must be disabled if the system is planning to use +* 2M/1G pages. */ -I915_WRITE (HSW_GTT_CACHE_EN ,GTT_CACHE_EN_ALL ); +I915_WRITE (HSW_GTT_CACHE_EN ,0 ); }static void g4x_init_clock_gating (struct drm_i915_private *dev_priv)
Signature · 6 lines
2.9.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 09/15] drm/i915: disable GTT cache for 2M/1G pages
Quoted 27 lines · Matthew Auld
When SW enables the use of 2M/1G pages, it must disable the GTT cache.
Signed-off-by Matthew Auld <[email protected]>Cc Joonas Lahtinen <[email protected]>--- drivers/gpu/drm/i915/intel_pm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/intel_pm.c +3
-3@@ -8195,10 +8195,10 @@ static void broadwell_init_clock_gating(struct drm_i915_private *dev_priv)/* * WaGttCachingOffByDefault:bdw -* GTT cache may not work with big pages, so if those -* are ever enabled GTT cache may need to be disabled. +* The GTT cache must be disabled if the system is planning to use +* 2M/1G pages. */ -I915_WRITE (HSW_GTT_CACHE_EN ,GTT_CACHE_EN_ALL ); +I915_WRITE (HSW_GTT_CACHE_EN ,0 );/* WaKVMNotificationOnConfigChange:bdw */ I915_WRITE(CHICKEN_PAR2_1, I915_READ(CHICKEN_PAR2_1)
drivers/gpu/drm/i915/intel_pm.c static void cherryview_init_clock_gating(struct drm_i915_private *dev_priv) · line 8479
Quoted 8 lines
drivers/gpu/drm/i915/intel_pm.c +2
-2@@ -8474,10 +8474,10 @@ static void cherryview_init_clock_gating(struct drm_i915_private *dev_priv)gen8_set_l3sqc_credits (dev_priv,38 ,2 );/* -* GTT cache may not work with big pages, so if those -* are ever enabled GTT cache may need to be disabled. +* The GTT cache must be disabled if the system is planning to use +* 2M/1G pages. */
Cherryview doesn't support 48bit ppgtt so isn't using huge pages. -Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 10/15 drm/i915: support huge gtt pages for the 48b PPGTT
In reply to Matthew AuldSupport inserting huge gtt pages into the 48b PPGTT, including mixed-mode where we allow a mixture of gtt page sizes.
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 79 ++++++++++++++++++++++++++++++++++--- drivers/gpu/drm/i915/i915_gem_gtt.h | 5 +++ 2 files changed, 79 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +74 -5
@@ -934,17 +934,86 @@ static void gen8_ppgtt_insert_4lvl(struct i915_address_space *vm, u32 unused) {struct i915_hw_ppgtt *ppgtt =i915_vm_to_ppgtt (vm); +struct gen8_insert_pte idx =gen8_insert_pte (start); +struct i915_page_directory_pointer **pdps = ppgtt->pml4.pdps; +struct i915_page_directory_pointer *pdp = pdps[idx.pml4e]; +struct i915_page_directory *pd = pdp->page_directory[idx.pdpe]; +struct i915_page_table *pt = pd->page_table[idx.pde]; +gen8_pte_t *pdp_vaddr =kmap_atomic_px (pdp); +gen8_pte_t *pd_vaddr =kmap_atomic_px (pd); +gen8_pte_t *pt_vaddr =kmap_atomic_px (pt); +const gen8_pte_t pte_encode =gen8_pte_encode (0 , cache_level);struct sgt_dma iter = { .sg = pages->sgl, .dma =sg_dma_address (iter.sg), .max = iter.dma + iter.sg->length, }; -struct i915_page_directory_pointer **pdps = ppgtt->pml4.pdps; -struct gen8_insert_pte idx =gen8_insert_pte (start); -while (gen8_ppgtt_insert_pte_entries (ppgtt, pdps[idx.pml4e++], &iter, - &idx, cache_level)) -GEM_BUG_ON (idx.pml4e >=GEN8_PML4ES_PER_PML4 ); +do { +unsigned int page_size; + + pt_vaddr[idx.pte] = pte_encode | iter.dma; + page_size =I915_GTT_PAGE_SIZE ; + +if (!idx.pte && page_sizes->sg >I915_GTT_PAGE_SIZE ) { +dma_addr_t remaining = iter.max - iter.dma; + +if (unlikely (page_sizes->sg &I915_GTT_PAGE_SIZE_1G ) && + remaining >=I915_GTT_PAGE_SIZE_1G && !idx.pde) { + pdp_vaddr[idx.pdpe] = pte_encode |GEN8_PDPE_PS_1G | iter.dma; + page_size =I915_GTT_PAGE_SIZE_1G ; + }else if (page_sizes->sg &I915_GTT_PAGE_SIZE_2M && + remaining >=I915_GTT_PAGE_SIZE_2M ) { + pd_vaddr[idx.pde] = pte_encode |GEN8_PDE_PS_2M | iter.dma; + page_size =I915_GTT_PAGE_SIZE_2M ; +/* We don't support 64K in mixed mode for now */ + }else if (page_sizes->sg ==I915_GTT_PAGE_SIZE_64K ) { + pd_vaddr[idx.pde] |=GEN8_PDE_IPS_64K ; + } + } + + start += page_size; + iter.dma += page_size; +if (iter.dma >= iter.max) { + iter.sg =__sg_next (iter.sg); +if (!iter.sg) +break ; + + iter.dma =sg_dma_address (iter.sg); + iter.max = iter.dma + iter.sg->length; + } + + idx.pte =gen8_pte_index (start); +if (!idx.pte) { + idx.pde =gen8_pde_index (start); + +if (!idx.pde) { + idx.pdpe =gen8_pdpe_index (start); + +if (!idx.pdpe) { +GEM_BUG_ON (idx.pml4e >=GEN8_PML4ES_PER_PML4 ); + pdp = pdps[idx.pml4e++]; + +kunmap_atomic (pdp_vaddr); + pdp_vaddr =kmap_atomic_px (pdp); + } + + pd = pdp->page_directory[idx.pdpe]; + +kunmap_atomic (pd_vaddr); + pd_vaddr =kmap_atomic_px (pd); + } + + pt = pd->page_table[idx.pde]; + +kunmap_atomic (pt_vaddr); + pt_vaddr =kmap_atomic_px (pt); + } + }while (1 ); + +kunmap_atomic (pt_vaddr); +kunmap_atomic (pd_vaddr); +kunmap_atomic (pdp_vaddr); } static void gen8_free_page_tables(struct i915_address_space *vm,
drivers/gpu/drm/i915/i915_gem_gtt.h +5 -0
@@ -149,6 +149,11 @@ typedef u64 gen8_ppgtt_pml4e_t;#define GEN8_PPAT_ELLC_OVERRIDE (0<<2)#define GEN8_PPAT (i, x) ((u64)(x) << ((i) * 8)) +#define GEN8_PDE_IPS_64K BIT(11) +#define GEN8_PDE_PS_2M BIT(7) + +#define GEN8_PDPE_PS_1G BIT(7) +struct sg_table ;struct intel_rotation_info {
Signature · 6 lines
2.9.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 11/15 drm/i915: accurate page size tracking for the ppgtt
In reply to Matthew AuldNow that we support multiple page sizes for the ppgtt, it would be useful to track the real usage for debugging purposes.
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 10 ++++++++++ drivers/gpu/drm/i915/i915_gem_object.h | 2 ++ drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 1 + 3 files changed, 13 insertions(+)
drivers/gpu/drm/i915/i915_gem_gtt.c +10 -0
@@ -217,6 +217,8 @@ static int ppgtt_bind_vma(struct i915_vma *vma,static void ppgtt_unbind_vma (struct i915_vma *vma) { vma->vm->clear_range (vma->vm, vma->node.start, vma->size); + + vma->obj->mm.page_sizes.gtt =0 ; } static gen8_pte_t gen8_pte_encode(dma_addr_t addr,
@@ -924,6 +926,8 @@ static void gen8_ppgtt_insert_3lvl(struct i915_address_space *vm,gen8_ppgtt_insert_pte_entries (ppgtt, &ppgtt->pdp, &iter, &idx, cache_level); + + page_sizes->gtt =I915_GTT_PAGE_SIZE ; } static void gen8_ppgtt_insert_4lvl(struct i915_address_space *vm,
@@ -972,6 +976,8 @@ static void gen8_ppgtt_insert_4lvl(struct i915_address_space *vm, } } + page_sizes->gtt |= page_size; + start += page_size; iter.dma += page_size;if (iter.dma >= iter.max) {
@@ -1731,6 +1737,8 @@ static void gen6_ppgtt_insert_entries(struct i915_address_space *vm, } }while (1 );kunmap_atomic (vaddr); + + page_sizes->gtt =I915_GTT_PAGE_SIZE ; } static int gen6_alloc_va_range(struct i915_address_space *vm,
@@ -2525,6 +2533,8 @@ static void aliasing_gtt_unbind_vma(struct i915_vma *vma)struct i915_address_space *vm = &i915->mm.aliasing_ppgtt->base; vm->clear_range (vm, vma->node.start, vma->size); + + vma->obj->mm.page_sizes.gtt =0 ; } }
drivers/gpu/drm/i915/i915_gem_object.h +2 -0
@@ -129,9 +129,11 @@ struct drm_i915_gem_object {struct sg_table *pages;void *mapping; +/* TODO: whack some of this into the error state */ struct i915_page_sizes {unsigned int phys;unsigned int sg; +unsigned int gtt; } page_sizes;struct i915_gem_object_page_iter {
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c +1 -0
@@ -267,6 +267,7 @@ static int lowlevel_hole(struct drm_i915_private *i915,GEM_BUG_ON (addr +BIT_ULL (size) > vm->total); vm->clear_range (vm, addr,BIT_ULL (size)); + obj->mm.page_sizes.gtt =0 ; }i915_gem_object_unpin_pages (obj);
Signature · 6 lines
2.9.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 12/15 drm/i915/debugfs: include some gtt page size metrics
In reply to Matthew AuldGood to know, mostly for debugging purposes.
--- drivers/gpu/drm/i915/i915_debugfs.c | 40 ++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +37 -3
@@ -117,6 +117,26 @@ static u64 i915_gem_obj_total_ggtt_size(struct drm_i915_gem_object *obj)return size; } +static const char *stringify_page_sizes (unsigned int page_sizes) +{ +switch (page_sizes) { +case I915_GTT_PAGE_SIZE_4K : +return "4K" ; +case I915_GTT_PAGE_SIZE_64K : +return "64K" ; +case I915_GTT_PAGE_SIZE_2M : +return "2M" ; +case I915_GTT_PAGE_SIZE_1G : +return "1G" ; +default : +/* mixed-mode? */ +if (page_sizes) +return "M" ; + +return "" ; + } +} +static void describe_obj (struct seq_file *m,struct drm_i915_gem_object *obj) {
@@ -128,7 +148,7 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)lockdep_assert_held (&obj->base.dev->struct_mutex); - seq_printf(m, "%pK: %c%c%c%c%c %8zdKiB %02x %02x %s%s%s", + seq_printf(m, "%pK: %c%c%c%c%c %8zdKiB %3s %02x %02x %s%s%s", &obj->base, get_active_flag(obj), get_pin_flag(obj),
@@ -136,6 +156,7 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)get_global_flag (obj),get_pin_mapped_flag (obj), obj->base.size /1024 , +stringify_page_sizes (obj->mm.page_sizes.gtt), obj->base.read_domains, obj->base.write_domain, i915_cache_level_str(dev_priv, obj->cache_level),
@@ -399,8 +420,8 @@ static int i915_gem_object_info(struct seq_file *m, void *data)struct drm_i915_private *dev_priv =node_to_i915 (m->private);struct drm_device *dev = &dev_priv->drm;struct i915_ggtt *ggtt = &dev_priv->ggtt; -u32 count, mapped_count, purgeable_count, dpy_count; -u64 size, mapped_size, purgeable_size, dpy_size; +u32 count, mapped_count, purgeable_count, dpy_count, huge_count; +u64 size, mapped_size, purgeable_size, dpy_size, huge_size;struct drm_i915_gem_object *obj;struct drm_file *file;int ret;
@@ -416,6 +437,7 @@ static int i915_gem_object_info(struct seq_file *m, void *data) size = count =0 ; mapped_size = mapped_count =0 ; purgeable_size = purgeable_count =0 ; + huge_size = huge_count =0 ;list_for_each_entry (obj, &dev_priv->mm.unbound_list, global_link) { size += obj->base.size; ++count;
@@ -429,6 +451,11 @@ static int i915_gem_object_info(struct seq_file *m, void *data) mapped_count++; mapped_size += obj->base.size; } + +if (obj->mm.page_sizes.gtt >I915_GTT_PAGE_SIZE ) { + huge_count++; + huge_size += obj->base.size; + } }seq_printf (m,"%u unbound objects, %llu bytes\n" , count, size);
@@ -451,6 +478,11 @@ static int i915_gem_object_info(struct seq_file *m, void *data) mapped_count++; mapped_size += obj->base.size; } + +if (obj->mm.page_sizes.gtt >I915_GTT_PAGE_SIZE ) { + huge_count++; + huge_size += obj->base.size; + } }seq_printf (m,"%u bound objects, %llu bytes\n" , count, size);
@@ -458,6 +490,8 @@ static int i915_gem_object_info(struct seq_file *m, void *data) purgeable_count, purgeable_size);seq_printf (m,"%u mapped objects, %llu bytes\n" , mapped_count, mapped_size); +seq_printf (m,"%u huge-paged objects, %llu bytes\n" , + huge_count, huge_size);seq_printf (m,"%u display objects (pinned), %llu bytes\n" , dpy_count, dpy_size);
Signature · 6 lines
2.9.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 13/15 drm/i915: enable platform support for 64K pages
In reply to Matthew AuldFor gen9+ enable platform level support for 64K pages. Also enable for mock testing.
--- drivers/gpu/drm/i915/i915_pci.c | 6 ++++-- drivers/gpu/drm/i915/selftests/mock_gem_device.c | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_pci.c +4 -2
@@ -354,14 +354,16 @@ static const struct intel_device_info intel_cherryview_info = { .has_aliasing_ppgtt = 1, .has_full_ppgtt = 1, .display_mmio_offset = VLV_DISPLAY_BASE, -GEN_DEFAULT_PAGE_SIZES , + .page_size_mask =I915_GTT_PAGE_SIZE_4K | +I915_GTT_PAGE_SIZE_64K ,GEN_CHV_PIPEOFFSETS ,CURSOR_OFFSETS , CHV_COLORS, };#define GEN9_DEFAULT_PAGE_SIZES \ - .page_size_mask = I915_GTT_PAGE_SIZE_4K + .page_size_mask = I915_GTT_PAGE_SIZE_4K | \ + I915_GTT_PAGE_SIZE_64Kstatic const struct intel_device_info intel_skylake_info = { BDW_FEATURES,
drivers/gpu/drm/i915/selftests/mock_gem_device.c +2 -1
@@ -148,7 +148,8 @@ struct drm_i915_private *mock_gem_device(void)mkwrite_device_info (i915)->gen =-1 ;mkwrite_device_info (i915)->page_size_mask = -I915_GTT_PAGE_SIZE_4K ; +I915_GTT_PAGE_SIZE_4K | +I915_GTT_PAGE_SIZE_64K ;spin_lock_init (&i915->mm.object_stat_lock);mock_uncore_init (i915);
Signature · 6 lines
2.9.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 14/15 drm/i915: enable platform support for 2M pages
In reply to Matthew AuldFor gen8+ enable platform level support for 2M pages. Also enable for mock testing.
--- drivers/gpu/drm/i915/i915_pci.c | 9 ++++++--- drivers/gpu/drm/i915/selftests/mock_gem_device.c | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_pci.c +6 -3
@@ -319,7 +319,8 @@ static const struct intel_device_info intel_haswell_info = {#define BDW_FEATURES \ HSW_FEATURES, \ BDW_COLORS, \ - GEN_DEFAULT_PAGE_SIZES, \ + .page_size_mask = I915_GTT_PAGE_SIZE_4K | \ + I915_GTT_PAGE_SIZE_2M, \ .has_logical_ring_contexts = 1, \ .has_full_48bit_ppgtt = 1, \ .has_64bit_reloc = 1
@@ -355,7 +356,8 @@ static const struct intel_device_info intel_cherryview_info = { .has_full_ppgtt = 1, .display_mmio_offset = VLV_DISPLAY_BASE, .page_size_mask =I915_GTT_PAGE_SIZE_4K | -I915_GTT_PAGE_SIZE_64K , +I915_GTT_PAGE_SIZE_64K | +I915_GTT_PAGE_SIZE_2M ,GEN_CHV_PIPEOFFSETS ,CURSOR_OFFSETS , CHV_COLORS,
@@ -363,7 +365,8 @@ static const struct intel_device_info intel_cherryview_info = {#define GEN9_DEFAULT_PAGE_SIZES \ .page_size_mask = I915_GTT_PAGE_SIZE_4K | \ - I915_GTT_PAGE_SIZE_64K + I915_GTT_PAGE_SIZE_64K | \ + I915_GTT_PAGE_SIZE_2Mstatic const struct intel_device_info intel_skylake_info = {BDW_FEATURES ,
drivers/gpu/drm/i915/selftests/mock_gem_device.c +2 -1
@@ -149,7 +149,8 @@ struct drm_i915_private *mock_gem_device(void)mkwrite_device_info (i915)->page_size_mask =I915_GTT_PAGE_SIZE_4K | -I915_GTT_PAGE_SIZE_64K ; +I915_GTT_PAGE_SIZE_64K | +I915_GTT_PAGE_SIZE_2M ;spin_lock_init (&i915->mm.object_stat_lock);mock_uncore_init (i915);
Signature · 6 lines
2.9.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 15/15 drm/i915: enable platform support for 1G pages
In reply to Matthew AuldFor gen8+ enable platform level support for 1G pages. Also enable for mock testing.
--- drivers/gpu/drm/i915/i915_pci.c | 9 ++++++--- drivers/gpu/drm/i915/selftests/mock_gem_device.c | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_pci.c +6 -3
@@ -320,7 +320,8 @@ static const struct intel_device_info intel_haswell_info = {HSW_FEATURES , \BDW_COLORS , \ .page_size_mask = I915_GTT_PAGE_SIZE_4K | \ -I915_GTT_PAGE_SIZE_2M , \ +I915_GTT_PAGE_SIZE_2M | \ +I915_GTT_PAGE_SIZE_1G , \ .has_logical_ring_contexts = 1, \ .has_full_48bit_ppgtt = 1, \ .has_64bit_reloc = 1
@@ -357,7 +358,8 @@ static const struct intel_device_info intel_cherryview_info = { .display_mmio_offset = VLV_DISPLAY_BASE, .page_size_mask =I915_GTT_PAGE_SIZE_4K |I915_GTT_PAGE_SIZE_64K | -I915_GTT_PAGE_SIZE_2M , +I915_GTT_PAGE_SIZE_2M | +I915_GTT_PAGE_SIZE_1G ,GEN_CHV_PIPEOFFSETS ,CURSOR_OFFSETS , CHV_COLORS,
@@ -366,7 +368,8 @@ static const struct intel_device_info intel_cherryview_info = {#define GEN9_DEFAULT_PAGE_SIZES \ .page_size_mask = I915_GTT_PAGE_SIZE_4K | \ I915_GTT_PAGE_SIZE_64K | \ - I915_GTT_PAGE_SIZE_2M + I915_GTT_PAGE_SIZE_2M | \ + I915_GTT_PAGE_SIZE_1Gstatic const struct intel_device_info intel_skylake_info = {BDW_FEATURES ,
drivers/gpu/drm/i915/selftests/mock_gem_device.c +2 -1
@@ -150,7 +150,8 @@ struct drm_i915_private *mock_gem_device(void)mkwrite_device_info (i915)->page_size_mask =I915_GTT_PAGE_SIZE_4K |I915_GTT_PAGE_SIZE_64K | -I915_GTT_PAGE_SIZE_2M ; +I915_GTT_PAGE_SIZE_2M | +I915_GTT_PAGE_SIZE_1G ;spin_lock_init (&i915->mm.object_stat_lock);mock_uncore_init (i915);
Signature · 6 lines
2.9.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for huge gtt pages
In reply to Matthew Auld== Series Details ==
== Series Details ==
Series: huge gtt pages
URL : https://patchwork.freedesktop.org/series/25118/
State : success
== Summary ==
Series 25118v1 huge gtt pages
https://patchwork.freedesktop.org/api/1.0/series/25118/revisions/1/mbox/
fi-bdw-5557u total:278 pass:267 dwarn:0 dfail:0 fail:0 skip:11 time:446s fi-bdw-gvtdvm total:278 pass:256 dwarn:8 dfail:0 fail:0 skip:14 time:438s fi-bsw-n3050 total:278 pass:242 dwarn:0 dfail:0 fail:0 skip:36 time:568s fi-bxt-j4205 total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:19 time:494s fi-byt-j1900 total:278 pass:254 dwarn:0 dfail:0 fail:0 skip:24 time:475s fi-byt-n2820 total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time:473s fi-hsw-4770 total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time:432s fi-hsw-4770r total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time:412s fi-ilk-650 total:278 pass:228 dwarn:0 dfail:0 fail:0 skip:50 time:412s fi-ivb-3520m total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time:491s fi-ivb-3770 total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time:462s fi-kbl-7500u total:278 pass:255 dwarn:5 dfail:0 fail:0 skip:18 time:463s fi-kbl-7560u total:278 pass:263 dwarn:5 dfail:0 fail:0 skip:10 time:566s fi-skl-6260u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:452s fi-skl-6700hq total:278 pass:239 dwarn:0 dfail:1 fail:17 skip:21 time:433s fi-skl-6700k total:278 pass:256 dwarn:4 dfail:0 fail:0 skip:18 time:465s fi-skl-6770hq total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:489s fi-skl-gvtdvm total:278 pass:265 dwarn:0 dfail:0 fail:0 skip:13 time:432s fi-snb-2520m total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time:533s fi-snb-2600 total:278 pass:249 dwarn:0 dfail:0 fail:0 skip:29 time:403s
593aae9587d79f8a823a36f4e6cc12e23b547d07 drm-tip: 2017y-05m-31d-14h-36m-16s UTC integration manifest 7f3e1da drm/i915: enable platform support for 1G pages
14bccb0 drm/i915: enable platform support for 2M pages
d4e64ea drm/i915: enable platform support for 64K pages
b31a68e drm/i915/debugfs: include some gtt page size metrics
4770028 drm/i915: accurate page size tracking for the ppgtt
2e4fbc8 drm/i915: support huge gtt pages for the 48b PPGTT
9e817e0 drm/i915: disable GTT cache for 2M/1G pages
f30b433 drm/i915: enable IPS bit for 64K pages
bfc2fa4 drm/i915: pass mm.gtt_page_sizes to ppgtt insert_entries
73ee6a0 drm/i915: align 64K objects to 2M
84d06ac drm/i915: align the vma start to the largest gtt page size
2fdf461 drm/i915: introduce gem object page_sizes
cfd5167 drm/i915: introduce page_size_mask to dev_info
79c3010 drm/i915: enable THP for gemfs
4738e84 drm/i915: really simple gemfs
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4847/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx