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

Re: [Xen-devel][Pv-ops][PATCH] Netback multiple tasklet support



On Wed, 2009-12-09 at 20:23 +0000, Jeremy Fitzhardinge wrote:
> 
> I've pushed this out in its own branch: 
> xen/dom0/backend/netback-tasklet; please post any future patches
> against 
> this branch. 

This is probably a bit pointless given the code is commented out but I
wanted to get it out there while it was in my head:

Subject: xen: ensure locking gnttab_copy_grant_page is safe against interrupts.

Now that netback processing occurs in a thread instead of a tasklet
gnttab_copy_grant_page needs to be safe against interrupts.

The code is currently commented out in this tree but on 2.6.18 we observed a
deadlock where the netback thread called gnttab_copy_grant_page, locked
gnttab_dma_lock for writing, was interrupted and on return from interrupt the
network stack's TX tasklet ended up calling __gnttab_dma_map_page via the
hardware driver->swiotlb and tries to take gnttab_dma_lock for reading.

Correct the commented code so we don't get bitten if/when it is re-enabled.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>#
Cc: "Xu, Dongxiao" <dongxiao.xu@xxxxxxxxx>
---
 drivers/xen/grant-table.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index c653970..f25a2bc 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -828,14 +828,14 @@ int gnttab_copy_grant_page(grant_ref_t ref, struct page 
**pagep)
        mfn = pfn_to_mfn(pfn);
        new_mfn = virt_to_mfn(new_addr);
 
-//     write_seqlock(&gnttab_dma_lock); /* protects __gnttab_dma_map_page on 
2.6.18 */
+//     write_seqlock_irq(&gnttab_dma_lock); /* protects __gnttab_dma_map_page 
on 2.6.18 */
 
        /* Make seq visible before checking page_mapped. */
        smp_mb();
 
        /* Has the page been DMA-mapped? */
        if (unlikely(page_mapped(page))) {
-               //write_sequnlock(&gnttab_dma_lock);
+               //write_sequnlock_irq(&gnttab_dma_lock);
                put_page(new_page);
                err = -EBUSY;
                goto out;
@@ -855,7 +855,7 @@ int gnttab_copy_grant_page(grant_ref_t ref, struct page 
**pagep)
        BUG_ON(err);
        BUG_ON(unmap.status);
 
-//     write_sequnlock(&gnttab_dma_lock);
+//     write_sequnlock_irq(&gnttab_dma_lock);
 
        if (!xen_feature(XENFEAT_auto_translated_physmap)) {
                set_phys_to_machine(page_to_pfn(new_page), INVALID_P2M_ENTRY);
-- 
1.5.6.5




_______________________________________________
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®.