ice: interrupt moderation updates
Subsystems (2)
v2 cover ice: interrupt moderation updates
Improve how the driver generates interrupts when it's using DIMLIB, and repair a couple of bugs found when making this change. It doesn't make sense for these changes to go into net, because they both depend on patch one in this series, or changes that are only available in net-next.
Jesse Brandeburg (3):
ice-linux: update dim usage and moderation
ice-linux: fix rate limit update after coalesce change
ice-linux: fix software generating extra interrupts
drivers/net/ethernet/intel/ice/ice_ethtool.c | 9 +- .../net/ethernet/intel/ice/ice_hw_autogen.h | 1 + drivers/net/ethernet/intel/ice/ice_lib.c | 29 ++++- drivers/net/ethernet/intel/ice/ice_lib.h | 1 + drivers/net/ethernet/intel/ice/ice_main.c | 118 ++++++++++-------- drivers/net/ethernet/intel/ice/ice_txrx.c | 99 ++++++++------- 6 files changed, 153 insertions(+), 104 deletions(-)
Signature · 1 line
2.31.1
PATCH v2 1/3 ice-linux: update dim usage and moderation
The driver was having trouble with unreliable latency when doing single threaded ping-pong tests. This was root caused to the DIM algorithm landing on a too slow interrupt value, which caused high latency, and it was especially present when queues were being switched frequently by the scheduler as happens on default setups today.
In attempting to improve this, we allow the upper rate limit for interrupts to move to rate limit of 4 microseconds as a max, which means that no vector can generate more than 250,000 interrupts per second. The old config was up to 100,000. The driver previously tried to program the rate limit too frequently and if the receive and transmit side were both active on the same vector, the INTRL would be set incorrectly, and this change fixes that issue as a side effect of the redesign.
This driver will operate from now on with a slightly changed DIM table with more emphasis towards latency sensitivity by having more table entries with lower latency than with high latency (high being >= 64 microseconds).
The driver also resets the DIM algorithm state with a new stats set when there is no work done and the data becomes stale (older than 1 second), for the respective receive or transmit portion of the interrupt.
Add a new helper for setting rate limit, which will be used more in a followup patch.
--- drivers/net/ethernet/intel/ice/ice_lib.c | 25 +++++ drivers/net/ethernet/intel/ice/ice_lib.h | 1 + drivers/net/ethernet/intel/ice/ice_main.c | 118 ++++++++++++---------- drivers/net/ethernet/intel/ice/ice_txrx.c | 73 ++++++------- 4 files changed, 130 insertions(+), 87 deletions(-)
drivers/net/ethernet/intel/ice/ice_lib.c +25 -0
@@ -1927,6 +1927,31 @@ void ice_write_itr(struct ice_ring_container *rc, u16 itr)__ice_write_itr (q_vector, rc, itr); } +/** +* ice_set_q_vector_intrl - set up interrupt rate limiting +* @q_vector: the vector to be configured +* +* Interrupt rate limiting is local to the vector, not per-queue so we must +* detect if either ring container has dynamic enabled to decide what to set +* the interrupt rate limit to via INTRL settings. In the case of dynamic +* disabled on both, write the value with the cached setting to make sure +* INTRL matches user visible value. +*/ +void ice_set_q_vector_intrl (struct ice_q_vector *q_vector) +{ +if (ITR_IS_DYNAMIC (&q_vector->tx) ||ITR_IS_DYNAMIC (&q_vector->rx)) { +/* in the case of dynamic enabled, cap each vector to no more +* than (4 us) 250,000 ints/sec, which allows low latency +* but still less than 500,000 interrupts per second, which +* reduces CPU a bit in the case of the lowest latency +* setting. The 4 here is a value in microseconds. +*/ +ice_write_intrl (q_vector,4 ); + }else { +ice_write_intrl (q_vector, q_vector->intrl); + } +} +/** * ice_vsi_cfg_msix - MSIX mode Interrupt Config in the HW * @vsi: the VSI being configured
drivers/net/ethernet/intel/ice/ice_lib.h +1 -0
@@ -103,6 +103,7 @@ int ice_status_to_errno(enum ice_status err);void ice_write_intrl (struct ice_q_vector *q_vector,u8 intrl);void ice_write_itr (struct ice_ring_container *rc,u16 itr); +void ice_set_q_vector_intrl (struct ice_q_vector *q_vector);enum ice_status ice_vsi_cfg_mac_fltr (struct ice_vsi *vsi,const u8 *macaddr,bool set);
drivers/net/ethernet/intel/ice/ice_main.c +66 -52
182 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_txrx.c +38 -35
113 lines not on this page · raw message
Signature · 1 line
2.31.1
Creeley
PATCH v2 1/3 ice-linux: update dim usage and moderation
Quoted 5 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jesse Brandeburg
Sent: Thursday, August 19, 2021 12:30 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH net-next v2 1/3] ice-linux: update dim usage and moderation
I think the subject should be "ice: ..." instead of "ice-linux: ...". Same goes for 2/3 and 3/3.
Quoted 34 lines
The driver was having trouble with unreliable latency when doing single threaded ping-pong tests. This was root caused to the DIM algorithm landing on a too slow interrupt value, which caused high latency, and it was especially present when queues were being switched frequently by the scheduler as happens on default setups today.
In attempting to improve this, we allow the upper rate limit for interrupts to move to rate limit of 4 microseconds as a max, which means that no vector can generate more than 250,000 interrupts per second. The old config was up to 100,000. The driver previously tried to program the rate limit too frequently and if the receive and transmit side were both active on the same vector, the INTRL would be set incorrectly, and this change fixes that issue as a side effect of the redesign.
This driver will operate from now on with a slightly changed DIM table with more emphasis towards latency sensitivity by having more table entries with lower latency than with high latency (high being >= 64 microseconds).
The driver also resets the DIM algorithm state with a new stats set when there is no work done and the data becomes stale (older than 1 second), for the respective receive or transmit portion of the interrupt.
Add a new helper for setting rate limit, which will be used more in a followup patch.
Signed-off-by Jesse Brandeburg <[email protected]>--- drivers/net/ethernet/intel/ice/ice_lib.c | 25 +++++ drivers/net/ethernet/intel/ice/ice_lib.h | 1 + drivers/net/ethernet/intel/ice/ice_main.c | 118 ++++++++++++---------- drivers/net/ethernet/intel/ice/ice_txrx.c | 73 ++++++------- 4 files changed, 130 insertions(+), 87 deletions(-)
<snip>
Nguyen
PATCH v2 1/3 ice-linux: update dim usage and moderation
Quoted 11 lines · Brett
Quoted 7 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jesse Brandeburg
Sent: Thursday, August 19, 2021 12:30 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [PATCH net-next v2 1/3] ice-linux:
update dim usage and moderationI think the subject should be "ice: ..." instead of "ice-linux: ...". Same
goes for 2/3 and 3/3.
I agree with Brett. ice, not ice-linux. I was going to fix that up myself, however, this isn't applying after Maciej's series [1]. It looked largely due to the split of ice_ring [2], but I didn't see if there were other conflicts. Could you update and accommodate the series' changes so it'll apply?
Thanks,
Tony
[1]
https://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=258748
[2] https://patchwork.ozlabs.org/patch/1518639
Quoted 51 lines
Quoted 37 lines
The driver was having trouble with unreliable latency when doing single
threaded ping-pong tests. This was root caused to the DIM algorithm landing on a too slow interrupt value, which caused high latency, and it
was especially present when queues were being switched frequently by the
scheduler as happens on default setups today.In attempting to improve this, we allow the upper rate limit for interrupts to move to rate limit of 4 microseconds as a max, which means
that no vector can generate more than 250,000 interrupts per second. The
old config was up to 100,000. The driver previously tried to program the
rate limit too frequently and if the receive and transmit side were both
active on the same vector, the INTRL would be set incorrectly, and this
change fixes that issue as a side effect of the redesign.This driver will operate from now on with a slightly changed DIM table
with more emphasis towards latency sensitivity by having more table entries with lower latency than with high latency (high being >= 64 microseconds).The driver also resets the DIM algorithm state with a new stats set when
there is no work done and the data becomes stale (older than 1 second),
for the respective receive or transmit portion of the interrupt.Add a new helper for setting rate limit, which will be used more in a followup patch.
Quoted 8 lines
Signed-off-by Jesse Brandeburg <[email protected]>--- drivers/net/ethernet/intel/ice/ice_lib.c | 25 +++++ drivers/net/ethernet/intel/ice/ice_lib.h | 1 + drivers/net/ethernet/intel/ice/ice_main.c | 118 ++++++++++++---- ------ drivers/net/ethernet/intel/ice/ice_txrx.c | 73 ++++++------- 4 files changed, 130 insertions(+), 87 deletions(-)<snip>
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
PATCH v2 2/3 ice-linux: fix rate limit update after coalesce change
In reply to Jesse BrandeburgIf the adaptive settings are changed with
ethtool -C ethx adaptive-rx off adaptive-tx off
then the interrupt rate limit should be maintained as a user set value, but only if BOTH adaptive settings are off. Fix a bug where the rate limit that was being used in adaptive mode was staying set in the register but was not reported correctly by ethtool -c ethx.
--- drivers/net/ethernet/intel/ice/ice_ethtool.c | 9 +++++---- drivers/net/ethernet/intel/ice/ice_lib.c | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/ice/ice_ethtool.c +5 -4
@@ -3657,11 +3657,8 @@ ice_set_rc_coalesce(enum ice_container_type c_type, struct ethtool_coalesce *ec, c_type_str);return -EINVAL ; } -if (ec->rx_coalesce_usecs_high != rc->ring->q_vector->intrl) { +if (ec->rx_coalesce_usecs_high != rc->ring->q_vector->intrl) rc->ring->q_vector->intrl = ec->rx_coalesce_usecs_high; -ice_write_intrl (rc->ring->q_vector, - ec->rx_coalesce_usecs_high); - } use_adaptive_coalesce = ec->use_adaptive_rx_coalesce; coalesce_usecs = ec->rx_coalesce_usecs;
@@ -3811,6 +3808,8 @@ __ice_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *ec,if (ice_set_q_coalesce (vsi, ec, v_idx))return -EINVAL ; + +ice_set_q_vector_intrl (vsi->q_vectors[v_idx]); } goto set_complete; }
@@ -3818,6 +3817,8 @@ __ice_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *ec,if (ice_set_q_coalesce (vsi, ec, q_num))return -EINVAL ; +ice_set_q_vector_intrl (vsi->q_vectors[q_num]); + set_complete:return 0 ; }
drivers/net/ethernet/intel/ice/ice_lib.c +2 -2
@@ -3109,7 +3109,7 @@ ice_vsi_rebuild_set_coalesce(struct ice_vsi *vsi, } vsi->q_vectors[i]->intrl = coalesce[i].intrl; -ice_write_intrl (vsi->q_vectors[i], coalesce[i].intrl); +ice_set_q_vector_intrl (vsi->q_vectors[i]); }/* the number of queue vectors increased so write whatever is in
@@ -3127,7 +3127,7 @@ ice_vsi_rebuild_set_coalesce(struct ice_vsi *vsi,ice_write_itr (rc, rc->itr_setting); vsi->q_vectors[i]->intrl = coalesce[0 ].intrl; -ice_write_intrl (vsi->q_vectors[i], coalesce[0 ].intrl); +ice_set_q_vector_intrl (vsi->q_vectors[i]); } }
Signature · 1 line
2.31.1
PATCH v2 3/3 ice-linux: fix software generating extra interrupts
In reply to Jesse BrandeburgThe driver tried to work around missing completion events that occurred while interrupts are disabled, by triggering a software interrupt whenever we exit polling (but we had to have polled at least once).
This was causing a *lot* of extra interrupts for some workloads like NVMe over TCP, which resulted in regressions in performance. It was also visible when polling didn't prevent interrupts when busy_poll was enabled.
Fix the extra interrupts by utilizing our previously unused 3rd ITR (interrupt throttle) index and set it to 20K interrupts per second, and then trigger a software interrupt within that rate limit.
While here, slightly refactor the code to avoid an overwrite of a local variable in the case of wb_en = true.
--- .../net/ethernet/intel/ice/ice_hw_autogen.h | 1 + drivers/net/ethernet/intel/ice/ice_txrx.c | 26 +++++++++++-------- 2 files changed, 16 insertions(+), 11 deletions(-)
drivers/net/ethernet/intel/ice/ice_hw_autogen.h +1 -0
@@ -183,6 +183,7 @@#define GLINT_DYN_CTL_INTERVAL_S 5#define GLINT_DYN_CTL_INTERVAL_M ICE_M(0xFFF, 5)#define GLINT_DYN_CTL_SW_ITR_INDX_ENA_M BIT(24) +#define GLINT_DYN_CTL_SW_ITR_INDX_S 25#define GLINT_DYN_CTL_SW_ITR_INDX_M ICE_M(0x3, 25)#define GLINT_DYN_CTL_WB_ON_ITR_M BIT(30)#define GLINT_DYN_CTL_INTENA_MSK_M BIT(31)
drivers/net/ethernet/intel/ice/ice_txrx.c +15 -11
@@ -1323,21 +1323,25 @@ static void ice_enable_interrupt(struct ice_q_vector *q_vector)if (test_bit (ICE_DOWN , vsi->state))return ; -/* When exiting WB_ON_ITR, let ITR resume its normal -* interrupts-enabled path. +/* trigger an ITR delayed software interrupt when exiting busy poll, to +* make sure to catch any pending cleanups that might have been missed +* due to interrupt state transition. If busy poll or poll isn't +* enabled, then don't update ITR, and just enable the interrupt. */ -if (wb_en) +if (!wb_en) { + itr_val =ice_buildreg_itr (ICE_ITR_NONE ,0 ); + }else { q_vector->wb_on_itr = false; - itr_val =ice_buildreg_itr (ICE_ITR_NONE ,0 ); -/* trigger an immediate software interrupt when exiting -* busy poll, to make sure to catch any pending cleanups -* that might have been missed due to interrupt state -* transition. -*/ -if (wb_en) { +/* do two things here with a single write. Set up the third ITR +* index to be used for software interrupt moderation, and then +* trigger a software interrupt with a rate limit of 20K on +* software interrupts, this will help avoid high interrupt +* loads due to frequently polling and exiting polling. +*/ + itr_val =ice_buildreg_itr (ICE_IDX_ITR2 ,ICE_ITR_20K ); itr_val |=GLINT_DYN_CTL_SWINT_TRIG_M | -GLINT_DYN_CTL_SW_ITR_INDX_M | +ICE_IDX_ITR2 <<GLINT_DYN_CTL_SW_ITR_INDX_S |GLINT_DYN_CTL_SW_ITR_INDX_ENA_M ; }wr32 (&vsi->back->hw,GLINT_DYN_CTL (q_vector->reg_idx), itr_val);
Signature · 1 line
2.31.1