Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp14443534pxu; Tue, 5 Jan 2021 01:28:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJwhJvEICSmdM3n4Dane+I/teMUW+UHH3tvUZwIlcwofhmCkYY6RwZ3YA1JKn9MIjkWDocAj X-Received: by 2002:a17:906:38c3:: with SMTP id r3mr69791526ejd.193.1609838918942; Tue, 05 Jan 2021 01:28:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609838918; cv=none; d=google.com; s=arc-20160816; b=qYOYmof0l2TiIrZoUFNgosCbLgdny7WAf3kI/mljH09iyCOI8pwXjFpcgn0mXd/u2n ri0IU9qHmxU2uMIU0j1XFlfYSoCB/RrLprExG9zSRkQ7vzfX2gIhdEsP2/OZUnHCXtsJ yVdAIbDRCHOVq/bfQesEdeOBS4JcyZlqRfbmlqnmduGTiPwYz1LkHB+Ov8Gg/tKFrCRh PWBZ+V3/Jbute+MxI/xc3kpyWWhZIdUbTZK/K9HBvUH6KH5F443bKIxO8h8g639OuOIN bJ7SaaadbfufVsIjNVumRjIktd4NfiWLzRd50r1mnj6qiIGVUzq1KxoSKNYDaLk1xxiT h0Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:user-agent:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version; bh=HvM+vgQifGjFKMvs5MbBSiGfUnB/27nGTRU/GFQ7+Ok=; b=C8P4JGZSTwymKMJWJ/tPsNUVDrEysY8OZBX3NxZOOcyk5mZsCl7vj4ghLMXRtEOJDq IMRH6C0iDIapXFLDih1YR9gUi9ncl8hD8hH4/E8zQB/On3YOwDGzsxKzSbsx3hGO4f1/ 5Zd1ZpHX+8CNHxNGpYy1SdnP1AsIx6Z2QA1v+RdSPmn5GsZh8Jw0qeF7CMmKCKPU4K6b zVUrtTqO/LASDLn3pU7s4izETt+brkdFtKGhdfueF1YDJayUoWljOCysh6FmZfONURO1 bPZppsnhe5NXPR8vSvItcMt9my2RV0ClMrgjMRv5vXhfR3/mOYbkZLhqYF5XdqUa+zY+ kQgg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u18si35122425edy.420.2021.01.05.01.28.15; Tue, 05 Jan 2021 01:28:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727768AbhAEJZ4 (ORCPT + 99 others); Tue, 5 Jan 2021 04:25:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:48224 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726394AbhAEJZz (ORCPT ); Tue, 5 Jan 2021 04:25:55 -0500 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E3B9620756; Tue, 5 Jan 2021 09:25:13 +0000 (UTC) Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1kwiaV-005Oa8-O2; Tue, 05 Jan 2021 09:25:11 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Tue, 05 Jan 2021 09:25:11 +0000 From: Marc Zyngier To: Shenming Lu Cc: Eric Auger , Will Deacon , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Alex Williamson , Cornelia Huck , Lorenzo Pieralisi , wanghaibin.wang@huawei.com, yuzenghui@huawei.com Subject: Re: [RFC PATCH v2 3/4] KVM: arm64: GICv4.1: Restore VLPI's pending state to physical side In-Reply-To: <20210104081613.100-4-lushenming@huawei.com> References: <20210104081613.100-1-lushenming@huawei.com> <20210104081613.100-4-lushenming@huawei.com> User-Agent: Roundcube Webmail/1.4.9 Message-ID: <76a7b9cca485dc8157d3be53189eac69@kernel.org> X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: lushenming@huawei.com, eric.auger@redhat.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, alex.williamson@redhat.com, cohuck@redhat.com, lorenzo.pieralisi@arm.com, wanghaibin.wang@huawei.com, yuzenghui@huawei.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-01-04 08:16, Shenming Lu wrote: > From: Zenghui Yu > > When setting the forwarding path of a VLPI (switch to the HW mode), > we could also transfer the pending state from irq->pending_latch to > VPT (especially in migration, the pending states of VLPIs are restored > into kvm’s vgic first). And we currently send "INT+VSYNC" to trigger > a VLPI to pending. > > Signed-off-by: Zenghui Yu > Signed-off-by: Shenming Lu > --- > arch/arm64/kvm/vgic/vgic-v4.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/arch/arm64/kvm/vgic/vgic-v4.c > b/arch/arm64/kvm/vgic/vgic-v4.c > index f211a7c32704..7945d6d09cdd 100644 > --- a/arch/arm64/kvm/vgic/vgic-v4.c > +++ b/arch/arm64/kvm/vgic/vgic-v4.c > @@ -454,6 +454,18 @@ int kvm_vgic_v4_set_forwarding(struct kvm *kvm, > int virq, > irq->host_irq = virq; > atomic_inc(&map.vpe->vlpi_count); > > + /* Transfer pending state */ > + ret = irq_set_irqchip_state(irq->host_irq, > + IRQCHIP_STATE_PENDING, > + irq->pending_latch); > + WARN_RATELIMIT(ret, "IRQ %d", irq->host_irq); Why do this if pending_latch is 0, which is likely to be the overwhelming case? > + > + /* > + * Let it be pruned from ap_list later and don't bother > + * the List Register. > + */ > + irq->pending_latch = false; What guarantees the pruning? Pruning only happens on vcpu exit, which means we may have the same interrupt via both the LR and the stream interface, which I don't believe is legal (it is like having two LRs holding the same interrupt). > + > out: > mutex_unlock(&its->its_lock); > return ret; Thanks, M. -- Jazz is not dead. It just smells funny...