Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4805815ybg; Tue, 29 Oct 2019 12:39:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqxwUrJAA6jas2nTUDHAK89D/90R+4YrBA8FAMhZmez7Gi7FYclj3jBy8Iara9TCEzzX5ht5 X-Received: by 2002:a17:906:615:: with SMTP id s21mr5169919ejb.276.1572377995686; Tue, 29 Oct 2019 12:39:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572377995; cv=none; d=google.com; s=arc-20160816; b=VWF8M+iIDQFoZOEypfAodI0W9kAv1Hj9HmD03VMbi5F2trxfL4iqcjkUhuY0bBsTcI jlHxxLVkYEm6ZT8fosKI/NCI3Mq3iwy4wlnzSMBTTwxpw6D0JDMtch2cWTPrrXX5/9s5 ujlmPPUjoINQSLyM2iH8bE0hrgz4WadLE4WZbkTySDWMCHg8S+tNH+O+oIeRH+1Qxj+k 7ELOMmAONou4VH63lUC0+ZkqFIyrtQQFDFFQx48JRfxD7d9ATCFJHYDHo3z0Ymf6E/YX HsvhOstv/V4jcq2cKimXm4dFdUyNrgMbwupP1SreeTVWT77QNPjeZ4n7JUnfi0EJODgi g0DA== 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=UunobBWlwD9ibnb0HkId/xYN0SXF7OaYKp3doUOR5Ps=; b=FuTZVU5xkQa8ouaBbVCAeklMCFVn00y23QL3KfTdSAKOMyRRGkOGgVDejm5QUR8ews 7GugJ22PnLbNtqPOAPPvjs7nL3LAo0WEg+K2kkfTzg6sYrUKM1yyLOx65dQwaxf19ybo N7wNqdt5gV08frlwZ2iY3lE9FcNQrB/ShVbC1dtqpioHTDBVA9rweuUalc9elOza/MYE mFR+PIqQpIuaC1AuFs7ErHihDxO4zy9/EUSeVaIjgy4vMZfM4VLjz9lQEb9Byr5hGqQV MN1YCAoV6mQWYN3nibLgJO66qehEse592h9Z8pB4ue6CW0TMcrbLdo7fx1a/Jes+4RLE ALAg== 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 l25si5556775ejc.160.2019.10.29.12.39.32; Tue, 29 Oct 2019 12:39:55 -0700 (PDT) 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 S2388610AbfJ2Nbc (ORCPT + 99 others); Tue, 29 Oct 2019 09:31:32 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:5219 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388602AbfJ2Nbc (ORCPT ); Tue, 29 Oct 2019 09:31:32 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id B145089EF28F21D4DC20; Tue, 29 Oct 2019 21:31:27 +0800 (CST) Received: from [127.0.0.1] (10.173.222.27) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.439.0; Tue, 29 Oct 2019 21:31:19 +0800 Subject: Re: [PATCH 3/3] KVM: arm/arm64: vgic: Don't rely on the wrong pending table To: Auger Eric , Marc Zyngier CC: , , , , , , References: <20191029071919.177-1-yuzenghui@huawei.com> <20191029071919.177-4-yuzenghui@huawei.com> <86mudjykfa.wl-maz@kernel.org> From: Zenghui Yu Message-ID: <01638947-ce47-2e09-68f0-a95eb6e9b2d0@huawei.com> Date: Tue, 29 Oct 2019 21:31:18 +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="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit 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/10/29 20:49, Auger Eric wrote: > On 10/29/19 1:27 PM, Zenghui Yu wrote: >> okay, the remaining question is that in vgic_v3_save_pending_tables(): >> >>     stored = val & (1U << bit_nr); >>     if (stored == irq->pending_latch) >>         continue; >> >>     if (irq->pending_latch) >>         val |= 1 << bit_nr; >>     else >>         val &= ~(1 << bit_nr); >> >> Do we really have a scenario where irq->pending_latch==false and >> stored==true (corresponds to the above "else") and then we clear >> pending status of this LPI in guest memory? >> I can not think out one now. > > if you save, restore and save again. On the 1st save the LPI may be > pending, it gets stored. On the second save the LPI may be not pending > anymore? I assume you mean the "restore" by vgic_its_restore_ite(). While restoring a LPI, we will sync the pending status from guest pending table (into the software pending_latch), and clear the corresponding bit in guest memory. See vgic_v3_lpi_sync_pending_status(). So on the second save, the LPI can be not pending, the guest pending table will also indicate not pending. Thanks, Zenghui