From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, NICE_REPLY_A,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 5029 invoked from network); 16 Aug 2022 20:55:01 -0000 Received: from 9front.inri.net (168.235.81.73) by inbox.vuxu.org with ESMTPUTF8; 16 Aug 2022 20:55:01 -0000 Received: from mail.posixcafe.org ([45.76.19.58]) by 9front; Tue Aug 16 16:54:05 -0400 2022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=posixcafe.org; s=20200506; t=1660683240; 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=oIGgVj266XmTcjffBFcvB9koiwmqF4cp6MQiLcErEso=; b=VmaZBpMQ89rICuY3ScoPj4qDb/WIvsqlQY0u/Wc8sCKMPhl/nDm7bmQM/rZXgqwQbKraUS pCekCnRFJuIf0vovPwRJqBFUxzhu3Y5rnQg+K7OeTzjZWG4oTbBQPNVS5+3af4OgVNhxPU KnlxmKJOhEKoqkBoj+2u+3DkStSVjXg= Received: from [192.168.168.200] (161-97-228-135.mynextlight.net [161.97.228.135]) by mail.posixcafe.org (OpenSMTPD) with ESMTPSA id 2fa3df98 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for <9front@9front.org>; Tue, 16 Aug 2022 15:54:00 -0500 (CDT) Message-ID: Date: Tue, 16 Aug 2022 14:51:50 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Content-Language: en-US To: 9front@9front.org References: From: Jacob Moody In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: agile flexible deep-learning dependency-oriented full-stack shader Subject: Re: [9front] fix race condition on writes to #v/vgactl Reply-To: 9front@9front.org Precedence: bulk On 8/16/22 14:44, qwx@sciops.net wrote: > On Tue Aug 16 08:12:41 +0200 2022, qwx@sciops.net wrote: >> Hello, >> >> I've been experiencing a seemingly impossible kernel panic when >> messing with vgactl. Occasionally, writing multiple commands to >> /dev/vgactl rapidly may cause an assert to fail >> (/sys/src/9/port/devdraw.c:/assert). The panic is perfectly >> reproducible by sending `softscreen off' commands quickly (tested on >> x61t): >> >> ; for(i in `{seq 10}) echo softscreen off >/dev/vgactl >> >> The panic occurs within the first few iterations. Moving some locks >> out of individual functions to hold them for the entire step fixes >> this. The patch below works, but qunlock may be called without the >> drawlock being held, I need to recheck and clean up before commiting >> anything. Credit to moody for suggesting looking in this direction! > > Here's the final patch, mostly the same. I'll commit this later > unless there are any objections. > > Thanks, > qwx > Checks out to me.