From: Oleg Nesterov <oleg@redhat.com>
To: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <peterz@infradead.org>,
Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
Anton Arapov <anton@redhat.com>, Hugh Dickins <hughd@google.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] uprobes: rename vma_address() and make it return "unsigned long"
Date: Thu, 26 Jul 2012 12:28:12 +0200 [thread overview]
Message-ID: <20120726102812.GB7197@redhat.com> (raw)
In-Reply-To: <20120726050018.GD3810@linux.vnet.ibm.com>
On 07/26, Srikar Dronamraju wrote:
>
> * Oleg Nesterov <oleg@redhat.com> [2012-07-12 19:10:22]:
>
> > 1. vma_address() returns loff_t, this looks confusing and this is
> > unnecessary after the previous change. Make it return "ulong",
> > all callers truncate the result anyway.
> >
> > 2. Its name conflicts with mm/rmap.c:vma_address(), rename it to
> > offset_to_vaddr(), this matches vaddr_to_offset().
> >
> > Signed-off-by: Oleg Nesterov <oleg@redhat.com>
>
> Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Thanks.
Could you please ack v2 below?
I forgot to update "loff_t vaddr" in mmap/munmap. IOW, this is the
same patch plus
- loff_t vaddr = offset_to_vaddr(...);
+ unsigned long vaddr = offset_to_vaddr(...);
in uprobe_mmap/munmap.
In fact I was going to do this in
"uprobes: teach build_probe_list() to consider the range" but
forgot as well.
Oleg.
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -112,14 +112,9 @@ static bool valid_vma(struct vm_area_struct *vma, bool is_register)
return false;
}
-static loff_t vma_address(struct vm_area_struct *vma, loff_t offset)
+static unsigned long offset_to_vaddr(struct vm_area_struct *vma, loff_t offset)
{
- loff_t vaddr;
-
- vaddr = vma->vm_start + offset;
- vaddr -= (loff_t)vma->vm_pgoff << PAGE_SHIFT;
-
- return vaddr;
+ return vma->vm_start + offset - ((loff_t)vma->vm_pgoff << PAGE_SHIFT);
}
static loff_t vaddr_to_offset(struct vm_area_struct *vma, unsigned long vaddr)
@@ -775,7 +770,7 @@ build_map_info(struct address_space *mapping, loff_t offset, bool is_register)
curr = info;
info->mm = vma->vm_mm;
- info->vaddr = vma_address(vma, offset);
+ info->vaddr = offset_to_vaddr(vma, offset);
}
mutex_unlock(&mapping->i_mmap_mutex);
@@ -1042,7 +1037,7 @@ int uprobe_mmap(struct vm_area_struct *vma)
list_for_each_entry_safe(uprobe, u, &tmp_list, pending_list) {
if (!ret) {
- loff_t vaddr = vma_address(vma, uprobe->offset);
+ unsigned long vaddr = offset_to_vaddr(vma, uprobe->offset);
ret = install_breakpoint(uprobe, vma->vm_mm, vma, vaddr);
/*
@@ -1103,7 +1098,7 @@ void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned lon
build_probe_list(inode, vma, start, end, &tmp_list);
list_for_each_entry_safe(uprobe, u, &tmp_list, pending_list) {
- loff_t vaddr = vma_address(vma, uprobe->offset);
+ unsigned long vaddr = offset_to_vaddr(vma, uprobe->offset);
/*
* An unregister could have removed the probe before
* unmap. So check before we decrement the count.
next prev parent reply other threads:[~2012-07-26 10:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-12 17:09 [PATCH 0/4] uprobes: vma_address() fixlets Oleg Nesterov
2012-07-12 17:10 ` [PATCH 1/4] uprobes: introduce vaddr_to_offset(vma, vaddr) Oleg Nesterov
2012-07-26 4:58 ` Srikar Dronamraju
2012-07-12 17:10 ` [PATCH 2/4] uprobes: fix register_for_each_vma()->vma_address() check Oleg Nesterov
2012-07-26 4:59 ` Srikar Dronamraju
2012-07-12 17:10 ` [PATCH 3/4] uprobes: rename vma_address() and make it return "unsigned long" Oleg Nesterov
2012-07-26 5:00 ` Srikar Dronamraju
2012-07-26 10:28 ` Oleg Nesterov [this message]
2012-07-27 6:22 ` Srikar Dronamraju
2012-07-12 17:10 ` [PATCH 4/4] uprobes: __replace_page() needs munlock_vma_page() Oleg Nesterov
2012-07-26 5:18 ` Srikar Dronamraju
2012-07-26 10:16 ` Oleg Nesterov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120726102812.GB7197@redhat.com \
--to=oleg@redhat.com \
--cc=ananth@in.ibm.com \
--cc=anton@redhat.com \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=srikar@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).