Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/_smr.h
Show All 29 Lines | |||||
#ifndef _SYS__SMR_H_ | #ifndef _SYS__SMR_H_ | ||||
#define _SYS__SMR_H_ | #define _SYS__SMR_H_ | ||||
typedef uint32_t smr_seq_t; | typedef uint32_t smr_seq_t; | ||||
typedef int32_t smr_delta_t; | typedef int32_t smr_delta_t; | ||||
typedef struct smr *smr_t; | typedef struct smr *smr_t; | ||||
#define SMR_ENTERED(smr) \ | |||||
(curthread->td_critnest != 0 && zpcpu_get((smr))->c_seq != SMR_SEQ_INVALID) | |||||
jeff: For this assert to work you will need to move the smr structure into _smr.h. | |||||
Done Inline ActionsIf code is using SMR_ENTERED() then it will presumably have called smr_enter() somewhere in the same file, in which case smr.h is included already. Most of the macros in smr_types.h can be used without smr.h. markj: If code is using SMR_ENTERED() then it will presumably have called smr_enter() somewhere in the… | |||||
#define SMR_ASSERT_ENTERED(smr) \ | |||||
KASSERT(SMR_ENTERED(smr), ("Not in smr section")) | |||||
#define SMR_ASSERT_NOT_ENTERED(smr) \ | |||||
KASSERT(!SMR_ENTERED(smr), ("In smr section.")); | |||||
jeffUnsubmitted Not Done Inline ActionsShould possibly use SMR_ASSERT for this jeff: Should possibly use SMR_ASSERT for this | |||||
markjAuthorUnsubmitted Done Inline ActionsIt'd then print "Assertion curthread->td_critnest != 0 && ... failed" which seems less clear than "In smr section". markj: It'd then print "Assertion curthread->td_critnest != 0 && ... failed" which seems less clear… | |||||
rlibbyUnsubmitted Not Done Inline ActionsIt seems like SMR_ASSERT's value is providing the equivalent of __func__ for the macros where it's used, which doesn't seem valuable for SMR_ASSERT_ENTERED/NOT_ENTERED. rlibby: It seems like SMR_ASSERT's value is providing the equivalent of `__func__` for the macros where… | |||||
#define SMR_ASSERT(ex, fn) \ | |||||
KASSERT((ex), (fn ": Assertion " #ex " failed at %s:%d", __FILE__, __LINE__)) | |||||
#endif /* __SYS_SMR_H_ */ | #endif /* __SYS_SMR_H_ */ |
For this assert to work you will need to move the smr structure into _smr.h.