NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/55745: spdmem_i2c_match() panics

The following reply was made to PR kern/55745; it has been noted by GNATS.

From: Robert Elz <kre%munnari.OZ.AU@localhost>
Subject: Re: kern/55745: spdmem_i2c_match() panics
Date: Tue, 17 Nov 2020 21:18:22 +0700

 I would not use
 	if (!cold)
 in piixpm_i2c_dummy_release_bus() or whatever that function ends
 up being called, there must be some chance that the system will
 transition from cold to !cold while the code that happens between
 the piixpm_i2c_dummy_acquire_bus() and piixpm_i2c_dummy_release_bus()
 is running, in which case the latter will attempt to exit a mutex
 that has never been entered.
 Instead, have the acquire() function remember in a state bit whether
 it attempted to enter the mutex or notm (ie: entered it, there is no
 tried and failed), and then exit it only when it was actually entered.
 Even if it is (apparently) impossible for the cold->!cold transition
 to happen during this period, writing it this way makes it safer
 against later modifications in how other parts of the system work.

Home | Main Index | Thread Index | Old Index