Re: [PATCH v4 3/3] drm/gem-shmem: Add import attachment warning to locked pin function

2024-05-23 Thread Boris Brezillon
> need to make sure the non-NULL check warning is also added to the latter. > > Cc: Thomas Zimmermann > Cc: Dmitry Osipenko > Cc: Boris Brezillon > Fixes: a78027847226 ("drm/gem: Acquire reservation lock in > drm_gem_{pin/unpin}()") > Signed-off-by: Adrián Laru

Re: [PATCH v4 2/3] drm/lima: Fix dma_resv deadlock at drm object pin time

2024-05-23 Thread Boris Brezillon
ich also tries to lock the same dma_resv, leading to a double lock > situation. > > As was already done for Panfrost in the previous commit, fix it by > replacing drm_gem_shmem_pin() with its locked variant. > > Cc: Thomas Zimmermann > Cc: Dmitry Osipenko > Cc: Boris Brezil

Re: [PATCH v4 1/3] drm/panfrost: Fix dma_resv deadlock at drm object pin time

2024-05-23 Thread Boris Brezillon
){+.+.}-{3:3}, at: > drm_gem_pin+0x2c/0x80 [drm] > > Fix it by replacing drm_gem_shmem_pin with its locked version, as the lock > had already been taken by drm_gem_pin(). > > Cc: Thomas Zimmermann > Cc: Dmitry Osipenko > Cc: Boris Brezillon > Cc: Steven Price > Fi

Re: [PATCH v3 0/2] drm: Fix dma_resv deadlock at drm object pin time

2024-05-21 Thread Boris Brezillon
On Fri, 17 May 2024 19:16:21 +0100 Adrián Larumbe wrote: > Hi Boris and Thomas, > > On 02.05.2024 14:18, Thomas Zimmermann wrote: > > Hi > > > > Am 02.05.24 um 14:00 schrieb Boris Brezillon: > > > On Thu, 2 May 2024 13:59:41 +0200 > > > Boris

Re: [PATCH v4 0/5] drm/panthor: Collection of tiler heap related fixes

2024-05-13 Thread Boris Brezillon
On Thu, 2 May 2024 18:51:53 +0200 Boris Brezillon wrote: > This is a collection of tiler heap fixes for bugs/oddities found while > looking at incremental rendering. > > Ideally, we want to land those before 6.10 is released, so we don't need > to increment the driver ver

Re: [PATCH 0/4] drm/panthor: More reset fixes

2024-05-13 Thread Boris Brezillon
On Thu, 2 May 2024 20:38:08 +0200 Boris Brezillon wrote: > Hello, > > This is a collection of fixes for bugs found while chasing an > unrecoverable fault leading to a device unplug (because of some > other bugs that was introduced in my local dev branch). > > The firs

Re: [PATCH] drm/panthor: Fix the FW reset logic

2024-05-02 Thread Boris Brezillon
On Tue, 30 Apr 2024 13:37:27 +0200 Boris Brezillon wrote: > In the post_reset function, if the fast reset didn't succeed, we > are not clearing the fast_reset flag, which prevents firmware > sections from being reloaded. While at it, use panthor_fw_stop() > instead of manually wri

[PATCH 4/4] drm/panthor: Call panthor_sched_post_reset() even if the reset failed

2024-05-02 Thread Boris Brezillon
We need to undo what was done in panthor_sched_pre_reset() even if the reset failed. We just flag all previously running groups as terminated when that happens to unblock things. Signed-off-by: Boris Brezillon --- drivers/gpu/drm/panthor/panthor_device.c | 7 +-- drivers/gpu/drm/panthor

[PATCH 2/4] drm/panthor: Keep a ref to the VM at the panthor_kernel_bo level

2024-05-02 Thread Boris Brezillon
Avoids use-after-free situations when panthor_fw_unplug() is called and the kernel BO was mapped to the FW VM. Signed-off-by: Boris Brezillon --- drivers/gpu/drm/panthor/panthor_fw.c| 4 ++-- drivers/gpu/drm/panthor/panthor_gem.c | 8 +--- drivers/gpu/drm/panthor/panthor_gem.h

[PATCH 0/4] drm/panthor: More reset fixes

2024-05-02 Thread Boris Brezillon
are fixing various NULL/invalid pointer derefs caused by use-after-free situations following a device unplug. Regards, Boris Boris Brezillon (4): drm/panthor: Force an immediate reset on unrecoverable faults drm/panthor: Keep a ref to the VM at the panthor_kernel_bo level drm/panthor: Reset

[PATCH 3/4] drm/panthor: Reset the FW VM to NULL on unplug

2024-05-02 Thread Boris Brezillon
This way get NULL derefs instead of use-after-free if the FW VM is referenced after the device has been unplugged. Signed-off-by: Boris Brezillon --- drivers/gpu/drm/panthor/panthor_fw.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/panthor/panthor_fw.c b/drivers/gpu/drm

[PATCH 1/4] drm/panthor: Force an immediate reset on unrecoverable faults

2024-05-02 Thread Boris Brezillon
If the FW reports an unrecoverable fault, we need to reset the GPU before we can start re-using it again. Signed-off-by: Boris Brezillon --- drivers/gpu/drm/panthor/panthor_device.c | 1 + drivers/gpu/drm/panthor/panthor_device.h | 1 + drivers/gpu/drm/panthor/panthor_sched.c | 11

Re: [PATCH v3 3/5] drm/panthor: Relax the constraints on the tiler chunk size

2024-05-02 Thread Boris Brezillon
On Thu, 2 May 2024 16:47:56 +0100 Steven Price wrote: > On 02/05/2024 16:40, Boris Brezillon wrote: > > The field used to store the chunk size if 12 bits wide, and the encoding > > is chunk_size = chunk_header.chunk_size << 12, which gives us a > > theoretica

[PATCH v4 5/5] drm/panthor: Document drm_panthor_tiler_heap_destroy::handle validity constraints

2024-05-02 Thread Boris Brezillon
Make sure the user is aware that drm_panthor_tiler_heap_destroy::handle must be a handle previously returned by DRM_IOCTL_PANTHOR_TILER_HEAP_CREATE. v4: - Add Steve's R-b v3: - New patch Signed-off-by: Boris Brezillon Reviewed-by: Steven Price --- include/uapi/drm/panthor_drm.h | 6 +- 1

[PATCH v4 4/5] drm/panthor: Fix an off-by-one in the heap context retrieval logic

2024-05-02 Thread Boris Brezillon
alid heap handle that's zero. v4: - s/XA_FLAGS_ALLOC1/XA_FLAGS_ALLOC/ v3: - Allocate in the [0:MAX_HEAPS_PER_POOL-1] range v2: - New patch Fixes: 9cca48fa4f89 ("drm/panthor: Add the heap logical block") Reported-by: Eric Smith Signed-off-by: Boris Brezillon Tested-by: Eric Smith -

[PATCH v4 1/5] drm/panthor: Fix tiler OOM handling to allow incremental rendering

2024-05-02 Thread Boris Brezillon
: Add the scheduler logical block") Signed-off-by: Antonino Maniscalco Signed-off-by: Boris Brezillon Reviewed-by: Liviu Dudau Reviewed-by: Steven Price --- drivers/gpu/drm/panthor/panthor_heap.c | 12 drivers/gpu/drm/panthor/panthor_sched.c | 7 ++- 2 files changed, 14

[PATCH v4 3/5] drm/panthor: Relax the constraints on the tiler chunk size

2024-05-02 Thread Boris Brezillon
- Turn the power-of-two constraint into a page-aligned constraint to allow fine-tune of the initial/max heap memory size - Fix the panthor_heap_create() kerneldoc Fixes: 9cca48fa4f89 ("drm/panthor: Add the heap logical block") Signed-off-by: Boris Brezillon Reviewed-by: Liviu Dudau Rev

[PATCH v4 2/5] drm/panthor: Make sure the tiler initial/max chunks are consistent

2024-05-02 Thread Boris Brezillon
check Fixes: 9cca48fa4f89 ("drm/panthor: Add the heap logical block") Signed-off-by: Boris Brezillon Reviewed-by: Liviu Dudau Reviewed-by: Steven Price --- drivers/gpu/drm/panthor/panthor_heap.c | 3 +++ include/uapi/drm/panthor_drm.h | 8 ++-- 2 files changed, 9 ins

[PATCH v4 0/5] drm/panthor: Collection of tiler heap related fixes

2024-05-02 Thread Boris Brezillon
Antonino Maniscalco (1): drm/panthor: Fix tiler OOM handling to allow incremental rendering Boris Brezillon (4): drm/panthor: Make sure the tiler initial/max chunks are consistent drm/panthor: Relax the constraints on the tiler chunk size drm/panthor: Fix an off-by-one in the heap context

Re: [PATCH v3 4/5] drm/panthor: Fix an off-by-one in the heap context retrieval logic

2024-05-02 Thread Boris Brezillon
On Thu, 2 May 2024 16:52:24 +0100 Steven Price wrote: > On 02/05/2024 16:40, Boris Brezillon wrote: > > The heap ID is used to index the heap context pool, and allocating > > in the [1:MAX_HEAPS_PER_POOL] leads to an off-by-one. This was > > originally to avoid returni

Re: [PATCH v2] drm/panthor: Make sure we handle 'unknown group state' case properly

2024-05-02 Thread Boris Brezillon
On Thu, 2 May 2024 17:52:48 +0200 Boris Brezillon wrote: > When we check for state values returned by the FW, we only cover part of > the 0:7 range. Make sure we catch FW inconsistencies by adding a default > to the switch statement, and flagging the group state as unknown in th

Re: [PATCH] drm/panthor: Kill the faulty_slots variable in panthor_sched_suspend()

2024-05-02 Thread Boris Brezillon
On Thu, 25 Apr 2024 12:18:29 +0100 Steven Price wrote: > On 25/04/2024 11:39, Boris Brezillon wrote: > > We can use upd_ctx.timedout_mask directly, and the faulty_slots update > > in the flush_caches_failed situation is never used. > > > > Suggested-by: Suggested-b

[PATCH v2] drm/panthor: Make sure we handle 'unknown group state' case properly

2024-05-02 Thread Boris Brezillon
the group as unusable after that point, to prevent the potential corruption from creeping in other places if we continue executing stuff on this context. v2: - Add Steve's R-b - Fix commit message Reported-by: Dan Carpenter Suggested-by: Steven Price Signed-off-by: Boris Brezillon Reviewed

[PATCH v3 5/5] drm/panthor: Document drm_panthor_tiler_heap_destroy::handle validity constraints

2024-05-02 Thread Boris Brezillon
Make sure the user is aware that drm_panthor_tiler_heap_destroy::handle must be a handle previously returned by DRM_IOCTL_PANTHOR_TILER_HEAP_CREATE. Signed-off-by: Boris Brezillon --- include/uapi/drm/panthor_drm.h | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include

[PATCH v3 4/5] drm/panthor: Fix an off-by-one in the heap context retrieval logic

2024-05-02 Thread Boris Brezillon
alid heap handle that's zero. v3: - Allocate in the [0:MAX_HEAPS_PER_POOL-1] range v2: - New patch Fixes: 9cca48fa4f89 ("drm/panthor: Add the heap logical block") Reported-by: Eric Smith Signed-off-by: Boris Brezillon Tested-by: Eric Smith --- drivers/gpu/drm/panthor/panthor_hea

[PATCH v3 3/5] drm/panthor: Relax the constraints on the tiler chunk size

2024-05-02 Thread Boris Brezillon
ligned constraint to allow fine-tune of the initial/max heap memory size - Fix the panthor_heap_create() kerneldoc Fixes: 9cca48fa4f89 ("drm/panthor: Add the heap logical block") Signed-off-by: Boris Brezillon Reviewed-by: Liviu Dudau Reviewed-by: Steven Price --- drivers

[PATCH v3 2/5] drm/panthor: Make sure the tiler initial/max chunks are consistent

2024-05-02 Thread Boris Brezillon
check Fixes: 9cca48fa4f89 ("drm/panthor: Add the heap logical block") Signed-off-by: Boris Brezillon Reviewed-by: Liviu Dudau Reviewed-by: Steven Price --- drivers/gpu/drm/panthor/panthor_heap.c | 3 +++ include/uapi/drm/panthor_drm.h | 8 ++-- 2 files changed, 9 ins

[PATCH v3 0/5] drm/panthor: Collection of tiler heap related fixes

2024-05-02 Thread Boris Brezillon
Antonino Maniscalco (1): drm/panthor: Fix tiler OOM handling to allow incremental rendering Boris Brezillon (4): drm/panthor: Make sure the tiler initial/max chunks are consistent drm/panthor: Relax the constraints on the tiler chunk size drm/panthor: Fix an off-by-one in the heap context

[PATCH v3 1/5] drm/panthor: Fix tiler OOM handling to allow incremental rendering

2024-05-02 Thread Boris Brezillon
: Add the scheduler logical block") Signed-off-by: Antonino Maniscalco Signed-off-by: Boris Brezillon Reviewed-by: Liviu Dudau Reviewed-by: Steven Price --- drivers/gpu/drm/panthor/panthor_heap.c | 12 drivers/gpu/drm/panthor/panthor_sched.c | 7 ++- 2 files changed, 14

Re: [PATCH v2 4/4] drm/panthor: Fix an off-by-one in the heap context retrieval logic

2024-05-02 Thread Boris Brezillon
On Thu, 2 May 2024 16:36:02 +0200 Boris Brezillon wrote: > On Thu, 2 May 2024 15:26:55 +0100 > Steven Price wrote: > > > On 02/05/2024 15:15, Boris Brezillon wrote: > > > On Thu, 2 May 2024 15:03:51 +0100 > > > Steven Price wrote: > > > > &g

Re: [PATCH v2 4/4] drm/panthor: Fix an off-by-one in the heap context retrieval logic

2024-05-02 Thread Boris Brezillon
On Thu, 2 May 2024 15:26:55 +0100 Steven Price wrote: > On 02/05/2024 15:15, Boris Brezillon wrote: > > On Thu, 2 May 2024 15:03:51 +0100 > > Steven Price wrote: > > > >> On 30/04/2024 12:28, Boris Brezillon wrote: > >>> ID 0 is reserved to

Re: [PATCH v2 4/4] drm/panthor: Fix an off-by-one in the heap context retrieval logic

2024-05-02 Thread Boris Brezillon
On Thu, 2 May 2024 15:03:51 +0100 Steven Price wrote: > On 30/04/2024 12:28, Boris Brezillon wrote: > > ID 0 is reserved to encode 'no-tiler-heap', the heap ID range is > > [1:MAX_HEAPS_PER_POOL], which we occasionally need to turn into an index > > in the [0:MAX_HEAPS_PER

Re: [PATCH v3 0/2] drm: Fix dma_resv deadlock at drm object pin time

2024-05-02 Thread Boris Brezillon
On Thu, 2 May 2024 13:59:41 +0200 Boris Brezillon wrote: > Hi Thomas, > > On Thu, 2 May 2024 13:51:16 +0200 > Thomas Zimmermann wrote: > > > Hi, > > > > ignoring my r-b on patch 1, I'd like to rethink the current patches in > > general. > >

Re: [PATCH v3 0/2] drm: Fix dma_resv deadlock at drm object pin time

2024-05-02 Thread Boris Brezillon
Hi Thomas, On Thu, 2 May 2024 13:51:16 +0200 Thomas Zimmermann wrote: > Hi, > > ignoring my r-b on patch 1, I'd like to rethink the current patches in > general. > > I think drm_gem_shmem_pin() should become the locked version of _pin(), > so that drm_gem_shmem_object_pin() can call it

Re: [PATCH v3 1/2] drm/panfrost: Fix dma_resv deadlock at drm object pin time

2024-05-02 Thread Boris Brezillon
> drm_gem_shmem_object_pin() transition. Oh, and the commit message refers explicitly to Panfrost in a few places even though you're fixing Lima as well. > > Do the same thing for the Lima driver, as it most likely suffers from the > same issue. > > Cc: Thomas Zimmerm

Re: [PATCH v3 2/2] drm/gem-shmem: Add import attachment warning to locked pin function

2024-05-02 Thread Boris Brezillon
On Wed, 1 May 2024 07:56:00 +0100 Adrián Larumbe wrote: > Commit ec144244a43f ("drm/gem-shmem: Acquire reservation lock in GEM > pin/unpin callbacks") moved locking DRM object's dma reservation to > drm_gem_shmem_object_pin, and made drm_gem_shmem_pin_locked public, so we > need to make sure

Re: [PATCH v2 4/4] drm/panthor: Fix an off-by-one in the heap context retrieval logic

2024-04-30 Thread Boris Brezillon
On Tue, 30 Apr 2024 17:40:54 +0100 Liviu Dudau wrote: > On Tue, Apr 30, 2024 at 01:28:52PM +0200, Boris Brezillon wrote: > > ID 0 is reserved to encode 'no-tiler-heap', the heap ID range is > > [1:MAX_HEAPS_PER_POOL], which we occasionally need to turn into an inde

[PATCH] drm/panthor: Fix the FW reset logic

2024-04-30 Thread Boris Brezillon
: Add the FW logical block") Signed-off-by: Boris Brezillon --- drivers/gpu/drm/panthor/panthor_fw.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/panthor/panthor_fw.c b/drivers/gpu/drm/panthor/panthor_fw.c index 181395e2859a..fedf96274

[PATCH v2 3/4] drm/panthor: Relax the constraints on the tiler chunk size

2024-04-30 Thread Boris Brezillon
al/max heap memory size - Fix the panthor_heap_create() kerneldoc Fixes: 9cca48fa4f89 ("drm/panthor: Add the heap logical block") Signed-off-by: Boris Brezillon --- drivers/gpu/drm/panthor/panthor_heap.c | 8 include/uapi/drm/panthor_drm.h | 6 +- 2 files changed, 9

[PATCH v2 4/4] drm/panthor: Fix an off-by-one in the heap context retrieval logic

2024-04-30 Thread Boris Brezillon
block") Reported-by: Eric Smith Signed-off-by: Boris Brezillon Tested-by: Eric Smith --- drivers/gpu/drm/panthor/panthor_heap.c | 35 +++--- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/panthor/panthor_heap.c b/drivers/gpu/drm/panthor/pant

[PATCH v2 2/4] drm/panthor: Make sure the tiler initial/max chunks are consistent

2024-04-30 Thread Boris Brezillon
9cca48fa4f89 ("drm/panthor: Add the heap logical block") Signed-off-by: Boris Brezillon --- drivers/gpu/drm/panthor/panthor_heap.c | 3 +++ include/uapi/drm/panthor_drm.h | 8 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/panthor/pantho

[PATCH v2 1/4] drm/panthor: Fix tiler OOM handling to allow incremental rendering

2024-04-30 Thread Boris Brezillon
duler logical block") Signed-off-by: Antonino Maniscalco Signed-off-by: Boris Brezillon --- drivers/gpu/drm/panthor/panthor_heap.c | 12 drivers/gpu/drm/panthor/panthor_sched.c | 7 ++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/panthor/pant

[PATCH v2 0/4] drm/panthor: Collection of tiler heap related fixes

2024-04-30 Thread Boris Brezillon
: Fix tiler OOM handling to allow incremental rendering Boris Brezillon (3): drm/panthor: Make sure the tiler initial/max chunks are consistent drm/panthor: Relax the constraints on the tiler chunk size drm/panthor: Fix an off-by-one in the heap context retrieval logic drivers/gpu/drm/panthor

Re: [PATCH 2/3] drm/panthor: Make sure the tiler initial/max chunks are consistent

2024-04-25 Thread Boris Brezillon
On Thu, 25 Apr 2024 11:43:39 +0100 Steven Price wrote: > On 25/04/2024 10:28, Steven Price wrote: > > On 25/04/2024 08:18, Boris Brezillon wrote: > >> It doesn't make sense to have a maximum number of chunks smaller than > >> the initial number of chunks attached to

[PATCH] drm/panthor: Kill the faulty_slots variable in panthor_sched_suspend()

2024-04-25 Thread Boris Brezillon
We can use upd_ctx.timedout_mask directly, and the faulty_slots update in the flush_caches_failed situation is never used. Suggested-by: Suggested-by: Steven Price Signed-off-by: Boris Brezillon --- drivers/gpu/drm/panthor/panthor_sched.c | 10 +++--- 1 file changed, 3 insertions(+), 7

Re: [PATCH 3/3] drm/panthor: Relax the check on the tiler chunk size

2024-04-25 Thread Boris Brezillon
On Thu, 25 Apr 2024 10:28:56 +0100 Steven Price wrote: > On 25/04/2024 08:18, Boris Brezillon wrote: > > The field used to store the chunk size if 12 bits wide, and the encoding > NIT: ^^ is > > > is chunk_size = chunk_header.chunk_si

Re: [PATCH 1/3] drm/panthor: Fix tiler OOM handling to allow incremental rendering

2024-04-25 Thread Boris Brezillon
On Thu, 25 Apr 2024 10:28:49 +0100 Steven Price wrote: > On 25/04/2024 08:18, Boris Brezillon wrote: > > From: Antonino Maniscalco > > > > If the kernel couldn't allocate memory because we reached the maximum > > number of chunks but no render passes are in fl

[PATCH] drm/panthor: Make sure we handled the unknown group state properly

2024-04-25 Thread Boris Brezillon
the group as unusable after that point, to prevent the potential corruption from creeping in other places if we continue executing stuff on this context. Reported-by: Dan Carpenter Suggested-by: Steven Price Signed-off-by: Boris Brezillon --- drivers/gpu/drm/panthor/panthor_sched.c | 37

[PATCH 3/3] drm/panthor: Relax the check on the tiler chunk size

2024-04-25 Thread Boris Brezillon
("drm/panthor: Add the heap logical block") Signed-off-by: Boris Brezillon --- drivers/gpu/drm/panthor/panthor_heap.c | 2 +- include/uapi/drm/panthor_drm.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/panthor/panthor_heap.c b/drivers

[PATCH 2/3] drm/panthor: Make sure the tiler initial/max chunks are consistent

2024-04-25 Thread Boris Brezillon
t;drm/panthor: Add the heap logical block") Signed-off-by: Boris Brezillon --- drivers/gpu/drm/panthor/panthor_heap.c | 3 +++ include/uapi/drm/panthor_drm.h | 8 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/panthor/panthor_heap.c b/

[PATCH 1/3] drm/panthor: Fix tiler OOM handling to allow incremental rendering

2024-04-25 Thread Boris Brezillon
duler logical block") Signed-off-by: Antonino Maniscalco Signed-off-by: Boris Brezillon --- drivers/gpu/drm/panthor/panthor_sched.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sch

[PATCH 0/3] drm/panthor: Collection of tiler heap related fixes

2024-04-25 Thread Boris Brezillon
Antonino Maniscalco (1): drm/panthor: Fix tiler OOM handling to allow incremental rendering Boris Brezillon (2): drm/panthor: Make sure the tiler initial/max chunks are consistent drm/panthor: Relax the check on the tiler chunk size drivers/gpu/drm/panthor/panthor_heap.c | 5 - drivers

Re: [PATCH v2] drm/panfrost: Fix dma_resv deadlock at drm object pin time

2024-04-24 Thread Boris Brezillon
){+.+.}-{3:3}, at: > drm_gem_pin+0x2c/0x80 [drm] > > Fix it by assuming the object's reservation had already been locked by the > time we reach panfrost_gem_pin. > > Do the same thing for the Lima driver, as it most likely suffers from the > same issue. > > Cc: Thomas Z

Re: [PATCH v2 1/3] drm/panthor: introduce job cycle and timestamp accounting

2024-04-24 Thread Boris Brezillon
On Tue, 23 Apr 2024 22:32:34 +0100 Adrián Larumbe wrote: > Enable calculations of job submission times in clock cycles and wall > time. This is done by expanding the boilerplate command stream when running > a job to include instructions that compute said times right before an after > a user CS.

Re: [PATCH] drm/panfrost: Fix dma_resv deadlock at drm object pin time

2024-04-22 Thread Boris Brezillon
){+.+.}-{3:3}, at: > drm_gem_pin+0x2c/0x80 [drm] > > Fix it by assuming the object's reservation had already been locked by the > time we reach panfrost_gem_pin. > > Cc: Thomas Zimmermann > Cc: Dmitry Osipenko > Cc: Boris Brezillon > Cc: Steven Price > Fixes: a78027847

Re: [PATCH] drm/panthor: clean up some types in panthor_sched_suspend()

2024-04-17 Thread Boris Brezillon
a bug if anything > > were stored there. > > > > Signed-off-by: Dan Carpenter > > Reviewed-by: Steven Price Reviewed-by: Boris Brezillon > > If you fancy a bit more clean-up then I think faulty_slots is completely > redundant as a separate variable. In par

Re: [PATCH v3] drm/panthor: Fix couple of NULL vs IS_ERR() bugs

2024-04-03 Thread Boris Brezillon
call-sites accordingly. " Thanks, Boris > --- > This is spotted by smatch and the patch is only compile tested > > v1->v2: Fix the function panthor_vm_get_heap_pool() to only return error > pointers and handle the caller sites [Suggested by Boris Brezillon] > - Also

Re: [PATCH] drm/panthor: Fix error code in panthor_gpu_init()

2024-04-03 Thread Boris Brezillon
On Tue, 2 Apr 2024 12:56:19 +0300 Dan Carpenter wrote: > This code accidentally returns zero/success on error because of a typo. > It should be "irq" instead of "ret". The other thing is that if > platform_get_irq_byname() were to return zero then the error code would > be cmplicated.

Re: [PATCH] drm/panthor: Fix off by one in panthor_fw_get_cs_iface()

2024-04-03 Thread Boris Brezillon
On Tue, 2 Apr 2024 12:56:42 +0300 Dan Carpenter wrote: > The ->iface.streams[csg_slot][] array has MAX_CS_PER_CSG elements so > this > comparison needs to be >= to prevent an out of bounds access. > > Fixes: 2718d91816ee ("drm/panthor: Add the FW logical block") > Signed-off-by: Dan Carpenter

Re: [PATCH] drm/panthor: Fix a couple -ENOMEM error codes

2024-04-03 Thread Boris Brezillon
On Tue, 2 Apr 2024 12:58:09 +0300 Dan Carpenter wrote: > These error paths forgot to set the error code to -ENOMEM. > > Fixes: 647810ec2476 ("drm/panthor: Add the MMU/VM logical block") > Signed-off-by: Dan Carpenter Queued to drm-misc-next. Thanks, Boris > --- >

Re: [PATCH] drm/panthor: Fix NULL vs IS_ERR() bug in panthor_probe()

2024-04-03 Thread Boris Brezillon
On Tue, 2 Apr 2024 03:40:40 -0700 Harshit Mogalapalli wrote: > The devm_drm_dev_alloc() function returns error pointers. > Update the error handling to check for error pointers instead of NULL. > > Fixes: 4bdca1150792 ("drm/panthor: Add the driver frontend block") > Signed-off-by: Harshit

Re: [PATCH 1/2] drm/panthor: Cleanup unused variable 'cookie'

2024-04-03 Thread Boris Brezillon
9c916 ("drm/panthor: Drop the dev_enter/exit() sections in > _irq_suspend/resume()") > Cc: Boris Brezillon > Cc: Steven Price > Signed-off-by: Liviu Dudau Queued both patches to drm-misc-next. > --- > drivers/gpu/drm/panthor/panthor_device.h | 4 > 1 file c

Re: [PATCH 2/2] drm/panthor: Fix some kerneldoc warnings

2024-04-03 Thread Boris Brezillon
logical block") > Cc: Boris Brezillon > Cc: Steven Price > Signed-off-by: Liviu Dudau Reviewed-by: Boris Brezillon > --- > drivers/gpu/drm/panthor/panthor_sched.c | 8 +++- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/pan

Re: [PATCH 1/2] drm/panthor: Cleanup unused variable 'cookie'

2024-04-03 Thread Boris Brezillon
9c916 ("drm/panthor: Drop the dev_enter/exit() sections in > _irq_suspend/resume()") > Cc: Boris Brezillon > Cc: Steven Price > Signed-off-by: Liviu Dudau Reviewed-by: Boris Brezillon > --- > drivers/gpu/drm/panthor/panthor_device.h | 4 > 1 file changed,

Re: [PATCH v3] drm/panthor: Fix couple of NULL vs IS_ERR() bugs

2024-04-02 Thread Boris Brezillon
On Tue, 2 Apr 2024 17:44:18 +0300 Dan Carpenter wrote: > On Tue, Apr 02, 2024 at 04:38:38PM +0200, Boris Brezillon wrote: > > On Tue, 2 Apr 2024 07:14:11 -0700 > > Harshit Mogalapalli wrote: > > > > > Currently panthor_vm_get_heap_pool() returns both ERR_PT

Re: [PATCH v3] drm/panthor: Fix couple of NULL vs IS_ERR() bugs

2024-04-02 Thread Boris Brezillon
or > pointers and handle the caller sites [Suggested by Boris Brezillon] > - Also merge these IS_ERR() vs NULL bugs into same patch > > v2->v3: pull out error checking for devm_drm_dev_alloc() failure. > --- > drivers/gpu/drm/panthor/panthor_drv.c | 4 ++-- >

Re: [PATCH v2] drm/panthor: Fix couple of NULL vs IS_ERR() bugs

2024-04-02 Thread Boris Brezillon
On Tue, 2 Apr 2024 19:35:41 +0530 Harshit Mogalapalli wrote: > Hi Boris, > On 02/04/24 19:32, Boris Brezillon wrote: > > On Tue, 2 Apr 2024 06:47:08 -0700 > > Harshit Mogalapalli wrote: > > > >> 1. The devm_drm_dev_alloc() function returns error pointers. &

Re: [PATCH] drm/panthor: Fix NULL vs IS_ERR() bug in panthor_probe()

2024-04-02 Thread Boris Brezillon
t; Signed-off-by: Harshit Mogalapalli Reviewed-by: Boris Brezillon > --- > This is spotted by smatch and the patch is only compile tested > --- > drivers/gpu/drm/panthor/panthor_drv.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/pant

Re: [PATCH v2] drm/panthor: Fix couple of NULL vs IS_ERR() bugs

2024-04-02 Thread Boris Brezillon
thor: Add the driver frontend block") > Signed-off-by: Harshit Mogalapalli > --- > This is spotted by smatch and the patch is only compile tested > > v1->v2: Fix the function panthor_vm_get_heap_pool() to only return error > pointers and handle the caller sites [Suggested by Bori

Re: [PATCH] drm/panthor: Fix NULL vs IS_ERR() bug in panthor_ioctl_tiler_heap_destroy()

2024-04-02 Thread Boris Brezillon
On Tue, 2 Apr 2024 18:52:12 +0530 Harshit Mogalapalli wrote: > Hello Boris, > > On 02/04/24 18:03, Boris Brezillon wrote: > > Hello Harshit, > > > > On Tue, 2 Apr 2024 03:33:58 -0700 > > Harshit Mogalapalli wrote: > > > >> panth

Re: [PATCH] drm/panthor: Fix NULL vs IS_ERR() bug in panthor_ioctl_tiler_heap_destroy()

2024-04-02 Thread Boris Brezillon
Hello Harshit, On Tue, 2 Apr 2024 03:33:58 -0700 Harshit Mogalapalli wrote: > panthor_vm_get_heap_pool() returns ERR_PTR on failure. > > Fixes: 4bdca1150792 ("drm/panthor: Add the driver frontend block") > Signed-off-by: Harshit Mogalapalli > --- > This is spotted by smatch and the patch is

Re: [PATCH] drm/panthor: Fix a couple -ENOMEM error codes

2024-04-02 Thread Boris Brezillon
On Tue, 2 Apr 2024 12:58:09 +0300 Dan Carpenter wrote: > These error paths forgot to set the error code to -ENOMEM. > > Fixes: 647810ec2476 ("drm/panthor: Add the MMU/VM logical block") > Signed-off-by: Dan Carpenter Reviewed-by: Boris Brezillon > --- &

Re: [PATCH] drm/panthor: Fix off by one in panthor_fw_get_cs_iface()

2024-04-02 Thread Boris Brezillon
> Signed-off-by: Dan Carpenter Reviewed-by: Boris Brezillon > --- > drivers/gpu/drm/panthor/panthor_fw.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/panthor/panthor_fw.c > b/drivers/gpu/drm/panthor/panthor_fw.c > index 33

Re: [PATCH] drm/panthor: Fix error code in panthor_gpu_init()

2024-04-02 Thread Boris Brezillon
or code would > be cmplicated. Fortunately, it does not so we can just change <= to > < 0. > > Fixes: 5cd894e258c4 ("drm/panthor: Add the GPU logical block") > Signed-off-by: Dan Carpenter Reviewed-by: Boris Brezillon > --- > drivers/gpu/drm/panthor/panthor_gpu.c | 4

Re: [PATCH] drm/panthor: Fix clang -Wunused-but-set-variable in tick_ctx_apply()

2024-04-02 Thread Boris Brezillon
On Thu, 28 Mar 2024 09:22:07 -0700 Nathan Chancellor wrote: > Clang warns (or errors with CONFIG_WERROR): > > drivers/gpu/drm/panthor/panthor_sched.c:2048:6: error: variable > 'csg_mod_mask' set but not used [-Werror,-Wunused-but-set-variable] >2048 | u32 csg_mod_mask = 0,

Re: [PATCH v3 1/3] drm/panthor: Fix IO-page mmap() for 32-bit userspace on 64-bit kernel

2024-04-02 Thread Boris Brezillon
On Tue, 26 Mar 2024 12:12:03 +0100 Boris Brezillon wrote: > When mapping an IO region, the pseudo-file offset is dependent on the > userspace architecture. panthor_device_mmio_offset() abstracts that > away for us by turning a userspace MMIO offset into its kernel > equivalent,

Re: [PATCH v6 10/14] drm/panthor: Add the scheduler logical block

2024-03-28 Thread Boris Brezillon
Hi Nathan, On Thu, 28 Mar 2024 08:38:09 -0700 Nathan Chancellor wrote: > Hi Boris, > > On Thu, Feb 29, 2024 at 05:22:24PM +0100, Boris Brezillon wrote: > > > --- > > drivers/gpu/drm/panthor/panthor_sched.c | 3502 +++ > > drivers/gpu/drm/

Re: [PATCH v3 3/3] drm/panthor: Drop the dev_enter/exit() sections in _irq_suspend/resume()

2024-03-26 Thread Boris Brezillon
On Tue, 26 Mar 2024 12:12:05 +0100 Boris Brezillon wrote: > There's no reason for _irq_suspend/resume() to be called after the > device has been unplugged, and keeping this dev_enter/exit() > section in _irq_suspend() is turns _irq_suspend() into a NOP ^ s

[PATCH v3 2/3] drm/panthor: Fix ordering in _irq_suspend()

2024-03-26 Thread Boris Brezillon
by: Steven Price Signed-off-by: Boris Brezillon Reviewed-by: Steven Price --- drivers/gpu/drm/panthor/panthor_device.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/panthor/panthor_device.h b/drivers/gpu/drm/panthor/panthor_device.h index 7ee4987a3796..3a

[PATCH v3 3/3] drm/panthor: Drop the dev_enter/exit() sections in _irq_suspend/resume()

2024-03-26 Thread Boris Brezillon
t;drm/panthor: Add the device logical block") Signed-off-by: Boris Brezillon --- drivers/gpu/drm/panthor/panthor_device.h | 17 - 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/panthor/panthor_device.h b/drivers/gpu/drm/panthor/panthor_devi

[PATCH v3 1/3] drm/panthor: Fix IO-page mmap() for 32-bit userspace on 64-bit kernel

2024-03-26 Thread Boris Brezillon
Reported-by: Lukas F. Hartmann Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10835 Signed-off-by: Boris Brezillon Reviewed-by: Steven Price --- drivers/gpu/drm/panthor/panthor_device.c | 8 drivers/gpu/drm/panthor/panthor_device.h | 24 drivers/gpu/d

Re: [PATCH] drm/panthor: Fix wrong kernel-doc format in the uAPI header

2024-03-26 Thread Boris Brezillon
On Tue, 26 Mar 2024 10:30:55 +0100 Boris Brezillon wrote: > The kernel doc prefix is /** not /*. > > Reported-by: Stephen Rothwell > Signed-off-by: Boris Brezillon Queued to drm-misc-next. > --- > include/uapi/drm/panthor_drm.h | 4 ++-- > 1 file changed, 2 inser

Re: [PATCH][next] drm/panthor: Fix spelling mistake "readyness" -> "readiness"

2024-03-26 Thread Boris Brezillon
On Tue, 26 Mar 2024 10:02:19 + Colin Ian King wrote: > There is a spelling mistake in a drm_err message. Fix it. > > Signed-off-by: Colin Ian King Queued to drm-misc-next. > --- > drivers/gpu/drm/panthor/panthor_gpu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff

Re: [PATCH][next] drm/panthor: Fix spelling mistake "readyness" -> "readiness"

2024-03-26 Thread Boris Brezillon
On Tue, 26 Mar 2024 10:14:37 + Liviu Dudau wrote: > On Tue, Mar 26, 2024 at 10:02:19AM +, Colin Ian King wrote: > > There is a spelling mistake in a drm_err message. Fix it. > > > > Signed-off-by: Colin Ian King > > Acked-by: Liviu Dudau > > Boris, can you also pick this one up

Re: [PATCH v2 2/3] drm/panthor: Fix ordering in _irq_suspend()

2024-03-26 Thread Boris Brezillon
On Tue, 26 Mar 2024 09:58:17 + Liviu Dudau wrote: > On Mon, Mar 25, 2024 at 07:02:13PM +0100, Boris Brezillon wrote: > > On Mon, 25 Mar 2024 17:16:16 + > > Liviu Dudau wrote: > > > > > On Mon, Mar 25, 2024 at 02:57:04PM +0100, Boris Brezillon wro

[PATCH] drm/panthor: Fix wrong kernel-doc format in the uAPI header

2024-03-26 Thread Boris Brezillon
The kernel doc prefix is /** not /*. Reported-by: Stephen Rothwell Signed-off-by: Boris Brezillon --- include/uapi/drm/panthor_drm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/uapi/drm/panthor_drm.h b/include/uapi/drm/panthor_drm.h index 373df80f41ed

Re: [PATCH v2 3/3] drm/panthor: Actually suspend IRQs in the unplug path

2024-03-25 Thread Boris Brezillon
On Mon, 25 Mar 2024 17:24:17 + Liviu Dudau wrote: > On Mon, Mar 25, 2024 at 02:57:05PM +0100, Boris Brezillon wrote: > > panthor_xxx_irq_suspend() doesn't mask the interrupts if drm_dev_unplug() > > has been called, which is always the case when our panthor_xxx_unplu

Re: [PATCH v2 2/3] drm/panthor: Fix ordering in _irq_suspend()

2024-03-25 Thread Boris Brezillon
On Mon, 25 Mar 2024 17:16:16 + Liviu Dudau wrote: > On Mon, Mar 25, 2024 at 02:57:04PM +0100, Boris Brezillon wrote: > > Make sure we set suspended=true last to avoid generating an irq storm > > in the unlikely case where an IRQ happens between the suspended=true

[PATCH v2 3/3] drm/panthor: Actually suspend IRQs in the unplug path

2024-03-25 Thread Boris Brezillon
. v2: - Add Steve's R-b Fixes: 5fe909cae118 ("drm/panthor: Add the device logical block") Signed-off-by: Boris Brezillon Reviewed-by: Steven Price --- Found inadvertently while debugging another issue. I guess I managed to call rmmod during a PING and that led to the FW interrupt han

[PATCH v2 1/3] drm/panthor: Fix IO-page mmap() for 32-bit userspace on 64-bit kernel

2024-03-25 Thread Boris Brezillon
. Hartmann Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10835 Signed-off-by: Boris Brezillon Reviewed-by: Steven Price --- drivers/gpu/drm/panthor/panthor_device.c | 8 drivers/gpu/drm/panthor/panthor_device.h | 24 drivers/gpu/drm/panthor/panthor_drv

[PATCH v2 2/3] drm/panthor: Fix ordering in _irq_suspend()

2024-03-25 Thread Boris Brezillon
Make sure we set suspended=true last to avoid generating an irq storm in the unlikely case where an IRQ happens between the suspended=true assignment and the _INT_MASK update. v2: - New patch Reported-by: Steven Price Signed-off-by: Boris Brezillon --- drivers/gpu/drm/panthor/panthor_device.h

Re: [PATCH 2/2] drm/panthor: Actually suspend IRQs in the unplug path

2024-03-25 Thread Boris Brezillon
On Mon, 25 Mar 2024 11:17:24 + Steven Price wrote: > On 25/03/2024 10:41, Boris Brezillon wrote: > > panthor_xxx_irq_suspend() doesn't mask the interrupts if drm_dev_unplug() > > has been called, which is always the case when our panthor_xxx_unplug() > > he

Re: [PATCH 1/2] drm/panthor: Fix IO-page mmap() for 32-bit userspace on 64-bit kernel

2024-03-25 Thread Boris Brezillon
On Mon, 25 Mar 2024 11:12:40 + Steven Price wrote: > On 25/03/2024 10:41, Boris Brezillon wrote: > > When mapping an IO region, the pseudo-file offset is dependent on the > > userspace architecture. panthor_device_mmio_offset() abstract that away > > for us by turning a

[PATCH 1/2] drm/panthor: Fix IO-page mmap() for 32-bit userspace on 64-bit kernel

2024-03-25 Thread Boris Brezillon
: 5fe909cae118 ("drm/panthor: Add the device logical block") Reported-by: Adrián Larumbe Reported-by: Lukas F. Hartmann Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10835 Signed-off-by: Boris Brezillon --- drivers/gpu/drm/panthor/panthor_device.c | 11 +++ 1 file

[PATCH 2/2] drm/panthor: Actually suspend IRQs in the unplug path

2024-03-25 Thread Boris Brezillon
. Fixes: 5fe909cae118 ("drm/panthor: Add the device logical block") Signed-off-by: Boris Brezillon --- Found inadvertently while debugging another issue. I guess I managed to call rmmod during a PING and that led to the FW interrupt handler being executed after the device suspen

Re: [PATCH] drm/panthor: Don't use virt_to_pfn()

2024-03-25 Thread Boris Brezillon
On Mon, 18 Mar 2024 15:11:42 + Robin Murphy wrote: > On 18/03/2024 2:51 pm, Steven Price wrote: > > virt_to_pfn() isn't available on x86 (except to xen) so breaks > > COMPILE_TEST builds. Avoid its use completely by instead storing the > > struct page pointer allocated in

Re: [PATCH v2] drm/panthor: Fix the CONFIG_PM=n case

2024-03-25 Thread Boris Brezillon
On Mon, 18 Mar 2024 16:31:17 +0100 Boris Brezillon wrote: > Putting a hard dependency on CONFIG_PM is not possible because of a > circular dependency issue, and it's actually not desirable either. In > order to support this use case, we forcibly resume at init time, and > suspend at

[PATCH v2] drm/panthor: Fix the CONFIG_PM=n case

2024-03-18 Thread Boris Brezillon
definition Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202403031944.eoimq8wk-...@intel.com/ Signed-off-by: Boris Brezillon --- Tested by faking CONFIG_PM=n in the driver (basically commenting all pm_runtime calls, and making the panthor_device_suspend/resume

Re: [PATCH] drm/panthor: Don't use virt_to_pfn()

2024-03-18 Thread Boris Brezillon
On Mon, 18 Mar 2024 15:11:42 + Robin Murphy wrote: > On 18/03/2024 2:51 pm, Steven Price wrote: > > virt_to_pfn() isn't available on x86 (except to xen) so breaks > > COMPILE_TEST builds. Avoid its use completely by instead storing the > > struct page pointer allocated in

Re: [PATCH] drm/panthor: Don't use virt_to_pfn()

2024-03-18 Thread Boris Brezillon
> > Signed-off-by: Steven Price Reviewed-by: Boris Brezillon Thanks, Boris > --- > drivers/gpu/drm/panthor/panthor_device.c | 10 ++ > drivers/gpu/drm/panthor/panthor_device.h | 2 +- > 2 files changed, 7 insertions(+), 5 deletions(-) > > diff --git a/driv

  1   2   3   4   5   6   7   8   9   10   >