AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lang Yu <Lang.Yu@amd.com>
To: Eric Huang <jinhuieric.huang@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>,
	Felix Kuehling <Felix.Kuehling@amd.com>,
	Huang Rui <ray.huang@amd.com>,
	amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdkfd: only allow heavy-weight TLB flush on some ASICs for SVM too
Date: Fri, 15 Apr 2022 10:38:38 +0800	[thread overview]
Message-ID: <Yljars9+5resjVTz@lang-desktop> (raw)
In-Reply-To: <037fabb7-01a5-1a02-ffed-5c9f54a10510@amd.com>

On 04/14/ , Eric Huang wrote:
> 
> 
> On 2022-04-14 04:19, Lang Yu wrote:
> > The idea is from commit a50fe7078035 ("drm/amdkfd: Only apply heavy-weight
> > TLB flush on Aldebaran") and commit f61c40c0757a ("drm/amdkfd: enable
> > heavy-weight TLB flush on Arcturus"). Otherwise, we will run into problems
> > on some ASICs when running SVM applications.
> > 
> > Signed-off-by: Lang Yu <Lang.Yu@amd.com>
> > ---
> >   drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 8 --------
> >   drivers/gpu/drm/amd/amdkfd/kfd_priv.h    | 8 ++++++++
> >   drivers/gpu/drm/amd/amdkfd/kfd_svm.c     | 4 +++-
> >   3 files changed, 11 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> > index 91f82a9ccdaf..459f59e3d0ed 100644
> > --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> > @@ -1128,14 +1128,6 @@ static int kfd_ioctl_free_memory_of_gpu(struct file *filep,
> >   	return ret;
> >   }
> > -static bool kfd_flush_tlb_after_unmap(struct kfd_dev *dev)
> > -{
> > -	return KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2) ||
> > -		(KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 1) &&
> > -		dev->adev->sdma.instance[0].fw_version >= 18) ||
> > -		KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 0);
> > -}
> > -
> >   static int kfd_ioctl_map_memory_to_gpu(struct file *filep,
> >   					struct kfd_process *p, void *data)
> >   {
> > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
> > index 8a43def1f638..aff6f598ff2c 100644
> > --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
> > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
> > @@ -1328,6 +1328,14 @@ void kfd_signal_poison_consumed_event(struct kfd_dev *dev, u32 pasid);
> >   void kfd_flush_tlb(struct kfd_process_device *pdd, enum TLB_FLUSH_TYPE type);
> > +static inline bool kfd_flush_tlb_after_unmap(struct kfd_dev *dev)
> > +{
> > +	return KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2) ||
> > +	       (KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 1) &&
> > +	       dev->adev->sdma.instance[0].fw_version >= 18) ||
> > +	       KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 0);
> > +}
> > +
> It is a cosmetic change for function kfd_flush_tlb_after_unmap, and not
> related to the topic. You can separate that into another patch.

Okay. Thanks.

Regards,
Lang

> Regards,
> Eric
> >   bool kfd_is_locked(void);
> >   /* Compute profile */
> > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> > index 459fa07a3bcc..5afe216cf099 100644
> > --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> > @@ -1229,7 +1229,9 @@ svm_range_unmap_from_gpus(struct svm_range *prange, unsigned long start,
> >   			if (r)
> >   				break;
> >   		}
> > -		kfd_flush_tlb(pdd, TLB_FLUSH_HEAVYWEIGHT);
> > +
> > +		if (kfd_flush_tlb_after_unmap(pdd->dev))
> > +			kfd_flush_tlb(pdd, TLB_FLUSH_HEAVYWEIGHT);
> >   	}
> >   	return r;
> 

  reply	other threads:[~2022-04-15  2:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-14  8:19 [PATCH] drm/amdkfd: only allow heavy-weight TLB flush on some ASICs for SVM too Lang Yu
2022-04-14 13:44 ` Eric Huang
2022-04-15  2:38   ` Lang Yu [this message]
2022-04-14 15:15 ` Felix Kuehling
2022-04-15  2:47   ` Lang Yu
2022-04-15  5:07     ` Felix Kuehling
2022-04-14 17:46 ` Paul Menzel
2022-04-15  3:20   ` Lang Yu
2022-04-15  5:14     ` Paul Menzel
2022-04-15  6:37       ` Lang Yu

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=Yljars9+5resjVTz@lang-desktop \
    --to=lang.yu@amd.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=jinhuieric.huang@amd.com \
    --cc=ray.huang@amd.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