Re: [RFC Patch 1/10] Introducing generic hardware breakpoint handlerinterfaces

From: Alan Stern
Date: Tue Feb 03 2009 - 15:07:26 EST


On Tue, 3 Feb 2009, K.Prasad wrote:

> Hi Alan,
> After a better understanding about RCU usage in this patch, I'm
> thinking if the list traversals in kernel/hw_breakpoint.c should be
> changed into their RCU equivalent i.e. list_for_each_entry_rcu() instead
> of list_for_each_entry() and list_del_rcu() instead of list_del() -
> given that we are considering the list of thread HW breakpoints
> (thread_bps) and kernel breakpoints (cur_kbpdata) which are also
> accessed from exception-handler contexts.
>
> I think that with the possibility of parallel execution of
> the 'update' sections which would alter the protected data structures
> (mentioned above) through functions such as - say insert_bp_in_list(),
> balance_kernel_vs_user() and various other routines and the read-side
> critical regions which need to be identified after converting the list
> traversal routines it would be necessary to wrap the code around them
> with rcu_read_(un)lock() routines.

The read-side critical sections don't need to be identified -- I can
tell you exactly what they are. There is only one, and it is in
switch_to_thread_hw_breakpoint(). If you go look at that routine,
you'll see it already uses list_for_each_entry_rcu().

> What do you think? Is there something grossly incorrect in this
> assessment of locking requirements?

Not in your assessment of locking requirements, only in your
understanding of where the critical section is.

Alan Stern

--
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/