Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LKMM: failing cmpxchg should have no ordering #60

Open
JonasOberhauser opened this issue May 24, 2024 · 1 comment
Open

LKMM: failing cmpxchg should have no ordering #60

JonasOberhauser opened this issue May 24, 2024 · 1 comment

Comments

@JonasOberhauser
Copy link

In LKMM, a failing cmpxchg is just a once access with no implied barriers.

Per my understanding, GenMC currently inserts atomic-related mb() around cmpxchg

https://github.com/MPI-SWS/genmc/blob/master/include/lkmm.h#L133

which in LKMM also provide ordering in case the RMW fails:

P0(int *x, int *y, int *z)
{
	WRITE_ONCE(*x, 1);
	smp_store_release(y, 1);
}

P1(int *x, int *y, int *z)
{
	int r = 2;
	if (atomic_cmpxchg(y, 2, 2)) {
		smp_mb__after_atomic();
		r = READ_ONCE(*x);
	}
}

exists (1:r=0) // impossible
@JonasOberhauser
Copy link
Author

https://github.com/MPI-SWS/genmc/blob/master/include/lkmm.h#L140C1-L144C1

the same issue appears here, these failed cmpxchg should have relaxed failure mode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant