Date: Fri, 3 Dec 2010 13:12:05 +0530 From: "Jayachandran C." <c.jayachandran@gmail.com> To: Alan Cox <alc@rice.edu>, Warner Losh <imp@bsdimp.com>, freebsd-mips@freebsd.org Subject: Re: vm_page_startup() Message-ID: <AANLkTiktu9N095=DS1dsBZG6Dc0oNYZ1gCG%2BUeQxrhXV@mail.gmail.com> In-Reply-To: <4CF7DD6C.6020303@rice.edu> References: <4CF5E518.20508@rice.edu> <4CF71F79.3020500@bsdimp.com> <4CF7DD6C.6020303@rice.edu>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
On Thu, Dec 2, 2010 at 11:24 PM, Alan Cox <alc@rice.edu> wrote:
> Warner Losh wrote:
>>
>> On 11/30/2010 23:03, Alan Cox wrote:
>>>
>>> Given this bit of code in the MIPS pmap:
>>>
>>> vm_offset_t
>>> pmap_map(vm_offset_t *virt, vm_offset_t start, vm_offset_t end, int prot)
>>> {
>>> vm_offset_t va, sva;
>>>
>>> if (MIPS_DIRECT_MAPPABLE(end))
>>> return (MIPS_PHYS_TO_DIRECT(start));
>>
>> All mips architectures have at least a small direct map...
>
...
> Doesn't the above test have an off-by-error, specifically, shouldn't it be
> "MIPS_DIRECT_MAPPABLE(end - 1)"?
Yes. There was another place where the same error was made. I have
attached a patch for these (also cleans up a few comments which I had
added some time back).
If there are no objections, I will check this in later today.
JC.
[-- Attachment #2 --]
Index: sys/mips/mips/pmap.c
===================================================================
--- sys/mips/mips/pmap.c (revision 215974)
+++ sys/mips/mips/pmap.c (working copy)
@@ -196,14 +196,15 @@ static void pmap_update_page_action(void *arg);
#ifndef __mips_n64
/*
- * This structure is for high memory (memory above 512Meg in 32 bit)
- * This memory area does not have direct mapping, so we a mechanism to do
- * temporary per-CPU mapping to access these addresses.
+ * This structure is for high memory (memory above 512Meg in 32 bit) support.
+ * The highmem area does not have a KSEG0 mapping, and we need a mechanism to
+ * do temporary per-CPU mappings for pmap_zero_page, pmap_copy_page etc.
*
- * At bootup we reserve 2 virtual pages per CPU for mapping highmem pages, to
- * access a highmem physical address on a CPU, we will disable interrupts and
- * add the mapping from the reserved virtual address for the CPU to the physical
- * address in the kernel pagetable.
+ * At bootup, we reserve 2 virtual pages per CPU for mapping highmem pages. To
+ * access a highmem physical address on a CPU, we map the physical address to
+ * the reserved virtual address for the CPU in the kernel pagetable. This is
+ * done with interrupts disabled(although a spinlock and sched_pin would be
+ * sufficient).
*/
struct local_sysmaps {
vm_offset_t base;
@@ -520,11 +521,11 @@ again:
}
/*
- * In 32 bit, we may have memory which cannot be mapped directly
- * this memory will need temporary mapping before it can be
+ * In 32 bit, we may have memory which cannot be mapped directly.
+ * This memory will need temporary mapping before it can be
* accessed.
*/
- if (!MIPS_DIRECT_MAPPABLE(phys_avail[i - 1]))
+ if (MIPS_DIRECT_MAPPABLE(phys_avail[i - 1] - 1) == 0)
need_local_mappings = 1;
/*
@@ -893,7 +894,7 @@ pmap_map(vm_offset_t *virt, vm_offset_t start, vm_
{
vm_offset_t va, sva;
- if (MIPS_DIRECT_MAPPABLE(end))
+ if (MIPS_DIRECT_MAPPABLE(end - 1))
return (MIPS_PHYS_TO_DIRECT(start));
va = sva = *virt;
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTiktu9N095=DS1dsBZG6Dc0oNYZ1gCG%2BUeQxrhXV>
