Re: [PATCH 2/2] xen: privcmd: Add support for ioeventfd

From: Juergen Gross
Date: Mon Oct 09 2023 - 06:58:34 EST


On 09.10.23 12:53, Viresh Kumar wrote:
On 09-10-23, 10:40, Alex Bennée wrote:
I thought generally sync points act as full barriers. Doing a bunch of
grepping I think ends at:

static __always_inline bool __mutex_unlock_fast(struct mutex *lock)
{
unsigned long curr = (unsigned long)current;

return atomic_long_try_cmpxchg_release(&lock->owner, &curr, 0UL);
}

so you should already have completed your writes by that point.

I am not sure if depending on such indirect mechanisms to implement
barriers for you is a good idea.

The situation here probably requires explicit barriers to make sure it
doesn't break in future ?


Depending on lock implementations to include the needed barriers is fine IMO.

That is one central objective locks must ensure: to make sure any updates in
a locked region are operating on consistent data and being observable by
others after leaving the locked region.


Juergen

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature