Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4885098ybl; Mon, 13 Jan 2020 23:12:45 -0800 (PST) X-Google-Smtp-Source: APXvYqwXMhcCrc6jJCZO+fi9pPqPqZYRkcqvJpE7ZXNRMaPwnCf8s2igKczvbbraaF84Ow3IoX3r X-Received: by 2002:a9d:65cf:: with SMTP id z15mr16553683oth.238.1578985964928; Mon, 13 Jan 2020 23:12:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578985964; cv=none; d=google.com; s=arc-20160816; b=vvVeVC3B6VH4ZDNvKTTgetB2FZoEYDCf5JtqVuFvhRX4gr4TfLDKAMPtKZg3bv9fWw jU6p45DgIVM5Y6XDEZrChV15B8C/BJXKGd56w7Hce96TRfxes1FLIx1a2j7bHWGqntFU lE8obNDqAdiVYrlFNWgSNqyNA6ivH+xrrXS2SWg3RAvPpLzkwhCz4FoFp53nM1ysHJcl qrve2m451/+ftLIUjg3Yq5ev8+XzHgj8yiQv8dpS8jfWDdy8iaQxAIKF8Jp/Ss8RnXx9 W0t/vTaf39v6jH+9y5o1+Dw60GYIf2gau8SChGdoRihMl+4vKaKeWW1ubtqBLGClWqDq pCJQ== 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:cc:to:subject; bh=z+/jiEOO0oZoU0bSmC4cNPmrFdXxHNs2pdjygzCYaJA=; b=c6C3OgIIPyts0j1FKFEKe44Y2S/iRYP/KYKYOPcnvR7E9xjQXz9jiyq4ZjCwiISANb P9p0K12IXChkLlBJxKNkzFGqvkHoBLCkMAE2iHQ5bhpf9qHMTEjSn8A2MbN+Dp/8AkI2 Y4CUcypEyzCCq7aSMlQXRmMr/CZWs6MOA5BX+jDRZFNEQ2qdUFgPwRRY4KOUHvTSkbqN 2sBuSXRPg1/eiFY2nsvB05yltrRy52UlDWh4cOVI3oTCUZDReTeyuGrMrlM0KGn9YDji RT6GkK3lf9vCee0jnpv1foixo3MZ3cteE7tulpZuNdR9jwldGVethOVlMu+zspz73JJr niRA== 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 v5si8272018otn.155.2020.01.13.23.12.31; Mon, 13 Jan 2020 23:12:44 -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 S1728855AbgANHK2 (ORCPT + 99 others); Tue, 14 Jan 2020 02:10:28 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:43034 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728746AbgANHK2 (ORCPT ); Tue, 14 Jan 2020 02:10:28 -0500 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id F2952AAD54E551A6FA5C; Tue, 14 Jan 2020 15:10:25 +0800 (CST) Received: from [127.0.0.1] (10.173.222.27) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.439.0; Tue, 14 Jan 2020 15:10:19 +0800 Subject: Re: [PATCH] KVM: arm/arm64: vgic-its: Check hopefully the last DISCARD command error To: Auger Eric , CC: , , , , References: <20191225133014.1825-1-yuzenghui@huawei.com> From: Zenghui Yu Message-ID: <41c88abb-433a-f87c-c858-7f2eb4c40926@huawei.com> Date: Tue, 14 Jan 2020 15:10:16 +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: Content-Type: text/plain; charset="windows-1252"; 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 2020/1/10 16:37, Auger Eric wrote: > Hi Zenghui, > > On 12/25/19 2:30 PM, Zenghui Yu wrote: >> DISCARD command error occurs if any of the following apply: >> >> - [ ... (those which we have already handled) ] > nit: I would remove the above and simply say the discard is supposed to > fail if the collection is not mapped to any target redistributor. If an > ITE exists then the ite->collection is non NULL. I think this is not always true. Let's talk about the following scenario (a bit insane, though): 1. First map a LPI to an unmapped Collection, then ite->collection is non NULL and its target_addr is COLLECTION_NOT_MAPPED. 2. Then issue MAPC and unMAPC(V=0) commands on this Collection, the ite->collection will be NULL, see vgic_its_free_collection(). Discard the LPI mapping after "1" or "2", we will both encounter the unmapped collection command error. > What needs to be checked is its_is_collection_mapped(). > > By the way update_affinity_collection() also tests ite->collection. I > think this is useless or do I miss something? Yeah, I agree. We managed to invoke update_affinity_collection(,, coll), ensure that the 'coll' can _not_ be NULL. So '!ite->collection' is already a subcase of 'coll != ite->collection'. We can safely get rid of it. > > Reviewed-by: Eric Auger > Thanks for that. I'll change the commit message with your suggestion and add your R-b in v2. Thanks, Zenghui