Thomas Hellström skrev:
>
>>>>
>>>>
>>> What's protecting file_priv->event_list here?
>>>
>>>
>> You can test for list emptiness without taking the lock.
>>
>>
>
> Are you suggesting accessing a member of a mutex protected struct
> without taking the mutex?
> Do you have a pointer to where what you say above is documented?
>
> That would be highly architecture dependent and in this particular case
> require the processor being capable of atomic pointer reads and writes,
> no processor r/w reordering and the compiler assuming the list head
> being declared volatile.
>
> Even if that's the case let's assume list_empty() returns true, and then
>
That should of course be "... returns false, ..."
> another thread sneaks in and empties the queue before you take the
> mutex. The next thing you do is to access and try to remove "event",
> which doesn't exist because the list is empty. If you're lucky you'll
> see an oops. If not, you end up with strange memory corruption.
>
>
>>
>>
>>>> + while (!list_empty(&file_priv->event_list)) {
>>>> + mutex_lock(&dev->struct_mutex);
>>>> + event = list_first_entry(&file_priv->event_list,
>>>> + struct drm_pending_event, link);
>>>>
/Thomas
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel