From: Chris Friesen <cfriesen@nortel.com>
To: Arjan van de Ven <arjan@infradead.org>
Cc: linuxppc-dev@ozlabs.org, Linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: question on symbol exports
Date: Tue, 01 Feb 2005 09:37:00 -0600 [thread overview]
Message-ID: <41FFA21C.8060203@nortelnetworks.com> (raw)
In-Reply-To: <1107243398.4208.47.camel@laptopd505.fenrus.org>
Arjan van de Ven wrote:
> On Mon, 2005-01-31 at 18:15 -0600, Chris Friesen wrote:
>>Is there any particular reason why modules should not be allowed to
>>flush the tlb, or is this an oversight?
>
> can you point at the url to your module source? I suspect modules doing
> tlb flushes is the wrong thing, but without seeing the source it's hard
> to tell.
I've included the relevent code at the bottom. The module will be
released under the GPL.
I've got a module that I'm porting forward from 2.4. The basic idea is
that we want to be able to track pages dirtied by an application. The
system has no swap, so we use the dirty bit to get this information. On
demand we walk the page tables belonging to the process, store the
addresses of any dirty ones, flush the tlb, and mark them clean.
I (obviously) don't have a good understanding of how the tlb interacts
with the software page tables. If we don't need to flush the tlb I'd
love to hear it. If there's an easier way than walking the tables
manually please let me know.
If it matters, some of the dirty pages may be code (it's used by an
emulator for a system that can handle on-the-fly binary patching).
Thanks,
Chris
Note: this code is run while holding &mm->mmap_sem and &mm->page_table_lock.
/* scan through the entire address space given */
dirty_count = 0;
for(addr=start&PAGE_MASK; addr<=end; addr+=PAGE_SIZE) {
pgd_t *pgd;
pmd_t *pmd;
pte_t *ptep, pte;
/* Page table walking code stolen from follow_page() except
* that this version does not support huge tlbs.
*/
pgd = pgd_offset(mm, addr);
if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd)))
continue;
pmd = pmd_offset(pgd, addr);
if (pmd_none(*pmd))
continue;
if (unlikely(pmd_bad(*pmd)))
continue;
ptep = pte_offset_map(pmd, addr);
if (!ptep)
continue;
pte = *ptep;
pte_unmap(ptep);
if (!pte_present(pte))
continue;
if (!pte_dirty(pte))
continue;
if (!pte_read(pte))
continue;
/* We have a user readable dirty page. Count it.*/
dirty_count++;
if (dirty_count > entries) {
continue;
} else {
__put_user(addr, buf);
buf++;
}
flush_tlb_page(find_vma(mm,addr), addr);
pte = pte_mkclean(pte);
}
next prev parent reply other threads:[~2005-02-01 15:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-01 0:15 question on symbol exports Chris Friesen
2005-02-01 7:36 ` Arjan van de Ven
2005-02-01 15:37 ` Chris Friesen [this message]
2005-02-01 15:50 ` Arjan van de Ven
2005-02-01 17:00 ` Chris Friesen
[not found] ` <20050204203050.GA5889@dmt.cnet>
2005-02-04 20:14 ` Chris Friesen
2005-02-05 9:19 ` Benjamin Herrenschmidt
2005-02-07 14:44 ` Chris Friesen
2005-02-07 21:35 ` Benjamin Herrenschmidt
2005-02-07 23:02 ` Chris Friesen
2005-02-07 23:42 ` Dan Malek
2005-02-08 15:36 ` Chris Friesen
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=41FFA21C.8060203@nortelnetworks.com \
--to=cfriesen@nortel.com \
--cc=arjan@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
/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).