From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t v3 06/52] lib/intel_batchbuffer: Add allocator support in blitter src copy
Date: Thu, 05 Aug 2021 12:47:30 -0700 [thread overview]
Message-ID: <87eeb7u10t.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20210805072830.GA3295@zkempczy-mobl2>
On Thu, 05 Aug 2021 00:28:30 -0700, Zbigniew Kempczyński wrote:
>
Thanks for the responding. I have replied below, please see if anything
needs to be addressed but otherwise this is:
Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
> On Wed, Aug 04, 2021 at 04:26:32PM -0700, Dixit, Ashutosh wrote:
> > On Mon, 26 Jul 2021 12:59:40 -0700, Zbigniew Kempczyński wrote:
> > >
> > > @@ -808,9 +816,21 @@ void igt_blitter_src_copy(int fd,
> > > uint32_t src_pitch, dst_pitch;
> > > uint32_t dst_reloc_offset, src_reloc_offset;
> > > uint32_t gen = intel_gen(intel_get_drm_devid(fd));
> > > + uint64_t batch_offset, src_offset, dst_offset;
> > > const bool has_64b_reloc = gen >= 8;
> > > int i = 0;
> > >
> > > + batch_handle = gem_create(fd, 4096);
> > > + if (ahnd) {
> > > + src_offset = get_offset(ahnd, src_handle, src_size, 0);
> > > + dst_offset = get_offset(ahnd, dst_handle, dst_size, 0);
> > > + batch_offset = get_offset(ahnd, batch_handle, 4096, 0);
> > > + } else {
> > > + src_offset = 16 << 20;
> > > + dst_offset = ALIGN(src_offset + src_size, 1 << 20);
> > > + batch_offset = ALIGN(dst_offset + dst_size, 1 << 20);
> >
> > For the !ahnd case, we are providing relocations right? We still need to
> > provide these offsets or they can all be 0?
>
> Yes, we're providing relocations but we try to guess offsets to avoid them.
> If we guess valid offsets they will be used, if we missed and kernel decides
> to migrate vma(s) kernel will relocate and fill offsets within bb regardless
> NO_RELOC (it's just a hint - if vmas are not moved and you filled bb with
> them just skip relocations).
Yes this is as I thought as I said in the later mail.
> > > @@ -882,22 +902,29 @@ void igt_blitter_src_copy(int fd,
> > >
> > > igt_assert(i <= ARRAY_SIZE(batch));
> > >
> > > - batch_handle = gem_create(fd, 4096);
> > > gem_write(fd, batch_handle, 0, batch, sizeof(batch));
> > >
> > > - fill_relocation(&relocs[0], dst_handle, -1, dst_delta, dst_reloc_offset,
> > > + fill_relocation(&relocs[0], dst_handle, dst_offset,
> > > + dst_delta, dst_reloc_offset,
> > > I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER);
> > > - fill_relocation(&relocs[1], src_handle, -1, src_delta, src_reloc_offset,
> > > + fill_relocation(&relocs[1], src_handle, src_offset,
> > > + src_delta, src_reloc_offset,
> > > I915_GEM_DOMAIN_RENDER, 0);
> > >
> > > - fill_object(&objs[0], dst_handle, 0, NULL, 0);
> > > - fill_object(&objs[1], src_handle, 0, NULL, 0);
> > > - fill_object(&objs[2], batch_handle, 0, relocs, 2);
> > > + fill_object(&objs[0], dst_handle, dst_offset, NULL, 0);
> > > + fill_object(&objs[1], src_handle, src_offset, NULL, 0);
> > > + fill_object(&objs[2], batch_handle, batch_offset, relocs, 2);
> > >
> > > - objs[0].flags |= EXEC_OBJECT_NEEDS_FENCE;
> > > + objs[0].flags |= EXEC_OBJECT_NEEDS_FENCE | EXEC_OBJECT_WRITE;
> > > objs[1].flags |= EXEC_OBJECT_NEEDS_FENCE;
> > >
> > > - exec_blit(fd, objs, 3, gen, 0);
> > > + if (ahnd) {
> > > + objs[0].flags |= EXEC_OBJECT_PINNED | EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
> > > + objs[1].flags |= EXEC_OBJECT_PINNED | EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
> > > + objs[2].flags |= EXEC_OBJECT_PINNED | EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
> > > + }
> >
> > Should be add an "else" here and pull the fill_relocation() and set the
> > relocation_count to 2 only if we have !ahnd? Maybe ok to leave as is too if
> > the kernel will ignore the reloc stuff when EXEC_OBJECT_PINNED is set.
>
> We may pass relocs data to the kernel but check in no-reloc gens uses .relocation_count
> field. That's why we need to provide it zeroed.
>
> If you're asking why I haven't do else - I'm just a little bit lazy and I wanted
> avoid to additional else {} block. But if you think code would be more readable
> I will change it.
No it's ok, no need to change. But looks like the relocation_count above is
unconditionally set to 2 in both reloc and no-reloc case. If this works
then maybe relocation_count is ignored if EXEC_OBJECT_PINNED is set?
Otherwise we may to set it to 0 in the non-reloc case.
> > > @@ -584,10 +601,17 @@ static void work(int i915, int dmabuf, const intel_ctx_t *ctx, unsigned ring)
> > > obj[SCRATCH].handle = prime_fd_to_handle(i915, dmabuf);
> > >
> > > obj[BATCH].handle = gem_create(i915, size);
> > > + obj[BATCH].offset = get_offset(ahnd, obj[BATCH].handle, size, 0);
> > > obj[BATCH].relocs_ptr = (uintptr_t)store;
> > > - obj[BATCH].relocation_count = ARRAY_SIZE(store);
> > > + obj[BATCH].relocation_count = !ahnd ? ARRAY_SIZE(store) : 0;
> > > memset(store, 0, sizeof(store));
> > >
> > > + if (ahnd) {
> > > + obj[SCRATCH].flags = EXEC_OBJECT_PINNED | EXEC_OBJECT_WRITE;
> > > + obj[SCRATCH].offset = scratch_offset;
> > > + obj[BATCH].flags = EXEC_OBJECT_PINNED;
> > > + }
> >
> > Why don't we compute scratch_offset in work() itself (and rather pass it in
> > from the callers)?
>
> In work() we're not aware what scratch object size is. So there's hard to
> call get_offset() with size. So I need to pass size or offset, probably
> experience with other tests points me to pass offset instead size.
> Generally if we have some scratch and we want to use it within pipelined
> executions in same context we need to provide same offset for scratch,
> but offsets which are not busy for bb. Second is problematic with Simple allocator
> (see one of my previous email when I describe this problem) because scratch
> will have same offset - we want this, but bb will also have same offset.
> Using Reloc allocator at least gives us next offsets for bb, but we have
> to avoid using it twice or more for scratch).
Sorry, I did not realize scratch is not available in work. I would rather
pass scratch into the function but maybe it's ok as is too.
>
> >
> > > @@ -602,8 +626,8 @@ static void work(int i915, int dmabuf, const intel_ctx_t *ctx, unsigned ring)
> > > store[count].write_domain = I915_GEM_DOMAIN_INSTRUCTION;
> > > batch[i] = MI_STORE_DWORD_IMM | (gen < 6 ? 1 << 22 : 0);
> > > if (gen >= 8) {
> > > - batch[++i] = 0;
> > > - batch[++i] = 0;
> > > + batch[++i] = scratch_offset + store[count].delta;
> > > + batch[++i] = (scratch_offset + store[count].delta) >> 32;
> > > } else if (gen >= 4) {
> > > batch[++i] = 0;
> > > batch[++i] = 0;
> >
> > Should we add the offset's even for previous gen's (gen < 8)? Because I am
> > thinking at present kernel is supporting reloc's for gen < 12 but maybe
> > later kernels will discontinue them completely so we'll need to fix the
> > previous gen's all over again? Maybe too much?
>
> On older gens you'll definitely catch relocation here (presumed_offset == -1
> and lack of NO_RELOC flag).
>
> Newer kernels cannot remove relocations because on gens where you have no
> ppgtt you're not able to predict which offsets are busy or not. So passing
> offset here does nothing and relocation will overwrite it.
Ah ok, because multiple processes are sharing the global gtt. Thanks.
next prev parent reply other threads:[~2021-08-05 19:47 UTC|newest]
Thread overview: 102+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-26 19:59 [igt-dev] [PATCH i-g-t v3 00/52] Add allocator support in IGT Zbigniew Kempczyński
2021-07-26 19:59 ` [igt-dev] [PATCH i-g-t v3 01/52] lib/igt_dummyload: Add support of using allocator in igt spinner Zbigniew Kempczyński
2021-08-03 23:07 ` Dixit, Ashutosh
2021-08-04 6:19 ` Zbigniew Kempczyński
2021-07-26 19:59 ` [igt-dev] [PATCH i-g-t v3 02/52] lib/intel_allocator: Add few helper functions for common use Zbigniew Kempczyński
2021-08-03 21:01 ` Dixit, Ashutosh
2021-08-04 0:18 ` Dixit, Ashutosh
2021-08-04 6:13 ` Zbigniew Kempczyński
2021-08-05 18:53 ` Dixit, Ashutosh
2021-08-06 1:15 ` Dixit, Ashutosh
2021-08-06 5:51 ` Zbigniew Kempczyński
2021-08-06 5:35 ` Zbigniew Kempczyński
2021-08-06 5:52 ` Dixit, Ashutosh
2021-07-26 19:59 ` [igt-dev] [PATCH i-g-t v3 03/52] lib/igt_gt: Add passing ahnd as an argument to igt_hang Zbigniew Kempczyński
2021-08-03 23:15 ` Dixit, Ashutosh
2021-07-26 19:59 ` [igt-dev] [PATCH i-g-t v3 04/52] lib/intel_batchbuffer: Ensure relocation code will be called Zbigniew Kempczyński
2021-08-03 23:34 ` Dixit, Ashutosh
2021-07-26 19:59 ` [igt-dev] [PATCH i-g-t v3 05/52] lib/intel_batchbuffer: Add allocator support in blitter fast copy Zbigniew Kempczyński
2021-07-26 19:59 ` [igt-dev] [PATCH i-g-t v3 06/52] lib/intel_batchbuffer: Add allocator support in blitter src copy Zbigniew Kempczyński
2021-08-04 23:26 ` Dixit, Ashutosh
2021-08-04 23:44 ` Dixit, Ashutosh
2021-08-05 8:50 ` Zbigniew Kempczyński
2021-08-05 7:28 ` Zbigniew Kempczyński
2021-08-05 19:47 ` Dixit, Ashutosh [this message]
2021-08-06 6:17 ` Zbigniew Kempczyński
2021-07-26 19:59 ` [igt-dev] [PATCH i-g-t v3 07/52] lib/intel_batchbuffer: Try to avoid relocations in blitting Zbigniew Kempczyński
2021-08-04 23:42 ` Dixit, Ashutosh
2021-08-05 7:34 ` Zbigniew Kempczyński
2021-07-26 19:59 ` [igt-dev] [PATCH i-g-t v3 08/52] lib/huc_copy: Extend huc copy prototype to pass allocator handle Zbigniew Kempczyński
2021-08-05 0:31 ` Dixit, Ashutosh
2021-08-05 7:44 ` Zbigniew Kempczyński
2021-07-26 19:59 ` [igt-dev] [PATCH i-g-t v3 09/52] tests/gem_bad_reloc: Skip on gens where relocations are not supported Zbigniew Kempczyński
2021-08-05 0:33 ` Dixit, Ashutosh
2021-08-05 7:46 ` Zbigniew Kempczyński
2021-07-26 19:59 ` [igt-dev] [PATCH i-g-t v3 10/52] tests/gem_busy: Adopt to use allocator Zbigniew Kempczyński
2021-08-05 2:07 ` Dixit, Ashutosh
2021-08-05 8:02 ` Zbigniew Kempczyński
2021-08-05 21:14 ` Dixit, Ashutosh
2021-08-06 6:56 ` Zbigniew Kempczyński
2021-08-05 8:14 ` Zbigniew Kempczyński
2021-07-26 19:59 ` [igt-dev] [PATCH i-g-t v3 11/52] tests/gem_create: " Zbigniew Kempczyński
2021-08-05 2:14 ` Dixit, Ashutosh
2021-07-26 19:59 ` [igt-dev] [PATCH i-g-t v3 12/52] tests/gem_ctx_engines: " Zbigniew Kempczyński
2021-08-05 2:40 ` Dixit, Ashutosh
2021-07-26 19:59 ` [igt-dev] [PATCH i-g-t v3 13/52] tests/gem_ctx_exec: " Zbigniew Kempczyński
2021-08-05 3:06 ` Dixit, Ashutosh
2021-08-05 8:46 ` Zbigniew Kempczyński
2021-07-26 19:59 ` [igt-dev] [PATCH i-g-t v3 14/52] tests/gem_ctx_freq: " Zbigniew Kempczyński
2021-08-05 6:07 ` Dixit, Ashutosh
2021-07-26 19:59 ` [igt-dev] [PATCH i-g-t v3 15/52] tests/gem_ctx_isolation: " Zbigniew Kempczyński
2021-07-26 19:59 ` [igt-dev] [PATCH i-g-t v3 16/52] tests/gem_ctx_param: " Zbigniew Kempczyński
2021-08-05 7:18 ` Dixit, Ashutosh
2021-08-05 10:19 ` Zbigniew Kempczyński
2021-07-26 19:59 ` [igt-dev] [PATCH i-g-t v3 17/52] tests/gem_eio: " Zbigniew Kempczyński
2021-08-05 21:44 ` Dixit, Ashutosh
2021-08-06 7:16 ` Zbigniew Kempczyński
2021-07-26 19:59 ` [igt-dev] [PATCH i-g-t v3 18/52] tests/gem_exec_async: " Zbigniew Kempczyński
2021-08-06 1:43 ` Dixit, Ashutosh
2021-08-06 7:33 ` Zbigniew Kempczyński
2021-07-26 19:59 ` [igt-dev] [PATCH i-g-t v3 19/52] tests/gem_exec_big: Require relocation support Zbigniew Kempczyński
2021-07-26 19:59 ` [igt-dev] [PATCH i-g-t v3 20/52] tests/gem_exec_capture: Support gens without relocations Zbigniew Kempczyński
2021-07-26 19:59 ` [igt-dev] [PATCH i-g-t v3 21/52] tests/gem_exec_gttfill: Require relocation support Zbigniew Kempczyński
2021-07-26 19:59 ` [igt-dev] [PATCH i-g-t v3 22/52] tests/gem_exec_store: Support gens without relocations Zbigniew Kempczyński
2021-07-26 19:59 ` [igt-dev] [PATCH i-g-t v3 23/52] tests/gem_exec_suspend: Adopt to use allocator Zbigniew Kempczyński
2021-08-06 2:15 ` Dixit, Ashutosh
2021-07-26 19:59 ` [igt-dev] [PATCH i-g-t v3 24/52] tests/gem_exec_parallel: Adopt to use alloctor Zbigniew Kempczyński
2021-08-06 4:39 ` Dixit, Ashutosh
2021-07-26 19:59 ` [igt-dev] [PATCH i-g-t v3 25/52] tests/gem_exec_params: Support gens without relocations Zbigniew Kempczyński
2021-07-26 20:00 ` [igt-dev] [PATCH i-g-t v3 26/52] tests/gem_mmap: Add allocator support Zbigniew Kempczyński
2021-07-26 20:00 ` [igt-dev] [PATCH i-g-t v3 27/52] tests/gem_mmap_gtt: " Zbigniew Kempczyński
2021-07-26 20:00 ` [igt-dev] [PATCH i-g-t v3 28/52] tests/gem_mmap_offset: " Zbigniew Kempczyński
2021-07-26 20:00 ` [igt-dev] [PATCH i-g-t v3 29/52] tests/gem_mmap_wc: Adopt to use allocator Zbigniew Kempczyński
2021-08-06 4:51 ` Dixit, Ashutosh
2021-07-26 20:00 ` [igt-dev] [PATCH i-g-t v3 30/52] tests/gem_request_retire: Add allocator support Zbigniew Kempczyński
2021-07-26 20:00 ` [igt-dev] [PATCH i-g-t v3 31/52] tests/gem_ringfill: Adopt to use allocator Zbigniew Kempczyński
2021-08-06 5:04 ` Dixit, Ashutosh
2021-07-26 20:00 ` [igt-dev] [PATCH i-g-t v3 32/52] tests/gem_softpin: Exercise eviction with softpinning Zbigniew Kempczyński
2021-07-26 20:00 ` [igt-dev] [PATCH i-g-t v3 33/52] tests/gem_spin_batch: Adopt to use allocator Zbigniew Kempczyński
2021-07-26 20:00 ` [igt-dev] [PATCH i-g-t v3 34/52] tests/gem_tiled_fence_blits: " Zbigniew Kempczyński
2021-07-26 20:00 ` [igt-dev] [PATCH i-g-t v3 35/52] tests/gem_unfence_active_buffers: " Zbigniew Kempczyński
2021-08-06 5:44 ` Dixit, Ashutosh
2021-07-26 20:00 ` [igt-dev] [PATCH i-g-t v3 36/52] tests/gem_unref_active_buffers: " Zbigniew Kempczyński
2021-08-06 5:46 ` Dixit, Ashutosh
2021-07-26 20:00 ` [igt-dev] [PATCH i-g-t v3 37/52] tests/gem_wait: " Zbigniew Kempczyński
2021-08-06 5:48 ` Dixit, Ashutosh
2021-07-26 20:00 ` [igt-dev] [PATCH i-g-t v3 38/52] tests/gem_watchdog: Adopt to use no-reloc Zbigniew Kempczyński
2021-07-26 20:00 ` [igt-dev] [PATCH i-g-t v3 39/52] tests/gem_workarounds: Adopt to use allocator Zbigniew Kempczyński
2021-07-26 20:00 ` [igt-dev] [PATCH i-g-t v3 40/52] tests/i915_hangman: " Zbigniew Kempczyński
2021-07-26 20:00 ` [igt-dev] [PATCH i-g-t v3 41/52] tests/i915_module_load: " Zbigniew Kempczyński
2021-07-26 20:00 ` [igt-dev] [PATCH i-g-t v3 42/52] tests/i915_pm_rc6_residency: " Zbigniew Kempczyński
2021-07-26 20:00 ` [igt-dev] [PATCH i-g-t v3 43/52] tests/i915_pm_rpm: Adopt to use no-reloc Zbigniew Kempczyński
2021-07-26 20:00 ` [igt-dev] [PATCH i-g-t v3 44/52] tests/i915_pm_rps: Alter " Zbigniew Kempczyński
2021-07-26 20:00 ` [igt-dev] [PATCH i-g-t v3 45/52] tests/kms_busy: Adopt to use allocator Zbigniew Kempczyński
2021-07-26 20:00 ` [igt-dev] [PATCH i-g-t v3 46/52] tests/kms_cursor_legacy: " Zbigniew Kempczyński
2021-07-26 20:00 ` [igt-dev] [PATCH i-g-t v3 47/52] tests/kms_flip: " Zbigniew Kempczyński
2021-07-26 20:00 ` [igt-dev] [PATCH i-g-t v3 48/52] tests/kms_vblank: " Zbigniew Kempczyński
2021-07-26 20:00 ` [igt-dev] [PATCH i-g-t v3 49/52] tests/perf_pmu: " Zbigniew Kempczyński
2021-07-26 20:00 ` [igt-dev] [PATCH i-g-t v3 50/52] tests/sysfs_heartbeat_interval: " Zbigniew Kempczyński
2021-07-26 20:00 ` [igt-dev] [PATCH i-g-t v3 51/52] tests/sysfs_preempt_timeout: " Zbigniew Kempczyński
2021-07-26 20:00 ` [igt-dev] [PATCH i-g-t v3 52/52] tests/sysfs_timeslice_duration: " Zbigniew Kempczyński
2021-07-26 21:33 ` [igt-dev] ✓ Fi.CI.BAT: success for Add allocator support in IGT (rev3) Patchwork
2021-07-27 2:14 ` [igt-dev] ✗ Fi.CI.IGT: 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=87eeb7u10t.wl-ashutosh.dixit@intel.com \
--to=ashutosh.dixit@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=zbigniew.kempczynski@intel.com \
/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