From: lauraa@codeaurora.org (Laura Abbott)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v0] ARMv8:mm:Support the DEBUG_PAGEALLOC
Date: Wed, 29 Oct 2014 15:23:05 -0700 [thread overview]
Message-ID: <545168C9.4010206@codeaurora.org> (raw)
In-Reply-To: <544F338A.2060600@linaro.org>
On 10/27/2014 11:11 PM, zhichang.yuan wrote:
> Hi, Laura,
>
> Thanks for your comments!
>
>
>
...
>>> +}
>>> +
>>> +void kernel_map_pages(struct page *page, int numpages, int enable)
>>> +{
>>> + unsigned long start_addr, end_addr, addr;
>>> + unsigned int level;
>>> +
>>> + pte_t *kpte;
>>> + pteval_t old_pval, new_pval;
>>> +
>>> + int i, counter = 0;
>>> +
>>> + /*no highmem in ARMv8. */
>>> + addr = start_addr = (unsigned long)page_address(page);
>>> + end_addr = start_addr + (numpages << PAGE_SHIFT);
>>> +
>>> + for (i = 0; i < numpages; addr += PAGE_SIZE, i++) {
>>> + kpte = lookup_kaddress(addr, &level);
>>> + /*
>>> + * skip the memory holes. it is impossible if the input
>>> + * parameter is valid.
>>> + */
>>> + if (unlikely(!kpte || pte_none(*kpte))) {
>>> + pr_err("Have no kernel linear mapping for 0x%0lx\n", addr);
>>> + break;
>>> + }
>>> +
>>> + if (level != PG_LEVEL_PAGE) {
>>> + pr_err("Page entry for 0x%0lx is not PAGE LEVEL(%d)\n",
>>> + addr, level);
>>> + break;
>>> + }
>>> +
>>> + old_pval = pte_val(*kpte);
>>> + new_pval = (enable) ? (old_pval | PTE_VALID) :
>>> + (old_pval & (~PTE_VALID));
>>> + if (unlikely(new_pval == old_pval)) {
>>> + pr_warn("Page %s: same pte value at 0x%llx",
>>> + (enable) ? "alloc" : "free", old_pval);
>>> + continue;
>>> + }
>>> +
>>> + set_pte(kpte, __pte(new_pval));
>>> + counter++;
>>> + }
>>> +
>>> + if (counter)
>>> + flush_tlb_kernel_range(start_addr, end_addr);
>>> +}
>>
>> We already have some of this infrastructure to set page attributes
>> in arch/arm64/mm/pageattr.c . We should be leveraging that for
>> kernel_map_pages.
>>
> There is no pageattr.c for ARMv8. In X86, it exists.
> Do you mean pmd_modify?
>
It was added to the kernel fairly recently
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=11d91a770f1fff44dafdf88d6089a3451f99c9b6
Thanks,
Laura
--
Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
next prev parent reply other threads:[~2014-10-29 22:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-27 4:01 [PATCH v0] ARMv8:mm:Support the DEBUG_PAGEALLOC zhichang.yuan at linaro.org
2014-10-27 22:25 ` Laura Abbott
2014-10-28 6:11 ` zhichang.yuan
2014-10-29 22:23 ` Laura Abbott [this message]
2014-12-17 1:49 ` zhichang.yuan
2014-12-18 22:48 ` Laura Abbott
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=545168C9.4010206@codeaurora.org \
--to=lauraa@codeaurora.org \
--cc=linux-arm-kernel@lists.infradead.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).