Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp345541rdb; Thu, 15 Feb 2024 01:44:19 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXMHOGIuBR0hc/YXc3fVDcgTd2hxrZlBOBTZ9N6Ti4S2DUkPQRzC/oQED0f06M5ly9Q7vDpmrpXyub+sjHBoiQ3TUl1yCYGtIqP/qeoPg== X-Google-Smtp-Source: AGHT+IFHEUXp3ADWmf2SDLv4WLx+2O5C99bwINlb56zeQzrErHrNcXzQ8WhSQ9K4FGdlBunMrY1B X-Received: by 2002:a05:6a00:bd6:b0:6e1:142b:6dd6 with SMTP id x22-20020a056a000bd600b006e1142b6dd6mr1171398pfu.31.1707990259624; Thu, 15 Feb 2024 01:44:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707990259; cv=pass; d=google.com; s=arc-20160816; b=0n5yHqTaTZo9rdpLkx74oHUNeVhKDxQWtNtx/Egiw4bqcUZz2CFxuZeQBaGY+YdsZx pBJD4Rlkja8Zzt4qHm+5F+slsIGH6dSTbGmpP0RvpCmnj9iUt/WrxKuEw3ArOcZWrDg8 FQCEALVyqUd3YQmrDg7Y8yMMK6JUCH7Yfm46LnQllivbjZrVMnJhS+woX6I0UbbnIV/G 2JFCUs4n9ia/RyV12TmE0Q5fwJM7L666xU11Knv1yF1Y1j/CewIE1ny6yEb/5csWTh9Y lu1VtdSfff5ZWjDhFyW9jMQHtKPFn6YSb9pLuhicleBUganeSfb0n+oGUNwwhHlUujOl qiOg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date:dkim-signature; bh=DChUTHUqbVID+ASJpKIxwHB+Str3+5qO438tkUQ2om4=; fh=4M5rM6cF0tXKEvsrDyqurvYnQBsggznQ6bLR47hM4qw=; b=j4r5rRaLquJo0gmlJNb7vgUsMSJMf6i3tYhFh4sYUZxn5S9JjWgBvw+pj7VRkYDMrV ypcSiYl6xirsa3sEblCCQ9xZMX5fF+wmJ6Te5A7UeBg7KGSKoFPklox99TSHxJ+WP0ZS IyxzMI48INktrsPX29q3tiLy0xpgOXSO1AEIiMOYHjtnZGTBXono+TILsmYGoIUZShaY +G2KWwARIexDw8lu/5y+f7+pEtwmvH8vZkh+2/BHch9OCgWUfZ7PQ6qTwJASANWn451E hIIpPtgMCk1FM/VqFB4a/+WtHJYeQ4Np6cpZ2kssSMsWUHLW/FAq0TFM7bRhP/hl10Qu h5Kg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ho3gUMdC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-66570-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66570-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id be15-20020a056a001f0f00b006e0f4907ebasi883354pfb.113.2024.02.15.01.44.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 01:44:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66570-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ho3gUMdC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-66570-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66570-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 4B320280EDA for ; Thu, 15 Feb 2024 09:44:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DE1FB50A79; Thu, 15 Feb 2024 09:44:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ho3gUMdC" 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 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: linux-kernel@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.