drm/amdgpu: protect chash related code under macro
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): 1505978855-10394-1-git-send-email-shirish.s12-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH 1/1 drm/amdgpu: protect chash related code under macro
From: Shirish S <[email protected]>
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.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c +6 -3
@@ -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 }
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): a629c2fa-5b5f-bf35-b9b9-80e20f77ee58-5C7GfCeVMHo@public.gmane.org
This should not be needed, because in Kconfig I made amdgpu depend on CONFIG_CHASH.
Regards,
Felix
________________________________________
From: amd-gfx <[email protected]> on behalf of S, Shirish <[email protected]>
Sent: Thursday, September 21, 2017 3:35:01 AM
To: [email protected]; Deucher, Alexander
Subject: [PATCH] drm/amdgpu: protect chash related code under macro
From: Shirish S <[email protected]>
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.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c +6 -3
@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): DM5PR1201MB0235CA816799806917B87EB492670-grEf7a3NxMBd8L2jMOIKKmrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/[email protected]
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 <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>
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 <[email protected]> on behalf of S, Shirish <[email protected]>
Sent: Thursday, September 21, 2017 3:35:01 AM
To: [email protected]; Deucher, Alexander
Subject: [PATCH] drm/amdgpu: protect chash related code under macro
From: Shirish S <[email protected]>
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.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c +5 -3
@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): BN6PR12MB182658570E098C3EE683EA74F27A0-/b2+HYfkarSCndJ3FSsNdQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
It's part of the same patch that starts using the function:
commit c18d4ac89dc8ad1622c3abc7f4ff31b563c0196b
Author: Felix Kuehling <[email protected]> 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.
drivers/gpu/drm/Kconfig +1 -0
@@ -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
Quoted 79 lines · Shirish
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 <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: protect chash related code under macroThis should not be needed, because in
KconfigI made amdgpu depend onCONFIG_CHASH.Regards,
Felix
________________________________________
From: amd-gfx <[email protected]> on behalf of S, Shirish <[email protected]>
Sent: Thursday, September 21, 2017 3:35:01 AM
To: [email protected]; Deucher, Alexander
Subject: [PATCH] drm/amdgpu: protect chash related code under macroFrom: Shirish S <[email protected]>
The chash library is built only if
CONFIG_CHASHis enabled, however there is code inamdgpu_ih.cwhich results in link error as it is not under appropriate macro. This patch brings chash related code inamdgpu_ih.cunderCONFIG_CHASH.Signed-off-by Shirish S <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c +5
-3@@ -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
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx