From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1A291A0471 for ; Thu, 18 Jul 2019 12:22:26 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A3E7A1DBF; Thu, 18 Jul 2019 12:22:25 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 2E88A2AB for ; Thu, 18 Jul 2019 12:22:24 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jul 2019 03:22:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,278,1559545200"; d="scan'208";a="158744116" Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.251.81.9]) ([10.251.81.9]) by orsmga007.jf.intel.com with ESMTP; 18 Jul 2019 03:22:20 -0700 To: "Hyong Youb Kim (hyonkim)" , Nithin Kumar Dabilpuram Cc: David Marchand , Thomas Monjalon , Ferruh Yigit , Bruce Richardson , Jerin Jacob Kollanukkaran , "John Daley (johndale)" , Shahed Shaikh , "dev@dpdk.org" References: <20190717115852.171416-1-ndabilpuram@marvell.com> <20190717124354.142668-1-ndabilpuram@marvell.com> <20190717124354.142668-3-ndabilpuram@marvell.com> <20190717143513.GA5114@outlook.office365.com> From: "Burakov, Anatoly" Message-ID: Date: Thu, 18 Jul 2019 11:22:20 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [EXT] Re: [PATCH v2 2/3] eal: add ack interrupt API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 17-Jul-19 4:05 PM, Hyong Youb Kim (hyonkim) wrote: >> -----Original Message----- >> From: Nithin Kumar Dabilpuram >> Sent: Wednesday, July 17, 2019 11:36 PM > [...] >>>> Subject: [PATCH v2 2/3] eal: add ack interrupt API >>>> >>>> Add new ack interrupt API to avoid using >>>> VFIO_IRQ_SET_ACTION_TRIGGER(rte_intr_enable()) for >>>> acking interrupt purpose for VFIO based interrupt handlers. >>>> This implementation is specific to Linux. >>>> >>>> Using rte_intr_enable() for acking interrupt has below issues >>>> >>>> * Time consuming to do for every interrupt received as it will >>>> free_irq() followed by request_irq() and all other initializations >>>> * A race condition because of a window between free_irq() and >>>> request_irq() with packet reception still on and device still >>>> enabled and would throw warning messages like below. >>>> [158764.159833] do_IRQ: 9.34 No irq handler for vector >>>> >>>> In this patch, rte_intr_ack() is a no-op for VFIO_MSIX/VFIO_MSI >> interrupts >>>> as they are edge triggered and kernel would not mask the interrupt >> before >>>> delivering the event to userspace and we don't need to ack. >>>> >>>> Signed-off-by: Nithin Dabilpuram >>>> Signed-off-by: Jerin Jacob >>>> --- >>>> v2: >>>> * No change >>>> >>>> lib/librte_eal/common/include/rte_interrupts.h | 22 +++++++ >>>> lib/librte_eal/freebsd/eal/eal_interrupts.c | 9 +++ >>>> lib/librte_eal/linux/eal/eal_interrupts.c | 81 >>>> ++++++++++++++++++++++++++ >>>> lib/librte_eal/rte_eal_version.map | 1 + >>>> 4 files changed, 113 insertions(+) >>>> >>>> diff --git a/lib/librte_eal/common/include/rte_interrupts.h >>>> b/lib/librte_eal/common/include/rte_interrupts.h >>>> index c1e912c..93b31cd 100644 >>>> --- a/lib/librte_eal/common/include/rte_interrupts.h >>>> +++ b/lib/librte_eal/common/include/rte_interrupts.h >>>> @@ -118,6 +118,28 @@ int rte_intr_enable(const struct rte_intr_handle >>>> *intr_handle); >>>> */ >>>> int rte_intr_disable(const struct rte_intr_handle *intr_handle); >>>> >>>> +/** >>>> + * It acks an interrupt raised for the specified handle. >>>> + * >>>> + * Call this function to ack an interrupt from interrupt >>>> + * handler either from application or driver, so that >>>> + * new interrupts are raised. >>>> + * >>>> + * @note For interrupt handle types VFIO_MSIX and VFIO_MSI, >>>> + * this function is a no-op and returns success without >>>> + * changing anything as kernel doesn't expect >>>> + * them to be acked. >>>> + * >>> [...] >>> >>> Shouldn't we explain that this really is "unmask" but named "ack" because >>> of x and y, and that it is expected at end of INTx handler? Ack does >>> not have a well-defined meaning, whereas everyone knows what unmask >>> means.. >>> >> >> >> Ok. Is the below text fine with you ? Or please suggest. >> >> @note For interrupt handle types VFIO_MSIX and VFIO_MSI, >> this function is a no-op and returns success without >> changing anything as kernel doesn't expect >> them to be acked. >> This needs be used atleast for PCI devices with INTx interrupt >> as kernel before passing on event for INTx triggered interrupt, >> masks the interrupt and expects application to unmask it so that, >> further interrupts can be raised/triggered. This is also due to >> the fact that INTx is level triggered interrupt where as MSI/MSIx >> is not. Ideally this should have been called as intr_unmask() >> representing underlying api, but since unmask operation >> is not supported and not needed for VFIO MSI/MSIx interrupts >> after handling, it is named as ack. >> > > How about this? > > PMD generally calls this function at the end of its IRQ callback. > Internally, it unmasks the interrupt if possible. For INTx, unmasking > is required as the interrupt is auto-masked prior to invoking > callback. For MSI/MSI-X, unmasking is typically not needed as the > interrupt is not auto-masked. In fact, for interrupt handle types > VFIO_MSIX and VFIO_MSI, this function is no-op. > Does the user of this API even cares about these details? I would think that it would be eaiser to just mandate calling this function at the end of each interrupt callback period, regardless of which interrupt mode is used. Internal details are better explained in the implementation. > Thanks for your effort.. > -Hyong > > -- Thanks, Anatoly