From nobody Mon Dec 13 19:56:35 2021 X-Original-To: x11@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 CD89418DF56C; Mon, 13 Dec 2021 19:56:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JCXMS47J2z3Hmj; Mon, 13 Dec 2021 19:56:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from [10.0.1.4] (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 0FC61290BB; Mon, 13 Dec 2021 19:56:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <836761df-6eea-462b-9ae7-5d0d00aad38f@FreeBSD.org> Date: Mon, 13 Dec 2021 11:56:35 -0800 List-Id: X11 List-Archive: https://lists.freebsd.org/archives/freebsd-x11 List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-x11@freebsd.org X-BeenThere: freebsd-x11@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: smr inp breaks some jail use cases and panics with i915kms don't switch to the console anymore Content-Language: en-US To: Gleb Smirnoff Cc: "freebsd-current@freebsd.org" , x11@freebsd.org References: <1db0942e-0e66-4337-ce2f-4e1005107435@FreeBSD.org> From: John Baldwin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639425396; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8bXe+2LnS3T4wPGE74Fsg9BspE9IXjbNMzlFbT6+c7s=; b=Y94gCqIiQN7JiC9Td6qdTO3b2gfV0ZEPe3zsUF+Ys+MqmXB4FSROX1Z5Z9/20qrhpQF5EM wxRUs77fgfQJ40pmvrc1jjQaDORaifrg1OQcI6YWjk6OcgvAcfr4tTU2gCBSoXg8O0aaOV ZmDIIMZQa50/I9sR/jO2mvj/adJGjymFccQL0caffwr6vcAeK3BoLMPkTNiQCyAuSCCa7R NPxwAq2Q/+WOCarmP4kmgvXXfyaobXLnSrqK+h88iuZKDC0m64rI54vUr+QxmcWjRc4161 yed8XFPZO9hV/z40/MHAENYQauynCKi6AaNnyHR5YqV9dAcdXGXsnhrS1olndA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639425396; a=rsa-sha256; cv=none; b=yO93r+GU0MnakHjebxEL048tWEmtuDG7xkKS8ZkSeznhxJ3HUDT0bPB5xQALNbwdOR2AWC MRYUbMOK8Pn4jIQGbJ4c323sDKTKE8POo00hxiPxyfHEldBiDXPpicVfJL2j6HJRAV5O2k +S/Fj9F1P1xPzTNK0WjupAS3LGOJG+eBUU/at6jdPWJd73NgLZcoAD/NwMD/7/heZ9yJmo Iq/rQB2YA7jxjv5oLcXCSgb6TH7d2g7yZmtc8d8tVtzdLIQzqp+E4ALHIaRMGerrJn9z3p FEO5jDf/XFZ+miLWjtpHmgNX2KWBvFQ7zEdl0VKV5PML1MtBaKSsJWtlP94u8A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On 12/13/21 9:35 AM, Gleb Smirnoff wrote: > Hi John, > > On Mon, Dec 13, 2021 at 07:45:07AM -0800, John Baldwin wrote: > J> So there are two things here. The root issue is that the devel/apr1 port > J> runs a configure test for TCP_NDELAY being inherited by accepted sockets. > J> This test panics because prison_check_ip4() tries to lock a prison mutex > J> to walk the IPs assigned to a jail, but the caller (in_pcblookup_hash()) has > J> done an smr_enter() which is a critical_enter(): > > The first one is known, and I got a patch to fix it: > > https://reviews.freebsd.org/D33340 > > However, a pre-requisite to this simple patch is more complex: > > https://reviews.freebsd.org/D33339 > > There is some discussion on how to improve that, and I decided to do that > rather than stick to original version. So I takes a few extra days. > > We could push D33340 into main, if the negative effects (raciness of > the prison check) is considered lesser evil then potentially contested > mtx_lock in smr section. I think raciness is probably better than always panicking as it does today. > J> However, it was a bit harder to see this originally as the 915kms driver > J> tries to do a malloc(M_WAITOK) from cn_grab() when entering DDB which > J> recursively panics (even a malloc(M_NOWAIT) from cn_grab() is probably a > J> bad idea). When it panicked in X the result was that the screen just froze > J> on whatever it had most recently drawn and the machine looked hung. (The > J> fact that that sysbeep is off so I couldn't tell if typing in commands was > J> doing anything vs emitting errors probably didn't improve trying to diagnose > J> the hang as "sitting in ddb" initially, though I don't know if DDB itself > J> emits a beep for invalid commands, etc.) > > Didn't know about this one. Is this isolated to actually entering DDB or > there is some path that in a normal inpcb lookup we would M_WAITOK? This is in the drm(4) driver, nothing to do with in_pcb, just made it harder to see the in_pcb issue. -- John Baldwin