From nobody Fri May 17 16:07:53 2024 X-Original-To: dev-commits-src-main@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 4VgsLg2hz4z5LNwB; Fri, 17 May 2024 16:07:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 4VgsLg28SSz4P3g; Fri, 17 May 2024 16:07:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715962075; 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=9IhICfMM4WFbS8AF/oRNLo6t4/5KFLhZOg1WnLnABeU=; b=jvfC9X+V48pb843m3ofb5t3lmz3+XNH2jY00qR4BLmEiSSBfZn6gg3mi7R1RUWC5kAVK/8 bC50+mxkF10Krr/su7gIkj1N8Fyu5S4J4OdDjpJd40Ax9lMVVoiuMbAnvuaD4JrFQuFIoY vLgoQsn0Nv7Z/H16NY1hw01//R1VII4uIpyFOOeRn1ST3wZ+Lr/0m6j8/OfwnnU5lZhHOe rEpQfY4XpInCxOqDrZjw4t3Gn0D7h0k2Ms9K4fAmHHUigNmHtXfg6YeTgoNMMAhqNRSiTo Y78i4Hx3gLNLVHhgyxb5i6Xk+ob2XRC/4UI1fFadLOyqiHfSbfleQ5TsT2v7yg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715962075; a=rsa-sha256; cv=none; b=h9V48vJerdyjUsoh3gIelAJKoSFt71y2KgOoiJa7Dyk3/VTi4PhjnDZhQTLmBjxCON/jhe 10av5jds8+9iFHv09LGPXEmHLDCBiRdY26ySF1tUFkcxaxO6J3nco1PCSlLDCjXzRMN3E/ BrdWR+stPL1yLKBkdN1xL6EFdlNSUEGJJYjo5P3PVXNI2nh6WIeJIHSuenwD3ejBCYascZ 5v8/O0S3wiyXZ0FGjgqirfvUgn+Si4in0jZ0LyEJVal6hTyK6b9vGx6F97N6YiwlAfbIIR ge1TsK+iOlw+AlR3V3zcQwqyraGMBAmj9FDuDpXtdodkNDSkqbY+HCWEuWz5ZA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715962075; 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=9IhICfMM4WFbS8AF/oRNLo6t4/5KFLhZOg1WnLnABeU=; b=Svy+8mDUs4HY1VV8RN8ZCURLYqLVxG6wg73zeZlGCvePpX8BTe2ojobRghPbHeiGriyMmw fhinGAVs4PAVIIaF6OPyfix2TqO7aU8KkL5XQCXjlvJirfNImwjcrYsXmsqfBfXRkEpEmf cbOA5s2tmK/Osonc2xC4CSbcGC1jh7xx5vi2BQtvz7sO+8UuD3ATmw79yWL+puC+Ntlfdr deGcj0w5WSuyEbJ8R3sC225paHrvvOUO3A1lnqvomo9/R5Qxw7zBeiMBqqKERzXUuznrOj o6kv/mze63rLw9WRW4eC8O7vvjIGbp0wwPw4iArNvqIIDByQvXdgWMY44CShgg== Received: from [IPV6:2601:644:937f:4c50:c0c0:cf11:cc26:3c0e] (unknown [IPv6:2601:644:937f:4c50:c0c0:cf11:cc26:3c0e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4VgsLf5kHfzGKb; Fri, 17 May 2024 16:07:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <2cd3e698-1b42-4e7f-93a0-aacccb55c8d6@FreeBSD.org> Date: Fri, 17 May 2024 09:07:53 -0700 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: git: cff79fd02636 - main - linuxkpi: Fix spin_lock_init Content-Language: en-US To: Emmanuel Vadot , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202405170559.44H5xD7d019861@gitrepo.freebsd.org> From: John Baldwin In-Reply-To: <202405170559.44H5xD7d019861@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 5/16/24 10:59 PM, Emmanuel Vadot wrote: > The branch main has been updated by manu: > > URL: https://cgit.FreeBSD.org/src/commit/?id=cff79fd02636f34010d8b835cc9e55401fa76e74 > > commit cff79fd02636f34010d8b835cc9e55401fa76e74 > Author: Emmanuel Vadot > AuthorDate: 2024-05-17 04:52:53 +0000 > Commit: Emmanuel Vadot > CommitDate: 2024-05-17 05:58:59 +0000 > > linuxkpi: Fix spin_lock_init > > Some linux code re-init some spinlock so add MTX_NEW to mtx_init. > > Reported by: David Wolfskill > Fixes: ae38a1a1bfdf ("linuxkpi: spinlock: Simplify code") > --- > sys/compat/linuxkpi/common/include/linux/spinlock.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sys/compat/linuxkpi/common/include/linux/spinlock.h b/sys/compat/linuxkpi/common/include/linux/spinlock.h > index 3f6eb4bb70f6..2992e41c9c02 100644 > --- a/sys/compat/linuxkpi/common/include/linux/spinlock.h > +++ b/sys/compat/linuxkpi/common/include/linux/spinlock.h > @@ -140,7 +140,7 @@ typedef struct mtx spinlock_t; > #define spin_lock_name(name) _spin_lock_name(name, __FILE__, __LINE__) > > #define spin_lock_init(lock) mtx_init(lock, spin_lock_name("lnxspin"), \ > - NULL, MTX_DEF | MTX_NOWITNESS) > + NULL, MTX_DEF | MTX_NOWITNESS | MTX_NEW) > > #define spin_lock_destroy(_l) mtx_destroy(_l) This is only ok because of MTX_NOWITNESS. Reiniting locks without destroying them corrupts the internal linked lists in WITNESS for locks using witness. That may warrant a comment here explaining why we disable witness. It might be nice to add an extension to the various lock inits for code that wants to opt-int to using WITNESS where a name can be passed. Using those would be relatively small diffs in the client code and let select locks opt into using WITNESS. You could make it work by adding an optional second argument to spin_lock_init, etc. that takes the name. -- John Baldwin