Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp677509ybl; Fri, 13 Dec 2019 02:55:22 -0800 (PST) X-Google-Smtp-Source: APXvYqyUHhMWnHRPVxTdsIiN6LvdIgF1XH7wqTua8UQKKzr+b4joATKHCVgZ9qERQQasV2hugVZk X-Received: by 2002:a05:6830:22e3:: with SMTP id t3mr13315491otc.193.1576234522433; Fri, 13 Dec 2019 02:55:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576234522; cv=none; d=google.com; s=arc-20160816; b=dyauATqYP8Ujqm1n8mXvRjl2MT3Z1CK/Ghnh8HMvfzLM4SRiA4ScSZ0PkQXlbsGSWj kw+nw3fKeyX8/hxIZWmCHjIH8HEVzymjizc+Ujq4CoIGlY4cjf3x2KfpEYotTsXhrfrG I8DyIfsX3DQF3xE2gxNkqEfHDnyZuAGKHHVBd3ayaaKcVyNg5Q2B9UdVuQpADEZ/GC9k 0rOvGNS9EUJ2dHA/95Z5nYrXhG99S7iIQ6BD0Ek7RqPg0ojOhTFgsxGRIBeS2uj1wP4G qMefXz4c3ialwuK721YNsivJZxzF3tDfq8WGExBNL+VubEDtfJaPuTCRNw4QQL1mykJI Kmrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject; bh=vPrrsuymCwkbm/heAgQFz7/jmU4+vXCHmFQ+aitsqJo=; b=AELzDaDvPRXjTwyhzEZNHAYS2U4cSK3RbTQ753DRV0SbqIafWZBIvXxBVrRzA/PB1F NBzEs8DIwY1WCN6Cd+8Gc8jpsIkXbvc+HlTRKoz0gBu0ybZeg7pxASIR2VNUtzGi2xYm o8sRpqWBKA4U4ssmj/yMR6l0SxsViPdCnsn7AOjTWp6lYSwlu/lb+xMRDapjNgB0m0aJ lou91k6DSMULeyk8l0ikEmtDooFHkAKmH/i7+LmtLw8wtfQdOMF9+5RFJvX5aPlDyt45 bKwcaUvjTOdPf/2Qxgo5xOu6KLQau4tNGH0wSSaB0ivwpR0BNA7Ti4FIK7yUxGmoy7LO nxnQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d67si4975041oig.112.2019.12.13.02.55.10; Fri, 13 Dec 2019 02:55:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726592AbfLMKyL (ORCPT + 99 others); Fri, 13 Dec 2019 05:54:11 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:7685 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725928AbfLMKyK (ORCPT ); Fri, 13 Dec 2019 05:54:10 -0500 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 2A6E91B35A79113B855B; Fri, 13 Dec 2019 18:54:01 +0800 (CST) Received: from [127.0.0.1] (10.173.222.27) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.439.0; Fri, 13 Dec 2019 18:53:55 +0800 Subject: Re: [PATCH] KVM: arm/arm64: vgic-its: Fix restoration of unmapped collections To: Eric Auger , , , , References: <20191213094237.19627-1-eric.auger@redhat.com> From: Zenghui Yu Message-ID: Date: Fri, 13 Dec 2019 18:53:53 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: <20191213094237.19627-1-eric.auger@redhat.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.173.222.27] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Eric, On 2019/12/13 17:42, Eric Auger wrote: > Saving/restoring an unmapped collection is a valid scenario. For > example this happens if a MAPTI command was sent, featuring an > unmapped collection. At the moment the CTE fails to be restored. > Only compare against the number of online vcpus if the rdist > base is set. Have you actually seen a problem and this patch fixed it? To be honest, I'm surprised to find that we can map a LPI to an unmapped collection ;) (and prevent it to be delivered to vcpu with an INT_UNMAPPED_INTERRUPT error, until someone had actually mapped the collection). After a quick glance of spec (MAPTI), just as you said, this is valid. If Marc has no objection to this fix, please add Reviewed-by: Zenghui Yu Thanks, Zenghui > > Cc: stable@vger.kernel.org # v4.11+ > Fixes: ea1ad53e1e31a ("KVM: arm64: vgic-its: Collection table save/restore") > Signed-off-by: Eric Auger > --- > virt/kvm/arm/vgic/vgic-its.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c > index 98c7360d9fb7..17920d1b350a 100644 > --- a/virt/kvm/arm/vgic/vgic-its.c > +++ b/virt/kvm/arm/vgic/vgic-its.c > @@ -2475,7 +2475,8 @@ static int vgic_its_restore_cte(struct vgic_its *its, gpa_t gpa, int esz) > target_addr = (u32)(val >> KVM_ITS_CTE_RDBASE_SHIFT); > coll_id = val & KVM_ITS_CTE_ICID_MASK; > > - if (target_addr >= atomic_read(&kvm->online_vcpus)) > + if (target_addr != COLLECTION_NOT_MAPPED && > + target_addr >= atomic_read(&kvm->online_vcpus)) > return -EINVAL; > > collection = find_collection(its, coll_id); >