Re: smr inp breaks some jail use cases and panics with i915kms don't switch to the console anymore

John Baldwin <[email protected]>
Newsgroups gmane.os.freebsd.devel.x11,gmane.os.freebsd.current
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.