From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751143AbXBPG6E (ORCPT ); Fri, 16 Feb 2007 01:58:04 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751146AbXBPG6D (ORCPT ); Fri, 16 Feb 2007 01:58:03 -0500 Received: from gw.goop.org ([64.81.55.164]:39206 "EHLO mail.goop.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751143AbXBPG6B (ORCPT ); Fri, 16 Feb 2007 01:58:01 -0500 Message-ID: <45D555F9.7010203@goop.org> Date: Thu, 15 Feb 2007 22:58:01 -0800 From: Jeremy Fitzhardinge User-Agent: Thunderbird 1.5.0.9 (X11/20070212) MIME-Version: 1.0 To: Andrew Morton CC: Andi Kleen , linux-kernel@vger.kernel.org, virtualization@lists.osdl.org, xen-devel@lists.xensource.com, Chris Wright , Zachary Amsden , Ian Pratt , Christian Limpach Subject: Re: [patch 18/21] Xen-paravirt: Add Xen grant table support References: <20070216022449.739760547@goop.org> <20070216022531.904462260@goop.org> <20070215225229.6b63d050.akpm@linux-foundation.org> In-Reply-To: <20070215225229.6b63d050.akpm@linux-foundation.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Andrew Morton wrote: > On Thu, 15 Feb 2007 18:25:07 -0800 Jeremy Fitzhardinge wrote: > > >> +int gnttab_grant_foreign_access(domid_t domid, unsigned long frame, >> + int readonly) >> +{ >> + int ref; >> + >> + if (unlikely((ref = get_free_entry()) == -1)) >> + return -ENOSPC; >> + >> + shared[ref].frame = frame; >> + shared[ref].domid = domid; >> + wmb(); >> + shared[ref].flags = GTF_permit_access | (readonly ? GTF_readonly : 0); >> + >> + return ref; >> +} >> +EXPORT_SYMBOL_GPL(gnttab_grant_foreign_access); >> > > We have lots of open-coded mysteriously unexplained barriers in here. > > I assume they're not smp_wmb() because this could be a !SMP guest talking > to an SMP host? > Yeah. The grant tables refer to pages which are shared with other domains, so they could be running on other cpus even if this domain is UP. There's a lockless protocol going on here, but I'll need to look it up and sprinkle some comments. J