Netdev List
 help / color / mirror / Atom feed
From: Javen <javen_xu@realsil.com.cn>
To: "netdev-bot+sashiko@kernel.org" <netdev-bot+sashiko@kernel.org>
Cc: "hkallweit1@gmail.com" <hkallweit1@gmail.com>,
	"nic_swsd@realtek.com" <nic_swsd@realtek.com>,
	"andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"edumazet@google.com" <edumazet@google.com>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"horms@kernel.org" <horms@kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [net-next,v12,1/7] r8169: add support for multi irqs
Date: Fri, 4 Sep 2026 02:46:44 +0000	[thread overview]
Message-ID: <50122c7ae7704e6485684b2d2bac92e0@realsil.com.cn> (raw)
In-Reply-To: <178846812155.3394541.6579774818900952909@kernel.org>

>
>> +static int rtl8169_request_irq(struct rtl8169_private *tp) {
>> +     struct net_device *dev = tp->dev;
>> +     struct napi_struct *napi;
>> +     int i, rc;
>> +
>> +     for (i = 0; i < tp->irq_nvecs; i++) {
>> +             napi = &tp->rtl8169_napi[i];
>> +             rc = pci_request_irq(tp->pci_dev, i, rtl8169_interrupt,
>> +                                  NULL, napi, "%s-%d", dev->name, i);
>> +             if (rc)
>> +                     goto free_irq;
>> +     }
>> +     return 0;
>
>[ ... ]
>
>> @@ -5107,8 +5162,7 @@ static int rtl_open(struct net_device *dev)
>>
>>       rtl_request_firmware(tp);
>>
>> -     irqflags = pci_dev_msi_enabled(pdev) ? IRQF_NO_THREAD :
>IRQF_SHARED;
>> -     retval = request_irq(tp->irq, rtl8169_interrupt, irqflags, dev->name, tp);
>> +     retval = rtl8169_request_irq(tp);
>>       if (retval < 0)
>>               goto err_release_fw_2;
>
>[Severity: Medium]
>Does this drop the IRQF_NO_THREAD that commit 870f531e178e ("r8169: set
>IRQF_NO_THREAD if MSI(X) is enabled") added?
>
>pci_request_irq() hardcodes the flags and has no way to express
>IRQF_NO_THREAD:
>
>drivers/pci/irq.c:pci_request_irq() {
>        unsigned long irqflags = IRQF_SHARED;
>
>        if (!handler)
>                irqflags |= IRQF_ONESHOT;
>        ...
>        ret = request_threaded_irq(pci_irq_vector(dev, nr), handler, thread_fn,
>                                   irqflags, devname, dev_id); }
>
>With handler != NULL the flags are exactly IRQF_SHARED, so on a kernel
>booted with threadirqs, or with CONFIG_PREEMPT_RT, __setup_irq() reaches:

Hi Heiner,

In previous revisions, I was suggested to use the new api pci_request_irq(). However, since it hardcodes IRQF_SHARED and does not accept custom flags, it drops IRQF_NO_THREAD for MSI/MSI-X. 

To avoid this performance regression detected by ai, should I revert to using request_irq() + pci_irq_vector() in v13? Could you please advise on the best approach for v13?

Thanks,
Javen

>
>kernel/irq/manage.c:irq_setup_forced_threading() {
>        if (new->flags & (IRQF_NO_THREAD | IRQF_PERCPU | IRQF_ONESHOT))
>                return 0;
>        ...
>        new->flags |= IRQF_ONESHOT;
>        ...
>        new->thread_fn = new->handler;
>        new->handler = irq_default_primary_handler; }
>
>so rtl8169_interrupt() becomes force-threaded and the vector is masked until
>the thread runs, which is what 870f531e178e set out to avoid.
>
>Two related observations on the same change: MSI and MSI-X vectors are now
>requested as IRQF_SHARED even though they are not shareable, and the name
>registered in /proc/interrupts changes from "<ifname>" to "<ifname>-<N>".
>Should the changelog mention the name change?
>
>> @@ -5074,7 +5127,10 @@ static void rtl8169_netpoll(struct net_device
>> *dev)  {
>>       struct rtl8169_private *tp = netdev_priv(dev);
>>
>> -     rtl8169_interrupt(tp->irq, tp);
>> +     for (int i = 0; i < tp->irq_nvecs; i++) {
>> +             rtl8169_interrupt(pci_irq_vector(tp->pci_dev, i),
>> +                               &tp->rtl8169_napi[i]);
>> +     }
>>  }
>>  #endif


  reply	other threads:[~2026-09-04  2:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31  5:39 [PATCH net-next v12 0/7] r8169: add RSS support for RTL8127 javen
2026-08-31  5:39 ` [PATCH net-next v12 1/7] r8169: add support for multi irqs javen
2026-09-03 20:42   ` [net-next,v12,1/7] " netdev-bot+sashiko
2026-09-04  2:46     ` Javen [this message]
2026-08-31  5:39 ` [PATCH net-next v12 2/7] r8169: refactor RX path to prepare for multi-queue javen
2026-09-03 20:42   ` [net-next,v12,2/7] " netdev-bot+sashiko
2026-09-04  3:06     ` Javen
2026-08-31  5:39 ` [PATCH net-next v12 3/7] r8169: add support for new interrupt mapping javen
2026-09-03 20:42   ` [net-next,v12,3/7] " netdev-bot+sashiko
2026-08-31  5:39 ` [PATCH net-next v12 4/7] r8169: enable " javen
2026-09-03 20:42   ` [net-next,v12,4/7] " netdev-bot+sashiko
2026-08-31  5:39 ` [PATCH net-next v12 5/7] r8169: add support and enable rss javen
2026-09-03 20:42   ` [net-next,v12,5/7] " netdev-bot+sashiko
2026-08-31  5:39 ` [PATCH net-next v12 6/7] r8169: move struct ethtool_ops javen
2026-08-31  5:39 ` [PATCH net-next v12 7/7] r8169: add get_channel support for ethtool javen
2026-09-03 20:42   ` [net-next,v12,7/7] " netdev-bot+sashiko

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=50122c7ae7704e6485684b2d2bac92e0@realsil.com.cn \
    --to=javen_xu@realsil.com.cn \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.com \
    --cc=pabeni@redhat.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