Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp417528ybl; Fri, 10 Jan 2020 00:39:53 -0800 (PST) X-Google-Smtp-Source: APXvYqxmPUACHFeHRa+By76g7pgBZDBaOdRgdyCyXGNNu1Krqhbr0W5tZ36zce6x0g5amRUMB1HV X-Received: by 2002:aca:a9c5:: with SMTP id s188mr1384731oie.154.1578645593471; Fri, 10 Jan 2020 00:39:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578645593; cv=none; d=google.com; s=arc-20160816; b=Et6LI9CiEfPUq9/K2xr/pWBGYYM4AhRvj0yQ5N833Iw0XuM3ZTmhqh3lK1tdeMnjyi iLbY9doF+c0Wm1aUX3GSUZ8YNekbvfzHz3bb9+/W7zOBBEcOnJ734Iby0fw2WeoCjISU YUr2NUBtzo+bJzDx9fGcO/SekkcTkDt1nHVqFhrNrOAAwdWm+adg8QPna8HHTQn/kmfd gCUB1exXE1CuGKxwB0ddu4CMDb3KCNPjzWjB1QldirVBhul2gnNvs0zIlFhDxWrYbNbT NUPl+ER2osE9aJtntOuBOulA346ATOBo2MgidTDpQQHKEu9pn4miOA/vkEfPRlmSnMop uNNw== 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:dkim-signature; bh=SEGdNnuJMmxq2nRffYFL3avciJRwxghn7a6DuxkSNjc=; b=Razj03MS+tZFUqlRV3DQFxYWu4QjVuHg8iCL1nwbNKUZggCMEeY6YYPtcGugHP8+4f NNsUCYWc2WMkD7d13oMgE2b+41VGHHtgL1jmRQKfP9GjgA0tcPAi/NaSOmEnetJ4SUQZ mpFCFHhMDT6O7mWSgMTBQ25jcZbMSfl8IMEhnampJslINamDliEl9bO6VeqmlL6T7GMd CXdZlHuOpm70CrZ+Y1vfW5br199+wJ0GFpj14byryEGlwsa9iQuxdbFsFFCRgfNKfIsa rrV/Lv8oznQa5nT3R+09JBuTteJ3VT7EuAGoHWQIvSdnv2W+wX7Cn4pCVmN/42dc4hVw cdxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SsdeZHku; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m26si726358otn.307.2020.01.10.00.39.41; Fri, 10 Jan 2020 00:39:53 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SsdeZHku; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727135AbgAJIh2 (ORCPT + 99 others); Fri, 10 Jan 2020 03:37:28 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:29286 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726927AbgAJIh2 (ORCPT ); Fri, 10 Jan 2020 03:37:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578645446; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SEGdNnuJMmxq2nRffYFL3avciJRwxghn7a6DuxkSNjc=; b=SsdeZHkuH/WTZ+iwBibfIeCvJtl9owD4Jr+KBqHPRSI9YlW4oJvBBVXp8/+1Xh4ln1pmm5 4rdK9P+9JfUXot00iTslu6N+cAHZ+ClozkDSbFxc0DlY9DA2kq61zrWmamyZO/yCE89h+2 gqQ9m214X2lSGRkI4HbMnRQ9fBRmLH4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-350-1Hhibq09NKSGSuiB0AkAYg-1; Fri, 10 Jan 2020 03:37:23 -0500 X-MC-Unique: 1Hhibq09NKSGSuiB0AkAYg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 89BF01800D6B; Fri, 10 Jan 2020 08:37:21 +0000 (UTC) Received: from [10.36.117.108] (ovpn-117-108.ams2.redhat.com [10.36.117.108]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AA64560FA2; Fri, 10 Jan 2020 08:37:19 +0000 (UTC) Subject: Re: [PATCH] KVM: arm/arm64: vgic-its: Check hopefully the last DISCARD command error To: Zenghui Yu , maz@kernel.org Cc: andre.przywara@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, wanghaibin.wang@huawei.com References: <20191225133014.1825-1-yuzenghui@huawei.com> From: Auger Eric Message-ID: Date: Fri, 10 Jan 2020 09:37:17 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20191225133014.1825-1-yuzenghui@huawei.com> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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? Reviewed-by: Eric Auger Thanks Eric > - The EventID for the device is mapped to a collection that > has not been mapped to an RDbase using MAPC. > > Let's take the unmapped collection case into account and report > a DISCARD command error if it really happens. > > Signed-off-by: Zenghui Yu > --- > virt/kvm/arm/vgic/vgic-its.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c > index 17920d1b350a..d53d34a33e35 100644 > --- a/virt/kvm/arm/vgic/vgic-its.c > +++ b/virt/kvm/arm/vgic/vgic-its.c > @@ -839,9 +839,8 @@ static int vgic_its_cmd_handle_discard(struct kvm *kvm, struct vgic_its *its, > u32 event_id = its_cmd_get_id(its_cmd); > struct its_ite *ite; > > - > ite = find_ite(its, device_id, event_id); > - if (ite && ite->collection) { > + if (ite && its_is_collection_mapped(ite->collection)) { > /* > * Though the spec talks about removing the pending state, we > * don't bother here since we clear the ITTE anyway and the >