Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jul 2022 19:33:34 GMT
From:      Marcin Wojtas <mw@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 5393b9247fb0 - stable/12 - ena: Make first_interrupt a uint8_t
Message-ID:  <202207261933.26QJXYfr034031@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by mw:

URL: https://cgit.FreeBSD.org/src/commit/?id=5393b9247fb0262441c21534e2f9d41cff81fc4d

commit 5393b9247fb0262441c21534e2f9d41cff81fc4d
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-06-30 18:49:46 +0000
Commit:     Marcin Wojtas <mw@FreeBSD.org>
CommitDate: 2022-07-26 19:33:05 +0000

    ena: Make first_interrupt a uint8_t
    
    We do not have atomic(9) routines for bools, and it is not guaranteed
    that sizeof(bool) is 1.
    
    This fixes the KASAN and KMSAN kernel builds, which fail because the
    compiler refuses to silently cast a _Bool * to a uint8_t * when calling
    the atomic(9) sanitizer interceptors.
    
    Reviewed by:    Dawid Górecki <dgr@semihalf.com>
    MFC after:      2 weeks
    Fixes:  0ac122c388d9 ("ena: Use atomic_load/store functions for first_interrupt variable")
    Differential Revision:  https://reviews.freebsd.org/D35683
    
    (cherry picked from commit b72f1f4516896ad6da0ea74d146a56045de171f7)
---
 sys/dev/ena/ena.c          | 2 +-
 sys/dev/ena/ena.h          | 2 +-
 sys/dev/ena/ena_datapath.c | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/dev/ena/ena.c b/sys/dev/ena/ena.c
index a7d177454075..3efc0021a746 100644
--- a/sys/dev/ena/ena.c
+++ b/sys/dev/ena/ena.c
@@ -376,7 +376,7 @@ ena_init_io_rings_common(struct ena_adapter *adapter, struct ena_ring *ring,
 	ring->qid = qid;
 	ring->adapter = adapter;
 	ring->ena_dev = adapter->ena_dev;
-	atomic_store_8(&ring->first_interrupt, false);
+	atomic_store_8(&ring->first_interrupt, 0);
 	ring->no_interrupt_event_cnt = 0;
 }
 
diff --git a/sys/dev/ena/ena.h b/sys/dev/ena/ena.h
index 013b7f0360cc..b6cf9b8d3758 100644
--- a/sys/dev/ena/ena.h
+++ b/sys/dev/ena/ena.h
@@ -328,7 +328,7 @@ struct ena_ring {
 		uint16_t rx_mbuf_sz;
 	};
 
-	bool first_interrupt;
+	uint8_t first_interrupt;
 	uint16_t no_interrupt_event_cnt;
 
 	struct ena_com_rx_buf_info ena_bufs[ENA_PKT_MAX_BUFS];
diff --git a/sys/dev/ena/ena_datapath.c b/sys/dev/ena/ena_datapath.c
index a5c4eec43f67..9b41f4bcc773 100644
--- a/sys/dev/ena/ena_datapath.c
+++ b/sys/dev/ena/ena_datapath.c
@@ -91,8 +91,8 @@ ena_cleanup(void *arg, int pending)
 	ena_qid = ENA_IO_TXQ_IDX(qid);
 	io_cq = &adapter->ena_dev->io_cq_queues[ena_qid];
 
-	atomic_store_8(&tx_ring->first_interrupt, true);
-	atomic_store_8(&rx_ring->first_interrupt, true);
+	atomic_store_8(&tx_ring->first_interrupt, 1);
+	atomic_store_8(&rx_ring->first_interrupt, 1);
 
 	for (i = 0; i < ENA_CLEAN_BUDGET; ++i) {
 		rxc = ena_rx_cleanup(rx_ring);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202207261933.26QJXYfr034031>