From: "Zhu, Lingshan" Subject: Re: [PATCH 3/7] vhost_vdpa: implement IRQ offloading functions in vhost_vdpa Date: Wed, 15 Jul 2020 19:09:41 +0800 Message-ID: <35b0ed89-588a-81e1-2dac-b98629d4398c@intel.com> References: <1594565366-3195-1-git-send-email-lingshan.zhu@intel.com> <1594565366-3195-3-git-send-email-lingshan.zhu@intel.com> <3fb9ecfc-a325-69b5-f5b7-476a5683a324@redhat.com> <8f52ee3a-7a08-db14-9194-8085432481a4@intel.com> <2bd946e3-1524-efa5-df2b-3f6da66d2069@redhat.com> <61c1753a-43dc-e448-6ece-13a19058e621@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Return-path: In-Reply-To: Content-Language: en-US Sender: netdev-owner@vger.kernel.org To: Jason Wang , mst@redhat.com, alex.williamson@redhat.com, pbonzini@redhat.com, sean.j.christopherson@intel.com, wanpengli@tencent.com Cc: virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, netdev@vger.kernel.org, dan.daly@intel.com List-Id: virtualization@lists.linuxfoundation.org On 7/15/2020 5:42 PM, Jason Wang wrote: > > On 2020/7/15 下午5:20, Zhu, Lingshan wrote: >>>>> >>>>> I meant something like: >>>>> >>>>> unregister(); >>>>> vq->call_ctx.producer.token = ctx; >>>>> register(); >>>> This is what we are doing now, or I must missed somethig: >>>> if (ctx && ctx != token) { >>>>     irq_bypass_unregister_producer(&vq->call_ctx.producer); >>>>     vq->call_ctx.producer.token = ctx; >>>>     irq_bypass_register_producer(&vq->call_ctx.producer); >>>> >>>> } >>>> >>>> It just unregister and register. >>> >>> >>> I meant there's probably no need for the check and another check and >>> unregister before. The whole function is as simple as I suggested >>> above. >>> >>> Thanks >> IMHO we still need the checks, this function handles three cases: >> (1)if the ctx == token, we do nothing. For this unregister and >> register can work, but waste of time. > > > But we have a more simple code and we don't care about the performance > here since the operations is rare. > > >> (2)if token exists but ctx is NULL, this means user space issued an >> unbind, so we need to only unregister the producer. > > > Note that the register/unregister have a graceful check of whether or > not there's a token. > > >> (3)if ctx exists and ctx!=token, this means there is a new ctx, we >> need to update producer by unregister and register. >> >> I think we can not simply handle all these cases by "unregister and >> register". > > > So it looks to me the functions are equivalent. > > Thanks Sounds reasonable, thanks! > > >> >> Thanks, >> BR >> Zhu Lingshan >