Re: [PATCH 2/8] drm/panfrost: Fix a race in panfrost_ioctl_madvise()

2019-12-06 Thread Boris Brezillon
On Fri, 6 Dec 2019 08:53:27 +0100 Boris Brezillon wrote: > On Thu, 5 Dec 2019 17:08:02 -0600 > Rob Herring wrote: > > > On Fri, Nov 29, 2019 at 8:33 AM Boris Brezillon > > wrote: > > > > > > On Fri, 29 Nov 2019 14:24:48 + > > > Steven Price wrote: > > > > > > > On 29/11/2019 13:59,

Re: [PATCH 2/8] drm/panfrost: Fix a race in panfrost_ioctl_madvise()

2019-12-05 Thread Boris Brezillon
On Thu, 5 Dec 2019 17:08:02 -0600 Rob Herring wrote: > On Fri, Nov 29, 2019 at 8:33 AM Boris Brezillon > wrote: > > > > On Fri, 29 Nov 2019 14:24:48 + > > Steven Price wrote: > > > > > On 29/11/2019 13:59, Boris Brezillon wrote: > > > > If 2 threads change the MADVISE property of the sa

Re: [PATCH 2/8] drm/panfrost: Fix a race in panfrost_ioctl_madvise()

2019-12-05 Thread Rob Herring
On Fri, Nov 29, 2019 at 8:33 AM Boris Brezillon wrote: > > On Fri, 29 Nov 2019 14:24:48 + > Steven Price wrote: > > > On 29/11/2019 13:59, Boris Brezillon wrote: > > > If 2 threads change the MADVISE property of the same BO in parallel we > > > might end up with an shmem->madv value that's in

Re: [PATCH 2/8] drm/panfrost: Fix a race in panfrost_ioctl_madvise()

2019-11-29 Thread Boris Brezillon
On Fri, 29 Nov 2019 21:07:33 +0100 Daniel Vetter wrote: > On Fri, Nov 29, 2019 at 02:40:34PM +, Steven Price wrote: > > On 29/11/2019 14:33, Boris Brezillon wrote: > > > On Fri, 29 Nov 2019 14:24:48 + > > > Steven Price wrote: > > > > > >> On 29/11/2019 13:59, Boris Brezillon wrote:

Re: [PATCH 2/8] drm/panfrost: Fix a race in panfrost_ioctl_madvise()

2019-11-29 Thread Daniel Vetter
On Fri, Nov 29, 2019 at 02:40:34PM +, Steven Price wrote: > On 29/11/2019 14:33, Boris Brezillon wrote: > > On Fri, 29 Nov 2019 14:24:48 + > > Steven Price wrote: > > > >> On 29/11/2019 13:59, Boris Brezillon wrote: > >>> If 2 threads change the MADVISE property of the same BO in parallel

Re: [PATCH 2/8] drm/panfrost: Fix a race in panfrost_ioctl_madvise()

2019-11-29 Thread Steven Price
On 29/11/2019 14:33, Boris Brezillon wrote: > On Fri, 29 Nov 2019 14:24:48 + > Steven Price wrote: > >> On 29/11/2019 13:59, Boris Brezillon wrote: >>> If 2 threads change the MADVISE property of the same BO in parallel we >>> might end up with an shmem->madv value that's inconsistent with th

Re: [PATCH 2/8] drm/panfrost: Fix a race in panfrost_ioctl_madvise()

2019-11-29 Thread Boris Brezillon
On Fri, 29 Nov 2019 14:24:48 + Steven Price wrote: > On 29/11/2019 13:59, Boris Brezillon wrote: > > If 2 threads change the MADVISE property of the same BO in parallel we > > might end up with an shmem->madv value that's inconsistent with the > > presence of the BO in the shrinker list. >

Re: [PATCH 2/8] drm/panfrost: Fix a race in panfrost_ioctl_madvise()

2019-11-29 Thread Steven Price
On 29/11/2019 13:59, Boris Brezillon wrote: > If 2 threads change the MADVISE property of the same BO in parallel we > might end up with an shmem->madv value that's inconsistent with the > presence of the BO in the shrinker list. I'm a bit worried from the point of view of user space sanity that y

[PATCH 2/8] drm/panfrost: Fix a race in panfrost_ioctl_madvise()

2019-11-29 Thread Boris Brezillon
If 2 threads change the MADVISE property of the same BO in parallel we might end up with an shmem->madv value that's inconsistent with the presence of the BO in the shrinker list. The easiest solution to fix that is to protect the drm_gem_shmem_madvise() call with the shrinker lock. Fixes: 013b65