panic: vm_page_astate_fcmpset: invalid head requeue request on RPI3

Mark Johnston markj at freebsd.org
Thu Jan 2 14:16:52 UTC 2020


On Thu, Jan 02, 2020 at 02:58:16PM +0100, Idwer Vollering wrote:
> This can happen on amd64, on r356262, too.
> 
> $ kgdb /boot/kernel/kernel vmcore.0
> GNU gdb (GDB) 8.3.1 [GDB v8.3.1 for FreeBSD]
> Copyright (C) 2019 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> Type "show copying" and "show warranty" for details.
> This GDB was configured as "x86_64-portbld-freebsd13.0".
> Type "show configuration" for configuration details.
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>.
> Find the GDB manual and other documentation resources online at:
>     <http://www.gnu.org/software/gdb/documentation/>.
> 
> For help, type "help".
> Type "apropos word" to search for commands related to "word"...
> Reading symbols from /boot/kernel/kernel...
> Reading symbols from /usr/lib/debug//boot/kernel/kernel.debug...
> 
> Unread portion of the kernel message buffer:
> panic: vm_page_astate_fcmpset: invalid head requeue request for page

Sorry for the breakage.  I believe the patch below will fix the problem,
I am testing it now.

diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c
index 1e74f5c4c6db..cbdab1374f72 100644
--- a/sys/vm/vm_pageout.c
+++ b/sys/vm/vm_pageout.c
@@ -834,6 +834,7 @@ vm_pageout_launder(struct vm_domain *vmd, int launder, bool in_shortfall)
 				if (new.act_count > ACT_MAX)
 					new.act_count = ACT_MAX;
 
+				new.flags &= ~PGA_QUEUE_OP_MASK;
 				new.flags |= PGA_REQUEUE;
 				new.queue = PQ_ACTIVE;
 				if (!vm_page_pqstate_commit(m, &old, new))
@@ -1313,8 +1314,9 @@ vm_pageout_scan_active(struct vm_domain *vmd, int page_shortage)
 				 */
 				ps_delta = 0;
 				if (old.queue != PQ_ACTIVE) {
-					old.queue = PQ_ACTIVE;
-					old.flags |= PGA_REQUEUE;
+					new.flags &= ~PGA_QUEUE_OP_MASK;
+					new.flags |= PGA_REQUEUE;
+					new.queue = PQ_ACTIVE;
 				}
 			} else {
 				/*
@@ -1350,6 +1352,7 @@ vm_pageout_scan_active(struct vm_domain *vmd, int page_shortage)
 					ps_delta = 1;
 				}
 
+				new.flags &= ~PGA_QUEUE_OP_MASK;
 				new.flags |= PGA_REQUEUE;
 				new.queue = nqueue;
 			}
@@ -1560,6 +1563,7 @@ vm_pageout_scan_inactive(struct vm_domain *vmd, int shortage,
 				if (new.act_count > ACT_MAX)
 					new.act_count = ACT_MAX;
 
+				new.flags &= ~PGA_QUEUE_OP_MASK;
 				new.flags |= PGA_REQUEUE;
 				new.queue = PQ_ACTIVE;
 				if (!vm_page_pqstate_commit(m, &old, new))


More information about the freebsd-current mailing list