Message ID | 20240705200013.2656275-2-l.stach@pengutronix.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2,1/5] drm/etnaviv: hold GPU lock across perfmon sampling | expand |
> > The perf counter read functions don't just read registers, but they > also mutate state to direct the reads towards the correct pipe and > engine. Assert that the GPU mutex is held at this point, so that > those state changes don't interfere with others. > > Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com> > --- > v2: new patch > --- > drivers/gpu/drm/etnaviv/etnaviv_perfmon.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c > index dc9dea664a28..d53a5c293373 100644 > --- a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c > +++ b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c > @@ -62,6 +62,8 @@ static u32 pipe_perf_reg_read(struct etnaviv_gpu *gpu, > u32 value = 0; > unsigned i; > > + lockdep_assert_held(&gpu->lock); > + > for (i = 0; i < gpu->identity.pixel_pipes; i++) { > pipe_select(gpu, clock, i); > value += perf_reg_read(gpu, domain, signal); > @@ -81,6 +83,8 @@ static u32 pipe_reg_read(struct etnaviv_gpu *gpu, > u32 value = 0; > unsigned i; > > + lockdep_assert_held(&gpu->lock); > + > for (i = 0; i < gpu->identity.pixel_pipes; i++) { > pipe_select(gpu, clock, i); > value += gpu_read(gpu, signal->data); > -- > 2.39.2 >
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c index dc9dea664a28..d53a5c293373 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c @@ -62,6 +62,8 @@ static u32 pipe_perf_reg_read(struct etnaviv_gpu *gpu, u32 value = 0; unsigned i; + lockdep_assert_held(&gpu->lock); + for (i = 0; i < gpu->identity.pixel_pipes; i++) { pipe_select(gpu, clock, i); value += perf_reg_read(gpu, domain, signal); @@ -81,6 +83,8 @@ static u32 pipe_reg_read(struct etnaviv_gpu *gpu, u32 value = 0; unsigned i; + lockdep_assert_held(&gpu->lock); + for (i = 0; i < gpu->identity.pixel_pipes; i++) { pipe_select(gpu, clock, i); value += gpu_read(gpu, signal->data);
The perf counter read functions don't just read registers, but they also mutate state to direct the reads towards the correct pipe and engine. Assert that the GPU mutex is held at this point, so that those state changes don't interfere with others. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> --- v2: new patch --- drivers/gpu/drm/etnaviv/etnaviv_perfmon.c | 4 ++++ 1 file changed, 4 insertions(+)