linux/drivers/scsi/qedf
Sebastian Andrzej Siewior a912460efa scsi: fcoe: Use per-CPU API to update per-CPU statistics
The per-CPU statistics (struct fc_stats) is updated by getting a stable
per-CPU pointer via get_cpu() + per_cpu_ptr() and then performing the
increment. This can be optimized by using this_cpu_*() which will do
whatever is needed on the architecture to perform the update safe and
efficient.  The read out of the individual value (fc_get_host_stats())
should be done by using READ_ONCE() instead of a plain-C access. The
difference is that READ_ONCE() will always perform a single access while
the plain-C access can be split by the compiler into two loads if it
appears beneficial.  The usage of u64 has the side-effect that it is also
64bit wide on 32bit architectures and the read is always split into two
loads. The can lead to strange values if the read happens during an update
which alters both 32bit parts of the 64bit value. This can be circumvented
by either using a 32bit variables on 32bit architecures or extending the
statistics with a sequence counter.

Use this_cpu_*() API to update the statistics and READ_ONCE() to read it.

Link: https://lore.kernel.org/r/20220506105758.283887-3-bigeasy@linutronix.de
Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-05-16 21:26:50 -04:00
..
drv_fcoe_fw_funcs.c qed: Remove e4_ and _e4 from FW HSI 2021-10-04 12:55:48 +01:00
drv_fcoe_fw_funcs.h qed: Remove e4_ and _e4 from FW HSI 2021-10-04 12:55:48 +01:00
drv_scsi_fw_funcs.c
drv_scsi_fw_funcs.h
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile
qedf.h scsi: qedf: Stop using the SCSI pointer 2022-02-22 21:11:05 -05:00
qedf_attr.c scsi: qedf: Remove unnecessary code 2022-04-25 23:36:31 -04:00
qedf_dbg.c scsi: qedf: Use vzalloc() instead of vmalloc()/memset(0) 2021-05-21 16:31:17 -04:00
qedf_dbg.h scsi: qedf: Remove unused include of linux/version.h 2021-04-05 23:45:23 -04:00
qedf_debugfs.c scsi: qedf: Demote obvious misuse of kerneldoc to standard comment blocks 2020-07-15 16:01:58 -04:00
qedf_els.c qed: Remove e4_ and _e4 from FW HSI 2021-10-04 12:55:48 +01:00
qedf_fip.c scsi: qedf: Remove redundant initialization of variable rc 2020-06-02 21:44:14 -04:00
qedf_hsi.h
qedf_io.c scsi: qedf: Stop using the SCSI pointer 2022-02-22 21:11:05 -05:00
qedf_main.c scsi: fcoe: Use per-CPU API to update per-CPU statistics 2022-05-16 21:26:50 -04:00
qedf_version.h scsi: qedf: Update the version to 8.42.3.0 2019-08-29 18:51:19 -04:00