dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ram/gf100-: error out if a ridiculous amount of vram is detected
@ 2015-05-20 20:01 Ilia Mirkin
       [not found] ` <1432152067-32104-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
  2015-05-21  4:45 ` Ben Skeggs
  0 siblings, 2 replies; 4+ messages in thread
From: Ilia Mirkin @ 2015-05-20 20:01 UTC (permalink / raw)
  To: Ben Skeggs
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Some newer chips have trouble coming up, and we get bad MMIO reads from
them, like 0xbadf100. This ends up translating into crazy amounts of
VRAM, which destroys all sorts of other logic down the line. Instead,
fail device init.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: stable@kernel.org
---
 drm/nouveau/nvkm/subdev/fb/ramgf100.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drm/nouveau/nvkm/subdev/fb/ramgf100.c b/drm/nouveau/nvkm/subdev/fb/ramgf100.c
index de9f395..9d4d196 100644
--- a/drm/nouveau/nvkm/subdev/fb/ramgf100.c
+++ b/drm/nouveau/nvkm/subdev/fb/ramgf100.c
@@ -545,6 +545,12 @@ gf100_ram_create_(struct nvkm_object *parent, struct nvkm_object *engine,
 		}
 	}
 
+	/* if over 1TB of VRAM is reported, something went very wrong, bail */
+	if (ram->size > (1ULL << 40)) {
+		nv_error(pfb, "invalid vram size: %llx\n", ram->size);
+		return -EINVAL;
+	}
+
 	/* if all controllers have the same amount attached, there's no holes */
 	if (uniform) {
 		offset = rsvd_head;
-- 
2.3.6

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ram/gf100-: error out if a ridiculous amount of vram is detected
       [not found] ` <1432152067-32104-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
@ 2015-05-20 21:35   ` Tobias Klausmann
  2015-05-20 21:47     ` [Nouveau] " Ilia Mirkin
  0 siblings, 1 reply; 4+ messages in thread
From: Tobias Klausmann @ 2015-05-20 21:35 UTC (permalink / raw)
  To: Ilia Mirkin, Ben Skeggs
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Any idea on how to solve the problem. other than just reporting it?

But for now this adds a helpful error message... you may add my R-b.

On 20.05.2015 22:01, Ilia Mirkin wrote:
> Some newer chips have trouble coming up, and we get bad MMIO reads from
> them, like 0xbadf100. This ends up translating into crazy amounts of
> VRAM, which destroys all sorts of other logic down the line. Instead,
> fail device init.
>
> Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
> Cc: stable@kernel.org
> ---
>   drm/nouveau/nvkm/subdev/fb/ramgf100.c | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/drm/nouveau/nvkm/subdev/fb/ramgf100.c b/drm/nouveau/nvkm/subdev/fb/ramgf100.c
> index de9f395..9d4d196 100644
> --- a/drm/nouveau/nvkm/subdev/fb/ramgf100.c
> +++ b/drm/nouveau/nvkm/subdev/fb/ramgf100.c
> @@ -545,6 +545,12 @@ gf100_ram_create_(struct nvkm_object *parent, struct nvkm_object *engine,
>   		}
>   	}
>   
> +	/* if over 1TB of VRAM is reported, something went very wrong, bail */
> +	if (ram->size > (1ULL << 40)) {
> +		nv_error(pfb, "invalid vram size: %llx\n", ram->size);
> +		return -EINVAL;
> +	}
> +
>   	/* if all controllers have the same amount attached, there's no holes */
>   	if (uniform) {
>   		offset = rsvd_head;

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Nouveau] [PATCH] ram/gf100-: error out if a ridiculous amount of vram is detected
  2015-05-20 21:35   ` Tobias Klausmann
@ 2015-05-20 21:47     ` Ilia Mirkin
  0 siblings, 0 replies; 4+ messages in thread
From: Ilia Mirkin @ 2015-05-20 21:47 UTC (permalink / raw)
  To: Tobias Klausmann
  Cc: nouveau@lists.freedesktop.org, Ben Skeggs,
	dri-devel@lists.freedesktop.org

Someone will have to trudge through a mmiotrace and figure out what
magic bit we need to set in order to bring it out of deep sleep. Or
perhaps NVIDIA will graciously tell us, which they eventually did for
GK104/GK106 (but their instructions appear to be insufficient for at
least some GK106's).

But I've seen these errors every so often on various cards... we stick
things at the end of VRAM, which causes no end of confusion when we
think that it's a few PB out :)

On Wed, May 20, 2015 at 5:35 PM, Tobias Klausmann
<tobias.johannes.klausmann@mni.thm.de> wrote:
> Any idea on how to solve the problem. other than just reporting it?
>
> But for now this adds a helpful error message... you may add my R-b.
>
>
> On 20.05.2015 22:01, Ilia Mirkin wrote:
>>
>> Some newer chips have trouble coming up, and we get bad MMIO reads from
>> them, like 0xbadf100. This ends up translating into crazy amounts of
>> VRAM, which destroys all sorts of other logic down the line. Instead,
>> fail device init.
>>
>> Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
>> Cc: stable@kernel.org
>> ---
>>   drm/nouveau/nvkm/subdev/fb/ramgf100.c | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/drm/nouveau/nvkm/subdev/fb/ramgf100.c
>> b/drm/nouveau/nvkm/subdev/fb/ramgf100.c
>> index de9f395..9d4d196 100644
>> --- a/drm/nouveau/nvkm/subdev/fb/ramgf100.c
>> +++ b/drm/nouveau/nvkm/subdev/fb/ramgf100.c
>> @@ -545,6 +545,12 @@ gf100_ram_create_(struct nvkm_object *parent, struct
>> nvkm_object *engine,
>>                 }
>>         }
>>   +     /* if over 1TB of VRAM is reported, something went very wrong,
>> bail */
>> +       if (ram->size > (1ULL << 40)) {
>> +               nv_error(pfb, "invalid vram size: %llx\n", ram->size);
>> +               return -EINVAL;
>> +       }
>> +
>>         /* if all controllers have the same amount attached, there's no
>> holes */
>>         if (uniform) {
>>                 offset = rsvd_head;
>
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Nouveau] [PATCH] ram/gf100-: error out if a ridiculous amount of vram is detected
  2015-05-20 20:01 [PATCH] ram/gf100-: error out if a ridiculous amount of vram is detected Ilia Mirkin
       [not found] ` <1432152067-32104-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
@ 2015-05-21  4:45 ` Ben Skeggs
  1 sibling, 0 replies; 4+ messages in thread
From: Ben Skeggs @ 2015-05-21  4:45 UTC (permalink / raw)
  To: Ilia Mirkin
  Cc: nouveau@lists.freedesktop.org, Ben Skeggs,
	dri-devel@lists.freedesktop.org

On 21 May 2015 at 06:01, Ilia Mirkin <imirkin@alum.mit.edu> wrote:
> Some newer chips have trouble coming up, and we get bad MMIO reads from
> them, like 0xbadf100. This ends up translating into crazy amounts of
> VRAM, which destroys all sorts of other logic down the line. Instead,
> fail device init.
Hrm, I'm not sure what I think of doing something like this.  Where do
we draw the line at validating stuff we read from GPU registers?
Either way, we still have a bug, so I'm not sure what we gain from
working around it like this.

Ben.

>
> Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
> Cc: stable@kernel.org
> ---
>  drm/nouveau/nvkm/subdev/fb/ramgf100.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drm/nouveau/nvkm/subdev/fb/ramgf100.c b/drm/nouveau/nvkm/subdev/fb/ramgf100.c
> index de9f395..9d4d196 100644
> --- a/drm/nouveau/nvkm/subdev/fb/ramgf100.c
> +++ b/drm/nouveau/nvkm/subdev/fb/ramgf100.c
> @@ -545,6 +545,12 @@ gf100_ram_create_(struct nvkm_object *parent, struct nvkm_object *engine,
>                 }
>         }
>
> +       /* if over 1TB of VRAM is reported, something went very wrong, bail */
> +       if (ram->size > (1ULL << 40)) {
> +               nv_error(pfb, "invalid vram size: %llx\n", ram->size);
> +               return -EINVAL;
> +       }
> +
>         /* if all controllers have the same amount attached, there's no holes */
>         if (uniform) {
>                 offset = rsvd_head;
> --
> 2.3.6
>
> _______________________________________________
> Nouveau mailing list
> Nouveau@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-21  4:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-20 20:01 [PATCH] ram/gf100-: error out if a ridiculous amount of vram is detected Ilia Mirkin
     [not found] ` <1432152067-32104-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
2015-05-20 21:35   ` Tobias Klausmann
2015-05-20 21:47     ` [Nouveau] " Ilia Mirkin
2015-05-21  4:45 ` Ben Skeggs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox