From: Ian Campbell Subject: Re: [PATCH] ARM: cache coherence problem in guestcopy.c Date: Tue, 18 Jun 2013 13:18:53 +0100 Message-ID: <1371557933.22783.17.camel@zakaz.uk.xensource.com> References: <17177098.345811371557146762.JavaMail.weblogic@epv6ml06> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <17177098.345811371557146762.JavaMail.weblogic@epv6ml06> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: jaeyong.yoo@samsung.com Cc: Tim Deegan , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Tue, 2013-06-18 at 12:05 +0000, Jaeyong Yoo wrote: > > We were also speculating that we probably want some DMBs in > > context_switch_{from,to} as well as at return_to_guest. > > Actually, I just learned ReOrder Buffer, and it looks like so. Right. Tim and I were speculating about where and why the barriers were needed: In unmap_domain_page: This ensures any writes to domain memory via the Xen mapping are seen by subsequent accesses via the guest mapping. Likewise map_domain_page needs one to ensure that previous accesses via the guest mapping will be observed (this is the issue you observed). In context_switch_from: To ensure any writes done on a VCPU are seen before it is rescheduled, potentially on another PCPU. It seems likely that you'd want one in context_switch_to for the complementary reasons, In return_to_guest: This is similar to the unmap_domain_page one but handles writes to pages which are permanently shared by Xen and the guest, e.g. the shared info page or anything mapped with share_xen_page_with_guest etc. This one is debatable because all users of this are, I think, expected to get their own barriers correct since this these pages are typically part of some lock free datastructure arrangement. Ian.