[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Fix grant-ref allocation in netfront.
# HG changeset patch # User kaf24@xxxxxxxxxxxxxxxxxxxx # Node ID 56a2232377f1b3684da6e95a07f9854e40bc4ba7 # Parent 8d31f9a9c4232b8f9d0200d0a3d312170c197f63 Fix grant-ref allocation in netfront. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> diff -r 8d31f9a9c423 -r 56a2232377f1 linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c --- a/linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c Thu Aug 25 13:27:10 2005 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c Thu Aug 25 14:30:06 2005 @@ -34,9 +34,11 @@ EXPORT_SYMBOL(gnttab_grant_foreign_access); +EXPORT_SYMBOL(gnttab_end_foreign_access_ref); EXPORT_SYMBOL(gnttab_end_foreign_access); EXPORT_SYMBOL(gnttab_query_foreign_access); EXPORT_SYMBOL(gnttab_grant_foreign_transfer); +EXPORT_SYMBOL(gnttab_end_foreign_transfer_ref); EXPORT_SYMBOL(gnttab_end_foreign_transfer); EXPORT_SYMBOL(gnttab_alloc_grant_references); EXPORT_SYMBOL(gnttab_free_grant_references); @@ -160,7 +162,7 @@ } void -gnttab_end_foreign_access(grant_ref_t ref, int readonly) +gnttab_end_foreign_access_ref(grant_ref_t ref, int readonly) { u16 flags, nflags; @@ -170,7 +172,12 @@ printk(KERN_ALERT "WARNING: g.e. still in use!\n"); } while ( (nflags = synch_cmpxchg(&shared[ref].flags, flags, 0)) != flags ); - +} + +void +gnttab_end_foreign_access(grant_ref_t ref, int readonly) +{ + gnttab_end_foreign_access_ref(ref, readonly); put_free_entry(ref); } @@ -201,20 +208,13 @@ } unsigned long -gnttab_end_foreign_transfer(grant_ref_t ref) +gnttab_end_foreign_transfer_ref(grant_ref_t ref) { unsigned long frame = 0; u16 flags; flags = shared[ref].flags; -#ifdef CONFIG_XEN_NETDEV_GRANT_RX - /* - * But can't flags == (GTF_accept_transfer | GTF_transfer_completed) - * if gnttab_donate executes without interruption??? - */ -#else - ASSERT(flags == (GTF_accept_transfer | GTF_transfer_committed)); -#endif + /* * If a transfer is committed then wait for the frame address to appear. * Otherwise invalidate the grant entry against future use. @@ -224,8 +224,14 @@ while ( unlikely((frame = shared[ref].frame) == 0) ) cpu_relax(); + return frame; +} + +unsigned long +gnttab_end_foreign_transfer(grant_ref_t ref) +{ + unsigned long frame = gnttab_end_foreign_transfer_ref(ref); put_free_entry(ref); - return frame; } diff -r 8d31f9a9c423 -r 56a2232377f1 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Thu Aug 25 13:27:10 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Thu Aug 25 14:30:06 2005 @@ -363,7 +363,7 @@ "still in use by backend domain.\n"); goto out; } - gnttab_end_foreign_access(grant_tx_ref[id], GNTMAP_readonly); + gnttab_end_foreign_access_ref(grant_tx_ref[id], GNTMAP_readonly); gnttab_release_grant_reference(&gref_tx_head, grant_tx_ref[id]); grant_tx_ref[id] = GRANT_INVALID_REF; #endif @@ -649,7 +649,7 @@ #ifdef CONFIG_XEN_NETDEV_GRANT_RX ref = grant_rx_ref[rx->id]; grant_rx_ref[rx->id] = GRANT_INVALID_REF; - mfn = gnttab_end_foreign_transfer(ref); + mfn = gnttab_end_foreign_transfer_ref(ref); gnttab_release_grant_reference(&gref_rx_head, ref); #endif diff -r 8d31f9a9c423 -r 56a2232377f1 linux-2.6-xen-sparse/include/asm-xen/gnttab.h --- a/linux-2.6-xen-sparse/include/asm-xen/gnttab.h Thu Aug 25 13:27:10 2005 +++ b/linux-2.6-xen-sparse/include/asm-xen/gnttab.h Thu Aug 25 14:30:06 2005 @@ -30,10 +30,12 @@ int gnttab_grant_foreign_access(domid_t domid, unsigned long frame, int readonly); +void gnttab_end_foreign_access_ref(grant_ref_t ref, int readonly); void gnttab_end_foreign_access(grant_ref_t ref, int readonly); int gnttab_grant_foreign_transfer(domid_t domid, unsigned long pfn); +unsigned long gnttab_end_foreign_transfer_ref(grant_ref_t ref); unsigned long gnttab_end_foreign_transfer(grant_ref_t ref); int gnttab_query_foreign_access(grant_ref_t ref); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |