Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 May 2022 21:35:05 +0200
From:      Paul Floyd <paulf2718@gmail.com>
To:        FreeBSD Hackers <freebsd-hackers@freebsd.org>
Subject:   Re: Hang ast / pipelk / piperd
Message-ID:  <b598c89e-f11a-eed1-3d74-c3ef37bc400a@gmail.com>
In-Reply-To: <YpTRj7jVE0jfbxPO@nuc>
References:  <84015bf9-8504-1c3c-0ba5-58d0d7824843@gmail.com> <dca6a5b4-6f0c-98c0-2f2d-6e5da7405af4@gmail.com> <YpTRj7jVE0jfbxPO@nuc>

next in thread | previous in thread | raw e-mail | index | archive | help


On 5/30/22 14:15, Mark Johnston wrote:

> "procstat -kk <valgrind PID>" might help to reveal what's going on,
> since it sounds like the hand/livelock is happening somewhere in the
> kernel.

Not knowing much about the kernel, my guess is that this is related to

commit 4808bab7fa6c3ec49b49476b8326d7a0250a03fa
Author: Alexander Motin <mav@FreeBSD.org>
Date:   Tue Sep 21 18:14:22 2021 -0400

     sched_ule(4): Improve long-term load balancer.

and this bit of ast code

doreti_ast:
	/*
	 * Check for ASTs atomically with returning.  Disabling CPU
	 * interrupts provides sufficient locking even in the SMP case,
	 * since we will be informed of any new ASTs by an IPI.
	 */
	cli
	movq	PCPU(CURTHREAD),%rax
	testl	$TDF_ASTPENDING | TDF_NEEDRESCHED,TD_FLAGS(%rax)
	je	doreti_exit
	sti
	movq	%rsp,%rdi	/* pass a pointer to the trapframe */
	call	ast
	jmp	doreti_ast


The above commit seems to be migrating loaded threads to another CPU.

My test system is a VirtualBox amd64 FreeBSD 13.1 with one CPU running 
on a 13.0 host.

I just tried restarting the VM with 2 CPUs and the testcase seems to be 
a lot better - it's been running in a loop for 10 minutes whereas 
previously it would hang at least 1 in 5 times.

A+
Paul



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?b598c89e-f11a-eed1-3d74-c3ef37bc400a>