ionic: avoid races in ionic_heartbeat_check

Rework the heartbeat checks to be sure that we're getting an
atomic operation.  Through testing we found occasions where a
separate thread could clash with this check and cause erroneous
heartbeat check results.

Signed-off-by: Allen Hubbe <allenbh@pensando.io>
Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Shannon Nelson
2021-03-30 12:52:09 -07:00
committed by David S. Miller
parent 230efff47a
commit b2b9a8d7ed
2 changed files with 63 additions and 37 deletions

View File

@@ -4,6 +4,7 @@
#ifndef _IONIC_DEV_H_
#define _IONIC_DEV_H_
#include <linux/atomic.h>
#include <linux/mutex.h>
#include <linux/workqueue.h>
@@ -135,9 +136,11 @@ struct ionic_dev {
union ionic_dev_info_regs __iomem *dev_info_regs;
union ionic_dev_cmd_regs __iomem *dev_cmd_regs;
atomic_long_t last_check_time;
unsigned long last_hb_time;
u32 last_hb;
u8 last_fw_status;
u32 last_fw_hb;
bool fw_hb_ready;
bool fw_status_ready;
u64 __iomem *db_pages;
dma_addr_t phy_db_pages;