linux/drivers
Maciej Fijalkowski 913eda2b08 i40e: xsk: remove count_mask
Cited commit introduced a neat way of updating next_to_clean that does
not require boundary checks on each increment. This was done by masking
the new value with (ring length - 1) mask. Problem is that this is
applicable only for power of 2 ring sizes, for every other size this
assumption can not be made. In turn, it leads to cleaning descriptors
out of order as well as splats:

[ 1388.411915] Workqueue: events xp_release_deferred
[ 1388.411919] RIP: 0010:xp_free+0x1a/0x50
[ 1388.411921] Code: 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 0f 1f 44 00 00 55 48 8b 57 70 48 8d 47 70 48 89 e5 48 39 d0 74 06 <5d> c3 cc cc cc cc 48 8b 57 60 83 82 b8 00 00 00 01 48 8b 57 60 48
[ 1388.411922] RSP: 0018:ffa0000000a83cb0 EFLAGS: 00000206
[ 1388.411923] RAX: ff11000119aa5030 RBX: 000000000000001d RCX: ff110001129b6e50
[ 1388.411924] RDX: ff11000119aa4fa0 RSI: 0000000055555554 RDI: ff11000119aa4fc0
[ 1388.411925] RBP: ffa0000000a83cb0 R08: 0000000000000000 R09: 0000000000000000
[ 1388.411926] R10: 0000000000000001 R11: 0000000000000000 R12: ff11000115829b80
[ 1388.411927] R13: 000000000000005f R14: 0000000000000000 R15: ff11000119aa4fc0
[ 1388.411928] FS:  0000000000000000(0000) GS:ff11000277e00000(0000) knlGS:0000000000000000
[ 1388.411929] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1388.411930] CR2: 00007f1f564e6c14 CR3: 000000000783c005 CR4: 0000000000771ef0
[ 1388.411931] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 1388.411931] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 1388.411932] PKRU: 55555554
[ 1388.411933] Call Trace:
[ 1388.411934]  <IRQ>
[ 1388.411935]  ? show_regs+0x6e/0x80
[ 1388.411937]  ? watchdog_timer_fn+0x1d2/0x240
[ 1388.411939]  ? __pfx_watchdog_timer_fn+0x10/0x10
[ 1388.411941]  ? __hrtimer_run_queues+0x10e/0x290
[ 1388.411945]  ? clockevents_program_event+0xae/0x130
[ 1388.411947]  ? hrtimer_interrupt+0x105/0x240
[ 1388.411949]  ? __sysvec_apic_timer_interrupt+0x54/0x150
[ 1388.411952]  ? sysvec_apic_timer_interrupt+0x7f/0x90
[ 1388.411955]  </IRQ>
[ 1388.411955]  <TASK>
[ 1388.411956]  ? asm_sysvec_apic_timer_interrupt+0x1f/0x30
[ 1388.411958]  ? xp_free+0x1a/0x50
[ 1388.411960]  i40e_xsk_clean_rx_ring+0x5d/0x100 [i40e]
[ 1388.411968]  i40e_clean_rx_ring+0x14c/0x170 [i40e]
[ 1388.411977]  i40e_queue_pair_disable+0xda/0x260 [i40e]
[ 1388.411986]  i40e_xsk_pool_setup+0x192/0x1d0 [i40e]
[ 1388.411993]  i40e_reconfig_rss_queues+0x1f0/0x1450 [i40e]
[ 1388.412002]  xp_disable_drv_zc+0x73/0xf0
[ 1388.412004]  ? mutex_lock+0x17/0x50
[ 1388.412007]  xp_release_deferred+0x2b/0xc0
[ 1388.412010]  process_one_work+0x178/0x350
[ 1388.412011]  ? __pfx_worker_thread+0x10/0x10
[ 1388.412012]  worker_thread+0x2f7/0x420
[ 1388.412014]  ? __pfx_worker_thread+0x10/0x10
[ 1388.412015]  kthread+0xf8/0x130
[ 1388.412017]  ? __pfx_kthread+0x10/0x10
[ 1388.412019]  ret_from_fork+0x3d/0x60
[ 1388.412021]  ? __pfx_kthread+0x10/0x10
[ 1388.412023]  ret_from_fork_asm+0x1b/0x30
[ 1388.412026]  </TASK>

It comes from picking wrong ring entries when cleaning xsk buffers
during pool detach.

Remove the count_mask logic and use they boundary check when updating
next_to_process (which used to be a next_to_clean).

Fixes: c8a8ca3408 ("i40e: remove unnecessary memory writes of the next to clean pointer")
Reported-by: Tushar Vyavahare <tushar.vyavahare@intel.com>
Tested-by: Tushar Vyavahare <tushar.vyavahare@intel.com>
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://lore.kernel.org/r/20231018163908.40841-1-maciej.fijalkowski@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2023-10-19 17:27:21 -07:00
..
accel accel/ivpu: Use cached buffers for FW loading 2023-09-27 07:40:43 +02:00
accessibility
acpi Fix a Longsoon build warning by harmonizing the arch_[un]register_cpu() 2023-10-15 08:44:56 -07:00
amba amba: bus: fix refcount leak 2023-08-22 15:50:57 +02:00
android binder: fix memory leaks of spam and pending work 2023-10-05 12:48:08 +02:00
ata ata: pata_parport: fit3: implement IDE command set registers 2023-10-10 14:42:22 +09:00
atm
auxdisplay drm for 6.6-rc1 2023-08-30 13:34:34 -07:00
base regmap: Fix for v6.6 2023-10-18 09:30:03 -07:00
bcma
block block-6.6-2023-10-06 2023-10-06 15:43:19 -07:00
bluetooth Bluetooth: btrtl: Ignore error return for hci_devcd_register() 2023-10-13 20:03:04 -07:00
bus bus: ti-sysc: Fix SYSC_QUIRK_SWSUP_SIDLE_ACT handling for uart wake-up 2023-09-13 10:24:53 +03:00
cache cache: Add L2 cache management for Andes AX45MP RISC-V core 2023-09-01 09:08:59 -07:00
cdrom
cdx
char Hi, 2023-09-13 11:44:20 -07:00
clk clk: tegra: fix error return case for recalc_rate 2023-09-12 10:56:05 -07:00
clocksource Updates for clocksource/clockevent drivers: 2023-09-04 13:15:57 -07:00
comedi Revert "comedi: add HAS_IOPORT dependencies" 2023-09-12 15:49:20 +02:00
connector
counter First set of Counter fixes for 6.6 2023-10-02 13:13:15 +02:00
cpufreq cpufreq: Support per-policy performance boost 2023-08-29 20:51:40 +02:00
cpuidle powerpc updates for 6.6 2023-08-31 12:43:10 -07:00
crypto This update includes the following changes: 2023-08-29 11:23:29 -07:00
cxl cxl/acpi: Annotate struct cxl_cxims_data with __counted_by 2023-09-22 14:31:04 -07:00
dax mm: remove enum page_entry_size 2023-08-24 16:20:30 -07:00
dca
devfreq
dio
dma dmaengine fixes for v6.6 2023-10-13 08:52:57 -07:00
dma-buf dma-buf: add dma_fence_timestamp helper 2023-10-05 11:05:58 +02:00
edac Intel EDAC fixes: 2023-08-30 19:23:00 -07:00
eisa
extcon
firewire scsi: sd: Differentiate system and runtime start/stop management 2023-09-28 21:23:00 +09:00
firmware ARM: SoC fixes for 6.6 2023-09-30 18:41:37 -07:00
fpga
fsi fsi: i2cr: Switch to use struct i2c_driver's .probe() 2023-08-22 15:51:33 +02:00
gnss
gpio gpio: aspeed: fix the GPIO number passed to pinctrl_gpio_set_config() 2023-10-05 08:41:56 +02:00
gpu amd-drm-fixes-6.6-2023-10-11: 2023-10-13 13:20:24 +10:00
greybus
hid HID: logitech-hidpp: Fix kernel crash on receiver USB disconnect 2023-10-06 16:09:14 +02:00
hsi
hte hte: Explicitly include correct DT includes 2023-08-28 13:31:06 -05:00
hv hyperv-next for v6.6 2023-09-04 11:26:29 -07:00
hwmon hwmon: (nct6775) Fix non-existent ALARM warning 2023-09-18 11:52:18 -07:00
hwspinlock
hwtracing coresight: tmc-etr: Disable warnings for allocation failures 2023-09-20 10:46:30 +01:00
i2c i2c: npcm7xx: Fix callback completion ordering 2023-09-27 21:32:06 +02:00
i3c i3c: master: svc: fix probe failure when no i3c device exist 2023-09-06 01:21:47 +02:00
idle Perf events changes for v6.6: 2023-08-28 16:35:01 -07:00
iio iio: pressure: ms5611: ms5611_prom_is_valid false negative bug 2023-10-05 18:06:46 +01:00
infiniband RDMA/core: Require admin capabilities to set system parameters 2023-10-05 20:01:47 +03:00
input Input updates for v6.6-rc5 2023-10-13 23:19:16 -07:00
interconnect This pull request is full of clk driver changes. In fact, there aren't any 2023-08-30 19:53:39 -07:00
iommu iommu/vt-d: Avoid memory allocation in iommu_suspend() 2023-09-25 16:10:36 +02:00
ipack
irqchip A set of updates for interrupt chip drivers: 2023-10-10 11:14:07 -07:00
isdn Merge commit b320441c04 ("Merge tag 'tty-6.5-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty") into tty-next 2023-08-20 14:29:37 +02:00
leds leds: Drop BUG_ON check for LED_COLOR_ID_MULTI 2023-09-19 15:16:23 +01:00
macintosh powerpc updates for 6.6 2023-08-31 12:43:10 -07:00
mailbox mailbox: qcom-ipcc: fix incorrect num_chans counting 2023-09-05 10:11:01 -05:00
mcb mcb: remove is_added flag from mcb_device struct 2023-10-05 09:50:14 +02:00
md This push fixes a 6.5 regression in dm-crypt. 2023-10-10 10:47:35 -07:00
media media: i2c: ov8858: Don't set fwnode in the driver 2023-10-11 15:26:16 +02:00
memory
memstick
message
mfd Couple of small fixes, including: 2023-10-05 11:03:20 -07:00
misc misc: rtsx: Fix some platforms can not boot and move the l1ss judgment to probe 2023-09-25 10:48:19 +02:00
mmc TTY/Serial driver changes for 6.6-rc1 2023-09-01 09:38:00 -07:00
most
mtd ubi: Refuse attaching if mtd's erasesize is 0 2023-09-07 21:59:04 +02:00
mux mux: Explicitly include correct DT includes 2023-08-28 13:36:24 -05:00
net i40e: xsk: remove count_mask 2023-10-19 17:27:21 -07:00
nfc NFC: nxp: add NXP1002 2023-08-30 18:32:24 -07:00
ntb ntb: Check tx descriptors outstanding instead of head/tail for tx queue 2023-08-22 12:38:19 -04:00
nubus
nvdimm nvdimm changes for v6.6 merge window 2023-08-30 20:52:08 -07:00
nvme nvme fixes for Linux 6.6 2023-09-14 16:20:31 -06:00
nvmem nvmem: core: Notify when a new layout is registered 2023-08-23 16:34:02 +02:00
of of: overlay: Reorder struct fragment fields kerneldoc 2023-10-02 11:34:23 -05:00
opp OPP: Fix argument name in doc comment 2023-08-18 10:55:49 +05:30
parisc parisc: iosapic.c: Fix sparse warnings 2023-08-31 21:42:42 +02:00
parport TTY/Serial driver changes for 6.6-rc1 2023-09-01 09:38:00 -07:00
pci pci-v6.6-fixes-2 2023-10-06 09:11:13 -07:00
pcmcia
peci
perf RISC-V Fixes for 6.6-rc6 2023-10-13 09:17:48 -07:00
phy phy: lynx-28g: serialize concurrent phy_set_mode_ext() calls to shared registers 2023-10-06 10:59:52 +01:00
pinctrl pinctrl: renesas: rzn1: Enable missing PINMUX 2023-10-12 09:10:40 +02:00
platform platform/x86: hp-wmi:: Mark driver struct with __refdata to prevent section mismatch warning 2023-10-06 15:09:40 +02:00
pmdomain pmdomain: imx: scu-pd: correct DMA2 channel 2023-10-05 00:28:52 +02:00
pnp PNP: ACPI: Fix string truncation warning 2023-08-17 19:38:35 +02:00
power power: supply: qcom_battmgr: fix enable request endianness 2023-09-30 21:00:20 +02:00
powercap powercap: intel_rapl: Fix invalid setting of Power Limit 4 2023-09-06 22:21:22 +02:00
pps
ps3
ptp ptp: ocp: Fix error handling in ptp_ocp_device_init 2023-10-02 07:19:22 +01:00
pwm pwm: Changes for v6.6-rc1 2023-09-07 18:05:58 -07:00
rapidio
ras
regulator regulator/core: Revert "fix kobject release warning and memory leak in regulator_register()" 2023-09-26 17:26:08 +02:00
remoteproc remoteproc updates for v6.6 2023-09-04 15:12:26 -07:00
reset This pull request is full of clk driver changes. In fact, there aren't any 2023-08-30 19:53:39 -07:00
rpmsg rpmsg updates for v6.6 2023-09-04 15:08:52 -07:00
rtc RTC for 6.6 2023-09-07 16:07:35 -07:00
s390 net/smc: Fix dependency of SMC on ISM 2023-10-10 11:51:41 +02:00
sbus sbus: Explicitly include correct DT includes 2023-08-28 13:36:24 -05:00
scsi scsi: Do not rescan devices with a suspended queue 2023-10-10 14:42:22 +09:00
sh
siox
slimbus
soc ARM: SoC fixes for 6.6, part 2 2023-10-12 11:52:23 -07:00
soundwire soundwire: bus: Make IRQ handling conditionally built 2023-09-21 11:31:33 +02:00
spi spi: npcm-fiu: Fix UMA reads when dummy.nbytes == 0 2023-10-02 15:03:19 +01:00
spmi
ssb
staging staging: media: tegra-video: fix infinite recursion regression 2023-10-02 10:02:53 +02:00
target scsi: target: core: Fix deadlock due to recursive locking 2023-09-27 10:55:29 -04:00
tc
tee ARM: SoC fixes for 6.6, part 2 2023-10-12 11:52:23 -07:00
thermal thermal: sysfs: Fix trip_point_hyst_store() 2023-09-18 13:13:05 +02:00
thunderbolt thunderbolt: Restart XDomain discovery handshake after failure 2023-09-15 13:01:18 +03:00
tty serial: core: Fix checks for tx runtime PM state 2023-10-07 11:23:47 +02:00
ufs scsi: ufs: core: Correct clear TM error log 2023-10-09 21:33:30 -04:00
uio uio: pruss: fix missing iounmap() in pruss_probe() 2023-08-22 13:41:55 +02:00
usb usb: typec: ucsi: Use GET_CAPABILITY attributes data to set power supply scope 2023-10-11 11:39:25 +02:00
vdpa virtio: features 2023-09-04 10:43:44 -07:00
vfio vfio/mdev: Fix a null-ptr-deref bug for mdev_unregister_parent() 2023-09-22 12:48:04 -06:00
vhost vringh: don't use vringh_kiov_advance() in vringh_iov_xfer() 2023-10-04 08:26:48 +01:00
video fbdev fixes and cleanups for 6.6-rc7: 2023-10-17 17:14:22 -07:00
virt minmax: add in_range() macro 2023-08-24 16:20:18 -07:00
virtio virtio_ring: fix avail_wrap_counter in virtqueue_add_packed 2023-09-03 18:10:24 -04:00
vlynq
w1 w1: ds2482: Switch back to use struct i2c_driver's .probe() 2023-09-13 10:48:42 +02:00
watchdog linux-watchdog 6.6-rc1 tag 2023-09-06 09:19:12 -07:00
xen xen/events: replace evtchn_rwlock with RCU 2023-10-09 09:21:16 +02:00
zorro zorro: Include zorro.h in names.c 2023-08-21 13:27:44 +02:00
Kconfig Merge patch series "Add non-coherent DMA support for AX45MP" 2023-09-08 11:24:34 -07:00
Makefile pmdomain: Rename the genpd subsystem to pmdomain 2023-09-13 11:09:21 +02:00