Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp1288392rdb; Fri, 16 Feb 2024 10:42:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXZRgo6svyaZUaCMAkKsoRJBLQafxTkvSpmVxXKzSd355WRmkz3esl65d/mDWpcOn8GJHTNZbMfvJYTSEIh8EPY4SfVzyXxhMfpsOoHMw== X-Google-Smtp-Source: AGHT+IE69z5pPLHVVRbMMhGAVUuQ5Qz8fMzm9wQSTKxOeEtrXj0bTwu4FQ6S9vgT97F6kudmbnpU X-Received: by 2002:ac2:44b1:0:b0:512:9dee:9ac with SMTP id c17-20020ac244b1000000b005129dee09acmr586911lfm.48.1708108970632; Fri, 16 Feb 2024 10:42:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708108970; cv=pass; d=google.com; s=arc-20160816; b=sgkj3erh/6pVj1WknyXQL7SOJHB6wtOxrMGyHzAm6biyoo+PGEtJNglI5rnlTe6i7u JchMcl1Q8gTPnkyoT3AHafoI21htiwRuDUsUzbMtKIW4ChCT2T2+6o9Wgf88ll8wqFFX 2+Sfdtbt2ZLS1Y7yFtTanjaDbmJy0B1Xqaub3EiguFuapdj18UmyD4Hc5VjMBhF+B5xQ 5VY8OhIioMUh3Xap6Arkmww7zyItYs9hU52fvpRM1sUmu1wC2GRpeT2b3135qnR32qvD O8Fwft9MyCd3626QC8xTZqVi1OvOp9RjmUHcy4eNGLFp3lR3uJLV5+6ct4Pl2AtVut7X 8PBA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=dy9uGuDewCRmPkjUp3zVJbGMujkAY9qYVaz8IFv8Bxg=; fh=OGIcGdyoke6ohfCedcQQ3UJr3JDRxZcQDHVG7x10Yg0=; b=Q3JN5giaaZ7w44du5+zEg6DASz+bRkO74YWwNo1/AFjQiNYJtqZH6xVbTVnsWl9pLF RvIylmcS3QwkUo+12c50jFeGwk4fnr9+He+sZQmf3WVK5wDQdCydkFvflNykypGxUeyH xYqa7pH2095jUwjCbWGj5NfsA/tRy7zr/TMrCV2Q9G0r5Jf7tVdzN4mbOzN3mlALA69b j/GbzBiviU40hJ+nOadgjw+SPMaqoJ/ZoacVNqolxDEofiB7IPYilPIOiUkJDnsfjUuD IASSdDE3PUvPmgcdQCWbIpUMVMBxUIWoHKoNCzusdYZwfhI3Q109AEQhlMH/2OeenSIc J41Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=bShf0MgS; 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-69181-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69181-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id r18-20020a1709060d5200b00a3de10ea1c7si166298ejh.68.2024.02.16.10.42.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 10:42:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69181-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=bShf0MgS; 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-69181-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69181-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 52D7E1F21D19 for ; Fri, 16 Feb 2024 18:42:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CF2F4136678; Fri, 16 Feb 2024 18:42:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="bShf0MgS" Received: from out-179.mta0.migadu.com (out-179.mta0.migadu.com [91.218.175.179]) (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 2149C1353E6 for ; Fri, 16 Feb 2024 18:42:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708108930; cv=none; b=D2cbsI175YcCnCO3z5mCn2jMoPkLm78xGAK6KIMaMYYTjOJKmdSeH0V5kiMo6p1sUTgJMDOkuRhX5nOnpBkB4qWVdyVXIqR6hmPXXnpt5suhqZJjDdPA+slw0zM9mArXvr05lAUtkR/sNVCOvvY5QEZMNC54J75kc/CPTIPv1jY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708108930; c=relaxed/simple; bh=QxChEtUBGhZVQmcitgUSn661JjnUAOsMvF/MSmXznAI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=FgyVlaUNHzUTC6q6a+7IBblXfvwV6W0mDyGfZifHCkLADPKHG2MYNvR/GG1REkOoF6dIU0ieyDtA88Dvkth+yH3B1LtXVIpt5TeWl8BJ7zYER88sRoT8VDgyjS1ns/1s/ehwT3KkfnDkyFV5eKFxWUcHZeH0I2DHE0qIxFsH7I0= 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=bShf0MgS; arc=none smtp.client-ip=91.218.175.179 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 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1708108925; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=dy9uGuDewCRmPkjUp3zVJbGMujkAY9qYVaz8IFv8Bxg=; b=bShf0MgSqhuWrIL+S1qXovTFCfPLEhtIccDFfHBNEfhfP5OtCcTJr+ei8OFQ2UFIe50OQW 32WQuJTz/ZgYEbAy6Hf3Hhxp2YrhqtIWgNgStHoKgVgQ1DRYMx8JH7oKcQRUFSkFrv436F WqvzO/QKMfXA7oylFbU9dCdjvrsqasU= From: Oliver Upton To: kvmarm@lists.linux.dev Cc: kvm@vger.kernel.org, Marc Zyngier , James Morse , Suzuki K Poulose , Zenghui Yu , linux-kernel@vger.kernel.org, Oliver Upton Subject: [PATCH v3 00/10] KVM: arm64: Avoid serializing LPI get() / put() Date: Fri, 16 Feb 2024 18:41:43 +0000 Message-ID: <20240216184153.2714504-1-oliver.upton@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT As discussed, here is a slimmed-down series for addressing lock serialization in the vgic_get_irq() / vgic_put_irq() path for LPIs. The bulk of it is using an xarray to represent LPIs and leveraging RCU to avoid serializing readers of the LPI configuration state. There's a lot of potential for clean-up, but this is intentionally deferred until after we fix up the LPI translation cache. v2: https://lore.kernel.org/kvmarm/20240213093250.3960069-1-oliver.upton@linux.dev/ v2 -> v3: - Fix the stupid lock imbalance once and for all (Dan) - Drop the tracepoints / stats I used for debugging my own crap (Marc) Oliver Upton (10): KVM: arm64: vgic: Store LPIs in an xarray KVM: arm64: vgic: Use xarray to find LPI in vgic_get_lpi() KVM: arm64: vgic-v3: Iterate the xarray to find pending LPIs KVM: arm64: vgic-its: Walk the LPI xarray in vgic_copy_lpi_list() KVM: arm64: vgic: Get rid of the LPI linked-list KVM: arm64: vgic: Use atomics to count LPIs KVM: arm64: vgic: Free LPI vgic_irq structs in an RCU-safe manner KVM: arm64: vgic: Rely on RCU protection in vgic_get_lpi() KVM: arm64: vgic: Ensure the irq refcount is nonzero when taking a ref KVM: arm64: vgic: Don't acquire the lpi_list_lock in vgic_put_irq() arch/arm64/kvm/vgic/vgic-debug.c | 2 +- arch/arm64/kvm/vgic/vgic-init.c | 4 ++- arch/arm64/kvm/vgic/vgic-its.c | 53 +++++++++++++++++++----------- arch/arm64/kvm/vgic/vgic-v3.c | 3 +- arch/arm64/kvm/vgic/vgic.c | 56 ++++++++++---------------------- arch/arm64/kvm/vgic/vgic.h | 15 ++++++--- include/kvm/arm_vgic.h | 9 ++--- 7 files changed, 73 insertions(+), 69 deletions(-) base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d -- 2.44.0.rc0.258.g7320e95886-goog