Thread (5 messages) flat view 5 messages, 3 authors, 2011-02-14
DORMANTno replies

[PATCH 1/2] ARM: Introduce THREAD_NOTIFY_COPY for copy_thread() hooks

From: Russell King - ARM Linux <hidden>
Date: 2011-02-14 16:13:21

On Mon, Feb 14, 2011 at 12:12:05PM -0000, Will Deacon wrote:
Hi Catalin,
quoted
Subject: [PATCH 1/2] ARM: Introduce THREAD_NOTIFY_COPY for copy_thread() hooks

This patch adds THREAD_NOTIFY_COPY for colling registered handlers
during the copy_thread() function call. It also changes the VFP handler
to use a switch statement rather than if..else and ignore this event.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
---
 arch/arm/include/asm/thread_notify.h |    1 +
 arch/arm/kernel/process.c            |    2 ++
 arch/arm/vfp/vfpmodule.c             |   22 +++++++++++++++-------
 3 files changed, 18 insertions(+), 7 deletions(-)
This would be useful for the hw-breakpoint code, where we need to clear
(memset 0) the breakpoint structures in the child so that they don't get
unregistered later on.

However, we also need to flush (unregister) breakpoints in flush_thread
so that they don't persist across an exec. Ideally, we'd have a single
notifier block and act on THREAD_NOTIFY_{FLUSH,COPY} accordingly, but
the problem is that THREAD_NOTIFY_FLUSH is only notified *after* zeroing
most of the thread structure, so the call is currently inlined into
flush_thread and we don't use a notifier.
It's better to avoid the thread notifier if you don't need all the
facilities it offers as it gets called for every thread switch.  Every
additional registration will add additional cycles to the thread switch.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help