From patchwork Wed Feb 21 05:42:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Upton X-Patchwork-Id: 20709 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp849474dyc; Tue, 20 Feb 2024 21:44:06 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCViNOmnjFLslULOzSld2BZaQEgGYm3Rfd9rIEEanGMbiQjI6mGvIc4SMKB1fdMaMZ9tFrvdZxWymYg4lYEYJ0vcQhxxUw== X-Google-Smtp-Source: AGHT+IFJCLn8ASoWq0ULhzfE8PDow4lcP27PXEeLh99SMFdrsT0Jkh1n1mL6rqa6OHX2kmeLV5Ih X-Received: by 2002:ac8:58c2:0:b0:42d:e772:843 with SMTP id u2-20020ac858c2000000b0042de7720843mr17402725qta.58.1708494246213; Tue, 20 Feb 2024 21:44:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708494246; cv=pass; d=google.com; s=arc-20160816; b=07AFMAnGJfgOEHwTMnDQAotkDrjrS+2Htt3BmNAIHYKPyM16E3C8PLwyGmhRm3kTFa d1hUYrpSdasmOBmagOg/jdoufNFIHpOqb1R3NVjnT4ZizdBoM5jqEr1L9zoAs2K+K2Mz 26E9UZAo9dHSmAyBcUDxtJgxF92x0ODfsO+DZ6eN57XmC0XaGLZGVw1IM93iQWx78dZj Aqbv8IXWEYx0Ly+YVk9r/ZCnrTs47cEnJFZJu1SOwteMqmDSfd+nxnFiJfqKvCEHADPF 3gyGvabYATzbcq2hTbYw7tbNIJC0UGcjwEvW7STnO0xprLyuBbZHqGmp1cyFEzi0yBu9 /ISw== 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=R/Or/Yh2fAMtkGN2IdwrHuQeB2WLq6uP7r3G04y+nVk=; fh=kCIhDCwfhVa+1moYcBlLNuY7yX/BfELZCoRk1wSf3jY=; b=mDpb5qwJ0wqoyKjTO5g6s4e/6gbZJK+MxNyoTq0TLKycZME5MurEfvWPn7z+c9HjbL VbzolsGi0x9xionw7ejM/uyuw/7VhF64383DWukSnrdyaJgBlV3G3yx6H1J2Bmw/slHn OiJ7SaoQKMl4TXmC3VDPKG6UWC/REH9lIJDEdEM6fKqB0NdHaBEiARSx7sf5LYuoV5vg +HmEb5Tj0zJR32qtnknO/UB3qYUtIUmfSNLdFWUDJRIFdd0+cdEfSxjp+deYD4d8ZOwr M7iR6q5/raaF8hnKnsoGO7N1pB686cEvjtTKddjvzZhcXDTwtWCQiIYYGrN7rBbjMvlx TkXw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=QlIZNZ1D; 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-74098-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74098-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id kk4-20020a05622a2c0400b0042dda2ccd8csi9736987qtb.50.2024.02.20.21.44.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 21:44:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-74098-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=QlIZNZ1D; 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-74098-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74098-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 0617B1C2321B for ; Wed, 21 Feb 2024 05:44:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3CD913A8F5; Wed, 21 Feb 2024 05:43:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="QlIZNZ1D" Received: from out-188.mta0.migadu.com (out-188.mta0.migadu.com [91.218.175.188]) (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 5EED33A8D9 for ; Wed, 21 Feb 2024 05:43:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708494202; cv=none; b=ChZqCBE4pB3/wsaE0Emw63RijegWeRWTtBW5G5+qFh4r4z/9iiJTEWd+MIkwyDWRf8kUR99p2XhRIViCrTGJ4SgNFDiqqF0R6BwSNeG3b5cloiED5+cOmAr1iItAFtUn4XhXR/CEbJQpdld2lTWkVJKoyqNPw41ysg1IW2YfiM4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708494202; c=relaxed/simple; bh=7Rss8dEy/kleI+VwoacNEfis/mgGm1UZXOe2ZRncC0o=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=GK42h0cXyI4g5ECFIzW9IoPnnb9STJ/1Yla3gzo4juWjFHdmMXHKhGHapnV43Jru3QEukxhTgFyBtJJDswmoymZx0eGgLIQpNuoY6f/WA1FZTms9HUca2A5mPOqtQCnZWaonG8Xgx7wFRpAT7s682uAvl4L1ZbYv7QhUbTacb4o= 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=QlIZNZ1D; arc=none smtp.client-ip=91.218.175.188 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=1708494198; 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=R/Or/Yh2fAMtkGN2IdwrHuQeB2WLq6uP7r3G04y+nVk=; b=QlIZNZ1DPWCe1i+G3NUfzvZGRnxgOcqyEY/nDbKoZZFAtnXrvqNokC8nAIe74UMerLAVQP 3PRjEsb9s7Fh6gKlOBloWypS7xAfOouIToj/uuwOZgWdu8NP+TamKP6qQmSTdB5UTVnYEH m7WNUpJF6lsl2OzO7+py7MtmhiA1Ue4= 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, Eric Auger , Oliver Upton Subject: [PATCH v4 00/10] KVM: arm64: Avoid serializing LPI get() / put() Date: Wed, 21 Feb 2024 05:42:43 +0000 Message-ID: <20240221054253.3848076-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 X-Migadu-Flow: FLOW_OUT X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791486062741734885 X-GMAIL-MSGID: 1791486062741734885 Addressing a few more goofs that Zenghui was kind enough to point out. Clearly all of the bugs have been found and addressed at this point. v2: https://lore.kernel.org/kvmarm/20240213093250.3960069-1-oliver.upton@linux.dev/ v3: https://lore.kernel.org/kvmarm/20240216184153.2714504-1-oliver.upton@linux.dev/ v3 -> v4: - Actually walk the LPI INTID range in vgic_copy_lpi_list() (Zenghui) - Ensure xa_lock is taken w/ IRQs disabled, even after purging usage of the lpi_list_lock (Zenghui) - Document the lock ordering (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 | 55 +++++++++++++++++++---------- arch/arm64/kvm/vgic/vgic-v3.c | 3 +- arch/arm64/kvm/vgic/vgic.c | 60 +++++++++++--------------------- arch/arm64/kvm/vgic/vgic.h | 15 +++++--- include/kvm/arm_vgic.h | 9 ++--- 7 files changed, 79 insertions(+), 69 deletions(-) base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d Reviewed-by: Marc Zyngier