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.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,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 1CECAC433E0 for ; Wed, 15 Jul 2020 09:42:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E6B0A2064B for ; Wed, 15 Jul 2020 09:42:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="KmSi0GUn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730707AbgGOJmv (ORCPT ); Wed, 15 Jul 2020 05:42:51 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:58089 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730338AbgGOJmu (ORCPT ); Wed, 15 Jul 2020 05:42:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594806169; 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=QVN0SUJiWNQOMGmLO1R6WOiZV8nRybRORnIp3pu3RNw=; b=KmSi0GUntHAji6qNUhz25b1hNpkBd9R6wd1Cbj2P0dDybv5EVcfQn+5YVVjHEfGB5KfUD7 qnsRf9A0114NW70+WqCNbRIs2ahVg1CqU0c4QoJ2nzkQh8Ba6sUgL00JxDTX3duECO3rJD LEi11yfGUay3ml6UcIyBWOefp5OUHaI= 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-368-JARX-4MgPmqeCi7a5jNSaA-1; Wed, 15 Jul 2020 05:42:44 -0400 X-MC-Unique: JARX-4MgPmqeCi7a5jNSaA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AE7201800D42; Wed, 15 Jul 2020 09:42:42 +0000 (UTC) Received: from [10.72.13.230] (ovpn-13-230.pek2.redhat.com [10.72.13.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3395310013D0; Wed, 15 Jul 2020 09:42:34 +0000 (UTC) Subject: Re: [PATCH 3/7] vhost_vdpa: implement IRQ offloading functions in vhost_vdpa To: "Zhu, Lingshan" , 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 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> From: Jason Wang Message-ID: Date: Wed, 15 Jul 2020 17:42:33 +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: <61c1753a-43dc-e448-6ece-13a19058e621@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 > > Thanks, > BR > Zhu Lingshan