[lkml]   [2010]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH 07/10] module: __rcu annotations
    On Wednesday 24 February 2010 23:17:49 Paul E. McKenney wrote:
    > > Ok, this is a significant limitation of the list rcu annotation
    > > then, it's not possible to pass the same list into list_for_each_entry
    > > and list_for_each_entry_rcu with the way I changed the rcu list
    > > definition. I would be possible to do a __list_for_each_entry_rcu
    > > macro that takes an rcu_list_head but does not actually use
    > > rcu_dereference, but I'm not sure if that's good enough.
    > Hmmm... If the __rcu annotation was visible at runtime, it would be
    > easy provide an annotated version of list_for_each_entry_rcu() that
    > checks for module_mutex being held under lockdep.

    Well, if we keep the struct rcu_list_head and make it mandatory for
    rcu protected lists, it could be defined as

    struct rcu_list_head {
    struct list_head head;
    bool (*check)(void);

    #define RCU_LIST_HEAD_INIT_CHECK(__head, __check) \
    { .head = LIST_HEAD_INIT((__head).head), .check = (__check) }
    #define RCU_LIST_HEAD_INIT_CHECK(__list,__check) {.head = LIST_HEAD_INIT((__head).head) }

    #define RCU_LIST_HEAD_INIT(head) RCU_LIST_HEAD_INIT_CHECK(head,&rcu_read_lock_held)
    #define RCU_LIST_HEAD_INIT_BH(head) RCU_LIST_HEAD_INIT_CHECK(head,&rcu_read_lock_bh_held)

    #define list_entry_rcu_check(ptr, type, member, check) \
    container_of(rcu_dereference_check((void __rcu __force *)(ptr), check), type, member)

    #define list_for_each_entry_rcu(pos, __head, member) \
    for (pos = list_entry_rcu_check((__head)->, typeof(*pos), \
    member, (__head)->check); \
    prefetch(pos->, &pos->member != (head); \
    pos = list_entry_rcu_check(pos->, typeof(*pos), \
    member, (__head)->check)))

    That would let us check all the heads for correct usage, and at the same
    time avoid having to annotate all the list entries.


     \ /
      Last update: 2010-02-25 00:11    [W:0.020 / U:3.776 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site