From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34B41C433DF for ; Thu, 30 Jul 2020 14:20:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1B54A20838 for ; Thu, 30 Jul 2020 14:20:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729075AbgG3OUS (ORCPT ); Thu, 30 Jul 2020 10:20:18 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:8861 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726772AbgG3OUR (ORCPT ); Thu, 30 Jul 2020 10:20:17 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 45E8DC7AD72D78B946C1; Thu, 30 Jul 2020 22:19:58 +0800 (CST) Received: from [127.0.0.1] (10.174.186.173) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.487.0; Thu, 30 Jul 2020 22:19:49 +0800 From: Zhenyu Ye Subject: [Question] the check of ioeventfd collision in kvm_*assign_ioeventfd_idx To: , , , , , , , Xiexiangyou , Message-ID: Date: Thu, 30 Jul 2020 22:19:49 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset="gbk" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.186.173] X-CFilter-Loop: Reflected Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Hi all, There are checks of ioeventfd collision in both kvm_assign_ioeventfd_idx() and kvm_deassign_ioeventfd_idx(), however, with different logic. In kvm_assign_ioeventfd_idx(), this is done by ioeventfd_check_collision(): ---8<--- if (_p->bus_idx == p->bus_idx && _p->addr == p->addr && (!_p->length || !p->length || (_p->length == p->length && (_p->wildcard || p->wildcard || _p->datamatch == p->datamatch)))) // then we consider the two are the same ---8<--- The logic in kvm_deassign_ioeventfd_idx() is as follows: ---8<--- if (p->bus_idx != bus_idx || p->eventfd != eventfd || p->addr != args->addr || p->length != args->len || p->wildcard != wildcard) continue; if (!p->wildcard && p->datamatch != args->datamatch) continue; // then we consider the two are the same ---8<--- As we can see, there is extra check of p->eventfd in (). Why we don't check p->eventfd in kvm_assign_ioeventfd_idx()? Or should we delete this in kvm_deassign_ioeventfd_idx()? Thanks, Zhenyu