Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: "Welty, Brian" <brian.welty@intel.com>
Cc: Francois Dugast <francois.dugast@intel.com>,
	intel-xe@lists.freedesktop.org
Subject: Re: [Intel-xe] [PATCH v2 37/50] drm/xe/uapi: Convert tile_mask to a pt_placement_hint
Date: Thu, 9 Nov 2023 13:55:21 -0500	[thread overview]
Message-ID: <ZU0rGful8JOjd0x+@intel.com> (raw)
In-Reply-To: <4d0648c0-9665-4303-b64e-36365c804699@intel.com>

On Tue, Nov 07, 2023 at 04:17:51PM -0800, Welty, Brian wrote:
> 
> On 11/3/2023 7:34 AM, Francois Dugast wrote:
> > From: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > 
> > The previous tile_mask was also an optional hint, and only used
> > for the page-table tree placement. However, it was so tied
> > with the tile concept itself. Let's clarify things up and make
> > this generic enough. So accept any valid memory region mask.
> > It could even be a direct near_mem_region gotten from the engine_info.
> > pt stands for page table.
> > 
> > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > Signed-off-by: Francois Dugast <francois.dugast@intel.com>
> > ---
> >   drivers/gpu/drm/xe/xe_vm.c | 14 ++++++++++----
> >   include/uapi/drm/xe_drm.h  | 16 +++++++++++++---
> >   2 files changed, 23 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> > index 5538b0ed81e8..c7eb8d43bf33 100644
> > --- a/drivers/gpu/drm/xe/xe_vm.c
> > +++ b/drivers/gpu/drm/xe/xe_vm.c
> > @@ -3007,11 +3007,16 @@ int xe_vm_bind_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
> >   			goto release_vm_lock;
> >   		}
> > -		if (bind_ops[i].tile_mask) {
> > +		if (bind_ops[i].pt_placement_hint) {
> >   			u64 valid_tiles = BIT(xe->info.tile_count) - 1;
> > +			/*
> > +			 * System memory is currently ignored from this hint,
> > +			 * which gets entirely converted to a tile_mask
> > +			 */
> > +			u8 system_memory = 0x1;
> > -			if (XE_IOCTL_DBG(xe, bind_ops[i].tile_mask &
> > -					 ~valid_tiles)) {
> > +			if (XE_IOCTL_DBG(xe, bind_ops[i].pt_placement_hint &
> > +					 ~valid_tiles & ~system_memory)) {
> 
> But valid_tiles is not correct bitmask to use here as that is tiles, not a
> mask of VRAM regions...
> If pt_placement_hint is actually memory regions, I think you simply want:
> 	if (XE_IOCTL_DBG(xe, bind_ops[i].pt_placement_hint &
> ~xe->info.mem_region_mask) {

yes, this is a better check indeed. let's change.

> 
> 
> >   				err = -EINVAL;
> >   				goto release_vm_lock;
> >   			}
> > @@ -3088,7 +3093,8 @@ int xe_vm_bind_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
> >   		u32 op = bind_ops[i].op;
> >   		u32 flags = bind_ops[i].flags;
> >   		u64 obj_offset = bind_ops[i].obj_offset;
> > -		u8 tile_mask = bind_ops[i].tile_mask;
> > +		/* Remove the system memory bit when converting to tiles */
> > +		u8 tile_mask = bind_ops[i].pt_placement_hint & ~0x1;
> 
> Same as above...  conversion doesn't look right.
> If you want a tile_mask, don't you need to shift the pt_placement_hint ?
> So you want to convert XE_PL_VRAM0 and XE_PL_VRAM1 to a bitmask of tiles?
> I think you need:
>    tile_mask = bind_ops[i].pt_placement_hint  >> 1;

good catch, so we don't need to change the rest of the internal code.

> 
> -Brian
> 
> 
> >   		u32 prefetch_region = bind_ops[i].prefetch_mem_region_instance;
> >   		ops[i] = vm_bind_ioctl_ops_create(vm, bos[i], obj_offset,
> > diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h
> > index 35ce3605fc0b..2d0fb4386a69 100644
> > --- a/include/uapi/drm/xe_drm.h
> > +++ b/include/uapi/drm/xe_drm.h
> > @@ -850,10 +850,20 @@ struct drm_xe_vm_bind_op {
> >   	__u64 addr;
> >   	/**
> > -	 * @tile_mask: Mask for which tiles to create binds for, 0 == All tiles,
> > -	 * only applies to creating new VMAs
> > +	 * @pt_placement_hint: An optional memory_region bit-mask hint, which
> > +	 * only applies when creating new VMAs. Default value '0' is the
> > +	 * recommended value.
> > +	 *
> > +	 * It hints the optimal placement for the page-table tree for this VMA.
> > +	 * For instance, when userspace is using engines living in a secondary
> > +	 * tile with allocated BOs near those engines, that same
> > +	 * @near_mem_region could be used in this hint field.
> > +	 *
> > +	 * Since it is a hint, the Xe kernel driver is free to ignore this mask
> > +	 * and choose the best location for the page-table, taking into
> > +	 * consideration the running hardware and runtime constrains.
> >   	 */
> > -	__u64 tile_mask;
> > +	__u64 pt_placement_hint;
> >   #define DRM_XE_VM_BIND_OP_MAP		0x0
> >   #define DRM_XE_VM_BIND_OP_UNMAP		0x1

  reply	other threads:[~2023-11-09 18:56 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-03 14:34 [Intel-xe] [PATCH v2 00/50] uAPI Alignment - take 2 Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 01/50] fixup! drm/xe: Correlate engine and cpu timestamps with better accuracy Francois Dugast
2023-11-07 16:26   ` Lucas De Marchi
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 02/50] drm/xe/uapi: Add documentation for query Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 03/50] drm/xe: Extend drm_xe_vm_bind_op Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 04/50] drm/xe: Add uAPI to query micro-controler firmware version Francois Dugast
2023-11-09 15:37   ` Souza, Jose
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 05/50] drm/xe/uapi: Document DRM_XE_DEVICE_QUERY_HWCONFIG Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 06/50] drm/xe: Extend uAPI to query HuC micro-controler firmware version Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 07/50] drm/xe: Remove useless query config num_params Francois Dugast
2023-11-07 15:49   ` Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 08/50] drm/xe/uapi: Add missing DRM_ prefix in uAPI constants Francois Dugast
2023-11-07 14:05   ` Matthew Brost
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 09/50] drm/xe/uapi: Add _FLAG to uAPI constants usable for flags Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 10/50] fixup! drm/xe: Add uAPI to query micro-controler firmware version Francois Dugast
2023-11-07 14:07   ` Matthew Brost
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 11/50] drm/xe/uapi: Make constant comments visible in kernel doc Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 12/50] fixup! drm/xe: Correlate engine and cpu timestamps with better accuracy Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 13/50] drm/xe/uapi: Remove GT_TYPE_REMOTE Francois Dugast
2023-11-03 23:35   ` Matt Roper
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 14/50] drm/xe/uapi: Kill VM_MADVISE IOCTL Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 15/50] drm/xe/uapi: Separate bo_create placement from flags Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 16/50] drm/xe/uapi: Remove unused inaccessible memory region Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 17/50] drm/xe/uapi: Remove unused QUERY_CONFIG_MEM_REGION_COUNT Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 18/50] drm/xe/uapi: Remove unused QUERY_CONFIG_GT_COUNT Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 19/50] drm/xe/uapi: Rename *_mem_regions masks Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 20/50] drm/xe/uapi: Rename query's mem_usage to mem_regions Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 21/50] drm/xe: Make DRM_XE_DEVICE_QUERY_ENGINES future proof Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 22/50] drm/xe/uapi: Replace BO with GEM in documentation Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 23/50] drm/xe/pmu: Drop interrupt pmu event Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 24/50] xe/xe_bo: Reject bo creation of unaligned size Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 25/50] fixup! drm/xe: Make DRM_XE_DEVICE_QUERY_ENGINES future proof Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 26/50] drm/xe/uapi: Fix indentation issues that sometimes causes build warning Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 27/50] drm/xe/uapi: Order sections Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 28/50] drm/xe/uapi: More uAPI documentation additions and cosmetic updates Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 29/50] drm/xe/uapi: Split xe_sync types from flags Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 30/50] drm/xe/uapi: Standardize the FLAG naming and assignment Francois Dugast
2023-11-09 14:56   ` Matthew Brost
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 31/50] drm/xe/uapi: Differentiate WAIT_OP from WAIT_MASK Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 32/50] drm/xe/uapi: Move xe_exec after xe_exec_queue Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 33/50] fixup! drm/xe/uapi: Split xe_sync types from flags Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 34/50] drm/xe/uapi: Move memory_region masks from GT to engine Francois Dugast
2023-11-09 16:29   ` Souza, Jose
2023-11-09 16:35     ` Souza, Jose
2023-11-09 18:46       ` Rodrigo Vivi
2023-11-09 19:50         ` Souza, Jose
2023-11-09 21:04           ` Rodrigo Vivi
2023-11-16  3:31             ` Rodrigo Vivi
2023-11-16 16:15               ` Souza, Jose
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 35/50] drm/xe/uapi: Document the memory_region bitmask Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 36/50] drm/xe/uapi: Be more specific about the vm_bind prefetch region Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 37/50] drm/xe/uapi: Convert tile_mask to a pt_placement_hint Francois Dugast
2023-11-08  0:17   ` Welty, Brian
2023-11-09 18:55     ` Rodrigo Vivi [this message]
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 38/50] drm/xe/uapi: Rename couple exec_queue items Francois Dugast
2023-11-09 17:14   ` Souza, Jose
2023-11-09 18:40     ` Rodrigo Vivi
2023-11-09 20:02       ` Souza, Jose
2023-11-09 20:56         ` Rodrigo Vivi
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 39/50] drm/xe/uapi: Refactor engine information Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 40/50] drm/xe/uapi: Add link to Xe documentation Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 41/50] drm/xe/uapi: Crystal Reference Clock updates Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 42/50] drm/xe/uapi: Add Tile ID information to the GT info query Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 43/50] squash! drm/xe/uapi: Rename couple exec_queue items Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 44/50] fixup! drm/xe: Make DRM_XE_DEVICE_QUERY_ENGINES future proof Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 45/50] drm/xe/uapi: Remove bogus engine list from the wait_user_fence IOCTL Francois Dugast
2023-11-08  0:05   ` Welty, Brian
2023-11-09 18:56     ` Rodrigo Vivi
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 46/50] drm/xe/uapi: Align on a common way to return arrays (memory regions) Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 47/50] drm/xe/uapi: Align on a common way to return arrays (gt) Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 48/50] drm/xe/uapi: Align on a common way to return arrays (engines) Francois Dugast
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 49/50] drm/xe/uapi: Add block diagram of a device Francois Dugast
2023-11-09 15:35   ` Souza, Jose
2023-11-03 14:34 ` [Intel-xe] [PATCH v2 50/50] drm/xe/uapi: Add examples of user space code Francois Dugast
2023-11-03 14:38 ` [Intel-xe] ✓ CI.Patch_applied: success for uAPI Alignment - take 2 Patchwork
2023-11-03 14:39 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-11-03 14:40 ` [Intel-xe] ✓ CI.KUnit: success " Patchwork
2023-11-03 14:47 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-11-03 14:48 ` [Intel-xe] ✗ CI.Hooks: failure " Patchwork
2023-11-03 14:49 ` [Intel-xe] ✓ CI.checksparse: success " Patchwork
2023-11-03 15:24 ` [Intel-xe] ✗ CI.BAT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZU0rGful8JOjd0x+@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=brian.welty@intel.com \
    --cc=francois.dugast@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox