[PATCH 5/6] drm/amdkfd: Optimize out some duplicated code in kfd_signal_iommu_event()
Alex Deucher
alexdeucher at gmail.com
Fri Jul 13 19:27:48 UTC 2018
On Thu, Jul 12, 2018 at 5:24 PM, Felix Kuehling <Felix.Kuehling at amd.com> wrote:
> From: Yong Zhao <yong.zhao at amd.com>
Please add a patch description.
Alex
>
> Signed-off-by: Yong Zhao <yong.zhao at amd.com>
> Reviewed-by: Felix Kuehling <Felix.Kuehling at amd.com>
> Signed-off-by: Felix Kuehling <Felix.Kuehling at amd.com>
> ---
> drivers/gpu/drm/amd/amdkfd/kfd_events.c | 26 +++++++++++---------------
> 1 file changed, 11 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_events.c b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
> index 4dcacce..e9f0e0a 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_events.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
> @@ -911,22 +911,18 @@ void kfd_signal_iommu_event(struct kfd_dev *dev, unsigned int pasid,
> memory_exception_data.failure.NotPresent = 1;
> memory_exception_data.failure.NoExecute = 0;
> memory_exception_data.failure.ReadOnly = 0;
> - if (vma) {
> - if (vma->vm_start > address) {
> - memory_exception_data.failure.NotPresent = 1;
> - memory_exception_data.failure.NoExecute = 0;
> + if (vma && address >= vma->vm_start) {
> + memory_exception_data.failure.NotPresent = 0;
> +
> + if (is_write_requested && !(vma->vm_flags & VM_WRITE))
> + memory_exception_data.failure.ReadOnly = 1;
> + else
> memory_exception_data.failure.ReadOnly = 0;
> - } else {
> - memory_exception_data.failure.NotPresent = 0;
> - if (is_write_requested && !(vma->vm_flags & VM_WRITE))
> - memory_exception_data.failure.ReadOnly = 1;
> - else
> - memory_exception_data.failure.ReadOnly = 0;
> - if (is_execute_requested && !(vma->vm_flags & VM_EXEC))
> - memory_exception_data.failure.NoExecute = 1;
> - else
> - memory_exception_data.failure.NoExecute = 0;
> - }
> +
> + if (is_execute_requested && !(vma->vm_flags & VM_EXEC))
> + memory_exception_data.failure.NoExecute = 1;
> + else
> + memory_exception_data.failure.NoExecute = 0;
> }
>
> up_read(&mm->mmap_sem);
> --
> 2.7.4
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
More information about the amd-gfx
mailing list