[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120809141740.GA8509@redhat.com>
Date: Thu, 9 Aug 2012 16:17:40 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@...e.hu>, Peter Zijlstra <peterz@...radead.org>,
Ananth N Mavinakayanahalli <ananth@...ibm.com>,
Anton Arapov <anton@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 5/7] uprobes: introduce MMF_HAS_UPROBES
On 08/09, Srikar Dronamraju wrote:
>
> * Oleg Nesterov <oleg@...hat.com> [2012-08-08 19:37:47]:
>
> > Add the new MMF_HAS_UPROBES flag. It is set by install_breakpoint()
> > and it is copied by dup_mmap(), uprobe_pre_sstep_notifier() checks
> > it to avoid the slow path if the task was never probed. Perhaps it
> > makes sense to check it in valid_vma(is_register => false) as well.
> >
> > This needs the new dup_mmap()->uprobe_dup_mmap() hook. We can't use
> > uprobe_reset_state() or put MMF_HAS_UPROBES into MMF_INIT_MASK, we
> > need oldmm->mmap_sem to avoid the race with uprobe_register() or
> > mmap() from another thread.
> >
> > Currently we never clear this bit, it can be false-positive after
> > uprobe_unregister() or uprobe_munmap() or if dup_mmap() hits the
> > probed VM_DONTCOPY vma. But this is fine correctness-wise and has
> > no effect unless the task hits the non-uprobe breakpoint.
> >
>
> In which case, cant we just delete uprobe_munmap() altogether.
>From 0/7:
The next series will teach uprobes to
clear MMF_HAS_UPROBES, but perhaps we should simply remove
uprobe_munmap() instead.
Yes, after this series uprobe_munmap() is nop, but see below.
> > @@ -1034,6 +1045,9 @@ void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned lon
> > if (!atomic_read(&vma->vm_mm->mm_users)) /* called by mmput() ? */
> > return;
> >
> > + if (!test_bit(MMF_HAS_UPROBES, &vma->vm_mm->flags))
> > + return;
> > +
>
> I am not sure whats the purpose of the above test
>
>
>
> > /* TODO: unmapping uprobe(s) will need more work */
>
> and I am unable to think what more we would want to do here.
The next series will add MMF_UPROBE_RECALC, this bits indicates that
MMF_HAS_UPROBES can be false-positive. uprobe_munmap() will roughly do
if (find_node_in_range(start, end))
set_bit(MMF_UPROBE_RECALC);
Once again, I am not sure we really need more complications, we will
discuss this later and decide. If we do not want them, we can kill
uprobe_munmap().
Just in case... uprobe_dup_mmap() is very simple but "sub-optimal".
We can improve this logic if we add uprobe_dup_vma() instead which
does
if (test_bit(MMF_HAS_UPROBES))
return;
if (find_node_in_range(...))
set_bit(MMF_HAS_UPROBES);
But again, it would be better to discuss this later.
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists