mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next v7 0/2] dinghai: MSI-X interrupt pools and async event queue
@ 2026-12-02 15:23 han.junyang
  2026-12-02 15:26 ` [PATCH net-next v7 1/2] dinghai: add MSI-X interrupt pools han.junyang
  2026-12-02 15:29 ` [PATCH net-next v7 2/2] dinghai: add async event queue for firmware notifications han.junyang
  0 siblings, 2 replies; 6+ messages in thread
From: han.junyang @ 2026-12-02 15:23 UTC (permalink / raw)
  To: andrew+netdev, davem, edumazet, kuba, pabeni, horms
  Cc: linux-kernel, netdev, han.junyang, ran.ming, han.chengfei, zhang.yanze

From: Junyang Han <han.junyang@zte.com.cn>

This is v7 of the series. Patch 1 of v6 (firmware version check and
RISC-V readiness polling) has been applied; this version contains the
remaining two patches rebased on top of it. The review feedback on both
patches is addressed below; one item is not taken and is listed under
Review findings not taken.

The first patch allocates the MSI-X vector layout and manages the vectors
in per-purpose pools. The second creates the async event queue through
which the firmware will report events.

Some notes on the IRQ design:

The vector space is partitioned into per-purpose pools (async, RDMA,
vq). Event queues share a vector through an atomic notifier chain
attached to the IRQ, and the sharing degree is governed by pool
thresholds. The IRQ table hangs off a void *priv in the shared core
device: the PF, MPF and SF core devices each carry a different pool
layout behind that pointer, so a type-specific struct in en_pf.c keeps
the shared header free of PF-only details.

Changes in v7:
- Patch 1: select the vector layout from the device ID, so that a VF
  requests the 20 vectors it exposes instead of the 78 of a PF, and check
  the MSI-X table size with pci_msix_vec_count() before the vectors are
  requested. DINGHAI_PF now depends on PCI_MSI.
- Patch 1: keep the NVIDIA copyright notice on the IRQ pool code that is
  derived from mlx5's irq_affinity.c, remove the dead affinity == NULL
  branch, and make the comments and the overload message describe the
  sharing policy and its units correctly.
- Patch 2: check the valid flag of the message header before using the
  event_id, and clear it once the message has been dispatched. Remove the
  unused eq_table lock.
- The async event queue has no subscriber until the BAR message channel
  series; it is kept here because the vector allocation, the IRQ lifetime
  and the teardown order belong with the interrupt pools.

Changes in v6:
- Guard the IRQ table teardown in patch 2 rather than deferring the
  guards to patch 3, so the probe error paths of the MSI-X patch are
  safe on their own and bisection cannot land on an unguarded cleanup
  (sashiko review of v5).
- Review findings not taken from v5:
  The sashiko automated review of v5 [1], which was not posted to the
  list, reported four findings. The IRQ table teardown NULL
  dereferences on the probe error paths were real and are fixed in
  this revision. The remaining three restate earlier findings or
  do not apply: the BAR0 bounds item repeats the BAR 0 entry below;
  the 20 s legacy wait is the legacy-firmware detection itself:
  firmware that predates the compat region never populates it and
  the driver reports and proceeds in legacy mode after the timeout
  (see Changes in v4); and the health_version read cannot race the
  RISC-V core initialization: the readiness skip fires only for
  firmware with patch < ZXDH_HPIRQ_PATCH, which never reports the
  power-on flag, while firmware that does report health_version
  carries patch >= ZXDH_HPIRQ_PATCH and initializes the health
  buffer before the compat block reports ready.

  [1] https://sashiko.dev/#/patchset/20261014151200489685SCIlolykW0NGfL5EtQ%40zte.com.cn

Changes in v5:
- Drop __packed from zxdh_fw_compat and zxdh_health_buffer: both
  structs are naturally aligned with no padding.

Changes in v4:
- Fold the irq and eq table create() steps into their init()
  counterparts and route every probe error path through the same
  destroy() functions remove() uses, so cleanup has a single
  authority from the start (review feedback on v3).
- Give the pool name a buffer bound of its own (16 bytes) instead of
  sharing the 100-byte IRQ name buffer, so W=1 builds stay clean of
  -Wformat-truncation (review feedback on v3).
- Lower the compat region wait from 200 s to 20 s: the firmware
  publishes the block within 10 s of boot, so twice that leaves
  margin, and the wait now sits far below the 180 s udev event
  window raised on the thread (review feedback on v3).
- Wait for the compat block with a per-field readiness check instead
  of only the first dword: the firmware fills the fields one by one,
  and a dword-granular check can read a half-populated block (the
  "single write" justification given in v3 was wrong).
- Log the legacy-firmware assumption when the compat region wait
  times out, making the intentionally ignored timeout visible.

Changes in v3:
- Unmap the modern config MMIO regions on the probe error paths added
  in this series; they used to leak when the fw compat check or the
  RISC-V readiness wait failed.
- Skip the RISC-V readiness wait for firmware without the compat
  region: the erased patch field read as 0xffff and defeated the skip.
- Make fw_minor unsigned so firmware minor versions >= 128 are not
  rejected through sign wrap.
- Balance the per-CPU IRQ accounting on release, so pool teardown does
  not trip its leftover WARN; set the IRQ affinity for real with
  irq_set_affinity_and_hint() instead of only updating the hint; name
  IRQs after their pool instead of a hardcoded prefix; assert that the
  pool is empty at free instead of force-releasing leftovers.
- Clear eq->irq when the async IRQ request fails, so teardown does not
  treat the ERR_PTR as a live IRQ.

Review findings not taken:

- xa_alloc() with a NULL entry does not fail: __xa_alloc() turns a
  NULL entry into the internal zero entry as a reservation
  (lib/xarray.c), which is the reservation semantics the pool relies
  on.
- BAR 0 length checks against a truncated bar: the bar layout is part
  of the board firmware contract and the driver does not defend
  against a broken device, as settled during the review of the
  earlier device bring-up series (Andrew Lunn).

Changes in v2:
- Convert both firmware readiness polls to readx_poll_timeout()
  (Andrew Lunn).
- Read the fw compat block field by field through ioread*() accessors
  instead of an ioread32_rep() bulk copy, which misplaces the u8/u16
  fields on big-endian; no __le annotations are needed since each
  accessor converts from little-endian (Andrew Lunn).
- Use kref for the IRQ reference count (Andrew Lunn).

Junyang Han (2):
  dinghai: add MSI-X interrupt pools
  dinghai: add async event queue for firmware notifications

 drivers/net/ethernet/zte/dinghai/Kconfig    |   1 +
 drivers/net/ethernet/zte/dinghai/en_pf.c    | 121 ++++++
 drivers/net/ethernet/zte/dinghai/zxdh_eq.c  | 142 +++++++
 drivers/net/ethernet/zte/dinghai/zxdh_eq.h  |  62 +++
 drivers/net/ethernet/zte/dinghai/zxdh_irq.c | 401 ++++++++++++++++++++
 drivers/net/ethernet/zte/dinghai/zxdh_irq.h |  77 ++++
 6 files changed, 804 insertions(+)
 create mode 100644 drivers/net/ethernet/zte/dinghai/zxdh_eq.c
 create mode 100644 drivers/net/ethernet/zte/dinghai/zxdh_eq.h
 create mode 100644 drivers/net/ethernet/zte/dinghai/zxdh_irq.c
 create mode 100644 drivers/net/ethernet/zte/dinghai/zxdh_irq.h

-- 
2.27.0

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-12-03  3:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-02 15:23 [PATCH net-next v7 0/2] dinghai: MSI-X interrupt pools and async event queue han.junyang
2026-12-02 15:26 ` [PATCH net-next v7 1/2] dinghai: add MSI-X interrupt pools han.junyang
2026-12-03  2:38   ` kernel test robot
2026-12-03  2:51   ` kernel test robot
2026-12-03  3:56   ` kernel test robot
2026-12-02 15:29 ` [PATCH net-next v7 2/2] dinghai: add async event queue for firmware notifications han.junyang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®