All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Kubiak <michal.kubiak@intel.com>
To: Jiawen Wu <jiawenwu@trustnetic.com>
Cc: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<pabeni@redhat.com>, <horms@kernel.org>, <andrew@lunn.ch>,
	<netdev@vger.kernel.org>, <przemyslaw.kitszel@intel.com>,
	<mengyuanlou@net-swift.com>, <duanqiangwen@net-swift.com>
Subject: Re: [PATCH net v3 2/4] net: txgbe: remove separate irq request for MSI and INTx
Date: Wed, 3 Jul 2024 15:33:24 +0200	[thread overview]
Message-ID: <ZoVTJIGmBMP4gCD3@localhost.localdomain> (raw)
In-Reply-To: <20240701071416.8468-3-jiawenwu@trustnetic.com>

On Mon, Jul 01, 2024 at 03:14:14PM +0800, Jiawen Wu wrote:
> When using MSI or INTx interrupts, request_irq() for pdev->irq will
> conflict with request_threaded_irq() for txgbe->misc.irq, to cause
> system crash. So remove txgbe_request_irq() for MSI/INTx case, and
> rename txgbe_request_msix_irqs() since it only request for queue irqs.
> 

Could you please provide any test scenario how the crash can be
reproduced and/or add an example crash log?
Also, could you describe how request_irq() conflicts with
request_threaded_irq() in this case?

> Add wx->misc_irq_domain to determine whether the driver creates an IRQ
> domain and threaded request the IRQs.
> 
> Fixes: aefd013624a1 ("net: txgbe: use irq_domain for interrupt controller")
> Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
> ---
>  drivers/net/ethernet/wangxun/libwx/wx_hw.c    |  1 +
>  drivers/net/ethernet/wangxun/libwx/wx_lib.c   |  5 +-
>  drivers/net/ethernet/wangxun/libwx/wx_type.h  |  1 +
>  .../net/ethernet/wangxun/txgbe/txgbe_irq.c    | 80 ++-----------------
>  .../net/ethernet/wangxun/txgbe/txgbe_irq.h    |  2 +-
>  .../net/ethernet/wangxun/txgbe/txgbe_main.c   |  2 +-
>  6 files changed, 15 insertions(+), 76 deletions(-)
> 
> diff --git a/drivers/net/ethernet/wangxun/libwx/wx_hw.c b/drivers/net/ethernet/wangxun/libwx/wx_hw.c
> index 7c4b6881a93f..d1b682ce9c6d 100644
> --- a/drivers/net/ethernet/wangxun/libwx/wx_hw.c
> +++ b/drivers/net/ethernet/wangxun/libwx/wx_hw.c
> @@ -1959,6 +1959,7 @@ int wx_sw_init(struct wx *wx)
>  	}
>  
>  	bitmap_zero(wx->state, WX_STATE_NBITS);
> +	wx->misc_irq_domain = false;
>  
>  	return 0;
>  }
> diff --git a/drivers/net/ethernet/wangxun/libwx/wx_lib.c b/drivers/net/ethernet/wangxun/libwx/wx_lib.c
> index f53776877f71..e1f514b21090 100644
> --- a/drivers/net/ethernet/wangxun/libwx/wx_lib.c
> +++ b/drivers/net/ethernet/wangxun/libwx/wx_lib.c
> @@ -1997,7 +1997,8 @@ void wx_free_irq(struct wx *wx)
>  	int vector;
>  
>  	if (!(pdev->msix_enabled)) {
> -		free_irq(pdev->irq, wx);
> +		if (!wx->misc_irq_domain)
> +			free_irq(pdev->irq, wx);

Does it mean "pdev->irq" will never be freed if you set misc_irq_domain
to "true"? It seems you set it to true always during the initializaion,
in "txgbe_setup_misc_irq()"?

>  		return;
>  	}
>  
> @@ -2012,7 +2013,7 @@ void wx_free_irq(struct wx *wx)
>  		free_irq(entry->vector, q_vector);
>  	}
>  
> -	if (wx->mac.type == wx_mac_em)
> +	if (!wx->misc_irq_domain)
>  		free_irq(wx->msix_entry->vector, wx);
>  }
>  EXPORT_SYMBOL(wx_free_irq);
> diff --git a/drivers/net/ethernet/wangxun/libwx/wx_type.h b/drivers/net/ethernet/wangxun/libwx/wx_type.h
> index 5aaf7b1fa2db..0df7f5712b6f 100644
> --- a/drivers/net/ethernet/wangxun/libwx/wx_type.h
> +++ b/drivers/net/ethernet/wangxun/libwx/wx_type.h
> @@ -1058,6 +1058,7 @@ struct wx {
>  	dma_addr_t isb_dma;
>  	u32 *isb_mem;
>  	u32 isb_tag[WX_ISB_MAX];
> +	bool misc_irq_domain;

I don't think that introducing a kind of global variable to determine the call
context is a good idea.
Also, it seems that member is always true after the "probe" context is
completed, isn't it?

> 

[...]

> @@ -256,6 +190,8 @@ int txgbe_setup_misc_irq(struct txgbe *txgbe)
>  	if (err)
>  		goto free_gpio_irq;
>  
> +	wx->misc_irq_domain = true;
> +
>  	return 0;
> 

Is there any chance that member will be set back to "false" after the
initialization is completed?


Thanks,
Michal

  reply	other threads:[~2024-07-03 13:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-01  7:14 [PATCH net v3 0/4] net: txgbe: fix MSI and INTx interrupts Jiawen Wu
2024-07-01  7:14 ` [PATCH net v3 1/4] net: txgbe: initialize num_q_vectors for MSI/INTx interrupts Jiawen Wu
2024-07-02 15:21   ` Michal Kubiak
2024-07-03  1:45     ` Jiawen Wu
2024-07-01  7:14 ` [PATCH net v3 2/4] net: txgbe: remove separate irq request for MSI and INTx Jiawen Wu
2024-07-03 13:33   ` Michal Kubiak [this message]
2024-07-03 14:53     ` Michal Kubiak
2024-07-01  7:14 ` [PATCH net v3 3/4] net: txgbe: add extra handle for MSI/INTx into thread irq handle Jiawen Wu
2024-07-01  7:14 ` [PATCH net v3 4/4] net: txgbe: free isb resources at the right time Jiawen Wu
2024-07-02 14:10 ` [PATCH net v3 0/4] net: txgbe: fix MSI and INTx interrupts patchwork-bot+netdevbpf

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=ZoVTJIGmBMP4gCD3@localhost.localdomain \
    --to=michal.kubiak@intel.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=duanqiangwen@net-swift.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jiawenwu@trustnetic.com \
    --cc=kuba@kernel.org \
    --cc=mengyuanlou@net-swift.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.