Message ID | 20240213093250.3960069-4-oliver.upton@linux.dev |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-63208-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp423990dyb; Tue, 13 Feb 2024 01:35:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IHytzSH4xyggtyNessiXAUCUDZi6DxaLucLJgLKkElYwfi6i91nKZQoToWLc29/ENUfiVw6 X-Received: by 2002:a05:6871:729:b0:219:3447:6ba6 with SMTP id f41-20020a056871072900b0021934476ba6mr12474335oap.47.1707816933847; Tue, 13 Feb 2024 01:35:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707816933; cv=pass; d=google.com; s=arc-20160816; b=E9+qXPIwsSPHLjI9Rm39S1ahP3eUVYLAw4B2Ck/fUfOFCfxT9Tx+Olb7yuNVPpoHm/ NSqxCB/fLcHfqBbNNCA4gMBG9SYzIqWO6uhZfBKLVNGCv730bAZVLhFBJockYztYLvi0 uwAiHqVg79yjb+wXs/kKskqIi1XGnoPgjT0xh9Sqct7mpv1X6FBRJP/xCiEJZvSr+v3Y I/XJD+E7N3zAuPKk2NNP0asbC3cSPi3Naj4m4ac0CPLDTYOahGMpBjOib1gGSMfhoYxt k5ZMtmCcgzTX8xxH+VZgWNtReMHW0dJdOh8Pf1fVmtAg2c58kpgTIBa8XxYPAB5FEqSQ 0euQ== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=MN4YT9WjubbgV9vwymCrG2zbA0P41iVcrtZBfJr5OD0=; fh=uA7GYO7f+twxVA127KUUkobskh0ga5Sb6rstslx7gBw=; b=kcpsJ6ffQ+NBJc9AbudJPzy6olAXiuAZett9VWLnnnTTWKyv0G6KBoEC5W63ptUBhs P6oZkOz3lXsOqglQZxKwObx1kXEIN2lnlUdZJg8k2OpnGVu9HrUtQPE3Awv7tt2zYT5u q/FaB/VKmb82JyaTk+ni+eSAPdX08oG7mduQ5ule9q27SJ1y03sO2xpEY+AU71IqPvr9 7Qns+5aJGaZITuGomwiHQ5oPJUro7YsHOeZw28fuNMvlEZwmuZ9Cx/JFSj6wuKsiV//f fMEg9ynmFBITnN+fGDm2xRdK9QjwA6IM46xPgHrwmFAgb4nRkq1plHerdZPsl0M8NpM7 8tMw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=C7HSnkXR; 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-63208-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63208-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev X-Forwarded-Encrypted: i=2; AJvYcCXuBdleyNQq6kb1Dsd4exK7vW/bbzs0DE6Qv8y56Pd0ZawLfraMKT9Jgkz8LLb7doBJSPUCTX9AQ25IDLnmLVXamp2sdw== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id bq13-20020a056a02044d00b005d7a13d0be6si1837518pgb.232.2024.02.13.01.35.33 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 01:35:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63208-ouuuleilei=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=@linux.dev header.s=key1 header.b=C7HSnkXR; 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-63208-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63208-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 37A3228700D for <ouuuleilei@gmail.com>; Tue, 13 Feb 2024 09:35:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 94E7334550; Tue, 13 Feb 2024 09:33:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="C7HSnkXR" Received: from out-183.mta1.migadu.com (out-183.mta1.migadu.com [95.215.58.183]) (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 1DC85225D7 for <linux-kernel@vger.kernel.org>; Tue, 13 Feb 2024 09:33:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.183 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707816803; cv=none; b=kTneMpRHw8jja/y4W4rZeaSVY0nF5qk1miMMwi4sPsE4XQOJTrMEpN4vRh05mPJ+dalxPxbFfFV+qrnw0DoaZVrVl8WRICw0LsVwrr6RcXWui3XxKA0GMs3HypR0vLQ2bLZyVDr9WrQMW5PkXdrV5EcBJ7scxQR9yPIIaIOX6SE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707816803; c=relaxed/simple; bh=4brcHvDAVkgAUVv+EhHLpJGf3bgOIUhxLJMTpEy7pkA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q8sLUztp2/o2s22TI83H0hxi8J0aoF2kOsJhiiqjdVYJOdK97c/2MnKqAr9GtbDYMvNp2kVZws/wW1h/vMMThu3v5jKEPIRKlnSf2Hkpu/guB1OBrYSZ9NZ+phi6xb6DXiMTCaFJ8t0KiEKAc7vv1Zq58IoLx5rTVAJP9JgGV0g= 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=C7HSnkXR; arc=none smtp.client-ip=95.215.58.183 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=1707816798; 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: in-reply-to:in-reply-to:references:references; bh=MN4YT9WjubbgV9vwymCrG2zbA0P41iVcrtZBfJr5OD0=; b=C7HSnkXROz1+UoFZtjeg4W2NSgOZRroDA00Cdsa98sNQuumqq4yrXfLeNfcXS5vMpujcKT OmC+dNgbyNxY5y311yrx0WTver+2ok75zp+yixGCV9iajwZaZBpvbGmw7RTG9c6dzlLqgO 71HwURum7tLyeuMsoVyAtjOEU1Opz+Y= From: Oliver Upton <oliver.upton@linux.dev> To: kvmarm@lists.linux.dev Cc: kvm@vger.kernel.org, Marc Zyngier <maz@kernel.org>, James Morse <james.morse@arm.com>, Suzuki K Poulose <suzuki.poulose@arm.com>, Zenghui Yu <yuzenghui@huawei.com>, linux-kernel@vger.kernel.org, Oliver Upton <oliver.upton@linux.dev> Subject: [PATCH v2 03/23] KVM: arm64: vgic: Use xarray to find LPI in vgic_get_lpi() Date: Tue, 13 Feb 2024 09:32:40 +0000 Message-ID: <20240213093250.3960069-4-oliver.upton@linux.dev> In-Reply-To: <20240213093250.3960069-1-oliver.upton@linux.dev> References: <20240213093250.3960069-1-oliver.upton@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790775848827148553 X-GMAIL-MSGID: 1790775848827148553 |
Series |
KVM: arm64: Improvements to LPI injection
|
|
Commit Message
Oliver Upton
Feb. 13, 2024, 9:32 a.m. UTC
Iterating over the LPI linked-list is less than ideal when the desired
index is already known. Use the INTID to index the LPI xarray instead.
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
---
arch/arm64/kvm/vgic/vgic.c | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/arch/arm64/kvm/vgic/vgic.c b/arch/arm64/kvm/vgic/vgic.c index c126014f8395..d90c42ff051d 100644 --- a/arch/arm64/kvm/vgic/vgic.c +++ b/arch/arm64/kvm/vgic/vgic.c @@ -54,8 +54,9 @@ struct vgic_global kvm_vgic_global_state __ro_after_init = { */ /* - * Iterate over the VM's list of mapped LPIs to find the one with a - * matching interrupt ID and return a reference to the IRQ structure. + * Index the VM's xarray of mapped LPIs and return a reference to the IRQ + * structure. The caller is expected to call vgic_put_irq() later once it's + * finished with the IRQ. */ static struct vgic_irq *vgic_get_lpi(struct kvm *kvm, u32 intid) { @@ -65,20 +66,10 @@ static struct vgic_irq *vgic_get_lpi(struct kvm *kvm, u32 intid) raw_spin_lock_irqsave(&dist->lpi_list_lock, flags); - list_for_each_entry(irq, &dist->lpi_list_head, lpi_list) { - if (irq->intid != intid) - continue; - - /* - * This increases the refcount, the caller is expected to - * call vgic_put_irq() later once it's finished with the IRQ. - */ + irq = xa_load(&dist->lpi_xa, intid); + if (irq) vgic_get_irq_kref(irq); - goto out_unlock; - } - irq = NULL; -out_unlock: raw_spin_unlock_irqrestore(&dist->lpi_list_lock, flags); return irq;