From: Felix Kuehling <felix.kuehling@amd.com>
To: Alex Sierra <alex.sierra@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 04/10] drm/amdgpu: get owner ref in validate and map
Date: Mon, 21 Jun 2021 16:04:59 -0400 [thread overview]
Message-ID: <95a62079-cfb0-5a67-4612-e1ea6351eb6c@amd.com> (raw)
In-Reply-To: <20210621160423.3517-4-alex.sierra@amd.com>
On 2021-06-21 12:04 p.m., Alex Sierra wrote:
> Get the proper owner reference for amdgpu_hmm_range_get_pages function.
> This is useful for partial migrations. To avoid migrating back to
> system memory, VRAM pages, that are accessible by all devices in the
> same memory domain.
> Ex. multiple devices in the same hive.
>
> Signed-off-by: Alex Sierra <alex.sierra@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
> ---
> drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 25 ++++++++++++++++++++++++-
> 1 file changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> index 54f47b09b14a..2b4318646a75 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> @@ -1313,6 +1313,17 @@ static void svm_range_unreserve_bos(struct svm_validate_context *ctx)
> ttm_eu_backoff_reservation(&ctx->ticket, &ctx->validate_list);
> }
>
> +static void *kfd_svm_page_owner(struct kfd_process *p, int32_t gpuidx)
> +{
> + struct kfd_process_device *pdd;
> + struct amdgpu_device *adev;
> +
> + pdd = kfd_process_device_from_gpuidx(p, gpuidx);
> + adev = (struct amdgpu_device *)pdd->dev->kgd;
> +
> + return SVM_ADEV_PGMAP_OWNER(adev);
> +}
> +
> /*
> * Validation+GPU mapping with concurrent invalidation (MMU notifiers)
> *
> @@ -1343,6 +1354,9 @@ static int svm_range_validate_and_map(struct mm_struct *mm,
> {
> struct svm_validate_context ctx;
> struct hmm_range *hmm_range;
> + struct kfd_process *p;
> + void *owner;
> + int32_t idx;
> int r = 0;
>
> ctx.process = container_of(prange->svms, struct kfd_process, svms);
> @@ -1389,10 +1403,19 @@ static int svm_range_validate_and_map(struct mm_struct *mm,
> svm_range_reserve_bos(&ctx);
>
> if (!prange->actual_loc) {
> + p = container_of(prange->svms, struct kfd_process, svms);
> + owner = kfd_svm_page_owner(p, find_first_bit(ctx.bitmap,
> + MAX_GPU_INSTANCE));
> + for_each_set_bit(idx, ctx.bitmap, MAX_GPU_INSTANCE) {
> + if (kfd_svm_page_owner(p, idx) != owner) {
> + owner = NULL;
> + break;
> + }
> + }
> r = amdgpu_hmm_range_get_pages(&prange->notifier, mm, NULL,
> prange->start << PAGE_SHIFT,
> prange->npages, &hmm_range,
> - false, true, NULL);
> + false, true, owner);
> if (r) {
> pr_debug("failed %d to get svm range pages\n", r);
> goto unreserve_out;
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2021-06-21 20:05 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-21 16:04 [PATCH 01/10] drm/amdkfd: device pgmap owner at the svm migrate init Alex Sierra
2021-06-21 16:04 ` [PATCH 02/10] drm/amdkfd: add owner ref param to get hmm pages Alex Sierra
2021-06-21 20:00 ` Felix Kuehling
2021-06-21 16:04 ` [PATCH 03/10] drm/amdkfd: set owner ref to svm range prefault Alex Sierra
2021-06-21 20:02 ` Felix Kuehling
2021-06-21 16:04 ` [PATCH 04/10] drm/amdgpu: get owner ref in validate and map Alex Sierra
2021-06-21 20:04 ` Felix Kuehling [this message]
2021-06-21 16:04 ` [PATCH 05/10] drm/amdkfd: classify and map mixed svm range pages in GPU Alex Sierra
2021-06-21 20:26 ` Felix Kuehling
2021-06-21 16:04 ` [PATCH 06/10] drm/amdkfd: skip invalid pages during migrations Alex Sierra
2021-06-21 16:04 ` [PATCH 07/10] drm/amdkfd: skip migration for pages already in VRAM Alex Sierra
2021-06-21 21:01 ` Felix Kuehling
2021-06-21 16:04 ` [PATCH 08/10] drm/amdkfd: add invalid pages debug at vram migration Alex Sierra
2021-06-21 21:02 ` Felix Kuehling
2021-06-21 16:04 ` [PATCH 09/10] drm/amdkfd: partially actual_loc removed Alex Sierra
2021-06-21 21:24 ` Felix Kuehling
2021-06-21 16:04 ` [PATCH 10/10] drm/amdkfd: protect svm_bo ref in case prange has forked Alex Sierra
2021-06-21 21:46 ` Felix Kuehling
2021-06-21 19:59 ` [PATCH 01/10] drm/amdkfd: device pgmap owner at the svm migrate init Felix Kuehling
-- strict thread matches above, loose matches on Subject: below --
2021-05-27 20:55 Felix Kuehling
2021-05-27 20:56 ` [PATCH 04/10] drm/amdgpu: get owner ref in validate and map Felix Kuehling
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=95a62079-cfb0-5a67-4612-e1ea6351eb6c@amd.com \
--to=felix.kuehling@amd.com \
--cc=alex.sierra@amd.com \
--cc=amd-gfx@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