Kernel 5.8

AmigaOne X1000 platform specific issues related to Linux only.
User avatar
xeno74
Posts: 6081
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 5.8

Post by xeno74 »

I was able to revert the commit mm/vmalloc: track which page-table levels were modified with the following command:

Code: Select all

git revert 2ba3e6947aed9bb9575eb1603c0ac6e39185d32a
Unfortunately it doesn't build.

Code: Select all

lib/ioremap.c: In function ‘ioremap_page_range’:
lib/ioremap.c:245:13: error: ‘ARCH_PAGE_TABLE_SYNC_MASK’ undeclared (first use in this function); did you mean ‘PROC_TABLE_TYPE_MASK’?
  if (mask & ARCH_PAGE_TABLE_SYNC_MASK)
             ^~~~~~~~~~~~~~~~~~~~~~~~~
             PROC_TABLE_TYPE_MASK
lib/ioremap.c:245:13: note: each undeclared identifier is reported only once for each function it appears in
lib/ioremap.c:246:3: error: implicit declaration of function ‘arch_sync_kernel_mappings’ [-Werror=implicit-function-declaration]
   arch_sync_kernel_mappings(start, end);
   ^~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
scripts/Makefile.build:266: recipe for target 'lib/ioremap.o' failed
make[1]: *** [lib/ioremap.o] Error 1
Makefile:1735: recipe for target 'lib' failed
make: *** [lib] Error 2
make: *** Auf noch nicht beendete Prozesse wird gewartet …
  AR      virt/lib/built-in.a
  AR      virt/built-in.a
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.

User avatar
xeno74
Posts: 6081
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 5.8

Post by xeno74 »

I commented out the following lines in the file lib/ioremap.c:

:245

Code: Select all

//if (mask & ARCH_PAGE_TABLE_SYNC_MASK)
//              arch_sync_kernel_mappings(start, end);
//
//      return err;
After that I was able to compile the kernel. The kernel boots and works!!!!!!
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.

sailorMH
Posts: 121
Joined: Wed Aug 28, 2013 6:01 pm
Location: Czech republic

Re: Kernel 5.8

Post by sailorMH »

xeno74 wrote:
Fri Jun 05, 2020 4:52 pm
I commented out the following lines in the file lib/ioremap.c:

:245

Code: Select all

//if (mask & ARCH_PAGE_TABLE_SYNC_MASK)
//              arch_sync_kernel_mappings(start, end);
//
//      return err;
After that I was able to compile the kernel. The kernel boots and works!!!!!!
Super!! Good work.
Pegasos 2, AmigaOne X1000, Powebook G4, iMac G5, Powermac G5 Quad
MorphOS, AmigaOS, linux: MintPPC 11, Debian, Ubuntu ..., MacOS X

User avatar
xeno74
Posts: 6081
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 5.8

Post by xeno74 »

sailorMH wrote:
Fri Jun 05, 2020 9:00 pm
Super!! Good work.
Thank you! :-)

If the kernel developers don’t create a patch then I will create a patch.
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.

User avatar
xeno74
Posts: 6081
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 5.8

Post by xeno74 »

I created a boot patch for solving the boot issue today.

Code: Select all

diff -rupN a/include/linux/vmalloc.h b/include/linux/vmalloc.h
--- a/include/linux/vmalloc.h	2020-06-07 07:33:07.709630790 +0200
+++ b/include/linux/vmalloc.h	2020-06-07 07:31:03.565460991 +0200
@@ -132,22 +132,6 @@ extern int remap_vmalloc_range(struct vm
 							unsigned long pgoff);
 
 /*
- * Architectures can set this mask to a combination of PGTBL_P?D_MODIFIED values
- * and let generic vmalloc and ioremap code know when arch_sync_kernel_mappings()
- * needs to be called.
- */
-#ifndef ARCH_PAGE_TABLE_SYNC_MASK
-#define ARCH_PAGE_TABLE_SYNC_MASK 0
-#endif
-
-/*
- * There is no default implementation for arch_sync_kernel_mappings(). It is
- * relied upon the compiler to optimize calls out if ARCH_PAGE_TABLE_SYNC_MASK
- * is 0.
- */
-void arch_sync_kernel_mappings(unsigned long start, unsigned long end);
-
-/*
  *	Lowlevel-APIs (not for driver use!)
  */
 
diff -rupN a/lib/ioremap.c b/lib/ioremap.c
--- a/lib/ioremap.c	2020-06-07 07:33:07.781630995 +0200
+++ b/lib/ioremap.c	2020-06-07 07:32:28.425463956 +0200
@@ -242,10 +242,6 @@ int ioremap_page_range(unsigned long add
 
 	flush_cache_vmap(start, end);
 
-	if (mask & ARCH_PAGE_TABLE_SYNC_MASK)
-		arch_sync_kernel_mappings(start, end);
-
-	return err;
 }
 
 #ifdef CONFIG_GENERIC_IOREMAP
diff -rupN a/mm/vmalloc.c b/mm/vmalloc.c
--- a/mm/vmalloc.c	2020-06-07 07:33:07.793631029 +0200
+++ b/mm/vmalloc.c	2020-06-07 07:31:03.565460991 +0200
@@ -69,8 +69,7 @@ static void free_work(struct work_struct
 
 /*** Page table manipulation functions ***/
 
-static void vunmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
-			     pgtbl_mod_mask *mask)
+static void vunmap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end)
 {
 	pte_t *pte;
 
@@ -79,81 +78,59 @@ static void vunmap_pte_range(pmd_t *pmd,
 		pte_t ptent = ptep_get_and_clear(&init_mm, addr, pte);
 		WARN_ON(!pte_none(ptent) && !pte_present(ptent));
 	} while (pte++, addr += PAGE_SIZE, addr != end);
-	*mask |= PGTBL_PTE_MODIFIED;
 }
 
-static void vunmap_pmd_range(pud_t *pud, unsigned long addr, unsigned long end,
-			     pgtbl_mod_mask *mask)
+static void vunmap_pmd_range(pud_t *pud, unsigned long addr, unsigned long end)
 {
 	pmd_t *pmd;
 	unsigned long next;
-	int cleared;
 
 	pmd = pmd_offset(pud, addr);
 	do {
 		next = pmd_addr_end(addr, end);
-
-		cleared = pmd_clear_huge(pmd);
-		if (cleared || pmd_bad(*pmd))
-			*mask |= PGTBL_PMD_MODIFIED;
-
-		if (cleared)
+		if (pmd_clear_huge(pmd))
 			continue;
 		if (pmd_none_or_clear_bad(pmd))
 			continue;
-		vunmap_pte_range(pmd, addr, next, mask);
+		vunmap_pte_range(pmd, addr, next);
 	} while (pmd++, addr = next, addr != end);
 }
 
-static void vunmap_pud_range(p4d_t *p4d, unsigned long addr, unsigned long end,
-			     pgtbl_mod_mask *mask)
+static void vunmap_pud_range(p4d_t *p4d, unsigned long addr, unsigned long end)
 {
 	pud_t *pud;
 	unsigned long next;
-	int cleared;
 
 	pud = pud_offset(p4d, addr);
 	do {
 		next = pud_addr_end(addr, end);
-
-		cleared = pud_clear_huge(pud);
-		if (cleared || pud_bad(*pud))
-			*mask |= PGTBL_PUD_MODIFIED;
-
-		if (cleared)
+		if (pud_clear_huge(pud))
 			continue;
 		if (pud_none_or_clear_bad(pud))
 			continue;
-		vunmap_pmd_range(pud, addr, next, mask);
+		vunmap_pmd_range(pud, addr, next);
 	} while (pud++, addr = next, addr != end);
 }
 
-static void vunmap_p4d_range(pgd_t *pgd, unsigned long addr, unsigned long end,
-			     pgtbl_mod_mask *mask)
+static void vunmap_p4d_range(pgd_t *pgd, unsigned long addr, unsigned long end)
 {
 	p4d_t *p4d;
 	unsigned long next;
-	int cleared;
 
 	p4d = p4d_offset(pgd, addr);
 	do {
 		next = p4d_addr_end(addr, end);
-
-		cleared = p4d_clear_huge(p4d);
-		if (cleared || p4d_bad(*p4d))
-			*mask |= PGTBL_P4D_MODIFIED;
-
-		if (cleared)
+		if (p4d_clear_huge(p4d))
 			continue;
 		if (p4d_none_or_clear_bad(p4d))
 			continue;
-		vunmap_pud_range(p4d, addr, next, mask);
+		vunmap_pud_range(p4d, addr, next);
 	} while (p4d++, addr = next, addr != end);
 }
 
 /**
  * unmap_kernel_range_noflush - unmap kernel VM area
- * @start: start of the VM area to unmap
+ * @addr: start of the VM area to unmap
  * @size: size of the VM area to unmap
  *
  * Unmap PFN_UP(@size) pages at @addr.  The VM area @addr and @size specify
@@ -164,33 +141,24 @@ static void vunmap_p4d_range(pgd_t *pgd,
  * for calling flush_cache_vunmap() on to-be-mapped areas before calling this
  * function and flush_tlb_kernel_range() after.
  */
-void unmap_kernel_range_noflush(unsigned long start, unsigned long size)
+void unmap_kernel_range_noflush(unsigned long addr, unsigned long size)
 {
-	unsigned long end = start + size;
+	unsigned long end = addr + size;
 	unsigned long next;
 	pgd_t *pgd;
-	unsigned long addr = start;
-	pgtbl_mod_mask mask = 0;
 
 	BUG_ON(addr >= end);
-	start = addr;
 	pgd = pgd_offset_k(addr);
 	do {
 		next = pgd_addr_end(addr, end);
-		if (pgd_bad(*pgd))
-			mask |= PGTBL_PGD_MODIFIED;
 		if (pgd_none_or_clear_bad(pgd))
 			continue;
-		vunmap_p4d_range(pgd, addr, next, &mask);
+		vunmap_p4d_range(pgd, addr, next);
 	} while (pgd++, addr = next, addr != end);
-
-	if (mask & ARCH_PAGE_TABLE_SYNC_MASK)
-		arch_sync_kernel_mappings(start, end);
 }
 
 static int vmap_pte_range(pmd_t *pmd, unsigned long addr,
-		unsigned long end, pgprot_t prot, struct page **pages, int *nr,
-		pgtbl_mod_mask *mask)
+		unsigned long end, pgprot_t prot, struct page **pages, int *nr)
 {
 	pte_t *pte;
 
@@ -199,7 +167,7 @@ static int vmap_pte_range(pmd_t *pmd, un
 	 * callers keep track of where we're up to.
 	 */
 
-	pte = pte_alloc_kernel_track(pmd, addr, mask);
+	pte = pte_alloc_kernel(pmd, addr);
 	if (!pte)
 		return -ENOMEM;
 	do {
@@ -212,59 +180,55 @@ static int vmap_pte_range(pmd_t *pmd, un
 		set_pte_at(&init_mm, addr, pte, mk_pte(page, prot));
 		(*nr)++;
 	} while (pte++, addr += PAGE_SIZE, addr != end);
-	*mask |= PGTBL_PTE_MODIFIED;
 	return 0;
 }
 
 static int vmap_pmd_range(pud_t *pud, unsigned long addr,
-		unsigned long end, pgprot_t prot, struct page **pages, int *nr,
-		pgtbl_mod_mask *mask)
+		unsigned long end, pgprot_t prot, struct page **pages, int *nr)
 {
 	pmd_t *pmd;
 	unsigned long next;
 
-	pmd = pmd_alloc_track(&init_mm, pud, addr, mask);
+	pmd = pmd_alloc(&init_mm, pud, addr);
 	if (!pmd)
 		return -ENOMEM;
 	do {
 		next = pmd_addr_end(addr, end);
-		if (vmap_pte_range(pmd, addr, next, prot, pages, nr, mask))
+		if (vmap_pte_range(pmd, addr, next, prot, pages, nr))
 			return -ENOMEM;
 	} while (pmd++, addr = next, addr != end);
 	return 0;
 }
 
 static int vmap_pud_range(p4d_t *p4d, unsigned long addr,
-		unsigned long end, pgprot_t prot, struct page **pages, int *nr,
-		pgtbl_mod_mask *mask)
+		unsigned long end, pgprot_t prot, struct page **pages, int *nr)
 {
 	pud_t *pud;
 	unsigned long next;
 
-	pud = pud_alloc_track(&init_mm, p4d, addr, mask);
+	pud = pud_alloc(&init_mm, p4d, addr);
 	if (!pud)
 		return -ENOMEM;
 	do {
 		next = pud_addr_end(addr, end);
-		if (vmap_pmd_range(pud, addr, next, prot, pages, nr, mask))
+		if (vmap_pmd_range(pud, addr, next, prot, pages, nr))
 			return -ENOMEM;
 	} while (pud++, addr = next, addr != end);
 	return 0;
 }
 
 static int vmap_p4d_range(pgd_t *pgd, unsigned long addr,
-		unsigned long end, pgprot_t prot, struct page **pages, int *nr,
-		pgtbl_mod_mask *mask)
+		unsigned long end, pgprot_t prot, struct page **pages, int *nr)
 {
 	p4d_t *p4d;
 	unsigned long next;
 
-	p4d = p4d_alloc_track(&init_mm, pgd, addr, mask);
+	p4d = p4d_alloc(&init_mm, pgd, addr);
 	if (!p4d)
 		return -ENOMEM;
 	do {
 		next = p4d_addr_end(addr, end);
-		if (vmap_pud_range(p4d, addr, next, prot, pages, nr, mask))
+		if (vmap_pud_range(p4d, addr, next, prot, pages, nr))
 			return -ENOMEM;
 	} while (p4d++, addr = next, addr != end);
 	return 0;
@@ -291,28 +255,21 @@ static int vmap_p4d_range(pgd_t *pgd, un
 int map_kernel_range_noflush(unsigned long addr, unsigned long size,
 			     pgprot_t prot, struct page **pages)
 {
-	unsigned long start = addr;
 	unsigned long end = addr + size;
 	unsigned long next;
 	pgd_t *pgd;
 	int err = 0;
 	int nr = 0;
-	pgtbl_mod_mask mask = 0;
 
 	BUG_ON(addr >= end);
 	pgd = pgd_offset_k(addr);
 	do {
 		next = pgd_addr_end(addr, end);
-		if (pgd_bad(*pgd))
-			mask |= PGTBL_PGD_MODIFIED;
-		err = vmap_p4d_range(pgd, addr, next, prot, pages, &nr, &mask);
+		err = vmap_p4d_range(pgd, addr, next, prot, pages, &nr);
 		if (err)
 			return err;
 	} while (pgd++, addr = next, addr != end);
 
-	if (mask & ARCH_PAGE_TABLE_SYNC_MASK)
-		arch_sync_kernel_mappings(start, end);
-
 	return 0;
 }
The X5000 boots but unfortunately the X1000 doesn't boot.
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.


sailorMH
Posts: 121
Joined: Wed Aug 28, 2013 6:01 pm
Location: Czech republic

Re: Kernel 5.8

Post by sailorMH »

Pegasos 2, AmigaOne X1000, Powebook G4, iMac G5, Powermac G5 Quad
MorphOS, AmigaOS, linux: MintPPC 11, Debian, Ubuntu ..., MacOS X

User avatar
xeno74
Posts: 6081
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 5.8

Post by xeno74 »

sailorMH wrote:
Mon Jun 08, 2020 7:34 pm
works fine on Debian Sid and Debian 8
Hi SailorMH,

Many thanks for testing the alpha1! :-)

Cheers,
Christian
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.

User avatar
xeno74
Posts: 6081
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 5.8

Post by xeno74 »

Hi All,

I released the second alpha of kernel 5.8 for the X1000 and X5000 today.

New:
Download: linux-image-5.8-alpha2-X1000_X5000.tar.gz

Image

Please test the kernels.

Thanks,
Christian
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.

sailorMH
Posts: 121
Joined: Wed Aug 28, 2013 6:01 pm
Location: Czech republic

Re: Kernel 5.8

Post by sailorMH »

Pegasos 2, AmigaOne X1000, Powebook G4, iMac G5, Powermac G5 Quad
MorphOS, AmigaOS, linux: MintPPC 11, Debian, Ubuntu ..., MacOS X

Post Reply