Message ID | 20240126164623.1191363-1-l.stach@pengutronix.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/etnaviv: switch devcoredump allocations to GFP_NOWAIT | expand |
Am Freitag, dem 26.01.2024 um 17:46 +0100 schrieb Lucas Stach: > The etnaviv devcoredump is created in the GPU reset path, which > must make forward progress to avoid stalling memory reclaim on > unsignalled dma fences. The currently used __GFP_NORETRY does not > prohibit sleeping on direct reclaim, breaking the forward progress > guarantee. Switch to GFP_NOWAIT, which allows background reclaim > to be triggered, but avoids any stalls waiting for direct reclaim. > Any takers for reviewing this one? Regards, Lucas > Signed-off-by: Lucas Stach <l.stach@pengutronix.de> > --- > drivers/gpu/drm/etnaviv/etnaviv_dump.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/etnaviv/etnaviv_dump.c b/drivers/gpu/drm/etnaviv/etnaviv_dump.c > index 898f84a0fc30c..42c5028872d54 100644 > --- a/drivers/gpu/drm/etnaviv/etnaviv_dump.c > +++ b/drivers/gpu/drm/etnaviv/etnaviv_dump.c > @@ -159,8 +159,7 @@ void etnaviv_core_dump(struct etnaviv_gem_submit *submit) > file_size += sizeof(*iter.hdr) * n_obj; > > /* Allocate the file in vmalloc memory, it's likely to be big */ > - iter.start = __vmalloc(file_size, GFP_KERNEL | __GFP_NOWARN | > - __GFP_NORETRY); > + iter.start = __vmalloc(file_size, GFP_NOWAIT | __GFP_NOWARN); > if (!iter.start) { > mutex_unlock(&submit->mmu_context->lock); > dev_warn(gpu->dev, "failed to allocate devcoredump file\n"); > @@ -230,5 +229,6 @@ void etnaviv_core_dump(struct etnaviv_gem_submit *submit) > > etnaviv_core_dump_header(&iter, ETDUMP_BUF_END, iter.data); > > - dev_coredumpv(gpu->dev, iter.start, iter.data - iter.start, GFP_KERNEL); > + dev_coredumpv(gpu->dev, iter.start, iter.data - iter.start, > + GFP_NOWAIT | __GFP_NOWARN); > }
On Do, 2024-05-16 at 19:20 +0200, Lucas Stach wrote: > Am Freitag, dem 26.01.2024 um 17:46 +0100 schrieb Lucas Stach: > > The etnaviv devcoredump is created in the GPU reset path, which > > must make forward progress to avoid stalling memory reclaim on > > unsignalled dma fences. The currently used __GFP_NORETRY does not > > prohibit sleeping on direct reclaim, breaking the forward progress > > guarantee. Switch to GFP_NOWAIT, which allows background reclaim > > to be triggered, but avoids any stalls waiting for direct reclaim. > > > Any takers for reviewing this one? > > Regards, > Lucas > > > Signed-off-by: Lucas Stach <l.stach@pengutronix.de> > > --- > > drivers/gpu/drm/etnaviv/etnaviv_dump.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/gpu/drm/etnaviv/etnaviv_dump.c b/drivers/gpu/drm/etnaviv/etnaviv_dump.c > > index 898f84a0fc30c..42c5028872d54 100644 > > --- a/drivers/gpu/drm/etnaviv/etnaviv_dump.c > > +++ b/drivers/gpu/drm/etnaviv/etnaviv_dump.c > > @@ -159,8 +159,7 @@ void etnaviv_core_dump(struct etnaviv_gem_submit *submit) > > file_size += sizeof(*iter.hdr) * n_obj; > > > > /* Allocate the file in vmalloc memory, it's likely to be big */ > > - iter.start = __vmalloc(file_size, GFP_KERNEL | __GFP_NOWARN | > > - __GFP_NORETRY); > > + iter.start = __vmalloc(file_size, GFP_NOWAIT | __GFP_NOWARN); > > if (!iter.start) { > > mutex_unlock(&submit->mmu_context->lock); > > dev_warn(gpu->dev, "failed to allocate devcoredump file\n"); > > @@ -230,5 +229,6 @@ void etnaviv_core_dump(struct etnaviv_gem_submit *submit) > > > > etnaviv_core_dump_header(&iter, ETDUMP_BUF_END, iter.data); > > > > - dev_coredumpv(gpu->dev, iter.start, iter.data - iter.start, GFP_KERNEL); > > + dev_coredumpv(gpu->dev, iter.start, iter.data - iter.start, > > + GFP_NOWAIT | __GFP_NOWARN); Should this be __GFP_NOWARN? There is no fallback on failure, and if this fails and the __vmalloc() above didn't, there is no error message at all. regards Philipp
On Fri, May 17, 2024 at 10:18:50AM +0200, Philipp Zabel wrote: > On Do, 2024-05-16 at 19:20 +0200, Lucas Stach wrote: > > Am Freitag, dem 26.01.2024 um 17:46 +0100 schrieb Lucas Stach: > > > The etnaviv devcoredump is created in the GPU reset path, which > > > must make forward progress to avoid stalling memory reclaim on > > > unsignalled dma fences. The currently used __GFP_NORETRY does not > > > prohibit sleeping on direct reclaim, breaking the forward progress > > > guarantee. Switch to GFP_NOWAIT, which allows background reclaim > > > to be triggered, but avoids any stalls waiting for direct reclaim. > > > > > Any takers for reviewing this one? > > > > Regards, > > Lucas > > > > > Signed-off-by: Lucas Stach <l.stach@pengutronix.de> > > > --- > > > drivers/gpu/drm/etnaviv/etnaviv_dump.c | 6 +++--- > > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/etnaviv/etnaviv_dump.c b/drivers/gpu/drm/etnaviv/etnaviv_dump.c > > > index 898f84a0fc30c..42c5028872d54 100644 > > > --- a/drivers/gpu/drm/etnaviv/etnaviv_dump.c > > > +++ b/drivers/gpu/drm/etnaviv/etnaviv_dump.c > > > @@ -159,8 +159,7 @@ void etnaviv_core_dump(struct etnaviv_gem_submit *submit) > > > file_size += sizeof(*iter.hdr) * n_obj; > > > > > > /* Allocate the file in vmalloc memory, it's likely to be big */ > > > - iter.start = __vmalloc(file_size, GFP_KERNEL | __GFP_NOWARN | > > > - __GFP_NORETRY); > > > + iter.start = __vmalloc(file_size, GFP_NOWAIT | __GFP_NOWARN); > > > if (!iter.start) { > > > mutex_unlock(&submit->mmu_context->lock); > > > dev_warn(gpu->dev, "failed to allocate devcoredump file\n"); > > > @@ -230,5 +229,6 @@ void etnaviv_core_dump(struct etnaviv_gem_submit *submit) > > > > > > etnaviv_core_dump_header(&iter, ETDUMP_BUF_END, iter.data); > > > > > > - dev_coredumpv(gpu->dev, iter.start, iter.data - iter.start, GFP_KERNEL); > > > + dev_coredumpv(gpu->dev, iter.start, iter.data - iter.start, > > > + GFP_NOWAIT | __GFP_NOWARN); > > Should this be __GFP_NOWARN? There is no fallback on failure, and if > this fails and the __vmalloc() above didn't, there is no error message > at all. GFP_NOWAIT already has __GFP_NOWARN, so redundant. And there's really nothing you can do as a fallback (aside from dmesg output, which this code already does - ok mabye dev_coredump could also do warnings, but that's a separate patch). With the __GFP_NOWARN dropped: Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Cheers, Sima
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_dump.c b/drivers/gpu/drm/etnaviv/etnaviv_dump.c index 898f84a0fc30c..42c5028872d54 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_dump.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_dump.c @@ -159,8 +159,7 @@ void etnaviv_core_dump(struct etnaviv_gem_submit *submit) file_size += sizeof(*iter.hdr) * n_obj; /* Allocate the file in vmalloc memory, it's likely to be big */ - iter.start = __vmalloc(file_size, GFP_KERNEL | __GFP_NOWARN | - __GFP_NORETRY); + iter.start = __vmalloc(file_size, GFP_NOWAIT | __GFP_NOWARN); if (!iter.start) { mutex_unlock(&submit->mmu_context->lock); dev_warn(gpu->dev, "failed to allocate devcoredump file\n"); @@ -230,5 +229,6 @@ void etnaviv_core_dump(struct etnaviv_gem_submit *submit) etnaviv_core_dump_header(&iter, ETDUMP_BUF_END, iter.data); - dev_coredumpv(gpu->dev, iter.start, iter.data - iter.start, GFP_KERNEL); + dev_coredumpv(gpu->dev, iter.start, iter.data - iter.start, + GFP_NOWAIT | __GFP_NOWARN); }
The etnaviv devcoredump is created in the GPU reset path, which must make forward progress to avoid stalling memory reclaim on unsignalled dma fences. The currently used __GFP_NORETRY does not prohibit sleeping on direct reclaim, breaking the forward progress guarantee. Switch to GFP_NOWAIT, which allows background reclaim to be triggered, but avoids any stalls waiting for direct reclaim. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> --- drivers/gpu/drm/etnaviv/etnaviv_dump.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)