diff mbox series

[3/3] drm/etnaviv: Print an error message if inserting IOVA range fails

Message ID 20241004194207.1013744-4-sui.jingfeng@linux.dev (mailing list archive)
State New, archived
Headers show
Series Fix GPU virtual address collosion when CPU page size != GPU page size | expand

Commit Message

Sui Jingfeng Oct. 4, 2024, 7:42 p.m. UTC
Print an error message to help debug when such an issue happen, since it's
not so obvious.

Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev>
---
v0 -> v1: Use dev_err_ratelimited() to prevent spamming the logs

v0 is at https://lore.kernel.org/dri-devel/20240930221706.399139-1-sui.jingfeng@linux.dev/
---
 drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Lucas Stach Oct. 7, 2024, 10:20 a.m. UTC | #1
Am Samstag, dem 05.10.2024 um 03:42 +0800 schrieb Sui Jingfeng:
> Print an error message to help debug when such an issue happen, since it's
> not so obvious.
> 
> Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev>

Reviewed-by: Lucas Stach <l.stach@pengutronix.de>

> ---
> v0 -> v1: Use dev_err_ratelimited() to prevent spamming the logs
> 
> v0 is at https://lore.kernel.org/dri-devel/20240930221706.399139-1-sui.jingfeng@linux.dev/
> ---
>  drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
> index a52ec5eb0e3d..37866ed05c13 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
> @@ -300,8 +300,12 @@ int etnaviv_iommu_map_gem(struct etnaviv_iommu_context *context,
>  		ret = etnaviv_iommu_insert_exact(context, node, user_size, va);
>  	else
>  		ret = etnaviv_iommu_find_iova(context, node, user_size);
> -	if (ret < 0)
> +	if (ret < 0) {
> +		dev_err_ratelimited(context->global->dev,
> +				    "Insert iova failed: 0x%llx(0x%x)\n",
> +				    va, user_size);
>  		goto unlock;
> +	}
>  
>  	mapping->iova = node->start;
>  	ret = etnaviv_iommu_map(context, node->start, user_size, sgt,
Lucas Stach Oct. 28, 2024, 4:01 p.m. UTC | #2
Hi Sui,

Am Montag, dem 07.10.2024 um 12:20 +0200 schrieb Lucas Stach:
> Am Samstag, dem 05.10.2024 um 03:42 +0800 schrieb Sui Jingfeng:
> > Print an error message to help debug when such an issue happen, since it's
> > not so obvious.
> > 
> > Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev>
> 
> Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
> 
What happened to this patch? It's not part of the updated series
anymore. Even though the problem at hand is solved right now, I still
think this patch is useful  to have.

Regards,
Lucas

> > ---
> > v0 -> v1: Use dev_err_ratelimited() to prevent spamming the logs
> > 
> > v0 is at https://lore.kernel.org/dri-devel/20240930221706.399139-1-sui.jingfeng@linux.dev/
> > ---
> >  drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
> > index a52ec5eb0e3d..37866ed05c13 100644
> > --- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
> > +++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
> > @@ -300,8 +300,12 @@ int etnaviv_iommu_map_gem(struct etnaviv_iommu_context *context,
> >  		ret = etnaviv_iommu_insert_exact(context, node, user_size, va);
> >  	else
> >  		ret = etnaviv_iommu_find_iova(context, node, user_size);
> > -	if (ret < 0)
> > +	if (ret < 0) {
> > +		dev_err_ratelimited(context->global->dev,
> > +				    "Insert iova failed: 0x%llx(0x%x)\n",
> > +				    va, user_size);
> >  		goto unlock;
> > +	}
> >  
> >  	mapping->iova = node->start;
> >  	ret = etnaviv_iommu_map(context, node->start, user_size, sgt,
>
Sui Jingfeng Oct. 28, 2024, 4:25 p.m. UTC | #3
Hi,

On 2024/10/29 00:01, Lucas Stach wrote:
> Hi Sui,
>
> Am Montag, dem 07.10.2024 um 12:20 +0200 schrieb Lucas Stach:
>> Am Samstag, dem 05.10.2024 um 03:42 +0800 schrieb Sui Jingfeng:
>>> Print an error message to help debug when such an issue happen, since it's
>>> not so obvious.
>>>
>>> Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev>
>> Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
>>
> What happened to this patch? It's not part of the updated series
> anymore. Even though the problem at hand is solved right now, I still
> think this patch is useful  to have.

I was thinking this patch should be a separate patch while making the v2.

In the future, I guess there may have 64K CPU and/or GPU page size combinations
from other users or contributors.

I think I should resend this.
But don't know take which Linux kernel as code base.
etnaviv-next or etnaviv-fixes?

If you have convenient code base at hand now, you could pick it up, I don't mind.

> Regards,
> Lucas
>
>>> ---
>>> v0 -> v1: Use dev_err_ratelimited() to prevent spamming the logs
>>>
>>> v0 is at https://lore.kernel.org/dri-devel/20240930221706.399139-1-sui.jingfeng@linux.dev/
>>> ---
>>>   drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 6 +++++-
>>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
>>> index a52ec5eb0e3d..37866ed05c13 100644
>>> --- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
>>> +++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
>>> @@ -300,8 +300,12 @@ int etnaviv_iommu_map_gem(struct etnaviv_iommu_context *context,
>>>   		ret = etnaviv_iommu_insert_exact(context, node, user_size, va);
>>>   	else
>>>   		ret = etnaviv_iommu_find_iova(context, node, user_size);
>>> -	if (ret < 0)
>>> +	if (ret < 0) {
>>> +		dev_err_ratelimited(context->global->dev,
>>> +				    "Insert iova failed: 0x%llx(0x%x)\n",
>>> +				    va, user_size);
>>>   		goto unlock;
>>> +	}
>>>   
>>>   	mapping->iova = node->start;
>>>   	ret = etnaviv_iommu_map(context, node->start, user_size, sgt,
diff mbox series

Patch

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
index a52ec5eb0e3d..37866ed05c13 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
@@ -300,8 +300,12 @@  int etnaviv_iommu_map_gem(struct etnaviv_iommu_context *context,
 		ret = etnaviv_iommu_insert_exact(context, node, user_size, va);
 	else
 		ret = etnaviv_iommu_find_iova(context, node, user_size);
-	if (ret < 0)
+	if (ret < 0) {
+		dev_err_ratelimited(context->global->dev,
+				    "Insert iova failed: 0x%llx(0x%x)\n",
+				    va, user_size);
 		goto unlock;
+	}
 
 	mapping->iova = node->start;
 	ret = etnaviv_iommu_map(context, node->start, user_size, sgt,