Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp764493rdh; Wed, 14 Feb 2024 10:34:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXJh7KZZM9iFovRPESURl/ilqSuq0bAQoCF1gMdgXZ87svR2ivrOqCSYxjjCPvx2SugphwGLxHvJIZ3e8RCZf+2EWj7QHEpdqRQDeOWnA== X-Google-Smtp-Source: AGHT+IEsq/1jIv8g3TQ8BPtL/iUg3czccKnM5KcFCoaWnQpbkg4SNaO1ME1Nn5xY0VQY7zX9OxMQ X-Received: by 2002:aa7:d4cd:0:b0:55f:fd10:5e73 with SMTP id t13-20020aa7d4cd000000b0055ffd105e73mr2852026edr.20.1707935679877; Wed, 14 Feb 2024 10:34:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707935679; cv=pass; d=google.com; s=arc-20160816; b=NdLrO1lFFNFhFRe7SXZAcqcThQ2phNIKe1AVZRdQmSH/7cSp5AIYDmqUFvL5jvfJZ6 o+6D6V+WUel45I706MYxa8s4INIXkkiuW1dOI+Lmtc0itv/QY5gS3PUJDWyqYwhZmhgo MB3SVmUZvbeqAxRew9Y6Xjc2sqAhaOUSnOI01VnxLtlRmcCxy4PHKUOd1Aj0pm4GjwHB xiBCD+ui/Rfh9M+AMvowvaRMxhbpg0wXsgCi4jbNEYDS3ej1HnYuXcQhuvANkIjnr/Pk LhL7PID6Gec0AWCbdnbJtUSLtGhcz4gtu4ApOmMpzHDf8H5xUyJAoJt6VycLEgAa6rgQ LE6Q== 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:dkim-signature:date; bh=GfEPhq0mY5MqLsPcWaUBe1RZW2jMzAXPTv3wIHSwKlQ=; fh=3jsWAnEr0cpgb0fpeOSK+/pqV9LYPBOdN5GPjMTJOr0=; b=Q7h/jKok8VaVbsDJRpuJNm0FZzfjx7Nudg9eC2wgcOrU0cB/BXhZnXPKV2OJns0hgH 93D6gqbzw7IJuV5DXhqYQh7nW+/B7c02A11ctil6Xkh0QoQuvj9NUcaC4510PAVE8C3D uNaTfCMX17tsEiyvOC7ItflEzFwfckn+4/uONvMW3xEFSpdZuKxttOq18ZFOOmVlNlrr Fy5qUKtkrzxYwIYL4s4aRYsK9yBGmTyR4eAK2C5NcOX8cqqaVBMMbwAl3ncmGfFk8zrx mu+Y87RQFgouiTM4yGBx7I7xE9Ydl3bQ4JFA37/p7u8uVpdrW/zMltJUzSsct9xAH8ez A4vg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=CP+h46Zp; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-65814-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65814-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev X-Forwarded-Encrypted: i=2; AJvYcCV5mN/NYRWAbEeoM6chPwn5qbgKI9qCgfCZ87ZZ7sYLot/Jt1ug7a5O+CdLECS3xi7Rtvy1mPJvKCBPPnYaaCEcZHmm/FXw1SkZzrHltA== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id de2-20020a056402308200b005619bd7e9c5si3725475edb.209.2024.02.14.10.34.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 10:34:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-65814-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=CP+h46Zp; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-65814-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65814-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 8BF101F235C8 for ; Wed, 14 Feb 2024 18:32:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A23E812F5A2; Wed, 14 Feb 2024 18:32:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="CP+h46Zp" Received: from out-172.mta0.migadu.com (out-172.mta0.migadu.com [91.218.175.172]) (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 18F0013A25D for ; Wed, 14 Feb 2024 18:32:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707935534; cv=none; b=peTG5ugwEHkC7v9Cq8+pkHetbat4yXPS+xVNxPumPsuVBG/1vcrcRhZ80BHab1bXXf+vSpZH0pAYKrU267aIGblbNtsIKv5mYBOGsqRaGsmchTBTNW11/plFWVs427g1t4SVDeg6+geu5ifLe0Rd0gNfzB+z5L5kQdsHXC8tqug= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707935534; c=relaxed/simple; bh=hQJBRQGs+RMDCzJU9MhP0ybkU+4yNcL1dqxEYsEzrCo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=onjTv36txctfI2u2zKFnMQh+GRQvHmYYPKukliOJ0gtPIWVH0nfHdlzSaLEQReTgDqZDrZxiSyBwFQh7dUCrJueBHizo0l7KNS0P9iJaeU+bk8Gs0cmeMJa1yinuN1eQvwhtBP42aCe2Y5iyH8H/JT5SPJqpBMFqRFGdYVa7HwU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=CP+h46Zp; arc=none smtp.client-ip=91.218.175.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Wed, 14 Feb 2024 10:32:02 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1707935531; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=GfEPhq0mY5MqLsPcWaUBe1RZW2jMzAXPTv3wIHSwKlQ=; b=CP+h46ZpoN7SQ22Jluz5ihfwrCgfTdgpoPkPirGUtf3QP+9gfQ7TEZm0pRPTbYuEMl+pm6 Ww60ZIbeXtIkx2Xu/Bq+4IhqE7Uhwq33o4iA5pVBPTUjRu3nib+0GpnTUKxEf3sTAFbAJW 3lyWZklfv39+UBTo+dfGIdiaYZGg6Ts= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Marc Zyngier 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 Message-ID: References: <20240213093250.3960069-1-oliver.upton@linux.dev> <20240213093250.3960069-8-oliver.upton@linux.dev> <861q9f56x6.wl-maz@kernel.org> 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: <861q9f56x6.wl-maz@kernel.org> X-Migadu-Flow: FLOW_OUT Hey, On Wed, Feb 14, 2024 at 04:47:49PM +0000, Marc Zyngier wrote: > I'd like to propose an alternative approach here. I've always hated > this "copy a bunch of INTIDs" thing, Agree. > and the only purpose of this > silly counter is to dimension the resulting array. Well, we also use it to trivially print the number of LPIs for a particular vgic in the debug interface. > Could we instead rely on an xarray marking a bunch of entries (the > ones we want to 'copy'), and get the reader to clear these marks once > done? I think that'd work. I'm trying to convince myself we don't have bugs lurking in some of the existing usage of vgic_copy_lpi_list()... > 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! :) 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. -- Thanks, Oliver