xen-devel
[Xen-devel] Re: [RFC PATCH 28/33] Add Xen grant table support
To: |
Chris Wright <chrisw@xxxxxxxxxxxx> |
Subject: |
[Xen-devel] Re: [RFC PATCH 28/33] Add Xen grant table support |
From: |
Hollis Blanchard <hollisb@xxxxxxxxxx> |
Date: |
Tue, 25 Jul 2006 13:30:04 -0500 |
Cc: |
Andrew Morton <akpm@xxxxxxxx>, Jeremy Fitzhardinge <jeremy@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx, Ian Pratt <ian.pratt@xxxxxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, virtualization@xxxxxxxxxxxxxx, xen-ppc-devel <xen-ppc-devel@xxxxxxxxxxxxxxxxxxx> |
Delivery-date: |
Tue, 25 Jul 2006 11:29:45 -0700 |
Envelope-to: |
www-data@xxxxxxxxxxxxxxxxxx |
In-reply-to: |
<20060718091956.905130000@xxxxxxxxxxxx> |
List-help: |
<mailto:xen-devel-request@lists.xensource.com?subject=help> |
List-id: |
Xen developer discussion <xen-devel.lists.xensource.com> |
List-post: |
<mailto:xen-devel@lists.xensource.com> |
List-subscribe: |
<http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe> |
List-unsubscribe: |
<http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe> |
Organization: |
IBM Linux Technology Center |
References: |
<20060718091807.467468000@xxxxxxxxxxxx> <20060718091956.905130000@xxxxxxxxxxxx> |
Sender: |
xen-devel-bounces@xxxxxxxxxxxxxxxxxxx |
On Tue, 2006-07-18 at 00:00 -0700, Chris Wright wrote:
> +int gnttab_end_foreign_access_ref(grant_ref_t ref, int readonly)
> +{
> + u16 flags, nflags;
> +
> + nflags = shared[ref].flags;
> + do {
> + if ((flags = nflags) & (GTF_reading|GTF_writing)) {
> + printk(KERN_ALERT "WARNING: g.e. still in use!\n");
> + return 0;
> + }
> + } while ((nflags = synch_cmpxchg(&shared[ref].flags, flags, 0)) !=
> + flags);
> +
> + return 1;
> +}
>From patch 06/33:
+/*
+ * A grant table comprises a packed array of grant entries in one or
more
+ * page frames shared between Xen and a guest.
+ * [XEN]: This field is written by Xen and read by the sharing guest.
+ * [GST]: This field is written by the guest and read by Xen.
+ */
+struct grant_entry {
+ /* GTF_xxx: various type and flag information. [XEN,GST] */
+ uint16_t flags;
+ /* The domain being granted foreign privileges. [GST] */
+ domid_t domid;
+ /*
+ * GTF_permit_access: Frame that @domid is allowed to map and
access. [GST]
+ * GTF_accept_transfer: Frame whose ownership transferred by
@domid. [XEN]
+ */
+ uint32_t frame;
+};
I object to these uses of (synch_)cmpxchg on a uint16_t in common code.
Many architectures, including PowerPC, do not support 2-byte atomic
operations, but this code is common to all Xen architectures.
--
Hollis Blanchard
IBM Linux Technology Center
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|