On Fri, Aug 30, 2013 at 4:19 AM, Paolo Bonzini <pbonz...@redhat.com> wrote:
>
>
> I'm not sure about that; returning an RCU-protected variable after
> rcu_read_unlock() seems wrong to me because the pointer may not be valid
> at that point.  I suggest using a comment that asks to call
> host_from_stream_offset within rcu_read_lock()/rcu_read_unlock().
> However, if existing practice in the kernel is different, I'll bow to
that.

In this case the only caller is ram_load so I'm removing the critical
section from within host_from_stream_offset, and adding comments to note
that the ram_list needs to be protected by the caller. The current
docs/rcu.txt information indicates that rcu critical sections can be
"nested or overlapping." But your suggestion results in cleaner code - we
will have to go back to this later as you noted earlier.

Mike

Reply via email to