Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp66316lqb; Tue, 16 Apr 2024 09:00:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXN0VjuqF/ypf9Ericoe/P9IpyMubTSVoqunebfWJVE8UC3QbM7Edyti9VEz7RfGQOGIZbaa3Bnq2pg0Ca93AZBwBz/MSDWUCIv/gMktA== X-Google-Smtp-Source: AGHT+IFnx8TiXSNCfl+KncyF60d5fy44X9tl7u2of6qivDTrt10GrJR8TMwvrETyIaDbgAsQejf3 X-Received: by 2002:a05:6808:350:b0:3c6:fa20:6c04 with SMTP id j16-20020a056808035000b003c6fa206c04mr13095656oie.38.1713283203839; Tue, 16 Apr 2024 09:00:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713283203; cv=pass; d=google.com; s=arc-20160816; b=yE0PgRxG7h9c9WcgvBY+wjXZm8L+WwfcZd5tgc0tFGKwP6OV4w5rpj8ONANkSrdShr aUJC0xUrfcNCcow/+vexAyNclOJTMMWJxVQ26ZG0muhWSpsNeQjc+9LouAoDeET26Ldk NPzIyvVEUmPbrt4oYJLqZZyKbXZ9zmLCtOFeZNYCOSDaALDZQcKH5IeWoCpQaCnwuHCq fc4bqHUpFp7IWtUWIAD35WjJyYUH7B6YlWrAqeSQhS4enSVLyGari9Px8ERWLfwp6YcD fei86blX8zD7Ok49W/85VTfAxXVG3Vk6pxXvFMpCuM9vsLMkZnK0ebwnuLlxepm6glSU AY6Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=wZEy1lpoVSmMRE0DeOc5Gd5oUzFgnMEWwvGF0LAHu8U=; fh=/7AqYDe4mQKoJZ8Roi+FJPgiYc3Gyu8g/sTN1gbnCOE=; b=BmYhmXggYU4bfiwRNp1Xvzz4HQNJkvIUkItY1MXFCwCigBr02XQmFGER2WspYI5JVx gI3MaDDFAfcJIIqjcr5OT7pKA5VQAN2/FFFww+KsfYRrZy95gmRHcXkqWKRGkWFaUy84 AN5MW9uDDhsiloPQvygoNdywUEbgNLFMDfwEtafLiVN61iu6w5nUjAzAWL0AoSM7YICN d47iIrSBr2WHN5OMtHr7QIjCH7VKOXIGoFO0kSJ61rlmKnjn+LbQDstcPWbPSEnprv1w hgz0sTbAFtWRT3Fz5OUsB/kirvbyxtmsQlayCO+i60rOf9HS0HHE/uvhJQ8BVhoZeDzn 9Rfw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="Cn57aN//"; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-147184-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147184-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id cb25-20020a05622a1f9900b004370fdb4a68si5164962qtb.411.2024.04.16.09.00.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 09:00:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-147184-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="Cn57aN//"; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-147184-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147184-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6FC291C21988 for ; Tue, 16 Apr 2024 16:00:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9DD91132C3F; Tue, 16 Apr 2024 15:54:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Cn57aN//" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0019713C3FB; Tue, 16 Apr 2024 15:53:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713282840; cv=none; b=pLujvcztLkLPamwTEnZMHsQIKDP6lOZdOhefhmvLrG8ELpoT8s97Kg2Z/8nCxB3uwZVg/HlWDqsizOon3F+FPTzbpOsiWYIrV3hGxUhxbYuq3eZuty9APMDf+OtmVoX25ZJuaTZY+3NpAA3VAEtzEI5nAooSpClMcXNTLJPWnY4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713282840; c=relaxed/simple; bh=xr7ky7Cb0ygGptcAXZwef1Q17uuZn48m+YBRnvcd9GE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qhBIOj0D61j4cWtUXMQ7FicfFICkPkr5U5lQC7mzR4EFPj5Hvbe8Wa9wnxU6RK8mOwBowMW7AIOVYFg5k1Dg4a750ofDGwV3dBwAkpwz0Ct/6to14eepBwJYL2JDDGQIGdd2vAm4Ebj4GkyQVmRDLCDsHo2vmUVovPmp1ojk+tI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=Cn57aN//; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=wZEy1lpoVSmMRE0DeOc5Gd5oUzFgnMEWwvGF0LAHu8U=; b=Cn57aN//MYZ+dXqCms+9QZ2xFM R6jH8lG6V6rsLnVsxURyoEsjbtBO9tDJ7v6UB/+HgbxZsAyFFOBR+YDH5xpjk7FVFActU1ECnBScj N4ho/AR8AAxxxhz93MqQpIYfDGuWKuTvhQcG6IvQrIbyfOd5oSjCOA4iYUcVjHN3NL6S91Me6bJGx 7qqb2+R4sImsoxiMBzz11/ADpFTAwXs5ytiwivw4SLINRHcE3VrgJ9HhImwP87YrY3IglUYI/zgfL H1NJOi2F75jD1YIvcett5AlBNg1Y6joZY9hDc/LKkyUmLc1x69gk/ogvw0l41MO6CZMBFrddqPe1Z k1Ulqj2A==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwl7y-00000000r5i-0m9z; Tue, 16 Apr 2024 15:53:46 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id BC83030040C; Tue, 16 Apr 2024 17:53:45 +0200 (CEST) Date: Tue, 16 Apr 2024 17:53:45 +0200 From: Peter Zijlstra To: Elizabeth Figura Cc: Arnd Bergmann , Greg Kroah-Hartman , Jonathan Corbet , Shuah Khan , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, wine-devel@winehq.org, =?iso-8859-1?Q?Andr=E9?= Almeida , Wolfram Sang , Arkadiusz Hiler , Andy Lutomirski , linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, Randy Dunlap , Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng Subject: Re: [PATCH v4 00/30] NT synchronization primitive driver Message-ID: <20240416155345.GC12673@noisy.programming.kicks-ass.net> References: <20240416010837.333694-1-zfigura@codeweavers.com> <20240416081421.GB31647@noisy.programming.kicks-ass.net> <20240416155014.GB12673@noisy.programming.kicks-ass.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240416155014.GB12673@noisy.programming.kicks-ass.net> On Tue, Apr 16, 2024 at 05:50:14PM +0200, Peter Zijlstra wrote: > On Tue, Apr 16, 2024 at 10:14:21AM +0200, Peter Zijlstra wrote: > > > > Some aspects of the implementation may deserve particular comment: > > > > > > * In the interest of performance, each object is governed only by a single > > > spinlock. However, NTSYNC_IOC_WAIT_ALL requires that the state of multiple > > > objects be changed as a single atomic operation. In order to achieve this, we > > > first take a device-wide lock ("wait_all_lock") any time we are going to lock > > > more than one object at a time. > > > > > > The maximum number of objects that can be used in a vectored wait, and > > > therefore the maximum that can be locked simultaneously, is 64. This number is > > > NT's own limit. > > AFAICT: > > spin_lock(&dev->wait_all_lock); > list_for_each_entry(entry, &obj->all_waiters, node) > for (i=0; i spin_lock_nest_lock(q->entries[i].obj->lock, &dev->wait_all_lock); > > Where @count <= NTSYNC_MAX_WAIT_COUNT. > > So while this nests at most 65 spinlocks, there is no actual bound on > the amount of nested lock sections in total. That is, all_waiters list > can be grown without limits. > > Can we pretty please make wait_all_lock a mutex ? Hurmph, it's worse, you do that list walk while holding some obj->lock spinlokc too. Still need to figure out how all that works....