Index | Thread | Search

From:
Alexander Bluhm <alexander.bluhm@gmx.net>
Subject:
Re: ixl - witness: lock_object uninitialized
To:
Hrvoje Popovski <hrvoje@srce.hr>
Cc:
tech@openbsd.org
Date:
Sat, 6 Jan 2024 12:12:53 +0100

Download raw body.

Thread
On Sat, Jan 06, 2024 at 12:41:57AM +0100, Hrvoje Popovski wrote:
> when compiling source with WITNESS I'm getting
> witness: lock_object uninitialized while booting box with ixl interfaces.
> First I thought maybe it's kettenis@ ipl diff but I'm getting same logs
> with intrdefs.h,v 1.22
> 
> ixl interfaces seems fine, I can see then with ifconfig, attach ip
> address to them and ping something ...

Mutex must be initialize before using it.  Moving mtx_init() up
should fix it.  Diff is completetely untested.

bluhm

Index: dev/pci/if_ixl.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/dev/pci/if_ixl.c,v
diff -u -p -r1.94 if_ixl.c
--- dev/pci/if_ixl.c	30 Dec 2023 17:52:27 -0000	1.94
+++ dev/pci/if_ixl.c	6 Jan 2024 11:08:25 -0000
@@ -1881,6 +1881,7 @@ ixl_attach(struct device *parent, struct
 		goto free_hmc;
 	}
 
+	mtx_init(&sc->sc_link_state_mtx, IPL_NET);
 	if (ixl_get_link_status(sc) != 0) {
 		/* error printed by ixl_get_link_status */
 		goto free_hmc;
@@ -1987,7 +1988,6 @@ ixl_attach(struct device *parent, struct
 	if_attach_queues(ifp, nqueues);
 	if_attach_iqueues(ifp, nqueues);
 
-	mtx_init(&sc->sc_link_state_mtx, IPL_NET);
 	task_set(&sc->sc_link_state_task, ixl_link_state_update, sc);
 	ixl_wr(sc, I40E_PFINT_ICR0_ENA,
 	    I40E_PFINT_ICR0_ENA_LINK_STAT_CHANGE_MASK |