|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v4.1 2/2] xen/evtchn: rework per event channel lock
On 04.11.20 16:29, Jan Beulich wrote: @@ -738,7 +725,8 @@ int evtchn_send(struct domain *ld, unsigned int lport)lchn = evtchn_from_port(ld, lport); - spin_lock_irqsave(&lchn->lock, flags);+ if ( !evtchn_read_trylock(lchn) ) + return 0;Isn't there a change in behavior here? While sends through ECS_UNBOUND ports indeed get silently ignored, ECS_FREE ones ought to be getting -EINVAL (as should ECS_UNBOUND ones if they're Xen-consumer ones). With the failed trylock you don't know which of the two the port is in the process of being transitioned to/from. The same would apply for other operations distinguishing the two states. Right now both evtchn_status() and evtchn_bind_vcpu() only use the domain-wide lock, but the latter is getting switched by "evtchn: convert domain event lock to an r/w one" (granted there's an RFC remark there whether that transformation is worthwhile). Anyway, the main point of my remark is that there's another subtlety here which I don't think becomes obvious from description or comments - where the two states are mentioned, it gets to look as if they can be treated equally. Hmm, evtchn_send() seems to be called always with interrupts enabled. We could just use a standard read_lock() here if you think the different states should be treated as today.
I wanted to have the locking functions in one place. In case you prefer it otherwise (and you seem to do so) I'd rather move the write lock functions to the .c file.
Fine with me Juergen
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |