Re: [PATCH] i386 TIF flags for debug regs and io bitmap in ctxsw (v2)

From: Chuck Ebbert
Date: Tue Jul 25 2006 - 15:23:13 EST


In-Reply-To: <20060725055439.GA18053@xxxxxxxxxxxxxxxxx>

On Mon, 24 Jul 2006 22:54:39 -0700, Stephane Eranian wrote:
>
> I would like to follow-up the TIF flags and especially on the
> rules of inheritance. It appears the TIF flags are copied from
> parent to child task systematically on copy_process.
> Then they are adjusted in copy_threads() or sub-functions.
>
> The TIF_IO_BITMAP is checked in copy_threads() with the following code:
>
> int copy_thread(int nr, unsigned long clone_flags, unsigned long esp,
> unsigned long unused,
> struct task_struct * p, struct pt_regs * regs)
> {
> ....
> if (unlikely(test_tsk_thread_flag(tsk, TIF_IO_BITMAP))) {
> p->thread.io_bitmap_ptr = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL);
> if (!p->thread.io_bitmap_ptr) {
> p->thread.io_bitmap_max = 0;
> return -ENOMEM;
> }
> memcpy(p->thread.io_bitmap_ptr, tsk->thread.io_bitmap_ptr,
> IO_BITMAP_BYTES);
> set_tsk_thread_flag(p, TIF_IO_BITMAP);
> }
>
> I would think that the set_tsk_thread_flag() is extraneous.
>

Yeah. But harmless.

> As for TIF_DEBUG, my patch is not clearing it. I don't think you can
> have HW breakpoints be inherited from one task to the other.

Looks like the debug regs get copied on fork and only cleared on exec
in flush_thread(). So this should be OK. Please doublecheck.

(The new TIF_DEBUG flag went into 2.8.18-rc, in case you didn't notice.)

--
Chuck

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