From: Jerin Jacob <jerinjacobk@gmail.com>
To: Nithin Dabilpuram <ndabilpuram@marvell.com>,
Thomas Monjalon <thomas@monjalon.net>
Cc: Jerin Jacob <jerinj@marvell.com>, dpdk-dev <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] common/octeontx2: retry intr callback unregister
Date: Fri, 26 Jun 2020 20:46:14 +0530 [thread overview]
Message-ID: <CALBAE1MBw7nW1+8uHY-CW_TZHPkrqJg_UuGH-Fox-2Oa_2y6Gg@mail.gmail.com> (raw)
In-Reply-To: <20200611072605.472-1-ndabilpuram@marvell.com>
On Thu, Jun 11, 2020 at 1:06 PM Nithin Dabilpuram
<ndabilpuram@marvell.com> wrote:
>
> Interrupt callback unregister can fail with -EAGAIN
> when interrupt handler is active in interrupt thread.
> Hence retry before reporting a failure or proceeding further.
>
> Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
Delegating to Thomas as it belongs to common/octeontx2.
> ---
> drivers/common/octeontx2/otx2_irq.c | 19 +++++++++++++++++--
> 1 file changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/common/octeontx2/otx2_irq.c b/drivers/common/octeontx2/otx2_irq.c
> index fa3206a..c0137ff 100644
> --- a/drivers/common/octeontx2/otx2_irq.c
> +++ b/drivers/common/octeontx2/otx2_irq.c
> @@ -193,6 +193,8 @@ otx2_unregister_irq(struct rte_intr_handle *intr_handle,
> rte_intr_callback_fn cb, void *data, unsigned int vec)
> {
> struct rte_intr_handle tmp_handle;
> + uint8_t retries = 5; /* 5 ms */
> + int rc;
>
> if (vec > intr_handle->max_intr) {
> otx2_err("Error unregistering MSI-X interrupts vec:%d > %d",
> @@ -205,8 +207,21 @@ otx2_unregister_irq(struct rte_intr_handle *intr_handle,
> if (tmp_handle.fd == -1)
> return;
>
> - /* Un-register callback func from eal lib */
> - rte_intr_callback_unregister(&tmp_handle, cb, data);
> + do {
> + /* Un-register callback func from eal lib */
> + rc = rte_intr_callback_unregister(&tmp_handle, cb, data);
> + /* Retry only if -EAGAIN */
> + if (rc != -EAGAIN)
> + break;
> + rte_delay_ms(1);
> + retries--;
> + } while (retries);
> +
> + if (rc < 0) {
> + otx2_err("Error unregistering MSI-X intr vec %d cb, rc=%d",
> + vec, rc);
> + return;
> + }
>
> otx2_base_dbg("Disable vector:0x%x for vfio (efds: %d, max:%d)",
> vec, intr_handle->nb_efd, intr_handle->max_intr);
> --
> 2.8.4
>
next prev parent reply other threads:[~2020-06-26 15:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-11 7:26 Nithin Dabilpuram
2020-06-26 15:16 ` Jerin Jacob [this message]
2020-07-08 11:38 ` Jerin Jacob
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CALBAE1MBw7nW1+8uHY-CW_TZHPkrqJg_UuGH-Fox-2Oa_2y6Gg@mail.gmail.com \
--to=jerinjacobk@gmail.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=ndabilpuram@marvell.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).