linux-next: manual merge of the risc-v-fixes tree with Linus' tree
From: Stephen Rothwell
Date: Thu Sep 15 2022 - 18:05:26 EST
Hi all,
Today's linux-next merge of the risc-v-fixes tree got a conflict in:
arch/riscv/mm/pageattr.c
between commit:
8782fb61cc84 ("mm: pagewalk: Fix race between unmap and page walker")
from Linus' tree and commit:
92c5738923f9 ("riscv: Fix permissions for all mm's during mm init")
from the risc-v-fixes tree.
I fixed it up (I think - see below) and can carry the fix as
necessary. This is now fixed as far as linux-next is concerned, but any
non trivial conflicts should be mentioned to your upstream maintainer
when your tree is submitted for merging. You may also want to consider
cooperating with the maintainer of the conflicting tree to minimise any
particularly complex conflicts.
--
Cheers,
Stephen Rothwell
diff --cc arch/riscv/mm/pageattr.c
index 86c56616e5de,74b8107ac743..000000000000
--- a/arch/riscv/mm/pageattr.c
+++ b/arch/riscv/mm/pageattr.c
@@@ -115,6 -115,55 +115,55 @@@ static int __set_memory_mm(struct mm_st
.clear_mask = clear_mask
};
- mmap_read_lock(mm);
++ mmap_write_lock(mm);
+ ret = walk_page_range_novma(mm, start, end, &pageattr_ops, NULL,
+ &masks);
- mmap_read_unlock(mm);
++ mmap_write_unlock(mm);
+
+ return ret;
+ }
+
+ void fix_kernel_mem_early(char *startp, char *endp, pgprot_t set_mask,
+ pgprot_t clear_mask)
+ {
+ struct task_struct *t, *s;
+
+ unsigned long start = (unsigned long)startp;
+ unsigned long end = PAGE_ALIGN((unsigned long)endp);
+
+ /*
+ * In the SYSTEM_FREEING_INITMEM state we expect that all async code
+ * is done and no new userspace task can be created.
+ * So rcu_read_lock() should be enough here.
+ */
+ WARN_ON(system_state != SYSTEM_FREEING_INITMEM);
+
+ __set_memory_mm(current->active_mm, start, end, set_mask, clear_mask);
+ __set_memory_mm(&init_mm, start, end, set_mask, clear_mask);
+
+ rcu_read_lock();
+ for_each_process(t) {
+ if (t->flags & PF_KTHREAD)
+ continue;
+ for_each_thread(t, s) {
+ if (s->mm) {
+ __set_memory_mm(s->mm, start, end, set_mask,
+ clear_mask);
+ }
+ }
+ }
+ rcu_read_unlock();
+
+ flush_tlb_kernel_range(start, end);
+ }
+
+ static int __set_memory(unsigned long addr, int numpages, pgprot_t set_mask,
+ pgprot_t clear_mask)
+ {
+ int ret;
+ unsigned long start = addr;
+ unsigned long end = start + PAGE_SIZE * numpages;
+
if (!numpages)
return 0;
Attachment:
pgpDv8lDq_x1L.pgp
Description: OpenPGP digital signature