Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3872238pxu; Tue, 20 Oct 2020 02:44:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyw9iQy+PwPUgNN59Nx39dNELhy7RqIMXmS+x/EzWftfaIMgfb/GknK0CtjRnI1pL1WnX7N X-Received: by 2002:a17:906:3e17:: with SMTP id k23mr2354491eji.414.1603187062702; Tue, 20 Oct 2020 02:44:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603187062; cv=none; d=google.com; s=arc-20160816; b=ISE5Gm7woOQn6B0ENpOQoEwHmb3XRmcfjRGr/eSLANvPLKvabfBOIG1LYiU1MPPROX yJXtSFhIAMeTY12B+Iqckgdq3/qIWjIWyRXWHLW5ADF/WuCtU+KeKIUHiUR+Bt64pK1w 2I21Rt/0R4byyiORzZKjyYkJwP+reNRLbeQ7d3NOmgASri2ReP4pYiLmsDtoz6ysXMkp e8n08il1U+hSbI2DlKu3r1TP0celfx9wQNeqPSjGnFt7wpmXnvkTDW4npgW9tuCmB7mo nGcJkOiHRFzWNgw/6jPPlF2cwEYQrlL7YH0EPJSrtmA6vVr4fJwCblfDx48nq8LMR3wz +zxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=kUV7+7Yb5gWkt6R5BK6/Nubk0EIUzqlyn1lORobljU8=; b=MidxyUBn5Q+YxoEB5biaeloh2yAdRHzmDTz2AWHoNA84YVz42SlZYhO55XFx8UQRPu xyWV6g/OMByICJWdsRkPajMdjazFwl+6bKg8cK4EYB907adV4JPqSNnYBnC9PBoTKfWP PRFB8ZVbqXVBqB+usIW8OvkvP+fZ/lnwZ5Ld75rDShOY0BnpZmD1TjJG4C/aCiXjc+J2 AwMETRA3miyMi6TmfnrCsfQ1ePWcEqaCV7VOq65MAfkUAWxDtMt4oc2wtJzF+IbbbO4K /cu0o9gIShc3zaLQOC9cKdJ9qR1AiLTkCn9GNbl0JWuLlEs+uDbYC2JDJVua/NTP9fYB Gr2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="ho/N65rG"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id c6si850180ejr.584.2020.10.20.02.44.01; Tue, 20 Oct 2020 02:44:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="ho/N65rG"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2404306AbgJTGc1 (ORCPT + 99 others); Tue, 20 Oct 2020 02:32:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:32479 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730619AbgJTGc1 (ORCPT ); Tue, 20 Oct 2020 02:32:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603175545; 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=kUV7+7Yb5gWkt6R5BK6/Nubk0EIUzqlyn1lORobljU8=; b=ho/N65rGP7qEo1ynqxhUa2/H0XMAf4wx8zUWOL6dsoZoJgdEjniud3URX0CBSGyt6QPMMD X/HS/bnV+iE4sXzmF7IDzAz4hrNmx93mAWwjrRYWfzKO7OsMVz/PnubccHJqCxpTdfh+eW 1YBgc62wwzGQdzqS51E3F2ffHsOvC48= 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-123-TllFas1gNjWKqFl0xh-Dfg-1; Tue, 20 Oct 2020 02:32:24 -0400 X-MC-Unique: TllFas1gNjWKqFl0xh-Dfg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E71A01006C8C; Tue, 20 Oct 2020 06:32:21 +0000 (UTC) Received: from [10.72.13.171] (ovpn-13-171.pek2.redhat.com [10.72.13.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id E70976EF59; Tue, 20 Oct 2020 06:32:13 +0000 (UTC) Subject: Re: [PATCH 2/2] KVM: not link irqfd with a fake IRQ bypass producer To: Zhenzhong Duan , linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, kvm@vger.kernel.org Cc: netdev@vger.kernel.org, pbonzini@redhat.com, sean.j.christopherson@intel.com, vkuznets@redhat.com, wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, mst@redhat.com References: <20201019090657.131-1-zhenzhong.duan@gmail.com> <20201019090657.131-2-zhenzhong.duan@gmail.com> From: Jason Wang Message-ID: <7eec99d5-e36b-ee5b-5b6c-1486e453a083@redhat.com> Date: Tue, 20 Oct 2020 14:32:12 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201019090657.131-2-zhenzhong.duan@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/10/19 下午5:06, Zhenzhong Duan wrote: > In case failure to setup Post interrupt for an IRQ, it make no sense > to assign irqfd->producer to the producer. > > This change makes code more robust. It's better to describe what issue we will get without this patch. Thanks > > Signed-off-by: Zhenzhong Duan > --- > arch/x86/kvm/x86.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index ce856e0..277e961 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -10683,13 +10683,14 @@ int kvm_arch_irq_bypass_add_producer(struct irq_bypass_consumer *cons, > container_of(cons, struct kvm_kernel_irqfd, consumer); > int ret; > > - irqfd->producer = prod; > kvm_arch_start_assignment(irqfd->kvm); > ret = kvm_x86_ops.update_pi_irte(irqfd->kvm, > prod->irq, irqfd->gsi, 1); > > if (ret) > kvm_arch_end_assignment(irqfd->kvm); > + else > + irqfd->producer = prod; > > return ret; > }