[PATCH] drm/amdgpu: protect chash related code under macro

Felix Kuehling felix.kuehling at amd.com
Mon Sep 25 16:09:21 UTC 2017


It's part of the same patch that starts using the function:

commit c18d4ac89dc8ad1622c3abc7f4ff31b563c0196b
Author: Felix Kuehling <Felix.Kuehling at amd.com>
Date:   Sat Aug 26 02:43:06 2017 -0400

    drm/amdgpu: Track pending retry faults in IH and VM (v2)
    
    IH tracks pending retry faults in a hash table for fast lookup in
    interrupt context. Each VM has a short FIFO of pending VM faults for
    processing in a bottom half.
    
    The IH prescreening stage adds retry faults and filters out repeated
    retry interrupts to minimize the impact of interrupt storms.
    
    It's the VM's responsibility remove pending faults once they are
    handled. For now this is only done when the VM is destroyed.
    
    v2:
    - Made the hash table smaller and the FIFO longer. I never want the
      FIFO to fill up, because that would make prescreen take longer.
      128 pending page faults should be enough to keep migrations busy.
    
    Signed-off-by: Felix Kuehling <Felix.Kuehling at amd.com>
    Acked-by: Christian König <christian.koenig at amd.com> (v1)
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 1989c27..7fb8492 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -184,6 +184,7 @@ config DRM_AMDGPU
        select BACKLIGHT_CLASS_DEVICE
        select BACKLIGHT_LCD_SUPPORT
        select INTERVAL_TREE
+       select CHASH
        help
          Choose this option if you have a recent AMD Radeon graphics card.
 
[...]

Regards,
  Felix


On 2017-09-25 01:31 AM, S, Shirish wrote:
> Ok.
> Is there a link to the patch? 
>
>
>
> Regards,
> Shirish S
>
> -----Original Message-----
> From: Kuehling, Felix 
> Sent: Friday, September 22, 2017 7:36 PM
> To: S, Shirish <Shirish.S at amd.com>; amd-gfx at lists.freedesktop.org; Deucher, Alexander <Alexander.Deucher at amd.com>
> Subject: Re: [PATCH] drm/amdgpu: protect chash related code under macro
>
> This should not be needed, because in Kconfig I made amdgpu depend on CONFIG_CHASH.
>
> Regards,
>   Felix
> ________________________________________
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> on behalf of S, Shirish <sshankar at amd.com>
> Sent: Thursday, September 21, 2017 3:35:01 AM
> To: amd-gfx at lists.freedesktop.org; Deucher, Alexander
> Subject: [PATCH] drm/amdgpu: protect chash related code under macro
>
> From: Shirish S <shirish.s at amd.com>
>
> The chash library is built only if CONFIG_CHASH is enabled, however there is code in amdgpu_ih.c which results in link error as it is not under appropriate macro.
> This patch brings chash related code in amdgpu_ih.c under CONFIG_CHASH.
>
> Signed-off-by: Shirish S <shirish.s at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
> index f5f27e4..776c9c5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c
> @@ -231,14 +231,14 @@ int amdgpu_ih_add_fault(struct amdgpu_device *adev, u64 key)
>         /* Only let the hash table fill up to 50% for best performance */
>         if (adev->irq.ih.faults->count >= (1 << (AMDGPU_PAGEFAULT_HASH_BITS-1)))
>                 goto unlock_out;
> -
> +#ifdef CONFIG_CHASH
>         r = chash_table_copy_in(&adev->irq.ih.faults->hash, key, NULL);
>         if (!r)
>                 adev->irq.ih.faults->count++;
>
>         /* chash_table_copy_in should never fail unless we're losing count */
>         WARN_ON_ONCE(r < 0);
> -
> +#endif
>   unlock_out:
>         spin_unlock_irqrestore(&adev->irq.ih.faults->lock, flags);
>         return r;
> @@ -256,12 +256,14 @@ int amdgpu_ih_add_fault(struct amdgpu_device *adev, u64 key)
>    */
>   void amdgpu_ih_clear_fault(struct amdgpu_device *adev, u64 key)
>   {
> +#ifdef CONFIG_CHASH
>         unsigned long flags;
>         int r;
> -
> +#endif
>         if (!adev->irq.ih.faults)
>                 return;
>
> +#ifdef CONFIG_CHASH
>         spin_lock_irqsave(&adev->irq.ih.faults->lock, flags);
>
>         r = chash_table_remove(&adev->irq.ih.faults->hash, key, NULL); @@ -271,4 +273,5 @@ void amdgpu_ih_clear_fault(struct amdgpu_device *adev, u64 key)
>         }
>
>         spin_unlock_irqrestore(&adev->irq.ih.faults->lock, flags);
> +#endif
>   }
> --
> 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