diff for duplicates of <1480333322.4245.18.camel@synopsys.com> diff --git a/a/1.txt b/N1/1.txt index f268b38..0aba402 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -3,10 +3,10 @@ Hi Yuriy, Really nice catch! Though a couple of nitpicks below. -On Mon, 2016-11-28@07:07 +0300, Yuriy Kolerov wrote: +On Mon, 2016-11-28 at 07:07 +0300, Yuriy Kolerov wrote: > Originally pfn_pte(pfn, prot) macro had this definition: > -> ????__pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) +> __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) > > The value of pfn (Page Frame Number) is shifted to the left to get the > value of pte (Page Table Entry). Usually a 4-byte value is passed to @@ -21,49 +21,49 @@ On Mon, 2016-11-28@07:07 +0300, Yuriy Kolerov wrote: > with PAE40 are mapped to virtual address incorrectly. An error may > occur when the kernel tries to unmap such bad pages: > -> ????[ECR???]: 0x00050100 => Invalid Read @ 0x41414144 by insn @ 0x801644c6 -> ????[EFA???]: 0x41414144 -> ????[BLINK ]: unmap_page_range+0x134/0x700 -> ????[ERET??]: unmap_page_range+0x17a/0x700 -> ????[STAT32]: 0x8008021e : IE K -> ????BTA: 0x801644c6 ?SP: 0x901a5e84 ?FP: 0x5ff35de8 -> ????LPS: 0x8026462c LPE: 0x80264630 LPC: 0x00000000 -> ????r00: 0x8fcc4fc0 r01: 0x2fe68000 r02: 0x41414140 -> ????r03: 0x2c05c000 r04: 0x2fe6a000 r05: 0x0009ffff -> ????r06: 0x901b6898 r07: 0x2fe68000 r08: 0x00000001 -> ????r09: 0x804a807c r10: 0x0000067e r11: 0xffffffff -> ????r12: 0x80164480 -> ????Stack Trace: -> ??????unmap_page_range+0x17a/0x700 -> ??????unmap_vmas+0x46/0x64 -> ??????do_munmap+0x210/0x450 -> ??????SyS_munmap+0x2c/0x50 -> ??????EV_Trap+0xfc/0x100 +> [ECR ]: 0x00050100 => Invalid Read @ 0x41414144 by insn @ 0x801644c6 +> [EFA ]: 0x41414144 +> [BLINK ]: unmap_page_range+0x134/0x700 +> [ERET ]: unmap_page_range+0x17a/0x700 +> [STAT32]: 0x8008021e : IE K +> BTA: 0x801644c6 SP: 0x901a5e84 FP: 0x5ff35de8 +> LPS: 0x8026462c LPE: 0x80264630 LPC: 0x00000000 +> r00: 0x8fcc4fc0 r01: 0x2fe68000 r02: 0x41414140 +> r03: 0x2c05c000 r04: 0x2fe6a000 r05: 0x0009ffff +> r06: 0x901b6898 r07: 0x2fe68000 r08: 0x00000001 +> r09: 0x804a807c r10: 0x0000067e r11: 0xffffffff +> r12: 0x80164480 +> Stack Trace: +> unmap_page_range+0x17a/0x700 +> unmap_vmas+0x46/0x64 +> do_munmap+0x210/0x450 +> SyS_munmap+0x2c/0x50 +> EV_Trap+0xfc/0x100 This example makes not much sense in its current form. I'd like to see how mentioned above problem leads to this failure. I.e. pfn = 0xXXX gave pte = 0xYYY and at truncated to 0xYYY -address there's no data we expected thus reading from?0x41414144 +address there's no data we expected thus reading from 0x41414144 end up in exception etc. > So the value of pfn must be casted to pte_t before shifting to > ensure that 40-bit address will not be truncated: > -> ????__pte(((pte_t) (pfn) << PAGE_SHIFT) | pgprot_val(prot)) +> __pte(((pte_t) (pfn) << PAGE_SHIFT) | pgprot_val(prot)) > -> Signed-off-by: Yuriy Kolerov <yuriy.kolerov at synopsys.com> +> Signed-off-by: Yuriy Kolerov <yuriy.kolerov@synopsys.com> > --- -> ?arch/arc/include/asm/pgtable.h | 3 ++- -> ?1 file changed, 2 insertions(+), 1 deletion(-) +> arch/arc/include/asm/pgtable.h | 3 ++- +> 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h > index 89eeb37..77bc51c 100644 > --- a/arch/arc/include/asm/pgtable.h > +++ b/arch/arc/include/asm/pgtable.h > @@ -280,7 +280,8 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep) -> ? -> ?#define pte_page(pte) pfn_to_page(pte_pfn(pte)) -> ?#define mk_pte(page, prot) pfn_pte(page_to_pfn(page), prot) +> +> #define pte_page(pte) pfn_to_page(pte_pfn(pte)) +> #define mk_pte(page, prot) pfn_pte(page_to_pfn(page), prot) > -#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) > +#define pfn_pte(pfn, prot) \ > + __pte(((pte_t) (pfn) << PAGE_SHIFT) | pgprot_val(prot)) @@ -71,25 +71,25 @@ end up in exception etc. I think it's better to split it in a bit different manner like: --------------------------------->8----------------------------- #define pfn_pte(pfn, prot) __pte(((pte_t) (pfn) << PAGE_SHIFT) | \ - ??????pgprot_val(prot)) + pgprot_val(prot)) --------------------------------->8----------------------------- Also see how this macro is implemented for example on ARM: http://lxr.free-electrons.com/source/arch/arm/include/asm/pgtable.h#L211 -------------------->8------------------ -#define pfn_pte(pfn,prot)???????__pte(__pfn_to_phys(pfn) | pgprot_val(prot)) +#define pfn_pte(pfn,prot) __pte(__pfn_to_phys(pfn) | pgprot_val(prot)) -------------------->8------------------ Where __pfn_to_phys() is: http://lxr.free-electrons.com/source/include/asm-generic/memory_model.h#L78 -------------------->8------------------ -#define __pfn_to_phys(pfn)??????PFN_PHYS(pfn) +#define __pfn_to_phys(pfn) PFN_PHYS(pfn) -------------------->8------------------ PFN_PHYS() is: http://lxr.free-electrons.com/source/include/linux/pfn.h#L20 -------------------->8------------------ -#define PFN_PHYS(x)?????((phys_addr_t)(x) << PAGE_SHIFT) +#define PFN_PHYS(x) ((phys_addr_t)(x) << PAGE_SHIFT) -------------------->8------------------ And finally phys_addr_t is: diff --git a/a/content_digest b/N1/content_digest index 255d015..98eb29e 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -1,8 +1,12 @@ "ref\01480306037-15415-1-git-send-email-yuriy.kolerov@synopsys.com\0" - "From\0Alexey.Brodkin@synopsys.com (Alexey Brodkin)\0" - "Subject\0[PATCH] ARC: mm: PAE40: Cast pfn to pte_t in pfn_pte() macro\0" + "From\0Alexey Brodkin <Alexey.Brodkin@synopsys.com>\0" + "Subject\0Re: [PATCH] ARC: mm: PAE40: Cast pfn to pte_t in pfn_pte() macro\0" "Date\0Mon, 28 Nov 2016 11:43:05 +0000\0" - "To\0linux-snps-arc@lists.infradead.org\0" + "To\0yuriy.kolerov@synopsys.com <yuriy.kolerov@synopsys.com>\0" + "Cc\0linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>" + Alexey.Brodkin@synopsys.com <Alexey.Brodkin@synopsys.com> + Vineet Gupta <Vineet.Gupta1@synopsys.com> + " linux-snps-arc@lists.infradead.org <linux-snps-arc@lists.infradead.org>\0" "\00:1\0" "b\0" "Hi Yuriy,\n" @@ -10,10 +14,10 @@ "Really nice catch!\n" "Though a couple of nitpicks below.\n" "\n" - "On Mon, 2016-11-28@07:07 +0300, Yuriy Kolerov wrote:\n" + "On Mon, 2016-11-28 at 07:07 +0300, Yuriy Kolerov wrote:\n" "> Originally pfn_pte(pfn, prot) macro had this definition:\n" "> \n" - "> ????__pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))\n" + "> \302\240\302\240\302\240\302\240__pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))\n" "> \n" "> The value of pfn (Page Frame Number) is shifted to the left to get the\n" "> value of pte (Page Table Entry). Usually a 4-byte value is passed to\n" @@ -28,49 +32,49 @@ "> with PAE40 are mapped to virtual address incorrectly. An error may\n" "> occur when the kernel tries to unmap such bad pages:\n" "> \n" - "> ????[ECR???]: 0x00050100 => Invalid Read @ 0x41414144 by insn @ 0x801644c6\n" - "> ????[EFA???]: 0x41414144\n" - "> ????[BLINK ]: unmap_page_range+0x134/0x700\n" - "> ????[ERET??]: unmap_page_range+0x17a/0x700\n" - "> ????[STAT32]: 0x8008021e : IE K\n" - "> ????BTA: 0x801644c6\t?SP: 0x901a5e84\t?FP: 0x5ff35de8\n" - "> ????LPS: 0x8026462c\tLPE: 0x80264630\tLPC: 0x00000000\n" - "> ????r00: 0x8fcc4fc0\tr01: 0x2fe68000\tr02: 0x41414140\n" - "> ????r03: 0x2c05c000\tr04: 0x2fe6a000\tr05: 0x0009ffff\n" - "> ????r06: 0x901b6898\tr07: 0x2fe68000\tr08: 0x00000001\n" - "> ????r09: 0x804a807c\tr10: 0x0000067e\tr11: 0xffffffff\n" - "> ????r12: 0x80164480\n" - "> ????Stack Trace:\n" - "> ??????unmap_page_range+0x17a/0x700\n" - "> ??????unmap_vmas+0x46/0x64\n" - "> ??????do_munmap+0x210/0x450\n" - "> ??????SyS_munmap+0x2c/0x50\n" - "> ??????EV_Trap+0xfc/0x100\n" + "> \302\240\302\240\302\240\302\240[ECR\302\240\302\240\302\240]: 0x00050100 => Invalid Read @ 0x41414144 by insn @ 0x801644c6\n" + "> \302\240\302\240\302\240\302\240[EFA\302\240\302\240\302\240]: 0x41414144\n" + "> \302\240\302\240\302\240\302\240[BLINK ]: unmap_page_range+0x134/0x700\n" + "> \302\240\302\240\302\240\302\240[ERET\302\240\302\240]: unmap_page_range+0x17a/0x700\n" + "> \302\240\302\240\302\240\302\240[STAT32]: 0x8008021e : IE K\n" + "> \302\240\302\240\302\240\302\240BTA: 0x801644c6\t\302\240SP: 0x901a5e84\t\302\240FP: 0x5ff35de8\n" + "> \302\240\302\240\302\240\302\240LPS: 0x8026462c\tLPE: 0x80264630\tLPC: 0x00000000\n" + "> \302\240\302\240\302\240\302\240r00: 0x8fcc4fc0\tr01: 0x2fe68000\tr02: 0x41414140\n" + "> \302\240\302\240\302\240\302\240r03: 0x2c05c000\tr04: 0x2fe6a000\tr05: 0x0009ffff\n" + "> \302\240\302\240\302\240\302\240r06: 0x901b6898\tr07: 0x2fe68000\tr08: 0x00000001\n" + "> \302\240\302\240\302\240\302\240r09: 0x804a807c\tr10: 0x0000067e\tr11: 0xffffffff\n" + "> \302\240\302\240\302\240\302\240r12: 0x80164480\n" + "> \302\240\302\240\302\240\302\240Stack Trace:\n" + "> \302\240\302\240\302\240\302\240\302\240\302\240unmap_page_range+0x17a/0x700\n" + "> \302\240\302\240\302\240\302\240\302\240\302\240unmap_vmas+0x46/0x64\n" + "> \302\240\302\240\302\240\302\240\302\240\302\240do_munmap+0x210/0x450\n" + "> \302\240\302\240\302\240\302\240\302\240\302\240SyS_munmap+0x2c/0x50\n" + "> \302\240\302\240\302\240\302\240\302\240\302\240EV_Trap+0xfc/0x100\n" "\n" "This example makes not much sense in its current form.\n" "I'd like to see how mentioned above problem leads to this\n" "failure. I.e. pfn = 0xXXX gave pte = 0xYYY and at truncated to 0xYYY\n" - "address there's no data we expected thus reading from?0x41414144\n" + "address there's no data we expected thus reading from\302\2400x41414144\n" "end up in exception etc.\n" "\n" "> So the value of pfn must be casted to pte_t before shifting to\n" "> ensure that 40-bit address will not be truncated:\n" "> \n" - "> ????__pte(((pte_t) (pfn) << PAGE_SHIFT) | pgprot_val(prot))\n" + "> \302\240\302\240\302\240\302\240__pte(((pte_t) (pfn) << PAGE_SHIFT) | pgprot_val(prot))\n" "> \n" - "> Signed-off-by: Yuriy Kolerov <yuriy.kolerov at synopsys.com>\n" + "> Signed-off-by: Yuriy Kolerov <yuriy.kolerov@synopsys.com>\n" "> ---\n" - "> ?arch/arc/include/asm/pgtable.h | 3 ++-\n" - "> ?1 file changed, 2 insertions(+), 1 deletion(-)\n" + "> \302\240arch/arc/include/asm/pgtable.h | 3 ++-\n" + "> \302\2401 file changed, 2 insertions(+), 1 deletion(-)\n" "> \n" "> diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h\n" "> index 89eeb37..77bc51c 100644\n" "> --- a/arch/arc/include/asm/pgtable.h\n" "> +++ b/arch/arc/include/asm/pgtable.h\n" "> @@ -280,7 +280,8 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep)\n" - "> ?\n" - "> ?#define pte_page(pte)\t\tpfn_to_page(pte_pfn(pte))\n" - "> ?#define mk_pte(page, prot)\tpfn_pte(page_to_pfn(page), prot)\n" + "> \302\240\n" + "> \302\240#define pte_page(pte)\t\tpfn_to_page(pte_pfn(pte))\n" + "> \302\240#define mk_pte(page, prot)\tpfn_pte(page_to_pfn(page), prot)\n" "> -#define pfn_pte(pfn, prot)\t__pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))\n" "> +#define pfn_pte(pfn, prot) \\\n" "> +\t__pte(((pte_t) (pfn) << PAGE_SHIFT) | pgprot_val(prot))\n" @@ -78,25 +82,25 @@ "I think it's better to split it in a bit different manner like:\n" "--------------------------------->8-----------------------------\n" "#define pfn_pte(pfn, prot)\t__pte(((pte_t) (pfn) << PAGE_SHIFT) | \\\n" - "\t\t\t\t??????pgprot_val(prot))\n" + "\t\t\t\t\302\240\302\240\302\240\302\240\302\240\302\240pgprot_val(prot))\n" "--------------------------------->8-----------------------------\n" "\n" "Also see how this macro is implemented for example on ARM:\n" "http://lxr.free-electrons.com/source/arch/arm/include/asm/pgtable.h#L211\n" "-------------------->8------------------\n" - "#define pfn_pte(pfn,prot)???????__pte(__pfn_to_phys(pfn) | pgprot_val(prot))\n" + "#define pfn_pte(pfn,prot)\302\240\302\240\302\240\302\240\302\240\302\240\302\240__pte(__pfn_to_phys(pfn) | pgprot_val(prot))\n" "-------------------->8------------------\n" "\n" "Where __pfn_to_phys() is:\n" "http://lxr.free-electrons.com/source/include/asm-generic/memory_model.h#L78\n" "-------------------->8------------------\n" - "#define __pfn_to_phys(pfn)??????PFN_PHYS(pfn)\n" + "#define __pfn_to_phys(pfn)\302\240\302\240\302\240\302\240\302\240\302\240PFN_PHYS(pfn)\n" "-------------------->8------------------\n" "\n" "PFN_PHYS() is:\n" "http://lxr.free-electrons.com/source/include/linux/pfn.h#L20\n" "-------------------->8------------------\n" - "#define PFN_PHYS(x)?????((phys_addr_t)(x) << PAGE_SHIFT)\n" + "#define PFN_PHYS(x)\302\240\302\240\302\240\302\240\302\240((phys_addr_t)(x) << PAGE_SHIFT)\n" "-------------------->8------------------\n" "\n" "And finally phys_addr_t is:\n" @@ -117,4 +121,4 @@ "\n" -Alexey -26653beaec4541278ea07afabf512315112ea4ed4c58d311902b4db2a6637ae9 +8d1bf97214bc82d3ef09397b6cd376220a35ccd618726ca34378b3f7f9c37a18
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.