lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 14 Jun 2019 20:51:11 +0200
From:   Christian König <ckoenig.leichtzumerken@...il.com>
To:     Christian König <christian.koenig@....com>,
        Peter Zijlstra <peterz@...radead.org>,
        Lucas Stach <l.stach@...gutronix.de>,
        Russell King <linux+etnaviv@...linux.org.uk>,
        Christian Gmeiner <christian.gmeiner@...il.com>,
        Qiang Yu <yuq825@...il.com>, "Anholt, Eric" <eric@...olt.net>,
        Thomas Hellstrom <thellstrom@...are.com>,
        dri-devel <dri-devel@...ts.freedesktop.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        The etnaviv authors <etnaviv@...ts.freedesktop.org>,
        lima@...ts.freedesktop.org
Subject: Re: [PATCH 3/6] drm/gem: use new ww_mutex_(un)lock_for_each macros

Am 14.06.19 um 20:24 schrieb Daniel Vetter:
>
> On Fri, Jun 14, 2019 at 8:10 PM Christian König <ckoenig.leichtzumerken@...il.com> wrote:
>> [SNIP]
>> WW_MUTEX_LOCK_BEGIN()
>>
>> lock(lru_lock);
>>
>> while (bo = list_first(lru)) {
>> 	if (kref_get_unless_zero(bo)) {
>> 		unlock(lru_lock);
>> 		WW_MUTEX_LOCK(bo->ww_mutex);
>> 		lock(lru_lock);
>> 	} else {
>> 		/* bo is getting freed, steal it from the freeing process
>> 		 * or just ignore */
>> 	}
>> }
>> unlock(lru_lock)
>>
>> WW_MUTEX_LOCK_END;

Ah, now I know what you mean. And NO, that approach doesn't work.

See for the correct ww_mutex dance we need to use the iterator multiple 
times.

Once to give us the BOs which needs to be locked and another time to 
give us the BOs which needs to be unlocked in case of a contention.

That won't work with the approach you suggest here.

Regards,
Christian.

>
>
> Also I think if we allow this we could perhaps use this to implement the
> modeset macros too.
> -Daniel
>
>
>
>
>>> This is kinda what we went with for modeset locks with
>>> DRM_MODESET_LOCK_ALL_BEGIN/END, you can grab more locks in between the
>>> pair at least. But it's a lot more limited use-cases, maybe too fragile an
>>> idea for ww_mutex in full generality.
>>>
>>> Not going to type this out because too much w/e mode here already, but I
>>> can give it a stab next week.
>>> -Daniel
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@...ts.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
>

Powered by blists - more mailing lists