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

Re: [Xen-devel] [PATCH v4 03/11] x86/mce: handle host LMCE



>>> <haozhong.zhang@xxxxxxxxx> 06/29/17 5:29 AM >>>
>On 06/27/17 01:13 -0600, Jan Beulich wrote:
>> >>> Haozhong Zhang <haozhong.zhang@xxxxxxxxx> 06/26/17 11:17 AM >>>
>> >+   if (mctctl->pending)
>> >+           mctelem_xchg_head(&mctctl->pending, &tep->mcte_next, tep);
>> >+   else if (lmce)
>> >+           mctelem_xchg_head(&mctctl->lmce_pending, &tep->mcte_next, tep);
>> >+   else {
>> >+           if (mctctl->lmce_pending)
>> >+                   mctelem_xchg_head(&mctctl->lmce_pending,
>> >+                                     &mctctl->pending, NULL);
>> 
>> I don't think this is sufficiently proven to be safe: This may set ->pending 
>> to
>> non-NULL more than once, and while your comment above considers the
>> producer side, it doesn't consider the consumer(s). This is even more so that
>> the consumer side uses potentially stale information to tell which list head 
>> to
>> update.
>
>What problems do you think will be caused by setting ->pending to
>non-NULL more than once? The only such case is the last else branch:
>it corresponds to a broadcasting MC#, so all CPUs are in the exception
>context and no one is consuming ->pending at this moment.

Right, but for cases like this I think it is necessary to make this explicit via
adding a comment. The operation by itself is not as atomic as we'd want it
to be without having to consider the context in which it is being used.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.