qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH 2/2] mem: prepare address_space listener rcu


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [RFC PATCH 2/2] mem: prepare address_space listener rcu style
Date: Wed, 15 May 2013 05:19:48 -0400 (EDT)

> > > rcu_read_lock();
> > > map = rcu_dereference(d->cur_map)
> > > if (unlikely(d->prev_map!=map) {
> > >     d->root = map->root;
> > >     d->pgtbl = map->pgtbl;
> > > }
> > > ......
> > > rcu_read_unlock();
> > >
> > > Then it can avoid ABA problem.
> >
> > I don't see the assignment of prev_map, which is where the ABA problem
> > arises.

If you do this:

> rcu_read_lock();
> map = rcu_derefenrence(d->cur_map)
> if (unlikely(d->prev_map!=map) {
>     d->root = map->root;
>     d->pgtbl = map->pgtbl;
>     d->prev_map = map;
> }
> ....
> rcu_read_unlock();

It can happen.  The problem is that prev_map can change _after_
the rcu_read_unlock.  It is the same as your previous solution.
Please just use the load-and-check idiom.  I'll post my RCU
implementation as soon as I finish the documentation.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]