DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: <dev@dpdk.org>, Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Subject: Re: [RFC 6/6] intel/iavf: remove use of pthread_cancel
Date: Thu, 25 Sep 2025 16:11:53 +0100	[thread overview]
Message-ID: <aNVbuWzpak_gG5kP@bricha3-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <20250924165527.268645-7-stephen@networkplumber.org>

On Wed, Sep 24, 2025 at 09:51:13AM -0700, Stephen Hemminger wrote:
> The iavf driver uses a pipe to communicate with control thread.
> By closing the write side of the pipe, the main thread can
> tell the control thread to exit without use of pthread_cancel.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

>  drivers/net/intel/iavf/iavf_vchnl.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/intel/iavf/iavf_vchnl.c b/drivers/net/intel/iavf/iavf_vchnl.c
> index b1b7a5bf94..781bae11be 100644
> --- a/drivers/net/intel/iavf/iavf_vchnl.c
> +++ b/drivers/net/intel/iavf/iavf_vchnl.c
> @@ -161,14 +161,14 @@ iavf_dev_event_handler_fini(void)
>  	if (rte_atomic_fetch_sub_explicit(&handler->ndev, 1, rte_memory_order_relaxed) - 1 != 0)
>  		return;
>  
> -	int unused = pthread_cancel((pthread_t)handler->tid.opaque_id);
> -	RTE_SET_USED(unused);
> -	close(handler->fd[0]);
> +	/* closing the write side of the pipe will cause read() to return 0 in thread */
>  	close(handler->fd[1]);
> -	handler->fd[0] = -1;
>  	handler->fd[1] = -1;
>  
>  	rte_thread_join(handler->tid, NULL);
> +	close(handler->fd[0]);
> +	handler->fd[0] = -1;
> +
>  	pthread_mutex_destroy(&handler->lock);
>  
>  	struct iavf_event_element *pos, *save_next;
> -- 
> 2.47.3
> 

      reply	other threads:[~2025-09-25 15:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-24 16:51 [RFC 0/6] get rid " Stephen Hemminger
2025-09-24 16:51 ` [RFC 1/6] eal: avoid using pthread_cancel Stephen Hemminger
2025-09-24 16:51 ` [RFC 2/6] eventdev: avoid use of pthread_cancel Stephen Hemminger
2025-09-24 16:51 ` [RFC 3/6] raw/ifpga: " Stephen Hemminger
2025-09-24 16:51 ` [RFC 4/6] dma/skeleton: " Stephen Hemminger
2025-09-25  1:20   ` fengchengwen
2025-09-24 16:51 ` [RFC 5/6] intel/ipn3ke: " Stephen Hemminger
2025-09-24 16:51 ` [RFC 6/6] intel/iavf: remove " Stephen Hemminger
2025-09-25 15:11   ` Bruce Richardson [this message]

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=aNVbuWzpak_gG5kP@bricha3-mobl1.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    --cc=vladimir.medvedkin@intel.com \
    /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).