From mboxrd@z Thu Jan 1 00:00:00 1970 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 D0D0B28DA7; Sun, 18 Feb 2024 10:28:22 +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=1708252102; cv=none; b=X1uKfZ6m9fn5sfJOlCmFCls2t7wrFnwE8hP/SnNfFk0PfpLzlgJsoufUp5tpzvQBoT7ivd4A+cw69qsVEM02r1HRhXZChGz8Rfls3ceygWmPpCPY3Ed5El3xO7+euY/lWf+OPgJV0aVgYT+nEw5hpbdjQ1iZvFR/8bm924qoaow= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708252102; c=relaxed/simple; bh=jo3i6w4MRB5/SEWzXqo+q8xCowxsfAXxZRrnHqnwFyY=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=IArPWKoBb+fcZvvkGdQu9MEFvNqnobjoeDz9jahrOfBc+zZwgNI9bBWG0uLt3GNBaeIlCF6kcnMUlVvz6uCQdJ4AWxBhvgaxCqXD73uJFGa36vSlbdvye69xKIDxouxLxwj5xsTrpUS/YlWXdSbl1TdFtdcwzEnrB+JWvfDEp2E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TMHVSnnf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TMHVSnnf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACCCCC433F1; Sun, 18 Feb 2024 10:28:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708252102; bh=jo3i6w4MRB5/SEWzXqo+q8xCowxsfAXxZRrnHqnwFyY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=TMHVSnnfjqdGF9XRtANP2vUUKRsnBg6/al/pxwD/M6lYLw+2+RmJ9Yhn9byJ279gF FKopzBwb2scX9sZKj1fNBeMYsPo57X5RWtV7PoyBpEK/bdf+SpxCg0v/b2pzFdOBwE 2MfLhYFEMbcJ3Ns/EWz41AJ5Amf5KdjCI4Mqlsp+hcvXYs/YcJw3Qqfnlf89IBQi7B q1qQs8mrDrBJ11koCq5wsSgNOF+0XK33Cn9gln9rBYMMnXrCP+0zqKRu+2XeF37+hS F1+9FL0frplvAjqmMlOVyKHSlbrKGacwOBMSZFacx8mZufPREXLvl28hb3egbx3RD3 WYoDa1nBtmEgw== 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 1rbePD-004JPy-Vf; Sun, 18 Feb 2024 10:28:20 +0000 Date: Sun, 18 Feb 2024 10:28:19 +0000 Message-ID: <86frxq3w3g.wl-maz@kernel.org> From: Marc Zyngier To: Zenghui Yu Cc: Oliver Upton , , , James Morse , Suzuki K Poulose , Subject: Re: [PATCH v3 04/10] KVM: arm64: vgic-its: Walk the LPI xarray in vgic_copy_lpi_list() In-Reply-To: References: <20240216184153.2714504-1-oliver.upton@linux.dev> <20240216184153.2714504-5-oliver.upton@linux.dev> 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: kvm@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: yuzenghui@huawei.com, oliver.upton@linux.dev, kvmarm@lists.linux.dev, kvm@vger.kernel.org, james.morse@arm.com, suzuki.poulose@arm.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 Sun, 18 Feb 2024 08:46:53 +0000, Zenghui Yu wrote: > > On 2024/2/17 2:41, Oliver Upton wrote: > > Start iterating the LPI xarray in anticipation of removing the LPI > > linked-list. > > > > Signed-off-by: Oliver Upton > > --- > > arch/arm64/kvm/vgic/vgic-its.c | 7 ++++++- > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > diff --git a/arch/arm64/kvm/vgic/vgic-its.c b/arch/arm64/kvm/vgic/vgic-its.c > > index fb2d3c356984..9ce2edfadd11 100644 > > --- a/arch/arm64/kvm/vgic/vgic-its.c > > +++ b/arch/arm64/kvm/vgic/vgic-its.c > > @@ -335,6 +335,7 @@ static int update_lpi_config(struct kvm *kvm, struct vgic_irq *irq, > > int vgic_copy_lpi_list(struct kvm *kvm, struct kvm_vcpu *vcpu, u32 **intid_ptr) > > { > > struct vgic_dist *dist = &kvm->arch.vgic; > > + XA_STATE(xas, &dist->lpi_xa, GIC_LPI_OFFSET); > > struct vgic_irq *irq; > > unsigned long flags; > > u32 *intids; > > @@ -353,7 +354,9 @@ int vgic_copy_lpi_list(struct kvm *kvm, struct kvm_vcpu *vcpu, u32 **intid_ptr) > > return -ENOMEM; > > raw_spin_lock_irqsave(&dist->lpi_list_lock, flags); > > - list_for_each_entry(irq, &dist->lpi_list_head, lpi_list) { > > + rcu_read_lock(); > > + > > + xas_for_each(&xas, irq, INTERRUPT_ID_BITS_ITS) { > > We should use '1 << INTERRUPT_ID_BITS_ITS - 1' to represent the maximum > LPI interrupt ID. Huh, well caught! I'm not even sure how it works, as that's way smaller than the start of the walk (8192). Probably doesn't. An alternative would be to use max_lpis_propbaser(), but I'm not sure we always have a valid PROPBASER value set when we start using this function. Worth investigating though. Thanks, M. -- Without deviation from the norm, progress is not possible.