linux/drivers
Serge Semin c94b7f9bab nvme-hwmon: kmalloc the NVME SMART log buffer
Recent commit 52fde2c07d ("nvme: set dma alignment to dword") has
caused a regression on our platform.

It turned out that the nvme_get_log() method invocation caused the
nvme_hwmon_data structure instance corruption.  In particular the
nvme_hwmon_data.ctrl pointer was overwritten either with zeros or with
garbage.  After some research we discovered that the problem happened
even before the actual NVME DMA execution, but during the buffer mapping.
Since our platform is DMA-noncoherent, the mapping implied the cache-line
invalidations or write-backs depending on the DMA-direction parameter.
In case of the NVME SMART log getting the DMA was performed
from-device-to-memory, thus the cache-invalidation was activated during
the buffer mapping.  Since the log-buffer isn't cache-line aligned, the
cache-invalidation caused the neighbour data to be discarded.  The
neighbouring data turned to be the data surrounding the buffer in the
framework of the nvme_hwmon_data structure.

In order to fix that we need to make sure that the whole log-buffer is
defined within the cache-line-aligned memory region so the
cache-invalidation procedure wouldn't involve the adjacent data. One of
the option to guarantee that is to kmalloc the DMA-buffer [1]. Seeing the
rest of the NVME core driver prefer that method it has been chosen to fix
this problem too.

Note after a deeper researches we found out that the denoted commit wasn't
a root cause of the problem. It just revealed the invalidity by activating
the DMA-based NVME SMART log getting performed in the framework of the
NVME hwmon driver. The problem was here since the initial commit of the
driver.

[1] Documentation/core-api/dma-api-howto.rst

Fixes: 400b6a7b13 ("nvme: Add hardware monitoring support")
Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2022-10-19 12:43:13 +02:00
..
accessibility
acpi platform-drivers-x86 for v6.1-1 2022-10-05 10:38:24 -07:00
amba
android
ata ata changes for 6.1-rc1 2022-10-07 10:48:49 -07:00
atm
auxdisplay
base RISC-V Patches for the 6.1 Merge Window, Part 1 2022-10-09 13:24:01 -07:00
bcma
block Driver core changes for 6.1-rc1 2022-10-07 17:04:10 -07:00
bluetooth
bus Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
cdrom
char TTY/Serial driver update for 6.1-rc1 2022-10-07 16:36:24 -07:00
clk Here's the main clk pull request for this merge window. We have some 2022-10-08 10:06:48 -07:00
clocksource
comedi
connector
counter gpio updates for v6.1-rc1 2022-10-08 09:46:29 -07:00
cpufreq Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
cpuidle RISC-V Patches for the 6.1 Merge Window, Part 1 2022-10-09 13:24:01 -07:00
crypto * 'remove' callback converted to return void. Big change with trivial 2022-10-04 18:54:33 -07:00
cxl
dax
dca
devfreq
dio
dma dmaengine updates for v6.1-rc1 2022-10-07 15:56:34 -07:00
dma-buf whack-a-mole: cropped up open-coded file_inode() uses... 2022-10-06 17:22:11 -07:00
edac Merge branches 'edac-drivers' and 'edac-misc' into edac-updates-for-v6.1 2022-10-04 10:00:25 +02:00
eisa
extcon Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
firewire
firmware EFI updates for v6.1 2022-10-09 08:56:54 -07:00
fpga Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
fsi
gnss
gpio gpio updates for v6.1-rc1 2022-10-08 09:46:29 -07:00
gpu Driver core changes for 6.1-rc1 2022-10-07 17:04:10 -07:00
greybus
hid Assorted HID drivers updates and fixes for 6.1 2022-10-07 11:13:42 -07:00
hsi
hte
hv Merge branch 'acpi-dev' 2022-09-30 20:05:16 +02:00
hwmon Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
hwspinlock
hwtracing Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
i2c ARM: driver updates for 6.1 2022-10-06 11:04:57 -07:00
i3c
idle
iio Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
infiniband v6.1 merge window pull request 2022-10-07 12:05:29 -07:00
input * 'remove' callback converted to return void. Big change with trivial 2022-10-04 18:54:33 -07:00
interconnect
iommu Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
ipack Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
irqchip arm64 updates for 6.1: 2022-10-06 11:51:49 -07:00
isdn Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-10-03 17:44:18 -07:00
leds platform-drivers-x86 for v6.1-1 2022-10-05 10:38:24 -07:00
macintosh powerpc updates for 6.1 2022-10-09 14:05:15 -07:00
mailbox mailbox: qcom-ipcc: flag IRQ NO_THREAD 2022-10-05 21:51:58 -05:00
mcb
md for-6.1/passthrough-2022-10-04 2022-10-07 09:35:50 -07:00
media USB/Thunderbolt changes for 6.1-rc1 2022-10-07 16:48:26 -07:00
memory
memstick
message
mfd - Core Frameworks 2022-10-07 11:24:20 -07:00
misc Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
mmc TTY/Serial driver update for 6.1-rc1 2022-10-07 16:36:24 -07:00
most
mtd Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
mux
net TTY/Serial driver update for 6.1-rc1 2022-10-07 16:36:24 -07:00
nfc
ntb
nubus
nvdimm
nvme nvme-hwmon: kmalloc the NVME SMART log buffer 2022-10-19 12:43:13 +02:00
nvmem
of * 'remove' callback converted to return void. Big change with trivial 2022-10-04 18:54:33 -07:00
opp
parisc asm-generic updates for v6.1 2022-10-06 12:10:37 -07:00
parport
pci
pcmcia
peci
perf RISC-V Patches for the 6.1 Merge Window, Part 1 2022-10-09 13:24:01 -07:00
phy USB/Thunderbolt changes for 6.1-rc1 2022-10-07 16:48:26 -07:00
pinctrl ARM: driver updates for 6.1 2022-10-06 11:04:57 -07:00
platform platform-drivers-x86 for v6.1-1 2022-10-05 10:38:24 -07:00
pnp
power power supply and reset changes for the v6.1 series 2022-10-07 11:48:30 -07:00
powercap
pps
ps3
ptp
pwm pwm: Changes for v6.1-rc1 2022-10-07 11:32:10 -07:00
rapidio
ras
regulator - Core Frameworks 2022-10-07 11:24:20 -07:00
remoteproc remoteproc: virtio: Fix warning on bindings by removing the of_match_table 2022-10-05 09:20:44 -06:00
reset Here's the main clk pull request for this merge window. We have some 2022-10-08 10:06:48 -07:00
rpmsg
rtc
s390 s390 updates for the 6.1 merge window 2022-10-09 13:51:40 -07:00
sbus
scsi SCSI misc on 20221007 2022-10-07 12:33:18 -07:00
sh
siox
slimbus
soc Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
soundwire soundwire updates for 6.1-rc1 2022-10-07 16:13:55 -07:00
spi spi: Updates for v6.1 2022-10-04 19:36:53 -07:00
spmi spmi: pmic-arb: increase SPMI transaction timeout delay 2022-09-30 14:33:23 +02:00
ssb
staging Here's the main clk pull request for this merge window. We have some 2022-10-08 10:06:48 -07:00
target SCSI misc on 20221007 2022-10-07 12:33:18 -07:00
tc
tee ARM: driver updates for 6.1 2022-10-06 11:04:57 -07:00
thermal Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
thunderbolt USB/Thunderbolt changes for 6.1-rc1 2022-10-07 16:48:26 -07:00
tty TTY/Serial driver update for 6.1-rc1 2022-10-07 16:36:24 -07:00
ufs SCSI misc on 20221007 2022-10-07 12:33:18 -07:00
uio
usb USB/Thunderbolt changes for 6.1-rc1 2022-10-07 16:48:26 -07:00
vdpa Networking changes for 6.1. 2022-10-04 13:38:03 -07:00
vfio
vhost Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-10-03 17:44:18 -07:00
video drm pull for 6.1-rc1 2022-10-05 11:24:12 -07:00
virt Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
virtio
vlynq
w1 Char/Misc and other driver changes for 6.1-rc1 2022-10-08 08:56:37 -07:00
watchdog powerpc updates for 6.1 2022-10-09 14:05:15 -07:00
xen SCSI misc on 20221007 2022-10-07 12:33:18 -07:00
zorro
Kconfig
Makefile