Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1535820

Re: [PATCH V2 net 10/20] net/ena: remove redundant logic in napi callback for busy poll mode

From Eric Dumazet <eric.dumazet@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH V2 net 10/20] net/ena: remove redundant logic in napi callback for busy poll mode
Date 2016-12-05 07:00 +0100
Message-ID <sKUtH-qx-3@gated-at.bofh.it> (permalink)
References <sKF1D-7FZ-3@gated-at.bofh.it> <sKF1F-7FZ-43@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sun, 2016-12-04 at 15:19 +0200, Netanel Belgazal wrote:
> sk_busy_loop can call the napi callback few million times a sec.
> For each call there is unmask interrupt.
> We want to reduce the number of unmasks.
> 
> Add an atomic variable that will tell the napi handler if
> it was called from irq context or not.
> Unmask the interrupt only from irq context.
> 
> A schenario where the driver left with missed unmask isn't feasible.
> when ena_intr_msix_io is called the driver have 2 options:
> 1)Before napi completes and call napi_complete_done
> 2)After calling napi_complete_done
> 
> In the former case the napi will unmask the interrupt as needed.
> In the latter case napi_complete_done will remove napi from the schedule
> list so napi will be rescheduled (by ena_intr_msix_io) and interrupt
> will be unmasked as desire in the 2nd napi call.
> 
> Signed-off-by: Netanel Belgazal <netanel@annapurnalabs.com>
> ---


This looks very complicated to me.

I guess you missed the recent patches that happened on net-next ?

2e713283751f494596655d9125c168aeb913f71d net/mlx4_en: use napi_complete_done() return value
364b6055738b4c752c30ccaaf25c624e69d76195 net: busy-poll: return busypolling status to drivers
21cb84c48ca0619181106f0f44f3802a989de024 net: busy-poll: remove need_resched() from sk_can_busy_loop()
217f6974368188fd8bd7804bf5a036aa5762c5e4 net: busy-poll: allow preemption in sk_busy_loop()

napi_complete_done() return code can be used by a driver,
no need to add yet another atomic operation in fast path.

Anyway, this looks wrong :

@@ -1186,6 +1201,7 @@ static irqreturn_t ena_intr_msix_io(int irq, void *data)
 {
        struct ena_napi *ena_napi = data;
 
+       atomic_set(&ena_napi->unmask_interrupt, 1);
        napi_schedule(&ena_napi->napi);
 
You probably wanted :

if (napi_schedule_prep(n)) {
	atomic_set(&ena_napi->unmask_interrupt, 1);
	__napi_schedule(n);
}



Please rework this napi poll using core infrastructure.

busypoll logic should be centralized, not reimplemented in different ways in a driver.

Thanks.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V2 net 00/20] Increase ENA driver version to 1.1.2 Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
  [PATCH V2 net 05/20] net/ena: fix RSS default hash configuration Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 05/20] net/ena: fix RSS default hash configuration Matt Wilson <msw@amzn.com> - 2016-12-05 05:30 +0100
      Re: [PATCH V2 net 05/20] net/ena: fix RSS default hash configuration Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-05 19:40 +0100
  [PATCH V2 net 13/20] net/ena: change driver's default timeouts Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 13/20] net/ena: change driver's default timeouts Matt Wilson <msw@amzn.com> - 2016-12-05 05:40 +0100
      Re: [PATCH V2 net 13/20] net/ena: change driver's default timeouts Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-05 19:30 +0100
  [PATCH V2 net 08/20] net/ena: add hardware hints capability to the driver Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 08/20] net/ena: add hardware hints capability to  the driver Matt Wilson <msw@amzn.com> - 2016-12-05 05:40 +0100
      Re: [PATCH V2 net 08/20] net/ena: add hardware hints capability to  the driver Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-05 19:40 +0100
  [PATCH V2 net 17/20] net/ena: add IPv6 extended protocols to ena_admin_flow_hash_proto Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
  [PATCH V2 net 09/20] net/ena: fix potential access to freed memory during device reset Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
  [PATCH V2 net 07/20] net/ena: refactor ena_get_stats64 to be atomic context safe Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 07/20] net/ena: refactor ena_get_stats64 to be  atomic context safe Matt Wilson <msw@amzn.com> - 2016-12-05 05:30 +0100
      Re: [PATCH V2 net 07/20] net/ena: refactor ena_get_stats64 to be  atomic context safe Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-05 19:40 +0100
  [PATCH V2 net 12/20] net/ena: reduce the severity of ena printouts Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
  [PATCH V2 net 16/20] net/ena: use napi_schedule_irqoff when possible Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
  [PATCH V2 net 11/20] net/ena: use READ_ONCE to access completion descriptors Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
  [PATCH V2 net 06/20] net/ena: fix NULL dereference when removing the driver after device reset faild Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 06/20] net/ena: fix NULL dereference when removing  the driver after device reset faild Matt Wilson <msw@amzn.com> - 2016-12-05 05:40 +0100
      Re: [PATCH V2 net 06/20] net/ena: fix NULL dereference when removing  the driver after device reset faild Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-05 19:40 +0100
  [PATCH V2 net 14/20] net/ena: change condition for host attribute configuration Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
  [PATCH V2 net 04/20] net/ena: fix ethtool RSS flow configuration Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 04/20] net/ena: fix ethtool RSS flow configuration Matt Wilson <msw@amzn.com> - 2016-12-05 05:20 +0100
      Re: [PATCH V2 net 04/20] net/ena: fix ethtool RSS flow configuration Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-05 19:30 +0100
  [PATCH V2 net 02/20] net/ena: fix error handling when probe fails Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 02/20] net/ena: fix error handling when probe fails Matt Wilson <msw@amzn.com> - 2016-12-05 05:20 +0100
      Re: [PATCH V2 net 02/20] net/ena: fix error handling when probe fails Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-05 19:30 +0100
  [PATCH V2 net 10/20] net/ena: remove redundant logic in napi callback for busy poll mode Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 10/20] net/ena: remove redundant logic in napi  callback for busy poll mode Eric Dumazet <eric.dumazet@gmail.com> - 2016-12-05 07:00 +0100
      Re: [PATCH V2 net 10/20] net/ena: remove redundant logic in napi  callback for busy poll mode Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-05 19:30 +0100
        Re: [PATCH V2 net 10/20] net/ena: remove redundant logic in napi  callback for busy poll mode Eric Dumazet <eric.dumazet@gmail.com> - 2016-12-05 20:00 +0100
  [PATCH V2 net 15/20] net/ena: change sizeof() argument to be the type pointer Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
  [PATCH V2 net 01/20] net/ena: remove ntuple filter support from device feature list Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 01/20] net/ena: remove ntuple filter support from  device feature list Matt Wilson <msw@amzn.com> - 2016-12-05 05:10 +0100
  [PATCH V2 net 19/20] net/ena: restructure skb allocation Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
  [PATCH V2 net 03/20] net/ena: fix queues number calculation Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-04 14:30 +0100
    Re: [PATCH V2 net 03/20] net/ena: fix queues number calculation Matt Wilson <msw@amzn.com> - 2016-12-05 05:20 +0100
      Re: [PATCH V2 net 03/20] net/ena: fix queues number calculation Netanel Belgazal <netanel@annapurnalabs.com> - 2016-12-05 19:30 +0100
  Re: [PATCH V2 net 00/20] Increase ENA driver version to 1.1.2 David Miller <davem@davemloft.net> - 2016-12-05 03:50 +0100
    Re: [PATCH V2 net 00/20] Increase ENA driver version to 1.1.2 Matt Wilson <msw@amzn.com> - 2016-12-05 04:40 +0100

csiph-web