Re: [v2 PATCH 1/1] init: fix race between rootfs mount and firmware loading
From: Oleg Nesterov
Date: Thu Sep 18 2014 - 13:30:58 EST
On 09/18, Roman Peniaev wrote:
>
> If my final understanding is right (please, correct me if I am still wrong),
> following reordering can happen, but we are fine with it:
>
> wake_up_rootfs wait_event
>
> LOCK
> check the list, but empty
> set CONDITION <<< reordered
> UNLOCK
Yes,
> LOCK
> add to the list
> rmb <<< now we
> see CONDITION
Yes, but note that "now we see CONDITION" is true right after LOCK,
not sure what does this "rmb" in your pseudo mean. If you meant mb()
implied by set_current_state(), please see the comment above
prepare_to_wait().
> UNLOCK
>
> check CONDITION <<< it is
> set, we are woken up
Yes. In short, we rely on wait_queue_head_t->lock. Once a CPU takes
this lock, it should see all changes done by another CPU before it
released the same lock.
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/