Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jul 2022 19:31:03 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: d91776d81bb2 - stable/13 - ena: Make first_interrupt a uint8_t
Message-ID:  <202207261931.26QJV3ds029865@gitrepo.freebsd.org>

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

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

commit d91776d81bb2f44b994905f3aeaedaecbfead93a
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:30:17 +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 3f2aa1ffcd49..ad4fa357e595 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 4e1f75cd8f9a..f79e311fc88d 100644
--- a/sys/dev/ena/ena.h
+++ b/sys/dev/ena/ena.h
@@ -329,7 +329,7 @@ struct ena_ring {
 
 	};
 
-	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 c4c9ad3403c6..1bd901a30059 100644
--- a/sys/dev/ena/ena_datapath.c
+++ b/sys/dev/ena/ena_datapath.c
@@ -90,8 +90,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?202207261931.26QJV3ds029865>