All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Samudrala, Sridhar" <sridhar.samudrala@intel.com>
To: Joe Damato <jdamato@fastly.com>, <netdev@vger.kernel.org>
Cc: <pabeni@redhat.com>, <namangulati@google.com>,
	<edumazet@google.com>, <amritha.nambiar@intel.com>,
	<sdf@fomichev.me>, <peter@typeblog.net>, <m2shafiei@uwaterloo.ca>,
	<bjorn@rivosinc.com>, <hch@infradead.org>, <willy@infradead.org>,
	<willemdebruijn.kernel@gmail.com>, <skhawaja@google.com>,
	<kuba@kernel.org>, Martin Karsten <mkarsten@uwaterloo.ca>,
	Bagas Sanjaya <bagasdotme@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Simon Horman <horms@kernel.org>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	"open list:BPF [MISC] :Keyword:(?:b|_)bpf(?:b|_)"
	<bpf@vger.kernel.org>
Subject: Re: [PATCH net-next v3 7/7] docs: networking: Describe irq suspension
Date: Thu, 31 Oct 2024 22:47:05 -0500	[thread overview]
Message-ID: <cd033a99-014c-4b41-bfca-7b893604fe5a@intel.com> (raw)
In-Reply-To: <20241101004846.32532-8-jdamato@fastly.com>



On 10/31/2024 7:48 PM, Joe Damato wrote:
> Describe irq suspension, the epoll ioctls, and the tradeoffs of using
> different gro_flush_timeout values.
> 
> Signed-off-by: Joe Damato <jdamato@fastly.com>
> Co-developed-by: Martin Karsten <mkarsten@uwaterloo.ca>
> Signed-off-by: Martin Karsten <mkarsten@uwaterloo.ca>
> Acked-by: Stanislav Fomichev <sdf@fomichev.me>
> Reviewed-by: Bagas Sanjaya <bagasdotme@gmail.com>
> ---
<snip>


> +
> +IRQ suspension
> +--------------
> +
> +IRQ suspension is a mechanism wherein device IRQs are masked while epoll
> +triggers NAPI packet processing.
> +
> +While application calls to epoll_wait successfully retrieve events, the kernel will
> +defer the IRQ suspension timer. If the kernel does not retrieve any events
> +while busy polling (for example, because network traffic levels subsided), IRQ
> +suspension is disabled and the IRQ mitigation strategies described above are
> +engaged.
> +
> +This allows users to balance CPU consumption with network processing
> +efficiency.
> +
> +To use this mechanism:
> +
> +  1. The per-NAPI config parameter ``irq_suspend_timeout`` should be set to the
> +     maximum time (in nanoseconds) the application can have its IRQs
> +     suspended. This is done using netlink, as described above. This timeout
> +     serves as a safety mechanism to restart IRQ driver interrupt processing if
> +     the application has stalled. This value should be chosen so that it covers
> +     the amount of time the user application needs to process data from its
> +     call to epoll_wait, noting that applications can control how much data
> +     they retrieve by setting ``max_events`` when calling epoll_wait.
> +
> +  2. The sysfs parameter or per-NAPI config parameters ``gro_flush_timeout``
> +     and ``napi_defer_hard_irqs`` can be set to low values. They will be used
> +     to defer IRQs after busy poll has found no data.

Is it required to set gro_flush_timeout and napi_defer_hard_irqs when 
irq_suspend_timeout is set? Doesn't it override any smaller 
gro_flush_timeout value?


> +
> +  3. The ``prefer_busy_poll`` flag must be set to true. This can be done using
> +     the ``EPIOCSPARAMS`` ioctl as described above.
> +
> +  4. The application uses epoll as described above to trigger NAPI packet
> +     processing.
> +
> +As mentioned above, as long as subsequent calls to epoll_wait return events to
> +userland, the ``irq_suspend_timeout`` is deferred and IRQs are disabled. This
> +allows the application to process data without interference.
> +
> +Once a call to epoll_wait results in no events being found, IRQ suspension is
> +automatically disabled and the ``gro_flush_timeout`` and
> +``napi_defer_hard_irqs`` mitigation mechanisms take over.
> +
> +It is expected that ``irq_suspend_timeout`` will be set to a value much larger
> +than ``gro_flush_timeout`` as ``irq_suspend_timeout`` should suspend IRQs for
> +the duration of one userland processing cycle.
>   
>   .. _threaded:
>   


  reply	other threads:[~2024-11-01  3:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-01  0:48 [PATCH net-next v3 0/7] Suspend IRQs during application busy periods Joe Damato
2024-11-01  0:48 ` [PATCH net-next v3 1/7] net: Add napi_struct parameter irq_suspend_timeout Joe Damato
2024-11-01  0:48 ` [PATCH net-next v3 2/7] net: Suspend softirq when prefer_busy_poll is set Joe Damato
2024-11-01  0:48 ` [PATCH net-next v3 3/7] net: Add control functions for irq suspension Joe Damato
2024-11-01  0:48 ` [PATCH net-next v3 4/7] eventpoll: Trigger napi_busy_loop, if prefer_busy_poll is set Joe Damato
2024-11-01  0:48 ` [PATCH net-next v3 5/7] eventpoll: Control irq suspension for prefer_busy_poll Joe Damato
2024-11-01  0:48 ` [PATCH net-next v3 6/7] selftests: net: Add busy_poll_test Joe Damato
2024-11-01 13:34   ` Jakub Kicinski
2024-11-01 20:15     ` Joe Damato
2024-11-01  0:48 ` [PATCH net-next v3 7/7] docs: networking: Describe irq suspension Joe Damato
2024-11-01  3:47   ` Samudrala, Sridhar [this message]
2024-11-01  4:39     ` Joe Damato
2024-11-01 21:01       ` Samudrala, Sridhar
2024-11-01 21:46         ` Martin Karsten

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=cd033a99-014c-4b41-bfca-7b893604fe5a@intel.com \
    --to=sridhar.samudrala@intel.com \
    --cc=amritha.nambiar@intel.com \
    --cc=bagasdotme@gmail.com \
    --cc=bjorn@rivosinc.com \
    --cc=bpf@vger.kernel.org \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hch@infradead.org \
    --cc=horms@kernel.org \
    --cc=jdamato@fastly.com \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m2shafiei@uwaterloo.ca \
    --cc=mkarsten@uwaterloo.ca \
    --cc=namangulati@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=peter@typeblog.net \
    --cc=sdf@fomichev.me \
    --cc=skhawaja@google.com \
    --cc=willemdebruijn.kernel@gmail.com \
    --cc=willy@infradead.org \
    /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.