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

[Xen-devel] Re: [RFC PATCH 28/33] Add Xen grant table support



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


 


Rackspace

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