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

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

 



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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux