From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0D06A482C7; Thu, 15 Feb 2024 09:44:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707990250; cv=none; b=g8KYUglBytp92XU+cyOSyOin0BlaDVNZvOAK72uM4MISZjspp1v3vpbtNppsELbfHkTColPenhsETC4nlCqooZ4qXwLPz+K907vYS7g8yjrn6J84bGsglIBru6wgR6pRIGPL8v6UQ+txKgD9A3w9cMdZXnlpmOXbILb/uJyQX3Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707990250; c=relaxed/simple; bh=NWspp6vFhXCaH1t40eZE2OkjP7lfHkq9fLzAHD5BjZc=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=gwX4Y8lXTolsRzi+UKCq/ZB47M2XwiJOWa6rDceAQBzv701oqfuV1YkZJUg1dF/qpBaHeEbGgeI13xCoab0CKbQHPQmPGNEjrFyIdJjK2aCCK7v6Ad4J1vf6u/zJCALXTKt2E5enUcmDK95tqKLfm0qLklJa1/f5hDFKzW4Z1RE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ho3gUMdC; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ho3gUMdC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74155C433F1; Thu, 15 Feb 2024 09:44:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707990249; bh=NWspp6vFhXCaH1t40eZE2OkjP7lfHkq9fLzAHD5BjZc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Ho3gUMdC01T2IXbfggxAQMxOzxsSXLUKmRlBBcT3ak83XcVCjGhzMn7/YyKQcKKBz w3SmhRGG9h1p9y4v+1MvS9fXDSw3AvGfr3/DWNvMOKOoMtcJ4QxzQMa6BKzKL/n5hM VsXGXQLLFkK98cJgJu3BpdR5EIE+kwpu2/a4yih8aYhiC6c9BW4o2mIKlFwU86TiVc yvUnkwPhw9Yp5WPiqX56/ttlTufO+XbGPCQZfUaZxSh4u8NY1Lsf8nZpzM26c8VmGr jJP04Jk/NvqpZRaOFeqQ19Dhxqe5S6SZGm+o9i4+kwptkfBuvWO1CRM0H37ndL6jSQ x5IHJTVn7nfOA== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1raYHn-003Qt3-48; Thu, 15 Feb 2024 09:44:07 +0000 Date: Thu, 15 Feb 2024 09:44:06 +0000 Message-ID: <86sf1u3vvd.wl-maz@kernel.org> From: Marc Zyngier To: Oliver Upton Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org, James Morse , Suzuki K Poulose , Zenghui Yu , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 07/23] KVM: arm64: vgic: Use atomics to count LPIs In-Reply-To: References: <20240213093250.3960069-1-oliver.upton@linux.dev> <20240213093250.3960069-8-oliver.upton@linux.dev> <861q9f56x6.wl-maz@kernel.org> <86wmr64xyo.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: oliver.upton@linux.dev, kvmarm@lists.linux.dev, kvm@vger.kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Wed, 14 Feb 2024 23:01:04 +0000, Oliver Upton wrote: > > On Wed, Feb 14, 2024 at 08:01:19PM +0000, Marc Zyngier wrote: > > > > Of course, we only have 3 marks, so that's a bit restrictive from a > > > > concurrency perspective, but since most callers hold a lock, it should > > > > be OK. > > > > > > They all hold *a* lock, but maybe not the same one! :) > > > > Indeed. But as long as there isn't more than 3 locks (and that the > > xarray is OK being concurrently updated with marks), we're good! > > Oh, you mean to give each existing caller their own mark? Well, each caller "class". Where "class" means "holding look 'foo'". Same lock, same mark. With a maximum of 3 (and I think we can get away with 2). > > > Maybe we should serialize the use of markers on the LPI list on the > > > config_lock. A slight misuse, but we need a mutex since we're poking at > > > guest memory. Then we can go through the whole N-dimensional locking > > > puzzle and convince ourselves it is still correct. > > > > Maybe. This thing is already seeing so many abuses that one more may > > not matter much. Need to see how it fits in the whole hierarchy of > > GIC-related locks... > > It doesn't work. We have it that the config_lock needs to be taken > outside the its_lock. > > Too many damn locks! Well, the joys of emulating highly complex HW with a braindead programming interface. I'd explore the above suggestion to avoid introducing a new lock, if at all possible. Thanks, M. -- Without deviation from the norm, progress is not possible.