From nobody Mon Jun 06 17:44:28 2022 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 92CC51BDCAAE for ; Mon, 6 Jun 2022 17:44:28 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LH18D1sqdz4rCp for ; Mon, 6 Jun 2022 17:44:28 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E39229A7 for ; Mon, 6 Jun 2022 17:44:28 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 256HiSjY001831 for ; Mon, 6 Jun 2022 17:44:28 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 256HiSBs001830 for bugs@FreeBSD.org; Mon, 6 Jun 2022 17:44:28 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 264441] Hang with Valgrind on single CPU systems Date: Mon, 06 Jun 2022 17:44:28 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 13.1-RELEASE X-Bugzilla-Keywords: needs-qa X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: markj@FreeBSD.org X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: markj@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: assigned_to cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654537468; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kC0bNCxtZJxKz4rdFoeYUgn2lULziBMAEWkOFWVw4VA=; b=NPlRYFEIr3+y7bkVgjAyzKD8SrUrLy8AdGLaHxx/y0Hj/JSJZzGRfkqq8hjx3hWSiFgYhw UYdikj78nNDe/1PfSD14EOejgGogGGlxT5ZcpgUr4Cy95NssLPpDkMIZUGTE2ISP9sQ7tX 3vsSleO8wZXLkB1RE2wxOxvXrgkTIbWYAksjAaGlJagKCAwLsIVlhOTMpJ1Z+gURfcYu1N /EXsjixLQDk4YbHv1pOZDVMrg0O0GSEH2xarBiBx2GC80r5/pumlvNsPQrpq8A/Kzoi1Iv fk7j+2TYmM7TUHN/RMO0d73JuxOZ3Sc9ri7sQt8aA49cqtT1ZfBpBBv+pXJOuQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654537468; a=rsa-sha256; cv=none; b=E2Uzx1WTIT5+mrI4sStWGRuAnZVVcT9Q4GaBmXDH53wi8lobVK8icRTI6DgoFzMcXeIm0n z1KL9qJR6mG9fcRUJV/iob5pd6bxYqTIuRxbVsv5ElIkteFvqCzBtMP6GOiLmk3+vWGgdI Wl5F6xUqNe2zLULr9p0PpHtYgT/pcj5hp9vKE5mmwOwJTGfZMhazZ2Yxr5gNj56gwxyW2a fo1emXQ3PTBQ6kxR47F75vDIuqVhaDnBvUnREx1uiFRhkEODM2gYARc2h5FcBz2f2Ffayu 9+bpKh7cf7FabuRCluBFbDJ//Pw+vNmTgx5e0oT1PEUC373sHIoOyhu4aSjoug== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D264441 Mark Johnston changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|bugs@FreeBSD.org |markj@FreeBSD.org CC| |markj@FreeBSD.org --- Comment #1 from Mark Johnston --- Thanks for the repro steps, I was able to trigger the problem locally. It's enough to pin all of the valgrind threads to the same CPU: /tmp/valgrind # cpuset -l 1 perl tests/vg_regtest none/tests/tls Really there are two problems here. First, it seems that one of the threads (the one switched out in ast()) is simply getting starved. There are sever= al other always-runnable threads in the process that have a slightly higher scheduling priority, and they end up monopolizing the CPU. ULE has decided that the threads are "interactive", and in this case higher priority threads are always scheduled first. With multiple CPUs available I suppose the problem may still exist, it just becomes harder to trigger since with more CPUs there's less chance that the starved thread will get stuck. I'm guessing that the stuck thread is the o= ne which is supposed to be writing to the pipe. The second problem is a livelock in the pipe code. It seems that pipelock()/pipeunlock() can cause reader threads to wake each other up in a loop even when there's nothing to do. This is because the wait channel use= d by readers and writers to signal each other is the same as the one used to serialize I/O operations among multiple concurrent readers. It's not too h= ard to write a standalone test program which triggers this, albeit unreliably. = I suspect the livelock causes the scheduler problem, since the reader threads keep yielding the CPU to sleep, and this boosts their interactivity score. --=20 You are receiving this mail because: You are the assignee for the bug.=