* [PATCH 1/4] MIPS: vdso: Use vma page protection for remapping
@ 2020-11-13 11:09 Thomas Bogendoerfer
2020-11-13 11:09 ` [PATCH 2/4] MIPS: kvm: Use vm_get_page_prot to get protection bits Thomas Bogendoerfer
` (3 more replies)
0 siblings, 4 replies; 14+ messages in thread
From: Thomas Bogendoerfer @ 2020-11-13 11:09 UTC (permalink / raw)
To: linux-mips, linux-kernel
MIPS protection bits are setup during runtime so using defines like
PAGE_READONLY ignores these runtime changes. To fix this we simply
use the page protection of the setup vma.
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
---
arch/mips/kernel/vdso.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/mips/kernel/vdso.c b/arch/mips/kernel/vdso.c
index 242dc5e83847..7d0b91ad2581 100644
--- a/arch/mips/kernel/vdso.c
+++ b/arch/mips/kernel/vdso.c
@@ -161,7 +161,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
gic_pfn = virt_to_phys(mips_gic_base + MIPS_GIC_USER_OFS) >> PAGE_SHIFT;
ret = io_remap_pfn_range(vma, base, gic_pfn, gic_size,
- pgprot_noncached(PAGE_READONLY));
+ pgprot_noncached(vma->vm_page_prot));
if (ret)
goto out;
}
@@ -169,7 +169,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
/* Map data page. */
ret = remap_pfn_range(vma, data_addr,
virt_to_phys(vdso_data) >> PAGE_SHIFT,
- PAGE_SIZE, PAGE_READONLY);
+ PAGE_SIZE, vma->vm_page_prot);
if (ret)
goto out;
--
2.16.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/4] MIPS: kvm: Use vm_get_page_prot to get protection bits
2020-11-13 11:09 [PATCH 1/4] MIPS: vdso: Use vma page protection for remapping Thomas Bogendoerfer
@ 2020-11-13 11:09 ` Thomas Bogendoerfer
2020-11-14 7:34 ` Huacai Chen
2020-11-19 12:54 ` Thomas Bogendoerfer
2020-11-13 11:09 ` [PATCH 3/4] MIPS: mm: shorten lines by using macro Thomas Bogendoerfer
` (2 subsequent siblings)
3 siblings, 2 replies; 14+ messages in thread
From: Thomas Bogendoerfer @ 2020-11-13 11:09 UTC (permalink / raw)
To: Huacai Chen, Aleksandar Markovic, linux-mips, kvm, linux-kernel
MIPS protection bits are setup during runtime so using defines like
PAGE_SHARED ignores this runtime changes. Using vm_get_page_prot
to get correct page protection fixes this.
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
---
arch/mips/kvm/mmu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/mips/kvm/mmu.c b/arch/mips/kvm/mmu.c
index 28c366d307e7..3dabeda82458 100644
--- a/arch/mips/kvm/mmu.c
+++ b/arch/mips/kvm/mmu.c
@@ -1074,6 +1074,7 @@ int kvm_mips_handle_commpage_tlb_fault(unsigned long badvaddr,
{
kvm_pfn_t pfn;
pte_t *ptep;
+ pgprot_t prot;
ptep = kvm_trap_emul_pte_for_gva(vcpu, badvaddr);
if (!ptep) {
@@ -1083,7 +1084,8 @@ int kvm_mips_handle_commpage_tlb_fault(unsigned long badvaddr,
pfn = PFN_DOWN(virt_to_phys(vcpu->arch.kseg0_commpage));
/* Also set valid and dirty, so refill handler doesn't have to */
- *ptep = pte_mkyoung(pte_mkdirty(pfn_pte(pfn, PAGE_SHARED)));
+ prot = vm_get_page_prot(VM_READ|VM_WRITE|VM_SHARED);
+ *ptep = pte_mkyoung(pte_mkdirty(pfn_pte(pfn, prot)));
/* Invalidate this entry in the TLB, guest kernel ASID only */
kvm_mips_host_tlb_inv(vcpu, badvaddr, false, true);
--
2.16.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 3/4] MIPS: mm: shorten lines by using macro
2020-11-13 11:09 [PATCH 1/4] MIPS: vdso: Use vma page protection for remapping Thomas Bogendoerfer
2020-11-13 11:09 ` [PATCH 2/4] MIPS: kvm: Use vm_get_page_prot to get protection bits Thomas Bogendoerfer
@ 2020-11-13 11:09 ` Thomas Bogendoerfer
2020-11-19 12:54 ` Thomas Bogendoerfer
2020-11-13 11:09 ` [PATCH 4/4] MIPS: mm: Clean up setup of protection map Thomas Bogendoerfer
2020-11-19 12:53 ` [PATCH 1/4] MIPS: vdso: Use vma page protection for remapping Thomas Bogendoerfer
3 siblings, 1 reply; 14+ messages in thread
From: Thomas Bogendoerfer @ 2020-11-13 11:09 UTC (permalink / raw)
To: linux-mips, linux-kernel
Introduce helper macro to make lines shorter.
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
---
arch/mips/mm/cache.c | 38 +++++++++++++++++++++-----------------
1 file changed, 21 insertions(+), 17 deletions(-)
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index 3e81ba000096..f66a8bfc030e 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -155,26 +155,28 @@ void __update_cache(unsigned long address, pte_t pte)
unsigned long _page_cachable_default;
EXPORT_SYMBOL(_page_cachable_default);
+#define PM(p) __pgprot(_page_cachable_default | (p))
+
static inline void setup_protection_map(void)
{
if (cpu_has_rixi) {
- protection_map[0] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
- protection_map[1] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC);
- protection_map[2] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
- protection_map[3] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC);
- protection_map[4] = __pgprot(_page_cachable_default | _PAGE_PRESENT);
- protection_map[5] = __pgprot(_page_cachable_default | _PAGE_PRESENT);
- protection_map[6] = __pgprot(_page_cachable_default | _PAGE_PRESENT);
- protection_map[7] = __pgprot(_page_cachable_default | _PAGE_PRESENT);
-
- protection_map[8] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
- protection_map[9] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC);
- protection_map[10] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE | _PAGE_NO_READ);
- protection_map[11] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE);
- protection_map[12] = __pgprot(_page_cachable_default | _PAGE_PRESENT);
- protection_map[13] = __pgprot(_page_cachable_default | _PAGE_PRESENT);
- protection_map[14] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_WRITE);
- protection_map[15] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_WRITE);
+ protection_map[0] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
+ protection_map[1] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC);
+ protection_map[2] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
+ protection_map[3] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC);
+ protection_map[4] = PM(_PAGE_PRESENT);
+ protection_map[5] = PM(_PAGE_PRESENT);
+ protection_map[6] = PM(_PAGE_PRESENT);
+ protection_map[7] = PM(_PAGE_PRESENT);
+
+ protection_map[8] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
+ protection_map[9] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC);
+ protection_map[10] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE | _PAGE_NO_READ);
+ protection_map[11] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE);
+ protection_map[12] = PM(_PAGE_PRESENT);
+ protection_map[13] = PM(_PAGE_PRESENT);
+ protection_map[14] = PM(_PAGE_PRESENT | _PAGE_WRITE);
+ protection_map[15] = PM(_PAGE_PRESENT | _PAGE_WRITE);
} else {
protection_map[0] = PAGE_NONE;
@@ -196,6 +198,8 @@ static inline void setup_protection_map(void)
}
}
+#undef PM
+
void cpu_cache_init(void)
{
if (cpu_has_3k_cache) {
--
2.16.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 4/4] MIPS: mm: Clean up setup of protection map
2020-11-13 11:09 [PATCH 1/4] MIPS: vdso: Use vma page protection for remapping Thomas Bogendoerfer
2020-11-13 11:09 ` [PATCH 2/4] MIPS: kvm: Use vm_get_page_prot to get protection bits Thomas Bogendoerfer
2020-11-13 11:09 ` [PATCH 3/4] MIPS: mm: shorten lines by using macro Thomas Bogendoerfer
@ 2020-11-13 11:09 ` Thomas Bogendoerfer
2020-11-19 12:54 ` Thomas Bogendoerfer
2020-12-12 16:29 ` Guenter Roeck
2020-11-19 12:53 ` [PATCH 1/4] MIPS: vdso: Use vma page protection for remapping Thomas Bogendoerfer
3 siblings, 2 replies; 14+ messages in thread
From: Thomas Bogendoerfer @ 2020-11-13 11:09 UTC (permalink / raw)
To: linux-mips, linux-kernel
Protection map difference between RIXI and non RIXI cpus is _PAGE_NO_EXEC
and _PAGE_NO_READ usage. Both already take care of cpu_has_rixi while
setting up the page bits. So we just need one setup of protection map
and can drop the now unused (and broken for RIXI) PAGE_* defines.
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
---
arch/mips/include/asm/pgtable.h | 8 ------
arch/mips/mm/cache.c | 55 ++++++++++++++---------------------------
2 files changed, 18 insertions(+), 45 deletions(-)
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h
index e5ef0fdd4838..158ba3aa3bf1 100644
--- a/arch/mips/include/asm/pgtable.h
+++ b/arch/mips/include/asm/pgtable.h
@@ -25,14 +25,6 @@
struct mm_struct;
struct vm_area_struct;
-#define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_NO_READ | \
- _page_cachable_default)
-#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_WRITE | \
- _page_cachable_default)
-#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_NO_EXEC | \
- _page_cachable_default)
-#define PAGE_READONLY __pgprot(_PAGE_PRESENT | \
- _page_cachable_default)
#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE | \
_PAGE_GLOBAL | _page_cachable_default)
#define PAGE_KERNEL_NC __pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE | \
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index f66a8bfc030e..36bcf4e955e8 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -159,43 +159,24 @@ EXPORT_SYMBOL(_page_cachable_default);
static inline void setup_protection_map(void)
{
- if (cpu_has_rixi) {
- protection_map[0] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
- protection_map[1] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC);
- protection_map[2] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
- protection_map[3] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC);
- protection_map[4] = PM(_PAGE_PRESENT);
- protection_map[5] = PM(_PAGE_PRESENT);
- protection_map[6] = PM(_PAGE_PRESENT);
- protection_map[7] = PM(_PAGE_PRESENT);
-
- protection_map[8] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
- protection_map[9] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC);
- protection_map[10] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE | _PAGE_NO_READ);
- protection_map[11] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE);
- protection_map[12] = PM(_PAGE_PRESENT);
- protection_map[13] = PM(_PAGE_PRESENT);
- protection_map[14] = PM(_PAGE_PRESENT | _PAGE_WRITE);
- protection_map[15] = PM(_PAGE_PRESENT | _PAGE_WRITE);
-
- } else {
- protection_map[0] = PAGE_NONE;
- protection_map[1] = PAGE_READONLY;
- protection_map[2] = PAGE_COPY;
- protection_map[3] = PAGE_COPY;
- protection_map[4] = PAGE_READONLY;
- protection_map[5] = PAGE_READONLY;
- protection_map[6] = PAGE_COPY;
- protection_map[7] = PAGE_COPY;
- protection_map[8] = PAGE_NONE;
- protection_map[9] = PAGE_READONLY;
- protection_map[10] = PAGE_SHARED;
- protection_map[11] = PAGE_SHARED;
- protection_map[12] = PAGE_READONLY;
- protection_map[13] = PAGE_READONLY;
- protection_map[14] = PAGE_SHARED;
- protection_map[15] = PAGE_SHARED;
- }
+ protection_map[0] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
+ protection_map[1] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC);
+ protection_map[2] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
+ protection_map[3] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC);
+ protection_map[4] = PM(_PAGE_PRESENT);
+ protection_map[5] = PM(_PAGE_PRESENT);
+ protection_map[6] = PM(_PAGE_PRESENT);
+ protection_map[7] = PM(_PAGE_PRESENT);
+
+ protection_map[8] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
+ protection_map[9] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC);
+ protection_map[10] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE |
+ _PAGE_NO_READ);
+ protection_map[11] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE);
+ protection_map[12] = PM(_PAGE_PRESENT);
+ protection_map[13] = PM(_PAGE_PRESENT);
+ protection_map[14] = PM(_PAGE_PRESENT | _PAGE_WRITE);
+ protection_map[15] = PM(_PAGE_PRESENT | _PAGE_WRITE);
}
#undef PM
--
2.16.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 2/4] MIPS: kvm: Use vm_get_page_prot to get protection bits
2020-11-13 11:09 ` [PATCH 2/4] MIPS: kvm: Use vm_get_page_prot to get protection bits Thomas Bogendoerfer
@ 2020-11-14 7:34 ` Huacai Chen
2020-11-16 12:30 ` Thomas Bogendoerfer
2020-11-19 12:54 ` Thomas Bogendoerfer
1 sibling, 1 reply; 14+ messages in thread
From: Huacai Chen @ 2020-11-14 7:34 UTC (permalink / raw)
To: Thomas Bogendoerfer; +Cc: Aleksandar Markovic, open list:MIPS, kvm, LKML
Hi, Thomas,
On Fri, Nov 13, 2020 at 7:13 PM Thomas Bogendoerfer
<tsbogend@alpha.franken.de> wrote:
>
> MIPS protection bits are setup during runtime so using defines like
> PAGE_SHARED ignores this runtime changes. Using vm_get_page_prot
> to get correct page protection fixes this.
Is there some visible bugs if without this fix?
Huacai
>
> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> ---
> arch/mips/kvm/mmu.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/mips/kvm/mmu.c b/arch/mips/kvm/mmu.c
> index 28c366d307e7..3dabeda82458 100644
> --- a/arch/mips/kvm/mmu.c
> +++ b/arch/mips/kvm/mmu.c
> @@ -1074,6 +1074,7 @@ int kvm_mips_handle_commpage_tlb_fault(unsigned long badvaddr,
> {
> kvm_pfn_t pfn;
> pte_t *ptep;
> + pgprot_t prot;
>
> ptep = kvm_trap_emul_pte_for_gva(vcpu, badvaddr);
> if (!ptep) {
> @@ -1083,7 +1084,8 @@ int kvm_mips_handle_commpage_tlb_fault(unsigned long badvaddr,
>
> pfn = PFN_DOWN(virt_to_phys(vcpu->arch.kseg0_commpage));
> /* Also set valid and dirty, so refill handler doesn't have to */
> - *ptep = pte_mkyoung(pte_mkdirty(pfn_pte(pfn, PAGE_SHARED)));
> + prot = vm_get_page_prot(VM_READ|VM_WRITE|VM_SHARED);
> + *ptep = pte_mkyoung(pte_mkdirty(pfn_pte(pfn, prot)));
>
> /* Invalidate this entry in the TLB, guest kernel ASID only */
> kvm_mips_host_tlb_inv(vcpu, badvaddr, false, true);
> --
> 2.16.4
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/4] MIPS: kvm: Use vm_get_page_prot to get protection bits
2020-11-14 7:34 ` Huacai Chen
@ 2020-11-16 12:30 ` Thomas Bogendoerfer
2020-11-17 1:18 ` Huacai Chen
0 siblings, 1 reply; 14+ messages in thread
From: Thomas Bogendoerfer @ 2020-11-16 12:30 UTC (permalink / raw)
To: Huacai Chen; +Cc: Aleksandar Markovic, open list:MIPS, kvm, LKML
On Sat, Nov 14, 2020 at 03:34:14PM +0800, Huacai Chen wrote:
> Hi, Thomas,
>
> On Fri, Nov 13, 2020 at 7:13 PM Thomas Bogendoerfer
> <tsbogend@alpha.franken.de> wrote:
> >
> > MIPS protection bits are setup during runtime so using defines like
> > PAGE_SHARED ignores this runtime changes. Using vm_get_page_prot
> > to get correct page protection fixes this.
> Is there some visible bugs if without this fix?
no exec isn't enabled for these mappings, if cpu supports it.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/4] MIPS: kvm: Use vm_get_page_prot to get protection bits
2020-11-16 12:30 ` Thomas Bogendoerfer
@ 2020-11-17 1:18 ` Huacai Chen
2020-11-17 10:40 ` Thomas Bogendoerfer
0 siblings, 1 reply; 14+ messages in thread
From: Huacai Chen @ 2020-11-17 1:18 UTC (permalink / raw)
To: Thomas Bogendoerfer; +Cc: Aleksandar Markovic, open list:MIPS, kvm, LKML
Hi, Thomas,
On Mon, Nov 16, 2020 at 8:35 PM Thomas Bogendoerfer
<tsbogend@alpha.franken.de> wrote:
>
> On Sat, Nov 14, 2020 at 03:34:14PM +0800, Huacai Chen wrote:
> > Hi, Thomas,
> >
> > On Fri, Nov 13, 2020 at 7:13 PM Thomas Bogendoerfer
> > <tsbogend@alpha.franken.de> wrote:
> > >
> > > MIPS protection bits are setup during runtime so using defines like
> > > PAGE_SHARED ignores this runtime changes. Using vm_get_page_prot
> > > to get correct page protection fixes this.
> > Is there some visible bugs if without this fix?
>
> no exec isn't enabled for these mappings, if cpu supports it.
The whole series wants to set XI if supported?
Huacai
Huacai
>
> Thomas.
>
> --
> Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
> good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/4] MIPS: kvm: Use vm_get_page_prot to get protection bits
2020-11-17 1:18 ` Huacai Chen
@ 2020-11-17 10:40 ` Thomas Bogendoerfer
0 siblings, 0 replies; 14+ messages in thread
From: Thomas Bogendoerfer @ 2020-11-17 10:40 UTC (permalink / raw)
To: Huacai Chen; +Cc: Aleksandar Markovic, open list:MIPS, kvm, LKML
On Tue, Nov 17, 2020 at 09:18:15AM +0800, Huacai Chen wrote:
> Hi, Thomas,
>
> On Mon, Nov 16, 2020 at 8:35 PM Thomas Bogendoerfer
> <tsbogend@alpha.franken.de> wrote:
> >
> > On Sat, Nov 14, 2020 at 03:34:14PM +0800, Huacai Chen wrote:
> > > Hi, Thomas,
> > >
> > > On Fri, Nov 13, 2020 at 7:13 PM Thomas Bogendoerfer
> > > <tsbogend@alpha.franken.de> wrote:
> > > >
> > > > MIPS protection bits are setup during runtime so using defines like
> > > > PAGE_SHARED ignores this runtime changes. Using vm_get_page_prot
> > > > to get correct page protection fixes this.
> > > Is there some visible bugs if without this fix?
> >
> > no exec isn't enabled for these mappings, if cpu supports it.
> The whole series wants to set XI if supported?
that and RI where possible. I want to get rid of the PAGE_* defines,
because they lead to forgetting about RI and XI protection map setup,
which doesn't use the defines and would need another set of defines.
So by using only protection_map[] everything goes via one place.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/4] MIPS: vdso: Use vma page protection for remapping
2020-11-13 11:09 [PATCH 1/4] MIPS: vdso: Use vma page protection for remapping Thomas Bogendoerfer
` (2 preceding siblings ...)
2020-11-13 11:09 ` [PATCH 4/4] MIPS: mm: Clean up setup of protection map Thomas Bogendoerfer
@ 2020-11-19 12:53 ` Thomas Bogendoerfer
3 siblings, 0 replies; 14+ messages in thread
From: Thomas Bogendoerfer @ 2020-11-19 12:53 UTC (permalink / raw)
To: linux-mips, linux-kernel
On Fri, Nov 13, 2020 at 12:09:49PM +0100, Thomas Bogendoerfer wrote:
> MIPS protection bits are setup during runtime so using defines like
> PAGE_READONLY ignores these runtime changes. To fix this we simply
> use the page protection of the setup vma.
>
> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> ---
> arch/mips/kernel/vdso.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/4] MIPS: kvm: Use vm_get_page_prot to get protection bits
2020-11-13 11:09 ` [PATCH 2/4] MIPS: kvm: Use vm_get_page_prot to get protection bits Thomas Bogendoerfer
2020-11-14 7:34 ` Huacai Chen
@ 2020-11-19 12:54 ` Thomas Bogendoerfer
1 sibling, 0 replies; 14+ messages in thread
From: Thomas Bogendoerfer @ 2020-11-19 12:54 UTC (permalink / raw)
To: Huacai Chen, Aleksandar Markovic, linux-mips, kvm, linux-kernel
On Fri, Nov 13, 2020 at 12:09:50PM +0100, Thomas Bogendoerfer wrote:
> MIPS protection bits are setup during runtime so using defines like
> PAGE_SHARED ignores this runtime changes. Using vm_get_page_prot
> to get correct page protection fixes this.
>
> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> ---
> arch/mips/kvm/mmu.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/4] MIPS: mm: shorten lines by using macro
2020-11-13 11:09 ` [PATCH 3/4] MIPS: mm: shorten lines by using macro Thomas Bogendoerfer
@ 2020-11-19 12:54 ` Thomas Bogendoerfer
0 siblings, 0 replies; 14+ messages in thread
From: Thomas Bogendoerfer @ 2020-11-19 12:54 UTC (permalink / raw)
To: linux-mips, linux-kernel
On Fri, Nov 13, 2020 at 12:09:51PM +0100, Thomas Bogendoerfer wrote:
> Introduce helper macro to make lines shorter.
>
> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> ---
> arch/mips/mm/cache.c | 38 +++++++++++++++++++++-----------------
> 1 file changed, 21 insertions(+), 17 deletions(-)
applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 4/4] MIPS: mm: Clean up setup of protection map
2020-11-13 11:09 ` [PATCH 4/4] MIPS: mm: Clean up setup of protection map Thomas Bogendoerfer
@ 2020-11-19 12:54 ` Thomas Bogendoerfer
2020-12-12 16:29 ` Guenter Roeck
1 sibling, 0 replies; 14+ messages in thread
From: Thomas Bogendoerfer @ 2020-11-19 12:54 UTC (permalink / raw)
To: linux-mips, linux-kernel
On Fri, Nov 13, 2020 at 12:09:52PM +0100, Thomas Bogendoerfer wrote:
> Protection map difference between RIXI and non RIXI cpus is _PAGE_NO_EXEC
> and _PAGE_NO_READ usage. Both already take care of cpu_has_rixi while
> setting up the page bits. So we just need one setup of protection map
> and can drop the now unused (and broken for RIXI) PAGE_* defines.
>
> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> ---
> arch/mips/include/asm/pgtable.h | 8 ------
> arch/mips/mm/cache.c | 55 ++++++++++++++---------------------------
> 2 files changed, 18 insertions(+), 45 deletions(-)
applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 4/4] MIPS: mm: Clean up setup of protection map
2020-11-13 11:09 ` [PATCH 4/4] MIPS: mm: Clean up setup of protection map Thomas Bogendoerfer
2020-11-19 12:54 ` Thomas Bogendoerfer
@ 2020-12-12 16:29 ` Guenter Roeck
2020-12-14 15:32 ` Thomas Bogendoerfer
1 sibling, 1 reply; 14+ messages in thread
From: Guenter Roeck @ 2020-12-12 16:29 UTC (permalink / raw)
To: Thomas Bogendoerfer; +Cc: linux-mips, linux-kernel
On Fri, Nov 13, 2020 at 12:09:52PM +0100, Thomas Bogendoerfer wrote:
> Protection map difference between RIXI and non RIXI cpus is _PAGE_NO_EXEC
> and _PAGE_NO_READ usage. Both already take care of cpu_has_rixi while
> setting up the page bits. So we just need one setup of protection map
> and can drop the now unused (and broken for RIXI) PAGE_* defines.
>
> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> ---
This patch results in:
drivers/video/fbdev/udlfb.c: In function 'dlfb_ops_mmap':
drivers/video/fbdev/udlfb.c:343:52: error: 'PAGE_SHARED' undeclared (first use in this function)
343 | if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED))
| ^~~~~~~~~~~
when building mips:allmodconfig.
Guenter
---
bisect log:
# bad: [3cc2bd440f2171f093b3a8480a4b54d8c270ed38] Add linux-next specific files for 20201211
# good: [0477e92881850d44910a7e94fc2c46f96faa131f] Linux 5.10-rc7
git bisect start 'HEAD' 'v5.10-rc7'
# bad: [0a701401d4e29d9e73f0f3cc02179fc6c9191646] Merge remote-tracking branch 'crypto/master'
git bisect bad 0a701401d4e29d9e73f0f3cc02179fc6c9191646
# bad: [196d9132cc82feb410b6386491de9ac5661b0b76] Merge remote-tracking branch 'printk/for-next'
git bisect bad 196d9132cc82feb410b6386491de9ac5661b0b76
# good: [5bc192c72197553fe3b934830482caf931347c9c] Merge remote-tracking branch 'arm-soc/for-next'
git bisect good 5bc192c72197553fe3b934830482caf931347c9c
# bad: [24aa026d842ebfa5ff9cefe92bb3d6cc6a558206] Merge remote-tracking branch 'risc-v/for-next'
git bisect bad 24aa026d842ebfa5ff9cefe92bb3d6cc6a558206
# good: [44e8eb23644eaf38dbfaf4a68d08b13c190f58c2] Merge remote-tracking branch 'm68knommu/for-next'
git bisect good 44e8eb23644eaf38dbfaf4a68d08b13c190f58c2
# good: [ff57698a9610fcf7d9c4469bf68c881eff22e2f8] powerpc: Fix update form addressing in inline assembly
git bisect good ff57698a9610fcf7d9c4469bf68c881eff22e2f8
# bad: [a7ab7f9e2de7e39cafa041fcba425935b2c188bf] Merge remote-tracking branch 'parisc-hd/for-next'
git bisect bad a7ab7f9e2de7e39cafa041fcba425935b2c188bf
# good: [724d554a117a0552c2c982f0b5cd1d685274d678] MIPS: vdso: Use vma page protection for remapping
git bisect good 724d554a117a0552c2c982f0b5cd1d685274d678
# bad: [27f45b5690f7cfe916c83aaa7263ac3da7e251ee] Merge remote-tracking branch 'mips/mips-next'
git bisect bad 27f45b5690f7cfe916c83aaa7263ac3da7e251ee
# bad: [79109a515ac3f1009632f4a4c81597e9438a2d65] MIPS: configs: drop unused BACKLIGHT_GENERIC option
git bisect bad 79109a515ac3f1009632f4a4c81597e9438a2d65
# bad: [74a2810b7c1fcd60c87a8c47f95660628e00e97c] MIPS: KASLR: Correct valid bits in apply_r_mips_26_rel()
git bisect bad 74a2810b7c1fcd60c87a8c47f95660628e00e97c
# bad: [0df162e1377a585ced8adb932f7d6e4164e91ccf] MIPS: mm: Clean up setup of protection map
git bisect bad 0df162e1377a585ced8adb932f7d6e4164e91ccf
# good: [ed2adb74217a4054a92e0a0746e31ec6f5e466c8] MIPS: mm: shorten lines by using macro
git bisect good ed2adb74217a4054a92e0a0746e31ec6f5e466c8
# first bad commit: [0df162e1377a585ced8adb932f7d6e4164e91ccf] MIPS: mm: Clean up setup of protection map
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 4/4] MIPS: mm: Clean up setup of protection map
2020-12-12 16:29 ` Guenter Roeck
@ 2020-12-14 15:32 ` Thomas Bogendoerfer
0 siblings, 0 replies; 14+ messages in thread
From: Thomas Bogendoerfer @ 2020-12-14 15:32 UTC (permalink / raw)
To: Guenter Roeck; +Cc: linux-mips, linux-kernel
On Sat, Dec 12, 2020 at 08:29:23AM -0800, Guenter Roeck wrote:
> On Fri, Nov 13, 2020 at 12:09:52PM +0100, Thomas Bogendoerfer wrote:
> > Protection map difference between RIXI and non RIXI cpus is _PAGE_NO_EXEC
> > and _PAGE_NO_READ usage. Both already take care of cpu_has_rixi while
> > setting up the page bits. So we just need one setup of protection map
> > and can drop the now unused (and broken for RIXI) PAGE_* defines.
> >
> > Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> > ---
>
> This patch results in:
>
> drivers/video/fbdev/udlfb.c: In function 'dlfb_ops_mmap':
> drivers/video/fbdev/udlfb.c:343:52: error: 'PAGE_SHARED' undeclared (first use in this function)
> 343 | if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED))
> | ^~~~~~~~~~~
>
> when building mips:allmodconfig.
thank you for the report, I've pushed a fix to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2020-12-14 17:00 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-13 11:09 [PATCH 1/4] MIPS: vdso: Use vma page protection for remapping Thomas Bogendoerfer
2020-11-13 11:09 ` [PATCH 2/4] MIPS: kvm: Use vm_get_page_prot to get protection bits Thomas Bogendoerfer
2020-11-14 7:34 ` Huacai Chen
2020-11-16 12:30 ` Thomas Bogendoerfer
2020-11-17 1:18 ` Huacai Chen
2020-11-17 10:40 ` Thomas Bogendoerfer
2020-11-19 12:54 ` Thomas Bogendoerfer
2020-11-13 11:09 ` [PATCH 3/4] MIPS: mm: shorten lines by using macro Thomas Bogendoerfer
2020-11-19 12:54 ` Thomas Bogendoerfer
2020-11-13 11:09 ` [PATCH 4/4] MIPS: mm: Clean up setup of protection map Thomas Bogendoerfer
2020-11-19 12:54 ` Thomas Bogendoerfer
2020-12-12 16:29 ` Guenter Roeck
2020-12-14 15:32 ` Thomas Bogendoerfer
2020-11-19 12:53 ` [PATCH 1/4] MIPS: vdso: Use vma page protection for remapping Thomas Bogendoerfer
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).